(window.webpackJsonp=window.webpackJsonp||[]).push([[82,5,6,7],{"+NIl":function(ct,Qe,ne){(function(le){le(ne("VrN/"))})(function(le){"use strict";le.defineMode("stex",function(Z,P){"use strict";function Q(h,s){h.cmdState.push(s)}function H(h){return h.cmdState.length>0?h.cmdState[h.cmdState.length-1]:null}function F(h){var s=h.cmdState.pop();s&&s.closeBracket()}function K(h){for(var s=h.cmdState,d=s.length-1;d>=0;d--){var o=s[d];if(o.name=="DEFAULT")continue;return o}return{styleIdentifier:function(){return null}}}function W(h,s,d){return function(){this.name=h,this.bracketNo=0,this.style=s,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 M={};M.importmodule=W("importmodule","tag",["string","builtin"]),M.documentclass=W("documentclass","tag",["","atom"]),M.usepackage=W("usepackage","tag",["atom"]),M.begin=W("begin","tag",["atom"]),M.end=W("end","tag",["atom"]),M.label=W("label","tag",["atom"]),M.ref=W("ref","tag",["atom"]),M.eqref=W("eqref","tag",["atom"]),M.cite=W("cite","tag",["atom"]),M.bibitem=W("bibitem","tag",["atom"]),M.Bibitem=W("Bibitem","tag",["atom"]),M.RBibitem=W("RBibitem","tag",["atom"]),M.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(h,s){h.f=s}function g(h,s){var d;if(h.match(/^\\[a-zA-Z@]+/)){var o=h.current().slice(1);return d=M.hasOwnProperty(o)?M[o]:M.DEFAULT,d=new d,Q(s,d),R(s,f),d.style}if(h.match(/^\\[$&%#{}_]/))return"tag";if(h.match(/^\\[,;!\/\\]/))return"tag";if(h.match("\\["))return R(s,function(u,c){return p(u,c,"\\]")}),"keyword";if(h.match("\\("))return R(s,function(u,c){return p(u,c,"\\)")}),"keyword";if(h.match("$$"))return R(s,function(u,c){return p(u,c,"$$")}),"keyword";if(h.match("$"))return R(s,function(u,c){return p(u,c,"$")}),"keyword";var n=h.next();if(n=="%")return h.skipToEnd(),"comment";if(n=="}"||n=="]"){if(d=H(s),d)d.closeBracket(n),R(s,f);else return"error";return"bracket"}else return n=="{"||n=="["?(d=M.DEFAULT,d=new d,Q(s,d),"bracket"):/\d/.test(n)?(h.eatWhile(/[\w.%]/),"atom"):(h.eatWhile(/[\w\-_]/),d=K(s),d.name=="begin"&&(d.argument=h.current()),d.styleIdentifier())}function p(h,s,d){if(h.eatSpace())return null;if(d&&h.match(d))return R(s,g),"keyword";if(h.match(/^\\[a-zA-Z@]+/))return"tag";if(h.match(/^[a-zA-Z]+/))return"variable-2";if(h.match(/^\\[$&%#{}_]/))return"tag";if(h.match(/^\\[,;!\/]/))return"tag";if(h.match(/^[\^_&]/))return"tag";if(h.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(h.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var o=h.next();return o=="{"||o=="}"||o=="["||o=="]"||o=="("||o==")"?"bracket":o=="%"?(h.skipToEnd(),"comment"):"error"}function f(h,s){var d=h.peek(),o;return d=="{"||d=="["?(o=H(s),o.openBracket(d),h.eat(d),R(s,g),"bracket"):/[ \t\r]/.test(d)?(h.eat(d),null):(R(s,g),F(s),g(h,s))}return{startState:function(){var h=P.inMathMode?function(s,d){return p(s,d)}:g;return{cmdState:[],f:h}},copyState:function(h){return{cmdState:h.cmdState.slice(),f:h.f}},token:function(h,s){return s.f(h,s)},blankLine:function(h){h.f=g,h.cmdState.length=0},lineComment:"%"}}),le.defineMIME("text/x-stex","stex"),le.defineMIME("text/x-latex","stex")})},"+ua5":function(ct,Qe,ne){},"19Vz":function(ct,Qe,ne){(function(le){le(ne("VrN/"))})(function(le){le.defineOption("placeholder","",function(W,M,R){var g=R&&R!=le.Init;if(M&&!g)W.on("blur",H),W.on("change",F),W.on("swapDoc",F),le.on(W.getInputField(),"compositionupdate",W.state.placeholderCompose=function(){Q(W)}),F(W);else if(!M&&g){W.off("blur",H),W.off("change",F),W.off("swapDoc",F),le.off(W.getInputField(),"compositionupdate",W.state.placeholderCompose),Z(W);var p=W.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}M&&!W.hasFocus()&&H(W)});function Z(W){W.state.placeholder&&(W.state.placeholder.parentNode.removeChild(W.state.placeholder),W.state.placeholder=null)}function P(W){Z(W);var M=W.state.placeholder=document.createElement("pre");M.style.cssText="height: 0; overflow: visible",M.style.direction=W.getOption("direction"),M.className="CodeMirror-placeholder CodeMirror-line-like";var R=W.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),M.appendChild(R),W.display.lineSpace.insertBefore(M,W.display.lineSpace.firstChild)}function Q(W){setTimeout(function(){var M=!1,R=W.getInputField();R.nodeName=="TEXTAREA"?M=!R.value:W.lineCount()==1&&(M=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),M?P(W):Z(W)},20)}function H(W){K(W)&&P(W)}function F(W){var M=W.getWrapperElement(),R=K(W);M.className=M.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?P(W):Z(W)}function K(W){return W.lineCount()===1&&W.getLine(0)===""}})},"1eCo":function(ct,Qe,ne){(function(le){le(ne("VrN/"))})(function(le){"use strict";var Z={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},P={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};le.defineMode("xml",function(Q,H){var F=Q.indentUnit,K={},W=H.htmlMode?Z:P;for(var M in W)K[M]=W[M];for(var M in H)K[M]=H[M];var R,g;function p(l,E){function m(D){return E.tokenize=D,D(l,E)}var b=l.next();if(b=="<")return l.eat("!")?l.eat("[")?l.match("CDATA[")?m(s("atom","]]>")):null:l.match("--")?m(s("comment","-->")):l.match("DOCTYPE",!0,!0)?(l.eatWhile(/[\w\._\-]/),m(d(1))):null:l.eat("?")?(l.eatWhile(/[\w\._\-]/),E.tokenize=s("meta","?>"),"meta"):(R=l.eat("/")?"closeTag":"openTag",E.tokenize=f,"tag bracket");if(b=="&"){var N;return l.eat("#")?l.eat("x")?N=l.eatWhile(/[a-fA-F\d]/)&&l.eat(";"):N=l.eatWhile(/[\d]/)&&l.eat(";"):N=l.eatWhile(/[\w\.\-:]/)&&l.eat(";"),N?"atom":"error"}else return l.eatWhile(/[^&<]/),null}p.isInText=!0;function f(l,E){var m=l.next();if(m==">"||m=="/"&&l.eat(">"))return E.tokenize=p,R=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return R="equals",null;if(m=="<"){E.tokenize=p,E.state=c,E.tagName=E.tagStart=null;var b=E.tokenize(l,E);return b?b+" tag error":"tag error"}else return/[\'\"]/.test(m)?(E.tokenize=h(m),E.stringStartCol=l.column(),E.tokenize(l,E)):(l.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function h(l){var E=function(m,b){for(;!m.eol();)if(m.next()==l){b.tokenize=f;break}return"string"};return E.isInAttribute=!0,E}function s(l,E){return function(m,b){for(;!m.eol();){if(m.match(E)){b.tokenize=p;break}m.next()}return l}}function d(l){return function(E,m){for(var b;(b=E.next())!=null;){if(b=="<")return m.tokenize=d(l+1),m.tokenize(E,m);if(b==">")if(l==1){m.tokenize=p;break}else return m.tokenize=d(l-1),m.tokenize(E,m)}return"meta"}}function o(l,E,m){this.prev=l.context,this.tagName=E,this.indent=l.indented,this.startOfLine=m,(K.doNotIndent.hasOwnProperty(E)||l.context&&l.context.noIndent)&&(this.noIndent=!0)}function n(l){l.context&&(l.context=l.context.prev)}function u(l,E){for(var m;;){if(!l.context)return;if(m=l.context.tagName,!K.contextGrabbers.hasOwnProperty(m)||!K.contextGrabbers[m].hasOwnProperty(E))return;n(l)}}function c(l,E,m){return l=="openTag"?(m.tagStart=E.column(),L):l=="closeTag"?C:c}function L(l,E,m){return l=="word"?(m.tagName=E.current(),g="tag",w):K.allowMissingTagName&&l=="endTag"?(g="tag bracket",w(l,E,m)):(g="error",L)}function C(l,E,m){if(l=="word"){var b=E.current();return m.context&&m.context.tagName!=b&&K.implicitlyClosed.hasOwnProperty(m.context.tagName)&&n(m),m.context&&m.context.tagName==b||K.matchClosing===!1?(g="tag",x):(g="tag error",O)}else return K.allowMissingTagName&&l=="endTag"?(g="tag bracket",x(l,E,m)):(g="error",O)}function x(l,E,m){return l!="endTag"?(g="error",x):(n(m),c)}function O(l,E,m){return g="error",x(l,E,m)}function w(l,E,m){if(l=="word")return g="attribute",S;if(l=="endTag"||l=="selfcloseTag"){var b=m.tagName,N=m.tagStart;return m.tagName=m.tagStart=null,l=="selfcloseTag"||K.autoSelfClosers.hasOwnProperty(b)?u(m,b):(u(m,b),m.context=new o(m,b,N==m.indented)),c}return g="error",w}function S(l,E,m){return l=="equals"?T:(K.allowMissing||(g="error"),w(l,E,m))}function T(l,E,m){return l=="string"?_:l=="word"&&K.allowUnquoted?(g="string",w):(g="error",w(l,E,m))}function _(l,E,m){return l=="string"?_:w(l,E,m)}return{startState:function(l){var E={tokenize:p,state:c,indented:l||0,tagName:null,tagStart:null,context:null};return l!=null&&(E.baseIndent=l),E},token:function(l,E){if(!E.tagName&&l.sol()&&(E.indented=l.indentation()),l.eatSpace())return null;R=null;var m=E.tokenize(l,E);return(m||R)&&m!="comment"&&(g=null,E.state=E.state(R||m,l,E),g&&(m=g=="error"?m+" error":g)),m},indent:function(l,E,m){var b=l.context;if(l.tokenize.isInAttribute)return l.tagStart==l.indented?l.stringStartCol+1:l.indented+F;if(b&&b.noIndent)return le.Pass;if(l.tokenize!=f&&l.tokenize!=p)return m?m.match(/^(\s*)/)[0].length:0;if(l.tagName)return K.multilineTagIndentPastTag!==!1?l.tagStart+l.tagName.length+2:l.tagStart+F*(K.multilineTagIndentFactor||1);if(K.alignCDATA&&/$/,blockCommentStart:"",configuration:K.htmlMode?"html":"xml",helperType:K.htmlMode?"html":"xml",skipAttribute:function(l){l.state==T&&(l.state=w)},xmlCurrentTag:function(l){return l.tagName?{name:l.tagName,close:l.type=="closeTag"}:null},xmlCurrentContext:function(l){for(var E=[],m=l.context;m;m=m.prev)m.tagName&&E.push(m.tagName);return E.reverse()}}}),le.defineMIME("text/xml","xml"),le.defineMIME("application/xml","xml"),le.mimeModes.hasOwnProperty("text/html")||le.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(ct,Qe,ne){"use strict";ne.d(Qe,"a",function(){return C});var le=ne("+L6B"),Z=ne("2/Rp"),P=ne("2qtc"),Q=ne("kLXV"),H=ne("9og8"),F=ne("k1fw"),K=ne("miYZ"),W=ne("tsqr"),M=ne("oBTY"),R=ne("tJVT"),g=ne("DZo9"),p=ne("8z0m"),f=ne("WmNS"),h=ne.n(f),s=ne("q1tI"),d=ne.n(s),o=ne("m3rI"),n=ne("wzkS"),u=ne("y5JW"),c=ne("LtfV"),L=p.a.Dragger;function C(x){var O=[];return x&&x.length>0&&(O=x.map(function(w){return{uid:w.id,id:w.id,name:w.title+u.c+w.filesize,url:w.url,filesize:w.filesize,status:"done",response:{id:w.id}}})),O}Qe.b=function(x){var O=x.value,w=x.onChange,S=x.action,T=x.className,_=x.maxSize,l=_===void 0?150:_,E=x.title,m=E===void 0?"\u4E0A\u4F20\u9644\u4EF6":E,b=x.showRemoveModal,N=b===void 0?!1:b,D=x.accept,B=D===void 0?"":D,j=x.additionalText,I=x.isDragger,v=x.number,G=v===void 0?1e3:v,Y=x.aloneClear,re=Y===void 0?!1:Y,oe=Object(s.useState)(!1),we=Object(R.a)(oe,2),pe=we[0],Ee=we[1],_e=Object(s.useState)(O||[]),Ae=Object(R.a)(_e,2),fe=Ae[0],ue=Ae[1];Object(s.useEffect)(function(){O&&(ue(Object(M.a)(O)),G===(O==null?void 0:O.length)&&Ee(!0))},[O]);var ie=function(){setTimeout(function(){fe.pop(),ue(Object(M.a)(fe))},500)},de={multiple:!0,disabled:pe,accept:B,withCredentials:!0,fileList:fe,beforeUpload:function(ke,Te){var Ce=ke.size/1024/1024;return fe.concat(Te).length>G?(fe.pop(),ue(Object(M.a)(fe)),W.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(G,"\u4E2A\u6587\u4EF6")),re?Promise.reject():(ie(),!1)):!0},action:S||"".concat(o.a.API_SERVER,"/api/attachments.json"),onChange:function(ke){var Te,Ce,Le=Object(M.a)(ke.fileList);if(ke.file.status==="done"&&((Te=ke.file)===null||Te===void 0||((Ce=Te.response)===null||Ce===void 0)?void 0:Ce.status)===-1){var Be,Fe;W.b.error((Be=ke.file)===null||Be===void 0||((Fe=Be.response)===null||Fe===void 0)?void 0:Fe.message);return}Le.length>=G?Ee(!0):Ee(!1),ue(Object(M.a)(Le)),Le=Le.map(function(Me){var Ue;if(Me!=null&&(Ue=Me.response)!==null&&Ue!==void 0&&Ue.id){var Ve;Me.url="/api/attachments/".concat(Me==null||((Ve=Me.response)===null||Ve===void 0)?void 0:Ve.id)}return Me.name.indexOf(u.c)===-1&&(Me.name="".concat(Me.name).concat(u.c).concat(Object(u.a)(Me.size))),Object(F.a)({},Me)}),console.log("info:",ke),w(Le)},onRemove:function(){var Re=Object(H.a)(h.a.mark(function Te(Ce){var Le;return h.a.wrap(function(Fe){for(;;)switch(Fe.prev=Fe.next){case 0:if(Le=function(){var Me=Object(H.a)(h.a.mark(function Ue(){var Ve,$e;return h.a.wrap(function(Xe){for(;;)switch(Xe.prev=Xe.next){case 0:if(Ve=Ce.response?Ce.response.id:Ce.id,!Ve){Xe.next=8;break}return Xe.next=4,Object(n.d)(Ce.response?Ce.response.id:Ce.uid);case 4:return $e=Xe.sent,Xe.abrupt("return",$e);case 8:return Xe.abrupt("return",!0);case 9:case"end":return Xe.stop()}},Ue)}));return function(){return Me.apply(this,arguments)}}(),!N){Fe.next=5;break}return Fe.abrupt("return",new Promise(function(Me,Ue){Q.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:d.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var Ve=Object(H.a)(h.a.mark(function Ze(){var Xe;return h.a.wrap(function(et){for(;;)switch(et.prev=et.next){case 0:return et.next=2,Le();case 2:Xe=et.sent,W.b.success("\u5220\u9664\u6210\u529F"),Me(!0);case 5:case"end":return et.stop()}},Ze)}));function $e(){return Ve.apply(this,arguments)}return $e}(),onCancel:function(){return Me(!1)}})}));case 5:return Fe.next=7,Le();case 7:return Fe.abrupt("return",Fe.sent);case 8:case"end":return Fe.stop()}},Te)}));function ke(Te){return Re.apply(this,arguments)}return ke}()};function se(Re){Re.preventDefault(),Re.stopPropagation()}return d.a.createElement("div",{className:"multi-upload ".concat(T||"")},I&&d.a.createElement(L,de,d.a.createElement("p",{className:"ant-upload-drag-icon"},d.a.createElement(c.a,null)),d.a.createElement("p",{className:"ant-upload-text"},"\u70B9\u51FB\u4E0A\u4F20\u56FE\u6807\uFF0C\u9009\u62E9\u8981\u4E0A\u4F20\u7684\u6587\u4EF6\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64",d.a.createElement("br",null),"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",l,"MB)"," "),j),!I&&d.a.createElement(p.a,de,d.a.createElement(Z.a,{disabled:pe},m),d.a.createElement("span",{onClick:se,style:{marginLeft:10,color:"#FA6400"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",l,"MB)"," ")))}},"55Ip":function(ct,Qe,ne){"use strict";ne.d(Qe,"a",function(){return u});var le=ne("Ty5D"),Z=ne("dI71"),P=ne("q1tI"),Q=ne.n(P),H=ne("YS25"),F=ne("17x9"),K=ne.n(F),W=ne("wx14"),M=ne("zLVn"),R=ne("9R94"),g=function(T){Object(Z.a)(_,T);function _(){for(var E,m=arguments.length,b=new Array(m),N=0;NY&&(Y=v.line_indent_level));var re={mode:G,parent:v,last_token:v?v.last_token:new f(u.START_BLOCK,""),last_word:v?v.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:Y,alignment:0,line_indent_level:v?v.line_indent_level:Y,start_line_index:this._output.get_line_number(),ternary_depth:0};return re},j.prototype._reset=function(v){var G=v.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new p(this._options,G),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(l.BlockStatement);var Y=new d(v,this._options);return this._tokens=Y.tokenize(),v},j.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var v,G=this._reset(this._source_text),Y=this._options.eol;this._options.eol==="auto"&&(Y=` `,G&&h.lineBreak.test(G||"")&&(Y=G.match(h.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 v=this._output.get_code(Y),v},j.prototype.handle_token=function(v,G){v.type===u.START_EXPR?this.handle_start_expr(v):v.type===u.END_EXPR?this.handle_end_expr(v):v.type===u.START_BLOCK?this.handle_start_block(v):v.type===u.END_BLOCK?this.handle_end_block(v):v.type===u.WORD?this.handle_word(v):v.type===u.RESERVED?this.handle_word(v):v.type===u.SEMICOLON?this.handle_semicolon(v):v.type===u.STRING?this.handle_string(v):v.type===u.EQUALS?this.handle_equals(v):v.type===u.OPERATOR?this.handle_operator(v):v.type===u.COMMA?this.handle_comma(v):v.type===u.BLOCK_COMMENT?this.handle_block_comment(v,G):v.type===u.COMMENT?this.handle_comment(v,G):v.type===u.DOT?this.handle_dot(v):v.type===u.EOF?this.handle_eof(v):v.type===u.UNKNOWN?this.handle_unknown(v,G):this.handle_unknown(v,G)},j.prototype.handle_whitespace_and_comments=function(v,G){var Y=v.newlines,re=this._options.keep_array_indentation&&b(this._flags.mode);if(v.comments_before)for(var oe=v.comments_before.next();oe;)this.handle_whitespace_and_comments(oe,G),this.handle_token(oe,G),oe=v.comments_before.next();if(re)for(var we=0;we0,G);else if(this._options.max_preserve_newlines&&Y>this._options.max_preserve_newlines&&(Y=this._options.max_preserve_newlines),this._options.preserve_newlines&&Y>1){this.print_newline(!1,G);for(var pe=1;pe0&&(!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))},j.prototype.set_mode=function(v){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,v),this._flags=this.create_flags(this._previous_flags,v),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===l.Statement&&E(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},j.prototype.start_of_object_property=function(){return this._flags.parent.mode===l.ObjectLiteral&&this._flags.mode===l.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"]))},j.prototype.start_of_statement=function(v){var G=!1;return G=G||O(this._flags.last_token,["var","let","const"])&&v.type===u.WORD,G=G||x(this._flags.last_token,"do"),G=G||!(this._flags.parent.mode===l.ObjectLiteral&&this._flags.mode===l.Statement)&&O(this._flags.last_token,I)&&!v.newlines,G=G||x(this._flags.last_token,"else")&&!(x(v,"if")&&!v.comments_before),G=G||this._flags.last_token.type===u.END_EXPR&&(this._previous_flags.mode===l.ForInitializer||this._previous_flags.mode===l.Conditional),G=G||this._flags.last_token.type===u.WORD&&this._flags.mode===l.BlockStatement&&!this._flags.in_case&&!(v.text==="--"||v.text==="++")&&this._last_last_text!=="function"&&v.type!==u.WORD&&v.type!==u.RESERVED,G=G||this._flags.mode===l.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||O(this._flags.last_token,["get","set"])),G?(this.set_mode(l.Statement),this.indent(),this.handle_whitespace_and_comments(v,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v,O(v,["do","for","if","while"])),!0):!1},j.prototype.handle_start_expr=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v);var G=l.Expression;if(v.text==="["){if(this._flags.last_token.type===u.WORD||this._flags.last_token.text===")"){O(this._flags.last_token,o)&&(this._output.space_before_token=!0),this.print_token(v),this.set_mode(G),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}G=l.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())),c(this._flags.last_token.type,[u.START_EXPR,u.END_EXPR,u.WORD,u.OPERATOR,u.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===u.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,G=l.ForInitializer):c(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,G=l.Conditional):c(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&v.whitespace_before===""?this._output.space_before_token=!1:(c(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===u.EQUALS||this._flags.last_token.type===u.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v);else if(this._flags.last_token.type===u.WORD){this._output.space_before_token=!1;var Y=this._tokens.peek(-3);if(this._options.space_after_named_function&&Y){var re=this._tokens.peek(-4);O(Y,["async","function"])||Y.text==="*"&&O(re,["async","function"])?this._output.space_before_token=!0:this._flags.mode===l.ObjectLiteral?(Y.text==="{"||Y.text===","||Y.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(v);(this._flags.last_token.type===u.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(c(this._last_last_text,["function","yield"])||this._flags.mode===l.ObjectLiteral&&c(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===u.START_BLOCK?this.print_newline():(this._flags.last_token.type===u.END_EXPR||this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===u.COMMA)&&this.allow_wrap_or_preserved_newline(v,v.newlines),this.print_token(v),this.set_mode(G),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},j.prototype.handle_end_expr=function(v){for(;this._flags.mode===l.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(v,v.text==="]"&&b(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===u.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(v),this.restore_mode(),E(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===l.Conditional&&(this._previous_flags.mode=l.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},j.prototype.handle_start_block=function(v){this.handle_whitespace_and_comments(v);var G=this._tokens.peek(),Y=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===u.END_EXPR?(this.set_mode(l.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(l.BlockStatement):Y&&(c(Y.text,[":",","])&&c(G.type,[u.STRING,u.WORD,u.RESERVED])||c(G.text,["get","set","..."])&&c(Y.type,[u.WORD,u.RESERVED]))?c(this._last_last_text,["class","interface"])&&!c(Y.text,[":",","])?this.set_mode(l.BlockStatement):this.set_mode(l.ObjectLiteral):this._flags.last_token.type===u.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(l.BlockStatement):c(this._flags.last_token.type,[u.EQUALS,u.START_EXPR,u.COMMA,u.OPERATOR])||O(this._flags.last_token,["return","throw","import","default"])?this.set_mode(l.ObjectLiteral):this.set_mode(l.BlockStatement),this._flags.last_token&&(O(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var re=!G.comments_before&&G.text==="}",oe=re&&this._flags.last_word==="function"&&this._flags.last_token.type===u.END_EXPR;if(this._options.brace_preserve_inline){var we=0,pe=null;this._flags.inline_frame=!0;do if(we+=1,pe=this._tokens.peek(we-1),pe.newlines){this._flags.inline_frame=!1;break}while(pe.type!==u.EOF&&!(pe.type===u.END_BLOCK&&pe.opened===v))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==u.OPERATOR&&(oe||this._flags.last_token.type===u.EQUALS||O(this._flags.last_token,w)&&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===u.START_EXPR||this._flags.last_token.type===u.COMMA)&&((this._flags.last_token.type===u.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(v),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==u.OPERATOR&&this._flags.last_token.type!==u.START_EXPR&&(this._flags.last_token.type===u.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(v),this.indent(),!re&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},j.prototype.handle_end_block=function(v){for(this.handle_whitespace_and_comments(v);this._flags.mode===l.Statement;)this.restore_mode();var G=this._flags.last_token.type===u.START_BLOCK;this._flags.inline_frame&&!G?this._output.space_before_token=!0:this._options.brace_style==="expand"?G||this.print_newline():G||(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(v)},j.prototype.handle_word=function(v){if(v.type===u.RESERVED){if(c(v.text,["set","get"])&&this._flags.mode!==l.ObjectLiteral)v.type=u.WORD;else if(v.text==="import"&&c(this._tokens.peek().text,["(","."]))v.type=u.WORD;else if(c(v.text,["as","from"])&&!this._flags.import_block)v.type=u.WORD;else if(this._flags.mode===l.ObjectLiteral){var G=this._tokens.peek();G.text===":"&&(v.type=u.WORD)}}if(this.start_of_statement(v)?O(this._flags.last_token,["var","let","const"])&&v.type===u.WORD&&(this._flags.declaration_statement=!0):v.newlines&&!N(this._flags.mode)&&(this._flags.last_token.type!==u.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==u.EQUALS&&(this._options.preserve_newlines||!O(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(v),this.print_newline()):this.handle_whitespace_and_comments(v),this._flags.do_block&&!this._flags.do_while)if(x(v,"while")){this._output.space_before_token=!0,this.print_token(v),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(v,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===l.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&O(v,["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(v),this._flags.in_case=!0;return}if((this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.EQUALS||this._flags.last_token.type===u.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v)),x(v,"function")){(c(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(c(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===u.OPERATOR))&&(!this._output.just_added_blankline()&&!v.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===u.RESERVED||this._flags.last_token.type===u.WORD?O(this._flags.last_token,["get","set","new","export"])||O(this._flags.last_token,I)?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===u.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(N(this._flags.mode)||b(this._flags.mode))||this.print_newline(),this.print_token(v),this._flags.last_word=v.text;return}var Y="NONE";if(this._flags.last_token.type===u.END_BLOCK?this._previous_flags.inline_frame?Y="SPACE":O(v,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines?Y="NEWLINE":(Y="SPACE",this._output.space_before_token=!0):Y="NEWLINE":this._flags.last_token.type===u.SEMICOLON&&this._flags.mode===l.BlockStatement?Y="NEWLINE":this._flags.last_token.type===u.SEMICOLON&&N(this._flags.mode)?Y="SPACE":this._flags.last_token.type===u.STRING?Y="NEWLINE":this._flags.last_token.type===u.RESERVED||this._flags.last_token.type===u.WORD||this._flags.last_token.text==="*"&&(c(this._last_last_text,["function","yield"])||this._flags.mode===l.ObjectLiteral&&c(this._last_last_text,["{",","]))?Y="SPACE":this._flags.last_token.type===u.START_BLOCK?this._flags.inline_frame?Y="SPACE":Y="NEWLINE":this._flags.last_token.type===u.END_EXPR&&(this._output.space_before_token=!0,Y="NEWLINE"),O(v,o)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?Y="SPACE":Y="NEWLINE"),O(v,["else","catch","finally"]))if((!(this._flags.last_token.type===u.END_BLOCK&&this._previous_flags.mode===l.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.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 Y==="NEWLINE"?O(this._flags.last_token,w)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&O(v,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==u.END_EXPR?(this._flags.last_token.type!==u.START_EXPR||!O(v,["var","let","const"]))&&this._flags.last_token.text!==":"&&(x(v,"if")&&x(v.previous,"else")?this._output.space_before_token=!0:this.print_newline()):O(v,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():Y==="SPACE"&&(this._output.space_before_token=!0);v.previous&&(v.previous.type===u.WORD||v.previous.type===u.RESERVED)&&(this._output.space_before_token=!0),this.print_token(v),this._flags.last_word=v.text,v.type===u.RESERVED&&(v.text==="do"?this._flags.do_block=!0:v.text==="if"?this._flags.if_block=!0:v.text==="import"?this._flags.import_block=!0:this._flags.import_block&&x(v,"from")&&(this._flags.import_block=!1))},j.prototype.handle_semicolon=function(v){this.start_of_statement(v)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(v);for(var G=this._tokens.peek();this._flags.mode===l.Statement&&!(this._flags.if_block&&x(G,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(v)},j.prototype.handle_string=function(v){v.text.startsWith("`")&&v.newlines===0&&v.whitespace_before===""&&(v.previous.text===")"||this._flags.last_token.type===u.WORD)||(this.start_of_statement(v)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(v),this._flags.last_token.type===u.RESERVED||this._flags.last_token.type===u.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR||this._flags.last_token.type===u.EQUALS||this._flags.last_token.type===u.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v):v.text.startsWith("`")&&this._flags.last_token.type===u.END_EXPR&&(v.previous.text==="]"||v.previous.text===")")&&v.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(v)},j.prototype.handle_equals=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0},j.prototype.handle_comma=function(v){this.handle_whitespace_and_comments(v,!0),this.print_token(v),this._output.space_before_token=!0,this._flags.declaration_statement?(N(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(v)):this._flags.mode===l.ObjectLiteral||this._flags.mode===l.Statement&&this._flags.parent.mode===l.ObjectLiteral?(this._flags.mode===l.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(v)},j.prototype.handle_operator=function(v){var G=v.text==="*"&&(O(this._flags.last_token,["function","yield"])||c(this._flags.last_token.type,[u.START_BLOCK,u.COMMA,u.END_BLOCK,u.SEMICOLON])),Y=c(v.text,["-","+"])&&(c(this._flags.last_token.type,[u.START_BLOCK,u.START_EXPR,u.EQUALS,u.OPERATOR])||c(this._flags.last_token.text,o)||this._flags.last_token.text===",");if(!this.start_of_statement(v)){var re=!G;this.handle_whitespace_and_comments(v,re)}if(v.text==="*"&&this._flags.last_token.type===u.DOT){this.print_token(v);return}if(v.text==="::"){this.print_token(v);return}if(this._flags.last_token.type===u.OPERATOR&&c(this._options.operator_position,_)&&this.allow_wrap_or_preserved_newline(v),v.text===":"&&this._flags.in_case){this.print_token(v),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==u.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 oe=!0,we=!0,pe=!1;if(v.text===":"?this._flags.ternary_depth===0?oe=!1:(this._flags.ternary_depth-=1,pe=!0):v.text==="?"&&(this._flags.ternary_depth+=1),!Y&&!G&&this._options.preserve_newlines&&c(v.text,n)){var Ee=v.text===":",_e=Ee&&pe,Ae=Ee&&!pe;switch(this._options.operator_position){case T.before_newline:this._output.space_before_token=!Ae,this.print_token(v),(!Ee||_e)&&this.allow_wrap_or_preserved_newline(v),this._output.space_before_token=!0;return;case T.after_newline:this._output.space_before_token=!0,!Ee||_e?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(v):this._output.space_before_token=!1,this.print_token(v),this._output.space_before_token=!0;return;case T.preserve_newline:Ae||this.allow_wrap_or_preserved_newline(v),oe=!(this._output.just_added_newline()||Ae),this._output.space_before_token=oe,this.print_token(v),this._output.space_before_token=!0;return}}if(G){this.allow_wrap_or_preserved_newline(v),oe=!1;var fe=this._tokens.peek();we=fe&&c(fe.type,[u.WORD,u.RESERVED])}else if(v.text==="...")this.allow_wrap_or_preserved_newline(v),oe=this._flags.last_token.type===u.START_BLOCK,we=!1;else if(c(v.text,["--","++","!","~"])||Y){if((this._flags.last_token.type===u.COMMA||this._flags.last_token.type===u.START_EXPR)&&this.allow_wrap_or_preserved_newline(v),oe=!1,we=!1,v.newlines&&(v.text==="--"||v.text==="++"||v.text==="~")){var ue=O(this._flags.last_token,w)&&v.newlines;ue&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(ue,!0)}this._flags.last_token.text===";"&&N(this._flags.mode)&&(oe=!0),this._flags.last_token.type===u.RESERVED?oe=!0:this._flags.last_token.type===u.END_EXPR?oe=!(this._flags.last_token.text==="]"&&(v.text==="--"||v.text==="++")):this._flags.last_token.type===u.OPERATOR&&(oe=c(v.text,["--","-","++","+"])&&c(this._flags.last_token.text,["--","-","++","+"]),c(v.text,["+","-"])&&c(this._flags.last_token.text,["--","++"])&&(we=!0)),(this._flags.mode===l.BlockStatement&&!this._flags.inline_frame||this._flags.mode===l.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||oe,this.print_token(v),this._output.space_before_token=we},j.prototype.handle_block_comment=function(v,G){if(this._output.raw){this._output.add_raw_token(v),v.directives&&v.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(v.directives){this.print_newline(!1,G),this.print_token(v),v.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!h.newline.test(v.text)&&!v.newlines){this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0;return}else this.print_block_commment(v,G)},j.prototype.print_block_commment=function(v,G){var Y=m(v.text),re,oe=!1,we=!1,pe=v.whitespace_before,Ee=pe.length;if(this.print_newline(!1,G),this.print_token_line_indentation(v),this._output.add_token(Y[0]),this.print_newline(!1,G),Y.length>1){for(Y=Y.slice(1),oe=D(Y,"*"),we=B(Y,pe),oe&&(this._flags.alignment=1),re=0;re=0;h--)if(this.__items[h].match(f))return!0;return!1},R.prototype.set_indent=function(f,h){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=h||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},R.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)},R.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},R.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},R.prototype.is_empty=function(){return this.__items.length===0},R.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},R.prototype.push=function(f){this.__items.push(f);var h=f.lastIndexOf(` `);h!==-1?this.__character_count=f.length-h:this.__character_count+=f.length},R.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},R.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},R.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},R.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},R.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 g(f,h){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)),h=h||"",f.indent_level>0&&(h=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=h,this.__base_string_length=h.length}g.prototype.get_indent_size=function(f,h){var s=this.__base_string_length;return h=h||0,f<0&&(s=0),s+=f*this.__indent_size,s+=h,s},g.prototype.get_indent_string=function(f,h){var s=this.__base_string;return h=h||0,f<0&&(f=0,s=""),h+=f*this.__indent_size,this.__ensure_cache(h),s+=this.__cache[h],s},g.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var f=this.__cache.length,h=0,s="";this.__indent_size&&f>=this.__indent_size&&(h=Math.floor(f/this.__indent_size),f-=h*this.__indent_size,s=new Array(h+1).join(this.__indent_string)),f&&(s+=new Array(f+1).join(" ")),this.__cache.push(s)};function p(f,h){this.__indent_cache=new g(f,h),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 R(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}p.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},p.prototype.get_line_number=function(){return this.__lines.length},p.prototype.get_indent_string=function(f,h){return this.__indent_cache.get_indent_string(f,h)},p.prototype.get_indent_size=function(f,h){return this.__indent_cache.get_indent_size(f,h)},p.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},p.prototype.add_new_line=function(f){return this.is_empty()||!f&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},p.prototype.get_code=function(f){this.trim(!0);var h=this.current_line.pop();h&&(h[h.length-1]===` `&&(h=h.replace(/\n+$/g,"")),this.current_line.push(h)),this._end_with_newline&&this.__add_outputline();var s=this.__lines.join(` `);return f!==` `&&(s=s.replace(/[\n]/g,f)),s},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(f,h){return f=f||0,h=h||0,this.next_line.set_indent(f,h),this.__lines.length>1?(this.current_line.set_indent(f,h),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(f){for(var h=0;h1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(f,h){for(var s=this.__lines.length-2;s>=0;){var d=this.__lines[s];if(d.is_empty())break;if(d.item(0).indexOf(f)!==0&&d.item(-1)!==h){this.__lines.splice(s+1,0,new R(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},M.exports.Output=p},function(M){function R(g,p,f,h){this.type=g,this.text=p,this.comments_before=null,this.newlines=f||0,this.whitespace_before=h||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}M.exports.Token=R},function(M,R){var g="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",p="\\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",h="\\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",s="(?:\\\\u[0-9a-fA-F]{4}|["+g+f+"])",d="(?:\\\\u[0-9a-fA-F]{4}|["+p+f+h+"])*";R.identifier=new RegExp(s+d,"g"),R.identifierStart=new RegExp(s),R.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+p+f+h+"])+");var o=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;R.newline=/[\n\r\u2028\u2029]/,R.lineBreak=new RegExp(`\r |`+R.newline.source),R.allLineBreaks=new RegExp(R.lineBreak.source,"g")},function(M,R,g){var p=g(6).Options,f=["before-newline","after-newline","preserve-newline"];function h(s){p.call(this,s,"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 n=0;n>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),S=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";S=S.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),S="\\?\\.(?!\\d) "+S,S=S.replace(/ /g,"|");var T=new RegExp(S),_="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),l=_.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),E=new RegExp("^(?:"+l.join("|")+")$"),m,b=function(D,B){f.call(this,D,B),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var j=new o(this._input),I=new n(this._input).read_options(this._options);this.__patterns={template:I,identifier:I.starting_with(d.identifier).matching(d.identifierMatch),number:j.matching(C),punct:j.matching(T),comment:j.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:j.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:j.matching(//),include:j.starting_with(/#include/).until_after(d.lineBreak),shebang:j.starting_with(/#!/).until_after(d.lineBreak),xml:j.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:I.until(/['\\\n\r\u2028\u2029]/),double_quote:I.until(/["\\\n\r\u2028\u2029]/),template_text:I.until(/[`\\$]/),template_expression:I.until(/[`}\\]/)}};b.prototype=new f,b.prototype._is_comment=function(D){return D.type===c.COMMENT||D.type===c.BLOCK_COMMENT||D.type===c.UNKNOWN},b.prototype._is_opening=function(D){return D.type===c.START_BLOCK||D.type===c.START_EXPR},b.prototype._is_closing=function(D,B){return(D.type===c.END_BLOCK||D.type===c.END_EXPR)&&B&&(D.text==="]"&&B.text==="["||D.text===")"&&B.text==="("||D.text==="}"&&B.text==="{")},b.prototype._reset=function(){m=!1},b.prototype._get_next_token=function(D,B){var j=null;this._readWhitespace();var I=this._input.peek();return I===null?this._create_token(c.EOF,""):(j=j||this._read_non_javascript(I),j=j||this._read_string(I),j=j||this._read_word(D),j=j||this._read_singles(I),j=j||this._read_comment(I),j=j||this._read_regexp(I,D),j=j||this._read_xml(I,D),j=j||this._read_punctuation(),j=j||this._create_token(c.UNKNOWN,this._input.next()),j)},b.prototype._read_word=function(D){var B;if(B=this.__patterns.identifier.read(),B!=="")return B=B.replace(d.allLineBreaks,` `),!(D.type===c.DOT||D.type===c.RESERVED&&(D.text==="set"||D.text==="get"))&&E.test(B)?(B==="in"||B==="of")&&(D.type===c.WORD||D.type===c.STRING)?this._create_token(c.OPERATOR,B):this._create_token(c.RESERVED,B):this._create_token(c.WORD,B);if(B=this.__patterns.number.read(),B!=="")return this._create_token(c.WORD,B)},b.prototype._read_singles=function(D){var B=null;return D==="("||D==="["?B=this._create_token(c.START_EXPR,D):D===")"||D==="]"?B=this._create_token(c.END_EXPR,D):D==="{"?B=this._create_token(c.START_BLOCK,D):D==="}"?B=this._create_token(c.END_BLOCK,D):D===";"?B=this._create_token(c.SEMICOLON,D):D==="."&&O.test(this._input.peek(1))?B=this._create_token(c.DOT,D):D===","&&(B=this._create_token(c.COMMA,D)),B&&this._input.next(),B},b.prototype._read_punctuation=function(){var D=this.__patterns.punct.read();if(D!=="")return D==="="?this._create_token(c.EQUALS,D):D==="?."?this._create_token(c.DOT,D):this._create_token(c.OPERATOR,D)},b.prototype._read_non_javascript=function(D){var B="";if(D==="#"){if(this._is_first_token()&&(B=this.__patterns.shebang.read(),B))return this._create_token(c.UNKNOWN,B.trim()+` `);if(B=this.__patterns.include.read(),B)return this._create_token(c.UNKNOWN,B.trim()+` `);D=this._input.next();var j="#";if(this._input.hasNext()&&this._input.testChar(x)){do D=this._input.next(),j+=D;while(this._input.hasNext()&&D!=="#"&&D!=="=");return D==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(j+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(j+="{}",this._input.next(),this._input.next())),this._create_token(c.WORD,j)}this._input.back()}else if(D==="<"&&this._is_first_token()){if(B=this.__patterns.html_comment_start.read(),B){for(;this._input.hasNext()&&!this._input.testChar(d.newline);)B+=this._input.next();return m=!0,this._create_token(c.COMMENT,B)}}else if(m&&D==="-"&&(B=this.__patterns.html_comment_end.read(),B))return m=!1,this._create_token(c.COMMENT,B);return null},b.prototype._read_comment=function(D){var B=null;if(D==="/"){var j="";if(this._input.peek(1)==="*"){j=this.__patterns.block_comment.read();var I=L.get_directives(j);I&&I.ignore==="start"&&(j+=L.readIgnored(this._input)),j=j.replace(d.allLineBreaks,` `),B=this._create_token(c.BLOCK_COMMENT,j),B.directives=I}else this._input.peek(1)==="/"&&(j=this.__patterns.comment.read(),B=this._create_token(c.COMMENT,j))}return B},b.prototype._read_string=function(D){if(D==="`"||D==="'"||D==='"'){var B=this._input.next();return this.has_char_escapes=!1,D==="`"?B+=this._read_string_recursive("`",!0,"${"):B+=this._read_string_recursive(D),this.has_char_escapes&&this._options.unescape_strings&&(B=N(B)),this._input.peek()===D&&(B+=this._input.next()),B=B.replace(d.allLineBreaks,` `),this._create_token(c.STRING,B)}return null},b.prototype._allow_regexp_or_xml=function(D){return D.type===c.RESERVED&&u(D.text,["return","case","throw","else","do","typeof","yield"])||D.type===c.END_EXPR&&D.text===")"&&D.opened.previous.type===c.RESERVED&&u(D.opened.previous.text,["if","while","for"])||u(D.type,[c.COMMENT,c.START_EXPR,c.START_BLOCK,c.START,c.END_BLOCK,c.OPERATOR,c.EQUALS,c.EOF,c.SEMICOLON,c.COMMA])},b.prototype._read_regexp=function(D,B){if(D==="/"&&this._allow_regexp_or_xml(B)){for(var j=this._input.next(),I=!1,v=!1;this._input.hasNext()&&(I||v||this._input.peek()!==D)&&!this._input.testChar(d.newline);)j+=this._input.peek(),I?I=!1:(I=this._input.peek()==="\\",this._input.peek()==="["?v=!0:this._input.peek()==="]"&&(v=!1)),this._input.next();return this._input.peek()===D&&(j+=this._input.next(),j+=this._input.read(d.identifier)),this._create_token(c.STRING,j)}return null},b.prototype._read_xml=function(D,B){if(this._options.e4x&&D==="<"&&this._allow_regexp_or_xml(B)){var j="",I=this.__patterns.xml.read_match();if(I){for(var v=I[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),G=v.indexOf("{")===0,Y=0;I;){var re=!!I[1],oe=I[2],we=!!I[I.length-1]||oe.slice(0,8)==="![CDATA[";if(!we&&(oe===v||G&&oe.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(re?--Y:++Y),j+=I[0],Y<=0)break;I=this.__patterns.xml.read_match()}return I||(j+=this._input.match(/[\s\S]*/g)[0]),j=j.replace(d.allLineBreaks,` `),this._create_token(c.STRING,j)}}return null};function N(D){for(var B="",j=0,I=new p(D),v=null;I.hasNext();)if(v=I.match(/([\s]|[^\\]|\\\\)+/g),v&&(B+=v[0]),I.peek()==="\\"){if(I.next(),I.peek()==="x")v=I.match(/x([0-9A-Fa-f]{2})/g);else if(I.peek()==="u")v=I.match(/u([0-9A-Fa-f]{4})/g);else{B+="\\",I.hasNext()&&(B+=I.next());continue}if(!v)return D;if(j=parseInt(v[1],16),j>126&&j<=255&&v[0].indexOf("x")===0)return D;if(j>=0&&j<32){B+="\\"+v[0];continue}else j===34||j===39||j===92?B+="\\"+String.fromCharCode(j):B+=String.fromCharCode(j)}return B}b.prototype._read_string_recursive=function(D,B,j){var I,v;D==="'"?v=this.__patterns.single_quote:D==='"'?v=this.__patterns.double_quote:D==="`"?v=this.__patterns.template_text:D==="}"&&(v=this.__patterns.template_expression);for(var G=v.read(),Y="";this._input.hasNext();){if(Y=this._input.next(),Y===D||!B&&d.newline.test(Y)){this._input.back();break}else Y==="\\"&&this._input.hasNext()?(I=this._input.peek(),I==="x"||I==="u"?this.has_char_escapes=!0:I==="\r"&&this._input.peek(1)===` `&&this._input.next(),Y+=this._input.next()):j&&(j==="${"&&Y==="$"&&this._input.peek()==="{"&&(Y+=this._input.next()),j===Y&&(D==="`"?Y+=this._read_string_recursive("}",B,"`"):Y+=this._read_string_recursive("`",B,"${"),this._input.hasNext()&&(Y+=this._input.next())));Y+=v.read(),G+=Y}return G},M.exports.Tokenizer=b,M.exports.TOKEN=c,M.exports.positionable_operators=w.slice(),M.exports.line_starters=_.slice()},function(M){var R=RegExp.prototype.hasOwnProperty("sticky");function g(p){this.__input=p||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position=0&&p=0&&f=p.length&&this.__input.substring(f-p.length,f).toLowerCase()===p},M.exports.InputScanner=g},function(M,R,g){var p=g(8).InputScanner,f=g(3).Token,h=g(10).TokenStream,s=g(11).WhitespacePattern,d={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},o=function(n,u){this._input=new p(n),this._options=u||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new s(this._input)};o.prototype.tokenize=function(){this._input.restart(),this.__tokens=new h,this._reset();for(var n,u=new f(d.START,""),c=null,L=[],C=new h;u.type!==d.EOF;){for(n=this._get_next_token(u,c);this._is_comment(n);)C.add(n),n=this._get_next_token(u,c);C.isEmpty()||(n.comments_before=C,C=new h),n.parent=c,this._is_opening(n)?(L.push(c),c=n):c&&this._is_closing(n,c)&&(n.opened=c,c.closed=n,c=L.pop(),n.parent=c),n.previous=u,u.next=n,this.__tokens.add(n),u=n}return this.__tokens},o.prototype._is_first_token=function(){return this.__tokens.isEmpty()},o.prototype._reset=function(){},o.prototype._get_next_token=function(n,u){this._readWhitespace();var c=this._input.read(/.+/g);return c?this._create_token(d.RAW,c):this._create_token(d.EOF,"")},o.prototype._is_comment=function(n){return!1},o.prototype._is_opening=function(n){return!1},o.prototype._is_closing=function(n,u){return!1},o.prototype._create_token=function(n,u){var c=new f(n,u,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return c},o.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},M.exports.Tokenizer=o,M.exports.TOKEN=d},function(M){function R(g){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=g}R.prototype.restart=function(){this.__position=0},R.prototype.isEmpty=function(){return this.__tokens_length===0},R.prototype.hasNext=function(){return this.__position=0&&g/),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}/)}}h.prototype=new p,h.prototype._create=function(){return new h(this._input,this)},h.prototype._update=function(){this.__set_templated_pattern()},h.prototype.disable=function(s){var d=this._create();return d._disabled[s]=!0,d._update(),d},h.prototype.read_options=function(s){var d=this._create();for(var o in f)d._disabled[o]=s.templating.indexOf(o)===-1;return d._update(),d},h.prototype.exclude=function(s){var d=this._create();return d._excluded[s]=!0,d._update(),d},h.prototype.read=function(){var s="";this._match_pattern?s=this._input.read(this._starting_pattern):s=this._input.read(this._starting_pattern,this.__template_pattern);for(var d=this._read_template();d;)this._match_pattern?d+=this._input.read(this._match_pattern):d+=this._input.readUntil(this.__template_pattern),s+=d,d=this._read_template();return this._until_after&&(s+=this._input.readUntilAfter(this._until_pattern)),s},h.prototype.__set_templated_pattern=function(){var s=[];this._disabled.php||s.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||s.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||s.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(s.push(this.__patterns.django._starting_pattern.source),s.push(this.__patterns.django_value._starting_pattern.source),s.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||s.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&s.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+s.join("|")+")")},h.prototype._read_template=function(){var s="",d=this._input.peek();if(d==="<"){var o=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&o==="?"&&(s=s||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&o==="%"&&(s=s||this.__patterns.erb.read())}else d==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(s=s||this.__patterns.handlebars_comment.read(),s=s||this.__patterns.handlebars_unescaped.read(),s=s||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(s=s||this.__patterns.django_value.read()),this._excluded.django||(s=s||this.__patterns.django_comment.read(),s=s||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(s=s||this.__patterns.smarty_comment.read(),s=s||this.__patterns.smarty_literal.read(),s=s||this.__patterns.smarty.read()));return s},M.exports.TemplatablePattern=h}],F={};function K(M){var R=F[M];if(R!==void 0)return R.exports;var g=F[M]={exports:{}};return H[M](g,g.exports,K),g.exports}var W=K(0);P=W})();var Q=P;!(le=[],Z=function(){return{js_beautify:Q}}.apply(Qe,le),Z!==void 0&&(ct.exports=Z))})()},"7Cbv":function(ct,Qe,ne){"use strict";var le=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Z=new Uint8Array(16);function P(){if(!le)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return le(Z)}var Q=/^(?:[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 H(f){return typeof f=="string"&&Q.test(f)}for(var F=H,K=[],W=0;W<256;++W)K.push((W+256).toString(16).substr(1));function M(f){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=(K[f[h+0]]+K[f[h+1]]+K[f[h+2]]+K[f[h+3]]+"-"+K[f[h+4]]+K[f[h+5]]+"-"+K[f[h+6]]+K[f[h+7]]+"-"+K[f[h+8]]+K[f[h+9]]+"-"+K[f[h+10]]+K[f[h+11]]+K[f[h+12]]+K[f[h+13]]+K[f[h+14]]+K[f[h+15]]).toLowerCase();if(!F(s))throw TypeError("Stringified UUID is invalid");return s}var R=M;function g(f,h,s){f=f||{};var d=f.random||(f.rng||P)();if(d[6]=d[6]&15|64,d[8]=d[8]&63|128,h){s=s||0;for(var o=0;o<16;++o)h[s+o]=d[o];return h}return R(d)}var p=Qe.a=g},"7ahc":function(ct,Qe,ne){"use strict";ne.d(Qe,"a",function(){return L});var le=ne("k1fw"),Z=ne("0Owb"),P=ne("+L6B"),Q=ne("2/Rp"),H=ne("y8nQ"),F=ne("Vl3Y"),K=ne("tJVT"),W=ne("OaEy"),M=ne("2fM7"),R=ne("q1tI"),g=ne.n(R),p=ne("VrN/"),f=ne.n(p),h=ne("p77/"),s=ne.n(h),d=ne("c5Ni"),o=ne.n(d),n=M.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},c={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"]};Qe.b=function(C){var x=C.callback,O=C.onCancel,w=Object(R.useState)("python"),S=Object(K.a)(w,2),T=S[0],_=S[1];function l(m){_(c[m][1])}function E(m){x(m)}return g.a.createElement(F.a,Object(Z.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:E}),g.a.createElement(F.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},g.a.createElement(M.a,{onChange:l},Object.keys(c).map(function(m){return g.a.createElement(n,{key:m,value:m},c[m][0])}))),g.a.createElement(F.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},g.a.createElement(L,{mode:T})),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(Q.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(Q.a,{type:"ghost",onClick:O},"\u53D6\u6D88")))};function L(C){var x=C.value,O=C.onChange,w=C.mode,S=C.options,T=S===void 0?{}:S,_=Object(R.useRef)(),l=Object(R.useState)(),E=Object(K.a)(l,2),m=E[0],b=E[1];return Object(R.useEffect)(function(){if(m){function N(D){var B=D.getValue();O&&O(B)}return m.on("change",N),function(){m.off("change",N)}}},[m,O]),Object(R.useEffect)(function(){m&&m.setOption("mode",w)},[m,w]),Object(R.useEffect)(function(){m&&((x!==m.getValue()||x==="")&&setTimeout(function(){m.setValue(x||" ")},300))},[m,x]),Object(R.useEffect)(function(){if(_.current&&!m){var N=f.a.fromTextArea(_.current,Object(le.a)({mode:w,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},T));b(N)}},[_.current,m]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:_}))}},"8EBN":function(ct,Qe,ne){(function(le){le(ne("VrN/"))})(function(le){"use strict";le.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 Z=0;Z-1&&Q.substring(K+1,Q.length);if(W)return le.findModeByExtension(W)},le.findModeByName=function(Q){Q=Q.toLowerCase();for(var H=0;H=U.length?q.slice(U.length):q}).join(` `)}var o=[],n=["
    "],u=new h.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function L(){o.length=0,n=["
      "]}var C={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function x(X,y,A,U){if(y>=X.length||X[y].level<=A)return y;var q=X[y];U.push("
    • "+q.text+""),y++;var V=[];return y=x(X,y,q.level,V),V.length>0&&(U.push("
        "),V.forEach(function(ye){U.push(ye)}),U.push("
      ")),U.push("
    • "),y=x(X,y,A,U),y}function O(){return x(o,0,0,n),n.push("
    "),n.join("")}var w={heading:function(y){var A=c.exec(y);if(A)return{type:"heading",raw:A[0],depth:A[1].length,text:A[2]}},fences:function(y){var A=this.rules.block.fences.exec(y);if(A){var U=A[0],q=d(U,A[3]||""),V=A[2]?A[2].trim():A[2];if(["latex","katex","math"].indexOf(V)>=0){var ye=_(),He=q;q=ye,l[ye]={type:"block",expression:He}}return{type:"code",raw:U,lang:V,text:q}}}},S=/(?:\${2})([^\n`]+?)(?:\${2})/gi,T=0,_=function(){return"__special_katext_id_".concat(T++,"__")},l={};function E(){return l}function m(){T=0,l={}}function b(X){return X=X.replace(S,function(y,A){var U=_();return l[U]={type:"inline",expression:A},U}),X}var N=u.listitem;u.listitem=function(X){return N(b(X))};var D=u.paragraph;u.paragraph=function(X){return D(b(X))};var B=u.tablecell;u.tablecell=function(X,y){return B(b(X),y)},u.code=function(X,y,A){var U=(y||"").match(/\S*/)[0];return U?["latex","katex","math"].indexOf(U)>=0?"

    ".concat(X,"

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

    [TOC]

    ",O()),L()),Dt=Dt.replace(/(__special_katext_id_\d+__)/g,function(ir,ui){var wi=ri[ui],Vr=wi.type,Er=wi.expression;return Object(re.renderToString)(gr(Er)||"",{displayMode:Vr==="block",throwOnError:!1,output:"html"})}),Dt=Dt.replace(/▁/g,"\u2581\u2581\u2581"),m(),ye){var zt=document.createElement("div");return zt.innerHTML=Dt,zt.innerText}return setTimeout(function(){return dn()},500),Dt},[yi]),zi=Object(R.useRef)();C.WebkitLineClamp=He,He&&(jt=Object(H.a)(Object(H.a)({},jt),C));function _r(ti){var Ht=ti.target;if(Ht.tagName.toUpperCase()==="IMG"){if(gt){var pi=Ht.getAttribute("src");or(pi),yr("image")}}else if(Ht.tagName.toUpperCase()==="A"){var Dt=Ht.getAttribute("href");if(Dt.indexOf("office")>-1)ti.preventDefault(),or(Dt),yr("office");else if(Dt.indexOf("application/pdf")>-1)ti.preventDefault(),or(Dt),yr("pdf");else if(Dt.indexOf("text/html")>-1)ti.preventDefault(),or(Dt),yr("html");else if(Dt.startsWith("#")){ti.preventDefault();var ri=document.getElementById(Dt.replace("#",""));ri&&ri.scrollIntoView(!0)}}}var dn=function(){var Ht,pi=(Ht=zi.current)===null||Ht===void 0?void 0:Ht.querySelectorAll("video");pi==null||pi.forEach(function(Dt){if(Dt.oncontextmenu=function(){return!1},Dt.src.indexOf(".m3u8")>-1&&!Dt.canPlayType("application/vnd.apple.mpegurl")){if(G.a.isSupported()){var ri=new G.a;ri.loadSource(Dt.src),ri.attachMedia(Dt)}}})};Object(R.useEffect)(function(){if(zi.current&&Yi&&(Yi.match(mr)&&window.PR.prettyPrint()),zi.current)return zi.current.addEventListener("click",_r),function(){zi.current.removeEventListener("click",_r),m(),L()}},[Yi,zi.current,_r]);var br=function(Ht){if(!q)return;Ht.target.nodeName==="IMG"?(_i.current.style.zIndex=1,_i.current.style.display="flex",_i.current.style.width=Ht.target.clientWidth+"px",_i.current.style.height=Ht.target.clientHeight+"px",_i.current.style.top=Ht.target.offsetTop+"px",_i.current.style.left=Ht.target.offsetLeft+"px",Xi.current.src=Ht.target.getAttribute("src")):_i.current.style.display="none"};return g.a.createElement("div",{style:{position:"relative"}},g.a.createElement("div",{ref:zi,style:Object(H.a)({},jt),className:"".concat(V||""," markdown-body ").concat(pr.a.mdBody),onMouseOver:br,dangerouslySetInnerHTML:{__html:Yi}}),g.a.createElement("div",{ref:_i,className:pr.a.button},g.a.createElement(Z.a,null,g.a.createElement(Q.a,{onClick:function(){return zr()}},"\u88C1\u526A"),g.a.createElement(Q.a,{onClick:function(){return Kr()}},"\u7F16\u8F91"))),g.a.createElement("img",{ref:Xi,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),g.a.createElement(oe.a,{close:!0,data:ji,type:ji!=null&&ji.length?kr:"",style:Object(H.a)({},Pi),onClose:function(){return or("")}}))}},"9VGf":function(ct,Qe,ne){"use strict";ne.d(Qe,"a",function(){return P});var le=ne("q1tI"),Z=ne.n(le);function P(Q,H){var F=Object(le.useRef)();Object(le.useEffect)(function(){F.current=Q}),Object(le.useEffect)(function(){function K(){F.current()}if(H!==null){var W=setInterval(K,H);return function(){return clearInterval(W)}}},[H])}},BU3w:function(ct,Qe,ne){"use strict";ne.d(Qe,"a",function(){return F});var le=ne("MNnm"),Z="rc-util-key";function P(K){if(K.attachTo)return K.attachTo;var W=document.querySelector("head");return W||document.body}function Q(K){var W,M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(le.a)())return null;var R=document.createElement("style");if((W=M.csp)===null||W===void 0?void 0:W.nonce){var g;R.nonce=(g=M.csp)===null||g===void 0?void 0:g.nonce}R.innerHTML=K;var p=P(M),f=p.firstChild;return M.prepend&&p.prepend?p.prepend(R):M.prepend&&f?p.insertBefore(R,f):p.appendChild(R),R}var H=new Map;function F(K,W){var M=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=P(M);if(!H.has(R)){var g=Q("",M),p=g.parentNode;H.set(R,p),p.removeChild(g)}var f=Array.from(H.get(R).children).find(function(n){return n.tagName==="STYLE"&&n[Z]===W});if(f){var h,s;if(((h=M.csp)===null||h===void 0?void 0:h.nonce)&&f.nonce!==((s=M.csp)===null||s===void 0?void 0:s.nonce)){var d;f.nonce=(d=M.csp)===null||d===void 0?void 0:d.nonce}return f.innerHTML!==K&&(f.innerHTML=K),f}var o=Q(K,M);return o[Z]=W,o}},Bd2K:function(ct,Qe,ne){(function(le){le(ne("VrN/"),ne("osHv"))})(function(le){le.defineOption("autoCloseTags",!1,function(M,R,g){if(g!=le.Init&&g&&M.removeKeyMap("autoCloseTags"),!R)return;var p={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(p["'/'"]=function(f){return F(f)}),(typeof R!="object"||R.whenOpening!==!1)&&(p["'>'"]=function(f){return Q(f)}),M.addKeyMap(p)});var Z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],P=["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 Q(M){if(M.getOption("disableInput"))return le.Pass;for(var R=M.listSelections(),g=[],p=M.getOption("autoCloseTags"),f=0;fh.ch&&(u=u.slice(0,u.length-s.end+h.ch));var x=u.toLowerCase();if(!u||s.type=="string"&&(s.end!=h.ch||!/[\"\']/.test(s.string.charAt(s.string.length-1))||s.string.length==1)||s.type=="tag"&&n.close||s.string.indexOf("/")==h.ch-s.start-1||L&&K(L,x)>-1||W(M,d.mode.xmlCurrentContext&&d.mode.xmlCurrentContext(o)||[],u,h,!0))return le.Pass;var O=typeof p=="object"&&p.emptyTags;if(O&&K(O,u)>-1){g[f]={text:"/>",newPos:le.Pos(h.line,h.ch+2)};continue}var w=C&&K(C,x)>-1;g[f]={indent:w,text:">"+(w?` `:"")+"",newPos:w?le.Pos(h.line+1,0):le.Pos(h.line,h.ch+1)}}for(var S=typeof p=="object"&&p.dontIndentOnAutoClose,f=R.length-1;f>=0;f--){var T=g[f];M.replaceRange(T.text,R[f].head,R[f].anchor,"+insert");var _=M.listSelections().slice(0);_[f]={head:T.newPos,anchor:T.newPos},M.setSelections(_),!S&&T.indent&&(M.indentLine(T.newPos.line,null,!0),M.indentLine(T.newPos.line+1,null,!0))}}function H(M,R){for(var g=M.listSelections(),p=[],f=R?"/":""&&(L+=">"),p[d]=L}if(M.replaceSelections(p),g=M.listSelections(),!s)for(var d=0;d=0&&R[o]==g;o--)++d;p=s.to;for(var o=1;o0){for(var R=0;R1&&arguments[1]!==void 0?arguments[1]:"",R=[],g=0;gSe.length)&&(ve=Se.length);for(var xe=0,te=new Array(ve);xe=Se.length?{done:!0}:{done:!1,value:Se[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 xe=Se[Symbol.iterator](),xe.next.bind(xe)}function F(Se,ve){return ve={exports:{}},Se(ve,ve.exports),ve.exports}var K=F(function(Se){function ve(){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 xe(te){Se.exports.defaults=te}Se.exports={defaults:ve(),getDefaults:ve,changeDefaults:xe}}),W=K.defaults,M=K.getDefaults,R=K.changeDefaults,g=/[&<>"']/,p=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,h=/[<>"']|&(?!#?\w+;)/g,s={"&":"&","<":"<",">":">",'"':""","'":"'"},d=function(ve){return s[ve]};function o(Se,ve){if(ve){if(g.test(Se))return Se.replace(p,d)}else if(f.test(Se))return Se.replace(h,d);return Se}var n=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(Se){return Se.replace(n,function(ve,xe){return xe=xe.toLowerCase(),xe==="colon"?":":xe.charAt(0)==="#"?xe.charAt(1)==="x"?String.fromCharCode(parseInt(xe.substring(2),16)):String.fromCharCode(+xe.substring(1)):""})}var c=/(^|[^\[])\^/g;function L(Se,ve){Se=Se.source||Se,ve=ve||"";var xe={replace:function(ae,he){return he=he.source||he,he=he.replace(c,"$1"),Se=Se.replace(ae,he),xe},getRegex:function(){return new RegExp(Se,ve)}};return xe}var C=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(Se,ve,xe){if(Se){var te;try{te=decodeURIComponent(u(xe)).replace(C,"").toLowerCase()}catch(ae){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}ve&&!x.test(xe)&&(xe=l(ve,xe));try{xe=encodeURI(xe).replace(/%25/g,"%")}catch(ae){return null}return xe}var w={},S=/^[^:]+:\/*[^/]*$/,T=/^([^:]+:)[\s\S]*$/,_=/^([^:]+:\/*[^/]*)[\s\S]*$/;function l(Se,ve){w[" "+Se]||(S.test(Se)?w[" "+Se]=Se+"/":w[" "+Se]=N(Se,"/",!0)),Se=w[" "+Se];var xe=Se.indexOf(":")===-1;return ve.substring(0,2)==="//"?xe?ve:Se.replace(T,"$1")+ve:ve.charAt(0)==="/"?xe?ve:Se.replace(_,"$1")+ve:Se+ve}var E={exec:function(){}};function m(Se){for(var ve=1,xe,te;ve=0&&be[Ge]==="\\";)De=!De;return De?"|":" |"}),te=xe.split(/ \|/),ae=0;if(te.length>ve)te.splice(ve);else for(;te.length=te.length?ae.slice(te.length):ae}).join(` `)}var pe=function(){function Se(xe){this.options=xe||I}var ve=Se.prototype;return ve.space=function(te){var ae=this.rules.block.newline.exec(te);if(ae)return ae[0].length>1?{type:"space",raw:ae[0]}:{raw:` `}},ve.code=function(te,ae){var he=this.rules.block.code.exec(te);if(he){var me=ae[ae.length-1];if(me&&me.type==="paragraph")return{raw:he[0],text:he[0].trimRight()};var be=he[0].replace(/^ {4}/gm,"");return{type:"code",raw:he[0],codeBlockStyle:"indented",text:this.options.pedantic?be:v(be,` `)}}},ve.fences=function(te){var ae=this.rules.block.fences.exec(te);if(ae){var he=ae[0],me=we(he,ae[3]||"");return{type:"code",raw:he,lang:ae[2]?ae[2].trim():ae[2],text:me}}},ve.heading=function(te){var ae=this.rules.block.heading.exec(te);if(ae)return{type:"heading",raw:ae[0],depth:ae[1].length,text:ae[2]}},ve.nptable=function(te){var ae=this.rules.block.nptable.exec(te);if(ae){var he={type:"table",header:G(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(` `):[],raw:ae[0]};if(he.header.length===he.align.length){var me=he.align.length,be;for(be=0;be ?/gm,"");return{type:"blockquote",raw:ae[0],text:he}}},ve.list=function(te){var ae=this.rules.block.list.exec(te);if(ae){for(var he=ae[0],me=ae[2],be=me.length>1,De=me[me.length-1]===")",Ge={type:"list",raw:he,ordered:be,start:be?+me.slice(0,-1):"",loose:!1,items:[]},st=ae[0].match(this.rules.block.item),ft=!1,pt,Ct,xt,ht,Ut,Mt,Zt,Yt=st.length,Rt=0;Rt1||this.options.smartLists&&xt!==me)&&(ht=st.slice(Rt+1).join(` `),Ge.raw=Ge.raw.substring(0,Ge.raw.length-ht.length),Rt=Yt-1)),Ut=ft||/\n\n(?!\s*$)/.test(pt),Rt!==Yt-1&&(ft=pt.charAt(pt.length-1)===` `,Ut||(Ut=ft)),Ut&&(Ge.loose=!0),Mt=/^\[[ xX]\] /.test(pt),Zt=void 0,Mt&&(Zt=pt[1]!==" ",pt=pt.replace(/^\[[ xX]\] +/,"")),Ge.items.push({type:"list_item",raw:he,task:Mt,checked:Zt,loose:Ut,text:pt});return Ge}},ve.html=function(te){var ae=this.rules.block.html.exec(te);if(ae)return{type:this.options.sanitize?"paragraph":"html",raw:ae[0],pre:!this.options.sanitizer&&(ae[1]==="pre"||ae[1]==="script"||ae[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ae[0]):Y(ae[0]):ae[0]}},ve.def=function(te){var ae=this.rules.block.def.exec(te);if(ae){ae[3]&&(ae[3]=ae[3].substring(1,ae[3].length-1));var he=ae[1].toLowerCase().replace(/\s+/g," ");return{tag:he,raw:ae[0],href:ae[2],title:ae[3]}}},ve.table=function(te){var ae=this.rules.block.table.exec(te);if(ae){var he={type:"table",header:G(ae[1].replace(/^ *| *\| *$/g,"")),align:ae[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ae[3]?ae[3].replace(/\n$/,"").split(` `):[]};if(he.header.length===he.align.length){he.raw=ae[0];var me=he.align.length,be;for(be=0;be/i.test(me[0])&&(ae=!1),!he&&/^<(pre|code|kbd|script)(\s|>)/i.test(me[0])?he=!0:he&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(me[0])&&(he=!1),{type:this.options.sanitize?"text":"html",raw:me[0],inLink:ae,inRawBlock:he,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):Y(me[0]):me[0]}},ve.link=function(te){var ae=this.rules.inline.link.exec(te);if(ae){var he=re(ae[2],"()");if(he>-1){var me=ae[0].indexOf("!")===0?5:4,be=me+ae[1].length+he;ae[2]=ae[2].substring(0,he),ae[0]=ae[0].substring(0,be).trim(),ae[3]=""}var De=ae[2],Ge="";if(this.options.pedantic){var st=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(De);st?(De=st[1],Ge=st[3]):Ge=""}else Ge=ae[3]?ae[3].slice(1,-1):"";De=De.trim().replace(/^<([\s\S]*)>$/,"$1");var ft=oe(ae,{href:De&&De.replace(this.rules.inline._escapes,"$1"),title:Ge&&Ge.replace(this.rules.inline._escapes,"$1")},ae[0]);return ft}},ve.reflink=function(te,ae){var he;if((he=this.rules.inline.reflink.exec(te))||(he=this.rules.inline.nolink.exec(te))){var me=(he[2]||he[1]).replace(/\s+/g," ");if(me=ae[me.toLowerCase()],!me||!me.href){var be=he[0].charAt(0);return{type:"text",raw:be,text:be}}var De=oe(he,me,he[0]);return De}},ve.strong=function(te,ae,he){he===void 0&&(he="");var me=this.rules.inline.strong.start.exec(te);if(me&&(!me[1]||me[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ae=ae.slice(-1*te.length);var be=me[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;be.lastIndex=0;for(var De;(me=be.exec(ae))!=null;)if(De=this.rules.inline.strong.middle.exec(ae.slice(0,me.index+3)),De)return{type:"strong",raw:te.slice(0,De[0].length),text:te.slice(2,De[0].length-2)}}},ve.em=function(te,ae,he){he===void 0&&(he="");var me=this.rules.inline.em.start.exec(te);if(me&&(!me[1]||me[1]&&(he===""||this.rules.inline.punctuation.exec(he)))){ae=ae.slice(-1*te.length);var be=me[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;be.lastIndex=0;for(var De;(me=be.exec(ae))!=null;)if(De=this.rules.inline.em.middle.exec(ae.slice(0,me.index+2)),De)return{type:"em",raw:te.slice(0,De[0].length),text:te.slice(1,De[0].length-1)}}},ve.codespan=function(te){var ae=this.rules.inline.code.exec(te);if(ae){var he=ae[2].replace(/\n/g," "),me=/[^ ]/.test(he),be=he.startsWith(" ")&&he.endsWith(" ");return me&&be&&(he=he.substring(1,he.length-1)),he=Y(he,!0),{type:"codespan",raw:ae[0],text:he}}},ve.br=function(te){var ae=this.rules.inline.br.exec(te);if(ae)return{type:"br",raw:ae[0]}},ve.del=function(te){var ae=this.rules.inline.del.exec(te);if(ae)return{type:"del",raw:ae[0],text:ae[1]}},ve.autolink=function(te,ae){var he=this.rules.inline.autolink.exec(te);if(he){var me,be;return he[2]==="@"?(me=Y(this.options.mangle?ae(he[1]):he[1]),be="mailto:"+me):(me=Y(he[1]),be=me),{type:"link",raw:he[0],text:me,href:be,tokens:[{type:"text",raw:me,text:me}]}}},ve.url=function(te,ae){var he;if(he=this.rules.inline.url.exec(te)){var me,be;if(he[2]==="@")me=Y(this.options.mangle?ae(he[0]):he[0]),be="mailto:"+me;else{var De;do De=he[0],he[0]=this.rules.inline._backpedal.exec(he[0])[0];while(De!==he[0]);me=Y(he[0]),he[1]==="www."?be="http://"+me:be=me}return{type:"link",raw:he[0],text:me,href:be,tokens:[{type:"text",raw:me,text:me}]}}},ve.inlineText=function(te,ae,he){var me=this.rules.inline.text.exec(te);if(me){var be;return ae?be=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):Y(me[0]):me[0]:be=Y(this.options.smartypants?he(me[0]):me[0]),{type:"text",raw:me[0],text:be}}},Se}(),Ee=j.noopTest,_e=j.edit,Ae=j.merge,fe={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:Ee,table:Ee,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};fe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,fe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,fe.def=_e(fe.def).replace("label",fe._label).replace("title",fe._title).getRegex(),fe.bullet=/(?:[*+-]|\d{1,9}[.)])/,fe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,fe.item=_e(fe.item,"gm").replace(/bull/g,fe.bullet).getRegex(),fe.list=_e(fe.list).replace(/bull/g,fe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+fe.def.source+")").getRegex(),fe._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",fe._comment=//,fe.html=_e(fe.html,"i").replace("comment",fe._comment).replace("tag",fe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fe.paragraph=_e(fe._paragraph).replace("hr",fe.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",fe._tag).getRegex(),fe.blockquote=_e(fe.blockquote).replace("paragraph",fe.paragraph).getRegex(),fe.normal=Ae({},fe),fe.gfm=Ae({},fe.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*|$)"}),fe.gfm.nptable=_e(fe.gfm.nptable).replace("hr",fe.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",fe._tag).getRegex(),fe.gfm.table=_e(fe.gfm.table).replace("hr",fe.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",fe._tag).getRegex(),fe.pedantic=Ae({},fe.normal,{html:_e(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",fe._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:Ee,paragraph:_e(fe.normal._paragraph).replace("hr",fe.hr).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",fe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ee,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:Ee,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",ue.punctuation=_e(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=_e(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=_e(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=_e(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=_e(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=_e(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=_e(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=_e(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=_e(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=_e(ue._blockSkip,"g").getRegex(),ue.overlapSkip=_e(ue._overlapSkip,"g").getRegex(),ue._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ue._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ue._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])?)+(?![-_])/,ue.autolink=_e(ue.autolink).replace("scheme",ue._scheme).replace("email",ue._email).getRegex(),ue._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ue.tag=_e(ue.tag).replace("comment",fe._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=_e(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=_e(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=_e(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=Ae({},ue),ue.pedantic=Ae({},ue.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:_e(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:_e(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=Ae({},ue.normal,{escape:_e(ue.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)),ve+="&#"+te+";";return ve}var Ce=function(){function Se(xe){this.tokens=[],this.tokens.links=Object.create(null),this.options=xe||de,this.options.tokenizer=this.options.tokenizer||new pe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:se.normal,inline:Re.normal};this.options.pedantic?(te.block=se.pedantic,te.inline=Re.pedantic):this.options.gfm&&(te.block=se.gfm,this.options.breaks?te.inline=Re.breaks:te.inline=Re.gfm),this.tokenizer.rules=te}Se.lex=function(te,ae){var he=new Se(ae);return he.lex(te)};var ve=Se.prototype;return ve.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},ve.blockTokens=function(te,ae,he){ae===void 0&&(ae=[]),he===void 0&&(he=!0),te=te.replace(/^ +$/gm,"");for(var me,be,De,Ge;te;){if(me=this.tokenizer.space(te)){te=te.substring(me.raw.length),me.type&&ae.push(me);continue}if(me=this.tokenizer.code(te,ae)){te=te.substring(me.raw.length),me.type?ae.push(me):(Ge=ae[ae.length-1],Ge.raw+=` `+me.raw,Ge.text+=` `+me.text);continue}if(me=this.tokenizer.fences(te)){te=te.substring(me.raw.length),ae.push(me);continue}if(me=this.tokenizer.heading(te)){te=te.substring(me.raw.length),ae.push(me);continue}if(me=this.tokenizer.nptable(te)){te=te.substring(me.raw.length),ae.push(me);continue}if(me=this.tokenizer.hr(te)){te=te.substring(me.raw.length),ae.push(me);continue}if(me=this.tokenizer.blockquote(te)){te=te.substring(me.raw.length),me.tokens=this.blockTokens(me.text,[],he),ae.push(me);continue}if(me=this.tokenizer.list(te)){for(te=te.substring(me.raw.length),De=me.items.length,be=0;be0)for(;(st=this.tokenizer.rules.inline.reflinkSearch.exec(Ge))!=null;)ft.includes(st[0].slice(st[0].lastIndexOf("[")+1,-1))&&(Ge=Ge.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+Ge.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(st=this.tokenizer.rules.inline.blockSkip.exec(Ge))!=null;)Ge=Ge.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+Ge.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(De=this.tokenizer.escape(te)){te=te.substring(De.raw.length),ae.push(De);continue}if(De=this.tokenizer.tag(te,he,me)){te=te.substring(De.raw.length),he=De.inLink,me=De.inRawBlock,ae.push(De);continue}if(De=this.tokenizer.link(te)){te=te.substring(De.raw.length),De.type==="link"&&(De.tokens=this.inlineTokens(De.text,[],!0,me)),ae.push(De);continue}if(De=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(De.raw.length),De.type==="link"&&(De.tokens=this.inlineTokens(De.text,[],!0,me)),ae.push(De);continue}if(De=this.tokenizer.strong(te,Ge,be)){te=te.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],he,me),ae.push(De);continue}if(De=this.tokenizer.em(te,Ge,be)){te=te.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],he,me),ae.push(De);continue}if(De=this.tokenizer.codespan(te)){te=te.substring(De.raw.length),ae.push(De);continue}if(De=this.tokenizer.br(te)){te=te.substring(De.raw.length),ae.push(De);continue}if(De=this.tokenizer.del(te)){te=te.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],he,me),ae.push(De);continue}if(De=this.tokenizer.autolink(te,Te)){te=te.substring(De.raw.length),ae.push(De);continue}if(!he&&(De=this.tokenizer.url(te,Te))){te=te.substring(De.raw.length),ae.push(De);continue}if(De=this.tokenizer.inlineText(te,me,ke)){te=te.substring(De.raw.length),be=De.raw.slice(-1),ae.push(De);continue}if(te){var pt="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(pt);break}else throw new Error(pt)}}return ae},Z(Se,null,[{key:"rules",get:function(){return{block:se,inline:Re}}}]),Se}(),Le=K.defaults,Be=j.cleanUrl,Fe=j.escape,Me=function(){function Se(xe){this.options=xe||Le}var ve=Se.prototype;return ve.code=function(te,ae,he){var me=(ae||"").match(/\S*/)[0];if(this.options.highlight){var be=this.options.highlight(te,me);be!=null&&be!==te&&(he=!0,te=be)}return me?'
    '+(he?te:Fe(te,!0))+`
    `:"
    "+(he?te:Fe(te,!0))+`
    `},ve.blockquote=function(te){return`
    `+te+`
    `},ve.html=function(te){return te},ve.heading=function(te,ae,he,me){return this.options.headerIds?"'+te+" `:""+te+" `},ve.hr=function(){return this.options.xhtml?`
    `:`
    `},ve.list=function(te,ae,he){var me=ae?"ol":"ul",be=ae&&he!==1?' start="'+he+'"':"";return"<"+me+be+`> `+te+" `},ve.listitem=function(te){return"
  • "+te+`
  • `},ve.checkbox=function(te){return" "},ve.paragraph=function(te){return"

    "+te+`

    `},ve.table=function(te,ae){return ae&&(ae=""+ae+""),` `+te+` `+ae+`
    `},ve.tablerow=function(te){return` `+te+` `},ve.tablecell=function(te,ae){var he=ae.header?"th":"td",me=ae.align?"<"+he+' align="'+ae.align+'">':"<"+he+">";return me+te+" `},ve.strong=function(te){return""+te+""},ve.em=function(te){return""+te+""},ve.codespan=function(te){return""+te+""},ve.br=function(){return this.options.xhtml?"
    ":"
    "},ve.del=function(te){return""+te+""},ve.link=function(te,ae,he){if(te=Be(this.options.sanitize,this.options.baseUrl,te),te===null)return he;var me='",me},ve.image=function(te,ae,he){if(te=Be(this.options.sanitize,this.options.baseUrl,te),te===null)return he;var me=''+he+'":">",me},ve.text=function(te){return te},Se}(),Ue=function(){function Se(){}var ve=Se.prototype;return ve.strong=function(te){return te},ve.em=function(te){return te},ve.codespan=function(te){return te},ve.del=function(te){return te},ve.html=function(te){return te},ve.text=function(te){return te},ve.link=function(te,ae,he){return""+he},ve.image=function(te,ae,he){return""+he},ve.br=function(){return""},Se}(),Ve=function(){function Se(){this.seen={}}var ve=Se.prototype;return ve.slug=function(te){var ae=te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ae)){var he=ae;do this.seen[he]++,ae=he+"-"+this.seen[he];while(this.seen.hasOwnProperty(ae))}return this.seen[ae]=0,ae},Se}(),$e=K.defaults,Ze=j.unescape,Xe=function(){function Se(xe){this.options=xe||$e,this.options.renderer=this.options.renderer||new Me,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ue,this.slugger=new Ve}Se.parse=function(te,ae){var he=new Se(ae);return he.parse(te)};var ve=Se.prototype;return ve.parse=function(te,ae){ae===void 0&&(ae=!0);var he="",me,be,De,Ge,st,ft,pt,Ct,xt,ht,Ut,Mt,Zt,Yt,Rt,Ti,Ui,qe,wt=te.length;for(me=0;me0&&Rt.tokens[0].type==="text"?(Rt.tokens[0].text=qe+" "+Rt.tokens[0].text,Rt.tokens[0].tokens&&Rt.tokens[0].tokens.length>0&&Rt.tokens[0].tokens[0].type==="text"&&(Rt.tokens[0].tokens[0].text=qe+" "+Rt.tokens[0].tokens[0].text)):Rt.tokens.unshift({type:"text",text:qe}):Yt+=qe),Yt+=this.parse(Rt.tokens,Zt),xt+=this.renderer.listitem(Yt,Ui,Ti);he+=this.renderer.list(xt,Ut,Mt);continue}case"html":{he+=this.renderer.html(ht.text);continue}case"paragraph":{he+=this.renderer.paragraph(this.parseInline(ht.tokens));continue}case"text":{for(xt=ht.tokens?this.parseInline(ht.tokens):ht.text;me+1An error occurred:

    "+rt(De.message+"",!0)+"
    ";throw De}}Pe.options=Pe.setOptions=function(Se){return ot(Pe.defaults,Se),ut(Pe.defaults),Pe},Pe.getDefaults=Ne,Pe.defaults=tt,Pe.use=function(Se){var ve=ot({},Se);if(Se.renderer&&function(){var te=Pe.defaults.renderer||new Me,ae=function(be){var De=te[be];te[be]=function(){for(var Ge=arguments.length,st=new Array(Ge),ft=0;ft`,triples:"",explode:"[]{}"},P=le.Pos;le.defineOption("autoCloseBrackets",!1,function(s,d,o){o&&o!=le.Init&&(s.removeKeyMap(H),s.state.closeBrackets=null),d&&(F(Q(d,"pairs")),s.state.closeBrackets=d,s.addKeyMap(H))});function Q(s,d){return d=="pairs"&&typeof s=="string"?s:typeof s=="object"&&s[d]!=null?s[d]:Z[d]}var H={Backspace:M,Enter:R};function F(s){for(var d=0;d=0;u--){var L=n[u].head;s.replaceRange("",P(L.line,L.ch-1),P(L.line,L.ch+1),"+delete")}}function R(s){var d=W(s),o=d&&Q(d,"explode");if(!o||s.getOption("disableInput"))return le.Pass;for(var n=s.listSelections(),u=0;u0;return{anchor:new P(s.anchor.line,s.anchor.ch+(d?-1:1)),head:new P(s.head.line,s.head.ch+(d?1:-1))}}function p(s,d){var o=W(s);if(!o||s.getOption("disableInput"))return le.Pass;var n=Q(o,"pairs"),u=n.indexOf(d);if(u==-1)return le.Pass;for(var c=Q(o,"closeBefore"),L=Q(o,"triples"),C=n.charAt(u+1)==d,x=s.listSelections(),O=u%2==0,w,S=0;S=0&&s.getRange(_,P(_.line,_.ch+3))==d+d+d?l="skipThree":l="skip";else if(C&&_.ch>1&&L.indexOf(d)>=0&&s.getRange(P(_.line,_.ch-2),_)==d+d){if(_.ch>2&&/\bstring/.test(s.getTokenTypeAt(P(_.line,_.ch-2))))return le.Pass;l="addFour"}else if(C){var m=_.ch==0?" ":s.getRange(P(_.line,_.ch-1),_);if(!le.isWordChar(E)&&m!=d&&!le.isWordChar(m))l="both";else return le.Pass}else if(O&&(E.length===0||/\s/.test(E)||c.indexOf(E)>-1))l="both";else return le.Pass;if(!w)w=l;else if(w!=l)return le.Pass}var b=u%2?n.charAt(u-1):d,N=u%2?d:n.charAt(u+1);s.operation(function(){if(w=="skip")s.execCommand("goCharRight");else if(w=="skipThree")for(var D=0;D<3;D++)s.execCommand("goCharRight");else if(w=="surround"){for(var B=s.getSelections(),D=0;D0&&(re.percent=re.loaded/re.total*100),j.onProgress(re)});var v=new FormData;j.data&&Object.keys(j.data).forEach(function(Y){var re=j.data[Y];if(Array.isArray(re)){re.forEach(function(oe){v.append(Y+"[]",oe)});return}v.append(Y,j.data[Y])}),j.file instanceof Blob?v.append(j.filename,j.file,j.file.name):v.append(j.filename,j.file),I.onerror=function(re){j.onError(re)},I.onload=function(){return I.status<200||I.status>=300?j.onError(H(j,I),F(I)):j.onSuccess(F(I),I)},I.open(j.method,j.action,!0),j.withCredentials&&"withCredentials"in I&&(I.withCredentials=!0);var G=j.headers||{};return G["X-Requested-With"]!==null&&I.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(G).forEach(function(Y){G[Y]!==null&&I.setRequestHeader(Y,G[Y])}),I.send(v),{abort:function(){I.abort()}}}var W=+new Date,M=0;function R(){return"rc-upload-"+W+"-"+ ++M}function g(j,I){return j.indexOf(I,j.length-I.length)!==-1}var p=function(j,I){if(j&&I){var v=Array.isArray(I)?I:I.split(","),G=j.name||"",Y=j.type||"",re=Y.replace(/\/.*$/,"");return v.some(function(oe){var we=oe.trim();return we.charAt(0)==="."?g(G.toLowerCase(),we.toLowerCase()):/\/\*$/.test(we)?re===we.replace(/\/.*$/,""):Y===we})}return!0};function f(j,I){var v=j.createReader(),G=[];function Y(){v.readEntries(function(re){var oe=Array.prototype.slice.apply(re);G=G.concat(oe);var we=!oe.length;we?I(G):Y()})}Y()}var h=function(I,v,G){var Y=function re(oe,we){we=we||"",oe.isFile?oe.file(function(pe){G(pe)&&(oe.fullPath&&!pe.webkitRelativePath&&(Object.defineProperties(pe,{webkitRelativePath:{writable:!0}}),pe.webkitRelativePath=oe.fullPath.replace(/^\//,""),Object.defineProperties(pe,{webkitRelativePath:{writable:!1}})),v([pe]))}):oe.isDirectory&&f(oe,function(pe){pe.forEach(function(Ee){re(Ee,""+we+oe.name+"/")})})};I.forEach(function(re){Y(re.webkitGetAsEntry())})},s=h,d=Object.assign||function(j){for(var I=1;I=0)continue;if(!Object.prototype.hasOwnProperty.call(j,G))continue;v[G]=j[G]}return v}function L(j,I){if(!(j instanceof I))throw new TypeError("Cannot call a class as a function")}function C(j,I){if(!j)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:j}function x(j,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);j.prototype=Object.create(I&&I.prototype,{constructor:{value:j,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(j,I):j.__proto__=I)}var O=function(I){return Object.keys(I).reduce(function(v,G){return(G.substr(0,5)==="data-"||G.substr(0,5)==="aria-"||G==="role")&&(v[G]=I[G]),v},{})},w=function(j){x(I,j);function I(){var v,G,Y,re;L(this,I);for(var oe=arguments.length,we=Array(oe),pe=0;pe1&&arguments[1]!==void 0?arguments[1]:1,xe=Ue.length,te=0;te1&&arguments[1]!==void 0?arguments[1]:!1;return Object(O.a)(v).map(function(Y,re){if(!H.isValidElement(Y)||!Y.type)return null;var oe=Y.type.isSelectOptGroup,we=Y.key,pe=Y.props,Ee=pe.children,_e=Object(K.a)(pe,["children"]);return G||!oe?w(Y):Object(x.a)(Object(x.a)({key:"__RC_SELECT_GRP__".concat(we===null?re:we,"__"),label:we},_e),{},{options:S(Ee)})}).filter(function(Y){return Y})}var T=ne("2Qr1"),_=ne("qNPg"),l=ne("U8pU"),E=ne("Kwbf"),m=ne("WKfj");function b(v){var G=v.mode,Y=v.options,re=v.children,oe=v.backfill,we=v.allowClear,pe=v.placeholder,Ee=v.getInputElement,_e=v.showSearch,Ae=v.onSearch,fe=v.defaultOpen,ue=v.autoFocus,ie=v.labelInValue,de=v.value,se=v.inputValue,Re=v.optionLabelProp,ke=G==="multiple"||G==="tags",Te=_e!==void 0?_e:ke||G==="combobox",Ce=Y||S(re);if(Object(E.a)(G!=="tags"||Ce.every(function(Me){return!Me.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),G==="tags"||G==="combobox"){var Le=Ce.some(function(Me){return Me.options?Me.options.some(function(Ue){return typeof("value"in Ue?Ue.value:Ue.key)=="number"}):typeof("value"in Me?Me.value:Me.key)=="number"});Object(E.a)(!Le,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(E.a)(G!=="combobox"||!Re,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(E.a)(G==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(E.a)(G==="combobox"||!Ee,"`getInputElement` only work with `combobox` mode."),Object(E.b)(G!=="combobox"||!Ee||!we||!pe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Ae&&!Te&&G!=="combobox"&&G!=="tags"&&Object(E.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(E.b)(!fe||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),de!=null){var Be=Object(m.d)(de);Object(E.a)(!ie||Be.every(function(Me){return Object(l.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(E.a)(!ke||Array.isArray(de),"`value` should be array when `mode` is `multiple` or `tags`")}if(re){var Fe=null;Object(O.a)(re).some(function(Me){if(!H.isValidElement(Me)||!Me.type)return!1;var Ue=Me.type;if(Ue.isSelectOption)return!1;if(Ue.isSelectOptGroup){var Ve=Object(O.a)(Me.props.children).every(function($e){return!H.isValidElement($e)||!Me.type||$e.type.isSelectOption?!0:(Fe=$e.type,!1)});return!Ve}return Fe=Ue,!0}),Fe&&Object(E.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Fe.displayName||Fe.name||Fe,"`.")),Object(E.a)(se===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var N=b,D=Object(_.a)({prefixCls:"rc-select",components:{optionList:n},convertChildrenToData:S,flattenOptions:T.d,getLabeledValue:T.e,filterOptions:T.b,isValueDisabled:T.g,findValueOption:T.c,warningProps:N,fillOptionsWithMissingValue:T.a}),B=function(v){Object(P.a)(Y,v);var G=Object(Q.a)(Y);function Y(){var re;return Object(le.a)(this,Y),re=G.apply(this,arguments),re.selectRef=H.createRef(),re.focus=function(){re.selectRef.current.focus()},re.blur=function(){re.selectRef.current.blur()},re}return Object(Z.a)(Y,[{key:"render",value:function(){return H.createElement(D,Object.assign({ref:this.selectRef},this.props))}}]),Y}(H.Component);B.Option=c,B.OptGroup=C;var j=B,I=Qe.c=j},M8RZ:function(ct,Qe,ne){"use strict";ne.d(Qe,"a",function(){return M});var le=ne("fWQN"),Z=ne("mtLc"),P=ne("yKVA"),Q=ne("879j"),H=ne("q1tI"),F=ne.n(H),K=ne("i8i4"),W=ne.n(K),M=function(R){Object(P.a)(p,R);var g=Object(Q.a)(p);function p(f){var h;Object(le.a)(this,p),h=g.call(this,f);var s=window.document;return h.node=s.createElement("div"),s.body.appendChild(h.node),h}return Object(Z.a)(p,[{key:"render",value:function(){var h=this.props.children;return Object(K.createPortal)(h,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),p}(F.a.Component)},Ot1p:function(ct,Qe,ne){"use strict";var le=ne("2qtc"),Z=ne("kLXV"),P=ne("rAM+"),Q=ne("miYZ"),H=ne("tsqr"),F=ne("9og8"),K=ne("tJVT"),W=ne("jrin"),M=ne("WmNS"),R=ne.n(M),g=ne("q1tI"),p=ne.n(g),f=ne("VrN/"),h=ne.n(f),s=ne("bdgK"),d=ne("p77/"),o=ne("Bd2K"),n=ne("ELLl"),u=ne("19Vz"),c=ne("lZu9"),L=ne("+NIl"),C=ne("kSUc"),x=ne("9Bee"),O=function(be){var De=be.value,Ge=De===void 0?"":De,st=be.className,ft=be.showTextOnly,pt=be.showLines,Ct=be.style,xt=Ct===void 0?{}:Ct,ht=Object(g.useMemo)(function(){return""},[Ge]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:ht}}))},w=ne("0Owb"),S=ne("dejd"),T=ne("C+DQ"),_=ne("1vsH"),l=ne("m3rI"),E=[{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 m(be){var De=be.onActionCallback,Ge=be.title,st=be.icon,ft=be.actionName,pt=be.className,Ct=pt===void 0?"":pt,xt=be.children;function ht(){De(ft)}return p.a.createElement("a",{title:Ge,className:Ct,onClick:ht},p.a.createElement("i",{className:"md-iconfont ".concat(st)}),xt)}var b=function(be){var De=be.watch,Ge=be.showNullButton,st=be.onActionCallback,ft=be.fullScreen,pt=be.insertTemp,Ct=be.hidetoolBar,xt=be.uuid,ht=be.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(_.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(_.F)("_educoder_session"),"&key=").concat(xt,"&api=").concat(encodeURIComponent(l.a.PROXY_SERVER)));var Ut=[].concat(E,[{title:"".concat(De?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(De?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!Ct&&Ut.map(function(Mt,Zt){return p.a.createElement("li",{key:Zt},Mt.actionName?p.a.createElement(m,Object(w.a)({},Mt,{onActionCallback:st})):p.a.createElement("span",{className:"v-line"}))}),Ge?p.a.createElement("li",null,p.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:st},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,pt&&p.a.createElement("li",null,p.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(pt),onActionCallback:st},p.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),p.a.createElement("li",{className:"btn-full-screen"},p.a.createElement(m,{icon:"".concat(ft?"icon-shrink":"icon-enlarge"),title:ft?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:st})))},N=ne("M8RZ"),D=ne("+L6B"),B=ne("2/Rp"),j=ne("y8nQ"),I=ne("Vl3Y"),v=ne("5NDa"),G=ne("5rEg"),Y={labelCol:{span:4},wrapperCol:{span:20}},re=function(be){var De=be.callback,Ge=be.onCancel;function st(ft){De(ft)}return p.a.createElement(I.a,Object(w.a)({},Y,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:st}),p.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},p.a.createElement(G.a,null)),p.a.createElement(I.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},p.a.createElement(G.a,null)),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(B.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(B.a,{type:"ghost",onClick:Ge},"\u53D6\u6D88")))},oe=ne("7ahc"),we=ne("HmJG"),pe=ne("BjJ7"),Ee=I.a.useForm,_e={width:280,marginRight:10},Ae={labelCol:{span:5},wrapperCol:{span:19}},fe=function(be){var De=be.callback,Ge=be.onCancel,st=Ee(),ft=Object(K.a)(st,1),pt=ft[0];function Ct(Ut){De(Ut)}function xt(Ut,Mt){if(Ut.status===-1){H.b.error(Ut.message);return}pt.setFieldsValue({src:"/api/attachments/".concat(Ut.id),type:Mt.type})}function ht(Ut){var Mt=Ut.target.files[0];ie(Mt,xt)}return p.a.createElement(I.a,Object(w.a)({form:pt},Ae,{className:"upload-image-panel",onFinish:Ct}),p.a.createElement(I.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(I.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},p.a.createElement(G.a,{style:_e})),p.a.createElement(ue,{onFileChange:ht}))),p.a.createElement(I.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},p.a.createElement(G.a,{style:{width:264}})),p.a.createElement(I.a.Item,{style:{textAlign:"right"}},p.a.createElement(B.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(B.a,{type:"ghost",onClick:Ge},"\u53D6\u6D88")))};function ue(be){var De=be.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:De}))}function ie(be,De){if(!be)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ge=new FormData;Ge.append("editormd-image-file",be),Ge.append("file_param_name","editormd-image-file"),Ge.append("byxhr","true");var st=new window.XMLHttpRequest;st.withCredentials=!0,st.addEventListener("load",function(ft){De(JSON.parse(ft.target.responseText),be)},!1),st.addEventListener("error",function(ft){console.error(ft)},!1),st.open("POST","".concat(pe.a,"/api/attachments.json")),st.send(Ge)}var de=ne("giR+"),se=ne("fyUT"),Re=ne("7Kak"),ke=ne("9yH6"),Te=ke.a.Group,Ce={margin:"0 8px"},Le=function(be){var De=be.callback,Ge=be.onCancel;function st(ft){De(ft)}return p.a.createElement(I.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:st},p.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},p.a.createElement("span",{style:Ce},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:Ce},"\u884C\u6570"),p.a.createElement(I.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(se.a,null)),p.a.createElement("span",{style:Ce},"\u5217\u6570"),p.a.createElement(I.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},p.a.createElement(se.a,null))),p.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},p.a.createElement("span",{style:Ce},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(I.a.Item,{name:"align"},p.a.createElement(Te,null,p.a.createElement(ke.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(ke.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(ke.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(ke.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(B.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(B.a,{type:"ghost",onClick:Ge},"\u53D6\u6D88")))},Be=ne("ErOA"),Fe=ne("7Cbv"),Me="link",Ue="upload-image",Ve="code-block",$e="add-table",Ze="------------",Xe={default:Ze,left:":".concat(Ze),center:":".concat(Ze,":"),right:"".concat(Ze,":")},ot=ne("9VGf"),et,rt;function Ne(){}var ut=0,tt=1e4,Pe="\u2581",We=` **\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 Se(be){return/^\d+$/.test(be)?"".concat(be,"px"):be}var ve=navigator.platform.toUpperCase().indexOf("MAC")>=0,xe=ve?"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"],ae=(et={},Object(W.a)(et,xe+"-B","bold"),Object(W.a)(et,xe+"-I","italic"),et),he=(rt={},Object(W.a)(rt,Me,"\u6DFB\u52A0\u94FE\u63A5"),Object(W.a)(rt,Ve,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(W.a)(rt,Ue,"\u6DFB\u52A0\u6587\u4EF6"),Object(W.a)(rt,$e,"\u6DFB\u52A0\u8868\u683C"),rt),me=Qe.a=function(be){var De=be.defaultValue,Ge=De===void 0?"":De,st=be.onChange,ft=be.width,pt=ft===void 0?"100%":ft,Ct=be.height,xt=Ct===void 0?400:Ct,ht=be.miniToolbar,Ut=ht===void 0?!1:ht,Mt=be.isFocus,Zt=Mt===void 0?!1:Mt,Yt=be.watch,Rt=be.insertTemp,Ti=be.mode,Ui=Ti===void 0?"markdown":Ti,qe=be.id,wt=qe===void 0?"markdown-editor-id":qe,Ot=be.showResizeBar,Lt=Ot===void 0?!1:Ot,qt=be.noStorage,qi=qt===void 0?!1:qt,er=be.showNullButton,Bt=er===void 0?!1:er,mt=be.hidetoolBar,Gi=mt===void 0?!1:mt,tr=be.fullScreen,vi=tr===void 0?!1:tr,kt=be.onBlur,Bi=be.onCMBeforeChange,Vi=be.onFullScreen,fr=be.className,Ye=fr===void 0?"":fr,Tt=be.disablePaste,pr=Tt===void 0?!1:Tt,mr=be.placeholder,gr=mr===void 0?"":mr,vr=be.values,X=vr===void 0?"":vr,y=Object(g.useState)(null),A=Object(K.a)(y,2),U=A[0],q=A[1],V=Object(g.useState)(Ge),ye=Object(K.a)(V,2),He=ye[0],it=ye[1],gt=Object(g.useState)(Yt),ze=Object(K.a)(gt,2),_t=ze[0],jt=ze[1],$t=Object(g.useState)(vi),Pi=Object(K.a)($t,2),yi=Pi[0],_i=Pi[1],Xi=Object(g.useState)(""),Ir=Object(K.a)(Xi,2),li=Ir[0],ji=Ir[1],or=Object(g.useState)(0),lr=Object(K.a)(or,2),Mi=lr[0],kr=lr[1],yr=Object(g.useState)(xt),zr=Object(K.a)(yr,2),Kr=zr[0],Yi=zr[1],zi=Object(g.useState)(!1),_r=Object(K.a)(zi,2),dn=_r[0],br=_r[1],ti=Object(g.useRef)(Object(Fe.a)()),Ht=Object(g.useRef)(!1),pi=Object(g.useRef)(),Dt=Object(g.useRef)(),ri=Object(g.useRef)(),zt=Object(g.useRef)(),ir=Object(g.useRef)(),ui=function(){var vt=Object(F.a)(R.a.mark(function St(){var bt,It;return R.a.wrap(function(Vt){for(;;)switch(Vt.prev=Vt.next){case 0:return Vt.next=2,Object(Be.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ti.current}});case 2:It=Vt.sent,It!=null&&(bt=It.attachments)!==null&&bt!==void 0&&bt.length&&(console.log("cm:",U,Dt),It.attachments.map(function(Nt){Nt.content_type.indexOf("image")>-1?U.replaceSelection("![,](/api/attachments/".concat(Nt.id,"?type=").concat(Nt.content_type,")")):Nt.content_type.indexOf("video")>-1?U.replaceSelection('')):Nt.content_type.indexOf("pdf")>-1?U.replaceSelection('
    ').concat(Nt.name,"")):U.replaceSelection("[".concat(Nt.name,"](").concat(l.a.API_SERVER,"/api/attachments/").concat(Nt.id,"?type=").concat(Nt.content_type,")"))}));case 4:case"end":return Vt.stop()}},St)}));return function(){return vt.apply(this,arguments)}}();Object(g.useEffect)(function(){it(X),U==null||U.setValue(X)},[X]),Object(g.useEffect)(function(){Vi==null||Vi(yi)},[yi]),Object(g.useEffect)(function(){if(Dt.current){var vt=h.a.fromTextArea(Dt.current,{mode:Ui,lineNumbers:!Ut,lineWrapping:!0,value:Ge,autoCloseTags:!0,autoCloseBrackets:!0});Zt&&vt.focus();function St(bt,It){if(pr){It.preventDefault();return}var Ft=It.clipboardData;if(Ft){var Vt=Ft.types.toString(),Nt=Ft.items;if(Vt==="Files"||Ft.types.indexOf("Files")>-1){if(It.preventDefault(),Ui=="stex")return;try{var si,Ai=Nt[1];((si=Nt[0])===null||si===void 0?void 0:si.kind)==="file"&&(Ai=Nt[0]);var Pt=Ai.getAsFile(),ur=Pt.name.split(".").pop();ie(Pt,function(Wt){if(Wt.id){var Oi,bi,Ki;(Pt==null||((Oi=Pt.type)===null||Oi===void 0)?void 0:Oi.indexOf("image"))>-1?vt.replaceSelection("![,](/api/attachments/".concat(Wt.id,"?type=").concat(Wt.content_type,")")):(Pt==null||((bi=Pt.type)===null||bi===void 0)?void 0:bi.indexOf("video"))>-1?vt.replaceSelection('')):(Pt==null||((Ki=Pt.type)===null||Ki===void 0)?void 0:Ki.indexOf("pdf"))>-1?vt.replaceSelection('').concat(Pt.name,"")):te.includes(ur)?vt.replaceSelection('').concat(Pt.name,"")):vt.replaceSelection("[".concat(Pt.name,"](").concat(l.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}else(Wt==null?void 0:Wt.status)===401&&(document.location.href="/user/login")})}catch(Wt){H.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return vt.on("paste",St),vt.on("dragleave",function(bt,It){ri.current.classList.remove("mouse-hover-md")}),vt.on("dragover",function(bt,It){ri.current.classList.add("mouse-hover-md")}),vt.on("drop",function(bt,It){ri.current.classList.add("mouse-hover-md");var Ft;if(Ft=It.dataTransfer.files,Ft.length>0){It.preventDefault(),It.stopPropagation();for(var Vt=function(Ai){var Pt=Ft[Ai],ur=Pt.name.split(".").pop();ie(Pt,function(Wt){if(Wt.id){var Oi,bi,Ki;(Pt==null||((Oi=Pt.type)===null||Oi===void 0)?void 0:Oi.indexOf("image"))>-1?vt.replaceSelection("![,](/api/attachments/".concat(Wt.id,"?type=").concat(Wt.content_type,")")):(Pt==null||((bi=Pt.type)===null||bi===void 0)?void 0:bi.indexOf("video"))>-1?vt.replaceSelection('')):(Pt==null||((Ki=Pt.type)===null||Ki===void 0)?void 0:Ki.indexOf("pdf"))>-1?vt.replaceSelection('').concat(Pt.name,"")):te.includes(ur)?vt.replaceSelection('').concat(Pt.name,"")):vt.replaceSelection("[".concat(Pt.name,"](").concat(l.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}else(Wt==null?void 0:Wt.status)===401&&(document.location.href="/user/login")})},Nt=0;Nt0||Nt.target.offsetWidth>0)&&(wi(),U.setSize("100%","100%"),U.refresh())}}catch(si){Ft.e(si)}finally{Ft.f()}});return bt.observe(Dt.current.parentElement),bt}if(U){var St=vt();return function(){St.unobserve(Dt.current.parentElement)}}},[U,wi]),Object(g.useEffect)(function(){if(U){for(var vt=[],St=function(){var Nt=It[bt];Ft=Object(K.a)(Nt,2);var si=Ft[0],Ai=Ft[1],Pt=Object(W.a)({},si,function(){Vr(Ai)});vt.push(Pt),U.addKeyMap(Pt)},bt=0,It=Object.entries(ae);bt0){var vt=new Date().getTime(),St=window.sessionStorage.getItem(wt);vt>=Mi+tt&&(!St||St!==He)&&(window.sessionStorage.setItem(wt,He),br(!0))}},tt),Object(g.useEffect)(function(){jt(Yt)},[U,Yt]),Object(g.useEffect)(function(){U&&(Zt&&U.focus())},[U,Zt]),Object(g.useEffect)(function(){if(_t&&U){var vt=U.getScrollerElement();function St(bt){var It=bt.target;if(ir.current){var Ft=It.scrollTop/It.scrollHeight;ir.current.scrollTop=ir.current.scrollHeight*Ft}}return vt.addEventListener("scroll",St),function(){vt.removeEventListener("scroll",St)}}},[U,_t]),Object(g.useEffect)(function(){if(U&&Bi){function vt(St,bt){Bi(St,bt)}return U.on("beforeChange",vt),function(){U.off("beforeChange",vt)}}},[U,Bi]),Object(g.useEffect)(function(){if(U&&kt){function vt(){kt(U.getValue())}return U.on("blur",vt),function(){U.off("blur",vt)}}},[U,kt]),Object(g.useEffect)(function(){if(U){function vt(St){var bt=St.getValue();it(bt),kr(new Date().getTime()),St.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),st&&st(bt)}return U.on("change",vt),function(){U.off("change",vt)}}},[U,st]),Object(g.useEffect)(function(){U&&(Ge==null?(U.setValue(""),it("")):Ge!==U.getValue()&&(U.setValue(Ge),it(Ge),U.setCursor(U.lineCount(),0)))},[U,Ge]);var Vr=Object(g.useCallback)(function(vt){var St=U.getCursor(),bt=U.getSelection(),It=bt.split(` `);switch(vt){case"bold":return U.replaceSelection("**"+bt+"**"),bt===""&&U.setCursor(St.line,St.ch+2),U.focus();case"italic":return U.replaceSelection("*"+bt+"*"),bt===""&&U.setCursor(St.line,St.ch+1),U.focus();case"code":return U.replaceSelection("`"+bt+"`"),bt===""&&U.setCursor(St.line,St.ch+1),U.focus();case"inline-latex":return U.replaceSelection("`$$"+bt+"$$`"),bt===""&&U.setCursor(St.line,St.ch+3),U.focus();case"latex":return U.replaceSelection("```latex\n"+bt+"\n```"),U.setCursor(St.line+1,bt.length+1),U.focus();case"line-break":return U.replaceSelection(`
    `),U.focus();case"list-ul":return bt===""?U.replaceSelection("- "+bt):U.replaceSelection(It.map(function(Ft){return Ft===""?"":"- ".concat(Ft)}).join(` `)),U.focus();case"list-ol":return bt===""?U.replaceSelection("1. "+bt):U.replaceSelection(It.map(function(Ft,Vt){return Ft===""?"":"".concat(Vt+1,". ").concat(Ft)}).join(` `)),U.focus();case"add-null-ch":return bt===""&&U.setCursor(St.line,St.ch+1),U.replaceSelection(Pe),U.focus();case"inster-template-1":return bt===""&&U.setCursor(St.line,St.ch),U.replaceSelection(We),U.focus();case"eraser":return U.setValue(""),U.focus();case"trigger-watch":return jt(!_t),U.focus();case"trigger-full-screen":return _i(!yi),U.focus();case Me:ji(Me);return;case Ve:ji(Ve);return;case Ue:ji(Ue);return;case $e:ji($e);return;default:throw new Error}},[U,_t,yi]),Er=Object(g.useCallback)(function(vt){ji("");switch(li){case Me:var St=vt.title,bt=vt.link;return U.replaceSelection("[".concat(St,"](").concat(bt,")")),U.focus();case Ve:var It=vt.language,Ft=vt.content;return U.replaceSelection(["```"+It,Ft,"```"].join(` `)),U.focus();case Ue:var Vt=vt.src,Nt=vt.alt;return Nt?U.replaceSelection("![ ".concat(Nt," ]( ").concat(Vt,' "').concat(Nt,'" )')):U.replaceSelection("![,](".concat(Vt,")")),U.focus();case $e:for(var si=vt.row,Ai=vt.col,Pt=vt.align,ur=` `,Wt=0;Wt300&&(si=300);var Ai=xt+si+"px";Yi(Ai)}}return vt.addEventListener("mousedown",It),document.addEventListener("mousemove",Vt),document.addEventListener("mouseup",Ft),function(){vt.removeEventListener("mousedown",It),document.removeEventListener("mousemove",Vt),document.removeEventListener("mouseup",Ft)}}},[U,zt]),Object(g.useEffect)(function(){Yi(xt)},[xt]);var rr=Se(pt),fn=Se(Kr),$i={width:rr,height:fn},pn=Object(g.useMemo)(function(){if(Mi){var vt=new Date(Mi),St=vt.getHours(),bt=vt.getMinutes(),It=vt.getSeconds();return St=St<10?"0"+St:St,bt=bt<10?"0"+bt:bt,It=It<10?"0"+It:It,"".concat(St,":").concat(bt,":").concat(It)}return 0},[Mi]);function jn(){window.sessionStorage.removeItem(wt),br(!1),kr(0)}function Dr(){br(!1),kr(0),U.setValue(window.sessionStorage.getItem(wt))}function ua(vt,St){var bt=U.getValue();bt=bt.replace(vt,St),it(bt),U==null||U.setValue(bt)}return p.a.createElement(g.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:ri},p.a.createElement("div",{className:"markdown-editor-container ".concat(Ye," ").concat(_t?"on-preview":""," ").concat(Ut?"mini":""," ").concat(yi?"full-screen":""),style:$i},p.a.createElement(b,{insertTemp:Rt,watch:_t,fullScreen:yi,showNullButton:Bt,onActionCallback:Vr,hidetoolBar:Gi,uuid:ti.current,setOpenPhones:function(){Ht.current=!0}}),p.a.createElement("div",{className:"markdown-editor-body"},p.a.createElement("div",{className:"codemirror-container"},p.a.createElement("textarea",{ref:Dt,placeholder:gr})),_t?p.a.createElement("div",{ref:ir,className:"preview-container"},Ui==="stex"&&p.a.createElement(O,{value:He}),Ui!=="stex"&&p.a.createElement(x.a,{edit:!0,value:He,replaces:ua})):null))),Lt?p.a.createElement("a",{ref:zt,className:"editor-resize"}):null,p.a.createElement(N.a,null,he[li]?p.a.createElement(Z.a,{centered:!0,title:he[li],visible:!0,onCancel:xr,footer:null,className:"markdown-popup-form"},cn):null))}},SJMd:function(ct,Qe){/** * @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,le,Z,P=!1,Q,H;window.PR_SHOULD_USE_CONTINUATION=!0;var F,K;(function(){var W=window,M=["break,continue,do,else,for,if,return,while"],R=[M,"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"],g=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],p=[g,"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=[g,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],h=[g,"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"],s="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=[g,"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",n=[M,"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"],u=[M,"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"],c=[M,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],L=[p,h,f,d,o,n,u,c],C=/^(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",w="com",S="typ",T="lit",_="pun",l="pln",E="tag",m="dec",b="src",N="atn",D="atv",B="nocode",j="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function I(Te){for(var Ce=0,Le=!1,Be=!1,Fe=0,Me=Te.length;Fe122||(te<65||xe>90||ut.push([Math.max(65,xe)|32,Math.min(te,90)|32]),te<97||xe>122||ut.push([Math.max(97,xe)&~32,Math.min(te,122)&~32]))}}ut.sort(function(be,De){return be[0]-De[0]||De[1]-be[1]});for(var ae=[],he=[],We=0;Weme[0]&&(me[1]+1>me[0]&&Pe.push("-"),Pe.push(Ze(me[1])))}return Pe.push("]"),Pe.join("")}function ot(rt){for(var Ne=rt.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")),ut=Ne.length,tt=[],Pe=0,We=0;Pe=2&&xe==="["?Ne[Pe]=Xe(Se):xe!=="\\"&&(Ne[Pe]=Se.replace(/[a-zA-Z]/g,function(he){var me=he.charCodeAt(0);return"["+String.fromCharCode(me&~32,me|32)+"]"}))}return Ne.join("")}for(var et=[],Fe=0,Me=Te.length;Fe=0;)Le[et.charAt(rt)]=ot;var Ne=ot[1],ut=""+Ne;$e.hasOwnProperty(ut)||(Ve.push(Ne),$e[ut]=null)}Ve.push(/[\0-\uffff]/),Be=I(Ve)})();var Fe=Ce.length,Me=function(Ue){for(var Ve=Ue.sourceCode,$e=Ue.basePos,Ze=Ue.sourceNode,Xe=[$e,l],ot=0,et=Ve.match(Be)||[],rt={},Ne=0,ut=et.length;Ne=5&&Pe.substring(0,5)==="lang-",Se&&!(We&&typeof We[1]=="string")&&(Se=!1,Pe=b),Se||(rt[tt]=Pe)}var te=ot;if(ot+=tt.length,!Se)Xe.push($e+te,Pe);else{var ae=We[1],he=tt.indexOf(ae),me=he+ae.length;We[2]&&(me=tt.length-We[2].length,he=me-ae.length);var be=Pe.substring(5);G(Ze,$e+te,tt.substring(0,he),Me,Xe),G(Ze,$e+te+he,ae,ue(be,ae),Xe),G(Ze,$e+te+me,tt.substring(me),Me,Xe)}}Ue.decorations=Xe};return Me}function we(Te){var Ce=[],Le=[];Te.tripleQuotedStrings?Ce.push([x,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Te.multiLineStrings?Ce.push([x,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ce.push([x,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Te.verbatimStrings&&Le.push([x,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Be=Te.hashComments;Be&&(Te.cStyleComments?(Be>1?Ce.push([w,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ce.push([w,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Le.push([x,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ce.push([w,/^#[^\r\n]*/,null,"#"])),Te.cStyleComments&&(Le.push([w,/^\/\/[^\r\n]*/,null]),Le.push([w,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=Te.regexLiterals;if(Fe){var Me=Fe>1?"":` \r`,Ue=Me?".":"[\\S\\s]",Ve="/(?=[^/*"+Me+"])(?:[^/\\x5B\\x5C"+Me+"]|\\x5C"+Ue+"|\\x5B(?:[^\\x5C\\x5D"+Me+"]|\\x5C"+Ue+")*(?:\\x5D|$))+/";Le.push(["lang-regex",RegExp("^"+j+"("+Ve+")")])}var $e=Te.types;$e&&Le.push([S,$e]);var Ze=(""+Te.keywords).replace(/^ | $/g,"");Ze.length&&Le.push([O,new RegExp("^(?:"+Ze.replace(/[\s,]+/g,"|")+")\\b"),null]),Ce.push([l,/^\s+/,null,` \r \xA0`]);var Xe="^.[^\\s\\w.$@'\"`/\\\\]*";return Te.regexLiterals&&(Xe+="(?!s*/)"),Le.push([T,/^@[a-z_$][a-z_$@0-9]*/i,null],[S,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[l,/^[a-z_$][a-z_$@0-9]*/i,null],[T,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[l,/^\\[\s\S]?/,null],[_,new RegExp(Xe),null]),oe(Ce,Le)}var pe=we({keywords:L,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ee(Te,Ce,Le){for(var Be=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,Me=Te.ownerDocument,Ue=Me.createElement("li");Te.firstChild;)Ue.appendChild(Te.firstChild);var Ve=[Ue];function $e(Ne){var ut=Ne.nodeType;if(ut==1&&!Be.test(Ne.className))if(Ne.nodeName==="br")Ze(Ne),Ne.parentNode&&Ne.parentNode.removeChild(Ne);else for(var tt=Ne.firstChild;tt;tt=tt.nextSibling)$e(tt);else if((ut==3||ut==4)&&Le){var Pe=Ne.nodeValue,We=Pe.match(Fe);if(We){var Se=Pe.substring(0,We.index);Ne.nodeValue=Se;var ve=Pe.substring(We.index+We[0].length);if(ve){var xe=Ne.parentNode;xe.insertBefore(Me.createTextNode(ve),Ne.nextSibling)}Ze(Ne),Se||Ne.parentNode.removeChild(Ne)}}}function Ze(Ne){for(;!Ne.nextSibling;)if(Ne=Ne.parentNode,!Ne)return;function ut(We,Se){var ve=Se?We.cloneNode(!1):We,xe=We.parentNode;if(xe){var te=ut(xe,1),ae=We.nextSibling;te.appendChild(ve);for(var he=ae;he;he=ae)ae=he.nextSibling,te.appendChild(he)}return ve}for(var tt=ut(Ne.nextSibling,0),Pe;(Pe=tt.parentNode)&&Pe.nodeType===1;)tt=Pe;Ve.push(tt)}for(var Xe=0;Xe=xe&&($e+=2),Me>=te&&(ot+=2)}}finally{Pe&&(Pe.style.display=We)}}var Ae={};function fe(Te,Ce){for(var Le=Ce.length;--Le>=0;){var Be=Ce[Le];Ae.hasOwnProperty(Be)?W.console&&console.warn("cannot override language handler %s",Be):Ae[Be]=Te}}function ue(Te,Ce){return Te&&Ae.hasOwnProperty(Te)||(Te=/^\s*]*(?:>|$)/],[w,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[_,/^(?:<[%?]|[%?]>)/],["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"]),fe(oe([[l,/^[\s]+/,null,` \r `],[D,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[E,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[N,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[_,/^[=<>\/]+/],["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"]),fe(oe([],[[D,/^[\s\S]+/]]),["uq.val"]),fe(we({keywords:p,hashComments:!0,cStyleComments:!0,types:C}),["c","cc","cpp","cxx","cyc","m"]),fe(we({keywords:"null,true,false"}),["json"]),fe(we({keywords:h,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:C}),["cs"]),fe(we({keywords:f,cStyleComments:!0}),["java"]),fe(we({keywords:c,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),fe(we({keywords:n,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),fe(we({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),fe(we({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),fe(we({keywords:d,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),fe(we({keywords:s,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),fe(oe([],[[x,/^[\s\S]+/]]),["regex"]);function ie(Te){var Ce=Te.langExtension;try{var Le=v(Te.sourceNode,Te.pre),Be=Le.sourceCode;Te.sourceCode=Be,Te.spans=Le.spans,Te.basePos=0,ue(Ce,Be)(Te),_e(Te)}catch(Fe){W.console&&console.log(Fe&&Fe.stack||Fe)}}function de(Te,Ce,Le){var Be=Le||!1,Fe=Ce||null,Me=document.createElement("div");Me.innerHTML="
    "+Te+"
    ",Me=Me.firstChild,Be&&Ee(Me,Be,!0);var Ue={langExtension:Fe,numberLines:Be,sourceNode:Me,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return ie(Ue),Me.innerHTML}function se(Te,Ce){var Le=Ce||document.body,Be=Le.ownerDocument||document;function Fe(ve){return Le.getElementsByTagName(ve)}for(var Me=[Fe("pre"),Fe("code"),Fe("xmp")],Ue=[],Ve=0;Ve=0;h--)if(this.__items[h].match(f))return!0;return!1},R.prototype.set_indent=function(f,h){this.is_empty()&&(this.__indent_count=f||0,this.__alignment_count=h||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},R.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)},R.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},R.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},R.prototype.is_empty=function(){return this.__items.length===0},R.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},R.prototype.push=function(f){this.__items.push(f);var h=f.lastIndexOf(` `);h!==-1?this.__character_count=f.length-h:this.__character_count+=f.length},R.prototype.pop=function(){var f=null;return this.is_empty()||(f=this.__items.pop(),this.__character_count-=f.length),f},R.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},R.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},R.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},R.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 g(f,h){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)),h=h||"",f.indent_level>0&&(h=new Array(f.indent_level+1).join(this.__indent_string)),this.__base_string=h,this.__base_string_length=h.length}g.prototype.get_indent_size=function(f,h){var s=this.__base_string_length;return h=h||0,f<0&&(s=0),s+=f*this.__indent_size,s+=h,s},g.prototype.get_indent_string=function(f,h){var s=this.__base_string;return h=h||0,f<0&&(f=0,s=""),h+=f*this.__indent_size,this.__ensure_cache(h),s+=this.__cache[h],s},g.prototype.__ensure_cache=function(f){for(;f>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var f=this.__cache.length,h=0,s="";this.__indent_size&&f>=this.__indent_size&&(h=Math.floor(f/this.__indent_size),f-=h*this.__indent_size,s=new Array(h+1).join(this.__indent_string)),f&&(s+=new Array(f+1).join(" ")),this.__cache.push(s)};function p(f,h){this.__indent_cache=new g(f,h),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 R(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}p.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},p.prototype.get_line_number=function(){return this.__lines.length},p.prototype.get_indent_string=function(f,h){return this.__indent_cache.get_indent_string(f,h)},p.prototype.get_indent_size=function(f,h){return this.__indent_cache.get_indent_size(f,h)},p.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},p.prototype.add_new_line=function(f){return this.is_empty()||!f&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},p.prototype.get_code=function(f){this.trim(!0);var h=this.current_line.pop();h&&(h[h.length-1]===` `&&(h=h.replace(/\n+$/g,"")),this.current_line.push(h)),this._end_with_newline&&this.__add_outputline();var s=this.__lines.join(` `);return f!==` `&&(s=s.replace(/[\n]/g,f)),s},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(f,h){return f=f||0,h=h||0,this.next_line.set_indent(f,h),this.__lines.length>1?(this.current_line.set_indent(f,h),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(f){for(var h=0;h1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(f,h){for(var s=this.__lines.length-2;s>=0;){var d=this.__lines[s];if(d.is_empty())break;if(d.item(0).indexOf(f)!==0&&d.item(-1)!==h){this.__lines.splice(s+1,0,new R(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},M.exports.Output=p},,,,function(M){function R(f,h){this.raw_options=g(f,h),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"])}R.prototype._get_array=function(f,h){var s=this.raw_options[f],d=h||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(d=s.concat()):typeof s=="string"&&(d=s.split(/[^a-zA-Z0-9_\/\-]+/)),d},R.prototype._get_boolean=function(f,h){var s=this.raw_options[f],d=s===void 0?!!h:!!s;return d},R.prototype._get_characters=function(f,h){var s=this.raw_options[f],d=h||"";return typeof s=="string"&&(d=s.replace(/\\r/,"\r").replace(/\\n/,` `).replace(/\\t/," ")),d},R.prototype._get_number=function(f,h){var s=this.raw_options[f];h=parseInt(h,10),isNaN(h)&&(h=0);var d=parseInt(s,10);return isNaN(d)&&(d=h),d},R.prototype._get_selection=function(f,h,s){var d=this._get_selection_list(f,h,s);if(d.length!==1)throw new Error("Invalid Option Value: The option '"+f+`' can only be one of the following values: `+h+` You passed in: '`+this.raw_options[f]+"'");return d[0]},R.prototype._get_selection_list=function(f,h,s){if(!h||h.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[h[0]],!this._is_valid_selection(s,h))throw new Error("Invalid Default Value!");var d=this._get_array(f,s);if(!this._is_valid_selection(d,h))throw new Error("Invalid Option Value: The option '"+f+`' can contain only the following values: `+h+` You passed in: '`+this.raw_options[f]+"'");return d},R.prototype._is_valid_selection=function(f,h){return f.length&&h.length&&!f.some(function(s){return h.indexOf(s)===-1})};function g(f,h){var s={};f=p(f);var d;for(d in f)d!==h&&(s[d]=f[d]);if(h&&f[h])for(d in f[h])s[d]=f[h][d];return s}function p(f){var h={},s;for(s in f){var d=s.replace(/-/g,"_");h[d]=f[s]}return h}M.exports.Options=R,M.exports.normalizeOpts=p,M.exports.mergeOpts=g},,function(M){var R=RegExp.prototype.hasOwnProperty("sticky");function g(p){this.__input=p||"",this.__input_length=this.__input.length,this.__position=0}g.prototype.restart=function(){this.__position=0},g.prototype.back=function(){this.__position>0&&(this.__position-=1)},g.prototype.hasNext=function(){return this.__position=0&&p=0&&f=p.length&&this.__input.substring(f-p.length,f).toLowerCase()===p},M.exports.InputScanner=g},,,,,function(M){function R(g,p){g=typeof g=="string"?g:g.source,p=typeof p=="string"?p:p.source,this.__directives_block_pattern=new RegExp(g+/ beautify( \w+[:]\w+)+ /.source+p,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(g+/\sbeautify\signore:end\s/.source+p,"g")}R.prototype.get_directives=function(g){if(!g.match(this.__directives_block_pattern))return null;var p={};this.__directive_pattern.lastIndex=0;for(var f=this.__directive_pattern.exec(g);f;)p[f[1]]=f[2],f=this.__directive_pattern.exec(g);return p},R.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},M.exports.Directives=R},,function(M,R,g){var p=g(16).Beautifier,f=g(17).Options;function h(s,d){var o=new p(s,d);return o.beautify()}M.exports=h,M.exports.defaultOptions=function(){return new f}},function(M,R,g){var p=g(17).Options,f=g(2).Output,h=g(8).InputScanner,s=g(13).Directives,d=new s(/\/\*/,/\*\//),o=/\r\n|[\r\n]/,n=/\r\n|[\r\n]/g,u=/\s/,c=/(?:\s|\n)+/g,L=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,C=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function x(O,w){this._source_text=O||"",this._options=new p(w),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 w="";for(this._ch=this._input.next();this._ch;){if(w+=this._ch,this._ch==="\\")w+=this._input.next();else if(O.indexOf(this._ch)!==-1||this._ch===` `)break;this._ch=this._input.next()}return w},x.prototype.eatWhitespace=function(O){for(var w=u.test(this._input.peek()),S=0;u.test(this._input.peek());)this._ch=this._input.next(),O&&this._ch===` `&&((S===0||S0&&this._indentLevel--},x.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var O=this._source_text,w=this._options.eol;w==="auto"&&(w=` `,O&&o.test(O||"")&&(w=O.match(o)[0])),O=O.replace(n,` `);var S=O.match(/^[\t ]*/)[0];this._output=new f(this._options,S),this._input=new h(O),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var T=0,_=!1,l=!1,E=!1,m=!1,b=!1,N=!1,D=this._ch,B=!1,j,I,v;j=this._input.read(c),I=j!=="",v=D,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),D=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var G=this._input.read(L),Y=d.get_directives(G);Y&&Y.ignore==="start"&&(G+=d.readIgnored(this._input)),this.print_string(G),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(C)),this.eatWhitespace(!0);else if(this._ch==="@"||this._ch==="$")if(this.preserveSingleSpace(I),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"?m=!0:re==="import"&&(b=!0),re in this.NESTED_AT_RULE?(this._nestedLevel+=1,re in this.CONDITIONAL_GROUP_RULE&&(E=!0)):!_&&T===0&&re.indexOf(":")!==-1&&(l=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(I),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")l&&(l=!1,this.outdent()),E?(E=!1,_=this._indentLevel>=this._nestedLevel):_=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&_&&(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)):(v==="("?this._output.space_before_token=!1:v!==","&&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(),v==="{"&&this._output.trim(!0),b=!1,m=!1,l&&(this.outdent(),l=!1),this.print_string(this._ch),_=!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 oe=0;oe"||this._ch==="+"||this._ch==="~")&&!l&&T===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&&u.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(I),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),u.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 Ee=v==='"'||v==="'";this.preserveSingleSpace(Ee||I),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===` `&&B&&this._output.add_new_line()}var _e=this._output.get_code(w);return _e},M.exports.Beautifier=x},function(M,R,g){var p=g(6).Options;function f(h){p.call(this,h,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var s=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||s;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&&(p=!1,M=!0);var x=u&&(R||p&&(C==null||C<12.11)),O=P||K&&W>=9;function w(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S=function(e,t){var r=e.className,i=w(t).exec(r);if(i){var a=r.slice(i.index+i[0].length);e.className=r.slice(0,i.index)+(a?i[1]+a:"")}};function T(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function _(e,t){return T(e).appendChild(t)}function l(e,t,r,i){var a=document.createElement(e);if(r&&(a.className=r),i&&(a.style.cssText=i),typeof t=="string")a.appendChild(document.createTextNode(t));else if(t)for(var k=0;k=t)return z+(t-k);z+=$-k,z+=r-z%r,k=$+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=I(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r=t)return i+Math.min(z,t-a);if(a+=k-i,a+=r-a%r,i=k+1,a>=t)return i}}var fe=[""];function ue(e){for(;fe.length<=e;)fe.push(ie(fe)+" ");return fe[e]}function ie(e){return e[e.length-1]}function de(e,t){for(var r=[],i=0;i"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Te.test(e))}function Le(e,t){return t?t.source.indexOf("\\w")>-1&&Ce(e)?!0:t.test(e):Ce(e)}function Be(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\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&&Fe.test(e)}function Ue(e,t,r){for(;(r<0?t>0:tr?-1:1;;){if(t==r)return t;var a=(t+r)/2,k=i<0?Math.ceil(a):Math.floor(a);if(k==t)return e(k)?t:r;e(k)?r=k:t=k+i}}function $e(e,t,r,i){if(!e)return i(t,r,"ltr",0);for(var a=!1,k=0;kt||t==r&&z.to==t)&&(i(Math.max(z.from,t),Math.min(z.to,r),z.level==1?"rtl":"ltr",k),a=!0)}a||i(t,r,"ltr")}var Ze=null;function Xe(e,t,r){var i;Ze=null;for(var a=0;at)return a;k.to==t&&(k.from!=k.to&&r=="before"?i=a:Ze=a),k.from==t&&(k.from!=k.to&&r!="before"?i=a:Ze=a)}return i!=null?i:Ze}var ot=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,a=/[stwN]/,k=/[LRr]/,z=/[Lb1n]/,$=/[1n]/;function J(ee,ce,ge){this.level=ee,this.from=ce,this.to=ge}return function(ee,ce){var ge=ce=="ltr"?"L":"R";if(ee.length==0||ce=="ltr"&&!i.test(ee))return!1;for(var Ie=ee.length,Oe=[],je=0;je-1&&(i[t]=a.slice(0,k).concat(a.slice(k+1)))}}}function Pe(e,t){var r=ut(e,t);if(!r.length)return;for(var i=Array.prototype.slice.call(arguments,2),a=0;a0}function xe(e){e.prototype.on=function(t,r){Ne(this,t,r)},e.prototype.off=function(t,r){tt(this,t,r)}}function te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ae(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function he(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function me(e){te(e),ae(e)}function be(e){return e.target||e.srcElement}function De(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),u&&e.ctrlKey&&t==1&&(t=3),t}var Ge=function(){if(K&&W<9)return!1;var e=l("div");return"draggable"in e||"dragDrop"in e}(),st;function ft(e){if(st==null){var t=l("span","\u200B");_(e,l("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(st=t.offsetWidth<=1&&t.offsetHeight>2&&!(K&&W<8))}var r=st?l("span","\u200B"):l("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var pt;function Ct(e){if(pt!=null)return pt;var t=_(e,document.createTextNode("A\u062EA")),r=m(t,0,1).getBoundingClientRect(),i=m(t,1,2).getBoundingClientRect();return T(e),!r||r.left==r.right?!1:pt=i.right-r.right<3}var xt=` b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],i=e.length;t<=i;){var a=e.indexOf(` `,t);a==-1&&(a=e.length);var k=e.slice(t,e.charAt(a-1)=="\r"?a-1:a),z=k.indexOf("\r");z!=-1?(r.push(k.slice(0,z)),t+=z+1):(r.push(k),t=a+1)}return r}:function(e){return e.split(/\r\n?|\n/)},ht=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(r){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Ut=function(){var e=l("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Mt=null;function Zt(e){if(Mt!=null)return Mt;var t=_(e,l("span","x")),r=t.getBoundingClientRect(),i=m(t,0,1).getBoundingClientRect();return Mt=Math.abs(r.left-i.left)>1}var Yt={},Rt={};function Ti(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Yt[e]=t}function Ui(e,t){Rt[e]=t}function qe(e){if(typeof e=="string"&&Rt.hasOwnProperty(e))e=Rt[e];else if(e&&typeof e.name=="string"&&Rt.hasOwnProperty(e.name)){var t=Rt[e.name];typeof t=="string"&&(t={name:t}),e=ke(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return qe("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return qe("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function wt(e,t){t=qe(t);var r=Yt[t.name];if(!r)return wt(e,"text/plain");var i=r(e,t);if(Ot.hasOwnProperty(t.name)){var a=Ot[t.name];for(var k in a){if(!a.hasOwnProperty(k))continue;i.hasOwnProperty(k)&&(i["_"+k]=i[k]),i[k]=a[k]}}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var z in t.modeProps)i[z]=t.modeProps[z];return i}var Ot={};function Lt(e,t){var r=Ot.hasOwnProperty(e)?Ot[e]:Ot[e]={};v(t,r)}function qt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var i in t){var a=t[i];a instanceof Array&&(a=a.concat([])),r[i]=a}return r}function qi(e,t){for(var r;e.innerMode&&!(r=e.innerMode(t),!r||r.mode==e);)t=r.state,e=r.mode;return r||{mode:e,state:t}}function er(e,t,r){return e.startState?e.startState(t,r):!0}var Bt=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};Bt.prototype.eol=function(){return this.pos>=this.string.length},Bt.prototype.sol=function(){return this.pos==this.lineStart},Bt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Bt.prototype.next=function(){if(this.post},Bt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Bt.prototype.skipToEnd=function(){this.pos=this.string.length},Bt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Bt.prototype.backUp=function(e){this.pos-=e},Bt.prototype.column=function(){return this.lastColumnPos0?null:(k&&t!==!1&&(this.pos+=k[0].length),k)}},Bt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Bt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Bt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Bt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function mt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var i=0;;++i){var a=r.children[i],k=a.chunkSize();if(t=e.first&&tr?Ye(r,mt(e,r).text.length):A(t,mt(e,t.line).text.length)}function A(e,t){var r=e.ch;return r==null||r>t?Ye(e.line,t):r<0?Ye(e.line,0):e}function U(e,t){for(var r=[],i=0;ithis.maxLookAhead&&(this.maxLookAhead=e),t},V.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}},V.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},V.fromSaved=function(e,t,r){return t instanceof q?new V(e,qt(e.mode,t.state),r,t.lookAhead):new V(e,qt(e.mode,t),r)},V.prototype.save=function(e){var t=e!==!1?qt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new q(t,this.maxLookAhead):t};function ye(e,t,r,i){var a=[e.state.modeGen],k={};yi(e,t.text,e.doc.mode,r,function(ee,ce){return a.push(ee,ce)},k,i);for(var z=r.state,$=function(ee){r.baseTokens=a;var ce=e.state.overlays[ee],ge=1,Ie=0;r.state=!0,yi(e,t.text,ce.mode,r,function(Oe,je){for(var Ke=ge;IeOe&&a.splice(ge,1,Oe,a[ge+1],Je),ge+=2,Ie=Math.min(Oe,Je)}if(!je)return;if(ce.opaque)a.splice(Ke,ge-Ke,Oe,"overlay "+je),ge=Ke+2;else for(;Kee.options.maxHighlightLength&&qt(e.doc.mode,i.state),k=ye(e,t,i);a&&(i.state=a),t.stateAfter=i.save(!a),t.styles=k.styles,k.classes?t.styleClasses=k.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function it(e,t,r){var i=e.doc,a=e.display;if(!i.mode.startState)return new V(i,!0,t);var k=_i(e,t,r),z=k>i.first&&mt(i,k-1).stateAfter,$=z?V.fromSaved(i,z,k):new V(i,er(i.mode),k);return i.iter(k,t,function(J){gt(e,J.text,$);var ee=$.line;J.stateAfter=ee==t-1||ee%5==0||ee>=a.viewFrom&&eet.start)return k}throw new Error("Mode "+e.name+" failed to advance stream.")}var jt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function $t(e,t,r,i){var a=e.doc,k=a.mode,z;t=y(a,t);var $=mt(a,t.line),J=it(e,t.line,r),ee=new Bt($.text,e.options.tabSize,J),ce;for(i&&(ce=[]);(i||ee.pose.options.maxHighlightLength?($=!1,z&>(e,t,i,ce.pos),ce.pos=t.length,ge=null):ge=Pi(_t(r,ce,i.state,Ie),k),Ie){var Oe=Ie[0].name;Oe&&(ge="m-"+(ge?Oe+" "+ge:Oe))}if(!$||ee!=ge){for(;Jz;--$){if($<=k.first)return k.first;var J=mt(k,$-1),ee=J.stateAfter;if(ee&&(!r||$+(ee instanceof q?ee.lookAhead:0)<=k.modeFrontier))return $;var ce=G(J.text,null,e.options.tabSize);(a==null||i>ce)&&(a=$-1,i=ce)}return a}function Xi(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontierr;i--){var a=mt(e,i).stateAfter;if(a&&(!(a instanceof q)||i+a.lookAhead=t:k.to>t);(i||(i=[])).push(new lr(z,k.from,J?null:k.to))}}return i}function Kr(e,t,r){var i;if(e)for(var a=0;a=t:k.to>t);if($||k.from==t&&z.type=="bookmark"&&(!r||k.marker.insertLeft)){var J=k.from==null||(z.inclusiveLeft?k.from<=t:k.from0&&$)for(var dt=0;dt<$.length;++dt)$[dt].to==null&&(at||(at=[])).push(new lr($[dt].marker,null,null));for(var Et=0;Et0)continue;var ce=[J,1],ge=Tt(ee.from,$.from),Ie=Tt(ee.to,$.to);(ge<0||!z.inclusiveLeft&&!ge)&&ce.push({from:ee.from,to:$.from}),(Ie>0||!z.inclusiveRight&&!Ie)&&ce.push({from:$.to,to:ee.to}),a.splice.apply(a,ce),J+=ce.length-3}return a}function dn(e){var t=e.markedSpans;if(!t)return;for(var r=0;rt)&&(!i||pi(i,k.marker)<0)&&(i=k.marker)}return i}function ui(e,t,r,i,a){var k=mt(e,t),z=li&&k.markedSpans;if(z)for(var $=0;$=0&&ge<=0||ce<=0&&ge>=0)continue;if(ce<=0&&(J.marker.inclusiveRight&&a.inclusiveLeft?Tt(ee.to,r)>=0:Tt(ee.to,r)>0)||ce>=0&&(J.marker.inclusiveRight&&a.inclusiveLeft?Tt(ee.from,i)<=0:Tt(ee.from,i)<0))return!0}}function wi(e){for(var t;t=ri(e);)e=t.find(-1,!0).line;return e}function Vr(e){for(var t;t=zt(e);)e=t.find(1,!0).line;return e}function Er(e){for(var t,r;t=zt(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function cn(e,t){var r=mt(e,t),i=wi(r);return r==i?t:kt(i)}function xr(e,t){if(t>e.lastLine())return t;var r=mt(e,t),i;if(!rr(e,r))return t;for(;i=zt(r);)r=i.find(1,!0).line;return kt(r)+1}function rr(e,t){var r=li&&t.markedSpans;if(r)for(var i=void 0,a=0;at.maxLineLength&&(t.maxLineLength=a,t.maxLine=i)})}var Dr=function(e,t,r){this.text=e,br(this,t),this.height=r?r(this):1};Dr.prototype.lineNo=function(){return kt(this)},xe(Dr);function ua(e,t,r,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),dn(e),br(e,r);var a=i?i(e):1;a!=e.height&&vi(e,a)}function vt(e){e.parent=null,dn(e)}var St={},bt={};function It(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?bt:St;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Ft(e,t){var r=E("span",null,null,M?"padding-right: .1px":null),i={pre:E("pre",[r],"CodeMirror-line"),content:r,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 k=a?t.rest[a-1]:t.line,z=void 0;i.pos=0,i.addToken=Nt,Ct(e.display.measure)&&(z=et(k,e.doc.direction))&&(i.addToken=Ai(i.addToken,z)),i.map=[];var $=t!=e.display.externalMeasured&&kt(k);ur(k,i,He(e,k,$)),k.styleClasses&&(k.styleClasses.bgClass&&(i.bgClass=B(k.styleClasses.bgClass,i.bgClass||"")),k.styleClasses.textClass&&(i.textClass=B(k.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(ft(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(M){var J=i.content.lastChild;(/\bcm-tab\b/.test(J.className)||J.querySelector&&J.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return Pe(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=B(i.pre.className,i.textClass||"")),i}function Vt(e){var t=l("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Nt(e,t,r,i,a,k,z){if(!t)return;var $=e.splitSpaces?si(t,e.trailingSpace):t,J=e.cm.state.specialChars,ee=!1,ce;if(!J.test(t))e.col+=t.length,ce=document.createTextNode($),e.map.push(e.pos,e.pos+t.length,ce),K&&W<9&&(ee=!0),e.pos+=t.length;else{ce=document.createDocumentFragment();for(var ge=0;;){J.lastIndex=ge;var Ie=J.exec(t),Oe=Ie?Ie.index-ge:t.length-ge;if(Oe){var je=document.createTextNode($.slice(ge,ge+Oe));K&&W<9?ce.appendChild(l("span",[je])):ce.appendChild(je),e.map.push(e.pos,e.pos+Oe,je),e.col+=Oe,e.pos+=Oe}if(!Ie)break;ge+=Oe+1;var Ke=void 0;if(Ie[0]==" "){var Je=e.cm.options.tabSize,nt=Je-e.col%Je;Ke=ce.appendChild(l("span",ue(nt),"cm-tab")),Ke.setAttribute("role","presentation"),Ke.setAttribute("cm-text"," "),e.col+=nt}else Ie[0]=="\r"||Ie[0]==` `?(Ke=ce.appendChild(l("span",Ie[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ke.setAttribute("cm-text",Ie[0]),e.col+=1):(Ke=e.cm.options.specialCharPlaceholder(Ie[0]),Ke.setAttribute("cm-text",Ie[0]),K&&W<9?ce.appendChild(l("span",[Ke])):ce.appendChild(Ke),e.col+=1);e.map.push(e.pos,e.pos+1,Ke),e.pos++}}if(e.trailingSpace=$.charCodeAt(t.length-1)==32,r||i||a||ee||k||z){var lt=r||"";i&&(lt+=i),a&&(lt+=a);var at=l("span",[ce],lt,k);if(z)for(var dt in z)z.hasOwnProperty(dt)&&dt!="style"&&dt!="class"&&at.setAttribute(dt,z[dt]);return e.content.appendChild(at)}e.content.appendChild(ce)}function si(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,i="",a=0;aee&&ge.from<=ee);Ie++);if(ge.to>=ce)return e(r,i,a,k,z,$,J);e(r,i.slice(0,ge.to-ee),a,k,null,$,J),k=null,i=i.slice(ge.to-ee),ee=ge.to}}}function Pt(e,t,r,i){var a=!i&&r.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",r.id)),a&&(e.cm.display.input.setUneditable(a),e.content.appendChild(a)),e.pos+=t,e.trailingSpace=!1}function ur(e,t,r){var i=e.markedSpans,a=e.text,k=0;if(!i){for(var z=1;zJ||At.collapsed&&yt.to==J&&yt.from==J)){if(yt.to!=null&&yt.to!=J&&Oe>yt.to&&(Oe=yt.to,Ke=""),At.className&&(je+=" "+At.className),At.css&&(Ie=(Ie?Ie+";":"")+At.css),At.startStyle&&yt.from==J&&(Je+=" "+At.startStyle),At.endStyle&&yt.to==Oe&&(dt||(dt=[])).push(At.endStyle,yt.to),At.title&&((lt||(lt={})).title=At.title),At.attributes)for(var Xt in At.attributes)(lt||(lt={}))[Xt]=At.attributes[Xt];At.collapsed&&(!nt||pi(nt.marker,At)<0)&&(nt=yt)}else yt.from>J&&Oe>yt.from&&(Oe=yt.from)}if(dt)for(var ci=0;ci=$)break;for(var Fi=Math.min($,Oe);;){if(ce){var Ii=J+ce.length;if(!nt){var ni=Ii>Fi?ce.slice(0,Fi-J):ce;t.addToken(t,ni,ge?ge+je:je,Je,J+ni.length==Oe?Ke:"",Ie,lt)}if(Ii>=Fi){ce=ce.slice(Fi-J),J=Fi;break}J=Ii,Je=""}ce=a.slice(k,k=r[ee++]),ge=It(r[ee++],t.cm.options)}}}function Wt(e,t,r){this.line=t,this.rest=Er(t),this.size=this.rest?kt(ie(this.rest))-r+1:1,this.node=this.text=null,this.hidden=rr(e,t)}function Oi(e,t,r){for(var i=[],a,k=t;k2&&k.push((J.bottom+ee.top)/2-r.top)}}k.push(r.bottom-r.top)}}function es(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;ir)return{map:e.measure.maps[a],cache:e.measure.caches[a],before:!0}}function Bo(e,t){t=wi(t);var r=kt(t),i=e.display.externalMeasured=new Wt(e.doc,t,r);i.lineN=r;var a=i.built=Ft(e,i);return i.text=a.pre,_(e.display.lineMeasure,a.pre),i}function ts(e,t,r,i){return ar(e,Xr(e,t),r,i)}function fa(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&tt)&&(k=J-$,a=k-1,t>=J&&(z="right")),a!=null){if(i=e[ee+2],$==J&&r==(i.insertLeft?"left":"right")&&(z=r),r=="left"&&a==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)i=e[(ee-=3)+2],z="left";if(r=="right"&&a==J-$)for(;ee=0&&!((r=e[a]).left!=r.right);a--);return r}function Ho(e,t,r,i){var a=rs(t.map,r,i),k=a.node,z=a.start,$=a.end,J=a.collapse,ee;if(k.nodeType==3){for(var ce=0;ce<4;ce++){for(;z&&Me(t.line.text.charAt(a.coverStart+z));)--z;for(;a.coverStart+$0&&(J=i="right");var ge;e.options.lineWrapping&&(ge=k.getClientRects()).length>1?ee=ge[i=="right"?ge.length-1:0]:ee=k.getBoundingClientRect()}if(K&&W<9&&!z&&(!ee||!ee.left&&!ee.right)){var Ie=k.parentNode.getClientRects()[0];Ie?ee={left:Ie.left,right:Ie.left+$r(e.display),top:Ie.top,bottom:Ie.bottom}:ee=is}for(var Oe=ee.top-t.rect.top,je=ee.bottom-t.rect.top,Ke=(Oe+je)/2,Je=t.view.measure.heights,nt=0;nt=i.text.length?(J=i.text.length,ee="before"):J<=0&&(J=0,ee="after"),!$)return z(ee=="before"?J-1:J,ee=="before");function ce(je,Ke,Je){var nt=$[Ke],lt=nt.level==1;return z(Je?je-1:je,lt!=Je)}var ge=Xe($,J,ee),Ie=Ze,Oe=ce(J,ge,ee=="before");return Ie!=null&&(Oe.other=ce(J,Ie,ee!="before")),Oe}function us(e,t){var r=0;t=y(e.doc,t),e.options.lineWrapping||(r=$r(e.display)*t.ch);var i=mt(e.doc,t.line),a=$i(i)+Hn(e.display);return{left:r,right:r,top:a,bottom:a+i.height}}function ga(e,t,r,i,a){var k=Ye(e,t,r);return k.xRel=a,i&&(k.outside=i),k}function va(e,t,r){var i=e.doc;if(r+=e.display.viewOffset,r<0)return ga(i.first,0,null,-1,-1);var a=Bi(i,r),k=i.first+i.size-1;if(a>k)return ga(i.first+i.size-1,mt(i,k).text.length,null,1,1);t<0&&(t=0);for(var z=mt(i,a);;){var $=Go(e,z,a,t,r),J=ir(z,$.ch+($.xRel>0||$.outside>0?1:0));if(!J)return $;var ee=J.find(1);if(ee.line==a)return ee;z=mt(i,a=ee.line)}}function hs(e,t,r,i){i-=pa(t);var a=t.text.length,k=Ve(function(z){return ar(e,r,z-1).bottom<=i},a,0);return a=Ve(function(z){return ar(e,r,z).top>i},k,a),{begin:k,end:a}}function ds(e,t,r,i){r||(r=Xr(e,t));var a=Wn(e,t,ar(e,r,i),"line").top;return hs(e,t,r,a)}function ya(e,t,r,i){return e.bottom<=r?!1:e.top>r?!0:(i?e.left:e.right)>t}function Go(e,t,r,i,a){a-=$i(t);var k=Xr(e,t),z=pa(t),$=0,J=t.text.length,ee=!0,ce=et(t,e.doc.direction);if(ce){var ge=(e.options.lineWrapping?Ko:zo)(e,t,r,k,ce,i,a);ee=ge.level!=1,$=ee?ge.from:ge.to-1,J=ee?ge.to:ge.from-1}var Ie=null,Oe=null,je=Ve(function(Et){var yt=ar(e,k,Et);return yt.top+=z,yt.bottom+=z,ya(yt,i,a,!1)?(yt.top<=a&&yt.left<=i&&(Ie=Et,Oe=yt),!0):!1},$,J),Ke,Je,nt=!1;if(Oe){var lt=i-Oe.left=dt.bottom?1:0}return je=Ue(t.text,je,1),ga(r,je,Je,nt,i-Ke)}function zo(e,t,r,i,a,k,z){var $=Ve(function(ge){var Ie=a[ge],Oe=Ie.level!=1;return ya(Qi(e,Ye(r,Oe?Ie.to:Ie.from,Oe?"before":"after"),"line",t,i),k,z,!0)},0,a.length-1),J=a[$];if($>0){var ee=J.level!=1,ce=Qi(e,Ye(r,ee?J.from:J.to,ee?"after":"before"),"line",t,i);ya(ce,k,z,!0)&&ce.top>z&&(J=a[$-1])}return J}function Ko(e,t,r,i,a,k,z){var $=hs(e,t,i,z),J=$.begin,ee=$.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var ce=null,ge=null,Ie=0;Ie=ee||Oe.to<=J)continue;var je=Oe.level!=1,Ke=ar(e,i,je?Math.min(ee,Oe.to)-1:Math.max(J,Oe.from)).right,Je=KeJe)&&(ce=Oe,ge=Je)}return ce||(ce=a[a.length-1]),ce.fromee&&(ce={from:ce.from,to:ee,level:ce.level}),ce}var Mr;function Yr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Mr==null){Mr=l("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Mr.appendChild(document.createTextNode("x")),Mr.appendChild(l("br"));Mr.appendChild(document.createTextNode("x"))}_(e.measure,Mr);var r=Mr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),T(e.measure),r||1}function $r(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=l("span","xxxxxxxxxx"),r=l("pre",[t],"CodeMirror-line-like");_(e.measure,r);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,r={},i={},a=t.gutters.clientLeft,k=t.gutters.firstChild,z=0;k;k=k.nextSibling,++z){var $=e.display.gutterSpecs[z].className;r[$]=k.offsetLeft+k.clientLeft+a,i[$]=k.clientWidth}return{fixedPos:ba(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function ba(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function cs(e){var t=Yr(e.display),r=e.options.lineWrapping,i=r&&Math.max(5,e.display.scroller.clientWidth/$r(e.display)-3);return function(a){if(rr(e.doc,a))return 0;var k=0;if(a.widgets)for(var z=0;z0&&(ee=mt(e.doc,J.line).text).length==J.ch){var ce=G(ee,ee.length,e.options.tabSize)-ee.length;J=Ye(J.line,Math.max(0,Math.round((k-qa(e.display).left)/$r(e.display))-ce))}return J}function Fr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,i=0;it)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo)li&&cn(e.doc,t)a.viewFrom?wr(e):(a.viewFrom+=i,a.viewTo+=i);else if(t<=a.viewFrom&&r>=a.viewTo)wr(e);else if(t<=a.viewFrom){var k=Gn(e,r,r+i,1);k?(a.view=a.view.slice(k.index),a.viewFrom=k.lineN,a.viewTo+=i):wr(e)}else if(r>=a.viewTo){var z=Gn(e,t,t,-1);z?(a.view=a.view.slice(0,z.index),a.viewTo=z.lineN):wr(e)}else{var $=Gn(e,t,t,-1),J=Gn(e,r,r+i,1);$&&J?(a.view=a.view.slice(0,$.index).concat(Oi(e,$.lineN,J.lineN)).concat(a.view.slice(J.index)),a.viewTo+=i):wr(e)}var ee=a.externalMeasured;ee&&(r=a.lineN&&t=i.viewTo)return;var k=i.view[Fr(e,t)];if(k.node==null)return;var z=k.changes||(k.changes=[]);re(z,r)==-1&&z.push(r)}function wr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gn(e,t,r,i){var a=Fr(e,t),k,z=e.display.view;if(!li||r==e.doc.first+e.doc.size)return{index:a,lineN:r};for(var $=e.display.viewFrom,J=0;J0){if(a==z.length-1)return null;k=$+z[a].size-t,a++}else k=$-t;t+=k,r+=k}for(;cn(e.doc,r)!=r;){if(a==(i<0?0:z.length-1))return null;r+=i*z[a-(i<0?1:0)].size,a+=i}return{index:a,lineN:r}}function Vo(e,t,r){var i=e.display,a=i.view;a.length==0||t>=i.viewTo||r<=i.viewFrom?(i.view=Oi(e,t,r),i.viewFrom=t):(i.viewFrom>t?i.view=Oi(e,t,i.viewFrom).concat(i.view):i.viewFromr&&(i.view=i.view.slice(0,Fr(e,r)))),i.viewTo=r}function fs(e){for(var t=e.display.view,r=0,i=0;i=e.display.viewTo||$.to().line0?t.blinker=setInterval(function(){e.hasFocus()||Qr(e),t.cursorDiv.style.visibility=(r=!r)?"":"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,Qr(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Pe(e,"focus",e,t),e.state.focused=!0,D(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),M&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),xa(e)}function Qr(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Pe(e,"blur",e,t),e.state.focused=!1,S(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kn(e){for(var t=e.display,r=t.lineDiv.offsetTop,i=0;i.005||ce<-.005)&&(vi(a.line,z),ys(a.line),a.rest))for(var ge=0;gee.display.sizerWidth){var Ie=Math.ceil($/$r(e.display));Ie>e.display.maxLineLength&&(e.display.maxLineLength=Ie,e.display.maxLine=a.line,e.display.maxLineChanged=!0)}}}function ys(e){if(e.widgets)for(var t=0;t=z&&(k=Bi(t,$i(mt(t,J))-e.wrapper.clientHeight),z=J)}return{from:k,to:Math.max(z,k+1)}}function Yo(e,t){if(We(e,"scrollCursorIntoView"))return;var r=e.display,i=r.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&&!s){var k=l("div","\u200B",null,`position: absolute; top: `+(t.top-r.viewOffset-Hn(e.display))+`px; height: `+(t.bottom-t.top+nr(e)+r.barHeight)+`px; left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(k),k.scrollIntoView(a),e.display.lineSpace.removeChild(k)}}function $o(e,t,r,i){i==null&&(i=0);var a;!e.options.lineWrapping&&t==r&&(t=t.ch?Ye(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Ye(t.line,t.ch+1,"before"):t);for(var k=0;k<5;k++){var z=!1,$=Qi(e,t),J=!r||r==t?$:Qi(e,r);a={left:Math.min($.left,J.left),top:Math.min($.top,J.top)-i,right:Math.max($.left,J.left),bottom:Math.max($.bottom,J.bottom)+i};var ee=wa(e,a),ce=e.doc.scrollTop,ge=e.doc.scrollLeft;if(ee.scrollTop!=null&&(En(e,ee.scrollTop),Math.abs(e.doc.scrollTop-ce)>1&&(z=!0)),ee.scrollLeft!=null&&(Ur(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>1&&(z=!0)),!z)break}return a}function Qo(e,t){var r=wa(e,t);r.scrollTop!=null&&En(e,r.scrollTop),r.scrollLeft!=null&&Ur(e,r.scrollLeft)}function wa(e,t){var r=e.display,i=Yr(e.display);t.top<0&&(t.top=0);var a=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,k=ca(e),z={};t.bottom-t.top>k&&(t.bottom=t.top+k);var $=e.doc.height+da(r),J=t.top$-i;if(t.topa+k){var ce=Math.min(t.top,(ee?$:t.bottom)-k);ce!=a&&(z.scrollTop=ce)}var ge=e.options.fixedGutter?0:r.gutters.offsetWidth,Ie=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-ge,Oe=Pr(e)-r.gutters.offsetWidth,je=t.right-t.left>Oe;return je&&(t.right=t.left+Oe),t.left<10?z.scrollLeft=0:t.leftOe+Ie-3&&(z.scrollLeft=t.right+(je?0:10)-Oe),z}function Sa(e,t){if(t==null)return;Xn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Zr(e){Xn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bn(e,t,r){(t!=null||r!=null)&&Xn(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function Zo(e,t){Xn(e),e.curOp.scrollToPos=t}function Xn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=us(e,t.from),i=us(e,t.to);_s(e,r,i,t.margin)}}function _s(e,t,r,i){var a=wa(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-i,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+i});bn(e,a.scrollLeft,a.scrollTop)}function En(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;P||Aa(e,{top:t}),bs(e,t,!0),P&&Aa(e),wn(e,100)}function bs(e,t,r){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!r)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Ur(e,t,r,i){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?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 xn(e){var t=e.display,r=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?r:0,docHeight:i,scrollHeight:i+nr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Br=function(e,t,r){this.cm=r;var i=this.vert=l("div",[l("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),a=this.horiz=l("div",[l("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=a.tabIndex=-1,e(i),e(a),Ne(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),Ne(a,"scroll",function(){a.clientWidth&&t(a.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,K&&W<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Br.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(r){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=r?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var k=e.viewWidth-e.barLeft-(r?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+k)+"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:r?i:0,bottom:t?i:0}},Br.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Br.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Br.prototype.zeroWidthHack=function(){var e=u&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},Br.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function i(){var a=e.getBoundingClientRect(),k=r=="vert"?document.elementFromPoint(a.right-1,(a.top+a.bottom)/2):document.elementFromPoint((a.right+a.left)/2,a.bottom-1);k!=e?e.style.pointerEvents="none":t.set(1e3,i)}t.set(1e3,i)},Br.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Tn=function(){};Tn.prototype.update=function(){return{bottom:0,right:0}},Tn.prototype.setScrollLeft=function(){},Tn.prototype.setScrollTop=function(){},Tn.prototype.clear=function(){};function Jr(e,t){t||(t=xn(e));var r=e.display.barWidth,i=e.display.barHeight;Es(e,t);for(var a=0;a<4&&r!=e.display.barWidth||i!=e.display.barHeight;a++)r!=e.display.barWidth&&e.options.lineWrapping&&Kn(e),Es(e,xn(e)),r=e.display.barWidth,i=e.display.barHeight}function Es(e,t){var r=e.display,i=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=i.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=i.bottom)+"px",r.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=i.bottom+"px",r.scrollbarFiller.style.width=i.right+"px"):r.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=i.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var xs={native:Br,null:Tn};function Ts(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&S(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new xs[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ne(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){r=="horizontal"?Ur(e,t):En(e,t)},e),e.display.scrollbars.addClass&&D(e.display.wrapper,e.display.scrollbars.addClass)}var Jo=0;function jr(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:++Jo},Ki(e.curOp)}function Hr(e){var t=e.curOp;t&&Io(t,function(r){for(var i=0;i=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Yn(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,r=t.display;e.updatedDisplay&&Kn(t),e.barMeasure=xn(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=ts(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+nr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Pr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function rl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)return;var r=+new Date+e.options.workTime,i=it(e,t.highlightFrontier),a=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(k){if(i.line>=e.display.viewFrom){var z=k.styles,$=k.text.length>e.options.maxHighlightLength?qt(t.mode,i.state):null,J=ye(e,k,i,!0);$&&(i.state=$),k.styles=J.styles;var ee=k.styleClasses,ce=J.classes;ce?k.styleClasses=ce:ee&&(k.styleClasses=null);for(var ge=!z||z.length!=k.styles.length||ee!=ce&&(!ee||!ce||ee.bgClass!=ce.bgClass||ee.textClass!=ce.textClass),Ie=0;!ge&&Ier)return wn(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),a.length&&Ni(e,function(){for(var k=0;k=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&fs(e)==0)return!1;Cs(e)&&(wr(e),t.dims=_a(e));var a=i.first+i.size,k=Math.max(t.visible.from-e.options.viewportMargin,i.first),z=Math.min(a,t.visible.to+e.options.viewportMargin);r.viewFromz&&r.viewTo-z<20&&(z=Math.min(a,r.viewTo)),li&&(k=cn(e.doc,k),z=xr(e.doc,z));var $=k!=r.viewFrom||z!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vo(e,k,z),r.viewOffset=$i(mt(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var J=fs(e);if(!$&&J==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var ee=ol(e);return J>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),J>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(ee),T(r.cursorDiv),T(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,$&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,wn(e,400)),r.updateLineNumbers=null,!0}function ws(e,t){for(var r=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==Pr(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+da(e.display)-ca(e),r.top)}),t.visible=Vn(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=Vn(e.display,e.doc,r));if(!Ca(e,t))break;Kn(e);var a=xn(e);_n(e),Jr(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 r=new Yn(e,t);if(Ca(e,r)){Kn(e),ws(e,r);var i=xn(e);_n(e),Jr(e,i),Ra(e,i),r.finish()}}function ul(e,t,r){var i=e.display,a=e.options.lineNumbers,k=i.lineDiv,z=k.firstChild;function $(je){var Ke=je.nextSibling;return M&&u&&e.display.currentWheelTarget==je?je.style.display="none":je.parentNode.removeChild(je),Ke}for(var J=i.view,ee=i.viewFrom,ce=0;ce-1&&(Oe=!1),Ya(e,ge,ee,r)),Oe&&(T(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(fr(e.options,ee)))),z=ge.node.nextSibling}ee+=ge.size}for(;z;)z=$(z)}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+nr(e)+"px"}function Ss(e){var t=e.display,r=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,k=i+"px",z=0;zz.clientWidth,J=z.scrollHeight>z.clientHeight;if(!(i&&$||a&&J))return;if(a&&u&&M){e:for(var ee=t.target,ce=k.view;ee!=z;ee=ee.parentNode)for(var ge=0;ge=0&&Tt(e,i.to())<=0)return r}return-1};var Gt=function(e,t){this.anchor=e,this.head=t};Gt.prototype.from=function(){return vr(this.anchor,this.head)},Gt.prototype.to=function(){return gr(this.anchor,this.head)},Gt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Zi(e,t,r){var i=e&&e.options.selectionsMayTouch,a=t[r];t.sort(function(Ie,Oe){return Tt(Ie.from(),Oe.from())}),r=re(t,a);for(var k=1;k0:J>=0){var ee=vr($.from(),z.from()),ce=gr($.to(),z.to()),ge=$.empty()?z.from()==z.head:$.from()==$.head;k<=r&&--r,t.splice(--k,2,new Gt(ge?ce:ee,ge?ee:ce))}}return new Wi(t,r)}function Sr(e,t){return new Wi([new Gt(e,t||e)],0)}function Cr(e){return e.text?Ye(e.from.line+e.text.length-1,ie(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ls(e,t){if(Tt(e,t.from)<0)return e;if(Tt(e,t.to)<=0)return Cr(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=Cr(t).ch-t.to.ch),Ye(r,i)}function Ia(e,t){for(var r=[],i=0;i1&&e.remove($.line+1,je-1),e.insert($.line+1,nt)}mi(e,"change",e,t)}function Ar(e,t,r){function i(a,k,z){if(a.linked)for(var $=0;$1&&!e.done[e.done.length-2].ranges)return e.done.pop(),ie(e.done)}function Ns(e,t,r,i){var a=e.history;a.undone.length=0;var k=+new Date,z,$;if((a.lastOp==i||a.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&a.lastModTime>k-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(z=pl(a,a.lastOp==i)))$=ie(z.changes),Tt(t.from,t.to)==0&&Tt(t.from,$.to)==0?$.to=Cr(t):z.changes.push(Pa(e,t));else{var J=ie(a.done);for((!J||!J.ranges)&&Zn(e.sel,a.done),z={changes:[Pa(e,t)],generation:a.generation},a.done.push(z);a.done.length>a.undoDepth;)a.done.shift(),a.done[0].ranges||a.done.shift()}a.done.push(r),a.generation=++a.maxGeneration,a.lastModTime=a.lastSelTime=k,a.lastOp=a.lastSelOp=i,a.lastOrigin=a.lastSelOrigin=t.origin,$||Pe(e,"historyAdded")}function ml(e,t,r,i){var a=t.charAt(0);return a=="*"||a=="+"&&r.ranges.length==i.ranges.length&&r.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,r,i){var a=e.history,k=i&&i.origin;r==a.lastSelOp||k&&a.lastSelOrigin==k&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==k||ml(e,k,ie(a.done),t))?a.done[a.done.length-1]=t:Zn(t,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=k,a.lastSelOp=r,i&&i.clearRedo!==!1&&Ms(a.undone)}function Zn(e,t){var r=ie(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Fs(e,t,r,i){var a=t["spans_"+e.id],k=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,i),function(z){z.markedSpans&&((a||(a=t["spans_"+e.id]={}))[k]=z.markedSpans),++k})}function vl(e){if(!e)return null;for(var t,r=0;r-1&&(ie($)[ge]=ee[ge],delete ee[ge]))}}return i}function Ma(e,t,r,i){if(i){var a=e.anchor;if(r){var k=Tt(t,a)<0;k!=Tt(r,a)<0?(a=t,t=r):k!=Tt(t,r)<0&&(t=r)}return new Gt(a,t)}else return new Gt(r||t,t)}function Jn(e,t,r,i,a){a==null&&(a=e.cm&&(e.cm.display.shift||e.extend)),Ei(e,new Wi([Ma(e.sel.primary(),t,r,a)],0),i)}function Bs(e,t,r){for(var i=[],a=e.cm&&(e.cm.display.shift||e.extend),k=0;k=t.ch:$.to>t.ch))){if(a&&(Pe(J,"beforeCursorEnter"),J.explicitlyCleared))if(k.markedSpans){--z;continue}else break;if(!J.atomic)continue;if(r){var ge=J.find(i<0?1:-1),Ie=void 0;if((i<0?ce:ee)&&(ge=Ks(e,ge,-i,ge&&ge.line==t.line?k:null)),ge&&ge.line==t.line&&(Ie=Tt(ge,r))&&(i<0?Ie<0:Ie>0))return en(e,ge,t,i,a)}var Oe=J.find(i<0?-1:1);return(i<0?ee:ce)&&(Oe=Ks(e,Oe,i,Oe.line==t.line?k:null)),Oe?en(e,Oe,t,i,a):null}}return t}function ea(e,t,r,i,a){var k=i||1,z=en(e,t,r,k,a)||!a&&en(e,t,r,k,!0)||en(e,t,r,-k,a)||!a&&en(e,t,r,-k,!0);return z||(e.cantEdit=!0,Ye(e.first,0))}function Ks(e,t,r,i){return r<0&&t.ch==0?t.line>e.first?y(e,Ye(t.line-1)):null:r>0&&t.ch==(i||mt(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]==""&&Tt(t.from,t.to)==0)return;var r=Ia(e,t);Ns(e,t,r,e.cm?e.cm.curOp.id:NaN),An(e,t,r,Yi(e,t));var i=[];Ar(e,function(a,k){!k&&re(i,a.history)==-1&&(Js(a.history,t),i.push(a.history)),An(a,t,null,Yi(a,t))})}function ta(e,t,r){var i=e.cm&&e.cm.state.suppressEdits;if(i&&!r)return;for(var a=e.history,k,z=e.sel,$=t=="undo"?a.done:a.undone,J=t=="undo"?a.undone:a.done,ee=0;ee<$.length&&!(k=$[ee],r?k.ranges&&!k.equals(e.sel):!k.ranges);ee++);if(ee==$.length)return;for(a.lastOrigin=a.lastSelOrigin=null;;)if(k=$.pop(),k.ranges){if(Zn(k,J),r&&!k.equals(e.sel)){Ei(e,k,{clearRedo:!1});return}z=k}else if(i){$.push(k);return}else break;var ce=[];Zn(z,J),J.push({changes:ce,generation:a.generation}),a.generation=k.generation||++a.maxGeneration;for(var ge=ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"),Ie=function(Ke){var Je=k.changes[Ke];if(Je.origin=t,ge&&!Xs(e,Je,!1))return $.length=0,{};ce.push(Pa(e,Je));var nt=Ke?Ia(e,Je):ie($);An(e,Je,nt,Us(e,Je)),!Ke&&e.cm&&e.cm.scrollIntoView({from:Je.from,to:Cr(Je)});var lt=[];Ar(e,function(at,dt){!dt&&re(lt,at.history)==-1&&(Js(at.history,Je),lt.push(at.history)),An(at,Je,null,Us(at,Je))})},Oe=k.changes.length-1;Oe>=0;--Oe){var je=Ie(Oe);if(je)return je.v}}function $s(e,t){if(t==0)return;if(e.first+=t,e.sel=new Wi(de(e.sel.ranges,function(a){return new Gt(Ye(a.anchor.line+t,a.anchor.ch),Ye(a.head.line+t,a.head.ch))}),e.sel.primIndex),e.cm){Ri(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,i=r.viewFrom;ie.lastLine())return;if(t.from.linek&&(t={from:t.from,to:Ye(k,mt(e,k).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Gi(e,t.from,t.to),r||(r=Ia(e,t)),e.cm?bl(e.cm,t,i):Da(e,t,i),qn(e,r,pe),e.cantEdit&&ea(e,Ye(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,r){var i=e.doc,a=e.display,k=t.from,z=t.to,$=!1,J=k.line;e.options.lineWrapping||(J=kt(wi(mt(i,k.line))),i.iter(J,z.line+1,function(Oe){if(Oe==a.maxLine)return $=!0,!0})),i.sel.contains(t.from,t.to)>-1&&Se(e),Da(i,t,r,cs(e)),e.options.lineWrapping||(i.iter(J,k.line+t.text.length,function(Oe){var je=pn(Oe);je>a.maxLineLength&&(a.maxLine=Oe,a.maxLineLength=je,a.maxLineChanged=!0,$=!1)}),$&&(e.curOp.updateMaxLine=!0)),Xi(i,k.line),wn(e,400);var ee=t.text.length-(z.line-k.line)-1;t.full?Ri(e):k.line==z.line&&t.text.length==1&&!ks(e.doc,t)?Tr(e,k.line,"text"):Ri(e,k.line,z.line+1,ee);var ce=ve(e,"changes"),ge=ve(e,"change");if(ge||ce){var Ie={from:k,to:z,text:t.text,removed:t.removed,origin:t.origin};ge&&mi(e,"change",e,Ie),ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ie)}e.display.selForContextMenu=null}function rn(e,t,r,i,a){var k;i||(i=r),Tt(i,r)<0&&(k=[i,r],r=k[0],i=k[1]),typeof t=="string"&&(t=e.splitLines(t)),tn(e,{from:r,to:i,text:t,origin:a})}function Qs(e,t,r,i){r1||!(this.children[0]instanceof Rn))){var $=[];this.collapse($),this.children=[new Rn($)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var z=a.lines.length%25+25,$=z;$10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var i=0;ie.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=ce,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&Ri(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&&mi(e,"markerCleared",e,this,i,a),t&&Hr(e),this.parent&&this.parent.clear()},Or.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,i,a=0;a0||z==0&&k.clearWhenEmpty!==!1)return k;if(k.replacedWith&&(k.collapsed=!0,k.widgetNode=E("span",[k.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(k.widgetNode.insertLeft=!0)),k.collapsed){if(ui(e,t.line,t,r,k)||t.line!=r.line&&ui(e,r.line,t,r,k))throw new Error("Inserting collapsed marker partially overlapping an existing one");or()}k.addToHistory&&Ns(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var $=t.line,J=e.cm,ee;if(e.iter($,r.line+1,function(ge){J&&k.collapsed&&!J.options.lineWrapping&&wi(ge)==J.display.maxLine&&(ee=!0),k.collapsed&&$!=t.line&&vi(ge,0),yr(ge,new lr(k,$==t.line?t.ch:null,$==r.line?r.ch:null)),++$}),k.collapsed&&e.iter(t.line,r.line+1,function(ge){rr(e,ge)&&vi(ge,0)}),k.clearOnEnter&&Ne(k,"beforeCursorEnter",function(){return k.clear()}),k.readOnly&&(ji(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),k.collapsed&&(k.id=++eo,k.atomic=!0),J){if(ee&&(J.curOp.updateMaxLine=!0),k.collapsed)Ri(J,t.line,r.line+1);else if(k.className||k.startStyle||k.endStyle||k.css||k.attributes||k.title)for(var ce=t.line;ce<=r.line;ce++)Tr(J,ce,"text");k.atomic&&Gs(J.doc),mi(J,"markerAdded",J,k)}return k}var kn=function(e,t){this.markers=e,this.primary=t;for(var r=0;r=0;J--)tn(this,i[J]);$?Hs(this,$):this.cm&&Zr(this.cm)}),undo:di(function(){ta(this,"undo")}),redo:di(function(){ta(this,"redo")}),undoSelection:di(function(){ta(this,"undo",!0)}),redoSelection:di(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,r=0,i=0;i=e.ch)&&t.push(a.marker.parent||a.marker)}return t},findMarks:function(e,t,r){e=y(this,e),t=y(this,t);var i=[],a=e.line;return this.iter(e.line,t.line+1,function(k){var z=k.markedSpans;if(z)for(var $=0;$=J.to||J.from==null&&a!=e.line||J.from!=null&&a==t.line&&J.from>=t.ch)&&(!r||r(J.marker))&&i.push(J.marker.parent||J.marker)}++a}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var i=0;ie)return t=e,!0;e-=k,++r}),y(this,Ye(r,t))},indexFromPos:function(e){e=y(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 ce=e.dataTransfer.getData("Text");if(ce){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),qn(t.doc,Sr(r,r)),ge)for(var Ie=0;Ie=0;$--)rn(e.doc,"",i[$].from,i[$].to,"+delete");Zr(e)})}function Fa(e,t,r){var i=Ue(e.text,t+r,r);return i<0||i>e.text.length?null:i}function Ua(e,t,r){var i=Fa(e,t.ch,r);return i==null?null:new Ye(t.line,i,r<0?"after":"before")}function Ba(e,t,r,i,a){if(e){t.doc.direction=="rtl"&&(a=-a);var k=et(r,t.doc.direction);if(k){var z=a<0?ie(k):k[0],$=a<0==(z.level==1),J=$?"after":"before",ee;if(z.level>0||t.doc.direction=="rtl"){var ce=Xr(t,r);ee=a<0?r.text.length-1:0;var ge=ar(t,ce,ee).top;ee=Ve(function(Ie){return ar(t,ce,Ie).top==ge},a<0==(z.level==1)?z.from:z.to-1,ee),J=="before"&&(ee=Fa(r,ee,1))}else ee=a<0?z.to:z.from;return new Ye(i,ee,J)}}return new Ye(i,a<0?r.text.length:0,a<0?"before":"after")}function Pl(e,t,r,i){var a=et(t,e.doc.direction);if(!a)return Ua(t,r,i);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var k=Xe(a,r.ch,r.sticky),z=a[k];if(e.doc.direction=="ltr"&&z.level%2==0&&(i>0?z.to>r.ch:z.from=z.from&&Ie>=ce.begin)){var Oe=ge?"before":"after";return new Ye(r.line,Ie,Oe)}}var je=function(nt,lt,at){for(var dt=function(Xt,ci){return ci?new Ye(r.line,$(Xt,1),"before"):new Ye(r.line,Xt,"after")};nt>=0&&nt0==(Et.level!=1),At=yt?at.begin:$(at.end,-1);if(Et.from<=At&&At0?ce.end:$(ce.begin,-1);return Je!=null&&!(i>0&&Je==t.text.length)&&(Ke=je(i>0?0:a.length-1,i,ee(Je)),Ke)?Ke:null}var Mn={selectAll:Vs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),pe)},killLine:function(e){return sn(e,function(t){if(t.empty()){var r=mt(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)a=new Ye(a.line,a.ch+1),e.replaceRange(k.charAt(a.ch-1)+k.charAt(a.ch-2),Ye(a.line,a.ch-2),a,"+transpose");else if(a.line>e.doc.first){var z=mt(e.doc,a.line-1).text;z&&(a=new Ye(a.line,1),e.replaceRange(k.charAt(0)+e.doc.lineSeparator()+z.charAt(z.length-1),Ye(a.line-1,z.length-1),a,"+transpose"))}}r.push(new Gt(a,a))}e.setSelections(r)})},newlineAndIndent:function(e){return Ni(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var i=0;ie&&Tt(t,this.pos)==0&&r==this.button};var Fn,Un;function Hl(e,t){var r=+new Date;return Un&&Un.compare(r,e,t)?(Fn=Un=null,"triple"):Fn&&Fn.compare(r,e,t)?(Un=new Ha(r,e,t),Fn=null,"double"):(Fn=new Ha(r,e,t),Un=null,"single")}function vo(e){var t=this,r=t.display;if(We(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,hr(r,e)){M||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(Wa(t,e))return;var i=Nr(t,e),a=De(e),k=i?Hl(i,a):"single";if(window.focus(),a==1&&t.state.selectingText&&t.state.selectingText(e),i&&Wl(t,a,i,k,e))return;a==1?i?zl(t,i,k,e):be(e)==r.scroller&&te(e):a==2?(i&&Jn(t.doc,i),setTimeout(function(){return r.input.focus()},20)):a==3&&(O?t.display.input.onContextMenu(e):vs(t))}function Wl(e,t,r,i,a){var k="Click";return i=="double"?k="Double"+k:i=="triple"&&(k="Triple"+k),k=(t==1?"Left":t==2?"Middle":"Right")+k,Nn(e,oo(k,a),a,function(z){if(typeof z=="string"&&(z=Mn[z]),!z)return!1;var $=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),$=z(e,r)!=we}finally{e.state.suppressEdits=!1}return $})}function Gl(e,t,r){var i=e.getOption("configureMouse"),a=i?i(e,t,r):{};if(a.unit==null){var k=c?r.shiftKey&&r.metaKey:r.altKey;a.unit=k?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(a.extend==null||e.doc.extend)&&(a.extend=e.doc.extend||r.shiftKey),a.addNew==null&&(a.addNew=u?r.metaKey:r.ctrlKey),a.moveOnDrag==null&&(a.moveOnDrag=!(u?r.altKey:r.ctrlKey)),a}function zl(e,t,r,i){K?setTimeout(I(gs,e),0):e.curOp.focus=N();var a=Gl(e,r,i),k=e.doc.sel,z;e.options.dragDrop&&Ge&&!e.isReadOnly()&&r=="single"&&(z=k.contains(t))>-1&&(Tt((z=k.ranges[z]).from(),t)<0||t.xRel>0)&&(Tt(z.to(),t)>0||t.xRel<0)?Kl(e,i,t,a):Vl(e,i,t,a)}function Kl(e,t,r,i){var a=e.display,k=!1,z=hi(e,function(ee){M&&(a.scroller.draggable=!1),e.state.draggingText=!1,tt(a.wrapper.ownerDocument,"mouseup",z),tt(a.wrapper.ownerDocument,"mousemove",$),tt(a.scroller,"dragstart",J),tt(a.scroller,"drop",z),k||(te(ee),i.addNew||Jn(e.doc,r,null,null,i.extend),M&&!f||K&&W==9?setTimeout(function(){a.wrapper.ownerDocument.body.focus({preventScroll:!0}),a.input.focus()},20):a.input.focus())}),$=function(ee){k=k||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},J=function(){return k=!0};M&&(a.scroller.draggable=!0),e.state.draggingText=z,z.copy=!i.moveOnDrag,a.scroller.dragDrop&&a.scroller.dragDrop(),Ne(a.wrapper.ownerDocument,"mouseup",z),Ne(a.wrapper.ownerDocument,"mousemove",$),Ne(a.scroller,"dragstart",J),Ne(a.scroller,"drop",z),vs(e),setTimeout(function(){return a.input.focus()},20)}function yo(e,t,r){if(r=="char")return new Gt(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Gt(Ye(t.line,0),y(e.doc,Ye(t.line+1,0)));var i=r(e,t);return new Gt(i.from,i.to)}function Vl(e,t,r,i){var a=e.display,k=e.doc;te(t);var z,$,J=k.sel,ee=J.ranges;if(i.addNew&&!i.extend?($=k.sel.contains(r),$>-1?z=ee[$]:z=new Gt(r,r)):(z=k.sel.primary(),$=k.sel.primIndex),i.unit=="rectangle")i.addNew||(z=new Gt(r,r)),r=Nr(e,t,!0,!0),$=-1;else{var ce=yo(e,r,i.unit);i.extend?z=Ma(z,ce.anchor,ce.head,i.extend):z=ce}i.addNew?$==-1?($=ee.length,Ei(k,Zi(e,ee.concat([z]),$),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[$].empty()&&i.unit=="char"&&!i.extend?(Ei(k,Zi(e,ee.slice(0,$).concat(ee.slice($+1)),0),{scroll:!1,origin:"*mouse"}),J=k.sel):Na(k,$,z,Ee):($=0,Ei(k,new Wi([z],0),Ee),J=k.sel);var ge=r;function Ie(at){if(Tt(ge,at)==0)return;if(ge=at,i.unit=="rectangle"){for(var dt=[],Et=e.options.tabSize,yt=G(mt(k,r.line).text,r.ch,Et),At=G(mt(k,at.line).text,at.ch,Et),Xt=Math.min(yt,At),ci=Math.max(yt,At),Jt=Math.min(r.line,at.line),Fi=Math.min(e.lastLine(),Math.max(r.line,at.line));Jt<=Fi;Jt++){var Ii=mt(k,Jt).text,ni=Ae(Ii,Xt,Et);Xt==ci?dt.push(new Gt(Ye(Jt,ni),Ye(Jt,ni))):Ii.length>ni&&dt.push(new Gt(Ye(Jt,ni),Ye(Jt,Ae(Ii,ci,Et))))}dt.length||dt.push(new Gt(r,r)),Ei(k,Zi(e,J.ranges.slice(0,$).concat(dt),$),{origin:"*mouse",scroll:!1}),e.scrollIntoView(at)}else{var ki=z,gi=yo(e,at,i.unit),oi=ki.anchor,ai;Tt(gi.anchor,oi)>0?(ai=gi.head,oi=vr(ki.from(),gi.anchor)):(ai=gi.anchor,oi=gr(ki.to(),gi.head));var ei=J.ranges.slice(0);ei[$]=Xl(e,new Gt(y(k,oi),ai)),Ei(k,Zi(e,ei,$),Ee)}}var Oe=a.wrapper.getBoundingClientRect(),je=0;function Ke(at){var dt=++je,Et=Nr(e,at,!0,i.unit=="rectangle");if(!Et)return;if(Tt(Et,ge)!=0){e.curOp.focus=N(),Ie(Et);var yt=Vn(a,k);(Et.line>=yt.to||Et.lineOe.bottom?20:0;At&&setTimeout(hi(e,function(){if(je!=dt)return;a.scroller.scrollTop+=At,Ke(at)}),50)}}function Je(at){e.state.selectingText=!1,je=Infinity,at&&(te(at),a.input.focus()),tt(a.wrapper.ownerDocument,"mousemove",nt),tt(a.wrapper.ownerDocument,"mouseup",lt),k.history.lastSelOrigin=null}var nt=hi(e,function(at){at.buttons===0||!De(at)?Je(at):Ke(at)}),lt=hi(e,Je);e.state.selectingText=lt,Ne(a.wrapper.ownerDocument,"mousemove",nt),Ne(a.wrapper.ownerDocument,"mouseup",lt)}function Xl(e,t){var r=t.anchor,i=t.head,a=mt(e.doc,r.line);if(Tt(r,i)==0&&r.sticky==i.sticky)return t;var k=et(a);if(!k)return t;var z=Xe(k,r.ch,r.sticky),$=k[z];if($.from!=r.ch&&$.to!=r.ch)return t;var J=z+($.from==r.ch==($.level!=1)?0:1);if(J==0||J==k.length)return t;var ee;if(i.line!=r.line)ee=(i.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ce=Xe(k,i.ch,i.sticky),ge=ce-z||(i.ch-r.ch)*($.level==1?-1:1);ce==J-1||ce==J?ee=ge<0:ee=ge>0}var Ie=k[J+(ee?-1:0)],Oe=ee==(Ie.level==1),je=Oe?Ie.from:Ie.to,Ke=Oe?"after":"before";return r.ch==je&&r.sticky==Ke?t:new Gt(new Ye(r.line,je,Ke),i)}function _o(e,t,r,i){var a,k;if(t.touches)a=t.touches[0].clientX,k=t.touches[0].clientY;else try{a=t.clientX,k=t.clientY}catch(Ie){return!1}if(a>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&te(t);var z=e.display,$=z.lineDiv.getBoundingClientRect();if(k>$.bottom||!ve(e,r))return he(t);k-=$.top-z.viewOffset;for(var J=0;J=a){var ce=Bi(e.doc,k),ge=e.display.gutterSpecs[J];return Pe(e,r,e,ce,ge.className,t),he(t)}}}function Wa(e,t){return _o(e,t,"gutterClick",!0)}function bo(e,t){if(hr(e.display,t)||Yl(e,t))return;if(We(e,t,"contextmenu"))return;O||e.display.input.onContextMenu(t)}function Yl(e,t){return ve(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-"),yn(e)}var on={toString:function(){return"CodeMirror.Init"}},xo={},aa={};function $l(e){var t=e.optionHandlers;function r(i,a,k,z){e.defaults[i]=a,k&&(t[i]=z?function($,J,ee){ee!=on&&k($,J,ee)}:k)}e.defineOption=r,e.Init=on,r("value","",function(i,a){return i.setValue(a)},!0),r("mode",null,function(i,a){i.doc.modeOption=a,ka(i)},!0),r("indentUnit",2,ka,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(i){Cn(i),yn(i),Ri(i)},!0),r("lineSeparator",null,function(i,a){if(i.doc.lineSep=a,!a)return;var k=[],z=i.doc.first;i.doc.iter(function(J){for(var ee=0;;){var ce=J.text.indexOf(a,ee);if(ce==-1)break;ee=ce+a.length,k.push(Ye(z,ce))}z++});for(var $=k.length-1;$>=0;$--)rn(i.doc,a,k[$],Ye(k[$].line,k[$].ch+a.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(i,a,k){i.state.specialChars=new RegExp(a.source+(a.test(" ")?"":"| "),"g"),k!=on&&i.refresh()}),r("specialCharPlaceholder",Vt,function(i){return i.refresh()},!0),r("electricChars",!0),r("inputStyle",n?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(i,a){return i.getInputField().spellcheck=a},!0),r("autocorrect",!1,function(i,a){return i.getInputField().autocorrect=a},!0),r("autocapitalize",!1,function(i,a){return i.getInputField().autocapitalize=a},!0),r("rtlMoveVisually",!L),r("wholeLineUpdateBefore",!0),r("theme","default",function(i){Eo(i),Sn(i)},!0),r("keyMap","default",function(i,a,k){var z=ra(a),$=k!=on&&ra(k);$&&$.detach&&$.detach(i,z),z.attach&&z.attach(i,$||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Zl,!0),r("gutters",[],function(i,a){i.display.gutterSpecs=La(a,i.options.lineNumbers),Sn(i)},!0),r("fixedGutter",!0,function(i,a){i.display.gutters.style.left=a?ba(i.display)+"px":"0",i.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(i){return Jr(i)},!0),r("scrollbarStyle","native",function(i){Ts(i),Jr(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),r("lineNumbers",!1,function(i,a){i.display.gutterSpecs=La(i.options.gutters,a),Sn(i)},!0),r("firstLineNumber",1,Sn,!0),r("lineNumberFormatter",function(i){return i},Sn,!0),r("showCursorWhenSelecting",!1,_n,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(i,a){a=="nocursor"&&(Qr(i),i.display.input.blur()),i.display.input.readOnlyChanged(a)}),r("screenReaderLabel",null,function(i,a){a=a===""?null:a,i.display.input.screenReaderLabelChanged(a)}),r("disableInput",!1,function(i,a){a||i.display.input.reset()},!0),r("dragDrop",!0,Ql),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,_n,!0),r("singleCursorHeightPerLine",!0,_n,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Cn,!0),r("addModeClass",!1,Cn,!0),r("pollInterval",100),r("undoDepth",200,function(i,a){return i.doc.history.undoDepth=a}),r("historyEventDelay",1250),r("viewportMargin",10,function(i){return i.refresh()},!0),r("maxHighlightLength",1e4,Cn,!0),r("moveInputWithCursor",!0,function(i,a){a||i.display.input.resetPosition()}),r("tabindex",null,function(i,a){return i.display.input.getField().tabIndex=a||""}),r("autofocus",null),r("direction","ltr",function(i,a){return i.doc.setDirection(a)},!0),r("phrases",null)}function Ql(e,t,r){var i=r&&r!=on;if(!t!=!i){var a=e.display.dragFunctions,k=t?Ne:tt;k(e.display.scroller,"dragstart",a.start),k(e.display.scroller,"dragenter",a.enter),k(e.display.scroller,"dragover",a.over),k(e.display.scroller,"dragleave",a.leave),k(e.display.scroller,"drop",a.drop)}}function Zl(e){e.options.lineWrapping?(D(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(S(e.display.wrapper,"CodeMirror-wrap"),jn(e)),Ea(e),Ri(e),yn(e),setTimeout(function(){return Jr(e)},100)}function Qt(e,t){var r=this;if(!(this instanceof Qt))return new Qt(e,t);this.options=t=t?v(t):{},v(xo,t,!1);var i=t.value;typeof i=="string"?i=new Li(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var a=new Qt.inputStyles[t.inputStyle](this),k=this.display=new hl(e,i,a,t);k.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 Y,keySeq:null,specialChars:null},t.autofocus&&!n&&k.input.focus(),K&&W<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Jl(this),Rl(),jr(this),this.curOp.forceUpdate=!0,Ds(this,i),t.autofocus&&!n||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&Ta(r)},20):Qr(this);for(var z in aa)aa.hasOwnProperty(z)&&aa[z](this,t[z],on);Cs(this),t.finishInit&&t.finishInit(this);for(var $=0;$20*20}Ne(t.scroller,"touchstart",function(J){if(!We(e,J)&&!k(J)&&!Wa(e,J)){t.input.ensurePolled(),clearTimeout(r);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-i.end<=300?i:null},J.touches.length==1&&(t.activeTouch.left=J.touches[0].pageX,t.activeTouch.top=J.touches[0].pageY)}}),Ne(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ne(t.scroller,"touchend",function(J){var ee=t.activeTouch;if(ee&&!hr(t,J)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var ce=e.coordsChar(t.activeTouch,"page"),ge;!ee.prev||z(ee,ee.prev)?ge=new Gt(ce,ce):!ee.prev.prev||z(ee,ee.prev.prev)?ge=e.findWordAt(ce):ge=new Gt(Ye(ce.line,0),y(e.doc,Ye(ce.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),te(J)}a()}),Ne(t.scroller,"touchcancel",a),Ne(t.scroller,"scroll",function(){t.scroller.clientHeight&&(En(e,t.scroller.scrollTop),Ur(e,t.scroller.scrollLeft,!0),Pe(e,"scroll",e))}),Ne(t.scroller,"mousewheel",function(J){return Rs(e,J)}),Ne(t.scroller,"DOMMouseScroll",function(J){return Rs(e,J)}),Ne(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(J){We(e,J)||me(J)},over:function(J){We(e,J)||(Ol(e,J),me(J))},start:function(J){return Al(e,J)},drop:hi(e,Cl),leave:function(J){We(e,J)||ro(e)}};var $=t.input.getField();Ne($,"keyup",function(J){return mo.call(e,J)}),Ne($,"keydown",hi(e,po)),Ne($,"keypress",hi(e,go)),Ne($,"focus",function(J){return Ta(e,J)}),Ne($,"blur",function(J){return Qr(e,J)})}var Ga=[];Qt.defineInitHook=function(e){return Ga.push(e)};function Bn(e,t,r,i){var a=e.doc,k;r==null&&(r="add"),r=="smart"&&(a.mode.indent?k=it(e,t).state:r="prev");var z=e.options.tabSize,$=mt(a,t),J=G($.text,null,z);$.stateAfter&&($.stateAfter=null);var ee=$.text.match(/^\s*/)[0],ce;if(!i&&!/\S/.test($.text))ce=0,r="not";else if(r=="smart"&&(ce=a.mode.indent(k,$.text.slice(ee.length),$.text),ce==we||ce>150)){if(!i)return;r="prev"}r=="prev"?t>a.first?ce=G(mt(a,t-1).text,null,z):ce=0:r=="add"?ce=J+e.options.indentUnit:r=="subtract"?ce=J-e.options.indentUnit:typeof r=="number"&&(ce=J+r),ce=Math.max(0,ce);var ge="",Ie=0;if(e.options.indentWithTabs)for(var Oe=Math.floor(ce/z);Oe;--Oe)Ie+=z,ge+=" ";if(Iez,J=xt(t),ee=null;if($&&i.ranges.length>1)if(Ji&&Ji.text.join(` `)==t){if(i.ranges.length%Ji.text.length==0){ee=[];for(var ce=0;ce=0;Ie--){var Oe=i.ranges[Ie],je=Oe.from(),Ke=Oe.to();Oe.empty()&&(r&&r>0?je=Ye(je.line,je.ch-r):e.state.overwrite&&!$?Ke=Ye(Ke.line,Math.min(mt(k,Ke.line).text.length,Ke.ch+ie(J).length)):$&&Ji&&Ji.lineWise&&Ji.text.join(` `)==J.join(` `)&&(je=Ke=Ye(je.line,0)));var Je={from:je,to:Ke,text:ee?ee[Ie%ee.length]:J,origin:a||($?"paste":e.state.cutIncoming>z?"cut":"+input")};tn(e.doc,Je),mi(e,"inputRead",e,Je)}t&&!$&&wo(e,t),Zr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function To(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Ni(t,function(){return za(t,r,0,null,"paste")}),!0}function wo(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var r=e.doc.sel,i=r.ranges.length-1;i>=0;i--){var a=r.ranges[i];if(a.head.ch>100||i&&r.ranges[i-1].head.line==a.head.line)continue;var k=e.getModeAt(a.head),z=!1;if(k.electricChars){for(var $=0;$-1){z=Bn(e,a.head.line,"smart");break}}else k.electricInput&&(k.electricInput.test(mt(e.doc,a.head.line).text.slice(0,a.head.ch))&&(z=Bn(e,a.head.line,"smart")));z&&mi(e,"electricInput",e,a.head.line)}}function So(e){for(var t=[],r=[],i=0;ik&&(Bn(this,$.head.line,i,!0),k=$.head.line,z==this.doc.sel.primIndex&&Zr(this));else{var J=$.from(),ee=$.to(),ce=Math.max(k,J.line);k=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var ge=ce;ge0&&Na(this.doc,z,new Gt(J,Ie[z].to()),pe)}}}),getTokenAt:function(i,a){return $t(this,i,a)},getLineTokens:function(i,a){return $t(this,Ye(i),a,!0)},getTokenTypeAt:function(i){i=y(this.doc,i);var a=He(this,mt(this.doc,i.line)),k=0,z=(a.length-1)/2,$=i.ch,J;if($==0)J=a[2];else for(;;){var ee=k+z>>1;if((ee?a[ee*2-1]:0)>=$)z=ee;else if(a[ee*2+1]<$)k=ee+1;else{J=a[ee*2+2];break}}var ce=J?J.indexOf("overlay "):-1;return ce<0?J:ce==0?null:J.slice(0,ce-1)},getModeAt:function(i){var a=this.doc.mode;return a.innerMode?e.innerMode(a,this.getTokenAt(i).state).mode:a},getHelper:function(i,a){return this.getHelpers(i,a)[0]},getHelpers:function(i,a){var k=[];if(!r.hasOwnProperty(a))return k;var z=r[a],$=this.getModeAt(i);if(typeof $[a]=="string")z[$[a]]&&k.push(z[$[a]]);else if($[a])for(var J=0;J<$[a].length;J++){var ee=z[$[a][J]];ee&&k.push(ee)}else $.helperType&&z[$.helperType]?k.push(z[$.helperType]):z[$.name]&&k.push(z[$.name]);for(var ce=0;ceJ&&(i=J,z=!0),$=mt(this.doc,i)}else $=i;return Wn(this,$,{top:0,left:0},a||"page",k||z).top+(z?this.doc.height-$i($):0)},defaultTextHeight:function(){return Yr(this.display)},defaultCharWidth:function(){return $r(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,a,k,z,$){var J=this.display;i=Qi(this,y(this.doc,i));var ee=i.bottom,ce=i.left;if(a.style.position="absolute",a.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(a),J.sizer.appendChild(a),z=="over")ee=i.top;else if(z=="above"||z=="near"){var ge=Math.max(J.wrapper.clientHeight,this.doc.height),Ie=Math.max(J.sizer.clientWidth,J.lineSpace.clientWidth);(z=="above"||i.bottom+a.offsetHeight>ge)&&i.top>a.offsetHeight?ee=i.top-a.offsetHeight:i.bottom+a.offsetHeight<=ge&&(ee=i.bottom),ce+a.offsetWidth>Ie&&(ce=Ie-a.offsetWidth)}a.style.top=ee+"px",a.style.left=a.style.right="",$=="right"?(ce=J.sizer.clientWidth-a.offsetWidth,a.style.right="0px"):($=="left"?ce=0:$=="middle"&&(ce=(J.sizer.clientWidth-a.offsetWidth)/2),a.style.left=ce+"px"),k&&Qo(this,{left:ce,top:ee,right:ce+a.offsetWidth,bottom:ee+a.offsetHeight})},triggerOnKeyDown:Si(po),triggerOnKeyPress:Si(go),triggerOnKeyUp:mo,triggerOnMouseDown:Si(vo),execCommand:function(i){if(Mn.hasOwnProperty(i))return Mn[i].call(null,this)},triggerElectric:Si(function(i){wo(this,i)}),findPosH:function(i,a,k,z){var $=1;a<0&&($=-1,a=-a);for(var J=y(this.doc,i),ee=0;ee0&&ce(k.charAt(z-1));)--z;for(;$.5||this.options.lineWrapping)&&Ea(this),Pe(this,"refresh",this)}),swapDoc:Si(function(i){var a=this.doc;return a.cm=null,this.state.selectingText&&this.state.selectingText(),Ds(this,i),yn(this),this.display.input.reset(),bn(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,mi(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}},xe(e),e.registerHelper=function(i,a,k){r.hasOwnProperty(i)||(r[i]=e[i]={_global:[]}),r[i][a]=k},e.registerGlobalHelper=function(i,a,k,z){e.registerHelper(i,a,z),r[i]._global.push({pred:k,val:z})}}function Ka(e,t,r,i,a){var k=t,z=r,$=mt(e,t.line),J=a&&e.direction=="rtl"?-r:r;function ee(){var lt=t.line+J;return lt=e.first+e.size?!1:(t=new Ye(lt,t.ch,t.sticky),$=mt(e,lt))}function ce(lt){var at;if(i=="codepoint"){var dt=$.text.charCodeAt(t.ch+(i>0?0:-1));isNaN(dt)?at=null:at=new Ye(t.line,Math.max(0,Math.min($.text.length,t.ch+r*(dt>=55296&&dt<56320?2:1))),-r)}else a?at=Pl(e.cm,$,t,r):at=Ua($,t,r);if(at==null)if(!lt&&ee())t=Ba(a,e.cm,$,t.line,J);else return!1;else t=at;return!0}if(i=="char"||i=="codepoint")ce();else if(i=="column")ce(!0);else if(i=="word"||i=="group")for(var ge=null,Ie=i=="group",Oe=e.cm&&e.cm.getHelper(t,"wordChars"),je=!0;!(r<0&&!ce(!je));je=!1){var Ke=$.text.charAt(t.ch)||` `,Je=Le(Ke,Oe)?"w":Ie&&Ke==` `?"n":!Ie||/\s/.test(Ke)?null:"p";if(Ie&&!je&&!Je&&(Je="s"),ge&&ge!=Je){r<0&&(r=1,ce(),t.sticky="after");break}if(Je&&(ge=Je),r>0&&!ce(!je))break}var nt=ea(e,t,k,z,!0);return pr(k,nt)&&(nt.hitSide=!0),nt}function Oo(e,t,r,i){var a=e.doc,k=t.left,z;if(i=="page"){var $=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),J=Math.max($-.5*Yr(e.display),3);z=(r>0?t.bottom:t.top)+r*J}else i=="line"&&(z=r>0?t.bottom+3:t.top-3);for(var ee;!(ee=va(e,k,z),!ee.outside);){if(r<0?z<=0:z>=a.height){ee.hitSide=!0;break}z+=r*5}return ee}var Kt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Kt.prototype.init=function(e){var t=this,r=this,i=r.cm,a=r.div=e.lineDiv;Co(a,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function k($){for(var J=$.target;J;J=J.parentNode){if(J==a)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(J.className))break}return!1}Ne(a,"paste",function($){if(!k($)||We(i,$)||To($,i))return;W<=11&&setTimeout(hi(i,function(){return t.updateFromDOM()}),20)}),Ne(a,"compositionstart",function($){t.composing={data:$.data,done:!1}}),Ne(a,"compositionupdate",function($){t.composing||(t.composing={data:$.data,done:!1})}),Ne(a,"compositionend",function($){t.composing&&($.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ne(a,"touchstart",function(){return r.forceCompositionEnd()}),Ne(a,"input",function(){t.composing||t.readFromDOMSoon()});function z($){if(!k($)||We(i,$))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()}),$.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var J=So(i);sa({lineWise:!0,text:J.text}),$.type=="cut"&&i.operation(function(){i.setSelections(J.ranges,0,pe),i.replaceSelection("",null,"cut")})}else return;if($.clipboardData){$.clipboardData.clearData();var ee=Ji.text.join(` `);if($.clipboardData.setData("Text",ee),$.clipboardData.getData("Text")==ee){$.preventDefault();return}}var ce=Ao(),ge=ce.firstChild;i.display.lineSpace.insertBefore(ce,i.display.lineSpace.firstChild),ge.value=Ji.text.join(` `);var Ie=document.activeElement;j(ge),setTimeout(function(){i.display.lineSpace.removeChild(ce),Ie.focus(),Ie==a&&r.showPrimarySelection()},50)}Ne(a,"copy",z),Ne(a,"cut",z)},Kt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Kt.prototype.prepareSelection=function(){var e=ps(this.cm,!1);return e.focus=document.activeElement==this.div,e},Kt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Kt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Kt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),i=r.from(),a=r.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||a.line=t.display.viewFrom&&Ro(t,i)||{node:$[0].measure.map[2],offset:0},ee=a.linee.firstLine()&&(i=Ye(i.line-1,mt(e.doc,i.line-1).length)),a.ch==mt(e.doc,a.line).text.length&&a.linet.viewTo-1)return!1;var k,z,$;i.line==t.viewFrom||(k=Fr(e,i.line))==0?(z=kt(t.view[0].line),$=t.view[0].node):(z=kt(t.view[k].line),$=t.view[k-1].node.nextSibling);var J=Fr(e,a.line),ee,ce;if(J==t.view.length-1?(ee=t.viewTo-1,ce=t.lineDiv.lastChild):(ee=kt(t.view[J+1].line)-1,ce=t.view[J+1].node.previousSibling),!$)return!1;for(var ge=e.doc.splitLines(tu(e,$,ce,z,ee)),Ie=Gi(e.doc,Ye(z,0),Ye(ee,mt(e.doc,ee).text.length));ge.length>1&&Ie.length>1;)if(ie(ge)==ie(Ie))ge.pop(),Ie.pop(),ee--;else if(ge[0]==Ie[0])ge.shift(),Ie.shift(),z++;else break;for(var Oe=0,je=0,Ke=ge[0],Je=Ie[0],nt=Math.min(Ke.length,Je.length);Oei.ch&<.charCodeAt(lt.length-je-1)==at.charCodeAt(at.length-je-1);)Oe--,je++;ge[ge.length-1]=lt.slice(0,lt.length-je).replace(/^\u200b+/,""),ge[0]=ge[0].slice(Oe).replace(/\u200b+$/,"");var Et=Ye(z,Oe),yt=Ye(ee,Ie.length?ie(Ie).length-je:0);if(ge.length>1||ge[0]||Tt(Et,yt))return rn(e.doc,ge,Et,yt,"+input"),!0},Kt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Kt.prototype.reset=function(){this.forceCompositionEnd()},Kt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Kt.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)},Kt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Ni(this.cm,function(){return Ri(e.cm)})},Kt.prototype.setUneditable=function(e){e.contentEditable="false"},Kt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||hi(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Kt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Kt.prototype.onContextMenu=function(){},Kt.prototype.resetPosition=function(){},Kt.prototype.needsContentAttribute=!0;function Ro(e,t){var r=fa(e,t.line);if(!r||r.hidden)return null;var i=mt(e.doc,t.line),a=es(r,i,t.line),k=et(i,e.doc.direction),z="left";if(k){var $=Xe(k,t.ch);z=$%2?"right":"left"}var J=rs(a.map,t.ch,z);return J.offset=J.collapse=="right"?J.end:J.start,J}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ln(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,i,a){var k="",z=!1,$=e.doc.lineSeparator(),J=!1;function ee(Oe){return function(je){return je.id==Oe}}function ce(){z&&(k+=$,J&&(k+=$),z=J=!1)}function ge(Oe){Oe&&(ce(),k+=Oe)}function Ie(Oe){if(Oe.nodeType==1){var je=Oe.getAttribute("cm-text");if(je){ge(je);return}var Ke=Oe.getAttribute("cm-marker"),Je;if(Ke){var nt=e.findMarks(Ye(i,0),Ye(a+1,0),ee(+Ke));nt.length&&(Je=nt[0].find(0))&&ge(Gi(e.doc,Je.from,Je.to).join($));return}if(Oe.getAttribute("contenteditable")=="false")return;var lt=/^(pre|div|p|li|table|br)$/i.test(Oe.nodeName);if(!/^br$/i.test(Oe.nodeName)&&Oe.textContent.length==0)return;lt&&ce();for(var at=0;at=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Ne(a,"paste",function(z){if(We(i,z)||To(z,i))return;i.state.pasteIncoming=+new Date,r.fastPoll()});function k(z){if(We(i,z))return;if(i.somethingSelected())sa({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var $=So(i);sa({lineWise:!0,text:$.text}),z.type=="cut"?i.setSelections($.ranges,null,pe):(r.prevInput="",a.value=$.text.join(` `),j(a))}else return;z.type=="cut"&&(i.state.cutIncoming=+new Date)}Ne(a,"cut",k),Ne(a,"copy",k),Ne(e.scroller,"paste",function(z){if(hr(e,z)||We(i,z))return;if(!a.dispatchEvent){i.state.pasteIncoming=+new Date,r.focus();return}var $=new Event("paste");$.clipboardData=z.clipboardData,a.dispatchEvent($)}),Ne(e.lineSpace,"selectstart",function(z){hr(e,z)||te(z)}),Ne(a,"compositionstart",function(){var z=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:z,range:i.markText(z,i.getCursor("to"),{className:"CodeMirror-composing"})}}),Ne(a,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},ii.prototype.createField=function(e){this.wrapper=Ao(),this.textarea=this.wrapper.firstChild},ii.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},ii.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,i=ps(e);if(e.options.moveInputWithCursor){var a=Qi(e,r.sel.primary().head,"div"),k=t.wrapper.getBoundingClientRect(),z=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,a.top+z.top-k.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,a.left+z.left-k.left))}return i},ii.prototype.showSelection=function(e){var t=this.cm,r=t.display;_(r.cursorDiv,e.cursors),_(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},ii.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&j(this.textarea),K&&W>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",K&&W>=9&&(this.hasSelection=null))},ii.prototype.getField=function(){return this.textarea},ii.prototype.supportsTouch=function(){return!1},ii.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!n||N()!=this.textarea))try{this.textarea.focus()}catch(e){}},ii.prototype.blur=function(){this.textarea.blur()},ii.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ii.prototype.receivedFocus=function(){this.slowPoll()},ii.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()})},ii.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var i=t.poll();!i&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},ii.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||ht(r)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var a=r.value;if(a==i&&!t.somethingSelected())return!1;if(K&&W>=9&&this.hasSelection===a||u&&/[\uf700-\uf7ff]/.test(a))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var k=a.charCodeAt(0);if(k==8203&&!i&&(i="\u200B"),k==8666)return this.reset(),this.cm.execCommand("undo")}for(var z=0,$=Math.min(i.length,a.length);z<$&&i.charCodeAt(z)==a.charCodeAt(z);)++z;return Ni(t,function(){za(t,a.slice(z),i.length-z,null,e.composing?"*compose":null),a.length>1e3||a.indexOf(` `)>-1?r.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},ii.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ii.prototype.onKeyPress=function(){K&&W>=9&&(this.hasSelection=null),this.fastPoll()},ii.prototype.onContextMenu=function(e){var t=this,r=t.cm,i=r.display,a=t.textarea;t.contextMenuPending&&t.contextMenuPending();var k=Nr(r,e),z=i.scroller.scrollTop;if(!k||p)return;var $=r.options.resetSelectionOnContextMenu;$&&r.doc.sel.contains(k)==-1&&hi(r,Ei)(r.doc,Sr(k),pe);var J=a.style.cssText,ee=t.wrapper.style.cssText,ce=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",a.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-ce.top-5)+"px; left: "+(e.clientX-ce.left-5)+`px; z-index: 1000; background: `+(K?"rgba(255, 255, 255, .05)":"transparent")+`; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ge;M&&(ge=window.scrollY),i.input.focus(),M&&window.scrollTo(null,ge),i.input.reset(),r.somethingSelected()||(a.value=t.prevInput=" "),t.contextMenuPending=Oe,i.selForContextMenu=r.doc.sel,clearTimeout(i.detectingSelectAll);function Ie(){if(a.selectionStart!=null){var Ke=r.somethingSelected(),Je="\u200B"+(Ke?a.value:"");a.value="\u21DA",a.value=Je,t.prevInput=Ke?"":"\u200B",a.selectionStart=1,a.selectionEnd=Je.length,i.selForContextMenu=r.doc.sel}}function Oe(){if(t.contextMenuPending!=Oe)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,a.style.cssText=J,K&&W<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=z),a.selectionStart!=null){(!K||K&&W<9)&&Ie();var Ke=0,Je=function(){i.selForContextMenu==r.doc.sel&&a.selectionStart==0&&a.selectionEnd>0&&t.prevInput=="\u200B"?hi(r,Vs)(r):Ke++<10?i.detectingSelectAll=setTimeout(Je,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(Je,200)}}if(K&&W>=9&&Ie(),O){me(e);var je=function(){tt(window,"mouseup",je),setTimeout(Oe,20)};Ne(window,"mouseup",je)}else setTimeout(Oe,50)},ii.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},ii.prototype.setUneditable=function(){},ii.prototype.needsContentAttribute=!1;function ru(e,t){if(t=t?v(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 r=N();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function i(){e.value=$.getValue()}var a;if(e.form&&(Ne(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var k=e.form;a=k.submit;try{var z=k.submit=function(){i(),k.submit=a,k.submit(),k.submit=z}}catch(J){}}t.finishInit=function(J){J.save=i,J.getTextArea=function(){return e},J.toTextArea=function(){J.toTextArea=isNaN,i(),e.parentNode.removeChild(J.getWrapperElement()),e.style.display="",e.form&&(tt(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=a))}},e.style.display="none";var $=Qt(function(J){return e.parentNode.insertBefore(J,e.nextSibling)},t);return $}function nu(e){e.off=tt,e.on=Ne,e.wheelEventPixels=dl,e.Doc=Li,e.splitLines=xt,e.countColumn=G,e.findColumn=Ae,e.isWordChar=Ce,e.Pass=we,e.signal=Pe,e.Line=Dr,e.changeEnd=Cr,e.scrollbarModel=xs,e.Pos=Ye,e.cmpPos=Tt,e.modes=Yt,e.mimeModes=Rt,e.resolveMode=qe,e.getMode=wt,e.modeExtensions=Ot,e.extendMode=Lt,e.copyState=qt,e.startState=er,e.innerMode=qi,e.commands=Mn,e.keyMap=dr,e.keyName=lo,e.isModifierKey=so,e.lookupKey=an,e.normalizeKeyMap=Dl,e.StringStream=Bt,e.SharedTextMarker=kn,e.TextMarker=Or,e.LineWidget=In,e.e_preventDefault=te,e.e_stopPropagation=ae,e.e_stop=me,e.addClass=D,e.contains=b,e.rmClass=S,e.keyNames=Rr}$l(Qt),ql(Qt);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Li.prototype)Li.prototype.hasOwnProperty(la)&&re(au,la)<0&&(Qt.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Li.prototype[la]));return xe(Li),Qt.inputStyles={textarea:ii,contenteditable:Kt},Qt.defineMode=function(e){!Qt.defaults.mode&&e!="null"&&(Qt.defaults.mode=e),Ti.apply(this,arguments)},Qt.defineMIME=Ui,Qt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Qt.defineMIME("text/plain","null"),Qt.defineExtension=function(e,t){Qt.prototype[e]=t},Qt.defineDocExtension=function(e,t){Li.prototype[e]=t},Qt.fromTextArea=ru,nu(Qt),Qt.version="5.58.2",Qt})},Y1PL:function(ct,Qe,ne){"use strict";ne.r(Qe),ne.d(Qe,"ResizableTextArea",function(){return re});var le=ne("wx14"),Z=ne("1OyB"),P=ne("vuIU"),Q=ne("Ji7U"),H=ne("LK+K"),F=ne("q1tI"),K=ne("VTBJ"),W=ne("rePB"),M=ne("Zm9Q"),R=ne("Kwbf"),g=ne("c+Xe"),p=ne("m+aA"),f=ne("bdgK"),h=new Map;function s(pe){pe.forEach(function(Ee){var _e,Ae=Ee.target;(_e=h.get(Ae))===null||_e===void 0||_e.forEach(function(fe){return fe(Ae)})})}var d=new f.default(s),o=null,n=null;function u(pe,Ee){h.has(pe)||(h.set(pe,new Set),d.observe(pe)),h.get(pe).add(Ee)}function c(pe,Ee){h.has(pe)&&(h.get(pe).delete(Ee),h.get(pe).size||(d.unobserve(pe),h.delete(pe)))}var L=function(pe){Object(Q.a)(_e,pe);var Ee=Object(H.a)(_e);function _e(){return Object(Z.a)(this,_e),Ee.apply(this,arguments)}return Object(P.a)(_e,[{key:"render",value:function(){return this.props.children}}]),_e}(F.Component),C=F.createContext(null);function x(pe){var Ee=pe.children,_e=pe.onBatchResize,Ae=F.useRef(0),fe=F.useRef([]),ue=F.useContext(C),ie=F.useCallback(function(de,se,Re){Ae.current+=1;var ke=Ae.current;fe.current.push({size:de,element:se,data:Re}),Promise.resolve().then(function(){ke===Ae.current&&(_e==null||_e(fe.current),fe.current=[])}),ue==null||ue(de,se,Re)},[_e,ue]);return F.createElement(C.Provider,{value:ie},Ee)}function O(pe){var Ee=pe.children,_e=pe.disabled,Ae=F.useRef(null),fe=F.useRef(null),ue=F.useContext(C),ie=F.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),de=F.isValidElement(Ee)&&Object(g.c)(Ee),se=de?Ee.ref:null,Re=F.useMemo(function(){return Object(g.a)(se,Ae)},[se,Ae]),ke=F.useRef(pe);ke.current=pe;var Te=F.useCallback(function(Ce){var Le=ke.current,Be=Le.onResize,Fe=Le.data,Me=Ce.getBoundingClientRect(),Ue=Me.width,Ve=Me.height,$e=Ce.offsetWidth,Ze=Ce.offsetHeight,Xe=Math.floor(Ue),ot=Math.floor(Ve);if(ie.current.width!==Xe||ie.current.height!==ot||ie.current.offsetWidth!==$e||ie.current.offsetHeight!==Ze){var et={width:Xe,height:ot,offsetWidth:$e,offsetHeight:Ze};ie.current=et;var rt=$e===Math.round(Ue)?Ue:$e,Ne=Ze===Math.round(Ve)?Ve:Ze,ut=Object(K.a)(Object(K.a)({},et),{},{offsetWidth:rt,offsetHeight:Ne});ue==null||ue(ut,Ce,Fe),Be&&Promise.resolve().then(function(){Be(ut,Ce)})}},[]);return F.useEffect(function(){var Ce=Object(p.a)(Ae.current)||Object(p.a)(fe.current);return Ce&&!_e&&u(Ce,Te),function(){return c(Ce,Te)}},[Ae.current,_e]),F.createElement(L,{ref:fe},de?F.cloneElement(Ee,{ref:Re}):Ee)}var w="rc-observer-key";function S(pe){var Ee=pe.children,_e=Object(M.a)(Ee);return _e.map(function(Ae,fe){var ue=(Ae==null?void 0:Ae.key)||"".concat(w,"-").concat(fe);return F.createElement(O,Object(le.a)({},pe,{key:ue}),Ae)})}S.Collection=x;var T=S,_=ne("bT9E"),l=ne("TSYQ"),E=ne.n(l),m=` 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"],N={},D;function B(pe){var Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_e=pe.getAttribute("id")||pe.getAttribute("data-reactid")||pe.getAttribute("name");if(Ee&&N[_e])return N[_e];var Ae=window.getComputedStyle(pe),fe=Ae.getPropertyValue("box-sizing")||Ae.getPropertyValue("-moz-box-sizing")||Ae.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(Ae.getPropertyValue("padding-bottom"))+parseFloat(Ae.getPropertyValue("padding-top")),ie=parseFloat(Ae.getPropertyValue("border-bottom-width"))+parseFloat(Ae.getPropertyValue("border-top-width")),de=b.map(function(Re){return"".concat(Re,":").concat(Ae.getPropertyValue(Re))}).join(";"),se={sizingStyle:de,paddingSize:ue,borderSize:ie,boxSizing:fe};return Ee&&_e&&(N[_e]=se),se}function j(pe){var Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Ae=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;D||(D=document.createElement("textarea"),D.setAttribute("tab-index","-1"),D.setAttribute("aria-hidden","true"),document.body.appendChild(D)),pe.getAttribute("wrap")?D.setAttribute("wrap",pe.getAttribute("wrap")):D.removeAttribute("wrap");var fe=B(pe,Ee),ue=fe.paddingSize,ie=fe.borderSize,de=fe.boxSizing,se=fe.sizingStyle;D.setAttribute("style","".concat(se,";").concat(m)),D.value=pe.value||pe.placeholder||"";var Re=Number.MIN_SAFE_INTEGER,ke=Number.MAX_SAFE_INTEGER,Te=D.scrollHeight,Ce;if(de==="border-box"?Te+=ie:de==="content-box"&&(Te-=ue),_e!==null||Ae!==null){D.value=" ";var Le=D.scrollHeight-ue;_e!==null&&(Re=Le*_e,de==="border-box"&&(Re=Re+ue+ie),Te=Math.max(Re,Te)),Ae!==null&&(ke=Le*Ae,de==="border-box"&&(ke=ke+ue+ie),Ce=Te>ke?"":"hidden",Te=Math.min(ke,Te))}return{height:Te,minHeight:Re,maxHeight:ke,overflowY:Ce,resize:"none"}}var I=ne("Gytx"),v=ne.n(I),G;(function(pe){pe[pe.NONE=0]="NONE",pe[pe.RESIZING=1]="RESIZING",pe[pe.RESIZED=2]="RESIZED"})(G||(G={}));var Y=function(pe){Object(Q.a)(_e,pe);var Ee=Object(H.a)(_e);function _e(Ae){var fe;return Object(Z.a)(this,_e),fe=Ee.call(this,Ae),fe.nextFrameActionId=void 0,fe.resizeFrameId=void 0,fe.textArea=void 0,fe.saveTextArea=function(ue){fe.textArea=ue},fe.handleResize=function(ue){var ie=fe.state.resizeStatus,de=fe.props,se=de.autoSize,Re=de.onResize;if(ie!==G.NONE)return;typeof Re=="function"&&Re(ue),se&&fe.resizeOnNextFrame()},fe.resizeOnNextFrame=function(){cancelAnimationFrame(fe.nextFrameActionId),fe.nextFrameActionId=requestAnimationFrame(fe.resizeTextarea)},fe.resizeTextarea=function(){var ue=fe.props.autoSize;if(!ue||!fe.textArea)return;var ie=ue.minRows,de=ue.maxRows,se=j(fe.textArea,!1,ie,de);fe.setState({textareaStyles:se,resizeStatus:G.RESIZING},function(){cancelAnimationFrame(fe.resizeFrameId),fe.resizeFrameId=requestAnimationFrame(function(){fe.setState({resizeStatus:G.RESIZED},function(){fe.resizeFrameId=requestAnimationFrame(function(){fe.setState({resizeStatus:G.NONE}),fe.fixFirefoxAutoScroll()})})})})},fe.renderTextArea=function(){var ue=fe.props,ie=ue.prefixCls,de=ie===void 0?"rc-textarea":ie,se=ue.autoSize,Re=ue.onResize,ke=ue.className,Te=ue.disabled,Ce=fe.state,Le=Ce.textareaStyles,Be=Ce.resizeStatus,Fe=Object(_.a)(fe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Me=E()(de,ke,Object(W.a)({},"".concat(de,"-disabled"),Te));"value"in Fe&&(Fe.value=Fe.value||"");var Ue=Object(K.a)(Object(K.a)(Object(K.a)({},fe.props.style),Le),Be===G.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return F.createElement(T,{onResize:fe.handleResize,disabled:!(se||Re)},F.createElement("textarea",Object(le.a)({},Fe,{className:Me,style:Ue,ref:fe.saveTextArea})))},fe.state={textareaStyles:{},resizeStatus:G.NONE},fe}return Object(P.a)(_e,[{key:"componentDidUpdate",value:function(fe){(fe.value!==this.props.value||!v()(fe.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 fe=this.textArea.selectionStart,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(fe,ue)}}catch(ie){}}},{key:"render",value:function(){return this.renderTextArea()}}]),_e}(F.Component),re=Y,oe=function(pe){Object(Q.a)(_e,pe);var Ee=Object(H.a)(_e);function _e(Ae){var fe;Object(Z.a)(this,_e),fe=Ee.call(this,Ae),fe.resizableTextArea=void 0,fe.focus=function(){fe.resizableTextArea.textArea.focus()},fe.saveTextArea=function(ie){fe.resizableTextArea=ie},fe.handleChange=function(ie){var de=fe.props.onChange;fe.setValue(ie.target.value,function(){fe.resizableTextArea.resizeTextarea()}),de&&de(ie)},fe.handleKeyDown=function(ie){var de=fe.props,se=de.onPressEnter,Re=de.onKeyDown;ie.keyCode===13&&se&&se(ie),Re&&Re(ie)};var ue=typeof Ae.value=="undefined"||Ae.value===null?Ae.defaultValue:Ae.value;return fe.state={value:ue},fe}return Object(P.a)(_e,[{key:"setValue",value:function(fe,ue){"value"in this.props||this.setState({value:fe},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return F.createElement(re,Object(le.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(fe){return"value"in fe?{value:fe.value}:null}}]),_e}(F.Component),we=Qe.default=oe},ZW9T:function(ct,Qe,ne){"use strict";ne.d(Qe,"a",function(){return j});var le=ne("k1fw"),Z=ne("miYZ"),P=ne("tsqr"),Q=ne("rAM+"),H=ne("tJVT"),F=ne("PpiC"),K=ne("q1tI"),W=ne.n(K),M=ne("bdgK"),R=ne("oBTY"),g=ne("9og8"),p=ne("WmNS"),f=ne.n(p),h={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"]},s={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(` `)}]},n=ne("5VLF"),u=ne.n(n),c={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"]}},L=function(v,G){return G.map(function(Y){return{label:Y,kind:v.languages.CompletionItemKind.Keyword,insertText:Y}})},C=function(v){return Object.keys(c.tables).map(function(G){return{label:G,kind:v.languages.CompletionItemKind.Variable,insertText:G}})},x=function(v,G){var Y=c.tables[v];return Y?Y.map(function(re){return{label:re,kind:G.languages.CompletionItemKind.Field,insertText:re}}):[]};function O(I,v,G,Y,re){var oe=v.getWordUntilPosition(G),we={startLineNumber:G.lineNumber,endLineNumber:G.lineNumber,startColumn:oe.startColumn,endColumn:oe.endColumn},pe=Y.map(function(Ee){return{label:Ee,kind:I.languages.CompletionItemKind.Keyword,insertText:Ee,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:we}});return re.map(function(Ee){pe.push(Object(le.a)(Object(le.a)({},Ee),{},{range:we}))}),pe}var w=function(I){c.languages.map(function(re){return I.languages.registerDocumentFormattingEditProvider(re,{provideDocumentFormattingEdits:function(we,pe,Ee){return Object(g.a)(f.a.mark(function _e(){var Ae;return f.a.wrap(function(ue){for(;;)switch(ue.prev=ue.next){case 0:return Ae=u()(we.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}),ue.abrupt("return",[{range:we.getFullModelRange(),text:Ae}]);case 2:case"end":return ue.stop()}},_e)}))()}}),re});var v=d.quickKey.map(function(re){return{label:re.label,kind:I.languages.CompletionItemKind.Method,insertText:re.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),G=o.quickKey.map(function(re){return{label:re.label,kind:I.languages.CompletionItemKind.Method,insertText:re.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),Y=s.quickKey.map(function(re){return{label:re.label,kind:I.languages.CompletionItemKind.Method,insertText:re.content,insertTextRules:I.languages.CompletionItemInsertTextRule.InsertAsSnippet}});I.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(R.a)(d.keywords),Object(R.a)(d.quickKey.map(function(re){return re.label}))),provideCompletionItems:function(oe,we){var pe=oe.getValueInRange({startLineNumber:we.lineNumber,startColumn:1,endLineNumber:we.lineNumber,endColumn:we.column}),Ee=pe.match(/cu/gim);console.log("match:",Ee,we,pe,oe);var _e=[],Ae=we.lineNumber,fe=we.column,ue=oe.getValueInRange({startLineNumber:Ae,startColumn:0,endLineNumber:Ae,endColumn:fe}),ie=ue.trim().split(/\s+/),de=ie[ie.length-1];if(de.endsWith(".")){var se=de.slice(0,de.length-1);Object.keys(c.tables).includes(se)&&(_e=Object(R.a)(x(se,I)))}else de==="."?_e=[]:_e=[].concat(Object(R.a)(C(I)),Object(R.a)(L(I,d.keywords)),Object(R.a)(v));return{suggestions:_e}}}),I.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(R.a)(h.keywords)),provideCompletionItems:function(oe,we){var pe=oe.getValueInRange({startLineNumber:we.lineNumber,startColumn:1,endLineNumber:we.lineNumber,endColumn:we.column}),Ee=pe.match(/cu/gim);console.log("match:",Ee,we,pe,oe);var _e=[],Ae=we.lineNumber,fe=we.column,ue=oe.getValueInRange({startLineNumber:Ae,startColumn:0,endLineNumber:Ae,endColumn:fe}),ie=ue.trim().split(/\s+/),de=ie[ie.length-1];if(de.endsWith(".")){var se=de.slice(0,de.length-1);Object.keys(c.tables).includes(se)&&(_e=Object(R.a)(x(se,I)))}else de==="."?_e=[]:_e=[].concat(Object(R.a)(C(I)),Object(R.a)(L(I,h.keywords)));return{suggestions:_e}}}),I.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(R.a)(s.keywords)),provideCompletionItems:function(oe,we){var pe=[],Ee=we.lineNumber,_e=we.column,Ae=oe.getValueInRange({startLineNumber:Ee,startColumn:0,endLineNumber:Ee,endColumn:_e}),fe=Ae.trim().split(/\s+/),ue=fe[fe.length-1];if(ue.endsWith(".")){var ie=ue.slice(0,ue.length-1);Object.keys(c.tables).includes(ie)&&(pe=Object(R.a)(x(ie,I)))}else ue==="."?pe=[]:pe=[].concat(Object(R.a)(C(I)),Object(R.a)(L(I,s.keywords)),Object(R.a)(Y));return{suggestions:pe}}}),I.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(R.a)(o.keywords)),provideCompletionItems:function(oe,we){var pe=[],Ee=we.lineNumber,_e=we.column,Ae=oe.getValueInRange({startLineNumber:Ee,startColumn:0,endLineNumber:Ee,endColumn:_e}),fe=Ae.trim().split(/\s+/),ue=fe[fe.length-1];if(ue.endsWith(".")){var ie=ue.slice(0,ue.length-1);Object.keys(c.tables).includes(ie)&&(pe=Object(R.a)(x(ie,I)))}else ue==="."?pe=[]:pe=[].concat(Object(R.a)(C(I)),Object(R.a)(L(I,o.keywords)),Object(R.a)(G));return{suggestions:pe}}})},S="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",T=ne("LvDl"),_=ne("+ua5");function l(I){return/^\d+$/.test(I)?"".concat(I,"px"):I}function E(){}var m=!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 N(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],v=I;if(Array.isArray(I)){for(var G=0;G0||qt.target.offsetWidth>0)&&Pe.current.instance.layout()}}catch(qi){Ot.e(qi)}finally{Ot.f()}}),qe.observe(tt.current)),qe}function be(){P.b.warn(decodeURIComponent(S))}var De=function(){var wt=Pe.current.instance;if(oe!=null&&wt&&ae){var Ot=wt.getModel();Ot&&oe!==Ot.getValue()&&(m=!0,Ot.setValue(oe),wt.layout(),m=!1)}};Object(K.useEffect)(function(){We.current&&clearTimeout(We.current),We.current=setTimeout(function(){De()},500)},[oe,ae,Pe.current]),Object(K.useEffect)(function(){if(et&&Pe.current&&Pe.current.instance){var qe=Pe.current.instance;qe.changeViewZones(function(Ot){var Lt=document.createElement("div");Lt.style.padding="10px 20px",Lt.style.width="calc(100% - 20px)",Lt.className="my-error-line-wrp",Lt.innerHTML=Ne,Ot.addZone({afterLineNumber:et||11,heightInLines:3,domNode:Lt})});var wt={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}};qe.addOverlayWidget(wt),qe.revealPositionInCenter({lineNumber:20,column:1})}},[et,Pe.current,ae]);function Ge(){var qe=Pe.current.instance;if(qe){var wt=qe.getSelection(),Ot=Pe.current.pastePos||{},Lt=new D.Range(Ot.startLineNumber||wt.endLineNumber,Ot.startColumn||wt.endColumn,Ot.endLineNumber||wt.endLineNumber,Ot.endColumn||wt.endColumn);setTimeout(function(){qe.executeEdits("",[{range:Lt,text:""}])},300)}}function st(qe){(window.navigator.platform.match("Mac")?qe.metaKey:qe.ctrlKey)&&qe.keyCode==83&&(qe.preventDefault(),ke())}var ft=function(){if(Ce&&Pe.current.instance){var wt=Pe.current.instance.getContentHeight();Ti(wt0||Ue.target.offsetWidth>0)&&Ce.layout()}}catch(Ve){Fe.e(Ve)}finally{Fe.f()}}),Le.observe(Ae.current)),Le}Object(K.useEffect)(function(){Ae.current&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(Ce){D=Ce;var Le=D.editor.createDiffEditor(Ae.current,Object(le.a)(Object(le.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},_e),{},{wordWrap:!0}));de(Le);var Be=se(Le);return function(){Le.dispose();var Fe=Le.getModel();Fe&&Fe.dispose(),Be.unobserve(Ae.current)}})},[]),Object(K.useEffect)(function(){ie&&ie.setModel({original:D.editor.createModel(oe,pe),modified:D.editor.createModel(we,pe)})},[oe,we,pe,ie]);var Re=l(G),ke=l(re),Te={width:Re,height:ke};return W.a.createElement("div",{className:"my-diff-editor",ref:Ae,style:Te})}},ZpRC:function(ct,Qe,ne){"use strict";function le(g){return typeof g=="object"&&g!=null&&g.nodeType===1}function Z(g,p){return(!p||g!=="hidden")&&g!=="visible"&&g!=="clip"}function P(g,p){if(g.clientHeightp||d>g&&o=p&&n>=f?d-g-h:o>p&&nf?o-p+s:0}var H=function(g,p){var f=window,h=p.scrollMode,s=p.block,d=p.inline,o=p.boundary,n=p.skipOverflowHiddenElements,u=typeof o=="function"?o:function(Le){return Le!==o};if(!le(g))throw new TypeError("Invalid target");for(var c=document.scrollingElement||document.documentElement,L=[],C=g;le(C)&&u(C);){if((C=C.parentElement)===c){L.push(C);break}C!=null&&C===document.body&&P(C)&&!P(document.documentElement)||C!=null&&P(C,n)&&L.push(C)}for(var x=f.visualViewport?f.visualViewport.width:innerWidth,O=f.visualViewport?f.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,S=window.scrollY||pageYOffset,T=g.getBoundingClientRect(),_=T.height,l=T.width,E=T.top,m=T.right,b=T.bottom,N=T.left,D=s==="start"||s==="nearest"?E:s==="end"?b:E+_/2,B=d==="center"?N+l/2:d==="end"?m:N,j=[],I=0;I=0&&N>=0&&b<=O&&m<=x&&E>=oe&&b<=pe&&N>=Ee&&m<=we)return j;var _e=getComputedStyle(v),Ae=parseInt(_e.borderLeftWidth,10),fe=parseInt(_e.borderTopWidth,10),ue=parseInt(_e.borderRightWidth,10),ie=parseInt(_e.borderBottomWidth,10),de=0,se=0,Re="offsetWidth"in v?v.offsetWidth-v.clientWidth-Ae-ue:0,ke="offsetHeight"in v?v.offsetHeight-v.clientHeight-fe-ie:0;if(c===v)de=s==="start"?D:s==="end"?D-O:s==="nearest"?Q(S,S+O,O,fe,ie,S+D,S+D+_,_):D-O/2,se=d==="start"?B:d==="center"?B-x/2:d==="end"?B-x:Q(w,w+x,x,Ae,ue,w+B,w+B+l,l),de=Math.max(0,de+S),se=Math.max(0,se+w);else{de=s==="start"?D-oe-fe:s==="end"?D-pe+ie+ke:s==="nearest"?Q(oe,pe,Y,fe,ie+ke,D,D+_,_):D-(oe+Y/2)+ke/2,se=d==="start"?B-Ee-Ae:d==="center"?B-(Ee+re/2)+Re/2:d==="end"?B-we+ue+Re:Q(Ee,we,re,Ae,ue+Re,B,B+l,l);var Te=v.scrollLeft,Ce=v.scrollTop;D+=Ce-(de=Math.max(0,Math.min(Ce+de,v.scrollHeight-Y+ke))),B+=Te-(se=Math.max(0,Math.min(Te+se,v.scrollWidth-re+Re)))}j.push({el:v,top:de,left:se})}return j};function F(g){return g===Object(g)&&Object.keys(g).length!==0}function K(g,p){p===void 0&&(p="auto");var f="scrollBehavior"in document.body.style;g.forEach(function(h){var s=h.el,d=h.top,o=h.left;s.scroll&&f?s.scroll({top:d,left:o,behavior:p}):(s.scrollTop=d,s.scrollLeft=o)})}function W(g){return g===!1?{block:"end",inline:"nearest"}:F(g)?g:{block:"start",inline:"nearest"}}function M(g,p){var f=!g.ownerDocument.documentElement.contains(g);if(F(p)&&typeof p.behavior=="function")return p.behavior(f?[]:H(g,p));if(f)return;var h=W(p);return K(H(g,h),h.behavior)}var R=Qe.a=M},Zss7:function(ct,Qe,ne){var le;(function(Z){var P=/^\s+/,Q=/\s+$/,H=0,F=Z.round,K=Z.min,W=Z.max,M=Z.random;function R(ie,de){if(ie=ie||"",de=de||{},ie instanceof R)return ie;if(!(this instanceof R))return new R(ie,de);var se=g(ie);this._originalInput=ie,this._r=se.r,this._g=se.g,this._b=se.b,this._a=se.a,this._roundA=F(100*this._a)/100,this._format=de.format||se.format,this._gradientType=de.gradientType,this._r<1&&(this._r=F(this._r)),this._g<1&&(this._g=F(this._g)),this._b<1&&(this._b=F(this._b)),this._ok=se.ok,this._tc_id=H++}R.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var ie=this.toRgb();return(ie.r*299+ie.g*587+ie.b*114)/1e3},getLuminance:function(){var ie=this.toRgb(),de,se,Re,ke,Te,Ce;return de=ie.r/255,se=ie.g/255,Re=ie.b/255,de<=.03928?ke=de/12.92:ke=Z.pow((de+.055)/1.055,2.4),se<=.03928?Te=se/12.92:Te=Z.pow((se+.055)/1.055,2.4),Re<=.03928?Ce=Re/12.92:Ce=Z.pow((Re+.055)/1.055,2.4),.2126*ke+.7152*Te+.0722*Ce},setAlpha:function(ie){return this._a=j(ie),this._roundA=F(100*this._a)/100,this},toHsv:function(){var ie=s(this._r,this._g,this._b);return{h:ie.h*360,s:ie.s,v:ie.v,a:this._a}},toHsvString:function(){var ie=s(this._r,this._g,this._b),de=F(ie.h*360),se=F(ie.s*100),Re=F(ie.v*100);return this._a==1?"hsv("+de+", "+se+"%, "+Re+"%)":"hsva("+de+", "+se+"%, "+Re+"%, "+this._roundA+")"},toHsl:function(){var ie=f(this._r,this._g,this._b);return{h:ie.h*360,s:ie.s,l:ie.l,a:this._a}},toHslString:function(){var ie=f(this._r,this._g,this._b),de=F(ie.h*360),se=F(ie.s*100),Re=F(ie.l*100);return this._a==1?"hsl("+de+", "+se+"%, "+Re+"%)":"hsla("+de+", "+se+"%, "+Re+"%, "+this._roundA+")"},toHex:function(ie){return o(this._r,this._g,this._b,ie)},toHexString:function(ie){return"#"+this.toHex(ie)},toHex8:function(ie){return n(this._r,this._g,this._b,this._a,ie)},toHex8String:function(ie){return"#"+this.toHex8(ie)},toRgb:function(){return{r:F(this._r),g:F(this._g),b:F(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+F(this._r)+", "+F(this._g)+", "+F(this._b)+")":"rgba("+F(this._r)+", "+F(this._g)+", "+F(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:F(I(this._r,255)*100)+"%",g:F(I(this._g,255)*100)+"%",b:F(I(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+F(I(this._r,255)*100)+"%, "+F(I(this._g,255)*100)+"%, "+F(I(this._b,255)*100)+"%)":"rgba("+F(I(this._r,255)*100)+"%, "+F(I(this._g,255)*100)+"%, "+F(I(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:D[o(this._r,this._g,this._b,!0)]||!1},toFilter:function(ie){var de="#"+u(this._r,this._g,this._b,this._a),se=de,Re=this._gradientType?"GradientType = 1, ":"";if(ie){var ke=R(ie);se="#"+u(ke._r,ke._g,ke._b,ke._a)}return"progid:DXImageTransform.Microsoft.gradient("+Re+"startColorstr="+de+",endColorstr="+se+")"},toString:function(ie){var de=!!ie;ie=ie||this._format;var se=!1,Re=this._a<1&&this._a>=0,ke=!de&&Re&&(ie==="hex"||ie==="hex6"||ie==="hex3"||ie==="hex4"||ie==="hex8"||ie==="name");return ke?ie==="name"&&this._a===0?this.toName():this.toRgbString():(ie==="rgb"&&(se=this.toRgbString()),ie==="prgb"&&(se=this.toPercentageRgbString()),(ie==="hex"||ie==="hex6")&&(se=this.toHexString()),ie==="hex3"&&(se=this.toHexString(!0)),ie==="hex4"&&(se=this.toHex8String(!0)),ie==="hex8"&&(se=this.toHex8String()),ie==="name"&&(se=this.toName()),ie==="hsl"&&(se=this.toHslString()),ie==="hsv"&&(se=this.toHsvString()),se||this.toHexString())},clone:function(){return R(this.toString())},_applyModification:function(ie,de){var se=ie.apply(null,[this].concat([].slice.call(de)));return this._r=se._r,this._g=se._g,this._b=se._b,this.setAlpha(se._a),this},lighten:function(){return this._applyModification(x,arguments)},brighten:function(){return this._applyModification(O,arguments)},darken:function(){return this._applyModification(w,arguments)},desaturate:function(){return this._applyModification(c,arguments)},saturate:function(){return this._applyModification(L,arguments)},greyscale:function(){return this._applyModification(C,arguments)},spin:function(){return this._applyModification(S,arguments)},_applyCombination:function(ie,de){return ie.apply(null,[this].concat([].slice.call(de)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(T,arguments)},monochromatic:function(){return this._applyCombination(b,arguments)},splitcomplement:function(){return this._applyCombination(E,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(l,arguments)}},R.fromRatio=function(ie,de){if(typeof ie=="object"){var se={};for(var Re in ie)ie.hasOwnProperty(Re)&&(Re==="a"?se[Re]=ie[Re]:se[Re]=we(ie[Re]));ie=se}return R(ie,de)};function g(ie){var de={r:0,g:0,b:0},se=1,Re=null,ke=null,Te=null,Ce=!1,Le=!1;return typeof ie=="string"&&(ie=fe(ie)),typeof ie=="object"&&(Ae(ie.r)&&Ae(ie.g)&&Ae(ie.b)?(de=p(ie.r,ie.g,ie.b),Ce=!0,Le=String(ie.r).substr(-1)==="%"?"prgb":"rgb"):Ae(ie.h)&&Ae(ie.s)&&Ae(ie.v)?(Re=we(ie.s),ke=we(ie.v),de=d(ie.h,Re,ke),Ce=!0,Le="hsv"):Ae(ie.h)&&Ae(ie.s)&&Ae(ie.l)&&(Re=we(ie.s),Te=we(ie.l),de=h(ie.h,Re,Te),Ce=!0,Le="hsl"),ie.hasOwnProperty("a")&&(se=ie.a)),se=j(se),{ok:Ce,format:ie.format||Le,r:K(255,W(de.r,0)),g:K(255,W(de.g,0)),b:K(255,W(de.b,0)),a:se}}function p(ie,de,se){return{r:I(ie,255)*255,g:I(de,255)*255,b:I(se,255)*255}}function f(ie,de,se){ie=I(ie,255),de=I(de,255),se=I(se,255);var Re=W(ie,de,se),ke=K(ie,de,se),Te,Ce,Le=(Re+ke)/2;if(Re==ke)Te=Ce=0;else{var Be=Re-ke;Ce=Le>.5?Be/(2-Re-ke):Be/(Re+ke);switch(Re){case ie:Te=(de-se)/Be+(de1&&(Ue-=1),Ue<1/6?Fe+(Me-Fe)*6*Ue:Ue<1/2?Me:Ue<2/3?Fe+(Me-Fe)*(2/3-Ue)*6:Fe}if(de===0)Re=ke=Te=se;else{var Le=se<.5?se*(1+de):se+de-se*de,Be=2*se-Le;Re=Ce(Be,Le,ie+1/3),ke=Ce(Be,Le,ie),Te=Ce(Be,Le,ie-1/3)}return{r:Re*255,g:ke*255,b:Te*255}}function s(ie,de,se){ie=I(ie,255),de=I(de,255),se=I(se,255);var Re=W(ie,de,se),ke=K(ie,de,se),Te,Ce,Le=Re,Be=Re-ke;if(Ce=Re===0?0:Be/Re,Re==ke)Te=0;else{switch(Re){case ie:Te=(de-se)/Be+(de>1)+720)%360;--de;)Re.h=(Re.h+ke)%360,Te.push(R(Re));return Te}function b(ie,de){de=de||6;for(var se=R(ie).toHsv(),Re=se.h,ke=se.s,Te=se.v,Ce=[],Le=1/de;de--;)Ce.push(R({h:Re,s:ke,v:Te})),Te=(Te+Le)%1;return Ce}R.mix=function(ie,de,se){se=se===0?0:se||50;var Re=R(ie).toRgb(),ke=R(de).toRgb(),Te=se/100,Ce={r:(ke.r-Re.r)*Te+Re.r,g:(ke.g-Re.g)*Te+Re.g,b:(ke.b-Re.b)*Te+Re.b,a:(ke.a-Re.a)*Te+Re.a};return R(Ce)},R.readability=function(ie,de){var se=R(ie),Re=R(de);return(Z.max(se.getLuminance(),Re.getLuminance())+.05)/(Z.min(se.getLuminance(),Re.getLuminance())+.05)},R.isReadable=function(ie,de,se){var Re=R.readability(ie,de),ke,Te;Te=!1,ke=ue(se);switch(ke.level+ke.size){case"AAsmall":case"AAAlarge":Te=Re>=4.5;break;case"AAlarge":Te=Re>=3;break;case"AAAsmall":Te=Re>=7;break}return Te},R.mostReadable=function(ie,de,se){var Re=null,ke=0,Te,Ce,Le,Be;se=se||{},Ce=se.includeFallbackColors,Le=se.level,Be=se.size;for(var Fe=0;Feke&&(ke=Te,Re=R(de[Fe]));return R.isReadable(ie,Re,{level:Le,size:Be})||!Ce?Re:(se.includeFallbackColors=!1,R.mostReadable(ie,["#fff","#000"],se))};var N=R.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},D=R.hexNames=B(N);function B(ie){var de={};for(var se in ie)ie.hasOwnProperty(se)&&(de[ie[se]]=se);return de}function j(ie){return ie=parseFloat(ie),(isNaN(ie)||ie<0||ie>1)&&(ie=1),ie}function I(ie,de){Y(ie)&&(ie="100%");var se=re(ie);return ie=K(de,W(0,parseFloat(ie))),se&&(ie=parseInt(ie*de,10)/100),Z.abs(ie-de)<1e-6?1:ie%de/parseFloat(de)}function v(ie){return K(1,W(0,ie))}function G(ie){return parseInt(ie,16)}function Y(ie){return typeof ie=="string"&&ie.indexOf(".")!=-1&&parseFloat(ie)===1}function re(ie){return typeof ie=="string"&&ie.indexOf("%")!=-1}function oe(ie){return ie.length==1?"0"+ie:""+ie}function we(ie){return ie<=1&&(ie=ie*100+"%"),ie}function pe(ie){return Z.round(parseFloat(ie)*255).toString(16)}function Ee(ie){return G(ie)/255}var _e=function(){var ie="[-\\+]?\\d+%?",de="[-\\+]?\\d*\\.\\d+%?",se="(?:"+de+")|(?:"+ie+")",Re="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?",ke="[\\s|\\(]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")[,|\\s]+("+se+")\\s*\\)?";return{CSS_UNIT:new RegExp(se),rgb:new RegExp("rgb"+Re),rgba:new RegExp("rgba"+ke),hsl:new RegExp("hsl"+Re),hsla:new RegExp("hsla"+ke),hsv:new RegExp("hsv"+Re),hsva:new RegExp("hsva"+ke),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Ae(ie){return!!_e.CSS_UNIT.exec(ie)}function fe(ie){ie=ie.replace(P,"").replace(Q,"").toLowerCase();var de=!1;if(N[ie])ie=N[ie],de=!0;else if(ie=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var se;return(se=_e.rgb.exec(ie))?{r:se[1],g:se[2],b:se[3]}:(se=_e.rgba.exec(ie))?{r:se[1],g:se[2],b:se[3],a:se[4]}:(se=_e.hsl.exec(ie))?{h:se[1],s:se[2],l:se[3]}:(se=_e.hsla.exec(ie))?{h:se[1],s:se[2],l:se[3],a:se[4]}:(se=_e.hsv.exec(ie))?{h:se[1],s:se[2],v:se[3]}:(se=_e.hsva.exec(ie))?{h:se[1],s:se[2],v:se[3],a:se[4]}:(se=_e.hex8.exec(ie))?{r:G(se[1]),g:G(se[2]),b:G(se[3]),a:Ee(se[4]),format:de?"name":"hex8"}:(se=_e.hex6.exec(ie))?{r:G(se[1]),g:G(se[2]),b:G(se[3]),format:de?"name":"hex"}:(se=_e.hex4.exec(ie))?{r:G(se[1]+""+se[1]),g:G(se[2]+""+se[2]),b:G(se[3]+""+se[3]),a:Ee(se[4]+""+se[4]),format:de?"name":"hex8"}:(se=_e.hex3.exec(ie))?{r:G(se[1]+""+se[1]),g:G(se[2]+""+se[2]),b:G(se[3]+""+se[3]),format:de?"name":"hex"}:!1}function ue(ie){var de,se;return ie=ie||{level:"AA",size:"small"},de=(ie.level||"AA").toUpperCase(),se=(ie.size||"small").toLowerCase(),de!=="AA"&&de!=="AAA"&&(de="AA"),se!=="small"&&se!=="large"&&(se="small"),{level:de,size:se}}ct.exports?ct.exports=R:!(le=function(){return R}.call(Qe,ne,Qe,ct),le!==void 0&&(ct.exports=le))})(Math)},bT9E:function(ct,Qe,ne){"use strict";ne.d(Qe,"a",function(){return Z});var le=ne("VTBJ");function Z(P,Q){var H=Object(le.a)({},P);return Array.isArray(Q)&&Q.forEach(function(F){delete H[F]}),H}},c5Ni:function(ct,Qe,ne){},dejd:function(ct,Qe,ne){},dmUQ:function(ct,Qe,ne){"use strict";var le=ne("Ff2n"),Z=ne("rePB"),P=ne("1OyB"),Q=ne("vuIU"),H=ne("Ji7U"),F=ne("md7G"),K=ne("foSv"),W=ne("q1tI"),M=ne.n(W),R=ne("TSYQ"),g=ne.n(R),p=ne("4IlW");function f(_,l){var E=Object.keys(_);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(_);l&&(m=m.filter(function(b){return Object.getOwnPropertyDescriptor(_,b).enumerable})),E.push.apply(E,m)}return E}function h(_){for(var l=1;l1?re-1:0),we=1;we1?I-1:0),G=1;G=0)return parseInt(j.slice(j.indexOf("e-")+2),10);var I=0;return j.indexOf(".")>=0&&(I=j.length-j.indexOf(".")-1),I},b.getInputDisplayValue=function(B){var j=B||b.state,I=j.focused,v=j.inputValue,G=j.value,Y;I?Y=v:Y=b.toPrecisionAsStep(G),Y==null&&(Y="");var re=b.formatWrapper(Y);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(B){}},b.restoreByAfter=function(B){if(B===void 0)return!1;var j=b.input.value,I=j.lastIndexOf(B);if(I===-1)return!1;var v=b.cursorBefore.length;return b.lastKeyCode===p.a.DELETE&&b.cursorBefore.charAt(v-1)===B[0]?(b.fixCaret(v,v),!0):I+B.length===j.length?(b.fixCaret(I,I),!0):!1},b.partRestoreByAfter=function(B){return B===void 0?!1:Array.prototype.some.call(B,function(j,I){var v=B.substring(I);return b.restoreByAfter(v)})},b.isNotCompleteNumber=function(B){return isNaN(B)||B===""||B===null||B&&B.toString().indexOf(".")===B.toString().length-1},b.stop=function(){b.autoStepTimer&&clearTimeout(b.autoStepTimer)},b.down=function(B,j,I){b.pressingUpOrDown=!0,b.step("down",B,j,I)},b.up=function(B,j,I){b.pressingUpOrDown=!0,b.step("up",B,j,I)},b.saveInput=function(B){b.input=B};var N=m.value;N===void 0&&(N=m.defaultValue),b.state={focused:m.autoFocus};var D=b.getValidValue(b.toNumber(N));return b.state=h(h({},b.state),{},{inputValue:b.toPrecisionAsStep(D),value:D}),b}return Object(Q.a)(E,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(b){var N=this.props,D=N.value,B=N.onChange,j=N.max,I=N.min,v=this.state.focused;if(b){if(!O(b.value,D)||!O(b.max,j)||!O(b.min,I)){var G=v?D:this.getValidValue(D),Y;this.pressingUpOrDown?Y=G:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(G),this.setState({value:G,inputValue:Y})}var re="value"in this.props?D:this.state.value;"max"in this.props&&b.max!==j&&typeof re=="number"&&re>j&&B&&B(j),"min"in this.props&&b.min!==I&&typeof re=="number"&&re1&&arguments[1]!==void 0?arguments[1]:this.props.min,D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,B=parseFloat(b);return isNaN(B)?b:(BD&&(B=D),B)}},{key:"setValue",value:function(b,N){var D=this.props.precision,B=this.isNotCompleteNumber(parseFloat(b))?null:parseFloat(b),j=this.state.value,I=j===void 0?null:j,v=this.state.inputValue,G=v===void 0?null:v,Y=typeof B=="number"?B.toFixed(D):"".concat(B),re=B!==I||Y!=="".concat(G);return"value"in this.props?(G=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:G},N)):this.setState({value:B,inputValue:this.toPrecisionAsStep(b)},N),re&&this.props.onChange(B),B}},{key:"getMaxPrecision",value:function(b){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,D=this.props,B=D.precision,j=D.step;if(x(B))return B;var I=this.getPrecision(N),v=this.getPrecision(j),G=this.getPrecision(b);return b?Math.max(G,I+v):I+v}},{key:"getPrecisionFactor",value:function(b){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,D=this.getMaxPrecision(b,N);return Math.pow(10,D)}},{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 N=Math.abs(this.getMaxPrecision(b));return isNaN(N)?b.toString():Number(b).toFixed(N)}},{key:"toNumber",value:function(b){var N=this.props.precision,D=this.state.focused,B=b&&b.length>16&&D;return this.isNotCompleteNumber(b)||B?b:x(N)?Math.round(b*Math.pow(10,N))/Math.pow(10,N):Number(b)}},{key:"upStep",value:function(b,N){var D=this.props.step,B=this.getPrecisionFactor(b,N),j=Math.abs(this.getMaxPrecision(b,N)),I=((B*b+B*D*N)/B).toFixed(j);return this.toNumber(I)}},{key:"downStep",value:function(b,N){var D=this.props.step,B=this.getPrecisionFactor(b,N),j=Math.abs(this.getMaxPrecision(b,N)),I=((B*b-B*D*N)/B).toFixed(j);return this.toNumber(I)}},{key:"step",value:function(b,N){var D=this,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,j=arguments.length>3?arguments[3]:void 0;this.stop(),N&&(N.persist(),N.preventDefault());var I=this.props;if(I.disabled)return;var v=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(v))return;var G=this["".concat(b,"Step")](v,B),Y=G>I.max||GI.max?G=I.max:G=oe),We=(ot||ot===0)&&(isNaN(ot)||Number(ot)<=we),Se=Pe||B||j,ve=We||B||j,xe=g()("".concat(D,"-handler"),"".concat(D,"-handler-up"),Object(Z.a)({},"".concat(D,"-handler-up-disabled"),Se)),te=g()("".concat(D,"-handler"),"".concat(D,"-handler-down"),Object(Z.a)({},"".concat(D,"-handler-down-disabled"),ve)),ae=I?{onTouchStart:Se?o:this.up,onTouchEnd:this.stop}:{onMouseDown:Se?o:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},he=I?{onTouchStart:ve?o:this.down,onTouchEnd:this.stop}:{onMouseDown:ve?o:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return M.a.createElement("div",{className:rt,style:pe,title:Ee,onMouseEnter:_e,onMouseLeave:Ae,onMouseOver:fe,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},M.a.createElement("div",{className:"".concat(D,"-handler-wrap")},M.a.createElement("span",Object.assign({unselectable:"on"},ae,{role:"button","aria-label":"Increase Value","aria-disabled":Se,className:xe}),G||M.a.createElement("span",{unselectable:"on",className:"".concat(D,"-handler-up-inner"),onClick:n})),M.a.createElement("span",Object.assign({unselectable:"on"},he,{role:"button","aria-label":"Decrease Value","aria-disabled":ve,className:te}),Y||M.a.createElement("span",{unselectable:"on",className:"".concat(D,"-handler-down-inner"),onClick:n}))),M.a.createElement("div",{className:"".concat(D,"-input-wrap")},M.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":we,"aria-valuemax":oe,"aria-valuenow":ot,required:ie,type:Re,placeholder:ke,onPaste:Ve,onClick:de,onMouseUp:this.onMouseUp,className:"".concat(D,"-input"),tabIndex:se,autoComplete:v,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:ut?this.onKeyDown:o,onKeyUp:ut?this.onKeyUp:o,autoFocus:Me,maxLength:Fe,readOnly:j,disabled:B,max:oe,min:we,step:Be,name:Ue,title:Ee,id:Te,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(tt),pattern:Le,inputMode:Ce,onInput:$e},Ne))))}}]),E}(M.a.Component);w.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:C,min:-C,step:1,style:{},onChange:o,onKeyDown:o,onPressEnter:o,onFocus:o,onBlur:o,parser:u,required:!1,autoComplete:"off"};var S=w,T=Qe.a=S},gMzb:function(ct,Qe,ne){"use strict";var le=ne("k1fw"),Z=ne("oBTY"),P=ne("9og8"),Q=ne("tJVT"),H=ne("sRBo"),F=ne("kaz8"),K=ne("WmNS"),W=ne.n(K),M=ne("q1tI"),R=ne.n(M),g=ne("9kvl"),p=ne("wlus"),f=ne("w5pM"),h=ne("ErOA"),s=ne("OaEy"),d=ne("2fM7"),o=ne("y8nQ"),n=ne("Vl3Y"),u=ne("Ty5D"),c=ne("yQHh"),L=ne.n(c),C=F.a.Group,x=function(l){var E,m,b,N,D,B,j,I,v=l.classroomList,G=l.loading,Y=l.user,re=l.exercise_id,oe=re===void 0?null:re,we=l.homework_common_id,pe=we===void 0?null:we,Ee=l.setitem,_e=l.item,Ae=l.type,fe=l.rz,ue=l.dispatch,ie=Object(M.useState)([]),de=Object(Q.a)(ie,2),se=de[0],Re=de[1],ke=Object(M.useState)({zydatas:[],jbdatas:[],kcdatas:[],zsdatas:[],page:1,per_page:20}),Te=Object(Q.a)(ke,2),Ce=Te[0],Le=Te[1],Be=Object(u.i)(),Fe=Object(M.useState)(!1),Me=Object(Q.a)(Fe,2),Ue=Me[0],Ve=Me[1],$e=Object(M.useState)(!1),Ze=Object(Q.a)($e,2),Xe=Ze[0],ot=Ze[1],et=n.a.useForm(),rt=Object(Q.a)(et,1),Ne=rt[0];Object(M.useEffect)(function(){fe&&(Ce.zydatas=fe,Le(Object(le.a)({},Ce)),_e!=null&&_e.ec_course_id&&ut())},[_e,fe]);function ut(){return tt.apply(this,arguments)}function tt(){return tt=Object(P.a)(W.a.mark(function te(){return W.a.wrap(function(he){for(;;)switch(he.prev=he.next){case 0:return console.log("----",_e),he.next=3,Pe(_e==null?void 0:_e.ec_major_school_id);case 3:return he.next=5,Se(_e==null?void 0:_e.ec_year_id);case 5:return he.next=7,xe(_e==null?void 0:_e.ec_course_id);case 7:Ne.setFieldsValue({ec_course_id:_e==null?void 0:_e.ec_course_id,ec_major_school_id:_e==null?void 0:_e.ec_major_school_id,ec_point_ids:_e==null?void 0:_e.ec_point_ids,ec_year_id:_e==null?void 0:_e.ec_year_id});case 8:case"end":return he.stop()}},te)})),tt.apply(this,arguments)}function Pe(te){return We.apply(this,arguments)}function We(){return We=Object(P.a)(W.a.mark(function te(ae){var he;return W.a.wrap(function(be){for(;;)switch(be.prev=be.next){case 0:return be.next=2,Object(h.a)("/api/ec_major_schools/".concat(ae,"/ec_years/get_year_list.json"),{method:"get"});case 2:he=be.sent,Ce.jbdatas=he==null?void 0:he.data,Le(Object(le.a)({},Ce)),Ne.setFieldsValue({ec_year_id:"",ec_course_id:"",ec_point_ids:[]});case 6:case"end":return be.stop()}},te)})),We.apply(this,arguments)}function Se(te){return ve.apply(this,arguments)}function ve(){return ve=Object(P.a)(W.a.mark(function te(ae){var he;return W.a.wrap(function(be){for(;;)switch(be.prev=be.next){case 0:return be.next=2,Object(h.a)("/api/ec_years/".concat(ae,"/ec_courses/get_courses.json"),{method:"get"});case 2:he=be.sent,Ce.kcdatas=he==null?void 0:he.data,Le(Object(le.a)({},Ce)),Ne.setFieldsValue({ec_course_id:"",ec_point_ids:[]});case 6:case"end":return be.stop()}},te)})),ve.apply(this,arguments)}var xe=function(){var te=Object(P.a)(W.a.mark(function ae(he){var me;return W.a.wrap(function(De){for(;;)switch(De.prev=De.next){case 0:return De.next=2,Object(h.a)("/api/ec_courses/".concat(he,"/ec_points.json"),{method:"get",params:{ec_course_id:he}});case 2:me=De.sent,Ce.zsdatas=me==null?void 0:me.data,Le(Object(le.a)({},Ce));case 5:case"end":return De.stop()}},ae)}));return function(he){return te.apply(this,arguments)}}();return R.a.createElement("div",{className:L.a.from},R.a.createElement(n.a,{form:Ne,layout:"inline",onValuesChange:function(ae){console.log("----",ae),ae.ec_major_school_id&&(Ce.jbdatas=[],Ce.kcdatas=[],Ce.zsdatas=[],Le(Object(le.a)({},Ce)),Pe(ae.ec_major_school_id)),ae.ec_year_id&&(Ce.kcdatas=[],Ce.zsdatas=[],Le(Object(le.a)({},Ce)),Se(ae.ec_year_id)),ae.ec_course_id&&(Ce.zsdatas=[],Le(Object(le.a)({},Ce)),xe(ae.ec_course_id))},onFinish:function(){var te=Object(P.a)(W.a.mark(function ae(he){return W.a.wrap(function(be){for(;;)switch(be.prev=be.next){case 0:Ee(he);case 1:case"end":return be.stop()}},ae)}));return function(ae){return te.apply(this,arguments)}}()},R.a.createElement(n.a.Item,{label:"\u8BA4\u8BC1\u4E13\u4E1A",name:"ec_major_school_id"},R.a.createElement(d.a,{style:{width:150},disabled:((E=Ce.zydatas)===null||E===void 0?void 0:E.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u4E13\u4E1A"},Ce==null||((m=Ce.zydatas)===null||m===void 0)?void 0:m.map(function(te,ae){return R.a.createElement(d.a.Option,{key:ae,value:te==null?void 0:te.ec_major_school_id},te==null?void 0:te.name)}))),R.a.createElement(n.a.Item,{label:"\u8BA4\u8BC1\u5C4A\u522B",name:"ec_year_id"},R.a.createElement(d.a,{style:{width:150},disabled:((b=Ce.jbdatas)===null||b===void 0?void 0:b.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BA4\u8BC1\u5C4A\u522B"},Ce==null||((N=Ce.jbdatas)===null||N===void 0)?void 0:N.map(function(te,ae){return R.a.createElement(d.a.Option,{key:ae,value:te==null?void 0:te.ec_year_id},te==null?void 0:te.year)}))),R.a.createElement(n.a.Item,{label:"\u8BFE\u7A0B",name:"ec_course_id"},R.a.createElement(d.a,{style:{width:150},disabled:((D=Ce.kcdatas)===null||D===void 0?void 0:D.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u8BFE\u7A0B"},Ce==null||((B=Ce.kcdatas)===null||B===void 0)?void 0:B.map(function(te,ae){return R.a.createElement(d.a.Option,{key:ae,value:te==null?void 0:te.id},te==null?void 0:te.name)}))),R.a.createElement(n.a.Item,{label:"\u77E5\u8BC6\u70B9",name:"ec_point_ids"},R.a.createElement(d.a,{onChange:function(){Ne.submit()},style:{width:150},mode:"multiple",disabled:((j=Ce.zsdatas)===null||j===void 0?void 0:j.length)<=0,placeholder:"\u8BF7\u9009\u62E9\u77E5\u8BC6\u70B9"},Ce==null||((I=Ce.zsdatas)===null||I===void 0)?void 0:I.map(function(te,ae){return R.a.createElement(d.a.Option,{key:ae,value:te==null?void 0:te.id},te==null?void 0:te.name)})))))},O=Object(g.a)(function(_){var l=_.classroomList,E=_.loading,m=_.globalSetting,b=_.user;return{classroomList:l,globalSetting:m,loading:E.effects,user:b}})(x),w=F.a.Group,S=function(l){var E,m,b,N=l.classroomList,D=l.loading,B=l.user,j=l.exercise_id,I=j===void 0?null:j,v=l.homework_common_id,G=v===void 0?null:v,Y=l.setitem,re=l.type,oe=l.dispatch,we=Object(M.useState)([{}]),pe=Object(Q.a)(we,2),Ee=pe[0],_e=pe[1],Ae=Object(M.useState)([]),fe=Object(Q.a)(Ae,2),ue=fe[0],ie=fe[1];function de(){return se.apply(this,arguments)}function se(){return se=Object(P.a)(W.a.mark(function Te(){var Ce,Le,Be,Fe,Me;return W.a.wrap(function(Ve){for(;;)switch(Ve.prev=Ve.next){case 0:return Ve.next=2,Object(h.a)("/api/ec_courses/".concat(0,"/ec_points/get_work_points.json"),{method:"get",params:{exercise_id:I,homework_common_id:G}});case 2:Le=Ve.sent,(Le==null||((Ce=Le.data)===null||Ce===void 0)?void 0:Ce.length)>0&&(Me=[],Le==null||((Be=Le.data)===null||Be===void 0)||Be.map(function($e){var Ze;$e==null||((Ze=$e.ec_point_ids)===null||Ze===void 0)||Ze.map(function(Xe){Me.push(Xe)})}),Y(Object(le.a)(Object(le.a)({},Le==null||((Fe=Le.data)===null||Fe===void 0)?void 0:Fe[0]),{},{ec_point_ids:Me})),_e(Le==null?void 0:Le.data));case 4:case"end":return Ve.stop()}},Te)})),se.apply(this,arguments)}Object(M.useEffect)(function(){var Te,Ce;B!=null&&(Te=B.userInfo)!==null&&Te!==void 0&&(Ce=Te.course)!==null&&Ce!==void 0&&Ce.course_school_id&&Re()},[B==null||((E=B.userInfo)===null||E===void 0||((m=E.course)===null||m===void 0))?void 0:m.course_school_id]);function Re(){return ke.apply(this,arguments)}function ke(){return ke=Object(P.a)(W.a.mark(function Te(){var Ce,Le,Be;return W.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return Me.next=2,Object(h.a)("/api/schools/".concat(B==null||((Ce=B.userInfo)===null||Ce===void 0||((Le=Ce.course)===null||Le===void 0))?void 0:Le.course_school_id,"/ec_majors/get_major_list.json"),{method:"get"});case 2:Be=Me.sent,ie(Be==null?void 0:Be.data),(G||I)&&de();case 5:case"end":return Me.stop()}},Te)})),ke.apply(this,arguments)}return console.log(Ee),R.a.createElement("div",{style:{display:(b=B.userInfo.course)!==null&&b!==void 0&&b.is_openengineering?"":"none"}},R.a.createElement("p",{style:{fontSize:"16px",fontWeight:400}},"\u5DE5\u7A0B\u8BA4\u8BC1\u8003\u6838\u77E5\u8BC6\u70B9"),Ee==null?void 0:Ee.map(function(Te,Ce){return R.a.createElement("div",{style:{display:"flex",alignItems:"center",marginBottom:"10px"}},R.a.createElement(O,{rz:ue,item:Te,type:Ce,setitem:function(Be){Ee.splice(Ce,1,Be),_e(Object(Z.a)(Ee));var Fe=[];Ee==null||Ee.map(function(Me){var Ue;Me==null||((Ue=Me.ec_point_ids)===null||Ue===void 0)||Ue.map(function(Ve){Fe.push(Ve)})}),Y(Object(le.a)(Object(le.a)({},Be),{},{ec_point_ids:Fe}))}}),Ce!=0&&R.a.createElement(p.a,{onClick:function(){Ee.splice(Ce,1),_e(Object(Z.a)(Ee))},style:{marginLeft:10,fontSize:"20px"}}),R.a.createElement(f.a,{onClick:function(){Ee.push({}),_e(Object(Z.a)(Ee))},style:{marginLeft:10,fontSize:"20px"}}))}))},T=Qe.a=Object(g.a)(function(_){var l=_.classroomList,E=_.loading,m=_.globalSetting,b=_.user;return{classroomList:l,globalSetting:m,loading:E.effects,user:b}})(S)},h78n:function(ct,Qe,ne){"use strict";ne.d(Qe,"a",function(){return b});var le=ne("q1tI"),Z=ne.n(le),P=ne("TSYQ"),Q=ne.n(P),H={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},F=function(B){var j=B.map(function(){return Object(le.useRef)()}),I=Object(le.useRef)();return Object(le.useEffect)(function(){var v=Date.now(),G=!1;Object.keys(j).forEach(function(Y){var re=j[Y].current;if(!re)return;G=!0;var oe=re.style;oe.transitionDuration=".3s, .3s, .3s, .06s",I.current&&v-I.current<100&&(oe.transitionDuration="0s, 0s")}),G&&(I.current=Date.now())}),[j]};function K(){return K=Object.assign||function(D){for(var B=1;BD.length)&&(B=D.length);for(var j=0,I=new Array(B);j=0)continue;if(!Object.prototype.propertyIsEnumerable.call(D,I))continue;j[I]=D[I]}}return j}function s(D,B){if(D==null)return{};var j={},I=Object.keys(D),v,G;for(G=0;G=0)continue;j[v]=D[v]}return j}var d=function(B){var j=B.className,I=B.percent,v=B.prefixCls,G=B.strokeColor,Y=B.strokeLinecap,re=B.strokeWidth,oe=B.style,we=B.trailColor,pe=B.trailWidth,Ee=B.transition,_e=h(B,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete _e.gapPosition;var Ae=Array.isArray(I)?I:[I],fe=Array.isArray(G)?G:[G],ue=F(Ae),ie=W(ue,1),de=ie[0],se=re/2,Re=100-re/2,ke="M ".concat(Y==="round"?se:0,",").concat(se,` L `).concat(Y==="round"?Re:100,",").concat(se),Te="0 0 100 ".concat(re),Ce=0;return Z.a.createElement("svg",K({className:Q()("".concat(v,"-line"),j),viewBox:Te,preserveAspectRatio:"none",style:oe},_e),Z.a.createElement("path",{className:"".concat(v,"-line-trail"),d:ke,strokeLinecap:Y,stroke:we,strokeWidth:pe||re,fillOpacity:"0"}),Ae.map(function(Le,Be){var Fe={strokeDasharray:"".concat(Le,"px, 100px"),strokeDashoffset:"-".concat(Ce,"px"),transition:Ee||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Me=fe[Be]||fe[fe.length-1];return Ce+=Le,Z.a.createElement("path",{key:Be,className:"".concat(v,"-line-path"),d:ke,strokeLinecap:Y,stroke:Me,strokeWidth:re,fillOpacity:"0",ref:de[Be],style:Fe})}))};d.defaultProps=H;var o=d;function n(){return n=Object.assign||function(D){for(var B=1;BD.length)&&(B=D.length);for(var j=0,I=new Array(B);j=0)continue;if(!Object.prototype.propertyIsEnumerable.call(D,I))continue;j[I]=D[I]}}return j}function S(D,B){if(D==null)return{};var j={},I=Object.keys(D),v,G;for(G=0;G=0)continue;j[v]=D[v]}return j}var T=0;function _(D){return+D.replace("%","")}function l(D){return Array.isArray(D)?D:[D]}function E(D,B,j,I){var v=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,G=arguments.length>5?arguments[5]:void 0,Y=50-I/2,re=0,oe=-Y,we=0,pe=-2*Y;switch(G){case"left":re=-Y,oe=0,we=2*Y,pe=0;break;case"right":re=Y,oe=0,we=-2*Y,pe=0;break;case"bottom":oe=Y,pe=2*Y;break;default:}var Ee="M 50,50 m ".concat(re,",").concat(oe,` a `).concat(Y,",").concat(Y," 0 1 1 ").concat(we,",").concat(-pe,` a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-we,",").concat(pe),_e=Math.PI*2*Y,Ae={stroke:j,strokeDasharray:"".concat(B/100*(_e-v),"px ").concat(_e,"px"),strokeDashoffset:"-".concat(v/2+D/100*(_e-v),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Ee,pathStyle:Ae}}var m=function(B){var j=B.prefixCls,I=B.strokeWidth,v=B.trailWidth,G=B.gapDegree,Y=B.gapPosition,re=B.trailColor,oe=B.strokeLinecap,we=B.style,pe=B.className,Ee=B.strokeColor,_e=B.percent,Ae=w(B,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),fe=Object(le.useMemo)(function(){return T+=1,T},[]),ue=E(0,100,re,I,G,Y),ie=ue.pathString,de=ue.pathStyle,se=l(_e),Re=l(Ee),ke=Re.find(function(Fe){return Object.prototype.toString.call(Fe)==="[object Object]"}),Te=F(se),Ce=u(Te,1),Le=Ce[0],Be=function(){var Me=0;return se.map(function(Ue,Ve){var $e=Re[Ve]||Re[Re.length-1],Ze=Object.prototype.toString.call($e)==="[object Object]"?"url(#".concat(j,"-gradient-").concat(fe,")"):"",Xe=E(Me,Ue,$e,I,G,Y);return Me+=Ue,Z.a.createElement("path",{key:Ve,className:"".concat(j,"-circle-path"),d:Xe.pathString,stroke:Ze,strokeLinecap:oe,strokeWidth:I,opacity:Ue===0?0:1,fillOpacity:"0",style:Xe.pathStyle,ref:Le[Ve]})})};return Z.a.createElement("svg",n({className:Q()("".concat(j,"-circle"),pe),viewBox:"0 0 100 100",style:we},Ae),ke&&Z.a.createElement("defs",null,Z.a.createElement("linearGradient",{id:"".concat(j,"-gradient-").concat(fe),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(ke).sort(function(Fe,Me){return _(Fe)-_(Me)}).map(function(Fe,Me){return Z.a.createElement("stop",{key:Me,offset:Fe,stopColor:ke[Fe]})}))),Z.a.createElement("path",{className:"".concat(j,"-circle-trail"),d:ie,stroke:re,strokeLinecap:oe,strokeWidth:v||I,fillOpacity:"0",style:de}),Be().reverse())};m.defaultProps=H;var b=m,N={Line:o,Circle:b}},kSUc:function(ct,Qe,ne){},lLeG:function(ct,Qe,ne){ct.exports={bg:"bg___f0e4_",flexRow:"flexRow___1-S6r",flexJustifyCenter:"flexJustifyCenter___3KkrV",flexAlignEnd:"flexAlignEnd___146T7",flexAlignCenter:"flexAlignCenter___2UVve",flexColumn:"flexColumn___nj9sg",formWrap:"formWrap___2eqbH",titleWrap:"titleWrap___1gkN2",fieldWrap:"fieldWrap___2l5q8",mdWrap:"mdWrap___38Ffu",backgroundFa:"backgroundFa___2gBUv",button:"button___3jgMh"}},lZu9:function(ct,Qe,ne){(function(le){le(ne("VrN/"),ne("1eCo"),ne("8EBN"))})(function(le){"use strict";le.defineMode("markdown",function(Z,P){var Q=le.getMode(Z,"text/html"),H=Q.name=="null";function F(I){if(le.findModeByName){var v=le.findModeByName(I);v&&(I=v.mime||v.mimes[0])}var G=le.getMode(Z,I);return G.name=="null"?null:G}P.highlightFormatting===void 0&&(P.highlightFormatting=!1),P.maxBlockquoteDepth===void 0&&(P.maxBlockquoteDepth=0),P.taskLists===void 0&&(P.taskLists=!1),P.strikethrough===void 0&&(P.strikethrough=!1),P.emoji===void 0&&(P.emoji=!1),P.fencedCodeBlockHighlighting===void 0&&(P.fencedCodeBlockHighlighting=!0),P.fencedCodeBlockDefaultMode===void 0&&(P.fencedCodeBlockDefaultMode="text/plain"),P.xml===void 0&&(P.xml=!0),P.tokenTypeOverrides===void 0&&(P.tokenTypeOverrides={});var K={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var W in K)K.hasOwnProperty(W)&&P.tokenTypeOverrides[W]&&(K[W]=P.tokenTypeOverrides[W]);var M=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,p=P.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,f=/^ {0,3}(?:\={1,}|-{2,})\s*$/,h=/^[^#!\[\]*_\\<>` "'(~:]+/,s=/^(~~~+|```+)[ \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]/,n=" ";function u(I,v,G){return v.f=v.inline=G,G(I,v)}function c(I,v,G){return v.f=v.block=G,G(I,v)}function L(I){return!I||!/\S/.test(I.string)}function C(I){if(I.linkTitle=!1,I.linkHref=!1,I.linkText=!1,I.em=!1,I.strong=!1,I.strikethrough=!1,I.quote=0,I.indentedCode=!1,I.f==O){var v=H;if(!v){var G=le.innerMode(Q,I.htmlState);v=G.mode.name=="xml"&&G.state.tagStart===null&&!G.state.context&&G.state.tokenize.isInText}v&&(I.f=_,I.block=x,I.htmlState=null)}return I.trailingSpace=0,I.trailingSpaceNewLine=!1,I.prevLine=I.thisLine,I.thisLine={stream:null},null}function x(I,v){var G=I.column()===v.indentation,Y=L(v.prevLine.stream),re=v.indentedCode,oe=v.prevLine.hr,we=v.list!==!1,pe=(v.listStack[v.listStack.length-1]||0)+3;v.indentedCode=!1;var Ee=v.indentation;if(v.indentationDiff===null&&(v.indentationDiff=v.indentation,we)){for(v.list=null;Ee=4&&(re||v.prevLine.fencedCodeEnd||v.prevLine.header||Y))return I.skipToEnd(),v.indentedCode=!0,K.code;if(I.eatSpace())return null;if(G&&v.indentation<=pe&&(fe=I.match(p))&&fe[1].length<=6)return v.quote=0,v.header=fe[1].length,v.thisLine.header=!0,P.highlightFormatting&&(v.formatting="header"),v.f=v.inline,S(v);if(v.indentation<=pe&&I.eat(">"))return v.quote=G?1:v.quote+1,P.highlightFormatting&&(v.formatting="quote"),I.eatSpace(),S(v);if(!Ae&&!v.setext&&G&&v.indentation<=pe&&(fe=I.match(R))){var ue=fe[1]?"ol":"ul";return v.indentation=Ee+I.current().length,v.list=!0,v.quote=0,v.listStack.push(v.indentation),v.em=!1,v.strong=!1,v.code=!1,v.strikethrough=!1,P.taskLists&&I.match(g,!1)&&(v.taskList=!0),v.f=v.inline,P.highlightFormatting&&(v.formatting=["list","list-"+ue]),S(v)}else{if(G&&v.indentation<=pe&&(fe=I.match(s,!0)))return v.quote=0,v.fencedEndRE=new RegExp(fe[1]+"+ *$"),v.localMode=P.fencedCodeBlockHighlighting&&F(fe[2]||P.fencedCodeBlockDefaultMode),v.localMode&&(v.localState=le.startState(v.localMode)),v.f=v.block=w,P.highlightFormatting&&(v.formatting="code-block"),v.code=-1,S(v);if(v.setext||(!_e||!we)&&!v.quote&&v.list===!1&&!v.code&&!Ae&&!d.test(I.string)&&(fe=I.lookAhead(1))&&(fe=fe.match(f)))return v.setext?(v.header=v.setext,v.setext=0,I.skipToEnd(),P.highlightFormatting&&(v.formatting="header")):(v.header=fe[0].charAt(0)=="="?1:2,v.setext=v.header),v.thisLine.header=!0,v.f=v.inline,S(v);if(Ae)return I.skipToEnd(),v.hr=!0,v.thisLine.hr=!0,K.hr;if(I.peek()==="[")return u(I,v,N)}return u(I,v,v.inline)}function O(I,v){var G=Q.token(I,v.htmlState);if(!H){var Y=le.innerMode(Q,v.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||v.md_inside&&I.current().indexOf(">")>-1)&&(v.f=_,v.block=x,v.htmlState=null)}return G}function w(I,v){var G=v.listStack[v.listStack.length-1]||0,Y=v.indentation=I.quote?v.push(K.formatting+"-"+I.formatting[G]+"-"+I.quote):v.push("error"))}if(I.taskOpen)return v.push("meta"),v.length?v.join(" "):null;if(I.taskClosed)return v.push("property"),v.length?v.join(" "):null;if(I.linkHref?v.push(K.linkHref,"url"):(I.strong&&v.push(K.strong),I.em&&v.push(K.em),I.strikethrough&&v.push(K.strikethrough),I.emoji&&v.push(K.emoji),I.linkText&&v.push(K.linkText),I.code&&v.push(K.code),I.image&&v.push(K.image),I.imageAltText&&v.push(K.imageAltText,"link"),I.imageMarker&&v.push(K.imageMarker)),I.header&&v.push(K.header,K.header+"-"+I.header),I.quote&&(v.push(K.quote),!P.maxBlockquoteDepth||P.maxBlockquoteDepth>=I.quote?v.push(K.quote+"-"+I.quote):v.push(K.quote+"-"+P.maxBlockquoteDepth)),I.list!==!1){var Y=(I.listStack.length-1)%3;Y?Y===1?v.push(K.list2):v.push(K.list3):v.push(K.list1)}return I.trailingSpaceNewLine?v.push("trailing-space-new-line"):I.trailingSpace&&v.push("trailing-space-"+(I.trailingSpace%2?"a":"b")),v.length?v.join(" "):null}function T(I,v){return I.match(h,!0)?S(v):void 0}function _(I,v){var G=v.text(I,v);if(typeof G!="undefined")return G;if(v.list)return v.list=null,S(v);if(v.taskList){var Y=I.match(g,!0)[1]===" ";return Y?v.taskOpen=!0:v.taskClosed=!0,P.highlightFormatting&&(v.formatting="task"),v.taskList=!1,S(v)}if(v.taskOpen=!1,v.taskClosed=!1,v.header&&I.match(/^#+$/,!0))return P.highlightFormatting&&(v.formatting="header"),S(v);var re=I.next();if(v.linkTitle){v.linkTitle=!1;var oe=re;re==="("&&(oe=")"),oe=(oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var we="^\\s*(?:[^"+oe+"\\\\]+|\\\\\\\\|\\\\.)"+oe;if(I.match(new RegExp(we),!0))return K.linkHref}if(re==="`"){var pe=v.formatting;P.highlightFormatting&&(v.formatting="code"),I.eatWhile("`");var Ee=I.current().length;if(v.code==0&&(!v.quote||Ee==1))return v.code=Ee,S(v);if(Ee==v.code){var _e=S(v);return v.code=0,_e}else return v.formatting=pe,S(v)}else if(v.code)return S(v);if(re==="\\"&&(I.next(),P.highlightFormatting)){var Ae=S(v),fe=K.formatting+"-escape";return Ae?Ae+" "+fe:fe}if(re==="!"&&I.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return v.imageMarker=!0,v.image=!0,P.highlightFormatting&&(v.formatting="image"),S(v);if(re==="["&&v.imageMarker&&I.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return v.imageMarker=!1,v.imageAltText=!0,P.highlightFormatting&&(v.formatting="image"),S(v);if(re==="]"&&v.imageAltText){P.highlightFormatting&&(v.formatting="image");var Ae=S(v);return v.imageAltText=!1,v.image=!1,v.inline=v.f=E,Ae}if(re==="["&&!v.image)return v.linkText&&I.match(/^.*?\]/)||(v.linkText=!0,P.highlightFormatting&&(v.formatting="link")),S(v);if(re==="]"&&v.linkText){P.highlightFormatting&&(v.formatting="link");var Ae=S(v);return v.linkText=!1,v.inline=v.f=I.match(/\(.*?\)| ?\[.*?\]/,!1)?E:_,Ae}if(re==="<"&&I.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){v.f=v.inline=l,P.highlightFormatting&&(v.formatting="link");var Ae=S(v);return Ae?Ae+=" ":Ae="",Ae+K.linkInline}if(re==="<"&&I.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){v.f=v.inline=l,P.highlightFormatting&&(v.formatting="link");var Ae=S(v);return Ae?Ae+=" ":Ae="",Ae+K.linkEmail}if(P.xml&&re==="<"&&I.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=I.string.indexOf(">",I.pos);if(ue!=-1){var ie=I.string.substring(I.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(ie)&&(v.md_inside=!0)}return I.backUp(1),v.htmlState=le.startState(Q),c(I,v,O)}if(P.xml&&re==="<"&&I.match(/^\/\w*?>/))return v.md_inside=!1,"tag";if(re==="*"||re==="_"){for(var de=1,se=I.pos==1?" ":I.string.charAt(I.pos-2);de<3&&I.eat(re);)de++;var Re=I.peek()||" ",ke=!/\s/.test(Re)&&(!o.test(Re)||/\s/.test(se)||o.test(se)),Te=!/\s/.test(se)&&(!o.test(se)||/\s/.test(Re)||o.test(Re)),Ce=null,Le=null;if(de%2&&(!v.em&&ke&&(re==="*"||!Te||o.test(se))?Ce=!0:v.em==re&&Te&&(re==="*"||!ke||o.test(Re))&&(Ce=!1)),de>1&&(!v.strong&&ke&&(re==="*"||!Te||o.test(se))?Le=!0:v.strong==re&&Te&&(re==="*"||!ke||o.test(Re))&&(Le=!1)),Le!=null||Ce!=null){P.highlightFormatting&&(v.formatting=Ce==null?"strong":Le==null?"em":"strong em"),Ce===!0&&(v.em=re),Le===!0&&(v.strong=re);var _e=S(v);return Ce===!1&&(v.em=!1),Le===!1&&(v.strong=!1),_e}}else if(re===" "&&(I.eat("*")||I.eat("_"))){if(I.peek()===" ")return S(v);I.backUp(1)}if(P.strikethrough){if(re==="~"&&I.eatWhile(re)){if(v.strikethrough){P.highlightFormatting&&(v.formatting="strikethrough");var _e=S(v);return v.strikethrough=!1,_e}else if(I.match(/^[^\s]/,!1))return v.strikethrough=!0,P.highlightFormatting&&(v.formatting="strikethrough"),S(v)}else if(re===" "&&I.match(/^~~/,!0)){if(I.peek()===" ")return S(v);I.backUp(2)}}if(P.emoji&&re===":"&&I.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){v.emoji=!0,P.highlightFormatting&&(v.formatting="emoji");var Be=S(v);return v.emoji=!1,Be}return re===" "&&(I.match(/^ +$/,!1)?v.trailingSpace++:v.trailingSpace&&(v.trailingSpaceNewLine=!0)),S(v)}function l(I,v){var G=I.next();if(G===">"){v.f=v.inline=_,P.highlightFormatting&&(v.formatting="link");var Y=S(v);return Y?Y+=" ":Y="",Y+K.linkInline}return I.match(/^[^>]+/,!0),K.linkInline}function E(I,v){if(I.eatSpace())return null;var G=I.next();return G==="("||G==="["?(v.f=v.inline=b(G==="("?")":"]"),P.highlightFormatting&&(v.formatting="link-string"),v.linkHref=!0,S(v)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function b(I){return function(v,G){var Y=v.next();if(Y===I){G.f=G.inline=_,P.highlightFormatting&&(G.formatting="link-string");var re=S(G);return G.linkHref=!1,re}return v.match(m[I]),G.linkHref=!0,S(G)}}function N(I,v){return I.match(/^([^\]\\]|\\.)*\]:/,!1)?(v.f=D,I.next(),P.highlightFormatting&&(v.formatting="link"),v.linkText=!0,S(v)):u(I,v,_)}function D(I,v){if(I.match(/^\]:/,!0)){v.f=v.inline=B,P.highlightFormatting&&(v.formatting="link");var G=S(v);return v.linkText=!1,G}return I.match(/^([^\]\\]|\\.)+/,!0),K.linkText}function B(I,v){return I.eatSpace()?null:(I.match(/^[^\s]+/,!0),I.peek()===void 0?v.linkTitle=!0:I.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),v.f=v.inline=_,K.linkHref+" url")}var j={startState:function(){return{f:x,prevLine:{stream:null},thisLine:{stream:null},block:x,htmlState:null,indentation:0,inline:_,text:T,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(I){return{f:I.f,prevLine:I.prevLine,thisLine:I.thisLine,block:I.block,htmlState:I.htmlState&&le.copyState(Q,I.htmlState),indentation:I.indentation,localMode:I.localMode,localState:I.localMode?le.copyState(I.localMode,I.localState):null,inline:I.inline,text:I.text,formatting:!1,linkText:I.linkText,linkTitle:I.linkTitle,linkHref:I.linkHref,code:I.code,em:I.em,strong:I.strong,strikethrough:I.strikethrough,emoji:I.emoji,header:I.header,setext:I.setext,hr:I.hr,taskList:I.taskList,list:I.list,listStack:I.listStack.slice(0),quote:I.quote,indentedCode:I.indentedCode,trailingSpace:I.trailingSpace,trailingSpaceNewLine:I.trailingSpaceNewLine,md_inside:I.md_inside,fencedEndRE:I.fencedEndRE}},token:function(I,v){if(v.formatting=!1,I!=v.thisLine.stream){if(v.header=0,v.hr=!1,I.match(/^\s*$/,!0))return C(v),null;if(v.prevLine=v.thisLine,v.thisLine={stream:I},v.taskList=!1,v.trailingSpace=0,v.trailingSpaceNewLine=!1,!v.localState&&(v.f=v.block,v.f!=O)){var G=I.match(/^\s*/,!0)[0].replace(/\t/g,n).length;if(v.indentation=G,v.indentationDiff=null,G>0)return null}}return v.f(I,v)},innerMode:function(I){return I.block==O?{state:I.htmlState,mode:Q}:I.localState?{state:I.localState,mode:I.localMode}:{state:I,mode:j}},indent:function(I,v,G){return I.block==O&&Q.indent?Q.indent(I.htmlState,v,G):I.localState&&I.localMode.indent?I.localMode.indent(I.localState,v,G):le.Pass},blankLine:C,getType:S,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return j},"xml"),le.defineMIME("text/markdown","markdown"),le.defineMIME("text/x-markdown","markdown")})},osHv:function(ct,Qe,ne){(function(le){le(ne("VrN/"))})(function(le){"use strict";var Z=le.Pos;function P(o,n){return o.line-n.line||o.ch-n.ch}var Q="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",H=Q+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",F=new RegExp("<(/?)(["+Q+"]["+H+"]*)","g");function K(o,n,u,c){this.line=n,this.ch=u,this.cm=o,this.text=o.getLine(n),this.min=c?Math.max(c.from,o.firstLine()):o.firstLine(),this.max=c?Math.min(c.to-1,o.lastLine()):o.lastLine()}function W(o,n){var u=o.cm.getTokenTypeAt(Z(o.line,n));return u&&/\btag\b/.test(u)}function M(o){return o.line>=o.max?void 0:(o.ch=0,o.text=o.cm.getLine(++o.line),!0)}function R(o){return o.line<=o.min?void 0:(o.text=o.cm.getLine(--o.line),o.ch=o.text.length,!0)}function g(o){for(;;){var n=o.text.indexOf(">",o.ch);if(n==-1){if(M(o))continue;return}if(!W(o,n+1)){o.ch=n+1;continue}var u=o.text.lastIndexOf("/",n),c=u>-1&&!/\S/.test(o.text.slice(u+1,n));return o.ch=n+1,c?"selfClose":"regular"}}function p(o){for(;;){var n=o.ch?o.text.lastIndexOf("<",o.ch-1):-1;if(n==-1){if(R(o))continue;return}if(!W(o,n+1)){o.ch=n;continue}F.lastIndex=n,o.ch=n;var u=F.exec(o.text);if(u&&u.index==n)return u}}function f(o){for(;;){F.lastIndex=o.ch;var n=F.exec(o.text);if(!n){if(M(o))continue;return}if(!W(o,n.index+1)){o.ch=n.index+1;continue}return o.ch=n.index+n[0].length,n}}function h(o){for(;;){var n=o.ch?o.text.lastIndexOf(">",o.ch-1):-1;if(n==-1){if(R(o))continue;return}if(!W(o,n+1)){o.ch=n;continue}var u=o.text.lastIndexOf("/",n),c=u>-1&&!/\S/.test(o.text.slice(u+1,n));return o.ch=n+1,c?"selfClose":"regular"}}function s(o,n){for(var u=[];;){var c=f(o),L,C=o.line,x=o.ch-(c?c[0].length:0);if(!c||!(L=g(o)))return;if(L=="selfClose")continue;if(c[1]){for(var O=u.length-1;O>=0;--O)if(u[O]==c[2]){u.length=O;break}if(O<0&&(!n||n==c[2]))return{tag:c[2],from:Z(C,x),to:Z(o.line,o.ch)}}else u.push(c[2])}}function d(o,n){for(var u=[];;){var c=h(o);if(!c)return;if(c=="selfClose"){p(o);continue}var L=o.line,C=o.ch,x=p(o);if(!x)return;if(x[1])u.push(x[2]);else{for(var O=u.length-1;O>=0;--O)if(u[O]==x[2]){u.length=O;break}if(O<0&&(!n||n==x[2]))return{tag:x[2],from:Z(o.line,o.ch),to:Z(L,C)}}}}le.registerHelper("fold","xml",function(o,n){for(var u=new K(o,n.line,0);;){var c=f(u);if(!c||u.line!=n.line)return;var L=g(u);if(!L)return;if(!c[1]&&L!="selfClose"){var C=Z(u.line,u.ch),x=s(u,c[2]);return x&&P(x.from,C)>0?{from:C,to:x.from}:null}}}),le.findMatchingTag=function(o,n,u){var c=new K(o,n.line,n.ch,u);if(c.text.indexOf(">")==-1&&c.text.indexOf("<")==-1)return;var L=g(c),C=L&&Z(c.line,c.ch),x=L&&p(c);if(!L||!x||P(c,n)>0)return;var O={from:Z(c.line,c.ch),to:C,tag:x[2]};return L=="selfClose"?{open:O,close:null,at:"open"}:x[1]?{open:d(c,x[2]),close:O,at:"close"}:(c=new K(o,C.line,C.ch,u),{open:O,close:s(c,x[2]),at:"open"})},le.findEnclosingTag=function(o,n,u,c){for(var L=new K(o,n.line,n.ch,u);;){var C=d(L,c);if(!C)break;var x=new K(o,n.line,n.ch,u),O=s(x,C.tag);if(O)return{open:C,close:O}}},le.scanForClosingTag=function(o,n,u,c){var L=new K(o,n.line,n.ch,c?{from:0,to:c}:null);return s(L,u)}})},p5ED:function(ct,Qe,ne){"use strict";var le=ne("+L6B"),Z=ne("2/Rp"),P=ne("5Dmo"),Q=ne("3S7+"),H=ne("k1fw"),F=ne("tJVT"),K=ne("q1tI"),W=ne.n(K),M=ne("vHTk"),R=ne.n(M),g=ne("yEEn"),p=ne("ZW9T"),f=ne("1vsH");Qe.a=function(h){var s=h.name,d=h.data,o=h.theme,n=h.type,u=h.filename,c=h.monacoEditor,L=h.className,C=h.style,x=h.close,O=h.onClose,w=h.hasMask,S=Object(K.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),T=Object(F.a)(S,2),_=T[0],l=T[1],E=Object(K.useState)(""),m=Object(F.a)(E,2),b=m[0],N=m[1],D,B=1024*1024,j=10*B,I=Object(K.useRef)();n==="office"&&(D=Object(f.T)(d).filesize,D>j&&(n="other")),u&&(c.filename=u),Object(K.useEffect)(function(){var Y,re,oe=(Y=document.cookie)===null||Y===void 0||((re=Y.replace(/\s/g,""))===null||re===void 0)?void 0:re.split(";");oe==null||oe.map(function(we){var pe=we.split("=");pe[0]==="_educoder_session"&&N(pe[1])})},[]);var v=function(){if(d.startsWith("http")||d.startsWith("/")){G();return}Object(f.z)(u||"educoder",d,u)},G=function(){Object(f.x)(u||s,d)};return console.log("data:",d,"fileanme:",u," name:",s),W.a.createElement("div",{style:Object(H.a)({},C||{}),className:"".concat(w&&R.a.bgBlack," ").concat(n?R.a.wrp:"hide")},x&&W.a.createElement("div",{className:R.a.close,ref:I},W.a.createElement(Q.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return I.current}},W.a.createElement("span",{onClick:G},W.a.createElement("i",{className:"icon-quxiaozhiding"}))),W.a.createElement(Q.a,{title:"\u5173\u95ED",getPopupContainer:function(){return I.current}},W.a.createElement("span",{className:"",onClick:O},W.a.createElement("i",{className:"icon-guanbi1"})))),W.a.createElement("div",{className:"".concat(R.a[L]," ").concat(L," ").concat(R.a.monaco," ").concat(n==="txt"?"show":"hide")},n==="txt"&&W.a.createElement(p.b,c)),n==="audio"&&W.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}),n==="video"&&W.a.createElement(W.a.Fragment,null,d!=null&&d.startsWith("/")?W.a.createElement("video",{controls:!0,src:"".concat(d),autoPlay:!0}):W.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(d),autoPlay:!0})),n==="html"&&W.a.createElement("iframe",{src:d+"&disposition=inline"}),n==="pdf"&&W.a.createElement("embed",{className:R.a.embed,src:d}),n==="image"&&W.a.createElement(W.a.Fragment,null,W.a.createElement("img",{src:"".concat(d!=null&&d.startsWith("/")||(d==null?void 0:d.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(d)})),n==="other"&&W.a.createElement("div",null,W.a.createElement(Z.a,{type:"primary",size:"large",onClick:v},W.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(n==="download"||n==="office")&&W.a.createElement(Z.a,{type:"primary",size:"large",onClick:v},W.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ct,Qe,ne){},psGv:function(ct,Qe,ne){var le,Z;(function(){var P;(function(){"use strict";var K=[,,function(g){function p(s){this.__parent=s,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}p.prototype.clone_empty=function(){var s=new p(this.__parent);return s.set_indent(this.__indent_count,this.__alignment_count),s},p.prototype.item=function(s){return s<0?this.__items[this.__items.length+s]:this.__items[s]},p.prototype.has_match=function(s){for(var d=this.__items.length-1;d>=0;d--)if(this.__items[d].match(s))return!0;return!1},p.prototype.set_indent=function(s,d){this.is_empty()&&(this.__indent_count=s||0,this.__alignment_count=d||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},p.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},p.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},p.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var s=this.__parent.current_line;return s.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),s.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),s.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,s.__items[0]===" "&&(s.__items.splice(0,1),s.__character_count-=1),!0}return!1},p.prototype.is_empty=function(){return this.__items.length===0},p.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},p.prototype.push=function(s){this.__items.push(s);var d=s.lastIndexOf(` `);d!==-1?this.__character_count=s.length-d:this.__character_count+=s.length},p.prototype.pop=function(){var s=null;return this.is_empty()||(s=this.__items.pop(),this.__character_count-=s.length),s},p.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},p.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},p.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},p.prototype.toString=function(){var s="";return this.is_empty()?this.__parent.indent_empty_lines&&(s=this.__parent.get_indent_string(this.__indent_count)):(s=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),s+=this.__items.join("")),s};function f(s,d){this.__cache=[""],this.__indent_size=s.indent_size,this.__indent_string=s.indent_char,s.indent_with_tabs||(this.__indent_string=new Array(s.indent_size+1).join(s.indent_char)),d=d||"",s.indent_level>0&&(d=new Array(s.indent_level+1).join(this.__indent_string)),this.__base_string=d,this.__base_string_length=d.length}f.prototype.get_indent_size=function(s,d){var o=this.__base_string_length;return d=d||0,s<0&&(o=0),o+=s*this.__indent_size,o+=d,o},f.prototype.get_indent_string=function(s,d){var o=this.__base_string;return d=d||0,s<0&&(s=0,o=""),d+=s*this.__indent_size,this.__ensure_cache(d),o+=this.__cache[d],o},f.prototype.__ensure_cache=function(s){for(;s>=this.__cache.length;)this.__add_column()},f.prototype.__add_column=function(){var s=this.__cache.length,d=0,o="";this.__indent_size&&s>=this.__indent_size&&(d=Math.floor(s/this.__indent_size),s-=d*this.__indent_size,o=new Array(d+1).join(this.__indent_string)),s&&(o+=new Array(s+1).join(" ")),this.__cache.push(o)};function h(s,d){this.__indent_cache=new f(s,d),this.raw=!1,this._end_with_newline=s.end_with_newline,this.indent_size=s.indent_size,this.wrap_line_length=s.wrap_line_length,this.indent_empty_lines=s.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new p(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}h.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},h.prototype.get_line_number=function(){return this.__lines.length},h.prototype.get_indent_string=function(s,d){return this.__indent_cache.get_indent_string(s,d)},h.prototype.get_indent_size=function(s,d){return this.__indent_cache.get_indent_size(s,d)},h.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},h.prototype.add_new_line=function(s){return this.is_empty()||!s&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},h.prototype.get_code=function(s){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 s!==` `&&(o=o.replace(/[\n]/g,s)),o},h.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},h.prototype.set_indent=function(s,d){return s=s||0,d=d||0,this.next_line.set_indent(s,d),this.__lines.length>1?(this.current_line.set_indent(s,d),!0):(this.current_line.set_indent(),!1)},h.prototype.add_raw_token=function(s){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},h.prototype.just_added_newline=function(){return this.current_line.is_empty()},h.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},h.prototype.ensure_empty_line_above=function(s,d){for(var o=this.__lines.length-2;o>=0;){var n=this.__lines[o];if(n.is_empty())break;if(n.item(0).indexOf(s)!==0&&n.item(-1)!==d){this.__lines.splice(o+1,0,new p(this)),this.previous_line=this.__lines[this.__lines.length-2];break}o--}},g.exports.Output=h},function(g){function p(f,h,s,d){this.type=f,this.text=h,this.comments_before=null,this.newlines=s||0,this.whitespace_before=d||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}g.exports.Token=p},,,function(g){function p(s,d){this.raw_options=f(s,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"])}p.prototype._get_array=function(s,d){var o=this.raw_options[s],n=d||[];return typeof o=="object"?o!==null&&typeof o.concat=="function"&&(n=o.concat()):typeof o=="string"&&(n=o.split(/[^a-zA-Z0-9_\/\-]+/)),n},p.prototype._get_boolean=function(s,d){var o=this.raw_options[s],n=o===void 0?!!d:!!o;return n},p.prototype._get_characters=function(s,d){var o=this.raw_options[s],n=d||"";return typeof o=="string"&&(n=o.replace(/\\r/,"\r").replace(/\\n/,` `).replace(/\\t/," ")),n},p.prototype._get_number=function(s,d){var o=this.raw_options[s];d=parseInt(d,10),isNaN(d)&&(d=0);var n=parseInt(o,10);return isNaN(n)&&(n=d),n},p.prototype._get_selection=function(s,d,o){var n=this._get_selection_list(s,d,o);if(n.length!==1)throw new Error("Invalid Option Value: The option '"+s+`' can only be one of the following values: `+d+` You passed in: '`+this.raw_options[s]+"'");return n[0]},p.prototype._get_selection_list=function(s,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 n=this._get_array(s,o);if(!this._is_valid_selection(n,d))throw new Error("Invalid Option Value: The option '"+s+`' can contain only the following values: `+d+` You passed in: '`+this.raw_options[s]+"'");return n},p.prototype._is_valid_selection=function(s,d){return s.length&&d.length&&!s.some(function(o){return d.indexOf(o)===-1})};function f(s,d){var o={};s=h(s);var n;for(n in s)n!==d&&(o[n]=s[n]);if(d&&s[d])for(n in s[d])o[n]=s[d][n];return o}function h(s){var d={},o;for(o in s){var n=o.replace(/-/g,"_");d[n]=s[o]}return d}g.exports.Options=p,g.exports.normalizeOpts=h,g.exports.mergeOpts=f},,function(g){var p=RegExp.prototype.hasOwnProperty("sticky");function f(h){this.__input=h||"",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&&h=0&&s=h.length&&this.__input.substring(s-h.length,s).toLowerCase()===h},g.exports.InputScanner=f},function(g,p,f){var h=f(8).InputScanner,s=f(3).Token,d=f(10).TokenStream,o=f(11).WhitespacePattern,n={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},u=function(c,L){this._input=new h(c),this._options=L||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new o(this._input)};u.prototype.tokenize=function(){this._input.restart(),this.__tokens=new d,this._reset();for(var c,L=new s(n.START,""),C=null,x=[],O=new d;L.type!==n.EOF;){for(c=this._get_next_token(L,C);this._is_comment(c);)O.add(c),c=this._get_next_token(L,C);O.isEmpty()||(c.comments_before=O,O=new d),c.parent=C,this._is_opening(c)?(x.push(C),C=c):C&&this._is_closing(c,C)&&(c.opened=C,C.closed=c,C=x.pop(),c.parent=C),c.previous=L,L.next=c,this.__tokens.add(c),L=c}return this.__tokens},u.prototype._is_first_token=function(){return this.__tokens.isEmpty()},u.prototype._reset=function(){},u.prototype._get_next_token=function(c,L){this._readWhitespace();var C=this._input.read(/.+/g);return C?this._create_token(n.RAW,C):this._create_token(n.EOF,"")},u.prototype._is_comment=function(c){return!1},u.prototype._is_opening=function(c){return!1},u.prototype._is_closing=function(c,L){return!1},u.prototype._create_token=function(c,L){var C=new s(c,L,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return C},u.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},g.exports.Tokenizer=u,g.exports.TOKEN=n},function(g){function p(f){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=f}p.prototype.restart=function(){this.__position=0},p.prototype.isEmpty=function(){return this.__tokens_length===0},p.prototype.hasNext=function(){return this.__position=0&&f/),erb:u.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:u.starting_with(/{%/).until_after(/%}/),django_value:u.starting_with(/{{/).until_after(/}}/),django_comment:u.starting_with(/{#/).until_after(/#}/),smarty:u.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:u.starting_with(/{\*/).until_after(/\*}/),smarty_literal:u.starting_with(/{literal}/).until_after(/{\/literal}/)}}d.prototype=new h,d.prototype._create=function(){return new d(this._input,this)},d.prototype._update=function(){this.__set_templated_pattern()},d.prototype.disable=function(o){var n=this._create();return n._disabled[o]=!0,n._update(),n},d.prototype.read_options=function(o){var n=this._create();for(var u in s)n._disabled[u]=o.templating.indexOf(u)===-1;return n._update(),n},d.prototype.exclude=function(o){var n=this._create();return n._excluded[o]=!0,n._update(),n},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 n=this._read_template();n;)this._match_pattern?n+=this._input.read(this._match_pattern):n+=this._input.readUntil(this.__template_pattern),o+=n,n=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="",n=this._input.peek();if(n==="<"){var u=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&u==="?"&&(o=o||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&u==="%"&&(o=o||this.__patterns.erb.read())}else n==="{"&&(!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},g.exports.TemplatablePattern=d},,,,function(g,p,f){var h=f(19).Beautifier,s=f(20).Options;function d(o,n,u,c){var L=new h(o,n,u,c);return L.beautify()}g.exports=d,g.exports.defaultOptions=function(){return new s}},function(g,p,f){var h=f(20).Options,s=f(2).Output,d=f(21).Tokenizer,o=f(21).TOKEN,n=/\r\n|[\r\n]/,u=/\r\n|[\r\n]/g,c=function(E,m){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=E.max_preserve_newlines,this.preserve_newlines=E.preserve_newlines,this._output=new s(E,m)};c.prototype.current_line_has_match=function(E){return this._output.current_line.has_match(E)},c.prototype.set_space_before_token=function(E,m){this._output.space_before_token=E,this._output.non_breaking_space=m},c.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},c.prototype.add_raw_token=function(E){this._output.add_raw_token(E)},c.prototype.print_preserved_newlines=function(E){var m=0;E.type!==o.TEXT&&E.previous.type!==o.TEXT&&(m=E.newlines?1:0),this.preserve_newlines&&(m=E.newlines0);return m!==0},c.prototype.traverse_whitespace=function(E){return E.whitespace_before||E.newlines?(this.print_preserved_newlines(E)||(this._output.space_before_token=!0),!0):!1},c.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},c.prototype.print_newline=function(E){this._output.add_new_line(E)},c.prototype.print_token=function(E){E.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(E.text))},c.prototype.indent=function(){this.indent_level++},c.prototype.get_full_indent=function(E){return E=this.indent_level+(E||0),E<1?"":this._output.get_indent_string(E)};var L=function(E){for(var m=null,b=E.next;b.type!==o.EOF&&E.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&&(m=b.next.next.text);break}b=b.next}return m},C=function(E,m){var b=null,N=null;return m.closed?(E==="script"?b="text/javascript":E==="style"&&(b="text/css"),b=L(m)||b,b.search("text/css")>-1?N="css":b.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?N="javascript":b.search(/(text|application|dojo)\/(x-)?(html)/)>-1?N="html":b.search(/test\/null/)>-1&&(N="null"),N):null};function x(E,m){return m.indexOf(E)!==-1}function O(E,m,b){this.parent=E||null,this.tag=m?m.tag_name:"",this.indent_level=b||0,this.parser_token=m||null}function w(E){this._printer=E,this._current_frame=null}w.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},w.prototype.record_tag=function(E){var m=new O(this._current_frame,E,this._printer.indent_level);this._current_frame=m},w.prototype._try_pop_frame=function(E){var m=null;return E&&(m=E.parser_token,this._printer.indent_level=E.indent_level,this._current_frame=E.parent),m},w.prototype._get_frame=function(E,m){for(var b=this._current_frame;b&&!(E.indexOf(b.tag)!==-1);){if(m&&m.indexOf(b.tag)!==-1){b=null;break}b=b.parent}return b},w.prototype.try_pop=function(E,m){var b=this._get_frame([E],m);return this._try_pop_frame(b)},w.prototype.indent_to_tag=function(E){var m=this._get_frame(E);m&&(this._printer.indent_level=m.indent_level)};function S(E,m,b,N){this._source_text=E||"",m=m||{},this._js_beautify=b,this._css_beautify=N,this._tag_stack=null;var D=new h(m,"html");this._options=D,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"}S.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var E=this._source_text,m=this._options.eol;this._options.eol==="auto"&&(m=` `,E&&n.test(E)&&(m=E.match(n)[0])),E=E.replace(u,` `);var b=E.match(/^[\t ]*/)[0],N={text:"",type:""},D=new T,B=new c(this._options,b),j=new d(E,this._options).tokenize();this._tag_stack=new w(B);for(var I=null,v=j.next();v.type!==o.EOF;)v.type===o.TAG_OPEN||v.type===o.COMMENT?(I=this._handle_tag_open(B,v,D,N),D=I):v.type===o.ATTRIBUTE||v.type===o.EQUALS||v.type===o.VALUE||v.type===o.TEXT&&!D.tag_complete?I=this._handle_inside_tag(B,v,D,j):v.type===o.TAG_CLOSE?I=this._handle_tag_close(B,v,D):v.type===o.TEXT?I=this._handle_text(B,v,D):B.add_raw_token(v),N=I,v=j.next();var G=B._output.get_code(m);return G},S.prototype._handle_tag_close=function(E,m,b){var N={text:m.text,type:m.type};return E.alignment_size=0,b.tag_complete=!0,E.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),b.is_unformatted?E.add_raw_token(m):(b.tag_start_char==="<"&&(E.set_space_before_token(m.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&b.has_wrapped_attrs&&E.print_newline(!1)),E.print_token(m)),b.indent_content&&!(b.is_unformatted||b.is_content_unformatted)&&(E.indent(),b.indent_content=!1),!b.is_inline_element&&!(b.is_unformatted||b.is_content_unformatted)&&E.set_wrap_point(),N},S.prototype._handle_inside_tag=function(E,m,b,N){var D=b.has_wrapped_attrs,B={text:m.text,type:m.type};if(E.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),b.is_unformatted)E.add_raw_token(m);else if(b.tag_start_char==="{"&&m.type===o.TEXT)E.print_preserved_newlines(m)?(m.newlines=0,E.add_raw_token(m)):E.print_token(m);else{if(m.type===o.ATTRIBUTE?(E.set_space_before_token(!0),b.attr_count+=1):(m.type===o.EQUALS||m.type===o.VALUE&&m.previous.type===o.EQUALS)&&E.set_space_before_token(!1),m.type===o.ATTRIBUTE&&b.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(E.traverse_whitespace(m),D=D||m.newlines!==0),this._is_wrap_attributes_force)){var j=b.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&b.attr_count===1){var I=!0,v=0,G;do{if(G=N.peek(v),G.type===o.ATTRIBUTE){I=!1;break}v+=1}while(v<4&&G.type!==o.EOF&&G.type!==o.TAG_CLOSE);j=!I}j&&(E.print_newline(!1),D=!0)}E.print_token(m),D=D||E.previous_token_wrapped(),b.has_wrapped_attrs=D}return B},S.prototype._handle_text=function(E,m,b){var N={text:m.text,type:"TK_CONTENT"};return b.custom_beautifier_name?this._print_custom_beatifier_text(E,m,b):b.is_unformatted||b.is_content_unformatted?E.add_raw_token(m):(E.traverse_whitespace(m),E.print_token(m)),N},S.prototype._print_custom_beatifier_text=function(E,m,b){var N=this;if(m.text!==""){var D=m.text,B,j=1,I="",v="";b.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?B=this._js_beautify:b.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?B=this._css_beautify:b.custom_beautifier_name==="html"&&(B=function(pe,Ee){var _e=new S(pe,Ee,N._js_beautify,N._css_beautify);return _e.beautify()}),this._options.indent_scripts==="keep"?j=0:this._options.indent_scripts==="separate"&&(j=-E.indent_level);var G=E.get_full_indent(j);if(D=D.replace(/\n[ \t]*$/,""),b.custom_beautifier_name!=="html"&&D[0]==="<"&&D.match(/^(|]]>)$/.exec(D);if(!Y){E.add_raw_token(m);return}I=G+Y[1]+` `,D=Y[4],Y[5]&&(v=G+Y[5]),D=D.replace(/\n[ \t]*$/,""),(Y[2]||Y[3].indexOf(` `)!==-1)&&(Y=Y[3].match(/[ \t]+$/),Y&&(m.whitespace_before=Y[0]))}if(D)if(B){var re=function(){this.eol=` `};re.prototype=this._options.raw_options;var oe=new re;D=B(G+D,oe)}else{var we=m.whitespace_before;we&&(D=D.replace(new RegExp(` (`+we+")?","g"),` `)),D=G+D.replace(/\n/g,` `+G)}I&&(D?D=I+D+` `+v:D=I+v),E.print_newline(!1),D&&(m.text=D,m.whitespace_before="",m.newlines=0,E.add_raw_token(m),E.print_newline(!0))}},S.prototype._handle_tag_open=function(E,m,b,N){var D=this._get_tag_open_token(m);return(b.is_unformatted||b.is_content_unformatted)&&!b.is_empty_element&&m.type===o.TAG_OPEN&&m.text.indexOf("]*)/),this.tag_check=b?b[1]:""):(b=m.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=b?b[1]:"",(m.text.startsWith("{{#>")||m.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&m.next!==null?this.tag_check=m.next.text.split(" ")[0]:this.tag_check=m.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),m.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||m.closed&&m.closed.text==="/>";var N=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(N=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(N)))}};S.prototype._get_tag_open_token=function(E){var m=new T(this._tag_stack.get_parser_token(),E);return m.alignment_size=this._options.wrap_attributes_indent_size,m.is_end_tag=m.is_end_tag||x(m.tag_check,this._options.void_elements),m.is_empty_element=m.tag_complete||m.is_start_tag&&m.is_end_tag,m.is_unformatted=!m.tag_complete&&x(m.tag_check,this._options.unformatted),m.is_content_unformatted=!m.is_empty_element&&x(m.tag_check,this._options.content_unformatted),m.is_inline_element=x(m.tag_name,this._options.inline)||m.tag_name.includes("-")||m.tag_start_char==="{",m},S.prototype._set_tag_position=function(E,m,b,N,D){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||E.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=C(b.tag_check,m)))),x(b.tag_check,this._options.extra_liners)&&(E.print_newline(!1),E._output.just_added_blankline()||E.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 B=E.current_line_has_match(/{{#if/);B||E.print_newline(!1)}b.tag_name==="!--"&&D.type===o.TAG_CLOSE&&N.is_end_tag&&b.text.indexOf(` `)===-1||(b.is_inline_element||b.is_unformatted||E.print_newline(!1),this._calcluate_parent_multiline(E,b))}else if(b.is_end_tag){var j=!1;j=b.start_tag_token&&b.start_tag_token.multiline_content,j=j||!b.is_inline_element&&!(N.is_inline_element||N.is_unformatted)&&!(D.type===o.TAG_CLOSE&&b.start_tag_token===N)&&D.type!=="TK_CONTENT",(b.is_content_unformatted||b.is_unformatted)&&(j=!1),j&&E.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)&&(D.type!=="TK_CONTENT"||b.is_content_unformatted)&&E.print_newline(!1),this._calcluate_parent_multiline(E,b)},S.prototype._calcluate_parent_multiline=function(E,m){m.parent&&E._output.just_added_newline()&&!((m.is_inline_element||m.is_unformatted)&&m.parent.is_inline_element)&&(m.parent.multiline_content=!0)};var _=["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"],l=["a","audio","del","ins","map","noscript","video"];S.prototype._do_optional_end_element=function(E){var m=null;if(E.is_empty_element||!E.is_start_tag||!E.parent)return;if(E.tag_name==="body")m=m||this._tag_stack.try_pop("head");else if(E.tag_name==="li")m=m||this._tag_stack.try_pop("li",["ol","ul"]);else if(E.tag_name==="dd"||E.tag_name==="dt")m=m||this._tag_stack.try_pop("dt",["dl"]),m=m||this._tag_stack.try_pop("dd",["dl"]);else if(E.parent.tag_name==="p"&&_.indexOf(E.tag_name)!==-1){var b=E.parent.parent;(!b||l.indexOf(b.tag_name)===-1)&&(m=m||this._tag_stack.try_pop("p"))}else E.tag_name==="rp"||E.tag_name==="rt"?(m=m||this._tag_stack.try_pop("rt",["ruby","rtc"]),m=m||this._tag_stack.try_pop("rp",["ruby","rtc"])):E.tag_name==="optgroup"?m=m||this._tag_stack.try_pop("optgroup",["select"]):E.tag_name==="option"?m=m||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):E.tag_name==="colgroup"?m=m||this._tag_stack.try_pop("caption",["table"]):E.tag_name==="thead"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"])):E.tag_name==="tbody"||E.tag_name==="tfoot"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"]),m=m||this._tag_stack.try_pop("thead",["table"]),m=m||this._tag_stack.try_pop("tbody",["table"])):E.tag_name==="tr"?(m=m||this._tag_stack.try_pop("caption",["table"]),m=m||this._tag_stack.try_pop("colgroup",["table"]),m=m||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(E.tag_name==="th"||E.tag_name==="td")&&(m=m||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),m=m||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return E.parent=this._tag_stack.get_parser_token(),m},g.exports.Beautifier=S},function(g,p,f){var h=f(6).Options;function s(d){h.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"])}s.prototype=new h,g.exports.Options=s},function(g,p,f){var h=f(9).Tokenizer,s=f(9).TOKEN,d=f(13).Directives,o=f(14).TemplatablePattern,n=f(12).Pattern,u={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:s.START,RAW:s.RAW,EOF:s.EOF},c=new d(/<\!--/,/-->/),L=function(C,x){h.call(this,C,x),this._current_tag_name="";var O=new o(this._input).read_options(this._options),w=new n(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:w.starting_with(/{{!--/).until_after(/--}}/),handlebars:w.starting_with(/{{/).until_after(/}}/),handlebars_open:w.until(/[\n\r\t }]/),handlebars_raw_close:w.until(/}}/),comment:w.starting_with(//),cdata:w.starting_with(//),conditional_comment:w.starting_with(//),processing:w.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 S=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=w.matching(S).until_after(S)}};L.prototype=new h,L.prototype._is_comment=function(C){return!1},L.prototype._is_opening=function(C){return C.type===u.TAG_OPEN},L.prototype._is_closing=function(C,x){return C.type===u.TAG_CLOSE&&x&&((C.text===">"||C.text==="/>")&&x.text[0]==="<"||C.text==="}}"&&x.text[0]==="{"&&x.text[1]==="{")},L.prototype._reset=function(){this._current_tag_name=""},L.prototype._get_next_token=function(C,x){var O=null;this._readWhitespace();var w=this._input.peek();return w===null?this._create_token(u.EOF,""):(O=O||this._read_open_handlebars(w,x),O=O||this._read_attribute(w,C,x),O=O||this._read_close(w,x),O=O||this._read_raw_content(w,C,x),O=O||this._read_content_word(w),O=O||this._read_comment_or_cdata(w),O=O||this._read_processing(w),O=O||this._read_open(w,x),O=O||this._create_token(u.UNKNOWN,this._input.next()),O)},L.prototype._read_comment_or_cdata=function(C){var x=null,O=null,w=null;if(C==="<"){var S=this._input.peek(1);S==="!"&&(O=this.__patterns.comment.read(),O?(w=c.get_directives(O),w&&w.ignore==="start"&&(O+=c.readIgnored(this._input))):O=this.__patterns.cdata.read()),O&&(x=this._create_token(u.COMMENT,O),x.directives=w)}return x},L.prototype._read_processing=function(C){var x=null,O=null,w=null;if(C==="<"){var S=this._input.peek(1);(S==="!"||S==="?")&&(O=this.__patterns.conditional_comment.read(),O=O||this.__patterns.processing.read()),O&&(x=this._create_token(u.COMMENT,O),x.directives=w)}return x},L.prototype._read_open=function(C,x){var O=null,w=null;return x||C==="<"&&(O=this._input.next(),this._input.peek()==="/"&&(O+=this._input.next()),O+=this.__patterns.element_name.read(),w=this._create_token(u.TAG_OPEN,O)),w},L.prototype._read_open_handlebars=function(C,x){var O=null,w=null;return x||this._options.indent_handlebars&&C==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(O=this.__patterns.handlebars_comment.read(),O=O||this.__patterns.handlebars.read(),w=this._create_token(u.COMMENT,O)):(O=this.__patterns.handlebars_open.read(),w=this._create_token(u.TAG_OPEN,O))),w},L.prototype._read_close=function(C,x){var O=null,w=null;return x&&(x.text[0]==="<"&&(C===">"||C==="/"&&this._input.peek(1)===">")?(O=this._input.next(),C==="/"&&(O+=this._input.next()),w=this._create_token(u.TAG_CLOSE,O)):x.text[0]==="{"&&C==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),w=this._create_token(u.TAG_CLOSE,"}}"))),w},L.prototype._read_attribute=function(C,x,O){var w=null,S="";if(O&&O.text[0]==="<")if(C==="=")w=this._create_token(u.EQUALS,this._input.next());else if(C==='"'||C==="'"){var T=this._input.next();C==='"'?T+=this.__patterns.double_quote.read():T+=this.__patterns.single_quote.read(),w=this._create_token(u.VALUE,T)}else S=this.__patterns.attribute.read(),S&&(x.type===u.EQUALS?w=this._create_token(u.VALUE,S):w=this._create_token(u.ATTRIBUTE,S));return w},L.prototype._is_content_unformatted=function(C){return this._options.void_elements.indexOf(C)===-1&&(this._options.content_unformatted.indexOf(C)!==-1||this._options.unformatted.indexOf(C)!==-1)},L.prototype._read_raw_content=function(C,x,O){var w="";if(O&&O.text[0]==="{")w=this.__patterns.handlebars_raw_close.read();else if(x.type===u.TAG_CLOSE&&x.opened.text[0]==="<"&&x.text[0]!=="/"){var S=x.opened.text.substr(1).toLowerCase();if(S==="script"||S==="style"){var T=this._read_comment_or_cdata(C);if(T)return T.type=u.TEXT,T;w=this._input.readUntil(new RegExp("","ig"))}else this._is_content_unformatted(S)&&(w=this._input.readUntil(new RegExp("","ig")))}return w?this._create_token(u.TEXT,w):null},L.prototype._read_content_word=function(C){var x="";if(this._options.unformatted_content_delimiter&&(C===this._options.unformatted_content_delimiter[0]&&(x=this.__patterns.unformatted_content_delimiter.read())),x||(x=this.__patterns.word.read()),x)return this._create_token(u.TEXT,x)},g.exports.Tokenizer=L,g.exports.TOKEN=u}],W={};function M(g){var p=W[g];if(p!==void 0)return p.exports;var f=W[g]={exports:{}};return K[g](f,f.exports,M),f.exports}var R=M(18);P=R})();var Q=P;if(!0)!(le=[ne,ne("6UM0"),ne("TXwP")],Z=function(K){var W=ne("6UM0"),M=ne("TXwP");return{html_beautify:function(R,g){return Q(R,g,W.js_beautify,M.css_beautify)}}}.apply(Qe,le),Z!==void 0&&(ct.exports=Z));else var H,F})()},"rAM+":function(ct,Qe,ne){"use strict";ne.d(Qe,"a",function(){return Z});var le=ne("Qw5x");function Z(P,Q){var H;if(typeof Symbol=="undefined"||P[Symbol.iterator]==null){if(Array.isArray(P)||(H=Object(le.a)(P))||Q&&P&&typeof P.length=="number"){H&&(P=H);var F=0,K=function(){};return{s:K,n:function(){return F>=P.length?{done:!0}:{done:!1,value:P[F++]}},e:function(p){throw p},f:K}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var W=!0,M=!1,R;return{s:function(){H=P[Symbol.iterator]()},n:function(){var p=H.next();return W=p.done,p},e:function(p){M=!0,R=p},f:function(){try{!W&&H.return!=null&&H.return()}finally{if(M)throw R}}}}},rUJ1:function(ct,Qe){const ne=/[&<>"']/,le=/[&<>"']/g,Z=/[<>"']|&(?!#?\w+;)/,P=/[<>"']|&(?!#?\w+;)/g,Q={"&":"&","<":"<",">":">",'"':""","'":"'"},H=w=>Q[w];function F(w,S){if(S){if(ne.test(w))return w.replace(le,H)}else if(Z.test(w))return w.replace(P,H);return w}const K=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function W(w){return w.replace(K,(S,T)=>(T=T.toLowerCase(),T==="colon"?":":T.charAt(0)==="#"?T.charAt(1)==="x"?String.fromCharCode(parseInt(T.substring(2),16)):String.fromCharCode(+T.substring(1)):""))}const M=/(^|[^\[])\^/g;function R(w,S){w=w.source||w,S=S||"";const T={replace:(_,l)=>(l=l.source||l,l=l.replace(M,"$1"),w=w.replace(_,l),T),getRegex:()=>new RegExp(w,S)};return T}const g=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(w,S,T){if(w){let _;try{_=decodeURIComponent(W(T)).replace(g,"").toLowerCase()}catch(l){return null}if(_.indexOf("javascript:")===0||_.indexOf("vbscript:")===0||_.indexOf("data:")===0)return null}S&&!p.test(T)&&(T=n(S,T));try{T=encodeURI(T).replace(/%25/g,"%")}catch(_){return null}return T}const h={},s=/^[^:]+:\/*[^/]*$/,d=/^([^:]+:)[\s\S]*$/,o=/^([^:]+:\/*[^/]*)[\s\S]*$/;function n(w,S){h[" "+w]||(s.test(w)?h[" "+w]=w+"/":h[" "+w]=C(w,"/",!0)),w=h[" "+w];const T=w.indexOf(":")===-1;return S.substring(0,2)==="//"?T?S:w.replace(d,"$1")+S:S.charAt(0)==="/"?T?S:w.replace(o,"$1")+S:w+S}const u={exec:function(){}};function c(w){let S=1,T,_;for(;S{let N=!1,D=m;for(;--D>=0&&b[D]==="\\";)N=!N;return N?"|":" |"}),_=T.split(/ \|/);let l=0;if(_.length>S)_.splice(S);else for(;_.lengthde.max_num)){We.next=3;break}return o.b.info("\u6700\u5927\u4EBA\u6570\u4E0D\u80FD\u5C0F\u4E8E\u6700\u5C0F\u4EBA\u6570"),We.abrupt("return");case 3:return Xe=Object(s.a)({},de),Xe.attachment_ids&&(Xe.attachment_ids=Xe==null||((ot=Xe.attachment_ids)===null||ot===void 0)?void 0:ot.map(function(Se){return Se.response.id})),Xe.reference_attachment_ids&&(Xe.reference_attachment_ids=Xe==null||((et=Xe.reference_attachment_ids)===null||et===void 0)?void 0:et.map(function(Se){return Se.response.id})),rt=Ee.params,Ne=rt.coursesId,ut=rt.categoryId,We.next=9,Object(E.a)(Object(s.a)(Object(s.a)({coursesId:Ne,category:ut},Xe),{},{type:3}));case 9:tt=We.sent,tt.status===0&&(Me(tt.homework_id),Object(_.cb)(["\u6559\u5B66\u8BFE\u5802","\u5206\u7EC4\u4F5C\u4E1A","\u65B0\u5EFA\u5206\u7EC4\u4F5C\u4E1A"]),S.d.push("/classrooms/".concat(Ne,"/group_homework/").concat(tt.homework_id,"/detail")));case 11:case"end":return We.stop()}},$e)}));return function(Ze){return Ve.apply(this,arguments)}}();function Me(Ve){return Ue.apply(this,arguments)}function Ue(){return Ue=Object(n.a)(x.a.mark(function Ve($e){var Ze;return x.a.wrap(function(ot){for(;;)switch(ot.prev=ot.next){case 0:if(Le!=null&&Le.ec_point_ids){ot.next=2;break}return ot.abrupt("return");case 2:return ot.next=4,Object(B.a)("/api/ec_courses/".concat(Le==null?void 0:Le.ec_course_id,"/ec_points/set_work_points.json"),{method:"post",body:Object(s.a)({homework_common_id:$e},Le)});case 4:Ze=ot.sent;case 5:case"end":return ot.stop()}},Ve)})),Ue.apply(this,arguments)}return w.a.createElement("section",{className:b.a.bg},ke.course_name&&w.a.createElement("section",{className:"animated fadeIn"},w.a.createElement("aside",{className:"mt10"},ke.category&&w.a.createElement(h.a,{separator:">"},w.a.createElement(h.a.Item,null,w.a.createElement(T.a,{to:"/classrooms/".concat(ke.course_id,"/group_homework")},ke.course_name)),w.a.createElement(h.a.Item,null,w.a.createElement(T.a,{to:"/classrooms/".concat(ke.course_id,"/group_homework")},ke.category.category_name)),w.a.createElement(h.a.Item,null,"\u65B0\u5EFA\u8BE6\u60C5")))),w.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u65B0\u5EFA\u5206\u7EC4\u4F5C\u4E1A"),w.a.createElement(c.a,{form:fe,className:b.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){se(Object(s.a)({},fe.getFieldsValue()))},initialValues:{base_on_project:!1},onFinish:Fe},w.a.createElement("div",{className:b.a.fieldWrap},w.a.createElement(c.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},w.a.createElement(p.a,{maxLength:60,suffix:"".concat(((G=de.name)===null||G===void 0?void 0:G.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),w.a.createElement("div",{className:b.a.mdWrap},w.a.createElement(c.a.Item,{name:"description",label:"\u5185\u5BB9:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:5e3,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"}]},w.a.createElement(l.a,{watch:!0,defaultValue:de.intro})),w.a.createElement("div",null,w.a.createElement(c.a.Item,{name:"attachment_ids"},w.a.createElement(N.b,null))),w.a.createElement(F.a,{gutter:[20,20]},w.a.createElement(W.a,{flex:"230px"},w.a.createElement(c.a.Item,{name:"min_num",label:"\u5206\u7EC4\u8BBE\u7F6E",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5C0F\u4EBA\u6570"}]},w.a.createElement(R.a,{style:{width:200},min:1,placeholder:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5C0F\u4EBA\u6570"}))),w.a.createElement(W.a,{flex:"230px"},w.a.createElement(c.a.Item,{name:"max_num",label:w.a.createElement("div",null,"\xA0"),rules:[{required:!0,message:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5927\u4EBA\u6570"}]},w.a.createElement(R.a,{style:{width:200},max:100,placeholder:"\u8BF7\u586B\u5199\u6BCF\u7EC4\u6700\u5927\u4EBA\u6570"}))),w.a.createElement(W.a,null,w.a.createElement("div",{className:"mt30"},"\uFF08\u5B66\u751F\u63D0\u4EA4\u4F5C\u54C1\u65F6\u9700\u8981\u5173\u8054\u540C\u7EC4\u6210\u5458\uFF0C\u7EC4\u5185\u6210\u5458\u4F5C\u54C1\u5171\u4EAB\uFF09"))),w.a.createElement(F.a,null,w.a.createElement(W.a,null,w.a.createElement(c.a.Item,{name:"base_on_project",valuePropName:"checked"},w.a.createElement(Q.a,{value:!0},"\u57FA\u4E8E\u9879\u76EE\u5B9E\u65BD")),w.a.createElement("span",{className:"c-light-black"},"\uFF08\u9009\u4E2D\uFF0C\u5219\u5FC5\u987B\u5728\u672C\u5E73\u53F0\u521B\u5EFA\u9879\u76EE\uFF0C\u9879\u76EE\u7BA1\u7406\u5458\u53EF\u4EE5\u63D0\u4EA4\u4F5C\u54C1\uFF1B\u4E0D\u9009\u4E2D\uFF0C\u65E0\u9700\u5728\u5E73\u53F0\u521B\u5EFA\u9879\u76EE\uFF0C\u4EFB\u610F\u5C0F\u7EC4\u6210\u5458\u5747\u53EF\u4EE5\u63D0\u4EA4\u4F5C\u54C1\uFF09")))),w.a.createElement("div",{className:b.a.mdWrap},w.a.createElement(c.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},w.a.createElement(l.a,{watch:!0,defaultValue:de.notice})),w.a.createElement("div",null,w.a.createElement(c.a.Item,{name:"reference_attachment_ids"},w.a.createElement(N.b,null))))),w.a.createElement("div",{className:b.a.mdWrap},w.a.createElement(D.a,{setitem:function($e){return Be(Object(s.a)({},$e))}})),w.a.createElement("div",{className:b.a.backgroundFa},w.a.createElement("div",{className:"pt40 mb30"},w.a.createElement(c.a.Item,null,w.a.createElement(Z.a,{size:"large",type:"primary",onClick:function(){fe.submit()},className:"".concat(b.a.button," mr20"),htmlType:"submit",loading:we["newCourse/editCourse"]||we["newCourse/submitCourse"]},"\u63D0\u4EA4"),w.a.createElement(Z.a,{size:"large",type:"primary",ghost:!0,className:b.a.button,onClick:function(){return S.d.push("/classrooms/".concat(Ee.params.coursesId,"/group_homework"))}},"\u53D6\u6D88")))))};Qe.default=Object(S.a)(function(I){var v=I.shixunHomeworks,G=I.newCourse,Y=I.loading,re=I.globalSetting;return{shixunHomeworks:v,newCourse:G,globalSetting:re,loading:Y.effects}})(j)},ulZh:function(ct,Qe,ne){typeof window!="undefined"&&function(Z,P){ct.exports=P()}(this,function(){return function(le){var Z={};function P(Q){if(Z[Q])return Z[Q].exports;var H=Z[Q]={i:Q,l:!1,exports:{}};return le[Q].call(H.exports,H,H.exports,P),H.l=!0,H.exports}return P.m=le,P.c=Z,P.d=function(Q,H,F){P.o(Q,H)||Object.defineProperty(Q,H,{enumerable:!0,get:F})},P.r=function(Q){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Q,"__esModule",{value:!0})},P.t=function(Q,H){if(H&1&&(Q=P(Q)),H&8)return Q;if(H&4&&typeof Q=="object"&&Q&&Q.__esModule)return Q;var F=Object.create(null);if(P.r(F),Object.defineProperty(F,"default",{enumerable:!0,value:Q}),H&2&&typeof Q!="string")for(var K in Q)P.d(F,K,function(W){return Q[W]}.bind(null,K));return F},P.n=function(Q){var H=Q&&Q.__esModule?function(){return Q.default}:function(){return Q};return P.d(H,"a",H),H},P.o=function(Q,H){return Object.prototype.hasOwnProperty.call(Q,H)},P.p="/dist/",P(P.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(le,Z,P){"use strict";var Q=Object.prototype.hasOwnProperty,H="~";function F(){}Object.create&&(F.prototype=Object.create(null),new F().__proto__||(H=!1));function K(g,p,f){this.fn=g,this.context=p,this.once=f||!1}function W(g,p,f,h,s){if(typeof f!="function")throw new TypeError("The listener must be a function");var d=new K(f,h||g,s),o=H?H+p:p;return g._events[o]?g._events[o].fn?g._events[o]=[g._events[o],d]:g._events[o].push(d):(g._events[o]=d,g._eventsCount++),g}function M(g,p){--g._eventsCount===0?g._events=new F:delete g._events[p]}function R(){this._events=new F,this._eventsCount=0}R.prototype.eventNames=function(){var p=[],f,h;if(this._eventsCount===0)return p;for(h in f=this._events)Q.call(f,h)&&p.push(H?h.slice(1):h);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(f)):p},R.prototype.listeners=function(p){var f=H?H+p:p,h=this._events[f];if(!h)return[];if(h.fn)return[h.fn];for(var s=0,d=h.length,o=new Array(d);s0},!1)}function g(p,f){for(var h={main:[f]},s={main:[]},d={main:{}};R(h);)for(var o=Object.keys(h),n=0;n=2*O/S||b<=D)return;var B=Number.POSITIVE_INFINITY,j;for(j=o.level-1;j>_;j--){var I=T[j].maxBitrate;if(B=O*I/(8*.8*m),B=b)return;var v=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+o.sn+(n?" part "+n.index:"")+" of level "+o.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+j+` Current BW estimate: `+(Object(Q.isFiniteNumber)(v)?(v/1024).toFixed(3):"Unknown")+` Kb/s Estimated load time for current fragment: `+b.toFixed(3)+` s Estimated load time for the next fragment: `+B.toFixed(3)+` s Time to underbuffer: `+D.toFixed(3)+" s"),u.nextLoadLevel=j,this.bwEstimator.sample(w,x.loaded),this.clearTimer(),o.loader&&(this.fragCurrent=this.partCurrent=null,o.loader.abort()),u.trigger(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:o,part:n,stats:x})},s.onFragLoaded=function(o,n){var u=n.frag,c=n.part;if(u.type===M.PlaylistLevelType.MAIN&&Object(Q.isFiniteNumber)(u.sn)){var L=c?c.stats:u.stats,C=c?c.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var x=this.hls.levels[u.level],O=(x.loaded?x.loaded.bytes:0)+L.loaded,w=(x.loaded?x.loaded.duration:0)+C;x.loaded={bytes:O,duration:w},x.realBitrate=Math.round(8*O/w)}if(u.bitrateTest){var S={stats:L,frag:u,part:c,id:u.type};this.onFragBuffered(F.Events.FRAG_BUFFERED,S),u.bitrateTest=!1}}},s.onFragBuffered=function(o,n){var u=n.frag,c=n.part,L=c?c.stats:u.stats;if(L.aborted)return;if(u.type!==M.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var C=L.parsing.end-L.loading.start;this.bwEstimator.sample(C,L.loaded),L.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=C/1e3:this.bitrateTestDelay=0},s.onError=function(o,n){switch(n.details){case W.ErrorDetails.FRAG_LOAD_ERROR:case W.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},s.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},s.getNextABRAutoLevel=function(){var o=this.fragCurrent,n=this.partCurrent,u=this.hls,c=u.maxAutoLevel,L=u.config,C=u.minAutoLevel,x=u.media,O=n?n.duration:o?o.duration:0,w=x?x.currentTime:0,S=x&&x.playbackRate!==0?Math.abs(x.playbackRate):1,T=this.bwEstimator?this.bwEstimator.getEstimate():L.abrEwmaDefaultEstimate,_=(K.BufferHelper.bufferInfo(x,w,L.maxBufferHole).end-w)/S,l=this.findBestLevel(T,C,c,_,L.abrBandWidthFactor,L.abrBandWidthUpFactor);if(l>=0)return l;R.logger.trace((_?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var E=O?Math.min(O,L.maxStarvationDelay):L.maxStarvationDelay,m=L.abrBandWidthFactor,b=L.abrBandWidthUpFactor;if(!_){var N=this.bitrateTestDelay;if(N){var D=O?Math.min(O,L.maxLoadingDelay):L.maxLoadingDelay;E=D-N,R.logger.trace("bitrate test took "+Math.round(1e3*N)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*E)+" ms"),m=b=1}}return l=this.findBestLevel(T,C,c,_+E,m,b),Math.max(l,0)},s.findBestLevel=function(o,n,u,c,L,C){for(var x,O=this.fragCurrent,w=this.partCurrent,S=this.lastLoadedFragLevel,T=this.hls.levels,_=T[S],l=!!(_!=null&&(x=_.details)!==null&&x!==void 0&&x.live),E=_==null?void 0:_.codecSet,m=w?w.duration:O?O.duration:0,b=u;b>=n;b--){var N=T[b];if(!N||E&&N.codecSet!==E)continue;var D=N.details,B=(w?D==null?void 0:D.partTarget:D==null?void 0:D.averagetargetduration)||m,j=void 0;b<=S?j=L*o:j=C*o;var I=T[b].maxBitrate,v=I*B/j;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+b+"/"+Math.round(j)+"/"+I+"/"+B+"/"+c+"/"+v),j>I&&(!v||l&&!this.bitrateTestDelay||v0&&_===-1?(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),this.state=H.State.IDLE):(this.loadedmetadata=!1,this.state=H.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=_,this.tick()},S.doTick=function(){switch(this.state){case H.State.IDLE:this.doTickIdle();break;case H.State.WAITING_TRACK:{var _,l=this.levels,E=this.trackId,m=l==null||((_=l[E])===null||_===void 0)?void 0:_.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=H.State.WAITING_INIT_PTS}break}case H.State.FRAG_LOADING_WAITING_RETRY:{var b,N=performance.now(),D=this.retryDate;(!D||N>=D||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=H.State.IDLE);break}case H.State.WAITING_INIT_PTS:{var B=this.waitingData;if(B){var j=B.frag,I=B.part,v=B.cache,G=B.complete;if(this.initPTS[j.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=H.State.FRAG_LOADING;var Y=v.flush(),re={frag:j,part:I,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(re),G&&O.prototype._handleFragmentLoadComplete.call(this,re)}else if(this.videoTrackCC!==this.waitingVideoCC)n.logger.log("Waiting fragment cc ("+j.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var oe=this.getLoadPosition(),we=K.BufferHelper.bufferInfo(this.mediaBuffer,oe,this.config.maxBufferHole),pe=Object(s.fragmentWithinToleranceTest)(we.end,this.config.maxFragLookUpTolerance,j);pe<0&&(n.logger.log("Waiting fragment cc ("+j.cc+") @ "+j.start+" cancelled because another fragment at "+we.end+" is needed"),this.clearWaitingFragment())}}else this.state=H.State.IDLE}}this.onTickEnd()},S.clearWaitingFragment=function(){var _=this.waitingData;_&&(this.fragmentTracker.removeFragment(_.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=H.State.IDLE)},S.onTickEnd=function(){var _=this.media;if(!_||!_.readyState)return;var l=this.mediaBuffer?this.mediaBuffer:_,E=l.buffered;!this.loadedmetadata&&E.length&&(this.loadedmetadata=!0),this.lastCurrentTime=_.currentTime},S.doTickIdle=function(){var _,l,E=this.hls,m=this.levels,b=this.media,N=this.trackId,D=E.config;if(!m||!m[N])return;if(!b&&(this.startFragRequested||!D.startFragPrefetch))return;var B=m[N],j=B.details;if(!j||j.live&&this.levelLastLoaded!==N||this.waitForCdnTuneIn(j)){this.state=H.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(I===null)return;var v=I.len,G=this.getMaxBufferLength(),Y=this.audioSwitch;if(v>=G&&!Y)return;if(!Y&&this._streamEnded(I,j)){E.trigger(F.Events.BUFFER_EOS,{type:"audio"}),this.state=H.State.ENDED;return}var re=j.fragments,oe=re[0].start,we=I.end;if(Y){var pe=this.getLoadPosition();we=pe,j.PTSKnown&&peoe||I.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=oe+.05))}var Ee=this.getNextFragment(we,j);if(!Ee){this.bufferFlushed=!0;return}((_=Ee.decryptdata)===null||_===void 0?void 0:_.keyFormat)==="identity"&&!((l=Ee.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(Ee,j):this.loadFragment(Ee,j,we)},S.getMaxBufferLength=function(){var _=O.prototype.getMaxBufferLength.call(this),l=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return l===null?_:Math.max(_,l.len)},S.onMediaDetaching=function(){this.videoBuffer=null,O.prototype.onMediaDetaching.call(this)},S.onAudioTracksUpdated=function(_,l){var E=l.audioTracks;this.resetTransmuxer(),this.levels=E.map(function(m){return new M.Level(m)})},S.onAudioTrackSwitching=function(_,l){var E=!!l.url;this.trackId=l.id;var m=this.fragCurrent;m!=null&&m.loader&&m.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),E?this.setInterval(C):this.resetTransmuxer(),E?(this.audioSwitch=!0,this.state=H.State.IDLE):this.state=H.State.STOPPED,this.tick()},S.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},S.onLevelLoaded=function(_,l){this.mainDetails=l.details},S.onAudioTrackLoaded=function(_,l){var E,m=this.levels,b=l.details,N=l.id;if(!m){this.warn("Audio tracks were reset while loading level "+N);return}this.log("Track "+N+" loaded ["+b.startSN+","+b.endSN+"],duration:"+b.totalduration);var D=m[N],B=0;if(b.live||(E=D.details)!==null&&E!==void 0&&E.live){var j=this.mainDetails;if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed||!j)return;!D.details&&b.hasProgramDateTime&&j.hasProgramDateTime?(Object(d.alignMediaPlaylistByPDT)(b,j),B=b.fragments[0].start):B=this.alignPlaylists(b,D.details)}D.details=b,this.levelLastLoaded=N,!this.startFragRequested&&(this.mainDetails||!b.live)&&this.setStartPosition(D.details,B),this.state===H.State.WAITING_TRACK&&!this.waitForCdnTuneIn(b)&&(this.state=H.State.IDLE),this.tick()},S._handleFragmentLoadProgress=function(_){var l,E=_.frag,m=_.part,b=_.payload,N=this.config,D=this.trackId,B=this.levels;if(!B){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+E.sn+" of level "+E.level+" will not be buffered");return}var j=B[D];console.assert(j,"Audio track is defined on fragment load progress");var I=j.details;console.assert(I,"Audio track details are defined on fragment load progress");var v=N.defaultAudioCodec||j.audioCodec||"mp4a.40.2",G=this.transmuxer;G||(G=this.transmuxer=new f.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[E.cc],re=(l=E.initSegment)===null||l===void 0?void 0:l.data;if(Y!==void 0){var oe=!1,we=m?m.index:-1,pe=we!==-1,Ee=new h.ChunkMetadata(E.level,E.sn,E.stats.chunkCount,b.byteLength,we,pe);G.push(b,re,v,"",E,m,I.totalduration,oe,Ee,Y)}else{n.logger.log("Unknown video PTS for cc "+E.cc+", waiting for video PTS before demuxing audio frag "+E.sn+" of ["+I.startSN+" ,"+I.endSN+"],track "+D);var _e=this.waitingData=this.waitingData||{frag:E,part:m,cache:new p.default,complete:!1},Ae=_e.cache;Ae.push(new Uint8Array(b)),this.waitingVideoCC=this.videoTrackCC,this.state=H.State.WAITING_INIT_PTS}},S._handleFragmentLoadComplete=function(_){if(this.waitingData){this.waitingData.complete=!0;return}O.prototype._handleFragmentLoadComplete.call(this,_)},S.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},S.onBufferCreated=function(_,l){var E=l.tracks.audio;E&&(this.mediaBuffer=E.buffer),l.tracks.video&&(this.videoBuffer=l.tracks.video.buffer)},S.onFragBuffered=function(_,l){var E=l.frag,m=l.part;if(E.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(E)){this.warn("Fragment "+E.sn+(m?" p: "+m.index:"")+" of level "+E.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}E.sn!=="initSegment"&&(this.fragPrevious=E,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(E,m)},S.onError=function(_,l){switch(l.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(R.PlaylistLevelType.AUDIO,l);break;case o.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case o.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==H.State.ERROR&&this.state!==H.State.STOPPED&&(this.state=l.fatal?H.State.ERROR:H.State.IDLE,this.warn(l.details+" while loading frag, switching to "+this.state+" state"));break;case o.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="audio"&&(this.state===H.State.PARSING||this.state===H.State.PARSED)){var E=!0,m=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);m&&m.len>.5&&(E=!this.reduceMaxBufferLength(m.len)),E&&(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}},S.onBufferFlushed=function(_,l){var E=l.type;E===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},S._handleTransmuxComplete=function(_){var l,E="audio",m=this.hls,b=_.remuxResult,N=_.chunkMeta,D=this.getCurrentContext(N);if(!D){this.warn("The loading context changed while buffering fragment "+N.sn+" of level "+N.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(N.level);return}var B=D.frag,j=D.part,I=b.audio,v=b.text,G=b.id3,Y=b.initSegment;if(this.fragContextChanged(B))return;if(this.state=H.State.PARSING,this.audioSwitch&&I&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,B,N),m.trigger(F.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:E,tracks:Y.tracks})),I){var re=I.startPTS,oe=I.endPTS,we=I.startDTS,pe=I.endDTS;j&&(j.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:re,endPTS:oe,startDTS:we,endDTS:pe}),B.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,re,oe,we,pe),this.bufferFragmentData(I,B,j,N)}if(G!=null&&(l=G.samples)!==null&&l!==void 0&&l.length){var Ee=u({frag:B,id:E},G);m.trigger(F.Events.FRAG_PARSING_METADATA,Ee)}if(v){var _e=u({frag:B,id:E},v);m.trigger(F.Events.FRAG_PARSING_USERDATA,_e)}},S._bufferInitSegment=function(_,l,E){if(this.state!==H.State.PARSING)return;_.video&&delete _.video;var m=_.audio;if(!m)return;m.levelCodec=m.codec,m.id="audio",this.log("Init audio buffer, container:"+m.container+", codecs[parsed]=["+m.codec+"]"),this.hls.trigger(F.Events.BUFFER_CODECS,_);var b=m.initSegment;if(b!=null&&b.byteLength){var N={type:"audio",frag:l,part:null,chunkMeta:E,parent:l.type,data:b};this.hls.trigger(F.Events.BUFFER_APPENDING,N)}this.tick()},S.loadFragment=function(_,l,E){var m=this.fragmentTracker.getState(_);this.fragCurrent=_,(this.audioSwitch||m===W.FragmentState.NOT_LOADED||m===W.FragmentState.PARTIAL)&&(_.sn==="initSegment"?this._loadInitSegment(_):l.live&&!Object(Q.isFiniteNumber)(this.initPTS[_.cc])?(this.log("Waiting for video PTS in continuity counter "+_.cc+" of live stream before loading audio fragment "+_.sn+" of level "+this.trackId),this.state=H.State.WAITING_INIT_PTS):(this.startFragRequested=!0,O.prototype.loadFragment.call(this,_,l,E)))},S.completeAudioSwitch=function(){var _=this.hls,l=this.media,E=this.trackId;l&&(this.log("Switching audio track : flushing all audio"),O.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,_.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:E})},w}(H.default);Z.default=x},"./src/controller/audio-track-controller.ts":function(le,Z,P){"use strict";P.r(Z);var Q=P("./src/events.ts"),H=P("./src/errors.ts"),F=P("./src/controller/base-playlist-controller.ts"),K=P("./src/types/loader.ts");function W(f,h){for(var s=0;s=n.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=n[this.trackId];this.log("Now switching to audio-track index "+o);var c=n[o],L=c.id,C=c.groupId,x=C===void 0?"":C,O=c.name,w=c.type,S=c.url;if(this.trackId=o,this.trackName=O,this.selectDefaultTrack=!1,this.hls.trigger(Q.Events.AUDIO_TRACK_SWITCHING,{id:L,groupId:x,name:O,type:w,url:S}),c.details&&!c.details.live)return;var T=this.switchParams(c.url,u==null?void 0:u.details);this.loadPlaylist(T)},s.selectInitialTrack=function(){var o=this.tracksInGroup;console.assert(o.length,"Initial audio track should be selected when tracks are known");var n=this.trackName,u=this.findTrackId(n)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},s.findTrackId=function(o){for(var n=this.tracksInGroup,u=0;uh.partTarget&&(c+=1)}if(Object(Q.isFiniteNumber)(u))return new H.HlsUrlParameters(u,Object(Q.isFiniteNumber)(c)?c:void 0,H.HlsSkip.No)}}},g.loadPlaylist=function(f){},g.shouldLoadTrack=function(f){return this.canLoad&&f&&!!f.url&&(!f.details||f.details.live)},g.playlistLoaded=function(f,h,s){var d=this,o=h.details,n=h.stats,u=n.loading.end?Math.max(0,self.performance.now()-n.loading.end):0;if(o.advancedDateTime=Date.now()-u,o.live||s!=null&&s.live){if(o.reloaded(s),s&&this.log("live playlist "+f+" "+(o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:"MISSED")),s&&o.fragments.length>0&&Object(F.mergeDetails)(s,o),!this.canLoad||!o.live)return;var c,L=void 0,C=void 0;if(o.canBlockReload&&o.endSN&&o.advanced){var x=this.hls.config.lowLatencyMode,O=o.lastPartSn,w=o.endSN,S=o.lastPartIndex,T=S!==-1,_=O===w,l=x?0:S;T?(L=_?w+1:O,C=_?l:S+1):L=w+1;var E=o.age,m=E+o.ageHeader,b=Math.min(m-o.partTarget,o.targetduration*1.5);if(b>0){if(s&&b>s.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+s.tuneInGoal+" to: "+b+" with playlist age: "+o.age),b=0;else{var N=Math.floor(b/o.targetduration);if(L+=N,C!==void 0){var D=Math.round(b%o.targetduration/o.partTarget);C+=D}this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+E.toFixed(2)+"s goal: "+b+" skip sn "+N+" to part "+C)}o.tuneInGoal=b}if(c=this.getDeliveryDirectives(o,h.deliveryDirectives,L,C),x||!_){this.loadPlaylist(c);return}}else c=this.getDeliveryDirectives(o,h.deliveryDirectives,L,C);var B=Object(F.computeReloadInterval)(o,n);L!==void 0&&o.canBlockReload&&(B-=o.partTarget||1),this.log("reload live playlist "+f+" in "+Math.round(B)+" ms"),this.timer=self.setTimeout(function(){return d.loadPlaylist(c)},B)}else this.clearTimer()},g.getDeliveryDirectives=function(f,h,s,d){var o=Object(H.getSkipValue)(f,s);return h!=null&&h.skip&&f.deltaUpdateFailed&&(s=h.msn,d=h.part,o=H.HlsSkip.No),new H.HlsUrlParameters(s,d,o)},g.retryLoadingOrFail=function(f){var h=this,s=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 n=Math.min(Math.pow(2,this.retryCount)*s.levelLoadingRetryDelay,s.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return h.loadPlaylist()},n),this.warn("retry playlist loading #"+this.retryCount+" in "+n+' ms after "'+f.details+'"')}}else this.warn('cannot recover from error "'+f.details+'"'),this.clearTimer(),f.fatal=!0;return d},R}()},"./src/controller/base-stream-controller.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"State",function(){return w}),P.d(Z,"default",function(){return S});var Q=P("./src/polyfills/number.ts"),H=P("./src/task-loop.ts"),F=P("./src/controller/fragment-tracker.ts"),K=P("./src/utils/buffer-helper.ts"),W=P("./src/utils/logger.ts"),M=P("./src/events.ts"),R=P("./src/errors.ts"),g=P("./src/types/transmuxer.ts"),p=P("./src/utils/mp4-tools.ts"),f=P("./src/utils/discontinuities.ts"),h=P("./src/controller/fragment-finders.ts"),s=P("./src/controller/level-helper.ts"),d=P("./src/loader/fragment-loader.ts"),o=P("./src/crypt/decrypter.ts"),n=P("./src/utils/time-ranges.ts"),u=P("./src/types/loader.ts");function c(T,_){for(var l=0;l<_.length;l++){var E=_[l];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(T,E.key,E)}}function L(T,_,l){return _&&c(T.prototype,_),l&&c(T,l),T}function C(T){if(T===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return T}function x(T,_){T.prototype=Object.create(_.prototype),T.prototype.constructor=T,O(T,_)}function O(T,_){return O=Object.setPrototypeOf||function(E,m){return E.__proto__=m,E},O(T,_)}var w={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},S=function(T){x(_,T);function _(E,m,b){var N;return N=T.call(this)||this,N.hls=void 0,N.fragPrevious=null,N.fragCurrent=null,N.fragmentTracker=void 0,N.transmuxer=null,N._state=w.STOPPED,N.media=void 0,N.mediaBuffer=void 0,N.config=void 0,N.bitrateTest=!1,N.lastCurrentTime=0,N.nextLoadPosition=0,N.startPosition=0,N.loadedmetadata=!1,N.fragLoadError=0,N.retryDate=0,N.levels=null,N.fragmentLoader=void 0,N.levelLastLoaded=null,N.startFragRequested=!1,N.decrypter=void 0,N.initPTS=[],N.onvseeking=null,N.onvended=null,N.logPrefix="",N.log=void 0,N.warn=void 0,N.logPrefix=b,N.log=W.logger.log.bind(W.logger,b+":"),N.warn=W.logger.warn.bind(W.logger,b+":"),N.hls=E,N.fragmentLoader=new d.default(E.config),N.fragmentTracker=m,N.config=E.config,N.decrypter=new o.default(E,E.config),E.on(M.Events.KEY_LOADED,N.onKeyLoaded,C(N)),N}var l=_.prototype;return l.doTick=function(){this.onTickEnd()},l.onTickEnd=function(){},l.startLoad=function(m){},l.stopLoad=function(){this.fragmentLoader.abort();var m=this.fragCurrent;m&&this.fragmentTracker.removeFragment(m),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=w.STOPPED},l._streamEnded=function(m,b){var N=this.fragCurrent,D=this.fragmentTracker;if(!b.live&&N&&N.sn===b.endSN&&!m.nextStart){var B=D.getState(N);return B===F.FragmentState.PARTIAL||B===F.FragmentState.OK}return!1},l.onMediaAttached=function(m,b){var N=this.media=this.mediaBuffer=b.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),N.addEventListener("seeking",this.onvseeking),N.addEventListener("ended",this.onvended);var D=this.config;this.levels&&D.autoStartLoad&&this.state===w.STOPPED&&this.startLoad(D.startPosition)},l.onMediaDetaching=function(){var m=this.media;m!=null&&m.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),m&&(m.removeEventListener("seeking",this.onvseeking),m.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},l.onMediaSeeking=function(){var m=this.config,b=this.fragCurrent,N=this.media,D=this.mediaBuffer,B=this.state,j=N?N.currentTime:0,I=K.BufferHelper.bufferInfo(D||N,j,m.maxBufferHole);if(this.log("media seeking to "+(Object(Q.isFiniteNumber)(j)?j.toFixed(3):j)+", state: "+B),B===w.ENDED)this.resetLoadingState();else if(b&&!I.len){var v=m.maxFragLookUpTolerance,G=b.start-v,Y=b.start+b.duration+v,re=j>Y;(j0&&j&&j.key&&j.iv&&j.method==="AES-128"){var I=self.performance.now();return b.decrypter.webCryptoDecrypt(new Uint8Array(B),j.key.buffer,j.iv.buffer).then(function(v){var G=self.performance.now();return D.trigger(M.Events.FRAG_DECRYPTED,{frag:m,payload:v,stats:{tstart:I,tdecrypt:G}}),N.payload=v,N})}return N}).then(function(N){var D=b.fragCurrent,B=b.hls,j=b.levels;if(!j)throw new Error("init load aborted, missing levels");var I=j[m.level].details;console.assert(I,"Level details are defined when init segment is loaded");var v=m.stats;b.state=w.IDLE,b.fragLoadError=0,m.data=new Uint8Array(N.payload),v.parsing.start=v.buffering.start=self.performance.now(),v.parsing.end=v.buffering.end=self.performance.now(),N.frag===D&&B.trigger(M.Events.FRAG_BUFFERED,{stats:v,frag:D,part:null,id:m.type}),b.tick()}).catch(function(N){b.warn(N),b.resetFragmentLoading(m)})},l.fragContextChanged=function(m){var b=this.fragCurrent;return!m||!b||m.level!==b.level||m.sn!==b.sn||m.urlId!==b.urlId},l.fragBufferedComplete=function(m,b){var N=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(b?" part: "+b.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+n.default.toString(K.BufferHelper.getBuffered(N))),this.state=w.IDLE,this.tick()},l._handleFragmentLoadComplete=function(m){var b=this.transmuxer;if(!b)return;var N=m.frag,D=m.part,B=m.partsLoaded,j=!B||B.length===0||B.some(function(v){return!v}),I=new g.ChunkMetadata(N.level,N.sn,N.stats.chunkCount+1,0,D?D.index:-1,!j);b.flush(I)},l._handleFragmentLoadProgress=function(m){},l._doFragLoad=function(m,b,N,D){var B=this;if(N===void 0&&(N=null),!this.levels)throw new Error("frag load aborted, missing levels");if(N=Math.max(m.start,N||0),this.config.lowLatencyMode&&b){var j=b.partList;if(j&&D){N>m.end&&b.fragmentHint&&(m=b.fragmentHint);var I=this.getNextPart(j,m,N);if(I>-1){var v=j[I];return this.log("Loading part sn: "+m.sn+" p: "+v.index+" cc: "+m.cc+" of playlist ["+b.startSN+"-"+b.endSN+"] parts [0-"+I+"-"+(j.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(N.toFixed(3))),this.nextLoadPosition=v.start+v.duration,this.state=w.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:m,part:j[I],targetBufferTime:N}),this.doFragPartsLoad(m,j,I,D).catch(function(G){return B.handleFragLoadError(G)})}else if(!m.url||this.loadedEndOfParts(j,N))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(b?"of ["+b.startSN+"-"+b.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(N.toFixed(3))),Object(Q.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=w.FRAG_LOADING,this.hls.trigger(M.Events.FRAG_LOADING,{frag:m,targetBufferTime:N}),this.fragmentLoader.load(m,D).catch(function(G){return B.handleFragLoadError(G)})},l.doFragPartsLoad=function(m,b,N,D){var B=this;return new Promise(function(j,I){var v=[],G=function Y(re){var oe=b[re];B.fragmentLoader.loadPart(m,oe,D).then(function(we){v[oe.index]=we;var pe=we.part;B.hls.trigger(M.Events.FRAG_LOADED,we);var Ee=b[re+1];if(Ee&&Ee.fragment===m)Y(re+1);else return j({frag:m,part:pe,partsLoaded:v})}).catch(I)};G(N)})},l.handleFragLoadError=function(m){var b=m.data;return b&&b.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(b.frag,b.part):this.hls.trigger(M.Events.ERROR,b),null},l._handleTransmuxerFlush=function(m){var b=this.getCurrentContext(m);if(!b||this.state!==w.PARSING){this.fragCurrent||(this.state=w.IDLE);return}var N=b.frag,D=b.part,B=b.level,j=self.performance.now();N.stats.parsing.end=j,D&&(D.stats.parsing.end=j),this.updateLevelTiming(N,D,B,m.partial)},l.getCurrentContext=function(m){var b=this.levels,N=m.level,D=m.sn,B=m.part;if(!b||!b[N])return this.warn("Levels object was unset while buffering fragment "+D+" of level "+N+". The current chunk will not be buffered."),null;var j=b[N],I=B>-1?Object(s.getPartWith)(j,D,B):null,v=I?I.fragment:Object(s.getFragmentWithSN)(j,D,this.fragCurrent);return v?{frag:v,part:I,level:j}:null},l.bufferFragmentData=function(m,b,N,D){if(!m||this.state!==w.PARSING)return;var B=m.data1,j=m.data2,I=B;if(B&&j&&(I=Object(p.appendUint8Array)(B,j)),!I||!I.length)return;var v={type:m.type,frag:b,part:N,chunkMeta:D,parent:b.type,data:I};this.hls.trigger(M.Events.BUFFER_APPENDING,v),m.dropped&&m.independent&&!N&&this.flushBufferGap(b)},l.flushBufferGap=function(m){var b=this.media;if(!b)return;if(!K.BufferHelper.isBuffered(b,b.currentTime)){this.flushMainBuffer(0,m.start);return}var N=b.currentTime,D=K.BufferHelper.bufferInfo(b,N,0),B=m.duration,j=Math.min(this.config.maxFragLookUpTolerance*2,B*.25),I=Math.max(Math.min(m.start-j,D.end-j),N+j);m.start-I>j&&this.flushMainBuffer(I,m.start)},l.getFwdBufferInfo=function(m,b){var N=this.config,D=this.getLoadPosition();if(!Object(Q.isFiniteNumber)(D))return null;var B=K.BufferHelper.bufferInfo(m,D,N.maxBufferHole);if(B.len===0&&B.nextStart!==void 0){var j=this.fragmentTracker.getBufferedFrag(D,b);if(j&&B.nextStart=N?(b.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+b.maxMaxBufferLength+"s"),!0):!1},l.getNextFragment=function(m,b){var N,D,B=b.fragments,j=B.length;if(!j)return null;var I=this.config,v=B[0].start,G;if(b.live){var Y=I.initialLiveManifestSize;if(j-1&&NN.start&&N.loaded},l.getInitialLiveFragment=function(m,b){var N=this.fragPrevious,D=null;if(N){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+N.programDateTime),D=Object(h.findFragmentByPDT)(b,N.endProgramDateTime,this.config.maxFragLookUpTolerance)),!D){var B=N.sn+1;if(B>=m.startSN&&B<=m.endSN){var j=b[B-m.startSN];N.cc===j.cc&&(D=j,this.log("Live playlist, switching playlist, load frag with next SN: "+D.sn))}D||(D=Object(h.findFragWithCC)(b,N.cc),D&&this.log("Live playlist, switching playlist, load frag with same CC: "+D.sn))}}else{var I=this.hls.liveSyncPosition;I!==null&&(D=this.getFragmentAtPosition(I,this.bitrateTest?m.fragmentEnd:m.edge,m))}return D},l.getFragmentAtPosition=function(m,b,N){var D=this.config,B=this.fragPrevious,j=N.fragments,I=N.endSN,v=N.fragmentHint,G=D.maxFragLookUpTolerance,Y=!!(D.lowLatencyMode&&N.partList&&v);Y&&v&&!this.bitrateTest&&(j=j.concat(v),I=v.sn);var re;if(mb-G?0:G;re=Object(h.findFragmentByPTS)(B,j,m,oe)}else re=j[j.length-1];if(re){var we=re.sn-N.startSN,pe=B&&re.level===B.level,Ee=j[we+1],_e=this.fragmentTracker.getState(re);if(_e===F.FragmentState.BACKTRACKED){re=null;for(var Ae=we;j[Ae]&&this.fragmentTracker.getState(j[Ae])===F.FragmentState.BACKTRACKED;)B?re=j[Ae--]:re=j[--Ae];re||(re=Ee)}else B&&re.sn===B.sn&&!Y&&(pe&&(re.sn=j-b.maxFragLookUpTolerance&&B<=I;if(D!==null&&N.duration>D&&(B"+m.startSN+" prev-sn: "+(B?B.sn:"na")+" fragments: "+I),re}return v},l.waitForCdnTuneIn=function(m){var b=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*b)},l.setStartPosition=function(m,b){var N=this.startPosition;if(N"+m))}}]),_}(H.default)},"./src/controller/buffer-controller.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return h});var Q=P("./src/polyfills/number.ts"),H=P("./src/events.ts"),F=P("./src/utils/logger.ts"),K=P("./src/errors.ts"),W=P("./src/utils/buffer-helper.ts"),M=P("./src/utils/mediasource-helper.ts"),R=P("./src/loader/fragment.ts"),g=P("./src/controller/buffer-operation-queue.ts"),p=Object(M.getMediaSource)(),f=/([ha]vc.)(?:\.[^.,]+)+/,h=function(){function s(o){var n=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var u=n.hls,c=n.media,L=n.mediaSource;F.logger.log("[buffer-controller]: Media source opened"),c&&(n.updateMediaElementDuration(),u.trigger(H.Events.MEDIA_ATTACHED,{media:c})),L&&L.removeEventListener("sourceopen",n._onMediaSourceOpen),n.checkPendingTracks()},this._onMediaSourceClose=function(){F.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){F.logger.log("[buffer-controller]: Media source ended")},this.hls=o,this._initSourceBuffer(),this.registerListeners()}var d=s.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 n=this.hls;n.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.on(H.Events.BUFFER_RESET,this.onBufferReset,this),n.on(H.Events.BUFFER_APPENDING,this.onBufferAppending,this),n.on(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),n.on(H.Events.BUFFER_EOS,this.onBufferEos,this),n.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),n.on(H.Events.LEVEL_UPDATED,this.onLevelUpdated,this),n.on(H.Events.FRAG_PARSED,this.onFragParsed,this),n.on(H.Events.FRAG_CHANGED,this.onFragChanged,this)},d.unregisterListeners=function(){var n=this.hls;n.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),n.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),n.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),n.off(H.Events.BUFFER_RESET,this.onBufferReset,this),n.off(H.Events.BUFFER_APPENDING,this.onBufferAppending,this),n.off(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),n.off(H.Events.BUFFER_EOS,this.onBufferEos,this),n.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),n.off(H.Events.LEVEL_UPDATED,this.onLevelUpdated,this),n.off(H.Events.FRAG_PARSED,this.onFragParsed,this),n.off(H.Events.FRAG_CHANGED,this.onFragChanged,this)},d._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},d.onManifestParsed=function(n,u){var c=2;(u.audio&&!u.video||!u.altAudio)&&(c=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=c,this.details=null,F.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},d.onMediaAttaching=function(n,u){var c=this.media=u.media;if(c&&p){var L=this.mediaSource=new p;L.addEventListener("sourceopen",this._onMediaSourceOpen),L.addEventListener("sourceended",this._onMediaSourceEnded),L.addEventListener("sourceclose",this._onMediaSourceClose),c.src=self.URL.createObjectURL(L),this._objectUrl=c.src}},d.onMediaDetaching=function(){var n=this.media,u=this.mediaSource,c=this._objectUrl;if(u){if(F.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(L){F.logger.warn("[buffer-controller]: onMediaDetaching: "+L.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),n&&(c&&self.URL.revokeObjectURL(c),n.src===c?(n.removeAttribute("src"),n.load()):F.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(H.Events.MEDIA_DETACHED,void 0)},d.onBufferReset=function(){var n=this;this.getSourceBufferTypes().forEach(function(u){var c=n.sourceBuffer[u];try{c&&(n.removeBufferListeners(u),n.mediaSource&&n.mediaSource.removeSourceBuffer(c),n.sourceBuffer[u]=void 0)}catch(L){F.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",L)}}),this._initSourceBuffer()},d.onBufferCodecs=function(n,u){var c=this,L=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(C){if(L){var x=c.tracks[C];if(x&&typeof x.buffer.changeType=="function"){var O=u[C],w=O.codec,S=O.levelCodec,T=O.container,_=(x.levelCodec||x.codec).replace(f,"$1"),l=(S||w).replace(f,"$1");if(_!==l){var E=T+";codecs="+(S||w);c.appendChangeType(C,E)}}}else c.pendingTracks[C]=u[C]}),L)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},d.appendChangeType=function(n,u){var c=this,L=this.operationQueue,C={execute:function(){var O=c.sourceBuffer[n];O&&(F.logger.log("[buffer-controller]: changing "+n+" sourceBuffer type to "+u),O.changeType(u)),L.shiftAndExecuteNext(n)},onStart:function(){},onComplete:function(){},onError:function(O){F.logger.warn("[buffer-controller]: Failed to change "+n+" SourceBuffer type",O)}};L.append(C,n)},d.onBufferAppending=function(n,u){var c=this,L=this.hls,C=this.operationQueue,x=this.tracks,O=u.data,w=u.type,S=u.frag,T=u.part,_=u.chunkMeta,l=_.buffering[w],E=self.performance.now();l.start=E;var m=S.stats.buffering,b=T?T.stats.buffering:null;m.start===0&&(m.start=E),b&&b.start===0&&(b.start=E);var N=x.audio,D=w==="audio"&&_.id===1&&(N==null?void 0:N.container)==="audio/mpeg",B={execute:function(){if(l.executeStart=self.performance.now(),D){var I=c.sourceBuffer[w];if(I){var v=S.start-I.timestampOffset;Math.abs(v)>=.1&&(F.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+S.start+" (delta: "+v+") sn: "+S.sn+")"),I.timestampOffset=S.start)}}c.appendExecutor(O,w)},onStart:function(){},onComplete:function(){var I=self.performance.now();l.executeEnd=l.end=I,m.first===0&&(m.first=I),b&&b.first===0&&(b.first=I);var v=c.sourceBuffer,G={};for(var Y in v)G[Y]=W.BufferHelper.getBuffered(v[Y]);c.appendError=0,c.hls.trigger(H.Events.BUFFER_APPENDED,{type:w,frag:S,part:T,chunkMeta:_,parent:S.type,timeRanges:G})},onError:function(I){F.logger.error("[buffer-controller]: Error encountered while trying to append to the "+w+" SourceBuffer",I);var v={type:K.ErrorTypes.MEDIA_ERROR,parent:S.type,details:K.ErrorDetails.BUFFER_APPEND_ERROR,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?v.details=K.ErrorDetails.BUFFER_FULL_ERROR:(c.appendError++,v.details=K.ErrorDetails.BUFFER_APPEND_ERROR,c.appendError>L.config.appendErrorMaxRetry&&(F.logger.error("[buffer-controller]: Failed "+L.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),v.fatal=!0)),L.trigger(H.Events.ERROR,v)}};C.append(B,w)},d.onBufferFlushing=function(n,u){var c=this,L=this.operationQueue,C=function(O){return{execute:c.removeExecutor.bind(c,O,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){c.hls.trigger(H.Events.BUFFER_FLUSHED,{type:O})},onError:function(S){F.logger.warn("[buffer-controller]: Failed to remove from "+O+" SourceBuffer",S)}}};u.type?L.append(C(u.type),u.type):this.getSourceBufferTypes().forEach(function(x){L.append(C(x),x)})},d.onFragParsed=function(n,u){var c=this,L=u.frag,C=u.part,x=[],O=C?C.elementaryStreams:L.elementaryStreams;O[R.ElementaryStreamTypes.AUDIOVIDEO]?x.push("audiovideo"):(O[R.ElementaryStreamTypes.AUDIO]&&x.push("audio"),O[R.ElementaryStreamTypes.VIDEO]&&x.push("video"));var w=function(){var T=self.performance.now();L.stats.buffering.end=T,C&&(C.stats.buffering.end=T);var _=C?C.stats:L.stats;c.hls.trigger(H.Events.FRAG_BUFFERED,{frag:L,part:C,stats:_,id:L.type})};x.length===0&&F.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+L.type+" level: "+L.level+" sn: "+L.sn),this.blockBuffers(w,x)},d.onFragChanged=function(n,u){this.flushBackBuffer()},d.onBufferEos=function(n,u){var c=this,L=this.getSourceBufferTypes().reduce(function(C,x){var O=c.sourceBuffer[x];return(!u.type||u.type===x)&&(O&&!O.ended&&(O.ended=!0,F.logger.log("[buffer-controller]: "+x+" sourceBuffer now EOS"))),C&&!!(!O||O.ended)},!0);L&&this.blockBuffers(function(){var C=c.mediaSource;if(!C||C.readyState!=="open")return;C.endOfStream()})},d.onLevelUpdated=function(n,u){var c=u.details;if(!c.fragments.length)return;this.details=c,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},d.flushBackBuffer=function(){var n=this.hls,u=this.details,c=this.media,L=this.sourceBuffer;if(!c||u===null)return;var C=this.getSourceBufferTypes();if(!C.length)return;var x=u.live&&n.config.liveBackBufferLength!==null?n.config.liveBackBufferLength:n.config.backBufferLength;if(!Object(Q.isFiniteNumber)(x)||x<0)return;var O=c.currentTime,w=u.levelTargetDuration,S=Math.max(x,w),T=Math.floor(O/w)*w-S;C.forEach(function(_){var l=L[_];if(l){var E=W.BufferHelper.getBuffered(l);E.length>0&&T>E.start(0)&&(n.trigger(H.Events.BACK_BUFFER_REACHED,{bufferEnd:T}),u.live&&n.trigger(H.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:T}),n.trigger(H.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:T,type:_}))}})},d.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var n=this.details,u=this.hls,c=this.media,L=this.mediaSource,C=n.fragments[0].start+n.totalduration,x=c.duration,O=Object(Q.isFiniteNumber)(L.duration)?L.duration:0;n.live&&u.config.liveDurationInfinity?(F.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),L.duration=Infinity,this.updateSeekableRange(n)):(C>O&&C>x||!Object(Q.isFiniteNumber)(x))&&(F.logger.log("[buffer-controller]: Updating Media Source duration to "+C.toFixed(3)),L.duration=C)},d.updateSeekableRange=function(n){var u=this.mediaSource,c=n.fragments,L=c.length;if(L&&n.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var C=Math.max(0,c[0].start),x=Math.max(C,C+n.totalduration);u.setLiveSeekableRange(C,x)}},d.checkPendingTracks=function(){var n=this.bufferCodecEventsExpected,u=this.operationQueue,c=this.pendingTracks,L=Object.keys(c).length;if(L&&!n||L===2){this.createSourceBuffers(c),this.pendingTracks={};var C=this.getSourceBufferTypes();if(C.length===0){this.hls.trigger(H.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}C.forEach(function(x){u.executeNext(x)})}},d.createSourceBuffers=function(n){var u=this.sourceBuffer,c=this.mediaSource;if(!c)throw Error("createSourceBuffers called when mediaSource was null");var L=0;for(var C in n)if(!u[C]){var x=n[C];if(!x)throw Error("source buffer exists for track "+C+", however track does not");var O=x.levelCodec||x.codec,w=x.container+";codecs="+O;F.logger.log("[buffer-controller]: creating sourceBuffer("+w+")");try{var S=u[C]=c.addSourceBuffer(w),T=C;this.addBufferListener(T,"updatestart",this._onSBUpdateStart),this.addBufferListener(T,"updateend",this._onSBUpdateEnd),this.addBufferListener(T,"error",this._onSBUpdateError),this.tracks[C]={buffer:S,codec:O,container:x.container,levelCodec:x.levelCodec,id:x.id},L++}catch(_){F.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+_.message),this.hls.trigger(H.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:_,mimeType:w})}}L&&this.hls.trigger(H.Events.BUFFER_CREATED,{tracks:this.tracks})},d._onSBUpdateStart=function(n){var u=this.operationQueue,c=u.current(n);c.onStart()},d._onSBUpdateEnd=function(n){var u=this.operationQueue,c=u.current(n);c.onComplete(),u.shiftAndExecuteNext(n)},d._onSBUpdateError=function(n,u){F.logger.error("[buffer-controller]: "+n+" SourceBuffer error",u),this.hls.trigger(H.Events.ERROR,{type:K.ErrorTypes.MEDIA_ERROR,details:K.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var c=this.operationQueue.current(n);c&&c.onError(u)},d.removeExecutor=function(n,u,c){var L=this.media,C=this.mediaSource,x=this.operationQueue,O=this.sourceBuffer,w=O[n];if(!L||!C||!w){F.logger.warn("[buffer-controller]: Attempting to remove from the "+n+" SourceBuffer, but it does not exist"),x.shiftAndExecuteNext(n);return}var S=Object(Q.isFiniteNumber)(L.duration)?L.duration:Infinity,T=Object(Q.isFiniteNumber)(C.duration)?C.duration:Infinity,_=Math.max(0,u),l=Math.min(c,S,T);l>_?(F.logger.log("[buffer-controller]: Removing ["+_+","+l+"] from the "+n+" SourceBuffer"),console.assert(!w.updating,n+" sourceBuffer must not be updating"),w.remove(_,l)):x.shiftAndExecuteNext(n)},d.appendExecutor=function(n,u){var c=this.operationQueue,L=this.sourceBuffer,C=L[u];if(!C){F.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),c.shiftAndExecuteNext(u);return}C.ended=!1,console.assert(!C.updating,u+" sourceBuffer must not be updating"),C.appendBuffer(n)},d.blockBuffers=function(n,u){var c=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){F.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(n);return}var L=this.operationQueue,C=u.map(function(x){return L.appendBlocker(x)});Promise.all(C).then(function(){n(),u.forEach(function(x){var O=c.sourceBuffer[x];(!O||!O.updating)&&L.shiftAndExecuteNext(x)})})},d.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},d.addBufferListener=function(n,u,c){var L=this.sourceBuffer[n];if(!L)return;var C=c.bind(this,n);this.listeners[n].push({event:u,listener:C}),L.addEventListener(u,C)},d.removeBufferListeners=function(n){var u=this.sourceBuffer[n];if(!u)return;this.listeners[n].forEach(function(c){u.removeEventListener(c.event,c.listener)})},s}()},"./src/controller/buffer-operation-queue.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return H});var Q=P("./src/utils/logger.ts"),H=function(){function F(W){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=W}var K=F.prototype;return K.append=function(M,R){var g=this.queues[R];g.push(M),g.length===1&&this.buffers[R]&&this.executeNext(R)},K.insertAbort=function(M,R){var g=this.queues[R];g.unshift(M),this.executeNext(R)},K.appendBlocker=function(M){var R,g=new Promise(function(f){R=f}),p={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(p,M),g},K.executeNext=function(M){var R=this.buffers,g=this.queues,p=R[M],f=g[M];if(f.length){var h=f[0];try{h.execute()}catch(s){Q.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),h.onError(s),(!p||!p.updating)&&(f.shift(),this.executeNext(M))}}},K.shiftAndExecuteNext=function(M){this.queues[M].shift(),this.executeNext(M)},K.current=function(M){return this.queues[M][0]},F}()},"./src/controller/cap-level-controller.ts":function(le,Z,P){"use strict";P.r(Z);var Q=P("./src/events.ts");function H(W,M){for(var R=0;R0&&this.mediaWidth>0){var g=this.hls.levels;if(g.length){var p=this.hls;p.autoLevelCapping=this.getMaxLevel(g.length-1),p.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=p.autoLevelCapping}}},M.getMaxLevel=function(g){var p=this,f=this.hls.levels;if(!f.length)return-1;var h=f.filter(function(s,d){return W.isLevelAllowed(d,p.restrictedLevels)&&d<=g});return this.clientRect=null,W.getMaxLevelByMediaSize(h,this.mediaWidth,this.mediaHeight)},M.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},M.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},M.getDimensions=function(){if(this.clientRect)return this.clientRect;var g=this.media,p={width:0,height:0};if(g){var f=g.getBoundingClientRect();p.width=f.width,p.height=f.height,!p.width&&!p.height&&(p.width=f.right-f.left||g.width||0,p.height=f.bottom-f.top||g.height||0)}return this.clientRect=p,p},W.isLevelAllowed=function(g,p){return p===void 0&&(p=[]),p.indexOf(g)===-1},W.getMaxLevelByMediaSize=function(g,p,f){if(!g||!g.length)return-1;for(var h=function(u,c){return c?u.width!==c.width||u.height!==c.height:!0},s=g.length-1,d=0;d=p||o.height>=f)&&h(o,g[d+1])){s=d;break}}return s},F(W,[{key:"mediaWidth",get:function(){return this.getDimensions().width*W.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*W.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(p){}return g}}]),W}();Z.default=K},"./src/controller/cmcd-controller.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return h});var Q=P("./src/events.ts"),H=P("./src/types/cmcd.ts"),F=P("./src/utils/buffer-helper.ts"),K=P("./src/utils/logger.ts");function W(s,d){for(var o=0;o=s.length?{done:!0}:{done:!1,value:s[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g(s,d){if(!s)return;if(typeof s=="string")return p(s,d);var o=Object.prototype.toString.call(s).slice(8,-1);if(o==="Object"&&s.constructor&&(o=s.constructor.name),o==="Map"||o==="Set")return Array.from(s);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return p(s,d)}function p(s,d){(d==null||d>s.length)&&(d=s.length);for(var o=0,n=new Array(d);ou&&(u=x.bitrate)}return u>0?u:NaN},d.getBufferLength=function(n){var u=this.hls.media,c=n===H.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!c||!u)return NaN;var L=F.BufferHelper.bufferInfo(c,u.currentTime,this.config.maxBufferHole);return L.len*1e3},d.createPlaylistLoader=function(){var n=this.config.pLoader,u=this.applyPlaylistData,c=n||this.config.loader;return function(){function L(x){this.loader=void 0,this.loader=new c(x)}var C=L.prototype;return C.destroy=function(){this.loader.destroy()},C.abort=function(){this.loader.abort()},C.load=function(O,w,S){u(O),this.loader.load(O,w,S)},M(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},d.createFragmentLoader=function(){var n=this.config.fLoader,u=this.applyFragmentData,c=n||this.config.loader;return function(){function L(x){this.loader=void 0,this.loader=new c(x)}var C=L.prototype;return C.destroy=function(){this.loader.destroy()},C.abort=function(){this.loader.abort()},C.load=function(O,w,S){u(O),this.loader.load(O,w,S)},M(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},s.uuid=function(){var n=URL.createObjectURL(new Blob),u=n.toString();return URL.revokeObjectURL(n),u.substr(u.lastIndexOf("/")+1)},s.serialize=function(n){for(var u=[],c=function(D){return!Number.isNaN(D)&&D!=null&&D!==""&&D!==!1},L=function(D){return Math.round(D)},C=function(D){return L(D/100)*100},x=function(D){return encodeURIComponent(D)},O={br:L,d:L,bl:C,dl:C,mtp:C,nor:x,rtp:C,tb:L},w=Object.keys(n||{}).sort(),S=R(w),T;!(T=S()).done;){var _=T.value,l=n[_];if(!c(l))continue;if(_==="v"&&l===1)continue;if(_=="pr"&&l===1)continue;var E=O[_];E&&(l=E(l));var m=typeof l,b=void 0;_==="ot"||_==="sf"||_==="st"?b=_+"="+l:m==="boolean"?b=_:m==="number"?b=_+"="+l:b=_+"="+JSON.stringify(l),u.push(b)}return u.join(",")},s.toHeaders=function(n){for(var u=Object.keys(n),c={},L=["Object","Request","Session","Status"],C=[{},{},{},{}],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,w=u;OR){this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var x=R-this._requestLicenseFailureCount+1;F.logger.warn("Retrying license request, "+x+" attempts left"),this._requestLicense(u,c)}break}},s._generateLicenseRequestChallenge=function(o,n){switch(o.mediaKeySystemDomain){case K.KeySystems.WIDEVINE:return n}throw new Error("unsupported key-system: "+o.mediaKeySystemDomain)},s._requestLicense=function(o,n){F.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){F.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var c=this.getLicenseServerUrl(u.mediaKeySystemDomain),L=this._createLicenseXhr(c,o,n);F.logger.log("Sending license request to URL: "+c);var C=this._generateLicenseRequestChallenge(u,o);L.send(C)}catch(x){F.logger.error("Failure requesting DRM license: "+x),this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.KEY_SYSTEM_ERROR,details:H.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},s.onMediaAttached=function(o,n){if(!this._emeEnabled)return;var u=n.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},s.onMediaDetached=function(){var o=this._media,n=this._mediaKeysList;if(!o)return;o.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(n.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return o.setMediaKeys(null)}).catch(function(){})},s.onManifestParsed=function(o,n){if(!this._emeEnabled)return;var u=n.levels.map(function(L){return L.audioCodec}).filter(function(L){return!!L}),c=n.levels.map(function(L){return L.videoCodec}).filter(function(L){return!!L});this._attemptKeySystemAccess(K.KeySystems.WIDEVINE,u,c)},M(h,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),h}();Z.default=f},"./src/controller/fps-controller.ts":function(le,Z,P){"use strict";P.r(Z);var Q=P("./src/events.ts"),H=P("./src/utils/logger.ts"),F=function(){function K(M){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=M,this.registerListeners()}var W=K.prototype;return W.setStreamController=function(R){this.streamController=R},W.registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},W.unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching)},W.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},W.onMediaAttaching=function(R,g){var p=this.hls.config;if(p.capLevelOnFPSDrop){var f=g.media instanceof self.HTMLVideoElement?g.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),p.fpsDroppedMonitoringPeriod)}},W.checkFPS=function(R,g,p){var f=performance.now();if(g){if(this.lastTime){var h=f-this.lastTime,s=p-this.lastDroppedFrames,d=g-this.lastDecodedFrames,o=1e3*s/h,n=this.hls;if(n.trigger(Q.Events.FPS_DROP,{currentDropped:s,currentDecoded:d,totalDroppedFrames:p}),o>0&&s>n.config.fpsDroppedMonitoringThreshold*d){var u=n.currentLevel;H.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(n.autoLevelCapping===-1||n.autoLevelCapping>=u)&&(u=u-1,n.trigger(Q.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:n.currentLevel}),n.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=f,this.lastDroppedFrames=p,this.lastDecodedFrames=g}},W.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var g=R.getVideoPlaybackQuality();this.checkFPS(R,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},K}();Z.default=F},"./src/controller/fragment-finders.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"findFragmentByPDT",function(){return F}),P.d(Z,"findFragmentByPTS",function(){return K}),P.d(Z,"fragmentWithinToleranceTest",function(){return W}),P.d(Z,"pdtWithinToleranceTest",function(){return M}),P.d(Z,"findFragWithCC",function(){return R});var Q=P("./src/polyfills/number.ts"),H=P("./src/utils/binary-search.ts");function F(g,p,f){if(p===null||!Array.isArray(g)||!g.length||!Object(Q.isFiniteNumber)(p))return null;var h=g[0].programDateTime;if(p<(h||0))return null;var s=g[g.length-1].endProgramDateTime;if(p>=(s||0))return null;f=f||0;for(var d=0;dg&&f.start?-1:0}function M(g,p,f){var h=Math.min(p,f.duration+(f.deltaPTS?f.deltaPTS:0))*1e3,s=f.endProgramDateTime||0;return s-h>g}function R(g,p){return H.default.search(g,function(f){return f.ccp?-1:0})}},"./src/controller/fragment-tracker.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"FragmentState",function(){return F}),P.d(Z,"FragmentTracker",function(){return K});var Q=P("./src/events.ts"),H=P("./src/types/loader.ts"),F;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(F||(F={}));var K=function(){function R(p){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=p,this._registerListeners()}var g=R.prototype;return g._registerListeners=function(){var f=this.hls;f.on(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.on(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.on(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var f=this.hls;f.off(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),f.off(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),f.off(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(f,h){if(h===H.PlaylistLevelType.MAIN){var s=this.activeFragment,d=this.activeParts;if(!s)return null;if(d)for(var o=d.length;o--;){var n=d[o],u=n?n.end:s.appendedPTS;if(n.start<=f&&u!==void 0&&f<=u)return o>9&&(this.activeParts=d.slice(o-9)),n}else if(s.start<=f&&s.appendedPTS!==void 0&&f<=s.appendedPTS)return s}return this.getBufferedFrag(f,h)},g.getBufferedFrag=function(f,h){for(var s=this.fragments,d=Object.keys(s),o=d.length;o--;){var n=s[d[o]];if((n==null?void 0:n.body.type)===h&&n.buffered){var u=n.body;if(u.start<=f&&f<=u.end)return u}}return null},g.detectEvictedFragments=function(f,h,s){var d=this;Object.keys(this.fragments).forEach(function(o){var n=d.fragments[o];if(!n)return;if(!n.buffered){n.body.type===s&&d.removeFragment(n.body);return}var u=n.range[f];if(!u)return;u.time.some(function(c){var L=!d.isTimeBuffered(c.startPTS,c.endPTS,h);return L&&d.removeFragment(n.body),L})})},g.detectPartialFragments=function(f){var h=this,s=this.timeRanges,d=f.frag,o=f.part;if(!s||d.sn==="initSegment")return;var n=M(d),u=this.fragments[n];if(!u)return;Object.keys(s).forEach(function(c){var L=d.elementaryStreams[c];if(!L)return;var C=s[c],x=o!==null||L.partial===!0;u.range[c]=h.getBufferedTimes(d,o,x,C)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},g.fragBuffered=function(f){var h=M(f),s=this.fragments[h];s&&(s.backtrack=s.loaded=null,s.buffered=!0)},g.getBufferedTimes=function(f,h,s,d){for(var o={time:[],partial:s},n=h?h.start:f.start,u=h?h.end:f.end,c=f.minEndPTS||u,L=f.maxStartPTS||n,C=0;C=x&&c<=O){o.time.push({startPTS:Math.max(n,d.start(C)),endPTS:Math.min(u,d.end(C))});break}else if(nx)o.partial=!0,o.time.push({startPTS:Math.max(n,d.start(C)),endPTS:Math.min(u,d.end(C))});else if(u<=x)break}return o},g.getPartialFragment=function(f){var h=null,s,d,o,n=0,u=this.bufferPadding,c=this.fragments;return Object.keys(c).forEach(function(L){var C=c[L];if(!C)return;W(C)&&(d=C.body.start-u,o=C.body.end+u,f>=d&&f<=o&&(s=Math.min(f-d,o-f),n<=s&&(h=C.body,n=s)))}),h},g.getState=function(f){var h=M(f),s=this.fragments[h];return s?s.buffered?W(s)?F.PARTIAL:F.OK:s.backtrack?F.BACKTRACKED:F.APPENDING:F.NOT_LOADED},g.backtrack=function(f,h){var s=M(f),d=this.fragments[s];if(!d||d.backtrack)return null;var o=d.backtrack=h||d.loaded;return d.loaded=null,o},g.getBacktrackData=function(f){var h=M(f),s=this.fragments[h];if(s){var d,o=s.backtrack;if(o!=null&&(d=o.payload)!==null&&d!==void 0&&d.byteLength)return o;this.removeFragment(f)}return null},g.isTimeBuffered=function(f,h,s){for(var d,o,n=0;n=d&&h<=o)return!0;if(h<=d)return!1}return!1},g.onFragLoaded=function(f,h){var s=h.frag,d=h.part;if(s.sn==="initSegment"||s.bitrateTest||d)return;var o=M(s);this.fragments[o]={body:s,loaded:h,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(f,h){var s=this,d=h.frag,o=h.part,n=h.timeRanges;if(d.type===H.PlaylistLevelType.MAIN)if(this.activeFragment=d,o){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(o)}else this.activeParts=null;this.timeRanges=n,Object.keys(n).forEach(function(c){var L=n[c];if(s.detectEvictedFragments(c,L),!o)for(var C=0;Cf&&d.removeFragment(u)}})},g.removeFragment=function(f){var h=M(f);f.stats.loaded=0,f.clearElementaryStreamInfo(),delete this.fragments[h]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function W(R){var g,p;return R.buffered&&(((g=R.range.video)===null||g===void 0?void 0:g.partial)||((p=R.range.audio)===null||p===void 0?void 0:p.partial))}function M(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"STALL_MINIMUM_DURATION_MS",function(){return W}),P.d(Z,"MAX_START_GAP_JUMP",function(){return M}),P.d(Z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),P.d(Z,"SKIP_BUFFER_RANGE_START",function(){return g}),P.d(Z,"default",function(){return p});var Q=P("./src/utils/buffer-helper.ts"),H=P("./src/errors.ts"),F=P("./src/events.ts"),K=P("./src/utils/logger.ts"),W=250,M=2,R=.1,g=.05,p=function(){function f(s,d,o,n){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=s,this.media=d,this.fragmentTracker=o,this.hls=n}var h=f.prototype;return h.destroy=function(){this.hls=this.fragmentTracker=this.media=null},h.poll=function(d){var o=this.config,n=this.media,u=this.stalled,c=n.currentTime,L=n.seeking,C=this.seeking&&!L,x=!this.seeking&&L;if(this.seeking=L,c!==d){if(this.moved=!0,u!==null){if(this.stallReported){var O=self.performance.now()-u;K.logger.warn("playback not stuck anymore @"+c+", after "+Math.round(O)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((x||C)&&(this.stalled=null),n.paused||n.ended||n.playbackRate===0||!Q.BufferHelper.getBuffered(n).length)return;var w=Q.BufferHelper.bufferInfo(n,c,0),S=w.len>0,T=w.nextStart||0;if(!S&&!T)return;if(L){var _=w.len>M,l=!T||T-c>M&&!this.fragmentTracker.getPartialFragment(c);if(_||l)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var E,m=Math.max(T,w.start||0)-c,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=b==null||((E=b.details)===null||E===void 0)?void 0:E.live,D=N?b.details.targetduration*2:M;if(m>0&&m<=D){this._trySkipBufferHole(null);return}}var B=self.performance.now();if(u===null){this.stalled=B;return}var j=B-u;!L&&j>=W&&this._reportStall(w.len);var I=Q.BufferHelper.bufferInfo(n,c,o.maxBufferHole);this._tryFixBufferStall(I,j)},h._tryFixBufferStall=function(d,o){var n=this.config,u=this.fragmentTracker,c=this.media,L=c.currentTime,C=u.getPartialFragment(L);if(C){var x=this._trySkipBufferHole(C);if(x)return}d.len>n.maxBufferHole&&o>n.highBufferWatchdogPeriod*1e3&&(K.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},h._reportStall=function(d){var o=this.hls,n=this.media,u=this.stallReported;u||(this.stallReported=!0,K.logger.warn("Playback stalling at @"+n.currentTime+" due to low buffer (buffer="+d+")"),o.trigger(F.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:d}))},h._trySkipBufferHole=function(d){for(var o=this.config,n=this.hls,u=this.media,c=u.currentTime,L=0,C=Q.BufferHelper.getBuffered(u),x=0;x=L&&c.05&&this.forwardBufferLength>1){var x=Math.min(2,Math.max(1,n)),O=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20;f.playbackRate=Math.min(x,Math.max(1,O))}else f.playbackRate!==1&&f.playbackRate!==0&&(f.playbackRate=1)},g.estimateLiveEdge=function(){var f=this.levelDetails;return f===null?null:f.edge+f.age},g.computeLatency=function(){var f=this.estimateLiveEdge();return f===null?null:f-this.currentTime},W(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var f=this.config,h=this.levelDetails;return f.liveMaxLatencyDuration!==void 0?f.liveMaxLatencyDuration:h?f.liveMaxLatencyDurationCount*h.targetduration:0}},{key:"targetLatency",get:function(){var f=this.levelDetails;if(f===null)return null;var h=f.holdBack,s=f.partHoldBack,d=f.targetduration,o=this.config,n=o.liveSyncDuration,u=o.liveSyncDurationCount,c=o.lowLatencyMode,L=this.hls.userConfig,C=c&&s||h;(L.liveSyncDuration||L.liveSyncDurationCount||C===0)&&(C=n!==void 0?n:u*d);var x=d,O=1;return C+Math.min(this.stallCount*O,x)}},{key:"liveSyncPosition",get:function(){var f=this.estimateLiveEdge(),h=this.targetLatency,s=this.levelDetails;if(f===null||h===null||s===null)return null;var d=s.edge,o=f-h-this.edgeStalled,n=d-s.totalduration,u=d-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(n,o),u)}},{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 h=(this.config.lowLatencyMode&&f.partTarget||f.targetduration)*3;return Math.max(f.age-h,0)}},{key:"forwardBufferLength",get:function(){var f=this.media,h=this.levelDetails;if(!f||!h)return 0;var s=f.buffered.length;return s?f.buffered.end(s-1):h.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return o});var Q=P("./src/types/level.ts"),H=P("./src/events.ts"),F=P("./src/errors.ts"),K=P("./src/utils/codecs.ts"),W=P("./src/controller/level-helper.ts"),M=P("./src/controller/base-playlist-controller.ts"),R=P("./src/types/loader.ts");function g(){return g=Object.assign||function(n){for(var u=1;u0){T=O[0].bitrate,O.sort(function(j,I){return j.bitrate-I.bitrate}),this._levels=O;for(var N=0;Nthis.hls.config.fragLoadingMaxRetry&&(_=x.frag.level)):_=x.frag.level}break;case F.ErrorDetails.LEVEL_LOAD_ERROR:case F.ErrorDetails.LEVEL_LOAD_TIMEOUT:O&&(O.deliveryDirectives&&(T=!1),_=O.level),S=!0;break;case F.ErrorDetails.REMUX_ALLOC_ERROR:_=x.level,S=!0;break}_!==void 0&&this.recoverLevel(x,_,S,T)},c.recoverLevel=function(C,x,O,w){var S=C.details,T=this._levels[x];if(T.loadError++,O){var _=this.retryLoadingOrFail(C);if(_)C.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(w){var l=T.url.length;if(l>1&&T.loadError1){var w=(x.urlId+1)%O;this.warn("Switching to redundant URL-id "+w),this._levels.forEach(function(S){S.urlId=w}),this.level=C}},c.onFragLoaded=function(C,x){var O=x.frag;if(O!==void 0&&O.type===R.PlaylistLevelType.MAIN){var w=this._levels[O.level];w!==void 0&&(w.fragmentError=0,w.loadError=0)}},c.onLevelLoaded=function(C,x){var O,w=x.level,S=x.details,T=this._levels[w];if(!T){var _;this.warn("Invalid level index "+w),(_=x.deliveryDirectives)!==null&&_!==void 0&&_.skip&&(S.deltaUpdateFailed=!0);return}w===this.currentLevelIndex?(T.fragmentError===0&&(T.loadError=0,this.retryCount=0),this.playlistLoaded(w,x,T.details)):(O=x.deliveryDirectives)!==null&&O!==void 0&&O.skip&&(S.deltaUpdateFailed=!0)},c.onAudioTrackSwitched=function(C,x){var O=this.hls.levels[this.currentLevelIndex];if(!O)return;if(O.audioGroupIds){for(var w=-1,S=this.hls.audioTracks[x.id].groupId,T=0;T0){var w=O.urlId,S=O.url[w];if(C)try{S=C.addDirectives(S)}catch(T){this.warn("Could not construct new URL with HLS Delivery Directives: "+T)}this.log("Attempt loading level index "+x+(C?" at sn "+C.msn+" part "+C.part:"")+" with URL-id "+w+" "+S),this.clearTimer(),this.hls.trigger(H.Events.LEVEL_LOADING,{url:S,level:x,id:w,deliveryDirectives:C||null})}},c.removeLevel=function(C,x){var O=function(T,_){return _!==x},w=this._levels.filter(function(S,T){return T!==C?!0:S.url.length>1&&x!==void 0?(S.url=S.url.filter(O),S.audioGroupIds&&(S.audioGroupIds=S.audioGroupIds.filter(O)),S.textGroupIds&&(S.textGroupIds=S.textGroupIds.filter(O)),S.urlId=0,!0):!1}).map(function(S,T){var _=S.details;return _!=null&&_.fragments&&_.fragments.forEach(function(l){l.level=T}),S});this._levels=w,this.hls.trigger(H.Events.LEVELS_UPDATED,{levels:w})},f(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(C){var x,O=this._levels;if(O.length===0)return;if(this.currentLevelIndex===C&&(x=O[C])!==null&&x!==void 0&&x.details)return;if(C<0||C>=O.length){var w=C<0;if(this.hls.trigger(H.Events.ERROR,{type:F.ErrorTypes.OTHER_ERROR,details:F.ErrorDetails.LEVEL_SWITCH_ERROR,level:C,fatal:w,reason:"invalid level idx"}),w)return;C=Math.min(C,O.length-1)}this.clearTimer();var S=this.currentLevelIndex,T=O[S],_=O[C];this.log("switching to level "+C+" from "+S),this.currentLevelIndex=C;var l=g({},_,{level:C,maxBitrate:_.maxBitrate,uri:_.uri,urlId:_.urlId});delete l._urlId,this.hls.trigger(H.Events.LEVEL_SWITCHING,l);var E=_.details;if(!E||E.live){var m=this.switchParams(_.uri,T==null?void 0:T.details);this.loadPlaylist(m)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(C){this.manualLevelIndex=C,this._startLevel===void 0&&(this._startLevel=C),C!==-1&&(this.level=C)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(C){this._firstLevel=C}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var C=this.hls.config.startLevel;return C!==void 0?C:this._firstLevel}else return this._startLevel},set:function(C){this._startLevel=C}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(C){this.level=C,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=C)}}]),u}(M.default)},"./src/controller/level-helper.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"addGroupId",function(){return F}),P.d(Z,"assignTrackIdsByGroup",function(){return K}),P.d(Z,"updatePTS",function(){return W}),P.d(Z,"updateFragPTSDTS",function(){return R}),P.d(Z,"mergeDetails",function(){return g}),P.d(Z,"mapPartIntersection",function(){return p}),P.d(Z,"mapFragmentIntersection",function(){return f}),P.d(Z,"adjustSliding",function(){return h}),P.d(Z,"addSliding",function(){return s}),P.d(Z,"computeReloadInterval",function(){return d}),P.d(Z,"getFragmentWithSN",function(){return o}),P.d(Z,"getPartWith",function(){return n});var Q=P("./src/polyfills/number.ts"),H=P("./src/utils/logger.ts");function F(u,c,L){switch(c){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(L);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(L);break}}function K(u){var c={};u.forEach(function(L){var C=L.groupId||"";L.id=c[C]=c[C]||0,c[C]++})}function W(u,c,L){var C=u[c],x=u[L];M(C,x)}function M(u,c){var L=c.startPTS;if(Object(Q.isFiniteNumber)(L)){var C=0,x;c.sn>u.sn?(C=L-u.start,x=u):(C=u.start-L,x=c),x.duration!==C&&(x.duration=C)}else if(c.sn>u.sn){var O=u.cc===c.cc;O&&u.minEndPTS?c.start=u.start+(u.minEndPTS-u.start):c.start=u.start+u.duration}else c.start=Math.max(u.start-c.duration,0)}function R(u,c,L,C,x,O){var w=C-L;w<=0&&(H.logger.warn("Fragment should have a positive duration",c),C=L+c.duration,O=x+c.duration);var S=L,T=C,_=c.startPTS,l=c.endPTS;if(Object(Q.isFiniteNumber)(_)){var E=Math.abs(_-L);Object(Q.isFiniteNumber)(c.deltaPTS)?c.deltaPTS=Math.max(E,c.deltaPTS):c.deltaPTS=E,S=Math.max(L,_),L=Math.min(L,_),x=Math.min(x,c.startDTS),T=Math.min(C,l),C=Math.max(C,l),O=Math.max(O,c.endDTS)}c.duration=C-L;var m=L-c.start;c.appendedPTS=C,c.start=c.startPTS=L,c.maxStartPTS=S,c.startDTS=x,c.endPTS=C,c.minEndPTS=T,c.endDTS=O;var b=c.sn;if(!u||bu.endSN)return 0;var N,D=b-u.startSN,B=u.fragments;for(B[D]=c,N=D;N>0;N--)M(B[N],B[N-1]);for(N=D;N=0;x--){var O=C[x].initSegment;if(O){L=O;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var w=0,S;if(f(u,c,function(N,D){N.relurl&&(w=N.cc-D.cc),Object(Q.isFiniteNumber)(N.startPTS)&&Object(Q.isFiniteNumber)(N.endPTS)&&(D.start=D.startPTS=N.startPTS,D.startDTS=N.startDTS,D.appendedPTS=N.appendedPTS,D.maxStartPTS=N.maxStartPTS,D.endPTS=N.endPTS,D.endDTS=N.endDTS,D.minEndPTS=N.minEndPTS,D.duration=N.endPTS-N.startPTS,D.duration&&(S=D),c.PTSKnown=c.alignedSliding=!0),D.elementaryStreams=N.elementaryStreams,D.loader=N.loader,D.stats=N.stats,D.urlId=N.urlId,N.initSegment&&(D.initSegment=N.initSegment,L=N.initSegment)}),L){var T=c.fragmentHint?c.fragments.concat(c.fragmentHint):c.fragments;T.forEach(function(N){var D;(!N.initSegment||N.initSegment.relurl===((D=L)===null||D===void 0?void 0:D.relurl))&&(N.initSegment=L)})}if(c.skippedSegments&&(c.deltaUpdateFailed=c.fragments.some(function(N){return!N}),c.deltaUpdateFailed)){H.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var _=c.skippedSegments;_--;)c.fragments.shift();c.startSN=c.fragments[0].sn,c.startCC=c.fragments[0].cc}var l=c.fragments;if(w){H.logger.warn("discontinuity sliding from playlist, take drift into account");for(var E=0;E=C.length)return;s(c,C[L].start)}function s(u,c){if(c){for(var L=u.fragments,C=u.skippedSegments;C0&&x0&&T===-1&&(this.log("Override startPosition with lastCurrentTime @"+_.toFixed(3)),T=_),this.state=H.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=T,this.tick()}else this._forceStartLoad=!0,this.state=H.State.STOPPED},w.stopLoad=function(){this._forceStartLoad=!1,x.prototype.stopLoad.call(this)},w.doTick=function(){switch(this.state){case H.State.IDLE:this.doTickIdle();break;case H.State.WAITING_LEVEL:{var T,_=this.levels,l=this.level,E=_==null||((T=_[l])===null||T===void 0)?void 0:T.details;if(E&&(!E.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(E))break;this.state=H.State.IDLE;break}break}case H.State.FRAG_LOADING_WAITING_RETRY:{var m,b=self.performance.now(),N=this.retryDate;(!N||b>=N||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=H.State.IDLE)}break;default:break}this.onTickEnd()},w.onTickEnd=function(){x.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},w.doTickIdle=function(){var T,_,l=this.hls,E=this.levelLastLoaded,m=this.levels,b=this.media,N=l.config,D=l.nextLoadLevel;if(E===null||!b&&(this.startFragRequested||!N.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[D])return;var B=m[D];this.level=l.nextLoadLevel=D;var j=B.details;if(!j||this.state===H.State.WAITING_LEVEL||j.live&&this.levelLastLoaded!==D){this.state=H.State.WAITING_LEVEL;return}var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:b,R.PlaylistLevelType.MAIN);if(I===null)return;var v=I.len,G=this.getMaxBufferLength(B.maxBitrate);if(v>=G)return;if(this._streamEnded(I,j)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(K.Events.BUFFER_EOS,Y),this.state=H.State.ENDED;return}var re=I.end,oe=this.getNextFragment(re,j);if(this.couldBacktrack&&!this.fragPrevious&&oe&&oe.sn!=="initSegment"){var we=oe.sn-j.startSN;we>1&&(oe=j.fragments[we-1],this.fragmentTracker.removeFragment(oe))}if(oe&&this.fragmentTracker.getState(oe)===M.FragmentState.OK&&this.nextLoadPosition>re){var pe=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(b,pe,R.PlaylistLevelType.MAIN),oe=this.getNextFragment(this.nextLoadPosition,j)}if(!oe)return;oe.initSegment&&!oe.initSegment.data&&!this.bitrateTest&&(oe=oe.initSegment),((T=oe.decryptdata)===null||T===void 0?void 0:T.keyFormat)==="identity"&&!((_=oe.decryptdata)!==null&&_!==void 0&&_.key)?this.loadKey(oe,j):this.loadFragment(oe,j,re)},w.loadFragment=function(T,_,l){var E,m=this.fragmentTracker.getState(T);if(this.fragCurrent=T,m===M.FragmentState.BACKTRACKED){var b=this.fragmentTracker.getBacktrackData(T);if(b){this._handleFragmentLoadProgress(b),this._handleFragmentLoadComplete(b);return}else m=M.FragmentState.NOT_LOADED}m===M.FragmentState.NOT_LOADED||m===M.FragmentState.PARTIAL?T.sn==="initSegment"?this._loadInitSegment(T):this.bitrateTest?(T.bitrateTest=!0,this.log("Fragment "+T.sn+" of level "+T.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(T)):(this.startFragRequested=!0,x.prototype.loadFragment.call(this,T,_,l)):m===M.FragmentState.APPENDING?this.reduceMaxBufferLength(T.duration)&&this.fragmentTracker.removeFragment(T):((E=this.media)===null||E===void 0?void 0:E.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},w.getAppendedFrag=function(T){var _=this.fragmentTracker.getAppendedFrag(T,R.PlaylistLevelType.MAIN);return _&&"fragment"in _?_.fragment:_},w.getBufferedFrag=function(T){return this.fragmentTracker.getBufferedFrag(T,R.PlaylistLevelType.MAIN)},w.followingBufferedFrag=function(T){return T?this.getBufferedFrag(T.end+.5):null},w.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},w.nextLevelSwitch=function(){var T=this.levels,_=this.media;if(_!=null&&_.readyState){var l,E=this.getAppendedFrag(_.currentTime);if(E&&E.start>1&&this.flushMainBuffer(0,E.start-1),!_.paused&&T){var m=this.hls.nextLoadLevel,b=T[m],N=this.fragLastKbps;N&&this.fragCurrent?l=this.fragCurrent.duration*b.maxBitrate/(1e3*N)+1:l=0}else l=0;var D=this.getBufferedFrag(_.currentTime+l);if(D){var B=this.followingBufferedFrag(D);if(B){this.abortCurrentFrag();var j=B.maxStartPTS?B.maxStartPTS:B.start,I=B.duration,v=Math.max(D.end,j+Math.min(Math.max(I-this.config.maxFragLookUpTolerance,I*.5),I*.75));this.flushMainBuffer(v,Number.POSITIVE_INFINITY)}}}},w.abortCurrentFrag=function(){var T=this.fragCurrent;this.fragCurrent=null,T!=null&&T.loader&&T.loader.abort(),this.state===H.State.KEY_LOADING&&(this.state=H.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},w.flushMainBuffer=function(T,_){x.prototype.flushMainBuffer.call(this,T,_,this.altAudio?"video":null)},w.onMediaAttached=function(T,_){x.prototype.onMediaAttached.call(this,T,_);var l=_.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),l.addEventListener("playing",this.onvplaying),l.addEventListener("seeked",this.onvseeked),this.gapController=new h.default(this.config,l,this.fragmentTracker,this.hls)},w.onMediaDetaching=function(){var T=this.media;T&&(T.removeEventListener("playing",this.onvplaying),T.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)},w.onMediaPlaying=function(){this.tick()},w.onMediaSeeked=function(){var T=this.media,_=T?T.currentTime:null;Object(Q.isFiniteNumber)(_)&&this.log("Media seeked to "+_.toFixed(3)),this.tick()},w.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(K.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},w.onManifestParsed=function(T,_){var l=!1,E=!1,m;_.levels.forEach(function(b){m=b.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(l=!0),m.indexOf("mp4a.40.5")!==-1&&(E=!0))}),this.audioCodecSwitch=l&&E&&!Object(F.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=_.levels,this.startFragRequested=!1},w.onLevelLoading=function(T,_){var l=this.levels;if(!l||this.state!==H.State.IDLE)return;var E=l[_.level];(!E.details||E.details.live&&this.levelLastLoaded!==_.level||this.waitForCdnTuneIn(E.details))&&(this.state=H.State.WAITING_LEVEL)},w.onLevelLoaded=function(T,_){var l,E=this.levels,m=_.level,b=_.details,N=b.totalduration;if(!E){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+b.startSN+","+b.endSN+"], cc ["+b.startCC+", "+b.endCC+"] duration:"+N);var D=this.fragCurrent;D&&(this.state===H.State.FRAG_LOADING||this.state===H.State.FRAG_LOADING_WAITING_RETRY)&&(D.level!==_.level&&D.loader&&(this.state=H.State.IDLE,D.loader.abort()));var B=E[m],j=0;if(b.live||(l=B.details)!==null&&l!==void 0&&l.live){if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed)return;j=this.alignPlaylists(b,B.details)}if(B.details=b,this.levelLastLoaded=m,this.hls.trigger(K.Events.LEVEL_UPDATED,{details:b,level:m}),this.state===H.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(b))return;this.state=H.State.IDLE}this.startFragRequested?b.live&&this.synchronizeToLiveEdge(b):this.setStartPosition(b,j),this.tick()},w._handleFragmentLoadProgress=function(T){var _,l=T.frag,E=T.part,m=T.payload,b=this.levels;if(!b){this.warn("Levels were reset while fragment load was in progress. Fragment "+l.sn+" of level "+l.level+" will not be buffered");return}var N=b[l.level],D=N.details;if(!D){this.warn("Dropping fragment "+l.sn+" of level "+l.level+" after level details were reset");return}var B=N.videoCodec,j=D.PTSKnown||!D.live,I=(_=l.initSegment)===null||_===void 0?void 0:_.data,v=this._getAudioCodec(N),G=this.transmuxer=this.transmuxer||new p.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=E?E.index:-1,re=Y!==-1,oe=new f.ChunkMetadata(l.level,l.sn,l.stats.chunkCount,m.byteLength,Y,re),we=this.initPTS[l.cc];G.push(m,I,v,B,l,E,D.totalduration,j,oe,we)},w.onAudioTrackSwitching=function(T,_){var l=this.altAudio,E=!!_.url,m=_.id;if(!E){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 N=this.hls;l&&N.trigger(K.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),N.trigger(K.Events.AUDIO_TRACK_SWITCHED,{id:m})}},w.onAudioTrackSwitched=function(T,_){var l=_.id,E=!!this.hls.audioTracks[l].url;if(E){var m=this.videoBuffer;m&&this.mediaBuffer!==m&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=m)}this.altAudio=E,this.tick()},w.onBufferCreated=function(T,_){var l=_.tracks,E,m,b=!1;for(var N in l){var D=l[N];if(D.id==="main"){if(m=N,E=D,N==="video"){var B=l[N];B&&(this.videoBuffer=B.buffer)}}else b=!0}b&&E?(this.log("Alternate track found, use "+m+".buffered to schedule main fragment loading"),this.mediaBuffer=E.buffer):this.mediaBuffer=this.media},w.onFragBuffered=function(T,_){var l=_.frag,E=_.part;if(l&&l.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(l)){this.warn("Fragment "+l.sn+(E?" p: "+E.index:"")+" of level "+l.level+" finished buffering, but was aborted. state: "+this.state),this.state===H.State.PARSED&&(this.state=H.State.IDLE);return}var m=E?E.stats:l.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),l.sn!=="initSegment"&&(this.fragPrevious=l),this.fragBufferedComplete(l,E)},w.onError=function(T,_){switch(_.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,_);break;case s.ErrorDetails.LEVEL_LOAD_ERROR:case s.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==H.State.ERROR&&(_.fatal?(this.warn(""+_.details),this.state=H.State.ERROR):!_.levelRetry&&this.state===H.State.WAITING_LEVEL&&(this.state=H.State.IDLE));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if(_.parent==="main"&&(this.state===H.State.PARSING||this.state===H.State.PARSED)){var l=!0,E=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);E&&E.len>.5&&(l=!this.reduceMaxBufferLength(E.len)),l&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},w.checkBuffer=function(){var T=this.media,_=this.gapController;if(!T||!_||!T.readyState)return;var l=W.BufferHelper.getBuffered(T);!this.loadedmetadata&&l.length?(this.loadedmetadata=!0,this.seekToStartPos()):_.poll(this.lastCurrentTime),this.lastCurrentTime=T.currentTime},w.onFragLoadEmergencyAborted=function(){this.state=H.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},w.onBufferFlushed=function(T,_){var l=_.type;if(l!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var E=(l===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(E,l,R.PlaylistLevelType.MAIN)}},w.onLevelsUpdated=function(T,_){this.levels=_.levels},w.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},w.seekToStartPos=function(){var T=this.media,_=T.currentTime,l=this.startPosition;if(l>=0&&_0&&(b1&&T.seeking===!1){var l=T.currentTime;if(W.BufferHelper.isBuffered(T,l)?_=this.getAppendedFrag(l):W.BufferHelper.isBuffered(T,l+.1)&&(_=this.getAppendedFrag(l+.1)),_){var E=this.fragPlaying,m=_.level;(!E||_.sn!==E.sn||E.level!==m||_.urlId!==E.urlId)&&(this.hls.trigger(K.Events.FRAG_CHANGED,{frag:_}),(!E||E.level!==m)&&this.hls.trigger(K.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=_)}}},n(O,[{key:"nextLevel",get:function(){var T=this.nextBufferedFrag;return T?T.level:-1}},{key:"currentLevel",get:function(){var T=this.media;if(T){var _=this.getAppendedFrag(T.currentTime);if(_)return _.level}return-1}},{key:"nextBufferedFrag",get:function(){var T=this.media;if(T){var _=this.getAppendedFrag(T.currentTime);return this.followingBufferedFrag(_)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),O}(H.default)},"./src/controller/subtitle-stream-controller.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"SubtitleStreamController",function(){return u});var Q=P("./src/events.ts"),H=P("./src/utils/logger.ts"),F=P("./src/utils/buffer-helper.ts"),K=P("./src/controller/fragment-finders.ts"),W=P("./src/utils/discontinuities.ts"),M=P("./src/controller/level-helper.ts"),R=P("./src/controller/fragment-tracker.ts"),g=P("./src/controller/base-stream-controller.ts"),p=P("./src/types/loader.ts"),f=P("./src/types/level.ts");function h(c,L){for(var C=0;C=_[m].start&&E<=_[m].end){l=_[m];break}var b=S.start+S.duration;l?l.end=b:(l={start:E,end:b},_.push(l)),this.fragmentTracker.fragBuffered(S)},C.onBufferFlushing=function(O,w){var S=w.startOffset,T=w.endOffset;if(S===0&&T!==Number.POSITIVE_INFINITY){var _=this.currentTrackId,l=this.levels;if(!l.length||!l[_]||!l[_].details)return;var E=l[_].details,m=E.targetduration,b=T-m;if(b<=0)return;w.endOffsetSubtitles=Math.max(0,b),this.tracksBuffered.forEach(function(N){for(var D=0;D=E.length||_!==l||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,T.live||(S=m.details)!==null&&S!==void 0&&S.live){var b=this.mainDetails;if(T.deltaUpdateFailed||!b)return;var N=b.fragments[0];if(!m.details)T.hasProgramDateTime&&b.hasProgramDateTime?Object(W.alignMediaPlaylistByPDT)(T,b):N&&Object(M.addSliding)(T,N.start);else{var D=this.alignPlaylists(T,m.details);D===0&&N&&Object(M.addSliding)(T,N.start)}}if(m.details=T,this.levelLastLoaded=_,this.tick(),T.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var B=Object(K.findFragmentByPTS)(null,T.fragments,this.media.currentTime,0);B||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},C._handleFragmentLoadComplete=function(O){var w=O.frag,S=O.payload,T=w.decryptdata,_=this.hls;if(this.fragContextChanged(w))return;if(S&&S.byteLength>0&&T&&T.key&&T.iv&&T.method==="AES-128"){var l=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(S),T.key.buffer,T.iv.buffer).then(function(E){var m=performance.now();_.trigger(Q.Events.FRAG_DECRYPTED,{frag:w,payload:E,stats:{tstart:l,tdecrypt:m}})})}},C.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var O,w=this.currentTrackId,S=this.levels;if(!S.length||!S[w]||!S[w].details)return;var T=S[w].details,_=T.targetduration,l=this.config,E=this.media,m=F.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,E.currentTime-_,l.maxBufferHole),b=m.end,N=m.len,D=this.getMaxBufferLength()+_;if(N>D)return;console.assert(T,"Subtitle track details are defined on idle subtitle stream controller tick");var B=T.fragments,j=B.length,I=T.edge,v,G=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(n){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,n)},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 n=f(this.media.textTracks);n.forEach(function(u){Object(H.clearCurrentCues)(u)}),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(n,u){this.tracks=u.subtitleTracks},d.onSubtitleTrackLoaded=function(n,u){var c=u.id,L=u.details,C=this.trackId,x=this.tracksInGroup[C];if(!x){this.warn("Invalid subtitle track id "+c);return}var O=x.details;x.details=u.details,this.log("subtitle track "+c+" loaded ["+L.startSN+"-"+L.endSN+"]"),c===this.trackId&&(this.retryCount=0,this.playlistLoaded(c,u,O))},d.onLevelLoading=function(n,u){this.switchLevel(u.level)},d.onLevelSwitching=function(n,u){this.switchLevel(u.level)},d.switchLevel=function(n){var u=this.hls.levels[n];if(!(u!=null&&u.textGroupIds))return;var c=u.textGroupIds[u.urlId];if(this.groupId!==c){var L=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,C=this.tracks.filter(function(w){return!c||w.groupId===c});this.tracksInGroup=C;var x=this.findTrackId(L==null?void 0:L.name)||this.findTrackId();this.groupId=c;var O={subtitleTracks:C};this.log("Updating subtitle tracks, "+C.length+' track(s) found in "'+c+'" group-id'),this.hls.trigger(Q.Events.SUBTITLE_TRACKS_UPDATED,O),x!==-1&&this.setSubtitleTrack(x,L)}},d.findTrackId=function(n){for(var u=this.tracksInGroup,c=0;c=L.length)return;this.clearTimer();var C=L[n];if(this.log("Switching to subtitle track "+n),this.trackId=n,C){var x=C.id,O=C.groupId,w=O===void 0?"":O,S=C.name,T=C.type,_=C.url;this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:x,groupId:w,name:S,type:T,url:_});var l=this.switchParams(C.url,u==null?void 0:u.details);this.loadPlaylist(l)}else this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:n})},d.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var n=-1,u=f(this.media.textTracks),c=0;c=0&&(T[0]=Math.min(T[0],L),T[1]=Math.max(T[1],C),w=!0,_/(C-L)>.5))return}if(w||O.push([L,C]),this.config.renderTextTracksNatively){var l=this.captionsTracks[c];this.Cues.newCue(l,L,C,x)}else{var E=this.Cues.newCue(null,L,C,x);this.hls.trigger(H.Events.CUES_PARSED,{type:"captions",cues:E,track:c})}},n.onInitPtsFound=function(c,L){var C=this,x=L.frag,O=L.id,w=L.initPTS,S=L.timescale,T=this.unparsedVttFrags;O==="main"&&(this.initPTS[x.cc]=w,this.timescale[x.cc]=S),T.length&&(this.unparsedVttFrags=[],T.forEach(function(_){C.onFragLoaded(H.Events.FRAG_LOADED,_)}))},n.getExistingTrack=function(c){var L=this.media;if(L)for(var C=0;C>>8^S&255^99,R[x]=S,g[S]=x;var T=C[x],_=C[T],l=C[_],E=C[S]*257^S*16843008;f[x]=E<<24|E>>>8,h[x]=E<<16|E>>>16,s[x]=E<<8|E>>>24,d[x]=E,E=l*16843009^_*65537^T*257^x*16843008,n[S]=E<<24|E>>>8,u[S]=E<<16|E>>>16,c[S]=E<<8|E>>>24,L[S]=E,x?(x=T^C[C[C[l^T]]],O^=C[C[O]]):x=O=1}},W.expandKey=function(R){for(var g=this.uint8ArrayToUint32Array_(R),p=!0,f=0;f>>6)+1;var E=(c[L+2]&60)>>>2;if(E>l.length-1){u.trigger(F.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+E});return}return w=(c[L+2]&1)<<2,w|=(c[L+3]&192)>>>6,Q.logger.log("manifest codec:"+C+", ADTS type:"+x+", samplingIndex:"+E),/firefox/i.test(T)?E>=6?(x=5,S=new Array(4),O=E-3):(x=2,S=new Array(2),O=E):T.indexOf("android")!==-1?(x=2,S=new Array(2),O=E):(x=5,S=new Array(4),C&&(C.indexOf("mp4a.40.29")!==-1||C.indexOf("mp4a.40.5")!==-1)||!C&&E>=6?O=E-3:((C&&C.indexOf("mp4a.40.2")!==-1&&(E>=6&&w===1||/vivaldi/i.test(T))||!C&&w===1)&&(x=2,S=new Array(2)),O=E)),S[0]=x<<3,S[0]|=(E&14)>>1,S[1]|=(E&1)<<7,S[1]|=w<<3,x===5&&(S[1]|=(O&14)>>1,S[2]=(O&1)<<7,S[2]|=2<<2,S[3]=0),{config:S,samplerate:l[E],channelCount:w,codec:"mp4a.40."+x,manifestCodec:_}}function W(u,c){return u[c]===255&&(u[c+1]&246)===240}function M(u,c){return u[c+1]&1?7:9}function R(u,c){return(u[c+3]&3)<<11|u[c+4]<<3|(u[c+5]&224)>>>5}function g(u,c){return c+5=u.length)return!1;var C=R(u,c);if(C<=L)return!1;var x=c+C;return x===u.length||p(u,x)}return!1}function s(u,c,L,C,x){if(!u.samplerate){var O=K(c,L,C,x);if(!O)return;u.config=O.config,u.samplerate=O.samplerate,u.channelCount=O.channelCount,u.codec=O.codec,u.manifestCodec=O.manifestCodec,Q.logger.log("parsed codec:"+u.codec+", rate:"+O.samplerate+", channels:"+O.channelCount)}}function d(u){return 1024*9e4/u}function o(u,c,L,C,x){var O=M(u,c),w=R(u,c);if(w-=O,w>0){var S=L+C*x;return{headerLength:O,frameLength:w,stamp:S}}}function n(u,c,L,C,x){var O=d(u.samplerate),w=o(c,L,C,x,O);if(w){var S=w.frameLength,T=w.headerLength,_=w.stamp,l=T+S,E=Math.max(0,L+l-c.length),m;E?(m=new Uint8Array(l-T),m.set(c.subarray(L+T,c.length),0)):m=c.subarray(L+T,L+l);var b={unit:m,pts:_};return E||u.samples.push(b),{sample:b,length:l,missing:E}}}},"./src/demux/base-audio-demuxer.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"initPTSFn",function(){return R});var Q=P("./src/polyfills/number.ts"),H=P("./src/demux/id3.ts"),F=P("./src/demux/dummy-demuxed-track.ts"),K=P("./src/utils/mp4-tools.ts"),W=P("./src/utils/typed-array.ts"),M=function(){function g(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var p=g.prototype;return p.resetInitSegment=function(h,s,d){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},p.resetTimeStamp=function(){},p.resetContiguity=function(){},p.canParse=function(h,s){return!1},p.appendFrame=function(h,s,d){},p.demux=function(h,s){this.cachedData&&(h=Object(K.appendUint8Array)(this.cachedData,h),this.cachedData=null);var d=H.getID3Data(h,0),o=d?d.length:0,n,u,c=this._audioTrack,L=this._id3Track,C=d?H.getTimeStamp(d):void 0,x=h.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(C,s)),d&&d.length>0&&L.samples.push({pts:this.initPTS,dts:this.initPTS,data:d}),u=this.initPTS;oM?(this.word<<=M,this.bitsAvailable-=M):(M-=this.bitsAvailable,R=M>>3,M-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=M,this.bitsAvailable-=M)},K.readBits=function(M){var R=Math.min(this.bitsAvailable,M),g=this.word>>>32-R;return M>32&&Q.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=M-R,R>0&&this.bitsAvailable?g<>>M)!==0)return this.word<<=M,this.bitsAvailable-=M,M;return this.loadWord(),M+this.skipLZ()},K.skipUEG=function(){this.skipBits(1+this.skipLZ())},K.skipEG=function(){this.skipBits(1+this.skipLZ())},K.readUEG=function(){var M=this.skipLZ();return this.readBits(M+1)-1},K.readEG=function(){var M=this.readUEG();return 1&M?1+M>>>1:-1*(M>>>1)},K.readBoolean=function(){return this.readBits(1)===1},K.readUByte=function(){return this.readBits(8)},K.readUShort=function(){return this.readBits(16)},K.readUInt=function(){return this.readBits(32)},K.skipScalingList=function(M){for(var R=8,g=8,p,f=0;f0?x.subarray(w,w+S):void 0},K=function(x,O){var w=0;return w=(x[O]&127)<<21,w|=(x[O+1]&127)<<14,w|=(x[O+2]&127)<<7,w|=x[O+3]&127,w},W=function(x,O){return Q(x,O)&&K(x,O+6)+10<=x.length-O},M=function(x){for(var O=p(x),w=0;w>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b+=String.fromCharCode(l);break;case 12:case 13:E=x[N++],b+=String.fromCharCode((l&31)<<6|E&63);break;case 14:E=x[N++],m=x[N++],b+=String.fromCharCode((l&15)<<12|(E&63)<<6|(m&63)<<0);break;default:}}return b},u={decodeTextFrame:s},c;function L(){return!c&&typeof self.TextDecoder!="undefined"&&(c=new self.TextDecoder("utf-8")),c}},"./src/demux/mp3demuxer.ts":function(le,Z,P){"use strict";P.r(Z);var Q=P("./src/demux/base-audio-demuxer.ts"),H=P("./src/demux/id3.ts"),F=P("./src/utils/logger.ts"),K=P("./src/demux/mpegaudio.ts");function W(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,M(g,p)}function M(g,p){return M=Object.setPrototypeOf||function(h,s){return h.__proto__=s,h},M(g,p)}var R=function(g){W(p,g);function p(){return g.apply(this,arguments)||this}var f=p.prototype;return f.resetInitSegment=function(s,d,o){g.prototype.resetInitSegment.call(this,s,d,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:s,duration:o,inputTimeScale:9e4,dropped:0}},p.probe=function(s){if(!s)return!1;for(var d=H.getID3Data(s,0)||[],o=d.length,n=s.length;o0},W.demux=function(R){var g=R,p=Object(H.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(Q.appendUint8Array)(this.remainderData,R));var f=Object(Q.segmentValidRange)(g);this.remainderData=f.remainder,p.samples=f.valid||new Uint8Array}else p.samples=g;return{audioTrack:Object(H.dummyTrack)(),avcTrack:p,id3Track:Object(H.dummyTrack)(),textTrack:Object(H.dummyTrack)()}},W.flush=function(){var R=Object(H.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(H.dummyTrack)(),avcTrack:R,id3Track:Object(H.dummyTrack)(),textTrack:Object(H.dummyTrack)()}},W.demuxSampleAes=function(R,g,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},W.destroy=function(){},K}();F.minProbeByteLength=1024,Z.default=F},"./src/demux/mpegaudio.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"appendFrame",function(){return M}),P.d(Z,"parseHeader",function(){return R}),P.d(Z,"isHeaderPattern",function(){return g}),P.d(Z,"isHeader",function(){return p}),P.d(Z,"canParse",function(){return f}),P.d(Z,"probe",function(){return h});var Q=null,H=[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],F=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],K=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],W=[0,1,1,4];function M(s,d,o,n,u){if(o+24>d.length)return;var c=R(d,o);if(c&&o+c.frameLength<=d.length){var L=c.samplesPerFrame*9e4/c.sampleRate,C=n+u*L,x={unit:d.subarray(o,o+c.frameLength),pts:C,dts:C};return s.config=[],s.channelCount=c.channelCount,s.samplerate=c.sampleRate,s.samples.push(x),{sample:x,length:c.frameLength,missing:0}}}function R(s,d){var o=s[d+1]>>3&3,n=s[d+1]>>1&3,u=s[d+2]>>4&15,c=s[d+2]>>2&3;if(o!==1&&u!==0&&u!==15&&c!==3){var L=s[d+2]>>1&1,C=s[d+3]>>6,x=o===3?3-n:n===3?3:4,O=H[x*14+u-1]*1e3,w=o===3?0:o===2?1:2,S=F[w*3+c],T=C===3?1:2,_=K[o][n],l=W[n],E=_*8*l,m=Math.floor(_*O/S+L)*l;if(Q===null){var b=navigator.userAgent||"",N=b.match(/Chrome\/(\d+)/i);Q=N?parseInt(N[1]):0}var D=!!Q&&Q<=87;return D&&n===2&&O>=224e3&&C===0&&(s[d+3]=s[d+3]|128),{sampleRate:S,channelCount:T,frameLength:m,samplesPerFrame:E}}}function g(s,d){return s[d]===255&&(s[d+1]&224)===224&&(s[d+1]&6)!==0}function p(s,d){return d+1=R.length){p();return}if(R[g].unit.length<32)continue;var f=this.decrypter.isSync();if(this.decryptAacSample(R,g,p,f),!f)return}},W.getAvcEncryptedData=function(R){for(var g=Math.floor((R.length-48)/160)*16+16,p=new Int8Array(g),f=0,h=32;h<=R.length-16;h+=160,f+=16)p.set(R.subarray(h,h+16),f);return p},W.getAvcDecryptedUnit=function(R,g){for(var p=new Uint8Array(g),f=0,h=32;h<=R.length-16;h+=160,f+=16)R.set(p.subarray(f,f+16),h);return R},W.decryptAvcSample=function(R,g,p,f,h,s){var d=Object(H.discardEPB)(h.data),o=this.getAvcEncryptedData(d),n=this;this.decryptBuffer(o.buffer,function(u){h.data=n.getAvcDecryptedUnit(d,u),s||n.decryptAvcSamples(R,g,p+1,f)})},W.decryptAvcSamples=function(R,g,p,f){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,p=0){if(g>=R.length){f();return}for(var h=R[g].units;!(p>=h.length);p++){var s=h[p];if(s.data.length<=48||s.type!==1&&s.type!==5)continue;var d=this.decrypter.isSync();if(this.decryptAvcSample(R,g,p,f,s,d),!d)return}}},K}();Z.default=F},"./src/demux/transmuxer-interface.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return h});var Q=P("./node_modules/webworkify-webpack/index.js"),H=P.n(Q),F=P("./src/events.ts"),K=P("./src/demux/transmuxer.ts"),W=P("./src/utils/logger.ts"),M=P("./src/errors.ts"),R=P("./src/utils/mediasource-helper.ts"),g=P("./node_modules/eventemitter3/index.js"),p=P.n(g),f=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},h=function(){function s(o,n,u,c){var L=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=n,this.onTransmuxComplete=u,this.onFlush=c;var C=o.config,x=function(_,l){l=l||{},l.frag=L.frag,l.id=L.id,o.trigger(_,l)};this.observer=new g.EventEmitter,this.observer.on(F.Events.FRAG_DECRYPTED,x),this.observer.on(F.Events.ERROR,x);var O={mp4:f.isTypeSupported("video/mp4"),mpeg:f.isTypeSupported("audio/mpeg"),mp3:f.isTypeSupported('audio/mp4; codecs="mp3"')},w=navigator.vendor;if(C.enableWorker&&typeof Worker!="undefined"){W.logger.log("demuxing in webworker");var S;try{S=this.worker=Q("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),S.addEventListener("message",this.onwmsg),S.onerror=function(T){o.trigger(F.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(T.message+" ("+T.filename+":"+T.lineno+")")})},S.postMessage({cmd:"init",typeSupported:O,vendor:w,id:n,config:JSON.stringify(C)})}catch(T){W.logger.warn("Error in worker:",T),W.logger.error("Error while initializing DemuxerWorker, fallback to inline"),S&&self.URL.revokeObjectURL(S.objectURL),this.transmuxer=new K.default(this.observer,O,C,w,n),this.worker=null}}else this.transmuxer=new K.default(this.observer,O,C,w,n)}var d=s.prototype;return d.destroy=function(){var n=this.worker;if(n)n.removeEventListener("message",this.onwmsg),n.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var c=this.observer;c&&c.removeAllListeners(),this.observer=null},d.push=function(n,u,c,L,C,x,O,w,S,T){var _=this;S.transmuxing.start=self.performance.now();var l=this.transmuxer,E=this.worker,m=x?x.start:C.start,b=C.decryptdata,N=this.frag,D=!(N&&C.cc===N.cc),B=!(N&&S.level===N.level),j=N?S.sn-N.sn:-1,I=this.part?S.part-this.part.index:1,v=!B&&(j===1||j===0&&I===1),G=self.performance.now();(B||j||C.stats.parsing.start===0)&&(C.stats.parsing.start=G),x&&(I||!v)&&(x.stats.parsing.start=G);var Y=new K.TransmuxState(D,v,w,B,m);if(!v||D){W.logger.log("[transmuxer-interface, "+C.type+"]: Starting new transmux session for sn: "+S.sn+" p: "+S.part+" level: "+S.level+" id: "+S.id+` discontinuity: `+D+` trackSwitch: `+B+` contiguous: `+v+` accurateTimeOffset: `+w+` timeOffset: `+m);var re=new K.TransmuxConfig(c,L,u,O,T);this.configureTransmuxer(re)}if(this.frag=C,this.part=x,E)E.postMessage({cmd:"demux",data:n,decryptdata:b,chunkMeta:S,state:Y},n instanceof ArrayBuffer?[n]:[]);else if(l){var oe=l.push(n,b,S,Y);Object(K.isPromise)(oe)?oe.then(function(we){_.handleTransmuxComplete(we)}):this.handleTransmuxComplete(oe)}},d.flush=function(n){var u=this;n.transmuxing.start=self.performance.now();var c=this.transmuxer,L=this.worker;if(L)L.postMessage({cmd:"flush",chunkMeta:n});else if(c){var C=c.flush(n);Object(K.isPromise)(C)?C.then(function(x){u.handleFlushResult(x,n)}):this.handleFlushResult(C,n)}},d.handleFlushResult=function(n,u){var c=this;n.forEach(function(L){c.handleTransmuxComplete(L)}),this.onFlush(u)},d.onWorkerMessage=function(n){var u=n.data,c=this.hls;switch(u.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.id=this.id,c.trigger(u.event,u.data);break}}},d.configureTransmuxer=function(n){var u=this.worker,c=this.transmuxer;u?u.postMessage({cmd:"configure",config:n}):c&&c.configure(n)},d.handleTransmuxComplete=function(n){n.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(n)},s}()},"./src/demux/transmuxer-worker.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return M});var Q=P("./src/demux/transmuxer.ts"),H=P("./src/events.ts"),F=P("./src/utils/logger.ts"),K=P("./node_modules/eventemitter3/index.js"),W=P.n(K);function M(h){var s=new K.EventEmitter,d=function(n,u){h.postMessage({event:n,data:u})};s.on(H.Events.FRAG_DECRYPTED,d),s.on(H.Events.ERROR,d),h.addEventListener("message",function(o){var n=o.data;switch(n.cmd){case"init":{var u=JSON.parse(n.config);h.transmuxer=new Q.default(s,n.typeSupported,u,n.vendor,n.id),Object(F.enableLogs)(u.debug),d("init",null);break}case"configure":{h.transmuxer.configure(n.config);break}case"demux":{var c=h.transmuxer.push(n.data,n.decryptdata,n.chunkMeta,n.state);Object(Q.isPromise)(c)?c.then(function(x){R(h,x)}):R(h,c);break}case"flush":{var L=n.chunkMeta,C=h.transmuxer.flush(L);Object(Q.isPromise)(C)?C.then(function(x){p(h,x,L)}):p(h,C,L);break}default:break}})}function R(h,s){if(f(s.remuxResult))return;var d=[],o=s.remuxResult,n=o.audio,u=o.video;n&&g(d,n),u&&g(d,u),h.postMessage({event:"transmuxComplete",data:s},d)}function g(h,s){s.data1&&h.push(s.data1.buffer),s.data2&&h.push(s.data2.buffer)}function p(h,s,d){s.forEach(function(o){R(h,o)}),h.postMessage({event:"flush",data:d})}function f(h){return!h.audio&&!h.video&&!h.text&&!h.id3&&!h.initSegment}},"./src/demux/transmuxer.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return u}),P.d(Z,"isPromise",function(){return C}),P.d(Z,"TransmuxConfig",function(){return x}),P.d(Z,"TransmuxState",function(){return O});var Q=P("./src/events.ts"),H=P("./src/errors.ts"),F=P("./src/crypt/decrypter.ts"),K=P("./src/demux/aacdemuxer.ts"),W=P("./src/demux/mp4demuxer.ts"),M=P("./src/demux/tsdemuxer.ts"),R=P("./src/demux/mp3demuxer.ts"),g=P("./src/remux/mp4-remuxer.ts"),p=P("./src/remux/passthrough-remuxer.ts"),f=P("./src/demux/chunk-cache.ts"),h=P("./src/utils/mp4-tools.ts"),s=P("./src/utils/logger.ts"),d;try{d=self.performance.now.bind(self.performance)}catch(w){s.logger.debug("Unable to use Performance API on this environment"),d=self.Date.now}var o=[{demux:M.default,remux:g.default},{demux:W.default,remux:p.default},{demux:K.default,remux:g.default},{demux:R.default,remux:g.default}],n=1024;o.forEach(function(w){var S=w.demux;n=Math.max(n,S.minProbeByteLength)});var u=function(){function w(T,_,l,E,m){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=T,this.typeSupported=_,this.config=l,this.vendor=E,this.id=m}var S=w.prototype;return S.configure=function(_){this.transmuxConfig=_,this.decrypter&&this.decrypter.reset()},S.push=function(_,l,E,m){var b=this,N=E.transmuxing;N.executeStart=d();var D=new Uint8Array(_),B=this.cache,j=this.config,I=this.currentTransmuxState,v=this.transmuxConfig;m&&(this.currentTransmuxState=m);var G=c(D,l);if(G&&G.method==="AES-128"){var Y=this.getDecrypter();if(j.enableSoftwareAES){var re=Y.softwareDecrypt(D,G.key.buffer,G.iv.buffer);if(!re)return N.executeEnd=d(),L(E);D=new Uint8Array(re)}else return this.decryptionPromise=Y.webCryptoDecrypt(D,G.key.buffer,G.iv.buffer).then(function(Ce){var Le=b.push(Ce,null,E);return b.decryptionPromise=null,Le}),this.decryptionPromise}var oe=m||I,we=oe.contiguous,pe=oe.discontinuity,Ee=oe.trackSwitch,_e=oe.accurateTimeOffset,Ae=oe.timeOffset,fe=v.audioCodec,ue=v.videoCodec,ie=v.defaultInitPts,de=v.duration,se=v.initSegmentData;if((pe||Ee)&&this.resetInitSegment(se,fe,ue,de),pe&&this.resetInitialTimestamp(ie),we||this.resetContiguity(),this.needsProbing(D,pe,Ee)){if(B.dataLength){var Re=B.flush();D=Object(h.appendUint8Array)(Re,D)}this.configureTransmuxer(D,v)}var ke=this.transmux(D,G,Ae,_e,E),Te=this.currentTransmuxState;return Te.contiguous=!0,Te.discontinuity=!1,Te.trackSwitch=!1,N.executeEnd=d(),ke},S.flush=function(_){var l=this,E=_.transmuxing;E.executeStart=d();var m=this.decrypter,b=this.cache,N=this.currentTransmuxState,D=this.decryptionPromise;if(D)return D.then(function(){return l.flush(_)});var B=[],j=N.timeOffset;if(m){var I=m.flush();I&&B.push(this.push(I,null,_))}var v=b.dataLength;b.reset();var G=this.demuxer,Y=this.remuxer;if(!G||!Y)return v>=n&&this.observer.emit(Q.Events.ERROR,Q.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),E.executeEnd=d(),[L(_)];var re=G.flush(j);return C(re)?re.then(function(oe){return l.flushRemux(B,oe,_),B}):(this.flushRemux(B,re,_),B)},S.flushRemux=function(_,l,E){var m=l.audioTrack,b=l.avcTrack,N=l.id3Track,D=l.textTrack,B=this.currentTransmuxState,j=B.accurateTimeOffset,I=B.timeOffset;s.logger.log("[transmuxer.ts]: Flushed fragment "+E.sn+(E.part>-1?" p: "+E.part:"")+" of level "+E.level);var v=this.remuxer.remux(m,b,N,D,I,j,!0,this.id);_.push({remuxResult:v,chunkMeta:E}),E.transmuxing.executeEnd=d()},S.resetInitialTimestamp=function(_){var l=this.demuxer,E=this.remuxer;if(!l||!E)return;l.resetTimeStamp(_),E.resetTimeStamp(_)},S.resetContiguity=function(){var _=this.demuxer,l=this.remuxer;if(!_||!l)return;_.resetContiguity(),l.resetNextTimestamp()},S.resetInitSegment=function(_,l,E,m){var b=this.demuxer,N=this.remuxer;if(!b||!N)return;b.resetInitSegment(l,E,m),N.resetInitSegment(_,l,E)},S.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},S.transmux=function(_,l,E,m,b){var N;return l&&l.method==="SAMPLE-AES"?N=this.transmuxSampleAes(_,l,E,m,b):N=this.transmuxUnencrypted(_,E,m,b),N},S.transmuxUnencrypted=function(_,l,E,m){var b=this.demuxer.demux(_,l,!1,!this.config.progressive),N=b.audioTrack,D=b.avcTrack,B=b.id3Track,j=b.textTrack,I=this.remuxer.remux(N,D,B,j,l,E,!1,this.id);return{remuxResult:I,chunkMeta:m}},S.transmuxSampleAes=function(_,l,E,m,b){var N=this;return this.demuxer.demuxSampleAes(_,l,E).then(function(D){var B=N.remuxer.remux(D.audioTrack,D.avcTrack,D.id3Track,D.textTrack,E,m,!1,N.id);return{remuxResult:B,chunkMeta:b}})},S.configureTransmuxer=function(_,l){for(var E=this.config,m=this.observer,b=this.typeSupported,N=this.vendor,D=l.audioCodec,B=l.defaultInitPts,j=l.duration,I=l.initSegmentData,v=l.videoCodec,G,Y=0,re=o.length;Y0&&S!=null&&S.key!=null&&S.iv!==null&&S.method!=null&&(T=S),T}var L=function(S){return{remuxResult:{},chunkMeta:S}};function C(w){return"then"in w&&w.then instanceof Function}var x=function(S,T,_,l,E){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=S,this.videoCodec=T,this.initSegmentData=_,this.duration=l,this.defaultInitPts=E},O=function(S,T,_,l,E){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=S,this.contiguous=T,this.accurateTimeOffset=_,this.trackSwitch=l,this.timeOffset=E}},"./src/demux/tsdemuxer.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"discardEPB",function(){return L});var Q=P("./src/demux/adts.ts"),H=P("./src/demux/mpegaudio.ts"),F=P("./src/demux/exp-golomb.ts"),K=P("./src/demux/id3.ts"),W=P("./src/demux/sample-aes.ts"),M=P("./src/events.ts"),R=P("./src/utils/mp4-tools.ts"),g=P("./src/utils/logger.ts"),p=P("./src/errors.ts"),f={video:1,audio:2,id3:3,text:4},h=function(){function C(O,w,S){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=w,this.typeSupported=S}C.probe=function(w){var S=C.syncOffset(w);return S<0?!1:(S&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+S+", junk ahead ?"),!0)},C.syncOffset=function(w){for(var S=Math.min(1e3,w.length-3*188),T=0;T>4,fe=void 0;if(Ae>1){if(fe=pe+5+w[pe+4],fe===pe+188)continue}else fe=pe+4;switch(_e){case N:Ee&&(D&&(l=n(D))&&this.parseAVCPES(l,!1),D={data:[],size:0}),D&&(D.data.push(w.subarray(fe,pe+188)),D.size+=pe+188-fe);break;case B:Ee&&(I&&(l=n(I))&&(m.isAAC?this.parseAACPES(l):this.parseMPEGPES(l)),I={data:[],size:0}),I&&(I.data.push(w.subarray(fe,pe+188)),I.size+=pe+188-fe);break;case j:Ee&&(v&&(l=n(v))&&this.parseID3PES(l),v={data:[],size:0}),v&&(v.data.push(w.subarray(fe,pe+188)),v.size+=pe+188-fe);break;case 0:Ee&&(fe+=w[fe]+1),re=this._pmtId=d(w,fe);break;case re:{Ee&&(fe+=w[fe]+1);var ue=o(w,fe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,T);N=ue.avc,N>0&&(E.pid=N),B=ue.audio,B>0&&(m.pid=B,m.isAAC=ue.isAAC),j=ue.id3,j>0&&(b.pid=j),G&&!Y&&(g.logger.log("reparse from beginning"),G=!1,pe=we-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:G=!0;break}}else this.observer.emit(M.Events.ERROR,M.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});E.pesData=D,m.pesData=I,b.pesData=v;var ie={audioTrack:m,avcTrack:E,id3Track:b,textTrack:this._txtTrack};return _&&this.extractRemainingSamples(ie),ie},x.flush=function(){var w=this.remainderData;this.remainderData=null;var S;return w?S=this.demux(w,-1,!1,!0):S={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(S),this.sampleAes?this.decrypt(S,this.sampleAes):S},x.extractRemainingSamples=function(w){var S=w.audioTrack,T=w.avcTrack,_=w.id3Track,l=T.pesData,E=S.pesData,m=_.pesData,b;l&&(b=n(l))?(this.parseAVCPES(b,!0),T.pesData=null):T.pesData=l,E&&(b=n(E))?(S.isAAC?this.parseAACPES(b):this.parseMPEGPES(b),S.pesData=null):(E!=null&&E.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),S.pesData=E),m&&(b=n(m))?(this.parseID3PES(b),_.pesData=null):_.pesData=m},x.demuxSampleAes=function(w,S,T){var _=this.demux(w,T,!0,!this.config.progressive),l=this.sampleAes=new W.default(this.observer,this.config,S);return this.decrypt(_,l)},x.decrypt=function(w,S){return new Promise(function(T){var _=w.audioTrack,l=w.avcTrack;_.samples&&_.isAAC?S.decryptAacSamples(_.samples,0,function(){l.samples?S.decryptAvcSamples(l.samples,0,0,function(){T(w)}):T(w)}):l.samples&&S.decryptAvcSamples(l.samples,0,0,function(){T(w)})})},x.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},x.parseAVCPES=function(w,S){var T=this,_=this._avcTrack,l=this.parseAVCNALu(w.data),E=!1,m=this.avcSample,b,N=!1;w.data=null,m&&l.length&&!_.audFound&&(u(m,_),m=this.avcSample=s(!1,w.pts,w.dts,"")),l.forEach(function(D){switch(D.type){case 1:{b=!0,m||(m=T.avcSample=s(!0,w.pts,w.dts,"")),E&&(m.debug+="NDR "),m.frame=!0;var B=D.data;if(N&&B.length>4){var j=new F.default(B).readSliceType();(j===2||j===4||j===7||j===9)&&(m.key=!0)}break}case 5:b=!0,m||(m=T.avcSample=s(!0,w.pts,w.dts,"")),E&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{b=!0,E&&m&&(m.debug+="SEI ");var I=new F.default(L(D.data));I.readUByte();for(var v=0,G=0,Y=!1,re=0;!Y&&I.bytesAvailable>1;){v=0;do re=I.readUByte(),v+=re;while(re===255);G=0;do re=I.readUByte(),G+=re;while(re===255);if(v===4&&I.bytesAvailable!==0){Y=!0;var oe=I.readUByte();if(oe===181){var we=I.readUShort();if(we===49){var pe=I.readUInt();if(pe===1195456820){var Ee=I.readUByte();if(Ee===3){for(var _e=I.readUByte(),Ae=I.readUByte(),fe=31&_e,ue=[_e,Ae],ie=0;ie16){for(var de=[],se=0;se<16;se++)de.push(I.readUByte().toString(16)),(se===3||se===5||se===7||se===9)&&de.push("-");for(var Re=G-16,ke=new Uint8Array(Re),Te=0;Te=0){var I={data:w.subarray(B,m-_-1),type:j};E.push(I)}else{var v=this.getLastNalUnit();if(v&&(l&&m<=4-l&&(v.state&&(v.data=v.data.subarray(0,v.data.byteLength-l))),N=m-_-1,N>0)){var G=new Uint8Array(v.data.byteLength+N);G.set(v.data,0),G.set(w.subarray(0,N),v.data.byteLength),v.data=G,v.state=0}}m=0&&_>=0){var Y={data:w.subarray(B,S),type:j,state:_};E.push(Y)}if(E.length===0){var re=this.getLastNalUnit();if(re){var oe=new Uint8Array(re.data.byteLength+w.byteLength);oe.set(re.data,0),oe.set(w,re.data.byteLength),re.data=oe}}return T.naluState=_,E},x.parseAACPES=function(w){var S=0,T=this._audioTrack,_=this.aacOverFlow,l=w.data;if(_){this.aacOverFlow=null;var E=_.sample.unit.byteLength,m=Math.min(_.missing,E),b=E-m;_.sample.unit.set(l.subarray(0,m),b),T.samples.push(_.sample),S=_.missing}var N,D;for(N=S,D=l.length;N1;){var E=new Uint8Array(l[0].length+l[1].length);E.set(l[0]),E.set(l[1],l[0].length),l[0]=E,l.splice(1,1)}O=l[0];var m=(O[0]<<16)+(O[1]<<8)+O[2];if(m===1){if(w=(O[4]<<8)+O[5],w&&w>C.size-6)return null;var b=O[7];b&192&&(T=(O[9]&14)*536870912+(O[10]&255)*4194304+(O[11]&254)*16384+(O[12]&255)*128+(O[13]&254)/2,b&64?(_=(O[14]&14)*536870912+(O[15]&255)*4194304+(O[16]&254)*16384+(O[17]&255)*128+(O[18]&254)/2,T-_>60*9e4&&(g.logger.warn(Math.round((T-_)/9e4)+"s delta between PTS and DTS, align them"),T=_)):_=T),S=O[8];var N=S+9;if(C.size<=N)return null;C.size-=N;for(var D=new Uint8Array(C.size),B=0,j=l.length;BI){N-=I;continue}else O=O.subarray(N),I-=N,N=0;D.set(O,x),x+=I}return w&&(w-=S+3),{data:D,pts:T,dts:_,len:w}}return null}function u(C,x){if(C.units.length&&C.frame){if(C.pts===void 0){var O=x.samples,w=O.length;if(w){var S=O[w-1];C.pts=S.pts,C.dts=S.dts}else{x.dropped++;return}}x.samples.push(C)}C.debug.length&&g.logger.log(C.pts+"/"+C.dts+":"+C.debug)}function c(C,x){var O=C.length;if(O>0){if(x.pts>=C[O-1].pts)C.push(x);else for(var w=O-1;w>=0;w--)if(x.ptsT)return l;return 0}},{key:"maxAutoLevel",get:function(){var S=this.levels,T=this.autoLevelCapping,_;return T===-1&&S&&S.length?_=S.length-1:_=T,_}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(S){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,S)}},{key:"audioTracks",get:function(){var S=this.audioTrackController;return S?S.audioTracks:[]}},{key:"audioTrack",get:function(){var S=this.audioTrackController;return S?S.audioTrack:-1},set:function(S){var T=this.audioTrackController;T&&(T.audioTrack=S)}},{key:"subtitleTracks",get:function(){var S=this.subtitleTrackController;return S?S.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var S=this.subtitleTrackController;return S?S.subtitleTrack:-1},set:function(S){var T=this.subtitleTrackController;T&&(T.subtitleTrack=S)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var S=this.subtitleTrackController;return S?S.subtitleDisplay:!1},set:function(S){var T=this.subtitleTrackController;T&&(T.subtitleDisplay=S)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(S){this.config.lowLatencyMode=S}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return n.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return x.defaultConfig?x.defaultConfig:s.hlsDefaultConfig},set:function(S){x.defaultConfig=S}}]),x}();C.defaultConfig=void 0},"./src/is-supported.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"isSupported",function(){return F}),P.d(Z,"changeTypeSupported",function(){return K});var Q=P("./src/utils/mediasource-helper.ts");function H(){return self.SourceBuffer||self.WebKitSourceBuffer}function F(){var W=Object(Q.getMediaSource)();if(!W)return!1;var M=H(),R=W&&typeof W.isTypeSupported=="function"&&W.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!M||M.prototype&&typeof M.prototype.appendBuffer=="function"&&typeof M.prototype.remove=="function";return!!R&&!!g}function K(){var W,M=H();return typeof(M==null||((W=M.prototype)===null||W===void 0)?void 0:W.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return h}),P.d(Z,"LoadError",function(){return d});var Q=P("./src/polyfills/number.ts"),H=P("./src/errors.ts");function F(o,n){o.prototype=Object.create(n.prototype),o.prototype.constructor=o,g(o,n)}function K(o){var n=typeof Map=="function"?new Map:void 0;return K=function(c){if(c===null||!R(c))return c;if(typeof c!="function")throw new TypeError("Super expression must either be null or a function");if(typeof n!="undefined"){if(n.has(c))return n.get(c);n.set(c,L)}function L(){return W(c,arguments,p(this).constructor)}return L.prototype=Object.create(c.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),g(L,c)},K(o)}function W(o,n,u){return M()?W=Reflect.construct:W=function(L,C,x){var O=[null];O.push.apply(O,C);var w=Function.bind.apply(L,O),S=new w;return x&&g(S,x.prototype),S},W.apply(null,arguments)}function M(){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 R(o){return Function.toString.call(o).indexOf("[native code]")!==-1}function g(o,n){return g=Object.setPrototypeOf||function(c,L){return c.__proto__=L,c},g(o,n)}function p(o){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},p(o)}var f=Math.pow(2,17),h=function(){function o(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var n=o.prototype;return n.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},n.abort=function(){this.loader&&this.loader.abort()},n.load=function(c,L){var C=this,x=c.url;if(!x)return Promise.reject(new d({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,networkDetails:null},"Fragment does not have a "+(x?"part list":"url")));this.abort();var O=this.config,w=O.fLoader,S=O.loader;return new Promise(function(T,_){C.loader&&C.loader.destroy();var l=C.loader=c.loader=w?new w(O):new S(O),E=s(c),m={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};c.stats=l.stats,l.load(E,m,{onSuccess:function(N,D,B,j){C.resetLoader(c,l),T({frag:c,part:null,payload:N.data,networkDetails:j})},onError:function(N,D,B){C.resetLoader(c,l),_(new d({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,response:N,networkDetails:B}))},onAbort:function(N,D,B){C.resetLoader(c,l),_(new d({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,networkDetails:B}))},onTimeout:function(N,D,B){C.resetLoader(c,l),_(new d({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,networkDetails:B}))},onProgress:function(N,D,B,j){L&&L({frag:c,part:null,payload:B,networkDetails:j})}})})},n.loadPart=function(c,L,C){var x=this;this.abort();var O=this.config,w=O.fLoader,S=O.loader;return new Promise(function(T,_){x.loader&&x.loader.destroy();var l=x.loader=c.loader=w?new w(O):new S(O),E=s(c,L),m={timeout:O.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:O.fragLoadingMaxRetryTimeout,highWaterMark:f};L.stats=l.stats,l.load(E,m,{onSuccess:function(N,D,B,j){x.resetLoader(c,l),x.updateStatsFromPart(c,L);var I={frag:c,part:L,payload:N.data,networkDetails:j};C(I),T(I)},onError:function(N,D,B){x.resetLoader(c,l),_(new d({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:c,part:L,response:N,networkDetails:B}))},onAbort:function(N,D,B){c.stats.aborted=L.stats.aborted,x.resetLoader(c,l),_(new d({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:c,part:L,networkDetails:B}))},onTimeout:function(N,D,B){x.resetLoader(c,l),_(new d({type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:c,part:L,networkDetails:B}))}})})},n.updateStatsFromPart=function(c,L){var C=c.stats,x=L.stats,O=x.total;if(C.loaded+=x.loaded,O){var w=Math.round(c.duration/L.duration),S=Math.min(Math.round(C.loaded/O),w),T=w-S,_=T*Math.round(C.loaded/S);C.total=C.loaded+_}else C.total=Math.max(C.loaded,C.total);var l=C.loading,E=x.loading;l.start?l.first+=E.first-E.start:(l.start=E.start,l.first=E.first),l.end=E.end},n.resetLoader=function(c,L){c.loader=null,this.loader===L&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),L.destroy()},o}();function s(o,n){n===void 0&&(n=null);var u=n||o,c={frag:o,part:n,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},L=u.byteRangeStartOffset,C=u.byteRangeEndOffset;return Object(Q.isFiniteNumber)(L)&&Object(Q.isFiniteNumber)(C)&&(c.rangeStart=L,c.rangeEnd=C),c}var d=function(o){F(n,o);function n(u){for(var c,L=arguments.length,C=new Array(L>1?L-1:0),x=1;x>8*(15-O)&255;return x},c.setDecryptDataFromLevelKey=function(C,x){var O=C;return(C==null?void 0:C.method)==="AES-128"&&C.uri&&!C.iv&&(O=W.LevelKey.fromURI(C.uri),O.method=C.method,O.iv=this.createInitializationVector(x),O.keyFormat="identity"),O},c.setElementaryStreamInfo=function(C,x,O,w,S,T){T===void 0&&(T=!1);var _=this.elementaryStreams,l=_[C];if(!l){_[C]={startPTS:x,endPTS:O,startDTS:w,endDTS:S,partial:T};return}l.startPTS=Math.min(l.startPTS,x),l.endPTS=Math.max(l.endPTS,O),l.startDTS=Math.min(l.startDTS,w),l.endDTS=Math.max(l.endDTS,S)},c.clearElementaryStreamInfo=function(){var C=this.elementaryStreams;C[h.AUDIO]=null,C[h.VIDEO]=null,C[h.AUDIOVIDEO]=null},f(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var C=this.sn;typeof C!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&K.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),C=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,C)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Q.isFiniteNumber)(this.programDateTime))return null;var C=Object(Q.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+C*1e3}},{key:"encrypted",get:function(){var C;return!!((C=this.decryptdata)!==null&&C!==void 0&&C.keyFormat&&this.decryptdata.uri)}}]),u}(s),o=function(n){R(u,n);function u(c,L,C,x,O){var w;w=n.call(this,C)||this,w.fragOffset=0,w.duration=0,w.gap=!1,w.independent=!1,w.relurl=void 0,w.fragment=void 0,w.index=void 0,w.stats=new M.LoadStats,w.duration=c.decimalFloatingPoint("DURATION"),w.gap=c.bool("GAP"),w.independent=c.bool("INDEPENDENT"),w.relurl=c.enumeratedString("URI"),w.fragment=L,w.index=x;var S=c.enumeratedString("BYTERANGE");return S&&w.setByteRange(S,O),O&&(w.fragOffset=O.fragOffset+O.duration),w}return f(u,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var L=this.elementaryStreams;return!!(L.audio||L.video||L.audiovideo)}}]),u}(s)},"./src/loader/key-loader.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return K});var Q=P("./src/events.ts"),H=P("./src/errors.ts"),F=P("./src/utils/logger.ts"),K=function(){function W(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var M=W.prototype;return M._registerListeners=function(){this.hls.on(Q.Events.KEY_LOADING,this.onKeyLoading,this)},M._unregisterListeners=function(){this.hls.off(Q.Events.KEY_LOADING,this.onKeyLoading)},M.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var p=this.loaders[g];p&&p.destroy()}this.loaders={}},M.onKeyLoading=function(g,p){var f=p.frag,h=f.type,s=this.loaders[h];if(!f.decryptdata){F.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(s&&(F.logger.warn("abort previous key loader for type:"+h),s.abort()),!d){F.logger.warn("key uri is falsy");return}var n=o.loader,u=f.loader=this.loaders[h]=new n(o);this.decrypturl=d,this.decryptkey=null;var c={url:d,frag:f,responseType:"arraybuffer"},L={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:o.fragLoadingRetryDelay,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:0},C={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(c,L,C)}else this.decryptkey&&(f.decryptdata.key=this.decryptkey,this.hls.trigger(Q.Events.KEY_LOADED,{frag:f}))},M.loadsuccess=function(g,p,f){var h=f.frag;if(!h.decryptdata){F.logger.error("after key load, decryptdata unset");return}this.decryptkey=h.decryptdata.key=new Uint8Array(g.data),h.loader=null,delete this.loaders[h.type],this.hls.trigger(Q.Events.KEY_LOADED,{frag:h})},M.loaderror=function(g,p){var f=p.frag,h=f.loader;h&&h.abort(),delete this.loaders[f.type],this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:f,response:g})},M.loadtimeout=function(g,p){var f=p.frag,h=f.loader;h&&h.abort(),delete this.loaders[f.type],this.hls.trigger(Q.Events.ERROR,{type:H.ErrorTypes.NETWORK_ERROR,details:H.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:f})},W}()},"./src/loader/level-details.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"LevelDetails",function(){return W});var Q=P("./src/polyfills/number.ts");function H(M,R){for(var g=0;gp.endSN||f>0||f===0&&h>0,this.updated||this.advanced?this.misses=Math.floor(p.misses*.6):this.misses=p.misses+1,this.availabilityDelay=p.availabilityDelay},F(M,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Q.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||K}},{key:"drift",get:function(){var p=this.driftEndTime-this.driftStartTime;if(p>0){var f=this.driftEnd-this.driftStart;return f*1e3/p}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var p;return(p=this.fragments)!==null&&p!==void 0&&p.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var p;return(p=this.partList)!==null&&p!==void 0&&p.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),M}()},"./src/loader/level-key.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"LevelKey",function(){return W});var Q=P("./node_modules/url-toolkit/src/url-toolkit.js"),H=P.n(Q);function F(M,R){for(var g=0;g2){var _=T.shift()+".";return _+=parseInt(T.shift()).toString(16),_+=("000"+parseInt(T.shift()).toString(16)).substr(-4),_}return S},O.resolve=function(S,T){return H.buildAbsoluteURL(T,S,{alwaysNormalize:!0})},O.parseMasterPlaylist=function(S,T){var _=[],l={},E=!1;f.lastIndex=0;for(var m;(m=f.exec(S))!=null;)if(m[1]){var b=new R.AttrList(m[1]),N={attrs:b,bitrate:b.decimalInteger("AVERAGE-BANDWIDTH")||b.decimalInteger("BANDWIDTH"),name:b.NAME,url:O.resolve(m[2],T)},D=b.decimalResolution("RESOLUTION");D&&(N.width=D.width,N.height=D.height),c((b.CODECS||"").split(/[ ,]+/).filter(function(j){return j}),N),N.videoCodec&&N.videoCodec.indexOf("avc1")!==-1&&(N.videoCodec=O.convertAVC1ToAVCOTI(N.videoCodec)),_.push(N)}else if(m[3]){var B=new R.AttrList(m[3]);B["DATA-ID"]&&(E=!0,l[B["DATA-ID"]]=B)}return{levels:_,sessionData:E?l:null}},O.parseMasterPlaylistMedia=function(S,T,_,l){l===void 0&&(l=[]);var E,m=[],b=0;for(h.lastIndex=0;(E=h.exec(S))!==null;){var N=new R.AttrList(E[1]);if(N.TYPE===_){var D={attrs:N,bitrate:0,id:b++,groupId:N["GROUP-ID"],instreamId:N["INSTREAM-ID"],name:N.NAME||N.LANGUAGE||"",type:_,default:N.bool("DEFAULT"),autoselect:N.bool("AUTOSELECT"),forced:N.bool("FORCED"),lang:N.LANGUAGE,url:N.URI?O.resolve(N.URI,T):""};if(l.length){var B=O.findGroup(l,D.groupId)||l[0];L(D,B,"audioCodec"),L(D,B,"textCodec")}m.push(D)}}return m},O.parseLevelPlaylist=function(S,T,_,l,E){var m=new W.LevelDetails(T),b=m.fragments,N=null,D=0,B=0,j=0,I=0,v=null,G=new K.Fragment(l,T),Y,re,oe,we=-1,pe=!1;for(s.lastIndex=0,m.m3u8=S;(Y=s.exec(S))!==null;){pe&&(pe=!1,G=new K.Fragment(l,T),G.start=j,G.sn=D,G.cc=I,G.level=_,N&&(G.initSegment=N,G.rawProgramDateTime=N.rawProgramDateTime));var Ee=Y[1];if(Ee){G.duration=parseFloat(Ee);var _e=(" "+Y[2]).slice(1);G.title=_e||null,G.tagList.push(_e?["INF",Ee,_e]:["INF",Ee])}else if(Y[3])Object(Q.isFiniteNumber)(G.duration)&&(G.start=j,oe&&(G.levelkey=oe),G.sn=D,G.level=_,G.cc=I,G.urlId=E,b.push(G),G.relurl=(" "+Y[3]).slice(1),x(G,v),v=G,j+=G.duration,D++,B=0,pe=!0);else if(Y[4]){var Ae=(" "+Y[4]).slice(1);v?G.setByteRange(Ae,v):G.setByteRange(Ae)}else if(Y[5])G.rawProgramDateTime=(" "+Y[5]).slice(1),G.tagList.push(["PROGRAM-DATE-TIME",G.rawProgramDateTime]),we===-1&&(we=b.length);else{if(Y=Y[0].match(d),!Y){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(re=1;re-1){g.logger.warn("Keyformat "+Ve+" is not supported from the manifest");continue}else if(Ve!=="identity")continue;Le&&(oe=M.LevelKey.fromURL(T,Be),Be&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Le)>=0&&(oe.method=Le,oe.keyFormat=Ve,Ue&&(oe.keyID=Ue),Me&&(oe.keyFormatVersions=Me),oe.iv=Fe));break}case"START":{var Ze=new R.AttrList(ue),Xe=Ze.decimalFloatingPoint("TIME-OFFSET");Object(Q.isFiniteNumber)(Xe)&&(m.startTimeOffset=Xe);break}case"MAP":{var ot=new R.AttrList(ue);G.relurl=ot.URI,ot.BYTERANGE&&G.setByteRange(ot.BYTERANGE),G.level=_,G.sn="initSegment",oe&&(G.levelkey=oe),G.initSegment=null,N=G,pe=!0;break}case"SERVER-CONTROL":{var et=new R.AttrList(ue);m.canBlockReload=et.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=et.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&et.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=et.optionalFloat("PART-HOLD-BACK",0),m.holdBack=et.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var rt=new R.AttrList(ue);m.partTarget=rt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ne=m.partList;Ne||(Ne=m.partList=[]);var ut=B>0?Ne[Ne.length-1]:void 0,tt=B++,Pe=new K.Part(new R.AttrList(ue),G,T,tt,ut);Ne.push(Pe),G.duration+=Pe.duration;break}case"PRELOAD-HINT":{var We=new R.AttrList(ue);m.preloadHint=We;break}case"RENDITION-REPORT":{var Se=new R.AttrList(ue);m.renditionReports=m.renditionReports||[],m.renditionReports.push(Se);break}default:g.logger.warn("line parsed but not handled: "+Y);break}}}v&&!v.relurl?(b.pop(),j-=v.duration,m.partList&&(m.fragmentHint=v)):m.partList&&(x(G,v),G.cc=I,m.fragmentHint=G);var ve=b.length,xe=b[0],te=b[ve-1];if(j+=m.skippedSegments*m.targetduration,j>0&&ve&&te){m.averagetargetduration=j/ve;var ae=te.sn;m.endSN=ae!=="initSegment"?ae:0,xe&&(m.startCC=xe.cc,xe.initSegment||m.fragments.every(function(he){return he.relurl&&n(he.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),G=new K.Fragment(l,T),G.relurl=te.relurl,G.level=_,G.sn="initSegment",xe.initSegment=G,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(j+=m.fragmentHint.duration),m.totalduration=j,m.endCC=I,we>0&&C(b,we),m},O}();function c(O,w){["video","audio","text"].forEach(function(S){var T=O.filter(function(l){return Object(p.isCodecType)(l,S)});if(T.length){var _=T.filter(function(l){return l.lastIndexOf("avc1",0)===0||l.lastIndexOf("mp4a",0)===0});w[S+"Codec"]=_.length>0?_[0]:T[0],O=O.filter(function(l){return T.indexOf(l)===-1})}}),w.unknownCodecs=O}function L(O,w,S){var T=w[S];T&&(O[S]=T)}function C(O,w){for(var S=O[w],T=w;T--;){var _=O[T];if(!_)return;_.programDateTime=S.programDateTime-_.duration*1e3,S=_}}function x(O,w){O.rawProgramDateTime?O.programDateTime=Date.parse(O.rawProgramDateTime):w!=null&&w.programDateTime&&(O.programDateTime=w.endProgramDateTime),Object(Q.isFiniteNumber)(O.programDateTime)||(O.programDateTime=null,O.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(le,Z,P){"use strict";P.r(Z);var Q=P("./src/polyfills/number.ts"),H=P("./src/events.ts"),F=P("./src/errors.ts"),K=P("./src/utils/logger.ts"),W=P("./src/utils/mp4-tools.ts"),M=P("./src/loader/m3u8-parser.ts"),R=P("./src/types/loader.ts"),g=P("./src/utils/attr-list.ts");function p(s){var d=s.type;switch(d){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function f(s,d){var o=s.url;return(o===void 0||o.indexOf("data:")===0)&&(o=d.url),o}var h=function(){function s(o){this.hls=void 0,this.loaders=Object.create(null),this.hls=o,this.registerListeners()}var d=s.prototype;return d.registerListeners=function(){var n=this.hls;n.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),n.on(H.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),n.on(H.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.unregisterListeners=function(){var n=this.hls;n.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),n.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),n.off(H.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),n.off(H.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},d.createInternalLoader=function(n){var u=this.hls.config,c=u.pLoader,L=u.loader,C=c||L,x=new C(u);return n.loader=x,this.loaders[n.type]=x,x},d.getInternalLoader=function(n){return this.loaders[n.type]},d.resetInternalLoader=function(n){this.loaders[n]&&delete this.loaders[n]},d.destroyInternalLoaders=function(){for(var n in this.loaders){var u=this.loaders[n];u&&u.destroy(),this.resetInternalLoader(n)}},d.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},d.onManifestLoading=function(n,u){var c=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:c,deliveryDirectives:null})},d.onLevelLoading=function(n,u){var c=u.id,L=u.level,C=u.url,x=u.deliveryDirectives;this.load({id:c,groupId:null,level:L,responseType:"text",type:R.PlaylistContextType.LEVEL,url:C,deliveryDirectives:x})},d.onAudioTrackLoading=function(n,u){var c=u.id,L=u.groupId,C=u.url,x=u.deliveryDirectives;this.load({id:c,groupId:L,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:C,deliveryDirectives:x})},d.onSubtitleTrackLoading=function(n,u){var c=u.id,L=u.groupId,C=u.url,x=u.deliveryDirectives;this.load({id:c,groupId:L,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:C,deliveryDirectives:x})},d.load=function(n){var u,c=this.hls.config,L=this.getInternalLoader(n);if(L){var C=L.context;if(C&&C.url===n.url){K.logger.trace("[playlist-loader]: playlist request ongoing");return}K.logger.log("[playlist-loader]: aborting previous loader for type: "+n.type),L.abort()}var x,O,w,S;switch(n.type){case R.PlaylistContextType.MANIFEST:x=c.manifestLoadingMaxRetry,O=c.manifestLoadingTimeOut,w=c.manifestLoadingRetryDelay,S=c.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:x=0,O=c.levelLoadingTimeOut;break;default:x=c.levelLoadingMaxRetry,O=c.levelLoadingTimeOut,w=c.levelLoadingRetryDelay,S=c.levelLoadingMaxRetryTimeout;break}if(L=this.createInternalLoader(n),(u=n.deliveryDirectives)!==null&&u!==void 0&&u.part){var T;if(n.type===R.PlaylistContextType.LEVEL&&n.level!==null?T=this.hls.levels[n.level].details:n.type===R.PlaylistContextType.AUDIO_TRACK&&n.id!==null?T=this.hls.audioTracks[n.id].details:n.type===R.PlaylistContextType.SUBTITLE_TRACK&&n.id!==null&&(T=this.hls.subtitleTracks[n.id].details),T){var _=T.partTarget,l=T.targetduration;_&&l&&(O=Math.min(Math.max(_*3,l*.8)*1e3,O))}}var E={timeout:O,maxRetry:x,retryDelay:w,maxRetryDelay:S,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};L.load(n,E,m)},d.loadsuccess=function(n,u,c,L){if(L===void 0&&(L=null),c.isSidxRequest){this.handleSidxRequest(n,c),this.handlePlaylistLoaded(n,u,c,L);return}this.resetInternalLoader(c.type);var C=n.data;if(C.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(n,c,"no EXTM3U delimiter",L);return}u.parsing.start=performance.now(),C.indexOf("#EXTINF:")>0||C.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(n,u,c,L):this.handleMasterPlaylist(n,u,c,L)},d.loaderror=function(n,u,c){c===void 0&&(c=null),this.handleNetworkError(u,c,!1,n)},d.loadtimeout=function(n,u,c){c===void 0&&(c=null),this.handleNetworkError(u,c,!0)},d.handleMasterPlaylist=function(n,u,c,L){var C=this.hls,x=n.data,O=f(n,c),w=M.default.parseMasterPlaylist(x,O),S=w.levels,T=w.sessionData;if(!S.length){this.handleManifestParsingError(n,c,"no level found in manifest",L);return}var _=S.map(function(D){return{id:D.attrs.AUDIO,audioCodec:D.audioCodec}}),l=S.map(function(D){return{id:D.attrs.SUBTITLES,textCodec:D.textCodec}}),E=M.default.parseMasterPlaylistMedia(x,O,"AUDIO",_),m=M.default.parseMasterPlaylistMedia(x,O,"SUBTITLES",l),b=M.default.parseMasterPlaylistMedia(x,O,"CLOSED-CAPTIONS");if(E.length){var N=E.some(function(D){return!D.url});!N&&S[0].audioCodec&&!S[0].attrs.AUDIO&&(K.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),E.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}C.trigger(H.Events.MANIFEST_LOADED,{levels:S,audioTracks:E,subtitles:m,captions:b,url:O,stats:u,networkDetails:L,sessionData:T})},d.handleTrackOrLevelPlaylist=function(n,u,c,L){var C=this.hls,x=c.id,O=c.level,w=c.type,S=f(n,c),T=Object(Q.isFiniteNumber)(x)?x:0,_=Object(Q.isFiniteNumber)(O)?O:T,l=p(c),E=M.default.parseLevelPlaylist(n.data,S,_,l,T);if(!E.fragments.length){C.trigger(H.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:S,reason:"no fragments found in level",level:typeof c.level=="number"?c.level:void 0});return}if(w===R.PlaylistContextType.MANIFEST){var m={attrs:new g.AttrList({}),bitrate:0,details:E,name:"",url:S};C.trigger(H.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:S,stats:u,networkDetails:L,sessionData:null})}if(u.parsing.end=performance.now(),E.needSidxRanges){var b,N=(b=E.fragments[0].initSegment)===null||b===void 0?void 0:b.url;this.load({url:N,isSidxRequest:!0,type:w,level:O,levelDetails:E,id:x,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}c.levelDetails=E,this.handlePlaylistLoaded(n,u,c,L)},d.handleSidxRequest=function(n,u){var c=Object(W.parseSegmentIndex)(new Uint8Array(n.data));if(!c)return;var L=c.references,C=u.levelDetails;L.forEach(function(x,O){var w=x.info,S=C.fragments[O];S.byteRange.length===0&&S.setByteRange(String(1+w.end-w.start)+"@"+String(w.start)),S.initSegment&&S.initSegment.setByteRange(String(c.moovEndOffset)+"@0")})},d.handleManifestParsingError=function(n,u,c,L){this.hls.trigger(H.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===R.PlaylistContextType.MANIFEST,url:n.url,reason:c,response:n,context:u,networkDetails:L})},d.handleNetworkError=function(n,u,c,L){c===void 0&&(c=!1),K.logger.warn("[playlist-loader]: A network "+(c?"timeout":"error")+" occurred while loading "+n.type+" level: "+n.level+" id: "+n.id+' group-id: "'+n.groupId+'"');var C=F.ErrorDetails.UNKNOWN,x=!1,O=this.getInternalLoader(n);switch(n.type){case R.PlaylistContextType.MANIFEST:C=c?F.ErrorDetails.MANIFEST_LOAD_TIMEOUT:F.ErrorDetails.MANIFEST_LOAD_ERROR,x=!0;break;case R.PlaylistContextType.LEVEL:C=c?F.ErrorDetails.LEVEL_LOAD_TIMEOUT:F.ErrorDetails.LEVEL_LOAD_ERROR,x=!1;break;case R.PlaylistContextType.AUDIO_TRACK:C=c?F.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,x=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:C=c?F.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:F.ErrorDetails.SUBTITLE_LOAD_ERROR,x=!1;break}O&&this.resetInternalLoader(n.type);var w={type:F.ErrorTypes.NETWORK_ERROR,details:C,fatal:x,url:n.url,loader:O,context:n,networkDetails:u};L&&(w.response=L),this.hls.trigger(H.Events.ERROR,w)},d.handlePlaylistLoaded=function(n,u,c,L){var C=c.type,x=c.level,O=c.id,w=c.groupId,S=c.loader,T=c.levelDetails,_=c.deliveryDirectives;if(!(T!=null&&T.targetduration)){this.handleManifestParsingError(n,c,"invalid target duration",L);return}if(!S)return;T.live&&(S.getCacheAge&&(T.ageHeader=S.getCacheAge()||0),(!S.getCacheAge||isNaN(T.ageHeader))&&(T.ageHeader=0));switch(C){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(H.Events.LEVEL_LOADED,{details:T,level:x||0,id:O||0,stats:u,networkDetails:L,deliveryDirectives:_});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(H.Events.AUDIO_TRACK_LOADED,{details:T,id:O||0,groupId:w||"",stats:u,networkDetails:L,deliveryDirectives:_});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(H.Events.SUBTITLE_TRACK_LOADED,{details:T,id:O||0,groupId:w||"",stats:u,networkDetails:L,deliveryDirectives:_});break}},s}();Z.default=h},"./src/polyfills/number.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"isFiniteNumber",function(){return Q}),P.d(Z,"MAX_SAFE_INTEGER",function(){return H});var Q=Number.isFinite||function(F){return typeof F=="number"&&isFinite(F)},H=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(le,Z,P){"use strict";P.r(Z);var Q=function(){function H(){}return H.getSilentFrame=function(K,W){switch(K){case"mp4a.40.2":if(W===1)return new Uint8Array([0,200,0,128,35,128]);if(W===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(W===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(W===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(W===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(W===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(W===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(W===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(W===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},H}();Z.default=Q},"./src/remux/mp4-generator.ts":function(le,Z,P){"use strict";P.r(Z);var Q=Math.pow(2,32)-1,H=function(){function F(){}return F.init=function(){F.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 W;for(W in F.types)F.types.hasOwnProperty(W)&&(F.types[W]=[W.charCodeAt(0),W.charCodeAt(1),W.charCodeAt(2),W.charCodeAt(3)]);var M=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]),R=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]);F.HDLR_TYPES={video:M,audio:R};var g=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),p=new Uint8Array([0,0,0,0,0,0,0,0]);F.STTS=F.STSC=F.STCO=p,F.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),F.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),F.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),F.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var f=new Uint8Array([105,115,111,109]),h=new Uint8Array([97,118,99,49]),s=new Uint8Array([0,0,0,1]);F.FTYP=F.box(F.types.ftyp,f,s,f,h),F.DINF=F.box(F.types.dinf,F.box(F.types.dref,g))},F.box=function(W){for(var M=8,R=arguments.length,g=new Array(R>1?R-1:0),p=1;p>24&255,s[1]=M>>16&255,s[2]=M>>8&255,s[3]=M&255,s.set(W,4),f=0,M=8;f>24&255,W>>16&255,W>>8&255,W&255,R>>24,R>>16&255,R>>8&255,R&255,g>>24,g>>16&255,g>>8&255,g&255,85,196,0,0]))},F.mdia=function(W){return F.box(F.types.mdia,F.mdhd(W.timescale,W.duration),F.hdlr(W.type),F.minf(W))},F.mfhd=function(W){return F.box(F.types.mfhd,new Uint8Array([0,0,0,0,W>>24,W>>16&255,W>>8&255,W&255]))},F.minf=function(W){return W.type==="audio"?F.box(F.types.minf,F.box(F.types.smhd,F.SMHD),F.DINF,F.stbl(W)):F.box(F.types.minf,F.box(F.types.vmhd,F.VMHD),F.DINF,F.stbl(W))},F.moof=function(W,M,R){return F.box(F.types.moof,F.mfhd(W),F.traf(R,M))},F.moov=function(W){for(var M=W.length,R=[];M--;)R[M]=F.trak(W[M]);return F.box.apply(null,[F.types.moov,F.mvhd(W[0].timescale,W[0].duration)].concat(R).concat(F.mvex(W)))},F.mvex=function(W){for(var M=W.length,R=[];M--;)R[M]=F.trex(W[M]);return F.box.apply(null,[F.types.mvex].concat(R))},F.mvhd=function(W,M){M*=W;var R=Math.floor(M/(Q+1)),g=Math.floor(M%(Q+1)),p=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,W>>24&255,W>>16&255,W>>8&255,W&255,R>>24,R>>16&255,R>>8&255,R&255,g>>24,g>>16&255,g>>8&255,g&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 F.box(F.types.mvhd,p)},F.sdtp=function(W){var M=W.samples||[],R=new Uint8Array(4+M.length),g,p;for(g=0;g>>8&255),M.push(f&255),M=M.concat(Array.prototype.slice.call(p));for(g=0;g>>8&255),R.push(f&255),R=R.concat(Array.prototype.slice.call(p));var h=F.box(F.types.avcC,new Uint8Array([1,M[3],M[4],M[5],252|3,224|W.sps.length].concat(M).concat([W.pps.length]).concat(R))),s=W.width,d=W.height,o=W.pixelRatio[0],n=W.pixelRatio[1];return F.box(F.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,s>>8&255,s&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]),h,F.box(F.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),F.box(F.types.pasp,new Uint8Array([o>>24,o>>16&255,o>>8&255,o&255,n>>24,n>>16&255,n>>8&255,n&255])))},F.esds=function(W){var M=W.config.length;return new Uint8Array([0,0,0,0,3,23+M,0,1,0,4,15+M,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([M]).concat(W.config).concat([6,1,2]))},F.mp4a=function(W){var M=W.samplerate;return F.box(F.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]),F.box(F.types.esds,F.esds(W)))},F.mp3=function(W){var M=W.samplerate;return F.box(F.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,W.channelCount,0,16,0,0,0,0,M>>8&255,M&255,0,0]))},F.stsd=function(W){return W.type==="audio"?!W.isAAC&&W.codec==="mp3"?F.box(F.types.stsd,F.STSD,F.mp3(W)):F.box(F.types.stsd,F.STSD,F.mp4a(W)):F.box(F.types.stsd,F.STSD,F.avc1(W))},F.tkhd=function(W){var M=W.id,R=W.duration*W.timescale,g=W.width,p=W.height,f=Math.floor(R/(Q+1)),h=Math.floor(R%(Q+1));return F.box(F.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,0,0,0,0,f>>24,f>>16&255,f>>8&255,f&255,h>>24,h>>16&255,h>>8&255,h&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,g>>8&255,g&255,0,0,p>>8&255,p&255,0,0]))},F.traf=function(W,M){var R=F.sdtp(W),g=W.id,p=Math.floor(M/(Q+1)),f=Math.floor(M%(Q+1));return F.box(F.types.traf,F.box(F.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),F.box(F.types.tfdt,new Uint8Array([1,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,f>>24,f>>16&255,f>>8&255,f&255])),F.trun(W,R.length+16+20+8+16+8+8),R)},F.trak=function(W){return W.duration=W.duration||4294967295,F.box(F.types.trak,F.tkhd(W),F.mdia(W))},F.trex=function(W){var M=W.id;return F.box(F.types.trex,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},F.trun=function(W,M){var R=W.samples||[],g=R.length,p=12+16*g,f=new Uint8Array(p),h,s,d,o,n,u;for(M+=8+p,f.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,M>>>24&255,M>>>16&255,M>>>8&255,M&255],0),h=0;h>>24&255,d>>>16&255,d>>>8&255,d&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.paddingValue<<1|n.isNonSync,n.degradPrio&240<<8,n.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*h);return F.box(F.types.trun,f)},F.initSegment=function(W){F.types||F.init();var M=F.moov(W),R=new Uint8Array(F.FTYP.byteLength+M.byteLength);return R.set(F.FTYP),R.set(M,F.FTYP.byteLength),R},F}();H.types=void 0,H.HDLR_TYPES=void 0,H.STTS=void 0,H.STSC=void 0,H.STCO=void 0,H.STSZ=void 0,H.VMHD=void 0,H.SMHD=void 0,H.STSD=void 0,H.FTYP=void 0,H.DINF=void 0,Z.default=H},"./src/remux/mp4-remuxer.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return u}),P.d(Z,"normalizePts",function(){return c});var Q=P("./src/polyfills/number.ts"),H=P("./src/remux/aac-helper.ts"),F=P("./src/remux/mp4-generator.ts"),K=P("./src/events.ts"),W=P("./src/errors.ts"),M=P("./src/utils/logger.ts"),R=P("./src/types/loader.ts"),g=P("./src/utils/timescale-conversion.ts");function p(){return p=Object.assign||function(O){for(var w=1;w0?E:m.pts},T[0].pts);return _&&M.logger.debug("PTS rollover detected"),l},w.remux=function(T,_,l,E,m,b,N,D){var B,j,I,v,G,Y,re=m,oe=m,we=T.pid>-1,pe=_.pid>-1,Ee=_.samples.length,_e=T.samples.length>0,Ae=Ee>1,fe=(!we||_e)&&(!pe||Ae)||this.ISGenerated||N;if(fe){this.ISGenerated||(I=this.generateIS(T,_,m));var ue=this.isVideoContiguous,ie=-1;if(Ae&&(ie=L(_.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,ie>0){M.logger.warn("[mp4-remuxer]: Dropped "+ie+" out of "+Ee+" video samples due to a missing keyframe");var de=this.getVideoStartPts(_.samples);_.samples=_.samples.slice(ie),_.dropped+=ie,oe+=(_.samples[0].pts-de)/(_.timescale||9e4)}else ie===-1&&(M.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ee+" video samples"),Y=!1);if(this.ISGenerated){if(_e&&Ae){var se=this.getVideoStartPts(_.samples),Re=c(T.samples[0].pts,se)-se,ke=Re/_.inputTimeScale;re+=Math.max(0,ke),oe+=Math.max(0,-ke)}if(_e){if(T.samplerate||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),I=this.generateIS(T,_,m)),j=this.remuxAudio(T,re,this.isAudioContiguous,b,pe||Ae||D===R.PlaylistLevelType.AUDIO?oe:void 0),Ae){var Te=j?j.endPTS-j.startPTS:0;_.inputTimeScale||(M.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),I=this.generateIS(T,_,m)),B=this.remuxVideo(_,oe,ue,Te)}}else Ae&&(B=this.remuxVideo(_,oe,ue,0));B&&(B.firstKeyFrame=ie,B.independent=ie!==-1)}}return this.ISGenerated&&(l.samples.length&&(G=this.remuxID3(l,m)),E.samples.length&&(v=this.remuxText(E,m))),{audio:j,video:B,initSegment:I,independent:Y,text:v,id3:G}},w.generateIS=function(T,_,l){var E=T.samples,m=_.samples,b=this.typeSupported,N={},D=!Object(Q.isFiniteNumber)(this._initPTS),B="audio/mp4",j,I,v;if(D&&(j=I=Infinity),T.config&&E.length&&(T.timescale=T.samplerate,T.isAAC||(b.mpeg?(B="audio/mpeg",T.codec=""):b.mp3&&(T.codec="mp3")),N.audio={id:"audio",container:B,codec:T.codec,initSegment:!T.isAAC&&b.mpeg?new Uint8Array(0):F.default.initSegment([T]),metadata:{channelCount:T.channelCount}},D&&(v=T.inputTimeScale,j=I=E[0].pts-Math.round(v*l))),_.sps&&_.pps&&m.length&&(_.timescale=_.inputTimeScale,N.video={id:"main",container:"video/mp4",codec:_.codec,initSegment:F.default.initSegment([_]),metadata:{width:_.width,height:_.height}},D)){v=_.inputTimeScale;var G=this.getVideoStartPts(m),Y=Math.round(v*l);I=Math.min(I,c(m[0].dts,G)-Y),j=Math.min(j,G-Y)}if(Object.keys(N).length)return this.ISGenerated=!0,D&&(this._initPTS=j,this._initDTS=I),{tracks:N,initPTS:j,timescale:v}},w.remuxVideo=function(T,_,l,E){var m=T.inputTimeScale,b=T.samples,N=[],D=b.length,B=this._initPTS,j=this.nextAvcDts,I=8,v,G,Y,re=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,we=0,pe=!1;if(!l||j===null){var Ee=_*m,_e=b[0].pts-c(b[0].dts,b[0].pts);j=Ee-_e}for(var Ae=0;Aefe.pts){var ue=9e4*.2;we=Math.max(Math.min(we,fe.pts-fe.dts),-1*ue)}fe.dts0?Ae-1:Ae].dts&&(pe=!0)}pe&&b.sort(function(Ct,xt){var ht=Ct.dts-xt.dts,Ut=Ct.pts-xt.pts;return ht||Ut}),G=b[0].dts,Y=b[b.length-1].dts;var ie=Math.round((Y-G)/(D-1));if(we<0){if(weie,Ce=ke<-1;if(Te||Ce){Te?M.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(ke,!0)+" ms ("+ke+"dts) hole between fragments detected, filling it"):M.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-ke,!0)+" ms ("+ke+"dts) overlapping between fragments detected"),G=j;var Le=b[0].pts-ke;b[0].dts=G,b[0].pts=Le,M.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(Le,!0)+"/"+Object(g.toMsFromMpegTsClock)(G,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(ke,!0)+" ms")}}n&&(G=Math.max(0,G));for(var Be=0,Fe=0,Me=0;Me0?Ne-1:Ne].dts;if(ae.stretchShortVideoTrack&&this.nextAudioPts!==null){var me=Math.floor(ae.maxBufferHole*m),be=(E?re+E*m:this.nextAudioPts)-ut.pts;be>me?(v=be-he,v<0&&(v=he),M.logger.log("[mp4-remuxer]: It is approximately "+be/90+" ms to the next segment; using duration "+v/90+" ms for the last video frame.")):v=he}else v=he}var De=Math.round(ut.pts-ut.dts);N.push(new C(ut.key,v,Pe,De))}if(N.length&&d&&d<70){var Ge=N[0].flags;Ge.dependsOn=2,Ge.isNonSync=0}console.assert(v!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=j=Y+v,this.isVideoContiguous=!0;var st=F.default.moof(T.sequenceNumber++,G,p({},T,{samples:N})),ft="video",pt={data1:st,data2:et,startPTS:re/m,endPTS:(oe+v)/m,startDTS:G/m,endDTS:j/m,type:ft,hasAudio:!1,hasVideo:!0,nb:N.length,dropped:T.dropped};return T.samples=[],T.dropped=0,console.assert(et.length,"MDAT length must not be zero"),pt},w.remuxAudio=function(T,_,l,E,m){var b=T.inputTimeScale,N=T.samplerate?T.samplerate:b,D=b/N,B=T.isAAC?h:s,j=B*D,I=this._initPTS,v=!T.isAAC&&this.typeSupported.mpeg,G=[],Y=T.samples,re=v?0:8,oe=this.nextAudioPts||-1,we=_*b;if(this.isAudioContiguous=l=l||Y.length&&oe>0&&(E&&Math.abs(we-oe)<9e3||Math.abs(c(Y[0].pts-I,we)-oe)<20*j),Y.forEach(function(xe){xe.pts=c(xe.pts-I,we)}),!l||oe<0){if(Y=Y.filter(function(xe){return xe.pts>=0}),!Y.length)return;m===0?oe=0:E?oe=Math.max(0,we):oe=Y[0].pts}if(T.isAAC)for(var pe=m!==void 0,Ee=this.config.maxAudioFramesDrift,_e=0,Ae=oe;_e=Ee*j&&de0){Fe+=re;try{Be=new Uint8Array(Fe)}catch(xe){this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:W.ErrorTypes.MUX_ERROR,details:W.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Fe,reason:"fail allocating audio mdat "+Fe});return}if(!v){var et=new DataView(Be.buffer);et.setUint32(0,Fe),Be.set(F.default.types.mdat,4)}}else return;Be.set(Ze,re);var rt=Ze.byteLength;re+=rt,G.push(new C(!0,B,rt,0)),Le=Xe}var Ne=G.length;if(!Ne)return;var ut=G[G.length-1];this.nextAudioPts=oe=Le+D*ut.duration;var tt=v?new Uint8Array(0):F.default.moof(T.sequenceNumber++,Ce/D,p({},T,{samples:G}));T.samples=[];var Pe=Ce/b,We=oe/b,Se="audio",ve={data1:tt,data2:Be,startPTS:Pe,endPTS:We,startDTS:Pe,endDTS:We,type:Se,hasAudio:!0,hasVideo:!1,nb:Ne};return this.isAudioContiguous=!0,console.assert(Be.length,"MDAT length must not be zero"),ve},w.remuxEmptyAudio=function(T,_,l,E){var m=T.inputTimeScale,b=T.samplerate?T.samplerate:m,N=m/b,D=this.nextAudioPts,B=(D!==null?D:E.startDTS*m)+this._initDTS,j=E.endDTS*m+this._initDTS,I=N*h,v=Math.ceil((j-B)/I),G=H.default.getSilentFrame(T.manifestCodec||T.codec,T.channelCount);if(M.logger.warn("[mp4-remuxer]: remux empty Audio"),!G){M.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],re=0;re4294967296;)O+=S;return O}function L(O){for(var w=0;w0?this.lastEndDTS=T:(K.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var _=!!O.audio,l=!!O.video,E="";_&&(E+="audio"),l&&(E+="video");var m={data1:C,startPTS:S,startDTS:S,endPTS:T,endDTS:T,type:E,hasAudio:_,hasVideo:l,nb:1,dropped:0};return L.audio=m.type==="audio"?m:void 0,L.video=m.type!=="audio"?m:void 0,L.text=o,L.id3=d,L.initSegment=x,L},g}(),M=function(p,f,h){return Object(H.getStartDTS)(p,f)-h};function R(g,p){var f=g==null?void 0:g.codec;return f&&f.length>4?f:f==="hvc1"?"hvc1.1.c.L120.90":f==="av01"?"av01.0.04M.08":f==="avc1"||p===F.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Z.default=W},"./src/task-loop.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"default",function(){return Q});var Q=function(){function H(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var F=H.prototype;return F.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},F.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},F.onHandlerDestroyed=function(){},F.hasInterval=function(){return!!this._tickInterval},F.hasNextTick=function(){return!!this._tickTimer},F.setInterval=function(W){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,W),!0)},F.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},F.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},F.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},F.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},F.doTick=function(){},H}()},"./src/types/cmcd.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"CMCDVersion",function(){return Q}),P.d(Z,"CMCDObjectType",function(){return H}),P.d(Z,"CMCDStreamingFormat",function(){return F}),P.d(Z,"CMCDStreamType",function(){return K});var Q=1,H;(function(W){W.MANIFEST="m",W.AUDIO="a",W.VIDEO="v",W.MUXED="av",W.INIT="i",W.CAPTION="c",W.TIMED_TEXT="tt",W.KEY="k",W.OTHER="o"})(H||(H={}));var F;(function(W){W.DASH="d",W.HLS="h",W.SMOOTH="s",W.OTHER="o"})(F||(F={}));var K;(function(W){W.VOD="v",W.LIVE="l"})(K||(K={}))},"./src/types/level.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"HlsSkip",function(){return F}),P.d(Z,"getSkipValue",function(){return K}),P.d(Z,"HlsUrlParameters",function(){return W}),P.d(Z,"Level",function(){return M});function Q(R,g){for(var p=0;pNumber.MAX_SAFE_INTEGER?Infinity:g},W.hexadecimalInteger=function(R){if(this[R]){var g=(this[R]||"0x").slice(2);g=(g.length&1?"0":"")+g;for(var p=new Uint8Array(g.length/2),f=0;fNumber.MAX_SAFE_INTEGER?Infinity:g},W.decimalFloatingPoint=function(R){return parseFloat(this[R])},W.optionalFloat=function(R,g){var p=this[R];return p?parseFloat(p):g},W.enumeratedString=function(R){return this[R]},W.bool=function(R){return this[R]==="YES"},W.decimalResolution=function(R){var g=Q.exec(this[R]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},K.parseAttrList=function(R){var g,p={},f='"';for(H.lastIndex=0;(g=H.exec(R))!==null;){var h=g[2];h.indexOf(f)===0&&h.lastIndexOf(f)===h.length-1&&(h=h.slice(1,-1)),p[g[1]]=h}return p},K}()},"./src/utils/binary-search.ts":function(le,Z,P){"use strict";P.r(Z);var Q={search:function(F,K){for(var W=0,M=F.length-1,R=null,g=null;W<=M;){R=(W+M)/2|0,g=F[R];var p=K(g);if(p>0)W=R+1;else if(p<0)M=R-1;else return g}return null}};Z.default=Q},"./src/utils/buffer-helper.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"BufferHelper",function(){return F});var Q=P("./src/utils/logger.ts"),H={length:0,start:function(){return 0},end:function(){return 0}},F=function(){function K(){}return K.isBuffered=function(M,R){try{if(M){for(var g=K.getBuffered(M),p=0;p=g.start(p)&&R<=g.end(p))return!0}}catch(f){}return!1},K.bufferInfo=function(M,R,g){try{if(M){var p=K.getBuffered(M),f=[],h;for(h=0;hs&&(p[h-1].end=M[f].end):p.push(M[f])}else p.push(M[f])}else p=M;for(var d=0,o,n=R,u=R,c=0;c=L&&R=l&&Q.logger.log(this.time+" ["+l+"] "+E)},S}(),d=function(T){for(var _=[],l=0;lW&&(this.logger.log(h.DEBUG,"Too large cursor position "+this.pos),this.pos=W)},T.moveCursor=function(l){var E=this.pos+l;if(l>1)for(var m=this.pos+1;m=144&&this.backSpace();var E=F(l);if(this.pos>=W){this.logger.log(h.ERROR,"Cannot insert "+l.toString(16)+" ("+E+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(E,this.currPenState),this.moveCursor(1)},T.clearFromPos=function(l){var E;for(E=l;E0&&(l?m="["+E.join(" | ")+"]":m=E.join(` `)),m},T.getTextAndFormat=function(){return this.rows},S}(),L=function(){function S(_,l,E){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=_,this.outputFilter=l,this.mode=null,this.verbose=0,this.displayedMemory=new c(E),this.nonDisplayedMemory=new c(E),this.lastOutputScreen=new c(E),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=E}var T=S.prototype;return T.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[K-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},T.getHandler=function(){return this.outputFilter},T.setHandler=function(l){this.outputFilter=l},T.setPAC=function(l){this.writeScreen.setPAC(l)},T.setBkgData=function(l){this.writeScreen.setBkgData(l)},T.setMode=function(l){if(l===this.mode)return;this.mode=l,this.logger.log(h.INFO,"MODE="+l),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=l},T.insertChars=function(l){for(var E=0;E=46,E.italics)E.foreground="white";else{var m=Math.floor(l/2)-16,b=["white","green","blue","cyan","red","yellow","magenta"];E.foreground=b[m]}this.logger.log(h.INFO,"MIDROW: "+JSON.stringify(E)),this.writeScreen.setPen(E)},T.outputDataUpdate=function(l){l===void 0&&(l=!1);var E=this.logger.time;if(E===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=E:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,E,this.lastOutputScreen),l&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:E),this.lastOutputScreen.copy(this.displayedMemory))},T.cueSplitAtTime=function(l){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,l,this.displayedMemory),this.cueStartTime=l))},S}(),C=function(){function S(_,l,E){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new s;this.channels=[null,new L(_,l,m),new L(_+1,E,m)],this.cmdHistory=w(),this.logger=m}var T=S.prototype;return T.getHandler=function(l){return this.channels[l].getHandler()},T.setHandler=function(l,E){this.channels[l].setHandler(E)},T.addData=function(l,E){var m,b,N,D=!1;this.logger.time=l;for(var B=0;B ("+d([b,N])+")"),m=this.parseCmd(b,N),m||(m=this.parseMidrow(b,N)),m||(m=this.parsePAC(b,N)),m||(m=this.parseBackgroundAttributes(b,N)),!m&&(D=this.parseChars(b,N),D)){var j=this.currentChannel;if(j&&j>0){var I=this.channels[j];I.insertChars(D)}else this.logger.log(h.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!D&&this.logger.log(h.WARNING,"Couldn't parse cleaned data "+d([b,N])+" orig: "+d([E[B],E[B+1]]))}},T.parseCmd=function(l,E){var m=this.cmdHistory,b=(l===20||l===28||l===21||l===29)&&E>=32&&E<=47,N=(l===23||l===31)&&E>=33&&E<=35;if(!(b||N))return!1;if(O(l,E,m))return x(null,null,m),this.logger.log(h.DEBUG,"Repeated command ("+d([l,E])+") is dropped"),!0;var D=l===20||l===21||l===23?1:2,B=this.channels[D];return l===20||l===21||l===28||l===29?E===32?B.ccRCL():E===33?B.ccBS():E===34?B.ccAOF():E===35?B.ccAON():E===36?B.ccDER():E===37?B.ccRU(2):E===38?B.ccRU(3):E===39?B.ccRU(4):E===40?B.ccFON():E===41?B.ccRDC():E===42?B.ccTR():E===43?B.ccRTD():E===44?B.ccEDM():E===45?B.ccCR():E===46?B.ccENM():E===47&&B.ccEOC():B.ccTO(E-32),x(l,E,m),this.currentChannel=D,!0},T.parseMidrow=function(l,E){var m=0;if((l===17||l===25)&&E>=32&&E<=47){if(l===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(h.ERROR,"Mismatch channel in midrow parsing"),!1;var b=this.channels[m];return b?(b.ccMIDROW(E),this.logger.log(h.DEBUG,"MIDROW ("+d([l,E])+")"),!0):!1}return!1},T.parsePAC=function(l,E){var m,b=this.cmdHistory,N=(l>=17&&l<=23||l>=25&&l<=31)&&E>=64&&E<=127,D=(l===16||l===24)&&E>=64&&E<=95;if(!(N||D))return!1;if(O(l,E,b))return x(null,null,b),!0;var B=l<=23?1:2;E>=64&&E<=95?m=B===1?M[l]:g[l]:m=B===1?R[l]:p[l];var j=this.channels[B];return j?(j.setPAC(this.interpretPAC(m,E)),x(l,E,b),this.currentChannel=B,!0):!1},T.interpretPAC=function(l,E){var m,b={color:null,italics:!1,indent:null,underline:!1,row:l};return E>95?m=E-96:m=E-64,b.underline=(m&1)===1,m<=13?b.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(b.italics=!0,b.color="white"):b.indent=Math.floor((m-16)/2)*4,b},T.parseChars=function(l,E){var m,b=null,N=null;if(l>=25?(m=2,N=l-8):(m=1,N=l),N>=17&&N<=19){var D;N===17?D=E+80:N===18?D=E+112:D=E+144,this.logger.log(h.INFO,"Special char '"+F(D)+"' in channel "+m),b=[D]}else l>=32&&l<=127&&(b=E===0?[l]:[l,E]);if(b){var B=d(b);this.logger.log(h.DEBUG,"Char codes = "+B.join(",")),x(l,E,this.cmdHistory)}return b},T.parseBackgroundAttributes=function(l,E){var m=(l===16||l===24)&&E>=32&&E<=47,b=(l===23||l===31)&&E>=45&&E<=47;if(!(m||b))return!1;var N,D={};l===16||l===24?(N=Math.floor((E-32)/2),D.background=f[N],E%2===1&&(D.background=D.background+"_semi")):E===45?D.background="transparent":(D.foreground="black",E===47&&(D.underline=!0));var B=l<=23?1:2,j=this.channels[B];return j.setBkgData(D),x(l,E,this.cmdHistory),!0},T.reset=function(){for(var l=0;l=16?n--:n++;var x=Object(Q.fixLineBreaks)(u.trim()),O=Object(H.generateCueId)(g,p,x);(!R||!R.cues||!R.cues.getCueById(O))&&(d=new c(g,p,x),d.id=O,d.line=L+1,d.align="left",d.position=10+Math.min(80,Math.floor(n*8/32)*10),h.push(d))}return R&&h.length&&(h.sort(function(w,S){return w.line==="auto"||S.line==="auto"?0:w.line>8&&S.line>8?S.line-w.line:w.line-S.line}),h.forEach(function(w){return Object(F.addCueToTrack)(R,w)})),h}};Z.default=W},"./src/utils/discontinuities.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"findFirstFragWithCC",function(){return K}),P.d(Z,"shouldAlignOnDiscontinuities",function(){return W}),P.d(Z,"findDiscontinuousReferenceFrag",function(){return M}),P.d(Z,"adjustSlidingStart",function(){return g}),P.d(Z,"alignStream",function(){return p}),P.d(Z,"alignPDT",function(){return h}),P.d(Z,"alignFragmentByPDTDelta",function(){return s}),P.d(Z,"alignMediaPlaylistByPDT",function(){return d});var Q=P("./src/polyfills/number.ts"),H=P("./src/utils/logger.ts"),F=P("./src/controller/level-helper.ts");function K(o,n){for(var u=null,c=0,L=o.length;cu.startCC||o&&o.cc=this.minWeight_},K.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},K.destroy=function(){},F}();Z.default=H},"./src/utils/ewma.ts":function(le,Z,P){"use strict";P.r(Z);var Q=function(){function H(K,W,M){W===void 0&&(W=0),M===void 0&&(M=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=K,this.alpha_=K?Math.exp(Math.log(.5)/K):0,this.estimate_=W,this.totalWeight_=M}var F=H.prototype;return F.sample=function(W,M){var R=Math.pow(this.alpha_,W);this.estimate_=M*(1-R)+R*this.estimate_,this.totalWeight_+=W},F.getTotalWeight=function(){return this.totalWeight_},F.getEstimate=function(){if(this.alpha_){var W=1-Math.pow(this.alpha_,this.totalWeight_);if(W)return this.estimate_/W}return this.estimate_},H}();Z.default=Q},"./src/utils/fetch-loader.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"fetchSupported",function(){return s});var Q=P("./src/polyfills/number.ts"),H=P("./src/loader/load-stats.ts"),F=P("./src/demux/chunk-cache.ts");function K(c,L){c.prototype=Object.create(L.prototype),c.prototype.constructor=c,p(c,L)}function W(c){var L=typeof Map=="function"?new Map:void 0;return W=function(x){if(x===null||!g(x))return x;if(typeof x!="function")throw new TypeError("Super expression must either be null or a function");if(typeof L!="undefined"){if(L.has(x))return L.get(x);L.set(x,O)}function O(){return M(x,arguments,f(this).constructor)}return O.prototype=Object.create(x.prototype,{constructor:{value:O,enumerable:!1,writable:!0,configurable:!0}}),p(O,x)},W(c)}function M(c,L,C){return R()?M=Reflect.construct:M=function(O,w,S){var T=[null];T.push.apply(T,w);var _=Function.bind.apply(O,T),l=new _;return S&&p(l,S.prototype),l},M.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(c){return!1}}function g(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function p(c,L){return p=Object.setPrototypeOf||function(x,O){return x.__proto__=O,x},p(c,L)}function f(c){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(C){return C.__proto__||Object.getPrototypeOf(C)},f(c)}function h(){return h=Object.assign||function(c){for(var L=1;L=S&&T(O,w,_.flush(),x)):T(O,w,N,x),m()}).catch(function(){return Promise.reject()})};return E()},c}();function o(c,L){var C={method:"GET",mode:"cors",credentials:"same-origin",signal:L,headers:new self.Headers(h({},c.headers))};return c.rangeEnd&&C.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),C}function n(c,L){return new self.Request(c.url,L)}var u=function(c){K(L,c);function L(C,x,O){var w;return w=c.call(this,C)||this,w.code=void 0,w.details=void 0,w.code=x,w.details=O,w}return L}(W(Error));Z.default=d},"./src/utils/imsc1-ttml-parser.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"IMSC1_CODEC",function(){return g}),P.d(Z,"parseIMSC1",function(){return s});var Q=P("./src/utils/mp4-tools.ts"),H=P("./src/utils/vttparser.ts"),F=P("./src/utils/vttcue.ts"),K=P("./src/demux/id3.ts"),W=P("./src/utils/timescale-conversion.ts"),M=P("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(S){for(var T=1;T"):Q}function W(g){for(var p=arguments.length,f=new Array(p>1?p-1:0),h=1;h>24,L[C+1]=x>>16&255,L[C+2]=x>>8&255,L[C+3]=x&255}function p(L,C){var x=[];if(!C.length)return x;var O,w,S;"data"in L?(O=L.data,w=L.start,S=L.end):(O=L,w=0,S=O.byteLength);for(var T=w;T1?T+_:S;if(l===C[0])if(C.length===1)x.push({data:O,start:T+8,end:E});else{var m=p({data:O,start:T+8,end:E},C.slice(1));m.length&&K.apply(x,m)}T=E}return x}function f(L){var C=p(L,["moov"]),x=C[0],O=x?x.end:null,w=p(L,["sidx"]);if(!w||!w[0])return null;var S=[],T=w[0],_=T.data[0],l=_===0?8:16,E=R(T,l);l+=4;var m=0,b=0;_===0?l+=8:l+=16,l+=2;var N=T.end+b,D=M(T,l);l+=2;for(var B=0;B>>31;if(G===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=R(T,j);j+=4,S.push({referenceSize:v,subsegmentDuration:Y,info:{duration:Y/E,start:N,end:N+v-1}}),N+=v,j+=4,l=j}return{earliestPresentationTime:m,timescale:E,version:_,referencesCount:D,references:S,moovEndOffset:O}}function h(L){for(var C=[],x=p(L,["moov","trak"]),O=0;OW)&&(this.startTime=W),this.endTime=M,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},F.reset=function(){this.cueRanges=[]},H}()},"./src/utils/texttrack-utils.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"sendAddTrackEvent",function(){return H}),P.d(Z,"addCueToTrack",function(){return F}),P.d(Z,"clearCurrentCues",function(){return K}),P.d(Z,"removeCuesInRange",function(){return W}),P.d(Z,"getCuesInRange",function(){return R});var Q=P("./src/utils/logger.ts");function H(g,p){var f;try{f=new Event("addtrack")}catch(h){f=document.createEvent("Event"),f.initEvent("addtrack",!1,!1)}f.track=g,p.dispatchEvent(f)}function F(g,p){var f=g.mode;if(f==="disabled"&&(g.mode="hidden"),g.cues&&!g.cues.getCueById(p.id))try{if(g.addCue(p),!g.cues.getCueById(p.id))throw new Error("addCue is failed for: "+p)}catch(s){Q.logger.debug("[texttrack-utils]: "+s);var h=new self.TextTrackCue(p.startTime,p.endTime,p.text);h.id=p.id,g.addCue(h)}f==="disabled"&&(g.mode=f)}function K(g){var p=g.mode;if(p==="disabled"&&(g.mode="hidden"),g.cues)for(var f=g.cues.length;f--;)g.removeCue(g.cues[f]);p==="disabled"&&(g.mode=p)}function W(g,p,f){var h=g.mode;if(h==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var s=R(g.cues,p,f),d=0;dg[f].endTime)return-1;for(var h=0,s=f;h<=s;){var d=Math.floor((s+h)/2);if(pg[d].startTime&&h-1)for(var d=s,o=g.length;d=p&&n.endTime<=f)h.push(n);else if(n.startTime>f)return h}return h}},"./src/utils/time-ranges.ts":function(le,Z,P){"use strict";P.r(Z);var Q={toString:function(F){for(var K="",W=F.length,M=0;M1?p-1:0),h=1;h100)throw new Error("Position must be between 0 and 100.");S=m,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",M({},s,{get:function(){return T},set:function(m){var b=W(m);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");T=b,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",M({},s,{get:function(){return _},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");_=m,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",M({},s,{get:function(){return l},set:function(m){var b=W(m);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");l=b,this.hasBeenReset=!0}})),h.displayState=void 0}return R.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"parseTimeStamp",function(){return F}),P.d(Z,"fixLineBreaks",function(){return p}),P.d(Z,"VTTParser",function(){return f});var Q=P("./src/utils/vttcue.ts"),H=function(){function h(){}var s=h.prototype;return s.decode=function(o,n){if(!o)return"";if(typeof o!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(o))},h}();function F(h){function s(o,n,u,c){return(o|0)*3600+(n|0)*60+(u|0)+parseFloat(c||0)}var d=h.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return d?parseFloat(d[2])>59?s(d[2],d[3],0,d[4]):s(d[1],d[2],d[3],d[4]):null}var K=function(){function h(){this.values=Object.create(null)}var s=h.prototype;return s.set=function(o,n){!this.get(o)&&n!==""&&(this.values[o]=n)},s.get=function(o,n,u){return u?this.has(o)?this.values[o]:n[u]:this.has(o)?this.values[o]:n},s.has=function(o){return o in this.values},s.alt=function(o,n,u){for(var c=0;c=0&&u<=100)return this.set(o,u),!0}return!1},h}();function W(h,s,d,o){var n=o?h.split(o):[h];for(var u in n){if(typeof n[u]!="string")continue;var c=n[u].split(d);if(c.length!==2)continue;var L=c[0],C=c[1];s(L,C)}}var M=new Q.default(0,0,""),R=M.align==="middle"?"middle":"center";function g(h,s,d){var o=h;function n(){var L=F(h);if(L===null)throw new Error("Malformed timestamp: "+o);return h=h.replace(/^[^\sa-zA-Z-]+/,""),L}function u(L,C){var x=new K;W(L,function(S,T){var _;switch(S){case"region":for(var l=d.length-1;l>=0;l--)if(d[l].id===T){x.set(S,d[l].region);break}break;case"vertical":x.alt(S,T,["rl","lr"]);break;case"line":_=T.split(","),x.integer(S,_[0]),x.percent(S,_[0])&&x.set("snapToLines",!1),x.alt(S,_[0],["auto"]),_.length===2&&x.alt("lineAlign",_[1],["start",R,"end"]);break;case"position":_=T.split(","),x.percent(S,_[0]),_.length===2&&x.alt("positionAlign",_[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":x.percent(S,T);break;case"align":x.alt(S,T,["start",R,"end","left","right"]);break}},/:/,/\s/),C.region=x.get("region",null),C.vertical=x.get("vertical","");var O=x.get("line","auto");O==="auto"&&M.line===-1&&(O=-1),C.line=O,C.lineAlign=x.get("lineAlign","start"),C.snapToLines=x.get("snapToLines",!0),C.size=x.get("size",100),C.align=x.get("align",R);var w=x.get("position","auto");w==="auto"&&M.position===50&&(w=C.align==="start"||C.align==="left"?0:C.align==="end"||C.align==="right"?100:50),C.position=w}function c(){h=h.replace(/^\s+/,"")}if(c(),s.startTime=n(),c(),h.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+o);h=h.substr(3),c(),s.endTime=n(),c(),u(h,s)}function p(h){return h.replace(//gi,` `)}var f=function(){function h(){this.state="INITIAL",this.buffer="",this.decoder=new H,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var s=h.prototype;return s.parse=function(o){var n=this;o&&(n.buffer+=n.decoder.decode(o,{stream:!0}));function u(){var w=n.buffer,S=0;for(w=p(w);S")===-1){n.cue.id=L;continue}case"CUE":if(!n.cue){n.state="BADCUE";continue}try{g(L,n.cue,n.regionList)}catch(w){n.cue=null,n.state="BADCUE";continue}n.state="CUETEXT";continue;case"CUETEXT":{var O=L.indexOf("-->")!==-1;if(!L||O&&(x=!0)){n.oncue&&n.cue&&n.oncue(n.cue),n.cue=null,n.state="ID";continue}if(n.cue===null)continue;n.cue.text&&(n.cue.text+=` `),n.cue.text+=L}continue;case"BADCUE":L||(n.state="ID")}}}catch(w){n.state==="CUETEXT"&&n.cue&&n.oncue&&n.oncue(n.cue),n.cue=null,n.state=n.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},s.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(n){o.onparsingerror&&o.onparsingerror(n)}return o.onflush&&o.onflush(),this},h}()},"./src/utils/webvtt-parser.ts":function(le,Z,P){"use strict";P.r(Z),P.d(Z,"generateCueId",function(){return f}),P.d(Z,"parseWebVTT",function(){return s});var Q=P("./src/polyfills/number.ts"),H=P("./src/utils/vttparser.ts"),F=P("./src/demux/id3.ts"),K=P("./src/utils/timescale-conversion.ts"),W=P("./src/remux/mp4-remuxer.ts"),M=/\r\n|\n\r|\n|\r/g,R=function(o,n,u){return u===void 0&&(u=0),o.substr(u,n.length)===n},g=function(o){var n=parseInt(o.substr(-3)),u=parseInt(o.substr(-6,2)),c=parseInt(o.substr(-9,2)),L=o.length>9?parseInt(o.substr(0,o.indexOf(":"))):0;if(!Object(Q.isFiniteNumber)(n)||!Object(Q.isFiniteNumber)(u)||!Object(Q.isFiniteNumber)(c)||!Object(Q.isFiniteNumber)(L))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+o);return n+=1e3*u,n+=60*1e3*c,n+=60*60*1e3*L,n},p=function(o){for(var n=5381,u=o.length;u;)n=n*33^o.charCodeAt(--u);return(n>>>0).toString()};function f(d,o,n){return p(d.toString())+p(o.toString())+p(n)}var h=function(o,n,u){var c=o[n],L=o[c.prevCC];if(!L||!L.new&&c.new){o.ccOffset=o.presentationOffset=c.start,c.new=!1;return}for(;(C=L)!==null&&C!==void 0&&C.new;){var C;o.ccOffset+=c.start-L.start,c.new=!1,c=L,L=o[c.prevCC]}o.presentationOffset=u};function s(d,o,n,u,c,L,C,x){var O=new H.VTTParser,w=Object(F.utf8ArrayToStr)(new Uint8Array(d)).trim().replace(M,` `).split(` `),S=[],T=Object(K.toMpegTsClockFromTimescale)(o,n),_="00:00.000",l=0,E=0,m,b=!0,N=!1;O.oncue=function(D){var B=u[c],j=u.ccOffset,I=(l-T)/9e4;if(B!=null&&B.new&&(E!==void 0?j=u.ccOffset=B.start:h(u,c,I)),I&&(j=I-u.presentationOffset),N){var v=D.endTime-D.startTime,G=Object(W.normalizePts)((D.startTime+j-E)*9e4,L*9e4)/9e4;D.startTime=G,D.endTime=G+v}var Y=D.text.trim();D.text=decodeURIComponent(encodeURIComponent(Y)),D.id||(D.id=f(D.startTime,D.endTime,Y)),D.endTime>0&&S.push(D)},O.onparsingerror=function(D){m=D},O.onflush=function(){if(m){x(m);return}C(S)},w.forEach(function(D){if(b)if(R(D,"X-TIMESTAMP-MAP=")){b=!1,N=!0,D.substr(16).split(",").forEach(function(B){R(B,"LOCAL:")?_=B.substr(6):R(B,"MPEGTS:")&&(l=parseInt(B.substr(7)))});try{E=g(_)/1e3}catch(B){N=!1,m=B}return}else D===""&&(b=!1);O.parse(D+` `)}),O.flush()}},"./src/utils/xhr-loader.ts":function(le,Z,P){"use strict";P.r(Z);var Q=P("./src/utils/logger.ts"),H=P("./src/loader/load-stats.ts"),F=/^age:\s*[\d.]+\s*$/m,K=function(){function W(R){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=R?R.xhrSetup:null,this.stats=new H.LoadStats,this.retryDelay=0}var M=W.prototype;return M.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},M.abortInternal=function(){var g=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),g&&(g.onreadystatechange=null,g.onprogress=null,g.readyState!==4&&(this.stats.aborted=!0,g.abort()))},M.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},M.load=function(g,p,f){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=g,this.config=p,this.callbacks=f,this.retryDelay=p.retryDelay,this.loadInternal()},M.loadInternal=function(){var g=this.config,p=this.context;if(!g)return;var f=this.loader=new self.XMLHttpRequest,h=this.stats;h.loading.first=0,h.loaded=0;var s=this.xhrSetup;try{if(s)try{s(f,p.url)}catch(n){f.open("GET",p.url,!0),s(f,p.url)}f.readyState||f.open("GET",p.url,!0);var d=this.context.headers;if(d)for(var o in d)f.setRequestHeader(o,d[o])}catch(n){this.callbacks.onError({code:f.status,text:n.message},p,f);return}p.rangeEnd&&f.setRequestHeader("Range","bytes="+p.rangeStart+"-"+(p.rangeEnd-1)),f.onreadystatechange=this.readystatechange.bind(this),f.onprogress=this.loadprogress.bind(this),f.responseType=p.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout),f.send()},M.readystatechange=function(){var g=this.context,p=this.loader,f=this.stats;if(!g||!p)return;var h=p.readyState,s=this.config;if(f.aborted)return;if(h>=2)if(self.clearTimeout(this.requestTimeout),f.loading.first===0&&(f.loading.first=Math.max(self.performance.now(),f.loading.start)),h===4){p.onreadystatechange=null,p.onprogress=null;var d=p.status;if(d>=200&&d<300){f.loading.end=Math.max(self.performance.now(),f.loading.first);var o,n;if(g.responseType==="arraybuffer"?(o=p.response,n=o.byteLength):(o=p.responseText,n=o.length),f.loaded=f.total=n,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(f,g,o,p),!this.callbacks)return;var c={url:p.responseURL,data:o};this.callbacks.onSuccess(c,f,g,p)}else f.retry>=s.maxRetry||d>=400&&d<499?(Q.logger.error(d+" while loading "+g.url),this.callbacks.onError({code:d,text:p.statusText},g,p)):(Q.logger.warn(d+" while loading "+g.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,s.maxRetryDelay),f.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout)},M.loadtimeout=function(){Q.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},M.loadprogress=function(g){var p=this.stats;p.loaded=g.loaded,g.lengthComputable&&(p.total=g.total)},M.getCacheAge=function(){var g=null;if(this.loader&&F.test(this.loader.getAllResponseHeaders())){var p=this.loader.getResponseHeader("age");g=p?parseFloat(p):null}return g},W}();Z.default=K}}).default})},vHTk:function(ct,Qe,ne){ct.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wzkS:function(ct,Qe,ne){"use strict";ne.d(Qe,"c",function(){return H}),ne.d(Qe,"b",function(){return F}),ne.d(Qe,"d",function(){return K}),ne.d(Qe,"a",function(){return M}),ne.d(Qe,"e",function(){return R});var le=ne("9og8"),Z=ne("WmNS"),P=ne.n(Z),Q=ne("ErOA");function H(g){return Object(Q.c)("libraries/".concat(g,".json"))}function F(){return Object(Q.c)("library_tags.json")}function K(g){return W.apply(this,arguments)}function W(){return W=Object(le.a)(P.a.mark(function g(p){var f;return P.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.next=2,Object(Q.b)("attachments/".concat(p,".json"));case 2:return f=s.sent,s.abrupt("return",f.status===0);case 4:case"end":return s.stop()}},g)})),W.apply(this,arguments)}function M(g){return Object(Q.f)("libraries.json",g)}function R(g,p){return Object(Q.g)("libraries/".concat(g,".json"),p)}},y5JW:function(ct,Qe,ne){"use strict";ne.d(Qe,"c",function(){return d}),ne.d(Qe,"a",function(){return o});var le=ne("DZo9"),Z=ne("8z0m"),P=ne("+L6B"),Q=ne("2/Rp"),H=ne("9og8"),F=ne("miYZ"),K=ne("tsqr"),W=ne("k1fw"),M=ne("oBTY"),R=ne("WmNS"),g=ne.n(R),p=ne("q1tI"),f=ne.n(p),h=ne("m3rI"),s=ne("wzkS"),d="\u3000\u3000";function o(n){var u=["Bytes","KB","MB","GB","TB"];if(n==0)return"0 Byte";var c=parseInt(""+Math.floor(Math.log(n)/Math.log(1024)),10);return(n/Math.pow(1024,c)).toFixed(1)+" "+u[c]}Qe.b=function(n){var u=n.value,c=u===void 0?[]:u,L=n.action,C=n.onChange,x=n.className,O=n.maxSize,w=O===void 0?150:O,S=n.title,T=S===void 0?"\u6587\u4EF6\u4E0A\u4F20":S,_=n.accept,l=_===void 0?null:_,E={multiple:!1,fileList:c,accept:l,withCredentials:!0,beforeUpload:function(N){var D=N.size/1024/1024;return!0},action:"".concat(h.a.API_SERVER,"/api/attachments.json"),onChange:function(N){var D,B,j=Object(M.a)(N.fileList);if(j=j.map(function(G){return G.name.indexOf(d)===-1&&(G.name="".concat(G.name).concat(d).concat(o(G.size))),Object(W.a)({},G)}),N.file.status==="done"&&((D=N.file)===null||D===void 0||((B=D.response)===null||B===void 0)?void 0:B.status)===-1){var I,v;K.b.error((I=N.file)===null||I===void 0||((v=I.response)===null||v===void 0)?void 0:v.message),C([]);return}C(j)},onRemove:function(){var b=Object(H.a)(g.a.mark(function D(B){var j,I,v;return g.a.wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:if(j=B.size/1024/1024,!(B.status==="uploading")){Y.next=3;break}return Y.abrupt("return",!0);case 3:if(j0?"\u6BCF\u6B21\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u8D44\u6E90\uFF0C \u5220\u9664\u4E0B\u9762\u8D44\u6E90\u53EF\u91CD\u65B0\u4E0A\u4F20 ":"",disabled:c.length>0,ghost:!0},T),f.a.createElement("span",{onClick:m,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",w,"M)"," ")))}},yQHh:function(ct,Qe,ne){}}]);