You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
436 lines
1.3 MiB
436 lines
1.3 MiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[238,5,6,7,13],{"+NIl":function(Mt,_t,q){(function(le){le(q("VrN/"))})(function(le){"use strict";le.defineMode("stex",function(Q,P){"use strict";function Y(l,n){l.cmdState.push(n)}function D(l){return l.cmdState.length>0?l.cmdState[l.cmdState.length-1]:null}function U(l){var n=l.cmdState.pop();n&&n.closeBracket()}function H(l){for(var n=l.cmdState,c=n.length-1;c>=0;c--){var s=n[c];if(s.name=="DEFAULT")continue;return s}return{styleIdentifier:function(){return null}}}function I(l,n,c){return function(){this.name=l,this.bracketNo=0,this.style=n,this.styles=c,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var F={};F.importmodule=I("importmodule","tag",["string","builtin"]),F.documentclass=I("documentclass","tag",["","atom"]),F.usepackage=I("usepackage","tag",["atom"]),F.begin=I("begin","tag",["atom"]),F.end=I("end","tag",["atom"]),F.label=I("label","tag",["atom"]),F.ref=I("ref","tag",["atom"]),F.eqref=I("eqref","tag",["atom"]),F.cite=I("cite","tag",["atom"]),F.bibitem=I("bibitem","tag",["atom"]),F.Bibitem=I("Bibitem","tag",["atom"]),F.RBibitem=I("RBibitem","tag",["atom"]),F.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(l,n){l.f=n}function g(l,n){var c;if(l.match(/^\\[a-zA-Z@]+/)){var s=l.current().slice(1);return c=F.hasOwnProperty(s)?F[s]:F.DEFAULT,c=new c,Y(n,c),R(n,d),c.style}if(l.match(/^\\[$&%#{}_]/))return"tag";if(l.match(/^\\[,;!\/\\]/))return"tag";if(l.match("\\["))return R(n,function(o,f){return p(o,f,"\\]")}),"keyword";if(l.match("\\("))return R(n,function(o,f){return p(o,f,"\\)")}),"keyword";if(l.match("$$"))return R(n,function(o,f){return p(o,f,"$$")}),"keyword";if(l.match("$"))return R(n,function(o,f){return p(o,f,"$")}),"keyword";var a=l.next();if(a=="%")return l.skipToEnd(),"comment";if(a=="}"||a=="]"){if(c=D(n),c)c.closeBracket(a),R(n,d);else return"error";return"bracket"}else return a=="{"||a=="["?(c=F.DEFAULT,c=new c,Y(n,c),"bracket"):/\d/.test(a)?(l.eatWhile(/[\w.%]/),"atom"):(l.eatWhile(/[\w\-_]/),c=H(n),c.name=="begin"&&(c.argument=l.current()),c.styleIdentifier())}function p(l,n,c){if(l.eatSpace())return null;if(c&&l.match(c))return R(n,g),"keyword";if(l.match(/^\\[a-zA-Z@]+/))return"tag";if(l.match(/^[a-zA-Z]+/))return"variable-2";if(l.match(/^\\[$&%#{}_]/))return"tag";if(l.match(/^\\[,;!\/]/))return"tag";if(l.match(/^[\^_&]/))return"tag";if(l.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(l.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var s=l.next();return s=="{"||s=="}"||s=="["||s=="]"||s=="("||s==")"?"bracket":s=="%"?(l.skipToEnd(),"comment"):"error"}function d(l,n){var c=l.peek(),s;return c=="{"||c=="["?(s=D(n),s.openBracket(c),l.eat(c),R(n,g),"bracket"):/[ \t\r]/.test(c)?(l.eat(c),null):(R(n,g),U(n),g(l,n))}return{startState:function(){var l=P.inMathMode?function(n,c){return p(n,c)}:g;return{cmdState:[],f:l}},copyState:function(l){return{cmdState:l.cmdState.slice(),f:l.f}},token:function(l,n){return n.f(l,n)},blankLine:function(l){l.f=g,l.cmdState.length=0},lineComment:"%"}}),le.defineMIME("text/x-stex","stex"),le.defineMIME("text/x-latex","stex")})},"+ua5":function(Mt,_t,q){},"19Vz":function(Mt,_t,q){(function(le){le(q("VrN/"))})(function(le){le.defineOption("placeholder","",function(I,F,R){var g=R&&R!=le.Init;if(F&&!g)I.on("blur",D),I.on("change",U),I.on("swapDoc",U),le.on(I.getInputField(),"compositionupdate",I.state.placeholderCompose=function(){Y(I)}),U(I);else if(!F&&g){I.off("blur",D),I.off("change",U),I.off("swapDoc",U),le.off(I.getInputField(),"compositionupdate",I.state.placeholderCompose),Q(I);var p=I.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}F&&!I.hasFocus()&&D(I)});function Q(I){I.state.placeholder&&(I.state.placeholder.parentNode.removeChild(I.state.placeholder),I.state.placeholder=null)}function P(I){Q(I);var F=I.state.placeholder=document.createElement("pre");F.style.cssText="height: 0; overflow: visible",F.style.direction=I.getOption("direction"),F.className="CodeMirror-placeholder CodeMirror-line-like";var R=I.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),F.appendChild(R),I.display.lineSpace.insertBefore(F,I.display.lineSpace.firstChild)}function Y(I){setTimeout(function(){var F=!1,R=I.getInputField();R.nodeName=="TEXTAREA"?F=!R.value:I.lineCount()==1&&(F=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),F?P(I):Q(I)},20)}function D(I){H(I)&&P(I)}function U(I){var F=I.getWrapperElement(),R=H(I);F.className=F.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?P(I):Q(I)}function H(I){return I.lineCount()===1&&I.getLine(0)===""}})},"1ZF9":function(Mt,_t,q){Mt.exports=q.p+"static/Authorize.cc9c212f.png"},"1eCo":function(Mt,_t,q){(function(le){le(q("VrN/"))})(function(le){"use strict";var Q={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(Y,D){var U=Y.indentUnit,H={},I=D.htmlMode?Q:P;for(var F in I)H[F]=I[F];for(var F in D)H[F]=D[F];var R,g;function p(h,E){function m(N){return E.tokenize=N,N(h,E)}var T=h.next();if(T=="<")return h.eat("!")?h.eat("[")?h.match("CDATA[")?m(n("atom","]]>")):null:h.match("--")?m(n("comment","-->")):h.match("DOCTYPE",!0,!0)?(h.eatWhile(/[\w\._\-]/),m(c(1))):null:h.eat("?")?(h.eatWhile(/[\w\._\-]/),E.tokenize=n("meta","?>"),"meta"):(R=h.eat("/")?"closeTag":"openTag",E.tokenize=d,"tag bracket");if(T=="&"){var j;return h.eat("#")?h.eat("x")?j=h.eatWhile(/[a-fA-F\d]/)&&h.eat(";"):j=h.eatWhile(/[\d]/)&&h.eat(";"):j=h.eatWhile(/[\w\.\-:]/)&&h.eat(";"),j?"atom":"error"}else return h.eatWhile(/[^&<]/),null}p.isInText=!0;function d(h,E){var m=h.next();if(m==">"||m=="/"&&h.eat(">"))return E.tokenize=p,R=m==">"?"endTag":"selfcloseTag","tag bracket";if(m=="=")return R="equals",null;if(m=="<"){E.tokenize=p,E.state=f,E.tagName=E.tagStart=null;var T=E.tokenize(h,E);return T?T+" tag error":"tag error"}else return/[\'\"]/.test(m)?(E.tokenize=l(m),E.stringStartCol=h.column(),E.tokenize(h,E)):(h.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function l(h){var E=function(m,T){for(;!m.eol();)if(m.next()==h){T.tokenize=d;break}return"string"};return E.isInAttribute=!0,E}function n(h,E){return function(m,T){for(;!m.eol();){if(m.match(E)){T.tokenize=p;break}m.next()}return h}}function c(h){return function(E,m){for(var T;(T=E.next())!=null;){if(T=="<")return m.tokenize=c(h+1),m.tokenize(E,m);if(T==">")if(h==1){m.tokenize=p;break}else return m.tokenize=c(h-1),m.tokenize(E,m)}return"meta"}}function s(h,E,m){this.prev=h.context,this.tagName=E,this.indent=h.indented,this.startOfLine=m,(H.doNotIndent.hasOwnProperty(E)||h.context&&h.context.noIndent)&&(this.noIndent=!0)}function a(h){h.context&&(h.context=h.context.prev)}function o(h,E){for(var m;;){if(!h.context)return;if(m=h.context.tagName,!H.contextGrabbers.hasOwnProperty(m)||!H.contextGrabbers[m].hasOwnProperty(E))return;a(h)}}function f(h,E,m){return h=="openTag"?(m.tagStart=E.column(),L):h=="closeTag"?C:f}function L(h,E,m){return h=="word"?(m.tagName=E.current(),g="tag",w):H.allowMissingTagName&&h=="endTag"?(g="tag bracket",w(h,E,m)):(g="error",L)}function C(h,E,m){if(h=="word"){var T=E.current();return m.context&&m.context.tagName!=T&&H.implicitlyClosed.hasOwnProperty(m.context.tagName)&&a(m),m.context&&m.context.tagName==T||H.matchClosing===!1?(g="tag",x):(g="tag error",A)}else return H.allowMissingTagName&&h=="endTag"?(g="tag bracket",x(h,E,m)):(g="error",A)}function x(h,E,m){return h!="endTag"?(g="error",x):(a(m),f)}function A(h,E,m){return g="error",x(h,E,m)}function w(h,E,m){if(h=="word")return g="attribute",_;if(h=="endTag"||h=="selfcloseTag"){var T=m.tagName,j=m.tagStart;return m.tagName=m.tagStart=null,h=="selfcloseTag"||H.autoSelfClosers.hasOwnProperty(T)?o(m,T):(o(m,T),m.context=new s(m,T,j==m.indented)),f}return g="error",w}function _(h,E,m){return h=="equals"?S:(H.allowMissing||(g="error"),w(h,E,m))}function S(h,E,m){return h=="string"?y:h=="word"&&H.allowUnquoted?(g="string",w):(g="error",w(h,E,m))}function y(h,E,m){return h=="string"?y:w(h,E,m)}return{startState:function(h){var E={tokenize:p,state:f,indented:h||0,tagName:null,tagStart:null,context:null};return h!=null&&(E.baseIndent=h),E},token:function(h,E){if(!E.tagName&&h.sol()&&(E.indented=h.indentation()),h.eatSpace())return null;R=null;var m=E.tokenize(h,E);return(m||R)&&m!="comment"&&(g=null,E.state=E.state(R||m,h,E),g&&(m=g=="error"?m+" error":g)),m},indent:function(h,E,m){var T=h.context;if(h.tokenize.isInAttribute)return h.tagStart==h.indented?h.stringStartCol+1:h.indented+U;if(T&&T.noIndent)return le.Pass;if(h.tokenize!=d&&h.tokenize!=p)return m?m.match(/^(\s*)/)[0].length:0;if(h.tagName)return H.multilineTagIndentPastTag!==!1?h.tagStart+h.tagName.length+2:h.tagStart+U*(H.multilineTagIndentFactor||1);if(H.alignCDATA&&/<!\[CDATA\[/.test(E))return 0;var j=E&&/^<(\/)?([\w_:\.-]*)/.exec(E);if(j&&j[1])for(;T;)if(T.tagName==j[2]){T=T.prev;break}else if(H.implicitlyClosed.hasOwnProperty(T.tagName))T=T.prev;else break;else if(j)for(;T;){var N=H.contextGrabbers[T.tagName];if(N&&N.hasOwnProperty(j[2]))T=T.prev;else break}for(;T&&T.prev&&!T.startOfLine;)T=T.prev;return T?T.indent+U:h.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:H.htmlMode?"html":"xml",helperType:H.htmlMode?"html":"xml",skipAttribute:function(h){h.state==S&&(h.state=w)},xmlCurrentTag:function(h){return h.tagName?{name:h.tagName,close:h.type=="closeTag"}:null},xmlCurrentContext:function(h){for(var E=[],m=h.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})})},"2WWx":function(Mt,_t,q){"use strict";q.r(_t);var le=q("+L6B"),Q=q("2/Rp"),P=q("miYZ"),Y=q("tsqr"),D=q("2qtc"),U=q("kLXV"),H=q("9og8"),I=q("tJVT"),F=q("PpiC"),R=q("Znn+"),g=q("ZTPi"),p=q("WmNS"),d=q.n(p),l=q("q1tI"),n=q.n(l),c=q("9kvl"),s=q("iARn"),a=q.n(s),o=q("Q9mQ"),f=q("diRs"),L=q("sRBo"),C=q("kaz8"),x=q("5NDa"),A=q("5rEg"),w=q("jrin"),_=q("k1fw"),S=q("y8nQ"),y=q("Vl3Y"),h=q("OaEy"),E=q("2fM7"),m=q("Ty5D"),T=q("ZW9T"),j=q("Ot1p"),N=q("RCxd"),K=q("9vSm"),W=q.n(K),k=q("FrRK"),b=q("HeST"),G=q.n(b),J=A.a.TextArea,oe=function(Bt){var Rn=Bt.shixunsDetail,Wn=Bt.globalSetting,nn=Bt.loading,Pt=Bt.dispatch,Mi=Bt.onFinish,$i=Mi===void 0?function(){}:Mi,ui=Object(F.a)(Bt,["shixunsDetail","globalSetting","loading","dispatch","onFinish"]),vn=y.a.useForm(),Bi=Object(I.a)(vn,1),Ai=Bi[0],Pi=function(){var Zt=Object(H.a)(d.a.mark(function Ei(ji){var ri,ii;return d.a.wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return v.next=2,Pt({type:"shixunsDetail/getCustomScript",payload:{id:(ri=Rn.actionTabs.params)===null||ri===void 0?void 0:ri.id,compile:ji.execute,excutive:ji.compile}});case 2:ii=v.sent,ct(),ii&&$i(ii==null?void 0:ii.shixun_script);case 5:case"end":return v.stop()}},Ei)}));return function(ji){return Zt.apply(this,arguments)}}(),ct=function(){Pt({type:"shixunsDetail/setActionTabs",payload:{}})};return n.a.createElement(U.a,{centered:!0,title:"\u81EA\u5B9A\u4E49\u6A21\u677F",visible:Rn.actionTabs.key==="Settings-UseCustomScript",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",footer:null,onCancel:ct},n.a.createElement(y.a,{form:Ai,scrollToFirstError:!0,layout:"vertical",onFinish:Pi},n.a.createElement(y.a.Item,{name:"execute",label:"\u6267\u884C\u547D\u4EE4\uFF1A",rules:[{required:!0,message:"\u6267\u884C\u547D\u4EE4\u4E0D\u80FD\u4E3A\u7A7A"}]},n.a.createElement(J,{rows:4})),n.a.createElement(y.a.Item,{name:"compile",label:"\u7F16\u8BD1\u547D\u4EE4\uFF1A"},n.a.createElement(J,{rows:4})),n.a.createElement("div",{className:G.a.footerWrap},n.a.createElement(y.a.Item,null,n.a.createElement(Q.a,{className:"mr5",size:"large",onClick:ct},"\u53D6\u6D88"),n.a.createElement(Q.a,{size:"large",type:"primary",htmlType:"submit",loading:nn.effects["shixunsDetail/getCustomScript"]},"\u4FDD\u5B58")))))},fe=Object(c.a)(function(Gt){var Bt=Gt.shixunsDetail,Rn=Gt.loading,Wn=Gt.globalSetting;return{shixunsDetail:Bt,globalSetting:Wn,loading:Rn}})(oe),Ne=q("9ZNV"),_e=q("9Bee"),Fe=q("QXZ7"),We=q("N3QO"),Ue=q("1vsH"),xe=E.a.Option,ue=function(Bt){var Rn,Wn,nn,Pt,Mi,$i,ui,vn,Bi,Ai,Pi,ct,Zt,Ei,ji,ri,ii,X,v,O,B,te,z,be,tt,Ot,Ct=Bt.shixunsDetail,at=Bt.globalSetting,Yt=Bt.loading,Cn=Bt.user,Nn=Bt.dispatch,Hi=Object(F.a)(Bt,["shixunsDetail","globalSetting","loading","user","dispatch"]),Ri=Object(m.h)(),fi=Object(l.useRef)(),sr=y.a.useForm(),rr=Object(I.a)(sr,1),wi=rr[0],lr=Object(l.useState)({}),mr=Object(I.a)(lr,2),ai=mr[0],on=mr[1],ci=Object(l.useState)(),Qt=Object(I.a)(ci,2),di=Qt[0],Fn=Qt[1],bi=Object(l.useState)(),$=Object(I.a)(bi,2),pe=$[0],Oe=$[1],Re=Object(l.useState)([]),Ge=Object(I.a)(Re,2),Me=Ge[0],$e=Ge[1],Ye=Object(l.useState)({}),ut=Object(I.a)(Ye,2),Ze=ut[0],dt=ut[1],lt=Object(l.useState)([]),nt=Object(I.a)(lt,2),Et=nt[0],pt=nt[1],Lt=Object(l.useState)(!1),bt=Object(I.a)(Lt,2),Nt=bt[0],qt=bt[1],rn=(Rn=Cn.userInfo)===null||Rn===void 0||((Wn=Rn.shixun)===null||Wn===void 0)?void 0:Wn.editable;Object(l.useEffect)(function(){var ln,kt;fi.current=(ln=Ri.pathname)===null||ln===void 0||((kt=ln.split("/"))===null||kt===void 0)?void 0:kt[2]},[]),Object(l.useEffect)(function(){if(!Ct.setting)return;var ln=Ct.setting.shixun||{},kt=ln.name,Yn=ln.description,mn=ln.trainee,Sn=ln.choice_main_type,Un=ln.choice_small_type,Bn=ln.choice_standard_scripts,Li=ln.jupyter_show_description,kn={name:kt,description:Yn,trainee:mn,mainType:Sn,subType:Un,evaluationScript:Bn,jupyter_show_description:Li};ti(),on(kn),wi.setFieldsValue(kn)},[Ct.setting]);var ti=function(){var kt=Ct.setting.shixun||{},Yn=kt.choice_main_type,mn=kt.main_type,Sn=kt.small_type,Un=kt.choice_small_type,Bn=kt.is_secret_repository,Li=kt.standard_scripts,kn=kt.evaluate_script,Gn=kt.shixun_service_configs;Fn(Bn),Oe(kn),$e(Gn),pt(Li||[]),pn(Yn,Un)},pn=function(kt){var Yn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],mn=Ct.setting.shixun||{},Sn=mn.main_type,Un=mn.small_type,Bn=Sn==null?void 0:Sn.find(function(kn){return kn.id===kt}),Li={mainTypeName:Bn==null?void 0:Bn.type_name,mainTypeDescription:Bn==null?void 0:Bn.description,smallType:[]};Yn.map(function(kn){Un.map(function(Gn){kn===Gn.id&&!!Gn.description&&Li.smallType.push({name:Gn.type_name,des:Gn.description})})}),dt(Li)},bn=function(){Object(Ue.cb)(["\u5B9E\u8DF5\u9879\u76EE","\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE","\u7533\u8BF7\u65B0\u5EFA"]),Nn({type:"newShixuns/setActionTabs",payload:{key:"NewShixuns-Apply"}})},In=function(kt,Yn,mn){var Sn=Me.map(function(Un,Bn){return Bn===mn?Object(_.a)(Object(_.a)({},Un),{},Object(w.a)({},Yn,kt)):Un});$e(Sn)},At=function(kt,Yn){on(Object(_.a)({},Yn)),"mainType"in kt&&(wn(kt.mainType,Yn),pn(Yn.mainType,Yn.subType)),"subType"in kt&&(Jt(kt.subType,Yn),pn(Yn.mainType,Yn.subType)),"evaluationScript"in kt&&cn(kt.evaluationScript)},cn=function(kt){U.a.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:n.a.createElement("div",{className:"tc font16"},"\u539F\u6709\u811A\u672C\u5C06\u88AB\u65B0\u7684\u811A\u672C\u8986\u76D6\uFF0C\u65E0\u6CD5\u64A4\u9500",n.a.createElement("br",null),"\u662F\u5426\u786E\u8BA4\u6267\u884C\u8986\u76D6\u64CD\u4F5C"),onOk:function(){var Yn=Object(H.a)(d.a.mark(function Sn(){return d.a.wrap(function(Bn){for(;;)switch(Bn.prev=Bn.next){case 0:return Bn.next=2,En(kt);case 2:U.a.info({centered:!0,title:"\u63D0\u793A",okText:"\u77E5\u9053\u5566",content:n.a.createElement("div",{className:"tc font16"},"\u8BC4\u6D4B\u811A\u672C\u751F\u6210\u6210\u529F\uFF01")});case 3:case"end":return Bn.stop()}},Sn)}));function mn(){return Yn.apply(this,arguments)}return mn}()})},Jt=function(){var kt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Yn=arguments.length>1?arguments[1]:void 0,mn=[];mn.push(Me[0]),kt.map(function(Sn){var Un,Bn,Li,kn=Me.find(function(jn){return jn.mirror_repository_id===Sn});kn&&mn.push(kn);var Gn=(Un=Ct.setting)===null||Un===void 0||((Bn=Un.shixun)===null||Bn===void 0||((Li=Bn.small_type)===null||Li===void 0))?void 0:Li.find(function(jn){return jn.id===Sn});!kn&&Gn&&mn.push({mirror_repository_id:Sn,name:Gn.type_name,cpu_limit:1,lower_cpu_limit:.1,memory_limit:1024,request_limit:10})}),$e(mn)},wn=function(){var ln=Object(H.a)(d.a.mark(function kt(Yn,mn){var Sn,Un,Bn,Li,kn,Gn;return d.a.wrap(function(xi){for(;;)switch(xi.prev=xi.next){case 0:return Li=(Sn=Ct.setting)===null||Sn===void 0||((Un=Sn.shixun)===null||Un===void 0)?void 0:Un.main_type.find(function(er){return er.id===Yn}),Li&&(Me[0]={mirror_repository_id:Yn,name:Li.type_name,cpu_limit:1,lower_cpu_limit:.1,memory_limit:1024,request_limit:10},$e(Me)),xi.next=4,Nn({type:"shixunsDetail/getMirrorScript",payload:{mirror_id:Yn}});case 4:kn=xi.sent,pt(kn||[]),Gn=(Bn=kn[0])===null||Bn===void 0?void 0:Bn.id,wi.setFieldsValue({evaluationScript:Gn}),on(Object(_.a)(Object(_.a)({},mn),{evaluationScript:Gn})),En(Gn);case 10:case"end":return xi.stop()}},kt)}));return function(Yn,mn){return ln.apply(this,arguments)}}(),En=function(){var ln=Object(H.a)(d.a.mark(function kt(Yn){var mn;return d.a.wrap(function(Un){for(;;)switch(Un.prev=Un.next){case 0:return Un.next=2,Nn({type:"shixunsDetail/getScriptContent",payload:{id:fi.current,script_id:Yn||wi.getFieldValue("evaluationScript")}});case 2:mn=Un.sent,mn&&Oe(mn.content);case 4:case"end":return Un.stop()}},kt)}));return function(Yn){return ln.apply(this,arguments)}}(),Vn=function(){Nn({type:"shixunsDetail/setActionTabs",payload:{key:"Settings-UseCustomScript",params:{id:fi.current}}})},Kn=function(){var ln=Object(H.a)(d.a.mark(function kt(Yn){var mn,Sn,Un,Bn,Li,kn,Gn,jn,xi,er,Wi,fr,gr;return d.a.wrap(function(Dr){for(;;)switch(Dr.prev=Dr.next){case 0:return Sn=Yn||{},Un=Sn.mainType,Bn=Sn.subType,Li=Sn.name,kn=Sn.trainee,Gn=Sn.description,jn=Sn.evaluationScript,xi=Sn.jupyter_show_description,er=xi===void 0?!1:xi,Wi=(mn=Ct.detail)===null||mn===void 0?void 0:mn.is_jupyter,fr={id:fi.current,main_type:Un,sub_type:Bn,is_secret_repository:di,shixun:{name:Li,trainee:kn,is_jupyter:Wi,mirror_script_id:Wi?null:jn},shixun_info:{description:Gn,evaluate_script:Wi?null:pe},shixun_service_configs:Me.map(function(ur){return{mirror_repository_id:ur.mirror_repository_id,cpu_limit:ur.cpu_limit,lower_cpu_limit:ur.lower_cpu_limit,memory_limit:ur.memory_limit,request_limit:ur.request_limit,resource_limit:ur.resource_limit}})},Wi&&(fr=Object(_.a)(Object(_.a)({},fr),{},{shixun:Object(_.a)(Object(_.a)({},fr.shixun),{},{jupyter_show_description:er})})),Dr.next=6,Nn({type:"shixunsDetail/updateSettingBasicInfo",payload:fr});case 6:gr=Dr.sent,gr&&(Nn({type:"shixunsDetail/getSettingsData",payload:{id:fi.current}}),Nn({type:"shixunsDetail/getShixunsDetail",payload:{id:fi.current}}),gr.shixun_identifier&&Y.b.info("\u4FDD\u5B58\u6210\u529F"));case 8:case"end":return Dr.stop()}},kt)}));return function(Yn){return ln.apply(this,arguments)}}(),Di=function(){Object(Ue.cb)(["\u5B9E\u8DF5\u9879\u76EE","\u65B0\u5EFA\u5B9E\u8DF5\u9879\u76EE","\u5728\u7EBF\u521B\u5EFA"]),Nn({type:"newShixuns/setActionTabs",payload:{key:"Create-Environment"}})};return n.a.createElement("section",{className:W.a.wrap},n.a.createElement(y.a,{form:wi,className:W.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:At,onFinish:Kn},n.a.createElement("div",{className:W.a.fieldWrap},n.a.createElement(y.a.Item,{name:"name",label:"\u540D\u79F0:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u540D\u79F0"},{max:60,message:"\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26"},{whitespace:!0,message:"\u8BF7\u52FF\u8F93\u5165\u7A7A\u683C"}]},n.a.createElement(A.a,{placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26",disabled:!rn,addonAfter:"".concat(((nn=ai.name)===null||nn===void 0?void 0:nn.length)||0,"/60")})),n.a.createElement(y.a.Item,{name:"description",label:"\u7B80\u4ECB:"},rn?n.a.createElement(j.a,{defaultValue:(Pt=Ct.setting)===null||Pt===void 0||((Mi=Pt.shixun)===null||Mi===void 0)?void 0:Mi.description}):n.a.createElement(_e.a,{value:($i=Ct.setting)===null||$i===void 0||((ui=$i.shixun)===null||ui===void 0)?void 0:ui.description})),((vn=Ct.setting)===null||vn===void 0?void 0:vn.shixun.is_jupyter)&&n.a.createElement(y.a.Item,{name:"jupyter_show_description",valuePropName:"checked"},n.a.createElement(C.a,null,"\u663E\u793A\u4EFB\u52A1\u8981\u6C42\uFF08\u52FE\u9009\u540E\uFF0C\u5C06\u7B80\u4ECB\u4F5C\u4E3A\u4EFB\u52A1\u8981\u6C42\u663E\u793A\u5728\u5B9E\u8DF5\u9879\u76EE\u6311\u6218\u9875\u9762\uFF09")),n.a.createElement("div",{className:"".concat(W.a.flexRow," ").concat(W.a.flexAlignCenter)},n.a.createElement(y.a.Item,{className:W.a.width180,name:"trainee",label:"\u96BE\u6613\u5EA6:",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u6613\u5EA6"}]},n.a.createElement(E.a,{placeholder:"\u8BF7\u9009\u62E9\u96BE\u6613\u5EA6",disabled:((Bi=Ct.setting)===null||Bi===void 0||((Ai=Bi.shixun)===null||Ai===void 0)?void 0:Ai.status)===2?!0:!rn},n.a.createElement(xe,{value:1},"\u521D\u7EA7"),n.a.createElement(xe,{value:2},"\u4E2D\u7EA7"),n.a.createElement(xe,{value:3},"\u4E2D\u9AD8\u7EA7"),n.a.createElement(xe,{value:4},"\u9AD8\u7EA7")))),n.a.createElement("div",{className:"".concat(W.a.flexRow," ").concat(W.a.flexAlignEnd)},n.a.createElement(y.a.Item,{className:W.a.width180,name:"mainType",label:"\u5B9E\u9A8C\u73AF\u5883:",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u4E3B\u7C7B\u522B"}]},n.a.createElement(E.a,{placeholder:"\u8BF7\u9009\u62E9\u4E3B\u7C7B\u522B",disabled:((Pi=Ct.setting)===null||Pi===void 0||((ct=Pi.shixun)===null||ct===void 0)?void 0:ct.status)===2?!0:!rn},(Zt=Ct.setting)===null||Zt===void 0||((Ei=Zt.shixun)===null||Ei===void 0||((ji=Ei.main_type)===null||ji===void 0))?void 0:ji.map(function(ln){var kt=ln.type_name.toLowerCase().includes("jupyter");return ai.isJupyter==="1"&&kt||ai.isJupyter==="2"&&!kt?null:n.a.createElement(xe,{value:ln.id,key:ln.id,name:ln.description},ln.type_name)}))),n.a.createElement(y.a.Item,{name:"subType",className:"".concat(W.a.width280," ml20")},n.a.createElement(E.a,{placeholder:"\u8BF7\u9009\u62E9\u5C0F\u7C7B\u522B",mode:"multiple",disabled:((ri=Ct.setting)===null||ri===void 0||((ii=ri.shixun)===null||ii===void 0)?void 0:ii.status)===2?!0:!rn},(X=Ct.setting)===null||X===void 0||((v=X.shixun)===null||v===void 0)?void 0:v.small_type.map(function(ln){return n.a.createElement(xe,{value:ln.id,key:ln.id,name:ln.description},ln.type_name)}))),n.a.createElement("div",{className:W.a.installPackage,onClick:function(){return qt(!0)}},"\u73AF\u5883\u4ECB\u7ECD")),n.a.createElement("div",{className:"".concat(W.a.color888," font14 pb10")},"\u6CA1\u6709\u5B9E\u9A8C\u73AF\u5883\uFF1F",n.a.createElement("a",{className:"".concat(W.a.color0152d9," current"),onClick:bn}," ","\u7533\u8BF7\u65B0\u5EFA"),n.a.createElement("a",{className:"".concat(W.a.color0152d9," current"),onClick:Di}," ","\u5728\u7EBF\u521B\u5EFA")),!((O=Ct.detail)!==null&&O!==void 0&&O.is_jupyter)&&n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"".concat(W.a.flexRow," ").concat(W.a.flexAlignCenter)},n.a.createElement(y.a.Item,{className:W.a.width180,name:"evaluationScript",label:"\u8BC4\u6D4B\u811A\u672C:"},n.a.createElement(E.a,{placeholder:"\u8BF7\u9009\u62E9\u8BC4\u6D4B\u811A\u672C"},(Et||[]).map(function(ln,kt){return n.a.createElement(xe,{value:parseInt(ln.id),name:ln.scptname,key:kt},ln.scptname)}))),n.a.createElement("span",{className:"".concat(W.a.color0152d9," font14 current mt10 ml10"),onClick:Vn},"\u4F7F\u7528\u81EA\u5B9A\u4E49\u811A\u672C"),n.a.createElement(f.a,{overlayClassName:W.a.popover,placement:"bottomLeft",content:n.a.createElement("p",{className:"font12"},"\u4F7F\u7528\u81EA\u5B9A\u4E49\u6A21\u677F\uFF0C\u5E73\u53F0\u65E0\u6CD5\u81EA\u52A8\u66F4\u65B0\u811A\u672C\uFF0C\u8BF7\u5728\u5173\u5361\u521B\u5EFA\u5B8C\u540E\u624B\u52A8\u66F4\u65B0\u811A\u672C\u4E2D\u7684\u5FC5\u586B\u53C2",n.a.createElement("br",null),"\u6570\u548C\u4EE5\u4E0B2\u4E2A\u6570\u7EC4\u5143\u7D20\uFF1A",n.a.createElement("br",null),"challengeProgramNames",n.a.createElement("br",null),"sourceClassNames",n.a.createElement("br",null),n.a.createElement("br",null),"\u793A\u4F8B\uFF1A\u67092\u4E2A\u5173\u5361\u7684\u5B9E\u8BAD",n.a.createElement("br",null),n.a.createElement("br",null),"\u5404\u5173\u5361\u7684\u5F85\u7F16\u8BD1\u6587\u4EF6\u4E3A\uFF1A",n.a.createElement("br",null),"src/step1/HelloWorld.java",n.a.createElement("br",null),"src/step2/Other.java",n.a.createElement("br",null),n.a.createElement("br",null),"\u5404\u5173\u5361\u7684\u7F16\u8BD1\u540E\u751F\u6210\u7684\u6267\u884C\u6587\u4EF6\u4E3A\uFF1A",n.a.createElement("br",null),"step1.HelloWorld",n.a.createElement("br",null),"step2.Other",n.a.createElement("br",null),n.a.createElement("br",null),"\u5219\u6570\u7EC4\u5143\u7D20\u66F4\u65B0\u5982\u4E0B\uFF1A",n.a.createElement("br",null),'ff challengeProgramNames=("src/step1/',n.a.createElement("br",null),'HelloWorld.java" "src/step2/Other.java")',n.a.createElement("br",null),'sourceClassNames=("step1.HelloWorld',n.a.createElement("br",null),'" "step2.Other")',n.a.createElement("br",null),n.a.createElement("br",null),"\u5176\u5B83\u53C2\u6570\u53EF\u6309\u5B9E\u9645\u9700\u6C42\u5B9A\u5236"),trigger:"click"},n.a.createElement("span",{className:"mt10 ml10 current font14"},n.a.createElement(N.a,null)))),n.a.createElement(T.b,{width:1150,height:450,style:{border:"1px solid #ccc",background:"#f5f5f5"},language:"shell",theme:"vs-light",value:pe,options:{readOnly:((B=Ct.setting)===null||B===void 0||((te=B.shixun)===null||te===void 0)?void 0:te.status)===2?!0:!rn},onChange:function(kt){return Oe(kt)}})),!((z=Ct.detail)!==null&&z!==void 0&&z.is_jupyter)&&n.a.createElement("div",{className:"font14 mt20"},"\u79C1\u5BC6\u7248\u672C\u5E93\uFF1A",n.a.createElement(C.a,{checked:di,onChange:function(kt){return Fn(kt.target.checked)},disabled:((be=Ct.setting)===null||be===void 0||((tt=be.shixun)===null||tt===void 0)?void 0:tt.status)===2?!0:!rn},di?"\u5DF2\u521B\u5EFA\u7684\u79C1\u5BC6\u7248\u672C\u5E93\u53CA\u5176\u5185\u5BB9\uFF0C\u5C06\u5728\u201C\u4FDD\u5B58\u201D\u65F6\u88AB\u5220\u9664":"\uFF08\u82E5\u9700\u8981\u5BF9\u5B66\u5458\u9690\u85CF\u90E8\u5206\u7248\u672C\u5E93\u5185\u5BB9\u65F6\uFF0C\u8BF7\u9009\u4E2D\uFF1B\u9009\u4E2D\u4FDD\u5B58\u540E\u8868\u793A\u542F\u7528\u79C1\u5BC6\u7248\u672C\u5E93\uFF0C\u8BF7\u5C06\u9700\u8981\u5BF9\u5B66\u5458\u9690\u85CF\u7684\u6587\u4EF6\u5B58\u50A8\u5728\u79C1\u5BC6\u7248\u672C\u5E93\uFF09")),((Ot=Ct.detail)===null||Ot===void 0?void 0:Ot.identity)<3&&rn&&n.a.createElement("div",{className:W.a.serviceSettingWrap},n.a.createElement("p",{className:W.a.serviceSettingName},"\u670D\u52A1\u914D\u7F6E"),Me.map(function(ln,kt){var Yn,mn,Sn,Un,Bn,Li,kn,Gn;return n.a.createElement("div",{key:kt},n.a.createElement("div",null,n.a.createElement("span",{className:"font16"},ln.name)),n.a.createElement("div",{className:"mb5"},n.a.createElement("label",{className:W.a.serviceSetLeft},"CPU(\u6838)\uFF1A"),n.a.createElement(A.a,{className:W.a.serviceSetInput,value:ln.cpu_limit,disabled:((Yn=Ct.setting)===null||Yn===void 0||((mn=Yn.shixun)===null||mn===void 0)?void 0:mn.status)===2?!0:!rn,onChange:function(xi){return In(xi.target.value,"cpu_limit",kt)}})),n.a.createElement("div",{className:"mb5"},n.a.createElement("label",{className:W.a.serviceSetLeft},"\u6700\u4F4ECPU(\u6838)\uFF1A"),n.a.createElement(A.a,{className:W.a.serviceSetInput,value:ln.lower_cpu_limit,disabled:((Sn=Ct.setting)===null||Sn===void 0||((Un=Sn.shixun)===null||Un===void 0)?void 0:Un.status)===2?!0:!rn,onChange:function(xi){return In(xi.target.value,"lower_cpu_limit",kt)}})),n.a.createElement("div",{className:"mb5"},n.a.createElement("label",{className:W.a.serviceSetLeft},"\u5185\u5B58\u9650\u5236(M)\uFF1A"),n.a.createElement(A.a,{className:W.a.serviceSetInput,value:ln.memory_limit,disabled:((Bn=Ct.setting)===null||Bn===void 0||((Li=Bn.shixun)===null||Li===void 0)?void 0:Li.status)===2?!0:!rn,onChange:function(xi){return In(xi.target.value,"memory_limit",kt)}})),n.a.createElement("div",{className:"mb5"},n.a.createElement("label",{className:W.a.serviceSetLeft},"\u5185\u5B58\u8981\u6C42(M)\uFF1A"),n.a.createElement(A.a,{className:W.a.serviceSetMemoryInput,value:ln.request_limit,disabled:((kn=Ct.setting)===null||kn===void 0||((Gn=kn.shixun)===null||Gn===void 0)?void 0:Gn.status)===2?!0:!rn,onChange:function(xi){return In(xi.target.value,"request_limit",kt)}}),n.a.createElement("label",{className:"".concat(W.a.serviceSetTip," ml5")},"\u6E29\u99A8\u63D0\u793A\uFF1A\u7EAF\u7F16\u7A0B\u7C7B\u578B\u5B9E\u8BAD\u5EFA\u8BAE\u4F7F\u7528\u9ED8\u8BA4\u503C\uFF0C\u5BF9\u4E8E\u5927\u6570\u636E\u7B49\u5EFA\u8BAE\u4F7F\u7528\u6700\u5927\u5185\u5B58\u768430%")),n.a.createElement("div",{className:W.a.serviceBox},n.a.createElement("label",{className:W.a.serviceSetLeft},"\u78C1\u76D8\u9650\u5236(K)\uFF1A"),n.a.createElement(A.a,{className:W.a.serviceSetInput,value:ln.resource_limit,style:{width:300},maxLength:8,onChange:function(xi){var er=xi.target.value,Wi=/^\d*(\.\d*)?$/;er.match(Wi)&&In(xi.target.value,"resource_limit",kt)}})))}))),n.a.createElement(y.a.Item,null,n.a.createElement(Ne.a,{okText:"\u4FDD\u5B58",hasOkBtn:rn,loading:Yt.effects["shixunsDetail/updateSettingBasicInfo"],onCancel:function(){return c.d.push("/shixuns/".concat(fi.current,"/challenges"))},okButtonProps:{htmlType:"submit"}}))),n.a.createElement(k.a,null),n.a.createElement(Fe.a,{installPackage:Ze,visible:Nt,setVisible:qt}),n.a.createElement(fe,{onFinish:function(kt){return Oe(kt)}}),n.a.createElement(We.a,null))},ae=Object(c.a)(function(Gt){var Bt=Gt.shixunsDetail,Rn=Gt.loading,Wn=Gt.globalSetting,nn=Gt.user;return{shixunsDetail:Bt,globalSetting:Wn,user:nn,loading:Rn}})(ue),Ee=q("iQDF"),de=q("+eQT"),Ke=q("Awhp"),Je=q("KrTs"),je=q("O3gP"),Qe=q("lrIw"),ot=q("7Kak"),st=q("9yH6"),ht=q("oBTY"),mt=q("Z0Lh"),ft=q.n(mt),Ht=q("wd/R"),Vt=q.n(Ht),zt=q("EZOa"),Tt=q.n(zt),hn=function(Bt){if(!Bt)return Bt;var Rn=Bt.split(":");if(Rn[1]=="00"||Rn[1]=="30")return Bt;var Wn=parseInt(Rn[1]);if(Wn<30||Wn==60)return[Rn[0],"30"].join(":");if(Wn<60){var nn=[Rn[0],"00"].join(":"),Pt="YYYY-MM-DD HH:mm",Mi=Vt()(nn,Pt);return Mi.add(1,"hours"),Mi.format(Pt)}return Bt},Xt="YYYY-MM-DD HH:mm",Wt=function(Bt){var Rn,Wn,nn,Pt,Mi,$i,ui,vn=Bt.shixunsDetail,Bi=Bt.globalSetting,Ai=Bt.loading,Pi=Bt.user,ct=Bt.dispatch,Zt=Object(F.a)(Bt,["shixunsDetail","globalSetting","loading","user","dispatch"]),Ei=Object(l.useRef)(),ji=Object(l.useState)(),ri=Object(I.a)(ji,2),ii=ri[0],X=ri[1],v=Object(l.useState)(),O=Object(I.a)(v,2),B=O[0],te=O[1],z=Object(l.useState)([]),be=Object(I.a)(z,2),tt=be[0],Ot=be[1],Ct=Object(l.useState)([]),at=Object(I.a)(Ct,2),Yt=at[0],Cn=at[1],Nn=Object(l.useState)(""),Hi=Object(I.a)(Nn,2),Ri=Hi[0],fi=Hi[1],sr=Object(l.useState)(),rr=Object(I.a)(sr,2),wi=rr[0],lr=rr[1],mr=Object(l.useState)(),ai=Object(I.a)(mr,2),on=ai[0],ci=ai[1],Qt=(Rn=Pi.userInfo)===null||Rn===void 0||((Wn=Rn.shixun)===null||Wn===void 0)?void 0:Wn.editable;Object(l.useEffect)(function(){var $,pe;Ei.current=($=location.pathname)===null||$===void 0||((pe=$.split("/"))===null||pe===void 0)?void 0:pe[2],di()},[]),Object(l.useEffect)(function(){var $,pe,Oe,Re,Ge,Me,$e,Ye,ut,Ze;if(!vn.setting)return;X(($=vn.setting)===null||$===void 0||((pe=$.shixun)===null||pe===void 0)?void 0:pe.can_copy),te((Oe=vn.setting)===null||Oe===void 0||((Re=Oe.shixun)===null||Re===void 0)?void 0:Re.use_scope),lr(!!((Ge=vn.setting)!==null&&Ge!==void 0&&(Me=Ge.shixun)!==null&&Me!==void 0&&Me.opening_time)),ci(($e=vn.setting)===null||$e===void 0||((Ye=$e.shixun)===null||Ye===void 0)?void 0:Ye.opening_time),Ot((ut=vn.setting)===null||ut===void 0||((Ze=ut.shixun)===null||Ze===void 0)?void 0:Ze.scope_partment)},[vn.setting]);var di=function(){var $=Object(H.a)(d.a.mark(function pe(Oe){var Re;return d.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:return Me.next=2,ct({type:"shixunsDetail/getDepartments",payload:{q:Oe}});case 2:Re=Me.sent,Re&&Cn(Re.shools_name||[]);case 4:case"end":return Me.stop()}},pe)}));return function(Oe){return $.apply(this,arguments)}}(),Fn=function(pe){if(tt.includes(pe)){Y.b.info("\u8BF7\u52FF\u6307\u5B9A\u76F8\u540C\u7684\u5355\u4F4D");return}fi(null),Ot([].concat(Object(ht.a)(tt),[pe]))},bi=function(){var $=Object(H.a)(d.a.mark(function pe(){var Oe;return d.a.wrap(function(Ge){for(;;)switch(Ge.prev=Ge.next){case 0:if(!(wi&&!on)){Ge.next=3;break}return Y.b.info("\u8BF7\u9009\u62E9\u5F00\u542F\u65F6\u95F4"),Ge.abrupt("return");case 3:if(!(B===1&&!tt.length)){Ge.next=6;break}return Y.b.info("\u8BF7\u9009\u62E9\u6307\u5B9A\u5355\u4F4D\u516C\u5F00"),Ge.abrupt("return");case 6:return Ge.next=8,ct({type:"shixunsDetail/updatePermissionSetting",payload:{id:Ei.current,scope_partment:B===0?null:tt,shixun:{can_copy:ii,use_scope:B,opening_time:on}}});case 8:Oe=Ge.sent,Oe.status!==-1&&(Y.b.info("\u6743\u9650\u914D\u7F6E\u4FDD\u5B58\u6210\u529F\uFF01"),ct({type:"shixunsDetail/getSettingsData",payload:{id:Ei.current}}),ct({type:"shixunsDetail/getShixunsDetail",payload:{id:Ei.current}}));case 10:case"end":return Ge.stop()}},pe)}));return function(){return $.apply(this,arguments)}}();return n.a.createElement("section",{className:Tt.a.wrap},n.a.createElement("div",{className:Tt.a.labelWrap},n.a.createElement("label",{className:Tt.a.label},"\u590D\u5236:"),n.a.createElement("div",{className:Tt.a.labelContent},n.a.createElement("div",null,n.a.createElement(C.a,{checked:ii,onChange:function(pe){return X(pe.target.checked)},disabled:!Qt}),n.a.createElement("span",{className:"".concat(Tt.a.color999)},"\uFF08\u9009\u4E2D\u5219\u5141\u8BB8\u5DF2\u804C\u4E1A\u8BA4\u8BC1\u7684\u6559\u5E08\u590D\u5236\u8BE5\u5B9E\u8BAD\uFF09")))),!((((nn=vn.detail)===null||nn===void 0?void 0:nn.shixun_status)>1||((Pt=vn.detail)===null||Pt===void 0?void 0:Pt.public)===2)&&((Mi=vn.setting)===null||Mi===void 0||(($i=Mi.shixun)===null||$i===void 0)?void 0:$i.use_scope)===0&&((ui=vn.detail)===null||ui===void 0?void 0:ui.identity)>2)&&n.a.createElement("div",{className:Tt.a.labelWrap},n.a.createElement("label",{className:Tt.a.label},"\u516C\u5F00\u7A0B\u5EA6:"),n.a.createElement("div",{className:Tt.a.labelContent},n.a.createElement(st.a.Group,{value:B,onChange:function(pe){return te(pe.target.value)},disabled:!Qt},n.a.createElement(st.a,{className:Tt.a.radio,value:0},n.a.createElement("span",null,"\u5BF9\u6240\u6709\u5355\u4F4D\u516C\u5F00"),n.a.createElement("span",{className:Tt.a.color999},"\uFF08\u5B9E\u8BAD\u53D1\u5E03\u540E\uFF0C\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09")),n.a.createElement(st.a,{className:Tt.a.radio,value:1},n.a.createElement("span",null,"\u5BF9\u6307\u5B9A\u5355\u4F4D\u516C\u5F00"),n.a.createElement("span",{className:Tt.a.color999},"\uFF08\u5B9E\u8BAD\u53D1\u5E03\u540E\uFF0C\u4EC5\u5BF9\u4E0B\u65B9\u6307\u5B9A\u5355\u4F4D\u7684\u7528\u6237\u53EF\u89C1\uFF09"))),B===1&&n.a.createElement(n.a.Fragment,null,n.a.createElement("div",{className:"mt10"},n.a.createElement(Qe.a,{showSearch:!0,className:Tt.a.selectSchool,placeholder:"\u8BF7\u8F93\u5165\u5E76\u9009\u62E9\u5355\u4F4D\u540D\u79F0",value:Ri,onChange:function(pe){fi(pe),di(pe)},disabled:!Qt,onSelect:Fn,options:Yt==null?void 0:Yt.map(function($){return{value:$}})}),n.a.createElement("span",{className:Tt.a.color999},"\uFF08\u5B9E\u8BAD\u53D1\u5E03\u540E\uFF0C\u4EC5\u5BF9\u4E0B\u65B9\u6307\u5B9A\u5355\u4F4D\u7684\u7528\u6237\u53EF\u89C1\uFF09")),n.a.createElement("div",{className:"mt10"},tt==null?void 0:tt.map(function($){return Qt?n.a.createElement(Je.a,{count:"x",className:"mr20 current",onClick:function(){return Ot(tt.filter(function(Oe){return Oe!==$}))}},n.a.createElement(Q.a,{type:"primary",ghost:!0},$)):n.a.createElement(Q.a,{type:"primary",ghost:!0,className:"mr20"},$)}))))),n.a.createElement("div",{className:Tt.a.labelWrap},n.a.createElement("label",{className:Tt.a.label},"\u5F00\u542F\u65F6\u95F4:"),n.a.createElement("div",{className:Tt.a.labelContent},n.a.createElement("div",null,n.a.createElement(C.a,{checked:wi,onChange:function(pe){return lr(pe.target.checked)},disabled:!Qt}),n.a.createElement("span",{className:"".concat(Tt.a.color999," ml10")},"\uFF08\u9009\u4E2D\u5219\u5B66\u5458\u5728\u6307\u5B9A\u7684\u5F00\u542F\u65F6\u95F4\u540E\uFF0C\u624D\u80FD\u5F00\u542F\u5B66\u4E60\uFF1B\u4E0D\u9009\u4E2D\u5219\u5B66\u5458\u5728\u5B9E\u8BAD\u53D1\u5E03\u540E\uFF0C\u80FD\u7ACB\u5373\u5F00\u542F\u5B66\u4E60\uFF09")),wi&&n.a.createElement(de.a,{className:"".concat(Tt.a.dataPicker," mt10"),format:Xt,locale:ft.a,disabled:!Qt,placeholder:"\u8BF7\u8F93\u5165\u5F00\u542F\u65F6\u95F4",showToday:!1,disabledDate:function(pe){return pe&&pe<Vt()().endOf("day").subtract(1,"days")},showTime:{minuteStep:30},value:on&&Vt()(on,Xt),onChange:function(pe,Oe){return ci(hn(Oe))}}))),n.a.createElement(Ne.a,{okText:"\u4FDD\u5B58",hasOkBtn:Qt,loading:Ai.effects["shixunsDetail/updatePermissionSetting"],onCancel:function(){return c.d.push("/shixuns/".concat(Ei.current,"/challenges"))},onOk:bi}))},it=Object(c.a)(function(Gt){var Bt=Gt.shixunsDetail,Rn=Gt.loading,Wn=Gt.globalSetting,nn=Gt.user;return{shixunsDetail:Bt,globalSetting:Wn,user:nn,loading:Rn}})(Wt),un=q("5Dmo"),Kt=q("3S7+"),qe=q("DYRE"),wt=q("zeV3"),Be=q("giR+"),Ae=q("fyUT"),Ie=q("fu2T"),se=q("gK9i"),ce=q("KiOF"),ye=q.n(ce),Se=q("ErOA"),ke=se.a.Panel,et=A.a.TextArea,yt=function(Bt){var Rn,Wn,nn=Bt.shixunsDetail,Pt=Bt.globalSetting,Mi=Bt.loading,$i=Bt.user,ui=Bt.dispatch,vn=Bt.active,Bi=Object(F.a)(Bt,["shixunsDetail","globalSetting","loading","user","dispatch","active"]),Ai=Object(l.useRef)(),Pi=y.a.useForm(),ct=Object(I.a)(Pi,1),Zt=ct[0],Ei=Object(l.useState)({}),ji=Object(I.a)(Ei,2),ri=ji[0],ii=ji[1],X=Object(l.useState)(!1),v=Object(I.a)(X,2),O=v[0],B=v[1],te=Object(l.useState)([]),z=Object(I.a)(te,2),be=z[0],tt=z[1],Ot=Object(l.useState)([]),Ct=Object(I.a)(Ot,2),at=Ct[0],Yt=Ct[1],Cn=(Rn=$i.userInfo)===null||Rn===void 0||((Wn=Rn.shixun)===null||Wn===void 0)?void 0:Wn.editable;Object(l.useEffect)(function(){var ai,on;Ai.current=(ai=location.pathname)===null||ai===void 0||((on=ai.split("/"))===null||on===void 0)?void 0:on[2]},[]),Object(l.useEffect)(function(){vn==="testCase"&&Nn()},[vn]);var Nn=function(){var ai=Object(H.a)(d.a.mark(function on(){var ci,Qt,di,Fn,bi,$,pe,Oe,Re,Ge,Me,$e,Ye,ut,Ze;return d.a.wrap(function(lt){for(;;)switch(lt.prev=lt.next){case 0:return ci=[{hidden:0,input:"",output:"",score:100}],lt.next=3,Object(Se.a)("/api/shixuns/".concat(Ai.current,"/jupyter_evalute_setting.json"),{method:"get"});case 3:Qt=lt.sent,(Qt==null?void 0:Qt.status)===0&&(Yt(Qt==null||((di=Qt.data)===null||di===void 0)?void 0:di.standard_scripts),Ze={open_evaluate:Qt==null||((Fn=Qt.data)===null||Fn===void 0)?void 0:Fn.open_evaluate,exec_time:(Qt==null||((bi=Qt.data)===null||bi===void 0)?void 0:bi.exec_time)||3,test_set_score:(Qt==null||(($=Qt.data)===null||$===void 0)?void 0:$.test_set_score)===null?!1:Qt==null||((pe=Qt.data)===null||pe===void 0)?void 0:pe.test_set_score,test_set_average:(Qt==null||((Oe=Qt.data)===null||Oe===void 0)?void 0:Oe.test_set_average)===null?!0:Qt==null||((Re=Qt.data)===null||Re===void 0)?void 0:Re.test_set_average,choice_standard_scripts:(Qt==null||((Ge=Qt.data)===null||Ge===void 0)?void 0:Ge.choice_standard_scripts)||null,evaluate_script:(Qt==null||((Me=Qt.data)===null||Me===void 0)?void 0:Me.evaluate_script)||""},Zt.setFieldsValue(Ze),ii(Ze),tt(Qt!=null&&($e=Qt.data)!==null&&$e!==void 0&&(Ye=$e.test_sets)!==null&&Ye!==void 0&&Ye.length?Qt==null||((ut=Qt.data)===null||ut===void 0)?void 0:ut.test_sets:ci));case 5:case"end":return lt.stop()}},on)}));return function(){return ai.apply(this,arguments)}}(),Hi=function(){var ai=Object(H.a)(d.a.mark(function on(ci){var Qt,di,Fn;return d.a.wrap(function($){for(;;)switch($.prev=$.next){case 0:if(Qt=be.map(function(pe){return pe.score}),di=Qt.reduce(function(pe,Oe){return pe+Oe},0),!(ci.test_set_score&&di!==100&&be!==null&&be!==void 0&&be.length)){$.next=5;break}return Y.b.warn("\u6D4B\u8BD5\u7528\u4F8B\u7684\u8BC4\u5206\u5360\u6BD4\u4E4B\u548C\u5FC5\u987B\u7B49\u4E8E100"),$.abrupt("return");case 5:return B(!0),$.next=8,Object(Se.a)("/api/shixuns/".concat(Ai.current,"/update_jupyter_evaluate_setting.json"),{method:"post",body:Object(_.a)(Object(_.a)({},ci),{},{mirror_script_id:ci==null?void 0:ci.choice_standard_scripts,open_evaluate:ci!=null&&ci.open_evaluate?1:0,test_set:be.map(function(pe){return Object(_.a)(Object(_.a)({},pe),{},{is_file:!1})})})});case 8:Fn=$.sent,Fn.status===0&&Y.b.success("\u4FDD\u5B58\u6210\u529F"),B(!1);case 11:case"end":return $.stop()}},on)}));return function(ci){return ai.apply(this,arguments)}}(),Ri=function(on){ii(Object(_.a)({},Zt.getFieldsValue())),"test_set_average"in on&&on!==null&&on!==void 0&&on.test_set_average&&fi(be),"test_set_score"in on&&on!==null&&on!==void 0&&on.test_set_score&&(Zt.setFieldsValue({test_set_average:!0}),ii(Object(_.a)(Object(_.a)({},Zt.getFieldsValue()),{},{test_set_average:!0})),fi(be)),"choice_standard_scripts"in on&&U.a.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:n.a.createElement("div",{className:"tc font16"},"\u539F\u6709\u811A\u672C\u5C06\u88AB\u65B0\u7684\u811A\u672C\u8986\u76D6\uFF0C\u65E0\u6CD5\u64A4\u9500",n.a.createElement("br",null),"\u662F\u5426\u786E\u8BA4\u6267\u884C\u8986\u76D6\u64CD\u4F5C"),onOk:function(){var ci=Object(H.a)(d.a.mark(function di(){var Fn;return d.a.wrap(function($){for(;;)switch($.prev=$.next){case 0:return $.next=2,Object(Se.a)("/api/shixuns/".concat(Ai.current,"/get_script_contents.json"),{method:"get",params:{id:Ai.current,script_id:on==null?void 0:on.choice_standard_scripts}});case 2:Fn=$.sent,Fn!=null&&Fn.content&&(U.a.info({centered:!0,title:"\u63D0\u793A",okText:"\u77E5\u9053\u5566",content:n.a.createElement("div",{className:"tc font16"},"\u8BC4\u6D4B\u811A\u672C\u751F\u6210\u6210\u529F\uFF01")}),Zt.setFieldsValue({evaluate_script:Fn==null?void 0:Fn.content}),ii(Object(_.a)(Object(_.a)({},Zt.getFieldsValue()),{},{evaluate_script:Fn==null?void 0:Fn.content})));case 4:case"end":return $.stop()}},di)}));function Qt(){return ci.apply(this,arguments)}return Qt}()})},fi=function(on){var ci=0,Qt=Math.floor((100-ci)/on.length),di=Qt+(100-ci)%on.length;on=on.map(function(Fn,bi){return bi===on.length-1?Object(_.a)(Object(_.a)({},Fn),{},{score:di}):Object(_.a)(Object(_.a)({},Fn),{},{score:Qt})}),tt(on)},sr=function(){var on=[].concat(Object(ht.a)(be),[{hidden:0,input:"",output:"",score:0}]);Zt.getFieldValue("test_set_average")?fi(on):tt(on)},rr=ri.test_set_score,wi=ri.test_set_average,lr=ri.choice_standard_scripts,mr=ri.open_evaluate;return n.a.createElement("section",{className:ye.a.wrap},n.a.createElement(y.a,{form:Zt,layout:"vertical",onValuesChange:Ri,onFinish:Hi},n.a.createElement(y.a.Item,{name:"open_evaluate",style:{marginTop:10},valuePropName:"checked"},n.a.createElement(C.a,null,"\u542F\u7528Jupyter\u8BC4\u6D4B\u529F\u80FD")),mr&&n.a.createElement(n.a.Fragment,null,n.a.createElement("h4",{className:"font14"},"\u8BC4\u6D4B\u65F6\u957F\u9650\u5236"),n.a.createElement(y.a.Item,{label:"\u8BC4\u6D4B\u65F6\u957F\uFF08\u79D2\uFF09\uFF1A",name:"exec_time",style:{flexDirection:"row",marginTop:15},rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u8BC4\u6D4B\u65F6\u957F\u9650\u5236"},{type:"number",min:3,message:"\u6700\u5C0F\u9650\u5236\u65F6\u95F4\u662F3\u79D2"}]},n.a.createElement(Ae.a,{className:ye.a.in,min:3})),n.a.createElement("h4",{className:"font14 mb10"},"\u7CFB\u7EDF\u8BC4\u5206\u89C4\u5219"),n.a.createElement(y.a.Item,{name:"test_set_score"},n.a.createElement(st.a.Group,null,n.a.createElement(wt.a,{direction:"vertical"},n.a.createElement(st.a,{value:!1},"\u901A\u8FC7\u5168\u90E8\u6D4B\u8BD5\u96C6",n.a.createElement("span",{className:"c-grey-999"}," \uFF08\u5B66\u5458\u8BC4\u6D4B\uFF0C\u4EC5\u5F53\u6240\u6709\u6D4B\u8BD5\u96C6\u90FD\u6B63\u786E\u65F6\uFF0C\u624D\u83B7\u5F97\u4E00\u6B21\u6027\u5956\u52B1\uFF09")),n.a.createElement(st.a,{value:!0},"\u901A\u8FC7\u90E8\u5206\u6D4B\u8BD5\u96C6",n.a.createElement("span",{className:"c-grey-999"}," \uFF08\u5B66\u5458\u8BC4\u6D4B\uFF0C\u901A\u8FC7\u6D4B\u8BD5\u96C6\u5373\u53EF\u83B7\u5F97\u5BF9\u5E94\u5956\u52B1\uFF09"))))),n.a.createElement("h4",{className:"flex-container font14 mb10"},n.a.createElement("span",{className:"mr30"},"\u6D4B\u8BD5\u7528\u4F8B"),n.a.createElement(Q.a,{style:{height:28,borderRadius:4},type:"primary",onClick:sr,ghost:!0},"\u6DFB\u52A0\u6D4B\u8BD5\u7528\u4F8B")),rr&&n.a.createElement(y.a.Item,{name:"test_set_average"},n.a.createElement(st.a.Group,null,n.a.createElement(st.a,{value:!0},"\u5747\u5206\u6BD4\u4F8B"),n.a.createElement(st.a,{value:!1,style:{marginLeft:50}},"\u81EA\u5B9A\u4E49\u6BD4\u4F8B"))),n.a.createElement("div",{className:ye.a.fourPart},be.map(function(ai,on){return n.a.createElement("div",{className:ye.a.groupWrap,key:on},n.a.createElement("div",{className:"font16"},n.a.createElement("span",{className:"mr10"},"\u7EC4",on+1," : "),ri.test_set_score&&n.a.createElement("span",{style:{marginRight:100}},n.a.createElement(A.a,{style:{width:85},value:ai.score,type:"number",disabled:wi,onChange:function(Qt){var di=be.map(function(bi,$){return $===on?Object(_.a)(Object(_.a)({},bi),{},{score:Qt.target.value?Number(Qt.target.value):0}):bi}),Fn={test_set_average:!1};ii(Object(_.a)(Object(_.a)({},ri),Fn)),Zt.setFieldsValue(Fn),tt(di)}}),n.a.createElement("span",{className:"ml10 mr10"},"%")),n.a.createElement(C.a,{className:"font14 ml5",checked:ai.hidden===1,onChange:function(Qt){var di=be.map(function(Fn,bi){return bi===on?Object(_.a)(Object(_.a)({},Fn),{},{hidden:Qt.target.checked?1:0}):Fn});tt(di)}},"\u9690\u85CF",n.a.createElement("span",{className:"font12 c-light-black"},'\uFF08\u9690\u85CF\u6D4B\u8BD5\u96C6\u53EF\u4EE5\u9632\u6B62\u5B66\u751F\u901A\u8FC7"print"\u7B49\u624B\u6BB5\u76F4\u63A5\u901A\u5173\uFF09')),n.a.createElement("span",{className:"tr flex1",style:{float:"right"}},on!==0&&n.a.createElement(Kt.a,{placement:"bottom",title:"\u5220\u9664"},n.a.createElement("span",{className:"font16 c-red current",onClick:function(){var Qt=be.filter(function(di,Fn){return Fn!==on});fi(Qt)}},"\u5220\xA0\u9664")))),n.a.createElement(et,{bordered:!1,className:"mt10",rows:5,placeholder:"\u8F93\u5165",value:ai.input,onChange:function(Qt){var di=be.map(function(Fn,bi){return bi===on?Object(_.a)(Object(_.a)({},Fn),{},{input:Qt.target.value}):Fn});tt(di)}}),n.a.createElement(et,{bordered:!1,className:"mt10",rows:5,placeholder:"\u9884\u671F\u8F93\u51FA",value:ai.output,onChange:function(Qt){var di=be.map(function(Fn,bi){return bi===on?Object(_.a)(Object(_.a)({},Fn),{},{output:Qt.target.value}):Fn});tt(di)}}),n.a.createElement("div",{className:"mt10"},n.a.createElement("span",{className:"font14 mr20"},"\u9884\u671F\u8F93\u51FA:"),n.a.createElement(C.a,{checked:ai.is_invisible,onChange:function(Qt){var di=be.map(function(Fn,bi){return bi===on?Object(_.a)(Object(_.a)({},Fn),{},{is_invisible:Qt.target.checked}):Fn});tt(di)}},n.a.createElement("span",{className:"font14"},"\u5BF9\u5B66\u5458\u4E0D\u53EF\u89C1",n.a.createElement("span",{className:"font12 c-light-black"},"\uFF08\u52FE\u9009\u540E\uFF0C\u9884\u671F\u8F93\u51FA\u5BF9\u5B66\u5458\u59CB\u7EC8\u4E0D\u53EF\u89C1\uFF09")))),n.a.createElement("div",null,n.a.createElement("span",{className:"font14 mr20"},"\u7279\u6B8A\u5224\u5B9A:"),n.a.createElement(C.a,{checked:ai.last_match_rule,onChange:function(Qt){var di=be.map(function(Fn,bi){return bi===on?Object(_.a)(Object(_.a)({},Fn),{},{last_match_rule:Qt.target.checked}):Fn});tt(di)}},n.a.createElement("span",{className:"font14"},"\u672B\u5C3E\u5339\u914D",n.a.createElement("span",{className:"font12 c-light-black"},"\uFF08\u5B9E\u9645\u8F93\u51FA\u4E0E\u9884\u671F\u8F93\u51FA\u6700\u540E\u4E00\u884C\u76F8\u540C\u5373\u53EF\u901A\u5173\uFF09")))))})),n.a.createElement("h4",{className:"font14 mt20 mb10"},"\u8BC4\u6D4B\u811A\u672C"),n.a.createElement(y.a.Item,{name:"choice_standard_scripts"},n.a.createElement(E.a,{className:ye.a.se,getPopupContainer:function(on){return on.parentNode},placeholder:"\u8BF7\u9009\u62E9\u8BC4\u6D4B\u811A\u672C"},at.map(function(ai,on){return n.a.createElement(E.a.Option,{value:ai.id,key:on},ai.scptname)}))),n.a.createElement(y.a.Item,{name:"evaluate_script"},n.a.createElement(T.b,{height:450,style:{border:"1px solid #ccc"},language:"shell",theme:"vs-light"})))),n.a.createElement(Ne.a,{okText:"\u4FDD\u5B58",hasOkBtn:Cn,loading:O,onCancel:function(){return c.d.push("/shixuns/".concat(Ai.current,"/challenges"))},onOk:function(){return Zt.submit()}}))},$t=Object(c.a)(function(Gt){var Bt=Gt.shixunsDetail,Rn=Gt.loading,Wn=Gt.globalSetting,nn=Gt.user;return{shixunsDetail:Bt,globalSetting:Wn,user:nn,loading:Rn}})(yt),gn=q("XeAg"),Dt=q.n(gn),zn=function(Bt){var Rn,Wn,nn=Bt.shixunsDetail,Pt=Bt.globalSetting,Mi=Bt.loading,$i=Bt.user,ui=Bt.dispatch,vn=Object(F.a)(Bt,["shixunsDetail","globalSetting","loading","user","dispatch"]),Bi=Object(l.useRef)(),Ai=Object(l.useState)(),Pi=Object(I.a)(Ai,2),ct=Pi[0],Zt=Pi[1],Ei=Object(l.useState)(),ji=Object(I.a)(Ei,2),ri=ji[0],ii=ji[1],X=Object(l.useState)(),v=Object(I.a)(X,2),O=v[0],B=v[1],te=Object(l.useState)(),z=Object(I.a)(te,2),be=z[0],tt=z[1],Ot=Object(l.useState)(),Ct=Object(I.a)(Ot,2),at=Ct[0],Yt=Ct[1],Cn=Object(l.useState)(),Nn=Object(I.a)(Cn,2),Hi=Nn[0],Ri=Nn[1],fi=Object(l.useState)(),sr=Object(I.a)(fi,2),rr=sr[0],wi=sr[1],lr=Object(l.useState)(),mr=Object(I.a)(lr,2),ai=mr[0],on=mr[1],ci=Object(l.useState)(),Qt=Object(I.a)(ci,2),di=Qt[0],Fn=Qt[1],bi=Object(l.useState)(),$=Object(I.a)(bi,2),pe=$[0],Oe=$[1],Re=Object(l.useState)(),Ge=Object(I.a)(Re,2),Me=Ge[0],$e=Ge[1],Ye=(Rn=$i.userInfo)===null||Rn===void 0||((Wn=Rn.shixun)===null||Wn===void 0)?void 0:Wn.editable;Object(l.useEffect)(function(){var Ze,dt;Bi.current=(Ze=location.pathname)===null||Ze===void 0||((dt=Ze.split("/"))===null||dt===void 0)?void 0:dt[2]},[]),Object(l.useEffect)(function(){var Ze,dt,lt,nt,Et,pt,Lt,bt,Nt,qt,rn,ti,pn,bn,In,At,cn,Jt,wn,En,Vn;if(!nn.setting)return;Zt((Ze=nn.setting)===null||Ze===void 0||((dt=Ze.shixun)===null||dt===void 0)?void 0:dt.vnc),ii(!!((lt=nn.setting)!==null&<!==void 0&&(nt=lt.shixun)!==null&&nt!==void 0&&nt.webssh)),B((Et=nn.setting)===null||Et===void 0||((pt=Et.shixun)===null||pt===void 0)?void 0:pt.webssh),tt((Lt=nn.setting)===null||Lt===void 0||((bt=Lt.shixun)===null||bt===void 0)?void 0:bt.multi_webssh),Yt((Nt=nn.setting)===null||Nt===void 0||((qt=Nt.shixun)===null||qt===void 0)?void 0:qt.hide_code),Ri((rn=nn.setting)===null||rn===void 0||((ti=rn.shixun)===null||ti===void 0)?void 0:ti.code_edit_permission),wi((pn=nn.setting)===null||pn===void 0||((bn=pn.shixun)===null||bn===void 0)?void 0:bn.code_hidden),on((In=nn.setting)===null||In===void 0||((At=In.shixun)===null||At===void 0)?void 0:At.forbid_copy),Fn((cn=nn.setting)===null||cn===void 0||((Jt=cn.shixun)===null||Jt===void 0)?void 0:Jt.task_pass),Oe((wn=nn.setting)===null||wn===void 0||((En=wn.shixun)===null||En===void 0)?void 0:En.test_set_permission),$e((Vn=nn.setting.shixun)===null||Vn===void 0?void 0:Vn.display_git_address)},[nn.setting]);var ut=function(){var Ze=Object(H.a)(d.a.mark(function dt(){var lt;return d.a.wrap(function(Et){for(;;)switch(Et.prev=Et.next){case 0:return Et.next=2,ui({type:"shixunsDetail/updateLearnSetting",payload:{id:Bi.current,shixun:{code_hidden:rr,forbid_copy:ai,hide_code:at,multi_webssh:be,task_pass:di,test_set_permission:pe,display_git_address:Me,vnc:ct,webssh:ri?O:0,code_edit_permission:Hi}}});case 2:lt=Et.sent,lt.status!==-1&&(Y.b.info("\u5B66\u4E60\u9875\u9762\u8BBE\u7F6E\u4FDD\u5B58\u6210\u529F\uFF01"),ui({type:"shixunsDetail/getSettingsData",payload:{id:Bi.current}}),ui({type:"shixunsDetail/getShixunsDetail",payload:{id:Bi.current}}));case 4:case"end":return Et.stop()}},dt)}));return function(){return Ze.apply(this,arguments)}}();return n.a.createElement("section",{className:Dt.a.wrap},(ct||!ri)&&n.a.createElement("div",{className:Dt.a.labelWrap},n.a.createElement("label",{className:Dt.a.label},"\u5F00\u542F\u56FE\u5F62\u5316\u754C\u9762\uFF1A"),n.a.createElement("div",{className:Dt.a.labelContent},n.a.createElement("div",null,n.a.createElement(C.a,{checked:ct,disabled:!Ye,onChange:function(dt){var lt=dt.target.checked;Zt(lt),lt&&(Yt(!1),Ri(!1),wi(!1),on(!1),tt(!1),ii(!1))}}),n.a.createElement("span",{className:"".concat(Dt.a.color999," ml10")},"\uFF08\u9009\u4E2D\u5219\u7ED9\u5B66\u5458\u7684\u5B9E\u8DF5\u4EFB\u52A1\u542F\u52A8Ubuntu\u7CFB\u7EDF\u7684\u56FE\u5F62\u5316\u754C\u9762\uFF09")))),!ct&&n.a.createElement("div",{className:Dt.a.labelWrap},n.a.createElement("label",{className:Dt.a.label},"\u547D\u4EE4\u884C\uFF1A"),n.a.createElement("div",{className:Dt.a.labelContent},n.a.createElement("div",null,n.a.createElement(C.a,{checked:ri,disabled:!Ye,onChange:function(dt){var lt=dt.target.checked;ii(lt),lt?(Zt(!1),B(1)):(tt(!1),B(null),Yt(!1))}}),n.a.createElement("span",{className:"".concat(Dt.a.color999," ml10")},"\uFF08\u9009\u4E2D\u5219\u7ED9\u5B66\u5458\u7684\u5B9E\u8DF5\u4EFB\u52A1\u63D0\u4F9B\u547D\u4EE4\u884C\u7A97\u53E3\uFF09")),ri&&n.a.createElement("div",{className:"ml40"},n.a.createElement(st.a.Group,{value:O,disabled:!Ye,onChange:function(dt){var lt=dt.target.value;B(lt),lt!==1&&tt(!1)}},n.a.createElement(st.a,{className:Dt.a.radio,value:1},n.a.createElement("span",null,"\u547D\u4EE4\u884C\u7EC3\u4E60\u7A97\u53E3"),n.a.createElement("span",{className:Dt.a.color999},"\uFF08\u9009\u4E2D\u5219\u7ED9\u5B66\u5458\u63D0\u4F9B\u7528\u4E8E\u7EC3\u4E60\u64CD\u4F5C\u7684\u547D\u4EE4\u884C\uFF0C\u547D\u4EE4\u884C\u7684\u64CD\u4F5C\u4E0D\u4F1A\u5BF9\u5B66\u751F\u7684\u5B9E\u9A8C\u73AF\u5883\u9020\u6210\u5F71\u54CD\uFF09")),n.a.createElement(st.a,{className:Dt.a.radio,value:2},n.a.createElement("span",null,"\u547D\u4EE4\u884C\u8BC4\u6D4B\u7A97\u53E3"),n.a.createElement("span",{className:Dt.a.color999},"\uFF08\u9009\u4E2D\u5219\u7ED9\u5B66\u5458\u63D0\u4F9B\u7528\u4E8E\u8BC4\u6D4B\u64CD\u4F5C\u7684\u547D\u4EE4\u884C\uFF0C\u547D\u4EE4\u884C\u7684\u64CD\u4F5C\u53EF\u4EE5\u5BF9\u5B66\u751F\u7684\u5B9E\u9A8C\u73AF\u5883\u4EA7\u751F\u5F71\u54CD\uFF09")))),O===2&&n.a.createElement("div",{className:"ml60"},n.a.createElement(C.a,{checked:be,disabled:!Ye,onChange:function(dt){return tt(dt.target.checked)}}),n.a.createElement("span",{className:" ml10"},n.a.createElement("span",null,"\u591A\u4E2A\u547D\u4EE4\u884C\u7A97\u53E3\uFF1A"),n.a.createElement("span",{className:Dt.a.color999},"\uFF08\u9009\u4E2D\u5219\u5141\u8BB8\u5B66\u5458\u540C\u65F6\u5F00\u542F\u591A\u4E2A\u547D\u4EE4\u884C\u7A97\u53E3\uFF09"))))),!ct&&ri&&n.a.createElement("div",{className:Dt.a.labelWrap},n.a.createElement("label",{className:Dt.a.label},"\u9690\u85CF\u4EE3\u7801\u7A97\u53E3\uFF1A"),n.a.createElement("div",{className:Dt.a.labelContent},n.a.createElement("div",null,n.a.createElement(C.a,{checked:at,disabled:!Ye,onChange:function(dt){var lt=dt.target.checked;Yt(lt),lt&&Ri(!1)}}),n.a.createElement("span",{className:"".concat(Dt.a.color999," ml10")},"\uFF08\u9009\u4E2D\u5219\u5B66\u5458\u9875\u9762\u4E0D\u663E\u793A\u4EE3\u7801\u7A97\u53E3\uFF09")))),!ct&&!at&&n.a.createElement("div",{className:Dt.a.labelWrap},n.a.createElement("label",{className:Dt.a.label},"\u516C\u5F00\u7248\u672C\u5E93\uFF1A"),n.a.createElement("div",{className:Dt.a.labelContent},n.a.createElement("div",null,n.a.createElement(C.a,{checked:Hi,disabled:!Ye,onChange:function(dt){return Ri(dt.target.checked)}}),n.a.createElement("span",{className:"".concat(Dt.a.color999," ml10")},"\uFF08\u9009\u4E2D\u5219\u5141\u8BB8\u5B66\u5458\u67E5\u770B\u7248\u672C\u5E93\u4E2D\u7684\u5168\u90E8\u6587\u4EF6\uFF09")))),!at&&n.a.createElement("div",{className:Dt.a.labelWrap},n.a.createElement("label",{className:Dt.a.label},"\u663E\u793A\u7248\u672C\u5E93\u5730\u5740\uFF1A"),n.a.createElement("div",{className:Dt.a.labelContent},n.a.createElement("div",null,n.a.createElement(C.a,{checked:Me,disabled:!Ye,onChange:function(dt){return $e(dt.target.checked)}}),n.a.createElement("span",{className:"".concat(Dt.a.color999," ml10")}," \uFF08\u9009\u4E2D\u5219\u5BF9\u5B66\u5458\u516C\u5F00\u7248\u672C\u5E93\u5730\u5740\uFF0C\u5B66\u5458\u53EF\u4EE5\u5C06\u6240\u6709\u4EE3\u7801\u4E0B\u8F7D\u5230\u672C\u5730\uFF09")))),!ct&&n.a.createElement("div",{className:Dt.a.labelWrap},n.a.createElement("label",{className:Dt.a.label},"\u9690\u85CF\u4EE3\u7801\u76EE\u5F55\uFF1A"),n.a.createElement("div",{className:Dt.a.labelContent},n.a.createElement("div",null,n.a.createElement(C.a,{checked:rr,disabled:!Ye,onChange:function(dt){return wi(dt.target.checked)}}),n.a.createElement("span",{className:"".concat(Dt.a.color999," ml10")},"\uFF08\u9009\u4E2D\u5219\u5B66\u5458\u9875\u9762\u4E0D\u663E\u793A\u7248\u672C\u5E93\u76EE\u5F55\uFF09")))),!ct&&n.a.createElement("div",{className:Dt.a.labelWrap},n.a.createElement("label",{className:Dt.a.label},"\u7981\u7528\u7C98\u8D34\uFF1A"),n.a.createElement("div",{className:Dt.a.labelContent},n.a.createElement("div",null,n.a.createElement(C.a,{checked:ai,disabled:!Ye,onChange:function(dt){return on(dt.target.checked)}}),n.a.createElement("span",{className:"".concat(Dt.a.color999," ml10")},"\uFF08\u9009\u4E2D\u5219\u5B66\u5458\u9875\u9762\u4E0D\u5141\u8BB8\u4F7F\u7528\u7C98\u8D34\u529F\u80FD\uFF09")))),n.a.createElement("div",{className:Dt.a.labelWrap},n.a.createElement("label",{className:Dt.a.label},"\u8DF3\u5173\uFF1A"),n.a.createElement("div",{className:Dt.a.labelContent},n.a.createElement("div",null,n.a.createElement(C.a,{checked:di,disabled:!Ye,onChange:function(dt){return Fn(dt.target.checked)}}),n.a.createElement("span",{className:"".concat(Dt.a.color999," ml10")},"\uFF08\u9009\u4E2D\u5219\u5141\u8BB8\u5B66\u5458\u8DF3\u5173\u5B66\u4E60\u5B9E\u8BAD\u5173\u5361\u4EFB\u52A1\uFF09")))),n.a.createElement("div",{className:Dt.a.labelWrap},n.a.createElement("label",{className:Dt.a.label},"\u6D4B\u8BD5\u96C6\u89E3\u9501\uFF1A"),n.a.createElement("div",{className:Dt.a.labelContent},n.a.createElement("div",null,n.a.createElement(C.a,{checked:pe,disabled:!Ye,onChange:function(dt){return Oe(dt.target.checked)}}),n.a.createElement("span",{className:"".concat(Dt.a.color999," ml10")},"\uFF08\u9009\u4E2D\u5219\u5141\u8BB8\u5B66\u5458\u901A\u8FC7\u91D1\u5E01\u89E3\u9501\u67E5\u770B\u9690\u85CF\u6D4B\u8BD5\u96C6\u7684\u5185\u5BB9\uFF09")))),n.a.createElement(Ne.a,{okText:"\u4FDD\u5B58",hasOkBtn:Ye,loading:Mi.effects["shixunsDetail/updateLearnSetting"],onCancel:function(){return c.d.push("/shixuns/".concat(Bi.current,"/challenges"))},onOk:ut}))},Ln=Object(c.a)(function(Gt){var Bt=Gt.shixunsDetail,Rn=Gt.loading,Wn=Gt.globalSetting,nn=Gt.user;return{shixunsDetail:Bt,globalSetting:Wn,user:nn,loading:Rn}})(zn),sn=q("NLgs"),_i=q("cWXX"),si=q("/ezw"),zi=q("nl6Q"),Oi=q.n(zi),Qn=function(Bt){var Rn,Wn,nn,Pt,Mi=Bt.shixunsDetail,$i=Bt.globalSetting,ui=Bt.user,vn=Bt.dispatch,Bi=Object(F.a)(Bt,["shixunsDetail","globalSetting","user","dispatch"]),Ai=Object(m.h)(),Pi=Object(l.useRef)((Rn=Ai.pathname)===null||Rn===void 0||((Wn=Rn.split("/"))===null||Wn===void 0)?void 0:Wn[2]),ct=y.a.useForm(),Zt=Object(I.a)(ct,1),Ei=Zt[0],ji=Object(l.useState)(""),ri=Object(I.a)(ji,2),ii=ri[0],X=ri[1],v=Object(l.useState)(!1),O=Object(I.a)(v,2),B=O[0],te=O[1],z=(nn=ui.userInfo)===null||nn===void 0||((Pt=nn.shixun)===null||Pt===void 0)?void 0:Pt.editable;Object(l.useEffect)(function(){Pi.current&&be()},[Pi.current]);var be=function(){var Ot=Object(H.a)(d.a.mark(function Ct(){var at;return d.a.wrap(function(Cn){for(;;)switch(Cn.prev=Cn.next){case 0:return te(!0),Cn.next=3,Object(Se.a)("/api/shixuns/".concat(Pi.current,"/get_standard_answer.json"),{method:"get"});case 3:at=Cn.sent,at.status===0&&(X((at==null?void 0:at.standard_answer)||""),te(!1));case 5:case"end":return Cn.stop()}},Ct)}));return function(){return Ot.apply(this,arguments)}}(),tt=function(){var Ot=Object(H.a)(d.a.mark(function Ct(at){var Yt;return d.a.wrap(function(Nn){for(;;)switch(Nn.prev=Nn.next){case 0:return Nn.next=2,Object(Se.a)("/api/shixuns/".concat(Pi.current,"/set_standard_answer.json"),{method:"post",body:Object(_.a)({},at)});case 2:Yt=Nn.sent,Yt.status===0&&Y.b.success("\u4FDD\u5B58\u6210\u529F");case 4:case"end":return Nn.stop()}},Ct)}));return function(at){return Ot.apply(this,arguments)}}();return n.a.createElement("section",{className:Oi.a.wrap},n.a.createElement(si.a,{loading:B},n.a.createElement(y.a,{form:Ei,className:Oi.a.formWrap,scrollToFirstError:!0,layout:"vertical",onFinish:tt},n.a.createElement("div",{className:Oi.a.fieldWrap},n.a.createElement(y.a.Item,{name:"standard_answer",label:"\u53C2\u8003\u7B54\u6848:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848"}]},z?n.a.createElement(j.a,{defaultValue:ii}):n.a.createElement(_e.a,{value:ii}))),n.a.createElement(y.a.Item,null,n.a.createElement(Ne.a,{okText:"\u4FDD\u5B58",hasOkBtn:z,loading:!1,onCancel:function(){return c.d.push("/shixuns/".concat(Pi.current,"/challenges"))},okButtonProps:{htmlType:"submit"}})))))},ir=Object(c.a)(function(Gt){var Bt=Gt.shixunsDetail,Rn=Gt.globalSetting,Wn=Gt.user;return{shixunsDetail:Bt,globalSetting:Rn,user:Wn}})(Qn),qi=g.a.TabPane,It;(function(Gt){Gt.BasicInfo="basicInfo",Gt.Permission="permission",Gt.Learning="learning",Gt.TestCase="testCase",Gt.SuggestedAnswer="suggestedAnswer"})(It||(It={}));var Hn=function(Bt){var Rn,Wn,nn,Pt=Bt.shixunsDetail,Mi=Bt.globalSetting,$i=Bt.loading,ui=Bt.user,vn=Bt.dispatch,Bi=Object(F.a)(Bt,["shixunsDetail","globalSetting","loading","user","dispatch"]),Ai=Object(l.useState)(),Pi=Object(I.a)(Ai,2),ct=Pi[0],Zt=Pi[1],Ei=Object(l.useRef)(""),ji=(Rn=ui.userInfo)===null||Rn===void 0||((Wn=Rn.shixun)===null||Wn===void 0)?void 0:Wn.is_creator;Object(l.useEffect)(function(){return vn({type:"globalSetting/footerToggle",payload:!1}),function(){vn({type:"globalSetting/footerToggle",payload:!0})}},[]),Object(l.useEffect)(function(){var O;Ei.current=(O=location.pathname.split("/"))===null||O===void 0?void 0:O[2],vn({type:"shixunsDetail/getSettingsData",payload:{id:Ei.current}})},[]);var ri=function(){var O=Object(H.a)(d.a.mark(function B(){return d.a.wrap(function(z){for(;;)switch(z.prev=z.next){case 0:U.a.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:n.a.createElement("div",{className:"tc font14"},"\u5173\u95ED\u540E,",n.a.createElement("br",null),"\u7528\u6237\u4E0D\u80FD\u518D\u5F00\u59CB\u6311\u6218\u4E86\u662F\u5426\u786E\u8BA4\u5173\u95ED \uFF1F"),onOk:function(){var be=Object(H.a)(d.a.mark(function Ot(){var Ct;return d.a.wrap(function(Yt){for(;;)switch(Yt.prev=Yt.next){case 0:return Yt.next=2,vn({type:"shixunsDetail/permanentClose",payload:{id:Ei.current}});case 2:Ct=Yt.sent,Ct.status===1&&(Y.b.info("\u64CD\u4F5C\u6210\u529F"),c.d.push("/shixuns/".concat(Ei.current,"/challenges")));case 4:case"end":return Yt.stop()}},Ot)}));function tt(){return be.apply(this,arguments)}return tt}()});case 1:case"end":return z.stop()}},B)}));return function(){return O.apply(this,arguments)}}(),ii=function(){var O=Object(H.a)(d.a.mark(function B(){var te,z,be,tt,Ot,Ct,at;return d.a.wrap(function(Cn){for(;;)switch(Cn.prev=Cn.next){case 0:return Cn.next=2,vn({type:"shixunsDetail/getShixunQuote",payload:{id:Ei.current}});case 2:if(Cn.t0=Cn.sent,Cn.t0){Cn.next=5;break}Cn.t0={};case 5:at=Cn.t0,U.a.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",width:520,content:n.a.createElement("div",{className:"tc font14 ".concat(a.a.modal)},!!((te=at.subjects)!==null&&te!==void 0&&te.length)&&n.a.createElement(n.a.Fragment,null,n.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5DF2\u88AB\u5E94\u7528\u5230 ",(z=at.subjects)===null||z===void 0||((be=z.splice(0,2))===null||be===void 0)?void 0:be.map(function(Nn){return"\u300A".concat(Nn,"\u300B")}),"\u7B49",n.a.createElement("span",{className:a.a.colorOrange},at==null?void 0:at.subjects_count),"\u4E2A\u5B9E\u8BAD\u8BFE\u7A0B"),n.a.createElement("br",null)),!!((tt=at.courses)!==null&&tt!==void 0&&tt.length)&&n.a.createElement(n.a.Fragment,null,n.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5DF2\u88AB\u5E94\u7528\u5230",(Ot=at.courses)===null||Ot===void 0||((Ct=Ot.splice(0,2))===null||Ct===void 0)?void 0:Ct.map(function(Nn){return"\u300A".concat(Nn,"\u300B")}),"\u7B49",n.a.createElement("span",{className:a.a.colorOrange},at==null?void 0:at.courses_count),"\u4E2A\u6559\u5B66\u8BFE\u5802"),n.a.createElement("br",null)),n.a.createElement("span",{className:"".concat(a.a.colorYellow," mt30")},"\u5220\u9664\u5B9E\u8DF5\u9879\u76EE\u5C06\u5F71\u54CD\u8BFE\u7A0B\u53CA\u8BFE\u5802\u5BF9\u8BE5\u5B9E\u8DF5\u9879\u76EE\u7684\u4F7F\u7528\uFF01\u8BF7\u8C28\u614E\u64CD\u4F5C\uFF01")),onOk:function(){var Nn=Object(H.a)(d.a.mark(function Ri(){var fi;return d.a.wrap(function(rr){for(;;)switch(rr.prev=rr.next){case 0:return rr.next=2,vn({type:"shixunsDetail/deleteShixun",payload:{id:Ei.current}});case 2:fi=rr.sent,fi.status===1&&(Y.b.success("\u64CD\u4F5C\u6210\u529F"),c.d.push("/shixuns"));case 4:case"end":return rr.stop()}},Ri)}));function Hi(){return Nn.apply(this,arguments)}return Hi}()});case 7:case"end":return Cn.stop()}},B)}));return function(){return O.apply(this,arguments)}}(),X=function(){if(Object(sn.b)(vn,"\u4E0D\u80FD\u8FDB\u884C\u5220\u9664"))return},v=function(){var B,te,z,be;return n.a.createElement("div",{className:"mr20"},ji?(Pt==null||((B=Pt.detail)===null||B===void 0)?void 0:B.shixun_status)!==2?n.a.createElement(Q.a,{type:"primary",className:"mr20",ghost:!0,onClick:ii},"\u5220\u9664\u5B9E\u8DF5\u9879\u76EE"):n.a.createElement(Q.a,{type:"primary",className:"mr20",ghost:!0,onClick:X},"\u5220\u9664\u5B9E\u8DF5\u9879\u76EE"):null,((te=Pt.detail)===null||te===void 0?void 0:te.identity)===1&&((z=Pt.setting)===null||z===void 0||((be=z.shixun)===null||be===void 0)?void 0:be.status)===2&&n.a.createElement(Q.a,{type:"primary",ghost:!0,onClick:ri},"\u6C38\u4E45\u5173\u95ED"))};return n.a.createElement("section",{className:a.a.bg},n.a.createElement(g.a,{animated:!1,activeKey:ct,onChange:function(B){return Zt(B)},tabBarExtraContent:v()},n.a.createElement(qi,{tab:"\u57FA\u672C\u4FE1\u606F",key:It.BasicInfo},n.a.createElement(ae,null)),n.a.createElement(qi,{tab:"\u6743\u9650\u914D\u7F6E",key:It.Permission},n.a.createElement(it,null)),n.a.createElement(qi,{tab:"\u8BC4\u6D4B\u8BBE\u7F6E",key:It.TestCase},n.a.createElement($t,{active:ct})),n.a.createElement(qi,{tab:"\u53C2\u8003\u7B54\u6848",key:It.SuggestedAnswer},n.a.createElement(ir,null)),!((nn=Pt.detail)!==null&&nn!==void 0&&nn.is_jupyter)&&n.a.createElement(qi,{tab:"\u5B66\u4E60\u9875\u9762\u8BBE\u7F6E",key:It.Learning},n.a.createElement(Ln,null))))},li=_t.default=Object(c.a)(function(Gt){var Bt=Gt.shixunsDetail,Rn=Gt.loading,Wn=Gt.globalSetting,nn=Gt.user;return{shixunsDetail:Bt,globalSetting:Wn,user:nn,loading:Rn.models.index}})(Hn)},"5VLF":function(Mt,_t,q){"use strict";var le,Q;function P(Y,D,U){var H=function(I,F){return Y.js_beautify(I,F)};return H.js=Y.js_beautify,H.css=D.css_beautify,H.html=U.html_beautify,H.js_beautify=Y.js_beautify,H.css_beautify=D.css_beautify,H.html_beautify=U.html_beautify,H}!(le=[q("6UM0"),q("TXwP"),q("psGv")],Q=function(Y,D,U){return P(Y,D,U)}.apply(_t,le),Q!==void 0&&(Mt.exports=Q))},"6UM0":function(Mt,_t,q){var le,Q;(function(){var P;(function(){"use strict";var D=[function(F,R,g){var p=g(1).Beautifier,d=g(5).Options;function l(n,c){var s=new p(n,c);return s.beautify()}F.exports=l,F.exports.defaultOptions=function(){return new d}},function(F,R,g){var p=g(2).Output,d=g(3).Token,l=g(4),n=g(5).Options,c=g(7).Tokenizer,s=g(7).line_starters,a=g(7).positionable_operators,o=g(7).TOKEN;function f(b,G){return G.indexOf(b)!==-1}function L(b){return b.replace(/^\s+/g,"")}function C(b){for(var G={},J=0;J<b.length;J++)G[b[J].replace(/-/g,"_")]=b[J];return G}function x(b,G){return b&&b.type===o.RESERVED&&b.text===G}function A(b,G){return b&&b.type===o.RESERVED&&f(b.text,G)}var w=["case","return","do","if","throw","else","await","break","continue","async"],_=["before-newline","after-newline","preserve-newline"],S=C(_),y=[S.before_newline,S.preserve_newline],h={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function E(b,G){if(G.multiline_frame||G.mode===h.ForInitializer||G.mode===h.Conditional)return;b.remove_indent(G.start_line_index)}function m(b){b=b.replace(l.allLineBreaks,`
|
|
`);for(var G=[],J=b.indexOf(`
|
|
`);J!==-1;)G.push(b.substring(0,J)),b=b.substring(J+1),J=b.indexOf(`
|
|
`);return b.length&&G.push(b),G}function T(b){return b===h.ArrayLiteral}function j(b){return f(b,[h.Expression,h.ForInitializer,h.Conditional])}function N(b,G){for(var J=0;J<b.length;J++){var oe=b[J].trim();if(oe.charAt(0)!==G)return!1}return!0}function K(b,G){for(var J=0,oe=b.length,fe;J<oe;J++)if(fe=b[J],fe&&fe.indexOf(G)!==0)return!1;return!0}function W(b,G){G=G||{},this._source_text=b||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new n(G)}W.prototype.create_flags=function(b,G){var J=0;b&&(J=b.indentation_level,!this._output.just_added_newline()&&b.line_indent_level>J&&(J=b.line_indent_level));var oe={mode:G,parent:b,last_token:b?b.last_token:new d(o.START_BLOCK,""),last_word:b?b.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:J,alignment:0,line_indent_level:b?b.line_indent_level:J,start_line_index:this._output.get_line_number(),ternary_depth:0};return oe},W.prototype._reset=function(b){var G=b.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(h.BlockStatement);var J=new c(b,this._options);return this._tokens=J.tokenize(),b},W.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var b,G=this._reset(this._source_text),J=this._options.eol;this._options.eol==="auto"&&(J=`
|
|
`,G&&l.lineBreak.test(G||"")&&(J=G.match(l.lineBreak)[0]));for(var oe=this._tokens.next();oe;)this.handle_token(oe),this._last_last_text=this._flags.last_token.text,this._flags.last_token=oe,oe=this._tokens.next();return b=this._output.get_code(J),b},W.prototype.handle_token=function(b,G){b.type===o.START_EXPR?this.handle_start_expr(b):b.type===o.END_EXPR?this.handle_end_expr(b):b.type===o.START_BLOCK?this.handle_start_block(b):b.type===o.END_BLOCK?this.handle_end_block(b):b.type===o.WORD?this.handle_word(b):b.type===o.RESERVED?this.handle_word(b):b.type===o.SEMICOLON?this.handle_semicolon(b):b.type===o.STRING?this.handle_string(b):b.type===o.EQUALS?this.handle_equals(b):b.type===o.OPERATOR?this.handle_operator(b):b.type===o.COMMA?this.handle_comma(b):b.type===o.BLOCK_COMMENT?this.handle_block_comment(b,G):b.type===o.COMMENT?this.handle_comment(b,G):b.type===o.DOT?this.handle_dot(b):b.type===o.EOF?this.handle_eof(b):b.type===o.UNKNOWN?this.handle_unknown(b,G):this.handle_unknown(b,G)},W.prototype.handle_whitespace_and_comments=function(b,G){var J=b.newlines,oe=this._options.keep_array_indentation&&T(this._flags.mode);if(b.comments_before)for(var fe=b.comments_before.next();fe;)this.handle_whitespace_and_comments(fe,G),this.handle_token(fe,G),fe=b.comments_before.next();if(oe)for(var Ne=0;Ne<J;Ne+=1)this.print_newline(Ne>0,G);else if(this._options.max_preserve_newlines&&J>this._options.max_preserve_newlines&&(J=this._options.max_preserve_newlines),this._options.preserve_newlines&&J>1){this.print_newline(!1,G);for(var _e=1;_e<J;_e+=1)this.print_newline(!0,G)}};var k=["async","break","continue","return","throw","yield"];W.prototype.allow_wrap_or_preserved_newline=function(b,G){if(G=G===void 0?!1:G,this._output.just_added_newline())return;var J=this._options.preserve_newlines&&b.newlines||G,oe=f(this._flags.last_token.text,a)||f(b.text,a);if(oe){var fe=f(this._flags.last_token.text,a)&&f(this._options.operator_position,y)||f(b.text,a);J=J&&fe}if(J)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(A(this._flags.last_token,k))return;this._output.set_wrap_point()}},W.prototype.print_newline=function(b,G){if(!G&&(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==o.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")))for(var J=this._tokens.peek();this._flags.mode===h.Statement&&!(this._flags.if_block&&x(J,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(b)&&(this._flags.multiline_frame=!0)},W.prototype.print_token_line_indentation=function(b){this._output.just_added_newline()&&(this._options.keep_array_indentation&&b.newlines&&(b.text==="["||T(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(b.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},W.prototype.print_token=function(b){if(this._output.raw){this._output.add_raw_token(b);return}if(this._options.comma_first&&b.previous&&b.previous.type===o.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var G=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(G),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(b),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(b),this._output.non_breaking_space=!0,this._output.add_token(b.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},W.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},W.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},W.prototype.set_mode=function(b){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,b),this._flags=this.create_flags(this._previous_flags,b),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},W.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===h.Statement&&E(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},W.prototype.start_of_object_property=function(){return this._flags.parent.mode===h.ObjectLiteral&&this._flags.mode===h.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||A(this._flags.last_token,["get","set"]))},W.prototype.start_of_statement=function(b){var G=!1;return G=G||A(this._flags.last_token,["var","let","const"])&&b.type===o.WORD,G=G||x(this._flags.last_token,"do"),G=G||!(this._flags.parent.mode===h.ObjectLiteral&&this._flags.mode===h.Statement)&&A(this._flags.last_token,k)&&!b.newlines,G=G||x(this._flags.last_token,"else")&&!(x(b,"if")&&!b.comments_before),G=G||this._flags.last_token.type===o.END_EXPR&&(this._previous_flags.mode===h.ForInitializer||this._previous_flags.mode===h.Conditional),G=G||this._flags.last_token.type===o.WORD&&this._flags.mode===h.BlockStatement&&!this._flags.in_case&&!(b.text==="--"||b.text==="++")&&this._last_last_text!=="function"&&b.type!==o.WORD&&b.type!==o.RESERVED,G=G||this._flags.mode===h.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||A(this._flags.last_token,["get","set"])),G?(this.set_mode(h.Statement),this.indent(),this.handle_whitespace_and_comments(b,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(b,A(b,["do","for","if","while"])),!0):!1},W.prototype.handle_start_expr=function(b){this.start_of_statement(b)||this.handle_whitespace_and_comments(b);var G=h.Expression;if(b.text==="["){if(this._flags.last_token.type===o.WORD||this._flags.last_token.text===")"){A(this._flags.last_token,s)&&(this._output.space_before_token=!0),this.print_token(b),this.set_mode(G),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}G=h.ArrayLiteral,T(this._flags.mode)&&((this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline())),f(this._flags.last_token.type,[o.START_EXPR,o.END_EXPR,o.WORD,o.OPERATOR,o.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===o.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,G=h.ForInitializer):f(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,G=h.Conditional):f(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&b.whitespace_before===""?this._output.space_before_token=!1:(f(this._flags.last_token.text,s)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===o.EQUALS||this._flags.last_token.type===o.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(b);else if(this._flags.last_token.type===o.WORD){this._output.space_before_token=!1;var J=this._tokens.peek(-3);if(this._options.space_after_named_function&&J){var oe=this._tokens.peek(-4);A(J,["async","function"])||J.text==="*"&&A(oe,["async","function"])?this._output.space_before_token=!0:this._flags.mode===h.ObjectLiteral?(J.text==="{"||J.text===","||J.text==="*"&&(oe.text==="{"||oe.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(b);(this._flags.last_token.type===o.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(f(this._last_last_text,["function","yield"])||this._flags.mode===h.ObjectLiteral&&f(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===o.START_BLOCK?this.print_newline():(this._flags.last_token.type===o.END_EXPR||this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===o.COMMA)&&this.allow_wrap_or_preserved_newline(b,b.newlines),this.print_token(b),this.set_mode(G),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},W.prototype.handle_end_expr=function(b){for(;this._flags.mode===h.Statement;)this.restore_mode();this.handle_whitespace_and_comments(b),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(b,b.text==="]"&&T(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===o.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(b),this.restore_mode(),E(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===h.Conditional&&(this._previous_flags.mode=h.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},W.prototype.handle_start_block=function(b){this.handle_whitespace_and_comments(b);var G=this._tokens.peek(),J=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===o.END_EXPR?(this.set_mode(h.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(h.BlockStatement):J&&(f(J.text,[":",","])&&f(G.type,[o.STRING,o.WORD,o.RESERVED])||f(G.text,["get","set","..."])&&f(J.type,[o.WORD,o.RESERVED]))?f(this._last_last_text,["class","interface"])&&!f(J.text,[":",","])?this.set_mode(h.BlockStatement):this.set_mode(h.ObjectLiteral):this._flags.last_token.type===o.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(h.BlockStatement):f(this._flags.last_token.type,[o.EQUALS,o.START_EXPR,o.COMMA,o.OPERATOR])||A(this._flags.last_token,["return","throw","import","default"])?this.set_mode(h.ObjectLiteral):this.set_mode(h.BlockStatement),this._flags.last_token&&(A(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0));var oe=!G.comments_before&&G.text==="}",fe=oe&&this._flags.last_word==="function"&&this._flags.last_token.type===o.END_EXPR;if(this._options.brace_preserve_inline){var Ne=0,_e=null;this._flags.inline_frame=!0;do if(Ne+=1,_e=this._tokens.peek(Ne-1),_e.newlines){this._flags.inline_frame=!1;break}while(_e.type!==o.EOF&&!(_e.type===o.END_BLOCK&&_e.opened===b))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&b.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==o.OPERATOR&&(fe||this._flags.last_token.type===o.EQUALS||A(this._flags.last_token,w)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(T(this._previous_flags.mode)&&(this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.COMMA)&&((this._flags.last_token.type===o.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(b),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==o.OPERATOR&&this._flags.last_token.type!==o.START_EXPR&&(this._flags.last_token.type===o.START_BLOCK&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(b),this.indent(),!oe&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},W.prototype.handle_end_block=function(b){for(this.handle_whitespace_and_comments(b);this._flags.mode===h.Statement;)this.restore_mode();var G=this._flags.last_token.type===o.START_BLOCK;this._flags.inline_frame&&!G?this._output.space_before_token=!0:this._options.brace_style==="expand"?G||this.print_newline():G||(T(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(b)},W.prototype.handle_word=function(b){if(b.type===o.RESERVED){if(f(b.text,["set","get"])&&this._flags.mode!==h.ObjectLiteral)b.type=o.WORD;else if(b.text==="import"&&f(this._tokens.peek().text,["(","."]))b.type=o.WORD;else if(f(b.text,["as","from"])&&!this._flags.import_block)b.type=o.WORD;else if(this._flags.mode===h.ObjectLiteral){var G=this._tokens.peek();G.text===":"&&(b.type=o.WORD)}}if(this.start_of_statement(b)?A(this._flags.last_token,["var","let","const"])&&b.type===o.WORD&&(this._flags.declaration_statement=!0):b.newlines&&!j(this._flags.mode)&&(this._flags.last_token.type!==o.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==o.EQUALS&&(this._options.preserve_newlines||!A(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(b),this.print_newline()):this.handle_whitespace_and_comments(b),this._flags.do_block&&!this._flags.do_while)if(x(b,"while")){this._output.space_before_token=!0,this.print_token(b),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(b,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===h.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&A(b,["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(b),this._flags.in_case=!0;return}if((this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.EQUALS||this._flags.last_token.type===o.OPERATOR)&&(this.start_of_object_property()||this.allow_wrap_or_preserved_newline(b)),x(b,"function")){(f(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(f(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===o.OPERATOR))&&(!this._output.just_added_blankline()&&!b.comments_before&&(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===o.RESERVED||this._flags.last_token.type===o.WORD?A(this._flags.last_token,["get","set","new","export"])||A(this._flags.last_token,k)?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===o.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(j(this._flags.mode)||T(this._flags.mode))||this.print_newline(),this.print_token(b),this._flags.last_word=b.text;return}var J="NONE";if(this._flags.last_token.type===o.END_BLOCK?this._previous_flags.inline_frame?J="SPACE":A(b,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&b.newlines?J="NEWLINE":(J="SPACE",this._output.space_before_token=!0):J="NEWLINE":this._flags.last_token.type===o.SEMICOLON&&this._flags.mode===h.BlockStatement?J="NEWLINE":this._flags.last_token.type===o.SEMICOLON&&j(this._flags.mode)?J="SPACE":this._flags.last_token.type===o.STRING?J="NEWLINE":this._flags.last_token.type===o.RESERVED||this._flags.last_token.type===o.WORD||this._flags.last_token.text==="*"&&(f(this._last_last_text,["function","yield"])||this._flags.mode===h.ObjectLiteral&&f(this._last_last_text,["{",","]))?J="SPACE":this._flags.last_token.type===o.START_BLOCK?this._flags.inline_frame?J="SPACE":J="NEWLINE":this._flags.last_token.type===o.END_EXPR&&(this._output.space_before_token=!0,J="NEWLINE"),A(b,s)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?J="SPACE":J="NEWLINE"),A(b,["else","catch","finally"]))if((!(this._flags.last_token.type===o.END_BLOCK&&this._previous_flags.mode===h.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&b.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var oe=this._output.current_line;oe.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else J==="NEWLINE"?A(this._flags.last_token,w)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&A(b,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==o.END_EXPR?(this._flags.last_token.type!==o.START_EXPR||!A(b,["var","let","const"]))&&this._flags.last_token.text!==":"&&(x(b,"if")&&x(b.previous,"else")?this._output.space_before_token=!0:this.print_newline()):A(b,s)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&T(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():J==="SPACE"&&(this._output.space_before_token=!0);b.previous&&(b.previous.type===o.WORD||b.previous.type===o.RESERVED)&&(this._output.space_before_token=!0),this.print_token(b),this._flags.last_word=b.text,b.type===o.RESERVED&&(b.text==="do"?this._flags.do_block=!0:b.text==="if"?this._flags.if_block=!0:b.text==="import"?this._flags.import_block=!0:this._flags.import_block&&x(b,"from")&&(this._flags.import_block=!1))},W.prototype.handle_semicolon=function(b){this.start_of_statement(b)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(b);for(var G=this._tokens.peek();this._flags.mode===h.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(b)},W.prototype.handle_string=function(b){b.text.startsWith("`")&&b.newlines===0&&b.whitespace_before===""&&(b.previous.text===")"||this._flags.last_token.type===o.WORD)||(this.start_of_statement(b)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(b),this._flags.last_token.type===o.RESERVED||this._flags.last_token.type===o.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR||this._flags.last_token.type===o.EQUALS||this._flags.last_token.type===o.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(b):b.text.startsWith("`")&&this._flags.last_token.type===o.END_EXPR&&(b.previous.text==="]"||b.previous.text===")")&&b.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(b)},W.prototype.handle_equals=function(b){this.start_of_statement(b)||this.handle_whitespace_and_comments(b),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(b),this._output.space_before_token=!0},W.prototype.handle_comma=function(b){this.handle_whitespace_and_comments(b,!0),this.print_token(b),this._output.space_before_token=!0,this._flags.declaration_statement?(j(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(b)):this._flags.mode===h.ObjectLiteral||this._flags.mode===h.Statement&&this._flags.parent.mode===h.ObjectLiteral?(this._flags.mode===h.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(b)},W.prototype.handle_operator=function(b){var G=b.text==="*"&&(A(this._flags.last_token,["function","yield"])||f(this._flags.last_token.type,[o.START_BLOCK,o.COMMA,o.END_BLOCK,o.SEMICOLON])),J=f(b.text,["-","+"])&&(f(this._flags.last_token.type,[o.START_BLOCK,o.START_EXPR,o.EQUALS,o.OPERATOR])||f(this._flags.last_token.text,s)||this._flags.last_token.text===",");if(!this.start_of_statement(b)){var oe=!G;this.handle_whitespace_and_comments(b,oe)}if(b.text==="*"&&this._flags.last_token.type===o.DOT){this.print_token(b);return}if(b.text==="::"){this.print_token(b);return}if(this._flags.last_token.type===o.OPERATOR&&f(this._options.operator_position,y)&&this.allow_wrap_or_preserved_newline(b),b.text===":"&&this._flags.in_case){this.print_token(b),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==o.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 fe=!0,Ne=!0,_e=!1;if(b.text===":"?this._flags.ternary_depth===0?fe=!1:(this._flags.ternary_depth-=1,_e=!0):b.text==="?"&&(this._flags.ternary_depth+=1),!J&&!G&&this._options.preserve_newlines&&f(b.text,a)){var Fe=b.text===":",We=Fe&&_e,Ue=Fe&&!_e;switch(this._options.operator_position){case S.before_newline:this._output.space_before_token=!Ue,this.print_token(b),(!Fe||We)&&this.allow_wrap_or_preserved_newline(b),this._output.space_before_token=!0;return;case S.after_newline:this._output.space_before_token=!0,!Fe||We?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(b):this._output.space_before_token=!1,this.print_token(b),this._output.space_before_token=!0;return;case S.preserve_newline:Ue||this.allow_wrap_or_preserved_newline(b),fe=!(this._output.just_added_newline()||Ue),this._output.space_before_token=fe,this.print_token(b),this._output.space_before_token=!0;return}}if(G){this.allow_wrap_or_preserved_newline(b),fe=!1;var xe=this._tokens.peek();Ne=xe&&f(xe.type,[o.WORD,o.RESERVED])}else if(b.text==="...")this.allow_wrap_or_preserved_newline(b),fe=this._flags.last_token.type===o.START_BLOCK,Ne=!1;else if(f(b.text,["--","++","!","~"])||J){if((this._flags.last_token.type===o.COMMA||this._flags.last_token.type===o.START_EXPR)&&this.allow_wrap_or_preserved_newline(b),fe=!1,Ne=!1,b.newlines&&(b.text==="--"||b.text==="++"||b.text==="~")){var ue=A(this._flags.last_token,w)&&b.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===";"&&j(this._flags.mode)&&(fe=!0),this._flags.last_token.type===o.RESERVED?fe=!0:this._flags.last_token.type===o.END_EXPR?fe=!(this._flags.last_token.text==="]"&&(b.text==="--"||b.text==="++")):this._flags.last_token.type===o.OPERATOR&&(fe=f(b.text,["--","-","++","+"])&&f(this._flags.last_token.text,["--","-","++","+"]),f(b.text,["+","-"])&&f(this._flags.last_token.text,["--","++"])&&(Ne=!0)),(this._flags.mode===h.BlockStatement&&!this._flags.inline_frame||this._flags.mode===h.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||fe,this.print_token(b),this._output.space_before_token=Ne},W.prototype.handle_block_comment=function(b,G){if(this._output.raw){this._output.add_raw_token(b),b.directives&&b.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(b.directives){this.print_newline(!1,G),this.print_token(b),b.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!l.newline.test(b.text)&&!b.newlines){this._output.space_before_token=!0,this.print_token(b),this._output.space_before_token=!0;return}else this.print_block_commment(b,G)},W.prototype.print_block_commment=function(b,G){var J=m(b.text),oe,fe=!1,Ne=!1,_e=b.whitespace_before,Fe=_e.length;if(this.print_newline(!1,G),this.print_token_line_indentation(b),this._output.add_token(J[0]),this.print_newline(!1,G),J.length>1){for(J=J.slice(1),fe=N(J,"*"),Ne=K(J,_e),fe&&(this._flags.alignment=1),oe=0;oe<J.length;oe++)fe?(this.print_token_line_indentation(b),this._output.add_token(L(J[oe]))):Ne&&J[oe]?(this.print_token_line_indentation(b),this._output.add_token(J[oe].substring(Fe))):(this._output.current_line.set_indent(-1),this._output.add_token(J[oe])),this.print_newline(!1,G);this._flags.alignment=0}},W.prototype.handle_comment=function(b,G){b.newlines?this.print_newline(!1,G):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(b),this.print_newline(!1,G)},W.prototype.handle_dot=function(b){this.start_of_statement(b)||this.handle_whitespace_and_comments(b,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),A(this._flags.last_token,w)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(b,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(b)},W.prototype.handle_unknown=function(b,G){this.print_token(b),b.text[b.text.length-1]===`
|
|
`&&this.print_newline(!1,G)},W.prototype.handle_eof=function(b){for(;this._flags.mode===h.Statement;)this.restore_mode();this.handle_whitespace_and_comments(b)},F.exports.Beautifier=W},function(F){function R(d){this.__parent=d,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=[]}R.prototype.clone_empty=function(){var d=new R(this.__parent);return d.set_indent(this.__indent_count,this.__alignment_count),d},R.prototype.item=function(d){return d<0?this.__items[this.__items.length+d]:this.__items[d]},R.prototype.has_match=function(d){for(var l=this.__items.length-1;l>=0;l--)if(this.__items[l].match(d))return!0;return!1},R.prototype.set_indent=function(d,l){this.is_empty()&&(this.__indent_count=d||0,this.__alignment_count=l||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 d=this.__parent.current_line;return d.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),d.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),d.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,d.__items[0]===" "&&(d.__items.splice(0,1),d.__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(d){this.__items.push(d);var l=d.lastIndexOf(`
|
|
`);l!==-1?this.__character_count=d.length-l:this.__character_count+=d.length},R.prototype.pop=function(){var d=null;return this.is_empty()||(d=this.__items.pop(),this.__character_count-=d.length),d},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 d="";return this.is_empty()?this.__parent.indent_empty_lines&&(d=this.__parent.get_indent_string(this.__indent_count)):(d=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),d+=this.__items.join("")),d};function g(d,l){this.__cache=[""],this.__indent_size=d.indent_size,this.__indent_string=d.indent_char,d.indent_with_tabs||(this.__indent_string=new Array(d.indent_size+1).join(d.indent_char)),l=l||"",d.indent_level>0&&(l=new Array(d.indent_level+1).join(this.__indent_string)),this.__base_string=l,this.__base_string_length=l.length}g.prototype.get_indent_size=function(d,l){var n=this.__base_string_length;return l=l||0,d<0&&(n=0),n+=d*this.__indent_size,n+=l,n},g.prototype.get_indent_string=function(d,l){var n=this.__base_string;return l=l||0,d<0&&(d=0,n=""),l+=d*this.__indent_size,this.__ensure_cache(l),n+=this.__cache[l],n},g.prototype.__ensure_cache=function(d){for(;d>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var d=this.__cache.length,l=0,n="";this.__indent_size&&d>=this.__indent_size&&(l=Math.floor(d/this.__indent_size),d-=l*this.__indent_size,n=new Array(l+1).join(this.__indent_string)),d&&(n+=new Array(d+1).join(" ")),this.__cache.push(n)};function p(d,l){this.__indent_cache=new g(d,l),this.raw=!1,this._end_with_newline=d.end_with_newline,this.indent_size=d.indent_size,this.wrap_line_length=d.wrap_line_length,this.indent_empty_lines=d.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(d,l){return this.__indent_cache.get_indent_string(d,l)},p.prototype.get_indent_size=function(d,l){return this.__indent_cache.get_indent_size(d,l)},p.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},p.prototype.add_new_line=function(d){return this.is_empty()||!d&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},p.prototype.get_code=function(d){this.trim(!0);var l=this.current_line.pop();l&&(l[l.length-1]===`
|
|
`&&(l=l.replace(/\n+$/g,"")),this.current_line.push(l)),this._end_with_newline&&this.__add_outputline();var n=this.__lines.join(`
|
|
`);return d!==`
|
|
`&&(n=n.replace(/[\n]/g,d)),n},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(d,l){return d=d||0,l=l||0,this.next_line.set_indent(d,l),this.__lines.length>1?(this.current_line.set_indent(d,l),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(d){for(var l=0;l<d.newlines;l++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(d.whitespace_before),this.current_line.push(d.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},p.prototype.add_token=function(d){this.__add_space_before_token(),this.current_line.push(d),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},p.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},p.prototype.remove_indent=function(d){for(var l=this.__lines.length;d<l;)this.__lines[d]._remove_indent(),d++;this.current_line._remove_wrap_indent()},p.prototype.trim=function(d){for(d=d===void 0?!1:d,this.current_line.trim();d&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(d,l){for(var n=this.__lines.length-2;n>=0;){var c=this.__lines[n];if(c.is_empty())break;if(c.item(0).indexOf(d)!==0&&c.item(-1)!==l){this.__lines.splice(n+1,0,new R(this)),this.previous_line=this.__lines[this.__lines.length-2];break}n--}},F.exports.Output=p},function(F){function R(g,p,d,l){this.type=g,this.text=p,this.comments_before=null,this.newlines=d||0,this.whitespace_before=l||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}F.exports.Token=R},function(F,R){var g="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",p="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",d="\\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",l="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",n="(?:\\\\u[0-9a-fA-F]{4}|["+g+d+"])",c="(?:\\\\u[0-9a-fA-F]{4}|["+p+d+l+"])*";R.identifier=new RegExp(n+c,"g"),R.identifierStart=new RegExp(n),R.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+p+d+l+"])+");var s=/[\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(F,R,g){var p=g(6).Options,d=["before-newline","after-newline","preserve-newline"];function l(n){p.call(this,n,"js");var c=this.raw_options.brace_style||null;c==="expand-strict"?this.raw_options.brace_style="expand":c==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var s=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var a=0;a<s.length;a++)s[a]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=s[a];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",d),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}l.prototype=new p,F.exports.Options=l},function(F){function R(d,l){this.raw_options=g(d,l),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}R.prototype._get_array=function(d,l){var n=this.raw_options[d],c=l||[];return typeof n=="object"?n!==null&&typeof n.concat=="function"&&(c=n.concat()):typeof n=="string"&&(c=n.split(/[^a-zA-Z0-9_\/\-]+/)),c},R.prototype._get_boolean=function(d,l){var n=this.raw_options[d],c=n===void 0?!!l:!!n;return c},R.prototype._get_characters=function(d,l){var n=this.raw_options[d],c=l||"";return typeof n=="string"&&(c=n.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),c},R.prototype._get_number=function(d,l){var n=this.raw_options[d];l=parseInt(l,10),isNaN(l)&&(l=0);var c=parseInt(n,10);return isNaN(c)&&(c=l),c},R.prototype._get_selection=function(d,l,n){var c=this._get_selection_list(d,l,n);if(c.length!==1)throw new Error("Invalid Option Value: The option '"+d+`' can only be one of the following values:
|
|
`+l+`
|
|
You passed in: '`+this.raw_options[d]+"'");return c[0]},R.prototype._get_selection_list=function(d,l,n){if(!l||l.length===0)throw new Error("Selection list cannot be empty.");if(n=n||[l[0]],!this._is_valid_selection(n,l))throw new Error("Invalid Default Value!");var c=this._get_array(d,n);if(!this._is_valid_selection(c,l))throw new Error("Invalid Option Value: The option '"+d+`' can contain only the following values:
|
|
`+l+`
|
|
You passed in: '`+this.raw_options[d]+"'");return c},R.prototype._is_valid_selection=function(d,l){return d.length&&l.length&&!d.some(function(n){return l.indexOf(n)===-1})};function g(d,l){var n={};d=p(d);var c;for(c in d)c!==l&&(n[c]=d[c]);if(l&&d[l])for(c in d[l])n[c]=d[l][c];return n}function p(d){var l={},n;for(n in d){var c=n.replace(/-/g,"_");l[c]=d[n]}return l}F.exports.Options=R,F.exports.normalizeOpts=p,F.exports.mergeOpts=g},function(F,R,g){var p=g(8).InputScanner,d=g(9).Tokenizer,l=g(9).TOKEN,n=g(13).Directives,c=g(4),s=g(12).Pattern,a=g(14).TemplatablePattern;function o(N,K){return K.indexOf(N)!==-1}var f={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:l.START,RAW:l.RAW,EOF:l.EOF},L=new n(/\/\*/,/\*\//),C=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,x=/[0-9]/,A=/[^\d\.]/,w=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),_=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";_=_.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),_="\\?\\.(?!\\d) "+_,_=_.replace(/ /g,"|");var S=new RegExp(_),y="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),h=y.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),E=new RegExp("^(?:"+h.join("|")+")$"),m,T=function(N,K){d.call(this,N,K),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var W=new s(this._input),k=new a(this._input).read_options(this._options);this.__patterns={template:k,identifier:k.starting_with(c.identifier).matching(c.identifierMatch),number:W.matching(C),punct:W.matching(S),comment:W.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:W.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:W.matching(/<!--/),html_comment_end:W.matching(/-->/),include:W.starting_with(/#include/).until_after(c.lineBreak),shebang:W.starting_with(/#!/).until_after(c.lineBreak),xml:W.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:k.until(/['\\\n\r\u2028\u2029]/),double_quote:k.until(/["\\\n\r\u2028\u2029]/),template_text:k.until(/[`\\$]/),template_expression:k.until(/[`}\\]/)}};T.prototype=new d,T.prototype._is_comment=function(N){return N.type===f.COMMENT||N.type===f.BLOCK_COMMENT||N.type===f.UNKNOWN},T.prototype._is_opening=function(N){return N.type===f.START_BLOCK||N.type===f.START_EXPR},T.prototype._is_closing=function(N,K){return(N.type===f.END_BLOCK||N.type===f.END_EXPR)&&K&&(N.text==="]"&&K.text==="["||N.text===")"&&K.text==="("||N.text==="}"&&K.text==="{")},T.prototype._reset=function(){m=!1},T.prototype._get_next_token=function(N,K){var W=null;this._readWhitespace();var k=this._input.peek();return k===null?this._create_token(f.EOF,""):(W=W||this._read_non_javascript(k),W=W||this._read_string(k),W=W||this._read_word(N),W=W||this._read_singles(k),W=W||this._read_comment(k),W=W||this._read_regexp(k,N),W=W||this._read_xml(k,N),W=W||this._read_punctuation(),W=W||this._create_token(f.UNKNOWN,this._input.next()),W)},T.prototype._read_word=function(N){var K;if(K=this.__patterns.identifier.read(),K!=="")return K=K.replace(c.allLineBreaks,`
|
|
`),!(N.type===f.DOT||N.type===f.RESERVED&&(N.text==="set"||N.text==="get"))&&E.test(K)?(K==="in"||K==="of")&&(N.type===f.WORD||N.type===f.STRING)?this._create_token(f.OPERATOR,K):this._create_token(f.RESERVED,K):this._create_token(f.WORD,K);if(K=this.__patterns.number.read(),K!=="")return this._create_token(f.WORD,K)},T.prototype._read_singles=function(N){var K=null;return N==="("||N==="["?K=this._create_token(f.START_EXPR,N):N===")"||N==="]"?K=this._create_token(f.END_EXPR,N):N==="{"?K=this._create_token(f.START_BLOCK,N):N==="}"?K=this._create_token(f.END_BLOCK,N):N===";"?K=this._create_token(f.SEMICOLON,N):N==="."&&A.test(this._input.peek(1))?K=this._create_token(f.DOT,N):N===","&&(K=this._create_token(f.COMMA,N)),K&&this._input.next(),K},T.prototype._read_punctuation=function(){var N=this.__patterns.punct.read();if(N!=="")return N==="="?this._create_token(f.EQUALS,N):N==="?."?this._create_token(f.DOT,N):this._create_token(f.OPERATOR,N)},T.prototype._read_non_javascript=function(N){var K="";if(N==="#"){if(this._is_first_token()&&(K=this.__patterns.shebang.read(),K))return this._create_token(f.UNKNOWN,K.trim()+`
|
|
`);if(K=this.__patterns.include.read(),K)return this._create_token(f.UNKNOWN,K.trim()+`
|
|
`);N=this._input.next();var W="#";if(this._input.hasNext()&&this._input.testChar(x)){do N=this._input.next(),W+=N;while(this._input.hasNext()&&N!=="#"&&N!=="=");return N==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(W+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(W+="{}",this._input.next(),this._input.next())),this._create_token(f.WORD,W)}this._input.back()}else if(N==="<"&&this._is_first_token()){if(K=this.__patterns.html_comment_start.read(),K){for(;this._input.hasNext()&&!this._input.testChar(c.newline);)K+=this._input.next();return m=!0,this._create_token(f.COMMENT,K)}}else if(m&&N==="-"&&(K=this.__patterns.html_comment_end.read(),K))return m=!1,this._create_token(f.COMMENT,K);return null},T.prototype._read_comment=function(N){var K=null;if(N==="/"){var W="";if(this._input.peek(1)==="*"){W=this.__patterns.block_comment.read();var k=L.get_directives(W);k&&k.ignore==="start"&&(W+=L.readIgnored(this._input)),W=W.replace(c.allLineBreaks,`
|
|
`),K=this._create_token(f.BLOCK_COMMENT,W),K.directives=k}else this._input.peek(1)==="/"&&(W=this.__patterns.comment.read(),K=this._create_token(f.COMMENT,W))}return K},T.prototype._read_string=function(N){if(N==="`"||N==="'"||N==='"'){var K=this._input.next();return this.has_char_escapes=!1,N==="`"?K+=this._read_string_recursive("`",!0,"${"):K+=this._read_string_recursive(N),this.has_char_escapes&&this._options.unescape_strings&&(K=j(K)),this._input.peek()===N&&(K+=this._input.next()),K=K.replace(c.allLineBreaks,`
|
|
`),this._create_token(f.STRING,K)}return null},T.prototype._allow_regexp_or_xml=function(N){return N.type===f.RESERVED&&o(N.text,["return","case","throw","else","do","typeof","yield"])||N.type===f.END_EXPR&&N.text===")"&&N.opened.previous.type===f.RESERVED&&o(N.opened.previous.text,["if","while","for"])||o(N.type,[f.COMMENT,f.START_EXPR,f.START_BLOCK,f.START,f.END_BLOCK,f.OPERATOR,f.EQUALS,f.EOF,f.SEMICOLON,f.COMMA])},T.prototype._read_regexp=function(N,K){if(N==="/"&&this._allow_regexp_or_xml(K)){for(var W=this._input.next(),k=!1,b=!1;this._input.hasNext()&&(k||b||this._input.peek()!==N)&&!this._input.testChar(c.newline);)W+=this._input.peek(),k?k=!1:(k=this._input.peek()==="\\",this._input.peek()==="["?b=!0:this._input.peek()==="]"&&(b=!1)),this._input.next();return this._input.peek()===N&&(W+=this._input.next(),W+=this._input.read(c.identifier)),this._create_token(f.STRING,W)}return null},T.prototype._read_xml=function(N,K){if(this._options.e4x&&N==="<"&&this._allow_regexp_or_xml(K)){var W="",k=this.__patterns.xml.read_match();if(k){for(var b=k[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),G=b.indexOf("{")===0,J=0;k;){var oe=!!k[1],fe=k[2],Ne=!!k[k.length-1]||fe.slice(0,8)==="![CDATA[";if(!Ne&&(fe===b||G&&fe.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(oe?--J:++J),W+=k[0],J<=0)break;k=this.__patterns.xml.read_match()}return k||(W+=this._input.match(/[\s\S]*/g)[0]),W=W.replace(c.allLineBreaks,`
|
|
`),this._create_token(f.STRING,W)}}return null};function j(N){for(var K="",W=0,k=new p(N),b=null;k.hasNext();)if(b=k.match(/([\s]|[^\\]|\\\\)+/g),b&&(K+=b[0]),k.peek()==="\\"){if(k.next(),k.peek()==="x")b=k.match(/x([0-9A-Fa-f]{2})/g);else if(k.peek()==="u")b=k.match(/u([0-9A-Fa-f]{4})/g);else{K+="\\",k.hasNext()&&(K+=k.next());continue}if(!b)return N;if(W=parseInt(b[1],16),W>126&&W<=255&&b[0].indexOf("x")===0)return N;if(W>=0&&W<32){K+="\\"+b[0];continue}else W===34||W===39||W===92?K+="\\"+String.fromCharCode(W):K+=String.fromCharCode(W)}return K}T.prototype._read_string_recursive=function(N,K,W){var k,b;N==="'"?b=this.__patterns.single_quote:N==='"'?b=this.__patterns.double_quote:N==="`"?b=this.__patterns.template_text:N==="}"&&(b=this.__patterns.template_expression);for(var G=b.read(),J="";this._input.hasNext();){if(J=this._input.next(),J===N||!K&&c.newline.test(J)){this._input.back();break}else J==="\\"&&this._input.hasNext()?(k=this._input.peek(),k==="x"||k==="u"?this.has_char_escapes=!0:k==="\r"&&this._input.peek(1)===`
|
|
`&&this._input.next(),J+=this._input.next()):W&&(W==="${"&&J==="$"&&this._input.peek()==="{"&&(J+=this._input.next()),W===J&&(N==="`"?J+=this._read_string_recursive("}",K,"`"):J+=this._read_string_recursive("`",K,"${"),this._input.hasNext()&&(J+=this._input.next())));J+=b.read(),G+=J}return G},F.exports.Tokenizer=T,F.exports.TOKEN=f,F.exports.positionable_operators=w.slice(),F.exports.line_starters=y.slice()},function(F){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<this.__input_length},g.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__input.charAt(this.__position),this.__position+=1),p},g.prototype.peek=function(p){var d=null;return p=p||0,p+=this.__position,p>=0&&p<this.__input_length&&(d=this.__input.charAt(p)),d},g.prototype.__match=function(p,d){p.lastIndex=d;var l=p.exec(this.__input);return l&&!(R&&p.sticky)&&(l.index!==d&&(l=null)),l},g.prototype.test=function(p,d){return d=d||0,d+=this.__position,d>=0&&d<this.__input_length?!!this.__match(p,d):!1},g.prototype.testChar=function(p,d){var l=this.peek(d);return p.lastIndex=0,l!==null&&p.test(l)},g.prototype.match=function(p){var d=this.__match(p,this.__position);return d?this.__position+=d[0].length:d=null,d},g.prototype.read=function(p,d,l){var n="",c;return p&&(c=this.match(p),c&&(n+=c[0])),d&&(c||!p)&&(n+=this.readUntil(d,l)),n},g.prototype.readUntil=function(p,d){var l="",n=this.__position;p.lastIndex=this.__position;var c=p.exec(this.__input);return c?(n=c.index,d&&(n+=c[0].length)):n=this.__input_length,l=this.__input.substring(this.__position,n),this.__position=n,l},g.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},g.prototype.get_regexp=function(p,d){var l=null,n="g";return d&&R&&(n="y"),typeof p=="string"&&p!==""?l=new RegExp(p,n):p&&(l=new RegExp(p.source,n)),l},g.prototype.get_literal_regexp=function(p){return RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(p){var d=this.__position,l=this.readUntilAfter(p);return this.__position=d,l},g.prototype.lookBack=function(p){var d=this.__position-1;return d>=p.length&&this.__input.substring(d-p.length,d).toLowerCase()===p},F.exports.InputScanner=g},function(F,R,g){var p=g(8).InputScanner,d=g(3).Token,l=g(10).TokenStream,n=g(11).WhitespacePattern,c={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},s=function(a,o){this._input=new p(a),this._options=o||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new n(this._input)};s.prototype.tokenize=function(){this._input.restart(),this.__tokens=new l,this._reset();for(var a,o=new d(c.START,""),f=null,L=[],C=new l;o.type!==c.EOF;){for(a=this._get_next_token(o,f);this._is_comment(a);)C.add(a),a=this._get_next_token(o,f);C.isEmpty()||(a.comments_before=C,C=new l),a.parent=f,this._is_opening(a)?(L.push(f),f=a):f&&this._is_closing(a,f)&&(a.opened=f,f.closed=a,f=L.pop(),a.parent=f),a.previous=o,o.next=a,this.__tokens.add(a),o=a}return this.__tokens},s.prototype._is_first_token=function(){return this.__tokens.isEmpty()},s.prototype._reset=function(){},s.prototype._get_next_token=function(a,o){this._readWhitespace();var f=this._input.read(/.+/g);return f?this._create_token(c.RAW,f):this._create_token(c.EOF,"")},s.prototype._is_comment=function(a){return!1},s.prototype._is_opening=function(a){return!1},s.prototype._is_closing=function(a,o){return!1},s.prototype._create_token=function(a,o){var f=new d(a,o,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return f},s.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},F.exports.Tokenizer=s,F.exports.TOKEN=c},function(F){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<this.__tokens_length},R.prototype.next=function(){var g=null;return this.hasNext()&&(g=this.__tokens[this.__position],this.__position+=1),g},R.prototype.peek=function(g){var p=null;return g=g||0,g+=this.__position,g>=0&&g<this.__tokens_length&&(p=this.__tokens[g]),p},R.prototype.add=function(g){this.__parent_token&&(g.parent=this.__parent_token),this.__tokens.push(g),this.__tokens_length+=1},F.exports.TokenStream=R},function(F,R,g){var p=g(12).Pattern;function d(l,n){p.call(this,l,n),n?this._line_regexp=this._input.get_regexp(n._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}d.prototype=new p,d.prototype.__set_whitespace_patterns=function(l,n){l+="\\t ",n+="\\n\\r",this._match_pattern=this._input.get_regexp("["+l+n+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+n+"]")},d.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var l=this._input.read(this._match_pattern);if(l===" ")this.whitespace_before_token=" ";else if(l){var n=this.__split(this._newline_regexp,l);this.newline_count=n.length-1,this.whitespace_before_token=n[this.newline_count]}return l},d.prototype.matching=function(l,n){var c=this._create();return c.__set_whitespace_patterns(l,n),c._update(),c},d.prototype._create=function(){return new d(this._input,this)},d.prototype.__split=function(l,n){l.lastIndex=0;for(var c=0,s=[],a=l.exec(n);a;)s.push(n.substring(c,a.index)),c=a.index+a[0].length,a=l.exec(n);return c<n.length?s.push(n.substring(c,n.length)):s.push(""),s},F.exports.WhitespacePattern=d},function(F){function R(g,p){this._input=g,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,p&&(this._starting_pattern=this._input.get_regexp(p._starting_pattern,!0),this._match_pattern=this._input.get_regexp(p._match_pattern,!0),this._until_pattern=this._input.get_regexp(p._until_pattern),this._until_after=p._until_after)}R.prototype.read=function(){var g=this._input.read(this._starting_pattern);return(!this._starting_pattern||g)&&(g+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),g},R.prototype.read_match=function(){return this._input.match(this._match_pattern)},R.prototype.until_after=function(g){var p=this._create();return p._until_after=!0,p._until_pattern=this._input.get_regexp(g),p._update(),p},R.prototype.until=function(g){var p=this._create();return p._until_after=!1,p._until_pattern=this._input.get_regexp(g),p._update(),p},R.prototype.starting_with=function(g){var p=this._create();return p._starting_pattern=this._input.get_regexp(g,!0),p._update(),p},R.prototype.matching=function(g){var p=this._create();return p._match_pattern=this._input.get_regexp(g,!0),p._update(),p},R.prototype._create=function(){return new R(this._input,this)},R.prototype._update=function(){},F.exports.Pattern=R},function(F){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 d=this.__directive_pattern.exec(g);d;)p[d[1]]=d[2],d=this.__directive_pattern.exec(g);return p},R.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},F.exports.Directives=R},function(F,R,g){var p=g(12).Pattern,d={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function l(n,c){p.call(this,n,c),this.__template_pattern=null,this._disabled=Object.assign({},d),this._excluded=Object.assign({},d),c&&(this.__template_pattern=this._input.get_regexp(c.__template_pattern),this._excluded=Object.assign(this._excluded,c._excluded),this._disabled=Object.assign(this._disabled,c._disabled));var s=new p(n);this.__patterns={handlebars_comment:s.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:s.starting_with(/{{{/).until_after(/}}}/),handlebars:s.starting_with(/{{/).until_after(/}}/),php:s.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:s.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:s.starting_with(/{%/).until_after(/%}/),django_value:s.starting_with(/{{/).until_after(/}}/),django_comment:s.starting_with(/{#/).until_after(/#}/),smarty:s.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:s.starting_with(/{\*/).until_after(/\*}/),smarty_literal:s.starting_with(/{literal}/).until_after(/{\/literal}/)}}l.prototype=new p,l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){this.__set_templated_pattern()},l.prototype.disable=function(n){var c=this._create();return c._disabled[n]=!0,c._update(),c},l.prototype.read_options=function(n){var c=this._create();for(var s in d)c._disabled[s]=n.templating.indexOf(s)===-1;return c._update(),c},l.prototype.exclude=function(n){var c=this._create();return c._excluded[n]=!0,c._update(),c},l.prototype.read=function(){var n="";this._match_pattern?n=this._input.read(this._starting_pattern):n=this._input.read(this._starting_pattern,this.__template_pattern);for(var c=this._read_template();c;)this._match_pattern?c+=this._input.read(this._match_pattern):c+=this._input.readUntil(this.__template_pattern),n+=c,c=this._read_template();return this._until_after&&(n+=this._input.readUntilAfter(this._until_pattern)),n},l.prototype.__set_templated_pattern=function(){var n=[];this._disabled.php||n.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||n.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||n.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(n.push(this.__patterns.django._starting_pattern.source),n.push(this.__patterns.django_value._starting_pattern.source),n.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||n.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&n.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+n.join("|")+")")},l.prototype._read_template=function(){var n="",c=this._input.peek();if(c==="<"){var s=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&s==="?"&&(n=n||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&s==="%"&&(n=n||this.__patterns.erb.read())}else c==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(n=n||this.__patterns.handlebars_comment.read(),n=n||this.__patterns.handlebars_unescaped.read(),n=n||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(n=n||this.__patterns.django_value.read()),this._excluded.django||(n=n||this.__patterns.django_comment.read(),n=n||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(n=n||this.__patterns.smarty_comment.read(),n=n||this.__patterns.smarty_literal.read(),n=n||this.__patterns.smarty.read()));return n},F.exports.TemplatablePattern=l}],U={};function H(F){var R=U[F];if(R!==void 0)return R.exports;var g=U[F]={exports:{}};return D[F](g,g.exports,H),g.exports}var I=H(0);P=I})();var Y=P;!(le=[],Q=function(){return{js_beautify:Y}}.apply(_t,le),Q!==void 0&&(Mt.exports=Q))})()},"7Cbv":function(Mt,_t,q){"use strict";var le=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Q=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(Q)}var Y=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function D(d){return typeof d=="string"&&Y.test(d)}for(var U=D,H=[],I=0;I<256;++I)H.push((I+256).toString(16).substr(1));function F(d){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(H[d[l+0]]+H[d[l+1]]+H[d[l+2]]+H[d[l+3]]+"-"+H[d[l+4]]+H[d[l+5]]+"-"+H[d[l+6]]+H[d[l+7]]+"-"+H[d[l+8]]+H[d[l+9]]+"-"+H[d[l+10]]+H[d[l+11]]+H[d[l+12]]+H[d[l+13]]+H[d[l+14]]+H[d[l+15]]).toLowerCase();if(!U(n))throw TypeError("Stringified UUID is invalid");return n}var R=F;function g(d,l,n){d=d||{};var c=d.random||(d.rng||P)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,l){n=n||0;for(var s=0;s<16;++s)l[n+s]=c[s];return l}return R(c)}var p=_t.a=g},"7ahc":function(Mt,_t,q){"use strict";q.d(_t,"a",function(){return L});var le=q("k1fw"),Q=q("0Owb"),P=q("+L6B"),Y=q("2/Rp"),D=q("y8nQ"),U=q("Vl3Y"),H=q("tJVT"),I=q("OaEy"),F=q("2fM7"),R=q("q1tI"),g=q.n(R),p=q("VrN/"),d=q.n(p),l=q("p77/"),n=q.n(l),c=q("c5Ni"),s=q.n(c),a=F.a.Option,o={labelCol:{span:4},wrapperCol:{span:20}},f={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};_t.b=function(C){var x=C.callback,A=C.onCancel,w=Object(R.useState)("python"),_=Object(H.a)(w,2),S=_[0],y=_[1];function h(m){y(f[m][1])}function E(m){x(m)}return g.a.createElement(U.a,Object(Q.a)({},o,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:E}),g.a.createElement(U.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},g.a.createElement(F.a,{onChange:h},Object.keys(f).map(function(m){return g.a.createElement(a,{key:m,value:m},f[m][0])}))),g.a.createElement(U.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:S})),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(Y.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(Y.a,{type:"ghost",onClick:A},"\u53D6\u6D88")))};function L(C){var x=C.value,A=C.onChange,w=C.mode,_=C.options,S=_===void 0?{}:_,y=Object(R.useRef)(),h=Object(R.useState)(),E=Object(H.a)(h,2),m=E[0],T=E[1];return Object(R.useEffect)(function(){if(m){function j(N){var K=N.getValue();A&&A(K)}return m.on("change",j),function(){m.off("change",j)}}},[m,A]),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(y.current&&!m){var j=d.a.fromTextArea(y.current,Object(le.a)({mode:w,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},S));T(j)}},[y.current,m]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:y}))}},"7ixt":function(Mt,_t,q){"use strict";q.d(_t,"a",function(){return P});var le={adjustX:1,adjustY:1},Q=[0,0],P={left:{points:["cr","cl"],overflow:le,offset:[-4,0],targetOffset:Q},right:{points:["cl","cr"],overflow:le,offset:[4,0],targetOffset:Q},top:{points:["bc","tc"],overflow:le,offset:[0,-4],targetOffset:Q},bottom:{points:["tc","bc"],overflow:le,offset:[0,4],targetOffset:Q},topLeft:{points:["bl","tl"],overflow:le,offset:[0,-4],targetOffset:Q},leftTop:{points:["tr","tl"],overflow:le,offset:[-4,0],targetOffset:Q},topRight:{points:["br","tr"],overflow:le,offset:[0,-4],targetOffset:Q},rightTop:{points:["tl","tr"],overflow:le,offset:[4,0],targetOffset:Q},bottomRight:{points:["tr","br"],overflow:le,offset:[0,4],targetOffset:Q},rightBottom:{points:["bl","br"],overflow:le,offset:[4,0],targetOffset:Q},bottomLeft:{points:["tl","bl"],overflow:le,offset:[0,4],targetOffset:Q},leftBottom:{points:["br","bl"],overflow:le,offset:[-4,0],targetOffset:Q}},Y=P},"8EBN":function(Mt,_t,q){(function(le){le(q("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 Q=0;Q<le.modeInfo.length;Q++){var P=le.modeInfo[Q];P.mimes&&(P.mime=P.mimes[0])}le.findModeByMIME=function(Y){Y=Y.toLowerCase();for(var D=0;D<le.modeInfo.length;D++){var U=le.modeInfo[D];if(U.mime==Y)return U;if(U.mimes){for(var H=0;H<U.mimes.length;H++)if(U.mimes[H]==Y)return U}}if(/\+xml$/.test(Y))return le.findModeByMIME("application/xml");if(/\+json$/.test(Y))return le.findModeByMIME("application/json")},le.findModeByExtension=function(Y){Y=Y.toLowerCase();for(var D=0;D<le.modeInfo.length;D++){var U=le.modeInfo[D];if(U.ext){for(var H=0;H<U.ext.length;H++)if(U.ext[H]==Y)return U}}},le.findModeByFileName=function(Y){for(var D=0;D<le.modeInfo.length;D++){var U=le.modeInfo[D];if(U.file&&U.file.test(Y))return U}var H=Y.lastIndexOf("."),I=H>-1&&Y.substring(H+1,Y.length);if(I)return le.findModeByExtension(I)},le.findModeByName=function(Y){Y=Y.toLowerCase();for(var D=0;D<le.modeInfo.length;D++){var U=le.modeInfo[D];if(U.name.toLowerCase()==Y)return U;if(U.alias){for(var H=0;H<U.alias.length;H++)if(U.alias[H].toLowerCase()==Y)return U}}}})},"8hTe":function(Mt,_t,q){Mt.exports={button:"button___1wy9m"}},"9Bee":function(Mt,_t,q){"use strict";var le=q("DYRE"),Q=q("zeV3"),P=q("+L6B"),Y=q("2/Rp"),D=q("k1fw"),U=q("9og8"),H=q("tJVT"),I=q("WmNS"),F=q.n(I),R=q("q1tI"),g=q.n(R),p=q("vg9a"),d=q("DlQD"),l=q.n(d),n=q("rUJ1");function c(X,v){var O=X.match(/^(\s+)(?:```)/);if(O===null)return v;var B=O[1];return v.split(`
|
|
`).map(function(te){var z=te.match(/^\s+/);if(z===null)return te;var be=Object(H.a)(z,1),tt=be[0];return tt.length>=B.length?te.slice(B.length):te}).join(`
|
|
`)}var s=[],a=["<ul>"],o=new l.a.Renderer,f=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function L(){s.length=0,a=["<ul>"]}var C={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function x(X,v,O,B){if(v>=X.length||X[v].level<=O)return v;var te=X[v];B.push("<li><a href='#"+te.anchor+"'>"+te.text+"</a>"),v++;var z=[];return v=x(X,v,te.level,z),z.length>0&&(B.push("<ul>"),z.forEach(function(be){B.push(be)}),B.push("</ul>")),B.push("</li>"),v=x(X,v,O,B),v}function A(){return x(s,0,0,a),a.push("</ul>"),a.join("")}var w={heading:function(v){var O=f.exec(v);if(O)return{type:"heading",raw:O[0],depth:O[1].length,text:O[2]}},fences:function(v){var O=this.rules.block.fences.exec(v);if(O){var B=O[0],te=c(B,O[3]||""),z=O[2]?O[2].trim():O[2];if(["latex","katex","math"].indexOf(z)>=0){var be=y(),tt=te;te=be,h[be]={type:"block",expression:tt}}return{type:"code",raw:B,lang:z,text:te}}}},_=/(?:\${2})([^\n`]+?)(?:\${2})/gi,S=0,y=function(){return"__special_katext_id_".concat(S++,"__")},h={};function E(){return h}function m(){S=0,h={}}function T(X){return X=X.replace(_,function(v,O){var B=y();return h[B]={type:"inline",expression:O},B}),X}var j=o.listitem;o.listitem=function(X){return j(T(X))};var N=o.paragraph;o.paragraph=function(X){return N(T(X))};var K=o.tablecell;o.tablecell=function(X,v){return K(T(X),v)},o.code=function(X,v,O){var B=(v||"").match(/\S*/)[0];return B?["latex","katex","math"].indexOf(B)>=0?"<p class='editormd-tex'>".concat(X,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(v,'">').concat(O?X:Object(n.escape)(X,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(O?X:Object(n.escape)(X,!0))+"</code></pre>"},o.heading=function(X,v,O){var B=this.options.headerPrefix+O.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return s.push({anchor:B,level:v,text:X}),"<h"+v+' id="'+B+'">'+X+"</h"+v+">"},l.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),l.a.use({tokenizer:w,renderer:o});var W=l.a,k=q("SJMd"),b=q("ulZh"),G=q.n(b),J=q("m3rI"),oe=q("Oy/b"),fe=q("p5ED"),Ne=q("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 _e=function(X,v){return(_e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(O,B){O.__proto__=B}||function(O,B){for(var te in B)Object.prototype.hasOwnProperty.call(B,te)&&(O[te]=B[te])})(X,v)};function Fe(X,v){function O(){this.constructor=X}_e(X,v),X.prototype=v===null?Object.create(v):(O.prototype=v.prototype,new O)}function We(X,v,O,B){return new(O||(O=Promise))(function(te,z){function be(Ct){try{Ot(B.next(Ct))}catch(at){z(at)}}function tt(Ct){try{Ot(B.throw(Ct))}catch(at){z(at)}}function Ot(Ct){var at;Ct.done?te(Ct.value):(at=Ct.value,at instanceof O?at:new O(function(Yt){Yt(at)})).then(be,tt)}Ot((B=B.apply(X,v||[])).next())})}function Ue(X,v){var O,B,te,z,be={label:0,sent:function(){if(1&te[0])throw te[1];return te[1]},trys:[],ops:[]};return z={next:tt(0),throw:tt(1),return:tt(2)},typeof Symbol=="function"&&(z[Symbol.iterator]=function(){return this}),z;function tt(Ot){return function(Ct){return function(at){if(O)throw new TypeError("Generator is already executing.");for(;be;)try{if(O=1,B&&(te=2&at[0]?B.return:at[0]?B.throw||((te=B.return)&&te.call(B),0):B.next)&&!(te=te.call(B,at[1])).done)return te;switch(B=0,te&&(at=[2&at[0],te.value]),at[0]){case 0:case 1:te=at;break;case 4:return be.label++,{value:at[1],done:!1};case 5:be.label++,B=at[1],at=[0];continue;case 7:at=be.ops.pop(),be.trys.pop();continue;default:if(!(te=be.trys,(te=te.length>0&&te[te.length-1])||at[0]!==6&&at[0]!==2)){be=0;continue}if(at[0]===3&&(!te||at[1]>te[0]&&at[1]<te[3])){be.label=at[1];break}if(at[0]===6&&be.label<te[1]){be.label=te[1],te=at;break}if(te&&be.label<te[2]){be.label=te[2],be.ops.push(at);break}te[2]&&be.ops.pop(),be.trys.pop();continue}at=v.call(X,be)}catch(Yt){at=[6,Yt],B=0}finally{O=te=0}if(5&at[0])throw at[1];return{value:at[0]?at[1]:void 0,done:!0}}([Ot,Ct])}}}function xe(){for(var X=0,v=0,O=arguments.length;v<O;v++)X+=arguments[v].length;var B=Array(X),te=0;for(v=0;v<O;v++)for(var z=arguments[v],be=0,tt=z.length;be<tt;be++,te++)B[te]=z[be];return B}var ue=function(){function X(){}return X.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},X.setAttributes=function(v,O){for(var B=0,te=O;B<te.length;B++){var z=te[B],be=z[0],tt=z[1];v.setAttribute(be,tt)}},X.createRect=function(v,O,B){var te=document.createElementNS("http://www.w3.org/2000/svg","rect");return te.setAttribute("width",v.toString()),te.setAttribute("height",O.toString()),B&&X.setAttributes(te,B),te},X.createLine=function(v,O,B,te,z){var be=document.createElementNS("http://www.w3.org/2000/svg","line");return be.setAttribute("x1",v.toString()),be.setAttribute("y1",O.toString()),be.setAttribute("x2",B.toString()),be.setAttribute("y2",te.toString()),z&&X.setAttributes(be,z),be},X.createPolygon=function(v,O){var B=document.createElementNS("http://www.w3.org/2000/svg","polygon");return B.setAttribute("points",v),O&&X.setAttributes(B,O),B},X.createCircle=function(v,O){var B=document.createElementNS("http://www.w3.org/2000/svg","circle");return B.setAttribute("cx",(v/2).toString()),B.setAttribute("cy",(v/2).toString()),B.setAttribute("r",v.toString()),O&&X.setAttributes(B,O),B},X.createEllipse=function(v,O,B){var te=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return te.setAttribute("cx",(v/2).toString()),te.setAttribute("cy",(O/2).toString()),te.setAttribute("rx",(v/2).toString()),te.setAttribute("ry",(O/2).toString()),B&&X.setAttributes(te,B),te},X.createGroup=function(v){var O=document.createElementNS("http://www.w3.org/2000/svg","g");return v&&X.setAttributes(O,v),O},X.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},X.createMarker=function(v,O,B,te,z,be,tt){var Ot=document.createElementNS("http://www.w3.org/2000/svg","marker");return X.setAttributes(Ot,[["id",v],["orient",O],["markerWidth",B.toString()],["markerHeight",te.toString()],["refX",z.toString()],["refY",be.toString()]]),Ot.appendChild(tt),Ot},X.createText=function(v){var O=document.createElementNS("http://www.w3.org/2000/svg","text");return O.setAttribute("x","0"),O.setAttribute("y","0"),v&&X.setAttributes(O,v),O},X.createTSpan=function(v,O){var B=document.createElementNS("http://www.w3.org/2000/svg","tspan");return B.textContent=v,O&&X.setAttributes(B,O),B},X.createImage=function(v){var O=document.createElementNS("http://www.w3.org/2000/svg","image");return v&&X.setAttributes(O,v),O},X.createPoint=function(v,O){var B=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return B.x=v,B.y=O,B},X.createPath=function(v,O){var B=document.createElementNS("http://www.w3.org/2000/svg","path");return B.setAttribute("d",v),O&&X.setAttributes(B,O),B},X}(),ae=function(){function X(){}return X.addKey=function(v){X.key=v},Object.defineProperty(X,"isLicensed",{get:function(){return!!X.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(X.key)},enumerable:!1,configurable:!0}),X}(),Ee=function(){function X(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return X.prototype.rasterize=function(v,O,B){var te=this;return new Promise(function(z){var be=B!==void 0?B:document.createElement("canvas");v===null&&(te.markersOnly=!0,te.naturalSize=!1);var tt=document.createElementNS("http://www.w3.org/2000/svg","svg");tt.setAttribute("xmlns","http://www.w3.org/2000/svg"),tt.setAttribute("width",O.width.baseVal.valueAsString),tt.setAttribute("height",O.height.baseVal.valueAsString),tt.setAttribute("viewBox","0 0 "+O.viewBox.baseVal.width.toString()+" "+O.viewBox.baseVal.height.toString()),tt.innerHTML=O.innerHTML,te.naturalSize===!0?(tt.width.baseVal.value=v.naturalWidth,tt.height.baseVal.value=v.naturalHeight):te.width!==void 0&&te.height!==void 0&&(tt.width.baseVal.value=te.width,tt.height.baseVal.value=te.height),be.width=tt.width.baseVal.value,be.height=tt.height.baseVal.value;var Ot=tt.outerHTML,Ct=be.getContext("2d");te.markersOnly!==!0&&Ct.drawImage(v,0,0,be.width,be.height);var at=window.URL,Yt=new Image(be.width,be.height);Yt.setAttribute("crossOrigin","anonymous");var Cn=new Blob([Ot],{type:"image/svg+xml"}),Nn=at.createObjectURL(Cn);Yt.onload=function(){Ct.drawImage(Yt,0,0),at.revokeObjectURL(Nn);var Hi=be.toDataURL(te.imageType,te.imageQuality);z(Hi)},Yt.src=Nn})},X}(),de=function(){},Ke=function(){function X(v){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+v+"_"}return Object.defineProperty(X.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),X.prototype.addClass=function(v){return this.styleSheet===void 0&&this.addStyleSheet(),v.name=""+this.classNamePrefix+v.localName,this.classes.push(v),this.styleSheet.sheet.insertRule("."+v.name+" {"+v.style+"}",this.styleSheet.sheet.cssRules.length),v},X.prototype.addRule=function(v){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(v),this.styleSheet.sheet.insertRule(v.selector+" {"+v.style+"}",this.styleSheet.sheet.cssRules.length)},X.prototype.addStyleSheet=function(){var v;this.styleSheet=document.createElement("style"),((v=this.styleSheetRoot)!==null&&v!==void 0?v:document.head).appendChild(this.styleSheet),this.addRule(new Je("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Je("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new Je("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new je("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new je("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},X.prototype.removeStyleSheet=function(){var v;this.styleSheet&&(((v=this.styleSheetRoot)!==null&&v!==void 0?v:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},X}(),Je=function(X,v){this.selector=X,this.style=v},je=function(X,v){this.localName=X,this.style=v},Qe=function(){function X(v,O,B,te,z){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=v,this.displayMode=O,this.markerItems=B,this.uiStyleSettings=te,this.styles=z,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return X.prototype.show=function(v){var O=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=v,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var B=document.createElement("div");B.className=this.toolbarBlockStyleClass.name,B.style.whiteSpace="nowrap",this.uiContainer.appendChild(B),this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(B,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(z){var be=document.createElement("div");be.className=""+O.toolbarButtonStyleClass.name,be.setAttribute("data-type-name",z.typeName),be.innerHTML=z.icon,be.addEventListener("click",function(){O.markerToolbarButtonClicked(be,z)}),O.buttons.push(be),O.markerButtons.push(be)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var te=document.createElement("div");te.className=this.toolbarBlockStyleClass.name,te.style.whiteSpace="nowrap",te.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(te),this.addActionButton(te,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(te,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},X.prototype.addButtonClickListener=function(v){this.buttonClickListeners.push(v)},X.prototype.removeButtonClickListener=function(v){this.buttonClickListeners.indexOf(v)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(v),1)},X.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},X.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var v=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var O=0;O<this.markerButtons.length;O++)O<v||O===v&&this.markerButtons.length-1===v?this.markerButtonBlock.appendChild(this.markerButtons[O]):(O===v&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[O]))}},X.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},X.prototype.resetButtonStyles=function(){var v=this;this.buttons.forEach(function(O){O.className=O.className.replace(v.uiStyleSettings.toolbarButtonStyleColorsClassName?v.uiStyleSettings.toolbarButtonStyleColorsClassName:v.toolbarButtonStyleColorsClass.name,"").trim(),O.className=O.className.replace(v.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?v.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:v.toolbarActiveButtonStyleColorsClass.name,"").trim(),O.className+=" "+(v.uiStyleSettings.toolbarButtonStyleColorsClassName?v.uiStyleSettings.toolbarButtonStyleColorsClassName:v.toolbarButtonStyleColorsClass.name)})},X.prototype.addActionButton=function(v,O,B){var te=this,z=document.createElement("div");switch(z.className=""+this.toolbarButtonStyleClass.name,z.innerHTML=O,z.setAttribute("data-action",B),z.addEventListener("click",function(){te.actionToolbarButtonClicked(z,B)}),B){case"select":z.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":z.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":z.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":z.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":z.style.fill=this.uiStyleSettings.closeButtonColor}v.appendChild(z),this.buttons.push(z)},X.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new je("toolbar",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new je("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new je("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new je("toolbar-overflow-block",`
|
|
position: absolute;
|
|
top: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
|
|
z-index: 10;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new je("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var v=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new je("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*v)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*v)+`px;
|
|
padding: `+v+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new je("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new je("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Je("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new Je("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},X.prototype.markerToolbarButtonClicked=function(v,O){this.setActiveButton(v),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(B){return B("marker",O)}),this.markerButtonOverflowBlock.style.display="none"},X.prototype.actionToolbarButtonClicked=function(v,O){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(B){return B("action",O)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},X.prototype.setActiveButton=function(v){this.resetButtonStyles(),v.className=v.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),v.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},X.prototype.setActiveMarkerButton=function(v){var O=this.markerButtons.find(function(B){return B.getAttribute("data-type-name")===v});O&&this.setActiveButton(O)},X.prototype.setCurrentMarker=function(v){var O=this;this.currentMarker=v,this.buttons.filter(function(B){return/delete|notes/.test(B.getAttribute("data-action"))}).forEach(function(B){O.currentMarker===void 0?(B.style.fillOpacity="0.4",B.style.pointerEvents="none"):(B.style.fillOpacity="1",B.style.pointerEvents="all")})},X}(),ot=function(){function X(v,O,B,te){this.panels=[],this.panelButtons=[],this.markerjsContainer=v,this.displayMode=O,this.uiStyleSettings=B,this.styles=te,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return X.prototype.addStyles=function(){var v;this.toolboxStyleClass=this.styles.addClass(new je("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 je("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var O=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new je("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new je("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new je("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 je("toolbox-panel-row_colors",`
|
|
background-color: `+((v=this.uiStyleSettings.toolboxBackgroundColor)!==null&&v!==void 0?v:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new je("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*O)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*O)+`px;
|
|
padding: `+O+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new je("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new je("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new Je("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Je("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},X.prototype.show=function(v){var O;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=v,this.uiContainer.className=this.toolboxStyleClass.name+" "+((O=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&O!==void 0?O:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},X.prototype.setPanelButtons=function(v){var O,B,te=this;this.panels=v,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((O=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&O!==void 0?O:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((B=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&B!==void 0?B:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(z){var be;z.uiStyleSettings=te.uiStyleSettings;var tt=document.createElement("div");tt.className=te.toolboxButtonStyleClass.name+" "+((be=te.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&be!==void 0?be:te.toolboxButtonStyleColorsClass.name),tt.innerHTML=z.icon,tt.title=z.title,tt.addEventListener("click",function(){te.panelButtonClick(z)}),te.panelButtons.push(tt),te.buttonRow.appendChild(tt)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},X.prototype.panelButtonClick=function(v){var O=this,B=-1;if(v!==this.activePanel){B=this.panels.indexOf(v),this.panelRow.innerHTML="";var te=v.getUi();te.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(te),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=v}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){O.displayMode==="inline"?O.panelRow.style.display="none":O.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(z,be){var tt,Ot;z.className=O.toolboxButtonStyleClass.name+" "+(be===B?""+((tt=O.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&tt!==void 0?tt:O.toolboxActiveButtonStyleColorsClass.name):""+((Ot=O.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ot!==void 0?Ot:O.toolboxButtonStyleColorsClass.name))})},X}(),st=function(X,v){this.title=X,this.icon=v},ht=function(X){function v(O,B,te,z){var be=X.call(this,O,z||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return be.colors=[],be.addTransparent=!1,be.colorBoxes=[],be.colors=B,be.currentColor=te,be.setCurrentColor=be.setCurrentColor.bind(be),be.getColorBox=be.getColorBox.bind(be),be}return Fe(v,X),v.prototype.getUi=function(){var O=this,B=document.createElement("div");return B.style.overflow="hidden",B.style.whiteSpace="nowrap",this.colors.forEach(function(te){var z=O.getColorBox(te);B.appendChild(z),O.colorBoxes.push(z)}),B},v.prototype.getColorBox=function(O){var B=this,te=this.uiStyleSettings.toolbarHeight/4,z=this.uiStyleSettings.toolbarHeight-te,be=document.createElement("div");be.style.display="inline-block",be.style.boxSizing="content-box",be.style.width=z-2+"px",be.style.height=z-2+"px",be.style.padding="1px",be.style.marginRight="2px",be.style.marginBottom="2px",be.style.borderWidth="2px",be.style.borderStyle="solid",be.style.borderRadius=(z+2)/2+"px",be.style.borderColor=O===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",be.addEventListener("click",function(){B.setCurrentColor(O,be)});var tt=document.createElement("div");return tt.style.display="inline-block",tt.style.width=z-2+"px",tt.style.height=z-2+"px",tt.style.backgroundColor=O,tt.style.borderRadius=z/2+"px",O==="transparent"&&(tt.style.fill=this.uiStyleSettings.toolboxAccentColor,tt.innerHTML=`<svg viewBox="0 0 24 24">
|
|
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
|
|
</svg>`),be.appendChild(tt),be},v.prototype.setCurrentColor=function(O,B){var te=this;this.currentColor=O,this.colorBoxes.forEach(function(z){z.style.borderColor=z===B?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(O)},v}(st),mt=function(){function X(v,O,B){this._state="new",this._isSelected=!1,this._container=v,this._overlayContainer=O,this.globalSettings=B,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(v){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(v,O){},X.prototype.dblClick=function(v,O){},X.prototype.manipulate=function(v){},X.prototype.pointerUp=function(v){this.stateChanged()},X.prototype.dispose=function(){},X.prototype.addMarkerVisualToContainer=function(v){this.container.childNodes.length>0?this.container.insertBefore(v,this.container.childNodes[0]):this.container.appendChild(v)},X.prototype.getState=function(){return{typeName:X.typeName,state:this.state,notes:this.notes}},X.prototype.restoreState=function(v){this._state=v.state,this.notes=v.notes},X.prototype.scale=function(v,O){},X.prototype.colorChanged=function(v){this.onColorChanged&&this.onColorChanged(v),this.stateChanged()},X.prototype.fillColorChanged=function(v){this.onFillColorChanged&&this.onFillColorChanged(v),this.stateChanged()},X.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var v=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),v.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(v)&&this.onStateChanged(this)}},X.typeName="MarkerBase",X}(),ft=function(){function X(){this.findGripByVisual=this.findGripByVisual.bind(this)}return X.prototype.findGripByVisual=function(v){return this.topLeft.ownsTarget(v)?this.topLeft:this.topCenter.ownsTarget(v)?this.topCenter:this.topRight.ownsTarget(v)?this.topRight:this.centerLeft.ownsTarget(v)?this.centerLeft:this.centerRight.ownsTarget(v)?this.centerRight:this.bottomLeft.ownsTarget(v)?this.bottomLeft:this.bottomCenter.ownsTarget(v)?this.bottomCenter:this.bottomRight.ownsTarget(v)?this.bottomRight:void 0},X}(),Ht=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(v){return v===this.visual||v===this.visual.childNodes[0]||v===this.visual.childNodes[1]},X}(),Vt=function(){function X(){}return X.toITransformMatrix=function(v){return{a:v.a,b:v.b,c:v.c,d:v.d,e:v.e,f:v.f}},X.toSVGMatrix=function(v,O){return v.a=O.a,v.b=O.b,v.c=O.c,v.d=O.d,v.e=O.e,v.f=O.f,v},X}(),zt=function(X){function v(O,B,te){var z=X.call(this,O,B,te)||this;return z.left=0,z.top=0,z.width=0,z.height=0,z.defaultSize={x:50,y:20},z.offsetX=0,z.offsetY=0,z.rotationAngle=0,z.CB_DISTANCE=10,z._suppressMarkerCreateEvent=!1,z.container.transform.baseVal.appendItem(ue.createTransform()),z.setupControlBox(),z}return Fe(v,X),Object.defineProperty(v.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(v.prototype,"visual",{get:function(){return this._visual},set:function(O){this._visual=O;var B=ue.createTransform();this._visual.transform.baseVal.appendItem(B)},enumerable:!1,configurable:!0}),v.prototype.ownsTarget=function(O){return!!X.prototype.ownsTarget.call(this,O)||!!(this.controlGrips.findGripByVisual(O)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(O))},v.prototype.pointerDown=function(O,B){X.prototype.pointerDown.call(this,O,B),this.state==="new"&&(this.left=O.x,this.top=O.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var te=this.unrotatePoint(O);if(this.manipulationStartX=te.x,this.manipulationStartY=te.y,this.offsetX=te.x-this.left,this.offsetY=te.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(B),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(B)){this.activeGrip=this.rotatorGrip;var z=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=z.x-this.width/2,this.top=z.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var be=this.container.transform.baseVal.getItem(0);be.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(be,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},v.prototype.pointerUp=function(O){var B=this.state;X.prototype.pointerUp.call(this,O),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(O),this._state="select",B==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},v.prototype.moveVisual=function(O){this.visual.style.transform="translate("+O.x+"px, "+O.y+"px)"},v.prototype.manipulate=function(O){var B=this.unrotatePoint(O);this.state==="creating"?this.resize(O):this.state==="move"?(this.left=this.manipulationStartLeft+(B.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(B.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(B):this.state==="rotate"&&this.rotate(O)},v.prototype.resize=function(O){var B=this.manipulationStartLeft,te=this.manipulationStartWidth,z=this.manipulationStartTop,be=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:B=this.manipulationStartLeft+O.x-this.manipulationStartX,te=this.manipulationStartWidth+this.manipulationStartLeft-B;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:te=this.manipulationStartWidth+O.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:z=this.manipulationStartTop+O.y-this.manipulationStartY,be=this.manipulationStartHeight+this.manipulationStartTop-z;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:be=this.manipulationStartHeight+O.y-this.manipulationStartY}te>=0?(this.left=B,this.width=te):(this.left=B+te,this.width=-te),be>=0?(this.top=z,this.height=be):(this.top=z+be,this.height=-be),this.setSize()},v.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},v.prototype.rotate=function(O){if(Math.abs(O.x-this.centerX)>.1){var B=Math.sign(O.x-this.centerX);this.rotationAngle=180*Math.atan((O.y-this.centerY)/(O.x-this.centerX))/Math.PI+90*B,this.applyRotation()}},v.prototype.applyRotation=function(){var O=this.container.transform.baseVal.getItem(0);O.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(O,0)},v.prototype.rotatePoint=function(O){if(this.rotationAngle===0)return O;var B=this.container.getCTM(),te=ue.createPoint(O.x,O.y);return{x:(te=te.matrixTransform(B)).x,y:te.y}},v.prototype.unrotatePoint=function(O){if(this.rotationAngle===0)return O;var B=this.container.getCTM();B=B.inverse();var te=ue.createPoint(O.x,O.y);return{x:(te=te.matrixTransform(B)).x,y:te.y}},v.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},v.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},v.prototype.setupControlBox=function(){this.controlBox=ue.createGroup();var O=ue.createTransform();O.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(O),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 ft,this.addControlGrips(),this.controlBox.style.display="none"},v.prototype.adjustControlBox=function(){var O=this.controlBox.transform.baseVal.getItem(0);O.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(O,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},v.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},v.prototype.createGrip=function(){var O=new Ht;return O.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(O.visual),O},v.prototype.positionGrips=function(){var O=this.controlGrips.topLeft.GRIP_SIZE,B=-O/2,te=B,z=(this.width+this.CB_DISTANCE)/2-O/2,be=(this.height+this.CB_DISTANCE)/2-O/2,tt=this.height+this.CB_DISTANCE-O/2,Ot=this.width+this.CB_DISTANCE-O/2;this.positionGrip(this.controlGrips.topLeft.visual,B,te),this.positionGrip(this.controlGrips.topCenter.visual,z,te),this.positionGrip(this.controlGrips.topRight.visual,Ot,te),this.positionGrip(this.controlGrips.centerLeft.visual,B,be),this.positionGrip(this.controlGrips.centerRight.visual,Ot,be),this.positionGrip(this.controlGrips.bottomLeft.visual,B,tt),this.positionGrip(this.controlGrips.bottomCenter.visual,z,tt),this.positionGrip(this.controlGrips.bottomRight.visual,Ot,tt),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,z,te-3*this.CB_DISTANCE)},v.prototype.positionGrip=function(O,B,te){var z=O.transform.baseVal.getItem(0);z.setTranslate(B,te),O.transform.baseVal.replaceItem(z,0)},v.prototype.hideControlBox=function(){this.controlBox.style.display="none"},v.prototype.showControlBox=function(){this.controlBox.style.display=""},v.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Vt.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Vt.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},X.prototype.getState.call(this))},v.prototype.restoreState=function(O){X.prototype.restoreState.call(this,O);var B=O;this.left=B.left,this.top=B.top,this.width=B.width,this.height=B.height,this.rotationAngle=B.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Vt.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,B.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Vt.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,B.containerTransformMatrix))},v.prototype.scale=function(O,B){X.prototype.scale.call(this,O,B);var te=this.rotatePoint({x:this.left,y:this.top}),z=this.unrotatePoint({x:te.x*O,y:te.y*B});this.left=z.x,this.top=z.y,this.width=this.width*O,this.height=this.height*B,this.adjustControlBox()},v}(mt),Tt=function(X){function v(O,B,te){var z=X.call(this,O,B,te)||this;return z.fillColor="transparent",z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.opacity=1,z.setStrokeColor=z.setStrokeColor.bind(z),z.setFillColor=z.setFillColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.createVisual=z.createVisual.bind(z),z}return Fe(v,X),v.prototype.ownsTarget=function(O){return!(!X.prototype.ownsTarget.call(this,O)&&O!==this.visual)},v.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)},v.prototype.pointerDown=function(O,B){X.prototype.pointerDown.call(this,O,B),this.state==="new"&&(this.createVisual(),this.moveVisual(O),this._state="creating")},v.prototype.manipulate=function(O){X.prototype.manipulate.call(this,O)},v.prototype.resize=function(O){X.prototype.resize.call(this,O),this.setSize()},v.prototype.setSize=function(){X.prototype.setSize.call(this),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},v.prototype.pointerUp=function(O){X.prototype.pointerUp.call(this,O),this.setSize()},v.prototype.setStrokeColor=function(O){this.strokeColor=O,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(O),this.stateChanged()},v.prototype.setFillColor=function(O){this.fillColor=O,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},v.prototype.setStrokeWidth=function(O){this.strokeWidth=O,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},v.prototype.setStrokeDasharray=function(O){this.strokeDasharray=O,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},v.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},X.prototype.getState.call(this))},v.prototype.restoreState=function(O){var B=O;this.fillColor=B.fillColor,this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.opacity=B.opacity,this.createVisual(),X.prototype.restoreState.call(this,O),this.setSize()},v.prototype.scale=function(O,B){X.prototype.scale.call(this,O,B),this.setSize()},v.title="Rectangle marker",v}(zt),hn=function(X){function v(O,B,te,z){var be=X.call(this,O,z||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return be.widths=[],be.widthBoxes=[],be.widths=B,be.currentWidth=te,be.setCurrentWidth=be.setCurrentWidth.bind(be),be}return Fe(v,X),v.prototype.getUi=function(){var O=this,B=document.createElement("div");return B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2",this.widths.forEach(function(te){var z=document.createElement("div");z.style.display="flex",z.style.flexGrow="2",z.style.alignItems="center",z.style.justifyContent="space-between",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.borderColor=te===O.currentWidth?O.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){O.setCurrentWidth(te,z)}),B.appendChild(z);var be=document.createElement("div");be.innerText=te.toString(),be.style.marginRight="5px",z.appendChild(be);var tt=document.createElement("div");tt.style.minHeight="20px",tt.style.flexGrow="2",tt.style.display="flex",tt.style.alignItems="center";var Ot=document.createElement("hr");Ot.style.minWidth="20px",Ot.style.border="0px",Ot.style.borderTop=te+"px solid "+O.uiStyleSettings.toolboxColor,Ot.style.flexGrow="2",tt.appendChild(Ot),z.appendChild(tt),O.widthBoxes.push(z)}),B},v.prototype.setCurrentWidth=function(O,B){var te=this;this.currentWidth=O,this.widthBoxes.forEach(function(z){z.style.borderColor=z===B?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},v}(st),Xt=function(X){function v(O,B,te,z){var be=X.call(this,O,z||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return be.styles=[],be.styleBoxes=[],be.styles=B,be.currentStyle=te,be.setCurrentStyle=be.setCurrentStyle.bind(be),be}return Fe(v,X),v.prototype.getUi=function(){var O=this,B=document.createElement("div");return B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2",this.styles.forEach(function(te){var z=document.createElement("div");z.style.display="flex",z.style.alignItems="center",z.style.justifyContent="space-between",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.overflow="hidden",z.style.maxWidth=100/O.styles.length-5+"%",z.style.borderColor=te===O.currentStyle?O.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){O.setCurrentStyle(te,z)}),B.appendChild(z);var be=document.createElement("div");be.style.minHeight="20px",be.style.flexGrow="2",be.style.overflow="hidden";var tt=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+O.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(te!==""?'stroke-dasharray="'+te+'"':"")+` />
|
|
</svg>`;be.innerHTML=tt,z.appendChild(be),O.styleBoxes.push(z)}),B},v.prototype.setCurrentStyle=function(O,B){var te=this;this.currentStyle=O,this.styleBoxes.forEach(function(z){z.style.borderColor=z===B?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},v}(st),Wt=function(X){function v(O,B,te){var z=X.call(this,O,B,te)||this;return z.strokeColor=te.defaultColor,z.strokeWidth=te.defaultStrokeWidth,z.strokeDasharray=te.defaultStrokeDasharray,z.strokePanel=new ht("Line color",te.defaultColorSet,te.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.strokeWidthPanel=new hn("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new Xt("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z}return Fe(v,X),Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var O=X.prototype.getState.call(this);return O.typeName=v.typeName,O},v.typeName="FrameMarker",v.title="Frame marker",v.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',v}(Tt),it=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},un=function(X){function v(O,B,te){var z=X.call(this,O,B,te)||this;return z.x1=0,z.y1=0,z.x2=0,z.y2=0,z.defaultLength=50,z.manipulationStartX=0,z.manipulationStartY=0,z.manipulationStartX1=0,z.manipulationStartY1=0,z.manipulationStartX2=0,z.manipulationStartY2=0,z.setupControlBox(),z}return Fe(v,X),v.prototype.ownsTarget=function(O){return!!X.prototype.ownsTarget.call(this,O)||!(!this.grip1.ownsTarget(O)&&!this.grip2.ownsTarget(O))},v.prototype.pointerDown=function(O,B){X.prototype.pointerDown.call(this,O,B),this.manipulationStartX=O.x,this.manipulationStartY=O.y,this.state==="new"&&(this.x1=O.x,this.y1=O.y,this.x2=O.x,this.y2=O.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(B)?this.activeGrip=this.grip1:this.grip2.ownsTarget(B)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},v.prototype.pointerUp=function(O){var B=this.state;X.prototype.pointerUp.call(this,O),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(O),this._state="select",B==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},v.prototype.adjustVisual=function(){},v.prototype.manipulate=function(O){this.state==="creating"?this.resize(O):this.state==="move"?(this.x1=this.manipulationStartX1+O.x-this.manipulationStartX,this.y1=this.manipulationStartY1+O.y-this.manipulationStartY,this.x2=this.manipulationStartX2+O.x-this.manipulationStartX,this.y2=this.manipulationStartY2+O.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(O)},v.prototype.resize=function(O){switch(this.activeGrip){case this.grip1:this.x1=O.x,this.y1=O.y;break;case this.grip2:case void 0:this.x2=O.x,this.y2=O.y}this.adjustVisual(),this.adjustControlBox()},v.prototype.select=function(){X.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},v.prototype.deselect=function(){X.prototype.deselect.call(this),this.controlBox.style.display="none"},v.prototype.setupControlBox=function(){this.controlBox=ue.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},v.prototype.adjustControlBox=function(){this.positionGrips()},v.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},v.prototype.createGrip=function(){var O=new Ht;return O.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(O.visual),O},v.prototype.positionGrips=function(){var O=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-O/2,this.y1-O/2),this.positionGrip(this.grip2.visual,this.x2-O/2,this.y2-O/2)},v.prototype.positionGrip=function(O,B,te){var z=O.transform.baseVal.getItem(0);z.setTranslate(B,te),O.transform.baseVal.replaceItem(z,0)},v.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},X.prototype.getState.call(this))},v.prototype.restoreState=function(O){X.prototype.restoreState.call(this,O);var B=O;this.x1=B.x1,this.y1=B.y1,this.x2=B.x2,this.y2=B.y2},v.prototype.scale=function(O,B){X.prototype.scale.call(this,O,B),this.x1=this.x1*O,this.y1=this.y1*B,this.x2=this.x2*O,this.y2=this.y2*B,this.adjustVisual(),this.adjustControlBox()},v}(mt),Kt=function(X){function v(O,B,te){var z=X.call(this,O,B,te)||this;return z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.setStrokeColor=z.setStrokeColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.strokeColor=te.defaultColor,z.strokeWidth=te.defaultStrokeWidth,z.strokeDasharray=te.defaultStrokeDasharray,z.strokePanel=new ht("Line color",te.defaultColorSet,te.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.strokeWidthPanel=new hn("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new Xt("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z}return Fe(v,X),v.prototype.ownsTarget=function(O){return!(!X.prototype.ownsTarget.call(this,O)&&O!==this.visual&&O!==this.selectorLine&&O!==this.visibleLine)},v.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)},v.prototype.pointerDown=function(O,B){X.prototype.pointerDown.call(this,O,B),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},v.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),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()]]))},v.prototype.setStrokeColor=function(O){this.strokeColor=O,this.adjustVisual(),this.colorChanged(O)},v.prototype.setStrokeWidth=function(O){this.strokeWidth=O,this.adjustVisual()},v.prototype.setStrokeDasharray=function(O){this.strokeDasharray=O,this.adjustVisual(),this.stateChanged()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var O=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},X.prototype.getState.call(this));return O.typeName=v.typeName,O},v.prototype.restoreState=function(O){X.prototype.restoreState.call(this,O);var B=O;this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.createVisual(),this.adjustVisual()},v.typeName="LineMarker",v.title="Line marker",v.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',v}(un),qe=function(X){function v(O,B,te,z){var be=X.call(this,O,z||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return be.fonts=[],be.fontBoxes=[],be.fonts=B,be.currentFont=te,be.setCurrentFont=be.setCurrentFont.bind(be),be}return Fe(v,X),v.prototype.getUi=function(){var O=this,B=document.createElement("div");return B.style.overflow="hidden",B.style.flexGrow="2",this.fonts.forEach(function(te){var z=document.createElement("div");z.style.display="inline-block",z.style.alignItems="center",z.style.justifyContent="space-between",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.overflow="hidden",z.style.maxWidth=100/O.fonts.length-5+"%",z.style.borderColor=te===O.currentFont?O.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){O.setCurrentFont(te,z)}),B.appendChild(z);var be=document.createElement("div");be.style.display="flex",be.style.minHeight="20px",be.style.flexGrow="2",be.style.fontFamily=te,be.style.overflow="hidden";var tt=document.createElement("div");tt.style.whiteSpace="nowrap",tt.style.overflow="hidden",tt.style.textOverflow="ellipsis",tt.innerHTML="The quick brown fox jumps over the lazy dog",be.appendChild(tt),z.appendChild(be),O.fontBoxes.push(z)}),B},v.prototype.setCurrentFont=function(O,B){var te=this;this.currentFont=O,this.fontBoxes.forEach(function(z){z.style.borderColor=z===B?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},v}(st),wt=function(X){function v(O,B,te){var z=X.call(this,O,B,te)||this;return z.color="transparent",z.padding=5,z.DEFAULT_TEXT="your text here",z.text=z.DEFAULT_TEXT,z.isMoved=!1,z.color=te.defaultColor,z.fontFamily=te.defaultFontFamily,z.defaultSize={x:100,y:30},z.setColor=z.setColor.bind(z),z.setFont=z.setFont.bind(z),z.renderText=z.renderText.bind(z),z.sizeText=z.sizeText.bind(z),z.textEditDivClicked=z.textEditDivClicked.bind(z),z.showTextEditor=z.showTextEditor.bind(z),z.setSize=z.setSize.bind(z),z.positionTextEditor=z.positionTextEditor.bind(z),z.colorPanel=new ht("Color",te.defaultColorSet,te.defaultColor),z.colorPanel.onColorChanged=z.setColor,z.fontFamilyPanel=new qe("Font",te.defaultFontFamilies,te.defaultFontFamily),z.fontFamilyPanel.onFontChanged=z.setFont,z}return Fe(v,X),v.prototype.ownsTarget=function(O){if(X.prototype.ownsTarget.call(this,O)||O===this.visual||O===this.textElement||O===this.bgRectangle)return!0;var B=!1;return this.textElement.childNodes.forEach(function(te){te===O&&(B=!0)}),B},v.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()},v.prototype.pointerDown=function(O,B){X.prototype.pointerDown.call(this,O,B),this.isMoved=!1,this.pointerDownPoint=O,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(O),this._state="creating")},v.prototype.renderText=function(){var O=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(B){O.textElement.appendChild(ue.createTSpan(B.trim()===""?" ":B.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},v.prototype.getTextScale=function(){var O=this.textElement.getBBox(),B=1;if(O.width>0&&O.height>0){var te=(1*this.width-this.width*this.padding*2/100)/O.width,z=(1*this.height-this.height*this.padding*2/100)/O.height;B=Math.min(te,z)}return B},v.prototype.getTextPosition=function(O){var B=this.textElement.getBBox(),te=0,z=0;return B.width>0&&B.height>0&&(te=(this.width-B.width*O)/2,z=this.height/2-B.height*O/2),{x:te,y:z}},v.prototype.sizeText=function(){var O=this.textElement.getBBox(),B=this.getTextScale(),te=this.getTextPosition(B);te.y-=O.y*B,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+te.x+"px, "+te.y+"px) scale("+B+", "+B+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(te.x,te.y),this.textElement.transform.baseVal.getItem(1).setScale(B,B))},v.prototype.manipulate=function(O){X.prototype.manipulate.call(this,O),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(O.x-this.pointerDownPoint.x)>5||Math.abs(O.y-this.pointerDownPoint.y)>5)},v.prototype.resize=function(O){X.prototype.resize.call(this,O),this.isMoved=!0,this.setSize(),this.sizeText()},v.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()]]))},v.prototype.pointerUp=function(O){var B=this.state;B==="creating"&&(this._suppressMarkerCreateEvent=!0),X.prototype.pointerUp.call(this,O),this.setSize(),(B==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},v.prototype.showTextEditor=function(){var O=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(B){B.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var B=Number.parseFloat(O.textEditor.style.fontSize);O.textEditor.clientWidth>=Number.parseInt(O.textEditor.style.maxWidth)&&B>.9;)B-=.1,O.textEditor.style.fontSize=Math.max(B,.9)+"em"}),this.textEditor.addEventListener("keyup",function(B){B.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(B){if(B.clipboardData){var te=B.clipboardData.getData("text"),z=window.getSelection();if(!z.rangeCount)return!1;z.deleteFromDocument(),z.getRangeAt(0).insertNode(document.createTextNode(te)),B.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){O.textEditDivClicked(O.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},v.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var O=this.getTextScale(),B=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),te=this.textElement.getBBox(),z={x:te.width*O,y:te.height*O};B.x-=z.x/2,B.y-=z.y/2,this.textEditor.style.top=B.y+"px",this.textEditor.style.left=B.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-B.x+"px",this.textEditor.style.fontSize=Math.max(16*O,12)+"px",this.textElement.style.display="none"}},v.prototype.textEditDivClicked=function(O){this.text=O.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},v.prototype.select=function(){X.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},v.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),X.prototype.deselect.call(this)},v.prototype.dblClick=function(O,B){X.prototype.dblClick.call(this,O,B),this.showTextEditor()},v.prototype.setColor=function(O){this.textElement&&ue.setAttributes(this.textElement,[["fill",O]]),this.color=O,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(O)},v.prototype.setFont=function(O){this.textElement&&ue.setAttributes(this.textElement,[["font-family",O]]),this.fontFamily=O,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},v.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},v.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var O=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},X.prototype.getState.call(this));return O.typeName=v.typeName,O},v.prototype.restoreState=function(O){var B=O;this.color=B.color,this.fontFamily=B.fontFamily,this.padding=B.padding,this.text=B.text,this.createVisual(),X.prototype.restoreState.call(this,O),this.setSize()},v.prototype.scale=function(O,B){X.prototype.scale.call(this,O,B),this.setSize(),this.sizeText(),this.positionTextEditor()},v.typeName="TextMarker",v.title="Text marker",v.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',v}(zt),Be=function(X){function v(O,B,te){var z=X.call(this,O,B,te)||this;return z.color="transparent",z.lineWidth=3,z.drawing=!1,z.pixelRatio=1,z.color=te.defaultColor,z.lineWidth=te.defaultStrokeWidth,z.pixelRatio=te.freehandPixelRatio,z.setColor=z.setColor.bind(z),z.addCanvas=z.addCanvas.bind(z),z.finishCreation=z.finishCreation.bind(z),z.setLineWidth=z.setLineWidth.bind(z),z.colorPanel=new ht("Color",te.defaultColorSet,te.defaultColor),z.colorPanel.onColorChanged=z.setColor,z.lineWidthPanel=new hn("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),z.lineWidthPanel.onWidthChanged=z.setLineWidth,z}return Fe(v,X),v.prototype.ownsTarget=function(O){return!(!X.prototype.ownsTarget.call(this,O)&&O!==this.visual&&O!==this.drawingImage)},v.prototype.createVisual=function(){this.visual=ue.createGroup(),this.drawingImage=ue.createImage(),this.visual.appendChild(this.drawingImage);var O=ue.createTransform();this.visual.transform.baseVal.appendItem(O),this.addMarkerVisualToContainer(this.visual)},v.prototype.pointerDown=function(O,B){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(O.x,O.y),this.drawing=!0):X.prototype.pointerDown.call(this,O,B)},v.prototype.manipulate=function(O){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(O.x,O.y),this.canvasContext.stroke()):X.prototype.manipulate.call(this,O)},v.prototype.resize=function(O){X.prototype.resize.call(this,O),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},v.prototype.pointerUp=function(O){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):X.prototype.pointerUp.call(this,O)},v.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},v.prototype.select=function(){this.state==="creating"&&this.finishCreation(),X.prototype.select.call(this)},v.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),X.prototype.deselect.call(this)},v.prototype.finishCreation=function(){for(var O=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),B=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],te=B[0],z=B[1],be=B[2],tt=B[3],Ot=!1,Ct=0;Ct<this.canvasElement.height;Ct++)for(var at=0;at<this.canvasElement.width;at++)O.data[Ct*this.canvasElement.width*4+4*at+3]>0&&(Ot=!0,Ct<z&&(z=Ct),at<te&&(te=at),Ct>tt&&(tt=Ct),at>be&&(be=at));if(Ot){this.left=te/this.pixelRatio,this.top=z/this.pixelRatio,this.width=(be-te)/this.pixelRatio,this.height=(tt-z)/this.pixelRatio;var Yt=document.createElement("canvas");Yt.width=be-te,Yt.height=tt-z,Yt.getContext("2d").putImageData(this.canvasContext.getImageData(te,z,be-te,tt-z),0,0),this.drawingImgUrl=Yt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},v.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})},v.prototype.setColor=function(O){this.color=O,this.colorChanged(O)},v.prototype.setLineWidth=function(O){this.lineWidth=O},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var O=Object.assign({drawingImgUrl:this.drawingImgUrl},X.prototype.getState.call(this));return O.typeName=v.typeName,O},v.prototype.restoreState=function(O){this.createVisual(),X.prototype.restoreState.call(this,O),this.drawingImgUrl=O.drawingImgUrl,this.setDrawingImage()},v.prototype.scale=function(O,B){X.prototype.scale.call(this,O,B),this.setDrawingImage()},v.typeName="FreehandMarker",v.title="Freehand marker",v.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',v}(zt),Ae=function(X){function v(O,B,te){var z=X.call(this,O,te||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return z.typeBoxes=[],z.currentType=B,z.setCurrentType=z.setCurrentType.bind(z),z}return Fe(v,X),v.prototype.getUi=function(){var O=this,B=document.createElement("div");B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2";for(var te=function(tt){var Ot="both";switch(tt){case 0:Ot="both";break;case 1:Ot="start";break;case 2:Ot="end";break;case 3:Ot="none"}var Ct=document.createElement("div");if(Ct.style.display="flex",Ct.style.flexGrow="2",Ct.style.alignItems="center",Ct.style.justifyContent="space-between",Ct.style.padding="5px",Ct.style.borderWidth="2px",Ct.style.borderStyle="solid",Ct.style.borderColor=Ot===z.currentType?z.uiStyleSettings.toolboxAccentColor:"transparent",Ct.addEventListener("click",function(){O.setCurrentType(Ot,Ct)}),B.appendChild(Ct),Ot==="both"||Ot==="start"){var at=document.createElement("div");at.style.display="flex",at.style.alignItems="center",at.style.minHeight="20px",at.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,5 10,0 10,10" fill="`+(z.uiStyleSettings!==void 0?z.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,at.style.marginLeft="5px",Ct.appendChild(at)}var Yt=document.createElement("div");Yt.style.display="flex",Yt.style.alignItems="center",Yt.style.minHeight="20px",Yt.style.flexGrow="2";var Cn=document.createElement("hr");if(Cn.style.minWidth="20px",Cn.style.border="0px",Cn.style.borderTop="3px solid "+(z.uiStyleSettings!==void 0?z.uiStyleSettings.toolboxColor:"#eeeeee"),Cn.style.flexGrow="2",Yt.appendChild(Cn),Ct.appendChild(Yt),Ot==="both"||Ot==="end"){var Nn=document.createElement("div");Nn.style.display="flex",Nn.style.alignItems="center",Nn.style.minHeight="20px",Nn.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
|
|
<polygon points="0,0 10,5 0,10" fill="`+(z.uiStyleSettings!==void 0?z.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Nn.style.marginRight="5px",Ct.appendChild(Nn)}z.typeBoxes.push(Ct)},z=this,be=0;be<4;be++)te(be);return B},v.prototype.setCurrentType=function(O,B){var te=this;this.currentType=O,this.typeBoxes.forEach(function(z){z.style.borderColor=z===B?te.uiStyleSettings!==void 0?te.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},v}(st),Ie=function(X){function v(O,B,te){var z=X.call(this,O,B,te)||this;return z.arrowType="end",z.arrowBaseHeight=10,z.arrowBaseWidth=10,z.getArrowPoints=z.getArrowPoints.bind(z),z.setArrowType=z.setArrowType.bind(z),z.arrowTypePanel=new Ae("Arrow type","end"),z.arrowTypePanel.onArrowTypeChanged=z.setArrowType,z}return Fe(v,X),v.prototype.ownsTarget=function(O){return!(!X.prototype.ownsTarget.call(this,O)&&O!==this.arrow1&&O!==this.arrow2)},v.prototype.getArrowPoints=function(O,B){var te=this.arrowBaseWidth+2*this.strokeWidth,z=this.arrowBaseHeight+2*this.strokeWidth;return O-te/2+","+(B+z/2)+" "+O+","+(B-z/2)+" "+(O+te/2)+","+(B+z/2)},v.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)},v.prototype.pointerDown=function(O,B){X.prototype.pointerDown.call(this,O,B),this.state==="creating"&&this.createTips()},v.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 O=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),B=this.arrow1.transform.baseVal.getItem(0);B.setRotate(O,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(B,0);var te=this.arrow2.transform.baseVal.getItem(0);te.setRotate(O+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(te,0)}},v.prototype.setArrowType=function(O){this.arrowType=O,this.adjustVisual(),this.stateChanged()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var O=Object.assign({arrowType:this.arrowType},X.prototype.getState.call(this));return O.typeName=v.typeName,O},v.prototype.restoreState=function(O){X.prototype.restoreState.call(this,O);var B=O;this.arrowType=B.arrowType,this.createTips(),this.adjustVisual()},v.typeName="ArrowMarker",v.title="Arrow marker",v.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',v}(Kt),se=function(X){function v(O,B,te){var z=X.call(this,O,B,te)||this;return z.fillColor=te.defaultFillColor,z.strokeWidth=0,z.fillPanel=new ht("Color",te.defaultColorSet,te.defaultFillColor),z.fillPanel.onColorChanged=z.setFillColor,z}return Fe(v,X),Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var O=X.prototype.getState.call(this);return O.typeName=v.typeName,O},v.typeName="CoverMarker",v.title="Cover marker",v.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',v}(Tt),ce=function(X){function v(O,B,te,z){var be=X.call(this,O,z||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return be.opacities=[],be.opacityBoxes=[],be.opacities=B,be.currentOpacity=te,be.setCurrentOpacity=be.setCurrentOpacity.bind(be),be}return Fe(v,X),v.prototype.getUi=function(){var O=this,B=document.createElement("div");return B.style.display="flex",B.style.overflow="hidden",B.style.flexGrow="2",B.style.justifyContent="space-between",this.opacities.forEach(function(te){var z=document.createElement("div");z.style.display="flex",z.style.alignItems="center",z.style.justifyContent="center",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.borderColor=te===O.currentOpacity?O.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){O.setCurrentOpacity(te,z)}),B.appendChild(z);var be=document.createElement("div");be.innerText=100*te+"%",z.appendChild(be),O.opacityBoxes.push(z)}),B},v.prototype.setCurrentOpacity=function(O,B){var te=this;this.currentOpacity=O,this.opacityBoxes.forEach(function(z){z.style.borderColor=z===B?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},v}(st),ye=function(X){function v(O,B,te){var z=X.call(this,O,B,te)||this;return z.setOpacity=z.setOpacity.bind(z),z.fillColor=te.defaultHighlightColor,z.strokeWidth=0,z.opacity=te.defaultHighlightOpacity,z.fillPanel=new ht("Color",te.defaultColorSet,z.fillColor),z.fillPanel.onColorChanged=z.setFillColor,z.opacityPanel=new ce("Opacity",te.defaultOpacitySteps,z.opacity),z.opacityPanel.onOpacityChanged=z.setOpacity,z}return Fe(v,X),v.prototype.setOpacity=function(O){this.opacity=O,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var O=X.prototype.getState.call(this);return O.typeName=v.typeName,O},v.typeName="HighlightMarker",v.title="Highlight marker",v.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',v}(se),Se='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',ke=function(X){function v(O,B,te){var z=X.call(this,O,B,te)||this;return z.bgColor="transparent",z.tipPosition={x:0,y:0},z.tipBase1Position={x:0,y:0},z.tipBase2Position={x:0,y:0},z.tipMoving=!1,z.color=te.defaultStrokeColor,z.bgColor=te.defaultFillColor,z.fontFamily=te.defaultFontFamily,z.defaultSize={x:100,y:30},z.setBgColor=z.setBgColor.bind(z),z.getTipPoints=z.getTipPoints.bind(z),z.positionTip=z.positionTip.bind(z),z.setTipPoints=z.setTipPoints.bind(z),z.colorPanel=new ht("Text color",te.defaultColorSet,z.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),z.colorPanel.onColorChanged=z.setColor,z.bgColorPanel=new ht("Fill color",te.defaultColorSet,z.bgColor,Se),z.bgColorPanel.onColorChanged=z.setBgColor,z.fontFamilyPanel=new qe("Font",te.defaultFontFamilies,te.defaultFontFamily),z.fontFamilyPanel.onFontChanged=z.setFont,z.tipGrip=new Ht,z.tipGrip.visual.transform.baseVal.appendItem(ue.createTransform()),z.controlBox.appendChild(z.tipGrip.visual),z}return Fe(v,X),v.prototype.ownsTarget=function(O){return X.prototype.ownsTarget.call(this,O)||this.tipGrip.ownsTarget(O)||this.tip===O},v.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)},v.prototype.pointerDown=function(O,B){this.state==="new"&&X.prototype.pointerDown.call(this,O,B),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(B)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):X.prototype.pointerDown.call(this,O,B)},v.prototype.pointerUp=function(O){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,X.prototype.pointerUp.call(this,O);else{var B=this.state==="creating";X.prototype.pointerUp.call(this,O),this.setTipPoints(B),this.positionTip()}},v.prototype.manipulate=function(O){if(this.tipMoving){var B=this.unrotatePoint(O);this.tipPosition={x:B.x-this.manipulationStartLeft,y:B.y-this.manipulationStartTop},this.positionTip()}else X.prototype.manipulate.call(this,O)},v.prototype.setBgColor=function(O){this.bgRectangle&&this.tip&&(ue.setAttributes(this.bgRectangle,[["fill",O]]),ue.setAttributes(this.tip,[["fill",O]])),this.bgColor=O,this.fillColorChanged(O)},v.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},v.prototype.setTipPoints=function(O){O===void 0&&(O=!1);var B=Math.min(this.height/2,15),te=this.height/5;O&&(this.tipPosition={x:B+te/2,y:this.height+20});var z=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?z<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(te=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:B,y:0},this.tipBase2Position={x:B+te,y:0}):(this.tipBase1Position={x:0,y:B},this.tipBase2Position={x:0,y:B+te}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?z<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(te=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-B-te,y:0},this.tipBase2Position={x:this.width-B,y:0}):(this.tipBase1Position={x:this.width,y:B},this.tipBase2Position={x:this.width,y:B+te}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?z<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(te=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-B-te,y:this.height},this.tipBase2Position={x:this.width-B,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-B-te},this.tipBase2Position={x:this.width,y:this.height-B}):z<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(te=this.width/5,B=Math.min(this.width/2,15),this.tipBase1Position={x:B,y:this.height},this.tipBase2Position={x:B+te,y:this.height}):(this.tipBase1Position={x:0,y:this.height-B},this.tipBase2Position={x:0,y:this.height-B-te})},v.prototype.resize=function(O){X.prototype.resize.call(this,O),this.positionTip()},v.prototype.positionTip=function(){ue.setAttributes(this.tip,[["points",this.getTipPoints()]]);var O=this.tipGrip.visual.transform.baseVal.getItem(0);O.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(O,0)},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),v.prototype.select=function(){this.positionTip(),X.prototype.select.call(this)},v.prototype.getState=function(){var O=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},X.prototype.getState.call(this));return O.typeName=v.typeName,O},v.prototype.restoreState=function(O){var B=O;this.bgColor=B.bgColor,this.tipPosition=B.tipPosition,X.prototype.restoreState.call(this,O),this.createTip(),this.setTipPoints()},v.prototype.scale=function(O,B){X.prototype.scale.call(this,O,B),this.tipPosition={x:this.tipPosition.x*O,y:this.tipPosition.y*B},this.positionTip()},v.typeName="CalloutMarker",v.title="Callout marker",v.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',v}(wt),et=function(X){function v(O,B,te){var z=X.call(this,O,B,te)||this;return z.fillColor="transparent",z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.opacity=1,z.strokeColor=te.defaultColor,z.strokeWidth=te.defaultStrokeWidth,z.strokeDasharray=te.defaultStrokeDasharray,z.fillColor=te.defaultFillColor,z.setStrokeColor=z.setStrokeColor.bind(z),z.setFillColor=z.setFillColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.setOpacity=z.setOpacity.bind(z),z.createVisual=z.createVisual.bind(z),z.strokePanel=new ht("Line color",xe(te.defaultColorSet,["transparent"]),te.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.fillPanel=new ht("Fill color",xe(te.defaultColorSet,["transparent"]),z.fillColor,Se),z.fillPanel.onColorChanged=z.setFillColor,z.strokeWidthPanel=new hn("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new Xt("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z.opacityPanel=new ce("Opacity",te.defaultOpacitySteps,z.opacity),z.opacityPanel.onOpacityChanged=z.setOpacity,z}return Fe(v,X),v.prototype.ownsTarget=function(O){return!(!X.prototype.ownsTarget.call(this,O)&&O!==this.visual)},v.prototype.createVisual=function(){this.visual=ue.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},v.prototype.pointerDown=function(O,B){X.prototype.pointerDown.call(this,O,B),this.state==="new"&&(this.createVisual(),this.moveVisual(O),this._state="creating")},v.prototype.manipulate=function(O){X.prototype.manipulate.call(this,O)},v.prototype.resize=function(O){X.prototype.resize.call(this,O),this.setSize()},v.prototype.setSize=function(){X.prototype.setSize.call(this),ue.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},v.prototype.pointerUp=function(O){X.prototype.pointerUp.call(this,O),this.setSize()},v.prototype.setStrokeColor=function(O){this.strokeColor=O,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(O),this.stateChanged()},v.prototype.setFillColor=function(O){this.fillColor=O,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(O),this.stateChanged()},v.prototype.setStrokeWidth=function(O){this.strokeWidth=O,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},v.prototype.setStrokeDasharray=function(O){this.strokeDasharray=O,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},v.prototype.setOpacity=function(O){this.opacity=O,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var O=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},X.prototype.getState.call(this));return O.typeName=v.typeName,O},v.prototype.restoreState=function(O){var B=O;this.fillColor=B.fillColor,this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.opacity=B.opacity,this.createVisual(),X.prototype.restoreState.call(this,O),this.setSize()},v.prototype.scale=function(O,B){X.prototype.scale.call(this,O,B),this.setSize()},v.typeName="EllipseMarker",v.title="Ellipse marker",v.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',v}(zt),yt=function(X){function v(O,B,te){return X.call(this,O,B,te)||this}return Fe(v,X),Object.defineProperty(v.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),v.prototype.ownsTarget=function(O){return!(!X.prototype.ownsTarget.call(this,O)&&O!==this.tip1&&O!==this.tip2)},v.prototype.createTips=function(){this.tip1=ue.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.tip1),this.tip2=ue.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.tip2)},v.prototype.pointerDown=function(O,B){X.prototype.pointerDown.call(this,O,B),this.state==="creating"&&this.createTips()},v.prototype.adjustVisual=function(){if(X.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(ue.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var O=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),B=this.tip1.transform.baseVal.getItem(0);B.setRotate(O,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(B,0);var te=this.tip2.transform.baseVal.getItem(0);te.setRotate(O+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(te,0)}},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var O=X.prototype.getState.call(this);return O.typeName=v.typeName,O},v.prototype.restoreState=function(O){X.prototype.restoreState.call(this,O),this.createTips(),this.adjustVisual()},v.typeName="MeasurementMarker",v.title="Measurement marker",v.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',v}(Kt),$t=function(X){function v(O,B,te){var z=X.call(this,O,B,te)||this;return z.strokePanel.colors=te.defaultColorSet,z.fillColor="transparent",z}return Fe(v,X),Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var O=X.prototype.getState.call(this);return O.typeName=v.typeName,O},v.typeName="EllipseFrameMarker",v.title="Ellipse frame marker",v.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',v}(et),gn=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(v){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(v)||(this.undoStack.push(v),JSON.stringify(this.lastRedoStep)!==JSON.stringify(v)&&this.redoStack.splice(0,this.redoStack.length))},X.prototype.replaceLastUndoStep=function(v){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=v)},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 v=this.undoStack.pop();return v!==void 0&&this.redoStack.push(v),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}(),Dt=function(X){function v(O,B,te){var z=X.call(this,O,B,te)||this;return z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.curveX=0,z.curveY=0,z.manipulationStartCurveX=0,z.manipulationStartCurveY=0,z.setStrokeColor=z.setStrokeColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.positionGrips=z.positionGrips.bind(z),z.addControlGrips=z.addControlGrips.bind(z),z.adjustVisual=z.adjustVisual.bind(z),z.setupControlBox=z.setupControlBox.bind(z),z.resize=z.resize.bind(z),z.strokeColor=te.defaultColor,z.strokeWidth=te.defaultStrokeWidth,z.strokeDasharray=te.defaultStrokeDasharray,z.strokePanel=new ht("Line color",te.defaultColorSet,te.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.strokeWidthPanel=new hn("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new Xt("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z}return Fe(v,X),v.prototype.ownsTarget=function(O){return!(!X.prototype.ownsTarget.call(this,O)&&O!==this.visual&&O!==this.selectorCurve&&O!==this.visibleCurve&&!this.curveGrip.ownsTarget(O))},v.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},v.prototype.createVisual=function(){this.visual=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)},v.prototype.pointerDown=function(O,B){X.prototype.pointerDown.call(this,O,B),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=O.x,this.curveY=O.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(B)&&(this.activeGrip=this.curveGrip,this._state="resize")},v.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),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()]]))},v.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)},v.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,X.prototype.addControlGrips.call(this)},v.prototype.positionGrips=function(){X.prototype.positionGrips.call(this);var O=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-O/2,this.curveY-O/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},v.prototype.manipulate=function(O){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+O.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+O.y-this.manipulationStartY),X.prototype.manipulate.call(this,O)},v.prototype.resize=function(O){this.activeGrip===this.curveGrip&&(this.curveX=O.x,this.curveY=O.y),X.prototype.resize.call(this,O),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},v.prototype.setStrokeColor=function(O){this.strokeColor=O,this.adjustVisual(),this.colorChanged(O)},v.prototype.setStrokeWidth=function(O){this.strokeWidth=O,this.adjustVisual()},v.prototype.setStrokeDasharray=function(O){this.strokeDasharray=O,this.adjustVisual()},v.prototype.scale=function(O,B){this.curveX=this.curveX*O,this.curveY=this.curveY*B,X.prototype.scale.call(this,O,B)},Object.defineProperty(v.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),v.prototype.getState=function(){var O=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},X.prototype.getState.call(this));return O.typeName=v.typeName,O},v.prototype.restoreState=function(O){X.prototype.restoreState.call(this,O);var B=O;this.strokeColor=B.strokeColor,this.strokeWidth=B.strokeWidth,this.strokeDasharray=B.strokeDasharray,this.curveX=B.curveX,this.curveY=B.curveY,this.createVisual(),this.adjustVisual()},v.typeName="CurveMarker",v.title="Curve marker",v.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',v}(un),zn=function(){function X(v,O){O===void 0&&(O=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=v,this.cancelable=O}return Object.defineProperty(X.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),X.prototype.preventDefault=function(){this._defaultPrevented=!0},X}(),Ln=function(X){function v(O,B,te){var z=X.call(this,O,!1)||this;return z.dataUrl=B,z.state=te,z}return Fe(v,X),v}(zn),sn=function(X){function v(O,B,te){te===void 0&&(te=!1);var z=X.call(this,O,te)||this;return z.marker=B,z}return Fe(v,X),v}(zn),_i=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(v,O){this[v].push(O)},X.prototype.removeEventListener=function(v,O){var B=this[v].indexOf(O);B>-1&&this[v].splice(B,1)},X}(),si=function(){function X(v){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new it,this._isOpen=!1,this.undoRedoManager=new gn,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 _i,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=X.instanceCounter++,this.styles=new Ke(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=v,this.targetRoot=document.body,this.width=v.clientWidth,this.height=v.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(X.prototype,"ALL_MARKER_TYPES",{get:function(){return[Wt,Be,Ie,wt,$t,et,ye,ke,yt,se,Kt,Dt]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Wt,Be,Ie,wt,et,ye,ke]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Wt,Be,Ie,wt,ye]},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(v){var O=this;this._availableMarkerTypes.splice(0),v.forEach(function(B){if(typeof B=="string"){var te=O.ALL_MARKER_TYPES.find(function(z){return z.typeName===B});te!==void 0&&O._availableMarkerTypes.push(te)}else O._availableMarkerTypes.push(B)})},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(v){this._zoomLevel=v,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(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(),ae.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},X.prototype.show=function(){var v=this;this.styles.styleSheetRoot===void 0&&de.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=de.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(O){return O(new zn(v))})},X.prototype.render=function(){return We(this,void 0,void 0,function(){var v;return Ue(this,function(O){switch(O.label){case 0:return this.setCurrentMarker(),(v=new Ee).naturalSize=this.renderAtNaturalSize,v.imageType=this.renderImageType,v.imageQuality=this.renderImageQuality,v.markersOnly=this.renderMarkersOnly,v.width=this.renderWidth,v.height=this.renderHeight,[4,v.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return O.sent(),[4,v.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,O.sent()]}})})},X.prototype.close=function(v){var O=this;if(v===void 0&&(v=!1),this.isOpen){var B=!1;v||this.eventListeners.beforeclose.forEach(function(te){var z=new zn(O,!0);te(z),z.defaultPrevented&&(B=!0)}),B||(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(te){return te(new zn(O))}),this.detachEvents(),this._isOpen=!1)}},X.prototype.addMarkersToToolbar=function(){for(var v,O=[],B=0;B<arguments.length;B++)O[B]=arguments[B];(v=this._availableMarkerTypes).push.apply(v,O)},X.prototype.addRenderEventListener=function(v){this.addEventListener("render",function(O){v(O.dataUrl,O.state)})},X.prototype.removeRenderEventListener=function(v){},X.prototype.addCloseEventListener=function(v){this.addEventListener("close",function(){v()})},X.prototype.removeCloseEventListener=function(v){},X.prototype.setupResizeObserver=function(){var v=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){v.resize(v.target.clientWidth,v.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return v.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},X.prototype.onPopupTargetResize=function(){var v=1*this.target.clientWidth/this.target.clientHeight,O=this.editorCanvas.clientWidth/v>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*v:this.editorCanvas.clientWidth,B=O<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/v;this.resize(O,B)},X.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},X.prototype.resize=function(v,O){this._isResizing=!0;var B=v/this.imageWidth,te=O/this.imageHeight;this.imageWidth=Math.round(v),this.imageHeight=Math.round(O),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(B,te),this._isResizing=!1},X.prototype.scaleMarkers=function(v,O){var B,te=this;this._currentMarker&&this._currentMarker instanceof wt?this._currentMarker.scale(v,O):(B=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(z){z!==te._currentMarker&&z.scale(v,O)}),B!==void 0&&this.setCurrentMarker(B)},X.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},X.prototype.setTopLeft=function(){var v=this.editingTarget.getBoundingClientRect(),O=this.editorCanvas.getBoundingClientRect();this.left=v.left-O.left,this.top=v.top-O.top},X.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},X.prototype.addDefs=function(){for(var v,O=[],B=0;B<arguments.length;B++)O[B]=arguments[B];this.defs=ue.createDefs(),this.addDefsToImage(),(v=this.defs).append.apply(v,O)},X.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},X.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},X.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},X.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},X.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},X.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},X.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},X.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var v=document.createElement("a");v.href="https://markerjs.com/",v.target="_blank",v.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',v.title="Powered by marker.js",v.style.display="grid",v.style.alignItems="center",v.style.justifyItems="center",v.style.padding="3px",v.style.width="20px",v.style.height="20px",this.logoUI.appendChild(v),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},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 v=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=v+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Qe(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new ot(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},X.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},X.prototype.removeMarker=function(v){this.markerImage.removeChild(v.container),this.markers.indexOf(v)>-1&&this.markers.splice(this.markers.indexOf(v),1),v.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(v,O){if(v==="marker"&&O!==void 0)this.createNewMarker(O);else if(v==="action")switch(O){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 v=this;if(this._currentMarker!==void 0){var O=!1;if(this.eventListeners.markerbeforedelete.forEach(function(te){var z=new sn(v,v._currentMarker,!0);te(z),z.defaultPrevented&&(O=!0)}),!O){var B=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(te){return te(new sn(v,B))})}}},X.prototype.clear=function(){var v=this,O=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(be){var tt=new sn(v,void 0,!0);be(tt),tt.defaultPrevented&&(O=!0)}),!O)){this.setCurrentMarker();for(var B=function(be){var tt=te.markers[be];te.setCurrentMarker(te.markers[be]),te._currentMarker.dispose(),te.markerImage.removeChild(te._currentMarker.container),te.markers.splice(te.markers.indexOf(te._currentMarker),1),te.eventListeners.markerdelete.forEach(function(Ot){return Ot(new sn(v,tt))})},te=this,z=this.markers.length-1;z>=0;z--)B(z);this.addUndoStep()}},Object.defineProperty(X.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),X.prototype.showNotesEditor=function(){var v;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(v=this._currentMarker.notes)!==null&&v!==void 0?v:"",this.overlayContainer.appendChild(this.notesArea))},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 v=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var O=this.getState(),B=this.undoRedoManager.getLastUndoStep();if(!B||B.width===O.width&&B.height===O.height){var te=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(O),te<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(z){return z(new zn(v))})}else this.undoRedoManager.replaceLastUndoStep(O),this.eventListeners.statechange.forEach(function(z){return z(new zn(v))})}},X.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},X.prototype.undoStep=function(){var v=this,O=this.undoRedoManager.undo();O!==void 0&&(this.restoreState(O),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(B){return B(new zn(v))}))},X.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},X.prototype.redoStep=function(){var v=this,O=this.undoRedoManager.redo();O!==void 0&&(this.restoreState(O),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(B){return B(new zn(v))}))},X.prototype.stepZoom=function(){var v=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=v<this.zoomSteps.length-1?this.zoomSteps[v+1]:this.zoomSteps[0]},X.prototype.panTo=function(v){this.contentDiv.scrollBy({left:this.prevPanPoint.x-v.x,top:this.prevPanPoint.y-v.y}),this.prevPanPoint=v},X.prototype.startRenderAndClose=function(){return We(this,void 0,void 0,function(){var v,O,B=this;return Ue(this,function(te){switch(te.label){case 0:return[4,this.render()];case 1:return v=te.sent(),O=this.getState(),this.eventListeners.render.forEach(function(z){return z(new Ln(B,v,O))}),this.close(!0),[2]}})})},X.prototype.getState=function(v){v===!0&&this.setCurrentMarker();var O={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(B){return O.markers.push(B.getState())}),O},X.prototype.restoreState=function(v){var O=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);v.markers.forEach(function(B){var te=O._availableMarkerTypes.find(function(be){return be.typeName===B.typeName});if(te!==void 0){var z=O.addNewMarker(te);z.restoreState(B),O.markers.push(z)}}),v.width&&v.height&&(v.width!==this.imageWidth||v.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/v.width,this.imageHeight/v.height),this.eventListeners.restorestate.forEach(function(B){return B(new zn(O))})},X.prototype.addNewMarker=function(v){var O=ue.createGroup();return this.markerImage.appendChild(O),new v(O,this.overlayContainer,this.settings)},X.prototype.createNewMarker=function(v){var O,B=this;(O=typeof v=="string"?this._availableMarkerTypes.find(function(te){return te.typeName===v}):v)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(O),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(O.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(te){return te(new sn(B,B._currentMarker))}))},X.prototype.markerCreated=function(v){var O=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(v),this.setCurrentMarker(v),v instanceof Be&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Be):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(B){return B(new sn(O,O._currentMarker))})},X.prototype.colorChanged=function(v){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=v,this.settings.defaultStrokeColor=v)},X.prototype.fillColorChanged=function(v){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=v)},X.prototype.markerStateChanged=function(v){var O=this;this.eventListeners.markerchange.forEach(function(B){return B(new sn(O,v))})},X.prototype.setCurrentMarker=function(v){var O=this;this._currentMarker!==v&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(B){return B(new sn(O,O._currentMarker))})),this._currentMarker=v,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(B){return B(new sn(O,O._currentMarker))}))},X.prototype.onPointerDown=function(v){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||v.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var O=this.markers.find(function(B){return B.ownsTarget(v.target)});O!==void 0?(this.setCurrentMarker(O),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(v.clientX,v.clientY),v.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:v.clientX,y:v.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(v.clientX,v.clientY))},X.prototype.onDblClick=function(v){if(this._isFocused||this.focus(),this.mode==="select"){var O=this.markers.find(function(B){return B.ownsTarget(v.target)});O!==void 0&&O!==this._currentMarker&&this.setCurrentMarker(O),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(v.clientX,v.clientY),v.target):this.setCurrentMarker()}},X.prototype.onPointerMove=function(v){this.touchPoints!==1&&v.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||v.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(v.clientX,v.clientY)):this.zoomLevel>1&&this.panTo({x:v.clientX,y:v.clientY}))},X.prototype.onPointerUp=function(v){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(v.clientX,v.clientY)),this.isDragging=!1,this.addUndoStep()},X.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},X.prototype.onKeyUp=function(v){this._currentMarker===void 0||this.notesArea!==void 0||v.key!=="Delete"&&v.key!=="Backspace"||this.deleteSelectedMarker()},X.prototype.clientToLocalCoordinates=function(v,O){var B=this.markerImage.getBoundingClientRect();return{x:(v-B.left)/this.zoomLevel,y:(O-B.top)/this.zoomLevel}},X.prototype.onWindowResize=function(){this.positionUI()},X.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var v=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=v+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},X.prototype.addLicenseKey=function(v){ae.addKey(v)},X.prototype.addEventListener=function(v,O){this.eventListeners.addEventListener(v,O)},X.prototype.removeEventListener=function(v,O){this.eventListeners.removeEventListener(v,O)},X.prototype.renderState=function(v){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(v),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(X.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),X.prototype.focus=function(){var v=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(O){return O(new zn(v))}))},X.prototype.blur=function(){var v=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(O){return O(new zn(v))}))},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 zi=function(X,v){return(zi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(O,B){O.__proto__=B}||function(O,B){for(var te in B)Object.prototype.hasOwnProperty.call(B,te)&&(O[te]=B[te])})(X,v)};function Oi(X,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");function O(){this.constructor=X}zi(X,v),X.prototype=v===null?Object.create(v):(O.prototype=v.prototype,new O)}function Qn(X,v,O,B){return new(O||(O=Promise))(function(te,z){function be(Ct){try{Ot(B.next(Ct))}catch(at){z(at)}}function tt(Ct){try{Ot(B.throw(Ct))}catch(at){z(at)}}function Ot(Ct){var at;Ct.done?te(Ct.value):(at=Ct.value,at instanceof O?at:new O(function(Yt){Yt(at)})).then(be,tt)}Ot((B=B.apply(X,v||[])).next())})}function ir(X,v){var O,B,te,z,be={label:0,sent:function(){if(1&te[0])throw te[1];return te[1]},trys:[],ops:[]};return z={next:tt(0),throw:tt(1),return:tt(2)},typeof Symbol=="function"&&(z[Symbol.iterator]=function(){return this}),z;function tt(Ot){return function(Ct){return function(at){if(O)throw new TypeError("Generator is already executing.");for(;be;)try{if(O=1,B&&(te=2&at[0]?B.return:at[0]?B.throw||((te=B.return)&&te.call(B),0):B.next)&&!(te=te.call(B,at[1])).done)return te;switch(B=0,te&&(at=[2&at[0],te.value]),at[0]){case 0:case 1:te=at;break;case 4:return be.label++,{value:at[1],done:!1};case 5:be.label++,B=at[1],at=[0];continue;case 7:at=be.ops.pop(),be.trys.pop();continue;default:if(!(te=be.trys,(te=te.length>0&&te[te.length-1])||at[0]!==6&&at[0]!==2)){be=0;continue}if(at[0]===3&&(!te||at[1]>te[0]&&at[1]<te[3])){be.label=at[1];break}if(at[0]===6&&be.label<te[1]){be.label=te[1],te=at;break}if(te&&be.label<te[2]){be.label=te[2],be.ops.push(at);break}te[2]&&be.ops.pop(),be.trys.pop();continue}at=v.call(X,be)}catch(Yt){at=[6,Yt],B=0}finally{O=te=0}if(5&at[0])throw at[1];return{value:at[0]?at[1]:void 0,done:!0}}([Ot,Ct])}}}var qi=function(){function X(){}return X.addKey=function(v){X.key=v},Object.defineProperty(X,"isLicensed",{get:function(){return!!X.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(X.key)},enumerable:!1,configurable:!0}),X}(),It=function(){function X(){}return X.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},X.setAttributes=function(v,O){for(var B=0,te=O;B<te.length;B++){var z=te[B],be=z[0],tt=z[1];v.setAttribute(be,tt)}},X.createRect=function(v,O,B){var te=document.createElementNS("http://www.w3.org/2000/svg","rect");return te.setAttribute("width",v.toString()),te.setAttribute("height",O.toString()),B&&X.setAttributes(te,B),te},X.createLine=function(v,O,B,te,z){var be=document.createElementNS("http://www.w3.org/2000/svg","line");return be.setAttribute("x1",v.toString()),be.setAttribute("y1",O.toString()),be.setAttribute("x2",B.toString()),be.setAttribute("y2",te.toString()),z&&X.setAttributes(be,z),be},X.createPolygon=function(v,O){var B=document.createElementNS("http://www.w3.org/2000/svg","polygon");return B.setAttribute("points",v),O&&X.setAttributes(B,O),B},X.createCircle=function(v,O){var B=document.createElementNS("http://www.w3.org/2000/svg","circle");return B.setAttribute("cx",(v/2).toString()),B.setAttribute("cy",(v/2).toString()),B.setAttribute("r",v.toString()),O&&X.setAttributes(B,O),B},X.createEllipse=function(v,O,B){var te=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return te.setAttribute("cx",(v/2).toString()),te.setAttribute("cy",(O/2).toString()),te.setAttribute("rx",(v/2).toString()),te.setAttribute("ry",(O/2).toString()),B&&X.setAttributes(te,B),te},X.createGroup=function(v){var O=document.createElementNS("http://www.w3.org/2000/svg","g");return v&&X.setAttributes(O,v),O},X.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},X.createMarker=function(v,O,B,te,z,be,tt){var Ot=document.createElementNS("http://www.w3.org/2000/svg","marker");return X.setAttributes(Ot,[["id",v],["orient",O],["markerWidth",B.toString()],["markerHeight",te.toString()],["refX",z.toString()],["refY",be.toString()]]),Ot.appendChild(tt),Ot},X.createText=function(v){var O=document.createElementNS("http://www.w3.org/2000/svg","text");return O.setAttribute("x","0"),O.setAttribute("y","0"),v&&X.setAttributes(O,v),O},X.createTSpan=function(v,O){var B=document.createElementNS("http://www.w3.org/2000/svg","tspan");return B.textContent=v,O&&X.setAttributes(B,O),B},X.createImage=function(v){var O=document.createElementNS("http://www.w3.org/2000/svg","image");return v&&X.setAttributes(O,v),O},X.createPoint=function(v,O){var B=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return B.x=v,B.y=O,B},X.createPath=function(v,O){var B=document.createElementNS("http://www.w3.org/2000/svg","path");return B.setAttribute("d",v),O&&X.setAttributes(B,O),B},X.createElement=function(v,O){var B=document.createElementNS("http://www.w3.org/2000/svg",v);return O&&X.setAttributes(B,O),B},X.getHollowRectanglePath=function(v,O,B,te,z,be,tt,Ot){return"M"+v+","+O+"V"+(O+te)+"H"+(v+B)+"V"+O+"H"+z+"V"+be+"H"+(z+tt)+"V"+(be+Ot)+"H"+z+"V"+O+"Z"},X}(),Hn=function(){function X(v){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+v+"_"}return Object.defineProperty(X.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),X.prototype.addClass=function(v){return this.styleSheet===void 0&&this.addStyleSheet(),v.name=""+this.classNamePrefix+v.localName,this.classes.push(v),this.styleSheet.sheet.insertRule("."+v.name+" {"+v.style+"}",this.styleSheet.sheet.cssRules.length),v},X.prototype.addRule=function(v){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(v),this.styleSheet.sheet.insertRule(v.selector+" {"+v.style+"}",this.styleSheet.sheet.cssRules.length)},X.prototype.addStyleSheet=function(){var v;this.styleSheet=document.createElement("style"),((v=this.styleSheetRoot)!==null&&v!==void 0?v:document.head).appendChild(this.styleSheet),this.addRule(new li("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new li("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new li("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new Gt("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new Gt("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},X.prototype.removeStyleSheet=function(){var v;this.styleSheet&&(((v=this.styleSheetRoot)!==null&&v!==void 0?v:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},X}(),li=function(X,v){this.selector=X,this.style=v},Gt=function(X,v){this.localName=X,this.style=v},Bt=function(){function X(){this.blocks=[],this.display=""}return X.prototype.addButtonBlock=function(v){v.className=this.blockClassName,v.buttonClassName=this.buttonClassName,v.buttonColorsClassName=this.buttonColorsClassName,v.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(v)},X.prototype.addElementBlock=function(v){v.className===void 0&&(v.className=this.blockClassName),this.blocks.push(v)},X.prototype.getUI=function(){var v=document.createElement("div");return v.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,v.style.display=this.display,this.blocks.forEach(function(O){return v.appendChild(O.getUI())}),v},X}(),Rn=function(){function X(){}return X.prototype.getUI=function(){var v=document.createElement("div");if(v.className=this.className,this.minWidth!==void 0&&(v.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":v.style.justifyContent="flex-start";break;case"center":v.style.justifyContent="center";break;case"end":v.style.justifyContent="flex-end"}return v.style.whiteSpace="nowrap",v},X}(),Wn=function(X){function v(){var O=X!==null&&X.apply(this,arguments)||this;return O.buttons=[],O}return Oi(v,X),v.prototype.addButton=function(O){O.className=this.buttonClassName,O.colorsClassName=this.buttonColorsClassName,O.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(O)},v.prototype.getUI=function(){var O=X.prototype.getUI.call(this);return this.buttons.forEach(function(B){return O.appendChild(B.getUI())}),O},v}(Rn),nn=function(){function X(v,O){this._isActive=!1,this._isHidden=!1,this._icon=v,this.title=O,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(X.prototype,"icon",{get:function(){return this._icon},set:function(v){this._icon=v,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isActive",{get:function(){return this._isActive},set:function(v){this._isActive=v,this.adjustClassName()},enumerable:!1,configurable:!0}),X.prototype.getUI=function(){var v=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return v.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},X.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},X.prototype.hide=function(){this._isHidden=!0},X}(),Pt=function(X){function v(){var O=X!==null&&X.apply(this,arguments)||this;return O.elements=[],O}return Oi(v,X),v.prototype.addElement=function(O){this.elements.push(O)},v.prototype.getUI=function(){var O=X.prototype.getUI.call(this);return this.elements.forEach(function(B){return O.appendChild(B)}),O},v}(Rn),Mi=function(){function X(v,O){this.horizontal=v,this.vertical=O}return Object.defineProperty(X.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),X.prototype.getVerticalLength=function(v){return v/this.ratio},X.prototype.getHorizontalLength=function(v){return v*this.ratio},X}(),$i=function(){function X(){}return X.getIcon=function(v,O){if(v>0&&O>0){var B=new Mi(v,O),te=B.ratio>=1?20:B.getHorizontalLength(20),z=B.ratio<1?20:B.getVerticalLength(20),be=document.createElementNS("http://www.w3.org/2000/svg","svg");be.setAttribute("xmlns","http://www.w3.org/2000/svg"),be.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(be);var tt=It.createDefs();be.appendChild(tt);var Ot=It.createElement("clipPath",[["id","text-bg-clip"]]);tt.appendChild(Ot);var Ct=It.createPath(It.getHollowRectanglePath((24-te)/2,(24-z)/2,te,z,(24-te)/2+2,(24-z)/2+2,te-4,z-4));be.appendChild(Ct);var at=It.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);at.appendChild(It.createTSpan(v+":"+O)),be.appendChild(at);var Yt=at.getBBox();It.setAttributes(at,[["x",((24-Yt.width)/2).toString()],["y",((24-Yt.height)/2-Yt.y).toString()]]);var Cn=It.createPath(It.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Yt.width))/2,(24-Math.ceil(Yt.height))/2,Math.ceil(Yt.width),Math.ceil(Yt.height)));return Ot.appendChild(Cn),It.setAttributes(Ct,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(be),be.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},X}(),ui=function(X){function v(O,B,te){var z=X.call(this,O,B)||this;return z.isDropdownOpen=!1,z.onClick=z.dropdownButtonClicked,z.dropdownButtons=te,z}return Oi(v,X),v.prototype.setupDropdown=function(){var O=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(B){B.className=O.className,B.colorsClassName=O.colorsClassName,O.dropdownBlock.appendChild(B.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},v.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},v.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},v.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},v.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},v.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},v}(nn),vn=function(){function X(v,O){this.GRIP_SIZE=10,this.color=v,this.fillColor=O,this.visual=It.createGroup(),this.visual.appendChild(It.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(It.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(v){return v===this.visual||v===this.visual.childNodes[0]||v===this.visual.childNodes[1]},X.prototype.setCenter=function(v,O){this.visual.childNodes.forEach(function(B){return It.setAttributes(B,[["cx",v.toString()],["cy",O.toString()]])})},X}(),Bi=function(){function X(v,O,B,te){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=v,this.canvasHeight=O,this.margin=B,this.container=te,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(v){this._aspectRatio=v,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(v){this._isGridVisible=v,this.gridContainer&&It.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(v){this._zoomFactor=v,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),X.prototype.open=function(){var v=this;this.cropShadeElement=It.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=It.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var O=0;O<this.numberOfGridLines;O++)this.horizontalGridLines.push(It.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(It.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(B){return v.gridContainer.appendChild(B)}),this.verticalGridLines.forEach(function(B){return v.gridContainer.appendChild(B)}),this.cropRectElement=It.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new vn(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new vn(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new vn(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new vn(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},X.prototype.setCropRectangle=function(v){this.cropRect=v;var O=Object.assign({},this.cropRect);this.zoomFactor!==1&&(O.width=this.cropRect.width*this.zoomFactor,O.height=this.cropRect.height*this.zoomFactor,O.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-O.width/2,O.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-O.height/2),It.setAttributes(this.cropRectElement,[["x",O.x.toString()],["y",O.y.toString()],["width",O.width.toString()],["height",O.height.toString()]]);var B=O.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(z,be){var tt=O.y+B*(be+1);It.setAttributes(z,[["x1",""+O.x],["y1",""+tt],["x2",""+(O.x+O.width)],["y2",""+tt]])});var te=O.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(z,be){var tt=O.x+te*(be+1);It.setAttributes(z,[["x1",""+tt],["y1",""+O.y],["x2",""+tt],["y2",""+(O.y+O.height)]])}),It.setAttributes(this.cropShadeElement,[["d",It.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,O.x,O.y,O.width,O.height)]]),this.topLeftGrip.setCenter(O.x,O.y),this.topRightGrip.setCenter(O.x+O.width,O.y),this.bottomLeftGrip.setCenter(O.x,O.y+O.height),this.bottomRightGrip.setCenter(O.x+O.width,O.y+O.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(v,O){var B=this.container.getBoundingClientRect();return{x:v-B.left+this.margin,y:O-B.top+this.margin}},X.prototype.onPointerDown=function(v){this.container.setPointerCapture(v.pointerId),this.previousPoint=this.clientToLocalCoordinates(v.clientX,v.clientY),this.cropRectElement===v.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(v.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(v.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(v.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(v.target)&&(this.activeGrip=this.bottomRightGrip)},X.prototype.onPointerMove=function(v){if(this.isMoving)this.move(this.clientToLocalCoordinates(v.clientX,v.clientY));else if(this.activeGrip){var O=this.clientToLocalCoordinates(v.clientX,v.clientY);this.resize(O)}v.preventDefault()},X.prototype.onPointerUp=function(v){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(v.pointerId)},X.prototype.move=function(v){var O=v.x-this.previousPoint.x,B=v.y-this.previousPoint.y;this.zoomFactor!==1&&(O=-O/this.zoomFactor,B=-B/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+O),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+B),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=v},X.prototype.resize=function(v){var O=Object.assign({},this.cropRect),B=v.x-this.previousPoint.x,te=v.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:O.x+B<this.margin&&(B=this.margin-O.x),O.x+=B,O.width=this.cropRect.x+this.cropRect.width-O.x;break;case this.bottomRightGrip:case this.topRightGrip:O.width+B>this.canvasWidth*this.zoomFactor&&(B=this.canvasWidth*this.zoomFactor-O.width),O.width+=B}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(O.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(B),O.height=this.aspectRatio.getVerticalLength(O.width)):(O.y+=te,O.height=this.cropRect.y+this.cropRect.height-O.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?O.height=this.aspectRatio.getVerticalLength(O.width):O.height+=te}O.width<10&&(O.x=this.cropRect.x,O.width=10),O.height<10&&(O.y=this.cropRect.y,O.height=10),this.previousPoint=v,O.x>=this.margin&&O.y>=this.margin&&O.x-this.margin+O.width<=this.canvasWidth&&O.y-this.margin+O.height<=this.canvasHeight&&(this.cropRect=O,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 v=this.cropRect.x+this.cropRect.width/2,O=this.cropRect.y+this.cropRect.height/2,B=this.aspectRatio.getHorizontalLength(this.cropRect.height),te=this.aspectRatio.getVerticalLength(this.cropRect.width);B/this.canvasWidth<te/this.canvasHeight?this.cropRect.width=B:this.cropRect.height=te,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=v-this.cropRect.width/2,this.cropRect.y=O-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(v,O,B,te,z,be){var tt=B/v,Ot=te/O;return{x:(z.x-be)*tt+be,y:(z.y-be)*Ot+be,width:z.width*tt,height:z.height*Ot}},X.prototype.scaleCanvas=function(v,O){var B=this.getRescaledRect(this.canvasWidth,this.canvasHeight,v,O,this.cropRect,this.margin);this.canvasWidth=v,this.canvasHeight=O,this.onCropChange&&this.onCropChange(B),this.setCropRectangle(B)},X}(),Ai=function(){function X(v){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=v,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(X.prototype,"angle",{get:function(){return this._angle},set:function(v){this._angle=v,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(v){this.controlContainer.setPointerCapture(v.pointerId),this.isDragging=!0,this.previousPoint={x:v.clientX,y:v.clientY}},X.prototype.onPointerMove=function(v){this.isDragging&&(this.onAngleChange&&this.onAngleChange((v.clientX-this.previousPoint.x)/5),this.previousPoint.x=v.clientX)},X.prototype.onPointerUp=function(v){this.isDragging&&this.onAngleChange&&this.onAngleChange((v.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(v.pointerId)},X.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var v=this.angleLabelText.getBBox();It.setAttributes(this.angleLabelElement,[["x",((this.width-v.width)/2).toString()],["y",(this.height/2).toString()]])}},X.prototype.positionScaleShape=function(){if(this.scaleShape){var v=this.scaleShape.transform.baseVal.getItem(0);v.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(v,0)}},X.prototype.getVisual=function(){var v=document.createElementNS("http://www.w3.org/2000/svg","svg");v.setAttribute("xmlns","http://www.w3.org/2000/svg"),v.setAttribute("width",this.width+"px"),v.setAttribute("height",this.height+"px"),v.setAttribute("viewBox","0 0 "+this.width+" "+this.height),v.style.flexShrink="0",document.body.appendChild(v);for(var O="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,B=1;B<=this.width/5+10;B++){var te=B%5==0?this.height/3:this.height/6;O+="h4v"+-te+"h1v"+te}O+="v1H0Z",this.scaleShape=It.createPath(O);var z=It.createTransform();this.scaleShape.transform.baseVal.appendItem(z),v.appendChild(this.scaleShape),this.angleLabelElement=It.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=It.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var be=It.createTSpan("");return be.innerHTML="°",this.angleLabelElement.appendChild(be),v.appendChild(this.angleLabelElement),document.body.removeChild(v),v},X}(),Pi=function(){function X(){this.naturalSize=!1,this.imageType="image/png"}return X.prototype.rasterize=function(v,O,B,te,z,be,tt){var Ot=this;return new Promise(function(Ct){var at=document.createElement("canvas");at.width=v.width.baseVal.value-2*te,at.height=v.height.baseVal.value-2*te;var Yt=1,Cn=1;Ot.naturalSize===!0?(Yt=O.naturalWidth/(v.width.baseVal.value-2*te)/be,Cn=O.naturalHeight/(v.height.baseVal.value-2*te)/tt,at.width=O.naturalWidth/be,at.height=O.naturalHeight/tt):Ot.width!==void 0&&Ot.height!==void 0&&(Yt=Ot.width/B.width,Cn=Ot.height/B.height,at.width*=Yt,at.height*=Cn);var Nn=at.getContext("2d");Nn.translate(at.width/2,at.height/2),Nn.rotate(z*Math.PI/180),Nn.scale(be,tt),Nn.translate(-at.width/2,-at.height/2),Nn.drawImage(O,0,0,at.width,at.height);var Hi=document.createElement("canvas");Hi.width=B.width*Yt,Hi.height=B.height*Cn,Hi.getContext("2d").putImageData(Nn.getImageData((B.x-te)*Yt,(B.y-te)*Cn,B.width*Yt,B.height*Cn),0,0),Ct(Hi.toDataURL(Ot.imageType,Ot.imageQuality))})},X}(),ct=function(){function X(v){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=X.instanceCounter++,this.styles=new Hn(this.instanceNo),this.target=v,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(X.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(v){this._zoomToCropEnabled=v,v?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(v){this._isGridVisible=v,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"gridLines",{get:function(){return this._gridLines},set:function(v){this._gridLines=v,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(v){this._rotationAngle=v,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(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 v;return(v=this._aspectRatio)!==null&&v!==void 0?v:this.aspectRatios[0]},set:function(v){this._aspectRatio=v},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(v){v===void 0&&(v=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),v||this.closeEventListeners.forEach(function(O){return O()}),this._isOpen=!1)},X.prototype.addRenderEventListener=function(v){this.renderEventListeners.push(v)},X.prototype.removeRenderEventListener=function(v){this.renderEventListeners.indexOf(v)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(v),1)},X.prototype.addCloseEventListener=function(v){this.closeEventListeners.push(v)},X.prototype.removeCloseEventListener=function(v){this.closeEventListeners.indexOf(v)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(v),1)},X.prototype.setupResizeObserver=function(){var v=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){v.resize(v.target.clientWidth,v.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},X.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var v=1*this.target.clientWidth/this.target.clientHeight,O=this.contentDiv.clientWidth/v>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*v:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,B=O+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/v;this.resize(O,B)}},X.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},X.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",It.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},X.prototype.resize=function(v,O){this.imageWidth=Math.round(v),this.imageHeight=Math.round(O),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},X.prototype.setEditingTarget=function(){var v=document.createElement("canvas");v.width=this.target.naturalWidth,v.height=this.target.naturalHeight,v.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var O=v.toDataURL();It.setAttributes(this.editingTarget,[["href",O]]),this.setEditingTargetSize()},X.prototype.setTopLeft=function(){var v=this.target.getBoundingClientRect(),O=this.editorCanvas.getBoundingClientRect();this.left=v.left-O.left-this.CANVAS_MARGIN,this.top=v.top-O.top-this.CANVAS_MARGIN},X.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=It.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=It.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=It.createGroup(),this.editingTargetRotationScaleContainer=It.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var v=It.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(v);var O=It.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(O),this.editingTargetContainer=It.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},X.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},X.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=It.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Bi(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},X.prototype.zoomToCrop=function(){if(this.cropRect){var v=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,O=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=v+"px "+O+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-v+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-O+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},X.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},X.prototype.cropRectChanged=function(v){this.cropRect=v,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},X.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},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.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var v=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,O=this.target.offsetTop>v+this.CANVAS_MARGIN?this.target.offsetTop-(v+this.CANVAS_MARGIN):0;this.coverDiv.style.top=O+"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 v=this;this.topToolbar=new Bt,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 O=new Wn;O.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(O);var B=[];this.aspectRatios.forEach(function(Cn){var Nn=new nn($i.getIcon(Cn.horizontal,Cn.vertical),Cn.horizontal===0&&Cn.vertical===0?"FREE":Cn.horizontal+":"+Cn.vertical);Nn.onClick=function(){return v.ratioButtonClicked(Cn)},B.push(Nn)}),this.aspectRatioButton=new ui($i.getIcon(0,0),"Aspect ratio",B),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,O.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var te=new nn('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");te.isActive=this.isGridVisible,te.onClick=function(){v.isGridVisible=!v.isGridVisible,te.isActive=v.isGridVisible},O.addButton(te);var z=new nn('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(z.isActive=this.zoomToCropEnabled,z.onClick=function(){v.zoomToCropEnabled=!v.zoomToCropEnabled,z.isActive=v.zoomToCropEnabled},O.addButton(z),!qi.isLicensed){var be=new Pt;this.topToolbar.addElementBlock(be);var tt=document.createElement("div");tt.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Ot=document.createElement("a");Ot.style.color="currentColor",Ot.href="https://markerjs.com/products/cropro",Ot.target="_blank",Ot.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',tt.appendChild(Ot),be.addElement(tt)}var Ct=new Wn;Ct.minWidth=3*this.toolbarHeight+"px",Ct.contentAlign="end",this.topToolbar.addButtonBlock(Ct);var at=new nn('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");at.onClick=this.startRenderAndClose,Ct.addButton(at),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(at.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Yt=new nn('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");Yt.onClick=this.close,Ct.addButton(Yt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Yt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},X.prototype.addBottomToolbar=function(){var v=this;this.bottomToolbar=new Bt,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 O=new Wn;O.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(O);var B=new nn('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");B.onClick=this.rotateLeftButtonClicked,O.addButton(B);var te=new nn('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");te.onClick=this.rotateRightButtonClicked,O.addButton(te);var z=new Pt;z.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(z),this.straightener=new Ai("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(Ct){v.rotateBy(Ct),v.straightener.angle=v.rotationAngle},z.addElement(this.straightener.getUI());var be=new Wn;be.minWidth=2*this.toolbarHeight+"px",be.contentAlign="end",this.bottomToolbar.addButtonBlock(be);var tt=new nn('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");tt.onClick=this.flipHorizontallyButtonClicked,be.addButton(tt);var Ot=new nn('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");Ot.onClick=this.flipVerticallyButtonClicked,be.addButton(Ot)},X.prototype.ratioButtonClicked=function(v){this.aspectRatio=v,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},X.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=$i.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 Mi(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(v){if(v){var O=this.cropLayer.getRescaledRect(v.width,v.height,this.imageWidth,this.imageHeight,v.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(O),this.cropRectChanged(O),this.flippedHorizontally=v.flippedHorizontally,this.flippedVertically=v.flippedVertically,this.applyFlip(),this.rotationAngle=v.rotationAngle,this.applyRotation()}},X.prototype.clientToLocalCoordinates=function(v,O){var B=this.cropImage.getBoundingClientRect();return{x:v-B.left,y:O-B.top}},X.prototype.onWindowResize=function(){this.positionUI()},X.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var v=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=v+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},X.prototype.rotateLeftButtonClicked=function(){var v=this.rotationAngle-90;this.rotationAngle%90!=0&&(v+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(v)},X.prototype.rotateRightButtonClicked=function(){var v=this.rotationAngle+90;this.rotationAngle%90!=0&&(v-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(v)},X.prototype.rotateTo=function(v){v=(v=v>180?v-360:v)<=-180?v+360:v,this.rotationAngle=v,this.applyRotation()},X.prototype.rotateBy=function(v){this.rotateTo((this.rotationAngle+v)%360)},X.prototype.applyRotation=function(){var v=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var O=this.editingTargetRotationContainer.transform.baseVal.getItem(0);O.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(O,0);var B=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/B.width,this.imageHeight/B.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=v},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 Qn(this,void 0,void 0,function(){var v,O;return ir(this,function(B){switch(B.label){case 0:return[4,this.render()];case 1:return v=B.sent(),O=this.getState(),this.renderEventListeners.forEach(function(te){return te(v,O)}),this.close(!0),[2]}})})},X.prototype.render=function(){return Qn(this,void 0,void 0,function(){var v;return ir(this,function(O){switch(O.label){case 0:return(v=new Pi).naturalSize=this.renderAtNaturalSize,v.imageType=this.renderImageType,v.imageQuality=this.renderImageQuality,v.width=this.renderWidth,v.height=this.renderHeight,this.unzoomFromCrop(),It.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,v.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return O.sent(),[4,v.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,O.sent()]}})})},X.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Gt("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 Gt("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Gt("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var v=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Gt("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*v)+`px;
|
|
height: `+(this.toolbarHeight-2*v)+`px;
|
|
padding: `+v+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Gt("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Gt("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new li("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new li("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new Gt("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 Gt("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Gt("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 Gt("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*v)+`px;
|
|
padding: `+v+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Gt("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},X.instanceCounter=0,X}(),Zt=q("8hTe"),Ei=q.n(Zt),ji=/<pre[^>]*>/g;function ri(X){var v=document.createElement("div");return v.innerHTML=X,v.childNodes.length===0?"":v.childNodes[0].nodeValue}var ii=_t.a=function(X){var v=X.value,O=v===void 0?"":v,B=X.edit,te=B===void 0?!1:B,z=X.className,be=X.showTextOnly,tt=X.showLines,Ot=X.replaces,Ct=X.zoomImg,at=X.hasMask,Yt=X.style,Cn=Yt===void 0?{}:Yt,Nn=X.stylesPrev,Hi=Nn===void 0?{}:Nn,Ri=String(O),fi=Object(R.useRef)(),sr=Object(R.useRef)(),rr=Object(R.useState)(""),wi=Object(H.a)(rr,2),lr=wi[0],mr=wi[1],ai=Object(R.useState)("office"),on=Object(H.a)(ai,2),ci=on[0],Qt=on[1],di=function(){var Me=new ct(sr.current);Me.displayMode="popup",Me.addRenderEventListener(function(){var $e=Object(U.a)(F.a.mark(function Ye(ut){var Ze;return F.a.wrap(function(lt){for(;;)switch(lt.prev=lt.next){case 0:return fi.current.style.display="none",lt.next=3,Object(Ne.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ut}});case 3:Ze=lt.sent,Ze!=null&&Ze.id&&Ot(sr.current.getAttribute("src").replace(J.a.API_SERVER,""),"/api/attachments/".concat(Ze==null?void 0:Ze.id,"?type=").concat(Ze.content_type));case 5:case"end":return lt.stop()}},Ye)}));return function(Ye){return $e.apply(this,arguments)}}()),Me.show()},Fn=function(){var Me=new si(sr.current);Me.settings.displayMode="popup",Me.addEventListener("render",function(){var $e=Object(U.a)(F.a.mark(function Ye(ut){var Ze;return F.a.wrap(function(lt){for(;;)switch(lt.prev=lt.next){case 0:if(fi.current.style.display="none",!sr.current){lt.next=6;break}return lt.next=4,Object(Ne.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ut.dataUrl}});case 4:Ze=lt.sent,Ze!=null&&Ze.id&&Ot(sr.current.getAttribute("src").replace(J.a.API_SERVER,""),"/api/attachments/".concat(Ze==null?void 0:Ze.id,"?type=").concat(Ze.content_type));case 6:case"end":return lt.stop()}},Ye)}));return function(Ye){return $e.apply(this,arguments)}}()),Me.show(),window.markerArea=Me},bi=Object(R.useMemo)(function(){fi.current&&(fi.current.style.zIndex=-1);try{var Ge=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Me=/\"\/api\/attachments\/|\"\/attachments\/download\//g,$e=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Ri=Ri.replace(Ge,"("+J.a.API_SERVER+"/api/attachments/").replace(Me,'"'+J.a.API_SERVER+"/api/attachments/").replace($e,'"'+J.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(dt){}var Ye=W(Ri),ut=E();if(Ri.match(/\[TOC\]/)&&(Ye=Ye.replace("<p>[TOC]</p>",A()),L()),Ye=Ye.replace(/(__special_katext_id_\d+__)/g,function(dt,lt){var nt=ut[lt],Et=nt.type,pt=nt.expression;return Object(oe.renderToString)(ri(pt)||"",{displayMode:Et==="block",throwOnError:!1,output:"html"})}),Ye=Ye.replace(/▁/g,"\u2581\u2581\u2581"),m(),be){var Ze=document.createElement("div");return Ze.innerHTML=Ye,Ze.innerText}return setTimeout(function(){return Oe()},500),Ye},[Ri]),$=Object(R.useRef)();C.WebkitLineClamp=tt,tt&&(Cn=Object(D.a)(Object(D.a)({},Cn),C));function pe(Ge){var Me=Ge.target;if(Me.tagName.toUpperCase()==="IMG"){if(Ct){var $e=Me.getAttribute("src");mr($e),Qt("image")}}else if(Me.tagName.toUpperCase()==="A"){var Ye=Me.getAttribute("href");if(Ye.indexOf("office")>-1)Ge.preventDefault(),mr(Ye),Qt("office");else if(Ye.indexOf("application/pdf")>-1)Ge.preventDefault(),mr(Ye),Qt("pdf");else if(Ye.indexOf("text/html")>-1)Ge.preventDefault(),mr(Ye),Qt("html");else if(Ye.startsWith("#")){Ge.preventDefault();var ut=document.getElementById(Ye.replace("#",""));ut&&ut.scrollIntoView(!0)}}}var Oe=function(){var Me,$e=(Me=$.current)===null||Me===void 0?void 0:Me.querySelectorAll("video");$e==null||$e.forEach(function(Ye){if(Ye.oncontextmenu=function(){return!1},Ye.src.indexOf(".m3u8")>-1&&!Ye.canPlayType("application/vnd.apple.mpegurl")){if(G.a.isSupported()){var ut=new G.a;ut.loadSource(Ye.src),ut.attachMedia(Ye)}}})};Object(R.useEffect)(function(){if($.current&&bi&&(bi.match(ji)&&window.PR.prettyPrint()),$.current)return $.current.addEventListener("click",pe),function(){$.current.removeEventListener("click",pe),m(),L()}},[bi,$.current,pe]);var Re=function(Me){if(!te)return;Me.target.nodeName==="IMG"?(fi.current.style.zIndex=1,fi.current.style.display="flex",fi.current.style.width=Me.target.clientWidth+"px",fi.current.style.height=Me.target.clientHeight+"px",fi.current.style.top=Me.target.offsetTop+"px",fi.current.style.left=Me.target.offsetLeft+"px",sr.current.src=Me.target.getAttribute("src")):fi.current.style.display="none"};return g.a.createElement("div",{style:{position:"relative"}},g.a.createElement("div",{ref:$,style:Object(D.a)({},Cn),className:"".concat(z||""," markdown-body ").concat(Ei.a.mdBody),onMouseOver:Re,dangerouslySetInnerHTML:{__html:bi}}),g.a.createElement("div",{ref:fi,className:Ei.a.button},g.a.createElement(Q.a,null,g.a.createElement(Y.a,{onClick:function(){return di()}},"\u88C1\u526A"),g.a.createElement(Y.a,{onClick:function(){return Fn()}},"\u7F16\u8F91"))),g.a.createElement("img",{ref:sr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),g.a.createElement(fe.a,{close:!0,data:lr,type:lr!=null&&lr.length?ci:"",style:Object(D.a)({},Hi),onClose:function(){return mr("")}}))}},"9VGf":function(Mt,_t,q){"use strict";q.d(_t,"a",function(){return P});var le=q("q1tI"),Q=q.n(le);function P(Y,D){var U=Object(le.useRef)();Object(le.useEffect)(function(){U.current=Y}),Object(le.useEffect)(function(){function H(){U.current()}if(D!==null){var I=setInterval(H,D);return function(){return clearInterval(I)}}},[D])}},"9ZNV":function(Mt,_t,q){"use strict";q.d(_t,"a",function(){return R});var le=q("0Owb"),Q=q("+L6B"),P=q("2/Rp"),Y=q("q1tI"),D=q.n(Y),U=q("UUDw"),H=q.n(U),I=q("TSYQ"),F=q.n(I),R=function(p){var d=p.cancelText,l=d===void 0?"\u53D6\u6D88":d,n=p.okText,c=n===void 0?"\u786E\u5B9A":n,s=p.loading,a=s===void 0?!1:s,o=p.hasOkBtn,f=o===void 0?!0:o,L=p.okButtonProps,C=L===void 0?{}:L,x=p.onCancel,A=x===void 0?function(){}:x,w=p.onOk,_=w===void 0?function(){}:w,S=p.className,y=S===void 0?"":S;return D.a.createElement("div",{className:F()(H.a.buttonFixed,y)},D.a.createElement("div",{className:H.a.buttonWrap},D.a.createElement(P.a,{size:"large",className:"".concat(H.a.button," mr20"),onClick:A},l),f&&D.a.createElement(P.a,Object(le.a)({size:"large",type:"primary",className:"".concat(H.a.button," mr20"),loading:a,onClick:_},C),c)))}},"9vSm":function(Mt,_t,q){Mt.exports={flexRow:"flexRow___A0xBf",flexJustifyCenter:"flexJustifyCenter___3QSKR",flexAlignEnd:"flexAlignEnd___95Moc",flexAlignCenter:"flexAlignCenter___eHO4B",flexColumn:"flexColumn___1uvhT",formWrap:"formWrap___9AvVx",titleWrap:"titleWrap___2HsrT",fieldWrap:"fieldWrap___UGyUz",button:"button___1mji8",buttonFixed:"buttonFixed___2BGo6",buttonWrap:"buttonWrap___1Qeu8",width180:"width180___29K1C",width100:"width100___1any1",width280:"width280___2qisO",difficultyHint:"difficultyHint____Es-o",color888:"color888___3hL78",color0152d9:"color0152d9___2miMV",serviceSettingWrap:"serviceSettingWrap___D3PA-",serviceSettingName:"serviceSettingName___JtYbt",serviceSetLeft:"serviceSetLeft___1asKi",serviceSetInput:"serviceSetInput___2nd2c",serviceSetMemoryInput:"serviceSetMemoryInput___BCcbj",serviceSetTip:"serviceSetTip___3kYoT",installPackage:"installPackage___2EEZm",popover:"popover___17dH6"}},BU3w:function(Mt,_t,q){"use strict";q.d(_t,"a",function(){return U});var le=q("MNnm"),Q="rc-util-key";function P(H){if(H.attachTo)return H.attachTo;var I=document.querySelector("head");return I||document.body}function Y(H){var I,F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(le.a)())return null;var R=document.createElement("style");if((I=F.csp)===null||I===void 0?void 0:I.nonce){var g;R.nonce=(g=F.csp)===null||g===void 0?void 0:g.nonce}R.innerHTML=H;var p=P(F),d=p.firstChild;return F.prepend&&p.prepend?p.prepend(R):F.prepend&&d?p.insertBefore(R,d):p.appendChild(R),R}var D=new Map;function U(H,I){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=P(F);if(!D.has(R)){var g=Y("",F),p=g.parentNode;D.set(R,p),p.removeChild(g)}var d=Array.from(D.get(R).children).find(function(a){return a.tagName==="STYLE"&&a[Q]===I});if(d){var l,n;if(((l=F.csp)===null||l===void 0?void 0:l.nonce)&&d.nonce!==((n=F.csp)===null||n===void 0?void 0:n.nonce)){var c;d.nonce=(c=F.csp)===null||c===void 0?void 0:c.nonce}return d.innerHTML!==H&&(d.innerHTML=H),d}var s=Y(H,F);return s[Q]=I,s}},Bd2K:function(Mt,_t,q){(function(le){le(q("VrN/"),q("osHv"))})(function(le){le.defineOption("autoCloseTags",!1,function(F,R,g){if(g!=le.Init&&g&&F.removeKeyMap("autoCloseTags"),!R)return;var p={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(p["'/'"]=function(d){return U(d)}),(typeof R!="object"||R.whenOpening!==!1)&&(p["'>'"]=function(d){return Y(d)}),F.addKeyMap(p)});var Q=["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 Y(F){if(F.getOption("disableInput"))return le.Pass;for(var R=F.listSelections(),g=[],p=F.getOption("autoCloseTags"),d=0;d<R.length;d++){if(!R[d].empty())return le.Pass;var l=R[d].head,n=F.getTokenAt(l),c=le.innerMode(F.getMode(),n.state),s=c.state,a=c.mode.xmlCurrentTag&&c.mode.xmlCurrentTag(s),o=a&&a.name;if(!o)return le.Pass;var f=c.mode.configuration=="html",L=typeof p=="object"&&p.dontCloseTags||f&&Q,C=typeof p=="object"&&p.indentTags||f&&P;n.end>l.ch&&(o=o.slice(0,o.length-n.end+l.ch));var x=o.toLowerCase();if(!o||n.type=="string"&&(n.end!=l.ch||!/[\"\']/.test(n.string.charAt(n.string.length-1))||n.string.length==1)||n.type=="tag"&&a.close||n.string.indexOf("/")==l.ch-n.start-1||L&&H(L,x)>-1||I(F,c.mode.xmlCurrentContext&&c.mode.xmlCurrentContext(s)||[],o,l,!0))return le.Pass;var A=typeof p=="object"&&p.emptyTags;if(A&&H(A,o)>-1){g[d]={text:"/>",newPos:le.Pos(l.line,l.ch+2)};continue}var w=C&&H(C,x)>-1;g[d]={indent:w,text:">"+(w?`
|
|
|
|
`:"")+"</"+o+">",newPos:w?le.Pos(l.line+1,0):le.Pos(l.line,l.ch+1)}}for(var _=typeof p=="object"&&p.dontIndentOnAutoClose,d=R.length-1;d>=0;d--){var S=g[d];F.replaceRange(S.text,R[d].head,R[d].anchor,"+insert");var y=F.listSelections().slice(0);y[d]={head:S.newPos,anchor:S.newPos},F.setSelections(y),!_&&S.indent&&(F.indentLine(S.newPos.line,null,!0),F.indentLine(S.newPos.line+1,null,!0))}}function D(F,R){for(var g=F.listSelections(),p=[],d=R?"/":"</",l=F.getOption("autoCloseTags"),n=typeof l=="object"&&l.dontIndentOnSlash,c=0;c<g.length;c++){if(!g[c].empty())return le.Pass;var s=g[c].head,a=F.getTokenAt(s),o=le.innerMode(F.getMode(),a.state),f=o.state;if(R&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=s.ch-1))return le.Pass;var L,C=o.mode.name!="xml"&&F.getMode().name=="htmlmixed";if(C&&o.mode.name=="javascript")L=d+"script";else if(C&&o.mode.name=="css")L=d+"style";else{var x=o.mode.xmlCurrentContext&&o.mode.xmlCurrentContext(f);if(!x||x.length&&I(F,x,x[x.length-1],s))return le.Pass;L=d+x[x.length-1]}F.getLine(s.line).charAt(a.end)!=">"&&(L+=">"),p[c]=L}if(F.replaceSelections(p),g=F.listSelections(),!n)for(var c=0;c<g.length;c++)(c==g.length-1||g[c].head.line<g[c+1].head.line)&&F.indentLine(g[c].head.line)}function U(F){return F.getOption("disableInput")?le.Pass:D(F,!0)}le.commands.closeTag=function(F){return D(F)};function H(F,R){if(F.indexOf)return F.indexOf(R);for(var g=0,p=F.length;g<p;++g)if(F[g]==R)return g;return-1}function I(F,R,g,p,d){if(!le.scanForClosingTag)return!1;var l=Math.min(F.lastLine()+1,p.line+500),n=le.scanForClosingTag(F,p,null,l);if(!n||n.tag!=g)return!1;for(var c=d?1:0,s=R.length-1;s>=0&&R[s]==g;s--)++c;p=n.to;for(var s=1;s<c;s++){var a=le.scanForClosingTag(F,p,null,l);if(!a||a.tag!=g)return!1;p=a.to}return!0}})},BjJ7:function(Mt,_t,q){"use strict";q.d(_t,"d",function(){return Q}),q.d(_t,"c",function(){return P}),q.d(_t,"e",function(){return Y}),q.d(_t,"b",function(){return D}),q.d(_t,"a",function(){return H});var le=q("m3rI");function Q(I){var F=!0;if(I.length>0){for(var R=0;R<I.length;R++)if(I[R].compile_success==0||!I[R].compile_success){F=!1;break}}else F=!1;return F}function P(I){for(var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],g=0;g<I.length;g++){var p=I[g],d=F?"".concat(F,"/").concat(p.name):"".concat(p.name);R.push({title:p.name,isLeaf:!(p.type==="tree"),key:d})}return R}function Y(I,F,R){for(var g=0;g<I.length;g++){var p=I[g];if(p.key===F){p.children=R;break}p.children&&Y(p.children,F,R)}return I}function D(I,F,R){var g;return function(){var p=this,d=arguments,l=function(){g=null,R||I.apply(p,d)},n=R&&!g;clearTimeout(g),g=setTimeout(l,F),n&&I.apply(p,d)}}var U=!0,H=le.a.API_SERVER},"C+DQ":function(Mt,_t,q){},DlQD:function(Mt,_t,q){(function(le,Q){Mt.exports=Q()})(this,function(){"use strict";function le(Be,Ae){for(var Ie=0;Ie<Ae.length;Ie++){var se=Ae[Ie];se.enumerable=se.enumerable||!1,se.configurable=!0,"value"in se&&(se.writable=!0),Object.defineProperty(Be,se.key,se)}}function Q(Be,Ae,Ie){return Ae&&le(Be.prototype,Ae),Ie&&le(Be,Ie),Be}function P(Be,Ae){if(!Be)return;if(typeof Be=="string")return Y(Be,Ae);var Ie=Object.prototype.toString.call(Be).slice(8,-1);if(Ie==="Object"&&Be.constructor&&(Ie=Be.constructor.name),Ie==="Map"||Ie==="Set")return Array.from(Be);if(Ie==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ie))return Y(Be,Ae)}function Y(Be,Ae){(Ae==null||Ae>Be.length)&&(Ae=Be.length);for(var Ie=0,se=new Array(Ae);Ie<Ae;Ie++)se[Ie]=Be[Ie];return se}function D(Be,Ae){var Ie;if(typeof Symbol=="undefined"||Be[Symbol.iterator]==null){if(Array.isArray(Be)||(Ie=P(Be))||Ae&&Be&&typeof Be.length=="number"){Ie&&(Be=Ie);var se=0;return function(){return se>=Be.length?{done:!0}:{done:!1,value:Be[se++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return Ie=Be[Symbol.iterator](),Ie.next.bind(Ie)}function U(Be,Ae){return Ae={exports:{}},Be(Ae,Ae.exports),Ae.exports}var H=U(function(Be){function Ae(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function Ie(se){Be.exports.defaults=se}Be.exports={defaults:Ae(),getDefaults:Ae,changeDefaults:Ie}}),I=H.defaults,F=H.getDefaults,R=H.changeDefaults,g=/[&<>"']/,p=/[&<>"']/g,d=/[<>"']|&(?!#?\w+;)/,l=/[<>"']|&(?!#?\w+;)/g,n={"&":"&","<":"<",">":">",'"':""","'":"'"},c=function(Ae){return n[Ae]};function s(Be,Ae){if(Ae){if(g.test(Be))return Be.replace(p,c)}else if(d.test(Be))return Be.replace(l,c);return Be}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function o(Be){return Be.replace(a,function(Ae,Ie){return Ie=Ie.toLowerCase(),Ie==="colon"?":":Ie.charAt(0)==="#"?Ie.charAt(1)==="x"?String.fromCharCode(parseInt(Ie.substring(2),16)):String.fromCharCode(+Ie.substring(1)):""})}var f=/(^|[^\[])\^/g;function L(Be,Ae){Be=Be.source||Be,Ae=Ae||"";var Ie={replace:function(ce,ye){return ye=ye.source||ye,ye=ye.replace(f,"$1"),Be=Be.replace(ce,ye),Ie},getRegex:function(){return new RegExp(Be,Ae)}};return Ie}var C=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(Be,Ae,Ie){if(Be){var se;try{se=decodeURIComponent(o(Ie)).replace(C,"").toLowerCase()}catch(ce){return null}if(se.indexOf("javascript:")===0||se.indexOf("vbscript:")===0||se.indexOf("data:")===0)return null}Ae&&!x.test(Ie)&&(Ie=h(Ae,Ie));try{Ie=encodeURI(Ie).replace(/%25/g,"%")}catch(ce){return null}return Ie}var w={},_=/^[^:]+:\/*[^/]*$/,S=/^([^:]+:)[\s\S]*$/,y=/^([^:]+:\/*[^/]*)[\s\S]*$/;function h(Be,Ae){w[" "+Be]||(_.test(Be)?w[" "+Be]=Be+"/":w[" "+Be]=j(Be,"/",!0)),Be=w[" "+Be];var Ie=Be.indexOf(":")===-1;return Ae.substring(0,2)==="//"?Ie?Ae:Be.replace(S,"$1")+Ae:Ae.charAt(0)==="/"?Ie?Ae:Be.replace(y,"$1")+Ae:Be+Ae}var E={exec:function(){}};function m(Be){for(var Ae=1,Ie,se;Ae<arguments.length;Ae++){Ie=arguments[Ae];for(se in Ie)Object.prototype.hasOwnProperty.call(Ie,se)&&(Be[se]=Ie[se])}return Be}function T(Be,Ae){var Ie=Be.replace(/\|/g,function(ye,Se,ke){for(var et=!1,yt=Se;--yt>=0&&ke[yt]==="\\";)et=!et;return et?"|":" |"}),se=Ie.split(/ \|/),ce=0;if(se.length>Ae)se.splice(Ae);else for(;se.length<Ae;)se.push("");for(;ce<se.length;ce++)se[ce]=se[ce].trim().replace(/\\\|/g,"|");return se}function j(Be,Ae,Ie){var se=Be.length;if(se===0)return"";for(var ce=0;ce<se;){var ye=Be.charAt(se-ce-1);if(ye===Ae&&!Ie)ce++;else if(ye!==Ae&&Ie)ce++;else break}return Be.substr(0,se-ce)}function N(Be,Ae){if(Be.indexOf(Ae[1])===-1)return-1;for(var Ie=Be.length,se=0,ce=0;ce<Ie;ce++)if(Be[ce]==="\\")ce++;else if(Be[ce]===Ae[0])se++;else if(Be[ce]===Ae[1]&&(se--,se<0))return ce;return-1}function K(Be){Be&&Be.sanitize&&!Be.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var W={escape:s,unescape:o,edit:L,cleanUrl:A,resolveUrl:h,noopTest:E,merge:m,splitCells:T,rtrim:j,findClosingBracket:N,checkSanitizeDeprecation:K},k=H.defaults,b=W.rtrim,G=W.splitCells,J=W.escape,oe=W.findClosingBracket;function fe(Be,Ae,Ie){var se=Ae.href,ce=Ae.title?J(Ae.title):null,ye=Be[1].replace(/\\([\[\]])/g,"$1");return Be[0].charAt(0)!=="!"?{type:"link",raw:Ie,href:se,title:ce,text:ye}:{type:"image",raw:Ie,href:se,title:ce,text:J(ye)}}function Ne(Be,Ae){var Ie=Be.match(/^(\s+)(?:```)/);if(Ie===null)return Ae;var se=Ie[1];return Ae.split(`
|
|
`).map(function(ce){var ye=ce.match(/^\s+/);if(ye===null)return ce;var Se=ye[0];return Se.length>=se.length?ce.slice(se.length):ce}).join(`
|
|
`)}var _e=function(){function Be(Ie){this.options=Ie||k}var Ae=Be.prototype;return Ae.space=function(se){var ce=this.rules.block.newline.exec(se);if(ce)return ce[0].length>1?{type:"space",raw:ce[0]}:{raw:`
|
|
`}},Ae.code=function(se,ce){var ye=this.rules.block.code.exec(se);if(ye){var Se=ce[ce.length-1];if(Se&&Se.type==="paragraph")return{raw:ye[0],text:ye[0].trimRight()};var ke=ye[0].replace(/^ {4}/gm,"");return{type:"code",raw:ye[0],codeBlockStyle:"indented",text:this.options.pedantic?ke:b(ke,`
|
|
`)}}},Ae.fences=function(se){var ce=this.rules.block.fences.exec(se);if(ce){var ye=ce[0],Se=Ne(ye,ce[3]||"");return{type:"code",raw:ye,lang:ce[2]?ce[2].trim():ce[2],text:Se}}},Ae.heading=function(se){var ce=this.rules.block.heading.exec(se);if(ce)return{type:"heading",raw:ce[0],depth:ce[1].length,text:ce[2]}},Ae.nptable=function(se){var ce=this.rules.block.nptable.exec(se);if(ce){var ye={type:"table",header:G(ce[1].replace(/^ *| *\| *$/g,"")),align:ce[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ce[3]?ce[3].replace(/\n$/,"").split(`
|
|
`):[],raw:ce[0]};if(ye.header.length===ye.align.length){var Se=ye.align.length,ke;for(ke=0;ke<Se;ke++)/^ *-+: *$/.test(ye.align[ke])?ye.align[ke]="right":/^ *:-+: *$/.test(ye.align[ke])?ye.align[ke]="center":/^ *:-+ *$/.test(ye.align[ke])?ye.align[ke]="left":ye.align[ke]=null;for(Se=ye.cells.length,ke=0;ke<Se;ke++)ye.cells[ke]=G(ye.cells[ke],ye.header.length);return ye}}},Ae.hr=function(se){var ce=this.rules.block.hr.exec(se);if(ce)return{type:"hr",raw:ce[0]}},Ae.blockquote=function(se){var ce=this.rules.block.blockquote.exec(se);if(ce){var ye=ce[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ce[0],text:ye}}},Ae.list=function(se){var ce=this.rules.block.list.exec(se);if(ce){for(var ye=ce[0],Se=ce[2],ke=Se.length>1,et=Se[Se.length-1]===")",yt={type:"list",raw:ye,ordered:ke,start:ke?+Se.slice(0,-1):"",loose:!1,items:[]},$t=ce[0].match(this.rules.block.item),gn=!1,Dt,zn,Ln,sn,_i,si,zi,Oi=$t.length,Qn=0;Qn<Oi;Qn++)Dt=$t[Qn],ye=Dt,zn=Dt.length,Dt=Dt.replace(/^ *([*+-]|\d+[.)]) */,""),~Dt.indexOf(`
|
|
`)&&(zn-=Dt.length,Dt=this.options.pedantic?Dt.replace(/^ {1,4}/gm,""):Dt.replace(new RegExp("^ {1,"+zn+"}","gm"),"")),Qn!==Oi-1&&(Ln=this.rules.block.bullet.exec($t[Qn+1])[0],(ke?Ln.length===1||!et&&Ln[Ln.length-1]===")":Ln.length>1||this.options.smartLists&&Ln!==Se)&&(sn=$t.slice(Qn+1).join(`
|
|
`),yt.raw=yt.raw.substring(0,yt.raw.length-sn.length),Qn=Oi-1)),_i=gn||/\n\n(?!\s*$)/.test(Dt),Qn!==Oi-1&&(gn=Dt.charAt(Dt.length-1)===`
|
|
`,_i||(_i=gn)),_i&&(yt.loose=!0),si=/^\[[ xX]\] /.test(Dt),zi=void 0,si&&(zi=Dt[1]!==" ",Dt=Dt.replace(/^\[[ xX]\] +/,"")),yt.items.push({type:"list_item",raw:ye,task:si,checked:zi,loose:_i,text:Dt});return yt}},Ae.html=function(se){var ce=this.rules.block.html.exec(se);if(ce)return{type:this.options.sanitize?"paragraph":"html",raw:ce[0],pre:!this.options.sanitizer&&(ce[1]==="pre"||ce[1]==="script"||ce[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ce[0]):J(ce[0]):ce[0]}},Ae.def=function(se){var ce=this.rules.block.def.exec(se);if(ce){ce[3]&&(ce[3]=ce[3].substring(1,ce[3].length-1));var ye=ce[1].toLowerCase().replace(/\s+/g," ");return{tag:ye,raw:ce[0],href:ce[2],title:ce[3]}}},Ae.table=function(se){var ce=this.rules.block.table.exec(se);if(ce){var ye={type:"table",header:G(ce[1].replace(/^ *| *\| *$/g,"")),align:ce[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ce[3]?ce[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ye.header.length===ye.align.length){ye.raw=ce[0];var Se=ye.align.length,ke;for(ke=0;ke<Se;ke++)/^ *-+: *$/.test(ye.align[ke])?ye.align[ke]="right":/^ *:-+: *$/.test(ye.align[ke])?ye.align[ke]="center":/^ *:-+ *$/.test(ye.align[ke])?ye.align[ke]="left":ye.align[ke]=null;for(Se=ye.cells.length,ke=0;ke<Se;ke++)ye.cells[ke]=G(ye.cells[ke].replace(/^ *\| *| *\| *$/g,""),ye.header.length);return ye}}},Ae.lheading=function(se){var ce=this.rules.block.lheading.exec(se);if(ce)return{type:"heading",raw:ce[0],depth:ce[2].charAt(0)==="="?1:2,text:ce[1]}},Ae.paragraph=function(se){var ce=this.rules.block.paragraph.exec(se);if(ce)return{type:"paragraph",raw:ce[0],text:ce[1].charAt(ce[1].length-1)===`
|
|
`?ce[1].slice(0,-1):ce[1]}},Ae.text=function(se,ce){var ye=this.rules.block.text.exec(se);if(ye){var Se=ce[ce.length-1];return Se&&Se.type==="text"?{raw:ye[0],text:ye[0]}:{type:"text",raw:ye[0],text:ye[0]}}},Ae.escape=function(se){var ce=this.rules.inline.escape.exec(se);if(ce)return{type:"escape",raw:ce[0],text:J(ce[1])}},Ae.tag=function(se,ce,ye){var Se=this.rules.inline.tag.exec(se);if(Se)return!ce&&/^<a /i.test(Se[0])?ce=!0:ce&&/^<\/a>/i.test(Se[0])&&(ce=!1),!ye&&/^<(pre|code|kbd|script)(\s|>)/i.test(Se[0])?ye=!0:ye&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(Se[0])&&(ye=!1),{type:this.options.sanitize?"text":"html",raw:Se[0],inLink:ce,inRawBlock:ye,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Se[0]):J(Se[0]):Se[0]}},Ae.link=function(se){var ce=this.rules.inline.link.exec(se);if(ce){var ye=oe(ce[2],"()");if(ye>-1){var Se=ce[0].indexOf("!")===0?5:4,ke=Se+ce[1].length+ye;ce[2]=ce[2].substring(0,ye),ce[0]=ce[0].substring(0,ke).trim(),ce[3]=""}var et=ce[2],yt="";if(this.options.pedantic){var $t=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(et);$t?(et=$t[1],yt=$t[3]):yt=""}else yt=ce[3]?ce[3].slice(1,-1):"";et=et.trim().replace(/^<([\s\S]*)>$/,"$1");var gn=fe(ce,{href:et&&et.replace(this.rules.inline._escapes,"$1"),title:yt&&yt.replace(this.rules.inline._escapes,"$1")},ce[0]);return gn}},Ae.reflink=function(se,ce){var ye;if((ye=this.rules.inline.reflink.exec(se))||(ye=this.rules.inline.nolink.exec(se))){var Se=(ye[2]||ye[1]).replace(/\s+/g," ");if(Se=ce[Se.toLowerCase()],!Se||!Se.href){var ke=ye[0].charAt(0);return{type:"text",raw:ke,text:ke}}var et=fe(ye,Se,ye[0]);return et}},Ae.strong=function(se,ce,ye){ye===void 0&&(ye="");var Se=this.rules.inline.strong.start.exec(se);if(Se&&(!Se[1]||Se[1]&&(ye===""||this.rules.inline.punctuation.exec(ye)))){ce=ce.slice(-1*se.length);var ke=Se[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ke.lastIndex=0;for(var et;(Se=ke.exec(ce))!=null;)if(et=this.rules.inline.strong.middle.exec(ce.slice(0,Se.index+3)),et)return{type:"strong",raw:se.slice(0,et[0].length),text:se.slice(2,et[0].length-2)}}},Ae.em=function(se,ce,ye){ye===void 0&&(ye="");var Se=this.rules.inline.em.start.exec(se);if(Se&&(!Se[1]||Se[1]&&(ye===""||this.rules.inline.punctuation.exec(ye)))){ce=ce.slice(-1*se.length);var ke=Se[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ke.lastIndex=0;for(var et;(Se=ke.exec(ce))!=null;)if(et=this.rules.inline.em.middle.exec(ce.slice(0,Se.index+2)),et)return{type:"em",raw:se.slice(0,et[0].length),text:se.slice(1,et[0].length-1)}}},Ae.codespan=function(se){var ce=this.rules.inline.code.exec(se);if(ce){var ye=ce[2].replace(/\n/g," "),Se=/[^ ]/.test(ye),ke=ye.startsWith(" ")&&ye.endsWith(" ");return Se&&ke&&(ye=ye.substring(1,ye.length-1)),ye=J(ye,!0),{type:"codespan",raw:ce[0],text:ye}}},Ae.br=function(se){var ce=this.rules.inline.br.exec(se);if(ce)return{type:"br",raw:ce[0]}},Ae.del=function(se){var ce=this.rules.inline.del.exec(se);if(ce)return{type:"del",raw:ce[0],text:ce[1]}},Ae.autolink=function(se,ce){var ye=this.rules.inline.autolink.exec(se);if(ye){var Se,ke;return ye[2]==="@"?(Se=J(this.options.mangle?ce(ye[1]):ye[1]),ke="mailto:"+Se):(Se=J(ye[1]),ke=Se),{type:"link",raw:ye[0],text:Se,href:ke,tokens:[{type:"text",raw:Se,text:Se}]}}},Ae.url=function(se,ce){var ye;if(ye=this.rules.inline.url.exec(se)){var Se,ke;if(ye[2]==="@")Se=J(this.options.mangle?ce(ye[0]):ye[0]),ke="mailto:"+Se;else{var et;do et=ye[0],ye[0]=this.rules.inline._backpedal.exec(ye[0])[0];while(et!==ye[0]);Se=J(ye[0]),ye[1]==="www."?ke="http://"+Se:ke=Se}return{type:"link",raw:ye[0],text:Se,href:ke,tokens:[{type:"text",raw:Se,text:Se}]}}},Ae.inlineText=function(se,ce,ye){var Se=this.rules.inline.text.exec(se);if(Se){var ke;return ce?ke=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Se[0]):J(Se[0]):Se[0]:ke=J(this.options.smartypants?ye(Se[0]):Se[0]),{type:"text",raw:Se[0],text:ke}}},Be}(),Fe=W.noopTest,We=W.edit,Ue=W.merge,xe={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Fe,table:Fe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};xe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,xe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,xe.def=We(xe.def).replace("label",xe._label).replace("title",xe._title).getRegex(),xe.bullet=/(?:[*+-]|\d{1,9}[.)])/,xe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,xe.item=We(xe.item,"gm").replace(/bull/g,xe.bullet).getRegex(),xe.list=We(xe.list).replace(/bull/g,xe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+xe.def.source+")").getRegex(),xe._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",xe._comment=/<!--(?!-?>)[\s\S]*?-->/,xe.html=We(xe.html,"i").replace("comment",xe._comment).replace("tag",xe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xe.paragraph=We(xe._paragraph).replace("hr",xe.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",xe._tag).getRegex(),xe.blockquote=We(xe.blockquote).replace("paragraph",xe.paragraph).getRegex(),xe.normal=Ue({},xe),xe.gfm=Ue({},xe.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*|$)"}),xe.gfm.nptable=We(xe.gfm.nptable).replace("hr",xe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",xe._tag).getRegex(),xe.gfm.table=We(xe.gfm.table).replace("hr",xe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",xe._tag).getRegex(),xe.pedantic=Ue({},xe.normal,{html:We(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",xe._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Fe,paragraph:We(xe.normal._paragraph).replace("hr",xe.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",xe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Fe,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Fe,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=We(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=We(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=We(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=We(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=We(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=We(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=We(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=We(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=We(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=We(ue._blockSkip,"g").getRegex(),ue.overlapSkip=We(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=We(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=We(ue.tag).replace("comment",xe._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=We(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=We(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=We(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=Ue({},ue),ue.pedantic=Ue({},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:We(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:We(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=Ue({},ue.normal,{escape:We(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]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),ue.gfm.url=We(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=Ue({},ue.gfm,{br:We(ue.br).replace("{2,}","*").getRegex(),text:We(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var ae={block:xe,inline:ue},Ee=H.defaults,de=ae.block,Ke=ae.inline;function Je(Be){return Be.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function je(Be){var Ae="",Ie,se,ce=Be.length;for(Ie=0;Ie<ce;Ie++)se=Be.charCodeAt(Ie),Math.random()>.5&&(se="x"+se.toString(16)),Ae+="&#"+se+";";return Ae}var Qe=function(){function Be(Ie){this.tokens=[],this.tokens.links=Object.create(null),this.options=Ie||Ee,this.options.tokenizer=this.options.tokenizer||new _e,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var se={block:de.normal,inline:Ke.normal};this.options.pedantic?(se.block=de.pedantic,se.inline=Ke.pedantic):this.options.gfm&&(se.block=de.gfm,this.options.breaks?se.inline=Ke.breaks:se.inline=Ke.gfm),this.tokenizer.rules=se}Be.lex=function(se,ce){var ye=new Be(ce);return ye.lex(se)};var Ae=Be.prototype;return Ae.lex=function(se){return se=se.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(se,this.tokens,!0),this.inline(this.tokens),this.tokens},Ae.blockTokens=function(se,ce,ye){ce===void 0&&(ce=[]),ye===void 0&&(ye=!0),se=se.replace(/^ +$/gm,"");for(var Se,ke,et,yt;se;){if(Se=this.tokenizer.space(se)){se=se.substring(Se.raw.length),Se.type&&ce.push(Se);continue}if(Se=this.tokenizer.code(se,ce)){se=se.substring(Se.raw.length),Se.type?ce.push(Se):(yt=ce[ce.length-1],yt.raw+=`
|
|
`+Se.raw,yt.text+=`
|
|
`+Se.text);continue}if(Se=this.tokenizer.fences(se)){se=se.substring(Se.raw.length),ce.push(Se);continue}if(Se=this.tokenizer.heading(se)){se=se.substring(Se.raw.length),ce.push(Se);continue}if(Se=this.tokenizer.nptable(se)){se=se.substring(Se.raw.length),ce.push(Se);continue}if(Se=this.tokenizer.hr(se)){se=se.substring(Se.raw.length),ce.push(Se);continue}if(Se=this.tokenizer.blockquote(se)){se=se.substring(Se.raw.length),Se.tokens=this.blockTokens(Se.text,[],ye),ce.push(Se);continue}if(Se=this.tokenizer.list(se)){for(se=se.substring(Se.raw.length),et=Se.items.length,ke=0;ke<et;ke++)Se.items[ke].tokens=this.blockTokens(Se.items[ke].text,[],!1);ce.push(Se);continue}if(Se=this.tokenizer.html(se)){se=se.substring(Se.raw.length),ce.push(Se);continue}if(ye&&(Se=this.tokenizer.def(se))){se=se.substring(Se.raw.length),this.tokens.links[Se.tag]||(this.tokens.links[Se.tag]={href:Se.href,title:Se.title});continue}if(Se=this.tokenizer.table(se)){se=se.substring(Se.raw.length),ce.push(Se);continue}if(Se=this.tokenizer.lheading(se)){se=se.substring(Se.raw.length),ce.push(Se);continue}if(ye&&(Se=this.tokenizer.paragraph(se))){se=se.substring(Se.raw.length),ce.push(Se);continue}if(Se=this.tokenizer.text(se,ce)){se=se.substring(Se.raw.length),Se.type?ce.push(Se):(yt=ce[ce.length-1],yt.raw+=`
|
|
`+Se.raw,yt.text+=`
|
|
`+Se.text);continue}if(se){var $t="Infinite loop on byte: "+se.charCodeAt(0);if(this.options.silent){console.error($t);break}else throw new Error($t)}}return ce},Ae.inline=function(se){var ce,ye,Se,ke,et,yt,$t=se.length;for(ce=0;ce<$t;ce++){yt=se[ce];switch(yt.type){case"paragraph":case"text":case"heading":{yt.tokens=[],this.inlineTokens(yt.text,yt.tokens);break}case"table":{for(yt.tokens={header:[],cells:[]},ke=yt.header.length,ye=0;ye<ke;ye++)yt.tokens.header[ye]=[],this.inlineTokens(yt.header[ye],yt.tokens.header[ye]);for(ke=yt.cells.length,ye=0;ye<ke;ye++)for(et=yt.cells[ye],yt.tokens.cells[ye]=[],Se=0;Se<et.length;Se++)yt.tokens.cells[ye][Se]=[],this.inlineTokens(et[Se],yt.tokens.cells[ye][Se]);break}case"blockquote":{this.inline(yt.tokens);break}case"list":{for(ke=yt.items.length,ye=0;ye<ke;ye++)this.inline(yt.items[ye].tokens);break}}}return se},Ae.inlineTokens=function(se,ce,ye,Se,ke){ce===void 0&&(ce=[]),ye===void 0&&(ye=!1),Se===void 0&&(Se=!1),ke===void 0&&(ke="");var et,yt=se,$t;if(this.tokens.links){var gn=Object.keys(this.tokens.links);if(gn.length>0)for(;($t=this.tokenizer.rules.inline.reflinkSearch.exec(yt))!=null;)gn.includes($t[0].slice($t[0].lastIndexOf("[")+1,-1))&&(yt=yt.slice(0,$t.index)+"["+"a".repeat($t[0].length-2)+"]"+yt.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;($t=this.tokenizer.rules.inline.blockSkip.exec(yt))!=null;)yt=yt.slice(0,$t.index)+"["+"a".repeat($t[0].length-2)+"]"+yt.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;se;){if(et=this.tokenizer.escape(se)){se=se.substring(et.raw.length),ce.push(et);continue}if(et=this.tokenizer.tag(se,ye,Se)){se=se.substring(et.raw.length),ye=et.inLink,Se=et.inRawBlock,ce.push(et);continue}if(et=this.tokenizer.link(se)){se=se.substring(et.raw.length),et.type==="link"&&(et.tokens=this.inlineTokens(et.text,[],!0,Se)),ce.push(et);continue}if(et=this.tokenizer.reflink(se,this.tokens.links)){se=se.substring(et.raw.length),et.type==="link"&&(et.tokens=this.inlineTokens(et.text,[],!0,Se)),ce.push(et);continue}if(et=this.tokenizer.strong(se,yt,ke)){se=se.substring(et.raw.length),et.tokens=this.inlineTokens(et.text,[],ye,Se),ce.push(et);continue}if(et=this.tokenizer.em(se,yt,ke)){se=se.substring(et.raw.length),et.tokens=this.inlineTokens(et.text,[],ye,Se),ce.push(et);continue}if(et=this.tokenizer.codespan(se)){se=se.substring(et.raw.length),ce.push(et);continue}if(et=this.tokenizer.br(se)){se=se.substring(et.raw.length),ce.push(et);continue}if(et=this.tokenizer.del(se)){se=se.substring(et.raw.length),et.tokens=this.inlineTokens(et.text,[],ye,Se),ce.push(et);continue}if(et=this.tokenizer.autolink(se,je)){se=se.substring(et.raw.length),ce.push(et);continue}if(!ye&&(et=this.tokenizer.url(se,je))){se=se.substring(et.raw.length),ce.push(et);continue}if(et=this.tokenizer.inlineText(se,Se,Je)){se=se.substring(et.raw.length),ke=et.raw.slice(-1),ce.push(et);continue}if(se){var Dt="Infinite loop on byte: "+se.charCodeAt(0);if(this.options.silent){console.error(Dt);break}else throw new Error(Dt)}}return ce},Q(Be,null,[{key:"rules",get:function(){return{block:de,inline:Ke}}}]),Be}(),ot=H.defaults,st=W.cleanUrl,ht=W.escape,mt=function(){function Be(Ie){this.options=Ie||ot}var Ae=Be.prototype;return Ae.code=function(se,ce,ye){var Se=(ce||"").match(/\S*/)[0];if(this.options.highlight){var ke=this.options.highlight(se,Se);ke!=null&&ke!==se&&(ye=!0,se=ke)}return Se?'<pre><code class="'+this.options.langPrefix+ht(Se,!0)+'">'+(ye?se:ht(se,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ye?se:ht(se,!0))+`</code></pre>
|
|
`},Ae.blockquote=function(se){return`<blockquote>
|
|
`+se+`</blockquote>
|
|
`},Ae.html=function(se){return se},Ae.heading=function(se,ce,ye,Se){return this.options.headerIds?"<h"+ce+' id="'+this.options.headerPrefix+Se.slug(ye)+'">'+se+"</h"+ce+`>
|
|
`:"<h"+ce+">"+se+"</h"+ce+`>
|
|
`},Ae.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},Ae.list=function(se,ce,ye){var Se=ce?"ol":"ul",ke=ce&&ye!==1?' start="'+ye+'"':"";return"<"+Se+ke+`>
|
|
`+se+"</"+Se+`>
|
|
`},Ae.listitem=function(se){return"<li>"+se+`</li>
|
|
`},Ae.checkbox=function(se){return"<input "+(se?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},Ae.paragraph=function(se){return"<p>"+se+`</p>
|
|
`},Ae.table=function(se,ce){return ce&&(ce="<tbody>"+ce+"</tbody>"),`<table>
|
|
<thead>
|
|
`+se+`</thead>
|
|
`+ce+`</table>
|
|
`},Ae.tablerow=function(se){return`<tr>
|
|
`+se+`</tr>
|
|
`},Ae.tablecell=function(se,ce){var ye=ce.header?"th":"td",Se=ce.align?"<"+ye+' align="'+ce.align+'">':"<"+ye+">";return Se+se+"</"+ye+`>
|
|
`},Ae.strong=function(se){return"<strong>"+se+"</strong>"},Ae.em=function(se){return"<em>"+se+"</em>"},Ae.codespan=function(se){return"<code>"+se+"</code>"},Ae.br=function(){return this.options.xhtml?"<br/>":"<br>"},Ae.del=function(se){return"<del>"+se+"</del>"},Ae.link=function(se,ce,ye){if(se=st(this.options.sanitize,this.options.baseUrl,se),se===null)return ye;var Se='<a href="'+ht(se)+'"';return ce&&(Se+=' title="'+ce+'"'),Se+=">"+ye+"</a>",Se},Ae.image=function(se,ce,ye){if(se=st(this.options.sanitize,this.options.baseUrl,se),se===null)return ye;var Se='<img src="'+se+'" alt="'+ye+'"';return ce&&(Se+=' title="'+ce+'"'),Se+=this.options.xhtml?"/>":">",Se},Ae.text=function(se){return se},Be}(),ft=function(){function Be(){}var Ae=Be.prototype;return Ae.strong=function(se){return se},Ae.em=function(se){return se},Ae.codespan=function(se){return se},Ae.del=function(se){return se},Ae.html=function(se){return se},Ae.text=function(se){return se},Ae.link=function(se,ce,ye){return""+ye},Ae.image=function(se,ce,ye){return""+ye},Ae.br=function(){return""},Be}(),Ht=function(){function Be(){this.seen={}}var Ae=Be.prototype;return Ae.slug=function(se){var ce=se.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ce)){var ye=ce;do this.seen[ye]++,ce=ye+"-"+this.seen[ye];while(this.seen.hasOwnProperty(ce))}return this.seen[ce]=0,ce},Be}(),Vt=H.defaults,zt=W.unescape,Tt=function(){function Be(Ie){this.options=Ie||Vt,this.options.renderer=this.options.renderer||new mt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ft,this.slugger=new Ht}Be.parse=function(se,ce){var ye=new Be(ce);return ye.parse(se)};var Ae=Be.prototype;return Ae.parse=function(se,ce){ce===void 0&&(ce=!0);var ye="",Se,ke,et,yt,$t,gn,Dt,zn,Ln,sn,_i,si,zi,Oi,Qn,ir,qi,It,Hn=se.length;for(Se=0;Se<Hn;Se++){sn=se[Se];switch(sn.type){case"space":continue;case"hr":{ye+=this.renderer.hr();continue}case"heading":{ye+=this.renderer.heading(this.parseInline(sn.tokens),sn.depth,zt(this.parseInline(sn.tokens,this.textRenderer)),this.slugger);continue}case"code":{ye+=this.renderer.code(sn.text,sn.lang,sn.escaped);continue}case"table":{for(zn="",Dt="",yt=sn.header.length,ke=0;ke<yt;ke++)Dt+=this.renderer.tablecell(this.parseInline(sn.tokens.header[ke]),{header:!0,align:sn.align[ke]});for(zn+=this.renderer.tablerow(Dt),Ln="",yt=sn.cells.length,ke=0;ke<yt;ke++){for(gn=sn.tokens.cells[ke],Dt="",$t=gn.length,et=0;et<$t;et++)Dt+=this.renderer.tablecell(this.parseInline(gn[et]),{header:!1,align:sn.align[et]});Ln+=this.renderer.tablerow(Dt)}ye+=this.renderer.table(zn,Ln);continue}case"blockquote":{Ln=this.parse(sn.tokens),ye+=this.renderer.blockquote(Ln);continue}case"list":{for(_i=sn.ordered,si=sn.start,zi=sn.loose,yt=sn.items.length,Ln="",ke=0;ke<yt;ke++)Qn=sn.items[ke],ir=Qn.checked,qi=Qn.task,Oi="",Qn.task&&(It=this.renderer.checkbox(ir),zi?Qn.tokens.length>0&&Qn.tokens[0].type==="text"?(Qn.tokens[0].text=It+" "+Qn.tokens[0].text,Qn.tokens[0].tokens&&Qn.tokens[0].tokens.length>0&&Qn.tokens[0].tokens[0].type==="text"&&(Qn.tokens[0].tokens[0].text=It+" "+Qn.tokens[0].tokens[0].text)):Qn.tokens.unshift({type:"text",text:It}):Oi+=It),Oi+=this.parse(Qn.tokens,zi),Ln+=this.renderer.listitem(Oi,qi,ir);ye+=this.renderer.list(Ln,_i,si);continue}case"html":{ye+=this.renderer.html(sn.text);continue}case"paragraph":{ye+=this.renderer.paragraph(this.parseInline(sn.tokens));continue}case"text":{for(Ln=sn.tokens?this.parseInline(sn.tokens):sn.text;Se+1<Hn&&se[Se+1].type==="text";)sn=se[++Se],Ln+=`
|
|
`+(sn.tokens?this.parseInline(sn.tokens):sn.text);ye+=ce?this.renderer.paragraph(Ln):Ln;continue}default:{var li='Token with "'+sn.type+'" type was not found.';if(this.options.silent){console.error(li);return}else throw new Error(li)}}}return ye},Ae.parseInline=function(se,ce){ce=ce||this.renderer;var ye="",Se,ke,et=se.length;for(Se=0;Se<et;Se++){ke=se[Se];switch(ke.type){case"escape":{ye+=ce.text(ke.text);break}case"html":{ye+=ce.html(ke.text);break}case"link":{ye+=ce.link(ke.href,ke.title,this.parseInline(ke.tokens,ce));break}case"image":{ye+=ce.image(ke.href,ke.title,ke.text);break}case"strong":{ye+=ce.strong(this.parseInline(ke.tokens,ce));break}case"em":{ye+=ce.em(this.parseInline(ke.tokens,ce));break}case"codespan":{ye+=ce.codespan(ke.text);break}case"br":{ye+=ce.br();break}case"del":{ye+=ce.del(this.parseInline(ke.tokens,ce));break}case"text":{ye+=ce.text(ke.text);break}default:{var yt='Token with "'+ke.type+'" type was not found.';if(this.options.silent){console.error(yt);return}else throw new Error(yt)}}}return ye},Be}(),hn=W.merge,Xt=W.checkSanitizeDeprecation,Wt=W.escape,it=H.getDefaults,un=H.changeDefaults,Kt=H.defaults;function qe(Be,Ae,Ie){if(typeof Be=="undefined"||Be===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Be!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Be)+", string expected");if(typeof Ae=="function"&&(Ie=Ae,Ae=null),Ae=hn({},qe.defaults,Ae||{}),Xt(Ae),Ie){var se=Ae.highlight,ce;try{ce=Qe.lex(Be,Ae)}catch(et){return Ie(et)}var ye=function(yt){var $t;if(!yt)try{$t=Tt.parse(ce,Ae)}catch(gn){yt=gn}return Ae.highlight=se,yt?Ie(yt):Ie(null,$t)};if(!se||se.length<3)return ye();if(delete Ae.highlight,!ce.length)return ye();var Se=0;qe.walkTokens(ce,function(et){et.type==="code"&&(Se++,setTimeout(function(){se(et.text,et.lang,function(yt,$t){if(yt)return ye(yt);$t!=null&&$t!==et.text&&(et.text=$t,et.escaped=!0),Se--,Se===0&&ye()})},0))}),Se===0&&ye();return}try{var ke=Qe.lex(Be,Ae);return Ae.walkTokens&&qe.walkTokens(ke,Ae.walkTokens),Tt.parse(ke,Ae)}catch(et){if(et.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,Ae.silent)return"<p>An error occurred:</p><pre>"+Wt(et.message+"",!0)+"</pre>";throw et}}qe.options=qe.setOptions=function(Be){return hn(qe.defaults,Be),un(qe.defaults),qe},qe.getDefaults=it,qe.defaults=Kt,qe.use=function(Be){var Ae=hn({},Be);if(Be.renderer&&function(){var se=qe.defaults.renderer||new mt,ce=function(ke){var et=se[ke];se[ke]=function(){for(var yt=arguments.length,$t=new Array(yt),gn=0;gn<yt;gn++)$t[gn]=arguments[gn];var Dt=Be.renderer[ke].apply(se,$t);return Dt===!1&&(Dt=et.apply(se,$t)),Dt}};for(var ye in Be.renderer)ce(ye);Ae.renderer=se}(),Be.tokenizer&&function(){var se=qe.defaults.tokenizer||new _e,ce=function(ke){var et=se[ke];se[ke]=function(){for(var yt=arguments.length,$t=new Array(yt),gn=0;gn<yt;gn++)$t[gn]=arguments[gn];var Dt=Be.tokenizer[ke].apply(se,$t);return Dt===!1&&(Dt=et.apply(se,$t)),Dt}};for(var ye in Be.tokenizer)ce(ye);Ae.tokenizer=se}(),Be.walkTokens){var Ie=qe.defaults.walkTokens;Ae.walkTokens=function(se){Be.walkTokens(se),Ie&&Ie(se)}}qe.setOptions(Ae)},qe.walkTokens=function(Be,Ae){for(var Ie=D(Be),se;!(se=Ie()).done;){var ce=se.value;Ae(ce);switch(ce.type){case"table":{for(var ye=D(ce.tokens.header),Se;!(Se=ye()).done;){var ke=Se.value;qe.walkTokens(ke,Ae)}for(var et=D(ce.tokens.cells),yt;!(yt=et()).done;)for(var $t=yt.value,gn=D($t),Dt;!(Dt=gn()).done;){var zn=Dt.value;qe.walkTokens(zn,Ae)}break}case"list":{qe.walkTokens(ce.items,Ae);break}default:ce.tokens&&qe.walkTokens(ce.tokens,Ae)}}},qe.Parser=Tt,qe.parser=Tt.parse,qe.Renderer=mt,qe.TextRenderer=ft,qe.Lexer=Qe,qe.lexer=Qe.lex,qe.Tokenizer=_e,qe.Slugger=Ht,qe.parse=qe;var wt=qe;return wt})},ELLl:function(Mt,_t,q){(function(le){le(q("VrN/"))})(function(le){var Q={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},P=le.Pos;le.defineOption("autoCloseBrackets",!1,function(n,c,s){s&&s!=le.Init&&(n.removeKeyMap(D),n.state.closeBrackets=null),c&&(U(Y(c,"pairs")),n.state.closeBrackets=c,n.addKeyMap(D))});function Y(n,c){return c=="pairs"&&typeof n=="string"?n:typeof n=="object"&&n[c]!=null?n[c]:Q[c]}var D={Backspace:F,Enter:R};function U(n){for(var c=0;c<n.length;c++){var s=n.charAt(c),a="'"+s+"'";D[a]||(D[a]=H(s))}}U(Q.pairs+"`");function H(n){return function(c){return p(c,n)}}function I(n){var c=n.state.closeBrackets;if(!c||c.override)return c;var s=n.getModeAt(n.getCursor());return s.closeBrackets||c}function F(n){var c=I(n);if(!c||n.getOption("disableInput"))return le.Pass;for(var s=Y(c,"pairs"),a=n.listSelections(),o=0;o<a.length;o++){if(!a[o].empty())return le.Pass;var f=d(n,a[o].head);if(!f||s.indexOf(f)%2!=0)return le.Pass}for(var o=a.length-1;o>=0;o--){var L=a[o].head;n.replaceRange("",P(L.line,L.ch-1),P(L.line,L.ch+1),"+delete")}}function R(n){var c=I(n),s=c&&Y(c,"explode");if(!s||n.getOption("disableInput"))return le.Pass;for(var a=n.listSelections(),o=0;o<a.length;o++){if(!a[o].empty())return le.Pass;var f=d(n,a[o].head);if(!f||s.indexOf(f)%2!=0)return le.Pass}n.operation(function(){var L=n.lineSeparator()||`
|
|
`;n.replaceSelection(L+L,null),n.execCommand("goCharLeft"),a=n.listSelections();for(var C=0;C<a.length;C++){var x=a[C].head.line;n.indentLine(x,null,!0),n.indentLine(x+1,null,!0)}})}function g(n){var c=le.cmpPos(n.anchor,n.head)>0;return{anchor:new P(n.anchor.line,n.anchor.ch+(c?-1:1)),head:new P(n.head.line,n.head.ch+(c?1:-1))}}function p(n,c){var s=I(n);if(!s||n.getOption("disableInput"))return le.Pass;var a=Y(s,"pairs"),o=a.indexOf(c);if(o==-1)return le.Pass;for(var f=Y(s,"closeBefore"),L=Y(s,"triples"),C=a.charAt(o+1)==c,x=n.listSelections(),A=o%2==0,w,_=0;_<x.length;_++){var S=x[_],y=S.head,h,E=n.getRange(y,P(y.line,y.ch+1));if(A&&!S.empty())h="surround";else if((C||!A)&&E==c)C&&l(n,y)?h="both":L.indexOf(c)>=0&&n.getRange(y,P(y.line,y.ch+3))==c+c+c?h="skipThree":h="skip";else if(C&&y.ch>1&&L.indexOf(c)>=0&&n.getRange(P(y.line,y.ch-2),y)==c+c){if(y.ch>2&&/\bstring/.test(n.getTokenTypeAt(P(y.line,y.ch-2))))return le.Pass;h="addFour"}else if(C){var m=y.ch==0?" ":n.getRange(P(y.line,y.ch-1),y);if(!le.isWordChar(E)&&m!=c&&!le.isWordChar(m))h="both";else return le.Pass}else if(A&&(E.length===0||/\s/.test(E)||f.indexOf(E)>-1))h="both";else return le.Pass;if(!w)w=h;else if(w!=h)return le.Pass}var T=o%2?a.charAt(o-1):c,j=o%2?c:a.charAt(o+1);n.operation(function(){if(w=="skip")n.execCommand("goCharRight");else if(w=="skipThree")for(var N=0;N<3;N++)n.execCommand("goCharRight");else if(w=="surround"){for(var K=n.getSelections(),N=0;N<K.length;N++)K[N]=T+K[N]+j;n.replaceSelections(K,"around"),K=n.listSelections().slice();for(var N=0;N<K.length;N++)K[N]=g(K[N]);n.setSelections(K)}else w=="both"?(n.replaceSelection(T+j,null),n.triggerElectric(T+j),n.execCommand("goCharLeft")):w=="addFour"&&(n.replaceSelection(T+T+T+T,"before"),n.execCommand("goCharRight"))})}function d(n,c){var s=n.getRange(P(c.line,c.ch-1),P(c.line,c.ch+1));return s.length==2?s:null}function l(n,c){var s=n.getTokenAt(P(c.line,c.ch+1));return/\bstring/.test(s.type)&&s.start==c.ch&&(c.ch==0||!/\bstring/.test(n.getTokenTypeAt(c)))}})},EZOa:function(Mt,_t,q){Mt.exports={wrap:"wrap___3Gc_c",labelWrap:"labelWrap___3ixsT",label:"label___2ip8w",labelContent:"labelContent___2buLg",flexRow:"flexRow___thCOf",color999:"color999___tBQKH",radio:"radio___jRhYN",selectSchool:"selectSchool___1-ikA",dataPicker:"dataPicker___2AeMT"}},FPkq:function(Mt,_t,q){Mt.exports=q.p+"static/qrCode.dd0fe9b2.png"},FrRK:function(Mt,_t,q){"use strict";var le=q("+L6B"),Q=q("2/Rp"),P=q("DZo9"),Y=q("8z0m"),D=q("miYZ"),U=q("tsqr"),H=q("9og8"),I=q("2qtc"),F=q("kLXV"),R=q("y8nQ"),g=q("Vl3Y"),p=q("tJVT"),d=q("PpiC"),l=q("5NDa"),n=q("5rEg"),c=q("WmNS"),s=q.n(c),a=q("q1tI"),o=q.n(a),f=q("9kvl"),L=q("m3rI"),C=q("FPkq"),x=q.n(C),A=q("qB8g"),w=q.n(A),_=n.a.TextArea,S=function(h){var E=h.newShixuns,m=h.globalSetting,T=h.loading,j=h.dispatch,N=Object(d.a)(h,["newShixuns","globalSetting","loading","dispatch"]),K=g.a.useForm(),W=Object(p.a)(K,1),k=W[0],b=Object(a.useState)([]),G=Object(p.a)(b,2),J=G[0],oe=G[1],fe=function(xe){var ue=["uploading","done","removed"];ue.includes(xe.file.status)&&oe(xe.fileList)},Ne=function(xe){if(!xe.percent||xe.percent==100){var ue,ae=(ue=xe.response)===null||ue===void 0?void 0:ue.id;return F.a.confirm({centered:!0,title:"\u786E\u5B9A\u8981\u5220\u9664\u8FD9\u4E2A\u9644\u4EF6\u5417?",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:function(){var Ee=Object(H.a)(s.a.mark(function Ke(){var Je;return s.a.wrap(function(Qe){for(;;)switch(Qe.prev=Qe.next){case 0:return Qe.next=2,j({type:"newShixuns/deleteAttachment",payload:{id:ae}});case 2:Je=Qe.sent,Je&&oe(J.filter(function(ot){var st;return((st=ot.response)===null||st===void 0?void 0:st.id)!==ae}));case 4:case"end":return Qe.stop()}},Ke)}));function de(){return Ee.apply(this,arguments)}return de}()}),!1}},_e=function(xe){if(J.length)return!1;var ue=xe.size/1024/1024>50;return ue?(U.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E50MB"),!1):!0},Fe=function(){var Ue=Object(H.a)(s.a.mark(function xe(ue){var ae,Ee,de,Ke,Je,je,Qe,ot;return s.a.wrap(function(ht){for(;;)switch(ht.prev=ht.next){case 0:return de=ue||{},Ke=de.language,Je=de.env,je=de.mode,Qe=de.code,ht.next=3,j({type:"newShixuns/applyShixunMirror",payload:{language:Ke,runtime:Je,run_method:je,attachment_id:J==null||((ae=J[0])===null||ae===void 0||((Ee=ae.response)===null||Ee===void 0))?void 0:Ee.id}});case 3:ot=ht.sent,j({type:"newShixuns/setActionTabs",payload:{}}),ot&&U.b.success("\u65B0\u5EFA\u7533\u8BF7\u5DF2\u63D0\u4EA4\uFF0C\u8BF7\u7B49\u5F85\u7BA1\u7406\u5458\u5BA1\u6838\u3002");case 6:case"end":return ht.stop()}},xe)}));return function(ue){return Ue.apply(this,arguments)}}(),We=function(){k.resetFields(),oe([])};return o.a.createElement(F.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:E.actionTabs.key==="NewShixuns-Apply",title:"\u7533\u8BF7\u65B0\u5EFA",width:"1000px",footer:null,afterClose:We},o.a.createElement("section",{className:w.a.qrCode},o.a.createElement("aside",{className:w.a.a1},o.a.createElement("div",{className:w.a.code},o.a.createElement("img",{width:120,height:120,src:x.a,alt:"\u4E8C\u7EF4\u7801"})),o.a.createElement("div",{className:w.a.group},"\u5B9E\u9A8C\u73AF\u5883\u7533\u8BF7QQ\u7FA4"),o.a.createElement("div",{className:w.a.groupNumber},"\u7FA4\u53F7\uFF1A740157011")),o.a.createElement("aside",{className:w.a.a2},"\u5C0A\u656C\u7684\u8001\u5E08/\u540C\u5B66\u60A8\u597D\uFF0C",o.a.createElement("br",null),"\u5982\u679C\u60A8\u60F3\u65B0\u5EFA\u5B9E\u9A8C\u73AF\u5883\uFF0C\u53EF\u4EE5\u626B\u63CF\u5DE6\u4FA7\u4E8C\u7EF4\u7801\u8FDB\u7FA4\uFF0C\u76F4\u63A5\u5411\u6211\u4EEC\u7684\u5DE5\u4F5C\u4EBA\u5458\u7533\u8BF7\u54E6~ \u4E5F\u53EF\u4EE5\u63D0\u4EA4\u4E0B\u9762\u7684\u8868\u5355\u7533\u8BF7\uFF0C\u6211\u4EEC\u7684\u5DE5\u4F5C\u4EBA\u5458\u6536\u5230\u7533\u8BF7\u4FE1\u606F\u5C06\u4F1A\u7B2C\u4E00\u65F6\u95F4\u8054\u7CFB\u60A8\uFF01")),o.a.createElement(g.a,{className:w.a.formWrap,form:k,labelCol:{span:4},wrapperCol:{span:20},onFinish:Fe},o.a.createElement(g.a.Item,{label:"\u8BED\u8A00\uFF1A",name:"language",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u8BED\u8A00"}]},o.a.createElement(_,{placeholder:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u662F\u57FA\u4E8E\u4EC0\u4E48\u8BED\u8A00\uFF1A\u793A\u4F8B\uFF1APython",rows:4})),o.a.createElement(g.a.Item,{label:"\u7CFB\u7EDF\u73AF\u5883\uFF1A",name:"env",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u8BED\u8A00\u7CFB\u7EDF\u73AF\u5883"}]},o.a.createElement(_,{placeholder:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u662F\u57FA\u4E8E\u4EC0\u4E48linux\u7CFB\u7EDF\u73AF\u5883,\u4EE3\u7801\u8FD0\u884C\u73AF\u5883",rows:4})),o.a.createElement(g.a.Item,{label:"\u6D4B\u8BD5\u4EE3\u7801\u8FD0\u884C\u65B9\u5F0F\uFF1A",name:"mode",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u6D4B\u8BD5\u4EE3\u7801\u8FD0\u884C\u65B9\u5F0F"}]},o.a.createElement(_,{placeholder:"\u8BF7\u586B\u5199\u8BE5\u955C\u50CF\u4E2D\u6D4B\u8BD5\u4EE3\u7801\u8FD0\u884C\u65B9\u5F0F",rows:4})),o.a.createElement(g.a.Item,{label:"\u6D4B\u8BD5\u4EE3\u7801\uFF1A",name:"code",rules:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u9644\u4EF6"}]},o.a.createElement("div",{className:w.a.upload},o.a.createElement(Y.a,{fileList:J,action:"".concat(L.a.API_SERVER,"/api/attachments.json?client_key=6d57f8c3dd186c5ada392546ace9620a"),onChange:fe,onRemove:Ne,beforeUpload:_e,withCredentials:!0},o.a.createElement("span",{className:"".concat(w.a.color0152d9," current")},"\u4E0A\u4F20\u9644\u4EF6"),o.a.createElement("span",{className:"".concat(w.a.colorCCC," ml10")},"(\u5355\u4E2A\u6587\u4EF650M\u4EE5\u5185)")))),o.a.createElement("div",{className:w.a.footerWrap},o.a.createElement(g.a.Item,null,o.a.createElement(Q.a,{className:"mr5",size:"large",onClick:function(){j({type:"newShixuns/setActionTabs",payload:{}})}},"\u53D6\u6D88"),o.a.createElement(Q.a,{size:"large",type:"primary",htmlType:"submit",loading:T["newShixuns/applyShixunMirror"]},"\u4FDD\u5B58")))))};_t.a=Object(f.a)(function(y){var h=y.newShixuns,E=y.loading,m=y.globalSetting;return{newShixuns:h,globalSetting:m,loading:E.effects}})(S)},GfqC:function(Mt,_t,q){"use strict";var le=q("q1tI"),Q=q.n(le),P=q("TSYQ"),Y=q.n(P);function D(W,k){var b="cannot "+W.method+" "+W.action+" "+k.status+"'",G=new Error(b);return G.status=k.status,G.method=W.method,G.url=W.action,G}function U(W){var k=W.responseText||W.response;if(!k)return k;try{return JSON.parse(k)}catch(b){return k}}function H(W){var k=new XMLHttpRequest;W.onProgress&&k.upload&&(k.upload.onprogress=function(oe){oe.total>0&&(oe.percent=oe.loaded/oe.total*100),W.onProgress(oe)});var b=new FormData;W.data&&Object.keys(W.data).forEach(function(J){var oe=W.data[J];if(Array.isArray(oe)){oe.forEach(function(fe){b.append(J+"[]",fe)});return}b.append(J,W.data[J])}),W.file instanceof Blob?b.append(W.filename,W.file,W.file.name):b.append(W.filename,W.file),k.onerror=function(oe){W.onError(oe)},k.onload=function(){return k.status<200||k.status>=300?W.onError(D(W,k),U(k)):W.onSuccess(U(k),k)},k.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in k&&(k.withCredentials=!0);var G=W.headers||{};return G["X-Requested-With"]!==null&&k.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(G).forEach(function(J){G[J]!==null&&k.setRequestHeader(J,G[J])}),k.send(b),{abort:function(){k.abort()}}}var I=+new Date,F=0;function R(){return"rc-upload-"+I+"-"+ ++F}function g(W,k){return W.indexOf(k,W.length-k.length)!==-1}var p=function(W,k){if(W&&k){var b=Array.isArray(k)?k:k.split(","),G=W.name||"",J=W.type||"",oe=J.replace(/\/.*$/,"");return b.some(function(fe){var Ne=fe.trim();return Ne.charAt(0)==="."?g(G.toLowerCase(),Ne.toLowerCase()):/\/\*$/.test(Ne)?oe===Ne.replace(/\/.*$/,""):J===Ne})}return!0};function d(W,k){var b=W.createReader(),G=[];function J(){b.readEntries(function(oe){var fe=Array.prototype.slice.apply(oe);G=G.concat(fe);var Ne=!fe.length;Ne?k(G):J()})}J()}var l=function(k,b,G){var J=function oe(fe,Ne){Ne=Ne||"",fe.isFile?fe.file(function(_e){G(_e)&&(fe.fullPath&&!_e.webkitRelativePath&&(Object.defineProperties(_e,{webkitRelativePath:{writable:!0}}),_e.webkitRelativePath=fe.fullPath.replace(/^\//,""),Object.defineProperties(_e,{webkitRelativePath:{writable:!1}})),b([_e]))}):fe.isDirectory&&d(fe,function(_e){_e.forEach(function(Fe){oe(Fe,""+Ne+fe.name+"/")})})};k.forEach(function(oe){J(oe.webkitGetAsEntry())})},n=l,c=Object.assign||function(W){for(var k=1;k<arguments.length;k++){var b=arguments[k];for(var G in b)Object.prototype.hasOwnProperty.call(b,G)&&(W[G]=b[G])}return W},s=function(){function W(k,b){var G=[],J=!0,oe=!1,fe=void 0;try{for(var Ne=k[Symbol.iterator](),_e;!(J=(_e=Ne.next()).done)&&!(G.push(_e.value),b&&G.length===b);J=!0);}catch(Fe){oe=!0,fe=Fe}finally{try{!J&&Ne.return&&Ne.return()}finally{if(oe)throw fe}}return G}return function(k,b){if(Array.isArray(k))return k;if(Symbol.iterator in Object(k))return W(k,b);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function W(k,b){for(var G=0;G<b.length;G++){var J=b[G];J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J&&(J.writable=!0),Object.defineProperty(k,J.key,J)}}return function(k,b,G){return b&&W(k.prototype,b),G&&W(k,G),k}}();function o(W,k,b){return k in W?Object.defineProperty(W,k,{value:b,enumerable:!0,configurable:!0,writable:!0}):W[k]=b,W}function f(W,k){var b={};for(var G in W){if(k.indexOf(G)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,G))continue;b[G]=W[G]}return b}function L(W,k){if(!(W instanceof k))throw new TypeError("Cannot call a class as a function")}function C(W,k){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:W}function x(W,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);W.prototype=Object.create(k&&k.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(W,k):W.__proto__=k)}var A=function(k){return Object.keys(k).reduce(function(b,G){return(G.substr(0,5)==="data-"||G.substr(0,5)==="aria-"||G==="role")&&(b[G]=k[G]),b},{})},w=function(W){x(k,W);function k(){var b,G,J,oe;L(this,k);for(var fe=arguments.length,Ne=Array(fe),_e=0;_e<fe;_e++)Ne[_e]=arguments[_e];return oe=(G=(J=C(this,(b=k.__proto__||Object.getPrototypeOf(k)).call.apply(b,[this].concat(Ne))),J),J.state={uid:R()},J.reqs={},J.onChange=function(Fe){var We=Fe.target.files;J.uploadFiles(We),J.reset()},J.onClick=function(Fe){var We=J.fileInput;if(!We)return;var Ue=J.props,xe=Ue.children,ue=Ue.onClick;xe&&xe.type==="button"&&(We.parentNode.focus(),We.parentNode.querySelector("button").blur()),We.click(),ue&&ue(Fe)},J.onKeyDown=function(Fe){Fe.key==="Enter"&&J.onClick()},J.onFileDrop=function(Fe){var We=J.props.multiple;if(Fe.preventDefault(),Fe.type==="dragover")return;if(J.props.directory)n(Array.prototype.slice.call(Fe.dataTransfer.items),J.uploadFiles,function(xe){return p(xe,J.props.accept)});else{var Ue=Array.prototype.slice.call(Fe.dataTransfer.files).filter(function(xe){return p(xe,J.props.accept)});We===!1&&(Ue=Ue.slice(0,1)),J.uploadFiles(Ue)}},J.uploadFiles=function(Fe){var We=Array.prototype.slice.call(Fe);We.map(function(Ue){return Ue.uid=R(),Ue}).forEach(function(Ue){J.upload(Ue,We)})},J.saveFileInput=function(Fe){J.fileInput=Fe},G),C(J,oe)}return a(k,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(G,J){var oe=this,fe=this.props;if(!fe.beforeUpload)return setTimeout(function(){return oe.post(G)},0);var Ne=fe.beforeUpload(G,J);Ne&&Ne.then?Ne.then(function(_e){var Fe=Object.prototype.toString.call(_e);return Fe==="[object File]"||Fe==="[object Blob]"?oe.post(_e):oe.post(G)}).catch(function(_e){console.log(_e)}):Ne!==!1&&setTimeout(function(){return oe.post(G)},0);return}},{key:"post",value:function(G){var J=this;if(!this._isMounted)return;var oe=this.props,fe=oe.onStart,Ne=oe.onProgress,_e=oe.transformFile,Fe=_e===void 0?function(We){return We}:_e;new Promise(function(We){var Ue=oe.action;return typeof Ue=="function"&&(Ue=Ue(G)),We(Ue)}).then(function(We){var Ue=G.uid,xe=oe.customRequest||H,ue=Promise.resolve(Fe(G)).then(function(ae){var Ee=oe.data;return typeof Ee=="function"&&(Ee=Ee(ae)),Promise.all([ae,Ee])}).catch(function(ae){console.error(ae)});ue.then(function(ae){var Ee=s(ae,2),de=Ee[0],Ke=Ee[1],Je={action:We,filename:oe.name,data:Ke,file:de,headers:oe.headers,withCredentials:oe.withCredentials,method:oe.method||"post",onProgress:Ne?function(je){Ne(je,G)}:null,onSuccess:function(Qe,ot){delete J.reqs[Ue],oe.onSuccess(Qe,G,ot)},onError:function(Qe,ot){delete J.reqs[Ue],oe.onError(Qe,ot,G)}};fe(G),J.reqs[Ue]=xe(Je)})})}},{key:"reset",value:function(){this.setState({uid:R()})}},{key:"abort",value:function(G){var J=this.reqs;if(G){var oe=G;G&&G.uid&&(oe=G.uid),J[oe]&&J[oe].abort&&J[oe].abort(),delete J[oe]}else Object.keys(J).forEach(function(fe){J[fe]&&J[fe].abort&&J[fe].abort(),delete J[fe]})}},{key:"render",value:function(){var G,J=this.props,oe=J.component,fe=J.prefixCls,Ne=J.className,_e=J.disabled,Fe=J.id,We=J.style,Ue=J.multiple,xe=J.accept,ue=J.children,ae=J.directory,Ee=J.openFileDialogOnClick,de=J.onMouseEnter,Ke=J.onMouseLeave,Je=f(J,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),je=Y()((G={},o(G,fe,!0),o(G,fe+"-disabled",_e),o(G,Ne,Ne),G)),Qe=_e?{}:{onClick:Ee?this.onClick:function(){},onKeyDown:Ee?this.onKeyDown:function(){},onMouseEnter:de,onMouseLeave:Ke,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Q.a.createElement(oe,c({},Qe,{className:je,role:"button",style:We}),Q.a.createElement("input",c({},A(Je),{id:Fe,type:"file",ref:this.saveFileInput,onClick:function(st){return st.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:xe,directory:ae?"directory":null,webkitdirectory:ae?"webkitdirectory":null,multiple:Ue,onChange:this.onChange})),ue)}}]),k}(le.Component),_=w,S=Object.assign||function(W){for(var k=1;k<arguments.length;k++){var b=arguments[k];for(var G in b)Object.prototype.hasOwnProperty.call(b,G)&&(W[G]=b[G])}return W},y=function(){function W(k,b){for(var G=0;G<b.length;G++){var J=b[G];J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J&&(J.writable=!0),Object.defineProperty(k,J.key,J)}}return function(k,b,G){return b&&W(k.prototype,b),G&&W(k,G),k}}();function h(W,k){if(!(W instanceof k))throw new TypeError("Cannot call a class as a function")}function E(W,k){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:W}function m(W,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);W.prototype=Object.create(k&&k.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(W,k):W.__proto__=k)}function T(){}var j=function(W){m(k,W);function k(){var b,G,J,oe;h(this,k);for(var fe=arguments.length,Ne=Array(fe),_e=0;_e<fe;_e++)Ne[_e]=arguments[_e];return oe=(G=(J=E(this,(b=k.__proto__||Object.getPrototypeOf(k)).call.apply(b,[this].concat(Ne))),J),J.saveUploader=function(Fe){J.uploader=Fe},G),E(J,oe)}return y(k,[{key:"abort",value:function(G){this.uploader.abort(G)}},{key:"render",value:function(){return Q.a.createElement(_,S({},this.props,{ref:this.saveUploader}))}}]),k}(le.Component);j.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:T,onError:T,onSuccess:T,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var N=j,K=_t.a=N},Gytx:function(Mt,_t){Mt.exports=function(le,Q,P,Y){var D=P?P.call(Y,le,Q):void 0;if(D!==void 0)return!!D;if(le===Q)return!0;if(typeof le!="object"||!le||typeof Q!="object"||!Q)return!1;var U=Object.keys(le),H=Object.keys(Q);if(U.length!==H.length)return!1;for(var I=Object.prototype.hasOwnProperty.bind(Q),F=0;F<U.length;F++){var R=U[F];if(!I(R))return!1;var g=le[R],p=Q[R];if(D=P?P.call(Y,g,p,R):void 0,D===!1||D===void 0&&g!==p)return!1}return!0}},HeST:function(Mt,_t,q){Mt.exports={footerWrap:"footerWrap___1qa9B"}},HjOm:function(Mt,_t,q){"use strict";Object.defineProperty(_t,"__esModule",{value:!0}),_t.default=void 0;var le={locale:"zh_CN",today:"\u4ECA\u5929",now:"\u6B64\u523B",backToToday:"\u8FD4\u56DE\u4ECA\u5929",ok:"\u786E\u5B9A",timeSelect:"\u9009\u62E9\u65F6\u95F4",dateSelect:"\u9009\u62E9\u65E5\u671F",weekSelect:"\u9009\u62E9\u5468",clear:"\u6E05\u9664",month:"\u6708",year:"\u5E74",previousMonth:"\u4E0A\u4E2A\u6708 (\u7FFB\u9875\u4E0A\u952E)",nextMonth:"\u4E0B\u4E2A\u6708 (\u7FFB\u9875\u4E0B\u952E)",monthSelect:"\u9009\u62E9\u6708\u4EFD",yearSelect:"\u9009\u62E9\u5E74\u4EFD",decadeSelect:"\u9009\u62E9\u5E74\u4EE3",yearFormat:"YYYY\u5E74",dayFormat:"D\u65E5",dateFormat:"YYYY\u5E74M\u6708D\u65E5",dateTimeFormat:"YYYY\u5E74M\u6708D\u65E5 HH\u65F6mm\u5206ss\u79D2",previousYear:"\u4E0A\u4E00\u5E74 (Control\u952E\u52A0\u5DE6\u65B9\u5411\u952E)",nextYear:"\u4E0B\u4E00\u5E74 (Control\u952E\u52A0\u53F3\u65B9\u5411\u952E)",previousDecade:"\u4E0A\u4E00\u5E74\u4EE3",nextDecade:"\u4E0B\u4E00\u5E74\u4EE3",previousCentury:"\u4E0A\u4E00\u4E16\u7EAA",nextCentury:"\u4E0B\u4E00\u4E16\u7EAA"},Q=le;_t.default=Q},HmJG:function(Mt,_t,q){},I8Z2:function(Mt,_t,q){"use strict";q.d(_t,"a",function(){return Y}),q.d(_t,"b",function(){return d}),q.d(_t,"c",function(){return n});var le=q("q1tI"),Q=function(){var c=function(s,a){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,f){o.__proto__=f}||function(o,f){for(var L in f)f.hasOwnProperty(L)&&(o[L]=f[L])},c(s,a)};return function(s,a){c(s,a);function o(){this.constructor=s}s.prototype=a===null?Object.create(a):(o.prototype=a.prototype,new o)}}(),P=le.createContext(null),Y=function(c){Q(s,c);function s(){return c!==null&&c.apply(this,arguments)||this}return s.prototype.render=function(){return le.createElement(P.Provider,{value:this.props.store},this.props.children)},s}(le.Component),D=q("Gytx"),U=q.n(D),H=q("2mql"),I=q.n(H),F=function(){var c=function(s,a){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,f){o.__proto__=f}||function(o,f){for(var L in f)f.hasOwnProperty(L)&&(o[L]=f[L])},c(s,a)};return function(s,a){c(s,a);function o(){this.constructor=s}s.prototype=a===null?Object.create(a):(o.prototype=a.prototype,new o)}}(),R=function(){return R=Object.assign||function(c){for(var s,a=1,o=arguments.length;a<o;a++){s=arguments[a];for(var f in s)Object.prototype.hasOwnProperty.call(s,f)&&(c[f]=s[f])}return c},R.apply(this,arguments)};function g(c){return c.displayName||c.name||"Component"}var p=function(){return{}};function d(c,s){s===void 0&&(s={});var a=!!c,o=c||p;return function(L){var C=function(A){F(w,A);function w(_,S){var y=A.call(this,_,S)||this;return y.unsubscribe=null,y.handleChange=function(){if(!y.unsubscribe)return;var h=o(y.store.getState(),y.props);y.setState({subscribed:h})},y.store=y.context,y.state={subscribed:o(y.store.getState(),_),store:y.store,props:_},y}return w.getDerivedStateFromProps=function(_,S){return c&&c.length===2&&_!==S.props?{subscribed:o(S.store.getState(),_),props:_}:{props:_}},w.prototype.componentDidMount=function(){this.trySubscribe()},w.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},w.prototype.shouldComponentUpdate=function(_,S){return!U()(this.props,_)||!U()(this.state.subscribed,S.subscribed)},w.prototype.trySubscribe=function(){a&&(this.unsubscribe=this.store.subscribe(this.handleChange),this.handleChange())},w.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},w.prototype.render=function(){var _=R(R(R({},this.props),this.state.subscribed),{store:this.store});return le.createElement(L,R({},_,{ref:this.props.miniStoreForwardedRef}))},w.displayName="Connect("+g(L)+")",w.contextType=P,w}(le.Component);if(s.forwardRef){var x=le.forwardRef(function(A,w){return le.createElement(C,R({},A,{miniStoreForwardedRef:w}))});return I()(x,L)}return I()(C,L)}}var l=function(){return l=Object.assign||function(c){for(var s,a=1,o=arguments.length;a<o;a++){s=arguments[a];for(var f in s)Object.prototype.hasOwnProperty.call(s,f)&&(c[f]=s[f])}return c},l.apply(this,arguments)};function n(c){var s=c,a=[];function o(C){s=l(l({},s),C);for(var x=0;x<a.length;x++)a[x]()}function f(){return s}function L(C){return a.push(C),function(){var A=a.indexOf(C);a.splice(A,1)}}return{setState:o,getState:f,subscribe:L}}},IH3J:function(Mt,_t,q){Mt.exports={wrapInstallPackageStyle:"wrapInstallPackageStyle___2JdHa",installPackageStyle:"installPackageStyle___3mphi",title:"title___-Mfcd",line:"line___1qKKa",bodyHeight:"bodyHeight___3hV2N"}},KiOF:function(Mt,_t,q){Mt.exports={wrap:"wrap___3dUOw","test-case-name":"test-case-name___1keuO","btn-remove-case":"btn-remove-case___i9eN1",in:"in___mbx0p",se:"se___15Bvt",fourPart:"fourPart___36dQ3",groupWrap:"groupWrap___mgj4-",customInput:"customInput___3AbsZ"}},LdHM:function(Mt,_t,q){"use strict";q.d(_t,"b",function(){return f}),q.d(_t,"a",function(){return C});var le=q("1OyB"),Q=q("vuIU"),P=q("Ji7U"),Y=q("LK+K"),D=q("q1tI"),U=q("rePB"),H=q("Ff2n"),I=q("ODXe"),F=q("4IlW"),R=q("bX4T"),g=q("YrtM"),p=q("TSYQ"),d=q.n(p),l=q("+nKL"),n=q("8OUc"),c=function(G,J){var oe=G.prefixCls,fe=G.id,Ne=G.flattenOptions,_e=G.childrenAsData,Fe=G.values,We=G.searchValue,Ue=G.multiple,xe=G.defaultActiveFirstOption,ue=G.height,ae=G.itemHeight,Ee=G.notFoundContent,de=G.open,Ke=G.menuItemSelectedIcon,Je=G.virtual,je=G.onSelect,Qe=G.onToggleOpen,ot=G.onActiveValue,st=G.onScroll,ht=G.onMouseEnter,mt="".concat(oe,"-item"),ft=Object(g.a)(function(){return Ne},[de,Ne],function(wt,Be){return Be[0]&&wt[1]!==Be[1]}),Ht=D.useRef(null),Vt=function(Be){Be.preventDefault()},zt=function(Be){Ht.current&&Ht.current.scrollTo({index:Be})},Tt=function(Be){for(var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,Ie=ft.length,se=0;se<Ie;se+=1){var ce=(Be+se*Ae+Ie)%Ie,ye=ft[ce],Se=ye.group,ke=ye.data;if(!Se&&!ke.disabled)return ce}return-1},hn=D.useState(function(){return Tt(0)}),Xt=Object(I.a)(hn,2),Wt=Xt[0],it=Xt[1],un=function(Be){it(Be);var Ae=ft[Be];if(!Ae){ot(null,-1);return}ot(Ae.data.value,Be)};D.useEffect(function(){un(xe!==!1?Tt(0):-1)},[ft.length,We]),D.useEffect(function(){var wt=setTimeout(function(){if(!Ue&&de&&Fe.size===1){var Be=Array.from(Fe)[0],Ae=ft.findIndex(function(Ie){var se=Ie.data;return se.value===Be});un(Ae),zt(Ae)}});return function(){return clearTimeout(wt)}},[de]);var Kt=function(Be){Be!==void 0&&je(Be,{selected:!Fe.has(Be)}),Ue||Qe(!1)};if(D.useImperativeHandle(J,function(){return{onKeyDown:function(Be){var Ae=Be.which;switch(Ae){case F.a.UP:case F.a.DOWN:{var Ie=0;if(Ae===F.a.UP?Ie=-1:Ae===F.a.DOWN&&(Ie=1),Ie!==0){var se=Tt(Wt+Ie,Ie);zt(se),un(se)}break}case F.a.ENTER:{var ce=ft[Wt];ce&&!ce.data.disabled?Kt(ce.data.value):Kt(void 0),de&&Be.preventDefault();break}case F.a.ESC:Qe(!1)}},onKeyUp:function(){},scrollTo:function(Be){zt(Be)}}}),ft.length===0)return D.createElement("div",{role:"listbox",id:"".concat(fe,"_list"),className:"".concat(mt,"-empty"),onMouseDown:Vt},Ee);function qe(wt){var Be=ft[wt];if(!Be)return null;var Ae=Be.data||{},Ie=Ae.value,se=Ae.label,ce=Ae.children,ye=Object(R.a)(Ae,!0),Se=_e?ce:se;return Be?D.createElement("div",Object.assign({"aria-label":typeof Se=="string"?Se:null},ye,{key:wt,role:"option",id:"".concat(fe,"_list_").concat(wt),"aria-selected":Fe.has(Ie)}),Ie):null}return D.createElement(D.Fragment,null,D.createElement("div",{role:"listbox",id:"".concat(fe,"_list"),style:{height:0,width:0,overflow:"hidden"}},qe(Wt-1),qe(Wt),qe(Wt+1)),D.createElement(l.a,{itemKey:"key",ref:Ht,data:ft,height:ue,itemHeight:ae,fullHeight:!1,onMouseDown:Vt,onScroll:st,virtual:Je,onMouseEnter:ht},function(wt,Be){var Ae,Ie=wt.group,se=wt.groupOption,ce=wt.data,ye=ce.label,Se=ce.key;if(Ie)return D.createElement("div",{className:d()(mt,"".concat(mt,"-group"))},ye!==void 0?ye:Se);var ke=ce.disabled,et=ce.value,yt=ce.title,$t=ce.children,gn=ce.style,Dt=ce.className,zn=Object(H.a)(ce,["disabled","value","title","children","style","className"]),Ln=Fe.has(et),sn="".concat(mt,"-option"),_i=d()(mt,sn,Dt,(Ae={},Object(U.a)(Ae,"".concat(sn,"-grouped"),se),Object(U.a)(Ae,"".concat(sn,"-active"),Wt===Be&&!ke),Object(U.a)(Ae,"".concat(sn,"-disabled"),ke),Object(U.a)(Ae,"".concat(sn,"-selected"),Ln),Ae)),si=_e?$t:ye,zi=!Ke||typeof Ke=="function"||Ln;return D.createElement("div",Object.assign({},zn,{"aria-selected":Ln,className:_i,title:yt,onMouseMove:function(){if(Wt===Be||ke)return;un(Be)},onClick:function(){ke||Kt(et)},style:gn}),D.createElement("div",{className:"".concat(sn,"-content")},si||et),D.isValidElement(Ke)||Ln,zi&&D.createElement(n.a,{className:"".concat(mt,"-option-state"),customizeIcon:Ke,customizeIconProps:{isSelected:Ln}},Ln?"\u2713":null))}))},s=D.forwardRef(c);s.displayName="OptionList";var a=s,o=function(){return null};o.isSelectOption=!0;var f=o,L=function(){return null};L.isSelectOptGroup=!0;var C=L,x=q("VTBJ"),A=q("Zm9Q");function w(b){var G=b.key,J=b.props,oe=J.children,fe=J.value,Ne=Object(H.a)(J,["children","value"]);return Object(x.a)({key:G,value:fe!==void 0?fe:G,children:oe},Ne)}function _(b){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(A.a)(b).map(function(J,oe){if(!D.isValidElement(J)||!J.type)return null;var fe=J.type.isSelectOptGroup,Ne=J.key,_e=J.props,Fe=_e.children,We=Object(H.a)(_e,["children"]);return G||!fe?w(J):Object(x.a)(Object(x.a)({key:"__RC_SELECT_GRP__".concat(Ne===null?oe:Ne,"__"),label:Ne},We),{},{options:_(Fe)})}).filter(function(J){return J})}var S=q("2Qr1"),y=q("qNPg"),h=q("U8pU"),E=q("Kwbf"),m=q("WKfj");function T(b){var G=b.mode,J=b.options,oe=b.children,fe=b.backfill,Ne=b.allowClear,_e=b.placeholder,Fe=b.getInputElement,We=b.showSearch,Ue=b.onSearch,xe=b.defaultOpen,ue=b.autoFocus,ae=b.labelInValue,Ee=b.value,de=b.inputValue,Ke=b.optionLabelProp,Je=G==="multiple"||G==="tags",je=We!==void 0?We:Je||G==="combobox",Qe=J||_(oe);if(Object(E.a)(G!=="tags"||Qe.every(function(mt){return!mt.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),G==="tags"||G==="combobox"){var ot=Qe.some(function(mt){return mt.options?mt.options.some(function(ft){return typeof("value"in ft?ft.value:ft.key)=="number"}):typeof("value"in mt?mt.value:mt.key)=="number"});Object(E.a)(!ot,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(E.a)(G!=="combobox"||!Ke,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(E.a)(G==="combobox"||!fe,"`backfill` only works with `combobox` mode."),Object(E.a)(G==="combobox"||!Fe,"`getInputElement` only work with `combobox` mode."),Object(E.b)(G!=="combobox"||!Fe||!Ne||!_e,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Ue&&!je&&G!=="combobox"&&G!=="tags"&&Object(E.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(E.b)(!xe||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Ee!=null){var st=Object(m.d)(Ee);Object(E.a)(!ae||st.every(function(mt){return Object(h.a)(mt)==="object"&&("key"in mt||"value"in mt)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(E.a)(!Je||Array.isArray(Ee),"`value` should be array when `mode` is `multiple` or `tags`")}if(oe){var ht=null;Object(A.a)(oe).some(function(mt){if(!D.isValidElement(mt)||!mt.type)return!1;var ft=mt.type;if(ft.isSelectOption)return!1;if(ft.isSelectOptGroup){var Ht=Object(A.a)(mt.props.children).every(function(Vt){return!D.isValidElement(Vt)||!mt.type||Vt.type.isSelectOption?!0:(ht=Vt.type,!1)});return!Ht}return ht=ft,!0}),ht&&Object(E.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ht.displayName||ht.name||ht,"`.")),Object(E.a)(de===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var j=T,N=Object(y.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:_,flattenOptions:S.d,getLabeledValue:S.e,filterOptions:S.b,isValueDisabled:S.g,findValueOption:S.c,warningProps:j,fillOptionsWithMissingValue:S.a}),K=function(b){Object(P.a)(J,b);var G=Object(Y.a)(J);function J(){var oe;return Object(le.a)(this,J),oe=G.apply(this,arguments),oe.selectRef=D.createRef(),oe.focus=function(){oe.selectRef.current.focus()},oe.blur=function(){oe.selectRef.current.blur()},oe}return Object(Q.a)(J,[{key:"render",value:function(){return D.createElement(N,Object.assign({ref:this.selectRef},this.props))}}]),J}(D.Component);K.Option=f,K.OptGroup=C;var W=K,k=_t.c=W},M8RZ:function(Mt,_t,q){"use strict";q.d(_t,"a",function(){return F});var le=q("fWQN"),Q=q("mtLc"),P=q("yKVA"),Y=q("879j"),D=q("q1tI"),U=q.n(D),H=q("i8i4"),I=q.n(H),F=function(R){Object(P.a)(p,R);var g=Object(Y.a)(p);function p(d){var l;Object(le.a)(this,p),l=g.call(this,d);var n=window.document;return l.node=n.createElement("div"),n.body.appendChild(l.node),l}return Object(Q.a)(p,[{key:"render",value:function(){var l=this.props.children;return Object(H.createPortal)(l,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),p}(U.a.Component)},N3QO:function(Mt,_t,q){"use strict";var le=q("2qtc"),Q=q("kLXV"),P=q("tJVT"),Y=q("q1tI"),D=q.n(Y),U=q("9kvl"),H=q("FPkq"),I=q.n(H),F=function(g){var p,d=g.newShixuns,l=g.dispatch,n=g.user,c=Object(Y.useState)(!1),s=Object(P.a)(c,2),a=s[0],o=s[1];Object(Y.useEffect)(function(){d.actionTabs.key==="Create-Environment"&&L()},[d==null||((p=d.actionTabs)===null||p===void 0)?void 0:p.key]);var f=function(){l({type:"newShixuns/setActionTabs",payload:{}})},L=function(){var x,A,w;f(),((x=n.userInfo)===null||x===void 0?void 0:x.mirror_marker_status)===0?o(!0):((A=n.userInfo)===null||A===void 0?void 0:A.mirror_marker_status)===1?U.d.push("/shixuns/new/CreateImg"):((w=n.userInfo)===null||w===void 0?void 0:w.mirror_marker_status)===2&&Q.a.confirm({title:"\u60A8\u4ECA\u65E5\u5DF2\u8FBE\u5230\u7533\u8BF7\u4E0A\u9650\uFF0C\u662F\u5426\u8DF3\u8F6C\u81F3\u4E91\u4E3B\u673A\u5217\u8868\uFF1F",content:"\u63D0\u793A\uFF1A\u6BCF\u5929\u6700\u591A\u5141\u8BB8\u7533\u8BF7\u4E00\u53F0\u4E91\u4E3B\u673A",okText:"\u8DF3\u8F6C",cancelText:"\u53D6\u6D88",onOk:function(){var S;U.d.push("/users/".concat((S=n.userInfo)===null||S===void 0?void 0:S.login,"/experiment-img"))}})};return D.a.createElement(Q.a,{title:"\u52A0\u5165qq\u7FA4\u63D0\u793A",visible:a,footer:null,onCancel:function(){o(!1)}},D.a.createElement("div",{style:{textAlign:"center"}},D.a.createElement("br",null),D.a.createElement("img",{width:120,height:120,style:{marginTop:"20px"},src:I.a,alt:"\u4E8C\u7EF4\u7801"})),D.a.createElement("img",null))};_t.a=Object(U.a)(function(R){var g=R.newShixuns,p=R.user,d=R.globalSetting;return{newShixuns:g,globalSetting:d,user:p}})(F)},NLgs:function(Mt,_t,q){"use strict";q.d(_t,"e",function(){return f}),q.d(_t,"f",function(){return L}),q.d(_t,"d",function(){return x}),q.d(_t,"c",function(){return A}),q.d(_t,"a",function(){return w}),q.d(_t,"b",function(){return _});var le=q("miYZ"),Q=q("tsqr"),P=q("9og8"),Y=q("2qtc"),D=q("kLXV"),U=q("WmNS"),H=q.n(U),I=q("q1tI"),F=q.n(I),R=q("9kvl"),g=q("xKgJ"),p=q("1vsH"),d=q("RCxd"),l=q("yTi+"),n=q.n(l),c=q("1ZF9"),s=q.n(c),a=q("NoGO"),o=q.n(a),f=function(y){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!!(L(y)&&C(h))},L=function(y){return Object(g.p)()?!0:(y({type:"user/showPopLogin",payload:{showPopLogin:!0,showClosable:!0}}),!1)},C=function(){var y,h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,E=Object(R.c)()._store.getState(),m=E.user;return(y=m.userInfo)!==null&&y!==void 0&&y.profile_completed?!0:(D.a.confirm({title:"\u63D0\u793A",width:530,centered:!0,content:h?"\u6309\u7167\u6709\u5173\u653F\u7B56\u89C4\u5B9A\uFF0C\u7279\u6B8A\u5B9E\u9A8C\u9700\u8981\u5148\u7ED1\u5B9A\u624B\u673A\u53F7\u624D\u80FD\u4F7F\u7528\uFF0C\u8BF7\u5148\u7ED1\u5B9A\u624B\u673A\u53F7\u7801":"\u60A8\u9700\u8981\u53BB\u5B8C\u5584\u60A8\u7684\u4E2A\u4EBA\u8D44\u6599\uFF0C\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD",okText:"\u7ACB\u5373\u5B8C\u5584",cancelText:"\u7A0D\u540E\u5B8C\u5584",onOk:function(){R.d.push("/account/profile/edit")}}),!1)},x=function(){var y,h=Object(R.c)()._store.getState(),E=h.user;return(y=E.userInfo)!==null&&y!==void 0&&y.professional_certification?!0:(D.a.confirm({title:"\u63D0\u793A",centered:!0,content:F.a.createElement("div",{className:"tc"},"\u60A8\u9700\u8981\u53BB\u5B8C\u6210\u60A8\u7684\u804C\u4E1A\u8BA4\u8BC1\uFF0C\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD"),okText:"\u7ACB\u5373\u5B8C\u5584",cancelText:"\u7A0D\u540E\u5B8C\u5584",onOk:function(){Object(p.S)("/account/certification")}}),!1)},A=function(){return Object(g.a)()?!0:(D.a.warning({centered:!0,width:530,title:"\u63D0\u793A",content:F.a.createElement("div",{className:"tc",style:{marginLeft:-38}},F.a.createElement("p",null,"\u626B\u7801\u52A0\u5934\u6B4C\u52A9\u6559\uFF0C\u7533\u8BF7\u64CD\u4F5C\u6743\u9650"),F.a.createElement("img",{src:o.a,width:200})),okText:"\u6211\u77E5\u9053\u4E86",maskClosable:!0}),!1)},w=function(y,h){return y?!0:(D.a.confirm({centered:!0,zIndex:1e4,width:530,title:"\u63D0\u793A",content:F.a.createElement("div",null,F.a.createElement("p",null,h||"\u8BE5\u5B9E\u8DF5\u8D44\u6E90\u9700\u6388\u6743\u540E\u624D\u53EF\u4F7F\u7528\u3002 \u60A8\u53EF\u4EE5\u5728QQ\u670D\u52A1\u7FA4\u5411\u7BA1\u7406\u5458\u7533\u8BF7\uFF0C\u83B7\u5F97\u7EE7\u7EED\u64CD\u4F5C\u7684\u6743\u9650\u3002"),F.a.createElement("div",{style:{marginLeft:"110px"}},F.a.createElement("img",{src:s.a,width:200}),F.a.createElement("div",{style:{marginLeft:"35px"}},"\u7FA4\u53F7\uFF1A","714336072"))),okText:"\u7ACB\u5373\u8054\u7CFB",cancelText:"\u53D6\u6D88",onOk:function(){Object(p.S)("https://qm.qq.com/cgi-bin/qm/qr?k=tIyDPXUtE0yEk-MOJxhH55lTUJS-nYAM&jump_from=webapi")}}),!1)},_=function(y){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",E=Object(R.c)()._store.getState(),m=E.shixunsDetail.detail;return(m==null?void 0:m.public)===2||(m==null?void 0:m.public)===1||(m==null?void 0:m.shixun_status)===3?(D.a.info({centered:!0,icon:F.a.createElement(d.a,{style:{color:"#faad14"}}),width:460,title:"\u63D0\u793A",content:F.a.createElement("div",{className:"tc",style:{marginLeft:-38}},F.a.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",paddingLeft:38,margin:"12px 0"}},F.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u7684\u72B6\u6001\u4E3A",(m==null?void 0:m.public)===2?"\u5DF2\u516C\u5F00":(m==null?void 0:m.public)===1?"\u5F85\u5BA1\u6838":"\u5DF2\u5173\u95ED","\uFF0C",h,"\u3002"),F.a.createElement("p",null,"\u5982\u6709\u9700\u8981\uFF0C\u8BF7\u8054\u7CFB\u5E73\u53F0\u7BA1\u7406\u5458\u8FDB\u884C\u6280\u672F\u652F\u6301\u3002")),F.a.createElement("img",{style:{border:"4px solid #0152d9",borderRadius:"4px"},src:n.a,alt:"\u4E8C\u7EF4\u7801",width:160})),okText:"\u6211\u77E5\u9053\u4E86"}),!0):(m==null?void 0:m.shixun_status)===2?(D.a.confirm({centered:!0,icon:F.a.createElement(d.a,null),title:"\u63D0\u793A",content:F.a.createElement("div",null,F.a.createElement("span",null,"\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5DF2\u53D1\u5E03\uFF0C",h,"\u3002"),F.a.createElement("br",null),F.a.createElement("span",null,"\u5982\u6709\u9700\u8981\uFF0C\u60A8\u53EF\u4EE5\u64A4\u9500\u53D1\u5E03\u540E\uFF0C\u518D\u8FDB\u884C\u64CD\u4F5C\u3002")),okText:"\u64A4\u9500\u53D1\u5E03",cancelText:"\u53D6\u6D88",onOk:function(){D.a.confirm({width:440,centered:!0,icon:F.a.createElement(d.a,{style:{color:"#faad14"}}),title:"\u63D0\u793A",content:"\u64A4\u9500\u53D1\u5E03\u540E\uFF0C\u5B66\u5458\u5C06\u65E0\u6CD5\u8FDB\u884C\u7EC3\u4E60\u3002\u662F\u5426\u786E\u8BA4\u64A4\u9500\u53D1\u5E03\uFF1F",okText:"\u786E\u5B9A\u64A4\u9500\u53D1\u5E03",cancelText:"\u53D6\u6D88",onOk:function(){var j=Object(P.a)(H.a.mark(function K(){var W;return H.a.wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.next=2,y({type:"shixunsDetail/cancelRelease",payload:{id:m==null?void 0:m.identifier}});case 2:W=b.sent,W.status!==401&&(Q.b.success("\u64A4\u9500\u53D1\u5E03\u6210\u529F\u3002\u5B9E\u8BAD\u56DE\u5230\u672A\u53D1\u5E03\u7684\u72B6\u6001\u3002"),y({type:"shixunsDetail/getShixunsDetail",payload:{id:m==null?void 0:m.identifier}}),y({type:"practiceSetting/getCommonData",payload:{id:m==null?void 0:m.identifier}}));case 4:case"end":return b.stop()}},K)}));function N(){return j.apply(this,arguments)}return N}()})}}),!0):!1}},NoGO:function(Mt,_t,q){Mt.exports=q.p+"static/newqrcode.d852fdfc.png"},OLES:function(Mt,_t,q){"use strict";var le=q("U8pU"),Q=q("VTBJ"),P=q("Ff2n"),Y=q("q1tI"),D=q("uciX"),U=q("7ixt"),H=function(d){var l=d.overlay,n=d.prefixCls,c=d.id,s=d.overlayInnerStyle;return Y.createElement("div",{className:"".concat(n,"-inner"),id:c,role:"tooltip",style:s},typeof l=="function"?l():l)},I=H,F=function(d,l){var n=d.overlayClassName,c=d.trigger,s=c===void 0?["hover"]:c,a=d.mouseEnterDelay,o=a===void 0?0:a,f=d.mouseLeaveDelay,L=f===void 0?.1:f,C=d.overlayStyle,x=d.prefixCls,A=x===void 0?"rc-tooltip":x,w=d.children,_=d.onVisibleChange,S=d.afterVisibleChange,y=d.transitionName,h=d.animation,E=d.placement,m=E===void 0?"right":E,T=d.align,j=T===void 0?{}:T,N=d.destroyTooltipOnHide,K=N===void 0?!1:N,W=d.defaultVisible,k=d.getTooltipContainer,b=d.overlayInnerStyle,G=Object(P.a)(d,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),J=Object(Y.useRef)(null);Object(Y.useImperativeHandle)(l,function(){return J.current});var oe=Object(Q.a)({},G);"visible"in d&&(oe.popupVisible=d.visible);var fe=function(){var Ue=d.arrowContent,xe=Ue===void 0?null:Ue,ue=d.overlay,ae=d.id;return[Y.createElement("div",{className:"".concat(A,"-arrow"),key:"arrow"},xe),Y.createElement(I,{key:"content",prefixCls:A,id:ae,overlay:ue,overlayInnerStyle:b})]},Ne=!1,_e=!1;if(typeof K=="boolean")Ne=K;else if(K&&Object(le.a)(K)==="object"){var Fe=K.keepParent;Ne=Fe===!0,_e=Fe===!1}return Y.createElement(D.a,Object.assign({popupClassName:n,prefixCls:A,popup:fe,action:s,builtinPlacements:U.a,popupPlacement:m,ref:J,popupAlign:j,getPopupContainer:k,onPopupVisibleChange:_,afterPopupVisibleChange:S,popupTransitionName:y,popupAnimation:h,defaultPopupVisible:W,destroyPopupOnHide:Ne,autoDestroy:_e,mouseLeaveDelay:L,popupStyle:C,mouseEnterDelay:o},oe),w)},R=Object(Y.forwardRef)(F),g=_t.a=R},Ot1p:function(Mt,_t,q){"use strict";var le=q("2qtc"),Q=q("kLXV"),P=q("rAM+"),Y=q("miYZ"),D=q("tsqr"),U=q("9og8"),H=q("tJVT"),I=q("jrin"),F=q("WmNS"),R=q.n(F),g=q("q1tI"),p=q.n(g),d=q("VrN/"),l=q.n(d),n=q("bdgK"),c=q("p77/"),s=q("Bd2K"),a=q("ELLl"),o=q("19Vz"),f=q("lZu9"),L=q("+NIl"),C=q("kSUc"),x=q("9Bee"),A=function(ke){var et=ke.value,yt=et===void 0?"":et,$t=ke.className,gn=ke.showTextOnly,Dt=ke.showLines,zn=ke.style,Ln=zn===void 0?{}:zn,sn=Object(g.useMemo)(function(){return""},[yt]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:sn}}))},w=q("0Owb"),_=q("dejd"),S=q("C+DQ"),y=q("1vsH"),h=q("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(ke){var et=ke.onActionCallback,yt=ke.title,$t=ke.icon,gn=ke.actionName,Dt=ke.className,zn=Dt===void 0?"":Dt,Ln=ke.children;function sn(){et(gn)}return p.a.createElement("a",{title:yt,className:zn,onClick:sn},p.a.createElement("i",{className:"md-iconfont ".concat($t)}),Ln)}var T=function(ke){var et=ke.watch,yt=ke.showNullButton,$t=ke.onActionCallback,gn=ke.fullScreen,Dt=ke.insertTemp,zn=ke.hidetoolBar,Ln=ke.uuid,sn=ke.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(y.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(y.F)("_educoder_session"),"&key=").concat(Ln,"&api=").concat(encodeURIComponent(h.a.PROXY_SERVER)));var _i=[].concat(E,[{title:"".concat(et?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(et?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!zn&&_i.map(function(si,zi){return p.a.createElement("li",{key:zi},si.actionName?p.a.createElement(m,Object(w.a)({},si,{onActionCallback:$t})):p.a.createElement("span",{className:"v-line"}))}),yt?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:$t},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Dt&&p.a.createElement("li",null,p.a.createElement(m,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Dt),onActionCallback:$t},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(gn?"icon-shrink":"icon-enlarge"),title:gn?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:$t})))},j=q("M8RZ"),N=q("+L6B"),K=q("2/Rp"),W=q("y8nQ"),k=q("Vl3Y"),b=q("5NDa"),G=q("5rEg"),J={labelCol:{span:4},wrapperCol:{span:20}},oe=function(ke){var et=ke.callback,yt=ke.onCancel;function $t(gn){et(gn)}return p.a.createElement(k.a,Object(w.a)({},J,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:$t}),p.a.createElement(k.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(k.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(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(K.a,{type:"ghost",onClick:yt},"\u53D6\u6D88")))},fe=q("7ahc"),Ne=q("HmJG"),_e=q("BjJ7"),Fe=k.a.useForm,We={width:280,marginRight:10},Ue={labelCol:{span:5},wrapperCol:{span:19}},xe=function(ke){var et=ke.callback,yt=ke.onCancel,$t=Fe(),gn=Object(H.a)($t,1),Dt=gn[0];function zn(_i){et(_i)}function Ln(_i,si){if(_i.status===-1){D.b.error(_i.message);return}Dt.setFieldsValue({src:"/api/attachments/".concat(_i.id),type:si.type})}function sn(_i){var si=_i.target.files[0];ae(si,Ln)}return p.a.createElement(k.a,Object(w.a)({form:Dt},Ue,{className:"upload-image-panel",onFinish:zn}),p.a.createElement(k.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(k.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},p.a.createElement(G.a,{style:We})),p.a.createElement(ue,{onFileChange:sn}))),p.a.createElement(k.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},p.a.createElement(G.a,{style:{width:264}})),p.a.createElement(k.a.Item,{style:{textAlign:"right"}},p.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(K.a,{type:"ghost",onClick:yt},"\u53D6\u6D88")))};function ue(ke){var et=ke.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:et}))}function ae(ke,et){if(!ke)throw new String("\u6CA1\u6709\u6587\u4EF6");var yt=new FormData;yt.append("editormd-image-file",ke),yt.append("file_param_name","editormd-image-file"),yt.append("byxhr","true");var $t=new window.XMLHttpRequest;$t.withCredentials=!0,$t.addEventListener("load",function(gn){et(JSON.parse(gn.target.responseText),ke)},!1),$t.addEventListener("error",function(gn){console.error(gn)},!1),$t.open("POST","".concat(_e.a,"/api/attachments.json")),$t.send(yt)}var Ee=q("giR+"),de=q("fyUT"),Ke=q("7Kak"),Je=q("9yH6"),je=Je.a.Group,Qe={margin:"0 8px"},ot=function(ke){var et=ke.callback,yt=ke.onCancel;function $t(gn){et(gn)}return p.a.createElement(k.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:$t},p.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},p.a.createElement("span",{style:Qe},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:Qe},"\u884C\u6570"),p.a.createElement(k.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(de.a,null)),p.a.createElement("span",{style:Qe},"\u5217\u6570"),p.a.createElement(k.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},p.a.createElement(de.a,null))),p.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},p.a.createElement("span",{style:Qe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(k.a.Item,{name:"align"},p.a.createElement(je,null,p.a.createElement(Je.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(Je.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(Je.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(Je.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(K.a,{type:"ghost",onClick:yt},"\u53D6\u6D88")))},st=q("ErOA"),ht=q("7Cbv"),mt="link",ft="upload-image",Ht="code-block",Vt="add-table",zt="------------",Tt={default:zt,left:":".concat(zt),center:":".concat(zt,":"),right:"".concat(zt,":")},hn=q("9VGf"),Xt,Wt;function it(){}var un=0,Kt=1e4,qe="\u2581",wt=`
|
|
**\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 Be(ke){return/^\d+$/.test(ke)?"".concat(ke,"px"):ke}var Ae=navigator.platform.toUpperCase().indexOf("MAC")>=0,Ie=Ae?"Cmd":"Ctrl",se=["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"],ce=(Xt={},Object(I.a)(Xt,Ie+"-B","bold"),Object(I.a)(Xt,Ie+"-I","italic"),Xt),ye=(Wt={},Object(I.a)(Wt,mt,"\u6DFB\u52A0\u94FE\u63A5"),Object(I.a)(Wt,Ht,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(I.a)(Wt,ft,"\u6DFB\u52A0\u6587\u4EF6"),Object(I.a)(Wt,Vt,"\u6DFB\u52A0\u8868\u683C"),Wt),Se=_t.a=function(ke){var et=ke.defaultValue,yt=et===void 0?"":et,$t=ke.onChange,gn=ke.width,Dt=gn===void 0?"100%":gn,zn=ke.height,Ln=zn===void 0?400:zn,sn=ke.miniToolbar,_i=sn===void 0?!1:sn,si=ke.isFocus,zi=si===void 0?!1:si,Oi=ke.watch,Qn=ke.insertTemp,ir=ke.mode,qi=ir===void 0?"markdown":ir,It=ke.id,Hn=It===void 0?"markdown-editor-id":It,li=ke.showResizeBar,Gt=li===void 0?!1:li,Bt=ke.noStorage,Rn=Bt===void 0?!1:Bt,Wn=ke.showNullButton,nn=Wn===void 0?!1:Wn,Pt=ke.hidetoolBar,Mi=Pt===void 0?!1:Pt,$i=ke.fullScreen,ui=$i===void 0?!1:$i,vn=ke.onBlur,Bi=ke.onCMBeforeChange,Ai=ke.onFullScreen,Pi=ke.className,ct=Pi===void 0?"":Pi,Zt=ke.disablePaste,Ei=Zt===void 0?!1:Zt,ji=ke.placeholder,ri=ji===void 0?"":ji,ii=ke.values,X=ii===void 0?"":ii,v=Object(g.useState)(null),O=Object(H.a)(v,2),B=O[0],te=O[1],z=Object(g.useState)(yt),be=Object(H.a)(z,2),tt=be[0],Ot=be[1],Ct=Object(g.useState)(Oi),at=Object(H.a)(Ct,2),Yt=at[0],Cn=at[1],Nn=Object(g.useState)(ui),Hi=Object(H.a)(Nn,2),Ri=Hi[0],fi=Hi[1],sr=Object(g.useState)(""),rr=Object(H.a)(sr,2),wi=rr[0],lr=rr[1],mr=Object(g.useState)(0),ai=Object(H.a)(mr,2),on=ai[0],ci=ai[1],Qt=Object(g.useState)(Ln),di=Object(H.a)(Qt,2),Fn=di[0],bi=di[1],$=Object(g.useState)(!1),pe=Object(H.a)($,2),Oe=pe[0],Re=pe[1],Ge=Object(g.useRef)(Object(ht.a)()),Me=Object(g.useRef)(!1),$e=Object(g.useRef)(),Ye=Object(g.useRef)(),ut=Object(g.useRef)(),Ze=Object(g.useRef)(),dt=Object(g.useRef)(),lt=function(){var At=Object(U.a)(R.a.mark(function cn(){var Jt,wn;return R.a.wrap(function(Vn){for(;;)switch(Vn.prev=Vn.next){case 0:return Vn.next=2,Object(st.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Ge.current}});case 2:wn=Vn.sent,wn!=null&&(Jt=wn.attachments)!==null&&Jt!==void 0&&Jt.length&&(console.log("cm:",B,Ye),wn.attachments.map(function(Kn){Kn.content_type.indexOf("image")>-1?B.replaceSelection(".concat(Kn.content_type,")")):Kn.content_type.indexOf("video")>-1?B.replaceSelection('<video width="100%" controls src="'.concat(h.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Kn.content_type.indexOf("pdf")>-1?B.replaceSelection('<a href="'.concat(h.a.API_SERVER,"/api/attachments/").concat(Kn.id,"?type=").concat(Kn.content_type,'&disposition=inline" target="_blank">').concat(Kn.name,"</a>")):B.replaceSelection("[".concat(Kn.name,"](").concat(h.a.API_SERVER,"/api/attachments/").concat(Kn.id,"?type=").concat(Kn.content_type,")"))}));case 4:case"end":return Vn.stop()}},cn)}));return function(){return At.apply(this,arguments)}}();Object(g.useEffect)(function(){Ot(X),B==null||B.setValue(X)},[X]),Object(g.useEffect)(function(){Ai==null||Ai(Ri)},[Ri]),Object(g.useEffect)(function(){if(Ye.current){var At=l.a.fromTextArea(Ye.current,{mode:qi,lineNumbers:!_i,lineWrapping:!0,value:yt,autoCloseTags:!0,autoCloseBrackets:!0});zi&&At.focus();function cn(Jt,wn){if(Ei){wn.preventDefault();return}var En=wn.clipboardData;if(En){var Vn=En.types.toString(),Kn=En.items;if(Vn==="Files"||En.types.indexOf("Files")>-1){if(wn.preventDefault(),qi=="stex")return;try{var Di,ln=Kn[1];((Di=Kn[0])===null||Di===void 0?void 0:Di.kind)==="file"&&(ln=Kn[0]);var kt=ln.getAsFile(),Yn=kt.name.split(".").pop();ae(kt,function(mn){if(mn.id){var Sn,Un,Bn;(kt==null||((Sn=kt.type)===null||Sn===void 0)?void 0:Sn.indexOf("image"))>-1?At.replaceSelection(".concat(mn.content_type,")")):(kt==null||((Un=kt.type)===null||Un===void 0)?void 0:Un.indexOf("video"))>-1?At.replaceSelection('<video width="100%" controls src="'.concat(h.a.API_SERVER,"/api/attachments/").concat(mn.id,'"></video>')):(kt==null||((Bn=kt.type)===null||Bn===void 0)?void 0:Bn.indexOf("pdf"))>-1?At.replaceSelection('<a href="'.concat(h.a.API_SERVER,"/api/attachments/").concat(mn.id,"?type=").concat(kt.type,'&disposition=inline" target="_blank">').concat(kt.name,"</a>")):se.includes(Yn)?At.replaceSelection('<a href="'.concat(h.a.API_SERVER,"/api/attachments/").concat(mn.id,'?type=office&disposition=inline" target="_blank">').concat(kt.name,"</a>")):At.replaceSelection("[".concat(kt.name,"](").concat(h.a.API_SERVER,"/api/attachments/").concat(mn.id,"?type=").concat(mn.content_type,")"))}else(mn==null?void 0:mn.status)===401&&(document.location.href="/user/login")})}catch(mn){D.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return At.on("paste",cn),At.on("dragleave",function(Jt,wn){ut.current.classList.remove("mouse-hover-md")}),At.on("dragover",function(Jt,wn){ut.current.classList.add("mouse-hover-md")}),At.on("drop",function(Jt,wn){ut.current.classList.add("mouse-hover-md");var En;if(En=wn.dataTransfer.files,En.length>0){wn.preventDefault(),wn.stopPropagation();for(var Vn=function(ln){var kt=En[ln],Yn=kt.name.split(".").pop();ae(kt,function(mn){if(mn.id){var Sn,Un,Bn;(kt==null||((Sn=kt.type)===null||Sn===void 0)?void 0:Sn.indexOf("image"))>-1?At.replaceSelection(".concat(mn.content_type,")")):(kt==null||((Un=kt.type)===null||Un===void 0)?void 0:Un.indexOf("video"))>-1?At.replaceSelection('<video width="100%" controls src="'.concat(h.a.API_SERVER,"/api/attachments/").concat(mn.id,'"></video>')):(kt==null||((Bn=kt.type)===null||Bn===void 0)?void 0:Bn.indexOf("pdf"))>-1?At.replaceSelection('<a href="'.concat(h.a.API_SERVER,"/api/attachments/").concat(mn.id,"?type=").concat(kt.type,'&disposition=inline" target="_blank">').concat(kt.name,"</a>")):se.includes(Yn)?At.replaceSelection('<a href="'.concat(h.a.API_SERVER,"/api/attachments/").concat(mn.id,'?type=office&disposition=inline" target="_blank">').concat(kt.name,"</a>")):At.replaceSelection("[".concat(kt.name,"](").concat(h.a.API_SERVER,"/api/attachments/").concat(mn.id,"?type=").concat(mn.content_type,")"))}else(mn==null?void 0:mn.status)===401&&(document.location.href="/user/login")})},Kn=0;Kn<En.length;Kn++)Vn(Kn)}}),te(At),function(){At.off("paste",cn)}}},[]);var nt=Object(g.useCallback)(function(){if(ut.current)try{}catch(At){console.log(At,"---- to set md editor body height")}},[Fn,ut,Ri]);Object(g.useEffect)(function(){function At(){var Jt=new n.default(function(wn){var En=Object(P.a)(wn),Vn;try{for(En.s();!(Vn=En.n()).done;){var Kn=Vn.value;(Kn.target.offsetHeight>0||Kn.target.offsetWidth>0)&&(nt(),B.setSize("100%","100%"),B.refresh())}}catch(Di){En.e(Di)}finally{En.f()}});return Jt.observe(Ye.current.parentElement),Jt}if(B){var cn=At();return function(){cn.unobserve(Ye.current.parentElement)}}},[B,nt]),Object(g.useEffect)(function(){if(B){for(var At=[],cn=function(){var Kn=wn[Jt];En=Object(H.a)(Kn,2);var Di=En[0],ln=En[1],kt=Object(I.a)({},Di,function(){Et(ln)});At.push(kt),B.addKeyMap(kt)},Jt=0,wn=Object.entries(ce);Jt<wn.length;Jt++){var En;cn()}return $e.current=setInterval(function(){Me.current&<()},4e3),function(){clearInterval($e.current);var Vn=Object(P.a)(At),Kn;try{for(Vn.s();!(Kn=Vn.n()).done;){var Di=Kn.value;B.removeKeyMap(Di)}}catch(ln){Vn.e(ln)}finally{Vn.f()}}}},[B]),Object(g.useEffect)(function(){ui!==Ri&&fi(ui)},[ui]),Object(hn.a)(function(){if(!Rn&&on>0){var At=new Date().getTime(),cn=window.sessionStorage.getItem(Hn);At>=on+Kt&&(!cn||cn!==tt)&&(window.sessionStorage.setItem(Hn,tt),Re(!0))}},Kt),Object(g.useEffect)(function(){Cn(Oi)},[B,Oi]),Object(g.useEffect)(function(){B&&(zi&&B.focus())},[B,zi]),Object(g.useEffect)(function(){if(Yt&&B){var At=B.getScrollerElement();function cn(Jt){var wn=Jt.target;if(dt.current){var En=wn.scrollTop/wn.scrollHeight;dt.current.scrollTop=dt.current.scrollHeight*En}}return At.addEventListener("scroll",cn),function(){At.removeEventListener("scroll",cn)}}},[B,Yt]),Object(g.useEffect)(function(){if(B&&Bi){function At(cn,Jt){Bi(cn,Jt)}return B.on("beforeChange",At),function(){B.off("beforeChange",At)}}},[B,Bi]),Object(g.useEffect)(function(){if(B&&vn){function At(){vn(B.getValue())}return B.on("blur",At),function(){B.off("blur",At)}}},[B,vn]),Object(g.useEffect)(function(){if(B){function At(cn){var Jt=cn.getValue();Ot(Jt),ci(new Date().getTime()),cn.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),$t&&$t(Jt)}return B.on("change",At),function(){B.off("change",At)}}},[B,$t]),Object(g.useEffect)(function(){B&&(yt==null?(B.setValue(""),Ot("")):yt!==B.getValue()&&(B.setValue(yt),Ot(yt),B.setCursor(B.lineCount(),0)))},[B,yt]);var Et=Object(g.useCallback)(function(At){var cn=B.getCursor(),Jt=B.getSelection(),wn=Jt.split(`
|
|
`);switch(At){case"bold":return B.replaceSelection("**"+Jt+"**"),Jt===""&&B.setCursor(cn.line,cn.ch+2),B.focus();case"italic":return B.replaceSelection("*"+Jt+"*"),Jt===""&&B.setCursor(cn.line,cn.ch+1),B.focus();case"code":return B.replaceSelection("`"+Jt+"`"),Jt===""&&B.setCursor(cn.line,cn.ch+1),B.focus();case"inline-latex":return B.replaceSelection("`$$"+Jt+"$$`"),Jt===""&&B.setCursor(cn.line,cn.ch+3),B.focus();case"latex":return B.replaceSelection("```latex\n"+Jt+"\n```"),B.setCursor(cn.line+1,Jt.length+1),B.focus();case"line-break":return B.replaceSelection(`<br/>
|
|
`),B.focus();case"list-ul":return Jt===""?B.replaceSelection("- "+Jt):B.replaceSelection(wn.map(function(En){return En===""?"":"- ".concat(En)}).join(`
|
|
`)),B.focus();case"list-ol":return Jt===""?B.replaceSelection("1. "+Jt):B.replaceSelection(wn.map(function(En,Vn){return En===""?"":"".concat(Vn+1,". ").concat(En)}).join(`
|
|
`)),B.focus();case"add-null-ch":return Jt===""&&B.setCursor(cn.line,cn.ch+1),B.replaceSelection(qe),B.focus();case"inster-template-1":return Jt===""&&B.setCursor(cn.line,cn.ch),B.replaceSelection(wt),B.focus();case"eraser":return B.setValue(""),B.focus();case"trigger-watch":return Cn(!Yt),B.focus();case"trigger-full-screen":return fi(!Ri),B.focus();case mt:lr(mt);return;case Ht:lr(Ht);return;case ft:lr(ft);return;case Vt:lr(Vt);return;default:throw new Error}},[B,Yt,Ri]),pt=Object(g.useCallback)(function(At){lr("");switch(wi){case mt:var cn=At.title,Jt=At.link;return B.replaceSelection("[".concat(cn,"](").concat(Jt,")")),B.focus();case Ht:var wn=At.language,En=At.content;return B.replaceSelection(["```"+wn,En,"```"].join(`
|
|
`)),B.focus();case ft:var Vn=At.src,Kn=At.alt;return Kn?B.replaceSelection(".concat(Vn,' "').concat(Kn,'" )')):B.replaceSelection("")),B.focus();case Vt:for(var Di=At.row,ln=At.col,kt=At.align,Yn=`
|
|
`,mn=0;mn<Di;mn++){for(var Sn=[],Un=[],Bn=0;Bn<ln;Bn++)mn===1&&Un.push(Tt[kt]),Sn.push(" ");mn===1&&(Yn+="| ".concat(Un.join(" | "),` |
|
|
`)),Yn+="| ".concat(Sn.join(ln===1?"":" | "),` |
|
|
`)}return B.replaceSelection(Yn+`
|
|
`),B.focus();default:throw new Error}},[B,wi]),Lt=Object(g.useMemo)(function(){switch(wi){case mt:return p.a.createElement(oe,{callback:pt,onCancel:bt});case Ht:return p.a.createElement(fe.b,{callback:pt,onCancel:bt});case ft:return p.a.createElement(xe,{callback:pt,onCancel:bt});case Vt:return p.a.createElement(ot,{callback:pt,onCancel:bt});default:return null}},[wi]);function bt(){lr("")}Object(g.useEffect)(function(){if(Ze.current){var At=Ze.current,cn=!1,Jt=0;function wn(Kn){cn=!0,Jt=Kn.pageY}function En(){cn=!1}function Vn(Kn){if(cn){var Di=Kn.pageY-Jt;Di<0&&(Di=0),Di>300&&(Di=300);var ln=Ln+Di+"px";bi(ln)}}return At.addEventListener("mousedown",wn),document.addEventListener("mousemove",Vn),document.addEventListener("mouseup",En),function(){At.removeEventListener("mousedown",wn),document.removeEventListener("mousemove",Vn),document.removeEventListener("mouseup",En)}}},[B,Ze]),Object(g.useEffect)(function(){bi(Ln)},[Ln]);var Nt=Be(Dt),qt=Be(Fn),rn={width:Nt,height:qt},ti=Object(g.useMemo)(function(){if(on){var At=new Date(on),cn=At.getHours(),Jt=At.getMinutes(),wn=At.getSeconds();return cn=cn<10?"0"+cn:cn,Jt=Jt<10?"0"+Jt:Jt,wn=wn<10?"0"+wn:wn,"".concat(cn,":").concat(Jt,":").concat(wn)}return 0},[on]);function pn(){window.sessionStorage.removeItem(Hn),Re(!1),ci(0)}function bn(){Re(!1),ci(0),B.setValue(window.sessionStorage.getItem(Hn))}function In(At,cn){var Jt=B.getValue();Jt=Jt.replace(At,cn),Ot(Jt),B==null||B.setValue(Jt)}return p.a.createElement(g.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:ut},p.a.createElement("div",{className:"markdown-editor-container ".concat(ct," ").concat(Yt?"on-preview":""," ").concat(_i?"mini":""," ").concat(Ri?"full-screen":""),style:rn},p.a.createElement(T,{insertTemp:Qn,watch:Yt,fullScreen:Ri,showNullButton:nn,onActionCallback:Et,hidetoolBar:Mi,uuid:Ge.current,setOpenPhones:function(){Me.current=!0}}),p.a.createElement("div",{className:"markdown-editor-body"},p.a.createElement("div",{className:"codemirror-container"},p.a.createElement("textarea",{ref:Ye,placeholder:ri})),Yt?p.a.createElement("div",{ref:dt,className:"preview-container"},qi==="stex"&&p.a.createElement(A,{value:tt}),qi!=="stex"&&p.a.createElement(x.a,{edit:!0,value:tt,replaces:In})):null))),Gt?p.a.createElement("a",{ref:Ze,className:"editor-resize"}):null,p.a.createElement(j.a,null,ye[wi]?p.a.createElement(Q.a,{centered:!0,title:ye[wi],visible:!0,onCancel:bt,footer:null,className:"markdown-popup-form"},Lt):null))}},QXZ7:function(Mt,_t,q){"use strict";var le=q("2qtc"),Q=q("kLXV"),P=q("q1tI"),Y=q.n(P),D=q("9Bee"),U=q("IH3J"),H=q.n(U),I=function(R){var g,p,d=R.installPackage,l=R.visible,n=R.setVisible;return Object(P.useEffect)(function(){return l?document.body.setAttribute("class",H.a.bodyHeight):document.body.removeAttribute("class"),function(){document.body.removeAttribute("class")}},[l]),Y.a.createElement(Q.a,{centered:!0,keyboard:!1,destroyOnClose:!0,visible:l,title:"\u73AF\u5883\u4ECB\u7ECD",width:"1000px",wrapClassName:H.a.wrapInstallPackageStyle,footer:null,onCancel:function(){return n(!1)}},Y.a.createElement("div",{className:H.a.installPackageStyle},Y.a.createElement("div",{className:"mb30"},Y.a.createElement("div",{className:H.a.title},d.mainTypeName),Y.a.createElement("div",null,Y.a.createElement(D.a,{value:d.mainTypeDescription}))),!!(d!=null&&(g=d.smallType)!==null&&g!==void 0&&g.length)&&Y.a.createElement("div",{className:H.a.line}),Y.a.createElement("div",null,d==null||((p=d.smallType)===null||p===void 0)?void 0:p.map(function(c,s){return Y.a.createElement(Y.a.Fragment,{key:s},Y.a.createElement("div",{className:H.a.title,style:{marginBottom:14}},c.name),Y.a.createElement("div",{className:"mb30"},Y.a.createElement(D.a,{value:c.des})))}))))};_t.a=I},SJMd:function(Mt,_t){/**
|
|
* @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 q,le,Q,P=!1,Y,D;window.PR_SHOULD_USE_CONTINUATION=!0;var U,H;(function(){var I=window,F=["break,continue,do,else,for,if,return,while"],R=[F,"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"],d=[g,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],l=[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"],n="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",c=[g,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",a=[F,"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"],o=[F,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],f=[F,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],L=[p,l,d,c,s,a,o,f],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",A="kwd",w="com",_="typ",S="lit",y="pun",h="pln",E="tag",m="dec",T="src",j="atn",N="atv",K="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(je){for(var Qe=0,ot=!1,st=!1,ht=0,mt=je.length;ht<mt;++ht){var ft=je[ht];if(ft.ignoreCase)st=!0;else if(/[a-z]/i.test(ft.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){ot=!0,st=!1;break}}var Ht={b:8,t:9,n:10,v:11,f:12,r:13};function Vt(Wt){var it=Wt.charCodeAt(0);if(it!==92)return it;var un=Wt.charAt(1);return it=Ht[un],it||("0"<=un&&un<="7"?parseInt(Wt.substring(1),8):un==="u"||un==="x"?parseInt(Wt.substring(2),16):Wt.charCodeAt(1))}function zt(Wt){if(Wt<32)return(Wt<16?"\\x0":"\\x")+Wt.toString(16);var it=String.fromCharCode(Wt);return it==="\\"||it==="-"||it==="]"||it==="^"?"\\"+it:it}function Tt(Wt){var it=Wt.substring(1,Wt.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),un=[],Kt=it[0]==="^",qe=["["];Kt&&qe.push("^");for(var wt=Kt?1:0,Be=it.length;wt<Be;++wt){var Ae=it[wt];if(/\\[bdsw]/i.test(Ae))qe.push(Ae);else{var Ie=Vt(Ae),se;wt+2<Be&&it[wt+1]==="-"?(se=Vt(it[wt+2]),wt+=2):se=Ie,un.push([Ie,se]),se<65||Ie>122||(se<65||Ie>90||un.push([Math.max(65,Ie)|32,Math.min(se,90)|32]),se<97||Ie>122||un.push([Math.max(97,Ie)&~32,Math.min(se,122)&~32]))}}un.sort(function(ke,et){return ke[0]-et[0]||et[1]-ke[1]});for(var ce=[],ye=[],wt=0;wt<un.length;++wt){var Se=un[wt];Se[0]<=ye[1]+1?ye[1]=Math.max(ye[1],Se[1]):ce.push(ye=Se)}for(var wt=0;wt<ce.length;++wt){var Se=ce[wt];qe.push(zt(Se[0])),Se[1]>Se[0]&&(Se[1]+1>Se[0]&&qe.push("-"),qe.push(zt(Se[1])))}return qe.push("]"),qe.join("")}function hn(Wt){for(var it=Wt.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")),un=it.length,Kt=[],qe=0,wt=0;qe<un;++qe){var Be=it[qe];if(Be==="(")++wt;else if(Be.charAt(0)==="\\"){var Ae=+Be.substring(1);Ae&&(Ae<=wt?Kt[Ae]=-1:it[qe]=zt(Ae))}}for(var qe=1;qe<Kt.length;++qe)Kt[qe]===-1&&(Kt[qe]=++Qe);for(var qe=0,wt=0;qe<un;++qe){var Be=it[qe];if(Be==="(")++wt,Kt[wt]||(it[qe]="(?:");else if(Be.charAt(0)==="\\"){var Ae=+Be.substring(1);Ae&&Ae<=wt&&(it[qe]="\\"+Kt[Ae])}}for(var qe=0;qe<un;++qe)it[qe]==="^"&&it[qe+1]!=="^"&&(it[qe]="");if(Wt.ignoreCase&&ot)for(var qe=0;qe<un;++qe){var Be=it[qe],Ie=Be.charAt(0);Be.length>=2&&Ie==="["?it[qe]=Tt(Be):Ie!=="\\"&&(it[qe]=Be.replace(/[a-zA-Z]/g,function(ye){var Se=ye.charCodeAt(0);return"["+String.fromCharCode(Se&~32,Se|32)+"]"}))}return it.join("")}for(var Xt=[],ht=0,mt=je.length;ht<mt;++ht){var ft=je[ht];if(ft.global||ft.multiline)throw new Error(""+ft);Xt.push("(?:"+hn(ft)+")")}return new RegExp(Xt.join("|"),st?"gi":"g")}function b(je,Qe){var ot=/(?:^|\s)nocode(?:\s|$)/,st=[],ht=0,mt=[],ft=0;function Ht(Vt){var zt=Vt.nodeType;if(zt==1){if(ot.test(Vt.className))return;for(var Tt=Vt.firstChild;Tt;Tt=Tt.nextSibling)Ht(Tt);var hn=Vt.nodeName.toLowerCase();(hn==="br"||hn==="li")&&(st[ft]=`
|
|
`,mt[ft<<1]=ht++,mt[ft++<<1|1]=Vt)}else if(zt==3||zt==4){var Xt=Vt.nodeValue;Xt.length&&(Qe?Xt=Xt.replace(/\r\n?/g,`
|
|
`):Xt=Xt.replace(/[ \t\r\n]+/g," "),st[ft]=Xt,mt[ft<<1]=ht,ht+=Xt.length,mt[ft++<<1|1]=Vt)}}return Ht(je),{sourceCode:st.join("").replace(/\n$/,""),spans:mt}}function G(je,Qe,ot,st,ht){if(!ot)return;var mt={sourceNode:je,pre:1,langExtension:null,numberLines:null,sourceCode:ot,spans:null,basePos:Qe,decorations:null};st(mt),ht.push.apply(ht,mt.decorations)}var J=/\S/;function oe(je){for(var Qe=void 0,ot=je.firstChild;ot;ot=ot.nextSibling){var st=ot.nodeType;Qe=st===1?Qe?je:ot:st===3&&J.test(ot.nodeValue)?je:Qe}return Qe===je?void 0:Qe}function fe(je,Qe){var ot={},st;(function(){for(var ft=je.concat(Qe),Ht=[],Vt={},zt=0,Tt=ft.length;zt<Tt;++zt){var hn=ft[zt],Xt=hn[3];if(Xt)for(var Wt=Xt.length;--Wt>=0;)ot[Xt.charAt(Wt)]=hn;var it=hn[1],un=""+it;Vt.hasOwnProperty(un)||(Ht.push(it),Vt[un]=null)}Ht.push(/[\0-\uffff]/),st=k(Ht)})();var ht=Qe.length,mt=function(ft){for(var Ht=ft.sourceCode,Vt=ft.basePos,zt=ft.sourceNode,Tt=[Vt,h],hn=0,Xt=Ht.match(st)||[],Wt={},it=0,un=Xt.length;it<un;++it){var Kt=Xt[it],qe=Wt[Kt],wt=void 0,Be;if(typeof qe=="string")Be=!1;else{var Ae=ot[Kt.charAt(0)];if(Ae)wt=Kt.match(Ae[1]),qe=Ae[0];else{for(var Ie=0;Ie<ht;++Ie)if(Ae=Qe[Ie],wt=Kt.match(Ae[1]),wt){qe=Ae[0];break}wt||(qe=h)}Be=qe.length>=5&&qe.substring(0,5)==="lang-",Be&&!(wt&&typeof wt[1]=="string")&&(Be=!1,qe=T),Be||(Wt[Kt]=qe)}var se=hn;if(hn+=Kt.length,!Be)Tt.push(Vt+se,qe);else{var ce=wt[1],ye=Kt.indexOf(ce),Se=ye+ce.length;wt[2]&&(Se=Kt.length-wt[2].length,ye=Se-ce.length);var ke=qe.substring(5);G(zt,Vt+se,Kt.substring(0,ye),mt,Tt),G(zt,Vt+se+ye,ce,ue(ke,ce),Tt),G(zt,Vt+se+Se,Kt.substring(Se),mt,Tt)}}ft.decorations=Tt};return mt}function Ne(je){var Qe=[],ot=[];je.tripleQuotedStrings?Qe.push([x,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):je.multiLineStrings?Qe.push([x,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Qe.push([x,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),je.verbatimStrings&&ot.push([x,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var st=je.hashComments;st&&(je.cStyleComments?(st>1?Qe.push([w,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Qe.push([w,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),ot.push([x,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Qe.push([w,/^#[^\r\n]*/,null,"#"])),je.cStyleComments&&(ot.push([w,/^\/\/[^\r\n]*/,null]),ot.push([w,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ht=je.regexLiterals;if(ht){var mt=ht>1?"":`
|
|
\r`,ft=mt?".":"[\\S\\s]",Ht="/(?=[^/*"+mt+"])(?:[^/\\x5B\\x5C"+mt+"]|\\x5C"+ft+"|\\x5B(?:[^\\x5C\\x5D"+mt+"]|\\x5C"+ft+")*(?:\\x5D|$))+/";ot.push(["lang-regex",RegExp("^"+W+"("+Ht+")")])}var Vt=je.types;Vt&&ot.push([_,Vt]);var zt=(""+je.keywords).replace(/^ | $/g,"");zt.length&&ot.push([A,new RegExp("^(?:"+zt.replace(/[\s,]+/g,"|")+")\\b"),null]),Qe.push([h,/^\s+/,null,` \r
|
|
\xA0`]);var Tt="^.[^\\s\\w.$@'\"`/\\\\]*";return je.regexLiterals&&(Tt+="(?!s*/)"),ot.push([S,/^@[a-z_$][a-z_$@0-9]*/i,null],[_,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[h,/^[a-z_$][a-z_$@0-9]*/i,null],[S,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[h,/^\\[\s\S]?/,null],[y,new RegExp(Tt),null]),fe(Qe,ot)}var _e=Ne({keywords:L,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Fe(je,Qe,ot){for(var st=/(?:^|\s)nocode(?:\s|$)/,ht=/\r\n?|\n/,mt=je.ownerDocument,ft=mt.createElement("li");je.firstChild;)ft.appendChild(je.firstChild);var Ht=[ft];function Vt(it){var un=it.nodeType;if(un==1&&!st.test(it.className))if(it.nodeName==="br")zt(it),it.parentNode&&it.parentNode.removeChild(it);else for(var Kt=it.firstChild;Kt;Kt=Kt.nextSibling)Vt(Kt);else if((un==3||un==4)&&ot){var qe=it.nodeValue,wt=qe.match(ht);if(wt){var Be=qe.substring(0,wt.index);it.nodeValue=Be;var Ae=qe.substring(wt.index+wt[0].length);if(Ae){var Ie=it.parentNode;Ie.insertBefore(mt.createTextNode(Ae),it.nextSibling)}zt(it),Be||it.parentNode.removeChild(it)}}}function zt(it){for(;!it.nextSibling;)if(it=it.parentNode,!it)return;function un(wt,Be){var Ae=Be?wt.cloneNode(!1):wt,Ie=wt.parentNode;if(Ie){var se=un(Ie,1),ce=wt.nextSibling;se.appendChild(Ae);for(var ye=ce;ye;ye=ce)ce=ye.nextSibling,se.appendChild(ye)}return Ae}for(var Kt=un(it.nextSibling,0),qe;(qe=Kt.parentNode)&&qe.nodeType===1;)Kt=qe;Ht.push(Kt)}for(var Tt=0;Tt<Ht.length;++Tt)Vt(Ht[Tt]);Qe===(Qe|0)&&Ht[0].setAttribute("value",Qe);var hn=mt.createElement("ol");hn.className="linenums";for(var Xt=Math.max(0,Qe-1|0)||0,Tt=0,Wt=Ht.length;Tt<Wt;++Tt)ft=Ht[Tt],ft.className="L"+(Tt+Xt)%10,ft.firstChild||ft.appendChild(mt.createTextNode("\xA0")),hn.appendChild(ft);je.appendChild(hn)}function We(je){var Qe=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Qe=Qe&&+Qe[1]<=8;var ot=/\n/g,st=je.sourceCode,ht=st.length,mt=0,ft=je.spans,Ht=ft.length,Vt=0,zt=je.decorations,Tt=zt.length,hn=0;zt[Tt]=ht;var Xt,Wt;for(Wt=Xt=0;Wt<Tt;)zt[Wt]!==zt[Wt+2]?(zt[Xt++]=zt[Wt++],zt[Xt++]=zt[Wt++]):Wt+=2;for(Tt=Xt,Wt=Xt=0;Wt<Tt;){for(var it=zt[Wt],un=zt[Wt+1],Kt=Wt+2;Kt+2<=Tt&&zt[Kt+1]===un;)Kt+=2;zt[Xt++]=it,zt[Xt++]=un,Wt=Kt}Tt=zt.length=Xt;var qe=je.sourceNode,wt="";qe&&(wt=qe.style.display,qe.style.display="none");try{for(var Be=null;Vt<Ht;){var Ae=ft[Vt],Ie=ft[Vt+2]||ht,se=zt[hn+2]||ht,Kt=Math.min(Ie,se),ce=ft[Vt+1],ye;if(ce.nodeType!==1&&(ye=st.substring(mt,Kt))){Qe&&(ye=ye.replace(ot,"\r")),ce.nodeValue=ye;var Se=ce.ownerDocument,ke=Se.createElement("span");ke.className=zt[hn+1];var et=ce.parentNode;et.replaceChild(ke,ce),ke.appendChild(ce),mt<Ie&&(ft[Vt+1]=ce=Se.createTextNode(st.substring(Kt,Ie)),et.insertBefore(ce,ke.nextSibling))}mt=Kt,mt>=Ie&&(Vt+=2),mt>=se&&(hn+=2)}}finally{qe&&(qe.style.display=wt)}}var Ue={};function xe(je,Qe){for(var ot=Qe.length;--ot>=0;){var st=Qe[ot];Ue.hasOwnProperty(st)?I.console&&console.warn("cannot override language handler %s",st):Ue[st]=je}}function ue(je,Qe){return je&&Ue.hasOwnProperty(je)||(je=/^\s*</.test(Qe)?"default-markup":"default-code"),Ue[je]}xe(_e,["default-code"]),xe(fe([],[[h,/^[^<?]+/],[m,/^<!\w[^>]*(?:>|$)/],[w,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[y,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),xe(fe([[h,/^[\s]+/,null,` \r
|
|
`],[N,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[E,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[j,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[y,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),xe(fe([],[[N,/^[\s\S]+/]]),["uq.val"]),xe(Ne({keywords:p,hashComments:!0,cStyleComments:!0,types:C}),["c","cc","cpp","cxx","cyc","m"]),xe(Ne({keywords:"null,true,false"}),["json"]),xe(Ne({keywords:l,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:C}),["cs"]),xe(Ne({keywords:d,cStyleComments:!0}),["java"]),xe(Ne({keywords:f,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),xe(Ne({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),xe(Ne({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),xe(Ne({keywords:o,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),xe(Ne({keywords:c,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),xe(Ne({keywords:n,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),xe(fe([],[[x,/^[\s\S]+/]]),["regex"]);function ae(je){var Qe=je.langExtension;try{var ot=b(je.sourceNode,je.pre),st=ot.sourceCode;je.sourceCode=st,je.spans=ot.spans,je.basePos=0,ue(Qe,st)(je),We(je)}catch(ht){I.console&&console.log(ht&&ht.stack||ht)}}function Ee(je,Qe,ot){var st=ot||!1,ht=Qe||null,mt=document.createElement("div");mt.innerHTML="<pre>"+je+"</pre>",mt=mt.firstChild,st&&Fe(mt,st,!0);var ft={langExtension:ht,numberLines:st,sourceNode:mt,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return ae(ft),mt.innerHTML}function de(je,Qe){var ot=Qe||document.body,st=ot.ownerDocument||document;function ht(Ae){return ot.getElementsByTagName(Ae)}for(var mt=[ht("pre"),ht("code"),ht("xmp")],ft=[],Ht=0;Ht<mt.length;++Ht)for(var Vt=0,zt=mt[Ht].length;Vt<zt;++Vt)ft.push(mt[Ht][Vt]);mt=null;var Tt=Date;Tt.now||(Tt={now:function(){return+new Date}});var hn=0,Xt=/\blang(?:uage)?-([\w.]+)(?!\S)/,Wt=/\bprettyprint\b/,it=/\bprettyprinted\b/,un=/pre|xmp/i,Kt=/^code$/i,qe=/^(?:pre|code|xmp)$/i,wt={};function Be(){for(var Ae=I.PR_SHOULD_USE_CONTINUATION?Tt.now()+250:Infinity;hn<ft.length&&Tt.now()<Ae;hn++){for(var Ie=ft[hn],se=wt,ce=Ie;ce=ce.previousSibling;){var ye=ce.nodeType,Se=(ye===7||ye===8)&&ce.nodeValue;if(Se?!/^\??prettify\b/.test(Se):ye!==3||/\S/.test(ce.nodeValue))break;if(Se){se={},Se.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Oi,Qn,ir){se[Qn]=ir});break}}var ke=Ie.className;if((se!==wt||Wt.test(ke))&&!it.test(ke)){for(var et=!1,yt=Ie.parentNode;yt;yt=yt.parentNode){var $t=yt.tagName;if(qe.test($t)&&yt.className&&Wt.test(yt.className)){et=!0;break}}if(!et){Ie.className+=" prettyprinted";var gn=se.lang;if(!gn){gn=ke.match(Xt);var Dt;!gn&&(Dt=oe(Ie))&&Kt.test(Dt.tagName)&&(gn=Dt.className.match(Xt)),gn&&(gn=gn[1])}var zn;if(un.test(Ie.tagName))zn=1;else{var Ln=Ie.currentStyle,sn=st.defaultView,_i=Ln?Ln.whiteSpace:sn&&sn.getComputedStyle?sn.getComputedStyle(Ie,null).getPropertyValue("white-space"):0;zn=_i&&_i.substring(0,3)==="pre"}var si=se.linenums;(si=si==="true"||+si)||(si=ke.match(/\blinenums\b(?::(\d+))?/),si=si?si[1]&&si[1].length?+si[1]:!0:!1),si&&Fe(Ie,si,zn);var zi={langExtension:gn,sourceNode:Ie,numberLines:si,pre:zn,sourceCode:null,basePos:null,spans:null,decorations:null};ae(zi)}}}hn<ft.length?I.setTimeout(Be,250):typeof je=="function"&&je()}Be()}var Ke=I.PR={createSimpleLexer:fe,registerLangHandler:xe,sourceDecorator:Ne,PR_ATTRIB_NAME:j,PR_ATTRIB_VALUE:N,PR_COMMENT:w,PR_DECLARATION:m,PR_KEYWORD:A,PR_LITERAL:S,PR_NOCODE:K,PR_PLAIN:h,PR_PUNCTUATION:y,PR_SOURCE:T,PR_STRING:x,PR_TAG:E,PR_TYPE:_,prettyPrintOne:P?I.prettyPrintOne=Ee:U=Ee,prettyPrint:H=P?I.prettyPrint=de:H=de},Je=I.define;typeof Je=="function"&&Je.amd&&Je("google-code-prettify",[],function(){return Ke})})()},TXwP:function(Mt,_t,q){var le,Q;(function(){var P;(function(){"use strict";var D=[,,function(F){function R(d){this.__parent=d,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=[]}R.prototype.clone_empty=function(){var d=new R(this.__parent);return d.set_indent(this.__indent_count,this.__alignment_count),d},R.prototype.item=function(d){return d<0?this.__items[this.__items.length+d]:this.__items[d]},R.prototype.has_match=function(d){for(var l=this.__items.length-1;l>=0;l--)if(this.__items[l].match(d))return!0;return!1},R.prototype.set_indent=function(d,l){this.is_empty()&&(this.__indent_count=d||0,this.__alignment_count=l||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 d=this.__parent.current_line;return d.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),d.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),d.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,d.__items[0]===" "&&(d.__items.splice(0,1),d.__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(d){this.__items.push(d);var l=d.lastIndexOf(`
|
|
`);l!==-1?this.__character_count=d.length-l:this.__character_count+=d.length},R.prototype.pop=function(){var d=null;return this.is_empty()||(d=this.__items.pop(),this.__character_count-=d.length),d},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 d="";return this.is_empty()?this.__parent.indent_empty_lines&&(d=this.__parent.get_indent_string(this.__indent_count)):(d=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),d+=this.__items.join("")),d};function g(d,l){this.__cache=[""],this.__indent_size=d.indent_size,this.__indent_string=d.indent_char,d.indent_with_tabs||(this.__indent_string=new Array(d.indent_size+1).join(d.indent_char)),l=l||"",d.indent_level>0&&(l=new Array(d.indent_level+1).join(this.__indent_string)),this.__base_string=l,this.__base_string_length=l.length}g.prototype.get_indent_size=function(d,l){var n=this.__base_string_length;return l=l||0,d<0&&(n=0),n+=d*this.__indent_size,n+=l,n},g.prototype.get_indent_string=function(d,l){var n=this.__base_string;return l=l||0,d<0&&(d=0,n=""),l+=d*this.__indent_size,this.__ensure_cache(l),n+=this.__cache[l],n},g.prototype.__ensure_cache=function(d){for(;d>=this.__cache.length;)this.__add_column()},g.prototype.__add_column=function(){var d=this.__cache.length,l=0,n="";this.__indent_size&&d>=this.__indent_size&&(l=Math.floor(d/this.__indent_size),d-=l*this.__indent_size,n=new Array(l+1).join(this.__indent_string)),d&&(n+=new Array(d+1).join(" ")),this.__cache.push(n)};function p(d,l){this.__indent_cache=new g(d,l),this.raw=!1,this._end_with_newline=d.end_with_newline,this.indent_size=d.indent_size,this.wrap_line_length=d.wrap_line_length,this.indent_empty_lines=d.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(d,l){return this.__indent_cache.get_indent_string(d,l)},p.prototype.get_indent_size=function(d,l){return this.__indent_cache.get_indent_size(d,l)},p.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},p.prototype.add_new_line=function(d){return this.is_empty()||!d&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},p.prototype.get_code=function(d){this.trim(!0);var l=this.current_line.pop();l&&(l[l.length-1]===`
|
|
`&&(l=l.replace(/\n+$/g,"")),this.current_line.push(l)),this._end_with_newline&&this.__add_outputline();var n=this.__lines.join(`
|
|
`);return d!==`
|
|
`&&(n=n.replace(/[\n]/g,d)),n},p.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},p.prototype.set_indent=function(d,l){return d=d||0,l=l||0,this.next_line.set_indent(d,l),this.__lines.length>1?(this.current_line.set_indent(d,l),!0):(this.current_line.set_indent(),!1)},p.prototype.add_raw_token=function(d){for(var l=0;l<d.newlines;l++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(d.whitespace_before),this.current_line.push(d.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},p.prototype.add_token=function(d){this.__add_space_before_token(),this.current_line.push(d),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},p.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},p.prototype.remove_indent=function(d){for(var l=this.__lines.length;d<l;)this.__lines[d]._remove_indent(),d++;this.current_line._remove_wrap_indent()},p.prototype.trim=function(d){for(d=d===void 0?!1:d,this.current_line.trim();d&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},p.prototype.just_added_newline=function(){return this.current_line.is_empty()},p.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},p.prototype.ensure_empty_line_above=function(d,l){for(var n=this.__lines.length-2;n>=0;){var c=this.__lines[n];if(c.is_empty())break;if(c.item(0).indexOf(d)!==0&&c.item(-1)!==l){this.__lines.splice(n+1,0,new R(this)),this.previous_line=this.__lines[this.__lines.length-2];break}n--}},F.exports.Output=p},,,,function(F){function R(d,l){this.raw_options=g(d,l),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}R.prototype._get_array=function(d,l){var n=this.raw_options[d],c=l||[];return typeof n=="object"?n!==null&&typeof n.concat=="function"&&(c=n.concat()):typeof n=="string"&&(c=n.split(/[^a-zA-Z0-9_\/\-]+/)),c},R.prototype._get_boolean=function(d,l){var n=this.raw_options[d],c=n===void 0?!!l:!!n;return c},R.prototype._get_characters=function(d,l){var n=this.raw_options[d],c=l||"";return typeof n=="string"&&(c=n.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),c},R.prototype._get_number=function(d,l){var n=this.raw_options[d];l=parseInt(l,10),isNaN(l)&&(l=0);var c=parseInt(n,10);return isNaN(c)&&(c=l),c},R.prototype._get_selection=function(d,l,n){var c=this._get_selection_list(d,l,n);if(c.length!==1)throw new Error("Invalid Option Value: The option '"+d+`' can only be one of the following values:
|
|
`+l+`
|
|
You passed in: '`+this.raw_options[d]+"'");return c[0]},R.prototype._get_selection_list=function(d,l,n){if(!l||l.length===0)throw new Error("Selection list cannot be empty.");if(n=n||[l[0]],!this._is_valid_selection(n,l))throw new Error("Invalid Default Value!");var c=this._get_array(d,n);if(!this._is_valid_selection(c,l))throw new Error("Invalid Option Value: The option '"+d+`' can contain only the following values:
|
|
`+l+`
|
|
You passed in: '`+this.raw_options[d]+"'");return c},R.prototype._is_valid_selection=function(d,l){return d.length&&l.length&&!d.some(function(n){return l.indexOf(n)===-1})};function g(d,l){var n={};d=p(d);var c;for(c in d)c!==l&&(n[c]=d[c]);if(l&&d[l])for(c in d[l])n[c]=d[l][c];return n}function p(d){var l={},n;for(n in d){var c=n.replace(/-/g,"_");l[c]=d[n]}return l}F.exports.Options=R,F.exports.normalizeOpts=p,F.exports.mergeOpts=g},,function(F){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<this.__input_length},g.prototype.next=function(){var p=null;return this.hasNext()&&(p=this.__input.charAt(this.__position),this.__position+=1),p},g.prototype.peek=function(p){var d=null;return p=p||0,p+=this.__position,p>=0&&p<this.__input_length&&(d=this.__input.charAt(p)),d},g.prototype.__match=function(p,d){p.lastIndex=d;var l=p.exec(this.__input);return l&&!(R&&p.sticky)&&(l.index!==d&&(l=null)),l},g.prototype.test=function(p,d){return d=d||0,d+=this.__position,d>=0&&d<this.__input_length?!!this.__match(p,d):!1},g.prototype.testChar=function(p,d){var l=this.peek(d);return p.lastIndex=0,l!==null&&p.test(l)},g.prototype.match=function(p){var d=this.__match(p,this.__position);return d?this.__position+=d[0].length:d=null,d},g.prototype.read=function(p,d,l){var n="",c;return p&&(c=this.match(p),c&&(n+=c[0])),d&&(c||!p)&&(n+=this.readUntil(d,l)),n},g.prototype.readUntil=function(p,d){var l="",n=this.__position;p.lastIndex=this.__position;var c=p.exec(this.__input);return c?(n=c.index,d&&(n+=c[0].length)):n=this.__input_length,l=this.__input.substring(this.__position,n),this.__position=n,l},g.prototype.readUntilAfter=function(p){return this.readUntil(p,!0)},g.prototype.get_regexp=function(p,d){var l=null,n="g";return d&&R&&(n="y"),typeof p=="string"&&p!==""?l=new RegExp(p,n):p&&(l=new RegExp(p.source,n)),l},g.prototype.get_literal_regexp=function(p){return RegExp(p.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},g.prototype.peekUntilAfter=function(p){var d=this.__position,l=this.readUntilAfter(p);return this.__position=d,l},g.prototype.lookBack=function(p){var d=this.__position-1;return d>=p.length&&this.__input.substring(d-p.length,d).toLowerCase()===p},F.exports.InputScanner=g},,,,,function(F){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 d=this.__directive_pattern.exec(g);d;)p[d[1]]=d[2],d=this.__directive_pattern.exec(g);return p},R.prototype.readIgnored=function(g){return g.readUntilAfter(this.__directives_end_ignore_pattern)},F.exports.Directives=R},,function(F,R,g){var p=g(16).Beautifier,d=g(17).Options;function l(n,c){var s=new p(n,c);return s.beautify()}F.exports=l,F.exports.defaultOptions=function(){return new d}},function(F,R,g){var p=g(17).Options,d=g(2).Output,l=g(8).InputScanner,n=g(13).Directives,c=new n(/\/\*/,/\*\//),s=/\r\n|[\r\n]/,a=/\r\n|[\r\n]/g,o=/\s/,f=/(?:\s|\n)+/g,L=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,C=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function x(A,w){this._source_text=A||"",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(A){var w="";for(this._ch=this._input.next();this._ch;){if(w+=this._ch,this._ch==="\\")w+=this._input.next();else if(A.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return w},x.prototype.eatWhitespace=function(A){for(var w=o.test(this._input.peek()),_=0;o.test(this._input.peek());)this._ch=this._input.next(),A&&this._ch===`
|
|
`&&((_===0||_<this._options.max_preserve_newlines)&&(_++,this._output.add_new_line(!0)));return w},x.prototype.foundNestedPseudoClass=function(){for(var A=0,w=1,_=this._input.peek(w);_;){if(_==="{")return!0;if(_==="(")A+=1;else if(_===")"){if(A===0)return!1;A-=1}else if(_===";"||_==="}")return!1;w++,_=this._input.peek(w)}return!1},x.prototype.print_string=function(A){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(A)},x.prototype.preserveSingleSpace=function(A){A&&(this._output.space_before_token=!0)},x.prototype.indent=function(){this._indentLevel++},x.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},x.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var A=this._source_text,w=this._options.eol;w==="auto"&&(w=`
|
|
`,A&&s.test(A||"")&&(w=A.match(s)[0])),A=A.replace(a,`
|
|
`);var _=A.match(/^[\t ]*/)[0];this._output=new d(this._options,_),this._input=new l(A),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var S=0,y=!1,h=!1,E=!1,m=!1,T=!1,j=!1,N=this._ch,K=!1,W,k,b;W=this._input.read(f),k=W!=="",b=N,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),N=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var G=this._input.read(L),J=c.get_directives(G);J&&J.ignore==="start"&&(G+=c.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(k),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var oe=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);oe.match(/[ :]$/)&&(oe=this.eatString(": ").replace(/\s$/,""),this.print_string(oe),this._output.space_before_token=!0),oe=oe.replace(/\s$/,""),oe==="extend"?m=!0:oe==="import"&&(T=!0),oe in this.NESTED_AT_RULE?(this._nestedLevel+=1,oe in this.CONDITIONAL_GROUP_RULE&&(E=!0)):!y&&S===0&&oe.indexOf(":")!==-1&&(h=!0,this.indent())}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(k),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")h&&(h=!1,this.outdent()),E?(E=!1,y=this._indentLevel>=this._nestedLevel):y=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&y&&(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",",")),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(b==="("?this._output.space_before_token=!1:b!==","&&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(),b==="{"&&this._output.trim(!0),T=!1,m=!1,h&&(this.outdent(),h=!1),this.print_string(this._ch),y=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&(this._input.peek()!=="}"&&this._output.add_new_line(!0)),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var fe=0;fe<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;fe++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[fe])){K=!0;break}(y||E)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!m&&S===0?(this.print_string(":"),h||(h=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var Ne=b==='"'||b==="'";this.preserveSingleSpace(Ne||k),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")K=!1,S===0?(h&&(this.outdent(),h=!1),m=!1,T=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),S++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),S&&(S--,this.outdent()));else{var _e=!1;this._input.lookBack("with")&&(_e=!0),this.preserveSingleSpace(k||_e),this.print_string(this._ch),h&&b==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),j=!0):(this.eatWhitespace(),S++,this.indent())}else if(this._ch===")")S&&(S--,this.outdent()),j&&this._input.peek()===";"&&this._options.selector_separator_newline&&(j=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!h||j)&&S===0&&!T&&!m?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!h&&S===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&&o.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(k),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),o.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 Fe=b==='"'||b==="'";this.preserveSingleSpace(Fe||k),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&K&&this._output.add_new_line()}var We=this._output.get_code(w);return We},F.exports.Beautifier=x},function(F,R,g){var p=g(6).Options;function d(l){p.call(this,l,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var n=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||n;var c=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var s=0;s<c.length;s++)c[s]!=="expand"?this.brace_style="collapse":this.brace_style=c[s]}d.prototype=new p,F.exports.Options=d}],U={};function H(F){var R=U[F];if(R!==void 0)return R.exports;var g=U[F]={exports:{}};return D[F](g,g.exports,H),g.exports}var I=H(15);P=I})();var Y=P;!(le=[],Q=function(){return{css_beautify:Y}}.apply(_t,le),Q!==void 0&&(Mt.exports=Q))})()},UUDw:function(Mt,_t,q){Mt.exports={buttonFixed:"buttonFixed___2zLVJ",button:"button___-JgFH",buttonWrap:"buttonWrap___aZhhk"}},"VrN/":function(Mt,_t,q){(function(le,Q){Mt.exports=Q()})(this,function(){"use strict";var le=navigator.userAgent,Q=navigator.platform,P=/gecko\/\d/i.test(le),Y=/MSIE \d/.test(le),D=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(le),U=/Edge\/(\d+)/.exec(le),H=Y||D||U,I=H&&(Y?document.documentMode||6:+(U||D)[1]),F=!U&&/WebKit\//.test(le),R=F&&/Qt\/\d+\.\d+/.test(le),g=!U&&/Chrome\//.test(le),p=/Opera\//.test(le),d=/Apple Computer/.test(navigator.vendor),l=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(le),n=/PhantomJS/.test(le),c=!U&&/AppleWebKit/.test(le)&&/Mobile\/\w+/.test(le),s=/Android/.test(le),a=c||s||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(le),o=c||/Mac/.test(Q),f=/\bCrOS\b/.test(le),L=/win/i.test(Q),C=p&&le.match(/Version\/(\d*\.\d*)/);C&&(C=Number(C[1])),C&&C>=15&&(p=!1,F=!0);var x=o&&(R||p&&(C==null||C<12.11)),A=P||H&&I>=9;function w(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var _=function(e,t){var r=e.className,i=w(t).exec(r);if(i){var u=r.slice(i.index+i[0].length);e.className=r.slice(0,i.index)+(u?i[1]+u:"")}};function S(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function y(e,t){return S(e).appendChild(t)}function h(e,t,r,i){var u=document.createElement(e);if(r&&(u.className=r),i&&(u.style.cssText=i),typeof t=="string")u.appendChild(document.createTextNode(t));else if(t)for(var M=0;M<t.length;++M)u.appendChild(t[M]);return u}function E(e,t,r,i){var u=h(e,t,r,i);return u.setAttribute("role","presentation"),u}var m;document.createRange?m=function(e,t,r,i){var u=document.createRange();return u.setEnd(i||e,r),u.setStart(e,t),u}:m=function(e,t,r){var i=document.body.createTextRange();try{i.moveToElementText(e.parentNode)}catch(u){return i}return i.collapse(!0),i.moveEnd("character",r),i.moveStart("character",t),i};function T(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function j(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function N(e,t){var r=e.className;w(t).test(r)||(e.className+=(r?" ":"")+t)}function K(e,t){for(var r=e.split(" "),i=0;i<r.length;i++)r[i]&&!w(r[i]).test(t)&&(t+=" "+r[i]);return t}var W=function(e){e.select()};c?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:H&&(W=function(e){try{e.select()}catch(t){}});function k(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function b(e,t,r){t||(t={});for(var i in e)e.hasOwnProperty(i)&&(r!==!1||!t.hasOwnProperty(i))&&(t[i]=e[i]);return t}function G(e,t,r,i,u){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var M=i||0,V=u||0;;){var Z=e.indexOf(" ",M);if(Z<0||Z>=t)return V+(t-M);V+=Z-M,V+=r-V%r,M=Z+1}}var J=function(){this.id=null,this.f=null,this.time=0,this.handler=k(this.onTimeout,this)};J.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},J.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=r)};function oe(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}var fe=50,Ne={toString:function(){return"CodeMirror.Pass"}},_e={scroll:!1},Fe={origin:"*mouse"},We={origin:"+move"};function Ue(e,t,r){for(var i=0,u=0;;){var M=e.indexOf(" ",i);M==-1&&(M=e.length);var V=M-i;if(M==e.length||u+V>=t)return i+Math.min(V,t-u);if(u+=M-i,u+=r-u%r,i=M+1,u>=t)return i}}var xe=[""];function ue(e){for(;xe.length<=e;)xe.push(ae(xe)+" ");return xe[e]}function ae(e){return e[e.length-1]}function Ee(e,t){for(var r=[],i=0;i<e.length;i++)r[i]=t(e[i],i);return r}function de(e,t,r){for(var i=0,u=r(t);i<e.length&&r(e[i])<=u;)i++;e.splice(i,0,t)}function Ke(){}function Je(e,t){var r;return Object.create?r=Object.create(e):(Ke.prototype=e,r=new Ke),t&&b(t,r),r}var je=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Qe(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||je.test(e))}function ot(e,t){return t?t.source.indexOf("\\w")>-1&&Qe(e)?!0:t.test(e):Qe(e)}function st(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ht=/[\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 mt(e){return e.charCodeAt(0)>=768&&ht.test(e)}function ft(e,t,r){for(;(r<0?t>0:t<e.length)&&mt(e.charAt(t));)t+=r;return t}function Ht(e,t,r){for(var i=t>r?-1:1;;){if(t==r)return t;var u=(t+r)/2,M=i<0?Math.ceil(u):Math.floor(u);if(M==t)return e(M)?t:r;e(M)?r=M:t=M+i}}function Vt(e,t,r,i){if(!e)return i(t,r,"ltr",0);for(var u=!1,M=0;M<e.length;++M){var V=e[M];(V.from<r&&V.to>t||t==r&&V.to==t)&&(i(Math.max(V.from,t),Math.min(V.to,r),V.level==1?"rtl":"ltr",M),u=!0)}u||i(t,r,"ltr")}var zt=null;function Tt(e,t,r){var i;zt=null;for(var u=0;u<e.length;++u){var M=e[u];if(M.from<t&&M.to>t)return u;M.to==t&&(M.from!=M.to&&r=="before"?i=u:zt=u),M.from==t&&(M.from!=M.to&&r!="before"?i=u:zt=u)}return i!=null?i:zt}var hn=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(ie){return ie<=247?e.charAt(ie):1424<=ie&&ie<=1524?"R":1536<=ie&&ie<=1785?t.charAt(ie-1536):1774<=ie&&ie<=2220?"r":8192<=ie&&ie<=8203?"w":ie==8204?"b":"L"}var i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,u=/[stwN]/,M=/[LRr]/,V=/[Lb1n]/,Z=/[1n]/;function ee(ie,Te,Le){this.level=ie,this.from=Te,this.to=Le}return function(ie,Te){var Le=Te=="ltr"?"L":"R";if(ie.length==0||Te=="ltr"&&!i.test(ie))return!1;for(var Xe=ie.length,Ve=[],gt=0;gt<Xe;++gt)Ve.push(r(ie.charCodeAt(gt)));for(var Rt=0,Ut=Le;Rt<Xe;++Rt){var en=Ve[Rt];en=="m"?Ve[Rt]=Ut:Ut=en}for(var fn=0,tn=Le;fn<Xe;++fn){var _n=Ve[fn];_n=="1"&&tn=="r"?Ve[fn]="n":M.test(_n)&&(tn=_n,_n=="r"&&(Ve[fn]="R"))}for(var $n=1,Pn=Ve[0];$n<Xe-1;++$n){var yi=Ve[$n];yi=="+"&&Pn=="1"&&Ve[$n+1]=="1"?Ve[$n]="1":yi==","&&Pn==Ve[$n+1]&&(Pn=="1"||Pn=="n")&&(Ve[$n]=Pn),Pn=yi}for(var nr=0;nr<Xe;++nr){var Ur=Ve[nr];if(Ur==",")Ve[nr]="N";else if(Ur=="%"){var pr=void 0;for(pr=nr+1;pr<Xe&&Ve[pr]=="%";++pr);for(var ra=nr&&Ve[nr-1]=="!"||pr<Xe&&Ve[pr]=="1"?"1":"N",ea=nr;ea<pr;++ea)Ve[ea]=ra;nr=pr-1}}for(var Ar=0,ta=Le;Ar<Xe;++Ar){var Wr=Ve[Ar];ta=="L"&&Wr=="1"?Ve[Ar]="L":M.test(Wr)&&(ta=Wr)}for(var Ir=0;Ir<Xe;++Ir)if(u.test(Ve[Ir])){var Rr=void 0;for(Rr=Ir+1;Rr<Xe&&u.test(Ve[Rr]);++Rr);for(var _r=(Ir?Ve[Ir-1]:Le)=="L",na=(Rr<Xe?Ve[Rr]:Le)=="L",So=_r==na?_r?"L":"R":Le,to=Ir;to<Rr;++to)Ve[to]=So;Ir=Rr-1}for(var Vr=[],Ia,Br=0;Br<Xe;)if(V.test(Ve[Br])){var ms=Br;for(++Br;Br<Xe&&V.test(Ve[Br]);++Br);Vr.push(new ee(0,ms,Br))}else{var Ga=Br,lo=Vr.length,uo=Te=="rtl"?1:0;for(++Br;Br<Xe&&Ve[Br]!="L";++Br);for(var Xr=Ga;Xr<Br;)if(Z.test(Ve[Xr])){Ga<Xr&&(Vr.splice(lo,0,new ee(1,Ga,Xr)),lo+=uo);var Oo=Xr;for(++Xr;Xr<Br&&Z.test(Ve[Xr]);++Xr);Vr.splice(lo,0,new ee(2,Oo,Xr)),lo+=uo,Ga=Xr}else++Xr;Ga<Br&&Vr.splice(lo,0,new ee(1,Ga,Br))}return Te=="ltr"&&(Vr[0].level==1&&(Ia=ie.match(/^\s+/))&&(Vr[0].from=Ia[0].length,Vr.unshift(new ee(0,0,Ia[0].length))),ae(Vr).level==1&&(Ia=ie.match(/\s+$/))&&(ae(Vr).to-=Ia[0].length,Vr.push(new ee(0,Xe-Ia[0].length,Xe)))),Te=="rtl"?Vr.reverse():Vr}}();function Xt(e,t){var r=e.order;return r==null&&(r=e.order=hn(e.text,t)),r}var Wt=[],it=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var i=e._handlers||(e._handlers={});i[t]=(i[t]||Wt).concat(r)}};function un(e,t){return e._handlers&&e._handlers[t]||Wt}function Kt(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var i=e._handlers,u=i&&i[t];if(u){var M=oe(u,r);M>-1&&(i[t]=u.slice(0,M).concat(u.slice(M+1)))}}}function qe(e,t){var r=un(e,t);if(!r.length)return;for(var i=Array.prototype.slice.call(arguments,2),u=0;u<r.length;++u)r[u].apply(null,i)}function wt(e,t,r){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),qe(e,r||t.type,e,t),ye(t)||t.codemirrorIgnore}function Be(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),i=0;i<t.length;++i)oe(r,t[i])==-1&&r.push(t[i])}function Ae(e,t){return un(e,t).length>0}function Ie(e){e.prototype.on=function(t,r){it(this,t,r)},e.prototype.off=function(t,r){Kt(this,t,r)}}function se(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ce(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ye(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Se(e){se(e),ce(e)}function ke(e){return e.target||e.srcElement}function et(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),o&&e.ctrlKey&&t==1&&(t=3),t}var yt=function(){if(H&&I<9)return!1;var e=h("div");return"draggable"in e||"dragDrop"in e}(),$t;function gn(e){if($t==null){var t=h("span","\u200B");y(e,h("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&($t=t.offsetWidth<=1&&t.offsetHeight>2&&!(H&&I<8))}var r=$t?h("span","\u200B"):h("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var Dt;function zn(e){if(Dt!=null)return Dt;var t=y(e,document.createTextNode("A\u062EA")),r=m(t,0,1).getBoundingClientRect(),i=m(t,1,2).getBoundingClientRect();return S(e),!r||r.left==r.right?!1:Dt=i.right-r.right<3}var Ln=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],i=e.length;t<=i;){var u=e.indexOf(`
|
|
`,t);u==-1&&(u=e.length);var M=e.slice(t,e.charAt(u-1)=="\r"?u-1:u),V=M.indexOf("\r");V!=-1?(r.push(M.slice(0,V)),t+=V+1):(r.push(M),t=u+1)}return r}:function(e){return e.split(/\r\n?|\n/)},sn=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},_i=function(){var e=h("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),si=null;function zi(e){if(si!=null)return si;var t=y(e,h("span","x")),r=t.getBoundingClientRect(),i=m(t,0,1).getBoundingClientRect();return si=Math.abs(r.left-i.left)>1}var Oi={},Qn={};function ir(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Oi[e]=t}function qi(e,t){Qn[e]=t}function It(e){if(typeof e=="string"&&Qn.hasOwnProperty(e))e=Qn[e];else if(e&&typeof e.name=="string"&&Qn.hasOwnProperty(e.name)){var t=Qn[e.name];typeof t=="string"&&(t={name:t}),e=Je(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return It("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return It("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Hn(e,t){t=It(t);var r=Oi[t.name];if(!r)return Hn(e,"text/plain");var i=r(e,t);if(li.hasOwnProperty(t.name)){var u=li[t.name];for(var M in u){if(!u.hasOwnProperty(M))continue;i.hasOwnProperty(M)&&(i["_"+M]=i[M]),i[M]=u[M]}}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var V in t.modeProps)i[V]=t.modeProps[V];return i}var li={};function Gt(e,t){var r=li.hasOwnProperty(e)?li[e]:li[e]={};b(t,r)}function Bt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var i in t){var u=t[i];u instanceof Array&&(u=u.concat([])),r[i]=u}return r}function Rn(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 Wn(e,t,r){return e.startState?e.startState(t,r):!0}var nn=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};nn.prototype.eol=function(){return this.pos>=this.string.length},nn.prototype.sol=function(){return this.pos==this.lineStart},nn.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},nn.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},nn.prototype.eat=function(e){var t=this.string.charAt(this.pos),r;if(typeof e=="string"?r=t==e:r=t&&(e.test?e.test(t):e(t)),r)return++this.pos,t},nn.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},nn.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},nn.prototype.skipToEnd=function(){this.pos=this.string.length},nn.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},nn.prototype.backUp=function(e){this.pos-=e},nn.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=G(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?G(this.string,this.lineStart,this.tabSize):0)},nn.prototype.indentation=function(){return G(this.string,null,this.tabSize)-(this.lineStart?G(this.string,this.lineStart,this.tabSize):0)},nn.prototype.match=function(e,t,r){if(typeof e=="string"){var i=function(V){return r?V.toLowerCase():V},u=this.string.substr(this.pos,e.length);if(i(u)==i(e))return t!==!1&&(this.pos+=e.length),!0}else{var M=this.string.slice(this.pos).match(e);return M&&M.index>0?null:(M&&t!==!1&&(this.pos+=M[0].length),M)}},nn.prototype.current=function(){return this.string.slice(this.start,this.pos)},nn.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},nn.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},nn.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Pt(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 u=r.children[i],M=u.chunkSize();if(t<M){r=u;break}t-=M}return r.lines[t]}function Mi(e,t,r){var i=[],u=t.line;return e.iter(t.line,r.line+1,function(M){var V=M.text;u==r.line&&(V=V.slice(0,r.ch)),u==t.line&&(V=V.slice(t.ch)),i.push(V),++u}),i}function $i(e,t,r){var i=[];return e.iter(t,r,function(u){i.push(u.text)}),i}function ui(e,t){var r=t-e.height;if(r)for(var i=e;i;i=i.parent)i.height+=r}function vn(e){if(e.parent==null)return null;for(var t=e.parent,r=oe(t.lines,e),i=t.parent;i;t=i,i=i.parent)for(var u=0;!(i.children[u]==t);++u)r+=i.children[u].chunkSize();return r+t.first}function Bi(e,t){var r=e.first;e:do{for(var i=0;i<e.children.length;++i){var u=e.children[i],M=u.height;if(t<M){e=u;continue e}t-=M,r+=u.chunkSize()}return r}while(!e.lines);for(var V=0;V<e.lines.length;++V){var Z=e.lines[V],ee=Z.height;if(t<ee)break;t-=ee}return r+V}function Ai(e,t){return t>=e.first&&t<e.first+e.size}function Pi(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function ct(e,t,r){if(r===void 0&&(r=null),!(this instanceof ct))return new ct(e,t,r);this.line=e,this.ch=t,this.sticky=r}function Zt(e,t){return e.line-t.line||e.ch-t.ch}function Ei(e,t){return e.sticky==t.sticky&&Zt(e,t)==0}function ji(e){return ct(e.line,e.ch)}function ri(e,t){return Zt(e,t)<0?t:e}function ii(e,t){return Zt(e,t)<0?e:t}function X(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function v(e,t){if(t.line<e.first)return ct(e.first,0);var r=e.first+e.size-1;return t.line>r?ct(r,Pt(e,r).text.length):O(t,Pt(e,t.line).text.length)}function O(e,t){var r=e.ch;return r==null||r>t?ct(e.line,t):r<0?ct(e.line,0):e}function B(e,t){for(var r=[],i=0;i<t.length;i++)r[i]=v(e,t[i]);return r}var te=function(e,t){this.state=e,this.lookAhead=t},z=function(e,t,r,i){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};z.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},z.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}},z.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},z.fromSaved=function(e,t,r){return t instanceof te?new z(e,Bt(e.mode,t.state),r,t.lookAhead):new z(e,Bt(e.mode,t),r)},z.prototype.save=function(e){var t=e!==!1?Bt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new te(t,this.maxLookAhead):t};function be(e,t,r,i){var u=[e.state.modeGen],M={};Ri(e,t.text,e.doc.mode,r,function(ie,Te){return u.push(ie,Te)},M,i);for(var V=r.state,Z=function(ie){r.baseTokens=u;var Te=e.state.overlays[ie],Le=1,Xe=0;r.state=!0,Ri(e,t.text,Te.mode,r,function(Ve,gt){for(var Rt=Le;Xe<Ve;){var Ut=u[Le];Ut>Ve&&u.splice(Le,1,Ve,u[Le+1],Ut),Le+=2,Xe=Math.min(Ve,Ut)}if(!gt)return;if(Te.opaque)u.splice(Rt,Le-Rt,Ve,"overlay "+gt),Le=Rt+2;else for(;Rt<Le;Rt+=2){var en=u[Rt+1];u[Rt+1]=(en?en+" ":"")+"overlay "+gt}},M),r.state=V,r.baseTokens=null,r.baseTokenPos=1},ee=0;ee<e.state.overlays.length;++ee)Z(ee);return{styles:u,classes:M.bgClass||M.textClass?M:null}}function tt(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=Ot(e,vn(t)),u=t.text.length>e.options.maxHighlightLength&&Bt(e.doc.mode,i.state),M=be(e,t,i);u&&(i.state=u),t.stateAfter=i.save(!u),t.styles=M.styles,M.classes?t.styleClasses=M.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 Ot(e,t,r){var i=e.doc,u=e.display;if(!i.mode.startState)return new z(i,!0,t);var M=fi(e,t,r),V=M>i.first&&Pt(i,M-1).stateAfter,Z=V?z.fromSaved(i,V,M):new z(i,Wn(i.mode),M);return i.iter(M,t,function(ee){Ct(e,ee.text,Z);var ie=Z.line;ee.stateAfter=ie==t-1||ie%5==0||ie>=u.viewFrom&&ie<u.viewTo?Z.save():null,Z.nextLine()}),r&&(i.modeFrontier=Z.line),Z}function Ct(e,t,r,i){var u=e.doc.mode,M=new nn(t,e.options.tabSize,r);for(M.start=M.pos=i||0,t==""&&at(u,r.state);!M.eol();)Yt(u,M,r.state),M.start=M.pos}function at(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var r=Rn(e,t);if(r.mode.blankLine)return r.mode.blankLine(r.state)}function Yt(e,t,r,i){for(var u=0;u<10;u++){i&&(i[0]=Rn(e,r).mode);var M=e.token(t,r);if(t.pos>t.start)return M}throw new Error("Mode "+e.name+" failed to advance stream.")}var Cn=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Nn(e,t,r,i){var u=e.doc,M=u.mode,V;t=v(u,t);var Z=Pt(u,t.line),ee=Ot(e,t.line,r),ie=new nn(Z.text,e.options.tabSize,ee),Te;for(i&&(Te=[]);(i||ie.pos<t.ch)&&!ie.eol();)ie.start=ie.pos,V=Yt(M,ie,ee.state),i&&Te.push(new Cn(ie,V,Bt(u.mode,ee.state)));return i?Te:new Cn(ie,V,ee.state)}function Hi(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var i=r[1]?"bgClass":"textClass";t[i]==null?t[i]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[i])||(t[i]+=" "+r[2])}return e}function Ri(e,t,r,i,u,M,V){var Z=r.flattenSpans;Z==null&&(Z=e.options.flattenSpans);var ee=0,ie=null,Te=new nn(t,e.options.tabSize,i),Le,Xe=e.options.addModeClass&&[null];for(t==""&&Hi(at(r,i.state),M);!Te.eol();){if(Te.pos>e.options.maxHighlightLength?(Z=!1,V&&Ct(e,t,i,Te.pos),Te.pos=t.length,Le=null):Le=Hi(Yt(r,Te,i.state,Xe),M),Xe){var Ve=Xe[0].name;Ve&&(Le="m-"+(Le?Ve+" "+Le:Ve))}if(!Z||ie!=Le){for(;ee<Te.start;)ee=Math.min(Te.start,ee+5e3),u(ee,ie);ie=Le}Te.start=Te.pos}for(;ee<Te.pos;){var gt=Math.min(Te.pos,ee+5e3);u(gt,ie),ee=gt}}function fi(e,t,r){for(var i,u,M=e.doc,V=r?-1:t-(e.doc.mode.innerMode?1e3:100),Z=t;Z>V;--Z){if(Z<=M.first)return M.first;var ee=Pt(M,Z-1),ie=ee.stateAfter;if(ie&&(!r||Z+(ie instanceof te?ie.lookAhead:0)<=M.modeFrontier))return Z;var Te=G(ee.text,null,e.options.tabSize);(u==null||i>Te)&&(u=Z-1,i=Te)}return u}function sr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var r=e.first,i=t-1;i>r;i--){var u=Pt(e,i).stateAfter;if(u&&(!(u instanceof te)||i+u.lookAhead<t)){r=i+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}var rr=!1,wi=!1;function lr(){rr=!0}function mr(){wi=!0}function ai(e,t,r){this.marker=e,this.from=t,this.to=r}function on(e,t){if(e)for(var r=0;r<e.length;++r){var i=e[r];if(i.marker==t)return i}}function ci(e,t){for(var r,i=0;i<e.length;++i)e[i]!=t&&(r||(r=[])).push(e[i]);return r}function Qt(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function di(e,t,r){var i;if(e)for(var u=0;u<e.length;++u){var M=e[u],V=M.marker,Z=M.from==null||(V.inclusiveLeft?M.from<=t:M.from<t);if(Z||M.from==t&&V.type=="bookmark"&&(!r||!M.marker.insertLeft)){var ee=M.to==null||(V.inclusiveRight?M.to>=t:M.to>t);(i||(i=[])).push(new ai(V,M.from,ee?null:M.to))}}return i}function Fn(e,t,r){var i;if(e)for(var u=0;u<e.length;++u){var M=e[u],V=M.marker,Z=M.to==null||(V.inclusiveRight?M.to>=t:M.to>t);if(Z||M.from==t&&V.type=="bookmark"&&(!r||M.marker.insertLeft)){var ee=M.from==null||(V.inclusiveLeft?M.from<=t:M.from<t);(i||(i=[])).push(new ai(V,ee?null:M.from-t,M.to==null?null:M.to-t))}}return i}function bi(e,t){if(t.full)return null;var r=Ai(e,t.from.line)&&Pt(e,t.from.line).markedSpans,i=Ai(e,t.to.line)&&Pt(e,t.to.line).markedSpans;if(!r&&!i)return null;var u=t.from.ch,M=t.to.ch,V=Zt(t.from,t.to)==0,Z=di(r,u,V),ee=Fn(i,M,V),ie=t.text.length==1,Te=ae(t.text).length+(ie?u:0);if(Z)for(var Le=0;Le<Z.length;++Le){var Xe=Z[Le];if(Xe.to==null){var Ve=on(ee,Xe.marker);Ve?ie&&(Xe.to=Ve.to==null?null:Ve.to+Te):Xe.to=u}}if(ee)for(var gt=0;gt<ee.length;++gt){var Rt=ee[gt];if(Rt.to!=null&&(Rt.to+=Te),Rt.from==null){var Ut=on(Z,Rt.marker);Ut||(Rt.from=Te,ie&&(Z||(Z=[])).push(Rt))}else Rt.from+=Te,ie&&(Z||(Z=[])).push(Rt)}Z&&(Z=$(Z)),ee&&ee!=Z&&(ee=$(ee));var en=[Z];if(!ie){var fn=t.text.length-2,tn;if(fn>0&&Z)for(var _n=0;_n<Z.length;++_n)Z[_n].to==null&&(tn||(tn=[])).push(new ai(Z[_n].marker,null,null));for(var $n=0;$n<fn;++$n)en.push(tn);en.push(ee)}return en}function $(e){for(var t=0;t<e.length;++t){var r=e[t];r.from!=null&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function pe(e,t,r){var i=null;if(e.iter(t.line,r.line+1,function(Ve){if(Ve.markedSpans)for(var gt=0;gt<Ve.markedSpans.length;++gt){var Rt=Ve.markedSpans[gt].marker;Rt.readOnly&&(!i||oe(i,Rt)==-1)&&(i||(i=[])).push(Rt)}}),!i)return null;for(var u=[{from:t,to:r}],M=0;M<i.length;++M)for(var V=i[M],Z=V.find(0),ee=0;ee<u.length;++ee){var ie=u[ee];if(Zt(ie.to,Z.from)<0||Zt(ie.from,Z.to)>0)continue;var Te=[ee,1],Le=Zt(ie.from,Z.from),Xe=Zt(ie.to,Z.to);(Le<0||!V.inclusiveLeft&&!Le)&&Te.push({from:ie.from,to:Z.from}),(Xe>0||!V.inclusiveRight&&!Xe)&&Te.push({from:Z.to,to:ie.to}),u.splice.apply(u,Te),ee+=Te.length-3}return u}function Oe(e){var t=e.markedSpans;if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}function Re(e,t){if(!t)return;for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}function Ge(e){return e.inclusiveLeft?-1:0}function Me(e){return e.inclusiveRight?1:0}function $e(e,t){var r=e.lines.length-t.lines.length;if(r!=0)return r;var i=e.find(),u=t.find(),M=Zt(i.from,u.from)||Ge(e)-Ge(t);if(M)return-M;var V=Zt(i.to,u.to)||Me(e)-Me(t);return V||t.id-e.id}function Ye(e,t){var r=wi&&e.markedSpans,i;if(r)for(var u=void 0,M=0;M<r.length;++M)u=r[M],u.marker.collapsed&&(t?u.from:u.to)==null&&(!i||$e(i,u.marker)<0)&&(i=u.marker);return i}function ut(e){return Ye(e,!0)}function Ze(e){return Ye(e,!1)}function dt(e,t){var r=wi&&e.markedSpans,i;if(r)for(var u=0;u<r.length;++u){var M=r[u];M.marker.collapsed&&(M.from==null||M.from<t)&&(M.to==null||M.to>t)&&(!i||$e(i,M.marker)<0)&&(i=M.marker)}return i}function lt(e,t,r,i,u){var M=Pt(e,t),V=wi&&M.markedSpans;if(V)for(var Z=0;Z<V.length;++Z){var ee=V[Z];if(!ee.marker.collapsed)continue;var ie=ee.marker.find(0),Te=Zt(ie.from,r)||Ge(ee.marker)-Ge(u),Le=Zt(ie.to,i)||Me(ee.marker)-Me(u);if(Te>=0&&Le<=0||Te<=0&&Le>=0)continue;if(Te<=0&&(ee.marker.inclusiveRight&&u.inclusiveLeft?Zt(ie.to,r)>=0:Zt(ie.to,r)>0)||Te>=0&&(ee.marker.inclusiveRight&&u.inclusiveLeft?Zt(ie.from,i)<=0:Zt(ie.from,i)<0))return!0}}function nt(e){for(var t;t=ut(e);)e=t.find(-1,!0).line;return e}function Et(e){for(var t;t=Ze(e);)e=t.find(1,!0).line;return e}function pt(e){for(var t,r;t=Ze(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function Lt(e,t){var r=Pt(e,t),i=nt(r);return r==i?t:vn(i)}function bt(e,t){if(t>e.lastLine())return t;var r=Pt(e,t),i;if(!Nt(e,r))return t;for(;i=Ze(r);)r=i.find(1,!0).line;return vn(r)+1}function Nt(e,t){var r=wi&&t.markedSpans;if(r)for(var i=void 0,u=0;u<r.length;++u){if(i=r[u],!i.marker.collapsed)continue;if(i.from==null)return!0;if(i.marker.widgetNode)continue;if(i.from==0&&i.marker.inclusiveLeft&&qt(e,t,i))return!0}}function qt(e,t,r){if(r.to==null){var i=r.marker.find(1,!0);return qt(e,i.line,on(i.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var u=void 0,M=0;M<t.markedSpans.length;++M)if(u=t.markedSpans[M],u.marker.collapsed&&!u.marker.widgetNode&&u.from==r.to&&(u.to==null||u.to!=r.from)&&(u.marker.inclusiveLeft||r.marker.inclusiveRight)&&qt(e,t,u))return!0}function rn(e){e=nt(e);for(var t=0,r=e.parent,i=0;i<r.lines.length;++i){var u=r.lines[i];if(u==e)break;t+=u.height}for(var M=r.parent;M;r=M,M=r.parent)for(var V=0;V<M.children.length;++V){var Z=M.children[V];if(Z==r)break;t+=Z.height}return t}function ti(e){if(e.height==0)return 0;for(var t=e.text.length,r,i=e;r=ut(i);){var u=r.find(0,!0);i=u.from.line,t+=u.from.ch-u.to.ch}for(i=e;r=Ze(i);){var M=r.find(0,!0);t-=i.text.length-M.from.ch,i=M.to.line,t+=i.text.length-M.to.ch}return t}function pn(e){var t=e.display,r=e.doc;t.maxLine=Pt(r,r.first),t.maxLineLength=ti(t.maxLine),t.maxLineChanged=!0,r.iter(function(i){var u=ti(i);u>t.maxLineLength&&(t.maxLineLength=u,t.maxLine=i)})}var bn=function(e,t,r){this.text=e,Re(this,t),this.height=r?r(this):1};bn.prototype.lineNo=function(){return vn(this)},Ie(bn);function In(e,t,r,i){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Oe(e),Re(e,r);var u=i?i(e):1;u!=e.height&&ui(e,u)}function At(e){e.parent=null,Oe(e)}var cn={},Jt={};function wn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Jt:cn;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function En(e,t){var r=E("span",null,null,F?"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 u=0;u<=(t.rest?t.rest.length:0);u++){var M=u?t.rest[u-1]:t.line,V=void 0;i.pos=0,i.addToken=Kn,zn(e.display.measure)&&(V=Xt(M,e.doc.direction))&&(i.addToken=ln(i.addToken,V)),i.map=[];var Z=t!=e.display.externalMeasured&&vn(M);Yn(M,i,tt(e,M,Z)),M.styleClasses&&(M.styleClasses.bgClass&&(i.bgClass=K(M.styleClasses.bgClass,i.bgClass||"")),M.styleClasses.textClass&&(i.textClass=K(M.styleClasses.textClass,i.textClass||""))),i.map.length==0&&i.map.push(0,0,i.content.appendChild(gn(e.display.measure))),u==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(F){var ee=i.content.lastChild;(/\bcm-tab\b/.test(ee.className)||ee.querySelector&&ee.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return qe(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=K(i.pre.className,i.textClass||"")),i}function Vn(e){var t=h("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Kn(e,t,r,i,u,M,V){if(!t)return;var Z=e.splitSpaces?Di(t,e.trailingSpace):t,ee=e.cm.state.specialChars,ie=!1,Te;if(!ee.test(t))e.col+=t.length,Te=document.createTextNode(Z),e.map.push(e.pos,e.pos+t.length,Te),H&&I<9&&(ie=!0),e.pos+=t.length;else{Te=document.createDocumentFragment();for(var Le=0;;){ee.lastIndex=Le;var Xe=ee.exec(t),Ve=Xe?Xe.index-Le:t.length-Le;if(Ve){var gt=document.createTextNode(Z.slice(Le,Le+Ve));H&&I<9?Te.appendChild(h("span",[gt])):Te.appendChild(gt),e.map.push(e.pos,e.pos+Ve,gt),e.col+=Ve,e.pos+=Ve}if(!Xe)break;Le+=Ve+1;var Rt=void 0;if(Xe[0]==" "){var Ut=e.cm.options.tabSize,en=Ut-e.col%Ut;Rt=Te.appendChild(h("span",ue(en),"cm-tab")),Rt.setAttribute("role","presentation"),Rt.setAttribute("cm-text"," "),e.col+=en}else Xe[0]=="\r"||Xe[0]==`
|
|
`?(Rt=Te.appendChild(h("span",Xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Rt.setAttribute("cm-text",Xe[0]),e.col+=1):(Rt=e.cm.options.specialCharPlaceholder(Xe[0]),Rt.setAttribute("cm-text",Xe[0]),H&&I<9?Te.appendChild(h("span",[Rt])):Te.appendChild(Rt),e.col+=1);e.map.push(e.pos,e.pos+1,Rt),e.pos++}}if(e.trailingSpace=Z.charCodeAt(t.length-1)==32,r||i||u||ie||M||V){var fn=r||"";i&&(fn+=i),u&&(fn+=u);var tn=h("span",[Te],fn,M);if(V)for(var _n in V)V.hasOwnProperty(_n)&&_n!="style"&&_n!="class"&&tn.setAttribute(_n,V[_n]);return e.content.appendChild(tn)}e.content.appendChild(Te)}function Di(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,i="",u=0;u<e.length;u++){var M=e.charAt(u);M==" "&&r&&(u==e.length-1||e.charCodeAt(u+1)==32)&&(M="\xA0"),i+=M,r=M==" "}return i}function ln(e,t){return function(r,i,u,M,V,Z,ee){u=u?u+" cm-force-border":"cm-force-border";for(var ie=r.pos,Te=ie+i.length;;){for(var Le=void 0,Xe=0;Xe<t.length&&!(Le=t[Xe],Le.to>ie&&Le.from<=ie);Xe++);if(Le.to>=Te)return e(r,i,u,M,V,Z,ee);e(r,i.slice(0,Le.to-ie),u,M,null,Z,ee),M=null,i=i.slice(Le.to-ie),ie=Le.to}}}function kt(e,t,r,i){var u=!i&&r.widgetNode;u&&e.map.push(e.pos,e.pos+t,u),!i&&e.cm.display.input.needsContentAttribute&&(u||(u=e.content.appendChild(document.createElement("span"))),u.setAttribute("cm-marker",r.id)),u&&(e.cm.display.input.setUneditable(u),e.content.appendChild(u)),e.pos+=t,e.trailingSpace=!1}function Yn(e,t,r){var i=e.markedSpans,u=e.text,M=0;if(!i){for(var V=1;V<r.length;V+=2)t.addToken(t,u.slice(M,M=r[V]),wn(r[V+1],t.cm.options));return}for(var Z=u.length,ee=0,ie=1,Te="",Le,Xe,Ve=0,gt,Rt,Ut,en,fn;;){if(Ve==ee){gt=Rt=Ut=Xe="",fn=null,en=null,Ve=Infinity;for(var tn=[],_n=void 0,$n=0;$n<i.length;++$n){var Pn=i[$n],yi=Pn.marker;if(yi.type=="bookmark"&&Pn.from==ee&&yi.widgetNode)tn.push(yi);else if(Pn.from<=ee&&(Pn.to==null||Pn.to>ee||yi.collapsed&&Pn.to==ee&&Pn.from==ee)){if(Pn.to!=null&&Pn.to!=ee&&Ve>Pn.to&&(Ve=Pn.to,Rt=""),yi.className&&(gt+=" "+yi.className),yi.css&&(Xe=(Xe?Xe+";":"")+yi.css),yi.startStyle&&Pn.from==ee&&(Ut+=" "+yi.startStyle),yi.endStyle&&Pn.to==Ve&&(_n||(_n=[])).push(yi.endStyle,Pn.to),yi.title&&((fn||(fn={})).title=yi.title),yi.attributes)for(var nr in yi.attributes)(fn||(fn={}))[nr]=yi.attributes[nr];yi.collapsed&&(!en||$e(en.marker,yi)<0)&&(en=Pn)}else Pn.from>ee&&Ve>Pn.from&&(Ve=Pn.from)}if(_n)for(var Ur=0;Ur<_n.length;Ur+=2)_n[Ur+1]==Ve&&(Rt+=" "+_n[Ur]);if(!en||en.from==ee)for(var pr=0;pr<tn.length;++pr)kt(t,0,tn[pr]);if(en&&(en.from||0)==ee){if(kt(t,(en.to==null?Z+1:en.to)-ee,en.marker,en.from==null),en.to==null)return;en.to==ee&&(en=!1)}}if(ee>=Z)break;for(var ra=Math.min(Z,Ve);;){if(Te){var ea=ee+Te.length;if(!en){var Ar=ea>ra?Te.slice(0,ra-ee):Te;t.addToken(t,Ar,Le?Le+gt:gt,Ut,ee+Ar.length==Ve?Rt:"",Xe,fn)}if(ea>=ra){Te=Te.slice(ra-ee),ee=ra;break}ee=ea,Ut=""}Te=u.slice(M,M=r[ie++]),Le=wn(r[ie++],t.cm.options)}}}function mn(e,t,r){this.line=t,this.rest=pt(t),this.size=this.rest?vn(ae(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Nt(e,t)}function Sn(e,t,r){for(var i=[],u,M=t;M<r;M=u){var V=new mn(e.doc,Pt(e.doc,M),M);u=M+V.size,i.push(V)}return i}var Un=null;function Bn(e){Un?Un.ops.push(e):e.ownsGroup=Un={ops:[e],delayedCallbacks:[]}}function Li(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var i=0;i<e.ops.length;i++){var u=e.ops[i];if(u.cursorActivityHandlers)for(;u.cursorActivityCalled<u.cursorActivityHandlers.length;)u.cursorActivityHandlers[u.cursorActivityCalled++].call(null,u.cm)}}while(r<t.length)}function kn(e,t){var r=e.ownsGroup;if(!r)return;try{Li(r)}finally{Un=null,t(r)}}var Gn=null;function jn(e,t){var r=un(e,t);if(!r.length)return;var i=Array.prototype.slice.call(arguments,2),u;Un?u=Un.delayedCallbacks:Gn?u=Gn:(u=Gn=[],setTimeout(xi,0));for(var M=function(Z){u.push(function(){return r[Z].apply(null,i)})},V=0;V<r.length;++V)M(V)}function xi(){var e=Gn;Gn=null;for(var t=0;t<e.length;++t)e[t]()}function er(e,t,r,i){for(var u=0;u<t.changes.length;u++){var M=t.changes[u];M=="text"?Cr(e,t):M=="gutter"?ur(e,t,r,i):M=="class"?Dr(e,t):M=="widget"&&ca(e,t,i)}t.changes=null}function Wi(e){return e.node==e.text&&(e.node=h("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),H&&I<8&&(e.node.style.zIndex=2)),e.node}function fr(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var i=Wi(t);t.background=i.insertBefore(h("div",null,r),i.firstChild),e.display.input.setUneditable(t.background)}}function gr(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):En(e,t)}function Cr(e,t){var r=t.text.className,i=gr(e,t);t.text==t.node&&(t.node=i.pre),t.text.parentNode.replaceChild(i.pre,t.text),t.text=i.pre,i.bgClass!=t.bgClass||i.textClass!=t.textClass?(t.bgClass=i.bgClass,t.textClass=i.textClass,Dr(e,t)):r&&(t.text.className=r)}function Dr(e,t){fr(e,t),t.line.wrapClass?Wi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function ur(e,t,r,i){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var u=Wi(t);t.gutterBackground=h("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),u.insertBefore(t.gutterBackground,t.text)}var M=t.line.gutterMarkers;if(e.options.lineNumbers||M){var V=Wi(t),Z=t.gutter=h("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Z),V.insertBefore(Z,t.text),t.line.gutterClass&&(Z.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!M||!M["CodeMirror-linenumbers"])&&(t.lineNumber=Z.appendChild(h("div",Pi(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),M)for(var ee=0;ee<e.display.gutterSpecs.length;++ee){var ie=e.display.gutterSpecs[ee].className,Te=M.hasOwnProperty(ie)&&M[ie];Te&&Z.appendChild(h("div",[Te],"CodeMirror-gutter-elt","left: "+i.gutterLeft[ie]+"px; width: "+i.gutterWidth[ie]+"px"))}}}function ca(e,t,r){t.alignable&&(t.alignable=null);for(var i=w("CodeMirror-linewidget"),u=t.node.firstChild,M=void 0;u;u=M)M=u.nextSibling,i.test(u.className)&&t.node.removeChild(u);Kr(e,t,r)}function wr(e,t,r,i){var u=gr(e,t);return t.text=t.node=u.pre,u.bgClass&&(t.bgClass=u.bgClass),u.textClass&&(t.textClass=u.textClass),Dr(e,t),ur(e,t,r,i),Kr(e,t,i),t.node}function Kr(e,t,r){if(va(e,t.line,t,r,!0),t.rest)for(var i=0;i<t.rest.length;i++)va(e,t.rest[i],t,r,!1)}function va(e,t,r,i,u){if(!t.widgets)return;for(var M=Wi(r),V=0,Z=t.widgets;V<Z.length;++V){var ee=Z[V],ie=h("div",[ee.node],"CodeMirror-linewidget"+(ee.className?" "+ee.className:""));ee.handleMouseEvents||ie.setAttribute("cm-ignore-events","true"),Gr(ee,ie,r,i),e.display.input.setUneditable(ie),u&&ee.above?M.insertBefore(ie,r.gutter||r.text):M.appendChild(ie),jn(ee,"redraw")}}function Gr(e,t,r,i){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var u=i.wrapperWidth;t.style.left=i.fixedPos+"px",e.coverGutter||(u-=i.gutterTotalWidth,t.style.paddingLeft=i.gutterTotalWidth+"px"),t.style.width=u+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-i.gutterTotalWidth+"px"))}function br(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!T(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),y(t.display.measure,h("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function kr(e,t){for(var r=ke(t);r!=e.wrapper;r=r.parentNode)if(!r||r.nodeType==1&&r.getAttribute("cm-ignore-events")=="true"||r.parentNode==e.sizer&&r!=e.mover)return!0}function Mr(e){return e.lineSpace.offsetTop}function me(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function De(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=y(e.measure,h("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return!isNaN(i.left)&&!isNaN(i.right)&&(e.cachedPaddingH=i),i}function Pe(e){return fe-e.display.nativeBarWidth}function ge(e){return e.display.scroller.clientWidth-Pe(e)-e.display.barWidth}function ne(e){return e.display.scroller.clientHeight-Pe(e)-e.display.barHeight}function he(e,t,r){var i=e.options.lineWrapping,u=i&&ge(e);if(!t.measure.heights||i&&t.measure.width!=u){var M=t.measure.heights=[];if(i){t.measure.width=u;for(var V=t.text.firstChild.getClientRects(),Z=0;Z<V.length-1;Z++){var ee=V[Z],ie=V[Z+1];Math.abs(ee.bottom-ie.bottom)>2&&M.push((ee.bottom+ie.top)/2-r.top)}}M.push(r.bottom-r.top)}}function re(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var i=0;i<e.rest.length;i++)if(e.rest[i]==t)return{map:e.measure.maps[i],cache:e.measure.caches[i]};for(var u=0;u<e.rest.length;u++)if(vn(e.rest[u])>r)return{map:e.measure.maps[u],cache:e.measure.caches[u],before:!0}}function ve(e,t){t=nt(t);var r=vn(t),i=e.display.externalMeasured=new mn(e.doc,t,r);i.lineN=r;var u=i.built=En(e,i);return i.text=u.pre,y(e.display.lineMeasure,u.pre),i}function Ce(e,t,r,i){return ze(e,we(e,t),r,i)}function He(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Qi(e,t)];var r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size)return r}function we(e,t){var r=vn(t),i=He(e,r);i&&!i.text?i=null:i&&i.changes&&(er(e,i,r,Mn(e)),e.curOp.forceUpdate=!0),i||(i=ve(e,t));var u=re(i,t,r);return{line:t,view:i,rect:null,map:u.map,cache:u.cache,before:u.before,hasHeights:!1}}function ze(e,t,r,i,u){t.before&&(r=-1);var M=r+(i||""),V;return t.cache.hasOwnProperty(M)?V=t.cache[M]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(he(e,t.view,t.rect),t.hasHeights=!0),V=Ft(e,t,r,i),V.bogus||(t.cache[M]=V)),{left:V.left,right:V.right,top:u?V.rtop:V.top,bottom:u?V.rbottom:V.bottom}}var rt={left:0,right:0,top:0,bottom:0};function vt(e,t,r){for(var i,u,M,V,Z,ee,ie=0;ie<e.length;ie+=3)if(Z=e[ie],ee=e[ie+1],t<Z?(u=0,M=1,V="left"):t<ee?(u=t-Z,M=u+1):(ie==e.length-3||t==ee&&e[ie+3]>t)&&(M=ee-Z,u=M-1,t>=ee&&(V="right")),u!=null){if(i=e[ie+2],Z==ee&&r==(i.insertLeft?"left":"right")&&(V=r),r=="left"&&u==0)for(;ie&&e[ie-2]==e[ie-3]&&e[ie-1].insertLeft;)i=e[(ie-=3)+2],V="left";if(r=="right"&&u==ee-Z)for(;ie<e.length-3&&e[ie+3]==e[ie+4]&&!e[ie+5].insertLeft;)i=e[(ie+=3)+2],V="right";break}return{node:i,start:u,end:M,collapse:V,coverStart:Z,coverEnd:ee}}function xt(e,t){var r=rt;if(t=="left")for(var i=0;i<e.length&&!((r=e[i]).left!=r.right);i++);else for(var u=e.length-1;u>=0&&!((r=e[u]).left!=r.right);u--);return r}function Ft(e,t,r,i){var u=vt(t.map,r,i),M=u.node,V=u.start,Z=u.end,ee=u.collapse,ie;if(M.nodeType==3){for(var Te=0;Te<4;Te++){for(;V&&mt(t.line.text.charAt(u.coverStart+V));)--V;for(;u.coverStart+Z<u.coverEnd&&mt(t.line.text.charAt(u.coverStart+Z));)++Z;if(H&&I<9&&V==0&&Z==u.coverEnd-u.coverStart?ie=M.parentNode.getBoundingClientRect():ie=xt(m(M,V,Z).getClientRects(),i),ie.left||ie.right||V==0)break;Z=V,V=V-1,ee="right"}H&&I<11&&(ie=dn(e.display.measure,ie))}else{V>0&&(ee=i="right");var Le;e.options.lineWrapping&&(Le=M.getClientRects()).length>1?ie=Le[i=="right"?Le.length-1:0]:ie=M.getBoundingClientRect()}if(H&&I<9&&!V&&(!ie||!ie.left&&!ie.right)){var Xe=M.parentNode.getClientRects()[0];Xe?ie={left:Xe.left,right:Xe.left+Ci(e.display),top:Xe.top,bottom:Xe.bottom}:ie=rt}for(var Ve=ie.top-t.rect.top,gt=ie.bottom-t.rect.top,Rt=(Ve+gt)/2,Ut=t.view.measure.heights,en=0;en<Ut.length-1&&!(Rt<Ut[en]);en++);var fn=en?Ut[en-1]:0,tn=Ut[en],_n={left:(ee=="right"?ie.right:ie.left)-t.rect.left,right:(ee=="left"?ie.left:ie.right)-t.rect.left,top:fn,bottom:tn};return!ie.left&&!ie.right&&(_n.bogus=!0),e.options.singleCursorHeightPerLine||(_n.rtop=Ve,_n.rbottom=gt),_n}function dn(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!zi(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*i,bottom:t.bottom*i}}function Dn(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function On(e){e.display.externalMeasure=null,S(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Dn(e.display.view[t])}function Jn(e){On(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ni(){return g&&s?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Xn(){return g&&s?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ei(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=br(e.widgets[r]));return t}function oi(e,t,r,i,u){if(!u){var M=ei(t);r.top+=M,r.bottom+=M}if(i=="line")return r;i||(i="local");var V=rn(t);if(i=="local"?V+=Mr(e.display):V-=e.display.viewOffset,i=="page"||i=="window"){var Z=e.display.lineSpace.getBoundingClientRect();V+=Z.top+(i=="window"?0:Xn());var ee=Z.left+(i=="window"?0:ni());r.left+=ee,r.right+=ee}return r.top+=V,r.bottom+=V,r}function An(e,t,r){if(r=="div")return t;var i=t.left,u=t.top;if(r=="page")i-=ni(),u-=Xn();else if(r=="local"||!r){var M=e.display.sizer.getBoundingClientRect();i+=M.left,u+=M.top}var V=e.display.lineSpace.getBoundingClientRect();return{left:i-V.left,top:u-V.top}}function Ti(e,t,r,i,u){return i||(i=Pt(e.doc,t.line)),oi(e,i,Ce(e,i,t.ch,u),r)}function Tn(e,t,r,i,u,M){i=i||Pt(e.doc,t.line),u||(u=we(e,i));function V(gt,Rt){var Ut=ze(e,u,gt,Rt?"right":"left",M);return Rt?Ut.left=Ut.right:Ut.right=Ut.left,oi(e,i,Ut,r)}var Z=Xt(i,e.doc.direction),ee=t.ch,ie=t.sticky;if(ee>=i.text.length?(ee=i.text.length,ie="before"):ee<=0&&(ee=0,ie="after"),!Z)return V(ie=="before"?ee-1:ee,ie=="before");function Te(gt,Rt,Ut){var en=Z[Rt],fn=en.level==1;return V(Ut?gt-1:gt,fn!=Ut)}var Le=Tt(Z,ee,ie),Xe=zt,Ve=Te(ee,Le,ie=="before");return Xe!=null&&(Ve.other=Te(ee,Xe,ie!="before")),Ve}function St(e,t){var r=0;t=v(e.doc,t),e.options.lineWrapping||(r=Ci(e.display)*t.ch);var i=Pt(e.doc,t.line),u=rn(i)+Mr(e.display);return{left:r,right:r,top:u,bottom:u+i.height}}function jt(e,t,r,i,u){var M=ct(e,t,r);return M.xRel=u,i&&(M.outside=i),M}function Zn(e,t,r){var i=e.doc;if(r+=e.display.viewOffset,r<0)return jt(i.first,0,null,-1,-1);var u=Bi(i,r),M=i.first+i.size-1;if(u>M)return jt(i.first+i.size-1,Pt(i,M).text.length,null,1,1);t<0&&(t=0);for(var V=Pt(i,u);;){var Z=Yi(e,V,u,t,r),ee=dt(V,Z.ch+(Z.xRel>0||Z.outside>0?1:0));if(!ee)return Z;var ie=ee.find(1);if(ie.line==u)return ie;V=Pt(i,u=ie.line)}}function pi(e,t,r,i){i-=ei(t);var u=t.text.length,M=Ht(function(V){return ze(e,r,V-1).bottom<=i},u,0);return u=Ht(function(V){return ze(e,r,V).top>i},M,u),{begin:M,end:u}}function yn(e,t,r,i){r||(r=we(e,t));var u=oi(e,t,ze(e,r,i),"line").top;return pi(e,t,r,u)}function gi(e,t,r,i){return e.bottom<=r?!1:e.top>r?!0:(i?e.left:e.right)>t}function Yi(e,t,r,i,u){u-=rn(t);var M=we(e,t),V=ei(t),Z=0,ee=t.text.length,ie=!0,Te=Xt(t,e.doc.direction);if(Te){var Le=(e.options.lineWrapping?Ni:vi)(e,t,r,M,Te,i,u);ie=Le.level!=1,Z=ie?Le.from:Le.to-1,ee=ie?Le.to:Le.from-1}var Xe=null,Ve=null,gt=Ht(function($n){var Pn=ze(e,M,$n);return Pn.top+=V,Pn.bottom+=V,gi(Pn,i,u,!1)?(Pn.top<=u&&Pn.left<=i&&(Xe=$n,Ve=Pn),!0):!1},Z,ee),Rt,Ut,en=!1;if(Ve){var fn=i-Ve.left<Ve.right-i,tn=fn==ie;gt=Xe+(tn?0:1),Ut=tn?"after":"before",Rt=fn?Ve.left:Ve.right}else{!ie&&(gt==ee||gt==Z)&>++,Ut=gt==0?"after":gt==t.text.length?"before":ze(e,M,gt-(ie?1:0)).bottom+V<=u==ie?"after":"before";var _n=Tn(e,ct(r,gt,Ut),"line",t,M);Rt=_n.left,en=u<_n.top?-1:u>=_n.bottom?1:0}return gt=ft(t.text,gt,1),jt(r,gt,Ut,en,i-Rt)}function vi(e,t,r,i,u,M,V){var Z=Ht(function(Le){var Xe=u[Le],Ve=Xe.level!=1;return gi(Tn(e,ct(r,Ve?Xe.to:Xe.from,Ve?"before":"after"),"line",t,i),M,V,!0)},0,u.length-1),ee=u[Z];if(Z>0){var ie=ee.level!=1,Te=Tn(e,ct(r,ie?ee.from:ee.to,ie?"after":"before"),"line",t,i);gi(Te,M,V,!0)&&Te.top>V&&(ee=u[Z-1])}return ee}function Ni(e,t,r,i,u,M,V){var Z=pi(e,t,i,V),ee=Z.begin,ie=Z.end;/\s/.test(t.text.charAt(ie-1))&&ie--;for(var Te=null,Le=null,Xe=0;Xe<u.length;Xe++){var Ve=u[Xe];if(Ve.from>=ie||Ve.to<=ee)continue;var gt=Ve.level!=1,Rt=ze(e,i,gt?Math.min(ie,Ve.to)-1:Math.max(ee,Ve.from)).right,Ut=Rt<M?M-Rt+1e9:Rt-M;(!Te||Le>Ut)&&(Te=Ve,Le=Ut)}return Te||(Te=u[u.length-1]),Te.from<ee&&(Te={from:ee,to:Te.to,level:Te.level}),Te.to>ie&&(Te={from:Te.from,to:ie,level:Te.level}),Te}var Ii;function Si(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Ii==null){Ii=h("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Ii.appendChild(document.createTextNode("x")),Ii.appendChild(h("br"));Ii.appendChild(document.createTextNode("x"))}y(e.measure,Ii);var r=Ii.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),S(e.measure),r||1}function Ci(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=h("span","xxxxxxxxxx"),r=h("pre",[t],"CodeMirror-line-like");y(e.measure,r);var i=t.getBoundingClientRect(),u=(i.right-i.left)/10;return u>2&&(e.cachedCharWidth=u),u||10}function Mn(e){for(var t=e.display,r={},i={},u=t.gutters.clientLeft,M=t.gutters.firstChild,V=0;M;M=M.nextSibling,++V){var Z=e.display.gutterSpecs[V].className;r[Z]=M.offsetLeft+M.clientLeft+u,i[Z]=M.clientWidth}return{fixedPos:or(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function or(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function $r(e){var t=Si(e.display),r=e.options.lineWrapping,i=r&&Math.max(5,e.display.scroller.clientWidth/Ci(e.display)-3);return function(u){if(Nt(e.doc,u))return 0;var M=0;if(u.widgets)for(var V=0;V<u.widgets.length;V++)u.widgets[V].height&&(M+=u.widgets[V].height);return r?M+(Math.ceil(u.text.length/i)||1)*t:M+t}}function Pr(e){var t=e.doc,r=$r(e);t.iter(function(i){var u=r(i);u!=i.height&&ui(i,u)})}function Er(e,t,r,i){var u=e.display;if(!r&&ke(t).getAttribute("cm-not-content")=="true")return null;var M,V,Z=u.lineSpace.getBoundingClientRect();try{M=t.clientX-Z.left,V=t.clientY-Z.top}catch(Le){return null}var ee=Zn(e,M,V),ie;if(i&&ee.xRel>0&&(ie=Pt(e.doc,ee.line).text).length==ee.ch){var Te=G(ie,ie.length,e.options.tabSize)-ie.length;ee=ct(ee.line,Math.max(0,Math.round((M-De(e.display).left)/Ci(e.display))-Te))}return ee}function Qi(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;i<r.length;i++)if(t-=r[i].size,t<0)return i}function Ki(e,t,r,i){t==null&&(t=e.doc.first),r==null&&(r=e.doc.first+e.doc.size),i||(i=0);var u=e.display;if(i&&r<u.viewTo&&(u.updateLineNumbers==null||u.updateLineNumbers>t)&&(u.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=u.viewTo)wi&&Lt(e.doc,t)<u.viewTo&&Ji(e);else if(r<=u.viewFrom)wi&&bt(e.doc,r+i)>u.viewFrom?Ji(e):(u.viewFrom+=i,u.viewTo+=i);else if(t<=u.viewFrom&&r>=u.viewTo)Ji(e);else if(t<=u.viewFrom){var M=Nr(e,r,r+i,1);M?(u.view=u.view.slice(M.index),u.viewFrom=M.lineN,u.viewTo+=i):Ji(e)}else if(r>=u.viewTo){var V=Nr(e,t,t,-1);V?(u.view=u.view.slice(0,V.index),u.viewTo=V.lineN):Ji(e)}else{var Z=Nr(e,t,t,-1),ee=Nr(e,r,r+i,1);Z&&ee?(u.view=u.view.slice(0,Z.index).concat(Sn(e,Z.lineN,ee.lineN)).concat(u.view.slice(ee.index)),u.viewTo+=i):Ji(e)}var ie=u.externalMeasured;ie&&(r<ie.lineN?ie.lineN+=i:t<ie.lineN+ie.size&&(u.externalMeasured=null))}function Vi(e,t,r){e.curOp.viewChanged=!0;var i=e.display,u=e.display.externalMeasured;if(u&&t>=u.lineN&&t<u.lineN+u.size&&(i.externalMeasured=null),t<i.viewFrom||t>=i.viewTo)return;var M=i.view[Qi(e,t)];if(M.node==null)return;var V=M.changes||(M.changes=[]);oe(V,r)==-1&&V.push(r)}function Ji(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Nr(e,t,r,i){var u=Qi(e,t),M,V=e.display.view;if(!wi||r==e.doc.first+e.doc.size)return{index:u,lineN:r};for(var Z=e.display.viewFrom,ee=0;ee<u;ee++)Z+=V[ee].size;if(Z!=t){if(i>0){if(u==V.length-1)return null;M=Z+V[u].size-t,u++}else M=Z-t;t+=M,r+=M}for(;Lt(e.doc,r)!=r;){if(u==(i<0?0:V.length-1))return null;r+=i*V[u-(i<0?1:0)].size,u+=i}return{index:u,lineN:r}}function da(e,t,r){var i=e.display,u=i.view;u.length==0||t>=i.viewTo||r<=i.viewFrom?(i.view=Sn(e,t,r),i.viewFrom=t):(i.viewFrom>t?i.view=Sn(e,t,i.viewFrom).concat(i.view):i.viewFrom<t&&(i.view=i.view.slice(Qi(e,t))),i.viewFrom=t,i.viewTo<r?i.view=i.view.concat(Sn(e,i.viewTo,r)):i.viewTo>r&&(i.view=i.view.slice(0,Qi(e,r)))),i.viewTo=r}function aa(e){for(var t=e.display.view,r=0,i=0;i<t.length;i++){var u=t[i];!u.hidden&&(!u.node||u.changes)&&++r}return r}function Gi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Qr(e,t){t===void 0&&(t=!0);for(var r=e.doc,i={},u=i.cursors=document.createDocumentFragment(),M=i.selection=document.createDocumentFragment(),V=0;V<r.sel.ranges.length;V++){if(!t&&V==r.sel.primIndex)continue;var Z=r.sel.ranges[V];if(Z.from().line>=e.display.viewTo||Z.to().line<e.display.viewFrom)continue;var ee=Z.empty();(ee||e.options.showCursorWhenSelecting)&&Jr(e,Z.head,u),ee||Ui(e,Z,M)}return i}function Jr(e,t,r){var i=Tn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),u=r.appendChild(h("div","\xA0","CodeMirror-cursor"));if(u.style.left=i.left+"px",u.style.top=i.top+"px",u.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var M=r.appendChild(h("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));M.style.display="",M.style.left=i.other.left+"px",M.style.top=i.other.top+"px",M.style.height=(i.other.bottom-i.other.top)*.85+"px"}}function Xi(e,t){return e.top-t.top||e.left-t.left}function Ui(e,t,r){var i=e.display,u=e.doc,M=document.createDocumentFragment(),V=De(e.display),Z=V.left,ee=Math.max(i.sizerWidth,ge(e)-i.sizer.offsetLeft)-V.right,ie=u.direction=="ltr";function Te(tn,_n,$n,Pn){_n<0&&(_n=0),_n=Math.round(_n),Pn=Math.round(Pn),M.appendChild(h("div",null,"CodeMirror-selected","position: absolute; left: "+tn+`px;
|
|
top: `+_n+"px; width: "+($n==null?ee-tn:$n)+`px;
|
|
height: `+(Pn-_n)+"px"))}function Le(tn,_n,$n){var Pn=Pt(u,tn),yi=Pn.text.length,nr,Ur;function pr(Ar,ta){return Ti(e,ct(tn,Ar),"div",Pn,ta)}function ra(Ar,ta,Wr){var Ir=yn(e,Pn,null,Ar),Rr=ta=="ltr"==(Wr=="after")?"left":"right",_r=Wr=="after"?Ir.begin:Ir.end-(/\s/.test(Pn.text.charAt(Ir.end-1))?2:1);return pr(_r,Rr)[Rr]}var ea=Xt(Pn,u.direction);return Vt(ea,_n||0,$n==null?yi:$n,function(Ar,ta,Wr,Ir){var Rr=Wr=="ltr",_r=pr(Ar,Rr?"left":"right"),na=pr(ta-1,Rr?"right":"left"),So=_n==null&&Ar==0,to=$n==null&&ta==yi,Vr=Ir==0,Ia=!ea||Ir==ea.length-1;if(na.top-_r.top<=3){var Br=(ie?So:to)&&Vr,ms=(ie?to:So)&&Ia,Ga=Br?Z:(Rr?_r:na).left,lo=ms?ee:(Rr?na:_r).right;Te(Ga,_r.top,lo-Ga,_r.bottom)}else{var uo,Xr,Oo,gs;Rr?(uo=ie&&So&&Vr?Z:_r.left,Xr=ie?ee:ra(Ar,Wr,"before"),Oo=ie?Z:ra(ta,Wr,"after"),gs=ie&&to&&Ia?ee:na.right):(uo=ie?ra(Ar,Wr,"before"):Z,Xr=!ie&&So&&Vr?ee:_r.right,Oo=!ie&&to&&Ia?Z:na.left,gs=ie?ra(ta,Wr,"after"):ee),Te(uo,_r.top,Xr-uo,_r.bottom),_r.bottom<na.top&&Te(Z,_r.bottom,null,na.top),Te(Oo,na.top,gs-Oo,na.bottom)}(!nr||Xi(_r,nr)<0)&&(nr=_r),Xi(na,nr)<0&&(nr=na),(!Ur||Xi(_r,Ur)<0)&&(Ur=_r),Xi(na,Ur)<0&&(Ur=na)}),{start:nr,end:Ur}}var Xe=t.from(),Ve=t.to();if(Xe.line==Ve.line)Le(Xe.line,Xe.ch,Ve.ch);else{var gt=Pt(u,Xe.line),Rt=Pt(u,Ve.line),Ut=nt(gt)==nt(Rt),en=Le(Xe.line,Xe.ch,Ut?gt.text.length+1:null).end,fn=Le(Ve.line,Ut?0:null,Ve.ch).start;Ut&&(en.top<fn.top-2?(Te(en.right,en.top,null,en.bottom),Te(Z,fn.top,fn.left,fn.bottom)):Te(en.right,en.top,fn.left-en.right,en.bottom)),en.bottom<fn.top&&Te(Z,en.bottom,null,fn.top)}r.appendChild(M)}function vr(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Ca(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function ka(e){e.state.focused||(e.display.input.focus(),oa(e))}function no(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ca(e))},100)}function oa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(qe(e,"focus",e,t),e.state.focused=!0,N(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),F&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),vr(e)}function Ca(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(qe(e,"blur",e,t),e.state.focused=!1,_(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function wa(e){for(var t=e.display,r=t.lineDiv.offsetTop,i=0;i<t.view.length;i++){var u=t.view[i],M=e.options.lineWrapping,V=void 0,Z=0;if(u.hidden)continue;if(H&&I<8){var ee=u.node.offsetTop+u.node.offsetHeight;V=ee-r,r=ee}else{var ie=u.node.getBoundingClientRect();V=ie.bottom-ie.top,!M&&u.text.firstChild&&(Z=u.text.firstChild.getBoundingClientRect().right-ie.left-1)}var Te=u.line.height-V;if((Te>.005||Te<-.005)&&(ui(u.line,V),Sa(u.line),u.rest))for(var Le=0;Le<u.rest.length;Le++)Sa(u.rest[Le]);if(Z>e.display.sizerWidth){var Xe=Math.ceil(Z/Ci(e.display));Xe>e.display.maxLineLength&&(e.display.maxLineLength=Xe,e.display.maxLine=u.line,e.display.maxLineChanged=!0)}}}function Sa(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],i=r.node.parentNode;i&&(r.height=i.offsetHeight)}}function Ma(e,t,r){var i=r&&r.top!=null?Math.max(0,r.top):e.scroller.scrollTop;i=Math.floor(i-Mr(e));var u=r&&r.bottom!=null?r.bottom:i+e.wrapper.clientHeight,M=Bi(t,i),V=Bi(t,u);if(r&&r.ensure){var Z=r.ensure.from.line,ee=r.ensure.to.line;Z<M?(M=Z,V=Bi(t,rn(Pt(t,Z))+e.wrapper.clientHeight)):Math.min(ee,t.lastLine())>=V&&(M=Bi(t,rn(Pt(t,ee))-e.wrapper.clientHeight),V=ee)}return{from:M,to:Math.max(V,M+1)}}function co(e,t){if(wt(e,"scrollCursorIntoView"))return;var r=e.display,i=r.sizer.getBoundingClientRect(),u=null;if(t.top+i.top<0?u=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(u=!1),u!=null&&!n){var M=h("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-r.viewOffset-Mr(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Pe(e)+r.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(M),M.scrollIntoView(u),e.display.lineSpace.removeChild(M)}}function Ao(e,t,r,i){i==null&&(i=0);var u;!e.options.lineWrapping&&t==r&&(t=t.ch?ct(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?ct(t.line,t.ch+1,"before"):t);for(var M=0;M<5;M++){var V=!1,Z=Tn(e,t),ee=!r||r==t?Z:Tn(e,r);u={left:Math.min(Z.left,ee.left),top:Math.min(Z.top,ee.top)-i,right:Math.max(Z.left,ee.left),bottom:Math.max(Z.bottom,ee.bottom)+i};var ie=Oa(e,u),Te=e.doc.scrollTop,Le=e.doc.scrollLeft;if(ie.scrollTop!=null&&(Da(e,ie.scrollTop),Math.abs(e.doc.scrollTop-Te)>1&&(V=!0)),ie.scrollLeft!=null&&(Lr(e,ie.scrollLeft),Math.abs(e.doc.scrollLeft-Le)>1&&(V=!0)),!V)break}return u}function za(e,t){var r=Oa(e,t);r.scrollTop!=null&&Da(e,r.scrollTop),r.scrollLeft!=null&&Lr(e,r.scrollLeft)}function Oa(e,t){var r=e.display,i=Si(e.display);t.top<0&&(t.top=0);var u=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,M=ne(e),V={};t.bottom-t.top>M&&(t.bottom=t.top+M);var Z=e.doc.height+me(r),ee=t.top<i,ie=t.bottom>Z-i;if(t.top<u)V.scrollTop=ee?0:t.top;else if(t.bottom>u+M){var Te=Math.min(t.top,(ie?Z:t.bottom)-M);Te!=u&&(V.scrollTop=Te)}var Le=e.options.fixedGutter?0:r.gutters.offsetWidth,Xe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-Le,Ve=ge(e)-r.gutters.offsetWidth,gt=t.right-t.left>Ve;return gt&&(t.right=t.left+Ve),t.left<10?V.scrollLeft=0:t.left<Xe?V.scrollLeft=Math.max(0,t.left+Le-(gt?0:10)):t.right>Ve+Xe-3&&(V.scrollLeft=t.right+(gt?0:10)-Ve),V}function Va(e,t){if(t==null)return;Ya(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function ya(e){Ya(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Aa(e,t,r){(t!=null||r!=null)&&Ya(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function ho(e,t){Ya(e),e.curOp.scrollToPos=t}function Ya(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=St(e,t.from),i=St(e,t.to);Ra(e,r,i,t.margin)}}function Ra(e,t,r,i){var u=Oa(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});Aa(e,u.scrollLeft,u.scrollTop)}function Da(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;P||Fa(e,{top:t}),_a(e,t,!0),P&&Fa(e),Na(e,100)}function _a(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 Lr(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,mi(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function ha(e){var t=e.display,r=t.gutters.offsetWidth,i=Math.round(e.doc.height+me(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+Pe(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var fa=function(e,t,r){this.cm=r;var i=this.vert=h("div",[h("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),u=this.horiz=h("div",[h("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=u.tabIndex=-1,e(i),e(u),it(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),it(u,"scroll",function(){u.clientWidth&&t(u.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,H&&I<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};fa.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 u=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+u)+"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 M=e.viewWidth-e.barLeft-(r?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+M)+"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}},fa.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},fa.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},fa.prototype.zeroWidthHack=function(){var e=o&&!l?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new J,this.disableVert=new J},fa.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function i(){var u=e.getBoundingClientRect(),M=r=="vert"?document.elementFromPoint(u.right-1,(u.top+u.bottom)/2):document.elementFromPoint((u.right+u.left)/2,u.bottom-1);M!=e?e.style.pointerEvents="none":t.set(1e3,i)}t.set(1e3,i)},fa.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ba=function(){};ba.prototype.update=function(){return{bottom:0,right:0}},ba.prototype.setScrollLeft=function(){},ba.prototype.setScrollTop=function(){},ba.prototype.clear=function(){};function pa(e,t){t||(t=ha(e));var r=e.display.barWidth,i=e.display.barHeight;Xa(e,t);for(var u=0;u<4&&r!=e.display.barWidth||i!=e.display.barHeight;u++)r!=e.display.barWidth&&e.options.lineWrapping&&wa(e),Xa(e,ha(e)),r=e.display.barWidth,i=e.display.barHeight}function Xa(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 $a={native:fa,null:ba};function Qa(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&_(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new $a[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),it(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"?Lr(e,t):Da(e,t)},e),e.display.scrollbars.addClass&&N(e.display.wrapper,e.display.scrollbars.addClass)}var Pa=0;function sa(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:++Pa},Bn(e.curOp)}function Ea(e){var t=e.curOp;t&&kn(t,function(r){for(var i=0;i<r.ops.length;i++)r.ops[i].cm.curOp=null;io(r)})}function io(e){for(var t=e.ops,r=0;r<t.length;r++)Ro(t[r]);for(var i=0;i<t.length;i++)Do(t[i]);for(var u=0;u<t.length;u++)fo(t[u]);for(var M=0;M<t.length;M++)ro(t[M]);for(var V=0;V<t.length;V++)po(t[V])}function Ro(e){var t=e.cm,r=t.display;ao(t),e.updateMaxLine&&pn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Zr(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Do(e){e.updatedDisplay=e.mustUpdate&&xa(e.cm,e.update)}function fo(e){var t=e.cm,r=t.display;e.updatedDisplay&&wa(t),e.barMeasure=ha(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ce(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+Pe(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-ge(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function ro(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Lr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==j();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&pa(t,e.barMeasure),e.updatedDisplay&&Fi(t,e.barMeasure),e.selectionChanged&&vr(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&ka(e.cm)}function po(e){var t=e.cm,r=t.display,i=t.doc;if(e.updatedDisplay&&Ja(t,e.update),r.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(r.wheelStartX=r.wheelStartY=null),e.scrollTop!=null&&_a(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Lr(t,e.scrollLeft,!0,!0),e.scrollToPos){var u=Ao(t,v(i,e.scrollToPos.from),v(i,e.scrollToPos.to),e.scrollToPos.margin);co(t,u)}var M=e.maybeHiddenMarkers,V=e.maybeUnhiddenMarkers;if(M)for(var Z=0;Z<M.length;++Z)M[Z].lines.length||qe(M[Z],"hide");if(V)for(var ee=0;ee<V.length;++ee)V[ee].lines.length&&qe(V[ee],"unhide");r.wrapper.offsetHeight&&(i.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&qe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function jr(e,t){if(e.curOp)return t();sa(e);try{return t()}finally{Ea(e)}}function cr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);sa(e);try{return t.apply(e,arguments)}finally{Ea(e)}}}function Sr(e){return function(){if(this.curOp)return e.apply(this,arguments);sa(this);try{return e.apply(this,arguments)}finally{Ea(this)}}}function dr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);sa(t);try{return e.apply(this,arguments)}finally{Ea(t)}}}function Na(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,k(mo,e))}function mo(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var r=+new Date+e.options.workTime,i=Ot(e,t.highlightFrontier),u=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),function(M){if(i.line>=e.display.viewFrom){var V=M.styles,Z=M.text.length>e.options.maxHighlightLength?Bt(t.mode,i.state):null,ee=be(e,M,i,!0);Z&&(i.state=Z),M.styles=ee.styles;var ie=M.styleClasses,Te=ee.classes;Te?M.styleClasses=Te:ie&&(M.styleClasses=null);for(var Le=!V||V.length!=M.styles.length||ie!=Te&&(!ie||!Te||ie.bgClass!=Te.bgClass||ie.textClass!=Te.textClass),Xe=0;!Le&&Xe<V.length;++Xe)Le=V[Xe]!=M.styles[Xe];Le&&u.push(i.line),M.stateAfter=i.save(),i.nextLine()}else M.text.length<=e.options.maxHighlightLength&&Ct(e,M.text,i),M.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>r)return Na(e,e.options.workDelay),!0}),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),u.length&&jr(e,function(){for(var M=0;M<u.length;M++)Vi(e,u[M],"text")})}var Zr=function(e,t,r){var i=e.display;this.viewport=t,this.visible=Ma(i,e.doc,t),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=ge(e),this.force=r,this.dims=Mn(e),this.events=[]};Zr.prototype.signal=function(e,t){Ae(e,t)&&this.events.push(arguments)},Zr.prototype.finish=function(){for(var e=0;e<this.events.length;e++)qe.apply(null,this.events[e])};function ao(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Pe(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Pe(e)+"px",t.scrollbarsClipped=!0)}function oo(e){if(e.hasFocus())return null;var t=j();if(!t||!T(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&T(e.display.lineDiv,i.anchorNode)&&(r.anchorNode=i.anchorNode,r.anchorOffset=i.anchorOffset,r.focusNode=i.focusNode,r.focusOffset=i.focusOffset)}return r}function so(e){if(!e||!e.activeElt||e.activeElt==j())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&T(document.body,e.anchorNode)&&T(document.body,e.focusNode)){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}function xa(e,t){var r=e.display,i=e.doc;if(t.editorIsHidden)return Ji(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&aa(e)==0)return!1;ar(e)&&(Ji(e),t.dims=Mn(e));var u=i.first+i.size,M=Math.max(t.visible.from-e.options.viewportMargin,i.first),V=Math.min(u,t.visible.to+e.options.viewportMargin);r.viewFrom<M&&M-r.viewFrom<20&&(M=Math.max(i.first,r.viewFrom)),r.viewTo>V&&r.viewTo-V<20&&(V=Math.min(u,r.viewTo)),wi&&(M=Lt(e.doc,M),V=bt(e.doc,V));var Z=M!=r.viewFrom||V!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;da(e,M,V),r.viewOffset=rn(Pt(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var ee=aa(e);if(!Z&&ee==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var ie=oo(e);return ee>4&&(r.lineDiv.style.display="none"),go(e,r.updateLineNumbers,t.dims),ee>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,so(ie),S(r.cursorDiv),S(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,Z&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Na(e,400)),r.updateLineNumbers=null,!0}function Ja(e,t){for(var r=t.viewport,i=!0;;i=!1){if(!i||!e.options.lineWrapping||t.oldDisplayWidth==ge(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+me(e.display)-ne(e),r.top)}),t.visible=Ma(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else i&&(t.visible=Ma(e.display,e.doc,r));if(!xa(e,t))break;wa(e);var u=ha(e);Gi(e),pa(e,u),Fi(e,u),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 Fa(e,t){var r=new Zr(e,t);if(xa(e,r)){wa(e),Ja(e,r);var i=ha(e);Gi(e),pa(e,i),Fi(e,i),r.finish()}}function go(e,t,r){var i=e.display,u=e.options.lineNumbers,M=i.lineDiv,V=M.firstChild;function Z(gt){var Rt=gt.nextSibling;return F&&o&&e.display.currentWheelTarget==gt?gt.style.display="none":gt.parentNode.removeChild(gt),Rt}for(var ee=i.view,ie=i.viewFrom,Te=0;Te<ee.length;Te++){var Le=ee[Te];if(!Le.hidden)if(!Le.node||Le.node.parentNode!=M){var Xe=wr(e,Le,ie,r);M.insertBefore(Xe,V)}else{for(;V!=Le.node;)V=Z(V);var Ve=u&&t!=null&&t<=ie&&Le.lineNumber;Le.changes&&(oe(Le.changes,"gutter")>-1&&(Ve=!1),er(e,Le,ie,r)),Ve&&(S(Le.lineNumber),Le.lineNumber.appendChild(document.createTextNode(Pi(e.options,ie)))),V=Le.node.nextSibling}ie+=Le.size}for(;V;)V=Z(V)}function Za(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Fi(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+Pe(e)+"px"}function mi(e){var t=e.display,r=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var i=or(t)-t.scroller.scrollLeft+e.doc.scrollLeft,u=t.gutters.offsetWidth,M=i+"px",V=0;V<r.length;V++)if(!r[V].hidden){e.options.fixedGutter&&(r[V].gutter&&(r[V].gutter.style.left=M),r[V].gutterBackground&&(r[V].gutterBackground.style.left=M));var Z=r[V].alignable;if(Z)for(var ee=0;ee<Z.length;ee++)Z[ee].style.left=M}e.options.fixedGutter&&(t.gutters.style.left=i+u+"px")}function ar(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=Pi(e.options,t.first+t.size-1),i=e.display;if(r.length!=i.lineNumChars){var u=i.measure.appendChild(h("div",[h("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),M=u.firstChild.offsetWidth,V=u.offsetWidth-M;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(M,i.lineGutter.offsetWidth-V)+1,i.lineNumWidth=i.lineNumInnerWidth+V,i.lineNumChars=i.lineNumInnerWidth?r.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Za(e.display),!0}return!1}function Fr(e,t){for(var r=[],i=!1,u=0;u<e.length;u++){var M=e[u],V=null;if(typeof M!="string"&&(V=M.style,M=M.className),M=="CodeMirror-linenumbers")if(t)i=!0;else continue;r.push({className:M,style:V})}return t&&!i&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function La(e){var t=e.gutters,r=e.gutterSpecs;S(t),e.lineGutter=null;for(var i=0;i<r.length;++i){var u=r[i],M=u.className,V=u.style,Z=t.appendChild(h("div",null,"CodeMirror-gutter "+M));V&&(Z.style.cssText=V),M=="CodeMirror-linenumbers"&&(e.lineGutter=Z,Z.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Za(e)}function la(e){La(e.display),Ki(e),mi(e)}function Ua(e,t,r,i){var u=this;this.input=r,u.scrollbarFiller=h("div",null,"CodeMirror-scrollbar-filler"),u.scrollbarFiller.setAttribute("cm-not-content","true"),u.gutterFiller=h("div",null,"CodeMirror-gutter-filler"),u.gutterFiller.setAttribute("cm-not-content","true"),u.lineDiv=E("div",null,"CodeMirror-code"),u.selectionDiv=h("div",null,null,"position: relative; z-index: 1"),u.cursorDiv=h("div",null,"CodeMirror-cursors"),u.measure=h("div",null,"CodeMirror-measure"),u.lineMeasure=h("div",null,"CodeMirror-measure"),u.lineSpace=E("div",[u.measure,u.lineMeasure,u.selectionDiv,u.cursorDiv,u.lineDiv],null,"position: relative; outline: none");var M=E("div",[u.lineSpace],"CodeMirror-lines");u.mover=h("div",[M],null,"position: relative"),u.sizer=h("div",[u.mover],"CodeMirror-sizer"),u.sizerWidth=null,u.heightForcer=h("div",null,null,"position: absolute; height: "+fe+"px; width: 1px;"),u.gutters=h("div",null,"CodeMirror-gutters"),u.lineGutter=null,u.scroller=h("div",[u.sizer,u.heightForcer,u.gutters],"CodeMirror-scroll"),u.scroller.setAttribute("tabIndex","-1"),u.wrapper=h("div",[u.scrollbarFiller,u.gutterFiller,u.scroller],"CodeMirror"),H&&I<8&&(u.gutters.style.zIndex=-1,u.scroller.style.paddingRight=0),!F&&!(P&&a)&&(u.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(u.wrapper):e(u.wrapper)),u.viewFrom=u.viewTo=t.first,u.reportedViewFrom=u.reportedViewTo=t.first,u.view=[],u.renderedView=null,u.externalMeasured=null,u.viewOffset=0,u.lastWrapHeight=u.lastWrapWidth=0,u.updateLineNumbers=null,u.nativeBarWidth=u.barHeight=u.barWidth=0,u.scrollbarsClipped=!1,u.lineNumWidth=u.lineNumInnerWidth=u.lineNumChars=null,u.alignWidgets=!1,u.cachedCharWidth=u.cachedTextHeight=u.cachedPaddingH=null,u.maxLine=null,u.maxLineLength=0,u.maxLineChanged=!1,u.wheelDX=u.wheelDY=u.wheelStartX=u.wheelStartY=null,u.shift=!1,u.selForContextMenu=null,u.activeTouch=null,u.gutterSpecs=Fr(i.gutters,i.lineNumbers),La(u),r.init(u)}var ua=0,yr=null;H?yr=-.53:P?yr=15:g?yr=-.7:d&&(yr=-1/3);function Ba(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),r==null&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:r==null&&(r=e.wheelDelta),{x:t,y:r}}function ja(e){var t=Ba(e);return t.x*=yr,t.y*=yr,t}function Ha(e,t){var r=Ba(t),i=r.x,u=r.y,M=e.display,V=M.scroller,Z=V.scrollWidth>V.clientWidth,ee=V.scrollHeight>V.clientHeight;if(!(i&&Z||u&&ee))return;if(u&&o&&F){e:for(var ie=t.target,Te=M.view;ie!=V;ie=ie.parentNode)for(var Le=0;Le<Te.length;Le++)if(Te[Le].node==ie){e.display.currentWheelTarget=ie;break e}}if(i&&!P&&!p&&yr!=null){u&&ee&&Da(e,Math.max(0,V.scrollTop+u*yr)),Lr(e,Math.max(0,V.scrollLeft+i*yr)),(!u||u&&ee)&&se(t),M.wheelStartX=null;return}if(u&&yr!=null){var Xe=u*yr,Ve=e.doc.scrollTop,gt=Ve+M.wrapper.clientHeight;Xe<0?Ve=Math.max(0,Ve+Xe-50):gt=Math.min(e.doc.height,gt+Xe+50),Fa(e,{top:Ve,bottom:gt})}ua<20&&(M.wheelStartX==null?(M.wheelStartX=V.scrollLeft,M.wheelStartY=V.scrollTop,M.wheelDX=i,M.wheelDY=u,setTimeout(function(){if(M.wheelStartX==null)return;var Rt=V.scrollLeft-M.wheelStartX,Ut=V.scrollTop-M.wheelStartY,en=Ut&&M.wheelDY&&Ut/M.wheelDY||Rt&&M.wheelDX&&Rt/M.wheelDX;if(M.wheelStartX=M.wheelStartY=null,!en)return;yr=(yr*ua+en)/(ua+1),++ua},200)):(M.wheelDX+=i,M.wheelDY+=u))}var Hr=function(e,t){this.ranges=e,this.primIndex=t};Hr.prototype.primary=function(){return this.ranges[this.primIndex]},Hr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],i=e.ranges[t];if(!Ei(r.anchor,i.anchor)||!Ei(r.head,i.head))return!1}return!0},Hr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new ki(ji(this.ranges[t].anchor),ji(this.ranges[t].head));return new Hr(e,this.primIndex)},Hr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Hr.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var i=this.ranges[r];if(Zt(t,i.from())>=0&&Zt(e,i.to())<=0)return r}return-1};var ki=function(e,t){this.anchor=e,this.head=t};ki.prototype.from=function(){return ii(this.anchor,this.head)},ki.prototype.to=function(){return ri(this.anchor,this.head)},ki.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function qn(e,t,r){var i=e&&e.options.selectionsMayTouch,u=t[r];t.sort(function(Xe,Ve){return Zt(Xe.from(),Ve.from())}),r=oe(t,u);for(var M=1;M<t.length;M++){var V=t[M],Z=t[M-1],ee=Zt(Z.to(),V.from());if(i&&!V.empty()?ee>0:ee>=0){var ie=ii(Z.from(),V.from()),Te=ri(Z.to(),V.to()),Le=Z.empty()?V.from()==V.head:Z.from()==Z.head;M<=r&&--r,t.splice(--M,2,new ki(Le?Te:ie,Le?ie:Te))}}return new Hr(t,r)}function an(e,t){return new Hr([new ki(e,t||e)],0)}function xn(e){return e.text?ct(e.from.line+e.text.length-1,ae(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function hi(e,t){if(Zt(e,t.from)<0)return e;if(Zt(e,t.to)<=0)return xn(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+=xn(t).ch-t.to.ch),ct(r,i)}function tr(e,t){for(var r=[],i=0;i<e.sel.ranges.length;i++){var u=e.sel.ranges[i];r.push(new ki(hi(u.anchor,t),hi(u.head,t)))}return qn(e.cm,r,e.sel.primIndex)}function ma(e,t,r){return e.line==t.line?ct(r.line,e.ch-t.ch+r.ch):ct(r.line+(e.line-t.line),e.ch)}function ia(e,t,r){for(var i=[],u=ct(e.first,0),M=u,V=0;V<t.length;V++){var Z=t[V],ee=ma(Z.from,u,M),ie=ma(xn(Z),u,M);if(u=Z.to,M=ie,r=="around"){var Te=e.sel.ranges[V],Le=Zt(Te.head,Te.anchor)<0;i[V]=new ki(Le?ie:ee,Le?ee:ie)}else i[V]=new ki(ee,ee)}return new Hr(i,e.sel.primIndex)}function Or(e){e.doc.mode=Hn(e.options,e.doc.modeOption),Yr(e)}function Yr(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Na(e,100),e.state.modeGen++,e.curOp&&Ki(e)}function ga(e,t){return t.from.ch==0&&t.to.ch==0&&ae(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Wa(e,t,r,i){function u(fn){return r?r[fn]:null}function M(fn,tn,_n){In(fn,tn,_n,i),jn(fn,"change",fn,t)}function V(fn,tn){for(var _n=[],$n=fn;$n<tn;++$n)_n.push(new bn(ie[$n],u($n),i));return _n}var Z=t.from,ee=t.to,ie=t.text,Te=Pt(e,Z.line),Le=Pt(e,ee.line),Xe=ae(ie),Ve=u(ie.length-1),gt=ee.line-Z.line;if(t.full)e.insert(0,V(0,ie.length)),e.remove(ie.length,e.size-ie.length);else if(ga(e,t)){var Rt=V(0,ie.length-1);M(Le,Le.text,Ve),gt&&e.remove(Z.line,gt),Rt.length&&e.insert(Z.line,Rt)}else if(Te==Le)if(ie.length==1)M(Te,Te.text.slice(0,Z.ch)+Xe+Te.text.slice(ee.ch),Ve);else{var Ut=V(1,ie.length-1);Ut.push(new bn(Xe+Te.text.slice(ee.ch),Ve,i)),M(Te,Te.text.slice(0,Z.ch)+ie[0],u(0)),e.insert(Z.line+1,Ut)}else if(ie.length==1)M(Te,Te.text.slice(0,Z.ch)+ie[0]+Le.text.slice(ee.ch),u(0)),e.remove(Z.line+1,gt);else{M(Te,Te.text.slice(0,Z.ch)+ie[0],u(0)),M(Le,Xe+Le.text.slice(ee.ch),Ve);var en=V(1,ie.length-1);gt>1&&e.remove(Z.line+1,gt-1),e.insert(Z.line+1,en)}jn(e,"change",e,t)}function xr(e,t,r){function i(u,M,V){if(u.linked)for(var Z=0;Z<u.linked.length;++Z){var ee=u.linked[Z];if(ee.doc==M)continue;var ie=V&&ee.sharedHist;if(r&&!ie)continue;t(ee.doc,ie),i(ee.doc,u,ie)}}i(e,null,!0)}function vs(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Pr(e),Or(e),ys(e),e.options.lineWrapping||pn(e),e.options.mode=t.modeOption,Ki(e)}function ys(e){(e.doc.direction=="rtl"?N:_)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){jr(e,function(){ys(e),Ki(e)})}function Go(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function is(e,t){var r={from:ji(t.from),to:xn(t),text:Mi(e,t.from,t.to)};return Es(e,r,t.from.line,t.to.line+1),xr(e,function(i){return Es(i,r,t.from.line,t.to.line+1)},!0),r}function _s(e){for(;e.length;){var t=ae(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return _s(e.done),ae(e.done);if(e.done.length&&!ae(e.done).ranges)return ae(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),ae(e.done)}function bs(e,t,r,i){var u=e.history;u.undone.length=0;var M=+new Date,V,Z;if((u.lastOp==i||u.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&u.lastModTime>M-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(V=pl(u,u.lastOp==i)))Z=ae(V.changes),Zt(t.from,t.to)==0&&Zt(t.from,Z.to)==0?Z.to=xn(t):V.changes.push(is(e,t));else{var ee=ae(u.done);for((!ee||!ee.ranges)&&zo(e.sel,u.done),V={changes:[is(e,t)],generation:u.generation},u.done.push(V);u.done.length>u.undoDepth;)u.done.shift(),u.done[0].ranges||u.done.shift()}u.done.push(r),u.generation=++u.maxGeneration,u.lastModTime=u.lastSelTime=M,u.lastOp=u.lastSelOp=i,u.lastOrigin=u.lastSelOrigin=t.origin,Z||qe(e,"historyAdded")}function ml(e,t,r,i){var u=t.charAt(0);return u=="*"||u=="+"&&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 u=e.history,M=i&&i.origin;r==u.lastSelOp||M&&u.lastSelOrigin==M&&(u.lastModTime==u.lastSelTime&&u.lastOrigin==M||ml(e,M,ae(u.done),t))?u.done[u.done.length-1]=t:zo(t,u.done),u.lastSelTime=+new Date,u.lastSelOrigin=M,u.lastSelOp=r,i&&i.clearRedo!==!1&&_s(u.undone)}function zo(e,t){var r=ae(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Es(e,t,r,i){var u=t["spans_"+e.id],M=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,i),function(V){V.markedSpans&&((u||(u=t["spans_"+e.id]={}))[M]=V.markedSpans),++M})}function vl(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function yl(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var i=[],u=0;u<t.text.length;++u)i.push(vl(r[u]));return i}function xs(e,t){var r=yl(e,t),i=bi(e,t);if(!r)return i;if(!i)return r;for(var u=0;u<r.length;++u){var M=r[u],V=i[u];if(M&&V){e:for(var Z=0;Z<V.length;++Z){for(var ee=V[Z],ie=0;ie<M.length;++ie)if(M[ie].marker==ee.marker)continue e;M.push(ee)}}else V&&(r[u]=V)}return r}function vo(e,t,r){for(var i=[],u=0;u<e.length;++u){var M=e[u];if(M.ranges){i.push(r?Hr.prototype.deepCopy.call(M):M);continue}var V=M.changes,Z=[];i.push({changes:Z});for(var ee=0;ee<V.length;++ee){var ie=V[ee],Te=void 0;if(Z.push({from:ie.from,to:ie.to,text:ie.text}),t)for(var Le in ie)(Te=Le.match(/^spans_(\d+)$/))&&(oe(t,Number(Te[1]))>-1&&(ae(Z)[Le]=ie[Le],delete ie[Le]))}}return i}function rs(e,t,r,i){if(i){var u=e.anchor;if(r){var M=Zt(t,u)<0;M!=Zt(r,u)<0?(u=t,t=r):M!=Zt(t,r)<0&&(t=r)}return new ki(u,t)}else return new ki(r||t,t)}function Vo(e,t,r,i,u){u==null&&(u=e.cm&&(e.cm.display.shift||e.extend)),zr(e,new Hr([rs(e.sel.primary(),t,r,u)],0),i)}function Ts(e,t,r){for(var i=[],u=e.cm&&(e.cm.display.shift||e.extend),M=0;M<e.sel.ranges.length;M++)i[M]=rs(e.sel.ranges[M],t[M],null,u);var V=qn(e.cm,i,e.sel.primIndex);zr(e,V,r)}function as(e,t,r,i){var u=e.sel.ranges.slice(0);u[t]=r,zr(e,qn(e.cm,u,e.sel.primIndex),i)}function Cs(e,t,r,i){zr(e,an(t,r),i)}function _l(e,t,r){var i={ranges:t.ranges,update:function(u){this.ranges=[];for(var M=0;M<u.length;M++)this.ranges[M]=new ki(v(e,u[M].anchor),v(e,u[M].head))},origin:r&&r.origin};return qe(e,"beforeSelectionChange",e,i),e.cm&&qe(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?qn(e.cm,i.ranges,i.ranges.length-1):t}function ws(e,t,r){var i=e.history.done,u=ae(i);u&&u.ranges?(i[i.length-1]=t,Yo(e,t,r)):zr(e,t,r)}function zr(e,t,r){Yo(e,t,r),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Yo(e,t,r){(Ae(e,"beforeSelectionChange")||e.cm&&Ae(e.cm,"beforeSelectionChange"))&&(t=_l(e,t,r));var i=r&&r.bias||(Zt(t.primary().head,e.sel.primary().head)<0?-1:1);Ss(e,As(e,t,i,!0)),!(r&&r.scroll===!1)&&e.cm&&ya(e.cm)}function Ss(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Be(e.cm)),jn(e,"cursorActivity",e)}function Os(e){Ss(e,As(e,e.sel,null,!1))}function As(e,t,r,i){for(var u,M=0;M<t.ranges.length;M++){var V=t.ranges[M],Z=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[M],ee=Xo(e,V.anchor,Z&&Z.anchor,r,i),ie=Xo(e,V.head,Z&&Z.head,r,i);(u||ee!=V.anchor||ie!=V.head)&&(u||(u=t.ranges.slice(0,M)),u[M]=new ki(ee,ie))}return u?qn(e.cm,u,t.primIndex):t}function yo(e,t,r,i,u){var M=Pt(e,t.line);if(M.markedSpans)for(var V=0;V<M.markedSpans.length;++V){var Z=M.markedSpans[V],ee=Z.marker,ie="selectLeft"in ee?!ee.selectLeft:ee.inclusiveLeft,Te="selectRight"in ee?!ee.selectRight:ee.inclusiveRight;if((Z.from==null||(ie?Z.from<=t.ch:Z.from<t.ch))&&(Z.to==null||(Te?Z.to>=t.ch:Z.to>t.ch))){if(u&&(qe(ee,"beforeCursorEnter"),ee.explicitlyCleared))if(M.markedSpans){--V;continue}else break;if(!ee.atomic)continue;if(r){var Le=ee.find(i<0?1:-1),Xe=void 0;if((i<0?Te:ie)&&(Le=Rs(e,Le,-i,Le&&Le.line==t.line?M:null)),Le&&Le.line==t.line&&(Xe=Zt(Le,r))&&(i<0?Xe<0:Xe>0))return yo(e,Le,t,i,u)}var Ve=ee.find(i<0?-1:1);return(i<0?ie:Te)&&(Ve=Rs(e,Ve,i,Ve.line==t.line?M:null)),Ve?yo(e,Ve,t,i,u):null}}return t}function Xo(e,t,r,i,u){var M=i||1,V=yo(e,t,r,M,u)||!u&&yo(e,t,r,M,!0)||yo(e,t,r,-M,u)||!u&&yo(e,t,r,-M,!0);return V||(e.cantEdit=!0,ct(e.first,0))}function Rs(e,t,r,i){return r<0&&t.ch==0?t.line>e.first?v(e,ct(t.line-1)):null:r>0&&t.ch==(i||Pt(e,t.line)).text.length?t.line<e.first+e.size-1?ct(t.line+1,0):null:new ct(t.line,t.ch+r)}function Ds(e){e.setSelection(ct(e.firstLine(),0),ct(e.lastLine()),_e)}function Ls(e,t,r){var i={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return i.canceled=!0}};return r&&(i.update=function(u,M,V,Z){u&&(i.from=v(e,u)),M&&(i.to=v(e,M)),V&&(i.text=V),Z!==void 0&&(i.origin=Z)}),qe(e,"beforeChange",e,i),e.cm&&qe(e.cm,"beforeChange",e.cm,i),i.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function _o(e,t,r){if(e.cm){if(!e.cm.curOp)return cr(e.cm,_o)(e,t,r);if(e.cm.state.suppressEdits)return}if((Ae(e,"beforeChange")||e.cm&&Ae(e.cm,"beforeChange"))&&(t=Ls(e,t,!0),!t))return;var i=rr&&!r&&pe(e,t.from,t.to);if(i)for(var u=i.length-1;u>=0;--u)Is(e,{from:i[u].from,to:i[u].to,text:u?[""]:t.text,origin:t.origin});else Is(e,t)}function Is(e,t){if(t.text.length==1&&t.text[0]==""&&Zt(t.from,t.to)==0)return;var r=tr(e,t);bs(e,t,r,e.cm?e.cm.curOp.id:NaN),Lo(e,t,r,bi(e,t));var i=[];xr(e,function(u,M){!M&&oe(i,u.history)==-1&&(Ns(u.history,t),i.push(u.history)),Lo(u,t,null,bi(u,t))})}function $o(e,t,r){var i=e.cm&&e.cm.state.suppressEdits;if(i&&!r)return;for(var u=e.history,M,V=e.sel,Z=t=="undo"?u.done:u.undone,ee=t=="undo"?u.undone:u.done,ie=0;ie<Z.length&&!(M=Z[ie],r?M.ranges&&!M.equals(e.sel):!M.ranges);ie++);if(ie==Z.length)return;for(u.lastOrigin=u.lastSelOrigin=null;;)if(M=Z.pop(),M.ranges){if(zo(M,ee),r&&!M.equals(e.sel)){zr(e,M,{clearRedo:!1});return}V=M}else if(i){Z.push(M);return}else break;var Te=[];zo(V,ee),ee.push({changes:Te,generation:u.generation}),u.generation=M.generation||++u.maxGeneration;for(var Le=Ae(e,"beforeChange")||e.cm&&Ae(e.cm,"beforeChange"),Xe=function(Rt){var Ut=M.changes[Rt];if(Ut.origin=t,Le&&!Ls(e,Ut,!1))return Z.length=0,{};Te.push(is(e,Ut));var en=Rt?tr(e,Ut):ae(Z);Lo(e,Ut,en,xs(e,Ut)),!Rt&&e.cm&&e.cm.scrollIntoView({from:Ut.from,to:xn(Ut)});var fn=[];xr(e,function(tn,_n){!_n&&oe(fn,tn.history)==-1&&(Ns(tn.history,Ut),fn.push(tn.history)),Lo(tn,Ut,null,xs(tn,Ut))})},Ve=M.changes.length-1;Ve>=0;--Ve){var gt=Xe(Ve);if(gt)return gt.v}}function ks(e,t){if(t==0)return;if(e.first+=t,e.sel=new Hr(Ee(e.sel.ranges,function(u){return new ki(ct(u.anchor.line+t,u.anchor.ch),ct(u.head.line+t,u.head.ch))}),e.sel.primIndex),e.cm){Ki(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,i=r.viewFrom;i<r.viewTo;i++)Vi(e.cm,i,"gutter")}}function Lo(e,t,r,i){if(e.cm&&!e.cm.curOp)return cr(e.cm,Lo)(e,t,r,i);if(t.to.line<e.first){ks(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var u=t.text.length-1-(e.first-t.from.line);ks(e,u),t={from:ct(e.first,0),to:ct(t.to.line+u,t.to.ch),text:[ae(t.text)],origin:t.origin}}var M=e.lastLine();t.to.line>M&&(t={from:t.from,to:ct(M,Pt(e,M).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mi(e,t.from,t.to),r||(r=tr(e,t)),e.cm?bl(e.cm,t,i):Wa(e,t,i),Yo(e,r,_e),e.cantEdit&&Xo(e,ct(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,r){var i=e.doc,u=e.display,M=t.from,V=t.to,Z=!1,ee=M.line;e.options.lineWrapping||(ee=vn(nt(Pt(i,M.line))),i.iter(ee,V.line+1,function(Ve){if(Ve==u.maxLine)return Z=!0,!0})),i.sel.contains(t.from,t.to)>-1&&Be(e),Wa(i,t,r,$r(e)),e.options.lineWrapping||(i.iter(ee,M.line+t.text.length,function(Ve){var gt=ti(Ve);gt>u.maxLineLength&&(u.maxLine=Ve,u.maxLineLength=gt,u.maxLineChanged=!0,Z=!1)}),Z&&(e.curOp.updateMaxLine=!0)),sr(i,M.line),Na(e,400);var ie=t.text.length-(V.line-M.line)-1;t.full?Ki(e):M.line==V.line&&t.text.length==1&&!ga(e.doc,t)?Vi(e,M.line,"text"):Ki(e,M.line,V.line+1,ie);var Te=Ae(e,"changes"),Le=Ae(e,"change");if(Le||Te){var Xe={from:M,to:V,text:t.text,removed:t.removed,origin:t.origin};Le&&jn(e,"change",e,Xe),Te&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Xe)}e.display.selForContextMenu=null}function bo(e,t,r,i,u){var M;i||(i=r),Zt(i,r)<0&&(M=[i,r],r=M[0],i=M[1]),typeof t=="string"&&(t=e.splitLines(t)),_o(e,{from:r,to:i,text:t,origin:u})}function Ms(e,t,r,i){r<e.line?e.line+=i:t<e.line&&(e.line=t,e.ch=0)}function Ps(e,t,r,i){for(var u=0;u<e.length;++u){var M=e[u],V=!0;if(M.ranges){M.copied||(M=e[u]=M.deepCopy(),M.copied=!0);for(var Z=0;Z<M.ranges.length;Z++)Ms(M.ranges[Z].anchor,t,r,i),Ms(M.ranges[Z].head,t,r,i);continue}for(var ee=0;ee<M.changes.length;++ee){var ie=M.changes[ee];if(r<ie.from.line)ie.from=ct(ie.from.line+i,ie.from.ch),ie.to=ct(ie.to.line+i,ie.to.ch);else if(t<=ie.to.line){V=!1;break}}V||(e.splice(0,u+1),u=0)}}function Ns(e,t){var r=t.from.line,i=t.to.line,u=t.text.length-(i-r)-1;Ps(e.done,r,i,u),Ps(e.undone,r,i,u)}function Io(e,t,r,i){var u=t,M=t;return typeof t=="number"?M=Pt(e,X(e,t)):u=vn(t),u==null?null:(i(M,u)&&e.cm&&Vi(e.cm,u,r),M)}function ko(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}ko.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,i=e+t;r<i;++r){var u=this.lines[r];this.height-=u.height,At(u),jn(u,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=this},iterN:function(e,t,r){for(var i=e+t;e<i;++e)if(r(this.lines[e]))return!0}};function Mo(e){this.children=e;for(var t=0,r=0,i=0;i<e.length;++i){var u=e[i];t+=u.chunkSize(),r+=u.height,u.parent=this}this.size=t,this.height=r,this.parent=null}Mo.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var i=this.children[r],u=i.chunkSize();if(e<u){var M=Math.min(t,u-e),V=i.height;if(i.removeInner(e,M),this.height-=V-i.height,u==M&&(this.children.splice(r--,1),i.parent=null),(t-=M)==0)break;e=0}else e-=u}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof ko))){var Z=[];this.collapse(Z),this.children=[new ko(Z)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var i=0;i<this.children.length;++i){var u=this.children[i],M=u.chunkSize();if(e<=M){if(u.insertInner(e,t,r),u.lines&&u.lines.length>50){for(var V=u.lines.length%25+25,Z=V;Z<u.lines.length;){var ee=new ko(u.lines.slice(Z,Z+=25));u.height-=ee.height,this.children.splice(++i,0,ee),ee.parent=this}u.lines=u.lines.slice(0,V),this.maybeSpill()}break}e-=M}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Mo(t);if(e.parent){e.size-=r.size,e.height-=r.height;var u=oe(e.parent.children,e);e.parent.children.splice(u+1,0,r)}else{var i=new Mo(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var i=0;i<this.children.length;++i){var u=this.children[i],M=u.chunkSize();if(e<M){var V=Math.min(t,M-e);if(u.iterN(e,V,r))return!0;if((t-=V)==0)break;e=0}else e-=M}}};var Po=function(e,t,r){if(r)for(var i in r)r.hasOwnProperty(i)&&(this[i]=r[i]);this.doc=e,this.node=t};Po.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,i=vn(r);if(i==null||!t)return;for(var u=0;u<t.length;++u)t[u]==this&&t.splice(u--,1);t.length||(r.widgets=null);var M=br(this);ui(r,Math.max(0,r.height-M)),e&&(jr(e,function(){Fs(e,r,-M),Vi(e,i,"widget")}),jn(e,"lineWidgetCleared",e,this,i))},Po.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,i=this.line;this.height=null;var u=br(this)-t;if(!u)return;Nt(this.doc,i)||ui(i,i.height+u),r&&jr(r,function(){r.curOp.forceUpdate=!0,Fs(r,i,u),jn(r,"lineWidgetChanged",r,e,vn(i))})},Ie(Po);function Fs(e,t,r){rn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Va(e,r)}function El(e,t,r,i){var u=new Po(e,r,i),M=e.cm;return M&&u.noHScroll&&(M.display.alignWidgets=!0),Io(e,t,"widget",function(V){var Z=V.widgets||(V.widgets=[]);if(u.insertAt==null?Z.push(u):Z.splice(Math.min(Z.length-1,Math.max(0,u.insertAt)),0,u),u.line=V,M&&!Nt(e,V)){var ee=rn(V)<e.scrollTop;ui(V,V.height+br(u)),ee&&Va(M,u.height),M.curOp.forceUpdate=!0}return!0}),M&&jn(M,"lineWidgetAdded",M,u,typeof t=="number"?t:vn(t)),u}var Us=0,qa=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Us};qa.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&sa(e),Ae(this,"clear")){var r=this.find();r&&jn(this,"clear",r.from,r.to)}for(var i=null,u=null,M=0;M<this.lines.length;++M){var V=this.lines[M],Z=on(V.markedSpans,this);e&&!this.collapsed?Vi(e,vn(V),"text"):e&&(Z.to!=null&&(u=vn(V)),Z.from!=null&&(i=vn(V))),V.markedSpans=ci(V.markedSpans,Z),Z.from==null&&this.collapsed&&!Nt(this.doc,V)&&e&&ui(V,Si(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var ee=0;ee<this.lines.length;++ee){var ie=nt(this.lines[ee]),Te=ti(ie);Te>e.display.maxLineLength&&(e.display.maxLine=ie,e.display.maxLineLength=Te,e.display.maxLineChanged=!0)}i!=null&&e&&this.collapsed&&Ki(e,i,u+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Os(e.doc)),e&&jn(e,"markerCleared",e,this,i,u),t&&Ea(e),this.parent&&this.parent.clear()},qa.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,i,u=0;u<this.lines.length;++u){var M=this.lines[u],V=on(M.markedSpans,this);if(V.from!=null&&(r=ct(t?M:vn(M),V.from),e==-1))return r;if(V.to!=null&&(i=ct(t?M:vn(M),V.to),e==1))return i}return r&&{from:r,to:i}},qa.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,i=this.doc.cm;if(!t||!i)return;jr(i,function(){var u=t.line,M=vn(t.line),V=He(i,M);if(V&&(Dn(V),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!Nt(r.doc,u)&&r.height!=null){var Z=r.height;r.height=null;var ee=br(r)-Z;ee&&ui(u,u.height+ee)}jn(i,"markerChanged",i,e)})},qa.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||oe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},qa.prototype.detachLine=function(e){if(this.lines.splice(oe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Ie(qa);function Eo(e,t,r,i,u){if(i&&i.shared)return xl(e,t,r,i,u);if(e.cm&&!e.cm.curOp)return cr(e.cm,Eo)(e,t,r,i,u);var M=new qa(e,u),V=Zt(t,r);if(i&&b(i,M,!1),V>0||V==0&&M.clearWhenEmpty!==!1)return M;if(M.replacedWith&&(M.collapsed=!0,M.widgetNode=E("span",[M.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||M.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(M.widgetNode.insertLeft=!0)),M.collapsed){if(lt(e,t.line,t,r,M)||t.line!=r.line&<(e,r.line,t,r,M))throw new Error("Inserting collapsed marker partially overlapping an existing one");mr()}M.addToHistory&&bs(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var Z=t.line,ee=e.cm,ie;if(e.iter(Z,r.line+1,function(Le){ee&&M.collapsed&&!ee.options.lineWrapping&&nt(Le)==ee.display.maxLine&&(ie=!0),M.collapsed&&Z!=t.line&&ui(Le,0),Qt(Le,new ai(M,Z==t.line?t.ch:null,Z==r.line?r.ch:null)),++Z}),M.collapsed&&e.iter(t.line,r.line+1,function(Le){Nt(e,Le)&&ui(Le,0)}),M.clearOnEnter&&it(M,"beforeCursorEnter",function(){return M.clear()}),M.readOnly&&(lr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),M.collapsed&&(M.id=++Us,M.atomic=!0),ee){if(ie&&(ee.curOp.updateMaxLine=!0),M.collapsed)Ki(ee,t.line,r.line+1);else if(M.className||M.startStyle||M.endStyle||M.css||M.attributes||M.title)for(var Te=t.line;Te<=r.line;Te++)Vi(ee,Te,"text");M.atomic&&Os(ee.doc),jn(ee,"markerAdded",ee,M)}return M}var No=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};No.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();jn(this,"clear")},No.prototype.find=function(e,t){return this.primary.find(e,t)},Ie(No);function xl(e,t,r,i,u){i=b(i),i.shared=!1;var M=[Eo(e,t,r,i,u)],V=M[0],Z=i.widgetNode;return xr(e,function(ee){Z&&(i.widgetNode=Z.cloneNode(!0)),M.push(Eo(ee,v(ee,t),v(ee,r),i,u));for(var ie=0;ie<ee.linked.length;++ie)if(ee.linked[ie].isParent)return;V=ae(M)}),new No(M,V)}function Bs(e){return e.findMarks(ct(e.first,0),e.clipPos(ct(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var r=0;r<t.length;r++){var i=t[r],u=i.find(),M=e.clipPos(u.from),V=e.clipPos(u.to);if(Zt(M,V)){var Z=Eo(e,M,V,i.primary,i.primary.type);i.markers.push(Z),Z.parent=i}}}function Cl(e){for(var t=function(i){var u=e[i],M=[u.primary.doc];xr(u.primary.doc,function(ee){return M.push(ee)});for(var V=0;V<u.markers.length;V++){var Z=u.markers[V];oe(M,Z.doc)==-1&&(Z.parent=null,u.markers.splice(V--,1))}},r=0;r<e.length;r++)t(r)}var wl=0,qr=function(e,t,r,i,u){if(!(this instanceof qr))return new qr(e,t,r,i,u);r==null&&(r=0),Mo.call(this,[new ko([new bn("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var M=ct(r,0);this.sel=an(M),this.history=new Go(null),this.id=++wl,this.modeOption=t,this.lineSep=i,this.direction=u=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Wa(this,{from:M,to:M,text:e}),zr(this,an(M),_e)};qr.prototype=Je(Mo.prototype,{constructor:qr,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,i=0;i<t.length;++i)r+=t[i].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=$i(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:dr(function(e){var t=ct(this.first,0),r=this.first+this.size-1;_o(this,{from:t,to:ct(r,Pt(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Aa(this.cm,0,0),zr(this,an(t),_e)}),replaceRange:function(e,t,r,i){t=v(this,t),r=r?v(this,r):t,bo(this,e,t,r,i)},getRange:function(e,t,r){var i=Mi(this,v(this,e),v(this,t));return r===!1?i:i.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Ai(this,e))return Pt(this,e)},getLineNumber:function(e){return vn(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Pt(this,e)),nt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return v(this,e)},getCursor:function(e){var t=this.sel.primary(),r;return e==null||e=="head"?r=t.head:e=="anchor"?r=t.anchor:e=="end"||e=="to"||e===!1?r=t.to():r=t.from(),r},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:dr(function(e,t,r){Cs(this,v(this,typeof e=="number"?ct(e,t||0):e),null,r)}),setSelection:dr(function(e,t,r){Cs(this,v(this,e),v(this,t||e),r)}),extendSelection:dr(function(e,t,r){Vo(this,v(this,e),t&&v(this,t),r)}),extendSelections:dr(function(e,t){Ts(this,B(this,e),t)}),extendSelectionsBy:dr(function(e,t){var r=Ee(this.sel.ranges,e);Ts(this,B(this,r),t)}),setSelections:dr(function(e,t,r){if(!e.length)return;for(var i=[],u=0;u<e.length;u++)i[u]=new ki(v(this,e[u].anchor),v(this,e[u].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),zr(this,qn(this.cm,i,t),r)}),addSelection:dr(function(e,t,r){var i=this.sel.ranges.slice(0);i.push(new ki(v(this,e),v(this,t||e))),zr(this,qn(this.cm,i,i.length-1),r)}),getSelection:function(e){for(var t=this.sel.ranges,r,i=0;i<t.length;i++){var u=Mi(this,t[i].from(),t[i].to());r=r?r.concat(u):u}return e===!1?r:r.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,i=0;i<r.length;i++){var u=Mi(this,r[i].from(),r[i].to());e!==!1&&(u=u.join(e||this.lineSeparator())),t[i]=u}return t},replaceSelection:function(e,t,r){for(var i=[],u=0;u<this.sel.ranges.length;u++)i[u]=e;this.replaceSelections(i,t,r||"+input")},replaceSelections:dr(function(e,t,r){for(var i=[],u=this.sel,M=0;M<u.ranges.length;M++){var V=u.ranges[M];i[M]={from:V.from(),to:V.to(),text:this.splitLines(e[M]),origin:r}}for(var Z=t&&t!="end"&&ia(this,i,t),ee=i.length-1;ee>=0;ee--)_o(this,i[ee]);Z?ws(this,Z):this.cm&&ya(this.cm)}),undo:dr(function(){$o(this,"undo")}),redo:dr(function(){$o(this,"redo")}),undoSelection:dr(function(){$o(this,"undo",!0)}),redoSelection:dr(function(){$o(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.done.length;i++)e.done[i].ranges||++t;for(var u=0;u<e.undone.length;u++)e.undone[u].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new Go(this.history.maxGeneration),xr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:vo(this.history.done),undone:vo(this.history.undone)}},setHistory:function(e){var t=this.history=new Go(this.history.maxGeneration);t.done=vo(e.done.slice(0),null,!0),t.undone=vo(e.undone.slice(0),null,!0)},setGutterMarker:dr(function(e,t,r){return Io(this,e,"gutter",function(i){var u=i.gutterMarkers||(i.gutterMarkers={});return u[t]=r,!r&&st(u)&&(i.gutterMarkers=null),!0})}),clearGutter:dr(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&Io(t,r,"gutter",function(){return r.gutterMarkers[e]=null,st(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Ai(this,e))return null;if(t=e,e=Pt(this,e),!e)return null}else if(t=vn(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:dr(function(e,t,r){return Io(this,e,t=="gutter"?"gutter":"class",function(i){var u=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!i[u])i[u]=r;else{if(w(r).test(i[u]))return!1;i[u]+=" "+r}return!0})}),removeLineClass:dr(function(e,t,r){return Io(this,e,t=="gutter"?"gutter":"class",function(i){var u=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",M=i[u];if(M)if(r==null)i[u]=null;else{var V=M.match(w(r));if(!V)return!1;var Z=V.index+V[0].length;i[u]=M.slice(0,V.index)+(!V.index||Z==M.length?"":" ")+M.slice(Z)||null}else return!1;return!0})}),addLineWidget:dr(function(e,t,r){return El(this,e,t,r)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return Eo(this,v(this,e),v(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=v(this,e),Eo(this,e,e,r,"bookmark")},findMarksAt:function(e){e=v(this,e);var t=[],r=Pt(this,e.line).markedSpans;if(r)for(var i=0;i<r.length;++i){var u=r[i];(u.from==null||u.from<=e.ch)&&(u.to==null||u.to>=e.ch)&&t.push(u.marker.parent||u.marker)}return t},findMarks:function(e,t,r){e=v(this,e),t=v(this,t);var i=[],u=e.line;return this.iter(e.line,t.line+1,function(M){var V=M.markedSpans;if(V)for(var Z=0;Z<V.length;Z++){var ee=V[Z];!(ee.to!=null&&u==e.line&&e.ch>=ee.to||ee.from==null&&u!=e.line||ee.from!=null&&u==t.line&&ee.from>=t.ch)&&(!r||r(ee.marker))&&i.push(ee.marker.parent||ee.marker)}++u}),i},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var i=0;i<r.length;++i)r[i].from!=null&&e.push(r[i].marker)}),e},posFromIndex:function(e){var t,r=this.first,i=this.lineSeparator().length;return this.iter(function(u){var M=u.text.length+i;if(M>e)return t=e,!0;e-=M,++r}),v(this,ct(r,t))},indexFromPos:function(e){e=v(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(i){t+=i.text.length+r}),t},copy:function(e){var t=new qr($i(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<r&&(r=e.to);var i=new qr($i(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:e.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Tl(i,Bs(this)),i},unlinkDoc:function(e){if(e instanceof hr&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var r=this.linked[t];if(r.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Cl(Bs(this));break}if(e.history==this.history){var i=[e.id];xr(e,function(u){return i.push(u.id)},!0),e.history=new Go(null),e.history.done=vo(this.history.done,i),e.history.undone=vo(this.history.undone,i)}},iterLinkedDocs:function(e){xr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ln(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:dr(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),qr.prototype.eachLine=qr.prototype.iter;var js=0;function Sl(e){var t=this;if(Hs(t),wt(t,e)||kr(t.display,e))return;se(e),H&&(js=+new Date);var r=Er(t,e,!0),i=e.dataTransfer.files;if(!r||t.isReadOnly())return;if(i&&i.length&&window.FileReader&&window.File)for(var u=i.length,M=Array(u),V=0,Z=function(){++V==u&&cr(t,function(){r=v(t.doc,r);var Ve={from:r,to:r,text:t.doc.splitLines(M.filter(function(gt){return gt!=null}).join(t.doc.lineSeparator())),origin:"paste"};_o(t.doc,Ve),ws(t.doc,an(v(t.doc,r),v(t.doc,xn(Ve))))})()},ee=function(Ve,gt){if(t.options.allowDropFileTypes&&oe(t.options.allowDropFileTypes,Ve.type)==-1){Z();return}var Rt=new FileReader;Rt.onerror=function(){return Z()},Rt.onload=function(){var Ut=Rt.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ut)){Z();return}M[gt]=Ut,Z()},Rt.readAsText(Ve)},ie=0;ie<i.length;ie++)ee(i[ie],ie);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var Te=e.dataTransfer.getData("Text");if(Te){var Le;if(t.state.draggingText&&!t.state.draggingText.copy&&(Le=t.listSelections()),Yo(t.doc,an(r,r)),Le)for(var Xe=0;Xe<Le.length;++Xe)bo(t.doc,"",Le[Xe].anchor,Le[Xe].head,"drag");t.replaceSelection(Te,"around","paste"),t.display.input.focus()}}catch(Ve){}}}function Ol(e,t){if(H&&(!e.state.draggingText||+new Date-js<100)){Se(t);return}if(wt(e,t)||kr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!d){var r=h("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),p&&r.parentNode.removeChild(r)}}function Al(e,t){var r=Er(e,t);if(!r)return;var i=document.createDocumentFragment();Jr(e,r,i),e.display.dragCursor||(e.display.dragCursor=h("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),y(e.display.dragCursor,i)}function Hs(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Ws(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),r=[],i=0;i<t.length;i++){var u=t[i].CodeMirror;u&&r.push(u)}r.length&&r[0].operation(function(){for(var M=0;M<r.length;M++)e(r[M])})}var Ks=!1;function Rl(){if(Ks)return;Dl(),Ks=!0}function Dl(){var e;it(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,Ws(Ll)},100))}),it(window,"blur",function(){return Ws(Ca)})}function Ll(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var eo={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Fo=0;Fo<10;Fo++)eo[Fo+48]=eo[Fo+96]=String(Fo);for(var Qo=65;Qo<=90;Qo++)eo[Qo]=String.fromCharCode(Qo);for(var Uo=1;Uo<=12;Uo++)eo[Uo+111]=eo[Uo+63235]="F"+Uo;var Ka={};Ka.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ka.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ka.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ka.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ka.default=o?Ka.macDefault:Ka.pcDefault;function Il(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var r,i,u,M,V=0;V<t.length-1;V++){var Z=t[V];if(/^(cmd|meta|m)$/i.test(Z))M=!0;else if(/^a(lt)?$/i.test(Z))r=!0;else if(/^(c|ctrl|control)$/i.test(Z))i=!0;else if(/^s(hift)?$/i.test(Z))u=!0;else throw new Error("Unrecognized modifier name: "+Z)}return r&&(e="Alt-"+e),i&&(e="Ctrl-"+e),M&&(e="Cmd-"+e),u&&(e="Shift-"+e),e}function kl(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if(i=="..."){delete e[r];continue}for(var u=Ee(r.split(" "),Il),M=0;M<u.length;M++){var V=void 0,Z=void 0;M==u.length-1?(Z=u.join(" "),V=i):(Z=u.slice(0,M+1).join(" "),V="...");var ee=t[Z];if(!ee)t[Z]=V;else if(ee!=V)throw new Error("Inconsistent bindings for "+Z)}delete e[r]}for(var ie in t)e[ie]=t[ie];return e}function xo(e,t,r,i){t=Jo(t);var u=t.call?t.call(e,i):t[e];if(u===!1)return"nothing";if(u==="...")return"multi";if(u!=null&&r(u))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return xo(e,t.fallthrough,r,i);for(var M=0;M<t.fallthrough.length;M++){var V=xo(e,t.fallthrough[M],r,i);if(V)return V}}}function Gs(e){var t=typeof e=="string"?e:eo[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function zs(e,t,r){var i=e;return t.altKey&&i!="Alt"&&(e="Alt-"+e),(x?t.metaKey:t.ctrlKey)&&i!="Ctrl"&&(e="Ctrl-"+e),(x?t.ctrlKey:t.metaKey)&&i!="Mod"&&(e="Cmd-"+e),!r&&t.shiftKey&&i!="Shift"&&(e="Shift-"+e),e}function Vs(e,t){if(p&&e.keyCode==34&&e.char)return!1;var r=eo[e.keyCode];return r==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(r=e.code),zs(r,e,t))}function Jo(e){return typeof e=="string"?Ka[e]:e}function To(e,t){for(var r=e.doc.sel.ranges,i=[],u=0;u<r.length;u++){for(var M=t(r[u]);i.length&&Zt(M.from,ae(i).to)<=0;){var V=i.pop();if(Zt(V.from,M.from)<0){M.from=V.from;break}}i.push(M)}jr(e,function(){for(var Z=i.length-1;Z>=0;Z--)bo(e.doc,"",i[Z].from,i[Z].to,"+delete");ya(e)})}function os(e,t,r){var i=ft(e.text,t+r,r);return i<0||i>e.text.length?null:i}function ss(e,t,r){var i=os(e,t.ch,r);return i==null?null:new ct(t.line,i,r<0?"after":"before")}function ls(e,t,r,i,u){if(e){t.doc.direction=="rtl"&&(u=-u);var M=Xt(r,t.doc.direction);if(M){var V=u<0?ae(M):M[0],Z=u<0==(V.level==1),ee=Z?"after":"before",ie;if(V.level>0||t.doc.direction=="rtl"){var Te=we(t,r);ie=u<0?r.text.length-1:0;var Le=ze(t,Te,ie).top;ie=Ht(function(Xe){return ze(t,Te,Xe).top==Le},u<0==(V.level==1)?V.from:V.to-1,ie),ee=="before"&&(ie=os(r,ie,1))}else ie=u<0?V.to:V.from;return new ct(i,ie,ee)}}return new ct(i,u<0?r.text.length:0,u<0?"before":"after")}function Ml(e,t,r,i){var u=Xt(t,e.doc.direction);if(!u)return ss(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 M=Tt(u,r.ch,r.sticky),V=u[M];if(e.doc.direction=="ltr"&&V.level%2==0&&(i>0?V.to>r.ch:V.from<r.ch))return ss(t,r,i);var Z=function(en,fn){return os(t,en instanceof ct?en.ch:en,fn)},ee,ie=function(en){return e.options.lineWrapping?(ee=ee||we(e,t),yn(e,t,ee,en)):{begin:0,end:t.text.length}},Te=ie(r.sticky=="before"?Z(r,-1):r.ch);if(e.doc.direction=="rtl"||V.level==1){var Le=V.level==1==i<0,Xe=Z(r,Le?1:-1);if(Xe!=null&&(Le?Xe<=V.to&&Xe<=Te.end:Xe>=V.from&&Xe>=Te.begin)){var Ve=Le?"before":"after";return new ct(r.line,Xe,Ve)}}var gt=function(en,fn,tn){for(var _n=function(nr,Ur){return Ur?new ct(r.line,Z(nr,1),"before"):new ct(r.line,nr,"after")};en>=0&&en<u.length;en+=fn){var $n=u[en],Pn=fn>0==($n.level!=1),yi=Pn?tn.begin:Z(tn.end,-1);if($n.from<=yi&&yi<$n.to)return _n(yi,Pn);if(yi=Pn?$n.from:Z($n.to,-1),tn.begin<=yi&&yi<tn.end)return _n(yi,Pn)}},Rt=gt(M+i,i,Te);if(Rt)return Rt;var Ut=i>0?Te.end:Z(Te.begin,-1);return Ut!=null&&!(i>0&&Ut==t.text.length)&&(Rt=gt(i>0?0:u.length-1,i,ie(Ut)),Rt)?Rt:null}var Bo={selectAll:Ds,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),_e)},killLine:function(e){return To(e,function(t){if(t.empty()){var r=Pt(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:ct(t.head.line+1,0)}:{from:t.head,to:ct(t.head.line,r)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return To(e,function(t){return{from:ct(t.from().line,0),to:v(e.doc,ct(t.to().line+1,0))}})},delLineLeft:function(e){return To(e,function(t){return{from:ct(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return To(e,function(t){var r=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:r},"div");return{from:i,to:t.from()}})},delWrappedLineRight:function(e){return To(e,function(t){var r=e.charCoords(t.head,"div").top+5,i=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:i}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(ct(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(ct(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return Ys(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Xs(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Pl(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},We)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},We)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,i=e.coordsChar({left:0,top:r},"div");return i.ch<e.getLine(i.line).search(/\S/)?Xs(e,t.head):i},We)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),i=e.options.tabSize,u=0;u<r.length;u++){var M=r[u].from(),V=G(e.getLine(M.line),M.ch,i);t.push(ue(i-V%i))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return jr(e,function(){for(var t=e.listSelections(),r=[],i=0;i<t.length;i++){if(!t[i].empty())continue;var u=t[i].head,M=Pt(e.doc,u.line).text;if(M){if(u.ch==M.length&&(u=new ct(u.line,u.ch-1)),u.ch>0)u=new ct(u.line,u.ch+1),e.replaceRange(M.charAt(u.ch-1)+M.charAt(u.ch-2),ct(u.line,u.ch-2),u,"+transpose");else if(u.line>e.doc.first){var V=Pt(e.doc,u.line-1).text;V&&(u=new ct(u.line,1),e.replaceRange(M.charAt(0)+e.doc.lineSeparator()+V.charAt(V.length-1),ct(u.line-1,V.length-1),u,"+transpose"))}}r.push(new ki(u,u))}e.setSelections(r)})},newlineAndIndent:function(e){return jr(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;i<t.length;i++)e.indentLine(t[i].from().line,null,!0);ya(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Ys(e,t){var r=Pt(e.doc,t),i=nt(r);return i!=r&&(t=vn(i)),ls(!0,e,i,t,1)}function Pl(e,t){var r=Pt(e.doc,t),i=Et(r);return i!=r&&(t=vn(i)),ls(!0,e,r,t,-1)}function Xs(e,t){var r=Ys(e,t.line),i=Pt(e.doc,r.line),u=Xt(i,e.doc.direction);if(!u||u[0].level==0){var M=Math.max(r.ch,i.text.search(/\S/)),V=t.line==r.line&&t.ch<=M&&t.ch;return ct(r.line,V?0:M,r.sticky)}return r}function Zo(e,t,r){if(typeof t=="string"&&(t=Bo[t],!t))return!1;e.display.input.ensurePolled();var i=e.display.shift,u=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),u=t(e)!=Ne}finally{e.display.shift=i,e.state.suppressEdits=!1}return u}function Nl(e,t,r){for(var i=0;i<e.state.keyMaps.length;i++){var u=xo(t,e.state.keyMaps[i],r,e);if(u)return u}return e.options.extraKeys&&xo(t,e.options.extraKeys,r,e)||xo(t,e.options.keyMap,r,e)}var Fl=new J;function jo(e,t,r,i){var u=e.state.keySeq;if(u){if(Gs(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==u&&(e.state.keySeq=null,e.display.input.reset())}),$s(e,u+" "+t,r,i))return!0}return $s(e,t,r,i)}function $s(e,t,r,i){var u=Nl(e,t,i);return u=="multi"&&(e.state.keySeq=t),u=="handled"&&jn(e,"keyHandled",e,t,r),(u=="handled"||u=="multi")&&(se(r),vr(e)),!!u}function Qs(e,t){var r=Vs(t,!0);return r?t.shiftKey&&!e.state.keySeq?jo(e,"Shift-"+r,t,function(i){return Zo(e,i,!0)})||jo(e,r,t,function(i){if(typeof i=="string"?/^go[A-Z]/.test(i):i.motion)return Zo(e,i)}):jo(e,r,t,function(i){return Zo(e,i)}):!1}function Ul(e,t,r){return jo(e,"'"+r+"'",t,function(i){return Zo(e,i,!0)})}var us=null;function Js(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=j(),wt(t,e))return;H&&I<11&&e.keyCode==27&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=r==16||e.shiftKey;var i=Qs(t,e);p&&(us=i?r:null,!i&&r==88&&!_i&&(o?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),P&&!o&&!i&&r==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),r==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;N(t,"CodeMirror-crosshair");function r(i){(i.keyCode==18||!i.altKey)&&(_(t,"CodeMirror-crosshair"),Kt(document,"keyup",r),Kt(document,"mouseover",r))}it(document,"keyup",r),it(document,"mouseover",r)}function Zs(e){e.keyCode==16&&(this.doc.sel.shift=!1),wt(this,e)}function qs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(kr(t.display,e)||wt(t,e)||e.ctrlKey&&!e.altKey||o&&e.metaKey)return;var r=e.keyCode,i=e.charCode;if(p&&r==us){us=null,se(e);return}if(p&&(!e.which||e.which<10)&&Qs(t,e))return;var u=String.fromCharCode(i==null?r:i);if(u=="\b")return;if(Ul(t,e,u))return;t.display.input.onKeyPress(e)}var jl=400,cs=function(e,t,r){this.time=e,this.pos=t,this.button=r};cs.prototype.compare=function(e,t,r){return this.time+jl>e&&Zt(t,this.pos)==0&&r==this.button};var Ho,Wo;function Hl(e,t){var r=+new Date;return Wo&&Wo.compare(r,e,t)?(Ho=Wo=null,"triple"):Ho&&Ho.compare(r,e,t)?(Wo=new cs(r,e,t),Ho=null,"double"):(Ho=new cs(r,e,t),Wo=null,"single")}function el(e){var t=this,r=t.display;if(wt(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,kr(r,e)){F||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if(ds(t,e))return;var i=Er(t,e),u=et(e),M=i?Hl(i,u):"single";if(window.focus(),u==1&&t.state.selectingText&&t.state.selectingText(e),i&&Wl(t,u,i,M,e))return;u==1?i?Gl(t,i,M,e):ke(e)==r.scroller&&se(e):u==2?(i&&Vo(t.doc,i),setTimeout(function(){return r.input.focus()},20)):u==3&&(A?t.display.input.onContextMenu(e):no(t))}function Wl(e,t,r,i,u){var M="Click";return i=="double"?M="Double"+M:i=="triple"&&(M="Triple"+M),M=(t==1?"Left":t==2?"Middle":"Right")+M,jo(e,zs(M,u),u,function(V){if(typeof V=="string"&&(V=Bo[V]),!V)return!1;var Z=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Z=V(e,r)!=Ne}finally{e.state.suppressEdits=!1}return Z})}function Kl(e,t,r){var i=e.getOption("configureMouse"),u=i?i(e,t,r):{};if(u.unit==null){var M=f?r.shiftKey&&r.metaKey:r.altKey;u.unit=M?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(u.extend==null||e.doc.extend)&&(u.extend=e.doc.extend||r.shiftKey),u.addNew==null&&(u.addNew=o?r.metaKey:r.ctrlKey),u.moveOnDrag==null&&(u.moveOnDrag=!(o?r.altKey:r.ctrlKey)),u}function Gl(e,t,r,i){H?setTimeout(k(ka,e),0):e.curOp.focus=j();var u=Kl(e,r,i),M=e.doc.sel,V;e.options.dragDrop&&yt&&!e.isReadOnly()&&r=="single"&&(V=M.contains(t))>-1&&(Zt((V=M.ranges[V]).from(),t)<0||t.xRel>0)&&(Zt(V.to(),t)>0||t.xRel<0)?zl(e,i,t,u):Vl(e,i,t,u)}function zl(e,t,r,i){var u=e.display,M=!1,V=cr(e,function(ie){F&&(u.scroller.draggable=!1),e.state.draggingText=!1,Kt(u.wrapper.ownerDocument,"mouseup",V),Kt(u.wrapper.ownerDocument,"mousemove",Z),Kt(u.scroller,"dragstart",ee),Kt(u.scroller,"drop",V),M||(se(ie),i.addNew||Vo(e.doc,r,null,null,i.extend),F&&!d||H&&I==9?setTimeout(function(){u.wrapper.ownerDocument.body.focus({preventScroll:!0}),u.input.focus()},20):u.input.focus())}),Z=function(ie){M=M||Math.abs(t.clientX-ie.clientX)+Math.abs(t.clientY-ie.clientY)>=10},ee=function(){return M=!0};F&&(u.scroller.draggable=!0),e.state.draggingText=V,V.copy=!i.moveOnDrag,u.scroller.dragDrop&&u.scroller.dragDrop(),it(u.wrapper.ownerDocument,"mouseup",V),it(u.wrapper.ownerDocument,"mousemove",Z),it(u.scroller,"dragstart",ee),it(u.scroller,"drop",V),no(e),setTimeout(function(){return u.input.focus()},20)}function tl(e,t,r){if(r=="char")return new ki(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new ki(ct(t.line,0),v(e.doc,ct(t.line+1,0)));var i=r(e,t);return new ki(i.from,i.to)}function Vl(e,t,r,i){var u=e.display,M=e.doc;se(t);var V,Z,ee=M.sel,ie=ee.ranges;if(i.addNew&&!i.extend?(Z=M.sel.contains(r),Z>-1?V=ie[Z]:V=new ki(r,r)):(V=M.sel.primary(),Z=M.sel.primIndex),i.unit=="rectangle")i.addNew||(V=new ki(r,r)),r=Er(e,t,!0,!0),Z=-1;else{var Te=tl(e,r,i.unit);i.extend?V=rs(V,Te.anchor,Te.head,i.extend):V=Te}i.addNew?Z==-1?(Z=ie.length,zr(M,qn(e,ie.concat([V]),Z),{scroll:!1,origin:"*mouse"})):ie.length>1&&ie[Z].empty()&&i.unit=="char"&&!i.extend?(zr(M,qn(e,ie.slice(0,Z).concat(ie.slice(Z+1)),0),{scroll:!1,origin:"*mouse"}),ee=M.sel):as(M,Z,V,Fe):(Z=0,zr(M,new Hr([V],0),Fe),ee=M.sel);var Le=r;function Xe(tn){if(Zt(Le,tn)==0)return;if(Le=tn,i.unit=="rectangle"){for(var _n=[],$n=e.options.tabSize,Pn=G(Pt(M,r.line).text,r.ch,$n),yi=G(Pt(M,tn.line).text,tn.ch,$n),nr=Math.min(Pn,yi),Ur=Math.max(Pn,yi),pr=Math.min(r.line,tn.line),ra=Math.min(e.lastLine(),Math.max(r.line,tn.line));pr<=ra;pr++){var ea=Pt(M,pr).text,Ar=Ue(ea,nr,$n);nr==Ur?_n.push(new ki(ct(pr,Ar),ct(pr,Ar))):ea.length>Ar&&_n.push(new ki(ct(pr,Ar),ct(pr,Ue(ea,Ur,$n))))}_n.length||_n.push(new ki(r,r)),zr(M,qn(e,ee.ranges.slice(0,Z).concat(_n),Z),{origin:"*mouse",scroll:!1}),e.scrollIntoView(tn)}else{var ta=V,Wr=tl(e,tn,i.unit),Ir=ta.anchor,Rr;Zt(Wr.anchor,Ir)>0?(Rr=Wr.head,Ir=ii(ta.from(),Wr.anchor)):(Rr=Wr.anchor,Ir=ri(ta.to(),Wr.head));var _r=ee.ranges.slice(0);_r[Z]=Yl(e,new ki(v(M,Ir),Rr)),zr(M,qn(e,_r,Z),Fe)}}var Ve=u.wrapper.getBoundingClientRect(),gt=0;function Rt(tn){var _n=++gt,$n=Er(e,tn,!0,i.unit=="rectangle");if(!$n)return;if(Zt($n,Le)!=0){e.curOp.focus=j(),Xe($n);var Pn=Ma(u,M);($n.line>=Pn.to||$n.line<Pn.from)&&setTimeout(cr(e,function(){gt==_n&&Rt(tn)}),150)}else{var yi=tn.clientY<Ve.top?-20:tn.clientY>Ve.bottom?20:0;yi&&setTimeout(cr(e,function(){if(gt!=_n)return;u.scroller.scrollTop+=yi,Rt(tn)}),50)}}function Ut(tn){e.state.selectingText=!1,gt=Infinity,tn&&(se(tn),u.input.focus()),Kt(u.wrapper.ownerDocument,"mousemove",en),Kt(u.wrapper.ownerDocument,"mouseup",fn),M.history.lastSelOrigin=null}var en=cr(e,function(tn){tn.buttons===0||!et(tn)?Ut(tn):Rt(tn)}),fn=cr(e,Ut);e.state.selectingText=fn,it(u.wrapper.ownerDocument,"mousemove",en),it(u.wrapper.ownerDocument,"mouseup",fn)}function Yl(e,t){var r=t.anchor,i=t.head,u=Pt(e.doc,r.line);if(Zt(r,i)==0&&r.sticky==i.sticky)return t;var M=Xt(u);if(!M)return t;var V=Tt(M,r.ch,r.sticky),Z=M[V];if(Z.from!=r.ch&&Z.to!=r.ch)return t;var ee=V+(Z.from==r.ch==(Z.level!=1)?0:1);if(ee==0||ee==M.length)return t;var ie;if(i.line!=r.line)ie=(i.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var Te=Tt(M,i.ch,i.sticky),Le=Te-V||(i.ch-r.ch)*(Z.level==1?-1:1);Te==ee-1||Te==ee?ie=Le<0:ie=Le>0}var Xe=M[ee+(ie?-1:0)],Ve=ie==(Xe.level==1),gt=Ve?Xe.from:Xe.to,Rt=Ve?"after":"before";return r.ch==gt&&r.sticky==Rt?t:new ki(new ct(r.line,gt,Rt),i)}function nl(e,t,r,i){var u,M;if(t.touches)u=t.touches[0].clientX,M=t.touches[0].clientY;else try{u=t.clientX,M=t.clientY}catch(Xe){return!1}if(u>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&se(t);var V=e.display,Z=V.lineDiv.getBoundingClientRect();if(M>Z.bottom||!Ae(e,r))return ye(t);M-=Z.top-V.viewOffset;for(var ee=0;ee<e.display.gutterSpecs.length;++ee){var ie=V.gutters.childNodes[ee];if(ie&&ie.getBoundingClientRect().right>=u){var Te=Bi(e.doc,M),Le=e.display.gutterSpecs[ee];return qe(e,r,e,Te,Le.className,t),ye(t)}}}function ds(e,t){return nl(e,t,"gutterClick",!0)}function il(e,t){if(kr(e.display,t)||Xl(e,t))return;if(wt(e,t,"contextmenu"))return;A||e.display.input.onContextMenu(t)}function Xl(e,t){return Ae(e,"gutterContextMenu")?nl(e,t,"gutterContextMenu",!1):!1}function rl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Jn(e)}var Co={toString:function(){return"CodeMirror.Init"}},al={},qo={};function $l(e){var t=e.optionHandlers;function r(i,u,M,V){e.defaults[i]=u,M&&(t[i]=V?function(Z,ee,ie){ie!=Co&&M(Z,ee,ie)}:M)}e.defineOption=r,e.Init=Co,r("value","",function(i,u){return i.setValue(u)},!0),r("mode",null,function(i,u){i.doc.modeOption=u,Or(i)},!0),r("indentUnit",2,Or,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(i){Yr(i),Jn(i),Ki(i)},!0),r("lineSeparator",null,function(i,u){if(i.doc.lineSep=u,!u)return;var M=[],V=i.doc.first;i.doc.iter(function(ee){for(var ie=0;;){var Te=ee.text.indexOf(u,ie);if(Te==-1)break;ie=Te+u.length,M.push(ct(V,Te))}V++});for(var Z=M.length-1;Z>=0;Z--)bo(i.doc,u,M[Z],ct(M[Z].line,M[Z].ch+u.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(i,u,M){i.state.specialChars=new RegExp(u.source+(u.test(" ")?"":"| "),"g"),M!=Co&&i.refresh()}),r("specialCharPlaceholder",Vn,function(i){return i.refresh()},!0),r("electricChars",!0),r("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(i,u){return i.getInputField().spellcheck=u},!0),r("autocorrect",!1,function(i,u){return i.getInputField().autocorrect=u},!0),r("autocapitalize",!1,function(i,u){return i.getInputField().autocapitalize=u},!0),r("rtlMoveVisually",!L),r("wholeLineUpdateBefore",!0),r("theme","default",function(i){rl(i),la(i)},!0),r("keyMap","default",function(i,u,M){var V=Jo(u),Z=M!=Co&&Jo(M);Z&&Z.detach&&Z.detach(i,V),V.attach&&V.attach(i,Z||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Jl,!0),r("gutters",[],function(i,u){i.display.gutterSpecs=Fr(u,i.options.lineNumbers),la(i)},!0),r("fixedGutter",!0,function(i,u){i.display.gutters.style.left=u?or(i.display)+"px":"0",i.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(i){return pa(i)},!0),r("scrollbarStyle","native",function(i){Qa(i),pa(i),i.display.scrollbars.setScrollTop(i.doc.scrollTop),i.display.scrollbars.setScrollLeft(i.doc.scrollLeft)},!0),r("lineNumbers",!1,function(i,u){i.display.gutterSpecs=Fr(i.options.gutters,u),la(i)},!0),r("firstLineNumber",1,la,!0),r("lineNumberFormatter",function(i){return i},la,!0),r("showCursorWhenSelecting",!1,Gi,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(i,u){u=="nocursor"&&(Ca(i),i.display.input.blur()),i.display.input.readOnlyChanged(u)}),r("screenReaderLabel",null,function(i,u){u=u===""?null:u,i.display.input.screenReaderLabelChanged(u)}),r("disableInput",!1,function(i,u){u||i.display.input.reset()},!0),r("dragDrop",!0,Ql),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,Gi,!0),r("singleCursorHeightPerLine",!0,Gi,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Yr,!0),r("addModeClass",!1,Yr,!0),r("pollInterval",100),r("undoDepth",200,function(i,u){return i.doc.history.undoDepth=u}),r("historyEventDelay",1250),r("viewportMargin",10,function(i){return i.refresh()},!0),r("maxHighlightLength",1e4,Yr,!0),r("moveInputWithCursor",!0,function(i,u){u||i.display.input.resetPosition()}),r("tabindex",null,function(i,u){return i.display.input.getField().tabIndex=u||""}),r("autofocus",null),r("direction","ltr",function(i,u){return i.doc.setDirection(u)},!0),r("phrases",null)}function Ql(e,t,r){var i=r&&r!=Co;if(!t!=!i){var u=e.display.dragFunctions,M=t?it:Kt;M(e.display.scroller,"dragstart",u.start),M(e.display.scroller,"dragenter",u.enter),M(e.display.scroller,"dragover",u.over),M(e.display.scroller,"dragleave",u.leave),M(e.display.scroller,"drop",u.drop)}}function Jl(e){e.options.lineWrapping?(N(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(_(e.display.wrapper,"CodeMirror-wrap"),pn(e)),Pr(e),Ki(e),Jn(e),setTimeout(function(){return pa(e)},100)}function hr(e,t){var r=this;if(!(this instanceof hr))return new hr(e,t);this.options=t=t?b(t):{},b(al,t,!1);var i=t.value;typeof i=="string"?i=new qr(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var u=new hr.inputStyles[t.inputStyle](this),M=this.display=new Ua(e,i,u,t);M.wrapper.CodeMirror=this,rl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Qa(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 J,keySeq:null,specialChars:null},t.autofocus&&!a&&M.input.focus(),H&&I<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Rl(),sa(this),this.curOp.forceUpdate=!0,vs(this,i),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&oa(r)},20):Ca(this);for(var V in qo)qo.hasOwnProperty(V)&&qo[V](this,t[V],Co);ar(this),t.finishInit&&t.finishInit(this);for(var Z=0;Z<hs.length;++Z)hs[Z](this);Ea(this),F&&t.lineWrapping&&getComputedStyle(M.lineDiv).textRendering=="optimizelegibility"&&(M.lineDiv.style.textRendering="auto")}hr.defaults=al,hr.optionHandlers=qo;function Zl(e){var t=e.display;it(t.scroller,"mousedown",cr(e,el)),H&&I<11?it(t.scroller,"dblclick",cr(e,function(ee){if(wt(e,ee))return;var ie=Er(e,ee);if(!ie||ds(e,ee)||kr(e.display,ee))return;se(ee);var Te=e.findWordAt(ie);Vo(e.doc,Te.anchor,Te.head)})):it(t.scroller,"dblclick",function(ee){return wt(e,ee)||se(ee)}),it(t.scroller,"contextmenu",function(ee){return il(e,ee)}),it(t.input.getField(),"contextmenu",function(ee){t.scroller.contains(ee.target)||il(e,ee)});var r,i={end:0};function u(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),i=t.activeTouch,i.end=+new Date)}function M(ee){if(ee.touches.length!=1)return!1;var ie=ee.touches[0];return ie.radiusX<=1&&ie.radiusY<=1}function V(ee,ie){if(ie.left==null)return!0;var Te=ie.left-ee.left,Le=ie.top-ee.top;return Te*Te+Le*Le>20*20}it(t.scroller,"touchstart",function(ee){if(!wt(e,ee)&&!M(ee)&&!ds(e,ee)){t.input.ensurePolled(),clearTimeout(r);var ie=+new Date;t.activeTouch={start:ie,moved:!1,prev:ie-i.end<=300?i:null},ee.touches.length==1&&(t.activeTouch.left=ee.touches[0].pageX,t.activeTouch.top=ee.touches[0].pageY)}}),it(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),it(t.scroller,"touchend",function(ee){var ie=t.activeTouch;if(ie&&!kr(t,ee)&&ie.left!=null&&!ie.moved&&new Date-ie.start<300){var Te=e.coordsChar(t.activeTouch,"page"),Le;!ie.prev||V(ie,ie.prev)?Le=new ki(Te,Te):!ie.prev.prev||V(ie,ie.prev.prev)?Le=e.findWordAt(Te):Le=new ki(ct(Te.line,0),v(e.doc,ct(Te.line+1,0))),e.setSelection(Le.anchor,Le.head),e.focus(),se(ee)}u()}),it(t.scroller,"touchcancel",u),it(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Da(e,t.scroller.scrollTop),Lr(e,t.scroller.scrollLeft,!0),qe(e,"scroll",e))}),it(t.scroller,"mousewheel",function(ee){return Ha(e,ee)}),it(t.scroller,"DOMMouseScroll",function(ee){return Ha(e,ee)}),it(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(ee){wt(e,ee)||Se(ee)},over:function(ee){wt(e,ee)||(Al(e,ee),Se(ee))},start:function(ee){return Ol(e,ee)},drop:cr(e,Sl),leave:function(ee){wt(e,ee)||Hs(e)}};var Z=t.input.getField();it(Z,"keyup",function(ee){return Zs.call(e,ee)}),it(Z,"keydown",cr(e,Js)),it(Z,"keypress",cr(e,qs)),it(Z,"focus",function(ee){return oa(e,ee)}),it(Z,"blur",function(ee){return Ca(e,ee)})}var hs=[];hr.defineInitHook=function(e){return hs.push(e)};function Ko(e,t,r,i){var u=e.doc,M;r==null&&(r="add"),r=="smart"&&(u.mode.indent?M=Ot(e,t).state:r="prev");var V=e.options.tabSize,Z=Pt(u,t),ee=G(Z.text,null,V);Z.stateAfter&&(Z.stateAfter=null);var ie=Z.text.match(/^\s*/)[0],Te;if(!i&&!/\S/.test(Z.text))Te=0,r="not";else if(r=="smart"&&(Te=u.mode.indent(M,Z.text.slice(ie.length),Z.text),Te==Ne||Te>150)){if(!i)return;r="prev"}r=="prev"?t>u.first?Te=G(Pt(u,t-1).text,null,V):Te=0:r=="add"?Te=ee+e.options.indentUnit:r=="subtract"?Te=ee-e.options.indentUnit:typeof r=="number"&&(Te=ee+r),Te=Math.max(0,Te);var Le="",Xe=0;if(e.options.indentWithTabs)for(var Ve=Math.floor(Te/V);Ve;--Ve)Xe+=V,Le+=" ";if(Xe<Te&&(Le+=ue(Te-Xe)),Le!=ie)return bo(u,Le,ct(t,0),ct(t,ie.length),"+input"),Z.stateAfter=null,!0;for(var gt=0;gt<u.sel.ranges.length;gt++){var Rt=u.sel.ranges[gt];if(Rt.head.line==t&&Rt.head.ch<ie.length){var Ut=ct(t,ie.length);as(u,gt,new ki(Ut,Ut));break}}}var Ta=null;function es(e){Ta=e}function fs(e,t,r,i,u){var M=e.doc;e.display.shift=!1,i||(i=M.sel);var V=+new Date-200,Z=u=="paste"||e.state.pasteIncoming>V,ee=Ln(t),ie=null;if(Z&&i.ranges.length>1)if(Ta&&Ta.text.join(`
|
|
`)==t){if(i.ranges.length%Ta.text.length==0){ie=[];for(var Te=0;Te<Ta.text.length;Te++)ie.push(M.splitLines(Ta.text[Te]))}}else ee.length==i.ranges.length&&e.options.pasteLinesPerSelection&&(ie=Ee(ee,function(en){return[en]}));for(var Le=e.curOp.updateInput,Xe=i.ranges.length-1;Xe>=0;Xe--){var Ve=i.ranges[Xe],gt=Ve.from(),Rt=Ve.to();Ve.empty()&&(r&&r>0?gt=ct(gt.line,gt.ch-r):e.state.overwrite&&!Z?Rt=ct(Rt.line,Math.min(Pt(M,Rt.line).text.length,Rt.ch+ae(ee).length)):Z&&Ta&&Ta.lineWise&&Ta.text.join(`
|
|
`)==ee.join(`
|
|
`)&&(gt=Rt=ct(gt.line,0)));var Ut={from:gt,to:Rt,text:ie?ie[Xe%ie.length]:ee,origin:u||(Z?"paste":e.state.cutIncoming>V?"cut":"+input")};_o(e.doc,Ut),jn(e,"inputRead",e,Ut)}t&&!Z&&sl(e,t),ya(e),e.curOp.updateInput<2&&(e.curOp.updateInput=Le),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ol(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&jr(t,function(){return fs(t,r,0,null,"paste")}),!0}function sl(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 u=r.ranges[i];if(u.head.ch>100||i&&r.ranges[i-1].head.line==u.head.line)continue;var M=e.getModeAt(u.head),V=!1;if(M.electricChars){for(var Z=0;Z<M.electricChars.length;Z++)if(t.indexOf(M.electricChars.charAt(Z))>-1){V=Ko(e,u.head.line,"smart");break}}else M.electricInput&&(M.electricInput.test(Pt(e.doc,u.head.line).text.slice(0,u.head.ch))&&(V=Ko(e,u.head.line,"smart")));V&&jn(e,"electricInput",e,u.head.line)}}function ll(e){for(var t=[],r=[],i=0;i<e.doc.sel.ranges.length;i++){var u=e.doc.sel.ranges[i].head.line,M={anchor:ct(u,0),head:ct(u+1,0)};r.push(M),t.push(e.getRange(M.anchor,M.head))}return{text:t,ranges:r}}function ul(e,t,r,i){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",i?"":"off"),e.setAttribute("spellcheck",!!t)}function cl(){var e=h("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=h("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return F?e.style.width="1000px":e.setAttribute("wrap","off"),c&&(e.style.border="1px solid black"),ul(e),t}function ql(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(i,u){var M=this.options,V=M[i];if(M[i]==u&&i!="mode")return;M[i]=u,t.hasOwnProperty(i)&&cr(this,t[i])(this,u,V),qe(this,"optionChange",this,i)},getOption:function(i){return this.options[i]},getDoc:function(){return this.doc},addKeyMap:function(i,u){this.state.keyMaps[u?"push":"unshift"](Jo(i))},removeKeyMap:function(i){for(var u=this.state.keyMaps,M=0;M<u.length;++M)if(u[M]==i||u[M].name==i)return u.splice(M,1),!0},addOverlay:Sr(function(i,u){var M=i.token?i:e.getMode(this.options,i);if(M.startState)throw new Error("Overlays may not be stateful.");de(this.state.overlays,{mode:M,modeSpec:i,opaque:u&&u.opaque,priority:u&&u.priority||0},function(V){return V.priority}),this.state.modeGen++,Ki(this)}),removeOverlay:Sr(function(i){for(var u=this.state.overlays,M=0;M<u.length;++M){var V=u[M].modeSpec;if(V==i||typeof i=="string"&&V.name==i){u.splice(M,1),this.state.modeGen++,Ki(this);return}}}),indentLine:Sr(function(i,u,M){typeof u!="string"&&typeof u!="number"&&(u==null?u=this.options.smartIndent?"smart":"prev":u=u?"add":"subtract"),Ai(this.doc,i)&&Ko(this,i,u,M)}),indentSelection:Sr(function(i){for(var u=this.doc.sel.ranges,M=-1,V=0;V<u.length;V++){var Z=u[V];if(Z.empty())Z.head.line>M&&(Ko(this,Z.head.line,i,!0),M=Z.head.line,V==this.doc.sel.primIndex&&ya(this));else{var ee=Z.from(),ie=Z.to(),Te=Math.max(M,ee.line);M=Math.min(this.lastLine(),ie.line-(ie.ch?0:1))+1;for(var Le=Te;Le<M;++Le)Ko(this,Le,i);var Xe=this.doc.sel.ranges;ee.ch==0&&u.length==Xe.length&&Xe[V].from().ch>0&&as(this.doc,V,new ki(ee,Xe[V].to()),_e)}}}),getTokenAt:function(i,u){return Nn(this,i,u)},getLineTokens:function(i,u){return Nn(this,ct(i),u,!0)},getTokenTypeAt:function(i){i=v(this.doc,i);var u=tt(this,Pt(this.doc,i.line)),M=0,V=(u.length-1)/2,Z=i.ch,ee;if(Z==0)ee=u[2];else for(;;){var ie=M+V>>1;if((ie?u[ie*2-1]:0)>=Z)V=ie;else if(u[ie*2+1]<Z)M=ie+1;else{ee=u[ie*2+2];break}}var Te=ee?ee.indexOf("overlay "):-1;return Te<0?ee:Te==0?null:ee.slice(0,Te-1)},getModeAt:function(i){var u=this.doc.mode;return u.innerMode?e.innerMode(u,this.getTokenAt(i).state).mode:u},getHelper:function(i,u){return this.getHelpers(i,u)[0]},getHelpers:function(i,u){var M=[];if(!r.hasOwnProperty(u))return M;var V=r[u],Z=this.getModeAt(i);if(typeof Z[u]=="string")V[Z[u]]&&M.push(V[Z[u]]);else if(Z[u])for(var ee=0;ee<Z[u].length;ee++){var ie=V[Z[u][ee]];ie&&M.push(ie)}else Z.helperType&&V[Z.helperType]?M.push(V[Z.helperType]):V[Z.name]&&M.push(V[Z.name]);for(var Te=0;Te<V._global.length;Te++){var Le=V._global[Te];Le.pred(Z,this)&&oe(M,Le.val)==-1&&M.push(Le.val)}return M},getStateAfter:function(i,u){var M=this.doc;return i=X(M,i==null?M.first+M.size-1:i),Ot(this,i+1,u).state},cursorCoords:function(i,u){var M,V=this.doc.sel.primary();return i==null?M=V.head:typeof i=="object"?M=v(this.doc,i):M=i?V.from():V.to(),Tn(this,M,u||"page")},charCoords:function(i,u){return Ti(this,v(this.doc,i),u||"page")},coordsChar:function(i,u){return i=An(this,i,u||"page"),Zn(this,i.left,i.top)},lineAtHeight:function(i,u){return i=An(this,{top:i,left:0},u||"page").top,Bi(this.doc,i+this.display.viewOffset)},heightAtLine:function(i,u,M){var V=!1,Z;if(typeof i=="number"){var ee=this.doc.first+this.doc.size-1;i<this.doc.first?i=this.doc.first:i>ee&&(i=ee,V=!0),Z=Pt(this.doc,i)}else Z=i;return oi(this,Z,{top:0,left:0},u||"page",M||V).top+(V?this.doc.height-rn(Z):0)},defaultTextHeight:function(){return Si(this.display)},defaultCharWidth:function(){return Ci(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(i,u,M,V,Z){var ee=this.display;i=Tn(this,v(this.doc,i));var ie=i.bottom,Te=i.left;if(u.style.position="absolute",u.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(u),ee.sizer.appendChild(u),V=="over")ie=i.top;else if(V=="above"||V=="near"){var Le=Math.max(ee.wrapper.clientHeight,this.doc.height),Xe=Math.max(ee.sizer.clientWidth,ee.lineSpace.clientWidth);(V=="above"||i.bottom+u.offsetHeight>Le)&&i.top>u.offsetHeight?ie=i.top-u.offsetHeight:i.bottom+u.offsetHeight<=Le&&(ie=i.bottom),Te+u.offsetWidth>Xe&&(Te=Xe-u.offsetWidth)}u.style.top=ie+"px",u.style.left=u.style.right="",Z=="right"?(Te=ee.sizer.clientWidth-u.offsetWidth,u.style.right="0px"):(Z=="left"?Te=0:Z=="middle"&&(Te=(ee.sizer.clientWidth-u.offsetWidth)/2),u.style.left=Te+"px"),M&&za(this,{left:Te,top:ie,right:Te+u.offsetWidth,bottom:ie+u.offsetHeight})},triggerOnKeyDown:Sr(Js),triggerOnKeyPress:Sr(qs),triggerOnKeyUp:Zs,triggerOnMouseDown:Sr(el),execCommand:function(i){if(Bo.hasOwnProperty(i))return Bo[i].call(null,this)},triggerElectric:Sr(function(i){sl(this,i)}),findPosH:function(i,u,M,V){var Z=1;u<0&&(Z=-1,u=-u);for(var ee=v(this.doc,i),ie=0;ie<u&&!(ee=ps(this.doc,ee,Z,M,V),ee.hitSide);++ie);return ee},moveH:Sr(function(i,u){var M=this;this.extendSelectionsBy(function(V){return M.display.shift||M.doc.extend||V.empty()?ps(M.doc,V.head,i,u,M.options.rtlMoveVisually):i<0?V.from():V.to()},We)}),deleteH:Sr(function(i,u){var M=this.doc.sel,V=this.doc;M.somethingSelected()?V.replaceSelection("",null,"+delete"):To(this,function(Z){var ee=ps(V,Z.head,i,u,!1);return i<0?{from:ee,to:Z.head}:{from:Z.head,to:ee}})}),findPosV:function(i,u,M,V){var Z=1,ee=V;u<0&&(Z=-1,u=-u);for(var ie=v(this.doc,i),Te=0;Te<u;++Te){var Le=Tn(this,ie,"div");if(ee==null?ee=Le.left:Le.left=ee,ie=dl(this,Le,Z,M),ie.hitSide)break}return ie},moveV:Sr(function(i,u){var M=this,V=this.doc,Z=[],ee=!this.display.shift&&!V.extend&&V.sel.somethingSelected();if(V.extendSelectionsBy(function(Te){if(ee)return i<0?Te.from():Te.to();var Le=Tn(M,Te.head,"div");Te.goalColumn!=null&&(Le.left=Te.goalColumn),Z.push(Le.left);var Xe=dl(M,Le,i,u);return u=="page"&&Te==V.sel.primary()&&Va(M,Ti(M,Xe,"div").top-Le.top),Xe},We),Z.length)for(var ie=0;ie<V.sel.ranges.length;ie++)V.sel.ranges[ie].goalColumn=Z[ie]}),findWordAt:function(i){var u=this.doc,M=Pt(u,i.line).text,V=i.ch,Z=i.ch;if(M){var ee=this.getHelper(i,"wordChars");(i.sticky=="before"||Z==M.length)&&V?--V:++Z;for(var ie=M.charAt(V),Te=ot(ie,ee)?function(Le){return ot(Le,ee)}:/\s/.test(ie)?function(Le){return/\s/.test(Le)}:function(Le){return!/\s/.test(Le)&&!ot(Le)};V>0&&Te(M.charAt(V-1));)--V;for(;Z<M.length&&Te(M.charAt(Z));)++Z}return new ki(ct(i.line,V),ct(i.line,Z))},toggleOverwrite:function(i){if(i!=null&&i==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?N(this.display.cursorDiv,"CodeMirror-overwrite"):_(this.display.cursorDiv,"CodeMirror-overwrite"),qe(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==j()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Sr(function(i,u){Aa(this,i,u)}),getScrollInfo:function(){var i=this.display.scroller;return{left:i.scrollLeft,top:i.scrollTop,height:i.scrollHeight-Pe(this)-this.display.barHeight,width:i.scrollWidth-Pe(this)-this.display.barWidth,clientHeight:ne(this),clientWidth:ge(this)}},scrollIntoView:Sr(function(i,u){i==null?(i={from:this.doc.sel.primary().head,to:null},u==null&&(u=this.options.cursorScrollMargin)):typeof i=="number"?i={from:ct(i,0),to:null}:i.from==null&&(i={from:i,to:null}),i.to||(i.to=i.from),i.margin=u||0,i.from.line!=null?ho(this,i):Ra(this,i.from,i.to,i.margin)}),setSize:Sr(function(i,u){var M=this,V=function(ee){return typeof ee=="number"||/^\d+$/.test(String(ee))?ee+"px":ee};i!=null&&(this.display.wrapper.style.width=V(i)),u!=null&&(this.display.wrapper.style.height=V(u)),this.options.lineWrapping&&On(this);var Z=this.display.viewFrom;this.doc.iter(Z,this.display.viewTo,function(ee){if(ee.widgets){for(var ie=0;ie<ee.widgets.length;ie++)if(ee.widgets[ie].noHScroll){Vi(M,Z,"widget");break}}++Z}),this.curOp.forceUpdate=!0,qe(this,"refresh",this)}),operation:function(i){return jr(this,i)},startOperation:function(){return sa(this)},endOperation:function(){return Ea(this)},refresh:Sr(function(){var i=this.display.cachedTextHeight;Ki(this),this.curOp.forceUpdate=!0,Jn(this),Aa(this,this.doc.scrollLeft,this.doc.scrollTop),Za(this.display),(i==null||Math.abs(i-Si(this.display))>.5||this.options.lineWrapping)&&Pr(this),qe(this,"refresh",this)}),swapDoc:Sr(function(i){var u=this.doc;return u.cm=null,this.state.selectingText&&this.state.selectingText(),vs(this,i),Jn(this),this.display.input.reset(),Aa(this,i.scrollLeft,i.scrollTop),this.curOp.forceScroll=!0,jn(this,"swapDoc",this,u),u}),phrase:function(i){var u=this.options.phrases;return u&&Object.prototype.hasOwnProperty.call(u,i)?u[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}},Ie(e),e.registerHelper=function(i,u,M){r.hasOwnProperty(i)||(r[i]=e[i]={_global:[]}),r[i][u]=M},e.registerGlobalHelper=function(i,u,M,V){e.registerHelper(i,u,V),r[i]._global.push({pred:M,val:V})}}function ps(e,t,r,i,u){var M=t,V=r,Z=Pt(e,t.line),ee=u&&e.direction=="rtl"?-r:r;function ie(){var fn=t.line+ee;return fn<e.first||fn>=e.first+e.size?!1:(t=new ct(fn,t.ch,t.sticky),Z=Pt(e,fn))}function Te(fn){var tn;if(i=="codepoint"){var _n=Z.text.charCodeAt(t.ch+(i>0?0:-1));isNaN(_n)?tn=null:tn=new ct(t.line,Math.max(0,Math.min(Z.text.length,t.ch+r*(_n>=55296&&_n<56320?2:1))),-r)}else u?tn=Ml(e.cm,Z,t,r):tn=ss(Z,t,r);if(tn==null)if(!fn&&ie())t=ls(u,e.cm,Z,t.line,ee);else return!1;else t=tn;return!0}if(i=="char"||i=="codepoint")Te();else if(i=="column")Te(!0);else if(i=="word"||i=="group")for(var Le=null,Xe=i=="group",Ve=e.cm&&e.cm.getHelper(t,"wordChars"),gt=!0;!(r<0&&!Te(!gt));gt=!1){var Rt=Z.text.charAt(t.ch)||`
|
|
`,Ut=ot(Rt,Ve)?"w":Xe&&Rt==`
|
|
`?"n":!Xe||/\s/.test(Rt)?null:"p";if(Xe&&!gt&&!Ut&&(Ut="s"),Le&&Le!=Ut){r<0&&(r=1,Te(),t.sticky="after");break}if(Ut&&(Le=Ut),r>0&&!Te(!gt))break}var en=Xo(e,t,M,V,!0);return Ei(M,en)&&(en.hitSide=!0),en}function dl(e,t,r,i){var u=e.doc,M=t.left,V;if(i=="page"){var Z=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),ee=Math.max(Z-.5*Si(e.display),3);V=(r>0?t.bottom:t.top)+r*ee}else i=="line"&&(V=r>0?t.bottom+3:t.top-3);for(var ie;!(ie=Zn(e,M,V),!ie.outside);){if(r<0?V<=0:V>=u.height){ie.hitSide=!0;break}V+=r*5}return ie}var Zi=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new J,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Zi.prototype.init=function(e){var t=this,r=this,i=r.cm,u=r.div=e.lineDiv;ul(u,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize);function M(Z){for(var ee=Z.target;ee;ee=ee.parentNode){if(ee==u)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(ee.className))break}return!1}it(u,"paste",function(Z){if(!M(Z)||wt(i,Z)||ol(Z,i))return;I<=11&&setTimeout(cr(i,function(){return t.updateFromDOM()}),20)}),it(u,"compositionstart",function(Z){t.composing={data:Z.data,done:!1}}),it(u,"compositionupdate",function(Z){t.composing||(t.composing={data:Z.data,done:!1})}),it(u,"compositionend",function(Z){t.composing&&(Z.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),it(u,"touchstart",function(){return r.forceCompositionEnd()}),it(u,"input",function(){t.composing||t.readFromDOMSoon()});function V(Z){if(!M(Z)||wt(i,Z))return;if(i.somethingSelected())es({lineWise:!1,text:i.getSelections()}),Z.type=="cut"&&i.replaceSelection("",null,"cut");else if(i.options.lineWiseCopyCut){var ee=ll(i);es({lineWise:!0,text:ee.text}),Z.type=="cut"&&i.operation(function(){i.setSelections(ee.ranges,0,_e),i.replaceSelection("",null,"cut")})}else return;if(Z.clipboardData){Z.clipboardData.clearData();var ie=Ta.text.join(`
|
|
`);if(Z.clipboardData.setData("Text",ie),Z.clipboardData.getData("Text")==ie){Z.preventDefault();return}}var Te=cl(),Le=Te.firstChild;i.display.lineSpace.insertBefore(Te,i.display.lineSpace.firstChild),Le.value=Ta.text.join(`
|
|
`);var Xe=document.activeElement;W(Le),setTimeout(function(){i.display.lineSpace.removeChild(Te),Xe.focus(),Xe==u&&r.showPrimarySelection()},50)}it(u,"copy",V),it(u,"cut",V)},Zi.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Zi.prototype.prepareSelection=function(){var e=Qr(this.cm,!1);return e.focus=document.activeElement==this.div,e},Zi.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Zi.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Zi.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),i=r.from(),u=r.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||u.line<t.display.viewFrom){e.removeAllRanges();return}var M=ts(t,e.anchorNode,e.anchorOffset),V=ts(t,e.focusNode,e.focusOffset);if(M&&!M.bad&&V&&!V.bad&&Zt(ii(M,V),i)==0&&Zt(ri(M,V),u)==0)return;var Z=t.display.view,ee=i.line>=t.display.viewFrom&&hl(t,i)||{node:Z[0].measure.map[2],offset:0},ie=u.line<t.display.viewTo&&hl(t,u);if(!ie){var Te=Z[Z.length-1].measure,Le=Te.maps?Te.maps[Te.maps.length-1]:Te.map;ie={node:Le[Le.length-1],offset:Le[Le.length-2]-Le[Le.length-3]}}if(!ee||!ie){e.removeAllRanges();return}var Xe=e.rangeCount&&e.getRangeAt(0),Ve;try{Ve=m(ee.node,ee.offset,ie.offset,ie.node)}catch(gt){}Ve&&(!P&&t.state.focused?(e.collapse(ee.node,ee.offset),Ve.collapsed||(e.removeAllRanges(),e.addRange(Ve))):(e.removeAllRanges(),e.addRange(Ve)),Xe&&e.anchorNode==null?e.addRange(Xe):P&&this.startGracePeriod()),this.rememberSelection()},Zi.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Zi.prototype.showMultipleSelections=function(e){y(this.cm.display.cursorDiv,e.cursors),y(this.cm.display.selectionDiv,e.selection)},Zi.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Zi.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return T(this.div,t)},Zi.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Zi.prototype.blur=function(){this.div.blur()},Zi.prototype.getField=function(){return this.div},Zi.prototype.supportsTouch=function(){return!0},Zi.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():jr(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},Zi.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Zi.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(s&&g&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var r=ts(t,e.anchorNode,e.anchorOffset),i=ts(t,e.focusNode,e.focusOffset);r&&i&&jr(t,function(){zr(t.doc,an(r,i),_e),(r.bad||i.bad)&&(t.curOp.selectionChanged=!0)})},Zi.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,r=e.doc.sel.primary(),i=r.from(),u=r.to();if(i.ch==0&&i.line>e.firstLine()&&(i=ct(i.line-1,Pt(e.doc,i.line-1).length)),u.ch==Pt(e.doc,u.line).text.length&&u.line<e.lastLine()&&(u=ct(u.line+1,0)),i.line<t.viewFrom||u.line>t.viewTo-1)return!1;var M,V,Z;i.line==t.viewFrom||(M=Qi(e,i.line))==0?(V=vn(t.view[0].line),Z=t.view[0].node):(V=vn(t.view[M].line),Z=t.view[M-1].node.nextSibling);var ee=Qi(e,u.line),ie,Te;if(ee==t.view.length-1?(ie=t.viewTo-1,Te=t.lineDiv.lastChild):(ie=vn(t.view[ee+1].line)-1,Te=t.view[ee+1].node.previousSibling),!Z)return!1;for(var Le=e.doc.splitLines(tu(e,Z,Te,V,ie)),Xe=Mi(e.doc,ct(V,0),ct(ie,Pt(e.doc,ie).text.length));Le.length>1&&Xe.length>1;)if(ae(Le)==ae(Xe))Le.pop(),Xe.pop(),ie--;else if(Le[0]==Xe[0])Le.shift(),Xe.shift(),V++;else break;for(var Ve=0,gt=0,Rt=Le[0],Ut=Xe[0],en=Math.min(Rt.length,Ut.length);Ve<en&&Rt.charCodeAt(Ve)==Ut.charCodeAt(Ve);)++Ve;for(var fn=ae(Le),tn=ae(Xe),_n=Math.min(fn.length-(Le.length==1?Ve:0),tn.length-(Xe.length==1?Ve:0));gt<_n&&fn.charCodeAt(fn.length-gt-1)==tn.charCodeAt(tn.length-gt-1);)++gt;if(Le.length==1&&Xe.length==1&&V==i.line)for(;Ve&&Ve>i.ch&&fn.charCodeAt(fn.length-gt-1)==tn.charCodeAt(tn.length-gt-1);)Ve--,gt++;Le[Le.length-1]=fn.slice(0,fn.length-gt).replace(/^\u200b+/,""),Le[0]=Le[0].slice(Ve).replace(/\u200b+$/,"");var $n=ct(V,Ve),Pn=ct(ie,Xe.length?ae(Xe).length-gt:0);if(Le.length>1||Le[0]||Zt($n,Pn))return bo(e.doc,Le,$n,Pn,"+input"),!0},Zi.prototype.ensurePolled=function(){this.forceCompositionEnd()},Zi.prototype.reset=function(){this.forceCompositionEnd()},Zi.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Zi.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)},Zi.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&jr(this.cm,function(){return Ki(e.cm)})},Zi.prototype.setUneditable=function(e){e.contentEditable="false"},Zi.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||cr(this.cm,fs)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Zi.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Zi.prototype.onContextMenu=function(){},Zi.prototype.resetPosition=function(){},Zi.prototype.needsContentAttribute=!0;function hl(e,t){var r=He(e,t.line);if(!r||r.hidden)return null;var i=Pt(e.doc,t.line),u=re(r,i,t.line),M=Xt(i,e.doc.direction),V="left";if(M){var Z=Tt(M,t.ch);V=Z%2?"right":"left"}var ee=vt(u.map,t.ch,V);return ee.offset=ee.collapse=="right"?ee.end:ee.start,ee}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function wo(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,i,u){var M="",V=!1,Z=e.doc.lineSeparator(),ee=!1;function ie(Ve){return function(gt){return gt.id==Ve}}function Te(){V&&(M+=Z,ee&&(M+=Z),V=ee=!1)}function Le(Ve){Ve&&(Te(),M+=Ve)}function Xe(Ve){if(Ve.nodeType==1){var gt=Ve.getAttribute("cm-text");if(gt){Le(gt);return}var Rt=Ve.getAttribute("cm-marker"),Ut;if(Rt){var en=e.findMarks(ct(i,0),ct(u+1,0),ie(+Rt));en.length&&(Ut=en[0].find(0))&&Le(Mi(e.doc,Ut.from,Ut.to).join(Z));return}if(Ve.getAttribute("contenteditable")=="false")return;var fn=/^(pre|div|p|li|table|br)$/i.test(Ve.nodeName);if(!/^br$/i.test(Ve.nodeName)&&Ve.textContent.length==0)return;fn&&Te();for(var tn=0;tn<Ve.childNodes.length;tn++)Xe(Ve.childNodes[tn]);/^(pre|p)$/i.test(Ve.nodeName)&&(ee=!0),fn&&(V=!0)}else Ve.nodeType==3&&Le(Ve.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Xe(t),t==r);)t=t.nextSibling,ee=!1;return M}function ts(e,t,r){var i;if(t==e.display.lineDiv){if(i=e.display.lineDiv.childNodes[r],!i)return wo(e.clipPos(ct(e.display.viewTo-1)),!0);t=null,r=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var u=0;u<e.display.view.length;u++){var M=e.display.view[u];if(M.node==i)return nu(M,t,r)}}function nu(e,t,r){var i=e.text.firstChild,u=!1;if(!t||!T(i,t))return wo(ct(vn(e.line),0),!0);if(t==i&&(u=!0,t=i.childNodes[r],r=0,!t)){var M=e.rest?ae(e.rest):e.line;return wo(ct(vn(M),M.text.length),u)}var V=t.nodeType==3?t:null,Z=t;for(!V&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(V=t.firstChild,r&&(r=V.nodeValue.length));Z.parentNode!=i;)Z=Z.parentNode;var ee=e.measure,ie=ee.maps;function Te(Ut,en,fn){for(var tn=-1;tn<(ie?ie.length:0);tn++)for(var _n=tn<0?ee.map:ie[tn],$n=0;$n<_n.length;$n+=3){var Pn=_n[$n+2];if(Pn==Ut||Pn==en){var yi=vn(tn<0?e.line:e.rest[tn]),nr=_n[$n]+fn;return(fn<0||Pn!=Ut)&&(nr=_n[$n+(fn?1:0)]),ct(yi,nr)}}}var Le=Te(V,Z,r);if(Le)return wo(Le,u);for(var Xe=Z.nextSibling,Ve=V?V.nodeValue.length-r:0;Xe;Xe=Xe.nextSibling){if(Le=Te(Xe,Xe.firstChild,0),Le)return wo(ct(Le.line,Le.ch-Ve),u);Ve+=Xe.textContent.length}for(var gt=Z.previousSibling,Rt=r;gt;gt=gt.previousSibling){if(Le=Te(gt,gt.firstChild,-1),Le)return wo(ct(Le.line,Le.ch+Rt),u);Rt+=gt.textContent.length}}var Tr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new J,this.hasSelection=!1,this.composing=null};Tr.prototype.init=function(e){var t=this,r=this,i=this.cm;this.createField(e);var u=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),c&&(u.style.width="0px"),it(u,"input",function(){H&&I>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),it(u,"paste",function(V){if(wt(i,V)||ol(V,i))return;i.state.pasteIncoming=+new Date,r.fastPoll()});function M(V){if(wt(i,V))return;if(i.somethingSelected())es({lineWise:!1,text:i.getSelections()});else if(i.options.lineWiseCopyCut){var Z=ll(i);es({lineWise:!0,text:Z.text}),V.type=="cut"?i.setSelections(Z.ranges,null,_e):(r.prevInput="",u.value=Z.text.join(`
|
|
`),W(u))}else return;V.type=="cut"&&(i.state.cutIncoming=+new Date)}it(u,"cut",M),it(u,"copy",M),it(e.scroller,"paste",function(V){if(kr(e,V)||wt(i,V))return;if(!u.dispatchEvent){i.state.pasteIncoming=+new Date,r.focus();return}var Z=new Event("paste");Z.clipboardData=V.clipboardData,u.dispatchEvent(Z)}),it(e.lineSpace,"selectstart",function(V){kr(e,V)||se(V)}),it(u,"compositionstart",function(){var V=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:V,range:i.markText(V,i.getCursor("to"),{className:"CodeMirror-composing"})}}),it(u,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Tr.prototype.createField=function(e){this.wrapper=cl(),this.textarea=this.wrapper.firstChild},Tr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Tr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,i=Qr(e);if(e.options.moveInputWithCursor){var u=Tn(e,r.sel.primary().head,"div"),M=t.wrapper.getBoundingClientRect(),V=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,u.top+V.top-M.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,u.left+V.left-M.left))}return i},Tr.prototype.showSelection=function(e){var t=this.cm,r=t.display;y(r.cursorDiv,e.cursors),y(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Tr.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&&W(this.textarea),H&&I>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",H&&I>=9&&(this.hasSelection=null))},Tr.prototype.getField=function(){return this.textarea},Tr.prototype.supportsTouch=function(){return!1},Tr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||j()!=this.textarea))try{this.textarea.focus()}catch(e){}},Tr.prototype.blur=function(){this.textarea.blur()},Tr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Tr.prototype.receivedFocus=function(){this.slowPoll()},Tr.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()})},Tr.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)},Tr.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||sn(r)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var u=r.value;if(u==i&&!t.somethingSelected())return!1;if(H&&I>=9&&this.hasSelection===u||o&&/[\uf700-\uf7ff]/.test(u))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var M=u.charCodeAt(0);if(M==8203&&!i&&(i="\u200B"),M==8666)return this.reset(),this.cm.execCommand("undo")}for(var V=0,Z=Math.min(i.length,u.length);V<Z&&i.charCodeAt(V)==u.charCodeAt(V);)++V;return jr(t,function(){fs(t,u.slice(V),i.length-V,null,e.composing?"*compose":null),u.length>1e3||u.indexOf(`
|
|
`)>-1?r.value=e.prevInput="":e.prevInput=u,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Tr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Tr.prototype.onKeyPress=function(){H&&I>=9&&(this.hasSelection=null),this.fastPoll()},Tr.prototype.onContextMenu=function(e){var t=this,r=t.cm,i=r.display,u=t.textarea;t.contextMenuPending&&t.contextMenuPending();var M=Er(r,e),V=i.scroller.scrollTop;if(!M||p)return;var Z=r.options.resetSelectionOnContextMenu;Z&&r.doc.sel.contains(M)==-1&&cr(r,zr)(r.doc,an(M),_e);var ee=u.style.cssText,ie=t.wrapper.style.cssText,Te=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",u.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-Te.top-5)+"px; left: "+(e.clientX-Te.left-5)+`px;
|
|
z-index: 1000; background: `+(H?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var Le;F&&(Le=window.scrollY),i.input.focus(),F&&window.scrollTo(null,Le),i.input.reset(),r.somethingSelected()||(u.value=t.prevInput=" "),t.contextMenuPending=Ve,i.selForContextMenu=r.doc.sel,clearTimeout(i.detectingSelectAll);function Xe(){if(u.selectionStart!=null){var Rt=r.somethingSelected(),Ut="\u200B"+(Rt?u.value:"");u.value="\u21DA",u.value=Ut,t.prevInput=Rt?"":"\u200B",u.selectionStart=1,u.selectionEnd=Ut.length,i.selForContextMenu=r.doc.sel}}function Ve(){if(t.contextMenuPending!=Ve)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ie,u.style.cssText=ee,H&&I<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=V),u.selectionStart!=null){(!H||H&&I<9)&&Xe();var Rt=0,Ut=function(){i.selForContextMenu==r.doc.sel&&u.selectionStart==0&&u.selectionEnd>0&&t.prevInput=="\u200B"?cr(r,Ds)(r):Rt++<10?i.detectingSelectAll=setTimeout(Ut,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(Ut,200)}}if(H&&I>=9&&Xe(),A){Se(e);var gt=function(){Kt(window,"mouseup",gt),setTimeout(Ve,20)};it(window,"mouseup",gt)}else setTimeout(Ve,50)},Tr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Tr.prototype.setUneditable=function(){},Tr.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?b(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=j();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function i(){e.value=Z.getValue()}var u;if(e.form&&(it(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var M=e.form;u=M.submit;try{var V=M.submit=function(){i(),M.submit=u,M.submit(),M.submit=V}}catch(ee){}}t.finishInit=function(ee){ee.save=i,ee.getTextArea=function(){return e},ee.toTextArea=function(){ee.toTextArea=isNaN,i(),e.parentNode.removeChild(ee.getWrapperElement()),e.style.display="",e.form&&(Kt(e.form,"submit",i),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=u))}},e.style.display="none";var Z=hr(function(ee){return e.parentNode.insertBefore(ee,e.nextSibling)},t);return Z}function ru(e){e.off=Kt,e.on=it,e.wheelEventPixels=ja,e.Doc=qr,e.splitLines=Ln,e.countColumn=G,e.findColumn=Ue,e.isWordChar=Qe,e.Pass=Ne,e.signal=qe,e.Line=bn,e.changeEnd=xn,e.scrollbarModel=$a,e.Pos=ct,e.cmpPos=Zt,e.modes=Oi,e.mimeModes=Qn,e.resolveMode=It,e.getMode=Hn,e.modeExtensions=li,e.extendMode=Gt,e.copyState=Bt,e.startState=Wn,e.innerMode=Rn,e.commands=Bo,e.keyMap=Ka,e.keyName=Vs,e.isModifierKey=Gs,e.lookupKey=xo,e.normalizeKeyMap=kl,e.StringStream=nn,e.SharedTextMarker=No,e.TextMarker=qa,e.LineWidget=Po,e.e_preventDefault=se,e.e_stopPropagation=ce,e.e_stop=Se,e.addClass=N,e.contains=T,e.rmClass=_,e.keyNames=eo}$l(hr),ql(hr);var au="iter insert remove copy getEditor constructor".split(" ");for(var ns in qr.prototype)qr.prototype.hasOwnProperty(ns)&&oe(au,ns)<0&&(hr.prototype[ns]=function(e){return function(){return e.apply(this.doc,arguments)}}(qr.prototype[ns]));return Ie(qr),hr.inputStyles={textarea:Tr,contenteditable:Zi},hr.defineMode=function(e){!hr.defaults.mode&&e!="null"&&(hr.defaults.mode=e),ir.apply(this,arguments)},hr.defineMIME=qi,hr.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),hr.defineMIME("text/plain","null"),hr.defineExtension=function(e,t){hr.prototype[e]=t},hr.defineDocExtension=function(e,t){qr.prototype[e]=t},hr.fromTextArea=iu,ru(hr),hr.version="5.58.2",hr})},XeAg:function(Mt,_t,q){Mt.exports={wrap:"wrap___1LRVR",labelWrap:"labelWrap___2gHb9",label:"label___1qDBe",labelContent:"labelContent___1ReMX",flexRow:"flexRow___3Ab_g",color999:"color999___oq2Dh",radio:"radio___3QbqR"}},Y1PL:function(Mt,_t,q){"use strict";q.r(_t),q.d(_t,"ResizableTextArea",function(){return oe});var le=q("wx14"),Q=q("1OyB"),P=q("vuIU"),Y=q("Ji7U"),D=q("LK+K"),U=q("q1tI"),H=q("VTBJ"),I=q("rePB"),F=q("Zm9Q"),R=q("Kwbf"),g=q("c+Xe"),p=q("m+aA"),d=q("bdgK"),l=new Map;function n(_e){_e.forEach(function(Fe){var We,Ue=Fe.target;(We=l.get(Ue))===null||We===void 0||We.forEach(function(xe){return xe(Ue)})})}var c=new d.default(n),s=null,a=null;function o(_e,Fe){l.has(_e)||(l.set(_e,new Set),c.observe(_e)),l.get(_e).add(Fe)}function f(_e,Fe){l.has(_e)&&(l.get(_e).delete(Fe),l.get(_e).size||(c.unobserve(_e),l.delete(_e)))}var L=function(_e){Object(Y.a)(We,_e);var Fe=Object(D.a)(We);function We(){return Object(Q.a)(this,We),Fe.apply(this,arguments)}return Object(P.a)(We,[{key:"render",value:function(){return this.props.children}}]),We}(U.Component),C=U.createContext(null);function x(_e){var Fe=_e.children,We=_e.onBatchResize,Ue=U.useRef(0),xe=U.useRef([]),ue=U.useContext(C),ae=U.useCallback(function(Ee,de,Ke){Ue.current+=1;var Je=Ue.current;xe.current.push({size:Ee,element:de,data:Ke}),Promise.resolve().then(function(){Je===Ue.current&&(We==null||We(xe.current),xe.current=[])}),ue==null||ue(Ee,de,Ke)},[We,ue]);return U.createElement(C.Provider,{value:ae},Fe)}function A(_e){var Fe=_e.children,We=_e.disabled,Ue=U.useRef(null),xe=U.useRef(null),ue=U.useContext(C),ae=U.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Ee=U.isValidElement(Fe)&&Object(g.c)(Fe),de=Ee?Fe.ref:null,Ke=U.useMemo(function(){return Object(g.a)(de,Ue)},[de,Ue]),Je=U.useRef(_e);Je.current=_e;var je=U.useCallback(function(Qe){var ot=Je.current,st=ot.onResize,ht=ot.data,mt=Qe.getBoundingClientRect(),ft=mt.width,Ht=mt.height,Vt=Qe.offsetWidth,zt=Qe.offsetHeight,Tt=Math.floor(ft),hn=Math.floor(Ht);if(ae.current.width!==Tt||ae.current.height!==hn||ae.current.offsetWidth!==Vt||ae.current.offsetHeight!==zt){var Xt={width:Tt,height:hn,offsetWidth:Vt,offsetHeight:zt};ae.current=Xt;var Wt=Vt===Math.round(ft)?ft:Vt,it=zt===Math.round(Ht)?Ht:zt,un=Object(H.a)(Object(H.a)({},Xt),{},{offsetWidth:Wt,offsetHeight:it});ue==null||ue(un,Qe,ht),st&&Promise.resolve().then(function(){st(un,Qe)})}},[]);return U.useEffect(function(){var Qe=Object(p.a)(Ue.current)||Object(p.a)(xe.current);return Qe&&!We&&o(Qe,je),function(){return f(Qe,je)}},[Ue.current,We]),U.createElement(L,{ref:xe},Ee?U.cloneElement(Fe,{ref:Ke}):Fe)}var w="rc-observer-key";function _(_e){var Fe=_e.children,We=Object(F.a)(Fe);return We.map(function(Ue,xe){var ue=(Ue==null?void 0:Ue.key)||"".concat(w,"-").concat(xe);return U.createElement(A,Object(le.a)({},_e,{key:ue}),Ue)})}_.Collection=x;var S=_,y=q("bT9E"),h=q("TSYQ"),E=q.n(h),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
|
|
`,T=["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"],j={},N;function K(_e){var Fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,We=_e.getAttribute("id")||_e.getAttribute("data-reactid")||_e.getAttribute("name");if(Fe&&j[We])return j[We];var Ue=window.getComputedStyle(_e),xe=Ue.getPropertyValue("box-sizing")||Ue.getPropertyValue("-moz-box-sizing")||Ue.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(Ue.getPropertyValue("padding-bottom"))+parseFloat(Ue.getPropertyValue("padding-top")),ae=parseFloat(Ue.getPropertyValue("border-bottom-width"))+parseFloat(Ue.getPropertyValue("border-top-width")),Ee=T.map(function(Ke){return"".concat(Ke,":").concat(Ue.getPropertyValue(Ke))}).join(";"),de={sizingStyle:Ee,paddingSize:ue,borderSize:ae,boxSizing:xe};return Fe&&We&&(j[We]=de),de}function W(_e){var Fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,We=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Ue=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;N||(N=document.createElement("textarea"),N.setAttribute("tab-index","-1"),N.setAttribute("aria-hidden","true"),document.body.appendChild(N)),_e.getAttribute("wrap")?N.setAttribute("wrap",_e.getAttribute("wrap")):N.removeAttribute("wrap");var xe=K(_e,Fe),ue=xe.paddingSize,ae=xe.borderSize,Ee=xe.boxSizing,de=xe.sizingStyle;N.setAttribute("style","".concat(de,";").concat(m)),N.value=_e.value||_e.placeholder||"";var Ke=Number.MIN_SAFE_INTEGER,Je=Number.MAX_SAFE_INTEGER,je=N.scrollHeight,Qe;if(Ee==="border-box"?je+=ae:Ee==="content-box"&&(je-=ue),We!==null||Ue!==null){N.value=" ";var ot=N.scrollHeight-ue;We!==null&&(Ke=ot*We,Ee==="border-box"&&(Ke=Ke+ue+ae),je=Math.max(Ke,je)),Ue!==null&&(Je=ot*Ue,Ee==="border-box"&&(Je=Je+ue+ae),Qe=je>Je?"":"hidden",je=Math.min(Je,je))}return{height:je,minHeight:Ke,maxHeight:Je,overflowY:Qe,resize:"none"}}var k=q("Gytx"),b=q.n(k),G;(function(_e){_e[_e.NONE=0]="NONE",_e[_e.RESIZING=1]="RESIZING",_e[_e.RESIZED=2]="RESIZED"})(G||(G={}));var J=function(_e){Object(Y.a)(We,_e);var Fe=Object(D.a)(We);function We(Ue){var xe;return Object(Q.a)(this,We),xe=Fe.call(this,Ue),xe.nextFrameActionId=void 0,xe.resizeFrameId=void 0,xe.textArea=void 0,xe.saveTextArea=function(ue){xe.textArea=ue},xe.handleResize=function(ue){var ae=xe.state.resizeStatus,Ee=xe.props,de=Ee.autoSize,Ke=Ee.onResize;if(ae!==G.NONE)return;typeof Ke=="function"&&Ke(ue),de&&xe.resizeOnNextFrame()},xe.resizeOnNextFrame=function(){cancelAnimationFrame(xe.nextFrameActionId),xe.nextFrameActionId=requestAnimationFrame(xe.resizeTextarea)},xe.resizeTextarea=function(){var ue=xe.props.autoSize;if(!ue||!xe.textArea)return;var ae=ue.minRows,Ee=ue.maxRows,de=W(xe.textArea,!1,ae,Ee);xe.setState({textareaStyles:de,resizeStatus:G.RESIZING},function(){cancelAnimationFrame(xe.resizeFrameId),xe.resizeFrameId=requestAnimationFrame(function(){xe.setState({resizeStatus:G.RESIZED},function(){xe.resizeFrameId=requestAnimationFrame(function(){xe.setState({resizeStatus:G.NONE}),xe.fixFirefoxAutoScroll()})})})})},xe.renderTextArea=function(){var ue=xe.props,ae=ue.prefixCls,Ee=ae===void 0?"rc-textarea":ae,de=ue.autoSize,Ke=ue.onResize,Je=ue.className,je=ue.disabled,Qe=xe.state,ot=Qe.textareaStyles,st=Qe.resizeStatus,ht=Object(y.a)(xe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),mt=E()(Ee,Je,Object(I.a)({},"".concat(Ee,"-disabled"),je));"value"in ht&&(ht.value=ht.value||"");var ft=Object(H.a)(Object(H.a)(Object(H.a)({},xe.props.style),ot),st===G.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return U.createElement(S,{onResize:xe.handleResize,disabled:!(de||Ke)},U.createElement("textarea",Object(le.a)({},ht,{className:mt,style:ft,ref:xe.saveTextArea})))},xe.state={textareaStyles:{},resizeStatus:G.NONE},xe}return Object(P.a)(We,[{key:"componentDidUpdate",value:function(xe){(xe.value!==this.props.value||!b()(xe.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 xe=this.textArea.selectionStart,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(xe,ue)}}catch(ae){}}},{key:"render",value:function(){return this.renderTextArea()}}]),We}(U.Component),oe=J,fe=function(_e){Object(Y.a)(We,_e);var Fe=Object(D.a)(We);function We(Ue){var xe;Object(Q.a)(this,We),xe=Fe.call(this,Ue),xe.resizableTextArea=void 0,xe.focus=function(){xe.resizableTextArea.textArea.focus()},xe.saveTextArea=function(ae){xe.resizableTextArea=ae},xe.handleChange=function(ae){var Ee=xe.props.onChange;xe.setValue(ae.target.value,function(){xe.resizableTextArea.resizeTextarea()}),Ee&&Ee(ae)},xe.handleKeyDown=function(ae){var Ee=xe.props,de=Ee.onPressEnter,Ke=Ee.onKeyDown;ae.keyCode===13&&de&&de(ae),Ke&&Ke(ae)};var ue=typeof Ue.value=="undefined"||Ue.value===null?Ue.defaultValue:Ue.value;return xe.state={value:ue},xe}return Object(P.a)(We,[{key:"setValue",value:function(xe,ue){"value"in this.props||this.setState({value:xe},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return U.createElement(oe,Object(le.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(xe){return"value"in xe?{value:xe.value}:null}}]),We}(U.Component),Ne=_t.default=fe},ZW9T:function(Mt,_t,q){"use strict";q.d(_t,"a",function(){return W});var le=q("k1fw"),Q=q("miYZ"),P=q("tsqr"),Y=q("rAM+"),D=q("tJVT"),U=q("PpiC"),H=q("q1tI"),I=q.n(H),F=q("bdgK"),R=q("oBTY"),g=q("9og8"),p=q("WmNS"),d=q.n(p),l={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},n={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
|
|
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
|
|
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},c={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","for","friend","gcnew","generic","goto","if","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`)},{label:"#include",content:'include "$0"'},{label:"printf",content:"printf($0)"},{label:"main",content:["int main () {"," $0","}"].join(`
|
|
`)},{label:"for",content:["for( ; ; ){"," $0","}"].join(`
|
|
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
|
|
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
|
|
`)},{label:"#include <iostream>",content:["#include <iostream>"].join(`
|
|
`)},{label:"#include <vector>",content:["#include <vector>"].join(`
|
|
`)},{label:"#include <sstream>",content:["#include <sstream>"].join(`
|
|
`)},{label:"#include <string>",content:["#include <string>"].join(`
|
|
`)},{label:"#include <cmath>",content:["#include <cmath>"].join(`
|
|
`)}]},s={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
|
|
`)}]},a=q("5VLF"),o=q.n(a),f={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},L=function(b,G){return G.map(function(J){return{label:J,kind:b.languages.CompletionItemKind.Keyword,insertText:J}})},C=function(b){return Object.keys(f.tables).map(function(G){return{label:G,kind:b.languages.CompletionItemKind.Variable,insertText:G}})},x=function(b,G){var J=f.tables[b];return J?J.map(function(oe){return{label:oe,kind:G.languages.CompletionItemKind.Field,insertText:oe}}):[]};function A(k,b,G,J,oe){var fe=b.getWordUntilPosition(G),Ne={startLineNumber:G.lineNumber,endLineNumber:G.lineNumber,startColumn:fe.startColumn,endColumn:fe.endColumn},_e=J.map(function(Fe){return{label:Fe,kind:k.languages.CompletionItemKind.Keyword,insertText:Fe,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Ne}});return oe.map(function(Fe){_e.push(Object(le.a)(Object(le.a)({},Fe),{},{range:Ne}))}),_e}var w=function(k){f.languages.map(function(oe){return k.languages.registerDocumentFormattingEditProvider(oe,{provideDocumentFormattingEdits:function(Ne,_e,Fe){return Object(g.a)(d.a.mark(function We(){var Ue;return d.a.wrap(function(ue){for(;;)switch(ue.prev=ue.next){case 0:return Ue=o()(Ne.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:Ne.getFullModelRange(),text:Ue}]);case 2:case"end":return ue.stop()}},We)}))()}}),oe});var b=c.quickKey.map(function(oe){return{label:oe.label,kind:k.languages.CompletionItemKind.Method,insertText:oe.content,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),G=s.quickKey.map(function(oe){return{label:oe.label,kind:k.languages.CompletionItemKind.Method,insertText:oe.content,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet}}),J=n.quickKey.map(function(oe){return{label:oe.label,kind:k.languages.CompletionItemKind.Method,insertText:oe.content,insertTextRules:k.languages.CompletionItemInsertTextRule.InsertAsSnippet}});k.languages.registerCompletionItemProvider("cpp",{triggerCharacters:["."," ","#"].concat(Object(R.a)(c.keywords),Object(R.a)(c.quickKey.map(function(oe){return oe.label}))),provideCompletionItems:function(fe,Ne){var _e=fe.getValueInRange({startLineNumber:Ne.lineNumber,startColumn:1,endLineNumber:Ne.lineNumber,endColumn:Ne.column}),Fe=_e.match(/cu/gim);console.log("match:",Fe,Ne,_e,fe);var We=[],Ue=Ne.lineNumber,xe=Ne.column,ue=fe.getValueInRange({startLineNumber:Ue,startColumn:0,endLineNumber:Ue,endColumn:xe}),ae=ue.trim().split(/\s+/),Ee=ae[ae.length-1];if(Ee.endsWith(".")){var de=Ee.slice(0,Ee.length-1);Object.keys(f.tables).includes(de)&&(We=Object(R.a)(x(de,k)))}else Ee==="."?We=[]:We=[].concat(Object(R.a)(C(k)),Object(R.a)(L(k,c.keywords)),Object(R.a)(b));return{suggestions:We}}}),k.languages.registerCompletionItemProvider("c",{triggerCharacters:["."," ","#"].concat(Object(R.a)(l.keywords)),provideCompletionItems:function(fe,Ne){var _e=fe.getValueInRange({startLineNumber:Ne.lineNumber,startColumn:1,endLineNumber:Ne.lineNumber,endColumn:Ne.column}),Fe=_e.match(/cu/gim);console.log("match:",Fe,Ne,_e,fe);var We=[],Ue=Ne.lineNumber,xe=Ne.column,ue=fe.getValueInRange({startLineNumber:Ue,startColumn:0,endLineNumber:Ue,endColumn:xe}),ae=ue.trim().split(/\s+/),Ee=ae[ae.length-1];if(Ee.endsWith(".")){var de=Ee.slice(0,Ee.length-1);Object.keys(f.tables).includes(de)&&(We=Object(R.a)(x(de,k)))}else Ee==="."?We=[]:We=[].concat(Object(R.a)(C(k)),Object(R.a)(L(k,l.keywords)));return{suggestions:We}}}),k.languages.registerCompletionItemProvider("java",{triggerCharacters:["."," "].concat(Object(R.a)(n.keywords)),provideCompletionItems:function(fe,Ne){var _e=[],Fe=Ne.lineNumber,We=Ne.column,Ue=fe.getValueInRange({startLineNumber:Fe,startColumn:0,endLineNumber:Fe,endColumn:We}),xe=Ue.trim().split(/\s+/),ue=xe[xe.length-1];if(ue.endsWith(".")){var ae=ue.slice(0,ue.length-1);Object.keys(f.tables).includes(ae)&&(_e=Object(R.a)(x(ae,k)))}else ue==="."?_e=[]:_e=[].concat(Object(R.a)(C(k)),Object(R.a)(L(k,n.keywords)),Object(R.a)(J));return{suggestions:_e}}}),k.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "].concat(Object(R.a)(s.keywords)),provideCompletionItems:function(fe,Ne){var _e=[],Fe=Ne.lineNumber,We=Ne.column,Ue=fe.getValueInRange({startLineNumber:Fe,startColumn:0,endLineNumber:Fe,endColumn:We}),xe=Ue.trim().split(/\s+/),ue=xe[xe.length-1];if(ue.endsWith(".")){var ae=ue.slice(0,ue.length-1);Object.keys(f.tables).includes(ae)&&(_e=Object(R.a)(x(ae,k)))}else ue==="."?_e=[]:_e=[].concat(Object(R.a)(C(k)),Object(R.a)(L(k,s.keywords)),Object(R.a)(G));return{suggestions:_e}}})},_="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",S=q("LvDl"),y=q("+ua5");function h(k){return/^\d+$/.test(k)?"".concat(k,"px"):k}function E(){}var m=!1,T={"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 j(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],b=k;if(Array.isArray(k)){for(var G=0;G<k.length;G++){var J=T[k[G]];if(J)return J}return b[0]}return T[b]||b}var N=null,K=_t.b=function(k){var b=k.width,G=b===void 0?"100%":b,J=k.height,oe=J===void 0?"100%":J,fe=k.value,Ne=k.language,_e=Ne===void 0?"javascript":Ne,Fe=k.style,We=Fe===void 0?{}:Fe,Ue=k.options,xe=Ue===void 0?{}:Ue,ue=k.overrideServices,ae=ue===void 0?{}:ue,Ee=k.theme,de=Ee===void 0?"vs-dark":Ee,Ke=k.onEditBlur,Je=k.onSave,je=k.autoHeight,Qe=je===void 0?!1:je,ot=k.forbidCopy,st=ot===void 0?!1:ot,ht=k.onChange,mt=ht===void 0?E:ht,ft=k.editorDidMount,Ht=ft===void 0?E:ft,Vt=k.onFocus,zt=Vt===void 0?E:Vt,Tt=k.filename,hn=Tt===void 0?"educoder.txt":Tt,Xt=k.errorLine,Wt=k.errorContent,it=Wt===void 0?"":Wt,un=Object(U.a)(k,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Kt=Object(H.useRef)(),qe=Object(H.useRef)({}),wt=Object(H.useRef)(),Be=Object(H.useRef)(!1),Ae=Object(H.useRef)(),Ie=Object(H.useState)(!1),se=Object(D.a)(Ie,2),ce=se[0],ye=se[1];function Se(){var It;return Kt.current&&(It=new F.default(function(Hn){var li=Object(Y.a)(Hn),Gt;try{for(li.s();!(Gt=li.n()).done;){var Bt=Gt.value;(Bt.target.offsetHeight>0||Bt.target.offsetWidth>0)&&qe.current.instance.layout()}}catch(Rn){li.e(Rn)}finally{li.f()}}),It.observe(Kt.current)),It}function ke(){P.b.warn(decodeURIComponent(_))}var et=function(){var Hn=qe.current.instance;if(fe!=null&&Hn&&ce){var li=Hn.getModel();li&&fe!==li.getValue()&&(m=!0,li.setValue(fe),Hn.layout(),m=!1)}};Object(H.useEffect)(function(){wt.current&&clearTimeout(wt.current),wt.current=setTimeout(function(){et()},500)},[fe,ce,qe.current]),Object(H.useEffect)(function(){if(Xt&&qe.current&&qe.current.instance){var It=qe.current.instance;It.changeViewZones(function(li){var Gt=document.createElement("div");Gt.style.padding="10px 20px",Gt.style.width="calc(100% - 20px)",Gt.className="my-error-line-wrp",Gt.innerHTML=it,li.addZone({afterLineNumber:Xt||11,heightInLines:3,domNode:Gt})});var Hn={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};It.addOverlayWidget(Hn),It.revealPositionInCenter({lineNumber:20,column:1})}},[Xt,qe.current,ce]);function yt(){var It=qe.current.instance;if(It){var Hn=It.getSelection(),li=qe.current.pastePos||{},Gt=new N.Range(li.startLineNumber||Hn.endLineNumber,li.startColumn||Hn.endColumn,li.endLineNumber||Hn.endLineNumber,li.endColumn||Hn.endColumn);setTimeout(function(){It.executeEdits("",[{range:Gt,text:""}])},300)}}function $t(It){(window.navigator.platform.match("Mac")?It.metaKey:It.ctrlKey)&&It.keyCode==83&&(It.preventDefault(),Je())}var gn=function(){if(Qe&&qe.current.instance){var Hn=qe.current.instance.getContentHeight();ir(Hn<oe?oe:Hn)}else ir(oe)};function Dt(It){var Hn=document.createEvent("MouseEvents");Hn.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),It.dispatchEvent(Hn)}function zn(It,Hn){var li=window.URL||window.webkitURL||window,Gt=new Blob([Hn]),Bt=document.createElementNS("http://www.w3.org/1999/xhtml","a");Bt.href=li.createObjectURL(Gt),Bt.download=It,Dt(Bt)}Object(H.useEffect)(function(){gn()},[gn]),Object(H.useEffect)(function(){Kt.current&&!ce&&q.e(27).then(q.t.bind(null,"M/lh",7)).then(function(It){try{N=It,qe.current.instance=N.editor.create(Kt.current,{value:fe,language:j(_e),theme:de,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},ae);var Hn=qe.current.instance;if(Ht(Hn,N),setTimeout(function(){gn(),qe.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){zn(hn||"educoder.txt",Hn.getValue())}})},500),qe.current.subscription=Hn.onDidChangeModelContent(function(Gt){Be.current?clearTimeout(Ae.current):(gn(),mt(Hn.getValue(),Gt)),Ae.current=setTimeout(function(){Be.current=!1},500)}),window.Monaco||w(N),st&&(Hn.addCommand(N.KeyMod.CtrlCmd|N.KeyMod.Shift|N.KeyCode.KEY_V,function(){return ke(),null}),Hn.addCommand(N.KeyMod.CtrlCmd|N.KeyCode.KEY_C,function(){return ke(),null})),window.Monaco=N,Ke&&Hn.onDidBlurEditorWidget(function(){Ke(Hn.getValue())}),zt&&Hn.onDidFocusEditorText(function(){zt(Hn.getValue())}),st){Hn.addCommand(N.KeyMod.CtrlCmd|N.KeyCode.KEY_V,function(){return ke(),null}),Hn.onDidPaste(function(Gt){qe.current.pastePos=Gt});try{window.addEventListener("paste",yt)}catch(Gt){}}var li=Se();return ye(!0),function(){var Gt=qe.current.instance;Gt.dispose();var Bt=Gt.getModel();Bt&&Bt.dispose(),qe.current.subscription&&qe.current.subscription.dispose(),st&&window.removeEventListener("paste",yt),li.unobserve(Kt.current)}}catch(Gt){}})},[]),Object(H.useEffect)(function(){var It=qe.current.instance;if(It&&ce)return document.addEventListener("keydown",$t,!1),function(){document.removeEventListener("keydown",$t)}},[Je,ce]),Object(H.useEffect)(function(){var It=qe.current.instance;if(It&&ce){var Hn=j(_e);N.editor.setModelLanguage(It.getModel(),Hn),console.log("language:",_e,It.getModel(),Hn)}},[_e,ce]),Object(H.useEffect)(function(){var It=qe.current.instance;It&&ce&&N.editor.setTheme(de)},[de,ce]),Object(H.useEffect)(function(){var It=qe.current.instance;It&&ce&&(It.updateOptions(Object(le.a)({},xe)),setTimeout(function(){It.getModel().updateOptions(Object(le.a)({},xe))},200))},[JSON.stringify(xe),ce]),Object(H.useEffect)(function(){var It=qe.current.instance;It&&ce&&It.layout()},[G,oe,ce]);var Ln=Object(H.useState)(h(G)),sn=Object(D.a)(Ln,2),_i=sn[0],si=sn[1],zi=Object(H.useState)(h(oe)),Oi=Object(D.a)(zi,2),Qn=Oi[0],ir=Oi[1],qi=Object(le.a)(Object(le.a)({},We),{},{width:_i,height:Qn});return I.a.createElement("div",{className:"my-monaco-editor",ref:Kt,style:qi})};function W(k){var b=k.width,G=b===void 0?"100%":b,J=k.height,oe=J===void 0?"100%":J,fe=k.original,Ne=k.modified,_e=k.language,Fe=k.options,We=Fe===void 0?{}:Fe,Ue=Object(H.useRef)(),xe=Object(H.useState)(null),ue=Object(D.a)(xe,2),ae=ue[0],Ee=ue[1];function de(Qe){var ot;return Ue.current&&(ot=new F.default(function(st){var ht=Object(Y.a)(st),mt;try{for(ht.s();!(mt=ht.n()).done;){var ft=mt.value;(ft.target.offsetHeight>0||ft.target.offsetWidth>0)&&Qe.layout()}}catch(Ht){ht.e(Ht)}finally{ht.f()}}),ot.observe(Ue.current)),ot}Object(H.useEffect)(function(){Ue.current&&q.e(27).then(q.t.bind(null,"M/lh",7)).then(function(Qe){N=Qe;var ot=N.editor.createDiffEditor(Ue.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},We),{},{wordWrap:!0}));Ee(ot);var st=de(ot);return function(){ot.dispose();var ht=ot.getModel();ht&&ht.dispose(),st.unobserve(Ue.current)}})},[]),Object(H.useEffect)(function(){ae&&ae.setModel({original:N.editor.createModel(fe,_e),modified:N.editor.createModel(Ne,_e)})},[fe,Ne,_e,ae]);var Ke=h(G),Je=h(oe),je={width:Ke,height:Je};return I.a.createElement("div",{className:"my-diff-editor",ref:Ue,style:je})}},ZpRC:function(Mt,_t,q){"use strict";function le(g){return typeof g=="object"&&g!=null&&g.nodeType===1}function Q(g,p){return(!p||g!=="hidden")&&g!=="visible"&&g!=="clip"}function P(g,p){if(g.clientHeight<g.scrollHeight||g.clientWidth<g.scrollWidth){var d=getComputedStyle(g,null);return Q(d.overflowY,p)||Q(d.overflowX,p)||function(l){var n=function(c){if(!c.ownerDocument||!c.ownerDocument.defaultView)return null;try{return c.ownerDocument.defaultView.frameElement}catch(s){return null}}(l);return!!n&&(n.clientHeight<l.scrollHeight||n.clientWidth<l.scrollWidth)}(g)}return!1}function Y(g,p,d,l,n,c,s,a){return c<g&&s>p||c>g&&s<p?0:c<=g&&a<=d||s>=p&&a>=d?c-g-l:s>p&&a<d||c<g&&a>d?s-p+n:0}var D=function(g,p){var d=window,l=p.scrollMode,n=p.block,c=p.inline,s=p.boundary,a=p.skipOverflowHiddenElements,o=typeof s=="function"?s:function(ot){return ot!==s};if(!le(g))throw new TypeError("Invalid target");for(var f=document.scrollingElement||document.documentElement,L=[],C=g;le(C)&&o(C);){if((C=C.parentElement)===f){L.push(C);break}C!=null&&C===document.body&&P(C)&&!P(document.documentElement)||C!=null&&P(C,a)&&L.push(C)}for(var x=d.visualViewport?d.visualViewport.width:innerWidth,A=d.visualViewport?d.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,_=window.scrollY||pageYOffset,S=g.getBoundingClientRect(),y=S.height,h=S.width,E=S.top,m=S.right,T=S.bottom,j=S.left,N=n==="start"||n==="nearest"?E:n==="end"?T:E+y/2,K=c==="center"?j+h/2:c==="end"?m:j,W=[],k=0;k<L.length;k++){var b=L[k],G=b.getBoundingClientRect(),J=G.height,oe=G.width,fe=G.top,Ne=G.right,_e=G.bottom,Fe=G.left;if(l==="if-needed"&&E>=0&&j>=0&&T<=A&&m<=x&&E>=fe&&T<=_e&&j>=Fe&&m<=Ne)return W;var We=getComputedStyle(b),Ue=parseInt(We.borderLeftWidth,10),xe=parseInt(We.borderTopWidth,10),ue=parseInt(We.borderRightWidth,10),ae=parseInt(We.borderBottomWidth,10),Ee=0,de=0,Ke="offsetWidth"in b?b.offsetWidth-b.clientWidth-Ue-ue:0,Je="offsetHeight"in b?b.offsetHeight-b.clientHeight-xe-ae:0;if(f===b)Ee=n==="start"?N:n==="end"?N-A:n==="nearest"?Y(_,_+A,A,xe,ae,_+N,_+N+y,y):N-A/2,de=c==="start"?K:c==="center"?K-x/2:c==="end"?K-x:Y(w,w+x,x,Ue,ue,w+K,w+K+h,h),Ee=Math.max(0,Ee+_),de=Math.max(0,de+w);else{Ee=n==="start"?N-fe-xe:n==="end"?N-_e+ae+Je:n==="nearest"?Y(fe,_e,J,xe,ae+Je,N,N+y,y):N-(fe+J/2)+Je/2,de=c==="start"?K-Fe-Ue:c==="center"?K-(Fe+oe/2)+Ke/2:c==="end"?K-Ne+ue+Ke:Y(Fe,Ne,oe,Ue,ue+Ke,K,K+h,h);var je=b.scrollLeft,Qe=b.scrollTop;N+=Qe-(Ee=Math.max(0,Math.min(Qe+Ee,b.scrollHeight-J+Je))),K+=je-(de=Math.max(0,Math.min(je+de,b.scrollWidth-oe+Ke)))}W.push({el:b,top:Ee,left:de})}return W};function U(g){return g===Object(g)&&Object.keys(g).length!==0}function H(g,p){p===void 0&&(p="auto");var d="scrollBehavior"in document.body.style;g.forEach(function(l){var n=l.el,c=l.top,s=l.left;n.scroll&&d?n.scroll({top:c,left:s,behavior:p}):(n.scrollTop=c,n.scrollLeft=s)})}function I(g){return g===!1?{block:"end",inline:"nearest"}:U(g)?g:{block:"start",inline:"nearest"}}function F(g,p){var d=!g.ownerDocument.documentElement.contains(g);if(U(p)&&typeof p.behavior=="function")return p.behavior(d?[]:D(g,p));if(d)return;var l=I(p);return H(D(g,l),l.behavior)}var R=_t.a=F},Zss7:function(Mt,_t,q){var le;(function(Q){var P=/^\s+/,Y=/\s+$/,D=0,U=Q.round,H=Q.min,I=Q.max,F=Q.random;function R(ae,Ee){if(ae=ae||"",Ee=Ee||{},ae instanceof R)return ae;if(!(this instanceof R))return new R(ae,Ee);var de=g(ae);this._originalInput=ae,this._r=de.r,this._g=de.g,this._b=de.b,this._a=de.a,this._roundA=U(100*this._a)/100,this._format=Ee.format||de.format,this._gradientType=Ee.gradientType,this._r<1&&(this._r=U(this._r)),this._g<1&&(this._g=U(this._g)),this._b<1&&(this._b=U(this._b)),this._ok=de.ok,this._tc_id=D++}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 ae=this.toRgb();return(ae.r*299+ae.g*587+ae.b*114)/1e3},getLuminance:function(){var ae=this.toRgb(),Ee,de,Ke,Je,je,Qe;return Ee=ae.r/255,de=ae.g/255,Ke=ae.b/255,Ee<=.03928?Je=Ee/12.92:Je=Q.pow((Ee+.055)/1.055,2.4),de<=.03928?je=de/12.92:je=Q.pow((de+.055)/1.055,2.4),Ke<=.03928?Qe=Ke/12.92:Qe=Q.pow((Ke+.055)/1.055,2.4),.2126*Je+.7152*je+.0722*Qe},setAlpha:function(ae){return this._a=W(ae),this._roundA=U(100*this._a)/100,this},toHsv:function(){var ae=n(this._r,this._g,this._b);return{h:ae.h*360,s:ae.s,v:ae.v,a:this._a}},toHsvString:function(){var ae=n(this._r,this._g,this._b),Ee=U(ae.h*360),de=U(ae.s*100),Ke=U(ae.v*100);return this._a==1?"hsv("+Ee+", "+de+"%, "+Ke+"%)":"hsva("+Ee+", "+de+"%, "+Ke+"%, "+this._roundA+")"},toHsl:function(){var ae=d(this._r,this._g,this._b);return{h:ae.h*360,s:ae.s,l:ae.l,a:this._a}},toHslString:function(){var ae=d(this._r,this._g,this._b),Ee=U(ae.h*360),de=U(ae.s*100),Ke=U(ae.l*100);return this._a==1?"hsl("+Ee+", "+de+"%, "+Ke+"%)":"hsla("+Ee+", "+de+"%, "+Ke+"%, "+this._roundA+")"},toHex:function(ae){return s(this._r,this._g,this._b,ae)},toHexString:function(ae){return"#"+this.toHex(ae)},toHex8:function(ae){return a(this._r,this._g,this._b,this._a,ae)},toHex8String:function(ae){return"#"+this.toHex8(ae)},toRgb:function(){return{r:U(this._r),g:U(this._g),b:U(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+U(this._r)+", "+U(this._g)+", "+U(this._b)+")":"rgba("+U(this._r)+", "+U(this._g)+", "+U(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:U(k(this._r,255)*100)+"%",g:U(k(this._g,255)*100)+"%",b:U(k(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+U(k(this._r,255)*100)+"%, "+U(k(this._g,255)*100)+"%, "+U(k(this._b,255)*100)+"%)":"rgba("+U(k(this._r,255)*100)+"%, "+U(k(this._g,255)*100)+"%, "+U(k(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:N[s(this._r,this._g,this._b,!0)]||!1},toFilter:function(ae){var Ee="#"+o(this._r,this._g,this._b,this._a),de=Ee,Ke=this._gradientType?"GradientType = 1, ":"";if(ae){var Je=R(ae);de="#"+o(Je._r,Je._g,Je._b,Je._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ke+"startColorstr="+Ee+",endColorstr="+de+")"},toString:function(ae){var Ee=!!ae;ae=ae||this._format;var de=!1,Ke=this._a<1&&this._a>=0,Je=!Ee&&Ke&&(ae==="hex"||ae==="hex6"||ae==="hex3"||ae==="hex4"||ae==="hex8"||ae==="name");return Je?ae==="name"&&this._a===0?this.toName():this.toRgbString():(ae==="rgb"&&(de=this.toRgbString()),ae==="prgb"&&(de=this.toPercentageRgbString()),(ae==="hex"||ae==="hex6")&&(de=this.toHexString()),ae==="hex3"&&(de=this.toHexString(!0)),ae==="hex4"&&(de=this.toHex8String(!0)),ae==="hex8"&&(de=this.toHex8String()),ae==="name"&&(de=this.toName()),ae==="hsl"&&(de=this.toHslString()),ae==="hsv"&&(de=this.toHsvString()),de||this.toHexString())},clone:function(){return R(this.toString())},_applyModification:function(ae,Ee){var de=ae.apply(null,[this].concat([].slice.call(Ee)));return this._r=de._r,this._g=de._g,this._b=de._b,this.setAlpha(de._a),this},lighten:function(){return this._applyModification(x,arguments)},brighten:function(){return this._applyModification(A,arguments)},darken:function(){return this._applyModification(w,arguments)},desaturate:function(){return this._applyModification(f,arguments)},saturate:function(){return this._applyModification(L,arguments)},greyscale:function(){return this._applyModification(C,arguments)},spin:function(){return this._applyModification(_,arguments)},_applyCombination:function(ae,Ee){return ae.apply(null,[this].concat([].slice.call(Ee)))},analogous:function(){return this._applyCombination(m,arguments)},complement:function(){return this._applyCombination(S,arguments)},monochromatic:function(){return this._applyCombination(T,arguments)},splitcomplement:function(){return this._applyCombination(E,arguments)},triad:function(){return this._applyCombination(y,arguments)},tetrad:function(){return this._applyCombination(h,arguments)}},R.fromRatio=function(ae,Ee){if(typeof ae=="object"){var de={};for(var Ke in ae)ae.hasOwnProperty(Ke)&&(Ke==="a"?de[Ke]=ae[Ke]:de[Ke]=Ne(ae[Ke]));ae=de}return R(ae,Ee)};function g(ae){var Ee={r:0,g:0,b:0},de=1,Ke=null,Je=null,je=null,Qe=!1,ot=!1;return typeof ae=="string"&&(ae=xe(ae)),typeof ae=="object"&&(Ue(ae.r)&&Ue(ae.g)&&Ue(ae.b)?(Ee=p(ae.r,ae.g,ae.b),Qe=!0,ot=String(ae.r).substr(-1)==="%"?"prgb":"rgb"):Ue(ae.h)&&Ue(ae.s)&&Ue(ae.v)?(Ke=Ne(ae.s),Je=Ne(ae.v),Ee=c(ae.h,Ke,Je),Qe=!0,ot="hsv"):Ue(ae.h)&&Ue(ae.s)&&Ue(ae.l)&&(Ke=Ne(ae.s),je=Ne(ae.l),Ee=l(ae.h,Ke,je),Qe=!0,ot="hsl"),ae.hasOwnProperty("a")&&(de=ae.a)),de=W(de),{ok:Qe,format:ae.format||ot,r:H(255,I(Ee.r,0)),g:H(255,I(Ee.g,0)),b:H(255,I(Ee.b,0)),a:de}}function p(ae,Ee,de){return{r:k(ae,255)*255,g:k(Ee,255)*255,b:k(de,255)*255}}function d(ae,Ee,de){ae=k(ae,255),Ee=k(Ee,255),de=k(de,255);var Ke=I(ae,Ee,de),Je=H(ae,Ee,de),je,Qe,ot=(Ke+Je)/2;if(Ke==Je)je=Qe=0;else{var st=Ke-Je;Qe=ot>.5?st/(2-Ke-Je):st/(Ke+Je);switch(Ke){case ae:je=(Ee-de)/st+(Ee<de?6:0);break;case Ee:je=(de-ae)/st+2;break;case de:je=(ae-Ee)/st+4;break}je/=6}return{h:je,s:Qe,l:ot}}function l(ae,Ee,de){var Ke,Je,je;ae=k(ae,360),Ee=k(Ee,100),de=k(de,100);function Qe(ht,mt,ft){return ft<0&&(ft+=1),ft>1&&(ft-=1),ft<1/6?ht+(mt-ht)*6*ft:ft<1/2?mt:ft<2/3?ht+(mt-ht)*(2/3-ft)*6:ht}if(Ee===0)Ke=Je=je=de;else{var ot=de<.5?de*(1+Ee):de+Ee-de*Ee,st=2*de-ot;Ke=Qe(st,ot,ae+1/3),Je=Qe(st,ot,ae),je=Qe(st,ot,ae-1/3)}return{r:Ke*255,g:Je*255,b:je*255}}function n(ae,Ee,de){ae=k(ae,255),Ee=k(Ee,255),de=k(de,255);var Ke=I(ae,Ee,de),Je=H(ae,Ee,de),je,Qe,ot=Ke,st=Ke-Je;if(Qe=Ke===0?0:st/Ke,Ke==Je)je=0;else{switch(Ke){case ae:je=(Ee-de)/st+(Ee<de?6:0);break;case Ee:je=(de-ae)/st+2;break;case de:je=(ae-Ee)/st+4;break}je/=6}return{h:je,s:Qe,v:ot}}function c(ae,Ee,de){ae=k(ae,360)*6,Ee=k(Ee,100),de=k(de,100);var Ke=Q.floor(ae),Je=ae-Ke,je=de*(1-Ee),Qe=de*(1-Je*Ee),ot=de*(1-(1-Je)*Ee),st=Ke%6,ht=[de,Qe,je,je,ot,de][st],mt=[ot,de,de,Qe,je,je][st],ft=[je,je,ot,de,de,Qe][st];return{r:ht*255,g:mt*255,b:ft*255}}function s(ae,Ee,de,Ke){var Je=[fe(U(ae).toString(16)),fe(U(Ee).toString(16)),fe(U(de).toString(16))];return Ke&&Je[0].charAt(0)==Je[0].charAt(1)&&Je[1].charAt(0)==Je[1].charAt(1)&&Je[2].charAt(0)==Je[2].charAt(1)?Je[0].charAt(0)+Je[1].charAt(0)+Je[2].charAt(0):Je.join("")}function a(ae,Ee,de,Ke,Je){var je=[fe(U(ae).toString(16)),fe(U(Ee).toString(16)),fe(U(de).toString(16)),fe(_e(Ke))];return Je&&je[0].charAt(0)==je[0].charAt(1)&&je[1].charAt(0)==je[1].charAt(1)&&je[2].charAt(0)==je[2].charAt(1)&&je[3].charAt(0)==je[3].charAt(1)?je[0].charAt(0)+je[1].charAt(0)+je[2].charAt(0)+je[3].charAt(0):je.join("")}function o(ae,Ee,de,Ke){var Je=[fe(_e(Ke)),fe(U(ae).toString(16)),fe(U(Ee).toString(16)),fe(U(de).toString(16))];return Je.join("")}R.equals=function(ae,Ee){return!ae||!Ee?!1:R(ae).toRgbString()==R(Ee).toRgbString()},R.random=function(){return R.fromRatio({r:F(),g:F(),b:F()})};function f(ae,Ee){Ee=Ee===0?0:Ee||10;var de=R(ae).toHsl();return de.s-=Ee/100,de.s=b(de.s),R(de)}function L(ae,Ee){Ee=Ee===0?0:Ee||10;var de=R(ae).toHsl();return de.s+=Ee/100,de.s=b(de.s),R(de)}function C(ae){return R(ae).desaturate(100)}function x(ae,Ee){Ee=Ee===0?0:Ee||10;var de=R(ae).toHsl();return de.l+=Ee/100,de.l=b(de.l),R(de)}function A(ae,Ee){Ee=Ee===0?0:Ee||10;var de=R(ae).toRgb();return de.r=I(0,H(255,de.r-U(255*-(Ee/100)))),de.g=I(0,H(255,de.g-U(255*-(Ee/100)))),de.b=I(0,H(255,de.b-U(255*-(Ee/100)))),R(de)}function w(ae,Ee){Ee=Ee===0?0:Ee||10;var de=R(ae).toHsl();return de.l-=Ee/100,de.l=b(de.l),R(de)}function _(ae,Ee){var de=R(ae).toHsl(),Ke=(de.h+Ee)%360;return de.h=Ke<0?360+Ke:Ke,R(de)}function S(ae){var Ee=R(ae).toHsl();return Ee.h=(Ee.h+180)%360,R(Ee)}function y(ae){var Ee=R(ae).toHsl(),de=Ee.h;return[R(ae),R({h:(de+120)%360,s:Ee.s,l:Ee.l}),R({h:(de+240)%360,s:Ee.s,l:Ee.l})]}function h(ae){var Ee=R(ae).toHsl(),de=Ee.h;return[R(ae),R({h:(de+90)%360,s:Ee.s,l:Ee.l}),R({h:(de+180)%360,s:Ee.s,l:Ee.l}),R({h:(de+270)%360,s:Ee.s,l:Ee.l})]}function E(ae){var Ee=R(ae).toHsl(),de=Ee.h;return[R(ae),R({h:(de+72)%360,s:Ee.s,l:Ee.l}),R({h:(de+216)%360,s:Ee.s,l:Ee.l})]}function m(ae,Ee,de){Ee=Ee||6,de=de||30;var Ke=R(ae).toHsl(),Je=360/de,je=[R(ae)];for(Ke.h=(Ke.h-(Je*Ee>>1)+720)%360;--Ee;)Ke.h=(Ke.h+Je)%360,je.push(R(Ke));return je}function T(ae,Ee){Ee=Ee||6;for(var de=R(ae).toHsv(),Ke=de.h,Je=de.s,je=de.v,Qe=[],ot=1/Ee;Ee--;)Qe.push(R({h:Ke,s:Je,v:je})),je=(je+ot)%1;return Qe}R.mix=function(ae,Ee,de){de=de===0?0:de||50;var Ke=R(ae).toRgb(),Je=R(Ee).toRgb(),je=de/100,Qe={r:(Je.r-Ke.r)*je+Ke.r,g:(Je.g-Ke.g)*je+Ke.g,b:(Je.b-Ke.b)*je+Ke.b,a:(Je.a-Ke.a)*je+Ke.a};return R(Qe)},R.readability=function(ae,Ee){var de=R(ae),Ke=R(Ee);return(Q.max(de.getLuminance(),Ke.getLuminance())+.05)/(Q.min(de.getLuminance(),Ke.getLuminance())+.05)},R.isReadable=function(ae,Ee,de){var Ke=R.readability(ae,Ee),Je,je;je=!1,Je=ue(de);switch(Je.level+Je.size){case"AAsmall":case"AAAlarge":je=Ke>=4.5;break;case"AAlarge":je=Ke>=3;break;case"AAAsmall":je=Ke>=7;break}return je},R.mostReadable=function(ae,Ee,de){var Ke=null,Je=0,je,Qe,ot,st;de=de||{},Qe=de.includeFallbackColors,ot=de.level,st=de.size;for(var ht=0;ht<Ee.length;ht++)je=R.readability(ae,Ee[ht]),je>Je&&(Je=je,Ke=R(Ee[ht]));return R.isReadable(ae,Ke,{level:ot,size:st})||!Qe?Ke:(de.includeFallbackColors=!1,R.mostReadable(ae,["#fff","#000"],de))};var j=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"},N=R.hexNames=K(j);function K(ae){var Ee={};for(var de in ae)ae.hasOwnProperty(de)&&(Ee[ae[de]]=de);return Ee}function W(ae){return ae=parseFloat(ae),(isNaN(ae)||ae<0||ae>1)&&(ae=1),ae}function k(ae,Ee){J(ae)&&(ae="100%");var de=oe(ae);return ae=H(Ee,I(0,parseFloat(ae))),de&&(ae=parseInt(ae*Ee,10)/100),Q.abs(ae-Ee)<1e-6?1:ae%Ee/parseFloat(Ee)}function b(ae){return H(1,I(0,ae))}function G(ae){return parseInt(ae,16)}function J(ae){return typeof ae=="string"&&ae.indexOf(".")!=-1&&parseFloat(ae)===1}function oe(ae){return typeof ae=="string"&&ae.indexOf("%")!=-1}function fe(ae){return ae.length==1?"0"+ae:""+ae}function Ne(ae){return ae<=1&&(ae=ae*100+"%"),ae}function _e(ae){return Q.round(parseFloat(ae)*255).toString(16)}function Fe(ae){return G(ae)/255}var We=function(){var ae="[-\\+]?\\d+%?",Ee="[-\\+]?\\d*\\.\\d+%?",de="(?:"+Ee+")|(?:"+ae+")",Ke="[\\s|\\(]+("+de+")[,|\\s]+("+de+")[,|\\s]+("+de+")\\s*\\)?",Je="[\\s|\\(]+("+de+")[,|\\s]+("+de+")[,|\\s]+("+de+")[,|\\s]+("+de+")\\s*\\)?";return{CSS_UNIT:new RegExp(de),rgb:new RegExp("rgb"+Ke),rgba:new RegExp("rgba"+Je),hsl:new RegExp("hsl"+Ke),hsla:new RegExp("hsla"+Je),hsv:new RegExp("hsv"+Ke),hsva:new RegExp("hsva"+Je),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 Ue(ae){return!!We.CSS_UNIT.exec(ae)}function xe(ae){ae=ae.replace(P,"").replace(Y,"").toLowerCase();var Ee=!1;if(j[ae])ae=j[ae],Ee=!0;else if(ae=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var de;return(de=We.rgb.exec(ae))?{r:de[1],g:de[2],b:de[3]}:(de=We.rgba.exec(ae))?{r:de[1],g:de[2],b:de[3],a:de[4]}:(de=We.hsl.exec(ae))?{h:de[1],s:de[2],l:de[3]}:(de=We.hsla.exec(ae))?{h:de[1],s:de[2],l:de[3],a:de[4]}:(de=We.hsv.exec(ae))?{h:de[1],s:de[2],v:de[3]}:(de=We.hsva.exec(ae))?{h:de[1],s:de[2],v:de[3],a:de[4]}:(de=We.hex8.exec(ae))?{r:G(de[1]),g:G(de[2]),b:G(de[3]),a:Fe(de[4]),format:Ee?"name":"hex8"}:(de=We.hex6.exec(ae))?{r:G(de[1]),g:G(de[2]),b:G(de[3]),format:Ee?"name":"hex"}:(de=We.hex4.exec(ae))?{r:G(de[1]+""+de[1]),g:G(de[2]+""+de[2]),b:G(de[3]+""+de[3]),a:Fe(de[4]+""+de[4]),format:Ee?"name":"hex8"}:(de=We.hex3.exec(ae))?{r:G(de[1]+""+de[1]),g:G(de[2]+""+de[2]),b:G(de[3]+""+de[3]),format:Ee?"name":"hex"}:!1}function ue(ae){var Ee,de;return ae=ae||{level:"AA",size:"small"},Ee=(ae.level||"AA").toUpperCase(),de=(ae.size||"small").toLowerCase(),Ee!=="AA"&&Ee!=="AAA"&&(Ee="AA"),de!=="small"&&de!=="large"&&(de="small"),{level:Ee,size:de}}Mt.exports?Mt.exports=R:!(le=function(){return R}.call(_t,q,_t,Mt),le!==void 0&&(Mt.exports=le))})(Math)},bT9E:function(Mt,_t,q){"use strict";q.d(_t,"a",function(){return Q});var le=q("VTBJ");function Q(P,Y){var D=Object(le.a)({},P);return Array.isArray(Y)&&Y.forEach(function(U){delete D[U]}),D}},c5Ni:function(Mt,_t,q){},dejd:function(Mt,_t,q){},dmUQ:function(Mt,_t,q){"use strict";var le=q("Ff2n"),Q=q("rePB"),P=q("1OyB"),Y=q("vuIU"),D=q("Ji7U"),U=q("md7G"),H=q("foSv"),I=q("q1tI"),F=q.n(I),R=q("TSYQ"),g=q.n(R),p=q("4IlW");function d(y,h){var E=Object.keys(y);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(y);h&&(m=m.filter(function(T){return Object.getOwnPropertyDescriptor(y,T).enumerable})),E.push.apply(E,m)}return E}function l(y){for(var h=1;h<arguments.length;h++){var E=arguments[h]!=null?arguments[h]:{};h%2?d(Object(E),!0).forEach(function(m){Object(Q.a)(y,m,E[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(E)):d(Object(E)).forEach(function(m){Object.defineProperty(y,m,Object.getOwnPropertyDescriptor(E,m))})}return y}function n(y){var h=c();return function(){var m=Object(H.a)(y),T;if(h){var j=Object(H.a)(this).constructor;T=Reflect.construct(m,arguments,j)}else T=m.apply(this,arguments);return Object(U.a)(this,T)}}function c(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(y){return!1}}function s(){}function a(y){y.preventDefault()}var o=function(h){return h.replace(/[^\w.-]+/g,"")},f=200,L=600,C=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,x=function(h){return h!=null},A=function(h,E){return E===h||typeof E=="number"&&typeof h=="number"&&isNaN(E)&&isNaN(h)},w=function(y){Object(D.a)(E,y);var h=n(E);function E(m){var T;Object(P.a)(this,E),T=h.call(this,m),T.onKeyDown=function(K){var W=T.props,k=W.onKeyDown,b=W.onPressEnter;if(K.keyCode===p.a.UP){var G=T.getRatio(K);T.up(K,G,null),T.stop()}else if(K.keyCode===p.a.DOWN){var J=T.getRatio(K);T.down(K,J,null),T.stop()}else K.keyCode===p.a.ENTER&&b&&b(K);if(T.recordCursorPosition(),T.lastKeyCode=K.keyCode,k){for(var oe=arguments.length,fe=new Array(oe>1?oe-1:0),Ne=1;Ne<oe;Ne++)fe[Ne-1]=arguments[Ne];k.apply(void 0,[K].concat(fe))}},T.onKeyUp=function(K){var W=T.props.onKeyUp;if(T.stop(),T.recordCursorPosition(),W){for(var k=arguments.length,b=new Array(k>1?k-1:0),G=1;G<k;G++)b[G-1]=arguments[G];W.apply(void 0,[K].concat(b))}},T.onChange=function(K){var W=T.props.onChange;T.state.focused&&(T.inputting=!0),T.rawInput=T.props.parser(T.getValueFromEvent(K)),T.setState({inputValue:T.rawInput}),W(T.toNumber(T.rawInput))},T.onMouseUp=function(){var K=T.props.onMouseUp;T.recordCursorPosition(),K&&K.apply(void 0,arguments)},T.onFocus=function(){var K;T.setState({focused:!0}),(K=T.props).onFocus.apply(K,arguments)},T.onBlur=function(){var K=T.props.onBlur;T.inputting=!1,T.setState({focused:!1});var W=T.getCurrentValidValue(T.state.inputValue),k=T.setValue(W,s);if(K){var b=T.input.value,G=T.getInputDisplayValue({focus:!1,value:k});T.input.value=G&&Number(G),K.apply(void 0,arguments),T.input.value=b}},T.getRatio=function(K){var W=1;return K.metaKey||K.ctrlKey?W=.1:K.shiftKey&&(W=10),W},T.getFullNum=function(K){return isNaN(K)?K:/e/i.test(String(K))?Number(K).toFixed(18).replace(/\.?0+$/,""):K},T.getPrecision=function(K){if(x(T.props.precision))return T.props.precision;var W=String(K);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var k=0;return W.indexOf(".")>=0&&(k=W.length-W.indexOf(".")-1),k},T.getInputDisplayValue=function(K){var W=K||T.state,k=W.focused,b=W.inputValue,G=W.value,J;k?J=b:J=T.toPrecisionAsStep(G),J==null&&(J="");var oe=T.formatWrapper(J);return x(T.props.decimalSeparator)&&(oe=oe.toString().replace(".",T.props.decimalSeparator)),oe},T.recordCursorPosition=function(){try{T.cursorStart=T.input.selectionStart,T.cursorEnd=T.input.selectionEnd,T.currentValue=T.input.value,T.cursorBefore=T.input.value.substring(0,T.cursorStart),T.cursorAfter=T.input.value.substring(T.cursorEnd)}catch(K){}},T.restoreByAfter=function(K){if(K===void 0)return!1;var W=T.input.value,k=W.lastIndexOf(K);if(k===-1)return!1;var b=T.cursorBefore.length;return T.lastKeyCode===p.a.DELETE&&T.cursorBefore.charAt(b-1)===K[0]?(T.fixCaret(b,b),!0):k+K.length===W.length?(T.fixCaret(k,k),!0):!1},T.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function(W,k){var b=K.substring(k);return T.restoreByAfter(b)})},T.isNotCompleteNumber=function(K){return isNaN(K)||K===""||K===null||K&&K.toString().indexOf(".")===K.toString().length-1},T.stop=function(){T.autoStepTimer&&clearTimeout(T.autoStepTimer)},T.down=function(K,W,k){T.pressingUpOrDown=!0,T.step("down",K,W,k)},T.up=function(K,W,k){T.pressingUpOrDown=!0,T.step("up",K,W,k)},T.saveInput=function(K){T.input=K};var j=m.value;j===void 0&&(j=m.defaultValue),T.state={focused:m.autoFocus};var N=T.getValidValue(T.toNumber(j));return T.state=l(l({},T.state),{},{inputValue:T.toPrecisionAsStep(N),value:N}),T}return Object(Y.a)(E,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(T){var j=this.props,N=j.value,K=j.onChange,W=j.max,k=j.min,b=this.state.focused;if(T){if(!A(T.value,N)||!A(T.max,W)||!A(T.min,k)){var G=b?N:this.getValidValue(N),J;this.pressingUpOrDown?J=G:this.inputting?J=this.rawInput:J=this.toPrecisionAsStep(G),this.setState({value:G,inputValue:J})}var oe="value"in this.props?N:this.state.value;"max"in this.props&&T.max!==W&&typeof oe=="number"&&oe>W&&K&&K(W),"min"in this.props&&T.min!==k&&typeof oe=="number"&&oe<k&&K&&K(k)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var fe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===p.a.BACKSPACE?fe=this.cursorStart-1:this.lastKeyCode===p.a.DELETE&&(fe=this.cursorStart):fe=this.input.value.length,this.fixCaret(fe,fe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case p.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case p.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ne){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(T){var j=T;return j===""?j="":this.isNotCompleteNumber(parseFloat(j))?j=this.state.value:j=this.getValidValue(j),this.toNumber(j)}},{key:"getValueFromEvent",value:function(T){var j=T.target.value.trim().replace(/。/g,".");return x(this.props.decimalSeparator)&&(j=j.replace(this.props.decimalSeparator,".")),j}},{key:"getValidValue",value:function(T){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,K=parseFloat(T);return isNaN(K)?T:(K<j&&(K=j),K>N&&(K=N),K)}},{key:"setValue",value:function(T,j){var N=this.props.precision,K=this.isNotCompleteNumber(parseFloat(T))?null:parseFloat(T),W=this.state.value,k=W===void 0?null:W,b=this.state.inputValue,G=b===void 0?null:b,J=typeof K=="number"?K.toFixed(N):"".concat(K),oe=K!==k||J!=="".concat(G);return"value"in this.props?(G=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:G},j)):this.setState({value:K,inputValue:this.toPrecisionAsStep(T)},j),oe&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(T){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.props,K=N.precision,W=N.step;if(x(K))return K;var k=this.getPrecision(j),b=this.getPrecision(W),G=this.getPrecision(T);return T?Math.max(G,k+b):k+b}},{key:"getPrecisionFactor",value:function(T){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.getMaxPrecision(T,j);return Math.pow(10,N)}},{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(T){return this.props.formatter?this.props.formatter(T):T}},{key:"toPrecisionAsStep",value:function(T){if(this.isNotCompleteNumber(T)||T==="")return T;var j=Math.abs(this.getMaxPrecision(T));return isNaN(j)?T.toString():Number(T).toFixed(j)}},{key:"toNumber",value:function(T){var j=this.props.precision,N=this.state.focused,K=T&&T.length>16&&N;return this.isNotCompleteNumber(T)||K?T:x(j)?Math.round(T*Math.pow(10,j))/Math.pow(10,j):Number(T)}},{key:"upStep",value:function(T,j){var N=this.props.step,K=this.getPrecisionFactor(T,j),W=Math.abs(this.getMaxPrecision(T,j)),k=((K*T+K*N*j)/K).toFixed(W);return this.toNumber(k)}},{key:"downStep",value:function(T,j){var N=this.props.step,K=this.getPrecisionFactor(T,j),W=Math.abs(this.getMaxPrecision(T,j)),k=((K*T-K*N*j)/K).toFixed(W);return this.toNumber(k)}},{key:"step",value:function(T,j){var N=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),j&&(j.persist(),j.preventDefault());var k=this.props;if(k.disabled)return;var b=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(b))return;var G=this["".concat(T,"Step")](b,K),J=G>k.max||G<k.min;if(G>k.max?G=k.max:G<k.min&&(G=k.min),this.setValue(G,null),this.setState({focused:!0},function(){N.pressingUpOrDown=!1}),J)return;this.autoStepTimer=setTimeout(function(){N[T](j,K,!0)},W?f:L)}},{key:"fixCaret",value:function(T,j){if(T===void 0||j===void 0||!this.input||!this.input.value)return;try{var N=this.input.selectionStart,K=this.input.selectionEnd;(T!==N||j!==K)&&this.input.setSelectionRange(T,j)}catch(W){}}},{key:"render",value:function(){var T,j=this.props,N=j.prefixCls,K=j.disabled,W=j.readOnly,k=j.useTouch,b=j.autoComplete,G=j.upHandler,J=j.downHandler,oe=j.className,fe=j.max,Ne=j.min,_e=j.style,Fe=j.title,We=j.onMouseEnter,Ue=j.onMouseLeave,xe=j.onMouseOver,ue=j.onMouseOut,ae=j.required,Ee=j.onClick,de=j.tabIndex,Ke=j.type,Je=j.placeholder,je=j.id,Qe=j.inputMode,ot=j.pattern,st=j.step,ht=j.maxLength,mt=j.autoFocus,ft=j.name,Ht=j.onPaste,Vt=j.onInput,zt=Object(le.a)(j,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Tt=this.state,hn=Tt.value,Xt=Tt.focused,Wt=g()(N,(T={},Object(Q.a)(T,oe,!!oe),Object(Q.a)(T,"".concat(N,"-disabled"),K),Object(Q.a)(T,"".concat(N,"-focused"),Xt),T)),it={};Object.keys(zt).forEach(function(Se){(Se.substr(0,5)==="data-"||Se.substr(0,5)==="aria-"||Se==="role")&&(it[Se]=zt[Se])});var un=!W&&!K,Kt=this.getInputDisplayValue(null),qe=(hn||hn===0)&&(isNaN(hn)||Number(hn)>=fe),wt=(hn||hn===0)&&(isNaN(hn)||Number(hn)<=Ne),Be=qe||K||W,Ae=wt||K||W,Ie=g()("".concat(N,"-handler"),"".concat(N,"-handler-up"),Object(Q.a)({},"".concat(N,"-handler-up-disabled"),Be)),se=g()("".concat(N,"-handler"),"".concat(N,"-handler-down"),Object(Q.a)({},"".concat(N,"-handler-down-disabled"),Ae)),ce=k?{onTouchStart:Be?s:this.up,onTouchEnd:this.stop}:{onMouseDown:Be?s:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ye=k?{onTouchStart:Ae?s:this.down,onTouchEnd:this.stop}:{onMouseDown:Ae?s:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return F.a.createElement("div",{className:Wt,style:_e,title:Fe,onMouseEnter:We,onMouseLeave:Ue,onMouseOver:xe,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},F.a.createElement("div",{className:"".concat(N,"-handler-wrap")},F.a.createElement("span",Object.assign({unselectable:"on"},ce,{role:"button","aria-label":"Increase Value","aria-disabled":Be,className:Ie}),G||F.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-up-inner"),onClick:a})),F.a.createElement("span",Object.assign({unselectable:"on"},ye,{role:"button","aria-label":"Decrease Value","aria-disabled":Ae,className:se}),J||F.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-down-inner"),onClick:a}))),F.a.createElement("div",{className:"".concat(N,"-input-wrap")},F.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ne,"aria-valuemax":fe,"aria-valuenow":hn,required:ae,type:Ke,placeholder:Je,onPaste:Ht,onClick:Ee,onMouseUp:this.onMouseUp,className:"".concat(N,"-input"),tabIndex:de,autoComplete:b,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:un?this.onKeyDown:s,onKeyUp:un?this.onKeyUp:s,autoFocus:mt,maxLength:ht,readOnly:W,disabled:K,max:fe,min:Ne,step:st,name:ft,title:Fe,id:je,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Kt),pattern:ot,inputMode:Qe,onInput:Vt},it))))}}]),E}(F.a.Component);w.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:C,min:-C,step:1,style:{},onChange:s,onKeyDown:s,onPressEnter:s,onFocus:s,onBlur:s,parser:o,required:!1,autoComplete:"off"};var _=w,S=_t.a=_},h78n:function(Mt,_t,q){"use strict";q.d(_t,"a",function(){return T});var le=q("q1tI"),Q=q.n(le),P=q("TSYQ"),Y=q.n(P),D={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},U=function(K){var W=K.map(function(){return Object(le.useRef)()}),k=Object(le.useRef)();return Object(le.useEffect)(function(){var b=Date.now(),G=!1;Object.keys(W).forEach(function(J){var oe=W[J].current;if(!oe)return;G=!0;var fe=oe.style;fe.transitionDuration=".3s, .3s, .3s, .06s",k.current&&b-k.current<100&&(fe.transitionDuration="0s, 0s")}),G&&(k.current=Date.now())}),[W]};function H(){return H=Object.assign||function(N){for(var K=1;K<arguments.length;K++){var W=arguments[K];for(var k in W)Object.prototype.hasOwnProperty.call(W,k)&&(N[k]=W[k])}return N},H.apply(this,arguments)}function I(N,K){return d(N)||p(N,K)||R(N,K)||F()}function F(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function R(N,K){if(!N)return;if(typeof N=="string")return g(N,K);var W=Object.prototype.toString.call(N).slice(8,-1);if(W==="Object"&&N.constructor&&(W=N.constructor.name),W==="Map"||W==="Set")return Array.from(N);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return g(N,K)}function g(N,K){(K==null||K>N.length)&&(K=N.length);for(var W=0,k=new Array(K);W<K;W++)k[W]=N[W];return k}function p(N,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(N)))return;var W=[],k=!0,b=!1,G=void 0;try{for(var J=N[Symbol.iterator](),oe;!(k=(oe=J.next()).done)&&!(W.push(oe.value),K&&W.length===K);k=!0);}catch(fe){b=!0,G=fe}finally{try{!k&&J.return!=null&&J.return()}finally{if(b)throw G}}return W}function d(N){if(Array.isArray(N))return N}function l(N,K){if(N==null)return{};var W=n(N,K),k,b;if(Object.getOwnPropertySymbols){var G=Object.getOwnPropertySymbols(N);for(b=0;b<G.length;b++){if(k=G[b],K.indexOf(k)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(N,k))continue;W[k]=N[k]}}return W}function n(N,K){if(N==null)return{};var W={},k=Object.keys(N),b,G;for(G=0;G<k.length;G++){if(b=k[G],K.indexOf(b)>=0)continue;W[b]=N[b]}return W}var c=function(K){var W=K.className,k=K.percent,b=K.prefixCls,G=K.strokeColor,J=K.strokeLinecap,oe=K.strokeWidth,fe=K.style,Ne=K.trailColor,_e=K.trailWidth,Fe=K.transition,We=l(K,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete We.gapPosition;var Ue=Array.isArray(k)?k:[k],xe=Array.isArray(G)?G:[G],ue=U(Ue),ae=I(ue,1),Ee=ae[0],de=oe/2,Ke=100-oe/2,Je="M ".concat(J==="round"?de:0,",").concat(de,`
|
|
L `).concat(J==="round"?Ke:100,",").concat(de),je="0 0 100 ".concat(oe),Qe=0;return Q.a.createElement("svg",H({className:Y()("".concat(b,"-line"),W),viewBox:je,preserveAspectRatio:"none",style:fe},We),Q.a.createElement("path",{className:"".concat(b,"-line-trail"),d:Je,strokeLinecap:J,stroke:Ne,strokeWidth:_e||oe,fillOpacity:"0"}),Ue.map(function(ot,st){var ht={strokeDasharray:"".concat(ot,"px, 100px"),strokeDashoffset:"-".concat(Qe,"px"),transition:Fe||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},mt=xe[st]||xe[xe.length-1];return Qe+=ot,Q.a.createElement("path",{key:st,className:"".concat(b,"-line-path"),d:Je,strokeLinecap:J,stroke:mt,strokeWidth:oe,fillOpacity:"0",ref:Ee[st],style:ht})}))};c.defaultProps=D;var s=c;function a(){return a=Object.assign||function(N){for(var K=1;K<arguments.length;K++){var W=arguments[K];for(var k in W)Object.prototype.hasOwnProperty.call(W,k)&&(N[k]=W[k])}return N},a.apply(this,arguments)}function o(N,K){return A(N)||x(N,K)||L(N,K)||f()}function f(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L(N,K){if(!N)return;if(typeof N=="string")return C(N,K);var W=Object.prototype.toString.call(N).slice(8,-1);if(W==="Object"&&N.constructor&&(W=N.constructor.name),W==="Map"||W==="Set")return Array.from(N);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return C(N,K)}function C(N,K){(K==null||K>N.length)&&(K=N.length);for(var W=0,k=new Array(K);W<K;W++)k[W]=N[W];return k}function x(N,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(N)))return;var W=[],k=!0,b=!1,G=void 0;try{for(var J=N[Symbol.iterator](),oe;!(k=(oe=J.next()).done)&&!(W.push(oe.value),K&&W.length===K);k=!0);}catch(fe){b=!0,G=fe}finally{try{!k&&J.return!=null&&J.return()}finally{if(b)throw G}}return W}function A(N){if(Array.isArray(N))return N}function w(N,K){if(N==null)return{};var W=_(N,K),k,b;if(Object.getOwnPropertySymbols){var G=Object.getOwnPropertySymbols(N);for(b=0;b<G.length;b++){if(k=G[b],K.indexOf(k)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(N,k))continue;W[k]=N[k]}}return W}function _(N,K){if(N==null)return{};var W={},k=Object.keys(N),b,G;for(G=0;G<k.length;G++){if(b=k[G],K.indexOf(b)>=0)continue;W[b]=N[b]}return W}var S=0;function y(N){return+N.replace("%","")}function h(N){return Array.isArray(N)?N:[N]}function E(N,K,W,k){var b=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,G=arguments.length>5?arguments[5]:void 0,J=50-k/2,oe=0,fe=-J,Ne=0,_e=-2*J;switch(G){case"left":oe=-J,fe=0,Ne=2*J,_e=0;break;case"right":oe=J,fe=0,Ne=-2*J,_e=0;break;case"bottom":fe=J,_e=2*J;break;default:}var Fe="M 50,50 m ".concat(oe,",").concat(fe,`
|
|
a `).concat(J,",").concat(J," 0 1 1 ").concat(Ne,",").concat(-_e,`
|
|
a `).concat(J,",").concat(J," 0 1 1 ").concat(-Ne,",").concat(_e),We=Math.PI*2*J,Ue={stroke:W,strokeDasharray:"".concat(K/100*(We-b),"px ").concat(We,"px"),strokeDashoffset:"-".concat(b/2+N/100*(We-b),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Fe,pathStyle:Ue}}var m=function(K){var W=K.prefixCls,k=K.strokeWidth,b=K.trailWidth,G=K.gapDegree,J=K.gapPosition,oe=K.trailColor,fe=K.strokeLinecap,Ne=K.style,_e=K.className,Fe=K.strokeColor,We=K.percent,Ue=w(K,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),xe=Object(le.useMemo)(function(){return S+=1,S},[]),ue=E(0,100,oe,k,G,J),ae=ue.pathString,Ee=ue.pathStyle,de=h(We),Ke=h(Fe),Je=Ke.find(function(ht){return Object.prototype.toString.call(ht)==="[object Object]"}),je=U(de),Qe=o(je,1),ot=Qe[0],st=function(){var mt=0;return de.map(function(ft,Ht){var Vt=Ke[Ht]||Ke[Ke.length-1],zt=Object.prototype.toString.call(Vt)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(xe,")"):"",Tt=E(mt,ft,Vt,k,G,J);return mt+=ft,Q.a.createElement("path",{key:Ht,className:"".concat(W,"-circle-path"),d:Tt.pathString,stroke:zt,strokeLinecap:fe,strokeWidth:k,opacity:ft===0?0:1,fillOpacity:"0",style:Tt.pathStyle,ref:ot[Ht]})})};return Q.a.createElement("svg",a({className:Y()("".concat(W,"-circle"),_e),viewBox:"0 0 100 100",style:Ne},Ue),Je&&Q.a.createElement("defs",null,Q.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(xe),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Je).sort(function(ht,mt){return y(ht)-y(mt)}).map(function(ht,mt){return Q.a.createElement("stop",{key:mt,offset:ht,stopColor:Je[ht]})}))),Q.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:ae,stroke:oe,strokeLinecap:fe,strokeWidth:b||k,fillOpacity:"0",style:Ee}),st().reverse())};m.defaultProps=D;var T=m,j={Line:s,Circle:T}},iARn:function(Mt,_t,q){Mt.exports={bg:"bg___1WeoA",modal:"modal___hHaTK",colorOrange:"colorOrange___1MhAt",colorYellow:"colorYellow___t8MmG"}},k3GJ:function(Mt,_t,q){"use strict";q.d(_t,"a",function(){return wr});var le=q("rePB"),Q=q("ODXe"),P=q("Ff2n"),Y=q("VTBJ"),D=q("q1tI"),U=q("TSYQ"),H=q.n(U),I=q("Zm9Q"),F=q("6cGi"),R=q("KQm4"),g=q("xEkU"),p=q.n(g),d=q("t23M");function l(me){var De=Object(D.useRef)(),Pe=Object(D.useRef)(!1);function ge(){for(var ne=arguments.length,he=new Array(ne),re=0;re<ne;re++)he[re]=arguments[re];Pe.current||(p.a.cancel(De.current),De.current=p()(function(){me.apply(void 0,he)}))}return Object(D.useEffect)(function(){return function(){Pe.current=!0,p.a.cancel(De.current)}},[]),ge}function n(me){var De=Object(D.useRef)([]),Pe=Object(D.useState)({}),ge=Object(Q.a)(Pe,2),ne=ge[1],he=Object(D.useRef)(typeof me=="function"?me():me),re=l(function(){var Ce=he.current;De.current.forEach(function(He){Ce=He(Ce)}),De.current=[],he.current=Ce,ne({})});function ve(Ce){De.current.push(Ce),re()}return[he.current,ve]}var c=q("4IlW");function s(me,De){var Pe,ge=me.prefixCls,ne=me.id,he=me.active,re=me.rtl,ve=me.tab,Ce=ve.key,He=ve.tab,we=ve.disabled,ze=ve.closeIcon,rt=me.tabBarGutter,vt=me.tabPosition,xt=me.closable,Ft=me.renderWrapper,dn=me.removeAriaLabel,Dn=me.editable,On=me.onClick,Jn=me.onRemove,ni=me.onFocus,Xn="".concat(ge,"-tab");D.useEffect(function(){return Jn},[]);var ei={};vt==="top"||vt==="bottom"?ei[re?"marginLeft":"marginRight"]=rt:ei.marginBottom=rt;var oi=Dn&&xt!==!1&&!we;function An(St){if(we)return;On(St)}function Ti(St){St.preventDefault(),St.stopPropagation(),Dn.onEdit("remove",{key:Ce,event:St})}var Tn=D.createElement("div",{key:Ce,ref:De,className:H()(Xn,(Pe={},Object(le.a)(Pe,"".concat(Xn,"-with-remove"),oi),Object(le.a)(Pe,"".concat(Xn,"-active"),he),Object(le.a)(Pe,"".concat(Xn,"-disabled"),we),Pe)),style:ei,onClick:An},D.createElement("div",{role:"tab","aria-selected":he,id:ne&&"".concat(ne,"-tab-").concat(Ce),className:"".concat(Xn,"-btn"),"aria-controls":ne&&"".concat(ne,"-panel-").concat(Ce),"aria-disabled":we,tabIndex:we?null:0,onClick:function(jt){jt.stopPropagation(),An(jt)},onKeyDown:function(jt){[c.a.SPACE,c.a.ENTER].includes(jt.which)&&(jt.preventDefault(),An(jt))},onFocus:ni},He),oi&&D.createElement("button",{type:"button","aria-label":dn||"remove",tabIndex:0,className:"".concat(Xn,"-remove"),onClick:function(jt){jt.stopPropagation(),Ti(jt)}},ze||Dn.removeIcon||"\xD7"));return Ft&&(Tn=Ft(Tn)),Tn}var a=D.forwardRef(s),o={width:0,height:0,left:0,top:0};function f(me,De,Pe){return Object(D.useMemo)(function(){for(var ge,ne=new Map,he=De.get((ge=me[0])===null||ge===void 0?void 0:ge.key)||o,re=he.left+he.width,ve=0;ve<me.length;ve+=1){var Ce=me[ve].key,He=De.get(Ce);if(!He){var we;He=De.get((we=me[ve-1])===null||we===void 0?void 0:we.key)||o}var ze=ne.get(Ce)||Object(Y.a)({},He);ze.right=re-ze.left-ze.width,ne.set(Ce,ze)}return ne},[me.map(function(ge){return ge.key}).join("_"),De,Pe])}var L={width:0,height:0,left:0,top:0,right:0};function C(me,De,Pe,ge,ne){var he=ne.tabs,re=ne.tabPosition,ve=ne.rtl,Ce,He,we;["top","bottom"].includes(re)?(Ce="width",He=ve?"right":"left",we=Math.abs(De.left)):(Ce="height",He="top",we=-De.top);var ze=De[Ce],rt=Pe[Ce],vt=ge[Ce],xt=ze;return rt+vt>ze&&(xt=ze-vt),Object(D.useMemo)(function(){if(!he.length)return[0,0];for(var Ft=he.length,dn=Ft,Dn=0;Dn<Ft;Dn+=1){var On=me.get(he[Dn].key)||L;if(On[He]+On[Ce]>we+xt){dn=Dn-1;break}}for(var Jn=0,ni=Ft-1;ni>=0;ni-=1){var Xn=me.get(he[ni].key)||L;if(Xn[He]<we){Jn=ni+1;break}}return[Jn,dn]},[me,we,xt,re,he.map(function(Ft){return Ft.key}).join("_"),ve])}var x=q("wx14"),A=q("1OyB"),w=q("vuIU"),_=q("JX7q"),S=q("Ji7U"),y=q("LK+K"),h=q("I8Z2"),E=q("bT9E"),m=q("2GS6"),T=q("Gytx"),j=q.n(T),N=q("U8pU"),K=/iPhone/i,W=/iPod/i,k=/iPad/i,b=/\bAndroid(?:.+)Mobile\b/i,G=/Android/i,J=/\bAndroid(?:.+)SD4930UR\b/i,oe=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,fe=/Windows Phone/i,Ne=/\bWindows(?:.+)ARM\b/i,_e=/BlackBerry/i,Fe=/BB10/i,We=/Opera Mini/i,Ue=/\b(CriOS|Chrome)(?:.+)Mobile/i,xe=/Mobile(?:.+)Firefox\b/i;function ue(me,De){return me.test(De)}function ae(me){var De=me||(typeof navigator!="undefined"?navigator.userAgent:""),Pe=(De||"").split("[FBAN");if(typeof Pe[1]!="undefined"){var ge=Pe,ne=Object(Q.a)(ge,1);De=ne[0]}if(Pe=De.split("Twitter"),typeof Pe[1]!="undefined"){var he=Pe,re=Object(Q.a)(he,1);De=re[0]}var ve={apple:{phone:ue(K,De)&&!ue(fe,De),ipod:ue(W,De),tablet:!ue(K,De)&&ue(k,De)&&!ue(fe,De),device:(ue(K,De)||ue(W,De)||ue(k,De))&&!ue(fe,De)},amazon:{phone:ue(J,De),tablet:!ue(J,De)&&ue(oe,De),device:ue(J,De)||ue(oe,De)},android:{phone:!ue(fe,De)&&ue(J,De)||!ue(fe,De)&&ue(b,De),tablet:!ue(fe,De)&&!ue(J,De)&&!ue(b,De)&&(ue(oe,De)||ue(G,De)),device:!ue(fe,De)&&(ue(J,De)||ue(oe,De)||ue(b,De)||ue(G,De))||ue(/\bokhttp\b/i,De)},windows:{phone:ue(fe,De),tablet:ue(Ne,De),device:ue(fe,De)||ue(Ne,De)},other:{blackberry:ue(_e,De),blackberry10:ue(Fe,De),opera:ue(We,De),firefox:ue(xe,De),chrome:ue(Ue,De),device:ue(_e,De)||ue(Fe,De)||ue(We,De)||ue(xe,De)||ue(Ue,De)},any:null,phone:null,tablet:null};return ve.any=ve.apple.device||ve.android.device||ve.windows.device||ve.other.device,ve.phone=ve.apple.phone||ve.android.phone||ve.windows.phone,ve.tablet=ve.apple.tablet||ve.android.tablet||ve.windows.tablet,ve}var Ee=Object(Y.a)(Object(Y.a)({},ae()),{},{isMobile:ae}),de=Ee;function Ke(){}function Je(me,De,Pe){var ge=De||"";return me.key||"".concat(ge,"item_").concat(Pe)}function je(me){return"".concat(me,"-menu-")}function Qe(me,De){var Pe=-1;D.Children.forEach(me,function(ge){Pe+=1,ge&&ge.type&&ge.type.isMenuItemGroup?D.Children.forEach(ge.props.children,function(ne){Pe+=1,De(ne,Pe)}):De(ge,Pe)})}function ot(me,De,Pe){if(!me||Pe.find)return;D.Children.forEach(me,function(ge){if(ge){var ne=ge.type;if(!ne||!(ne.isSubMenu||ne.isMenuItem||ne.isMenuItemGroup))return;De.indexOf(ge.key)!==-1?Pe.find=!0:ge.props.children&&ot(ge.props.children,De,Pe)}})}var st=["defaultSelectedKeys","selectedKeys","defaultOpenKeys","openKeys","mode","getPopupContainer","onSelect","onDeselect","onDestroy","openTransitionName","openAnimation","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","triggerSubMenuAction","level","selectable","multiple","onOpenChange","visible","focusable","defaultActiveFirst","prefixCls","inlineIndent","parentMenu","title","rootPrefixCls","eventKey","active","onItemHover","onTitleMouseEnter","onTitleMouseLeave","onTitleClick","popupAlign","popupOffset","isOpen","renderMenuItem","manualRef","subMenuKey","disabled","index","isSelected","store","activeKey","builtinPlacements","overflowedIndicator","motion","attribute","value","popupClassName","inlineCollapsed","menu","theme","itemIcon","expandIcon"],ht=function(De){var Pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ge=De&&typeof De.getBoundingClientRect=="function"&&De.getBoundingClientRect().width;if(ge){if(Pe){var ne=getComputedStyle(De),he=ne.marginLeft,re=ne.marginRight;ge+=+he.replace("px","")+ +re.replace("px","")}ge=+ge.toFixed(6)}return ge||0},mt=function(De,Pe,ge){De&&Object(N.a)(De.style)==="object"&&(De.style[Pe]=ge)},ft=function(){return de.any},Ht=q("bdgK"),Vt=q("i8i4"),zt=q.n(Vt),Tt=q("wgJM"),hn=q("l4aY"),Xt=q("m+aA"),Wt=q("c+Xe"),it=q("zT1h"),un=q("QC+M");function Kt(me,De,Pe){return Pe?me[0]===De[0]:me[0]===De[0]&&me[1]===De[1]}function qe(me,De,Pe){var ge=me[De]||{};return Object(Y.a)(Object(Y.a)({},ge),Pe)}function wt(me,De,Pe,ge){for(var ne=Pe.points,he=Object.keys(me),re=0;re<he.length;re+=1){var ve=he[re];if(Kt(me[ve].points,ne,ge))return"".concat(De,"-placement-").concat(ve)}return""}var Be=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var me=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(me)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(me==null?void 0:me.substr(0,4)))},Ae=q("MNnm");function Ie(me,De){var Pe={};return Pe[me.toLowerCase()]=De.toLowerCase(),Pe["Webkit".concat(me)]="webkit".concat(De),Pe["Moz".concat(me)]="moz".concat(De),Pe["ms".concat(me)]="MS".concat(De),Pe["O".concat(me)]="o".concat(De.toLowerCase()),Pe}function se(me,De){var Pe={animationend:Ie("Animation","AnimationEnd"),transitionend:Ie("Transition","TransitionEnd")};return me&&("AnimationEvent"in De||delete Pe.animationend.animation,"TransitionEvent"in De||delete Pe.transitionend.transition),Pe}var ce=se(Object(Ae.a)(),typeof window!="undefined"?window:{}),ye={};if(Object(Ae.a)()){var Se=document.createElement("div");ye=Se.style}var ke={};function et(me){if(ke[me])return ke[me];var De=ce[me];if(De)for(var Pe=Object.keys(De),ge=Pe.length,ne=0;ne<ge;ne+=1){var he=Pe[ne];if(Object.prototype.hasOwnProperty.call(De,he)&&he in ye)return ke[me]=De[he],ke[me]}return""}var yt=et("animationend"),$t=et("transitionend"),gn=!!(yt&&$t),Dt=yt||"animationend",zn=$t||"transitionend";function Ln(me,De){if(!me)return null;if(Object(N.a)(me)==="object"){var Pe=De.replace(/-\w/g,function(ge){return ge[1].toUpperCase()});return me[Pe]}return"".concat(me,"-").concat(De)}var sn="none",_i="appear",si="enter",zi="leave",Oi="none",Qn="prepare",ir="start",qi="active",It="end";function Hn(me){var De=Object(D.useRef)(!1),Pe=Object(D.useState)(me),ge=Object(Q.a)(Pe,2),ne=ge[0],he=ge[1];function re(ve){De.current||he(ve)}return Object(D.useEffect)(function(){return function(){De.current=!0}},[]),[ne,re]}var li=Object(Ae.a)()?D.useLayoutEffect:D.useEffect,Gt=li,Bt=function(){var me=D.useRef(null);function De(){Tt.a.cancel(me.current)}function Pe(ge){var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;De();var he=Object(Tt.a)(function(){ne<=1?ge({isCanceled:function(){return he!==me.current}}):Pe(ge,ne-1)});me.current=he}return D.useEffect(function(){return function(){De()}},[]),[Pe,De]},Rn=[Qn,ir,qi,It],Wn=!1,nn=!0;function Pt(me){return me===qi||me===It}var Mi=function(me,De){var Pe=D.useState(Oi),ge=Object(Q.a)(Pe,2),ne=ge[0],he=ge[1],re=Bt(),ve=Object(Q.a)(re,2),Ce=ve[0],He=ve[1];function we(){he(Qn)}return Gt(function(){if(ne!==Oi&&ne!==It){var ze=Rn.indexOf(ne),rt=Rn[ze+1],vt=De(ne);vt===Wn?he(rt):Ce(function(xt){function Ft(){if(xt.isCanceled())return;he(rt)}vt===!0?Ft():Promise.resolve(vt).then(Ft)})}},[me,ne]),D.useEffect(function(){return function(){He()}},[]),[we,ne]},$i=function(me){var De=Object(D.useRef)(),Pe=Object(D.useRef)(me);Pe.current=me;var ge=D.useCallback(function(re){Pe.current(re)},[]);function ne(re){re&&(re.removeEventListener(zn,ge),re.removeEventListener(Dt,ge))}function he(re){De.current&&De.current!==re&&ne(De.current),re&&re!==De.current&&(re.addEventListener(zn,ge),re.addEventListener(Dt,ge),De.current=re)}return D.useEffect(function(){return function(){ne(De.current)}},[]),[he,ne]};function ui(me,De,Pe,ge){var ne=ge.motionEnter,he=ne===void 0?!0:ne,re=ge.motionAppear,ve=re===void 0?!0:re,Ce=ge.motionLeave,He=Ce===void 0?!0:Ce,we=ge.motionDeadline,ze=ge.motionLeaveImmediately,rt=ge.onAppearPrepare,vt=ge.onEnterPrepare,xt=ge.onLeavePrepare,Ft=ge.onAppearStart,dn=ge.onEnterStart,Dn=ge.onLeaveStart,On=ge.onAppearActive,Jn=ge.onEnterActive,ni=ge.onLeaveActive,Xn=ge.onAppearEnd,ei=ge.onEnterEnd,oi=ge.onLeaveEnd,An=ge.onVisibleChanged,Ti=Hn(),Tn=Object(Q.a)(Ti,2),St=Tn[0],jt=Tn[1],Zn=Hn(sn),pi=Object(Q.a)(Zn,2),yn=pi[0],gi=pi[1],Yi=Hn(null),vi=Object(Q.a)(Yi,2),Ni=vi[0],Ii=vi[1],Si=Object(D.useRef)(!1),Ci=Object(D.useRef)(null),Mn=Object(D.useRef)(!1),or=Object(D.useRef)(null);function $r(){var Xi=Pe();return Xi||or.current}var Pr=Object(D.useRef)(!1);function Er(Xi){var Ui=$r();if(Xi&&!Xi.deadline&&Xi.target!==Ui)return;var vr;yn===_i&&Pr.current?vr=Xn==null?void 0:Xn(Ui,Xi):yn===si&&Pr.current?vr=ei==null?void 0:ei(Ui,Xi):yn===zi&&Pr.current&&(vr=oi==null?void 0:oi(Ui,Xi)),vr!==!1&&!Mn.current&&(gi(sn),Ii(null))}var Qi=$i(Er),Ki=Object(Q.a)(Qi,1),Vi=Ki[0],Ji=D.useMemo(function(){var Xi,Ui,vr;switch(yn){case"appear":return Xi={},Object(le.a)(Xi,Qn,rt),Object(le.a)(Xi,ir,Ft),Object(le.a)(Xi,qi,On),Xi;case"enter":return Ui={},Object(le.a)(Ui,Qn,vt),Object(le.a)(Ui,ir,dn),Object(le.a)(Ui,qi,Jn),Ui;case"leave":return vr={},Object(le.a)(vr,Qn,xt),Object(le.a)(vr,ir,Dn),Object(le.a)(vr,qi,ni),vr;default:return{}}},[yn]),Nr=Mi(yn,function(Xi){if(Xi===Qn){var Ui=Ji[Qn];return Ui?Ui($r()):Wn}if(Gi in Ji){var vr;Ii(((vr=Ji[Gi])===null||vr===void 0?void 0:vr.call(Ji,$r(),null))||null)}return Gi===qi&&(Vi($r()),we>0&&(clearTimeout(Ci.current),Ci.current=setTimeout(function(){Er({deadline:!0})},we))),nn}),da=Object(Q.a)(Nr,2),aa=da[0],Gi=da[1],Qr=Pt(Gi);Pr.current=Qr,Gt(function(){jt(De);var Xi=Si.current;if(Si.current=!0,!me)return;var Ui;!Xi&&De&&ve&&(Ui=_i),Xi&&De&&he&&(Ui=si),(Xi&&!De&&He||!Xi&&ze&&!De&&He)&&(Ui=zi),Ui&&(gi(Ui),aa())},[De]),Object(D.useEffect)(function(){(yn===_i&&!ve||yn===si&&!he||yn===zi&&!He)&&gi(sn)},[ve,he,He]),Object(D.useEffect)(function(){return function(){clearTimeout(Ci.current),Mn.current=!0}},[]),Object(D.useEffect)(function(){St!==void 0&&yn===sn&&(An==null||An(St))},[St,yn]);var Jr=Ni;return Ji[Qn]&&Gi===ir&&(Jr=Object(Y.a)({transition:"none"},Jr)),[yn,Gi,Jr,St!=null?St:De]}var vn=function(me){Object(S.a)(Pe,me);var De=Object(y.a)(Pe);function Pe(){return Object(A.a)(this,Pe),De.apply(this,arguments)}return Object(w.a)(Pe,[{key:"render",value:function(){return this.props.children}}]),Pe}(D.Component),Bi=vn;function Ai(me){var De=me;Object(N.a)(me)==="object"&&(De=me.transitionSupport);function Pe(ne){return!!(ne.motionName&&De)}var ge=D.forwardRef(function(ne,he){var re=ne.visible,ve=re===void 0?!0:re,Ce=ne.removeOnLeave,He=Ce===void 0?!0:Ce,we=ne.forceRender,ze=ne.children,rt=ne.motionName,vt=ne.leavedClassName,xt=ne.eventProps,Ft=Pe(ne),dn=Object(D.useRef)(),Dn=Object(D.useRef)();function On(){try{return Object(Xt.a)(dn.current||Dn.current)}catch(gi){return null}}var Jn=ui(Ft,ve,On,ne),ni=Object(Q.a)(Jn,4),Xn=ni[0],ei=ni[1],oi=ni[2],An=ni[3],Ti=D.useRef(An);An&&(Ti.current=!0);var Tn=Object(D.useRef)(he);Tn.current=he;var St=D.useCallback(function(gi){dn.current=gi,Object(Wt.b)(Tn.current,gi)},[]),jt,Zn=Object(Y.a)(Object(Y.a)({},xt),{},{visible:ve});if(!ze)jt=null;else if(Xn===sn||!Pe(ne))An?jt=ze(Object(Y.a)({},Zn),St):!He&&Ti.current?jt=ze(Object(Y.a)(Object(Y.a)({},Zn),{},{className:vt}),St):we?jt=ze(Object(Y.a)(Object(Y.a)({},Zn),{},{style:{display:"none"}}),St):jt=null;else{var pi,yn;ei===Qn?yn="prepare":Pt(ei)?yn="active":ei===ir&&(yn="start"),jt=ze(Object(Y.a)(Object(Y.a)({},Zn),{},{className:H()(Ln(rt,Xn),(pi={},Object(le.a)(pi,Ln(rt,"".concat(Xn,"-").concat(yn)),yn),Object(le.a)(pi,rt,typeof rt=="string"),pi)),style:oi}),St)}return D.createElement(Bi,{ref:Dn},jt)});return ge.displayName="CSSMotion",ge}var Pi=Ai(gn),ct="add",Zt="keep",Ei="remove",ji="removed";function ri(me){var De;return me&&Object(N.a)(me)==="object"&&"key"in me?De=me:De={key:me},Object(Y.a)(Object(Y.a)({},De),{},{key:String(De.key)})}function ii(){var me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return me.map(ri)}function X(){var me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Pe=[],ge=0,ne=De.length,he=ii(me),re=ii(De);he.forEach(function(He){for(var we=!1,ze=ge;ze<ne;ze+=1){var rt=re[ze];if(rt.key===He.key){ge<ze&&(Pe=Pe.concat(re.slice(ge,ze).map(function(vt){return Object(Y.a)(Object(Y.a)({},vt),{},{status:ct})})),ge=ze),Pe.push(Object(Y.a)(Object(Y.a)({},rt),{},{status:Zt})),ge+=1,we=!0;break}}we||Pe.push(Object(Y.a)(Object(Y.a)({},He),{},{status:Ei}))}),ge<ne&&(Pe=Pe.concat(re.slice(ge).map(function(He){return Object(Y.a)(Object(Y.a)({},He),{},{status:ct})})));var ve={};Pe.forEach(function(He){var we=He.key;ve[we]=(ve[we]||0)+1});var Ce=Object.keys(ve).filter(function(He){return ve[He]>1});return Ce.forEach(function(He){Pe=Pe.filter(function(we){var ze=we.key,rt=we.status;return ze!==He||rt!==Ei}),Pe.forEach(function(we){we.key===He&&(we.status=Zt)})}),Pe}var v=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function O(me){var De=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Pi,Pe=function(ge){Object(S.a)(he,ge);var ne=Object(y.a)(he);function he(){var re;return Object(A.a)(this,he),re=ne.apply(this,arguments),re.state={keyEntities:[]},re.removeKey=function(ve){re.setState(function(Ce){var He=Ce.keyEntities;return{keyEntities:He.map(function(we){return we.key!==ve?we:Object(Y.a)(Object(Y.a)({},we),{},{status:ji})})}})},re}return Object(w.a)(he,[{key:"render",value:function(){var ve=this,Ce=this.state.keyEntities,He=this.props,we=He.component,ze=He.children,rt=He.onVisibleChanged,vt=Object(P.a)(He,["component","children","onVisibleChanged"]),xt=we||D.Fragment,Ft={};return v.forEach(function(dn){Ft[dn]=vt[dn],delete vt[dn]}),delete vt.keys,D.createElement(xt,vt,Ce.map(function(dn){var Dn=dn.status,On=Object(P.a)(dn,["status"]),Jn=Dn===ct||Dn===Zt;return D.createElement(De,Object(x.a)({},Ft,{key:On.key,visible:Jn,eventProps:On,onVisibleChanged:function(Xn){rt==null||rt(Xn,{key:On.key}),Xn||ve.removeKey(On.key)}}),ze)}))}}],[{key:"getDerivedStateFromProps",value:function(ve,Ce){var He=ve.keys,we=Ce.keyEntities,ze=ii(He),rt=X(we,ze);return{keyEntities:rt.filter(function(vt){var xt=we.find(function(Ft){var dn=Ft.key;return vt.key===dn});return!(xt&&xt.status===ji&&vt.status===Ei)})}}}]),he}(D.Component);return Pe.defaultProps={component:"div"},Pe}var B=O(gn),te=Pi;function z(me){var De=me.prefixCls,Pe=me.motion,ge=me.animation,ne=me.transitionName;return Pe||(ge?{motionName:"".concat(De,"-").concat(ge)}:ne?{motionName:ne}:null)}function be(me){var De=me.prefixCls,Pe=me.visible,ge=me.zIndex,ne=me.mask,he=me.maskMotion,re=me.maskAnimation,ve=me.maskTransitionName;if(!ne)return null;var Ce={};return(he||ve||re)&&(Ce=Object(Y.a)({motionAppear:!0},z({motion:he,prefixCls:De,transitionName:ve,animation:re}))),D.createElement(te,Object(x.a)({},Ce,{visible:Pe,removeOnLeave:!0}),function(He){var we=He.className;return D.createElement("div",{style:{zIndex:ge},className:H()("".concat(De,"-mask"),we)})})}var tt=q("9mu1"),Ot=q("o0o1"),Ct=q.n(Ot),at=q("HaE+"),Yt=["measure","align",null,"motion"],Cn=function(me,De){var Pe=Object(D.useState)(null),ge=Object(Q.a)(Pe,2),ne=ge[0],he=ge[1],re=Object(D.useRef)(),ve=Object(D.useRef)(!1);function Ce(ze){ve.current||he(ze)}function He(){Tt.a.cancel(re.current)}function we(ze){He(),re.current=Object(Tt.a)(function(){Ce(function(rt){switch(ne){case"align":return"motion";case"motion":return"stable";default:}return rt}),ze==null||ze()})}return Object(D.useEffect)(function(){Ce("measure")},[me]),Object(D.useEffect)(function(){switch(ne){case"measure":De();break;default:}ne&&(re.current=Object(Tt.a)(Object(at.a)(Ct.a.mark(function ze(){var rt,vt;return Ct.a.wrap(function(Ft){for(;;)switch(Ft.prev=Ft.next){case 0:rt=Yt.indexOf(ne),vt=Yt[rt+1],vt&&rt!==-1&&Ce(vt);case 3:case"end":return Ft.stop()}},ze)}))))},[ne]),Object(D.useEffect)(function(){return function(){ve.current=!0,He()}},[]),[ne,we]},Nn=function(me){var De=D.useState({width:0,height:0}),Pe=Object(Q.a)(De,2),ge=Pe[0],ne=Pe[1];function he(ve){ne({width:ve.offsetWidth,height:ve.offsetHeight})}var re=D.useMemo(function(){var ve={};if(me){var Ce=ge.width,He=ge.height;me.indexOf("height")!==-1&&He?ve.height=He:me.indexOf("minHeight")!==-1&&He&&(ve.minHeight=He),me.indexOf("width")!==-1&&Ce?ve.width=Ce:me.indexOf("minWidth")!==-1&&Ce&&(ve.minWidth=Ce)}return ve},[me,ge]);return[re,he]},Hi=D.forwardRef(function(me,De){var Pe=me.visible,ge=me.prefixCls,ne=me.className,he=me.style,re=me.children,ve=me.zIndex,Ce=me.stretch,He=me.destroyPopupOnHide,we=me.forceRender,ze=me.align,rt=me.point,vt=me.getRootDomNode,xt=me.getClassNameFromAlign,Ft=me.onAlign,dn=me.onMouseEnter,Dn=me.onMouseLeave,On=me.onMouseDown,Jn=me.onTouchStart,ni=Object(D.useRef)(),Xn=Object(D.useRef)(),ei=Object(D.useState)(),oi=Object(Q.a)(ei,2),An=oi[0],Ti=oi[1],Tn=Nn(Ce),St=Object(Q.a)(Tn,2),jt=St[0],Zn=St[1];function pi(){Ce&&Zn(vt())}var yn=Cn(Pe,pi),gi=Object(Q.a)(yn,2),Yi=gi[0],vi=gi[1],Ni=Object(D.useRef)();function Ii(){return rt||vt}function Si(){var Qi;(Qi=ni.current)===null||Qi===void 0||Qi.forceAlign()}function Ci(Qi,Ki){var Vi=xt(Ki);An!==Vi&&Ti(Vi),Yi==="align"&&(An!==Vi?Promise.resolve().then(function(){Si()}):vi(function(){var Ji;(Ji=Ni.current)===null||Ji===void 0||Ji.call(Ni)}),Ft==null||Ft(Qi,Ki))}var Mn=Object(Y.a)({},z(me));["onAppearEnd","onEnterEnd","onLeaveEnd"].forEach(function(Qi){var Ki=Mn[Qi];Mn[Qi]=function(Vi,Ji){return vi(),Ki==null?void 0:Ki(Vi,Ji)}});function or(){return new Promise(function(Qi){Ni.current=Qi})}D.useEffect(function(){!Mn.motionName&&Yi==="motion"&&vi()},[Mn.motionName,Yi]),D.useImperativeHandle(De,function(){return{forceAlign:Si,getElement:function(){return Xn.current}}});var $r=Object(Y.a)(Object(Y.a)({},jt),{},{zIndex:ve,opacity:Yi==="motion"||Yi==="stable"||!Pe?void 0:0,pointerEvents:Yi==="stable"?void 0:"none"},he),Pr=!0;(ze==null?void 0:ze.points)&&(Yi==="align"||Yi==="stable")&&(Pr=!1);var Er=re;return D.Children.count(re)>1&&(Er=D.createElement("div",{className:"".concat(ge,"-content")},re)),D.createElement(te,Object(x.a)({visible:Pe,ref:Xn,leavedClassName:"".concat(ge,"-hidden")},Mn,{onAppearPrepare:or,onEnterPrepare:or,removeOnLeave:He,forceRender:we}),function(Qi,Ki){var Vi=Qi.className,Ji=Qi.style,Nr=H()(ge,ne,An,Vi);return D.createElement(tt.a,{target:Ii(),key:"popup",ref:ni,monitorWindowResize:!0,disabled:Pr,align:ze,onAlign:Ci},D.createElement("div",{ref:Ki,className:Nr,onMouseEnter:dn,onMouseLeave:Dn,onMouseDownCapture:On,onTouchStartCapture:Jn,style:Object(Y.a)(Object(Y.a)({},Ji),$r)},Er))})});Hi.displayName="PopupInner";var Ri=Hi,fi=D.forwardRef(function(me,De){var Pe=me.prefixCls,ge=me.visible,ne=me.zIndex,he=me.children,re=me.mobile;re=re===void 0?{}:re;var ve=re.popupClassName,Ce=re.popupStyle,He=re.popupMotion,we=He===void 0?{}:He,ze=re.popupRender,rt=D.useRef();D.useImperativeHandle(De,function(){return{forceAlign:function(){},getElement:function(){return rt.current}}});var vt=Object(Y.a)({zIndex:ne},Ce),xt=he;return D.Children.count(he)>1&&(xt=D.createElement("div",{className:"".concat(Pe,"-content")},he)),ze&&(xt=ze(xt)),D.createElement(te,Object(x.a)({visible:ge,ref:rt,removeOnLeave:!0},we),function(Ft,dn){var Dn=Ft.className,On=Ft.style,Jn=H()(Pe,ve,Dn);return D.createElement("div",{ref:dn,className:Jn,style:Object(Y.a)(Object(Y.a)({},On),vt)},xt)})});fi.displayName="MobilePopupInner";var sr=fi,rr=["visible","mobile"],wi=D.forwardRef(function(me,De){var Pe=me.visible,ge=me.mobile,ne=Object(P.a)(me,rr),he=Object(D.useState)(Pe),re=Object(Q.a)(he,2),ve=re[0],Ce=re[1],He=Object(D.useState)(!1),we=Object(Q.a)(He,2),ze=we[0],rt=we[1],vt=Object(Y.a)(Object(Y.a)({},ne),{},{visible:ve});Object(D.useEffect)(function(){Ce(Pe),Pe&&ge&&rt(Be())},[Pe,ge]);var xt=ze?D.createElement(sr,Object(x.a)({},vt,{mobile:ge,ref:De})):D.createElement(Ri,Object(x.a)({},vt,{ref:De}));return D.createElement("div",null,D.createElement(be,vt),xt)});wi.displayName="Popup";var lr=wi,mr=D.createContext(null),ai=mr;function on(){}function ci(){return""}function Qt(me){return me?me.ownerDocument:window.document}var di=["onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur","onContextMenu"];function Fn(me){var De=function(Pe){Object(S.a)(ne,Pe);var ge=Object(y.a)(ne);function ne(he){var re;Object(A.a)(this,ne),re=ge.call(this,he),re.popupRef=D.createRef(),re.triggerRef=D.createRef(),re.attachId=void 0,re.clickOutsideHandler=void 0,re.touchOutsideHandler=void 0,re.contextMenuOutsideHandler1=void 0,re.contextMenuOutsideHandler2=void 0,re.mouseDownTimeout=void 0,re.focusTime=void 0,re.preClickTime=void 0,re.preTouchTime=void 0,re.delayTimer=void 0,re.hasPopupMouseDown=void 0,re.onMouseEnter=function(Ce){var He=re.props.mouseEnterDelay;re.fireEvents("onMouseEnter",Ce),re.delaySetPopupVisible(!0,He,He?null:Ce)},re.onMouseMove=function(Ce){re.fireEvents("onMouseMove",Ce),re.setPoint(Ce)},re.onMouseLeave=function(Ce){re.fireEvents("onMouseLeave",Ce),re.delaySetPopupVisible(!1,re.props.mouseLeaveDelay)},re.onPopupMouseEnter=function(){re.clearDelayTimer()},re.onPopupMouseLeave=function(Ce){var He;if(Ce.relatedTarget&&!Ce.relatedTarget.setTimeout&&Object(hn.a)((He=re.popupRef.current)===null||He===void 0?void 0:He.getElement(),Ce.relatedTarget))return;re.delaySetPopupVisible(!1,re.props.mouseLeaveDelay)},re.onFocus=function(Ce){re.fireEvents("onFocus",Ce),re.clearDelayTimer(),re.isFocusToShow()&&(re.focusTime=Date.now(),re.delaySetPopupVisible(!0,re.props.focusDelay))},re.onMouseDown=function(Ce){re.fireEvents("onMouseDown",Ce),re.preClickTime=Date.now()},re.onTouchStart=function(Ce){re.fireEvents("onTouchStart",Ce),re.preTouchTime=Date.now()},re.onBlur=function(Ce){re.fireEvents("onBlur",Ce),re.clearDelayTimer(),re.isBlurToHide()&&re.delaySetPopupVisible(!1,re.props.blurDelay)},re.onContextMenu=function(Ce){Ce.preventDefault(),re.fireEvents("onContextMenu",Ce),re.setPopupVisible(!0,Ce)},re.onContextMenuClose=function(){re.isContextMenuToShow()&&re.close()},re.onClick=function(Ce){if(re.fireEvents("onClick",Ce),re.focusTime){var He;if(re.preClickTime&&re.preTouchTime?He=Math.min(re.preClickTime,re.preTouchTime):re.preClickTime?He=re.preClickTime:re.preTouchTime&&(He=re.preTouchTime),Math.abs(He-re.focusTime)<20)return;re.focusTime=0}re.preClickTime=0,re.preTouchTime=0,re.isClickToShow()&&(re.isClickToHide()||re.isBlurToHide())&&Ce&&Ce.preventDefault&&Ce.preventDefault();var we=!re.state.popupVisible;(re.isClickToHide()&&!we||we&&re.isClickToShow())&&re.setPopupVisible(!re.state.popupVisible,Ce)},re.onPopupMouseDown=function(){if(re.hasPopupMouseDown=!0,clearTimeout(re.mouseDownTimeout),re.mouseDownTimeout=window.setTimeout(function(){re.hasPopupMouseDown=!1},0),re.context){var Ce;(Ce=re.context).onPopupMouseDown.apply(Ce,arguments)}},re.onDocumentClick=function(Ce){if(re.props.mask&&!re.props.maskClosable)return;var He=Ce.target,we=re.getRootDomNode(),ze=re.getPopupDomNode();(!Object(hn.a)(we,He)||re.isContextMenuOnly())&&!Object(hn.a)(ze,He)&&!re.hasPopupMouseDown&&re.close()},re.getRootDomNode=function(){var Ce=re.props.getTriggerDOMNode;if(Ce)return Ce(re.triggerRef.current);try{var He=Object(Xt.a)(re.triggerRef.current);if(He)return He}catch(we){}return zt.a.findDOMNode(Object(_.a)(re))},re.getPopupClassNameFromAlign=function(Ce){var He=[],we=re.props,ze=we.popupPlacement,rt=we.builtinPlacements,vt=we.prefixCls,xt=we.alignPoint,Ft=we.getPopupClassNameFromAlign;return ze&&rt&&He.push(wt(rt,vt,Ce,xt)),Ft&&He.push(Ft(Ce)),He.join(" ")},re.getComponent=function(){var Ce=re.props,He=Ce.prefixCls,we=Ce.destroyPopupOnHide,ze=Ce.popupClassName,rt=Ce.onPopupAlign,vt=Ce.popupMotion,xt=Ce.popupAnimation,Ft=Ce.popupTransitionName,dn=Ce.popupStyle,Dn=Ce.mask,On=Ce.maskAnimation,Jn=Ce.maskTransitionName,ni=Ce.maskMotion,Xn=Ce.zIndex,ei=Ce.popup,oi=Ce.stretch,An=Ce.alignPoint,Ti=Ce.mobile,Tn=Ce.forceRender,St=re.state,jt=St.popupVisible,Zn=St.point,pi=re.getPopupAlign(),yn={};return re.isMouseEnterToShow()&&(yn.onMouseEnter=re.onPopupMouseEnter),re.isMouseLeaveToHide()&&(yn.onMouseLeave=re.onPopupMouseLeave),yn.onMouseDown=re.onPopupMouseDown,yn.onTouchStart=re.onPopupMouseDown,D.createElement(lr,Object(x.a)({prefixCls:He,destroyPopupOnHide:we,visible:jt,point:An&&Zn,className:ze,align:pi,onAlign:rt,animation:xt,getClassNameFromAlign:re.getPopupClassNameFromAlign},yn,{stretch:oi,getRootDomNode:re.getRootDomNode,style:dn,mask:Dn,zIndex:Xn,transitionName:Ft,maskAnimation:On,maskTransitionName:Jn,maskMotion:ni,ref:re.popupRef,motion:vt,mobile:Ti,forceRender:Tn}),typeof ei=="function"?ei():ei)},re.attachParent=function(Ce){Tt.a.cancel(re.attachId);var He=re.props,we=He.getPopupContainer,ze=He.getDocument,rt=re.getRootDomNode(),vt;we?(rt||we.length===0)&&(vt=we(rt)):vt=ze(re.getRootDomNode()).body,vt?vt.appendChild(Ce):re.attachId=Object(Tt.a)(function(){re.attachParent(Ce)})},re.getContainer=function(){var Ce=re.props.getDocument,He=Ce(re.getRootDomNode()).createElement("div");return He.style.position="absolute",He.style.top="0",He.style.left="0",He.style.width="100%",re.attachParent(He),He},re.setPoint=function(Ce){var He=re.props.alignPoint;if(!He||!Ce)return;re.setState({point:{pageX:Ce.pageX,pageY:Ce.pageY}})},re.handlePortalUpdate=function(){re.state.prevPopupVisible!==re.state.popupVisible&&re.props.afterPopupVisibleChange(re.state.popupVisible)},re.triggerContextValue={onPopupMouseDown:re.onPopupMouseDown};var ve;return"popupVisible"in he?ve=!!he.popupVisible:ve=!!he.defaultPopupVisible,re.state={prevPopupVisible:ve,popupVisible:ve},di.forEach(function(Ce){re["fire".concat(Ce)]=function(He){re.fireEvents(Ce,He)}}),re}return Object(w.a)(ne,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var re=this.props,ve=this.state;if(ve.popupVisible){var Ce;!this.clickOutsideHandler&&(this.isClickToHide()||this.isContextMenuToShow())&&(Ce=re.getDocument(this.getRootDomNode()),this.clickOutsideHandler=Object(it.a)(Ce,"mousedown",this.onDocumentClick)),this.touchOutsideHandler||(Ce=Ce||re.getDocument(this.getRootDomNode()),this.touchOutsideHandler=Object(it.a)(Ce,"touchstart",this.onDocumentClick)),!this.contextMenuOutsideHandler1&&this.isContextMenuToShow()&&(Ce=Ce||re.getDocument(this.getRootDomNode()),this.contextMenuOutsideHandler1=Object(it.a)(Ce,"scroll",this.onContextMenuClose)),!this.contextMenuOutsideHandler2&&this.isContextMenuToShow()&&(this.contextMenuOutsideHandler2=Object(it.a)(window,"blur",this.onContextMenuClose));return}this.clearOutsideHandler()}},{key:"componentWillUnmount",value:function(){this.clearDelayTimer(),this.clearOutsideHandler(),clearTimeout(this.mouseDownTimeout),Tt.a.cancel(this.attachId)}},{key:"getPopupDomNode",value:function(){var re;return((re=this.popupRef.current)===null||re===void 0?void 0:re.getElement())||null}},{key:"getPopupAlign",value:function(){var re=this.props,ve=re.popupPlacement,Ce=re.popupAlign,He=re.builtinPlacements;return ve&&He?qe(He,ve,Ce):Ce}},{key:"setPopupVisible",value:function(re,ve){var Ce=this.props.alignPoint,He=this.state.popupVisible;this.clearDelayTimer(),He!==re&&("popupVisible"in this.props||this.setState({popupVisible:re,prevPopupVisible:He}),this.props.onPopupVisibleChange(re)),Ce&&ve&&re&&this.setPoint(ve)}},{key:"delaySetPopupVisible",value:function(re,ve,Ce){var He=this,we=ve*1e3;if(this.clearDelayTimer(),we){var ze=Ce?{pageX:Ce.pageX,pageY:Ce.pageY}:null;this.delayTimer=window.setTimeout(function(){He.setPopupVisible(re,ze),He.clearDelayTimer()},we)}else this.setPopupVisible(re,Ce)}},{key:"clearDelayTimer",value:function(){this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=null)}},{key:"clearOutsideHandler",value:function(){this.clickOutsideHandler&&(this.clickOutsideHandler.remove(),this.clickOutsideHandler=null),this.contextMenuOutsideHandler1&&(this.contextMenuOutsideHandler1.remove(),this.contextMenuOutsideHandler1=null),this.contextMenuOutsideHandler2&&(this.contextMenuOutsideHandler2.remove(),this.contextMenuOutsideHandler2=null),this.touchOutsideHandler&&(this.touchOutsideHandler.remove(),this.touchOutsideHandler=null)}},{key:"createTwoChains",value:function(re){var ve=this.props.children.props,Ce=this.props;return ve[re]&&Ce[re]?this["fire".concat(re)]:ve[re]||Ce[re]}},{key:"isClickToShow",value:function(){var re=this.props,ve=re.action,Ce=re.showAction;return ve.indexOf("click")!==-1||Ce.indexOf("click")!==-1}},{key:"isContextMenuOnly",value:function(){var re=this.props.action;return re==="contextMenu"||re.length===1&&re[0]==="contextMenu"}},{key:"isContextMenuToShow",value:function(){var re=this.props,ve=re.action,Ce=re.showAction;return ve.indexOf("contextMenu")!==-1||Ce.indexOf("contextMenu")!==-1}},{key:"isClickToHide",value:function(){var re=this.props,ve=re.action,Ce=re.hideAction;return ve.indexOf("click")!==-1||Ce.indexOf("click")!==-1}},{key:"isMouseEnterToShow",value:function(){var re=this.props,ve=re.action,Ce=re.showAction;return ve.indexOf("hover")!==-1||Ce.indexOf("mouseEnter")!==-1}},{key:"isMouseLeaveToHide",value:function(){var re=this.props,ve=re.action,Ce=re.hideAction;return ve.indexOf("hover")!==-1||Ce.indexOf("mouseLeave")!==-1}},{key:"isFocusToShow",value:function(){var re=this.props,ve=re.action,Ce=re.showAction;return ve.indexOf("focus")!==-1||Ce.indexOf("focus")!==-1}},{key:"isBlurToHide",value:function(){var re=this.props,ve=re.action,Ce=re.hideAction;return ve.indexOf("focus")!==-1||Ce.indexOf("blur")!==-1}},{key:"forcePopupAlign",value:function(){if(this.state.popupVisible){var re;(re=this.popupRef.current)===null||re===void 0||re.forceAlign()}}},{key:"fireEvents",value:function(re,ve){var Ce=this.props.children.props[re];Ce&&Ce(ve);var He=this.props[re];He&&He(ve)}},{key:"close",value:function(){this.setPopupVisible(!1)}},{key:"render",value:function(){var re=this.state.popupVisible,ve=this.props,Ce=ve.children,He=ve.forceRender,we=ve.alignPoint,ze=ve.className,rt=ve.autoDestroy,vt=D.Children.only(Ce),xt={key:"trigger"};this.isContextMenuToShow()?xt.onContextMenu=this.onContextMenu:xt.onContextMenu=this.createTwoChains("onContextMenu"),this.isClickToHide()||this.isClickToShow()?(xt.onClick=this.onClick,xt.onMouseDown=this.onMouseDown,xt.onTouchStart=this.onTouchStart):(xt.onClick=this.createTwoChains("onClick"),xt.onMouseDown=this.createTwoChains("onMouseDown"),xt.onTouchStart=this.createTwoChains("onTouchStart")),this.isMouseEnterToShow()?(xt.onMouseEnter=this.onMouseEnter,we&&(xt.onMouseMove=this.onMouseMove)):xt.onMouseEnter=this.createTwoChains("onMouseEnter"),this.isMouseLeaveToHide()?xt.onMouseLeave=this.onMouseLeave:xt.onMouseLeave=this.createTwoChains("onMouseLeave"),this.isFocusToShow()||this.isBlurToHide()?(xt.onFocus=this.onFocus,xt.onBlur=this.onBlur):(xt.onFocus=this.createTwoChains("onFocus"),xt.onBlur=this.createTwoChains("onBlur"));var Ft=H()(vt&&vt.props&&vt.props.className,ze);Ft&&(xt.className=Ft);var dn=Object(Y.a)({},xt);Object(Wt.c)(vt)&&(dn.ref=Object(Wt.a)(this.triggerRef,vt.ref));var Dn=D.cloneElement(vt,dn),On;return(re||this.popupRef.current||He)&&(On=D.createElement(me,{key:"portal",getContainer:this.getContainer,didUpdate:this.handlePortalUpdate},this.getComponent())),!re&&rt&&(On=null),D.createElement(ai.Provider,{value:this.triggerContextValue},Dn,On)}}],[{key:"getDerivedStateFromProps",value:function(re,ve){var Ce=re.popupVisible,He={};return Ce!==void 0&&ve.popupVisible!==Ce&&(He.popupVisible=Ce,He.prevPopupVisible=ve.popupVisible),He}}]),ne}(D.Component);return De.contextType=ai,De.defaultProps={prefixCls:"rc-trigger-popup",getPopupClassNameFromAlign:ci,getDocument:Qt,onPopupVisibleChange:on,afterPopupVisibleChange:on,onPopupAlign:on,popupClassName:"",mouseEnterDelay:0,mouseLeaveDelay:.1,focusDelay:0,blurDelay:.15,popupStyle:{},destroyPopupOnHide:!1,popupAlign:{},defaultPopupVisible:!1,mask:!1,maskClosable:!0,action:[],showAction:[],hideAction:[],autoDestroy:!1},De}var bi=Fn(un.a),$={adjustX:1,adjustY:1},pe={topLeft:{points:["bl","tl"],overflow:$,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:$,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:$,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:$,offset:[4,0]}},Oe={topLeft:{points:["bl","tl"],overflow:$,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:$,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:$,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:$,offset:[4,0]}},Re=pe,Ge=0,Me={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},$e=function(De,Pe,ge){var ne=je(Pe),he=De.getState();De.setState({defaultActiveFirst:Object(Y.a)(Object(Y.a)({},he.defaultActiveFirst),{},Object(le.a)({},ne,ge))})},Ye=function(me){Object(S.a)(Pe,me);var De=Object(y.a)(Pe);function Pe(ge){var ne;Object(A.a)(this,Pe),ne=De.call(this,ge),ne.onDestroy=function(we){ne.props.onDestroy(we)},ne.onKeyDown=function(we){var ze=we.keyCode,rt=ne.menuInstance,vt=ne.props.store,xt=ne.getVisible();if(ze===c.a.ENTER)return ne.onTitleClick(we),$e(vt,ne.props.eventKey,!0),!0;if(ze===c.a.RIGHT)return xt?rt.onKeyDown(we):(ne.triggerOpenChange(!0),$e(vt,ne.props.eventKey,!0)),!0;if(ze===c.a.LEFT){var Ft;if(xt)Ft=rt.onKeyDown(we);else return;return Ft||(ne.triggerOpenChange(!1),Ft=!0),Ft}return xt&&(ze===c.a.UP||ze===c.a.DOWN)?rt.onKeyDown(we):void 0},ne.onOpenChange=function(we){ne.props.onOpenChange(we)},ne.onPopupVisibleChange=function(we){ne.triggerOpenChange(we,we?"mouseenter":"mouseleave")},ne.onMouseEnter=function(we){var ze=ne.props,rt=ze.eventKey,vt=ze.onMouseEnter,xt=ze.store;$e(xt,ne.props.eventKey,!1),vt({key:rt,domEvent:we})},ne.onMouseLeave=function(we){var ze=ne.props,rt=ze.parentMenu,vt=ze.eventKey,xt=ze.onMouseLeave;rt.subMenuInstance=Object(_.a)(ne),xt({key:vt,domEvent:we})},ne.onTitleMouseEnter=function(we){var ze=ne.props,rt=ze.eventKey,vt=ze.onItemHover,xt=ze.onTitleMouseEnter;vt({key:rt,hover:!0}),xt({key:rt,domEvent:we})},ne.onTitleMouseLeave=function(we){var ze=ne.props,rt=ze.parentMenu,vt=ze.eventKey,xt=ze.onItemHover,Ft=ze.onTitleMouseLeave;rt.subMenuInstance=Object(_.a)(ne),xt({key:vt,hover:!1}),Ft({key:vt,domEvent:we})},ne.onTitleClick=function(we){var ze=Object(_.a)(ne),rt=ze.props;if(rt.onTitleClick({key:rt.eventKey,domEvent:we}),rt.triggerSubMenuAction==="hover")return;ne.triggerOpenChange(!ne.getVisible(),"click"),$e(rt.store,ne.props.eventKey,!1)},ne.onSubMenuClick=function(we){typeof ne.props.onClick=="function"&&ne.props.onClick(ne.addKeyPath(we))},ne.onSelect=function(we){ne.props.onSelect(we)},ne.onDeselect=function(we){ne.props.onDeselect(we)},ne.getPrefixCls=function(){return"".concat(ne.props.rootPrefixCls,"-submenu")},ne.getActiveClassName=function(){return"".concat(ne.getPrefixCls(),"-active")},ne.getDisabledClassName=function(){return"".concat(ne.getPrefixCls(),"-disabled")},ne.getSelectedClassName=function(){return"".concat(ne.getPrefixCls(),"-selected")},ne.getOpenClassName=function(){return"".concat(ne.props.rootPrefixCls,"-submenu-open")},ne.getVisible=function(){return ne.state.isOpen},ne.getMode=function(){return ne.state.mode},ne.saveMenuInstance=function(we){ne.menuInstance=we},ne.addKeyPath=function(we){return Object(Y.a)(Object(Y.a)({},we),{},{keyPath:(we.keyPath||[]).concat(ne.props.eventKey)})},ne.triggerOpenChange=function(we,ze){var rt=ne.props.eventKey,vt=function(){ne.onOpenChange({key:rt,item:Object(_.a)(ne),trigger:ze,open:we})};ze==="mouseenter"?ne.mouseenterTimeout=setTimeout(function(){vt()},0):vt()},ne.isChildrenSelected=function(){var we={find:!1};return ot(ne.props.children,ne.props.selectedKeys,we),we.find},ne.isInlineMode=function(){return ne.getMode()==="inline"},ne.adjustWidth=function(){if(!ne.subMenuTitle||!ne.menuInstance)return;var we=Vt.findDOMNode(ne.menuInstance);if(we.offsetWidth>=ne.subMenuTitle.offsetWidth)return;we.style.minWidth="".concat(ne.subMenuTitle.offsetWidth,"px")},ne.saveSubMenuTitle=function(we){ne.subMenuTitle=we},ne.getBaseProps=function(){var we=Object(_.a)(ne),ze=we.props,rt=ne.getMode();return{mode:rt==="horizontal"?"vertical":rt,visible:ne.getVisible(),level:ze.level+1,inlineIndent:ze.inlineIndent,focusable:!1,onClick:ne.onSubMenuClick,onSelect:ne.onSelect,onDeselect:ne.onDeselect,onDestroy:ne.onDestroy,selectedKeys:ze.selectedKeys,eventKey:"".concat(ze.eventKey,"-menu-"),openKeys:ze.openKeys,motion:ze.motion,onOpenChange:ne.onOpenChange,subMenuOpenDelay:ze.subMenuOpenDelay,parentMenu:Object(_.a)(ne),subMenuCloseDelay:ze.subMenuCloseDelay,forceSubMenuRender:ze.forceSubMenuRender,triggerSubMenuAction:ze.triggerSubMenuAction,builtinPlacements:ze.builtinPlacements,defaultActiveFirst:ze.store.getState().defaultActiveFirst[je(ze.eventKey)],multiple:ze.multiple,prefixCls:ze.rootPrefixCls,id:ne.internalMenuId,manualRef:ne.saveMenuInstance,itemIcon:ze.itemIcon,expandIcon:ze.expandIcon,direction:ze.direction}},ne.getMotion=function(we,ze){var rt=Object(_.a)(ne),vt=rt.haveRendered,xt=ne.props,Ft=xt.motion,dn=xt.rootPrefixCls,Dn=Object(Y.a)(Object(Y.a)({},Ft),{},{leavedClassName:"".concat(dn,"-hidden"),removeOnLeave:!1,motionAppear:vt||!ze||we!=="inline"});return Dn};var he=ge.store,re=ge.eventKey,ve=he.getState(),Ce=ve.defaultActiveFirst;ne.isRootMenu=!1;var He=!1;return Ce&&(He=Ce[re]),$e(he,re,He),ne.state={mode:ge.mode,isOpen:ge.isOpen},ne}return Object(w.a)(Pe,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var ne=this,he=this.props,re=he.mode,ve=he.parentMenu,Ce=he.manualRef,He=he.isOpen,we=function(){ne.setState({mode:re,isOpen:He})},ze=He!==this.state.isOpen,rt=re!==this.state.mode;if((rt||ze)&&(Tt.a.cancel(this.updateStateRaf),rt?this.updateStateRaf=Object(Tt.a)(we):we()),Ce&&Ce(this),re!=="horizontal"||!(ve==null?void 0:ve.isRootMenu)||!He)return;this.minWidthTimeout=setTimeout(function(){return ne.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var ne=this.props,he=ne.onDestroy,re=ne.eventKey;he&&he(re),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout),Tt.a.cancel(this.updateStateRaf)}},{key:"renderPopupMenu",value:function(ne,he){var re=this.getBaseProps();return D.createElement(pn,Object(x.a)({},re,{id:this.internalMenuId,className:ne,style:he}),this.props.children)}},{key:"renderChildren",value:function(){var ne=this,he=this.getBaseProps(),re=he.mode,ve=he.visible,Ce=he.forceSubMenuRender,He=he.direction,we=this.getMotion(re,ve);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||ve||Ce,!this.haveOpened)return D.createElement("div",null);var ze=H()("".concat(he.prefixCls,"-sub"),Object(le.a)({},"".concat(he.prefixCls,"-rtl"),He==="rtl"));return this.isInlineMode()?D.createElement(te,Object(x.a)({visible:he.visible,forceRender:Ce},we),function(rt){var vt=rt.className,xt=rt.style,Ft=H()(ze,vt);return ne.renderPopupMenu(Ft,xt)}):this.renderPopupMenu(ze)}},{key:"render",value:function(){var ne,he,re,ve=Object(Y.a)({},this.props),Ce=this.getVisible(),He=this.getPrefixCls(),we=this.isInlineMode(),ze=this.getMode(),rt=H()(He,"".concat(He,"-").concat(ze),(ne={},Object(le.a)(ne,ve.className,!!ve.className),Object(le.a)(ne,this.getOpenClassName(),Ce),Object(le.a)(ne,this.getActiveClassName(),ve.active||Ce&&!we),Object(le.a)(ne,this.getDisabledClassName(),ve.disabled),Object(le.a)(ne,this.getSelectedClassName(),this.isChildrenSelected()),ne));this.internalMenuId||(ve.eventKey?this.internalMenuId="".concat(ve.eventKey,"$Menu"):(Ge+=1,this.internalMenuId="$__$".concat(Ge,"$Menu")));var vt={},xt={},Ft={};ve.disabled||(vt={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},xt={onClick:this.onTitleClick},Ft={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var dn={},Dn=ve.direction,On=Dn==="rtl";we&&(On?dn.paddingRight=ve.inlineIndent*ve.level:dn.paddingLeft=ve.inlineIndent*ve.level);var Jn={};this.getVisible()&&(Jn={"aria-owns":this.internalMenuId});var ni=null;ze!=="horizontal"&&(ni=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(ni=D.createElement(this.props.expandIcon,Object(Y.a)({},this.props))));var Xn=D.createElement("div",Object(x.a)({ref:this.saveSubMenuTitle,style:dn,className:"".concat(He,"-title"),role:"button"},Ft,xt,{"aria-expanded":Ce},Jn,{"aria-haspopup":"true",title:typeof ve.title=="string"?ve.title:void 0}),ve.title,ni||D.createElement("i",{className:"".concat(He,"-arrow")})),ei=this.renderChildren(),oi=((he=ve.parentMenu)===null||he===void 0?void 0:he.isRootMenu)?ve.parentMenu.props.getPopupContainer:function(Ii){return Ii.parentNode},An=Me[ze],Ti=ve.popupOffset?{offset:ve.popupOffset}:{},Tn=H()((re={},Object(le.a)(re,ve.popupClassName,ve.popupClassName&&!we),Object(le.a)(re,"".concat(He,"-rtl"),On),re)),St=ve.disabled,jt=ve.triggerSubMenuAction,Zn=ve.subMenuOpenDelay,pi=ve.forceSubMenuRender,yn=ve.subMenuCloseDelay,gi=ve.builtinPlacements;st.forEach(function(Ii){return delete ve[Ii]}),delete ve.onClick;var Yi=On?Object(Y.a)(Object(Y.a)({},Oe),gi):Object(Y.a)(Object(Y.a)({},pe),gi);delete ve.direction;var vi=this.getBaseProps(),Ni=we?null:this.getMotion(vi.mode,vi.visible);return D.createElement("li",Object(x.a)({},ve,vt,{className:rt,role:"menuitem"}),D.createElement(bi,{prefixCls:He,popupClassName:H()("".concat(He,"-popup"),Tn),getPopupContainer:oi,builtinPlacements:Yi,popupPlacement:An,popupVisible:we?!1:Ce,popupAlign:Ti,popup:we?null:ei,action:St||we?[]:[jt],mouseEnterDelay:Zn,mouseLeaveDelay:yn,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:pi,popupMotion:Ni},Xn),we?ei:null)}}]),Pe}(D.Component);Ye.defaultProps={onMouseEnter:Ke,onMouseLeave:Ke,onTitleMouseEnter:Ke,onTitleMouseLeave:Ke,onTitleClick:Ke,manualRef:Ke,mode:"vertical",title:""};var ut=Object(h.b)(function(me,De){var Pe=me.openKeys,ge=me.activeKey,ne=me.selectedKeys,he=De.eventKey,re=De.subMenuKey;return{isOpen:Pe.indexOf(he)>-1,active:ge[re]===he,selectedKeys:ne}})(Ye);ut.isSubMenu=!0;var Ze=ut,dt="menuitem-overflowed",lt=.5,nt=function(me){Object(S.a)(Pe,me);var De=Object(y.a)(Pe);function Pe(){var ge;return Object(A.a)(this,Pe),ge=De.apply(this,arguments),ge.resizeObserver=null,ge.mutationObserver=null,ge.originalTotalWidth=0,ge.overflowedItems=[],ge.menuItemSizes=[],ge.cancelFrameId=null,ge.state={lastVisibleIndex:void 0},ge.childRef=D.createRef(),ge.getMenuItemNodes=function(){var ne=ge.props.prefixCls,he=ge.childRef.current;return he?[].slice.call(he.children).filter(function(re){return re.className.split(" ").indexOf("".concat(ne,"-overflowed-submenu"))<0}):[]},ge.getOverflowedSubMenuItem=function(ne,he,re){var ve=ge.props,Ce=ve.overflowedIndicator,He=ve.level,we=ve.mode,ze=ve.prefixCls,rt=ve.theme;if(He!==1||we!=="horizontal")return null;var vt=ge.props.children[0],xt=vt.props,Ft=xt.children,dn=xt.title,Dn=xt.style,On=Object(P.a)(xt,["children","title","style"]),Jn=Object(Y.a)({},Dn),ni="".concat(ne,"-overflowed-indicator"),Xn="".concat(ne,"-overflowed-indicator");he.length===0&&re!==!0?Jn=Object(Y.a)(Object(Y.a)({},Jn),{},{display:"none"}):re&&(Jn=Object(Y.a)(Object(Y.a)({},Jn),{},{visibility:"hidden",position:"absolute"}),ni="".concat(ni,"-placeholder"),Xn="".concat(Xn,"-placeholder"));var ei=rt?"".concat(ze,"-").concat(rt):"",oi={};return st.forEach(function(An){On[An]!==void 0&&(oi[An]=On[An])}),D.createElement(Ze,Object(x.a)({title:Ce,className:"".concat(ze,"-overflowed-submenu"),popupClassName:ei},oi,{key:ni,eventKey:Xn,disabled:!1,style:Jn}),he)},ge.setChildrenWidthAndResize=function(){if(ge.props.mode!=="horizontal")return;var ne=ge.childRef.current;if(!ne)return;var he=ne.children;if(!he||he.length===0)return;var re=ne.children[he.length-1];mt(re,"display","inline-block");var ve=ge.getMenuItemNodes(),Ce=ve.filter(function(He){return He.className.split(" ").indexOf(dt)>=0});Ce.forEach(function(He){mt(He,"display","inline-block")}),ge.menuItemSizes=ve.map(function(He){return ht(He,!0)}),Ce.forEach(function(He){mt(He,"display","none")}),ge.overflowedIndicatorWidth=ht(ne.children[ne.children.length-1],!0),ge.originalTotalWidth=ge.menuItemSizes.reduce(function(He,we){return He+we},0),ge.handleResize(),mt(re,"display","none")},ge.handleResize=function(){if(ge.props.mode!=="horizontal")return;var ne=ge.childRef.current;if(!ne)return;var he=ht(ne);ge.overflowedItems=[];var re=0,ve;ge.originalTotalWidth>he+lt&&(ve=-1,ge.menuItemSizes.forEach(function(Ce){re+=Ce,re+ge.overflowedIndicatorWidth<=he&&(ve+=1)})),ge.setState({lastVisibleIndex:ve})},ge}return Object(w.a)(Pe,[{key:"componentDidMount",value:function(){var ne=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var he=this.childRef.current;if(!he)return;this.resizeObserver=new Ht.default(function(re){re.forEach(function(){var ve=ne.cancelFrameId;cancelAnimationFrame(ve),ne.cancelFrameId=requestAnimationFrame(ne.setChildrenWidthAndResize)})}),[].slice.call(he.children).concat(he).forEach(function(re){ne.resizeObserver.observe(re)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){ne.resizeObserver.disconnect(),[].slice.call(he.children).concat(he).forEach(function(re){ne.resizeObserver.observe(re)}),ne.setChildrenWidthAndResize()}),this.mutationObserver.observe(he,{attributes:!1,childList:!0,subTree:!1}))}}},{key:"componentWillUnmount",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),cancelAnimationFrame(this.cancelFrameId)}},{key:"renderChildren",value:function(ne){var he=this,re=this.state.lastVisibleIndex;return(ne||[]).reduce(function(ve,Ce,He){var we=Ce;if(he.props.mode==="horizontal"){var ze=he.getOverflowedSubMenuItem(Ce.props.eventKey,[]);re!==void 0&&he.props.className.indexOf("".concat(he.props.prefixCls,"-root"))!==-1&&(He>re&&(we=D.cloneElement(Ce,{style:{display:"none"},eventKey:"".concat(Ce.props.eventKey,"-hidden"),className:"".concat(dt)})),He===re+1&&(he.overflowedItems=ne.slice(re+1).map(function(vt){return D.cloneElement(vt,{key:vt.props.eventKey,mode:"vertical-left"})}),ze=he.getOverflowedSubMenuItem(Ce.props.eventKey,he.overflowedItems)));var rt=[].concat(Object(R.a)(ve),[ze,we]);return He===ne.length-1&&rt.push(he.getOverflowedSubMenuItem(Ce.props.eventKey,[],!0)),rt}return[].concat(Object(R.a)(ve),[we])},[])}},{key:"render",value:function(){var ne=this.props,he=ne.visible,re=ne.prefixCls,ve=ne.overflowedIndicator,Ce=ne.mode,He=ne.level,we=ne.tag,ze=ne.children,rt=ne.theme,vt=Object(P.a)(ne,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),xt=we;return D.createElement(xt,Object(x.a)({ref:this.childRef},vt),this.renderChildren(ze))}}]),Pe}(D.Component);nt.defaultProps={tag:"div",className:""};var Et=nt;function pt(me){return me.length?me.every(function(De){return!!De.props.disabled}):!0}function Lt(me,De,Pe){var ge=me.getState();me.setState({activeKey:Object(Y.a)(Object(Y.a)({},ge.activeKey),{},Object(le.a)({},De,Pe))})}function bt(me){return me.eventKey||"0-menu-"}function Nt(me,De){var Pe=De,ge=me.children,ne=me.eventKey;if(Pe){var he;if(Qe(ge,function(re,ve){re&&re.props&&!re.props.disabled&&Pe===Je(re,ne,ve)&&(he=!0)}),he)return Pe}return Pe=null,me.defaultActiveFirst&&Qe(ge,function(re,ve){!Pe&&re&&!re.props.disabled&&(Pe=Je(re,ne,ve))}),Pe}function qt(me){if(!me)return;var De=this.instanceArray.indexOf(me);De!==-1?this.instanceArray[De]=me:this.instanceArray.push(me)}var rn=function(me){Object(S.a)(Pe,me);var De=Object(y.a)(Pe);function Pe(ge){var ne;return Object(A.a)(this,Pe),ne=De.call(this,ge),ne.onKeyDown=function(he,re){var ve=he.keyCode,Ce;if(ne.getFlatInstanceArray().forEach(function(we){we&&we.props.active&&we.onKeyDown&&(Ce=we.onKeyDown(he))}),Ce)return 1;var He=null;return(ve===c.a.UP||ve===c.a.DOWN)&&(He=ne.step(ve===c.a.UP?-1:1)),He?(he.preventDefault(),Lt(ne.props.store,bt(ne.props),He.props.eventKey),typeof re=="function"&&re(He),1):void 0},ne.onItemHover=function(he){var re=he.key,ve=he.hover;Lt(ne.props.store,bt(ne.props),ve?re:null)},ne.onDeselect=function(he){ne.props.onDeselect(he)},ne.onSelect=function(he){ne.props.onSelect(he)},ne.onClick=function(he){ne.props.onClick(he)},ne.onOpenChange=function(he){ne.props.onOpenChange(he)},ne.onDestroy=function(he){ne.props.onDestroy(he)},ne.getFlatInstanceArray=function(){return ne.instanceArray},ne.step=function(he){var re=ne.getFlatInstanceArray(),ve=ne.props.store.getState().activeKey[bt(ne.props)],Ce=re.length;if(!Ce)return null;he<0&&(re=re.concat().reverse());var He=-1;if(re.every(function(vt,xt){return vt&&vt.props.eventKey===ve?(He=xt,!1):!0}),!ne.props.defaultActiveFirst&&He!==-1&&pt(re.slice(He,Ce-1)))return;var we=(He+1)%Ce,ze=we;do{var rt=re[ze];if(!rt||rt.props.disabled)ze=(ze+1)%Ce;else return rt}while(ze!==we);return null},ne.renderCommonMenuItem=function(he,re,ve){var Ce=ne.props.store.getState(),He=Object(_.a)(ne),we=He.props,ze=Je(he,we.eventKey,re),rt=he.props;if(!rt||typeof he.type=="string")return he;var vt=ze===Ce.activeKey,xt=Object(Y.a)(Object(Y.a)({mode:rt.mode||we.mode,level:we.level,inlineIndent:we.inlineIndent,renderMenuItem:ne.renderMenuItem,rootPrefixCls:we.prefixCls,index:re,parentMenu:we.parentMenu,manualRef:rt.disabled?void 0:Object(m.a)(he.ref,qt.bind(Object(_.a)(ne))),eventKey:ze,active:!rt.disabled&&vt,multiple:we.multiple,onClick:function(dn){(rt.onClick||Ke)(dn),ne.onClick(dn)},onItemHover:ne.onItemHover,motion:we.motion,subMenuOpenDelay:we.subMenuOpenDelay,subMenuCloseDelay:we.subMenuCloseDelay,forceSubMenuRender:we.forceSubMenuRender,onOpenChange:ne.onOpenChange,onDeselect:ne.onDeselect,onSelect:ne.onSelect,builtinPlacements:we.builtinPlacements,itemIcon:rt.itemIcon||ne.props.itemIcon,expandIcon:rt.expandIcon||ne.props.expandIcon},ve),{},{direction:we.direction});return(we.mode==="inline"||ft())&&(xt.triggerSubMenuAction="click"),D.cloneElement(he,Object(Y.a)(Object(Y.a)({},xt),{},{key:ze||re}))},ne.renderMenuItem=function(he,re,ve){if(!he)return null;var Ce=ne.props.store.getState(),He={openKeys:Ce.openKeys,selectedKeys:Ce.selectedKeys,triggerSubMenuAction:ne.props.triggerSubMenuAction,subMenuKey:ve};return ne.renderCommonMenuItem(he,re,He)},ge.store.setState({activeKey:Object(Y.a)(Object(Y.a)({},ge.store.getState().activeKey),{},Object(le.a)({},ge.eventKey,Nt(ge,ge.activeKey)))}),ne.instanceArray=[],ne}return Object(w.a)(Pe,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(ne){return this.props.visible||ne.visible||this.props.className!==ne.className||!j()(this.props.style,ne.style)}},{key:"componentDidUpdate",value:function(ne){var he=this.props,re="activeKey"in he?he.activeKey:he.store.getState().activeKey[bt(he)],ve=Nt(he,re);if(ve!==re)Lt(he.store,bt(he),ve);else if("activeKey"in ne){var Ce=Nt(ne,ne.activeKey);ve!==Ce&&Lt(he.store,bt(he),ve)}}},{key:"render",value:function(){var ne=this,he=Object(x.a)({},this.props);this.instanceArray=[];var re=H()(he.prefixCls,he.className,"".concat(he.prefixCls,"-").concat(he.mode)),ve={className:re,role:he.role||"menu"};he.id&&(ve.id=he.id),he.focusable&&(ve.tabIndex=0,ve.onKeyDown=this.onKeyDown);var Ce=he.prefixCls,He=he.eventKey,we=he.visible,ze=he.level,rt=he.mode,vt=he.overflowedIndicator,xt=he.theme;return st.forEach(function(Ft){return delete he[Ft]}),delete he.onClick,D.createElement(Et,Object(x.a)({},he,{prefixCls:Ce,mode:rt,tag:"ul",level:ze,theme:xt,visible:we,overflowedIndicator:vt},ve),Object(I.a)(he.children).map(function(Ft,dn){return ne.renderMenuItem(Ft,dn,He||"0-menu-")}))}}]),Pe}(D.Component);rn.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:Ke};var ti=Object(h.b)()(rn),pn=ti,bn=q("Kwbf");function In(me,De,Pe){var ge=me.prefixCls,ne=me.motion,he=me.defaultMotions,re=he===void 0?{}:he,ve=me.openAnimation,Ce=me.openTransitionName,He=De.switchingModeFromInline;if(ne)return ne;if(Object(N.a)(ve)==="object"&&ve)Object(bn.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof ve=="string")return{motionName:"".concat(ge,"-open-").concat(ve)};if(Ce)return{motionName:Ce};var we=re[Pe];return we||(He?null:re.other)}var At=function(me){Object(S.a)(Pe,me);var De=Object(y.a)(Pe);function Pe(ge){var ne;Object(A.a)(this,Pe),ne=De.call(this,ge),ne.onSelect=function(ve){var Ce=Object(_.a)(ne),He=Ce.props;if(He.selectable){var we=ne.store.getState(),ze=we.selectedKeys,rt=ve.key;He.multiple?ze=ze.concat([rt]):ze=[rt],"selectedKeys"in He||ne.store.setState({selectedKeys:ze}),He.onSelect(Object(Y.a)(Object(Y.a)({},ve),{},{selectedKeys:ze}))}},ne.onClick=function(ve){var Ce=ne.getRealMenuMode(),He=Object(_.a)(ne),we=He.store,ze=He.props.onOpenChange;Ce!=="inline"&&!("openKeys"in ne.props)&&(we.setState({openKeys:[]}),ze([])),ne.props.onClick(ve)},ne.onKeyDown=function(ve,Ce){ne.innerMenu.getWrappedInstance().onKeyDown(ve,Ce)},ne.onOpenChange=function(ve){var Ce=Object(_.a)(ne),He=Ce.props,we=ne.store.getState().openKeys.concat(),ze=!1,rt=function(xt){var Ft=!1;if(xt.open)Ft=we.indexOf(xt.key)===-1,Ft&&we.push(xt.key);else{var dn=we.indexOf(xt.key);Ft=dn!==-1,Ft&&we.splice(dn,1)}ze=ze||Ft};Array.isArray(ve)?ve.forEach(rt):rt(ve),ze&&("openKeys"in ne.props||ne.store.setState({openKeys:we}),He.onOpenChange(we))},ne.onDeselect=function(ve){var Ce=Object(_.a)(ne),He=Ce.props;if(He.selectable){var we=ne.store.getState().selectedKeys.concat(),ze=ve.key,rt=we.indexOf(ze);rt!==-1&&we.splice(rt,1),"selectedKeys"in He||ne.store.setState({selectedKeys:we}),He.onDeselect(Object(Y.a)(Object(Y.a)({},ve),{},{selectedKeys:we}))}},ne.onMouseEnter=function(ve){ne.restoreModeVerticalFromInline();var Ce=ne.props.onMouseEnter;Ce&&Ce(ve)},ne.onTransitionEnd=function(ve){var Ce=ve.propertyName==="width"&&ve.target===ve.currentTarget,He=ve.target.className,we=Object.prototype.toString.call(He)==="[object SVGAnimatedString]"?He.animVal:He,ze=ve.propertyName==="font-size"&&we.indexOf("anticon")>=0;(Ce||ze)&&ne.restoreModeVerticalFromInline()},ne.setInnerMenu=function(ve){ne.innerMenu=ve},ne.isRootMenu=!0;var he=ge.defaultSelectedKeys,re=ge.defaultOpenKeys;return"selectedKeys"in ge&&(he=ge.selectedKeys||[]),"openKeys"in ge&&(re=ge.openKeys||[]),ne.store=Object(h.c)({selectedKeys:he,openKeys:re,activeKey:{"0-menu-":Nt(ge,ge.activeKey)}}),ne.state={switchingModeFromInline:!1,prevProps:ge,inlineOpenKeys:[],store:ne.store},ne}return Object(w.a)(Pe,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(ne){var he=this.props,re=he.siderCollapsed,ve=he.inlineCollapsed,Ce=he.onOpenChange;(!ne.inlineCollapsed&&ve||!ne.siderCollapsed&&re)&&Ce([]),this.updateMiniStore(),this.updateMenuDisplay()}},{key:"updateMenuDisplay",value:function(){var ne=this.props.collapsedWidth,he=this.store,re=this.prevOpenKeys,ve=this.getInlineCollapsed()&&(ne===0||ne==="0"||ne==="0px");ve?(this.prevOpenKeys=he.getState().openKeys.concat(),this.store.setState({openKeys:[]})):re&&(this.store.setState({openKeys:re}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var ne=this.props.mode,he=this.state.switchingModeFromInline,re=this.getInlineCollapsed();return he&&re?"inline":re?"vertical":ne}},{key:"getInlineCollapsed",value:function(){var ne=this.props,he=ne.inlineCollapsed,re=ne.siderCollapsed;return re!==void 0?re:he}},{key:"restoreModeVerticalFromInline",value:function(){var ne=this.state.switchingModeFromInline;ne&&this.setState({switchingModeFromInline:!1})}},{key:"updateMiniStore",value:function(){"selectedKeys"in this.props&&this.store.setState({selectedKeys:this.props.selectedKeys||[]}),"openKeys"in this.props&&this.store.setState({openKeys:this.props.openKeys||[]})}},{key:"render",value:function(){var ne=Object(Y.a)({},Object(E.a)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),he=this.getRealMenuMode();return ne.className+=" ".concat(ne.prefixCls,"-root"),ne.direction==="rtl"&&(ne.className+=" ".concat(ne.prefixCls,"-rtl")),ne=Object(Y.a)(Object(Y.a)({},ne),{},{mode:he,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:In(this.props,this.state,he)}),delete ne.openAnimation,delete ne.openTransitionName,D.createElement(h.a,{store:this.store},D.createElement(pn,Object(x.a)({},ne,{ref:this.setInnerMenu}),this.props.children))}}],[{key:"getDerivedStateFromProps",value:function(ne,he){var re=he.prevProps,ve=he.store,Ce=ve.getState(),He={},we={prevProps:ne};return re.mode==="inline"&&ne.mode!=="inline"&&(we.switchingModeFromInline=!0),"openKeys"in ne?He.openKeys=ne.openKeys||[]:((ne.inlineCollapsed&&!re.inlineCollapsed||ne.siderCollapsed&&!re.siderCollapsed)&&(we.switchingModeFromInline=!0,we.inlineOpenKeys=Ce.openKeys,He.openKeys=[]),(!ne.inlineCollapsed&&re.inlineCollapsed||!ne.siderCollapsed&&re.siderCollapsed)&&(He.openKeys=he.inlineOpenKeys,we.inlineOpenKeys=[])),Object.keys(He).length&&ve.setState(He),we}}]),Pe}(D.Component);At.defaultProps={selectable:!0,onClick:Ke,onSelect:Ke,onOpenChange:Ke,onDeselect:Ke,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:D.createElement("span",null,"\xB7\xB7\xB7")};var cn=At,Jt=function(me){Object(S.a)(Pe,me);var De=Object(y.a)(Pe);function Pe(){var ge;return Object(A.a)(this,Pe),ge=De.apply(this,arguments),ge.onKeyDown=function(ne){var he=ne.keyCode;return he===c.a.ENTER?(ge.onClick(ne),!0):void 0},ge.onMouseLeave=function(ne){var he=ge.props,re=he.eventKey,ve=he.onItemHover,Ce=he.onMouseLeave;ve({key:re,hover:!1}),Ce({key:re,domEvent:ne})},ge.onMouseEnter=function(ne){var he=ge.props,re=he.eventKey,ve=he.onItemHover,Ce=he.onMouseEnter;ve({key:re,hover:!0}),Ce({key:re,domEvent:ne})},ge.onClick=function(ne){var he=ge.props,re=he.eventKey,ve=he.multiple,Ce=he.onClick,He=he.onSelect,we=he.onDeselect,ze=he.isSelected,rt={key:re,keyPath:[re],item:Object(_.a)(ge),domEvent:ne};Ce(rt),ve?ze?we(rt):He(rt):ze||He(rt)},ge.saveNode=function(ne){ge.node=ne},ge}return Object(w.a)(Pe,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var ne=this.props;ne.onDestroy&&ne.onDestroy(ne.eventKey)}},{key:"getPrefixCls",value:function(){return"".concat(this.props.rootPrefixCls,"-item")}},{key:"getActiveClassName",value:function(){return"".concat(this.getPrefixCls(),"-active")}},{key:"getSelectedClassName",value:function(){return"".concat(this.getPrefixCls(),"-selected")}},{key:"getDisabledClassName",value:function(){return"".concat(this.getPrefixCls(),"-disabled")}},{key:"callRef",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"render",value:function(){var ne,he=Object(Y.a)({},this.props),re=H()(this.getPrefixCls(),he.className,(ne={},Object(le.a)(ne,this.getActiveClassName(),!he.disabled&&he.active),Object(le.a)(ne,this.getSelectedClassName(),he.isSelected),Object(le.a)(ne,this.getDisabledClassName(),he.disabled),ne)),ve=Object(Y.a)(Object(Y.a)({},he.attribute),{},{title:typeof he.title=="string"?he.title:void 0,className:re,role:he.role||"menuitem","aria-disabled":he.disabled});he.role==="option"?ve=Object(Y.a)(Object(Y.a)({},ve),{},{role:"option","aria-selected":he.isSelected}):(he.role===null||he.role==="none")&&(ve.role="none");var Ce={onClick:he.disabled?null:this.onClick,onMouseLeave:he.disabled?null:this.onMouseLeave,onMouseEnter:he.disabled?null:this.onMouseEnter},He=Object(Y.a)({},he.style);he.mode==="inline"&&(he.direction==="rtl"?He.paddingRight=he.inlineIndent*he.level:He.paddingLeft=he.inlineIndent*he.level),st.forEach(function(ze){return delete he[ze]}),delete he.direction;var we=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(we=D.createElement(this.props.itemIcon,this.props)),D.createElement("li",Object(x.a)({},Object(E.a)(he,["onClick","onMouseEnter","onMouseLeave","onSelect"]),ve,Ce,{style:He,ref:this.saveNode}),he.children,we)}}]),Pe}(D.Component);Jt.isMenuItem=!0,Jt.defaultProps={onSelect:Ke,onMouseEnter:Ke,onMouseLeave:Ke,manualRef:Ke};var wn=Object(h.b)(function(me,De){var Pe=me.activeKey,ge=me.selectedKeys,ne=De.eventKey,he=De.subMenuKey;return{active:Pe[he]===ne,isSelected:Array.isArray(ge)?ge.indexOf(ne)!==-1:ge===ne}})(Jt),En=wn,Vn=function(me){Object(S.a)(Pe,me);var De=Object(y.a)(Pe);function Pe(){var ge;return Object(A.a)(this,Pe),ge=De.apply(this,arguments),ge.renderInnerMenuItem=function(ne){var he=ge.props,re=he.renderMenuItem,ve=he.index;return re(ne,ve,ge.props.subMenuKey)},ge}return Object(w.a)(Pe,[{key:"render",value:function(){var ne=Object(x.a)({},this.props),he=ne.className,re=he===void 0?"":he,ve=ne.rootPrefixCls,Ce="".concat(ve,"-item-group-title"),He="".concat(ve,"-item-group-list"),we=ne.title,ze=ne.children;return st.forEach(function(rt){return delete ne[rt]}),delete ne.direction,D.createElement("li",Object(x.a)({},ne,{onClick:function(vt){return vt.stopPropagation()},className:"".concat(re," ").concat(ve,"-item-group")}),D.createElement("div",{className:Ce,title:typeof we=="string"?we:void 0},we),D.createElement("ul",{className:He},D.Children.map(ze,this.renderInnerMenuItem)))}}]),Pe}(D.Component);Vn.isMenuItemGroup=!0,Vn.defaultProps={disabled:!0};var Kn=Vn,Di=function(De){var Pe=De.className,ge=De.rootPrefixCls,ne=De.style;return D.createElement("li",{className:"".concat(Pe," ").concat(ge,"-item-divider"),style:ne})};Di.defaultProps={disabled:!0,className:"",style:{}};var ln=Di,kt=cn,Yn=q("eDIo");function mn(me,De){var Pe=me.prefixCls,ge=me.editable,ne=me.locale,he=me.style;return!ge||ge.showAdd===!1?null:D.createElement("button",{ref:De,type:"button",className:"".concat(Pe,"-nav-add"),style:he,"aria-label":(ne==null?void 0:ne.addAriaLabel)||"Add tab",onClick:function(ve){ge.onEdit("add",{event:ve})}},ge.addIcon||"+")}var Sn=D.forwardRef(mn);function Un(me,De){var Pe=me.prefixCls,ge=me.id,ne=me.tabs,he=me.locale,re=me.mobile,ve=me.moreIcon,Ce=ve===void 0?"More":ve,He=me.moreTransitionName,we=me.style,ze=me.className,rt=me.editable,vt=me.tabBarGutter,xt=me.rtl,Ft=me.onTabClick,dn=Object(D.useState)(!1),Dn=Object(Q.a)(dn,2),On=Dn[0],Jn=Dn[1],ni=Object(D.useState)(null),Xn=Object(Q.a)(ni,2),ei=Xn[0],oi=Xn[1],An="".concat(ge,"-more-popup"),Ti="".concat(Pe,"-dropdown"),Tn=ei!==null?"".concat(An,"-").concat(ei):null,St=he==null?void 0:he.dropdownAriaLabel,jt=D.createElement(kt,{onClick:function(Ni){var Ii=Ni.key,Si=Ni.domEvent;Ft(Ii,Si),Jn(!1)},id:An,tabIndex:-1,role:"listbox","aria-activedescendant":Tn,selectedKeys:[ei],"aria-label":St!==void 0?St:"expanded dropdown"},ne.map(function(vi){return D.createElement(En,{key:vi.key,id:"".concat(An,"-").concat(vi.key),role:"option","aria-controls":ge&&"".concat(ge,"-panel-").concat(vi.key),disabled:vi.disabled},vi.tab)}));function Zn(vi){for(var Ni=ne.filter(function(or){return!or.disabled}),Ii=Ni.findIndex(function(or){return or.key===ei})||0,Si=Ni.length,Ci=0;Ci<Si;Ci+=1){Ii=(Ii+vi+Si)%Si;var Mn=Ni[Ii];if(!Mn.disabled){oi(Mn.key);return}}}function pi(vi){var Ni=vi.which;if(!On){[c.a.DOWN,c.a.SPACE,c.a.ENTER].includes(Ni)&&(Jn(!0),vi.preventDefault());return}switch(Ni){case c.a.UP:Zn(-1),vi.preventDefault();break;case c.a.DOWN:Zn(1),vi.preventDefault();break;case c.a.ESC:Jn(!1);break;case c.a.SPACE:case c.a.ENTER:ei!==null&&Ft(ei,vi);break}}Object(D.useEffect)(function(){var vi=document.getElementById(Tn);vi&&vi.scrollIntoView&&vi.scrollIntoView(!1)},[ei]),Object(D.useEffect)(function(){On||oi(null)},[On]);var yn=Object(le.a)({},xt?"marginLeft":"marginRight",vt);ne.length||(yn.visibility="hidden",yn.order=1);var gi=H()(Object(le.a)({},"".concat(Ti,"-rtl"),xt)),Yi=re?null:D.createElement(Yn.a,{prefixCls:Ti,overlay:jt,trigger:["hover"],visible:On,transitionName:He,onVisibleChange:Jn,overlayClassName:gi,mouseEnterDelay:.1,mouseLeaveDelay:.1},D.createElement("button",{type:"button",className:"".concat(Pe,"-nav-more"),style:yn,tabIndex:-1,"aria-hidden":"true","aria-haspopup":"listbox","aria-controls":An,id:"".concat(ge,"-more"),"aria-expanded":On,onKeyDown:pi},Ce));return D.createElement("div",{className:H()("".concat(Pe,"-nav-operations"),ze),style:we,ref:De},Yi,D.createElement(Sn,{prefixCls:Pe,locale:he,editable:rt}))}var Bn=D.forwardRef(Un),Li=Object(D.createContext)(null),kn=.1,Gn=.01,jn=20,xi=Math.pow(.995,jn);function er(){var me=navigator.userAgent||navigator.vendor||window.opera;return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(me)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(me.substr(0,4)))}function Wi(me,De){var Pe=Object(D.useState)(),ge=Object(Q.a)(Pe,2),ne=ge[0],he=ge[1],re=Object(D.useState)(0),ve=Object(Q.a)(re,2),Ce=ve[0],He=ve[1],we=Object(D.useState)(0),ze=Object(Q.a)(we,2),rt=ze[0],vt=ze[1],xt=Object(D.useState)(),Ft=Object(Q.a)(xt,2),dn=Ft[0],Dn=Ft[1],On=Object(D.useRef)();function Jn(St){var jt=St.touches[0],Zn=jt.screenX,pi=jt.screenY;he({x:Zn,y:pi}),window.clearInterval(On.current)}function ni(St){if(!ne)return;St.preventDefault();var jt=St.touches[0],Zn=jt.screenX,pi=jt.screenY;he({x:Zn,y:pi});var yn=Zn-ne.x,gi=pi-ne.y;De(yn,gi);var Yi=Date.now();He(Yi),vt(Yi-Ce),Dn({x:yn,y:gi})}function Xn(){if(!ne)return;if(he(null),Dn(null),dn){var St=dn.x/rt,jt=dn.y/rt,Zn=Math.abs(St),pi=Math.abs(jt);if(Math.max(Zn,pi)<kn)return;var yn=St,gi=jt;On.current=window.setInterval(function(){if(Math.abs(yn)<Gn&&Math.abs(gi)<Gn){window.clearInterval(On.current);return}yn*=xi,gi*=xi,De(yn*jn,gi*jn)},jn)}}var ei=Object(D.useRef)(0),oi=Object(D.useRef)(!1),An=Object(D.useRef)();function Ti(St){var jt=St.deltaX,Zn=St.deltaY,pi=0,yn=Math.abs(jt),gi=Math.abs(Zn);yn===gi?pi=An.current==="x"?jt:Zn:yn>gi?(pi=jt,An.current="x"):(pi=Zn,An.current="y");var Yi=Date.now();Yi-ei.current>100&&(oi.current=!1),(De(-pi,-pi)||oi.current)&&(St.preventDefault(),oi.current=!0),ei.current=Yi}var Tn=Object(D.useRef)(null);Tn.current={onTouchStart:Jn,onTouchMove:ni,onTouchEnd:Xn,onWheel:Ti},D.useEffect(function(){function St(yn){Tn.current.onTouchStart(yn)}function jt(yn){Tn.current.onTouchMove(yn)}function Zn(yn){Tn.current.onTouchEnd(yn)}function pi(yn){Tn.current.onWheel(yn)}return document.addEventListener("touchmove",jt,{passive:!1}),document.addEventListener("touchend",Zn,{passive:!1}),me.current.addEventListener("touchstart",St,{passive:!1}),me.current.addEventListener("wheel",pi),function(){document.removeEventListener("touchmove",jt),document.removeEventListener("touchend",Zn)}},[])}function fr(){var me=Object(D.useRef)(new Map);function De(ge){return me.current.has(ge)||me.current.set(ge,D.createRef()),me.current.get(ge)}function Pe(ge){me.current.delete(ge)}return[De,Pe]}function gr(me,De){var Pe=D.useRef(me),ge=D.useState({}),ne=Object(Q.a)(ge,2),he=ne[1];function re(ve){var Ce=typeof ve=="function"?ve(Pe.current):ve;Ce!==Pe.current&&De(Ce,Pe.current),Pe.current=Ce,he({})}return[Pe.current,re]}var Cr=function(De){var Pe=De.position,ge=De.prefixCls,ne=De.extra;if(!ne)return null;var he,re=ne;return Pe==="right"&&(he=re.right||!re.left&&re||null),Pe==="left"&&(he=re.left||null),he?D.createElement("div",{className:"".concat(ge,"-extra-content")},he):null};function Dr(me,De){var Pe,ge=D.useContext(Li),ne=ge.prefixCls,he=ge.tabs,re=me.className,ve=me.style,Ce=me.id,He=me.animated,we=me.activeKey,ze=me.rtl,rt=me.extra,vt=me.editable,xt=me.locale,Ft=me.tabPosition,dn=me.tabBarGutter,Dn=me.children,On=me.onTabClick,Jn=me.onTabScroll,ni=Object(D.useRef)(),Xn=Object(D.useRef)(),ei=Object(D.useRef)(),oi=Object(D.useRef)(),An=fr(),Ti=Object(Q.a)(An,2),Tn=Ti[0],St=Ti[1],jt=Ft==="top"||Ft==="bottom",Zn=gr(0,function(Fi,mi){jt&&Jn&&Jn({direction:Fi>mi?"left":"right"})}),pi=Object(Q.a)(Zn,2),yn=pi[0],gi=pi[1],Yi=gr(0,function(Fi,mi){!jt&&Jn&&Jn({direction:Fi>mi?"top":"bottom"})}),vi=Object(Q.a)(Yi,2),Ni=vi[0],Ii=vi[1],Si=Object(D.useState)(0),Ci=Object(Q.a)(Si,2),Mn=Ci[0],or=Ci[1],$r=Object(D.useState)(0),Pr=Object(Q.a)($r,2),Er=Pr[0],Qi=Pr[1],Ki=Object(D.useState)(0),Vi=Object(Q.a)(Ki,2),Ji=Vi[0],Nr=Vi[1],da=Object(D.useState)(0),aa=Object(Q.a)(da,2),Gi=aa[0],Qr=aa[1],Jr=Object(D.useState)(null),Xi=Object(Q.a)(Jr,2),Ui=Xi[0],vr=Xi[1],ka=Object(D.useState)(null),no=Object(Q.a)(ka,2),oa=no[0],Ca=no[1],wa=Object(D.useState)(0),Sa=Object(Q.a)(wa,2),Ma=Sa[0],co=Sa[1],Ao=Object(D.useState)(0),za=Object(Q.a)(Ao,2),Oa=za[0],Va=za[1],ya=n(new Map),Aa=Object(Q.a)(ya,2),ho=Aa[0],Ya=Aa[1],Ra=f(he,ho,Mn),Da="".concat(ne,"-nav-operations-hidden"),_a=0,Lr=0;jt?ze?(_a=0,Lr=Math.max(0,Mn-Ui)):(_a=Math.min(0,Ui-Mn),Lr=0):(_a=Math.min(0,oa-Er),Lr=0);function ha(Fi){return Fi<_a?[_a,!1]:Fi>Lr?[Lr,!1]:[Fi,!0]}var fa=Object(D.useRef)(),ba=Object(D.useState)(),pa=Object(Q.a)(ba,2),Xa=pa[0],$a=pa[1];function Qa(){$a(Date.now())}function Pa(){window.clearTimeout(fa.current)}Wi(ni,function(Fi,mi){var ar=!1;function Fr(La,la){La(function(Ua){var ua=ha(Ua+la),yr=Object(Q.a)(ua,2),Ba=yr[0],ja=yr[1];return ar=ja,Ba})}if(jt){if(Ui>=Mn)return ar;Fr(gi,Fi)}else{if(oa>=Er)return ar;Fr(Ii,mi)}return Pa(),Qa(),ar}),Object(D.useEffect)(function(){return Pa(),Xa&&(fa.current=window.setTimeout(function(){$a(0)},100)),Pa},[Xa]);function sa(){var Fi=arguments.length>0&&arguments[0]!==void 0?arguments[0]:we,mi=Ra.get(Fi);if(!mi)return;if(jt){var ar=yn;ze?mi.right<yn?ar=mi.right:mi.right+mi.width>yn+Ui&&(ar=mi.right+mi.width-Ui):mi.left<-yn?ar=-mi.left:mi.left+mi.width>-yn+Ui&&(ar=-(mi.left+mi.width-Ui)),Ii(0),gi(ha(ar)[0])}else{var Fr=Ni;mi.top<-Ni?Fr=-mi.top:mi.top+mi.height>-Ni+oa&&(Fr=-(mi.top+mi.height-oa)),gi(0),Ii(ha(Fr)[0])}}var Ea=C(Ra,{width:Ui,height:oa,left:yn,top:Ni},{width:Ji,height:Gi},{width:Ma,height:Oa},Object(Y.a)(Object(Y.a)({},me),{},{tabs:he})),io=Object(Q.a)(Ea,2),Ro=io[0],Do=io[1],fo=he.map(function(Fi){var mi=Fi.key;return D.createElement(a,{id:Ce,prefixCls:ne,key:mi,rtl:ze,tab:Fi,closable:Fi.closable,editable:vt,active:mi===we,tabPosition:Ft,tabBarGutter:dn,renderWrapper:Dn,removeAriaLabel:xt==null?void 0:xt.removeAriaLabel,ref:Tn(mi),onClick:function(Fr){On(mi,Fr)},onRemove:function(){St(mi)},onFocus:function(){sa(mi),Qa(),ze||(ni.current.scrollLeft=0),ni.current.scrollTop=0}})}),ro=l(function(){var Fi,mi,ar,Fr,La,la,Ua,ua,yr,Ba=((Fi=ni.current)===null||Fi===void 0?void 0:Fi.offsetWidth)||0,ja=((mi=ni.current)===null||mi===void 0?void 0:mi.offsetHeight)||0,Ha=((ar=oi.current)===null||ar===void 0?void 0:ar.offsetWidth)||0,Hr=((Fr=oi.current)===null||Fr===void 0?void 0:Fr.offsetHeight)||0,ki=((La=ei.current)===null||La===void 0?void 0:La.offsetWidth)||0,qn=((la=ei.current)===null||la===void 0?void 0:la.offsetHeight)||0;vr(Ba),Ca(ja),co(Ha),Va(Hr);var an=(((Ua=Xn.current)===null||Ua===void 0?void 0:Ua.offsetWidth)||0)-Ha,xn=(((ua=Xn.current)===null||ua===void 0?void 0:ua.offsetHeight)||0)-Hr;or(an),Qi(xn);var hi=(yr=ei.current)===null||yr===void 0?void 0:yr.className.includes(Da);Nr(an-(hi?0:ki)),Qr(xn-(hi?0:qn)),Ya(function(){var tr=new Map;return he.forEach(function(ma){var ia=ma.key,Or=Tn(ia).current;Or&&tr.set(ia,{width:Or.offsetWidth,height:Or.offsetHeight,left:Or.offsetLeft,top:Or.offsetTop})}),tr})}),po=he.slice(0,Ro),jr=he.slice(Do+1),cr=[].concat(Object(R.a)(po),Object(R.a)(jr)),Sr=Object(D.useState)(),dr=Object(Q.a)(Sr,2),Na=dr[0],mo=dr[1],Zr=Ra.get(we),ao=Object(D.useRef)();function oo(){p.a.cancel(ao.current)}Object(D.useEffect)(function(){var Fi={};return Zr&&(jt?(ze?Fi.right=Zr.right:Fi.left=Zr.left,Fi.width=Zr.width):(Fi.top=Zr.top,Fi.height=Zr.height)),oo(),ao.current=p()(function(){mo(Fi)}),oo},[Zr,jt,ze]),Object(D.useEffect)(function(){sa()},[we,Zr,Ra,jt]),Object(D.useEffect)(function(){ro()},[ze,dn,we,he.map(function(Fi){return Fi.key}).join("_")]);var so=!!cr.length,xa="".concat(ne,"-nav-wrap"),Ja,Fa,go,Za;return jt?ze?(Fa=yn>0,Ja=yn+Ui<Mn):(Ja=yn<0,Fa=-yn+Ui<Mn):(go=Ni<0,Za=-Ni+oa<Er),D.createElement("div",{ref:De,role:"tablist",className:H()("".concat(ne,"-nav"),re),style:ve,onKeyDown:function(){Qa()}},D.createElement(Cr,{position:"left",extra:rt,prefixCls:ne}),D.createElement(d.a,{onResize:ro},D.createElement("div",{className:H()(xa,(Pe={},Object(le.a)(Pe,"".concat(xa,"-ping-left"),Ja),Object(le.a)(Pe,"".concat(xa,"-ping-right"),Fa),Object(le.a)(Pe,"".concat(xa,"-ping-top"),go),Object(le.a)(Pe,"".concat(xa,"-ping-bottom"),Za),Pe)),ref:ni},D.createElement(d.a,{onResize:ro},D.createElement("div",{ref:Xn,className:"".concat(ne,"-nav-list"),style:{transform:"translate(".concat(yn,"px, ").concat(Ni,"px)"),transition:Xa?"none":void 0}},fo,D.createElement(Sn,{ref:oi,prefixCls:ne,locale:xt,editable:vt,style:{visibility:so?"hidden":null}}),D.createElement("div",{className:H()("".concat(ne,"-ink-bar"),Object(le.a)({},"".concat(ne,"-ink-bar-animated"),He.inkBar)),style:Na}))))),D.createElement(Bn,Object.assign({},me,{ref:ei,prefixCls:ne,tabs:cr,className:!so&&Da})),D.createElement(Cr,{position:"right",extra:rt,prefixCls:ne}))}var ur=D.forwardRef(Dr);function ca(me){var De=me.id,Pe=me.activeKey,ge=me.animated,ne=me.tabPosition,he=me.rtl,re=me.destroyInactiveTabPane,ve=D.useContext(Li),Ce=ve.prefixCls,He=ve.tabs,we=ge.tabPane,ze=He.findIndex(function(rt){return rt.key===Pe});return D.createElement("div",{className:H()("".concat(Ce,"-content-holder"))},D.createElement("div",{className:H()("".concat(Ce,"-content"),"".concat(Ce,"-content-").concat(ne),Object(le.a)({},"".concat(Ce,"-content-animated"),we)),style:ze&&we?Object(le.a)({},he?"marginRight":"marginLeft","-".concat(ze,"00%")):null},He.map(function(rt){return D.cloneElement(rt.node,{key:rt.key,prefixCls:Ce,tabKey:rt.key,id:De,animated:we,active:rt.key===Pe,destroyInactiveTabPane:re})})))}function wr(me){var De=me.prefixCls,Pe=me.forceRender,ge=me.className,ne=me.style,he=me.id,re=me.active,ve=me.animated,Ce=me.destroyInactiveTabPane,He=me.tabKey,we=me.children,ze=D.useState(Pe),rt=Object(Q.a)(ze,2),vt=rt[0],xt=rt[1];D.useEffect(function(){re?xt(!0):Ce&&xt(!1)},[re,Ce]);var Ft={};return re||(ve?(Ft.visibility="hidden",Ft.height=0,Ft.overflowY="hidden"):Ft.display="none"),D.createElement("div",{id:he&&"".concat(he,"-panel-").concat(He),role:"tabpanel",tabIndex:re?0:-1,"aria-labelledby":he&&"".concat(he,"-tab-").concat(He),"aria-hidden":!re,style:Object(Y.a)(Object(Y.a)({},Ft),ne),className:H()("".concat(De,"-tabpane"),re&&"".concat(De,"-tabpane-active"),ge)},(re||vt||Pe)&&we)}var Kr=0;function va(me){return Object(I.a)(me).map(function(De){if(D.isValidElement(De)){var Pe=De.key!==void 0?String(De.key):void 0;return Object(Y.a)(Object(Y.a)({key:Pe},De.props),{},{node:De})}return null}).filter(function(De){return De})}function Gr(me,De){var Pe,ge=me.id,ne=me.prefixCls,he=ne===void 0?"rc-tabs":ne,re=me.className,ve=me.children,Ce=me.direction,He=me.activeKey,we=me.defaultActiveKey,ze=me.editable,rt=me.animated,vt=me.tabPosition,xt=vt===void 0?"top":vt,Ft=me.tabBarGutter,dn=me.tabBarStyle,Dn=me.tabBarExtraContent,On=me.locale,Jn=me.moreIcon,ni=me.moreTransitionName,Xn=me.destroyInactiveTabPane,ei=me.renderTabBar,oi=me.onChange,An=me.onTabClick,Ti=me.onTabScroll,Tn=Object(P.a)(me,["id","prefixCls","className","children","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","moreIcon","moreTransitionName","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll"]),St=va(ve),jt=Ce==="rtl",Zn;rt===!1?Zn={inkBar:!1,tabPane:!1}:Zn=Object(Y.a)({inkBar:!0,tabPane:!1},rt!==!0?rt:null);var pi=Object(D.useState)(!1),yn=Object(Q.a)(pi,2),gi=yn[0],Yi=yn[1];Object(D.useEffect)(function(){Yi(er())},[]);var vi=Object(F.a)(function(){var Gi;return(Gi=St[0])===null||Gi===void 0?void 0:Gi.key},{value:He,defaultValue:we}),Ni=Object(Q.a)(vi,2),Ii=Ni[0],Si=Ni[1],Ci=Object(D.useState)(function(){return St.findIndex(function(Gi){return Gi.key===Ii})}),Mn=Object(Q.a)(Ci,2),or=Mn[0],$r=Mn[1];Object(D.useEffect)(function(){var Gi=St.findIndex(function(Jr){return Jr.key===Ii});if(Gi===-1){var Qr;Gi=Math.max(0,Math.min(or,St.length-1)),Si((Qr=St[Gi])===null||Qr===void 0?void 0:Qr.key)}$r(Gi)},[St.map(function(Gi){return Gi.key}).join("_"),Ii,or]);var Pr=Object(F.a)(null,{value:ge}),Er=Object(Q.a)(Pr,2),Qi=Er[0],Ki=Er[1],Vi=xt;gi&&!["left","right"].includes(xt)&&(Vi="top"),Object(D.useEffect)(function(){ge||(Ki("rc-tabs-".concat(Kr)),Kr+=1)},[]);function Ji(Gi,Qr){An==null||An(Gi,Qr),Si(Gi),oi==null||oi(Gi)}var Nr={id:Qi,activeKey:Ii,animated:Zn,tabPosition:Vi,rtl:jt,mobile:gi},da,aa=Object(Y.a)(Object(Y.a)({},Nr),{},{editable:ze,locale:On,moreIcon:Jn,moreTransitionName:ni,tabBarGutter:Ft,onTabClick:Ji,onTabScroll:Ti,extra:Dn,style:dn,panes:ve});return ei?da=ei(aa,ur):da=D.createElement(ur,Object.assign({},aa)),D.createElement(Li.Provider,{value:{tabs:St,prefixCls:he}},D.createElement("div",Object.assign({ref:De,id:ge,className:H()(he,"".concat(he,"-").concat(Vi),(Pe={},Object(le.a)(Pe,"".concat(he,"-mobile"),gi),Object(le.a)(Pe,"".concat(he,"-editable"),ze),Object(le.a)(Pe,"".concat(he,"-rtl"),jt),Pe),re)},Tn),da,D.createElement(ca,Object.assign({destroyInactiveTabPane:Xn},Nr,{animated:Zn}))))}var br=D.forwardRef(Gr);br.TabPane=wr;var kr=br,Mr=_t.b=kr},kSUc:function(Mt,_t,q){},lZu9:function(Mt,_t,q){(function(le){le(q("VrN/"),q("1eCo"),q("8EBN"))})(function(le){"use strict";le.defineMode("markdown",function(Q,P){var Y=le.getMode(Q,"text/html"),D=Y.name=="null";function U(k){if(le.findModeByName){var b=le.findModeByName(k);b&&(k=b.mime||b.mimes[0])}var G=le.getMode(Q,k);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 H={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 I in H)H.hasOwnProperty(I)&&P.tokenTypeOverrides[I]&&(H[I]=P.tokenTypeOverrides[I]);var F=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,p=P.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,d=/^ {0,3}(?:\={1,}|-{2,})\s*$/,l=/^[^#!\[\]*_\\<>` "'(~:]+/,n=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,c=/^\s*\[[^\]]+?\]:.*$/,s=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,a=" ";function o(k,b,G){return b.f=b.inline=G,G(k,b)}function f(k,b,G){return b.f=b.block=G,G(k,b)}function L(k){return!k||!/\S/.test(k.string)}function C(k){if(k.linkTitle=!1,k.linkHref=!1,k.linkText=!1,k.em=!1,k.strong=!1,k.strikethrough=!1,k.quote=0,k.indentedCode=!1,k.f==A){var b=D;if(!b){var G=le.innerMode(Y,k.htmlState);b=G.mode.name=="xml"&&G.state.tagStart===null&&!G.state.context&&G.state.tokenize.isInText}b&&(k.f=y,k.block=x,k.htmlState=null)}return k.trailingSpace=0,k.trailingSpaceNewLine=!1,k.prevLine=k.thisLine,k.thisLine={stream:null},null}function x(k,b){var G=k.column()===b.indentation,J=L(b.prevLine.stream),oe=b.indentedCode,fe=b.prevLine.hr,Ne=b.list!==!1,_e=(b.listStack[b.listStack.length-1]||0)+3;b.indentedCode=!1;var Fe=b.indentation;if(b.indentationDiff===null&&(b.indentationDiff=b.indentation,Ne)){for(b.list=null;Fe<b.listStack[b.listStack.length-1];)b.listStack.pop(),b.listStack.length?b.indentation=b.listStack[b.listStack.length-1]:b.list=!1;b.list!==!1&&(b.indentationDiff=Fe-b.listStack[b.listStack.length-1])}var We=!J&&!fe&&!b.prevLine.header&&(!Ne||!oe)&&!b.prevLine.fencedCodeEnd,Ue=(b.list===!1||fe||J)&&b.indentation<=_e&&k.match(F),xe=null;if(b.indentationDiff>=4&&(oe||b.prevLine.fencedCodeEnd||b.prevLine.header||J))return k.skipToEnd(),b.indentedCode=!0,H.code;if(k.eatSpace())return null;if(G&&b.indentation<=_e&&(xe=k.match(p))&&xe[1].length<=6)return b.quote=0,b.header=xe[1].length,b.thisLine.header=!0,P.highlightFormatting&&(b.formatting="header"),b.f=b.inline,_(b);if(b.indentation<=_e&&k.eat(">"))return b.quote=G?1:b.quote+1,P.highlightFormatting&&(b.formatting="quote"),k.eatSpace(),_(b);if(!Ue&&!b.setext&&G&&b.indentation<=_e&&(xe=k.match(R))){var ue=xe[1]?"ol":"ul";return b.indentation=Fe+k.current().length,b.list=!0,b.quote=0,b.listStack.push(b.indentation),b.em=!1,b.strong=!1,b.code=!1,b.strikethrough=!1,P.taskLists&&k.match(g,!1)&&(b.taskList=!0),b.f=b.inline,P.highlightFormatting&&(b.formatting=["list","list-"+ue]),_(b)}else{if(G&&b.indentation<=_e&&(xe=k.match(n,!0)))return b.quote=0,b.fencedEndRE=new RegExp(xe[1]+"+ *$"),b.localMode=P.fencedCodeBlockHighlighting&&U(xe[2]||P.fencedCodeBlockDefaultMode),b.localMode&&(b.localState=le.startState(b.localMode)),b.f=b.block=w,P.highlightFormatting&&(b.formatting="code-block"),b.code=-1,_(b);if(b.setext||(!We||!Ne)&&!b.quote&&b.list===!1&&!b.code&&!Ue&&!c.test(k.string)&&(xe=k.lookAhead(1))&&(xe=xe.match(d)))return b.setext?(b.header=b.setext,b.setext=0,k.skipToEnd(),P.highlightFormatting&&(b.formatting="header")):(b.header=xe[0].charAt(0)=="="?1:2,b.setext=b.header),b.thisLine.header=!0,b.f=b.inline,_(b);if(Ue)return k.skipToEnd(),b.hr=!0,b.thisLine.hr=!0,H.hr;if(k.peek()==="[")return o(k,b,j)}return o(k,b,b.inline)}function A(k,b){var G=Y.token(k,b.htmlState);if(!D){var J=le.innerMode(Y,b.htmlState);(J.mode.name=="xml"&&J.state.tagStart===null&&!J.state.context&&J.state.tokenize.isInText||b.md_inside&&k.current().indexOf(">")>-1)&&(b.f=y,b.block=x,b.htmlState=null)}return G}function w(k,b){var G=b.listStack[b.listStack.length-1]||0,J=b.indentation<G,oe=G+3;if(b.fencedEndRE&&b.indentation<=oe&&(J||k.match(b.fencedEndRE))){P.highlightFormatting&&(b.formatting="code-block");var fe;return J||(fe=_(b)),b.localMode=b.localState=null,b.block=x,b.f=y,b.fencedEndRE=null,b.code=0,b.thisLine.fencedCodeEnd=!0,J?f(k,b,b.block):fe}else return b.localMode?b.localMode.token(k,b.localState):(k.skipToEnd(),H.code)}function _(k){var b=[];if(k.formatting){b.push(H.formatting),typeof k.formatting=="string"&&(k.formatting=[k.formatting]);for(var G=0;G<k.formatting.length;G++)b.push(H.formatting+"-"+k.formatting[G]),k.formatting[G]==="header"&&b.push(H.formatting+"-"+k.formatting[G]+"-"+k.header),k.formatting[G]==="quote"&&(!P.maxBlockquoteDepth||P.maxBlockquoteDepth>=k.quote?b.push(H.formatting+"-"+k.formatting[G]+"-"+k.quote):b.push("error"))}if(k.taskOpen)return b.push("meta"),b.length?b.join(" "):null;if(k.taskClosed)return b.push("property"),b.length?b.join(" "):null;if(k.linkHref?b.push(H.linkHref,"url"):(k.strong&&b.push(H.strong),k.em&&b.push(H.em),k.strikethrough&&b.push(H.strikethrough),k.emoji&&b.push(H.emoji),k.linkText&&b.push(H.linkText),k.code&&b.push(H.code),k.image&&b.push(H.image),k.imageAltText&&b.push(H.imageAltText,"link"),k.imageMarker&&b.push(H.imageMarker)),k.header&&b.push(H.header,H.header+"-"+k.header),k.quote&&(b.push(H.quote),!P.maxBlockquoteDepth||P.maxBlockquoteDepth>=k.quote?b.push(H.quote+"-"+k.quote):b.push(H.quote+"-"+P.maxBlockquoteDepth)),k.list!==!1){var J=(k.listStack.length-1)%3;J?J===1?b.push(H.list2):b.push(H.list3):b.push(H.list1)}return k.trailingSpaceNewLine?b.push("trailing-space-new-line"):k.trailingSpace&&b.push("trailing-space-"+(k.trailingSpace%2?"a":"b")),b.length?b.join(" "):null}function S(k,b){return k.match(l,!0)?_(b):void 0}function y(k,b){var G=b.text(k,b);if(typeof G!="undefined")return G;if(b.list)return b.list=null,_(b);if(b.taskList){var J=k.match(g,!0)[1]===" ";return J?b.taskOpen=!0:b.taskClosed=!0,P.highlightFormatting&&(b.formatting="task"),b.taskList=!1,_(b)}if(b.taskOpen=!1,b.taskClosed=!1,b.header&&k.match(/^#+$/,!0))return P.highlightFormatting&&(b.formatting="header"),_(b);var oe=k.next();if(b.linkTitle){b.linkTitle=!1;var fe=oe;oe==="("&&(fe=")"),fe=(fe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ne="^\\s*(?:[^"+fe+"\\\\]+|\\\\\\\\|\\\\.)"+fe;if(k.match(new RegExp(Ne),!0))return H.linkHref}if(oe==="`"){var _e=b.formatting;P.highlightFormatting&&(b.formatting="code"),k.eatWhile("`");var Fe=k.current().length;if(b.code==0&&(!b.quote||Fe==1))return b.code=Fe,_(b);if(Fe==b.code){var We=_(b);return b.code=0,We}else return b.formatting=_e,_(b)}else if(b.code)return _(b);if(oe==="\\"&&(k.next(),P.highlightFormatting)){var Ue=_(b),xe=H.formatting+"-escape";return Ue?Ue+" "+xe:xe}if(oe==="!"&&k.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return b.imageMarker=!0,b.image=!0,P.highlightFormatting&&(b.formatting="image"),_(b);if(oe==="["&&b.imageMarker&&k.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return b.imageMarker=!1,b.imageAltText=!0,P.highlightFormatting&&(b.formatting="image"),_(b);if(oe==="]"&&b.imageAltText){P.highlightFormatting&&(b.formatting="image");var Ue=_(b);return b.imageAltText=!1,b.image=!1,b.inline=b.f=E,Ue}if(oe==="["&&!b.image)return b.linkText&&k.match(/^.*?\]/)||(b.linkText=!0,P.highlightFormatting&&(b.formatting="link")),_(b);if(oe==="]"&&b.linkText){P.highlightFormatting&&(b.formatting="link");var Ue=_(b);return b.linkText=!1,b.inline=b.f=k.match(/\(.*?\)| ?\[.*?\]/,!1)?E:y,Ue}if(oe==="<"&&k.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){b.f=b.inline=h,P.highlightFormatting&&(b.formatting="link");var Ue=_(b);return Ue?Ue+=" ":Ue="",Ue+H.linkInline}if(oe==="<"&&k.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){b.f=b.inline=h,P.highlightFormatting&&(b.formatting="link");var Ue=_(b);return Ue?Ue+=" ":Ue="",Ue+H.linkEmail}if(P.xml&&oe==="<"&&k.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=k.string.indexOf(">",k.pos);if(ue!=-1){var ae=k.string.substring(k.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(ae)&&(b.md_inside=!0)}return k.backUp(1),b.htmlState=le.startState(Y),f(k,b,A)}if(P.xml&&oe==="<"&&k.match(/^\/\w*?>/))return b.md_inside=!1,"tag";if(oe==="*"||oe==="_"){for(var Ee=1,de=k.pos==1?" ":k.string.charAt(k.pos-2);Ee<3&&k.eat(oe);)Ee++;var Ke=k.peek()||" ",Je=!/\s/.test(Ke)&&(!s.test(Ke)||/\s/.test(de)||s.test(de)),je=!/\s/.test(de)&&(!s.test(de)||/\s/.test(Ke)||s.test(Ke)),Qe=null,ot=null;if(Ee%2&&(!b.em&&Je&&(oe==="*"||!je||s.test(de))?Qe=!0:b.em==oe&&je&&(oe==="*"||!Je||s.test(Ke))&&(Qe=!1)),Ee>1&&(!b.strong&&Je&&(oe==="*"||!je||s.test(de))?ot=!0:b.strong==oe&&je&&(oe==="*"||!Je||s.test(Ke))&&(ot=!1)),ot!=null||Qe!=null){P.highlightFormatting&&(b.formatting=Qe==null?"strong":ot==null?"em":"strong em"),Qe===!0&&(b.em=oe),ot===!0&&(b.strong=oe);var We=_(b);return Qe===!1&&(b.em=!1),ot===!1&&(b.strong=!1),We}}else if(oe===" "&&(k.eat("*")||k.eat("_"))){if(k.peek()===" ")return _(b);k.backUp(1)}if(P.strikethrough){if(oe==="~"&&k.eatWhile(oe)){if(b.strikethrough){P.highlightFormatting&&(b.formatting="strikethrough");var We=_(b);return b.strikethrough=!1,We}else if(k.match(/^[^\s]/,!1))return b.strikethrough=!0,P.highlightFormatting&&(b.formatting="strikethrough"),_(b)}else if(oe===" "&&k.match(/^~~/,!0)){if(k.peek()===" ")return _(b);k.backUp(2)}}if(P.emoji&&oe===":"&&k.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){b.emoji=!0,P.highlightFormatting&&(b.formatting="emoji");var st=_(b);return b.emoji=!1,st}return oe===" "&&(k.match(/^ +$/,!1)?b.trailingSpace++:b.trailingSpace&&(b.trailingSpaceNewLine=!0)),_(b)}function h(k,b){var G=k.next();if(G===">"){b.f=b.inline=y,P.highlightFormatting&&(b.formatting="link");var J=_(b);return J?J+=" ":J="",J+H.linkInline}return k.match(/^[^>]+/,!0),H.linkInline}function E(k,b){if(k.eatSpace())return null;var G=k.next();return G==="("||G==="["?(b.f=b.inline=T(G==="("?")":"]"),P.highlightFormatting&&(b.formatting="link-string"),b.linkHref=!0,_(b)):"error"}var m={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function T(k){return function(b,G){var J=b.next();if(J===k){G.f=G.inline=y,P.highlightFormatting&&(G.formatting="link-string");var oe=_(G);return G.linkHref=!1,oe}return b.match(m[k]),G.linkHref=!0,_(G)}}function j(k,b){return k.match(/^([^\]\\]|\\.)*\]:/,!1)?(b.f=N,k.next(),P.highlightFormatting&&(b.formatting="link"),b.linkText=!0,_(b)):o(k,b,y)}function N(k,b){if(k.match(/^\]:/,!0)){b.f=b.inline=K,P.highlightFormatting&&(b.formatting="link");var G=_(b);return b.linkText=!1,G}return k.match(/^([^\]\\]|\\.)+/,!0),H.linkText}function K(k,b){return k.eatSpace()?null:(k.match(/^[^\s]+/,!0),k.peek()===void 0?b.linkTitle=!0:k.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),b.f=b.inline=y,H.linkHref+" url")}var W={startState:function(){return{f:x,prevLine:{stream:null},thisLine:{stream:null},block:x,htmlState:null,indentation:0,inline:y,text:S,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(k){return{f:k.f,prevLine:k.prevLine,thisLine:k.thisLine,block:k.block,htmlState:k.htmlState&&le.copyState(Y,k.htmlState),indentation:k.indentation,localMode:k.localMode,localState:k.localMode?le.copyState(k.localMode,k.localState):null,inline:k.inline,text:k.text,formatting:!1,linkText:k.linkText,linkTitle:k.linkTitle,linkHref:k.linkHref,code:k.code,em:k.em,strong:k.strong,strikethrough:k.strikethrough,emoji:k.emoji,header:k.header,setext:k.setext,hr:k.hr,taskList:k.taskList,list:k.list,listStack:k.listStack.slice(0),quote:k.quote,indentedCode:k.indentedCode,trailingSpace:k.trailingSpace,trailingSpaceNewLine:k.trailingSpaceNewLine,md_inside:k.md_inside,fencedEndRE:k.fencedEndRE}},token:function(k,b){if(b.formatting=!1,k!=b.thisLine.stream){if(b.header=0,b.hr=!1,k.match(/^\s*$/,!0))return C(b),null;if(b.prevLine=b.thisLine,b.thisLine={stream:k},b.taskList=!1,b.trailingSpace=0,b.trailingSpaceNewLine=!1,!b.localState&&(b.f=b.block,b.f!=A)){var G=k.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(b.indentation=G,b.indentationDiff=null,G>0)return null}}return b.f(k,b)},innerMode:function(k){return k.block==A?{state:k.htmlState,mode:Y}:k.localState?{state:k.localState,mode:k.localMode}:{state:k,mode:W}},indent:function(k,b,G){return k.block==A&&Y.indent?Y.indent(k.htmlState,b,G):k.localState&&k.localMode.indent?k.localMode.indent(k.localState,b,G):le.Pass},blankLine:C,getType:_,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),le.defineMIME("text/markdown","markdown"),le.defineMIME("text/x-markdown","markdown")})},nl6Q:function(Mt,_t,q){Mt.exports={flexRow:"flexRow___3aYjA",flexJustifyCenter:"flexJustifyCenter___16jJH",flexAlignEnd:"flexAlignEnd___1ihKP",flexAlignCenter:"flexAlignCenter___LDh8n",flexColumn:"flexColumn___31422",formWrap:"formWrap___2K9bP",titleWrap:"titleWrap___1-LH2",fieldWrap:"fieldWrap___38RNx",button:"button___1HFUb",buttonFixed:"buttonFixed___SoJUC",buttonWrap:"buttonWrap___kSCl4",width180:"width180___3-lQ-",width100:"width100___3ukD5",width280:"width280___1kvO2",difficultyHint:"difficultyHint___2lOI0",color888:"color888___tF489",color0152d9:"color0152d9___16HSj",serviceSettingWrap:"serviceSettingWrap___3k585",serviceSettingName:"serviceSettingName___1hHp6",serviceSetLeft:"serviceSetLeft___3maEC",serviceSetInput:"serviceSetInput___3WpKi",serviceSetMemoryInput:"serviceSetMemoryInput___b1j7g",serviceSetTip:"serviceSetTip___1wzVT",installPackage:"installPackage___2jWIH",popover:"popover___tYl2l"}},ogmK:function(Mt,_t,q){"use strict";q.d(_t,"a",function(){return Fn});var le=q("1OyB"),Q=q("vuIU"),P=q("Ji7U"),Y=q("LK+K"),D=q("rePB"),U=q("VTBJ"),H=q("ODXe"),I=q("q1tI"),F=q("TSYQ"),R=q.n(F),g=q("Kwbf"),p=q("6cGi"),d=q("U8pU"),l=q("4IlW"),n=I.createContext({}),c=n,s={visibility:"hidden"};function a($){var pe=$.prefixCls,Oe=$.prevIcon,Re=Oe===void 0?"\u2039":Oe,Ge=$.nextIcon,Me=Ge===void 0?"\u203A":Ge,$e=$.superPrevIcon,Ye=$e===void 0?"\xAB":$e,ut=$.superNextIcon,Ze=ut===void 0?"\xBB":ut,dt=$.onSuperPrev,lt=$.onSuperNext,nt=$.onPrev,Et=$.onNext,pt=$.children,Lt=I.useContext(c),bt=Lt.hideNextBtn,Nt=Lt.hidePrevBtn;return I.createElement("div",{className:pe},dt&&I.createElement("button",{type:"button",onClick:dt,tabIndex:-1,className:"".concat(pe,"-super-prev-btn"),style:Nt?s:{}},Ye),nt&&I.createElement("button",{type:"button",onClick:nt,tabIndex:-1,className:"".concat(pe,"-prev-btn"),style:Nt?s:{}},Re),I.createElement("div",{className:"".concat(pe,"-view")},pt),Et&&I.createElement("button",{type:"button",onClick:Et,tabIndex:-1,className:"".concat(pe,"-next-btn"),style:bt?s:{}},Me),lt&&I.createElement("button",{type:"button",onClick:lt,tabIndex:-1,className:"".concat(pe,"-super-next-btn"),style:bt?s:{}},Ze))}var o=a;function f($){var pe=I.useContext(c),Oe=pe.hideHeader;if(Oe)return null;var Re=$.prefixCls,Ge=$.generateConfig,Me=$.locale,$e=$.value,Ye=$.format,ut="".concat(Re,"-header");return I.createElement(o,{prefixCls:ut},$e?Ge.locale.format(Me.locale,$e,Ye):"\xA0")}var L=f,C=q("YrtM"),x=q("KQm4"),A=new Map;function w($,pe,Oe){if(A.get($)&&cancelAnimationFrame(A.get($)),Oe<=0){A.set($,requestAnimationFrame(function(){$.scrollTop=pe}));return}var Re=pe-$.scrollTop,Ge=Re/Oe*10;A.set($,requestAnimationFrame(function(){$.scrollTop+=Ge,$.scrollTop!==pe&&w($,pe,Oe-10)}))}function _($,pe){var Oe=pe.onLeftRight,Re=pe.onCtrlLeftRight,Ge=pe.onUpDown,Me=pe.onPageUpDown,$e=pe.onEnter,Ye=$.which,ut=$.ctrlKey,Ze=$.metaKey;switch(Ye){case l.a.LEFT:if(ut||Ze){if(Re)return Re(-1),!0}else if(Oe)return Oe(-1),!0;break;case l.a.RIGHT:if(ut||Ze){if(Re)return Re(1),!0}else if(Oe)return Oe(1),!0;break;case l.a.UP:if(Ge)return Ge(-1),!0;break;case l.a.DOWN:if(Ge)return Ge(1),!0;break;case l.a.PAGE_UP:if(Me)return Me(-1),!0;break;case l.a.PAGE_DOWN:if(Me)return Me(1),!0;break;case l.a.ENTER:if($e)return $e(),!0;break}return!1}function S($,pe,Oe,Re){var Ge=$;if(!Ge)switch(pe){case"time":Ge=Re?"hh:mm:ss a":"HH:mm:ss";break;case"week":Ge="gggg-wo";break;case"month":Ge="YYYY-MM";break;case"quarter":Ge="YYYY-[Q]Q";break;case"year":Ge="YYYY";break;default:Ge=Oe?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD"}return Ge}function y($,pe){var Oe=$==="time"?8:10;return Math.max(Oe,pe.length)+2}var h=null,E=new Set;function m($){return!h&&typeof window!="undefined"&&window.addEventListener&&(h=function(Oe){Object(x.a)(E).forEach(function(Re){Re(Oe)})},window.addEventListener("mousedown",h)),E.add($),function(){E.delete($),E.size===0&&(window.removeEventListener("mousedown",h),h=null)}}var T=function(pe){return pe==="month"||pe==="date"?"year":pe},j=function(pe){return pe==="date"?"month":pe},N=function(pe){return pe==="month"||pe==="date"?"quarter":pe},K=function(pe){return pe==="date"?"week":pe},W={year:T,month:j,quarter:N,week:K,time:null,date:null};function k($,pe){return $.some(function(Oe){return Oe&&Oe.contains(pe)})}function b($){var pe=$.prefixCls,Oe=$.units,Re=$.onSelect,Ge=$.value,Me=$.active,$e=$.hideDisabledOptions,Ye="".concat(pe,"-cell"),ut=I.useContext(c),Ze=ut.open,dt=I.useRef(null),lt=I.useRef(new Map);return I.useLayoutEffect(function(){var nt=lt.current.get(Ge);nt&&Ze!==!1&&w(dt.current,nt.offsetTop,120)},[Ge]),I.useLayoutEffect(function(){if(Ze){var nt=lt.current.get(Ge);nt&&w(dt.current,nt.offsetTop,0)}},[Ze]),I.createElement("ul",{className:R()("".concat(pe,"-column"),Object(D.a)({},"".concat(pe,"-column-active"),Me)),ref:dt,style:{position:"relative"}},Oe.map(function(nt){var Et;return $e&&nt.disabled?null:I.createElement("li",{key:nt.value,ref:function(Lt){lt.current.set(nt.value,Lt)},className:R()(Ye,(Et={},Object(D.a)(Et,"".concat(Ye,"-disabled"),nt.disabled),Object(D.a)(Et,"".concat(Ye,"-selected"),Ge===nt.value),Et)),onClick:function(){if(nt.disabled)return;Re(nt.value)}},I.createElement("div",{className:"".concat(Ye,"-inner")},nt.label))}))}var G=b;function J($,pe){for(var Oe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"0",Re=String($);Re.length<pe;)Re="".concat(Oe).concat($);return Re}var oe=function(){for(var pe=arguments.length,Oe=new Array(pe),Re=0;Re<pe;Re++)Oe[Re]=arguments[Re];return Oe};function fe($){return $==null?[]:Array.isArray($)?$:[$]}function Ne($){var pe={};return Object.keys($).forEach(function(Oe){(Oe.substr(0,5)==="data-"||Oe.substr(0,5)==="aria-"||Oe==="role"||Oe==="name")&&Oe.substr(0,7)!=="data-__"&&(pe[Oe]=$[Oe])}),pe}function _e($,pe){return $?$[pe]:null}function Fe($,pe,Oe){var Re=[_e($,0),_e($,1)];return Re[Oe]=typeof pe=="function"?pe(Re[Oe]):pe,!Re[0]&&!Re[1]?null:Re}function We($,pe,Oe,Re,Ge){var Me=$.setHour(pe,Oe);return Me=$.setMinute(Me,Re),Me=$.setSecond(Me,Ge),Me}function Ue($,pe,Oe,Re,Ge,Me){var $e=Math.floor($/Re)*Re;if($e<$)return[$e,60-Ge,60-Me];var Ye=Math.floor(pe/Ge)*Ge;if(Ye<pe)return[$e,Ye,60-Me];var ut=Math.floor(Oe/Me)*Me;return[$e,Ye,ut]}function xe($,pe){if($.length!==pe.length)return!0;for(var Oe=0;Oe<$.length;Oe+=1)if($[Oe].disabled!==pe[Oe].disabled)return!0;return!1}function ue($,pe,Oe,Re){for(var Ge=[],Me=$;Me<=pe;Me+=Oe)Ge.push({label:J(Me,2),value:Me,disabled:(Re||[]).includes(Me)});return Ge}function ae($){var pe=$.generateConfig,Oe=$.prefixCls,Re=$.operationRef,Ge=$.activeColumnIndex,Me=$.value,$e=$.showHour,Ye=$.showMinute,ut=$.showSecond,Ze=$.use12Hours,dt=$.hourStep,lt=dt===void 0?1:dt,nt=$.minuteStep,Et=nt===void 0?1:nt,pt=$.secondStep,Lt=pt===void 0?1:pt,bt=$.disabledHours,Nt=$.disabledMinutes,qt=$.disabledSeconds,rn=$.hideDisabledOptions,ti=$.onSelect,pn=[],bn="".concat(Oe,"-content"),In="".concat(Oe,"-time-panel"),At,cn=Me?pe.getHour(Me):-1,Jt=Me?pe.getMinute(Me):-1,wn=Me?pe.getSecond(Me):-1,En=function(Gn,jn,xi,er){var Wi=Me||pe.getNow(),fr=Math.max(0,jn),gr=Math.max(0,xi),Cr=Math.max(0,er);return Wi=We(pe,Wi,!Ze||!Gn?fr:fr+12,gr,Cr),Wi},Vn=ue(0,23,lt,bt&&bt()),Kn=Object(C.a)(function(){return Vn},Vn,xe);Ze&&(At=cn>=12,cn%=12);var Di=I.useMemo(function(){if(!Ze)return[!1,!1];var kn=[!0,!0];return Kn.forEach(function(Gn){var jn=Gn.disabled,xi=Gn.value;if(jn)return;xi>=12?kn[1]=!1:kn[0]=!1}),kn},[Ze,Kn]),ln=Object(H.a)(Di,2),kt=ln[0],Yn=ln[1],mn=I.useMemo(function(){return Ze?Kn.filter(At?function(kn){return kn.value>=12}:function(kn){return kn.value<12}).map(function(kn){var Gn=kn.value%12,jn=Gn===0?"12":J(Gn,2);return Object(U.a)(Object(U.a)({},kn),{},{label:jn,value:Gn})}):Kn},[Ze,Kn]),Sn=ue(0,59,Et,Nt&&Nt(cn)),Un=ue(0,59,Lt,qt&&qt(cn,Jt));Re.current={onUpDown:function(Gn){var jn=pn[Ge];if(jn)for(var xi=jn.units.findIndex(function(gr){return gr.value===jn.value}),er=jn.units.length,Wi=1;Wi<er;Wi+=1){var fr=jn.units[(xi+Gn*Wi+er)%er];if(fr.disabled!==!0){jn.onSelect(fr.value);break}}}};function Bn(kn,Gn,jn,xi,er){kn!==!1&&pn.push({node:I.cloneElement(Gn,{prefixCls:In,value:jn,active:Ge===pn.length,onSelect:er,units:xi,hideDisabledOptions:rn}),onSelect:er,value:jn,units:xi})}Bn($e,I.createElement(G,{key:"hour"}),cn,mn,function(kn){ti(En(At,kn,Jt,wn),"mouse")}),Bn(Ye,I.createElement(G,{key:"minute"}),Jt,Sn,function(kn){ti(En(At,cn,kn,wn),"mouse")}),Bn(ut,I.createElement(G,{key:"second"}),wn,Un,function(kn){ti(En(At,cn,Jt,kn),"mouse")});var Li=-1;return typeof At=="boolean"&&(Li=At?1:0),Bn(Ze===!0,I.createElement(G,{key:"12hours"}),Li,[{label:"AM",value:0,disabled:kt},{label:"PM",value:1,disabled:Yn}],function(kn){ti(En(!!kn,cn,Jt,wn),"mouse")}),I.createElement("div",{className:bn},pn.map(function(kn){var Gn=kn.node;return Gn}))}var Ee=ae,de=function(pe){return pe.filter(function(Oe){return Oe!==!1}).length};function Ke($){var pe=$.generateConfig,Oe=$.format,Re=Oe===void 0?"HH:mm:ss":Oe,Ge=$.prefixCls,Me=$.active,$e=$.operationRef,Ye=$.showHour,ut=$.showMinute,Ze=$.showSecond,dt=$.use12Hours,lt=dt===void 0?!1:dt,nt=$.onSelect,Et=$.value,pt="".concat(Ge,"-time-panel"),Lt=I.useRef(),bt=I.useState(-1),Nt=Object(H.a)(bt,2),qt=Nt[0],rn=Nt[1],ti=de([Ye,ut,Ze,lt]);return $e.current={onKeyDown:function(bn){return _(bn,{onLeftRight:function(At){rn((qt+At+ti)%ti)},onUpDown:function(At){qt===-1?rn(0):Lt.current&&Lt.current.onUpDown(At)},onEnter:function(){nt(Et||pe.getNow(),"key"),rn(-1)}})},onBlur:function(){rn(-1)}},I.createElement("div",{className:R()(pt,Object(D.a)({},"".concat(pt,"-active"),Me))},I.createElement(L,Object.assign({},$,{format:Re,prefixCls:Ge})),I.createElement(Ee,Object.assign({},$,{prefixCls:Ge,activeColumnIndex:qt,operationRef:Lt})))}var Je=Ke,je=7;function Qe($,pe){return!$&&!pe?!0:!$||!pe?!1:void 0}function ot($,pe,Oe){var Re=Qe(pe,Oe);if(typeof Re=="boolean")return Re;var Ge=Math.floor($.getYear(pe)/10),Me=Math.floor($.getYear(Oe)/10);return Ge===Me}function st($,pe,Oe){var Re=Qe(pe,Oe);return typeof Re=="boolean"?Re:$.getYear(pe)===$.getYear(Oe)}function ht($,pe){var Oe=Math.floor($.getMonth(pe)/3);return Oe+1}function mt($,pe,Oe){var Re=Qe(pe,Oe);return typeof Re=="boolean"?Re:st($,pe,Oe)&&ht($,pe)===ht($,Oe)}function ft($,pe,Oe){var Re=Qe(pe,Oe);return typeof Re=="boolean"?Re:st($,pe,Oe)&&$.getMonth(pe)===$.getMonth(Oe)}function Ht($,pe,Oe){var Re=Qe(pe,Oe);return typeof Re=="boolean"?Re:$.getYear(pe)===$.getYear(Oe)&&$.getMonth(pe)===$.getMonth(Oe)&&$.getDate(pe)===$.getDate(Oe)}function Vt($,pe,Oe){var Re=Qe(pe,Oe);return typeof Re=="boolean"?Re:$.getHour(pe)===$.getHour(Oe)&&$.getMinute(pe)===$.getMinute(Oe)&&$.getSecond(pe)===$.getSecond(Oe)}function zt($,pe,Oe,Re){var Ge=Qe(Oe,Re);return typeof Ge=="boolean"?Ge:$.locale.getWeek(pe,Oe)===$.locale.getWeek(pe,Re)}function Tt($,pe,Oe){return Ht($,pe,Oe)&&Vt($,pe,Oe)}function hn($,pe,Oe,Re){return!pe||!Oe||!Re?!1:!Ht($,pe,Re)&&!Ht($,Oe,Re)&&$.isAfter(Re,pe)&&$.isAfter(Oe,Re)}function Xt($,pe,Oe){var Re=pe.locale.getWeekFirstDay($),Ge=pe.setDate(Oe,1),Me=pe.getWeekDay(Ge),$e=pe.addDate(Ge,Re-Me);return pe.getMonth($e)===pe.getMonth(Oe)&&pe.getDate($e)>1&&($e=pe.addDate($e,-7)),$e}function Wt($,pe,Oe){var Re=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;switch(pe){case"year":return Oe.addYear($,Re*10);case"quarter":case"month":return Oe.addYear($,Re);default:return Oe.addMonth($,Re)}}var it=I.createContext({}),un=it;function Kt($){var pe=$.cellPrefixCls,Oe=$.generateConfig,Re=$.rangedValue,Ge=$.hoverRangedValue,Me=$.isInView,$e=$.isSameCell,Ye=$.offsetCell,ut=$.today,Ze=$.value;function dt(lt){var nt,Et=Ye(lt,-1),pt=Ye(lt,1),Lt=_e(Re,0),bt=_e(Re,1),Nt=_e(Ge,0),qt=_e(Ge,1),rn=hn(Oe,Nt,qt,lt);function ti(Jt){return $e(Lt,Jt)}function pn(Jt){return $e(bt,Jt)}var bn=$e(Nt,lt),In=$e(qt,lt),At=(rn||In)&&(!Me(Et)||pn(Et)),cn=(rn||bn)&&(!Me(pt)||ti(pt));return nt={},Object(D.a)(nt,"".concat(pe,"-in-view"),Me(lt)),Object(D.a)(nt,"".concat(pe,"-in-range"),hn(Oe,Lt,bt,lt)),Object(D.a)(nt,"".concat(pe,"-range-start"),ti(lt)),Object(D.a)(nt,"".concat(pe,"-range-end"),pn(lt)),Object(D.a)(nt,"".concat(pe,"-range-start-single"),ti(lt)&&!bt),Object(D.a)(nt,"".concat(pe,"-range-end-single"),pn(lt)&&!Lt),Object(D.a)(nt,"".concat(pe,"-range-start-near-hover"),ti(lt)&&($e(Et,Nt)||hn(Oe,Nt,qt,Et))),Object(D.a)(nt,"".concat(pe,"-range-end-near-hover"),pn(lt)&&($e(pt,qt)||hn(Oe,Nt,qt,pt))),Object(D.a)(nt,"".concat(pe,"-range-hover"),rn),Object(D.a)(nt,"".concat(pe,"-range-hover-start"),bn),Object(D.a)(nt,"".concat(pe,"-range-hover-end"),In),Object(D.a)(nt,"".concat(pe,"-range-hover-edge-start"),At),Object(D.a)(nt,"".concat(pe,"-range-hover-edge-end"),cn),Object(D.a)(nt,"".concat(pe,"-range-hover-edge-start-near-range"),At&&$e(Et,bt)),Object(D.a)(nt,"".concat(pe,"-range-hover-edge-end-near-range"),cn&&$e(pt,Lt)),Object(D.a)(nt,"".concat(pe,"-today"),$e(ut,lt)),Object(D.a)(nt,"".concat(pe,"-selected"),$e(Ze,lt)),nt}return dt}function qe($){for(var pe=$.prefixCls,Oe=$.disabledDate,Re=$.onSelect,Ge=$.rowNum,Me=$.colNum,$e=$.prefixColumn,Ye=$.rowClassName,ut=$.baseDate,Ze=$.getCellClassName,dt=$.getCellText,lt=$.getCellNode,nt=$.getCellDate,Et=$.titleCell,pt=$.headerCells,Lt=I.useContext(c),bt=Lt.onDateMouseEnter,Nt=Lt.onDateMouseLeave,qt="".concat(pe,"-cell"),rn=[],ti=0;ti<Ge;ti+=1){for(var pn=[],bn=void 0,In=function(Jt){var wn=ti*Me+Jt,En=nt(ut,wn),Vn=Oe&&Oe(En);Jt===0&&(bn=En,$e&&pn.push($e(bn))),pn.push(I.createElement("td",{key:Jt,title:Et&&Et(En),className:R()(qt,Object(U.a)(Object(D.a)({},"".concat(qt,"-disabled"),Vn),Ze(En))),onClick:function(){Vn||Re(En)},onMouseEnter:function(){!Vn&&bt&&bt(En)},onMouseLeave:function(){!Vn&&Nt&&Nt(En)}},lt?lt(En):I.createElement("div",{className:"".concat(qt,"-inner")},dt(En))))},At=0;At<Me;At+=1)In(At);rn.push(I.createElement("tr",{key:ti,className:Ye&&Ye(bn)},pn))}return I.createElement("div",{className:"".concat(pe,"-body")},I.createElement("table",{className:"".concat(pe,"-content")},pt&&I.createElement("thead",null,I.createElement("tr",null,pt)),I.createElement("tbody",null,rn)))}function wt($){var pe=$.prefixCls,Oe=$.generateConfig,Re=$.prefixColumn,Ge=$.locale,Me=$.rowCount,$e=$.viewDate,Ye=$.value,ut=$.dateRender,Ze=I.useContext(un),dt=Ze.rangedValue,lt=Ze.hoverRangedValue,nt=Xt(Ge.locale,Oe,$e),Et="".concat(pe,"-cell"),pt=Oe.locale.getWeekFirstDay(Ge.locale),Lt=Oe.getNow(),bt=[],Nt=Ge.shortWeekDays||(Oe.locale.getShortWeekDays?Oe.locale.getShortWeekDays(Ge.locale):[]);Re&&bt.push(I.createElement("th",{key:"empty","aria-label":"empty cell"}));for(var qt=0;qt<je;qt+=1)bt.push(I.createElement("th",{key:qt},Nt[(qt+pt)%je]));var rn=Kt({cellPrefixCls:Et,today:Lt,value:Ye,generateConfig:Oe,rangedValue:Re?null:dt,hoverRangedValue:Re?null:lt,isSameCell:function(bn,In){return Ht(Oe,bn,In)},isInView:function(bn){return ft(Oe,bn,$e)},offsetCell:function(bn,In){return Oe.addDate(bn,In)}}),ti=ut?function(pn){return ut(pn,Lt)}:void 0;return I.createElement(qe,Object.assign({},$,{rowNum:Me,colNum:je,baseDate:nt,getCellNode:ti,getCellText:Oe.getDate,getCellClassName:rn,getCellDate:Oe.addDate,titleCell:function(bn){return Oe.locale.format(Ge.locale,bn,"YYYY-MM-DD")},headerCells:bt}))}var Be=wt;function Ae($){var pe=$.prefixCls,Oe=$.generateConfig,Re=$.locale,Ge=$.viewDate,Me=$.onNextMonth,$e=$.onPrevMonth,Ye=$.onNextYear,ut=$.onPrevYear,Ze=$.onYearClick,dt=$.onMonthClick,lt=I.useContext(c),nt=lt.hideHeader;if(nt)return null;var Et="".concat(pe,"-header"),pt=Re.shortMonths||(Oe.locale.getShortMonths?Oe.locale.getShortMonths(Re.locale):[]),Lt=Oe.getMonth(Ge),bt=I.createElement("button",{type:"button",key:"year",onClick:Ze,tabIndex:-1,className:"".concat(pe,"-year-btn")},Oe.locale.format(Re.locale,Ge,Re.yearFormat)),Nt=I.createElement("button",{type:"button",key:"month",onClick:dt,tabIndex:-1,className:"".concat(pe,"-month-btn")},Re.monthFormat?Oe.locale.format(Re.locale,Ge,Re.monthFormat):pt[Lt]),qt=Re.monthBeforeYear?[Nt,bt]:[bt,Nt];return I.createElement(o,Object.assign({},$,{prefixCls:Et,onSuperPrev:ut,onPrev:$e,onNext:Me,onSuperNext:Ye}),qt)}var Ie=Ae,se=6;function ce($){var pe=$.prefixCls,Oe=$.panelName,Re=Oe===void 0?"date":Oe,Ge=$.keyboardConfig,Me=$.active,$e=$.operationRef,Ye=$.generateConfig,ut=$.value,Ze=$.viewDate,dt=$.onViewDateChange,lt=$.onPanelChange,nt=$.onSelect,Et="".concat(pe,"-").concat(Re,"-panel");$e.current={onKeyDown:function(Nt){return _(Nt,Object(U.a)({onLeftRight:function(rn){nt(Ye.addDate(ut||Ze,rn),"key")},onCtrlLeftRight:function(rn){nt(Ye.addYear(ut||Ze,rn),"key")},onUpDown:function(rn){nt(Ye.addDate(ut||Ze,rn*je),"key")},onPageUpDown:function(rn){nt(Ye.addMonth(ut||Ze,rn),"key")}},Ge))}};var pt=function(Nt){var qt=Ye.addYear(Ze,Nt);dt(qt),lt(null,qt)},Lt=function(Nt){var qt=Ye.addMonth(Ze,Nt);dt(qt),lt(null,qt)};return I.createElement("div",{className:R()(Et,Object(D.a)({},"".concat(Et,"-active"),Me))},I.createElement(Ie,Object.assign({},$,{prefixCls:pe,value:ut,viewDate:Ze,onPrevYear:function(){pt(-1)},onNextYear:function(){pt(1)},onPrevMonth:function(){Lt(-1)},onNextMonth:function(){Lt(1)},onMonthClick:function(){lt("month",Ze)},onYearClick:function(){lt("year",Ze)}})),I.createElement(Be,Object.assign({},$,{onSelect:function(Nt){return nt(Nt,"mouse")},prefixCls:pe,value:ut,viewDate:Ze,rowCount:se})))}var ye=ce;function Se($,pe,Oe){if(!Oe)return pe;var Re=pe;return Re=$.setHour(Re,$.getHour(Oe)),Re=$.setMinute(Re,$.getMinute(Oe)),Re=$.setSecond(Re,$.getSecond(Oe)),Re}var ke=oe("date","time");function et($){var pe=$.prefixCls,Oe=$.operationRef,Re=$.generateConfig,Ge=$.value,Me=$.defaultValue,$e=$.disabledTime,Ye=$.showTime,ut=$.onSelect,Ze="".concat(pe,"-datetime-panel"),dt=I.useState(null),lt=Object(H.a)(dt,2),nt=lt[0],Et=lt[1],pt=I.useRef({}),Lt=I.useRef({}),bt=Object(d.a)(Ye)==="object"?Object(U.a)({},Ye):{};function Nt(pn){var bn=ke.indexOf(nt)+pn,In=ke[bn]||null;return In}var qt=function(bn){Lt.current.onBlur&&Lt.current.onBlur(bn),Et(null)};Oe.current={onKeyDown:function(bn){if(bn.which===l.a.TAB){var In=Nt(bn.shiftKey?-1:1);return Et(In),In&&bn.preventDefault(),!0}if(nt){var At=nt==="date"?pt:Lt;return At.current&&At.current.onKeyDown&&At.current.onKeyDown(bn),!0}return[l.a.LEFT,l.a.RIGHT,l.a.UP,l.a.DOWN].includes(bn.which)?(Et("date"),!0):!1},onBlur:qt,onClose:qt};var rn=function(bn,In){var At=bn;In==="date"&&!Ge&&bt.defaultValue?(At=Re.setHour(At,Re.getHour(bt.defaultValue)),At=Re.setMinute(At,Re.getMinute(bt.defaultValue)),At=Re.setSecond(At,Re.getSecond(bt.defaultValue))):In==="time"&&!Ge&&Me&&(At=Re.setYear(At,Re.getYear(Me)),At=Re.setMonth(At,Re.getMonth(Me)),At=Re.setDate(At,Re.getDate(Me))),ut&&ut(At,"mouse")},ti=$e?$e(Ge||null):{};return I.createElement("div",{className:R()(Ze,Object(D.a)({},"".concat(Ze,"-active"),nt))},I.createElement(ye,Object.assign({},$,{operationRef:pt,active:nt==="date",onSelect:function(bn){rn(Se(Re,bn,Ye&&Object(d.a)(Ye)==="object"?Ye.defaultValue:null),"date")}})),I.createElement(Je,Object.assign({},$,{format:void 0},bt,ti,{defaultValue:void 0,operationRef:Lt,active:nt==="time",onSelect:function(bn){rn(bn,"time")}})))}var yt=et;function $t($){var pe=$.prefixCls,Oe=$.generateConfig,Re=$.locale,Ge=$.value,Me="".concat(pe,"-cell"),$e=function(dt){return I.createElement("td",{key:"week",className:R()(Me,"".concat(Me,"-week"))},Oe.locale.getWeek(Re.locale,dt))},Ye="".concat(pe,"-week-panel-row"),ut=function(dt){return R()(Ye,Object(D.a)({},"".concat(Ye,"-selected"),zt(Oe,Re.locale,Ge,dt)))};return I.createElement(ye,Object.assign({},$,{panelName:"week",prefixColumn:$e,rowClassName:ut,keyboardConfig:{onLeftRight:null}}))}var gn=$t;function Dt($){var pe=$.prefixCls,Oe=$.generateConfig,Re=$.locale,Ge=$.viewDate,Me=$.onNextYear,$e=$.onPrevYear,Ye=$.onYearClick,ut=I.useContext(c),Ze=ut.hideHeader;if(Ze)return null;var dt="".concat(pe,"-header");return I.createElement(o,Object.assign({},$,{prefixCls:dt,onSuperPrev:$e,onSuperNext:Me}),I.createElement("button",{type:"button",onClick:Ye,className:"".concat(pe,"-year-btn")},Oe.locale.format(Re.locale,Ge,Re.yearFormat)))}var zn=Dt,Ln=3,sn=4;function _i($){var pe=$.prefixCls,Oe=$.locale,Re=$.value,Ge=$.viewDate,Me=$.generateConfig,$e=$.monthCellRender,Ye=I.useContext(un),ut=Ye.rangedValue,Ze=Ye.hoverRangedValue,dt="".concat(pe,"-cell"),lt=Kt({cellPrefixCls:dt,value:Re,generateConfig:Me,rangedValue:ut,hoverRangedValue:Ze,isSameCell:function(bt,Nt){return ft(Me,bt,Nt)},isInView:function(){return!0},offsetCell:function(bt,Nt){return Me.addMonth(bt,Nt)}}),nt=Oe.shortMonths||(Me.locale.getShortMonths?Me.locale.getShortMonths(Oe.locale):[]),Et=Me.setMonth(Ge,0),pt=$e?function(Lt){return $e(Lt,Oe)}:void 0;return I.createElement(qe,Object.assign({},$,{rowNum:sn,colNum:Ln,baseDate:Et,getCellNode:pt,getCellText:function(bt){return Oe.monthFormat?Me.locale.format(Oe.locale,bt,Oe.monthFormat):nt[Me.getMonth(bt)]},getCellClassName:lt,getCellDate:Me.addMonth,titleCell:function(bt){return Me.locale.format(Oe.locale,bt,"YYYY-MM")}}))}var si=_i;function zi($){var pe=$.prefixCls,Oe=$.operationRef,Re=$.onViewDateChange,Ge=$.generateConfig,Me=$.value,$e=$.viewDate,Ye=$.onPanelChange,ut=$.onSelect,Ze="".concat(pe,"-month-panel");Oe.current={onKeyDown:function(nt){return _(nt,{onLeftRight:function(pt){ut(Ge.addMonth(Me||$e,pt),"key")},onCtrlLeftRight:function(pt){ut(Ge.addYear(Me||$e,pt),"key")},onUpDown:function(pt){ut(Ge.addMonth(Me||$e,pt*Ln),"key")},onEnter:function(){Ye("date",Me||$e)}})}};var dt=function(nt){var Et=Ge.addYear($e,nt);Re(Et),Ye(null,Et)};return I.createElement("div",{className:Ze},I.createElement(zn,Object.assign({},$,{prefixCls:pe,onPrevYear:function(){dt(-1)},onNextYear:function(){dt(1)},onYearClick:function(){Ye("year",$e)}})),I.createElement(si,Object.assign({},$,{prefixCls:pe,onSelect:function(nt){ut(nt,"mouse"),Ye("date",nt)}})))}var Oi=zi;function Qn($){var pe=$.prefixCls,Oe=$.generateConfig,Re=$.locale,Ge=$.viewDate,Me=$.onNextYear,$e=$.onPrevYear,Ye=$.onYearClick,ut=I.useContext(c),Ze=ut.hideHeader;if(Ze)return null;var dt="".concat(pe,"-header");return I.createElement(o,Object.assign({},$,{prefixCls:dt,onSuperPrev:$e,onSuperNext:Me}),I.createElement("button",{type:"button",onClick:Ye,className:"".concat(pe,"-year-btn")},Oe.locale.format(Re.locale,Ge,Re.yearFormat)))}var ir=Qn,qi=4,It=1;function Hn($){var pe=$.prefixCls,Oe=$.locale,Re=$.value,Ge=$.viewDate,Me=$.generateConfig,$e=I.useContext(un),Ye=$e.rangedValue,ut=$e.hoverRangedValue,Ze="".concat(pe,"-cell"),dt=Kt({cellPrefixCls:Ze,value:Re,generateConfig:Me,rangedValue:Ye,hoverRangedValue:ut,isSameCell:function(Et,pt){return mt(Me,Et,pt)},isInView:function(){return!0},offsetCell:function(Et,pt){return Me.addMonth(Et,pt*3)}}),lt=Me.setDate(Me.setMonth(Ge,0),1);return I.createElement(qe,Object.assign({},$,{rowNum:It,colNum:qi,baseDate:lt,getCellText:function(Et){return Me.locale.format(Oe.locale,Et,Oe.quarterFormat||"[Q]Q")},getCellClassName:dt,getCellDate:function(Et,pt){return Me.addMonth(Et,pt*3)},titleCell:function(Et){return Me.locale.format(Oe.locale,Et,"YYYY-[Q]Q")}}))}var li=Hn;function Gt($){var pe=$.prefixCls,Oe=$.operationRef,Re=$.onViewDateChange,Ge=$.generateConfig,Me=$.value,$e=$.viewDate,Ye=$.onPanelChange,ut=$.onSelect,Ze="".concat(pe,"-quarter-panel");Oe.current={onKeyDown:function(nt){return _(nt,{onLeftRight:function(pt){ut(Ge.addMonth(Me||$e,pt*3),"key")},onCtrlLeftRight:function(pt){ut(Ge.addYear(Me||$e,pt),"key")},onUpDown:function(pt){ut(Ge.addYear(Me||$e,pt),"key")}})}};var dt=function(nt){var Et=Ge.addYear($e,nt);Re(Et),Ye(null,Et)};return I.createElement("div",{className:Ze},I.createElement(ir,Object.assign({},$,{prefixCls:pe,onPrevYear:function(){dt(-1)},onNextYear:function(){dt(1)},onYearClick:function(){Ye("year",$e)}})),I.createElement(li,Object.assign({},$,{prefixCls:pe,onSelect:function(nt){ut(nt,"mouse")}})))}var Bt=Gt;function Rn($){var pe=$.prefixCls,Oe=$.generateConfig,Re=$.viewDate,Ge=$.onPrevDecade,Me=$.onNextDecade,$e=$.onDecadeClick,Ye=I.useContext(c),ut=Ye.hideHeader;if(ut)return null;var Ze="".concat(pe,"-header"),dt=Oe.getYear(Re),lt=Math.floor(dt/ui)*ui,nt=lt+ui-1;return I.createElement(o,Object.assign({},$,{prefixCls:Ze,onSuperPrev:Ge,onSuperNext:Me}),I.createElement("button",{type:"button",onClick:$e,className:"".concat(pe,"-decade-btn")},lt,"-",nt))}var Wn=Rn,nn=3,Pt=4;function Mi($){var pe=$.prefixCls,Oe=$.value,Re=$.viewDate,Ge=$.locale,Me=$.generateConfig,$e=I.useContext(un),Ye=$e.rangedValue,ut=$e.hoverRangedValue,Ze="".concat(pe,"-cell"),dt=Me.getYear(Re),lt=Math.floor(dt/ui)*ui,nt=lt+ui-1,Et=Me.setYear(Re,lt-Math.ceil((nn*Pt-ui)/2)),pt=function(Nt){var qt=Me.getYear(Nt);return lt<=qt&&qt<=nt},Lt=Kt({cellPrefixCls:Ze,value:Oe,generateConfig:Me,rangedValue:Ye,hoverRangedValue:ut,isSameCell:function(Nt,qt){return st(Me,Nt,qt)},isInView:pt,offsetCell:function(Nt,qt){return Me.addYear(Nt,qt)}});return I.createElement(qe,Object.assign({},$,{rowNum:Pt,colNum:nn,baseDate:Et,getCellText:Me.getYear,getCellClassName:Lt,getCellDate:Me.addYear,titleCell:function(Nt){return Me.locale.format(Ge.locale,Nt,"YYYY")}}))}var $i=Mi,ui=10;function vn($){var pe=$.prefixCls,Oe=$.operationRef,Re=$.onViewDateChange,Ge=$.generateConfig,Me=$.value,$e=$.viewDate,Ye=$.sourceMode,ut=$.onSelect,Ze=$.onPanelChange,dt="".concat(pe,"-year-panel");Oe.current={onKeyDown:function(Et){return _(Et,{onLeftRight:function(Lt){ut(Ge.addYear(Me||$e,Lt),"key")},onCtrlLeftRight:function(Lt){ut(Ge.addYear(Me||$e,Lt*ui),"key")},onUpDown:function(Lt){ut(Ge.addYear(Me||$e,Lt*nn),"key")},onEnter:function(){Ze(Ye==="date"?"date":"month",Me||$e)}})}};var lt=function(Et){var pt=Ge.addYear($e,Et*10);Re(pt),Ze(null,pt)};return I.createElement("div",{className:dt},I.createElement(Wn,Object.assign({},$,{prefixCls:pe,onPrevDecade:function(){lt(-1)},onNextDecade:function(){lt(1)},onDecadeClick:function(){Ze("decade",$e)}})),I.createElement($i,Object.assign({},$,{prefixCls:pe,onSelect:function(Et){Ze(Ye==="date"?"date":"month",Et),ut(Et,"mouse")}})))}var Bi=vn;function Ai($){var pe=$.prefixCls,Oe=$.generateConfig,Re=$.viewDate,Ge=$.onPrevDecades,Me=$.onNextDecades,$e=I.useContext(c),Ye=$e.hideHeader;if(Ye)return null;var ut="".concat(pe,"-header"),Ze=Oe.getYear(Re),dt=Math.floor(Ze/ii)*ii,lt=dt+ii-1;return I.createElement(o,Object.assign({},$,{prefixCls:ut,onSuperPrev:Ge,onSuperNext:Me}),dt,"-",lt)}var Pi=Ai,ct=3,Zt=4;function Ei($){var pe=ri-1,Oe=$.prefixCls,Re=$.viewDate,Ge=$.generateConfig,Me=$.disabledDate,$e="".concat(Oe,"-cell"),Ye=Ge.getYear(Re),ut=Math.floor(Ye/ri)*ri,Ze=Math.floor(Ye/ii)*ii,dt=Ze+ii-1,lt=Ge.setYear(Re,Ze-Math.ceil((ct*Zt*ri-ii)/2)),nt=function(pt){var Lt,bt=Me&&Me(pt),Nt=Ge.getYear(pt),qt=Nt+pe;return Lt={},Object(D.a)(Lt,"".concat($e,"-disabled"),bt),Object(D.a)(Lt,"".concat($e,"-in-view"),Ze<=Nt&&qt<=dt),Object(D.a)(Lt,"".concat($e,"-selected"),Nt===ut),Lt};return I.createElement(qe,Object.assign({},$,{rowNum:Zt,colNum:ct,baseDate:lt,getCellText:function(pt){var Lt=Ge.getYear(pt);return"".concat(Lt,"-").concat(Lt+pe)},getCellClassName:nt,getCellDate:function(pt,Lt){return Ge.addYear(pt,Lt*ri)}}))}var ji=Ei,ri=10,ii=ri*10;function X($){var pe=$.prefixCls,Oe=$.onViewDateChange,Re=$.generateConfig,Ge=$.viewDate,Me=$.operationRef,$e=$.onSelect,Ye=$.onPanelChange,ut="".concat(pe,"-decade-panel");Me.current={onKeyDown:function(nt){return _(nt,{onLeftRight:function(pt){$e(Re.addYear(Ge,pt*ri),"key")},onCtrlLeftRight:function(pt){$e(Re.addYear(Ge,pt*ii),"key")},onUpDown:function(pt){$e(Re.addYear(Ge,pt*ri*ct),"key")},onEnter:function(){Ye("year",Ge)}})}};var Ze=function(nt){var Et=Re.addYear(Ge,nt*ii);Oe(Et),Ye(null,Et)},dt=function(nt){$e(nt,"mouse"),Ye("year",nt)};return I.createElement("div",{className:ut},I.createElement(Pi,Object.assign({},$,{prefixCls:pe,onPrevDecades:function(){Ze(-1)},onNextDecades:function(){Ze(1)}})),I.createElement(ji,Object.assign({},$,{prefixCls:pe,onSelect:dt})))}var v=X;function O($,pe,Oe){return Oe?I.createElement("div",{className:"".concat($,"-footer-extra")},Oe(pe)):null}function B($){var pe=$.prefixCls,Oe=$.rangeList,Re=Oe===void 0?[]:Oe,Ge=$.components,Me=Ge===void 0?{}:Ge,$e=$.needConfirmButton,Ye=$.onNow,ut=$.onOk,Ze=$.okDisabled,dt=$.showNow,lt=$.locale,nt,Et;if(Re.length){var pt=Me.rangeItem||"span";nt=I.createElement(I.Fragment,null,Re.map(function(bt){var Nt=bt.label,qt=bt.onClick,rn=bt.onMouseEnter,ti=bt.onMouseLeave;return I.createElement("li",{key:Nt,className:"".concat(pe,"-preset")},I.createElement(pt,{onClick:qt,onMouseEnter:rn,onMouseLeave:ti},Nt))}))}if($e){var Lt=Me.button||"button";Ye&&!nt&&dt!==!1&&(nt=I.createElement("li",{className:"".concat(pe,"-now")},I.createElement("a",{className:"".concat(pe,"-now-btn"),onClick:Ye},lt.now))),Et=$e&&I.createElement("li",{className:"".concat(pe,"-ok")},I.createElement(Lt,{disabled:Ze,onClick:ut},lt.ok))}return!nt&&!Et?null:I.createElement("ul",{className:"".concat(pe,"-ranges")},nt,Et)}function te($){var pe,Oe=$.prefixCls,Re=Oe===void 0?"rc-picker":Oe,Ge=$.className,Me=$.style,$e=$.locale,Ye=$.generateConfig,ut=$.value,Ze=$.defaultValue,dt=$.pickerValue,lt=$.defaultPickerValue,nt=$.disabledDate,Et=$.mode,pt=$.picker,Lt=pt===void 0?"date":pt,bt=$.tabIndex,Nt=bt===void 0?0:bt,qt=$.showNow,rn=$.showTime,ti=$.showToday,pn=$.renderExtraFooter,bn=$.hideHeader,In=$.onSelect,At=$.onChange,cn=$.onPanelChange,Jt=$.onMouseDown,wn=$.onPickerValueChange,En=$.onOk,Vn=$.components,Kn=$.direction,Di=$.hourStep,ln=Di===void 0?1:Di,kt=$.minuteStep,Yn=kt===void 0?1:kt,mn=$.secondStep,Sn=mn===void 0?1:mn,Un=Lt==="date"&&!!rn||Lt==="time",Bn=24%ln===0,Li=60%Yn===0,kn=60%Sn===0,Gn=I.useContext(c),jn=Gn.operationRef,xi=Gn.panelRef,er=Gn.onSelect,Wi=Gn.hideRanges,fr=Gn.defaultOpenValue,gr=I.useContext(un),Cr=gr.inRange,Dr=gr.panelPosition,ur=gr.rangedValue,ca=gr.hoverRangedValue,wr=I.useRef({}),Kr=I.useRef(!0),va=Object(p.a)(null,{value:ut,defaultValue:Ze,postState:function(St){return!St&&fr&&Lt==="time"?fr:St}}),Gr=Object(H.a)(va,2),br=Gr[0],kr=Gr[1],Mr=Object(p.a)(null,{value:dt,defaultValue:lt||br,postState:function(St){return St||Ye.getNow()}}),me=Object(H.a)(Mr,2),De=me[0],Pe=me[1],ge=function(St){Pe(St),wn&&wn(St)},ne=function(St){var jt=W[Lt];return jt?jt(St):St},he=Object(p.a)(function(){return Lt==="time"?"time":ne("date")},{value:Et}),re=Object(H.a)(he,2),ve=re[0],Ce=re[1];I.useEffect(function(){Ce(Lt)},[Lt]);var He=I.useState(function(){return ve}),we=Object(H.a)(He,2),ze=we[0],rt=we[1],vt=function(St,jt){var Zn=ne(St||ve);rt(ve),Ce(Zn),cn&&(ve!==Zn||Tt(Ye,De,De))&&cn(jt,Zn)},xt=function(St,jt){var Zn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;(ve===Lt||Zn)&&(kr(St),In&&In(St),er&&er(St,jt),At&&!Tt(Ye,St,br)&&At(St))},Ft=function(St){return wr.current&&wr.current.onKeyDown?([l.a.LEFT,l.a.RIGHT,l.a.UP,l.a.DOWN,l.a.PAGE_UP,l.a.PAGE_DOWN,l.a.ENTER].includes(St.which)&&St.preventDefault(),wr.current.onKeyDown(St)):(Object(g.a)(!1,"Panel not correct handle keyDown event. Please help to fire issue about this."),!1)},dn=function(St){wr.current&&wr.current.onBlur&&wr.current.onBlur(St)};jn&&Dr!=="right"&&(jn.current={onKeyDown:Ft,onClose:function(){wr.current&&wr.current.onClose&&wr.current.onClose()}}),I.useEffect(function(){ut&&!Kr.current&&Pe(ut)},[ut]),I.useEffect(function(){Kr.current=!1},[]);var Dn,On=Object(U.a)(Object(U.a)({},$),{},{operationRef:wr,prefixCls:Re,viewDate:De,value:br,onViewDateChange:ge,sourceMode:ze,onPanelChange:vt,disabledDate:ve!=="decade"?nt:void 0});delete On.onChange,delete On.onSelect;switch(ve){case"decade":Dn=I.createElement(v,Object.assign({},On,{onSelect:function(St,jt){ge(St),xt(St,jt)}}));break;case"year":Dn=I.createElement(Bi,Object.assign({},On,{onSelect:function(St,jt){ge(St),xt(St,jt)}}));break;case"month":Dn=I.createElement(Oi,Object.assign({},On,{onSelect:function(St,jt){ge(St),xt(St,jt)}}));break;case"quarter":Dn=I.createElement(Bt,Object.assign({},On,{onSelect:function(St,jt){ge(St),xt(St,jt)}}));break;case"week":Dn=I.createElement(gn,Object.assign({},On,{onSelect:function(St,jt){ge(St),xt(St,jt)}}));break;case"time":delete On.showTime,Dn=I.createElement(Je,Object.assign({},On,Object(d.a)(rn)==="object"?rn:null,{onSelect:function(St,jt){ge(St),xt(St,jt)}}));break;default:rn?Dn=I.createElement(yt,Object.assign({},On,{onSelect:function(St,jt){ge(St),xt(St,jt)}})):Dn=I.createElement(ye,Object.assign({},On,{onSelect:function(St,jt){ge(St),xt(St,jt)}}))}var Jn,ni,Xn=function(){var St=Ye.getNow(),jt=Ue(Ye.getHour(St),Ye.getMinute(St),Ye.getSecond(St),Bn?ln:1,Li?Yn:1,kn?Sn:1),Zn=We(Ye,St,jt[0],jt[1],jt[2]);xt(Zn,"submit")};Wi||(Jn=O(Re,ve,pn),ni=B({prefixCls:Re,components:Vn,needConfirmButton:Un,okDisabled:!br||nt&&nt(br),locale:$e,showNow:qt,onNow:Un&&Xn,onOk:function(){br&&(xt(br,"submit",!0),En&&En(br))}}));var ei;if(ti&&ve==="date"&&Lt==="date"&&!rn){var oi=Ye.getNow(),An="".concat(Re,"-today-btn"),Ti=nt&&nt(oi);ei=I.createElement("a",{className:R()(An,Ti&&"".concat(An,"-disabled")),"aria-disabled":Ti,onClick:function(){Ti||xt(oi,"mouse",!0)}},$e.today)}return I.createElement(c.Provider,{value:Object(U.a)(Object(U.a)({},Gn),{},{hideHeader:"hideHeader"in $?bn:Gn.hideHeader,hidePrevBtn:Cr&&Dr==="right",hideNextBtn:Cr&&Dr==="left"})},I.createElement("div",{tabIndex:Nt,className:R()("".concat(Re,"-panel"),Ge,(pe={},Object(D.a)(pe,"".concat(Re,"-panel-has-range"),ur&&ur[0]&&ur[1]),Object(D.a)(pe,"".concat(Re,"-panel-has-range-hover"),ca&&ca[0]&&ca[1]),Object(D.a)(pe,"".concat(Re,"-panel-rtl"),Kn==="rtl"),pe)),style:Me,onKeyDown:Ft,onBlur:dn,onMouseDown:Jt,ref:xi},Dn,Jn||ni||ei?I.createElement("div",{className:"".concat(Re,"-footer")},Jn,ni,ei):null))}var z=te,be=q("uciX"),tt={bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:1,adjustY:1}},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}}};function Ot($){var pe,Oe=$.prefixCls,Re=$.popupElement,Ge=$.popupStyle,Me=$.visible,$e=$.dropdownClassName,Ye=$.dropdownAlign,ut=$.transitionName,Ze=$.getPopupContainer,dt=$.children,lt=$.range,nt=$.popupPlacement,Et=$.direction,pt="".concat(Oe,"-dropdown"),Lt=function(){return nt!==void 0?nt:Et==="rtl"?"bottomRight":"bottomLeft"};return I.createElement(be.a,{showAction:[],hideAction:[],popupPlacement:Lt(),builtinPlacements:tt,prefixCls:pt,popupTransitionName:ut,popup:Re,popupAlign:Ye,popupVisible:Me,popupClassName:R()($e,(pe={},Object(D.a)(pe,"".concat(pt,"-range"),lt),Object(D.a)(pe,"".concat(pt,"-rtl"),Et==="rtl"),pe)),popupStyle:Ge,getPopupContainer:Ze},dt)}var Ct=Ot;function at($){var pe=$.open,Oe=$.value,Re=$.isClickOutside,Ge=$.triggerOpen,Me=$.forwardKeyDown,$e=$.blurToCancel,Ye=$.onSubmit,ut=$.onCancel,Ze=$.onFocus,dt=$.onBlur,lt=Object(I.useState)(!1),nt=Object(H.a)(lt,2),Et=nt[0],pt=nt[1],Lt=Object(I.useState)(!1),bt=Object(H.a)(Lt,2),Nt=bt[0],qt=bt[1],rn=Object(I.useRef)(!1),ti=Object(I.useRef)(!1),pn={onMouseDown:function(){pt(!0),Ge(!0)},onKeyDown:function(In){switch(In.which){case l.a.ENTER:{pe?Ye()!==!1&&pt(!0):Ge(!0),In.preventDefault();return}case l.a.TAB:{Et&&pe&&!In.shiftKey?(pt(!1),In.preventDefault()):!Et&&pe&&(!Me(In)&&In.shiftKey&&(pt(!0),In.preventDefault()));return}case l.a.ESC:{pt(!0),ut();return}}!pe&&![l.a.SHIFT].includes(In.which)?Ge(!0):Et||Me(In)},onFocus:function(In){pt(!0),qt(!0),Ze&&Ze(In)},onBlur:function(In){if(rn.current||!Re(document.activeElement)){rn.current=!1;return}$e?setTimeout(function(){Re(document.activeElement)&&ut()},0):pe&&(Ge(!1),ti.current&&Ye()),qt(!1),dt&&dt(In)}};return Object(I.useEffect)(function(){ti.current=!1},[pe]),Object(I.useEffect)(function(){ti.current=!0},[Oe]),Object(I.useEffect)(function(){return m(function(bn){var In=bn.target;pe&&(Re(In)?Nt||Ge(!1):(rn.current=!0,requestAnimationFrame(function(){rn.current=!1})))})}),[pn,{focused:Nt,typing:Et}]}function Yt($){var pe=$.valueTexts,Oe=$.onTextChange,Re=I.useState(""),Ge=Object(H.a)(Re,2),Me=Ge[0],$e=Ge[1],Ye=I.useRef([]);Ye.current=pe;function ut(dt){$e(dt),Oe(dt)}function Ze(){$e(Ye.current[0])}return I.useEffect(function(){pe.every(function(dt){return dt!==Me})&&Ze()},[pe.join("||")]),[Me,ut,Ze]}var Cn=q("Gytx"),Nn=q.n(Cn);function Hi($,pe){var Oe=pe.formatList,Re=pe.generateConfig,Ge=pe.locale;return Object(C.a)(function(){if(!$)return[[""],""];for(var Me="",$e=[],Ye=0;Ye<Oe.length;Ye+=1){var ut=Oe[Ye],Ze=Re.locale.format(Ge.locale,$,ut);$e.push(Ze),Ye===0&&(Me=Ze)}return[$e,Me]},[$,Oe],function(Me,$e){return Me[0]!==$e[0]||!Nn()(Me[1],$e[1])})}function Ri($,pe){var Oe=pe.formatList,Re=pe.generateConfig,Ge=pe.locale,Me=Object(I.useState)(null),$e=Object(H.a)(Me,2),Ye=$e[0],ut=$e[1],Ze=Object(I.useRef)(null);function dt(bt){var Nt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(cancelAnimationFrame(Ze.current),Nt){ut(bt);return}Ze.current=requestAnimationFrame(function(){ut(bt)})}var lt=Hi(Ye,{formatList:Oe,generateConfig:Re,locale:Ge}),nt=Object(H.a)(lt,2),Et=nt[1];function pt(bt){dt(bt)}function Lt(){var bt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;dt(null,bt)}return Object(I.useEffect)(function(){Lt(!0)},[$]),Object(I.useEffect)(function(){return function(){return cancelAnimationFrame(Ze.current)}},[]),[Et,pt,Lt]}function fi($){var pe,Oe=$.prefixCls,Re=Oe===void 0?"rc-picker":Oe,Ge=$.id,Me=$.tabIndex,$e=$.style,Ye=$.className,ut=$.dropdownClassName,Ze=$.dropdownAlign,dt=$.popupStyle,lt=$.transitionName,nt=$.generateConfig,Et=$.locale,pt=$.inputReadOnly,Lt=$.allowClear,bt=$.autoFocus,Nt=$.showTime,qt=$.picker,rn=qt===void 0?"date":qt,ti=$.format,pn=$.use12Hours,bn=$.value,In=$.defaultValue,At=$.open,cn=$.defaultOpen,Jt=$.defaultOpenValue,wn=$.suffixIcon,En=$.clearIcon,Vn=$.disabled,Kn=$.disabledDate,Di=$.placeholder,ln=$.getPopupContainer,kt=$.pickerRef,Yn=$.panelRender,mn=$.onChange,Sn=$.onOpenChange,Un=$.onFocus,Bn=$.onBlur,Li=$.onMouseDown,kn=$.onMouseUp,Gn=$.onMouseEnter,jn=$.onMouseLeave,xi=$.onContextMenu,er=$.onClick,Wi=$.direction,fr=$.autoComplete,gr=fr===void 0?"off":fr,Cr=I.useRef(null),Dr=rn==="date"&&!!Nt||rn==="time",ur=fe(S(ti,rn,Nt,pn)),ca=I.useRef(null),wr=I.useRef(null),Kr=Object(p.a)(null,{value:bn,defaultValue:In}),va=Object(H.a)(Kr,2),Gr=va[0],br=va[1],kr=I.useState(Gr),Mr=Object(H.a)(kr,2),me=Mr[0],De=Mr[1],Pe=I.useRef(null),ge=Object(p.a)(!1,{value:At,defaultValue:cn,postState:function(Mn){return Vn?!1:Mn},onChange:function(Mn){Sn&&Sn(Mn),!Mn&&Pe.current&&Pe.current.onClose&&Pe.current.onClose()}}),ne=Object(H.a)(ge,2),he=ne[0],re=ne[1],ve=Hi(me,{formatList:ur,generateConfig:nt,locale:Et}),Ce=Object(H.a)(ve,2),He=Ce[0],we=Ce[1],ze=Yt({valueTexts:He,onTextChange:function(Mn){var or=nt.locale.parse(Et.locale,Mn,ur);or&&(!Kn||!Kn(or))&&De(or)}}),rt=Object(H.a)(ze,3),vt=rt[0],xt=rt[1],Ft=rt[2],dn=function(Mn){De(Mn),br(Mn),mn&&!Tt(nt,Gr,Mn)&&mn(Mn,Mn?nt.locale.format(Et.locale,Mn,ur[0]):"")},Dn=function(Mn){if(Vn&&Mn)return;re(Mn)},On=function(Mn){return he&&Pe.current&&Pe.current.onKeyDown?Pe.current.onKeyDown(Mn):(Object(g.a)(!1,"Picker not correct forward KeyDown operation. Please help to fire issue about this."),!1)},Jn=function(){kn&&kn.apply(void 0,arguments),Cr.current&&(Cr.current.focus(),Dn(!0))},ni=at({blurToCancel:Dr,open:he,value:vt,triggerOpen:Dn,forwardKeyDown:On,isClickOutside:function(Mn){return!k([ca.current,wr.current],Mn)},onSubmit:function(){return Kn&&Kn(me)?!1:(dn(me),Dn(!1),Ft(),!0)},onCancel:function(){Dn(!1),De(Gr),Ft()},onFocus:Un,onBlur:Bn}),Xn=Object(H.a)(ni,2),ei=Xn[0],oi=Xn[1],An=oi.focused,Ti=oi.typing;I.useEffect(function(){he||(De(Gr),!He.length||He[0]===""?xt(""):we!==vt&&Ft())},[he,He]),I.useEffect(function(){he||Ft()},[rn]),I.useEffect(function(){De(Gr)},[Gr]),kt&&(kt.current={focus:function(){Cr.current&&Cr.current.focus()},blur:function(){Cr.current&&Cr.current.blur()}});var Tn=Object(U.a)(Object(U.a)({},$),{},{className:void 0,style:void 0,pickerValue:void 0,onPickerValueChange:void 0}),St=I.createElement(z,Object.assign({},Tn,{generateConfig:nt,className:R()(Object(D.a)({},"".concat(Re,"-panel-focused"),!Ti)),value:me,locale:Et,tabIndex:-1,onChange:De,direction:Wi}));Yn&&(St=Yn(St));var jt=I.createElement("div",{className:"".concat(Re,"-panel-container"),onMouseDown:function(Mn){Mn.preventDefault()}},St),Zn;wn&&(Zn=I.createElement("span",{className:"".concat(Re,"-suffix")},wn));var pi;Lt&&Gr&&!Vn&&(pi=I.createElement("span",{onMouseDown:function(Mn){Mn.preventDefault(),Mn.stopPropagation()},onMouseUp:function(Mn){Mn.preventDefault(),Mn.stopPropagation(),dn(null),Dn(!1)},className:"".concat(Re,"-clear")},En||I.createElement("span",{className:"".concat(Re,"-clear-btn")})));var yn=function(Mn,or){(or==="submit"||or!=="key"&&!Dr)&&(dn(Mn),Dn(!1))},gi=Wi==="rtl"?"bottomRight":"bottomLeft",Yi=Ri(vt,{formatList:ur,generateConfig:nt,locale:Et}),vi=Object(H.a)(Yi,3),Ni=vi[0],Ii=vi[1],Si=vi[2];return I.createElement(c.Provider,{value:{operationRef:Pe,hideHeader:rn==="time",panelRef:ca,onSelect:yn,open:he,defaultOpenValue:Jt,onDateMouseEnter:Ii,onDateMouseLeave:Si}},I.createElement(Ct,{visible:he,popupElement:jt,popupStyle:dt,prefixCls:Re,dropdownClassName:ut,dropdownAlign:Ze,getPopupContainer:ln,transitionName:lt,popupPlacement:gi,direction:Wi},I.createElement("div",{className:R()(Re,Ye,(pe={},Object(D.a)(pe,"".concat(Re,"-disabled"),Vn),Object(D.a)(pe,"".concat(Re,"-focused"),An),Object(D.a)(pe,"".concat(Re,"-rtl"),Wi==="rtl"),pe)),style:$e,onMouseDown:Li,onMouseUp:Jn,onMouseEnter:Gn,onMouseLeave:jn,onContextMenu:xi,onClick:er},I.createElement("div",{className:R()("".concat(Re,"-input"),Object(D.a)({},"".concat(Re,"-input-placeholder"),!!Ni)),ref:wr},I.createElement("input",Object.assign({id:Ge,tabIndex:Me,disabled:Vn,readOnly:pt||!Ti,value:Ni||vt,onChange:function(Mn){xt(Mn.target.value)},autoFocus:bt,placeholder:Di,ref:Cr,title:vt},ei,{size:y(rn,ur[0])},Ne($),{autoComplete:gr})),Zn,pi))))}var sr=function($){Object(P.a)(Oe,$);var pe=Object(Y.a)(Oe);function Oe(){var Re;return Object(le.a)(this,Oe),Re=pe.apply(this,arguments),Re.pickerRef=I.createRef(),Re.focus=function(){Re.pickerRef.current&&Re.pickerRef.current.focus()},Re.blur=function(){Re.pickerRef.current&&Re.pickerRef.current.blur()},Re}return Object(Q.a)(Oe,[{key:"render",value:function(){return I.createElement(fi,Object.assign({},this.props,{pickerRef:this.pickerRef}))}}]),Oe}(I.Component),rr=sr;function wi($,pe,Oe){var Re=$.picker,Ge=$.locale,Me=$.selectedValue,$e=$.disabledDate,Ye=$.disabled,ut=$.generateConfig,Ze=_e(Me,0),dt=_e(Me,1);function lt(bt){var Nt=ut.getYear(bt),qt=ut.locale.getWeek(Ge.locale,bt);return Nt*100+qt}function nt(bt){var Nt=ut.getYear(bt),qt=ut.getMonth(bt);return Nt*100+qt}function Et(bt){var Nt=ut.getYear(bt),qt=ht(ut,bt);return Nt*10+qt}var pt=I.useCallback(function(bt){if($e&&$e(bt))return!0;if(Ye[1]&&dt)return!Ht(ut,bt,dt)&&ut.isAfter(bt,dt);if(pe&&dt)switch(Re){case"quarter":return Et(bt)>Et(dt);case"month":return nt(bt)>nt(dt);case"week":return lt(bt)>lt(dt);default:return!Ht(ut,bt,dt)&&ut.isAfter(bt,dt)}return!1},[$e,Ye[1],dt,pe]),Lt=I.useCallback(function(bt){if($e&&$e(bt))return!0;if(Ye[0]&&Ze)return!Ht(ut,bt,dt)&&ut.isAfter(Ze,bt);if(Oe&&Ze)switch(Re){case"quarter":return Et(bt)<Et(Ze);case"month":return nt(bt)<nt(Ze);case"week":return lt(bt)<lt(Ze);default:return!Ht(ut,bt,Ze)&&ut.isAfter(Ze,bt)}return!1},[$e,Ye[0],Ze,Oe]);return[pt,Lt]}function lr($,pe,Oe,Re){var Ge=Wt($,Oe,Re,1);function Me($e){return $e($,pe)?"same":$e(Ge,pe)?"closing":"far"}switch(Oe){case"year":return Me(function($e,Ye){return ot(Re,$e,Ye)});case"quarter":case"month":return Me(function($e,Ye){return st(Re,$e,Ye)});default:return Me(function($e,Ye){return ft(Re,$e,Ye)})}}function mr($,pe,Oe,Re){var Ge=_e($,0),Me=_e($,1);if(pe===0)return Ge;if(Ge&&Me){var $e=lr(Ge,Me,Oe,Re);switch($e){case"same":return Ge;case"closing":return Ge;default:return Wt(Me,Oe,Re,-1)}}return Ge}function ai($){var pe=$.values,Oe=$.picker,Re=$.defaultDates,Ge=$.generateConfig,Me=I.useState(function(){return[_e(Re,0),_e(Re,1)]}),$e=Object(H.a)(Me,2),Ye=$e[0],ut=$e[1],Ze=I.useState(null),dt=Object(H.a)(Ze,2),lt=dt[0],nt=dt[1],Et=_e(pe,0),pt=_e(pe,1);function Lt(Nt){return Ye[Nt]?Ye[Nt]:_e(lt,Nt)||mr(pe,Nt,Oe,Ge)||Et||pt||Ge.getNow()}function bt(Nt,qt){if(Nt){var rn=Fe(lt,Nt,qt);ut(Fe(Ye,null,qt)||[null,null]);var ti=(qt+1)%2;_e(pe,ti)||(rn=Fe(rn,Nt,ti)),nt(rn)}else(Et||pt)&&nt(null)}return[Lt,bt]}function on($,pe){return $&&$[0]&&$[1]&&pe.isAfter($[0],$[1])?[$[1],$[0]]:$}function ci($,pe,Oe,Re){return $||Re&&Re[pe]?!0:!!Oe[(pe+1)%2]}function Qt($){var pe,Oe,Re,Ge=$.prefixCls,Me=Ge===void 0?"rc-picker":Ge,$e=$.id,Ye=$.style,ut=$.className,Ze=$.popupStyle,dt=$.dropdownClassName,lt=$.transitionName,nt=$.dropdownAlign,Et=$.getPopupContainer,pt=$.generateConfig,Lt=$.locale,bt=$.placeholder,Nt=$.autoFocus,qt=$.disabled,rn=$.format,ti=$.picker,pn=ti===void 0?"date":ti,bn=$.showTime,In=$.use12Hours,At=$.separator,cn=At===void 0?"~":At,Jt=$.value,wn=$.defaultValue,En=$.defaultPickerValue,Vn=$.open,Kn=$.defaultOpen,Di=$.disabledDate,ln=$.disabledTime,kt=$.dateRender,Yn=$.panelRender,mn=$.ranges,Sn=$.allowEmpty,Un=$.allowClear,Bn=$.suffixIcon,Li=$.clearIcon,kn=$.pickerRef,Gn=$.inputReadOnly,jn=$.mode,xi=$.renderExtraFooter,er=$.onChange,Wi=$.onOpenChange,fr=$.onPanelChange,gr=$.onCalendarChange,Cr=$.onFocus,Dr=$.onBlur,ur=$.onOk,ca=$.components,wr=$.order,Kr=$.direction,va=$.activePickerIndex,Gr=$.autoComplete,br=Gr===void 0?"off":Gr,kr=pn==="date"&&!!bn||pn==="time",Mr=Object(I.useRef)({}),me=Object(I.useRef)(null),De=Object(I.useRef)(null),Pe=Object(I.useRef)(null),ge=Object(I.useRef)(null),ne=Object(I.useRef)(null),he=Object(I.useRef)(null),re=Object(I.useRef)(null),ve=fe(S(rn,pn,bn,In)),Ce=Object(p.a)(0,{value:va}),He=Object(H.a)(Ce,2),we=He[0],ze=He[1],rt=Object(I.useRef)(null),vt=I.useMemo(function(){return Array.isArray(qt)?qt:[qt||!1,qt||!1]},[qt]),xt=Object(p.a)(null,{value:Jt,defaultValue:wn,postState:function(an){return pn==="time"&&!wr?an:on(an,pt)}}),Ft=Object(H.a)(xt,2),dn=Ft[0],Dn=Ft[1],On=ai({values:dn,picker:pn,defaultDates:En,generateConfig:pt}),Jn=Object(H.a)(On,2),ni=Jn[0],Xn=Jn[1],ei=Object(p.a)(dn,{postState:function(an){var xn=an;if(vt[0]&&vt[1])return xn;for(var hi=0;hi<2;hi+=1)vt[hi]&&!_e(xn,hi)&&!_e(Sn,hi)&&(xn=Fe(xn,pt.getNow(),hi));return xn}}),oi=Object(H.a)(ei,2),An=oi[0],Ti=oi[1],Tn=Object(p.a)([pn,pn],{value:jn}),St=Object(H.a)(Tn,2),jt=St[0],Zn=St[1];Object(I.useEffect)(function(){Zn([pn,pn])},[pn]);var pi=function(an,xn){Zn(an),fr&&fr(xn,an)},yn=wi({picker:pn,selectedValue:An,locale:Lt,disabled:vt,disabledDate:Di,generateConfig:pt},Mr.current[1],Mr.current[0]),gi=Object(H.a)(yn,2),Yi=gi[0],vi=gi[1],Ni=Object(p.a)(!1,{value:Vn,defaultValue:Kn,postState:function(an){return vt[we]?!1:an},onChange:function(an){Wi&&Wi(an),!an&&rt.current&&rt.current.onClose&&rt.current.onClose()}}),Ii=Object(H.a)(Ni,2),Si=Ii[0],Ci=Ii[1],Mn=Si&&we===0,or=Si&&we===1,$r=Object(I.useState)(0),Pr=Object(H.a)($r,2),Er=Pr[0],Qi=Pr[1];Object(I.useEffect)(function(){!Si&&me.current&&Qi(me.current.offsetWidth)},[Si]);var Ki=I.useRef();function Vi(qn,an){if(qn)clearTimeout(Ki.current),Mr.current[an]=!0,ze(an),Ci(qn),Si||Xn(null,an);else if(we===an){Ci(qn);var xn=Mr.current;Ki.current=setTimeout(function(){xn===Mr.current&&(Mr.current={})})}}function Ji(qn){Vi(!0,qn),setTimeout(function(){var an=[he,re][qn];an.current&&an.current.focus()},0)}function Nr(qn,an){var xn=qn,hi=_e(xn,0),tr=_e(xn,1);hi&&tr&&pt.isAfter(hi,tr)&&(pn==="week"&&!zt(pt,Lt.locale,hi,tr)||pn==="quarter"&&!mt(pt,hi,tr)||pn!=="week"&&pn!=="quarter"&&pn!=="time"&&!Ht(pt,hi,tr)?(an===0?(xn=[hi,null],tr=null):(hi=null,xn=[null,tr]),Mr.current=Object(D.a)({},an,!0)):(pn!=="time"||wr!==!1)&&(xn=on(xn,pt))),Ti(xn);var ma=xn&&xn[0]?pt.locale.format(Lt.locale,xn[0],ve[0]):"",ia=xn&&xn[1]?pt.locale.format(Lt.locale,xn[1],ve[0]):"";if(gr){var Or={range:an===0?"start":"end"};gr(xn,[ma,ia],Or)}var Yr=ci(hi,0,vt,Sn),ga=ci(tr,1,vt,Sn),Wa=xn===null||Yr&&ga;Wa&&(Dn(xn),er&&(!Tt(pt,_e(dn,0),hi)||!Tt(pt,_e(dn,1),tr))&&er(xn,[ma,ia]));var xr=null;an===0&&!vt[1]?xr=1:an===1&&!vt[0]&&(xr=0),xr!==null&&xr!==we&&(!Mr.current[xr]||!_e(xn,xr))&&_e(xn,an)?Ji(xr):Vi(!1,an)}var da=function(an){return Si&&rt.current&&rt.current.onKeyDown?rt.current.onKeyDown(an):(Object(g.a)(!1,"Picker not correct forward KeyDown operation. Please help to fire issue about this."),!1)},aa={formatList:ve,generateConfig:pt,locale:Lt},Gi=Hi(_e(An,0),aa),Qr=Object(H.a)(Gi,2),Jr=Qr[0],Xi=Qr[1],Ui=Hi(_e(An,1),aa),vr=Object(H.a)(Ui,2),ka=vr[0],no=vr[1],oa=function(an,xn){var hi=pt.locale.parse(Lt.locale,an,ve),tr=xn===0?Yi:vi;hi&&!tr(hi)&&(Ti(Fe(An,hi,xn)),Xn(hi,xn))},Ca=Yt({valueTexts:Jr,onTextChange:function(an){return oa(an,0)}}),wa=Object(H.a)(Ca,3),Sa=wa[0],Ma=wa[1],co=wa[2],Ao=Yt({valueTexts:ka,onTextChange:function(an){return oa(an,1)}}),za=Object(H.a)(Ao,3),Oa=za[0],Va=za[1],ya=za[2],Aa=Object(I.useState)(null),ho=Object(H.a)(Aa,2),Ya=ho[0],Ra=ho[1],Da=Object(I.useState)(null),_a=Object(H.a)(Da,2),Lr=_a[0],ha=_a[1],fa=Ri(Sa,{formatList:ve,generateConfig:pt,locale:Lt}),ba=Object(H.a)(fa,3),pa=ba[0],Xa=ba[1],$a=ba[2],Qa=Ri(Oa,{formatList:ve,generateConfig:pt,locale:Lt}),Pa=Object(H.a)(Qa,3),sa=Pa[0],Ea=Pa[1],io=Pa[2],Ro=function(an){ha(Fe(An,an,we)),we===0?Xa(an):Ea(an)},Do=function(){ha(Fe(An,null,we)),we===0?$a():io()},fo=function(an,xn){return{blurToCancel:kr,forwardKeyDown:da,onBlur:Dr,isClickOutside:function(tr){return!k([De.current,Pe.current,ge.current],tr)},onFocus:function(tr){ze(an),Cr&&Cr(tr)},triggerOpen:function(tr){Vi(tr,an)},onSubmit:function(){Nr(An,an),xn()},onCancel:function(){Vi(!1,an),Ti(dn),xn()}}},ro=at(Object(U.a)(Object(U.a)({},fo(0,co)),{},{open:Mn,value:Sa})),po=Object(H.a)(ro,2),jr=po[0],cr=po[1],Sr=cr.focused,dr=cr.typing,Na=at(Object(U.a)(Object(U.a)({},fo(1,ya)),{},{open:or,value:Oa})),mo=Object(H.a)(Na,2),Zr=mo[0],ao=mo[1],oo=ao.focused,so=ao.typing,xa=function(an){!Si&&!he.current.contains(an.target)&&!re.current.contains(an.target)&&(vt[0]?vt[1]||Ji(1):Ji(0))},Ja=function(an){Si&&(Sr||oo)&&!he.current.contains(an.target)&&!re.current.contains(an.target)&&an.preventDefault()},Fa=dn&&dn[0]?pt.locale.format(Lt.locale,dn[0],"YYYYMMDDHHmmss"):"",go=dn&&dn[1]?pt.locale.format(Lt.locale,dn[1],"YYYYMMDDHHmmss"):"";Object(I.useEffect)(function(){Si||(Ti(dn),!Jr.length||Jr[0]===""?Ma(""):Xi!==Sa&&co(),!ka.length||ka[0]===""?Va(""):no!==Oa&&ya())},[Si,Jr,ka]),Object(I.useEffect)(function(){Ti(dn)},[Fa,go]),kn&&(kn.current={focus:function(){he.current&&he.current.focus()},blur:function(){he.current&&he.current.blur(),re.current&&re.current.blur()}});var Za=Object.keys(mn||{}),Fi=Za.map(function(qn){var an=mn[qn],xn=typeof an=="function"?an():an;return{label:qn,onClick:function(){Nr(xn,null),Vi(!1,we)},onMouseEnter:function(){Ra(xn)},onMouseLeave:function(){Ra(null)}}});function mi(){var qn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,an=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},xn=null;Si&&Lr&&Lr[0]&&Lr[1]&&pt.isAfter(Lr[1],Lr[0])&&(xn=Lr);var hi=bn;if(bn&&Object(d.a)(bn)==="object"&&bn.defaultValue){var tr=bn.defaultValue;hi=Object(U.a)(Object(U.a)({},bn),{},{defaultValue:_e(tr,we)||void 0})}var ma=null;return kt&&(ma=function(Or,Yr){return kt(Or,Yr,{range:we?"end":"start"})}),I.createElement(un.Provider,{value:{inRange:!0,panelPosition:qn,rangedValue:Ya||An,hoverRangedValue:xn}},I.createElement(z,Object.assign({},$,an,{dateRender:ma,showTime:hi,mode:jt[we],generateConfig:pt,style:void 0,direction:Kr,disabledDate:we===0?Yi:vi,disabledTime:function(Or){return ln?ln(Or,we===0?"start":"end"):!1},className:R()(Object(D.a)({},"".concat(Me,"-panel-focused"),we===0?!dr:!so)),value:_e(An,we),locale:Lt,tabIndex:-1,onPanelChange:function(Or,Yr){pi(Fe(jt,Yr,we),Fe(An,Or,we));var ga=Or;qn==="right"&&jt[we]===Yr&&(ga=Wt(ga,Yr,pt,-1)),Xn(ga,we)},onOk:null,onSelect:void 0,onChange:void 0,defaultValue:void 0,defaultPickerValue:void 0})))}var ar=0,Fr=0;we&&Pe.current&&ne.current&&De.current&&(ar=Pe.current.offsetWidth+ne.current.offsetWidth,De.current.offsetWidth&&ar>De.current.offsetWidth&&(Fr=ar));var La=Kr==="rtl"?{right:ar}:{left:ar};function la(){var qn,an=O(Me,jt[we],xi),xn=B({prefixCls:Me,components:ca,needConfirmButton:kr,okDisabled:!_e(An,we)||Di&&Di(An[we]),locale:Lt,rangeList:Fi,onOk:function(){_e(An,we)&&(Nr(An,we),ur&&ur(An))}});if(pn!=="time"&&!bn){var hi=ni(we),tr=Wt(hi,pn,pt),ma=jt[we],ia=ma===pn,Or=mi(ia?"left":!1,{pickerValue:hi,onPickerValueChange:function(xr){Xn(xr,we)}}),Yr=mi("right",{pickerValue:tr,onPickerValueChange:function(xr){Xn(Wt(xr,pn,pt,-1),we)}});Kr==="rtl"?qn=I.createElement(I.Fragment,null,Yr,ia&&Or):qn=I.createElement(I.Fragment,null,Or,ia&&Yr)}else qn=mi();var ga=I.createElement(I.Fragment,null,I.createElement("div",{className:"".concat(Me,"-panels")},qn),(an||xn)&&I.createElement("div",{className:"".concat(Me,"-footer")},an,xn));return Yn&&(ga=Yn(ga)),I.createElement("div",{className:"".concat(Me,"-panel-container"),style:{marginLeft:Fr},ref:De,onMouseDown:function(xr){xr.preventDefault()}},ga)}var Ua=I.createElement("div",{className:R()("".concat(Me,"-range-wrapper"),"".concat(Me,"-").concat(pn,"-range-wrapper")),style:{minWidth:Er}},I.createElement("div",{className:"".concat(Me,"-range-arrow"),style:La}),la()),ua;Bn&&(ua=I.createElement("span",{className:"".concat(Me,"-suffix")},Bn));var yr;Un&&(_e(dn,0)&&!vt[0]||_e(dn,1)&&!vt[1])&&(yr=I.createElement("span",{onMouseDown:function(an){an.preventDefault(),an.stopPropagation()},onMouseUp:function(an){an.preventDefault(),an.stopPropagation();var xn=dn;vt[0]||(xn=Fe(xn,null,0)),vt[1]||(xn=Fe(xn,null,1)),Nr(xn,null),Vi(!1,we)},className:"".concat(Me,"-clear")},Li||I.createElement("span",{className:"".concat(Me,"-clear-btn")})));var Ba={size:y(pn,ve[0])},ja=0,Ha=0;Pe.current&&ge.current&&ne.current&&(we===0?Ha=Pe.current.offsetWidth:(ja=ar,Ha=ge.current.offsetWidth));var Hr=Kr==="rtl"?{right:ja}:{left:ja},ki=function(an,xn){var hi=Fe(An,an,we);xn==="submit"||xn!=="key"&&!kr?(Nr(hi,we),we===0?$a():io()):Ti(hi)};return I.createElement(c.Provider,{value:{operationRef:rt,hideHeader:pn==="time",onDateMouseEnter:Ro,onDateMouseLeave:Do,hideRanges:!0,onSelect:ki,open:Si}},I.createElement(Ct,{visible:Si,popupElement:Ua,popupStyle:Ze,prefixCls:Me,dropdownClassName:dt,dropdownAlign:nt,getPopupContainer:Et,transitionName:lt,range:!0,direction:Kr},I.createElement("div",Object.assign({ref:me,className:R()(Me,"".concat(Me,"-range"),ut,(pe={},Object(D.a)(pe,"".concat(Me,"-disabled"),vt[0]&&vt[1]),Object(D.a)(pe,"".concat(Me,"-focused"),we===0?Sr:oo),Object(D.a)(pe,"".concat(Me,"-rtl"),Kr==="rtl"),pe)),style:Ye,onClick:xa,onMouseDown:Ja},Ne($)),I.createElement("div",{className:R()("".concat(Me,"-input"),(Oe={},Object(D.a)(Oe,"".concat(Me,"-input-active"),we===0),Object(D.a)(Oe,"".concat(Me,"-input-placeholder"),!!pa),Oe)),ref:Pe},I.createElement("input",Object.assign({id:$e,disabled:vt[0],readOnly:Gn||!dr,value:pa||Sa,onChange:function(an){Ma(an.target.value)},autoFocus:Nt,placeholder:_e(bt,0)||"",ref:he},jr,Ba,{autoComplete:br}))),I.createElement("div",{className:"".concat(Me,"-range-separator"),ref:ne},cn),I.createElement("div",{className:R()("".concat(Me,"-input"),(Re={},Object(D.a)(Re,"".concat(Me,"-input-active"),we===1),Object(D.a)(Re,"".concat(Me,"-input-placeholder"),!!sa),Re)),ref:ge},I.createElement("input",Object.assign({disabled:vt[1],readOnly:Gn||!so,value:sa||Oa,onChange:function(an){Va(an.target.value)},placeholder:_e(bt,1)||"",ref:re},Zr,Ba,{autoComplete:br}))),I.createElement("div",{className:"".concat(Me,"-active-bar"),style:Object(U.a)(Object(U.a)({},Hr),{},{width:Ha,position:"absolute"})}),ua,yr)))}var di=function($){Object(P.a)(Oe,$);var pe=Object(Y.a)(Oe);function Oe(){var Re;return Object(le.a)(this,Oe),Re=pe.apply(this,arguments),Re.pickerRef=I.createRef(),Re.focus=function(){Re.pickerRef.current&&Re.pickerRef.current.focus()},Re.blur=function(){Re.pickerRef.current&&Re.pickerRef.current.blur()},Re}return Object(Q.a)(Oe,[{key:"render",value:function(){return I.createElement(Qt,Object.assign({},this.props,{pickerRef:this.pickerRef}))}}]),Oe}(I.Component),Fn=di,bi=_t.b=rr},osHv:function(Mt,_t,q){(function(le){le(q("VrN/"))})(function(le){"use strict";var Q=le.Pos;function P(s,a){return s.line-a.line||s.ch-a.ch}var Y="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",D=Y+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",U=new RegExp("<(/?)(["+Y+"]["+D+"]*)","g");function H(s,a,o,f){this.line=a,this.ch=o,this.cm=s,this.text=s.getLine(a),this.min=f?Math.max(f.from,s.firstLine()):s.firstLine(),this.max=f?Math.min(f.to-1,s.lastLine()):s.lastLine()}function I(s,a){var o=s.cm.getTokenTypeAt(Q(s.line,a));return o&&/\btag\b/.test(o)}function F(s){return s.line>=s.max?void 0:(s.ch=0,s.text=s.cm.getLine(++s.line),!0)}function R(s){return s.line<=s.min?void 0:(s.text=s.cm.getLine(--s.line),s.ch=s.text.length,!0)}function g(s){for(;;){var a=s.text.indexOf(">",s.ch);if(a==-1){if(F(s))continue;return}if(!I(s,a+1)){s.ch=a+1;continue}var o=s.text.lastIndexOf("/",a),f=o>-1&&!/\S/.test(s.text.slice(o+1,a));return s.ch=a+1,f?"selfClose":"regular"}}function p(s){for(;;){var a=s.ch?s.text.lastIndexOf("<",s.ch-1):-1;if(a==-1){if(R(s))continue;return}if(!I(s,a+1)){s.ch=a;continue}U.lastIndex=a,s.ch=a;var o=U.exec(s.text);if(o&&o.index==a)return o}}function d(s){for(;;){U.lastIndex=s.ch;var a=U.exec(s.text);if(!a){if(F(s))continue;return}if(!I(s,a.index+1)){s.ch=a.index+1;continue}return s.ch=a.index+a[0].length,a}}function l(s){for(;;){var a=s.ch?s.text.lastIndexOf(">",s.ch-1):-1;if(a==-1){if(R(s))continue;return}if(!I(s,a+1)){s.ch=a;continue}var o=s.text.lastIndexOf("/",a),f=o>-1&&!/\S/.test(s.text.slice(o+1,a));return s.ch=a+1,f?"selfClose":"regular"}}function n(s,a){for(var o=[];;){var f=d(s),L,C=s.line,x=s.ch-(f?f[0].length:0);if(!f||!(L=g(s)))return;if(L=="selfClose")continue;if(f[1]){for(var A=o.length-1;A>=0;--A)if(o[A]==f[2]){o.length=A;break}if(A<0&&(!a||a==f[2]))return{tag:f[2],from:Q(C,x),to:Q(s.line,s.ch)}}else o.push(f[2])}}function c(s,a){for(var o=[];;){var f=l(s);if(!f)return;if(f=="selfClose"){p(s);continue}var L=s.line,C=s.ch,x=p(s);if(!x)return;if(x[1])o.push(x[2]);else{for(var A=o.length-1;A>=0;--A)if(o[A]==x[2]){o.length=A;break}if(A<0&&(!a||a==x[2]))return{tag:x[2],from:Q(s.line,s.ch),to:Q(L,C)}}}}le.registerHelper("fold","xml",function(s,a){for(var o=new H(s,a.line,0);;){var f=d(o);if(!f||o.line!=a.line)return;var L=g(o);if(!L)return;if(!f[1]&&L!="selfClose"){var C=Q(o.line,o.ch),x=n(o,f[2]);return x&&P(x.from,C)>0?{from:C,to:x.from}:null}}}),le.findMatchingTag=function(s,a,o){var f=new H(s,a.line,a.ch,o);if(f.text.indexOf(">")==-1&&f.text.indexOf("<")==-1)return;var L=g(f),C=L&&Q(f.line,f.ch),x=L&&p(f);if(!L||!x||P(f,a)>0)return;var A={from:Q(f.line,f.ch),to:C,tag:x[2]};return L=="selfClose"?{open:A,close:null,at:"open"}:x[1]?{open:c(f,x[2]),close:A,at:"close"}:(f=new H(s,C.line,C.ch,o),{open:A,close:n(f,x[2]),at:"open"})},le.findEnclosingTag=function(s,a,o,f){for(var L=new H(s,a.line,a.ch,o);;){var C=c(L,f);if(!C)break;var x=new H(s,a.line,a.ch,o),A=n(x,C.tag);if(A)return{open:C,close:A}}},le.scanForClosingTag=function(s,a,o,f){var L=new H(s,a.line,a.ch,f?{from:0,to:f}:null);return n(L,o)}})},p5ED:function(Mt,_t,q){"use strict";var le=q("+L6B"),Q=q("2/Rp"),P=q("5Dmo"),Y=q("3S7+"),D=q("k1fw"),U=q("tJVT"),H=q("q1tI"),I=q.n(H),F=q("vHTk"),R=q.n(F),g=q("yEEn"),p=q("ZW9T"),d=q("1vsH");_t.a=function(l){var n=l.name,c=l.data,s=l.theme,a=l.type,o=l.filename,f=l.monacoEditor,L=l.className,C=l.style,x=l.close,A=l.onClose,w=l.hasMask,_=Object(H.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),S=Object(U.a)(_,2),y=S[0],h=S[1],E=Object(H.useState)(""),m=Object(U.a)(E,2),T=m[0],j=m[1],N,K=1024*1024,W=10*K,k=Object(H.useRef)();a==="office"&&(N=Object(d.T)(c).filesize,N>W&&(a="other")),o&&(f.filename=o),Object(H.useEffect)(function(){var J,oe,fe=(J=document.cookie)===null||J===void 0||((oe=J.replace(/\s/g,""))===null||oe===void 0)?void 0:oe.split(";");fe==null||fe.map(function(Ne){var _e=Ne.split("=");_e[0]==="_educoder_session"&&j(_e[1])})},[]);var b=function(){if(c.startsWith("http")||c.startsWith("/")){G();return}Object(d.z)(o||"educoder",c,o)},G=function(){Object(d.x)(o||n,c)};return console.log("data:",c,"fileanme:",o," name:",n),I.a.createElement("div",{style:Object(D.a)({},C||{}),className:"".concat(w&&R.a.bgBlack," ").concat(a?R.a.wrp:"hide")},x&&I.a.createElement("div",{className:R.a.close,ref:k},I.a.createElement(Y.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return k.current}},I.a.createElement("span",{onClick:G},I.a.createElement("i",{className:"icon-quxiaozhiding"}))),I.a.createElement(Y.a,{title:"\u5173\u95ED",getPopupContainer:function(){return k.current}},I.a.createElement("span",{className:"",onClick:A},I.a.createElement("i",{className:"icon-guanbi1"})))),I.a.createElement("div",{className:"".concat(R.a[L]," ").concat(L," ").concat(R.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&I.a.createElement(p.b,f)),a==="audio"&&I.a.createElement("audio",{src:"".concat(c!=null&&c.startsWith("/")||(c==null?void 0:c.indexOf("https://"))>-1?c:"data:audio/mp3;base64,").concat(c),autoPlay:!0}),a==="video"&&I.a.createElement(I.a.Fragment,null,c!=null&&c.startsWith("/")?I.a.createElement("video",{controls:!0,src:"".concat(c),autoPlay:!0}):I.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(c),autoPlay:!0})),a==="html"&&I.a.createElement("iframe",{src:c+"&disposition=inline"}),a==="pdf"&&I.a.createElement("embed",{className:R.a.embed,src:c}),a==="image"&&I.a.createElement(I.a.Fragment,null,I.a.createElement("img",{src:"".concat(c!=null&&c.startsWith("/")||(c==null?void 0:c.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(c)})),a==="other"&&I.a.createElement("div",null,I.a.createElement(Q.a,{type:"primary",size:"large",onClick:b},I.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&I.a.createElement(Q.a,{type:"primary",size:"large",onClick:b},I.a.createElement(g.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(Mt,_t,q){},psGv:function(Mt,_t,q){var le,Q;(function(){var P;(function(){"use strict";var H=[,,function(g){function p(n){this.__parent=n,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}p.prototype.clone_empty=function(){var n=new p(this.__parent);return n.set_indent(this.__indent_count,this.__alignment_count),n},p.prototype.item=function(n){return n<0?this.__items[this.__items.length+n]:this.__items[n]},p.prototype.has_match=function(n){for(var c=this.__items.length-1;c>=0;c--)if(this.__items[c].match(n))return!0;return!1},p.prototype.set_indent=function(n,c){this.is_empty()&&(this.__indent_count=n||0,this.__alignment_count=c||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},p.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},p.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},p.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var n=this.__parent.current_line;return n.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),n.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),n.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,n.__items[0]===" "&&(n.__items.splice(0,1),n.__character_count-=1),!0}return!1},p.prototype.is_empty=function(){return this.__items.length===0},p.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},p.prototype.push=function(n){this.__items.push(n);var c=n.lastIndexOf(`
|
|
`);c!==-1?this.__character_count=n.length-c:this.__character_count+=n.length},p.prototype.pop=function(){var n=null;return this.is_empty()||(n=this.__items.pop(),this.__character_count-=n.length),n},p.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},p.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},p.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},p.prototype.toString=function(){var n="";return this.is_empty()?this.__parent.indent_empty_lines&&(n=this.__parent.get_indent_string(this.__indent_count)):(n=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),n+=this.__items.join("")),n};function d(n,c){this.__cache=[""],this.__indent_size=n.indent_size,this.__indent_string=n.indent_char,n.indent_with_tabs||(this.__indent_string=new Array(n.indent_size+1).join(n.indent_char)),c=c||"",n.indent_level>0&&(c=new Array(n.indent_level+1).join(this.__indent_string)),this.__base_string=c,this.__base_string_length=c.length}d.prototype.get_indent_size=function(n,c){var s=this.__base_string_length;return c=c||0,n<0&&(s=0),s+=n*this.__indent_size,s+=c,s},d.prototype.get_indent_string=function(n,c){var s=this.__base_string;return c=c||0,n<0&&(n=0,s=""),c+=n*this.__indent_size,this.__ensure_cache(c),s+=this.__cache[c],s},d.prototype.__ensure_cache=function(n){for(;n>=this.__cache.length;)this.__add_column()},d.prototype.__add_column=function(){var n=this.__cache.length,c=0,s="";this.__indent_size&&n>=this.__indent_size&&(c=Math.floor(n/this.__indent_size),n-=c*this.__indent_size,s=new Array(c+1).join(this.__indent_string)),n&&(s+=new Array(n+1).join(" ")),this.__cache.push(s)};function l(n,c){this.__indent_cache=new d(n,c),this.raw=!1,this._end_with_newline=n.end_with_newline,this.indent_size=n.indent_size,this.wrap_line_length=n.wrap_line_length,this.indent_empty_lines=n.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new p(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}l.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},l.prototype.get_line_number=function(){return this.__lines.length},l.prototype.get_indent_string=function(n,c){return this.__indent_cache.get_indent_string(n,c)},l.prototype.get_indent_size=function(n,c){return this.__indent_cache.get_indent_size(n,c)},l.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},l.prototype.add_new_line=function(n){return this.is_empty()||!n&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},l.prototype.get_code=function(n){this.trim(!0);var c=this.current_line.pop();c&&(c[c.length-1]===`
|
|
`&&(c=c.replace(/\n+$/g,"")),this.current_line.push(c)),this._end_with_newline&&this.__add_outputline();var s=this.__lines.join(`
|
|
`);return n!==`
|
|
`&&(s=s.replace(/[\n]/g,n)),s},l.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},l.prototype.set_indent=function(n,c){return n=n||0,c=c||0,this.next_line.set_indent(n,c),this.__lines.length>1?(this.current_line.set_indent(n,c),!0):(this.current_line.set_indent(),!1)},l.prototype.add_raw_token=function(n){for(var c=0;c<n.newlines;c++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(n.whitespace_before),this.current_line.push(n.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},l.prototype.add_token=function(n){this.__add_space_before_token(),this.current_line.push(n),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},l.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},l.prototype.remove_indent=function(n){for(var c=this.__lines.length;n<c;)this.__lines[n]._remove_indent(),n++;this.current_line._remove_wrap_indent()},l.prototype.trim=function(n){for(n=n===void 0?!1:n,this.current_line.trim();n&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},l.prototype.just_added_newline=function(){return this.current_line.is_empty()},l.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},l.prototype.ensure_empty_line_above=function(n,c){for(var s=this.__lines.length-2;s>=0;){var a=this.__lines[s];if(a.is_empty())break;if(a.item(0).indexOf(n)!==0&&a.item(-1)!==c){this.__lines.splice(s+1,0,new p(this)),this.previous_line=this.__lines[this.__lines.length-2];break}s--}},g.exports.Output=l},function(g){function p(d,l,n,c){this.type=d,this.text=l,this.comments_before=null,this.newlines=n||0,this.whitespace_before=c||"",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(n,c){this.raw_options=d(n,c),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}p.prototype._get_array=function(n,c){var s=this.raw_options[n],a=c||[];return typeof s=="object"?s!==null&&typeof s.concat=="function"&&(a=s.concat()):typeof s=="string"&&(a=s.split(/[^a-zA-Z0-9_\/\-]+/)),a},p.prototype._get_boolean=function(n,c){var s=this.raw_options[n],a=s===void 0?!!c:!!s;return a},p.prototype._get_characters=function(n,c){var s=this.raw_options[n],a=c||"";return typeof s=="string"&&(a=s.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),a},p.prototype._get_number=function(n,c){var s=this.raw_options[n];c=parseInt(c,10),isNaN(c)&&(c=0);var a=parseInt(s,10);return isNaN(a)&&(a=c),a},p.prototype._get_selection=function(n,c,s){var a=this._get_selection_list(n,c,s);if(a.length!==1)throw new Error("Invalid Option Value: The option '"+n+`' can only be one of the following values:
|
|
`+c+`
|
|
You passed in: '`+this.raw_options[n]+"'");return a[0]},p.prototype._get_selection_list=function(n,c,s){if(!c||c.length===0)throw new Error("Selection list cannot be empty.");if(s=s||[c[0]],!this._is_valid_selection(s,c))throw new Error("Invalid Default Value!");var a=this._get_array(n,s);if(!this._is_valid_selection(a,c))throw new Error("Invalid Option Value: The option '"+n+`' can contain only the following values:
|
|
`+c+`
|
|
You passed in: '`+this.raw_options[n]+"'");return a},p.prototype._is_valid_selection=function(n,c){return n.length&&c.length&&!n.some(function(s){return c.indexOf(s)===-1})};function d(n,c){var s={};n=l(n);var a;for(a in n)a!==c&&(s[a]=n[a]);if(c&&n[c])for(a in n[c])s[a]=n[c][a];return s}function l(n){var c={},s;for(s in n){var a=s.replace(/-/g,"_");c[a]=n[s]}return c}g.exports.Options=p,g.exports.normalizeOpts=l,g.exports.mergeOpts=d},,function(g){var p=RegExp.prototype.hasOwnProperty("sticky");function d(l){this.__input=l||"",this.__input_length=this.__input.length,this.__position=0}d.prototype.restart=function(){this.__position=0},d.prototype.back=function(){this.__position>0&&(this.__position-=1)},d.prototype.hasNext=function(){return this.__position<this.__input_length},d.prototype.next=function(){var l=null;return this.hasNext()&&(l=this.__input.charAt(this.__position),this.__position+=1),l},d.prototype.peek=function(l){var n=null;return l=l||0,l+=this.__position,l>=0&&l<this.__input_length&&(n=this.__input.charAt(l)),n},d.prototype.__match=function(l,n){l.lastIndex=n;var c=l.exec(this.__input);return c&&!(p&&l.sticky)&&(c.index!==n&&(c=null)),c},d.prototype.test=function(l,n){return n=n||0,n+=this.__position,n>=0&&n<this.__input_length?!!this.__match(l,n):!1},d.prototype.testChar=function(l,n){var c=this.peek(n);return l.lastIndex=0,c!==null&&l.test(c)},d.prototype.match=function(l){var n=this.__match(l,this.__position);return n?this.__position+=n[0].length:n=null,n},d.prototype.read=function(l,n,c){var s="",a;return l&&(a=this.match(l),a&&(s+=a[0])),n&&(a||!l)&&(s+=this.readUntil(n,c)),s},d.prototype.readUntil=function(l,n){var c="",s=this.__position;l.lastIndex=this.__position;var a=l.exec(this.__input);return a?(s=a.index,n&&(s+=a[0].length)):s=this.__input_length,c=this.__input.substring(this.__position,s),this.__position=s,c},d.prototype.readUntilAfter=function(l){return this.readUntil(l,!0)},d.prototype.get_regexp=function(l,n){var c=null,s="g";return n&&p&&(s="y"),typeof l=="string"&&l!==""?c=new RegExp(l,s):l&&(c=new RegExp(l.source,s)),c},d.prototype.get_literal_regexp=function(l){return RegExp(l.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},d.prototype.peekUntilAfter=function(l){var n=this.__position,c=this.readUntilAfter(l);return this.__position=n,c},d.prototype.lookBack=function(l){var n=this.__position-1;return n>=l.length&&this.__input.substring(n-l.length,n).toLowerCase()===l},g.exports.InputScanner=d},function(g,p,d){var l=d(8).InputScanner,n=d(3).Token,c=d(10).TokenStream,s=d(11).WhitespacePattern,a={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},o=function(f,L){this._input=new l(f),this._options=L||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new s(this._input)};o.prototype.tokenize=function(){this._input.restart(),this.__tokens=new c,this._reset();for(var f,L=new n(a.START,""),C=null,x=[],A=new c;L.type!==a.EOF;){for(f=this._get_next_token(L,C);this._is_comment(f);)A.add(f),f=this._get_next_token(L,C);A.isEmpty()||(f.comments_before=A,A=new c),f.parent=C,this._is_opening(f)?(x.push(C),C=f):C&&this._is_closing(f,C)&&(f.opened=C,C.closed=f,C=x.pop(),f.parent=C),f.previous=L,L.next=f,this.__tokens.add(f),L=f}return this.__tokens},o.prototype._is_first_token=function(){return this.__tokens.isEmpty()},o.prototype._reset=function(){},o.prototype._get_next_token=function(f,L){this._readWhitespace();var C=this._input.read(/.+/g);return C?this._create_token(a.RAW,C):this._create_token(a.EOF,"")},o.prototype._is_comment=function(f){return!1},o.prototype._is_opening=function(f){return!1},o.prototype._is_closing=function(f,L){return!1},o.prototype._create_token=function(f,L){var C=new n(f,L,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return C},o.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},g.exports.Tokenizer=o,g.exports.TOKEN=a},function(g){function p(d){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=d}p.prototype.restart=function(){this.__position=0},p.prototype.isEmpty=function(){return this.__tokens_length===0},p.prototype.hasNext=function(){return this.__position<this.__tokens_length},p.prototype.next=function(){var d=null;return this.hasNext()&&(d=this.__tokens[this.__position],this.__position+=1),d},p.prototype.peek=function(d){var l=null;return d=d||0,d+=this.__position,d>=0&&d<this.__tokens_length&&(l=this.__tokens[d]),l},p.prototype.add=function(d){this.__parent_token&&(d.parent=this.__parent_token),this.__tokens.push(d),this.__tokens_length+=1},g.exports.TokenStream=p},function(g,p,d){var l=d(12).Pattern;function n(c,s){l.call(this,c,s),s?this._line_regexp=this._input.get_regexp(s._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}n.prototype=new l,n.prototype.__set_whitespace_patterns=function(c,s){c+="\\t ",s+="\\n\\r",this._match_pattern=this._input.get_regexp("["+c+s+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+s+"]")},n.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var c=this._input.read(this._match_pattern);if(c===" ")this.whitespace_before_token=" ";else if(c){var s=this.__split(this._newline_regexp,c);this.newline_count=s.length-1,this.whitespace_before_token=s[this.newline_count]}return c},n.prototype.matching=function(c,s){var a=this._create();return a.__set_whitespace_patterns(c,s),a._update(),a},n.prototype._create=function(){return new n(this._input,this)},n.prototype.__split=function(c,s){c.lastIndex=0;for(var a=0,o=[],f=c.exec(s);f;)o.push(s.substring(a,f.index)),a=f.index+f[0].length,f=c.exec(s);return a<s.length?o.push(s.substring(a,s.length)):o.push(""),o},g.exports.WhitespacePattern=n},function(g){function p(d,l){this._input=d,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,l&&(this._starting_pattern=this._input.get_regexp(l._starting_pattern,!0),this._match_pattern=this._input.get_regexp(l._match_pattern,!0),this._until_pattern=this._input.get_regexp(l._until_pattern),this._until_after=l._until_after)}p.prototype.read=function(){var d=this._input.read(this._starting_pattern);return(!this._starting_pattern||d)&&(d+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),d},p.prototype.read_match=function(){return this._input.match(this._match_pattern)},p.prototype.until_after=function(d){var l=this._create();return l._until_after=!0,l._until_pattern=this._input.get_regexp(d),l._update(),l},p.prototype.until=function(d){var l=this._create();return l._until_after=!1,l._until_pattern=this._input.get_regexp(d),l._update(),l},p.prototype.starting_with=function(d){var l=this._create();return l._starting_pattern=this._input.get_regexp(d,!0),l._update(),l},p.prototype.matching=function(d){var l=this._create();return l._match_pattern=this._input.get_regexp(d,!0),l._update(),l},p.prototype._create=function(){return new p(this._input,this)},p.prototype._update=function(){},g.exports.Pattern=p},function(g){function p(d,l){d=typeof d=="string"?d:d.source,l=typeof l=="string"?l:l.source,this.__directives_block_pattern=new RegExp(d+/ beautify( \w+[:]\w+)+ /.source+l,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(d+/\sbeautify\signore:end\s/.source+l,"g")}p.prototype.get_directives=function(d){if(!d.match(this.__directives_block_pattern))return null;var l={};this.__directive_pattern.lastIndex=0;for(var n=this.__directive_pattern.exec(d);n;)l[n[1]]=n[2],n=this.__directive_pattern.exec(d);return l},p.prototype.readIgnored=function(d){return d.readUntilAfter(this.__directives_end_ignore_pattern)},g.exports.Directives=p},function(g,p,d){var l=d(12).Pattern,n={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function c(s,a){l.call(this,s,a),this.__template_pattern=null,this._disabled=Object.assign({},n),this._excluded=Object.assign({},n),a&&(this.__template_pattern=this._input.get_regexp(a.__template_pattern),this._excluded=Object.assign(this._excluded,a._excluded),this._disabled=Object.assign(this._disabled,a._disabled));var o=new l(s);this.__patterns={handlebars_comment:o.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:o.starting_with(/{{{/).until_after(/}}}/),handlebars:o.starting_with(/{{/).until_after(/}}/),php:o.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),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}/)}}c.prototype=new l,c.prototype._create=function(){return new c(this._input,this)},c.prototype._update=function(){this.__set_templated_pattern()},c.prototype.disable=function(s){var a=this._create();return a._disabled[s]=!0,a._update(),a},c.prototype.read_options=function(s){var a=this._create();for(var o in n)a._disabled[o]=s.templating.indexOf(o)===-1;return a._update(),a},c.prototype.exclude=function(s){var a=this._create();return a._excluded[s]=!0,a._update(),a},c.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 a=this._read_template();a;)this._match_pattern?a+=this._input.read(this._match_pattern):a+=this._input.readUntil(this.__template_pattern),s+=a,a=this._read_template();return this._until_after&&(s+=this._input.readUntilAfter(this._until_pattern)),s},c.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("|")+")")},c.prototype._read_template=function(){var s="",a=this._input.peek();if(a==="<"){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 a==="{"&&(!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},g.exports.TemplatablePattern=c},,,,function(g,p,d){var l=d(19).Beautifier,n=d(20).Options;function c(s,a,o,f){var L=new l(s,a,o,f);return L.beautify()}g.exports=c,g.exports.defaultOptions=function(){return new n}},function(g,p,d){var l=d(20).Options,n=d(2).Output,c=d(21).Tokenizer,s=d(21).TOKEN,a=/\r\n|[\r\n]/,o=/\r\n|[\r\n]/g,f=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 n(E,m)};f.prototype.current_line_has_match=function(E){return this._output.current_line.has_match(E)},f.prototype.set_space_before_token=function(E,m){this._output.space_before_token=E,this._output.non_breaking_space=m},f.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},f.prototype.add_raw_token=function(E){this._output.add_raw_token(E)},f.prototype.print_preserved_newlines=function(E){var m=0;E.type!==s.TEXT&&E.previous.type!==s.TEXT&&(m=E.newlines?1:0),this.preserve_newlines&&(m=E.newlines<this.max_preserve_newlines+1?E.newlines:this.max_preserve_newlines+1);for(var T=0;T<m;T++)this.print_newline(T>0);return m!==0},f.prototype.traverse_whitespace=function(E){return E.whitespace_before||E.newlines?(this.print_preserved_newlines(E)||(this._output.space_before_token=!0),!0):!1},f.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},f.prototype.print_newline=function(E){this._output.add_new_line(E)},f.prototype.print_token=function(E){E.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(E.text))},f.prototype.indent=function(){this.indent_level++},f.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,T=E.next;T.type!==s.EOF&&E.closed!==T;){if(T.type===s.ATTRIBUTE&&T.text==="type"){T.next&&T.next.type===s.EQUALS&&T.next.next&&T.next.next.type===s.VALUE&&(m=T.next.next.text);break}T=T.next}return m},C=function(E,m){var T=null,j=null;return m.closed?(E==="script"?T="text/javascript":E==="style"&&(T="text/css"),T=L(m)||T,T.search("text/css")>-1?j="css":T.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?j="javascript":T.search(/(text|application|dojo)\/(x-)?(html)/)>-1?j="html":T.search(/test\/null/)>-1&&(j="null"),j):null};function x(E,m){return m.indexOf(E)!==-1}function A(E,m,T){this.parent=E||null,this.tag=m?m.tag_name:"",this.indent_level=T||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 A(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 T=this._current_frame;T&&!(E.indexOf(T.tag)!==-1);){if(m&&m.indexOf(T.tag)!==-1){T=null;break}T=T.parent}return T},w.prototype.try_pop=function(E,m){var T=this._get_frame([E],m);return this._try_pop_frame(T)},w.prototype.indent_to_tag=function(E){var m=this._get_frame(E);m&&(this._printer.indent_level=m.indent_level)};function _(E,m,T,j){this._source_text=E||"",m=m||{},this._js_beautify=T,this._css_beautify=j,this._tag_stack=null;var N=new l(m,"html");this._options=N,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"}_.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&&a.test(E)&&(m=E.match(a)[0])),E=E.replace(o,`
|
|
`);var T=E.match(/^[\t ]*/)[0],j={text:"",type:""},N=new S,K=new f(this._options,T),W=new c(E,this._options).tokenize();this._tag_stack=new w(K);for(var k=null,b=W.next();b.type!==s.EOF;)b.type===s.TAG_OPEN||b.type===s.COMMENT?(k=this._handle_tag_open(K,b,N,j),N=k):b.type===s.ATTRIBUTE||b.type===s.EQUALS||b.type===s.VALUE||b.type===s.TEXT&&!N.tag_complete?k=this._handle_inside_tag(K,b,N,W):b.type===s.TAG_CLOSE?k=this._handle_tag_close(K,b,N):b.type===s.TEXT?k=this._handle_text(K,b,N):K.add_raw_token(b),j=k,b=W.next();var G=K._output.get_code(m);return G},_.prototype._handle_tag_close=function(E,m,T){var j={text:m.text,type:m.type};return E.alignment_size=0,T.tag_complete=!0,E.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),T.is_unformatted?E.add_raw_token(m):(T.tag_start_char==="<"&&(E.set_space_before_token(m.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&T.has_wrapped_attrs&&E.print_newline(!1)),E.print_token(m)),T.indent_content&&!(T.is_unformatted||T.is_content_unformatted)&&(E.indent(),T.indent_content=!1),!T.is_inline_element&&!(T.is_unformatted||T.is_content_unformatted)&&E.set_wrap_point(),j},_.prototype._handle_inside_tag=function(E,m,T,j){var N=T.has_wrapped_attrs,K={text:m.text,type:m.type};if(E.set_space_before_token(m.newlines||m.whitespace_before!=="",!0),T.is_unformatted)E.add_raw_token(m);else if(T.tag_start_char==="{"&&m.type===s.TEXT)E.print_preserved_newlines(m)?(m.newlines=0,E.add_raw_token(m)):E.print_token(m);else{if(m.type===s.ATTRIBUTE?(E.set_space_before_token(!0),T.attr_count+=1):(m.type===s.EQUALS||m.type===s.VALUE&&m.previous.type===s.EQUALS)&&E.set_space_before_token(!1),m.type===s.ATTRIBUTE&&T.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(E.traverse_whitespace(m),N=N||m.newlines!==0),this._is_wrap_attributes_force)){var W=T.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&T.attr_count===1){var k=!0,b=0,G;do{if(G=j.peek(b),G.type===s.ATTRIBUTE){k=!1;break}b+=1}while(b<4&&G.type!==s.EOF&&G.type!==s.TAG_CLOSE);W=!k}W&&(E.print_newline(!1),N=!0)}E.print_token(m),N=N||E.previous_token_wrapped(),T.has_wrapped_attrs=N}return K},_.prototype._handle_text=function(E,m,T){var j={text:m.text,type:"TK_CONTENT"};return T.custom_beautifier_name?this._print_custom_beatifier_text(E,m,T):T.is_unformatted||T.is_content_unformatted?E.add_raw_token(m):(E.traverse_whitespace(m),E.print_token(m)),j},_.prototype._print_custom_beatifier_text=function(E,m,T){var j=this;if(m.text!==""){var N=m.text,K,W=1,k="",b="";T.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?K=this._js_beautify:T.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?K=this._css_beautify:T.custom_beautifier_name==="html"&&(K=function(_e,Fe){var We=new _(_e,Fe,j._js_beautify,j._css_beautify);return We.beautify()}),this._options.indent_scripts==="keep"?W=0:this._options.indent_scripts==="separate"&&(W=-E.indent_level);var G=E.get_full_indent(W);if(N=N.replace(/\n[ \t]*$/,""),T.custom_beautifier_name!=="html"&&N[0]==="<"&&N.match(/^(<!--|<!\[CDATA\[)/)){var J=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(N);if(!J){E.add_raw_token(m);return}k=G+J[1]+`
|
|
`,N=J[4],J[5]&&(b=G+J[5]),N=N.replace(/\n[ \t]*$/,""),(J[2]||J[3].indexOf(`
|
|
`)!==-1)&&(J=J[3].match(/[ \t]+$/),J&&(m.whitespace_before=J[0]))}if(N)if(K){var oe=function(){this.eol=`
|
|
`};oe.prototype=this._options.raw_options;var fe=new oe;N=K(G+N,fe)}else{var Ne=m.whitespace_before;Ne&&(N=N.replace(new RegExp(`
|
|
(`+Ne+")?","g"),`
|
|
`)),N=G+N.replace(/\n/g,`
|
|
`+G)}k&&(N?N=k+N+`
|
|
`+b:N=k+b),E.print_newline(!1),N&&(m.text=N,m.whitespace_before="",m.newlines=0,E.add_raw_token(m),E.print_newline(!0))}},_.prototype._handle_tag_open=function(E,m,T,j){var N=this._get_tag_open_token(m);return(T.is_unformatted||T.is_content_unformatted)&&!T.is_empty_element&&m.type===s.TAG_OPEN&&m.text.indexOf("</")===0?(E.add_raw_token(m),N.start_tag_token=this._tag_stack.try_pop(N.tag_name)):(E.traverse_whitespace(m),this._set_tag_position(E,m,N,T,j),N.is_inline_element||E.set_wrap_point(),E.print_token(m)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(N.alignment_size=m.text.length+1),!N.tag_complete&&!N.is_unformatted&&(E.alignment_size=N.alignment_size),N};var S=function(E,m){if(this.parent=E||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!m)this.tag_complete=!0;else{var T;this.tag_start_char=m.text[0],this.text=m.text,this.tag_start_char==="<"?(T=m.text.match(/^<([^\s>]*)/),this.tag_check=T?T[1]:""):(T=m.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=T?T[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===s.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||m.closed&&m.closed.text==="/>";var j=2;this.tag_start_char==="{"&&this.text.length>=3&&(this.text.charAt(2)==="~"&&(j=3)),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(j)))}};_.prototype._get_tag_open_token=function(E){var m=new S(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},_.prototype._set_tag_position=function(E,m,T,j,N){if(T.is_empty_element||(T.is_end_tag?T.start_tag_token=this._tag_stack.try_pop(T.tag_name):(this._do_optional_end_element(T)&&(T.is_inline_element||E.print_newline(!1)),this._tag_stack.record_tag(T),(T.tag_name==="script"||T.tag_name==="style")&&!(T.is_unformatted||T.is_content_unformatted)&&(T.custom_beautifier_name=C(T.tag_check,m)))),x(T.tag_check,this._options.extra_liners)&&(E.print_newline(!1),E._output.just_added_blankline()||E.print_newline(!0)),T.is_empty_element){if(T.tag_start_char==="{"&&T.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),T.indent_content=!0;var K=E.current_line_has_match(/{{#if/);K||E.print_newline(!1)}T.tag_name==="!--"&&N.type===s.TAG_CLOSE&&j.is_end_tag&&T.text.indexOf(`
|
|
`)===-1||(T.is_inline_element||T.is_unformatted||E.print_newline(!1),this._calcluate_parent_multiline(E,T))}else if(T.is_end_tag){var W=!1;W=T.start_tag_token&&T.start_tag_token.multiline_content,W=W||!T.is_inline_element&&!(j.is_inline_element||j.is_unformatted)&&!(N.type===s.TAG_CLOSE&&T.start_tag_token===j)&&N.type!=="TK_CONTENT",(T.is_content_unformatted||T.is_unformatted)&&(W=!1),W&&E.print_newline(!1)}else T.indent_content=!T.custom_beautifier_name,T.tag_start_char==="<"&&(T.tag_name==="html"?T.indent_content=this._options.indent_inner_html:T.tag_name==="head"?T.indent_content=this._options.indent_head_inner_html:T.tag_name==="body"&&(T.indent_content=this._options.indent_body_inner_html)),!(T.is_inline_element||T.is_unformatted)&&(N.type!=="TK_CONTENT"||T.is_content_unformatted)&&E.print_newline(!1),this._calcluate_parent_multiline(E,T)},_.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 y=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],h=["a","audio","del","ins","map","noscript","video"];_.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"&&y.indexOf(E.tag_name)!==-1){var T=E.parent.parent;(!T||h.indexOf(T.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=_},function(g,p,d){var l=d(6).Options;function n(c){l.call(this,c,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}n.prototype=new l,g.exports.Options=n},function(g,p,d){var l=d(9).Tokenizer,n=d(9).TOKEN,c=d(13).Directives,s=d(14).TemplatablePattern,a=d(12).Pattern,o={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:n.START,RAW:n.RAW,EOF:n.EOF},f=new c(/<\!--/,/-->/),L=function(C,x){l.call(this,C,x),this._current_tag_name="";var A=new s(this._input).read_options(this._options),w=new a(this._input);if(this.__patterns={word:A.until(/[\n\r\t <]/),single_quote:A.until_after(/'/),double_quote:A.until_after(/"/),attribute:A.until(/[\n\r\t =>]|\/>/),element_name:A.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(/<!--/).until_after(/-->/),cdata:w.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:w.starting_with(/<!\[/).until_after(/]>/),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 _=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=w.matching(_).until_after(_)}};L.prototype=new l,L.prototype._is_comment=function(C){return!1},L.prototype._is_opening=function(C){return C.type===o.TAG_OPEN},L.prototype._is_closing=function(C,x){return C.type===o.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 A=null;this._readWhitespace();var w=this._input.peek();return w===null?this._create_token(o.EOF,""):(A=A||this._read_open_handlebars(w,x),A=A||this._read_attribute(w,C,x),A=A||this._read_close(w,x),A=A||this._read_raw_content(w,C,x),A=A||this._read_content_word(w),A=A||this._read_comment_or_cdata(w),A=A||this._read_processing(w),A=A||this._read_open(w,x),A=A||this._create_token(o.UNKNOWN,this._input.next()),A)},L.prototype._read_comment_or_cdata=function(C){var x=null,A=null,w=null;if(C==="<"){var _=this._input.peek(1);_==="!"&&(A=this.__patterns.comment.read(),A?(w=f.get_directives(A),w&&w.ignore==="start"&&(A+=f.readIgnored(this._input))):A=this.__patterns.cdata.read()),A&&(x=this._create_token(o.COMMENT,A),x.directives=w)}return x},L.prototype._read_processing=function(C){var x=null,A=null,w=null;if(C==="<"){var _=this._input.peek(1);(_==="!"||_==="?")&&(A=this.__patterns.conditional_comment.read(),A=A||this.__patterns.processing.read()),A&&(x=this._create_token(o.COMMENT,A),x.directives=w)}return x},L.prototype._read_open=function(C,x){var A=null,w=null;return x||C==="<"&&(A=this._input.next(),this._input.peek()==="/"&&(A+=this._input.next()),A+=this.__patterns.element_name.read(),w=this._create_token(o.TAG_OPEN,A)),w},L.prototype._read_open_handlebars=function(C,x){var A=null,w=null;return x||this._options.indent_handlebars&&C==="{"&&this._input.peek(1)==="{"&&(this._input.peek(2)==="!"?(A=this.__patterns.handlebars_comment.read(),A=A||this.__patterns.handlebars.read(),w=this._create_token(o.COMMENT,A)):(A=this.__patterns.handlebars_open.read(),w=this._create_token(o.TAG_OPEN,A))),w},L.prototype._read_close=function(C,x){var A=null,w=null;return x&&(x.text[0]==="<"&&(C===">"||C==="/"&&this._input.peek(1)===">")?(A=this._input.next(),C==="/"&&(A+=this._input.next()),w=this._create_token(o.TAG_CLOSE,A)):x.text[0]==="{"&&C==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),w=this._create_token(o.TAG_CLOSE,"}}"))),w},L.prototype._read_attribute=function(C,x,A){var w=null,_="";if(A&&A.text[0]==="<")if(C==="=")w=this._create_token(o.EQUALS,this._input.next());else if(C==='"'||C==="'"){var S=this._input.next();C==='"'?S+=this.__patterns.double_quote.read():S+=this.__patterns.single_quote.read(),w=this._create_token(o.VALUE,S)}else _=this.__patterns.attribute.read(),_&&(x.type===o.EQUALS?w=this._create_token(o.VALUE,_):w=this._create_token(o.ATTRIBUTE,_));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,A){var w="";if(A&&A.text[0]==="{")w=this.__patterns.handlebars_raw_close.read();else if(x.type===o.TAG_CLOSE&&x.opened.text[0]==="<"&&x.text[0]!=="/"){var _=x.opened.text.substr(1).toLowerCase();if(_==="script"||_==="style"){var S=this._read_comment_or_cdata(C);if(S)return S.type=o.TEXT,S;w=this._input.readUntil(new RegExp("</"+_+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(_)&&(w=this._input.readUntil(new RegExp("</"+_+"[\\n\\r\\t ]*?>","ig")))}return w?this._create_token(o.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(o.TEXT,x)},g.exports.Tokenizer=L,g.exports.TOKEN=o}],I={};function F(g){var p=I[g];if(p!==void 0)return p.exports;var d=I[g]={exports:{}};return H[g](d,d.exports,F),d.exports}var R=F(18);P=R})();var Y=P;if(!0)!(le=[q,q("6UM0"),q("TXwP")],Q=function(H){var I=q("6UM0"),F=q("TXwP");return{html_beautify:function(R,g){return Y(R,g,I.js_beautify,F.css_beautify)}}}.apply(_t,le),Q!==void 0&&(Mt.exports=Q));else var D,U})()},qB8g:function(Mt,_t,q){Mt.exports={flexRow:"flexRow___Aj71W",flexColumn:"flexColumn___2jvSr",formWrap:"formWrap___3OxLN",upload:"upload___2lUf4",color0152d9:"color0152d9___10ICR",colorCCC:"colorCCC___2mbRd",footerWrap:"footerWrap___1Ytvb",qrCode:"qrCode___2RFKG",a1:"a1___HdrHw",code:"code___17cwA",group:"group___DUj4t",groupNumber:"groupNumber___3_2zt",a2:"a2___2_e5C"}},"rAM+":function(Mt,_t,q){"use strict";q.d(_t,"a",function(){return Q});var le=q("Qw5x");function Q(P,Y){var D;if(typeof Symbol=="undefined"||P[Symbol.iterator]==null){if(Array.isArray(P)||(D=Object(le.a)(P))||Y&&P&&typeof P.length=="number"){D&&(P=D);var U=0,H=function(){};return{s:H,n:function(){return U>=P.length?{done:!0}:{done:!1,value:P[U++]}},e:function(p){throw p},f:H}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var I=!0,F=!1,R;return{s:function(){D=P[Symbol.iterator]()},n:function(){var p=D.next();return I=p.done,p},e:function(p){F=!0,R=p},f:function(){try{!I&&D.return!=null&&D.return()}finally{if(F)throw R}}}}},rUJ1:function(Mt,_t){const q=/[&<>"']/,le=/[&<>"']/g,Q=/[<>"']|&(?!#?\w+;)/,P=/[<>"']|&(?!#?\w+;)/g,Y={"&":"&","<":"<",">":">",'"':""","'":"'"},D=w=>Y[w];function U(w,_){if(_){if(q.test(w))return w.replace(le,D)}else if(Q.test(w))return w.replace(P,D);return w}const H=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function I(w){return w.replace(H,(_,S)=>(S=S.toLowerCase(),S==="colon"?":":S.charAt(0)==="#"?S.charAt(1)==="x"?String.fromCharCode(parseInt(S.substring(2),16)):String.fromCharCode(+S.substring(1)):""))}const F=/(^|[^\[])\^/g;function R(w,_){w=w.source||w,_=_||"";const S={replace:(y,h)=>(h=h.source||h,h=h.replace(F,"$1"),w=w.replace(y,h),S),getRegex:()=>new RegExp(w,_)};return S}const g=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function d(w,_,S){if(w){let y;try{y=decodeURIComponent(I(S)).replace(g,"").toLowerCase()}catch(h){return null}if(y.indexOf("javascript:")===0||y.indexOf("vbscript:")===0||y.indexOf("data:")===0)return null}_&&!p.test(S)&&(S=a(_,S));try{S=encodeURI(S).replace(/%25/g,"%")}catch(y){return null}return S}const l={},n=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(w,_){l[" "+w]||(n.test(w)?l[" "+w]=w+"/":l[" "+w]=C(w,"/",!0)),w=l[" "+w];const S=w.indexOf(":")===-1;return _.substring(0,2)==="//"?S?_:w.replace(c,"$1")+_:_.charAt(0)==="/"?S?_:w.replace(s,"$1")+_:w+_}const o={exec:function(){}};function f(w){let _=1,S,y;for(;_<arguments.length;_++){S=arguments[_];for(y in S)Object.prototype.hasOwnProperty.call(S,y)&&(w[y]=S[y])}return w}function L(w,_){const S=w.replace(/\|/g,(E,m,T)=>{let j=!1,N=m;for(;--N>=0&&T[N]==="\\";)j=!j;return j?"|":" |"}),y=S.split(/ \|/);let h=0;if(y.length>_)y.splice(_);else for(;y.length<_;)y.push("");for(;h<y.length;h++)y[h]=y[h].trim().replace(/\\\|/g,"|");return y}function C(w,_,S){const y=w.length;if(y===0)return"";let h=0;for(;h<y;){const E=w.charAt(y-h-1);if(E===_&&!S)h++;else if(E!==_&&S)h++;else break}return w.substr(0,y-h)}function x(w,_){if(w.indexOf(_[1])===-1)return-1;const S=w.length;let y=0,h=0;for(;h<S;h++)if(w[h]==="\\")h++;else if(w[h]===_[0])y++;else if(w[h]===_[1]&&(y--,y<0))return h;return-1}function A(w){w&&w.sanitize&&!w.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}Mt.exports={escape:U,unescape:I,edit:R,cleanUrl:d,resolveUrl:a,noopTest:o,merge:f,splitCells:L,rtrim:C,findClosingBracket:x,checkSanitizeDeprecation:A}},t23M:function(Mt,_t,q){"use strict";var le=q("VTBJ"),Q=q("1OyB"),P=q("vuIU"),Y=q("Ji7U"),D=q("LK+K"),U=q("q1tI"),H=q.n(U),I=q("m+aA"),F=q("Zm9Q"),R=q("Kwbf"),g=q("c+Xe"),p=q("bdgK"),d="rc-observer-key",l=function(n){Object(Y.a)(s,n);var c=Object(D.a)(s);function s(){var a;return Object(Q.a)(this,s),a=c.apply(this,arguments),a.resizeObserver=null,a.childNode=null,a.currentElement=null,a.state={width:0,height:0,offsetHeight:0,offsetWidth:0},a.onResize=function(o){var f=a.props.onResize,L=o[0].target,C=L.getBoundingClientRect(),x=C.width,A=C.height,w=L.offsetWidth,_=L.offsetHeight,S=Math.floor(x),y=Math.floor(A);if(a.state.width!==S||a.state.height!==y||a.state.offsetWidth!==w||a.state.offsetHeight!==_){var h={width:S,height:y,offsetWidth:w,offsetHeight:_};a.setState(h),f&&Promise.resolve().then(function(){f(Object(le.a)(Object(le.a)({},h),{},{offsetWidth:w,offsetHeight:_}))})}},a.setChildNode=function(o){a.childNode=o},a}return Object(P.a)(s,[{key:"componentDidMount",value:function(){this.onComponentUpdated()}},{key:"componentDidUpdate",value:function(){this.onComponentUpdated()}},{key:"componentWillUnmount",value:function(){this.destroyObserver()}},{key:"onComponentUpdated",value:function(){var o=this.props.disabled;if(o){this.destroyObserver();return}var f=Object(I.a)(this.childNode||this),L=f!==this.currentElement;L&&(this.destroyObserver(),this.currentElement=f),!this.resizeObserver&&f&&(this.resizeObserver=new p.default(this.onResize),this.resizeObserver.observe(f))}},{key:"destroyObserver",value:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}},{key:"render",value:function(){var o=this.props.children,f=Object(F.a)(o);if(f.length>1)Object(R.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(f.length===0)return Object(R.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var L=f[0];if(U.isValidElement(L)&&Object(g.c)(L)){var C=L.ref;f[0]=U.cloneElement(L,{ref:Object(g.a)(C,this.setChildNode)})}return f.length===1?f[0]:f.map(function(x,A){return!U.isValidElement(x)||"key"in x&&x.key!==null?x:U.cloneElement(x,{key:"".concat(d,"-").concat(A)})})}}]),s}(U.Component);l.displayName="ResizeObserver",_t.a=l},ulZh:function(Mt,_t,q){typeof window!="undefined"&&function(Q,P){Mt.exports=P()}(this,function(){return function(le){var Q={};function P(Y){if(Q[Y])return Q[Y].exports;var D=Q[Y]={i:Y,l:!1,exports:{}};return le[Y].call(D.exports,D,D.exports,P),D.l=!0,D.exports}return P.m=le,P.c=Q,P.d=function(Y,D,U){P.o(Y,D)||Object.defineProperty(Y,D,{enumerable:!0,get:U})},P.r=function(Y){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Y,"__esModule",{value:!0})},P.t=function(Y,D){if(D&1&&(Y=P(Y)),D&8)return Y;if(D&4&&typeof Y=="object"&&Y&&Y.__esModule)return Y;var U=Object.create(null);if(P.r(U),Object.defineProperty(U,"default",{enumerable:!0,value:Y}),D&2&&typeof Y!="string")for(var H in Y)P.d(U,H,function(I){return Y[I]}.bind(null,H));return U},P.n=function(Y){var D=Y&&Y.__esModule?function(){return Y.default}:function(){return Y};return P.d(D,"a",D),D},P.o=function(Y,D){return Object.prototype.hasOwnProperty.call(Y,D)},P.p="/dist/",P(P.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(le,Q,P){"use strict";var Y=Object.prototype.hasOwnProperty,D="~";function U(){}Object.create&&(U.prototype=Object.create(null),new U().__proto__||(D=!1));function H(g,p,d){this.fn=g,this.context=p,this.once=d||!1}function I(g,p,d,l,n){if(typeof d!="function")throw new TypeError("The listener must be a function");var c=new H(d,l||g,n),s=D?D+p:p;return g._events[s]?g._events[s].fn?g._events[s]=[g._events[s],c]:g._events[s].push(c):(g._events[s]=c,g._eventsCount++),g}function F(g,p){--g._eventsCount===0?g._events=new U:delete g._events[p]}function R(){this._events=new U,this._eventsCount=0}R.prototype.eventNames=function(){var p=[],d,l;if(this._eventsCount===0)return p;for(l in d=this._events)Y.call(d,l)&&p.push(D?l.slice(1):l);return Object.getOwnPropertySymbols?p.concat(Object.getOwnPropertySymbols(d)):p},R.prototype.listeners=function(p){var d=D?D+p:p,l=this._events[d];if(!l)return[];if(l.fn)return[l.fn];for(var n=0,c=l.length,s=new Array(c);n<c;n++)s[n]=l[n].fn;return s},R.prototype.listenerCount=function(p){var d=D?D+p:p,l=this._events[d];return l?l.fn?1:l.length:0},R.prototype.emit=function(p,d,l,n,c,s){var a=D?D+p:p;if(!this._events[a])return!1;var o=this._events[a],f=arguments.length,L,C;if(o.fn){o.once&&this.removeListener(p,o.fn,void 0,!0);switch(f){case 1:return o.fn.call(o.context),!0;case 2:return o.fn.call(o.context,d),!0;case 3:return o.fn.call(o.context,d,l),!0;case 4:return o.fn.call(o.context,d,l,n),!0;case 5:return o.fn.call(o.context,d,l,n,c),!0;case 6:return o.fn.call(o.context,d,l,n,c,s),!0}for(C=1,L=new Array(f-1);C<f;C++)L[C-1]=arguments[C];o.fn.apply(o.context,L)}else{var x=o.length,A;for(C=0;C<x;C++){o[C].once&&this.removeListener(p,o[C].fn,void 0,!0);switch(f){case 1:o[C].fn.call(o[C].context);break;case 2:o[C].fn.call(o[C].context,d);break;case 3:o[C].fn.call(o[C].context,d,l);break;case 4:o[C].fn.call(o[C].context,d,l,n);break;default:if(!L)for(A=1,L=new Array(f-1);A<f;A++)L[A-1]=arguments[A];o[C].fn.apply(o[C].context,L)}}}return!0},R.prototype.on=function(p,d,l){return I(this,p,d,l,!1)},R.prototype.once=function(p,d,l){return I(this,p,d,l,!0)},R.prototype.removeListener=function(p,d,l,n){var c=D?D+p:p;if(!this._events[c])return this;if(!d)return F(this,c),this;var s=this._events[c];if(s.fn)s.fn===d&&(!n||s.once)&&(!l||s.context===l)&&F(this,c);else{for(var a=0,o=[],f=s.length;a<f;a++)(s[a].fn!==d||n&&!s[a].once||l&&s[a].context!==l)&&o.push(s[a]);o.length?this._events[c]=o.length===1?o[0]:o:F(this,c)}return this},R.prototype.removeAllListeners=function(p){var d;return p?(d=D?D+p:p,this._events[d]&&F(this,d)):(this._events=new U,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=D,R.EventEmitter=R,le.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(le,Q,P){(function(Y){var D=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,U=/^([^\/?#]*)([^]*)$/,H=/(?:\/|^)\.(?=\/)/g,I=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,F={buildAbsoluteURL:function(R,g,p){if(p=p||{},R=R.trim(),g=g.trim(),!g){if(!p.alwaysNormalize)return R;var d=F.parseURL(R);if(!d)throw new Error("Error trying to parse base URL.");return d.path=F.normalizePath(d.path),F.buildURLFromParts(d)}var l=F.parseURL(g);if(!l)throw new Error("Error trying to parse relative URL.");if(l.scheme)return p.alwaysNormalize?(l.path=F.normalizePath(l.path),F.buildURLFromParts(l)):g;var n=F.parseURL(R);if(!n)throw new Error("Error trying to parse base URL.");if(!n.netLoc&&n.path&&n.path[0]!=="/"){var c=U.exec(n.path);n.netLoc=c[1],n.path=c[2]}n.netLoc&&!n.path&&(n.path="/");var s={scheme:n.scheme,netLoc:l.netLoc,path:null,params:l.params,query:l.query,fragment:l.fragment};if(!l.netLoc&&(s.netLoc=n.netLoc,l.path[0]!=="/"))if(!l.path)s.path=n.path,l.params||(s.params=n.params,l.query||(s.query=n.query));else{var a=n.path,o=a.substring(0,a.lastIndexOf("/")+1)+l.path;s.path=F.normalizePath(o)}return s.path===null&&(s.path=p.alwaysNormalize?F.normalizePath(l.path):l.path),F.buildURLFromParts(s)},parseURL:function(R){var g=D.exec(R);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(H,"");R.length!==(R=R.replace(I,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};le.exports=F})(this)},"./node_modules/webworkify-webpack/index.js":function(le,Q,P){function Y(p){var d={};function l(c){if(d[c])return d[c].exports;var s=d[c]={i:c,l:!1,exports:{}};return p[c].call(s.exports,s,s.exports,l),s.l=!0,s.exports}l.m=p,l.c=d,l.i=function(c){return c},l.d=function(c,s,a){l.o(c,s)||Object.defineProperty(c,s,{configurable:!1,enumerable:!0,get:a})},l.r=function(c){Object.defineProperty(c,"__esModule",{value:!0})},l.n=function(c){var s=c&&c.__esModule?function(){return c.default}:function(){return c};return l.d(s,"a",s),s},l.o=function(c,s){return Object.prototype.hasOwnProperty.call(c,s)},l.p="/",l.oe=function(c){throw console.error(c),c};var n=l(l.s=ENTRY_MODULE);return n.default||n}var D="[\\.|\\-|\\+|\\w|/|@]+",U="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+D+").*?\\)";function H(p){return(p+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function I(p){return!isNaN(1*p)}function F(p,d,l){var n={};n[l]=[];var c=d.toString(),s=c.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return n;for(var a=s[1],o=new RegExp("(\\\\n|\\W)"+H(a)+U,"g"),f;f=o.exec(c);){if(f[3]==="dll-reference")continue;n[l].push(f[3])}for(o=new RegExp("\\("+H(a)+'\\("(dll-reference\\s('+D+'))"\\)\\)'+U,"g");f=o.exec(c);)p[f[2]]||(n[l].push(f[1]),p[f[2]]=P(f[1]).m),n[f[2]]=n[f[2]]||[],n[f[2]].push(f[4]);for(var L=Object.keys(n),C=0;C<L.length;C++)for(var x=0;x<n[L[C]].length;x++)I(n[L[C]][x])&&(n[L[C]][x]=1*n[L[C]][x]);return n}function R(p){var d=Object.keys(p);return d.reduce(function(l,n){return l||p[n].length>0},!1)}function g(p,d){for(var l={main:[d]},n={main:[]},c={main:{}};R(l);)for(var s=Object.keys(l),a=0;a<s.length;a++){var o=s[a],f=l[o],L=f.pop();if(c[o]=c[o]||{},c[o][L]||!p[o][L])continue;c[o][L]=!0,n[o]=n[o]||[],n[o].push(L);for(var C=F(p,p[o][L],o),x=Object.keys(C),A=0;A<x.length;A++)l[x[A]]=l[x[A]]||[],l[x[A]]=l[x[A]].concat(C[x[A]])}return n}le.exports=function(p,d){d=d||{};var l={main:P.m},n=d.all?{main:Object.keys(l.main)}:g(l,p),c="";Object.keys(n).filter(function(L){return L!=="main"}).forEach(function(L){for(var C=0;n[L][C];)C++;n[L].push(C),l[L][C]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",c=c+"var "+L+" = ("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(C))+")({"+n[L].map(function(x){return""+JSON.stringify(x)+": "+l[L][x].toString()}).join(",")+`});
|
|
`}),c=c+"new (("+Y.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+n.main.map(function(L){return""+JSON.stringify(L)+": "+l.main[L].toString()}).join(",")+"}))(self);";var s=new window.Blob([c],{type:"text/javascript"});if(d.bare)return s;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,o=a.createObjectURL(s),f=new window.Worker(o);return f.objectURL=o,f}},"./src/config.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"hlsDefaultConfig",function(){return A}),P.d(Q,"mergeConfig",function(){return _}),P.d(Q,"enableStreamingMode",function(){return S});var Y=P("./src/controller/abr-controller.ts"),D=P("./src/controller/audio-stream-controller.ts"),U=P("./src/controller/audio-track-controller.ts"),H=P("./src/controller/subtitle-stream-controller.ts"),I=P("./src/controller/subtitle-track-controller.ts"),F=P("./src/controller/buffer-controller.ts"),R=P("./src/controller/timeline-controller.ts"),g=P("./src/controller/cap-level-controller.ts"),p=P("./src/controller/fps-controller.ts"),d=P("./src/controller/eme-controller.ts"),l=P("./src/controller/cmcd-controller.ts"),n=P("./src/utils/xhr-loader.ts"),c=P("./src/utils/fetch-loader.ts"),s=P("./src/utils/cues.ts"),a=P("./src/utils/mediakeys-helper.ts"),o=P("./src/utils/logger.ts");function f(){return f=Object.assign||function(y){for(var h=1;h<arguments.length;h++){var E=arguments[h];for(var m in E)Object.prototype.hasOwnProperty.call(E,m)&&(y[m]=E[m])}return y},f.apply(this,arguments)}function L(y,h){var E=Object.keys(y);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(y);h&&(m=m.filter(function(T){return Object.getOwnPropertyDescriptor(y,T).enumerable})),E.push.apply(E,m)}return E}function C(y){for(var h=1;h<arguments.length;h++){var E=arguments[h]!=null?arguments[h]:{};h%2?L(Object(E),!0).forEach(function(m){x(y,m,E[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(E)):L(Object(E)).forEach(function(m){Object.defineProperty(y,m,Object.getOwnPropertyDescriptor(E,m))})}return y}function x(y,h,E){return h in y?Object.defineProperty(y,h,{value:E,enumerable:!0,configurable:!0,writable:!0}):y[h]=E,y}var A=C(C({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:n.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Y.default,bufferController:F.default,capLevelController:g.default,fpsController:p.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},w()),{},{subtitleStreamController:H.SubtitleStreamController,subtitleTrackController:I.default,timelineController:R.TimelineController,audioStreamController:D.default,audioTrackController:U.default,emeController:d.default,cmcdController:l.default});function w(){return{cueHandler:s.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function _(y,h){if((h.liveSyncDurationCount||h.liveMaxLatencyDurationCount)&&(h.liveSyncDuration||h.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(h.liveMaxLatencyDurationCount!==void 0&&(h.liveSyncDurationCount===void 0||h.liveMaxLatencyDurationCount<=h.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(h.liveMaxLatencyDuration!==void 0&&(h.liveSyncDuration===void 0||h.liveMaxLatencyDuration<=h.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return f({},y,h)}function S(y){var h=y.loader;if(h!==c.default&&h!==n.default)o.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),y.progressive=!1;else{var E=Object(c.fetchSupported)();E&&(y.loader=c.default,y.progressive=!0,y.enableSoftwareAES=!0,o.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/polyfills/number.ts"),D=P("./src/utils/ewma-bandwidth-estimator.ts"),U=P("./src/events.ts"),H=P("./src/utils/buffer-helper.ts"),I=P("./src/errors.ts"),F=P("./src/types/loader.ts"),R=P("./src/utils/logger.ts");function g(l,n){for(var c=0;c<n.length;c++){var s=n[c];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(l,s.key,s)}}function p(l,n,c){return n&&g(l.prototype,n),c&&g(l,c),l}var d=function(){function l(c){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=c;var s=c.config;this.bwEstimator=new D.default(s.abrEwmaSlowVoD,s.abrEwmaFastVoD,s.abrEwmaDefaultEstimate),this.registerListeners()}var n=l.prototype;return n.registerListeners=function(){var s=this.hls;s.on(U.Events.FRAG_LOADING,this.onFragLoading,this),s.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(U.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(U.Events.ERROR,this.onError,this)},n.unregisterListeners=function(){var s=this.hls;s.off(U.Events.FRAG_LOADING,this.onFragLoading,this),s.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(U.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(U.Events.ERROR,this.onError,this)},n.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},n.onFragLoading=function(s,a){var o=a.frag;if(o.type===F.PlaylistLevelType.MAIN&&!this.timer){var f;this.fragCurrent=o,this.partCurrent=(f=a.part)!=null?f:null,this.timer=self.setInterval(this.onCheck,100)}},n.onLevelLoaded=function(s,a){var o=this.hls.config;a.details.live?this.bwEstimator.update(o.abrEwmaSlowLive,o.abrEwmaFastLive):this.bwEstimator.update(o.abrEwmaSlowVoD,o.abrEwmaFastVoD)},n._abandonRulesCheck=function(){var s=this.fragCurrent,a=this.partCurrent,o=this.hls,f=o.autoLevelEnabled,L=o.config,C=o.media;if(!s||!C)return;var x=a?a.stats:s.stats,A=a?a.duration:s.duration;if(x.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!f||C.paused||!C.playbackRate||!C.readyState)return;var w=performance.now()-x.loading.start,_=Math.abs(C.playbackRate);if(w<=500*A/_)return;var S=o.levels,y=o.minAutoLevel,h=S[s.level],E=x.total||Math.max(x.loaded,Math.round(A*h.maxBitrate/8)),m=Math.max(1,x.bwEstimate?x.bwEstimate/8:x.loaded*1e3/w),T=(E-x.loaded)/m,j=C.currentTime,N=(H.BufferHelper.bufferInfo(C,j,L.maxBufferHole).end-j)/_;if(N>=2*A/_||T<=N)return;var K=Number.POSITIVE_INFINITY,W;for(W=s.level-1;W>y;W--){var k=S[W].maxBitrate;if(K=A*k/(8*.8*m),K<N)break}if(K>=T)return;var b=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+s.sn+(a?" part "+a.index:"")+" of level "+s.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
|
|
Current BW estimate: `+(Object(Y.isFiniteNumber)(b)?(b/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+T.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+K.toFixed(3)+` s
|
|
Time to underbuffer: `+N.toFixed(3)+" s"),o.nextLoadLevel=W,this.bwEstimator.sample(w,x.loaded),this.clearTimer(),s.loader&&(this.fragCurrent=this.partCurrent=null,s.loader.abort()),o.trigger(U.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:a,stats:x})},n.onFragLoaded=function(s,a){var o=a.frag,f=a.part;if(o.type===F.PlaylistLevelType.MAIN&&Object(Y.isFiniteNumber)(o.sn)){var L=f?f.stats:o.stats,C=f?f.duration:o.duration;if(this.clearTimer(),this.lastLoadedFragLevel=o.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var x=this.hls.levels[o.level],A=(x.loaded?x.loaded.bytes:0)+L.loaded,w=(x.loaded?x.loaded.duration:0)+C;x.loaded={bytes:A,duration:w},x.realBitrate=Math.round(8*A/w)}if(o.bitrateTest){var _={stats:L,frag:o,part:f,id:o.type};this.onFragBuffered(U.Events.FRAG_BUFFERED,_),o.bitrateTest=!1}}},n.onFragBuffered=function(s,a){var o=a.frag,f=a.part,L=f?f.stats:o.stats;if(L.aborted)return;if(o.type!==F.PlaylistLevelType.MAIN||o.sn==="initSegment")return;var C=L.parsing.end-L.loading.start;this.bwEstimator.sample(C,L.loaded),L.bwEstimate=this.bwEstimator.getEstimate(),o.bitrateTest?this.bitrateTestDelay=C/1e3:this.bitrateTestDelay=0},n.onError=function(s,a){switch(a.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},n.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},n.getNextABRAutoLevel=function(){var s=this.fragCurrent,a=this.partCurrent,o=this.hls,f=o.maxAutoLevel,L=o.config,C=o.minAutoLevel,x=o.media,A=a?a.duration:s?s.duration:0,w=x?x.currentTime:0,_=x&&x.playbackRate!==0?Math.abs(x.playbackRate):1,S=this.bwEstimator?this.bwEstimator.getEstimate():L.abrEwmaDefaultEstimate,y=(H.BufferHelper.bufferInfo(x,w,L.maxBufferHole).end-w)/_,h=this.findBestLevel(S,C,f,y,L.abrBandWidthFactor,L.abrBandWidthUpFactor);if(h>=0)return h;R.logger.trace((y?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var E=A?Math.min(A,L.maxStarvationDelay):L.maxStarvationDelay,m=L.abrBandWidthFactor,T=L.abrBandWidthUpFactor;if(!y){var j=this.bitrateTestDelay;if(j){var N=A?Math.min(A,L.maxLoadingDelay):L.maxLoadingDelay;E=N-j,R.logger.trace("bitrate test took "+Math.round(1e3*j)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*E)+" ms"),m=T=1}}return h=this.findBestLevel(S,C,f,y+E,m,T),Math.max(h,0)},n.findBestLevel=function(s,a,o,f,L,C){for(var x,A=this.fragCurrent,w=this.partCurrent,_=this.lastLoadedFragLevel,S=this.hls.levels,y=S[_],h=!!(y!=null&&(x=y.details)!==null&&x!==void 0&&x.live),E=y==null?void 0:y.codecSet,m=w?w.duration:A?A.duration:0,T=o;T>=a;T--){var j=S[T];if(!j||E&&j.codecSet!==E)continue;var N=j.details,K=(w?N==null?void 0:N.partTarget:N==null?void 0:N.averagetargetduration)||m,W=void 0;T<=_?W=L*s:W=C*s;var k=S[T].maxBitrate,b=k*K/W;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+T+"/"+Math.round(W)+"/"+k+"/"+K+"/"+f+"/"+b),W>k&&(!b||h&&!this.bitrateTestDelay||b<f))return T}return-1},p(l,[{key:"nextAutoLevel",get:function(){var s=this._nextAutoLevel,a=this.bwEstimator;if(s!==-1&&(!a||!a.canEstimate()))return s;var o=this.getNextABRAutoLevel();return s!==-1&&(o=Math.min(s,o)),o},set:function(s){this._nextAutoLevel=s}}]),l}();Q.default=d},"./src/controller/audio-stream-controller.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/polyfills/number.ts"),D=P("./src/controller/base-stream-controller.ts"),U=P("./src/events.ts"),H=P("./src/utils/buffer-helper.ts"),I=P("./src/controller/fragment-tracker.ts"),F=P("./src/types/level.ts"),R=P("./src/types/loader.ts"),g=P("./src/loader/fragment.ts"),p=P("./src/demux/chunk-cache.ts"),d=P("./src/demux/transmuxer-interface.ts"),l=P("./src/types/transmuxer.ts"),n=P("./src/controller/fragment-finders.ts"),c=P("./src/utils/discontinuities.ts"),s=P("./src/errors.ts"),a=P("./src/utils/logger.ts");function o(){return o=Object.assign||function(A){for(var w=1;w<arguments.length;w++){var _=arguments[w];for(var S in _)Object.prototype.hasOwnProperty.call(_,S)&&(A[S]=_[S])}return A},o.apply(this,arguments)}function f(A,w){A.prototype=Object.create(w.prototype),A.prototype.constructor=A,L(A,w)}function L(A,w){return L=Object.setPrototypeOf||function(S,y){return S.__proto__=y,S},L(A,w)}var C=100,x=function(A){f(w,A);function w(S,y){var h;return h=A.call(this,S,y,"[audio-stream-controller]")||this,h.videoBuffer=null,h.videoTrackCC=-1,h.waitingVideoCC=-1,h.audioSwitch=!1,h.trackId=-1,h.waitingData=null,h.mainDetails=null,h.bufferFlushed=!1,h._registerListeners(),h}var _=w.prototype;return _.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},_._registerListeners=function(){var y=this.hls;y.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),y.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.on(U.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),y.on(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),y.on(U.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),y.on(U.Events.ERROR,this.onError,this),y.on(U.Events.BUFFER_RESET,this.onBufferReset,this),y.on(U.Events.BUFFER_CREATED,this.onBufferCreated,this),y.on(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),y.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),y.on(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},_._unregisterListeners=function(){var y=this.hls;y.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),y.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.off(U.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),y.off(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),y.off(U.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),y.off(U.Events.ERROR,this.onError,this),y.off(U.Events.BUFFER_RESET,this.onBufferReset,this),y.off(U.Events.BUFFER_CREATED,this.onBufferCreated,this),y.off(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),y.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),y.off(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},_.onInitPtsFound=function(y,h){var E=h.frag,m=h.id,T=h.initPTS;if(m==="main"){var j=E.cc;this.initPTS[E.cc]=T,this.log("InitPTS for cc: "+j+" found from main: "+T),this.videoTrackCC=j,this.state===D.State.WAITING_INIT_PTS&&this.tick()}},_.startLoad=function(y){if(!this.levels){this.startPosition=y,this.state=D.State.STOPPED;return}var h=this.lastCurrentTime;this.stopLoad(),this.setInterval(C),this.fragLoadError=0,h>0&&y===-1?(this.log("Override startPosition with lastCurrentTime @"+h.toFixed(3)),this.state=D.State.IDLE):(this.loadedmetadata=!1,this.state=D.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=y,this.tick()},_.doTick=function(){switch(this.state){case D.State.IDLE:this.doTickIdle();break;case D.State.WAITING_TRACK:{var y,h=this.levels,E=this.trackId,m=h==null||((y=h[E])===null||y===void 0)?void 0:y.details;if(m){if(this.waitForCdnTuneIn(m))break;this.state=D.State.WAITING_INIT_PTS}break}case D.State.FRAG_LOADING_WAITING_RETRY:{var T,j=performance.now(),N=this.retryDate;(!N||j>=N||(T=this.media)!==null&&T!==void 0&&T.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=D.State.IDLE);break}case D.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var W=K.frag,k=K.part,b=K.cache,G=K.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=D.State.FRAG_LOADING;var J=b.flush(),oe={frag:W,part:k,payload:J,networkDetails:null};this._handleFragmentLoadProgress(oe),G&&A.prototype._handleFragmentLoadComplete.call(this,oe)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var fe=this.getLoadPosition(),Ne=H.BufferHelper.bufferInfo(this.mediaBuffer,fe,this.config.maxBufferHole),_e=Object(n.fragmentWithinToleranceTest)(Ne.end,this.config.maxFragLookUpTolerance,W);_e<0&&(a.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+Ne.end+" is needed"),this.clearWaitingFragment())}}else this.state=D.State.IDLE}}this.onTickEnd()},_.clearWaitingFragment=function(){var y=this.waitingData;y&&(this.fragmentTracker.removeFragment(y.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=D.State.IDLE)},_.onTickEnd=function(){var y=this.media;if(!y||!y.readyState)return;var h=this.mediaBuffer?this.mediaBuffer:y,E=h.buffered;!this.loadedmetadata&&E.length&&(this.loadedmetadata=!0),this.lastCurrentTime=y.currentTime},_.doTickIdle=function(){var y,h,E=this.hls,m=this.levels,T=this.media,j=this.trackId,N=E.config;if(!m||!m[j])return;if(!T&&(this.startFragRequested||!N.startFragPrefetch))return;var K=m[j],W=K.details;if(!W||W.live&&this.levelLastLoaded!==j||this.waitForCdnTuneIn(W)){this.state=D.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var k=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(k===null)return;var b=k.len,G=this.getMaxBufferLength(),J=this.audioSwitch;if(b>=G&&!J)return;if(!J&&this._streamEnded(k,W)){E.trigger(U.Events.BUFFER_EOS,{type:"audio"}),this.state=D.State.ENDED;return}var oe=W.fragments,fe=oe[0].start,Ne=k.end;if(J){var _e=this.getLoadPosition();Ne=_e,W.PTSKnown&&_e<fe&&((k.end>fe||k.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),T.currentTime=fe+.05))}var Fe=this.getNextFragment(Ne,W);if(!Fe){this.bufferFlushed=!0;return}((y=Fe.decryptdata)===null||y===void 0?void 0:y.keyFormat)==="identity"&&!((h=Fe.decryptdata)!==null&&h!==void 0&&h.key)?this.loadKey(Fe,W):this.loadFragment(Fe,W,Ne)},_.getMaxBufferLength=function(){var y=A.prototype.getMaxBufferLength.call(this),h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return h===null?y:Math.max(y,h.len)},_.onMediaDetaching=function(){this.videoBuffer=null,A.prototype.onMediaDetaching.call(this)},_.onAudioTracksUpdated=function(y,h){var E=h.audioTracks;this.resetTransmuxer(),this.levels=E.map(function(m){return new F.Level(m)})},_.onAudioTrackSwitching=function(y,h){var E=!!h.url;this.trackId=h.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=D.State.IDLE):this.state=D.State.STOPPED,this.tick()},_.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},_.onLevelLoaded=function(y,h){this.mainDetails=h.details},_.onAudioTrackLoaded=function(y,h){var E,m=this.levels,T=h.details,j=h.id;if(!m){this.warn("Audio tracks were reset while loading level "+j);return}this.log("Track "+j+" loaded ["+T.startSN+","+T.endSN+"],duration:"+T.totalduration);var N=m[j],K=0;if(T.live||(E=N.details)!==null&&E!==void 0&&E.live){var W=this.mainDetails;if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed||!W)return;!N.details&&T.hasProgramDateTime&&W.hasProgramDateTime?(Object(c.alignMediaPlaylistByPDT)(T,W),K=T.fragments[0].start):K=this.alignPlaylists(T,N.details)}N.details=T,this.levelLastLoaded=j,!this.startFragRequested&&(this.mainDetails||!T.live)&&this.setStartPosition(N.details,K),this.state===D.State.WAITING_TRACK&&!this.waitForCdnTuneIn(T)&&(this.state=D.State.IDLE),this.tick()},_._handleFragmentLoadProgress=function(y){var h,E=y.frag,m=y.part,T=y.payload,j=this.config,N=this.trackId,K=this.levels;if(!K){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 W=K[N];console.assert(W,"Audio track is defined on fragment load progress");var k=W.details;console.assert(k,"Audio track details are defined on fragment load progress");var b=j.defaultAudioCodec||W.audioCodec||"mp4a.40.2",G=this.transmuxer;G||(G=this.transmuxer=new d.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var J=this.initPTS[E.cc],oe=(h=E.initSegment)===null||h===void 0?void 0:h.data;if(J!==void 0){var fe=!1,Ne=m?m.index:-1,_e=Ne!==-1,Fe=new l.ChunkMetadata(E.level,E.sn,E.stats.chunkCount,T.byteLength,Ne,_e);G.push(T,oe,b,"",E,m,k.totalduration,fe,Fe,J)}else{a.logger.log("Unknown video PTS for cc "+E.cc+", waiting for video PTS before demuxing audio frag "+E.sn+" of ["+k.startSN+" ,"+k.endSN+"],track "+N);var We=this.waitingData=this.waitingData||{frag:E,part:m,cache:new p.default,complete:!1},Ue=We.cache;Ue.push(new Uint8Array(T)),this.waitingVideoCC=this.videoTrackCC,this.state=D.State.WAITING_INIT_PTS}},_._handleFragmentLoadComplete=function(y){if(this.waitingData){this.waitingData.complete=!0;return}A.prototype._handleFragmentLoadComplete.call(this,y)},_.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},_.onBufferCreated=function(y,h){var E=h.tracks.audio;E&&(this.mediaBuffer=E.buffer),h.tracks.video&&(this.videoBuffer=h.tracks.video.buffer)},_.onFragBuffered=function(y,h){var E=h.frag,m=h.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(U.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(E,m)},_.onError=function(y,h){switch(h.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,h);break;case s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==D.State.ERROR&&this.state!==D.State.STOPPED&&(this.state=h.fatal?D.State.ERROR:D.State.IDLE,this.warn(h.details+" while loading frag, switching to "+this.state+" state"));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if(h.parent==="audio"&&(this.state===D.State.PARSING||this.state===D.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,A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},_.onBufferFlushed=function(y,h){var E=h.type;E===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},_._handleTransmuxComplete=function(y){var h,E="audio",m=this.hls,T=y.remuxResult,j=y.chunkMeta,N=this.getCurrentContext(j);if(!N){this.warn("The loading context changed while buffering fragment "+j.sn+" of level "+j.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(j.level);return}var K=N.frag,W=N.part,k=T.audio,b=T.text,G=T.id3,J=T.initSegment;if(this.fragContextChanged(K))return;if(this.state=D.State.PARSING,this.audioSwitch&&k&&this.completeAudioSwitch(),J!=null&&J.tracks&&(this._bufferInitSegment(J.tracks,K,j),m.trigger(U.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:E,tracks:J.tracks})),k){var oe=k.startPTS,fe=k.endPTS,Ne=k.startDTS,_e=k.endDTS;W&&(W.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:fe,startDTS:Ne,endDTS:_e}),K.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,oe,fe,Ne,_e),this.bufferFragmentData(k,K,W,j)}if(G!=null&&(h=G.samples)!==null&&h!==void 0&&h.length){var Fe=o({frag:K,id:E},G);m.trigger(U.Events.FRAG_PARSING_METADATA,Fe)}if(b){var We=o({frag:K,id:E},b);m.trigger(U.Events.FRAG_PARSING_USERDATA,We)}},_._bufferInitSegment=function(y,h,E){if(this.state!==D.State.PARSING)return;y.video&&delete y.video;var m=y.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(U.Events.BUFFER_CODECS,y);var T=m.initSegment;if(T!=null&&T.byteLength){var j={type:"audio",frag:h,part:null,chunkMeta:E,parent:h.type,data:T};this.hls.trigger(U.Events.BUFFER_APPENDING,j)}this.tick()},_.loadFragment=function(y,h,E){var m=this.fragmentTracker.getState(y);this.fragCurrent=y,(this.audioSwitch||m===I.FragmentState.NOT_LOADED||m===I.FragmentState.PARTIAL)&&(y.sn==="initSegment"?this._loadInitSegment(y):h.live&&!Object(Y.isFiniteNumber)(this.initPTS[y.cc])?(this.log("Waiting for video PTS in continuity counter "+y.cc+" of live stream before loading audio fragment "+y.sn+" of level "+this.trackId),this.state=D.State.WAITING_INIT_PTS):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,y,h,E)))},_.completeAudioSwitch=function(){var y=this.hls,h=this.media,E=this.trackId;h&&(this.log("Switching audio track : flushing all audio"),A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,y.trigger(U.Events.AUDIO_TRACK_SWITCHED,{id:E})},w}(D.default);Q.default=x},"./src/controller/audio-track-controller.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/events.ts"),D=P("./src/errors.ts"),U=P("./src/controller/base-playlist-controller.ts"),H=P("./src/types/loader.ts");function I(d,l){for(var n=0;n<l.length;n++){var c=l[n];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(d,c.key,c)}}function F(d,l,n){return l&&I(d.prototype,l),n&&I(d,n),d}function R(d,l){d.prototype=Object.create(l.prototype),d.prototype.constructor=d,g(d,l)}function g(d,l){return g=Object.setPrototypeOf||function(c,s){return c.__proto__=s,c},g(d,l)}var p=function(d){R(l,d);function l(c){var s;return s=d.call(this,c,"[audio-track-controller]")||this,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.trackName="",s.selectDefaultTrack=!0,s.registerListeners(),s}var n=l.prototype;return n.registerListeners=function(){var s=this.hls;s.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.on(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(Y.Events.ERROR,this.onError,this)},n.unregisterListeners=function(){var s=this.hls;s.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.off(Y.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(Y.Events.ERROR,this.onError,this)},n.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,d.prototype.destroy.call(this)},n.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},n.onManifestParsed=function(s,a){this.tracks=a.audioTracks||[]},n.onAudioTrackLoaded=function(s,a){var o=a.id,f=a.details,L=this.tracksInGroup[o];if(!L){this.warn("Invalid audio track id "+o);return}var C=L.details;L.details=a.details,this.log("audioTrack "+o+" loaded ["+f.startSN+"-"+f.endSN+"]"),o===this.trackId&&(this.retryCount=0,this.playlistLoaded(o,a,C))},n.onLevelLoading=function(s,a){this.switchLevel(a.level)},n.onLevelSwitching=function(s,a){this.switchLevel(a.level)},n.switchLevel=function(s){var a=this.hls.levels[s];if(!(a!=null&&a.audioGroupIds))return;var o=a.audioGroupIds[a.urlId];if(this.groupId!==o){this.groupId=o;var f=this.tracks.filter(function(C){return!o||C.groupId===o});this.selectDefaultTrack&&!f.some(function(C){return C.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=f;var L={audioTracks:f};this.log("Updating audio tracks, "+f.length+' track(s) found in "'+o+'" group-id'),this.hls.trigger(Y.Events.AUDIO_TRACKS_UPDATED,L),this.selectInitialTrack()}},n.onError=function(s,a){if(d.prototype.onError.call(this,s,a),a.fatal||!a.context)return;a.context.type===H.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},n.setAudioTrack=function(s){var a=this.tracksInGroup;if(s<0||s>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var o=a[this.trackId];this.log("Now switching to audio-track index "+s);var f=a[s],L=f.id,C=f.groupId,x=C===void 0?"":C,A=f.name,w=f.type,_=f.url;if(this.trackId=s,this.trackName=A,this.selectDefaultTrack=!1,this.hls.trigger(Y.Events.AUDIO_TRACK_SWITCHING,{id:L,groupId:x,name:A,type:w,url:_}),f.details&&!f.details.live)return;var S=this.switchParams(f.url,o==null?void 0:o.details);this.loadPlaylist(S)},n.selectInitialTrack=function(){var s=this.tracksInGroup;console.assert(s.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,o=this.findTrackId(a)||this.findTrackId();o!==-1?this.setAudioTrack(o):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Y.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},n.findTrackId=function(s){for(var a=this.tracksInGroup,o=0;o<a.length;o++){var f=a[o];if((!this.selectDefaultTrack||f.default)&&(!s||s===f.name))return f.id}return-1},n.loadPlaylist=function(s){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var o=a.id,f=a.groupId,L=a.url;if(s)try{L=s.addDirectives(L)}catch(C){this.warn("Could not construct new URL with HLS Delivery Directives: "+C)}this.log("loading audio-track playlist for id: "+o),this.clearTimer(),this.hls.trigger(Y.Events.AUDIO_TRACK_LOADING,{url:L,id:o,groupId:f,deliveryDirectives:s||null})}},F(l,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(s){this.selectDefaultTrack=!1,this.setAudioTrack(s)}}]),l}(U.default);Q.default=p},"./src/controller/base-playlist-controller.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return F});var Y=P("./src/polyfills/number.ts"),D=P("./src/types/level.ts"),U=P("./src/controller/level-helper.ts"),H=P("./src/utils/logger.ts"),I=P("./src/errors.ts"),F=function(){function R(p,d){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=H.logger.log.bind(H.logger,d+":"),this.warn=H.logger.warn.bind(H.logger,d+":"),this.hls=p}var g=R.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(d,l){l.fatal&&l.type===I.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},g.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},g.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},g.stopLoad=function(){this.canLoad=!1,this.clearTimer()},g.switchParams=function(d,l){var n=l==null?void 0:l.renditionReports;if(n)for(var c=0;c<n.length;c++){var s=n[c],a=""+s.URI;if(a===d.substr(-a.length)){var o=parseInt(s["LAST-MSN"]),f=parseInt(s["LAST-PART"]);if(l&&this.hls.config.lowLatencyMode){var L=Math.min(l.age-l.partTarget,l.targetduration);f!==void 0&&L>l.partTarget&&(f+=1)}if(Object(Y.isFiniteNumber)(o))return new D.HlsUrlParameters(o,Object(Y.isFiniteNumber)(f)?f:void 0,D.HlsSkip.No)}}},g.loadPlaylist=function(d){},g.shouldLoadTrack=function(d){return this.canLoad&&d&&!!d.url&&(!d.details||d.details.live)},g.playlistLoaded=function(d,l,n){var c=this,s=l.details,a=l.stats,o=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(s.advancedDateTime=Date.now()-o,s.live||n!=null&&n.live){if(s.reloaded(n),n&&this.log("live playlist "+d+" "+(s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:"MISSED")),n&&s.fragments.length>0&&Object(U.mergeDetails)(n,s),!this.canLoad||!s.live)return;var f,L=void 0,C=void 0;if(s.canBlockReload&&s.endSN&&s.advanced){var x=this.hls.config.lowLatencyMode,A=s.lastPartSn,w=s.endSN,_=s.lastPartIndex,S=_!==-1,y=A===w,h=x?0:_;S?(L=y?w+1:A,C=y?h:_+1):L=w+1;var E=s.age,m=E+s.ageHeader,T=Math.min(m-s.partTarget,s.targetduration*1.5);if(T>0){if(n&&T>n.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+n.tuneInGoal+" to: "+T+" with playlist age: "+s.age),T=0;else{var j=Math.floor(T/s.targetduration);if(L+=j,C!==void 0){var N=Math.round(T%s.targetduration/s.partTarget);C+=N}this.log("CDN Tune-in age: "+s.ageHeader+"s last advanced "+E.toFixed(2)+"s goal: "+T+" skip sn "+j+" to part "+C)}s.tuneInGoal=T}if(f=this.getDeliveryDirectives(s,l.deliveryDirectives,L,C),x||!y){this.loadPlaylist(f);return}}else f=this.getDeliveryDirectives(s,l.deliveryDirectives,L,C);var K=Object(U.computeReloadInterval)(s,a);L!==void 0&&s.canBlockReload&&(K-=s.partTarget||1),this.log("reload live playlist "+d+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return c.loadPlaylist(f)},K)}else this.clearTimer()},g.getDeliveryDirectives=function(d,l,n,c){var s=Object(D.getSkipValue)(d,n);return l!=null&&l.skip&&d.deltaUpdateFailed&&(n=l.msn,c=l.part,s=D.HlsSkip.No),new D.HlsUrlParameters(n,c,s)},g.retryLoadingOrFail=function(d){var l=this,n=this.hls.config,c=this.retryCount<n.levelLoadingMaxRetry;if(c){var s;if(this.retryCount++,d.details.indexOf("LoadTimeOut")>-1&&(s=d.context)!==null&&s!==void 0&&s.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+d.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*n.levelLoadingRetryDelay,n.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return l.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+d.details+'"')}}else this.warn('cannot recover from error "'+d.details+'"'),this.clearTimer(),d.fatal=!0;return c},R}()},"./src/controller/base-stream-controller.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"State",function(){return w}),P.d(Q,"default",function(){return _});var Y=P("./src/polyfills/number.ts"),D=P("./src/task-loop.ts"),U=P("./src/controller/fragment-tracker.ts"),H=P("./src/utils/buffer-helper.ts"),I=P("./src/utils/logger.ts"),F=P("./src/events.ts"),R=P("./src/errors.ts"),g=P("./src/types/transmuxer.ts"),p=P("./src/utils/mp4-tools.ts"),d=P("./src/utils/discontinuities.ts"),l=P("./src/controller/fragment-finders.ts"),n=P("./src/controller/level-helper.ts"),c=P("./src/loader/fragment-loader.ts"),s=P("./src/crypt/decrypter.ts"),a=P("./src/utils/time-ranges.ts"),o=P("./src/types/loader.ts");function f(S,y){for(var h=0;h<y.length;h++){var E=y[h];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(S,E.key,E)}}function L(S,y,h){return y&&f(S.prototype,y),h&&f(S,h),S}function C(S){if(S===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return S}function x(S,y){S.prototype=Object.create(y.prototype),S.prototype.constructor=S,A(S,y)}function A(S,y){return A=Object.setPrototypeOf||function(E,m){return E.__proto__=m,E},A(S,y)}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"},_=function(S){x(y,S);function y(E,m,T){var j;return j=S.call(this)||this,j.hls=void 0,j.fragPrevious=null,j.fragCurrent=null,j.fragmentTracker=void 0,j.transmuxer=null,j._state=w.STOPPED,j.media=void 0,j.mediaBuffer=void 0,j.config=void 0,j.bitrateTest=!1,j.lastCurrentTime=0,j.nextLoadPosition=0,j.startPosition=0,j.loadedmetadata=!1,j.fragLoadError=0,j.retryDate=0,j.levels=null,j.fragmentLoader=void 0,j.levelLastLoaded=null,j.startFragRequested=!1,j.decrypter=void 0,j.initPTS=[],j.onvseeking=null,j.onvended=null,j.logPrefix="",j.log=void 0,j.warn=void 0,j.logPrefix=T,j.log=I.logger.log.bind(I.logger,T+":"),j.warn=I.logger.warn.bind(I.logger,T+":"),j.hls=E,j.fragmentLoader=new c.default(E.config),j.fragmentTracker=m,j.config=E.config,j.decrypter=new s.default(E,E.config),E.on(F.Events.KEY_LOADED,j.onKeyLoaded,C(j)),j}var h=y.prototype;return h.doTick=function(){this.onTickEnd()},h.onTickEnd=function(){},h.startLoad=function(m){},h.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},h._streamEnded=function(m,T){var j=this.fragCurrent,N=this.fragmentTracker;if(!T.live&&j&&j.sn===T.endSN&&!m.nextStart){var K=N.getState(j);return K===U.FragmentState.PARTIAL||K===U.FragmentState.OK}return!1},h.onMediaAttached=function(m,T){var j=this.media=this.mediaBuffer=T.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),j.addEventListener("seeking",this.onvseeking),j.addEventListener("ended",this.onvended);var N=this.config;this.levels&&N.autoStartLoad&&this.state===w.STOPPED&&this.startLoad(N.startPosition)},h.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()},h.onMediaSeeking=function(){var m=this.config,T=this.fragCurrent,j=this.media,N=this.mediaBuffer,K=this.state,W=j?j.currentTime:0,k=H.BufferHelper.bufferInfo(N||j,W,m.maxBufferHole);if(this.log("media seeking to "+(Object(Y.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+K),K===w.ENDED)this.resetLoadingState();else if(T&&!k.len){var b=m.maxFragLookUpTolerance,G=T.start-b,J=T.start+T.duration+b,oe=W>J;(W<G||oe)&&(oe&&T.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),T.loader.abort()),this.resetLoadingState())}j&&(this.lastCurrentTime=W),!this.loadedmetadata&&!k.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},h.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},h.onKeyLoaded=function(m,T){if(this.state!==w.KEY_LOADING||T.frag!==this.fragCurrent||!this.levels)return;this.state=w.IDLE;var j=this.levels[T.frag.level].details;j&&this.loadFragment(T.frag,j,T.frag.start)},h.onHandlerDestroying=function(){this.stopLoad(),S.prototype.onHandlerDestroying.call(this)},h.onHandlerDestroyed=function(){this.state=w.STOPPED,this.hls.off(F.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,S.prototype.onHandlerDestroyed.call(this)},h.loadKey=function(m,T){this.log("Loading key for "+m.sn+" of ["+T.startSN+"-"+T.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level),this.state=w.KEY_LOADING,this.fragCurrent=m,this.hls.trigger(F.Events.KEY_LOADING,{frag:m})},h.loadFragment=function(m,T,j){this._loadFragForPlayback(m,T,j)},h._loadFragForPlayback=function(m,T,j){var N=this,K=function(k){if(N.fragContextChanged(m)){N.warn("Fragment "+m.sn+(k.part?" p: "+k.part.index:"")+" of level "+m.level+" was dropped during download."),N.fragmentTracker.removeFragment(m);return}m.stats.chunkCount++,N._handleFragmentLoadProgress(k)};this._doFragLoad(m,T,j,K).then(function(W){if(!W)return;N.fragLoadError=0;var k=N.state;if(N.fragContextChanged(m)){(k===w.FRAG_LOADING||k===w.BACKTRACKING||!N.fragCurrent&&k===w.PARSING)&&(N.fragmentTracker.removeFragment(m),N.state=w.IDLE);return}if("payload"in W&&(N.log("Loaded fragment "+m.sn+" of level "+m.level),N.hls.trigger(F.Events.FRAG_LOADED,W),N.state===w.BACKTRACKING)){N.fragmentTracker.backtrack(m,W),N.resetFragmentLoading(m);return}N._handleFragmentLoadComplete(W)}).catch(function(W){N.warn(W),N.resetFragmentLoading(m)})},h.flushMainBuffer=function(m,T,j){if(j===void 0&&(j=null),!(m-T))return;var N={startOffset:m,endOffset:T,type:j};this.fragLoadError=0,this.hls.trigger(F.Events.BUFFER_FLUSHING,N)},h._loadInitSegment=function(m){var T=this;this._doFragLoad(m).then(function(j){if(!j||T.fragContextChanged(m)||!T.levels)throw new Error("init load aborted");return j}).then(function(j){var N=T.hls,K=j.payload,W=m.decryptdata;if(K&&K.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var k=self.performance.now();return T.decrypter.webCryptoDecrypt(new Uint8Array(K),W.key.buffer,W.iv.buffer).then(function(b){var G=self.performance.now();return N.trigger(F.Events.FRAG_DECRYPTED,{frag:m,payload:b,stats:{tstart:k,tdecrypt:G}}),j.payload=b,j})}return j}).then(function(j){var N=T.fragCurrent,K=T.hls,W=T.levels;if(!W)throw new Error("init load aborted, missing levels");var k=W[m.level].details;console.assert(k,"Level details are defined when init segment is loaded");var b=m.stats;T.state=w.IDLE,T.fragLoadError=0,m.data=new Uint8Array(j.payload),b.parsing.start=b.buffering.start=self.performance.now(),b.parsing.end=b.buffering.end=self.performance.now(),j.frag===N&&K.trigger(F.Events.FRAG_BUFFERED,{stats:b,frag:N,part:null,id:m.type}),T.tick()}).catch(function(j){T.warn(j),T.resetFragmentLoading(m)})},h.fragContextChanged=function(m){var T=this.fragCurrent;return!m||!T||m.level!==T.level||m.sn!==T.sn||m.urlId!==T.urlId},h.fragBufferedComplete=function(m,T){var j=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+m.type+" sn: "+m.sn+(T?" part: "+T.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+m.level+" "+a.default.toString(H.BufferHelper.getBuffered(j))),this.state=w.IDLE,this.tick()},h._handleFragmentLoadComplete=function(m){var T=this.transmuxer;if(!T)return;var j=m.frag,N=m.part,K=m.partsLoaded,W=!K||K.length===0||K.some(function(b){return!b}),k=new g.ChunkMetadata(j.level,j.sn,j.stats.chunkCount+1,0,N?N.index:-1,!W);T.flush(k)},h._handleFragmentLoadProgress=function(m){},h._doFragLoad=function(m,T,j,N){var K=this;if(j===void 0&&(j=null),!this.levels)throw new Error("frag load aborted, missing levels");if(j=Math.max(m.start,j||0),this.config.lowLatencyMode&&T){var W=T.partList;if(W&&N){j>m.end&&T.fragmentHint&&(m=T.fragmentHint);var k=this.getNextPart(W,m,j);if(k>-1){var b=W[k];return this.log("Loading part sn: "+m.sn+" p: "+b.index+" cc: "+m.cc+" of playlist ["+T.startSN+"-"+T.endSN+"] parts [0-"+k+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(j.toFixed(3))),this.nextLoadPosition=b.start+b.duration,this.state=w.FRAG_LOADING,this.hls.trigger(F.Events.FRAG_LOADING,{frag:m,part:W[k],targetBufferTime:j}),this.doFragPartsLoad(m,W,k,N).catch(function(G){return K.handleFragLoadError(G)})}else if(!m.url||this.loadedEndOfParts(W,j))return Promise.resolve(null)}}return this.log("Loading fragment "+m.sn+" cc: "+m.cc+" "+(T?"of ["+T.startSN+"-"+T.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+m.level+", target: "+parseFloat(j.toFixed(3))),Object(Y.isFiniteNumber)(m.sn)&&!this.bitrateTest&&(this.nextLoadPosition=m.start+m.duration),this.state=w.FRAG_LOADING,this.hls.trigger(F.Events.FRAG_LOADING,{frag:m,targetBufferTime:j}),this.fragmentLoader.load(m,N).catch(function(G){return K.handleFragLoadError(G)})},h.doFragPartsLoad=function(m,T,j,N){var K=this;return new Promise(function(W,k){var b=[],G=function J(oe){var fe=T[oe];K.fragmentLoader.loadPart(m,fe,N).then(function(Ne){b[fe.index]=Ne;var _e=Ne.part;K.hls.trigger(F.Events.FRAG_LOADED,Ne);var Fe=T[oe+1];if(Fe&&Fe.fragment===m)J(oe+1);else return W({frag:m,part:_e,partsLoaded:b})}).catch(k)};G(j)})},h.handleFragLoadError=function(m){var T=m.data;return T&&T.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(T.frag,T.part):this.hls.trigger(F.Events.ERROR,T),null},h._handleTransmuxerFlush=function(m){var T=this.getCurrentContext(m);if(!T||this.state!==w.PARSING){this.fragCurrent||(this.state=w.IDLE);return}var j=T.frag,N=T.part,K=T.level,W=self.performance.now();j.stats.parsing.end=W,N&&(N.stats.parsing.end=W),this.updateLevelTiming(j,N,K,m.partial)},h.getCurrentContext=function(m){var T=this.levels,j=m.level,N=m.sn,K=m.part;if(!T||!T[j])return this.warn("Levels object was unset while buffering fragment "+N+" of level "+j+". The current chunk will not be buffered."),null;var W=T[j],k=K>-1?Object(n.getPartWith)(W,N,K):null,b=k?k.fragment:Object(n.getFragmentWithSN)(W,N,this.fragCurrent);return b?{frag:b,part:k,level:W}:null},h.bufferFragmentData=function(m,T,j,N){if(!m||this.state!==w.PARSING)return;var K=m.data1,W=m.data2,k=K;if(K&&W&&(k=Object(p.appendUint8Array)(K,W)),!k||!k.length)return;var b={type:m.type,frag:T,part:j,chunkMeta:N,parent:T.type,data:k};this.hls.trigger(F.Events.BUFFER_APPENDING,b),m.dropped&&m.independent&&!j&&this.flushBufferGap(T)},h.flushBufferGap=function(m){var T=this.media;if(!T)return;if(!H.BufferHelper.isBuffered(T,T.currentTime)){this.flushMainBuffer(0,m.start);return}var j=T.currentTime,N=H.BufferHelper.bufferInfo(T,j,0),K=m.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),k=Math.max(Math.min(m.start-W,N.end-W),j+W);m.start-k>W&&this.flushMainBuffer(k,m.start)},h.getFwdBufferInfo=function(m,T){var j=this.config,N=this.getLoadPosition();if(!Object(Y.isFiniteNumber)(N))return null;var K=H.BufferHelper.bufferInfo(m,N,j.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(N,T);if(W&&K.nextStart<W.end)return H.BufferHelper.bufferInfo(m,N,Math.max(K.nextStart,j.maxBufferHole))}return K},h.getMaxBufferLength=function(m){var T=this.config,j;return m?j=Math.max(8*T.maxBufferSize/m,T.maxBufferLength):j=T.maxBufferLength,Math.min(j,T.maxMaxBufferLength)},h.reduceMaxBufferLength=function(m){var T=this.config,j=m||T.maxBufferLength;return T.maxMaxBufferLength>=j?(T.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+T.maxMaxBufferLength+"s"),!0):!1},h.getNextFragment=function(m,T){var j,N,K=T.fragments,W=K.length;if(!W)return null;var k=this.config,b=K[0].start,G;if(T.live){var J=k.initialLiveManifestSize;if(W<J)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+J+")"),null;!T.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(G=this.getInitialLiveFragment(T,K),this.startPosition=G?this.hls.liveSyncPosition||G.start:m)}else m<=b&&(G=K[0]);if(!G){var oe=k.lowLatencyMode?T.partEnd:T.fragmentEnd;G=this.getFragmentAtPosition(m,oe,T)}return(j=G)!==null&&j!==void 0&&j.initSegment&&!((N=G)!==null&&N!==void 0&&N.initSegment.data)&&!this.bitrateTest&&(G=G.initSegment),G},h.getNextPart=function(m,T,j){for(var N=-1,K=!1,W=!0,k=0,b=m.length;k<b;k++){var G=m[k];if(W=W&&!G.independent,N>-1&&j<G.start)break;var J=G.loaded;!J&&(K||G.independent||W)&&G.fragment===T&&(N=k),K=J}return N},h.loadedEndOfParts=function(m,T){var j=m[m.length-1];return j&&T>j.start&&j.loaded},h.getInitialLiveFragment=function(m,T){var j=this.fragPrevious,N=null;if(j){if(m.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+j.programDateTime),N=Object(l.findFragmentByPDT)(T,j.endProgramDateTime,this.config.maxFragLookUpTolerance)),!N){var K=j.sn+1;if(K>=m.startSN&&K<=m.endSN){var W=T[K-m.startSN];j.cc===W.cc&&(N=W,this.log("Live playlist, switching playlist, load frag with next SN: "+N.sn))}N||(N=Object(l.findFragWithCC)(T,j.cc),N&&this.log("Live playlist, switching playlist, load frag with same CC: "+N.sn))}}else{var k=this.hls.liveSyncPosition;k!==null&&(N=this.getFragmentAtPosition(k,this.bitrateTest?m.fragmentEnd:m.edge,m))}return N},h.getFragmentAtPosition=function(m,T,j){var N=this.config,K=this.fragPrevious,W=j.fragments,k=j.endSN,b=j.fragmentHint,G=N.maxFragLookUpTolerance,J=!!(N.lowLatencyMode&&j.partList&&b);J&&b&&!this.bitrateTest&&(W=W.concat(b),k=b.sn);var oe;if(m<T){var fe=m>T-G?0:G;oe=Object(l.findFragmentByPTS)(K,W,m,fe)}else oe=W[W.length-1];if(oe){var Ne=oe.sn-j.startSN,_e=K&&oe.level===K.level,Fe=W[Ne+1],We=this.fragmentTracker.getState(oe);if(We===U.FragmentState.BACKTRACKED){oe=null;for(var Ue=Ne;W[Ue]&&this.fragmentTracker.getState(W[Ue])===U.FragmentState.BACKTRACKED;)K?oe=W[Ue--]:oe=W[--Ue];oe||(oe=Fe)}else K&&oe.sn===K.sn&&!J&&(_e&&(oe.sn<k&&this.fragmentTracker.getState(Fe)!==U.FragmentState.OK?(this.log("SN "+oe.sn+" just loaded, load next one: "+Fe.sn),oe=Fe):oe=null))}return oe},h.synchronizeToLiveEdge=function(m){var T=this.config,j=this.media;if(!j)return;var N=this.hls.liveSyncPosition,K=j.currentTime,W=m.fragments[0].start,k=m.edge,b=K>=W-T.maxFragLookUpTolerance&&K<=k;if(N!==null&&j.duration>N&&(K<N||!b)){var G=T.liveMaxLatencyDuration!==void 0?T.liveMaxLatencyDuration:T.liveMaxLatencyDurationCount*m.targetduration;(!b&&j.readyState<4||K<k-G)&&(this.loadedmetadata||(this.nextLoadPosition=N),j.readyState&&(this.warn("Playback: "+K.toFixed(3)+" is located too far from the end of live sliding playlist: "+k+", reset currentTime to : "+N.toFixed(3)),j.currentTime=N))}},h.alignPlaylists=function(m,T){var j=this.levels,N=this.levelLastLoaded,K=this.fragPrevious,W=N!==null?j[N]:null,k=m.fragments.length;if(!k)return this.warn("No fragments in live playlist"),0;var b=m.fragments[0].start,G=!T,J=m.alignedSliding&&Object(Y.isFiniteNumber)(b);if(G||!J&&!b){Object(d.alignStream)(K,W,m);var oe=m.fragments[0].start;return this.log("Live playlist sliding: "+oe.toFixed(2)+" start-sn: "+(T?T.startSN:"na")+"->"+m.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+k),oe}return b},h.waitForCdnTuneIn=function(m){var T=3;return m.live&&m.canBlockReload&&m.tuneInGoal>Math.max(m.partHoldBack,m.partTarget*T)},h.setStartPosition=function(m,T){var j=this.startPosition;if(j<T&&(j=-1),j===-1||this.lastCurrentTime===-1){var N=m.startTimeOffset;Object(Y.isFiniteNumber)(N)?(j=T+N,N<0&&(j+=m.totalduration),j=Math.min(Math.max(T,j),T+m.totalduration),this.log("Start time offset "+N+" found in playlist, adjust startPosition to "+j),this.startPosition=j):m.live?j=this.hls.liveSyncPosition||T:this.startPosition=j=0,this.lastCurrentTime=j}this.nextLoadPosition=j},h.getLoadPosition=function(){var m=this.media,T=0;return this.loadedmetadata&&m?T=m.currentTime:this.nextLoadPosition&&(T=this.nextLoadPosition),T},h.handleFragLoadAborted=function(m,T){this.transmuxer&&m.sn!=="initSegment"&&m.stats.aborted&&(this.warn("Fragment "+m.sn+(T?" part"+T.index:"")+" of level "+m.level+" was aborted"),this.resetFragmentLoading(m))},h.resetFragmentLoading=function(m){(!this.fragCurrent||!this.fragContextChanged(m))&&(this.state=w.IDLE)},h.onFragmentOrKeyLoadError=function(m,T){if(T.fatal)return;var j=T.frag;if(!j||j.type!==m)return;var N=this.fragCurrent;console.assert(N&&j.sn===N.sn&&j.level===N.level&&j.urlId===N.urlId,"Frag load error must match current frag to retry");var K=this.config;if(this.fragLoadError+1<=K.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(j.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*K.fragLoadingRetryDelay,K.fragLoadingMaxRetryTimeout);this.warn("Fragment "+j.sn+" of "+m+" "+j.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=w.FRAG_LOADING_WAITING_RETRY}else T.levelRetry?(m===o.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=w.IDLE):(I.logger.error(T.details+" reaches max retry, redispatch as fatal ..."),T.fatal=!0,this.hls.stopLoad(),this.state=w.ERROR)},h.afterBufferFlushed=function(m,T,j){if(!m)return;var N=H.BufferHelper.getBuffered(m);this.fragmentTracker.detectEvictedFragments(T,N,j),this.state===w.ENDED&&this.resetLoadingState()},h.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=w.IDLE},h.resetLiveStartWhenNotLoaded=function(m){if(!this.loadedmetadata){this.startFragRequested=!1;var T=this.levels?this.levels[m].details:null;if(T!=null&&T.live)return this.startPosition=-1,this.setStartPosition(T,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},h.updateLevelTiming=function(m,T,j,N){var K=this,W=j.details;console.assert(!!W,"level.details must be defined");var k=Object.keys(m.elementaryStreams).reduce(function(b,G){var J=m.elementaryStreams[G];if(J){var oe=J.endPTS-J.startPTS;if(oe<=0)return K.warn("Could not parse fragment "+m.sn+" "+G+" duration reliably ("+oe+") resetting transmuxer to fallback to playlist timing"),K.resetTransmuxer(),b||!1;var fe=N?0:Object(n.updateFragPTSDTS)(W,m,J.startPTS,J.endPTS,J.startDTS,J.endDTS);return K.hls.trigger(F.Events.LEVEL_PTS_UPDATED,{details:W,level:j,drift:fe,type:G,frag:m,start:J.startPTS,end:J.endPTS}),!0}return b},!1);k?(this.state=w.PARSED,this.hls.trigger(F.Events.FRAG_PARSED,{frag:m,part:T})):this.resetLoadingState()},h.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},L(y,[{key:"state",get:function(){return this._state},set:function(m){var T=this._state;T!==m&&(this._state=m,this.log(T+"->"+m))}}]),y}(D.default)},"./src/controller/buffer-controller.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return l});var Y=P("./src/polyfills/number.ts"),D=P("./src/events.ts"),U=P("./src/utils/logger.ts"),H=P("./src/errors.ts"),I=P("./src/utils/buffer-helper.ts"),F=P("./src/utils/mediasource-helper.ts"),R=P("./src/loader/fragment.ts"),g=P("./src/controller/buffer-operation-queue.ts"),p=Object(F.getMediaSource)(),d=/([ha]vc.)(?:\.[^.,]+)+/,l=function(){function n(s){var a=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 o=a.hls,f=a.media,L=a.mediaSource;U.logger.log("[buffer-controller]: Media source opened"),f&&(a.updateMediaElementDuration(),o.trigger(D.Events.MEDIA_ATTACHED,{media:f})),L&&L.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){U.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){U.logger.log("[buffer-controller]: Media source ended")},this.hls=s,this._initSourceBuffer(),this.registerListeners()}var c=n.prototype;return c.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},c.destroy=function(){this.unregisterListeners(),this.details=null},c.registerListeners=function(){var a=this.hls;a.on(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(D.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(D.Events.BUFFER_RESET,this.onBufferReset,this),a.on(D.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(D.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(D.Events.BUFFER_EOS,this.onBufferEos,this),a.on(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(D.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(D.Events.FRAG_PARSED,this.onFragParsed,this),a.on(D.Events.FRAG_CHANGED,this.onFragChanged,this)},c.unregisterListeners=function(){var a=this.hls;a.off(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(D.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(D.Events.BUFFER_RESET,this.onBufferReset,this),a.off(D.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(D.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(D.Events.BUFFER_EOS,this.onBufferEos,this),a.off(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(D.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(D.Events.FRAG_PARSED,this.onFragParsed,this),a.off(D.Events.FRAG_CHANGED,this.onFragChanged,this)},c._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},c.onManifestParsed=function(a,o){var f=2;(o.audio&&!o.video||!o.altAudio)&&(f=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=f,this.details=null,U.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},c.onMediaAttaching=function(a,o){var f=this.media=o.media;if(f&&p){var L=this.mediaSource=new p;L.addEventListener("sourceopen",this._onMediaSourceOpen),L.addEventListener("sourceended",this._onMediaSourceEnded),L.addEventListener("sourceclose",this._onMediaSourceClose),f.src=self.URL.createObjectURL(L),this._objectUrl=f.src}},c.onMediaDetaching=function(){var a=this.media,o=this.mediaSource,f=this._objectUrl;if(o){if(U.logger.log("[buffer-controller]: media source detaching"),o.readyState==="open")try{o.endOfStream()}catch(L){U.logger.warn("[buffer-controller]: onMediaDetaching: "+L.message+" while calling endOfStream")}this.onBufferReset(),o.removeEventListener("sourceopen",this._onMediaSourceOpen),o.removeEventListener("sourceended",this._onMediaSourceEnded),o.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(f&&self.URL.revokeObjectURL(f),a.src===f?(a.removeAttribute("src"),a.load()):U.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(D.Events.MEDIA_DETACHED,void 0)},c.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(o){var f=a.sourceBuffer[o];try{f&&(a.removeBufferListeners(o),a.mediaSource&&a.mediaSource.removeSourceBuffer(f),a.sourceBuffer[o]=void 0)}catch(L){U.logger.warn("[buffer-controller]: Failed to reset the "+o+" buffer",L)}}),this._initSourceBuffer()},c.onBufferCodecs=function(a,o){var f=this,L=this.getSourceBufferTypes().length;if(Object.keys(o).forEach(function(C){if(L){var x=f.tracks[C];if(x&&typeof x.buffer.changeType=="function"){var A=o[C],w=A.codec,_=A.levelCodec,S=A.container,y=(x.levelCodec||x.codec).replace(d,"$1"),h=(_||w).replace(d,"$1");if(y!==h){var E=S+";codecs="+(_||w);f.appendChangeType(C,E)}}}else f.pendingTracks[C]=o[C]}),L)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},c.appendChangeType=function(a,o){var f=this,L=this.operationQueue,C={execute:function(){var A=f.sourceBuffer[a];A&&(U.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+o),A.changeType(o)),L.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(A){U.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",A)}};L.append(C,a)},c.onBufferAppending=function(a,o){var f=this,L=this.hls,C=this.operationQueue,x=this.tracks,A=o.data,w=o.type,_=o.frag,S=o.part,y=o.chunkMeta,h=y.buffering[w],E=self.performance.now();h.start=E;var m=_.stats.buffering,T=S?S.stats.buffering:null;m.start===0&&(m.start=E),T&&T.start===0&&(T.start=E);var j=x.audio,N=w==="audio"&&y.id===1&&(j==null?void 0:j.container)==="audio/mpeg",K={execute:function(){if(h.executeStart=self.performance.now(),N){var k=f.sourceBuffer[w];if(k){var b=_.start-k.timestampOffset;Math.abs(b)>=.1&&(U.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+_.start+" (delta: "+b+") sn: "+_.sn+")"),k.timestampOffset=_.start)}}f.appendExecutor(A,w)},onStart:function(){},onComplete:function(){var k=self.performance.now();h.executeEnd=h.end=k,m.first===0&&(m.first=k),T&&T.first===0&&(T.first=k);var b=f.sourceBuffer,G={};for(var J in b)G[J]=I.BufferHelper.getBuffered(b[J]);f.appendError=0,f.hls.trigger(D.Events.BUFFER_APPENDED,{type:w,frag:_,part:S,chunkMeta:y,parent:_.type,timeRanges:G})},onError:function(k){U.logger.error("[buffer-controller]: Error encountered while trying to append to the "+w+" SourceBuffer",k);var b={type:H.ErrorTypes.MEDIA_ERROR,parent:_.type,details:H.ErrorDetails.BUFFER_APPEND_ERROR,err:k,fatal:!1};k.code===DOMException.QUOTA_EXCEEDED_ERR?b.details=H.ErrorDetails.BUFFER_FULL_ERROR:(f.appendError++,b.details=H.ErrorDetails.BUFFER_APPEND_ERROR,f.appendError>L.config.appendErrorMaxRetry&&(U.logger.error("[buffer-controller]: Failed "+L.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),b.fatal=!0)),L.trigger(D.Events.ERROR,b)}};C.append(K,w)},c.onBufferFlushing=function(a,o){var f=this,L=this.operationQueue,C=function(A){return{execute:f.removeExecutor.bind(f,A,o.startOffset,o.endOffset),onStart:function(){},onComplete:function(){f.hls.trigger(D.Events.BUFFER_FLUSHED,{type:A})},onError:function(_){U.logger.warn("[buffer-controller]: Failed to remove from "+A+" SourceBuffer",_)}}};o.type?L.append(C(o.type),o.type):this.getSourceBufferTypes().forEach(function(x){L.append(C(x),x)})},c.onFragParsed=function(a,o){var f=this,L=o.frag,C=o.part,x=[],A=C?C.elementaryStreams:L.elementaryStreams;A[R.ElementaryStreamTypes.AUDIOVIDEO]?x.push("audiovideo"):(A[R.ElementaryStreamTypes.AUDIO]&&x.push("audio"),A[R.ElementaryStreamTypes.VIDEO]&&x.push("video"));var w=function(){var S=self.performance.now();L.stats.buffering.end=S,C&&(C.stats.buffering.end=S);var y=C?C.stats:L.stats;f.hls.trigger(D.Events.FRAG_BUFFERED,{frag:L,part:C,stats:y,id:L.type})};x.length===0&&U.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+L.type+" level: "+L.level+" sn: "+L.sn),this.blockBuffers(w,x)},c.onFragChanged=function(a,o){this.flushBackBuffer()},c.onBufferEos=function(a,o){var f=this,L=this.getSourceBufferTypes().reduce(function(C,x){var A=f.sourceBuffer[x];return(!o.type||o.type===x)&&(A&&!A.ended&&(A.ended=!0,U.logger.log("[buffer-controller]: "+x+" sourceBuffer now EOS"))),C&&!!(!A||A.ended)},!0);L&&this.blockBuffers(function(){var C=f.mediaSource;if(!C||C.readyState!=="open")return;C.endOfStream()})},c.onLevelUpdated=function(a,o){var f=o.details;if(!f.fragments.length)return;this.details=f,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},c.flushBackBuffer=function(){var a=this.hls,o=this.details,f=this.media,L=this.sourceBuffer;if(!f||o===null)return;var C=this.getSourceBufferTypes();if(!C.length)return;var x=o.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(Y.isFiniteNumber)(x)||x<0)return;var A=f.currentTime,w=o.levelTargetDuration,_=Math.max(x,w),S=Math.floor(A/w)*w-_;C.forEach(function(y){var h=L[y];if(h){var E=I.BufferHelper.getBuffered(h);E.length>0&&S>E.start(0)&&(a.trigger(D.Events.BACK_BUFFER_REACHED,{bufferEnd:S}),o.live&&a.trigger(D.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:S}),a.trigger(D.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:S,type:y}))}})},c.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,o=this.hls,f=this.media,L=this.mediaSource,C=a.fragments[0].start+a.totalduration,x=f.duration,A=Object(Y.isFiniteNumber)(L.duration)?L.duration:0;a.live&&o.config.liveDurationInfinity?(U.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),L.duration=Infinity,this.updateSeekableRange(a)):(C>A&&C>x||!Object(Y.isFiniteNumber)(x))&&(U.logger.log("[buffer-controller]: Updating Media Source duration to "+C.toFixed(3)),L.duration=C)},c.updateSeekableRange=function(a){var o=this.mediaSource,f=a.fragments,L=f.length;if(L&&a.live&&o!==null&&o!==void 0&&o.setLiveSeekableRange){var C=Math.max(0,f[0].start),x=Math.max(C,C+a.totalduration);o.setLiveSeekableRange(C,x)}},c.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,o=this.operationQueue,f=this.pendingTracks,L=Object.keys(f).length;if(L&&!a||L===2){this.createSourceBuffers(f),this.pendingTracks={};var C=this.getSourceBufferTypes();if(C.length===0){this.hls.trigger(D.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}C.forEach(function(x){o.executeNext(x)})}},c.createSourceBuffers=function(a){var o=this.sourceBuffer,f=this.mediaSource;if(!f)throw Error("createSourceBuffers called when mediaSource was null");var L=0;for(var C in a)if(!o[C]){var x=a[C];if(!x)throw Error("source buffer exists for track "+C+", however track does not");var A=x.levelCodec||x.codec,w=x.container+";codecs="+A;U.logger.log("[buffer-controller]: creating sourceBuffer("+w+")");try{var _=o[C]=f.addSourceBuffer(w),S=C;this.addBufferListener(S,"updatestart",this._onSBUpdateStart),this.addBufferListener(S,"updateend",this._onSBUpdateEnd),this.addBufferListener(S,"error",this._onSBUpdateError),this.tracks[C]={buffer:_,codec:A,container:x.container,levelCodec:x.levelCodec,id:x.id},L++}catch(y){U.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+y.message),this.hls.trigger(D.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:y,mimeType:w})}}L&&this.hls.trigger(D.Events.BUFFER_CREATED,{tracks:this.tracks})},c._onSBUpdateStart=function(a){var o=this.operationQueue,f=o.current(a);f.onStart()},c._onSBUpdateEnd=function(a){var o=this.operationQueue,f=o.current(a);f.onComplete(),o.shiftAndExecuteNext(a)},c._onSBUpdateError=function(a,o){U.logger.error("[buffer-controller]: "+a+" SourceBuffer error",o),this.hls.trigger(D.Events.ERROR,{type:H.ErrorTypes.MEDIA_ERROR,details:H.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var f=this.operationQueue.current(a);f&&f.onError(o)},c.removeExecutor=function(a,o,f){var L=this.media,C=this.mediaSource,x=this.operationQueue,A=this.sourceBuffer,w=A[a];if(!L||!C||!w){U.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),x.shiftAndExecuteNext(a);return}var _=Object(Y.isFiniteNumber)(L.duration)?L.duration:Infinity,S=Object(Y.isFiniteNumber)(C.duration)?C.duration:Infinity,y=Math.max(0,o),h=Math.min(f,_,S);h>y?(U.logger.log("[buffer-controller]: Removing ["+y+","+h+"] from the "+a+" SourceBuffer"),console.assert(!w.updating,a+" sourceBuffer must not be updating"),w.remove(y,h)):x.shiftAndExecuteNext(a)},c.appendExecutor=function(a,o){var f=this.operationQueue,L=this.sourceBuffer,C=L[o];if(!C){U.logger.warn("[buffer-controller]: Attempting to append to the "+o+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(o);return}C.ended=!1,console.assert(!C.updating,o+" sourceBuffer must not be updating"),C.appendBuffer(a)},c.blockBuffers=function(a,o){var f=this;if(o===void 0&&(o=this.getSourceBufferTypes()),!o.length){U.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var L=this.operationQueue,C=o.map(function(x){return L.appendBlocker(x)});Promise.all(C).then(function(){a(),o.forEach(function(x){var A=f.sourceBuffer[x];(!A||!A.updating)&&L.shiftAndExecuteNext(x)})})},c.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},c.addBufferListener=function(a,o,f){var L=this.sourceBuffer[a];if(!L)return;var C=f.bind(this,a);this.listeners[a].push({event:o,listener:C}),L.addEventListener(o,C)},c.removeBufferListeners=function(a){var o=this.sourceBuffer[a];if(!o)return;this.listeners[a].forEach(function(f){o.removeEventListener(f.event,f.listener)})},n}()},"./src/controller/buffer-operation-queue.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return D});var Y=P("./src/utils/logger.ts"),D=function(){function U(I){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=I}var H=U.prototype;return H.append=function(F,R){var g=this.queues[R];g.push(F),g.length===1&&this.buffers[R]&&this.executeNext(R)},H.insertAbort=function(F,R){var g=this.queues[R];g.unshift(F),this.executeNext(R)},H.appendBlocker=function(F){var R,g=new Promise(function(d){R=d}),p={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(p,F),g},H.executeNext=function(F){var R=this.buffers,g=this.queues,p=R[F],d=g[F];if(d.length){var l=d[0];try{l.execute()}catch(n){Y.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),l.onError(n),(!p||!p.updating)&&(d.shift(),this.executeNext(F))}}},H.shiftAndExecuteNext=function(F){this.queues[F].shift(),this.executeNext(F)},H.current=function(F){return this.queues[F][0]},U}()},"./src/controller/cap-level-controller.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/events.ts");function D(I,F){for(var R=0;R<F.length;R++){var g=F[R];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(I,g.key,g)}}function U(I,F,R){return F&&D(I.prototype,F),R&&D(I,R),I}var H=function(){function I(R){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=R,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var F=I.prototype;return F.setStreamController=function(g){this.streamController=g},F.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},F.registerListeners=function(){var g=this.hls;g.on(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},F.unregisterListener=function(){var g=this.hls;g.off(Y.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(Y.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},F.onFpsDropLevelCapping=function(g,p){I.isLevelAllowed(p.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(p.droppedLevel)},F.onMediaAttaching=function(g,p){this.media=p.media instanceof HTMLVideoElement?p.media:null},F.onManifestParsed=function(g,p){var d=this.hls;this.restrictedLevels=[],this.firstLevel=p.firstLevel,d.config.capLevelToPlayerSize&&p.video&&this.startCapping()},F.onBufferCodecs=function(g,p){var d=this.hls;d.config.capLevelToPlayerSize&&p.video&&this.startCapping()},F.onMediaDetaching=function(){this.stopCapping()},F.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&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}}},F.getMaxLevel=function(g){var p=this,d=this.hls.levels;if(!d.length)return-1;var l=d.filter(function(n,c){return I.isLevelAllowed(c,p.restrictedLevels)&&c<=g});return this.clientRect=null,I.getMaxLevelByMediaSize(l,this.mediaWidth,this.mediaHeight)},F.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()},F.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},F.getDimensions=function(){if(this.clientRect)return this.clientRect;var g=this.media,p={width:0,height:0};if(g){var d=g.getBoundingClientRect();p.width=d.width,p.height=d.height,!p.width&&!p.height&&(p.width=d.right-d.left||g.width||0,p.height=d.bottom-d.top||g.height||0)}return this.clientRect=p,p},I.isLevelAllowed=function(g,p){return p===void 0&&(p=[]),p.indexOf(g)===-1},I.getMaxLevelByMediaSize=function(g,p,d){if(!g||!g.length)return-1;for(var l=function(o,f){return f?o.width!==f.width||o.height!==f.height:!0},n=g.length-1,c=0;c<g.length;c+=1){var s=g[c];if((s.width>=p||s.height>=d)&&l(s,g[c+1])){n=c;break}}return n},U(I,[{key:"mediaWidth",get:function(){return this.getDimensions().width*I.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*I.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var g=1;try{g=self.devicePixelRatio}catch(p){}return g}}]),I}();Q.default=H},"./src/controller/cmcd-controller.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return l});var Y=P("./src/events.ts"),D=P("./src/types/cmcd.ts"),U=P("./src/utils/buffer-helper.ts"),H=P("./src/utils/logger.ts");function I(n,c){for(var s=0;s<c.length;s++){var a=c[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(n,a.key,a)}}function F(n,c,s){return c&&I(n.prototype,c),s&&I(n,s),n}function R(n,c){var s=typeof Symbol!="undefined"&&n[Symbol.iterator]||n["@@iterator"];if(s)return(s=s.call(n)).next.bind(s);if(Array.isArray(n)||(s=g(n))||c&&n&&typeof n.length=="number"){s&&(n=s);var a=0;return function(){return a>=n.length?{done:!0}:{done:!1,value:n[a++]}}}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(n,c){if(!n)return;if(typeof n=="string")return p(n,c);var s=Object.prototype.toString.call(n).slice(8,-1);if(s==="Object"&&n.constructor&&(s=n.constructor.name),s==="Map"||s==="Set")return Array.from(n);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return p(n,c)}function p(n,c){(c==null||c>n.length)&&(c=n.length);for(var s=0,a=new Array(c);s<c;s++)a[s]=n[s];return a}function d(){return d=Object.assign||function(n){for(var c=1;c<arguments.length;c++){var s=arguments[c];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])}return n},d.apply(this,arguments)}var l=function(){function n(s){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(L){try{a.apply(L,{ot:D.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(C){H.logger.warn("Could not generate manifest CMCD data.",C)}},this.applyFragmentData=function(L){try{var C=L.frag,x=a.hls.levels[C.level],A=a.getObjectType(C),w={d:C.duration*1e3,ot:A};(A===D.CMCDObjectType.VIDEO||A===D.CMCDObjectType.AUDIO||A==D.CMCDObjectType.MUXED)&&(w.br=x.bitrate/1e3,w.tb=a.getTopBandwidth(A),w.bl=a.getBufferLength(A)),a.apply(L,w)}catch(_){H.logger.warn("Could not generate segment CMCD data.",_)}},this.hls=s;var o=this.config=s.config,f=o.cmcd;f!=null&&(o.pLoader=this.createPlaylistLoader(),o.fLoader=this.createFragmentLoader(),this.sid=f.sessionId||n.uuid(),this.cid=f.contentId,this.useHeaders=f.useHeaders===!0,this.registerListeners())}var c=n.prototype;return c.registerListeners=function(){var a=this.hls;a.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(Y.Events.BUFFER_CREATED,this.onBufferCreated,this)},c.unregisterListeners=function(){var a=this.hls;a.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(Y.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},c.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},c.onMediaAttached=function(a,o){this.media=o.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},c.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},c.onBufferCreated=function(a,o){var f,L;this.audioBuffer=(f=o.tracks.audio)===null||f===void 0?void 0:f.buffer,this.videoBuffer=(L=o.tracks.video)===null||L===void 0?void 0:L.buffer},c.createData=function(){var a;return{v:D.CMCDVersion,sf:D.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},c.apply=function(a,o){o===void 0&&(o={}),d(o,this.createData());var f=o.ot===D.CMCDObjectType.INIT||o.ot===D.CMCDObjectType.VIDEO||o.ot===D.CMCDObjectType.MUXED;if(this.starved&&f&&(o.bs=!0,o.su=!0,this.starved=!1),o.su==null&&(o.su=this.buffering),this.useHeaders){var L=n.toHeaders(o);if(!Object.keys(L).length)return;a.headers||(a.headers={}),d(a.headers,L)}else{var C=n.toQuery(o);if(!C)return;a.url=n.appendQueryToUri(a.url,C)}},c.getObjectType=function(a){var o=a.type;return o==="subtitle"?D.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?D.CMCDObjectType.INIT:o==="audio"?D.CMCDObjectType.AUDIO:o==="main"?this.hls.audioTracks.length?D.CMCDObjectType.VIDEO:D.CMCDObjectType.MUXED:void 0},c.getTopBandwidth=function(a){for(var o=0,f=a===D.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,L=R(f),C;!(C=L()).done;){var x=C.value;x.bitrate>o&&(o=x.bitrate)}return o>0?o:NaN},c.getBufferLength=function(a){var o=this.hls.media,f=a===D.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!f||!o)return NaN;var L=U.BufferHelper.bufferInfo(f,o.currentTime,this.config.maxBufferHole);return L.len*1e3},c.createPlaylistLoader=function(){var a=this.config.pLoader,o=this.applyPlaylistData,f=a||this.config.loader;return function(){function L(x){this.loader=void 0,this.loader=new f(x)}var C=L.prototype;return C.destroy=function(){this.loader.destroy()},C.abort=function(){this.loader.abort()},C.load=function(A,w,_){o(A),this.loader.load(A,w,_)},F(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},c.createFragmentLoader=function(){var a=this.config.fLoader,o=this.applyFragmentData,f=a||this.config.loader;return function(){function L(x){this.loader=void 0,this.loader=new f(x)}var C=L.prototype;return C.destroy=function(){this.loader.destroy()},C.abort=function(){this.loader.abort()},C.load=function(A,w,_){o(A),this.loader.load(A,w,_)},F(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},n.uuid=function(){var a=URL.createObjectURL(new Blob),o=a.toString();return URL.revokeObjectURL(a),o.substr(o.lastIndexOf("/")+1)},n.serialize=function(a){for(var o=[],f=function(N){return!Number.isNaN(N)&&N!=null&&N!==""&&N!==!1},L=function(N){return Math.round(N)},C=function(N){return L(N/100)*100},x=function(N){return encodeURIComponent(N)},A={br:L,d:L,bl:C,dl:C,mtp:C,nor:x,rtp:C,tb:L},w=Object.keys(a||{}).sort(),_=R(w),S;!(S=_()).done;){var y=S.value,h=a[y];if(!f(h))continue;if(y==="v"&&h===1)continue;if(y=="pr"&&h===1)continue;var E=A[y];E&&(h=E(h));var m=typeof h,T=void 0;y==="ot"||y==="sf"||y==="st"?T=y+"="+h:m==="boolean"?T=y:m==="number"?T=y+"="+h:T=y+"="+JSON.stringify(h),o.push(T)}return o.join(",")},n.toHeaders=function(a){for(var o=Object.keys(a),f={},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},A=0,w=o;A<w.length;A++){var _=w[A],S=x[_]!=null?x[_]:1;C[S][_]=a[_]}for(var y=0;y<C.length;y++){var h=n.serialize(C[y]);h&&(f["CMCD-"+L[y]]=h)}return f},n.toQuery=function(a){return"CMCD="+encodeURIComponent(n.serialize(a))},n.appendQueryToUri=function(a,o){if(!o)return a;var f=a.includes("?")?"&":"?";return""+a+f+o},n}()},"./src/controller/eme-controller.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/events.ts"),D=P("./src/errors.ts"),U=P("./src/utils/logger.ts"),H=P("./src/utils/mediakeys-helper.ts");function I(l,n){for(var c=0;c<n.length;c++){var s=n[c];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(l,s.key,s)}}function F(l,n,c){return n&&I(l.prototype,n),c&&I(l,c),l}var R=3,g=function(n,c,s){var a={audioCapabilities:[],videoCapabilities:[]};return n.forEach(function(o){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+o+'"',robustness:s.audioRobustness||""})}),c.forEach(function(o){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+o+'"',robustness:s.videoRobustness||""})}),[a]},p=function(n,c,s,a){switch(n){case H.KeySystems.WIDEVINE:return g(c,s,a);default:throw new Error("Unknown key-system: "+n)}},d=function(){function l(c){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=c,this._config=c.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var n=l.prototype;return n.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},n._registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},n._unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Y.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this)},n.getLicenseServerUrl=function(s){switch(s){case H.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+s+'"')},n._attemptKeySystemAccess=function(s,a,o){var f=this,L=p(s,a,o,this._drmSystemOptions);U.logger.log("Requesting encrypted media key-system access");var C=this.requestMediaKeySystemAccess(s,L);this.mediaKeysPromise=C.then(function(x){return f._onMediaKeySystemAccessObtained(s,x)}),C.catch(function(x){U.logger.error('Failed to obtain key-system "'+s+'" access:',x)})},n._onMediaKeySystemAccessObtained=function(s,a){var o=this;U.logger.log('Access for key-system "'+s+'" obtained');var f={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:s};this._mediaKeysList.push(f);var L=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(C){return f.mediaKeys=C,U.logger.log('Media-keys created for key-system "'+s+'"'),o._onMediaKeysCreated(),C});return L.catch(function(C){U.logger.error("Failed to create media-keys:",C)}),L},n._onMediaKeysCreated=function(){var s=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),s._onNewMediaKeySession(a.mediaKeysSession))})},n._onNewMediaKeySession=function(s){var a=this;U.logger.log("New key-system session "+s.sessionId),s.addEventListener("message",function(o){a._onKeySessionMessage(s,o.message)},!1)},n._onKeySessionMessage=function(s,a){U.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(o){U.logger.log("Received license data (length: "+(o&&o.byteLength)+"), updating key-session"),s.update(o)})},n.onMediaEncrypted=function(s){var a=this;if(U.logger.log('Media is encrypted using "'+s.initDataType+'" init data type'),!this.mediaKeysPromise){U.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Y.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var o=function(L){if(!a._media)return;a._attemptSetMediaKeys(L),a._generateRequestWithPreferredKeySession(s.initDataType,s.initData)};this.mediaKeysPromise.then(o).catch(o)},n._attemptSetMediaKeys=function(s){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){U.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}U.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},n._generateRequestWithPreferredKeySession=function(s,a){var o=this,f=this._mediaKeysList[0];if(!f){U.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(f.mediaKeysSessionInitialized){U.logger.warn("Key-Session already initialized but requested again");return}var L=f.mediaKeysSession;if(!L){U.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Y.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){U.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Y.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}U.logger.log('Generating key-session request for "'+s+'" init data type'),f.mediaKeysSessionInitialized=!0,L.generateRequest(s,a).then(function(){U.logger.debug("Key-session generation succeeded")}).catch(function(C){U.logger.error("Error generating key-session request:",C),o.hls.trigger(Y.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},n._createLicenseXhr=function(s,a,o){var f=new XMLHttpRequest;f.responseType="arraybuffer",f.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,f,s,a,o);var L=this._licenseXhrSetup;if(L)try{L.call(this.hls,f,s),L=void 0}catch(C){U.logger.error(C)}try{f.readyState||f.open("POST",s,!0),L&&L.call(this.hls,f,s)}catch(C){throw new Error("issue setting up KeySystem license XHR "+C)}return f},n._onLicenseRequestReadyStageChange=function(s,a,o,f){switch(s.readyState){case 4:if(s.status===200){this._requestLicenseFailureCount=0,U.logger.log("License request succeeded");var L=s.response,C=this._licenseResponseCallback;if(C)try{L=C.call(this.hls,s,a)}catch(A){U.logger.error(A)}f(L)}else{if(U.logger.error("License Request XHR failed ("+a+"). Status: "+s.status+" ("+s.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(Y.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var x=R-this._requestLicenseFailureCount+1;U.logger.warn("Retrying license request, "+x+" attempts left"),this._requestLicense(o,f)}break}},n._generateLicenseRequestChallenge=function(s,a){switch(s.mediaKeySystemDomain){case H.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+s.mediaKeySystemDomain)},n._requestLicense=function(s,a){U.logger.log("Requesting content license for key-system");var o=this._mediaKeysList[0];if(!o){U.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Y.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var f=this.getLicenseServerUrl(o.mediaKeySystemDomain),L=this._createLicenseXhr(f,s,a);U.logger.log("Sending license request to URL: "+f);var C=this._generateLicenseRequestChallenge(o,s);L.send(C)}catch(x){U.logger.error("Failure requesting DRM license: "+x),this.hls.trigger(Y.Events.ERROR,{type:D.ErrorTypes.KEY_SYSTEM_ERROR,details:D.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},n.onMediaAttached=function(s,a){if(!this._emeEnabled)return;var o=a.media;this._media=o,o.addEventListener("encrypted",this._onMediaEncrypted)},n.onMediaDetached=function(){var s=this._media,a=this._mediaKeysList;if(!s)return;s.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(o){if(o.mediaKeysSession)return o.mediaKeysSession.close().catch(function(){})})).then(function(){return s.setMediaKeys(null)}).catch(function(){})},n.onManifestParsed=function(s,a){if(!this._emeEnabled)return;var o=a.levels.map(function(L){return L.audioCodec}).filter(function(L){return!!L}),f=a.levels.map(function(L){return L.videoCodec}).filter(function(L){return!!L});this._attemptKeySystemAccess(H.KeySystems.WIDEVINE,o,f)},F(l,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),l}();Q.default=d},"./src/controller/fps-controller.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/events.ts"),D=P("./src/utils/logger.ts"),U=function(){function H(F){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=F,this.registerListeners()}var I=H.prototype;return I.setStreamController=function(R){this.streamController=R},I.registerListeners=function(){this.hls.on(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},I.unregisterListeners=function(){this.hls.off(Y.Events.MEDIA_ATTACHING,this.onMediaAttaching)},I.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},I.onMediaAttaching=function(R,g){var p=this.hls.config;if(p.capLevelOnFPSDrop){var d=g.media instanceof self.HTMLVideoElement?g.media:null;this.media=d,d&&typeof d.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),p.fpsDroppedMonitoringPeriod)}},I.checkFPS=function(R,g,p){var d=performance.now();if(g){if(this.lastTime){var l=d-this.lastTime,n=p-this.lastDroppedFrames,c=g-this.lastDecodedFrames,s=1e3*n/l,a=this.hls;if(a.trigger(Y.Events.FPS_DROP,{currentDropped:n,currentDecoded:c,totalDroppedFrames:p}),s>0&&n>a.config.fpsDroppedMonitoringThreshold*c){var o=a.currentLevel;D.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+o),o>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=o)&&(o=o-1,a.trigger(Y.Events.FPS_DROP_LEVEL_CAPPING,{level:o,droppedLevel:a.currentLevel}),a.autoLevelCapping=o,this.streamController.nextLevelSwitch())}}this.lastTime=d,this.lastDroppedFrames=p,this.lastDecodedFrames=g}},I.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)},H}();Q.default=U},"./src/controller/fragment-finders.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"findFragmentByPDT",function(){return U}),P.d(Q,"findFragmentByPTS",function(){return H}),P.d(Q,"fragmentWithinToleranceTest",function(){return I}),P.d(Q,"pdtWithinToleranceTest",function(){return F}),P.d(Q,"findFragWithCC",function(){return R});var Y=P("./src/polyfills/number.ts"),D=P("./src/utils/binary-search.ts");function U(g,p,d){if(p===null||!Array.isArray(g)||!g.length||!Object(Y.isFiniteNumber)(p))return null;var l=g[0].programDateTime;if(p<(l||0))return null;var n=g[g.length-1].endProgramDateTime;if(p>=(n||0))return null;d=d||0;for(var c=0;c<g.length;++c){var s=g[c];if(F(p,d,s))return s}return null}function H(g,p,d,l){d===void 0&&(d=0),l===void 0&&(l=0);var n=null;if(g?n=p[g.sn-p[0].sn+1]||null:d===0&&p[0].start===0&&(n=p[0]),n&&I(d,l,n)===0)return n;var c=D.default.search(p,I.bind(null,d,l));return c||n}function I(g,p,d){g===void 0&&(g=0),p===void 0&&(p=0);var l=Math.min(p,d.duration+(d.deltaPTS?d.deltaPTS:0));return d.start+d.duration-l<=g?1:d.start-l>g&&d.start?-1:0}function F(g,p,d){var l=Math.min(p,d.duration+(d.deltaPTS?d.deltaPTS:0))*1e3,n=d.endProgramDateTime||0;return n-l>g}function R(g,p){return D.default.search(g,function(d){return d.cc<p?1:d.cc>p?-1:0})}},"./src/controller/fragment-tracker.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"FragmentState",function(){return U}),P.d(Q,"FragmentTracker",function(){return H});var Y=P("./src/events.ts"),D=P("./src/types/loader.ts"),U;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(U||(U={}));var H=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 d=this.hls;d.on(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),d.on(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var d=this.hls;d.off(Y.Events.BUFFER_APPENDED,this.onBufferAppended,this),d.off(Y.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(Y.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(d,l){if(l===D.PlaylistLevelType.MAIN){var n=this.activeFragment,c=this.activeParts;if(!n)return null;if(c)for(var s=c.length;s--;){var a=c[s],o=a?a.end:n.appendedPTS;if(a.start<=d&&o!==void 0&&d<=o)return s>9&&(this.activeParts=c.slice(s-9)),a}else if(n.start<=d&&n.appendedPTS!==void 0&&d<=n.appendedPTS)return n}return this.getBufferedFrag(d,l)},g.getBufferedFrag=function(d,l){for(var n=this.fragments,c=Object.keys(n),s=c.length;s--;){var a=n[c[s]];if((a==null?void 0:a.body.type)===l&&a.buffered){var o=a.body;if(o.start<=d&&d<=o.end)return o}}return null},g.detectEvictedFragments=function(d,l,n){var c=this;Object.keys(this.fragments).forEach(function(s){var a=c.fragments[s];if(!a)return;if(!a.buffered){a.body.type===n&&c.removeFragment(a.body);return}var o=a.range[d];if(!o)return;o.time.some(function(f){var L=!c.isTimeBuffered(f.startPTS,f.endPTS,l);return L&&c.removeFragment(a.body),L})})},g.detectPartialFragments=function(d){var l=this,n=this.timeRanges,c=d.frag,s=d.part;if(!n||c.sn==="initSegment")return;var a=F(c),o=this.fragments[a];if(!o)return;Object.keys(n).forEach(function(f){var L=c.elementaryStreams[f];if(!L)return;var C=n[f],x=s!==null||L.partial===!0;o.range[f]=l.getBufferedTimes(c,s,x,C)}),o.backtrack=o.loaded=null,Object.keys(o.range).length?o.buffered=!0:this.removeFragment(o.body)},g.fragBuffered=function(d){var l=F(d),n=this.fragments[l];n&&(n.backtrack=n.loaded=null,n.buffered=!0)},g.getBufferedTimes=function(d,l,n,c){for(var s={time:[],partial:n},a=l?l.start:d.start,o=l?l.end:d.end,f=d.minEndPTS||o,L=d.maxStartPTS||a,C=0;C<c.length;C++){var x=c.start(C)-this.bufferPadding,A=c.end(C)+this.bufferPadding;if(L>=x&&f<=A){s.time.push({startPTS:Math.max(a,c.start(C)),endPTS:Math.min(o,c.end(C))});break}else if(a<A&&o>x)s.partial=!0,s.time.push({startPTS:Math.max(a,c.start(C)),endPTS:Math.min(o,c.end(C))});else if(o<=x)break}return s},g.getPartialFragment=function(d){var l=null,n,c,s,a=0,o=this.bufferPadding,f=this.fragments;return Object.keys(f).forEach(function(L){var C=f[L];if(!C)return;I(C)&&(c=C.body.start-o,s=C.body.end+o,d>=c&&d<=s&&(n=Math.min(d-c,s-d),a<=n&&(l=C.body,a=n)))}),l},g.getState=function(d){var l=F(d),n=this.fragments[l];return n?n.buffered?I(n)?U.PARTIAL:U.OK:n.backtrack?U.BACKTRACKED:U.APPENDING:U.NOT_LOADED},g.backtrack=function(d,l){var n=F(d),c=this.fragments[n];if(!c||c.backtrack)return null;var s=c.backtrack=l||c.loaded;return c.loaded=null,s},g.getBacktrackData=function(d){var l=F(d),n=this.fragments[l];if(n){var c,s=n.backtrack;if(s!=null&&(c=s.payload)!==null&&c!==void 0&&c.byteLength)return s;this.removeFragment(d)}return null},g.isTimeBuffered=function(d,l,n){for(var c,s,a=0;a<n.length;a++){if(c=n.start(a)-this.bufferPadding,s=n.end(a)+this.bufferPadding,d>=c&&l<=s)return!0;if(l<=c)return!1}return!1},g.onFragLoaded=function(d,l){var n=l.frag,c=l.part;if(n.sn==="initSegment"||n.bitrateTest||c)return;var s=F(n);this.fragments[s]={body:n,loaded:l,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(d,l){var n=this,c=l.frag,s=l.part,a=l.timeRanges;if(c.type===D.PlaylistLevelType.MAIN)if(this.activeFragment=c,s){var o=this.activeParts;o||(this.activeParts=o=[]),o.push(s)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(f){var L=a[f];if(n.detectEvictedFragments(f,L),!s)for(var C=0;C<L.length;C++)c.appendedPTS=Math.max(L.end(C),c.appendedPTS||0)})},g.onFragBuffered=function(d,l){this.detectPartialFragments(l)},g.hasFragment=function(d){var l=F(d);return!!this.fragments[l]},g.removeFragmentsInRange=function(d,l,n){var c=this;Object.keys(this.fragments).forEach(function(s){var a=c.fragments[s];if(!a)return;if(a.buffered){var o=a.body;o.type===n&&o.start<l&&o.end>d&&c.removeFragment(o)}})},g.removeFragment=function(d){var l=F(d);d.stats.loaded=0,d.clearElementaryStreamInfo(),delete this.fragments[l]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function I(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 F(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"STALL_MINIMUM_DURATION_MS",function(){return I}),P.d(Q,"MAX_START_GAP_JUMP",function(){return F}),P.d(Q,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),P.d(Q,"SKIP_BUFFER_RANGE_START",function(){return g}),P.d(Q,"default",function(){return p});var Y=P("./src/utils/buffer-helper.ts"),D=P("./src/errors.ts"),U=P("./src/events.ts"),H=P("./src/utils/logger.ts"),I=250,F=2,R=.1,g=.05,p=function(){function d(n,c,s,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=n,this.media=c,this.fragmentTracker=s,this.hls=a}var l=d.prototype;return l.destroy=function(){this.hls=this.fragmentTracker=this.media=null},l.poll=function(c){var s=this.config,a=this.media,o=this.stalled,f=a.currentTime,L=a.seeking,C=this.seeking&&!L,x=!this.seeking&&L;if(this.seeking=L,f!==c){if(this.moved=!0,o!==null){if(this.stallReported){var A=self.performance.now()-o;H.logger.warn("playback not stuck anymore @"+f+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((x||C)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!Y.BufferHelper.getBuffered(a).length)return;var w=Y.BufferHelper.bufferInfo(a,f,0),_=w.len>0,S=w.nextStart||0;if(!_&&!S)return;if(L){var y=w.len>F,h=!S||S-f>F&&!this.fragmentTracker.getPartialFragment(f);if(y||h)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var E,m=Math.max(S,w.start||0)-f,T=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,j=T==null||((E=T.details)===null||E===void 0)?void 0:E.live,N=j?T.details.targetduration*2:F;if(m>0&&m<=N){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(o===null){this.stalled=K;return}var W=K-o;!L&&W>=I&&this._reportStall(w.len);var k=Y.BufferHelper.bufferInfo(a,f,s.maxBufferHole);this._tryFixBufferStall(k,W)},l._tryFixBufferStall=function(c,s){var a=this.config,o=this.fragmentTracker,f=this.media,L=f.currentTime,C=o.getPartialFragment(L);if(C){var x=this._trySkipBufferHole(C);if(x)return}c.len>a.maxBufferHole&&s>a.highBufferWatchdogPeriod*1e3&&(H.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},l._reportStall=function(c){var s=this.hls,a=this.media,o=this.stallReported;o||(this.stallReported=!0,H.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+c+")"),s.trigger(U.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:c}))},l._trySkipBufferHole=function(c){for(var s=this.config,a=this.hls,o=this.media,f=o.currentTime,L=0,C=Y.BufferHelper.getBuffered(o),x=0;x<C.length;x++){var A=C.start(x);if(f+s.maxBufferHole>=L&&f<A){var w=Math.max(A+g,o.currentTime+R);return H.logger.warn("skipping hole, adjusting currentTime from "+f+" to "+w),this.moved=!0,this.stalled=null,o.currentTime=w,c&&a.trigger(U.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+f+" to "+w,frag:c}),w}L=C.end(x)}return 0},l._tryNudgeBuffer=function(){var c=this.config,s=this.hls,a=this.media,o=a.currentTime,f=(this.nudgeRetry||0)+1;if(this.nudgeRetry=f,f<c.nudgeMaxRetry){var L=o+f*c.nudgeOffset;H.logger.warn("Nudging 'currentTime' from "+o+" to "+L),a.currentTime=L,s.trigger(U.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else H.logger.error("Playhead still not moving while enough data buffered @"+o+" after "+c.nudgeMaxRetry+" nudges"),s.trigger(U.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},d}()},"./src/controller/id3-track-controller.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/events.ts"),D=P("./src/utils/texttrack-utils.ts"),U=P("./src/demux/id3.ts"),H=.25,I=function(){function F(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var R=F.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var p=this.hls;p.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var p=this.hls;p.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(Y.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),p.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(p,d){this.media=d.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(D.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(p){if(!this.media)return;for(var d=0;d<p.length;d++){var l=p[d];if(l.kind==="metadata"&&l.label==="id3")return Object(D.sendAddTrackEvent)(l,this.media),l}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(p,d){if(!this.media)return;var l=d.frag,n=d.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var c=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,s=0;s<n.length;s++){var a=U.getID3Frames(n[s].data);if(a){var o=n[s].pts,f=s<n.length-1?n[s+1].pts:l.end,L=f-o;L<=0&&(f=o+H);for(var C=0;C<a.length;C++){var x=a[C];if(!U.isTimeStampFrame(x)){var A=new c(o,f,"");A.value=x,this.id3Track.addCue(A)}}}}},R.onBufferFlushing=function(p,d){var l=d.startOffset,n=d.endOffset,c=d.type;if(!c||c==="audio"){var s=this.id3Track;s&&Object(D.removeCuesInRange)(s,l,n)}},F}();Q.default=I},"./src/controller/latency-controller.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return F});var Y=P("./src/errors.ts"),D=P("./src/events.ts"),U=P("./src/utils/logger.ts");function H(R,g){for(var p=0;p<g.length;p++){var d=g[p];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(R,d.key,d)}}function I(R,g,p){return g&&H(R.prototype,g),p&&H(R,p),R}var F=function(){function R(p){var d=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return d.timeupdate()},this.hls=p,this.config=p.config,this.registerListeners()}var g=R.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.registerListeners=function(){this.hls.on(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(D.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(D.Events.ERROR,this.onError,this)},g.unregisterListeners=function(){this.hls.off(D.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(D.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(D.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(D.Events.ERROR,this.onError)},g.onMediaAttached=function(d,l){this.media=l.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},g.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},g.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},g.onLevelUpdated=function(d,l){var n=l.details;this.levelDetails=n,n.advanced&&this.timeupdate(),!n.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},g.onError=function(d,l){if(l.details!==Y.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,U.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},g.timeupdate=function(){var d=this.media,l=this.levelDetails;if(!d||!l)return;this.currentTime=d.currentTime;var n=this.computeLatency();if(n===null)return;this._latency=n;var c=this.config,s=c.lowLatencyMode,a=c.maxLiveSyncPlaybackRate;if(!s||a===1)return;var o=this.targetLatency;if(o===null)return;var f=n-o,L=Math.min(this.maxLatency,o+l.targetduration),C=f<L;if(l.live&&C&&f>.05&&this.forwardBufferLength>1){var x=Math.min(2,Math.max(1,a)),A=Math.round(2/(1+Math.exp(-.75*f-this.edgeStalled))*20)/20;d.playbackRate=Math.min(x,Math.max(1,A))}else d.playbackRate!==1&&d.playbackRate!==0&&(d.playbackRate=1)},g.estimateLiveEdge=function(){var d=this.levelDetails;return d===null?null:d.edge+d.age},g.computeLatency=function(){var d=this.estimateLiveEdge();return d===null?null:d-this.currentTime},I(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var d=this.config,l=this.levelDetails;return d.liveMaxLatencyDuration!==void 0?d.liveMaxLatencyDuration:l?d.liveMaxLatencyDurationCount*l.targetduration:0}},{key:"targetLatency",get:function(){var d=this.levelDetails;if(d===null)return null;var l=d.holdBack,n=d.partHoldBack,c=d.targetduration,s=this.config,a=s.liveSyncDuration,o=s.liveSyncDurationCount,f=s.lowLatencyMode,L=this.hls.userConfig,C=f&&n||l;(L.liveSyncDuration||L.liveSyncDurationCount||C===0)&&(C=a!==void 0?a:o*c);var x=c,A=1;return C+Math.min(this.stallCount*A,x)}},{key:"liveSyncPosition",get:function(){var d=this.estimateLiveEdge(),l=this.targetLatency,n=this.levelDetails;if(d===null||l===null||n===null)return null;var c=n.edge,s=d-l-this.edgeStalled,a=c-n.totalduration,o=c-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(a,s),o)}},{key:"drift",get:function(){var d=this.levelDetails;return d===null?1:d.drift}},{key:"edgeStalled",get:function(){var d=this.levelDetails;if(d===null)return 0;var l=(this.config.lowLatencyMode&&d.partTarget||d.targetduration)*3;return Math.max(d.age-l,0)}},{key:"forwardBufferLength",get:function(){var d=this.media,l=this.levelDetails;if(!d||!l)return 0;var n=d.buffered.length;return n?d.buffered.end(n-1):l.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return s});var Y=P("./src/types/level.ts"),D=P("./src/events.ts"),U=P("./src/errors.ts"),H=P("./src/utils/codecs.ts"),I=P("./src/controller/level-helper.ts"),F=P("./src/controller/base-playlist-controller.ts"),R=P("./src/types/loader.ts");function g(){return g=Object.assign||function(a){for(var o=1;o<arguments.length;o++){var f=arguments[o];for(var L in f)Object.prototype.hasOwnProperty.call(f,L)&&(a[L]=f[L])}return a},g.apply(this,arguments)}function p(a,o){for(var f=0;f<o.length;f++){var L=o[f];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(a,L.key,L)}}function d(a,o,f){return o&&p(a.prototype,o),f&&p(a,f),a}function l(a,o){a.prototype=Object.create(o.prototype),a.prototype.constructor=a,n(a,o)}function n(a,o){return n=Object.setPrototypeOf||function(L,C){return L.__proto__=C,L},n(a,o)}var c=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),s=function(a){l(o,a);function o(L){var C;return C=a.call(this,L,"[level-controller]")||this,C._levels=[],C._firstLevel=-1,C._startLevel=void 0,C.currentLevelIndex=-1,C.manualLevelIndex=-1,C.onParsedComplete=void 0,C._registerListeners(),C}var f=o.prototype;return f._registerListeners=function(){var C=this.hls;C.on(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),C.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.on(D.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),C.on(D.Events.FRAG_LOADED,this.onFragLoaded,this),C.on(D.Events.ERROR,this.onError,this)},f._unregisterListeners=function(){var C=this.hls;C.off(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),C.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.off(D.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),C.off(D.Events.FRAG_LOADED,this.onFragLoaded,this),C.off(D.Events.ERROR,this.onError,this)},f.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},f.startLoad=function(){var C=this._levels;C.forEach(function(x){x.loadError=0}),a.prototype.startLoad.call(this)},f.onManifestLoaded=function(C,x){var A=[],w=[],_=[],S,y={},h,E=!1,m=!1,T=!1;if(x.levels.forEach(function(W){var k=W.attrs;E=E||!!(W.width&&W.height),m=m||!!W.videoCodec,T=T||!!W.audioCodec,c&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var b=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;h=y[b],h?h.url.push(W.url):(h=new Y.Level(W),y[b]=h,A.push(h)),k&&(k.AUDIO&&Object(I.addGroupId)(h,"audio",k.AUDIO),k.SUBTITLES&&Object(I.addGroupId)(h,"text",k.SUBTITLES))}),(E||m)&&T&&(A=A.filter(function(W){var k=W.videoCodec,b=W.width,G=W.height;return!!k||!!(b&&G)})),A=A.filter(function(W){var k=W.audioCodec,b=W.videoCodec;return(!k||Object(H.isCodecSupportedInMp4)(k,"audio"))&&(!b||Object(H.isCodecSupportedInMp4)(b,"video"))}),x.audioTracks&&(w=x.audioTracks.filter(function(W){return!W.audioCodec||Object(H.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(I.assignTrackIdsByGroup)(w)),x.subtitles&&(_=x.subtitles,Object(I.assignTrackIdsByGroup)(_)),A.length>0){S=A[0].bitrate,A.sort(function(W,k){return W.bitrate-k.bitrate}),this._levels=A;for(var j=0;j<A.length;j++)if(A[j].bitrate===S){this._firstLevel=j,this.log("manifest loaded, "+A.length+" level(s) found, first bitrate: "+S);break}var N=T&&!m,K={levels:A,audioTracks:w,subtitleTracks:_,firstLevel:this._firstLevel,stats:x.stats,audio:T,video:m,altAudio:!N&&w.some(function(W){return!!W.url})};this.hls.trigger(D.Events.MANIFEST_PARSED,K),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:x.url,reason:"no level with compatible codecs found in manifest"})},f.onError=function(C,x){if(a.prototype.onError.call(this,C,x),x.fatal)return;var A=x.context,w=this._levels[this.currentLevelIndex];if(A&&(A.type===R.PlaylistContextType.AUDIO_TRACK&&w.audioGroupIds&&A.groupId===w.audioGroupIds[w.urlId]||A.type===R.PlaylistContextType.SUBTITLE_TRACK&&w.textGroupIds&&A.groupId===w.textGroupIds[w.urlId])){this.redundantFailover(this.currentLevelIndex);return}var _=!1,S=!0,y;switch(x.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:case U.ErrorDetails.KEY_LOAD_ERROR:case U.ErrorDetails.KEY_LOAD_TIMEOUT:if(x.frag){var h=this._levels[x.frag.level];h?(h.fragmentError++,h.fragmentError>this.hls.config.fragLoadingMaxRetry&&(y=x.frag.level)):y=x.frag.level}break;case U.ErrorDetails.LEVEL_LOAD_ERROR:case U.ErrorDetails.LEVEL_LOAD_TIMEOUT:A&&(A.deliveryDirectives&&(S=!1),y=A.level),_=!0;break;case U.ErrorDetails.REMUX_ALLOC_ERROR:y=x.level,_=!0;break}y!==void 0&&this.recoverLevel(x,y,_,S)},f.recoverLevel=function(C,x,A,w){var _=C.details,S=this._levels[x];if(S.loadError++,A){var y=this.retryLoadingOrFail(C);if(y)C.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(w){var h=S.url.length;if(h>1&&S.loadError<h)C.levelRetry=!0,this.redundantFailover(x);else if(this.manualLevelIndex===-1){var E=x===0?this._levels.length-1:x-1;this.currentLevelIndex!==E&&this._levels[E].loadError===0&&(this.warn(_+": switch to "+E),C.levelRetry=!0,this.hls.nextAutoLevel=E)}}},f.redundantFailover=function(C){var x=this._levels[C],A=x.url.length;if(A>1){var w=(x.urlId+1)%A;this.warn("Switching to redundant URL-id "+w),this._levels.forEach(function(_){_.urlId=w}),this.level=C}},f.onFragLoaded=function(C,x){var A=x.frag;if(A!==void 0&&A.type===R.PlaylistLevelType.MAIN){var w=this._levels[A.level];w!==void 0&&(w.fragmentError=0,w.loadError=0)}},f.onLevelLoaded=function(C,x){var A,w=x.level,_=x.details,S=this._levels[w];if(!S){var y;this.warn("Invalid level index "+w),(y=x.deliveryDirectives)!==null&&y!==void 0&&y.skip&&(_.deltaUpdateFailed=!0);return}w===this.currentLevelIndex?(S.fragmentError===0&&(S.loadError=0,this.retryCount=0),this.playlistLoaded(w,x,S.details)):(A=x.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(_.deltaUpdateFailed=!0)},f.onAudioTrackSwitched=function(C,x){var A=this.hls.levels[this.currentLevelIndex];if(!A)return;if(A.audioGroupIds){for(var w=-1,_=this.hls.audioTracks[x.id].groupId,S=0;S<A.audioGroupIds.length;S++)if(A.audioGroupIds[S]===_){w=S;break}w!==A.urlId&&(A.urlId=w,this.startLoad())}},f.loadPlaylist=function(C){var x=this.currentLevelIndex,A=this._levels[x];if(this.canLoad&&A&&A.url.length>0){var w=A.urlId,_=A.url[w];if(C)try{_=C.addDirectives(_)}catch(S){this.warn("Could not construct new URL with HLS Delivery Directives: "+S)}this.log("Attempt loading level index "+x+(C?" at sn "+C.msn+" part "+C.part:"")+" with URL-id "+w+" "+_),this.clearTimer(),this.hls.trigger(D.Events.LEVEL_LOADING,{url:_,level:x,id:w,deliveryDirectives:C||null})}},f.removeLevel=function(C,x){var A=function(S,y){return y!==x},w=this._levels.filter(function(_,S){return S!==C?!0:_.url.length>1&&x!==void 0?(_.url=_.url.filter(A),_.audioGroupIds&&(_.audioGroupIds=_.audioGroupIds.filter(A)),_.textGroupIds&&(_.textGroupIds=_.textGroupIds.filter(A)),_.urlId=0,!0):!1}).map(function(_,S){var y=_.details;return y!=null&&y.fragments&&y.fragments.forEach(function(h){h.level=S}),_});this._levels=w,this.hls.trigger(D.Events.LEVELS_UPDATED,{levels:w})},d(o,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(C){var x,A=this._levels;if(A.length===0)return;if(this.currentLevelIndex===C&&(x=A[C])!==null&&x!==void 0&&x.details)return;if(C<0||C>=A.length){var w=C<0;if(this.hls.trigger(D.Events.ERROR,{type:U.ErrorTypes.OTHER_ERROR,details:U.ErrorDetails.LEVEL_SWITCH_ERROR,level:C,fatal:w,reason:"invalid level idx"}),w)return;C=Math.min(C,A.length-1)}this.clearTimer();var _=this.currentLevelIndex,S=A[_],y=A[C];this.log("switching to level "+C+" from "+_),this.currentLevelIndex=C;var h=g({},y,{level:C,maxBitrate:y.maxBitrate,uri:y.uri,urlId:y.urlId});delete h._urlId,this.hls.trigger(D.Events.LEVEL_SWITCHING,h);var E=y.details;if(!E||E.live){var m=this.switchParams(y.uri,S==null?void 0:S.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)}}]),o}(F.default)},"./src/controller/level-helper.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"addGroupId",function(){return U}),P.d(Q,"assignTrackIdsByGroup",function(){return H}),P.d(Q,"updatePTS",function(){return I}),P.d(Q,"updateFragPTSDTS",function(){return R}),P.d(Q,"mergeDetails",function(){return g}),P.d(Q,"mapPartIntersection",function(){return p}),P.d(Q,"mapFragmentIntersection",function(){return d}),P.d(Q,"adjustSliding",function(){return l}),P.d(Q,"addSliding",function(){return n}),P.d(Q,"computeReloadInterval",function(){return c}),P.d(Q,"getFragmentWithSN",function(){return s}),P.d(Q,"getPartWith",function(){return a});var Y=P("./src/polyfills/number.ts"),D=P("./src/utils/logger.ts");function U(o,f,L){switch(f){case"audio":o.audioGroupIds||(o.audioGroupIds=[]),o.audioGroupIds.push(L);break;case"text":o.textGroupIds||(o.textGroupIds=[]),o.textGroupIds.push(L);break}}function H(o){var f={};o.forEach(function(L){var C=L.groupId||"";L.id=f[C]=f[C]||0,f[C]++})}function I(o,f,L){var C=o[f],x=o[L];F(C,x)}function F(o,f){var L=f.startPTS;if(Object(Y.isFiniteNumber)(L)){var C=0,x;f.sn>o.sn?(C=L-o.start,x=o):(C=o.start-L,x=f),x.duration!==C&&(x.duration=C)}else if(f.sn>o.sn){var A=o.cc===f.cc;A&&o.minEndPTS?f.start=o.start+(o.minEndPTS-o.start):f.start=o.start+o.duration}else f.start=Math.max(o.start-f.duration,0)}function R(o,f,L,C,x,A){var w=C-L;w<=0&&(D.logger.warn("Fragment should have a positive duration",f),C=L+f.duration,A=x+f.duration);var _=L,S=C,y=f.startPTS,h=f.endPTS;if(Object(Y.isFiniteNumber)(y)){var E=Math.abs(y-L);Object(Y.isFiniteNumber)(f.deltaPTS)?f.deltaPTS=Math.max(E,f.deltaPTS):f.deltaPTS=E,_=Math.max(L,y),L=Math.min(L,y),x=Math.min(x,f.startDTS),S=Math.min(C,h),C=Math.max(C,h),A=Math.max(A,f.endDTS)}f.duration=C-L;var m=L-f.start;f.appendedPTS=C,f.start=f.startPTS=L,f.maxStartPTS=_,f.startDTS=x,f.endPTS=C,f.minEndPTS=S,f.endDTS=A;var T=f.sn;if(!o||T<o.startSN||T>o.endSN)return 0;var j,N=T-o.startSN,K=o.fragments;for(K[N]=f,j=N;j>0;j--)F(K[j],K[j-1]);for(j=N;j<K.length-1;j++)F(K[j],K[j+1]);return o.fragmentHint&&F(K[K.length-1],o.fragmentHint),o.PTSKnown=o.alignedSliding=!0,m}function g(o,f){for(var L=null,C=o.fragments,x=C.length-1;x>=0;x--){var A=C[x].initSegment;if(A){L=A;break}}o.fragmentHint&&delete o.fragmentHint.endPTS;var w=0,_;if(d(o,f,function(j,N){j.relurl&&(w=j.cc-N.cc),Object(Y.isFiniteNumber)(j.startPTS)&&Object(Y.isFiniteNumber)(j.endPTS)&&(N.start=N.startPTS=j.startPTS,N.startDTS=j.startDTS,N.appendedPTS=j.appendedPTS,N.maxStartPTS=j.maxStartPTS,N.endPTS=j.endPTS,N.endDTS=j.endDTS,N.minEndPTS=j.minEndPTS,N.duration=j.endPTS-j.startPTS,N.duration&&(_=N),f.PTSKnown=f.alignedSliding=!0),N.elementaryStreams=j.elementaryStreams,N.loader=j.loader,N.stats=j.stats,N.urlId=j.urlId,j.initSegment&&(N.initSegment=j.initSegment,L=j.initSegment)}),L){var S=f.fragmentHint?f.fragments.concat(f.fragmentHint):f.fragments;S.forEach(function(j){var N;(!j.initSegment||j.initSegment.relurl===((N=L)===null||N===void 0?void 0:N.relurl))&&(j.initSegment=L)})}if(f.skippedSegments&&(f.deltaUpdateFailed=f.fragments.some(function(j){return!j}),f.deltaUpdateFailed)){D.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var y=f.skippedSegments;y--;)f.fragments.shift();f.startSN=f.fragments[0].sn,f.startCC=f.fragments[0].cc}var h=f.fragments;if(w){D.logger.warn("discontinuity sliding from playlist, take drift into account");for(var E=0;E<h.length;E++)h[E].cc+=w}f.skippedSegments&&(f.startCC=f.fragments[0].cc),p(o.partList,f.partList,function(j,N){N.elementaryStreams=j.elementaryStreams,N.stats=j.stats}),_?R(f,_,_.startPTS,_.endPTS,_.startDTS,_.endDTS):l(o,f),h.length&&(f.totalduration=f.edge-h[0].start),f.driftStartTime=o.driftStartTime,f.driftStart=o.driftStart;var m=f.advancedDateTime;if(f.advanced&&m){var T=f.edge;f.driftStart||(f.driftStartTime=m,f.driftStart=T),f.driftEndTime=m,f.driftEnd=T}else f.driftEndTime=o.driftEndTime,f.driftEnd=o.driftEnd,f.advancedDateTime=o.advancedDateTime}function p(o,f,L){if(o&&f)for(var C=0,x=0,A=o.length;x<=A;x++){var w=o[x],_=f[x+C];w&&_&&w.index===_.index&&w.fragment.sn===_.fragment.sn?L(w,_):C--}}function d(o,f,L){for(var C=f.skippedSegments,x=Math.max(o.startSN,f.startSN)-f.startSN,A=(o.fragmentHint?1:0)+(C?f.endSN:Math.min(o.endSN,f.endSN))-f.startSN,w=f.startSN-o.startSN,_=f.fragmentHint?f.fragments.concat(f.fragmentHint):f.fragments,S=o.fragmentHint?o.fragments.concat(o.fragmentHint):o.fragments,y=x;y<=A;y++){var h=S[w+y],E=_[y];C&&!E&&y<C&&(E=f.fragments[y]=h),h&&E&&L(h,E)}}function l(o,f){var L=f.startSN+f.skippedSegments-o.startSN,C=o.fragments;if(L<0||L>=C.length)return;n(f,C[L].start)}function n(o,f){if(f){for(var L=o.fragments,C=o.skippedSegments;C<L.length;C++)L[C].start+=f;o.fragmentHint&&(o.fragmentHint.start+=f)}}function c(o,f){var L=1e3*o.levelTargetDuration,C=L/2,x=o.age,A=x>0&&x<L*3,w=f.loading.end-f.loading.start,_,S=o.availabilityDelay;if(o.updated===!1)if(A){var y=333*o.misses;_=Math.max(Math.min(C,w*2),y),o.availabilityDelay=(o.availabilityDelay||0)+_}else _=C;else A?(S=Math.min(S||L/2,x),o.availabilityDelay=S,_=S+L-x):_=L-w;return Math.round(_)}function s(o,f,L){if(!o||!o.details)return null;var C=o.details,x=C.fragments[f-C.startSN];return x||(x=C.fragmentHint,x&&x.sn===f?x:f<C.startSN&&L&&L.sn===f?L:null)}function a(o,f,L){if(!o||!o.details)return null;var C=o.details.partList;if(C)for(var x=C.length;x--;){var A=C[x];if(A.index===L&&A.fragment.sn===f)return A}return null}},"./src/controller/stream-controller.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return C});var Y=P("./src/polyfills/number.ts"),D=P("./src/controller/base-stream-controller.ts"),U=P("./src/is-supported.ts"),H=P("./src/events.ts"),I=P("./src/utils/buffer-helper.ts"),F=P("./src/controller/fragment-tracker.ts"),R=P("./src/types/loader.ts"),g=P("./src/loader/fragment.ts"),p=P("./src/demux/transmuxer-interface.ts"),d=P("./src/types/transmuxer.ts"),l=P("./src/controller/gap-controller.ts"),n=P("./src/errors.ts"),c=P("./src/utils/logger.ts");function s(x,A){for(var w=0;w<A.length;w++){var _=A[w];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(x,_.key,_)}}function a(x,A,w){return A&&s(x.prototype,A),w&&s(x,w),x}function o(x,A){x.prototype=Object.create(A.prototype),x.prototype.constructor=x,f(x,A)}function f(x,A){return f=Object.setPrototypeOf||function(_,S){return _.__proto__=S,_},f(x,A)}var L=100,C=function(x){o(A,x);function A(_,S){var y;return y=x.call(this,_,S,"[stream-controller]")||this,y.audioCodecSwap=!1,y.gapController=null,y.level=-1,y._forceStartLoad=!1,y.altAudio=!1,y.audioOnly=!1,y.fragPlaying=null,y.onvplaying=null,y.onvseeked=null,y.fragLastKbps=0,y.stalled=!1,y.couldBacktrack=!1,y.audioCodecSwitch=!1,y.videoBuffer=null,y._registerListeners(),y}var w=A.prototype;return w._registerListeners=function(){var S=this.hls;S.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),S.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),S.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),S.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.on(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),S.on(H.Events.ERROR,this.onError,this),S.on(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),S.on(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),S.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this),S.on(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),S.on(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),S.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w._unregisterListeners=function(){var S=this.hls;S.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),S.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),S.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),S.off(H.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),S.off(H.Events.ERROR,this.onError,this),S.off(H.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),S.off(H.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),S.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),S.off(H.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),S.off(H.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),S.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},w.startLoad=function(S){if(this.levels){var y=this.lastCurrentTime,h=this.hls;if(this.stopLoad(),this.setInterval(L),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var E=h.startLevel;E===-1&&(h.config.testBandwidth?(E=0,this.bitrateTest=!0):E=h.nextAutoLevel),this.level=h.nextLoadLevel=E,this.loadedmetadata=!1}y>0&&S===-1&&(this.log("Override startPosition with lastCurrentTime @"+y.toFixed(3)),S=y),this.state=D.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=S,this.tick()}else this._forceStartLoad=!0,this.state=D.State.STOPPED},w.stopLoad=function(){this._forceStartLoad=!1,x.prototype.stopLoad.call(this)},w.doTick=function(){switch(this.state){case D.State.IDLE:this.doTickIdle();break;case D.State.WAITING_LEVEL:{var S,y=this.levels,h=this.level,E=y==null||((S=y[h])===null||S===void 0)?void 0:S.details;if(E&&(!E.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(E))break;this.state=D.State.IDLE;break}break}case D.State.FRAG_LOADING_WAITING_RETRY:{var m,T=self.performance.now(),j=this.retryDate;(!j||T>=j||(m=this.media)!==null&&m!==void 0&&m.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=D.State.IDLE)}break;default:break}this.onTickEnd()},w.onTickEnd=function(){x.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},w.doTickIdle=function(){var S,y,h=this.hls,E=this.levelLastLoaded,m=this.levels,T=this.media,j=h.config,N=h.nextLoadLevel;if(E===null||!T&&(this.startFragRequested||!j.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!m||!m[N])return;var K=m[N];this.level=h.nextLoadLevel=N;var W=K.details;if(!W||this.state===D.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==N){this.state=D.State.WAITING_LEVEL;return}var k=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:T,R.PlaylistLevelType.MAIN);if(k===null)return;var b=k.len,G=this.getMaxBufferLength(K.maxBitrate);if(b>=G)return;if(this._streamEnded(k,W)){var J={};this.altAudio&&(J.type="video"),this.hls.trigger(H.Events.BUFFER_EOS,J),this.state=D.State.ENDED;return}var oe=k.end,fe=this.getNextFragment(oe,W);if(this.couldBacktrack&&!this.fragPrevious&&fe&&fe.sn!=="initSegment"){var Ne=fe.sn-W.startSN;Ne>1&&(fe=W.fragments[Ne-1],this.fragmentTracker.removeFragment(fe))}if(fe&&this.fragmentTracker.getState(fe)===F.FragmentState.OK&&this.nextLoadPosition>oe){var _e=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(T,_e,R.PlaylistLevelType.MAIN),fe=this.getNextFragment(this.nextLoadPosition,W)}if(!fe)return;fe.initSegment&&!fe.initSegment.data&&!this.bitrateTest&&(fe=fe.initSegment),((S=fe.decryptdata)===null||S===void 0?void 0:S.keyFormat)==="identity"&&!((y=fe.decryptdata)!==null&&y!==void 0&&y.key)?this.loadKey(fe,W):this.loadFragment(fe,W,oe)},w.loadFragment=function(S,y,h){var E,m=this.fragmentTracker.getState(S);if(this.fragCurrent=S,m===F.FragmentState.BACKTRACKED){var T=this.fragmentTracker.getBacktrackData(S);if(T){this._handleFragmentLoadProgress(T),this._handleFragmentLoadComplete(T);return}else m=F.FragmentState.NOT_LOADED}m===F.FragmentState.NOT_LOADED||m===F.FragmentState.PARTIAL?S.sn==="initSegment"?this._loadInitSegment(S):this.bitrateTest?(S.bitrateTest=!0,this.log("Fragment "+S.sn+" of level "+S.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(S)):(this.startFragRequested=!0,x.prototype.loadFragment.call(this,S,y,h)):m===F.FragmentState.APPENDING?this.reduceMaxBufferLength(S.duration)&&this.fragmentTracker.removeFragment(S):((E=this.media)===null||E===void 0?void 0:E.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},w.getAppendedFrag=function(S){var y=this.fragmentTracker.getAppendedFrag(S,R.PlaylistLevelType.MAIN);return y&&"fragment"in y?y.fragment:y},w.getBufferedFrag=function(S){return this.fragmentTracker.getBufferedFrag(S,R.PlaylistLevelType.MAIN)},w.followingBufferedFrag=function(S){return S?this.getBufferedFrag(S.end+.5):null},w.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},w.nextLevelSwitch=function(){var S=this.levels,y=this.media;if(y!=null&&y.readyState){var h,E=this.getAppendedFrag(y.currentTime);if(E&&E.start>1&&this.flushMainBuffer(0,E.start-1),!y.paused&&S){var m=this.hls.nextLoadLevel,T=S[m],j=this.fragLastKbps;j&&this.fragCurrent?h=this.fragCurrent.duration*T.maxBitrate/(1e3*j)+1:h=0}else h=0;var N=this.getBufferedFrag(y.currentTime+h);if(N){var K=this.followingBufferedFrag(N);if(K){this.abortCurrentFrag();var W=K.maxStartPTS?K.maxStartPTS:K.start,k=K.duration,b=Math.max(N.end,W+Math.min(Math.max(k-this.config.maxFragLookUpTolerance,k*.5),k*.75));this.flushMainBuffer(b,Number.POSITIVE_INFINITY)}}}},w.abortCurrentFrag=function(){var S=this.fragCurrent;this.fragCurrent=null,S!=null&&S.loader&&S.loader.abort(),this.state===D.State.KEY_LOADING&&(this.state=D.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},w.flushMainBuffer=function(S,y){x.prototype.flushMainBuffer.call(this,S,y,this.altAudio?"video":null)},w.onMediaAttached=function(S,y){x.prototype.onMediaAttached.call(this,S,y);var h=y.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),h.addEventListener("playing",this.onvplaying),h.addEventListener("seeked",this.onvseeked),this.gapController=new l.default(this.config,h,this.fragmentTracker,this.hls)},w.onMediaDetaching=function(){var S=this.media;S&&(S.removeEventListener("playing",this.onvplaying),S.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 S=this.media,y=S?S.currentTime:null;Object(Y.isFiniteNumber)(y)&&this.log("Media seeked to "+y.toFixed(3)),this.tick()},w.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(H.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},w.onManifestParsed=function(S,y){var h=!1,E=!1,m;y.levels.forEach(function(T){m=T.audioCodec,m&&(m.indexOf("mp4a.40.2")!==-1&&(h=!0),m.indexOf("mp4a.40.5")!==-1&&(E=!0))}),this.audioCodecSwitch=h&&E&&!Object(U.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=y.levels,this.startFragRequested=!1},w.onLevelLoading=function(S,y){var h=this.levels;if(!h||this.state!==D.State.IDLE)return;var E=h[y.level];(!E.details||E.details.live&&this.levelLastLoaded!==y.level||this.waitForCdnTuneIn(E.details))&&(this.state=D.State.WAITING_LEVEL)},w.onLevelLoaded=function(S,y){var h,E=this.levels,m=y.level,T=y.details,j=T.totalduration;if(!E){this.warn("Levels were reset while loading level "+m);return}this.log("Level "+m+" loaded ["+T.startSN+","+T.endSN+"], cc ["+T.startCC+", "+T.endCC+"] duration:"+j);var N=this.fragCurrent;N&&(this.state===D.State.FRAG_LOADING||this.state===D.State.FRAG_LOADING_WAITING_RETRY)&&(N.level!==y.level&&N.loader&&(this.state=D.State.IDLE,N.loader.abort()));var K=E[m],W=0;if(T.live||(h=K.details)!==null&&h!==void 0&&h.live){if(T.fragments[0]||(T.deltaUpdateFailed=!0),T.deltaUpdateFailed)return;W=this.alignPlaylists(T,K.details)}if(K.details=T,this.levelLastLoaded=m,this.hls.trigger(H.Events.LEVEL_UPDATED,{details:T,level:m}),this.state===D.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(T))return;this.state=D.State.IDLE}this.startFragRequested?T.live&&this.synchronizeToLiveEdge(T):this.setStartPosition(T,W),this.tick()},w._handleFragmentLoadProgress=function(S){var y,h=S.frag,E=S.part,m=S.payload,T=this.levels;if(!T){this.warn("Levels were reset while fragment load was in progress. Fragment "+h.sn+" of level "+h.level+" will not be buffered");return}var j=T[h.level],N=j.details;if(!N){this.warn("Dropping fragment "+h.sn+" of level "+h.level+" after level details were reset");return}var K=j.videoCodec,W=N.PTSKnown||!N.live,k=(y=h.initSegment)===null||y===void 0?void 0:y.data,b=this._getAudioCodec(j),G=this.transmuxer=this.transmuxer||new p.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),J=E?E.index:-1,oe=J!==-1,fe=new d.ChunkMetadata(h.level,h.sn,h.stats.chunkCount,m.byteLength,J,oe),Ne=this.initPTS[h.cc];G.push(m,k,b,K,h,E,N.totalduration,W,fe,Ne)},w.onAudioTrackSwitching=function(S,y){var h=this.altAudio,E=!!y.url,m=y.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 T=this.fragCurrent;T!=null&&T.loader&&(this.log("Switching to main audio track, cancel main fragment load"),T.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var j=this.hls;h&&j.trigger(H.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),j.trigger(H.Events.AUDIO_TRACK_SWITCHED,{id:m})}},w.onAudioTrackSwitched=function(S,y){var h=y.id,E=!!this.hls.audioTracks[h].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(S,y){var h=y.tracks,E,m,T=!1;for(var j in h){var N=h[j];if(N.id==="main"){if(m=j,E=N,j==="video"){var K=h[j];K&&(this.videoBuffer=K.buffer)}}else T=!0}T&&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(S,y){var h=y.frag,E=y.part;if(h&&h.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(h)){this.warn("Fragment "+h.sn+(E?" p: "+E.index:"")+" of level "+h.level+" finished buffering, but was aborted. state: "+this.state),this.state===D.State.PARSED&&(this.state=D.State.IDLE);return}var m=E?E.stats:h.stats;this.fragLastKbps=Math.round(8*m.total/(m.buffering.end-m.loading.first)),h.sn!=="initSegment"&&(this.fragPrevious=h),this.fragBufferedComplete(h,E)},w.onError=function(S,y){switch(y.details){case n.ErrorDetails.FRAG_LOAD_ERROR:case n.ErrorDetails.FRAG_LOAD_TIMEOUT:case n.ErrorDetails.KEY_LOAD_ERROR:case n.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,y);break;case n.ErrorDetails.LEVEL_LOAD_ERROR:case n.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==D.State.ERROR&&(y.fatal?(this.warn(""+y.details),this.state=D.State.ERROR):!y.levelRetry&&this.state===D.State.WAITING_LEVEL&&(this.state=D.State.IDLE));break;case n.ErrorDetails.BUFFER_FULL_ERROR:if(y.parent==="main"&&(this.state===D.State.PARSING||this.state===D.State.PARSED)){var h=!0,E=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);E&&E.len>.5&&(h=!this.reduceMaxBufferLength(E.len)),h&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},w.checkBuffer=function(){var S=this.media,y=this.gapController;if(!S||!y||!S.readyState)return;var h=I.BufferHelper.getBuffered(S);!this.loadedmetadata&&h.length?(this.loadedmetadata=!0,this.seekToStartPos()):y.poll(this.lastCurrentTime),this.lastCurrentTime=S.currentTime},w.onFragLoadEmergencyAborted=function(){this.state=D.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},w.onBufferFlushed=function(S,y){var h=y.type;if(h!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var E=(h===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(E,h,R.PlaylistLevelType.MAIN)}},w.onLevelsUpdated=function(S,y){this.levels=y.levels},w.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},w.seekToStartPos=function(){var S=this.media,y=S.currentTime,h=this.startPosition;if(h>=0&&y<h){if(S.seeking){c.logger.log("could not seek to "+h+", already seeking at "+y);return}var E=I.BufferHelper.getBuffered(S),m=E.length?E.start(0):0,T=m-h;T>0&&(T<this.config.maxBufferHole||T<this.config.maxFragLookUpTolerance)&&(c.logger.log("adjusting start position by "+T+" to match buffer start"),h+=T,this.startPosition=h),this.log("seek to target start position "+h+" from current time "+y),S.currentTime=h}},w._getAudioCodec=function(S){var y=this.config.defaultAudioCodec||S.audioCodec;return this.audioCodecSwap&&y&&(this.log("Swapping audio codec"),y.indexOf("mp4a.40.5")!==-1?y="mp4a.40.2":y="mp4a.40.5"),y},w._loadBitrateTestFrag=function(S){var y=this;this._doFragLoad(S).then(function(h){var E=y.hls;if(!h||E.nextLoadLevel||y.fragContextChanged(S))return;y.fragLoadError=0,y.state=D.State.IDLE,y.startFragRequested=!1,y.bitrateTest=!1;var m=S.stats;m.parsing.start=m.parsing.end=m.buffering.start=m.buffering.end=self.performance.now(),E.trigger(H.Events.FRAG_LOADED,h)})},w._handleTransmuxComplete=function(S){var y,h="main",E=this.hls,m=S.remuxResult,T=S.chunkMeta,j=this.getCurrentContext(T);if(!j){this.warn("The loading context changed while buffering fragment "+T.sn+" of level "+T.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(T.level);return}var N=j.frag,K=j.part,W=j.level,k=m.video,b=m.text,G=m.id3,J=m.initSegment,oe=this.altAudio?void 0:m.audio;if(this.fragContextChanged(N))return;if(this.state=D.State.PARSING,J){J.tracks&&(this._bufferInitSegment(W,J.tracks,N,T),E.trigger(H.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:h,tracks:J.tracks}));var fe=J.initPTS,Ne=J.timescale;Object(Y.isFiniteNumber)(fe)&&(this.initPTS[N.cc]=fe,E.trigger(H.Events.INIT_PTS_FOUND,{frag:N,id:h,initPTS:fe,timescale:Ne}))}if(k&&m.independent!==!1){if(W.details){var _e=k.startPTS,Fe=k.endPTS,We=k.startDTS,Ue=k.endDTS;if(K)K.elementaryStreams[k.type]={startPTS:_e,endPTS:Fe,startDTS:We,endDTS:Ue};else if(k.firstKeyFrame&&k.independent&&(this.couldBacktrack=!0),k.dropped&&k.independent){var xe=this.getLoadPosition()+this.config.maxBufferHole;if(xe<_e){this.backtrack(N);return}N.setElementaryStreamInfo(k.type,N.start,Fe,N.start,Ue,!0)}N.setElementaryStreamInfo(k.type,_e,Fe,We,Ue),this.bufferFragmentData(k,N,K,T)}}else if(m.independent===!1){this.backtrack(N);return}if(oe){var ue=oe.startPTS,ae=oe.endPTS,Ee=oe.startDTS,de=oe.endDTS;K&&(K.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:ae,startDTS:Ee,endDTS:de}),N.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,ue,ae,Ee,de),this.bufferFragmentData(oe,N,K,T)}if(G!=null&&(y=G.samples)!==null&&y!==void 0&&y.length){var Ke={frag:N,id:h,samples:G.samples};E.trigger(H.Events.FRAG_PARSING_METADATA,Ke)}if(b){var Je={frag:N,id:h,samples:b.samples};E.trigger(H.Events.FRAG_PARSING_USERDATA,Je)}},w._bufferInitSegment=function(S,y,h,E){var m=this;if(this.state!==D.State.PARSING)return;this.audioOnly=!!y.audio&&!y.video,this.altAudio&&!this.audioOnly&&delete y.audio;var T=y.audio,j=y.video,N=y.audiovideo;if(T){var K=S.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(K&&(K.indexOf("mp4a.40.5")!==-1?K="mp4a.40.2":K="mp4a.40.5"),T.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(K="mp4a.40.5")),W.indexOf("android")!==-1&&T.container!=="audio/mpeg"&&(K="mp4a.40.2",this.log("Android: force audio codec to "+K)),S.audioCodec&&S.audioCodec!==K&&this.log('Swapping manifest audio codec "'+S.audioCodec+'" for "'+K+'"'),T.levelCodec=K,T.id="main",this.log("Init audio buffer, container:"+T.container+", codecs[selected/level/parsed]=["+(K||"")+"/"+(S.audioCodec||"")+"/"+T.codec+"]")}j&&(j.levelCodec=S.videoCodec,j.id="main",this.log("Init video buffer, container:"+j.container+", codecs[level/parsed]=["+(S.videoCodec||"")+"/"+j.codec+"]")),N&&this.log("Init audiovideo buffer, container:"+N.container+", codecs[level/parsed]=["+(S.attrs.CODECS||"")+"/"+N.codec+"]"),this.hls.trigger(H.Events.BUFFER_CODECS,y),Object.keys(y).forEach(function(k){var b=y[k],G=b.initSegment;G!=null&&G.byteLength&&m.hls.trigger(H.Events.BUFFER_APPENDING,{type:k,data:G,frag:h,part:null,chunkMeta:E,parent:h.type})}),this.tick()},w.backtrack=function(S){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(S);var y=this.fragmentTracker.backtrack(S);this.fragPrevious=null,this.nextLoadPosition=S.start,y?this.resetFragmentLoading(S):this.state=D.State.BACKTRACKING},w.checkFragmentChanged=function(){var S=this.media,y=null;if(S&&S.readyState>1&&S.seeking===!1){var h=S.currentTime;if(I.BufferHelper.isBuffered(S,h)?y=this.getAppendedFrag(h):I.BufferHelper.isBuffered(S,h+.1)&&(y=this.getAppendedFrag(h+.1)),y){var E=this.fragPlaying,m=y.level;(!E||y.sn!==E.sn||E.level!==m||y.urlId!==E.urlId)&&(this.hls.trigger(H.Events.FRAG_CHANGED,{frag:y}),(!E||E.level!==m)&&this.hls.trigger(H.Events.LEVEL_SWITCHED,{level:m}),this.fragPlaying=y)}}},a(A,[{key:"nextLevel",get:function(){var S=this.nextBufferedFrag;return S?S.level:-1}},{key:"currentLevel",get:function(){var S=this.media;if(S){var y=this.getAppendedFrag(S.currentTime);if(y)return y.level}return-1}},{key:"nextBufferedFrag",get:function(){var S=this.media;if(S){var y=this.getAppendedFrag(S.currentTime);return this.followingBufferedFrag(y)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),A}(D.default)},"./src/controller/subtitle-stream-controller.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"SubtitleStreamController",function(){return o});var Y=P("./src/events.ts"),D=P("./src/utils/logger.ts"),U=P("./src/utils/buffer-helper.ts"),H=P("./src/controller/fragment-finders.ts"),I=P("./src/utils/discontinuities.ts"),F=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"),d=P("./src/types/level.ts");function l(f,L){for(var C=0;C<L.length;C++){var x=L[C];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(f,x.key,x)}}function n(f,L,C){return L&&l(f.prototype,L),C&&l(f,C),f}function c(f,L){f.prototype=Object.create(L.prototype),f.prototype.constructor=f,s(f,L)}function s(f,L){return s=Object.setPrototypeOf||function(x,A){return x.__proto__=A,x},s(f,L)}var a=500,o=function(f){c(L,f);function L(x,A){var w;return w=f.call(this,x,A,"[subtitle-stream-controller]")||this,w.levels=[],w.currentTrackId=-1,w.tracksBuffered=[],w.mainDetails=null,w._registerListeners(),w}var C=L.prototype;return C.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},C._registerListeners=function(){var A=this.hls;A.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on(Y.Events.ERROR,this.onError,this),A.on(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.on(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.on(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.on(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C._unregisterListeners=function(){var A=this.hls;A.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off(Y.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off(Y.Events.ERROR,this.onError,this),A.off(Y.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.off(Y.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.off(Y.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.off(Y.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(a),this.tick()},C.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},C.onLevelLoaded=function(A,w){this.mainDetails=w.details},C.onSubtitleFragProcessed=function(A,w){var _=w.frag,S=w.success;if(this.fragPrevious=_,this.state=g.State.IDLE,!S)return;var y=this.tracksBuffered[this.currentTrackId];if(!y)return;for(var h,E=_.start,m=0;m<y.length;m++)if(E>=y[m].start&&E<=y[m].end){h=y[m];break}var T=_.start+_.duration;h?h.end=T:(h={start:E,end:T},y.push(h)),this.fragmentTracker.fragBuffered(_)},C.onBufferFlushing=function(A,w){var _=w.startOffset,S=w.endOffset;if(_===0&&S!==Number.POSITIVE_INFINITY){var y=this.currentTrackId,h=this.levels;if(!h.length||!h[y]||!h[y].details)return;var E=h[y].details,m=E.targetduration,T=S-m;if(T<=0)return;w.endOffsetSubtitles=Math.max(0,T),this.tracksBuffered.forEach(function(j){for(var N=0;N<j.length;){if(j[N].end<=T){j.shift();continue}else if(j[N].start<T)j[N].start=T;else break;N++}}),this.fragmentTracker.removeFragmentsInRange(_,T,p.PlaylistLevelType.SUBTITLE)}},C.onError=function(A,w){var _,S=w.frag;if(!S||S.type!==p.PlaylistLevelType.SUBTITLE)return;(_=this.fragCurrent)!==null&&_!==void 0&&_.loader&&this.fragCurrent.loader.abort(),this.state=g.State.IDLE},C.onSubtitleTracksUpdated=function(A,w){var _=this,S=w.subtitleTracks;this.tracksBuffered=[],this.levels=S.map(function(y){return new d.Level(y)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(y){_.tracksBuffered[y.id]=[]}),this.mediaBuffer=null},C.onSubtitleTrackSwitch=function(A,w){if(this.currentTrackId=w.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var _=this.levels[this.currentTrackId];_!=null&&_.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,_&&this.setInterval(a)},C.onSubtitleTrackLoaded=function(A,w){var _,S=w.details,y=w.id,h=this.currentTrackId,E=this.levels;if(!E.length)return;var m=E[h];if(y>=E.length||y!==h||!m)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,S.live||(_=m.details)!==null&&_!==void 0&&_.live){var T=this.mainDetails;if(S.deltaUpdateFailed||!T)return;var j=T.fragments[0];if(!m.details)S.hasProgramDateTime&&T.hasProgramDateTime?Object(I.alignMediaPlaylistByPDT)(S,T):j&&Object(F.addSliding)(S,j.start);else{var N=this.alignPlaylists(S,m.details);N===0&&j&&Object(F.addSliding)(S,j.start)}}if(m.details=S,this.levelLastLoaded=y,this.tick(),S.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var K=Object(H.findFragmentByPTS)(null,S.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),m.details=void 0)}},C._handleFragmentLoadComplete=function(A){var w=A.frag,_=A.payload,S=w.decryptdata,y=this.hls;if(this.fragContextChanged(w))return;if(_&&_.byteLength>0&&S&&S.key&&S.iv&&S.method==="AES-128"){var h=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(_),S.key.buffer,S.iv.buffer).then(function(E){var m=performance.now();y.trigger(Y.Events.FRAG_DECRYPTED,{frag:w,payload:E,stats:{tstart:h,tdecrypt:m}})})}},C.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var A,w=this.currentTrackId,_=this.levels;if(!_.length||!_[w]||!_[w].details)return;var S=_[w].details,y=S.targetduration,h=this.config,E=this.media,m=U.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,E.currentTime-y,h.maxBufferHole),T=m.end,j=m.len,N=this.getMaxBufferLength()+y;if(j>N)return;console.assert(S,"Subtitle track details are defined on idle subtitle stream controller tick");var K=S.fragments,W=K.length,k=S.edge,b,G=this.fragPrevious;if(T<k){var J=h.maxFragLookUpTolerance;G&&S.hasProgramDateTime&&(b=Object(H.findFragmentByPDT)(K,G.endProgramDateTime,J)),b||(b=Object(H.findFragmentByPTS)(G,K,T,J),!b&&G&&G.start<K[0].start&&(b=K[0]))}else b=K[W-1];(A=b)!==null&&A!==void 0&&A.encrypted?(D.logger.log("Loading key for "+b.sn),this.state=g.State.KEY_LOADING,this.hls.trigger(Y.Events.KEY_LOADING,{frag:b})):b&&this.fragmentTracker.getState(b)===R.FragmentState.NOT_LOADED&&this.loadFragment(b,S,T)}},C.loadFragment=function(A,w,_){this.fragCurrent=A,f.prototype.loadFragment.call(this,A,w,_)},n(L,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),L}(g.default)},"./src/controller/subtitle-track-controller.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/events.ts"),D=P("./src/utils/texttrack-utils.ts"),U=P("./src/controller/base-playlist-controller.ts"),H=P("./src/types/loader.ts");function I(l,n){for(var c=0;c<n.length;c++){var s=n[c];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(l,s.key,s)}}function F(l,n,c){return n&&I(l.prototype,n),c&&I(l,c),l}function R(l,n){l.prototype=Object.create(n.prototype),l.prototype.constructor=l,g(l,n)}function g(l,n){return g=Object.setPrototypeOf||function(s,a){return s.__proto__=a,s},g(l,n)}var p=function(l){R(n,l);function n(s){var a;return a=l.call(this,s,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var c=n.prototype;return c.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,l.prototype.destroy.call(this)},c.registerListeners=function(){var a=this.hls;a.on(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(Y.Events.ERROR,this.onError,this)},c.unregisterListeners=function(){var a=this.hls;a.off(Y.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(Y.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(Y.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(Y.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(Y.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(Y.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(Y.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(Y.Events.ERROR,this.onError,this)},c.onMediaAttached=function(a,o){if(this.media=o.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},c.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},c.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 a=d(this.media.textTracks);a.forEach(function(o){Object(D.clearCurrentCues)(o)}),this.subtitleTrack=-1,this.media=null},c.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},c.onManifestParsed=function(a,o){this.tracks=o.subtitleTracks},c.onSubtitleTrackLoaded=function(a,o){var f=o.id,L=o.details,C=this.trackId,x=this.tracksInGroup[C];if(!x){this.warn("Invalid subtitle track id "+f);return}var A=x.details;x.details=o.details,this.log("subtitle track "+f+" loaded ["+L.startSN+"-"+L.endSN+"]"),f===this.trackId&&(this.retryCount=0,this.playlistLoaded(f,o,A))},c.onLevelLoading=function(a,o){this.switchLevel(o.level)},c.onLevelSwitching=function(a,o){this.switchLevel(o.level)},c.switchLevel=function(a){var o=this.hls.levels[a];if(!(o!=null&&o.textGroupIds))return;var f=o.textGroupIds[o.urlId];if(this.groupId!==f){var L=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,C=this.tracks.filter(function(w){return!f||w.groupId===f});this.tracksInGroup=C;var x=this.findTrackId(L==null?void 0:L.name)||this.findTrackId();this.groupId=f;var A={subtitleTracks:C};this.log("Updating subtitle tracks, "+C.length+' track(s) found in "'+f+'" group-id'),this.hls.trigger(Y.Events.SUBTITLE_TRACKS_UPDATED,A),x!==-1&&this.setSubtitleTrack(x,L)}},c.findTrackId=function(a){for(var o=this.tracksInGroup,f=0;f<o.length;f++){var L=o[f];if((!this.selectDefaultTrack||L.default)&&(!a||a===L.name))return L.id}return-1},c.onError=function(a,o){if(l.prototype.onError.call(this,a,o),o.fatal||!o.context)return;o.context.type===H.PlaylistContextType.SUBTITLE_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},c.loadPlaylist=function(a){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var f=o.id,L=o.groupId,C=o.url;if(a)try{C=a.addDirectives(C)}catch(x){this.warn("Could not construct new URL with HLS Delivery Directives: "+x)}this.log("Loading subtitle playlist for id "+f),this.hls.trigger(Y.Events.SUBTITLE_TRACK_LOADING,{url:C,id:f,groupId:L,deliveryDirectives:a||null})}},c.toggleTrackModes=function(a){var o=this,f=this.media,L=this.subtitleDisplay,C=this.trackId;if(!f)return;var x=d(f.textTracks),A=x.filter(function(S){return S.groupId===o.groupId});if(a===-1)[].slice.call(x).forEach(function(S){S.mode="disabled"});else{var w=A[C];w&&(w.mode="disabled")}var _=A[a];_&&(_.mode=L?"showing":"hidden")},c.setSubtitleTrack=function(a,o){var f,L=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(f=L[a])!==null&&f!==void 0&&f.details)||a<-1||a>=L.length)return;this.clearTimer();var C=L[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,C){var x=C.id,A=C.groupId,w=A===void 0?"":A,_=C.name,S=C.type,y=C.url;this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:x,groupId:w,name:_,type:S,url:y});var h=this.switchParams(C.url,o==null?void 0:o.details);this.loadPlaylist(h)}else this.hls.trigger(Y.Events.SUBTITLE_TRACK_SWITCH,{id:a})},c.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,o=d(this.media.textTracks),f=0;f<o.length;f++)if(o[f].mode==="hidden")a=f;else if(o[f].mode==="showing"){a=f;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},F(n,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var o=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,o)}}]),n}(U.default);function d(l){for(var n=[],c=0;c<l.length;c++){var s=l[c];s.kind==="subtitles"&&s.label&&n.push(l[c])}return n}Q.default=p},"./src/controller/timeline-controller.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"TimelineController",function(){return d});var Y=P("./src/polyfills/number.ts"),D=P("./src/events.ts"),U=P("./src/utils/cea-608-parser.ts"),H=P("./src/utils/output-filter.ts"),I=P("./src/utils/webvtt-parser.ts"),F=P("./src/utils/texttrack-utils.ts"),R=P("./src/utils/imsc1-ttml-parser.ts"),g=P("./src/types/loader.ts"),p=P("./src/utils/logger.ts"),d=function(){function s(o){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=c(),this.captionsProperties=void 0,this.hls=o,this.config=o.config,this.Cues=o.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var f=new H.default(this,"textTrack1"),L=new H.default(this,"textTrack2"),C=new H.default(this,"textTrack3"),x=new H.default(this,"textTrack4");this.cea608Parser1=new U.default(1,f,L),this.cea608Parser2=new U.default(3,C,x)}o.on(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),o.on(D.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),o.on(D.Events.FRAG_LOADING,this.onFragLoading,this),o.on(D.Events.FRAG_LOADED,this.onFragLoaded,this),o.on(D.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),o.on(D.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),o.on(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),o.on(D.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),o.on(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=s.prototype;return a.destroy=function(){var f=this.hls;f.off(D.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),f.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(D.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(D.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),f.off(D.Events.FRAG_LOADING,this.onFragLoading,this),f.off(D.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(D.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),f.off(D.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),f.off(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),f.off(D.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),f.off(D.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(f,L,C,x,A){for(var w=!1,_=A.length;_--;){var S=A[_],y=n(S[0],S[1],L,C);if(y>=0&&(S[0]=Math.min(S[0],L),S[1]=Math.max(S[1],C),w=!0,y/(C-L)>.5))return}if(w||A.push([L,C]),this.config.renderTextTracksNatively){var h=this.captionsTracks[f];this.Cues.newCue(h,L,C,x)}else{var E=this.Cues.newCue(null,L,C,x);this.hls.trigger(D.Events.CUES_PARSED,{type:"captions",cues:E,track:f})}},a.onInitPtsFound=function(f,L){var C=this,x=L.frag,A=L.id,w=L.initPTS,_=L.timescale,S=this.unparsedVttFrags;A==="main"&&(this.initPTS[x.cc]=w,this.timescale[x.cc]=_),S.length&&(this.unparsedVttFrags=[],S.forEach(function(y){C.onFragLoaded(D.Events.FRAG_LOADED,y)}))},a.getExistingTrack=function(f){var L=this.media;if(L)for(var C=0;C<L.textTracks.length;C++){var x=L.textTracks[C];if(x[f])return x}return null},a.createCaptionsTrack=function(f){this.config.renderTextTracksNatively?this.createNativeTrack(f):this.createNonNativeTrack(f)},a.createNativeTrack=function(f){if(this.captionsTracks[f])return;var L=this.captionsProperties,C=this.captionsTracks,x=this.media,A=L[f],w=A.label,_=A.languageCode,S=this.getExistingTrack(f);if(S)C[f]=S,Object(F.clearCurrentCues)(C[f]),Object(F.sendAddTrackEvent)(C[f],x);else{var y=this.createTextTrack("captions",w,_);y&&(y[f]=!0,C[f]=y)}},a.createNonNativeTrack=function(f){if(this.nonNativeCaptionsTracks[f])return;var L=this.captionsProperties[f];if(!L)return;var C=L.label,x={_id:f,label:C,kind:"captions",default:L.media?!!L.media.default:!1,closedCaptions:L.media};this.nonNativeCaptionsTracks[f]=x,this.hls.trigger(D.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[x]})},a.createTextTrack=function(f,L,C){var x=this.media;return x?x.addTextTrack(f,L,C):void 0},a.onMediaAttaching=function(f,L){this.media=L.media,this._cleanTracks()},a.onMediaDetaching=function(){var f=this.captionsTracks;Object.keys(f).forEach(function(L){Object(F.clearCurrentCues)(f[L]),delete f[L]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=c(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},a._cleanTracks=function(){var f=this.media;if(!f)return;var L=f.textTracks;if(L)for(var C=0;C<L.length;C++)Object(F.clearCurrentCues)(L[C])},a.onSubtitleTracksUpdated=function(f,L){var C=this;this.textTracks=[];var x=L.subtitleTracks||[],A=x.some(function(y){return y.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||A&&this.config.enableIMSC1){var w=this.tracks&&x&&this.tracks.length===x.length;if(this.tracks=x||[],this.config.renderTextTracksNatively){var _=this.media?this.media.textTracks:[];this.tracks.forEach(function(y,h){var E;if(h<_.length){for(var m=null,T=0;T<_.length;T++)if(l(_[T],y)){m=_[T];break}m&&(E=m)}E?Object(F.clearCurrentCues)(E):(E=C.createTextTrack("subtitles",y.name,y.lang),E&&(E.mode="disabled")),E&&(E.groupId=y.groupId,C.textTracks.push(E))})}else if(!w&&this.tracks&&this.tracks.length){var S=this.tracks.map(function(y){return{label:y.name,kind:y.type.toLowerCase(),default:y.default,subtitleTrack:y}});this.hls.trigger(D.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:S})}}},a.onManifestLoaded=function(f,L){var C=this;this.config.enableCEA708Captions&&L.captions&&L.captions.forEach(function(x){var A=/(?:CC|SERVICE)([1-4])/.exec(x.instreamId);if(!A)return;var w="textTrack"+A[1],_=C.captionsProperties[w];if(!_)return;_.label=x.name,x.lang&&(_.languageCode=x.lang),_.media=x})},a.onFragLoading=function(f,L){var C=this.cea608Parser1,x=this.cea608Parser2,A=this.lastSn,w=this.lastPartIndex;if(!this.enabled||!(C&&x))return;if(L.frag.type===g.PlaylistLevelType.MAIN){var _,S,y=L.frag.sn,h=(_=L==null||((S=L.part)===null||S===void 0)?void 0:S.index)!=null?_:-1;y===A+1||y===A&&h===w+1||(C.reset(),x.reset()),this.lastSn=y,this.lastPartIndex=h}},a.onFragLoaded=function(f,L){var C=L.frag,x=L.payload,A=this.initPTS,w=this.unparsedVttFrags;if(C.type===g.PlaylistLevelType.SUBTITLE)if(x.byteLength){if(!Object(Y.isFiniteNumber)(A[C.cc])){w.push(L),A.length&&this.hls.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:C,error:new Error("Missing initial subtitle PTS")});return}var _=C.decryptdata;if(_==null||_.key==null||_.method!=="AES-128"){var S=this.tracks[C.level],y=this.vttCCs;y[C.cc]||(y[C.cc]={start:C.start,prevCC:this.prevCC,new:!0},this.prevCC=C.cc),S&&S.textCodec===R.IMSC1_CODEC?this._parseIMSC1(C,x):this._parseVTTs(C,x,y)}}else this.hls.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:C,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(f,L){var C=this,x=this.hls;Object(R.parseIMSC1)(L,this.initPTS[f.cc],this.timescale[f.cc],function(A){C._appendCues(A,f.level),x.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:f})},function(A){p.logger.log("Failed to parse IMSC1: "+A),x.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:A})})},a._parseVTTs=function(f,L,C){var x=this,A=this.hls;Object(I.parseWebVTT)(L,this.initPTS[f.cc],this.timescale[f.cc],C,f.cc,f.start,function(w){x._appendCues(w,f.level),A.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:f})},function(w){x._fallbackToIMSC1(f,L),p.logger.log("Failed to parse VTT cue: "+w),A.trigger(D.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:w})})},a._fallbackToIMSC1=function(f,L){var C=this,x=this.tracks[f.level];x.textCodec||Object(R.parseIMSC1)(L,this.initPTS[f.cc],this.timescale[f.cc],function(){x.textCodec=R.IMSC1_CODEC,C._parseIMSC1(f,L)},function(){x.textCodec="wvtt"})},a._appendCues=function(f,L){var C=this.hls;if(this.config.renderTextTracksNatively){var x=this.textTracks[L];if(x.mode==="disabled")return;f.forEach(function(_){return Object(F.addCueToTrack)(x,_)})}else{var A=this.tracks[L],w=A.default?"default":"subtitles"+L;C.trigger(D.Events.CUES_PARSED,{type:"subtitles",cues:f,track:w})}},a.onFragDecrypted=function(f,L){var C=L.frag;if(C.type===g.PlaylistLevelType.SUBTITLE){if(!Object(Y.isFiniteNumber)(this.initPTS[C.cc])){this.unparsedVttFrags.push(L);return}this.onFragLoaded(D.Events.FRAG_LOADED,L)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(f,L){var C=this.cea608Parser1,x=this.cea608Parser2;if(!this.enabled||!(C&&x))return;for(var A=0;A<L.samples.length;A++){var w=L.samples[A].bytes;if(w){var _=this.extractCea608Data(w);C.addData(L.samples[A].pts,_[0]),x.addData(L.samples[A].pts,_[1])}}},a.onBufferFlushing=function(f,L){var C=L.startOffset,x=L.endOffset,A=L.endOffsetSubtitles,w=L.type,_=this.media;if(!_||_.currentTime<x)return;if(!w||w==="video"){var S=this.captionsTracks;Object.keys(S).forEach(function(h){return Object(F.removeCuesInRange)(S[h],C,x)})}if(this.config.renderTextTracksNatively&&(C===0&&A!==void 0)){var y=this.textTracks;Object.keys(y).forEach(function(h){return Object(F.removeCuesInRange)(y[h],C,A)})}},a.extractCea608Data=function(f){for(var L=f[0]&31,C=2,x=[[],[]],A=0;A<L;A++){var w=f[C++],_=127&f[C++],S=127&f[C++],y=(4&w)!==0,h=3&w;if(_===0&&S===0)continue;y&&((h===0||h===1)&&(x[h].push(_),x[h].push(S)))}return x},s}();function l(s,a){return s&&s.label===a.name&&!(s.textTrack1||s.textTrack2)}function n(s,a,o,f){return Math.min(a,f)-Math.max(s,o)}function c(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return Y});var Y=function(){function D(H,I){this.subtle=void 0,this.aesIV=void 0,this.subtle=H,this.aesIV=I}var U=D.prototype;return U.decrypt=function(I,F){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},F,I)},D}()},"./src/crypt/aes-decryptor.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"removePadding",function(){return D}),P.d(Q,"default",function(){return U});var Y=P("./src/utils/typed-array.ts");function D(H){var I=H.byteLength,F=I&&new DataView(H.buffer).getUint8(I-1);return F?Object(Y.sliceUint8)(H,0,I-F):H}var U=function(){function H(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var I=H.prototype;return I.uint8ArrayToUint32Array_=function(R){for(var g=new DataView(R),p=new Uint32Array(4),d=0;d<4;d++)p[d]=g.getUint32(d*4);return p},I.initTable=function(){var R=this.sBox,g=this.invSBox,p=this.subMix,d=p[0],l=p[1],n=p[2],c=p[3],s=this.invSubMix,a=s[0],o=s[1],f=s[2],L=s[3],C=new Uint32Array(256),x=0,A=0,w=0;for(w=0;w<256;w++)w<128?C[w]=w<<1:C[w]=w<<1^283;for(w=0;w<256;w++){var _=A^A<<1^A<<2^A<<3^A<<4;_=_>>>8^_&255^99,R[x]=_,g[_]=x;var S=C[x],y=C[S],h=C[y],E=C[_]*257^_*16843008;d[x]=E<<24|E>>>8,l[x]=E<<16|E>>>16,n[x]=E<<8|E>>>24,c[x]=E,E=h*16843009^y*65537^S*257^x*16843008,a[_]=E<<24|E>>>8,o[_]=E<<16|E>>>16,f[_]=E<<8|E>>>24,L[_]=E,x?(x=S^C[C[C[h^S]]],A^=C[C[A]]):x=A=1}},I.expandKey=function(R){for(var g=this.uint8ArrayToUint32Array_(R),p=!0,d=0;d<g.length&&p;)p=g[d]===this.key[d],d++;if(p)return;this.key=g;var l=this.keySize=g.length;if(l!==4&&l!==6&&l!==8)throw new Error("Invalid aes key size="+l);var n=this.ksRows=(l+6+1)*4,c,s,a=this.keySchedule=new Uint32Array(n),o=this.invKeySchedule=new Uint32Array(n),f=this.sBox,L=this.rcon,C=this.invSubMix,x=C[0],A=C[1],w=C[2],_=C[3],S,y;for(c=0;c<n;c++){if(c<l){S=a[c]=g[c];continue}y=S,c%l===0?(y=y<<8|y>>>24,y=f[y>>>24]<<24|f[y>>>16&255]<<16|f[y>>>8&255]<<8|f[y&255],y^=L[c/l|0]<<24):l>6&&c%l===4&&(y=f[y>>>24]<<24|f[y>>>16&255]<<16|f[y>>>8&255]<<8|f[y&255]),a[c]=S=(a[c-l]^y)>>>0}for(s=0;s<n;s++)c=n-s,s&3?y=a[c]:y=a[c-4],s<4||c<=4?o[s]=y:o[s]=x[f[y>>>24]]^A[f[y>>>16&255]]^w[f[y>>>8&255]]^_[f[y&255]],o[s]=o[s]>>>0},I.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},I.decrypt=function(R,g,p){for(var d=this.keySize+6,l=this.invKeySchedule,n=this.invSBox,c=this.invSubMix,s=c[0],a=c[1],o=c[2],f=c[3],L=this.uint8ArrayToUint32Array_(p),C=L[0],x=L[1],A=L[2],w=L[3],_=new Int32Array(R),S=new Int32Array(_.length),y,h,E,m,T,j,N,K,W,k,b,G,J,oe,fe=this.networkToHostOrderSwap;g<_.length;){for(W=fe(_[g]),k=fe(_[g+1]),b=fe(_[g+2]),G=fe(_[g+3]),T=W^l[0],j=G^l[1],N=b^l[2],K=k^l[3],J=4,oe=1;oe<d;oe++)y=s[T>>>24]^a[j>>16&255]^o[N>>8&255]^f[K&255]^l[J],h=s[j>>>24]^a[N>>16&255]^o[K>>8&255]^f[T&255]^l[J+1],E=s[N>>>24]^a[K>>16&255]^o[T>>8&255]^f[j&255]^l[J+2],m=s[K>>>24]^a[T>>16&255]^o[j>>8&255]^f[N&255]^l[J+3],T=y,j=h,N=E,K=m,J=J+4;y=n[T>>>24]<<24^n[j>>16&255]<<16^n[N>>8&255]<<8^n[K&255]^l[J],h=n[j>>>24]<<24^n[N>>16&255]<<16^n[K>>8&255]<<8^n[T&255]^l[J+1],E=n[N>>>24]<<24^n[K>>16&255]<<16^n[T>>8&255]<<8^n[j&255]^l[J+2],m=n[K>>>24]<<24^n[T>>16&255]<<16^n[j>>8&255]<<8^n[N&255]^l[J+3],S[g]=fe(y^C),S[g+1]=fe(m^x),S[g+2]=fe(E^A),S[g+3]=fe(h^w),C=W,x=k,A=b,w=G,g=g+4}return S.buffer},H}()},"./src/crypt/decrypter.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return g});var Y=P("./src/crypt/aes-crypto.ts"),D=P("./src/crypt/fast-aes-key.ts"),U=P("./src/crypt/aes-decryptor.ts"),H=P("./src/utils/logger.ts"),I=P("./src/utils/mp4-tools.ts"),F=P("./src/utils/typed-array.ts"),R=16,g=function(){function p(l,n,c){var s=c===void 0?{}:c,a=s.removePKCS7Padding,o=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=l,this.config=n,this.removePKCS7Padding=o,o)try{var f=self.crypto;f&&(this.subtle=f.subtle||f.webkitSubtle)}catch(L){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var d=p.prototype;return d.destroy=function(){this.observer=null},d.isSync=function(){return this.config.enableSoftwareAES},d.flush=function(){var n=this.currentResult;if(!n){this.reset();return}var c=new Uint8Array(n);return this.reset(),this.removePKCS7Padding?Object(U.removePadding)(c):c},d.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},d.decrypt=function(n,c,s,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(n),c,s);var o=this.flush();o&&a(o.buffer)}else this.webCryptoDecrypt(new Uint8Array(n),c,s).then(a)},d.softwareDecrypt=function(n,c,s){var a=this.currentIV,o=this.currentResult,f=this.remainderData;this.logOnce("JS AES decrypt"),f&&(n=Object(I.appendUint8Array)(f,n),this.remainderData=null);var L=this.getValidChunk(n);if(!L.length)return null;a&&(s=a);var C=this.softwareDecrypter;C||(C=this.softwareDecrypter=new U.default),C.expandKey(c);var x=o;return this.currentResult=C.decrypt(L.buffer,0,s),this.currentIV=Object(F.sliceUint8)(L,-16).buffer,x||null},d.webCryptoDecrypt=function(n,c,s){var a=this,o=this.subtle;return(this.key!==c||!this.fastAesKey)&&(this.key=c,this.fastAesKey=new D.default(o,c)),this.fastAesKey.expandKey().then(function(f){if(!o)return Promise.reject(new Error("web crypto not initialized"));var L=new Y.default(o,s);return L.decrypt(n.buffer,f)}).catch(function(f){return a.onWebCryptoError(f,n,c,s)})},d.onWebCryptoError=function(n,c,s,a){return H.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",n),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(c,s,a)},d.getValidChunk=function(n){var c=n,s=n.length-n.length%R;return s!==n.length&&(c=Object(F.sliceUint8)(n,0,s),this.remainderData=Object(F.sliceUint8)(n,s)),c},d.logOnce=function(n){if(!this.logEnabled)return;H.logger.log("[decrypter.ts]: "+n),this.logEnabled=!1},p}()},"./src/crypt/fast-aes-key.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return Y});var Y=function(){function D(H,I){this.subtle=void 0,this.key=void 0,this.subtle=H,this.key=I}var U=D.prototype;return U.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},D}()},"./src/demux/aacdemuxer.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/demux/base-audio-demuxer.ts"),D=P("./src/demux/adts.ts"),U=P("./src/utils/logger.ts"),H=P("./src/demux/id3.ts");function I(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,F(g,p)}function F(g,p){return F=Object.setPrototypeOf||function(l,n){return l.__proto__=n,l},F(g,p)}var R=function(g){I(p,g);function p(l,n){var c;return c=g.call(this)||this,c.observer=void 0,c.config=void 0,c.observer=l,c.config=n,c}var d=p.prototype;return d.resetInitSegment=function(n,c,s){g.prototype.resetInitSegment.call(this,n,c,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:n,duration:s,inputTimeScale:9e4,dropped:0}},p.probe=function(n){if(!n)return!1;for(var c=H.getID3Data(n,0)||[],s=c.length,a=n.length;s<a;s++)if(D.probe(n,s))return U.logger.log("ADTS sync word found !"),!0;return!1},d.canParse=function(n,c){return D.canParse(n,c)},d.appendFrame=function(n,c,s){D.initTrackConfig(n,this.observer,c,s,n.manifestCodec);var a=D.appendFrame(n,c,s,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},p}(Y.default);R.minProbeByteLength=9,Q.default=R},"./src/demux/adts.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"getAudioConfig",function(){return H}),P.d(Q,"isHeaderPattern",function(){return I}),P.d(Q,"getHeaderLength",function(){return F}),P.d(Q,"getFullFrameLength",function(){return R}),P.d(Q,"canGetFrameLength",function(){return g}),P.d(Q,"isHeader",function(){return p}),P.d(Q,"canParse",function(){return d}),P.d(Q,"probe",function(){return l}),P.d(Q,"initTrackConfig",function(){return n}),P.d(Q,"getFrameDuration",function(){return c}),P.d(Q,"parseFrameHeader",function(){return s}),P.d(Q,"appendFrame",function(){return a});var Y=P("./src/utils/logger.ts"),D=P("./src/errors.ts"),U=P("./src/events.ts");function H(o,f,L,C){var x,A,w,_,S=navigator.userAgent.toLowerCase(),y=C,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];x=((f[L+2]&192)>>>6)+1;var E=(f[L+2]&60)>>>2;if(E>h.length-1){o.trigger(U.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+E});return}return w=(f[L+2]&1)<<2,w|=(f[L+3]&192)>>>6,Y.logger.log("manifest codec:"+C+", ADTS type:"+x+", samplingIndex:"+E),/firefox/i.test(S)?E>=6?(x=5,_=new Array(4),A=E-3):(x=2,_=new Array(2),A=E):S.indexOf("android")!==-1?(x=2,_=new Array(2),A=E):(x=5,_=new Array(4),C&&(C.indexOf("mp4a.40.29")!==-1||C.indexOf("mp4a.40.5")!==-1)||!C&&E>=6?A=E-3:((C&&C.indexOf("mp4a.40.2")!==-1&&(E>=6&&w===1||/vivaldi/i.test(S))||!C&&w===1)&&(x=2,_=new Array(2)),A=E)),_[0]=x<<3,_[0]|=(E&14)>>1,_[1]|=(E&1)<<7,_[1]|=w<<3,x===5&&(_[1]|=(A&14)>>1,_[2]=(A&1)<<7,_[2]|=2<<2,_[3]=0),{config:_,samplerate:h[E],channelCount:w,codec:"mp4a.40."+x,manifestCodec:y}}function I(o,f){return o[f]===255&&(o[f+1]&246)===240}function F(o,f){return o[f+1]&1?7:9}function R(o,f){return(o[f+3]&3)<<11|o[f+4]<<3|(o[f+5]&224)>>>5}function g(o,f){return f+5<o.length}function p(o,f){return f+1<o.length&&I(o,f)}function d(o,f){return g(o,f)&&I(o,f)&&R(o,f)<=o.length-f}function l(o,f){if(p(o,f)){var L=F(o,f);if(f+L>=o.length)return!1;var C=R(o,f);if(C<=L)return!1;var x=f+C;return x===o.length||p(o,x)}return!1}function n(o,f,L,C,x){if(!o.samplerate){var A=H(f,L,C,x);if(!A)return;o.config=A.config,o.samplerate=A.samplerate,o.channelCount=A.channelCount,o.codec=A.codec,o.manifestCodec=A.manifestCodec,Y.logger.log("parsed codec:"+o.codec+", rate:"+A.samplerate+", channels:"+A.channelCount)}}function c(o){return 1024*9e4/o}function s(o,f,L,C,x){var A=F(o,f),w=R(o,f);if(w-=A,w>0){var _=L+C*x;return{headerLength:A,frameLength:w,stamp:_}}}function a(o,f,L,C,x){var A=c(o.samplerate),w=s(f,L,C,x,A);if(w){var _=w.frameLength,S=w.headerLength,y=w.stamp,h=S+_,E=Math.max(0,L+h-f.length),m;E?(m=new Uint8Array(h-S),m.set(f.subarray(L+S,f.length),0)):m=f.subarray(L+S,L+h);var T={unit:m,pts:y};return E||o.samples.push(T),{sample:T,length:h,missing:E}}}},"./src/demux/base-audio-demuxer.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"initPTSFn",function(){return R});var Y=P("./src/polyfills/number.ts"),D=P("./src/demux/id3.ts"),U=P("./src/demux/dummy-demuxed-track.ts"),H=P("./src/utils/mp4-tools.ts"),I=P("./src/utils/typed-array.ts"),F=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(l,n,c){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},p.resetTimeStamp=function(){},p.resetContiguity=function(){},p.canParse=function(l,n){return!1},p.appendFrame=function(l,n,c){},p.demux=function(l,n){this.cachedData&&(l=Object(H.appendUint8Array)(this.cachedData,l),this.cachedData=null);var c=D.getID3Data(l,0),s=c?c.length:0,a,o,f=this._audioTrack,L=this._id3Track,C=c?D.getTimeStamp(c):void 0,x=l.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(C,n)),c&&c.length>0&&L.samples.push({pts:this.initPTS,dts:this.initPTS,data:c}),o=this.initPTS;s<x;){if(this.canParse(l,s)){var A=this.appendFrame(f,l,s);A?(this.frameIndex++,o=A.sample.pts,s+=A.length,a=s):s=x}else D.canParse(l,s)?(c=D.getID3Data(l,s),L.samples.push({pts:o,dts:o,data:c}),s+=c.length,a=s):s++;if(s===x&&a!==x){var w=Object(I.sliceUint8)(l,a);this.cachedData?this.cachedData=Object(H.appendUint8Array)(this.cachedData,w):this.cachedData=w}}return{audioTrack:f,avcTrack:Object(U.dummyTrack)(),id3Track:L,textTrack:Object(U.dummyTrack)()}},p.demuxSampleAes=function(l,n,c){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},p.flush=function(l){var n=this.cachedData;return n&&(this.cachedData=null,this.demux(n,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(U.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(U.dummyTrack)()}},p.destroy=function(){},g}(),R=function(p,d){return Object(Y.isFiniteNumber)(p)?p*90:d*9e4};Q.default=F},"./src/demux/chunk-cache.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return Y});var Y=function(){function U(){this.chunks=[],this.dataLength=0}var H=U.prototype;return H.push=function(F){this.chunks.push(F),this.dataLength+=F.length},H.flush=function(){var F=this.chunks,R=this.dataLength,g;if(F.length)F.length===1?g=F[0]:g=D(F,R);else return new Uint8Array(0);return this.reset(),g},H.reset=function(){this.chunks.length=0,this.dataLength=0},U}();function D(U,H){for(var I=new Uint8Array(H),F=0,R=0;R<U.length;R++){var g=U[R];I.set(g,F),F+=g.length}return I}},"./src/demux/dummy-demuxed-track.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"dummyTrack",function(){return Y});function Y(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/utils/logger.ts"),D=function(){function U(I){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=I,this.bytesAvailable=I.byteLength,this.word=0,this.bitsAvailable=0}var H=U.prototype;return H.loadWord=function(){var F=this.data,R=this.bytesAvailable,g=F.byteLength-R,p=new Uint8Array(4),d=Math.min(4,R);if(d===0)throw new Error("no bytes available");p.set(F.subarray(g,g+d)),this.word=new DataView(p.buffer).getUint32(0),this.bitsAvailable=d*8,this.bytesAvailable-=d},H.skipBits=function(F){var R;this.bitsAvailable>F?(this.word<<=F,this.bitsAvailable-=F):(F-=this.bitsAvailable,R=F>>3,F-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=F,this.bitsAvailable-=F)},H.readBits=function(F){var R=Math.min(this.bitsAvailable,F),g=this.word>>>32-R;return F>32&&Y.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=F-R,R>0&&this.bitsAvailable?g<<R|this.readBits(R):g},H.skipLZ=function(){var F;for(F=0;F<this.bitsAvailable;++F)if((this.word&2147483648>>>F)!==0)return this.word<<=F,this.bitsAvailable-=F,F;return this.loadWord(),F+this.skipLZ()},H.skipUEG=function(){this.skipBits(1+this.skipLZ())},H.skipEG=function(){this.skipBits(1+this.skipLZ())},H.readUEG=function(){var F=this.skipLZ();return this.readBits(F+1)-1},H.readEG=function(){var F=this.readUEG();return 1&F?1+F>>>1:-1*(F>>>1)},H.readBoolean=function(){return this.readBits(1)===1},H.readUByte=function(){return this.readBits(8)},H.readUShort=function(){return this.readBits(16)},H.readUInt=function(){return this.readBits(32)},H.skipScalingList=function(F){for(var R=8,g=8,p,d=0;d<F;d++)g!==0&&(p=this.readEG(),g=(R+p+256)%256),R=g===0?R:g},H.readSPS=function(){var F=0,R=0,g=0,p=0,d,l,n,c=this.readUByte.bind(this),s=this.readBits.bind(this),a=this.readUEG.bind(this),o=this.readBoolean.bind(this),f=this.skipBits.bind(this),L=this.skipEG.bind(this),C=this.skipUEG.bind(this),x=this.skipScalingList.bind(this);c();var A=c();if(s(5),f(3),c(),C(),A===100||A===110||A===122||A===244||A===44||A===83||A===86||A===118||A===128){var w=a();if(w===3&&f(1),C(),C(),f(1),o())for(l=w!==3?8:12,n=0;n<l;n++)o()&&(n<6?x(16):x(64))}C();var _=a();if(_===0)a();else if(_===1)for(f(1),L(),L(),d=a(),n=0;n<d;n++)L();C(),f(1);var S=a(),y=a(),h=s(1);h===0&&f(1),f(1),o()&&(F=a(),R=a(),g=a(),p=a());var E=[1,1];if(o()&&o()){var m=c();switch(m){case 1:E=[1,1];break;case 2:E=[12,11];break;case 3:E=[10,11];break;case 4:E=[16,11];break;case 5:E=[40,33];break;case 6:E=[24,11];break;case 7:E=[20,11];break;case 8:E=[32,11];break;case 9:E=[80,33];break;case 10:E=[18,11];break;case 11:E=[15,11];break;case 12:E=[64,33];break;case 13:E=[160,99];break;case 14:E=[4,3];break;case 15:E=[3,2];break;case 16:E=[2,1];break;case 255:{E=[c()<<8|c(),c()<<8|c()];break}}}return{width:Math.ceil((S+1)*16-F*2-R*2),height:(2-h)*(y+1)*16-(h?2:4)*(g+p),pixelRatio:E}},H.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},U}();Q.default=D},"./src/demux/id3.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"isHeader",function(){return Y}),P.d(Q,"isFooter",function(){return D}),P.d(Q,"getID3Data",function(){return U}),P.d(Q,"canParse",function(){return I}),P.d(Q,"getTimeStamp",function(){return F}),P.d(Q,"isTimeStampFrame",function(){return R}),P.d(Q,"getID3Frames",function(){return p}),P.d(Q,"decodeFrame",function(){return d}),P.d(Q,"utf8ArrayToStr",function(){return a}),P.d(Q,"testables",function(){return o});var Y=function(x,A){return A+10<=x.length&&(x[A]===73&&x[A+1]===68&&x[A+2]===51&&(x[A+3]<255&&x[A+4]<255&&(x[A+6]<128&&x[A+7]<128&&x[A+8]<128&&x[A+9]<128)))},D=function(x,A){return A+10<=x.length&&(x[A]===51&&x[A+1]===68&&x[A+2]===73&&(x[A+3]<255&&x[A+4]<255&&(x[A+6]<128&&x[A+7]<128&&x[A+8]<128&&x[A+9]<128)))},U=function(x,A){for(var w=A,_=0;Y(x,A);){_+=10;var S=H(x,A+6);_+=S,D(x,A+10)&&(_+=10),A+=_}return _>0?x.subarray(w,w+_):void 0},H=function(x,A){var w=0;return w=(x[A]&127)<<21,w|=(x[A+1]&127)<<14,w|=(x[A+2]&127)<<7,w|=x[A+3]&127,w},I=function(x,A){return Y(x,A)&&H(x,A+6)+10<=x.length-A},F=function(x){for(var A=p(x),w=0;w<A.length;w++){var _=A[w];if(R(_))return s(_)}return},R=function(x){return x&&x.key==="PRIV"&&x.info==="com.apple.streaming.transportStreamTimestamp"},g=function(x){var A=String.fromCharCode(x[0],x[1],x[2],x[3]),w=H(x,4),_=10;return{type:A,size:w,data:x.subarray(_,_+w)}},p=function(x){for(var A=0,w=[];Y(x,A);){var _=H(x,A+6);A+=10;for(var S=A+_;A+8<S;){var y=g(x.subarray(A)),h=d(y);h&&w.push(h),A+=y.size+10}D(x,A)&&(A+=10)}return w},d=function(x){return x.type==="PRIV"?l(x):x.type[0]==="W"?c(x):n(x)},l=function(x){if(x.size<2)return;var A=a(x.data,!0),w=new Uint8Array(x.data.subarray(A.length+1));return{key:x.type,info:A,data:w.buffer}},n=function(x){if(x.size<2)return;if(x.type==="TXXX"){var A=1,w=a(x.data.subarray(A),!0);A+=w.length+1;var _=a(x.data.subarray(A));return{key:x.type,info:w,data:_}}var S=a(x.data.subarray(1));return{key:x.type,data:S}},c=function(x){if(x.type==="WXXX"){if(x.size<2)return;var A=1,w=a(x.data.subarray(A),!0);A+=w.length+1;var _=a(x.data.subarray(A));return{key:x.type,info:w,data:_}}var S=a(x.data);return{key:x.type,data:S}},s=function(x){if(x.data.byteLength===8){var A=new Uint8Array(x.data),w=A[3]&1,_=(A[4]<<23)+(A[5]<<15)+(A[6]<<7)+A[7];return _/=45,w&&(_+=4772185884e-2),Math.round(_)}return},a=function(x,A){A===void 0&&(A=!1);var w=L();if(w){var _=w.decode(x);if(A){var S=_.indexOf("\0");return S!==-1?_.substring(0,S):_}return _.replace(/\0/g,"")}for(var y=x.length,h,E,m,T="",j=0;j<y;){if(h=x[j++],h===0&&A)return T;if(h===0||h===3)continue;switch(h>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:T+=String.fromCharCode(h);break;case 12:case 13:E=x[j++],T+=String.fromCharCode((h&31)<<6|E&63);break;case 14:E=x[j++],m=x[j++],T+=String.fromCharCode((h&15)<<12|(E&63)<<6|(m&63)<<0);break;default:}}return T},o={decodeTextFrame:n},f;function L(){return!f&&typeof self.TextDecoder!="undefined"&&(f=new self.TextDecoder("utf-8")),f}},"./src/demux/mp3demuxer.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/demux/base-audio-demuxer.ts"),D=P("./src/demux/id3.ts"),U=P("./src/utils/logger.ts"),H=P("./src/demux/mpegaudio.ts");function I(g,p){g.prototype=Object.create(p.prototype),g.prototype.constructor=g,F(g,p)}function F(g,p){return F=Object.setPrototypeOf||function(l,n){return l.__proto__=n,l},F(g,p)}var R=function(g){I(p,g);function p(){return g.apply(this,arguments)||this}var d=p.prototype;return d.resetInitSegment=function(n,c,s){g.prototype.resetInitSegment.call(this,n,c,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:n,duration:s,inputTimeScale:9e4,dropped:0}},p.probe=function(n){if(!n)return!1;for(var c=D.getID3Data(n,0)||[],s=c.length,a=n.length;s<a;s++)if(H.probe(n,s))return U.logger.log("MPEG Audio sync word found !"),!0;return!1},d.canParse=function(n,c){return H.canParse(n,c)},d.appendFrame=function(n,c,s){return this.initPTS===null?void 0:H.appendFrame(n,c,s,this.initPTS,this.frameIndex)},p}(Y.default);R.minProbeByteLength=4,Q.default=R},"./src/demux/mp4demuxer.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/utils/mp4-tools.ts"),D=P("./src/demux/dummy-demuxed-track.ts"),U=function(){function H(F,R){this.remainderData=null,this.config=void 0,this.config=R}var I=H.prototype;return I.resetTimeStamp=function(){},I.resetInitSegment=function(){},I.resetContiguity=function(){},H.probe=function(R){return Object(Y.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},I.demux=function(R){var g=R,p=Object(D.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(Y.appendUint8Array)(this.remainderData,R));var d=Object(Y.segmentValidRange)(g);this.remainderData=d.remainder,p.samples=d.valid||new Uint8Array}else p.samples=g;return{audioTrack:Object(D.dummyTrack)(),avcTrack:p,id3Track:Object(D.dummyTrack)(),textTrack:Object(D.dummyTrack)()}},I.flush=function(){var R=Object(D.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(D.dummyTrack)(),avcTrack:R,id3Track:Object(D.dummyTrack)(),textTrack:Object(D.dummyTrack)()}},I.demuxSampleAes=function(R,g,p){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},I.destroy=function(){},H}();U.minProbeByteLength=1024,Q.default=U},"./src/demux/mpegaudio.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"appendFrame",function(){return F}),P.d(Q,"parseHeader",function(){return R}),P.d(Q,"isHeaderPattern",function(){return g}),P.d(Q,"isHeader",function(){return p}),P.d(Q,"canParse",function(){return d}),P.d(Q,"probe",function(){return l});var Y=null,D=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],U=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],H=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],I=[0,1,1,4];function F(n,c,s,a,o){if(s+24>c.length)return;var f=R(c,s);if(f&&s+f.frameLength<=c.length){var L=f.samplesPerFrame*9e4/f.sampleRate,C=a+o*L,x={unit:c.subarray(s,s+f.frameLength),pts:C,dts:C};return n.config=[],n.channelCount=f.channelCount,n.samplerate=f.sampleRate,n.samples.push(x),{sample:x,length:f.frameLength,missing:0}}}function R(n,c){var s=n[c+1]>>3&3,a=n[c+1]>>1&3,o=n[c+2]>>4&15,f=n[c+2]>>2&3;if(s!==1&&o!==0&&o!==15&&f!==3){var L=n[c+2]>>1&1,C=n[c+3]>>6,x=s===3?3-a:a===3?3:4,A=D[x*14+o-1]*1e3,w=s===3?0:s===2?1:2,_=U[w*3+f],S=C===3?1:2,y=H[s][a],h=I[a],E=y*8*h,m=Math.floor(y*A/_+L)*h;if(Y===null){var T=navigator.userAgent||"",j=T.match(/Chrome\/(\d+)/i);Y=j?parseInt(j[1]):0}var N=!!Y&&Y<=87;return N&&a===2&&A>=224e3&&C===0&&(n[c+3]=n[c+3]|128),{sampleRate:_,channelCount:S,frameLength:m,samplesPerFrame:E}}}function g(n,c){return n[c]===255&&(n[c+1]&224)===224&&(n[c+1]&6)!==0}function p(n,c){return c+1<n.length&&g(n,c)}function d(n,c){var s=4;return g(n,c)&&s<=n.length-c}function l(n,c){if(c+1<n.length&&g(n,c)){var s=4,a=R(n,c),o=s;a!=null&&a.frameLength&&(o=a.frameLength);var f=c+o;return f===n.length||p(n,f)}return!1}},"./src/demux/sample-aes.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/crypt/decrypter.ts"),D=P("./src/demux/tsdemuxer.ts"),U=function(){function H(F,R,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new Y.default(F,R,{removePKCS7Padding:!1})}var I=H.prototype;return I.decryptBuffer=function(R,g){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,g)},I.decryptAacSample=function(R,g,p,d){var l=R[g].unit,n=l.subarray(16,l.length-l.length%16),c=n.buffer.slice(n.byteOffset,n.byteOffset+n.length),s=this;this.decryptBuffer(c,function(a){var o=new Uint8Array(a);l.set(o,16),d||s.decryptAacSamples(R,g+1,p)})},I.decryptAacSamples=function(R,g,p){for(;;g++){if(g>=R.length){p();return}if(R[g].unit.length<32)continue;var d=this.decrypter.isSync();if(this.decryptAacSample(R,g,p,d),!d)return}},I.getAvcEncryptedData=function(R){for(var g=Math.floor((R.length-48)/160)*16+16,p=new Int8Array(g),d=0,l=32;l<=R.length-16;l+=160,d+=16)p.set(R.subarray(l,l+16),d);return p},I.getAvcDecryptedUnit=function(R,g){for(var p=new Uint8Array(g),d=0,l=32;l<=R.length-16;l+=160,d+=16)R.set(p.subarray(d,d+16),l);return R},I.decryptAvcSample=function(R,g,p,d,l,n){var c=Object(D.discardEPB)(l.data),s=this.getAvcEncryptedData(c),a=this;this.decryptBuffer(s.buffer,function(o){l.data=a.getAvcDecryptedUnit(c,o),n||a.decryptAvcSamples(R,g,p+1,d)})},I.decryptAvcSamples=function(R,g,p,d){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,p=0){if(g>=R.length){d();return}for(var l=R[g].units;!(p>=l.length);p++){var n=l[p];if(n.data.length<=48||n.type!==1&&n.type!==5)continue;var c=this.decrypter.isSync();if(this.decryptAvcSample(R,g,p,d,n,c),!c)return}}},H}();Q.default=U},"./src/demux/transmuxer-interface.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return l});var Y=P("./node_modules/webworkify-webpack/index.js"),D=P.n(Y),U=P("./src/events.ts"),H=P("./src/demux/transmuxer.ts"),I=P("./src/utils/logger.ts"),F=P("./src/errors.ts"),R=P("./src/utils/mediasource-helper.ts"),g=P("./node_modules/eventemitter3/index.js"),p=P.n(g),d=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},l=function(){function n(s,a,o,f){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=s,this.id=a,this.onTransmuxComplete=o,this.onFlush=f;var C=s.config,x=function(y,h){h=h||{},h.frag=L.frag,h.id=L.id,s.trigger(y,h)};this.observer=new g.EventEmitter,this.observer.on(U.Events.FRAG_DECRYPTED,x),this.observer.on(U.Events.ERROR,x);var A={mp4:d.isTypeSupported("video/mp4"),mpeg:d.isTypeSupported("audio/mpeg"),mp3:d.isTypeSupported('audio/mp4; codecs="mp3"')},w=navigator.vendor;if(C.enableWorker&&typeof Worker!="undefined"){I.logger.log("demuxing in webworker");var _;try{_=this.worker=Y("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),_.addEventListener("message",this.onwmsg),_.onerror=function(S){s.trigger(U.Events.ERROR,{type:F.ErrorTypes.OTHER_ERROR,details:F.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(S.message+" ("+S.filename+":"+S.lineno+")")})},_.postMessage({cmd:"init",typeSupported:A,vendor:w,id:a,config:JSON.stringify(C)})}catch(S){I.logger.warn("Error in worker:",S),I.logger.error("Error while initializing DemuxerWorker, fallback to inline"),_&&self.URL.revokeObjectURL(_.objectURL),this.transmuxer=new H.default(this.observer,A,C,w,a),this.worker=null}}else this.transmuxer=new H.default(this.observer,A,C,w,a)}var c=n.prototype;return c.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var o=this.transmuxer;o&&(o.destroy(),this.transmuxer=null)}var f=this.observer;f&&f.removeAllListeners(),this.observer=null},c.push=function(a,o,f,L,C,x,A,w,_,S){var y=this;_.transmuxing.start=self.performance.now();var h=this.transmuxer,E=this.worker,m=x?x.start:C.start,T=C.decryptdata,j=this.frag,N=!(j&&C.cc===j.cc),K=!(j&&_.level===j.level),W=j?_.sn-j.sn:-1,k=this.part?_.part-this.part.index:1,b=!K&&(W===1||W===0&&k===1),G=self.performance.now();(K||W||C.stats.parsing.start===0)&&(C.stats.parsing.start=G),x&&(k||!b)&&(x.stats.parsing.start=G);var J=new H.TransmuxState(N,b,w,K,m);if(!b||N){I.logger.log("[transmuxer-interface, "+C.type+"]: Starting new transmux session for sn: "+_.sn+" p: "+_.part+" level: "+_.level+" id: "+_.id+`
|
|
discontinuity: `+N+`
|
|
trackSwitch: `+K+`
|
|
contiguous: `+b+`
|
|
accurateTimeOffset: `+w+`
|
|
timeOffset: `+m);var oe=new H.TransmuxConfig(f,L,o,A,S);this.configureTransmuxer(oe)}if(this.frag=C,this.part=x,E)E.postMessage({cmd:"demux",data:a,decryptdata:T,chunkMeta:_,state:J},a instanceof ArrayBuffer?[a]:[]);else if(h){var fe=h.push(a,T,_,J);Object(H.isPromise)(fe)?fe.then(function(Ne){y.handleTransmuxComplete(Ne)}):this.handleTransmuxComplete(fe)}},c.flush=function(a){var o=this;a.transmuxing.start=self.performance.now();var f=this.transmuxer,L=this.worker;if(L)L.postMessage({cmd:"flush",chunkMeta:a});else if(f){var C=f.flush(a);Object(H.isPromise)(C)?C.then(function(x){o.handleFlushResult(x,a)}):this.handleFlushResult(C,a)}},c.handleFlushResult=function(a,o){var f=this;a.forEach(function(L){f.handleTransmuxComplete(L)}),this.onFlush(o)},c.onWorkerMessage=function(a){var o=a.data,f=this.hls;switch(o.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(o.data);break}case"flush":{this.onFlush(o.data);break}default:{o.data=o.data||{},o.data.frag=this.frag,o.data.id=this.id,f.trigger(o.event,o.data);break}}},c.configureTransmuxer=function(a){var o=this.worker,f=this.transmuxer;o?o.postMessage({cmd:"configure",config:a}):f&&f.configure(a)},c.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},n}()},"./src/demux/transmuxer-worker.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return F});var Y=P("./src/demux/transmuxer.ts"),D=P("./src/events.ts"),U=P("./src/utils/logger.ts"),H=P("./node_modules/eventemitter3/index.js"),I=P.n(H);function F(l){var n=new H.EventEmitter,c=function(a,o){l.postMessage({event:a,data:o})};n.on(D.Events.FRAG_DECRYPTED,c),n.on(D.Events.ERROR,c),l.addEventListener("message",function(s){var a=s.data;switch(a.cmd){case"init":{var o=JSON.parse(a.config);l.transmuxer=new Y.default(n,a.typeSupported,o,a.vendor,a.id),Object(U.enableLogs)(o.debug),c("init",null);break}case"configure":{l.transmuxer.configure(a.config);break}case"demux":{var f=l.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(Y.isPromise)(f)?f.then(function(x){R(l,x)}):R(l,f);break}case"flush":{var L=a.chunkMeta,C=l.transmuxer.flush(L);Object(Y.isPromise)(C)?C.then(function(x){p(l,x,L)}):p(l,C,L);break}default:break}})}function R(l,n){if(d(n.remuxResult))return;var c=[],s=n.remuxResult,a=s.audio,o=s.video;a&&g(c,a),o&&g(c,o),l.postMessage({event:"transmuxComplete",data:n},c)}function g(l,n){n.data1&&l.push(n.data1.buffer),n.data2&&l.push(n.data2.buffer)}function p(l,n,c){n.forEach(function(s){R(l,s)}),l.postMessage({event:"flush",data:c})}function d(l){return!l.audio&&!l.video&&!l.text&&!l.id3&&!l.initSegment}},"./src/demux/transmuxer.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return o}),P.d(Q,"isPromise",function(){return C}),P.d(Q,"TransmuxConfig",function(){return x}),P.d(Q,"TransmuxState",function(){return A});var Y=P("./src/events.ts"),D=P("./src/errors.ts"),U=P("./src/crypt/decrypter.ts"),H=P("./src/demux/aacdemuxer.ts"),I=P("./src/demux/mp4demuxer.ts"),F=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"),d=P("./src/demux/chunk-cache.ts"),l=P("./src/utils/mp4-tools.ts"),n=P("./src/utils/logger.ts"),c;try{c=self.performance.now.bind(self.performance)}catch(w){n.logger.debug("Unable to use Performance API on this environment"),c=self.Date.now}var s=[{demux:F.default,remux:g.default},{demux:I.default,remux:p.default},{demux:H.default,remux:g.default},{demux:R.default,remux:g.default}],a=1024;s.forEach(function(w){var _=w.demux;a=Math.max(a,_.minProbeByteLength)});var o=function(){function w(S,y,h,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 d.default,this.observer=S,this.typeSupported=y,this.config=h,this.vendor=E,this.id=m}var _=w.prototype;return _.configure=function(y){this.transmuxConfig=y,this.decrypter&&this.decrypter.reset()},_.push=function(y,h,E,m){var T=this,j=E.transmuxing;j.executeStart=c();var N=new Uint8Array(y),K=this.cache,W=this.config,k=this.currentTransmuxState,b=this.transmuxConfig;m&&(this.currentTransmuxState=m);var G=f(N,h);if(G&&G.method==="AES-128"){var J=this.getDecrypter();if(W.enableSoftwareAES){var oe=J.softwareDecrypt(N,G.key.buffer,G.iv.buffer);if(!oe)return j.executeEnd=c(),L(E);N=new Uint8Array(oe)}else return this.decryptionPromise=J.webCryptoDecrypt(N,G.key.buffer,G.iv.buffer).then(function(Qe){var ot=T.push(Qe,null,E);return T.decryptionPromise=null,ot}),this.decryptionPromise}var fe=m||k,Ne=fe.contiguous,_e=fe.discontinuity,Fe=fe.trackSwitch,We=fe.accurateTimeOffset,Ue=fe.timeOffset,xe=b.audioCodec,ue=b.videoCodec,ae=b.defaultInitPts,Ee=b.duration,de=b.initSegmentData;if((_e||Fe)&&this.resetInitSegment(de,xe,ue,Ee),_e&&this.resetInitialTimestamp(ae),Ne||this.resetContiguity(),this.needsProbing(N,_e,Fe)){if(K.dataLength){var Ke=K.flush();N=Object(l.appendUint8Array)(Ke,N)}this.configureTransmuxer(N,b)}var Je=this.transmux(N,G,Ue,We,E),je=this.currentTransmuxState;return je.contiguous=!0,je.discontinuity=!1,je.trackSwitch=!1,j.executeEnd=c(),Je},_.flush=function(y){var h=this,E=y.transmuxing;E.executeStart=c();var m=this.decrypter,T=this.cache,j=this.currentTransmuxState,N=this.decryptionPromise;if(N)return N.then(function(){return h.flush(y)});var K=[],W=j.timeOffset;if(m){var k=m.flush();k&&K.push(this.push(k,null,y))}var b=T.dataLength;T.reset();var G=this.demuxer,J=this.remuxer;if(!G||!J)return b>=a&&this.observer.emit(Y.Events.ERROR,Y.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),E.executeEnd=c(),[L(y)];var oe=G.flush(W);return C(oe)?oe.then(function(fe){return h.flushRemux(K,fe,y),K}):(this.flushRemux(K,oe,y),K)},_.flushRemux=function(y,h,E){var m=h.audioTrack,T=h.avcTrack,j=h.id3Track,N=h.textTrack,K=this.currentTransmuxState,W=K.accurateTimeOffset,k=K.timeOffset;n.logger.log("[transmuxer.ts]: Flushed fragment "+E.sn+(E.part>-1?" p: "+E.part:"")+" of level "+E.level);var b=this.remuxer.remux(m,T,j,N,k,W,!0,this.id);y.push({remuxResult:b,chunkMeta:E}),E.transmuxing.executeEnd=c()},_.resetInitialTimestamp=function(y){var h=this.demuxer,E=this.remuxer;if(!h||!E)return;h.resetTimeStamp(y),E.resetTimeStamp(y)},_.resetContiguity=function(){var y=this.demuxer,h=this.remuxer;if(!y||!h)return;y.resetContiguity(),h.resetNextTimestamp()},_.resetInitSegment=function(y,h,E,m){var T=this.demuxer,j=this.remuxer;if(!T||!j)return;T.resetInitSegment(h,E,m),j.resetInitSegment(y,h,E)},_.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},_.transmux=function(y,h,E,m,T){var j;return h&&h.method==="SAMPLE-AES"?j=this.transmuxSampleAes(y,h,E,m,T):j=this.transmuxUnencrypted(y,E,m,T),j},_.transmuxUnencrypted=function(y,h,E,m){var T=this.demuxer.demux(y,h,!1,!this.config.progressive),j=T.audioTrack,N=T.avcTrack,K=T.id3Track,W=T.textTrack,k=this.remuxer.remux(j,N,K,W,h,E,!1,this.id);return{remuxResult:k,chunkMeta:m}},_.transmuxSampleAes=function(y,h,E,m,T){var j=this;return this.demuxer.demuxSampleAes(y,h,E).then(function(N){var K=j.remuxer.remux(N.audioTrack,N.avcTrack,N.id3Track,N.textTrack,E,m,!1,j.id);return{remuxResult:K,chunkMeta:T}})},_.configureTransmuxer=function(y,h){for(var E=this.config,m=this.observer,T=this.typeSupported,j=this.vendor,N=h.audioCodec,K=h.defaultInitPts,W=h.duration,k=h.initSegmentData,b=h.videoCodec,G,J=0,oe=s.length;J<oe;J++)if(s[J].demux.probe(y)){G=s[J];break}G||(n.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),G={demux:I.default,remux:p.default});var fe=this.demuxer,Ne=this.remuxer,_e=G.remux,Fe=G.demux;(!Ne||!(Ne instanceof _e))&&(this.remuxer=new _e(m,E,T,j)),(!fe||!(fe instanceof Fe))&&(this.demuxer=new Fe(m,E,T),this.probe=Fe.probe),this.resetInitSegment(k,N,b,W),this.resetInitialTimestamp(K)},_.needsProbing=function(y,h,E){return!this.demuxer||!this.remuxer||h||E},_.getDecrypter=function(){var y=this.decrypter;return y||(y=this.decrypter=new U.default(this.observer,this.config)),y},w}();function f(w,_){var S=null;return w.byteLength>0&&_!=null&&_.key!=null&&_.iv!==null&&_.method!=null&&(S=_),S}var L=function(_){return{remuxResult:{},chunkMeta:_}};function C(w){return"then"in w&&w.then instanceof Function}var x=function(_,S,y,h,E){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=_,this.videoCodec=S,this.initSegmentData=y,this.duration=h,this.defaultInitPts=E},A=function(_,S,y,h,E){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=_,this.contiguous=S,this.accurateTimeOffset=y,this.trackSwitch=h,this.timeOffset=E}},"./src/demux/tsdemuxer.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"discardEPB",function(){return L});var Y=P("./src/demux/adts.ts"),D=P("./src/demux/mpegaudio.ts"),U=P("./src/demux/exp-golomb.ts"),H=P("./src/demux/id3.ts"),I=P("./src/demux/sample-aes.ts"),F=P("./src/events.ts"),R=P("./src/utils/mp4-tools.ts"),g=P("./src/utils/logger.ts"),p=P("./src/errors.ts"),d={video:1,audio:2,id3:3,text:4},l=function(){function C(A,w,_){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=A,this.config=w,this.typeSupported=_}C.probe=function(w){var _=C.syncOffset(w);return _<0?!1:(_&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+_+", junk ahead ?"),!0)},C.syncOffset=function(w){for(var _=Math.min(1e3,w.length-3*188),S=0;S<_;){if(w[S]===71&&w[S+188]===71&&w[S+2*188]===71)return S;S++}return-1},C.createTrack=function(w,_){return{container:w==="video"||w==="audio"?"video/mp2t":void 0,type:w,id:d[w],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:w==="audio"?_:void 0}};var x=C.prototype;return x.resetInitSegment=function(w,_,S){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=C.createTrack("video",S),this._audioTrack=C.createTrack("audio",S),this._id3Track=C.createTrack("id3",S),this._txtTrack=C.createTrack("text",S),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=w,this.videoCodec=_,this._duration=S},x.resetTimeStamp=function(){},x.resetContiguity=function(){var w=this._audioTrack,_=this._avcTrack,S=this._id3Track;w&&(w.pesData=null),_&&(_.pesData=null),S&&(S.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},x.demux=function(w,_,S,y){S===void 0&&(S=!1),y===void 0&&(y=!1),S||(this.sampleAes=null);var h,E=this._avcTrack,m=this._audioTrack,T=this._id3Track,j=E.pid,N=E.pesData,K=m.pid,W=T.pid,k=m.pesData,b=T.pesData,G=!1,J=this.pmtParsed,oe=this._pmtId,fe=w.length;if(this.remainderData&&(w=Object(R.appendUint8Array)(this.remainderData,w),fe=w.length,this.remainderData=null),fe<188&&!y)return this.remainderData=w,{audioTrack:m,avcTrack:E,id3Track:T,textTrack:this._txtTrack};var Ne=Math.max(0,C.syncOffset(w));fe-=(fe+Ne)%188,fe<w.byteLength&&!y&&(this.remainderData=new Uint8Array(w.buffer,fe,w.buffer.byteLength-fe));for(var _e=Ne;_e<fe;_e+=188)if(w[_e]===71){var Fe=!!(w[_e+1]&64),We=((w[_e+1]&31)<<8)+w[_e+2],Ue=(w[_e+3]&48)>>4,xe=void 0;if(Ue>1){if(xe=_e+5+w[_e+4],xe===_e+188)continue}else xe=_e+4;switch(We){case j:Fe&&(N&&(h=a(N))&&this.parseAVCPES(h,!1),N={data:[],size:0}),N&&(N.data.push(w.subarray(xe,_e+188)),N.size+=_e+188-xe);break;case K:Fe&&(k&&(h=a(k))&&(m.isAAC?this.parseAACPES(h):this.parseMPEGPES(h)),k={data:[],size:0}),k&&(k.data.push(w.subarray(xe,_e+188)),k.size+=_e+188-xe);break;case W:Fe&&(b&&(h=a(b))&&this.parseID3PES(h),b={data:[],size:0}),b&&(b.data.push(w.subarray(xe,_e+188)),b.size+=_e+188-xe);break;case 0:Fe&&(xe+=w[xe]+1),oe=this._pmtId=c(w,xe);break;case oe:{Fe&&(xe+=w[xe]+1);var ue=s(w,xe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,S);j=ue.avc,j>0&&(E.pid=j),K=ue.audio,K>0&&(m.pid=K,m.isAAC=ue.isAAC),W=ue.id3,W>0&&(T.pid=W),G&&!J&&(g.logger.log("reparse from beginning"),G=!1,_e=Ne-188),J=this.pmtParsed=!0;break}case 17:case 8191:break;default:G=!0;break}}else this.observer.emit(F.Events.ERROR,F.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=N,m.pesData=k,T.pesData=b;var ae={audioTrack:m,avcTrack:E,id3Track:T,textTrack:this._txtTrack};return y&&this.extractRemainingSamples(ae),ae},x.flush=function(){var w=this.remainderData;this.remainderData=null;var _;return w?_=this.demux(w,-1,!1,!0):_={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(_),this.sampleAes?this.decrypt(_,this.sampleAes):_},x.extractRemainingSamples=function(w){var _=w.audioTrack,S=w.avcTrack,y=w.id3Track,h=S.pesData,E=_.pesData,m=y.pesData,T;h&&(T=a(h))?(this.parseAVCPES(T,!0),S.pesData=null):S.pesData=h,E&&(T=a(E))?(_.isAAC?this.parseAACPES(T):this.parseMPEGPES(T),_.pesData=null):(E!=null&&E.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),_.pesData=E),m&&(T=a(m))?(this.parseID3PES(T),y.pesData=null):y.pesData=m},x.demuxSampleAes=function(w,_,S){var y=this.demux(w,S,!0,!this.config.progressive),h=this.sampleAes=new I.default(this.observer,this.config,_);return this.decrypt(y,h)},x.decrypt=function(w,_){return new Promise(function(S){var y=w.audioTrack,h=w.avcTrack;y.samples&&y.isAAC?_.decryptAacSamples(y.samples,0,function(){h.samples?_.decryptAvcSamples(h.samples,0,0,function(){S(w)}):S(w)}):h.samples&&_.decryptAvcSamples(h.samples,0,0,function(){S(w)})})},x.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},x.parseAVCPES=function(w,_){var S=this,y=this._avcTrack,h=this.parseAVCNALu(w.data),E=!1,m=this.avcSample,T,j=!1;w.data=null,m&&h.length&&!y.audFound&&(o(m,y),m=this.avcSample=n(!1,w.pts,w.dts,"")),h.forEach(function(N){switch(N.type){case 1:{T=!0,m||(m=S.avcSample=n(!0,w.pts,w.dts,"")),E&&(m.debug+="NDR "),m.frame=!0;var K=N.data;if(j&&K.length>4){var W=new U.default(K).readSliceType();(W===2||W===4||W===7||W===9)&&(m.key=!0)}break}case 5:T=!0,m||(m=S.avcSample=n(!0,w.pts,w.dts,"")),E&&(m.debug+="IDR "),m.key=!0,m.frame=!0;break;case 6:{T=!0,E&&m&&(m.debug+="SEI ");var k=new U.default(L(N.data));k.readUByte();for(var b=0,G=0,J=!1,oe=0;!J&&k.bytesAvailable>1;){b=0;do oe=k.readUByte(),b+=oe;while(oe===255);G=0;do oe=k.readUByte(),G+=oe;while(oe===255);if(b===4&&k.bytesAvailable!==0){J=!0;var fe=k.readUByte();if(fe===181){var Ne=k.readUShort();if(Ne===49){var _e=k.readUInt();if(_e===1195456820){var Fe=k.readUByte();if(Fe===3){for(var We=k.readUByte(),Ue=k.readUByte(),xe=31&We,ue=[We,Ue],ae=0;ae<xe;ae++)ue.push(k.readUByte()),ue.push(k.readUByte()),ue.push(k.readUByte());f(S._txtTrack.samples,{type:3,pts:w.pts,bytes:ue})}}}}}else if(b===5&&k.bytesAvailable!==0){if(J=!0,G>16){for(var Ee=[],de=0;de<16;de++)Ee.push(k.readUByte().toString(16)),(de===3||de===5||de===7||de===9)&&Ee.push("-");for(var Ke=G-16,Je=new Uint8Array(Ke),je=0;je<Ke;je++)Je[je]=k.readUByte();f(S._txtTrack.samples,{pts:w.pts,payloadType:b,uuid:Ee.join(""),userData:Object(H.utf8ArrayToStr)(Je),userDataBytes:Je})}}else if(G<k.bytesAvailable)for(var Qe=0;Qe<G;Qe++)k.readUByte()}break}case 7:if(T=!0,j=!0,E&&m&&(m.debug+="SPS "),!y.sps){var ot=new U.default(N.data),st=ot.readSPS();y.width=st.width,y.height=st.height,y.pixelRatio=st.pixelRatio,y.sps=[N.data],y.duration=S._duration;for(var ht=N.data.subarray(1,4),mt="avc1.",ft=0;ft<3;ft++){var Ht=ht[ft].toString(16);Ht.length<2&&(Ht="0"+Ht),mt+=Ht}y.codec=mt}break;case 8:T=!0,E&&m&&(m.debug+="PPS "),y.pps||(y.pps=[N.data]);break;case 9:T=!1,y.audFound=!0,m&&o(m,y),m=S.avcSample=n(!1,w.pts,w.dts,E?"AUD ":"");break;case 12:T=!1;break;default:T=!1,m&&(m.debug+="unknown NAL "+N.type+" ");break}if(m&&T){var Vt=m.units;Vt.push(N)}}),_&&m&&(o(m,y),this.avcSample=null)},x.getLastNalUnit=function(){var w,_=this.avcSample,S;if(!_||_.units.length===0){var y=this._avcTrack.samples;_=y[y.length-1]}if((w=_)!==null&&w!==void 0&&w.units){var h=_.units;S=h[h.length-1]}return S},x.parseAVCNALu=function(w){var _=w.byteLength,S=this._avcTrack,y=S.naluState||0,h=y,E=[],m=0,T,j,N,K=-1,W=0;for(y===-1&&(K=0,W=w[0]&31,y=0,m=1);m<_;){if(T=w[m++],!y){y=T?0:1;continue}if(y===1){y=T?0:2;continue}if(!T)y=3;else if(T===1){if(K>=0){var k={data:w.subarray(K,m-y-1),type:W};E.push(k)}else{var b=this.getLastNalUnit();if(b&&(h&&m<=4-h&&(b.state&&(b.data=b.data.subarray(0,b.data.byteLength-h))),j=m-y-1,j>0)){var G=new Uint8Array(b.data.byteLength+j);G.set(b.data,0),G.set(w.subarray(0,j),b.data.byteLength),b.data=G,b.state=0}}m<_?(N=w[m]&31,K=m,W=N,y=0):y=-1}else y=0}if(K>=0&&y>=0){var J={data:w.subarray(K,_),type:W,state:y};E.push(J)}if(E.length===0){var oe=this.getLastNalUnit();if(oe){var fe=new Uint8Array(oe.data.byteLength+w.byteLength);fe.set(oe.data,0),fe.set(w,oe.data.byteLength),oe.data=fe}}return S.naluState=y,E},x.parseAACPES=function(w){var _=0,S=this._audioTrack,y=this.aacOverFlow,h=w.data;if(y){this.aacOverFlow=null;var E=y.sample.unit.byteLength,m=Math.min(y.missing,E),T=E-m;y.sample.unit.set(h.subarray(0,m),T),S.samples.push(y.sample),_=y.missing}var j,N;for(j=_,N=h.length;j<N-1&&!Y.isHeader(h,j);j++);if(j!==_){var K,W;if(j<N-1?(K="AAC PES did not start with ADTS header,offset:"+j,W=!1):(K="no ADTS header found in AAC PES",W=!0),g.logger.warn("parsing error:"+K),this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:p.ErrorTypes.MEDIA_ERROR,details:p.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:K}),W)return}Y.initTrackConfig(S,this.observer,h,j,this.audioCodec);var k;if(w.pts!==void 0)k=w.pts;else if(y){var b=Y.getFrameDuration(S.samplerate);k=y.sample.pts+b}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var G=0;j<N;)if(Y.isHeader(h,j)){if(j+5<N){var J=Y.appendFrame(S,h,j,k,G);if(J)if(J.missing)this.aacOverFlow=J;else{j+=J.length,G++;continue}}break}else j++},x.parseMPEGPES=function(w){var _=w.data,S=_.length,y=0,h=0,E=w.pts;if(E===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;h<S;)if(D.isHeader(_,h)){var m=D.appendFrame(this._audioTrack,_,h,E,y);if(m)h+=m.length,y++;else break}else h++},x.parseID3PES=function(w){if(w.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(w)},C}();l.minProbeByteLength=188;function n(C,x,A,w){return{key:C,frame:!1,pts:x,dts:A,units:[],debug:w,length:0}}function c(C,x){return(C[x+10]&31)<<8|C[x+11]}function s(C,x,A,w){var _={audio:-1,avc:-1,id3:-1,isAAC:!0},S=(C[x+1]&15)<<8|C[x+2],y=x+3+S-4,h=(C[x+10]&15)<<8|C[x+11];for(x+=12+h;x<y;){var E=(C[x+1]&31)<<8|C[x+2];switch(C[x]){case 207:if(!w){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:_.audio===-1&&(_.audio=E);break;case 21:_.id3===-1&&(_.id3=E);break;case 219:if(!w){g.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:_.avc===-1&&(_.avc=E);break;case 3:case 4:A?_.audio===-1&&(_.audio=E,_.isAAC=!1):g.logger.log("MPEG audio found, not supported in this browser");break;case 36:g.logger.warn("Unsupported HEVC stream type found");break;default:break}x+=((C[x+3]&15)<<8|C[x+4])+5}return _}function a(C){var x=0,A,w,_,S,y,h=C.data;if(!C||C.size===0)return null;for(;h[0].length<19&&h.length>1;){var E=new Uint8Array(h[0].length+h[1].length);E.set(h[0]),E.set(h[1],h[0].length),h[0]=E,h.splice(1,1)}A=h[0];var m=(A[0]<<16)+(A[1]<<8)+A[2];if(m===1){if(w=(A[4]<<8)+A[5],w&&w>C.size-6)return null;var T=A[7];T&192&&(S=(A[9]&14)*536870912+(A[10]&255)*4194304+(A[11]&254)*16384+(A[12]&255)*128+(A[13]&254)/2,T&64?(y=(A[14]&14)*536870912+(A[15]&255)*4194304+(A[16]&254)*16384+(A[17]&255)*128+(A[18]&254)/2,S-y>60*9e4&&(g.logger.warn(Math.round((S-y)/9e4)+"s delta between PTS and DTS, align them"),S=y)):y=S),_=A[8];var j=_+9;if(C.size<=j)return null;C.size-=j;for(var N=new Uint8Array(C.size),K=0,W=h.length;K<W;K++){A=h[K];var k=A.byteLength;if(j)if(j>k){j-=k;continue}else A=A.subarray(j),k-=j,j=0;N.set(A,x),x+=k}return w&&(w-=_+3),{data:N,pts:S,dts:y,len:w}}return null}function o(C,x){if(C.units.length&&C.frame){if(C.pts===void 0){var A=x.samples,w=A.length;if(w){var _=A[w-1];C.pts=_.pts,C.dts=_.dts}else{x.dropped++;return}}x.samples.push(C)}C.debug.length&&g.logger.log(C.pts+"/"+C.dts+":"+C.debug)}function f(C,x){var A=C.length;if(A>0){if(x.pts>=C[A-1].pts)C.push(x);else for(var w=A-1;w>=0;w--)if(x.pts<C[w].pts){C.splice(w,0,x);break}}else C.push(x)}function L(C){for(var x=C.byteLength,A=[],w=1;w<x-2;)C[w]===0&&C[w+1]===0&&C[w+2]===3?(A.push(w+2),w+=2):w++;if(A.length===0)return C;var _=x-A.length,S=new Uint8Array(_),y=0;for(w=0;w<_;y++,w++)y===A[0]&&(y++,A.shift()),S[w]=C[y];return S}Q.default=l},"./src/errors.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"ErrorTypes",function(){return Y}),P.d(Q,"ErrorDetails",function(){return D});var Y;(function(U){U.NETWORK_ERROR="networkError",U.MEDIA_ERROR="mediaError",U.KEY_SYSTEM_ERROR="keySystemError",U.MUX_ERROR="muxError",U.OTHER_ERROR="otherError"})(Y||(Y={}));var D;(function(U){U.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",U.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",U.KEY_SYSTEM_NO_SESSION="keySystemNoSession",U.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",U.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",U.MANIFEST_LOAD_ERROR="manifestLoadError",U.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",U.MANIFEST_PARSING_ERROR="manifestParsingError",U.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",U.LEVEL_EMPTY_ERROR="levelEmptyError",U.LEVEL_LOAD_ERROR="levelLoadError",U.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",U.LEVEL_SWITCH_ERROR="levelSwitchError",U.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",U.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",U.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",U.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",U.FRAG_LOAD_ERROR="fragLoadError",U.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",U.FRAG_DECRYPT_ERROR="fragDecryptError",U.FRAG_PARSING_ERROR="fragParsingError",U.REMUX_ALLOC_ERROR="remuxAllocError",U.KEY_LOAD_ERROR="keyLoadError",U.KEY_LOAD_TIMEOUT="keyLoadTimeOut",U.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",U.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",U.BUFFER_APPEND_ERROR="bufferAppendError",U.BUFFER_APPENDING_ERROR="bufferAppendingError",U.BUFFER_STALLED_ERROR="bufferStalledError",U.BUFFER_FULL_ERROR="bufferFullError",U.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",U.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",U.INTERNAL_EXCEPTION="internalException",U.INTERNAL_ABORTED="aborted",U.UNKNOWN="unknown"})(D||(D={}))},"./src/events.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"Events",function(){return Y});var Y;(function(D){D.MEDIA_ATTACHING="hlsMediaAttaching",D.MEDIA_ATTACHED="hlsMediaAttached",D.MEDIA_DETACHING="hlsMediaDetaching",D.MEDIA_DETACHED="hlsMediaDetached",D.BUFFER_RESET="hlsBufferReset",D.BUFFER_CODECS="hlsBufferCodecs",D.BUFFER_CREATED="hlsBufferCreated",D.BUFFER_APPENDING="hlsBufferAppending",D.BUFFER_APPENDED="hlsBufferAppended",D.BUFFER_EOS="hlsBufferEos",D.BUFFER_FLUSHING="hlsBufferFlushing",D.BUFFER_FLUSHED="hlsBufferFlushed",D.MANIFEST_LOADING="hlsManifestLoading",D.MANIFEST_LOADED="hlsManifestLoaded",D.MANIFEST_PARSED="hlsManifestParsed",D.LEVEL_SWITCHING="hlsLevelSwitching",D.LEVEL_SWITCHED="hlsLevelSwitched",D.LEVEL_LOADING="hlsLevelLoading",D.LEVEL_LOADED="hlsLevelLoaded",D.LEVEL_UPDATED="hlsLevelUpdated",D.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",D.LEVELS_UPDATED="hlsLevelsUpdated",D.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",D.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",D.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",D.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",D.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",D.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",D.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",D.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",D.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",D.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",D.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",D.CUES_PARSED="hlsCuesParsed",D.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",D.INIT_PTS_FOUND="hlsInitPtsFound",D.FRAG_LOADING="hlsFragLoading",D.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",D.FRAG_LOADED="hlsFragLoaded",D.FRAG_DECRYPTED="hlsFragDecrypted",D.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",D.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",D.FRAG_PARSING_METADATA="hlsFragParsingMetadata",D.FRAG_PARSED="hlsFragParsed",D.FRAG_BUFFERED="hlsFragBuffered",D.FRAG_CHANGED="hlsFragChanged",D.FPS_DROP="hlsFpsDrop",D.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",D.ERROR="hlsError",D.DESTROYING="hlsDestroying",D.KEY_LOADING="hlsKeyLoading",D.KEY_LOADED="hlsKeyLoaded",D.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",D.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Y||(Y={}))},"./src/hls.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return C});var Y=P("./node_modules/url-toolkit/src/url-toolkit.js"),D=P.n(Y),U=P("./src/loader/playlist-loader.ts"),H=P("./src/loader/key-loader.ts"),I=P("./src/controller/id3-track-controller.ts"),F=P("./src/controller/latency-controller.ts"),R=P("./src/controller/level-controller.ts"),g=P("./src/controller/fragment-tracker.ts"),p=P("./src/controller/stream-controller.ts"),d=P("./src/is-supported.ts"),l=P("./src/utils/logger.ts"),n=P("./src/config.ts"),c=P("./node_modules/eventemitter3/index.js"),s=P.n(c),a=P("./src/events.ts"),o=P("./src/errors.ts");function f(x,A){for(var w=0;w<A.length;w++){var _=A[w];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(x,_.key,_)}}function L(x,A,w){return A&&f(x.prototype,A),w&&f(x,w),x}var C=function(){x.isSupported=function(){return Object(d.isSupported)()};function x(w){w===void 0&&(w={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new c.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var _=this.config=Object(n.mergeConfig)(x.DefaultConfig,w);this.userConfig=w,Object(l.enableLogs)(_.debug),this._autoLevelCapping=-1,_.progressive&&Object(n.enableStreamingMode)(_);var S=_.abrController,y=_.bufferController,h=_.capLevelController,E=_.fpsController,m=this.abrController=new S(this),T=this.bufferController=new y(this),j=this.capLevelController=new h(this),N=new E(this),K=new U.default(this),W=new H.default(this),k=new I.default(this),b=this.levelController=new R.default(this),G=new g.FragmentTracker(this),J=this.streamController=new p.default(this,G);j.setStreamController(J),N.setStreamController(J);var oe=[b,J];this.networkControllers=oe;var fe=[K,W,m,T,j,N,k,G];this.audioTrackController=this.createController(_.audioTrackController,null,oe),this.createController(_.audioStreamController,G,oe),this.subtitleTrackController=this.createController(_.subtitleTrackController,null,oe),this.createController(_.subtitleStreamController,G,oe),this.createController(_.timelineController,null,fe),this.emeController=this.createController(_.emeController,null,fe),this.cmcdController=this.createController(_.cmcdController,null,fe),this.latencyController=this.createController(F.default,null,fe),this.coreComponents=fe}var A=x.prototype;return A.createController=function(_,S,y){if(_){var h=S?new _(this,S):new _(this);return y&&y.push(h),h}return null},A.on=function(_,S,y){y===void 0&&(y=this),this._emitter.on(_,S,y)},A.once=function(_,S,y){y===void 0&&(y=this),this._emitter.once(_,S,y)},A.removeAllListeners=function(_){this._emitter.removeAllListeners(_)},A.off=function(_,S,y,h){y===void 0&&(y=this),this._emitter.off(_,S,y,h)},A.listeners=function(_){return this._emitter.listeners(_)},A.emit=function(_,S,y){return this._emitter.emit(_,S,y)},A.trigger=function(_,S){if(this.config.debug)return this.emit(_,_,S);try{return this.emit(_,_,S)}catch(y){l.logger.error("An internal error happened while handling event "+_+'. Error message: "'+y.message+'". Here is a stacktrace:',y),this.trigger(a.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:_,error:y})}return!1},A.listenerCount=function(_){return this._emitter.listenerCount(_)},A.destroy=function(){l.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(_){return _.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(_){return _.destroy()}),this.coreComponents.length=0},A.attachMedia=function(_){l.logger.log("attachMedia"),this._media=_,this.trigger(a.Events.MEDIA_ATTACHING,{media:_})},A.detachMedia=function(){l.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},A.loadSource=function(_){this.stopLoad();var S=this.media,y=this.url,h=this.url=Y.buildAbsoluteURL(self.location.href,_,{alwaysNormalize:!0});l.logger.log("loadSource:"+h),S&&y&&y!==h&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(S)),this.trigger(a.Events.MANIFEST_LOADING,{url:_})},A.startLoad=function(_){_===void 0&&(_=-1),l.logger.log("startLoad("+_+")"),this.networkControllers.forEach(function(S){S.startLoad(_)})},A.stopLoad=function(){l.logger.log("stopLoad"),this.networkControllers.forEach(function(_){_.stopLoad()})},A.swapAudioCodec=function(){l.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},A.recoverMediaError=function(){l.logger.log("recoverMediaError");var _=this._media;this.detachMedia(),_&&this.attachMedia(_)},A.removeLevel=function(_,S){S===void 0&&(S=0),this.levelController.removeLevel(_,S)},L(x,[{key:"levels",get:function(){var _=this.levelController.levels;return _||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(_){l.logger.log("set currentLevel:"+_),this.loadLevel=_,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(_){l.logger.log("set nextLevel:"+_),this.levelController.manualLevel=_,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(_){l.logger.log("set loadLevel:"+_),this.levelController.manualLevel=_}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(_){this.levelController.nextLoadLevel=_}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(_){l.logger.log("set firstLevel:"+_),this.levelController.firstLevel=_}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(_){l.logger.log("set startLevel:"+_),_!==-1&&(_=Math.max(_,this.minAutoLevel)),this.levelController.startLevel=_}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(_){var S=!!_;S!==this.config.capLevelToPlayerSize&&(S?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=S)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(_){this._autoLevelCapping!==_&&(l.logger.log("set autoLevelCapping:"+_),this._autoLevelCapping=_)}},{key:"bandwidthEstimate",get:function(){var _=this.abrController.bwEstimator;return _?_.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var _=this.levels,S=this.config.minAutoBitrate;if(!_)return 0;for(var y=_.length,h=0;h<y;h++)if(_[h].maxBitrate>S)return h;return 0}},{key:"maxAutoLevel",get:function(){var _=this.levels,S=this.autoLevelCapping,y;return S===-1&&_&&_.length?y=_.length-1:y=S,y}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(_){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,_)}},{key:"audioTracks",get:function(){var _=this.audioTrackController;return _?_.audioTracks:[]}},{key:"audioTrack",get:function(){var _=this.audioTrackController;return _?_.audioTrack:-1},set:function(_){var S=this.audioTrackController;S&&(S.audioTrack=_)}},{key:"subtitleTracks",get:function(){var _=this.subtitleTrackController;return _?_.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var _=this.subtitleTrackController;return _?_.subtitleTrack:-1},set:function(_){var S=this.subtitleTrackController;S&&(S.subtitleTrack=_)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var _=this.subtitleTrackController;return _?_.subtitleDisplay:!1},set:function(_){var S=this.subtitleTrackController;S&&(S.subtitleDisplay=_)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(_){this.config.lowLatencyMode=_}},{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 a.Events}},{key:"ErrorTypes",get:function(){return o.ErrorTypes}},{key:"ErrorDetails",get:function(){return o.ErrorDetails}},{key:"DefaultConfig",get:function(){return x.defaultConfig?x.defaultConfig:n.hlsDefaultConfig},set:function(_){x.defaultConfig=_}}]),x}();C.defaultConfig=void 0},"./src/is-supported.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"isSupported",function(){return U}),P.d(Q,"changeTypeSupported",function(){return H});var Y=P("./src/utils/mediasource-helper.ts");function D(){return self.SourceBuffer||self.WebKitSourceBuffer}function U(){var I=Object(Y.getMediaSource)();if(!I)return!1;var F=D(),R=I&&typeof I.isTypeSupported=="function"&&I.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!F||F.prototype&&typeof F.prototype.appendBuffer=="function"&&typeof F.prototype.remove=="function";return!!R&&!!g}function H(){var I,F=D();return typeof(F==null||((I=F.prototype)===null||I===void 0)?void 0:I.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return l}),P.d(Q,"LoadError",function(){return c});var Y=P("./src/polyfills/number.ts"),D=P("./src/errors.ts");function U(s,a){s.prototype=Object.create(a.prototype),s.prototype.constructor=s,g(s,a)}function H(s){var a=typeof Map=="function"?new Map:void 0;return H=function(f){if(f===null||!R(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(f))return a.get(f);a.set(f,L)}function L(){return I(f,arguments,p(this).constructor)}return L.prototype=Object.create(f.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),g(L,f)},H(s)}function I(s,a,o){return F()?I=Reflect.construct:I=function(L,C,x){var A=[null];A.push.apply(A,C);var w=Function.bind.apply(L,A),_=new w;return x&&g(_,x.prototype),_},I.apply(null,arguments)}function F(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(s){return!1}}function R(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function g(s,a){return g=Object.setPrototypeOf||function(f,L){return f.__proto__=L,f},g(s,a)}function p(s){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(o){return o.__proto__||Object.getPrototypeOf(o)},p(s)}var d=Math.pow(2,17),l=function(){function s(o){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=o}var a=s.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(f,L){var C=this,x=f.url;if(!x)return Promise.reject(new c({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:f,networkDetails:null},"Fragment does not have a "+(x?"part list":"url")));this.abort();var A=this.config,w=A.fLoader,_=A.loader;return new Promise(function(S,y){C.loader&&C.loader.destroy();var h=C.loader=f.loader=w?new w(A):new _(A),E=n(f),m={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:d};f.stats=h.stats,h.load(E,m,{onSuccess:function(j,N,K,W){C.resetLoader(f,h),S({frag:f,part:null,payload:j.data,networkDetails:W})},onError:function(j,N,K){C.resetLoader(f,h),y(new c({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:f,response:j,networkDetails:K}))},onAbort:function(j,N,K){C.resetLoader(f,h),y(new c({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:f,networkDetails:K}))},onTimeout:function(j,N,K){C.resetLoader(f,h),y(new c({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:f,networkDetails:K}))},onProgress:function(j,N,K,W){L&&L({frag:f,part:null,payload:K,networkDetails:W})}})})},a.loadPart=function(f,L,C){var x=this;this.abort();var A=this.config,w=A.fLoader,_=A.loader;return new Promise(function(S,y){x.loader&&x.loader.destroy();var h=x.loader=f.loader=w?new w(A):new _(A),E=n(f,L),m={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:d};L.stats=h.stats,h.load(E,m,{onSuccess:function(j,N,K,W){x.resetLoader(f,h),x.updateStatsFromPart(f,L);var k={frag:f,part:L,payload:j.data,networkDetails:W};C(k),S(k)},onError:function(j,N,K){x.resetLoader(f,h),y(new c({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:f,part:L,response:j,networkDetails:K}))},onAbort:function(j,N,K){f.stats.aborted=L.stats.aborted,x.resetLoader(f,h),y(new c({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:f,part:L,networkDetails:K}))},onTimeout:function(j,N,K){x.resetLoader(f,h),y(new c({type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:f,part:L,networkDetails:K}))}})})},a.updateStatsFromPart=function(f,L){var C=f.stats,x=L.stats,A=x.total;if(C.loaded+=x.loaded,A){var w=Math.round(f.duration/L.duration),_=Math.min(Math.round(C.loaded/A),w),S=w-_,y=S*Math.round(C.loaded/_);C.total=C.loaded+y}else C.total=Math.max(C.loaded,C.total);var h=C.loading,E=x.loading;h.start?h.first+=E.first-E.start:(h.start=E.start,h.first=E.first),h.end=E.end},a.resetLoader=function(f,L){f.loader=null,this.loader===L&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),L.destroy()},s}();function n(s,a){a===void 0&&(a=null);var o=a||s,f={frag:s,part:a,responseType:"arraybuffer",url:o.url,headers:{},rangeStart:0,rangeEnd:0},L=o.byteRangeStartOffset,C=o.byteRangeEndOffset;return Object(Y.isFiniteNumber)(L)&&Object(Y.isFiniteNumber)(C)&&(f.rangeStart=L,f.rangeEnd=C),f}var c=function(s){U(a,s);function a(o){for(var f,L=arguments.length,C=new Array(L>1?L-1:0),x=1;x<L;x++)C[x-1]=arguments[x];return f=s.call.apply(s,[this].concat(C))||this,f.data=void 0,f.data=o,f}return a}(H(Error))},"./src/loader/fragment.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"ElementaryStreamTypes",function(){return l}),P.d(Q,"BaseSegment",function(){return n}),P.d(Q,"Fragment",function(){return c}),P.d(Q,"Part",function(){return s});var Y=P("./src/polyfills/number.ts"),D=P("./node_modules/url-toolkit/src/url-toolkit.js"),U=P.n(D),H=P("./src/utils/logger.ts"),I=P("./src/loader/level-key.ts"),F=P("./src/loader/load-stats.ts");function R(a,o){a.prototype=Object.create(o.prototype),a.prototype.constructor=a,g(a,o)}function g(a,o){return g=Object.setPrototypeOf||function(L,C){return L.__proto__=C,L},g(a,o)}function p(a,o){for(var f=0;f<o.length;f++){var L=o[f];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(a,L.key,L)}}function d(a,o,f){return o&&p(a.prototype,o),f&&p(a,f),a}var l;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(l||(l={}));var n=function(){function a(f){var L;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(L={},L[l.AUDIO]=null,L[l.VIDEO]=null,L[l.AUDIOVIDEO]=null,L),this.baseurl=f}var o=a.prototype;return o.setByteRange=function(L,C){var x=L.split("@",2),A=[];x.length===1?A[0]=C?C.byteRangeEndOffset:0:A[0]=parseInt(x[1]),A[1]=parseInt(x[0])+A[0],this._byteRange=A},d(a,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(D.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(L){this._url=L}}]),a}(),c=function(a){R(o,a);function o(L,C){var x;return x=a.call(this,C)||this,x._decryptdata=null,x.rawProgramDateTime=null,x.programDateTime=null,x.tagList=[],x.duration=0,x.sn=0,x.levelkey=void 0,x.type=void 0,x.loader=null,x.level=-1,x.cc=0,x.startPTS=void 0,x.endPTS=void 0,x.appendedPTS=void 0,x.startDTS=void 0,x.endDTS=void 0,x.start=0,x.deltaPTS=void 0,x.maxStartPTS=void 0,x.minEndPTS=void 0,x.stats=new F.LoadStats,x.urlId=0,x.data=void 0,x.bitrateTest=!1,x.title=null,x.initSegment=null,x.type=L,x}var f=o.prototype;return f.createInitializationVector=function(C){for(var x=new Uint8Array(16),A=12;A<16;A++)x[A]=C>>8*(15-A)&255;return x},f.setDecryptDataFromLevelKey=function(C,x){var A=C;return(C==null?void 0:C.method)==="AES-128"&&C.uri&&!C.iv&&(A=I.LevelKey.fromURI(C.uri),A.method=C.method,A.iv=this.createInitializationVector(x),A.keyFormat="identity"),A},f.setElementaryStreamInfo=function(C,x,A,w,_,S){S===void 0&&(S=!1);var y=this.elementaryStreams,h=y[C];if(!h){y[C]={startPTS:x,endPTS:A,startDTS:w,endDTS:_,partial:S};return}h.startPTS=Math.min(h.startPTS,x),h.endPTS=Math.max(h.endPTS,A),h.startDTS=Math.min(h.startDTS,w),h.endDTS=Math.max(h.endDTS,_)},f.clearElementaryStreamInfo=function(){var C=this.elementaryStreams;C[l.AUDIO]=null,C[l.VIDEO]=null,C[l.AUDIOVIDEO]=null},d(o,[{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&&H.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(Y.isFiniteNumber)(this.programDateTime))return null;var C=Object(Y.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)}}]),o}(n),s=function(a){R(o,a);function o(f,L,C,x,A){var w;w=a.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 F.LoadStats,w.duration=f.decimalFloatingPoint("DURATION"),w.gap=f.bool("GAP"),w.independent=f.bool("INDEPENDENT"),w.relurl=f.enumeratedString("URI"),w.fragment=L,w.index=x;var _=f.enumeratedString("BYTERANGE");return _&&w.setByteRange(_,A),A&&(w.fragOffset=A.fragOffset+A.duration),w}return d(o,[{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)}}]),o}(n)},"./src/loader/key-loader.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return H});var Y=P("./src/events.ts"),D=P("./src/errors.ts"),U=P("./src/utils/logger.ts"),H=function(){function I(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var F=I.prototype;return F._registerListeners=function(){this.hls.on(Y.Events.KEY_LOADING,this.onKeyLoading,this)},F._unregisterListeners=function(){this.hls.off(Y.Events.KEY_LOADING,this.onKeyLoading)},F.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var p=this.loaders[g];p&&p.destroy()}this.loaders={}},F.onKeyLoading=function(g,p){var d=p.frag,l=d.type,n=this.loaders[l];if(!d.decryptdata){U.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var c=d.decryptdata.uri;if(c!==this.decrypturl||this.decryptkey===null){var s=this.hls.config;if(n&&(U.logger.warn("abort previous key loader for type:"+l),n.abort()),!c){U.logger.warn("key uri is falsy");return}var a=s.loader,o=d.loader=this.loaders[l]=new a(s);this.decrypturl=c,this.decryptkey=null;var f={url:c,frag:d,responseType:"arraybuffer"},L={timeout:s.fragLoadingTimeOut,maxRetry:0,retryDelay:s.fragLoadingRetryDelay,maxRetryDelay:s.fragLoadingMaxRetryTimeout,highWaterMark:0},C={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};o.load(f,L,C)}else this.decryptkey&&(d.decryptdata.key=this.decryptkey,this.hls.trigger(Y.Events.KEY_LOADED,{frag:d}))},F.loadsuccess=function(g,p,d){var l=d.frag;if(!l.decryptdata){U.logger.error("after key load, decryptdata unset");return}this.decryptkey=l.decryptdata.key=new Uint8Array(g.data),l.loader=null,delete this.loaders[l.type],this.hls.trigger(Y.Events.KEY_LOADED,{frag:l})},F.loaderror=function(g,p){var d=p.frag,l=d.loader;l&&l.abort(),delete this.loaders[d.type],this.hls.trigger(Y.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:d,response:g})},F.loadtimeout=function(g,p){var d=p.frag,l=d.loader;l&&l.abort(),delete this.loaders[d.type],this.hls.trigger(Y.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:d})},I}()},"./src/loader/level-details.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"LevelDetails",function(){return I});var Y=P("./src/polyfills/number.ts");function D(F,R){for(var g=0;g<R.length;g++){var p=R[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(F,p.key,p)}}function U(F,R,g){return R&&D(F.prototype,R),g&&D(F,g),F}var H=10,I=function(){function F(g){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=g}var R=F.prototype;return R.reloaded=function(p){if(!p){this.advanced=!0,this.updated=!0;return}var d=this.lastPartSn-p.lastPartSn,l=this.lastPartIndex-p.lastPartIndex;this.updated=this.endSN!==p.endSN||!!l||!!d,this.advanced=this.endSN>p.endSN||d>0||d===0&&l>0,this.updated||this.advanced?this.misses=Math.floor(p.misses*.6):this.misses=p.misses+1,this.availabilityDelay=p.availabilityDelay},U(F,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Y.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||H}},{key:"drift",get:function(){var p=this.driftEndTime-this.driftStartTime;if(p>0){var d=this.driftEnd-this.driftStart;return d*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}}]),F}()},"./src/loader/level-key.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"LevelKey",function(){return I});var Y=P("./node_modules/url-toolkit/src/url-toolkit.js"),D=P.n(Y);function U(F,R){for(var g=0;g<R.length;g++){var p=R[g];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(F,p.key,p)}}function H(F,R,g){return R&&U(F.prototype,R),g&&U(F,g),F}var I=function(){F.fromURL=function(g,p){return new F(g,p)},F.fromURI=function(g){return new F(g)};function F(R,g){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,g?this._uri=Object(Y.buildAbsoluteURL)(R,g,{alwaysNormalize:!0}):this._uri=R}return H(F,[{key:"uri",get:function(){return this._uri}}]),F}()},"./src/loader/load-stats.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"LoadStats",function(){return Y});var Y=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return o});var Y=P("./src/polyfills/number.ts"),D=P("./node_modules/url-toolkit/src/url-toolkit.js"),U=P.n(D),H=P("./src/loader/fragment.ts"),I=P("./src/loader/level-details.ts"),F=P("./src/loader/level-key.ts"),R=P("./src/utils/attr-list.ts"),g=P("./src/utils/logger.ts"),p=P("./src/utils/codecs.ts"),d=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,l=/#EXT-X-MEDIA:(.*)/g,n=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),c=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),s=/\.(mp4|m4s|m4v|m4a)$/i;function a(A){var w,_;return s.test((w=(_=D.parseURL(A))===null||_===void 0?void 0:_.path)!=null?w:"")}var o=function(){function A(){}return A.findGroup=function(_,S){for(var y=0;y<_.length;y++){var h=_[y];if(h.id===S)return h}},A.convertAVC1ToAVCOTI=function(_){var S=_.split(".");if(S.length>2){var y=S.shift()+".";return y+=parseInt(S.shift()).toString(16),y+=("000"+parseInt(S.shift()).toString(16)).substr(-4),y}return _},A.resolve=function(_,S){return D.buildAbsoluteURL(S,_,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(_,S){var y=[],h={},E=!1;d.lastIndex=0;for(var m;(m=d.exec(_))!=null;)if(m[1]){var T=new R.AttrList(m[1]),j={attrs:T,bitrate:T.decimalInteger("AVERAGE-BANDWIDTH")||T.decimalInteger("BANDWIDTH"),name:T.NAME,url:A.resolve(m[2],S)},N=T.decimalResolution("RESOLUTION");N&&(j.width=N.width,j.height=N.height),f((T.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),j),j.videoCodec&&j.videoCodec.indexOf("avc1")!==-1&&(j.videoCodec=A.convertAVC1ToAVCOTI(j.videoCodec)),y.push(j)}else if(m[3]){var K=new R.AttrList(m[3]);K["DATA-ID"]&&(E=!0,h[K["DATA-ID"]]=K)}return{levels:y,sessionData:E?h:null}},A.parseMasterPlaylistMedia=function(_,S,y,h){h===void 0&&(h=[]);var E,m=[],T=0;for(l.lastIndex=0;(E=l.exec(_))!==null;){var j=new R.AttrList(E[1]);if(j.TYPE===y){var N={attrs:j,bitrate:0,id:T++,groupId:j["GROUP-ID"],instreamId:j["INSTREAM-ID"],name:j.NAME||j.LANGUAGE||"",type:y,default:j.bool("DEFAULT"),autoselect:j.bool("AUTOSELECT"),forced:j.bool("FORCED"),lang:j.LANGUAGE,url:j.URI?A.resolve(j.URI,S):""};if(h.length){var K=A.findGroup(h,N.groupId)||h[0];L(N,K,"audioCodec"),L(N,K,"textCodec")}m.push(N)}}return m},A.parseLevelPlaylist=function(_,S,y,h,E){var m=new I.LevelDetails(S),T=m.fragments,j=null,N=0,K=0,W=0,k=0,b=null,G=new H.Fragment(h,S),J,oe,fe,Ne=-1,_e=!1;for(n.lastIndex=0,m.m3u8=_;(J=n.exec(_))!==null;){_e&&(_e=!1,G=new H.Fragment(h,S),G.start=W,G.sn=N,G.cc=k,G.level=y,j&&(G.initSegment=j,G.rawProgramDateTime=j.rawProgramDateTime));var Fe=J[1];if(Fe){G.duration=parseFloat(Fe);var We=(" "+J[2]).slice(1);G.title=We||null,G.tagList.push(We?["INF",Fe,We]:["INF",Fe])}else if(J[3])Object(Y.isFiniteNumber)(G.duration)&&(G.start=W,fe&&(G.levelkey=fe),G.sn=N,G.level=y,G.cc=k,G.urlId=E,T.push(G),G.relurl=(" "+J[3]).slice(1),x(G,b),b=G,W+=G.duration,N++,K=0,_e=!0);else if(J[4]){var Ue=(" "+J[4]).slice(1);b?G.setByteRange(Ue,b):G.setByteRange(Ue)}else if(J[5])G.rawProgramDateTime=(" "+J[5]).slice(1),G.tagList.push(["PROGRAM-DATE-TIME",G.rawProgramDateTime]),Ne===-1&&(Ne=T.length);else{if(J=J[0].match(c),!J){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(oe=1;oe<J.length&&!(typeof J[oe]!="undefined");oe++);var xe=(" "+J[oe]).slice(1),ue=(" "+J[oe+1]).slice(1),ae=J[oe+2]?(" "+J[oe+2]).slice(1):"";switch(xe){case"PLAYLIST-TYPE":m.type=ue.toUpperCase();break;case"MEDIA-SEQUENCE":N=m.startSN=parseInt(ue);break;case"SKIP":{var Ee=new R.AttrList(ue),de=Ee.decimalInteger("SKIPPED-SEGMENTS");if(Object(Y.isFiniteNumber)(de)){m.skippedSegments=de;for(var Ke=de;Ke--;)T.unshift(null);N+=de}var Je=Ee.enumeratedString("RECENTLY-REMOVED-DATERANGES");Je&&(m.recentlyRemovedDateranges=Je.split(" "));break}case"TARGETDURATION":m.targetduration=parseFloat(ue);break;case"VERSION":m.version=parseInt(ue);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(ue||ae)&&G.tagList.push(ae?[ue,ae]:[ue]);break;case"DIS":k++;case"GAP":G.tagList.push([xe]);break;case"BITRATE":G.tagList.push([xe,ue]);break;case"DISCONTINUITY-SEQ":k=parseInt(ue);break;case"KEY":{var je,Qe=new R.AttrList(ue),ot=Qe.enumeratedString("METHOD"),st=Qe.URI,ht=Qe.hexadecimalInteger("IV"),mt=Qe.enumeratedString("KEYFORMATVERSIONS"),ft=Qe.enumeratedString("KEYID"),Ht=(je=Qe.enumeratedString("KEYFORMAT"))!=null?je:"identity",Vt=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Vt.indexOf(Ht)>-1){g.logger.warn("Keyformat "+Ht+" is not supported from the manifest");continue}else if(Ht!=="identity")continue;ot&&(fe=F.LevelKey.fromURL(S,st),st&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(ot)>=0&&(fe.method=ot,fe.keyFormat=Ht,ft&&(fe.keyID=ft),mt&&(fe.keyFormatVersions=mt),fe.iv=ht));break}case"START":{var zt=new R.AttrList(ue),Tt=zt.decimalFloatingPoint("TIME-OFFSET");Object(Y.isFiniteNumber)(Tt)&&(m.startTimeOffset=Tt);break}case"MAP":{var hn=new R.AttrList(ue);G.relurl=hn.URI,hn.BYTERANGE&&G.setByteRange(hn.BYTERANGE),G.level=y,G.sn="initSegment",fe&&(G.levelkey=fe),G.initSegment=null,j=G,_e=!0;break}case"SERVER-CONTROL":{var Xt=new R.AttrList(ue);m.canBlockReload=Xt.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=Xt.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&Xt.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=Xt.optionalFloat("PART-HOLD-BACK",0),m.holdBack=Xt.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Wt=new R.AttrList(ue);m.partTarget=Wt.decimalFloatingPoint("PART-TARGET");break}case"PART":{var it=m.partList;it||(it=m.partList=[]);var un=K>0?it[it.length-1]:void 0,Kt=K++,qe=new H.Part(new R.AttrList(ue),G,S,Kt,un);it.push(qe),G.duration+=qe.duration;break}case"PRELOAD-HINT":{var wt=new R.AttrList(ue);m.preloadHint=wt;break}case"RENDITION-REPORT":{var Be=new R.AttrList(ue);m.renditionReports=m.renditionReports||[],m.renditionReports.push(Be);break}default:g.logger.warn("line parsed but not handled: "+J);break}}}b&&!b.relurl?(T.pop(),W-=b.duration,m.partList&&(m.fragmentHint=b)):m.partList&&(x(G,b),G.cc=k,m.fragmentHint=G);var Ae=T.length,Ie=T[0],se=T[Ae-1];if(W+=m.skippedSegments*m.targetduration,W>0&&Ae&&se){m.averagetargetduration=W/Ae;var ce=se.sn;m.endSN=ce!=="initSegment"?ce:0,Ie&&(m.startCC=Ie.cc,Ie.initSegment||m.fragments.every(function(ye){return ye.relurl&&a(ye.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),G=new H.Fragment(h,S),G.relurl=se.relurl,G.level=y,G.sn="initSegment",Ie.initSegment=G,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(W+=m.fragmentHint.duration),m.totalduration=W,m.endCC=k,Ne>0&&C(T,Ne),m},A}();function f(A,w){["video","audio","text"].forEach(function(_){var S=A.filter(function(h){return Object(p.isCodecType)(h,_)});if(S.length){var y=S.filter(function(h){return h.lastIndexOf("avc1",0)===0||h.lastIndexOf("mp4a",0)===0});w[_+"Codec"]=y.length>0?y[0]:S[0],A=A.filter(function(h){return S.indexOf(h)===-1})}}),w.unknownCodecs=A}function L(A,w,_){var S=w[_];S&&(A[_]=S)}function C(A,w){for(var _=A[w],S=w;S--;){var y=A[S];if(!y)return;y.programDateTime=_.programDateTime-y.duration*1e3,_=y}}function x(A,w){A.rawProgramDateTime?A.programDateTime=Date.parse(A.rawProgramDateTime):w!=null&&w.programDateTime&&(A.programDateTime=w.endProgramDateTime),Object(Y.isFiniteNumber)(A.programDateTime)||(A.programDateTime=null,A.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/polyfills/number.ts"),D=P("./src/events.ts"),U=P("./src/errors.ts"),H=P("./src/utils/logger.ts"),I=P("./src/utils/mp4-tools.ts"),F=P("./src/loader/m3u8-parser.ts"),R=P("./src/types/loader.ts"),g=P("./src/utils/attr-list.ts");function p(n){var c=n.type;switch(c){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function d(n,c){var s=n.url;return(s===void 0||s.indexOf("data:")===0)&&(s=c.url),s}var l=function(){function n(s){this.hls=void 0,this.loaders=Object.create(null),this.hls=s,this.registerListeners()}var c=n.prototype;return c.registerListeners=function(){var a=this.hls;a.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(D.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(D.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(D.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},c.unregisterListeners=function(){var a=this.hls;a.off(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(D.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(D.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(D.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},c.createInternalLoader=function(a){var o=this.hls.config,f=o.pLoader,L=o.loader,C=f||L,x=new C(o);return a.loader=x,this.loaders[a.type]=x,x},c.getInternalLoader=function(a){return this.loaders[a.type]},c.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},c.destroyInternalLoaders=function(){for(var a in this.loaders){var o=this.loaders[a];o&&o.destroy(),this.resetInternalLoader(a)}},c.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},c.onManifestLoading=function(a,o){var f=o.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:f,deliveryDirectives:null})},c.onLevelLoading=function(a,o){var f=o.id,L=o.level,C=o.url,x=o.deliveryDirectives;this.load({id:f,groupId:null,level:L,responseType:"text",type:R.PlaylistContextType.LEVEL,url:C,deliveryDirectives:x})},c.onAudioTrackLoading=function(a,o){var f=o.id,L=o.groupId,C=o.url,x=o.deliveryDirectives;this.load({id:f,groupId:L,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:C,deliveryDirectives:x})},c.onSubtitleTrackLoading=function(a,o){var f=o.id,L=o.groupId,C=o.url,x=o.deliveryDirectives;this.load({id:f,groupId:L,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:C,deliveryDirectives:x})},c.load=function(a){var o,f=this.hls.config,L=this.getInternalLoader(a);if(L){var C=L.context;if(C&&C.url===a.url){H.logger.trace("[playlist-loader]: playlist request ongoing");return}H.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),L.abort()}var x,A,w,_;switch(a.type){case R.PlaylistContextType.MANIFEST:x=f.manifestLoadingMaxRetry,A=f.manifestLoadingTimeOut,w=f.manifestLoadingRetryDelay,_=f.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:x=0,A=f.levelLoadingTimeOut;break;default:x=f.levelLoadingMaxRetry,A=f.levelLoadingTimeOut,w=f.levelLoadingRetryDelay,_=f.levelLoadingMaxRetryTimeout;break}if(L=this.createInternalLoader(a),(o=a.deliveryDirectives)!==null&&o!==void 0&&o.part){var S;if(a.type===R.PlaylistContextType.LEVEL&&a.level!==null?S=this.hls.levels[a.level].details:a.type===R.PlaylistContextType.AUDIO_TRACK&&a.id!==null?S=this.hls.audioTracks[a.id].details:a.type===R.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(S=this.hls.subtitleTracks[a.id].details),S){var y=S.partTarget,h=S.targetduration;y&&h&&(A=Math.min(Math.max(y*3,h*.8)*1e3,A))}}var E={timeout:A,maxRetry:x,retryDelay:w,maxRetryDelay:_,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};L.load(a,E,m)},c.loadsuccess=function(a,o,f,L){if(L===void 0&&(L=null),f.isSidxRequest){this.handleSidxRequest(a,f),this.handlePlaylistLoaded(a,o,f,L);return}this.resetInternalLoader(f.type);var C=a.data;if(C.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,f,"no EXTM3U delimiter",L);return}o.parsing.start=performance.now(),C.indexOf("#EXTINF:")>0||C.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,o,f,L):this.handleMasterPlaylist(a,o,f,L)},c.loaderror=function(a,o,f){f===void 0&&(f=null),this.handleNetworkError(o,f,!1,a)},c.loadtimeout=function(a,o,f){f===void 0&&(f=null),this.handleNetworkError(o,f,!0)},c.handleMasterPlaylist=function(a,o,f,L){var C=this.hls,x=a.data,A=d(a,f),w=F.default.parseMasterPlaylist(x,A),_=w.levels,S=w.sessionData;if(!_.length){this.handleManifestParsingError(a,f,"no level found in manifest",L);return}var y=_.map(function(N){return{id:N.attrs.AUDIO,audioCodec:N.audioCodec}}),h=_.map(function(N){return{id:N.attrs.SUBTITLES,textCodec:N.textCodec}}),E=F.default.parseMasterPlaylistMedia(x,A,"AUDIO",y),m=F.default.parseMasterPlaylistMedia(x,A,"SUBTITLES",h),T=F.default.parseMasterPlaylistMedia(x,A,"CLOSED-CAPTIONS");if(E.length){var j=E.some(function(N){return!N.url});!j&&_[0].audioCodec&&!_[0].attrs.AUDIO&&(H.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(D.Events.MANIFEST_LOADED,{levels:_,audioTracks:E,subtitles:m,captions:T,url:A,stats:o,networkDetails:L,sessionData:S})},c.handleTrackOrLevelPlaylist=function(a,o,f,L){var C=this.hls,x=f.id,A=f.level,w=f.type,_=d(a,f),S=Object(Y.isFiniteNumber)(x)?x:0,y=Object(Y.isFiniteNumber)(A)?A:S,h=p(f),E=F.default.parseLevelPlaylist(a.data,_,y,h,S);if(!E.fragments.length){C.trigger(D.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:_,reason:"no fragments found in level",level:typeof f.level=="number"?f.level:void 0});return}if(w===R.PlaylistContextType.MANIFEST){var m={attrs:new g.AttrList({}),bitrate:0,details:E,name:"",url:_};C.trigger(D.Events.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:_,stats:o,networkDetails:L,sessionData:null})}if(o.parsing.end=performance.now(),E.needSidxRanges){var T,j=(T=E.fragments[0].initSegment)===null||T===void 0?void 0:T.url;this.load({url:j,isSidxRequest:!0,type:w,level:A,levelDetails:E,id:x,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}f.levelDetails=E,this.handlePlaylistLoaded(a,o,f,L)},c.handleSidxRequest=function(a,o){var f=Object(I.parseSegmentIndex)(new Uint8Array(a.data));if(!f)return;var L=f.references,C=o.levelDetails;L.forEach(function(x,A){var w=x.info,_=C.fragments[A];_.byteRange.length===0&&_.setByteRange(String(1+w.end-w.start)+"@"+String(w.start)),_.initSegment&&_.initSegment.setByteRange(String(f.moovEndOffset)+"@0")})},c.handleManifestParsingError=function(a,o,f,L){this.hls.trigger(D.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:o.type===R.PlaylistContextType.MANIFEST,url:a.url,reason:f,response:a,context:o,networkDetails:L})},c.handleNetworkError=function(a,o,f,L){f===void 0&&(f=!1),H.logger.warn("[playlist-loader]: A network "+(f?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var C=U.ErrorDetails.UNKNOWN,x=!1,A=this.getInternalLoader(a);switch(a.type){case R.PlaylistContextType.MANIFEST:C=f?U.ErrorDetails.MANIFEST_LOAD_TIMEOUT:U.ErrorDetails.MANIFEST_LOAD_ERROR,x=!0;break;case R.PlaylistContextType.LEVEL:C=f?U.ErrorDetails.LEVEL_LOAD_TIMEOUT:U.ErrorDetails.LEVEL_LOAD_ERROR,x=!1;break;case R.PlaylistContextType.AUDIO_TRACK:C=f?U.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,x=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:C=f?U.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:U.ErrorDetails.SUBTITLE_LOAD_ERROR,x=!1;break}A&&this.resetInternalLoader(a.type);var w={type:U.ErrorTypes.NETWORK_ERROR,details:C,fatal:x,url:a.url,loader:A,context:a,networkDetails:o};L&&(w.response=L),this.hls.trigger(D.Events.ERROR,w)},c.handlePlaylistLoaded=function(a,o,f,L){var C=f.type,x=f.level,A=f.id,w=f.groupId,_=f.loader,S=f.levelDetails,y=f.deliveryDirectives;if(!(S!=null&&S.targetduration)){this.handleManifestParsingError(a,f,"invalid target duration",L);return}if(!_)return;S.live&&(_.getCacheAge&&(S.ageHeader=_.getCacheAge()||0),(!_.getCacheAge||isNaN(S.ageHeader))&&(S.ageHeader=0));switch(C){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(D.Events.LEVEL_LOADED,{details:S,level:x||0,id:A||0,stats:o,networkDetails:L,deliveryDirectives:y});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(D.Events.AUDIO_TRACK_LOADED,{details:S,id:A||0,groupId:w||"",stats:o,networkDetails:L,deliveryDirectives:y});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(D.Events.SUBTITLE_TRACK_LOADED,{details:S,id:A||0,groupId:w||"",stats:o,networkDetails:L,deliveryDirectives:y});break}},n}();Q.default=l},"./src/polyfills/number.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"isFiniteNumber",function(){return Y}),P.d(Q,"MAX_SAFE_INTEGER",function(){return D});var Y=Number.isFinite||function(U){return typeof U=="number"&&isFinite(U)},D=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(le,Q,P){"use strict";P.r(Q);var Y=function(){function D(){}return D.getSilentFrame=function(H,I){switch(H){case"mp4a.40.2":if(I===1)return new Uint8Array([0,200,0,128,35,128]);if(I===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(I===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(I===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(I===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(I===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(I===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(I===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(I===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},D}();Q.default=Y},"./src/remux/mp4-generator.ts":function(le,Q,P){"use strict";P.r(Q);var Y=Math.pow(2,32)-1,D=function(){function U(){}return U.init=function(){U.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var I;for(I in U.types)U.types.hasOwnProperty(I)&&(U.types[I]=[I.charCodeAt(0),I.charCodeAt(1),I.charCodeAt(2),I.charCodeAt(3)]);var F=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]);U.HDLR_TYPES={video:F,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]);U.STTS=U.STSC=U.STCO=p,U.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),U.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),U.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),U.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var d=new Uint8Array([105,115,111,109]),l=new Uint8Array([97,118,99,49]),n=new Uint8Array([0,0,0,1]);U.FTYP=U.box(U.types.ftyp,d,n,d,l),U.DINF=U.box(U.types.dinf,U.box(U.types.dref,g))},U.box=function(I){for(var F=8,R=arguments.length,g=new Array(R>1?R-1:0),p=1;p<R;p++)g[p-1]=arguments[p];for(var d=g.length,l=d;d--;)F+=g[d].byteLength;var n=new Uint8Array(F);for(n[0]=F>>24&255,n[1]=F>>16&255,n[2]=F>>8&255,n[3]=F&255,n.set(I,4),d=0,F=8;d<l;d++)n.set(g[d],F),F+=g[d].byteLength;return n},U.hdlr=function(I){return U.box(U.types.hdlr,U.HDLR_TYPES[I])},U.mdat=function(I){return U.box(U.types.mdat,I)},U.mdhd=function(I,F){F*=I;var R=Math.floor(F/(Y+1)),g=Math.floor(F%(Y+1));return U.box(U.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&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]))},U.mdia=function(I){return U.box(U.types.mdia,U.mdhd(I.timescale,I.duration),U.hdlr(I.type),U.minf(I))},U.mfhd=function(I){return U.box(U.types.mfhd,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255]))},U.minf=function(I){return I.type==="audio"?U.box(U.types.minf,U.box(U.types.smhd,U.SMHD),U.DINF,U.stbl(I)):U.box(U.types.minf,U.box(U.types.vmhd,U.VMHD),U.DINF,U.stbl(I))},U.moof=function(I,F,R){return U.box(U.types.moof,U.mfhd(I),U.traf(R,F))},U.moov=function(I){for(var F=I.length,R=[];F--;)R[F]=U.trak(I[F]);return U.box.apply(null,[U.types.moov,U.mvhd(I[0].timescale,I[0].duration)].concat(R).concat(U.mvex(I)))},U.mvex=function(I){for(var F=I.length,R=[];F--;)R[F]=U.trex(I[F]);return U.box.apply(null,[U.types.mvex].concat(R))},U.mvhd=function(I,F){F*=I;var R=Math.floor(F/(Y+1)),g=Math.floor(F%(Y+1)),p=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&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 U.box(U.types.mvhd,p)},U.sdtp=function(I){var F=I.samples||[],R=new Uint8Array(4+F.length),g,p;for(g=0;g<F.length;g++)p=F[g].flags,R[g+4]=p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy;return U.box(U.types.sdtp,R)},U.stbl=function(I){return U.box(U.types.stbl,U.stsd(I),U.box(U.types.stts,U.STTS),U.box(U.types.stsc,U.STSC),U.box(U.types.stsz,U.STSZ),U.box(U.types.stco,U.STCO))},U.avc1=function(I){var F=[],R=[],g,p,d;for(g=0;g<I.sps.length;g++)p=I.sps[g],d=p.byteLength,F.push(d>>>8&255),F.push(d&255),F=F.concat(Array.prototype.slice.call(p));for(g=0;g<I.pps.length;g++)p=I.pps[g],d=p.byteLength,R.push(d>>>8&255),R.push(d&255),R=R.concat(Array.prototype.slice.call(p));var l=U.box(U.types.avcC,new Uint8Array([1,F[3],F[4],F[5],252|3,224|I.sps.length].concat(F).concat([I.pps.length]).concat(R))),n=I.width,c=I.height,s=I.pixelRatio[0],a=I.pixelRatio[1];return U.box(U.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,n>>8&255,n&255,c>>8&255,c&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]),l,U.box(U.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),U.box(U.types.pasp,new Uint8Array([s>>24,s>>16&255,s>>8&255,s&255,a>>24,a>>16&255,a>>8&255,a&255])))},U.esds=function(I){var F=I.config.length;return new Uint8Array([0,0,0,0,3,23+F,0,1,0,4,15+F,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([F]).concat(I.config).concat([6,1,2]))},U.mp4a=function(I){var F=I.samplerate;return U.box(U.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,F>>8&255,F&255,0,0]),U.box(U.types.esds,U.esds(I)))},U.mp3=function(I){var F=I.samplerate;return U.box(U.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,F>>8&255,F&255,0,0]))},U.stsd=function(I){return I.type==="audio"?!I.isAAC&&I.codec==="mp3"?U.box(U.types.stsd,U.STSD,U.mp3(I)):U.box(U.types.stsd,U.STSD,U.mp4a(I)):U.box(U.types.stsd,U.STSD,U.avc1(I))},U.tkhd=function(I){var F=I.id,R=I.duration*I.timescale,g=I.width,p=I.height,d=Math.floor(R/(Y+1)),l=Math.floor(R%(Y+1));return U.box(U.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,F>>24&255,F>>16&255,F>>8&255,F&255,0,0,0,0,d>>24,d>>16&255,d>>8&255,d&255,l>>24,l>>16&255,l>>8&255,l&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]))},U.traf=function(I,F){var R=U.sdtp(I),g=I.id,p=Math.floor(F/(Y+1)),d=Math.floor(F%(Y+1));return U.box(U.types.traf,U.box(U.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),U.box(U.types.tfdt,new Uint8Array([1,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,d>>24,d>>16&255,d>>8&255,d&255])),U.trun(I,R.length+16+20+8+16+8+8),R)},U.trak=function(I){return I.duration=I.duration||4294967295,U.box(U.types.trak,U.tkhd(I),U.mdia(I))},U.trex=function(I){var F=I.id;return U.box(U.types.trex,new Uint8Array([0,0,0,0,F>>24,F>>16&255,F>>8&255,F&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},U.trun=function(I,F){var R=I.samples||[],g=R.length,p=12+16*g,d=new Uint8Array(p),l,n,c,s,a,o;for(F+=8+p,d.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,F>>>24&255,F>>>16&255,F>>>8&255,F&255],0),l=0;l<g;l++)n=R[l],c=n.duration,s=n.size,a=n.flags,o=n.cts,d.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,o>>>24&255,o>>>16&255,o>>>8&255,o&255],12+16*l);return U.box(U.types.trun,d)},U.initSegment=function(I){U.types||U.init();var F=U.moov(I),R=new Uint8Array(U.FTYP.byteLength+F.byteLength);return R.set(U.FTYP),R.set(F,U.FTYP.byteLength),R},U}();D.types=void 0,D.HDLR_TYPES=void 0,D.STTS=void 0,D.STSC=void 0,D.STCO=void 0,D.STSZ=void 0,D.VMHD=void 0,D.SMHD=void 0,D.STSD=void 0,D.FTYP=void 0,D.DINF=void 0,Q.default=D},"./src/remux/mp4-remuxer.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return o}),P.d(Q,"normalizePts",function(){return f});var Y=P("./src/polyfills/number.ts"),D=P("./src/remux/aac-helper.ts"),U=P("./src/remux/mp4-generator.ts"),H=P("./src/events.ts"),I=P("./src/errors.ts"),F=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(A){for(var w=1;w<arguments.length;w++){var _=arguments[w];for(var S in _)Object.prototype.hasOwnProperty.call(_,S)&&(A[S]=_[S])}return A},p.apply(this,arguments)}var d=10*1e3,l=1024,n=1152,c=null,s=null,a=!1,o=function(){function A(_,S,y,h){if(h===void 0&&(h=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=_,this.config=S,this.typeSupported=y,this.ISGenerated=!1,c===null){var E=navigator.userAgent||"",m=E.match(/Chrome\/(\d+)/i);c=m?parseInt(m[1]):0}if(s===null){var T=navigator.userAgent.match(/Safari\/(\d+)/i);s=T?parseInt(T[1]):0}a=!!c&&c<75||!!s&&s<600}var w=A.prototype;return w.destroy=function(){},w.resetTimeStamp=function(S){F.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=S},w.resetNextTimestamp=function(){F.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},w.resetInitSegment=function(){F.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},w.getVideoStartPts=function(S){var y=!1,h=S.reduce(function(E,m){var T=m.pts-E;return T<-4294967296?(y=!0,f(E,m.pts)):T>0?E:m.pts},S[0].pts);return y&&F.logger.debug("PTS rollover detected"),h},w.remux=function(S,y,h,E,m,T,j,N){var K,W,k,b,G,J,oe=m,fe=m,Ne=S.pid>-1,_e=y.pid>-1,Fe=y.samples.length,We=S.samples.length>0,Ue=Fe>1,xe=(!Ne||We)&&(!_e||Ue)||this.ISGenerated||j;if(xe){this.ISGenerated||(k=this.generateIS(S,y,m));var ue=this.isVideoContiguous,ae=-1;if(Ue&&(ae=L(y.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(J=!0,ae>0){F.logger.warn("[mp4-remuxer]: Dropped "+ae+" out of "+Fe+" video samples due to a missing keyframe");var Ee=this.getVideoStartPts(y.samples);y.samples=y.samples.slice(ae),y.dropped+=ae,fe+=(y.samples[0].pts-Ee)/(y.timescale||9e4)}else ae===-1&&(F.logger.warn("[mp4-remuxer]: No keyframe found out of "+Fe+" video samples"),J=!1);if(this.ISGenerated){if(We&&Ue){var de=this.getVideoStartPts(y.samples),Ke=f(S.samples[0].pts,de)-de,Je=Ke/y.inputTimeScale;oe+=Math.max(0,Je),fe+=Math.max(0,-Je)}if(We){if(S.samplerate||(F.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),k=this.generateIS(S,y,m)),W=this.remuxAudio(S,oe,this.isAudioContiguous,T,_e||Ue||N===R.PlaylistLevelType.AUDIO?fe:void 0),Ue){var je=W?W.endPTS-W.startPTS:0;y.inputTimeScale||(F.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),k=this.generateIS(S,y,m)),K=this.remuxVideo(y,fe,ue,je)}}else Ue&&(K=this.remuxVideo(y,fe,ue,0));K&&(K.firstKeyFrame=ae,K.independent=ae!==-1)}}return this.ISGenerated&&(h.samples.length&&(G=this.remuxID3(h,m)),E.samples.length&&(b=this.remuxText(E,m))),{audio:W,video:K,initSegment:k,independent:J,text:b,id3:G}},w.generateIS=function(S,y,h){var E=S.samples,m=y.samples,T=this.typeSupported,j={},N=!Object(Y.isFiniteNumber)(this._initPTS),K="audio/mp4",W,k,b;if(N&&(W=k=Infinity),S.config&&E.length&&(S.timescale=S.samplerate,S.isAAC||(T.mpeg?(K="audio/mpeg",S.codec=""):T.mp3&&(S.codec="mp3")),j.audio={id:"audio",container:K,codec:S.codec,initSegment:!S.isAAC&&T.mpeg?new Uint8Array(0):U.default.initSegment([S]),metadata:{channelCount:S.channelCount}},N&&(b=S.inputTimeScale,W=k=E[0].pts-Math.round(b*h))),y.sps&&y.pps&&m.length&&(y.timescale=y.inputTimeScale,j.video={id:"main",container:"video/mp4",codec:y.codec,initSegment:U.default.initSegment([y]),metadata:{width:y.width,height:y.height}},N)){b=y.inputTimeScale;var G=this.getVideoStartPts(m),J=Math.round(b*h);k=Math.min(k,f(m[0].dts,G)-J),W=Math.min(W,G-J)}if(Object.keys(j).length)return this.ISGenerated=!0,N&&(this._initPTS=W,this._initDTS=k),{tracks:j,initPTS:W,timescale:b}},w.remuxVideo=function(S,y,h,E){var m=S.inputTimeScale,T=S.samples,j=[],N=T.length,K=this._initPTS,W=this.nextAvcDts,k=8,b,G,J,oe=Number.POSITIVE_INFINITY,fe=Number.NEGATIVE_INFINITY,Ne=0,_e=!1;if(!h||W===null){var Fe=y*m,We=T[0].pts-f(T[0].dts,T[0].pts);W=Fe-We}for(var Ue=0;Ue<N;Ue++){var xe=T[Ue];if(xe.pts=f(xe.pts-K,W),xe.dts=f(xe.dts-K,W),xe.dts>xe.pts){var ue=9e4*.2;Ne=Math.max(Math.min(Ne,xe.pts-xe.dts),-1*ue)}xe.dts<T[Ue>0?Ue-1:Ue].dts&&(_e=!0)}_e&&T.sort(function(zn,Ln){var sn=zn.dts-Ln.dts,_i=zn.pts-Ln.pts;return sn||_i}),G=T[0].dts,J=T[T.length-1].dts;var ae=Math.round((J-G)/(N-1));if(Ne<0){if(Ne<ae*-2){F.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-ae,!0)+" ms");for(var Ee=Ne,de=0;de<N;de++)T[de].dts=Ee=Math.max(Ee,T[de].pts-ae),T[de].pts=Math.max(Ee,T[de].pts)}else{F.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(Ne,!0)+" ms to overcome this issue");for(var Ke=0;Ke<N;Ke++)T[Ke].dts=T[Ke].dts+Ne}G=T[0].dts}if(h){var Je=G-W,je=Je>ae,Qe=Je<-1;if(je||Qe){je?F.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(Je,!0)+" ms ("+Je+"dts) hole between fragments detected, filling it"):F.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-Je,!0)+" ms ("+Je+"dts) overlapping between fragments detected"),G=W;var ot=T[0].pts-Je;T[0].dts=G,T[0].pts=ot,F.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(ot,!0)+"/"+Object(g.toMsFromMpegTsClock)(G,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(Je,!0)+" ms")}}a&&(G=Math.max(0,G));for(var st=0,ht=0,mt=0;mt<N;mt++){for(var ft=T[mt],Ht=ft.units,Vt=Ht.length,zt=0,Tt=0;Tt<Vt;Tt++)zt+=Ht[Tt].data.length;ht+=zt,st+=Vt,ft.length=zt,ft.dts=Math.max(ft.dts,G),ft.pts=Math.max(ft.pts,ft.dts,0),oe=Math.min(ft.pts,oe),fe=Math.max(ft.pts,fe)}J=T[N-1].dts;var hn=ht+4*st+8,Xt;try{Xt=new Uint8Array(hn)}catch(zn){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:hn,reason:"fail allocating video mdat "+hn});return}var Wt=new DataView(Xt.buffer);Wt.setUint32(0,hn),Xt.set(U.default.types.mdat,4);for(var it=0;it<N;it++){for(var un=T[it],Kt=un.units,qe=0,wt=0,Be=Kt.length;wt<Be;wt++){var Ae=Kt[wt],Ie=Ae.data,se=Ae.data.byteLength;Wt.setUint32(k,se),k+=4,Xt.set(Ie,k),k+=se,qe+=4+se}if(it<N-1)b=T[it+1].dts-un.dts;else{var ce=this.config,ye=un.dts-T[it>0?it-1:it].dts;if(ce.stretchShortVideoTrack&&this.nextAudioPts!==null){var Se=Math.floor(ce.maxBufferHole*m),ke=(E?oe+E*m:this.nextAudioPts)-un.pts;ke>Se?(b=ke-ye,b<0&&(b=ye),F.logger.log("[mp4-remuxer]: It is approximately "+ke/90+" ms to the next segment; using duration "+b/90+" ms for the last video frame.")):b=ye}else b=ye}var et=Math.round(un.pts-un.dts);j.push(new C(un.key,b,qe,et))}if(j.length&&c&&c<70){var yt=j[0].flags;yt.dependsOn=2,yt.isNonSync=0}console.assert(b!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=J+b,this.isVideoContiguous=!0;var $t=U.default.moof(S.sequenceNumber++,G,p({},S,{samples:j})),gn="video",Dt={data1:$t,data2:Xt,startPTS:oe/m,endPTS:(fe+b)/m,startDTS:G/m,endDTS:W/m,type:gn,hasAudio:!1,hasVideo:!0,nb:j.length,dropped:S.dropped};return S.samples=[],S.dropped=0,console.assert(Xt.length,"MDAT length must not be zero"),Dt},w.remuxAudio=function(S,y,h,E,m){var T=S.inputTimeScale,j=S.samplerate?S.samplerate:T,N=T/j,K=S.isAAC?l:n,W=K*N,k=this._initPTS,b=!S.isAAC&&this.typeSupported.mpeg,G=[],J=S.samples,oe=b?0:8,fe=this.nextAudioPts||-1,Ne=y*T;if(this.isAudioContiguous=h=h||J.length&&fe>0&&(E&&Math.abs(Ne-fe)<9e3||Math.abs(f(J[0].pts-k,Ne)-fe)<20*W),J.forEach(function(Ie){Ie.pts=f(Ie.pts-k,Ne)}),!h||fe<0){if(J=J.filter(function(Ie){return Ie.pts>=0}),!J.length)return;m===0?fe=0:E?fe=Math.max(0,Ne):fe=J[0].pts}if(S.isAAC)for(var _e=m!==void 0,Fe=this.config.maxAudioFramesDrift,We=0,Ue=fe;We<J.length;We++){var xe=J[We],ue=xe.pts,ae=ue-Ue,Ee=Math.abs(1e3*ae/T);if(ae<=-Fe*W&&_e)We===0&&(F.logger.warn("Audio frame @ "+(ue/T).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*ae/T)+" ms."),this.nextAudioPts=fe=Ue=ue);else if(ae>=Fe*W&&Ee<d&&_e){var de=Math.round(ae/W);Ue=ue-de*W,Ue<0&&(de--,Ue+=W),We===0&&(this.nextAudioPts=fe=Ue),F.logger.warn("[mp4-remuxer]: Injecting "+de+" audio frame @ "+(Ue/T).toFixed(3)+"s due to "+Math.round(1e3*ae/T)+" ms gap.");for(var Ke=0;Ke<de;Ke++){var Je=Math.max(Ue,0),je=D.default.getSilentFrame(S.manifestCodec||S.codec,S.channelCount);je||(F.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),je=xe.unit.subarray()),J.splice(We,0,{unit:je,pts:Je}),Ue+=W,We++}}xe.pts=Ue,Ue+=W}for(var Qe=null,ot=null,st,ht=0,mt=J.length;mt--;)ht+=J[mt].unit.byteLength;for(var ft=0,Ht=J.length;ft<Ht;ft++){var Vt=J[ft],zt=Vt.unit,Tt=Vt.pts;if(ot!==null){var hn=G[ft-1];hn.duration=Math.round((Tt-ot)/N)}else if(h&&S.isAAC&&(Tt=fe),Qe=Tt,ht>0){ht+=oe;try{st=new Uint8Array(ht)}catch(Ie){this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ht,reason:"fail allocating audio mdat "+ht});return}if(!b){var Xt=new DataView(st.buffer);Xt.setUint32(0,ht),st.set(U.default.types.mdat,4)}}else return;st.set(zt,oe);var Wt=zt.byteLength;oe+=Wt,G.push(new C(!0,K,Wt,0)),ot=Tt}var it=G.length;if(!it)return;var un=G[G.length-1];this.nextAudioPts=fe=ot+N*un.duration;var Kt=b?new Uint8Array(0):U.default.moof(S.sequenceNumber++,Qe/N,p({},S,{samples:G}));S.samples=[];var qe=Qe/T,wt=fe/T,Be="audio",Ae={data1:Kt,data2:st,startPTS:qe,endPTS:wt,startDTS:qe,endDTS:wt,type:Be,hasAudio:!0,hasVideo:!1,nb:it};return this.isAudioContiguous=!0,console.assert(st.length,"MDAT length must not be zero"),Ae},w.remuxEmptyAudio=function(S,y,h,E){var m=S.inputTimeScale,T=S.samplerate?S.samplerate:m,j=m/T,N=this.nextAudioPts,K=(N!==null?N:E.startDTS*m)+this._initDTS,W=E.endDTS*m+this._initDTS,k=j*l,b=Math.ceil((W-K)/k),G=D.default.getSilentFrame(S.manifestCodec||S.codec,S.channelCount);if(F.logger.warn("[mp4-remuxer]: remux empty Audio"),!G){F.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var J=[],oe=0;oe<b;oe++){var fe=K+oe*k;J.push({unit:G,pts:fe,dts:fe})}return S.samples=J,this.remuxAudio(S,y,h,!1)},w.remuxID3=function(S,y){var h=S.samples.length;if(!h)return;for(var E=S.inputTimeScale,m=this._initPTS,T=this._initDTS,j=0;j<h;j++){var N=S.samples[j];N.pts=f(N.pts-m,y*E)/E,N.dts=f(N.dts-T,y*E)/E}var K=S.samples;return S.samples=[],{samples:K}},w.remuxText=function(S,y){var h=S.samples.length;if(!h)return;for(var E=S.inputTimeScale,m=this._initPTS,T=0;T<h;T++){var j=S.samples[T];j.pts=f(j.pts-m,y*E)/E}S.samples.sort(function(K,W){return K.pts-W.pts});var N=S.samples;return S.samples=[],{samples:N}},A}();function f(A,w){var _;if(w===null)return A;for(w<A?_=-8589934592:_=8589934592;Math.abs(A-w)>4294967296;)A+=_;return A}function L(A){for(var w=0;w<A.length;w++)if(A[w].key)return w;return-1}var C=function(w,_,S,y){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=_,this.size=S,this.cts=y,this.flags=new x(w)},x=function(w){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=w?2:1,this.isNonSync=w?0:1}},"./src/remux/passthrough-remuxer.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/polyfills/number.ts"),D=P("./src/utils/mp4-tools.ts"),U=P("./src/loader/fragment.ts"),H=P("./src/utils/logger.ts"),I=function(){function g(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var p=g.prototype;return p.destroy=function(){},p.resetTimeStamp=function(l){this.initPTS=l,this.lastEndDTS=null},p.resetNextTimestamp=function(){this.lastEndDTS=null},p.resetInitSegment=function(l,n,c){this.audioCodec=n,this.videoCodec=c,this.generateInitSegment(l),this.emitInitSegment=!0},p.generateInitSegment=function(l){var n=this.audioCodec,c=this.videoCodec;if(!l||!l.byteLength){this.initTracks=void 0,this.initData=void 0;return}var s=this.initData=Object(D.parseInitSegment)(l);n||(n=R(s.audio,U.ElementaryStreamTypes.AUDIO)),c||(c=R(s.video,U.ElementaryStreamTypes.VIDEO));var a={};s.audio&&s.video?a.audiovideo={container:"video/mp4",codec:n+","+c,initSegment:l,id:"main"}:s.audio?a.audio={container:"audio/mp4",codec:n,initSegment:l,id:"audio"}:s.video?a.video={container:"video/mp4",codec:c,initSegment:l,id:"main"}:H.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},p.remux=function(l,n,c,s,a){var o=this.initPTS,f=this.lastEndDTS,L={audio:void 0,video:void 0,text:s,id3:c,initSegment:void 0};Object(Y.isFiniteNumber)(f)||(f=this.lastEndDTS=a||0);var C=n.samples;if(!C||!C.length)return L;var x={initPTS:void 0,timescale:1},A=this.initData;if((!A||!A.length)&&(this.generateInitSegment(C),A=this.initData),!A||!A.length)return H.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),L;this.emitInitSegment&&(x.tracks=this.initTracks,this.emitInitSegment=!1),Object(Y.isFiniteNumber)(o)||(this.initPTS=x.initPTS=o=F(A,C,f));var w=Object(D.getDuration)(C,A),_=f,S=w+_;Object(D.offsetStartDTS)(A,C,o),w>0?this.lastEndDTS=S:(H.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var y=!!A.audio,h=!!A.video,E="";y&&(E+="audio"),h&&(E+="video");var m={data1:C,startPTS:_,startDTS:_,endPTS:S,endDTS:S,type:E,hasAudio:y,hasVideo:h,nb:1,dropped:0};return L.audio=m.type==="audio"?m:void 0,L.video=m.type!=="audio"?m:void 0,L.text=s,L.id3=c,L.initSegment=x,L},g}(),F=function(p,d,l){return Object(D.getStartDTS)(p,d)-l};function R(g,p){var d=g==null?void 0:g.codec;return d&&d.length>4?d:d==="hvc1"?"hvc1.1.c.L120.90":d==="av01"?"av01.0.04M.08":d==="avc1"||p===U.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Q.default=I},"./src/task-loop.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return Y});var Y=function(){function D(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var U=D.prototype;return U.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},U.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},U.onHandlerDestroyed=function(){},U.hasInterval=function(){return!!this._tickInterval},U.hasNextTick=function(){return!!this._tickTimer},U.setInterval=function(I){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,I),!0)},U.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},U.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},U.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},U.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},U.doTick=function(){},D}()},"./src/types/cmcd.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"CMCDVersion",function(){return Y}),P.d(Q,"CMCDObjectType",function(){return D}),P.d(Q,"CMCDStreamingFormat",function(){return U}),P.d(Q,"CMCDStreamType",function(){return H});var Y=1,D;(function(I){I.MANIFEST="m",I.AUDIO="a",I.VIDEO="v",I.MUXED="av",I.INIT="i",I.CAPTION="c",I.TIMED_TEXT="tt",I.KEY="k",I.OTHER="o"})(D||(D={}));var U;(function(I){I.DASH="d",I.HLS="h",I.SMOOTH="s",I.OTHER="o"})(U||(U={}));var H;(function(I){I.VOD="v",I.LIVE="l"})(H||(H={}))},"./src/types/level.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"HlsSkip",function(){return U}),P.d(Q,"getSkipValue",function(){return H}),P.d(Q,"HlsUrlParameters",function(){return I}),P.d(Q,"Level",function(){return F});function Y(R,g){for(var p=0;p<g.length;p++){var d=g[p];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(R,d.key,d)}}function D(R,g,p){return g&&Y(R.prototype,g),p&&Y(R,p),R}var U;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(U||(U={}));function H(R,g){var p=R.canSkipUntil,d=R.canSkipDateRanges,l=R.endSN,n=g!==void 0?g-l:0;return p&&n<p?d?U.v2:U.Yes:U.No}var I=function(){function R(p,d,l){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=p,this.part=d,this.skip=l}var g=R.prototype;return g.addDirectives=function(d){var l=new self.URL(d);return this.msn!==void 0&&l.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&l.searchParams.set("_HLS_part",this.part.toString()),this.skip&&l.searchParams.set("_HLS_skip",this.skip),l.toString()},R}(),F=function(){function R(g){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[g.url],this.attrs=g.attrs,this.bitrate=g.bitrate,g.details&&(this.details=g.details),this.id=g.id||0,this.name=g.name,this.width=g.width||0,this.height=g.height||0,this.audioCodec=g.audioCodec,this.videoCodec=g.videoCodec,this.unknownCodecs=g.unknownCodecs,this.codecSet=[g.videoCodec,g.audioCodec].filter(function(p){return p}).join(",").replace(/\.[^.,]+/g,"")}return D(R,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(p){var d=p%this.url.length;this._urlId!==d&&(this.details=void 0,this._urlId=d)}}]),R}()},"./src/types/loader.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"PlaylistContextType",function(){return Y}),P.d(Q,"PlaylistLevelType",function(){return D});var Y;(function(U){U.MANIFEST="manifest",U.LEVEL="level",U.AUDIO_TRACK="audioTrack",U.SUBTITLE_TRACK="subtitleTrack"})(Y||(Y={}));var D;(function(U){U.MAIN="main",U.AUDIO="audio",U.SUBTITLE="subtitle"})(D||(D={}))},"./src/types/transmuxer.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"ChunkMetadata",function(){return Y});var Y=function(H,I,F,R,g,p){R===void 0&&(R=0),g===void 0&&(g=-1),p===void 0&&(p=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=D(),this.buffering={audio:D(),video:D(),audiovideo:D()},this.level=H,this.sn=I,this.id=F,this.size=R,this.part=g,this.partial=p};function D(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"AttrList",function(){return U});var Y=/^(\d+)x(\d+)$/,D=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,U=function(){function H(F){typeof F=="string"&&(F=H.parseAttrList(F));for(var R in F)F.hasOwnProperty(R)&&(this[R]=F[R])}var I=H.prototype;return I.decimalInteger=function(R){var g=parseInt(this[R],10);return g>Number.MAX_SAFE_INTEGER?Infinity:g},I.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),d=0;d<g.length/2;d++)p[d]=parseInt(g.slice(d*2,d*2+2),16);return p}else return null},I.hexadecimalIntegerAsNumber=function(R){var g=parseInt(this[R],16);return g>Number.MAX_SAFE_INTEGER?Infinity:g},I.decimalFloatingPoint=function(R){return parseFloat(this[R])},I.optionalFloat=function(R,g){var p=this[R];return p?parseFloat(p):g},I.enumeratedString=function(R){return this[R]},I.bool=function(R){return this[R]==="YES"},I.decimalResolution=function(R){var g=Y.exec(this[R]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},H.parseAttrList=function(R){var g,p={},d='"';for(D.lastIndex=0;(g=D.exec(R))!==null;){var l=g[2];l.indexOf(d)===0&&l.lastIndexOf(d)===l.length-1&&(l=l.slice(1,-1)),p[g[1]]=l}return p},H}()},"./src/utils/binary-search.ts":function(le,Q,P){"use strict";P.r(Q);var Y={search:function(U,H){for(var I=0,F=U.length-1,R=null,g=null;I<=F;){R=(I+F)/2|0,g=U[R];var p=H(g);if(p>0)I=R+1;else if(p<0)F=R-1;else return g}return null}};Q.default=Y},"./src/utils/buffer-helper.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"BufferHelper",function(){return U});var Y=P("./src/utils/logger.ts"),D={length:0,start:function(){return 0},end:function(){return 0}},U=function(){function H(){}return H.isBuffered=function(F,R){try{if(F){for(var g=H.getBuffered(F),p=0;p<g.length;p++)if(R>=g.start(p)&&R<=g.end(p))return!0}}catch(d){}return!1},H.bufferInfo=function(F,R,g){try{if(F){var p=H.getBuffered(F),d=[],l;for(l=0;l<p.length;l++)d.push({start:p.start(l),end:p.end(l)});return this.bufferedInfo(d,R,g)}}catch(n){}return{len:0,start:R,end:R,nextStart:void 0}},H.bufferedInfo=function(F,R,g){R=Math.max(0,R),F.sort(function(x,A){var w=x.start-A.start;return w||A.end-x.end});var p=[];if(g)for(var d=0;d<F.length;d++){var l=p.length;if(l){var n=p[l-1].end;F[d].start-n<g?F[d].end>n&&(p[l-1].end=F[d].end):p.push(F[d])}else p.push(F[d])}else p=F;for(var c=0,s,a=R,o=R,f=0;f<p.length;f++){var L=p[f].start,C=p[f].end;if(R+g>=L&&R<C)a=L,o=C,c=o-R;else if(R+g<L){s=L;break}}return{len:c,start:a||0,end:o||0,nextStart:s}},H.getBuffered=function(F){try{return F.buffered}catch(R){return Y.logger.log("failed to get media.buffered",R),D}},H}()},"./src/utils/cea-608-parser.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"Row",function(){return o}),P.d(Q,"CaptionScreen",function(){return f});var Y=P("./src/utils/logger.ts"),D={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},U=function(S){var y=S;return D.hasOwnProperty(S)&&(y=D[S]),String.fromCharCode(y)},H=15,I=100,F={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={17:2,18:4,21:6,22:8,23:10,19:13,20:15},g={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},p={25:2,26:4,29:6,30:8,31:10,27:13,28:15},d=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],l;(function(_){_[_.ERROR=0]="ERROR",_[_.TEXT=1]="TEXT",_[_.WARNING=2]="WARNING",_[_.INFO=2]="INFO",_[_.DEBUG=3]="DEBUG",_[_.DATA=3]="DATA"})(l||(l={}));var n=function(){function _(){this.time=null,this.verboseLevel=l.ERROR}var S=_.prototype;return S.log=function(h,E){this.verboseLevel>=h&&Y.logger.log(this.time+" ["+h+"] "+E)},_}(),c=function(S){for(var y=[],h=0;h<S.length;h++)y.push(S[h].toString(16));return y},s=function(){function _(y,h,E,m,T){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=y||"white",this.underline=h||!1,this.italics=E||!1,this.background=m||"black",this.flash=T||!1}var S=_.prototype;return S.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},S.setStyles=function(h){for(var E=["foreground","underline","italics","background","flash"],m=0;m<E.length;m++){var T=E[m];h.hasOwnProperty(T)&&(this[T]=h[T])}},S.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},S.equals=function(h){return this.foreground===h.foreground&&this.underline===h.underline&&this.italics===h.italics&&this.background===h.background&&this.flash===h.flash},S.copy=function(h){this.foreground=h.foreground,this.underline=h.underline,this.italics=h.italics,this.background=h.background,this.flash=h.flash},S.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},_}(),a=function(){function _(y,h,E,m,T,j){this.uchar=void 0,this.penState=void 0,this.uchar=y||" ",this.penState=new s(h,E,m,T,j)}var S=_.prototype;return S.reset=function(){this.uchar=" ",this.penState.reset()},S.setChar=function(h,E){this.uchar=h,this.penState.copy(E)},S.setPenState=function(h){this.penState.copy(h)},S.equals=function(h){return this.uchar===h.uchar&&this.penState.equals(h.penState)},S.copy=function(h){this.uchar=h.uchar,this.penState.copy(h.penState)},S.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},_}(),o=function(){function _(y){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var h=0;h<I;h++)this.chars.push(new a);this.logger=y,this.pos=0,this.currPenState=new s}var S=_.prototype;return S.equals=function(h){for(var E=!0,m=0;m<I;m++)if(!this.chars[m].equals(h.chars[m])){E=!1;break}return E},S.copy=function(h){for(var E=0;E<I;E++)this.chars[E].copy(h.chars[E])},S.isEmpty=function(){for(var h=!0,E=0;E<I;E++)if(!this.chars[E].isEmpty()){h=!1;break}return h},S.setCursor=function(h){this.pos!==h&&(this.pos=h),this.pos<0?(this.logger.log(l.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>I&&(this.logger.log(l.DEBUG,"Too large cursor position "+this.pos),this.pos=I)},S.moveCursor=function(h){var E=this.pos+h;if(h>1)for(var m=this.pos+1;m<E+1;m++)this.chars[m].setPenState(this.currPenState);this.setCursor(E)},S.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},S.insertChar=function(h){h>=144&&this.backSpace();var E=U(h);if(this.pos>=I){this.logger.log(l.ERROR,"Cannot insert "+h.toString(16)+" ("+E+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(E,this.currPenState),this.moveCursor(1)},S.clearFromPos=function(h){var E;for(E=h;E<I;E++)this.chars[E].reset()},S.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},S.clearToEndOfRow=function(){this.clearFromPos(this.pos)},S.getTextString=function(){for(var h=[],E=!0,m=0;m<I;m++){var T=this.chars[m].uchar;T!==" "&&(E=!1),h.push(T)}return E?"":h.join("")},S.setPenStyles=function(h){this.currPenState.setStyles(h);var E=this.chars[this.pos];E.setPenState(this.currPenState)},_}(),f=function(){function _(y){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var h=0;h<H;h++)this.rows.push(new o(y));this.logger=y,this.currRow=H-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var S=_.prototype;return S.reset=function(){for(var h=0;h<H;h++)this.rows[h].clear();this.currRow=H-1},S.equals=function(h){for(var E=!0,m=0;m<H;m++)if(!this.rows[m].equals(h.rows[m])){E=!1;break}return E},S.copy=function(h){for(var E=0;E<H;E++)this.rows[E].copy(h.rows[E])},S.isEmpty=function(){for(var h=!0,E=0;E<H;E++)if(!this.rows[E].isEmpty()){h=!1;break}return h},S.backSpace=function(){var h=this.rows[this.currRow];h.backSpace()},S.clearToEndOfRow=function(){var h=this.rows[this.currRow];h.clearToEndOfRow()},S.insertChar=function(h){var E=this.rows[this.currRow];E.insertChar(h)},S.setPen=function(h){var E=this.rows[this.currRow];E.setPenStyles(h)},S.moveCursor=function(h){var E=this.rows[this.currRow];E.moveCursor(h)},S.setCursor=function(h){this.logger.log(l.INFO,"setCursor: "+h);var E=this.rows[this.currRow];E.setCursor(h)},S.setPAC=function(h){this.logger.log(l.INFO,"pacData = "+JSON.stringify(h));var E=h.row-1;if(this.nrRollUpRows&&E<this.nrRollUpRows-1&&(E=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==E){for(var m=0;m<H;m++)this.rows[m].clear();var T=this.currRow+1-this.nrRollUpRows,j=this.lastOutputScreen;if(j){var N=j.rows[T].cueStartTime,K=this.logger.time;if(N&&K!==null&&N<K)for(var W=0;W<this.nrRollUpRows;W++)this.rows[E-this.nrRollUpRows+W+1].copy(j.rows[T+W])}}this.currRow=E;var k=this.rows[this.currRow];if(h.indent!==null){var b=h.indent,G=Math.max(b-1,0);k.setCursor(h.indent),h.color=k.chars[G].penState.foreground}var J={foreground:h.color,underline:h.underline,italics:h.italics,background:"black",flash:!1};this.setPen(J)},S.setBkgData=function(h){this.logger.log(l.INFO,"bkgData = "+JSON.stringify(h)),this.backSpace(),this.setPen(h),this.insertChar(32)},S.setRollUpRows=function(h){this.nrRollUpRows=h},S.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(l.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(l.TEXT,this.getDisplayText());var h=this.currRow+1-this.nrRollUpRows,E=this.rows.splice(h,1)[0];E.clear(),this.rows.splice(this.currRow,0,E),this.logger.log(l.INFO,"Rolling up")},S.getDisplayText=function(h){h=h||!1;for(var E=[],m="",T=-1,j=0;j<H;j++){var N=this.rows[j].getTextString();N&&(T=j+1,h?E.push("Row "+T+": '"+N+"'"):E.push(N.trim()))}return E.length>0&&(h?m="["+E.join(" | ")+"]":m=E.join(`
|
|
`)),m},S.getTextAndFormat=function(){return this.rows},_}(),L=function(){function _(y,h,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=y,this.outputFilter=h,this.mode=null,this.verbose=0,this.displayedMemory=new f(E),this.nonDisplayedMemory=new f(E),this.lastOutputScreen=new f(E),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=E}var S=_.prototype;return S.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[H-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},S.getHandler=function(){return this.outputFilter},S.setHandler=function(h){this.outputFilter=h},S.setPAC=function(h){this.writeScreen.setPAC(h)},S.setBkgData=function(h){this.writeScreen.setBkgData(h)},S.setMode=function(h){if(h===this.mode)return;this.mode=h,this.logger.log(l.INFO,"MODE="+h),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=h},S.insertChars=function(h){for(var E=0;E<h.length;E++)this.writeScreen.insertChar(h[E]);var m=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(l.INFO,m+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(l.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},S.ccRCL=function(){this.logger.log(l.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},S.ccBS=function(){if(this.logger.log(l.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},S.ccAOF=function(){},S.ccAON=function(){},S.ccDER=function(){this.logger.log(l.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},S.ccRU=function(h){this.logger.log(l.INFO,"RU("+h+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(h)},S.ccFON=function(){this.logger.log(l.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},S.ccRDC=function(){this.logger.log(l.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},S.ccTR=function(){this.logger.log(l.INFO,"TR"),this.setMode("MODE_TEXT")},S.ccRTD=function(){this.logger.log(l.INFO,"RTD"),this.setMode("MODE_TEXT")},S.ccEDM=function(){this.logger.log(l.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},S.ccCR=function(){this.logger.log(l.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},S.ccENM=function(){this.logger.log(l.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},S.ccEOC=function(){if(this.logger.log(l.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var h=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=h,this.writeScreen=this.nonDisplayedMemory,this.logger.log(l.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},S.ccTO=function(h){this.logger.log(l.INFO,"TO("+h+") - Tab Offset"),this.writeScreen.moveCursor(h)},S.ccMIDROW=function(h){var E={flash:!1};if(E.underline=h%2===1,E.italics=h>=46,E.italics)E.foreground="white";else{var m=Math.floor(h/2)-16,T=["white","green","blue","cyan","red","yellow","magenta"];E.foreground=T[m]}this.logger.log(l.INFO,"MIDROW: "+JSON.stringify(E)),this.writeScreen.setPen(E)},S.outputDataUpdate=function(h){h===void 0&&(h=!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),h&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:E),this.lastOutputScreen.copy(this.displayedMemory))},S.cueSplitAtTime=function(h){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,h,this.displayedMemory),this.cueStartTime=h))},_}(),C=function(){function _(y,h,E){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var m=new n;this.channels=[null,new L(y,h,m),new L(y+1,E,m)],this.cmdHistory=w(),this.logger=m}var S=_.prototype;return S.getHandler=function(h){return this.channels[h].getHandler()},S.setHandler=function(h,E){this.channels[h].setHandler(E)},S.addData=function(h,E){var m,T,j,N=!1;this.logger.time=h;for(var K=0;K<E.length;K+=2){if(T=E[K]&127,j=E[K+1]&127,T===0&&j===0)continue;if(this.logger.log(l.DATA,"["+c([E[K],E[K+1]])+"] -> ("+c([T,j])+")"),m=this.parseCmd(T,j),m||(m=this.parseMidrow(T,j)),m||(m=this.parsePAC(T,j)),m||(m=this.parseBackgroundAttributes(T,j)),!m&&(N=this.parseChars(T,j),N)){var W=this.currentChannel;if(W&&W>0){var k=this.channels[W];k.insertChars(N)}else this.logger.log(l.WARNING,"No channel found yet. TEXT-MODE?")}!m&&!N&&this.logger.log(l.WARNING,"Couldn't parse cleaned data "+c([T,j])+" orig: "+c([E[K],E[K+1]]))}},S.parseCmd=function(h,E){var m=this.cmdHistory,T=(h===20||h===28||h===21||h===29)&&E>=32&&E<=47,j=(h===23||h===31)&&E>=33&&E<=35;if(!(T||j))return!1;if(A(h,E,m))return x(null,null,m),this.logger.log(l.DEBUG,"Repeated command ("+c([h,E])+") is dropped"),!0;var N=h===20||h===21||h===23?1:2,K=this.channels[N];return h===20||h===21||h===28||h===29?E===32?K.ccRCL():E===33?K.ccBS():E===34?K.ccAOF():E===35?K.ccAON():E===36?K.ccDER():E===37?K.ccRU(2):E===38?K.ccRU(3):E===39?K.ccRU(4):E===40?K.ccFON():E===41?K.ccRDC():E===42?K.ccTR():E===43?K.ccRTD():E===44?K.ccEDM():E===45?K.ccCR():E===46?K.ccENM():E===47&&K.ccEOC():K.ccTO(E-32),x(h,E,m),this.currentChannel=N,!0},S.parseMidrow=function(h,E){var m=0;if((h===17||h===25)&&E>=32&&E<=47){if(h===17?m=1:m=2,m!==this.currentChannel)return this.logger.log(l.ERROR,"Mismatch channel in midrow parsing"),!1;var T=this.channels[m];return T?(T.ccMIDROW(E),this.logger.log(l.DEBUG,"MIDROW ("+c([h,E])+")"),!0):!1}return!1},S.parsePAC=function(h,E){var m,T=this.cmdHistory,j=(h>=17&&h<=23||h>=25&&h<=31)&&E>=64&&E<=127,N=(h===16||h===24)&&E>=64&&E<=95;if(!(j||N))return!1;if(A(h,E,T))return x(null,null,T),!0;var K=h<=23?1:2;E>=64&&E<=95?m=K===1?F[h]:g[h]:m=K===1?R[h]:p[h];var W=this.channels[K];return W?(W.setPAC(this.interpretPAC(m,E)),x(h,E,T),this.currentChannel=K,!0):!1},S.interpretPAC=function(h,E){var m,T={color:null,italics:!1,indent:null,underline:!1,row:h};return E>95?m=E-96:m=E-64,T.underline=(m&1)===1,m<=13?T.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(m/2)]:m<=15?(T.italics=!0,T.color="white"):T.indent=Math.floor((m-16)/2)*4,T},S.parseChars=function(h,E){var m,T=null,j=null;if(h>=25?(m=2,j=h-8):(m=1,j=h),j>=17&&j<=19){var N;j===17?N=E+80:j===18?N=E+112:N=E+144,this.logger.log(l.INFO,"Special char '"+U(N)+"' in channel "+m),T=[N]}else h>=32&&h<=127&&(T=E===0?[h]:[h,E]);if(T){var K=c(T);this.logger.log(l.DEBUG,"Char codes = "+K.join(",")),x(h,E,this.cmdHistory)}return T},S.parseBackgroundAttributes=function(h,E){var m=(h===16||h===24)&&E>=32&&E<=47,T=(h===23||h===31)&&E>=45&&E<=47;if(!(m||T))return!1;var j,N={};h===16||h===24?(j=Math.floor((E-32)/2),N.background=d[j],E%2===1&&(N.background=N.background+"_semi")):E===45?N.background="transparent":(N.foreground="black",E===47&&(N.underline=!0));var K=h<=23?1:2,W=this.channels[K];return W.setBkgData(N),x(h,E,this.cmdHistory),!0},S.reset=function(){for(var h=0;h<Object.keys(this.channels).length;h++){var E=this.channels[h];E&&E.reset()}this.cmdHistory=w()},S.cueSplitAtTime=function(h){for(var E=0;E<this.channels.length;E++){var m=this.channels[E];m&&m.cueSplitAtTime(h)}},_}();function x(_,S,y){y.a=_,y.b=S}function A(_,S,y){return y.a===_&&y.b===S}function w(){return{a:null,b:null}}Q.default=C},"./src/utils/codecs.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"isCodecType",function(){return D}),P.d(Q,"isCodecSupportedInMp4",function(){return U});var Y={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function D(H,I){var F=Y[I];return!!F&&F[H.slice(0,4)]===!0}function U(H,I){return MediaSource.isTypeSupported((I||"video")+'/mp4;codecs="'+H+'"')}},"./src/utils/cues.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/utils/vttparser.ts"),D=P("./src/utils/webvtt-parser.ts"),U=P("./src/utils/texttrack-utils.ts"),H=/\s/,I={newCue:function(R,g,p,d){for(var l=[],n,c,s,a,o,f=self.VTTCue||self.TextTrackCue,L=0;L<d.rows.length;L++)if(n=d.rows[L],s=!0,a=0,o="",!n.isEmpty()){for(var C=0;C<n.chars.length;C++)H.test(n.chars[C].uchar)&&s?a++:(o+=n.chars[C].uchar,s=!1);n.cueStartTime=g,g===p&&(p+=1e-4),a>=16?a--:a++;var x=Object(Y.fixLineBreaks)(o.trim()),A=Object(D.generateCueId)(g,p,x);(!R||!R.cues||!R.cues.getCueById(A))&&(c=new f(g,p,x),c.id=A,c.line=L+1,c.align="left",c.position=10+Math.min(80,Math.floor(a*8/32)*10),l.push(c))}return R&&l.length&&(l.sort(function(w,_){return w.line==="auto"||_.line==="auto"?0:w.line>8&&_.line>8?_.line-w.line:w.line-_.line}),l.forEach(function(w){return Object(U.addCueToTrack)(R,w)})),l}};Q.default=I},"./src/utils/discontinuities.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"findFirstFragWithCC",function(){return H}),P.d(Q,"shouldAlignOnDiscontinuities",function(){return I}),P.d(Q,"findDiscontinuousReferenceFrag",function(){return F}),P.d(Q,"adjustSlidingStart",function(){return g}),P.d(Q,"alignStream",function(){return p}),P.d(Q,"alignPDT",function(){return l}),P.d(Q,"alignFragmentByPDTDelta",function(){return n}),P.d(Q,"alignMediaPlaylistByPDT",function(){return c});var Y=P("./src/polyfills/number.ts"),D=P("./src/utils/logger.ts"),U=P("./src/controller/level-helper.ts");function H(s,a){for(var o=null,f=0,L=s.length;f<L;f++){var C=s[f];if(C&&C.cc===a){o=C;break}}return o}function I(s,a,o){return!!(a.details&&(o.endCC>o.startCC||s&&s.cc<o.startCC))}function F(s,a){var o=s.fragments,f=a.fragments;if(!f.length||!o.length){D.logger.log("No fragments to align");return}var L=H(o,f[0].cc);if(!L||L&&!L.startPTS){D.logger.log("No frag in previous level to align on");return}return L}function R(s,a){if(s){var o=s.start+a;s.start=s.startPTS=o,s.endPTS=o+s.duration}}function g(s,a){for(var o=a.fragments,f=0,L=o.length;f<L;f++)R(o[f],s);a.fragmentHint&&R(a.fragmentHint,s),a.alignedSliding=!0}function p(s,a,o){if(!a)return;d(s,o,a),!o.alignedSliding&&a.details&&l(o,a.details),!o.alignedSliding&&a.details&&!o.skippedSegments&&Object(U.adjustSliding)(a.details,o)}function d(s,a,o){if(I(s,o,a)){var f=F(o.details,a);f&&Object(Y.isFiniteNumber)(f.start)&&(D.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),g(f.start,a))}}function l(s,a){if(!a.fragments.length||!s.hasProgramDateTime||!a.hasProgramDateTime)return;var o=a.fragments[0].programDateTime,f=s.fragments[0].programDateTime,L=(f-o)/1e3+a.fragments[0].start;L&&Object(Y.isFiniteNumber)(L)&&(D.logger.log("Adjusting PTS using programDateTime delta "+(f-o)+"ms, sliding:"+L.toFixed(3)+" "+s.url+" "),g(L,s))}function n(s,a){var o=s.programDateTime;if(!o)return;var f=(o-a)/1e3;s.start=s.startPTS=f,s.endPTS=f+s.duration}function c(s,a){if(!a.fragments.length||!s.hasProgramDateTime||!a.hasProgramDateTime)return;var o=a.fragments[0].programDateTime,f=a.fragments[0].start,L=o-f*1e3;s.fragments.forEach(function(C){n(C,L)}),s.fragmentHint&&n(s.fragmentHint,L),s.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/utils/ewma.ts"),D=function(){function U(I,F,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Y.default(I),this.fast_=new Y.default(F)}var H=U.prototype;return H.update=function(F,R){var g=this.slow_,p=this.fast_;this.slow_.halfLife!==F&&(this.slow_=new Y.default(F,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new Y.default(R,p.getEstimate(),p.getTotalWeight()))},H.sample=function(F,R){F=Math.max(F,this.minDelayMs_);var g=8*R,p=F/1e3,d=g/p;this.fast_.sample(p,d),this.slow_.sample(p,d)},H.canEstimate=function(){var F=this.fast_;return F&&F.getTotalWeight()>=this.minWeight_},H.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},H.destroy=function(){},U}();Q.default=D},"./src/utils/ewma.ts":function(le,Q,P){"use strict";P.r(Q);var Y=function(){function D(H,I,F){I===void 0&&(I=0),F===void 0&&(F=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=H,this.alpha_=H?Math.exp(Math.log(.5)/H):0,this.estimate_=I,this.totalWeight_=F}var U=D.prototype;return U.sample=function(I,F){var R=Math.pow(this.alpha_,I);this.estimate_=F*(1-R)+R*this.estimate_,this.totalWeight_+=I},U.getTotalWeight=function(){return this.totalWeight_},U.getEstimate=function(){if(this.alpha_){var I=1-Math.pow(this.alpha_,this.totalWeight_);if(I)return this.estimate_/I}return this.estimate_},D}();Q.default=Y},"./src/utils/fetch-loader.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"fetchSupported",function(){return n});var Y=P("./src/polyfills/number.ts"),D=P("./src/loader/load-stats.ts"),U=P("./src/demux/chunk-cache.ts");function H(f,L){f.prototype=Object.create(L.prototype),f.prototype.constructor=f,p(f,L)}function I(f){var L=typeof Map=="function"?new Map:void 0;return I=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,A)}function A(){return F(x,arguments,d(this).constructor)}return A.prototype=Object.create(x.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),p(A,x)},I(f)}function F(f,L,C){return R()?F=Reflect.construct:F=function(A,w,_){var S=[null];S.push.apply(S,w);var y=Function.bind.apply(A,S),h=new y;return _&&p(h,_.prototype),h},F.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(f){return!1}}function g(f){return Function.toString.call(f).indexOf("[native code]")!==-1}function p(f,L){return p=Object.setPrototypeOf||function(x,A){return x.__proto__=A,x},p(f,L)}function d(f){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(C){return C.__proto__||Object.getPrototypeOf(C)},d(f)}function l(){return l=Object.assign||function(f){for(var L=1;L<arguments.length;L++){var C=arguments[L];for(var x in C)Object.prototype.hasOwnProperty.call(C,x)&&(f[x]=C[x])}return f},l.apply(this,arguments)}function n(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(f){}return!1}var c=function(){function f(C){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=C.fetchSetup||a,this.controller=new self.AbortController,this.stats=new D.LoadStats}var L=f.prototype;return L.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},L.abortInternal=function(){var x=this.response;(!x||!x.ok)&&(this.stats.aborted=!0,this.controller.abort())},L.abort=function(){var x;this.abortInternal(),(x=this.callbacks)!==null&&x!==void 0&&x.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},L.load=function(x,A,w){var _=this,S=this.stats;if(S.loading.start)throw new Error("Loader can only be used once.");S.loading.start=self.performance.now();var y=s(x,this.controller.signal),h=w.onProgress,E=x.responseType==="arraybuffer",m=E?"byteLength":"length";this.context=x,this.config=A,this.callbacks=w,this.request=this.fetchSetup(x,y),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){_.abortInternal(),w.onTimeout(S,x,_.response)},A.timeout),self.fetch(this.request).then(function(T){if(_.response=_.loader=T,!T.ok){var j=T.status,N=T.statusText;throw new o(N||"fetch, bad network response",j,T)}return S.loading.first=Math.max(self.performance.now(),S.loading.start),S.total=parseInt(T.headers.get("Content-Length")||"0"),h&&Object(Y.isFiniteNumber)(A.highWaterMark)?_.loadProgressively(T,S,x,A.highWaterMark,h):E?T.arrayBuffer():T.text()}).then(function(T){var j=_.response;self.clearTimeout(_.requestTimeout),S.loading.end=Math.max(self.performance.now(),S.loading.first),S.loaded=S.total=T[m];var N={url:j.url,data:T};h&&!Object(Y.isFiniteNumber)(A.highWaterMark)&&h(S,x,T,j),w.onSuccess(N,S,x,j)}).catch(function(T){if(self.clearTimeout(_.requestTimeout),S.aborted)return;var j=T.code||0;w.onError({code:j,text:T.message},x,T.details)})},L.getCacheAge=function(){var x=null;if(this.response){var A=this.response.headers.get("age");x=A?parseFloat(A):null}return x},L.loadProgressively=function(x,A,w,_,S){_===void 0&&(_=0);var y=new U.default,h=x.body.getReader(),E=function m(){return h.read().then(function(T){if(T.done)return y.dataLength&&S(A,w,y.flush(),x),Promise.resolve(new ArrayBuffer(0));var j=T.value,N=j.length;return A.loaded+=N,N<_||y.dataLength?(y.push(j),y.dataLength>=_&&S(A,w,y.flush(),x)):S(A,w,j,x),m()}).catch(function(){return Promise.reject()})};return E()},f}();function s(f,L){var C={method:"GET",mode:"cors",credentials:"same-origin",signal:L,headers:new self.Headers(l({},f.headers))};return f.rangeEnd&&C.headers.set("Range","bytes="+f.rangeStart+"-"+String(f.rangeEnd-1)),C}function a(f,L){return new self.Request(f.url,L)}var o=function(f){H(L,f);function L(C,x,A){var w;return w=f.call(this,C)||this,w.code=void 0,w.details=void 0,w.code=x,w.details=A,w}return L}(I(Error));Q.default=c},"./src/utils/imsc1-ttml-parser.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"IMSC1_CODEC",function(){return g}),P.d(Q,"parseIMSC1",function(){return n});var Y=P("./src/utils/mp4-tools.ts"),D=P("./src/utils/vttparser.ts"),U=P("./src/utils/vttcue.ts"),H=P("./src/demux/id3.ts"),I=P("./src/utils/timescale-conversion.ts"),F=P("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(_){for(var S=1;S<arguments.length;S++){var y=arguments[S];for(var h in y)Object.prototype.hasOwnProperty.call(y,h)&&(_[h]=y[h])}return _},R.apply(this,arguments)}var g="stpp.ttml.im1t",p=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,d=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,l={left:"start",center:"center",right:"end",start:"start",end:"end"};function n(_,S,y,h,E){var m=Object(Y.findBox)(new Uint8Array(_),["mdat"]);if(m.length===0){E(new Error("Could not parse IMSC1 mdat"));return}var T=m[0],j=Object(H.utf8ArrayToStr)(new Uint8Array(_,T.start,T.end-T.start)),N=Object(I.toTimescaleFromScale)(S,1,y);try{h(c(j,N))}catch(K){E(K)}}function c(_,S){var y=new DOMParser,h=y.parseFromString(_,"text/xml"),E=h.getElementsByTagName("tt")[0];if(!E)throw new Error("Invalid ttml");var m={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},T=Object.keys(m).reduce(function(k,b){return k[b]=E.getAttribute("ttp:"+b)||m[b],k},{}),j=E.getAttribute("xml:space")!=="preserve",N=a(s(E,"styling","style")),K=a(s(E,"layout","region")),W=s(E,"body","[begin]");return[].map.call(W,function(k){var b=o(k,j);if(!b||!k.hasAttribute("begin"))return null;var G=x(k.getAttribute("begin"),T),J=x(k.getAttribute("dur"),T),oe=x(k.getAttribute("end"),T);if(G===null)throw C(k);if(oe===null){if(J===null)throw C(k);oe=G+J}var fe=new U.default(G-S,oe-S,b);fe.id=Object(F.generateCueId)(fe.startTime,fe.endTime,fe.text);var Ne=K[k.getAttribute("region")],_e=N[k.getAttribute("style")];fe.position=10,fe.size=80;var Fe=f(Ne,_e),We=Fe.textAlign;if(We){var Ue=l[We];Ue&&(fe.lineAlign=Ue),fe.align=We}return R(fe,Fe),fe}).filter(function(k){return k!==null})}function s(_,S,y){var h=_.getElementsByTagName(S)[0];return h?[].slice.call(h.querySelectorAll(y)):[]}function a(_){return _.reduce(function(S,y){var h=y.getAttribute("xml:id");return h&&(S[h]=y),S},{})}function o(_,S){return[].slice.call(_.childNodes).reduce(function(y,h,E){var m;return h.nodeName==="br"&&E?y+`
|
|
`:(m=h.childNodes)!==null&&m!==void 0&&m.length?o(h,S):S?y+h.textContent.trim().replace(/\s+/g," "):y+h.textContent},"")}function f(_,S){var y="http://www.w3.org/ns/ttml#styling",h=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return h.reduce(function(E,m){var T=L(S,y,m)||L(_,y,m);return T&&(E[m]=T),E},{})}function L(_,S,y){return _.hasAttributeNS(S,y)?_.getAttributeNS(S,y):null}function C(_){return new Error("Could not parse ttml timestamp "+_)}function x(_,S){if(!_)return null;var y=Object(D.parseTimeStamp)(_);return y===null&&(p.test(_)?y=A(_,S):d.test(_)&&(y=w(_,S))),y}function A(_,S){var y=p.exec(_),h=(y[4]|0)+(y[5]|0)/S.subFrameRate;return(y[1]|0)*3600+(y[2]|0)*60+(y[3]|0)+h/S.frameRate}function w(_,S){var y=d.exec(_),h=Number(y[1]),E=y[2];switch(E){case"h":return h*3600;case"m":return h*60;case"ms":return h*1e3;case"f":return h/S.frameRate;case"t":return h/S.tickRate}return h}},"./src/utils/logger.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"enableLogs",function(){return F}),P.d(Q,"logger",function(){return R});var Y=function(){},D={trace:Y,debug:Y,log:Y,warn:Y,info:Y,error:Y},U=D;function H(g){var p=self.console[g];return p?p.bind(self.console,"["+g+"] >"):Y}function I(g){for(var p=arguments.length,d=new Array(p>1?p-1:0),l=1;l<p;l++)d[l-1]=arguments[l];d.forEach(function(n){U[n]=g[n]?g[n].bind(g):H(n)})}function F(g){if(self.console&&g===!0||typeof g=="object"){I(g,"debug","log","info","warn","error");try{U.log()}catch(p){U=D}}else U=D}var R=U},"./src/utils/mediakeys-helper.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"KeySystems",function(){return Y}),P.d(Q,"requestMediaKeySystemAccess",function(){return D});var Y;(function(U){U.WIDEVINE="com.widevine.alpha",U.PLAYREADY="com.microsoft.playready"})(Y||(Y={}));var D=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"getMediaSource",function(){return Y});function Y(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"bin2str",function(){return I}),P.d(Q,"readUint16",function(){return F}),P.d(Q,"readUint32",function(){return R}),P.d(Q,"writeUint32",function(){return g}),P.d(Q,"findBox",function(){return p}),P.d(Q,"parseSegmentIndex",function(){return d}),P.d(Q,"parseInitSegment",function(){return l}),P.d(Q,"getStartDTS",function(){return n}),P.d(Q,"getDuration",function(){return c}),P.d(Q,"computeRawDurationFromSamples",function(){return s}),P.d(Q,"offsetStartDTS",function(){return a}),P.d(Q,"segmentValidRange",function(){return o}),P.d(Q,"appendUint8Array",function(){return f});var Y=P("./src/utils/typed-array.ts"),D=P("./src/loader/fragment.ts"),U=Math.pow(2,32)-1,H=[].push;function I(L){return String.fromCharCode.apply(null,L)}function F(L,C){"data"in L&&(C+=L.start,L=L.data);var x=L[C]<<8|L[C+1];return x<0?65536+x:x}function R(L,C){"data"in L&&(C+=L.start,L=L.data);var x=L[C]<<24|L[C+1]<<16|L[C+2]<<8|L[C+3];return x<0?4294967296+x:x}function g(L,C,x){"data"in L&&(C+=L.start,L=L.data),L[C]=x>>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 A,w,_;"data"in L?(A=L.data,w=L.start,_=L.end):(A=L,w=0,_=A.byteLength);for(var S=w;S<_;){var y=R(A,S),h=I(A.subarray(S+4,S+8)),E=y>1?S+y:_;if(h===C[0])if(C.length===1)x.push({data:A,start:S+8,end:E});else{var m=p({data:A,start:S+8,end:E},C.slice(1));m.length&&H.apply(x,m)}S=E}return x}function d(L){var C=p(L,["moov"]),x=C[0],A=x?x.end:null,w=p(L,["sidx"]);if(!w||!w[0])return null;var _=[],S=w[0],y=S.data[0],h=y===0?8:16,E=R(S,h);h+=4;var m=0,T=0;y===0?h+=8:h+=16,h+=2;var j=S.end+T,N=F(S,h);h+=2;for(var K=0;K<N;K++){var W=h,k=R(S,W);W+=4;var b=k&2147483647,G=(k&2147483648)>>>31;if(G===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var J=R(S,W);W+=4,_.push({referenceSize:b,subsegmentDuration:J,info:{duration:J/E,start:j,end:j+b-1}}),j+=b,W+=4,h=W}return{earliestPresentationTime:m,timescale:E,version:y,referencesCount:N,references:_,moovEndOffset:A}}function l(L){for(var C=[],x=p(L,["moov","trak"]),A=0;A<x.length;A++){var w=x[A],_=p(w,["tkhd"])[0];if(_){var S=_.data[_.start],y=S===0?12:20,h=R(_,y),E=p(w,["mdia","mdhd"])[0];if(E){S=E.data[E.start],y=S===0?12:20;var m=R(E,y),T=p(w,["mdia","hdlr"])[0];if(T){var j=I(T.data.subarray(T.start+8,T.start+12)),N={soun:D.ElementaryStreamTypes.AUDIO,vide:D.ElementaryStreamTypes.VIDEO}[j];if(N){var K=p(w,["mdia","minf","stbl","stsd"])[0],W=void 0;K&&(W=I(K.data.subarray(K.start+12,K.start+16))),C[h]={timescale:m,type:N},C[N]={timescale:m,id:h,codec:W}}}}}}var k=p(L,["moov","mvex","trex"]);return k.forEach(function(b){var G=R(b,4),J=C[G];J&&(J.default={duration:R(b,12),flags:R(b,20)})}),C}function n(L,C){return p(C,["moof","traf"]).reduce(function(x,A){var w=p(A,["tfdt"])[0],_=w.data[w.start],S=p(A,["tfhd"]).reduce(function(y,h){var E=R(h,4),m=L[E];if(m){var T=R(w,4);_===1&&(T*=Math.pow(2,32),T+=R(w,8));var j=m.timescale||9e4,N=T/j;if(isFinite(N)&&(y===null||N<y))return N}return y},null);return S!==null&&isFinite(S)&&(x===null||S<x)?S:x},null)||0}function c(L,C){for(var x=0,A=0,w=0,_=p(L,["moof","traf"]),S=0;S<_.length;S++){var y=_[S],h=p(y,["tfhd"])[0],E=R(h,4),m=C[E];if(!m)continue;var T=m.default,j=R(h,0)|(T==null?void 0:T.flags),N=T==null?void 0:T.duration;j&8&&(j&2?N=R(h,12):N=R(h,8));for(var K=m.timescale||9e4,W=p(y,["trun"]),k=0;k<W.length;k++){if(N){var b=R(W[k],4);x=N*b}else x=s(W[k]);m.type===D.ElementaryStreamTypes.VIDEO?A+=x/K:m.type===D.ElementaryStreamTypes.AUDIO&&(w+=x/K)}}if(A===0&&w===0){var G=d(L);if(G!=null&&G.references)return G.references.reduce(function(J,oe){return J+oe.info.duration||0},0)}return A||w}function s(L){var C=R(L,0),x=8;C&1&&(x+=4),C&4&&(x+=4);for(var A=0,w=R(L,4),_=0;_<w;_++){if(C&256){var S=R(L,x);A+=S,x+=4}C&512&&(x+=4),C&1024&&(x+=4),C&2048&&(x+=4)}return A}function a(L,C,x){p(C,["moof","traf"]).forEach(function(A){p(A,["tfhd"]).forEach(function(w){var _=R(w,4),S=L[_];if(!S)return;var y=S.timescale||9e4;p(A,["tfdt"]).forEach(function(h){var E=h.data[h.start],m=R(h,4);if(E===0)g(h,4,m-x*y);else{m*=Math.pow(2,32),m+=R(h,8),m-=x*y,m=Math.max(m,0);var T=Math.floor(m/(U+1)),j=Math.floor(m%(U+1));g(h,4,T),g(h,8,j)}})})})}function o(L){var C={valid:null,remainder:null},x=p(L,["moof"]);if(x){if(x.length<2)return C.remainder=L,C}else return C;var A=x[x.length-1];return C.valid=Object(Y.sliceUint8)(L,0,A.start-8),C.remainder=Object(Y.sliceUint8)(L,A.start-8),C}function f(L,C){var x=new Uint8Array(L.length+C.length);return x.set(L),x.set(C,L.length),x}},"./src/utils/output-filter.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"default",function(){return Y});var Y=function(){function D(H,I){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=H,this.trackName=I}var U=D.prototype;return U.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},U.newCue=function(I,F,R){(this.startTime===null||this.startTime>I)&&(this.startTime=I),this.endTime=F,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},U.reset=function(){this.cueRanges=[]},D}()},"./src/utils/texttrack-utils.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"sendAddTrackEvent",function(){return D}),P.d(Q,"addCueToTrack",function(){return U}),P.d(Q,"clearCurrentCues",function(){return H}),P.d(Q,"removeCuesInRange",function(){return I}),P.d(Q,"getCuesInRange",function(){return R});var Y=P("./src/utils/logger.ts");function D(g,p){var d;try{d=new Event("addtrack")}catch(l){d=document.createEvent("Event"),d.initEvent("addtrack",!1,!1)}d.track=g,p.dispatchEvent(d)}function U(g,p){var d=g.mode;if(d==="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(n){Y.logger.debug("[texttrack-utils]: "+n);var l=new self.TextTrackCue(p.startTime,p.endTime,p.text);l.id=p.id,g.addCue(l)}d==="disabled"&&(g.mode=d)}function H(g){var p=g.mode;if(p==="disabled"&&(g.mode="hidden"),g.cues)for(var d=g.cues.length;d--;)g.removeCue(g.cues[d]);p==="disabled"&&(g.mode=p)}function I(g,p,d){var l=g.mode;if(l==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var n=R(g.cues,p,d),c=0;c<n.length;c++)g.removeCue(n[c]);l==="disabled"&&(g.mode=l)}function F(g,p){if(p<g[0].startTime)return 0;var d=g.length-1;if(p>g[d].endTime)return-1;for(var l=0,n=d;l<=n;){var c=Math.floor((n+l)/2);if(p<g[c].startTime)n=c-1;else if(p>g[c].startTime&&l<d)l=c+1;else return c}return g[l].startTime-p<p-g[n].startTime?l:n}function R(g,p,d){var l=[],n=F(g,p);if(n>-1)for(var c=n,s=g.length;c<s;c++){var a=g[c];if(a.startTime>=p&&a.endTime<=d)l.push(a);else if(a.startTime>d)return l}return l}},"./src/utils/time-ranges.ts":function(le,Q,P){"use strict";P.r(Q);var Y={toString:function(U){for(var H="",I=U.length,F=0;F<I;F++)H+="["+U.start(F).toFixed(3)+","+U.end(F).toFixed(3)+"]";return H}};Q.default=Y},"./src/utils/timescale-conversion.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"toTimescaleFromBase",function(){return D}),P.d(Q,"toTimescaleFromScale",function(){return U}),P.d(Q,"toMsFromMpegTsClock",function(){return H}),P.d(Q,"toMpegTsClockFromTimescale",function(){return I});var Y=9e4;function D(F,R,g,p){g===void 0&&(g=1),p===void 0&&(p=!1);var d=F*R*g;return p?Math.round(d):d}function U(F,R,g,p){return g===void 0&&(g=1),p===void 0&&(p=!1),D(F,R,1/g,p)}function H(F,R){return R===void 0&&(R=!1),D(F,1e3,1/Y,R)}function I(F,R){return R===void 0&&(R=1),D(F,Y,1/R)}},"./src/utils/typed-array.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"sliceUint8",function(){return Y});function Y(D,U,H){return Uint8Array.prototype.slice?D.slice(U,H):new Uint8Array(Array.prototype.slice.call(D,U,H))}},"./src/utils/vttcue.ts":function(le,Q,P){"use strict";P.r(Q),Q.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Y=["","lr","rl"],D=["start","middle","end","left","right"];function U(g,p){if(typeof p!="string")return!1;if(!Array.isArray(g))return!1;var d=p.toLowerCase();return~g.indexOf(d)?d:!1}function H(g){return U(Y,g)}function I(g){return U(D,g)}function F(g){for(var p=arguments.length,d=new Array(p>1?p-1:0),l=1;l<p;l++)d[l-1]=arguments[l];for(var n=1;n<arguments.length;n++){var c=arguments[n];for(var s in c)g[s]=c[s]}return g}function R(g,p,d){var l=this,n={enumerable:!0};l.hasBeenReset=!1;var c="",s=!1,a=g,o=p,f=d,L=null,C="",x=!0,A="auto",w="start",_=50,S="middle",y=50,h="middle";Object.defineProperty(l,"id",F({},n,{get:function(){return c},set:function(m){c=""+m}})),Object.defineProperty(l,"pauseOnExit",F({},n,{get:function(){return s},set:function(m){s=!!m}})),Object.defineProperty(l,"startTime",F({},n,{get:function(){return a},set:function(m){if(typeof m!="number")throw new TypeError("Start time must be set to a number.");a=m,this.hasBeenReset=!0}})),Object.defineProperty(l,"endTime",F({},n,{get:function(){return o},set:function(m){if(typeof m!="number")throw new TypeError("End time must be set to a number.");o=m,this.hasBeenReset=!0}})),Object.defineProperty(l,"text",F({},n,{get:function(){return f},set:function(m){f=""+m,this.hasBeenReset=!0}})),Object.defineProperty(l,"region",F({},n,{get:function(){return L},set:function(m){L=m,this.hasBeenReset=!0}})),Object.defineProperty(l,"vertical",F({},n,{get:function(){return C},set:function(m){var T=H(m);if(T===!1)throw new SyntaxError("An invalid or illegal string was specified.");C=T,this.hasBeenReset=!0}})),Object.defineProperty(l,"snapToLines",F({},n,{get:function(){return x},set:function(m){x=!!m,this.hasBeenReset=!0}})),Object.defineProperty(l,"line",F({},n,{get:function(){return A},set:function(m){if(typeof m!="number"&&m!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");A=m,this.hasBeenReset=!0}})),Object.defineProperty(l,"lineAlign",F({},n,{get:function(){return w},set:function(m){var T=I(m);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");w=T,this.hasBeenReset=!0}})),Object.defineProperty(l,"position",F({},n,{get:function(){return _},set:function(m){if(m<0||m>100)throw new Error("Position must be between 0 and 100.");_=m,this.hasBeenReset=!0}})),Object.defineProperty(l,"positionAlign",F({},n,{get:function(){return S},set:function(m){var T=I(m);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");S=T,this.hasBeenReset=!0}})),Object.defineProperty(l,"size",F({},n,{get:function(){return y},set:function(m){if(m<0||m>100)throw new Error("Size must be between 0 and 100.");y=m,this.hasBeenReset=!0}})),Object.defineProperty(l,"align",F({},n,{get:function(){return h},set:function(m){var T=I(m);if(!T)throw new SyntaxError("An invalid or illegal string was specified.");h=T,this.hasBeenReset=!0}})),l.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,Q,P){"use strict";P.r(Q),P.d(Q,"parseTimeStamp",function(){return U}),P.d(Q,"fixLineBreaks",function(){return p}),P.d(Q,"VTTParser",function(){return d});var Y=P("./src/utils/vttcue.ts"),D=function(){function l(){}var n=l.prototype;return n.decode=function(s,a){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))},l}();function U(l){function n(s,a,o,f){return(s|0)*3600+(a|0)*60+(o|0)+parseFloat(f||0)}var c=l.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return c?parseFloat(c[2])>59?n(c[2],c[3],0,c[4]):n(c[1],c[2],c[3],c[4]):null}var H=function(){function l(){this.values=Object.create(null)}var n=l.prototype;return n.set=function(s,a){!this.get(s)&&a!==""&&(this.values[s]=a)},n.get=function(s,a,o){return o?this.has(s)?this.values[s]:a[o]:this.has(s)?this.values[s]:a},n.has=function(s){return s in this.values},n.alt=function(s,a,o){for(var f=0;f<o.length;++f)if(a===o[f]){this.set(s,a);break}},n.integer=function(s,a){/^-?\d+$/.test(a)&&this.set(s,parseInt(a,10))},n.percent=function(s,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var o=parseFloat(a);if(o>=0&&o<=100)return this.set(s,o),!0}return!1},l}();function I(l,n,c,s){var a=s?l.split(s):[l];for(var o in a){if(typeof a[o]!="string")continue;var f=a[o].split(c);if(f.length!==2)continue;var L=f[0],C=f[1];n(L,C)}}var F=new Y.default(0,0,""),R=F.align==="middle"?"middle":"center";function g(l,n,c){var s=l;function a(){var L=U(l);if(L===null)throw new Error("Malformed timestamp: "+s);return l=l.replace(/^[^\sa-zA-Z-]+/,""),L}function o(L,C){var x=new H;I(L,function(_,S){var y;switch(_){case"region":for(var h=c.length-1;h>=0;h--)if(c[h].id===S){x.set(_,c[h].region);break}break;case"vertical":x.alt(_,S,["rl","lr"]);break;case"line":y=S.split(","),x.integer(_,y[0]),x.percent(_,y[0])&&x.set("snapToLines",!1),x.alt(_,y[0],["auto"]),y.length===2&&x.alt("lineAlign",y[1],["start",R,"end"]);break;case"position":y=S.split(","),x.percent(_,y[0]),y.length===2&&x.alt("positionAlign",y[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":x.percent(_,S);break;case"align":x.alt(_,S,["start",R,"end","left","right"]);break}},/:/,/\s/),C.region=x.get("region",null),C.vertical=x.get("vertical","");var A=x.get("line","auto");A==="auto"&&F.line===-1&&(A=-1),C.line=A,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"&&F.position===50&&(w=C.align==="start"||C.align==="left"?0:C.align==="end"||C.align==="right"?100:50),C.position=w}function f(){l=l.replace(/^\s+/,"")}if(f(),n.startTime=a(),f(),l.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);l=l.substr(3),f(),n.endTime=a(),f(),o(l,n)}function p(l){return l.replace(/<br(?: \/)?>/gi,`
|
|
`)}var d=function(){function l(){this.state="INITIAL",this.buffer="",this.decoder=new D,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var n=l.prototype;return n.parse=function(s){var a=this;s&&(a.buffer+=a.decoder.decode(s,{stream:!0}));function o(){var w=a.buffer,_=0;for(w=p(w);_<w.length&&w[_]!=="\r"&&w[_]!==`
|
|
`;)++_;var S=w.substr(0,_);return w[_]==="\r"&&++_,w[_]===`
|
|
`&&++_,a.buffer=w.substr(_),S}function f(w){I(w,function(_,S){},/:/)}try{var L="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;L=o();var C=L.match(/^()?WEBVTT([ \t].*)?$/);if(!C||!C[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var x=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;x?x=!1:L=o();switch(a.state){case"HEADER":/:/.test(L)?f(L):L||(a.state="ID");continue;case"NOTE":L||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(L)){a.state="NOTE";break}if(!L)continue;if(a.cue=new Y.default(0,0,""),a.state="CUE",L.indexOf("-->")===-1){a.cue.id=L;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{g(L,a.cue,a.regionList)}catch(w){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var A=L.indexOf("-->")!==-1;if(!L||A&&(x=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
|
|
`),a.cue.text+=L}continue;case"BADCUE":L||(a.state="ID")}}}catch(w){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},n.flush=function(){var s=this;try{if((s.cue||s.state==="HEADER")&&(s.buffer+=`
|
|
|
|
`,s.parse()),s.state==="INITIAL"||s.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){s.onparsingerror&&s.onparsingerror(a)}return s.onflush&&s.onflush(),this},l}()},"./src/utils/webvtt-parser.ts":function(le,Q,P){"use strict";P.r(Q),P.d(Q,"generateCueId",function(){return d}),P.d(Q,"parseWebVTT",function(){return n});var Y=P("./src/polyfills/number.ts"),D=P("./src/utils/vttparser.ts"),U=P("./src/demux/id3.ts"),H=P("./src/utils/timescale-conversion.ts"),I=P("./src/remux/mp4-remuxer.ts"),F=/\r\n|\n\r|\n|\r/g,R=function(s,a,o){return o===void 0&&(o=0),s.substr(o,a.length)===a},g=function(s){var a=parseInt(s.substr(-3)),o=parseInt(s.substr(-6,2)),f=parseInt(s.substr(-9,2)),L=s.length>9?parseInt(s.substr(0,s.indexOf(":"))):0;if(!Object(Y.isFiniteNumber)(a)||!Object(Y.isFiniteNumber)(o)||!Object(Y.isFiniteNumber)(f)||!Object(Y.isFiniteNumber)(L))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+s);return a+=1e3*o,a+=60*1e3*f,a+=60*60*1e3*L,a},p=function(s){for(var a=5381,o=s.length;o;)a=a*33^s.charCodeAt(--o);return(a>>>0).toString()};function d(c,s,a){return p(c.toString())+p(s.toString())+p(a)}var l=function(s,a,o){var f=s[a],L=s[f.prevCC];if(!L||!L.new&&f.new){s.ccOffset=s.presentationOffset=f.start,f.new=!1;return}for(;(C=L)!==null&&C!==void 0&&C.new;){var C;s.ccOffset+=f.start-L.start,f.new=!1,f=L,L=s[f.prevCC]}s.presentationOffset=o};function n(c,s,a,o,f,L,C,x){var A=new D.VTTParser,w=Object(U.utf8ArrayToStr)(new Uint8Array(c)).trim().replace(F,`
|
|
`).split(`
|
|
`),_=[],S=Object(H.toMpegTsClockFromTimescale)(s,a),y="00:00.000",h=0,E=0,m,T=!0,j=!1;A.oncue=function(N){var K=o[f],W=o.ccOffset,k=(h-S)/9e4;if(K!=null&&K.new&&(E!==void 0?W=o.ccOffset=K.start:l(o,f,k)),k&&(W=k-o.presentationOffset),j){var b=N.endTime-N.startTime,G=Object(I.normalizePts)((N.startTime+W-E)*9e4,L*9e4)/9e4;N.startTime=G,N.endTime=G+b}var J=N.text.trim();N.text=decodeURIComponent(encodeURIComponent(J)),N.id||(N.id=d(N.startTime,N.endTime,J)),N.endTime>0&&_.push(N)},A.onparsingerror=function(N){m=N},A.onflush=function(){if(m){x(m);return}C(_)},w.forEach(function(N){if(T)if(R(N,"X-TIMESTAMP-MAP=")){T=!1,j=!0,N.substr(16).split(",").forEach(function(K){R(K,"LOCAL:")?y=K.substr(6):R(K,"MPEGTS:")&&(h=parseInt(K.substr(7)))});try{E=g(y)/1e3}catch(K){j=!1,m=K}return}else N===""&&(T=!1);A.parse(N+`
|
|
`)}),A.flush()}},"./src/utils/xhr-loader.ts":function(le,Q,P){"use strict";P.r(Q);var Y=P("./src/utils/logger.ts"),D=P("./src/loader/load-stats.ts"),U=/^age:\s*[\d.]+\s*$/m,H=function(){function I(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 D.LoadStats,this.retryDelay=0}var F=I.prototype;return F.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},F.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()))},F.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},F.load=function(g,p,d){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=d,this.retryDelay=p.retryDelay,this.loadInternal()},F.loadInternal=function(){var g=this.config,p=this.context;if(!g)return;var d=this.loader=new self.XMLHttpRequest,l=this.stats;l.loading.first=0,l.loaded=0;var n=this.xhrSetup;try{if(n)try{n(d,p.url)}catch(a){d.open("GET",p.url,!0),n(d,p.url)}d.readyState||d.open("GET",p.url,!0);var c=this.context.headers;if(c)for(var s in c)d.setRequestHeader(s,c[s])}catch(a){this.callbacks.onError({code:d.status,text:a.message},p,d);return}p.rangeEnd&&d.setRequestHeader("Range","bytes="+p.rangeStart+"-"+(p.rangeEnd-1)),d.onreadystatechange=this.readystatechange.bind(this),d.onprogress=this.loadprogress.bind(this),d.responseType=p.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout),d.send()},F.readystatechange=function(){var g=this.context,p=this.loader,d=this.stats;if(!g||!p)return;var l=p.readyState,n=this.config;if(d.aborted)return;if(l>=2)if(self.clearTimeout(this.requestTimeout),d.loading.first===0&&(d.loading.first=Math.max(self.performance.now(),d.loading.start)),l===4){p.onreadystatechange=null,p.onprogress=null;var c=p.status;if(c>=200&&c<300){d.loading.end=Math.max(self.performance.now(),d.loading.first);var s,a;if(g.responseType==="arraybuffer"?(s=p.response,a=s.byteLength):(s=p.responseText,a=s.length),d.loaded=d.total=a,!this.callbacks)return;var o=this.callbacks.onProgress;if(o&&o(d,g,s,p),!this.callbacks)return;var f={url:p.responseURL,data:s};this.callbacks.onSuccess(f,d,g,p)}else d.retry>=n.maxRetry||c>=400&&c<499?(Y.logger.error(c+" while loading "+g.url),this.callbacks.onError({code:c,text:p.statusText},g,p)):(Y.logger.warn(c+" 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,n.maxRetryDelay),d.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout)},F.loadtimeout=function(){Y.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},F.loadprogress=function(g){var p=this.stats;p.loaded=g.loaded,g.lengthComputable&&(p.total=g.total)},F.getCacheAge=function(){var g=null;if(this.loader&&U.test(this.loader.getAllResponseHeaders())){var p=this.loader.getResponseHeader("age");g=p?parseFloat(p):null}return g},I}();Q.default=H}}).default})},vHTk:function(Mt,_t,q){Mt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},"yTi+":function(Mt,_t,q){Mt.exports=q.p+"static/AssistantCode3.fdd8db3c.jpeg"}}]);
|