(window.webpackJsonp=window.webpackJsonp||[]).push([[183,5,7],{"+NIl":function(vt,et,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"use strict";ae.defineMode("stex",function(J,D){"use strict";function Y(u,r){u.cmdState.push(r)}function F(u){return u.cmdState.length>0?u.cmdState[u.cmdState.length-1]:null}function U(u){var r=u.cmdState.pop();r&&r.closeBracket()}function W(u){for(var r=u.cmdState,d=r.length-1;d>=0;d--){var o=r[d];if(o.name=="DEFAULT")continue;return o}return{styleIdentifier:function(){return null}}}function j(u,r,d){return function(){this.name=u,this.bracketNo=0,this.style=r,this.styles=d,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var k={};k.importmodule=j("importmodule","tag",["string","builtin"]),k.documentclass=j("documentclass","tag",["","atom"]),k.usepackage=j("usepackage","tag",["atom"]),k.begin=j("begin","tag",["atom"]),k.end=j("end","tag",["atom"]),k.label=j("label","tag",["atom"]),k.ref=j("ref","tag",["atom"]),k.eqref=j("eqref","tag",["atom"]),k.cite=j("cite","tag",["atom"]),k.bibitem=j("bibitem","tag",["atom"]),k.Bibitem=j("Bibitem","tag",["atom"]),k.RBibitem=j("RBibitem","tag",["atom"]),k.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function I(u,r){u.f=r}function m(u,r){var d;if(u.match(/^\\[a-zA-Z@]+/)){var o=u.current().slice(1);return d=k.hasOwnProperty(o)?k[o]:k.DEFAULT,d=new d,Y(r,d),I(r,f),d.style}if(u.match(/^\\[$&%#{}_]/))return"tag";if(u.match(/^\\[,;!\/\\]/))return"tag";if(u.match("\\["))return I(r,function(l,p){return c(l,p,"\\]")}),"keyword";if(u.match("\\("))return I(r,function(l,p){return c(l,p,"\\)")}),"keyword";if(u.match("$$"))return I(r,function(l,p){return c(l,p,"$$")}),"keyword";if(u.match("$"))return I(r,function(l,p){return c(l,p,"$")}),"keyword";var s=u.next();if(s=="%")return u.skipToEnd(),"comment";if(s=="}"||s=="]"){if(d=F(r),d)d.closeBracket(s),I(r,f);else return"error";return"bracket"}else return s=="{"||s=="["?(d=k.DEFAULT,d=new d,Y(r,d),"bracket"):/\d/.test(s)?(u.eatWhile(/[\w.%]/),"atom"):(u.eatWhile(/[\w\-_]/),d=W(r),d.name=="begin"&&(d.argument=u.current()),d.styleIdentifier())}function c(u,r,d){if(u.eatSpace())return null;if(d&&u.match(d))return I(r,m),"keyword";if(u.match(/^\\[a-zA-Z@]+/))return"tag";if(u.match(/^[a-zA-Z]+/))return"variable-2";if(u.match(/^\\[$&%#{}_]/))return"tag";if(u.match(/^\\[,;!\/]/))return"tag";if(u.match(/^[\^_&]/))return"tag";if(u.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(u.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var o=u.next();return o=="{"||o=="}"||o=="["||o=="]"||o=="("||o==")"?"bracket":o=="%"?(u.skipToEnd(),"comment"):"error"}function f(u,r){var d=u.peek(),o;return d=="{"||d=="["?(o=F(r),o.openBracket(d),u.eat(d),I(r,m),"bracket"):/[ \t\r]/.test(d)?(u.eat(d),null):(I(r,m),U(r),m(u,r))}return{startState:function(){var u=D.inMathMode?function(r,d){return c(r,d)}:m;return{cmdState:[],f:u}},copyState:function(u){return{cmdState:u.cmdState.slice(),f:u.f}},token:function(u,r){return r.f(u,r)},blankLine:function(u){u.f=m,u.cmdState.length=0},lineComment:"%"}}),ae.defineMIME("text/x-stex","stex"),ae.defineMIME("text/x-latex","stex")})},"+ua5":function(vt,et,ne){},"19Vz":function(vt,et,ne){(function(ae){ae(ne("VrN/"))})(function(ae){ae.defineOption("placeholder","",function(j,k,I){var m=I&&I!=ae.Init;if(k&&!m)j.on("blur",F),j.on("change",U),j.on("swapDoc",U),ae.on(j.getInputField(),"compositionupdate",j.state.placeholderCompose=function(){Y(j)}),U(j);else if(!k&&m){j.off("blur",F),j.off("change",U),j.off("swapDoc",U),ae.off(j.getInputField(),"compositionupdate",j.state.placeholderCompose),J(j);var c=j.getWrapperElement();c.className=c.className.replace(" CodeMirror-empty","")}k&&!j.hasFocus()&&F(j)});function J(j){j.state.placeholder&&(j.state.placeholder.parentNode.removeChild(j.state.placeholder),j.state.placeholder=null)}function D(j){J(j);var k=j.state.placeholder=document.createElement("pre");k.style.cssText="height: 0; overflow: visible",k.style.direction=j.getOption("direction"),k.className="CodeMirror-placeholder CodeMirror-line-like";var I=j.getOption("placeholder");typeof I=="string"&&(I=document.createTextNode(I)),k.appendChild(I),j.display.lineSpace.insertBefore(k,j.display.lineSpace.firstChild)}function Y(j){setTimeout(function(){var k=!1,I=j.getInputField();I.nodeName=="TEXTAREA"?k=!I.value:j.lineCount()==1&&(k=!/[^\u200b]/.test(I.querySelector(".CodeMirror-line").textContent)),k?D(j):J(j)},20)}function F(j){W(j)&&D(j)}function U(j){var k=j.getWrapperElement(),I=W(j);k.className=k.className.replace(" CodeMirror-empty","")+(I?" CodeMirror-empty":""),I?D(j):J(j)}function W(j){return j.lineCount()===1&&j.getLine(0)===""}})},"1eCo":function(vt,et,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"use strict";var J={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},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ae.defineMode("xml",function(Y,F){var U=Y.indentUnit,W={},j=F.htmlMode?J:D;for(var k in j)W[k]=j[k];for(var k in F)W[k]=F[k];var I,m;function c(h,_){function g(P){return _.tokenize=P,P(h,_)}var b=h.next();if(b=="<")return h.eat("!")?h.eat("[")?h.match("CDATA[")?g(r("atom","]]>")):null:h.match("--")?g(r("comment","-->")):h.match("DOCTYPE",!0,!0)?(h.eatWhile(/[\w\._\-]/),g(d(1))):null:h.eat("?")?(h.eatWhile(/[\w\._\-]/),_.tokenize=r("meta","?>"),"meta"):(I=h.eat("/")?"closeTag":"openTag",_.tokenize=f,"tag bracket");if(b=="&"){var M;return h.eat("#")?h.eat("x")?M=h.eatWhile(/[a-fA-F\d]/)&&h.eat(";"):M=h.eatWhile(/[\d]/)&&h.eat(";"):M=h.eatWhile(/[\w\.\-:]/)&&h.eat(";"),M?"atom":"error"}else return h.eatWhile(/[^&<]/),null}c.isInText=!0;function f(h,_){var g=h.next();if(g==">"||g=="/"&&h.eat(">"))return _.tokenize=c,I=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return I="equals",null;if(g=="<"){_.tokenize=c,_.state=p,_.tagName=_.tagStart=null;var b=_.tokenize(h,_);return b?b+" tag error":"tag error"}else return/[\'\"]/.test(g)?(_.tokenize=u(g),_.stringStartCol=h.column(),_.tokenize(h,_)):(h.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function u(h){var _=function(g,b){for(;!g.eol();)if(g.next()==h){b.tokenize=f;break}return"string"};return _.isInAttribute=!0,_}function r(h,_){return function(g,b){for(;!g.eol();){if(g.match(_)){b.tokenize=c;break}g.next()}return h}}function d(h){return function(_,g){for(var b;(b=_.next())!=null;){if(b=="<")return g.tokenize=d(h+1),g.tokenize(_,g);if(b==">")if(h==1){g.tokenize=c;break}else return g.tokenize=d(h-1),g.tokenize(_,g)}return"meta"}}function o(h,_,g){this.prev=h.context,this.tagName=_,this.indent=h.indented,this.startOfLine=g,(W.doNotIndent.hasOwnProperty(_)||h.context&&h.context.noIndent)&&(this.noIndent=!0)}function s(h){h.context&&(h.context=h.context.prev)}function l(h,_){for(var g;;){if(!h.context)return;if(g=h.context.tagName,!W.contextGrabbers.hasOwnProperty(g)||!W.contextGrabbers[g].hasOwnProperty(_))return;s(h)}}function p(h,_,g){return h=="openTag"?(g.tagStart=_.column(),R):h=="closeTag"?w:p}function R(h,_,g){return h=="word"?(g.tagName=_.current(),m="tag",A):W.allowMissingTagName&&h=="endTag"?(m="tag bracket",A(h,_,g)):(m="error",R)}function w(h,_,g){if(h=="word"){var b=_.current();return g.context&&g.context.tagName!=b&&W.implicitlyClosed.hasOwnProperty(g.context.tagName)&&s(g),g.context&&g.context.tagName==b||W.matchClosing===!1?(m="tag",x):(m="tag error",O)}else return W.allowMissingTagName&&h=="endTag"?(m="tag bracket",x(h,_,g)):(m="error",O)}function x(h,_,g){return h!="endTag"?(m="error",x):(s(g),p)}function O(h,_,g){return m="error",x(h,_,g)}function A(h,_,g){if(h=="word")return m="attribute",T;if(h=="endTag"||h=="selfcloseTag"){var b=g.tagName,M=g.tagStart;return g.tagName=g.tagStart=null,h=="selfcloseTag"||W.autoSelfClosers.hasOwnProperty(b)?l(g,b):(l(g,b),g.context=new o(g,b,M==g.indented)),p}return m="error",A}function T(h,_,g){return h=="equals"?E:(W.allowMissing||(m="error"),A(h,_,g))}function E(h,_,g){return h=="string"?y:h=="word"&&W.allowUnquoted?(m="string",A):(m="error",A(h,_,g))}function y(h,_,g){return h=="string"?y:A(h,_,g)}return{startState:function(h){var _={tokenize:c,state:p,indented:h||0,tagName:null,tagStart:null,context:null};return h!=null&&(_.baseIndent=h),_},token:function(h,_){if(!_.tagName&&h.sol()&&(_.indented=h.indentation()),h.eatSpace())return null;I=null;var g=_.tokenize(h,_);return(g||I)&&g!="comment"&&(m=null,_.state=_.state(I||g,h,_),m&&(g=m=="error"?g+" error":m)),g},indent:function(h,_,g){var b=h.context;if(h.tokenize.isInAttribute)return h.tagStart==h.indented?h.stringStartCol+1:h.indented+U;if(b&&b.noIndent)return ae.Pass;if(h.tokenize!=f&&h.tokenize!=c)return g?g.match(/^(\s*)/)[0].length:0;if(h.tagName)return W.multilineTagIndentPastTag!==!1?h.tagStart+h.tagName.length+2:h.tagStart+U*(W.multilineTagIndentFactor||1);if(W.alignCDATA&&/$/,blockCommentStart:"",configuration:W.htmlMode?"html":"xml",helperType:W.htmlMode?"html":"xml",skipAttribute:function(h){h.state==E&&(h.state=A)},xmlCurrentTag:function(h){return h.tagName?{name:h.tagName,close:h.type=="closeTag"}:null},xmlCurrentContext:function(h){for(var _=[],g=h.context;g;g=g.prev)g.tagName&&_.push(g.tagName);return _.reverse()}}}),ae.defineMIME("text/xml","xml"),ae.defineMIME("application/xml","xml"),ae.mimeModes.hasOwnProperty("text/html")||ae.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"30zm":function(vt,et,ne){"use strict";var ae=ne("jCWc"),J=ne("kPKH"),D=ne("k1fw"),Y=ne("tJVT"),F=ne("PpiC"),U=ne("B9cy"),W=ne("Ol7k"),j=ne("lUTK"),k=ne("BvKs"),I=ne("q1tI"),m=ne.n(I),c=ne("Ty5D"),f=ne("55Ip"),u=ne("9kvl"),r=ne("m3rI"),d=ne("kzJb"),o=ne.n(d),s=k.a.SubMenu,l=W.a.Sider,p=W.a.Content,R=function(x){var O=x.messages,A=x.globalSetting,T=x.loading,E=x.user,y=x.dispatch,h=Object(F.a)(x,["messages","globalSetting","loading","user","dispatch"]),_=Object(c.i)(),g=E.userInfo,b=Object(c.h)(),M=O.tidingsList,P=O.privateMessage,K=O.unreadInfo,V=Object(I.useState)({per_page:10,page:1}),B=Object(Y.a)(V,2),C=B[0],$=B[1];Object(I.useEffect)(function(){ee()},[_.userId]);var ee=function(){y({type:"messages/unreadMessageInfo",payload:Object(D.a)(Object(D.a)({},C),_)})};return m.a.createElement(J.a,{flex:"264px"},m.a.createElement("aside",{className:o.a.userInfo},m.a.createElement("img",{className:"mt40",src:r.a.IMG_SERVER+"/images/"+(g==null?void 0:g.image_url)}),m.a.createElement("p",{className:"font24 mt10"},g==null?void 0:g.username),m.a.createElement("p",{className:"mt20"},g==null?void 0:g.user_identity)),m.a.createElement("ul",{className:o.a.navInfo},m.a.createElement(f.a,{to:"/messages/".concat(g==null?void 0:g.login,"/user_tidings")},m.a.createElement("li",{className:b.pathname.indexOf("user_tidings")>-1&&o.a.actived},"\u6D88\u606F",!!(K!=null&&K.unread_tiding_count)&&m.a.createElement("span",{className:o.a.newTip},K==null?void 0:K.unread_tiding_count))),m.a.createElement(f.a,{to:"/messages/".concat(g==null?void 0:g.login,"/private_messages")},m.a.createElement("li",{className:(b.pathname.indexOf("private_messages")>-1||b.pathname.indexOf("message_detail")>-1)&&o.a.actived},"\u79C1\u4FE1",!!(K!=null&&K.unread_message_count)&&m.a.createElement("span",{className:o.a.newTip},K==null?void 0:K.unread_message_count)))))};et.a=Object(u.a)(function(w){var x=w.messages,O=w.loading,A=w.user,T=w.globalSetting;return{messages:x,globalSetting:T,user:A,loading:O.effects}})(R)},"55Ip":function(vt,et,ne){"use strict";ne.d(et,"a",function(){return l});var ae=ne("Ty5D"),J=ne("dI71"),D=ne("q1tI"),Y=ne.n(D),F=ne("YS25"),U=ne("17x9"),W=ne.n(U),j=ne("wx14"),k=ne("zLVn"),I=ne("9R94"),m=function(E){Object(J.a)(y,E);function y(){for(var _,g=arguments.length,b=new Array(g),M=0;Mee&&(ee=C.line_indent_level));var re={mode:$,parent:C,last_token:C?C.last_token:new f(l.START_BLOCK,""),last_word:C?C.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:ee,alignment:0,line_indent_level:C?C.line_indent_level:ee,start_line_index:this._output.get_line_number(),ternary_depth:0};return re},V.prototype._reset=function(C){var $=C.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new c(this._options,$),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(h.BlockStatement);var ee=new d(C,this._options);return this._tokens=ee.tokenize(),C},V.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var C,$=this._reset(this._source_text),ee=this._options.eol;this._options.eol==="auto"&&(ee=` `,$&&u.lineBreak.test($||"")&&(ee=$.match(u.lineBreak)[0]));for(var re=this._tokens.next();re;)this.handle_token(re),this._last_last_text=this._flags.last_token.text,this._flags.last_token=re,re=this._tokens.next();return C=this._output.get_code(ee),C},V.prototype.handle_token=function(C,$){C.type===l.START_EXPR?this.handle_start_expr(C):C.type===l.END_EXPR?this.handle_end_expr(C):C.type===l.START_BLOCK?this.handle_start_block(C):C.type===l.END_BLOCK?this.handle_end_block(C):C.type===l.WORD?this.handle_word(C):C.type===l.RESERVED?this.handle_word(C):C.type===l.SEMICOLON?this.handle_semicolon(C):C.type===l.STRING?this.handle_string(C):C.type===l.EQUALS?this.handle_equals(C):C.type===l.OPERATOR?this.handle_operator(C):C.type===l.COMMA?this.handle_comma(C):C.type===l.BLOCK_COMMENT?this.handle_block_comment(C,$):C.type===l.COMMENT?this.handle_comment(C,$):C.type===l.DOT?this.handle_dot(C):C.type===l.EOF?this.handle_eof(C):C.type===l.UNKNOWN?this.handle_unknown(C,$):this.handle_unknown(C,$)},V.prototype.handle_whitespace_and_comments=function(C,$){var ee=C.newlines,re=this._options.keep_array_indentation&&b(this._flags.mode);if(C.comments_before)for(var ue=C.comments_before.next();ue;)this.handle_whitespace_and_comments(ue,$),this.handle_token(ue,$),ue=C.comments_before.next();if(re)for(var Te=0;Te0,$);else if(this._options.max_preserve_newlines&&ee>this._options.max_preserve_newlines&&(ee=this._options.max_preserve_newlines),this._options.preserve_newlines&&ee>1){this.print_newline(!1,$);for(var ye=1;ye0&&(!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))},V.prototype.set_mode=function(C){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,C),this._flags=this.create_flags(this._previous_flags,C),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},V.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===h.Statement&&_(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},V.prototype.start_of_object_property=function(){return this._flags.parent.mode===h.ObjectLiteral&&this._flags.mode===h.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"]))},V.prototype.start_of_statement=function(C){var $=!1;return $=$||O(this._flags.last_token,["var","let","const"])&&C.type===l.WORD,$=$||x(this._flags.last_token,"do"),$=$||!(this._flags.parent.mode===h.ObjectLiteral&&this._flags.mode===h.Statement)&&O(this._flags.last_token,B)&&!C.newlines,$=$||x(this._flags.last_token,"else")&&!(x(C,"if")&&!C.comments_before),$=$||this._flags.last_token.type===l.END_EXPR&&(this._previous_flags.mode===h.ForInitializer||this._previous_flags.mode===h.Conditional),$=$||this._flags.last_token.type===l.WORD&&this._flags.mode===h.BlockStatement&&!this._flags.in_case&&!(C.text==="--"||C.text==="++")&&this._last_last_text!=="function"&&C.type!==l.WORD&&C.type!==l.RESERVED,$=$||this._flags.mode===h.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"])),$?(this.set_mode(h.Statement),this.indent(),this.handle_whitespace_and_comments(C,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(C,O(C,["do","for","if","while"])),!0):!1},V.prototype.handle_start_expr=function(C){this.start_of_statement(C)||this.handle_whitespace_and_comments(C);var $=h.Expression;if(C.text==="["){if(this._flags.last_token.type===l.WORD||this._flags.last_token.text===")"){O(this._flags.last_token,o)&&(this._output.space_before_token=!0),this.print_token(C),this.set_mode($),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}$=h.ArrayLiteral,b(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())),p(this._flags.last_token.type,[l.START_EXPR,l.END_EXPR,l.WORD,l.OPERATOR,l.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===l.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,$=h.ForInitializer):p(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,$=h.Conditional):p(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&C.whitespace_before===""?this._output.space_before_token=!1:(p(this._flags.last_token.text,o)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===l.EQUALS||this._flags.last_token.type===l.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(C);else if(this._flags.last_token.type===l.WORD){this._output.space_before_token=!1;var ee=this._tokens.peek(-3);if(this._options.space_after_named_function&&ee){var re=this._tokens.peek(-4);O(ee,["async","function"])||ee.text==="*"&&O(re,["async","function"])?this._output.space_before_token=!0:this._flags.mode===h.ObjectLiteral?(ee.text==="{"||ee.text===","||ee.text==="*"&&(re.text==="{"||re.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(C);(this._flags.last_token.type===l.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(p(this._last_last_text,["function","yield"])||this._flags.mode===h.ObjectLiteral&&p(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===l.START_BLOCK?this.print_newline():(this._flags.last_token.type===l.END_EXPR||this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===l.COMMA)&&this.allow_wrap_or_preserved_newline(C,C.newlines),this.print_token(C),this.set_mode($),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},V.prototype.handle_end_expr=function(C){for(;this._flags.mode===h.Statement;)this.restore_mode();this.handle_whitespace_and_comments(C),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(C,C.text==="]"&&b(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===l.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(C),this.restore_mode(),_(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===h.Conditional&&(this._previous_flags.mode=h.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},V.prototype.handle_start_block=function(C){this.handle_whitespace_and_comments(C);var $=this._tokens.peek(),ee=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===l.END_EXPR?(this.set_mode(h.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(h.BlockStatement):ee&&(p(ee.text,[":",","])&&p($.type,[l.STRING,l.WORD,l.RESERVED])||p($.text,["get","set","..."])&&p(ee.type,[l.WORD,l.RESERVED]))?p(this._last_last_text,["class","interface"])&&!p(ee.text,[":",","])?this.set_mode(h.BlockStatement):this.set_mode(h.ObjectLiteral):this._flags.last_token.type===l.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(h.BlockStatement):p(this._flags.last_token.type,[l.EQUALS,l.START_EXPR,l.COMMA,l.OPERATOR])||O(this._flags.last_token,["return","throw","import","default"])?this.set_mode(h.ObjectLiteral):this.set_mode(h.BlockStatement),this._flags.last_token&&(O(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var re=!$.comments_before&&$.text==="}",ue=re&&this._flags.last_word==="function"&&this._flags.last_token.type===l.END_EXPR;if(this._options.brace_preserve_inline){var Te=0,ye=null;this._flags.inline_frame=!0;do if(Te+=1,ye=this._tokens.peek(Te-1),ye.newlines){this._flags.inline_frame=!1;break}while(ye.type!==l.EOF&&!(ye.type===l.END_BLOCK&&ye.opened===C))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&C.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==l.OPERATOR&&(ue||this._flags.last_token.type===l.EQUALS||O(this._flags.last_token,A)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(b(this._previous_flags.mode)&&(this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.COMMA)&&((this._flags.last_token.type===l.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(C),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==l.OPERATOR&&this._flags.last_token.type!==l.START_EXPR&&(this._flags.last_token.type===l.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(C),this.indent(),!re&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},V.prototype.handle_end_block=function(C){for(this.handle_whitespace_and_comments(C);this._flags.mode===h.Statement;)this.restore_mode();var $=this._flags.last_token.type===l.START_BLOCK;this._flags.inline_frame&&!$?this._output.space_before_token=!0:this._options.brace_style==="expand"?$||this.print_newline():$||(b(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(C)},V.prototype.handle_word=function(C){if(C.type===l.RESERVED){if(p(C.text,["set","get"])&&this._flags.mode!==h.ObjectLiteral)C.type=l.WORD;else if(C.text==="import"&&p(this._tokens.peek().text,["(","."]))C.type=l.WORD;else if(p(C.text,["as","from"])&&!this._flags.import_block)C.type=l.WORD;else if(this._flags.mode===h.ObjectLiteral){var $=this._tokens.peek();$.text===":"&&(C.type=l.WORD)}}if(this.start_of_statement(C)?O(this._flags.last_token,["var","let","const"])&&C.type===l.WORD&&(this._flags.declaration_statement=!0):C.newlines&&!M(this._flags.mode)&&(this._flags.last_token.type!==l.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==l.EQUALS&&(this._options.preserve_newlines||!O(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(C),this.print_newline()):this.handle_whitespace_and_comments(C),this._flags.do_block&&!this._flags.do_while)if(x(C,"while")){this._output.space_before_token=!0,this.print_token(C),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&&x(C,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===h.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&O(C,["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(C),this._flags.in_case=!0;return}if((this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.EQUALS||this._flags.last_token.type===l.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(C)),x(C,"function")){(p(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(p(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===l.OPERATOR))&&(!this._output.just_added_blankline()&&!C.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===l.RESERVED||this._flags.last_token.type===l.WORD?O(this._flags.last_token,["get","set","new","export"])||O(this._flags.last_token,B)?this._output.space_before_token=!0:x(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===l.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(M(this._flags.mode)||b(this._flags.mode))||this.print_newline(),this.print_token(C),this._flags.last_word=C.text;return}var ee="NONE";if(this._flags.last_token.type===l.END_BLOCK?this._previous_flags.inline_frame?ee="SPACE":O(C,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&C.newlines?ee="NEWLINE":(ee="SPACE",this._output.space_before_token=!0):ee="NEWLINE":this._flags.last_token.type===l.SEMICOLON&&this._flags.mode===h.BlockStatement?ee="NEWLINE":this._flags.last_token.type===l.SEMICOLON&&M(this._flags.mode)?ee="SPACE":this._flags.last_token.type===l.STRING?ee="NEWLINE":this._flags.last_token.type===l.RESERVED||this._flags.last_token.type===l.WORD||this._flags.last_token.text==="*"&&(p(this._last_last_text,["function","yield"])||this._flags.mode===h.ObjectLiteral&&p(this._last_last_text,["{",","]))?ee="SPACE":this._flags.last_token.type===l.START_BLOCK?this._flags.inline_frame?ee="SPACE":ee="NEWLINE":this._flags.last_token.type===l.END_EXPR&&(this._output.space_before_token=!0,ee="NEWLINE"),O(C,o)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?ee="SPACE":ee="NEWLINE"),O(C,["else","catch","finally"]))if((!(this._flags.last_token.type===l.END_BLOCK&&this._previous_flags.mode===h.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&C.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var re=this._output.current_line;re.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else ee==="NEWLINE"?O(this._flags.last_token,A)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&O(C,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==l.END_EXPR?(this._flags.last_token.type!==l.START_EXPR||!O(C,["var","let","const"]))&&this._flags.last_token.text!==":"&&(x(C,"if")&&x(C.previous,"else")?this._output.space_before_token=!0:this.print_newline()):O(C,o)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&b(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():ee==="SPACE"&&(this._output.space_before_token=!0);C.previous&&(C.previous.type===l.WORD||C.previous.type===l.RESERVED)&&(this._output.space_before_token=!0),this.print_token(C),this._flags.last_word=C.text,C.type===l.RESERVED&&(C.text==="do"?this._flags.do_block=!0:C.text==="if"?this._flags.if_block=!0:C.text==="import"?this._flags.import_block=!0:this._flags.import_block&&x(C,"from")&&(this._flags.import_block=!1))},V.prototype.handle_semicolon=function(C){this.start_of_statement(C)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(C);for(var $=this._tokens.peek();this._flags.mode===h.Statement&&!(this._flags.if_block&&x($,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(C)},V.prototype.handle_string=function(C){C.text.startsWith("`")&&C.newlines===0&&C.whitespace_before===""&&(C.previous.text===")"||this._flags.last_token.type===l.WORD)||(this.start_of_statement(C)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(C),this._flags.last_token.type===l.RESERVED||this._flags.last_token.type===l.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR||this._flags.last_token.type===l.EQUALS||this._flags.last_token.type===l.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(C):C.text.startsWith("`")&&this._flags.last_token.type===l.END_EXPR&&(C.previous.text==="]"||C.previous.text===")")&&C.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(C)},V.prototype.handle_equals=function(C){this.start_of_statement(C)||this.handle_whitespace_and_comments(C),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(C),this._output.space_before_token=!0},V.prototype.handle_comma=function(C){this.handle_whitespace_and_comments(C,!0),this.print_token(C),this._output.space_before_token=!0,this._flags.declaration_statement?(M(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(C)):this._flags.mode===h.ObjectLiteral||this._flags.mode===h.Statement&&this._flags.parent.mode===h.ObjectLiteral?(this._flags.mode===h.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(C)},V.prototype.handle_operator=function(C){var $=C.text==="*"&&(O(this._flags.last_token,["function","yield"])||p(this._flags.last_token.type,[l.START_BLOCK,l.COMMA,l.END_BLOCK,l.SEMICOLON])),ee=p(C.text,["-","+"])&&(p(this._flags.last_token.type,[l.START_BLOCK,l.START_EXPR,l.EQUALS,l.OPERATOR])||p(this._flags.last_token.text,o)||this._flags.last_token.text===",");if(!this.start_of_statement(C)){var re=!$;this.handle_whitespace_and_comments(C,re)}if(C.text==="*"&&this._flags.last_token.type===l.DOT){this.print_token(C);return}if(C.text==="::"){this.print_token(C);return}if(this._flags.last_token.type===l.OPERATOR&&p(this._options.operator_position,y)&&this.allow_wrap_or_preserved_newline(C),C.text===":"&&this._flags.in_case){this.print_token(C),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==l.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var ue=!0,Te=!0,ye=!1;if(C.text===":"?this._flags.ternary_depth===0?ue=!1:(this._flags.ternary_depth-=1,ye=!0):C.text==="?"&&(this._flags.ternary_depth+=1),!ee&&!$&&this._options.preserve_newlines&&p(C.text,s)){var be=C.text===":",we=be&&ye,xe=be&&!ye;switch(this._options.operator_position){case E.before_newline:this._output.space_before_token=!xe,this.print_token(C),(!be||we)&&this.allow_wrap_or_preserved_newline(C),this._output.space_before_token=!0;return;case E.after_newline:this._output.space_before_token=!0,!be||we?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(C):this._output.space_before_token=!1,this.print_token(C),this._output.space_before_token=!0;return;case E.preserve_newline:xe||this.allow_wrap_or_preserved_newline(C),ue=!(this._output.just_added_newline()||xe),this._output.space_before_token=ue,this.print_token(C),this._output.space_before_token=!0;return}}if($){this.allow_wrap_or_preserved_newline(C),ue=!1;var me=this._tokens.peek();Te=me&&p(me.type,[l.WORD,l.RESERVED])}else if(C.text==="...")this.allow_wrap_or_preserved_newline(C),ue=this._flags.last_token.type===l.START_BLOCK,Te=!1;else if(p(C.text,["--","++","!","~"])||ee){if((this._flags.last_token.type===l.COMMA||this._flags.last_token.type===l.START_EXPR)&&this.allow_wrap_or_preserved_newline(C),ue=!1,Te=!1,C.newlines&&(C.text==="--"||C.text==="++"||C.text==="~")){var se=O(this._flags.last_token,A)&&C.newlines;se&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(se,!0)}this._flags.last_token.text===";"&&M(this._flags.mode)&&(ue=!0),this._flags.last_token.type===l.RESERVED?ue=!0:this._flags.last_token.type===l.END_EXPR?ue=!(this._flags.last_token.text==="]"&&(C.text==="--"||C.text==="++")):this._flags.last_token.type===l.OPERATOR&&(ue=p(C.text,["--","-","++","+"])&&p(this._flags.last_token.text,["--","-","++","+"]),p(C.text,["+","-"])&&p(this._flags.last_token.text,["--","++"])&&(Te=!0)),(this._flags.mode===h.BlockStatement&&!this._flags.inline_frame||this._flags.mode===h.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||ue,this.print_token(C),this._output.space_before_token=Te},V.prototype.handle_block_comment=function(C,$){if(this._output.raw){this._output.add_raw_token(C),C.directives&&C.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(C.directives){this.print_newline(!1,$),this.print_token(C),C.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!u.newline.test(C.text)&&!C.newlines){this._output.space_before_token=!0,this.print_token(C),this._output.space_before_token=!0;return}else this.print_block_commment(C,$)},V.prototype.print_block_commment=function(C,$){var ee=g(C.text),re,ue=!1,Te=!1,ye=C.whitespace_before,be=ye.length;if(this.print_newline(!1,$),this.print_token_line_indentation(C),this._output.add_token(ee[0]),this.print_newline(!1,$),ee.length>1){for(ee=ee.slice(1),ue=P(ee,"*"),Te=K(ee,ye),ue&&(this._flags.alignment=1),re=0;re=0;u--)if(this.__items[u].match(f))return!0;return!1},I.prototype.set_indent=function(f,u){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=u||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},I.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)},I.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},I.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var f=this.__parent.current_line;return f.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),f.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),f.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,f.__items[0]===" "&&(f.__items.splice(0,1),f.__character_count-=1),!0}return!1},I.prototype.is_empty=function(){return this.__items.length===0},I.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},I.prototype.push=function(f){this.__items.push(f);var u=f.lastIndexOf(` `);u!==-1?this.__character_count=f.length-u:this.__character_count+=f.length},I.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},I.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},I.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},I.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},I.prototype.toString=function(){var f="";return this.is_empty()?this.__parent.indent_empty_lines&&(f=this.__parent.get_indent_string(this.__indent_count)):(f=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),f+=this.__items.join("")),f};function m(f,u){this.__cache=[""],this.__indent_size=f.indent_size,this.__indent_string=f.indent_char,f.indent_with_tabs||(this.__indent_string=new Array(f.indent_size+1).join(f.indent_char)),u=u||"",f.indent_level>0&&(u=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=u,this.__base_string_length=u.length}m.prototype.get_indent_size=function(f,u){var r=this.__base_string_length;return u=u||0,f<0&&(r=0),r+=f*this.__indent_size,r+=u,r},m.prototype.get_indent_string=function(f,u){var r=this.__base_string;return u=u||0,f<0&&(f=0,r=""),u+=f*this.__indent_size,this.__ensure_cache(u),r+=this.__cache[u],r},m.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var f=this.__cache.length,u=0,r="";this.__indent_size&&f>=this.__indent_size&&(u=Math.floor(f/this.__indent_size),f-=u*this.__indent_size,r=new Array(u+1).join(this.__indent_string)),f&&(r+=new Array(f+1).join(" ")),this.__cache.push(r)};function c(f,u){this.__indent_cache=new m(f,u),this.raw=!1,this._end_with_newline=f.end_with_newline,this.indent_size=f.indent_size,this.wrap_line_length=f.wrap_line_length,this.indent_empty_lines=f.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new I(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}c.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},c.prototype.get_line_number=function(){return this.__lines.length},c.prototype.get_indent_string=function(f,u){return this.__indent_cache.get_indent_string(f,u)},c.prototype.get_indent_size=function(f,u){return this.__indent_cache.get_indent_size(f,u)},c.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},c.prototype.add_new_line=function(f){return this.is_empty()||!f&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},c.prototype.get_code=function(f){this.trim(!0);var u=this.current_line.pop();u&&(u[u.length-1]===` `&&(u=u.replace(/\n+$/g,"")),this.current_line.push(u)),this._end_with_newline&&this.__add_outputline();var r=this.__lines.join(` `);return f!==` `&&(r=r.replace(/[\n]/g,f)),r},c.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},c.prototype.set_indent=function(f,u){return f=f||0,u=u||0,this.next_line.set_indent(f,u),this.__lines.length>1?(this.current_line.set_indent(f,u),!0):(this.current_line.set_indent(),!1)},c.prototype.add_raw_token=function(f){for(var u=0;u1&&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},c.prototype.just_added_newline=function(){return this.current_line.is_empty()},c.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},c.prototype.ensure_empty_line_above=function(f,u){for(var r=this.__lines.length-2;r>=0;){var d=this.__lines[r];if(d.is_empty())break;if(d.item(0).indexOf(f)!==0&&d.item(-1)!==u){this.__lines.splice(r+1,0,new I(this)),this.previous_line=this.__lines[this.__lines.length-2];break}r--}},k.exports.Output=c},function(k){function I(m,c,f,u){this.type=m,this.text=c,this.comments_before=null,this.newlines=f||0,this.whitespace_before=u||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}k.exports.Token=I},function(k,I){var m="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",c="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",f="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",u="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",r="(?:\\\\u[0-9a-fA-F]{4}|["+m+f+"])",d="(?:\\\\u[0-9a-fA-F]{4}|["+c+f+u+"])*";I.identifier=new RegExp(r+d,"g"),I.identifierStart=new RegExp(r),I.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+c+f+u+"])+");var o=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;I.newline=/[\n\r\u2028\u2029]/,I.lineBreak=new RegExp(`\r |`+I.newline.source),I.allLineBreaks=new RegExp(I.lineBreak.source,"g")},function(k,I,m){var c=m(6).Options,f=["before-newline","after-newline","preserve-newline"];function u(r){c.call(this,r,"js");var d=this.raw_options.brace_style||null;d==="expand-strict"?this.raw_options.brace_style="expand":d==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var o=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var s=0;s>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),T=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";T=T.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),T="\\?\\.(?!\\d) "+T,T=T.replace(/ /g,"|");var E=new RegExp(T),y="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),h=y.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),_=new RegExp("^(?:"+h.join("|")+")$"),g,b=function(P,K){f.call(this,P,K),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var V=new o(this._input),B=new s(this._input).read_options(this._options);this.__patterns={template:B,identifier:B.starting_with(d.identifier).matching(d.identifierMatch),number:V.matching(w),punct:V.matching(E),comment:V.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:V.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:V.matching(//),include:V.starting_with(/#include/).until_after(d.lineBreak),shebang:V.starting_with(/#!/).until_after(d.lineBreak),xml:V.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:B.until(/['\\\n\r\u2028\u2029]/),double_quote:B.until(/["\\\n\r\u2028\u2029]/),template_text:B.until(/[`\\$]/),template_expression:B.until(/[`}\\]/)}};b.prototype=new f,b.prototype._is_comment=function(P){return P.type===p.COMMENT||P.type===p.BLOCK_COMMENT||P.type===p.UNKNOWN},b.prototype._is_opening=function(P){return P.type===p.START_BLOCK||P.type===p.START_EXPR},b.prototype._is_closing=function(P,K){return(P.type===p.END_BLOCK||P.type===p.END_EXPR)&&K&&(P.text==="]"&&K.text==="["||P.text===")"&&K.text==="("||P.text==="}"&&K.text==="{")},b.prototype._reset=function(){g=!1},b.prototype._get_next_token=function(P,K){var V=null;this._readWhitespace();var B=this._input.peek();return B===null?this._create_token(p.EOF,""):(V=V||this._read_non_javascript(B),V=V||this._read_string(B),V=V||this._read_word(P),V=V||this._read_singles(B),V=V||this._read_comment(B),V=V||this._read_regexp(B,P),V=V||this._read_xml(B,P),V=V||this._read_punctuation(),V=V||this._create_token(p.UNKNOWN,this._input.next()),V)},b.prototype._read_word=function(P){var K;if(K=this.__patterns.identifier.read(),K!=="")return K=K.replace(d.allLineBreaks,` `),!(P.type===p.DOT||P.type===p.RESERVED&&(P.text==="set"||P.text==="get"))&&_.test(K)?(K==="in"||K==="of")&&(P.type===p.WORD||P.type===p.STRING)?this._create_token(p.OPERATOR,K):this._create_token(p.RESERVED,K):this._create_token(p.WORD,K);if(K=this.__patterns.number.read(),K!=="")return this._create_token(p.WORD,K)},b.prototype._read_singles=function(P){var K=null;return P==="("||P==="["?K=this._create_token(p.START_EXPR,P):P===")"||P==="]"?K=this._create_token(p.END_EXPR,P):P==="{"?K=this._create_token(p.START_BLOCK,P):P==="}"?K=this._create_token(p.END_BLOCK,P):P===";"?K=this._create_token(p.SEMICOLON,P):P==="."&&O.test(this._input.peek(1))?K=this._create_token(p.DOT,P):P===","&&(K=this._create_token(p.COMMA,P)),K&&this._input.next(),K},b.prototype._read_punctuation=function(){var P=this.__patterns.punct.read();if(P!=="")return P==="="?this._create_token(p.EQUALS,P):P==="?."?this._create_token(p.DOT,P):this._create_token(p.OPERATOR,P)},b.prototype._read_non_javascript=function(P){var K="";if(P==="#"){if(this._is_first_token()&&(K=this.__patterns.shebang.read(),K))return this._create_token(p.UNKNOWN,K.trim()+` `);if(K=this.__patterns.include.read(),K)return this._create_token(p.UNKNOWN,K.trim()+` `);P=this._input.next();var V="#";if(this._input.hasNext()&&this._input.testChar(x)){do P=this._input.next(),V+=P;while(this._input.hasNext()&&P!=="#"&&P!=="=");return P==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(V+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(V+="{}",this._input.next(),this._input.next())),this._create_token(p.WORD,V)}this._input.back()}else if(P==="<"&&this._is_first_token()){if(K=this.__patterns.html_comment_start.read(),K){for(;this._input.hasNext()&&!this._input.testChar(d.newline);)K+=this._input.next();return g=!0,this._create_token(p.COMMENT,K)}}else if(g&&P==="-"&&(K=this.__patterns.html_comment_end.read(),K))return g=!1,this._create_token(p.COMMENT,K);return null},b.prototype._read_comment=function(P){var K=null;if(P==="/"){var V="";if(this._input.peek(1)==="*"){V=this.__patterns.block_comment.read();var B=R.get_directives(V);B&&B.ignore==="start"&&(V+=R.readIgnored(this._input)),V=V.replace(d.allLineBreaks,` `),K=this._create_token(p.BLOCK_COMMENT,V),K.directives=B}else this._input.peek(1)==="/"&&(V=this.__patterns.comment.read(),K=this._create_token(p.COMMENT,V))}return K},b.prototype._read_string=function(P){if(P==="`"||P==="'"||P==='"'){var K=this._input.next();return this.has_char_escapes=!1,P==="`"?K+=this._read_string_recursive("`",!0,"${"):K+=this._read_string_recursive(P),this.has_char_escapes&&this._options.unescape_strings&&(K=M(K)),this._input.peek()===P&&(K+=this._input.next()),K=K.replace(d.allLineBreaks,` `),this._create_token(p.STRING,K)}return null},b.prototype._allow_regexp_or_xml=function(P){return P.type===p.RESERVED&&l(P.text,["return","case","throw","else","do","typeof","yield"])||P.type===p.END_EXPR&&P.text===")"&&P.opened.previous.type===p.RESERVED&&l(P.opened.previous.text,["if","while","for"])||l(P.type,[p.COMMENT,p.START_EXPR,p.START_BLOCK,p.START,p.END_BLOCK,p.OPERATOR,p.EQUALS,p.EOF,p.SEMICOLON,p.COMMA])},b.prototype._read_regexp=function(P,K){if(P==="/"&&this._allow_regexp_or_xml(K)){for(var V=this._input.next(),B=!1,C=!1;this._input.hasNext()&&(B||C||this._input.peek()!==P)&&!this._input.testChar(d.newline);)V+=this._input.peek(),B?B=!1:(B=this._input.peek()==="\\",this._input.peek()==="["?C=!0:this._input.peek()==="]"&&(C=!1)),this._input.next();return this._input.peek()===P&&(V+=this._input.next(),V+=this._input.read(d.identifier)),this._create_token(p.STRING,V)}return null},b.prototype._read_xml=function(P,K){if(this._options.e4x&&P==="<"&&this._allow_regexp_or_xml(K)){var V="",B=this.__patterns.xml.read_match();if(B){for(var C=B[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),$=C.indexOf("{")===0,ee=0;B;){var re=!!B[1],ue=B[2],Te=!!B[B.length-1]||ue.slice(0,8)==="![CDATA[";if(!Te&&(ue===C||$&&ue.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(re?--ee:++ee),V+=B[0],ee<=0)break;B=this.__patterns.xml.read_match()}return B||(V+=this._input.match(/[\s\S]*/g)[0]),V=V.replace(d.allLineBreaks,` `),this._create_token(p.STRING,V)}}return null};function M(P){for(var K="",V=0,B=new c(P),C=null;B.hasNext();)if(C=B.match(/([\s]|[^\\]|\\\\)+/g),C&&(K+=C[0]),B.peek()==="\\"){if(B.next(),B.peek()==="x")C=B.match(/x([0-9A-Fa-f]{2})/g);else if(B.peek()==="u")C=B.match(/u([0-9A-Fa-f]{4})/g);else{K+="\\",B.hasNext()&&(K+=B.next());continue}if(!C)return P;if(V=parseInt(C[1],16),V>126&&V<=255&&C[0].indexOf("x")===0)return P;if(V>=0&&V<32){K+="\\"+C[0];continue}else V===34||V===39||V===92?K+="\\"+String.fromCharCode(V):K+=String.fromCharCode(V)}return K}b.prototype._read_string_recursive=function(P,K,V){var B,C;P==="'"?C=this.__patterns.single_quote:P==='"'?C=this.__patterns.double_quote:P==="`"?C=this.__patterns.template_text:P==="}"&&(C=this.__patterns.template_expression);for(var $=C.read(),ee="";this._input.hasNext();){if(ee=this._input.next(),ee===P||!K&&d.newline.test(ee)){this._input.back();break}else ee==="\\"&&this._input.hasNext()?(B=this._input.peek(),B==="x"||B==="u"?this.has_char_escapes=!0:B==="\r"&&this._input.peek(1)===` `&&this._input.next(),ee+=this._input.next()):V&&(V==="${"&&ee==="$"&&this._input.peek()==="{"&&(ee+=this._input.next()),V===ee&&(P==="`"?ee+=this._read_string_recursive("}",K,"`"):ee+=this._read_string_recursive("`",K,"${"),this._input.hasNext()&&(ee+=this._input.next())));ee+=C.read(),$+=ee}return $},k.exports.Tokenizer=b,k.exports.TOKEN=p,k.exports.positionable_operators=A.slice(),k.exports.line_starters=y.slice()},function(k){var I=RegExp.prototype.hasOwnProperty("sticky");function m(c){this.__input=c||"",this.__input_length=this.__input.length,this.__position=0}m.prototype.restart=function(){this.__position=0},m.prototype.back=function(){this.__position>0&&(this.__position-=1)},m.prototype.hasNext=function(){return this.__position=0&&c=0&&f=c.length&&this.__input.substring(f-c.length,f).toLowerCase()===c},k.exports.InputScanner=m},function(k,I,m){var c=m(8).InputScanner,f=m(3).Token,u=m(10).TokenStream,r=m(11).WhitespacePattern,d={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},o=function(s,l){this._input=new c(s),this._options=l||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new r(this._input)};o.prototype.tokenize=function(){this._input.restart(),this.__tokens=new u,this._reset();for(var s,l=new f(d.START,""),p=null,R=[],w=new u;l.type!==d.EOF;){for(s=this._get_next_token(l,p);this._is_comment(s);)w.add(s),s=this._get_next_token(l,p);w.isEmpty()||(s.comments_before=w,w=new u),s.parent=p,this._is_opening(s)?(R.push(p),p=s):p&&this._is_closing(s,p)&&(s.opened=p,p.closed=s,p=R.pop(),s.parent=p),s.previous=l,l.next=s,this.__tokens.add(s),l=s}return this.__tokens},o.prototype._is_first_token=function(){return this.__tokens.isEmpty()},o.prototype._reset=function(){},o.prototype._get_next_token=function(s,l){this._readWhitespace();var p=this._input.read(/.+/g);return p?this._create_token(d.RAW,p):this._create_token(d.EOF,"")},o.prototype._is_comment=function(s){return!1},o.prototype._is_opening=function(s){return!1},o.prototype._is_closing=function(s,l){return!1},o.prototype._create_token=function(s,l){var p=new f(s,l,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return p},o.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},k.exports.Tokenizer=o,k.exports.TOKEN=d},function(k){function I(m){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=m}I.prototype.restart=function(){this.__position=0},I.prototype.isEmpty=function(){return this.__tokens_length===0},I.prototype.hasNext=function(){return this.__position=0&&m/),erb:o.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:o.starting_with(/{%/).until_after(/%}/),django_value:o.starting_with(/{{/).until_after(/}}/),django_comment:o.starting_with(/{#/).until_after(/#}/),smarty:o.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:o.starting_with(/{\*/).until_after(/\*}/),smarty_literal:o.starting_with(/{literal}/).until_after(/{\/literal}/)}}u.prototype=new c,u.prototype._create=function(){return new u(this._input,this)},u.prototype._update=function(){this.__set_templated_pattern()},u.prototype.disable=function(r){var d=this._create();return d._disabled[r]=!0,d._update(),d},u.prototype.read_options=function(r){var d=this._create();for(var o in f)d._disabled[o]=r.templating.indexOf(o)===-1;return d._update(),d},u.prototype.exclude=function(r){var d=this._create();return d._excluded[r]=!0,d._update(),d},u.prototype.read=function(){var r="";this._match_pattern?r=this._input.read(this._starting_pattern):r=this._input.read(this._starting_pattern,this.__template_pattern);for(var d=this._read_template();d;)this._match_pattern?d+=this._input.read(this._match_pattern):d+=this._input.readUntil(this.__template_pattern),r+=d,d=this._read_template();return this._until_after&&(r+=this._input.readUntilAfter(this._until_pattern)),r},u.prototype.__set_templated_pattern=function(){var r=[];this._disabled.php||r.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||r.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||r.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(r.push(this.__patterns.django._starting_pattern.source),r.push(this.__patterns.django_value._starting_pattern.source),r.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||r.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&r.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+r.join("|")+")")},u.prototype._read_template=function(){var r="",d=this._input.peek();if(d==="<"){var o=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&o==="?"&&(r=r||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&o==="%"&&(r=r||this.__patterns.erb.read())}else d==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(r=r||this.__patterns.handlebars_comment.read(),r=r||this.__patterns.handlebars_unescaped.read(),r=r||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(r=r||this.__patterns.django_value.read()),this._excluded.django||(r=r||this.__patterns.django_comment.read(),r=r||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(r=r||this.__patterns.smarty_comment.read(),r=r||this.__patterns.smarty_literal.read(),r=r||this.__patterns.smarty.read()));return r},k.exports.TemplatablePattern=u}],U={};function W(k){var I=U[k];if(I!==void 0)return I.exports;var m=U[k]={exports:{}};return F[k](m,m.exports,W),m.exports}var j=W(0);D=j})();var Y=D;!(ae=[],J=function(){return{js_beautify:Y}}.apply(et,ae),J!==void 0&&(vt.exports=J))})()},"7Cbv":function(vt,et,ne){"use strict";var ae=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),J=new Uint8Array(16);function D(){if(!ae)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ae(J)}var Y=/^(?:[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 F(f){return typeof f=="string"&&Y.test(f)}for(var U=F,W=[],j=0;j<256;++j)W.push((j+256).toString(16).substr(1));function k(f){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(W[f[u+0]]+W[f[u+1]]+W[f[u+2]]+W[f[u+3]]+"-"+W[f[u+4]]+W[f[u+5]]+"-"+W[f[u+6]]+W[f[u+7]]+"-"+W[f[u+8]]+W[f[u+9]]+"-"+W[f[u+10]]+W[f[u+11]]+W[f[u+12]]+W[f[u+13]]+W[f[u+14]]+W[f[u+15]]).toLowerCase();if(!U(r))throw TypeError("Stringified UUID is invalid");return r}var I=k;function m(f,u,r){f=f||{};var d=f.random||(f.rng||D)();if(d[6]=d[6]&15|64,d[8]=d[8]&63|128,u){r=r||0;for(var o=0;o<16;++o)u[r+o]=d[o];return u}return I(d)}var c=et.a=m},"7ahc":function(vt,et,ne){"use strict";ne.d(et,"a",function(){return R});var ae=ne("k1fw"),J=ne("0Owb"),D=ne("+L6B"),Y=ne("2/Rp"),F=ne("y8nQ"),U=ne("Vl3Y"),W=ne("tJVT"),j=ne("OaEy"),k=ne("2fM7"),I=ne("q1tI"),m=ne.n(I),c=ne("VrN/"),f=ne.n(c),u=ne("p77/"),r=ne.n(u),d=ne("c5Ni"),o=ne.n(d),s=k.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},p={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"]};et.b=function(w){var x=w.callback,O=w.onCancel,A=Object(I.useState)("python"),T=Object(W.a)(A,2),E=T[0],y=T[1];function h(g){y(p[g][1])}function _(g){x(g)}return m.a.createElement(U.a,Object(J.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:_}),m.a.createElement(U.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},m.a.createElement(k.a,{onChange:h},Object.keys(p).map(function(g){return m.a.createElement(s,{key:g,value:g},p[g][0])}))),m.a.createElement(U.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},m.a.createElement(R,{mode:E})),m.a.createElement("div",{className:"flex-container flex-end"},m.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement(Y.a,{type:"ghost",onClick:O},"\u53D6\u6D88")))};function R(w){var x=w.value,O=w.onChange,A=w.mode,T=w.options,E=T===void 0?{}:T,y=Object(I.useRef)(),h=Object(I.useState)(),_=Object(W.a)(h,2),g=_[0],b=_[1];return Object(I.useEffect)(function(){if(g){function M(P){var K=P.getValue();O&&O(K)}return g.on("change",M),function(){g.off("change",M)}}},[g,O]),Object(I.useEffect)(function(){g&&g.setOption("mode",A)},[g,A]),Object(I.useEffect)(function(){g&&((x!==g.getValue()||x==="")&&setTimeout(function(){g.setValue(x||" ")},300))},[g,x]),Object(I.useEffect)(function(){if(y.current&&!g){var M=f.a.fromTextArea(y.current,Object(ae.a)({mode:A,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},E));b(M)}},[y.current,g]),m.a.createElement("div",{className:"my-codemirror-container"},m.a.createElement("textarea",{ref:y}))}},"8EBN":function(vt,et,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"use strict";ae.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 J=0;J-1&&Y.substring(W+1,Y.length);if(j)return ae.findModeByExtension(j)},ae.findModeByName=function(Y){Y=Y.toLowerCase();for(var F=0;F=N.length?Z.slice(N.length):Z}).join(` `)}var o=[],s=["
    "],l=new u.a.Renderer,p=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function R(){o.length=0,s=["
      "]}var w={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function x(z,v,S,N){if(v>=z.length||z[v].level<=S)return v;var Z=z[v];N.push("
    • "+Z.text+""),v++;var G=[];return v=x(z,v,Z.level,G),G.length>0&&(N.push("
        "),G.forEach(function(fe){N.push(fe)}),N.push("
      ")),N.push("
    • "),v=x(z,v,S,N),v}function O(){return x(o,0,0,s),s.push("
    "),s.join("")}var A={heading:function(v){var S=p.exec(v);if(S)return{type:"heading",raw:S[0],depth:S[1].length,text:S[2]}},fences:function(v){var S=this.rules.block.fences.exec(v);if(S){var N=S[0],Z=d(N,S[3]||""),G=S[2]?S[2].trim():S[2];if(["latex","katex","math"].indexOf(G)>=0){var fe=y(),ke=Z;Z=fe,h[fe]={type:"block",expression:ke}}return{type:"code",raw:N,lang:G,text:Z}}}},T=/(?:\${2})([^\n`]+?)(?:\${2})/gi,E=0,y=function(){return"__special_katext_id_".concat(E++,"__")},h={};function _(){return h}function g(){E=0,h={}}function b(z){return z=z.replace(T,function(v,S){var N=y();return h[N]={type:"inline",expression:S},N}),z}var M=l.listitem;l.listitem=function(z){return M(b(z))};var P=l.paragraph;l.paragraph=function(z){return P(b(z))};var K=l.tablecell;l.tablecell=function(z,v){return K(b(z),v)},l.code=function(z,v,S){var N=(v||"").match(/\S*/)[0];return N?["latex","katex","math"].indexOf(N)>=0?"

    ".concat(z,"

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

    [TOC]

    ",O()),R()),Pt=Pt.replace(/(__special_katext_id_\d+__)/g,function(nn,fi){var Oi=si[fi],Xn=Oi.type,xn=Oi.expression;return Object(re.renderToString)(vn(xn)||"",{displayMode:Xn==="block",throwOnError:!1,output:"html"})}),Pt=Pt.replace(/▁/g,"\u2581\u2581\u2581"),g(),fe){var Vt=document.createElement("div");return Vt.innerHTML=Pt,Vt.innerText}return setTimeout(function(){return dr()},500),Pt},[xi]),Xi=Object(I.useRef)();w.WebkitLineClamp=ke,ke&&(Ht=Object(F.a)(Object(F.a)({},Ht),w));function bn(ri){var Wt=ri.target;if(Wt.tagName.toUpperCase()==="IMG"){if(gt){var yi=Wt.getAttribute("src");ln(yi),_n("image")}}else if(Wt.tagName.toUpperCase()==="A"){var Pt=Wt.getAttribute("href");if(Pt.indexOf("office")>-1)ri.preventDefault(),ln(Pt),_n("office");else if(Pt.indexOf("application/pdf")>-1)ri.preventDefault(),ln(Pt),_n("pdf");else if(Pt.indexOf("text/html")>-1)ri.preventDefault(),ln(Pt),_n("html");else if(Pt.startsWith("#")){ri.preventDefault();var si=document.getElementById(Pt.replace("#",""));si&&si.scrollIntoView(!0)}}}var dr=function(){var Wt,yi=(Wt=Xi.current)===null||Wt===void 0?void 0:Wt.querySelectorAll("video");yi==null||yi.forEach(function(Pt){if(Pt.oncontextmenu=function(){return!1},Pt.src.indexOf(".m3u8")>-1&&!Pt.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var si=new $.a;si.loadSource(Pt.src),si.attachMedia(Pt)}}})};Object(I.useEffect)(function(){if(Xi.current&&Ji&&(Ji.match(gn)&&window.PR.prettyPrint()),Xi.current)return Xi.current.addEventListener("click",bn),function(){Xi.current.removeEventListener("click",bn),g(),R()}},[Ji,Xi.current,bn]);var En=function(Wt){if(!Z)return;Wt.target.nodeName==="IMG"?(Ti.current.style.zIndex=1,Ti.current.style.display="flex",Ti.current.style.width=Wt.target.clientWidth+"px",Ti.current.style.height=Wt.target.clientHeight+"px",Ti.current.style.top=Wt.target.offsetTop+"px",Ti.current.style.left=Wt.target.offsetLeft+"px",Qi.current.src=Wt.target.getAttribute("src")):Ti.current.style.display="none"};return m.a.createElement("div",{style:{position:"relative"}},m.a.createElement("div",{ref:Xi,style:Object(F.a)({},Ht),className:"".concat(G||""," markdown-body ").concat(mn.a.mdBody),onMouseOver:En,dangerouslySetInnerHTML:{__html:Ji}}),m.a.createElement("div",{ref:Ti,className:mn.a.button},m.a.createElement(J.a,null,m.a.createElement(Y.a,{onClick:function(){return Kn()}},"\u88C1\u526A"),m.a.createElement(Y.a,{onClick:function(){return Vn()}},"\u7F16\u8F91"))),m.a.createElement("img",{ref:Qi,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),m.a.createElement(ue.a,{close:!0,data:zi,type:zi!=null&&zi.length?kn:"",style:Object(F.a)({},Bi),onClose:function(){return ln("")}}))}},"9VGf":function(vt,et,ne){"use strict";ne.d(et,"a",function(){return D});var ae=ne("q1tI"),J=ne.n(ae);function D(Y,F){var U=Object(ae.useRef)();Object(ae.useEffect)(function(){U.current=Y}),Object(ae.useEffect)(function(){function W(){U.current()}if(F!==null){var j=setInterval(W,F);return function(){return clearInterval(j)}}},[F])}},BU3w:function(vt,et,ne){"use strict";ne.d(et,"a",function(){return U});var ae=ne("MNnm"),J="rc-util-key";function D(W){if(W.attachTo)return W.attachTo;var j=document.querySelector("head");return j||document.body}function Y(W){var j,k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ae.a)())return null;var I=document.createElement("style");if((j=k.csp)===null||j===void 0?void 0:j.nonce){var m;I.nonce=(m=k.csp)===null||m===void 0?void 0:m.nonce}I.innerHTML=W;var c=D(k),f=c.firstChild;return k.prepend&&c.prepend?c.prepend(I):k.prepend&&f?c.insertBefore(I,f):c.appendChild(I),I}var F=new Map;function U(W,j){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},I=D(k);if(!F.has(I)){var m=Y("",k),c=m.parentNode;F.set(I,c),c.removeChild(m)}var f=Array.from(F.get(I).children).find(function(s){return s.tagName==="STYLE"&&s[J]===j});if(f){var u,r;if(((u=k.csp)===null||u===void 0?void 0:u.nonce)&&f.nonce!==((r=k.csp)===null||r===void 0?void 0:r.nonce)){var d;f.nonce=(d=k.csp)===null||d===void 0?void 0:d.nonce}return f.innerHTML!==W&&(f.innerHTML=W),f}var o=Y(W,k);return o[J]=j,o}},Bd2K:function(vt,et,ne){(function(ae){ae(ne("VrN/"),ne("osHv"))})(function(ae){ae.defineOption("autoCloseTags",!1,function(k,I,m){if(m!=ae.Init&&m&&k.removeKeyMap("autoCloseTags"),!I)return;var c={name:"autoCloseTags"};(typeof I!="object"||I.whenClosing!==!1)&&(c["'/'"]=function(f){return U(f)}),(typeof I!="object"||I.whenOpening!==!1)&&(c["'>'"]=function(f){return Y(f)}),k.addKeyMap(c)});var J=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["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 Y(k){if(k.getOption("disableInput"))return ae.Pass;for(var I=k.listSelections(),m=[],c=k.getOption("autoCloseTags"),f=0;fu.ch&&(l=l.slice(0,l.length-r.end+u.ch));var x=l.toLowerCase();if(!l||r.type=="string"&&(r.end!=u.ch||!/[\"\']/.test(r.string.charAt(r.string.length-1))||r.string.length==1)||r.type=="tag"&&s.close||r.string.indexOf("/")==u.ch-r.start-1||R&&W(R,x)>-1||j(k,d.mode.xmlCurrentContext&&d.mode.xmlCurrentContext(o)||[],l,u,!0))return ae.Pass;var O=typeof c=="object"&&c.emptyTags;if(O&&W(O,l)>-1){m[f]={text:"/>",newPos:ae.Pos(u.line,u.ch+2)};continue}var A=w&&W(w,x)>-1;m[f]={indent:A,text:">"+(A?` `:"")+"",newPos:A?ae.Pos(u.line+1,0):ae.Pos(u.line,u.ch+1)}}for(var T=typeof c=="object"&&c.dontIndentOnAutoClose,f=I.length-1;f>=0;f--){var E=m[f];k.replaceRange(E.text,I[f].head,I[f].anchor,"+insert");var y=k.listSelections().slice(0);y[f]={head:E.newPos,anchor:E.newPos},k.setSelections(y),!T&&E.indent&&(k.indentLine(E.newPos.line,null,!0),k.indentLine(E.newPos.line+1,null,!0))}}function F(k,I){for(var m=k.listSelections(),c=[],f=I?"/":""&&(R+=">"),c[d]=R}if(k.replaceSelections(c),m=k.listSelections(),!r)for(var d=0;d=0&&I[o]==m;o--)++d;c=r.to;for(var o=1;o0){for(var I=0;I1&&arguments[1]!==void 0?arguments[1]:"",I=[],m=0;mve.length)&&(de=ve.length);for(var pe=0,te=new Array(de);pe=ve.length?{done:!0}:{done:!1,value:ve[te++]}}}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 pe=ve[Symbol.iterator](),pe.next.bind(pe)}function U(ve,de){return de={exports:{}},ve(de,de.exports),de.exports}var W=U(function(ve){function de(){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 pe(te){ve.exports.defaults=te}ve.exports={defaults:de(),getDefaults:de,changeDefaults:pe}}),j=W.defaults,k=W.getDefaults,I=W.changeDefaults,m=/[&<>"']/,c=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,u=/[<>"']|&(?!#?\w+;)/g,r={"&":"&","<":"<",">":">",'"':""","'":"'"},d=function(de){return r[de]};function o(ve,de){if(de){if(m.test(ve))return ve.replace(c,d)}else if(f.test(ve))return ve.replace(u,d);return ve}var s=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ve){return ve.replace(s,function(de,pe){return pe=pe.toLowerCase(),pe==="colon"?":":pe.charAt(0)==="#"?pe.charAt(1)==="x"?String.fromCharCode(parseInt(pe.substring(2),16)):String.fromCharCode(+pe.substring(1)):""})}var p=/(^|[^\[])\^/g;function R(ve,de){ve=ve.source||ve,de=de||"";var pe={replace:function(ie,oe){return oe=oe.source||oe,oe=oe.replace(p,"$1"),ve=ve.replace(ie,oe),pe},getRegex:function(){return new RegExp(ve,de)}};return pe}var w=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(ve,de,pe){if(ve){var te;try{te=decodeURIComponent(l(pe)).replace(w,"").toLowerCase()}catch(ie){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}de&&!x.test(pe)&&(pe=h(de,pe));try{pe=encodeURI(pe).replace(/%25/g,"%")}catch(ie){return null}return pe}var A={},T=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,y=/^([^:]+:\/*[^/]*)[\s\S]*$/;function h(ve,de){A[" "+ve]||(T.test(ve)?A[" "+ve]=ve+"/":A[" "+ve]=M(ve,"/",!0)),ve=A[" "+ve];var pe=ve.indexOf(":")===-1;return de.substring(0,2)==="//"?pe?de:ve.replace(E,"$1")+de:de.charAt(0)==="/"?pe?de:ve.replace(y,"$1")+de:ve+de}var _={exec:function(){}};function g(ve){for(var de=1,pe,te;de=0&&ge[De]==="\\";)Ce=!Ce;return Ce?"|":" |"}),te=pe.split(/ \|/),ie=0;if(te.length>de)te.splice(de);else for(;te.length=te.length?ie.slice(te.length):ie}).join(` `)}var ye=function(){function ve(pe){this.options=pe||B}var de=ve.prototype;return de.space=function(te){var ie=this.rules.block.newline.exec(te);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:` `}},de.code=function(te,ie){var oe=this.rules.block.code.exec(te);if(oe){var he=ie[ie.length-1];if(he&&he.type==="paragraph")return{raw:oe[0],text:oe[0].trimRight()};var ge=oe[0].replace(/^ {4}/gm,"");return{type:"code",raw:oe[0],codeBlockStyle:"indented",text:this.options.pedantic?ge:C(ge,` `)}}},de.fences=function(te){var ie=this.rules.block.fences.exec(te);if(ie){var oe=ie[0],he=Te(oe,ie[3]||"");return{type:"code",raw:oe,lang:ie[2]?ie[2].trim():ie[2],text:he}}},de.heading=function(te){var ie=this.rules.block.heading.exec(te);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},de.nptable=function(te){var ie=this.rules.block.nptable.exec(te);if(ie){var oe={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(` `):[],raw:ie[0]};if(oe.header.length===oe.align.length){var he=oe.align.length,ge;for(ge=0;ge ?/gm,"");return{type:"blockquote",raw:ie[0],text:oe}}},de.list=function(te){var ie=this.rules.block.list.exec(te);if(ie){for(var oe=ie[0],he=ie[2],ge=he.length>1,Ce=he[he.length-1]===")",De={type:"list",raw:oe,ordered:ge,start:ge?+he.slice(0,-1):"",loose:!1,items:[]},Ke=ie[0].match(this.rules.block.item),ht=!1,it,mt,_t,Qe,Ft,Ct,Yt,$t=Ke.length,Lt=0;Lt<$t;Lt++)it=Ke[Lt],oe=it,mt=it.length,it=it.replace(/^ *([*+-]|\d+[.)]) */,""),~it.indexOf(` `)&&(mt-=it.length,it=this.options.pedantic?it.replace(/^ {1,4}/gm,""):it.replace(new RegExp("^ {1,"+mt+"}","gm"),"")),Lt!==$t-1&&(_t=this.rules.block.bullet.exec(Ke[Lt+1])[0],(ge?_t.length===1||!Ce&&_t[_t.length-1]===")":_t.length>1||this.options.smartLists&&_t!==he)&&(Qe=Ke.slice(Lt+1).join(` `),De.raw=De.raw.substring(0,De.raw.length-Qe.length),Lt=$t-1)),Ft=ht||/\n\n(?!\s*$)/.test(it),Lt!==$t-1&&(ht=it.charAt(it.length-1)===` `,Ft||(Ft=ht)),Ft&&(De.loose=!0),Ct=/^\[[ xX]\] /.test(it),Yt=void 0,Ct&&(Yt=it[1]!==" ",it=it.replace(/^\[[ xX]\] +/,"")),De.items.push({type:"list_item",raw:oe,task:Ct,checked:Yt,loose:Ft,text:it});return De}},de.html=function(te){var ie=this.rules.block.html.exec(te);if(ie)return{type:this.options.sanitize?"paragraph":"html",raw:ie[0],pre:!this.options.sanitizer&&(ie[1]==="pre"||ie[1]==="script"||ie[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):ee(ie[0]):ie[0]}},de.def=function(te){var ie=this.rules.block.def.exec(te);if(ie){ie[3]&&(ie[3]=ie[3].substring(1,ie[3].length-1));var oe=ie[1].toLowerCase().replace(/\s+/g," ");return{tag:oe,raw:ie[0],href:ie[2],title:ie[3]}}},de.table=function(te){var ie=this.rules.block.table.exec(te);if(ie){var oe={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(` `):[]};if(oe.header.length===oe.align.length){oe.raw=ie[0];var he=oe.align.length,ge;for(ge=0;ge/i.test(he[0])&&(ie=!1),!oe&&/^<(pre|code|kbd|script)(\s|>)/i.test(he[0])?oe=!0:oe&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(he[0])&&(oe=!1),{type:this.options.sanitize?"text":"html",raw:he[0],inLink:ie,inRawBlock:oe,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):ee(he[0]):he[0]}},de.link=function(te){var ie=this.rules.inline.link.exec(te);if(ie){var oe=re(ie[2],"()");if(oe>-1){var he=ie[0].indexOf("!")===0?5:4,ge=he+ie[1].length+oe;ie[2]=ie[2].substring(0,oe),ie[0]=ie[0].substring(0,ge).trim(),ie[3]=""}var Ce=ie[2],De="";if(this.options.pedantic){var Ke=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ce);Ke?(Ce=Ke[1],De=Ke[3]):De=""}else De=ie[3]?ie[3].slice(1,-1):"";Ce=Ce.trim().replace(/^<([\s\S]*)>$/,"$1");var ht=ue(ie,{href:Ce&&Ce.replace(this.rules.inline._escapes,"$1"),title:De&&De.replace(this.rules.inline._escapes,"$1")},ie[0]);return ht}},de.reflink=function(te,ie){var oe;if((oe=this.rules.inline.reflink.exec(te))||(oe=this.rules.inline.nolink.exec(te))){var he=(oe[2]||oe[1]).replace(/\s+/g," ");if(he=ie[he.toLowerCase()],!he||!he.href){var ge=oe[0].charAt(0);return{type:"text",raw:ge,text:ge}}var Ce=ue(oe,he,oe[0]);return Ce}},de.strong=function(te,ie,oe){oe===void 0&&(oe="");var he=this.rules.inline.strong.start.exec(te);if(he&&(!he[1]||he[1]&&(oe===""||this.rules.inline.punctuation.exec(oe)))){ie=ie.slice(-1*te.length);var ge=he[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ge.lastIndex=0;for(var Ce;(he=ge.exec(ie))!=null;)if(Ce=this.rules.inline.strong.middle.exec(ie.slice(0,he.index+3)),Ce)return{type:"strong",raw:te.slice(0,Ce[0].length),text:te.slice(2,Ce[0].length-2)}}},de.em=function(te,ie,oe){oe===void 0&&(oe="");var he=this.rules.inline.em.start.exec(te);if(he&&(!he[1]||he[1]&&(oe===""||this.rules.inline.punctuation.exec(oe)))){ie=ie.slice(-1*te.length);var ge=he[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ge.lastIndex=0;for(var Ce;(he=ge.exec(ie))!=null;)if(Ce=this.rules.inline.em.middle.exec(ie.slice(0,he.index+2)),Ce)return{type:"em",raw:te.slice(0,Ce[0].length),text:te.slice(1,Ce[0].length-1)}}},de.codespan=function(te){var ie=this.rules.inline.code.exec(te);if(ie){var oe=ie[2].replace(/\n/g," "),he=/[^ ]/.test(oe),ge=oe.startsWith(" ")&&oe.endsWith(" ");return he&&ge&&(oe=oe.substring(1,oe.length-1)),oe=ee(oe,!0),{type:"codespan",raw:ie[0],text:oe}}},de.br=function(te){var ie=this.rules.inline.br.exec(te);if(ie)return{type:"br",raw:ie[0]}},de.del=function(te){var ie=this.rules.inline.del.exec(te);if(ie)return{type:"del",raw:ie[0],text:ie[1]}},de.autolink=function(te,ie){var oe=this.rules.inline.autolink.exec(te);if(oe){var he,ge;return oe[2]==="@"?(he=ee(this.options.mangle?ie(oe[1]):oe[1]),ge="mailto:"+he):(he=ee(oe[1]),ge=he),{type:"link",raw:oe[0],text:he,href:ge,tokens:[{type:"text",raw:he,text:he}]}}},de.url=function(te,ie){var oe;if(oe=this.rules.inline.url.exec(te)){var he,ge;if(oe[2]==="@")he=ee(this.options.mangle?ie(oe[0]):oe[0]),ge="mailto:"+he;else{var Ce;do Ce=oe[0],oe[0]=this.rules.inline._backpedal.exec(oe[0])[0];while(Ce!==oe[0]);he=ee(oe[0]),oe[1]==="www."?ge="http://"+he:ge=he}return{type:"link",raw:oe[0],text:he,href:ge,tokens:[{type:"text",raw:he,text:he}]}}},de.inlineText=function(te,ie,oe){var he=this.rules.inline.text.exec(te);if(he){var ge;return ie?ge=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):ee(he[0]):he[0]:ge=ee(this.options.smartypants?oe(he[0]):he[0]),{type:"text",raw:he[0],text:ge}}},ve}(),be=V.noopTest,we=V.edit,xe=V.merge,me={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:be,table:be,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};me._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,me._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,me.def=we(me.def).replace("label",me._label).replace("title",me._title).getRegex(),me.bullet=/(?:[*+-]|\d{1,9}[.)])/,me.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,me.item=we(me.item,"gm").replace(/bull/g,me.bullet).getRegex(),me.list=we(me.list).replace(/bull/g,me.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+me.def.source+")").getRegex(),me._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",me._comment=//,me.html=we(me.html,"i").replace("comment",me._comment).replace("tag",me._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),me.paragraph=we(me._paragraph).replace("hr",me.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",me._tag).getRegex(),me.blockquote=we(me.blockquote).replace("paragraph",me.paragraph).getRegex(),me.normal=xe({},me),me.gfm=xe({},me.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*|$)"}),me.gfm.nptable=we(me.gfm.nptable).replace("hr",me.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",me._tag).getRegex(),me.gfm.table=we(me.gfm.table).replace("hr",me.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",me._tag).getRegex(),me.pedantic=xe({},me.normal,{html:we(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",me._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:be,paragraph:we(me.normal._paragraph).replace("hr",me.hr).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",me.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:be,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:be,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",se.punctuation=we(se.punctuation).replace(/punctuation/g,se._punctuation).getRegex(),se._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",se._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",se.em.start=we(se.em.start).replace(/punctuation/g,se._punctuation).getRegex(),se.em.middle=we(se.em.middle).replace(/punctuation/g,se._punctuation).replace(/overlapSkip/g,se._overlapSkip).getRegex(),se.em.endAst=we(se.em.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.em.endUnd=we(se.em.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.start=we(se.strong.start).replace(/punctuation/g,se._punctuation).getRegex(),se.strong.middle=we(se.strong.middle).replace(/punctuation/g,se._punctuation).replace(/blockSkip/g,se._blockSkip).getRegex(),se.strong.endAst=we(se.strong.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.endUnd=we(se.strong.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.blockSkip=we(se._blockSkip,"g").getRegex(),se.overlapSkip=we(se._overlapSkip,"g").getRegex(),se._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,se._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,se._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])?)+(?![-_])/,se.autolink=we(se.autolink).replace("scheme",se._scheme).replace("email",se._email).getRegex(),se._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,se.tag=we(se.tag).replace("comment",me._comment).replace("attribute",se._attribute).getRegex(),se._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,se._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,se._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,se.link=we(se.link).replace("label",se._label).replace("href",se._href).replace("title",se._title).getRegex(),se.reflink=we(se.reflink).replace("label",se._label).getRegex(),se.reflinkSearch=we(se.reflinkSearch,"g").replace("reflink",se.reflink).replace("nolink",se.nolink).getRegex(),se.normal=xe({},se),se.pedantic=xe({},se.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:we(/^!?\[(label)\]\((.*?)\)/).replace("label",se._label).getRegex(),reflink:we(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se._label).getRegex()}),se.gfm=xe({},se.normal,{escape:we(se.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\.5&&(te="x"+te.toString(16)),de+="&#"+te+";";return de}var Le=function(){function ve(pe){this.tokens=[],this.tokens.links=Object.create(null),this.options=pe||ze,this.options.tokenizer=this.options.tokenizer||new ye,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:He.normal,inline:rt.normal};this.options.pedantic?(te.block=He.pedantic,te.inline=rt.pedantic):this.options.gfm&&(te.block=He.gfm,this.options.breaks?te.inline=rt.breaks:te.inline=rt.gfm),this.tokenizer.rules=te}ve.lex=function(te,ie){var oe=new ve(ie);return oe.lex(te)};var de=ve.prototype;return de.lex=function(te){return te=te.replace(/\r\n|\r/g,` `).replace(/\t/g," "),this.blockTokens(te,this.tokens,!0),this.inline(this.tokens),this.tokens},de.blockTokens=function(te,ie,oe){ie===void 0&&(ie=[]),oe===void 0&&(oe=!0),te=te.replace(/^ +$/gm,"");for(var he,ge,Ce,De;te;){if(he=this.tokenizer.space(te)){te=te.substring(he.raw.length),he.type&&ie.push(he);continue}if(he=this.tokenizer.code(te,ie)){te=te.substring(he.raw.length),he.type?ie.push(he):(De=ie[ie.length-1],De.raw+=` `+he.raw,De.text+=` `+he.text);continue}if(he=this.tokenizer.fences(te)){te=te.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.heading(te)){te=te.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.nptable(te)){te=te.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.hr(te)){te=te.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.blockquote(te)){te=te.substring(he.raw.length),he.tokens=this.blockTokens(he.text,[],oe),ie.push(he);continue}if(he=this.tokenizer.list(te)){for(te=te.substring(he.raw.length),Ce=he.items.length,ge=0;ge0)for(;(Ke=this.tokenizer.rules.inline.reflinkSearch.exec(De))!=null;)ht.includes(Ke[0].slice(Ke[0].lastIndexOf("[")+1,-1))&&(De=De.slice(0,Ke.index)+"["+"a".repeat(Ke[0].length-2)+"]"+De.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ke=this.tokenizer.rules.inline.blockSkip.exec(De))!=null;)De=De.slice(0,Ke.index)+"["+"a".repeat(Ke[0].length-2)+"]"+De.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(Ce=this.tokenizer.escape(te)){te=te.substring(Ce.raw.length),ie.push(Ce);continue}if(Ce=this.tokenizer.tag(te,oe,he)){te=te.substring(Ce.raw.length),oe=Ce.inLink,he=Ce.inRawBlock,ie.push(Ce);continue}if(Ce=this.tokenizer.link(te)){te=te.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,he)),ie.push(Ce);continue}if(Ce=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,he)),ie.push(Ce);continue}if(Ce=this.tokenizer.strong(te,De,ge)){te=te.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],oe,he),ie.push(Ce);continue}if(Ce=this.tokenizer.em(te,De,ge)){te=te.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],oe,he),ie.push(Ce);continue}if(Ce=this.tokenizer.codespan(te)){te=te.substring(Ce.raw.length),ie.push(Ce);continue}if(Ce=this.tokenizer.br(te)){te=te.substring(Ce.raw.length),ie.push(Ce);continue}if(Ce=this.tokenizer.del(te)){te=te.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],oe,he),ie.push(Ce);continue}if(Ce=this.tokenizer.autolink(te,Oe)){te=te.substring(Ce.raw.length),ie.push(Ce);continue}if(!oe&&(Ce=this.tokenizer.url(te,Oe))){te=te.substring(Ce.raw.length),ie.push(Ce);continue}if(Ce=this.tokenizer.inlineText(te,he,ot)){te=te.substring(Ce.raw.length),ge=Ce.raw.slice(-1),ie.push(Ce);continue}if(te){var it="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(it);break}else throw new Error(it)}}return ie},J(ve,null,[{key:"rules",get:function(){return{block:He,inline:rt}}}]),ve}(),Ue=W.defaults,Ge=V.cleanUrl,je=V.escape,Me=function(){function ve(pe){this.options=pe||Ue}var de=ve.prototype;return de.code=function(te,ie,oe){var he=(ie||"").match(/\S*/)[0];if(this.options.highlight){var ge=this.options.highlight(te,he);ge!=null&&ge!==te&&(oe=!0,te=ge)}return he?'
    '+(oe?te:je(te,!0))+`
    `:"
    "+(oe?te:je(te,!0))+`
    `},de.blockquote=function(te){return`
    `+te+`
    `},de.html=function(te){return te},de.heading=function(te,ie,oe,he){return this.options.headerIds?"'+te+" `:""+te+" `},de.hr=function(){return this.options.xhtml?`
    `:`
    `},de.list=function(te,ie,oe){var he=ie?"ol":"ul",ge=ie&&oe!==1?' start="'+oe+'"':"";return"<"+he+ge+`> `+te+" `},de.listitem=function(te){return"
  • "+te+`
  • `},de.checkbox=function(te){return" "},de.paragraph=function(te){return"

    "+te+`

    `},de.table=function(te,ie){return ie&&(ie=""+ie+""),` `+te+` `+ie+`
    `},de.tablerow=function(te){return` `+te+` `},de.tablecell=function(te,ie){var oe=ie.header?"th":"td",he=ie.align?"<"+oe+' align="'+ie.align+'">':"<"+oe+">";return he+te+" `},de.strong=function(te){return""+te+""},de.em=function(te){return""+te+""},de.codespan=function(te){return""+te+""},de.br=function(){return this.options.xhtml?"
    ":"
    "},de.del=function(te){return""+te+""},de.link=function(te,ie,oe){if(te=Ge(this.options.sanitize,this.options.baseUrl,te),te===null)return oe;var he='",he},de.image=function(te,ie,oe){if(te=Ge(this.options.sanitize,this.options.baseUrl,te),te===null)return oe;var he=''+oe+'":">",he},de.text=function(te){return te},ve}(),Pe=function(){function ve(){}var de=ve.prototype;return de.strong=function(te){return te},de.em=function(te){return te},de.codespan=function(te){return te},de.del=function(te){return te},de.html=function(te){return te},de.text=function(te){return te},de.link=function(te,ie,oe){return""+oe},de.image=function(te,ie,oe){return""+oe},de.br=function(){return""},ve}(),ut=function(){function ve(){this.seen={}}var de=ve.prototype;return de.slug=function(te){var ie=te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ie)){var oe=ie;do this.seen[oe]++,ie=oe+"-"+this.seen[oe];while(this.seen.hasOwnProperty(ie))}return this.seen[ie]=0,ie},ve}(),tt=W.defaults,qe=V.unescape,$e=function(){function ve(pe){this.options=pe||tt,this.options.renderer=this.options.renderer||new Me,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Pe,this.slugger=new ut}ve.parse=function(te,ie){var oe=new ve(ie);return oe.parse(te)};var de=ve.prototype;return de.parse=function(te,ie){ie===void 0&&(ie=!0);var oe="",he,ge,Ce,De,Ke,ht,it,mt,_t,Qe,Ft,Ct,Yt,$t,Lt,di,Ii,Ve,St=te.length;for(he=0;he0&&Lt.tokens[0].type==="text"?(Lt.tokens[0].text=Ve+" "+Lt.tokens[0].text,Lt.tokens[0].tokens&&Lt.tokens[0].tokens.length>0&&Lt.tokens[0].tokens[0].type==="text"&&(Lt.tokens[0].tokens[0].text=Ve+" "+Lt.tokens[0].tokens[0].text)):Lt.tokens.unshift({type:"text",text:Ve}):$t+=Ve),$t+=this.parse(Lt.tokens,Yt),_t+=this.renderer.listitem($t,Ii,di);oe+=this.renderer.list(_t,Ft,Ct);continue}case"html":{oe+=this.renderer.html(Qe.text);continue}case"paragraph":{oe+=this.renderer.paragraph(this.parseInline(Qe.tokens));continue}case"text":{for(_t=Qe.tokens?this.parseInline(Qe.tokens):Qe.text;he+1An error occurred:

    "+Ye(Ce.message+"",!0)+"
    ";throw Ce}}Se.options=Se.setOptions=function(ve){return ft(Se.defaults,ve),ct(Se.defaults),Se},Se.getDefaults=Ae,Se.defaults=Je,Se.use=function(ve){var de=ft({},ve);if(ve.renderer&&function(){var te=Se.defaults.renderer||new Me,ie=function(ge){var Ce=te[ge];te[ge]=function(){for(var De=arguments.length,Ke=new Array(De),ht=0;ht`,triples:"",explode:"[]{}"},D=ae.Pos;ae.defineOption("autoCloseBrackets",!1,function(r,d,o){o&&o!=ae.Init&&(r.removeKeyMap(F),r.state.closeBrackets=null),d&&(U(Y(d,"pairs")),r.state.closeBrackets=d,r.addKeyMap(F))});function Y(r,d){return d=="pairs"&&typeof r=="string"?r:typeof r=="object"&&r[d]!=null?r[d]:J[d]}var F={Backspace:k,Enter:I};function U(r){for(var d=0;d=0;l--){var R=s[l].head;r.replaceRange("",D(R.line,R.ch-1),D(R.line,R.ch+1),"+delete")}}function I(r){var d=j(r),o=d&&Y(d,"explode");if(!o||r.getOption("disableInput"))return ae.Pass;for(var s=r.listSelections(),l=0;l0;return{anchor:new D(r.anchor.line,r.anchor.ch+(d?-1:1)),head:new D(r.head.line,r.head.ch+(d?1:-1))}}function c(r,d){var o=j(r);if(!o||r.getOption("disableInput"))return ae.Pass;var s=Y(o,"pairs"),l=s.indexOf(d);if(l==-1)return ae.Pass;for(var p=Y(o,"closeBefore"),R=Y(o,"triples"),w=s.charAt(l+1)==d,x=r.listSelections(),O=l%2==0,A,T=0;T=0&&r.getRange(y,D(y.line,y.ch+3))==d+d+d?h="skipThree":h="skip";else if(w&&y.ch>1&&R.indexOf(d)>=0&&r.getRange(D(y.line,y.ch-2),y)==d+d){if(y.ch>2&&/\bstring/.test(r.getTokenTypeAt(D(y.line,y.ch-2))))return ae.Pass;h="addFour"}else if(w){var g=y.ch==0?" ":r.getRange(D(y.line,y.ch-1),y);if(!ae.isWordChar(_)&&g!=d&&!ae.isWordChar(g))h="both";else return ae.Pass}else if(O&&(_.length===0||/\s/.test(_)||p.indexOf(_)>-1))h="both";else return ae.Pass;if(!A)A=h;else if(A!=h)return ae.Pass}var b=l%2?s.charAt(l-1):d,M=l%2?d:s.charAt(l+1);r.operation(function(){if(A=="skip")r.execCommand("goCharRight");else if(A=="skipThree")for(var P=0;P<3;P++)r.execCommand("goCharRight");else if(A=="surround"){for(var K=r.getSelections(),P=0;P=0)continue;if(!Object.prototype.hasOwnProperty.call(c,r))continue;u[r]=c[r]}return u}function j(c,f){if(!(c instanceof f))throw new TypeError("Cannot call a class as a function")}function k(c,f){if(!c)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return f&&(typeof f=="object"||typeof f=="function")?f:c}function I(c,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof f);c.prototype=Object.create(f&&f.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),f&&(Object.setPrototypeOf?Object.setPrototypeOf(c,f):c.__proto__=f)}var m=function(c){I(f,c);function f(u){j(this,f);var r=k(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,u));return r.scrollListener=r.scrollListener.bind(r),r.eventListenerOptions=r.eventListenerOptions.bind(r),r.mousewheelListener=r.mousewheelListener.bind(r),r}return ae(f,[{key:"componentDidMount",value:function(){this.pageLoaded=this.props.pageStart,this.options=this.eventListenerOptions(),this.attachScrollListener()}},{key:"componentDidUpdate",value:function(){if(this.props.isReverse&&this.loadMore){var r=this.getParentElement(this.scrollComponent);r.scrollTop=r.scrollHeight-this.beforeScrollHeight+this.beforeScrollTop,this.loadMore=!1}this.attachScrollListener()}},{key:"componentWillUnmount",value:function(){this.detachScrollListener(),this.detachMousewheelListener()}},{key:"isPassiveSupported",value:function(){var r=!1,d={get passive(){r=!0}};try{document.addEventListener("test",null,d),document.removeEventListener("test",null,d)}catch(o){}return r}},{key:"eventListenerOptions",value:function(){var r=this.props.useCapture;return this.isPassiveSupported()&&(r={useCapture:this.props.useCapture,passive:!0}),r}},{key:"setDefaultLoader",value:function(r){this.defaultLoader=r}},{key:"detachMousewheelListener",value:function(){var r=window;this.props.useWindow===!1&&(r=this.scrollComponent.parentNode),r.removeEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture)}},{key:"detachScrollListener",value:function(){var r=window;this.props.useWindow===!1&&(r=this.getParentElement(this.scrollComponent)),r.removeEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),r.removeEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture)}},{key:"getParentElement",value:function(r){var d=this.props.getScrollParent&&this.props.getScrollParent();return d!=null?d:r&&r.parentNode}},{key:"filterProps",value:function(r){return r}},{key:"attachScrollListener",value:function(){var r=this.getParentElement(this.scrollComponent);if(!this.props.hasMore||!r)return;var d=window;this.props.useWindow===!1&&(d=r),d.addEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture),d.addEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),d.addEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture),this.props.initialLoad&&this.scrollListener()}},{key:"mousewheelListener",value:function(r){r.deltaY===1&&!this.isPassiveSupported()&&r.preventDefault()}},{key:"scrollListener",value:function(){var r=this.scrollComponent,d=window,o=this.getParentElement(r),s=void 0;if(this.props.useWindow){var l=document.documentElement||document.body.parentNode||document.body,p=d.pageYOffset!==void 0?d.pageYOffset:l.scrollTop;this.props.isReverse?s=p:s=this.calculateOffset(r,p)}else this.props.isReverse?s=o.scrollTop:s=r.scrollHeight-o.scrollTop-o.clientHeight;s1&&arguments[1]!==void 0?arguments[1]:1,pe=Pe.length,te=0;te1&&arguments[1]!==void 0?arguments[1]:!1;return Object(O.a)(C).map(function(ee,re){if(!F.isValidElement(ee)||!ee.type)return null;var ue=ee.type.isSelectOptGroup,Te=ee.key,ye=ee.props,be=ye.children,we=Object(W.a)(ye,["children"]);return $||!ue?A(ee):Object(x.a)(Object(x.a)({key:"__RC_SELECT_GRP__".concat(Te===null?re:Te,"__"),label:Te},we),{},{options:T(be)})}).filter(function(ee){return ee})}var E=ne("2Qr1"),y=ne("qNPg"),h=ne("U8pU"),_=ne("Kwbf"),g=ne("WKfj");function b(C){var $=C.mode,ee=C.options,re=C.children,ue=C.backfill,Te=C.allowClear,ye=C.placeholder,be=C.getInputElement,we=C.showSearch,xe=C.onSearch,me=C.defaultOpen,se=C.autoFocus,Re=C.labelInValue,ze=C.value,He=C.inputValue,rt=C.optionLabelProp,ot=$==="multiple"||$==="tags",Oe=we!==void 0?we:ot||$==="combobox",Le=ee||T(re);if(Object(_.a)($!=="tags"||Le.every(function(Me){return!Me.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var Ue=Le.some(function(Me){return Me.options?Me.options.some(function(Pe){return typeof("value"in Pe?Pe.value:Pe.key)=="number"}):typeof("value"in Me?Me.value:Me.key)=="number"});Object(_.a)(!Ue,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(_.a)($!=="combobox"||!rt,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(_.a)($==="combobox"||!ue,"`backfill` only works with `combobox` mode."),Object(_.a)($==="combobox"||!be,"`getInputElement` only work with `combobox` mode."),Object(_.b)($!=="combobox"||!be||!Te||!ye,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),xe&&!Oe&&$!=="combobox"&&$!=="tags"&&Object(_.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(_.b)(!me||se,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ze!=null){var Ge=Object(g.d)(ze);Object(_.a)(!Re||Ge.every(function(Me){return Object(h.a)(Me)==="object"&&("key"in Me||"value"in Me)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(_.a)(!ot||Array.isArray(ze),"`value` should be array when `mode` is `multiple` or `tags`")}if(re){var je=null;Object(O.a)(re).some(function(Me){if(!F.isValidElement(Me)||!Me.type)return!1;var Pe=Me.type;if(Pe.isSelectOption)return!1;if(Pe.isSelectOptGroup){var ut=Object(O.a)(Me.props.children).every(function(tt){return!F.isValidElement(tt)||!Me.type||tt.type.isSelectOption?!0:(je=tt.type,!1)});return!ut}return je=Pe,!0}),je&&Object(_.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(je.displayName||je.name||je,"`.")),Object(_.a)(He===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=b,P=Object(y.a)({prefixCls:"rc-select",components:{optionList:s},convertChildrenToData:T,flattenOptions:E.d,getLabeledValue:E.e,filterOptions:E.b,isValueDisabled:E.g,findValueOption:E.c,warningProps:M,fillOptionsWithMissingValue:E.a}),K=function(C){Object(D.a)(ee,C);var $=Object(Y.a)(ee);function ee(){var re;return Object(ae.a)(this,ee),re=$.apply(this,arguments),re.selectRef=F.createRef(),re.focus=function(){re.selectRef.current.focus()},re.blur=function(){re.selectRef.current.blur()},re}return Object(J.a)(ee,[{key:"render",value:function(){return F.createElement(P,Object.assign({ref:this.selectRef},this.props))}}]),ee}(F.Component);K.Option=p,K.OptGroup=w;var V=K,B=et.c=V},M8RZ:function(vt,et,ne){"use strict";ne.d(et,"a",function(){return k});var ae=ne("fWQN"),J=ne("mtLc"),D=ne("yKVA"),Y=ne("879j"),F=ne("q1tI"),U=ne.n(F),W=ne("i8i4"),j=ne.n(W),k=function(I){Object(D.a)(c,I);var m=Object(Y.a)(c);function c(f){var u;Object(ae.a)(this,c),u=m.call(this,f);var r=window.document;return u.node=r.createElement("div"),r.body.appendChild(u.node),u}return Object(J.a)(c,[{key:"render",value:function(){var u=this.props.children;return Object(W.createPortal)(u,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),c}(U.a.Component)},Ot1p:function(vt,et,ne){"use strict";var ae=ne("2qtc"),J=ne("kLXV"),D=ne("rAM+"),Y=ne("miYZ"),F=ne("tsqr"),U=ne("9og8"),W=ne("tJVT"),j=ne("jrin"),k=ne("WmNS"),I=ne.n(k),m=ne("q1tI"),c=ne.n(m),f=ne("VrN/"),u=ne.n(f),r=ne("bdgK"),d=ne("p77/"),o=ne("Bd2K"),s=ne("ELLl"),l=ne("19Vz"),p=ne("lZu9"),R=ne("+NIl"),w=ne("kSUc"),x=ne("9Bee"),O=function(ge){var Ce=ge.value,De=Ce===void 0?"":Ce,Ke=ge.className,ht=ge.showTextOnly,it=ge.showLines,mt=ge.style,_t=mt===void 0?{}:mt,Qe=Object(m.useMemo)(function(){return""},[De]);return c.a.createElement(c.a.Fragment,null,c.a.createElement("div",{dangerouslySetInnerHTML:{__html:Qe}}))},A=ne("0Owb"),T=ne("dejd"),E=ne("C+DQ"),y=ne("1vsH"),h=ne("m3rI"),_=[{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 g(ge){var Ce=ge.onActionCallback,De=ge.title,Ke=ge.icon,ht=ge.actionName,it=ge.className,mt=it===void 0?"":it,_t=ge.children;function Qe(){Ce(ht)}return c.a.createElement("a",{title:De,className:mt,onClick:Qe},c.a.createElement("i",{className:"md-iconfont ".concat(Ke)}),_t)}var b=function(ge){var Ce=ge.watch,De=ge.showNullButton,Ke=ge.onActionCallback,ht=ge.fullScreen,it=ge.insertTemp,mt=ge.hidetoolBar,_t=ge.uuid,Qe=ge.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(y.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(y.F)("_educoder_session"),"&key=").concat(_t,"&api=").concat(encodeURIComponent(h.a.PROXY_SERVER)));var Ft=[].concat(_,[{title:"".concat(Ce?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ce?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return c.a.createElement("ul",{className:"markdown-toolbar-container"},!mt&&Ft.map(function(Ct,Yt){return c.a.createElement("li",{key:Yt},Ct.actionName?c.a.createElement(g,Object(A.a)({},Ct,{onActionCallback:Ke})):c.a.createElement("span",{className:"v-line"}))}),De?c.a.createElement("li",null,c.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ke},c.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,it&&c.a.createElement("li",null,c.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(it),onActionCallback:Ke},c.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),c.a.createElement("li",{className:"btn-full-screen"},c.a.createElement(g,{icon:"".concat(ht?"icon-shrink":"icon-enlarge"),title:ht?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ke})))},M=ne("M8RZ"),P=ne("+L6B"),K=ne("2/Rp"),V=ne("y8nQ"),B=ne("Vl3Y"),C=ne("5NDa"),$=ne("5rEg"),ee={labelCol:{span:4},wrapperCol:{span:20}},re=function(ge){var Ce=ge.callback,De=ge.onCancel;function Ke(ht){Ce(ht)}return c.a.createElement(B.a,Object(A.a)({},ee,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ke}),c.a.createElement(B.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},c.a.createElement($.a,null)),c.a.createElement(B.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},c.a.createElement($.a,null)),c.a.createElement("div",{className:"flex-container flex-end"},c.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),c.a.createElement(K.a,{type:"ghost",onClick:De},"\u53D6\u6D88")))},ue=ne("7ahc"),Te=ne("HmJG"),ye=ne("BjJ7"),be=B.a.useForm,we={width:280,marginRight:10},xe={labelCol:{span:5},wrapperCol:{span:19}},me=function(ge){var Ce=ge.callback,De=ge.onCancel,Ke=be(),ht=Object(W.a)(Ke,1),it=ht[0];function mt(Ft){Ce(Ft)}function _t(Ft,Ct){if(Ft.status===-1){F.b.error(Ft.message);return}it.setFieldsValue({src:"/api/attachments/".concat(Ft.id),type:Ct.type})}function Qe(Ft){var Ct=Ft.target.files[0];Re(Ct,_t)}return c.a.createElement(B.a,Object(A.a)({form:it},xe,{className:"upload-image-panel",onFinish:mt}),c.a.createElement(B.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},c.a.createElement("div",{className:"flex-container"},c.a.createElement(B.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},c.a.createElement($.a,{style:we})),c.a.createElement(se,{onFileChange:Qe}))),c.a.createElement(B.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},c.a.createElement($.a,{style:{width:264}})),c.a.createElement(B.a.Item,{style:{textAlign:"right"}},c.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),c.a.createElement(K.a,{type:"ghost",onClick:De},"\u53D6\u6D88")))};function se(ge){var Ce=ge.onFileChange;return c.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",c.a.createElement("input",{type:"file",onChange:Ce}))}function Re(ge,Ce){if(!ge)throw new String("\u6CA1\u6709\u6587\u4EF6");var De=new FormData;De.append("editormd-image-file",ge),De.append("file_param_name","editormd-image-file"),De.append("byxhr","true");var Ke=new window.XMLHttpRequest;Ke.withCredentials=!0,Ke.addEventListener("load",function(ht){Ce(JSON.parse(ht.target.responseText),ge)},!1),Ke.addEventListener("error",function(ht){console.error(ht)},!1),Ke.open("POST","".concat(ye.a,"/api/attachments.json")),Ke.send(De)}var ze=ne("giR+"),He=ne("fyUT"),rt=ne("7Kak"),ot=ne("9yH6"),Oe=ot.a.Group,Le={margin:"0 8px"},Ue=function(ge){var Ce=ge.callback,De=ge.onCancel;function Ke(ht){Ce(ht)}return c.a.createElement(B.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ke},c.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},c.a.createElement("span",{style:Le},"\u5355\u5143\u683C\u6570\uFF1A"),c.a.createElement("span",{style:Le},"\u884C\u6570"),c.a.createElement(B.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},c.a.createElement(He.a,null)),c.a.createElement("span",{style:Le},"\u5217\u6570"),c.a.createElement(B.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},c.a.createElement(He.a,null))),c.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},c.a.createElement("span",{style:Le},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),c.a.createElement(B.a.Item,{name:"align"},c.a.createElement(Oe,null,c.a.createElement(ot.a,{value:"default"},c.a.createElement("i",{className:"fa fa-align-justify"})),c.a.createElement(ot.a,{value:"left"},c.a.createElement("i",{className:"fa fa-align-left"})),c.a.createElement(ot.a,{value:"center"},c.a.createElement("i",{className:"fa fa-align-center"})),c.a.createElement(ot.a,{value:"right"},c.a.createElement("i",{className:"fa fa-align-right"}))))),c.a.createElement("div",{className:"flex-container flex-end"},c.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),c.a.createElement(K.a,{type:"ghost",onClick:De},"\u53D6\u6D88")))},Ge=ne("ErOA"),je=ne("7Cbv"),Me="link",Pe="upload-image",ut="code-block",tt="add-table",qe="------------",$e={default:qe,left:":".concat(qe),center:":".concat(qe,":"),right:"".concat(qe,":")},ft=ne("9VGf"),nt,Ye;function Ae(){}var ct=0,Je=1e4,Se="\u2581",Ne=` **\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 ve(ge){return/^\d+$/.test(ge)?"".concat(ge,"px"):ge}var de=navigator.platform.toUpperCase().indexOf("MAC")>=0,pe=de?"Cmd":"Ctrl",te=["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"],ie=(nt={},Object(j.a)(nt,pe+"-B","bold"),Object(j.a)(nt,pe+"-I","italic"),nt),oe=(Ye={},Object(j.a)(Ye,Me,"\u6DFB\u52A0\u94FE\u63A5"),Object(j.a)(Ye,ut,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(j.a)(Ye,Pe,"\u6DFB\u52A0\u6587\u4EF6"),Object(j.a)(Ye,tt,"\u6DFB\u52A0\u8868\u683C"),Ye),he=et.a=function(ge){var Ce=ge.defaultValue,De=Ce===void 0?"":Ce,Ke=ge.onChange,ht=ge.width,it=ht===void 0?"100%":ht,mt=ge.height,_t=mt===void 0?400:mt,Qe=ge.miniToolbar,Ft=Qe===void 0?!1:Qe,Ct=ge.isFocus,Yt=Ct===void 0?!1:Ct,$t=ge.watch,Lt=ge.insertTemp,di=ge.mode,Ii=di===void 0?"markdown":di,Ve=ge.id,St=Ve===void 0?"markdown-editor-id":Ve,Rt=ge.showResizeBar,It=Rt===void 0?!1:Rt,qt=ge.noStorage,jt=qt===void 0?!1:qt,Kt=ge.showNullButton,Tt=Kt===void 0?!1:Kt,lt=ge.hidetoolBar,Ai=lt===void 0?!1:lt,Ei=ge.fullScreen,ii=Ei===void 0?!1:Ei,Mt=ge.onBlur,Gi=ge.onCMBeforeChange,$i=ge.onFullScreen,pn=ge.className,We=pn===void 0?"":pn,At=ge.disablePaste,mn=At===void 0?!1:At,gn=ge.placeholder,vn=gn===void 0?"":gn,yn=ge.values,z=yn===void 0?"":yn,v=Object(m.useState)(null),S=Object(W.a)(v,2),N=S[0],Z=S[1],G=Object(m.useState)(De),fe=Object(W.a)(G,2),ke=fe[0],Ze=fe[1],gt=Object(m.useState)($t),Fe=Object(W.a)(gt,2),Et=Fe[0],Ht=Fe[1],Zt=Object(m.useState)(ii),Bi=Object(W.a)(Zt,2),xi=Bi[0],Ti=Bi[1],Qi=Object(m.useState)(""),Dn=Object(W.a)(Qi,2),ci=Dn[0],zi=Dn[1],ln=Object(m.useState)(0),un=Object(W.a)(ln,2),ji=un[0],kn=un[1],_n=Object(m.useState)(_t),Kn=Object(W.a)(_n,2),Vn=Kn[0],Ji=Kn[1],Xi=Object(m.useState)(!1),bn=Object(W.a)(Xi,2),dr=bn[0],En=bn[1],ri=Object(m.useRef)(Object(je.a)()),Wt=Object(m.useRef)(!1),yi=Object(m.useRef)(),Pt=Object(m.useRef)(),si=Object(m.useRef)(),Vt=Object(m.useRef)(),nn=Object(m.useRef)(),fi=function(){var yt=Object(U.a)(I.a.mark(function Ot(){var xt,kt;return I.a.wrap(function(Qt){for(;;)switch(Qt.prev=Qt.next){case 0:return Qt.next=2,Object(Ge.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ri.current}});case 2:kt=Qt.sent,kt!=null&&(xt=kt.attachments)!==null&&xt!==void 0&&xt.length&&(console.log("cm:",N,Pt),kt.attachments.map(function(Ut){Ut.content_type.indexOf("image")>-1?N.replaceSelection("![,](/api/attachments/".concat(Ut.id,"?type=").concat(Ut.content_type,")")):Ut.content_type.indexOf("video")>-1?N.replaceSelection('')):Ut.content_type.indexOf("pdf")>-1?N.replaceSelection('
    ').concat(Ut.name,"")):N.replaceSelection("[".concat(Ut.name,"](").concat(h.a.API_SERVER,"/api/attachments/").concat(Ut.id,"?type=").concat(Ut.content_type,")"))}));case 4:case"end":return Qt.stop()}},Ot)}));return function(){return yt.apply(this,arguments)}}();Object(m.useEffect)(function(){Ze(z),N==null||N.setValue(z)},[z]),Object(m.useEffect)(function(){$i==null||$i(xi)},[xi]),Object(m.useEffect)(function(){if(Pt.current){var yt=u.a.fromTextArea(Pt.current,{mode:Ii,lineNumbers:!Ft,lineWrapping:!0,value:De,autoCloseTags:!0,autoCloseBrackets:!0});Yt&&yt.focus();function Ot(xt,kt){if(mn){kt.preventDefault();return}var Bt=kt.clipboardData;if(Bt){var Qt=Bt.types.toString(),Ut=Bt.items;if(Qt==="Files"||Bt.types.indexOf("Files")>-1){if(kt.preventDefault(),Ii=="stex")return;try{var ui,Di=Ut[1];((ui=Ut[0])===null||ui===void 0?void 0:ui.kind)==="file"&&(Di=Ut[0]);var Nt=Di.getAsFile(),hn=Nt.name.split(".").pop();Re(Nt,function(Gt){if(Gt.id){var ki,wi,Yi;(Nt==null||((ki=Nt.type)===null||ki===void 0)?void 0:ki.indexOf("image"))>-1?yt.replaceSelection("![,](/api/attachments/".concat(Gt.id,"?type=").concat(Gt.content_type,")")):(Nt==null||((wi=Nt.type)===null||wi===void 0)?void 0:wi.indexOf("video"))>-1?yt.replaceSelection('')):(Nt==null||((Yi=Nt.type)===null||Yi===void 0)?void 0:Yi.indexOf("pdf"))>-1?yt.replaceSelection('').concat(Nt.name,"")):te.includes(hn)?yt.replaceSelection('').concat(Nt.name,"")):yt.replaceSelection("[".concat(Nt.name,"](").concat(h.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})}catch(Gt){F.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return yt.on("paste",Ot),yt.on("dragleave",function(xt,kt){si.current.classList.remove("mouse-hover-md")}),yt.on("dragover",function(xt,kt){si.current.classList.add("mouse-hover-md")}),yt.on("drop",function(xt,kt){si.current.classList.add("mouse-hover-md");var Bt;if(Bt=kt.dataTransfer.files,Bt.length>0){kt.preventDefault(),kt.stopPropagation();for(var Qt=function(Di){var Nt=Bt[Di],hn=Nt.name.split(".").pop();Re(Nt,function(Gt){if(Gt.id){var ki,wi,Yi;(Nt==null||((ki=Nt.type)===null||ki===void 0)?void 0:ki.indexOf("image"))>-1?yt.replaceSelection("![,](/api/attachments/".concat(Gt.id,"?type=").concat(Gt.content_type,")")):(Nt==null||((wi=Nt.type)===null||wi===void 0)?void 0:wi.indexOf("video"))>-1?yt.replaceSelection('')):(Nt==null||((Yi=Nt.type)===null||Yi===void 0)?void 0:Yi.indexOf("pdf"))>-1?yt.replaceSelection('').concat(Nt.name,"")):te.includes(hn)?yt.replaceSelection('').concat(Nt.name,"")):yt.replaceSelection("[".concat(Nt.name,"](").concat(h.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}else(Gt==null?void 0:Gt.status)===401&&(document.location.href="/user/login")})},Ut=0;Ut0||Ut.target.offsetWidth>0)&&(Oi(),N.setSize("100%","100%"),N.refresh())}}catch(ui){Bt.e(ui)}finally{Bt.f()}});return xt.observe(Pt.current.parentElement),xt}if(N){var Ot=yt();return function(){Ot.unobserve(Pt.current.parentElement)}}},[N,Oi]),Object(m.useEffect)(function(){if(N){for(var yt=[],Ot=function(){var Ut=kt[xt];Bt=Object(W.a)(Ut,2);var ui=Bt[0],Di=Bt[1],Nt=Object(j.a)({},ui,function(){Xn(Di)});yt.push(Nt),N.addKeyMap(Nt)},xt=0,kt=Object.entries(ie);xt0){var yt=new Date().getTime(),Ot=window.sessionStorage.getItem(St);yt>=ji+Je&&(!Ot||Ot!==ke)&&(window.sessionStorage.setItem(St,ke),En(!0))}},Je),Object(m.useEffect)(function(){Ht($t)},[N,$t]),Object(m.useEffect)(function(){N&&(Yt&&N.focus())},[N,Yt]),Object(m.useEffect)(function(){if(Et&&N){var yt=N.getScrollerElement();function Ot(xt){var kt=xt.target;if(nn.current){var Bt=kt.scrollTop/kt.scrollHeight;nn.current.scrollTop=nn.current.scrollHeight*Bt}}return yt.addEventListener("scroll",Ot),function(){yt.removeEventListener("scroll",Ot)}}},[N,Et]),Object(m.useEffect)(function(){if(N&&Gi){function yt(Ot,xt){Gi(Ot,xt)}return N.on("beforeChange",yt),function(){N.off("beforeChange",yt)}}},[N,Gi]),Object(m.useEffect)(function(){if(N&&Mt){function yt(){Mt(N.getValue())}return N.on("blur",yt),function(){N.off("blur",yt)}}},[N,Mt]),Object(m.useEffect)(function(){if(N){function yt(Ot){var xt=Ot.getValue();Ze(xt),kn(new Date().getTime()),Ot.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ke&&Ke(xt)}return N.on("change",yt),function(){N.off("change",yt)}}},[N,Ke]),Object(m.useEffect)(function(){N&&(De==null?(N.setValue(""),Ze("")):De!==N.getValue()&&(N.setValue(De),Ze(De),N.setCursor(N.lineCount(),0)))},[N,De]);var Xn=Object(m.useCallback)(function(yt){var Ot=N.getCursor(),xt=N.getSelection(),kt=xt.split(` `);switch(yt){case"bold":return N.replaceSelection("**"+xt+"**"),xt===""&&N.setCursor(Ot.line,Ot.ch+2),N.focus();case"italic":return N.replaceSelection("*"+xt+"*"),xt===""&&N.setCursor(Ot.line,Ot.ch+1),N.focus();case"code":return N.replaceSelection("`"+xt+"`"),xt===""&&N.setCursor(Ot.line,Ot.ch+1),N.focus();case"inline-latex":return N.replaceSelection("`$$"+xt+"$$`"),xt===""&&N.setCursor(Ot.line,Ot.ch+3),N.focus();case"latex":return N.replaceSelection("```latex\n"+xt+"\n```"),N.setCursor(Ot.line+1,xt.length+1),N.focus();case"line-break":return N.replaceSelection(`
    `),N.focus();case"list-ul":return xt===""?N.replaceSelection("- "+xt):N.replaceSelection(kt.map(function(Bt){return Bt===""?"":"- ".concat(Bt)}).join(` `)),N.focus();case"list-ol":return xt===""?N.replaceSelection("1. "+xt):N.replaceSelection(kt.map(function(Bt,Qt){return Bt===""?"":"".concat(Qt+1,". ").concat(Bt)}).join(` `)),N.focus();case"add-null-ch":return xt===""&&N.setCursor(Ot.line,Ot.ch+1),N.replaceSelection(Se),N.focus();case"inster-template-1":return xt===""&&N.setCursor(Ot.line,Ot.ch),N.replaceSelection(Ne),N.focus();case"eraser":return N.setValue(""),N.focus();case"trigger-watch":return Ht(!Et),N.focus();case"trigger-full-screen":return Ti(!xi),N.focus();case Me:zi(Me);return;case ut:zi(ut);return;case Pe:zi(Pe);return;case tt:zi(tt);return;default:throw new Error}},[N,Et,xi]),xn=Object(m.useCallback)(function(yt){zi("");switch(ci){case Me:var Ot=yt.title,xt=yt.link;return N.replaceSelection("[".concat(Ot,"](").concat(xt,")")),N.focus();case ut:var kt=yt.language,Bt=yt.content;return N.replaceSelection(["```"+kt,Bt,"```"].join(` `)),N.focus();case Pe:var Qt=yt.src,Ut=yt.alt;return Ut?N.replaceSelection("![ ".concat(Ut," ]( ").concat(Qt,' "').concat(Ut,'" )')):N.replaceSelection("![,](".concat(Qt,")")),N.focus();case tt:for(var ui=yt.row,Di=yt.col,Nt=yt.align,hn=` `,Gt=0;Gt300&&(ui=300);var Di=_t+ui+"px";Ji(Di)}}return yt.addEventListener("mousedown",kt),document.addEventListener("mousemove",Qt),document.addEventListener("mouseup",Bt),function(){yt.removeEventListener("mousedown",kt),document.removeEventListener("mousemove",Qt),document.removeEventListener("mouseup",Bt)}}},[N,Vt]),Object(m.useEffect)(function(){Ji(_t)},[_t]);var rn=ve(it),fr=ve(Vn),Zi={width:rn,height:fr},pr=Object(m.useMemo)(function(){if(ji){var yt=new Date(ji),Ot=yt.getHours(),xt=yt.getMinutes(),kt=yt.getSeconds();return Ot=Ot<10?"0"+Ot:Ot,xt=xt<10?"0"+xt:xt,kt=kt<10?"0"+kt:kt,"".concat(Ot,":").concat(xt,":").concat(kt)}return 0},[ji]);function jr(){window.sessionStorage.removeItem(St),En(!1),kn(0)}function Mn(){En(!1),kn(0),N.setValue(window.sessionStorage.getItem(St))}function ua(yt,Ot){var xt=N.getValue();xt=xt.replace(yt,Ot),Ze(xt),N==null||N.setValue(xt)}return c.a.createElement(m.Fragment,null,c.a.createElement("div",{className:"markdown-editor-wrapper",ref:si},c.a.createElement("div",{className:"markdown-editor-container ".concat(We," ").concat(Et?"on-preview":""," ").concat(Ft?"mini":""," ").concat(xi?"full-screen":""),style:Zi},c.a.createElement(b,{insertTemp:Lt,watch:Et,fullScreen:xi,showNullButton:Tt,onActionCallback:Xn,hidetoolBar:Ai,uuid:ri.current,setOpenPhones:function(){Wt.current=!0}}),c.a.createElement("div",{className:"markdown-editor-body"},c.a.createElement("div",{className:"codemirror-container"},c.a.createElement("textarea",{ref:Pt,placeholder:vn})),Et?c.a.createElement("div",{ref:nn,className:"preview-container"},Ii==="stex"&&c.a.createElement(O,{value:ke}),Ii!=="stex"&&c.a.createElement(x.a,{edit:!0,value:ke,replaces:ua})):null))),It?c.a.createElement("a",{ref:Vt,className:"editor-resize"}):null,c.a.createElement(M.a,null,oe[ci]?c.a.createElement(J.a,{centered:!0,title:oe[ci],visible:!0,onCancel:Tn,footer:null,className:"markdown-popup-form"},cr):null))}},RotF:function(vt,et,ne){vt.exports=ne("LSTS")},SJMd:function(vt,et){/** * @license * Copyright (C) 2006 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */var ne,ae,J,D=!1,Y,F;window.PR_SHOULD_USE_CONTINUATION=!0;var U,W;(function(){var j=window,k=["break,continue,do,else,for,if,return,while"],I=[k,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],m=[I,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],c=[m,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],f=[m,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],u=[m,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",d=[m,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],o="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",s=[k,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[k,"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"],p=[k,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=[c,u,f,d,o,s,l,p],w=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,x="str",O="kwd",A="com",T="typ",E="lit",y="pun",h="pln",_="tag",g="dec",b="src",M="atn",P="atv",K="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function B(Oe){for(var Le=0,Ue=!1,Ge=!1,je=0,Me=Oe.length;je122||(te<65||pe>90||ct.push([Math.max(65,pe)|32,Math.min(te,90)|32]),te<97||pe>122||ct.push([Math.max(97,pe)&~32,Math.min(te,122)&~32]))}}ct.sort(function(ge,Ce){return ge[0]-Ce[0]||Ce[1]-ge[1]});for(var ie=[],oe=[],Ne=0;Nehe[0]&&(he[1]+1>he[0]&&Se.push("-"),Se.push(qe(he[1])))}return Se.push("]"),Se.join("")}function ft(Ye){for(var Ae=Ye.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")),ct=Ae.length,Je=[],Se=0,Ne=0;Se=2&&pe==="["?Ae[Se]=$e(ve):pe!=="\\"&&(Ae[Se]=ve.replace(/[a-zA-Z]/g,function(oe){var he=oe.charCodeAt(0);return"["+String.fromCharCode(he&~32,he|32)+"]"}))}return Ae.join("")}for(var nt=[],je=0,Me=Oe.length;je=0;)Ue[nt.charAt(Ye)]=ft;var Ae=ft[1],ct=""+Ae;tt.hasOwnProperty(ct)||(ut.push(Ae),tt[ct]=null)}ut.push(/[\0-\uffff]/),Ge=B(ut)})();var je=Le.length,Me=function(Pe){for(var ut=Pe.sourceCode,tt=Pe.basePos,qe=Pe.sourceNode,$e=[tt,h],ft=0,nt=ut.match(Ge)||[],Ye={},Ae=0,ct=nt.length;Ae=5&&Se.substring(0,5)==="lang-",ve&&!(Ne&&typeof Ne[1]=="string")&&(ve=!1,Se=b),ve||(Ye[Je]=Se)}var te=ft;if(ft+=Je.length,!ve)$e.push(tt+te,Se);else{var ie=Ne[1],oe=Je.indexOf(ie),he=oe+ie.length;Ne[2]&&(he=Je.length-Ne[2].length,oe=he-ie.length);var ge=Se.substring(5);$(qe,tt+te,Je.substring(0,oe),Me,$e),$(qe,tt+te+oe,ie,se(ge,ie),$e),$(qe,tt+te+he,Je.substring(he),Me,$e)}}Pe.decorations=$e};return Me}function Te(Oe){var Le=[],Ue=[];Oe.tripleQuotedStrings?Le.push([x,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Oe.multiLineStrings?Le.push([x,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Le.push([x,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Oe.verbatimStrings&&Ue.push([x,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Ge=Oe.hashComments;Ge&&(Oe.cStyleComments?(Ge>1?Le.push([A,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Le.push([A,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ue.push([x,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Le.push([A,/^#[^\r\n]*/,null,"#"])),Oe.cStyleComments&&(Ue.push([A,/^\/\/[^\r\n]*/,null]),Ue.push([A,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var je=Oe.regexLiterals;if(je){var Me=je>1?"":` \r`,Pe=Me?".":"[\\S\\s]",ut="/(?=[^/*"+Me+"])(?:[^/\\x5B\\x5C"+Me+"]|\\x5C"+Pe+"|\\x5B(?:[^\\x5C\\x5D"+Me+"]|\\x5C"+Pe+")*(?:\\x5D|$))+/";Ue.push(["lang-regex",RegExp("^"+V+"("+ut+")")])}var tt=Oe.types;tt&&Ue.push([T,tt]);var qe=(""+Oe.keywords).replace(/^ | $/g,"");qe.length&&Ue.push([O,new RegExp("^(?:"+qe.replace(/[\s,]+/g,"|")+")\\b"),null]),Le.push([h,/^\s+/,null,` \r \xA0`]);var $e="^.[^\\s\\w.$@'\"`/\\\\]*";return Oe.regexLiterals&&($e+="(?!s*/)"),Ue.push([E,/^@[a-z_$][a-z_$@0-9]*/i,null],[T,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[h,/^[a-z_$][a-z_$@0-9]*/i,null],[E,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[h,/^\\[\s\S]?/,null],[y,new RegExp($e),null]),ue(Le,Ue)}var ye=Te({keywords:R,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function be(Oe,Le,Ue){for(var Ge=/(?:^|\s)nocode(?:\s|$)/,je=/\r\n?|\n/,Me=Oe.ownerDocument,Pe=Me.createElement("li");Oe.firstChild;)Pe.appendChild(Oe.firstChild);var ut=[Pe];function tt(Ae){var ct=Ae.nodeType;if(ct==1&&!Ge.test(Ae.className))if(Ae.nodeName==="br")qe(Ae),Ae.parentNode&&Ae.parentNode.removeChild(Ae);else for(var Je=Ae.firstChild;Je;Je=Je.nextSibling)tt(Je);else if((ct==3||ct==4)&&Ue){var Se=Ae.nodeValue,Ne=Se.match(je);if(Ne){var ve=Se.substring(0,Ne.index);Ae.nodeValue=ve;var de=Se.substring(Ne.index+Ne[0].length);if(de){var pe=Ae.parentNode;pe.insertBefore(Me.createTextNode(de),Ae.nextSibling)}qe(Ae),ve||Ae.parentNode.removeChild(Ae)}}}function qe(Ae){for(;!Ae.nextSibling;)if(Ae=Ae.parentNode,!Ae)return;function ct(Ne,ve){var de=ve?Ne.cloneNode(!1):Ne,pe=Ne.parentNode;if(pe){var te=ct(pe,1),ie=Ne.nextSibling;te.appendChild(de);for(var oe=ie;oe;oe=ie)ie=oe.nextSibling,te.appendChild(oe)}return de}for(var Je=ct(Ae.nextSibling,0),Se;(Se=Je.parentNode)&&Se.nodeType===1;)Je=Se;ut.push(Je)}for(var $e=0;$e=pe&&(tt+=2),Me>=te&&(ft+=2)}}finally{Se&&(Se.style.display=Ne)}}var xe={};function me(Oe,Le){for(var Ue=Le.length;--Ue>=0;){var Ge=Le[Ue];xe.hasOwnProperty(Ge)?j.console&&console.warn("cannot override language handler %s",Ge):xe[Ge]=Oe}}function se(Oe,Le){return Oe&&xe.hasOwnProperty(Oe)||(Oe=/^\s*]*(?:>|$)/],[A,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[y,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),me(ue([[h,/^[\s]+/,null,` \r `],[P,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[_,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[y,/^[=<>\/]+/],["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"]),me(ue([],[[P,/^[\s\S]+/]]),["uq.val"]),me(Te({keywords:c,hashComments:!0,cStyleComments:!0,types:w}),["c","cc","cpp","cxx","cyc","m"]),me(Te({keywords:"null,true,false"}),["json"]),me(Te({keywords:u,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:w}),["cs"]),me(Te({keywords:f,cStyleComments:!0}),["java"]),me(Te({keywords:p,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),me(Te({keywords:s,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),me(Te({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),me(Te({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),me(Te({keywords:d,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),me(Te({keywords:r,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),me(ue([],[[x,/^[\s\S]+/]]),["regex"]);function Re(Oe){var Le=Oe.langExtension;try{var Ue=C(Oe.sourceNode,Oe.pre),Ge=Ue.sourceCode;Oe.sourceCode=Ge,Oe.spans=Ue.spans,Oe.basePos=0,se(Le,Ge)(Oe),we(Oe)}catch(je){j.console&&console.log(je&&je.stack||je)}}function ze(Oe,Le,Ue){var Ge=Ue||!1,je=Le||null,Me=document.createElement("div");Me.innerHTML="
    "+Oe+"
    ",Me=Me.firstChild,Ge&&be(Me,Ge,!0);var Pe={langExtension:je,numberLines:Ge,sourceNode:Me,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Re(Pe),Me.innerHTML}function He(Oe,Le){var Ue=Le||document.body,Ge=Ue.ownerDocument||document;function je(de){return Ue.getElementsByTagName(de)}for(var Me=[je("pre"),je("code"),je("xmp")],Pe=[],ut=0;ut=0;u--)if(this.__items[u].match(f))return!0;return!1},I.prototype.set_indent=function(f,u){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=u||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},I.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)},I.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},I.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var f=this.__parent.current_line;return f.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),f.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),f.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,f.__items[0]===" "&&(f.__items.splice(0,1),f.__character_count-=1),!0}return!1},I.prototype.is_empty=function(){return this.__items.length===0},I.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},I.prototype.push=function(f){this.__items.push(f);var u=f.lastIndexOf(` `);u!==-1?this.__character_count=f.length-u:this.__character_count+=f.length},I.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},I.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},I.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},I.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},I.prototype.toString=function(){var f="";return this.is_empty()?this.__parent.indent_empty_lines&&(f=this.__parent.get_indent_string(this.__indent_count)):(f=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),f+=this.__items.join("")),f};function m(f,u){this.__cache=[""],this.__indent_size=f.indent_size,this.__indent_string=f.indent_char,f.indent_with_tabs||(this.__indent_string=new Array(f.indent_size+1).join(f.indent_char)),u=u||"",f.indent_level>0&&(u=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=u,this.__base_string_length=u.length}m.prototype.get_indent_size=function(f,u){var r=this.__base_string_length;return u=u||0,f<0&&(r=0),r+=f*this.__indent_size,r+=u,r},m.prototype.get_indent_string=function(f,u){var r=this.__base_string;return u=u||0,f<0&&(f=0,r=""),u+=f*this.__indent_size,this.__ensure_cache(u),r+=this.__cache[u],r},m.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var f=this.__cache.length,u=0,r="";this.__indent_size&&f>=this.__indent_size&&(u=Math.floor(f/this.__indent_size),f-=u*this.__indent_size,r=new Array(u+1).join(this.__indent_string)),f&&(r+=new Array(f+1).join(" ")),this.__cache.push(r)};function c(f,u){this.__indent_cache=new m(f,u),this.raw=!1,this._end_with_newline=f.end_with_newline,this.indent_size=f.indent_size,this.wrap_line_length=f.wrap_line_length,this.indent_empty_lines=f.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new I(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}c.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},c.prototype.get_line_number=function(){return this.__lines.length},c.prototype.get_indent_string=function(f,u){return this.__indent_cache.get_indent_string(f,u)},c.prototype.get_indent_size=function(f,u){return this.__indent_cache.get_indent_size(f,u)},c.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},c.prototype.add_new_line=function(f){return this.is_empty()||!f&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},c.prototype.get_code=function(f){this.trim(!0);var u=this.current_line.pop();u&&(u[u.length-1]===` `&&(u=u.replace(/\n+$/g,"")),this.current_line.push(u)),this._end_with_newline&&this.__add_outputline();var r=this.__lines.join(` `);return f!==` `&&(r=r.replace(/[\n]/g,f)),r},c.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},c.prototype.set_indent=function(f,u){return f=f||0,u=u||0,this.next_line.set_indent(f,u),this.__lines.length>1?(this.current_line.set_indent(f,u),!0):(this.current_line.set_indent(),!1)},c.prototype.add_raw_token=function(f){for(var u=0;u1&&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},c.prototype.just_added_newline=function(){return this.current_line.is_empty()},c.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},c.prototype.ensure_empty_line_above=function(f,u){for(var r=this.__lines.length-2;r>=0;){var d=this.__lines[r];if(d.is_empty())break;if(d.item(0).indexOf(f)!==0&&d.item(-1)!==u){this.__lines.splice(r+1,0,new I(this)),this.previous_line=this.__lines[this.__lines.length-2];break}r--}},k.exports.Output=c},,,,function(k){function I(f,u){this.raw_options=m(f,u),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"])}I.prototype._get_array=function(f,u){var r=this.raw_options[f],d=u||[];return typeof r=="object"?r!==null&&typeof r.concat=="function"&&(d=r.concat()):typeof r=="string"&&(d=r.split(/[^a-zA-Z0-9_\/\-]+/)),d},I.prototype._get_boolean=function(f,u){var r=this.raw_options[f],d=r===void 0?!!u:!!r;return d},I.prototype._get_characters=function(f,u){var r=this.raw_options[f],d=u||"";return typeof r=="string"&&(d=r.replace(/\\r/,"\r").replace(/\\n/,` `).replace(/\\t/," ")),d},I.prototype._get_number=function(f,u){var r=this.raw_options[f];u=parseInt(u,10),isNaN(u)&&(u=0);var d=parseInt(r,10);return isNaN(d)&&(d=u),d},I.prototype._get_selection=function(f,u,r){var d=this._get_selection_list(f,u,r);if(d.length!==1)throw new Error("Invalid Option Value: The option '"+f+`' can only be one of the following values: `+u+` You passed in: '`+this.raw_options[f]+"'");return d[0]},I.prototype._get_selection_list=function(f,u,r){if(!u||u.length===0)throw new Error("Selection list cannot be empty.");if(r=r||[u[0]],!this._is_valid_selection(r,u))throw new Error("Invalid Default Value!");var d=this._get_array(f,r);if(!this._is_valid_selection(d,u))throw new Error("Invalid Option Value: The option '"+f+`' can contain only the following values: `+u+` You passed in: '`+this.raw_options[f]+"'");return d},I.prototype._is_valid_selection=function(f,u){return f.length&&u.length&&!f.some(function(r){return u.indexOf(r)===-1})};function m(f,u){var r={};f=c(f);var d;for(d in f)d!==u&&(r[d]=f[d]);if(u&&f[u])for(d in f[u])r[d]=f[u][d];return r}function c(f){var u={},r;for(r in f){var d=r.replace(/-/g,"_");u[d]=f[r]}return u}k.exports.Options=I,k.exports.normalizeOpts=c,k.exports.mergeOpts=m},,function(k){var I=RegExp.prototype.hasOwnProperty("sticky");function m(c){this.__input=c||"",this.__input_length=this.__input.length,this.__position=0}m.prototype.restart=function(){this.__position=0},m.prototype.back=function(){this.__position>0&&(this.__position-=1)},m.prototype.hasNext=function(){return this.__position=0&&c=0&&f=c.length&&this.__input.substring(f-c.length,f).toLowerCase()===c},k.exports.InputScanner=m},,,,,function(k){function I(m,c){m=typeof m=="string"?m:m.source,c=typeof c=="string"?c:c.source,this.__directives_block_pattern=new RegExp(m+/ beautify( \w+[:]\w+)+ /.source+c,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(m+/\sbeautify\signore:end\s/.source+c,"g")}I.prototype.get_directives=function(m){if(!m.match(this.__directives_block_pattern))return null;var c={};this.__directive_pattern.lastIndex=0;for(var f=this.__directive_pattern.exec(m);f;)c[f[1]]=f[2],f=this.__directive_pattern.exec(m);return c},I.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},k.exports.Directives=I},,function(k,I,m){var c=m(16).Beautifier,f=m(17).Options;function u(r,d){var o=new c(r,d);return o.beautify()}k.exports=u,k.exports.defaultOptions=function(){return new f}},function(k,I,m){var c=m(17).Options,f=m(2).Output,u=m(8).InputScanner,r=m(13).Directives,d=new r(/\/\*/,/\*\//),o=/\r\n|[\r\n]/,s=/\r\n|[\r\n]/g,l=/\s/,p=/(?:\s|\n)+/g,R=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,w=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function x(O,A){this._source_text=O||"",this._options=new c(A),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}x.prototype.eatString=function(O){var A="";for(this._ch=this._input.next();this._ch;){if(A+=this._ch,this._ch==="\\")A+=this._input.next();else if(O.indexOf(this._ch)!==-1||this._ch===` `)break;this._ch=this._input.next()}return A},x.prototype.eatWhitespace=function(O){for(var A=l.test(this._input.peek()),T=0;l.test(this._input.peek());)this._ch=this._input.next(),O&&this._ch===` `&&((T===0||T0&&this._indentLevel--},x.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var O=this._source_text,A=this._options.eol;A==="auto"&&(A=` `,O&&o.test(O||"")&&(A=O.match(o)[0])),O=O.replace(s,` `);var T=O.match(/^[\t ]*/)[0];this._output=new f(this._options,T),this._input=new u(O),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var E=0,y=!1,h=!1,_=!1,g=!1,b=!1,M=!1,P=this._ch,K=!1,V,B,C;V=this._input.read(p),B=V!=="",C=P,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),P=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var $=this._input.read(R),ee=d.get_directives($);ee&&ee.ignore==="start"&&($+=d.readIgnored(this._input)),this.print_string($),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(B),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var re=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);re.match(/[ :]$/)&&(re=this.eatString(": ").replace(/\s$/,""),this.print_string(re),this._output.space_before_token=!0),re=re.replace(/\s$/,""),re==="extend"?g=!0:re==="import"&&(b=!0),re in this.NESTED_AT_RULE?(this._nestedLevel+=1,re in this.CONDITIONAL_GROUP_RULE&&(_=!0)):!y&&E===0&&re.indexOf(":")!==-1&&(h=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(B),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")h&&(h=!1,this.outdent()),_?(_=!1,y=this._indentLevel>=this._nestedLevel):y=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&y&&(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)):(C==="("?this._output.space_before_token=!1:C!==","&&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(),C==="{"&&this._output.trim(!0),b=!1,g=!1,h&&(this.outdent(),h=!1),this.print_string(this._ch),y=!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 ue=0;ue"||this._ch==="+"||this._ch==="~")&&!h&&E===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&l.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(B),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),l.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var be=C==='"'||C==="'";this.preserveSingleSpace(be||B),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===` `&&K&&this._output.add_new_line()}var we=this._output.get_code(A);return we},k.exports.Beautifier=x},function(k,I,m){var c=m(6).Options;function f(u){c.call(this,u,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var r=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||r;var d=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var o=0;o=15&&(c=!1,k=!0);var x=l&&(I||c&&(w==null||w<12.11)),O=D||W&&j>=9;function A(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var T=function(e,t){var n=e.className,i=A(t).exec(n);if(i){var a=n.slice(i.index+i[0].length);e.className=n.slice(0,i.index)+(a?i[1]+a:"")}};function E(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function y(e,t){return E(e).appendChild(t)}function h(e,t,n,i){var a=document.createElement(e);if(n&&(a.className=n),i&&(a.style.cssText=i),typeof t=="string")a.appendChild(document.createTextNode(t));else if(t)for(var L=0;L=t)return H+(t-L);H+=X-L,H+=n-H%n,L=X+1}}var ee=function(){this.id=null,this.f=null,this.time=0,this.handler=B(this.onTimeout,this)};ee.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ee.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n=t)return i+Math.min(H,t-a);if(a+=L-i,a+=n-a%n,i=L+1,a>=t)return i}}var me=[""];function se(e){for(;me.length<=e;)me.push(Re(me)+" ");return me[e]}function Re(e){return e[e.length-1]}function ze(e,t){for(var n=[],i=0;i"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Oe.test(e))}function Ue(e,t){return t?t.source.indexOf("\\w")>-1&&Le(e)?!0:t.test(e):Le(e)}function Ge(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var je=/[\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 Me(e){return e.charCodeAt(0)>=768&&je.test(e)}function Pe(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var a=(t+n)/2,L=i<0?Math.ceil(a):Math.floor(a);if(L==t)return e(L)?t:n;e(L)?n=L:t=L+i}}function tt(e,t,n,i){if(!e)return i(t,n,"ltr",0);for(var a=!1,L=0;Lt||t==n&&H.to==t)&&(i(Math.max(H.from,t),Math.min(H.to,n),H.level==1?"rtl":"ltr",L),a=!0)}a||i(t,n,"ltr")}var qe=null;function $e(e,t,n){var i;qe=null;for(var a=0;at)return a;L.to==t&&(L.from!=L.to&&n=="before"?i=a:qe=a),L.from==t&&(L.from!=L.to&&n!="before"?i=a:qe=a)}return i!=null?i:qe}var ft=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(q){return q<=247?e.charAt(q):1424<=q&&q<=1524?"R":1536<=q&&q<=1785?t.charAt(q-1536):1774<=q&&q<=2220?"r":8192<=q&&q<=8203?"w":q==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,a=/[stwN]/,L=/[LRr]/,H=/[Lb1n]/,X=/[1n]/;function Q(q,le,ce){this.level=q,this.from=le,this.to=ce}return function(q,le){var ce=le=="ltr"?"L":"R";if(q.length==0||le=="ltr"&&!i.test(q))return!1;for(var Ee=q.length,_e=[],Ie=0;Ie-1&&(i[t]=a.slice(0,L).concat(a.slice(L+1)))}}}function Se(e,t){var n=ct(e,t);if(!n.length)return;for(var i=Array.prototype.slice.call(arguments,2),a=0;a0}function pe(e){e.prototype.on=function(t,n){Ae(this,t,n)},e.prototype.off=function(t,n){Je(this,t,n)}}function te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ie(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function oe(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function he(e){te(e),ie(e)}function ge(e){return e.target||e.srcElement}function Ce(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var De=function(){if(W&&j<9)return!1;var e=h("div");return"draggable"in e||"dragDrop"in e}(),Ke;function ht(e){if(Ke==null){var t=h("span","\u200B");y(e,h("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ke=t.offsetWidth<=1&&t.offsetHeight>2&&!(W&&j<8))}var n=Ke?h("span","\u200B"):h("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var it;function mt(e){if(it!=null)return it;var t=y(e,document.createTextNode("A\u062EA")),n=g(t,0,1).getBoundingClientRect(),i=g(t,1,2).getBoundingClientRect();return E(e),!n||n.left==n.right?!1:it=i.right-n.right<3}var _t=` b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],i=e.length;t<=i;){var a=e.indexOf(` `,t);a==-1&&(a=e.length);var L=e.slice(t,e.charAt(a-1)=="\r"?a-1:a),H=L.indexOf("\r");H!=-1?(n.push(L.slice(0,H)),t+=H+1):(n.push(L),t=a+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Qe=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(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ft=function(){var e=h("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Ct=null;function Yt(e){if(Ct!=null)return Ct;var t=y(e,h("span","x")),n=t.getBoundingClientRect(),i=g(t,0,1).getBoundingClientRect();return Ct=Math.abs(n.left-i.left)>1}var $t={},Lt={};function di(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),$t[e]=t}function Ii(e,t){Lt[e]=t}function Ve(e){if(typeof e=="string"&&Lt.hasOwnProperty(e))e=Lt[e];else if(e&&typeof e.name=="string"&&Lt.hasOwnProperty(e.name)){var t=Lt[e.name];typeof t=="string"&&(t={name:t}),e=ot(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ve("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ve("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function St(e,t){t=Ve(t);var n=$t[t.name];if(!n)return St(e,"text/plain");var i=n(e,t);if(Rt.hasOwnProperty(t.name)){var a=Rt[t.name];for(var L in a){if(!a.hasOwnProperty(L))continue;i.hasOwnProperty(L)&&(i["_"+L]=i[L]),i[L]=a[L]}}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var H in t.modeProps)i[H]=t.modeProps[H];return i}var Rt={};function It(e,t){var n=Rt.hasOwnProperty(e)?Rt[e]:Rt[e]={};C(t,n)}function qt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var i in t){var a=t[i];a instanceof Array&&(a=a.concat([])),n[i]=a}return n}function jt(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Kt(e,t,n){return e.startState?e.startState(t,n):!0}var Tt=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Tt.prototype.eol=function(){return this.pos>=this.string.length},Tt.prototype.sol=function(){return this.pos==this.lineStart},Tt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Tt.prototype.next=function(){if(this.post},Tt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Tt.prototype.skipToEnd=function(){this.pos=this.string.length},Tt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Tt.prototype.backUp=function(e){this.pos-=e},Tt.prototype.column=function(){return this.lastColumnPos0?null:(L&&t!==!1&&(this.pos+=L[0].length),L)}},Tt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Tt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Tt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Tt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function lt(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 n=e;!n.lines;)for(var i=0;;++i){var a=n.children[i],L=a.chunkSize();if(t=e.first&&tn?We(n,lt(e,n).text.length):S(t,lt(e,t.line).text.length)}function S(e,t){var n=e.ch;return n==null||n>t?We(e.line,t):n<0?We(e.line,0):e}function N(e,t){for(var n=[],i=0;ithis.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,n){return t instanceof Z?new G(e,qt(e.mode,t.state),n,t.lookAhead):new G(e,qt(e.mode,t),n)},G.prototype.save=function(e){var t=e!==!1?qt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Z(t,this.maxLookAhead):t};function fe(e,t,n,i){var a=[e.state.modeGen],L={};xi(e,t.text,e.doc.mode,n,function(q,le){return a.push(q,le)},L,i);for(var H=n.state,X=function(q){n.baseTokens=a;var le=e.state.overlays[q],ce=1,Ee=0;n.state=!0,xi(e,t.text,le.mode,n,function(_e,Ie){for(var Be=ce;Ee<_e;){var Xe=a[ce];Xe>_e&&a.splice(ce,1,_e,a[ce+1],Xe),ce+=2,Ee=Math.min(_e,Xe)}if(!Ie)return;if(le.opaque)a.splice(Be,ce-Be,_e,"overlay "+Ie),ce=Be+2;else for(;Bee.options.maxHighlightLength&&qt(e.doc.mode,i.state),L=fe(e,t,i);a&&(i.state=a),t.stateAfter=i.save(!a),t.styles=L.styles,L.classes?t.styleClasses=L.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ze(e,t,n){var i=e.doc,a=e.display;if(!i.mode.startState)return new G(i,!0,t);var L=Ti(e,t,n),H=L>i.first&<(i,L-1).stateAfter,X=H?G.fromSaved(i,H,L):new G(i,Kt(i.mode),L);return i.iter(L,t,function(Q){gt(e,Q.text,X);var q=X.line;Q.stateAfter=q==t-1||q%5==0||q>=a.viewFrom&&qt.start)return L}throw new Error("Mode "+e.name+" failed to advance stream.")}var Ht=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Zt(e,t,n,i){var a=e.doc,L=a.mode,H;t=v(a,t);var X=lt(a,t.line),Q=Ze(e,t.line,n),q=new Tt(X.text,e.options.tabSize,Q),le;for(i&&(le=[]);(i||q.pose.options.maxHighlightLength?(X=!1,H&>(e,t,i,le.pos),le.pos=t.length,ce=null):ce=Bi(Et(n,le,i.state,Ee),L),Ee){var _e=Ee[0].name;_e&&(ce="m-"+(ce?_e+" "+ce:_e))}if(!X||q!=ce){for(;QH;--X){if(X<=L.first)return L.first;var Q=lt(L,X-1),q=Q.stateAfter;if(q&&(!n||X+(q instanceof Z?q.lookAhead:0)<=L.modeFrontier))return X;var le=$(Q.text,null,e.options.tabSize);(a==null||i>le)&&(a=X-1,i=le)}return a}function Qi(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontiern;i--){var a=lt(e,i).stateAfter;if(a&&(!(a instanceof Z)||i+a.lookAhead=t:L.to>t);(i||(i=[])).push(new un(H,L.from,Q?null:L.to))}}return i}function Vn(e,t,n){var i;if(e)for(var a=0;a=t:L.to>t);if(X||L.from==t&&H.type=="bookmark"&&(!n||L.marker.insertLeft)){var Q=L.from==null||(H.inclusiveLeft?L.from<=t:L.from0&&X)for(var pt=0;pt0)continue;var le=[Q,1],ce=At(q.from,X.from),Ee=At(q.to,X.to);(ce<0||!H.inclusiveLeft&&!ce)&&le.push({from:q.from,to:X.from}),(Ee>0||!H.inclusiveRight&&!Ee)&&le.push({from:X.to,to:q.to}),a.splice.apply(a,le),Q+=le.length-3}return a}function dr(e){var t=e.markedSpans;if(!t)return;for(var n=0;nt)&&(!i||yi(i,L.marker)<0)&&(i=L.marker)}return i}function fi(e,t,n,i,a){var L=lt(e,t),H=ci&&L.markedSpans;if(H)for(var X=0;X=0&&ce<=0||le<=0&&ce>=0)continue;if(le<=0&&(Q.marker.inclusiveRight&&a.inclusiveLeft?At(q.to,n)>=0:At(q.to,n)>0)||le>=0&&(Q.marker.inclusiveRight&&a.inclusiveLeft?At(q.from,i)<=0:At(q.from,i)<0))return!0}}function Oi(e){for(var t;t=si(e);)e=t.find(-1,!0).line;return e}function Xn(e){for(var t;t=Vt(e);)e=t.find(1,!0).line;return e}function xn(e){for(var t,n;t=Vt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function cr(e,t){var n=lt(e,t),i=Oi(n);return n==i?t:Mt(i)}function Tn(e,t){if(t>e.lastLine())return t;var n=lt(e,t),i;if(!rn(e,n))return t;for(;i=Vt(n);)n=i.find(1,!0).line;return Mt(n)+1}function rn(e,t){var n=ci&&t.markedSpans;if(n)for(var i=void 0,a=0;at.maxLineLength&&(t.maxLineLength=a,t.maxLine=i)})}var Mn=function(e,t,n){this.text=e,En(this,t),this.height=n?n(this):1};Mn.prototype.lineNo=function(){return Mt(this)},pe(Mn);function ua(e,t,n,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),dr(e),En(e,n);var a=i?i(e):1;a!=e.height&&ii(e,a)}function yt(e){e.parent=null,dr(e)}var Ot={},xt={};function kt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?xt:Ot;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Bt(e,t){var n=_("span",null,null,k?"padding-right: .1px":null),i={pre:_("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var a=0;a<=(t.rest?t.rest.length:0);a++){var L=a?t.rest[a-1]:t.line,H=void 0;i.pos=0,i.addToken=Ut,mt(e.display.measure)&&(H=nt(L,e.doc.direction))&&(i.addToken=Di(i.addToken,H)),i.map=[];var X=t!=e.display.externalMeasured&&Mt(L);hn(L,i,ke(e,L,X)),L.styleClasses&&(L.styleClasses.bgClass&&(i.bgClass=K(L.styleClasses.bgClass,i.bgClass||"")),L.styleClasses.textClass&&(i.textClass=K(L.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(ht(e.display.measure))),a==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(k){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 Se(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=K(i.pre.className,i.textClass||"")),i}function Qt(e){var t=h("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Ut(e,t,n,i,a,L,H){if(!t)return;var X=e.splitSpaces?ui(t,e.trailingSpace):t,Q=e.cm.state.specialChars,q=!1,le;if(!Q.test(t))e.col+=t.length,le=document.createTextNode(X),e.map.push(e.pos,e.pos+t.length,le),W&&j<9&&(q=!0),e.pos+=t.length;else{le=document.createDocumentFragment();for(var ce=0;;){Q.lastIndex=ce;var Ee=Q.exec(t),_e=Ee?Ee.index-ce:t.length-ce;if(_e){var Ie=document.createTextNode(X.slice(ce,ce+_e));W&&j<9?le.appendChild(h("span",[Ie])):le.appendChild(Ie),e.map.push(e.pos,e.pos+_e,Ie),e.col+=_e,e.pos+=_e}if(!Ee)break;ce+=_e+1;var Be=void 0;if(Ee[0]==" "){var Xe=e.cm.options.tabSize,at=Xe-e.col%Xe;Be=le.appendChild(h("span",se(at),"cm-tab")),Be.setAttribute("role","presentation"),Be.setAttribute("cm-text"," "),e.col+=at}else Ee[0]=="\r"||Ee[0]==` `?(Be=le.appendChild(h("span",Ee[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Be.setAttribute("cm-text",Ee[0]),e.col+=1):(Be=e.cm.options.specialCharPlaceholder(Ee[0]),Be.setAttribute("cm-text",Ee[0]),W&&j<9?le.appendChild(h("span",[Be])):le.appendChild(Be),e.col+=1);e.map.push(e.pos,e.pos+1,Be),e.pos++}}if(e.trailingSpace=X.charCodeAt(t.length-1)==32,n||i||a||q||L||H){var dt=n||"";i&&(dt+=i),a&&(dt+=a);var st=h("span",[le],dt,L);if(H)for(var pt in H)H.hasOwnProperty(pt)&&pt!="style"&&pt!="class"&&st.setAttribute(pt,H[pt]);return e.content.appendChild(st)}e.content.appendChild(le)}function ui(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,i="",a=0;aq&&ce.from<=q);Ee++);if(ce.to>=le)return e(n,i,a,L,H,X,Q);e(n,i.slice(0,ce.to-q),a,L,null,X,Q),L=null,i=i.slice(ce.to-q),q=ce.to}}}function Nt(e,t,n,i){var a=!i&&n.widgetNode;a&&e.map.push(e.pos,e.pos+t,a),!i&&e.cm.display.input.needsContentAttribute&&(a||(a=e.content.appendChild(document.createElement("span"))),a.setAttribute("cm-marker",n.id)),a&&(e.cm.display.input.setUneditable(a),e.content.appendChild(a)),e.pos+=t,e.trailingSpace=!1}function hn(e,t,n){var i=e.markedSpans,a=e.text,L=0;if(!i){for(var H=1;HQ||Dt.collapsed&&bt.to==Q&&bt.from==Q)){if(bt.to!=null&&bt.to!=Q&&_e>bt.to&&(_e=bt.to,Be=""),Dt.className&&(Ie+=" "+Dt.className),Dt.css&&(Ee=(Ee?Ee+";":"")+Dt.css),Dt.startStyle&&bt.from==Q&&(Xe+=" "+Dt.startStyle),Dt.endStyle&&bt.to==_e&&(pt||(pt=[])).push(Dt.endStyle,bt.to),Dt.title&&((dt||(dt={})).title=Dt.title),Dt.attributes)for(var Jt in Dt.attributes)(dt||(dt={}))[Jt]=Dt.attributes[Jt];Dt.collapsed&&(!at||yi(at.marker,Dt)<0)&&(at=bt)}else bt.from>Q&&_e>bt.from&&(_e=bt.from)}if(pt)for(var gi=0;gi=X)break;for(var Wi=Math.min(X,_e);;){if(le){var Ni=Q+le.length;if(!at){var oi=Ni>Wi?le.slice(0,Wi-Q):le;t.addToken(t,oi,ce?ce+Ie:Ie,Xe,Q+oi.length==_e?Be:"",Ee,dt)}if(Ni>=Wi){le=le.slice(Wi-Q),Q=Wi;break}Q=Ni,Xe=""}le=a.slice(L,L=n[q++]),ce=kt(n[q++],t.cm.options)}}}function Gt(e,t,n){this.line=t,this.rest=xn(t),this.size=this.rest?Mt(Re(this.rest))-n+1:1,this.node=this.text=null,this.hidden=rn(e,t)}function ki(e,t,n){for(var i=[],a,L=t;L2&&L.push((Q.bottom+q.top)/2-n.top)}}L.push(n.bottom-n.top)}}function es(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;in)return{map:e.measure.maps[a],cache:e.measure.caches[a],before:!0}}function Bo(e,t){t=Oi(t);var n=Mt(t),i=e.display.externalMeasured=new Gt(e.doc,t,n);i.lineN=n;var a=i.built=Bt(e,i);return i.text=a.pre,y(e.display.lineMeasure,a.pre),i}function ts(e,t,n,i){return sn(e,Yn(e,t),n,i)}function fa(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt)&&(L=Q-X,a=L-1,t>=Q&&(H="right")),a!=null){if(i=e[q+2],X==Q&&n==(i.insertLeft?"left":"right")&&(H=n),n=="left"&&a==0)for(;q&&e[q-2]==e[q-3]&&e[q-1].insertLeft;)i=e[(q-=3)+2],H="left";if(n=="right"&&a==Q-X)for(;q=0&&!((n=e[a]).left!=n.right);a--);return n}function Ho(e,t,n,i){var a=ns(t.map,n,i),L=a.node,H=a.start,X=a.end,Q=a.collapse,q;if(L.nodeType==3){for(var le=0;le<4;le++){for(;H&&Me(t.line.text.charAt(a.coverStart+H));)--H;for(;a.coverStart+X0&&(Q=i="right");var ce;e.options.lineWrapping&&(ce=L.getClientRects()).length>1?q=ce[i=="right"?ce.length-1:0]:q=L.getBoundingClientRect()}if(W&&j<9&&!H&&(!q||!q.left&&!q.right)){var Ee=L.parentNode.getClientRects()[0];Ee?q={left:Ee.left,right:Ee.left+Qn(e.display),top:Ee.top,bottom:Ee.bottom}:q=is}for(var _e=q.top-t.rect.top,Ie=q.bottom-t.rect.top,Be=(_e+Ie)/2,Xe=t.view.measure.heights,at=0;at=i.text.length?(Q=i.text.length,q="before"):Q<=0&&(Q=0,q="after"),!X)return H(q=="before"?Q-1:Q,q=="before");function le(Ie,Be,Xe){var at=X[Be],dt=at.level==1;return H(Xe?Ie-1:Ie,dt!=Xe)}var ce=$e(X,Q,q),Ee=qe,_e=le(Q,ce,q=="before");return Ee!=null&&(_e.other=le(Q,Ee,q!="before")),_e}function us(e,t){var n=0;t=v(e.doc,t),e.options.lineWrapping||(n=Qn(e.display)*t.ch);var i=lt(e.doc,t.line),a=Zi(i)+Hr(e.display);return{left:n,right:n,top:a,bottom:a+i.height}}function ga(e,t,n,i,a){var L=We(e,t,n);return L.xRel=a,i&&(L.outside=i),L}function va(e,t,n){var i=e.doc;if(n+=e.display.viewOffset,n<0)return ga(i.first,0,null,-1,-1);var a=Gi(i,n),L=i.first+i.size-1;if(a>L)return ga(i.first+i.size-1,lt(i,L).text.length,null,1,1);t<0&&(t=0);for(var H=lt(i,a);;){var X=Go(e,H,a,t,n),Q=nn(H,X.ch+(X.xRel>0||X.outside>0?1:0));if(!Q)return X;var q=Q.find(1);if(q.line==a)return q;H=lt(i,a=q.line)}}function hs(e,t,n,i){i-=pa(t);var a=t.text.length,L=ut(function(H){return sn(e,n,H-1).bottom<=i},a,0);return a=ut(function(H){return sn(e,n,H).top>i},L,a),{begin:L,end:a}}function ds(e,t,n,i){n||(n=Yn(e,t));var a=Wr(e,t,sn(e,n,i),"line").top;return hs(e,t,n,a)}function ya(e,t,n,i){return e.bottom<=n?!1:e.top>n?!0:(i?e.left:e.right)>t}function Go(e,t,n,i,a){a-=Zi(t);var L=Yn(e,t),H=pa(t),X=0,Q=t.text.length,q=!0,le=nt(t,e.doc.direction);if(le){var ce=(e.options.lineWrapping?Ko:zo)(e,t,n,L,le,i,a);q=ce.level!=1,X=q?ce.from:ce.to-1,Q=q?ce.to:ce.from-1}var Ee=null,_e=null,Ie=ut(function(wt){var bt=sn(e,L,wt);return bt.top+=H,bt.bottom+=H,ya(bt,i,a,!1)?(bt.top<=a&&bt.left<=i&&(Ee=wt,_e=bt),!0):!1},X,Q),Be,Xe,at=!1;if(_e){var dt=i-_e.left<_e.right-i,st=dt==q;Ie=Ee+(st?0:1),Xe=st?"after":"before",Be=dt?_e.left:_e.right}else{!q&&(Ie==Q||Ie==X)&&Ie++,Xe=Ie==0?"after":Ie==t.text.length?"before":sn(e,L,Ie-(q?1:0)).bottom+H<=a==q?"after":"before";var pt=qi(e,We(n,Ie,Xe),"line",t,L);Be=pt.left,at=a=pt.bottom?1:0}return Ie=Pe(t.text,Ie,1),ga(n,Ie,Xe,at,i-Be)}function zo(e,t,n,i,a,L,H){var X=ut(function(ce){var Ee=a[ce],_e=Ee.level!=1;return ya(qi(e,We(n,_e?Ee.to:Ee.from,_e?"before":"after"),"line",t,i),L,H,!0)},0,a.length-1),Q=a[X];if(X>0){var q=Q.level!=1,le=qi(e,We(n,q?Q.from:Q.to,q?"after":"before"),"line",t,i);ya(le,L,H,!0)&&le.top>H&&(Q=a[X-1])}return Q}function Ko(e,t,n,i,a,L,H){var X=hs(e,t,i,H),Q=X.begin,q=X.end;/\s/.test(t.text.charAt(q-1))&&q--;for(var le=null,ce=null,Ee=0;Ee=q||_e.to<=Q)continue;var Ie=_e.level!=1,Be=sn(e,i,Ie?Math.min(q,_e.to)-1:Math.max(Q,_e.from)).right,Xe=BeXe)&&(le=_e,ce=Xe)}return le||(le=a[a.length-1]),le.fromq&&(le={from:le.from,to:q,level:le.level}),le}var Nn;function $n(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Nn==null){Nn=h("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Nn.appendChild(document.createTextNode("x")),Nn.appendChild(h("br"));Nn.appendChild(document.createTextNode("x"))}y(e.measure,Nn);var n=Nn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),E(e.measure),n||1}function Qn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=h("span","xxxxxxxxxx"),n=h("pre",[t],"CodeMirror-line-like");y(e.measure,n);var i=t.getBoundingClientRect(),a=(i.right-i.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function _a(e){for(var t=e.display,n={},i={},a=t.gutters.clientLeft,L=t.gutters.firstChild,H=0;L;L=L.nextSibling,++H){var X=e.display.gutterSpecs[H].className;n[X]=L.offsetLeft+L.clientLeft+a,i[X]=L.clientWidth}return{fixedPos:ba(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function ba(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function cs(e){var t=$n(e.display),n=e.options.lineWrapping,i=n&&Math.max(5,e.display.scroller.clientWidth/Qn(e.display)-3);return function(a){if(rn(e.doc,a))return 0;var L=0;if(a.widgets)for(var H=0;H0&&(q=lt(e.doc,Q.line).text).length==Q.ch){var le=$(q,q.length,e.options.tabSize)-q.length;Q=We(Q.line,Math.max(0,Math.round((L-qa(e.display).left)/Qn(e.display))-le))}return Q}function Un(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,i=0;it)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo)ci&&cr(e.doc,t)a.viewFrom?Sn(e):(a.viewFrom+=i,a.viewTo+=i);else if(t<=a.viewFrom&&n>=a.viewTo)Sn(e);else if(t<=a.viewFrom){var L=Gr(e,n,n+i,1);L?(a.view=a.view.slice(L.index),a.viewFrom=L.lineN,a.viewTo+=i):Sn(e)}else if(n>=a.viewTo){var H=Gr(e,t,t,-1);H?(a.view=a.view.slice(0,H.index),a.viewTo=H.lineN):Sn(e)}else{var X=Gr(e,t,t,-1),Q=Gr(e,n,n+i,1);X&&Q?(a.view=a.view.slice(0,X.index).concat(ki(e,X.lineN,Q.lineN)).concat(a.view.slice(Q.index)),a.viewTo+=i):Sn(e)}var q=a.externalMeasured;q&&(n=a.lineN&&t=i.viewTo)return;var L=i.view[Un(e,t)];if(L.node==null)return;var H=L.changes||(L.changes=[]);re(H,n)==-1&&H.push(n)}function Sn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gr(e,t,n,i){var a=Un(e,t),L,H=e.display.view;if(!ci||n==e.doc.first+e.doc.size)return{index:a,lineN:n};for(var X=e.display.viewFrom,Q=0;Q0){if(a==H.length-1)return null;L=X+H[a].size-t,a++}else L=X-t;t+=L,n+=L}for(;cr(e.doc,n)!=n;){if(a==(i<0?0:H.length-1))return null;n+=i*H[a-(i<0?1:0)].size,a+=i}return{index:a,lineN:n}}function Vo(e,t,n){var i=e.display,a=i.view;a.length==0||t>=i.viewTo||n<=i.viewFrom?(i.view=ki(e,t,n),i.viewFrom=t):(i.viewFrom>t?i.view=ki(e,t,i.viewFrom).concat(i.view):i.viewFromn&&(i.view=i.view.slice(0,Un(e,n)))),i.viewTo=n}function fs(e){for(var t=e.display.view,n=0,i=0;i=e.display.viewTo||X.to().line0?t.blinker=setInterval(function(){e.hasFocus()||Jn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function gs(e){e.state.focused||(e.display.input.focus(),Ta(e))}function vs(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Jn(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Se(e,"focus",e,t),e.state.focused=!0,P(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),k&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),xa(e)}function Jn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Se(e,"blur",e,t),e.state.focused=!1,T(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kr(e){for(var t=e.display,n=t.lineDiv.offsetTop,i=0;i.005||le<-.005)&&(ii(a.line,H),ys(a.line),a.rest))for(var ce=0;cee.display.sizerWidth){var Ee=Math.ceil(X/Qn(e.display));Ee>e.display.maxLineLength&&(e.display.maxLineLength=Ee,e.display.maxLine=a.line,e.display.maxLineChanged=!0)}}}function ys(e){if(e.widgets)for(var t=0;t=H&&(L=Gi(t,Zi(lt(t,Q))-e.wrapper.clientHeight),H=Q)}return{from:L,to:Math.max(H,L+1)}}function Yo(e,t){if(Ne(e,"scrollCursorIntoView"))return;var n=e.display,i=n.sizer.getBoundingClientRect(),a=null;if(t.top+i.top<0?a=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(a=!1),a!=null&&!r){var L=h("div","\u200B",null,`position: absolute; top: `+(t.top-n.viewOffset-Hr(e.display))+`px; height: `+(t.bottom-t.top+an(e)+n.barHeight)+`px; left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(L),L.scrollIntoView(a),e.display.lineSpace.removeChild(L)}}function $o(e,t,n,i){i==null&&(i=0);var a;!e.options.lineWrapping&&t==n&&(t=t.ch?We(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?We(t.line,t.ch+1,"before"):t);for(var L=0;L<5;L++){var H=!1,X=qi(e,t),Q=!n||n==t?X:qi(e,n);a={left:Math.min(X.left,Q.left),top:Math.min(X.top,Q.top)-i,right:Math.max(X.left,Q.left),bottom:Math.max(X.bottom,Q.bottom)+i};var q=wa(e,a),le=e.doc.scrollTop,ce=e.doc.scrollLeft;if(q.scrollTop!=null&&(Er(e,q.scrollTop),Math.abs(e.doc.scrollTop-le)>1&&(H=!0)),q.scrollLeft!=null&&(Bn(e,q.scrollLeft),Math.abs(e.doc.scrollLeft-ce)>1&&(H=!0)),!H)break}return a}function Qo(e,t){var n=wa(e,t);n.scrollTop!=null&&Er(e,n.scrollTop),n.scrollLeft!=null&&Bn(e,n.scrollLeft)}function wa(e,t){var n=e.display,i=$n(e.display);t.top<0&&(t.top=0);var a=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,L=ca(e),H={};t.bottom-t.top>L&&(t.bottom=t.top+L);var X=e.doc.height+da(n),Q=t.topX-i;if(t.topa+L){var le=Math.min(t.top,(q?X:t.bottom)-L);le!=a&&(H.scrollTop=le)}var ce=e.options.fixedGutter?0:n.gutters.offsetWidth,Ee=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ce,_e=Pn(e)-n.gutters.offsetWidth,Ie=t.right-t.left>_e;return Ie&&(t.right=t.left+_e),t.left<10?H.scrollLeft=0:t.left_e+Ee-3&&(H.scrollLeft=t.right+(Ie?0:10)-_e),H}function Sa(e,t){if(t==null)return;Xr(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Zn(e){Xr(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function br(e,t,n){(t!=null||n!=null)&&Xr(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Jo(e,t){Xr(e),e.curOp.scrollToPos=t}function Xr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=us(e,t.from),i=us(e,t.to);_s(e,n,i,t.margin)}}function _s(e,t,n,i){var a=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-i,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+i});br(e,a.scrollLeft,a.scrollTop)}function Er(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||Aa(e,{top:t}),bs(e,t,!0),D&&Aa(e),wr(e,100)}function bs(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Bn(e,t,n,i){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?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 xr(e){var t=e.display,n=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?n:0,docHeight:i,scrollHeight:i+an(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var jn=function(e,t,n){this.cm=n;var i=this.vert=h("div",[h("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),a=this.horiz=h("div",[h("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=a.tabIndex=-1,e(i),e(a),Ae(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Ae(a,"scroll",function(){a.clientWidth&&t(a.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,W&&j<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};jn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var a=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+a)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var L=e.viewWidth-e.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+L)+"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:n?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=l&&!u?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ee,this.disableVert=new ee},jn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function i(){var a=e.getBoundingClientRect(),L=n=="vert"?document.elementFromPoint(a.right-1,(a.top+a.bottom)/2):document.elementFromPoint((a.right+a.left)/2,a.bottom-1);L!=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 Tr=function(){};Tr.prototype.update=function(){return{bottom:0,right:0}},Tr.prototype.setScrollLeft=function(){},Tr.prototype.setScrollTop=function(){},Tr.prototype.clear=function(){};function qn(e,t){t||(t=xr(e));var n=e.display.barWidth,i=e.display.barHeight;Es(e,t);for(var a=0;a<4&&n!=e.display.barWidth||i!=e.display.barHeight;a++)n!=e.display.barWidth&&e.options.lineWrapping&&Kr(e),Es(e,xr(e)),n=e.display.barWidth,i=e.display.barHeight}function Es(e,t){var n=e.display,i=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var xs={native:jn,null:Tr};function Ts(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(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),Ae(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Bn(e,t):Er(e,t)},e),e.display.scrollbars.addClass&&P(e.display.wrapper,e.display.scrollbars.addClass)}var Zo=0;function Hn(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:++Zo},Yi(e.curOp)}function Wn(e){var t=e.curOp;t&&Io(t,function(n){for(var i=0;i=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Ca(e.cm,e.update)}function il(e){var t=e.cm,n=t.display;e.updatedDisplay&&Kr(t),e.barMeasure=xr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ts(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+an(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Pn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)return;var n=+new Date+e.options.workTime,i=Ze(e,t.highlightFrontier),a=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(L){if(i.line>=e.display.viewFrom){var H=L.styles,X=L.text.length>e.options.maxHighlightLength?qt(t.mode,i.state):null,Q=fe(e,L,i,!0);X&&(i.state=X),L.styles=Q.styles;var q=L.styleClasses,le=Q.classes;le?L.styleClasses=le:q&&(L.styleClasses=null);for(var ce=!H||H.length!=L.styles.length||q!=le&&(!q||!le||q.bgClass!=le.bgClass||q.textClass!=le.textClass),Ee=0;!ce&&Een)return wr(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),a.length&&Hi(e,function(){for(var L=0;L=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&fs(e)==0)return!1;Cs(e)&&(Sn(e),t.dims=_a(e));var a=i.first+i.size,L=Math.max(t.visible.from-e.options.viewportMargin,i.first),H=Math.min(a,t.visible.to+e.options.viewportMargin);n.viewFromH&&n.viewTo-H<20&&(H=Math.min(a,n.viewTo)),ci&&(L=cr(e.doc,L),H=Tn(e.doc,H));var X=L!=n.viewFrom||H!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vo(e,L,H),n.viewOffset=Zi(lt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var Q=fs(e);if(!X&&Q==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var q=ol(e);return Q>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),Q>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(q),E(n.cursorDiv),E(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,X&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,wr(e,400)),n.updateLineNumbers=null,!0}function ws(e,t){for(var n=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Pn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+da(e.display)-ca(e),n.top)}),t.visible=Vr(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=Vr(e.display,e.doc,n));if(!Ca(e,t))break;Kr(e);var a=xr(e);_r(e),qn(e,a),Ra(e,a),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 n=new Yr(e,t);if(Ca(e,n)){Kr(e),ws(e,n);var i=xr(e);_r(e),qn(e,i),Ra(e,i),n.finish()}}function ul(e,t,n){var i=e.display,a=e.options.lineNumbers,L=i.lineDiv,H=L.firstChild;function X(Ie){var Be=Ie.nextSibling;return k&&l&&e.display.currentWheelTarget==Ie?Ie.style.display="none":Ie.parentNode.removeChild(Ie),Be}for(var Q=i.view,q=i.viewFrom,le=0;le-1&&(_e=!1),Ya(e,ce,q,n)),_e&&(E(ce.lineNumber),ce.lineNumber.appendChild(document.createTextNode(pn(e.options,q)))),H=ce.node.nextSibling}q+=ce.size}for(;H;)H=X(H)}function Oa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+an(e)+"px"}function Ss(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var i=ba(t)-t.scroller.scrollLeft+e.doc.scrollLeft,a=t.gutters.offsetWidth,L=i+"px",H=0;HH.clientWidth,Q=H.scrollHeight>H.clientHeight;if(!(i&&X||a&&Q))return;if(a&&l&&k){e:for(var q=t.target,le=L.view;q!=H;q=q.parentNode)for(var ce=0;ce=0&&At(e,i.to())<=0)return n}return-1};var zt=function(e,t){this.anchor=e,this.head=t};zt.prototype.from=function(){return yn(this.anchor,this.head)},zt.prototype.to=function(){return vn(this.anchor,this.head)},zt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function en(e,t,n){var i=e&&e.options.selectionsMayTouch,a=t[n];t.sort(function(Ee,_e){return At(Ee.from(),_e.from())}),n=re(t,a);for(var L=1;L0:Q>=0){var q=yn(X.from(),H.from()),le=vn(X.to(),H.to()),ce=X.empty()?H.from()==H.head:X.from()==X.head;L<=n&&--n,t.splice(--L,2,new zt(ce?le:q,ce?q:le))}}return new Vi(t,n)}function Cn(e,t){return new Vi([new zt(e,t||e)],0)}function An(e){return e.text?We(e.from.line+e.text.length-1,Re(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ls(e,t){if(At(e,t.from)<0)return e;if(At(e,t.to)<=0)return An(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=An(t).ch-t.to.ch),We(n,i)}function Ia(e,t){for(var n=[],i=0;i1&&e.remove(X.line+1,Ie-1),e.insert(X.line+1,at)}_i(e,"change",e,t)}function On(e,t,n){function i(a,L,H){if(a.linked)for(var X=0;X1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Re(e.done)}function Ns(e,t,n,i){var a=e.history;a.undone.length=0;var L=+new Date,H,X;if((a.lastOp==i||a.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&a.lastModTime>L-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(H=pl(a,a.lastOp==i)))X=Re(H.changes),At(t.from,t.to)==0&&At(t.from,X.to)==0?X.to=An(t):H.changes.push(Ma(e,t));else{var Q=Re(a.done);for((!Q||!Q.ranges)&&Jr(e.sel,a.done),H={changes:[Ma(e,t)],generation:a.generation},a.done.push(H);a.done.length>a.undoDepth;)a.done.shift(),a.done[0].ranges||a.done.shift()}a.done.push(n),a.generation=++a.maxGeneration,a.lastModTime=a.lastSelTime=L,a.lastOp=a.lastSelOp=i,a.lastOrigin=a.lastSelOrigin=t.origin,X||Se(e,"historyAdded")}function ml(e,t,n,i){var a=t.charAt(0);return a=="*"||a=="+"&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,i){var a=e.history,L=i&&i.origin;n==a.lastSelOp||L&&a.lastSelOrigin==L&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==L||ml(e,L,Re(a.done),t))?a.done[a.done.length-1]=t:Jr(t,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=L,a.lastSelOp=n,i&&i.clearRedo!==!1&&Ps(a.undone)}function Jr(e,t){var n=Re(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Fs(e,t,n,i){var a=t["spans_"+e.id],L=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,i),function(H){H.markedSpans&&((a||(a=t["spans_"+e.id]={}))[L]=H.markedSpans),++L})}function vl(e){if(!e)return null;for(var t,n=0;n-1&&(Re(X)[ce]=q[ce],delete q[ce]))}}return i}function Pa(e,t,n,i){if(i){var a=e.anchor;if(n){var L=At(t,a)<0;L!=At(n,a)<0?(a=t,t=n):L!=At(t,n)<0&&(t=n)}return new zt(a,t)}else return new zt(n||t,t)}function Zr(e,t,n,i,a){a==null&&(a=e.cm&&(e.cm.display.shift||e.extend)),Si(e,new Vi([Pa(e.sel.primary(),t,n,a)],0),i)}function Bs(e,t,n){for(var i=[],a=e.cm&&(e.cm.display.shift||e.extend),L=0;L=t.ch:X.to>t.ch))){if(a&&(Se(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(L.markedSpans){--H;continue}else break;if(!Q.atomic)continue;if(n){var ce=Q.find(i<0?1:-1),Ee=void 0;if((i<0?le:q)&&(ce=Ks(e,ce,-i,ce&&ce.line==t.line?L:null)),ce&&ce.line==t.line&&(Ee=At(ce,n))&&(i<0?Ee<0:Ee>0))return tr(e,ce,t,i,a)}var _e=Q.find(i<0?-1:1);return(i<0?q:le)&&(_e=Ks(e,_e,i,_e.line==t.line?L:null)),_e?tr(e,_e,t,i,a):null}}return t}function ea(e,t,n,i,a){var L=i||1,H=tr(e,t,n,L,a)||!a&&tr(e,t,n,L,!0)||tr(e,t,n,-L,a)||!a&&tr(e,t,n,-L,!0);return H||(e.cantEdit=!0,We(e.first,0))}function Ks(e,t,n,i){return n<0&&t.ch==0?t.line>e.first?v(e,We(t.line-1)):null:n>0&&t.ch==(i||lt(e,t.line)).text.length?t.line=0;--a)Ys(e,{from:i[a].from,to:i[a].to,text:a?[""]:t.text,origin:t.origin});else Ys(e,t)}function Ys(e,t){if(t.text.length==1&&t.text[0]==""&&At(t.from,t.to)==0)return;var n=Ia(e,t);Ns(e,t,n,e.cm?e.cm.curOp.id:NaN),Ar(e,t,n,Ji(e,t));var i=[];On(e,function(a,L){!L&&re(i,a.history)==-1&&(Zs(a.history,t),i.push(a.history)),Ar(a,t,null,Ji(a,t))})}function ta(e,t,n){var i=e.cm&&e.cm.state.suppressEdits;if(i&&!n)return;for(var a=e.history,L,H=e.sel,X=t=="undo"?a.done:a.undone,Q=t=="undo"?a.undone:a.done,q=0;q=0;--_e){var Ie=Ee(_e);if(Ie)return Ie.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new Vi(ze(e.sel.ranges,function(a){return new zt(We(a.anchor.line+t,a.anchor.ch),We(a.head.line+t,a.head.ch))}),e.sel.primIndex),e.cm){Mi(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,i=n.viewFrom;ie.lastLine())return;if(t.from.lineL&&(t={from:t.from,to:We(L,lt(e,L).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ai(e,t.from,t.to),n||(n=Ia(e,t)),e.cm?bl(e.cm,t,i):ka(e,t,i),qr(e,n,ye),e.cantEdit&&ea(e,We(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,n){var i=e.doc,a=e.display,L=t.from,H=t.to,X=!1,Q=L.line;e.options.lineWrapping||(Q=Mt(Oi(lt(i,L.line))),i.iter(Q,H.line+1,function(_e){if(_e==a.maxLine)return X=!0,!0})),i.sel.contains(t.from,t.to)>-1&&ve(e),ka(i,t,n,cs(e)),e.options.lineWrapping||(i.iter(Q,L.line+t.text.length,function(_e){var Ie=pr(_e);Ie>a.maxLineLength&&(a.maxLine=_e,a.maxLineLength=Ie,a.maxLineChanged=!0,X=!1)}),X&&(e.curOp.updateMaxLine=!0)),Qi(i,L.line),wr(e,400);var q=t.text.length-(H.line-L.line)-1;t.full?Mi(e):L.line==H.line&&t.text.length==1&&!Ds(e.doc,t)?wn(e,L.line,"text"):Mi(e,L.line,H.line+1,q);var le=de(e,"changes"),ce=de(e,"change");if(ce||le){var Ee={from:L,to:H,text:t.text,removed:t.removed,origin:t.origin};ce&&_i(e,"change",e,Ee),le&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ee)}e.display.selForContextMenu=null}function nr(e,t,n,i,a){var L;i||(i=n),At(i,n)<0&&(L=[i,n],n=L[0],i=L[1]),typeof t=="string"&&(t=e.splitLines(t)),ir(e,{from:n,to:i,text:t,origin:a})}function Qs(e,t,n,i){n1||!(this.children[0]instanceof Rr))){var X=[];this.collapse(X),this.children=[new Rr(X)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var H=a.lines.length%25+25,X=H;X10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var i=0;ie.display.maxLineLength&&(e.display.maxLine=q,e.display.maxLineLength=le,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&Mi(e,i,a+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Gs(e.doc)),e&&_i(e,"markerCleared",e,this,i,a),t&&Wn(e),this.parent&&this.parent.clear()},Rn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,i,a=0;a0||H==0&&L.clearWhenEmpty!==!1)return L;if(L.replacedWith&&(L.collapsed=!0,L.widgetNode=_("span",[L.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||L.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(L.widgetNode.insertLeft=!0)),L.collapsed){if(fi(e,t.line,t,n,L)||t.line!=n.line&&fi(e,n.line,t,n,L))throw new Error("Inserting collapsed marker partially overlapping an existing one");ln()}L.addToHistory&&Ns(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var X=t.line,Q=e.cm,q;if(e.iter(X,n.line+1,function(ce){Q&&L.collapsed&&!Q.options.lineWrapping&&Oi(ce)==Q.display.maxLine&&(q=!0),L.collapsed&&X!=t.line&&ii(ce,0),_n(ce,new un(L,X==t.line?t.ch:null,X==n.line?n.ch:null)),++X}),L.collapsed&&e.iter(t.line,n.line+1,function(ce){rn(e,ce)&&ii(ce,0)}),L.clearOnEnter&&Ae(L,"beforeCursorEnter",function(){return L.clear()}),L.readOnly&&(zi(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),L.collapsed&&(L.id=++eo,L.atomic=!0),Q){if(q&&(Q.curOp.updateMaxLine=!0),L.collapsed)Mi(Q,t.line,n.line+1);else if(L.className||L.startStyle||L.endStyle||L.css||L.attributes||L.title)for(var le=t.line;le<=n.line;le++)wn(Q,le,"text");L.atomic&&Gs(Q.doc),_i(Q,"markerAdded",Q,L)}return L}var Dr=function(e,t){this.markers=e,this.primary=t;for(var n=0;n=0;Q--)ir(this,i[Q]);X?Hs(this,X):this.cm&&Zn(this.cm)}),undo:mi(function(){ta(this,"undo")}),redo:mi(function(){ta(this,"redo")}),undoSelection:mi(function(){ta(this,"undo",!0)}),redoSelection:mi(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,n=0,i=0;i=e.ch)&&t.push(a.marker.parent||a.marker)}return t},findMarks:function(e,t,n){e=v(this,e),t=v(this,t);var i=[],a=e.line;return this.iter(e.line,t.line+1,function(L){var H=L.markedSpans;if(H)for(var X=0;X=Q.to||Q.from==null&&a!=e.line||Q.from!=null&&a==t.line&&Q.from>=t.ch)&&(!n||n(Q.marker))&&i.push(Q.marker.parent||Q.marker)}++a}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var i=0;ie)return t=e,!0;e-=L,++n}),v(this,We(n,t))},indexFromPos:function(e){e=v(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var le=e.dataTransfer.getData("Text");if(le){var ce;if(t.state.draggingText&&!t.state.draggingText.copy&&(ce=t.listSelections()),qr(t.doc,Cn(n,n)),ce)for(var Ee=0;Ee=0;X--)nr(e.doc,"",i[X].from,i[X].to,"+delete");Zn(e)})}function Fa(e,t,n){var i=Pe(e.text,t+n,n);return i<0||i>e.text.length?null:i}function Ua(e,t,n){var i=Fa(e,t.ch,n);return i==null?null:new We(t.line,i,n<0?"after":"before")}function Ba(e,t,n,i,a){if(e){t.doc.direction=="rtl"&&(a=-a);var L=nt(n,t.doc.direction);if(L){var H=a<0?Re(L):L[0],X=a<0==(H.level==1),Q=X?"after":"before",q;if(H.level>0||t.doc.direction=="rtl"){var le=Yn(t,n);q=a<0?n.text.length-1:0;var ce=sn(t,le,q).top;q=ut(function(Ee){return sn(t,le,Ee).top==ce},a<0==(H.level==1)?H.from:H.to-1,q),Q=="before"&&(q=Fa(n,q,1))}else q=a<0?H.to:H.from;return new We(i,q,Q)}}return new We(i,a<0?n.text.length:0,a<0?"before":"after")}function Ml(e,t,n,i){var a=nt(t,e.doc.direction);if(!a)return Ua(t,n,i);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var L=$e(a,n.ch,n.sticky),H=a[L];if(e.doc.direction=="ltr"&&H.level%2==0&&(i>0?H.to>n.ch:H.from=H.from&&Ee>=le.begin)){var _e=ce?"before":"after";return new We(n.line,Ee,_e)}}var Ie=function(at,dt,st){for(var pt=function(Jt,gi){return gi?new We(n.line,X(Jt,1),"before"):new We(n.line,Jt,"after")};at>=0&&at0==(wt.level!=1),Dt=bt?st.begin:X(st.end,-1);if(wt.from<=Dt&&Dt0?le.end:X(le.begin,-1);return Xe!=null&&!(i>0&&Xe==t.text.length)&&(Be=Ie(i>0?0:a.length-1,i,q(Xe)),Be)?Be:null}var Pr={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ye)},killLine:function(e){return sr(e,function(t){if(t.empty()){var n=lt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)a=new We(a.line,a.ch+1),e.replaceRange(L.charAt(a.ch-1)+L.charAt(a.ch-2),We(a.line,a.ch-2),a,"+transpose");else if(a.line>e.doc.first){var H=lt(e.doc,a.line-1).text;H&&(a=new We(a.line,1),e.replaceRange(L.charAt(0)+e.doc.lineSeparator()+H.charAt(H.length-1),We(a.line-1,H.length-1),a,"+transpose"))}}n.push(new zt(a,a))}e.setSelections(n)})},newlineAndIndent:function(e){return Hi(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var i=0;ie&&At(t,this.pos)==0&&n==this.button};var Fr,Ur;function Hl(e,t){var n=+new Date;return Ur&&Ur.compare(n,e,t)?(Fr=Ur=null,"triple"):Fr&&Fr.compare(n,e,t)?(Ur=new Ha(n,e,t),Fr=null,"double"):(Fr=new Ha(n,e,t),Ur=null,"single")}function vo(e){var t=this,n=t.display;if(Ne(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,dn(n,e)){k||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Wa(t,e))return;var i=Fn(t,e),a=Ce(e),L=i?Hl(i,a):"single";if(window.focus(),a==1&&t.state.selectingText&&t.state.selectingText(e),i&&Wl(t,a,i,L,e))return;a==1?i?zl(t,i,L,e):ge(e)==n.scroller&&te(e):a==2?(i&&Zr(t.doc,i),setTimeout(function(){return n.input.focus()},20)):a==3&&(O?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,n,i,a){var L="Click";return i=="double"?L="Double"+L:i=="triple"&&(L="Triple"+L),L=(t==1?"Left":t==2?"Middle":"Right")+L,Nr(e,oo(L,a),a,function(H){if(typeof H=="string"&&(H=Pr[H]),!H)return!1;var X=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),X=H(e,n)!=Te}finally{e.state.suppressEdits=!1}return X})}function Gl(e,t,n){var i=e.getOption("configureMouse"),a=i?i(e,t,n):{};if(a.unit==null){var L=p?n.shiftKey&&n.metaKey:n.altKey;a.unit=L?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(a.extend==null||e.doc.extend)&&(a.extend=e.doc.extend||n.shiftKey),a.addNew==null&&(a.addNew=l?n.metaKey:n.ctrlKey),a.moveOnDrag==null&&(a.moveOnDrag=!(l?n.altKey:n.ctrlKey)),a}function zl(e,t,n,i){W?setTimeout(B(gs,e),0):e.curOp.focus=M();var a=Gl(e,n,i),L=e.doc.sel,H;e.options.dragDrop&&De&&!e.isReadOnly()&&n=="single"&&(H=L.contains(t))>-1&&(At((H=L.ranges[H]).from(),t)<0||t.xRel>0)&&(At(H.to(),t)>0||t.xRel<0)?Kl(e,i,t,a):Vl(e,i,t,a)}function Kl(e,t,n,i){var a=e.display,L=!1,H=pi(e,function(q){k&&(a.scroller.draggable=!1),e.state.draggingText=!1,Je(a.wrapper.ownerDocument,"mouseup",H),Je(a.wrapper.ownerDocument,"mousemove",X),Je(a.scroller,"dragstart",Q),Je(a.scroller,"drop",H),L||(te(q),i.addNew||Zr(e.doc,n,null,null,i.extend),k&&!f||W&&j==9?setTimeout(function(){a.wrapper.ownerDocument.body.focus({preventScroll:!0}),a.input.focus()},20):a.input.focus())}),X=function(q){L=L||Math.abs(t.clientX-q.clientX)+Math.abs(t.clientY-q.clientY)>=10},Q=function(){return L=!0};k&&(a.scroller.draggable=!0),e.state.draggingText=H,H.copy=!i.moveOnDrag,a.scroller.dragDrop&&a.scroller.dragDrop(),Ae(a.wrapper.ownerDocument,"mouseup",H),Ae(a.wrapper.ownerDocument,"mousemove",X),Ae(a.scroller,"dragstart",Q),Ae(a.scroller,"drop",H),vs(e),setTimeout(function(){return a.input.focus()},20)}function yo(e,t,n){if(n=="char")return new zt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new zt(We(t.line,0),v(e.doc,We(t.line+1,0)));var i=n(e,t);return new zt(i.from,i.to)}function Vl(e,t,n,i){var a=e.display,L=e.doc;te(t);var H,X,Q=L.sel,q=Q.ranges;if(i.addNew&&!i.extend?(X=L.sel.contains(n),X>-1?H=q[X]:H=new zt(n,n)):(H=L.sel.primary(),X=L.sel.primIndex),i.unit=="rectangle")i.addNew||(H=new zt(n,n)),n=Fn(e,t,!0,!0),X=-1;else{var le=yo(e,n,i.unit);i.extend?H=Pa(H,le.anchor,le.head,i.extend):H=le}i.addNew?X==-1?(X=q.length,Si(L,en(e,q.concat([H]),X),{scroll:!1,origin:"*mouse"})):q.length>1&&q[X].empty()&&i.unit=="char"&&!i.extend?(Si(L,en(e,q.slice(0,X).concat(q.slice(X+1)),0),{scroll:!1,origin:"*mouse"}),Q=L.sel):Na(L,X,H,be):(X=0,Si(L,new Vi([H],0),be),Q=L.sel);var ce=n;function Ee(st){if(At(ce,st)==0)return;if(ce=st,i.unit=="rectangle"){for(var pt=[],wt=e.options.tabSize,bt=$(lt(L,n.line).text,n.ch,wt),Dt=$(lt(L,st.line).text,st.ch,wt),Jt=Math.min(bt,Dt),gi=Math.max(bt,Dt),ti=Math.min(n.line,st.line),Wi=Math.min(e.lastLine(),Math.max(n.line,st.line));ti<=Wi;ti++){var Ni=lt(L,ti).text,oi=xe(Ni,Jt,wt);Jt==gi?pt.push(new zt(We(ti,oi),We(ti,oi))):Ni.length>oi&&pt.push(new zt(We(ti,oi),We(ti,xe(Ni,gi,wt))))}pt.length||pt.push(new zt(n,n)),Si(L,en(e,Q.ranges.slice(0,X).concat(pt),X),{origin:"*mouse",scroll:!1}),e.scrollIntoView(st)}else{var Fi=H,bi=yo(e,st,i.unit),hi=Fi.anchor,li;At(bi.anchor,hi)>0?(li=bi.head,hi=yn(Fi.from(),bi.anchor)):(li=bi.anchor,hi=vn(Fi.to(),bi.head));var ni=Q.ranges.slice(0);ni[X]=Xl(e,new zt(v(L,hi),li)),Si(L,en(e,ni,X),be)}}var _e=a.wrapper.getBoundingClientRect(),Ie=0;function Be(st){var pt=++Ie,wt=Fn(e,st,!0,i.unit=="rectangle");if(!wt)return;if(At(wt,ce)!=0){e.curOp.focus=M(),Ee(wt);var bt=Vr(a,L);(wt.line>=bt.to||wt.line_e.bottom?20:0;Dt&&setTimeout(pi(e,function(){if(Ie!=pt)return;a.scroller.scrollTop+=Dt,Be(st)}),50)}}function Xe(st){e.state.selectingText=!1,Ie=Infinity,st&&(te(st),a.input.focus()),Je(a.wrapper.ownerDocument,"mousemove",at),Je(a.wrapper.ownerDocument,"mouseup",dt),L.history.lastSelOrigin=null}var at=pi(e,function(st){st.buttons===0||!Ce(st)?Xe(st):Be(st)}),dt=pi(e,Xe);e.state.selectingText=dt,Ae(a.wrapper.ownerDocument,"mousemove",at),Ae(a.wrapper.ownerDocument,"mouseup",dt)}function Xl(e,t){var n=t.anchor,i=t.head,a=lt(e.doc,n.line);if(At(n,i)==0&&n.sticky==i.sticky)return t;var L=nt(a);if(!L)return t;var H=$e(L,n.ch,n.sticky),X=L[H];if(X.from!=n.ch&&X.to!=n.ch)return t;var Q=H+(X.from==n.ch==(X.level!=1)?0:1);if(Q==0||Q==L.length)return t;var q;if(i.line!=n.line)q=(i.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var le=$e(L,i.ch,i.sticky),ce=le-H||(i.ch-n.ch)*(X.level==1?-1:1);le==Q-1||le==Q?q=ce<0:q=ce>0}var Ee=L[Q+(q?-1:0)],_e=q==(Ee.level==1),Ie=_e?Ee.from:Ee.to,Be=_e?"after":"before";return n.ch==Ie&&n.sticky==Be?t:new zt(new We(n.line,Ie,Be),i)}function _o(e,t,n,i){var a,L;if(t.touches)a=t.touches[0].clientX,L=t.touches[0].clientY;else try{a=t.clientX,L=t.clientY}catch(Ee){return!1}if(a>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&te(t);var H=e.display,X=H.lineDiv.getBoundingClientRect();if(L>X.bottom||!de(e,n))return oe(t);L-=X.top-H.viewOffset;for(var Q=0;Q=a){var le=Gi(e.doc,L),ce=e.display.gutterSpecs[Q];return Se(e,n,e,le,ce.className,t),oe(t)}}}function Wa(e,t){return _o(e,t,"gutterClick",!0)}function bo(e,t){if(dn(e.display,t)||Yl(e,t))return;if(Ne(e,t,"contextmenu"))return;O||e.display.input.onContextMenu(t)}function Yl(e,t){return de(e,"gutterContextMenu")?_o(e,t,"gutterContextMenu",!1):!1}function Eo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),yr(e)}var or={toString:function(){return"CodeMirror.Init"}},xo={},aa={};function $l(e){var t=e.optionHandlers;function n(i,a,L,H){e.defaults[i]=a,L&&(t[i]=H?function(X,Q,q){q!=or&&L(X,Q,q)}:L)}e.defineOption=n,e.Init=or,n("value","",function(i,a){return i.setValue(a)},!0),n("mode",null,function(i,a){i.doc.modeOption=a,Da(i)},!0),n("indentUnit",2,Da,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(i){Cr(i),yr(i),Mi(i)},!0),n("lineSeparator",null,function(i,a){if(i.doc.lineSep=a,!a)return;var L=[],H=i.doc.first;i.doc.iter(function(Q){for(var q=0;;){var le=Q.text.indexOf(a,q);if(le==-1)break;q=le+a.length,L.push(We(H,le))}H++});for(var X=L.length-1;X>=0;X--)nr(i.doc,a,L[X],We(L[X].line,L[X].ch+a.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(i,a,L){i.state.specialChars=new RegExp(a.source+(a.test(" ")?"":"| "),"g"),L!=or&&i.refresh()}),n("specialCharPlaceholder",Qt,function(i){return i.refresh()},!0),n("electricChars",!0),n("inputStyle",s?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(i,a){return i.getInputField().spellcheck=a},!0),n("autocorrect",!1,function(i,a){return i.getInputField().autocorrect=a},!0),n("autocapitalize",!1,function(i,a){return i.getInputField().autocapitalize=a},!0),n("rtlMoveVisually",!R),n("wholeLineUpdateBefore",!0),n("theme","default",function(i){Eo(i),Sr(i)},!0),n("keyMap","default",function(i,a,L){var H=na(a),X=L!=or&&na(L);X&&X.detach&&X.detach(i,H),H.attach&&H.attach(i,X||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(i,a){i.display.gutterSpecs=La(a,i.options.lineNumbers),Sr(i)},!0),n("fixedGutter",!0,function(i,a){i.display.gutters.style.left=a?ba(i.display)+"px":"0",i.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(i){return qn(i)},!0),n("scrollbarStyle","native",function(i){Ts(i),qn(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),n("lineNumbers",!1,function(i,a){i.display.gutterSpecs=La(i.options.gutters,a),Sr(i)},!0),n("firstLineNumber",1,Sr,!0),n("lineNumberFormatter",function(i){return i},Sr,!0),n("showCursorWhenSelecting",!1,_r,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(i,a){a=="nocursor"&&(Jn(i),i.display.input.blur()),i.display.input.readOnlyChanged(a)}),n("screenReaderLabel",null,function(i,a){a=a===""?null:a,i.display.input.screenReaderLabelChanged(a)}),n("disableInput",!1,function(i,a){a||i.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,_r,!0),n("singleCursorHeightPerLine",!0,_r,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Cr,!0),n("addModeClass",!1,Cr,!0),n("pollInterval",100),n("undoDepth",200,function(i,a){return i.doc.history.undoDepth=a}),n("historyEventDelay",1250),n("viewportMargin",10,function(i){return i.refresh()},!0),n("maxHighlightLength",1e4,Cr,!0),n("moveInputWithCursor",!0,function(i,a){a||i.display.input.resetPosition()}),n("tabindex",null,function(i,a){return i.display.input.getField().tabIndex=a||""}),n("autofocus",null),n("direction","ltr",function(i,a){return i.doc.setDirection(a)},!0),n("phrases",null)}function Ql(e,t,n){var i=n&&n!=or;if(!t!=!i){var a=e.display.dragFunctions,L=t?Ae:Je;L(e.display.scroller,"dragstart",a.start),L(e.display.scroller,"dragenter",a.enter),L(e.display.scroller,"dragover",a.over),L(e.display.scroller,"dragleave",a.leave),L(e.display.scroller,"drop",a.drop)}}function Jl(e){e.options.lineWrapping?(P(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),jr(e)),Ea(e),Mi(e),yr(e),setTimeout(function(){return qn(e)},100)}function ei(e,t){var n=this;if(!(this instanceof ei))return new ei(e,t);this.options=t=t?C(t):{},C(xo,t,!1);var i=t.value;typeof i=="string"?i=new Pi(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var a=new ei.inputStyles[t.inputStyle](this),L=this.display=new hl(e,i,a,t);L.wrapper.CodeMirror=this,Eo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ts(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ee,keySeq:null,specialChars:null},t.autofocus&&!s&&L.input.focus(),W&&j<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Rl(),Hn(this),this.curOp.forceUpdate=!0,ks(this,i),t.autofocus&&!s||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ta(n)},20):Jn(this);for(var H in aa)aa.hasOwnProperty(H)&&aa[H](this,t[H],or);Cs(this),t.finishInit&&t.finishInit(this);for(var X=0;X20*20}Ae(t.scroller,"touchstart",function(Q){if(!Ne(e,Q)&&!L(Q)&&!Wa(e,Q)){t.input.ensurePolled(),clearTimeout(n);var q=+new Date;t.activeTouch={start:q,moved:!1,prev:q-i.end<=300?i:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),Ae(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ae(t.scroller,"touchend",function(Q){var q=t.activeTouch;if(q&&!dn(t,Q)&&q.left!=null&&!q.moved&&new Date-q.start<300){var le=e.coordsChar(t.activeTouch,"page"),ce;!q.prev||H(q,q.prev)?ce=new zt(le,le):!q.prev.prev||H(q,q.prev.prev)?ce=e.findWordAt(le):ce=new zt(We(le.line,0),v(e.doc,We(le.line+1,0))),e.setSelection(ce.anchor,ce.head),e.focus(),te(Q)}a()}),Ae(t.scroller,"touchcancel",a),Ae(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Er(e,t.scroller.scrollTop),Bn(e,t.scroller.scrollLeft,!0),Se(e,"scroll",e))}),Ae(t.scroller,"mousewheel",function(Q){return Rs(e,Q)}),Ae(t.scroller,"DOMMouseScroll",function(Q){return Rs(e,Q)}),Ae(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){Ne(e,Q)||he(Q)},over:function(Q){Ne(e,Q)||(Ol(e,Q),he(Q))},start:function(Q){return Al(e,Q)},drop:pi(e,Cl),leave:function(Q){Ne(e,Q)||no(e)}};var X=t.input.getField();Ae(X,"keyup",function(Q){return mo.call(e,Q)}),Ae(X,"keydown",pi(e,po)),Ae(X,"keypress",pi(e,go)),Ae(X,"focus",function(Q){return Ta(e,Q)}),Ae(X,"blur",function(Q){return Jn(e,Q)})}var Ga=[];ei.defineInitHook=function(e){return Ga.push(e)};function Br(e,t,n,i){var a=e.doc,L;n==null&&(n="add"),n=="smart"&&(a.mode.indent?L=Ze(e,t).state:n="prev");var H=e.options.tabSize,X=lt(a,t),Q=$(X.text,null,H);X.stateAfter&&(X.stateAfter=null);var q=X.text.match(/^\s*/)[0],le;if(!i&&!/\S/.test(X.text))le=0,n="not";else if(n=="smart"&&(le=a.mode.indent(L,X.text.slice(q.length),X.text),le==Te||le>150)){if(!i)return;n="prev"}n=="prev"?t>a.first?le=$(lt(a,t-1).text,null,H):le=0:n=="add"?le=Q+e.options.indentUnit:n=="subtract"?le=Q-e.options.indentUnit:typeof n=="number"&&(le=Q+n),le=Math.max(0,le);var ce="",Ee=0;if(e.options.indentWithTabs)for(var _e=Math.floor(le/H);_e;--_e)Ee+=H,ce+=" ";if(EeH,Q=_t(t),q=null;if(X&&i.ranges.length>1)if(tn&&tn.text.join(` `)==t){if(i.ranges.length%tn.text.length==0){q=[];for(var le=0;le=0;Ee--){var _e=i.ranges[Ee],Ie=_e.from(),Be=_e.to();_e.empty()&&(n&&n>0?Ie=We(Ie.line,Ie.ch-n):e.state.overwrite&&!X?Be=We(Be.line,Math.min(lt(L,Be.line).text.length,Be.ch+Re(Q).length)):X&&tn&&tn.lineWise&&tn.text.join(` `)==Q.join(` `)&&(Ie=Be=We(Ie.line,0)));var Xe={from:Ie,to:Be,text:q?q[Ee%q.length]:Q,origin:a||(X?"paste":e.state.cutIncoming>H?"cut":"+input")};ir(e.doc,Xe),_i(e,"inputRead",e,Xe)}t&&!X&&wo(e,t),Zn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ce),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function To(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Hi(t,function(){return za(t,n,0,null,"paste")}),!0}function wo(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,i=n.ranges.length-1;i>=0;i--){var a=n.ranges[i];if(a.head.ch>100||i&&n.ranges[i-1].head.line==a.head.line)continue;var L=e.getModeAt(a.head),H=!1;if(L.electricChars){for(var X=0;X-1){H=Br(e,a.head.line,"smart");break}}else L.electricInput&&(L.electricInput.test(lt(e.doc,a.head.line).text.slice(0,a.head.ch))&&(H=Br(e,a.head.line,"smart")));H&&_i(e,"electricInput",e,a.head.line)}}function So(e){for(var t=[],n=[],i=0;iL&&(Br(this,X.head.line,i,!0),L=X.head.line,H==this.doc.sel.primIndex&&Zn(this));else{var Q=X.from(),q=X.to(),le=Math.max(L,Q.line);L=Math.min(this.lastLine(),q.line-(q.ch?0:1))+1;for(var ce=le;ce0&&Na(this.doc,H,new zt(Q,Ee[H].to()),ye)}}}),getTokenAt:function(i,a){return Zt(this,i,a)},getLineTokens:function(i,a){return Zt(this,We(i),a,!0)},getTokenTypeAt:function(i){i=v(this.doc,i);var a=ke(this,lt(this.doc,i.line)),L=0,H=(a.length-1)/2,X=i.ch,Q;if(X==0)Q=a[2];else for(;;){var q=L+H>>1;if((q?a[q*2-1]:0)>=X)H=q;else if(a[q*2+1]Q&&(i=Q,H=!0),X=lt(this.doc,i)}else X=i;return Wr(this,X,{top:0,left:0},a||"page",L||H).top+(H?this.doc.height-Zi(X):0)},defaultTextHeight:function(){return $n(this.display)},defaultCharWidth:function(){return Qn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,a,L,H,X){var Q=this.display;i=qi(this,v(this.doc,i));var q=i.bottom,le=i.left;if(a.style.position="absolute",a.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(a),Q.sizer.appendChild(a),H=="over")q=i.top;else if(H=="above"||H=="near"){var ce=Math.max(Q.wrapper.clientHeight,this.doc.height),Ee=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(H=="above"||i.bottom+a.offsetHeight>ce)&&i.top>a.offsetHeight?q=i.top-a.offsetHeight:i.bottom+a.offsetHeight<=ce&&(q=i.bottom),le+a.offsetWidth>Ee&&(le=Ee-a.offsetWidth)}a.style.top=q+"px",a.style.left=a.style.right="",X=="right"?(le=Q.sizer.clientWidth-a.offsetWidth,a.style.right="0px"):(X=="left"?le=0:X=="middle"&&(le=(Q.sizer.clientWidth-a.offsetWidth)/2),a.style.left=le+"px"),L&&Qo(this,{left:le,top:q,right:le+a.offsetWidth,bottom:q+a.offsetHeight})},triggerOnKeyDown:Ri(po),triggerOnKeyPress:Ri(go),triggerOnKeyUp:mo,triggerOnMouseDown:Ri(vo),execCommand:function(i){if(Pr.hasOwnProperty(i))return Pr[i].call(null,this)},triggerElectric:Ri(function(i){wo(this,i)}),findPosH:function(i,a,L,H){var X=1;a<0&&(X=-1,a=-a);for(var Q=v(this.doc,i),q=0;q0&&le(L.charAt(H-1));)--H;for(;X.5||this.options.lineWrapping)&&Ea(this),Se(this,"refresh",this)}),swapDoc:Ri(function(i){var a=this.doc;return a.cm=null,this.state.selectingText&&this.state.selectingText(),ks(this,i),yr(this),this.display.input.reset(),br(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,_i(this,"swapDoc",this,a),a}),phrase:function(i){var a=this.options.phrases;return a&&Object.prototype.hasOwnProperty.call(a,i)?a[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}},pe(e),e.registerHelper=function(i,a,L){n.hasOwnProperty(i)||(n[i]=e[i]={_global:[]}),n[i][a]=L},e.registerGlobalHelper=function(i,a,L,H){e.registerHelper(i,a,H),n[i]._global.push({pred:L,val:H})}}function Ka(e,t,n,i,a){var L=t,H=n,X=lt(e,t.line),Q=a&&e.direction=="rtl"?-n:n;function q(){var dt=t.line+Q;return dt=e.first+e.size?!1:(t=new We(dt,t.ch,t.sticky),X=lt(e,dt))}function le(dt){var st;if(i=="codepoint"){var pt=X.text.charCodeAt(t.ch+(i>0?0:-1));isNaN(pt)?st=null:st=new We(t.line,Math.max(0,Math.min(X.text.length,t.ch+n*(pt>=55296&&pt<56320?2:1))),-n)}else a?st=Ml(e.cm,X,t,n):st=Ua(X,t,n);if(st==null)if(!dt&&q())t=Ba(a,e.cm,X,t.line,Q);else return!1;else t=st;return!0}if(i=="char"||i=="codepoint")le();else if(i=="column")le(!0);else if(i=="word"||i=="group")for(var ce=null,Ee=i=="group",_e=e.cm&&e.cm.getHelper(t,"wordChars"),Ie=!0;!(n<0&&!le(!Ie));Ie=!1){var Be=X.text.charAt(t.ch)||` `,Xe=Ue(Be,_e)?"w":Ee&&Be==` `?"n":!Ee||/\s/.test(Be)?null:"p";if(Ee&&!Ie&&!Xe&&(Xe="s"),ce&&ce!=Xe){n<0&&(n=1,le(),t.sticky="after");break}if(Xe&&(ce=Xe),n>0&&!le(!Ie))break}var at=ea(e,t,L,H,!0);return mn(L,at)&&(at.hitSide=!0),at}function Oo(e,t,n,i){var a=e.doc,L=t.left,H;if(i=="page"){var X=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(X-.5*$n(e.display),3);H=(n>0?t.bottom:t.top)+n*Q}else i=="line"&&(H=n>0?t.bottom+3:t.top-3);for(var q;!(q=va(e,L,H),!q.outside);){if(n<0?H<=0:H>=a.height){q.hitSide=!0;break}H+=n*5}return q}var Xt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ee,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Xt.prototype.init=function(e){var t=this,n=this,i=n.cm,a=n.div=e.lineDiv;Co(a,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function L(X){for(var Q=X.target;Q;Q=Q.parentNode){if(Q==a)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}Ae(a,"paste",function(X){if(!L(X)||Ne(i,X)||To(X,i))return;j<=11&&setTimeout(pi(i,function(){return t.updateFromDOM()}),20)}),Ae(a,"compositionstart",function(X){t.composing={data:X.data,done:!1}}),Ae(a,"compositionupdate",function(X){t.composing||(t.composing={data:X.data,done:!1})}),Ae(a,"compositionend",function(X){t.composing&&(X.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ae(a,"touchstart",function(){return n.forceCompositionEnd()}),Ae(a,"input",function(){t.composing||t.readFromDOMSoon()});function H(X){if(!L(X)||Ne(i,X))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()}),X.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var Q=So(i);sa({lineWise:!0,text:Q.text}),X.type=="cut"&&i.operation(function(){i.setSelections(Q.ranges,0,ye),i.replaceSelection("",null,"cut")})}else return;if(X.clipboardData){X.clipboardData.clearData();var q=tn.text.join(` `);if(X.clipboardData.setData("Text",q),X.clipboardData.getData("Text")==q){X.preventDefault();return}}var le=Ao(),ce=le.firstChild;i.display.lineSpace.insertBefore(le,i.display.lineSpace.firstChild),ce.value=tn.text.join(` `);var Ee=document.activeElement;V(ce),setTimeout(function(){i.display.lineSpace.removeChild(le),Ee.focus(),Ee==a&&n.showPrimarySelection()},50)}Ae(a,"copy",H),Ae(a,"cut",H)},Xt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Xt.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},Xt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Xt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Xt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),a=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||a.line=t.display.viewFrom&&Ro(t,i)||{node:X[0].measure.map[2],offset:0},q=a.linee.firstLine()&&(i=We(i.line-1,lt(e.doc,i.line-1).length)),a.ch==lt(e.doc,a.line).text.length&&a.linet.viewTo-1)return!1;var L,H,X;i.line==t.viewFrom||(L=Un(e,i.line))==0?(H=Mt(t.view[0].line),X=t.view[0].node):(H=Mt(t.view[L].line),X=t.view[L-1].node.nextSibling);var Q=Un(e,a.line),q,le;if(Q==t.view.length-1?(q=t.viewTo-1,le=t.lineDiv.lastChild):(q=Mt(t.view[Q+1].line)-1,le=t.view[Q+1].node.previousSibling),!X)return!1;for(var ce=e.doc.splitLines(tu(e,X,le,H,q)),Ee=Ai(e.doc,We(H,0),We(q,lt(e.doc,q).text.length));ce.length>1&&Ee.length>1;)if(Re(ce)==Re(Ee))ce.pop(),Ee.pop(),q--;else if(ce[0]==Ee[0])ce.shift(),Ee.shift(),H++;else break;for(var _e=0,Ie=0,Be=ce[0],Xe=Ee[0],at=Math.min(Be.length,Xe.length);_ei.ch&&dt.charCodeAt(dt.length-Ie-1)==st.charCodeAt(st.length-Ie-1);)_e--,Ie++;ce[ce.length-1]=dt.slice(0,dt.length-Ie).replace(/^\u200b+/,""),ce[0]=ce[0].slice(_e).replace(/\u200b+$/,"");var wt=We(H,_e),bt=We(q,Ee.length?Re(Ee).length-Ie:0);if(ce.length>1||ce[0]||At(wt,bt))return nr(e.doc,ce,wt,bt,"+input"),!0},Xt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Xt.prototype.reset=function(){this.forceCompositionEnd()},Xt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Xt.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)},Xt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Hi(this.cm,function(){return Mi(e.cm)})},Xt.prototype.setUneditable=function(e){e.contentEditable="false"},Xt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||pi(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Xt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Xt.prototype.onContextMenu=function(){},Xt.prototype.resetPosition=function(){},Xt.prototype.needsContentAttribute=!0;function Ro(e,t){var n=fa(e,t.line);if(!n||n.hidden)return null;var i=lt(e.doc,t.line),a=es(n,i,t.line),L=nt(i,e.doc.direction),H="left";if(L){var X=$e(L,t.ch);H=X%2?"right":"left"}var Q=ns(a.map,t.ch,H);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 lr(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,i,a){var L="",H=!1,X=e.doc.lineSeparator(),Q=!1;function q(_e){return function(Ie){return Ie.id==_e}}function le(){H&&(L+=X,Q&&(L+=X),H=Q=!1)}function ce(_e){_e&&(le(),L+=_e)}function Ee(_e){if(_e.nodeType==1){var Ie=_e.getAttribute("cm-text");if(Ie){ce(Ie);return}var Be=_e.getAttribute("cm-marker"),Xe;if(Be){var at=e.findMarks(We(i,0),We(a+1,0),q(+Be));at.length&&(Xe=at[0].find(0))&&ce(Ai(e.doc,Xe.from,Xe.to).join(X));return}if(_e.getAttribute("contenteditable")=="false")return;var dt=/^(pre|div|p|li|table|br)$/i.test(_e.nodeName);if(!/^br$/i.test(_e.nodeName)&&_e.textContent.length==0)return;dt&&le();for(var st=0;st<_e.childNodes.length;st++)Ee(_e.childNodes[st]);/^(pre|p)$/i.test(_e.nodeName)&&(Q=!0),dt&&(H=!0)}else _e.nodeType==3&&ce(_e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Ee(t),t==n);)t=t.nextSibling,Q=!1;return L}function oa(e,t,n){var i;if(t==e.display.lineDiv){if(i=e.display.lineDiv.childNodes[n],!i)return lr(e.clipPos(We(e.display.viewTo-1)),!0);t=null,n=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 a=0;a=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ae(a,"paste",function(H){if(Ne(i,H)||To(H,i))return;i.state.pasteIncoming=+new Date,n.fastPoll()});function L(H){if(Ne(i,H))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var X=So(i);sa({lineWise:!0,text:X.text}),H.type=="cut"?i.setSelections(X.ranges,null,ye):(n.prevInput="",a.value=X.text.join(` `),V(a))}else return;H.type=="cut"&&(i.state.cutIncoming=+new Date)}Ae(a,"cut",L),Ae(a,"copy",L),Ae(e.scroller,"paste",function(H){if(dn(e,H)||Ne(i,H))return;if(!a.dispatchEvent){i.state.pasteIncoming=+new Date,n.focus();return}var X=new Event("paste");X.clipboardData=H.clipboardData,a.dispatchEvent(X)}),Ae(e.lineSpace,"selectstart",function(H){dn(e,H)||te(H)}),Ae(a,"compositionstart",function(){var H=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:H,range:i.markText(H,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Ae(a,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},ai.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild},ai.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},ai.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,i=ps(e);if(e.options.moveInputWithCursor){var a=qi(e,n.sel.primary().head,"div"),L=t.wrapper.getBoundingClientRect(),H=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,a.top+H.top-L.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,a.left+H.left-L.left))}return i},ai.prototype.showSelection=function(e){var t=this.cm,n=t.display;y(n.cursorDiv,e.cursors),y(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},ai.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&V(this.textarea),W&&j>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",W&&j>=9&&(this.hasSelection=null))},ai.prototype.getField=function(){return this.textarea},ai.prototype.supportsTouch=function(){return!1},ai.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!s||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},ai.prototype.blur=function(){this.textarea.blur()},ai.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ai.prototype.receivedFocus=function(){this.slowPoll()},ai.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()})},ai.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var i=t.poll();!i&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},ai.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||Qe(n)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var a=n.value;if(a==i&&!t.somethingSelected())return!1;if(W&&j>=9&&this.hasSelection===a||l&&/[\uf700-\uf7ff]/.test(a))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var L=a.charCodeAt(0);if(L==8203&&!i&&(i="\u200B"),L==8666)return this.reset(),this.cm.execCommand("undo")}for(var H=0,X=Math.min(i.length,a.length);H1e3||a.indexOf(` `)>-1?n.value=e.prevInput="":e.prevInput=a,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ai.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ai.prototype.onKeyPress=function(){W&&j>=9&&(this.hasSelection=null),this.fastPoll()},ai.prototype.onContextMenu=function(e){var t=this,n=t.cm,i=n.display,a=t.textarea;t.contextMenuPending&&t.contextMenuPending();var L=Fn(n,e),H=i.scroller.scrollTop;if(!L||c)return;var X=n.options.resetSelectionOnContextMenu;X&&n.doc.sel.contains(L)==-1&&pi(n,Si)(n.doc,Cn(L),ye);var Q=a.style.cssText,q=t.wrapper.style.cssText,le=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",a.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-le.top-5)+"px; left: "+(e.clientX-le.left-5)+`px; z-index: 1000; background: `+(W?"rgba(255, 255, 255, .05)":"transparent")+`; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ce;k&&(ce=window.scrollY),i.input.focus(),k&&window.scrollTo(null,ce),i.input.reset(),n.somethingSelected()||(a.value=t.prevInput=" "),t.contextMenuPending=_e,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll);function Ee(){if(a.selectionStart!=null){var Be=n.somethingSelected(),Xe="\u200B"+(Be?a.value:"");a.value="\u21DA",a.value=Xe,t.prevInput=Be?"":"\u200B",a.selectionStart=1,a.selectionEnd=Xe.length,i.selForContextMenu=n.doc.sel}}function _e(){if(t.contextMenuPending!=_e)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=q,a.style.cssText=Q,W&&j<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=H),a.selectionStart!=null){(!W||W&&j<9)&&Ee();var Be=0,Xe=function(){i.selForContextMenu==n.doc.sel&&a.selectionStart==0&&a.selectionEnd>0&&t.prevInput=="\u200B"?pi(n,Vs)(n):Be++<10?i.detectingSelectAll=setTimeout(Xe,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(Xe,200)}}if(W&&j>=9&&Ee(),O){he(e);var Ie=function(){Je(window,"mouseup",Ie),setTimeout(_e,20)};Ae(window,"mouseup",Ie)}else setTimeout(_e,50)},ai.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},ai.prototype.setUneditable=function(){},ai.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?C(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 n=M();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function i(){e.value=X.getValue()}var a;if(e.form&&(Ae(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var L=e.form;a=L.submit;try{var H=L.submit=function(){i(),L.submit=a,L.submit(),L.submit=H}}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&&(Je(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=a))}},e.style.display="none";var X=ei(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return X}function ru(e){e.off=Je,e.on=Ae,e.wheelEventPixels=dl,e.Doc=Pi,e.splitLines=_t,e.countColumn=$,e.findColumn=xe,e.isWordChar=Le,e.Pass=Te,e.signal=Se,e.Line=Mn,e.changeEnd=An,e.scrollbarModel=xs,e.Pos=We,e.cmpPos=At,e.modes=$t,e.mimeModes=Lt,e.resolveMode=Ve,e.getMode=St,e.modeExtensions=Rt,e.extendMode=It,e.copyState=qt,e.startState=Kt,e.innerMode=jt,e.commands=Pr,e.keyMap=cn,e.keyName=lo,e.isModifierKey=so,e.lookupKey=ar,e.normalizeKeyMap=kl,e.StringStream=Tt,e.SharedTextMarker=Dr,e.TextMarker=Rn,e.LineWidget=Ir,e.e_preventDefault=te,e.e_stopPropagation=ie,e.e_stop=he,e.addClass=P,e.contains=b,e.rmClass=T,e.keyNames=Ln}$l(ei),ql(ei);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Pi.prototype)Pi.prototype.hasOwnProperty(la)&&re(au,la)<0&&(ei.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Pi.prototype[la]));return pe(Pi),ei.inputStyles={textarea:ai,contenteditable:Xt},ei.defineMode=function(e){!ei.defaults.mode&&e!="null"&&(ei.defaults.mode=e),di.apply(this,arguments)},ei.defineMIME=Ii,ei.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ei.defineMIME("text/plain","null"),ei.defineExtension=function(e,t){ei.prototype[e]=t},ei.defineDocExtension=function(e,t){Pi.prototype[e]=t},ei.fromTextArea=nu,ru(ei),ei.version="5.58.2",ei})},Y1PL:function(vt,et,ne){"use strict";ne.r(et),ne.d(et,"ResizableTextArea",function(){return re});var ae=ne("wx14"),J=ne("1OyB"),D=ne("vuIU"),Y=ne("Ji7U"),F=ne("LK+K"),U=ne("q1tI"),W=ne("VTBJ"),j=ne("rePB"),k=ne("Zm9Q"),I=ne("Kwbf"),m=ne("c+Xe"),c=ne("m+aA"),f=ne("bdgK"),u=new Map;function r(ye){ye.forEach(function(be){var we,xe=be.target;(we=u.get(xe))===null||we===void 0||we.forEach(function(me){return me(xe)})})}var d=new f.default(r),o=null,s=null;function l(ye,be){u.has(ye)||(u.set(ye,new Set),d.observe(ye)),u.get(ye).add(be)}function p(ye,be){u.has(ye)&&(u.get(ye).delete(be),u.get(ye).size||(d.unobserve(ye),u.delete(ye)))}var R=function(ye){Object(Y.a)(we,ye);var be=Object(F.a)(we);function we(){return Object(J.a)(this,we),be.apply(this,arguments)}return Object(D.a)(we,[{key:"render",value:function(){return this.props.children}}]),we}(U.Component),w=U.createContext(null);function x(ye){var be=ye.children,we=ye.onBatchResize,xe=U.useRef(0),me=U.useRef([]),se=U.useContext(w),Re=U.useCallback(function(ze,He,rt){xe.current+=1;var ot=xe.current;me.current.push({size:ze,element:He,data:rt}),Promise.resolve().then(function(){ot===xe.current&&(we==null||we(me.current),me.current=[])}),se==null||se(ze,He,rt)},[we,se]);return U.createElement(w.Provider,{value:Re},be)}function O(ye){var be=ye.children,we=ye.disabled,xe=U.useRef(null),me=U.useRef(null),se=U.useContext(w),Re=U.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ze=U.isValidElement(be)&&Object(m.c)(be),He=ze?be.ref:null,rt=U.useMemo(function(){return Object(m.a)(He,xe)},[He,xe]),ot=U.useRef(ye);ot.current=ye;var Oe=U.useCallback(function(Le){var Ue=ot.current,Ge=Ue.onResize,je=Ue.data,Me=Le.getBoundingClientRect(),Pe=Me.width,ut=Me.height,tt=Le.offsetWidth,qe=Le.offsetHeight,$e=Math.floor(Pe),ft=Math.floor(ut);if(Re.current.width!==$e||Re.current.height!==ft||Re.current.offsetWidth!==tt||Re.current.offsetHeight!==qe){var nt={width:$e,height:ft,offsetWidth:tt,offsetHeight:qe};Re.current=nt;var Ye=tt===Math.round(Pe)?Pe:tt,Ae=qe===Math.round(ut)?ut:qe,ct=Object(W.a)(Object(W.a)({},nt),{},{offsetWidth:Ye,offsetHeight:Ae});se==null||se(ct,Le,je),Ge&&Promise.resolve().then(function(){Ge(ct,Le)})}},[]);return U.useEffect(function(){var Le=Object(c.a)(xe.current)||Object(c.a)(me.current);return Le&&!we&&l(Le,Oe),function(){return p(Le,Oe)}},[xe.current,we]),U.createElement(R,{ref:me},ze?U.cloneElement(be,{ref:rt}):be)}var A="rc-observer-key";function T(ye){var be=ye.children,we=Object(k.a)(be);return we.map(function(xe,me){var se=(xe==null?void 0:xe.key)||"".concat(A,"-").concat(me);return U.createElement(O,Object(ae.a)({},ye,{key:se}),xe)})}T.Collection=x;var E=T,y=ne("bT9E"),h=ne("TSYQ"),_=ne.n(h),g=` min-height:0 !important; max-height:none !important; height:0 !important; visibility:hidden !important; overflow:hidden !important; position:absolute !important; z-index:-1000 !important; top:0 !important; right:0 !important `,b=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],M={},P;function K(ye){var be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,we=ye.getAttribute("id")||ye.getAttribute("data-reactid")||ye.getAttribute("name");if(be&&M[we])return M[we];var xe=window.getComputedStyle(ye),me=xe.getPropertyValue("box-sizing")||xe.getPropertyValue("-moz-box-sizing")||xe.getPropertyValue("-webkit-box-sizing"),se=parseFloat(xe.getPropertyValue("padding-bottom"))+parseFloat(xe.getPropertyValue("padding-top")),Re=parseFloat(xe.getPropertyValue("border-bottom-width"))+parseFloat(xe.getPropertyValue("border-top-width")),ze=b.map(function(rt){return"".concat(rt,":").concat(xe.getPropertyValue(rt))}).join(";"),He={sizingStyle:ze,paddingSize:se,borderSize:Re,boxSizing:me};return be&&we&&(M[we]=He),He}function V(ye){var be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,we=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,xe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;P||(P=document.createElement("textarea"),P.setAttribute("tab-index","-1"),P.setAttribute("aria-hidden","true"),document.body.appendChild(P)),ye.getAttribute("wrap")?P.setAttribute("wrap",ye.getAttribute("wrap")):P.removeAttribute("wrap");var me=K(ye,be),se=me.paddingSize,Re=me.borderSize,ze=me.boxSizing,He=me.sizingStyle;P.setAttribute("style","".concat(He,";").concat(g)),P.value=ye.value||ye.placeholder||"";var rt=Number.MIN_SAFE_INTEGER,ot=Number.MAX_SAFE_INTEGER,Oe=P.scrollHeight,Le;if(ze==="border-box"?Oe+=Re:ze==="content-box"&&(Oe-=se),we!==null||xe!==null){P.value=" ";var Ue=P.scrollHeight-se;we!==null&&(rt=Ue*we,ze==="border-box"&&(rt=rt+se+Re),Oe=Math.max(rt,Oe)),xe!==null&&(ot=Ue*xe,ze==="border-box"&&(ot=ot+se+Re),Le=Oe>ot?"":"hidden",Oe=Math.min(ot,Oe))}return{height:Oe,minHeight:rt,maxHeight:ot,overflowY:Le,resize:"none"}}var B=ne("Gytx"),C=ne.n(B),$;(function(ye){ye[ye.NONE=0]="NONE",ye[ye.RESIZING=1]="RESIZING",ye[ye.RESIZED=2]="RESIZED"})($||($={}));var ee=function(ye){Object(Y.a)(we,ye);var be=Object(F.a)(we);function we(xe){var me;return Object(J.a)(this,we),me=be.call(this,xe),me.nextFrameActionId=void 0,me.resizeFrameId=void 0,me.textArea=void 0,me.saveTextArea=function(se){me.textArea=se},me.handleResize=function(se){var Re=me.state.resizeStatus,ze=me.props,He=ze.autoSize,rt=ze.onResize;if(Re!==$.NONE)return;typeof rt=="function"&&rt(se),He&&me.resizeOnNextFrame()},me.resizeOnNextFrame=function(){cancelAnimationFrame(me.nextFrameActionId),me.nextFrameActionId=requestAnimationFrame(me.resizeTextarea)},me.resizeTextarea=function(){var se=me.props.autoSize;if(!se||!me.textArea)return;var Re=se.minRows,ze=se.maxRows,He=V(me.textArea,!1,Re,ze);me.setState({textareaStyles:He,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(me.resizeFrameId),me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:$.RESIZED},function(){me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:$.NONE}),me.fixFirefoxAutoScroll()})})})})},me.renderTextArea=function(){var se=me.props,Re=se.prefixCls,ze=Re===void 0?"rc-textarea":Re,He=se.autoSize,rt=se.onResize,ot=se.className,Oe=se.disabled,Le=me.state,Ue=Le.textareaStyles,Ge=Le.resizeStatus,je=Object(y.a)(me.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Me=_()(ze,ot,Object(j.a)({},"".concat(ze,"-disabled"),Oe));"value"in je&&(je.value=je.value||"");var Pe=Object(W.a)(Object(W.a)(Object(W.a)({},me.props.style),Ue),Ge===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return U.createElement(E,{onResize:me.handleResize,disabled:!(He||rt)},U.createElement("textarea",Object(ae.a)({},je,{className:Me,style:Pe,ref:me.saveTextArea})))},me.state={textareaStyles:{},resizeStatus:$.NONE},me}return Object(D.a)(we,[{key:"componentDidUpdate",value:function(me){(me.value!==this.props.value||!C()(me.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var me=this.textArea.selectionStart,se=this.textArea.selectionEnd;this.textArea.setSelectionRange(me,se)}}catch(Re){}}},{key:"render",value:function(){return this.renderTextArea()}}]),we}(U.Component),re=ee,ue=function(ye){Object(Y.a)(we,ye);var be=Object(F.a)(we);function we(xe){var me;Object(J.a)(this,we),me=be.call(this,xe),me.resizableTextArea=void 0,me.focus=function(){me.resizableTextArea.textArea.focus()},me.saveTextArea=function(Re){me.resizableTextArea=Re},me.handleChange=function(Re){var ze=me.props.onChange;me.setValue(Re.target.value,function(){me.resizableTextArea.resizeTextarea()}),ze&&ze(Re)},me.handleKeyDown=function(Re){var ze=me.props,He=ze.onPressEnter,rt=ze.onKeyDown;Re.keyCode===13&&He&&He(Re),rt&&rt(Re)};var se=typeof xe.value=="undefined"||xe.value===null?xe.defaultValue:xe.value;return me.state={value:se},me}return Object(D.a)(we,[{key:"setValue",value:function(me,se){"value"in this.props||this.setState({value:me},se)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return U.createElement(re,Object(ae.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(me){return"value"in me?{value:me.value}:null}}]),we}(U.Component),Te=et.default=ue},ZW9T:function(vt,et,ne){"use strict";ne.d(et,"a",function(){return V});var ae=ne("k1fw"),J=ne("miYZ"),D=ne("tsqr"),Y=ne("rAM+"),F=ne("tJVT"),U=ne("PpiC"),W=ne("q1tI"),j=ne.n(W),k=ne("bdgK"),I=ne("oBTY"),m=ne("9og8"),c=ne("WmNS"),f=ne.n(c),u={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},r={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(` `)},{label:"System.out.println",content:["System.out.println($0)"].join(` `)},{label:"System.out.print",content:["System.out.print($0)"].join(` `)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},d={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(` `)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(` `)},{label:"for",content:["for( ; ; ){"," $0","}"].join(` `)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(` `)},{label:"using namespace std;",content:["using namespace std;"].join(` `)},{label:"#include ",content:["#include "].join(` `)},{label:"#include ",content:["#include "].join(` `)},{label:"#include ",content:["#include "].join(` `)},{label:"#include ",content:["#include "].join(` `)},{label:"#include ",content:["#include "].join(` `)}]},o={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(` `)}]},s=ne("5VLF"),l=ne.n(s),p={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"]}},R=function(C,$){return $.map(function(ee){return{label:ee,kind:C.languages.CompletionItemKind.Keyword,insertText:ee}})},w=function(C){return Object.keys(p.tables).map(function($){return{label:$,kind:C.languages.CompletionItemKind.Variable,insertText:$}})},x=function(C,$){var ee=p.tables[C];return ee?ee.map(function(re){return{label:re,kind:$.languages.CompletionItemKind.Field,insertText:re}}):[]};function O(B,C,$,ee,re){var ue=C.getWordUntilPosition($),Te={startLineNumber:$.lineNumber,endLineNumber:$.lineNumber,startColumn:ue.startColumn,endColumn:ue.endColumn},ye=ee.map(function(be){return{label:be,kind:B.languages.CompletionItemKind.Keyword,insertText:be,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Te}});return re.map(function(be){ye.push(Object(ae.a)(Object(ae.a)({},be),{},{range:Te}))}),ye}var A=function(B){p.languages.map(function(re){return B.languages.registerDocumentFormattingEditProvider(re,{provideDocumentFormattingEdits:function(Te,ye,be){return Object(m.a)(f.a.mark(function we(){var xe;return f.a.wrap(function(se){for(;;)switch(se.prev=se.next){case 0:return xe=l()(Te.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}),se.abrupt("return",[{range:Te.getFullModelRange(),text:xe}]);case 2:case"end":return se.stop()}},we)}))()}}),re});var C=d.quickKey.map(function(re){return{label:re.label,kind:B.languages.CompletionItemKind.Method,insertText:re.content,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),$=o.quickKey.map(function(re){return{label:re.label,kind:B.languages.CompletionItemKind.Method,insertText:re.content,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),ee=r.quickKey.map(function(re){return{label:re.label,kind:B.languages.CompletionItemKind.Method,insertText:re.content,insertTextRules:B.languages.CompletionItemInsertTextRule.InsertAsSnippet}});B.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(I.a)(d.keywords),Object(I.a)(d.quickKey.map(function(re){return re.label}))),provideCompletionItems:function(ue,Te){var ye=ue.getValueInRange({startLineNumber:Te.lineNumber,startColumn:1,endLineNumber:Te.lineNumber,endColumn:Te.column}),be=ye.match(/cu/gim);console.log("match:",be,Te,ye,ue);var we=[],xe=Te.lineNumber,me=Te.column,se=ue.getValueInRange({startLineNumber:xe,startColumn:0,endLineNumber:xe,endColumn:me}),Re=se.trim().split(/\s+/),ze=Re[Re.length-1];if(ze.endsWith(".")){var He=ze.slice(0,ze.length-1);Object.keys(p.tables).includes(He)&&(we=Object(I.a)(x(He,B)))}else ze==="."?we=[]:we=[].concat(Object(I.a)(w(B)),Object(I.a)(R(B,d.keywords)),Object(I.a)(C));return{suggestions:we}}}),B.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(I.a)(u.keywords)),provideCompletionItems:function(ue,Te){var ye=ue.getValueInRange({startLineNumber:Te.lineNumber,startColumn:1,endLineNumber:Te.lineNumber,endColumn:Te.column}),be=ye.match(/cu/gim);console.log("match:",be,Te,ye,ue);var we=[],xe=Te.lineNumber,me=Te.column,se=ue.getValueInRange({startLineNumber:xe,startColumn:0,endLineNumber:xe,endColumn:me}),Re=se.trim().split(/\s+/),ze=Re[Re.length-1];if(ze.endsWith(".")){var He=ze.slice(0,ze.length-1);Object.keys(p.tables).includes(He)&&(we=Object(I.a)(x(He,B)))}else ze==="."?we=[]:we=[].concat(Object(I.a)(w(B)),Object(I.a)(R(B,u.keywords)));return{suggestions:we}}}),B.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(I.a)(r.keywords)),provideCompletionItems:function(ue,Te){var ye=[],be=Te.lineNumber,we=Te.column,xe=ue.getValueInRange({startLineNumber:be,startColumn:0,endLineNumber:be,endColumn:we}),me=xe.trim().split(/\s+/),se=me[me.length-1];if(se.endsWith(".")){var Re=se.slice(0,se.length-1);Object.keys(p.tables).includes(Re)&&(ye=Object(I.a)(x(Re,B)))}else se==="."?ye=[]:ye=[].concat(Object(I.a)(w(B)),Object(I.a)(R(B,r.keywords)),Object(I.a)(ee));return{suggestions:ye}}}),B.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(I.a)(o.keywords)),provideCompletionItems:function(ue,Te){var ye=[],be=Te.lineNumber,we=Te.column,xe=ue.getValueInRange({startLineNumber:be,startColumn:0,endLineNumber:be,endColumn:we}),me=xe.trim().split(/\s+/),se=me[me.length-1];if(se.endsWith(".")){var Re=se.slice(0,se.length-1);Object.keys(p.tables).includes(Re)&&(ye=Object(I.a)(x(Re,B)))}else se==="."?ye=[]:ye=[].concat(Object(I.a)(w(B)),Object(I.a)(R(B,o.keywords)),Object(I.a)($));return{suggestions:ye}}})},T="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",E=ne("LvDl"),y=ne("+ua5");function h(B){return/^\d+$/.test(B)?"".concat(B,"px"):B}function _(){}var g=!1,b={"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 M(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],C=B;if(Array.isArray(B)){for(var $=0;$0||qt.target.offsetWidth>0)&&Se.current.instance.layout()}}catch(jt){Rt.e(jt)}finally{Rt.f()}}),Ve.observe(Je.current)),Ve}function ge(){D.b.warn(decodeURIComponent(T))}var Ce=function(){var St=Se.current.instance;if(ue!=null&&St&&ie){var Rt=St.getModel();Rt&&ue!==Rt.getValue()&&(g=!0,Rt.setValue(ue),St.layout(),g=!1)}};Object(W.useEffect)(function(){Ne.current&&clearTimeout(Ne.current),Ne.current=setTimeout(function(){Ce()},500)},[ue,ie,Se.current]),Object(W.useEffect)(function(){if(nt&&Se.current&&Se.current.instance){var Ve=Se.current.instance;Ve.changeViewZones(function(Rt){var It=document.createElement("div");It.style.padding="10px 20px",It.style.width="calc(100% - 20px)",It.className="my-error-line-wrp",It.innerHTML=Ae,Rt.addZone({afterLineNumber:nt||11,heightInLines:3,domNode:It})});var St={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}};Ve.addOverlayWidget(St),Ve.revealPositionInCenter({lineNumber:20,column:1})}},[nt,Se.current,ie]);function De(){var Ve=Se.current.instance;if(Ve){var St=Ve.getSelection(),Rt=Se.current.pastePos||{},It=new P.Range(Rt.startLineNumber||St.endLineNumber,Rt.startColumn||St.endColumn,Rt.endLineNumber||St.endLineNumber,Rt.endColumn||St.endColumn);setTimeout(function(){Ve.executeEdits("",[{range:It,text:""}])},300)}}function Ke(Ve){(window.navigator.platform.match("Mac")?Ve.metaKey:Ve.ctrlKey)&&Ve.keyCode==83&&(Ve.preventDefault(),ot())}var ht=function(){if(Le&&Se.current.instance){var St=Se.current.instance.getContentHeight();di(St0||Pe.target.offsetWidth>0)&&Le.layout()}}catch(ut){je.e(ut)}finally{je.f()}}),Ue.observe(xe.current)),Ue}Object(W.useEffect)(function(){xe.current&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(Le){P=Le;var Ue=P.editor.createDiffEditor(xe.current,Object(ae.a)(Object(ae.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},we),{},{wordWrap:!0}));ze(Ue);var Ge=He(Ue);return function(){Ue.dispose();var je=Ue.getModel();je&&je.dispose(),Ge.unobserve(xe.current)}})},[]),Object(W.useEffect)(function(){Re&&Re.setModel({original:P.editor.createModel(ue,ye),modified:P.editor.createModel(Te,ye)})},[ue,Te,ye,Re]);var rt=h($),ot=h(re),Oe={width:rt,height:ot};return j.a.createElement("div",{className:"my-diff-editor",ref:xe,style:Oe})}},ZpRC:function(vt,et,ne){"use strict";function ae(m){return typeof m=="object"&&m!=null&&m.nodeType===1}function J(m,c){return(!c||m!=="hidden")&&m!=="visible"&&m!=="clip"}function D(m,c){if(m.clientHeightc||d>m&&o=c&&s>=f?d-m-u:o>c&&sf?o-c+r:0}var F=function(m,c){var f=window,u=c.scrollMode,r=c.block,d=c.inline,o=c.boundary,s=c.skipOverflowHiddenElements,l=typeof o=="function"?o:function(Ue){return Ue!==o};if(!ae(m))throw new TypeError("Invalid target");for(var p=document.scrollingElement||document.documentElement,R=[],w=m;ae(w)&&l(w);){if((w=w.parentElement)===p){R.push(w);break}w!=null&&w===document.body&&D(w)&&!D(document.documentElement)||w!=null&&D(w,s)&&R.push(w)}for(var x=f.visualViewport?f.visualViewport.width:innerWidth,O=f.visualViewport?f.visualViewport.height:innerHeight,A=window.scrollX||pageXOffset,T=window.scrollY||pageYOffset,E=m.getBoundingClientRect(),y=E.height,h=E.width,_=E.top,g=E.right,b=E.bottom,M=E.left,P=r==="start"||r==="nearest"?_:r==="end"?b:_+y/2,K=d==="center"?M+h/2:d==="end"?g:M,V=[],B=0;B=0&&M>=0&&b<=O&&g<=x&&_>=ue&&b<=ye&&M>=be&&g<=Te)return V;var we=getComputedStyle(C),xe=parseInt(we.borderLeftWidth,10),me=parseInt(we.borderTopWidth,10),se=parseInt(we.borderRightWidth,10),Re=parseInt(we.borderBottomWidth,10),ze=0,He=0,rt="offsetWidth"in C?C.offsetWidth-C.clientWidth-xe-se:0,ot="offsetHeight"in C?C.offsetHeight-C.clientHeight-me-Re:0;if(p===C)ze=r==="start"?P:r==="end"?P-O:r==="nearest"?Y(T,T+O,O,me,Re,T+P,T+P+y,y):P-O/2,He=d==="start"?K:d==="center"?K-x/2:d==="end"?K-x:Y(A,A+x,x,xe,se,A+K,A+K+h,h),ze=Math.max(0,ze+T),He=Math.max(0,He+A);else{ze=r==="start"?P-ue-me:r==="end"?P-ye+Re+ot:r==="nearest"?Y(ue,ye,ee,me,Re+ot,P,P+y,y):P-(ue+ee/2)+ot/2,He=d==="start"?K-be-xe:d==="center"?K-(be+re/2)+rt/2:d==="end"?K-Te+se+rt:Y(be,Te,re,xe,se+rt,K,K+h,h);var Oe=C.scrollLeft,Le=C.scrollTop;P+=Le-(ze=Math.max(0,Math.min(Le+ze,C.scrollHeight-ee+ot))),K+=Oe-(He=Math.max(0,Math.min(Oe+He,C.scrollWidth-re+rt)))}V.push({el:C,top:ze,left:He})}return V};function U(m){return m===Object(m)&&Object.keys(m).length!==0}function W(m,c){c===void 0&&(c="auto");var f="scrollBehavior"in document.body.style;m.forEach(function(u){var r=u.el,d=u.top,o=u.left;r.scroll&&f?r.scroll({top:d,left:o,behavior:c}):(r.scrollTop=d,r.scrollLeft=o)})}function j(m){return m===!1?{block:"end",inline:"nearest"}:U(m)?m:{block:"start",inline:"nearest"}}function k(m,c){var f=!m.ownerDocument.documentElement.contains(m);if(U(c)&&typeof c.behavior=="function")return c.behavior(f?[]:F(m,c));if(f)return;var u=j(c);return W(F(m,u),u.behavior)}var I=et.a=k},bT9E:function(vt,et,ne){"use strict";ne.d(et,"a",function(){return J});var ae=ne("VTBJ");function J(D,Y){var F=Object(ae.a)({},D);return Array.isArray(Y)&&Y.forEach(function(U){delete F[U]}),F}},c5Ni:function(vt,et,ne){},dejd:function(vt,et,ne){},dmUQ:function(vt,et,ne){"use strict";var ae=ne("Ff2n"),J=ne("rePB"),D=ne("1OyB"),Y=ne("vuIU"),F=ne("Ji7U"),U=ne("md7G"),W=ne("foSv"),j=ne("q1tI"),k=ne.n(j),I=ne("TSYQ"),m=ne.n(I),c=ne("4IlW");function f(y,h){var _=Object.keys(y);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(y);h&&(g=g.filter(function(b){return Object.getOwnPropertyDescriptor(y,b).enumerable})),_.push.apply(_,g)}return _}function u(y){for(var h=1;h1?re-1:0),Te=1;Te1?B-1:0),$=1;$=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var B=0;return V.indexOf(".")>=0&&(B=V.length-V.indexOf(".")-1),B},b.getInputDisplayValue=function(K){var V=K||b.state,B=V.focused,C=V.inputValue,$=V.value,ee;B?ee=C:ee=b.toPrecisionAsStep($),ee==null&&(ee="");var re=b.formatWrapper(ee);return x(b.props.decimalSeparator)&&(re=re.toString().replace(".",b.props.decimalSeparator)),re},b.recordCursorPosition=function(){try{b.cursorStart=b.input.selectionStart,b.cursorEnd=b.input.selectionEnd,b.currentValue=b.input.value,b.cursorBefore=b.input.value.substring(0,b.cursorStart),b.cursorAfter=b.input.value.substring(b.cursorEnd)}catch(K){}},b.restoreByAfter=function(K){if(K===void 0)return!1;var V=b.input.value,B=V.lastIndexOf(K);if(B===-1)return!1;var C=b.cursorBefore.length;return b.lastKeyCode===c.a.DELETE&&b.cursorBefore.charAt(C-1)===K[0]?(b.fixCaret(C,C),!0):B+K.length===V.length?(b.fixCaret(B,B),!0):!1},b.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function(V,B){var C=K.substring(B);return b.restoreByAfter(C)})},b.isNotCompleteNumber=function(K){return isNaN(K)||K===""||K===null||K&&K.toString().indexOf(".")===K.toString().length-1},b.stop=function(){b.autoStepTimer&&clearTimeout(b.autoStepTimer)},b.down=function(K,V,B){b.pressingUpOrDown=!0,b.step("down",K,V,B)},b.up=function(K,V,B){b.pressingUpOrDown=!0,b.step("up",K,V,B)},b.saveInput=function(K){b.input=K};var M=g.value;M===void 0&&(M=g.defaultValue),b.state={focused:g.autoFocus};var P=b.getValidValue(b.toNumber(M));return b.state=u(u({},b.state),{},{inputValue:b.toPrecisionAsStep(P),value:P}),b}return Object(Y.a)(_,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(b){var M=this.props,P=M.value,K=M.onChange,V=M.max,B=M.min,C=this.state.focused;if(b){if(!O(b.value,P)||!O(b.max,V)||!O(b.min,B)){var $=C?P:this.getValidValue(P),ee;this.pressingUpOrDown?ee=$:this.inputting?ee=this.rawInput:ee=this.toPrecisionAsStep($),this.setState({value:$,inputValue:ee})}var re="value"in this.props?P:this.state.value;"max"in this.props&&b.max!==V&&typeof re=="number"&&re>V&&K&&K(V),"min"in this.props&&b.min!==B&&typeof re=="number"&&re1&&arguments[1]!==void 0?arguments[1]:this.props.min,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,K=parseFloat(b);return isNaN(K)?b:(KP&&(K=P),K)}},{key:"setValue",value:function(b,M){var P=this.props.precision,K=this.isNotCompleteNumber(parseFloat(b))?null:parseFloat(b),V=this.state.value,B=V===void 0?null:V,C=this.state.inputValue,$=C===void 0?null:C,ee=typeof K=="number"?K.toFixed(P):"".concat(K),re=K!==B||ee!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},M)):this.setState({value:K,inputValue:this.toPrecisionAsStep(b)},M),re&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,P=this.props,K=P.precision,V=P.step;if(x(K))return K;var B=this.getPrecision(M),C=this.getPrecision(V),$=this.getPrecision(b);return b?Math.max($,B+C):B+C}},{key:"getPrecisionFactor",value:function(b){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,P=this.getMaxPrecision(b,M);return Math.pow(10,P)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(b){return this.props.formatter?this.props.formatter(b):b}},{key:"toPrecisionAsStep",value:function(b){if(this.isNotCompleteNumber(b)||b==="")return b;var M=Math.abs(this.getMaxPrecision(b));return isNaN(M)?b.toString():Number(b).toFixed(M)}},{key:"toNumber",value:function(b){var M=this.props.precision,P=this.state.focused,K=b&&b.length>16&&P;return this.isNotCompleteNumber(b)||K?b:x(M)?Math.round(b*Math.pow(10,M))/Math.pow(10,M):Number(b)}},{key:"upStep",value:function(b,M){var P=this.props.step,K=this.getPrecisionFactor(b,M),V=Math.abs(this.getMaxPrecision(b,M)),B=((K*b+K*P*M)/K).toFixed(V);return this.toNumber(B)}},{key:"downStep",value:function(b,M){var P=this.props.step,K=this.getPrecisionFactor(b,M),V=Math.abs(this.getMaxPrecision(b,M)),B=((K*b-K*P*M)/K).toFixed(V);return this.toNumber(B)}},{key:"step",value:function(b,M){var P=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var B=this.props;if(B.disabled)return;var C=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(C))return;var $=this["".concat(b,"Step")](C,K),ee=$>B.max||$B.max?$=B.max:$=ue),Ne=(ft||ft===0)&&(isNaN(ft)||Number(ft)<=Te),ve=Se||K||V,de=Ne||K||V,pe=m()("".concat(P,"-handler"),"".concat(P,"-handler-up"),Object(J.a)({},"".concat(P,"-handler-up-disabled"),ve)),te=m()("".concat(P,"-handler"),"".concat(P,"-handler-down"),Object(J.a)({},"".concat(P,"-handler-down-disabled"),de)),ie=B?{onTouchStart:ve?o:this.up,onTouchEnd:this.stop}:{onMouseDown:ve?o:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},oe=B?{onTouchStart:de?o:this.down,onTouchEnd:this.stop}:{onMouseDown:de?o:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return k.a.createElement("div",{className:Ye,style:ye,title:be,onMouseEnter:we,onMouseLeave:xe,onMouseOver:me,onMouseOut:se,onFocus:function(){return null},onBlur:function(){return null}},k.a.createElement("div",{className:"".concat(P,"-handler-wrap")},k.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Increase Value","aria-disabled":ve,className:pe}),$||k.a.createElement("span",{unselectable:"on",className:"".concat(P,"-handler-up-inner"),onClick:s})),k.a.createElement("span",Object.assign({unselectable:"on"},oe,{role:"button","aria-label":"Decrease Value","aria-disabled":de,className:te}),ee||k.a.createElement("span",{unselectable:"on",className:"".concat(P,"-handler-down-inner"),onClick:s}))),k.a.createElement("div",{className:"".concat(P,"-input-wrap")},k.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":ue,"aria-valuenow":ft,required:Re,type:rt,placeholder:ot,onPaste:ut,onClick:ze,onMouseUp:this.onMouseUp,className:"".concat(P,"-input"),tabIndex:He,autoComplete:C,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:ct?this.onKeyDown:o,onKeyUp:ct?this.onKeyUp:o,autoFocus:Me,maxLength:je,readOnly:V,disabled:K,max:ue,min:Te,step:Ge,name:Pe,title:be,id:Oe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Je),pattern:Ue,inputMode:Le,onInput:tt},Ae))))}}]),_}(k.a.Component);A.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:w,min:-w,step:1,style:{},onChange:o,onKeyDown:o,onPressEnter:o,onFocus:o,onBlur:o,parser:l,required:!1,autoComplete:"off"};var T=A,E=et.a=T},fB9n:function(vt,et,ne){"use strict";ne.r(et);var ae=ne("14J3"),J=ne("BMrR"),D=ne("jCWc"),Y=ne("kPKH"),F=ne("k1fw"),U=ne("9og8"),W=ne("tJVT"),j=ne("PpiC"),k=ne("WmNS"),I=ne.n(k),m=ne("q1tI"),c=ne.n(m),f=ne("55Ip"),u=ne("9kvl"),r=ne("T2oS"),d=ne("W9HT"),o=ne("oBTY"),s=ne("B9cy"),l=ne("Ol7k"),p=ne("lUTK"),R=ne("BvKs"),w=ne("Ty5D"),x=ne("wd/R"),O=ne.n(x),A=ne("RotF"),T=ne.n(A),E=ne("m3rI"),y=ne("9Bee"),h=ne("SbmS"),_=ne.n(h),g=R.a.SubMenu,b=l.a.Sider,M=l.a.Content,P=function(Le){var Ue=Le.messages,Ge=Le.globalSetting,je=Le.loading,Me=Le.user,Pe=Le.dispatch,ut=Object(j.a)(Le,["messages","globalSetting","loading","user","dispatch"]),tt=Object(w.i)(),qe=Object(w.h)(),$e=Me.userInfo,ft=Object(m.useState)(!1),nt=Object(W.a)(ft,2),Ye=nt[0],Ae=nt[1],ct=Object(m.useState)({per_page:20,page:1}),Je=Object(W.a)(ct,2),Se=Je[0],Ne=Je[1],ve=Object(m.useState)({per_page:20,page:1}),de=Object(W.a)(ve,2),pe=de[0],te=de[1],ie=Object(m.useState)([]),oe=Object(W.a)(ie,2),he=oe[0],ge=oe[1];Object(m.useEffect)(function(){Se.page=1,De()},[tt.userId]);var Ce=function(ht){var it,mt;u.d.push("/messages/".concat(Me==null||((it=Me.userInfo)===null||it===void 0)?void 0:it.login,"/message_detail?target_ids=").concat(ht==null||((mt=ht.target)===null||mt===void 0)?void 0:mt.id))},De=function(){var Ke=Object(U.a)(I.a.mark(function ht(){var it,mt;return I.a.wrap(function(Qe){for(;;)switch(Qe.prev=Qe.next){case 0:return Ae(!1),Qe.next=3,Pe({type:"messages/getPrivateMessages",payload:Object(F.a)(Object(F.a)({},tt),pe)});case 3:it=Qe.sent,it!=null&&it.private_messages&&(ge([].concat(Object(o.a)(he),Object(o.a)(it.private_messages))),((mt=it.private_messages)===null||mt===void 0?void 0:mt.length)===20&&Ae(!0));case 5:case"end":return Qe.stop()}},ht)}));return function(){return Ke.apply(this,arguments)}}();return c.a.createElement("aside",{className:_.a.listRightMessage},c.a.createElement(T.a,{loadMore:function(){pe.page++,De()},hasMore:Ye,useWindow:!1},c.a.createElement(d.a,{spinning:je["messages/getPrivateMessages"]},c.a.createElement("div",{className:"minH500"},he==null?void 0:he.map(function(Ke,ht){var it,mt;return c.a.createElement("aside",{key:ht},c.a.createElement(J.a,{onClick:function(){return Ce(Ke)}},c.a.createElement(Y.a,{flex:"58px"},c.a.createElement("img",{src:E.a.IMG_SERVER+"/images/"+(Ke==null||((it=Ke.target)===null||it===void 0)?void 0:it.image_url),alt:""})),c.a.createElement(Y.a,{flex:"1"},c.a.createElement(J.a,null,c.a.createElement(Y.a,{span:24},c.a.createElement(J.a,null,c.a.createElement(Y.a,{flex:"1"},c.a.createElement("span",{className:_.a.userName},Ke==null||((mt=Ke.target)===null||mt===void 0)?void 0:mt.name)),c.a.createElement(Y.a,null,c.a.createElement("span",{className:"ml15 c-grey-c"},O()(Ke.send_time).fromNow())))),c.a.createElement(Y.a,{span:24},c.a.createElement("div",{className:["mt15",_.a.content].join(" ")},c.a.createElement(y.a,{value:Ke.content||""})))))))})))))},K=Object(u.a)(function(Oe){var Le=Oe.messages,Ue=Oe.loading,Ge=Oe.user,je=Oe.globalSetting;return{messages:Le,globalSetting:je,user:Ge,loading:Ue.effects}})(P),V=ne("+L6B"),B=ne("2/Rp"),C=ne("miYZ"),$=ne("tsqr"),ee=ne("y8nQ"),re=ne("Vl3Y"),ue=ne("kaH+"),Te=ne("1vsH"),ye=ne("5WQS"),be=ne("Ot1p"),we=ne("dhSg"),xe=R.a.SubMenu,me=l.a.Sider,se=l.a.Content,Re=function(Le){var Ue=Le.messages,Ge=Le.globalSetting,je=Le.loading,Me=Le.user,Pe=Le.dispatch,ut=Object(j.a)(Le,["messages","globalSetting","loading","user","dispatch"]),tt=Object(w.i)(),qe=Object(w.h)(),$e=qe.query,ft=Object(m.useState)({per_page:20,page:1}),nt=Object(W.a)(ft,2),Ye=nt[0],Ae=nt[1],ct=Object(m.useState)([]),Je=Object(W.a)(ct,2),Se=Je[0],Ne=Je[1],ve=Object(m.useState)(!1),de=Object(W.a)(ve,2),pe=de[0],te=de[1],ie=Object(m.useState)(!1),oe=Object(W.a)(ie,2),he=oe[0],ge=oe[1],Ce=Object(m.useState)(""),De=Object(W.a)(Ce,2),Ke=De[0],ht=De[1],it=Object(m.useRef)(),mt=re.a.useForm(),_t=Object(W.a)(mt,1),Qe=_t[0],Ft=Object(m.useState)([]),Ct=Object(W.a)(Ft,2),Yt=Ct[0],$t=Ct[1],Lt=Object(m.useState)(!0),di=Object(W.a)(Lt,2),Ii=di[0],Ve=di[1];Object(m.useEffect)(function(){Ye.page=1,St()},[$e.target_ids]);var St=function(){var jt=Object(U.a)(I.a.mark(function Kt(){var Tt,lt;return I.a.wrap(function(Ei){for(;;)switch(Ei.prev=Ei.next){case 0:return te(!1),Ei.next=3,Pe({type:"messages/getPrivateMessageDetails",payload:Object(F.a)(Object(F.a)({},tt),{},{target_id:$e==null?void 0:$e.target_ids},Ye)});case 3:Tt=Ei.sent,Tt!=null&&Tt.messages&&(Yt=Tt==null?void 0:Tt.messages,((lt=Yt)===null||lt===void 0?void 0:lt.length)===20&&setTimeout(function(){te(!0),Ve(!1)},500),Ye.page===1?Ne(Object(o.a)(Tt==null?void 0:Tt.messages.reverse())):Ne([].concat(Object(o.a)(Se),Object(o.a)(Tt==null?void 0:Tt.messages.reverse()))));case 5:case"end":return Ei.stop()}},Kt)}));return function(){return jt.apply(this,arguments)}}();Object(m.useEffect)(function(){console.log("newData.length:",Ye,Yt.length,Yt),Ye.page===1&&Ii&&(it.current.scrollTop=it.current.scrollHeight)},[Se]),Object(m.useEffect)(function(){it.current.onclick=function(jt){jt.target.nodeName==="IMG"&&jt.target.alt!==""&&we.a.publish("preview-image",jt.target.src)}},[]);var Rt=function(){var jt=Object(U.a)(I.a.mark(function Kt(Tt,lt){var Ai;return I.a.wrap(function(ii){for(;;)switch(ii.prev=ii.next){case 0:return ii.next=2,Object(ye.a)(Object(F.a)(Object(F.a)({},tt),{},{id:Tt.id}));case 2:Ai=ii.sent,Ai.status===0&&(Se.splice(lt,1),Ne(Object(o.a)(Se)));case 4:case"end":return ii.stop()}},Kt)}));return function(Tt,lt){return jt.apply(this,arguments)}}(),It=function(){var jt=Object(U.a)(I.a.mark(function Kt(){return I.a.wrap(function(lt){for(;;)switch(lt.prev=lt.next){case 0:if(!(Ke==="")){lt.next=3;break}return $.b.error("\u8BF7\u8F93\u5165\u60A8\u7684\u56DE\u590D"),lt.abrupt("return",!1);case 3:return ht(""),ge(!0),lt.next=7,Object(ye.g)(Object(F.a)(Object(F.a)({},tt),{},{content:Ke,target_id:$e==null?void 0:$e.target_ids}));case 7:ge(!1),Ye.page=1,Qe.resetFields(),St();case 11:case"end":return lt.stop()}},Kt)}));return function(){return jt.apply(this,arguments)}}(),qt=Object(m.useMemo)(function(){var jt=Me||{},Kt=jt.userInfo;return(Kt==null?void 0:Kt.is_teacher)&&(Kt==null?void 0:Kt.professional_certification)},[Me]);return c.a.createElement("section",null,c.a.createElement("aside",{className:_.a.listMessage,ref:it},c.a.createElement(T.a,{isReverse:!0,loadMore:function(){Ye.page++,St()},hasMore:pe,useWindow:!1},!pe&&c.a.createElement("div",{className:"tc mt20 animated fadeIn"},c.a.createElement("span",{className:_.a.msgDate},"\u6CA1\u6709\u4FE1\u606F\u4E86\uFF5E\uFF5E")),c.a.createElement(d.a,{spinning:je["messages/getPrivateMessageDetails"]},c.a.createElement("aside",{className:"minH500"},Se==null?void 0:Se.map(function(jt,Kt){var Tt;return c.a.createElement("aside",{key:Kt},c.a.createElement(J.a,{justify:"center"},c.a.createElement(Y.a,{flex:"1",className:"tc"},c.a.createElement("span",{className:_.a.msgDate},O()(jt.send_time).format("YYYY-MM-DD")))),c.a.createElement(J.a,{onClick:function(){return Object(Te.J)(jt)}},c.a.createElement(Y.a,{flex:"58px"},c.a.createElement("img",{src:E.a.IMG_SERVER+"/images/"+(jt==null||((Tt=jt.sender)===null||Tt===void 0)?void 0:Tt.image_url),alt:""})),c.a.createElement(Y.a,null,c.a.createElement("div",{className:_.a.msg},c.a.createElement(y.a,{value:jt.content||""}),c.a.createElement("span",{onClick:function(){return Rt(jt,Kt)},className:["current",_.a.deleteMsg].join(" ")},"\u5220\u9664"))),c.a.createElement(Y.a,null,c.a.createElement("span",{className:"c-grey-c ml10"},O()(jt.send_time).format("HH:mm")))))}))))),c.a.createElement("aside",{className:"pl30 pr30 mb30 mt30"},qt?c.a.createElement(re.a,{form:Qe},c.a.createElement(re.a.Item,{name:"content"},c.a.createElement(be.a,{placeholder:"\u8BF7\u8F93\u5165\u4F60\u7684\u56DE\u590D",height:150,onChange:function(Kt){return ht(Kt)}})),c.a.createElement(J.a,null,c.a.createElement(Y.a,{flex:"1"},c.a.createElement("span",{className:"c-red font14"},"\u5728\u95EE\u9898\u53CD\u9988\u65F6\uFF0C\u8BF7\u540C\u65F6\u53D1\u9001\u95EE\u9898\u53D1\u751F\u9875\u7684\u7F51\u5740\u94FE\u63A5\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u9AD8\u6548\u7684\u4E3A\u60A8\u670D\u52A1")),c.a.createElement(Y.a,null,c.a.createElement(B.a,{loading:he,type:"primary",onClick:function(){return It()}},"\u56DE\u590D")))):c.a.createElement("p",{className:"c-red font14",style:{textAlign:"center"}},"\u4EC5\u804C\u4E1A\u8BA4\u8BC1\u7684\u6559\u5E08\u53EF\u4EE5\u4F7F\u7528\u79C1\u4FE1\u529F\u80FD")),c.a.createElement(ue.a,null))},ze=Object(u.a)(function(Oe){var Le=Oe.messages,Ue=Oe.loading,Ge=Oe.user,je=Oe.globalSetting;return{messages:Le,globalSetting:je,user:Ge,loading:Ue.effects}})(Re),He=ne("30zm"),rt=function(Le){var Ue,Ge=Le.messages,je=Le.globalSetting,Me=Le.loading,Pe=Le.user,ut=Le.dispatch,tt=Object(j.a)(Le,["messages","globalSetting","loading","user","dispatch"]),qe=tt.match.params,$e=tt.location.query,ft=Pe.userInfo,nt=Ge.tidingsList,Ye=Ge.privateMessageDetails,Ae=Object(m.useState)({per_page:20,page:1}),ct=Object(W.a)(Ae,2),Je=ct[0],Se=ct[1],Ne=Object(m.useState)({per_page:20,page:1}),ve=Object(W.a)(Ne,2),de=ve[0],pe=ve[1],te=Object(m.useState)([]),ie=Object(W.a)(te,2),oe=ie[0],he=ie[1],ge=Object(m.useState)([]),Ce=Object(W.a)(ge,2),De=Ce[0],Ke=Ce[1];Object(m.useEffect)(function(){Je.page=1},[qe.userId]);var ht=function(){var mt=Object(U.a)(I.a.mark(function _t(){var Qe;return I.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:return Ct.next=2,ut({type:"messages/getPrivateMessageDetails",payload:Object(F.a)(Object(F.a)({},qe),{},{target_id:$e==null?void 0:$e.target_ids})});case 2:Qe=Ct.sent,Qe!=null&&Qe.messages&&he(Qe.messages);case 4:case"end":return Ct.stop()}},_t)}));return function(){return mt.apply(this,arguments)}}(),it=function(){var mt=Object(U.a)(I.a.mark(function _t(){var Qe;return I.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:return Ct.next=2,ut({type:"messages/getPrivateMessages",payload:Object(F.a)(Object(F.a)({},qe),de)});case 2:Qe=Ct.sent,Qe!=null&&Qe.private_messages&&Ke(Qe.private_messages);case 4:case"end":return Ct.stop()}},_t)}));return function(){return mt.apply(this,arguments)}}();return c.a.createElement("section",{className:_.a.bg},c.a.createElement("section",{className:"edu-container mt20"},c.a.createElement(J.a,{gutter:[20,20]},c.a.createElement(He.a,null),c.a.createElement(Y.a,{flex:"1"},c.a.createElement("aside",{className:"bg-white"},c.a.createElement("aside",{className:["font16",_.a.topBar].join(" ")},c.a.createElement(J.a,null,c.a.createElement(Y.a,{flex:"30px",className:"tc"},c.a.createElement(f.a,{to:"/messages/".concat(qe.userId,"/private_messages"),className:"iconfont icon-zuojiantou c-black pl10"})),c.a.createElement(Y.a,{flex:"1",className:"tc"},Ye==null||((Ue=Ye.target)===null||Ue===void 0)?void 0:Ue.name,"\u4E0E\u4F60\u7684\u79C1\u4FE1"),c.a.createElement(Y.a,{flex:"290px",className:"tl"},c.a.createElement("span",{className:"pl30"},"\u79C1\u4FE1\u5217\u8868")))),c.a.createElement(J.a,null,c.a.createElement(Y.a,{flex:"1"},c.a.createElement(ze,null)),c.a.createElement(Y.a,{flex:"290px"},c.a.createElement(K,null))))))))},ot=et.default=Object(u.a)(function(Oe){var Le=Oe.messages,Ue=Oe.loading,Ge=Oe.user,je=Oe.globalSetting;return{messages:Le,globalSetting:je,user:Ge,loading:Ue.effects}})(rt)},kSUc:function(vt,et,ne){},"kaH+":function(vt,et,ne){"use strict";var ae=ne("+L6B"),J=ne("2/Rp"),D=ne("tJVT"),Y=ne("q1tI"),F=ne.n(Y),U=ne("UZu5"),W=ne.n(U),j=ne("dhSg"),k=ne("rLCj"),I=ne("dF/Y"),m=ne("4i/N");et.a=function(){var c=Object(Y.useState)(""),f=Object(D.a)(c,2),u=f[0],r=f[1],d=Object(Y.useState)(0),o=Object(D.a)(d,2),s=o[0],l=o[1],p=Object(Y.useRef)("");Object(Y.useEffect)(function(){var E=j.a.subscribe("preview-image",function(y){r(y),document.body.style.overflow="hidden"});return E},[]),Object(Y.useEffect)(function(){return document.addEventListener("keydown",R),function(){document.removeEventListener("keydown",R)}},[]),Object(Y.useEffect)(function(){p.current=u},[u]);function R(E){E.keyCode==27&&p.current&&w()}function w(){document.body.style.overflow="auto",r("")}function x(){l(s+90)}var O=Object(Y.useRef)(),A=Object(Y.useRef)(),T=function(y){(y.nativeEvent.target===O.current||y.nativeEvent.target===A.current)&&w()};return F.a.createElement(Y.Fragment,null,u?F.a.createElement("div",{className:"image-preview-container",ref:O,onClick:T},F.a.createElement("div",{className:"button-group"},F.a.createElement(J.a,{onClick:x},"\u65CB\u8F6C",F.a.createElement(k.a,null)),F.a.createElement(J.a,{href:u},"\u4E0B\u8F7D",F.a.createElement(I.a,null)),F.a.createElement(J.a,{onClick:w},"\u5173\u95ED",F.a.createElement(m.a,null))),F.a.createElement("div",{className:"preview-wrp-group",ref:A},F.a.createElement("img",{className:"image-preview",src:u,alt:"\u9884\u89C8\u5927\u56FE",style:{transform:"rotate(".concat(s,"deg)")}}))):null)}},kzJb:function(vt,et,ne){vt.exports={flex_box_center:"flex_box_center___2qtoc",flex_space_between:"flex_space_between___NF1Yf",flex_box_vertical_center:"flex_box_vertical_center___2qH_j",flex_box_center_end:"flex_box_center_end___22P0N",flex_box_column:"flex_box_column___1IKP8",userInfo:"userInfo___2Dupy",navInfo:"navInfo___3fEvD",actived:"actived___3F322",newTip:"newTip___1Ta-b"}},lZu9:function(vt,et,ne){(function(ae){ae(ne("VrN/"),ne("1eCo"),ne("8EBN"))})(function(ae){"use strict";ae.defineMode("markdown",function(J,D){var Y=ae.getMode(J,"text/html"),F=Y.name=="null";function U(B){if(ae.findModeByName){var C=ae.findModeByName(B);C&&(B=C.mime||C.mimes[0])}var $=ae.getMode(J,B);return $.name=="null"?null:$}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var W={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 j in W)W.hasOwnProperty(j)&&D.tokenTypeOverrides[j]&&(W[j]=D.tokenTypeOverrides[j]);var k=/^([*\-_])(?:\s*\1){2,}\s*$/,I=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,m=/^\[(x| )\](?=\s)/i,c=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,f=/^ {0,3}(?:\={1,}|-{2,})\s*$/,u=/^[^#!\[\]*_\\<>` "'(~:]+/,r=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,d=/^\s*\[[^\]]+?\]:.*$/,o=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,s=" ";function l(B,C,$){return C.f=C.inline=$,$(B,C)}function p(B,C,$){return C.f=C.block=$,$(B,C)}function R(B){return!B||!/\S/.test(B.string)}function w(B){if(B.linkTitle=!1,B.linkHref=!1,B.linkText=!1,B.em=!1,B.strong=!1,B.strikethrough=!1,B.quote=0,B.indentedCode=!1,B.f==O){var C=F;if(!C){var $=ae.innerMode(Y,B.htmlState);C=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}C&&(B.f=y,B.block=x,B.htmlState=null)}return B.trailingSpace=0,B.trailingSpaceNewLine=!1,B.prevLine=B.thisLine,B.thisLine={stream:null},null}function x(B,C){var $=B.column()===C.indentation,ee=R(C.prevLine.stream),re=C.indentedCode,ue=C.prevLine.hr,Te=C.list!==!1,ye=(C.listStack[C.listStack.length-1]||0)+3;C.indentedCode=!1;var be=C.indentation;if(C.indentationDiff===null&&(C.indentationDiff=C.indentation,Te)){for(C.list=null;be=4&&(re||C.prevLine.fencedCodeEnd||C.prevLine.header||ee))return B.skipToEnd(),C.indentedCode=!0,W.code;if(B.eatSpace())return null;if($&&C.indentation<=ye&&(me=B.match(c))&&me[1].length<=6)return C.quote=0,C.header=me[1].length,C.thisLine.header=!0,D.highlightFormatting&&(C.formatting="header"),C.f=C.inline,T(C);if(C.indentation<=ye&&B.eat(">"))return C.quote=$?1:C.quote+1,D.highlightFormatting&&(C.formatting="quote"),B.eatSpace(),T(C);if(!xe&&!C.setext&&$&&C.indentation<=ye&&(me=B.match(I))){var se=me[1]?"ol":"ul";return C.indentation=be+B.current().length,C.list=!0,C.quote=0,C.listStack.push(C.indentation),C.em=!1,C.strong=!1,C.code=!1,C.strikethrough=!1,D.taskLists&&B.match(m,!1)&&(C.taskList=!0),C.f=C.inline,D.highlightFormatting&&(C.formatting=["list","list-"+se]),T(C)}else{if($&&C.indentation<=ye&&(me=B.match(r,!0)))return C.quote=0,C.fencedEndRE=new RegExp(me[1]+"+ *$"),C.localMode=D.fencedCodeBlockHighlighting&&U(me[2]||D.fencedCodeBlockDefaultMode),C.localMode&&(C.localState=ae.startState(C.localMode)),C.f=C.block=A,D.highlightFormatting&&(C.formatting="code-block"),C.code=-1,T(C);if(C.setext||(!we||!Te)&&!C.quote&&C.list===!1&&!C.code&&!xe&&!d.test(B.string)&&(me=B.lookAhead(1))&&(me=me.match(f)))return C.setext?(C.header=C.setext,C.setext=0,B.skipToEnd(),D.highlightFormatting&&(C.formatting="header")):(C.header=me[0].charAt(0)=="="?1:2,C.setext=C.header),C.thisLine.header=!0,C.f=C.inline,T(C);if(xe)return B.skipToEnd(),C.hr=!0,C.thisLine.hr=!0,W.hr;if(B.peek()==="[")return l(B,C,M)}return l(B,C,C.inline)}function O(B,C){var $=Y.token(B,C.htmlState);if(!F){var ee=ae.innerMode(Y,C.htmlState);(ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText||C.md_inside&&B.current().indexOf(">")>-1)&&(C.f=y,C.block=x,C.htmlState=null)}return $}function A(B,C){var $=C.listStack[C.listStack.length-1]||0,ee=C.indentation<$,re=$+3;if(C.fencedEndRE&&C.indentation<=re&&(ee||B.match(C.fencedEndRE))){D.highlightFormatting&&(C.formatting="code-block");var ue;return ee||(ue=T(C)),C.localMode=C.localState=null,C.block=x,C.f=y,C.fencedEndRE=null,C.code=0,C.thisLine.fencedCodeEnd=!0,ee?p(B,C,C.block):ue}else return C.localMode?C.localMode.token(B,C.localState):(B.skipToEnd(),W.code)}function T(B){var C=[];if(B.formatting){C.push(W.formatting),typeof B.formatting=="string"&&(B.formatting=[B.formatting]);for(var $=0;$=B.quote?C.push(W.formatting+"-"+B.formatting[$]+"-"+B.quote):C.push("error"))}if(B.taskOpen)return C.push("meta"),C.length?C.join(" "):null;if(B.taskClosed)return C.push("property"),C.length?C.join(" "):null;if(B.linkHref?C.push(W.linkHref,"url"):(B.strong&&C.push(W.strong),B.em&&C.push(W.em),B.strikethrough&&C.push(W.strikethrough),B.emoji&&C.push(W.emoji),B.linkText&&C.push(W.linkText),B.code&&C.push(W.code),B.image&&C.push(W.image),B.imageAltText&&C.push(W.imageAltText,"link"),B.imageMarker&&C.push(W.imageMarker)),B.header&&C.push(W.header,W.header+"-"+B.header),B.quote&&(C.push(W.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=B.quote?C.push(W.quote+"-"+B.quote):C.push(W.quote+"-"+D.maxBlockquoteDepth)),B.list!==!1){var ee=(B.listStack.length-1)%3;ee?ee===1?C.push(W.list2):C.push(W.list3):C.push(W.list1)}return B.trailingSpaceNewLine?C.push("trailing-space-new-line"):B.trailingSpace&&C.push("trailing-space-"+(B.trailingSpace%2?"a":"b")),C.length?C.join(" "):null}function E(B,C){return B.match(u,!0)?T(C):void 0}function y(B,C){var $=C.text(B,C);if(typeof $!="undefined")return $;if(C.list)return C.list=null,T(C);if(C.taskList){var ee=B.match(m,!0)[1]===" ";return ee?C.taskOpen=!0:C.taskClosed=!0,D.highlightFormatting&&(C.formatting="task"),C.taskList=!1,T(C)}if(C.taskOpen=!1,C.taskClosed=!1,C.header&&B.match(/^#+$/,!0))return D.highlightFormatting&&(C.formatting="header"),T(C);var re=B.next();if(C.linkTitle){C.linkTitle=!1;var ue=re;re==="("&&(ue=")"),ue=(ue+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+ue+"\\\\]+|\\\\\\\\|\\\\.)"+ue;if(B.match(new RegExp(Te),!0))return W.linkHref}if(re==="`"){var ye=C.formatting;D.highlightFormatting&&(C.formatting="code"),B.eatWhile("`");var be=B.current().length;if(C.code==0&&(!C.quote||be==1))return C.code=be,T(C);if(be==C.code){var we=T(C);return C.code=0,we}else return C.formatting=ye,T(C)}else if(C.code)return T(C);if(re==="\\"&&(B.next(),D.highlightFormatting)){var xe=T(C),me=W.formatting+"-escape";return xe?xe+" "+me:me}if(re==="!"&&B.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return C.imageMarker=!0,C.image=!0,D.highlightFormatting&&(C.formatting="image"),T(C);if(re==="["&&C.imageMarker&&B.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return C.imageMarker=!1,C.imageAltText=!0,D.highlightFormatting&&(C.formatting="image"),T(C);if(re==="]"&&C.imageAltText){D.highlightFormatting&&(C.formatting="image");var xe=T(C);return C.imageAltText=!1,C.image=!1,C.inline=C.f=_,xe}if(re==="["&&!C.image)return C.linkText&&B.match(/^.*?\]/)||(C.linkText=!0,D.highlightFormatting&&(C.formatting="link")),T(C);if(re==="]"&&C.linkText){D.highlightFormatting&&(C.formatting="link");var xe=T(C);return C.linkText=!1,C.inline=C.f=B.match(/\(.*?\)| ?\[.*?\]/,!1)?_:y,xe}if(re==="<"&&B.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){C.f=C.inline=h,D.highlightFormatting&&(C.formatting="link");var xe=T(C);return xe?xe+=" ":xe="",xe+W.linkInline}if(re==="<"&&B.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){C.f=C.inline=h,D.highlightFormatting&&(C.formatting="link");var xe=T(C);return xe?xe+=" ":xe="",xe+W.linkEmail}if(D.xml&&re==="<"&&B.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var se=B.string.indexOf(">",B.pos);if(se!=-1){var Re=B.string.substring(B.start,se);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Re)&&(C.md_inside=!0)}return B.backUp(1),C.htmlState=ae.startState(Y),p(B,C,O)}if(D.xml&&re==="<"&&B.match(/^\/\w*?>/))return C.md_inside=!1,"tag";if(re==="*"||re==="_"){for(var ze=1,He=B.pos==1?" ":B.string.charAt(B.pos-2);ze<3&&B.eat(re);)ze++;var rt=B.peek()||" ",ot=!/\s/.test(rt)&&(!o.test(rt)||/\s/.test(He)||o.test(He)),Oe=!/\s/.test(He)&&(!o.test(He)||/\s/.test(rt)||o.test(rt)),Le=null,Ue=null;if(ze%2&&(!C.em&&ot&&(re==="*"||!Oe||o.test(He))?Le=!0:C.em==re&&Oe&&(re==="*"||!ot||o.test(rt))&&(Le=!1)),ze>1&&(!C.strong&&ot&&(re==="*"||!Oe||o.test(He))?Ue=!0:C.strong==re&&Oe&&(re==="*"||!ot||o.test(rt))&&(Ue=!1)),Ue!=null||Le!=null){D.highlightFormatting&&(C.formatting=Le==null?"strong":Ue==null?"em":"strong em"),Le===!0&&(C.em=re),Ue===!0&&(C.strong=re);var we=T(C);return Le===!1&&(C.em=!1),Ue===!1&&(C.strong=!1),we}}else if(re===" "&&(B.eat("*")||B.eat("_"))){if(B.peek()===" ")return T(C);B.backUp(1)}if(D.strikethrough){if(re==="~"&&B.eatWhile(re)){if(C.strikethrough){D.highlightFormatting&&(C.formatting="strikethrough");var we=T(C);return C.strikethrough=!1,we}else if(B.match(/^[^\s]/,!1))return C.strikethrough=!0,D.highlightFormatting&&(C.formatting="strikethrough"),T(C)}else if(re===" "&&B.match(/^~~/,!0)){if(B.peek()===" ")return T(C);B.backUp(2)}}if(D.emoji&&re===":"&&B.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){C.emoji=!0,D.highlightFormatting&&(C.formatting="emoji");var Ge=T(C);return C.emoji=!1,Ge}return re===" "&&(B.match(/^ +$/,!1)?C.trailingSpace++:C.trailingSpace&&(C.trailingSpaceNewLine=!0)),T(C)}function h(B,C){var $=B.next();if($===">"){C.f=C.inline=y,D.highlightFormatting&&(C.formatting="link");var ee=T(C);return ee?ee+=" ":ee="",ee+W.linkInline}return B.match(/^[^>]+/,!0),W.linkInline}function _(B,C){if(B.eatSpace())return null;var $=B.next();return $==="("||$==="["?(C.f=C.inline=b($==="("?")":"]"),D.highlightFormatting&&(C.formatting="link-string"),C.linkHref=!0,T(C)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function b(B){return function(C,$){var ee=C.next();if(ee===B){$.f=$.inline=y,D.highlightFormatting&&($.formatting="link-string");var re=T($);return $.linkHref=!1,re}return C.match(g[B]),$.linkHref=!0,T($)}}function M(B,C){return B.match(/^([^\]\\]|\\.)*\]:/,!1)?(C.f=P,B.next(),D.highlightFormatting&&(C.formatting="link"),C.linkText=!0,T(C)):l(B,C,y)}function P(B,C){if(B.match(/^\]:/,!0)){C.f=C.inline=K,D.highlightFormatting&&(C.formatting="link");var $=T(C);return C.linkText=!1,$}return B.match(/^([^\]\\]|\\.)+/,!0),W.linkText}function K(B,C){return B.eatSpace()?null:(B.match(/^[^\s]+/,!0),B.peek()===void 0?C.linkTitle=!0:B.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),C.f=C.inline=y,W.linkHref+" url")}var V={startState:function(){return{f:x,prevLine:{stream:null},thisLine:{stream:null},block:x,htmlState:null,indentation:0,inline:y,text:E,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(B){return{f:B.f,prevLine:B.prevLine,thisLine:B.thisLine,block:B.block,htmlState:B.htmlState&&ae.copyState(Y,B.htmlState),indentation:B.indentation,localMode:B.localMode,localState:B.localMode?ae.copyState(B.localMode,B.localState):null,inline:B.inline,text:B.text,formatting:!1,linkText:B.linkText,linkTitle:B.linkTitle,linkHref:B.linkHref,code:B.code,em:B.em,strong:B.strong,strikethrough:B.strikethrough,emoji:B.emoji,header:B.header,setext:B.setext,hr:B.hr,taskList:B.taskList,list:B.list,listStack:B.listStack.slice(0),quote:B.quote,indentedCode:B.indentedCode,trailingSpace:B.trailingSpace,trailingSpaceNewLine:B.trailingSpaceNewLine,md_inside:B.md_inside,fencedEndRE:B.fencedEndRE}},token:function(B,C){if(C.formatting=!1,B!=C.thisLine.stream){if(C.header=0,C.hr=!1,B.match(/^\s*$/,!0))return w(C),null;if(C.prevLine=C.thisLine,C.thisLine={stream:B},C.taskList=!1,C.trailingSpace=0,C.trailingSpaceNewLine=!1,!C.localState&&(C.f=C.block,C.f!=O)){var $=B.match(/^\s*/,!0)[0].replace(/\t/g,s).length;if(C.indentation=$,C.indentationDiff=null,$>0)return null}}return C.f(B,C)},innerMode:function(B){return B.block==O?{state:B.htmlState,mode:Y}:B.localState?{state:B.localState,mode:B.localMode}:{state:B,mode:V}},indent:function(B,C,$){return B.block==O&&Y.indent?Y.indent(B.htmlState,C,$):B.localState&&B.localMode.indent?B.localMode.indent(B.localState,C,$):ae.Pass},blankLine:w,getType:T,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),ae.defineMIME("text/markdown","markdown"),ae.defineMIME("text/x-markdown","markdown")})},osHv:function(vt,et,ne){(function(ae){ae(ne("VrN/"))})(function(ae){"use strict";var J=ae.Pos;function D(o,s){return o.line-s.line||o.ch-s.ch}var Y="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",F=Y+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",U=new RegExp("<(/?)(["+Y+"]["+F+"]*)","g");function W(o,s,l,p){this.line=s,this.ch=l,this.cm=o,this.text=o.getLine(s),this.min=p?Math.max(p.from,o.firstLine()):o.firstLine(),this.max=p?Math.min(p.to-1,o.lastLine()):o.lastLine()}function j(o,s){var l=o.cm.getTokenTypeAt(J(o.line,s));return l&&/\btag\b/.test(l)}function k(o){return o.line>=o.max?void 0:(o.ch=0,o.text=o.cm.getLine(++o.line),!0)}function I(o){return o.line<=o.min?void 0:(o.text=o.cm.getLine(--o.line),o.ch=o.text.length,!0)}function m(o){for(;;){var s=o.text.indexOf(">",o.ch);if(s==-1){if(k(o))continue;return}if(!j(o,s+1)){o.ch=s+1;continue}var l=o.text.lastIndexOf("/",s),p=l>-1&&!/\S/.test(o.text.slice(l+1,s));return o.ch=s+1,p?"selfClose":"regular"}}function c(o){for(;;){var s=o.ch?o.text.lastIndexOf("<",o.ch-1):-1;if(s==-1){if(I(o))continue;return}if(!j(o,s+1)){o.ch=s;continue}U.lastIndex=s,o.ch=s;var l=U.exec(o.text);if(l&&l.index==s)return l}}function f(o){for(;;){U.lastIndex=o.ch;var s=U.exec(o.text);if(!s){if(k(o))continue;return}if(!j(o,s.index+1)){o.ch=s.index+1;continue}return o.ch=s.index+s[0].length,s}}function u(o){for(;;){var s=o.ch?o.text.lastIndexOf(">",o.ch-1):-1;if(s==-1){if(I(o))continue;return}if(!j(o,s+1)){o.ch=s;continue}var l=o.text.lastIndexOf("/",s),p=l>-1&&!/\S/.test(o.text.slice(l+1,s));return o.ch=s+1,p?"selfClose":"regular"}}function r(o,s){for(var l=[];;){var p=f(o),R,w=o.line,x=o.ch-(p?p[0].length:0);if(!p||!(R=m(o)))return;if(R=="selfClose")continue;if(p[1]){for(var O=l.length-1;O>=0;--O)if(l[O]==p[2]){l.length=O;break}if(O<0&&(!s||s==p[2]))return{tag:p[2],from:J(w,x),to:J(o.line,o.ch)}}else l.push(p[2])}}function d(o,s){for(var l=[];;){var p=u(o);if(!p)return;if(p=="selfClose"){c(o);continue}var R=o.line,w=o.ch,x=c(o);if(!x)return;if(x[1])l.push(x[2]);else{for(var O=l.length-1;O>=0;--O)if(l[O]==x[2]){l.length=O;break}if(O<0&&(!s||s==x[2]))return{tag:x[2],from:J(o.line,o.ch),to:J(R,w)}}}}ae.registerHelper("fold","xml",function(o,s){for(var l=new W(o,s.line,0);;){var p=f(l);if(!p||l.line!=s.line)return;var R=m(l);if(!R)return;if(!p[1]&&R!="selfClose"){var w=J(l.line,l.ch),x=r(l,p[2]);return x&&D(x.from,w)>0?{from:w,to:x.from}:null}}}),ae.findMatchingTag=function(o,s,l){var p=new W(o,s.line,s.ch,l);if(p.text.indexOf(">")==-1&&p.text.indexOf("<")==-1)return;var R=m(p),w=R&&J(p.line,p.ch),x=R&&c(p);if(!R||!x||D(p,s)>0)return;var O={from:J(p.line,p.ch),to:w,tag:x[2]};return R=="selfClose"?{open:O,close:null,at:"open"}:x[1]?{open:d(p,x[2]),close:O,at:"close"}:(p=new W(o,w.line,w.ch,l),{open:O,close:r(p,x[2]),at:"open"})},ae.findEnclosingTag=function(o,s,l,p){for(var R=new W(o,s.line,s.ch,l);;){var w=d(R,p);if(!w)break;var x=new W(o,s.line,s.ch,l),O=r(x,w.tag);if(O)return{open:w,close:O}}},ae.scanForClosingTag=function(o,s,l,p){var R=new W(o,s.line,s.ch,p?{from:0,to:p}:null);return r(R,l)}})},p5ED:function(vt,et,ne){"use strict";var ae=ne("+L6B"),J=ne("2/Rp"),D=ne("5Dmo"),Y=ne("3S7+"),F=ne("k1fw"),U=ne("tJVT"),W=ne("q1tI"),j=ne.n(W),k=ne("vHTk"),I=ne.n(k),m=ne("yEEn"),c=ne("ZW9T"),f=ne("1vsH");et.a=function(u){var r=u.name,d=u.data,o=u.theme,s=u.type,l=u.filename,p=u.monacoEditor,R=u.className,w=u.style,x=u.close,O=u.onClose,A=u.hasMask,T=Object(W.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),E=Object(U.a)(T,2),y=E[0],h=E[1],_=Object(W.useState)(""),g=Object(U.a)(_,2),b=g[0],M=g[1],P,K=1024*1024,V=10*K,B=Object(W.useRef)();s==="office"&&(P=Object(f.T)(d).filesize,P>V&&(s="other")),l&&(p.filename=l),Object(W.useEffect)(function(){var ee,re,ue=(ee=document.cookie)===null||ee===void 0||((re=ee.replace(/\s/g,""))===null||re===void 0)?void 0:re.split(";");ue==null||ue.map(function(Te){var ye=Te.split("=");ye[0]==="_educoder_session"&&M(ye[1])})},[]);var C=function(){if(d.startsWith("http")||d.startsWith("/")){$();return}Object(f.z)(l||"educoder",d,l)},$=function(){Object(f.x)(l||r,d)};return console.log("data:",d,"fileanme:",l," name:",r),j.a.createElement("div",{style:Object(F.a)({},w||{}),className:"".concat(A&&I.a.bgBlack," ").concat(s?I.a.wrp:"hide")},x&&j.a.createElement("div",{className:I.a.close,ref:B},j.a.createElement(Y.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return B.current}},j.a.createElement("span",{onClick:$},j.a.createElement("i",{className:"icon-quxiaozhiding"}))),j.a.createElement(Y.a,{title:"\u5173\u95ED",getPopupContainer:function(){return B.current}},j.a.createElement("span",{className:"",onClick:O},j.a.createElement("i",{className:"icon-guanbi1"})))),j.a.createElement("div",{className:"".concat(I.a[R]," ").concat(R," ").concat(I.a.monaco," ").concat(s==="txt"?"show":"hide")},s==="txt"&&j.a.createElement(c.b,p)),s==="audio"&&j.a.createElement("audio",{src:"".concat(d!=null&&d.startsWith("/")||(d==null?void 0:d.indexOf("https://"))>-1?d:"data:audio/mp3;base64,").concat(d),autoPlay:!0}),s==="video"&&j.a.createElement(j.a.Fragment,null,d!=null&&d.startsWith("/")?j.a.createElement("video",{controls:!0,src:"".concat(d),autoPlay:!0}):j.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(d),autoPlay:!0})),s==="html"&&j.a.createElement("iframe",{src:d+"&disposition=inline"}),s==="pdf"&&j.a.createElement("embed",{className:I.a.embed,src:d}),s==="image"&&j.a.createElement(j.a.Fragment,null,j.a.createElement("img",{src:"".concat(d!=null&&d.startsWith("/")||(d==null?void 0:d.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(d)})),s==="other"&&j.a.createElement("div",null,j.a.createElement(J.a,{type:"primary",size:"large",onClick:C},j.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(s==="download"||s==="office")&&j.a.createElement(J.a,{type:"primary",size:"large",onClick:C},j.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(vt,et,ne){},psGv:function(vt,et,ne){var ae,J;(function(){var D;(function(){"use strict";var W=[,,function(m){function c(r){this.__parent=r,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}c.prototype.clone_empty=function(){var r=new c(this.__parent);return r.set_indent(this.__indent_count,this.__alignment_count),r},c.prototype.item=function(r){return r<0?this.__items[this.__items.length+r]:this.__items[r]},c.prototype.has_match=function(r){for(var d=this.__items.length-1;d>=0;d--)if(this.__items[d].match(r))return!0;return!1},c.prototype.set_indent=function(r,d){this.is_empty()&&(this.__indent_count=r||0,this.__alignment_count=d||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},c.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)},c.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},c.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var r=this.__parent.current_line;return r.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),r.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),r.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,r.__items[0]===" "&&(r.__items.splice(0,1),r.__character_count-=1),!0}return!1},c.prototype.is_empty=function(){return this.__items.length===0},c.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},c.prototype.push=function(r){this.__items.push(r);var d=r.lastIndexOf(` `);d!==-1?this.__character_count=r.length-d:this.__character_count+=r.length},c.prototype.pop=function(){var r=null;return this.is_empty()||(r=this.__items.pop(),this.__character_count-=r.length),r},c.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},c.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},c.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},c.prototype.toString=function(){var r="";return this.is_empty()?this.__parent.indent_empty_lines&&(r=this.__parent.get_indent_string(this.__indent_count)):(r=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),r+=this.__items.join("")),r};function f(r,d){this.__cache=[""],this.__indent_size=r.indent_size,this.__indent_string=r.indent_char,r.indent_with_tabs||(this.__indent_string=new Array(r.indent_size+1).join(r.indent_char)),d=d||"",r.indent_level>0&&(d=new Array(r.indent_level+1).join(this.__indent_string)),this.__base_string=d,this.__base_string_length=d.length}f.prototype.get_indent_size=function(r,d){var o=this.__base_string_length;return d=d||0,r<0&&(o=0),o+=r*this.__indent_size,o+=d,o},f.prototype.get_indent_string=function(r,d){var o=this.__base_string;return d=d||0,r<0&&(r=0,o=""),d+=r*this.__indent_size,this.__ensure_cache(d),o+=this.__cache[d],o},f.prototype.__ensure_cache=function(r){for(;r>=this.__cache.length;)this.__add_column()},f.prototype.__add_column=function(){var r=this.__cache.length,d=0,o="";this.__indent_size&&r>=this.__indent_size&&(d=Math.floor(r/this.__indent_size),r-=d*this.__indent_size,o=new Array(d+1).join(this.__indent_string)),r&&(o+=new Array(r+1).join(" ")),this.__cache.push(o)};function u(r,d){this.__indent_cache=new f(r,d),this.raw=!1,this._end_with_newline=r.end_with_newline,this.indent_size=r.indent_size,this.wrap_line_length=r.wrap_line_length,this.indent_empty_lines=r.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new c(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}u.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},u.prototype.get_line_number=function(){return this.__lines.length},u.prototype.get_indent_string=function(r,d){return this.__indent_cache.get_indent_string(r,d)},u.prototype.get_indent_size=function(r,d){return this.__indent_cache.get_indent_size(r,d)},u.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},u.prototype.add_new_line=function(r){return this.is_empty()||!r&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},u.prototype.get_code=function(r){this.trim(!0);var d=this.current_line.pop();d&&(d[d.length-1]===` `&&(d=d.replace(/\n+$/g,"")),this.current_line.push(d)),this._end_with_newline&&this.__add_outputline();var o=this.__lines.join(` `);return r!==` `&&(o=o.replace(/[\n]/g,r)),o},u.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},u.prototype.set_indent=function(r,d){return r=r||0,d=d||0,this.next_line.set_indent(r,d),this.__lines.length>1?(this.current_line.set_indent(r,d),!0):(this.current_line.set_indent(),!1)},u.prototype.add_raw_token=function(r){for(var d=0;d1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},u.prototype.just_added_newline=function(){return this.current_line.is_empty()},u.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},u.prototype.ensure_empty_line_above=function(r,d){for(var o=this.__lines.length-2;o>=0;){var s=this.__lines[o];if(s.is_empty())break;if(s.item(0).indexOf(r)!==0&&s.item(-1)!==d){this.__lines.splice(o+1,0,new c(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},m.exports.Output=u},function(m){function c(f,u,r,d){this.type=f,this.text=u,this.comments_before=null,this.newlines=r||0,this.whitespace_before=d||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}m.exports.Token=c},,,function(m){function c(r,d){this.raw_options=f(r,d),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}c.prototype._get_array=function(r,d){var o=this.raw_options[r],s=d||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(s=o.concat()):typeof o=="string"&&(s=o.split(/[^a-zA-Z0-9_\/\-]+/)),s},c.prototype._get_boolean=function(r,d){var o=this.raw_options[r],s=o===void 0?!!d:!!o;return s},c.prototype._get_characters=function(r,d){var o=this.raw_options[r],s=d||"";return typeof o=="string"&&(s=o.replace(/\\r/,"\r").replace(/\\n/,` `).replace(/\\t/," ")),s},c.prototype._get_number=function(r,d){var o=this.raw_options[r];d=parseInt(d,10),isNaN(d)&&(d=0);var s=parseInt(o,10);return isNaN(s)&&(s=d),s},c.prototype._get_selection=function(r,d,o){var s=this._get_selection_list(r,d,o);if(s.length!==1)throw new Error("Invalid Option Value: The option '"+r+`' can only be one of the following values: `+d+` You passed in: '`+this.raw_options[r]+"'");return s[0]},c.prototype._get_selection_list=function(r,d,o){if(!d||d.length===0)throw new Error("Selection list cannot be empty.");if(o=o||[d[0]],!this._is_valid_selection(o,d))throw new Error("Invalid Default Value!");var s=this._get_array(r,o);if(!this._is_valid_selection(s,d))throw new Error("Invalid Option Value: The option '"+r+`' can contain only the following values: `+d+` You passed in: '`+this.raw_options[r]+"'");return s},c.prototype._is_valid_selection=function(r,d){return r.length&&d.length&&!r.some(function(o){return d.indexOf(o)===-1})};function f(r,d){var o={};r=u(r);var s;for(s in r)s!==d&&(o[s]=r[s]);if(d&&r[d])for(s in r[d])o[s]=r[d][s];return o}function u(r){var d={},o;for(o in r){var s=o.replace(/-/g,"_");d[s]=r[o]}return d}m.exports.Options=c,m.exports.normalizeOpts=u,m.exports.mergeOpts=f},,function(m){var c=RegExp.prototype.hasOwnProperty("sticky");function f(u){this.__input=u||"",this.__input_length=this.__input.length,this.__position=0}f.prototype.restart=function(){this.__position=0},f.prototype.back=function(){this.__position>0&&(this.__position-=1)},f.prototype.hasNext=function(){return this.__position=0&&u=0&&r=u.length&&this.__input.substring(r-u.length,r).toLowerCase()===u},m.exports.InputScanner=f},function(m,c,f){var u=f(8).InputScanner,r=f(3).Token,d=f(10).TokenStream,o=f(11).WhitespacePattern,s={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},l=function(p,R){this._input=new u(p),this._options=R||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new o(this._input)};l.prototype.tokenize=function(){this._input.restart(),this.__tokens=new d,this._reset();for(var p,R=new r(s.START,""),w=null,x=[],O=new d;R.type!==s.EOF;){for(p=this._get_next_token(R,w);this._is_comment(p);)O.add(p),p=this._get_next_token(R,w);O.isEmpty()||(p.comments_before=O,O=new d),p.parent=w,this._is_opening(p)?(x.push(w),w=p):w&&this._is_closing(p,w)&&(p.opened=w,w.closed=p,w=x.pop(),p.parent=w),p.previous=R,R.next=p,this.__tokens.add(p),R=p}return this.__tokens},l.prototype._is_first_token=function(){return this.__tokens.isEmpty()},l.prototype._reset=function(){},l.prototype._get_next_token=function(p,R){this._readWhitespace();var w=this._input.read(/.+/g);return w?this._create_token(s.RAW,w):this._create_token(s.EOF,"")},l.prototype._is_comment=function(p){return!1},l.prototype._is_opening=function(p){return!1},l.prototype._is_closing=function(p,R){return!1},l.prototype._create_token=function(p,R){var w=new r(p,R,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return w},l.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},m.exports.Tokenizer=l,m.exports.TOKEN=s},function(m){function c(f){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=f}c.prototype.restart=function(){this.__position=0},c.prototype.isEmpty=function(){return this.__tokens_length===0},c.prototype.hasNext=function(){return this.__position=0&&f/),erb:l.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:l.starting_with(/{%/).until_after(/%}/),django_value:l.starting_with(/{{/).until_after(/}}/),django_comment:l.starting_with(/{#/).until_after(/#}/),smarty:l.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:l.starting_with(/{\*/).until_after(/\*}/),smarty_literal:l.starting_with(/{literal}/).until_after(/{\/literal}/)}}d.prototype=new u,d.prototype._create=function(){return new d(this._input,this)},d.prototype._update=function(){this.__set_templated_pattern()},d.prototype.disable=function(o){var s=this._create();return s._disabled[o]=!0,s._update(),s},d.prototype.read_options=function(o){var s=this._create();for(var l in r)s._disabled[l]=o.templating.indexOf(l)===-1;return s._update(),s},d.prototype.exclude=function(o){var s=this._create();return s._excluded[o]=!0,s._update(),s},d.prototype.read=function(){var o="";this._match_pattern?o=this._input.read(this._starting_pattern):o=this._input.read(this._starting_pattern,this.__template_pattern);for(var s=this._read_template();s;)this._match_pattern?s+=this._input.read(this._match_pattern):s+=this._input.readUntil(this.__template_pattern),o+=s,s=this._read_template();return this._until_after&&(o+=this._input.readUntilAfter(this._until_pattern)),o},d.prototype.__set_templated_pattern=function(){var o=[];this._disabled.php||o.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||o.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||o.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(o.push(this.__patterns.django._starting_pattern.source),o.push(this.__patterns.django_value._starting_pattern.source),o.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||o.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&o.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+o.join("|")+")")},d.prototype._read_template=function(){var o="",s=this._input.peek();if(s==="<"){var l=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&l==="?"&&(o=o||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&l==="%"&&(o=o||this.__patterns.erb.read())}else s==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(o=o||this.__patterns.handlebars_comment.read(),o=o||this.__patterns.handlebars_unescaped.read(),o=o||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(o=o||this.__patterns.django_value.read()),this._excluded.django||(o=o||this.__patterns.django_comment.read(),o=o||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(o=o||this.__patterns.smarty_comment.read(),o=o||this.__patterns.smarty_literal.read(),o=o||this.__patterns.smarty.read()));return o},m.exports.TemplatablePattern=d},,,,function(m,c,f){var u=f(19).Beautifier,r=f(20).Options;function d(o,s,l,p){var R=new u(o,s,l,p);return R.beautify()}m.exports=d,m.exports.defaultOptions=function(){return new r}},function(m,c,f){var u=f(20).Options,r=f(2).Output,d=f(21).Tokenizer,o=f(21).TOKEN,s=/\r\n|[\r\n]/,l=/\r\n|[\r\n]/g,p=function(_,g){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=_.max_preserve_newlines,this.preserve_newlines=_.preserve_newlines,this._output=new r(_,g)};p.prototype.current_line_has_match=function(_){return this._output.current_line.has_match(_)},p.prototype.set_space_before_token=function(_,g){this._output.space_before_token=_,this._output.non_breaking_space=g},p.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},p.prototype.add_raw_token=function(_){this._output.add_raw_token(_)},p.prototype.print_preserved_newlines=function(_){var g=0;_.type!==o.TEXT&&_.previous.type!==o.TEXT&&(g=_.newlines?1:0),this.preserve_newlines&&(g=_.newlines0);return g!==0},p.prototype.traverse_whitespace=function(_){return _.whitespace_before||_.newlines?(this.print_preserved_newlines(_)||(this._output.space_before_token=!0),!0):!1},p.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},p.prototype.print_newline=function(_){this._output.add_new_line(_)},p.prototype.print_token=function(_){_.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(_.text))},p.prototype.indent=function(){this.indent_level++},p.prototype.get_full_indent=function(_){return _=this.indent_level+(_||0),_<1?"":this._output.get_indent_string(_)};var R=function(_){for(var g=null,b=_.next;b.type!==o.EOF&&_.closed!==b;){if(b.type===o.ATTRIBUTE&&b.text==="type"){b.next&&b.next.type===o.EQUALS&&b.next.next&&b.next.next.type===o.VALUE&&(g=b.next.next.text);break}b=b.next}return g},w=function(_,g){var b=null,M=null;return g.closed?(_==="script"?b="text/javascript":_==="style"&&(b="text/css"),b=R(g)||b,b.search("text/css")>-1?M="css":b.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?M="javascript":b.search(/(text|application|dojo)\/(x-)?(html)/)>-1?M="html":b.search(/test\/null/)>-1&&(M="null"),M):null};function x(_,g){return g.indexOf(_)!==-1}function O(_,g,b){this.parent=_||null,this.tag=g?g.tag_name:"",this.indent_level=b||0,this.parser_token=g||null}function A(_){this._printer=_,this._current_frame=null}A.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},A.prototype.record_tag=function(_){var g=new O(this._current_frame,_,this._printer.indent_level);this._current_frame=g},A.prototype._try_pop_frame=function(_){var g=null;return _&&(g=_.parser_token,this._printer.indent_level=_.indent_level,this._current_frame=_.parent),g},A.prototype._get_frame=function(_,g){for(var b=this._current_frame;b&&!(_.indexOf(b.tag)!==-1);){if(g&&g.indexOf(b.tag)!==-1){b=null;break}b=b.parent}return b},A.prototype.try_pop=function(_,g){var b=this._get_frame([_],g);return this._try_pop_frame(b)},A.prototype.indent_to_tag=function(_){var g=this._get_frame(_);g&&(this._printer.indent_level=g.indent_level)};function T(_,g,b,M){this._source_text=_||"",g=g||{},this._js_beautify=b,this._css_beautify=M,this._tag_stack=null;var P=new u(g,"html");this._options=P,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"}T.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var _=this._source_text,g=this._options.eol;this._options.eol==="auto"&&(g=` `,_&&s.test(_)&&(g=_.match(s)[0])),_=_.replace(l,` `);var b=_.match(/^[\t ]*/)[0],M={text:"",type:""},P=new E,K=new p(this._options,b),V=new d(_,this._options).tokenize();this._tag_stack=new A(K);for(var B=null,C=V.next();C.type!==o.EOF;)C.type===o.TAG_OPEN||C.type===o.COMMENT?(B=this._handle_tag_open(K,C,P,M),P=B):C.type===o.ATTRIBUTE||C.type===o.EQUALS||C.type===o.VALUE||C.type===o.TEXT&&!P.tag_complete?B=this._handle_inside_tag(K,C,P,V):C.type===o.TAG_CLOSE?B=this._handle_tag_close(K,C,P):C.type===o.TEXT?B=this._handle_text(K,C,P):K.add_raw_token(C),M=B,C=V.next();var $=K._output.get_code(g);return $},T.prototype._handle_tag_close=function(_,g,b){var M={text:g.text,type:g.type};return _.alignment_size=0,b.tag_complete=!0,_.set_space_before_token(g.newlines||g.whitespace_before!=="",!0),b.is_unformatted?_.add_raw_token(g):(b.tag_start_char==="<"&&(_.set_space_before_token(g.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&b.has_wrapped_attrs&&_.print_newline(!1)),_.print_token(g)),b.indent_content&&!(b.is_unformatted||b.is_content_unformatted)&&(_.indent(),b.indent_content=!1),!b.is_inline_element&&!(b.is_unformatted||b.is_content_unformatted)&&_.set_wrap_point(),M},T.prototype._handle_inside_tag=function(_,g,b,M){var P=b.has_wrapped_attrs,K={text:g.text,type:g.type};if(_.set_space_before_token(g.newlines||g.whitespace_before!=="",!0),b.is_unformatted)_.add_raw_token(g);else if(b.tag_start_char==="{"&&g.type===o.TEXT)_.print_preserved_newlines(g)?(g.newlines=0,_.add_raw_token(g)):_.print_token(g);else{if(g.type===o.ATTRIBUTE?(_.set_space_before_token(!0),b.attr_count+=1):(g.type===o.EQUALS||g.type===o.VALUE&&g.previous.type===o.EQUALS)&&_.set_space_before_token(!1),g.type===o.ATTRIBUTE&&b.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(_.traverse_whitespace(g),P=P||g.newlines!==0),this._is_wrap_attributes_force)){var V=b.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&b.attr_count===1){var B=!0,C=0,$;do{if($=M.peek(C),$.type===o.ATTRIBUTE){B=!1;break}C+=1}while(C<4&&$.type!==o.EOF&&$.type!==o.TAG_CLOSE);V=!B}V&&(_.print_newline(!1),P=!0)}_.print_token(g),P=P||_.previous_token_wrapped(),b.has_wrapped_attrs=P}return K},T.prototype._handle_text=function(_,g,b){var M={text:g.text,type:"TK_CONTENT"};return b.custom_beautifier_name?this._print_custom_beatifier_text(_,g,b):b.is_unformatted||b.is_content_unformatted?_.add_raw_token(g):(_.traverse_whitespace(g),_.print_token(g)),M},T.prototype._print_custom_beatifier_text=function(_,g,b){var M=this;if(g.text!==""){var P=g.text,K,V=1,B="",C="";b.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?K=this._js_beautify:b.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?K=this._css_beautify:b.custom_beautifier_name==="html"&&(K=function(ye,be){var we=new T(ye,be,M._js_beautify,M._css_beautify);return we.beautify()}),this._options.indent_scripts==="keep"?V=0:this._options.indent_scripts==="separate"&&(V=-_.indent_level);var $=_.get_full_indent(V);if(P=P.replace(/\n[ \t]*$/,""),b.custom_beautifier_name!=="html"&&P[0]==="<"&&P.match(/^(|]]>)$/.exec(P);if(!ee){_.add_raw_token(g);return}B=$+ee[1]+` `,P=ee[4],ee[5]&&(C=$+ee[5]),P=P.replace(/\n[ \t]*$/,""),(ee[2]||ee[3].indexOf(` `)!==-1)&&(ee=ee[3].match(/[ \t]+$/),ee&&(g.whitespace_before=ee[0]))}if(P)if(K){var re=function(){this.eol=` `};re.prototype=this._options.raw_options;var ue=new re;P=K($+P,ue)}else{var Te=g.whitespace_before;Te&&(P=P.replace(new RegExp(` (`+Te+")?","g"),` `)),P=$+P.replace(/\n/g,` `+$)}B&&(P?P=B+P+` `+C:P=B+C),_.print_newline(!1),P&&(g.text=P,g.whitespace_before="",g.newlines=0,_.add_raw_token(g),_.print_newline(!0))}},T.prototype._handle_tag_open=function(_,g,b,M){var P=this._get_tag_open_token(g);return(b.is_unformatted||b.is_content_unformatted)&&!b.is_empty_element&&g.type===o.TAG_OPEN&&g.text.indexOf("]*)/),this.tag_check=b?b[1]:""):(b=g.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=b?b[1]:"",(g.text.startsWith("{{#>")||g.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&g.next!==null?this.tag_check=g.next.text.split(" ")[0]:this.tag_check=g.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),g.type===o.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||g.closed&&g.closed.text==="/>";var M=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(M=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(M)))}};T.prototype._get_tag_open_token=function(_){var g=new E(this._tag_stack.get_parser_token(),_);return g.alignment_size=this._options.wrap_attributes_indent_size,g.is_end_tag=g.is_end_tag||x(g.tag_check,this._options.void_elements),g.is_empty_element=g.tag_complete||g.is_start_tag&&g.is_end_tag,g.is_unformatted=!g.tag_complete&&x(g.tag_check,this._options.unformatted),g.is_content_unformatted=!g.is_empty_element&&x(g.tag_check,this._options.content_unformatted),g.is_inline_element=x(g.tag_name,this._options.inline)||g.tag_name.includes("-")||g.tag_start_char==="{",g},T.prototype._set_tag_position=function(_,g,b,M,P){if(b.is_empty_element||(b.is_end_tag?b.start_tag_token=this._tag_stack.try_pop(b.tag_name):(this._do_optional_end_element(b)&&(b.is_inline_element||_.print_newline(!1)),this._tag_stack.record_tag(b),(b.tag_name==="script"||b.tag_name==="style")&&!(b.is_unformatted||b.is_content_unformatted)&&(b.custom_beautifier_name=w(b.tag_check,g)))),x(b.tag_check,this._options.extra_liners)&&(_.print_newline(!1),_._output.just_added_blankline()||_.print_newline(!0)),b.is_empty_element){if(b.tag_start_char==="{"&&b.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),b.indent_content=!0;var K=_.current_line_has_match(/{{#if/);K||_.print_newline(!1)}b.tag_name==="!--"&&P.type===o.TAG_CLOSE&&M.is_end_tag&&b.text.indexOf(` `)===-1||(b.is_inline_element||b.is_unformatted||_.print_newline(!1),this._calcluate_parent_multiline(_,b))}else if(b.is_end_tag){var V=!1;V=b.start_tag_token&&b.start_tag_token.multiline_content,V=V||!b.is_inline_element&&!(M.is_inline_element||M.is_unformatted)&&!(P.type===o.TAG_CLOSE&&b.start_tag_token===M)&&P.type!=="TK_CONTENT",(b.is_content_unformatted||b.is_unformatted)&&(V=!1),V&&_.print_newline(!1)}else b.indent_content=!b.custom_beautifier_name,b.tag_start_char==="<"&&(b.tag_name==="html"?b.indent_content=this._options.indent_inner_html:b.tag_name==="head"?b.indent_content=this._options.indent_head_inner_html:b.tag_name==="body"&&(b.indent_content=this._options.indent_body_inner_html)),!(b.is_inline_element||b.is_unformatted)&&(P.type!=="TK_CONTENT"||b.is_content_unformatted)&&_.print_newline(!1),this._calcluate_parent_multiline(_,b)},T.prototype._calcluate_parent_multiline=function(_,g){g.parent&&_._output.just_added_newline()&&!((g.is_inline_element||g.is_unformatted)&&g.parent.is_inline_element)&&(g.parent.multiline_content=!0)};var y=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],h=["a","audio","del","ins","map","noscript","video"];T.prototype._do_optional_end_element=function(_){var g=null;if(_.is_empty_element||!_.is_start_tag||!_.parent)return;if(_.tag_name==="body")g=g||this._tag_stack.try_pop("head");else if(_.tag_name==="li")g=g||this._tag_stack.try_pop("li",["ol","ul"]);else if(_.tag_name==="dd"||_.tag_name==="dt")g=g||this._tag_stack.try_pop("dt",["dl"]),g=g||this._tag_stack.try_pop("dd",["dl"]);else if(_.parent.tag_name==="p"&&y.indexOf(_.tag_name)!==-1){var b=_.parent.parent;(!b||h.indexOf(b.tag_name)===-1)&&(g=g||this._tag_stack.try_pop("p"))}else _.tag_name==="rp"||_.tag_name==="rt"?(g=g||this._tag_stack.try_pop("rt",["ruby","rtc"]),g=g||this._tag_stack.try_pop("rp",["ruby","rtc"])):_.tag_name==="optgroup"?g=g||this._tag_stack.try_pop("optgroup",["select"]):_.tag_name==="option"?g=g||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):_.tag_name==="colgroup"?g=g||this._tag_stack.try_pop("caption",["table"]):_.tag_name==="thead"?(g=g||this._tag_stack.try_pop("caption",["table"]),g=g||this._tag_stack.try_pop("colgroup",["table"])):_.tag_name==="tbody"||_.tag_name==="tfoot"?(g=g||this._tag_stack.try_pop("caption",["table"]),g=g||this._tag_stack.try_pop("colgroup",["table"]),g=g||this._tag_stack.try_pop("thead",["table"]),g=g||this._tag_stack.try_pop("tbody",["table"])):_.tag_name==="tr"?(g=g||this._tag_stack.try_pop("caption",["table"]),g=g||this._tag_stack.try_pop("colgroup",["table"]),g=g||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(_.tag_name==="th"||_.tag_name==="td")&&(g=g||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),g=g||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return _.parent=this._tag_stack.get_parser_token(),g},m.exports.Beautifier=T},function(m,c,f){var u=f(6).Options;function r(d){u.call(this,d,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}r.prototype=new u,m.exports.Options=r},function(m,c,f){var u=f(9).Tokenizer,r=f(9).TOKEN,d=f(13).Directives,o=f(14).TemplatablePattern,s=f(12).Pattern,l={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:r.START,RAW:r.RAW,EOF:r.EOF},p=new d(/<\!--/,/-->/),R=function(w,x){u.call(this,w,x),this._current_tag_name="";var O=new o(this._input).read_options(this._options),A=new s(this._input);if(this.__patterns={word:O.until(/[\n\r\t <]/),single_quote:O.until_after(/'/),double_quote:O.until_after(/"/),attribute:O.until(/[\n\r\t =>]|\/>/),element_name:O.until(/[\n\r\t >\/]/),handlebars_comment:A.starting_with(/{{!--/).until_after(/--}}/),handlebars:A.starting_with(/{{/).until_after(/}}/),handlebars_open:A.until(/[\n\r\t }]/),handlebars_raw_close:A.until(/}}/),comment:A.starting_with(//),cdata:A.starting_with(//),conditional_comment:A.starting_with(//),processing:A.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var T=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=A.matching(T).until_after(T)}};R.prototype=new u,R.prototype._is_comment=function(w){return!1},R.prototype._is_opening=function(w){return w.type===l.TAG_OPEN},R.prototype._is_closing=function(w,x){return w.type===l.TAG_CLOSE&&x&&((w.text===">"||w.text==="/>")&&x.text[0]==="<"||w.text==="}}"&&x.text[0]==="{"&&x.text[1]==="{")},R.prototype._reset=function(){this._current_tag_name=""},R.prototype._get_next_token=function(w,x){var O=null;this._readWhitespace();var A=this._input.peek();return A===null?this._create_token(l.EOF,""):(O=O||this._read_open_handlebars(A,x),O=O||this._read_attribute(A,w,x),O=O||this._read_close(A,x),O=O||this._read_raw_content(A,w,x),O=O||this._read_content_word(A),O=O||this._read_comment_or_cdata(A),O=O||this._read_processing(A),O=O||this._read_open(A,x),O=O||this._create_token(l.UNKNOWN,this._input.next()),O)},R.prototype._read_comment_or_cdata=function(w){var x=null,O=null,A=null;if(w==="<"){var T=this._input.peek(1);T==="!"&&(O=this.__patterns.comment.read(),O?(A=p.get_directives(O),A&&A.ignore==="start"&&(O+=p.readIgnored(this._input))):O=this.__patterns.cdata.read()),O&&(x=this._create_token(l.COMMENT,O),x.directives=A)}return x},R.prototype._read_processing=function(w){var x=null,O=null,A=null;if(w==="<"){var T=this._input.peek(1);(T==="!"||T==="?")&&(O=this.__patterns.conditional_comment.read(),O=O||this.__patterns.processing.read()),O&&(x=this._create_token(l.COMMENT,O),x.directives=A)}return x},R.prototype._read_open=function(w,x){var O=null,A=null;return x||w==="<"&&(O=this._input.next(),this._input.peek()==="/"&&(O+=this._input.next()),O+=this.__patterns.element_name.read(),A=this._create_token(l.TAG_OPEN,O)),A},R.prototype._read_open_handlebars=function(w,x){var O=null,A=null;return x||this._options.indent_handlebars&&w==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(O=this.__patterns.handlebars_comment.read(),O=O||this.__patterns.handlebars.read(),A=this._create_token(l.COMMENT,O)):(O=this.__patterns.handlebars_open.read(),A=this._create_token(l.TAG_OPEN,O))),A},R.prototype._read_close=function(w,x){var O=null,A=null;return x&&(x.text[0]==="<"&&(w===">"||w==="/"&&this._input.peek(1)===">")?(O=this._input.next(),w==="/"&&(O+=this._input.next()),A=this._create_token(l.TAG_CLOSE,O)):x.text[0]==="{"&&w==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),A=this._create_token(l.TAG_CLOSE,"}}"))),A},R.prototype._read_attribute=function(w,x,O){var A=null,T="";if(O&&O.text[0]==="<")if(w==="=")A=this._create_token(l.EQUALS,this._input.next());else if(w==='"'||w==="'"){var E=this._input.next();w==='"'?E+=this.__patterns.double_quote.read():E+=this.__patterns.single_quote.read(),A=this._create_token(l.VALUE,E)}else T=this.__patterns.attribute.read(),T&&(x.type===l.EQUALS?A=this._create_token(l.VALUE,T):A=this._create_token(l.ATTRIBUTE,T));return A},R.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)},R.prototype._read_raw_content=function(w,x,O){var A="";if(O&&O.text[0]==="{")A=this.__patterns.handlebars_raw_close.read();else if(x.type===l.TAG_CLOSE&&x.opened.text[0]==="<"&&x.text[0]!=="/"){var T=x.opened.text.substr(1).toLowerCase();if(T==="script"||T==="style"){var E=this._read_comment_or_cdata(w);if(E)return E.type=l.TEXT,E;A=this._input.readUntil(new RegExp("","ig"))}else this._is_content_unformatted(T)&&(A=this._input.readUntil(new RegExp("","ig")))}return A?this._create_token(l.TEXT,A):null},R.prototype._read_content_word=function(w){var x="";if(this._options.unformatted_content_delimiter&&(w===this._options.unformatted_content_delimiter[0]&&(x=this.__patterns.unformatted_content_delimiter.read())),x||(x=this.__patterns.word.read()),x)return this._create_token(l.TEXT,x)},m.exports.Tokenizer=R,m.exports.TOKEN=l}],j={};function k(m){var c=j[m];if(c!==void 0)return c.exports;var f=j[m]={exports:{}};return W[m](f,f.exports,k),f.exports}var I=k(18);D=I})();var Y=D;if(!0)!(ae=[ne,ne("6UM0"),ne("TXwP")],J=function(W){var j=ne("6UM0"),k=ne("TXwP");return{html_beautify:function(I,m){return Y(I,m,j.js_beautify,k.css_beautify)}}}.apply(et,ae),J!==void 0&&(vt.exports=J));else var F,U})()},"rAM+":function(vt,et,ne){"use strict";ne.d(et,"a",function(){return J});var ae=ne("Qw5x");function J(D,Y){var F;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(F=Object(ae.a)(D))||Y&&D&&typeof D.length=="number"){F&&(D=F);var U=0,W=function(){};return{s:W,n:function(){return U>=D.length?{done:!0}:{done:!1,value:D[U++]}},e:function(c){throw c},f:W}}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 j=!0,k=!1,I;return{s:function(){F=D[Symbol.iterator]()},n:function(){var c=F.next();return j=c.done,c},e:function(c){k=!0,I=c},f:function(){try{!j&&F.return!=null&&F.return()}finally{if(k)throw I}}}}},rUJ1:function(vt,et){const ne=/[&<>"']/,ae=/[&<>"']/g,J=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,Y={"&":"&","<":"<",">":">",'"':""","'":"'"},F=A=>Y[A];function U(A,T){if(T){if(ne.test(A))return A.replace(ae,F)}else if(J.test(A))return A.replace(D,F);return A}const W=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function j(A){return A.replace(W,(T,E)=>(E=E.toLowerCase(),E==="colon"?":":E.charAt(0)==="#"?E.charAt(1)==="x"?String.fromCharCode(parseInt(E.substring(2),16)):String.fromCharCode(+E.substring(1)):""))}const k=/(^|[^\[])\^/g;function I(A,T){A=A.source||A,T=T||"";const E={replace:(y,h)=>(h=h.source||h,h=h.replace(k,"$1"),A=A.replace(y,h),E),getRegex:()=>new RegExp(A,T)};return E}const m=/[^\w:]/g,c=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(A,T,E){if(A){let y;try{y=decodeURIComponent(j(E)).replace(m,"").toLowerCase()}catch(h){return null}if(y.indexOf("javascript:")===0||y.indexOf("vbscript:")===0||y.indexOf("data:")===0)return null}T&&!c.test(E)&&(E=s(T,E));try{E=encodeURI(E).replace(/%25/g,"%")}catch(y){return null}return E}const u={},r=/^[^:]+:\/*[^/]*$/,d=/^([^:]+:)[\s\S]*$/,o=/^([^:]+:\/*[^/]*)[\s\S]*$/;function s(A,T){u[" "+A]||(r.test(A)?u[" "+A]=A+"/":u[" "+A]=w(A,"/",!0)),A=u[" "+A];const E=A.indexOf(":")===-1;return T.substring(0,2)==="//"?E?T:A.replace(d,"$1")+T:T.charAt(0)==="/"?E?T:A.replace(o,"$1")+T:A+T}const l={exec:function(){}};function p(A){let T=1,E,y;for(;T{let M=!1,P=g;for(;--P>=0&&b[P]==="\\";)M=!M;return M?"|":" |"}),y=E.split(/ \|/);let h=0;if(y.length>T)y.splice(T);else for(;y.length0},!1)}function m(c,f){for(var u={main:[f]},r={main:[]},d={main:{}};I(u);)for(var o=Object.keys(u),s=0;s=2*O/T||b<=P)return;var K=Number.POSITIVE_INFINITY,V;for(V=o.level-1;V>y;V--){var B=E[V].maxBitrate;if(K=O*B/(8*.8*g),K=b)return;var C=this.bwEstimator.getEstimate();I.logger.warn("Fragment "+o.sn+(s?" part "+s.index:"")+" of level "+o.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+` Current BW estimate: `+(Object(Y.isFiniteNumber)(C)?(C/1024).toFixed(3):"Unknown")+` Kb/s Estimated load time for current fragment: `+b.toFixed(3)+` s Estimated load time for the next fragment: `+K.toFixed(3)+` s Time to underbuffer: `+P.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(A,x.loaded),this.clearTimer(),o.loader&&(this.fragCurrent=this.partCurrent=null,o.loader.abort()),l.trigger(U.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:o,part:s,stats:x})},r.onFragLoaded=function(o,s){var l=s.frag,p=s.part;if(l.type===k.PlaylistLevelType.MAIN&&Object(Y.isFiniteNumber)(l.sn)){var R=p?p.stats:l.stats,w=p?p.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var x=this.hls.levels[l.level],O=(x.loaded?x.loaded.bytes:0)+R.loaded,A=(x.loaded?x.loaded.duration:0)+w;x.loaded={bytes:O,duration:A},x.realBitrate=Math.round(8*O/A)}if(l.bitrateTest){var T={stats:R,frag:l,part:p,id:l.type};this.onFragBuffered(U.Events.FRAG_BUFFERED,T),l.bitrateTest=!1}}},r.onFragBuffered=function(o,s){var l=s.frag,p=s.part,R=p?p.stats:l.stats;if(R.aborted)return;if(l.type!==k.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var w=R.parsing.end-R.loading.start;this.bwEstimator.sample(w,R.loaded),R.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=w/1e3:this.bitrateTestDelay=0},r.onError=function(o,s){switch(s.details){case j.ErrorDetails.FRAG_LOAD_ERROR:case j.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},r.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},r.getNextABRAutoLevel=function(){var o=this.fragCurrent,s=this.partCurrent,l=this.hls,p=l.maxAutoLevel,R=l.config,w=l.minAutoLevel,x=l.media,O=s?s.duration:o?o.duration:0,A=x?x.currentTime:0,T=x&&x.playbackRate!==0?Math.abs(x.playbackRate):1,E=this.bwEstimator?this.bwEstimator.getEstimate():R.abrEwmaDefaultEstimate,y=(W.BufferHelper.bufferInfo(x,A,R.maxBufferHole).end-A)/T,h=this.findBestLevel(E,w,p,y,R.abrBandWidthFactor,R.abrBandWidthUpFactor);if(h>=0)return h;I.logger.trace((y?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var _=O?Math.min(O,R.maxStarvationDelay):R.maxStarvationDelay,g=R.abrBandWidthFactor,b=R.abrBandWidthUpFactor;if(!y){var M=this.bitrateTestDelay;if(M){var P=O?Math.min(O,R.maxLoadingDelay):R.maxLoadingDelay;_=P-M,I.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*_)+" ms"),g=b=1}}return h=this.findBestLevel(E,w,p,y+_,g,b),Math.max(h,0)},r.findBestLevel=function(o,s,l,p,R,w){for(var x,O=this.fragCurrent,A=this.partCurrent,T=this.lastLoadedFragLevel,E=this.hls.levels,y=E[T],h=!!(y!=null&&(x=y.details)!==null&&x!==void 0&&x.live),_=y==null?void 0:y.codecSet,g=A?A.duration:O?O.duration:0,b=l;b>=s;b--){var M=E[b];if(!M||_&&M.codecSet!==_)continue;var P=M.details,K=(A?P==null?void 0:P.partTarget:P==null?void 0:P.averagetargetduration)||g,V=void 0;b<=T?V=R*o:V=w*o;var B=E[b].maxBitrate,C=B*K/V;if(I.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+b+"/"+Math.round(V)+"/"+B+"/"+K+"/"+p+"/"+C),V>B&&(!C||h&&!this.bitrateTestDelay||C0&&y===-1?(this.log("Override startPosition with lastCurrentTime @"+h.toFixed(3)),this.state=F.State.IDLE):(this.loadedmetadata=!1,this.state=F.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=y,this.tick()},T.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_TRACK:{var y,h=this.levels,_=this.trackId,g=h==null||((y=h[_])===null||y===void 0)?void 0:y.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=F.State.WAITING_INIT_PTS}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var b,M=performance.now(),P=this.retryDate;(!P||M>=P||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=F.State.IDLE);break}case F.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var V=K.frag,B=K.part,C=K.cache,$=K.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.FRAG_LOADING;var ee=C.flush(),re={frag:V,part:B,payload:ee,networkDetails:null};this._handleFragmentLoadProgress(re),$&&O.prototype._handleFragmentLoadComplete.call(this,re)}else if(this.videoTrackCC!==this.waitingVideoCC)s.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ue=this.getLoadPosition(),Te=W.BufferHelper.bufferInfo(this.mediaBuffer,ue,this.config.maxBufferHole),ye=Object(r.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,V);ye<0&&(s.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+Te.end+" is needed"),this.clearWaitingFragment())}}else this.state=F.State.IDLE}}this.onTickEnd()},T.clearWaitingFragment=function(){var y=this.waitingData;y&&(this.fragmentTracker.removeFragment(y.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.IDLE)},T.onTickEnd=function(){var y=this.media;if(!y||!y.readyState)return;var h=this.mediaBuffer?this.mediaBuffer:y,_=h.buffered;!this.loadedmetadata&&_.length&&(this.loadedmetadata=!0),this.lastCurrentTime=y.currentTime},T.doTickIdle=function(){var y,h,_=this.hls,g=this.levels,b=this.media,M=this.trackId,P=_.config;if(!g||!g[M])return;if(!b&&(this.startFragRequested||!P.startFragPrefetch))return;var K=g[M],V=K.details;if(!V||V.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(V)){this.state=F.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,m.ElementaryStreamTypes.AUDIO,I.PlaylistLevelType.AUDIO));var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,I.PlaylistLevelType.AUDIO);if(B===null)return;var C=B.len,$=this.getMaxBufferLength(),ee=this.audioSwitch;if(C>=$&&!ee)return;if(!ee&&this._streamEnded(B,V)){_.trigger(U.Events.BUFFER_EOS,{type:"audio"}),this.state=F.State.ENDED;return}var re=V.fragments,ue=re[0].start,Te=B.end;if(ee){var ye=this.getLoadPosition();Te=ye,V.PTSKnown&&yeue||B.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=ue+.05))}var be=this.getNextFragment(Te,V);if(!be){this.bufferFlushed=!0;return}((y=be.decryptdata)===null||y===void 0?void 0:y.keyFormat)==="identity"&&!((h=be.decryptdata)!==null&&h!==void 0&&h.key)?this.loadKey(be,V):this.loadFragment(be,V,Te)},T.getMaxBufferLength=function(){var y=O.prototype.getMaxBufferLength.call(this),h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,I.PlaylistLevelType.MAIN);return h===null?y:Math.max(y,h.len)},T.onMediaDetaching=function(){this.videoBuffer=null,O.prototype.onMediaDetaching.call(this)},T.onAudioTracksUpdated=function(y,h){var _=h.audioTracks;this.resetTransmuxer(),this.levels=_.map(function(g){return new k.Level(g)})},T.onAudioTrackSwitching=function(y,h){var _=!!h.url;this.trackId=h.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),_?this.setInterval(w):this.resetTransmuxer(),_?(this.audioSwitch=!0,this.state=F.State.IDLE):this.state=F.State.STOPPED,this.tick()},T.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},T.onLevelLoaded=function(y,h){this.mainDetails=h.details},T.onAudioTrackLoaded=function(y,h){var _,g=this.levels,b=h.details,M=h.id;if(!g){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+b.startSN+","+b.endSN+"],duration:"+b.totalduration);var P=g[M],K=0;if(b.live||(_=P.details)!==null&&_!==void 0&&_.live){var V=this.mainDetails;if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed||!V)return;!P.details&&b.hasProgramDateTime&&V.hasProgramDateTime?(Object(d.alignMediaPlaylistByPDT)(b,V),K=b.fragments[0].start):K=this.alignPlaylists(b,P.details)}P.details=b,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!b.live)&&this.setStartPosition(P.details,K),this.state===F.State.WAITING_TRACK&&!this.waitForCdnTuneIn(b)&&(this.state=F.State.IDLE),this.tick()},T._handleFragmentLoadProgress=function(y){var h,_=y.frag,g=y.part,b=y.payload,M=this.config,P=this.trackId,K=this.levels;if(!K){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+_.sn+" of level "+_.level+" will not be buffered");return}var V=K[P];console.assert(V,"Audio track is defined on fragment load progress");var B=V.details;console.assert(B,"Audio track details are defined on fragment load progress");var C=M.defaultAudioCodec||V.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new f.default(this.hls,I.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[_.cc],re=(h=_.initSegment)===null||h===void 0?void 0:h.data;if(ee!==void 0){var ue=!1,Te=g?g.index:-1,ye=Te!==-1,be=new u.ChunkMetadata(_.level,_.sn,_.stats.chunkCount,b.byteLength,Te,ye);$.push(b,re,C,"",_,g,B.totalduration,ue,be,ee)}else{s.logger.log("Unknown video PTS for cc "+_.cc+", waiting for video PTS before demuxing audio frag "+_.sn+" of ["+B.startSN+" ,"+B.endSN+"],track "+P);var we=this.waitingData=this.waitingData||{frag:_,part:g,cache:new c.default,complete:!1},xe=we.cache;xe.push(new Uint8Array(b)),this.waitingVideoCC=this.videoTrackCC,this.state=F.State.WAITING_INIT_PTS}},T._handleFragmentLoadComplete=function(y){if(this.waitingData){this.waitingData.complete=!0;return}O.prototype._handleFragmentLoadComplete.call(this,y)},T.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},T.onBufferCreated=function(y,h){var _=h.tracks.audio;_&&(this.mediaBuffer=_.buffer),h.tracks.video&&(this.videoBuffer=h.tracks.video.buffer)},T.onFragBuffered=function(y,h){var _=h.frag,g=h.part;if(_.type!==I.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(_)){this.warn("Fragment "+_.sn+(g?" p: "+g.index:"")+" of level "+_.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}_.sn!=="initSegment"&&(this.fragPrevious=_,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(U.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(_,g)},T.onError=function(y,h){switch(h.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:case o.ErrorDetails.KEY_LOAD_ERROR:case o.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(I.PlaylistLevelType.AUDIO,h);break;case o.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case o.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==F.State.ERROR&&this.state!==F.State.STOPPED&&(this.state=h.fatal?F.State.ERROR:F.State.IDLE,this.warn(h.details+" while loading frag, switching to "+this.state+" state"));break;case o.ErrorDetails.BUFFER_FULL_ERROR:if(h.parent==="audio"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var _=!0,g=this.getFwdBufferInfo(this.mediaBuffer,I.PlaylistLevelType.AUDIO);g&&g.len>.5&&(_=!this.reduceMaxBufferLength(g.len)),_&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},T.onBufferFlushed=function(y,h){var _=h.type;_===m.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},T._handleTransmuxComplete=function(y){var h,_="audio",g=this.hls,b=y.remuxResult,M=y.chunkMeta,P=this.getCurrentContext(M);if(!P){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var K=P.frag,V=P.part,B=b.audio,C=b.text,$=b.id3,ee=b.initSegment;if(this.fragContextChanged(K))return;if(this.state=F.State.PARSING,this.audioSwitch&&B&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,K,M),g.trigger(U.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:_,tracks:ee.tracks})),B){var re=B.startPTS,ue=B.endPTS,Te=B.startDTS,ye=B.endDTS;V&&(V.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:re,endPTS:ue,startDTS:Te,endDTS:ye}),K.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,re,ue,Te,ye),this.bufferFragmentData(B,K,V,M)}if($!=null&&(h=$.samples)!==null&&h!==void 0&&h.length){var be=l({frag:K,id:_},$);g.trigger(U.Events.FRAG_PARSING_METADATA,be)}if(C){var we=l({frag:K,id:_},C);g.trigger(U.Events.FRAG_PARSING_USERDATA,we)}},T._bufferInitSegment=function(y,h,_){if(this.state!==F.State.PARSING)return;y.video&&delete y.video;var g=y.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(U.Events.BUFFER_CODECS,y);var b=g.initSegment;if(b!=null&&b.byteLength){var M={type:"audio",frag:h,part:null,chunkMeta:_,parent:h.type,data:b};this.hls.trigger(U.Events.BUFFER_APPENDING,M)}this.tick()},T.loadFragment=function(y,h,_){var g=this.fragmentTracker.getState(y);this.fragCurrent=y,(this.audioSwitch||g===j.FragmentState.NOT_LOADED||g===j.FragmentState.PARTIAL)&&(y.sn==="initSegment"?this._loadInitSegment(y):h.live&&!Object(Y.isFiniteNumber)(this.initPTS[y.cc])?(this.log("Waiting for video PTS in continuity counter "+y.cc+" of live stream before loading audio fragment "+y.sn+" of level "+this.trackId),this.state=F.State.WAITING_INIT_PTS):(this.startFragRequested=!0,O.prototype.loadFragment.call(this,y,h,_)))},T.completeAudioSwitch=function(){var y=this.hls,h=this.media,_=this.trackId;h&&(this.log("Switching audio track : flushing all audio"),O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,y.trigger(U.Events.AUDIO_TRACK_SWITCHED,{id:_})},A}(F.default);J.default=x},"./src/controller/audio-track-controller.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/events.ts"),F=D("./src/errors.ts"),U=D("./src/controller/base-playlist-controller.ts"),W=D("./src/types/loader.ts");function j(f,u){for(var r=0;r=s.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=s[this.trackId];this.log("Now switching to audio-track index "+o);var p=s[o],R=p.id,w=p.groupId,x=w===void 0?"":w,O=p.name,A=p.type,T=p.url;if(this.trackId=o,this.trackName=O,this.selectDefaultTrack=!1,this.hls.trigger(Y.Events.AUDIO_TRACK_SWITCHING,{id:R,groupId:x,name:O,type:A,url:T}),p.details&&!p.details.live)return;var E=this.switchParams(p.url,l==null?void 0:l.details);this.loadPlaylist(E)},r.selectInitialTrack=function(){var o=this.tracksInGroup;console.assert(o.length,"Initial audio track should be selected when tracks are known");var s=this.trackName,l=this.findTrackId(s)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},r.findTrackId=function(o){for(var s=this.tracksInGroup,l=0;lu.partTarget&&(p+=1)}if(Object(Y.isFiniteNumber)(l))return new F.HlsUrlParameters(l,Object(Y.isFiniteNumber)(p)?p:void 0,F.HlsSkip.No)}}},m.loadPlaylist=function(f){},m.shouldLoadTrack=function(f){return this.canLoad&&f&&!!f.url&&(!f.details||f.details.live)},m.playlistLoaded=function(f,u,r){var d=this,o=u.details,s=u.stats,l=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(o.advancedDateTime=Date.now()-l,o.live||r!=null&&r.live){if(o.reloaded(r),r&&this.log("live playlist "+f+" "+(o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:"MISSED")),r&&o.fragments.length>0&&Object(U.mergeDetails)(r,o),!this.canLoad||!o.live)return;var p,R=void 0,w=void 0;if(o.canBlockReload&&o.endSN&&o.advanced){var x=this.hls.config.lowLatencyMode,O=o.lastPartSn,A=o.endSN,T=o.lastPartIndex,E=T!==-1,y=O===A,h=x?0:T;E?(R=y?A+1:O,w=y?h:T+1):R=A+1;var _=o.age,g=_+o.ageHeader,b=Math.min(g-o.partTarget,o.targetduration*1.5);if(b>0){if(r&&b>r.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+r.tuneInGoal+" to: "+b+" with playlist age: "+o.age),b=0;else{var M=Math.floor(b/o.targetduration);if(R+=M,w!==void 0){var P=Math.round(b%o.targetduration/o.partTarget);w+=P}this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+_.toFixed(2)+"s goal: "+b+" skip sn "+M+" to part "+w)}o.tuneInGoal=b}if(p=this.getDeliveryDirectives(o,u.deliveryDirectives,R,w),x||!y){this.loadPlaylist(p);return}}else p=this.getDeliveryDirectives(o,u.deliveryDirectives,R,w);var K=Object(U.computeReloadInterval)(o,s);R!==void 0&&o.canBlockReload&&(K-=o.partTarget||1),this.log("reload live playlist "+f+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return d.loadPlaylist(p)},K)}else this.clearTimer()},m.getDeliveryDirectives=function(f,u,r,d){var o=Object(F.getSkipValue)(f,r);return u!=null&&u.skip&&f.deltaUpdateFailed&&(r=u.msn,d=u.part,o=F.HlsSkip.No),new F.HlsUrlParameters(r,d,o)},m.retryLoadingOrFail=function(f){var u=this,r=this.hls.config,d=this.retryCount-1&&(o=f.context)!==null&&o!==void 0&&o.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+f.details+'"'),this.loadPlaylist();else{var s=Math.min(Math.pow(2,this.retryCount)*r.levelLoadingRetryDelay,r.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return u.loadPlaylist()},s),this.warn("retry playlist loading #"+this.retryCount+" in "+s+' ms after "'+f.details+'"')}}else this.warn('cannot recover from error "'+f.details+'"'),this.clearTimer(),f.fatal=!0;return d},I}()},"./src/controller/base-stream-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"State",function(){return A}),D.d(J,"default",function(){return T});var Y=D("./src/polyfills/number.ts"),F=D("./src/task-loop.ts"),U=D("./src/controller/fragment-tracker.ts"),W=D("./src/utils/buffer-helper.ts"),j=D("./src/utils/logger.ts"),k=D("./src/events.ts"),I=D("./src/errors.ts"),m=D("./src/types/transmuxer.ts"),c=D("./src/utils/mp4-tools.ts"),f=D("./src/utils/discontinuities.ts"),u=D("./src/controller/fragment-finders.ts"),r=D("./src/controller/level-helper.ts"),d=D("./src/loader/fragment-loader.ts"),o=D("./src/crypt/decrypter.ts"),s=D("./src/utils/time-ranges.ts"),l=D("./src/types/loader.ts");function p(E,y){for(var h=0;hee;(V<$||re)&&(re&&b.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),b.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=V),!this.loadedmetadata&&!B.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},h.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},h.onKeyLoaded=function(g,b){if(this.state!==A.KEY_LOADING||b.frag!==this.fragCurrent||!this.levels)return;this.state=A.IDLE;var M=this.levels[b.frag.level].details;M&&this.loadFragment(b.frag,M,b.frag.start)},h.onHandlerDestroying=function(){this.stopLoad(),E.prototype.onHandlerDestroying.call(this)},h.onHandlerDestroyed=function(){this.state=A.STOPPED,this.hls.off(k.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,E.prototype.onHandlerDestroyed.call(this)},h.loadKey=function(g,b){this.log("Loading key for "+g.sn+" of ["+b.startSN+"-"+b.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=A.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(k.Events.KEY_LOADING,{frag:g})},h.loadFragment=function(g,b,M){this._loadFragForPlayback(g,b,M)},h._loadFragForPlayback=function(g,b,M){var P=this,K=function(B){if(P.fragContextChanged(g)){P.warn("Fragment "+g.sn+(B.part?" p: "+B.part.index:"")+" of level "+g.level+" was dropped during download."),P.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,P._handleFragmentLoadProgress(B)};this._doFragLoad(g,b,M,K).then(function(V){if(!V)return;P.fragLoadError=0;var B=P.state;if(P.fragContextChanged(g)){(B===A.FRAG_LOADING||B===A.BACKTRACKING||!P.fragCurrent&&B===A.PARSING)&&(P.fragmentTracker.removeFragment(g),P.state=A.IDLE);return}if("payload"in V&&(P.log("Loaded fragment "+g.sn+" of level "+g.level),P.hls.trigger(k.Events.FRAG_LOADED,V),P.state===A.BACKTRACKING)){P.fragmentTracker.backtrack(g,V),P.resetFragmentLoading(g);return}P._handleFragmentLoadComplete(V)}).catch(function(V){P.warn(V),P.resetFragmentLoading(g)})},h.flushMainBuffer=function(g,b,M){if(M===void 0&&(M=null),!(g-b))return;var P={startOffset:g,endOffset:b,type:M};this.fragLoadError=0,this.hls.trigger(k.Events.BUFFER_FLUSHING,P)},h._loadInitSegment=function(g){var b=this;this._doFragLoad(g).then(function(M){if(!M||b.fragContextChanged(g)||!b.levels)throw new Error("init load aborted");return M}).then(function(M){var P=b.hls,K=M.payload,V=g.decryptdata;if(K&&K.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var B=self.performance.now();return b.decrypter.webCryptoDecrypt(new Uint8Array(K),V.key.buffer,V.iv.buffer).then(function(C){var $=self.performance.now();return P.trigger(k.Events.FRAG_DECRYPTED,{frag:g,payload:C,stats:{tstart:B,tdecrypt:$}}),M.payload=C,M})}return M}).then(function(M){var P=b.fragCurrent,K=b.hls,V=b.levels;if(!V)throw new Error("init load aborted, missing levels");var B=V[g.level].details;console.assert(B,"Level details are defined when init segment is loaded");var C=g.stats;b.state=A.IDLE,b.fragLoadError=0,g.data=new Uint8Array(M.payload),C.parsing.start=C.buffering.start=self.performance.now(),C.parsing.end=C.buffering.end=self.performance.now(),M.frag===P&&K.trigger(k.Events.FRAG_BUFFERED,{stats:C,frag:P,part:null,id:g.type}),b.tick()}).catch(function(M){b.warn(M),b.resetFragmentLoading(g)})},h.fragContextChanged=function(g){var b=this.fragCurrent;return!g||!b||g.level!==b.level||g.sn!==b.sn||g.urlId!==b.urlId},h.fragBufferedComplete=function(g,b){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(b?" part: "+b.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+s.default.toString(W.BufferHelper.getBuffered(M))),this.state=A.IDLE,this.tick()},h._handleFragmentLoadComplete=function(g){var b=this.transmuxer;if(!b)return;var M=g.frag,P=g.part,K=g.partsLoaded,V=!K||K.length===0||K.some(function(C){return!C}),B=new m.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,P?P.index:-1,!V);b.flush(B)},h._handleFragmentLoadProgress=function(g){},h._doFragLoad=function(g,b,M,P){var K=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(g.start,M||0),this.config.lowLatencyMode&&b){var V=b.partList;if(V&&P){M>g.end&&b.fragmentHint&&(g=b.fragmentHint);var B=this.getNextPart(V,g,M);if(B>-1){var C=V[B];return this.log("Loading part sn: "+g.sn+" p: "+C.index+" cc: "+g.cc+" of playlist ["+b.startSN+"-"+b.endSN+"] parts [0-"+B+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=C.start+C.duration,this.state=A.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:g,part:V[B],targetBufferTime:M}),this.doFragPartsLoad(g,V,B,P).catch(function($){return K.handleFragLoadError($)})}else if(!g.url||this.loadedEndOfParts(V,M))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(b?"of ["+b.startSN+"-"+b.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(M.toFixed(3))),Object(Y.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=A.FRAG_LOADING,this.hls.trigger(k.Events.FRAG_LOADING,{frag:g,targetBufferTime:M}),this.fragmentLoader.load(g,P).catch(function($){return K.handleFragLoadError($)})},h.doFragPartsLoad=function(g,b,M,P){var K=this;return new Promise(function(V,B){var C=[],$=function ee(re){var ue=b[re];K.fragmentLoader.loadPart(g,ue,P).then(function(Te){C[ue.index]=Te;var ye=Te.part;K.hls.trigger(k.Events.FRAG_LOADED,Te);var be=b[re+1];if(be&&be.fragment===g)ee(re+1);else return V({frag:g,part:ye,partsLoaded:C})}).catch(B)};$(M)})},h.handleFragLoadError=function(g){var b=g.data;return b&&b.details===I.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(b.frag,b.part):this.hls.trigger(k.Events.ERROR,b),null},h._handleTransmuxerFlush=function(g){var b=this.getCurrentContext(g);if(!b||this.state!==A.PARSING){this.fragCurrent||(this.state=A.IDLE);return}var M=b.frag,P=b.part,K=b.level,V=self.performance.now();M.stats.parsing.end=V,P&&(P.stats.parsing.end=V),this.updateLevelTiming(M,P,K,g.partial)},h.getCurrentContext=function(g){var b=this.levels,M=g.level,P=g.sn,K=g.part;if(!b||!b[M])return this.warn("Levels object was unset while buffering fragment "+P+" of level "+M+". The current chunk will not be buffered."),null;var V=b[M],B=K>-1?Object(r.getPartWith)(V,P,K):null,C=B?B.fragment:Object(r.getFragmentWithSN)(V,P,this.fragCurrent);return C?{frag:C,part:B,level:V}:null},h.bufferFragmentData=function(g,b,M,P){if(!g||this.state!==A.PARSING)return;var K=g.data1,V=g.data2,B=K;if(K&&V&&(B=Object(c.appendUint8Array)(K,V)),!B||!B.length)return;var C={type:g.type,frag:b,part:M,chunkMeta:P,parent:b.type,data:B};this.hls.trigger(k.Events.BUFFER_APPENDING,C),g.dropped&&g.independent&&!M&&this.flushBufferGap(b)},h.flushBufferGap=function(g){var b=this.media;if(!b)return;if(!W.BufferHelper.isBuffered(b,b.currentTime)){this.flushMainBuffer(0,g.start);return}var M=b.currentTime,P=W.BufferHelper.bufferInfo(b,M,0),K=g.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),B=Math.max(Math.min(g.start-V,P.end-V),M+V);g.start-B>V&&this.flushMainBuffer(B,g.start)},h.getFwdBufferInfo=function(g,b){var M=this.config,P=this.getLoadPosition();if(!Object(Y.isFiniteNumber)(P))return null;var K=W.BufferHelper.bufferInfo(g,P,M.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(P,b);if(V&&K.nextStart=M?(b.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+b.maxMaxBufferLength+"s"),!0):!1},h.getNextFragment=function(g,b){var M,P,K=b.fragments,V=K.length;if(!V)return null;var B=this.config,C=K[0].start,$;if(b.live){var ee=B.initialLiveManifestSize;if(V-1&&M<$.start)break;var ee=$.loaded;!ee&&(K||$.independent||V)&&$.fragment===b&&(P=B),K=ee}return P},h.loadedEndOfParts=function(g,b){var M=g[g.length-1];return M&&b>M.start&&M.loaded},h.getInitialLiveFragment=function(g,b){var M=this.fragPrevious,P=null;if(M){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),P=Object(u.findFragmentByPDT)(b,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!P){var K=M.sn+1;if(K>=g.startSN&&K<=g.endSN){var V=b[K-g.startSN];M.cc===V.cc&&(P=V,this.log("Live playlist, switching playlist, load frag with next SN: "+P.sn))}P||(P=Object(u.findFragWithCC)(b,M.cc),P&&this.log("Live playlist, switching playlist, load frag with same CC: "+P.sn))}}else{var B=this.hls.liveSyncPosition;B!==null&&(P=this.getFragmentAtPosition(B,this.bitrateTest?g.fragmentEnd:g.edge,g))}return P},h.getFragmentAtPosition=function(g,b,M){var P=this.config,K=this.fragPrevious,V=M.fragments,B=M.endSN,C=M.fragmentHint,$=P.maxFragLookUpTolerance,ee=!!(P.lowLatencyMode&&M.partList&&C);ee&&C&&!this.bitrateTest&&(V=V.concat(C),B=C.sn);var re;if(gb-$?0:$;re=Object(u.findFragmentByPTS)(K,V,g,ue)}else re=V[V.length-1];if(re){var Te=re.sn-M.startSN,ye=K&&re.level===K.level,be=V[Te+1],we=this.fragmentTracker.getState(re);if(we===U.FragmentState.BACKTRACKED){re=null;for(var xe=Te;V[xe]&&this.fragmentTracker.getState(V[xe])===U.FragmentState.BACKTRACKED;)K?re=V[xe--]:re=V[--xe];re||(re=be)}else K&&re.sn===K.sn&&!ee&&(ye&&(re.sn=V-b.maxFragLookUpTolerance&&K<=B;if(P!==null&&M.duration>P&&(K"+g.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+B),re}return C},h.waitForCdnTuneIn=function(g){var b=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*b)},h.setStartPosition=function(g,b){var M=this.startPosition;if(M"+g))}}]),y}(F.default)},"./src/controller/buffer-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return u});var Y=D("./src/polyfills/number.ts"),F=D("./src/events.ts"),U=D("./src/utils/logger.ts"),W=D("./src/errors.ts"),j=D("./src/utils/buffer-helper.ts"),k=D("./src/utils/mediasource-helper.ts"),I=D("./src/loader/fragment.ts"),m=D("./src/controller/buffer-operation-queue.ts"),c=Object(k.getMediaSource)(),f=/([ha]vc.)(?:\.[^.,]+)+/,u=function(){function r(o){var s=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=s.hls,p=s.media,R=s.mediaSource;U.logger.log("[buffer-controller]: Media source opened"),p&&(s.updateMediaElementDuration(),l.trigger(F.Events.MEDIA_ATTACHED,{media:p})),R&&R.removeEventListener("sourceopen",s._onMediaSourceOpen),s.checkPendingTracks()},this._onMediaSourceClose=function(){U.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){U.logger.log("[buffer-controller]: Media source ended")},this.hls=o,this._initSourceBuffer(),this.registerListeners()}var d=r.prototype;return d.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},d.destroy=function(){this.unregisterListeners(),this.details=null},d.registerListeners=function(){var s=this.hls;s.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(F.Events.BUFFER_RESET,this.onBufferReset,this),s.on(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),s.on(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.on(F.Events.BUFFER_EOS,this.onBufferEos,this),s.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),s.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),s.on(F.Events.FRAG_PARSED,this.onFragParsed,this),s.on(F.Events.FRAG_CHANGED,this.onFragChanged,this)},d.unregisterListeners=function(){var s=this.hls;s.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(F.Events.BUFFER_RESET,this.onBufferReset,this),s.off(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),s.off(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),s.off(F.Events.BUFFER_EOS,this.onBufferEos,this),s.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),s.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),s.off(F.Events.FRAG_PARSED,this.onFragParsed,this),s.off(F.Events.FRAG_CHANGED,this.onFragChanged,this)},d._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new m.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},d.onManifestParsed=function(s,l){var p=2;(l.audio&&!l.video||!l.altAudio)&&(p=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=p,this.details=null,U.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},d.onMediaAttaching=function(s,l){var p=this.media=l.media;if(p&&c){var R=this.mediaSource=new c;R.addEventListener("sourceopen",this._onMediaSourceOpen),R.addEventListener("sourceended",this._onMediaSourceEnded),R.addEventListener("sourceclose",this._onMediaSourceClose),p.src=self.URL.createObjectURL(R),this._objectUrl=p.src}},d.onMediaDetaching=function(){var s=this.media,l=this.mediaSource,p=this._objectUrl;if(l){if(U.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(R){U.logger.warn("[buffer-controller]: onMediaDetaching: "+R.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),s&&(p&&self.URL.revokeObjectURL(p),s.src===p?(s.removeAttribute("src"),s.load()):U.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(F.Events.MEDIA_DETACHED,void 0)},d.onBufferReset=function(){var s=this;this.getSourceBufferTypes().forEach(function(l){var p=s.sourceBuffer[l];try{p&&(s.removeBufferListeners(l),s.mediaSource&&s.mediaSource.removeSourceBuffer(p),s.sourceBuffer[l]=void 0)}catch(R){U.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",R)}}),this._initSourceBuffer()},d.onBufferCodecs=function(s,l){var p=this,R=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(w){if(R){var x=p.tracks[w];if(x&&typeof x.buffer.changeType=="function"){var O=l[w],A=O.codec,T=O.levelCodec,E=O.container,y=(x.levelCodec||x.codec).replace(f,"$1"),h=(T||A).replace(f,"$1");if(y!==h){var _=E+";codecs="+(T||A);p.appendChangeType(w,_)}}}else p.pendingTracks[w]=l[w]}),R)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},d.appendChangeType=function(s,l){var p=this,R=this.operationQueue,w={execute:function(){var O=p.sourceBuffer[s];O&&(U.logger.log("[buffer-controller]: changing "+s+" sourceBuffer type to "+l),O.changeType(l)),R.shiftAndExecuteNext(s)},onStart:function(){},onComplete:function(){},onError:function(O){U.logger.warn("[buffer-controller]: Failed to change "+s+" SourceBuffer type",O)}};R.append(w,s)},d.onBufferAppending=function(s,l){var p=this,R=this.hls,w=this.operationQueue,x=this.tracks,O=l.data,A=l.type,T=l.frag,E=l.part,y=l.chunkMeta,h=y.buffering[A],_=self.performance.now();h.start=_;var g=T.stats.buffering,b=E?E.stats.buffering:null;g.start===0&&(g.start=_),b&&b.start===0&&(b.start=_);var M=x.audio,P=A==="audio"&&y.id===1&&(M==null?void 0:M.container)==="audio/mpeg",K={execute:function(){if(h.executeStart=self.performance.now(),P){var B=p.sourceBuffer[A];if(B){var C=T.start-B.timestampOffset;Math.abs(C)>=.1&&(U.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+T.start+" (delta: "+C+") sn: "+T.sn+")"),B.timestampOffset=T.start)}}p.appendExecutor(O,A)},onStart:function(){},onComplete:function(){var B=self.performance.now();h.executeEnd=h.end=B,g.first===0&&(g.first=B),b&&b.first===0&&(b.first=B);var C=p.sourceBuffer,$={};for(var ee in C)$[ee]=j.BufferHelper.getBuffered(C[ee]);p.appendError=0,p.hls.trigger(F.Events.BUFFER_APPENDED,{type:A,frag:T,part:E,chunkMeta:y,parent:T.type,timeRanges:$})},onError:function(B){U.logger.error("[buffer-controller]: Error encountered while trying to append to the "+A+" SourceBuffer",B);var C={type:W.ErrorTypes.MEDIA_ERROR,parent:T.type,details:W.ErrorDetails.BUFFER_APPEND_ERROR,err:B,fatal:!1};B.code===DOMException.QUOTA_EXCEEDED_ERR?C.details=W.ErrorDetails.BUFFER_FULL_ERROR:(p.appendError++,C.details=W.ErrorDetails.BUFFER_APPEND_ERROR,p.appendError>R.config.appendErrorMaxRetry&&(U.logger.error("[buffer-controller]: Failed "+R.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),C.fatal=!0)),R.trigger(F.Events.ERROR,C)}};w.append(K,A)},d.onBufferFlushing=function(s,l){var p=this,R=this.operationQueue,w=function(O){return{execute:p.removeExecutor.bind(p,O,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){p.hls.trigger(F.Events.BUFFER_FLUSHED,{type:O})},onError:function(T){U.logger.warn("[buffer-controller]: Failed to remove from "+O+" SourceBuffer",T)}}};l.type?R.append(w(l.type),l.type):this.getSourceBufferTypes().forEach(function(x){R.append(w(x),x)})},d.onFragParsed=function(s,l){var p=this,R=l.frag,w=l.part,x=[],O=w?w.elementaryStreams:R.elementaryStreams;O[I.ElementaryStreamTypes.AUDIOVIDEO]?x.push("audiovideo"):(O[I.ElementaryStreamTypes.AUDIO]&&x.push("audio"),O[I.ElementaryStreamTypes.VIDEO]&&x.push("video"));var A=function(){var E=self.performance.now();R.stats.buffering.end=E,w&&(w.stats.buffering.end=E);var y=w?w.stats:R.stats;p.hls.trigger(F.Events.FRAG_BUFFERED,{frag:R,part:w,stats:y,id:R.type})};x.length===0&&U.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+R.type+" level: "+R.level+" sn: "+R.sn),this.blockBuffers(A,x)},d.onFragChanged=function(s,l){this.flushBackBuffer()},d.onBufferEos=function(s,l){var p=this,R=this.getSourceBufferTypes().reduce(function(w,x){var O=p.sourceBuffer[x];return(!l.type||l.type===x)&&(O&&!O.ended&&(O.ended=!0,U.logger.log("[buffer-controller]: "+x+" sourceBuffer now EOS"))),w&&!!(!O||O.ended)},!0);R&&this.blockBuffers(function(){var w=p.mediaSource;if(!w||w.readyState!=="open")return;w.endOfStream()})},d.onLevelUpdated=function(s,l){var p=l.details;if(!p.fragments.length)return;this.details=p,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},d.flushBackBuffer=function(){var s=this.hls,l=this.details,p=this.media,R=this.sourceBuffer;if(!p||l===null)return;var w=this.getSourceBufferTypes();if(!w.length)return;var x=l.live&&s.config.liveBackBufferLength!==null?s.config.liveBackBufferLength:s.config.backBufferLength;if(!Object(Y.isFiniteNumber)(x)||x<0)return;var O=p.currentTime,A=l.levelTargetDuration,T=Math.max(x,A),E=Math.floor(O/A)*A-T;w.forEach(function(y){var h=R[y];if(h){var _=j.BufferHelper.getBuffered(h);_.length>0&&E>_.start(0)&&(s.trigger(F.Events.BACK_BUFFER_REACHED,{bufferEnd:E}),l.live&&s.trigger(F.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:E}),s.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:E,type:y}))}})},d.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var s=this.details,l=this.hls,p=this.media,R=this.mediaSource,w=s.fragments[0].start+s.totalduration,x=p.duration,O=Object(Y.isFiniteNumber)(R.duration)?R.duration:0;s.live&&l.config.liveDurationInfinity?(U.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),R.duration=Infinity,this.updateSeekableRange(s)):(w>O&&w>x||!Object(Y.isFiniteNumber)(x))&&(U.logger.log("[buffer-controller]: Updating Media Source duration to "+w.toFixed(3)),R.duration=w)},d.updateSeekableRange=function(s){var l=this.mediaSource,p=s.fragments,R=p.length;if(R&&s.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var w=Math.max(0,p[0].start),x=Math.max(w,w+s.totalduration);l.setLiveSeekableRange(w,x)}},d.checkPendingTracks=function(){var s=this.bufferCodecEventsExpected,l=this.operationQueue,p=this.pendingTracks,R=Object.keys(p).length;if(R&&!s||R===2){this.createSourceBuffers(p),this.pendingTracks={};var w=this.getSourceBufferTypes();if(w.length===0){this.hls.trigger(F.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}w.forEach(function(x){l.executeNext(x)})}},d.createSourceBuffers=function(s){var l=this.sourceBuffer,p=this.mediaSource;if(!p)throw Error("createSourceBuffers called when mediaSource was null");var R=0;for(var w in s)if(!l[w]){var x=s[w];if(!x)throw Error("source buffer exists for track "+w+", however track does not");var O=x.levelCodec||x.codec,A=x.container+";codecs="+O;U.logger.log("[buffer-controller]: creating sourceBuffer("+A+")");try{var T=l[w]=p.addSourceBuffer(A),E=w;this.addBufferListener(E,"updatestart",this._onSBUpdateStart),this.addBufferListener(E,"updateend",this._onSBUpdateEnd),this.addBufferListener(E,"error",this._onSBUpdateError),this.tracks[w]={buffer:T,codec:O,container:x.container,levelCodec:x.levelCodec,id:x.id},R++}catch(y){U.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+y.message),this.hls.trigger(F.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:y,mimeType:A})}}R&&this.hls.trigger(F.Events.BUFFER_CREATED,{tracks:this.tracks})},d._onSBUpdateStart=function(s){var l=this.operationQueue,p=l.current(s);p.onStart()},d._onSBUpdateEnd=function(s){var l=this.operationQueue,p=l.current(s);p.onComplete(),l.shiftAndExecuteNext(s)},d._onSBUpdateError=function(s,l){U.logger.error("[buffer-controller]: "+s+" SourceBuffer error",l),this.hls.trigger(F.Events.ERROR,{type:W.ErrorTypes.MEDIA_ERROR,details:W.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var p=this.operationQueue.current(s);p&&p.onError(l)},d.removeExecutor=function(s,l,p){var R=this.media,w=this.mediaSource,x=this.operationQueue,O=this.sourceBuffer,A=O[s];if(!R||!w||!A){U.logger.warn("[buffer-controller]: Attempting to remove from the "+s+" SourceBuffer, but it does not exist"),x.shiftAndExecuteNext(s);return}var T=Object(Y.isFiniteNumber)(R.duration)?R.duration:Infinity,E=Object(Y.isFiniteNumber)(w.duration)?w.duration:Infinity,y=Math.max(0,l),h=Math.min(p,T,E);h>y?(U.logger.log("[buffer-controller]: Removing ["+y+","+h+"] from the "+s+" SourceBuffer"),console.assert(!A.updating,s+" sourceBuffer must not be updating"),A.remove(y,h)):x.shiftAndExecuteNext(s)},d.appendExecutor=function(s,l){var p=this.operationQueue,R=this.sourceBuffer,w=R[l];if(!w){U.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(l);return}w.ended=!1,console.assert(!w.updating,l+" sourceBuffer must not be updating"),w.appendBuffer(s)},d.blockBuffers=function(s,l){var p=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){U.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(s);return}var R=this.operationQueue,w=l.map(function(x){return R.appendBlocker(x)});Promise.all(w).then(function(){s(),l.forEach(function(x){var O=p.sourceBuffer[x];(!O||!O.updating)&&R.shiftAndExecuteNext(x)})})},d.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},d.addBufferListener=function(s,l,p){var R=this.sourceBuffer[s];if(!R)return;var w=p.bind(this,s);this.listeners[s].push({event:l,listener:w}),R.addEventListener(l,w)},d.removeBufferListeners=function(s){var l=this.sourceBuffer[s];if(!l)return;this.listeners[s].forEach(function(p){l.removeEventListener(p.event,p.listener)})},r}()},"./src/controller/buffer-operation-queue.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return F});var Y=D("./src/utils/logger.ts"),F=function(){function U(j){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=j}var W=U.prototype;return W.append=function(k,I){var m=this.queues[I];m.push(k),m.length===1&&this.buffers[I]&&this.executeNext(I)},W.insertAbort=function(k,I){var m=this.queues[I];m.unshift(k),this.executeNext(I)},W.appendBlocker=function(k){var I,m=new Promise(function(f){I=f}),c={execute:I,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(c,k),m},W.executeNext=function(k){var I=this.buffers,m=this.queues,c=I[k],f=m[k];if(f.length){var u=f[0];try{u.execute()}catch(r){Y.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),u.onError(r),(!c||!c.updating)&&(f.shift(),this.executeNext(k))}}},W.shiftAndExecuteNext=function(k){this.queues[k].shift(),this.executeNext(k)},W.current=function(k){return this.queues[k][0]},U}()},"./src/controller/cap-level-controller.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/events.ts");function F(j,k){for(var I=0;I0&&this.mediaWidth>0){var m=this.hls.levels;if(m.length){var c=this.hls;c.autoLevelCapping=this.getMaxLevel(m.length-1),c.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=c.autoLevelCapping}}},k.getMaxLevel=function(m){var c=this,f=this.hls.levels;if(!f.length)return-1;var u=f.filter(function(r,d){return j.isLevelAllowed(d,c.restrictedLevels)&&d<=m});return this.clientRect=null,j.getMaxLevelByMediaSize(u,this.mediaWidth,this.mediaHeight)},k.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()},k.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},k.getDimensions=function(){if(this.clientRect)return this.clientRect;var m=this.media,c={width:0,height:0};if(m){var f=m.getBoundingClientRect();c.width=f.width,c.height=f.height,!c.width&&!c.height&&(c.width=f.right-f.left||m.width||0,c.height=f.bottom-f.top||m.height||0)}return this.clientRect=c,c},j.isLevelAllowed=function(m,c){return c===void 0&&(c=[]),c.indexOf(m)===-1},j.getMaxLevelByMediaSize=function(m,c,f){if(!m||!m.length)return-1;for(var u=function(l,p){return p?l.width!==p.width||l.height!==p.height:!0},r=m.length-1,d=0;d=c||o.height>=f)&&u(o,m[d+1])){r=d;break}}return r},U(j,[{key:"mediaWidth",get:function(){return this.getDimensions().width*j.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*j.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var m=1;try{m=self.devicePixelRatio}catch(c){}return m}}]),j}();J.default=W},"./src/controller/cmcd-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return u});var Y=D("./src/events.ts"),F=D("./src/types/cmcd.ts"),U=D("./src/utils/buffer-helper.ts"),W=D("./src/utils/logger.ts");function j(r,d){for(var o=0;o=r.length?{done:!0}:{done:!1,value:r[s++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function m(r,d){if(!r)return;if(typeof r=="string")return c(r,d);var o=Object.prototype.toString.call(r).slice(8,-1);if(o==="Object"&&r.constructor&&(o=r.constructor.name),o==="Map"||o==="Set")return Array.from(r);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return c(r,d)}function c(r,d){(d==null||d>r.length)&&(d=r.length);for(var o=0,s=new Array(d);ol&&(l=x.bitrate)}return l>0?l:NaN},d.getBufferLength=function(s){var l=this.hls.media,p=s===F.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!p||!l)return NaN;var R=U.BufferHelper.bufferInfo(p,l.currentTime,this.config.maxBufferHole);return R.len*1e3},d.createPlaylistLoader=function(){var s=this.config.pLoader,l=this.applyPlaylistData,p=s||this.config.loader;return function(){function R(x){this.loader=void 0,this.loader=new p(x)}var w=R.prototype;return w.destroy=function(){this.loader.destroy()},w.abort=function(){this.loader.abort()},w.load=function(O,A,T){l(O),this.loader.load(O,A,T)},k(R,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),R}()},d.createFragmentLoader=function(){var s=this.config.fLoader,l=this.applyFragmentData,p=s||this.config.loader;return function(){function R(x){this.loader=void 0,this.loader=new p(x)}var w=R.prototype;return w.destroy=function(){this.loader.destroy()},w.abort=function(){this.loader.abort()},w.load=function(O,A,T){l(O),this.loader.load(O,A,T)},k(R,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),R}()},r.uuid=function(){var s=URL.createObjectURL(new Blob),l=s.toString();return URL.revokeObjectURL(s),l.substr(l.lastIndexOf("/")+1)},r.serialize=function(s){for(var l=[],p=function(P){return!Number.isNaN(P)&&P!=null&&P!==""&&P!==!1},R=function(P){return Math.round(P)},w=function(P){return R(P/100)*100},x=function(P){return encodeURIComponent(P)},O={br:R,d:R,bl:w,dl:w,mtp:w,nor:x,rtp:w,tb:R},A=Object.keys(s||{}).sort(),T=I(A),E;!(E=T()).done;){var y=E.value,h=s[y];if(!p(h))continue;if(y==="v"&&h===1)continue;if(y=="pr"&&h===1)continue;var _=O[y];_&&(h=_(h));var g=typeof h,b=void 0;y==="ot"||y==="sf"||y==="st"?b=y+"="+h:g==="boolean"?b=y:g==="number"?b=y+"="+h:b=y+"="+JSON.stringify(h),l.push(b)}return l.join(",")},r.toHeaders=function(s){for(var l=Object.keys(s),p={},R=["Object","Request","Session","Status"],w=[{},{},{},{}],x={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},O=0,A=l;OI){this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var x=I-this._requestLicenseFailureCount+1;U.logger.warn("Retrying license request, "+x+" attempts left"),this._requestLicense(l,p)}break}},r._generateLicenseRequestChallenge=function(o,s){switch(o.mediaKeySystemDomain){case W.KeySystems.WIDEVINE:return s}throw new Error("unsupported key-system: "+o.mediaKeySystemDomain)},r._requestLicense=function(o,s){U.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){U.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var p=this.getLicenseServerUrl(l.mediaKeySystemDomain),R=this._createLicenseXhr(p,o,s);U.logger.log("Sending license request to URL: "+p);var w=this._generateLicenseRequestChallenge(l,o);R.send(w)}catch(x){U.logger.error("Failure requesting DRM license: "+x),this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},r.onMediaAttached=function(o,s){if(!this._emeEnabled)return;var l=s.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},r.onMediaDetached=function(){var o=this._media,s=this._mediaKeysList;if(!o)return;o.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(s.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return o.setMediaKeys(null)}).catch(function(){})},r.onManifestParsed=function(o,s){if(!this._emeEnabled)return;var l=s.levels.map(function(R){return R.audioCodec}).filter(function(R){return!!R}),p=s.levels.map(function(R){return R.videoCodec}).filter(function(R){return!!R});this._attemptKeySystemAccess(W.KeySystems.WIDEVINE,l,p)},k(u,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),u}();J.default=f},"./src/controller/fps-controller.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/events.ts"),F=D("./src/utils/logger.ts"),U=function(){function W(k){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=k,this.registerListeners()}var j=W.prototype;return j.setStreamController=function(I){this.streamController=I},j.registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},j.unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching)},j.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},j.onMediaAttaching=function(I,m){var c=this.hls.config;if(c.capLevelOnFPSDrop){var f=m.media instanceof self.HTMLVideoElement?m.media:null;this.media=f,f&&typeof f.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),c.fpsDroppedMonitoringPeriod)}},j.checkFPS=function(I,m,c){var f=performance.now();if(m){if(this.lastTime){var u=f-this.lastTime,r=c-this.lastDroppedFrames,d=m-this.lastDecodedFrames,o=1e3*r/u,s=this.hls;if(s.trigger(Y.Events.FPS_DROP,{currentDropped:r,currentDecoded:d,totalDroppedFrames:c}),o>0&&r>s.config.fpsDroppedMonitoringThreshold*d){var l=s.currentLevel;F.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(s.autoLevelCapping===-1||s.autoLevelCapping>=l)&&(l=l-1,s.trigger(Y.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:s.currentLevel}),s.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=f,this.lastDroppedFrames=c,this.lastDecodedFrames=m}},j.checkFPSInterval=function(){var I=this.media;if(I)if(this.isVideoPlaybackQualityAvailable){var m=I.getVideoPlaybackQuality();this.checkFPS(I,m.totalVideoFrames,m.droppedVideoFrames)}else this.checkFPS(I,I.webkitDecodedFrameCount,I.webkitDroppedFrameCount)},W}();J.default=U},"./src/controller/fragment-finders.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"findFragmentByPDT",function(){return U}),D.d(J,"findFragmentByPTS",function(){return W}),D.d(J,"fragmentWithinToleranceTest",function(){return j}),D.d(J,"pdtWithinToleranceTest",function(){return k}),D.d(J,"findFragWithCC",function(){return I});var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/binary-search.ts");function U(m,c,f){if(c===null||!Array.isArray(m)||!m.length||!Object(Y.isFiniteNumber)(c))return null;var u=m[0].programDateTime;if(c<(u||0))return null;var r=m[m.length-1].endProgramDateTime;if(c>=(r||0))return null;f=f||0;for(var d=0;dm&&f.start?-1:0}function k(m,c,f){var u=Math.min(c,f.duration+(f.deltaPTS?f.deltaPTS:0))*1e3,r=f.endProgramDateTime||0;return r-u>m}function I(m,c){return F.default.search(m,function(f){return f.ccc?-1:0})}},"./src/controller/fragment-tracker.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"FragmentState",function(){return U}),D.d(J,"FragmentTracker",function(){return W});var Y=D("./src/events.ts"),F=D("./src/types/loader.ts"),U;(function(I){I.NOT_LOADED="NOT_LOADED",I.BACKTRACKED="BACKTRACKED",I.APPENDING="APPENDING",I.PARTIAL="PARTIAL",I.OK="OK"})(U||(U={}));var W=function(){function I(c){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=c,this._registerListeners()}var m=I.prototype;return m._registerListeners=function(){var f=this.hls;f.on(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.on(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.on(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},m._unregisterListeners=function(){var f=this.hls;f.off(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.off(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.off(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},m.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},m.getAppendedFrag=function(f,u){if(u===F.PlaylistLevelType.MAIN){var r=this.activeFragment,d=this.activeParts;if(!r)return null;if(d)for(var o=d.length;o--;){var s=d[o],l=s?s.end:r.appendedPTS;if(s.start<=f&&l!==void 0&&f<=l)return o>9&&(this.activeParts=d.slice(o-9)),s}else if(r.start<=f&&r.appendedPTS!==void 0&&f<=r.appendedPTS)return r}return this.getBufferedFrag(f,u)},m.getBufferedFrag=function(f,u){for(var r=this.fragments,d=Object.keys(r),o=d.length;o--;){var s=r[d[o]];if((s==null?void 0:s.body.type)===u&&s.buffered){var l=s.body;if(l.start<=f&&f<=l.end)return l}}return null},m.detectEvictedFragments=function(f,u,r){var d=this;Object.keys(this.fragments).forEach(function(o){var s=d.fragments[o];if(!s)return;if(!s.buffered){s.body.type===r&&d.removeFragment(s.body);return}var l=s.range[f];if(!l)return;l.time.some(function(p){var R=!d.isTimeBuffered(p.startPTS,p.endPTS,u);return R&&d.removeFragment(s.body),R})})},m.detectPartialFragments=function(f){var u=this,r=this.timeRanges,d=f.frag,o=f.part;if(!r||d.sn==="initSegment")return;var s=k(d),l=this.fragments[s];if(!l)return;Object.keys(r).forEach(function(p){var R=d.elementaryStreams[p];if(!R)return;var w=r[p],x=o!==null||R.partial===!0;l.range[p]=u.getBufferedTimes(d,o,x,w)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},m.fragBuffered=function(f){var u=k(f),r=this.fragments[u];r&&(r.backtrack=r.loaded=null,r.buffered=!0)},m.getBufferedTimes=function(f,u,r,d){for(var o={time:[],partial:r},s=u?u.start:f.start,l=u?u.end:f.end,p=f.minEndPTS||l,R=f.maxStartPTS||s,w=0;w=x&&p<=O){o.time.push({startPTS:Math.max(s,d.start(w)),endPTS:Math.min(l,d.end(w))});break}else if(sx)o.partial=!0,o.time.push({startPTS:Math.max(s,d.start(w)),endPTS:Math.min(l,d.end(w))});else if(l<=x)break}return o},m.getPartialFragment=function(f){var u=null,r,d,o,s=0,l=this.bufferPadding,p=this.fragments;return Object.keys(p).forEach(function(R){var w=p[R];if(!w)return;j(w)&&(d=w.body.start-l,o=w.body.end+l,f>=d&&f<=o&&(r=Math.min(f-d,o-f),s<=r&&(u=w.body,s=r)))}),u},m.getState=function(f){var u=k(f),r=this.fragments[u];return r?r.buffered?j(r)?U.PARTIAL:U.OK:r.backtrack?U.BACKTRACKED:U.APPENDING:U.NOT_LOADED},m.backtrack=function(f,u){var r=k(f),d=this.fragments[r];if(!d||d.backtrack)return null;var o=d.backtrack=u||d.loaded;return d.loaded=null,o},m.getBacktrackData=function(f){var u=k(f),r=this.fragments[u];if(r){var d,o=r.backtrack;if(o!=null&&(d=o.payload)!==null&&d!==void 0&&d.byteLength)return o;this.removeFragment(f)}return null},m.isTimeBuffered=function(f,u,r){for(var d,o,s=0;s=d&&u<=o)return!0;if(u<=d)return!1}return!1},m.onFragLoaded=function(f,u){var r=u.frag,d=u.part;if(r.sn==="initSegment"||r.bitrateTest||d)return;var o=k(r);this.fragments[o]={body:r,loaded:u,backtrack:null,buffered:!1,range:Object.create(null)}},m.onBufferAppended=function(f,u){var r=this,d=u.frag,o=u.part,s=u.timeRanges;if(d.type===F.PlaylistLevelType.MAIN)if(this.activeFragment=d,o){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(o)}else this.activeParts=null;this.timeRanges=s,Object.keys(s).forEach(function(p){var R=s[p];if(r.detectEvictedFragments(p,R),!o)for(var w=0;wf&&d.removeFragment(l)}})},m.removeFragment=function(f){var u=k(f);f.stats.loaded=0,f.clearElementaryStreamInfo(),delete this.fragments[u]},m.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},I}();function j(I){var m,c;return I.buffered&&(((m=I.range.video)===null||m===void 0?void 0:m.partial)||((c=I.range.audio)===null||c===void 0?void 0:c.partial))}function k(I){return I.type+"_"+I.level+"_"+I.urlId+"_"+I.sn}},"./src/controller/gap-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"STALL_MINIMUM_DURATION_MS",function(){return j}),D.d(J,"MAX_START_GAP_JUMP",function(){return k}),D.d(J,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return I}),D.d(J,"SKIP_BUFFER_RANGE_START",function(){return m}),D.d(J,"default",function(){return c});var Y=D("./src/utils/buffer-helper.ts"),F=D("./src/errors.ts"),U=D("./src/events.ts"),W=D("./src/utils/logger.ts"),j=250,k=2,I=.1,m=.05,c=function(){function f(r,d,o,s){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=r,this.media=d,this.fragmentTracker=o,this.hls=s}var u=f.prototype;return u.destroy=function(){this.hls=this.fragmentTracker=this.media=null},u.poll=function(d){var o=this.config,s=this.media,l=this.stalled,p=s.currentTime,R=s.seeking,w=this.seeking&&!R,x=!this.seeking&&R;if(this.seeking=R,p!==d){if(this.moved=!0,l!==null){if(this.stallReported){var O=self.performance.now()-l;W.logger.warn("playback not stuck anymore @"+p+", after "+Math.round(O)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((x||w)&&(this.stalled=null),s.paused||s.ended||s.playbackRate===0||!Y.BufferHelper.getBuffered(s).length)return;var A=Y.BufferHelper.bufferInfo(s,p,0),T=A.len>0,E=A.nextStart||0;if(!T&&!E)return;if(R){var y=A.len>k,h=!E||E-p>k&&!this.fragmentTracker.getPartialFragment(p);if(y||h)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var _,g=Math.max(E,A.start||0)-p,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=b==null||((_=b.details)===null||_===void 0)?void 0:_.live,P=M?b.details.targetduration*2:k;if(g>0&&g<=P){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(l===null){this.stalled=K;return}var V=K-l;!R&&V>=j&&this._reportStall(A.len);var B=Y.BufferHelper.bufferInfo(s,p,o.maxBufferHole);this._tryFixBufferStall(B,V)},u._tryFixBufferStall=function(d,o){var s=this.config,l=this.fragmentTracker,p=this.media,R=p.currentTime,w=l.getPartialFragment(R);if(w){var x=this._trySkipBufferHole(w);if(x)return}d.len>s.maxBufferHole&&o>s.highBufferWatchdogPeriod*1e3&&(W.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},u._reportStall=function(d){var o=this.hls,s=this.media,l=this.stallReported;l||(this.stallReported=!0,W.logger.warn("Playback stalling at @"+s.currentTime+" due to low buffer (buffer="+d+")"),o.trigger(U.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:d}))},u._trySkipBufferHole=function(d){for(var o=this.config,s=this.hls,l=this.media,p=l.currentTime,R=0,w=Y.BufferHelper.getBuffered(l),x=0;x=R&&p.05&&this.forwardBufferLength>1){var x=Math.min(2,Math.max(1,s)),O=Math.round(2/(1+Math.exp(-.75*p-this.edgeStalled))*20)/20;f.playbackRate=Math.min(x,Math.max(1,O))}else f.playbackRate!==1&&f.playbackRate!==0&&(f.playbackRate=1)},m.estimateLiveEdge=function(){var f=this.levelDetails;return f===null?null:f.edge+f.age},m.computeLatency=function(){var f=this.estimateLiveEdge();return f===null?null:f-this.currentTime},j(I,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var f=this.config,u=this.levelDetails;return f.liveMaxLatencyDuration!==void 0?f.liveMaxLatencyDuration:u?f.liveMaxLatencyDurationCount*u.targetduration:0}},{key:"targetLatency",get:function(){var f=this.levelDetails;if(f===null)return null;var u=f.holdBack,r=f.partHoldBack,d=f.targetduration,o=this.config,s=o.liveSyncDuration,l=o.liveSyncDurationCount,p=o.lowLatencyMode,R=this.hls.userConfig,w=p&&r||u;(R.liveSyncDuration||R.liveSyncDurationCount||w===0)&&(w=s!==void 0?s:l*d);var x=d,O=1;return w+Math.min(this.stallCount*O,x)}},{key:"liveSyncPosition",get:function(){var f=this.estimateLiveEdge(),u=this.targetLatency,r=this.levelDetails;if(f===null||u===null||r===null)return null;var d=r.edge,o=f-u-this.edgeStalled,s=d-r.totalduration,l=d-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(s,o),l)}},{key:"drift",get:function(){var f=this.levelDetails;return f===null?1:f.drift}},{key:"edgeStalled",get:function(){var f=this.levelDetails;if(f===null)return 0;var u=(this.config.lowLatencyMode&&f.partTarget||f.targetduration)*3;return Math.max(f.age-u,0)}},{key:"forwardBufferLength",get:function(){var f=this.media,u=this.levelDetails;if(!f||!u)return 0;var r=f.buffered.length;return r?f.buffered.end(r-1):u.edge-this.currentTime}}]),I}()},"./src/controller/level-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return o});var Y=D("./src/types/level.ts"),F=D("./src/events.ts"),U=D("./src/errors.ts"),W=D("./src/utils/codecs.ts"),j=D("./src/controller/level-helper.ts"),k=D("./src/controller/base-playlist-controller.ts"),I=D("./src/types/loader.ts");function m(){return m=Object.assign||function(s){for(var l=1;l0){E=O[0].bitrate,O.sort(function(V,B){return V.bitrate-B.bitrate}),this._levels=O;for(var M=0;Mthis.hls.config.fragLoadingMaxRetry&&(y=x.frag.level)):y=x.frag.level}break;case U.ErrorDetails.LEVEL_LOAD_ERROR:case U.ErrorDetails.LEVEL_LOAD_TIMEOUT:O&&(O.deliveryDirectives&&(E=!1),y=O.level),T=!0;break;case U.ErrorDetails.REMUX_ALLOC_ERROR:y=x.level,T=!0;break}y!==void 0&&this.recoverLevel(x,y,T,E)},p.recoverLevel=function(w,x,O,A){var T=w.details,E=this._levels[x];if(E.loadError++,O){var y=this.retryLoadingOrFail(w);if(y)w.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(A){var h=E.url.length;if(h>1&&E.loadError1){var A=(x.urlId+1)%O;this.warn("Switching to redundant URL-id "+A),this._levels.forEach(function(T){T.urlId=A}),this.level=w}},p.onFragLoaded=function(w,x){var O=x.frag;if(O!==void 0&&O.type===I.PlaylistLevelType.MAIN){var A=this._levels[O.level];A!==void 0&&(A.fragmentError=0,A.loadError=0)}},p.onLevelLoaded=function(w,x){var O,A=x.level,T=x.details,E=this._levels[A];if(!E){var y;this.warn("Invalid level index "+A),(y=x.deliveryDirectives)!==null&&y!==void 0&&y.skip&&(T.deltaUpdateFailed=!0);return}A===this.currentLevelIndex?(E.fragmentError===0&&(E.loadError=0,this.retryCount=0),this.playlistLoaded(A,x,E.details)):(O=x.deliveryDirectives)!==null&&O!==void 0&&O.skip&&(T.deltaUpdateFailed=!0)},p.onAudioTrackSwitched=function(w,x){var O=this.hls.levels[this.currentLevelIndex];if(!O)return;if(O.audioGroupIds){for(var A=-1,T=this.hls.audioTracks[x.id].groupId,E=0;E0){var A=O.urlId,T=O.url[A];if(w)try{T=w.addDirectives(T)}catch(E){this.warn("Could not construct new URL with HLS Delivery Directives: "+E)}this.log("Attempt loading level index "+x+(w?" at sn "+w.msn+" part "+w.part:"")+" with URL-id "+A+" "+T),this.clearTimer(),this.hls.trigger(F.Events.LEVEL_LOADING,{url:T,level:x,id:A,deliveryDirectives:w||null})}},p.removeLevel=function(w,x){var O=function(E,y){return y!==x},A=this._levels.filter(function(T,E){return E!==w?!0:T.url.length>1&&x!==void 0?(T.url=T.url.filter(O),T.audioGroupIds&&(T.audioGroupIds=T.audioGroupIds.filter(O)),T.textGroupIds&&(T.textGroupIds=T.textGroupIds.filter(O)),T.urlId=0,!0):!1}).map(function(T,E){var y=T.details;return y!=null&&y.fragments&&y.fragments.forEach(function(h){h.level=E}),T});this._levels=A,this.hls.trigger(F.Events.LEVELS_UPDATED,{levels:A})},f(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(w){var x,O=this._levels;if(O.length===0)return;if(this.currentLevelIndex===w&&(x=O[w])!==null&&x!==void 0&&x.details)return;if(w<0||w>=O.length){var A=w<0;if(this.hls.trigger(F.Events.ERROR,{type:U.ErrorTypes.OTHER_ERROR,details:U.ErrorDetails.LEVEL_SWITCH_ERROR,level:w,fatal:A,reason:"invalid level idx"}),A)return;w=Math.min(w,O.length-1)}this.clearTimer();var T=this.currentLevelIndex,E=O[T],y=O[w];this.log("switching to level "+w+" from "+T),this.currentLevelIndex=w;var h=m({},y,{level:w,maxBitrate:y.maxBitrate,uri:y.uri,urlId:y.urlId});delete h._urlId,this.hls.trigger(F.Events.LEVEL_SWITCHING,h);var _=y.details;if(!_||_.live){var g=this.switchParams(y.uri,E==null?void 0:E.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(w){this.manualLevelIndex=w,this._startLevel===void 0&&(this._startLevel=w),w!==-1&&(this.level=w)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(w){this._firstLevel=w}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var w=this.hls.config.startLevel;return w!==void 0?w:this._firstLevel}else return this._startLevel},set:function(w){this._startLevel=w}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(w){this.level=w,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=w)}}]),l}(k.default)},"./src/controller/level-helper.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"addGroupId",function(){return U}),D.d(J,"assignTrackIdsByGroup",function(){return W}),D.d(J,"updatePTS",function(){return j}),D.d(J,"updateFragPTSDTS",function(){return I}),D.d(J,"mergeDetails",function(){return m}),D.d(J,"mapPartIntersection",function(){return c}),D.d(J,"mapFragmentIntersection",function(){return f}),D.d(J,"adjustSliding",function(){return u}),D.d(J,"addSliding",function(){return r}),D.d(J,"computeReloadInterval",function(){return d}),D.d(J,"getFragmentWithSN",function(){return o}),D.d(J,"getPartWith",function(){return s});var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/logger.ts");function U(l,p,R){switch(p){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(R);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(R);break}}function W(l){var p={};l.forEach(function(R){var w=R.groupId||"";R.id=p[w]=p[w]||0,p[w]++})}function j(l,p,R){var w=l[p],x=l[R];k(w,x)}function k(l,p){var R=p.startPTS;if(Object(Y.isFiniteNumber)(R)){var w=0,x;p.sn>l.sn?(w=R-l.start,x=l):(w=l.start-R,x=p),x.duration!==w&&(x.duration=w)}else if(p.sn>l.sn){var O=l.cc===p.cc;O&&l.minEndPTS?p.start=l.start+(l.minEndPTS-l.start):p.start=l.start+l.duration}else p.start=Math.max(l.start-p.duration,0)}function I(l,p,R,w,x,O){var A=w-R;A<=0&&(F.logger.warn("Fragment should have a positive duration",p),w=R+p.duration,O=x+p.duration);var T=R,E=w,y=p.startPTS,h=p.endPTS;if(Object(Y.isFiniteNumber)(y)){var _=Math.abs(y-R);Object(Y.isFiniteNumber)(p.deltaPTS)?p.deltaPTS=Math.max(_,p.deltaPTS):p.deltaPTS=_,T=Math.max(R,y),R=Math.min(R,y),x=Math.min(x,p.startDTS),E=Math.min(w,h),w=Math.max(w,h),O=Math.max(O,p.endDTS)}p.duration=w-R;var g=R-p.start;p.appendedPTS=w,p.start=p.startPTS=R,p.maxStartPTS=T,p.startDTS=x,p.endPTS=w,p.minEndPTS=E,p.endDTS=O;var b=p.sn;if(!l||bl.endSN)return 0;var M,P=b-l.startSN,K=l.fragments;for(K[P]=p,M=P;M>0;M--)k(K[M],K[M-1]);for(M=P;M=0;x--){var O=w[x].initSegment;if(O){R=O;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var A=0,T;if(f(l,p,function(M,P){M.relurl&&(A=M.cc-P.cc),Object(Y.isFiniteNumber)(M.startPTS)&&Object(Y.isFiniteNumber)(M.endPTS)&&(P.start=P.startPTS=M.startPTS,P.startDTS=M.startDTS,P.appendedPTS=M.appendedPTS,P.maxStartPTS=M.maxStartPTS,P.endPTS=M.endPTS,P.endDTS=M.endDTS,P.minEndPTS=M.minEndPTS,P.duration=M.endPTS-M.startPTS,P.duration&&(T=P),p.PTSKnown=p.alignedSliding=!0),P.elementaryStreams=M.elementaryStreams,P.loader=M.loader,P.stats=M.stats,P.urlId=M.urlId,M.initSegment&&(P.initSegment=M.initSegment,R=M.initSegment)}),R){var E=p.fragmentHint?p.fragments.concat(p.fragmentHint):p.fragments;E.forEach(function(M){var P;(!M.initSegment||M.initSegment.relurl===((P=R)===null||P===void 0?void 0:P.relurl))&&(M.initSegment=R)})}if(p.skippedSegments&&(p.deltaUpdateFailed=p.fragments.some(function(M){return!M}),p.deltaUpdateFailed)){F.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var y=p.skippedSegments;y--;)p.fragments.shift();p.startSN=p.fragments[0].sn,p.startCC=p.fragments[0].cc}var h=p.fragments;if(A){F.logger.warn("discontinuity sliding from playlist, take drift into account");for(var _=0;_=w.length)return;r(p,w[R].start)}function r(l,p){if(p){for(var R=l.fragments,w=l.skippedSegments;w0&&x0&&E===-1&&(this.log("Override startPosition with lastCurrentTime @"+y.toFixed(3)),E=y),this.state=F.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=E,this.tick()}else this._forceStartLoad=!0,this.state=F.State.STOPPED},A.stopLoad=function(){this._forceStartLoad=!1,x.prototype.stopLoad.call(this)},A.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_LEVEL:{var E,y=this.levels,h=this.level,_=y==null||((E=y[h])===null||E===void 0)?void 0:E.details;if(_&&(!_.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(_))break;this.state=F.State.IDLE;break}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var g,b=self.performance.now(),M=this.retryDate;(!M||b>=M||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=F.State.IDLE)}break;default:break}this.onTickEnd()},A.onTickEnd=function(){x.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},A.doTickIdle=function(){var E,y,h=this.hls,_=this.levelLastLoaded,g=this.levels,b=this.media,M=h.config,P=h.nextLoadLevel;if(_===null||!b&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[P])return;var K=g[P];this.level=h.nextLoadLevel=P;var V=K.details;if(!V||this.state===F.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==P){this.state=F.State.WAITING_LEVEL;return}var B=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:b,I.PlaylistLevelType.MAIN);if(B===null)return;var C=B.len,$=this.getMaxBufferLength(K.maxBitrate);if(C>=$)return;if(this._streamEnded(B,V)){var ee={};this.altAudio&&(ee.type="video"),this.hls.trigger(W.Events.BUFFER_EOS,ee),this.state=F.State.ENDED;return}var re=B.end,ue=this.getNextFragment(re,V);if(this.couldBacktrack&&!this.fragPrevious&&ue&&ue.sn!=="initSegment"){var Te=ue.sn-V.startSN;Te>1&&(ue=V.fragments[Te-1],this.fragmentTracker.removeFragment(ue))}if(ue&&this.fragmentTracker.getState(ue)===k.FragmentState.OK&&this.nextLoadPosition>re){var ye=this.audioOnly&&!this.altAudio?m.ElementaryStreamTypes.AUDIO:m.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(b,ye,I.PlaylistLevelType.MAIN),ue=this.getNextFragment(this.nextLoadPosition,V)}if(!ue)return;ue.initSegment&&!ue.initSegment.data&&!this.bitrateTest&&(ue=ue.initSegment),((E=ue.decryptdata)===null||E===void 0?void 0:E.keyFormat)==="identity"&&!((y=ue.decryptdata)!==null&&y!==void 0&&y.key)?this.loadKey(ue,V):this.loadFragment(ue,V,re)},A.loadFragment=function(E,y,h){var _,g=this.fragmentTracker.getState(E);if(this.fragCurrent=E,g===k.FragmentState.BACKTRACKED){var b=this.fragmentTracker.getBacktrackData(E);if(b){this._handleFragmentLoadProgress(b),this._handleFragmentLoadComplete(b);return}else g=k.FragmentState.NOT_LOADED}g===k.FragmentState.NOT_LOADED||g===k.FragmentState.PARTIAL?E.sn==="initSegment"?this._loadInitSegment(E):this.bitrateTest?(E.bitrateTest=!0,this.log("Fragment "+E.sn+" of level "+E.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(E)):(this.startFragRequested=!0,x.prototype.loadFragment.call(this,E,y,h)):g===k.FragmentState.APPENDING?this.reduceMaxBufferLength(E.duration)&&this.fragmentTracker.removeFragment(E):((_=this.media)===null||_===void 0?void 0:_.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},A.getAppendedFrag=function(E){var y=this.fragmentTracker.getAppendedFrag(E,I.PlaylistLevelType.MAIN);return y&&"fragment"in y?y.fragment:y},A.getBufferedFrag=function(E){return this.fragmentTracker.getBufferedFrag(E,I.PlaylistLevelType.MAIN)},A.followingBufferedFrag=function(E){return E?this.getBufferedFrag(E.end+.5):null},A.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},A.nextLevelSwitch=function(){var E=this.levels,y=this.media;if(y!=null&&y.readyState){var h,_=this.getAppendedFrag(y.currentTime);if(_&&_.start>1&&this.flushMainBuffer(0,_.start-1),!y.paused&&E){var g=this.hls.nextLoadLevel,b=E[g],M=this.fragLastKbps;M&&this.fragCurrent?h=this.fragCurrent.duration*b.maxBitrate/(1e3*M)+1:h=0}else h=0;var P=this.getBufferedFrag(y.currentTime+h);if(P){var K=this.followingBufferedFrag(P);if(K){this.abortCurrentFrag();var V=K.maxStartPTS?K.maxStartPTS:K.start,B=K.duration,C=Math.max(P.end,V+Math.min(Math.max(B-this.config.maxFragLookUpTolerance,B*.5),B*.75));this.flushMainBuffer(C,Number.POSITIVE_INFINITY)}}}},A.abortCurrentFrag=function(){var E=this.fragCurrent;this.fragCurrent=null,E!=null&&E.loader&&E.loader.abort(),this.state===F.State.KEY_LOADING&&(this.state=F.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},A.flushMainBuffer=function(E,y){x.prototype.flushMainBuffer.call(this,E,y,this.altAudio?"video":null)},A.onMediaAttached=function(E,y){x.prototype.onMediaAttached.call(this,E,y);var h=y.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),h.addEventListener("playing",this.onvplaying),h.addEventListener("seeked",this.onvseeked),this.gapController=new u.default(this.config,h,this.fragmentTracker,this.hls)},A.onMediaDetaching=function(){var E=this.media;E&&(E.removeEventListener("playing",this.onvplaying),E.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),x.prototype.onMediaDetaching.call(this)},A.onMediaPlaying=function(){this.tick()},A.onMediaSeeked=function(){var E=this.media,y=E?E.currentTime:null;Object(Y.isFiniteNumber)(y)&&this.log("Media seeked to "+y.toFixed(3)),this.tick()},A.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(W.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},A.onManifestParsed=function(E,y){var h=!1,_=!1,g;y.levels.forEach(function(b){g=b.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(h=!0),g.indexOf("mp4a.40.5")!==-1&&(_=!0))}),this.audioCodecSwitch=h&&_&&!Object(U.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=y.levels,this.startFragRequested=!1},A.onLevelLoading=function(E,y){var h=this.levels;if(!h||this.state!==F.State.IDLE)return;var _=h[y.level];(!_.details||_.details.live&&this.levelLastLoaded!==y.level||this.waitForCdnTuneIn(_.details))&&(this.state=F.State.WAITING_LEVEL)},A.onLevelLoaded=function(E,y){var h,_=this.levels,g=y.level,b=y.details,M=b.totalduration;if(!_){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+b.startSN+","+b.endSN+"], cc ["+b.startCC+", "+b.endCC+"] duration:"+M);var P=this.fragCurrent;P&&(this.state===F.State.FRAG_LOADING||this.state===F.State.FRAG_LOADING_WAITING_RETRY)&&(P.level!==y.level&&P.loader&&(this.state=F.State.IDLE,P.loader.abort()));var K=_[g],V=0;if(b.live||(h=K.details)!==null&&h!==void 0&&h.live){if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed)return;V=this.alignPlaylists(b,K.details)}if(K.details=b,this.levelLastLoaded=g,this.hls.trigger(W.Events.LEVEL_UPDATED,{details:b,level:g}),this.state===F.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(b))return;this.state=F.State.IDLE}this.startFragRequested?b.live&&this.synchronizeToLiveEdge(b):this.setStartPosition(b,V),this.tick()},A._handleFragmentLoadProgress=function(E){var y,h=E.frag,_=E.part,g=E.payload,b=this.levels;if(!b){this.warn("Levels were reset while fragment load was in progress. Fragment "+h.sn+" of level "+h.level+" will not be buffered");return}var M=b[h.level],P=M.details;if(!P){this.warn("Dropping fragment "+h.sn+" of level "+h.level+" after level details were reset");return}var K=M.videoCodec,V=P.PTSKnown||!P.live,B=(y=h.initSegment)===null||y===void 0?void 0:y.data,C=this._getAudioCodec(M),$=this.transmuxer=this.transmuxer||new c.default(this.hls,I.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ee=_?_.index:-1,re=ee!==-1,ue=new f.ChunkMetadata(h.level,h.sn,h.stats.chunkCount,g.byteLength,ee,re),Te=this.initPTS[h.cc];$.push(g,B,C,K,h,_,P.totalduration,V,ue,Te)},A.onAudioTrackSwitching=function(E,y){var h=this.altAudio,_=!!y.url,g=y.id;if(!_){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var b=this.fragCurrent;b!=null&&b.loader&&(this.log("Switching to main audio track, cancel main fragment load"),b.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;h&&M.trigger(W.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(W.Events.AUDIO_TRACK_SWITCHED,{id:g})}},A.onAudioTrackSwitched=function(E,y){var h=y.id,_=!!this.hls.audioTracks[h].url;if(_){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=_,this.tick()},A.onBufferCreated=function(E,y){var h=y.tracks,_,g,b=!1;for(var M in h){var P=h[M];if(P.id==="main"){if(g=M,_=P,M==="video"){var K=h[M];K&&(this.videoBuffer=K.buffer)}}else b=!0}b&&_?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=_.buffer):this.mediaBuffer=this.media},A.onFragBuffered=function(E,y){var h=y.frag,_=y.part;if(h&&h.type!==I.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(h)){this.warn("Fragment "+h.sn+(_?" p: "+_.index:"")+" of level "+h.level+" finished buffering, but was aborted. state: "+this.state),this.state===F.State.PARSED&&(this.state=F.State.IDLE);return}var g=_?_.stats:h.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),h.sn!=="initSegment"&&(this.fragPrevious=h),this.fragBufferedComplete(h,_)},A.onError=function(E,y){switch(y.details){case r.ErrorDetails.FRAG_LOAD_ERROR:case r.ErrorDetails.FRAG_LOAD_TIMEOUT:case r.ErrorDetails.KEY_LOAD_ERROR:case r.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(I.PlaylistLevelType.MAIN,y);break;case r.ErrorDetails.LEVEL_LOAD_ERROR:case r.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==F.State.ERROR&&(y.fatal?(this.warn(""+y.details),this.state=F.State.ERROR):!y.levelRetry&&this.state===F.State.WAITING_LEVEL&&(this.state=F.State.IDLE));break;case r.ErrorDetails.BUFFER_FULL_ERROR:if(y.parent==="main"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var h=!0,_=this.getFwdBufferInfo(this.media,I.PlaylistLevelType.MAIN);_&&_.len>.5&&(h=!this.reduceMaxBufferLength(_.len)),h&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},A.checkBuffer=function(){var E=this.media,y=this.gapController;if(!E||!y||!E.readyState)return;var h=j.BufferHelper.getBuffered(E);!this.loadedmetadata&&h.length?(this.loadedmetadata=!0,this.seekToStartPos()):y.poll(this.lastCurrentTime),this.lastCurrentTime=E.currentTime},A.onFragLoadEmergencyAborted=function(){this.state=F.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},A.onBufferFlushed=function(E,y){var h=y.type;if(h!==m.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var _=(h===m.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(_,h,I.PlaylistLevelType.MAIN)}},A.onLevelsUpdated=function(E,y){this.levels=y.levels},A.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},A.seekToStartPos=function(){var E=this.media,y=E.currentTime,h=this.startPosition;if(h>=0&&y0&&(b1&&E.seeking===!1){var h=E.currentTime;if(j.BufferHelper.isBuffered(E,h)?y=this.getAppendedFrag(h):j.BufferHelper.isBuffered(E,h+.1)&&(y=this.getAppendedFrag(h+.1)),y){var _=this.fragPlaying,g=y.level;(!_||y.sn!==_.sn||_.level!==g||y.urlId!==_.urlId)&&(this.hls.trigger(W.Events.FRAG_CHANGED,{frag:y}),(!_||_.level!==g)&&this.hls.trigger(W.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=y)}}},s(O,[{key:"nextLevel",get:function(){var E=this.nextBufferedFrag;return E?E.level:-1}},{key:"currentLevel",get:function(){var E=this.media;if(E){var y=this.getAppendedFrag(E.currentTime);if(y)return y.level}return-1}},{key:"nextBufferedFrag",get:function(){var E=this.media;if(E){var y=this.getAppendedFrag(E.currentTime);return this.followingBufferedFrag(y)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),O}(F.default)},"./src/controller/subtitle-stream-controller.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"SubtitleStreamController",function(){return l});var Y=D("./src/events.ts"),F=D("./src/utils/logger.ts"),U=D("./src/utils/buffer-helper.ts"),W=D("./src/controller/fragment-finders.ts"),j=D("./src/utils/discontinuities.ts"),k=D("./src/controller/level-helper.ts"),I=D("./src/controller/fragment-tracker.ts"),m=D("./src/controller/base-stream-controller.ts"),c=D("./src/types/loader.ts"),f=D("./src/types/level.ts");function u(p,R){for(var w=0;w=y[g].start&&_<=y[g].end){h=y[g];break}var b=T.start+T.duration;h?h.end=b:(h={start:_,end:b},y.push(h)),this.fragmentTracker.fragBuffered(T)},w.onBufferFlushing=function(O,A){var T=A.startOffset,E=A.endOffset;if(T===0&&E!==Number.POSITIVE_INFINITY){var y=this.currentTrackId,h=this.levels;if(!h.length||!h[y]||!h[y].details)return;var _=h[y].details,g=_.targetduration,b=E-g;if(b<=0)return;A.endOffsetSubtitles=Math.max(0,b),this.tracksBuffered.forEach(function(M){for(var P=0;P=_.length||y!==h||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,E.live||(T=g.details)!==null&&T!==void 0&&T.live){var b=this.mainDetails;if(E.deltaUpdateFailed||!b)return;var M=b.fragments[0];if(!g.details)E.hasProgramDateTime&&b.hasProgramDateTime?Object(j.alignMediaPlaylistByPDT)(E,b):M&&Object(k.addSliding)(E,M.start);else{var P=this.alignPlaylists(E,g.details);P===0&&M&&Object(k.addSliding)(E,M.start)}}if(g.details=E,this.levelLastLoaded=y,this.tick(),E.live&&!this.fragCurrent&&this.media&&this.state===m.State.IDLE){var K=Object(W.findFragmentByPTS)(null,E.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},w._handleFragmentLoadComplete=function(O){var A=O.frag,T=O.payload,E=A.decryptdata,y=this.hls;if(this.fragContextChanged(A))return;if(T&&T.byteLength>0&&E&&E.key&&E.iv&&E.method==="AES-128"){var h=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(T),E.key.buffer,E.iv.buffer).then(function(_){var g=performance.now();y.trigger(Y.Events.FRAG_DECRYPTED,{frag:A,payload:_,stats:{tstart:h,tdecrypt:g}})})}},w.doTick=function(){if(!this.media){this.state=m.State.IDLE;return}if(this.state===m.State.IDLE){var O,A=this.currentTrackId,T=this.levels;if(!T.length||!T[A]||!T[A].details)return;var E=T[A].details,y=E.targetduration,h=this.config,_=this.media,g=U.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,_.currentTime-y,h.maxBufferHole),b=g.end,M=g.len,P=this.getMaxBufferLength()+y;if(M>P)return;console.assert(E,"Subtitle track details are defined on idle subtitle stream controller tick");var K=E.fragments,V=K.length,B=E.edge,C,$=this.fragPrevious;if(b-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},d.pollTrackChange=function(s){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,s)},d.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var s=f(this.media.textTracks);s.forEach(function(l){Object(F.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},d.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},d.onManifestParsed=function(s,l){this.tracks=l.subtitleTracks},d.onSubtitleTrackLoaded=function(s,l){var p=l.id,R=l.details,w=this.trackId,x=this.tracksInGroup[w];if(!x){this.warn("Invalid subtitle track id "+p);return}var O=x.details;x.details=l.details,this.log("subtitle track "+p+" loaded ["+R.startSN+"-"+R.endSN+"]"),p===this.trackId&&(this.retryCount=0,this.playlistLoaded(p,l,O))},d.onLevelLoading=function(s,l){this.switchLevel(l.level)},d.onLevelSwitching=function(s,l){this.switchLevel(l.level)},d.switchLevel=function(s){var l=this.hls.levels[s];if(!(l!=null&&l.textGroupIds))return;var p=l.textGroupIds[l.urlId];if(this.groupId!==p){var R=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,w=this.tracks.filter(function(A){return!p||A.groupId===p});this.tracksInGroup=w;var x=this.findTrackId(R==null?void 0:R.name)||this.findTrackId();this.groupId=p;var O={subtitleTracks:w};this.log("Updating subtitle tracks, "+w.length+' track(s) found in "'+p+'" group-id'),this.hls.trigger(Y.Events.SUBTITLE_TRACKS_UPDATED,O),x!==-1&&this.setSubtitleTrack(x,R)}},d.findTrackId=function(s){for(var l=this.tracksInGroup,p=0;p=R.length)return;this.clearTimer();var w=R[s];if(this.log("Switching to subtitle track "+s),this.trackId=s,w){var x=w.id,O=w.groupId,A=O===void 0?"":O,T=w.name,E=w.type,y=w.url;this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:x,groupId:A,name:T,type:E,url:y});var h=this.switchParams(w.url,l==null?void 0:l.details);this.loadPlaylist(h)}else this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:s})},d.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var s=-1,l=f(this.media.textTracks),p=0;p=0&&(E[0]=Math.min(E[0],R),E[1]=Math.max(E[1],w),A=!0,y/(w-R)>.5))return}if(A||O.push([R,w]),this.config.renderTextTracksNatively){var h=this.captionsTracks[p];this.Cues.newCue(h,R,w,x)}else{var _=this.Cues.newCue(null,R,w,x);this.hls.trigger(F.Events.CUES_PARSED,{type:"captions",cues:_,track:p})}},s.onInitPtsFound=function(p,R){var w=this,x=R.frag,O=R.id,A=R.initPTS,T=R.timescale,E=this.unparsedVttFrags;O==="main"&&(this.initPTS[x.cc]=A,this.timescale[x.cc]=T),E.length&&(this.unparsedVttFrags=[],E.forEach(function(y){w.onFragLoaded(F.Events.FRAG_LOADED,y)}))},s.getExistingTrack=function(p){var R=this.media;if(R)for(var w=0;w>>8^T&255^99,I[x]=T,m[T]=x;var E=w[x],y=w[E],h=w[y],_=w[T]*257^T*16843008;f[x]=_<<24|_>>>8,u[x]=_<<16|_>>>16,r[x]=_<<8|_>>>24,d[x]=_,_=h*16843009^y*65537^E*257^x*16843008,s[T]=_<<24|_>>>8,l[T]=_<<16|_>>>16,p[T]=_<<8|_>>>24,R[T]=_,x?(x=E^w[w[w[h^E]]],O^=w[w[O]]):x=O=1}},j.expandKey=function(I){for(var m=this.uint8ArrayToUint32Array_(I),c=!0,f=0;f>>6)+1;var _=(p[R+2]&60)>>>2;if(_>h.length-1){l.trigger(U.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+_});return}return A=(p[R+2]&1)<<2,A|=(p[R+3]&192)>>>6,Y.logger.log("manifest codec:"+w+", ADTS type:"+x+", samplingIndex:"+_),/firefox/i.test(E)?_>=6?(x=5,T=new Array(4),O=_-3):(x=2,T=new Array(2),O=_):E.indexOf("android")!==-1?(x=2,T=new Array(2),O=_):(x=5,T=new Array(4),w&&(w.indexOf("mp4a.40.29")!==-1||w.indexOf("mp4a.40.5")!==-1)||!w&&_>=6?O=_-3:((w&&w.indexOf("mp4a.40.2")!==-1&&(_>=6&&A===1||/vivaldi/i.test(E))||!w&&A===1)&&(x=2,T=new Array(2)),O=_)),T[0]=x<<3,T[0]|=(_&14)>>1,T[1]|=(_&1)<<7,T[1]|=A<<3,x===5&&(T[1]|=(O&14)>>1,T[2]=(O&1)<<7,T[2]|=2<<2,T[3]=0),{config:T,samplerate:h[_],channelCount:A,codec:"mp4a.40."+x,manifestCodec:y}}function j(l,p){return l[p]===255&&(l[p+1]&246)===240}function k(l,p){return l[p+1]&1?7:9}function I(l,p){return(l[p+3]&3)<<11|l[p+4]<<3|(l[p+5]&224)>>>5}function m(l,p){return p+5=l.length)return!1;var w=I(l,p);if(w<=R)return!1;var x=p+w;return x===l.length||c(l,x)}return!1}function r(l,p,R,w,x){if(!l.samplerate){var O=W(p,R,w,x);if(!O)return;l.config=O.config,l.samplerate=O.samplerate,l.channelCount=O.channelCount,l.codec=O.codec,l.manifestCodec=O.manifestCodec,Y.logger.log("parsed codec:"+l.codec+", rate:"+O.samplerate+", channels:"+O.channelCount)}}function d(l){return 1024*9e4/l}function o(l,p,R,w,x){var O=k(l,p),A=I(l,p);if(A-=O,A>0){var T=R+w*x;return{headerLength:O,frameLength:A,stamp:T}}}function s(l,p,R,w,x){var O=d(l.samplerate),A=o(p,R,w,x,O);if(A){var T=A.frameLength,E=A.headerLength,y=A.stamp,h=E+T,_=Math.max(0,R+h-p.length),g;_?(g=new Uint8Array(h-E),g.set(p.subarray(R+E,p.length),0)):g=p.subarray(R+E,R+h);var b={unit:g,pts:y};return _||l.samples.push(b),{sample:b,length:h,missing:_}}}},"./src/demux/base-audio-demuxer.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"initPTSFn",function(){return I});var Y=D("./src/polyfills/number.ts"),F=D("./src/demux/id3.ts"),U=D("./src/demux/dummy-demuxed-track.ts"),W=D("./src/utils/mp4-tools.ts"),j=D("./src/utils/typed-array.ts"),k=function(){function m(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var c=m.prototype;return c.resetInitSegment=function(u,r,d){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},c.resetTimeStamp=function(){},c.resetContiguity=function(){},c.canParse=function(u,r){return!1},c.appendFrame=function(u,r,d){},c.demux=function(u,r){this.cachedData&&(u=Object(W.appendUint8Array)(this.cachedData,u),this.cachedData=null);var d=F.getID3Data(u,0),o=d?d.length:0,s,l,p=this._audioTrack,R=this._id3Track,w=d?F.getTimeStamp(d):void 0,x=u.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=I(w,r)),d&&d.length>0&&R.samples.push({pts:this.initPTS,dts:this.initPTS,data:d}),l=this.initPTS;ok?(this.word<<=k,this.bitsAvailable-=k):(k-=this.bitsAvailable,I=k>>3,k-=I>>3,this.bytesAvailable-=I,this.loadWord(),this.word<<=k,this.bitsAvailable-=k)},W.readBits=function(k){var I=Math.min(this.bitsAvailable,k),m=this.word>>>32-I;return k>32&&Y.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=I,this.bitsAvailable>0?this.word<<=I:this.bytesAvailable>0&&this.loadWord(),I=k-I,I>0&&this.bitsAvailable?m<>>k)!==0)return this.word<<=k,this.bitsAvailable-=k,k;return this.loadWord(),k+this.skipLZ()},W.skipUEG=function(){this.skipBits(1+this.skipLZ())},W.skipEG=function(){this.skipBits(1+this.skipLZ())},W.readUEG=function(){var k=this.skipLZ();return this.readBits(k+1)-1},W.readEG=function(){var k=this.readUEG();return 1&k?1+k>>>1:-1*(k>>>1)},W.readBoolean=function(){return this.readBits(1)===1},W.readUByte=function(){return this.readBits(8)},W.readUShort=function(){return this.readBits(16)},W.readUInt=function(){return this.readBits(32)},W.skipScalingList=function(k){for(var I=8,m=8,c,f=0;f0?x.subarray(A,A+T):void 0},W=function(x,O){var A=0;return A=(x[O]&127)<<21,A|=(x[O+1]&127)<<14,A|=(x[O+2]&127)<<7,A|=x[O+3]&127,A},j=function(x,O){return Y(x,O)&&W(x,O+6)+10<=x.length-O},k=function(x){for(var O=c(x),A=0;A>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b+=String.fromCharCode(h);break;case 12:case 13:_=x[M++],b+=String.fromCharCode((h&31)<<6|_&63);break;case 14:_=x[M++],g=x[M++],b+=String.fromCharCode((h&15)<<12|(_&63)<<6|(g&63)<<0);break;default:}}return b},l={decodeTextFrame:r},p;function R(){return!p&&typeof self.TextDecoder!="undefined"&&(p=new self.TextDecoder("utf-8")),p}},"./src/demux/mp3demuxer.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/demux/base-audio-demuxer.ts"),F=D("./src/demux/id3.ts"),U=D("./src/utils/logger.ts"),W=D("./src/demux/mpegaudio.ts");function j(m,c){m.prototype=Object.create(c.prototype),m.prototype.constructor=m,k(m,c)}function k(m,c){return k=Object.setPrototypeOf||function(u,r){return u.__proto__=r,u},k(m,c)}var I=function(m){j(c,m);function c(){return m.apply(this,arguments)||this}var f=c.prototype;return f.resetInitSegment=function(r,d,o){m.prototype.resetInitSegment.call(this,r,d,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:r,duration:o,inputTimeScale:9e4,dropped:0}},c.probe=function(r){if(!r)return!1;for(var d=F.getID3Data(r,0)||[],o=d.length,s=r.length;o0},j.demux=function(I){var m=I,c=Object(F.dummyTrack)();if(this.config.progressive){this.remainderData&&(m=Object(Y.appendUint8Array)(this.remainderData,I));var f=Object(Y.segmentValidRange)(m);this.remainderData=f.remainder,c.samples=f.valid||new Uint8Array}else c.samples=m;return{audioTrack:Object(F.dummyTrack)(),avcTrack:c,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},j.flush=function(){var I=Object(F.dummyTrack)();return I.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(F.dummyTrack)(),avcTrack:I,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},j.demuxSampleAes=function(I,m,c){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},j.destroy=function(){},W}();U.minProbeByteLength=1024,J.default=U},"./src/demux/mpegaudio.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"appendFrame",function(){return k}),D.d(J,"parseHeader",function(){return I}),D.d(J,"isHeaderPattern",function(){return m}),D.d(J,"isHeader",function(){return c}),D.d(J,"canParse",function(){return f}),D.d(J,"probe",function(){return u});var Y=null,F=[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],U=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],W=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],j=[0,1,1,4];function k(r,d,o,s,l){if(o+24>d.length)return;var p=I(d,o);if(p&&o+p.frameLength<=d.length){var R=p.samplesPerFrame*9e4/p.sampleRate,w=s+l*R,x={unit:d.subarray(o,o+p.frameLength),pts:w,dts:w};return r.config=[],r.channelCount=p.channelCount,r.samplerate=p.sampleRate,r.samples.push(x),{sample:x,length:p.frameLength,missing:0}}}function I(r,d){var o=r[d+1]>>3&3,s=r[d+1]>>1&3,l=r[d+2]>>4&15,p=r[d+2]>>2&3;if(o!==1&&l!==0&&l!==15&&p!==3){var R=r[d+2]>>1&1,w=r[d+3]>>6,x=o===3?3-s:s===3?3:4,O=F[x*14+l-1]*1e3,A=o===3?0:o===2?1:2,T=U[A*3+p],E=w===3?1:2,y=W[o][s],h=j[s],_=y*8*h,g=Math.floor(y*O/T+R)*h;if(Y===null){var b=navigator.userAgent||"",M=b.match(/Chrome\/(\d+)/i);Y=M?parseInt(M[1]):0}var P=!!Y&&Y<=87;return P&&s===2&&O>=224e3&&w===0&&(r[d+3]=r[d+3]|128),{sampleRate:T,channelCount:E,frameLength:g,samplesPerFrame:_}}}function m(r,d){return r[d]===255&&(r[d+1]&224)===224&&(r[d+1]&6)!==0}function c(r,d){return d+1=I.length){c();return}if(I[m].unit.length<32)continue;var f=this.decrypter.isSync();if(this.decryptAacSample(I,m,c,f),!f)return}},j.getAvcEncryptedData=function(I){for(var m=Math.floor((I.length-48)/160)*16+16,c=new Int8Array(m),f=0,u=32;u<=I.length-16;u+=160,f+=16)c.set(I.subarray(u,u+16),f);return c},j.getAvcDecryptedUnit=function(I,m){for(var c=new Uint8Array(m),f=0,u=32;u<=I.length-16;u+=160,f+=16)I.set(c.subarray(f,f+16),u);return I},j.decryptAvcSample=function(I,m,c,f,u,r){var d=Object(F.discardEPB)(u.data),o=this.getAvcEncryptedData(d),s=this;this.decryptBuffer(o.buffer,function(l){u.data=s.getAvcDecryptedUnit(d,l),r||s.decryptAvcSamples(I,m,c+1,f)})},j.decryptAvcSamples=function(I,m,c,f){if(I instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;m++,c=0){if(m>=I.length){f();return}for(var u=I[m].units;!(c>=u.length);c++){var r=u[c];if(r.data.length<=48||r.type!==1&&r.type!==5)continue;var d=this.decrypter.isSync();if(this.decryptAvcSample(I,m,c,f,r,d),!d)return}}},W}();J.default=U},"./src/demux/transmuxer-interface.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return u});var Y=D("./node_modules/webworkify-webpack/index.js"),F=D.n(Y),U=D("./src/events.ts"),W=D("./src/demux/transmuxer.ts"),j=D("./src/utils/logger.ts"),k=D("./src/errors.ts"),I=D("./src/utils/mediasource-helper.ts"),m=D("./node_modules/eventemitter3/index.js"),c=D.n(m),f=Object(I.getMediaSource)()||{isTypeSupported:function(){return!1}},u=function(){function r(o,s,l,p){var R=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=o,this.id=s,this.onTransmuxComplete=l,this.onFlush=p;var w=o.config,x=function(y,h){h=h||{},h.frag=R.frag,h.id=R.id,o.trigger(y,h)};this.observer=new m.EventEmitter,this.observer.on(U.Events.FRAG_DECRYPTED,x),this.observer.on(U.Events.ERROR,x);var O={mp4:f.isTypeSupported("video/mp4"),mpeg:f.isTypeSupported("audio/mpeg"),mp3:f.isTypeSupported('audio/mp4; codecs="mp3"')},A=navigator.vendor;if(w.enableWorker&&typeof Worker!="undefined"){j.logger.log("demuxing in webworker");var T;try{T=this.worker=Y("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),T.addEventListener("message",this.onwmsg),T.onerror=function(E){o.trigger(U.Events.ERROR,{type:k.ErrorTypes.OTHER_ERROR,details:k.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(E.message+" ("+E.filename+":"+E.lineno+")")})},T.postMessage({cmd:"init",typeSupported:O,vendor:A,id:s,config:JSON.stringify(w)})}catch(E){j.logger.warn("Error in worker:",E),j.logger.error("Error while initializing DemuxerWorker, fallback to inline"),T&&self.URL.revokeObjectURL(T.objectURL),this.transmuxer=new W.default(this.observer,O,w,A,s),this.worker=null}}else this.transmuxer=new W.default(this.observer,O,w,A,s)}var d=r.prototype;return d.destroy=function(){var s=this.worker;if(s)s.removeEventListener("message",this.onwmsg),s.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var p=this.observer;p&&p.removeAllListeners(),this.observer=null},d.push=function(s,l,p,R,w,x,O,A,T,E){var y=this;T.transmuxing.start=self.performance.now();var h=this.transmuxer,_=this.worker,g=x?x.start:w.start,b=w.decryptdata,M=this.frag,P=!(M&&w.cc===M.cc),K=!(M&&T.level===M.level),V=M?T.sn-M.sn:-1,B=this.part?T.part-this.part.index:1,C=!K&&(V===1||V===0&&B===1),$=self.performance.now();(K||V||w.stats.parsing.start===0)&&(w.stats.parsing.start=$),x&&(B||!C)&&(x.stats.parsing.start=$);var ee=new W.TransmuxState(P,C,A,K,g);if(!C||P){j.logger.log("[transmuxer-interface, "+w.type+"]: Starting new transmux session for sn: "+T.sn+" p: "+T.part+" level: "+T.level+" id: "+T.id+` discontinuity: `+P+` trackSwitch: `+K+` contiguous: `+C+` accurateTimeOffset: `+A+` timeOffset: `+g);var re=new W.TransmuxConfig(p,R,l,O,E);this.configureTransmuxer(re)}if(this.frag=w,this.part=x,_)_.postMessage({cmd:"demux",data:s,decryptdata:b,chunkMeta:T,state:ee},s instanceof ArrayBuffer?[s]:[]);else if(h){var ue=h.push(s,b,T,ee);Object(W.isPromise)(ue)?ue.then(function(Te){y.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(ue)}},d.flush=function(s){var l=this;s.transmuxing.start=self.performance.now();var p=this.transmuxer,R=this.worker;if(R)R.postMessage({cmd:"flush",chunkMeta:s});else if(p){var w=p.flush(s);Object(W.isPromise)(w)?w.then(function(x){l.handleFlushResult(x,s)}):this.handleFlushResult(w,s)}},d.handleFlushResult=function(s,l){var p=this;s.forEach(function(R){p.handleTransmuxComplete(R)}),this.onFlush(l)},d.onWorkerMessage=function(s){var l=s.data,p=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,p.trigger(l.event,l.data);break}}},d.configureTransmuxer=function(s){var l=this.worker,p=this.transmuxer;l?l.postMessage({cmd:"configure",config:s}):p&&p.configure(s)},d.handleTransmuxComplete=function(s){s.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(s)},r}()},"./src/demux/transmuxer-worker.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return k});var Y=D("./src/demux/transmuxer.ts"),F=D("./src/events.ts"),U=D("./src/utils/logger.ts"),W=D("./node_modules/eventemitter3/index.js"),j=D.n(W);function k(u){var r=new W.EventEmitter,d=function(s,l){u.postMessage({event:s,data:l})};r.on(F.Events.FRAG_DECRYPTED,d),r.on(F.Events.ERROR,d),u.addEventListener("message",function(o){var s=o.data;switch(s.cmd){case"init":{var l=JSON.parse(s.config);u.transmuxer=new Y.default(r,s.typeSupported,l,s.vendor,s.id),Object(U.enableLogs)(l.debug),d("init",null);break}case"configure":{u.transmuxer.configure(s.config);break}case"demux":{var p=u.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state);Object(Y.isPromise)(p)?p.then(function(x){I(u,x)}):I(u,p);break}case"flush":{var R=s.chunkMeta,w=u.transmuxer.flush(R);Object(Y.isPromise)(w)?w.then(function(x){c(u,x,R)}):c(u,w,R);break}default:break}})}function I(u,r){if(f(r.remuxResult))return;var d=[],o=r.remuxResult,s=o.audio,l=o.video;s&&m(d,s),l&&m(d,l),u.postMessage({event:"transmuxComplete",data:r},d)}function m(u,r){r.data1&&u.push(r.data1.buffer),r.data2&&u.push(r.data2.buffer)}function c(u,r,d){r.forEach(function(o){I(u,o)}),u.postMessage({event:"flush",data:d})}function f(u){return!u.audio&&!u.video&&!u.text&&!u.id3&&!u.initSegment}},"./src/demux/transmuxer.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return l}),D.d(J,"isPromise",function(){return w}),D.d(J,"TransmuxConfig",function(){return x}),D.d(J,"TransmuxState",function(){return O});var Y=D("./src/events.ts"),F=D("./src/errors.ts"),U=D("./src/crypt/decrypter.ts"),W=D("./src/demux/aacdemuxer.ts"),j=D("./src/demux/mp4demuxer.ts"),k=D("./src/demux/tsdemuxer.ts"),I=D("./src/demux/mp3demuxer.ts"),m=D("./src/remux/mp4-remuxer.ts"),c=D("./src/remux/passthrough-remuxer.ts"),f=D("./src/demux/chunk-cache.ts"),u=D("./src/utils/mp4-tools.ts"),r=D("./src/utils/logger.ts"),d;try{d=self.performance.now.bind(self.performance)}catch(A){r.logger.debug("Unable to use Performance API on this environment"),d=self.Date.now}var o=[{demux:k.default,remux:m.default},{demux:j.default,remux:c.default},{demux:W.default,remux:m.default},{demux:I.default,remux:m.default}],s=1024;o.forEach(function(A){var T=A.demux;s=Math.max(s,T.minProbeByteLength)});var l=function(){function A(E,y,h,_,g){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new f.default,this.observer=E,this.typeSupported=y,this.config=h,this.vendor=_,this.id=g}var T=A.prototype;return T.configure=function(y){this.transmuxConfig=y,this.decrypter&&this.decrypter.reset()},T.push=function(y,h,_,g){var b=this,M=_.transmuxing;M.executeStart=d();var P=new Uint8Array(y),K=this.cache,V=this.config,B=this.currentTransmuxState,C=this.transmuxConfig;g&&(this.currentTransmuxState=g);var $=p(P,h);if($&&$.method==="AES-128"){var ee=this.getDecrypter();if(V.enableSoftwareAES){var re=ee.softwareDecrypt(P,$.key.buffer,$.iv.buffer);if(!re)return M.executeEnd=d(),R(_);P=new Uint8Array(re)}else return this.decryptionPromise=ee.webCryptoDecrypt(P,$.key.buffer,$.iv.buffer).then(function(Le){var Ue=b.push(Le,null,_);return b.decryptionPromise=null,Ue}),this.decryptionPromise}var ue=g||B,Te=ue.contiguous,ye=ue.discontinuity,be=ue.trackSwitch,we=ue.accurateTimeOffset,xe=ue.timeOffset,me=C.audioCodec,se=C.videoCodec,Re=C.defaultInitPts,ze=C.duration,He=C.initSegmentData;if((ye||be)&&this.resetInitSegment(He,me,se,ze),ye&&this.resetInitialTimestamp(Re),Te||this.resetContiguity(),this.needsProbing(P,ye,be)){if(K.dataLength){var rt=K.flush();P=Object(u.appendUint8Array)(rt,P)}this.configureTransmuxer(P,C)}var ot=this.transmux(P,$,xe,we,_),Oe=this.currentTransmuxState;return Oe.contiguous=!0,Oe.discontinuity=!1,Oe.trackSwitch=!1,M.executeEnd=d(),ot},T.flush=function(y){var h=this,_=y.transmuxing;_.executeStart=d();var g=this.decrypter,b=this.cache,M=this.currentTransmuxState,P=this.decryptionPromise;if(P)return P.then(function(){return h.flush(y)});var K=[],V=M.timeOffset;if(g){var B=g.flush();B&&K.push(this.push(B,null,y))}var C=b.dataLength;b.reset();var $=this.demuxer,ee=this.remuxer;if(!$||!ee)return C>=s&&this.observer.emit(Y.Events.ERROR,Y.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),_.executeEnd=d(),[R(y)];var re=$.flush(V);return w(re)?re.then(function(ue){return h.flushRemux(K,ue,y),K}):(this.flushRemux(K,re,y),K)},T.flushRemux=function(y,h,_){var g=h.audioTrack,b=h.avcTrack,M=h.id3Track,P=h.textTrack,K=this.currentTransmuxState,V=K.accurateTimeOffset,B=K.timeOffset;r.logger.log("[transmuxer.ts]: Flushed fragment "+_.sn+(_.part>-1?" p: "+_.part:"")+" of level "+_.level);var C=this.remuxer.remux(g,b,M,P,B,V,!0,this.id);y.push({remuxResult:C,chunkMeta:_}),_.transmuxing.executeEnd=d()},T.resetInitialTimestamp=function(y){var h=this.demuxer,_=this.remuxer;if(!h||!_)return;h.resetTimeStamp(y),_.resetTimeStamp(y)},T.resetContiguity=function(){var y=this.demuxer,h=this.remuxer;if(!y||!h)return;y.resetContiguity(),h.resetNextTimestamp()},T.resetInitSegment=function(y,h,_,g){var b=this.demuxer,M=this.remuxer;if(!b||!M)return;b.resetInitSegment(h,_,g),M.resetInitSegment(y,h,_)},T.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},T.transmux=function(y,h,_,g,b){var M;return h&&h.method==="SAMPLE-AES"?M=this.transmuxSampleAes(y,h,_,g,b):M=this.transmuxUnencrypted(y,_,g,b),M},T.transmuxUnencrypted=function(y,h,_,g){var b=this.demuxer.demux(y,h,!1,!this.config.progressive),M=b.audioTrack,P=b.avcTrack,K=b.id3Track,V=b.textTrack,B=this.remuxer.remux(M,P,K,V,h,_,!1,this.id);return{remuxResult:B,chunkMeta:g}},T.transmuxSampleAes=function(y,h,_,g,b){var M=this;return this.demuxer.demuxSampleAes(y,h,_).then(function(P){var K=M.remuxer.remux(P.audioTrack,P.avcTrack,P.id3Track,P.textTrack,_,g,!1,M.id);return{remuxResult:K,chunkMeta:b}})},T.configureTransmuxer=function(y,h){for(var _=this.config,g=this.observer,b=this.typeSupported,M=this.vendor,P=h.audioCodec,K=h.defaultInitPts,V=h.duration,B=h.initSegmentData,C=h.videoCodec,$,ee=0,re=o.length;ee0&&T!=null&&T.key!=null&&T.iv!==null&&T.method!=null&&(E=T),E}var R=function(T){return{remuxResult:{},chunkMeta:T}};function w(A){return"then"in A&&A.then instanceof Function}var x=function(T,E,y,h,_){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=T,this.videoCodec=E,this.initSegmentData=y,this.duration=h,this.defaultInitPts=_},O=function(T,E,y,h,_){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=T,this.contiguous=E,this.accurateTimeOffset=y,this.trackSwitch=h,this.timeOffset=_}},"./src/demux/tsdemuxer.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"discardEPB",function(){return R});var Y=D("./src/demux/adts.ts"),F=D("./src/demux/mpegaudio.ts"),U=D("./src/demux/exp-golomb.ts"),W=D("./src/demux/id3.ts"),j=D("./src/demux/sample-aes.ts"),k=D("./src/events.ts"),I=D("./src/utils/mp4-tools.ts"),m=D("./src/utils/logger.ts"),c=D("./src/errors.ts"),f={video:1,audio:2,id3:3,text:4},u=function(){function w(O,A,T){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=O,this.config=A,this.typeSupported=T}w.probe=function(A){var T=w.syncOffset(A);return T<0?!1:(T&&m.logger.warn("MPEG2-TS detected but first sync word found @ offset "+T+", junk ahead ?"),!0)},w.syncOffset=function(A){for(var T=Math.min(1e3,A.length-3*188),E=0;E>4,me=void 0;if(xe>1){if(me=ye+5+A[ye+4],me===ye+188)continue}else me=ye+4;switch(we){case M:be&&(P&&(h=s(P))&&this.parseAVCPES(h,!1),P={data:[],size:0}),P&&(P.data.push(A.subarray(me,ye+188)),P.size+=ye+188-me);break;case K:be&&(B&&(h=s(B))&&(g.isAAC?this.parseAACPES(h):this.parseMPEGPES(h)),B={data:[],size:0}),B&&(B.data.push(A.subarray(me,ye+188)),B.size+=ye+188-me);break;case V:be&&(C&&(h=s(C))&&this.parseID3PES(h),C={data:[],size:0}),C&&(C.data.push(A.subarray(me,ye+188)),C.size+=ye+188-me);break;case 0:be&&(me+=A[me]+1),re=this._pmtId=d(A,me);break;case re:{be&&(me+=A[me]+1);var se=o(A,me,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,E);M=se.avc,M>0&&(_.pid=M),K=se.audio,K>0&&(g.pid=K,g.isAAC=se.isAAC),V=se.id3,V>0&&(b.pid=V),$&&!ee&&(m.logger.log("reparse from beginning"),$=!1,ye=Te-188),ee=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});_.pesData=P,g.pesData=B,b.pesData=C;var Re={audioTrack:g,avcTrack:_,id3Track:b,textTrack:this._txtTrack};return y&&this.extractRemainingSamples(Re),Re},x.flush=function(){var A=this.remainderData;this.remainderData=null;var T;return A?T=this.demux(A,-1,!1,!0):T={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(T),this.sampleAes?this.decrypt(T,this.sampleAes):T},x.extractRemainingSamples=function(A){var T=A.audioTrack,E=A.avcTrack,y=A.id3Track,h=E.pesData,_=T.pesData,g=y.pesData,b;h&&(b=s(h))?(this.parseAVCPES(b,!0),E.pesData=null):E.pesData=h,_&&(b=s(_))?(T.isAAC?this.parseAACPES(b):this.parseMPEGPES(b),T.pesData=null):(_!=null&&_.size&&m.logger.log("last AAC PES packet truncated,might overlap between fragments"),T.pesData=_),g&&(b=s(g))?(this.parseID3PES(b),y.pesData=null):y.pesData=g},x.demuxSampleAes=function(A,T,E){var y=this.demux(A,E,!0,!this.config.progressive),h=this.sampleAes=new j.default(this.observer,this.config,T);return this.decrypt(y,h)},x.decrypt=function(A,T){return new Promise(function(E){var y=A.audioTrack,h=A.avcTrack;y.samples&&y.isAAC?T.decryptAacSamples(y.samples,0,function(){h.samples?T.decryptAvcSamples(h.samples,0,0,function(){E(A)}):E(A)}):h.samples&&T.decryptAvcSamples(h.samples,0,0,function(){E(A)})})},x.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},x.parseAVCPES=function(A,T){var E=this,y=this._avcTrack,h=this.parseAVCNALu(A.data),_=!1,g=this.avcSample,b,M=!1;A.data=null,g&&h.length&&!y.audFound&&(l(g,y),g=this.avcSample=r(!1,A.pts,A.dts,"")),h.forEach(function(P){switch(P.type){case 1:{b=!0,g||(g=E.avcSample=r(!0,A.pts,A.dts,"")),_&&(g.debug+="NDR "),g.frame=!0;var K=P.data;if(M&&K.length>4){var V=new U.default(K).readSliceType();(V===2||V===4||V===7||V===9)&&(g.key=!0)}break}case 5:b=!0,g||(g=E.avcSample=r(!0,A.pts,A.dts,"")),_&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{b=!0,_&&g&&(g.debug+="SEI ");var B=new U.default(R(P.data));B.readUByte();for(var C=0,$=0,ee=!1,re=0;!ee&&B.bytesAvailable>1;){C=0;do re=B.readUByte(),C+=re;while(re===255);$=0;do re=B.readUByte(),$+=re;while(re===255);if(C===4&&B.bytesAvailable!==0){ee=!0;var ue=B.readUByte();if(ue===181){var Te=B.readUShort();if(Te===49){var ye=B.readUInt();if(ye===1195456820){var be=B.readUByte();if(be===3){for(var we=B.readUByte(),xe=B.readUByte(),me=31&we,se=[we,xe],Re=0;Re16){for(var ze=[],He=0;He<16;He++)ze.push(B.readUByte().toString(16)),(He===3||He===5||He===7||He===9)&&ze.push("-");for(var rt=$-16,ot=new Uint8Array(rt),Oe=0;Oe=0){var B={data:A.subarray(K,g-y-1),type:V};_.push(B)}else{var C=this.getLastNalUnit();if(C&&(h&&g<=4-h&&(C.state&&(C.data=C.data.subarray(0,C.data.byteLength-h))),M=g-y-1,M>0)){var $=new Uint8Array(C.data.byteLength+M);$.set(C.data,0),$.set(A.subarray(0,M),C.data.byteLength),C.data=$,C.state=0}}g=0&&y>=0){var ee={data:A.subarray(K,T),type:V,state:y};_.push(ee)}if(_.length===0){var re=this.getLastNalUnit();if(re){var ue=new Uint8Array(re.data.byteLength+A.byteLength);ue.set(re.data,0),ue.set(A,re.data.byteLength),re.data=ue}}return E.naluState=y,_},x.parseAACPES=function(A){var T=0,E=this._audioTrack,y=this.aacOverFlow,h=A.data;if(y){this.aacOverFlow=null;var _=y.sample.unit.byteLength,g=Math.min(y.missing,_),b=_-g;y.sample.unit.set(h.subarray(0,g),b),E.samples.push(y.sample),T=y.missing}var M,P;for(M=T,P=h.length;M1;){var _=new Uint8Array(h[0].length+h[1].length);_.set(h[0]),_.set(h[1],h[0].length),h[0]=_,h.splice(1,1)}O=h[0];var g=(O[0]<<16)+(O[1]<<8)+O[2];if(g===1){if(A=(O[4]<<8)+O[5],A&&A>w.size-6)return null;var b=O[7];b&192&&(E=(O[9]&14)*536870912+(O[10]&255)*4194304+(O[11]&254)*16384+(O[12]&255)*128+(O[13]&254)/2,b&64?(y=(O[14]&14)*536870912+(O[15]&255)*4194304+(O[16]&254)*16384+(O[17]&255)*128+(O[18]&254)/2,E-y>60*9e4&&(m.logger.warn(Math.round((E-y)/9e4)+"s delta between PTS and DTS, align them"),E=y)):y=E),T=O[8];var M=T+9;if(w.size<=M)return null;w.size-=M;for(var P=new Uint8Array(w.size),K=0,V=h.length;KB){M-=B;continue}else O=O.subarray(M),B-=M,M=0;P.set(O,x),x+=B}return A&&(A-=T+3),{data:P,pts:E,dts:y,len:A}}return null}function l(w,x){if(w.units.length&&w.frame){if(w.pts===void 0){var O=x.samples,A=O.length;if(A){var T=O[A-1];w.pts=T.pts,w.dts=T.dts}else{x.dropped++;return}}x.samples.push(w)}w.debug.length&&m.logger.log(w.pts+"/"+w.dts+":"+w.debug)}function p(w,x){var O=w.length;if(O>0){if(x.pts>=w[O-1].pts)w.push(x);else for(var A=O-1;A>=0;A--)if(x.ptsE)return h;return 0}},{key:"maxAutoLevel",get:function(){var T=this.levels,E=this.autoLevelCapping,y;return E===-1&&T&&T.length?y=T.length-1:y=E,y}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(T){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,T)}},{key:"audioTracks",get:function(){var T=this.audioTrackController;return T?T.audioTracks:[]}},{key:"audioTrack",get:function(){var T=this.audioTrackController;return T?T.audioTrack:-1},set:function(T){var E=this.audioTrackController;E&&(E.audioTrack=T)}},{key:"subtitleTracks",get:function(){var T=this.subtitleTrackController;return T?T.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var T=this.subtitleTrackController;return T?T.subtitleTrack:-1},set:function(T){var E=this.subtitleTrackController;E&&(E.subtitleTrack=T)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var T=this.subtitleTrackController;return T?T.subtitleDisplay:!1},set:function(T){var E=this.subtitleTrackController;E&&(E.subtitleDisplay=T)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(T){this.config.lowLatencyMode=T}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return s.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return x.defaultConfig?x.defaultConfig:r.hlsDefaultConfig},set:function(T){x.defaultConfig=T}}]),x}();w.defaultConfig=void 0},"./src/is-supported.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"isSupported",function(){return U}),D.d(J,"changeTypeSupported",function(){return W});var Y=D("./src/utils/mediasource-helper.ts");function F(){return self.SourceBuffer||self.WebKitSourceBuffer}function U(){var j=Object(Y.getMediaSource)();if(!j)return!1;var k=F(),I=j&&typeof j.isTypeSupported=="function"&&j.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),m=!k||k.prototype&&typeof k.prototype.appendBuffer=="function"&&typeof k.prototype.remove=="function";return!!I&&!!m}function W(){var j,k=F();return typeof(k==null||((j=k.prototype)===null||j===void 0)?void 0:j.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return u}),D.d(J,"LoadError",function(){return d});var Y=D("./src/polyfills/number.ts"),F=D("./src/errors.ts");function U(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,m(o,s)}function W(o){var s=typeof Map=="function"?new Map:void 0;return W=function(p){if(p===null||!I(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(typeof s!="undefined"){if(s.has(p))return s.get(p);s.set(p,R)}function R(){return j(p,arguments,c(this).constructor)}return R.prototype=Object.create(p.prototype,{constructor:{value:R,enumerable:!1,writable:!0,configurable:!0}}),m(R,p)},W(o)}function j(o,s,l){return k()?j=Reflect.construct:j=function(R,w,x){var O=[null];O.push.apply(O,w);var A=Function.bind.apply(R,O),T=new A;return x&&m(T,x.prototype),T},j.apply(null,arguments)}function k(){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 I(o){return Function.toString.call(o).indexOf("[native code]")!==-1}function m(o,s){return m=Object.setPrototypeOf||function(p,R){return p.__proto__=R,p},m(o,s)}function c(o){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},c(o)}var f=Math.pow(2,17),u=function(){function o(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var s=o.prototype;return s.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},s.abort=function(){this.loader&&this.loader.abort()},s.load=function(p,R){var w=this,x=p.url;if(!x)return Promise.reject(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:p,networkDetails:null},"Fragment does not have a "+(x?"part list":"url")));this.abort();var O=this.config,A=O.fLoader,T=O.loader;return new Promise(function(E,y){w.loader&&w.loader.destroy();var h=w.loader=p.loader=A?new A(O):new T(O),_=r(p),g={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};p.stats=h.stats,h.load(_,g,{onSuccess:function(M,P,K,V){w.resetLoader(p,h),E({frag:p,part:null,payload:M.data,networkDetails:V})},onError:function(M,P,K){w.resetLoader(p,h),y(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:p,response:M,networkDetails:K}))},onAbort:function(M,P,K){w.resetLoader(p,h),y(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:p,networkDetails:K}))},onTimeout:function(M,P,K){w.resetLoader(p,h),y(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:p,networkDetails:K}))},onProgress:function(M,P,K,V){R&&R({frag:p,part:null,payload:K,networkDetails:V})}})})},s.loadPart=function(p,R,w){var x=this;this.abort();var O=this.config,A=O.fLoader,T=O.loader;return new Promise(function(E,y){x.loader&&x.loader.destroy();var h=x.loader=p.loader=A?new A(O):new T(O),_=r(p,R),g={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};R.stats=h.stats,h.load(_,g,{onSuccess:function(M,P,K,V){x.resetLoader(p,h),x.updateStatsFromPart(p,R);var B={frag:p,part:R,payload:M.data,networkDetails:V};w(B),E(B)},onError:function(M,P,K){x.resetLoader(p,h),y(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:p,part:R,response:M,networkDetails:K}))},onAbort:function(M,P,K){p.stats.aborted=R.stats.aborted,x.resetLoader(p,h),y(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:p,part:R,networkDetails:K}))},onTimeout:function(M,P,K){x.resetLoader(p,h),y(new d({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:p,part:R,networkDetails:K}))}})})},s.updateStatsFromPart=function(p,R){var w=p.stats,x=R.stats,O=x.total;if(w.loaded+=x.loaded,O){var A=Math.round(p.duration/R.duration),T=Math.min(Math.round(w.loaded/O),A),E=A-T,y=E*Math.round(w.loaded/T);w.total=w.loaded+y}else w.total=Math.max(w.loaded,w.total);var h=w.loading,_=x.loading;h.start?h.first+=_.first-_.start:(h.start=_.start,h.first=_.first),h.end=_.end},s.resetLoader=function(p,R){p.loader=null,this.loader===R&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),R.destroy()},o}();function r(o,s){s===void 0&&(s=null);var l=s||o,p={frag:o,part:s,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},R=l.byteRangeStartOffset,w=l.byteRangeEndOffset;return Object(Y.isFiniteNumber)(R)&&Object(Y.isFiniteNumber)(w)&&(p.rangeStart=R,p.rangeEnd=w),p}var d=function(o){U(s,o);function s(l){for(var p,R=arguments.length,w=new Array(R>1?R-1:0),x=1;x>8*(15-O)&255;return x},p.setDecryptDataFromLevelKey=function(w,x){var O=w;return(w==null?void 0:w.method)==="AES-128"&&w.uri&&!w.iv&&(O=j.LevelKey.fromURI(w.uri),O.method=w.method,O.iv=this.createInitializationVector(x),O.keyFormat="identity"),O},p.setElementaryStreamInfo=function(w,x,O,A,T,E){E===void 0&&(E=!1);var y=this.elementaryStreams,h=y[w];if(!h){y[w]={startPTS:x,endPTS:O,startDTS:A,endDTS:T,partial:E};return}h.startPTS=Math.min(h.startPTS,x),h.endPTS=Math.max(h.endPTS,O),h.startDTS=Math.min(h.startDTS,A),h.endDTS=Math.max(h.endDTS,T)},p.clearElementaryStreamInfo=function(){var w=this.elementaryStreams;w[u.AUDIO]=null,w[u.VIDEO]=null,w[u.AUDIOVIDEO]=null},f(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var w=this.sn;typeof w!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&W.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),w=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,w)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Y.isFiniteNumber)(this.programDateTime))return null;var w=Object(Y.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+w*1e3}},{key:"encrypted",get:function(){var w;return!!((w=this.decryptdata)!==null&&w!==void 0&&w.keyFormat&&this.decryptdata.uri)}}]),l}(r),o=function(s){I(l,s);function l(p,R,w,x,O){var A;A=s.call(this,w)||this,A.fragOffset=0,A.duration=0,A.gap=!1,A.independent=!1,A.relurl=void 0,A.fragment=void 0,A.index=void 0,A.stats=new k.LoadStats,A.duration=p.decimalFloatingPoint("DURATION"),A.gap=p.bool("GAP"),A.independent=p.bool("INDEPENDENT"),A.relurl=p.enumeratedString("URI"),A.fragment=R,A.index=x;var T=p.enumeratedString("BYTERANGE");return T&&A.setByteRange(T,O),O&&(A.fragOffset=O.fragOffset+O.duration),A}return f(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var R=this.elementaryStreams;return!!(R.audio||R.video||R.audiovideo)}}]),l}(r)},"./src/loader/key-loader.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return W});var Y=D("./src/events.ts"),F=D("./src/errors.ts"),U=D("./src/utils/logger.ts"),W=function(){function j(I){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=I,this._registerListeners()}var k=j.prototype;return k._registerListeners=function(){this.hls.on(Y.Events.KEY_LOADING,this.onKeyLoading,this)},k._unregisterListeners=function(){this.hls.off(Y.Events.KEY_LOADING,this.onKeyLoading)},k.destroy=function(){this._unregisterListeners();for(var m in this.loaders){var c=this.loaders[m];c&&c.destroy()}this.loaders={}},k.onKeyLoading=function(m,c){var f=c.frag,u=f.type,r=this.loaders[u];if(!f.decryptdata){U.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var d=f.decryptdata.uri;if(d!==this.decrypturl||this.decryptkey===null){var o=this.hls.config;if(r&&(U.logger.warn("abort previous key loader for type:"+u),r.abort()),!d){U.logger.warn("key uri is falsy");return}var s=o.loader,l=f.loader=this.loaders[u]=new s(o);this.decrypturl=d,this.decryptkey=null;var p={url:d,frag:f,responseType:"arraybuffer"},R={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:o.fragLoadingRetryDelay,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:0},w={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(p,R,w)}else this.decryptkey&&(f.decryptdata.key=this.decryptkey,this.hls.trigger(Y.Events.KEY_LOADED,{frag:f}))},k.loadsuccess=function(m,c,f){var u=f.frag;if(!u.decryptdata){U.logger.error("after key load, decryptdata unset");return}this.decryptkey=u.decryptdata.key=new Uint8Array(m.data),u.loader=null,delete this.loaders[u.type],this.hls.trigger(Y.Events.KEY_LOADED,{frag:u})},k.loaderror=function(m,c){var f=c.frag,u=f.loader;u&&u.abort(),delete this.loaders[f.type],this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:f,response:m})},k.loadtimeout=function(m,c){var f=c.frag,u=f.loader;u&&u.abort(),delete this.loaders[f.type],this.hls.trigger(Y.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:f})},j}()},"./src/loader/level-details.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"LevelDetails",function(){return j});var Y=D("./src/polyfills/number.ts");function F(k,I){for(var m=0;mc.endSN||f>0||f===0&&u>0,this.updated||this.advanced?this.misses=Math.floor(c.misses*.6):this.misses=c.misses+1,this.availabilityDelay=c.availabilityDelay},U(k,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Y.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||W}},{key:"drift",get:function(){var c=this.driftEndTime-this.driftStartTime;if(c>0){var f=this.driftEnd-this.driftStart;return f*1e3/c}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var c;return(c=this.partList)!==null&&c!==void 0&&c.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var c;return(c=this.fragments)!==null&&c!==void 0&&c.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 c;return(c=this.partList)!==null&&c!==void 0&&c.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var c;return(c=this.partList)!==null&&c!==void 0&&c.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),k}()},"./src/loader/level-key.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"LevelKey",function(){return j});var Y=D("./node_modules/url-toolkit/src/url-toolkit.js"),F=D.n(Y);function U(k,I){for(var m=0;m2){var y=E.shift()+".";return y+=parseInt(E.shift()).toString(16),y+=("000"+parseInt(E.shift()).toString(16)).substr(-4),y}return T},O.resolve=function(T,E){return F.buildAbsoluteURL(E,T,{alwaysNormalize:!0})},O.parseMasterPlaylist=function(T,E){var y=[],h={},_=!1;f.lastIndex=0;for(var g;(g=f.exec(T))!=null;)if(g[1]){var b=new I.AttrList(g[1]),M={attrs:b,bitrate:b.decimalInteger("AVERAGE-BANDWIDTH")||b.decimalInteger("BANDWIDTH"),name:b.NAME,url:O.resolve(g[2],E)},P=b.decimalResolution("RESOLUTION");P&&(M.width=P.width,M.height=P.height),p((b.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=O.convertAVC1ToAVCOTI(M.videoCodec)),y.push(M)}else if(g[3]){var K=new I.AttrList(g[3]);K["DATA-ID"]&&(_=!0,h[K["DATA-ID"]]=K)}return{levels:y,sessionData:_?h:null}},O.parseMasterPlaylistMedia=function(T,E,y,h){h===void 0&&(h=[]);var _,g=[],b=0;for(u.lastIndex=0;(_=u.exec(T))!==null;){var M=new I.AttrList(_[1]);if(M.TYPE===y){var P={attrs:M,bitrate:0,id:b++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:y,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?O.resolve(M.URI,E):""};if(h.length){var K=O.findGroup(h,P.groupId)||h[0];R(P,K,"audioCodec"),R(P,K,"textCodec")}g.push(P)}}return g},O.parseLevelPlaylist=function(T,E,y,h,_){var g=new j.LevelDetails(E),b=g.fragments,M=null,P=0,K=0,V=0,B=0,C=null,$=new W.Fragment(h,E),ee,re,ue,Te=-1,ye=!1;for(r.lastIndex=0,g.m3u8=T;(ee=r.exec(T))!==null;){ye&&(ye=!1,$=new W.Fragment(h,E),$.start=V,$.sn=P,$.cc=B,$.level=y,M&&($.initSegment=M,$.rawProgramDateTime=M.rawProgramDateTime));var be=ee[1];if(be){$.duration=parseFloat(be);var we=(" "+ee[2]).slice(1);$.title=we||null,$.tagList.push(we?["INF",be,we]:["INF",be])}else if(ee[3])Object(Y.isFiniteNumber)($.duration)&&($.start=V,ue&&($.levelkey=ue),$.sn=P,$.level=y,$.cc=B,$.urlId=_,b.push($),$.relurl=(" "+ee[3]).slice(1),x($,C),C=$,V+=$.duration,P++,K=0,ye=!0);else if(ee[4]){var xe=(" "+ee[4]).slice(1);C?$.setByteRange(xe,C):$.setByteRange(xe)}else if(ee[5])$.rawProgramDateTime=(" "+ee[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),Te===-1&&(Te=b.length);else{if(ee=ee[0].match(d),!ee){m.logger.warn("No matches on slow regex match for level playlist!");continue}for(re=1;re-1){m.logger.warn("Keyformat "+ut+" is not supported from the manifest");continue}else if(ut!=="identity")continue;Ue&&(ue=k.LevelKey.fromURL(E,Ge),Ge&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ue)>=0&&(ue.method=Ue,ue.keyFormat=ut,Pe&&(ue.keyID=Pe),Me&&(ue.keyFormatVersions=Me),ue.iv=je));break}case"START":{var qe=new I.AttrList(se),$e=qe.decimalFloatingPoint("TIME-OFFSET");Object(Y.isFiniteNumber)($e)&&(g.startTimeOffset=$e);break}case"MAP":{var ft=new I.AttrList(se);$.relurl=ft.URI,ft.BYTERANGE&&$.setByteRange(ft.BYTERANGE),$.level=y,$.sn="initSegment",ue&&($.levelkey=ue),$.initSegment=null,M=$,ye=!0;break}case"SERVER-CONTROL":{var nt=new I.AttrList(se);g.canBlockReload=nt.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=nt.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&nt.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=nt.optionalFloat("PART-HOLD-BACK",0),g.holdBack=nt.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ye=new I.AttrList(se);g.partTarget=Ye.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ae=g.partList;Ae||(Ae=g.partList=[]);var ct=K>0?Ae[Ae.length-1]:void 0,Je=K++,Se=new W.Part(new I.AttrList(se),$,E,Je,ct);Ae.push(Se),$.duration+=Se.duration;break}case"PRELOAD-HINT":{var Ne=new I.AttrList(se);g.preloadHint=Ne;break}case"RENDITION-REPORT":{var ve=new I.AttrList(se);g.renditionReports=g.renditionReports||[],g.renditionReports.push(ve);break}default:m.logger.warn("line parsed but not handled: "+ee);break}}}C&&!C.relurl?(b.pop(),V-=C.duration,g.partList&&(g.fragmentHint=C)):g.partList&&(x($,C),$.cc=B,g.fragmentHint=$);var de=b.length,pe=b[0],te=b[de-1];if(V+=g.skippedSegments*g.targetduration,V>0&&de&&te){g.averagetargetduration=V/de;var ie=te.sn;g.endSN=ie!=="initSegment"?ie:0,pe&&(g.startCC=pe.cc,pe.initSegment||g.fragments.every(function(oe){return oe.relurl&&s(oe.relurl)})&&(m.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new W.Fragment(h,E),$.relurl=te.relurl,$.level=y,$.sn="initSegment",pe.initSegment=$,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(V+=g.fragmentHint.duration),g.totalduration=V,g.endCC=B,Te>0&&w(b,Te),g},O}();function p(O,A){["video","audio","text"].forEach(function(T){var E=O.filter(function(h){return Object(c.isCodecType)(h,T)});if(E.length){var y=E.filter(function(h){return h.lastIndexOf("avc1",0)===0||h.lastIndexOf("mp4a",0)===0});A[T+"Codec"]=y.length>0?y[0]:E[0],O=O.filter(function(h){return E.indexOf(h)===-1})}}),A.unknownCodecs=O}function R(O,A,T){var E=A[T];E&&(O[T]=E)}function w(O,A){for(var T=O[A],E=A;E--;){var y=O[E];if(!y)return;y.programDateTime=T.programDateTime-y.duration*1e3,T=y}}function x(O,A){O.rawProgramDateTime?O.programDateTime=Date.parse(O.rawProgramDateTime):A!=null&&A.programDateTime&&(O.programDateTime=A.endProgramDateTime),Object(Y.isFiniteNumber)(O.programDateTime)||(O.programDateTime=null,O.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/polyfills/number.ts"),F=D("./src/events.ts"),U=D("./src/errors.ts"),W=D("./src/utils/logger.ts"),j=D("./src/utils/mp4-tools.ts"),k=D("./src/loader/m3u8-parser.ts"),I=D("./src/types/loader.ts"),m=D("./src/utils/attr-list.ts");function c(r){var d=r.type;switch(d){case I.PlaylistContextType.AUDIO_TRACK:return I.PlaylistLevelType.AUDIO;case I.PlaylistContextType.SUBTITLE_TRACK:return I.PlaylistLevelType.SUBTITLE;default:return I.PlaylistLevelType.MAIN}}function f(r,d){var o=r.url;return(o===void 0||o.indexOf("data:")===0)&&(o=d.url),o}var u=function(){function r(o){this.hls=void 0,this.loaders=Object.create(null),this.hls=o,this.registerListeners()}var d=r.prototype;return d.registerListeners=function(){var s=this.hls;s.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),s.on(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.unregisterListeners=function(){var s=this.hls;s.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(F.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),s.off(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.createInternalLoader=function(s){var l=this.hls.config,p=l.pLoader,R=l.loader,w=p||R,x=new w(l);return s.loader=x,this.loaders[s.type]=x,x},d.getInternalLoader=function(s){return this.loaders[s.type]},d.resetInternalLoader=function(s){this.loaders[s]&&delete this.loaders[s]},d.destroyInternalLoaders=function(){for(var s in this.loaders){var l=this.loaders[s];l&&l.destroy(),this.resetInternalLoader(s)}},d.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},d.onManifestLoading=function(s,l){var p=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:I.PlaylistContextType.MANIFEST,url:p,deliveryDirectives:null})},d.onLevelLoading=function(s,l){var p=l.id,R=l.level,w=l.url,x=l.deliveryDirectives;this.load({id:p,groupId:null,level:R,responseType:"text",type:I.PlaylistContextType.LEVEL,url:w,deliveryDirectives:x})},d.onAudioTrackLoading=function(s,l){var p=l.id,R=l.groupId,w=l.url,x=l.deliveryDirectives;this.load({id:p,groupId:R,level:null,responseType:"text",type:I.PlaylistContextType.AUDIO_TRACK,url:w,deliveryDirectives:x})},d.onSubtitleTrackLoading=function(s,l){var p=l.id,R=l.groupId,w=l.url,x=l.deliveryDirectives;this.load({id:p,groupId:R,level:null,responseType:"text",type:I.PlaylistContextType.SUBTITLE_TRACK,url:w,deliveryDirectives:x})},d.load=function(s){var l,p=this.hls.config,R=this.getInternalLoader(s);if(R){var w=R.context;if(w&&w.url===s.url){W.logger.trace("[playlist-loader]: playlist request ongoing");return}W.logger.log("[playlist-loader]: aborting previous loader for type: "+s.type),R.abort()}var x,O,A,T;switch(s.type){case I.PlaylistContextType.MANIFEST:x=p.manifestLoadingMaxRetry,O=p.manifestLoadingTimeOut,A=p.manifestLoadingRetryDelay,T=p.manifestLoadingMaxRetryTimeout;break;case I.PlaylistContextType.LEVEL:case I.PlaylistContextType.AUDIO_TRACK:case I.PlaylistContextType.SUBTITLE_TRACK:x=0,O=p.levelLoadingTimeOut;break;default:x=p.levelLoadingMaxRetry,O=p.levelLoadingTimeOut,A=p.levelLoadingRetryDelay,T=p.levelLoadingMaxRetryTimeout;break}if(R=this.createInternalLoader(s),(l=s.deliveryDirectives)!==null&&l!==void 0&&l.part){var E;if(s.type===I.PlaylistContextType.LEVEL&&s.level!==null?E=this.hls.levels[s.level].details:s.type===I.PlaylistContextType.AUDIO_TRACK&&s.id!==null?E=this.hls.audioTracks[s.id].details:s.type===I.PlaylistContextType.SUBTITLE_TRACK&&s.id!==null&&(E=this.hls.subtitleTracks[s.id].details),E){var y=E.partTarget,h=E.targetduration;y&&h&&(O=Math.min(Math.max(y*3,h*.8)*1e3,O))}}var _={timeout:O,maxRetry:x,retryDelay:A,maxRetryDelay:T,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};R.load(s,_,g)},d.loadsuccess=function(s,l,p,R){if(R===void 0&&(R=null),p.isSidxRequest){this.handleSidxRequest(s,p),this.handlePlaylistLoaded(s,l,p,R);return}this.resetInternalLoader(p.type);var w=s.data;if(w.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(s,p,"no EXTM3U delimiter",R);return}l.parsing.start=performance.now(),w.indexOf("#EXTINF:")>0||w.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(s,l,p,R):this.handleMasterPlaylist(s,l,p,R)},d.loaderror=function(s,l,p){p===void 0&&(p=null),this.handleNetworkError(l,p,!1,s)},d.loadtimeout=function(s,l,p){p===void 0&&(p=null),this.handleNetworkError(l,p,!0)},d.handleMasterPlaylist=function(s,l,p,R){var w=this.hls,x=s.data,O=f(s,p),A=k.default.parseMasterPlaylist(x,O),T=A.levels,E=A.sessionData;if(!T.length){this.handleManifestParsingError(s,p,"no level found in manifest",R);return}var y=T.map(function(P){return{id:P.attrs.AUDIO,audioCodec:P.audioCodec}}),h=T.map(function(P){return{id:P.attrs.SUBTITLES,textCodec:P.textCodec}}),_=k.default.parseMasterPlaylistMedia(x,O,"AUDIO",y),g=k.default.parseMasterPlaylistMedia(x,O,"SUBTITLES",h),b=k.default.parseMasterPlaylistMedia(x,O,"CLOSED-CAPTIONS");if(_.length){var M=_.some(function(P){return!P.url});!M&&T[0].audioCodec&&!T[0].attrs.AUDIO&&(W.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),_.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new m.AttrList({}),bitrate:0,url:""}))}w.trigger(F.Events.MANIFEST_LOADED,{levels:T,audioTracks:_,subtitles:g,captions:b,url:O,stats:l,networkDetails:R,sessionData:E})},d.handleTrackOrLevelPlaylist=function(s,l,p,R){var w=this.hls,x=p.id,O=p.level,A=p.type,T=f(s,p),E=Object(Y.isFiniteNumber)(x)?x:0,y=Object(Y.isFiniteNumber)(O)?O:E,h=c(p),_=k.default.parseLevelPlaylist(s.data,T,y,h,E);if(!_.fragments.length){w.trigger(F.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:T,reason:"no fragments found in level",level:typeof p.level=="number"?p.level:void 0});return}if(A===I.PlaylistContextType.MANIFEST){var g={attrs:new m.AttrList({}),bitrate:0,details:_,name:"",url:T};w.trigger(F.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:T,stats:l,networkDetails:R,sessionData:null})}if(l.parsing.end=performance.now(),_.needSidxRanges){var b,M=(b=_.fragments[0].initSegment)===null||b===void 0?void 0:b.url;this.load({url:M,isSidxRequest:!0,type:A,level:O,levelDetails:_,id:x,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}p.levelDetails=_,this.handlePlaylistLoaded(s,l,p,R)},d.handleSidxRequest=function(s,l){var p=Object(j.parseSegmentIndex)(new Uint8Array(s.data));if(!p)return;var R=p.references,w=l.levelDetails;R.forEach(function(x,O){var A=x.info,T=w.fragments[O];T.byteRange.length===0&&T.setByteRange(String(1+A.end-A.start)+"@"+String(A.start)),T.initSegment&&T.initSegment.setByteRange(String(p.moovEndOffset)+"@0")})},d.handleManifestParsingError=function(s,l,p,R){this.hls.trigger(F.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===I.PlaylistContextType.MANIFEST,url:s.url,reason:p,response:s,context:l,networkDetails:R})},d.handleNetworkError=function(s,l,p,R){p===void 0&&(p=!1),W.logger.warn("[playlist-loader]: A network "+(p?"timeout":"error")+" occurred while loading "+s.type+" level: "+s.level+" id: "+s.id+' group-id: "'+s.groupId+'"');var w=U.ErrorDetails.UNKNOWN,x=!1,O=this.getInternalLoader(s);switch(s.type){case I.PlaylistContextType.MANIFEST:w=p?U.ErrorDetails.MANIFEST_LOAD_TIMEOUT:U.ErrorDetails.MANIFEST_LOAD_ERROR,x=!0;break;case I.PlaylistContextType.LEVEL:w=p?U.ErrorDetails.LEVEL_LOAD_TIMEOUT:U.ErrorDetails.LEVEL_LOAD_ERROR,x=!1;break;case I.PlaylistContextType.AUDIO_TRACK:w=p?U.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,x=!1;break;case I.PlaylistContextType.SUBTITLE_TRACK:w=p?U.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:U.ErrorDetails.SUBTITLE_LOAD_ERROR,x=!1;break}O&&this.resetInternalLoader(s.type);var A={type:U.ErrorTypes.NETWORK_ERROR,details:w,fatal:x,url:s.url,loader:O,context:s,networkDetails:l};R&&(A.response=R),this.hls.trigger(F.Events.ERROR,A)},d.handlePlaylistLoaded=function(s,l,p,R){var w=p.type,x=p.level,O=p.id,A=p.groupId,T=p.loader,E=p.levelDetails,y=p.deliveryDirectives;if(!(E!=null&&E.targetduration)){this.handleManifestParsingError(s,p,"invalid target duration",R);return}if(!T)return;E.live&&(T.getCacheAge&&(E.ageHeader=T.getCacheAge()||0),(!T.getCacheAge||isNaN(E.ageHeader))&&(E.ageHeader=0));switch(w){case I.PlaylistContextType.MANIFEST:case I.PlaylistContextType.LEVEL:this.hls.trigger(F.Events.LEVEL_LOADED,{details:E,level:x||0,id:O||0,stats:l,networkDetails:R,deliveryDirectives:y});break;case I.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(F.Events.AUDIO_TRACK_LOADED,{details:E,id:O||0,groupId:A||"",stats:l,networkDetails:R,deliveryDirectives:y});break;case I.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(F.Events.SUBTITLE_TRACK_LOADED,{details:E,id:O||0,groupId:A||"",stats:l,networkDetails:R,deliveryDirectives:y});break}},r}();J.default=u},"./src/polyfills/number.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"isFiniteNumber",function(){return Y}),D.d(J,"MAX_SAFE_INTEGER",function(){return F});var Y=Number.isFinite||function(U){return typeof U=="number"&&isFinite(U)},F=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ae,J,D){"use strict";D.r(J);var Y=function(){function F(){}return F.getSilentFrame=function(W,j){switch(W){case"mp4a.40.2":if(j===1)return new Uint8Array([0,200,0,128,35,128]);if(j===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(j===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(j===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(j===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(j===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(j===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(j===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(j===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},F}();J.default=Y},"./src/remux/mp4-generator.ts":function(ae,J,D){"use strict";D.r(J);var Y=Math.pow(2,32)-1,F=function(){function U(){}return U.init=function(){U.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 j;for(j in U.types)U.types.hasOwnProperty(j)&&(U.types[j]=[j.charCodeAt(0),j.charCodeAt(1),j.charCodeAt(2),j.charCodeAt(3)]);var k=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]),I=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]);U.HDLR_TYPES={video:k,audio:I};var m=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),c=new Uint8Array([0,0,0,0,0,0,0,0]);U.STTS=U.STSC=U.STCO=c,U.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),U.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),U.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),U.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var f=new Uint8Array([105,115,111,109]),u=new Uint8Array([97,118,99,49]),r=new Uint8Array([0,0,0,1]);U.FTYP=U.box(U.types.ftyp,f,r,f,u),U.DINF=U.box(U.types.dinf,U.box(U.types.dref,m))},U.box=function(j){for(var k=8,I=arguments.length,m=new Array(I>1?I-1:0),c=1;c>24&255,r[1]=k>>16&255,r[2]=k>>8&255,r[3]=k&255,r.set(j,4),f=0,k=8;f>24&255,j>>16&255,j>>8&255,j&255,I>>24,I>>16&255,I>>8&255,I&255,m>>24,m>>16&255,m>>8&255,m&255,85,196,0,0]))},U.mdia=function(j){return U.box(U.types.mdia,U.mdhd(j.timescale,j.duration),U.hdlr(j.type),U.minf(j))},U.mfhd=function(j){return U.box(U.types.mfhd,new Uint8Array([0,0,0,0,j>>24,j>>16&255,j>>8&255,j&255]))},U.minf=function(j){return j.type==="audio"?U.box(U.types.minf,U.box(U.types.smhd,U.SMHD),U.DINF,U.stbl(j)):U.box(U.types.minf,U.box(U.types.vmhd,U.VMHD),U.DINF,U.stbl(j))},U.moof=function(j,k,I){return U.box(U.types.moof,U.mfhd(j),U.traf(I,k))},U.moov=function(j){for(var k=j.length,I=[];k--;)I[k]=U.trak(j[k]);return U.box.apply(null,[U.types.moov,U.mvhd(j[0].timescale,j[0].duration)].concat(I).concat(U.mvex(j)))},U.mvex=function(j){for(var k=j.length,I=[];k--;)I[k]=U.trex(j[k]);return U.box.apply(null,[U.types.mvex].concat(I))},U.mvhd=function(j,k){k*=j;var I=Math.floor(k/(Y+1)),m=Math.floor(k%(Y+1)),c=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,j>>24&255,j>>16&255,j>>8&255,j&255,I>>24,I>>16&255,I>>8&255,I&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 U.box(U.types.mvhd,c)},U.sdtp=function(j){var k=j.samples||[],I=new Uint8Array(4+k.length),m,c;for(m=0;m>>8&255),k.push(f&255),k=k.concat(Array.prototype.slice.call(c));for(m=0;m>>8&255),I.push(f&255),I=I.concat(Array.prototype.slice.call(c));var u=U.box(U.types.avcC,new Uint8Array([1,k[3],k[4],k[5],252|3,224|j.sps.length].concat(k).concat([j.pps.length]).concat(I))),r=j.width,d=j.height,o=j.pixelRatio[0],s=j.pixelRatio[1];return U.box(U.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>8&255,r&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u,U.box(U.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),U.box(U.types.pasp,new Uint8Array([o>>24,o>>16&255,o>>8&255,o&255,s>>24,s>>16&255,s>>8&255,s&255])))},U.esds=function(j){var k=j.config.length;return new Uint8Array([0,0,0,0,3,23+k,0,1,0,4,15+k,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([k]).concat(j.config).concat([6,1,2]))},U.mp4a=function(j){var k=j.samplerate;return U.box(U.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]),U.box(U.types.esds,U.esds(j)))},U.mp3=function(j){var k=j.samplerate;return U.box(U.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,k>>8&255,k&255,0,0]))},U.stsd=function(j){return j.type==="audio"?!j.isAAC&&j.codec==="mp3"?U.box(U.types.stsd,U.STSD,U.mp3(j)):U.box(U.types.stsd,U.STSD,U.mp4a(j)):U.box(U.types.stsd,U.STSD,U.avc1(j))},U.tkhd=function(j){var k=j.id,I=j.duration*j.timescale,m=j.width,c=j.height,f=Math.floor(I/(Y+1)),u=Math.floor(I%(Y+1));return U.box(U.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,k>>24&255,k>>16&255,k>>8&255,k&255,0,0,0,0,f>>24,f>>16&255,f>>8&255,f&255,u>>24,u>>16&255,u>>8&255,u&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,c>>8&255,c&255,0,0]))},U.traf=function(j,k){var I=U.sdtp(j),m=j.id,c=Math.floor(k/(Y+1)),f=Math.floor(k%(Y+1));return U.box(U.types.traf,U.box(U.types.tfhd,new Uint8Array([0,0,0,0,m>>24,m>>16&255,m>>8&255,m&255])),U.box(U.types.tfdt,new Uint8Array([1,0,0,0,c>>24,c>>16&255,c>>8&255,c&255,f>>24,f>>16&255,f>>8&255,f&255])),U.trun(j,I.length+16+20+8+16+8+8),I)},U.trak=function(j){return j.duration=j.duration||4294967295,U.box(U.types.trak,U.tkhd(j),U.mdia(j))},U.trex=function(j){var k=j.id;return U.box(U.types.trex,new Uint8Array([0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},U.trun=function(j,k){var I=j.samples||[],m=I.length,c=12+16*m,f=new Uint8Array(c),u,r,d,o,s,l;for(k+=8+c,f.set([0,0,15,1,m>>>24&255,m>>>16&255,m>>>8&255,m&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255],0),u=0;u>>24&255,d>>>16&255,d>>>8&255,d&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,s.degradPrio&240<<8,s.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*u);return U.box(U.types.trun,f)},U.initSegment=function(j){U.types||U.init();var k=U.moov(j),I=new Uint8Array(U.FTYP.byteLength+k.byteLength);return I.set(U.FTYP),I.set(k,U.FTYP.byteLength),I},U}();F.types=void 0,F.HDLR_TYPES=void 0,F.STTS=void 0,F.STSC=void 0,F.STCO=void 0,F.STSZ=void 0,F.VMHD=void 0,F.SMHD=void 0,F.STSD=void 0,F.FTYP=void 0,F.DINF=void 0,J.default=F},"./src/remux/mp4-remuxer.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return l}),D.d(J,"normalizePts",function(){return p});var Y=D("./src/polyfills/number.ts"),F=D("./src/remux/aac-helper.ts"),U=D("./src/remux/mp4-generator.ts"),W=D("./src/events.ts"),j=D("./src/errors.ts"),k=D("./src/utils/logger.ts"),I=D("./src/types/loader.ts"),m=D("./src/utils/timescale-conversion.ts");function c(){return c=Object.assign||function(O){for(var A=1;A0?_:g.pts},E[0].pts);return y&&k.logger.debug("PTS rollover detected"),h},A.remux=function(E,y,h,_,g,b,M,P){var K,V,B,C,$,ee,re=g,ue=g,Te=E.pid>-1,ye=y.pid>-1,be=y.samples.length,we=E.samples.length>0,xe=be>1,me=(!Te||we)&&(!ye||xe)||this.ISGenerated||M;if(me){this.ISGenerated||(B=this.generateIS(E,y,g));var se=this.isVideoContiguous,Re=-1;if(xe&&(Re=R(y.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(ee=!0,Re>0){k.logger.warn("[mp4-remuxer]: Dropped "+Re+" out of "+be+" video samples due to a missing keyframe");var ze=this.getVideoStartPts(y.samples);y.samples=y.samples.slice(Re),y.dropped+=Re,ue+=(y.samples[0].pts-ze)/(y.timescale||9e4)}else Re===-1&&(k.logger.warn("[mp4-remuxer]: No keyframe found out of "+be+" video samples"),ee=!1);if(this.ISGenerated){if(we&&xe){var He=this.getVideoStartPts(y.samples),rt=p(E.samples[0].pts,He)-He,ot=rt/y.inputTimeScale;re+=Math.max(0,ot),ue+=Math.max(0,-ot)}if(we){if(E.samplerate||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),B=this.generateIS(E,y,g)),V=this.remuxAudio(E,re,this.isAudioContiguous,b,ye||xe||P===I.PlaylistLevelType.AUDIO?ue:void 0),xe){var Oe=V?V.endPTS-V.startPTS:0;y.inputTimeScale||(k.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),B=this.generateIS(E,y,g)),K=this.remuxVideo(y,ue,se,Oe)}}else xe&&(K=this.remuxVideo(y,ue,se,0));K&&(K.firstKeyFrame=Re,K.independent=Re!==-1)}}return this.ISGenerated&&(h.samples.length&&($=this.remuxID3(h,g)),_.samples.length&&(C=this.remuxText(_,g))),{audio:V,video:K,initSegment:B,independent:ee,text:C,id3:$}},A.generateIS=function(E,y,h){var _=E.samples,g=y.samples,b=this.typeSupported,M={},P=!Object(Y.isFiniteNumber)(this._initPTS),K="audio/mp4",V,B,C;if(P&&(V=B=Infinity),E.config&&_.length&&(E.timescale=E.samplerate,E.isAAC||(b.mpeg?(K="audio/mpeg",E.codec=""):b.mp3&&(E.codec="mp3")),M.audio={id:"audio",container:K,codec:E.codec,initSegment:!E.isAAC&&b.mpeg?new Uint8Array(0):U.default.initSegment([E]),metadata:{channelCount:E.channelCount}},P&&(C=E.inputTimeScale,V=B=_[0].pts-Math.round(C*h))),y.sps&&y.pps&&g.length&&(y.timescale=y.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:y.codec,initSegment:U.default.initSegment([y]),metadata:{width:y.width,height:y.height}},P)){C=y.inputTimeScale;var $=this.getVideoStartPts(g),ee=Math.round(C*h);B=Math.min(B,p(g[0].dts,$)-ee),V=Math.min(V,$-ee)}if(Object.keys(M).length)return this.ISGenerated=!0,P&&(this._initPTS=V,this._initDTS=B),{tracks:M,initPTS:V,timescale:C}},A.remuxVideo=function(E,y,h,_){var g=E.inputTimeScale,b=E.samples,M=[],P=b.length,K=this._initPTS,V=this.nextAvcDts,B=8,C,$,ee,re=Number.POSITIVE_INFINITY,ue=Number.NEGATIVE_INFINITY,Te=0,ye=!1;if(!h||V===null){var be=y*g,we=b[0].pts-p(b[0].dts,b[0].pts);V=be-we}for(var xe=0;xeme.pts){var se=9e4*.2;Te=Math.max(Math.min(Te,me.pts-me.dts),-1*se)}me.dts0?xe-1:xe].dts&&(ye=!0)}ye&&b.sort(function(mt,_t){var Qe=mt.dts-_t.dts,Ft=mt.pts-_t.pts;return Qe||Ft}),$=b[0].dts,ee=b[b.length-1].dts;var Re=Math.round((ee-$)/(P-1));if(Te<0){if(TeRe,Le=ot<-1;if(Oe||Le){Oe?k.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(ot,!0)+" ms ("+ot+"dts) hole between fragments detected, filling it"):k.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(-ot,!0)+" ms ("+ot+"dts) overlapping between fragments detected"),$=V;var Ue=b[0].pts-ot;b[0].dts=$,b[0].pts=Ue,k.logger.log("Video: First PTS/DTS adjusted: "+Object(m.toMsFromMpegTsClock)(Ue,!0)+"/"+Object(m.toMsFromMpegTsClock)($,!0)+", delta: "+Object(m.toMsFromMpegTsClock)(ot,!0)+" ms")}}s&&($=Math.max(0,$));for(var Ge=0,je=0,Me=0;Me0?Ae-1:Ae].dts;if(ie.stretchShortVideoTrack&&this.nextAudioPts!==null){var he=Math.floor(ie.maxBufferHole*g),ge=(_?re+_*g:this.nextAudioPts)-ct.pts;ge>he?(C=ge-oe,C<0&&(C=oe),k.logger.log("[mp4-remuxer]: It is approximately "+ge/90+" ms to the next segment; using duration "+C/90+" ms for the last video frame.")):C=oe}else C=oe}var Ce=Math.round(ct.pts-ct.dts);M.push(new w(ct.key,C,Se,Ce))}if(M.length&&d&&d<70){var De=M[0].flags;De.dependsOn=2,De.isNonSync=0}console.assert(C!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ee+C,this.isVideoContiguous=!0;var Ke=U.default.moof(E.sequenceNumber++,$,c({},E,{samples:M})),ht="video",it={data1:Ke,data2:nt,startPTS:re/g,endPTS:(ue+C)/g,startDTS:$/g,endDTS:V/g,type:ht,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:E.dropped};return E.samples=[],E.dropped=0,console.assert(nt.length,"MDAT length must not be zero"),it},A.remuxAudio=function(E,y,h,_,g){var b=E.inputTimeScale,M=E.samplerate?E.samplerate:b,P=b/M,K=E.isAAC?u:r,V=K*P,B=this._initPTS,C=!E.isAAC&&this.typeSupported.mpeg,$=[],ee=E.samples,re=C?0:8,ue=this.nextAudioPts||-1,Te=y*b;if(this.isAudioContiguous=h=h||ee.length&&ue>0&&(_&&Math.abs(Te-ue)<9e3||Math.abs(p(ee[0].pts-B,Te)-ue)<20*V),ee.forEach(function(pe){pe.pts=p(pe.pts-B,Te)}),!h||ue<0){if(ee=ee.filter(function(pe){return pe.pts>=0}),!ee.length)return;g===0?ue=0:_?ue=Math.max(0,Te):ue=ee[0].pts}if(E.isAAC)for(var ye=g!==void 0,be=this.config.maxAudioFramesDrift,we=0,xe=ue;we=be*V&&ze0){je+=re;try{Ge=new Uint8Array(je)}catch(pe){this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:j.ErrorTypes.MUX_ERROR,details:j.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:je,reason:"fail allocating audio mdat "+je});return}if(!C){var nt=new DataView(Ge.buffer);nt.setUint32(0,je),Ge.set(U.default.types.mdat,4)}}else return;Ge.set(qe,re);var Ye=qe.byteLength;re+=Ye,$.push(new w(!0,K,Ye,0)),Ue=$e}var Ae=$.length;if(!Ae)return;var ct=$[$.length-1];this.nextAudioPts=ue=Ue+P*ct.duration;var Je=C?new Uint8Array(0):U.default.moof(E.sequenceNumber++,Le/P,c({},E,{samples:$}));E.samples=[];var Se=Le/b,Ne=ue/b,ve="audio",de={data1:Je,data2:Ge,startPTS:Se,endPTS:Ne,startDTS:Se,endDTS:Ne,type:ve,hasAudio:!0,hasVideo:!1,nb:Ae};return this.isAudioContiguous=!0,console.assert(Ge.length,"MDAT length must not be zero"),de},A.remuxEmptyAudio=function(E,y,h,_){var g=E.inputTimeScale,b=E.samplerate?E.samplerate:g,M=g/b,P=this.nextAudioPts,K=(P!==null?P:_.startDTS*g)+this._initDTS,V=_.endDTS*g+this._initDTS,B=M*u,C=Math.ceil((V-K)/B),$=F.default.getSilentFrame(E.manifestCodec||E.codec,E.channelCount);if(k.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){k.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ee=[],re=0;re4294967296;)O+=T;return O}function R(O){for(var A=0;A0?this.lastEndDTS=E:(W.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var y=!!O.audio,h=!!O.video,_="";y&&(_+="audio"),h&&(_+="video");var g={data1:w,startPTS:T,startDTS:T,endPTS:E,endDTS:E,type:_,hasAudio:y,hasVideo:h,nb:1,dropped:0};return R.audio=g.type==="audio"?g:void 0,R.video=g.type!=="audio"?g:void 0,R.text=o,R.id3=d,R.initSegment=x,R},m}(),k=function(c,f,u){return Object(F.getStartDTS)(c,f)-u};function I(m,c){var f=m==null?void 0:m.codec;return f&&f.length>4?f:f==="hvc1"?"hvc1.1.c.L120.90":f==="av01"?"av01.0.04M.08":f==="avc1"||c===U.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}J.default=j},"./src/task-loop.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"default",function(){return Y});var Y=function(){function F(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var U=F.prototype;return U.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},U.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},U.onHandlerDestroyed=function(){},U.hasInterval=function(){return!!this._tickInterval},U.hasNextTick=function(){return!!this._tickTimer},U.setInterval=function(j){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,j),!0)},U.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},U.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},U.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},U.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},U.doTick=function(){},F}()},"./src/types/cmcd.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"CMCDVersion",function(){return Y}),D.d(J,"CMCDObjectType",function(){return F}),D.d(J,"CMCDStreamingFormat",function(){return U}),D.d(J,"CMCDStreamType",function(){return W});var Y=1,F;(function(j){j.MANIFEST="m",j.AUDIO="a",j.VIDEO="v",j.MUXED="av",j.INIT="i",j.CAPTION="c",j.TIMED_TEXT="tt",j.KEY="k",j.OTHER="o"})(F||(F={}));var U;(function(j){j.DASH="d",j.HLS="h",j.SMOOTH="s",j.OTHER="o"})(U||(U={}));var W;(function(j){j.VOD="v",j.LIVE="l"})(W||(W={}))},"./src/types/level.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"HlsSkip",function(){return U}),D.d(J,"getSkipValue",function(){return W}),D.d(J,"HlsUrlParameters",function(){return j}),D.d(J,"Level",function(){return k});function Y(I,m){for(var c=0;cNumber.MAX_SAFE_INTEGER?Infinity:m},j.hexadecimalInteger=function(I){if(this[I]){var m=(this[I]||"0x").slice(2);m=(m.length&1?"0":"")+m;for(var c=new Uint8Array(m.length/2),f=0;fNumber.MAX_SAFE_INTEGER?Infinity:m},j.decimalFloatingPoint=function(I){return parseFloat(this[I])},j.optionalFloat=function(I,m){var c=this[I];return c?parseFloat(c):m},j.enumeratedString=function(I){return this[I]},j.bool=function(I){return this[I]==="YES"},j.decimalResolution=function(I){var m=Y.exec(this[I]);return m===null?void 0:{width:parseInt(m[1],10),height:parseInt(m[2],10)}},W.parseAttrList=function(I){var m,c={},f='"';for(F.lastIndex=0;(m=F.exec(I))!==null;){var u=m[2];u.indexOf(f)===0&&u.lastIndexOf(f)===u.length-1&&(u=u.slice(1,-1)),c[m[1]]=u}return c},W}()},"./src/utils/binary-search.ts":function(ae,J,D){"use strict";D.r(J);var Y={search:function(U,W){for(var j=0,k=U.length-1,I=null,m=null;j<=k;){I=(j+k)/2|0,m=U[I];var c=W(m);if(c>0)j=I+1;else if(c<0)k=I-1;else return m}return null}};J.default=Y},"./src/utils/buffer-helper.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"BufferHelper",function(){return U});var Y=D("./src/utils/logger.ts"),F={length:0,start:function(){return 0},end:function(){return 0}},U=function(){function W(){}return W.isBuffered=function(k,I){try{if(k){for(var m=W.getBuffered(k),c=0;c=m.start(c)&&I<=m.end(c))return!0}}catch(f){}return!1},W.bufferInfo=function(k,I,m){try{if(k){var c=W.getBuffered(k),f=[],u;for(u=0;ur&&(c[u-1].end=k[f].end):c.push(k[f])}else c.push(k[f])}else c=k;for(var d=0,o,s=I,l=I,p=0;p=R&&I=h&&Y.logger.log(this.time+" ["+h+"] "+_)},T}(),d=function(E){for(var y=[],h=0;hj&&(this.logger.log(u.DEBUG,"Too large cursor position "+this.pos),this.pos=j)},E.moveCursor=function(h){var _=this.pos+h;if(h>1)for(var g=this.pos+1;g<_+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(_)},E.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},E.insertChar=function(h){h>=144&&this.backSpace();var _=U(h);if(this.pos>=j){this.logger.log(u.ERROR,"Cannot insert "+h.toString(16)+" ("+_+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(_,this.currPenState),this.moveCursor(1)},E.clearFromPos=function(h){var _;for(_=h;_0&&(h?g="["+_.join(" | ")+"]":g=_.join(` `)),g},E.getTextAndFormat=function(){return this.rows},T}(),R=function(){function T(y,h,_){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=y,this.outputFilter=h,this.mode=null,this.verbose=0,this.displayedMemory=new p(_),this.nonDisplayedMemory=new p(_),this.lastOutputScreen=new p(_),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=_}var E=T.prototype;return E.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[W-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},E.getHandler=function(){return this.outputFilter},E.setHandler=function(h){this.outputFilter=h},E.setPAC=function(h){this.writeScreen.setPAC(h)},E.setBkgData=function(h){this.writeScreen.setBkgData(h)},E.setMode=function(h){if(h===this.mode)return;this.mode=h,this.logger.log(u.INFO,"MODE="+h),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=h},E.insertChars=function(h){for(var _=0;_=46,_.italics)_.foreground="white";else{var g=Math.floor(h/2)-16,b=["white","green","blue","cyan","red","yellow","magenta"];_.foreground=b[g]}this.logger.log(u.INFO,"MIDROW: "+JSON.stringify(_)),this.writeScreen.setPen(_)},E.outputDataUpdate=function(h){h===void 0&&(h=!1);var _=this.logger.time;if(_===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=_:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,_,this.lastOutputScreen),h&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:_),this.lastOutputScreen.copy(this.displayedMemory))},E.cueSplitAtTime=function(h){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,h,this.displayedMemory),this.cueStartTime=h))},T}(),w=function(){function T(y,h,_){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new r;this.channels=[null,new R(y,h,g),new R(y+1,_,g)],this.cmdHistory=A(),this.logger=g}var E=T.prototype;return E.getHandler=function(h){return this.channels[h].getHandler()},E.setHandler=function(h,_){this.channels[h].setHandler(_)},E.addData=function(h,_){var g,b,M,P=!1;this.logger.time=h;for(var K=0;K<_.length;K+=2){if(b=_[K]&127,M=_[K+1]&127,b===0&&M===0)continue;if(this.logger.log(u.DATA,"["+d([_[K],_[K+1]])+"] -> ("+d([b,M])+")"),g=this.parseCmd(b,M),g||(g=this.parseMidrow(b,M)),g||(g=this.parsePAC(b,M)),g||(g=this.parseBackgroundAttributes(b,M)),!g&&(P=this.parseChars(b,M),P)){var V=this.currentChannel;if(V&&V>0){var B=this.channels[V];B.insertChars(P)}else this.logger.log(u.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!P&&this.logger.log(u.WARNING,"Couldn't parse cleaned data "+d([b,M])+" orig: "+d([_[K],_[K+1]]))}},E.parseCmd=function(h,_){var g=this.cmdHistory,b=(h===20||h===28||h===21||h===29)&&_>=32&&_<=47,M=(h===23||h===31)&&_>=33&&_<=35;if(!(b||M))return!1;if(O(h,_,g))return x(null,null,g),this.logger.log(u.DEBUG,"Repeated command ("+d([h,_])+") is dropped"),!0;var P=h===20||h===21||h===23?1:2,K=this.channels[P];return h===20||h===21||h===28||h===29?_===32?K.ccRCL():_===33?K.ccBS():_===34?K.ccAOF():_===35?K.ccAON():_===36?K.ccDER():_===37?K.ccRU(2):_===38?K.ccRU(3):_===39?K.ccRU(4):_===40?K.ccFON():_===41?K.ccRDC():_===42?K.ccTR():_===43?K.ccRTD():_===44?K.ccEDM():_===45?K.ccCR():_===46?K.ccENM():_===47&&K.ccEOC():K.ccTO(_-32),x(h,_,g),this.currentChannel=P,!0},E.parseMidrow=function(h,_){var g=0;if((h===17||h===25)&&_>=32&&_<=47){if(h===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(u.ERROR,"Mismatch channel in midrow parsing"),!1;var b=this.channels[g];return b?(b.ccMIDROW(_),this.logger.log(u.DEBUG,"MIDROW ("+d([h,_])+")"),!0):!1}return!1},E.parsePAC=function(h,_){var g,b=this.cmdHistory,M=(h>=17&&h<=23||h>=25&&h<=31)&&_>=64&&_<=127,P=(h===16||h===24)&&_>=64&&_<=95;if(!(M||P))return!1;if(O(h,_,b))return x(null,null,b),!0;var K=h<=23?1:2;_>=64&&_<=95?g=K===1?k[h]:m[h]:g=K===1?I[h]:c[h];var V=this.channels[K];return V?(V.setPAC(this.interpretPAC(g,_)),x(h,_,b),this.currentChannel=K,!0):!1},E.interpretPAC=function(h,_){var g,b={color:null,italics:!1,indent:null,underline:!1,row:h};return _>95?g=_-96:g=_-64,b.underline=(g&1)===1,g<=13?b.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(b.italics=!0,b.color="white"):b.indent=Math.floor((g-16)/2)*4,b},E.parseChars=function(h,_){var g,b=null,M=null;if(h>=25?(g=2,M=h-8):(g=1,M=h),M>=17&&M<=19){var P;M===17?P=_+80:M===18?P=_+112:P=_+144,this.logger.log(u.INFO,"Special char '"+U(P)+"' in channel "+g),b=[P]}else h>=32&&h<=127&&(b=_===0?[h]:[h,_]);if(b){var K=d(b);this.logger.log(u.DEBUG,"Char codes = "+K.join(",")),x(h,_,this.cmdHistory)}return b},E.parseBackgroundAttributes=function(h,_){var g=(h===16||h===24)&&_>=32&&_<=47,b=(h===23||h===31)&&_>=45&&_<=47;if(!(g||b))return!1;var M,P={};h===16||h===24?(M=Math.floor((_-32)/2),P.background=f[M],_%2===1&&(P.background=P.background+"_semi")):_===45?P.background="transparent":(P.foreground="black",_===47&&(P.underline=!0));var K=h<=23?1:2,V=this.channels[K];return V.setBkgData(P),x(h,_,this.cmdHistory),!0},E.reset=function(){for(var h=0;h=16?s--:s++;var x=Object(Y.fixLineBreaks)(l.trim()),O=Object(F.generateCueId)(m,c,x);(!I||!I.cues||!I.cues.getCueById(O))&&(d=new p(m,c,x),d.id=O,d.line=R+1,d.align="left",d.position=10+Math.min(80,Math.floor(s*8/32)*10),u.push(d))}return I&&u.length&&(u.sort(function(A,T){return A.line==="auto"||T.line==="auto"?0:A.line>8&&T.line>8?T.line-A.line:A.line-T.line}),u.forEach(function(A){return Object(U.addCueToTrack)(I,A)})),u}};J.default=j},"./src/utils/discontinuities.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"findFirstFragWithCC",function(){return W}),D.d(J,"shouldAlignOnDiscontinuities",function(){return j}),D.d(J,"findDiscontinuousReferenceFrag",function(){return k}),D.d(J,"adjustSlidingStart",function(){return m}),D.d(J,"alignStream",function(){return c}),D.d(J,"alignPDT",function(){return u}),D.d(J,"alignFragmentByPDTDelta",function(){return r}),D.d(J,"alignMediaPlaylistByPDT",function(){return d});var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/logger.ts"),U=D("./src/controller/level-helper.ts");function W(o,s){for(var l=null,p=0,R=o.length;pl.startCC||o&&o.cc=this.minWeight_},W.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},W.destroy=function(){},U}();J.default=F},"./src/utils/ewma.ts":function(ae,J,D){"use strict";D.r(J);var Y=function(){function F(W,j,k){j===void 0&&(j=0),k===void 0&&(k=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=W,this.alpha_=W?Math.exp(Math.log(.5)/W):0,this.estimate_=j,this.totalWeight_=k}var U=F.prototype;return U.sample=function(j,k){var I=Math.pow(this.alpha_,j);this.estimate_=k*(1-I)+I*this.estimate_,this.totalWeight_+=j},U.getTotalWeight=function(){return this.totalWeight_},U.getEstimate=function(){if(this.alpha_){var j=1-Math.pow(this.alpha_,this.totalWeight_);if(j)return this.estimate_/j}return this.estimate_},F}();J.default=Y},"./src/utils/fetch-loader.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"fetchSupported",function(){return r});var Y=D("./src/polyfills/number.ts"),F=D("./src/loader/load-stats.ts"),U=D("./src/demux/chunk-cache.ts");function W(p,R){p.prototype=Object.create(R.prototype),p.prototype.constructor=p,c(p,R)}function j(p){var R=typeof Map=="function"?new Map:void 0;return j=function(x){if(x===null||!m(x))return x;if(typeof x!="function")throw new TypeError("Super expression must either be null or a function");if(typeof R!="undefined"){if(R.has(x))return R.get(x);R.set(x,O)}function O(){return k(x,arguments,f(this).constructor)}return O.prototype=Object.create(x.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),c(O,x)},j(p)}function k(p,R,w){return I()?k=Reflect.construct:k=function(O,A,T){var E=[null];E.push.apply(E,A);var y=Function.bind.apply(O,E),h=new y;return T&&c(h,T.prototype),h},k.apply(null,arguments)}function I(){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(p){return!1}}function m(p){return Function.toString.call(p).indexOf("[native code]")!==-1}function c(p,R){return c=Object.setPrototypeOf||function(x,O){return x.__proto__=O,x},c(p,R)}function f(p){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(w){return w.__proto__||Object.getPrototypeOf(w)},f(p)}function u(){return u=Object.assign||function(p){for(var R=1;R=T&&E(O,A,y.flush(),x)):E(O,A,M,x),g()}).catch(function(){return Promise.reject()})};return _()},p}();function o(p,R){var w={method:"GET",mode:"cors",credentials:"same-origin",signal:R,headers:new self.Headers(u({},p.headers))};return p.rangeEnd&&w.headers.set("Range","bytes="+p.rangeStart+"-"+String(p.rangeEnd-1)),w}function s(p,R){return new self.Request(p.url,R)}var l=function(p){W(R,p);function R(w,x,O){var A;return A=p.call(this,w)||this,A.code=void 0,A.details=void 0,A.code=x,A.details=O,A}return R}(j(Error));J.default=d},"./src/utils/imsc1-ttml-parser.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"IMSC1_CODEC",function(){return m}),D.d(J,"parseIMSC1",function(){return r});var Y=D("./src/utils/mp4-tools.ts"),F=D("./src/utils/vttparser.ts"),U=D("./src/utils/vttcue.ts"),W=D("./src/demux/id3.ts"),j=D("./src/utils/timescale-conversion.ts"),k=D("./src/utils/webvtt-parser.ts");function I(){return I=Object.assign||function(T){for(var E=1;E"):Y}function j(m){for(var c=arguments.length,f=new Array(c>1?c-1:0),u=1;u>24,R[w+1]=x>>16&255,R[w+2]=x>>8&255,R[w+3]=x&255}function c(R,w){var x=[];if(!w.length)return x;var O,A,T;"data"in R?(O=R.data,A=R.start,T=R.end):(O=R,A=0,T=O.byteLength);for(var E=A;E1?E+y:T;if(h===w[0])if(w.length===1)x.push({data:O,start:E+8,end:_});else{var g=c({data:O,start:E+8,end:_},w.slice(1));g.length&&W.apply(x,g)}E=_}return x}function f(R){var w=c(R,["moov"]),x=w[0],O=x?x.end:null,A=c(R,["sidx"]);if(!A||!A[0])return null;var T=[],E=A[0],y=E.data[0],h=y===0?8:16,_=I(E,h);h+=4;var g=0,b=0;y===0?h+=8:h+=16,h+=2;var M=E.end+b,P=k(E,h);h+=2;for(var K=0;K>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ee=I(E,V);V+=4,T.push({referenceSize:C,subsegmentDuration:ee,info:{duration:ee/_,start:M,end:M+C-1}}),M+=C,V+=4,h=V}return{earliestPresentationTime:g,timescale:_,version:y,referencesCount:P,references:T,moovEndOffset:O}}function u(R){for(var w=[],x=c(R,["moov","trak"]),O=0;Oj)&&(this.startTime=j),this.endTime=k,this.screen=I,this.timelineController.createCaptionsTrack(this.trackName)},U.reset=function(){this.cueRanges=[]},F}()},"./src/utils/texttrack-utils.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"sendAddTrackEvent",function(){return F}),D.d(J,"addCueToTrack",function(){return U}),D.d(J,"clearCurrentCues",function(){return W}),D.d(J,"removeCuesInRange",function(){return j}),D.d(J,"getCuesInRange",function(){return I});var Y=D("./src/utils/logger.ts");function F(m,c){var f;try{f=new Event("addtrack")}catch(u){f=document.createEvent("Event"),f.initEvent("addtrack",!1,!1)}f.track=m,c.dispatchEvent(f)}function U(m,c){var f=m.mode;if(f==="disabled"&&(m.mode="hidden"),m.cues&&!m.cues.getCueById(c.id))try{if(m.addCue(c),!m.cues.getCueById(c.id))throw new Error("addCue is failed for: "+c)}catch(r){Y.logger.debug("[texttrack-utils]: "+r);var u=new self.TextTrackCue(c.startTime,c.endTime,c.text);u.id=c.id,m.addCue(u)}f==="disabled"&&(m.mode=f)}function W(m){var c=m.mode;if(c==="disabled"&&(m.mode="hidden"),m.cues)for(var f=m.cues.length;f--;)m.removeCue(m.cues[f]);c==="disabled"&&(m.mode=c)}function j(m,c,f){var u=m.mode;if(u==="disabled"&&(m.mode="hidden"),m.cues&&m.cues.length>0)for(var r=I(m.cues,c,f),d=0;dm[f].endTime)return-1;for(var u=0,r=f;u<=r;){var d=Math.floor((r+u)/2);if(cm[d].startTime&&u-1)for(var d=r,o=m.length;d=c&&s.endTime<=f)u.push(s);else if(s.startTime>f)return u}return u}},"./src/utils/time-ranges.ts":function(ae,J,D){"use strict";D.r(J);var Y={toString:function(U){for(var W="",j=U.length,k=0;k1?c-1:0),u=1;u100)throw new Error("Position must be between 0 and 100.");T=g,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",k({},r,{get:function(){return E},set:function(g){var b=j(g);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");E=b,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",k({},r,{get:function(){return y},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");y=g,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",k({},r,{get:function(){return h},set:function(g){var b=j(g);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");h=b,this.hasBeenReset=!0}})),u.displayState=void 0}return I.prototype.getCueAsHTML=function(){var m=self.WebVTT;return m.convertCueToDOMTree(self,this.text)},I}()},"./src/utils/vttparser.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"parseTimeStamp",function(){return U}),D.d(J,"fixLineBreaks",function(){return c}),D.d(J,"VTTParser",function(){return f});var Y=D("./src/utils/vttcue.ts"),F=function(){function u(){}var r=u.prototype;return r.decode=function(o,s){if(!o)return"";if(typeof o!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(o))},u}();function U(u){function r(o,s,l,p){return(o|0)*3600+(s|0)*60+(l|0)+parseFloat(p||0)}var d=u.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return d?parseFloat(d[2])>59?r(d[2],d[3],0,d[4]):r(d[1],d[2],d[3],d[4]):null}var W=function(){function u(){this.values=Object.create(null)}var r=u.prototype;return r.set=function(o,s){!this.get(o)&&s!==""&&(this.values[o]=s)},r.get=function(o,s,l){return l?this.has(o)?this.values[o]:s[l]:this.has(o)?this.values[o]:s},r.has=function(o){return o in this.values},r.alt=function(o,s,l){for(var p=0;p=0&&l<=100)return this.set(o,l),!0}return!1},u}();function j(u,r,d,o){var s=o?u.split(o):[u];for(var l in s){if(typeof s[l]!="string")continue;var p=s[l].split(d);if(p.length!==2)continue;var R=p[0],w=p[1];r(R,w)}}var k=new Y.default(0,0,""),I=k.align==="middle"?"middle":"center";function m(u,r,d){var o=u;function s(){var R=U(u);if(R===null)throw new Error("Malformed timestamp: "+o);return u=u.replace(/^[^\sa-zA-Z-]+/,""),R}function l(R,w){var x=new W;j(R,function(T,E){var y;switch(T){case"region":for(var h=d.length-1;h>=0;h--)if(d[h].id===E){x.set(T,d[h].region);break}break;case"vertical":x.alt(T,E,["rl","lr"]);break;case"line":y=E.split(","),x.integer(T,y[0]),x.percent(T,y[0])&&x.set("snapToLines",!1),x.alt(T,y[0],["auto"]),y.length===2&&x.alt("lineAlign",y[1],["start",I,"end"]);break;case"position":y=E.split(","),x.percent(T,y[0]),y.length===2&&x.alt("positionAlign",y[1],["start",I,"end","line-left","line-right","auto"]);break;case"size":x.percent(T,E);break;case"align":x.alt(T,E,["start",I,"end","left","right"]);break}},/:/,/\s/),w.region=x.get("region",null),w.vertical=x.get("vertical","");var O=x.get("line","auto");O==="auto"&&k.line===-1&&(O=-1),w.line=O,w.lineAlign=x.get("lineAlign","start"),w.snapToLines=x.get("snapToLines",!0),w.size=x.get("size",100),w.align=x.get("align",I);var A=x.get("position","auto");A==="auto"&&k.position===50&&(A=w.align==="start"||w.align==="left"?0:w.align==="end"||w.align==="right"?100:50),w.position=A}function p(){u=u.replace(/^\s+/,"")}if(p(),r.startTime=s(),p(),u.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+o);u=u.substr(3),p(),r.endTime=s(),p(),l(u,r)}function c(u){return u.replace(//gi,` `)}var f=function(){function u(){this.state="INITIAL",this.buffer="",this.decoder=new F,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var r=u.prototype;return r.parse=function(o){var s=this;o&&(s.buffer+=s.decoder.decode(o,{stream:!0}));function l(){var A=s.buffer,T=0;for(A=c(A);T")===-1){s.cue.id=R;continue}case"CUE":if(!s.cue){s.state="BADCUE";continue}try{m(R,s.cue,s.regionList)}catch(A){s.cue=null,s.state="BADCUE";continue}s.state="CUETEXT";continue;case"CUETEXT":{var O=R.indexOf("-->")!==-1;if(!R||O&&(x=!0)){s.oncue&&s.cue&&s.oncue(s.cue),s.cue=null,s.state="ID";continue}if(s.cue===null)continue;s.cue.text&&(s.cue.text+=` `),s.cue.text+=R}continue;case"BADCUE":R||(s.state="ID")}}}catch(A){s.state==="CUETEXT"&&s.cue&&s.oncue&&s.oncue(s.cue),s.cue=null,s.state=s.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},r.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(s){o.onparsingerror&&o.onparsingerror(s)}return o.onflush&&o.onflush(),this},u}()},"./src/utils/webvtt-parser.ts":function(ae,J,D){"use strict";D.r(J),D.d(J,"generateCueId",function(){return f}),D.d(J,"parseWebVTT",function(){return r});var Y=D("./src/polyfills/number.ts"),F=D("./src/utils/vttparser.ts"),U=D("./src/demux/id3.ts"),W=D("./src/utils/timescale-conversion.ts"),j=D("./src/remux/mp4-remuxer.ts"),k=/\r\n|\n\r|\n|\r/g,I=function(o,s,l){return l===void 0&&(l=0),o.substr(l,s.length)===s},m=function(o){var s=parseInt(o.substr(-3)),l=parseInt(o.substr(-6,2)),p=parseInt(o.substr(-9,2)),R=o.length>9?parseInt(o.substr(0,o.indexOf(":"))):0;if(!Object(Y.isFiniteNumber)(s)||!Object(Y.isFiniteNumber)(l)||!Object(Y.isFiniteNumber)(p)||!Object(Y.isFiniteNumber)(R))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+o);return s+=1e3*l,s+=60*1e3*p,s+=60*60*1e3*R,s},c=function(o){for(var s=5381,l=o.length;l;)s=s*33^o.charCodeAt(--l);return(s>>>0).toString()};function f(d,o,s){return c(d.toString())+c(o.toString())+c(s)}var u=function(o,s,l){var p=o[s],R=o[p.prevCC];if(!R||!R.new&&p.new){o.ccOffset=o.presentationOffset=p.start,p.new=!1;return}for(;(w=R)!==null&&w!==void 0&&w.new;){var w;o.ccOffset+=p.start-R.start,p.new=!1,p=R,R=o[p.prevCC]}o.presentationOffset=l};function r(d,o,s,l,p,R,w,x){var O=new F.VTTParser,A=Object(U.utf8ArrayToStr)(new Uint8Array(d)).trim().replace(k,` `).split(` `),T=[],E=Object(W.toMpegTsClockFromTimescale)(o,s),y="00:00.000",h=0,_=0,g,b=!0,M=!1;O.oncue=function(P){var K=l[p],V=l.ccOffset,B=(h-E)/9e4;if(K!=null&&K.new&&(_!==void 0?V=l.ccOffset=K.start:u(l,p,B)),B&&(V=B-l.presentationOffset),M){var C=P.endTime-P.startTime,$=Object(j.normalizePts)((P.startTime+V-_)*9e4,R*9e4)/9e4;P.startTime=$,P.endTime=$+C}var ee=P.text.trim();P.text=decodeURIComponent(encodeURIComponent(ee)),P.id||(P.id=f(P.startTime,P.endTime,ee)),P.endTime>0&&T.push(P)},O.onparsingerror=function(P){g=P},O.onflush=function(){if(g){x(g);return}w(T)},A.forEach(function(P){if(b)if(I(P,"X-TIMESTAMP-MAP=")){b=!1,M=!0,P.substr(16).split(",").forEach(function(K){I(K,"LOCAL:")?y=K.substr(6):I(K,"MPEGTS:")&&(h=parseInt(K.substr(7)))});try{_=m(y)/1e3}catch(K){M=!1,g=K}return}else P===""&&(b=!1);O.parse(P+` `)}),O.flush()}},"./src/utils/xhr-loader.ts":function(ae,J,D){"use strict";D.r(J);var Y=D("./src/utils/logger.ts"),F=D("./src/loader/load-stats.ts"),U=/^age:\s*[\d.]+\s*$/m,W=function(){function j(I){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=I?I.xhrSetup:null,this.stats=new F.LoadStats,this.retryDelay=0}var k=j.prototype;return k.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},k.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()))},k.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},k.load=function(m,c,f){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=c,this.callbacks=f,this.retryDelay=c.retryDelay,this.loadInternal()},k.loadInternal=function(){var m=this.config,c=this.context;if(!m)return;var f=this.loader=new self.XMLHttpRequest,u=this.stats;u.loading.first=0,u.loaded=0;var r=this.xhrSetup;try{if(r)try{r(f,c.url)}catch(s){f.open("GET",c.url,!0),r(f,c.url)}f.readyState||f.open("GET",c.url,!0);var d=this.context.headers;if(d)for(var o in d)f.setRequestHeader(o,d[o])}catch(s){this.callbacks.onError({code:f.status,text:s.message},c,f);return}c.rangeEnd&&f.setRequestHeader("Range","bytes="+c.rangeStart+"-"+(c.rangeEnd-1)),f.onreadystatechange=this.readystatechange.bind(this),f.onprogress=this.loadprogress.bind(this),f.responseType=c.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),m.timeout),f.send()},k.readystatechange=function(){var m=this.context,c=this.loader,f=this.stats;if(!m||!c)return;var u=c.readyState,r=this.config;if(f.aborted)return;if(u>=2)if(self.clearTimeout(this.requestTimeout),f.loading.first===0&&(f.loading.first=Math.max(self.performance.now(),f.loading.start)),u===4){c.onreadystatechange=null,c.onprogress=null;var d=c.status;if(d>=200&&d<300){f.loading.end=Math.max(self.performance.now(),f.loading.first);var o,s;if(m.responseType==="arraybuffer"?(o=c.response,s=o.byteLength):(o=c.responseText,s=o.length),f.loaded=f.total=s,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(f,m,o,c),!this.callbacks)return;var p={url:c.responseURL,data:o};this.callbacks.onSuccess(p,f,m,c)}else f.retry>=r.maxRetry||d>=400&&d<499?(Y.logger.error(d+" while loading "+m.url),this.callbacks.onError({code:d,text:c.statusText},m,c)):(Y.logger.warn(d+" 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,r.maxRetryDelay),f.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout)},k.loadtimeout=function(){Y.logger.warn("timeout while loading "+this.context.url);var m=this.callbacks;m&&(this.abortInternal(),m.onTimeout(this.stats,this.context,this.loader))},k.loadprogress=function(m){var c=this.stats;c.loaded=m.loaded,m.lengthComputable&&(c.total=m.total)},k.getCacheAge=function(){var m=null;if(this.loader&&U.test(this.loader.getAllResponseHeaders())){var c=this.loader.getResponseHeader("age");m=c?parseFloat(c):null}return m},j}();J.default=W}}).default})},vHTk:function(vt,et,ne){vt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);