@zhangqingcq/vgce 0.0.21 → 0.0.22

Sign up to get free protection for your applications and to get access to all the features.
package/dist/vgce.umd.cjs CHANGED
@@ -1152,5 +1152,5 @@ styles.join("\\n")
1152
1152
  line-height: 1.4;
1153
1153
  background: #25282c;
1154
1154
  color: #c1c1c1;
1155
- }`,"autocompletion.css",!1),g.AcePopup=Ie,g.$singleLineEditor=le,g.getAriaId=ae}),ace.define("ace/autocomplete/util",["require","exports","module"],function(r,g,V){g.parForEach=function($,oe,re){var Ce=0,ie=$.length;ie===0&&re();for(var ae=0;ae<ie;ae++)oe($[ae],function(le,Ie){Ce++,Ce===ie&&re(le,Ie)})};var k=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;g.retrievePrecedingIdentifier=function($,oe,re){re=re||k;for(var Ce=[],ie=oe-1;ie>=0&&re.test($[ie]);ie--)Ce.push($[ie]);return Ce.reverse().join("")},g.retrieveFollowingIdentifier=function($,oe,re){re=re||k;for(var Ce=[],ie=oe;ie<$.length&&re.test($[ie]);ie++)Ce.push($[ie]);return Ce},g.getCompletionPrefix=function($){var oe=$.getCursorPosition(),re=$.session.getLine(oe.row),Ce;return $.completers.forEach(function(ie){ie.identifierRegexps&&ie.identifierRegexps.forEach(function(ae){!Ce&&ae&&(Ce=this.retrievePrecedingIdentifier(re,oe.column,ae))}.bind(this))}.bind(this)),Ce||this.retrievePrecedingIdentifier(re,oe.column)}}),ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config"],function(r,g,V){var k=r("./keyboard/hash_handler").HashHandler,$=r("./autocomplete/popup").AcePopup,oe=r("./autocomplete/popup").getAriaId,re=r("./autocomplete/util"),Ce=r("./lib/lang"),ie=r("./lib/dom"),ae=r("./snippets").snippetManager,le=r("./config"),Ie=function(){this.autoInsert=!1,this.autoSelect=!0,this.exactMatch=!1,this.gatherCompletionsId=0,this.keyboardHandler=new k,this.keyboardHandler.bindKeys(this.commands),this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.changeTimer=Ce.delayedCall(function(){this.updateCompletions(!0)}.bind(this)),this.tooltipTimer=Ce.delayedCall(this.updateDocTooltip.bind(this),50)};(function(){this.$init=function(){return this.popup=new $(document.body||document.documentElement),this.popup.on("click",function(de){this.insertMatch(),de.stop()}.bind(this)),this.popup.focus=this.editor.focus.bind(this.editor),this.popup.on("show",this.tooltipTimer.bind(null,null)),this.popup.on("select",this.tooltipTimer.bind(null,null)),this.popup.on("changeHoverMarker",this.tooltipTimer.bind(null,null)),this.popup},this.getPopup=function(){return this.popup||this.$init()},this.openPopup=function(de,Ne,he){this.popup||this.$init(),this.popup.autoSelect=this.autoSelect,this.popup.setData(this.completions.filtered,this.completions.filterText),this.editor.textInput.setAriaOptions({activeDescendant:oe(this.popup.getRow())}),de.keyBinding.addKeyboardHandler(this.keyboardHandler);var ze=de.renderer;if(this.popup.setRow(this.autoSelect?0:-1),he)he&&!Ne&&this.detach();else{this.popup.setTheme(de.getTheme()),this.popup.setFontSize(de.getFontSize());var pe=ze.layerConfig.lineHeight,Ve=ze.$cursorLayer.getPixelPosition(this.base,!0);Ve.left-=this.popup.getTextLeftOffset();var Oe=de.container.getBoundingClientRect();Ve.top+=Oe.top-ze.layerConfig.offset,Ve.left+=Oe.left-de.renderer.scrollLeft,Ve.left+=ze.gutterWidth,this.popup.show(Ve,pe)}this.changeTimer.cancel()},this.detach=function(){this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off("changeSelection",this.changeListener),this.editor.off("blur",this.blurListener),this.editor.off("mousedown",this.mousedownListener),this.editor.off("mousewheel",this.mousewheelListener),this.changeTimer.cancel(),this.hideDocTooltip(),this.gatherCompletionsId+=1,this.popup&&this.popup.isOpen&&this.popup.hide(),this.base&&this.base.detach(),this.activated=!1,this.completions=this.base=null},this.changeListener=function(de){var Ne=this.editor.selection.lead;(Ne.row!=this.base.row||Ne.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},this.blurListener=function(de){var Ne=document.activeElement,he=this.editor.textInput.getElement(),ze=de.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(de.relatedTarget),pe=this.popup&&this.popup.container;Ne!=he&&Ne.parentNode!=pe&&!ze&&Ne!=this.tooltipNode&&de.relatedTarget!=he&&this.detach()},this.mousedownListener=function(de){this.detach()},this.mousewheelListener=function(de){this.detach()},this.goTo=function(de){this.popup.goTo(de)},this.insertMatch=function(de,Ne){if(de||(de=this.popup.getData(this.popup.getRow())),!de)return!1;var he=this.completions;if(this.editor.startOperation({command:{name:"insertMatch"}}),de.completer&&de.completer.insertMatch)de.completer.insertMatch(this.editor,de);else{if(!he)return!1;if(he.filterText)for(var ze=this.editor.selection.getAllRanges(),pe=0,Ve;Ve=ze[pe];pe++)Ve.start.column-=he.filterText.length,this.editor.session.remove(Ve);de.snippet?ae.insertSnippet(this.editor,de.snippet):this.editor.execCommand("insertstring",de.value||de)}this.completions==he&&this.detach(),this.editor.endOperation()},this.commands={Up:function(de){de.completer.goTo("up")},Down:function(de){de.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(de){de.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(de){de.completer.goTo("end")},Esc:function(de){de.completer.detach()},Return:function(de){return de.completer.insertMatch()},"Shift-Return":function(de){de.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(de){var Ne=de.completer.insertMatch();if(!Ne&&!de.tabstopManager)de.completer.goTo("down");else return Ne},PageUp:function(de){de.completer.popup.gotoPageUp()},PageDown:function(de){de.completer.popup.gotoPageDown()}},this.gatherCompletions=function(de,Ne){var he=de.getSession(),ze=de.getCursorPosition(),pe=re.getCompletionPrefix(de);this.base=he.doc.createAnchor(ze.row,ze.column-pe.length),this.base.$insertRight=!0;var Ve=[],Oe=de.completers.length;return de.completers.forEach(function(_e,At){_e.getCompletions(de,he,ze,pe,function($e,Fe){!$e&&Fe&&(Ve=Ve.concat(Fe)),Ne(null,{prefix:re.getCompletionPrefix(de),matches:Ve,finished:--Oe===0})})}),!0},this.showPopup=function(de,Ne){this.editor&&this.detach(),this.activated=!0,this.editor=de,de.completer!=this&&(de.completer&&de.completer.detach(),de.completer=this),de.on("changeSelection",this.changeListener),de.on("blur",this.blurListener),de.on("mousedown",this.mousedownListener),de.on("mousewheel",this.mousewheelListener),this.updateCompletions(!1,Ne)},this.updateCompletions=function(de,Ne){if(de&&this.base&&this.completions){var he=this.editor.getCursorPosition(),ze=this.editor.session.getTextRange({start:this.base,end:he});if(ze==this.completions.filterText)return;if(this.completions.setFilter(ze),!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==ze&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,ze,de);return}if(Ne&&Ne.matches){var he=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(he.row,he.column),this.base.$insertRight=!0,this.completions=new ue(Ne.matches),this.openPopup(this.editor,"",de)}var pe=this.gatherCompletionsId,Ve=function(Fe){if(Fe.finished)return this.detach()}.bind(this),Oe=function(Fe){var Ue=Fe.prefix,xe=Fe.matches;this.completions=new ue(xe),this.exactMatch&&(this.completions.exactMatch=!0),this.completions.setFilter(Ue);var Dt=this.completions.filtered;if(!Dt.length||Dt.length==1&&Dt[0].value==Ue&&!Dt[0].snippet)return Ve(Fe);if(this.autoInsert&&Dt.length==1&&Fe.finished)return this.insertMatch(Dt[0]);this.openPopup(this.editor,Ue,de)}.bind(this),_e=!0,At=null;if(this.gatherCompletions(this.editor,function(Fe,Ue){var xe=Ue.prefix,Dt=Ue&&Ue.matches;if(!Dt||!Dt.length)return Ve(Ue);if(!(xe.indexOf(Ue.prefix)!==0||pe!=this.gatherCompletionsId)){if(_e){At=Ue;return}Oe(Ue)}}.bind(this)),_e=!1,At){var $e=At;At=null,Oe($e)}},this.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},this.updateDocTooltip=function(){var de=this.popup,Ne=de.data,he=Ne&&(Ne[de.getHoveredRow()]||Ne[de.getRow()]),ze=null;if(!he||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();if(this.editor.completers.some(function(pe){return pe.getDocTooltip&&(ze=pe.getDocTooltip(he)),ze}),!ze&&typeof he!="string"&&(ze=he),typeof ze=="string"&&(ze={docText:ze}),!ze||!(ze.docHTML||ze.docText))return this.hideDocTooltip();this.showDocTooltip(ze)},this.showDocTooltip=function(de){this.tooltipNode||(this.tooltipNode=ie.createElement("div"),this.tooltipNode.className="ace_tooltip ace_doc-tooltip",this.tooltipNode.style.margin=0,this.tooltipNode.style.pointerEvents="auto",this.tooltipNode.tabIndex=-1,this.tooltipNode.onblur=this.blurListener.bind(this),this.tooltipNode.onclick=this.onTooltipClick.bind(this));var Ne=this.tooltipNode;de.docHTML?Ne.innerHTML=de.docHTML:de.docText&&(Ne.textContent=de.docText),Ne.parentNode||document.body.appendChild(Ne);var he=this.popup,ze=he.container.getBoundingClientRect();Ne.style.top=he.container.style.top,Ne.style.bottom=he.container.style.bottom,Ne.style.display="block",window.innerWidth-ze.right<320?ze.left<320?he.isTopdown?(Ne.style.top=ze.bottom+"px",Ne.style.left=ze.left+"px",Ne.style.right="",Ne.style.bottom=""):(Ne.style.top=he.container.offsetTop-Ne.offsetHeight+"px",Ne.style.left=ze.left+"px",Ne.style.right="",Ne.style.bottom=""):(Ne.style.right=window.innerWidth-ze.left+"px",Ne.style.left=""):(Ne.style.left=ze.right+1+"px",Ne.style.right="")},this.hideDocTooltip=function(){if(this.tooltipTimer.cancel(),!!this.tooltipNode){var de=this.tooltipNode;!this.editor.isFocused()&&document.activeElement==de&&this.editor.focus(),this.tooltipNode=null,de.parentNode&&de.parentNode.removeChild(de)}},this.onTooltipClick=function(de){for(var Ne=de.target;Ne&&Ne!=this.tooltipNode;){if(Ne.nodeName=="A"&&Ne.href){Ne.rel="noreferrer",Ne.target="_blank";break}Ne=Ne.parentNode}},this.destroy=function(){if(this.detach(),this.popup){this.popup.destroy();var de=this.popup.container;de&&de.parentNode&&de.parentNode.removeChild(de)}this.editor&&this.editor.completer==this&&this.editor.completer==null,this.popup=null}}).call(Ie.prototype),Ie.for=function(de){return de.completer||(le.get("sharedPopups")?(Ie.$shared||(Ie.$sharedInstance=new Ie),de.completer=Ie.$sharedInstance):(de.completer=new Ie,de.once("destroy",function(Ne,he){he.completer.destroy()}))),de.completer},Ie.startCommand={name:"startAutocomplete",exec:function(de,Ne){var he=Ie.for(de);he.autoInsert=!1,he.autoSelect=!0,he.showPopup(de,Ne),he.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var ue=function(de,Ne){this.all=de,this.filtered=de,this.filterText=Ne||"",this.exactMatch=!1};(function(){this.setFilter=function(de){if(de.length>this.filterText&&de.lastIndexOf(this.filterText,0)===0)var Ne=this.filtered;else var Ne=this.all;this.filterText=de,Ne=this.filterCompletions(Ne,this.filterText),Ne=Ne.sort(function(ze,pe){return pe.exactMatch-ze.exactMatch||pe.$score-ze.$score||(ze.caption||ze.value).localeCompare(pe.caption||pe.value)});var he=null;Ne=Ne.filter(function(ze){var pe=ze.snippet||ze.caption||ze.value;return pe===he?!1:(he=pe,!0)}),this.filtered=Ne},this.filterCompletions=function(de,Ne){var he=[],ze=Ne.toUpperCase(),pe=Ne.toLowerCase();e:for(var Ve=0,Oe;Oe=de[Ve];Ve++){var _e=Oe.caption||Oe.value||Oe.snippet;if(_e){var At=-1,$e=0,Fe=0,Ue,xe;if(this.exactMatch){if(Ne!==_e.substr(0,Ne.length))continue e}else{var Dt=_e.toLowerCase().indexOf(pe);if(Dt>-1)Fe=Dt;else for(var qe=0;qe<Ne.length;qe++){var kt=_e.indexOf(pe[qe],At+1),Et=_e.indexOf(ze[qe],At+1);if(Ue=kt>=0&&(Et<0||kt<Et)?kt:Et,Ue<0)continue e;xe=Ue-At-1,xe>0&&(At===-1&&(Fe+=10),Fe+=xe,$e=$e|1<<qe),At=Ue}}Oe.matchMask=$e,Oe.exactMatch=Fe?0:1,Oe.$score=(Oe.score||0)-Fe,he.push(Oe)}}return he}}).call(ue.prototype),g.Autocomplete=Ie,g.FilteredList=ue}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(r,g,V){var k=r("../range").Range,$=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;function oe(Ce,ie){var ae=Ce.getTextRange(k.fromPoints({row:0,column:0},ie));return ae.split($).length-1}function re(Ce,ie){var ae=oe(Ce,ie),le=Ce.getValue().split($),Ie=Object.create(null),ue=le[ae];return le.forEach(function(de,Ne){if(!(!de||de===ue)){var he=Math.abs(ae-Ne),ze=le.length-he;Ie[de]?Ie[de]=Math.max(ze,Ie[de]):Ie[de]=ze}}),Ie}g.getCompletions=function(Ce,ie,ae,le,Ie){var ue=re(ie,ae),de=Object.keys(ue);Ie(null,de.map(function(Ne){return{caption:Ne,value:Ne,score:ue[Ne],meta:"local"}}))}}),ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"],function(r,g,V){var k=r("../snippets").snippetManager,$=r("../autocomplete").Autocomplete,oe=r("../config"),re=r("../lib/lang"),Ce=r("../autocomplete/util"),ie=r("../autocomplete/text_completer"),ae={getCompletions:function(Oe,_e,At,$e,Fe){if(_e.$mode.completer)return _e.$mode.completer.getCompletions(Oe,_e,At,$e,Fe);var Ue=Oe.session.getState(At.row),xe=_e.$mode.getCompletions(Ue,_e,At,$e);Fe(null,xe)}},le=function(Oe){var _e={};return Oe.replace(/\${(\d+)(:(.*?))?}/g,function(At,$e,Fe,Ue){return _e[$e]=Ue||""}).replace(/\$(\d+?)/g,function(At,$e){return _e[$e]})},Ie={getCompletions:function(Oe,_e,At,$e,Fe){var Ue=[],xe=_e.getTokenAt(At.row,At.column);xe&&xe.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?Ue.push("html-tag"):Ue=k.getActiveScopes(Oe);var Dt=k.snippetMap,qe=[];Ue.forEach(function(kt){for(var Et=Dt[kt]||[],jt=Et.length;jt--;){var ti=Et[jt],Lt=ti.name||ti.tabTrigger;Lt&&qe.push({caption:Lt,snippet:ti.content,meta:ti.tabTrigger&&!ti.name?ti.tabTrigger+"⇥ ":"snippet",type:"snippet"})}},this),Fe(null,qe)},getDocTooltip:function(Oe){Oe.type=="snippet"&&!Oe.docHTML&&(Oe.docHTML=["<b>",re.escapeHTML(Oe.caption),"</b>","<hr></hr>",re.escapeHTML(le(Oe.snippet))].join(""))}},ue=[Ie,ie,ae];g.setCompleters=function(Oe){ue.length=0,Oe&&ue.push.apply(ue,Oe)},g.addCompleter=function(Oe){ue.push(Oe)},g.textCompleter=ie,g.keyWordCompleter=ae,g.snippetCompleter=Ie;var de={name:"expandSnippet",exec:function(Oe){return k.expandWithTab(Oe)},bindKey:"Tab"},Ne=function(Oe,_e){he(_e.session.$mode)},he=function(Oe){typeof Oe=="string"&&(Oe=oe.$modes[Oe]),Oe&&(k.files||(k.files={}),ze(Oe.$id,Oe.snippetFileId),Oe.modes&&Oe.modes.forEach(he))},ze=function(Oe,_e){!_e||!Oe||k.files[Oe]||(k.files[Oe]={},oe.loadModule(_e,function(At){At&&(k.files[Oe]=At,!At.snippets&&At.snippetText&&(At.snippets=k.parseSnippetFile(At.snippetText)),k.register(At.snippets||[],At.scope),At.includeScopes&&(k.snippetMap[At.scope].includeScopes=At.includeScopes,At.includeScopes.forEach(function($e){he("ace/mode/"+$e)})))}))},pe=function(Oe){var _e=Oe.editor,At=_e.completer&&_e.completer.activated;if(Oe.command.name==="backspace")At&&!Ce.getCompletionPrefix(_e)&&_e.completer.detach();else if(Oe.command.name==="insertstring"){var $e=Ce.getCompletionPrefix(_e);if($e&&!At){var Fe=$.for(_e);Fe.autoInsert=!1,Fe.showPopup(_e)}}},Ve=r("../editor").Editor;r("../config").defineOptions(Ve.prototype,"editor",{enableBasicAutocompletion:{set:function(Oe){Oe?(this.completers||(this.completers=Array.isArray(Oe)?Oe:ue),this.commands.addCommand($.startCommand)):this.commands.removeCommand($.startCommand)},value:!1},enableLiveAutocompletion:{set:function(Oe){Oe?(this.completers||(this.completers=Array.isArray(Oe)?Oe:ue),this.commands.on("afterExec",pe)):this.commands.removeListener("afterExec",pe)},value:!1},enableSnippets:{set:function(Oe){Oe?(this.commands.addCommand(de),this.on("changeMode",Ne),Ne(null,this)):(this.commands.removeCommand(de),this.off("changeMode",Ne))},value:!1}})}),function(){ace.require(["ace/ext/language_tools"],function(r){i&&(i.exports=r)})}()})(extLanguage_tools),ace$1.config.setModuleUrl("ace/theme/github",themeUrl),ace$1.config.setModuleUrl("ace/theme/kr_theme",themeUrl2),ace$1.config.setModuleUrl("ace/mode/base",workerBaseUrl),ace$1.config.setModuleUrl("ace/mode/json",modeJsonUrl),ace$1.config.setModuleUrl("ace/mode/json_worker",workerJsonUrl),ace$1.config.setModuleUrl("ace/snippets/json",snippetsJsonUrl),ace$1.config.setModuleUrl("ace/mode/javascript",modeJavascriptUrl),ace$1.config.setModuleUrl("ace/mode/javascript_worker",workerJavascriptUrl),ace$1.config.setModuleUrl("ace/snippets/javascript",snippetsJavascriptUrl),ace$1.require("ace/ext/language_tools");const _sfc_main$c=vue.defineComponent({__name:"code-edit-modal",props:{modelValue:{default:()=>({})},lang:{default:"json"},title:{default:"编辑"}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=vue.ref(!1),V=vue.computed({get(){return r.lang==="json"?JSON.stringify(r.modelValue,null,2):r.modelValue},set(k){r.lang==="json"?n("update:modelValue",JSON.parse(k)):n("update:modelValue",k)}});return(k,$)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(ElButton),{onClick:$[0]||($[0]=oe=>g.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("···")]),_:1}),vue.createVNode(vue.unref(ElDialog),{class:"modal-full",modelValue:vue.unref(g),"onUpdate:modelValue":$[2]||($[2]=oe=>vue.isRef(g)?g.value=oe:null),title:r.title,width:"60%"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(VAceEditor),{value:vue.unref(V),"onUpdate:value":$[1]||($[1]=oe=>vue.isRef(V)?V.value=oe:null),lang:r.lang,theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value","lang"])]),_:1},8,["modelValue","title"])]))}}),_hoisted_1$7={class:"one-row-txt",style:{width:"78px"}},_hoisted_2$5={key:1},_hoisted_3$5={class:"one-row-txt",style:{width:"145px"}},_hoisted_4$3={key:1},_sfc_main$b=vue.defineComponent({__name:"dynamic-el-form-item",props:{objInfo:{default:()=>({})},hide:{default:()=>[]},code:{type:Boolean,default:!1}},setup(i){const n=i;return(r,g)=>(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.objInfo,(V,k)=>(vue.openBlock(),vue.createElementBlock("div",{key:k},[n.code?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,class:"props-row",size:"small"},{label:vue.withCtx(()=>[vue.unref(getStringWidth)(String(k))>78?(vue.openBlock(),vue.createBlock(vue.unref(ElTooltip),{key:0,content:String(k),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$7,vue.toDisplayString(k),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$5,vue.toDisplayString(k),1))]),default:vue.withCtx(()=>[vue.unref(getStringWidth)(String(V.val))>145?(vue.openBlock(),vue.createBlock(vue.unref(ElTooltip),{key:0,content:JSON.stringify(V.val),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$5,vue.toDisplayString(V.val),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$3,vue.toDisplayString(V.val),1))]),_:2},1024)):vue.createCommentVNode("",!0),n.hide.indexOf(String(k))<0?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:1,label:V.title,size:"small"},{default:vue.withCtx(()=>[V.type===vue.unref(EConfigItemPropsType).Select?(vue.openBlock(),vue.createBlock(vue.unref(ElSelect),{key:0,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,placeholder:"Select",size:"small",disabled:!!(V!=null&&V.disabled)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(V.options,$=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:$.value,label:$.label,value:$.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).InputNumber?(vue.openBlock(),vue.createBlock(vue.unref(ElInputNumber),{key:1,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Input?(vue.openBlock(),vue.createBlock(vue.unref(ElInput),{key:2,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Textarea?(vue.openBlock(),vue.createBlock(vue.unref(ElInput),{key:3,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,autosize:"",type:"textarea",disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Color?(vue.openBlock(),vue.createBlock(vue.unref(ElColorPicker),{key:4,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Switch?(vue.openBlock(),vue.createBlock(vue.unref(ElSwitch),{key:5,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).JsonEdit?(vue.openBlock(),vue.createBlock(_sfc_main$c,{key:6,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):vue.createCommentVNode("",!0)]),_:2},1032,["label"])):vue.createCommentVNode("",!0)]))),128))}}),dynamicElFormItem_vue_vue_type_style_index_0_scoped_9e624fb4_lang="",dynamicElFormItem_vue_vue_type_style_index_1_lang="",DynamicElFormItem=_export_sfc(_sfc_main$b,[["__scopeId","data-v-9e624fb4"]]),_hoisted_1$6={style:{height:"100%"}},_hoisted_2$4={class:"flex flex-wrap"},_hoisted_3$4=["onMouseenter","onClick"],_sfc_main$a=vue.defineComponent({__name:"common-animate",props:{val:{}},emits:["updateCommonAniVal"],setup(i,{emit:n}){const r=i,g=vue.ref(r.val),V=vue.ref(!1),k=vue.ref("进入"),$=vue.ref(null),oe=re=>{n("updateCommonAniVal",re),V.value=!1};return vue.watch(()=>r.val,re=>{g.value=re}),(re,Ce)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$6,[vue.unref(g)?(vue.openBlock(),vue.createBlock(vue.unref(ElTag),{key:0,closable:"",onClose:Ce[0]||(Ce[0]=ie=>oe("")),onClick:Ce[1]||(Ce[1]=ie=>V.value=!0),style:{cursor:"pointer"}},{default:vue.withCtx(()=>{var ie;return[vue.createTextVNode(vue.toDisplayString((ie=vue.unref(common_animate_list).map(ae=>ae.children).reduce((ae,le)=>ae.concat(le)).find(ae=>ae.value==vue.unref(g)))==null?void 0:ie.label)+" ",1),vue.createVNode(vue.unref(ElIcon),{size:10},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"setting"})]),_:1})]}),_:1})):(vue.openBlock(),vue.createBlock(vue.unref(ElTag),{key:1,type:"success",style:{cursor:"pointer"},onClick:Ce[2]||(Ce[2]=ie=>V.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("新增")]),_:1})),vue.createVNode(vue.unref(ElDrawer),{modelValue:vue.unref(V),"onUpdate:modelValue":Ce[5]||(Ce[5]=ie=>vue.isRef(V)?V.value=ie:null),title:"选择动画",direction:"ltr"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElTabs),{modelValue:vue.unref(k),"onUpdate:modelValue":Ce[4]||(Ce[4]=ie=>vue.isRef(k)?k.value=ie:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(common_animate_list),ie=>(vue.openBlock(),vue.createBlock(vue.unref(ElTabPane),{label:ie.label,name:ie.label,key:ie.label},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElScrollbar),{height:"500px"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_2$4,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(ie.children,(ae,le)=>(vue.openBlock(),vue.createElementBlock("div",{class:"animate",key:le,onMouseenter:Ie=>$.value=le,onMouseleave:Ce[3]||(Ce[3]=Ie=>$.value=null),onClick:Ie=>oe(ae.value)},[vue.createElementVNode("div",{class:vue.normalizeClass(`${vue.unref($)==le?`animate__animated animate__${ae.value} animate__slow animate__infinite`:""}`)},vue.toDisplayString(ae.label),3)],40,_hoisted_3$4))),128))])]),_:2},1024)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]))}}),commonAnimate_vue_vue_type_style_index_0_scoped_2807ad45_lang="",CommonAnimate=_export_sfc(_sfc_main$a,[["__scopeId","data-v-2807ad45"]]),_sfc_main$9=vue.defineComponent({__name:"index",setup(i){var k;const n=useGlobalStore(pinia),r=vue.ref(((k=n.handle_svg_info)==null?void 0:k.info.id)||""),g=$=>{for(let oe of n.done_json)oe.selected=!1,oe.old_position={x:0,y:0};n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo($)},V={children:"children",label:"title"};return($,oe)=>(vue.openBlock(),vue.createBlock(vue.unref(ElTree),{data:vue.unref(n).done_json,props:V,onNodeClick:g,"default-expand-all":!0,"expand-on-click-node":!1,"highlight-current":!0,"node-key":"id","current-node-key":vue.unref(r)},null,8,["data","current-node-key"]))}}),_withScopeId$1=i=>(vue.pushScopeId("data-v-c79cfc9b"),i=i(),vue.popScopeId(),i),_hoisted_1$5={class:"wall-l"},_hoisted_2$3={class:"head-l"},_hoisted_3$3=_withScopeId$1(()=>vue.createElementVNode("span",null,"key",-1)),_hoisted_4$2=_withScopeId$1(()=>vue.createElementVNode("span",null,"value",-1)),_hoisted_5$1={class:"row-l"},_sfc_main$8=vue.defineComponent({__name:"list",props:{modelValue:{default:()=>[{key:"",val:""}]}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=vue.computed({get(){return r.modelValue},set($){n("update:modelValue",$)}}),V=()=>{g.value.push({key:"",val:""})},k=$=>{g.value.splice($,1)};return($,oe)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$5,[vue.createElementVNode("div",_hoisted_2$3,[_hoisted_3$3,_hoisted_4$2,vue.createVNode(vue.unref(ElIcon),{size:16,class:"bt-Icon",onClick:V},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"add"})]),_:1})]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(g),(re,Ce)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,[vue.createVNode(vue.unref(ElInput),{class:"content-l",modelValue:re.key,"onUpdate:modelValue":ie=>re.key=ie,size:"small",placeholder:"key"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(ElInput),{class:"content-l",modelValue:re.val,"onUpdate:modelValue":ie=>re.val=ie,size:"small",placeholder:"value"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(ElIcon),{size:16,class:"bt-Icon",onClick:ie=>k(Ce)},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"delete"})]),_:2},1032,["onClick"])]))),256))]))}}),list_vue_vue_type_style_index_0_scoped_c79cfc9b_lang="",List=_export_sfc(_sfc_main$8,[["__scopeId","data-v-c79cfc9b"]]),_hoisted_1$4={class:"c-wall-d"},_sfc_main$7=vue.defineComponent({__name:"condition",props:{modelValue:{default:()=>({type:EConditionType.None})}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=vue.computed({get(){return r.modelValue},set($){n("update:modelValue",$)}}),V=[{label:"大于",val:"greater"},{label:"大于等于",val:">="},{label:"小于",val:"<"},{label:"小于等于",val:"<="},{label:"等于",val:"=="},{label:"不等于",val:"!="},{label:"介于",val:">=,=<"},{label:"不介于",val:"<,>"}],k=$=>{$!=="None"&&(g.value.Relation={key:"",relation:"",val:"",val2:""}),n("update:modelValue",g)};return($,oe)=>{var re,Ce;return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$4,[vue.createVNode(vue.unref(ElFormItem),{label:"条件",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(g).type,"onUpdate:modelValue":oe[0]||(oe[0]=ie=>vue.unref(g).type=ie),onChange:k},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"None",label:"无"}),vue.createVNode(vue.unref(ElOption),{value:"Relation",label:"关系运算"})]),_:1},8,["modelValue"])]),_:1}),vue.unref(g).type==="Relation"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"属性",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(g).Relation.key,"onUpdate:modelValue":oe[1]||(oe[1]=ie=>vue.unref(g).Relation.key=ie)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(g).type==="Relation"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:1,label:"关系",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(g).Relation.relation,"onUpdate:modelValue":oe[2]||(oe[2]=ie=>vue.unref(g).Relation.relation=ie)},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(V,(ie,ae)=>vue.createVNode(vue.unref(ElOption),{value:ie.val,label:ie.label,key:"rop"+ae},null,8,["value","label"])),64))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(g).type==="Relation"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:2,label:"值",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(g).Relation.val,"onUpdate:modelValue":oe[3]||(oe[3]=ie=>vue.unref(g).Relation.val=ie)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(g).type==="Relation"&&(((re=vue.unref(g).Relation)==null?void 0:re.relation)===">=,=<"||((Ce=vue.unref(g).Relation)==null?void 0:Ce.relation)==="<,>")?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:3,label:"值2",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(g).Relation.val2,"onUpdate:modelValue":oe[4]||(oe[4]=ie=>vue.unref(g).Relation.val2=ie)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)])}}}),condition_vue_vue_type_style_index_0_scoped_f43f10e6_lang="",Condition=_export_sfc(_sfc_main$7,[["__scopeId","data-v-f43f10e6"]]),_sfc_main$6=vue.defineComponent({__name:"bind-anchor",props:{modelValue:{},title:{}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=useGlobalStore(pinia),V=vue.computed({get(){return r.modelValue!==null},set(ie){let ae=null;ie&&(ae={target_id:"",type:""}),n("update:modelValue",ae)}}),k=vue.computed({get(){var ie;return((ie=r.modelValue)==null?void 0:ie.target_id)??void 0},set(ie){let ae=null;V.value&&(ae={target_id:ie,type:$.value}),n("update:modelValue",ae)}}),$=vue.computed({get(){var ie;return((ie=r.modelValue)==null?void 0:ie.type)??void 0},set(ie){let ae=null;V.value&&(ae={target_id:k.value,type:ie}),n("update:modelValue",ae)}}),oe=vue.computed(()=>g.done_json.filter(ie=>ie.type!==EDoneJsonType.ConnectionLine).map(ie=>({label:ie.title,value:ie.id}))),re=[{label:"上锚点",value:ELineBindAnchors.TopCenter},{label:"右锚点",value:ELineBindAnchors.Right},{label:"下锚点",value:ELineBindAnchors.BottomCenter},{label:"左锚点",value:ELineBindAnchors.Left}];function Ce(){vue.nextTick(function(){var ie,ae;if(V.value&&((ie=r.modelValue)!=null&&ie.target_id)&&((ae=r.modelValue)!=null&&ae.type)&&g.handle_svg_info){let le=null;for(let Ie of g.done_json)Ie.id===r.modelValue.target_id&&(le=Ie);le&&(setSvgActualInfo(le),moveAnchors(le))}})}return(ie,ae)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createVNode(vue.unref(ElFormItem),{label:r.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(V),"onUpdate:modelValue":ae[0]||(ae[0]=le=>vue.isRef(V)?V.value=le:null),onChange:Ce},null,8,["modelValue"])]),_:1},8,["label"]),vue.unref(V)?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"绑定对象",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(k),"onUpdate:modelValue":ae[1]||(ae[1]=le=>vue.isRef(k)?k.value=le:null),onChange:Ce},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(oe),le=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:le.value,label:le.label,value:le.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(V)?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:1,label:"绑定位置",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref($),"onUpdate:modelValue":ae[2]||(ae[2]=le=>vue.isRef($)?$.value=le:null),onChange:Ce},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(re,le=>vue.createVNode(vue.unref(ElOption),{key:le.value,label:le.label,value:le.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)],64))}}),_withScopeId=i=>(vue.pushScopeId("data-v-68351889"),i=i(),vue.popScopeId(),i),_hoisted_1$3=_withScopeId(()=>vue.createElementVNode("span",{style:{"font-weight":"bold"}},"MQTT",-1)),_hoisted_2$2={key:1},_hoisted_3$2={class:"events-title"},_sfc_main$5=vue.defineComponent({__name:"index",setup(i){const n=useConfigStore(pinia),r=useGlobalStore(pinia),g=useSvgEditLayoutStore(pinia),V=vue.ref("page"),k=vue.ref("style"),$=(ue,de)=>{ue!=null&&ue.common_animations&&(ue.common_animations.val=de)};n.$subscribe((ue,de)=>{ue.storeId==="config-store"&&localStorage.setItem("svg-editor-config",JSON.stringify(de))});const oe=vue.ref(numberArray(20)),re=vue.ref(["MQTT"]),Ce=vue.ref();Ce.value=()=>{var de,Ne;let ue={type:EEventType.Null,action:EEventAction.Null,target:"",scripts:"",condition:{type:EConditionType.None}};(Ne=(de=r.handle_svg_info)==null?void 0:de.info)==null||Ne.events.push(ue)};const ie=(ue,de)=>{ue==="ChangeAttr"?de.attrs=[{key:"",val:""}]:delete de.attrs},ae=ue=>{var de,Ne;(Ne=(de=r.handle_svg_info)==null?void 0:de.info)==null||Ne.events.splice(ue,1)},le=()=>{g.center_offset={x:0,y:0}},Ie=()=>{if(r.handle_svg_info){const ue=r.done_json[r.handle_svg_info.index];vue.nextTick(function(){setSvgActualInfo(ue),moveAnchors(ue)})}};return(ue,de)=>vue.unref(r).intention!=vue.unref(EGlobalStoreIntention).Select?(vue.openBlock(),vue.createBlock(vue.unref(ElTabs),{key:0,class:"mx-2 rightTabs",modelValue:vue.unref(V),"onUpdate:modelValue":de[13]||(de[13]=Ne=>vue.isRef(V)?V.value=Ne:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElTabPane),{label:"图纸",name:"page"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"背景色",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElColorPicker),{modelValue:vue.unref(n).svg.background_color,"onUpdate:modelValue":de[0]||(de[0]=Ne=>vue.unref(n).svg.background_color=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"画布",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElButton),{size:"small",onClick:le,icon:vue.unref(aim_default)},{default:vue.withCtx(()=>[vue.createTextVNode("重置位置")]),_:1},8,["icon"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"X轴偏移",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(g).center_offset.x,"onUpdate:modelValue":de[1]||(de[1]=Ne=>vue.unref(g).center_offset.x=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Y轴偏移",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(g).center_offset.y,"onUpdate:modelValue":de[2]||(de[2]=Ne=>vue.unref(g).center_offset.y=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(n).svg.scale,"onUpdate:modelValue":de[3]||(de[3]=Ne=>vue.unref(n).svg.scale=Ne),step:.1,"step-strictly":""},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"标尺",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(n).svg.ruler,"onUpdate:modelValue":de[4]||(de[4]=Ne=>vue.unref(n).svg.ruler=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"网格",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(n).svg.grid,"onUpdate:modelValue":de[5]||(de[5]=Ne=>vue.unref(n).svg.grid=Ne)},null,8,["modelValue"])]),_:1}),vue.unref(n).svg.grid?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"网格颜色",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElColorPicker),{modelValue:vue.unref(n).svg.grid_color,"onUpdate:modelValue":de[6]||(de[6]=Ne=>vue.unref(n).svg.grid_color=Ne)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)]),_:1})]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"连线",name:"line"},{default:vue.withCtx(()=>[vue.unref(n).connection_line.props?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:0,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(n).connection_line.props,hide:["point_position"]},null,8,["obj-info"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(n).connection_line.animations?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:1,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:vue.unref(n).connection_line.animations.type.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(n).connection_line.animations.type.val,"onUpdate:modelValue":de[7]||(de[7]=Ne=>vue.unref(n).connection_line.animations.type.val=Ne),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(n).connection_line.animations.type.options,Ne=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:Ne.value,label:Ne.label,value:Ne.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),vue.unref(n).connection_line.animations.type.val!=="None"?(vue.openBlock(),vue.createBlock(DynamicElFormItem,{key:0,"obj-info":vue.unref(n).connection_line.animations,hide:["type","repeatCount"]},null,8,["obj-info"])):vue.createCommentVNode("",!0)]),_:1})):vue.createCommentVNode("",!0)]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"通信",name:"net"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElCollapse),{modelValue:vue.unref(re),"onUpdate:modelValue":de[12]||(de[12]=Ne=>vue.isRef(re)?re.value=Ne:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElCollapseItem),{name:"MQTT"},{title:vue.withCtx(()=>[_hoisted_1$3]),default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"URL",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.url,"onUpdate:modelValue":de[8]||(de[8]=Ne=>vue.unref(n).net.mqtt.url=Ne),placeholder:"如 ws://127.0.0.1:4500"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"用户名",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.user,"onUpdate:modelValue":de[9]||(de[9]=Ne=>vue.unref(n).net.mqtt.user=Ne),placeholder:"username"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"密码",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.pwd,"onUpdate:modelValue":de[10]||(de[10]=Ne=>vue.unref(n).net.mqtt.pwd=Ne),placeholder:"password"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Topics",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.topics,"onUpdate:modelValue":de[11]||(de[11]=Ne=>vue.unref(n).net.mqtt.topics=Ne),placeholder:"topics"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"结构",name:"tree"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$9)]),_:1})]),_:1},8,["modelValue"])):vue.unref(r).intention==vue.unref(EGlobalStoreIntention).Select&&vue.unref(r).handle_svg_info?(vue.openBlock(),vue.createBlock(vue.unref(ElTabs),{key:1,class:"mx-2 rightTabs",modelValue:vue.unref(k),"onUpdate:modelValue":de[31]||(de[31]=Ne=>vue.isRef(k)?k.value=Ne:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElTabPane),{label:"外观",name:"style"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"标题",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(r).handle_svg_info.info.title,"onUpdate:modelValue":de[14]||(de[14]=Ne=>vue.unref(r).handle_svg_info.info.title=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"X坐标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.x,"onUpdate:modelValue":de[15]||(de[15]=Ne=>vue.unref(r).handle_svg_info.info.x=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Y坐标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.y,"onUpdate:modelValue":de[16]||(de[16]=Ne=>vue.unref(r).handle_svg_info.info.y=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"X缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.scale_x,"onUpdate:modelValue":de[17]||(de[17]=Ne=>vue.unref(r).handle_svg_info.info.scale_x=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Y缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.scale_y,"onUpdate:modelValue":de[18]||(de[18]=Ne=>vue.unref(r).handle_svg_info.info.scale_y=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"旋转",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.rotate,"onUpdate:modelValue":de[19]||(de[19]=Ne=>vue.unref(r).handle_svg_info.info.rotate=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"显示",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(r).handle_svg_info.info.display,"onUpdate:modelValue":de[20]||(de[20]=Ne=>vue.unref(r).handle_svg_info.info.display=Ne)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"数据",name:"data"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"90px","label-position":"left"},{default:vue.withCtx(()=>{var Ne,he,ze;return[vue.createVNode(vue.unref(ElFormItem),{label:"ID",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(r).handle_svg_info.info.id,"onUpdate:modelValue":de[21]||(de[21]=pe=>vue.unref(r).handle_svg_info.info.id=pe)},null,8,["modelValue"])]),_:1}),vue.unref(r).handle_svg_info.info.state?(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,{key:0},vue.renderList(vue.unref(r).handle_svg_info.info.state,(pe,Ve)=>{var Oe;return vue.openBlock(),vue.createElementBlock("div",{key:"state"+String(Ve)},[vue.createVNode(vue.unref(ElFormItem),{class:"props-row",label:String(Ve),size:"small"},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(pe==null?void 0:pe.default),1)]),_:2},1032,["label"]),Ve==="OnOff"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:(Oe=vue.unref(r).handle_svg_info.info.state)==null?void 0:Oe.OnOff.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(r).handle_svg_info.info.state.OnOff.default,"onUpdate:modelValue":de[22]||(de[22]=_e=>vue.unref(r).handle_svg_info.info.state.OnOff.default=_e)},null,8,["modelValue"])]),_:1},8,["label"])):vue.createCommentVNode("",!0)])}),128)):vue.createCommentVNode("",!0),(Ne=vue.unref(r).handle_svg_info.info)!=null&&Ne.hasOwnProperty("tag_slot")?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$2,[vue.createVNode(vue.unref(ElFormItem),{class:"props-row",label:"tag_slot",size:"small"},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(vue.unref(r).handle_svg_info.info.tag_slot),1)]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"文字插槽",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(r).handle_svg_info.info.tag_slot,"onUpdate:modelValue":de[23]||(de[23]=pe=>vue.unref(r).handle_svg_info.info.tag_slot=pe)},null,8,["modelValue"])]),_:1})])):vue.createCommentVNode("",!0),vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(r).handle_svg_info.info.props,code:""},null,8,["obj-info"]),((he=vue.unref(r).handle_svg_info)==null?void 0:he.info.type)===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$6,{key:2,modelValue:vue.unref(r).handle_svg_info.info.bind_anchors.start,"onUpdate:modelValue":de[24]||(de[24]=pe=>vue.unref(r).handle_svg_info.info.bind_anchors.start=pe),title:"绑定起点"},null,8,["modelValue"])):vue.createCommentVNode("",!0),((ze=vue.unref(r).handle_svg_info)==null?void 0:ze.info.type)===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$6,{key:3,modelValue:vue.unref(r).handle_svg_info.info.bind_anchors.end,"onUpdate:modelValue":de[25]||(de[25]=pe=>vue.unref(r).handle_svg_info.info.bind_anchors.end=pe),title:"绑定终点"},null,8,["modelValue"])):vue.createCommentVNode("",!0)]}),_:1})]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"事件",name:"event"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElButton),{type:"primary",style:{width:"100%"},onClick:vue.unref(Ce)},{default:vue.withCtx(()=>[vue.createTextVNode("添加事件")]),_:1},8,["onClick"]),vue.createVNode(vue.unref(ElCollapse),{modelValue:vue.unref(oe),"onUpdate:modelValue":de[26]||(de[26]=Ne=>vue.isRef(oe)?oe.value=Ne:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(r).handle_svg_info.info.events,(Ne,he)=>(vue.openBlock(),vue.createBlock(vue.unref(ElCollapseItem),{name:he,key:"event"+he},{title:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$2,[vue.createElementVNode("span",null,"事件"+vue.toDisplayString(he+1),1),vue.createVNode(vue.unref(ElIcon),{size:16,class:"bt-Icon",onClick:vue.withModifiers(ze=>ae(he),["stop"])},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"delete"})]),_:2},1032,["onClick"])])]),default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"90px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"类型",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:Ne.type,"onUpdate:modelValue":ze=>Ne.type=ze},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"Click",label:"点击"}),vue.createVNode(vue.unref(ElOption),{value:"Change",label:"值改变"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),vue.createVNode(vue.unref(ElFormItem),{label:"行为",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:Ne.action,"onUpdate:modelValue":ze=>Ne.action=ze,onChange:ze=>ie(ze,Ne)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"ChangeAttr",label:"改变属性"}),vue.createVNode(vue.unref(ElOption),{value:"JavaScript",label:"执行JavaScript"})]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1024),Ne.action==="ChangeAttr"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"目标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:Ne.target,"onUpdate:modelValue":ze=>Ne.target=ze,placeholder:"默认自身"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),Ne.action==="ChangeAttr"?(vue.openBlock(),vue.createBlock(List,{key:1,modelValue:Ne.attrs,"onUpdate:modelValue":ze=>Ne.attrs=ze},null,8,["modelValue","onUpdate:modelValue"])):vue.createCommentVNode("",!0),Ne.action==="JavaScript"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:2,label:"JavaScript",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$c,{modelValue:Ne.scripts,"onUpdate:modelValue":ze=>Ne.scripts=ze,lang:"javascript"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),vue.createVNode(Condition,{modelValue:Ne.condition,"onUpdate:modelValue":ze=>Ne.condition=ze},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"动效",name:"animation"},{default:vue.withCtx(()=>{var Ne;return[(Ne=vue.unref(r).handle_svg_info)!=null&&Ne.info.animations?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:0,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(r).handle_svg_info.info.animations},null,8,["obj-info"])]),_:1})):vue.unref(r).handle_svg_info.info.common_animations?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:1,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"动画效果",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(CommonAnimate,{onUpdateCommonAniVal:de[27]||(de[27]=he=>{var ze;return $((ze=vue.unref(r).handle_svg_info)==null?void 0:ze.info,he)}),val:vue.unref(r).handle_svg_info.info.common_animations.val},null,8,["val"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"延迟",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.common_animations.delay,"onUpdate:modelValue":de[28]||(de[28]=he=>vue.unref(r).handle_svg_info.info.common_animations.delay=he)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"delay-0s",label:"无"}),vue.createVNode(vue.unref(ElOption),{value:"delay-1s",label:"1秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-2s",label:"2秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-3s",label:"3秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-4s",label:"4秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-5s",label:"5秒"})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"动画速度",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.common_animations.speed,"onUpdate:modelValue":de[29]||(de[29]=he=>vue.unref(r).handle_svg_info.info.common_animations.speed=he)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"slow",label:"慢"}),vue.createVNode(vue.unref(ElOption),{value:"slower",label:"最慢"}),vue.createVNode(vue.unref(ElOption),{value:"fast",label:"快"}),vue.createVNode(vue.unref(ElOption),{value:"faster",label:"最快"})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"循环次数",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.common_animations.repeat,"onUpdate:modelValue":de[30]||(de[30]=he=>vue.unref(r).handle_svg_info.info.common_animations.repeat=he)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"repeat-1",label:"一次"}),vue.createVNode(vue.unref(ElOption),{value:"repeat-2",label:"两次"}),vue.createVNode(vue.unref(ElOption),{value:"repeat-3",label:"三次"}),vue.createVNode(vue.unref(ElOption),{value:"infinite",label:"无限次"})]),_:1},8,["modelValue"])]),_:1})]),_:1})):vue.createCommentVNode("",!0)]}),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"结构",name:"tree"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$9)]),_:1})]),_:1},8,["modelValue"])):vue.createCommentVNode("",!0)}}),index_vue_vue_type_style_index_0_scoped_68351889_lang="",index_vue_vue_type_style_index_1_lang="",RightPanel=_export_sfc(_sfc_main$5,[["__scopeId","data-v-68351889"]]),_sfc_main$4=vue.defineComponent({__name:"index",setup(i){const n=vue.ref(""),r=useGlobalStore(pinia),g=useSvgEditLayoutStore(pinia),V=useConfigStore(pinia);return vue.onMounted(()=>{const k={layout_center:g.center_offset,config:V.$state,done_json:r.done_json};n.value=JSON.stringify(k,null,2)}),(k,$)=>(vue.openBlock(),vue.createBlock(vue.unref(VAceEditor),{value:vue.unref(n),"onUpdate:value":$[0]||($[0]=oe=>vue.isRef(n)?n.value=oe:null),lang:"json",theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value"]))}}),_sfc_main$3=vue.defineComponent({__name:"index",setup(i,{expose:n}){const r=vue.ref("");return n({setVal:k=>{r.value=k},onImportJson:()=>{useImportDataModel(r.value)&&ElMessage.success("导入成功")}}),(k,$)=>(vue.openBlock(),vue.createBlock(vue.unref(VAceEditor),{value:vue.unref(r),"onUpdate:value":$[0]||($[0]=oe=>vue.isRef(r)?r.value=oe:null),lang:"json",theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value"]))}}),_hoisted_1$2=["onMousedown"],_hoisted_2$1=["onMousedown"],_hoisted_3$1=["title","onMousedown"],_hoisted_4$1={class:"vue-ruler-content-mask"},_sfc_main$2=vue.defineComponent({__name:"index",props:{visible:{type:Boolean,default:!0},stepLength:{default:100}},setup(i){const n=i,r=useSvgEditLayoutStore(pinia),g=useConfigStore(pinia),V=function(){return function(ci,Ai,yi){ci&&Ai&&yi&&ci.addEventListener(Ai,yi,!1)}}(),k=function(){return function(ci,Ai,yi){ci&&Ai&&ci.removeEventListener(Ai,yi,!1)}}();let $=18,oe=vue.ref(0),re=vue.ref(0),Ce=vue.ref([]),ie=vue.ref([]);const ae=vue.ref([]);let le=vue.ref(!1),Ie="",ue=vue.ref(-999),de=vue.ref(-999),Ne=18,he=18,ze="";const pe=vue.ref(null),Ve=vue.ref(null),Oe=vue.ref(null),_e=vue.ref(null),At=vue.computed(()=>({width:oe.value+"px",height:re.value+"px"})),$e=vue.computed(()=>({padding:$+"px 0px 0px "+$+"px"})),Fe=vue.computed(()=>{let ci=0,Ai=0;return ae.value.map(yi=>{const wi=yi.type==="h";return{id:`${yi.type}_${wi?ci++:Ai++}`,type:yi.type,title:yi.site.toFixed(0)+"px",[wi?"top":"left"]:yi.site*g.svg.scale+$+r.center_offset[wi?"y":"x"]*g.svg.scale}})});r.$subscribe(ci=>{var Ai,yi,wi,li;((yi=(Ai=ci.events)==null?void 0:Ai.target)!=null&&yi.hasOwnProperty("left_nav")||(li=(wi=ci.events)==null?void 0:wi.target)!=null&&li.hasOwnProperty("right_nav"))&&window.setTimeout(Ue,420)}),g.$subscribe(ci=>{var Ai,yi;(yi=(Ai=ci.events)==null?void 0:Ai.target)!=null&&yi.hasOwnProperty("scale")&&Et()}),vue.onMounted(()=>{V(document,"mousemove",ti),V(document,"mouseup",ni),Ue(),V(window,"resize",xe)}),vue.onBeforeUnmount(()=>{k(document,"mousemove",ti),k(document,"mouseup",ni),k(window,"resize",xe)});const Ue=()=>{kt(),Et()},xe=()=>{Ce.value=[],ie.value=[],Ue()},Dt=({type:ci,top:Ai,left:yi})=>ci==="h"?{top:Ai+"px"}:{left:yi+"px"},qe=({type:ci,id:Ai})=>ci==="h"?di(Ai):hi(Ai),kt=()=>{const ci=window.getComputedStyle(Ve.value.parentNode,null);oe.value=parseInt(ci.getPropertyValue("width")),re.value=parseInt(ci.getPropertyValue("height")),Ne=Oe.value.clientWidth,he=_e.value.clientHeight},Et=()=>{jt(Ce.value,oe.value,r.center_offset.x),jt(ie.value,re.value,r.center_offset.y)},jt=(ci,Ai,yi)=>{if(ci.length===0)for(let wi=0;wi<Ai;wi+=n.stepLength)wi%n.stepLength===0&&ci.push({id:Number((wi/g.svg.scale-yi).toFixed(0))});else ci.forEach((wi,li)=>{wi.id=Number((li*n.stepLength/g.svg.scale-yi).toFixed(0))})},ti=ci=>{Et(),Lt(ci)},Lt=ci=>{if(!(ci.layerX===ci.x||ci.layerY===ci.y))switch(Ie){case"x":le.value&&(de.value=ci.layerY);break;case"y":le.value&&(ue.value=ci.layerX);break;case"h":le.value&&(de.value=ci.layerY);break;case"v":le.value&&(ue.value=ci.layerX);break}},Pt=ci=>{le.value=!0,Ie=ci},ni=ci=>{ri(ci)},ri=ci=>{if(le.value){switch(le.value=!1,Ie){case"x":const Ai=Math.round((ci.layerY-$)/g.svg.scale-r.center_offset.y);if(Ai<=0){de.value=-999;return}ae.value.push({type:"h",site:Ai});break;case"y":const yi=Math.round((ci.layerX-$)/g.svg.scale-r.center_offset.x);if(yi<=0){ue.value=-999;return}ae.value.push({type:"v",site:yi});break;case"h":ui(ae.value,Math.round((ci.layerY-$)/g.svg.scale-r.center_offset.y),Math.round(he/g.svg.scale-r.center_offset.y),"h");break;case"v":ui(ae.value,Math.round((ci.layerX-$)/g.svg.scale-r.center_offset.x),Math.round(Ne/g.svg.scale-r.center_offset.x),"v");break}de.value=ue.value=-999}},ui=(ci,Ai,yi,wi)=>{if(Ai<yi){let li;Fe.value.forEach((fi,Mi)=>{fi.id===ze&&(li=Mi)}),ci.splice(li,1)}else{let li;Fe.value.forEach((fi,Mi)=>{fi.id===ze&&(li=Mi)}),ci.splice(li,1,{type:wi,site:Ai})}},Ci=()=>{Pt("x")},gi=()=>{Pt("y")},di=ci=>{le.value=!0,Ie="h",ze=ci},hi=ci=>{le.value=!0,Ie="v",ze=ci};return(ci,Ai)=>(vue.openBlock(),vue.createElementBlock("div",{style:vue.normalizeStyle(vue.unref(At)),class:"vue-ruler-wrapper",onselectStart:"return false;",ref_key:"el",ref:Ve},[vue.withDirectives(vue.createElementVNode("section",null,[vue.createElementVNode("div",{ref_key:"horizontalRuler",ref:_e,class:"vue-ruler-h",onMousedown:vue.withModifiers(Ci,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(Ce),(yi,wi)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({left:wi*ci.stepLength+"px"}),class:"n"},vue.toDisplayString(yi.id),5))),256))],40,_hoisted_1$2),vue.createElementVNode("div",{ref_key:"verticalRuler",ref:Oe,class:"vue-ruler-v",onMousedown:vue.withModifiers(gi,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(ie),(yi,wi)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({top:wi*ci.stepLength+"px"}),class:"n"},vue.toDisplayString(yi.id),5))),256))],40,_hoisted_2$1),vue.createElementVNode("div",{style:vue.normalizeStyle({top:vue.unref(de)+"px"}),class:"vue-ruler-ref-dot-h"},[vue.createElementVNode("span",null,vue.toDisplayString(Math.round((vue.unref(de)-vue.unref(he))/vue.unref(g).svg.scale)),1)],4),vue.createElementVNode("div",{style:vue.normalizeStyle({left:vue.unref(ue)+"px"}),class:"vue-ruler-ref-dot-v"},[vue.createElementVNode("span",null,vue.toDisplayString(Math.round((vue.unref(ue)-vue.unref(Ne))/vue.unref(g).svg.scale)),1)],4),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(Fe),yi=>(vue.openBlock(),vue.createElementBlock("div",{title:yi.title,style:vue.normalizeStyle(Dt(yi)),key:yi.id,class:vue.normalizeClass(`vue-ruler-ref-line-${yi.type}`),onMousedown:wi=>qe(yi)},null,46,_hoisted_3$1))),128))],512),[[vue.vShow,n.visible]]),vue.createElementVNode("div",{ref_key:"content",ref:pe,class:"vue-ruler-content",style:vue.normalizeStyle(vue.unref($e))},[vue.renderSlot(ci.$slots,"default")],4),vue.withDirectives(vue.createElementVNode("div",_hoisted_4$1,null,512),[[vue.vShow,vue.unref(le)]])],4))}}),index_vue_vue_type_style_index_0_lang="";function fileWrite(i,n=new Date(Date.now()).toLocaleString()){const r=JSON.stringify(i),g=new Blob([r]);let V=document.createElement("a");V.download=n+".json",V.style.display="none",V.href=URL.createObjectURL(g),document.body.appendChild(V),V.click(),document.body.removeChild(V)}function fileRead(i){return new Promise((n,r)=>{let g=new FileReader;g.readAsText(i,"UTF-8"),g.onload=function(V){V&&V.target?n(V.target.result):r("文件读取错误")}})}const _hoisted_1$1={class:"canvas-main-pc"},_sfc_main$1=vue.defineComponent({__name:"index",props:{customToolbar:{},data:{},saveFile:{type:Boolean,default:!1}},emits:["onReturn","onPreview","onSave"],setup(i,{expose:n,emit:r}){const g=i,V=useGlobalStore(pinia),k=useSvgEditLayoutStore(pinia),$=useConfigStore(pinia),oe=vue.ref(),re=vue.reactive({[EVisibleConfKey.ExportJson]:!1,[EVisibleConfKey.ImportJson]:!1,[EVisibleConfKey.ImportFile]:!1}),Ce=(de,Ne)=>{re[de]=Ne},ie=vue.ref();ie.value=()=>{oe.value.onImportJson(),Ce(EVisibleConfKey.ImportJson,!1)};const ae=de=>["text/plain","application/json"].indexOf(de.type)<0?(ElMessage.error("仅支持的格式:txt、json"),!1):(fileRead(de).then(Ne=>{oe.value.setVal(Ne),ElMessage.success("文件读取成功!")}),!1),le=de=>{V.setDoneJson(de)};vue.onMounted(()=>{g.data?useImportDataModel(g.data):V.setDoneJson([]),V.intention=EGlobalStoreIntention.None}),n({setGraphNodeJson:le});const{appContext:Ie}=vue.getCurrentInstance();function ue(de){g.saveFile?ElMessageBox.prompt("请输入文件名","保存",{cancelButtonText:"取消",confirmButtonText:"保存"},Ie).then(Ne=>{fileWrite(de,Ne.value.trim()),r("onSave",de)}).catch(Ne=>{console.log(Ne)}):r("onSave",de)}return(de,Ne)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(ElContainer),null,{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElHeader),{class:"top-el-header"},{default:vue.withCtx(()=>[vue.createVNode(TopPanel,{onChangeVisible:Ce,onOnReturn:Ne[0]||(Ne[0]=he=>r("onReturn")),onOnPreview:Ne[1]||(Ne[1]=he=>r("onPreview",he)),onOnSave:ue})]),_:1}),vue.createVNode(vue.unref(ElContainer),{class:"middle"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElAside),{class:vue.normalizeClass(["side-nav",vue.unref(k).left_nav?"show-nav":"hide-nav"]),style:{"border-right":"1px solid #efefef"}},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElScrollbar),{class:"el-scroll-pc"},{default:vue.withCtx(()=>[vue.createVNode(LeftPanel,{class:"content-left","custom-toolbar":g.customToolbar},null,8,["custom-toolbar"])]),_:1})]),_:1},8,["class"]),vue.createVNode(vue.unref(ElMain),{class:"middle main"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$1,[vue.createVNode(_sfc_main$2,{class:"canvas-main-pc",visible:vue.unref($).svg.ruler},{default:vue.withCtx(()=>[vue.createVNode(CenterPanel)]),_:1},8,["visible"])])]),_:1}),vue.createVNode(vue.unref(ElAside),{class:vue.normalizeClass(["side-nav",vue.unref(k).right_nav?"show-nav":"hide-nav"]),style:{"border-left":"1px solid #efefef"}},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElScrollbar),{class:"el-scroll-pc"},{default:vue.withCtx(()=>[vue.createVNode(RightPanel)]),_:1})]),_:1},8,["class"])]),_:1})]),_:1}),vue.createVNode(vue.unref(ElDialog),{class:"modal-full",modelValue:vue.unref(re).ImportJson,"onUpdate:modelValue":Ne[3]||(Ne[3]=he=>vue.unref(re).ImportJson=he),title:"导入数据",width:"60%","destroy-on-close":""},{footer:vue.withCtx(()=>[vue.createVNode(vue.unref(ElUpload),{beforeUpload:ae,style:{display:"inline-flex","margin-right":"12px"},multiple:!1,"show-file-list":!1,limit:1},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElButton),{onClick:Ne[2]||(Ne[2]=he=>Ce(vue.unref(EVisibleConfKey).ImportFile,!0))},{default:vue.withCtx(()=>[vue.createTextVNode("读取文件")]),_:1})]),_:1}),vue.createVNode(vue.unref(ElButton),{type:"primary",onClick:vue.unref(ie)},{default:vue.withCtx(()=>[vue.createTextVNode("导入数据")]),_:1},8,["onClick"])]),default:vue.withCtx(()=>[vue.createVNode(_sfc_main$3,{ref_key:"importJsonRef",ref:oe},null,512)]),_:1},8,["modelValue"]),vue.createVNode(vue.unref(ElDialog),{class:"modal-full",modelValue:vue.unref(re).ExportJson,"onUpdate:modelValue":Ne[4]||(Ne[4]=he=>vue.unref(re).ExportJson=he),title:"导出",width:"60%","destroy-on-close":""},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$4)]),_:1},8,["modelValue"])]))}}),index_vue_vue_type_style_index_0_scoped_5dff6b8d_lang="",index$1=_export_sfc(_sfc_main$1,[["__scopeId","data-v-5dff6b8d"]]);function commonjsRequire(i){throw new Error('Could not dynamically require "'+i+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var mqtt={exports:{}};(function(i,n){(function(r){i.exports=r()})(function(){return function(){function r(g,V,k){function $(Ce,ie){if(!V[Ce]){if(!g[Ce]){var ae=typeof commonjsRequire=="function"&&commonjsRequire;if(!ie&&ae)return ae(Ce,!0);if(oe)return oe(Ce,!0);var le=new Error("Cannot find module '"+Ce+"'");throw le.code="MODULE_NOT_FOUND",le}var Ie=V[Ce]={exports:{}};g[Ce][0].call(Ie.exports,function(ue){var de=g[Ce][1][ue];return $(de||ue)},Ie,Ie.exports,r,g,V,k)}return V[Ce].exports}for(var oe=typeof commonjsRequire=="function"&&commonjsRequire,re=0;re<k.length;re++)$(k[re]);return $}return r}()({1:[function(r,g,V){(function(k,$){(function(){const oe=r("events").EventEmitter,re=r("./store"),Ce=r("./topic-alias-recv"),ie=r("./topic-alias-send"),ae=r("mqtt-packet"),le=r("./default-message-id-provider"),Ie=r("readable-stream").Writable,ue=r("inherits"),de=r("reinterval"),Ne=r("rfdc/default"),he=r("./validations"),ze=r("xtend"),pe=r("debug")("mqttjs:client"),Ve=k?k.nextTick:function(Lt){setTimeout(Lt,0)},Oe=$.setImmediate||function(Lt){Ve(Lt)},_e={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0},At=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],$e={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function Fe(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function Ue(Lt,Pt){if(Lt.options.protocolVersion===5&&Pt.cmd==="publish"){let ni;Pt.properties&&(ni=Pt.properties.topicAlias);const ri=Pt.topic.toString();if(Lt.topicAliasSend)if(ni){if(ri.length!==0&&(pe("applyTopicAlias :: register topic: %s - alias: %d",ri,ni),!Lt.topicAliasSend.put(ri,ni)))return pe("applyTopicAlias :: error out of range. topic: %s - alias: %d",ri,ni),new Error("Sending Topic Alias out of range")}else ri.length!==0&&(Lt.options.autoAssignTopicAlias?(ni=Lt.topicAliasSend.getAliasByTopic(ri),ni?(Pt.topic="",Pt.properties={...Pt.properties,topicAlias:ni},pe("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",ri,ni)):(ni=Lt.topicAliasSend.getLruAlias(),Lt.topicAliasSend.put(ri,ni),Pt.properties={...Pt.properties,topicAlias:ni},pe("applyTopicAlias :: auto assign topic: %s - alias: %d",ri,ni))):Lt.options.autoUseTopicAlias&&(ni=Lt.topicAliasSend.getAliasByTopic(ri),ni&&(Pt.topic="",Pt.properties={...Pt.properties,topicAlias:ni},pe("applyTopicAlias :: auto use topic: %s - alias: %d",ri,ni))));else if(ni)return pe("applyTopicAlias :: error out of range. topic: %s - alias: %d",ri,ni),new Error("Sending Topic Alias out of range")}}function xe(Lt,Pt){let ni;Pt.properties&&(ni=Pt.properties.topicAlias);let ri=Pt.topic.toString();if(ri.length===0){if(typeof ni>"u")return new Error("Unregistered Topic Alias");if(ri=Lt.topicAliasSend.getTopicByAlias(ni),typeof ri>"u")return new Error("Unregistered Topic Alias");Pt.topic=ri}ni&&delete Pt.properties.topicAlias}function Dt(Lt,Pt,ni){pe("sendPacket :: packet: %O",Pt),pe("sendPacket :: emitting `packetsend`"),Lt.emit("packetsend",Pt),pe("sendPacket :: writing to stream");const ri=ae.writeToStream(Pt,Lt.stream,Lt.options);pe("sendPacket :: writeToStream result %s",ri),!ri&&ni&&ni!==jt?(pe("sendPacket :: handle events on `drain` once through callback."),Lt.stream.once("drain",ni)):ni&&(pe("sendPacket :: invoking cb"),ni())}function qe(Lt){Lt&&(pe("flush: queue exists? %b",!!Lt),Object.keys(Lt).forEach(function(Pt){typeof Lt[Pt].cb=="function"&&(Lt[Pt].cb(new Error("Connection closed")),delete Lt[Pt])}))}function kt(Lt){Lt&&(pe("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(Lt).forEach(function(Pt){Lt[Pt].volatile&&typeof Lt[Pt].cb=="function"&&(Lt[Pt].cb(new Error("Connection closed")),delete Lt[Pt])}))}function Et(Lt,Pt,ni,ri){pe("storeAndSend :: store packet with cmd %s to outgoingStore",Pt.cmd);let ui=Pt,Ci;if(ui.cmd==="publish"&&(ui=Ne(Pt),Ci=xe(Lt,ui),Ci))return ni&&ni(Ci);Lt.outgoingStore.put(ui,function(di){if(di)return ni&&ni(di);ri(),Dt(Lt,Pt,ni)})}function jt(Lt){pe("nop ::",Lt)}function ti(Lt,Pt){let ni;const ri=this;if(!(this instanceof ti))return new ti(Lt,Pt);this.options=Pt||{};for(ni in _e)typeof this.options[ni]>"u"?this.options[ni]=_e[ni]:this.options[ni]=Pt[ni];pe("MqttClient :: options.protocol",Pt.protocol),pe("MqttClient :: options.protocolVersion",Pt.protocolVersion),pe("MqttClient :: options.username",Pt.username),pe("MqttClient :: options.keepalive",Pt.keepalive),pe("MqttClient :: options.reconnectPeriod",Pt.reconnectPeriod),pe("MqttClient :: options.rejectUnauthorized",Pt.rejectUnauthorized),pe("MqttClient :: options.topicAliasMaximum",Pt.topicAliasMaximum),this.options.clientId=typeof Pt.clientId=="string"?Pt.clientId:Fe(),pe("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=Pt.protocolVersion===5&&Pt.customHandleAcks?Pt.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=Lt,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new le:this.options.messageIdProvider,this.outgoingStore=Pt.outgoingStore||new re,this.incomingStore=Pt.incomingStore||new re,this.queueQoSZero=Pt.queueQoSZero===void 0?!0:Pt.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,Pt.topicAliasMaximum>0&&(Pt.topicAliasMaximum>65535?pe("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new Ce(Pt.topicAliasMaximum)),this.on("connect",function(){const ui=this.queue;function Ci(){const gi=ui.shift();pe("deliver :: entry %o",gi);let di=null;if(!gi){ri._resubscribe();return}di=gi.packet,pe("deliver :: call _sendPacket for %o",di);let hi=!0;di.messageId&&di.messageId!==0&&(ri.messageIdProvider.register(di.messageId)||(hi=!1)),hi?ri._sendPacket(di,function(ci){gi.cb&&gi.cb(ci),Ci()}):(pe("messageId: %d has already used. The message is skipped and removed.",di.messageId),Ci())}pe("connect :: sending queued packets"),Ci()}),this.on("close",function(){pe("close :: connected set to `false`"),this.connected=!1,pe("close :: clearing connackTimer"),clearTimeout(this.connackTimer),pe("close :: clearing ping timer"),ri.pingTimer!==null&&(ri.pingTimer.clear(),ri.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),pe("close :: calling _setupReconnect"),this._setupReconnect()}),oe.call(this),pe("MqttClient :: setting up stream"),this._setupStream()}ue(ti,oe),ti.prototype._setupStream=function(){const Lt=this,Pt=new Ie,ni=ae.parser(this.options);let ri=null;const ui=[];pe("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),pe("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),ni.on("packet",function(ci){pe("parser :: on packet push to packets array."),ui.push(ci)});function Ci(){if(ui.length)Ve(gi);else{const ci=ri;ri=null,ci()}}function gi(){pe("work :: getting next packet in queue");const ci=ui.shift();if(ci)pe("work :: packet pulled from queue"),Lt._handlePacket(ci,Ci);else{pe("work :: no packets in queue");const Ai=ri;ri=null,pe("work :: done flag is %s",!!Ai),Ai&&Ai()}}Pt._write=function(ci,Ai,yi){ri=yi,pe("writable stream :: parsing buffer"),ni.parse(ci),gi()};function di(ci){pe("streamErrorHandler :: error",ci.message),At.includes(ci.code)?(pe("streamErrorHandler :: emitting error"),Lt.emit("error",ci)):jt(ci)}pe("_setupStream :: pipe stream to writable stream"),this.stream.pipe(Pt),this.stream.on("error",di),this.stream.on("close",function(){pe("(%s)stream :: on close",Lt.options.clientId),kt(Lt.outgoing),pe("stream: emit close to MqttClient"),Lt.emit("close")}),pe("_setupStream: sending packet `connect`");const hi=Object.create(this.options);if(hi.cmd="connect",this.topicAliasRecv&&(hi.properties||(hi.properties={}),this.topicAliasRecv&&(hi.properties.topicAliasMaximum=this.topicAliasRecv.max)),Dt(this,hi),ni.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return Lt.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"){const ci=ze({cmd:"auth",reasonCode:0},this.options.authPacket);Dt(this,ci)}}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){pe("!!connectTimeout hit!! Calling _cleanUp with force `true`"),Lt._cleanUp(!0)},this.options.connectTimeout)},ti.prototype._handlePacket=function(Lt,Pt){const ni=this.options;if(ni.protocolVersion===5&&ni.properties&&ni.properties.maximumPacketSize&&ni.properties.maximumPacketSize<Lt.length)return this.emit("error",new Error("exceeding packets size "+Lt.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(pe("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",Lt),Lt.cmd){case"publish":this._handlePublish(Lt,Pt);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(Lt),Pt();break;case"pubrel":this._handlePubrel(Lt,Pt);break;case"connack":this._handleConnack(Lt),Pt();break;case"auth":this._handleAuth(Lt),Pt();break;case"pingresp":this._handlePingresp(Lt),Pt();break;case"disconnect":this._handleDisconnect(Lt),Pt();break}},ti.prototype._checkDisconnecting=function(Lt){return this.disconnecting&&(Lt&&Lt!==jt?Lt(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},ti.prototype.publish=function(Lt,Pt,ni,ri){pe("publish :: message `%s` to topic `%s`",Pt,Lt);const ui=this.options;if(typeof ni=="function"&&(ri=ni,ni=null),ni=ze({qos:0,retain:!1,dup:!1},ni),this._checkDisconnecting(ri))return this;const gi=this,di=function(){let hi=0;if((ni.qos===1||ni.qos===2)&&(hi=gi._nextId(),hi===null))return pe("No messageId left"),!1;const ci={cmd:"publish",topic:Lt,payload:Pt,qos:ni.qos,retain:ni.retain,messageId:hi,dup:ni.dup};switch(ui.protocolVersion===5&&(ci.properties=ni.properties),pe("publish :: qos",ni.qos),ni.qos){case 1:case 2:gi.outgoing[ci.messageId]={volatile:!1,cb:ri||jt},pe("MqttClient:publish: packet cmd: %s",ci.cmd),gi._sendPacket(ci,void 0,ni.cbStorePut);break;default:pe("MqttClient:publish: packet cmd: %s",ci.cmd),gi._sendPacket(ci,ri,ni.cbStorePut);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!di())&&this._storeProcessingQueue.push({invoke:di,cbStorePut:ni.cbStorePut,callback:ri}),this},ti.prototype.subscribe=function(){const Lt=this,Pt=new Array(arguments.length);for(let yi=0;yi<arguments.length;yi++)Pt[yi]=arguments[yi];const ni=[];let ri=Pt.shift();const ui=ri.resubscribe;let Ci=Pt.pop()||jt,gi=Pt.pop();const di=this.options.protocolVersion;delete ri.resubscribe,typeof ri=="string"&&(ri=[ri]),typeof Ci!="function"&&(gi=Ci,Ci=jt);const hi=he.validateTopics(ri);if(hi!==null)return Oe(Ci,new Error("Invalid topic "+hi)),this;if(this._checkDisconnecting(Ci))return pe("subscribe: discconecting true"),this;const ci={qos:0};if(di===5&&(ci.nl=!1,ci.rap=!1,ci.rh=0),gi=ze(ci,gi),Array.isArray(ri)?ri.forEach(function(yi){if(pe("subscribe: array topic %s",yi),!Object.prototype.hasOwnProperty.call(Lt._resubscribeTopics,yi)||Lt._resubscribeTopics[yi].qos<gi.qos||ui){const wi={topic:yi,qos:gi.qos};di===5&&(wi.nl=gi.nl,wi.rap=gi.rap,wi.rh=gi.rh,wi.properties=gi.properties),pe("subscribe: pushing topic `%s` and qos `%s` to subs list",wi.topic,wi.qos),ni.push(wi)}}):Object.keys(ri).forEach(function(yi){if(pe("subscribe: object topic %s",yi),!Object.prototype.hasOwnProperty.call(Lt._resubscribeTopics,yi)||Lt._resubscribeTopics[yi].qos<ri[yi].qos||ui){const wi={topic:yi,qos:ri[yi].qos};di===5&&(wi.nl=ri[yi].nl,wi.rap=ri[yi].rap,wi.rh=ri[yi].rh,wi.properties=gi.properties),pe("subscribe: pushing `%s` to subs list",wi),ni.push(wi)}}),!ni.length)return Ci(null,[]),this;const Ai=function(){const yi=Lt._nextId();if(yi===null)return pe("No messageId left"),!1;const wi={cmd:"subscribe",subscriptions:ni,qos:1,retain:!1,dup:!1,messageId:yi};if(gi.properties&&(wi.properties=gi.properties),Lt.options.resubscribe){pe("subscribe :: resubscribe true");const li=[];ni.forEach(function(fi){if(Lt.options.reconnectPeriod>0){const Mi={qos:fi.qos};di===5&&(Mi.nl=fi.nl||!1,Mi.rap=fi.rap||!1,Mi.rh=fi.rh||0,Mi.properties=fi.properties),Lt._resubscribeTopics[fi.topic]=Mi,li.push(fi.topic)}}),Lt.messageIdToTopic[wi.messageId]=li}return Lt.outgoing[wi.messageId]={volatile:!0,cb:function(li,fi){if(!li){const Mi=fi.granted;for(let Ni=0;Ni<Mi.length;Ni+=1)ni[Ni].qos=Mi[Ni]}Ci(li,ni)}},pe("subscribe :: call _sendPacket"),Lt._sendPacket(wi),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!Ai())&&this._storeProcessingQueue.push({invoke:Ai,callback:Ci}),this},ti.prototype.unsubscribe=function(){const Lt=this,Pt=new Array(arguments.length);for(let di=0;di<arguments.length;di++)Pt[di]=arguments[di];let ni=Pt.shift(),ri=Pt.pop()||jt,ui=Pt.pop();typeof ni=="string"&&(ni=[ni]),typeof ri!="function"&&(ui=ri,ri=jt);const Ci=he.validateTopics(ni);if(Ci!==null)return Oe(ri,new Error("Invalid topic "+Ci)),this;if(Lt._checkDisconnecting(ri))return this;const gi=function(){const di=Lt._nextId();if(di===null)return pe("No messageId left"),!1;const hi={cmd:"unsubscribe",qos:1,messageId:di};return typeof ni=="string"?hi.unsubscriptions=[ni]:Array.isArray(ni)&&(hi.unsubscriptions=ni),Lt.options.resubscribe&&hi.unsubscriptions.forEach(function(ci){delete Lt._resubscribeTopics[ci]}),typeof ui=="object"&&ui.properties&&(hi.properties=ui.properties),Lt.outgoing[hi.messageId]={volatile:!0,cb:ri},pe("unsubscribe: call _sendPacket"),Lt._sendPacket(hi),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!gi())&&this._storeProcessingQueue.push({invoke:gi,callback:ri}),this},ti.prototype.end=function(Lt,Pt,ni){const ri=this;pe("end :: (%s)",this.options.clientId),(Lt==null||typeof Lt!="boolean")&&(ni=Pt||jt,Pt=Lt,Lt=!1,typeof Pt!="object"&&(ni=Pt,Pt=null,typeof ni!="function"&&(ni=jt))),typeof Pt!="object"&&(ni=Pt,Pt=null),pe("end :: cb? %s",!!ni),ni=ni||jt;function ui(){pe("end :: closeStores: closing incoming and outgoing stores"),ri.disconnected=!0,ri.incomingStore.close(function(gi){ri.outgoingStore.close(function(di){if(pe("end :: closeStores: emitting end"),ri.emit("end"),ni){const hi=gi||di;pe("end :: closeStores: invoking callback with args"),ni(hi)}})}),ri._deferredReconnect&&ri._deferredReconnect()}function Ci(){pe("end :: (%s) :: finish :: calling _cleanUp with force %s",ri.options.clientId,Lt),ri._cleanUp(Lt,()=>{pe("end :: finish :: calling process.nextTick on closeStores"),Ve(ui.bind(ri))},Pt)}return this.disconnecting?(ni(),this):(this._clearReconnect(),this.disconnecting=!0,!Lt&&Object.keys(this.outgoing).length>0?(pe("end :: (%s) :: calling finish in 10ms once outgoing is empty",ri.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,Ci,10))):(pe("end :: (%s) :: immediately calling finish",ri.options.clientId),Ci()),this)},ti.prototype.removeOutgoingMessage=function(Lt){const Pt=this.outgoing[Lt]?this.outgoing[Lt].cb:null;return delete this.outgoing[Lt],this.outgoingStore.del({messageId:Lt},function(){Pt(new Error("Message removed"))}),this},ti.prototype.reconnect=function(Lt){pe("client reconnect");const Pt=this,ni=function(){Lt?(Pt.options.incomingStore=Lt.incomingStore,Pt.options.outgoingStore=Lt.outgoingStore):(Pt.options.incomingStore=null,Pt.options.outgoingStore=null),Pt.incomingStore=Pt.options.incomingStore||new re,Pt.outgoingStore=Pt.options.outgoingStore||new re,Pt.disconnecting=!1,Pt.disconnected=!1,Pt._deferredReconnect=null,Pt._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=ni:ni(),this},ti.prototype._reconnect=function(){pe("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),pe("client already connected. disconnecting first.")):(pe("_reconnect: calling _setupStream"),this._setupStream())},ti.prototype._setupReconnect=function(){const Lt=this;!Lt.disconnecting&&!Lt.reconnectTimer&&Lt.options.reconnectPeriod>0?(this.reconnecting||(pe("_setupReconnect :: emit `offline` state"),this.emit("offline"),pe("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),pe("_setupReconnect :: setting reconnectTimer for %d ms",Lt.options.reconnectPeriod),Lt.reconnectTimer=setInterval(function(){pe("reconnectTimer :: reconnect triggered!"),Lt._reconnect()},Lt.options.reconnectPeriod)):pe("_setupReconnect :: doing nothing...")},ti.prototype._clearReconnect=function(){pe("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},ti.prototype._cleanUp=function(Lt,Pt){const ni=arguments[2];if(Pt&&(pe("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",Pt)),pe("_cleanUp :: forced? %s",Lt),Lt)this.options.reconnectPeriod===0&&this.options.clean&&qe(this.outgoing),pe("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const ri=ze({cmd:"disconnect"},ni);pe("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(ri,Oe.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(pe("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(pe("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),Pt&&!this.connected&&(pe("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",Pt),Pt())},ti.prototype._sendPacket=function(Lt,Pt,ni){pe("_sendPacket :: (%s) :: start",this.options.clientId),ni=ni||jt,Pt=Pt||jt;const ri=Ue(this,Lt);if(ri){Pt(ri);return}if(!this.connected){if(Lt.cmd==="auth"){this._shiftPingInterval(),Dt(this,Lt,Pt);return}pe("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(Lt,Pt,ni);return}switch(this._shiftPingInterval(),Lt.cmd){case"publish":break;case"pubrel":Et(this,Lt,Pt,ni);return;default:Dt(this,Lt,Pt);return}switch(Lt.qos){case 2:case 1:Et(this,Lt,Pt,ni);break;case 0:default:Dt(this,Lt,Pt);break}pe("_sendPacket :: (%s) :: end",this.options.clientId)},ti.prototype._storePacket=function(Lt,Pt,ni){pe("_storePacket :: packet: %o",Lt),pe("_storePacket :: cb? %s",!!Pt),ni=ni||jt;let ri=Lt;if(ri.cmd==="publish"){ri=Ne(Lt);const ui=xe(this,ri);if(ui)return Pt&&Pt(ui)}(ri.qos||0)===0&&this.queueQoSZero||ri.cmd!=="publish"?this.queue.push({packet:ri,cb:Pt}):ri.qos>0?(Pt=this.outgoing[ri.messageId]?this.outgoing[ri.messageId].cb:null,this.outgoingStore.put(ri,function(ui){if(ui)return Pt&&Pt(ui);ni()})):Pt&&Pt(new Error("No connection to broker"))},ti.prototype._setupPingTimer=function(){pe("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const Lt=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=de(function(){Lt._checkPing()},this.options.keepalive*1e3))},ti.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(this.options.keepalive*1e3)},ti.prototype._checkPing=function(){pe("_checkPing :: checking ping..."),this.pingResp?(pe("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(pe("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},ti.prototype._handlePingresp=function(){this.pingResp=!0},ti.prototype._handleConnack=function(Lt){pe("_handleConnack");const Pt=this.options,ri=Pt.protocolVersion===5?Lt.reasonCode:Lt.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,Lt.properties){if(Lt.properties.topicAliasMaximum){if(Lt.properties.topicAliasMaximum>65535){this.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}Lt.properties.topicAliasMaximum>0&&(this.topicAliasSend=new ie(Lt.properties.topicAliasMaximum))}Lt.properties.serverKeepAlive&&Pt.keepalive&&(Pt.keepalive=Lt.properties.serverKeepAlive,this._shiftPingInterval()),Lt.properties.maximumPacketSize&&(Pt.properties||(Pt.properties={}),Pt.properties.maximumPacketSize=Lt.properties.maximumPacketSize)}if(ri===0)this.reconnecting=!1,this._onConnect(Lt);else if(ri>0){const ui=new Error("Connection refused: "+$e[ri]);ui.code=ri,this.emit("error",ui)}},ti.prototype._handleAuth=function(Lt){const ni=this.options.protocolVersion,ri=ni===5?Lt.reasonCode:Lt.returnCode;if(ni!==5){const Ci=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+ni);Ci.code=ri,this.emit("error",Ci);return}const ui=this;this.handleAuth(Lt,function(Ci,gi){if(Ci){ui.emit("error",Ci);return}if(ri===24)ui.reconnecting=!1,ui._sendPacket(gi);else{const di=new Error("Connection refused: "+$e[ri]);Ci.code=ri,ui.emit("error",di)}})},ti.prototype.handleAuth=function(Lt,Pt){Pt()},ti.prototype._handlePublish=function(Lt,Pt){pe("_handlePublish: packet %o",Lt),Pt=typeof Pt<"u"?Pt:jt;let ni=Lt.topic.toString();const ri=Lt.payload,ui=Lt.qos,Ci=Lt.messageId,gi=this,di=this.options,hi=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let ci;if(Lt.properties&&(ci=Lt.properties.topicAlias),typeof ci<"u")if(ni.length===0)if(ci>0&&ci<=65535){const Ai=this.topicAliasRecv.getTopicByAlias(ci);if(Ai)ni=Ai,pe("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",ni,ci);else{pe("_handlePublish :: unregistered topic alias. alias: %d",ci),this.emit("error",new Error("Received unregistered Topic Alias"));return}}else{pe("_handlePublish :: topic alias out of range. alias: %d",ci),this.emit("error",new Error("Received Topic Alias is out of range"));return}else if(this.topicAliasRecv.put(ni,ci))pe("_handlePublish :: registered topic: %s - alias: %d",ni,ci);else{pe("_handlePublish :: topic alias out of range. alias: %d",ci),this.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(pe("_handlePublish: qos %d",ui),ui){case 2:{di.customHandleAcks(ni,ri,Lt,function(ci,Ai){if(ci instanceof Error||(Ai=ci,ci=null),ci)return gi.emit("error",ci);if(hi.indexOf(Ai)===-1)return gi.emit("error",new Error("Wrong reason code for pubrec"));Ai?gi._sendPacket({cmd:"pubrec",messageId:Ci,reasonCode:Ai},Pt):gi.incomingStore.put(Lt,function(){gi._sendPacket({cmd:"pubrec",messageId:Ci},Pt)})});break}case 1:{di.customHandleAcks(ni,ri,Lt,function(ci,Ai){if(ci instanceof Error||(Ai=ci,ci=null),ci)return gi.emit("error",ci);if(hi.indexOf(Ai)===-1)return gi.emit("error",new Error("Wrong reason code for puback"));Ai||gi.emit("message",ni,ri,Lt),gi.handleMessage(Lt,function(yi){if(yi)return Pt&&Pt(yi);gi._sendPacket({cmd:"puback",messageId:Ci,reasonCode:Ai},Pt)})});break}case 0:this.emit("message",ni,ri,Lt),this.handleMessage(Lt,Pt);break;default:pe("_handlePublish: unknown QoS. Doing nothing.");break}},ti.prototype.handleMessage=function(Lt,Pt){Pt()},ti.prototype._handleAck=function(Lt){const Pt=Lt.messageId,ni=Lt.cmd;let ri=null;const ui=this.outgoing[Pt]?this.outgoing[Pt].cb:null,Ci=this;let gi;if(!ui){pe("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(pe("_handleAck :: packet type",ni),ni){case"pubcomp":case"puback":{const di=Lt.reasonCode;di&&di>0&&di!==16&&(gi=new Error("Publish error: "+$e[di]),gi.code=di,ui(gi,Lt)),delete this.outgoing[Pt],this.outgoingStore.del(Lt,ui),this.messageIdProvider.deallocate(Pt),this._invokeStoreProcessingQueue();break}case"pubrec":{ri={cmd:"pubrel",qos:2,messageId:Pt};const di=Lt.reasonCode;di&&di>0&&di!==16?(gi=new Error("Publish error: "+$e[di]),gi.code=di,ui(gi,Lt)):this._sendPacket(ri);break}case"suback":{delete this.outgoing[Pt],this.messageIdProvider.deallocate(Pt);for(let di=0;di<Lt.granted.length;di++)if(Lt.granted[di]&128){const hi=this.messageIdToTopic[Pt];hi&&hi.forEach(function(ci){delete Ci._resubscribeTopics[ci]})}this._invokeStoreProcessingQueue(),ui(null,Lt);break}case"unsuback":{delete this.outgoing[Pt],this.messageIdProvider.deallocate(Pt),this._invokeStoreProcessingQueue(),ui(null);break}default:Ci.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")},ti.prototype._handlePubrel=function(Lt,Pt){pe("handling pubrel packet"),Pt=typeof Pt<"u"?Pt:jt;const ni=Lt.messageId,ri=this,ui={cmd:"pubcomp",messageId:ni};ri.incomingStore.get(Lt,function(Ci,gi){Ci?ri._sendPacket(ui,Pt):(ri.emit("message",gi.topic,gi.payload,gi),ri.handleMessage(gi,function(di){if(di)return Pt(di);ri.incomingStore.del(gi,jt),ri._sendPacket(ui,Pt)}))})},ti.prototype._handleDisconnect=function(Lt){this.emit("disconnect",Lt)},ti.prototype._nextId=function(){return this.messageIdProvider.allocate()},ti.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},ti.prototype._resubscribe=function(){pe("_resubscribe");const Lt=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion===5&&!this.connackPacket.sessionPresent)&&Lt.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){pe("_resubscribe: protocolVersion 5");for(let Pt=0;Pt<Lt.length;Pt++){const ni={};ni[Lt[Pt]]=this._resubscribeTopics[Lt[Pt]],ni.resubscribe=!0,this.subscribe(ni,{properties:ni[Lt[Pt]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},ti.prototype._onConnect=function(Lt){if(this.disconnected){this.emit("connect",Lt);return}const Pt=this;this.connackPacket=Lt,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0;function ni(){let ri=Pt.outgoingStore.createStream();function ui(){Pt._storeProcessing=!1,Pt._packetIdsDuringStoreProcessing={}}Pt.once("close",Ci),ri.on("error",function(di){ui(),Pt._flushStoreProcessingQueue(),Pt.removeListener("close",Ci),Pt.emit("error",di)});function Ci(){ri.destroy(),ri=null,Pt._flushStoreProcessingQueue(),ui()}function gi(){if(!ri)return;Pt._storeProcessing=!0;const di=ri.read(1);let hi;if(!di){ri.once("readable",gi);return}if(Pt._packetIdsDuringStoreProcessing[di.messageId]){gi();return}!Pt.disconnecting&&!Pt.reconnectTimer?(hi=Pt.outgoing[di.messageId]?Pt.outgoing[di.messageId].cb:null,Pt.outgoing[di.messageId]={volatile:!1,cb:function(ci,Ai){hi&&hi(ci,Ai),gi()}},Pt._packetIdsDuringStoreProcessing[di.messageId]=!0,Pt.messageIdProvider.register(di.messageId)?Pt._sendPacket(di):pe("messageId: %d has already used.",di.messageId)):ri.destroy&&ri.destroy()}ri.on("end",function(){let di=!0;for(const hi in Pt._packetIdsDuringStoreProcessing)if(!Pt._packetIdsDuringStoreProcessing[hi]){di=!1;break}di?(ui(),Pt.removeListener("close",Ci),Pt._invokeAllStoreProcessingQueue(),Pt.emit("connect",Lt)):ni()}),gi()}ni()},ti.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const Lt=this._storeProcessingQueue[0];if(Lt&&Lt.invoke())return this._storeProcessingQueue.shift(),!0}return!1},ti.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},ti.prototype._flushStoreProcessingQueue=function(){for(const Lt of this._storeProcessingQueue)Lt.cbStorePut&&Lt.cbStorePut(new Error("Connection closed")),Lt.callback&&Lt.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},g.exports=ti}).call(this)}).call(this,r("_process"),typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{"./default-message-id-provider":7,"./store":8,"./topic-alias-recv":9,"./topic-alias-send":10,"./validations":11,_process:50,debug:18,events:22,inherits:24,"mqtt-packet":40,"readable-stream":69,reinterval:70,"rfdc/default":71,xtend:81}],2:[function(r,g,V){const{Buffer:k}=r("buffer"),$=r("readable-stream").Transform,oe=r("duplexify");let re,Ce,ie,ae=!1;function le(){const he=new $;return he._write=function(ze,pe,Ve){re.sendSocketMessage({data:ze.buffer,success:function(){Ve()},fail:function(){Ve(new Error)}})},he._flush=function(pe){re.closeSocket({success:function(){pe()}})},he}function Ie(he){he.hostname||(he.hostname="localhost"),he.path||(he.path="/"),he.wsOptions||(he.wsOptions={})}function ue(he,ze){const pe=he.protocol==="alis"?"wss":"ws";let Ve=pe+"://"+he.hostname+he.path;return he.port&&he.port!==80&&he.port!==443&&(Ve=pe+"://"+he.hostname+":"+he.port+he.path),typeof he.transformWsUrl=="function"&&(Ve=he.transformWsUrl(Ve,he,ze)),Ve}function de(){ae||(ae=!0,re.onSocketOpen(function(){ie.setReadable(Ce),ie.setWritable(Ce),ie.emit("connect")}),re.onSocketMessage(function(he){if(typeof he.data=="string"){const ze=k.from(he.data,"base64");Ce.push(ze)}else{const ze=new FileReader;ze.addEventListener("load",function(){let pe=ze.result;pe instanceof ArrayBuffer?pe=k.from(pe):pe=k.from(pe,"utf8"),Ce.push(pe)}),ze.readAsArrayBuffer(he.data)}}),re.onSocketClose(function(){ie.end(),ie.destroy()}),re.onSocketError(function(he){ie.destroy(he)}))}function Ne(he,ze){if(ze.hostname=ze.hostname||ze.host,!ze.hostname)throw new Error("Could not determine host. Specify host manually.");const pe=ze.protocolId==="MQIsdp"&&ze.protocolVersion===3?"mqttv3.1":"mqtt";Ie(ze);const Ve=ue(ze,he);return re=ze.my,re.connectSocket({url:Ve,protocols:pe}),Ce=le(),ie=oe.obj(),de(),ie}g.exports=Ne},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(r,g,V){const k=r("net"),$=r("debug")("mqttjs:tcp");function oe(re,Ce){Ce.port=Ce.port||1883,Ce.hostname=Ce.hostname||Ce.host||"localhost";const ie=Ce.port,ae=Ce.hostname;return $("port %d and host %s",ie,ae),k.createConnection(ie,ae)}g.exports=oe},{debug:18,net:16}],4:[function(r,g,V){const k=r("tls"),$=r("net"),oe=r("debug")("mqttjs:tls");function re(Ce,ie){ie.port=ie.port||8883,ie.host=ie.hostname||ie.host||"localhost",$.isIP(ie.host)===0&&(ie.servername=ie.host),ie.rejectUnauthorized=ie.rejectUnauthorized!==!1,delete ie.path,oe("port %d host %s rejectUnauthorized %b",ie.port,ie.host,ie.rejectUnauthorized);const ae=k.connect(ie);ae.on("secureConnect",function(){ie.rejectUnauthorized&&!ae.authorized?ae.emit("error",new Error("TLS not authorized")):ae.removeListener("error",le)});function le(Ie){ie.rejectUnauthorized&&Ce.emit("error",Ie),ae.end()}return ae.on("error",le),ae}g.exports=re},{debug:18,net:16,tls:16}],5:[function(r,g,V){(function(k){(function(){const{Buffer:$}=r("buffer"),oe=r("ws"),re=r("debug")("mqttjs:ws"),Ce=r("duplexify"),ie=r("readable-stream").Transform,ae=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],le=typeof k<"u"&&k.title==="browser"||typeof __webpack_require__=="function";function Ie(Ve,Oe){let _e=Ve.protocol+"://"+Ve.hostname+":"+Ve.port+Ve.path;return typeof Ve.transformWsUrl=="function"&&(_e=Ve.transformWsUrl(_e,Ve,Oe)),_e}function ue(Ve){const Oe=Ve;return Ve.hostname||(Oe.hostname="localhost"),Ve.port||(Ve.protocol==="wss"?Oe.port=443:Oe.port=80),Ve.path||(Oe.path="/"),Ve.wsOptions||(Oe.wsOptions={}),!le&&Ve.protocol==="wss"&&ae.forEach(function(_e){Object.prototype.hasOwnProperty.call(Ve,_e)&&!Object.prototype.hasOwnProperty.call(Ve.wsOptions,_e)&&(Oe.wsOptions[_e]=Ve[_e])}),Oe}function de(Ve){const Oe=ue(Ve);if(Oe.hostname||(Oe.hostname=Oe.host),!Oe.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");const _e=new URL(document.URL);Oe.hostname=_e.hostname,Oe.port||(Oe.port=_e.port)}return Oe.objectMode===void 0&&(Oe.objectMode=!(Oe.binary===!0||Oe.binary===void 0)),Oe}function Ne(Ve,Oe,_e){re("createWebSocket"),re("protocol: "+_e.protocolId+" "+_e.protocolVersion);const At=_e.protocolId==="MQIsdp"&&_e.protocolVersion===3?"mqttv3.1":"mqtt";return re("creating new Websocket for url: "+Oe+" and protocol: "+At),new oe(Oe,[At],_e.wsOptions)}function he(Ve,Oe){const _e=Oe.protocolId==="MQIsdp"&&Oe.protocolVersion===3?"mqttv3.1":"mqtt",At=Ie(Oe,Ve),$e=new WebSocket(At,[_e]);return $e.binaryType="arraybuffer",$e}function ze(Ve,Oe){re("streamBuilder");const _e=ue(Oe),At=Ie(_e,Ve),$e=Ne(Ve,At,_e),Fe=oe.createWebSocketStream($e,_e.wsOptions);return Fe.url=At,$e.on("close",()=>{Fe.destroy()}),Fe}function pe(Ve,Oe){re("browserStreamBuilder");let _e;const $e=de(Oe).browserBufferSize||1024*512,Fe=Oe.browserBufferTimeout||1e3,Ue=!Oe.objectMode,xe=he(Ve,Oe),Dt=kt(Oe,ni,ri);Oe.objectMode||(Dt._writev=Pt),Dt.on("close",()=>{xe.close()});const qe=typeof xe.addEventListener<"u";xe.readyState===xe.OPEN?_e=Dt:(_e=_e=Ce(void 0,void 0,Oe),Oe.objectMode||(_e._writev=Pt),qe?xe.addEventListener("open",Et):xe.onopen=Et),_e.socket=xe,qe?(xe.addEventListener("close",jt),xe.addEventListener("error",ti),xe.addEventListener("message",Lt)):(xe.onclose=jt,xe.onerror=ti,xe.onmessage=Lt);function kt(ui,Ci,gi){const di=new ie({objectModeMode:ui.objectMode});return di._write=Ci,di._flush=gi,di}function Et(){_e.setReadable(Dt),_e.setWritable(Dt),_e.emit("connect")}function jt(){_e.end(),_e.destroy()}function ti(ui){_e.destroy(ui)}function Lt(ui){let Ci=ui.data;Ci instanceof ArrayBuffer?Ci=$.from(Ci):Ci=$.from(Ci,"utf8"),Dt.push(Ci)}function Pt(ui,Ci){const gi=new Array(ui.length);for(let di=0;di<ui.length;di++)typeof ui[di].chunk=="string"?gi[di]=$.from(ui[di],"utf8"):gi[di]=ui[di].chunk;this._write($.concat(gi),"binary",Ci)}function ni(ui,Ci,gi){xe.bufferedAmount>$e&&setTimeout(ni,Fe,ui,Ci,gi),Ue&&typeof ui=="string"&&(ui=$.from(ui,"utf8"));try{xe.send(ui)}catch(di){return gi(di)}gi()}function ri(ui){xe.close(),ui()}return _e}le?g.exports=pe:g.exports=ze}).call(this)}).call(this,r("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(r,g,V){const{Buffer:k}=r("buffer"),$=r("readable-stream").Transform,oe=r("duplexify");let re,Ce,ie;function ae(){const Ne=new $;return Ne._write=function(he,ze,pe){re.send({data:he.buffer,success:function(){pe()},fail:function(Ve){pe(new Error(Ve))}})},Ne._flush=function(ze){re.close({success:function(){ze()}})},Ne}function le(Ne){Ne.hostname||(Ne.hostname="localhost"),Ne.path||(Ne.path="/"),Ne.wsOptions||(Ne.wsOptions={})}function Ie(Ne,he){const ze=Ne.protocol==="wxs"?"wss":"ws";let pe=ze+"://"+Ne.hostname+Ne.path;return Ne.port&&Ne.port!==80&&Ne.port!==443&&(pe=ze+"://"+Ne.hostname+":"+Ne.port+Ne.path),typeof Ne.transformWsUrl=="function"&&(pe=Ne.transformWsUrl(pe,Ne,he)),pe}function ue(){re.onOpen(function(){ie.setReadable(Ce),ie.setWritable(Ce),ie.emit("connect")}),re.onMessage(function(Ne){let he=Ne.data;he instanceof ArrayBuffer?he=k.from(he):he=k.from(he,"utf8"),Ce.push(he)}),re.onClose(function(){ie.end(),ie.destroy()}),re.onError(function(Ne){ie.destroy(new Error(Ne.errMsg))})}function de(Ne,he){if(he.hostname=he.hostname||he.host,!he.hostname)throw new Error("Could not determine host. Specify host manually.");const ze=he.protocolId==="MQIsdp"&&he.protocolVersion===3?"mqttv3.1":"mqtt";le(he);const pe=Ie(he,Ne);re=wx.connectSocket({url:pe,protocols:[ze]}),Ce=ae(),ie=oe.obj(),ie._destroy=function(Oe,_e){re.close({success:function(){_e&&_e(Oe)}})};const Ve=ie.destroy;return ie.destroy=function(){ie.destroy=Ve;const Oe=this;setTimeout(function(){re.close({fail:function(){Oe._destroy(new Error)}})},0)}.bind(ie),ue(),ie}g.exports=de},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(r,g,V){function k(){if(!(this instanceof k))return new k;this.nextId=Math.max(1,Math.floor(Math.random()*65535))}k.prototype.allocate=function(){const $=this.nextId++;return this.nextId===65536&&(this.nextId=1),$},k.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},k.prototype.register=function($){return!0},k.prototype.deallocate=function($){},k.prototype.clear=function(){},g.exports=k},{}],8:[function(r,g,V){const k=r("xtend"),$=r("readable-stream").Readable,oe={objectMode:!0},re={clean:!0};function Ce(ie){if(!(this instanceof Ce))return new Ce(ie);this.options=ie||{},this.options=k(re,ie),this._inflights=new Map}Ce.prototype.put=function(ie,ae){return this._inflights.set(ie.messageId,ie),ae&&ae(),this},Ce.prototype.createStream=function(){const ie=new $(oe),ae=[];let le=!1,Ie=0;return this._inflights.forEach(function(ue,de){ae.push(ue)}),ie._read=function(){!le&&Ie<ae.length?this.push(ae[Ie++]):this.push(null)},ie.destroy=function(){if(le)return;const ue=this;le=!0,setTimeout(function(){ue.emit("close")},0)},ie},Ce.prototype.del=function(ie,ae){return ie=this._inflights.get(ie.messageId),ie?(this._inflights.delete(ie.messageId),ae(null,ie)):ae&&ae(new Error("missing packet")),this},Ce.prototype.get=function(ie,ae){return ie=this._inflights.get(ie.messageId),ie?ae(null,ie):ae&&ae(new Error("missing packet")),this},Ce.prototype.close=function(ie){this.options.clean&&(this._inflights=null),ie&&ie()},g.exports=Ce},{"readable-stream":69,xtend:81}],9:[function(r,g,V){function k($){if(!(this instanceof k))return new k($);this.aliasToTopic={},this.max=$}k.prototype.put=function($,oe){return oe===0||oe>this.max?!1:(this.aliasToTopic[oe]=$,this.length=Object.keys(this.aliasToTopic).length,!0)},k.prototype.getTopicByAlias=function($){return this.aliasToTopic[$]},k.prototype.clear=function(){this.aliasToTopic={}},g.exports=k},{}],10:[function(r,g,V){const k=r("lru-cache"),$=r("number-allocator").NumberAllocator;function oe(re){if(!(this instanceof oe))return new oe(re);re>0&&(this.aliasToTopic=new k({max:re}),this.topicToAlias={},this.numberAllocator=new $(1,re),this.max=re,this.length=0)}oe.prototype.put=function(re,Ce){if(Ce===0||Ce>this.max)return!1;const ie=this.aliasToTopic.get(Ce);return ie&&delete this.topicToAlias[ie],this.aliasToTopic.set(Ce,re),this.topicToAlias[re]=Ce,this.numberAllocator.use(Ce),this.length=this.aliasToTopic.length,!0},oe.prototype.getTopicByAlias=function(re){return this.aliasToTopic.get(re)},oe.prototype.getAliasByTopic=function(re){const Ce=this.topicToAlias[re];return typeof Ce<"u"&&this.aliasToTopic.get(Ce),Ce},oe.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},oe.prototype.getLruAlias=function(){const re=this.numberAllocator.firstVacant();return re||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},g.exports=oe},{"lru-cache":37,"number-allocator":46}],11:[function(r,g,V){function k(oe){const re=oe.split("/");for(let Ce=0;Ce<re.length;Ce++)if(re[Ce]!=="+"){if(re[Ce]==="#")return Ce===re.length-1;if(re[Ce].indexOf("+")!==-1||re[Ce].indexOf("#")!==-1)return!1}return!0}function $(oe){if(oe.length===0)return"empty_topic_list";for(let re=0;re<oe.length;re++)if(!k(oe[re]))return oe[re];return null}g.exports={validateTopics:$}},{}],12:[function(r,g,V){(function(k){(function(){const $=r("../client"),oe=r("../store"),re=r("url"),Ce=r("xtend"),ie=r("debug")("mqttjs"),ae={};typeof k<"u"&&k.title!=="browser"||typeof __webpack_require__!="function"?(ae.mqtt=r("./tcp"),ae.tcp=r("./tcp"),ae.ssl=r("./tls"),ae.tls=r("./tls"),ae.mqtts=r("./tls")):(ae.wx=r("./wx"),ae.wxs=r("./wx"),ae.ali=r("./ali"),ae.alis=r("./ali")),ae.ws=r("./ws"),ae.wss=r("./ws");function le(ue){let de;ue.auth&&(de=ue.auth.match(/^(.+):(.+)$/),de?(ue.username=de[1],ue.password=de[2]):ue.username=ue.auth)}function Ie(ue,de){if(ie("connecting to an MQTT broker..."),typeof ue=="object"&&!de&&(de=ue,ue=null),de=de||{},ue){const ze=re.parse(ue,!0);if(ze.port!=null&&(ze.port=Number(ze.port)),de=Ce(ze,de),de.protocol===null)throw new Error("Missing protocol");de.protocol=de.protocol.replace(/:$/,"")}if(le(de),de.query&&typeof de.query.clientId=="string"&&(de.clientId=de.query.clientId),de.cert&&de.key)if(de.protocol){if(["mqtts","wss","wxs","alis"].indexOf(de.protocol)===-1)switch(de.protocol){case"mqtt":de.protocol="mqtts";break;case"ws":de.protocol="wss";break;case"wx":de.protocol="wxs";break;case"ali":de.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+de.protocol+'"!')}}else throw new Error("Missing secure protocol key");if(!ae[de.protocol]){const ze=["mqtts","wss"].indexOf(de.protocol)!==-1;de.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(pe,Ve){return ze&&Ve%2===0?!1:typeof ae[pe]=="function"})[0]}if(de.clean===!1&&!de.clientId)throw new Error("Missing clientId for unclean clients");de.protocol&&(de.defaultProtocol=de.protocol);function Ne(ze){return de.servers&&((!ze._reconnectCount||ze._reconnectCount===de.servers.length)&&(ze._reconnectCount=0),de.host=de.servers[ze._reconnectCount].host,de.port=de.servers[ze._reconnectCount].port,de.protocol=de.servers[ze._reconnectCount].protocol?de.servers[ze._reconnectCount].protocol:de.defaultProtocol,de.hostname=de.host,ze._reconnectCount++),ie("calling streambuilder for",de.protocol),ae[de.protocol](ze,de)}const he=new $(Ne,de);return he.on("error",function(){}),he}g.exports=Ie,g.exports.connect=Ie,g.exports.MqttClient=$,g.exports.Store=oe}).call(this)}).call(this,r("_process"))},{"../client":1,"../store":8,"./ali":2,"./tcp":3,"./tls":4,"./ws":5,"./wx":6,_process:50,debug:18,url:76,xtend:81}],13:[function(r,g,V){V.byteLength=le,V.toByteArray=ue,V.fromByteArray=he;for(var k=[],$=[],oe=typeof Uint8Array<"u"?Uint8Array:Array,re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ce=0,ie=re.length;Ce<ie;++Ce)k[Ce]=re[Ce],$[re.charCodeAt(Ce)]=Ce;$["-".charCodeAt(0)]=62,$["_".charCodeAt(0)]=63;function ae(ze){var pe=ze.length;if(pe%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var Ve=ze.indexOf("=");Ve===-1&&(Ve=pe);var Oe=Ve===pe?0:4-Ve%4;return[Ve,Oe]}function le(ze){var pe=ae(ze),Ve=pe[0],Oe=pe[1];return(Ve+Oe)*3/4-Oe}function Ie(ze,pe,Ve){return(pe+Ve)*3/4-Ve}function ue(ze){var pe,Ve=ae(ze),Oe=Ve[0],_e=Ve[1],At=new oe(Ie(ze,Oe,_e)),$e=0,Fe=_e>0?Oe-4:Oe,Ue;for(Ue=0;Ue<Fe;Ue+=4)pe=$[ze.charCodeAt(Ue)]<<18|$[ze.charCodeAt(Ue+1)]<<12|$[ze.charCodeAt(Ue+2)]<<6|$[ze.charCodeAt(Ue+3)],At[$e++]=pe>>16&255,At[$e++]=pe>>8&255,At[$e++]=pe&255;return _e===2&&(pe=$[ze.charCodeAt(Ue)]<<2|$[ze.charCodeAt(Ue+1)]>>4,At[$e++]=pe&255),_e===1&&(pe=$[ze.charCodeAt(Ue)]<<10|$[ze.charCodeAt(Ue+1)]<<4|$[ze.charCodeAt(Ue+2)]>>2,At[$e++]=pe>>8&255,At[$e++]=pe&255),At}function de(ze){return k[ze>>18&63]+k[ze>>12&63]+k[ze>>6&63]+k[ze&63]}function Ne(ze,pe,Ve){for(var Oe,_e=[],At=pe;At<Ve;At+=3)Oe=(ze[At]<<16&16711680)+(ze[At+1]<<8&65280)+(ze[At+2]&255),_e.push(de(Oe));return _e.join("")}function he(ze){for(var pe,Ve=ze.length,Oe=Ve%3,_e=[],At=16383,$e=0,Fe=Ve-Oe;$e<Fe;$e+=At)_e.push(Ne(ze,$e,$e+At>Fe?Fe:$e+At));return Oe===1?(pe=ze[Ve-1],_e.push(k[pe>>2]+k[pe<<4&63]+"==")):Oe===2&&(pe=(ze[Ve-2]<<8)+ze[Ve-1],_e.push(k[pe>>10]+k[pe>>4&63]+k[pe<<2&63]+"=")),_e.join("")}},{}],14:[function(r,g,V){const{Buffer:k}=r("buffer"),$=Symbol.for("BufferList");function oe(re){if(!(this instanceof oe))return new oe(re);oe._init.call(this,re)}oe._init=function(Ce){Object.defineProperty(this,$,{value:!0}),this._bufs=[],this.length=0,Ce&&this.append(Ce)},oe.prototype._new=function(Ce){return new oe(Ce)},oe.prototype._offset=function(Ce){if(Ce===0)return[0,0];let ie=0;for(let ae=0;ae<this._bufs.length;ae++){const le=ie+this._bufs[ae].length;if(Ce<le||ae===this._bufs.length-1)return[ae,Ce-ie];ie=le}},oe.prototype._reverseOffset=function(re){const Ce=re[0];let ie=re[1];for(let ae=0;ae<Ce;ae++)ie+=this._bufs[ae].length;return ie},oe.prototype.get=function(Ce){if(Ce>this.length||Ce<0)return;const ie=this._offset(Ce);return this._bufs[ie[0]][ie[1]]},oe.prototype.slice=function(Ce,ie){return typeof Ce=="number"&&Ce<0&&(Ce+=this.length),typeof ie=="number"&&ie<0&&(ie+=this.length),this.copy(null,0,Ce,ie)},oe.prototype.copy=function(Ce,ie,ae,le){if((typeof ae!="number"||ae<0)&&(ae=0),(typeof le!="number"||le>this.length)&&(le=this.length),ae>=this.length||le<=0)return Ce||k.alloc(0);const Ie=!!Ce,ue=this._offset(ae),de=le-ae;let Ne=de,he=Ie&&ie||0,ze=ue[1];if(ae===0&&le===this.length){if(!Ie)return this._bufs.length===1?this._bufs[0]:k.concat(this._bufs,this.length);for(let pe=0;pe<this._bufs.length;pe++)this._bufs[pe].copy(Ce,he),he+=this._bufs[pe].length;return Ce}if(Ne<=this._bufs[ue[0]].length-ze)return Ie?this._bufs[ue[0]].copy(Ce,ie,ze,ze+Ne):this._bufs[ue[0]].slice(ze,ze+Ne);Ie||(Ce=k.allocUnsafe(de));for(let pe=ue[0];pe<this._bufs.length;pe++){const Ve=this._bufs[pe].length-ze;if(Ne>Ve)this._bufs[pe].copy(Ce,he,ze),he+=Ve;else{this._bufs[pe].copy(Ce,he,ze,ze+Ne),he+=Ve;break}Ne-=Ve,ze&&(ze=0)}return Ce.length>he?Ce.slice(0,he):Ce},oe.prototype.shallowSlice=function(Ce,ie){if(Ce=Ce||0,ie=typeof ie!="number"?this.length:ie,Ce<0&&(Ce+=this.length),ie<0&&(ie+=this.length),Ce===ie)return this._new();const ae=this._offset(Ce),le=this._offset(ie),Ie=this._bufs.slice(ae[0],le[0]+1);return le[1]===0?Ie.pop():Ie[Ie.length-1]=Ie[Ie.length-1].slice(0,le[1]),ae[1]!==0&&(Ie[0]=Ie[0].slice(ae[1])),this._new(Ie)},oe.prototype.toString=function(Ce,ie,ae){return this.slice(ie,ae).toString(Ce)},oe.prototype.consume=function(Ce){if(Ce=Math.trunc(Ce),Number.isNaN(Ce)||Ce<=0)return this;for(;this._bufs.length;)if(Ce>=this._bufs[0].length)Ce-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(Ce),this.length-=Ce;break}return this},oe.prototype.duplicate=function(){const Ce=this._new();for(let ie=0;ie<this._bufs.length;ie++)Ce.append(this._bufs[ie]);return Ce},oe.prototype.append=function(Ce){if(Ce==null)return this;if(Ce.buffer)this._appendBuffer(k.from(Ce.buffer,Ce.byteOffset,Ce.byteLength));else if(Array.isArray(Ce))for(let ie=0;ie<Ce.length;ie++)this.append(Ce[ie]);else if(this._isBufferList(Ce))for(let ie=0;ie<Ce._bufs.length;ie++)this.append(Ce._bufs[ie]);else typeof Ce=="number"&&(Ce=Ce.toString()),this._appendBuffer(k.from(Ce));return this},oe.prototype._appendBuffer=function(Ce){this._bufs.push(Ce),this.length+=Ce.length},oe.prototype.indexOf=function(re,Ce,ie){if(ie===void 0&&typeof Ce=="string"&&(ie=Ce,Ce=void 0),typeof re=="function"||Array.isArray(re))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof re=="number"?re=k.from([re]):typeof re=="string"?re=k.from(re,ie):this._isBufferList(re)?re=re.slice():Array.isArray(re.buffer)?re=k.from(re.buffer,re.byteOffset,re.byteLength):k.isBuffer(re)||(re=k.from(re)),Ce=Number(Ce||0),isNaN(Ce)&&(Ce=0),Ce<0&&(Ce=this.length+Ce),Ce<0&&(Ce=0),re.length===0)return Ce>this.length?this.length:Ce;const ae=this._offset(Ce);let le=ae[0],Ie=ae[1];for(;le<this._bufs.length;le++){const ue=this._bufs[le];for(;Ie<ue.length;)if(ue.length-Ie>=re.length){const Ne=ue.indexOf(re,Ie);if(Ne!==-1)return this._reverseOffset([le,Ne]);Ie=ue.length-re.length+1}else{const Ne=this._reverseOffset([le,Ie]);if(this._match(Ne,re))return Ne;Ie++}Ie=0}return-1},oe.prototype._match=function(re,Ce){if(this.length-re<Ce.length)return!1;for(let ie=0;ie<Ce.length;ie++)if(this.get(re+ie)!==Ce[ie])return!1;return!0},function(){const re={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const Ce in re)(function(ie){re[ie]===null?oe.prototype[ie]=function(ae,le){return this.slice(ae,ae+le)[ie](0,le)}:oe.prototype[ie]=function(ae=0){return this.slice(ae,ae+re[ie])[ie](0)}})(Ce)}(),oe.prototype._isBufferList=function(Ce){return Ce instanceof oe||oe.isBufferList(Ce)},oe.isBufferList=function(Ce){return Ce!=null&&Ce[$]},g.exports=oe},{buffer:17}],15:[function(r,g,V){const k=r("readable-stream").Duplex,$=r("inherits"),oe=r("./BufferList");function re(Ce){if(!(this instanceof re))return new re(Ce);if(typeof Ce=="function"){this._callback=Ce;const ie=function(le){this._callback&&(this._callback(le),this._callback=null)}.bind(this);this.on("pipe",function(le){le.on("error",ie)}),this.on("unpipe",function(le){le.removeListener("error",ie)}),Ce=null}oe._init.call(this,Ce),k.call(this)}$(re,k),Object.assign(re.prototype,oe.prototype),re.prototype._new=function(ie){return new re(ie)},re.prototype._write=function(ie,ae,le){this._appendBuffer(ie),typeof le=="function"&&le()},re.prototype._read=function(ie){if(!this.length)return this.push(null);ie=Math.min(ie,this.length),this.push(this.slice(0,ie)),this.consume(ie)},re.prototype.end=function(ie){k.prototype.end.call(this,ie),this._callback&&(this._callback(null,this.slice()),this._callback=null)},re.prototype._destroy=function(ie,ae){this._bufs.length=0,this.length=0,ae(ie)},re.prototype._isBufferList=function(ie){return ie instanceof re||ie instanceof oe||re.isBufferList(ie)},re.isBufferList=oe.isBufferList,g.exports=re,g.exports.BufferListStream=re,g.exports.BufferList=oe},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(r,g,V){},{}],17:[function(r,g,V){(function(k){(function(){var $=r("base64-js"),oe=r("ieee754");V.Buffer=ae,V.SlowBuffer=Oe,V.INSPECT_MAX_BYTES=50;var re=2147483647;V.kMaxLength=re,ae.TYPED_ARRAY_SUPPORT=Ce(),!ae.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Ce(){try{var oi=new Uint8Array(1);return oi.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},oi.foo()===42}catch{return!1}}Object.defineProperty(ae.prototype,"parent",{enumerable:!0,get:function(){if(ae.isBuffer(this))return this.buffer}}),Object.defineProperty(ae.prototype,"offset",{enumerable:!0,get:function(){if(ae.isBuffer(this))return this.byteOffset}});function ie(oi){if(oi>re)throw new RangeError('The value "'+oi+'" is invalid for option "size"');var ei=new Uint8Array(oi);return ei.__proto__=ae.prototype,ei}function ae(oi,ei,ii){if(typeof oi=="number"){if(typeof ei=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return de(oi)}return le(oi,ei,ii)}typeof Symbol<"u"&&Symbol.species!=null&&ae[Symbol.species]===ae&&Object.defineProperty(ae,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),ae.poolSize=8192;function le(oi,ei,ii){if(typeof oi=="string")return Ne(oi,ei);if(ArrayBuffer.isView(oi))return he(oi);if(oi==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof oi);if(ai(oi,ArrayBuffer)||oi&&ai(oi.buffer,ArrayBuffer))return ze(oi,ei,ii);if(typeof oi=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var si=oi.valueOf&&oi.valueOf();if(si!=null&&si!==oi)return ae.from(si,ei,ii);var zi=pe(oi);if(zi)return zi;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof oi[Symbol.toPrimitive]=="function")return ae.from(oi[Symbol.toPrimitive]("string"),ei,ii);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof oi)}ae.from=function(oi,ei,ii){return le(oi,ei,ii)},ae.prototype.__proto__=Uint8Array.prototype,ae.__proto__=Uint8Array;function Ie(oi){if(typeof oi!="number")throw new TypeError('"size" argument must be of type number');if(oi<0)throw new RangeError('The value "'+oi+'" is invalid for option "size"')}function ue(oi,ei,ii){return Ie(oi),oi<=0?ie(oi):ei!==void 0?typeof ii=="string"?ie(oi).fill(ei,ii):ie(oi).fill(ei):ie(oi)}ae.alloc=function(oi,ei,ii){return ue(oi,ei,ii)};function de(oi){return Ie(oi),ie(oi<0?0:Ve(oi)|0)}ae.allocUnsafe=function(oi){return de(oi)},ae.allocUnsafeSlow=function(oi){return de(oi)};function Ne(oi,ei){if((typeof ei!="string"||ei==="")&&(ei="utf8"),!ae.isEncoding(ei))throw new TypeError("Unknown encoding: "+ei);var ii=_e(oi,ei)|0,si=ie(ii),zi=si.write(oi,ei);return zi!==ii&&(si=si.slice(0,zi)),si}function he(oi){for(var ei=oi.length<0?0:Ve(oi.length)|0,ii=ie(ei),si=0;si<ei;si+=1)ii[si]=oi[si]&255;return ii}function ze(oi,ei,ii){if(ei<0||oi.byteLength<ei)throw new RangeError('"offset" is outside of buffer bounds');if(oi.byteLength<ei+(ii||0))throw new RangeError('"length" is outside of buffer bounds');var si;return ei===void 0&&ii===void 0?si=new Uint8Array(oi):ii===void 0?si=new Uint8Array(oi,ei):si=new Uint8Array(oi,ei,ii),si.__proto__=ae.prototype,si}function pe(oi){if(ae.isBuffer(oi)){var ei=Ve(oi.length)|0,ii=ie(ei);return ii.length===0||oi.copy(ii,0,0,ei),ii}if(oi.length!==void 0)return typeof oi.length!="number"||Ii(oi.length)?ie(0):he(oi);if(oi.type==="Buffer"&&Array.isArray(oi.data))return he(oi.data)}function Ve(oi){if(oi>=re)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+re.toString(16)+" bytes");return oi|0}function Oe(oi){return+oi!=oi&&(oi=0),ae.alloc(+oi)}ae.isBuffer=function(ei){return ei!=null&&ei._isBuffer===!0&&ei!==ae.prototype},ae.compare=function(ei,ii){if(ai(ei,Uint8Array)&&(ei=ae.from(ei,ei.offset,ei.byteLength)),ai(ii,Uint8Array)&&(ii=ae.from(ii,ii.offset,ii.byteLength)),!ae.isBuffer(ei)||!ae.isBuffer(ii))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(ei===ii)return 0;for(var si=ei.length,zi=ii.length,mi=0,Si=Math.min(si,zi);mi<Si;++mi)if(ei[mi]!==ii[mi]){si=ei[mi],zi=ii[mi];break}return si<zi?-1:zi<si?1:0},ae.isEncoding=function(ei){switch(String(ei).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},ae.concat=function(ei,ii){if(!Array.isArray(ei))throw new TypeError('"list" argument must be an Array of Buffers');if(ei.length===0)return ae.alloc(0);var si;if(ii===void 0)for(ii=0,si=0;si<ei.length;++si)ii+=ei[si].length;var zi=ae.allocUnsafe(ii),mi=0;for(si=0;si<ei.length;++si){var Si=ei[si];if(ai(Si,Uint8Array)&&(Si=ae.from(Si)),!ae.isBuffer(Si))throw new TypeError('"list" argument must be an Array of Buffers');Si.copy(zi,mi),mi+=Si.length}return zi};function _e(oi,ei){if(ae.isBuffer(oi))return oi.length;if(ArrayBuffer.isView(oi)||ai(oi,ArrayBuffer))return oi.byteLength;if(typeof oi!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof oi);var ii=oi.length,si=arguments.length>2&&arguments[2]===!0;if(!si&&ii===0)return 0;for(var zi=!1;;)switch(ei){case"ascii":case"latin1":case"binary":return ii;case"utf8":case"utf-8":return Mi(oi).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ii*2;case"hex":return ii>>>1;case"base64":return vi(oi).length;default:if(zi)return si?-1:Mi(oi).length;ei=(""+ei).toLowerCase(),zi=!0}}ae.byteLength=_e;function At(oi,ei,ii){var si=!1;if((ei===void 0||ei<0)&&(ei=0),ei>this.length||((ii===void 0||ii>this.length)&&(ii=this.length),ii<=0)||(ii>>>=0,ei>>>=0,ii<=ei))return"";for(oi||(oi="utf8");;)switch(oi){case"hex":return Ci(this,ei,ii);case"utf8":case"utf-8":return Lt(this,ei,ii);case"ascii":return ri(this,ei,ii);case"latin1":case"binary":return ui(this,ei,ii);case"base64":return ti(this,ei,ii);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gi(this,ei,ii);default:if(si)throw new TypeError("Unknown encoding: "+oi);oi=(oi+"").toLowerCase(),si=!0}}ae.prototype._isBuffer=!0;function $e(oi,ei,ii){var si=oi[ei];oi[ei]=oi[ii],oi[ii]=si}ae.prototype.swap16=function(){var ei=this.length;if(ei%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var ii=0;ii<ei;ii+=2)$e(this,ii,ii+1);return this},ae.prototype.swap32=function(){var ei=this.length;if(ei%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var ii=0;ii<ei;ii+=4)$e(this,ii,ii+3),$e(this,ii+1,ii+2);return this},ae.prototype.swap64=function(){var ei=this.length;if(ei%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var ii=0;ii<ei;ii+=8)$e(this,ii,ii+7),$e(this,ii+1,ii+6),$e(this,ii+2,ii+5),$e(this,ii+3,ii+4);return this},ae.prototype.toString=function(){var ei=this.length;return ei===0?"":arguments.length===0?Lt(this,0,ei):At.apply(this,arguments)},ae.prototype.toLocaleString=ae.prototype.toString,ae.prototype.equals=function(ei){if(!ae.isBuffer(ei))throw new TypeError("Argument must be a Buffer");return this===ei?!0:ae.compare(this,ei)===0},ae.prototype.inspect=function(){var ei="",ii=V.INSPECT_MAX_BYTES;return ei=this.toString("hex",0,ii).replace(/(.{2})/g,"$1 ").trim(),this.length>ii&&(ei+=" ... "),"<Buffer "+ei+">"},ae.prototype.compare=function(ei,ii,si,zi,mi){if(ai(ei,Uint8Array)&&(ei=ae.from(ei,ei.offset,ei.byteLength)),!ae.isBuffer(ei))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof ei);if(ii===void 0&&(ii=0),si===void 0&&(si=ei?ei.length:0),zi===void 0&&(zi=0),mi===void 0&&(mi=this.length),ii<0||si>ei.length||zi<0||mi>this.length)throw new RangeError("out of range index");if(zi>=mi&&ii>=si)return 0;if(zi>=mi)return-1;if(ii>=si)return 1;if(ii>>>=0,si>>>=0,zi>>>=0,mi>>>=0,this===ei)return 0;for(var Si=mi-zi,xi=si-ii,Gi=Math.min(Si,xi),Bi=this.slice(zi,mi),Oi=ei.slice(ii,si),Zi=0;Zi<Gi;++Zi)if(Bi[Zi]!==Oi[Zi]){Si=Bi[Zi],xi=Oi[Zi];break}return Si<xi?-1:xi<Si?1:0};function Fe(oi,ei,ii,si,zi){if(oi.length===0)return-1;if(typeof ii=="string"?(si=ii,ii=0):ii>2147483647?ii=2147483647:ii<-2147483648&&(ii=-2147483648),ii=+ii,Ii(ii)&&(ii=zi?0:oi.length-1),ii<0&&(ii=oi.length+ii),ii>=oi.length){if(zi)return-1;ii=oi.length-1}else if(ii<0)if(zi)ii=0;else return-1;if(typeof ei=="string"&&(ei=ae.from(ei,si)),ae.isBuffer(ei))return ei.length===0?-1:Ue(oi,ei,ii,si,zi);if(typeof ei=="number")return ei=ei&255,typeof Uint8Array.prototype.indexOf=="function"?zi?Uint8Array.prototype.indexOf.call(oi,ei,ii):Uint8Array.prototype.lastIndexOf.call(oi,ei,ii):Ue(oi,[ei],ii,si,zi);throw new TypeError("val must be string, number or Buffer")}function Ue(oi,ei,ii,si,zi){var mi=1,Si=oi.length,xi=ei.length;if(si!==void 0&&(si=String(si).toLowerCase(),si==="ucs2"||si==="ucs-2"||si==="utf16le"||si==="utf-16le")){if(oi.length<2||ei.length<2)return-1;mi=2,Si/=2,xi/=2,ii/=2}function Gi(Vi,ki){return mi===1?Vi[ki]:Vi.readUInt16BE(ki*mi)}var Bi;if(zi){var Oi=-1;for(Bi=ii;Bi<Si;Bi++)if(Gi(oi,Bi)===Gi(ei,Oi===-1?0:Bi-Oi)){if(Oi===-1&&(Oi=Bi),Bi-Oi+1===xi)return Oi*mi}else Oi!==-1&&(Bi-=Bi-Oi),Oi=-1}else for(ii+xi>Si&&(ii=Si-xi),Bi=ii;Bi>=0;Bi--){for(var Zi=!0,Wi=0;Wi<xi;Wi++)if(Gi(oi,Bi+Wi)!==Gi(ei,Wi)){Zi=!1;break}if(Zi)return Bi}return-1}ae.prototype.includes=function(ei,ii,si){return this.indexOf(ei,ii,si)!==-1},ae.prototype.indexOf=function(ei,ii,si){return Fe(this,ei,ii,si,!0)},ae.prototype.lastIndexOf=function(ei,ii,si){return Fe(this,ei,ii,si,!1)};function xe(oi,ei,ii,si){ii=Number(ii)||0;var zi=oi.length-ii;si?(si=Number(si),si>zi&&(si=zi)):si=zi;var mi=ei.length;si>mi/2&&(si=mi/2);for(var Si=0;Si<si;++Si){var xi=parseInt(ei.substr(Si*2,2),16);if(Ii(xi))return Si;oi[ii+Si]=xi}return Si}function Dt(oi,ei,ii,si){return bi(Mi(ei,oi.length-ii),oi,ii,si)}function qe(oi,ei,ii,si){return bi(Ni(ei),oi,ii,si)}function kt(oi,ei,ii,si){return qe(oi,ei,ii,si)}function Et(oi,ei,ii,si){return bi(vi(ei),oi,ii,si)}function jt(oi,ei,ii,si){return bi(pi(ei,oi.length-ii),oi,ii,si)}ae.prototype.write=function(ei,ii,si,zi){if(ii===void 0)zi="utf8",si=this.length,ii=0;else if(si===void 0&&typeof ii=="string")zi=ii,si=this.length,ii=0;else if(isFinite(ii))ii=ii>>>0,isFinite(si)?(si=si>>>0,zi===void 0&&(zi="utf8")):(zi=si,si=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var mi=this.length-ii;if((si===void 0||si>mi)&&(si=mi),ei.length>0&&(si<0||ii<0)||ii>this.length)throw new RangeError("Attempt to write outside buffer bounds");zi||(zi="utf8");for(var Si=!1;;)switch(zi){case"hex":return xe(this,ei,ii,si);case"utf8":case"utf-8":return Dt(this,ei,ii,si);case"ascii":return qe(this,ei,ii,si);case"latin1":case"binary":return kt(this,ei,ii,si);case"base64":return Et(this,ei,ii,si);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return jt(this,ei,ii,si);default:if(Si)throw new TypeError("Unknown encoding: "+zi);zi=(""+zi).toLowerCase(),Si=!0}},ae.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ti(oi,ei,ii){return ei===0&&ii===oi.length?$.fromByteArray(oi):$.fromByteArray(oi.slice(ei,ii))}function Lt(oi,ei,ii){ii=Math.min(oi.length,ii);for(var si=[],zi=ei;zi<ii;){var mi=oi[zi],Si=null,xi=mi>239?4:mi>223?3:mi>191?2:1;if(zi+xi<=ii){var Gi,Bi,Oi,Zi;switch(xi){case 1:mi<128&&(Si=mi);break;case 2:Gi=oi[zi+1],(Gi&192)===128&&(Zi=(mi&31)<<6|Gi&63,Zi>127&&(Si=Zi));break;case 3:Gi=oi[zi+1],Bi=oi[zi+2],(Gi&192)===128&&(Bi&192)===128&&(Zi=(mi&15)<<12|(Gi&63)<<6|Bi&63,Zi>2047&&(Zi<55296||Zi>57343)&&(Si=Zi));break;case 4:Gi=oi[zi+1],Bi=oi[zi+2],Oi=oi[zi+3],(Gi&192)===128&&(Bi&192)===128&&(Oi&192)===128&&(Zi=(mi&15)<<18|(Gi&63)<<12|(Bi&63)<<6|Oi&63,Zi>65535&&Zi<1114112&&(Si=Zi))}}Si===null?(Si=65533,xi=1):Si>65535&&(Si-=65536,si.push(Si>>>10&1023|55296),Si=56320|Si&1023),si.push(Si),zi+=xi}return ni(si)}var Pt=4096;function ni(oi){var ei=oi.length;if(ei<=Pt)return String.fromCharCode.apply(String,oi);for(var ii="",si=0;si<ei;)ii+=String.fromCharCode.apply(String,oi.slice(si,si+=Pt));return ii}function ri(oi,ei,ii){var si="";ii=Math.min(oi.length,ii);for(var zi=ei;zi<ii;++zi)si+=String.fromCharCode(oi[zi]&127);return si}function ui(oi,ei,ii){var si="";ii=Math.min(oi.length,ii);for(var zi=ei;zi<ii;++zi)si+=String.fromCharCode(oi[zi]);return si}function Ci(oi,ei,ii){var si=oi.length;(!ei||ei<0)&&(ei=0),(!ii||ii<0||ii>si)&&(ii=si);for(var zi="",mi=ei;mi<ii;++mi)zi+=fi(oi[mi]);return zi}function gi(oi,ei,ii){for(var si=oi.slice(ei,ii),zi="",mi=0;mi<si.length;mi+=2)zi+=String.fromCharCode(si[mi]+si[mi+1]*256);return zi}ae.prototype.slice=function(ei,ii){var si=this.length;ei=~~ei,ii=ii===void 0?si:~~ii,ei<0?(ei+=si,ei<0&&(ei=0)):ei>si&&(ei=si),ii<0?(ii+=si,ii<0&&(ii=0)):ii>si&&(ii=si),ii<ei&&(ii=ei);var zi=this.subarray(ei,ii);return zi.__proto__=ae.prototype,zi};function di(oi,ei,ii){if(oi%1!==0||oi<0)throw new RangeError("offset is not uint");if(oi+ei>ii)throw new RangeError("Trying to access beyond buffer length")}ae.prototype.readUIntLE=function(ei,ii,si){ei=ei>>>0,ii=ii>>>0,si||di(ei,ii,this.length);for(var zi=this[ei],mi=1,Si=0;++Si<ii&&(mi*=256);)zi+=this[ei+Si]*mi;return zi},ae.prototype.readUIntBE=function(ei,ii,si){ei=ei>>>0,ii=ii>>>0,si||di(ei,ii,this.length);for(var zi=this[ei+--ii],mi=1;ii>0&&(mi*=256);)zi+=this[ei+--ii]*mi;return zi},ae.prototype.readUInt8=function(ei,ii){return ei=ei>>>0,ii||di(ei,1,this.length),this[ei]},ae.prototype.readUInt16LE=function(ei,ii){return ei=ei>>>0,ii||di(ei,2,this.length),this[ei]|this[ei+1]<<8},ae.prototype.readUInt16BE=function(ei,ii){return ei=ei>>>0,ii||di(ei,2,this.length),this[ei]<<8|this[ei+1]},ae.prototype.readUInt32LE=function(ei,ii){return ei=ei>>>0,ii||di(ei,4,this.length),(this[ei]|this[ei+1]<<8|this[ei+2]<<16)+this[ei+3]*16777216},ae.prototype.readUInt32BE=function(ei,ii){return ei=ei>>>0,ii||di(ei,4,this.length),this[ei]*16777216+(this[ei+1]<<16|this[ei+2]<<8|this[ei+3])},ae.prototype.readIntLE=function(ei,ii,si){ei=ei>>>0,ii=ii>>>0,si||di(ei,ii,this.length);for(var zi=this[ei],mi=1,Si=0;++Si<ii&&(mi*=256);)zi+=this[ei+Si]*mi;return mi*=128,zi>=mi&&(zi-=Math.pow(2,8*ii)),zi},ae.prototype.readIntBE=function(ei,ii,si){ei=ei>>>0,ii=ii>>>0,si||di(ei,ii,this.length);for(var zi=ii,mi=1,Si=this[ei+--zi];zi>0&&(mi*=256);)Si+=this[ei+--zi]*mi;return mi*=128,Si>=mi&&(Si-=Math.pow(2,8*ii)),Si},ae.prototype.readInt8=function(ei,ii){return ei=ei>>>0,ii||di(ei,1,this.length),this[ei]&128?(255-this[ei]+1)*-1:this[ei]},ae.prototype.readInt16LE=function(ei,ii){ei=ei>>>0,ii||di(ei,2,this.length);var si=this[ei]|this[ei+1]<<8;return si&32768?si|4294901760:si},ae.prototype.readInt16BE=function(ei,ii){ei=ei>>>0,ii||di(ei,2,this.length);var si=this[ei+1]|this[ei]<<8;return si&32768?si|4294901760:si},ae.prototype.readInt32LE=function(ei,ii){return ei=ei>>>0,ii||di(ei,4,this.length),this[ei]|this[ei+1]<<8|this[ei+2]<<16|this[ei+3]<<24},ae.prototype.readInt32BE=function(ei,ii){return ei=ei>>>0,ii||di(ei,4,this.length),this[ei]<<24|this[ei+1]<<16|this[ei+2]<<8|this[ei+3]},ae.prototype.readFloatLE=function(ei,ii){return ei=ei>>>0,ii||di(ei,4,this.length),oe.read(this,ei,!0,23,4)},ae.prototype.readFloatBE=function(ei,ii){return ei=ei>>>0,ii||di(ei,4,this.length),oe.read(this,ei,!1,23,4)},ae.prototype.readDoubleLE=function(ei,ii){return ei=ei>>>0,ii||di(ei,8,this.length),oe.read(this,ei,!0,52,8)},ae.prototype.readDoubleBE=function(ei,ii){return ei=ei>>>0,ii||di(ei,8,this.length),oe.read(this,ei,!1,52,8)};function hi(oi,ei,ii,si,zi,mi){if(!ae.isBuffer(oi))throw new TypeError('"buffer" argument must be a Buffer instance');if(ei>zi||ei<mi)throw new RangeError('"value" argument is out of bounds');if(ii+si>oi.length)throw new RangeError("Index out of range")}ae.prototype.writeUIntLE=function(ei,ii,si,zi){if(ei=+ei,ii=ii>>>0,si=si>>>0,!zi){var mi=Math.pow(2,8*si)-1;hi(this,ei,ii,si,mi,0)}var Si=1,xi=0;for(this[ii]=ei&255;++xi<si&&(Si*=256);)this[ii+xi]=ei/Si&255;return ii+si},ae.prototype.writeUIntBE=function(ei,ii,si,zi){if(ei=+ei,ii=ii>>>0,si=si>>>0,!zi){var mi=Math.pow(2,8*si)-1;hi(this,ei,ii,si,mi,0)}var Si=si-1,xi=1;for(this[ii+Si]=ei&255;--Si>=0&&(xi*=256);)this[ii+Si]=ei/xi&255;return ii+si},ae.prototype.writeUInt8=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,1,255,0),this[ii]=ei&255,ii+1},ae.prototype.writeUInt16LE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,2,65535,0),this[ii]=ei&255,this[ii+1]=ei>>>8,ii+2},ae.prototype.writeUInt16BE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,2,65535,0),this[ii]=ei>>>8,this[ii+1]=ei&255,ii+2},ae.prototype.writeUInt32LE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,4,4294967295,0),this[ii+3]=ei>>>24,this[ii+2]=ei>>>16,this[ii+1]=ei>>>8,this[ii]=ei&255,ii+4},ae.prototype.writeUInt32BE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,4,4294967295,0),this[ii]=ei>>>24,this[ii+1]=ei>>>16,this[ii+2]=ei>>>8,this[ii+3]=ei&255,ii+4},ae.prototype.writeIntLE=function(ei,ii,si,zi){if(ei=+ei,ii=ii>>>0,!zi){var mi=Math.pow(2,8*si-1);hi(this,ei,ii,si,mi-1,-mi)}var Si=0,xi=1,Gi=0;for(this[ii]=ei&255;++Si<si&&(xi*=256);)ei<0&&Gi===0&&this[ii+Si-1]!==0&&(Gi=1),this[ii+Si]=(ei/xi>>0)-Gi&255;return ii+si},ae.prototype.writeIntBE=function(ei,ii,si,zi){if(ei=+ei,ii=ii>>>0,!zi){var mi=Math.pow(2,8*si-1);hi(this,ei,ii,si,mi-1,-mi)}var Si=si-1,xi=1,Gi=0;for(this[ii+Si]=ei&255;--Si>=0&&(xi*=256);)ei<0&&Gi===0&&this[ii+Si+1]!==0&&(Gi=1),this[ii+Si]=(ei/xi>>0)-Gi&255;return ii+si},ae.prototype.writeInt8=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,1,127,-128),ei<0&&(ei=255+ei+1),this[ii]=ei&255,ii+1},ae.prototype.writeInt16LE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,2,32767,-32768),this[ii]=ei&255,this[ii+1]=ei>>>8,ii+2},ae.prototype.writeInt16BE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,2,32767,-32768),this[ii]=ei>>>8,this[ii+1]=ei&255,ii+2},ae.prototype.writeInt32LE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,4,2147483647,-2147483648),this[ii]=ei&255,this[ii+1]=ei>>>8,this[ii+2]=ei>>>16,this[ii+3]=ei>>>24,ii+4},ae.prototype.writeInt32BE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,4,2147483647,-2147483648),ei<0&&(ei=4294967295+ei+1),this[ii]=ei>>>24,this[ii+1]=ei>>>16,this[ii+2]=ei>>>8,this[ii+3]=ei&255,ii+4};function ci(oi,ei,ii,si,zi,mi){if(ii+si>oi.length)throw new RangeError("Index out of range");if(ii<0)throw new RangeError("Index out of range")}function Ai(oi,ei,ii,si,zi){return ei=+ei,ii=ii>>>0,zi||ci(oi,ei,ii,4),oe.write(oi,ei,ii,si,23,4),ii+4}ae.prototype.writeFloatLE=function(ei,ii,si){return Ai(this,ei,ii,!0,si)},ae.prototype.writeFloatBE=function(ei,ii,si){return Ai(this,ei,ii,!1,si)};function yi(oi,ei,ii,si,zi){return ei=+ei,ii=ii>>>0,zi||ci(oi,ei,ii,8),oe.write(oi,ei,ii,si,52,8),ii+8}ae.prototype.writeDoubleLE=function(ei,ii,si){return yi(this,ei,ii,!0,si)},ae.prototype.writeDoubleBE=function(ei,ii,si){return yi(this,ei,ii,!1,si)},ae.prototype.copy=function(ei,ii,si,zi){if(!ae.isBuffer(ei))throw new TypeError("argument should be a Buffer");if(si||(si=0),!zi&&zi!==0&&(zi=this.length),ii>=ei.length&&(ii=ei.length),ii||(ii=0),zi>0&&zi<si&&(zi=si),zi===si||ei.length===0||this.length===0)return 0;if(ii<0)throw new RangeError("targetStart out of bounds");if(si<0||si>=this.length)throw new RangeError("Index out of range");if(zi<0)throw new RangeError("sourceEnd out of bounds");zi>this.length&&(zi=this.length),ei.length-ii<zi-si&&(zi=ei.length-ii+si);var mi=zi-si;if(this===ei&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(ii,si,zi);else if(this===ei&&si<ii&&ii<zi)for(var Si=mi-1;Si>=0;--Si)ei[Si+ii]=this[Si+si];else Uint8Array.prototype.set.call(ei,this.subarray(si,zi),ii);return mi},ae.prototype.fill=function(ei,ii,si,zi){if(typeof ei=="string"){if(typeof ii=="string"?(zi=ii,ii=0,si=this.length):typeof si=="string"&&(zi=si,si=this.length),zi!==void 0&&typeof zi!="string")throw new TypeError("encoding must be a string");if(typeof zi=="string"&&!ae.isEncoding(zi))throw new TypeError("Unknown encoding: "+zi);if(ei.length===1){var mi=ei.charCodeAt(0);(zi==="utf8"&&mi<128||zi==="latin1")&&(ei=mi)}}else typeof ei=="number"&&(ei=ei&255);if(ii<0||this.length<ii||this.length<si)throw new RangeError("Out of range index");if(si<=ii)return this;ii=ii>>>0,si=si===void 0?this.length:si>>>0,ei||(ei=0);var Si;if(typeof ei=="number")for(Si=ii;Si<si;++Si)this[Si]=ei;else{var xi=ae.isBuffer(ei)?ei:ae.from(ei,zi),Gi=xi.length;if(Gi===0)throw new TypeError('The value "'+ei+'" is invalid for argument "value"');for(Si=0;Si<si-ii;++Si)this[Si+ii]=xi[Si%Gi]}return this};var wi=/[^+/0-9A-Za-z-_]/g;function li(oi){if(oi=oi.split("=")[0],oi=oi.trim().replace(wi,""),oi.length<2)return"";for(;oi.length%4!==0;)oi=oi+"=";return oi}function fi(oi){return oi<16?"0"+oi.toString(16):oi.toString(16)}function Mi(oi,ei){ei=ei||1/0;for(var ii,si=oi.length,zi=null,mi=[],Si=0;Si<si;++Si){if(ii=oi.charCodeAt(Si),ii>55295&&ii<57344){if(!zi){if(ii>56319){(ei-=3)>-1&&mi.push(239,191,189);continue}else if(Si+1===si){(ei-=3)>-1&&mi.push(239,191,189);continue}zi=ii;continue}if(ii<56320){(ei-=3)>-1&&mi.push(239,191,189),zi=ii;continue}ii=(zi-55296<<10|ii-56320)+65536}else zi&&(ei-=3)>-1&&mi.push(239,191,189);if(zi=null,ii<128){if((ei-=1)<0)break;mi.push(ii)}else if(ii<2048){if((ei-=2)<0)break;mi.push(ii>>6|192,ii&63|128)}else if(ii<65536){if((ei-=3)<0)break;mi.push(ii>>12|224,ii>>6&63|128,ii&63|128)}else if(ii<1114112){if((ei-=4)<0)break;mi.push(ii>>18|240,ii>>12&63|128,ii>>6&63|128,ii&63|128)}else throw new Error("Invalid code point")}return mi}function Ni(oi){for(var ei=[],ii=0;ii<oi.length;++ii)ei.push(oi.charCodeAt(ii)&255);return ei}function pi(oi,ei){for(var ii,si,zi,mi=[],Si=0;Si<oi.length&&!((ei-=2)<0);++Si)ii=oi.charCodeAt(Si),si=ii>>8,zi=ii%256,mi.push(zi),mi.push(si);return mi}function vi(oi){return $.toByteArray(li(oi))}function bi(oi,ei,ii,si){for(var zi=0;zi<si&&!(zi+ii>=ei.length||zi>=oi.length);++zi)ei[zi+ii]=oi[zi];return zi}function ai(oi,ei){return oi instanceof ei||oi!=null&&oi.constructor!=null&&oi.constructor.name!=null&&oi.constructor.name===ei.name}function Ii(oi){return oi!==oi}}).call(this)}).call(this,r("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(r,g,V){(function(k){(function(){V.formatArgs=oe,V.save=re,V.load=Ce,V.useColors=$,V.storage=ie(),V.destroy=(()=>{let le=!1;return()=>{le||(le=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),V.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function $(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function oe(le){if(le[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+le[0]+(this.useColors?"%c ":" ")+"+"+g.exports.humanize(this.diff),!this.useColors)return;const Ie="color: "+this.color;le.splice(1,0,Ie,"color: inherit");let ue=0,de=0;le[0].replace(/%[a-zA-Z%]/g,Ne=>{Ne!=="%%"&&(ue++,Ne==="%c"&&(de=ue))}),le.splice(de,0,Ie)}V.log=console.debug||console.log||(()=>{});function re(le){try{le?V.storage.setItem("debug",le):V.storage.removeItem("debug")}catch{}}function Ce(){let le;try{le=V.storage.getItem("debug")}catch{}return!le&&typeof k<"u"&&"env"in k&&(le=k.env.DEBUG),le}function ie(){try{return localStorage}catch{}}g.exports=r("./common")(V);const{formatters:ae}=g.exports;ae.j=function(le){try{return JSON.stringify(le)}catch(Ie){return"[UnexpectedJSONParseError]: "+Ie.message}}}).call(this)}).call(this,r("_process"))},{"./common":19,_process:50}],19:[function(r,g,V){function k($){re.debug=re,re.default=re,re.coerce=ue,re.disable=ae,re.enable=ie,re.enabled=le,re.humanize=r("ms"),re.destroy=de,Object.keys($).forEach(Ne=>{re[Ne]=$[Ne]}),re.names=[],re.skips=[],re.formatters={};function oe(Ne){let he=0;for(let ze=0;ze<Ne.length;ze++)he=(he<<5)-he+Ne.charCodeAt(ze),he|=0;return re.colors[Math.abs(he)%re.colors.length]}re.selectColor=oe;function re(Ne){let he,ze=null,pe,Ve;function Oe(..._e){if(!Oe.enabled)return;const At=Oe,$e=Number(new Date),Fe=$e-(he||$e);At.diff=Fe,At.prev=he,At.curr=$e,he=$e,_e[0]=re.coerce(_e[0]),typeof _e[0]!="string"&&_e.unshift("%O");let Ue=0;_e[0]=_e[0].replace(/%([a-zA-Z%])/g,(Dt,qe)=>{if(Dt==="%%")return"%";Ue++;const kt=re.formatters[qe];if(typeof kt=="function"){const Et=_e[Ue];Dt=kt.call(At,Et),_e.splice(Ue,1),Ue--}return Dt}),re.formatArgs.call(At,_e),(At.log||re.log).apply(At,_e)}return Oe.namespace=Ne,Oe.useColors=re.useColors(),Oe.color=re.selectColor(Ne),Oe.extend=Ce,Oe.destroy=re.destroy,Object.defineProperty(Oe,"enabled",{enumerable:!0,configurable:!1,get:()=>ze!==null?ze:(pe!==re.namespaces&&(pe=re.namespaces,Ve=re.enabled(Ne)),Ve),set:_e=>{ze=_e}}),typeof re.init=="function"&&re.init(Oe),Oe}function Ce(Ne,he){const ze=re(this.namespace+(typeof he>"u"?":":he)+Ne);return ze.log=this.log,ze}function ie(Ne){re.save(Ne),re.namespaces=Ne,re.names=[],re.skips=[];let he;const ze=(typeof Ne=="string"?Ne:"").split(/[\s,]+/),pe=ze.length;for(he=0;he<pe;he++)ze[he]&&(Ne=ze[he].replace(/\*/g,".*?"),Ne[0]==="-"?re.skips.push(new RegExp("^"+Ne.substr(1)+"$")):re.names.push(new RegExp("^"+Ne+"$")))}function ae(){const Ne=[...re.names.map(Ie),...re.skips.map(Ie).map(he=>"-"+he)].join(",");return re.enable(""),Ne}function le(Ne){if(Ne[Ne.length-1]==="*")return!0;let he,ze;for(he=0,ze=re.skips.length;he<ze;he++)if(re.skips[he].test(Ne))return!1;for(he=0,ze=re.names.length;he<ze;he++)if(re.names[he].test(Ne))return!0;return!1}function Ie(Ne){return Ne.toString().substring(2,Ne.toString().length-2).replace(/\.\*\?$/,"*")}function ue(Ne){return Ne instanceof Error?Ne.stack||Ne.message:Ne}function de(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return re.enable(re.load()),re}g.exports=k},{ms:45}],20:[function(r,g,V){(function(k,$){(function(){var oe=r("readable-stream"),re=r("end-of-stream"),Ce=r("inherits"),ie=r("stream-shift"),ae=$.from&&$.from!==Uint8Array.from?$.from([0]):new $([0]),le=function(pe,Ve){pe._corked?pe.once("uncork",Ve):Ve()},Ie=function(pe,Ve){pe._autoDestroy&&pe.destroy(Ve)},ue=function(pe,Ve){return function(Oe){Oe?Ie(pe,Oe.message==="premature close"?null:Oe):Ve&&!pe._ended&&pe.end()}},de=function(pe,Ve){if(!pe||pe._writableState&&pe._writableState.finished)return Ve();if(pe._writableState)return pe.end(Ve);pe.end(),Ve()},Ne=function(){},he=function(pe){return new oe.Readable({objectMode:!0,highWaterMark:16}).wrap(pe)},ze=function(pe,Ve,Oe){if(!(this instanceof ze))return new ze(pe,Ve,Oe);oe.Duplex.call(this,Oe),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!Oe||Oe.autoDestroy!==!1,this._forwardDestroy=!Oe||Oe.destroy!==!1,this._forwardEnd=!Oe||Oe.end!==!1,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,pe&&this.setWritable(pe),Ve&&this.setReadable(Ve)};Ce(ze,oe.Duplex),ze.obj=function(pe,Ve,Oe){return Oe||(Oe={}),Oe.objectMode=!0,Oe.highWaterMark=16,new ze(pe,Ve,Oe)},ze.prototype.cork=function(){++this._corked===1&&this.emit("cork")},ze.prototype.uncork=function(){this._corked&&--this._corked===0&&this.emit("uncork")},ze.prototype.setWritable=function(pe){if(this._unwrite&&this._unwrite(),this.destroyed){pe&&pe.destroy&&pe.destroy();return}if(pe===null||pe===!1){this.end();return}var Ve=this,Oe=re(pe,{writable:!0,readable:!1},ue(this,this._forwardEnd)),_e=function(){var $e=Ve._ondrain;Ve._ondrain=null,$e&&$e()},At=function(){Ve._writable.removeListener("drain",_e),Oe()};this._unwrite&&k.nextTick(_e),this._writable=pe,this._writable.on("drain",_e),this._unwrite=At,this.uncork()},ze.prototype.setReadable=function(pe){if(this._unread&&this._unread(),this.destroyed){pe&&pe.destroy&&pe.destroy();return}if(pe===null||pe===!1){this.push(null),this.resume();return}var Ve=this,Oe=re(pe,{writable:!1,readable:!0},ue(this)),_e=function(){Ve._forward()},At=function(){Ve.push(null)},$e=function(){Ve._readable2.removeListener("readable",_e),Ve._readable2.removeListener("end",At),Oe()};this._drained=!0,this._readable=pe,this._readable2=pe._readableState?pe:he(pe),this._readable2.on("readable",_e),this._readable2.on("end",At),this._unread=$e,this._forward()},ze.prototype._read=function(){this._drained=!0,this._forward()},ze.prototype._forward=function(){if(!(this._forwarding||!this._readable2||!this._drained)){this._forwarding=!0;for(var pe;this._drained&&(pe=ie(this._readable2))!==null;)this.destroyed||(this._drained=this.push(pe));this._forwarding=!1}},ze.prototype.destroy=function(pe,Ve){if(Ve||(Ve=Ne),this.destroyed)return Ve(null);this.destroyed=!0;var Oe=this;k.nextTick(function(){Oe._destroy(pe),Ve(null)})},ze.prototype._destroy=function(pe){if(pe){var Ve=this._ondrain;this._ondrain=null,Ve?Ve(pe):this.emit("error",pe)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},ze.prototype._write=function(pe,Ve,Oe){if(!this.destroyed){if(this._corked)return le(this,this._write.bind(this,pe,Ve,Oe));if(pe===ae)return this._finish(Oe);if(!this._writable)return Oe();this._writable.write(pe)===!1?this._ondrain=Oe:this.destroyed||Oe()}},ze.prototype._finish=function(pe){var Ve=this;this.emit("preend"),le(this,function(){de(Ve._forwardEnd&&Ve._writable,function(){Ve._writableState.prefinished===!1&&(Ve._writableState.prefinished=!0),Ve.emit("prefinish"),le(Ve,pe)})})},ze.prototype.end=function(pe,Ve,Oe){return typeof pe=="function"?this.end(null,null,pe):typeof Ve=="function"?this.end(pe,null,Ve):(this._ended=!0,pe&&this.write(pe),!this._writableState.ending&&!this._writableState.destroyed&&this.write(ae),oe.Writable.prototype.end.call(this,Oe))},g.exports=ze}).call(this)}).call(this,r("_process"),r("buffer").Buffer)},{_process:50,buffer:17,"end-of-stream":21,inherits:24,"readable-stream":69,"stream-shift":74}],21:[function(r,g,V){(function(k){(function(){var $=r("once"),oe=function(){},re=function(ae){return ae.setHeader&&typeof ae.abort=="function"},Ce=function(ae){return ae.stdio&&Array.isArray(ae.stdio)&&ae.stdio.length===3},ie=function(ae,le,Ie){if(typeof le=="function")return ie(ae,null,le);le||(le={}),Ie=$(Ie||oe);var ue=ae._writableState,de=ae._readableState,Ne=le.readable||le.readable!==!1&&ae.readable,he=le.writable||le.writable!==!1&&ae.writable,ze=!1,pe=function(){ae.writable||Ve()},Ve=function(){he=!1,Ne||Ie.call(ae)},Oe=function(){Ne=!1,he||Ie.call(ae)},_e=function(xe){Ie.call(ae,xe?new Error("exited with error code: "+xe):null)},At=function(xe){Ie.call(ae,xe)},$e=function(){k.nextTick(Fe)},Fe=function(){if(!ze){if(Ne&&!(de&&de.ended&&!de.destroyed))return Ie.call(ae,new Error("premature close"));if(he&&!(ue&&ue.ended&&!ue.destroyed))return Ie.call(ae,new Error("premature close"))}},Ue=function(){ae.req.on("finish",Ve)};return re(ae)?(ae.on("complete",Ve),ae.on("abort",$e),ae.req?Ue():ae.on("request",Ue)):he&&!ue&&(ae.on("end",pe),ae.on("close",pe)),Ce(ae)&&ae.on("exit",_e),ae.on("end",Oe),ae.on("finish",Ve),le.error!==!1&&ae.on("error",At),ae.on("close",$e),function(){ze=!0,ae.removeListener("complete",Ve),ae.removeListener("abort",$e),ae.removeListener("request",Ue),ae.req&&ae.req.removeListener("finish",Ve),ae.removeListener("end",pe),ae.removeListener("close",pe),ae.removeListener("finish",Ve),ae.removeListener("exit",_e),ae.removeListener("end",Oe),ae.removeListener("error",At),ae.removeListener("close",$e)}};g.exports=ie}).call(this)}).call(this,r("_process"))},{_process:50,once:48}],22:[function(r,g,V){var k=Object.create||Ue,$=Object.keys||xe,oe=Function.prototype.bind||Dt;function re(){(!this._events||!Object.prototype.hasOwnProperty.call(this,"_events"))&&(this._events=k(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}g.exports=re,re.EventEmitter=re,re.prototype._events=void 0,re.prototype._maxListeners=void 0;var Ce=10,ie;try{var ae={};Object.defineProperty&&Object.defineProperty(ae,"x",{value:0}),ie=ae.x===0}catch{ie=!1}ie?Object.defineProperty(re,"defaultMaxListeners",{enumerable:!0,get:function(){return Ce},set:function(qe){if(typeof qe!="number"||qe<0||qe!==qe)throw new TypeError('"defaultMaxListeners" must be a positive number');Ce=qe}}):re.defaultMaxListeners=Ce,re.prototype.setMaxListeners=function(kt){if(typeof kt!="number"||kt<0||isNaN(kt))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=kt,this};function le(qe){return qe._maxListeners===void 0?re.defaultMaxListeners:qe._maxListeners}re.prototype.getMaxListeners=function(){return le(this)};function Ie(qe,kt,Et){if(kt)qe.call(Et);else for(var jt=qe.length,ti=$e(qe,jt),Lt=0;Lt<jt;++Lt)ti[Lt].call(Et)}function ue(qe,kt,Et,jt){if(kt)qe.call(Et,jt);else for(var ti=qe.length,Lt=$e(qe,ti),Pt=0;Pt<ti;++Pt)Lt[Pt].call(Et,jt)}function de(qe,kt,Et,jt,ti){if(kt)qe.call(Et,jt,ti);else for(var Lt=qe.length,Pt=$e(qe,Lt),ni=0;ni<Lt;++ni)Pt[ni].call(Et,jt,ti)}function Ne(qe,kt,Et,jt,ti,Lt){if(kt)qe.call(Et,jt,ti,Lt);else for(var Pt=qe.length,ni=$e(qe,Pt),ri=0;ri<Pt;++ri)ni[ri].call(Et,jt,ti,Lt)}function he(qe,kt,Et,jt){if(kt)qe.apply(Et,jt);else for(var ti=qe.length,Lt=$e(qe,ti),Pt=0;Pt<ti;++Pt)Lt[Pt].apply(Et,jt)}re.prototype.emit=function(kt){var Et,jt,ti,Lt,Pt,ni,ri=kt==="error";if(ni=this._events,ni)ri=ri&&ni.error==null;else if(!ri)return!1;if(ri){if(arguments.length>1&&(Et=arguments[1]),Et instanceof Error)throw Et;var ui=new Error('Unhandled "error" event. ('+Et+")");throw ui.context=Et,ui}if(jt=ni[kt],!jt)return!1;var Ci=typeof jt=="function";switch(ti=arguments.length,ti){case 1:Ie(jt,Ci,this);break;case 2:ue(jt,Ci,this,arguments[1]);break;case 3:de(jt,Ci,this,arguments[1],arguments[2]);break;case 4:Ne(jt,Ci,this,arguments[1],arguments[2],arguments[3]);break;default:for(Lt=new Array(ti-1),Pt=1;Pt<ti;Pt++)Lt[Pt-1]=arguments[Pt];he(jt,Ci,this,Lt)}return!0};function ze(qe,kt,Et,jt){var ti,Lt,Pt;if(typeof Et!="function")throw new TypeError('"listener" argument must be a function');if(Lt=qe._events,Lt?(Lt.newListener&&(qe.emit("newListener",kt,Et.listener?Et.listener:Et),Lt=qe._events),Pt=Lt[kt]):(Lt=qe._events=k(null),qe._eventsCount=0),!Pt)Pt=Lt[kt]=Et,++qe._eventsCount;else if(typeof Pt=="function"?Pt=Lt[kt]=jt?[Et,Pt]:[Pt,Et]:jt?Pt.unshift(Et):Pt.push(Et),!Pt.warned&&(ti=le(qe),ti&&ti>0&&Pt.length>ti)){Pt.warned=!0;var ni=new Error("Possible EventEmitter memory leak detected. "+Pt.length+' "'+String(kt)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');ni.name="MaxListenersExceededWarning",ni.emitter=qe,ni.type=kt,ni.count=Pt.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",ni.name,ni.message)}return qe}re.prototype.addListener=function(kt,Et){return ze(this,kt,Et,!1)},re.prototype.on=re.prototype.addListener,re.prototype.prependListener=function(kt,Et){return ze(this,kt,Et,!0)};function pe(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var qe=new Array(arguments.length),kt=0;kt<qe.length;++kt)qe[kt]=arguments[kt];this.listener.apply(this.target,qe)}}function Ve(qe,kt,Et){var jt={fired:!1,wrapFn:void 0,target:qe,type:kt,listener:Et},ti=oe.call(pe,jt);return ti.listener=Et,jt.wrapFn=ti,ti}re.prototype.once=function(kt,Et){if(typeof Et!="function")throw new TypeError('"listener" argument must be a function');return this.on(kt,Ve(this,kt,Et)),this},re.prototype.prependOnceListener=function(kt,Et){if(typeof Et!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(kt,Ve(this,kt,Et)),this},re.prototype.removeListener=function(kt,Et){var jt,ti,Lt,Pt,ni;if(typeof Et!="function")throw new TypeError('"listener" argument must be a function');if(ti=this._events,!ti)return this;if(jt=ti[kt],!jt)return this;if(jt===Et||jt.listener===Et)--this._eventsCount===0?this._events=k(null):(delete ti[kt],ti.removeListener&&this.emit("removeListener",kt,jt.listener||Et));else if(typeof jt!="function"){for(Lt=-1,Pt=jt.length-1;Pt>=0;Pt--)if(jt[Pt]===Et||jt[Pt].listener===Et){ni=jt[Pt].listener,Lt=Pt;break}if(Lt<0)return this;Lt===0?jt.shift():At(jt,Lt),jt.length===1&&(ti[kt]=jt[0]),ti.removeListener&&this.emit("removeListener",kt,ni||Et)}return this},re.prototype.removeAllListeners=function(kt){var Et,jt,ti;if(jt=this._events,!jt)return this;if(!jt.removeListener)return arguments.length===0?(this._events=k(null),this._eventsCount=0):jt[kt]&&(--this._eventsCount===0?this._events=k(null):delete jt[kt]),this;if(arguments.length===0){var Lt=$(jt),Pt;for(ti=0;ti<Lt.length;++ti)Pt=Lt[ti],Pt!=="removeListener"&&this.removeAllListeners(Pt);return this.removeAllListeners("removeListener"),this._events=k(null),this._eventsCount=0,this}if(Et=jt[kt],typeof Et=="function")this.removeListener(kt,Et);else if(Et)for(ti=Et.length-1;ti>=0;ti--)this.removeListener(kt,Et[ti]);return this};function Oe(qe,kt,Et){var jt=qe._events;if(!jt)return[];var ti=jt[kt];return ti?typeof ti=="function"?Et?[ti.listener||ti]:[ti]:Et?Fe(ti):$e(ti,ti.length):[]}re.prototype.listeners=function(kt){return Oe(this,kt,!0)},re.prototype.rawListeners=function(kt){return Oe(this,kt,!1)},re.listenerCount=function(qe,kt){return typeof qe.listenerCount=="function"?qe.listenerCount(kt):_e.call(qe,kt)},re.prototype.listenerCount=_e;function _e(qe){var kt=this._events;if(kt){var Et=kt[qe];if(typeof Et=="function")return 1;if(Et)return Et.length}return 0}re.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function At(qe,kt){for(var Et=kt,jt=Et+1,ti=qe.length;jt<ti;Et+=1,jt+=1)qe[Et]=qe[jt];qe.pop()}function $e(qe,kt){for(var Et=new Array(kt),jt=0;jt<kt;++jt)Et[jt]=qe[jt];return Et}function Fe(qe){for(var kt=new Array(qe.length),Et=0;Et<kt.length;++Et)kt[Et]=qe[Et].listener||qe[Et];return kt}function Ue(qe){var kt=function(){};return kt.prototype=qe,new kt}function xe(qe){for(var kt in qe)Object.prototype.hasOwnProperty.call(qe,kt);return kt}function Dt(qe){var kt=this;return function(){return kt.apply(qe,arguments)}}},{}],23:[function(r,g,V){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */V.read=function(k,$,oe,re,Ce){var ie,ae,le=Ce*8-re-1,Ie=(1<<le)-1,ue=Ie>>1,de=-7,Ne=oe?Ce-1:0,he=oe?-1:1,ze=k[$+Ne];for(Ne+=he,ie=ze&(1<<-de)-1,ze>>=-de,de+=le;de>0;ie=ie*256+k[$+Ne],Ne+=he,de-=8);for(ae=ie&(1<<-de)-1,ie>>=-de,de+=re;de>0;ae=ae*256+k[$+Ne],Ne+=he,de-=8);if(ie===0)ie=1-ue;else{if(ie===Ie)return ae?NaN:(ze?-1:1)*(1/0);ae=ae+Math.pow(2,re),ie=ie-ue}return(ze?-1:1)*ae*Math.pow(2,ie-re)},V.write=function(k,$,oe,re,Ce,ie){var ae,le,Ie,ue=ie*8-Ce-1,de=(1<<ue)-1,Ne=de>>1,he=Ce===23?Math.pow(2,-24)-Math.pow(2,-77):0,ze=re?0:ie-1,pe=re?1:-1,Ve=$<0||$===0&&1/$<0?1:0;for($=Math.abs($),isNaN($)||$===1/0?(le=isNaN($)?1:0,ae=de):(ae=Math.floor(Math.log($)/Math.LN2),$*(Ie=Math.pow(2,-ae))<1&&(ae--,Ie*=2),ae+Ne>=1?$+=he/Ie:$+=he*Math.pow(2,1-Ne),$*Ie>=2&&(ae++,Ie/=2),ae+Ne>=de?(le=0,ae=de):ae+Ne>=1?(le=($*Ie-1)*Math.pow(2,Ce),ae=ae+Ne):(le=$*Math.pow(2,Ne-1)*Math.pow(2,Ce),ae=0));Ce>=8;k[oe+ze]=le&255,ze+=pe,le/=256,Ce-=8);for(ae=ae<<Ce|le,ue+=Ce;ue>0;k[oe+ze]=ae&255,ze+=pe,ae/=256,ue-=8);k[oe+ze-pe]|=Ve*128}},{}],24:[function(r,g,V){typeof Object.create=="function"?g.exports=function($,oe){oe&&($.super_=oe,$.prototype=Object.create(oe.prototype,{constructor:{value:$,enumerable:!1,writable:!0,configurable:!0}}))}:g.exports=function($,oe){if(oe){$.super_=oe;var re=function(){};re.prototype=oe.prototype,$.prototype=new re,$.prototype.constructor=$}}},{}],25:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});var k=function(){function $(oe,re){this.color=!0,this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0,this.leftChild=void 0,this.rightChild=void 0,this.key=oe,this.value=re}return $.prototype.rotateLeft=function(){var oe=this.parent,re=this.brother,Ce=this.leftChild,ie=this.rightChild;if(!ie)throw new Error("unknown error");var ae=ie.leftChild,le=ie.rightChild;return oe&&(oe.leftChild===this?oe.leftChild=ie:oe.rightChild===this&&(oe.rightChild=ie)),ie.parent=oe,ie.brother=re,ie.leftChild=this,ie.rightChild=le,re&&(re.brother=ie),this.parent=ie,this.brother=le,this.leftChild=Ce,this.rightChild=ae,le&&(le.parent=ie,le.brother=this),Ce&&(Ce.parent=this,Ce.brother=ae),ae&&(ae.parent=this,ae.brother=Ce),ie},$.prototype.rotateRight=function(){var oe=this.parent,re=this.brother,Ce=this.leftChild;if(!Ce)throw new Error("unknown error");var ie=this.rightChild,ae=Ce.leftChild,le=Ce.rightChild;return oe&&(oe.leftChild===this?oe.leftChild=Ce:oe.rightChild===this&&(oe.rightChild=Ce)),Ce.parent=oe,Ce.brother=re,Ce.leftChild=ae,Ce.rightChild=this,re&&(re.brother=Ce),ae&&(ae.parent=Ce,ae.brother=this),this.parent=Ce,this.brother=ae,this.leftChild=le,this.rightChild=ie,le&&(le.parent=this,le.brother=ie),ie&&(ie.parent=this,ie.brother=le),Ce},$.prototype.remove=function(){if(this.leftChild||this.rightChild)throw new Error("can only remove leaf node");this.parent&&(this===this.parent.leftChild?this.parent.leftChild=void 0:this===this.parent.rightChild&&(this.parent.rightChild=void 0)),this.brother&&(this.brother.brother=void 0),this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0},$.TreeNodeColorType={red:!0,black:!1},$}();Object.freeze(k),V.default=k},{}],26:[function(r,g,V){var k=this&&this.__generator||function(oe,re){var Ce={label:0,sent:function(){if(le[0]&1)throw le[1];return le[1]},trys:[],ops:[]},ie,ae,le,Ie;return Ie={next:ue(0),throw:ue(1),return:ue(2)},typeof Symbol=="function"&&(Ie[Symbol.iterator]=function(){return this}),Ie;function ue(Ne){return function(he){return de([Ne,he])}}function de(Ne){if(ie)throw new TypeError("Generator is already executing.");for(;Ce;)try{if(ie=1,ae&&(le=Ne[0]&2?ae.return:Ne[0]?ae.throw||((le=ae.return)&&le.call(ae),0):ae.next)&&!(le=le.call(ae,Ne[1])).done)return le;switch(ae=0,le&&(Ne=[Ne[0]&2,le.value]),Ne[0]){case 0:case 1:le=Ne;break;case 4:return Ce.label++,{value:Ne[1],done:!1};case 5:Ce.label++,ae=Ne[1],Ne=[0];continue;case 7:Ne=Ce.ops.pop(),Ce.trys.pop();continue;default:if(le=Ce.trys,!(le=le.length>0&&le[le.length-1])&&(Ne[0]===6||Ne[0]===2)){Ce=0;continue}if(Ne[0]===3&&(!le||Ne[1]>le[0]&&Ne[1]<le[3])){Ce.label=Ne[1];break}if(Ne[0]===6&&Ce.label<le[1]){Ce.label=le[1],le=Ne;break}if(le&&Ce.label<le[2]){Ce.label=le[2],Ce.ops.push(Ne);break}le[2]&&Ce.ops.pop(),Ce.trys.pop();continue}Ne=re.call(oe,Ce)}catch(he){Ne=[6,he],ae=0}finally{ie=le=0}if(Ne[0]&5)throw Ne[1];return{value:Ne[0]?Ne[1]:void 0,done:!0}}};Object.defineProperty(V,"__esModule",{value:!0}),$.sigma=3,$.bucketSize=5e3;function $(oe){var re=this;oe===void 0&&(oe=[]);var Ce=[],ie=0,ae=0,le=0,Ie=0,ue=0,de=0;this.size=function(){return de},this.empty=function(){return de===0},this.clear=function(){ie=le=ae=Ie=ue=de=0,he.call(this,$.bucketSize),de=0},this.front=function(){return Ce[ie][ae]},this.back=function(){return Ce[le][Ie]},this.forEach=function(ze){if(!this.empty()){var pe=0;if(ie===le){for(var Ve=ae;Ve<=Ie;++Ve)ze(Ce[ie][Ve],pe++);return}for(var Ve=ae;Ve<$.bucketSize;++Ve)ze(Ce[ie][Ve],pe++);for(var Ve=ie+1;Ve<le;++Ve)for(var Oe=0;Oe<$.bucketSize;++Oe)ze(Ce[Ve][Oe],pe++);for(var Ve=0;Ve<=Ie;++Ve)ze(Ce[le][Ve],pe++)}};var Ne=function(ze){var pe=ie*$.bucketSize+ae,Ve=pe+ze,Oe=le*$.bucketSize+Ie;if(Ve<pe||Ve>Oe)throw new Error("pos should more than 0 and less than queue's size");var _e=Math.floor(Ve/$.bucketSize),At=Ve%$.bucketSize;return{curNodeBucketIndex:_e,curNodePointerIndex:At}};this.getElementByPos=function(ze){var pe=Ne(ze),Ve=pe.curNodeBucketIndex,Oe=pe.curNodePointerIndex;return Ce[Ve][Oe]},this.eraseElementByPos=function(ze){var pe=this;if(ze<0||ze>de)throw new Error("pos should more than 0 and less than queue's size");if(ze===0)this.popFront();else if(ze===this.size())this.popBack();else{for(var Ve=[],Oe=ze+1;Oe<de;++Oe)Ve.push(this.getElementByPos(Oe));this.cut(ze),this.popBack(),Ve.forEach(function(_e){return pe.pushBack(_e)})}},this.eraseElementByValue=function(ze){if(!this.empty()){var pe=[];this.forEach(function(_e){_e!==ze&&pe.push(_e)});for(var Ve=pe.length,Oe=0;Oe<Ve;++Oe)this.setElementByPos(Oe,pe[Oe]);this.cut(Ve-1)}};var he=function(ze){for(var pe=[],Ve=ze*$.sigma,Oe=Math.max(Math.ceil(Ve/$.bucketSize),2),_e=0;_e<Oe;++_e)pe.push(new Array($.bucketSize));var At=Math.ceil(ze/$.bucketSize),$e=Math.floor(Oe/2)-Math.floor(At/2),Fe=$e,Ue=0;if(this.size())for(var _e=0;_e<At;++_e){for(var xe=0;xe<$.bucketSize;++xe)if(pe[$e+_e][xe]=this.front(),this.popFront(),this.empty()){Fe=$e+_e,Ue=xe;break}if(this.empty())break}Ce=pe,ie=$e,ae=0,le=Fe,Ie=Ue,ue=Oe,de=ze};this.pushBack=function(ze){this.empty()||(le===ue-1&&Ie===$.bucketSize-1&&he.call(this,this.size()),Ie<$.bucketSize-1?++Ie:le<ue-1&&(++le,Ie=0)),++de,Ce[le][Ie]=ze},this.popBack=function(){this.empty()||(this.size()!==1&&(Ie>0?--Ie:ie<le&&(--le,Ie=$.bucketSize-1)),de>0&&--de)},this.setElementByPos=function(ze,pe){var Ve=Ne(ze),Oe=Ve.curNodeBucketIndex,_e=Ve.curNodePointerIndex;Ce[Oe][_e]=pe},this.insert=function(ze,pe,Ve){var Oe=this;if(Ve===void 0&&(Ve=1),ze===0)for(;Ve--;)this.pushFront(pe);else if(ze===this.size())for(;Ve--;)this.pushBack(pe);else{for(var _e=[],At=ze;At<de;++At)_e.push(this.getElementByPos(At));this.cut(ze-1);for(var At=0;At<Ve;++At)this.pushBack(pe);_e.forEach(function($e){return Oe.pushBack($e)})}},this.find=function(ze){if(ie===le){for(var pe=ae;pe<=Ie;++pe)if(Ce[ie][pe]===ze)return!0;return!1}for(var pe=ae;pe<$.bucketSize;++pe)if(Ce[ie][pe]===ze)return!0;for(var pe=ie+1;pe<le;++pe)for(var Ve=0;Ve<$.bucketSize;++Ve)if(Ce[pe][Ve]===ze)return!0;for(var pe=0;pe<=Ie;++pe)if(Ce[le][pe]===ze)return!0;return!1},this.reverse=function(){for(var ze=0,pe=de-1;ze<pe;){var Ve=this.getElementByPos(ze);this.setElementByPos(ze,this.getElementByPos(pe)),this.setElementByPos(pe,Ve),++ze,--pe}},this.unique=function(){if(!this.empty()){var ze=[],pe=this.front();this.forEach(function(Oe,_e){(_e===0||Oe!==pe)&&(ze.push(Oe),pe=Oe)});for(var Ve=0;Ve<de;++Ve)this.setElementByPos(Ve,ze[Ve]);this.cut(ze.length-1)}},this.sort=function(ze){var pe=[];this.forEach(function(Oe){pe.push(Oe)}),pe.sort(ze);for(var Ve=0;Ve<de;++Ve)this.setElementByPos(Ve,pe[Ve])},this.pushFront=function(ze){this.empty()||(ie===0&&ae===0&&he.call(this,this.size()),ae>0?--ae:ie>0&&(--ie,ae=$.bucketSize-1)),++de,Ce[ie][ae]=ze},this.popFront=function(){this.empty()||(this.size()!==1&&(ae<$.bucketSize-1?++ae:ie<le&&(++ie,ae=0)),de>0&&--de)},this.shrinkToFit=function(){var ze=this,pe=[];this.forEach(function(At){pe.push(At)});var Ve=pe.length;Ce=[];for(var Oe=Math.ceil(Ve/$.bucketSize),_e=0;_e<Oe;++_e)Ce.push(new Array($.bucketSize));this.clear(),pe.forEach(function(At){return ze.pushBack(At)})},this.cut=function(ze){if(ze<0){this.clear();return}var pe=Ne(ze),Ve=pe.curNodeBucketIndex,Oe=pe.curNodePointerIndex;le=Ve,Ie=Oe,de=ze+1},this[Symbol.iterator]=function(){return function(){var pe,pe,pe,ze,pe;return k(this,function(Ve){switch(Ve.label){case 0:if(de===0)return[2];if(ie!==le)return[3,5];pe=ae,Ve.label=1;case 1:return pe<=Ie?[4,Ce[ie][pe]]:[3,4];case 2:Ve.sent(),Ve.label=3;case 3:return++pe,[3,1];case 4:return[2];case 5:pe=ae,Ve.label=6;case 6:return pe<$.bucketSize?[4,Ce[ie][pe]]:[3,9];case 7:Ve.sent(),Ve.label=8;case 8:return++pe,[3,6];case 9:pe=ie+1,Ve.label=10;case 10:if(!(pe<le))return[3,15];ze=0,Ve.label=11;case 11:return ze<$.bucketSize?[4,Ce[pe][ze]]:[3,14];case 12:Ve.sent(),Ve.label=13;case 13:return++ze,[3,11];case 14:return++pe,[3,10];case 15:pe=0,Ve.label=16;case 16:return pe<=Ie?[4,Ce[le][pe]]:[3,19];case 17:Ve.sent(),Ve.label=18;case 18:return++pe,[3,16];case 19:return[2]}})}()},function(){var ze=$.bucketSize;oe.size?ze=oe.size():oe.length&&(ze=oe.length);var pe=ze*$.sigma;ue=Math.ceil(pe/$.bucketSize),ue=Math.max(ue,3);for(var Ve=0;Ve<ue;++Ve)Ce.push(new Array($.bucketSize));var Oe=Math.ceil(ze/$.bucketSize);ie=Math.floor(ue/2)-Math.floor(Oe/2),le=ie,oe.forEach(function(_e){return re.pushBack(_e)})}(),Object.freeze(this)}Object.freeze($),V.default=$},{}],27:[function(r,g,V){var k=this&&this.__generator||function(ie,ae){var le={label:0,sent:function(){if(de[0]&1)throw de[1];return de[1]},trys:[],ops:[]},Ie,ue,de,Ne;return Ne={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(Ne[Symbol.iterator]=function(){return this}),Ne;function he(pe){return function(Ve){return ze([pe,Ve])}}function ze(pe){if(Ie)throw new TypeError("Generator is already executing.");for(;le;)try{if(Ie=1,ue&&(de=pe[0]&2?ue.return:pe[0]?ue.throw||((de=ue.return)&&de.call(ue),0):ue.next)&&!(de=de.call(ue,pe[1])).done)return de;switch(ue=0,de&&(pe=[pe[0]&2,de.value]),pe[0]){case 0:case 1:de=pe;break;case 4:return le.label++,{value:pe[1],done:!1};case 5:le.label++,ue=pe[1],pe=[0];continue;case 7:pe=le.ops.pop(),le.trys.pop();continue;default:if(de=le.trys,!(de=de.length>0&&de[de.length-1])&&(pe[0]===6||pe[0]===2)){le=0;continue}if(pe[0]===3&&(!de||pe[1]>de[0]&&pe[1]<de[3])){le.label=pe[1];break}if(pe[0]===6&&le.label<de[1]){le.label=de[1],de=pe;break}if(de&&le.label<de[2]){le.label=de[2],le.ops.push(pe);break}de[2]&&le.ops.pop(),le.trys.pop();continue}pe=ae.call(ie,le)}catch(Ve){pe=[6,Ve],ue=0}finally{Ie=de=0}if(pe[0]&5)throw pe[1];return{value:pe[0]?pe[1]:void 0,done:!0}}},$=this&&this.__values||function(ie){var ae=typeof Symbol=="function"&&Symbol.iterator,le=ae&&ie[ae],Ie=0;if(le)return le.call(ie);if(ie&&typeof ie.length=="number")return{next:function(){return ie&&Ie>=ie.length&&(ie=void 0),{value:ie&&ie[Ie++],done:!ie}}};throw new TypeError(ae?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../LinkList/LinkList"),re=r("../Map/Map");Ce.initSize=16,Ce.maxSize=1<<30,Ce.sigma=.75,Ce.treeifyThreshold=8,Ce.untreeifyThreshold=6,Ce.minTreeifySize=64;function Ce(ie,ae,le){var Ie=this;if(ie===void 0&&(ie=[]),ae===void 0&&(ae=Ce.initSize),le=le||function(ze){var pe,Ve,Oe=0,_e="";if(typeof ze=="number")Oe=Math.floor(ze),Oe=(Oe<<5)-Oe,Oe=Oe&Oe;else{typeof ze!="string"?_e=JSON.stringify(ze):_e=ze;try{for(var At=$(_e),$e=At.next();!$e.done;$e=At.next()){var Fe=$e.value,Ue=Fe.charCodeAt(0);Oe=(Oe<<5)-Oe+Ue,Oe=Oe&Oe}}catch(xe){pe={error:xe}}finally{try{$e&&!$e.done&&(Ve=At.return)&&Ve.call(At)}finally{if(pe)throw pe.error}}}return Oe^=Oe>>>16,Oe},ae&ae-1)throw new Error("initBucketNum must be 2 to the power of n");var ue=0,de=[],Ne=Math.max(Ce.initSize,Math.min(Ce.maxSize,ae));this.size=function(){return ue},this.empty=function(){return ue===0},this.clear=function(){ue=0,Ne=ae,de=[]},this.forEach=function(ze){var pe=0;de.forEach(function(Ve){Ve.forEach(function(Oe){ze(Oe,pe++)})})};var he=function(ze){if(!(ze>=Ce.maxSize)){Ne=ze*2;var pe=[];de.forEach(function(Ve,Oe){if(!Ve.empty()){if(Ve instanceof oe.default&&Ve.size()===1){var _e=Ve.front(),At=_e.key,$e=_e.value;pe[le(At)&Ne-1]=new oe.default([{key:At,value:$e}])}else if(Ve instanceof re.default){var Fe=new oe.default,Ue=new oe.default;Ve.forEach(function(qe){var kt=le(qe.key);kt&ze?Ue.pushBack(qe):Fe.pushBack(qe)}),Fe.size()>Ce.untreeifyThreshold?pe[Oe]=new re.default(Fe):Fe.size()&&(pe[Oe]=Fe),Ue.size()>Ce.untreeifyThreshold?pe[Oe+ze]=new re.default(Ue):Ue.size()&&(pe[Oe+ze]=Ue)}else{var xe=new oe.default,Dt=new oe.default;Ve.forEach(function(qe){var kt=le(qe.key);kt&ze?Dt.pushBack(qe):xe.pushBack(qe)}),xe.size()&&(pe[Oe]=xe),Dt.size()&&(pe[Oe+ze]=Dt)}de[Oe].clear()}}),de=pe}};this.setElement=function(ze,pe){var Ve,Oe;if(ze==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(pe==null){this.eraseElementByKey(ze);return}var _e=le(ze)&Ne-1;if(!de[_e])++ue,de[_e]=new oe.default([{key:ze,value:pe}]);else{var At=de[_e].size();if(de[_e]instanceof oe.default){try{for(var $e=$(de[_e]),Fe=$e.next();!Fe.done;Fe=$e.next()){var Ue=Fe.value;if(Ue.key===ze){Ue.value=pe;return}}}catch(Dt){Ve={error:Dt}}finally{try{Fe&&!Fe.done&&(Oe=$e.return)&&Oe.call($e)}finally{if(Ve)throw Ve.error}}de[_e].pushBack({key:ze,value:pe}),de[_e].size()>=Ce.treeifyThreshold&&(de[_e]=new re.default(de[_e]))}else de[_e].setElement(ze,pe);var xe=de[_e].size();ue+=xe-At}ue>Ne*Ce.sigma&&he.call(this,Ne)},this.getElementByKey=function(ze){var pe,Ve,Oe=le(ze)&Ne-1;if(de[Oe]){if(de[Oe]instanceof re.default)return de[Oe].getElementByKey(ze);try{for(var _e=$(de[Oe]),At=_e.next();!At.done;At=_e.next()){var $e=At.value;if($e.key===ze)return $e.value}}catch(Fe){pe={error:Fe}}finally{try{At&&!At.done&&(Ve=_e.return)&&Ve.call(_e)}finally{if(pe)throw pe.error}}}},this.eraseElementByKey=function(ze){var pe,Ve,Oe=le(ze)&Ne-1;if(de[Oe]){var _e=de[Oe].size();if(de[Oe]instanceof re.default)de[Oe].eraseElementByKey(ze),de[Oe].size()<=Ce.untreeifyThreshold&&(de[Oe]=new oe.default(de[Oe]));else{var At=-1;try{for(var $e=$(de[Oe]),Fe=$e.next();!Fe.done;Fe=$e.next()){var Ue=Fe.value;if(++At,Ue.key===ze){de[Oe].eraseElementByPos(At);break}}}catch(Dt){pe={error:Dt}}finally{try{Fe&&!Fe.done&&(Ve=$e.return)&&Ve.call($e)}finally{if(pe)throw pe.error}}}var xe=de[Oe].size();ue+=xe-_e}},this.find=function(ze){var pe,Ve,Oe=le(ze)&Ne-1;if(!de[Oe])return!1;if(de[Oe]instanceof re.default)return de[Oe].find(ze);try{for(var _e=$(de[Oe]),At=_e.next();!At.done;At=_e.next()){var $e=At.value;if($e.key===ze)return!0}}catch(Fe){pe={error:Fe}}finally{try{At&&!At.done&&(Ve=_e.return)&&Ve.call(_e)}finally{if(pe)throw pe.error}}return!1},this[Symbol.iterator]=function(){return function(){var ze,pe,Ve,Oe,_e,At,$e;return k(this,function(Fe){switch(Fe.label){case 0:ze=0,Fe.label=1;case 1:if(!(ze<Ne))return[3,10];for(;ze<Ne&&!de[ze];)++ze;if(ze>=Ne)return[3,10];Fe.label=2;case 2:Fe.trys.push([2,7,8,9]),pe=(At=void 0,$(de[ze])),Ve=pe.next(),Fe.label=3;case 3:return Ve.done?[3,6]:(Oe=Ve.value,[4,Oe]);case 4:Fe.sent(),Fe.label=5;case 5:return Ve=pe.next(),[3,3];case 6:return[3,9];case 7:return _e=Fe.sent(),At={error:_e},[3,9];case 8:try{Ve&&!Ve.done&&($e=pe.return)&&$e.call(pe)}finally{if(At)throw At.error}return[7];case 9:return++ze,[3,1];case 10:return[2]}})}()},ie.forEach(function(ze){var pe=ze.key,Ve=ze.value;return Ie.setElement(pe,Ve)}),Object.freeze(this)}Object.freeze(Ce),V.default=Ce},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(r,g,V){var k=this&&this.__generator||function(ie,ae){var le={label:0,sent:function(){if(de[0]&1)throw de[1];return de[1]},trys:[],ops:[]},Ie,ue,de,Ne;return Ne={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(Ne[Symbol.iterator]=function(){return this}),Ne;function he(pe){return function(Ve){return ze([pe,Ve])}}function ze(pe){if(Ie)throw new TypeError("Generator is already executing.");for(;le;)try{if(Ie=1,ue&&(de=pe[0]&2?ue.return:pe[0]?ue.throw||((de=ue.return)&&de.call(ue),0):ue.next)&&!(de=de.call(ue,pe[1])).done)return de;switch(ue=0,de&&(pe=[pe[0]&2,de.value]),pe[0]){case 0:case 1:de=pe;break;case 4:return le.label++,{value:pe[1],done:!1};case 5:le.label++,ue=pe[1],pe=[0];continue;case 7:pe=le.ops.pop(),le.trys.pop();continue;default:if(de=le.trys,!(de=de.length>0&&de[de.length-1])&&(pe[0]===6||pe[0]===2)){le=0;continue}if(pe[0]===3&&(!de||pe[1]>de[0]&&pe[1]<de[3])){le.label=pe[1];break}if(pe[0]===6&&le.label<de[1]){le.label=de[1],de=pe;break}if(de&&le.label<de[2]){le.label=de[2],le.ops.push(pe);break}de[2]&&le.ops.pop(),le.trys.pop();continue}pe=ae.call(ie,le)}catch(Ve){pe=[6,Ve],ue=0}finally{Ie=de=0}if(pe[0]&5)throw pe[1];return{value:pe[0]?pe[1]:void 0,done:!0}}},$=this&&this.__values||function(ie){var ae=typeof Symbol=="function"&&Symbol.iterator,le=ae&&ie[ae],Ie=0;if(le)return le.call(ie);if(ie&&typeof ie.length=="number")return{next:function(){return ie&&Ie>=ie.length&&(ie=void 0),{value:ie&&ie[Ie++],done:!ie}}};throw new TypeError(ae?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../Set/Set"),re=r("../LinkList/LinkList");Ce.initSize=16,Ce.maxSize=1<<30,Ce.sigma=.75,Ce.treeifyThreshold=8,Ce.untreeifyThreshold=6,Ce.minTreeifySize=64;function Ce(ie,ae,le){var Ie=this;if(ie===void 0&&(ie=[]),ae===void 0&&(ae=Ce.initSize),le=le||function(ze){var pe=0,Ve="";if(typeof ze=="number")pe=Math.floor(ze),pe=(pe<<5)-pe,pe=pe&pe;else{typeof ze!="string"?Ve=JSON.stringify(ze):Ve=ze;for(var Oe=0;Oe<Ve.length;Oe++){var _e=Ve.charCodeAt(Oe);pe=(pe<<5)-pe+_e,pe=pe&pe}}return pe^=pe>>>16,pe},ae&ae-1)throw new Error("initBucketNum must be 2 to the power of n");var ue=0,de=[],Ne=Math.max(Ce.initSize,Math.min(Ce.maxSize,ae));this.size=function(){return ue},this.empty=function(){return ue===0},this.clear=function(){ue=0,Ne=ae,de=[]},this.forEach=function(ze){var pe=0;de.forEach(function(Ve){Ve.forEach(function(Oe){ze(Oe,pe++)})})};var he=function(ze){if(!(ze>=Ce.maxSize)){Ne=ze*2;var pe=[];de.forEach(function(Ve,Oe){if(!Ve.empty()){if(Ve instanceof re.default&&Ve.size()===1){var _e=Ve.front();if(_e===void 0)throw new Error("unknown error");pe[le(_e)&Ne-1]=new re.default([_e])}else if(Ve instanceof oe.default){var At=new re.default,$e=new re.default;Ve.forEach(function(xe){var Dt=le(xe);Dt&ze?$e.pushBack(xe):At.pushBack(xe)}),At.size()>Ce.untreeifyThreshold?pe[Oe]=new oe.default(At):At.size()&&(pe[Oe]=At),$e.size()>Ce.untreeifyThreshold?pe[Oe+ze]=new oe.default($e):$e.size()&&(pe[Oe+ze]=$e)}else{var Fe=new re.default,Ue=new re.default;Ve.forEach(function(xe){var Dt=le(xe);Dt&ze?Ue.pushBack(xe):Fe.pushBack(xe)}),Fe.size()&&(pe[Oe]=Fe),Ue.size()&&(pe[Oe+ze]=Ue)}de[Oe].clear()}}),de=pe}};this.insert=function(ze){if(ze==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var pe=le(ze)&Ne-1;if(!de[pe])de[pe]=new re.default([ze]),++ue;else{var Ve=de[pe].size();if(de[pe]instanceof re.default){if(de[pe].find(ze))return;de[pe].pushBack(ze),de[pe].size()>=Ce.treeifyThreshold&&(de[pe]=new oe.default(de[pe]))}else de[pe].insert(ze);var Oe=de[pe].size();ue+=Oe-Ve}ue>Ne*Ce.sigma&&he.call(this,Ne)},this.eraseElementByValue=function(ze){var pe=le(ze)&Ne-1;if(de[pe]){var Ve=de[pe].size();de[pe].eraseElementByValue(ze),de[pe]instanceof oe.default&&de[pe].size()<=Ce.untreeifyThreshold&&(de[pe]=new re.default(de[pe]));var Oe=de[pe].size();ue+=Oe-Ve}},this.find=function(ze){var pe=le(ze)&Ne-1;return de[pe]?de[pe].find(ze):!1},this[Symbol.iterator]=function(){return function(){var ze,pe,Ve,Oe,_e,At,$e;return k(this,function(Fe){switch(Fe.label){case 0:ze=0,Fe.label=1;case 1:if(!(ze<Ne))return[3,10];for(;ze<Ne&&!de[ze];)++ze;if(ze>=Ne)return[3,10];Fe.label=2;case 2:Fe.trys.push([2,7,8,9]),pe=(At=void 0,$(de[ze])),Ve=pe.next(),Fe.label=3;case 3:return Ve.done?[3,6]:(Oe=Ve.value,[4,Oe]);case 4:Fe.sent(),Fe.label=5;case 5:return Ve=pe.next(),[3,3];case 6:return[3,9];case 7:return _e=Fe.sent(),At={error:_e},[3,9];case 8:try{Ve&&!Ve.done&&($e=pe.return)&&$e.call(pe)}finally{if(At)throw At.error}return[7];case 9:return++ze,[3,1];case 10:return[2]}})}()},ie.forEach(function(ze){return Ie.insert(ze)}),Object.freeze(this)}Object.freeze(Ce),V.default=Ce},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(r,g,V){var k=this&&this.__generator||function(re,Ce){var ie={label:0,sent:function(){if(Ie[0]&1)throw Ie[1];return Ie[1]},trys:[],ops:[]},ae,le,Ie,ue;return ue={next:de(0),throw:de(1),return:de(2)},typeof Symbol=="function"&&(ue[Symbol.iterator]=function(){return this}),ue;function de(he){return function(ze){return Ne([he,ze])}}function Ne(he){if(ae)throw new TypeError("Generator is already executing.");for(;ie;)try{if(ae=1,le&&(Ie=he[0]&2?le.return:he[0]?le.throw||((Ie=le.return)&&Ie.call(le),0):le.next)&&!(Ie=Ie.call(le,he[1])).done)return Ie;switch(le=0,Ie&&(he=[he[0]&2,Ie.value]),he[0]){case 0:case 1:Ie=he;break;case 4:return ie.label++,{value:he[1],done:!1};case 5:ie.label++,le=he[1],he=[0];continue;case 7:he=ie.ops.pop(),ie.trys.pop();continue;default:if(Ie=ie.trys,!(Ie=Ie.length>0&&Ie[Ie.length-1])&&(he[0]===6||he[0]===2)){ie=0;continue}if(he[0]===3&&(!Ie||he[1]>Ie[0]&&he[1]<Ie[3])){ie.label=he[1];break}if(he[0]===6&&ie.label<Ie[1]){ie.label=Ie[1],Ie=he;break}if(Ie&&ie.label<Ie[2]){ie.label=Ie[2],ie.ops.push(he);break}Ie[2]&&ie.ops.pop(),ie.trys.pop();continue}he=Ce.call(re,ie)}catch(ze){he=[6,ze],le=0}finally{ae=Ie=0}if(he[0]&5)throw he[1];return{value:he[0]?he[1]:void 0,done:!0}}};Object.defineProperty(V,"__esModule",{value:!0});var $=function(){function re(Ce){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=Ce}return re}();function oe(re){var Ce=this;re===void 0&&(re=[]);var ie=0,ae=void 0,le=void 0;this.size=function(){return ie},this.empty=function(){return ie===0},this.clear=function(){ae=le=void 0,ie=0},this.front=function(){return ae==null?void 0:ae.value},this.back=function(){return le==null?void 0:le.value},this.forEach=function(Ie){for(var ue=ae,de=0;ue;){if(ue.value===void 0)throw new Error("unknown error");Ie(ue.value,de++),ue=ue.next}},this.getElementByPos=function(Ie){if(Ie<0||Ie>=ie)throw new Error("pos must more then 0 and less then the list length");for(var ue=ae;Ie--&&ue;)ue=ue.next;if(!ue||ue.value===void 0)throw new Error("unknown error");return ue.value},this.eraseElementByPos=function(Ie){if(Ie<0||Ie>=ie)throw new Error("erase pos must more then 0 and less then the list length");if(Ie===0)this.popFront();else if(Ie===ie-1)this.popBack();else{for(var ue=ae;Ie--;){if(!(ue!=null&&ue.next))throw new Error("unknown error");ue=ue.next}if(!ue||!ue.pre||!ue.next)throw new Error("unknown error");var de=ue.pre,Ne=ue.next;Ne.pre=de,de.next=Ne,ie>0&&--ie}},this.eraseElementByValue=function(Ie){for(;ae&&ae.value===Ie;)this.popFront();for(;le&&le.value===Ie;)this.popBack();if(ae)for(var ue=ae;ue;){if(ue.value===Ie){var de=ue.pre,Ne=ue.next;Ne&&(Ne.pre=de),de&&(de.next=Ne),ie>0&&--ie}ue=ue.next}},this.pushBack=function(Ie){if(Ie==null)throw new Error("you can't push null or undefined here");++ie;var ue=new $(Ie);le?(le.next=ue,ue.pre=le,le=ue):ae=le=ue},this.popBack=function(){le&&(ie>0&&--ie,le&&(ae===le?ae=le=void 0:(le=le.pre,le&&(le.next=void 0))))},this.setElementByPos=function(Ie,ue){if(ue==null)throw new Error("you can't set null or undefined here");if(Ie<0||Ie>=ie)throw new Error("pos must more then 0 and less then the list length");for(var de=ae;Ie--;){if(!de)throw new Error("unknown error");de=de.next}de&&(de.value=ue)},this.insert=function(Ie,ue,de){if(de===void 0&&(de=1),ue==null)throw new Error("you can't insert null or undefined here");if(Ie<0||Ie>ie)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(de<0)throw new Error("insert size must more than 0");if(Ie===0)for(;de--;)this.pushFront(ue);else if(Ie===ie)for(;de--;)this.pushBack(ue);else{for(var Ne=ae,he=1;he<Ie;++he){if(!(Ne!=null&&Ne.next))throw new Error("unknown error");Ne=Ne==null?void 0:Ne.next}if(!Ne)throw new Error("unknown error");var ze=Ne.next;for(ie+=de;de--;)Ne.next=new $(ue),Ne.next.pre=Ne,Ne=Ne.next;Ne.next=ze,ze&&(ze.pre=Ne)}},this.find=function(Ie){for(var ue=ae;ue;){if(ue.value===Ie)return!0;ue=ue.next}return!1},this.reverse=function(){for(var Ie=ae,ue=le,de=0;Ie&&ue&&de*2<ie;){var Ne=Ie.value;Ie.value=ue.value,ue.value=Ne,Ie=Ie.next,ue=ue.pre,++de}},this.unique=function(){for(var Ie=ae;Ie;){for(var ue=Ie;ue&&ue.next&&ue.value===ue.next.value;)ue=ue.next,ie>0&&--ie;Ie.next=ue.next,Ie.next&&(Ie.next.pre=Ie),Ie=Ie.next}},this.sort=function(Ie){var ue=[];this.forEach(function(Ne){ue.push(Ne)}),ue.sort(Ie);var de=ae;ue.forEach(function(Ne){de&&(de.value=Ne,de=de.next)})},this.pushFront=function(Ie){if(Ie==null)throw new Error("you can't push null or undefined here");++ie;var ue=new $(Ie);ae?(ue.next=ae,ae.pre=ue,ae=ue):ae=le=ue},this.popFront=function(){ae&&(ie>0&&--ie,ae&&(ae===le?ae=le=void 0:(ae=ae.next,ae&&(ae.pre=void 0))))},this.merge=function(Ie){var ue=this,de=ae;Ie.forEach(function(Ne){for(;de&&de.value!==void 0&&de.value<=Ne;)de=de.next;if(de===void 0)ue.pushBack(Ne),de=le;else if(de===ae)ue.pushFront(Ne),de=ae;else{++ie;var he=de.pre;he&&(he.next=new $(Ne),he.next.pre=he,he.next.next=de,de&&(de.pre=he.next))}})},this[Symbol.iterator]=function(){return function(){var Ie;return k(this,function(ue){switch(ue.label){case 0:Ie=ae,ue.label=1;case 1:if(Ie===void 0)return[3,3];if(!Ie.value)throw new Error("unknown error");return[4,Ie.value];case 2:return ue.sent(),Ie=Ie.next,[3,1];case 3:return[2]}})}()},re.forEach(function(Ie){return Ce.pushBack(Ie)}),Object.freeze(this)}Object.freeze(oe),V.default=oe},{}],30:[function(r,g,V){var k=this&&this.__generator||function(Ce,ie){var ae={label:0,sent:function(){if(ue[0]&1)throw ue[1];return ue[1]},trys:[],ops:[]},le,Ie,ue,de;return de={next:Ne(0),throw:Ne(1),return:Ne(2)},typeof Symbol=="function"&&(de[Symbol.iterator]=function(){return this}),de;function Ne(ze){return function(pe){return he([ze,pe])}}function he(ze){if(le)throw new TypeError("Generator is already executing.");for(;ae;)try{if(le=1,Ie&&(ue=ze[0]&2?Ie.return:ze[0]?Ie.throw||((ue=Ie.return)&&ue.call(Ie),0):Ie.next)&&!(ue=ue.call(Ie,ze[1])).done)return ue;switch(Ie=0,ue&&(ze=[ze[0]&2,ue.value]),ze[0]){case 0:case 1:ue=ze;break;case 4:return ae.label++,{value:ze[1],done:!1};case 5:ae.label++,Ie=ze[1],ze=[0];continue;case 7:ze=ae.ops.pop(),ae.trys.pop();continue;default:if(ue=ae.trys,!(ue=ue.length>0&&ue[ue.length-1])&&(ze[0]===6||ze[0]===2)){ae=0;continue}if(ze[0]===3&&(!ue||ze[1]>ue[0]&&ze[1]<ue[3])){ae.label=ze[1];break}if(ze[0]===6&&ae.label<ue[1]){ae.label=ue[1],ue=ze;break}if(ue&&ae.label<ue[2]){ae.label=ue[2],ae.ops.push(ze);break}ue[2]&&ae.ops.pop(),ae.trys.pop();continue}ze=ie.call(Ce,ae)}catch(pe){ze=[6,pe],Ie=0}finally{le=ue=0}if(ze[0]&5)throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}},$=this&&this.__values||function(Ce){var ie=typeof Symbol=="function"&&Symbol.iterator,ae=ie&&Ce[ie],le=0;if(ae)return ae.call(Ce);if(Ce&&typeof Ce.length=="number")return{next:function(){return Ce&&le>=Ce.length&&(Ce=void 0),{value:Ce&&Ce[le++],done:!Ce}}};throw new TypeError(ie?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../Base/TreeNode");function re(Ce,ie){var ae=this;Ce===void 0&&(Ce=[]),ie=ie||function(xe,Dt){return xe<Dt?-1:xe>Dt?1:0};var le=0,Ie=new oe.default;Ie.color=oe.default.TreeNodeColorType.black,this.size=function(){return le},this.empty=function(){return le===0},this.clear=function(){le=0,Ie.key=Ie.value=void 0,Ie.leftChild=Ie.rightChild=Ie.brother=void 0};var ue=function(xe){if(!xe||xe.key===void 0)throw new Error("unknown error");return xe.leftChild?ue(xe.leftChild):xe},de=function(xe){if(!xe||xe.key===void 0)throw new Error("unknown error");return xe.rightChild?de(xe.rightChild):xe};this.front=function(){if(!this.empty()){var xe=ue(Ie);if(xe.key===void 0||xe.value===void 0)throw new Error("unknown error");return{key:xe.key,value:xe.value}}},this.back=function(){if(!this.empty()){var xe=de(Ie);if(xe.key===void 0||xe.value===void 0)throw new Error("unknown error");return{key:xe.key,value:xe.value}}},this.forEach=function(xe){var Dt,qe,kt=0;try{for(var Et=$(this),jt=Et.next();!jt.done;jt=Et.next()){var ti=jt.value;xe(ti,kt++)}}catch(Lt){Dt={error:Lt}}finally{try{jt&&!jt.done&&(qe=Et.return)&&qe.call(Et)}finally{if(Dt)throw Dt.error}}},this.getElementByPos=function(xe){var Dt,qe;if(xe<0||xe>=this.size())throw new Error("pos must more than 0 and less than set's size");var kt=0;try{for(var Et=$(this),jt=Et.next();!jt.done;jt=Et.next()){var ti=jt.value;if(kt===xe)return ti;++kt}}catch(Lt){Dt={error:Lt}}finally{try{jt&&!jt.done&&(qe=Et.return)&&qe.call(Et)}finally{if(Dt)throw Dt.error}}throw new Error("unknown Error")};var Ne=function(xe,Dt){if(!(!xe||xe.key===void 0||xe.value===void 0)){var qe=ie(xe.key,Dt);return qe===0?{key:xe.key,value:xe.value}:qe<0?Ne(xe.rightChild,Dt):Ne(xe.leftChild,Dt)||{key:xe.key,value:xe.value}}};this.lowerBound=function(xe){return Ne(Ie,xe)};var he=function(xe,Dt){if(!(!xe||xe.key===void 0||xe.value===void 0)){var qe=ie(xe.key,Dt);return qe<=0?he(xe.rightChild,Dt):he(xe.leftChild,Dt)||{key:xe.key,value:xe.value}}};this.upperBound=function(xe){return he(Ie,xe)};var ze=function(xe,Dt){if(!(!xe||xe.key===void 0||xe.value===void 0)){var qe=ie(xe.key,Dt);return qe===0?{key:xe.key,value:xe.value}:qe>0?ze(xe.leftChild,Dt):ze(xe.rightChild,Dt)||{key:xe.key,value:xe.value}}};this.reverseLowerBound=function(xe){return ze(Ie,xe)};var pe=function(xe,Dt){if(!(!xe||xe.key===void 0||xe.value===void 0)){var qe=ie(xe.key,Dt);return qe>=0?pe(xe.leftChild,Dt):pe(xe.rightChild,Dt)||{key:xe.key,value:xe.value}}};this.reverseUpperBound=function(xe){return pe(Ie,xe)};var Ve=function(xe){var Dt=xe.parent;if(!Dt){if(xe===Ie)return;throw new Error("unknown error")}if(xe.color===oe.default.TreeNodeColorType.red){xe.color=oe.default.TreeNodeColorType.black;return}var qe=xe.brother;if(!qe)throw new Error("unknown error");if(xe===Dt.leftChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),Ve(xe)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),xe.color=oe.default.TreeNodeColorType.black}else if((!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateRight();Ie===qe&&(Ie=kt),Ve(xe)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,Ve(Dt))}else if(xe===Dt.rightChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),Ve(xe)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),xe.color=oe.default.TreeNodeColorType.black}else if((!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateLeft();Ie===qe&&(Ie=kt),Ve(xe)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,Ve(Dt))}},Oe=function(xe){for(var Dt=xe;Dt.leftChild||Dt.rightChild;){if(Dt.rightChild){Dt=ue(Dt.rightChild);var qe=xe.key;xe.key=Dt.key,Dt.key=qe;var kt=xe.value;xe.value=Dt.value,Dt.value=kt,xe=Dt}if(Dt.leftChild){Dt=de(Dt.leftChild);var qe=xe.key;xe.key=Dt.key,Dt.key=qe;var kt=xe.value;xe.value=Dt.value,Dt.value=kt,xe=Dt}}Ve(Dt),Dt&&Dt.remove(),--le,Ie.color=oe.default.TreeNodeColorType.black},_e=function(xe,Dt){if(!xe||xe.key===void 0)return!1;var qe=_e(xe.leftChild,Dt);return qe||Dt(xe)?!0:_e(xe.rightChild,Dt)};this.eraseElementByPos=function(xe){if(xe<0||xe>=le)throw new Error("pos must more than 0 and less than set's size");var Dt=0;_e(Ie,function(qe){return xe===Dt?(Oe(qe),!0):(++Dt,!1)})},this.eraseElementByKey=function(xe){if(!this.empty()){var Dt=Fe(Ie,xe);Dt===void 0||Dt.key===void 0||ie(Dt.key,xe)!==0||Oe(Dt)}};var At=function(xe,Dt){if(!xe||xe.key===void 0)throw new Error("unknown error");var qe=ie(Dt,xe.key);return qe<0?xe.leftChild?At(xe.leftChild,Dt):(xe.leftChild=new oe.default,xe.leftChild.parent=xe,xe.leftChild.brother=xe.rightChild,xe.rightChild&&(xe.rightChild.brother=xe.leftChild),xe.leftChild):qe>0?xe.rightChild?At(xe.rightChild,Dt):(xe.rightChild=new oe.default,xe.rightChild.parent=xe,xe.rightChild.brother=xe.leftChild,xe.leftChild&&(xe.leftChild.brother=xe.rightChild),xe.rightChild):xe},$e=function(xe){var Dt=xe.parent;if(!Dt){if(xe===Ie)return;throw new Error("unknown error")}if(Dt.color!==oe.default.TreeNodeColorType.black&&Dt.color===oe.default.TreeNodeColorType.red){var qe=Dt.brother,kt=Dt.parent;if(!kt)throw new Error("unknown error");if(qe&&qe.color===oe.default.TreeNodeColorType.red)qe.color=Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red,$e(kt);else if(!qe||qe.color===oe.default.TreeNodeColorType.black){if(Dt===kt.leftChild){if(xe===Dt.leftChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var Et=kt.rotateRight();kt===Ie&&(Ie=Et)}else if(xe===Dt.rightChild){var Et=Dt.rotateLeft();kt===Ie&&(Ie=Et),$e(Dt)}}else if(Dt===kt.rightChild){if(xe===Dt.leftChild){var Et=Dt.rotateRight();kt===Ie&&(Ie=Et),$e(Dt)}else if(xe===Dt.rightChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var Et=kt.rotateLeft();kt===Ie&&(Ie=Et)}}}}};this.setElement=function(xe,Dt){if(xe==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(Dt==null){this.eraseElementByKey(xe);return}if(this.empty()){++le,Ie.key=xe,Ie.value=Dt,Ie.color=oe.default.TreeNodeColorType.black;return}var qe=At(Ie,xe);if(qe.key!==void 0&&ie(qe.key,xe)===0){qe.value=Dt;return}++le,qe.key=xe,qe.value=Dt,$e(qe),Ie.color=oe.default.TreeNodeColorType.black};var Fe=function(xe,Dt){if(!(!xe||xe.key===void 0)){var qe=ie(Dt,xe.key);return qe<0?Fe(xe.leftChild,Dt):qe>0?Fe(xe.rightChild,Dt):xe}};this.find=function(xe){return!!Fe(Ie,xe)},this.getElementByKey=function(xe){var Dt=Fe(Ie,xe);if((Dt==null?void 0:Dt.key)===void 0||(Dt==null?void 0:Dt.value)===void 0)throw new Error("unknown error");return Dt.value},this.union=function(xe){var Dt=this;xe.forEach(function(qe){var kt=qe.key,Et=qe.value;return Dt.setElement(kt,Et)})},this.getHeight=function(){if(this.empty())return 0;var xe=function(Dt){return Dt?Math.max(xe(Dt.leftChild),xe(Dt.rightChild))+1:1};return xe(Ie)};var Ue=function(xe){return k(this,function(Dt){switch(Dt.label){case 0:return!xe||xe.key===void 0||xe.value===void 0?[2]:[5,$(Ue(xe.leftChild))];case 1:return Dt.sent(),[4,{key:xe.key,value:xe.value}];case 2:return Dt.sent(),[5,$(Ue(xe.rightChild))];case 3:return Dt.sent(),[2]}})};this[Symbol.iterator]=function(){return Ue(Ie)},Ce.forEach(function(xe){var Dt=xe.key,qe=xe.value;return ae.setElement(Dt,qe)}),Object.freeze(this)}Object.freeze(re),V.default=re},{"../Base/TreeNode":25}],31:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});function k($,oe){$===void 0&&($=[]),oe=oe||function(le,Ie){return le>Ie?-1:le<Ie?1:0};var re=[];$.forEach(function(le){return re.push(le)});var Ce=re.length,ie=function(le,Ie){if(le<0||le>=Ce)throw new Error("unknown error");if(Ie<0||Ie>=Ce)throw new Error("unknown error");var ue=re[le];re[le]=re[Ie],re[Ie]=ue},ae=function(le){if(le<0||le>=Ce)throw new Error("unknown error");var Ie=le*2+1,ue=le*2+2;Ie<Ce&&oe(re[le],re[Ie])>0&&ie(le,Ie),ue<Ce&&oe(re[le],re[ue])>0&&ie(le,ue)};(function(){for(var le=Math.floor((Ce-1)/2);le>=0;--le)for(var Ie=le,ue=Ie*2+1;ue<Ce;){var de=ue,Ne=de+1,he=de;if(Ne<Ce&&oe(re[de],re[Ne])>0&&(he=Ne),oe(re[Ie],re[he])<=0)break;ie(Ie,he),Ie=he,ue=Ie*2+1}})(),this.size=function(){return Ce},this.empty=function(){return Ce===0},this.clear=function(){Ce=0,re.length=0},this.push=function(le){if(re.push(le),++Ce,Ce!==1)for(var Ie=Ce-1;Ie>0;){var ue=Math.floor((Ie-1)/2);if(oe(re[ue],le)<=0)break;ae(ue),Ie=ue}},this.pop=function(){if(!this.empty()){if(this.size()===1){--Ce;return}var le=re[Ce-1];--Ce;for(var Ie=0;Ie<this.size();){var ue=Ie*2+1,de=Ie*2+2;if(ue>=this.size())break;var Ne=ue;if(de<this.size()&&oe(re[ue],re[de])>0&&(Ne=de),oe(re[Ne],le)>=0)break;re[Ie]=re[Ne],Ie=Ne}re[Ie]=le}},this.top=function(){return re[0]},Object.freeze(this)}Object.freeze(k),V.default=k},{}],32:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});var k=r("../LinkList/LinkList");function $(oe){oe===void 0&&(oe=[]);var re=new k.default(oe);this.size=function(){return re.size()},this.empty=function(){return re.empty()},this.clear=function(){re.clear()},this.push=function(Ce){re.pushBack(Ce)},this.pop=function(){re.popFront()},this.front=function(){return re.front()},Object.freeze(this)}Object.freeze($),V.default=$},{"../LinkList/LinkList":29}],33:[function(r,g,V){var k=this&&this.__generator||function(Ce,ie){var ae={label:0,sent:function(){if(ue[0]&1)throw ue[1];return ue[1]},trys:[],ops:[]},le,Ie,ue,de;return de={next:Ne(0),throw:Ne(1),return:Ne(2)},typeof Symbol=="function"&&(de[Symbol.iterator]=function(){return this}),de;function Ne(ze){return function(pe){return he([ze,pe])}}function he(ze){if(le)throw new TypeError("Generator is already executing.");for(;ae;)try{if(le=1,Ie&&(ue=ze[0]&2?Ie.return:ze[0]?Ie.throw||((ue=Ie.return)&&ue.call(Ie),0):Ie.next)&&!(ue=ue.call(Ie,ze[1])).done)return ue;switch(Ie=0,ue&&(ze=[ze[0]&2,ue.value]),ze[0]){case 0:case 1:ue=ze;break;case 4:return ae.label++,{value:ze[1],done:!1};case 5:ae.label++,Ie=ze[1],ze=[0];continue;case 7:ze=ae.ops.pop(),ae.trys.pop();continue;default:if(ue=ae.trys,!(ue=ue.length>0&&ue[ue.length-1])&&(ze[0]===6||ze[0]===2)){ae=0;continue}if(ze[0]===3&&(!ue||ze[1]>ue[0]&&ze[1]<ue[3])){ae.label=ze[1];break}if(ze[0]===6&&ae.label<ue[1]){ae.label=ue[1],ue=ze;break}if(ue&&ae.label<ue[2]){ae.label=ue[2],ae.ops.push(ze);break}ue[2]&&ae.ops.pop(),ae.trys.pop();continue}ze=ie.call(Ce,ae)}catch(pe){ze=[6,pe],Ie=0}finally{le=ue=0}if(ze[0]&5)throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}},$=this&&this.__values||function(Ce){var ie=typeof Symbol=="function"&&Symbol.iterator,ae=ie&&Ce[ie],le=0;if(ae)return ae.call(Ce);if(Ce&&typeof Ce.length=="number")return{next:function(){return Ce&&le>=Ce.length&&(Ce=void 0),{value:Ce&&Ce[le++],done:!Ce}}};throw new TypeError(ie?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../Base/TreeNode");function re(Ce,ie){var ae=this;Ce===void 0&&(Ce=[]),ie=ie||function(xe,Dt){return xe<Dt?-1:xe>Dt?1:0};var le=0,Ie=new oe.default;Ie.color=oe.default.TreeNodeColorType.black,this.size=function(){return le},this.empty=function(){return le===0},this.clear=function(){le=0,Ie.key=void 0,Ie.leftChild=Ie.rightChild=Ie.brother=Ie.parent=void 0,Ie.color=oe.default.TreeNodeColorType.black};var ue=function(xe){if(!xe||xe.key===void 0)throw new Error("unknown error");return xe.leftChild?ue(xe.leftChild):xe},de=function(xe){if(!xe||xe.key===void 0)throw new Error("unknown error");return xe.rightChild?de(xe.rightChild):xe};this.front=function(){if(!this.empty()){var xe=ue(Ie);return xe.key}},this.back=function(){if(!this.empty()){var xe=de(Ie);return xe.key}},this.forEach=function(xe){var Dt,qe,kt=0;try{for(var Et=$(this),jt=Et.next();!jt.done;jt=Et.next()){var ti=jt.value;xe(ti,kt++)}}catch(Lt){Dt={error:Lt}}finally{try{jt&&!jt.done&&(qe=Et.return)&&qe.call(Et)}finally{if(Dt)throw Dt.error}}},this.getElementByPos=function(xe){var Dt,qe;if(xe<0||xe>=this.size())throw new Error("pos must more than 0 and less than set's size");var kt=0;try{for(var Et=$(this),jt=Et.next();!jt.done;jt=Et.next()){var ti=jt.value;if(kt===xe)return ti;++kt}}catch(Lt){Dt={error:Lt}}finally{try{jt&&!jt.done&&(qe=Et.return)&&qe.call(Et)}finally{if(Dt)throw Dt.error}}throw new Error("unknown error")};var Ne=function(xe){var Dt=xe.parent;if(!Dt){if(xe===Ie)return;throw new Error("unknown error")}if(xe.color===oe.default.TreeNodeColorType.red){xe.color=oe.default.TreeNodeColorType.black;return}var qe=xe.brother;if(!qe)throw new Error("unknown error");if(xe===Dt.leftChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),Ne(xe)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),xe.color=oe.default.TreeNodeColorType.black}else if((!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateRight();Ie===qe&&(Ie=kt),Ne(xe)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,Ne(Dt))}else if(xe===Dt.rightChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),Ne(xe)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),xe.color=oe.default.TreeNodeColorType.black}else if((!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateLeft();Ie===qe&&(Ie=kt),Ne(xe)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,Ne(Dt))}},he=function(xe){for(var Dt=xe;Dt.leftChild||Dt.rightChild;){if(Dt.rightChild){Dt=ue(Dt.rightChild);var qe=xe.key;xe.key=Dt.key,Dt.key=qe,xe=Dt}if(Dt.leftChild){Dt=de(Dt.leftChild);var qe=xe.key;xe.key=Dt.key,Dt.key=qe,xe=Dt}}Ne(Dt),Dt&&Dt.remove(),--le,Ie.color=oe.default.TreeNodeColorType.black},ze=function(xe,Dt){if(!xe||xe.key===void 0)return!1;var qe=ze(xe.leftChild,Dt);return qe||Dt(xe)?!0:ze(xe.rightChild,Dt)};this.eraseElementByPos=function(xe){if(xe<0||xe>=le)throw new Error("pos must more than 0 and less than set's size");var Dt=0;ze(Ie,function(qe){return xe===Dt?(he(qe),!0):(++Dt,!1)})},this.eraseElementByValue=function(xe){if(!this.empty()){var Dt=Oe(Ie,xe);Dt===void 0||Dt.key===void 0||ie(Dt.key,xe)!==0||he(Dt)}};var pe=function(xe,Dt){if(!xe||xe.key===void 0)throw new Error("unknown error");var qe=ie(Dt,xe.key);return qe<0?xe.leftChild?pe(xe.leftChild,Dt):(xe.leftChild=new oe.default,xe.leftChild.parent=xe,xe.leftChild.brother=xe.rightChild,xe.rightChild&&(xe.rightChild.brother=xe.leftChild),xe.leftChild):qe>0?xe.rightChild?pe(xe.rightChild,Dt):(xe.rightChild=new oe.default,xe.rightChild.parent=xe,xe.rightChild.brother=xe.leftChild,xe.leftChild&&(xe.leftChild.brother=xe.rightChild),xe.rightChild):xe},Ve=function(xe){var Dt=xe.parent;if(!Dt){if(xe===Ie)return;throw new Error("unknown error")}if(Dt.color!==oe.default.TreeNodeColorType.black&&Dt.color===oe.default.TreeNodeColorType.red){var qe=Dt.brother,kt=Dt.parent;if(!kt)throw new Error("unknown error");if(qe&&qe.color===oe.default.TreeNodeColorType.red)qe.color=Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red,Ve(kt);else if(!qe||qe.color===oe.default.TreeNodeColorType.black){if(Dt===kt.leftChild){if(xe===Dt.leftChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var Et=kt.rotateRight();kt===Ie&&(Ie=Et)}else if(xe===Dt.rightChild){var Et=Dt.rotateLeft();kt===Ie&&(Ie=Et),Ve(Dt)}}else if(Dt===kt.rightChild){if(xe===Dt.leftChild){var Et=Dt.rotateRight();kt===Ie&&(Ie=Et),Ve(Dt)}else if(xe===Dt.rightChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var Et=kt.rotateLeft();kt===Ie&&(Ie=Et)}}}}};this.insert=function(xe){if(xe==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty()){++le,Ie.key=xe,Ie.color=oe.default.TreeNodeColorType.black;return}var Dt=pe(Ie,xe);Dt.key!==void 0&&ie(Dt.key,xe)===0||(++le,Dt.key=xe,Ve(Dt),Ie.color=oe.default.TreeNodeColorType.black)};var Oe=function(xe,Dt){if(!(!xe||xe.key===void 0)){var qe=ie(Dt,xe.key);return qe<0?Oe(xe.leftChild,Dt):qe>0?Oe(xe.rightChild,Dt):xe}};this.find=function(xe){var Dt=Oe(Ie,xe);return Dt!==void 0&&Dt.key!==void 0&&ie(Dt.key,xe)===0};var _e=function(xe,Dt){if(!(!xe||xe.key===void 0)){var qe=ie(xe.key,Dt);if(qe===0)return xe.key;if(qe<0)return _e(xe.rightChild,Dt);var kt=_e(xe.leftChild,Dt);return kt!==void 0?kt:xe.key}};this.lowerBound=function(xe){return _e(Ie,xe)};var At=function(xe,Dt){if(!(!xe||xe.key===void 0)){var qe=ie(xe.key,Dt);if(qe<=0)return At(xe.rightChild,Dt);var kt=At(xe.leftChild,Dt);return kt!==void 0?kt:xe.key}};this.upperBound=function(xe){return At(Ie,xe)};var $e=function(xe,Dt){if(!(!xe||xe.key===void 0)){var qe=ie(xe.key,Dt);if(qe===0)return xe.key;if(qe>0)return $e(xe.leftChild,Dt);var kt=$e(xe.rightChild,Dt);return kt!==void 0?kt:xe.key}};this.reverseLowerBound=function(xe){return $e(Ie,xe)};var Fe=function(xe,Dt){if(!(!xe||xe.key===void 0)){var qe=ie(xe.key,Dt);if(qe>=0)return Fe(xe.leftChild,Dt);var kt=Fe(xe.rightChild,Dt);return kt!==void 0?kt:xe.key}};this.reverseUpperBound=function(xe){return Fe(Ie,xe)},this.union=function(xe){var Dt=this;xe.forEach(function(qe){return Dt.insert(qe)})},this.getHeight=function(){if(this.empty())return 0;var xe=function(Dt){return Dt?Math.max(xe(Dt.leftChild),xe(Dt.rightChild))+1:1};return xe(Ie)};var Ue=function(xe){return k(this,function(Dt){switch(Dt.label){case 0:return!xe||xe.key===void 0?[2]:[5,$(Ue(xe.leftChild))];case 1:return Dt.sent(),[4,xe.key];case 2:return Dt.sent(),[5,$(Ue(xe.rightChild))];case 3:return Dt.sent(),[2]}})};this[Symbol.iterator]=function(){return Ue(Ie)},Ce.forEach(function(xe){return ae.insert(xe)}),Object.freeze(this)}Object.freeze(re),V.default=re},{"../Base/TreeNode":25}],34:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});function k($){var oe=this;$===void 0&&($=[]);var re=0,Ce=[];this.size=function(){return re},this.empty=function(){return re===0},this.clear=function(){re=0,Ce.length=0},this.push=function(ie){Ce.push(ie),++re},this.pop=function(){Ce.pop(),re>0&&--re},this.top=function(){return Ce[re-1]},$.forEach(function(ie){return oe.push(ie)}),Object.freeze(this)}Object.freeze(k),V.default=k},{}],35:[function(r,g,V){var k=this&&this.__generator||function(ie,ae){var le={label:0,sent:function(){if(de[0]&1)throw de[1];return de[1]},trys:[],ops:[]},Ie,ue,de,Ne;return Ne={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(Ne[Symbol.iterator]=function(){return this}),Ne;function he(pe){return function(Ve){return ze([pe,Ve])}}function ze(pe){if(Ie)throw new TypeError("Generator is already executing.");for(;le;)try{if(Ie=1,ue&&(de=pe[0]&2?ue.return:pe[0]?ue.throw||((de=ue.return)&&de.call(ue),0):ue.next)&&!(de=de.call(ue,pe[1])).done)return de;switch(ue=0,de&&(pe=[pe[0]&2,de.value]),pe[0]){case 0:case 1:de=pe;break;case 4:return le.label++,{value:pe[1],done:!1};case 5:le.label++,ue=pe[1],pe=[0];continue;case 7:pe=le.ops.pop(),le.trys.pop();continue;default:if(de=le.trys,!(de=de.length>0&&de[de.length-1])&&(pe[0]===6||pe[0]===2)){le=0;continue}if(pe[0]===3&&(!de||pe[1]>de[0]&&pe[1]<de[3])){le.label=pe[1];break}if(pe[0]===6&&le.label<de[1]){le.label=de[1],de=pe;break}if(de&&le.label<de[2]){le.label=de[2],le.ops.push(pe);break}de[2]&&le.ops.pop(),le.trys.pop();continue}pe=ae.call(ie,le)}catch(Ve){pe=[6,Ve],ue=0}finally{Ie=de=0}if(pe[0]&5)throw pe[1];return{value:pe[0]?pe[1]:void 0,done:!0}}},$=this&&this.__read||function(ie,ae){var le=typeof Symbol=="function"&&ie[Symbol.iterator];if(!le)return ie;var Ie=le.call(ie),ue,de=[],Ne;try{for(;(ae===void 0||ae-- >0)&&!(ue=Ie.next()).done;)de.push(ue.value)}catch(he){Ne={error:he}}finally{try{ue&&!ue.done&&(le=Ie.return)&&le.call(Ie)}finally{if(Ne)throw Ne.error}}return de},oe=this&&this.__spreadArray||function(ie,ae,le){if(le||arguments.length===2)for(var Ie=0,ue=ae.length,de;Ie<ue;Ie++)(de||!(Ie in ae))&&(de||(de=Array.prototype.slice.call(ae,0,Ie)),de[Ie]=ae[Ie]);return ie.concat(de||Array.prototype.slice.call(ae))},re=this&&this.__values||function(ie){var ae=typeof Symbol=="function"&&Symbol.iterator,le=ae&&ie[ae],Ie=0;if(le)return le.call(ie);if(ie&&typeof ie.length=="number")return{next:function(){return ie&&Ie>=ie.length&&(ie=void 0),{value:ie&&ie[Ie++],done:!ie}}};throw new TypeError(ae?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});function Ce(ie){var ae=this;ie===void 0&&(ie=[]);var le=0,Ie=[];this.size=function(){return le},this.empty=function(){return le===0},this.clear=function(){le=0,Ie.length=0},this.front=function(){if(!this.empty())return Ie[0]},this.back=function(){if(!this.empty())return Ie[le-1]},this.forEach=function(ue){Ie.forEach(ue)},this.getElementByPos=function(ue){if(ue<0||ue>=le)throw new Error("pos must more than 0 and less than vector's size");return Ie[ue]},this.eraseElementByPos=function(ue){if(ue<0||ue>=le)throw new Error("pos must more than 0 and less than vector's size");for(var de=ue;de<le-1;++de)Ie[de]=Ie[de+1];this.popBack()},this.eraseElementByValue=function(ue){var de=[];this.forEach(function(he){he!==ue&&de.push(he)}),de.forEach(function(he,ze){Ie[ze]=he});for(var Ne=de.length;le>Ne;)this.popBack()},this.pushBack=function(ue){Ie.push(ue),++le},this.popBack=function(){Ie.pop(),le>0&&--le},this.setElementByPos=function(ue,de){if(ue<0||ue>=le)throw new Error("pos must more than 0 and less than vector's size");Ie[ue]=de},this.insert=function(ue,de,Ne){if(Ne===void 0&&(Ne=1),ue<0||ue>le)throw new Error("pos must more than 0 and less than or equal to vector's size");Ie.splice.apply(Ie,oe([ue,0],$(new Array(Ne).fill(de)),!1)),le+=Ne},this.find=function(ue){return Ie.includes(ue)},this.reverse=function(){Ie.reverse()},this.unique=function(){var ue,de=[];this.forEach(function(he,ze){(ze===0||he!==ue)&&(de.push(he),ue=he)}),de.forEach(function(he,ze){Ie[ze]=he});for(var Ne=de.length;le>Ne;)this.popBack()},this.sort=function(ue){Ie.sort(ue)},this[Symbol.iterator]=function(){return function(){return k(this,function(ue){switch(ue.label){case 0:return[5,re(Ie)];case 1:return[2,ue.sent()]}})}()},ie.forEach(function(ue){return ae.pushBack(ue)}),Object.freeze(this)}Object.freeze(Ce),V.default=Ce},{}],36:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0}),V.HashMap=V.HashSet=V.Map=V.Set=V.PriorityQueue=V.Deque=V.LinkList=V.Queue=V.Stack=V.Vector=void 0;var k=r("./Vector/Vector");V.Vector=k.default;var $=r("./Stack/Stack");V.Stack=$.default;var oe=r("./Queue/Queue");V.Queue=oe.default;var re=r("./LinkList/LinkList");V.LinkList=re.default;var Ce=r("./Deque/Deque");V.Deque=Ce.default;var ie=r("./PriorityQueue/PriorityQueue");V.PriorityQueue=ie.default;var ae=r("./Set/Set");V.Set=ae.default;var le=r("./Map/Map");V.Map=le.default;var Ie=r("./HashSet/HashSet");V.HashSet=Ie.default;var ue=r("./HashMap/HashMap");V.HashMap=ue.default},{"./Deque/Deque":26,"./HashMap/HashMap":27,"./HashSet/HashSet":28,"./LinkList/LinkList":29,"./Map/Map":30,"./PriorityQueue/PriorityQueue":31,"./Queue/Queue":32,"./Set/Set":33,"./Stack/Stack":34,"./Vector/Vector":35}],37:[function(r,g,V){const k=r("yallist"),$=Symbol("max"),oe=Symbol("length"),re=Symbol("lengthCalculator"),Ce=Symbol("allowStale"),ie=Symbol("maxAge"),ae=Symbol("dispose"),le=Symbol("noDisposeOnSet"),Ie=Symbol("lruList"),ue=Symbol("cache"),de=Symbol("updateAgeOnGet"),Ne=()=>1;class he{constructor(Fe){if(typeof Fe=="number"&&(Fe={max:Fe}),Fe||(Fe={}),Fe.max&&(typeof Fe.max!="number"||Fe.max<0))throw new TypeError("max must be a non-negative number");this[$]=Fe.max||1/0;const Ue=Fe.length||Ne;if(this[re]=typeof Ue!="function"?Ne:Ue,this[Ce]=Fe.stale||!1,Fe.maxAge&&typeof Fe.maxAge!="number")throw new TypeError("maxAge must be a number");this[ie]=Fe.maxAge||0,this[ae]=Fe.dispose,this[le]=Fe.noDisposeOnSet||!1,this[de]=Fe.updateAgeOnGet||!1,this.reset()}set max(Fe){if(typeof Fe!="number"||Fe<0)throw new TypeError("max must be a non-negative number");this[$]=Fe||1/0,Ve(this)}get max(){return this[$]}set allowStale(Fe){this[Ce]=!!Fe}get allowStale(){return this[Ce]}set maxAge(Fe){if(typeof Fe!="number")throw new TypeError("maxAge must be a non-negative number");this[ie]=Fe,Ve(this)}get maxAge(){return this[ie]}set lengthCalculator(Fe){typeof Fe!="function"&&(Fe=Ne),Fe!==this[re]&&(this[re]=Fe,this[oe]=0,this[Ie].forEach(Ue=>{Ue.length=this[re](Ue.value,Ue.key),this[oe]+=Ue.length})),Ve(this)}get lengthCalculator(){return this[re]}get length(){return this[oe]}get itemCount(){return this[Ie].length}rforEach(Fe,Ue){Ue=Ue||this;for(let xe=this[Ie].tail;xe!==null;){const Dt=xe.prev;At(this,Fe,xe,Ue),xe=Dt}}forEach(Fe,Ue){Ue=Ue||this;for(let xe=this[Ie].head;xe!==null;){const Dt=xe.next;At(this,Fe,xe,Ue),xe=Dt}}keys(){return this[Ie].toArray().map(Fe=>Fe.key)}values(){return this[Ie].toArray().map(Fe=>Fe.value)}reset(){this[ae]&&this[Ie]&&this[Ie].length&&this[Ie].forEach(Fe=>this[ae](Fe.key,Fe.value)),this[ue]=new Map,this[Ie]=new k,this[oe]=0}dump(){return this[Ie].map(Fe=>pe(this,Fe)?!1:{k:Fe.key,v:Fe.value,e:Fe.now+(Fe.maxAge||0)}).toArray().filter(Fe=>Fe)}dumpLru(){return this[Ie]}set(Fe,Ue,xe){if(xe=xe||this[ie],xe&&typeof xe!="number")throw new TypeError("maxAge must be a number");const Dt=xe?Date.now():0,qe=this[re](Ue,Fe);if(this[ue].has(Fe)){if(qe>this[$])return Oe(this,this[ue].get(Fe)),!1;const jt=this[ue].get(Fe).value;return this[ae]&&(this[le]||this[ae](Fe,jt.value)),jt.now=Dt,jt.maxAge=xe,jt.value=Ue,this[oe]+=qe-jt.length,jt.length=qe,this.get(Fe),Ve(this),!0}const kt=new _e(Fe,Ue,qe,Dt,xe);return kt.length>this[$]?(this[ae]&&this[ae](Fe,Ue),!1):(this[oe]+=kt.length,this[Ie].unshift(kt),this[ue].set(Fe,this[Ie].head),Ve(this),!0)}has(Fe){if(!this[ue].has(Fe))return!1;const Ue=this[ue].get(Fe).value;return!pe(this,Ue)}get(Fe){return ze(this,Fe,!0)}peek(Fe){return ze(this,Fe,!1)}pop(){const Fe=this[Ie].tail;return Fe?(Oe(this,Fe),Fe.value):null}del(Fe){Oe(this,this[ue].get(Fe))}load(Fe){this.reset();const Ue=Date.now();for(let xe=Fe.length-1;xe>=0;xe--){const Dt=Fe[xe],qe=Dt.e||0;if(qe===0)this.set(Dt.k,Dt.v);else{const kt=qe-Ue;kt>0&&this.set(Dt.k,Dt.v,kt)}}}prune(){this[ue].forEach((Fe,Ue)=>ze(this,Ue,!1))}}const ze=($e,Fe,Ue)=>{const xe=$e[ue].get(Fe);if(xe){const Dt=xe.value;if(pe($e,Dt)){if(Oe($e,xe),!$e[Ce])return}else Ue&&($e[de]&&(xe.value.now=Date.now()),$e[Ie].unshiftNode(xe));return Dt.value}},pe=($e,Fe)=>{if(!Fe||!Fe.maxAge&&!$e[ie])return!1;const Ue=Date.now()-Fe.now;return Fe.maxAge?Ue>Fe.maxAge:$e[ie]&&Ue>$e[ie]},Ve=$e=>{if($e[oe]>$e[$])for(let Fe=$e[Ie].tail;$e[oe]>$e[$]&&Fe!==null;){const Ue=Fe.prev;Oe($e,Fe),Fe=Ue}},Oe=($e,Fe)=>{if(Fe){const Ue=Fe.value;$e[ae]&&$e[ae](Ue.key,Ue.value),$e[oe]-=Ue.length,$e[ue].delete(Ue.key),$e[Ie].removeNode(Fe)}};class _e{constructor(Fe,Ue,xe,Dt,qe){this.key=Fe,this.value=Ue,this.length=xe,this.now=Dt,this.maxAge=qe||0}}const At=($e,Fe,Ue,xe)=>{let Dt=Ue.value;pe($e,Dt)&&(Oe($e,Ue),$e[Ce]||(Dt=void 0)),Dt&&Fe.call(xe,Dt.value,Dt.key,$e)};g.exports=he},{yallist:83}],38:[function(r,g,V){(function(k){(function(){const $=g.exports;$.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},$.codes={};for(const re in $.types){const Ce=$.types[re];$.codes[Ce]=re}$.CMD_SHIFT=4,$.CMD_MASK=240,$.DUP_MASK=8,$.QOS_MASK=3,$.QOS_SHIFT=1,$.RETAIN_MASK=1,$.VARBYTEINT_MASK=127,$.VARBYTEINT_FIN_MASK=128,$.VARBYTEINT_MAX=268435455,$.SESSIONPRESENT_MASK=1,$.SESSIONPRESENT_HEADER=k.from([$.SESSIONPRESENT_MASK]),$.CONNACK_HEADER=k.from([$.codes.connack<<$.CMD_SHIFT]),$.USERNAME_MASK=128,$.PASSWORD_MASK=64,$.WILL_RETAIN_MASK=32,$.WILL_QOS_MASK=24,$.WILL_QOS_SHIFT=3,$.WILL_FLAG_MASK=4,$.CLEAN_SESSION_MASK=2,$.CONNECT_HEADER=k.from([$.codes.connect<<$.CMD_SHIFT]),$.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},$.propertiesCodes={};for(const re in $.properties){const Ce=$.properties[re];$.propertiesCodes[Ce]=re}$.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"};function oe(re){return[0,1,2].map(Ce=>[0,1].map(ie=>[0,1].map(ae=>{const le=k.alloc(1);return le.writeUInt8($.codes[re]<<$.CMD_SHIFT|(ie?$.DUP_MASK:0)|Ce<<$.QOS_SHIFT|ae,0,!0),le})))}$.PUBLISH_HEADER=oe("publish"),$.SUBSCRIBE_HEADER=oe("subscribe"),$.SUBSCRIBE_OPTIONS_QOS_MASK=3,$.SUBSCRIBE_OPTIONS_NL_MASK=1,$.SUBSCRIBE_OPTIONS_NL_SHIFT=2,$.SUBSCRIBE_OPTIONS_RAP_MASK=1,$.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,$.SUBSCRIBE_OPTIONS_RH_MASK=3,$.SUBSCRIBE_OPTIONS_RH_SHIFT=4,$.SUBSCRIBE_OPTIONS_RH=[0,16,32],$.SUBSCRIBE_OPTIONS_NL=4,$.SUBSCRIBE_OPTIONS_RAP=8,$.SUBSCRIBE_OPTIONS_QOS=[0,1,2],$.UNSUBSCRIBE_HEADER=oe("unsubscribe"),$.ACKS={unsuback:oe("unsuback"),puback:oe("puback"),pubcomp:oe("pubcomp"),pubrel:oe("pubrel"),pubrec:oe("pubrec")},$.SUBACK_HEADER=k.from([$.codes.suback<<$.CMD_SHIFT]),$.VERSION3=k.from([3]),$.VERSION4=k.from([4]),$.VERSION5=k.from([5]),$.VERSION131=k.from([131]),$.VERSION132=k.from([132]),$.QOS=[0,1,2].map(re=>k.from([re])),$.EMPTY={pingreq:k.from([$.codes.pingreq<<4,0]),pingresp:k.from([$.codes.pingresp<<4,0]),disconnect:k.from([$.codes.disconnect<<4,0])}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],39:[function(r,g,V){(function(k){(function(){const $=r("./writeToStream"),oe=r("events");function re(ie,ae){const le=new Ce;return $(ie,le,ae),le.concat()}class Ce extends oe{constructor(){super(),this._array=new Array(20),this._i=0}write(ae){return this._array[this._i++]=ae,!0}concat(){let ae=0;const le=new Array(this._array.length),Ie=this._array;let ue=0,de;for(de=0;de<Ie.length&&Ie[de]!==void 0;de++)typeof Ie[de]!="string"?le[de]=Ie[de].length:le[de]=k.byteLength(Ie[de]),ae+=le[de];const Ne=k.allocUnsafe(ae);for(de=0;de<Ie.length&&Ie[de]!==void 0;de++)typeof Ie[de]!="string"?(Ie[de].copy(Ne,ue),ue+=le[de]):(Ne.write(Ie[de],ue),ue+=le[de]);return Ne}}g.exports=re}).call(this)}).call(this,r("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(r,g,V){V.parser=r("./parser").parser,V.generate=r("./generate"),V.writeToStream=r("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(r,g,V){(function(k){(function(){const oe={},re=k.isBuffer(k.from([1,2]).subarray(0,1));function Ce(Ie){const ue=k.allocUnsafe(2);return ue.writeUInt8(Ie>>8,0),ue.writeUInt8(Ie&255,0+1),ue}function ie(){for(let Ie=0;Ie<65536;Ie++)oe[Ie]=Ce(Ie)}function ae(Ie){let de=0,Ne=0;const he=k.allocUnsafe(4);do de=Ie%128|0,Ie=Ie/128|0,Ie>0&&(de=de|128),he.writeUInt8(de,Ne++);while(Ie>0&&Ne<4);return Ie>0&&(Ne=0),re?he.subarray(0,Ne):he.slice(0,Ne)}function le(Ie){const ue=k.allocUnsafe(4);return ue.writeUInt32BE(Ie,0),ue}g.exports={cache:oe,generateCache:ie,generateNumber:Ce,genBufVariableByteInt:ae,generate4ByteBuffer:le}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],42:[function(r,g,V){class k{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}g.exports=k},{}],43:[function(r,g,V){const k=r("bl"),$=r("events"),oe=r("./packet"),re=r("./constants"),Ce=r("debug")("mqtt-packet:parser");class ie extends ${constructor(){super(),this.parser=this.constructor.parser}static parser(le){return this instanceof ie?(this.settings=le||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new ie().parser(le)}_resetState(){Ce("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new oe,this.error=null,this._list=k(),this._stateCounter=0}parse(le){for(this.error&&this._resetState(),this._list.append(le),Ce("parse: current state: %s",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,Ce("parse: state complete. _stateCounter is now: %d",this._stateCounter),Ce("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return Ce("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const le=this._list.readUInt8(0);return this.packet.cmd=re.types[le>>re.CMD_SHIFT],this.packet.retain=(le&re.RETAIN_MASK)!==0,this.packet.qos=le>>re.QOS_SHIFT&re.QOS_MASK,this.packet.dup=(le&re.DUP_MASK)!==0,Ce("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const le=this._parseVarByteNum(!0);return le&&(this.packet.length=le.value,this._list.consume(le.bytes)),Ce("_parseLength %d",le.value),!!le}_parsePayload(){Ce("_parsePayload: payload %O",this._list);let le=!1;if(this.packet.length===0||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}le=!0}return Ce("_parsePayload complete result: %s",le),le}_parseConnect(){Ce("_parseConnect");let le,Ie,ue,de;const Ne={},he=this.packet,ze=this._parseString();if(ze===null)return this._emitError(new Error("Cannot parse protocolId"));if(ze!=="MQTT"&&ze!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(he.protocolId=ze,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(he.protocolVersion=this._list.readUInt8(this._pos),he.protocolVersion>=128&&(he.bridgeMode=!0,he.protocolVersion=he.protocolVersion-128),he.protocolVersion!==3&&he.protocolVersion!==4&&he.protocolVersion!==5)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(Ne.username=this._list.readUInt8(this._pos)&re.USERNAME_MASK,Ne.password=this._list.readUInt8(this._pos)&re.PASSWORD_MASK,Ne.will=this._list.readUInt8(this._pos)&re.WILL_FLAG_MASK,Ne.will&&(he.will={},he.will.retain=(this._list.readUInt8(this._pos)&re.WILL_RETAIN_MASK)!==0,he.will.qos=(this._list.readUInt8(this._pos)&re.WILL_QOS_MASK)>>re.WILL_QOS_SHIFT),he.clean=(this._list.readUInt8(this._pos)&re.CLEAN_SESSION_MASK)!==0,this._pos++,he.keepalive=this._parseNum(),he.keepalive===-1)return this._emitError(new Error("Packet too short"));if(he.protocolVersion===5){const Ve=this._parseProperties();Object.getOwnPropertyNames(Ve).length&&(he.properties=Ve)}const pe=this._parseString();if(pe===null)return this._emitError(new Error("Packet too short"));if(he.clientId=pe,Ce("_parseConnect: packet.clientId: %s",he.clientId),Ne.will){if(he.protocolVersion===5){const Ve=this._parseProperties();Object.getOwnPropertyNames(Ve).length&&(he.will.properties=Ve)}if(le=this._parseString(),le===null)return this._emitError(new Error("Cannot parse will topic"));if(he.will.topic=le,Ce("_parseConnect: packet.will.topic: %s",he.will.topic),Ie=this._parseBuffer(),Ie===null)return this._emitError(new Error("Cannot parse will payload"));he.will.payload=Ie,Ce("_parseConnect: packet.will.paylaod: %s",he.will.payload)}if(Ne.username){if(de=this._parseString(),de===null)return this._emitError(new Error("Cannot parse username"));he.username=de,Ce("_parseConnect: packet.username: %s",he.username)}if(Ne.password){if(ue=this._parseBuffer(),ue===null)return this._emitError(new Error("Cannot parse password"));he.password=ue}return this.settings=he,Ce("_parseConnect: complete"),he}_parseConnack(){Ce("_parseConnack");const le=this.packet;if(this._list.length<1)return null;if(le.sessionPresent=!!(this._list.readUInt8(this._pos++)&re.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?le.reasonCode=this._list.readUInt8(this._pos++):le.reasonCode=0;else{if(this._list.length<2)return null;le.returnCode=this._list.readUInt8(this._pos++)}if(le.returnCode===-1||le.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}Ce("_parseConnack: complete")}_parsePublish(){Ce("_parsePublish");const le=this.packet;if(le.topic=this._parseString(),le.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(le.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}le.payload=this._list.slice(this._pos,le.length),Ce("_parsePublish: payload from buffer list: %o",le.payload)}}_parseSubscribe(){Ce("_parseSubscribe");const le=this.packet;let Ie,ue,de,Ne,he,ze,pe;if(le.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(le.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const Ve=this._parseProperties();Object.getOwnPropertyNames(Ve).length&&(le.properties=Ve)}for(;this._pos<le.length;){if(Ie=this._parseString(),Ie===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=le.length)return this._emitError(new Error("Malformed Subscribe Payload"));ue=this._parseByte(),de=ue&re.SUBSCRIBE_OPTIONS_QOS_MASK,ze=(ue>>re.SUBSCRIBE_OPTIONS_NL_SHIFT&re.SUBSCRIBE_OPTIONS_NL_MASK)!==0,he=(ue>>re.SUBSCRIBE_OPTIONS_RAP_SHIFT&re.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,Ne=ue>>re.SUBSCRIBE_OPTIONS_RH_SHIFT&re.SUBSCRIBE_OPTIONS_RH_MASK,pe={topic:Ie,qos:de},this.settings.protocolVersion===5?(pe.nl=ze,pe.rap=he,pe.rh=Ne):this.settings.bridgeMode&&(pe.rh=0,pe.rap=!0,pe.nl=!0),Ce("_parseSubscribe: push subscription `%s` to subscription",pe),le.subscriptions.push(pe)}}}_parseSuback(){Ce("_parseSuback");const le=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){Ce("_parseUnsubscribe");const le=this.packet;if(le.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}for(;this._pos<le.length;){const Ie=this._parseString();if(Ie===null)return this._emitError(new Error("Cannot parse topic"));Ce("_parseUnsubscribe: push topic `%s` to unsubscriptions",Ie),le.unsubscriptions.push(Ie)}}}_parseUnsuback(){Ce("_parseUnsuback");const le=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(this.settings.protocolVersion===5){const Ie=this._parseProperties();for(Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie),le.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){Ce("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const le=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5&&(le.length>2?(le.reasonCode=this._parseByte(),Ce("_parseConfirmation: packet.reasonCode `%d`",le.reasonCode)):le.reasonCode=0,le.length>3)){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}return!0}_parseDisconnect(){const le=this.packet;if(Ce("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?le.reasonCode=this._parseByte():le.reasonCode=0;const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}return Ce("_parseDisconnect result: true"),!0}_parseAuth(){Ce("_parseAuth");const le=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));le.reasonCode=this._parseByte();const Ie=this._parseProperties();return Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie),Ce("_parseAuth: result: true"),!0}_parseMessageId(){const le=this.packet;return le.messageId=this._parseNum(),le.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(Ce("_parseMessageId: packet.messageId %d",le.messageId),!0)}_parseString(le){const Ie=this._parseNum(),ue=Ie+this._pos;if(Ie===-1||ue>this._list.length||ue>this.packet.length)return null;const de=this._list.toString("utf8",this._pos,ue);return this._pos+=Ie,Ce("_parseString: result: %s",de),de}_parseStringPair(){return Ce("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const le=this._parseNum(),Ie=le+this._pos;if(le===-1||Ie>this._list.length||Ie>this.packet.length)return null;const ue=this._list.slice(this._pos,Ie);return this._pos+=le,Ce("_parseBuffer: result: %o",ue),ue}_parseNum(){if(this._list.length-this._pos<2)return-1;const le=this._list.readUInt16BE(this._pos);return this._pos+=2,Ce("_parseNum: result: %s",le),le}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const le=this._list.readUInt32BE(this._pos);return this._pos+=4,Ce("_parse4ByteNum: result: %s",le),le}_parseVarByteNum(le){Ce("_parseVarByteNum");const Ie=4;let ue=0,de=1,Ne=0,he=!1,ze;const pe=this._pos?this._pos:0;for(;ue<Ie&&pe+ue<this._list.length;){if(ze=this._list.readUInt8(pe+ue++),Ne+=de*(ze&re.VARBYTEINT_MASK),de*=128,!(ze&re.VARBYTEINT_FIN_MASK)){he=!0;break}if(this._list.length<=ue)break}return!he&&ue===Ie&&this._list.length>=ue&&this._emitError(new Error("Invalid variable byte integer")),pe&&(this._pos+=ue),he=he?le?{bytes:ue,value:Ne}:Ne:!1,Ce("_parseVarByteNum: result: %o",he),he}_parseByte(){let le;return this._pos<this._list.length&&(le=this._list.readUInt8(this._pos),this._pos++),Ce("_parseByte: result: %o",le),le}_parseByType(le){switch(Ce("_parseByType: type: %s",le),le){case"byte":return this._parseByte()!==0;case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){Ce("_parseProperties");const le=this._parseVarByteNum(),ue=this._pos+le,de={};for(;this._pos<ue;){const Ne=this._parseByte();if(!Ne)return this._emitError(new Error("Cannot parse property code type")),!1;const he=re.propertiesCodes[Ne];if(!he)return this._emitError(new Error("Unknown property")),!1;if(he==="userProperties"){de[he]||(de[he]=Object.create(null));const ze=this._parseByType(re.propertiesTypes[he]);if(de[he][ze.name])if(Array.isArray(de[he][ze.name]))de[he][ze.name].push(ze.value);else{const pe=de[he][ze.name];de[he][ze.name]=[pe],de[he][ze.name].push(ze.value)}else de[he][ze.name]=ze.value;continue}de[he]?Array.isArray(de[he])?de[he].push(this._parseByType(re.propertiesTypes[he])):(de[he]=[de[he]],de[he].push(this._parseByType(re.propertiesTypes[he]))):de[he]=this._parseByType(re.propertiesTypes[he])}return de}_newPacket(){return Ce("_newPacket"),this.packet&&(this._list.consume(this.packet.length),Ce("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),Ce("_newPacket: new packet"),this.packet=new oe,this._pos=0,!0}_emitError(le){Ce("_emitError"),this.error=le,this.emit("error",le)}}g.exports=ie},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(r,g,V){(function(k){(function(){const $=r("./constants"),oe=k.allocUnsafe(0),re=k.from([0]),Ce=r("./numbers"),ie=r("process-nextick-args").nextTick,ae=r("debug")("mqtt-packet:writeToStream"),le=Ce.cache,Ie=Ce.generateNumber,ue=Ce.generateCache,de=Ce.genBufVariableByteInt,Ne=Ce.generate4ByteBuffer;let he=ni,ze=!0;function pe(wi,li,fi){switch(ae("generate called"),li.cork&&(li.cork(),ie(Ve,li)),ze&&(ze=!1,ue()),ae("generate: packet.cmd: %s",wi.cmd),wi.cmd){case"connect":return Oe(wi,li);case"connack":return _e(wi,li,fi);case"publish":return At(wi,li,fi);case"puback":case"pubrec":case"pubrel":case"pubcomp":return $e(wi,li,fi);case"subscribe":return Fe(wi,li,fi);case"suback":return Ue(wi,li,fi);case"unsubscribe":return xe(wi,li,fi);case"unsuback":return Dt(wi,li,fi);case"pingreq":case"pingresp":return qe(wi,li);case"disconnect":return kt(wi,li,fi);case"auth":return Et(wi,li,fi);default:return li.emit("error",new Error("Unknown command")),!1}}Object.defineProperty(pe,"cacheNumbers",{get(){return he===ni},set(wi){wi?((!le||Object.keys(le).length===0)&&(ze=!0),he=ni):(ze=!1,he=ri)}});function Ve(wi){wi.uncork()}function Oe(wi,li,fi){const Mi=wi||{},Ni=Mi.protocolId||"MQTT";let pi=Mi.protocolVersion||4;const vi=Mi.will;let bi=Mi.clean;const ai=Mi.keepalive||0,Ii=Mi.clientId||"",oi=Mi.username,ei=Mi.password,ii=Mi.properties;bi===void 0&&(bi=!0);let si=0;if(!Ni||typeof Ni!="string"&&!k.isBuffer(Ni))return li.emit("error",new Error("Invalid protocolId")),!1;if(si+=Ni.length+2,pi!==3&&pi!==4&&pi!==5)return li.emit("error",new Error("Invalid protocol version")),!1;if(si+=1,(typeof Ii=="string"||k.isBuffer(Ii))&&(Ii||pi>=4)&&(Ii||bi))si+=k.byteLength(Ii)+2;else{if(pi<4)return li.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(bi*1===0)return li.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof ai!="number"||ai<0||ai>65535||ai%1!==0)return li.emit("error",new Error("Invalid keepalive")),!1;if(si+=2,si+=1,pi===5){var zi=gi(li,ii);if(!zi)return!1;si+=zi.length}if(vi){if(typeof vi!="object")return li.emit("error",new Error("Invalid will")),!1;if(!vi.topic||typeof vi.topic!="string")return li.emit("error",new Error("Invalid will topic")),!1;if(si+=k.byteLength(vi.topic)+2,si+=2,vi.payload)if(vi.payload.length>=0)typeof vi.payload=="string"?si+=k.byteLength(vi.payload):si+=vi.payload.length;else return li.emit("error",new Error("Invalid will payload")),!1;var mi={};if(pi===5){if(mi=gi(li,vi.properties),!mi)return!1;si+=mi.length}}let Si=!1;if(oi!=null)if(yi(oi))Si=!0,si+=k.byteLength(oi)+2;else return li.emit("error",new Error("Invalid username")),!1;if(ei!=null){if(!Si)return li.emit("error",new Error("Username is required to use password")),!1;if(yi(ei))si+=Ai(ei)+2;else return li.emit("error",new Error("Invalid password")),!1}li.write($.CONNECT_HEADER),ti(li,si),Ci(li,Ni),Mi.bridgeMode&&(pi+=128),li.write(pi===131?$.VERSION131:pi===132?$.VERSION132:pi===4?$.VERSION4:pi===5?$.VERSION5:$.VERSION3);let xi=0;return xi|=oi!=null?$.USERNAME_MASK:0,xi|=ei!=null?$.PASSWORD_MASK:0,xi|=vi&&vi.retain?$.WILL_RETAIN_MASK:0,xi|=vi&&vi.qos?vi.qos<<$.WILL_QOS_SHIFT:0,xi|=vi?$.WILL_FLAG_MASK:0,xi|=bi?$.CLEAN_SESSION_MASK:0,li.write(k.from([xi])),he(li,ai),pi===5&&zi.write(),Ci(li,Ii),vi&&(pi===5&&mi.write(),Lt(li,vi.topic),Ci(li,vi.payload)),oi!=null&&Ci(li,oi),ei!=null&&Ci(li,ei),!0}function _e(wi,li,fi){const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Mi===5?Ni.reasonCode:Ni.returnCode,vi=Ni.properties;let bi=2;if(typeof pi!="number")return li.emit("error",new Error("Invalid return code")),!1;let ai=null;if(Mi===5){if(ai=gi(li,vi),!ai)return!1;bi+=ai.length}return li.write($.CONNACK_HEADER),ti(li,bi),li.write(Ni.sessionPresent?$.SESSIONPRESENT_HEADER:re),li.write(k.from([pi])),ai!=null&&ai.write(),!0}function At(wi,li,fi){ae("publish: packet: %o",wi);const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.qos||0,vi=Ni.retain?$.RETAIN_MASK:0,bi=Ni.topic,ai=Ni.payload||oe,Ii=Ni.messageId,oi=Ni.properties;let ei=0;if(typeof bi=="string")ei+=k.byteLength(bi)+2;else if(k.isBuffer(bi))ei+=bi.length+2;else return li.emit("error",new Error("Invalid topic")),!1;if(k.isBuffer(ai)?ei+=ai.length:ei+=k.byteLength(ai),pi&&typeof Ii!="number")return li.emit("error",new Error("Invalid messageId")),!1;pi&&(ei+=2);let ii=null;if(Mi===5){if(ii=gi(li,oi),!ii)return!1;ei+=ii.length}return li.write($.PUBLISH_HEADER[pi][Ni.dup?1:0][vi?1:0]),ti(li,ei),he(li,Ai(bi)),li.write(bi),pi>0&&he(li,Ii),ii!=null&&ii.write(),ae("publish: payload: %o",ai),li.write(ai)}function $e(wi,li,fi){const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.cmd||"puback",vi=Ni.messageId,bi=Ni.dup&&pi==="pubrel"?$.DUP_MASK:0;let ai=0;const Ii=Ni.reasonCode,oi=Ni.properties;let ei=Mi===5?3:2;if(pi==="pubrel"&&(ai=1),typeof vi!="number")return li.emit("error",new Error("Invalid messageId")),!1;let ii=null;if(Mi===5&&typeof oi=="object"){if(ii=di(li,oi,fi,ei),!ii)return!1;ei+=ii.length}return li.write($.ACKS[pi][ai][bi][0]),ti(li,ei),he(li,vi),Mi===5&&li.write(k.from([Ii])),ii!==null&&ii.write(),!0}function Fe(wi,li,fi){ae("subscribe: packet: ");const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.dup?$.DUP_MASK:0,vi=Ni.messageId,bi=Ni.subscriptions,ai=Ni.properties;let Ii=0;if(typeof vi!="number")return li.emit("error",new Error("Invalid messageId")),!1;Ii+=2;let oi=null;if(Mi===5){if(oi=gi(li,ai),!oi)return!1;Ii+=oi.length}if(typeof bi=="object"&&bi.length)for(let ii=0;ii<bi.length;ii+=1){const si=bi[ii].topic,zi=bi[ii].qos;if(typeof si!="string")return li.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof zi!="number")return li.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(Mi===5){if(typeof(bi[ii].nl||!1)!="boolean")return li.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(bi[ii].rap||!1)!="boolean")return li.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const xi=bi[ii].rh||0;if(typeof xi!="number"||xi>2)return li.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}Ii+=k.byteLength(si)+2+1}else return li.emit("error",new Error("Invalid subscriptions")),!1;ae("subscribe: writing to stream: %o",$.SUBSCRIBE_HEADER),li.write($.SUBSCRIBE_HEADER[1][pi?1:0][0]),ti(li,Ii),he(li,vi),oi!==null&&oi.write();let ei=!0;for(const ii of bi){const si=ii.topic,zi=ii.qos,mi=+ii.nl,Si=+ii.rap,xi=ii.rh;let Gi;Lt(li,si),Gi=$.SUBSCRIBE_OPTIONS_QOS[zi],Mi===5&&(Gi|=mi?$.SUBSCRIBE_OPTIONS_NL:0,Gi|=Si?$.SUBSCRIBE_OPTIONS_RAP:0,Gi|=xi?$.SUBSCRIBE_OPTIONS_RH[xi]:0),ei=li.write(k.from([Gi]))}return ei}function Ue(wi,li,fi){const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.messageId,vi=Ni.granted,bi=Ni.properties;let ai=0;if(typeof pi!="number")return li.emit("error",new Error("Invalid messageId")),!1;if(ai+=2,typeof vi=="object"&&vi.length)for(let oi=0;oi<vi.length;oi+=1){if(typeof vi[oi]!="number")return li.emit("error",new Error("Invalid qos vector")),!1;ai+=1}else return li.emit("error",new Error("Invalid qos vector")),!1;let Ii=null;if(Mi===5){if(Ii=di(li,bi,fi,ai),!Ii)return!1;ai+=Ii.length}return li.write($.SUBACK_HEADER),ti(li,ai),he(li,pi),Ii!==null&&Ii.write(),li.write(k.from(vi))}function xe(wi,li,fi){const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.messageId,vi=Ni.dup?$.DUP_MASK:0,bi=Ni.unsubscriptions,ai=Ni.properties;let Ii=0;if(typeof pi!="number")return li.emit("error",new Error("Invalid messageId")),!1;if(Ii+=2,typeof bi=="object"&&bi.length)for(let ii=0;ii<bi.length;ii+=1){if(typeof bi[ii]!="string")return li.emit("error",new Error("Invalid unsubscriptions")),!1;Ii+=k.byteLength(bi[ii])+2}else return li.emit("error",new Error("Invalid unsubscriptions")),!1;let oi=null;if(Mi===5){if(oi=gi(li,ai),!oi)return!1;Ii+=oi.length}li.write($.UNSUBSCRIBE_HEADER[1][vi?1:0][0]),ti(li,Ii),he(li,pi),oi!==null&&oi.write();let ei=!0;for(let ii=0;ii<bi.length;ii++)ei=Lt(li,bi[ii]);return ei}function Dt(wi,li,fi){const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.messageId,vi=Ni.dup?$.DUP_MASK:0,bi=Ni.granted,ai=Ni.properties,Ii=Ni.cmd,oi=0;let ei=2;if(typeof pi!="number")return li.emit("error",new Error("Invalid messageId")),!1;if(Mi===5)if(typeof bi=="object"&&bi.length)for(let si=0;si<bi.length;si+=1){if(typeof bi[si]!="number")return li.emit("error",new Error("Invalid qos vector")),!1;ei+=1}else return li.emit("error",new Error("Invalid qos vector")),!1;let ii=null;if(Mi===5){if(ii=di(li,ai,fi,ei),!ii)return!1;ei+=ii.length}return li.write($.ACKS[Ii][oi][vi][0]),ti(li,ei),he(li,pi),ii!==null&&ii.write(),Mi===5&&li.write(k.from(bi)),!0}function qe(wi,li,fi){return li.write($.EMPTY[wi.cmd])}function kt(wi,li,fi){const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.reasonCode,vi=Ni.properties;let bi=Mi===5?1:0,ai=null;if(Mi===5){if(ai=di(li,vi,fi,bi),!ai)return!1;bi+=ai.length}return li.write(k.from([$.codes.disconnect<<4])),ti(li,bi),Mi===5&&li.write(k.from([pi])),ai!==null&&ai.write(),!0}function Et(wi,li,fi){const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.reasonCode,vi=Ni.properties;let bi=Mi===5?1:0;Mi!==5&&li.emit("error",new Error("Invalid mqtt version for auth packet"));const ai=di(li,vi,fi,bi);return ai?(bi+=ai.length,li.write(k.from([$.codes.auth<<4])),ti(li,bi),li.write(k.from([pi])),ai!==null&&ai.write(),!0):!1}const jt={};function ti(wi,li){if(li>$.VARBYTEINT_MAX)return wi.emit("error",new Error(`Invalid variable byte integer: ${li}`)),!1;let fi=jt[li];return fi||(fi=de(li),li<16384&&(jt[li]=fi)),ae("writeVarByteInt: writing to stream: %o",fi),wi.write(fi)}function Lt(wi,li){const fi=k.byteLength(li);return he(wi,fi),ae("writeString: %s",li),wi.write(li,"utf8")}function Pt(wi,li,fi){Lt(wi,li),Lt(wi,fi)}function ni(wi,li){return ae("writeNumberCached: number: %d",li),ae("writeNumberCached: %o",le[li]),wi.write(le[li])}function ri(wi,li){const fi=Ie(li);return ae("writeNumberGenerated: %o",fi),wi.write(fi)}function ui(wi,li){const fi=Ne(li);return ae("write4ByteNumber: %o",fi),wi.write(fi)}function Ci(wi,li){typeof li=="string"?Lt(wi,li):li?(he(wi,li.length),wi.write(li)):he(wi,0)}function gi(wi,li){if(typeof li!="object"||li.length!=null)return{length:1,write(){ci(wi,{},0)}};let fi=0;function Mi(pi,vi){const bi=$.propertiesTypes[pi];let ai=0;switch(bi){case"byte":{if(typeof vi!="boolean")return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=1+1;break}case"int8":{if(typeof vi!="number"||vi<0||vi>255)return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=1+1;break}case"binary":{if(vi&&vi===null)return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=1+k.byteLength(vi)+2;break}case"int16":{if(typeof vi!="number"||vi<0||vi>65535)return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=1+2;break}case"int32":{if(typeof vi!="number"||vi<0||vi>4294967295)return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=1+4;break}case"var":{if(typeof vi!="number"||vi<0||vi>268435455)return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=1+k.byteLength(de(vi));break}case"string":{if(typeof vi!="string")return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=1+2+k.byteLength(vi.toString());break}case"pair":{if(typeof vi!="object")return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=Object.getOwnPropertyNames(vi).reduce((Ii,oi)=>{const ei=vi[oi];return Array.isArray(ei)?Ii+=ei.reduce((ii,si)=>(ii+=1+2+k.byteLength(oi.toString())+2+k.byteLength(si.toString()),ii),0):Ii+=1+2+k.byteLength(oi.toString())+2+k.byteLength(vi[oi].toString()),Ii},0);break}default:return wi.emit("error",new Error(`Invalid property ${pi}: ${vi}`)),!1}return ai}if(li)for(const pi in li){let vi=0,bi=0;const ai=li[pi];if(Array.isArray(ai))for(let Ii=0;Ii<ai.length;Ii++){if(bi=Mi(pi,ai[Ii]),!bi)return!1;vi+=bi}else{if(bi=Mi(pi,ai),!bi)return!1;vi=bi}if(!vi)return!1;fi+=vi}return{length:k.byteLength(de(fi))+fi,write(){ci(wi,li,fi)}}}function di(wi,li,fi,Mi){const Ni=["reasonString","userProperties"],pi=fi&&fi.properties&&fi.properties.maximumPacketSize?fi.properties.maximumPacketSize:0;let vi=gi(wi,li);if(pi)for(;Mi+vi.length>pi;){const bi=Ni.shift();if(bi&&li[bi])delete li[bi],vi=gi(wi,li);else return!1}return vi}function hi(wi,li,fi){switch($.propertiesTypes[li]){case"byte":{wi.write(k.from([$.properties[li]])),wi.write(k.from([+fi]));break}case"int8":{wi.write(k.from([$.properties[li]])),wi.write(k.from([fi]));break}case"binary":{wi.write(k.from([$.properties[li]])),Ci(wi,fi);break}case"int16":{wi.write(k.from([$.properties[li]])),he(wi,fi);break}case"int32":{wi.write(k.from([$.properties[li]])),ui(wi,fi);break}case"var":{wi.write(k.from([$.properties[li]])),ti(wi,fi);break}case"string":{wi.write(k.from([$.properties[li]])),Lt(wi,fi);break}case"pair":{Object.getOwnPropertyNames(fi).forEach(Ni=>{const pi=fi[Ni];Array.isArray(pi)?pi.forEach(vi=>{wi.write(k.from([$.properties[li]])),Pt(wi,Ni.toString(),vi.toString())}):(wi.write(k.from([$.properties[li]])),Pt(wi,Ni.toString(),pi.toString()))});break}default:return wi.emit("error",new Error(`Invalid property ${li} value: ${fi}`)),!1}}function ci(wi,li,fi){ti(wi,fi);for(const Mi in li)if(Object.prototype.hasOwnProperty.call(li,Mi)&&li[Mi]!==null){const Ni=li[Mi];if(Array.isArray(Ni))for(let pi=0;pi<Ni.length;pi++)hi(wi,Mi,Ni[pi]);else hi(wi,Mi,Ni)}}function Ai(wi){return wi?wi instanceof k?wi.length:k.byteLength(wi):0}function yi(wi){return typeof wi=="string"||wi instanceof k}g.exports=pe}).call(this)}).call(this,r("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(r,g,V){var k=1e3,$=k*60,oe=$*60,re=oe*24,Ce=re*7,ie=re*365.25;g.exports=function(de,Ne){Ne=Ne||{};var he=typeof de;if(he==="string"&&de.length>0)return ae(de);if(he==="number"&&isFinite(de))return Ne.long?Ie(de):le(de);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(de))};function ae(de){if(de=String(de),!(de.length>100)){var Ne=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(de);if(Ne){var he=parseFloat(Ne[1]),ze=(Ne[2]||"ms").toLowerCase();switch(ze){case"years":case"year":case"yrs":case"yr":case"y":return he*ie;case"weeks":case"week":case"w":return he*Ce;case"days":case"day":case"d":return he*re;case"hours":case"hour":case"hrs":case"hr":case"h":return he*oe;case"minutes":case"minute":case"mins":case"min":case"m":return he*$;case"seconds":case"second":case"secs":case"sec":case"s":return he*k;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return he;default:return}}}}function le(de){var Ne=Math.abs(de);return Ne>=re?Math.round(de/re)+"d":Ne>=oe?Math.round(de/oe)+"h":Ne>=$?Math.round(de/$)+"m":Ne>=k?Math.round(de/k)+"s":de+"ms"}function Ie(de){var Ne=Math.abs(de);return Ne>=re?ue(de,Ne,re,"day"):Ne>=oe?ue(de,Ne,oe,"hour"):Ne>=$?ue(de,Ne,$,"minute"):Ne>=k?ue(de,Ne,k,"second"):de+" ms"}function ue(de,Ne,he,ze){var pe=Ne>=he*1.5;return Math.round(de/he)+" "+ze+(pe?"s":"")}},{}],46:[function(r,g,V){const k=r("./lib/number-allocator.js");g.exports.NumberAllocator=k},{"./lib/number-allocator.js":47}],47:[function(r,g,V){const k=r("js-sdsl").Set,$=r("debug")("number-allocator:trace"),oe=r("debug")("number-allocator:error");function re(ie,ae){this.low=ie,this.high=ae}re.prototype.equals=function(ie){return this.low===ie.low&&this.high===ie.high},re.prototype.compare=function(ie){return this.low<ie.low&&this.high<ie.low?-1:ie.low<this.low&&ie.high<this.low?1:0};function Ce(ie,ae){if(!(this instanceof Ce))return new Ce(ie,ae);this.min=ie,this.max=ae,this.ss=new k([],(le,Ie)=>le.compare(Ie)),$("Create"),this.clear()}Ce.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},Ce.prototype.alloc=function(){if(this.ss.size()===0)return $("alloc():empty"),null;const ie=this.ss.front(),ae=ie.low;return ae+1<=ie.high?++ie.low:this.ss.eraseElementByPos(0),$("alloc():"+ae),ae},Ce.prototype.use=function(ie){const ae=new re(ie,ie),le=this.ss.lowerBound(ae);if(le){if(le.equals(ae))return this.ss.eraseElementByValue(le),$("use():"+ie),!0;if(le.low>ie)return!1;if(le.low===ie)return++le.low,$("use():"+ie),!0;if(le.high===ie)return--le.high,$("use():"+ie),!0;const Ie=le.low;return le.low=ie+1,this.ss.insert(new re(Ie,ie-1)),$("use():"+ie),!0}return $("use():failed"),!1},Ce.prototype.free=function(ie){if(ie<this.min||ie>this.max){oe("free():"+ie+" is out of range");return}const ae=new re(ie,ie),le=this.ss.lowerBound(ae);if(le){if(le.low<=ie&&ie<=le.high){oe("free():"+ie+" has already been vacant");return}if(le===this.ss.front())ie+1===le.low?--le.low:this.ss.insert(ae);else{const Ie=this.ss.reverseLowerBound(ae);Ie.high+1===ie?ie+1===le.low?(this.ss.eraseElementByValue(Ie),le.low=Ie.low):Ie.high=ie:ie+1===le.low?le.low=ie:this.ss.insert(ae)}}else{if(le===this.ss.front()){this.ss.insert(ae);return}const Ie=this.ss.reverseLowerBound(ae);Ie.high+1===ie?Ie.high=ie:this.ss.insert(ae)}$("free():"+ie)},Ce.prototype.clear=function(){$("clear()"),this.ss.clear(),this.ss.insert(new re(this.min,this.max))},Ce.prototype.intervalCount=function(){return this.ss.size()},Ce.prototype.dump=function(){console.log("length:"+this.ss.size());for(const ie of this.ss)console.log(ie)},g.exports=Ce},{debug:18,"js-sdsl":36}],48:[function(r,g,V){var k=r("wrappy");g.exports=k($),g.exports.strict=k(oe),$.proto=$(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return $(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return oe(this)},configurable:!0})});function $(re){var Ce=function(){return Ce.called?Ce.value:(Ce.called=!0,Ce.value=re.apply(this,arguments))};return Ce.called=!1,Ce}function oe(re){var Ce=function(){if(Ce.called)throw new Error(Ce.onceError);return Ce.called=!0,Ce.value=re.apply(this,arguments)},ie=re.name||"Function wrapped with `once`";return Ce.onceError=ie+" shouldn't be called more than once",Ce.called=!1,Ce}},{wrappy:79}],49:[function(r,g,V){(function(k){(function(){typeof k>"u"||!k.version||k.version.indexOf("v0.")===0||k.version.indexOf("v1.")===0&&k.version.indexOf("v1.8.")!==0?g.exports={nextTick:$}:g.exports=k;function $(oe,re,Ce,ie){if(typeof oe!="function")throw new TypeError('"callback" argument must be a function');var ae=arguments.length,le,Ie;switch(ae){case 0:case 1:return k.nextTick(oe);case 2:return k.nextTick(function(){oe.call(null,re)});case 3:return k.nextTick(function(){oe.call(null,re,Ce)});case 4:return k.nextTick(function(){oe.call(null,re,Ce,ie)});default:for(le=new Array(ae-1),Ie=0;Ie<le.length;)le[Ie++]=arguments[Ie];return k.nextTick(function(){oe.apply(null,le)})}}}).call(this)}).call(this,r("_process"))},{_process:50}],50:[function(r,g,V){var k=g.exports={},$,oe;function re(){throw new Error("setTimeout has not been defined")}function Ce(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?$=setTimeout:$=re}catch{$=re}try{typeof clearTimeout=="function"?oe=clearTimeout:oe=Ce}catch{oe=Ce}})();function ie(Ve){if($===setTimeout)return setTimeout(Ve,0);if(($===re||!$)&&setTimeout)return $=setTimeout,setTimeout(Ve,0);try{return $(Ve,0)}catch{try{return $.call(null,Ve,0)}catch{return $.call(this,Ve,0)}}}function ae(Ve){if(oe===clearTimeout)return clearTimeout(Ve);if((oe===Ce||!oe)&&clearTimeout)return oe=clearTimeout,clearTimeout(Ve);try{return oe(Ve)}catch{try{return oe.call(null,Ve)}catch{return oe.call(this,Ve)}}}var le=[],Ie=!1,ue,de=-1;function Ne(){!Ie||!ue||(Ie=!1,ue.length?le=ue.concat(le):de=-1,le.length&&he())}function he(){if(!Ie){var Ve=ie(Ne);Ie=!0;for(var Oe=le.length;Oe;){for(ue=le,le=[];++de<Oe;)ue&&ue[de].run();de=-1,Oe=le.length}ue=null,Ie=!1,ae(Ve)}}k.nextTick=function(Ve){var Oe=new Array(arguments.length-1);if(arguments.length>1)for(var _e=1;_e<arguments.length;_e++)Oe[_e-1]=arguments[_e];le.push(new ze(Ve,Oe)),le.length===1&&!Ie&&ie(he)};function ze(Ve,Oe){this.fun=Ve,this.array=Oe}ze.prototype.run=function(){this.fun.apply(null,this.array)},k.title="browser",k.browser=!0,k.env={},k.argv=[],k.version="",k.versions={};function pe(){}k.on=pe,k.addListener=pe,k.once=pe,k.off=pe,k.removeListener=pe,k.removeAllListeners=pe,k.emit=pe,k.prependListener=pe,k.prependOnceListener=pe,k.listeners=function(Ve){return[]},k.binding=function(Ve){throw new Error("process.binding is not supported")},k.cwd=function(){return"/"},k.chdir=function(Ve){throw new Error("process.chdir is not supported")},k.umask=function(){return 0}},{}],51:[function(r,g,V){(function(k){(function(){(function($){var oe=typeof V=="object"&&V&&!V.nodeType&&V,re=typeof g=="object"&&g&&!g.nodeType&&g,Ce=typeof k=="object"&&k;(Ce.global===Ce||Ce.window===Ce||Ce.self===Ce)&&($=Ce);var ie,ae=2147483647,le=36,Ie=1,ue=26,de=38,Ne=700,he=72,ze=128,pe="-",Ve=/^xn--/,Oe=/[^\x20-\x7E]/,_e=/[\x2E\u3002\uFF0E\uFF61]/g,At={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$e=le-Ie,Fe=Math.floor,Ue=String.fromCharCode,xe;function Dt(gi){throw new RangeError(At[gi])}function qe(gi,di){for(var hi=gi.length,ci=[];hi--;)ci[hi]=di(gi[hi]);return ci}function kt(gi,di){var hi=gi.split("@"),ci="";hi.length>1&&(ci=hi[0]+"@",gi=hi[1]),gi=gi.replace(_e,".");var Ai=gi.split("."),yi=qe(Ai,di).join(".");return ci+yi}function Et(gi){for(var di=[],hi=0,ci=gi.length,Ai,yi;hi<ci;)Ai=gi.charCodeAt(hi++),Ai>=55296&&Ai<=56319&&hi<ci?(yi=gi.charCodeAt(hi++),(yi&64512)==56320?di.push(((Ai&1023)<<10)+(yi&1023)+65536):(di.push(Ai),hi--)):di.push(Ai);return di}function jt(gi){return qe(gi,function(di){var hi="";return di>65535&&(di-=65536,hi+=Ue(di>>>10&1023|55296),di=56320|di&1023),hi+=Ue(di),hi}).join("")}function ti(gi){return gi-48<10?gi-22:gi-65<26?gi-65:gi-97<26?gi-97:le}function Lt(gi,di){return gi+22+75*(gi<26)-((di!=0)<<5)}function Pt(gi,di,hi){var ci=0;for(gi=hi?Fe(gi/Ne):gi>>1,gi+=Fe(gi/di);gi>$e*ue>>1;ci+=le)gi=Fe(gi/$e);return Fe(ci+($e+1)*gi/(gi+de))}function ni(gi){var di=[],hi=gi.length,ci,Ai=0,yi=ze,wi=he,li,fi,Mi,Ni,pi,vi,bi,ai,Ii;for(li=gi.lastIndexOf(pe),li<0&&(li=0),fi=0;fi<li;++fi)gi.charCodeAt(fi)>=128&&Dt("not-basic"),di.push(gi.charCodeAt(fi));for(Mi=li>0?li+1:0;Mi<hi;){for(Ni=Ai,pi=1,vi=le;Mi>=hi&&Dt("invalid-input"),bi=ti(gi.charCodeAt(Mi++)),(bi>=le||bi>Fe((ae-Ai)/pi))&&Dt("overflow"),Ai+=bi*pi,ai=vi<=wi?Ie:vi>=wi+ue?ue:vi-wi,!(bi<ai);vi+=le)Ii=le-ai,pi>Fe(ae/Ii)&&Dt("overflow"),pi*=Ii;ci=di.length+1,wi=Pt(Ai-Ni,ci,Ni==0),Fe(Ai/ci)>ae-yi&&Dt("overflow"),yi+=Fe(Ai/ci),Ai%=ci,di.splice(Ai++,0,yi)}return jt(di)}function ri(gi){var di,hi,ci,Ai,yi,wi,li,fi,Mi,Ni,pi,vi=[],bi,ai,Ii,oi;for(gi=Et(gi),bi=gi.length,di=ze,hi=0,yi=he,wi=0;wi<bi;++wi)pi=gi[wi],pi<128&&vi.push(Ue(pi));for(ci=Ai=vi.length,Ai&&vi.push(pe);ci<bi;){for(li=ae,wi=0;wi<bi;++wi)pi=gi[wi],pi>=di&&pi<li&&(li=pi);for(ai=ci+1,li-di>Fe((ae-hi)/ai)&&Dt("overflow"),hi+=(li-di)*ai,di=li,wi=0;wi<bi;++wi)if(pi=gi[wi],pi<di&&++hi>ae&&Dt("overflow"),pi==di){for(fi=hi,Mi=le;Ni=Mi<=yi?Ie:Mi>=yi+ue?ue:Mi-yi,!(fi<Ni);Mi+=le)oi=fi-Ni,Ii=le-Ni,vi.push(Ue(Lt(Ni+oi%Ii,0))),fi=Fe(oi/Ii);vi.push(Ue(Lt(fi,0))),yi=Pt(hi,ai,ci==Ai),hi=0,++ci}++hi,++di}return vi.join("")}function ui(gi){return kt(gi,function(di){return Ve.test(di)?ni(di.slice(4).toLowerCase()):di})}function Ci(gi){return kt(gi,function(di){return Oe.test(di)?"xn--"+ri(di):di})}if(ie={version:"1.4.1",ucs2:{decode:Et,encode:jt},decode:ni,encode:ri,toASCII:Ci,toUnicode:ui},oe&&re)if(g.exports==oe)re.exports=ie;else for(xe in ie)ie.hasOwnProperty(xe)&&(oe[xe]=ie[xe]);else $.punycode=ie})(this)}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],52:[function(r,g,V){function k(oe,re){return Object.prototype.hasOwnProperty.call(oe,re)}g.exports=function(oe,re,Ce,ie){re=re||"&",Ce=Ce||"=";var ae={};if(typeof oe!="string"||oe.length===0)return ae;var le=/\+/g;oe=oe.split(re);var Ie=1e3;ie&&typeof ie.maxKeys=="number"&&(Ie=ie.maxKeys);var ue=oe.length;Ie>0&&ue>Ie&&(ue=Ie);for(var de=0;de<ue;++de){var Ne=oe[de].replace(le,"%20"),he=Ne.indexOf(Ce),ze,pe,Ve,Oe;he>=0?(ze=Ne.substr(0,he),pe=Ne.substr(he+1)):(ze=Ne,pe=""),Ve=decodeURIComponent(ze),Oe=decodeURIComponent(pe),k(ae,Ve)?$(ae[Ve])?ae[Ve].push(Oe):ae[Ve]=[ae[Ve],Oe]:ae[Ve]=Oe}return ae};var $=Array.isArray||function(oe){return Object.prototype.toString.call(oe)==="[object Array]"}},{}],53:[function(r,g,V){var k=function(Ce){switch(typeof Ce){case"string":return Ce;case"boolean":return Ce?"true":"false";case"number":return isFinite(Ce)?Ce:"";default:return""}};g.exports=function(Ce,ie,ae,le){return ie=ie||"&",ae=ae||"=",Ce===null&&(Ce=void 0),typeof Ce=="object"?oe(re(Ce),function(Ie){var ue=encodeURIComponent(k(Ie))+ae;return $(Ce[Ie])?oe(Ce[Ie],function(de){return ue+encodeURIComponent(k(de))}).join(ie):ue+encodeURIComponent(k(Ce[Ie]))}).join(ie):le?encodeURIComponent(k(le))+ae+encodeURIComponent(k(Ce)):""};var $=Array.isArray||function(Ce){return Object.prototype.toString.call(Ce)==="[object Array]"};function oe(Ce,ie){if(Ce.map)return Ce.map(ie);for(var ae=[],le=0;le<Ce.length;le++)ae.push(ie(Ce[le],le));return ae}var re=Object.keys||function(Ce){var ie=[];for(var ae in Ce)Object.prototype.hasOwnProperty.call(Ce,ae)&&ie.push(ae);return ie}},{}],54:[function(r,g,V){V.decode=V.parse=r("./decode"),V.encode=V.stringify=r("./encode")},{"./decode":52,"./encode":53}],55:[function(r,g,V){function k(le,Ie){le.prototype=Object.create(Ie.prototype),le.prototype.constructor=le,le.__proto__=Ie}var $={};function oe(le,Ie,ue){ue||(ue=Error);function de(he,ze,pe){return typeof Ie=="string"?Ie:Ie(he,ze,pe)}var Ne=function(he){k(ze,he);function ze(pe,Ve,Oe){return he.call(this,de(pe,Ve,Oe))||this}return ze}(ue);Ne.prototype.name=ue.name,Ne.prototype.code=le,$[le]=Ne}function re(le,Ie){if(Array.isArray(le)){var ue=le.length;return le=le.map(function(de){return String(de)}),ue>2?"one of ".concat(Ie," ").concat(le.slice(0,ue-1).join(", "),", or ")+le[ue-1]:ue===2?"one of ".concat(Ie," ").concat(le[0]," or ").concat(le[1]):"of ".concat(Ie," ").concat(le[0])}else return"of ".concat(Ie," ").concat(String(le))}function Ce(le,Ie,ue){return le.substr(!ue||ue<0?0:+ue,Ie.length)===Ie}function ie(le,Ie,ue){return(ue===void 0||ue>le.length)&&(ue=le.length),le.substring(ue-Ie.length,ue)===Ie}function ae(le,Ie,ue){return typeof ue!="number"&&(ue=0),ue+Ie.length>le.length?!1:le.indexOf(Ie,ue)!==-1}oe("ERR_INVALID_OPT_VALUE",function(le,Ie){return'The value "'+Ie+'" is invalid for option "'+le+'"'},TypeError),oe("ERR_INVALID_ARG_TYPE",function(le,Ie,ue){var de;typeof Ie=="string"&&Ce(Ie,"not ")?(de="must not be",Ie=Ie.replace(/^not /,"")):de="must be";var Ne;if(ie(le," argument"))Ne="The ".concat(le," ").concat(de," ").concat(re(Ie,"type"));else{var he=ae(le,".")?"property":"argument";Ne='The "'.concat(le,'" ').concat(he," ").concat(de," ").concat(re(Ie,"type"))}return Ne+=". Received type ".concat(typeof ue),Ne},TypeError),oe("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),oe("ERR_METHOD_NOT_IMPLEMENTED",function(le){return"The "+le+" method is not implemented"}),oe("ERR_STREAM_PREMATURE_CLOSE","Premature close"),oe("ERR_STREAM_DESTROYED",function(le){return"Cannot call "+le+" after a stream was destroyed"}),oe("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),oe("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),oe("ERR_STREAM_WRITE_AFTER_END","write after end"),oe("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),oe("ERR_UNKNOWN_ENCODING",function(le){return"Unknown encoding: "+le},TypeError),oe("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),g.exports.codes=$},{}],56:[function(r,g,V){(function(k){(function(){var $=Object.keys||function(de){var Ne=[];for(var he in de)Ne.push(he);return Ne};g.exports=le;var oe=r("./_stream_readable"),re=r("./_stream_writable");r("inherits")(le,oe);for(var Ce=$(re.prototype),ie=0;ie<Ce.length;ie++){var ae=Ce[ie];le.prototype[ae]||(le.prototype[ae]=re.prototype[ae])}function le(de){if(!(this instanceof le))return new le(de);oe.call(this,de),re.call(this,de),this.allowHalfOpen=!0,de&&(de.readable===!1&&(this.readable=!1),de.writable===!1&&(this.writable=!1),de.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",Ie)))}Object.defineProperty(le.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(le.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(le.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Ie(){this._writableState.ended||k.nextTick(ue,this)}function ue(de){de.end()}Object.defineProperty(le.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(Ne){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=Ne,this._writableState.destroyed=Ne)}})}).call(this)}).call(this,r("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(r,g,V){g.exports=$;var k=r("./_stream_transform");r("inherits")($,k);function $(oe){if(!(this instanceof $))return new $(oe);k.call(this,oe)}$.prototype._transform=function(oe,re,Ce){Ce(null,oe)}},{"./_stream_transform":59,inherits:24}],58:[function(r,g,V){(function(k,$){(function(){g.exports=jt;var oe;jt.ReadableState=Et,r("events").EventEmitter;var re=function(Ii,oi){return Ii.listeners(oi).length},Ce=r("./internal/streams/stream"),ie=r("buffer").Buffer,ae=$.Uint8Array||function(){};function le(ai){return ie.from(ai)}function Ie(ai){return ie.isBuffer(ai)||ai instanceof ae}var ue=r("util"),de;ue&&ue.debuglog?de=ue.debuglog("stream"):de=function(){};var Ne=r("./internal/streams/buffer_list"),he=r("./internal/streams/destroy"),ze=r("./internal/streams/state"),pe=ze.getHighWaterMark,Ve=r("../errors").codes,Oe=Ve.ERR_INVALID_ARG_TYPE,_e=Ve.ERR_STREAM_PUSH_AFTER_EOF,At=Ve.ERR_METHOD_NOT_IMPLEMENTED,$e=Ve.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Fe,Ue,xe;r("inherits")(jt,Ce);var Dt=he.errorOrDestroy,qe=["error","close","destroy","pause","resume"];function kt(ai,Ii,oi){if(typeof ai.prependListener=="function")return ai.prependListener(Ii,oi);!ai._events||!ai._events[Ii]?ai.on(Ii,oi):Array.isArray(ai._events[Ii])?ai._events[Ii].unshift(oi):ai._events[Ii]=[oi,ai._events[Ii]]}function Et(ai,Ii,oi){oe=oe||r("./_stream_duplex"),ai=ai||{},typeof oi!="boolean"&&(oi=Ii instanceof oe),this.objectMode=!!ai.objectMode,oi&&(this.objectMode=this.objectMode||!!ai.readableObjectMode),this.highWaterMark=pe(this,ai,"readableHighWaterMark",oi),this.buffer=new Ne,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=ai.emitClose!==!1,this.autoDestroy=!!ai.autoDestroy,this.destroyed=!1,this.defaultEncoding=ai.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,ai.encoding&&(Fe||(Fe=r("string_decoder/").StringDecoder),this.decoder=new Fe(ai.encoding),this.encoding=ai.encoding)}function jt(ai){if(oe=oe||r("./_stream_duplex"),!(this instanceof jt))return new jt(ai);var Ii=this instanceof oe;this._readableState=new Et(ai,this,Ii),this.readable=!0,ai&&(typeof ai.read=="function"&&(this._read=ai.read),typeof ai.destroy=="function"&&(this._destroy=ai.destroy)),Ce.call(this)}Object.defineProperty(jt.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(Ii){this._readableState&&(this._readableState.destroyed=Ii)}}),jt.prototype.destroy=he.destroy,jt.prototype._undestroy=he.undestroy,jt.prototype._destroy=function(ai,Ii){Ii(ai)},jt.prototype.push=function(ai,Ii){var oi=this._readableState,ei;return oi.objectMode?ei=!0:typeof ai=="string"&&(Ii=Ii||oi.defaultEncoding,Ii!==oi.encoding&&(ai=ie.from(ai,Ii),Ii=""),ei=!0),ti(this,ai,Ii,!1,ei)},jt.prototype.unshift=function(ai){return ti(this,ai,null,!0,!1)};function ti(ai,Ii,oi,ei,ii){de("readableAddChunk",Ii);var si=ai._readableState;if(Ii===null)si.reading=!1,Ci(ai,si);else{var zi;if(ii||(zi=Pt(si,Ii)),zi)Dt(ai,zi);else if(si.objectMode||Ii&&Ii.length>0)if(typeof Ii!="string"&&!si.objectMode&&Object.getPrototypeOf(Ii)!==ie.prototype&&(Ii=le(Ii)),ei)si.endEmitted?Dt(ai,new $e):Lt(ai,si,Ii,!0);else if(si.ended)Dt(ai,new _e);else{if(si.destroyed)return!1;si.reading=!1,si.decoder&&!oi?(Ii=si.decoder.write(Ii),si.objectMode||Ii.length!==0?Lt(ai,si,Ii,!1):hi(ai,si)):Lt(ai,si,Ii,!1)}else ei||(si.reading=!1,hi(ai,si))}return!si.ended&&(si.length<si.highWaterMark||si.length===0)}function Lt(ai,Ii,oi,ei){Ii.flowing&&Ii.length===0&&!Ii.sync?(Ii.awaitDrain=0,ai.emit("data",oi)):(Ii.length+=Ii.objectMode?1:oi.length,ei?Ii.buffer.unshift(oi):Ii.buffer.push(oi),Ii.needReadable&&gi(ai)),hi(ai,Ii)}function Pt(ai,Ii){var oi;return!Ie(Ii)&&typeof Ii!="string"&&Ii!==void 0&&!ai.objectMode&&(oi=new Oe("chunk",["string","Buffer","Uint8Array"],Ii)),oi}jt.prototype.isPaused=function(){return this._readableState.flowing===!1},jt.prototype.setEncoding=function(ai){Fe||(Fe=r("string_decoder/").StringDecoder);var Ii=new Fe(ai);this._readableState.decoder=Ii,this._readableState.encoding=this._readableState.decoder.encoding;for(var oi=this._readableState.buffer.head,ei="";oi!==null;)ei+=Ii.write(oi.data),oi=oi.next;return this._readableState.buffer.clear(),ei!==""&&this._readableState.buffer.push(ei),this._readableState.length=ei.length,this};var ni=1073741824;function ri(ai){return ai>=ni?ai=ni:(ai--,ai|=ai>>>1,ai|=ai>>>2,ai|=ai>>>4,ai|=ai>>>8,ai|=ai>>>16,ai++),ai}function ui(ai,Ii){return ai<=0||Ii.length===0&&Ii.ended?0:Ii.objectMode?1:ai!==ai?Ii.flowing&&Ii.length?Ii.buffer.head.data.length:Ii.length:(ai>Ii.highWaterMark&&(Ii.highWaterMark=ri(ai)),ai<=Ii.length?ai:Ii.ended?Ii.length:(Ii.needReadable=!0,0))}jt.prototype.read=function(ai){de("read",ai),ai=parseInt(ai,10);var Ii=this._readableState,oi=ai;if(ai!==0&&(Ii.emittedReadable=!1),ai===0&&Ii.needReadable&&((Ii.highWaterMark!==0?Ii.length>=Ii.highWaterMark:Ii.length>0)||Ii.ended))return de("read: emitReadable",Ii.length,Ii.ended),Ii.length===0&&Ii.ended?pi(this):gi(this),null;if(ai=ui(ai,Ii),ai===0&&Ii.ended)return Ii.length===0&&pi(this),null;var ei=Ii.needReadable;de("need readable",ei),(Ii.length===0||Ii.length-ai<Ii.highWaterMark)&&(ei=!0,de("length less than watermark",ei)),Ii.ended||Ii.reading?(ei=!1,de("reading or ended",ei)):ei&&(de("do read"),Ii.reading=!0,Ii.sync=!0,Ii.length===0&&(Ii.needReadable=!0),this._read(Ii.highWaterMark),Ii.sync=!1,Ii.reading||(ai=ui(oi,Ii)));var ii;return ai>0?ii=Ni(ai,Ii):ii=null,ii===null?(Ii.needReadable=Ii.length<=Ii.highWaterMark,ai=0):(Ii.length-=ai,Ii.awaitDrain=0),Ii.length===0&&(Ii.ended||(Ii.needReadable=!0),oi!==ai&&Ii.ended&&pi(this)),ii!==null&&this.emit("data",ii),ii};function Ci(ai,Ii){if(de("onEofChunk"),!Ii.ended){if(Ii.decoder){var oi=Ii.decoder.end();oi&&oi.length&&(Ii.buffer.push(oi),Ii.length+=Ii.objectMode?1:oi.length)}Ii.ended=!0,Ii.sync?gi(ai):(Ii.needReadable=!1,Ii.emittedReadable||(Ii.emittedReadable=!0,di(ai)))}}function gi(ai){var Ii=ai._readableState;de("emitReadable",Ii.needReadable,Ii.emittedReadable),Ii.needReadable=!1,Ii.emittedReadable||(de("emitReadable",Ii.flowing),Ii.emittedReadable=!0,k.nextTick(di,ai))}function di(ai){var Ii=ai._readableState;de("emitReadable_",Ii.destroyed,Ii.length,Ii.ended),!Ii.destroyed&&(Ii.length||Ii.ended)&&(ai.emit("readable"),Ii.emittedReadable=!1),Ii.needReadable=!Ii.flowing&&!Ii.ended&&Ii.length<=Ii.highWaterMark,Mi(ai)}function hi(ai,Ii){Ii.readingMore||(Ii.readingMore=!0,k.nextTick(ci,ai,Ii))}function ci(ai,Ii){for(;!Ii.reading&&!Ii.ended&&(Ii.length<Ii.highWaterMark||Ii.flowing&&Ii.length===0);){var oi=Ii.length;if(de("maybeReadMore read 0"),ai.read(0),oi===Ii.length)break}Ii.readingMore=!1}jt.prototype._read=function(ai){Dt(this,new At("_read()"))},jt.prototype.pipe=function(ai,Ii){var oi=this,ei=this._readableState;switch(ei.pipesCount){case 0:ei.pipes=ai;break;case 1:ei.pipes=[ei.pipes,ai];break;default:ei.pipes.push(ai);break}ei.pipesCount+=1,de("pipe count=%d opts=%j",ei.pipesCount,Ii);var ii=(!Ii||Ii.end!==!1)&&ai!==k.stdout&&ai!==k.stderr,si=ii?mi:Vi;ei.endEmitted?k.nextTick(si):oi.once("end",si),ai.on("unpipe",zi);function zi(ki,Hi){de("onunpipe"),ki===oi&&Hi&&Hi.hasUnpiped===!1&&(Hi.hasUnpiped=!0,Gi())}function mi(){de("onend"),ai.end()}var Si=Ai(oi);ai.on("drain",Si);var xi=!1;function Gi(){de("cleanup"),ai.removeListener("close",Zi),ai.removeListener("finish",Wi),ai.removeListener("drain",Si),ai.removeListener("error",Oi),ai.removeListener("unpipe",zi),oi.removeListener("end",mi),oi.removeListener("end",Vi),oi.removeListener("data",Bi),xi=!0,ei.awaitDrain&&(!ai._writableState||ai._writableState.needDrain)&&Si()}oi.on("data",Bi);function Bi(ki){de("ondata");var Hi=ai.write(ki);de("dest.write",Hi),Hi===!1&&((ei.pipesCount===1&&ei.pipes===ai||ei.pipesCount>1&&bi(ei.pipes,ai)!==-1)&&!xi&&(de("false write response, pause",ei.awaitDrain),ei.awaitDrain++),oi.pause())}function Oi(ki){de("onerror",ki),Vi(),ai.removeListener("error",Oi),re(ai,"error")===0&&Dt(ai,ki)}kt(ai,"error",Oi);function Zi(){ai.removeListener("finish",Wi),Vi()}ai.once("close",Zi);function Wi(){de("onfinish"),ai.removeListener("close",Zi),Vi()}ai.once("finish",Wi);function Vi(){de("unpipe"),oi.unpipe(ai)}return ai.emit("pipe",oi),ei.flowing||(de("pipe resume"),oi.resume()),ai};function Ai(ai){return function(){var oi=ai._readableState;de("pipeOnDrain",oi.awaitDrain),oi.awaitDrain&&oi.awaitDrain--,oi.awaitDrain===0&&re(ai,"data")&&(oi.flowing=!0,Mi(ai))}}jt.prototype.unpipe=function(ai){var Ii=this._readableState,oi={hasUnpiped:!1};if(Ii.pipesCount===0)return this;if(Ii.pipesCount===1)return ai&&ai!==Ii.pipes?this:(ai||(ai=Ii.pipes),Ii.pipes=null,Ii.pipesCount=0,Ii.flowing=!1,ai&&ai.emit("unpipe",this,oi),this);if(!ai){var ei=Ii.pipes,ii=Ii.pipesCount;Ii.pipes=null,Ii.pipesCount=0,Ii.flowing=!1;for(var si=0;si<ii;si++)ei[si].emit("unpipe",this,{hasUnpiped:!1});return this}var zi=bi(Ii.pipes,ai);return zi===-1?this:(Ii.pipes.splice(zi,1),Ii.pipesCount-=1,Ii.pipesCount===1&&(Ii.pipes=Ii.pipes[0]),ai.emit("unpipe",this,oi),this)},jt.prototype.on=function(ai,Ii){var oi=Ce.prototype.on.call(this,ai,Ii),ei=this._readableState;return ai==="data"?(ei.readableListening=this.listenerCount("readable")>0,ei.flowing!==!1&&this.resume()):ai==="readable"&&!ei.endEmitted&&!ei.readableListening&&(ei.readableListening=ei.needReadable=!0,ei.flowing=!1,ei.emittedReadable=!1,de("on readable",ei.length,ei.reading),ei.length?gi(this):ei.reading||k.nextTick(wi,this)),oi},jt.prototype.addListener=jt.prototype.on,jt.prototype.removeListener=function(ai,Ii){var oi=Ce.prototype.removeListener.call(this,ai,Ii);return ai==="readable"&&k.nextTick(yi,this),oi},jt.prototype.removeAllListeners=function(ai){var Ii=Ce.prototype.removeAllListeners.apply(this,arguments);return(ai==="readable"||ai===void 0)&&k.nextTick(yi,this),Ii};function yi(ai){var Ii=ai._readableState;Ii.readableListening=ai.listenerCount("readable")>0,Ii.resumeScheduled&&!Ii.paused?Ii.flowing=!0:ai.listenerCount("data")>0&&ai.resume()}function wi(ai){de("readable nexttick read 0"),ai.read(0)}jt.prototype.resume=function(){var ai=this._readableState;return ai.flowing||(de("resume"),ai.flowing=!ai.readableListening,li(this,ai)),ai.paused=!1,this};function li(ai,Ii){Ii.resumeScheduled||(Ii.resumeScheduled=!0,k.nextTick(fi,ai,Ii))}function fi(ai,Ii){de("resume",Ii.reading),Ii.reading||ai.read(0),Ii.resumeScheduled=!1,ai.emit("resume"),Mi(ai),Ii.flowing&&!Ii.reading&&ai.read(0)}jt.prototype.pause=function(){return de("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(de("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Mi(ai){var Ii=ai._readableState;for(de("flow",Ii.flowing);Ii.flowing&&ai.read()!==null;);}jt.prototype.wrap=function(ai){var Ii=this,oi=this._readableState,ei=!1;ai.on("end",function(){if(de("wrapped end"),oi.decoder&&!oi.ended){var zi=oi.decoder.end();zi&&zi.length&&Ii.push(zi)}Ii.push(null)}),ai.on("data",function(zi){if(de("wrapped data"),oi.decoder&&(zi=oi.decoder.write(zi)),!(oi.objectMode&&zi==null)&&!(!oi.objectMode&&(!zi||!zi.length))){var mi=Ii.push(zi);mi||(ei=!0,ai.pause())}});for(var ii in ai)this[ii]===void 0&&typeof ai[ii]=="function"&&(this[ii]=function(mi){return function(){return ai[mi].apply(ai,arguments)}}(ii));for(var si=0;si<qe.length;si++)ai.on(qe[si],this.emit.bind(this,qe[si]));return this._read=function(zi){de("wrapped _read",zi),ei&&(ei=!1,ai.resume())},this},typeof Symbol=="function"&&(jt.prototype[Symbol.asyncIterator]=function(){return Ue===void 0&&(Ue=r("./internal/streams/async_iterator")),Ue(this)}),Object.defineProperty(jt.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(jt.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(jt.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(Ii){this._readableState&&(this._readableState.flowing=Ii)}}),jt._fromList=Ni,Object.defineProperty(jt.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function Ni(ai,Ii){if(Ii.length===0)return null;var oi;return Ii.objectMode?oi=Ii.buffer.shift():!ai||ai>=Ii.length?(Ii.decoder?oi=Ii.buffer.join(""):Ii.buffer.length===1?oi=Ii.buffer.first():oi=Ii.buffer.concat(Ii.length),Ii.buffer.clear()):oi=Ii.buffer.consume(ai,Ii.decoder),oi}function pi(ai){var Ii=ai._readableState;de("endReadable",Ii.endEmitted),Ii.endEmitted||(Ii.ended=!0,k.nextTick(vi,Ii,ai))}function vi(ai,Ii){if(de("endReadableNT",ai.endEmitted,ai.length),!ai.endEmitted&&ai.length===0&&(ai.endEmitted=!0,Ii.readable=!1,Ii.emit("end"),ai.autoDestroy)){var oi=Ii._writableState;(!oi||oi.autoDestroy&&oi.finished)&&Ii.destroy()}}typeof Symbol=="function"&&(jt.from=function(ai,Ii){return xe===void 0&&(xe=r("./internal/streams/from")),xe(jt,ai,Ii)});function bi(ai,Ii){for(var oi=0,ei=ai.length;oi<ei;oi++)if(ai[oi]===Ii)return oi;return-1}}).call(this)}).call(this,r("_process"),typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/async_iterator":61,"./internal/streams/buffer_list":62,"./internal/streams/destroy":63,"./internal/streams/from":65,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,events:22,inherits:24,"string_decoder/":75,util:16}],59:[function(r,g,V){g.exports=le;var k=r("../errors").codes,$=k.ERR_METHOD_NOT_IMPLEMENTED,oe=k.ERR_MULTIPLE_CALLBACK,re=k.ERR_TRANSFORM_ALREADY_TRANSFORMING,Ce=k.ERR_TRANSFORM_WITH_LENGTH_0,ie=r("./_stream_duplex");r("inherits")(le,ie);function ae(de,Ne){var he=this._transformState;he.transforming=!1;var ze=he.writecb;if(ze===null)return this.emit("error",new oe);he.writechunk=null,he.writecb=null,Ne!=null&&this.push(Ne),ze(de);var pe=this._readableState;pe.reading=!1,(pe.needReadable||pe.length<pe.highWaterMark)&&this._read(pe.highWaterMark)}function le(de){if(!(this instanceof le))return new le(de);ie.call(this,de),this._transformState={afterTransform:ae.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,de&&(typeof de.transform=="function"&&(this._transform=de.transform),typeof de.flush=="function"&&(this._flush=de.flush)),this.on("prefinish",Ie)}function Ie(){var de=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(Ne,he){ue(de,Ne,he)}):ue(this,null,null)}le.prototype.push=function(de,Ne){return this._transformState.needTransform=!1,ie.prototype.push.call(this,de,Ne)},le.prototype._transform=function(de,Ne,he){he(new $("_transform()"))},le.prototype._write=function(de,Ne,he){var ze=this._transformState;if(ze.writecb=he,ze.writechunk=de,ze.writeencoding=Ne,!ze.transforming){var pe=this._readableState;(ze.needTransform||pe.needReadable||pe.length<pe.highWaterMark)&&this._read(pe.highWaterMark)}},le.prototype._read=function(de){var Ne=this._transformState;Ne.writechunk!==null&&!Ne.transforming?(Ne.transforming=!0,this._transform(Ne.writechunk,Ne.writeencoding,Ne.afterTransform)):Ne.needTransform=!0},le.prototype._destroy=function(de,Ne){ie.prototype._destroy.call(this,de,function(he){Ne(he)})};function ue(de,Ne,he){if(Ne)return de.emit("error",Ne);if(he!=null&&de.push(he),de._writableState.length)throw new Ce;if(de._transformState.transforming)throw new re;return de.push(null)}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(r,g,V){(function(k,$){(function(){g.exports=Et;function oe(Mi){var Ni=this;this.next=null,this.entry=null,this.finish=function(){fi(Ni,Mi)}}var re;Et.WritableState=qe;var Ce={deprecate:r("util-deprecate")},ie=r("./internal/streams/stream"),ae=r("buffer").Buffer,le=$.Uint8Array||function(){};function Ie(Mi){return ae.from(Mi)}function ue(Mi){return ae.isBuffer(Mi)||Mi instanceof le}var de=r("./internal/streams/destroy"),Ne=r("./internal/streams/state"),he=Ne.getHighWaterMark,ze=r("../errors").codes,pe=ze.ERR_INVALID_ARG_TYPE,Ve=ze.ERR_METHOD_NOT_IMPLEMENTED,Oe=ze.ERR_MULTIPLE_CALLBACK,_e=ze.ERR_STREAM_CANNOT_PIPE,At=ze.ERR_STREAM_DESTROYED,$e=ze.ERR_STREAM_NULL_VALUES,Fe=ze.ERR_STREAM_WRITE_AFTER_END,Ue=ze.ERR_UNKNOWN_ENCODING,xe=de.errorOrDestroy;r("inherits")(Et,ie);function Dt(){}function qe(Mi,Ni,pi){re=re||r("./_stream_duplex"),Mi=Mi||{},typeof pi!="boolean"&&(pi=Ni instanceof re),this.objectMode=!!Mi.objectMode,pi&&(this.objectMode=this.objectMode||!!Mi.writableObjectMode),this.highWaterMark=he(this,Mi,"writableHighWaterMark",pi),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var vi=Mi.decodeStrings===!1;this.decodeStrings=!vi,this.defaultEncoding=Mi.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(bi){Ci(Ni,bi)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Mi.emitClose!==!1,this.autoDestroy=!!Mi.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new oe(this)}qe.prototype.getBuffer=function(){for(var Ni=this.bufferedRequest,pi=[];Ni;)pi.push(Ni),Ni=Ni.next;return pi},function(){try{Object.defineProperty(qe.prototype,"buffer",{get:Ce.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var kt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(kt=Function.prototype[Symbol.hasInstance],Object.defineProperty(Et,Symbol.hasInstance,{value:function(Ni){return kt.call(this,Ni)?!0:this!==Et?!1:Ni&&Ni._writableState instanceof qe}})):kt=function(Ni){return Ni instanceof this};function Et(Mi){re=re||r("./_stream_duplex");var Ni=this instanceof re;if(!Ni&&!kt.call(Et,this))return new Et(Mi);this._writableState=new qe(Mi,this,Ni),this.writable=!0,Mi&&(typeof Mi.write=="function"&&(this._write=Mi.write),typeof Mi.writev=="function"&&(this._writev=Mi.writev),typeof Mi.destroy=="function"&&(this._destroy=Mi.destroy),typeof Mi.final=="function"&&(this._final=Mi.final)),ie.call(this)}Et.prototype.pipe=function(){xe(this,new _e)};function jt(Mi,Ni){var pi=new Fe;xe(Mi,pi),k.nextTick(Ni,pi)}function ti(Mi,Ni,pi,vi){var bi;return pi===null?bi=new $e:typeof pi!="string"&&!Ni.objectMode&&(bi=new pe("chunk",["string","Buffer"],pi)),bi?(xe(Mi,bi),k.nextTick(vi,bi),!1):!0}Et.prototype.write=function(Mi,Ni,pi){var vi=this._writableState,bi=!1,ai=!vi.objectMode&&ue(Mi);return ai&&!ae.isBuffer(Mi)&&(Mi=Ie(Mi)),typeof Ni=="function"&&(pi=Ni,Ni=null),ai?Ni="buffer":Ni||(Ni=vi.defaultEncoding),typeof pi!="function"&&(pi=Dt),vi.ending?jt(this,pi):(ai||ti(this,vi,Mi,pi))&&(vi.pendingcb++,bi=Pt(this,vi,ai,Mi,Ni,pi)),bi},Et.prototype.cork=function(){this._writableState.corked++},Et.prototype.uncork=function(){var Mi=this._writableState;Mi.corked&&(Mi.corked--,!Mi.writing&&!Mi.corked&&!Mi.bufferProcessing&&Mi.bufferedRequest&&hi(this,Mi))},Et.prototype.setDefaultEncoding=function(Ni){if(typeof Ni=="string"&&(Ni=Ni.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Ni+"").toLowerCase())>-1))throw new Ue(Ni);return this._writableState.defaultEncoding=Ni,this},Object.defineProperty(Et.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Lt(Mi,Ni,pi){return!Mi.objectMode&&Mi.decodeStrings!==!1&&typeof Ni=="string"&&(Ni=ae.from(Ni,pi)),Ni}Object.defineProperty(Et.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Pt(Mi,Ni,pi,vi,bi,ai){if(!pi){var Ii=Lt(Ni,vi,bi);vi!==Ii&&(pi=!0,bi="buffer",vi=Ii)}var oi=Ni.objectMode?1:vi.length;Ni.length+=oi;var ei=Ni.length<Ni.highWaterMark;if(ei||(Ni.needDrain=!0),Ni.writing||Ni.corked){var ii=Ni.lastBufferedRequest;Ni.lastBufferedRequest={chunk:vi,encoding:bi,isBuf:pi,callback:ai,next:null},ii?ii.next=Ni.lastBufferedRequest:Ni.bufferedRequest=Ni.lastBufferedRequest,Ni.bufferedRequestCount+=1}else ni(Mi,Ni,!1,oi,vi,bi,ai);return ei}function ni(Mi,Ni,pi,vi,bi,ai,Ii){Ni.writelen=vi,Ni.writecb=Ii,Ni.writing=!0,Ni.sync=!0,Ni.destroyed?Ni.onwrite(new At("write")):pi?Mi._writev(bi,Ni.onwrite):Mi._write(bi,ai,Ni.onwrite),Ni.sync=!1}function ri(Mi,Ni,pi,vi,bi){--Ni.pendingcb,pi?(k.nextTick(bi,vi),k.nextTick(wi,Mi,Ni),Mi._writableState.errorEmitted=!0,xe(Mi,vi)):(bi(vi),Mi._writableState.errorEmitted=!0,xe(Mi,vi),wi(Mi,Ni))}function ui(Mi){Mi.writing=!1,Mi.writecb=null,Mi.length-=Mi.writelen,Mi.writelen=0}function Ci(Mi,Ni){var pi=Mi._writableState,vi=pi.sync,bi=pi.writecb;if(typeof bi!="function")throw new Oe;if(ui(pi),Ni)ri(Mi,pi,vi,Ni,bi);else{var ai=ci(pi)||Mi.destroyed;!ai&&!pi.corked&&!pi.bufferProcessing&&pi.bufferedRequest&&hi(Mi,pi),vi?k.nextTick(gi,Mi,pi,ai,bi):gi(Mi,pi,ai,bi)}}function gi(Mi,Ni,pi,vi){pi||di(Mi,Ni),Ni.pendingcb--,vi(),wi(Mi,Ni)}function di(Mi,Ni){Ni.length===0&&Ni.needDrain&&(Ni.needDrain=!1,Mi.emit("drain"))}function hi(Mi,Ni){Ni.bufferProcessing=!0;var pi=Ni.bufferedRequest;if(Mi._writev&&pi&&pi.next){var vi=Ni.bufferedRequestCount,bi=new Array(vi),ai=Ni.corkedRequestsFree;ai.entry=pi;for(var Ii=0,oi=!0;pi;)bi[Ii]=pi,pi.isBuf||(oi=!1),pi=pi.next,Ii+=1;bi.allBuffers=oi,ni(Mi,Ni,!0,Ni.length,bi,"",ai.finish),Ni.pendingcb++,Ni.lastBufferedRequest=null,ai.next?(Ni.corkedRequestsFree=ai.next,ai.next=null):Ni.corkedRequestsFree=new oe(Ni),Ni.bufferedRequestCount=0}else{for(;pi;){var ei=pi.chunk,ii=pi.encoding,si=pi.callback,zi=Ni.objectMode?1:ei.length;if(ni(Mi,Ni,!1,zi,ei,ii,si),pi=pi.next,Ni.bufferedRequestCount--,Ni.writing)break}pi===null&&(Ni.lastBufferedRequest=null)}Ni.bufferedRequest=pi,Ni.bufferProcessing=!1}Et.prototype._write=function(Mi,Ni,pi){pi(new Ve("_write()"))},Et.prototype._writev=null,Et.prototype.end=function(Mi,Ni,pi){var vi=this._writableState;return typeof Mi=="function"?(pi=Mi,Mi=null,Ni=null):typeof Ni=="function"&&(pi=Ni,Ni=null),Mi!=null&&this.write(Mi,Ni),vi.corked&&(vi.corked=1,this.uncork()),vi.ending||li(this,vi,pi),this},Object.defineProperty(Et.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function ci(Mi){return Mi.ending&&Mi.length===0&&Mi.bufferedRequest===null&&!Mi.finished&&!Mi.writing}function Ai(Mi,Ni){Mi._final(function(pi){Ni.pendingcb--,pi&&xe(Mi,pi),Ni.prefinished=!0,Mi.emit("prefinish"),wi(Mi,Ni)})}function yi(Mi,Ni){!Ni.prefinished&&!Ni.finalCalled&&(typeof Mi._final=="function"&&!Ni.destroyed?(Ni.pendingcb++,Ni.finalCalled=!0,k.nextTick(Ai,Mi,Ni)):(Ni.prefinished=!0,Mi.emit("prefinish")))}function wi(Mi,Ni){var pi=ci(Ni);if(pi&&(yi(Mi,Ni),Ni.pendingcb===0&&(Ni.finished=!0,Mi.emit("finish"),Ni.autoDestroy))){var vi=Mi._readableState;(!vi||vi.autoDestroy&&vi.endEmitted)&&Mi.destroy()}return pi}function li(Mi,Ni,pi){Ni.ending=!0,wi(Mi,Ni),pi&&(Ni.finished?k.nextTick(pi):Mi.once("finish",pi)),Ni.ended=!0,Mi.writable=!1}function fi(Mi,Ni,pi){var vi=Mi.entry;for(Mi.entry=null;vi;){var bi=vi.callback;Ni.pendingcb--,bi(pi),vi=vi.next}Ni.corkedRequestsFree.next=Mi}Object.defineProperty(Et.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(Ni){this._writableState&&(this._writableState.destroyed=Ni)}}),Et.prototype.destroy=de.destroy,Et.prototype._undestroy=de.undestroy,Et.prototype._destroy=function(Mi,Ni){Ni(Mi)}}).call(this)}).call(this,r("_process"),typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/destroy":63,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,inherits:24,"util-deprecate":78}],61:[function(r,g,V){(function(k){(function(){var $;function oe(At,$e,Fe){return $e in At?Object.defineProperty(At,$e,{value:Fe,enumerable:!0,configurable:!0,writable:!0}):At[$e]=Fe,At}var re=r("./end-of-stream"),Ce=Symbol("lastResolve"),ie=Symbol("lastReject"),ae=Symbol("error"),le=Symbol("ended"),Ie=Symbol("lastPromise"),ue=Symbol("handlePromise"),de=Symbol("stream");function Ne(At,$e){return{value:At,done:$e}}function he(At){var $e=At[Ce];if($e!==null){var Fe=At[de].read();Fe!==null&&(At[Ie]=null,At[Ce]=null,At[ie]=null,$e(Ne(Fe,!1)))}}function ze(At){k.nextTick(he,At)}function pe(At,$e){return function(Fe,Ue){At.then(function(){if($e[le]){Fe(Ne(void 0,!0));return}$e[ue](Fe,Ue)},Ue)}}var Ve=Object.getPrototypeOf(function(){}),Oe=Object.setPrototypeOf(($={get stream(){return this[de]},next:function(){var $e=this,Fe=this[ae];if(Fe!==null)return Promise.reject(Fe);if(this[le])return Promise.resolve(Ne(void 0,!0));if(this[de].destroyed)return new Promise(function(qe,kt){k.nextTick(function(){$e[ae]?kt($e[ae]):qe(Ne(void 0,!0))})});var Ue=this[Ie],xe;if(Ue)xe=new Promise(pe(Ue,this));else{var Dt=this[de].read();if(Dt!==null)return Promise.resolve(Ne(Dt,!1));xe=new Promise(this[ue])}return this[Ie]=xe,xe}},oe($,Symbol.asyncIterator,function(){return this}),oe($,"return",function(){var $e=this;return new Promise(function(Fe,Ue){$e[de].destroy(null,function(xe){if(xe){Ue(xe);return}Fe(Ne(void 0,!0))})})}),$),Ve),_e=function($e){var Fe,Ue=Object.create(Oe,(Fe={},oe(Fe,de,{value:$e,writable:!0}),oe(Fe,Ce,{value:null,writable:!0}),oe(Fe,ie,{value:null,writable:!0}),oe(Fe,ae,{value:null,writable:!0}),oe(Fe,le,{value:$e._readableState.endEmitted,writable:!0}),oe(Fe,ue,{value:function(Dt,qe){var kt=Ue[de].read();kt?(Ue[Ie]=null,Ue[Ce]=null,Ue[ie]=null,Dt(Ne(kt,!1))):(Ue[Ce]=Dt,Ue[ie]=qe)},writable:!0}),Fe));return Ue[Ie]=null,re($e,function(xe){if(xe&&xe.code!=="ERR_STREAM_PREMATURE_CLOSE"){var Dt=Ue[ie];Dt!==null&&(Ue[Ie]=null,Ue[Ce]=null,Ue[ie]=null,Dt(xe)),Ue[ae]=xe;return}var qe=Ue[Ce];qe!==null&&(Ue[Ie]=null,Ue[Ce]=null,Ue[ie]=null,qe(Ne(void 0,!0))),Ue[le]=!0}),$e.on("readable",ze.bind(null,Ue)),Ue};g.exports=_e}).call(this)}).call(this,r("_process"))},{"./end-of-stream":64,_process:50}],62:[function(r,g,V){function k(he,ze){var pe=Object.keys(he);if(Object.getOwnPropertySymbols){var Ve=Object.getOwnPropertySymbols(he);ze&&(Ve=Ve.filter(function(Oe){return Object.getOwnPropertyDescriptor(he,Oe).enumerable})),pe.push.apply(pe,Ve)}return pe}function $(he){for(var ze=1;ze<arguments.length;ze++){var pe=arguments[ze]!=null?arguments[ze]:{};ze%2?k(Object(pe),!0).forEach(function(Ve){oe(he,Ve,pe[Ve])}):Object.getOwnPropertyDescriptors?Object.defineProperties(he,Object.getOwnPropertyDescriptors(pe)):k(Object(pe)).forEach(function(Ve){Object.defineProperty(he,Ve,Object.getOwnPropertyDescriptor(pe,Ve))})}return he}function oe(he,ze,pe){return ze in he?Object.defineProperty(he,ze,{value:pe,enumerable:!0,configurable:!0,writable:!0}):he[ze]=pe,he}function re(he,ze){if(!(he instanceof ze))throw new TypeError("Cannot call a class as a function")}function Ce(he,ze){for(var pe=0;pe<ze.length;pe++){var Ve=ze[pe];Ve.enumerable=Ve.enumerable||!1,Ve.configurable=!0,"value"in Ve&&(Ve.writable=!0),Object.defineProperty(he,Ve.key,Ve)}}function ie(he,ze,pe){return ze&&Ce(he.prototype,ze),pe&&Ce(he,pe),he}var ae=r("buffer"),le=ae.Buffer,Ie=r("util"),ue=Ie.inspect,de=ue&&ue.custom||"inspect";function Ne(he,ze,pe){le.prototype.copy.call(he,ze,pe)}g.exports=function(){function he(){re(this,he),this.head=null,this.tail=null,this.length=0}return ie(he,[{key:"push",value:function(pe){var Ve={data:pe,next:null};this.length>0?this.tail.next=Ve:this.head=Ve,this.tail=Ve,++this.length}},{key:"unshift",value:function(pe){var Ve={data:pe,next:this.head};this.length===0&&(this.tail=Ve),this.head=Ve,++this.length}},{key:"shift",value:function(){if(this.length!==0){var pe=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,pe}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(pe){if(this.length===0)return"";for(var Ve=this.head,Oe=""+Ve.data;Ve=Ve.next;)Oe+=pe+Ve.data;return Oe}},{key:"concat",value:function(pe){if(this.length===0)return le.alloc(0);for(var Ve=le.allocUnsafe(pe>>>0),Oe=this.head,_e=0;Oe;)Ne(Oe.data,Ve,_e),_e+=Oe.data.length,Oe=Oe.next;return Ve}},{key:"consume",value:function(pe,Ve){var Oe;return pe<this.head.data.length?(Oe=this.head.data.slice(0,pe),this.head.data=this.head.data.slice(pe)):pe===this.head.data.length?Oe=this.shift():Oe=Ve?this._getString(pe):this._getBuffer(pe),Oe}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(pe){var Ve=this.head,Oe=1,_e=Ve.data;for(pe-=_e.length;Ve=Ve.next;){var At=Ve.data,$e=pe>At.length?At.length:pe;if($e===At.length?_e+=At:_e+=At.slice(0,pe),pe-=$e,pe===0){$e===At.length?(++Oe,Ve.next?this.head=Ve.next:this.head=this.tail=null):(this.head=Ve,Ve.data=At.slice($e));break}++Oe}return this.length-=Oe,_e}},{key:"_getBuffer",value:function(pe){var Ve=le.allocUnsafe(pe),Oe=this.head,_e=1;for(Oe.data.copy(Ve),pe-=Oe.data.length;Oe=Oe.next;){var At=Oe.data,$e=pe>At.length?At.length:pe;if(At.copy(Ve,Ve.length-pe,0,$e),pe-=$e,pe===0){$e===At.length?(++_e,Oe.next?this.head=Oe.next:this.head=this.tail=null):(this.head=Oe,Oe.data=At.slice($e));break}++_e}return this.length-=_e,Ve}},{key:de,value:function(pe,Ve){return ue(this,$({},Ve,{depth:0,customInspect:!1}))}}]),he}()},{buffer:17,util:16}],63:[function(r,g,V){(function(k){(function(){function $(le,Ie){var ue=this,de=this._readableState&&this._readableState.destroyed,Ne=this._writableState&&this._writableState.destroyed;return de||Ne?(Ie?Ie(le):le&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,k.nextTick(ie,this,le)):k.nextTick(ie,this,le)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(le||null,function(he){!Ie&&he?ue._writableState?ue._writableState.errorEmitted?k.nextTick(re,ue):(ue._writableState.errorEmitted=!0,k.nextTick(oe,ue,he)):k.nextTick(oe,ue,he):Ie?(k.nextTick(re,ue),Ie(he)):k.nextTick(re,ue)}),this)}function oe(le,Ie){ie(le,Ie),re(le)}function re(le){le._writableState&&!le._writableState.emitClose||le._readableState&&!le._readableState.emitClose||le.emit("close")}function Ce(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function ie(le,Ie){le.emit("error",Ie)}function ae(le,Ie){var ue=le._readableState,de=le._writableState;ue&&ue.autoDestroy||de&&de.autoDestroy?le.destroy(Ie):le.emit("error",Ie)}g.exports={destroy:$,undestroy:Ce,errorOrDestroy:ae}}).call(this)}).call(this,r("_process"))},{_process:50}],64:[function(r,g,V){var k=r("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function $(ie){var ae=!1;return function(){if(!ae){ae=!0;for(var le=arguments.length,Ie=new Array(le),ue=0;ue<le;ue++)Ie[ue]=arguments[ue];ie.apply(this,Ie)}}}function oe(){}function re(ie){return ie.setHeader&&typeof ie.abort=="function"}function Ce(ie,ae,le){if(typeof ae=="function")return Ce(ie,null,ae);ae||(ae={}),le=$(le||oe);var Ie=ae.readable||ae.readable!==!1&&ie.readable,ue=ae.writable||ae.writable!==!1&&ie.writable,de=function(){ie.writable||he()},Ne=ie._writableState&&ie._writableState.finished,he=function(){ue=!1,Ne=!0,Ie||le.call(ie)},ze=ie._readableState&&ie._readableState.endEmitted,pe=function(){Ie=!1,ze=!0,ue||le.call(ie)},Ve=function($e){le.call(ie,$e)},Oe=function(){var $e;if(Ie&&!ze)return(!ie._readableState||!ie._readableState.ended)&&($e=new k),le.call(ie,$e);if(ue&&!Ne)return(!ie._writableState||!ie._writableState.ended)&&($e=new k),le.call(ie,$e)},_e=function(){ie.req.on("finish",he)};return re(ie)?(ie.on("complete",he),ie.on("abort",Oe),ie.req?_e():ie.on("request",_e)):ue&&!ie._writableState&&(ie.on("end",de),ie.on("close",de)),ie.on("end",pe),ie.on("finish",he),ae.error!==!1&&ie.on("error",Ve),ie.on("close",Oe),function(){ie.removeListener("complete",he),ie.removeListener("abort",Oe),ie.removeListener("request",_e),ie.req&&ie.req.removeListener("finish",he),ie.removeListener("end",de),ie.removeListener("close",de),ie.removeListener("finish",he),ie.removeListener("end",pe),ie.removeListener("error",Ve),ie.removeListener("close",Oe)}}g.exports=Ce},{"../../../errors":55}],65:[function(r,g,V){g.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(r,g,V){var k;function $(he){var ze=!1;return function(){ze||(ze=!0,he.apply(void 0,arguments))}}var oe=r("../../../errors").codes,re=oe.ERR_MISSING_ARGS,Ce=oe.ERR_STREAM_DESTROYED;function ie(he){if(he)throw he}function ae(he){return he.setHeader&&typeof he.abort=="function"}function le(he,ze,pe,Ve){Ve=$(Ve);var Oe=!1;he.on("close",function(){Oe=!0}),k===void 0&&(k=r("./end-of-stream")),k(he,{readable:ze,writable:pe},function(At){if(At)return Ve(At);Oe=!0,Ve()});var _e=!1;return function(At){if(!Oe&&!_e){if(_e=!0,ae(he))return he.abort();if(typeof he.destroy=="function")return he.destroy();Ve(At||new Ce("pipe"))}}}function Ie(he){he()}function ue(he,ze){return he.pipe(ze)}function de(he){return!he.length||typeof he[he.length-1]!="function"?ie:he.pop()}function Ne(){for(var he=arguments.length,ze=new Array(he),pe=0;pe<he;pe++)ze[pe]=arguments[pe];var Ve=de(ze);if(Array.isArray(ze[0])&&(ze=ze[0]),ze.length<2)throw new re("streams");var Oe,_e=ze.map(function(At,$e){var Fe=$e<ze.length-1,Ue=$e>0;return le(At,Fe,Ue,function(xe){Oe||(Oe=xe),xe&&_e.forEach(Ie),!Fe&&(_e.forEach(Ie),Ve(Oe))})});return ze.reduce(ue)}g.exports=Ne},{"../../../errors":55,"./end-of-stream":64}],67:[function(r,g,V){var k=r("../../../errors").codes.ERR_INVALID_OPT_VALUE;function $(re,Ce,ie){return re.highWaterMark!=null?re.highWaterMark:Ce?re[ie]:null}function oe(re,Ce,ie,ae){var le=$(Ce,ae,ie);if(le!=null){if(!(isFinite(le)&&Math.floor(le)===le)||le<0){var Ie=ae?ie:"highWaterMark";throw new k(Ie,le)}return Math.floor(le)}return re.objectMode?16:16*1024}g.exports={getHighWaterMark:oe}},{"../../../errors":55}],68:[function(r,g,V){g.exports=r("events").EventEmitter},{events:22}],69:[function(r,g,V){V=g.exports=r("./lib/_stream_readable.js"),V.Stream=V,V.Readable=V,V.Writable=r("./lib/_stream_writable.js"),V.Duplex=r("./lib/_stream_duplex.js"),V.Transform=r("./lib/_stream_transform.js"),V.PassThrough=r("./lib/_stream_passthrough.js"),V.finished=r("./lib/internal/streams/end-of-stream.js"),V.pipeline=r("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":56,"./lib/_stream_passthrough.js":57,"./lib/_stream_readable.js":58,"./lib/_stream_transform.js":59,"./lib/_stream_writable.js":60,"./lib/internal/streams/end-of-stream.js":64,"./lib/internal/streams/pipeline.js":66}],70:[function(r,g,V){function k(oe,re,Ce){var ie=this;this._callback=oe,this._args=Ce,this._interval=setInterval(oe,re,this._args),this.reschedule=function(ae){ae||(ae=ie._interval),ie._interval&&clearInterval(ie._interval),ie._interval=setInterval(ie._callback,ae,ie._args)},this.clear=function(){ie._interval&&(clearInterval(ie._interval),ie._interval=void 0)},this.destroy=function(){ie._interval&&clearInterval(ie._interval),ie._callback=void 0,ie._interval=void 0,ie._args=void 0}}function $(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("interval needed");var oe;if(arguments.length>0){oe=new Array(arguments.length-2);for(var re=0;re<oe.length;re++)oe[re]=arguments[re+2]}return new k(arguments[0],arguments[1],oe)}g.exports=$},{}],71:[function(r,g,V){g.exports=r("./index.js")()},{"./index.js":72}],72:[function(r,g,V){(function(k){(function(){g.exports=oe;function $(Ce){return Ce instanceof k?k.from(Ce):new Ce.constructor(Ce.buffer.slice(),Ce.byteOffset,Ce.length)}function oe(Ce){if(Ce=Ce||{},Ce.circles)return re(Ce);return Ce.proto?le:ae;function ie(Ie,ue){for(var de=Object.keys(Ie),Ne=new Array(de.length),he=0;he<de.length;he++){var ze=de[he],pe=Ie[ze];typeof pe!="object"||pe===null?Ne[ze]=pe:pe instanceof Date?Ne[ze]=new Date(pe):ArrayBuffer.isView(pe)?Ne[ze]=$(pe):Ne[ze]=ue(pe)}return Ne}function ae(Ie){if(typeof Ie!="object"||Ie===null)return Ie;if(Ie instanceof Date)return new Date(Ie);if(Array.isArray(Ie))return ie(Ie,ae);if(Ie instanceof Map)return new Map(ie(Array.from(Ie),ae));if(Ie instanceof Set)return new Set(ie(Array.from(Ie),ae));var ue={};for(var de in Ie)if(Object.hasOwnProperty.call(Ie,de)!==!1){var Ne=Ie[de];typeof Ne!="object"||Ne===null?ue[de]=Ne:Ne instanceof Date?ue[de]=new Date(Ne):Ne instanceof Map?ue[de]=new Map(ie(Array.from(Ne),ae)):Ne instanceof Set?ue[de]=new Set(ie(Array.from(Ne),ae)):ArrayBuffer.isView(Ne)?ue[de]=$(Ne):ue[de]=ae(Ne)}return ue}function le(Ie){if(typeof Ie!="object"||Ie===null)return Ie;if(Ie instanceof Date)return new Date(Ie);if(Array.isArray(Ie))return ie(Ie,le);if(Ie instanceof Map)return new Map(ie(Array.from(Ie),le));if(Ie instanceof Set)return new Set(ie(Array.from(Ie),le));var ue={};for(var de in Ie){var Ne=Ie[de];typeof Ne!="object"||Ne===null?ue[de]=Ne:Ne instanceof Date?ue[de]=new Date(Ne):Ne instanceof Map?ue[de]=new Map(ie(Array.from(Ne),le)):Ne instanceof Set?ue[de]=new Set(ie(Array.from(Ne),le)):ArrayBuffer.isView(Ne)?ue[de]=$(Ne):ue[de]=le(Ne)}return ue}}function re(Ce){var ie=[],ae=[];return Ce.proto?ue:Ie;function le(de,Ne){for(var he=Object.keys(de),ze=new Array(he.length),pe=0;pe<he.length;pe++){var Ve=he[pe],Oe=de[Ve];if(typeof Oe!="object"||Oe===null)ze[Ve]=Oe;else if(Oe instanceof Date)ze[Ve]=new Date(Oe);else if(ArrayBuffer.isView(Oe))ze[Ve]=$(Oe);else{var _e=ie.indexOf(Oe);_e!==-1?ze[Ve]=ae[_e]:ze[Ve]=Ne(Oe)}}return ze}function Ie(de){if(typeof de!="object"||de===null)return de;if(de instanceof Date)return new Date(de);if(Array.isArray(de))return le(de,Ie);if(de instanceof Map)return new Map(le(Array.from(de),Ie));if(de instanceof Set)return new Set(le(Array.from(de),Ie));var Ne={};ie.push(de),ae.push(Ne);for(var he in de)if(Object.hasOwnProperty.call(de,he)!==!1){var ze=de[he];if(typeof ze!="object"||ze===null)Ne[he]=ze;else if(ze instanceof Date)Ne[he]=new Date(ze);else if(ze instanceof Map)Ne[he]=new Map(le(Array.from(ze),Ie));else if(ze instanceof Set)Ne[he]=new Set(le(Array.from(ze),Ie));else if(ArrayBuffer.isView(ze))Ne[he]=$(ze);else{var pe=ie.indexOf(ze);pe!==-1?Ne[he]=ae[pe]:Ne[he]=Ie(ze)}}return ie.pop(),ae.pop(),Ne}function ue(de){if(typeof de!="object"||de===null)return de;if(de instanceof Date)return new Date(de);if(Array.isArray(de))return le(de,ue);if(de instanceof Map)return new Map(le(Array.from(de),ue));if(de instanceof Set)return new Set(le(Array.from(de),ue));var Ne={};ie.push(de),ae.push(Ne);for(var he in de){var ze=de[he];if(typeof ze!="object"||ze===null)Ne[he]=ze;else if(ze instanceof Date)Ne[he]=new Date(ze);else if(ze instanceof Map)Ne[he]=new Map(le(Array.from(ze),ue));else if(ze instanceof Set)Ne[he]=new Set(le(Array.from(ze),ue));else if(ArrayBuffer.isView(ze))Ne[he]=$(ze);else{var pe=ie.indexOf(ze);pe!==-1?Ne[he]=ae[pe]:Ne[he]=ue(ze)}}return ie.pop(),ae.pop(),Ne}}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],73:[function(r,g,V){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var k=r("buffer"),$=k.Buffer;function oe(Ce,ie){for(var ae in Ce)ie[ae]=Ce[ae]}$.from&&$.alloc&&$.allocUnsafe&&$.allocUnsafeSlow?g.exports=k:(oe(k,V),V.Buffer=re);function re(Ce,ie,ae){return $(Ce,ie,ae)}re.prototype=Object.create($.prototype),oe($,re),re.from=function(Ce,ie,ae){if(typeof Ce=="number")throw new TypeError("Argument must not be a number");return $(Ce,ie,ae)},re.alloc=function(Ce,ie,ae){if(typeof Ce!="number")throw new TypeError("Argument must be a number");var le=$(Ce);return ie!==void 0?typeof ae=="string"?le.fill(ie,ae):le.fill(ie):le.fill(0),le},re.allocUnsafe=function(Ce){if(typeof Ce!="number")throw new TypeError("Argument must be a number");return $(Ce)},re.allocUnsafeSlow=function(Ce){if(typeof Ce!="number")throw new TypeError("Argument must be a number");return k.SlowBuffer(Ce)}},{buffer:17}],74:[function(r,g,V){g.exports=k;function k(oe){var re=oe._readableState;return re?re.objectMode||typeof oe._duplexState=="number"?oe.read():oe.read($(re)):null}function $(oe){return oe.buffer.length?oe.buffer.head?oe.buffer.head.data.length:oe.buffer[0].length:oe.length}},{}],75:[function(r,g,V){var k=r("safe-buffer").Buffer,$=k.isEncoding||function(_e){switch(_e=""+_e,_e&&_e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function oe(_e){if(!_e)return"utf8";for(var At;;)switch(_e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return _e;default:if(At)return;_e=(""+_e).toLowerCase(),At=!0}}function re(_e){var At=oe(_e);if(typeof At!="string"&&(k.isEncoding===$||!$(_e)))throw new Error("Unknown encoding: "+_e);return At||_e}V.StringDecoder=Ce;function Ce(_e){this.encoding=re(_e);var At;switch(this.encoding){case"utf16le":this.text=Ne,this.end=he,At=4;break;case"utf8":this.fillLast=Ie,At=4;break;case"base64":this.text=ze,this.end=pe,At=3;break;default:this.write=Ve,this.end=Oe;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=k.allocUnsafe(At)}Ce.prototype.write=function(_e){if(_e.length===0)return"";var At,$e;if(this.lastNeed){if(At=this.fillLast(_e),At===void 0)return"";$e=this.lastNeed,this.lastNeed=0}else $e=0;return $e<_e.length?At?At+this.text(_e,$e):this.text(_e,$e):At||""},Ce.prototype.end=de,Ce.prototype.text=ue,Ce.prototype.fillLast=function(_e){if(this.lastNeed<=_e.length)return _e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,_e.length),this.lastNeed-=_e.length};function ie(_e){return _e<=127?0:_e>>5===6?2:_e>>4===14?3:_e>>3===30?4:_e>>6===2?-1:-2}function ae(_e,At,$e){var Fe=At.length-1;if(Fe<$e)return 0;var Ue=ie(At[Fe]);return Ue>=0?(Ue>0&&(_e.lastNeed=Ue-1),Ue):--Fe<$e||Ue===-2?0:(Ue=ie(At[Fe]),Ue>=0?(Ue>0&&(_e.lastNeed=Ue-2),Ue):--Fe<$e||Ue===-2?0:(Ue=ie(At[Fe]),Ue>=0?(Ue>0&&(Ue===2?Ue=0:_e.lastNeed=Ue-3),Ue):0))}function le(_e,At,$e){if((At[0]&192)!==128)return _e.lastNeed=0,"�";if(_e.lastNeed>1&&At.length>1){if((At[1]&192)!==128)return _e.lastNeed=1,"�";if(_e.lastNeed>2&&At.length>2&&(At[2]&192)!==128)return _e.lastNeed=2,"�"}}function Ie(_e){var At=this.lastTotal-this.lastNeed,$e=le(this,_e);if($e!==void 0)return $e;if(this.lastNeed<=_e.length)return _e.copy(this.lastChar,At,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_e.copy(this.lastChar,At,0,_e.length),this.lastNeed-=_e.length}function ue(_e,At){var $e=ae(this,_e,At);if(!this.lastNeed)return _e.toString("utf8",At);this.lastTotal=$e;var Fe=_e.length-($e-this.lastNeed);return _e.copy(this.lastChar,0,Fe),_e.toString("utf8",At,Fe)}function de(_e){var At=_e&&_e.length?this.write(_e):"";return this.lastNeed?At+"�":At}function Ne(_e,At){if((_e.length-At)%2===0){var $e=_e.toString("utf16le",At);if($e){var Fe=$e.charCodeAt($e.length-1);if(Fe>=55296&&Fe<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=_e[_e.length-2],this.lastChar[1]=_e[_e.length-1],$e.slice(0,-1)}return $e}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=_e[_e.length-1],_e.toString("utf16le",At,_e.length-1)}function he(_e){var At=_e&&_e.length?this.write(_e):"";if(this.lastNeed){var $e=this.lastTotal-this.lastNeed;return At+this.lastChar.toString("utf16le",0,$e)}return At}function ze(_e,At){var $e=(_e.length-At)%3;return $e===0?_e.toString("base64",At):(this.lastNeed=3-$e,this.lastTotal=3,$e===1?this.lastChar[0]=_e[_e.length-1]:(this.lastChar[0]=_e[_e.length-2],this.lastChar[1]=_e[_e.length-1]),_e.toString("base64",At,_e.length-$e))}function pe(_e){var At=_e&&_e.length?this.write(_e):"";return this.lastNeed?At+this.lastChar.toString("base64",0,3-this.lastNeed):At}function Ve(_e){return _e.toString(this.encoding)}function Oe(_e){return _e&&_e.length?this.write(_e):""}},{"safe-buffer":73}],76:[function(r,g,V){var k=r("punycode"),$=r("./util");V.parse=At,V.resolve=Fe,V.resolveObject=Ue,V.format=$e,V.Url=oe;function oe(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var re=/^([a-z0-9.+-]+:)/i,Ce=/:[0-9]*$/,ie=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,ae=["<",">",'"',"`"," ","\r",`
1155
+ }`,"autocompletion.css",!1),g.AcePopup=Ie,g.$singleLineEditor=le,g.getAriaId=ae}),ace.define("ace/autocomplete/util",["require","exports","module"],function(r,g,V){g.parForEach=function($,oe,re){var Ce=0,ie=$.length;ie===0&&re();for(var ae=0;ae<ie;ae++)oe($[ae],function(le,Ie){Ce++,Ce===ie&&re(le,Ie)})};var k=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;g.retrievePrecedingIdentifier=function($,oe,re){re=re||k;for(var Ce=[],ie=oe-1;ie>=0&&re.test($[ie]);ie--)Ce.push($[ie]);return Ce.reverse().join("")},g.retrieveFollowingIdentifier=function($,oe,re){re=re||k;for(var Ce=[],ie=oe;ie<$.length&&re.test($[ie]);ie++)Ce.push($[ie]);return Ce},g.getCompletionPrefix=function($){var oe=$.getCursorPosition(),re=$.session.getLine(oe.row),Ce;return $.completers.forEach(function(ie){ie.identifierRegexps&&ie.identifierRegexps.forEach(function(ae){!Ce&&ae&&(Ce=this.retrievePrecedingIdentifier(re,oe.column,ae))}.bind(this))}.bind(this)),Ce||this.retrievePrecedingIdentifier(re,oe.column)}}),ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config"],function(r,g,V){var k=r("./keyboard/hash_handler").HashHandler,$=r("./autocomplete/popup").AcePopup,oe=r("./autocomplete/popup").getAriaId,re=r("./autocomplete/util"),Ce=r("./lib/lang"),ie=r("./lib/dom"),ae=r("./snippets").snippetManager,le=r("./config"),Ie=function(){this.autoInsert=!1,this.autoSelect=!0,this.exactMatch=!1,this.gatherCompletionsId=0,this.keyboardHandler=new k,this.keyboardHandler.bindKeys(this.commands),this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.changeTimer=Ce.delayedCall(function(){this.updateCompletions(!0)}.bind(this)),this.tooltipTimer=Ce.delayedCall(this.updateDocTooltip.bind(this),50)};(function(){this.$init=function(){return this.popup=new $(document.body||document.documentElement),this.popup.on("click",function(de){this.insertMatch(),de.stop()}.bind(this)),this.popup.focus=this.editor.focus.bind(this.editor),this.popup.on("show",this.tooltipTimer.bind(null,null)),this.popup.on("select",this.tooltipTimer.bind(null,null)),this.popup.on("changeHoverMarker",this.tooltipTimer.bind(null,null)),this.popup},this.getPopup=function(){return this.popup||this.$init()},this.openPopup=function(de,Ne,he){this.popup||this.$init(),this.popup.autoSelect=this.autoSelect,this.popup.setData(this.completions.filtered,this.completions.filterText),this.editor.textInput.setAriaOptions({activeDescendant:oe(this.popup.getRow())}),de.keyBinding.addKeyboardHandler(this.keyboardHandler);var ze=de.renderer;if(this.popup.setRow(this.autoSelect?0:-1),he)he&&!Ne&&this.detach();else{this.popup.setTheme(de.getTheme()),this.popup.setFontSize(de.getFontSize());var pe=ze.layerConfig.lineHeight,Ve=ze.$cursorLayer.getPixelPosition(this.base,!0);Ve.left-=this.popup.getTextLeftOffset();var Oe=de.container.getBoundingClientRect();Ve.top+=Oe.top-ze.layerConfig.offset,Ve.left+=Oe.left-de.renderer.scrollLeft,Ve.left+=ze.gutterWidth,this.popup.show(Ve,pe)}this.changeTimer.cancel()},this.detach=function(){this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off("changeSelection",this.changeListener),this.editor.off("blur",this.blurListener),this.editor.off("mousedown",this.mousedownListener),this.editor.off("mousewheel",this.mousewheelListener),this.changeTimer.cancel(),this.hideDocTooltip(),this.gatherCompletionsId+=1,this.popup&&this.popup.isOpen&&this.popup.hide(),this.base&&this.base.detach(),this.activated=!1,this.completions=this.base=null},this.changeListener=function(de){var Ne=this.editor.selection.lead;(Ne.row!=this.base.row||Ne.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},this.blurListener=function(de){var Ne=document.activeElement,he=this.editor.textInput.getElement(),ze=de.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(de.relatedTarget),pe=this.popup&&this.popup.container;Ne!=he&&Ne.parentNode!=pe&&!ze&&Ne!=this.tooltipNode&&de.relatedTarget!=he&&this.detach()},this.mousedownListener=function(de){this.detach()},this.mousewheelListener=function(de){this.detach()},this.goTo=function(de){this.popup.goTo(de)},this.insertMatch=function(de,Ne){if(de||(de=this.popup.getData(this.popup.getRow())),!de)return!1;var he=this.completions;if(this.editor.startOperation({command:{name:"insertMatch"}}),de.completer&&de.completer.insertMatch)de.completer.insertMatch(this.editor,de);else{if(!he)return!1;if(he.filterText)for(var ze=this.editor.selection.getAllRanges(),pe=0,Ve;Ve=ze[pe];pe++)Ve.start.column-=he.filterText.length,this.editor.session.remove(Ve);de.snippet?ae.insertSnippet(this.editor,de.snippet):this.editor.execCommand("insertstring",de.value||de)}this.completions==he&&this.detach(),this.editor.endOperation()},this.commands={Up:function(de){de.completer.goTo("up")},Down:function(de){de.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(de){de.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(de){de.completer.goTo("end")},Esc:function(de){de.completer.detach()},Return:function(de){return de.completer.insertMatch()},"Shift-Return":function(de){de.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(de){var Ne=de.completer.insertMatch();if(!Ne&&!de.tabstopManager)de.completer.goTo("down");else return Ne},PageUp:function(de){de.completer.popup.gotoPageUp()},PageDown:function(de){de.completer.popup.gotoPageDown()}},this.gatherCompletions=function(de,Ne){var he=de.getSession(),ze=de.getCursorPosition(),pe=re.getCompletionPrefix(de);this.base=he.doc.createAnchor(ze.row,ze.column-pe.length),this.base.$insertRight=!0;var Ve=[],Oe=de.completers.length;return de.completers.forEach(function(_e,At){_e.getCompletions(de,he,ze,pe,function($e,Fe){!$e&&Fe&&(Ve=Ve.concat(Fe)),Ne(null,{prefix:re.getCompletionPrefix(de),matches:Ve,finished:--Oe===0})})}),!0},this.showPopup=function(de,Ne){this.editor&&this.detach(),this.activated=!0,this.editor=de,de.completer!=this&&(de.completer&&de.completer.detach(),de.completer=this),de.on("changeSelection",this.changeListener),de.on("blur",this.blurListener),de.on("mousedown",this.mousedownListener),de.on("mousewheel",this.mousewheelListener),this.updateCompletions(!1,Ne)},this.updateCompletions=function(de,Ne){if(de&&this.base&&this.completions){var he=this.editor.getCursorPosition(),ze=this.editor.session.getTextRange({start:this.base,end:he});if(ze==this.completions.filterText)return;if(this.completions.setFilter(ze),!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==ze&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,ze,de);return}if(Ne&&Ne.matches){var he=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(he.row,he.column),this.base.$insertRight=!0,this.completions=new ue(Ne.matches),this.openPopup(this.editor,"",de)}var pe=this.gatherCompletionsId,Ve=function(Fe){if(Fe.finished)return this.detach()}.bind(this),Oe=function(Fe){var Ue=Fe.prefix,xe=Fe.matches;this.completions=new ue(xe),this.exactMatch&&(this.completions.exactMatch=!0),this.completions.setFilter(Ue);var Dt=this.completions.filtered;if(!Dt.length||Dt.length==1&&Dt[0].value==Ue&&!Dt[0].snippet)return Ve(Fe);if(this.autoInsert&&Dt.length==1&&Fe.finished)return this.insertMatch(Dt[0]);this.openPopup(this.editor,Ue,de)}.bind(this),_e=!0,At=null;if(this.gatherCompletions(this.editor,function(Fe,Ue){var xe=Ue.prefix,Dt=Ue&&Ue.matches;if(!Dt||!Dt.length)return Ve(Ue);if(!(xe.indexOf(Ue.prefix)!==0||pe!=this.gatherCompletionsId)){if(_e){At=Ue;return}Oe(Ue)}}.bind(this)),_e=!1,At){var $e=At;At=null,Oe($e)}},this.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},this.updateDocTooltip=function(){var de=this.popup,Ne=de.data,he=Ne&&(Ne[de.getHoveredRow()]||Ne[de.getRow()]),ze=null;if(!he||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();if(this.editor.completers.some(function(pe){return pe.getDocTooltip&&(ze=pe.getDocTooltip(he)),ze}),!ze&&typeof he!="string"&&(ze=he),typeof ze=="string"&&(ze={docText:ze}),!ze||!(ze.docHTML||ze.docText))return this.hideDocTooltip();this.showDocTooltip(ze)},this.showDocTooltip=function(de){this.tooltipNode||(this.tooltipNode=ie.createElement("div"),this.tooltipNode.className="ace_tooltip ace_doc-tooltip",this.tooltipNode.style.margin=0,this.tooltipNode.style.pointerEvents="auto",this.tooltipNode.tabIndex=-1,this.tooltipNode.onblur=this.blurListener.bind(this),this.tooltipNode.onclick=this.onTooltipClick.bind(this));var Ne=this.tooltipNode;de.docHTML?Ne.innerHTML=de.docHTML:de.docText&&(Ne.textContent=de.docText),Ne.parentNode||document.body.appendChild(Ne);var he=this.popup,ze=he.container.getBoundingClientRect();Ne.style.top=he.container.style.top,Ne.style.bottom=he.container.style.bottom,Ne.style.display="block",window.innerWidth-ze.right<320?ze.left<320?he.isTopdown?(Ne.style.top=ze.bottom+"px",Ne.style.left=ze.left+"px",Ne.style.right="",Ne.style.bottom=""):(Ne.style.top=he.container.offsetTop-Ne.offsetHeight+"px",Ne.style.left=ze.left+"px",Ne.style.right="",Ne.style.bottom=""):(Ne.style.right=window.innerWidth-ze.left+"px",Ne.style.left=""):(Ne.style.left=ze.right+1+"px",Ne.style.right="")},this.hideDocTooltip=function(){if(this.tooltipTimer.cancel(),!!this.tooltipNode){var de=this.tooltipNode;!this.editor.isFocused()&&document.activeElement==de&&this.editor.focus(),this.tooltipNode=null,de.parentNode&&de.parentNode.removeChild(de)}},this.onTooltipClick=function(de){for(var Ne=de.target;Ne&&Ne!=this.tooltipNode;){if(Ne.nodeName=="A"&&Ne.href){Ne.rel="noreferrer",Ne.target="_blank";break}Ne=Ne.parentNode}},this.destroy=function(){if(this.detach(),this.popup){this.popup.destroy();var de=this.popup.container;de&&de.parentNode&&de.parentNode.removeChild(de)}this.editor&&this.editor.completer==this&&this.editor.completer==null,this.popup=null}}).call(Ie.prototype),Ie.for=function(de){return de.completer||(le.get("sharedPopups")?(Ie.$shared||(Ie.$sharedInstance=new Ie),de.completer=Ie.$sharedInstance):(de.completer=new Ie,de.once("destroy",function(Ne,he){he.completer.destroy()}))),de.completer},Ie.startCommand={name:"startAutocomplete",exec:function(de,Ne){var he=Ie.for(de);he.autoInsert=!1,he.autoSelect=!0,he.showPopup(de,Ne),he.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var ue=function(de,Ne){this.all=de,this.filtered=de,this.filterText=Ne||"",this.exactMatch=!1};(function(){this.setFilter=function(de){if(de.length>this.filterText&&de.lastIndexOf(this.filterText,0)===0)var Ne=this.filtered;else var Ne=this.all;this.filterText=de,Ne=this.filterCompletions(Ne,this.filterText),Ne=Ne.sort(function(ze,pe){return pe.exactMatch-ze.exactMatch||pe.$score-ze.$score||(ze.caption||ze.value).localeCompare(pe.caption||pe.value)});var he=null;Ne=Ne.filter(function(ze){var pe=ze.snippet||ze.caption||ze.value;return pe===he?!1:(he=pe,!0)}),this.filtered=Ne},this.filterCompletions=function(de,Ne){var he=[],ze=Ne.toUpperCase(),pe=Ne.toLowerCase();e:for(var Ve=0,Oe;Oe=de[Ve];Ve++){var _e=Oe.caption||Oe.value||Oe.snippet;if(_e){var At=-1,$e=0,Fe=0,Ue,xe;if(this.exactMatch){if(Ne!==_e.substr(0,Ne.length))continue e}else{var Dt=_e.toLowerCase().indexOf(pe);if(Dt>-1)Fe=Dt;else for(var qe=0;qe<Ne.length;qe++){var kt=_e.indexOf(pe[qe],At+1),Et=_e.indexOf(ze[qe],At+1);if(Ue=kt>=0&&(Et<0||kt<Et)?kt:Et,Ue<0)continue e;xe=Ue-At-1,xe>0&&(At===-1&&(Fe+=10),Fe+=xe,$e=$e|1<<qe),At=Ue}}Oe.matchMask=$e,Oe.exactMatch=Fe?0:1,Oe.$score=(Oe.score||0)-Fe,he.push(Oe)}}return he}}).call(ue.prototype),g.Autocomplete=Ie,g.FilteredList=ue}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(r,g,V){var k=r("../range").Range,$=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;function oe(Ce,ie){var ae=Ce.getTextRange(k.fromPoints({row:0,column:0},ie));return ae.split($).length-1}function re(Ce,ie){var ae=oe(Ce,ie),le=Ce.getValue().split($),Ie=Object.create(null),ue=le[ae];return le.forEach(function(de,Ne){if(!(!de||de===ue)){var he=Math.abs(ae-Ne),ze=le.length-he;Ie[de]?Ie[de]=Math.max(ze,Ie[de]):Ie[de]=ze}}),Ie}g.getCompletions=function(Ce,ie,ae,le,Ie){var ue=re(ie,ae),de=Object.keys(ue);Ie(null,de.map(function(Ne){return{caption:Ne,value:Ne,score:ue[Ne],meta:"local"}}))}}),ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/autocomplete/text_completer","ace/editor","ace/config"],function(r,g,V){var k=r("../snippets").snippetManager,$=r("../autocomplete").Autocomplete,oe=r("../config"),re=r("../lib/lang"),Ce=r("../autocomplete/util"),ie=r("../autocomplete/text_completer"),ae={getCompletions:function(Oe,_e,At,$e,Fe){if(_e.$mode.completer)return _e.$mode.completer.getCompletions(Oe,_e,At,$e,Fe);var Ue=Oe.session.getState(At.row),xe=_e.$mode.getCompletions(Ue,_e,At,$e);Fe(null,xe)}},le=function(Oe){var _e={};return Oe.replace(/\${(\d+)(:(.*?))?}/g,function(At,$e,Fe,Ue){return _e[$e]=Ue||""}).replace(/\$(\d+?)/g,function(At,$e){return _e[$e]})},Ie={getCompletions:function(Oe,_e,At,$e,Fe){var Ue=[],xe=_e.getTokenAt(At.row,At.column);xe&&xe.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?Ue.push("html-tag"):Ue=k.getActiveScopes(Oe);var Dt=k.snippetMap,qe=[];Ue.forEach(function(kt){for(var Et=Dt[kt]||[],jt=Et.length;jt--;){var ti=Et[jt],Lt=ti.name||ti.tabTrigger;Lt&&qe.push({caption:Lt,snippet:ti.content,meta:ti.tabTrigger&&!ti.name?ti.tabTrigger+"⇥ ":"snippet",type:"snippet"})}},this),Fe(null,qe)},getDocTooltip:function(Oe){Oe.type=="snippet"&&!Oe.docHTML&&(Oe.docHTML=["<b>",re.escapeHTML(Oe.caption),"</b>","<hr></hr>",re.escapeHTML(le(Oe.snippet))].join(""))}},ue=[Ie,ie,ae];g.setCompleters=function(Oe){ue.length=0,Oe&&ue.push.apply(ue,Oe)},g.addCompleter=function(Oe){ue.push(Oe)},g.textCompleter=ie,g.keyWordCompleter=ae,g.snippetCompleter=Ie;var de={name:"expandSnippet",exec:function(Oe){return k.expandWithTab(Oe)},bindKey:"Tab"},Ne=function(Oe,_e){he(_e.session.$mode)},he=function(Oe){typeof Oe=="string"&&(Oe=oe.$modes[Oe]),Oe&&(k.files||(k.files={}),ze(Oe.$id,Oe.snippetFileId),Oe.modes&&Oe.modes.forEach(he))},ze=function(Oe,_e){!_e||!Oe||k.files[Oe]||(k.files[Oe]={},oe.loadModule(_e,function(At){At&&(k.files[Oe]=At,!At.snippets&&At.snippetText&&(At.snippets=k.parseSnippetFile(At.snippetText)),k.register(At.snippets||[],At.scope),At.includeScopes&&(k.snippetMap[At.scope].includeScopes=At.includeScopes,At.includeScopes.forEach(function($e){he("ace/mode/"+$e)})))}))},pe=function(Oe){var _e=Oe.editor,At=_e.completer&&_e.completer.activated;if(Oe.command.name==="backspace")At&&!Ce.getCompletionPrefix(_e)&&_e.completer.detach();else if(Oe.command.name==="insertstring"){var $e=Ce.getCompletionPrefix(_e);if($e&&!At){var Fe=$.for(_e);Fe.autoInsert=!1,Fe.showPopup(_e)}}},Ve=r("../editor").Editor;r("../config").defineOptions(Ve.prototype,"editor",{enableBasicAutocompletion:{set:function(Oe){Oe?(this.completers||(this.completers=Array.isArray(Oe)?Oe:ue),this.commands.addCommand($.startCommand)):this.commands.removeCommand($.startCommand)},value:!1},enableLiveAutocompletion:{set:function(Oe){Oe?(this.completers||(this.completers=Array.isArray(Oe)?Oe:ue),this.commands.on("afterExec",pe)):this.commands.removeListener("afterExec",pe)},value:!1},enableSnippets:{set:function(Oe){Oe?(this.commands.addCommand(de),this.on("changeMode",Ne),Ne(null,this)):(this.commands.removeCommand(de),this.off("changeMode",Ne))},value:!1}})}),function(){ace.require(["ace/ext/language_tools"],function(r){i&&(i.exports=r)})}()})(extLanguage_tools),ace$1.config.setModuleUrl("ace/theme/github",themeUrl),ace$1.config.setModuleUrl("ace/theme/kr_theme",themeUrl2),ace$1.config.setModuleUrl("ace/mode/base",workerBaseUrl),ace$1.config.setModuleUrl("ace/mode/json",modeJsonUrl),ace$1.config.setModuleUrl("ace/mode/json_worker",workerJsonUrl),ace$1.config.setModuleUrl("ace/snippets/json",snippetsJsonUrl),ace$1.config.setModuleUrl("ace/mode/javascript",modeJavascriptUrl),ace$1.config.setModuleUrl("ace/mode/javascript_worker",workerJavascriptUrl),ace$1.config.setModuleUrl("ace/snippets/javascript",snippetsJavascriptUrl),ace$1.require("ace/ext/language_tools");const _sfc_main$c=vue.defineComponent({__name:"code-edit-modal",props:{modelValue:{default:()=>({})},lang:{default:"json"},title:{default:"编辑"}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=vue.ref(!1),V=vue.computed({get(){return r.lang==="json"?JSON.stringify(r.modelValue,null,2):r.modelValue},set(k){r.lang==="json"?n("update:modelValue",JSON.parse(k)):n("update:modelValue",k)}});return(k,$)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(ElButton),{onClick:$[0]||($[0]=oe=>g.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("···")]),_:1}),vue.createVNode(vue.unref(ElDialog),{class:"modal-full",modelValue:vue.unref(g),"onUpdate:modelValue":$[2]||($[2]=oe=>vue.isRef(g)?g.value=oe:null),title:r.title,width:"60%"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(VAceEditor),{value:vue.unref(V),"onUpdate:value":$[1]||($[1]=oe=>vue.isRef(V)?V.value=oe:null),lang:r.lang,theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value","lang"])]),_:1},8,["modelValue","title"])]))}}),_hoisted_1$7={class:"one-row-txt",style:{width:"78px"}},_hoisted_2$5={key:1},_hoisted_3$5={class:"one-row-txt",style:{width:"145px"}},_hoisted_4$3={key:1},_sfc_main$b=vue.defineComponent({__name:"dynamic-el-form-item",props:{objInfo:{default:()=>({})},hide:{default:()=>[]},code:{type:Boolean,default:!1}},setup(i){const n=i;return(r,g)=>(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.objInfo,(V,k)=>(vue.openBlock(),vue.createElementBlock("div",{key:k},[n.code?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,class:"props-row",size:"small"},{label:vue.withCtx(()=>[vue.unref(getStringWidth)(String(k))>78?(vue.openBlock(),vue.createBlock(vue.unref(ElTooltip),{key:0,content:String(k),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$7,vue.toDisplayString(k),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$5,vue.toDisplayString(k),1))]),default:vue.withCtx(()=>[vue.unref(getStringWidth)(String(V.val))>145?(vue.openBlock(),vue.createBlock(vue.unref(ElTooltip),{key:0,content:JSON.stringify(V.val),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$5,vue.toDisplayString(V.val),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$3,vue.toDisplayString(V.val),1))]),_:2},1024)):vue.createCommentVNode("",!0),n.hide.indexOf(String(k))<0?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:1,label:V.title,size:"small"},{default:vue.withCtx(()=>[V.type===vue.unref(EConfigItemPropsType).Select?(vue.openBlock(),vue.createBlock(vue.unref(ElSelect),{key:0,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,placeholder:"Select",size:"small",disabled:!!(V!=null&&V.disabled)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(V.options,$=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:$.value,label:$.label,value:$.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).InputNumber?(vue.openBlock(),vue.createBlock(vue.unref(ElInputNumber),{key:1,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Input?(vue.openBlock(),vue.createBlock(vue.unref(ElInput),{key:2,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Textarea?(vue.openBlock(),vue.createBlock(vue.unref(ElInput),{key:3,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,autosize:"",type:"textarea",disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Color?(vue.openBlock(),vue.createBlock(vue.unref(ElColorPicker),{key:4,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).Switch?(vue.openBlock(),vue.createBlock(vue.unref(ElSwitch),{key:5,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):V.type===vue.unref(EConfigItemPropsType).JsonEdit?(vue.openBlock(),vue.createBlock(_sfc_main$c,{key:6,modelValue:V.val,"onUpdate:modelValue":$=>V.val=$,disabled:!!(V!=null&&V.disabled)},null,8,["modelValue","onUpdate:modelValue","disabled"])):vue.createCommentVNode("",!0)]),_:2},1032,["label"])):vue.createCommentVNode("",!0)]))),128))}}),dynamicElFormItem_vue_vue_type_style_index_0_scoped_9e624fb4_lang="",dynamicElFormItem_vue_vue_type_style_index_1_lang="",DynamicElFormItem=_export_sfc(_sfc_main$b,[["__scopeId","data-v-9e624fb4"]]),_hoisted_1$6={style:{height:"100%"}},_hoisted_2$4={class:"flex flex-wrap"},_hoisted_3$4=["onMouseenter","onClick"],_sfc_main$a=vue.defineComponent({__name:"common-animate",props:{val:{}},emits:["updateCommonAniVal"],setup(i,{emit:n}){const r=i,g=vue.ref(r.val),V=vue.ref(!1),k=vue.ref("进入"),$=vue.ref(null),oe=re=>{n("updateCommonAniVal",re),V.value=!1};return vue.watch(()=>r.val,re=>{g.value=re}),(re,Ce)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$6,[vue.unref(g)?(vue.openBlock(),vue.createBlock(vue.unref(ElTag),{key:0,closable:"",onClose:Ce[0]||(Ce[0]=ie=>oe("")),onClick:Ce[1]||(Ce[1]=ie=>V.value=!0),style:{cursor:"pointer"}},{default:vue.withCtx(()=>{var ie;return[vue.createTextVNode(vue.toDisplayString((ie=vue.unref(common_animate_list).map(ae=>ae.children).reduce((ae,le)=>ae.concat(le)).find(ae=>ae.value==vue.unref(g)))==null?void 0:ie.label)+" ",1),vue.createVNode(vue.unref(ElIcon),{size:10},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"setting"})]),_:1})]}),_:1})):(vue.openBlock(),vue.createBlock(vue.unref(ElTag),{key:1,type:"success",style:{cursor:"pointer"},onClick:Ce[2]||(Ce[2]=ie=>V.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("新增")]),_:1})),vue.createVNode(vue.unref(ElDrawer),{modelValue:vue.unref(V),"onUpdate:modelValue":Ce[5]||(Ce[5]=ie=>vue.isRef(V)?V.value=ie:null),title:"选择动画",direction:"ltr"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElTabs),{modelValue:vue.unref(k),"onUpdate:modelValue":Ce[4]||(Ce[4]=ie=>vue.isRef(k)?k.value=ie:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(common_animate_list),ie=>(vue.openBlock(),vue.createBlock(vue.unref(ElTabPane),{label:ie.label,name:ie.label,key:ie.label},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElScrollbar),{height:"500px"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_2$4,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(ie.children,(ae,le)=>(vue.openBlock(),vue.createElementBlock("div",{class:"animate",key:le,onMouseenter:Ie=>$.value=le,onMouseleave:Ce[3]||(Ce[3]=Ie=>$.value=null),onClick:Ie=>oe(ae.value)},[vue.createElementVNode("div",{class:vue.normalizeClass(`${vue.unref($)==le?`animate__animated animate__${ae.value} animate__slow animate__infinite`:""}`)},vue.toDisplayString(ae.label),3)],40,_hoisted_3$4))),128))])]),_:2},1024)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]))}}),commonAnimate_vue_vue_type_style_index_0_scoped_2807ad45_lang="",CommonAnimate=_export_sfc(_sfc_main$a,[["__scopeId","data-v-2807ad45"]]),_sfc_main$9=vue.defineComponent({__name:"index",setup(i){var k;const n=useGlobalStore(pinia),r=vue.ref(((k=n.handle_svg_info)==null?void 0:k.info.id)||""),g=$=>{for(let oe of n.done_json)oe.selected=!1,oe.old_position={x:0,y:0};n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo($)},V={children:"children",label:"title"};return($,oe)=>(vue.openBlock(),vue.createBlock(vue.unref(ElTree),{data:vue.unref(n).done_json,props:V,onNodeClick:g,"default-expand-all":!0,"expand-on-click-node":!1,"highlight-current":!0,"node-key":"id","current-node-key":vue.unref(r)},null,8,["data","current-node-key"]))}}),_withScopeId$1=i=>(vue.pushScopeId("data-v-c79cfc9b"),i=i(),vue.popScopeId(),i),_hoisted_1$5={class:"wall-l"},_hoisted_2$3={class:"head-l"},_hoisted_3$3=_withScopeId$1(()=>vue.createElementVNode("span",null,"key",-1)),_hoisted_4$2=_withScopeId$1(()=>vue.createElementVNode("span",null,"value",-1)),_hoisted_5$1={class:"row-l"},_sfc_main$8=vue.defineComponent({__name:"list",props:{modelValue:{default:()=>[{key:"",val:""}]}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=vue.computed({get(){return r.modelValue},set($){n("update:modelValue",$)}}),V=()=>{g.value.push({key:"",val:""})},k=$=>{g.value.splice($,1)};return($,oe)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$5,[vue.createElementVNode("div",_hoisted_2$3,[_hoisted_3$3,_hoisted_4$2,vue.createVNode(vue.unref(ElIcon),{size:16,class:"bt-Icon",onClick:V},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"add"})]),_:1})]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(g),(re,Ce)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,[vue.createVNode(vue.unref(ElInput),{class:"content-l",modelValue:re.key,"onUpdate:modelValue":ie=>re.key=ie,size:"small",placeholder:"key"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(ElInput),{class:"content-l",modelValue:re.val,"onUpdate:modelValue":ie=>re.val=ie,size:"small",placeholder:"value"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(ElIcon),{size:16,class:"bt-Icon",onClick:ie=>k(Ce)},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"delete"})]),_:2},1032,["onClick"])]))),256))]))}}),list_vue_vue_type_style_index_0_scoped_c79cfc9b_lang="",List=_export_sfc(_sfc_main$8,[["__scopeId","data-v-c79cfc9b"]]),_hoisted_1$4={class:"c-wall-d"},_sfc_main$7=vue.defineComponent({__name:"condition",props:{modelValue:{default:()=>({type:EConditionType.None})}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=vue.computed({get(){return r.modelValue},set($){n("update:modelValue",$)}}),V=[{label:"大于",val:"greater"},{label:"大于等于",val:">="},{label:"小于",val:"<"},{label:"小于等于",val:"<="},{label:"等于",val:"=="},{label:"不等于",val:"!="},{label:"介于",val:">=,=<"},{label:"不介于",val:"<,>"}],k=$=>{$!=="None"&&(g.value.Relation={key:"",relation:"",val:"",val2:""}),n("update:modelValue",g)};return($,oe)=>{var re,Ce;return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$4,[vue.createVNode(vue.unref(ElFormItem),{label:"条件",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(g).type,"onUpdate:modelValue":oe[0]||(oe[0]=ie=>vue.unref(g).type=ie),onChange:k},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"None",label:"无"}),vue.createVNode(vue.unref(ElOption),{value:"Relation",label:"关系运算"})]),_:1},8,["modelValue"])]),_:1}),vue.unref(g).type==="Relation"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"属性",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(g).Relation.key,"onUpdate:modelValue":oe[1]||(oe[1]=ie=>vue.unref(g).Relation.key=ie)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(g).type==="Relation"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:1,label:"关系",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(g).Relation.relation,"onUpdate:modelValue":oe[2]||(oe[2]=ie=>vue.unref(g).Relation.relation=ie)},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(V,(ie,ae)=>vue.createVNode(vue.unref(ElOption),{value:ie.val,label:ie.label,key:"rop"+ae},null,8,["value","label"])),64))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(g).type==="Relation"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:2,label:"值",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(g).Relation.val,"onUpdate:modelValue":oe[3]||(oe[3]=ie=>vue.unref(g).Relation.val=ie)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(g).type==="Relation"&&(((re=vue.unref(g).Relation)==null?void 0:re.relation)===">=,=<"||((Ce=vue.unref(g).Relation)==null?void 0:Ce.relation)==="<,>")?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:3,label:"值2",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(g).Relation.val2,"onUpdate:modelValue":oe[4]||(oe[4]=ie=>vue.unref(g).Relation.val2=ie)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)])}}}),condition_vue_vue_type_style_index_0_scoped_f43f10e6_lang="",Condition=_export_sfc(_sfc_main$7,[["__scopeId","data-v-f43f10e6"]]),_sfc_main$6=vue.defineComponent({__name:"bind-anchor",props:{modelValue:{},title:{}},emits:["update:modelValue"],setup(i,{emit:n}){const r=i,g=useGlobalStore(pinia),V=vue.computed({get(){return r.modelValue!==null},set(ie){let ae=null;ie&&(ae={target_id:"",type:""}),n("update:modelValue",ae)}}),k=vue.computed({get(){var ie;return((ie=r.modelValue)==null?void 0:ie.target_id)??void 0},set(ie){let ae=null;V.value&&(ae={target_id:ie,type:$.value}),n("update:modelValue",ae)}}),$=vue.computed({get(){var ie;return((ie=r.modelValue)==null?void 0:ie.type)??void 0},set(ie){let ae=null;V.value&&(ae={target_id:k.value,type:ie}),n("update:modelValue",ae)}}),oe=vue.computed(()=>g.done_json.filter(ie=>ie.type!==EDoneJsonType.ConnectionLine).map(ie=>({label:ie.title,value:ie.id}))),re=[{label:"上锚点",value:ELineBindAnchors.TopCenter},{label:"右锚点",value:ELineBindAnchors.Right},{label:"下锚点",value:ELineBindAnchors.BottomCenter},{label:"左锚点",value:ELineBindAnchors.Left}];function Ce(){vue.nextTick(function(){var ie,ae;if(V.value&&((ie=r.modelValue)!=null&&ie.target_id)&&((ae=r.modelValue)!=null&&ae.type)&&g.handle_svg_info){let le=null;for(let Ie of g.done_json)Ie.id===r.modelValue.target_id&&(le=Ie);le&&(setSvgActualInfo(le),moveAnchors(le))}})}return(ie,ae)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createVNode(vue.unref(ElFormItem),{label:r.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(V),"onUpdate:modelValue":ae[0]||(ae[0]=le=>vue.isRef(V)?V.value=le:null),onChange:Ce},null,8,["modelValue"])]),_:1},8,["label"]),vue.unref(V)?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"绑定对象",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(k),"onUpdate:modelValue":ae[1]||(ae[1]=le=>vue.isRef(k)?k.value=le:null),onChange:Ce},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(oe),le=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:le.value,label:le.label,value:le.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(V)?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:1,label:"绑定位置",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref($),"onUpdate:modelValue":ae[2]||(ae[2]=le=>vue.isRef($)?$.value=le:null),onChange:Ce},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(re,le=>vue.createVNode(vue.unref(ElOption),{key:le.value,label:le.label,value:le.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)],64))}}),_withScopeId=i=>(vue.pushScopeId("data-v-68351889"),i=i(),vue.popScopeId(),i),_hoisted_1$3=_withScopeId(()=>vue.createElementVNode("span",{style:{"font-weight":"bold"}},"MQTT",-1)),_hoisted_2$2={key:1},_hoisted_3$2={class:"events-title"},_sfc_main$5=vue.defineComponent({__name:"index",setup(i){const n=useConfigStore(pinia),r=useGlobalStore(pinia),g=useSvgEditLayoutStore(pinia),V=vue.ref("page"),k=vue.ref("style"),$=(ue,de)=>{ue!=null&&ue.common_animations&&(ue.common_animations.val=de)};n.$subscribe((ue,de)=>{ue.storeId==="config-store"&&localStorage.setItem("svg-editor-config",JSON.stringify(de))});const oe=vue.ref(numberArray(20)),re=vue.ref(["MQTT"]),Ce=vue.ref();Ce.value=()=>{var de,Ne;let ue={type:EEventType.Null,action:EEventAction.Null,target:"",scripts:"",condition:{type:EConditionType.None}};(Ne=(de=r.handle_svg_info)==null?void 0:de.info)==null||Ne.events.push(ue)};const ie=(ue,de)=>{ue==="ChangeAttr"?de.attrs=[{key:"",val:""}]:delete de.attrs},ae=ue=>{var de,Ne;(Ne=(de=r.handle_svg_info)==null?void 0:de.info)==null||Ne.events.splice(ue,1)},le=()=>{g.center_offset={x:0,y:0}},Ie=()=>{if(r.handle_svg_info){const ue=r.done_json[r.handle_svg_info.index];vue.nextTick(function(){setSvgActualInfo(ue),moveAnchors(ue)})}};return(ue,de)=>vue.unref(r).intention!=vue.unref(EGlobalStoreIntention).Select?(vue.openBlock(),vue.createBlock(vue.unref(ElTabs),{key:0,class:"mx-2 rightTabs",modelValue:vue.unref(V),"onUpdate:modelValue":de[13]||(de[13]=Ne=>vue.isRef(V)?V.value=Ne:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElTabPane),{label:"图纸",name:"page"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"背景色",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElColorPicker),{modelValue:vue.unref(n).svg.background_color,"onUpdate:modelValue":de[0]||(de[0]=Ne=>vue.unref(n).svg.background_color=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"画布",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElButton),{size:"small",onClick:le,icon:vue.unref(aim_default)},{default:vue.withCtx(()=>[vue.createTextVNode("重置位置")]),_:1},8,["icon"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"X轴偏移",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(g).center_offset.x,"onUpdate:modelValue":de[1]||(de[1]=Ne=>vue.unref(g).center_offset.x=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Y轴偏移",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(g).center_offset.y,"onUpdate:modelValue":de[2]||(de[2]=Ne=>vue.unref(g).center_offset.y=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(n).svg.scale,"onUpdate:modelValue":de[3]||(de[3]=Ne=>vue.unref(n).svg.scale=Ne),step:.1,"step-strictly":""},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"标尺",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(n).svg.ruler,"onUpdate:modelValue":de[4]||(de[4]=Ne=>vue.unref(n).svg.ruler=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"网格",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(n).svg.grid,"onUpdate:modelValue":de[5]||(de[5]=Ne=>vue.unref(n).svg.grid=Ne)},null,8,["modelValue"])]),_:1}),vue.unref(n).svg.grid?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"网格颜色",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElColorPicker),{modelValue:vue.unref(n).svg.grid_color,"onUpdate:modelValue":de[6]||(de[6]=Ne=>vue.unref(n).svg.grid_color=Ne)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)]),_:1})]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"连线",name:"line"},{default:vue.withCtx(()=>[vue.unref(n).connection_line.props?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:0,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(n).connection_line.props,hide:["point_position"]},null,8,["obj-info"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(n).connection_line.animations?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:1,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:vue.unref(n).connection_line.animations.type.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(n).connection_line.animations.type.val,"onUpdate:modelValue":de[7]||(de[7]=Ne=>vue.unref(n).connection_line.animations.type.val=Ne),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(n).connection_line.animations.type.options,Ne=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:Ne.value,label:Ne.label,value:Ne.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),vue.unref(n).connection_line.animations.type.val!=="None"?(vue.openBlock(),vue.createBlock(DynamicElFormItem,{key:0,"obj-info":vue.unref(n).connection_line.animations,hide:["type","repeatCount"]},null,8,["obj-info"])):vue.createCommentVNode("",!0)]),_:1})):vue.createCommentVNode("",!0)]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"通信",name:"net"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElCollapse),{modelValue:vue.unref(re),"onUpdate:modelValue":de[12]||(de[12]=Ne=>vue.isRef(re)?re.value=Ne:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElCollapseItem),{name:"MQTT"},{title:vue.withCtx(()=>[_hoisted_1$3]),default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"URL",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.url,"onUpdate:modelValue":de[8]||(de[8]=Ne=>vue.unref(n).net.mqtt.url=Ne),placeholder:"如 ws://127.0.0.1:4500"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"用户名",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.user,"onUpdate:modelValue":de[9]||(de[9]=Ne=>vue.unref(n).net.mqtt.user=Ne),placeholder:"username"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"密码",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.pwd,"onUpdate:modelValue":de[10]||(de[10]=Ne=>vue.unref(n).net.mqtt.pwd=Ne),placeholder:"password"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Topics",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(n).net.mqtt.topics,"onUpdate:modelValue":de[11]||(de[11]=Ne=>vue.unref(n).net.mqtt.topics=Ne),placeholder:"topics"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"结构",name:"tree"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$9)]),_:1})]),_:1},8,["modelValue"])):vue.unref(r).intention==vue.unref(EGlobalStoreIntention).Select&&vue.unref(r).handle_svg_info?(vue.openBlock(),vue.createBlock(vue.unref(ElTabs),{key:1,class:"mx-2 rightTabs",modelValue:vue.unref(k),"onUpdate:modelValue":de[31]||(de[31]=Ne=>vue.isRef(k)?k.value=Ne:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElTabPane),{label:"外观",name:"style"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"标题",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(r).handle_svg_info.info.title,"onUpdate:modelValue":de[14]||(de[14]=Ne=>vue.unref(r).handle_svg_info.info.title=Ne)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"X坐标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.x,"onUpdate:modelValue":de[15]||(de[15]=Ne=>vue.unref(r).handle_svg_info.info.x=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Y坐标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.y,"onUpdate:modelValue":de[16]||(de[16]=Ne=>vue.unref(r).handle_svg_info.info.y=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"X缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.scale_x,"onUpdate:modelValue":de[17]||(de[17]=Ne=>vue.unref(r).handle_svg_info.info.scale_x=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"Y缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.scale_y,"onUpdate:modelValue":de[18]||(de[18]=Ne=>vue.unref(r).handle_svg_info.info.scale_y=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"旋转",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInputNumber),{modelValue:vue.unref(r).handle_svg_info.info.rotate,"onUpdate:modelValue":de[19]||(de[19]=Ne=>vue.unref(r).handle_svg_info.info.rotate=Ne),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"显示",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(r).handle_svg_info.info.display,"onUpdate:modelValue":de[20]||(de[20]=Ne=>vue.unref(r).handle_svg_info.info.display=Ne)},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"数据",name:"data"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"90px","label-position":"left"},{default:vue.withCtx(()=>{var Ne,he,ze;return[vue.createVNode(vue.unref(ElFormItem),{label:"ID",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(r).handle_svg_info.info.id,"onUpdate:modelValue":de[21]||(de[21]=pe=>vue.unref(r).handle_svg_info.info.id=pe)},null,8,["modelValue"])]),_:1}),vue.unref(r).handle_svg_info.info.state?(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,{key:0},vue.renderList(vue.unref(r).handle_svg_info.info.state,(pe,Ve)=>{var Oe;return vue.openBlock(),vue.createElementBlock("div",{key:"state"+String(Ve)},[vue.createVNode(vue.unref(ElFormItem),{class:"props-row",label:String(Ve),size:"small"},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(pe==null?void 0:pe.default),1)]),_:2},1032,["label"]),Ve==="OnOff"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:(Oe=vue.unref(r).handle_svg_info.info.state)==null?void 0:Oe.OnOff.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSwitch),{modelValue:vue.unref(r).handle_svg_info.info.state.OnOff.default,"onUpdate:modelValue":de[22]||(de[22]=_e=>vue.unref(r).handle_svg_info.info.state.OnOff.default=_e)},null,8,["modelValue"])]),_:1},8,["label"])):vue.createCommentVNode("",!0)])}),128)):vue.createCommentVNode("",!0),(Ne=vue.unref(r).handle_svg_info.info)!=null&&Ne.hasOwnProperty("tag_slot")?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$2,[vue.createVNode(vue.unref(ElFormItem),{class:"props-row",label:"tag_slot",size:"small"},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(vue.unref(r).handle_svg_info.info.tag_slot),1)]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"文字插槽",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:vue.unref(r).handle_svg_info.info.tag_slot,"onUpdate:modelValue":de[23]||(de[23]=pe=>vue.unref(r).handle_svg_info.info.tag_slot=pe)},null,8,["modelValue"])]),_:1})])):vue.createCommentVNode("",!0),vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(r).handle_svg_info.info.props,code:""},null,8,["obj-info"]),((he=vue.unref(r).handle_svg_info)==null?void 0:he.info.type)===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$6,{key:2,modelValue:vue.unref(r).handle_svg_info.info.bind_anchors.start,"onUpdate:modelValue":de[24]||(de[24]=pe=>vue.unref(r).handle_svg_info.info.bind_anchors.start=pe),title:"绑定起点"},null,8,["modelValue"])):vue.createCommentVNode("",!0),((ze=vue.unref(r).handle_svg_info)==null?void 0:ze.info.type)===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$6,{key:3,modelValue:vue.unref(r).handle_svg_info.info.bind_anchors.end,"onUpdate:modelValue":de[25]||(de[25]=pe=>vue.unref(r).handle_svg_info.info.bind_anchors.end=pe),title:"绑定终点"},null,8,["modelValue"])):vue.createCommentVNode("",!0)]}),_:1})]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"事件",name:"event"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElButton),{type:"primary",style:{width:"100%"},onClick:vue.unref(Ce)},{default:vue.withCtx(()=>[vue.createTextVNode("添加事件")]),_:1},8,["onClick"]),vue.createVNode(vue.unref(ElCollapse),{modelValue:vue.unref(oe),"onUpdate:modelValue":de[26]||(de[26]=Ne=>vue.isRef(oe)?oe.value=Ne:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(r).handle_svg_info.info.events,(Ne,he)=>(vue.openBlock(),vue.createBlock(vue.unref(ElCollapseItem),{name:he,key:"event"+he},{title:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$2,[vue.createElementVNode("span",null,"事件"+vue.toDisplayString(he+1),1),vue.createVNode(vue.unref(ElIcon),{size:16,class:"bt-Icon",onClick:vue.withModifiers(ze=>ae(he),["stop"])},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$j,{name:"delete"})]),_:2},1032,["onClick"])])]),default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElForm),{"label-width":"90px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"类型",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:Ne.type,"onUpdate:modelValue":ze=>Ne.type=ze},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"Click",label:"点击"}),vue.createVNode(vue.unref(ElOption),{value:"Change",label:"值改变"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),vue.createVNode(vue.unref(ElFormItem),{label:"行为",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:Ne.action,"onUpdate:modelValue":ze=>Ne.action=ze,onChange:ze=>ie(ze,Ne)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"ChangeAttr",label:"改变属性"}),vue.createVNode(vue.unref(ElOption),{value:"JavaScript",label:"执行JavaScript"})]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1024),Ne.action==="ChangeAttr"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,label:"目标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElInput),{modelValue:Ne.target,"onUpdate:modelValue":ze=>Ne.target=ze,placeholder:"默认自身"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),Ne.action==="ChangeAttr"?(vue.openBlock(),vue.createBlock(List,{key:1,modelValue:Ne.attrs,"onUpdate:modelValue":ze=>Ne.attrs=ze},null,8,["modelValue","onUpdate:modelValue"])):vue.createCommentVNode("",!0),Ne.action==="JavaScript"?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:2,label:"JavaScript",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$c,{modelValue:Ne.scripts,"onUpdate:modelValue":ze=>Ne.scripts=ze,lang:"javascript"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),vue.createVNode(Condition,{modelValue:Ne.condition,"onUpdate:modelValue":ze=>Ne.condition=ze},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"动效",name:"animation"},{default:vue.withCtx(()=>{var Ne;return[(Ne=vue.unref(r).handle_svg_info)!=null&&Ne.info.animations?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:0,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(r).handle_svg_info.info.animations},null,8,["obj-info"])]),_:1})):vue.unref(r).handle_svg_info.info.common_animations?(vue.openBlock(),vue.createBlock(vue.unref(ElForm),{key:1,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElFormItem),{label:"动画效果",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(CommonAnimate,{onUpdateCommonAniVal:de[27]||(de[27]=he=>{var ze;return $((ze=vue.unref(r).handle_svg_info)==null?void 0:ze.info,he)}),val:vue.unref(r).handle_svg_info.info.common_animations.val},null,8,["val"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"延迟",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.common_animations.delay,"onUpdate:modelValue":de[28]||(de[28]=he=>vue.unref(r).handle_svg_info.info.common_animations.delay=he)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"delay-0s",label:"无"}),vue.createVNode(vue.unref(ElOption),{value:"delay-1s",label:"1秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-2s",label:"2秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-3s",label:"3秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-4s",label:"4秒"}),vue.createVNode(vue.unref(ElOption),{value:"delay-5s",label:"5秒"})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"动画速度",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.common_animations.speed,"onUpdate:modelValue":de[29]||(de[29]=he=>vue.unref(r).handle_svg_info.info.common_animations.speed=he)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"slow",label:"慢"}),vue.createVNode(vue.unref(ElOption),{value:"slower",label:"最慢"}),vue.createVNode(vue.unref(ElOption),{value:"fast",label:"快"}),vue.createVNode(vue.unref(ElOption),{value:"faster",label:"最快"})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(ElFormItem),{label:"循环次数",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.common_animations.repeat,"onUpdate:modelValue":de[30]||(de[30]=he=>vue.unref(r).handle_svg_info.info.common_animations.repeat=he)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElOption),{value:"repeat-1",label:"一次"}),vue.createVNode(vue.unref(ElOption),{value:"repeat-2",label:"两次"}),vue.createVNode(vue.unref(ElOption),{value:"repeat-3",label:"三次"}),vue.createVNode(vue.unref(ElOption),{value:"infinite",label:"无限次"})]),_:1},8,["modelValue"])]),_:1})]),_:1})):vue.createCommentVNode("",!0)]}),_:1}),vue.createVNode(vue.unref(ElTabPane),{label:"结构",name:"tree"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$9)]),_:1})]),_:1},8,["modelValue"])):vue.createCommentVNode("",!0)}}),index_vue_vue_type_style_index_0_scoped_68351889_lang="",index_vue_vue_type_style_index_1_lang="",RightPanel=_export_sfc(_sfc_main$5,[["__scopeId","data-v-68351889"]]),_sfc_main$4=vue.defineComponent({__name:"index",setup(i){const n=vue.ref(""),r=useGlobalStore(pinia),g=useSvgEditLayoutStore(pinia),V=useConfigStore(pinia);return vue.onMounted(()=>{const k={layout_center:g.center_offset,config:V.$state,done_json:r.done_json};n.value=JSON.stringify(k,null,2)}),(k,$)=>(vue.openBlock(),vue.createBlock(vue.unref(VAceEditor),{value:vue.unref(n),"onUpdate:value":$[0]||($[0]=oe=>vue.isRef(n)?n.value=oe:null),lang:"json",theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value"]))}}),_sfc_main$3=vue.defineComponent({__name:"index",setup(i,{expose:n}){const r=vue.ref("");return n({setVal:k=>{r.value=k},onImportJson:()=>{useImportDataModel(r.value)&&ElMessage.success("导入成功")}}),(k,$)=>(vue.openBlock(),vue.createBlock(vue.unref(VAceEditor),{value:vue.unref(r),"onUpdate:value":$[0]||($[0]=oe=>vue.isRef(r)?r.value=oe:null),lang:"json",theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value"]))}}),_hoisted_1$2=["onMousedown"],_hoisted_2$1=["onMousedown"],_hoisted_3$1=["title","onMousedown"],_hoisted_4$1={class:"vue-ruler-content-mask"},_sfc_main$2=vue.defineComponent({__name:"index",props:{visible:{type:Boolean,default:!0},stepLength:{default:100}},setup(i){const n=i,r=useSvgEditLayoutStore(pinia),g=useConfigStore(pinia),V=function(){return function(ci,Ai,yi){ci&&Ai&&yi&&ci.addEventListener(Ai,yi,!1)}}(),k=function(){return function(ci,Ai,yi){ci&&Ai&&ci.removeEventListener(Ai,yi,!1)}}();let $=18,oe=vue.ref(0),re=vue.ref(0),Ce=vue.ref([]),ie=vue.ref([]);const ae=vue.ref([]);let le=vue.ref(!1),Ie="",ue=vue.ref(-999),de=vue.ref(-999),Ne=18,he=18,ze="";const pe=vue.ref(null),Ve=vue.ref(null),Oe=vue.ref(null),_e=vue.ref(null),At=vue.computed(()=>({width:oe.value+"px",height:re.value+"px"})),$e=vue.computed(()=>({padding:$+"px 0px 0px "+$+"px"})),Fe=vue.computed(()=>{let ci=0,Ai=0;return ae.value.map(yi=>{const wi=yi.type==="h";return{id:`${yi.type}_${wi?ci++:Ai++}`,type:yi.type,title:yi.site.toFixed(0)+"px",[wi?"top":"left"]:yi.site*g.svg.scale+$+r.center_offset[wi?"y":"x"]*g.svg.scale}})});r.$subscribe(ci=>{var Ai,yi,wi,li;((yi=(Ai=ci.events)==null?void 0:Ai.target)!=null&&yi.hasOwnProperty("left_nav")||(li=(wi=ci.events)==null?void 0:wi.target)!=null&&li.hasOwnProperty("right_nav"))&&window.setTimeout(Ue,420)}),g.$subscribe(ci=>{var Ai,yi;(yi=(Ai=ci.events)==null?void 0:Ai.target)!=null&&yi.hasOwnProperty("scale")&&Et()}),vue.onMounted(()=>{V(document,"mousemove",ti),V(document,"mouseup",ni),Ue(),V(window,"resize",xe)}),vue.onBeforeUnmount(()=>{k(document,"mousemove",ti),k(document,"mouseup",ni),k(window,"resize",xe)});const Ue=()=>{kt(),Et()},xe=()=>{Ce.value=[],ie.value=[],Ue()},Dt=({type:ci,top:Ai,left:yi})=>ci==="h"?{top:Ai+"px"}:{left:yi+"px"},qe=({type:ci,id:Ai})=>ci==="h"?di(Ai):hi(Ai),kt=()=>{const ci=window.getComputedStyle(Ve.value.parentNode,null);oe.value=parseInt(ci.getPropertyValue("width")),re.value=parseInt(ci.getPropertyValue("height")),Ne=Oe.value.clientWidth,he=_e.value.clientHeight},Et=()=>{jt(Ce.value,oe.value,r.center_offset.x),jt(ie.value,re.value,r.center_offset.y)},jt=(ci,Ai,yi)=>{if(ci.length===0)for(let wi=0;wi<Ai;wi+=n.stepLength)wi%n.stepLength===0&&ci.push({id:Number((wi/g.svg.scale-yi).toFixed(0))});else ci.forEach((wi,li)=>{wi.id=Number((li*n.stepLength/g.svg.scale-yi).toFixed(0))})},ti=ci=>{Et(),Lt(ci)},Lt=ci=>{if(!(ci.layerX===ci.x||ci.layerY===ci.y))switch(Ie){case"x":le.value&&(de.value=ci.layerY);break;case"y":le.value&&(ue.value=ci.layerX);break;case"h":le.value&&(de.value=ci.layerY);break;case"v":le.value&&(ue.value=ci.layerX);break}},Pt=ci=>{le.value=!0,Ie=ci},ni=ci=>{ri(ci)},ri=ci=>{if(le.value){switch(le.value=!1,Ie){case"x":const Ai=Math.round((ci.layerY-$)/g.svg.scale-r.center_offset.y);if(Ai<=0){de.value=-999;return}ae.value.push({type:"h",site:Ai});break;case"y":const yi=Math.round((ci.layerX-$)/g.svg.scale-r.center_offset.x);if(yi<=0){ue.value=-999;return}ae.value.push({type:"v",site:yi});break;case"h":ui(ae.value,Math.round((ci.layerY-$)/g.svg.scale-r.center_offset.y),Math.round(he/g.svg.scale-r.center_offset.y),"h");break;case"v":ui(ae.value,Math.round((ci.layerX-$)/g.svg.scale-r.center_offset.x),Math.round(Ne/g.svg.scale-r.center_offset.x),"v");break}de.value=ue.value=-999}},ui=(ci,Ai,yi,wi)=>{if(Ai<yi){let li;Fe.value.forEach((fi,Mi)=>{fi.id===ze&&(li=Mi)}),ci.splice(li,1)}else{let li;Fe.value.forEach((fi,Mi)=>{fi.id===ze&&(li=Mi)}),ci.splice(li,1,{type:wi,site:Ai})}},Ci=()=>{Pt("x")},gi=()=>{Pt("y")},di=ci=>{le.value=!0,Ie="h",ze=ci},hi=ci=>{le.value=!0,Ie="v",ze=ci};return(ci,Ai)=>(vue.openBlock(),vue.createElementBlock("div",{style:vue.normalizeStyle(vue.unref(At)),class:"vue-ruler-wrapper",onselectStart:"return false;",ref_key:"el",ref:Ve},[vue.withDirectives(vue.createElementVNode("section",null,[vue.createElementVNode("div",{ref_key:"horizontalRuler",ref:_e,class:"vue-ruler-h",onMousedown:vue.withModifiers(Ci,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(Ce),(yi,wi)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({left:wi*ci.stepLength+"px"}),class:"n"},vue.toDisplayString(yi.id),5))),256))],40,_hoisted_1$2),vue.createElementVNode("div",{ref_key:"verticalRuler",ref:Oe,class:"vue-ruler-v",onMousedown:vue.withModifiers(gi,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(ie),(yi,wi)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({top:wi*ci.stepLength+"px"}),class:"n"},vue.toDisplayString(yi.id),5))),256))],40,_hoisted_2$1),vue.createElementVNode("div",{style:vue.normalizeStyle({top:vue.unref(de)+"px"}),class:"vue-ruler-ref-dot-h"},[vue.createElementVNode("span",null,vue.toDisplayString(Math.round((vue.unref(de)-vue.unref(he))/vue.unref(g).svg.scale)),1)],4),vue.createElementVNode("div",{style:vue.normalizeStyle({left:vue.unref(ue)+"px"}),class:"vue-ruler-ref-dot-v"},[vue.createElementVNode("span",null,vue.toDisplayString(Math.round((vue.unref(ue)-vue.unref(Ne))/vue.unref(g).svg.scale)),1)],4),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(Fe),yi=>(vue.openBlock(),vue.createElementBlock("div",{title:yi.title,style:vue.normalizeStyle(Dt(yi)),key:yi.id,class:vue.normalizeClass(`vue-ruler-ref-line-${yi.type}`),onMousedown:wi=>qe(yi)},null,46,_hoisted_3$1))),128))],512),[[vue.vShow,n.visible]]),vue.createElementVNode("div",{ref_key:"content",ref:pe,class:"vue-ruler-content",style:vue.normalizeStyle(vue.unref($e))},[vue.renderSlot(ci.$slots,"default")],4),vue.withDirectives(vue.createElementVNode("div",_hoisted_4$1,null,512),[[vue.vShow,vue.unref(le)]])],4))}}),index_vue_vue_type_style_index_0_lang="";function fileWrite(i,n=new Date(Date.now()).toLocaleString()){const r=JSON.stringify(i),g=new Blob([r]);let V=document.createElement("a");V.download=n+".json",V.style.display="none",V.href=URL.createObjectURL(g),document.body.appendChild(V),V.click(),document.body.removeChild(V)}function fileRead(i){return new Promise((n,r)=>{let g=new FileReader;g.readAsText(i,"UTF-8"),g.onload=function(V){V&&V.target?n(V.target.result):r("文件读取错误")}})}const _hoisted_1$1={class:"canvas-main-pc"},_sfc_main$1=vue.defineComponent({__name:"index",props:{customToolbar:{},data:{},saveFile:{type:Boolean,default:!1}},emits:["onReturn","onPreview","onSave"],setup(i,{expose:n,emit:r}){const g=i,V=useGlobalStore(pinia),k=useSvgEditLayoutStore(pinia),$=useConfigStore(pinia),oe=useEditPrivateStore(pinia),re=vue.ref(),Ce=vue.reactive({[EVisibleConfKey.ExportJson]:!1,[EVisibleConfKey.ImportJson]:!1,[EVisibleConfKey.ImportFile]:!1}),ie=(Ne,he)=>{Ce[Ne]=he},ae=vue.ref();ae.value=()=>{re.value.onImportJson(),ie(EVisibleConfKey.ImportJson,!1)};const le=Ne=>["text/plain","application/json"].indexOf(Ne.type)<0?(ElMessage.error("仅支持的格式:txt、json"),!1):(fileRead(Ne).then(he=>{re.value.setVal(he),ElMessage.success("文件读取成功!")}),!1),Ie=Ne=>{V.setDoneJson(Ne)};vue.onMounted(()=>{oe.history_doneComponent=[],oe.history_now_index=0,g.data?useImportDataModel(g.data):V.setDoneJson([]),V.intention=EGlobalStoreIntention.None});const{appContext:ue}=vue.getCurrentInstance();function de(Ne){g.saveFile?ElMessageBox.prompt("请输入文件名","保存",{cancelButtonText:"取消",confirmButtonText:"保存"},ue).then(he=>{fileWrite(Ne,he.value.trim()),r("onSave",Ne)}).catch(he=>{console.log(he)}):r("onSave",Ne)}return n({setGraphNodeJson:Ie}),(Ne,he)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(ElContainer),null,{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElHeader),{class:"top-el-header"},{default:vue.withCtx(()=>[vue.createVNode(TopPanel,{onChangeVisible:ie,onOnReturn:he[0]||(he[0]=ze=>r("onReturn")),onOnPreview:he[1]||(he[1]=ze=>r("onPreview",ze)),onOnSave:de})]),_:1}),vue.createVNode(vue.unref(ElContainer),{class:"middle"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElAside),{class:vue.normalizeClass(["side-nav",vue.unref(k).left_nav?"show-nav":"hide-nav"]),style:{"border-right":"1px solid #efefef"}},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElScrollbar),{class:"el-scroll-pc"},{default:vue.withCtx(()=>[vue.createVNode(LeftPanel,{class:"content-left","custom-toolbar":g.customToolbar},null,8,["custom-toolbar"])]),_:1})]),_:1},8,["class"]),vue.createVNode(vue.unref(ElMain),{class:"middle main"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$1,[vue.createVNode(_sfc_main$2,{class:"canvas-main-pc",visible:vue.unref($).svg.ruler},{default:vue.withCtx(()=>[vue.createVNode(CenterPanel)]),_:1},8,["visible"])])]),_:1}),vue.createVNode(vue.unref(ElAside),{class:vue.normalizeClass(["side-nav",vue.unref(k).right_nav?"show-nav":"hide-nav"]),style:{"border-left":"1px solid #efefef"}},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElScrollbar),{class:"el-scroll-pc"},{default:vue.withCtx(()=>[vue.createVNode(RightPanel)]),_:1})]),_:1},8,["class"])]),_:1})]),_:1}),vue.createVNode(vue.unref(ElDialog),{class:"modal-full",modelValue:vue.unref(Ce).ImportJson,"onUpdate:modelValue":he[3]||(he[3]=ze=>vue.unref(Ce).ImportJson=ze),title:"导入数据",width:"60%","destroy-on-close":""},{footer:vue.withCtx(()=>[vue.createVNode(vue.unref(ElUpload),{beforeUpload:le,style:{display:"inline-flex","margin-right":"12px"},multiple:!1,"show-file-list":!1,limit:1},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElButton),{onClick:he[2]||(he[2]=ze=>ie(vue.unref(EVisibleConfKey).ImportFile,!0))},{default:vue.withCtx(()=>[vue.createTextVNode("读取文件")]),_:1})]),_:1}),vue.createVNode(vue.unref(ElButton),{type:"primary",onClick:vue.unref(ae)},{default:vue.withCtx(()=>[vue.createTextVNode("导入数据")]),_:1},8,["onClick"])]),default:vue.withCtx(()=>[vue.createVNode(_sfc_main$3,{ref_key:"importJsonRef",ref:re},null,512)]),_:1},8,["modelValue"]),vue.createVNode(vue.unref(ElDialog),{class:"modal-full",modelValue:vue.unref(Ce).ExportJson,"onUpdate:modelValue":he[4]||(he[4]=ze=>vue.unref(Ce).ExportJson=ze),title:"导出",width:"60%","destroy-on-close":""},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$4)]),_:1},8,["modelValue"])]))}}),index_vue_vue_type_style_index_0_scoped_ad4c8816_lang="",index$1=_export_sfc(_sfc_main$1,[["__scopeId","data-v-ad4c8816"]]);function commonjsRequire(i){throw new Error('Could not dynamically require "'+i+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var mqtt={exports:{}};(function(i,n){(function(r){i.exports=r()})(function(){return function(){function r(g,V,k){function $(Ce,ie){if(!V[Ce]){if(!g[Ce]){var ae=typeof commonjsRequire=="function"&&commonjsRequire;if(!ie&&ae)return ae(Ce,!0);if(oe)return oe(Ce,!0);var le=new Error("Cannot find module '"+Ce+"'");throw le.code="MODULE_NOT_FOUND",le}var Ie=V[Ce]={exports:{}};g[Ce][0].call(Ie.exports,function(ue){var de=g[Ce][1][ue];return $(de||ue)},Ie,Ie.exports,r,g,V,k)}return V[Ce].exports}for(var oe=typeof commonjsRequire=="function"&&commonjsRequire,re=0;re<k.length;re++)$(k[re]);return $}return r}()({1:[function(r,g,V){(function(k,$){(function(){const oe=r("events").EventEmitter,re=r("./store"),Ce=r("./topic-alias-recv"),ie=r("./topic-alias-send"),ae=r("mqtt-packet"),le=r("./default-message-id-provider"),Ie=r("readable-stream").Writable,ue=r("inherits"),de=r("reinterval"),Ne=r("rfdc/default"),he=r("./validations"),ze=r("xtend"),pe=r("debug")("mqttjs:client"),Ve=k?k.nextTick:function(Lt){setTimeout(Lt,0)},Oe=$.setImmediate||function(Lt){Ve(Lt)},_e={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0},At=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],$e={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function Fe(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function Ue(Lt,Pt){if(Lt.options.protocolVersion===5&&Pt.cmd==="publish"){let ni;Pt.properties&&(ni=Pt.properties.topicAlias);const ri=Pt.topic.toString();if(Lt.topicAliasSend)if(ni){if(ri.length!==0&&(pe("applyTopicAlias :: register topic: %s - alias: %d",ri,ni),!Lt.topicAliasSend.put(ri,ni)))return pe("applyTopicAlias :: error out of range. topic: %s - alias: %d",ri,ni),new Error("Sending Topic Alias out of range")}else ri.length!==0&&(Lt.options.autoAssignTopicAlias?(ni=Lt.topicAliasSend.getAliasByTopic(ri),ni?(Pt.topic="",Pt.properties={...Pt.properties,topicAlias:ni},pe("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",ri,ni)):(ni=Lt.topicAliasSend.getLruAlias(),Lt.topicAliasSend.put(ri,ni),Pt.properties={...Pt.properties,topicAlias:ni},pe("applyTopicAlias :: auto assign topic: %s - alias: %d",ri,ni))):Lt.options.autoUseTopicAlias&&(ni=Lt.topicAliasSend.getAliasByTopic(ri),ni&&(Pt.topic="",Pt.properties={...Pt.properties,topicAlias:ni},pe("applyTopicAlias :: auto use topic: %s - alias: %d",ri,ni))));else if(ni)return pe("applyTopicAlias :: error out of range. topic: %s - alias: %d",ri,ni),new Error("Sending Topic Alias out of range")}}function xe(Lt,Pt){let ni;Pt.properties&&(ni=Pt.properties.topicAlias);let ri=Pt.topic.toString();if(ri.length===0){if(typeof ni>"u")return new Error("Unregistered Topic Alias");if(ri=Lt.topicAliasSend.getTopicByAlias(ni),typeof ri>"u")return new Error("Unregistered Topic Alias");Pt.topic=ri}ni&&delete Pt.properties.topicAlias}function Dt(Lt,Pt,ni){pe("sendPacket :: packet: %O",Pt),pe("sendPacket :: emitting `packetsend`"),Lt.emit("packetsend",Pt),pe("sendPacket :: writing to stream");const ri=ae.writeToStream(Pt,Lt.stream,Lt.options);pe("sendPacket :: writeToStream result %s",ri),!ri&&ni&&ni!==jt?(pe("sendPacket :: handle events on `drain` once through callback."),Lt.stream.once("drain",ni)):ni&&(pe("sendPacket :: invoking cb"),ni())}function qe(Lt){Lt&&(pe("flush: queue exists? %b",!!Lt),Object.keys(Lt).forEach(function(Pt){typeof Lt[Pt].cb=="function"&&(Lt[Pt].cb(new Error("Connection closed")),delete Lt[Pt])}))}function kt(Lt){Lt&&(pe("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(Lt).forEach(function(Pt){Lt[Pt].volatile&&typeof Lt[Pt].cb=="function"&&(Lt[Pt].cb(new Error("Connection closed")),delete Lt[Pt])}))}function Et(Lt,Pt,ni,ri){pe("storeAndSend :: store packet with cmd %s to outgoingStore",Pt.cmd);let ui=Pt,Ci;if(ui.cmd==="publish"&&(ui=Ne(Pt),Ci=xe(Lt,ui),Ci))return ni&&ni(Ci);Lt.outgoingStore.put(ui,function(di){if(di)return ni&&ni(di);ri(),Dt(Lt,Pt,ni)})}function jt(Lt){pe("nop ::",Lt)}function ti(Lt,Pt){let ni;const ri=this;if(!(this instanceof ti))return new ti(Lt,Pt);this.options=Pt||{};for(ni in _e)typeof this.options[ni]>"u"?this.options[ni]=_e[ni]:this.options[ni]=Pt[ni];pe("MqttClient :: options.protocol",Pt.protocol),pe("MqttClient :: options.protocolVersion",Pt.protocolVersion),pe("MqttClient :: options.username",Pt.username),pe("MqttClient :: options.keepalive",Pt.keepalive),pe("MqttClient :: options.reconnectPeriod",Pt.reconnectPeriod),pe("MqttClient :: options.rejectUnauthorized",Pt.rejectUnauthorized),pe("MqttClient :: options.topicAliasMaximum",Pt.topicAliasMaximum),this.options.clientId=typeof Pt.clientId=="string"?Pt.clientId:Fe(),pe("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=Pt.protocolVersion===5&&Pt.customHandleAcks?Pt.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=Lt,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new le:this.options.messageIdProvider,this.outgoingStore=Pt.outgoingStore||new re,this.incomingStore=Pt.incomingStore||new re,this.queueQoSZero=Pt.queueQoSZero===void 0?!0:Pt.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,Pt.topicAliasMaximum>0&&(Pt.topicAliasMaximum>65535?pe("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new Ce(Pt.topicAliasMaximum)),this.on("connect",function(){const ui=this.queue;function Ci(){const gi=ui.shift();pe("deliver :: entry %o",gi);let di=null;if(!gi){ri._resubscribe();return}di=gi.packet,pe("deliver :: call _sendPacket for %o",di);let hi=!0;di.messageId&&di.messageId!==0&&(ri.messageIdProvider.register(di.messageId)||(hi=!1)),hi?ri._sendPacket(di,function(ci){gi.cb&&gi.cb(ci),Ci()}):(pe("messageId: %d has already used. The message is skipped and removed.",di.messageId),Ci())}pe("connect :: sending queued packets"),Ci()}),this.on("close",function(){pe("close :: connected set to `false`"),this.connected=!1,pe("close :: clearing connackTimer"),clearTimeout(this.connackTimer),pe("close :: clearing ping timer"),ri.pingTimer!==null&&(ri.pingTimer.clear(),ri.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),pe("close :: calling _setupReconnect"),this._setupReconnect()}),oe.call(this),pe("MqttClient :: setting up stream"),this._setupStream()}ue(ti,oe),ti.prototype._setupStream=function(){const Lt=this,Pt=new Ie,ni=ae.parser(this.options);let ri=null;const ui=[];pe("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),pe("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),ni.on("packet",function(ci){pe("parser :: on packet push to packets array."),ui.push(ci)});function Ci(){if(ui.length)Ve(gi);else{const ci=ri;ri=null,ci()}}function gi(){pe("work :: getting next packet in queue");const ci=ui.shift();if(ci)pe("work :: packet pulled from queue"),Lt._handlePacket(ci,Ci);else{pe("work :: no packets in queue");const Ai=ri;ri=null,pe("work :: done flag is %s",!!Ai),Ai&&Ai()}}Pt._write=function(ci,Ai,yi){ri=yi,pe("writable stream :: parsing buffer"),ni.parse(ci),gi()};function di(ci){pe("streamErrorHandler :: error",ci.message),At.includes(ci.code)?(pe("streamErrorHandler :: emitting error"),Lt.emit("error",ci)):jt(ci)}pe("_setupStream :: pipe stream to writable stream"),this.stream.pipe(Pt),this.stream.on("error",di),this.stream.on("close",function(){pe("(%s)stream :: on close",Lt.options.clientId),kt(Lt.outgoing),pe("stream: emit close to MqttClient"),Lt.emit("close")}),pe("_setupStream: sending packet `connect`");const hi=Object.create(this.options);if(hi.cmd="connect",this.topicAliasRecv&&(hi.properties||(hi.properties={}),this.topicAliasRecv&&(hi.properties.topicAliasMaximum=this.topicAliasRecv.max)),Dt(this,hi),ni.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return Lt.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"){const ci=ze({cmd:"auth",reasonCode:0},this.options.authPacket);Dt(this,ci)}}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){pe("!!connectTimeout hit!! Calling _cleanUp with force `true`"),Lt._cleanUp(!0)},this.options.connectTimeout)},ti.prototype._handlePacket=function(Lt,Pt){const ni=this.options;if(ni.protocolVersion===5&&ni.properties&&ni.properties.maximumPacketSize&&ni.properties.maximumPacketSize<Lt.length)return this.emit("error",new Error("exceeding packets size "+Lt.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(pe("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",Lt),Lt.cmd){case"publish":this._handlePublish(Lt,Pt);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(Lt),Pt();break;case"pubrel":this._handlePubrel(Lt,Pt);break;case"connack":this._handleConnack(Lt),Pt();break;case"auth":this._handleAuth(Lt),Pt();break;case"pingresp":this._handlePingresp(Lt),Pt();break;case"disconnect":this._handleDisconnect(Lt),Pt();break}},ti.prototype._checkDisconnecting=function(Lt){return this.disconnecting&&(Lt&&Lt!==jt?Lt(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},ti.prototype.publish=function(Lt,Pt,ni,ri){pe("publish :: message `%s` to topic `%s`",Pt,Lt);const ui=this.options;if(typeof ni=="function"&&(ri=ni,ni=null),ni=ze({qos:0,retain:!1,dup:!1},ni),this._checkDisconnecting(ri))return this;const gi=this,di=function(){let hi=0;if((ni.qos===1||ni.qos===2)&&(hi=gi._nextId(),hi===null))return pe("No messageId left"),!1;const ci={cmd:"publish",topic:Lt,payload:Pt,qos:ni.qos,retain:ni.retain,messageId:hi,dup:ni.dup};switch(ui.protocolVersion===5&&(ci.properties=ni.properties),pe("publish :: qos",ni.qos),ni.qos){case 1:case 2:gi.outgoing[ci.messageId]={volatile:!1,cb:ri||jt},pe("MqttClient:publish: packet cmd: %s",ci.cmd),gi._sendPacket(ci,void 0,ni.cbStorePut);break;default:pe("MqttClient:publish: packet cmd: %s",ci.cmd),gi._sendPacket(ci,ri,ni.cbStorePut);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!di())&&this._storeProcessingQueue.push({invoke:di,cbStorePut:ni.cbStorePut,callback:ri}),this},ti.prototype.subscribe=function(){const Lt=this,Pt=new Array(arguments.length);for(let yi=0;yi<arguments.length;yi++)Pt[yi]=arguments[yi];const ni=[];let ri=Pt.shift();const ui=ri.resubscribe;let Ci=Pt.pop()||jt,gi=Pt.pop();const di=this.options.protocolVersion;delete ri.resubscribe,typeof ri=="string"&&(ri=[ri]),typeof Ci!="function"&&(gi=Ci,Ci=jt);const hi=he.validateTopics(ri);if(hi!==null)return Oe(Ci,new Error("Invalid topic "+hi)),this;if(this._checkDisconnecting(Ci))return pe("subscribe: discconecting true"),this;const ci={qos:0};if(di===5&&(ci.nl=!1,ci.rap=!1,ci.rh=0),gi=ze(ci,gi),Array.isArray(ri)?ri.forEach(function(yi){if(pe("subscribe: array topic %s",yi),!Object.prototype.hasOwnProperty.call(Lt._resubscribeTopics,yi)||Lt._resubscribeTopics[yi].qos<gi.qos||ui){const wi={topic:yi,qos:gi.qos};di===5&&(wi.nl=gi.nl,wi.rap=gi.rap,wi.rh=gi.rh,wi.properties=gi.properties),pe("subscribe: pushing topic `%s` and qos `%s` to subs list",wi.topic,wi.qos),ni.push(wi)}}):Object.keys(ri).forEach(function(yi){if(pe("subscribe: object topic %s",yi),!Object.prototype.hasOwnProperty.call(Lt._resubscribeTopics,yi)||Lt._resubscribeTopics[yi].qos<ri[yi].qos||ui){const wi={topic:yi,qos:ri[yi].qos};di===5&&(wi.nl=ri[yi].nl,wi.rap=ri[yi].rap,wi.rh=ri[yi].rh,wi.properties=gi.properties),pe("subscribe: pushing `%s` to subs list",wi),ni.push(wi)}}),!ni.length)return Ci(null,[]),this;const Ai=function(){const yi=Lt._nextId();if(yi===null)return pe("No messageId left"),!1;const wi={cmd:"subscribe",subscriptions:ni,qos:1,retain:!1,dup:!1,messageId:yi};if(gi.properties&&(wi.properties=gi.properties),Lt.options.resubscribe){pe("subscribe :: resubscribe true");const li=[];ni.forEach(function(fi){if(Lt.options.reconnectPeriod>0){const Mi={qos:fi.qos};di===5&&(Mi.nl=fi.nl||!1,Mi.rap=fi.rap||!1,Mi.rh=fi.rh||0,Mi.properties=fi.properties),Lt._resubscribeTopics[fi.topic]=Mi,li.push(fi.topic)}}),Lt.messageIdToTopic[wi.messageId]=li}return Lt.outgoing[wi.messageId]={volatile:!0,cb:function(li,fi){if(!li){const Mi=fi.granted;for(let Ni=0;Ni<Mi.length;Ni+=1)ni[Ni].qos=Mi[Ni]}Ci(li,ni)}},pe("subscribe :: call _sendPacket"),Lt._sendPacket(wi),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!Ai())&&this._storeProcessingQueue.push({invoke:Ai,callback:Ci}),this},ti.prototype.unsubscribe=function(){const Lt=this,Pt=new Array(arguments.length);for(let di=0;di<arguments.length;di++)Pt[di]=arguments[di];let ni=Pt.shift(),ri=Pt.pop()||jt,ui=Pt.pop();typeof ni=="string"&&(ni=[ni]),typeof ri!="function"&&(ui=ri,ri=jt);const Ci=he.validateTopics(ni);if(Ci!==null)return Oe(ri,new Error("Invalid topic "+Ci)),this;if(Lt._checkDisconnecting(ri))return this;const gi=function(){const di=Lt._nextId();if(di===null)return pe("No messageId left"),!1;const hi={cmd:"unsubscribe",qos:1,messageId:di};return typeof ni=="string"?hi.unsubscriptions=[ni]:Array.isArray(ni)&&(hi.unsubscriptions=ni),Lt.options.resubscribe&&hi.unsubscriptions.forEach(function(ci){delete Lt._resubscribeTopics[ci]}),typeof ui=="object"&&ui.properties&&(hi.properties=ui.properties),Lt.outgoing[hi.messageId]={volatile:!0,cb:ri},pe("unsubscribe: call _sendPacket"),Lt._sendPacket(hi),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!gi())&&this._storeProcessingQueue.push({invoke:gi,callback:ri}),this},ti.prototype.end=function(Lt,Pt,ni){const ri=this;pe("end :: (%s)",this.options.clientId),(Lt==null||typeof Lt!="boolean")&&(ni=Pt||jt,Pt=Lt,Lt=!1,typeof Pt!="object"&&(ni=Pt,Pt=null,typeof ni!="function"&&(ni=jt))),typeof Pt!="object"&&(ni=Pt,Pt=null),pe("end :: cb? %s",!!ni),ni=ni||jt;function ui(){pe("end :: closeStores: closing incoming and outgoing stores"),ri.disconnected=!0,ri.incomingStore.close(function(gi){ri.outgoingStore.close(function(di){if(pe("end :: closeStores: emitting end"),ri.emit("end"),ni){const hi=gi||di;pe("end :: closeStores: invoking callback with args"),ni(hi)}})}),ri._deferredReconnect&&ri._deferredReconnect()}function Ci(){pe("end :: (%s) :: finish :: calling _cleanUp with force %s",ri.options.clientId,Lt),ri._cleanUp(Lt,()=>{pe("end :: finish :: calling process.nextTick on closeStores"),Ve(ui.bind(ri))},Pt)}return this.disconnecting?(ni(),this):(this._clearReconnect(),this.disconnecting=!0,!Lt&&Object.keys(this.outgoing).length>0?(pe("end :: (%s) :: calling finish in 10ms once outgoing is empty",ri.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,Ci,10))):(pe("end :: (%s) :: immediately calling finish",ri.options.clientId),Ci()),this)},ti.prototype.removeOutgoingMessage=function(Lt){const Pt=this.outgoing[Lt]?this.outgoing[Lt].cb:null;return delete this.outgoing[Lt],this.outgoingStore.del({messageId:Lt},function(){Pt(new Error("Message removed"))}),this},ti.prototype.reconnect=function(Lt){pe("client reconnect");const Pt=this,ni=function(){Lt?(Pt.options.incomingStore=Lt.incomingStore,Pt.options.outgoingStore=Lt.outgoingStore):(Pt.options.incomingStore=null,Pt.options.outgoingStore=null),Pt.incomingStore=Pt.options.incomingStore||new re,Pt.outgoingStore=Pt.options.outgoingStore||new re,Pt.disconnecting=!1,Pt.disconnected=!1,Pt._deferredReconnect=null,Pt._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=ni:ni(),this},ti.prototype._reconnect=function(){pe("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),pe("client already connected. disconnecting first.")):(pe("_reconnect: calling _setupStream"),this._setupStream())},ti.prototype._setupReconnect=function(){const Lt=this;!Lt.disconnecting&&!Lt.reconnectTimer&&Lt.options.reconnectPeriod>0?(this.reconnecting||(pe("_setupReconnect :: emit `offline` state"),this.emit("offline"),pe("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),pe("_setupReconnect :: setting reconnectTimer for %d ms",Lt.options.reconnectPeriod),Lt.reconnectTimer=setInterval(function(){pe("reconnectTimer :: reconnect triggered!"),Lt._reconnect()},Lt.options.reconnectPeriod)):pe("_setupReconnect :: doing nothing...")},ti.prototype._clearReconnect=function(){pe("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},ti.prototype._cleanUp=function(Lt,Pt){const ni=arguments[2];if(Pt&&(pe("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",Pt)),pe("_cleanUp :: forced? %s",Lt),Lt)this.options.reconnectPeriod===0&&this.options.clean&&qe(this.outgoing),pe("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const ri=ze({cmd:"disconnect"},ni);pe("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(ri,Oe.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(pe("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(pe("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),Pt&&!this.connected&&(pe("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",Pt),Pt())},ti.prototype._sendPacket=function(Lt,Pt,ni){pe("_sendPacket :: (%s) :: start",this.options.clientId),ni=ni||jt,Pt=Pt||jt;const ri=Ue(this,Lt);if(ri){Pt(ri);return}if(!this.connected){if(Lt.cmd==="auth"){this._shiftPingInterval(),Dt(this,Lt,Pt);return}pe("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(Lt,Pt,ni);return}switch(this._shiftPingInterval(),Lt.cmd){case"publish":break;case"pubrel":Et(this,Lt,Pt,ni);return;default:Dt(this,Lt,Pt);return}switch(Lt.qos){case 2:case 1:Et(this,Lt,Pt,ni);break;case 0:default:Dt(this,Lt,Pt);break}pe("_sendPacket :: (%s) :: end",this.options.clientId)},ti.prototype._storePacket=function(Lt,Pt,ni){pe("_storePacket :: packet: %o",Lt),pe("_storePacket :: cb? %s",!!Pt),ni=ni||jt;let ri=Lt;if(ri.cmd==="publish"){ri=Ne(Lt);const ui=xe(this,ri);if(ui)return Pt&&Pt(ui)}(ri.qos||0)===0&&this.queueQoSZero||ri.cmd!=="publish"?this.queue.push({packet:ri,cb:Pt}):ri.qos>0?(Pt=this.outgoing[ri.messageId]?this.outgoing[ri.messageId].cb:null,this.outgoingStore.put(ri,function(ui){if(ui)return Pt&&Pt(ui);ni()})):Pt&&Pt(new Error("No connection to broker"))},ti.prototype._setupPingTimer=function(){pe("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const Lt=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=de(function(){Lt._checkPing()},this.options.keepalive*1e3))},ti.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(this.options.keepalive*1e3)},ti.prototype._checkPing=function(){pe("_checkPing :: checking ping..."),this.pingResp?(pe("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(pe("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},ti.prototype._handlePingresp=function(){this.pingResp=!0},ti.prototype._handleConnack=function(Lt){pe("_handleConnack");const Pt=this.options,ri=Pt.protocolVersion===5?Lt.reasonCode:Lt.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,Lt.properties){if(Lt.properties.topicAliasMaximum){if(Lt.properties.topicAliasMaximum>65535){this.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}Lt.properties.topicAliasMaximum>0&&(this.topicAliasSend=new ie(Lt.properties.topicAliasMaximum))}Lt.properties.serverKeepAlive&&Pt.keepalive&&(Pt.keepalive=Lt.properties.serverKeepAlive,this._shiftPingInterval()),Lt.properties.maximumPacketSize&&(Pt.properties||(Pt.properties={}),Pt.properties.maximumPacketSize=Lt.properties.maximumPacketSize)}if(ri===0)this.reconnecting=!1,this._onConnect(Lt);else if(ri>0){const ui=new Error("Connection refused: "+$e[ri]);ui.code=ri,this.emit("error",ui)}},ti.prototype._handleAuth=function(Lt){const ni=this.options.protocolVersion,ri=ni===5?Lt.reasonCode:Lt.returnCode;if(ni!==5){const Ci=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+ni);Ci.code=ri,this.emit("error",Ci);return}const ui=this;this.handleAuth(Lt,function(Ci,gi){if(Ci){ui.emit("error",Ci);return}if(ri===24)ui.reconnecting=!1,ui._sendPacket(gi);else{const di=new Error("Connection refused: "+$e[ri]);Ci.code=ri,ui.emit("error",di)}})},ti.prototype.handleAuth=function(Lt,Pt){Pt()},ti.prototype._handlePublish=function(Lt,Pt){pe("_handlePublish: packet %o",Lt),Pt=typeof Pt<"u"?Pt:jt;let ni=Lt.topic.toString();const ri=Lt.payload,ui=Lt.qos,Ci=Lt.messageId,gi=this,di=this.options,hi=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let ci;if(Lt.properties&&(ci=Lt.properties.topicAlias),typeof ci<"u")if(ni.length===0)if(ci>0&&ci<=65535){const Ai=this.topicAliasRecv.getTopicByAlias(ci);if(Ai)ni=Ai,pe("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",ni,ci);else{pe("_handlePublish :: unregistered topic alias. alias: %d",ci),this.emit("error",new Error("Received unregistered Topic Alias"));return}}else{pe("_handlePublish :: topic alias out of range. alias: %d",ci),this.emit("error",new Error("Received Topic Alias is out of range"));return}else if(this.topicAliasRecv.put(ni,ci))pe("_handlePublish :: registered topic: %s - alias: %d",ni,ci);else{pe("_handlePublish :: topic alias out of range. alias: %d",ci),this.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(pe("_handlePublish: qos %d",ui),ui){case 2:{di.customHandleAcks(ni,ri,Lt,function(ci,Ai){if(ci instanceof Error||(Ai=ci,ci=null),ci)return gi.emit("error",ci);if(hi.indexOf(Ai)===-1)return gi.emit("error",new Error("Wrong reason code for pubrec"));Ai?gi._sendPacket({cmd:"pubrec",messageId:Ci,reasonCode:Ai},Pt):gi.incomingStore.put(Lt,function(){gi._sendPacket({cmd:"pubrec",messageId:Ci},Pt)})});break}case 1:{di.customHandleAcks(ni,ri,Lt,function(ci,Ai){if(ci instanceof Error||(Ai=ci,ci=null),ci)return gi.emit("error",ci);if(hi.indexOf(Ai)===-1)return gi.emit("error",new Error("Wrong reason code for puback"));Ai||gi.emit("message",ni,ri,Lt),gi.handleMessage(Lt,function(yi){if(yi)return Pt&&Pt(yi);gi._sendPacket({cmd:"puback",messageId:Ci,reasonCode:Ai},Pt)})});break}case 0:this.emit("message",ni,ri,Lt),this.handleMessage(Lt,Pt);break;default:pe("_handlePublish: unknown QoS. Doing nothing.");break}},ti.prototype.handleMessage=function(Lt,Pt){Pt()},ti.prototype._handleAck=function(Lt){const Pt=Lt.messageId,ni=Lt.cmd;let ri=null;const ui=this.outgoing[Pt]?this.outgoing[Pt].cb:null,Ci=this;let gi;if(!ui){pe("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(pe("_handleAck :: packet type",ni),ni){case"pubcomp":case"puback":{const di=Lt.reasonCode;di&&di>0&&di!==16&&(gi=new Error("Publish error: "+$e[di]),gi.code=di,ui(gi,Lt)),delete this.outgoing[Pt],this.outgoingStore.del(Lt,ui),this.messageIdProvider.deallocate(Pt),this._invokeStoreProcessingQueue();break}case"pubrec":{ri={cmd:"pubrel",qos:2,messageId:Pt};const di=Lt.reasonCode;di&&di>0&&di!==16?(gi=new Error("Publish error: "+$e[di]),gi.code=di,ui(gi,Lt)):this._sendPacket(ri);break}case"suback":{delete this.outgoing[Pt],this.messageIdProvider.deallocate(Pt);for(let di=0;di<Lt.granted.length;di++)if(Lt.granted[di]&128){const hi=this.messageIdToTopic[Pt];hi&&hi.forEach(function(ci){delete Ci._resubscribeTopics[ci]})}this._invokeStoreProcessingQueue(),ui(null,Lt);break}case"unsuback":{delete this.outgoing[Pt],this.messageIdProvider.deallocate(Pt),this._invokeStoreProcessingQueue(),ui(null);break}default:Ci.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")},ti.prototype._handlePubrel=function(Lt,Pt){pe("handling pubrel packet"),Pt=typeof Pt<"u"?Pt:jt;const ni=Lt.messageId,ri=this,ui={cmd:"pubcomp",messageId:ni};ri.incomingStore.get(Lt,function(Ci,gi){Ci?ri._sendPacket(ui,Pt):(ri.emit("message",gi.topic,gi.payload,gi),ri.handleMessage(gi,function(di){if(di)return Pt(di);ri.incomingStore.del(gi,jt),ri._sendPacket(ui,Pt)}))})},ti.prototype._handleDisconnect=function(Lt){this.emit("disconnect",Lt)},ti.prototype._nextId=function(){return this.messageIdProvider.allocate()},ti.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},ti.prototype._resubscribe=function(){pe("_resubscribe");const Lt=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion===5&&!this.connackPacket.sessionPresent)&&Lt.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){pe("_resubscribe: protocolVersion 5");for(let Pt=0;Pt<Lt.length;Pt++){const ni={};ni[Lt[Pt]]=this._resubscribeTopics[Lt[Pt]],ni.resubscribe=!0,this.subscribe(ni,{properties:ni[Lt[Pt]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},ti.prototype._onConnect=function(Lt){if(this.disconnected){this.emit("connect",Lt);return}const Pt=this;this.connackPacket=Lt,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0;function ni(){let ri=Pt.outgoingStore.createStream();function ui(){Pt._storeProcessing=!1,Pt._packetIdsDuringStoreProcessing={}}Pt.once("close",Ci),ri.on("error",function(di){ui(),Pt._flushStoreProcessingQueue(),Pt.removeListener("close",Ci),Pt.emit("error",di)});function Ci(){ri.destroy(),ri=null,Pt._flushStoreProcessingQueue(),ui()}function gi(){if(!ri)return;Pt._storeProcessing=!0;const di=ri.read(1);let hi;if(!di){ri.once("readable",gi);return}if(Pt._packetIdsDuringStoreProcessing[di.messageId]){gi();return}!Pt.disconnecting&&!Pt.reconnectTimer?(hi=Pt.outgoing[di.messageId]?Pt.outgoing[di.messageId].cb:null,Pt.outgoing[di.messageId]={volatile:!1,cb:function(ci,Ai){hi&&hi(ci,Ai),gi()}},Pt._packetIdsDuringStoreProcessing[di.messageId]=!0,Pt.messageIdProvider.register(di.messageId)?Pt._sendPacket(di):pe("messageId: %d has already used.",di.messageId)):ri.destroy&&ri.destroy()}ri.on("end",function(){let di=!0;for(const hi in Pt._packetIdsDuringStoreProcessing)if(!Pt._packetIdsDuringStoreProcessing[hi]){di=!1;break}di?(ui(),Pt.removeListener("close",Ci),Pt._invokeAllStoreProcessingQueue(),Pt.emit("connect",Lt)):ni()}),gi()}ni()},ti.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const Lt=this._storeProcessingQueue[0];if(Lt&&Lt.invoke())return this._storeProcessingQueue.shift(),!0}return!1},ti.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},ti.prototype._flushStoreProcessingQueue=function(){for(const Lt of this._storeProcessingQueue)Lt.cbStorePut&&Lt.cbStorePut(new Error("Connection closed")),Lt.callback&&Lt.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},g.exports=ti}).call(this)}).call(this,r("_process"),typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{"./default-message-id-provider":7,"./store":8,"./topic-alias-recv":9,"./topic-alias-send":10,"./validations":11,_process:50,debug:18,events:22,inherits:24,"mqtt-packet":40,"readable-stream":69,reinterval:70,"rfdc/default":71,xtend:81}],2:[function(r,g,V){const{Buffer:k}=r("buffer"),$=r("readable-stream").Transform,oe=r("duplexify");let re,Ce,ie,ae=!1;function le(){const he=new $;return he._write=function(ze,pe,Ve){re.sendSocketMessage({data:ze.buffer,success:function(){Ve()},fail:function(){Ve(new Error)}})},he._flush=function(pe){re.closeSocket({success:function(){pe()}})},he}function Ie(he){he.hostname||(he.hostname="localhost"),he.path||(he.path="/"),he.wsOptions||(he.wsOptions={})}function ue(he,ze){const pe=he.protocol==="alis"?"wss":"ws";let Ve=pe+"://"+he.hostname+he.path;return he.port&&he.port!==80&&he.port!==443&&(Ve=pe+"://"+he.hostname+":"+he.port+he.path),typeof he.transformWsUrl=="function"&&(Ve=he.transformWsUrl(Ve,he,ze)),Ve}function de(){ae||(ae=!0,re.onSocketOpen(function(){ie.setReadable(Ce),ie.setWritable(Ce),ie.emit("connect")}),re.onSocketMessage(function(he){if(typeof he.data=="string"){const ze=k.from(he.data,"base64");Ce.push(ze)}else{const ze=new FileReader;ze.addEventListener("load",function(){let pe=ze.result;pe instanceof ArrayBuffer?pe=k.from(pe):pe=k.from(pe,"utf8"),Ce.push(pe)}),ze.readAsArrayBuffer(he.data)}}),re.onSocketClose(function(){ie.end(),ie.destroy()}),re.onSocketError(function(he){ie.destroy(he)}))}function Ne(he,ze){if(ze.hostname=ze.hostname||ze.host,!ze.hostname)throw new Error("Could not determine host. Specify host manually.");const pe=ze.protocolId==="MQIsdp"&&ze.protocolVersion===3?"mqttv3.1":"mqtt";Ie(ze);const Ve=ue(ze,he);return re=ze.my,re.connectSocket({url:Ve,protocols:pe}),Ce=le(),ie=oe.obj(),de(),ie}g.exports=Ne},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(r,g,V){const k=r("net"),$=r("debug")("mqttjs:tcp");function oe(re,Ce){Ce.port=Ce.port||1883,Ce.hostname=Ce.hostname||Ce.host||"localhost";const ie=Ce.port,ae=Ce.hostname;return $("port %d and host %s",ie,ae),k.createConnection(ie,ae)}g.exports=oe},{debug:18,net:16}],4:[function(r,g,V){const k=r("tls"),$=r("net"),oe=r("debug")("mqttjs:tls");function re(Ce,ie){ie.port=ie.port||8883,ie.host=ie.hostname||ie.host||"localhost",$.isIP(ie.host)===0&&(ie.servername=ie.host),ie.rejectUnauthorized=ie.rejectUnauthorized!==!1,delete ie.path,oe("port %d host %s rejectUnauthorized %b",ie.port,ie.host,ie.rejectUnauthorized);const ae=k.connect(ie);ae.on("secureConnect",function(){ie.rejectUnauthorized&&!ae.authorized?ae.emit("error",new Error("TLS not authorized")):ae.removeListener("error",le)});function le(Ie){ie.rejectUnauthorized&&Ce.emit("error",Ie),ae.end()}return ae.on("error",le),ae}g.exports=re},{debug:18,net:16,tls:16}],5:[function(r,g,V){(function(k){(function(){const{Buffer:$}=r("buffer"),oe=r("ws"),re=r("debug")("mqttjs:ws"),Ce=r("duplexify"),ie=r("readable-stream").Transform,ae=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],le=typeof k<"u"&&k.title==="browser"||typeof __webpack_require__=="function";function Ie(Ve,Oe){let _e=Ve.protocol+"://"+Ve.hostname+":"+Ve.port+Ve.path;return typeof Ve.transformWsUrl=="function"&&(_e=Ve.transformWsUrl(_e,Ve,Oe)),_e}function ue(Ve){const Oe=Ve;return Ve.hostname||(Oe.hostname="localhost"),Ve.port||(Ve.protocol==="wss"?Oe.port=443:Oe.port=80),Ve.path||(Oe.path="/"),Ve.wsOptions||(Oe.wsOptions={}),!le&&Ve.protocol==="wss"&&ae.forEach(function(_e){Object.prototype.hasOwnProperty.call(Ve,_e)&&!Object.prototype.hasOwnProperty.call(Ve.wsOptions,_e)&&(Oe.wsOptions[_e]=Ve[_e])}),Oe}function de(Ve){const Oe=ue(Ve);if(Oe.hostname||(Oe.hostname=Oe.host),!Oe.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");const _e=new URL(document.URL);Oe.hostname=_e.hostname,Oe.port||(Oe.port=_e.port)}return Oe.objectMode===void 0&&(Oe.objectMode=!(Oe.binary===!0||Oe.binary===void 0)),Oe}function Ne(Ve,Oe,_e){re("createWebSocket"),re("protocol: "+_e.protocolId+" "+_e.protocolVersion);const At=_e.protocolId==="MQIsdp"&&_e.protocolVersion===3?"mqttv3.1":"mqtt";return re("creating new Websocket for url: "+Oe+" and protocol: "+At),new oe(Oe,[At],_e.wsOptions)}function he(Ve,Oe){const _e=Oe.protocolId==="MQIsdp"&&Oe.protocolVersion===3?"mqttv3.1":"mqtt",At=Ie(Oe,Ve),$e=new WebSocket(At,[_e]);return $e.binaryType="arraybuffer",$e}function ze(Ve,Oe){re("streamBuilder");const _e=ue(Oe),At=Ie(_e,Ve),$e=Ne(Ve,At,_e),Fe=oe.createWebSocketStream($e,_e.wsOptions);return Fe.url=At,$e.on("close",()=>{Fe.destroy()}),Fe}function pe(Ve,Oe){re("browserStreamBuilder");let _e;const $e=de(Oe).browserBufferSize||1024*512,Fe=Oe.browserBufferTimeout||1e3,Ue=!Oe.objectMode,xe=he(Ve,Oe),Dt=kt(Oe,ni,ri);Oe.objectMode||(Dt._writev=Pt),Dt.on("close",()=>{xe.close()});const qe=typeof xe.addEventListener<"u";xe.readyState===xe.OPEN?_e=Dt:(_e=_e=Ce(void 0,void 0,Oe),Oe.objectMode||(_e._writev=Pt),qe?xe.addEventListener("open",Et):xe.onopen=Et),_e.socket=xe,qe?(xe.addEventListener("close",jt),xe.addEventListener("error",ti),xe.addEventListener("message",Lt)):(xe.onclose=jt,xe.onerror=ti,xe.onmessage=Lt);function kt(ui,Ci,gi){const di=new ie({objectModeMode:ui.objectMode});return di._write=Ci,di._flush=gi,di}function Et(){_e.setReadable(Dt),_e.setWritable(Dt),_e.emit("connect")}function jt(){_e.end(),_e.destroy()}function ti(ui){_e.destroy(ui)}function Lt(ui){let Ci=ui.data;Ci instanceof ArrayBuffer?Ci=$.from(Ci):Ci=$.from(Ci,"utf8"),Dt.push(Ci)}function Pt(ui,Ci){const gi=new Array(ui.length);for(let di=0;di<ui.length;di++)typeof ui[di].chunk=="string"?gi[di]=$.from(ui[di],"utf8"):gi[di]=ui[di].chunk;this._write($.concat(gi),"binary",Ci)}function ni(ui,Ci,gi){xe.bufferedAmount>$e&&setTimeout(ni,Fe,ui,Ci,gi),Ue&&typeof ui=="string"&&(ui=$.from(ui,"utf8"));try{xe.send(ui)}catch(di){return gi(di)}gi()}function ri(ui){xe.close(),ui()}return _e}le?g.exports=pe:g.exports=ze}).call(this)}).call(this,r("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(r,g,V){const{Buffer:k}=r("buffer"),$=r("readable-stream").Transform,oe=r("duplexify");let re,Ce,ie;function ae(){const Ne=new $;return Ne._write=function(he,ze,pe){re.send({data:he.buffer,success:function(){pe()},fail:function(Ve){pe(new Error(Ve))}})},Ne._flush=function(ze){re.close({success:function(){ze()}})},Ne}function le(Ne){Ne.hostname||(Ne.hostname="localhost"),Ne.path||(Ne.path="/"),Ne.wsOptions||(Ne.wsOptions={})}function Ie(Ne,he){const ze=Ne.protocol==="wxs"?"wss":"ws";let pe=ze+"://"+Ne.hostname+Ne.path;return Ne.port&&Ne.port!==80&&Ne.port!==443&&(pe=ze+"://"+Ne.hostname+":"+Ne.port+Ne.path),typeof Ne.transformWsUrl=="function"&&(pe=Ne.transformWsUrl(pe,Ne,he)),pe}function ue(){re.onOpen(function(){ie.setReadable(Ce),ie.setWritable(Ce),ie.emit("connect")}),re.onMessage(function(Ne){let he=Ne.data;he instanceof ArrayBuffer?he=k.from(he):he=k.from(he,"utf8"),Ce.push(he)}),re.onClose(function(){ie.end(),ie.destroy()}),re.onError(function(Ne){ie.destroy(new Error(Ne.errMsg))})}function de(Ne,he){if(he.hostname=he.hostname||he.host,!he.hostname)throw new Error("Could not determine host. Specify host manually.");const ze=he.protocolId==="MQIsdp"&&he.protocolVersion===3?"mqttv3.1":"mqtt";le(he);const pe=Ie(he,Ne);re=wx.connectSocket({url:pe,protocols:[ze]}),Ce=ae(),ie=oe.obj(),ie._destroy=function(Oe,_e){re.close({success:function(){_e&&_e(Oe)}})};const Ve=ie.destroy;return ie.destroy=function(){ie.destroy=Ve;const Oe=this;setTimeout(function(){re.close({fail:function(){Oe._destroy(new Error)}})},0)}.bind(ie),ue(),ie}g.exports=de},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(r,g,V){function k(){if(!(this instanceof k))return new k;this.nextId=Math.max(1,Math.floor(Math.random()*65535))}k.prototype.allocate=function(){const $=this.nextId++;return this.nextId===65536&&(this.nextId=1),$},k.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},k.prototype.register=function($){return!0},k.prototype.deallocate=function($){},k.prototype.clear=function(){},g.exports=k},{}],8:[function(r,g,V){const k=r("xtend"),$=r("readable-stream").Readable,oe={objectMode:!0},re={clean:!0};function Ce(ie){if(!(this instanceof Ce))return new Ce(ie);this.options=ie||{},this.options=k(re,ie),this._inflights=new Map}Ce.prototype.put=function(ie,ae){return this._inflights.set(ie.messageId,ie),ae&&ae(),this},Ce.prototype.createStream=function(){const ie=new $(oe),ae=[];let le=!1,Ie=0;return this._inflights.forEach(function(ue,de){ae.push(ue)}),ie._read=function(){!le&&Ie<ae.length?this.push(ae[Ie++]):this.push(null)},ie.destroy=function(){if(le)return;const ue=this;le=!0,setTimeout(function(){ue.emit("close")},0)},ie},Ce.prototype.del=function(ie,ae){return ie=this._inflights.get(ie.messageId),ie?(this._inflights.delete(ie.messageId),ae(null,ie)):ae&&ae(new Error("missing packet")),this},Ce.prototype.get=function(ie,ae){return ie=this._inflights.get(ie.messageId),ie?ae(null,ie):ae&&ae(new Error("missing packet")),this},Ce.prototype.close=function(ie){this.options.clean&&(this._inflights=null),ie&&ie()},g.exports=Ce},{"readable-stream":69,xtend:81}],9:[function(r,g,V){function k($){if(!(this instanceof k))return new k($);this.aliasToTopic={},this.max=$}k.prototype.put=function($,oe){return oe===0||oe>this.max?!1:(this.aliasToTopic[oe]=$,this.length=Object.keys(this.aliasToTopic).length,!0)},k.prototype.getTopicByAlias=function($){return this.aliasToTopic[$]},k.prototype.clear=function(){this.aliasToTopic={}},g.exports=k},{}],10:[function(r,g,V){const k=r("lru-cache"),$=r("number-allocator").NumberAllocator;function oe(re){if(!(this instanceof oe))return new oe(re);re>0&&(this.aliasToTopic=new k({max:re}),this.topicToAlias={},this.numberAllocator=new $(1,re),this.max=re,this.length=0)}oe.prototype.put=function(re,Ce){if(Ce===0||Ce>this.max)return!1;const ie=this.aliasToTopic.get(Ce);return ie&&delete this.topicToAlias[ie],this.aliasToTopic.set(Ce,re),this.topicToAlias[re]=Ce,this.numberAllocator.use(Ce),this.length=this.aliasToTopic.length,!0},oe.prototype.getTopicByAlias=function(re){return this.aliasToTopic.get(re)},oe.prototype.getAliasByTopic=function(re){const Ce=this.topicToAlias[re];return typeof Ce<"u"&&this.aliasToTopic.get(Ce),Ce},oe.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},oe.prototype.getLruAlias=function(){const re=this.numberAllocator.firstVacant();return re||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},g.exports=oe},{"lru-cache":37,"number-allocator":46}],11:[function(r,g,V){function k(oe){const re=oe.split("/");for(let Ce=0;Ce<re.length;Ce++)if(re[Ce]!=="+"){if(re[Ce]==="#")return Ce===re.length-1;if(re[Ce].indexOf("+")!==-1||re[Ce].indexOf("#")!==-1)return!1}return!0}function $(oe){if(oe.length===0)return"empty_topic_list";for(let re=0;re<oe.length;re++)if(!k(oe[re]))return oe[re];return null}g.exports={validateTopics:$}},{}],12:[function(r,g,V){(function(k){(function(){const $=r("../client"),oe=r("../store"),re=r("url"),Ce=r("xtend"),ie=r("debug")("mqttjs"),ae={};typeof k<"u"&&k.title!=="browser"||typeof __webpack_require__!="function"?(ae.mqtt=r("./tcp"),ae.tcp=r("./tcp"),ae.ssl=r("./tls"),ae.tls=r("./tls"),ae.mqtts=r("./tls")):(ae.wx=r("./wx"),ae.wxs=r("./wx"),ae.ali=r("./ali"),ae.alis=r("./ali")),ae.ws=r("./ws"),ae.wss=r("./ws");function le(ue){let de;ue.auth&&(de=ue.auth.match(/^(.+):(.+)$/),de?(ue.username=de[1],ue.password=de[2]):ue.username=ue.auth)}function Ie(ue,de){if(ie("connecting to an MQTT broker..."),typeof ue=="object"&&!de&&(de=ue,ue=null),de=de||{},ue){const ze=re.parse(ue,!0);if(ze.port!=null&&(ze.port=Number(ze.port)),de=Ce(ze,de),de.protocol===null)throw new Error("Missing protocol");de.protocol=de.protocol.replace(/:$/,"")}if(le(de),de.query&&typeof de.query.clientId=="string"&&(de.clientId=de.query.clientId),de.cert&&de.key)if(de.protocol){if(["mqtts","wss","wxs","alis"].indexOf(de.protocol)===-1)switch(de.protocol){case"mqtt":de.protocol="mqtts";break;case"ws":de.protocol="wss";break;case"wx":de.protocol="wxs";break;case"ali":de.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+de.protocol+'"!')}}else throw new Error("Missing secure protocol key");if(!ae[de.protocol]){const ze=["mqtts","wss"].indexOf(de.protocol)!==-1;de.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(pe,Ve){return ze&&Ve%2===0?!1:typeof ae[pe]=="function"})[0]}if(de.clean===!1&&!de.clientId)throw new Error("Missing clientId for unclean clients");de.protocol&&(de.defaultProtocol=de.protocol);function Ne(ze){return de.servers&&((!ze._reconnectCount||ze._reconnectCount===de.servers.length)&&(ze._reconnectCount=0),de.host=de.servers[ze._reconnectCount].host,de.port=de.servers[ze._reconnectCount].port,de.protocol=de.servers[ze._reconnectCount].protocol?de.servers[ze._reconnectCount].protocol:de.defaultProtocol,de.hostname=de.host,ze._reconnectCount++),ie("calling streambuilder for",de.protocol),ae[de.protocol](ze,de)}const he=new $(Ne,de);return he.on("error",function(){}),he}g.exports=Ie,g.exports.connect=Ie,g.exports.MqttClient=$,g.exports.Store=oe}).call(this)}).call(this,r("_process"))},{"../client":1,"../store":8,"./ali":2,"./tcp":3,"./tls":4,"./ws":5,"./wx":6,_process:50,debug:18,url:76,xtend:81}],13:[function(r,g,V){V.byteLength=le,V.toByteArray=ue,V.fromByteArray=he;for(var k=[],$=[],oe=typeof Uint8Array<"u"?Uint8Array:Array,re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ce=0,ie=re.length;Ce<ie;++Ce)k[Ce]=re[Ce],$[re.charCodeAt(Ce)]=Ce;$["-".charCodeAt(0)]=62,$["_".charCodeAt(0)]=63;function ae(ze){var pe=ze.length;if(pe%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var Ve=ze.indexOf("=");Ve===-1&&(Ve=pe);var Oe=Ve===pe?0:4-Ve%4;return[Ve,Oe]}function le(ze){var pe=ae(ze),Ve=pe[0],Oe=pe[1];return(Ve+Oe)*3/4-Oe}function Ie(ze,pe,Ve){return(pe+Ve)*3/4-Ve}function ue(ze){var pe,Ve=ae(ze),Oe=Ve[0],_e=Ve[1],At=new oe(Ie(ze,Oe,_e)),$e=0,Fe=_e>0?Oe-4:Oe,Ue;for(Ue=0;Ue<Fe;Ue+=4)pe=$[ze.charCodeAt(Ue)]<<18|$[ze.charCodeAt(Ue+1)]<<12|$[ze.charCodeAt(Ue+2)]<<6|$[ze.charCodeAt(Ue+3)],At[$e++]=pe>>16&255,At[$e++]=pe>>8&255,At[$e++]=pe&255;return _e===2&&(pe=$[ze.charCodeAt(Ue)]<<2|$[ze.charCodeAt(Ue+1)]>>4,At[$e++]=pe&255),_e===1&&(pe=$[ze.charCodeAt(Ue)]<<10|$[ze.charCodeAt(Ue+1)]<<4|$[ze.charCodeAt(Ue+2)]>>2,At[$e++]=pe>>8&255,At[$e++]=pe&255),At}function de(ze){return k[ze>>18&63]+k[ze>>12&63]+k[ze>>6&63]+k[ze&63]}function Ne(ze,pe,Ve){for(var Oe,_e=[],At=pe;At<Ve;At+=3)Oe=(ze[At]<<16&16711680)+(ze[At+1]<<8&65280)+(ze[At+2]&255),_e.push(de(Oe));return _e.join("")}function he(ze){for(var pe,Ve=ze.length,Oe=Ve%3,_e=[],At=16383,$e=0,Fe=Ve-Oe;$e<Fe;$e+=At)_e.push(Ne(ze,$e,$e+At>Fe?Fe:$e+At));return Oe===1?(pe=ze[Ve-1],_e.push(k[pe>>2]+k[pe<<4&63]+"==")):Oe===2&&(pe=(ze[Ve-2]<<8)+ze[Ve-1],_e.push(k[pe>>10]+k[pe>>4&63]+k[pe<<2&63]+"=")),_e.join("")}},{}],14:[function(r,g,V){const{Buffer:k}=r("buffer"),$=Symbol.for("BufferList");function oe(re){if(!(this instanceof oe))return new oe(re);oe._init.call(this,re)}oe._init=function(Ce){Object.defineProperty(this,$,{value:!0}),this._bufs=[],this.length=0,Ce&&this.append(Ce)},oe.prototype._new=function(Ce){return new oe(Ce)},oe.prototype._offset=function(Ce){if(Ce===0)return[0,0];let ie=0;for(let ae=0;ae<this._bufs.length;ae++){const le=ie+this._bufs[ae].length;if(Ce<le||ae===this._bufs.length-1)return[ae,Ce-ie];ie=le}},oe.prototype._reverseOffset=function(re){const Ce=re[0];let ie=re[1];for(let ae=0;ae<Ce;ae++)ie+=this._bufs[ae].length;return ie},oe.prototype.get=function(Ce){if(Ce>this.length||Ce<0)return;const ie=this._offset(Ce);return this._bufs[ie[0]][ie[1]]},oe.prototype.slice=function(Ce,ie){return typeof Ce=="number"&&Ce<0&&(Ce+=this.length),typeof ie=="number"&&ie<0&&(ie+=this.length),this.copy(null,0,Ce,ie)},oe.prototype.copy=function(Ce,ie,ae,le){if((typeof ae!="number"||ae<0)&&(ae=0),(typeof le!="number"||le>this.length)&&(le=this.length),ae>=this.length||le<=0)return Ce||k.alloc(0);const Ie=!!Ce,ue=this._offset(ae),de=le-ae;let Ne=de,he=Ie&&ie||0,ze=ue[1];if(ae===0&&le===this.length){if(!Ie)return this._bufs.length===1?this._bufs[0]:k.concat(this._bufs,this.length);for(let pe=0;pe<this._bufs.length;pe++)this._bufs[pe].copy(Ce,he),he+=this._bufs[pe].length;return Ce}if(Ne<=this._bufs[ue[0]].length-ze)return Ie?this._bufs[ue[0]].copy(Ce,ie,ze,ze+Ne):this._bufs[ue[0]].slice(ze,ze+Ne);Ie||(Ce=k.allocUnsafe(de));for(let pe=ue[0];pe<this._bufs.length;pe++){const Ve=this._bufs[pe].length-ze;if(Ne>Ve)this._bufs[pe].copy(Ce,he,ze),he+=Ve;else{this._bufs[pe].copy(Ce,he,ze,ze+Ne),he+=Ve;break}Ne-=Ve,ze&&(ze=0)}return Ce.length>he?Ce.slice(0,he):Ce},oe.prototype.shallowSlice=function(Ce,ie){if(Ce=Ce||0,ie=typeof ie!="number"?this.length:ie,Ce<0&&(Ce+=this.length),ie<0&&(ie+=this.length),Ce===ie)return this._new();const ae=this._offset(Ce),le=this._offset(ie),Ie=this._bufs.slice(ae[0],le[0]+1);return le[1]===0?Ie.pop():Ie[Ie.length-1]=Ie[Ie.length-1].slice(0,le[1]),ae[1]!==0&&(Ie[0]=Ie[0].slice(ae[1])),this._new(Ie)},oe.prototype.toString=function(Ce,ie,ae){return this.slice(ie,ae).toString(Ce)},oe.prototype.consume=function(Ce){if(Ce=Math.trunc(Ce),Number.isNaN(Ce)||Ce<=0)return this;for(;this._bufs.length;)if(Ce>=this._bufs[0].length)Ce-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(Ce),this.length-=Ce;break}return this},oe.prototype.duplicate=function(){const Ce=this._new();for(let ie=0;ie<this._bufs.length;ie++)Ce.append(this._bufs[ie]);return Ce},oe.prototype.append=function(Ce){if(Ce==null)return this;if(Ce.buffer)this._appendBuffer(k.from(Ce.buffer,Ce.byteOffset,Ce.byteLength));else if(Array.isArray(Ce))for(let ie=0;ie<Ce.length;ie++)this.append(Ce[ie]);else if(this._isBufferList(Ce))for(let ie=0;ie<Ce._bufs.length;ie++)this.append(Ce._bufs[ie]);else typeof Ce=="number"&&(Ce=Ce.toString()),this._appendBuffer(k.from(Ce));return this},oe.prototype._appendBuffer=function(Ce){this._bufs.push(Ce),this.length+=Ce.length},oe.prototype.indexOf=function(re,Ce,ie){if(ie===void 0&&typeof Ce=="string"&&(ie=Ce,Ce=void 0),typeof re=="function"||Array.isArray(re))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof re=="number"?re=k.from([re]):typeof re=="string"?re=k.from(re,ie):this._isBufferList(re)?re=re.slice():Array.isArray(re.buffer)?re=k.from(re.buffer,re.byteOffset,re.byteLength):k.isBuffer(re)||(re=k.from(re)),Ce=Number(Ce||0),isNaN(Ce)&&(Ce=0),Ce<0&&(Ce=this.length+Ce),Ce<0&&(Ce=0),re.length===0)return Ce>this.length?this.length:Ce;const ae=this._offset(Ce);let le=ae[0],Ie=ae[1];for(;le<this._bufs.length;le++){const ue=this._bufs[le];for(;Ie<ue.length;)if(ue.length-Ie>=re.length){const Ne=ue.indexOf(re,Ie);if(Ne!==-1)return this._reverseOffset([le,Ne]);Ie=ue.length-re.length+1}else{const Ne=this._reverseOffset([le,Ie]);if(this._match(Ne,re))return Ne;Ie++}Ie=0}return-1},oe.prototype._match=function(re,Ce){if(this.length-re<Ce.length)return!1;for(let ie=0;ie<Ce.length;ie++)if(this.get(re+ie)!==Ce[ie])return!1;return!0},function(){const re={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const Ce in re)(function(ie){re[ie]===null?oe.prototype[ie]=function(ae,le){return this.slice(ae,ae+le)[ie](0,le)}:oe.prototype[ie]=function(ae=0){return this.slice(ae,ae+re[ie])[ie](0)}})(Ce)}(),oe.prototype._isBufferList=function(Ce){return Ce instanceof oe||oe.isBufferList(Ce)},oe.isBufferList=function(Ce){return Ce!=null&&Ce[$]},g.exports=oe},{buffer:17}],15:[function(r,g,V){const k=r("readable-stream").Duplex,$=r("inherits"),oe=r("./BufferList");function re(Ce){if(!(this instanceof re))return new re(Ce);if(typeof Ce=="function"){this._callback=Ce;const ie=function(le){this._callback&&(this._callback(le),this._callback=null)}.bind(this);this.on("pipe",function(le){le.on("error",ie)}),this.on("unpipe",function(le){le.removeListener("error",ie)}),Ce=null}oe._init.call(this,Ce),k.call(this)}$(re,k),Object.assign(re.prototype,oe.prototype),re.prototype._new=function(ie){return new re(ie)},re.prototype._write=function(ie,ae,le){this._appendBuffer(ie),typeof le=="function"&&le()},re.prototype._read=function(ie){if(!this.length)return this.push(null);ie=Math.min(ie,this.length),this.push(this.slice(0,ie)),this.consume(ie)},re.prototype.end=function(ie){k.prototype.end.call(this,ie),this._callback&&(this._callback(null,this.slice()),this._callback=null)},re.prototype._destroy=function(ie,ae){this._bufs.length=0,this.length=0,ae(ie)},re.prototype._isBufferList=function(ie){return ie instanceof re||ie instanceof oe||re.isBufferList(ie)},re.isBufferList=oe.isBufferList,g.exports=re,g.exports.BufferListStream=re,g.exports.BufferList=oe},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(r,g,V){},{}],17:[function(r,g,V){(function(k){(function(){var $=r("base64-js"),oe=r("ieee754");V.Buffer=ae,V.SlowBuffer=Oe,V.INSPECT_MAX_BYTES=50;var re=2147483647;V.kMaxLength=re,ae.TYPED_ARRAY_SUPPORT=Ce(),!ae.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Ce(){try{var oi=new Uint8Array(1);return oi.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},oi.foo()===42}catch{return!1}}Object.defineProperty(ae.prototype,"parent",{enumerable:!0,get:function(){if(ae.isBuffer(this))return this.buffer}}),Object.defineProperty(ae.prototype,"offset",{enumerable:!0,get:function(){if(ae.isBuffer(this))return this.byteOffset}});function ie(oi){if(oi>re)throw new RangeError('The value "'+oi+'" is invalid for option "size"');var ei=new Uint8Array(oi);return ei.__proto__=ae.prototype,ei}function ae(oi,ei,ii){if(typeof oi=="number"){if(typeof ei=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return de(oi)}return le(oi,ei,ii)}typeof Symbol<"u"&&Symbol.species!=null&&ae[Symbol.species]===ae&&Object.defineProperty(ae,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),ae.poolSize=8192;function le(oi,ei,ii){if(typeof oi=="string")return Ne(oi,ei);if(ArrayBuffer.isView(oi))return he(oi);if(oi==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof oi);if(ai(oi,ArrayBuffer)||oi&&ai(oi.buffer,ArrayBuffer))return ze(oi,ei,ii);if(typeof oi=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var si=oi.valueOf&&oi.valueOf();if(si!=null&&si!==oi)return ae.from(si,ei,ii);var zi=pe(oi);if(zi)return zi;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof oi[Symbol.toPrimitive]=="function")return ae.from(oi[Symbol.toPrimitive]("string"),ei,ii);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof oi)}ae.from=function(oi,ei,ii){return le(oi,ei,ii)},ae.prototype.__proto__=Uint8Array.prototype,ae.__proto__=Uint8Array;function Ie(oi){if(typeof oi!="number")throw new TypeError('"size" argument must be of type number');if(oi<0)throw new RangeError('The value "'+oi+'" is invalid for option "size"')}function ue(oi,ei,ii){return Ie(oi),oi<=0?ie(oi):ei!==void 0?typeof ii=="string"?ie(oi).fill(ei,ii):ie(oi).fill(ei):ie(oi)}ae.alloc=function(oi,ei,ii){return ue(oi,ei,ii)};function de(oi){return Ie(oi),ie(oi<0?0:Ve(oi)|0)}ae.allocUnsafe=function(oi){return de(oi)},ae.allocUnsafeSlow=function(oi){return de(oi)};function Ne(oi,ei){if((typeof ei!="string"||ei==="")&&(ei="utf8"),!ae.isEncoding(ei))throw new TypeError("Unknown encoding: "+ei);var ii=_e(oi,ei)|0,si=ie(ii),zi=si.write(oi,ei);return zi!==ii&&(si=si.slice(0,zi)),si}function he(oi){for(var ei=oi.length<0?0:Ve(oi.length)|0,ii=ie(ei),si=0;si<ei;si+=1)ii[si]=oi[si]&255;return ii}function ze(oi,ei,ii){if(ei<0||oi.byteLength<ei)throw new RangeError('"offset" is outside of buffer bounds');if(oi.byteLength<ei+(ii||0))throw new RangeError('"length" is outside of buffer bounds');var si;return ei===void 0&&ii===void 0?si=new Uint8Array(oi):ii===void 0?si=new Uint8Array(oi,ei):si=new Uint8Array(oi,ei,ii),si.__proto__=ae.prototype,si}function pe(oi){if(ae.isBuffer(oi)){var ei=Ve(oi.length)|0,ii=ie(ei);return ii.length===0||oi.copy(ii,0,0,ei),ii}if(oi.length!==void 0)return typeof oi.length!="number"||Ii(oi.length)?ie(0):he(oi);if(oi.type==="Buffer"&&Array.isArray(oi.data))return he(oi.data)}function Ve(oi){if(oi>=re)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+re.toString(16)+" bytes");return oi|0}function Oe(oi){return+oi!=oi&&(oi=0),ae.alloc(+oi)}ae.isBuffer=function(ei){return ei!=null&&ei._isBuffer===!0&&ei!==ae.prototype},ae.compare=function(ei,ii){if(ai(ei,Uint8Array)&&(ei=ae.from(ei,ei.offset,ei.byteLength)),ai(ii,Uint8Array)&&(ii=ae.from(ii,ii.offset,ii.byteLength)),!ae.isBuffer(ei)||!ae.isBuffer(ii))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(ei===ii)return 0;for(var si=ei.length,zi=ii.length,mi=0,Si=Math.min(si,zi);mi<Si;++mi)if(ei[mi]!==ii[mi]){si=ei[mi],zi=ii[mi];break}return si<zi?-1:zi<si?1:0},ae.isEncoding=function(ei){switch(String(ei).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},ae.concat=function(ei,ii){if(!Array.isArray(ei))throw new TypeError('"list" argument must be an Array of Buffers');if(ei.length===0)return ae.alloc(0);var si;if(ii===void 0)for(ii=0,si=0;si<ei.length;++si)ii+=ei[si].length;var zi=ae.allocUnsafe(ii),mi=0;for(si=0;si<ei.length;++si){var Si=ei[si];if(ai(Si,Uint8Array)&&(Si=ae.from(Si)),!ae.isBuffer(Si))throw new TypeError('"list" argument must be an Array of Buffers');Si.copy(zi,mi),mi+=Si.length}return zi};function _e(oi,ei){if(ae.isBuffer(oi))return oi.length;if(ArrayBuffer.isView(oi)||ai(oi,ArrayBuffer))return oi.byteLength;if(typeof oi!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof oi);var ii=oi.length,si=arguments.length>2&&arguments[2]===!0;if(!si&&ii===0)return 0;for(var zi=!1;;)switch(ei){case"ascii":case"latin1":case"binary":return ii;case"utf8":case"utf-8":return Mi(oi).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ii*2;case"hex":return ii>>>1;case"base64":return vi(oi).length;default:if(zi)return si?-1:Mi(oi).length;ei=(""+ei).toLowerCase(),zi=!0}}ae.byteLength=_e;function At(oi,ei,ii){var si=!1;if((ei===void 0||ei<0)&&(ei=0),ei>this.length||((ii===void 0||ii>this.length)&&(ii=this.length),ii<=0)||(ii>>>=0,ei>>>=0,ii<=ei))return"";for(oi||(oi="utf8");;)switch(oi){case"hex":return Ci(this,ei,ii);case"utf8":case"utf-8":return Lt(this,ei,ii);case"ascii":return ri(this,ei,ii);case"latin1":case"binary":return ui(this,ei,ii);case"base64":return ti(this,ei,ii);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gi(this,ei,ii);default:if(si)throw new TypeError("Unknown encoding: "+oi);oi=(oi+"").toLowerCase(),si=!0}}ae.prototype._isBuffer=!0;function $e(oi,ei,ii){var si=oi[ei];oi[ei]=oi[ii],oi[ii]=si}ae.prototype.swap16=function(){var ei=this.length;if(ei%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var ii=0;ii<ei;ii+=2)$e(this,ii,ii+1);return this},ae.prototype.swap32=function(){var ei=this.length;if(ei%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var ii=0;ii<ei;ii+=4)$e(this,ii,ii+3),$e(this,ii+1,ii+2);return this},ae.prototype.swap64=function(){var ei=this.length;if(ei%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var ii=0;ii<ei;ii+=8)$e(this,ii,ii+7),$e(this,ii+1,ii+6),$e(this,ii+2,ii+5),$e(this,ii+3,ii+4);return this},ae.prototype.toString=function(){var ei=this.length;return ei===0?"":arguments.length===0?Lt(this,0,ei):At.apply(this,arguments)},ae.prototype.toLocaleString=ae.prototype.toString,ae.prototype.equals=function(ei){if(!ae.isBuffer(ei))throw new TypeError("Argument must be a Buffer");return this===ei?!0:ae.compare(this,ei)===0},ae.prototype.inspect=function(){var ei="",ii=V.INSPECT_MAX_BYTES;return ei=this.toString("hex",0,ii).replace(/(.{2})/g,"$1 ").trim(),this.length>ii&&(ei+=" ... "),"<Buffer "+ei+">"},ae.prototype.compare=function(ei,ii,si,zi,mi){if(ai(ei,Uint8Array)&&(ei=ae.from(ei,ei.offset,ei.byteLength)),!ae.isBuffer(ei))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof ei);if(ii===void 0&&(ii=0),si===void 0&&(si=ei?ei.length:0),zi===void 0&&(zi=0),mi===void 0&&(mi=this.length),ii<0||si>ei.length||zi<0||mi>this.length)throw new RangeError("out of range index");if(zi>=mi&&ii>=si)return 0;if(zi>=mi)return-1;if(ii>=si)return 1;if(ii>>>=0,si>>>=0,zi>>>=0,mi>>>=0,this===ei)return 0;for(var Si=mi-zi,xi=si-ii,Gi=Math.min(Si,xi),Bi=this.slice(zi,mi),Oi=ei.slice(ii,si),Zi=0;Zi<Gi;++Zi)if(Bi[Zi]!==Oi[Zi]){Si=Bi[Zi],xi=Oi[Zi];break}return Si<xi?-1:xi<Si?1:0};function Fe(oi,ei,ii,si,zi){if(oi.length===0)return-1;if(typeof ii=="string"?(si=ii,ii=0):ii>2147483647?ii=2147483647:ii<-2147483648&&(ii=-2147483648),ii=+ii,Ii(ii)&&(ii=zi?0:oi.length-1),ii<0&&(ii=oi.length+ii),ii>=oi.length){if(zi)return-1;ii=oi.length-1}else if(ii<0)if(zi)ii=0;else return-1;if(typeof ei=="string"&&(ei=ae.from(ei,si)),ae.isBuffer(ei))return ei.length===0?-1:Ue(oi,ei,ii,si,zi);if(typeof ei=="number")return ei=ei&255,typeof Uint8Array.prototype.indexOf=="function"?zi?Uint8Array.prototype.indexOf.call(oi,ei,ii):Uint8Array.prototype.lastIndexOf.call(oi,ei,ii):Ue(oi,[ei],ii,si,zi);throw new TypeError("val must be string, number or Buffer")}function Ue(oi,ei,ii,si,zi){var mi=1,Si=oi.length,xi=ei.length;if(si!==void 0&&(si=String(si).toLowerCase(),si==="ucs2"||si==="ucs-2"||si==="utf16le"||si==="utf-16le")){if(oi.length<2||ei.length<2)return-1;mi=2,Si/=2,xi/=2,ii/=2}function Gi(Vi,ki){return mi===1?Vi[ki]:Vi.readUInt16BE(ki*mi)}var Bi;if(zi){var Oi=-1;for(Bi=ii;Bi<Si;Bi++)if(Gi(oi,Bi)===Gi(ei,Oi===-1?0:Bi-Oi)){if(Oi===-1&&(Oi=Bi),Bi-Oi+1===xi)return Oi*mi}else Oi!==-1&&(Bi-=Bi-Oi),Oi=-1}else for(ii+xi>Si&&(ii=Si-xi),Bi=ii;Bi>=0;Bi--){for(var Zi=!0,Wi=0;Wi<xi;Wi++)if(Gi(oi,Bi+Wi)!==Gi(ei,Wi)){Zi=!1;break}if(Zi)return Bi}return-1}ae.prototype.includes=function(ei,ii,si){return this.indexOf(ei,ii,si)!==-1},ae.prototype.indexOf=function(ei,ii,si){return Fe(this,ei,ii,si,!0)},ae.prototype.lastIndexOf=function(ei,ii,si){return Fe(this,ei,ii,si,!1)};function xe(oi,ei,ii,si){ii=Number(ii)||0;var zi=oi.length-ii;si?(si=Number(si),si>zi&&(si=zi)):si=zi;var mi=ei.length;si>mi/2&&(si=mi/2);for(var Si=0;Si<si;++Si){var xi=parseInt(ei.substr(Si*2,2),16);if(Ii(xi))return Si;oi[ii+Si]=xi}return Si}function Dt(oi,ei,ii,si){return bi(Mi(ei,oi.length-ii),oi,ii,si)}function qe(oi,ei,ii,si){return bi(Ni(ei),oi,ii,si)}function kt(oi,ei,ii,si){return qe(oi,ei,ii,si)}function Et(oi,ei,ii,si){return bi(vi(ei),oi,ii,si)}function jt(oi,ei,ii,si){return bi(pi(ei,oi.length-ii),oi,ii,si)}ae.prototype.write=function(ei,ii,si,zi){if(ii===void 0)zi="utf8",si=this.length,ii=0;else if(si===void 0&&typeof ii=="string")zi=ii,si=this.length,ii=0;else if(isFinite(ii))ii=ii>>>0,isFinite(si)?(si=si>>>0,zi===void 0&&(zi="utf8")):(zi=si,si=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var mi=this.length-ii;if((si===void 0||si>mi)&&(si=mi),ei.length>0&&(si<0||ii<0)||ii>this.length)throw new RangeError("Attempt to write outside buffer bounds");zi||(zi="utf8");for(var Si=!1;;)switch(zi){case"hex":return xe(this,ei,ii,si);case"utf8":case"utf-8":return Dt(this,ei,ii,si);case"ascii":return qe(this,ei,ii,si);case"latin1":case"binary":return kt(this,ei,ii,si);case"base64":return Et(this,ei,ii,si);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return jt(this,ei,ii,si);default:if(Si)throw new TypeError("Unknown encoding: "+zi);zi=(""+zi).toLowerCase(),Si=!0}},ae.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ti(oi,ei,ii){return ei===0&&ii===oi.length?$.fromByteArray(oi):$.fromByteArray(oi.slice(ei,ii))}function Lt(oi,ei,ii){ii=Math.min(oi.length,ii);for(var si=[],zi=ei;zi<ii;){var mi=oi[zi],Si=null,xi=mi>239?4:mi>223?3:mi>191?2:1;if(zi+xi<=ii){var Gi,Bi,Oi,Zi;switch(xi){case 1:mi<128&&(Si=mi);break;case 2:Gi=oi[zi+1],(Gi&192)===128&&(Zi=(mi&31)<<6|Gi&63,Zi>127&&(Si=Zi));break;case 3:Gi=oi[zi+1],Bi=oi[zi+2],(Gi&192)===128&&(Bi&192)===128&&(Zi=(mi&15)<<12|(Gi&63)<<6|Bi&63,Zi>2047&&(Zi<55296||Zi>57343)&&(Si=Zi));break;case 4:Gi=oi[zi+1],Bi=oi[zi+2],Oi=oi[zi+3],(Gi&192)===128&&(Bi&192)===128&&(Oi&192)===128&&(Zi=(mi&15)<<18|(Gi&63)<<12|(Bi&63)<<6|Oi&63,Zi>65535&&Zi<1114112&&(Si=Zi))}}Si===null?(Si=65533,xi=1):Si>65535&&(Si-=65536,si.push(Si>>>10&1023|55296),Si=56320|Si&1023),si.push(Si),zi+=xi}return ni(si)}var Pt=4096;function ni(oi){var ei=oi.length;if(ei<=Pt)return String.fromCharCode.apply(String,oi);for(var ii="",si=0;si<ei;)ii+=String.fromCharCode.apply(String,oi.slice(si,si+=Pt));return ii}function ri(oi,ei,ii){var si="";ii=Math.min(oi.length,ii);for(var zi=ei;zi<ii;++zi)si+=String.fromCharCode(oi[zi]&127);return si}function ui(oi,ei,ii){var si="";ii=Math.min(oi.length,ii);for(var zi=ei;zi<ii;++zi)si+=String.fromCharCode(oi[zi]);return si}function Ci(oi,ei,ii){var si=oi.length;(!ei||ei<0)&&(ei=0),(!ii||ii<0||ii>si)&&(ii=si);for(var zi="",mi=ei;mi<ii;++mi)zi+=fi(oi[mi]);return zi}function gi(oi,ei,ii){for(var si=oi.slice(ei,ii),zi="",mi=0;mi<si.length;mi+=2)zi+=String.fromCharCode(si[mi]+si[mi+1]*256);return zi}ae.prototype.slice=function(ei,ii){var si=this.length;ei=~~ei,ii=ii===void 0?si:~~ii,ei<0?(ei+=si,ei<0&&(ei=0)):ei>si&&(ei=si),ii<0?(ii+=si,ii<0&&(ii=0)):ii>si&&(ii=si),ii<ei&&(ii=ei);var zi=this.subarray(ei,ii);return zi.__proto__=ae.prototype,zi};function di(oi,ei,ii){if(oi%1!==0||oi<0)throw new RangeError("offset is not uint");if(oi+ei>ii)throw new RangeError("Trying to access beyond buffer length")}ae.prototype.readUIntLE=function(ei,ii,si){ei=ei>>>0,ii=ii>>>0,si||di(ei,ii,this.length);for(var zi=this[ei],mi=1,Si=0;++Si<ii&&(mi*=256);)zi+=this[ei+Si]*mi;return zi},ae.prototype.readUIntBE=function(ei,ii,si){ei=ei>>>0,ii=ii>>>0,si||di(ei,ii,this.length);for(var zi=this[ei+--ii],mi=1;ii>0&&(mi*=256);)zi+=this[ei+--ii]*mi;return zi},ae.prototype.readUInt8=function(ei,ii){return ei=ei>>>0,ii||di(ei,1,this.length),this[ei]},ae.prototype.readUInt16LE=function(ei,ii){return ei=ei>>>0,ii||di(ei,2,this.length),this[ei]|this[ei+1]<<8},ae.prototype.readUInt16BE=function(ei,ii){return ei=ei>>>0,ii||di(ei,2,this.length),this[ei]<<8|this[ei+1]},ae.prototype.readUInt32LE=function(ei,ii){return ei=ei>>>0,ii||di(ei,4,this.length),(this[ei]|this[ei+1]<<8|this[ei+2]<<16)+this[ei+3]*16777216},ae.prototype.readUInt32BE=function(ei,ii){return ei=ei>>>0,ii||di(ei,4,this.length),this[ei]*16777216+(this[ei+1]<<16|this[ei+2]<<8|this[ei+3])},ae.prototype.readIntLE=function(ei,ii,si){ei=ei>>>0,ii=ii>>>0,si||di(ei,ii,this.length);for(var zi=this[ei],mi=1,Si=0;++Si<ii&&(mi*=256);)zi+=this[ei+Si]*mi;return mi*=128,zi>=mi&&(zi-=Math.pow(2,8*ii)),zi},ae.prototype.readIntBE=function(ei,ii,si){ei=ei>>>0,ii=ii>>>0,si||di(ei,ii,this.length);for(var zi=ii,mi=1,Si=this[ei+--zi];zi>0&&(mi*=256);)Si+=this[ei+--zi]*mi;return mi*=128,Si>=mi&&(Si-=Math.pow(2,8*ii)),Si},ae.prototype.readInt8=function(ei,ii){return ei=ei>>>0,ii||di(ei,1,this.length),this[ei]&128?(255-this[ei]+1)*-1:this[ei]},ae.prototype.readInt16LE=function(ei,ii){ei=ei>>>0,ii||di(ei,2,this.length);var si=this[ei]|this[ei+1]<<8;return si&32768?si|4294901760:si},ae.prototype.readInt16BE=function(ei,ii){ei=ei>>>0,ii||di(ei,2,this.length);var si=this[ei+1]|this[ei]<<8;return si&32768?si|4294901760:si},ae.prototype.readInt32LE=function(ei,ii){return ei=ei>>>0,ii||di(ei,4,this.length),this[ei]|this[ei+1]<<8|this[ei+2]<<16|this[ei+3]<<24},ae.prototype.readInt32BE=function(ei,ii){return ei=ei>>>0,ii||di(ei,4,this.length),this[ei]<<24|this[ei+1]<<16|this[ei+2]<<8|this[ei+3]},ae.prototype.readFloatLE=function(ei,ii){return ei=ei>>>0,ii||di(ei,4,this.length),oe.read(this,ei,!0,23,4)},ae.prototype.readFloatBE=function(ei,ii){return ei=ei>>>0,ii||di(ei,4,this.length),oe.read(this,ei,!1,23,4)},ae.prototype.readDoubleLE=function(ei,ii){return ei=ei>>>0,ii||di(ei,8,this.length),oe.read(this,ei,!0,52,8)},ae.prototype.readDoubleBE=function(ei,ii){return ei=ei>>>0,ii||di(ei,8,this.length),oe.read(this,ei,!1,52,8)};function hi(oi,ei,ii,si,zi,mi){if(!ae.isBuffer(oi))throw new TypeError('"buffer" argument must be a Buffer instance');if(ei>zi||ei<mi)throw new RangeError('"value" argument is out of bounds');if(ii+si>oi.length)throw new RangeError("Index out of range")}ae.prototype.writeUIntLE=function(ei,ii,si,zi){if(ei=+ei,ii=ii>>>0,si=si>>>0,!zi){var mi=Math.pow(2,8*si)-1;hi(this,ei,ii,si,mi,0)}var Si=1,xi=0;for(this[ii]=ei&255;++xi<si&&(Si*=256);)this[ii+xi]=ei/Si&255;return ii+si},ae.prototype.writeUIntBE=function(ei,ii,si,zi){if(ei=+ei,ii=ii>>>0,si=si>>>0,!zi){var mi=Math.pow(2,8*si)-1;hi(this,ei,ii,si,mi,0)}var Si=si-1,xi=1;for(this[ii+Si]=ei&255;--Si>=0&&(xi*=256);)this[ii+Si]=ei/xi&255;return ii+si},ae.prototype.writeUInt8=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,1,255,0),this[ii]=ei&255,ii+1},ae.prototype.writeUInt16LE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,2,65535,0),this[ii]=ei&255,this[ii+1]=ei>>>8,ii+2},ae.prototype.writeUInt16BE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,2,65535,0),this[ii]=ei>>>8,this[ii+1]=ei&255,ii+2},ae.prototype.writeUInt32LE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,4,4294967295,0),this[ii+3]=ei>>>24,this[ii+2]=ei>>>16,this[ii+1]=ei>>>8,this[ii]=ei&255,ii+4},ae.prototype.writeUInt32BE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,4,4294967295,0),this[ii]=ei>>>24,this[ii+1]=ei>>>16,this[ii+2]=ei>>>8,this[ii+3]=ei&255,ii+4},ae.prototype.writeIntLE=function(ei,ii,si,zi){if(ei=+ei,ii=ii>>>0,!zi){var mi=Math.pow(2,8*si-1);hi(this,ei,ii,si,mi-1,-mi)}var Si=0,xi=1,Gi=0;for(this[ii]=ei&255;++Si<si&&(xi*=256);)ei<0&&Gi===0&&this[ii+Si-1]!==0&&(Gi=1),this[ii+Si]=(ei/xi>>0)-Gi&255;return ii+si},ae.prototype.writeIntBE=function(ei,ii,si,zi){if(ei=+ei,ii=ii>>>0,!zi){var mi=Math.pow(2,8*si-1);hi(this,ei,ii,si,mi-1,-mi)}var Si=si-1,xi=1,Gi=0;for(this[ii+Si]=ei&255;--Si>=0&&(xi*=256);)ei<0&&Gi===0&&this[ii+Si+1]!==0&&(Gi=1),this[ii+Si]=(ei/xi>>0)-Gi&255;return ii+si},ae.prototype.writeInt8=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,1,127,-128),ei<0&&(ei=255+ei+1),this[ii]=ei&255,ii+1},ae.prototype.writeInt16LE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,2,32767,-32768),this[ii]=ei&255,this[ii+1]=ei>>>8,ii+2},ae.prototype.writeInt16BE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,2,32767,-32768),this[ii]=ei>>>8,this[ii+1]=ei&255,ii+2},ae.prototype.writeInt32LE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,4,2147483647,-2147483648),this[ii]=ei&255,this[ii+1]=ei>>>8,this[ii+2]=ei>>>16,this[ii+3]=ei>>>24,ii+4},ae.prototype.writeInt32BE=function(ei,ii,si){return ei=+ei,ii=ii>>>0,si||hi(this,ei,ii,4,2147483647,-2147483648),ei<0&&(ei=4294967295+ei+1),this[ii]=ei>>>24,this[ii+1]=ei>>>16,this[ii+2]=ei>>>8,this[ii+3]=ei&255,ii+4};function ci(oi,ei,ii,si,zi,mi){if(ii+si>oi.length)throw new RangeError("Index out of range");if(ii<0)throw new RangeError("Index out of range")}function Ai(oi,ei,ii,si,zi){return ei=+ei,ii=ii>>>0,zi||ci(oi,ei,ii,4),oe.write(oi,ei,ii,si,23,4),ii+4}ae.prototype.writeFloatLE=function(ei,ii,si){return Ai(this,ei,ii,!0,si)},ae.prototype.writeFloatBE=function(ei,ii,si){return Ai(this,ei,ii,!1,si)};function yi(oi,ei,ii,si,zi){return ei=+ei,ii=ii>>>0,zi||ci(oi,ei,ii,8),oe.write(oi,ei,ii,si,52,8),ii+8}ae.prototype.writeDoubleLE=function(ei,ii,si){return yi(this,ei,ii,!0,si)},ae.prototype.writeDoubleBE=function(ei,ii,si){return yi(this,ei,ii,!1,si)},ae.prototype.copy=function(ei,ii,si,zi){if(!ae.isBuffer(ei))throw new TypeError("argument should be a Buffer");if(si||(si=0),!zi&&zi!==0&&(zi=this.length),ii>=ei.length&&(ii=ei.length),ii||(ii=0),zi>0&&zi<si&&(zi=si),zi===si||ei.length===0||this.length===0)return 0;if(ii<0)throw new RangeError("targetStart out of bounds");if(si<0||si>=this.length)throw new RangeError("Index out of range");if(zi<0)throw new RangeError("sourceEnd out of bounds");zi>this.length&&(zi=this.length),ei.length-ii<zi-si&&(zi=ei.length-ii+si);var mi=zi-si;if(this===ei&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(ii,si,zi);else if(this===ei&&si<ii&&ii<zi)for(var Si=mi-1;Si>=0;--Si)ei[Si+ii]=this[Si+si];else Uint8Array.prototype.set.call(ei,this.subarray(si,zi),ii);return mi},ae.prototype.fill=function(ei,ii,si,zi){if(typeof ei=="string"){if(typeof ii=="string"?(zi=ii,ii=0,si=this.length):typeof si=="string"&&(zi=si,si=this.length),zi!==void 0&&typeof zi!="string")throw new TypeError("encoding must be a string");if(typeof zi=="string"&&!ae.isEncoding(zi))throw new TypeError("Unknown encoding: "+zi);if(ei.length===1){var mi=ei.charCodeAt(0);(zi==="utf8"&&mi<128||zi==="latin1")&&(ei=mi)}}else typeof ei=="number"&&(ei=ei&255);if(ii<0||this.length<ii||this.length<si)throw new RangeError("Out of range index");if(si<=ii)return this;ii=ii>>>0,si=si===void 0?this.length:si>>>0,ei||(ei=0);var Si;if(typeof ei=="number")for(Si=ii;Si<si;++Si)this[Si]=ei;else{var xi=ae.isBuffer(ei)?ei:ae.from(ei,zi),Gi=xi.length;if(Gi===0)throw new TypeError('The value "'+ei+'" is invalid for argument "value"');for(Si=0;Si<si-ii;++Si)this[Si+ii]=xi[Si%Gi]}return this};var wi=/[^+/0-9A-Za-z-_]/g;function li(oi){if(oi=oi.split("=")[0],oi=oi.trim().replace(wi,""),oi.length<2)return"";for(;oi.length%4!==0;)oi=oi+"=";return oi}function fi(oi){return oi<16?"0"+oi.toString(16):oi.toString(16)}function Mi(oi,ei){ei=ei||1/0;for(var ii,si=oi.length,zi=null,mi=[],Si=0;Si<si;++Si){if(ii=oi.charCodeAt(Si),ii>55295&&ii<57344){if(!zi){if(ii>56319){(ei-=3)>-1&&mi.push(239,191,189);continue}else if(Si+1===si){(ei-=3)>-1&&mi.push(239,191,189);continue}zi=ii;continue}if(ii<56320){(ei-=3)>-1&&mi.push(239,191,189),zi=ii;continue}ii=(zi-55296<<10|ii-56320)+65536}else zi&&(ei-=3)>-1&&mi.push(239,191,189);if(zi=null,ii<128){if((ei-=1)<0)break;mi.push(ii)}else if(ii<2048){if((ei-=2)<0)break;mi.push(ii>>6|192,ii&63|128)}else if(ii<65536){if((ei-=3)<0)break;mi.push(ii>>12|224,ii>>6&63|128,ii&63|128)}else if(ii<1114112){if((ei-=4)<0)break;mi.push(ii>>18|240,ii>>12&63|128,ii>>6&63|128,ii&63|128)}else throw new Error("Invalid code point")}return mi}function Ni(oi){for(var ei=[],ii=0;ii<oi.length;++ii)ei.push(oi.charCodeAt(ii)&255);return ei}function pi(oi,ei){for(var ii,si,zi,mi=[],Si=0;Si<oi.length&&!((ei-=2)<0);++Si)ii=oi.charCodeAt(Si),si=ii>>8,zi=ii%256,mi.push(zi),mi.push(si);return mi}function vi(oi){return $.toByteArray(li(oi))}function bi(oi,ei,ii,si){for(var zi=0;zi<si&&!(zi+ii>=ei.length||zi>=oi.length);++zi)ei[zi+ii]=oi[zi];return zi}function ai(oi,ei){return oi instanceof ei||oi!=null&&oi.constructor!=null&&oi.constructor.name!=null&&oi.constructor.name===ei.name}function Ii(oi){return oi!==oi}}).call(this)}).call(this,r("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(r,g,V){(function(k){(function(){V.formatArgs=oe,V.save=re,V.load=Ce,V.useColors=$,V.storage=ie(),V.destroy=(()=>{let le=!1;return()=>{le||(le=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),V.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function $(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function oe(le){if(le[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+le[0]+(this.useColors?"%c ":" ")+"+"+g.exports.humanize(this.diff),!this.useColors)return;const Ie="color: "+this.color;le.splice(1,0,Ie,"color: inherit");let ue=0,de=0;le[0].replace(/%[a-zA-Z%]/g,Ne=>{Ne!=="%%"&&(ue++,Ne==="%c"&&(de=ue))}),le.splice(de,0,Ie)}V.log=console.debug||console.log||(()=>{});function re(le){try{le?V.storage.setItem("debug",le):V.storage.removeItem("debug")}catch{}}function Ce(){let le;try{le=V.storage.getItem("debug")}catch{}return!le&&typeof k<"u"&&"env"in k&&(le=k.env.DEBUG),le}function ie(){try{return localStorage}catch{}}g.exports=r("./common")(V);const{formatters:ae}=g.exports;ae.j=function(le){try{return JSON.stringify(le)}catch(Ie){return"[UnexpectedJSONParseError]: "+Ie.message}}}).call(this)}).call(this,r("_process"))},{"./common":19,_process:50}],19:[function(r,g,V){function k($){re.debug=re,re.default=re,re.coerce=ue,re.disable=ae,re.enable=ie,re.enabled=le,re.humanize=r("ms"),re.destroy=de,Object.keys($).forEach(Ne=>{re[Ne]=$[Ne]}),re.names=[],re.skips=[],re.formatters={};function oe(Ne){let he=0;for(let ze=0;ze<Ne.length;ze++)he=(he<<5)-he+Ne.charCodeAt(ze),he|=0;return re.colors[Math.abs(he)%re.colors.length]}re.selectColor=oe;function re(Ne){let he,ze=null,pe,Ve;function Oe(..._e){if(!Oe.enabled)return;const At=Oe,$e=Number(new Date),Fe=$e-(he||$e);At.diff=Fe,At.prev=he,At.curr=$e,he=$e,_e[0]=re.coerce(_e[0]),typeof _e[0]!="string"&&_e.unshift("%O");let Ue=0;_e[0]=_e[0].replace(/%([a-zA-Z%])/g,(Dt,qe)=>{if(Dt==="%%")return"%";Ue++;const kt=re.formatters[qe];if(typeof kt=="function"){const Et=_e[Ue];Dt=kt.call(At,Et),_e.splice(Ue,1),Ue--}return Dt}),re.formatArgs.call(At,_e),(At.log||re.log).apply(At,_e)}return Oe.namespace=Ne,Oe.useColors=re.useColors(),Oe.color=re.selectColor(Ne),Oe.extend=Ce,Oe.destroy=re.destroy,Object.defineProperty(Oe,"enabled",{enumerable:!0,configurable:!1,get:()=>ze!==null?ze:(pe!==re.namespaces&&(pe=re.namespaces,Ve=re.enabled(Ne)),Ve),set:_e=>{ze=_e}}),typeof re.init=="function"&&re.init(Oe),Oe}function Ce(Ne,he){const ze=re(this.namespace+(typeof he>"u"?":":he)+Ne);return ze.log=this.log,ze}function ie(Ne){re.save(Ne),re.namespaces=Ne,re.names=[],re.skips=[];let he;const ze=(typeof Ne=="string"?Ne:"").split(/[\s,]+/),pe=ze.length;for(he=0;he<pe;he++)ze[he]&&(Ne=ze[he].replace(/\*/g,".*?"),Ne[0]==="-"?re.skips.push(new RegExp("^"+Ne.substr(1)+"$")):re.names.push(new RegExp("^"+Ne+"$")))}function ae(){const Ne=[...re.names.map(Ie),...re.skips.map(Ie).map(he=>"-"+he)].join(",");return re.enable(""),Ne}function le(Ne){if(Ne[Ne.length-1]==="*")return!0;let he,ze;for(he=0,ze=re.skips.length;he<ze;he++)if(re.skips[he].test(Ne))return!1;for(he=0,ze=re.names.length;he<ze;he++)if(re.names[he].test(Ne))return!0;return!1}function Ie(Ne){return Ne.toString().substring(2,Ne.toString().length-2).replace(/\.\*\?$/,"*")}function ue(Ne){return Ne instanceof Error?Ne.stack||Ne.message:Ne}function de(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return re.enable(re.load()),re}g.exports=k},{ms:45}],20:[function(r,g,V){(function(k,$){(function(){var oe=r("readable-stream"),re=r("end-of-stream"),Ce=r("inherits"),ie=r("stream-shift"),ae=$.from&&$.from!==Uint8Array.from?$.from([0]):new $([0]),le=function(pe,Ve){pe._corked?pe.once("uncork",Ve):Ve()},Ie=function(pe,Ve){pe._autoDestroy&&pe.destroy(Ve)},ue=function(pe,Ve){return function(Oe){Oe?Ie(pe,Oe.message==="premature close"?null:Oe):Ve&&!pe._ended&&pe.end()}},de=function(pe,Ve){if(!pe||pe._writableState&&pe._writableState.finished)return Ve();if(pe._writableState)return pe.end(Ve);pe.end(),Ve()},Ne=function(){},he=function(pe){return new oe.Readable({objectMode:!0,highWaterMark:16}).wrap(pe)},ze=function(pe,Ve,Oe){if(!(this instanceof ze))return new ze(pe,Ve,Oe);oe.Duplex.call(this,Oe),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!Oe||Oe.autoDestroy!==!1,this._forwardDestroy=!Oe||Oe.destroy!==!1,this._forwardEnd=!Oe||Oe.end!==!1,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,pe&&this.setWritable(pe),Ve&&this.setReadable(Ve)};Ce(ze,oe.Duplex),ze.obj=function(pe,Ve,Oe){return Oe||(Oe={}),Oe.objectMode=!0,Oe.highWaterMark=16,new ze(pe,Ve,Oe)},ze.prototype.cork=function(){++this._corked===1&&this.emit("cork")},ze.prototype.uncork=function(){this._corked&&--this._corked===0&&this.emit("uncork")},ze.prototype.setWritable=function(pe){if(this._unwrite&&this._unwrite(),this.destroyed){pe&&pe.destroy&&pe.destroy();return}if(pe===null||pe===!1){this.end();return}var Ve=this,Oe=re(pe,{writable:!0,readable:!1},ue(this,this._forwardEnd)),_e=function(){var $e=Ve._ondrain;Ve._ondrain=null,$e&&$e()},At=function(){Ve._writable.removeListener("drain",_e),Oe()};this._unwrite&&k.nextTick(_e),this._writable=pe,this._writable.on("drain",_e),this._unwrite=At,this.uncork()},ze.prototype.setReadable=function(pe){if(this._unread&&this._unread(),this.destroyed){pe&&pe.destroy&&pe.destroy();return}if(pe===null||pe===!1){this.push(null),this.resume();return}var Ve=this,Oe=re(pe,{writable:!1,readable:!0},ue(this)),_e=function(){Ve._forward()},At=function(){Ve.push(null)},$e=function(){Ve._readable2.removeListener("readable",_e),Ve._readable2.removeListener("end",At),Oe()};this._drained=!0,this._readable=pe,this._readable2=pe._readableState?pe:he(pe),this._readable2.on("readable",_e),this._readable2.on("end",At),this._unread=$e,this._forward()},ze.prototype._read=function(){this._drained=!0,this._forward()},ze.prototype._forward=function(){if(!(this._forwarding||!this._readable2||!this._drained)){this._forwarding=!0;for(var pe;this._drained&&(pe=ie(this._readable2))!==null;)this.destroyed||(this._drained=this.push(pe));this._forwarding=!1}},ze.prototype.destroy=function(pe,Ve){if(Ve||(Ve=Ne),this.destroyed)return Ve(null);this.destroyed=!0;var Oe=this;k.nextTick(function(){Oe._destroy(pe),Ve(null)})},ze.prototype._destroy=function(pe){if(pe){var Ve=this._ondrain;this._ondrain=null,Ve?Ve(pe):this.emit("error",pe)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},ze.prototype._write=function(pe,Ve,Oe){if(!this.destroyed){if(this._corked)return le(this,this._write.bind(this,pe,Ve,Oe));if(pe===ae)return this._finish(Oe);if(!this._writable)return Oe();this._writable.write(pe)===!1?this._ondrain=Oe:this.destroyed||Oe()}},ze.prototype._finish=function(pe){var Ve=this;this.emit("preend"),le(this,function(){de(Ve._forwardEnd&&Ve._writable,function(){Ve._writableState.prefinished===!1&&(Ve._writableState.prefinished=!0),Ve.emit("prefinish"),le(Ve,pe)})})},ze.prototype.end=function(pe,Ve,Oe){return typeof pe=="function"?this.end(null,null,pe):typeof Ve=="function"?this.end(pe,null,Ve):(this._ended=!0,pe&&this.write(pe),!this._writableState.ending&&!this._writableState.destroyed&&this.write(ae),oe.Writable.prototype.end.call(this,Oe))},g.exports=ze}).call(this)}).call(this,r("_process"),r("buffer").Buffer)},{_process:50,buffer:17,"end-of-stream":21,inherits:24,"readable-stream":69,"stream-shift":74}],21:[function(r,g,V){(function(k){(function(){var $=r("once"),oe=function(){},re=function(ae){return ae.setHeader&&typeof ae.abort=="function"},Ce=function(ae){return ae.stdio&&Array.isArray(ae.stdio)&&ae.stdio.length===3},ie=function(ae,le,Ie){if(typeof le=="function")return ie(ae,null,le);le||(le={}),Ie=$(Ie||oe);var ue=ae._writableState,de=ae._readableState,Ne=le.readable||le.readable!==!1&&ae.readable,he=le.writable||le.writable!==!1&&ae.writable,ze=!1,pe=function(){ae.writable||Ve()},Ve=function(){he=!1,Ne||Ie.call(ae)},Oe=function(){Ne=!1,he||Ie.call(ae)},_e=function(xe){Ie.call(ae,xe?new Error("exited with error code: "+xe):null)},At=function(xe){Ie.call(ae,xe)},$e=function(){k.nextTick(Fe)},Fe=function(){if(!ze){if(Ne&&!(de&&de.ended&&!de.destroyed))return Ie.call(ae,new Error("premature close"));if(he&&!(ue&&ue.ended&&!ue.destroyed))return Ie.call(ae,new Error("premature close"))}},Ue=function(){ae.req.on("finish",Ve)};return re(ae)?(ae.on("complete",Ve),ae.on("abort",$e),ae.req?Ue():ae.on("request",Ue)):he&&!ue&&(ae.on("end",pe),ae.on("close",pe)),Ce(ae)&&ae.on("exit",_e),ae.on("end",Oe),ae.on("finish",Ve),le.error!==!1&&ae.on("error",At),ae.on("close",$e),function(){ze=!0,ae.removeListener("complete",Ve),ae.removeListener("abort",$e),ae.removeListener("request",Ue),ae.req&&ae.req.removeListener("finish",Ve),ae.removeListener("end",pe),ae.removeListener("close",pe),ae.removeListener("finish",Ve),ae.removeListener("exit",_e),ae.removeListener("end",Oe),ae.removeListener("error",At),ae.removeListener("close",$e)}};g.exports=ie}).call(this)}).call(this,r("_process"))},{_process:50,once:48}],22:[function(r,g,V){var k=Object.create||Ue,$=Object.keys||xe,oe=Function.prototype.bind||Dt;function re(){(!this._events||!Object.prototype.hasOwnProperty.call(this,"_events"))&&(this._events=k(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}g.exports=re,re.EventEmitter=re,re.prototype._events=void 0,re.prototype._maxListeners=void 0;var Ce=10,ie;try{var ae={};Object.defineProperty&&Object.defineProperty(ae,"x",{value:0}),ie=ae.x===0}catch{ie=!1}ie?Object.defineProperty(re,"defaultMaxListeners",{enumerable:!0,get:function(){return Ce},set:function(qe){if(typeof qe!="number"||qe<0||qe!==qe)throw new TypeError('"defaultMaxListeners" must be a positive number');Ce=qe}}):re.defaultMaxListeners=Ce,re.prototype.setMaxListeners=function(kt){if(typeof kt!="number"||kt<0||isNaN(kt))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=kt,this};function le(qe){return qe._maxListeners===void 0?re.defaultMaxListeners:qe._maxListeners}re.prototype.getMaxListeners=function(){return le(this)};function Ie(qe,kt,Et){if(kt)qe.call(Et);else for(var jt=qe.length,ti=$e(qe,jt),Lt=0;Lt<jt;++Lt)ti[Lt].call(Et)}function ue(qe,kt,Et,jt){if(kt)qe.call(Et,jt);else for(var ti=qe.length,Lt=$e(qe,ti),Pt=0;Pt<ti;++Pt)Lt[Pt].call(Et,jt)}function de(qe,kt,Et,jt,ti){if(kt)qe.call(Et,jt,ti);else for(var Lt=qe.length,Pt=$e(qe,Lt),ni=0;ni<Lt;++ni)Pt[ni].call(Et,jt,ti)}function Ne(qe,kt,Et,jt,ti,Lt){if(kt)qe.call(Et,jt,ti,Lt);else for(var Pt=qe.length,ni=$e(qe,Pt),ri=0;ri<Pt;++ri)ni[ri].call(Et,jt,ti,Lt)}function he(qe,kt,Et,jt){if(kt)qe.apply(Et,jt);else for(var ti=qe.length,Lt=$e(qe,ti),Pt=0;Pt<ti;++Pt)Lt[Pt].apply(Et,jt)}re.prototype.emit=function(kt){var Et,jt,ti,Lt,Pt,ni,ri=kt==="error";if(ni=this._events,ni)ri=ri&&ni.error==null;else if(!ri)return!1;if(ri){if(arguments.length>1&&(Et=arguments[1]),Et instanceof Error)throw Et;var ui=new Error('Unhandled "error" event. ('+Et+")");throw ui.context=Et,ui}if(jt=ni[kt],!jt)return!1;var Ci=typeof jt=="function";switch(ti=arguments.length,ti){case 1:Ie(jt,Ci,this);break;case 2:ue(jt,Ci,this,arguments[1]);break;case 3:de(jt,Ci,this,arguments[1],arguments[2]);break;case 4:Ne(jt,Ci,this,arguments[1],arguments[2],arguments[3]);break;default:for(Lt=new Array(ti-1),Pt=1;Pt<ti;Pt++)Lt[Pt-1]=arguments[Pt];he(jt,Ci,this,Lt)}return!0};function ze(qe,kt,Et,jt){var ti,Lt,Pt;if(typeof Et!="function")throw new TypeError('"listener" argument must be a function');if(Lt=qe._events,Lt?(Lt.newListener&&(qe.emit("newListener",kt,Et.listener?Et.listener:Et),Lt=qe._events),Pt=Lt[kt]):(Lt=qe._events=k(null),qe._eventsCount=0),!Pt)Pt=Lt[kt]=Et,++qe._eventsCount;else if(typeof Pt=="function"?Pt=Lt[kt]=jt?[Et,Pt]:[Pt,Et]:jt?Pt.unshift(Et):Pt.push(Et),!Pt.warned&&(ti=le(qe),ti&&ti>0&&Pt.length>ti)){Pt.warned=!0;var ni=new Error("Possible EventEmitter memory leak detected. "+Pt.length+' "'+String(kt)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');ni.name="MaxListenersExceededWarning",ni.emitter=qe,ni.type=kt,ni.count=Pt.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",ni.name,ni.message)}return qe}re.prototype.addListener=function(kt,Et){return ze(this,kt,Et,!1)},re.prototype.on=re.prototype.addListener,re.prototype.prependListener=function(kt,Et){return ze(this,kt,Et,!0)};function pe(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var qe=new Array(arguments.length),kt=0;kt<qe.length;++kt)qe[kt]=arguments[kt];this.listener.apply(this.target,qe)}}function Ve(qe,kt,Et){var jt={fired:!1,wrapFn:void 0,target:qe,type:kt,listener:Et},ti=oe.call(pe,jt);return ti.listener=Et,jt.wrapFn=ti,ti}re.prototype.once=function(kt,Et){if(typeof Et!="function")throw new TypeError('"listener" argument must be a function');return this.on(kt,Ve(this,kt,Et)),this},re.prototype.prependOnceListener=function(kt,Et){if(typeof Et!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(kt,Ve(this,kt,Et)),this},re.prototype.removeListener=function(kt,Et){var jt,ti,Lt,Pt,ni;if(typeof Et!="function")throw new TypeError('"listener" argument must be a function');if(ti=this._events,!ti)return this;if(jt=ti[kt],!jt)return this;if(jt===Et||jt.listener===Et)--this._eventsCount===0?this._events=k(null):(delete ti[kt],ti.removeListener&&this.emit("removeListener",kt,jt.listener||Et));else if(typeof jt!="function"){for(Lt=-1,Pt=jt.length-1;Pt>=0;Pt--)if(jt[Pt]===Et||jt[Pt].listener===Et){ni=jt[Pt].listener,Lt=Pt;break}if(Lt<0)return this;Lt===0?jt.shift():At(jt,Lt),jt.length===1&&(ti[kt]=jt[0]),ti.removeListener&&this.emit("removeListener",kt,ni||Et)}return this},re.prototype.removeAllListeners=function(kt){var Et,jt,ti;if(jt=this._events,!jt)return this;if(!jt.removeListener)return arguments.length===0?(this._events=k(null),this._eventsCount=0):jt[kt]&&(--this._eventsCount===0?this._events=k(null):delete jt[kt]),this;if(arguments.length===0){var Lt=$(jt),Pt;for(ti=0;ti<Lt.length;++ti)Pt=Lt[ti],Pt!=="removeListener"&&this.removeAllListeners(Pt);return this.removeAllListeners("removeListener"),this._events=k(null),this._eventsCount=0,this}if(Et=jt[kt],typeof Et=="function")this.removeListener(kt,Et);else if(Et)for(ti=Et.length-1;ti>=0;ti--)this.removeListener(kt,Et[ti]);return this};function Oe(qe,kt,Et){var jt=qe._events;if(!jt)return[];var ti=jt[kt];return ti?typeof ti=="function"?Et?[ti.listener||ti]:[ti]:Et?Fe(ti):$e(ti,ti.length):[]}re.prototype.listeners=function(kt){return Oe(this,kt,!0)},re.prototype.rawListeners=function(kt){return Oe(this,kt,!1)},re.listenerCount=function(qe,kt){return typeof qe.listenerCount=="function"?qe.listenerCount(kt):_e.call(qe,kt)},re.prototype.listenerCount=_e;function _e(qe){var kt=this._events;if(kt){var Et=kt[qe];if(typeof Et=="function")return 1;if(Et)return Et.length}return 0}re.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function At(qe,kt){for(var Et=kt,jt=Et+1,ti=qe.length;jt<ti;Et+=1,jt+=1)qe[Et]=qe[jt];qe.pop()}function $e(qe,kt){for(var Et=new Array(kt),jt=0;jt<kt;++jt)Et[jt]=qe[jt];return Et}function Fe(qe){for(var kt=new Array(qe.length),Et=0;Et<kt.length;++Et)kt[Et]=qe[Et].listener||qe[Et];return kt}function Ue(qe){var kt=function(){};return kt.prototype=qe,new kt}function xe(qe){for(var kt in qe)Object.prototype.hasOwnProperty.call(qe,kt);return kt}function Dt(qe){var kt=this;return function(){return kt.apply(qe,arguments)}}},{}],23:[function(r,g,V){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */V.read=function(k,$,oe,re,Ce){var ie,ae,le=Ce*8-re-1,Ie=(1<<le)-1,ue=Ie>>1,de=-7,Ne=oe?Ce-1:0,he=oe?-1:1,ze=k[$+Ne];for(Ne+=he,ie=ze&(1<<-de)-1,ze>>=-de,de+=le;de>0;ie=ie*256+k[$+Ne],Ne+=he,de-=8);for(ae=ie&(1<<-de)-1,ie>>=-de,de+=re;de>0;ae=ae*256+k[$+Ne],Ne+=he,de-=8);if(ie===0)ie=1-ue;else{if(ie===Ie)return ae?NaN:(ze?-1:1)*(1/0);ae=ae+Math.pow(2,re),ie=ie-ue}return(ze?-1:1)*ae*Math.pow(2,ie-re)},V.write=function(k,$,oe,re,Ce,ie){var ae,le,Ie,ue=ie*8-Ce-1,de=(1<<ue)-1,Ne=de>>1,he=Ce===23?Math.pow(2,-24)-Math.pow(2,-77):0,ze=re?0:ie-1,pe=re?1:-1,Ve=$<0||$===0&&1/$<0?1:0;for($=Math.abs($),isNaN($)||$===1/0?(le=isNaN($)?1:0,ae=de):(ae=Math.floor(Math.log($)/Math.LN2),$*(Ie=Math.pow(2,-ae))<1&&(ae--,Ie*=2),ae+Ne>=1?$+=he/Ie:$+=he*Math.pow(2,1-Ne),$*Ie>=2&&(ae++,Ie/=2),ae+Ne>=de?(le=0,ae=de):ae+Ne>=1?(le=($*Ie-1)*Math.pow(2,Ce),ae=ae+Ne):(le=$*Math.pow(2,Ne-1)*Math.pow(2,Ce),ae=0));Ce>=8;k[oe+ze]=le&255,ze+=pe,le/=256,Ce-=8);for(ae=ae<<Ce|le,ue+=Ce;ue>0;k[oe+ze]=ae&255,ze+=pe,ae/=256,ue-=8);k[oe+ze-pe]|=Ve*128}},{}],24:[function(r,g,V){typeof Object.create=="function"?g.exports=function($,oe){oe&&($.super_=oe,$.prototype=Object.create(oe.prototype,{constructor:{value:$,enumerable:!1,writable:!0,configurable:!0}}))}:g.exports=function($,oe){if(oe){$.super_=oe;var re=function(){};re.prototype=oe.prototype,$.prototype=new re,$.prototype.constructor=$}}},{}],25:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});var k=function(){function $(oe,re){this.color=!0,this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0,this.leftChild=void 0,this.rightChild=void 0,this.key=oe,this.value=re}return $.prototype.rotateLeft=function(){var oe=this.parent,re=this.brother,Ce=this.leftChild,ie=this.rightChild;if(!ie)throw new Error("unknown error");var ae=ie.leftChild,le=ie.rightChild;return oe&&(oe.leftChild===this?oe.leftChild=ie:oe.rightChild===this&&(oe.rightChild=ie)),ie.parent=oe,ie.brother=re,ie.leftChild=this,ie.rightChild=le,re&&(re.brother=ie),this.parent=ie,this.brother=le,this.leftChild=Ce,this.rightChild=ae,le&&(le.parent=ie,le.brother=this),Ce&&(Ce.parent=this,Ce.brother=ae),ae&&(ae.parent=this,ae.brother=Ce),ie},$.prototype.rotateRight=function(){var oe=this.parent,re=this.brother,Ce=this.leftChild;if(!Ce)throw new Error("unknown error");var ie=this.rightChild,ae=Ce.leftChild,le=Ce.rightChild;return oe&&(oe.leftChild===this?oe.leftChild=Ce:oe.rightChild===this&&(oe.rightChild=Ce)),Ce.parent=oe,Ce.brother=re,Ce.leftChild=ae,Ce.rightChild=this,re&&(re.brother=Ce),ae&&(ae.parent=Ce,ae.brother=this),this.parent=Ce,this.brother=ae,this.leftChild=le,this.rightChild=ie,le&&(le.parent=this,le.brother=ie),ie&&(ie.parent=this,ie.brother=le),Ce},$.prototype.remove=function(){if(this.leftChild||this.rightChild)throw new Error("can only remove leaf node");this.parent&&(this===this.parent.leftChild?this.parent.leftChild=void 0:this===this.parent.rightChild&&(this.parent.rightChild=void 0)),this.brother&&(this.brother.brother=void 0),this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0},$.TreeNodeColorType={red:!0,black:!1},$}();Object.freeze(k),V.default=k},{}],26:[function(r,g,V){var k=this&&this.__generator||function(oe,re){var Ce={label:0,sent:function(){if(le[0]&1)throw le[1];return le[1]},trys:[],ops:[]},ie,ae,le,Ie;return Ie={next:ue(0),throw:ue(1),return:ue(2)},typeof Symbol=="function"&&(Ie[Symbol.iterator]=function(){return this}),Ie;function ue(Ne){return function(he){return de([Ne,he])}}function de(Ne){if(ie)throw new TypeError("Generator is already executing.");for(;Ce;)try{if(ie=1,ae&&(le=Ne[0]&2?ae.return:Ne[0]?ae.throw||((le=ae.return)&&le.call(ae),0):ae.next)&&!(le=le.call(ae,Ne[1])).done)return le;switch(ae=0,le&&(Ne=[Ne[0]&2,le.value]),Ne[0]){case 0:case 1:le=Ne;break;case 4:return Ce.label++,{value:Ne[1],done:!1};case 5:Ce.label++,ae=Ne[1],Ne=[0];continue;case 7:Ne=Ce.ops.pop(),Ce.trys.pop();continue;default:if(le=Ce.trys,!(le=le.length>0&&le[le.length-1])&&(Ne[0]===6||Ne[0]===2)){Ce=0;continue}if(Ne[0]===3&&(!le||Ne[1]>le[0]&&Ne[1]<le[3])){Ce.label=Ne[1];break}if(Ne[0]===6&&Ce.label<le[1]){Ce.label=le[1],le=Ne;break}if(le&&Ce.label<le[2]){Ce.label=le[2],Ce.ops.push(Ne);break}le[2]&&Ce.ops.pop(),Ce.trys.pop();continue}Ne=re.call(oe,Ce)}catch(he){Ne=[6,he],ae=0}finally{ie=le=0}if(Ne[0]&5)throw Ne[1];return{value:Ne[0]?Ne[1]:void 0,done:!0}}};Object.defineProperty(V,"__esModule",{value:!0}),$.sigma=3,$.bucketSize=5e3;function $(oe){var re=this;oe===void 0&&(oe=[]);var Ce=[],ie=0,ae=0,le=0,Ie=0,ue=0,de=0;this.size=function(){return de},this.empty=function(){return de===0},this.clear=function(){ie=le=ae=Ie=ue=de=0,he.call(this,$.bucketSize),de=0},this.front=function(){return Ce[ie][ae]},this.back=function(){return Ce[le][Ie]},this.forEach=function(ze){if(!this.empty()){var pe=0;if(ie===le){for(var Ve=ae;Ve<=Ie;++Ve)ze(Ce[ie][Ve],pe++);return}for(var Ve=ae;Ve<$.bucketSize;++Ve)ze(Ce[ie][Ve],pe++);for(var Ve=ie+1;Ve<le;++Ve)for(var Oe=0;Oe<$.bucketSize;++Oe)ze(Ce[Ve][Oe],pe++);for(var Ve=0;Ve<=Ie;++Ve)ze(Ce[le][Ve],pe++)}};var Ne=function(ze){var pe=ie*$.bucketSize+ae,Ve=pe+ze,Oe=le*$.bucketSize+Ie;if(Ve<pe||Ve>Oe)throw new Error("pos should more than 0 and less than queue's size");var _e=Math.floor(Ve/$.bucketSize),At=Ve%$.bucketSize;return{curNodeBucketIndex:_e,curNodePointerIndex:At}};this.getElementByPos=function(ze){var pe=Ne(ze),Ve=pe.curNodeBucketIndex,Oe=pe.curNodePointerIndex;return Ce[Ve][Oe]},this.eraseElementByPos=function(ze){var pe=this;if(ze<0||ze>de)throw new Error("pos should more than 0 and less than queue's size");if(ze===0)this.popFront();else if(ze===this.size())this.popBack();else{for(var Ve=[],Oe=ze+1;Oe<de;++Oe)Ve.push(this.getElementByPos(Oe));this.cut(ze),this.popBack(),Ve.forEach(function(_e){return pe.pushBack(_e)})}},this.eraseElementByValue=function(ze){if(!this.empty()){var pe=[];this.forEach(function(_e){_e!==ze&&pe.push(_e)});for(var Ve=pe.length,Oe=0;Oe<Ve;++Oe)this.setElementByPos(Oe,pe[Oe]);this.cut(Ve-1)}};var he=function(ze){for(var pe=[],Ve=ze*$.sigma,Oe=Math.max(Math.ceil(Ve/$.bucketSize),2),_e=0;_e<Oe;++_e)pe.push(new Array($.bucketSize));var At=Math.ceil(ze/$.bucketSize),$e=Math.floor(Oe/2)-Math.floor(At/2),Fe=$e,Ue=0;if(this.size())for(var _e=0;_e<At;++_e){for(var xe=0;xe<$.bucketSize;++xe)if(pe[$e+_e][xe]=this.front(),this.popFront(),this.empty()){Fe=$e+_e,Ue=xe;break}if(this.empty())break}Ce=pe,ie=$e,ae=0,le=Fe,Ie=Ue,ue=Oe,de=ze};this.pushBack=function(ze){this.empty()||(le===ue-1&&Ie===$.bucketSize-1&&he.call(this,this.size()),Ie<$.bucketSize-1?++Ie:le<ue-1&&(++le,Ie=0)),++de,Ce[le][Ie]=ze},this.popBack=function(){this.empty()||(this.size()!==1&&(Ie>0?--Ie:ie<le&&(--le,Ie=$.bucketSize-1)),de>0&&--de)},this.setElementByPos=function(ze,pe){var Ve=Ne(ze),Oe=Ve.curNodeBucketIndex,_e=Ve.curNodePointerIndex;Ce[Oe][_e]=pe},this.insert=function(ze,pe,Ve){var Oe=this;if(Ve===void 0&&(Ve=1),ze===0)for(;Ve--;)this.pushFront(pe);else if(ze===this.size())for(;Ve--;)this.pushBack(pe);else{for(var _e=[],At=ze;At<de;++At)_e.push(this.getElementByPos(At));this.cut(ze-1);for(var At=0;At<Ve;++At)this.pushBack(pe);_e.forEach(function($e){return Oe.pushBack($e)})}},this.find=function(ze){if(ie===le){for(var pe=ae;pe<=Ie;++pe)if(Ce[ie][pe]===ze)return!0;return!1}for(var pe=ae;pe<$.bucketSize;++pe)if(Ce[ie][pe]===ze)return!0;for(var pe=ie+1;pe<le;++pe)for(var Ve=0;Ve<$.bucketSize;++Ve)if(Ce[pe][Ve]===ze)return!0;for(var pe=0;pe<=Ie;++pe)if(Ce[le][pe]===ze)return!0;return!1},this.reverse=function(){for(var ze=0,pe=de-1;ze<pe;){var Ve=this.getElementByPos(ze);this.setElementByPos(ze,this.getElementByPos(pe)),this.setElementByPos(pe,Ve),++ze,--pe}},this.unique=function(){if(!this.empty()){var ze=[],pe=this.front();this.forEach(function(Oe,_e){(_e===0||Oe!==pe)&&(ze.push(Oe),pe=Oe)});for(var Ve=0;Ve<de;++Ve)this.setElementByPos(Ve,ze[Ve]);this.cut(ze.length-1)}},this.sort=function(ze){var pe=[];this.forEach(function(Oe){pe.push(Oe)}),pe.sort(ze);for(var Ve=0;Ve<de;++Ve)this.setElementByPos(Ve,pe[Ve])},this.pushFront=function(ze){this.empty()||(ie===0&&ae===0&&he.call(this,this.size()),ae>0?--ae:ie>0&&(--ie,ae=$.bucketSize-1)),++de,Ce[ie][ae]=ze},this.popFront=function(){this.empty()||(this.size()!==1&&(ae<$.bucketSize-1?++ae:ie<le&&(++ie,ae=0)),de>0&&--de)},this.shrinkToFit=function(){var ze=this,pe=[];this.forEach(function(At){pe.push(At)});var Ve=pe.length;Ce=[];for(var Oe=Math.ceil(Ve/$.bucketSize),_e=0;_e<Oe;++_e)Ce.push(new Array($.bucketSize));this.clear(),pe.forEach(function(At){return ze.pushBack(At)})},this.cut=function(ze){if(ze<0){this.clear();return}var pe=Ne(ze),Ve=pe.curNodeBucketIndex,Oe=pe.curNodePointerIndex;le=Ve,Ie=Oe,de=ze+1},this[Symbol.iterator]=function(){return function(){var pe,pe,pe,ze,pe;return k(this,function(Ve){switch(Ve.label){case 0:if(de===0)return[2];if(ie!==le)return[3,5];pe=ae,Ve.label=1;case 1:return pe<=Ie?[4,Ce[ie][pe]]:[3,4];case 2:Ve.sent(),Ve.label=3;case 3:return++pe,[3,1];case 4:return[2];case 5:pe=ae,Ve.label=6;case 6:return pe<$.bucketSize?[4,Ce[ie][pe]]:[3,9];case 7:Ve.sent(),Ve.label=8;case 8:return++pe,[3,6];case 9:pe=ie+1,Ve.label=10;case 10:if(!(pe<le))return[3,15];ze=0,Ve.label=11;case 11:return ze<$.bucketSize?[4,Ce[pe][ze]]:[3,14];case 12:Ve.sent(),Ve.label=13;case 13:return++ze,[3,11];case 14:return++pe,[3,10];case 15:pe=0,Ve.label=16;case 16:return pe<=Ie?[4,Ce[le][pe]]:[3,19];case 17:Ve.sent(),Ve.label=18;case 18:return++pe,[3,16];case 19:return[2]}})}()},function(){var ze=$.bucketSize;oe.size?ze=oe.size():oe.length&&(ze=oe.length);var pe=ze*$.sigma;ue=Math.ceil(pe/$.bucketSize),ue=Math.max(ue,3);for(var Ve=0;Ve<ue;++Ve)Ce.push(new Array($.bucketSize));var Oe=Math.ceil(ze/$.bucketSize);ie=Math.floor(ue/2)-Math.floor(Oe/2),le=ie,oe.forEach(function(_e){return re.pushBack(_e)})}(),Object.freeze(this)}Object.freeze($),V.default=$},{}],27:[function(r,g,V){var k=this&&this.__generator||function(ie,ae){var le={label:0,sent:function(){if(de[0]&1)throw de[1];return de[1]},trys:[],ops:[]},Ie,ue,de,Ne;return Ne={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(Ne[Symbol.iterator]=function(){return this}),Ne;function he(pe){return function(Ve){return ze([pe,Ve])}}function ze(pe){if(Ie)throw new TypeError("Generator is already executing.");for(;le;)try{if(Ie=1,ue&&(de=pe[0]&2?ue.return:pe[0]?ue.throw||((de=ue.return)&&de.call(ue),0):ue.next)&&!(de=de.call(ue,pe[1])).done)return de;switch(ue=0,de&&(pe=[pe[0]&2,de.value]),pe[0]){case 0:case 1:de=pe;break;case 4:return le.label++,{value:pe[1],done:!1};case 5:le.label++,ue=pe[1],pe=[0];continue;case 7:pe=le.ops.pop(),le.trys.pop();continue;default:if(de=le.trys,!(de=de.length>0&&de[de.length-1])&&(pe[0]===6||pe[0]===2)){le=0;continue}if(pe[0]===3&&(!de||pe[1]>de[0]&&pe[1]<de[3])){le.label=pe[1];break}if(pe[0]===6&&le.label<de[1]){le.label=de[1],de=pe;break}if(de&&le.label<de[2]){le.label=de[2],le.ops.push(pe);break}de[2]&&le.ops.pop(),le.trys.pop();continue}pe=ae.call(ie,le)}catch(Ve){pe=[6,Ve],ue=0}finally{Ie=de=0}if(pe[0]&5)throw pe[1];return{value:pe[0]?pe[1]:void 0,done:!0}}},$=this&&this.__values||function(ie){var ae=typeof Symbol=="function"&&Symbol.iterator,le=ae&&ie[ae],Ie=0;if(le)return le.call(ie);if(ie&&typeof ie.length=="number")return{next:function(){return ie&&Ie>=ie.length&&(ie=void 0),{value:ie&&ie[Ie++],done:!ie}}};throw new TypeError(ae?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../LinkList/LinkList"),re=r("../Map/Map");Ce.initSize=16,Ce.maxSize=1<<30,Ce.sigma=.75,Ce.treeifyThreshold=8,Ce.untreeifyThreshold=6,Ce.minTreeifySize=64;function Ce(ie,ae,le){var Ie=this;if(ie===void 0&&(ie=[]),ae===void 0&&(ae=Ce.initSize),le=le||function(ze){var pe,Ve,Oe=0,_e="";if(typeof ze=="number")Oe=Math.floor(ze),Oe=(Oe<<5)-Oe,Oe=Oe&Oe;else{typeof ze!="string"?_e=JSON.stringify(ze):_e=ze;try{for(var At=$(_e),$e=At.next();!$e.done;$e=At.next()){var Fe=$e.value,Ue=Fe.charCodeAt(0);Oe=(Oe<<5)-Oe+Ue,Oe=Oe&Oe}}catch(xe){pe={error:xe}}finally{try{$e&&!$e.done&&(Ve=At.return)&&Ve.call(At)}finally{if(pe)throw pe.error}}}return Oe^=Oe>>>16,Oe},ae&ae-1)throw new Error("initBucketNum must be 2 to the power of n");var ue=0,de=[],Ne=Math.max(Ce.initSize,Math.min(Ce.maxSize,ae));this.size=function(){return ue},this.empty=function(){return ue===0},this.clear=function(){ue=0,Ne=ae,de=[]},this.forEach=function(ze){var pe=0;de.forEach(function(Ve){Ve.forEach(function(Oe){ze(Oe,pe++)})})};var he=function(ze){if(!(ze>=Ce.maxSize)){Ne=ze*2;var pe=[];de.forEach(function(Ve,Oe){if(!Ve.empty()){if(Ve instanceof oe.default&&Ve.size()===1){var _e=Ve.front(),At=_e.key,$e=_e.value;pe[le(At)&Ne-1]=new oe.default([{key:At,value:$e}])}else if(Ve instanceof re.default){var Fe=new oe.default,Ue=new oe.default;Ve.forEach(function(qe){var kt=le(qe.key);kt&ze?Ue.pushBack(qe):Fe.pushBack(qe)}),Fe.size()>Ce.untreeifyThreshold?pe[Oe]=new re.default(Fe):Fe.size()&&(pe[Oe]=Fe),Ue.size()>Ce.untreeifyThreshold?pe[Oe+ze]=new re.default(Ue):Ue.size()&&(pe[Oe+ze]=Ue)}else{var xe=new oe.default,Dt=new oe.default;Ve.forEach(function(qe){var kt=le(qe.key);kt&ze?Dt.pushBack(qe):xe.pushBack(qe)}),xe.size()&&(pe[Oe]=xe),Dt.size()&&(pe[Oe+ze]=Dt)}de[Oe].clear()}}),de=pe}};this.setElement=function(ze,pe){var Ve,Oe;if(ze==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(pe==null){this.eraseElementByKey(ze);return}var _e=le(ze)&Ne-1;if(!de[_e])++ue,de[_e]=new oe.default([{key:ze,value:pe}]);else{var At=de[_e].size();if(de[_e]instanceof oe.default){try{for(var $e=$(de[_e]),Fe=$e.next();!Fe.done;Fe=$e.next()){var Ue=Fe.value;if(Ue.key===ze){Ue.value=pe;return}}}catch(Dt){Ve={error:Dt}}finally{try{Fe&&!Fe.done&&(Oe=$e.return)&&Oe.call($e)}finally{if(Ve)throw Ve.error}}de[_e].pushBack({key:ze,value:pe}),de[_e].size()>=Ce.treeifyThreshold&&(de[_e]=new re.default(de[_e]))}else de[_e].setElement(ze,pe);var xe=de[_e].size();ue+=xe-At}ue>Ne*Ce.sigma&&he.call(this,Ne)},this.getElementByKey=function(ze){var pe,Ve,Oe=le(ze)&Ne-1;if(de[Oe]){if(de[Oe]instanceof re.default)return de[Oe].getElementByKey(ze);try{for(var _e=$(de[Oe]),At=_e.next();!At.done;At=_e.next()){var $e=At.value;if($e.key===ze)return $e.value}}catch(Fe){pe={error:Fe}}finally{try{At&&!At.done&&(Ve=_e.return)&&Ve.call(_e)}finally{if(pe)throw pe.error}}}},this.eraseElementByKey=function(ze){var pe,Ve,Oe=le(ze)&Ne-1;if(de[Oe]){var _e=de[Oe].size();if(de[Oe]instanceof re.default)de[Oe].eraseElementByKey(ze),de[Oe].size()<=Ce.untreeifyThreshold&&(de[Oe]=new oe.default(de[Oe]));else{var At=-1;try{for(var $e=$(de[Oe]),Fe=$e.next();!Fe.done;Fe=$e.next()){var Ue=Fe.value;if(++At,Ue.key===ze){de[Oe].eraseElementByPos(At);break}}}catch(Dt){pe={error:Dt}}finally{try{Fe&&!Fe.done&&(Ve=$e.return)&&Ve.call($e)}finally{if(pe)throw pe.error}}}var xe=de[Oe].size();ue+=xe-_e}},this.find=function(ze){var pe,Ve,Oe=le(ze)&Ne-1;if(!de[Oe])return!1;if(de[Oe]instanceof re.default)return de[Oe].find(ze);try{for(var _e=$(de[Oe]),At=_e.next();!At.done;At=_e.next()){var $e=At.value;if($e.key===ze)return!0}}catch(Fe){pe={error:Fe}}finally{try{At&&!At.done&&(Ve=_e.return)&&Ve.call(_e)}finally{if(pe)throw pe.error}}return!1},this[Symbol.iterator]=function(){return function(){var ze,pe,Ve,Oe,_e,At,$e;return k(this,function(Fe){switch(Fe.label){case 0:ze=0,Fe.label=1;case 1:if(!(ze<Ne))return[3,10];for(;ze<Ne&&!de[ze];)++ze;if(ze>=Ne)return[3,10];Fe.label=2;case 2:Fe.trys.push([2,7,8,9]),pe=(At=void 0,$(de[ze])),Ve=pe.next(),Fe.label=3;case 3:return Ve.done?[3,6]:(Oe=Ve.value,[4,Oe]);case 4:Fe.sent(),Fe.label=5;case 5:return Ve=pe.next(),[3,3];case 6:return[3,9];case 7:return _e=Fe.sent(),At={error:_e},[3,9];case 8:try{Ve&&!Ve.done&&($e=pe.return)&&$e.call(pe)}finally{if(At)throw At.error}return[7];case 9:return++ze,[3,1];case 10:return[2]}})}()},ie.forEach(function(ze){var pe=ze.key,Ve=ze.value;return Ie.setElement(pe,Ve)}),Object.freeze(this)}Object.freeze(Ce),V.default=Ce},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(r,g,V){var k=this&&this.__generator||function(ie,ae){var le={label:0,sent:function(){if(de[0]&1)throw de[1];return de[1]},trys:[],ops:[]},Ie,ue,de,Ne;return Ne={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(Ne[Symbol.iterator]=function(){return this}),Ne;function he(pe){return function(Ve){return ze([pe,Ve])}}function ze(pe){if(Ie)throw new TypeError("Generator is already executing.");for(;le;)try{if(Ie=1,ue&&(de=pe[0]&2?ue.return:pe[0]?ue.throw||((de=ue.return)&&de.call(ue),0):ue.next)&&!(de=de.call(ue,pe[1])).done)return de;switch(ue=0,de&&(pe=[pe[0]&2,de.value]),pe[0]){case 0:case 1:de=pe;break;case 4:return le.label++,{value:pe[1],done:!1};case 5:le.label++,ue=pe[1],pe=[0];continue;case 7:pe=le.ops.pop(),le.trys.pop();continue;default:if(de=le.trys,!(de=de.length>0&&de[de.length-1])&&(pe[0]===6||pe[0]===2)){le=0;continue}if(pe[0]===3&&(!de||pe[1]>de[0]&&pe[1]<de[3])){le.label=pe[1];break}if(pe[0]===6&&le.label<de[1]){le.label=de[1],de=pe;break}if(de&&le.label<de[2]){le.label=de[2],le.ops.push(pe);break}de[2]&&le.ops.pop(),le.trys.pop();continue}pe=ae.call(ie,le)}catch(Ve){pe=[6,Ve],ue=0}finally{Ie=de=0}if(pe[0]&5)throw pe[1];return{value:pe[0]?pe[1]:void 0,done:!0}}},$=this&&this.__values||function(ie){var ae=typeof Symbol=="function"&&Symbol.iterator,le=ae&&ie[ae],Ie=0;if(le)return le.call(ie);if(ie&&typeof ie.length=="number")return{next:function(){return ie&&Ie>=ie.length&&(ie=void 0),{value:ie&&ie[Ie++],done:!ie}}};throw new TypeError(ae?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../Set/Set"),re=r("../LinkList/LinkList");Ce.initSize=16,Ce.maxSize=1<<30,Ce.sigma=.75,Ce.treeifyThreshold=8,Ce.untreeifyThreshold=6,Ce.minTreeifySize=64;function Ce(ie,ae,le){var Ie=this;if(ie===void 0&&(ie=[]),ae===void 0&&(ae=Ce.initSize),le=le||function(ze){var pe=0,Ve="";if(typeof ze=="number")pe=Math.floor(ze),pe=(pe<<5)-pe,pe=pe&pe;else{typeof ze!="string"?Ve=JSON.stringify(ze):Ve=ze;for(var Oe=0;Oe<Ve.length;Oe++){var _e=Ve.charCodeAt(Oe);pe=(pe<<5)-pe+_e,pe=pe&pe}}return pe^=pe>>>16,pe},ae&ae-1)throw new Error("initBucketNum must be 2 to the power of n");var ue=0,de=[],Ne=Math.max(Ce.initSize,Math.min(Ce.maxSize,ae));this.size=function(){return ue},this.empty=function(){return ue===0},this.clear=function(){ue=0,Ne=ae,de=[]},this.forEach=function(ze){var pe=0;de.forEach(function(Ve){Ve.forEach(function(Oe){ze(Oe,pe++)})})};var he=function(ze){if(!(ze>=Ce.maxSize)){Ne=ze*2;var pe=[];de.forEach(function(Ve,Oe){if(!Ve.empty()){if(Ve instanceof re.default&&Ve.size()===1){var _e=Ve.front();if(_e===void 0)throw new Error("unknown error");pe[le(_e)&Ne-1]=new re.default([_e])}else if(Ve instanceof oe.default){var At=new re.default,$e=new re.default;Ve.forEach(function(xe){var Dt=le(xe);Dt&ze?$e.pushBack(xe):At.pushBack(xe)}),At.size()>Ce.untreeifyThreshold?pe[Oe]=new oe.default(At):At.size()&&(pe[Oe]=At),$e.size()>Ce.untreeifyThreshold?pe[Oe+ze]=new oe.default($e):$e.size()&&(pe[Oe+ze]=$e)}else{var Fe=new re.default,Ue=new re.default;Ve.forEach(function(xe){var Dt=le(xe);Dt&ze?Ue.pushBack(xe):Fe.pushBack(xe)}),Fe.size()&&(pe[Oe]=Fe),Ue.size()&&(pe[Oe+ze]=Ue)}de[Oe].clear()}}),de=pe}};this.insert=function(ze){if(ze==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var pe=le(ze)&Ne-1;if(!de[pe])de[pe]=new re.default([ze]),++ue;else{var Ve=de[pe].size();if(de[pe]instanceof re.default){if(de[pe].find(ze))return;de[pe].pushBack(ze),de[pe].size()>=Ce.treeifyThreshold&&(de[pe]=new oe.default(de[pe]))}else de[pe].insert(ze);var Oe=de[pe].size();ue+=Oe-Ve}ue>Ne*Ce.sigma&&he.call(this,Ne)},this.eraseElementByValue=function(ze){var pe=le(ze)&Ne-1;if(de[pe]){var Ve=de[pe].size();de[pe].eraseElementByValue(ze),de[pe]instanceof oe.default&&de[pe].size()<=Ce.untreeifyThreshold&&(de[pe]=new re.default(de[pe]));var Oe=de[pe].size();ue+=Oe-Ve}},this.find=function(ze){var pe=le(ze)&Ne-1;return de[pe]?de[pe].find(ze):!1},this[Symbol.iterator]=function(){return function(){var ze,pe,Ve,Oe,_e,At,$e;return k(this,function(Fe){switch(Fe.label){case 0:ze=0,Fe.label=1;case 1:if(!(ze<Ne))return[3,10];for(;ze<Ne&&!de[ze];)++ze;if(ze>=Ne)return[3,10];Fe.label=2;case 2:Fe.trys.push([2,7,8,9]),pe=(At=void 0,$(de[ze])),Ve=pe.next(),Fe.label=3;case 3:return Ve.done?[3,6]:(Oe=Ve.value,[4,Oe]);case 4:Fe.sent(),Fe.label=5;case 5:return Ve=pe.next(),[3,3];case 6:return[3,9];case 7:return _e=Fe.sent(),At={error:_e},[3,9];case 8:try{Ve&&!Ve.done&&($e=pe.return)&&$e.call(pe)}finally{if(At)throw At.error}return[7];case 9:return++ze,[3,1];case 10:return[2]}})}()},ie.forEach(function(ze){return Ie.insert(ze)}),Object.freeze(this)}Object.freeze(Ce),V.default=Ce},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(r,g,V){var k=this&&this.__generator||function(re,Ce){var ie={label:0,sent:function(){if(Ie[0]&1)throw Ie[1];return Ie[1]},trys:[],ops:[]},ae,le,Ie,ue;return ue={next:de(0),throw:de(1),return:de(2)},typeof Symbol=="function"&&(ue[Symbol.iterator]=function(){return this}),ue;function de(he){return function(ze){return Ne([he,ze])}}function Ne(he){if(ae)throw new TypeError("Generator is already executing.");for(;ie;)try{if(ae=1,le&&(Ie=he[0]&2?le.return:he[0]?le.throw||((Ie=le.return)&&Ie.call(le),0):le.next)&&!(Ie=Ie.call(le,he[1])).done)return Ie;switch(le=0,Ie&&(he=[he[0]&2,Ie.value]),he[0]){case 0:case 1:Ie=he;break;case 4:return ie.label++,{value:he[1],done:!1};case 5:ie.label++,le=he[1],he=[0];continue;case 7:he=ie.ops.pop(),ie.trys.pop();continue;default:if(Ie=ie.trys,!(Ie=Ie.length>0&&Ie[Ie.length-1])&&(he[0]===6||he[0]===2)){ie=0;continue}if(he[0]===3&&(!Ie||he[1]>Ie[0]&&he[1]<Ie[3])){ie.label=he[1];break}if(he[0]===6&&ie.label<Ie[1]){ie.label=Ie[1],Ie=he;break}if(Ie&&ie.label<Ie[2]){ie.label=Ie[2],ie.ops.push(he);break}Ie[2]&&ie.ops.pop(),ie.trys.pop();continue}he=Ce.call(re,ie)}catch(ze){he=[6,ze],le=0}finally{ae=Ie=0}if(he[0]&5)throw he[1];return{value:he[0]?he[1]:void 0,done:!0}}};Object.defineProperty(V,"__esModule",{value:!0});var $=function(){function re(Ce){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=Ce}return re}();function oe(re){var Ce=this;re===void 0&&(re=[]);var ie=0,ae=void 0,le=void 0;this.size=function(){return ie},this.empty=function(){return ie===0},this.clear=function(){ae=le=void 0,ie=0},this.front=function(){return ae==null?void 0:ae.value},this.back=function(){return le==null?void 0:le.value},this.forEach=function(Ie){for(var ue=ae,de=0;ue;){if(ue.value===void 0)throw new Error("unknown error");Ie(ue.value,de++),ue=ue.next}},this.getElementByPos=function(Ie){if(Ie<0||Ie>=ie)throw new Error("pos must more then 0 and less then the list length");for(var ue=ae;Ie--&&ue;)ue=ue.next;if(!ue||ue.value===void 0)throw new Error("unknown error");return ue.value},this.eraseElementByPos=function(Ie){if(Ie<0||Ie>=ie)throw new Error("erase pos must more then 0 and less then the list length");if(Ie===0)this.popFront();else if(Ie===ie-1)this.popBack();else{for(var ue=ae;Ie--;){if(!(ue!=null&&ue.next))throw new Error("unknown error");ue=ue.next}if(!ue||!ue.pre||!ue.next)throw new Error("unknown error");var de=ue.pre,Ne=ue.next;Ne.pre=de,de.next=Ne,ie>0&&--ie}},this.eraseElementByValue=function(Ie){for(;ae&&ae.value===Ie;)this.popFront();for(;le&&le.value===Ie;)this.popBack();if(ae)for(var ue=ae;ue;){if(ue.value===Ie){var de=ue.pre,Ne=ue.next;Ne&&(Ne.pre=de),de&&(de.next=Ne),ie>0&&--ie}ue=ue.next}},this.pushBack=function(Ie){if(Ie==null)throw new Error("you can't push null or undefined here");++ie;var ue=new $(Ie);le?(le.next=ue,ue.pre=le,le=ue):ae=le=ue},this.popBack=function(){le&&(ie>0&&--ie,le&&(ae===le?ae=le=void 0:(le=le.pre,le&&(le.next=void 0))))},this.setElementByPos=function(Ie,ue){if(ue==null)throw new Error("you can't set null or undefined here");if(Ie<0||Ie>=ie)throw new Error("pos must more then 0 and less then the list length");for(var de=ae;Ie--;){if(!de)throw new Error("unknown error");de=de.next}de&&(de.value=ue)},this.insert=function(Ie,ue,de){if(de===void 0&&(de=1),ue==null)throw new Error("you can't insert null or undefined here");if(Ie<0||Ie>ie)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(de<0)throw new Error("insert size must more than 0");if(Ie===0)for(;de--;)this.pushFront(ue);else if(Ie===ie)for(;de--;)this.pushBack(ue);else{for(var Ne=ae,he=1;he<Ie;++he){if(!(Ne!=null&&Ne.next))throw new Error("unknown error");Ne=Ne==null?void 0:Ne.next}if(!Ne)throw new Error("unknown error");var ze=Ne.next;for(ie+=de;de--;)Ne.next=new $(ue),Ne.next.pre=Ne,Ne=Ne.next;Ne.next=ze,ze&&(ze.pre=Ne)}},this.find=function(Ie){for(var ue=ae;ue;){if(ue.value===Ie)return!0;ue=ue.next}return!1},this.reverse=function(){for(var Ie=ae,ue=le,de=0;Ie&&ue&&de*2<ie;){var Ne=Ie.value;Ie.value=ue.value,ue.value=Ne,Ie=Ie.next,ue=ue.pre,++de}},this.unique=function(){for(var Ie=ae;Ie;){for(var ue=Ie;ue&&ue.next&&ue.value===ue.next.value;)ue=ue.next,ie>0&&--ie;Ie.next=ue.next,Ie.next&&(Ie.next.pre=Ie),Ie=Ie.next}},this.sort=function(Ie){var ue=[];this.forEach(function(Ne){ue.push(Ne)}),ue.sort(Ie);var de=ae;ue.forEach(function(Ne){de&&(de.value=Ne,de=de.next)})},this.pushFront=function(Ie){if(Ie==null)throw new Error("you can't push null or undefined here");++ie;var ue=new $(Ie);ae?(ue.next=ae,ae.pre=ue,ae=ue):ae=le=ue},this.popFront=function(){ae&&(ie>0&&--ie,ae&&(ae===le?ae=le=void 0:(ae=ae.next,ae&&(ae.pre=void 0))))},this.merge=function(Ie){var ue=this,de=ae;Ie.forEach(function(Ne){for(;de&&de.value!==void 0&&de.value<=Ne;)de=de.next;if(de===void 0)ue.pushBack(Ne),de=le;else if(de===ae)ue.pushFront(Ne),de=ae;else{++ie;var he=de.pre;he&&(he.next=new $(Ne),he.next.pre=he,he.next.next=de,de&&(de.pre=he.next))}})},this[Symbol.iterator]=function(){return function(){var Ie;return k(this,function(ue){switch(ue.label){case 0:Ie=ae,ue.label=1;case 1:if(Ie===void 0)return[3,3];if(!Ie.value)throw new Error("unknown error");return[4,Ie.value];case 2:return ue.sent(),Ie=Ie.next,[3,1];case 3:return[2]}})}()},re.forEach(function(Ie){return Ce.pushBack(Ie)}),Object.freeze(this)}Object.freeze(oe),V.default=oe},{}],30:[function(r,g,V){var k=this&&this.__generator||function(Ce,ie){var ae={label:0,sent:function(){if(ue[0]&1)throw ue[1];return ue[1]},trys:[],ops:[]},le,Ie,ue,de;return de={next:Ne(0),throw:Ne(1),return:Ne(2)},typeof Symbol=="function"&&(de[Symbol.iterator]=function(){return this}),de;function Ne(ze){return function(pe){return he([ze,pe])}}function he(ze){if(le)throw new TypeError("Generator is already executing.");for(;ae;)try{if(le=1,Ie&&(ue=ze[0]&2?Ie.return:ze[0]?Ie.throw||((ue=Ie.return)&&ue.call(Ie),0):Ie.next)&&!(ue=ue.call(Ie,ze[1])).done)return ue;switch(Ie=0,ue&&(ze=[ze[0]&2,ue.value]),ze[0]){case 0:case 1:ue=ze;break;case 4:return ae.label++,{value:ze[1],done:!1};case 5:ae.label++,Ie=ze[1],ze=[0];continue;case 7:ze=ae.ops.pop(),ae.trys.pop();continue;default:if(ue=ae.trys,!(ue=ue.length>0&&ue[ue.length-1])&&(ze[0]===6||ze[0]===2)){ae=0;continue}if(ze[0]===3&&(!ue||ze[1]>ue[0]&&ze[1]<ue[3])){ae.label=ze[1];break}if(ze[0]===6&&ae.label<ue[1]){ae.label=ue[1],ue=ze;break}if(ue&&ae.label<ue[2]){ae.label=ue[2],ae.ops.push(ze);break}ue[2]&&ae.ops.pop(),ae.trys.pop();continue}ze=ie.call(Ce,ae)}catch(pe){ze=[6,pe],Ie=0}finally{le=ue=0}if(ze[0]&5)throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}},$=this&&this.__values||function(Ce){var ie=typeof Symbol=="function"&&Symbol.iterator,ae=ie&&Ce[ie],le=0;if(ae)return ae.call(Ce);if(Ce&&typeof Ce.length=="number")return{next:function(){return Ce&&le>=Ce.length&&(Ce=void 0),{value:Ce&&Ce[le++],done:!Ce}}};throw new TypeError(ie?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../Base/TreeNode");function re(Ce,ie){var ae=this;Ce===void 0&&(Ce=[]),ie=ie||function(xe,Dt){return xe<Dt?-1:xe>Dt?1:0};var le=0,Ie=new oe.default;Ie.color=oe.default.TreeNodeColorType.black,this.size=function(){return le},this.empty=function(){return le===0},this.clear=function(){le=0,Ie.key=Ie.value=void 0,Ie.leftChild=Ie.rightChild=Ie.brother=void 0};var ue=function(xe){if(!xe||xe.key===void 0)throw new Error("unknown error");return xe.leftChild?ue(xe.leftChild):xe},de=function(xe){if(!xe||xe.key===void 0)throw new Error("unknown error");return xe.rightChild?de(xe.rightChild):xe};this.front=function(){if(!this.empty()){var xe=ue(Ie);if(xe.key===void 0||xe.value===void 0)throw new Error("unknown error");return{key:xe.key,value:xe.value}}},this.back=function(){if(!this.empty()){var xe=de(Ie);if(xe.key===void 0||xe.value===void 0)throw new Error("unknown error");return{key:xe.key,value:xe.value}}},this.forEach=function(xe){var Dt,qe,kt=0;try{for(var Et=$(this),jt=Et.next();!jt.done;jt=Et.next()){var ti=jt.value;xe(ti,kt++)}}catch(Lt){Dt={error:Lt}}finally{try{jt&&!jt.done&&(qe=Et.return)&&qe.call(Et)}finally{if(Dt)throw Dt.error}}},this.getElementByPos=function(xe){var Dt,qe;if(xe<0||xe>=this.size())throw new Error("pos must more than 0 and less than set's size");var kt=0;try{for(var Et=$(this),jt=Et.next();!jt.done;jt=Et.next()){var ti=jt.value;if(kt===xe)return ti;++kt}}catch(Lt){Dt={error:Lt}}finally{try{jt&&!jt.done&&(qe=Et.return)&&qe.call(Et)}finally{if(Dt)throw Dt.error}}throw new Error("unknown Error")};var Ne=function(xe,Dt){if(!(!xe||xe.key===void 0||xe.value===void 0)){var qe=ie(xe.key,Dt);return qe===0?{key:xe.key,value:xe.value}:qe<0?Ne(xe.rightChild,Dt):Ne(xe.leftChild,Dt)||{key:xe.key,value:xe.value}}};this.lowerBound=function(xe){return Ne(Ie,xe)};var he=function(xe,Dt){if(!(!xe||xe.key===void 0||xe.value===void 0)){var qe=ie(xe.key,Dt);return qe<=0?he(xe.rightChild,Dt):he(xe.leftChild,Dt)||{key:xe.key,value:xe.value}}};this.upperBound=function(xe){return he(Ie,xe)};var ze=function(xe,Dt){if(!(!xe||xe.key===void 0||xe.value===void 0)){var qe=ie(xe.key,Dt);return qe===0?{key:xe.key,value:xe.value}:qe>0?ze(xe.leftChild,Dt):ze(xe.rightChild,Dt)||{key:xe.key,value:xe.value}}};this.reverseLowerBound=function(xe){return ze(Ie,xe)};var pe=function(xe,Dt){if(!(!xe||xe.key===void 0||xe.value===void 0)){var qe=ie(xe.key,Dt);return qe>=0?pe(xe.leftChild,Dt):pe(xe.rightChild,Dt)||{key:xe.key,value:xe.value}}};this.reverseUpperBound=function(xe){return pe(Ie,xe)};var Ve=function(xe){var Dt=xe.parent;if(!Dt){if(xe===Ie)return;throw new Error("unknown error")}if(xe.color===oe.default.TreeNodeColorType.red){xe.color=oe.default.TreeNodeColorType.black;return}var qe=xe.brother;if(!qe)throw new Error("unknown error");if(xe===Dt.leftChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),Ve(xe)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),xe.color=oe.default.TreeNodeColorType.black}else if((!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateRight();Ie===qe&&(Ie=kt),Ve(xe)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,Ve(Dt))}else if(xe===Dt.rightChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),Ve(xe)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),xe.color=oe.default.TreeNodeColorType.black}else if((!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateLeft();Ie===qe&&(Ie=kt),Ve(xe)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,Ve(Dt))}},Oe=function(xe){for(var Dt=xe;Dt.leftChild||Dt.rightChild;){if(Dt.rightChild){Dt=ue(Dt.rightChild);var qe=xe.key;xe.key=Dt.key,Dt.key=qe;var kt=xe.value;xe.value=Dt.value,Dt.value=kt,xe=Dt}if(Dt.leftChild){Dt=de(Dt.leftChild);var qe=xe.key;xe.key=Dt.key,Dt.key=qe;var kt=xe.value;xe.value=Dt.value,Dt.value=kt,xe=Dt}}Ve(Dt),Dt&&Dt.remove(),--le,Ie.color=oe.default.TreeNodeColorType.black},_e=function(xe,Dt){if(!xe||xe.key===void 0)return!1;var qe=_e(xe.leftChild,Dt);return qe||Dt(xe)?!0:_e(xe.rightChild,Dt)};this.eraseElementByPos=function(xe){if(xe<0||xe>=le)throw new Error("pos must more than 0 and less than set's size");var Dt=0;_e(Ie,function(qe){return xe===Dt?(Oe(qe),!0):(++Dt,!1)})},this.eraseElementByKey=function(xe){if(!this.empty()){var Dt=Fe(Ie,xe);Dt===void 0||Dt.key===void 0||ie(Dt.key,xe)!==0||Oe(Dt)}};var At=function(xe,Dt){if(!xe||xe.key===void 0)throw new Error("unknown error");var qe=ie(Dt,xe.key);return qe<0?xe.leftChild?At(xe.leftChild,Dt):(xe.leftChild=new oe.default,xe.leftChild.parent=xe,xe.leftChild.brother=xe.rightChild,xe.rightChild&&(xe.rightChild.brother=xe.leftChild),xe.leftChild):qe>0?xe.rightChild?At(xe.rightChild,Dt):(xe.rightChild=new oe.default,xe.rightChild.parent=xe,xe.rightChild.brother=xe.leftChild,xe.leftChild&&(xe.leftChild.brother=xe.rightChild),xe.rightChild):xe},$e=function(xe){var Dt=xe.parent;if(!Dt){if(xe===Ie)return;throw new Error("unknown error")}if(Dt.color!==oe.default.TreeNodeColorType.black&&Dt.color===oe.default.TreeNodeColorType.red){var qe=Dt.brother,kt=Dt.parent;if(!kt)throw new Error("unknown error");if(qe&&qe.color===oe.default.TreeNodeColorType.red)qe.color=Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red,$e(kt);else if(!qe||qe.color===oe.default.TreeNodeColorType.black){if(Dt===kt.leftChild){if(xe===Dt.leftChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var Et=kt.rotateRight();kt===Ie&&(Ie=Et)}else if(xe===Dt.rightChild){var Et=Dt.rotateLeft();kt===Ie&&(Ie=Et),$e(Dt)}}else if(Dt===kt.rightChild){if(xe===Dt.leftChild){var Et=Dt.rotateRight();kt===Ie&&(Ie=Et),$e(Dt)}else if(xe===Dt.rightChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var Et=kt.rotateLeft();kt===Ie&&(Ie=Et)}}}}};this.setElement=function(xe,Dt){if(xe==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(Dt==null){this.eraseElementByKey(xe);return}if(this.empty()){++le,Ie.key=xe,Ie.value=Dt,Ie.color=oe.default.TreeNodeColorType.black;return}var qe=At(Ie,xe);if(qe.key!==void 0&&ie(qe.key,xe)===0){qe.value=Dt;return}++le,qe.key=xe,qe.value=Dt,$e(qe),Ie.color=oe.default.TreeNodeColorType.black};var Fe=function(xe,Dt){if(!(!xe||xe.key===void 0)){var qe=ie(Dt,xe.key);return qe<0?Fe(xe.leftChild,Dt):qe>0?Fe(xe.rightChild,Dt):xe}};this.find=function(xe){return!!Fe(Ie,xe)},this.getElementByKey=function(xe){var Dt=Fe(Ie,xe);if((Dt==null?void 0:Dt.key)===void 0||(Dt==null?void 0:Dt.value)===void 0)throw new Error("unknown error");return Dt.value},this.union=function(xe){var Dt=this;xe.forEach(function(qe){var kt=qe.key,Et=qe.value;return Dt.setElement(kt,Et)})},this.getHeight=function(){if(this.empty())return 0;var xe=function(Dt){return Dt?Math.max(xe(Dt.leftChild),xe(Dt.rightChild))+1:1};return xe(Ie)};var Ue=function(xe){return k(this,function(Dt){switch(Dt.label){case 0:return!xe||xe.key===void 0||xe.value===void 0?[2]:[5,$(Ue(xe.leftChild))];case 1:return Dt.sent(),[4,{key:xe.key,value:xe.value}];case 2:return Dt.sent(),[5,$(Ue(xe.rightChild))];case 3:return Dt.sent(),[2]}})};this[Symbol.iterator]=function(){return Ue(Ie)},Ce.forEach(function(xe){var Dt=xe.key,qe=xe.value;return ae.setElement(Dt,qe)}),Object.freeze(this)}Object.freeze(re),V.default=re},{"../Base/TreeNode":25}],31:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});function k($,oe){$===void 0&&($=[]),oe=oe||function(le,Ie){return le>Ie?-1:le<Ie?1:0};var re=[];$.forEach(function(le){return re.push(le)});var Ce=re.length,ie=function(le,Ie){if(le<0||le>=Ce)throw new Error("unknown error");if(Ie<0||Ie>=Ce)throw new Error("unknown error");var ue=re[le];re[le]=re[Ie],re[Ie]=ue},ae=function(le){if(le<0||le>=Ce)throw new Error("unknown error");var Ie=le*2+1,ue=le*2+2;Ie<Ce&&oe(re[le],re[Ie])>0&&ie(le,Ie),ue<Ce&&oe(re[le],re[ue])>0&&ie(le,ue)};(function(){for(var le=Math.floor((Ce-1)/2);le>=0;--le)for(var Ie=le,ue=Ie*2+1;ue<Ce;){var de=ue,Ne=de+1,he=de;if(Ne<Ce&&oe(re[de],re[Ne])>0&&(he=Ne),oe(re[Ie],re[he])<=0)break;ie(Ie,he),Ie=he,ue=Ie*2+1}})(),this.size=function(){return Ce},this.empty=function(){return Ce===0},this.clear=function(){Ce=0,re.length=0},this.push=function(le){if(re.push(le),++Ce,Ce!==1)for(var Ie=Ce-1;Ie>0;){var ue=Math.floor((Ie-1)/2);if(oe(re[ue],le)<=0)break;ae(ue),Ie=ue}},this.pop=function(){if(!this.empty()){if(this.size()===1){--Ce;return}var le=re[Ce-1];--Ce;for(var Ie=0;Ie<this.size();){var ue=Ie*2+1,de=Ie*2+2;if(ue>=this.size())break;var Ne=ue;if(de<this.size()&&oe(re[ue],re[de])>0&&(Ne=de),oe(re[Ne],le)>=0)break;re[Ie]=re[Ne],Ie=Ne}re[Ie]=le}},this.top=function(){return re[0]},Object.freeze(this)}Object.freeze(k),V.default=k},{}],32:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});var k=r("../LinkList/LinkList");function $(oe){oe===void 0&&(oe=[]);var re=new k.default(oe);this.size=function(){return re.size()},this.empty=function(){return re.empty()},this.clear=function(){re.clear()},this.push=function(Ce){re.pushBack(Ce)},this.pop=function(){re.popFront()},this.front=function(){return re.front()},Object.freeze(this)}Object.freeze($),V.default=$},{"../LinkList/LinkList":29}],33:[function(r,g,V){var k=this&&this.__generator||function(Ce,ie){var ae={label:0,sent:function(){if(ue[0]&1)throw ue[1];return ue[1]},trys:[],ops:[]},le,Ie,ue,de;return de={next:Ne(0),throw:Ne(1),return:Ne(2)},typeof Symbol=="function"&&(de[Symbol.iterator]=function(){return this}),de;function Ne(ze){return function(pe){return he([ze,pe])}}function he(ze){if(le)throw new TypeError("Generator is already executing.");for(;ae;)try{if(le=1,Ie&&(ue=ze[0]&2?Ie.return:ze[0]?Ie.throw||((ue=Ie.return)&&ue.call(Ie),0):Ie.next)&&!(ue=ue.call(Ie,ze[1])).done)return ue;switch(Ie=0,ue&&(ze=[ze[0]&2,ue.value]),ze[0]){case 0:case 1:ue=ze;break;case 4:return ae.label++,{value:ze[1],done:!1};case 5:ae.label++,Ie=ze[1],ze=[0];continue;case 7:ze=ae.ops.pop(),ae.trys.pop();continue;default:if(ue=ae.trys,!(ue=ue.length>0&&ue[ue.length-1])&&(ze[0]===6||ze[0]===2)){ae=0;continue}if(ze[0]===3&&(!ue||ze[1]>ue[0]&&ze[1]<ue[3])){ae.label=ze[1];break}if(ze[0]===6&&ae.label<ue[1]){ae.label=ue[1],ue=ze;break}if(ue&&ae.label<ue[2]){ae.label=ue[2],ae.ops.push(ze);break}ue[2]&&ae.ops.pop(),ae.trys.pop();continue}ze=ie.call(Ce,ae)}catch(pe){ze=[6,pe],Ie=0}finally{le=ue=0}if(ze[0]&5)throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}},$=this&&this.__values||function(Ce){var ie=typeof Symbol=="function"&&Symbol.iterator,ae=ie&&Ce[ie],le=0;if(ae)return ae.call(Ce);if(Ce&&typeof Ce.length=="number")return{next:function(){return Ce&&le>=Ce.length&&(Ce=void 0),{value:Ce&&Ce[le++],done:!Ce}}};throw new TypeError(ie?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});var oe=r("../Base/TreeNode");function re(Ce,ie){var ae=this;Ce===void 0&&(Ce=[]),ie=ie||function(xe,Dt){return xe<Dt?-1:xe>Dt?1:0};var le=0,Ie=new oe.default;Ie.color=oe.default.TreeNodeColorType.black,this.size=function(){return le},this.empty=function(){return le===0},this.clear=function(){le=0,Ie.key=void 0,Ie.leftChild=Ie.rightChild=Ie.brother=Ie.parent=void 0,Ie.color=oe.default.TreeNodeColorType.black};var ue=function(xe){if(!xe||xe.key===void 0)throw new Error("unknown error");return xe.leftChild?ue(xe.leftChild):xe},de=function(xe){if(!xe||xe.key===void 0)throw new Error("unknown error");return xe.rightChild?de(xe.rightChild):xe};this.front=function(){if(!this.empty()){var xe=ue(Ie);return xe.key}},this.back=function(){if(!this.empty()){var xe=de(Ie);return xe.key}},this.forEach=function(xe){var Dt,qe,kt=0;try{for(var Et=$(this),jt=Et.next();!jt.done;jt=Et.next()){var ti=jt.value;xe(ti,kt++)}}catch(Lt){Dt={error:Lt}}finally{try{jt&&!jt.done&&(qe=Et.return)&&qe.call(Et)}finally{if(Dt)throw Dt.error}}},this.getElementByPos=function(xe){var Dt,qe;if(xe<0||xe>=this.size())throw new Error("pos must more than 0 and less than set's size");var kt=0;try{for(var Et=$(this),jt=Et.next();!jt.done;jt=Et.next()){var ti=jt.value;if(kt===xe)return ti;++kt}}catch(Lt){Dt={error:Lt}}finally{try{jt&&!jt.done&&(qe=Et.return)&&qe.call(Et)}finally{if(Dt)throw Dt.error}}throw new Error("unknown error")};var Ne=function(xe){var Dt=xe.parent;if(!Dt){if(xe===Ie)return;throw new Error("unknown error")}if(xe.color===oe.default.TreeNodeColorType.red){xe.color=oe.default.TreeNodeColorType.black;return}var qe=xe.brother;if(!qe)throw new Error("unknown error");if(xe===Dt.leftChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),Ne(xe)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),xe.color=oe.default.TreeNodeColorType.black}else if((!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateRight();Ie===qe&&(Ie=kt),Ne(xe)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,Ne(Dt))}else if(xe===Dt.rightChild){if(qe.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.black,Dt.color=oe.default.TreeNodeColorType.red;var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),Ne(xe)}else if(qe.color===oe.default.TreeNodeColorType.black)if(qe.leftChild&&qe.leftChild.color===oe.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=oe.default.TreeNodeColorType.black,qe.leftChild&&(qe.leftChild.color=oe.default.TreeNodeColorType.black);var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),xe.color=oe.default.TreeNodeColorType.black}else if((!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&qe.rightChild&&qe.rightChild.color===oe.default.TreeNodeColorType.red){qe.color=oe.default.TreeNodeColorType.red,qe.rightChild&&(qe.rightChild.color=oe.default.TreeNodeColorType.black);var kt=qe.rotateLeft();Ie===qe&&(Ie=kt),Ne(xe)}else(!qe.leftChild||qe.leftChild.color===oe.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===oe.default.TreeNodeColorType.black)&&(qe.color=oe.default.TreeNodeColorType.red,Ne(Dt))}},he=function(xe){for(var Dt=xe;Dt.leftChild||Dt.rightChild;){if(Dt.rightChild){Dt=ue(Dt.rightChild);var qe=xe.key;xe.key=Dt.key,Dt.key=qe,xe=Dt}if(Dt.leftChild){Dt=de(Dt.leftChild);var qe=xe.key;xe.key=Dt.key,Dt.key=qe,xe=Dt}}Ne(Dt),Dt&&Dt.remove(),--le,Ie.color=oe.default.TreeNodeColorType.black},ze=function(xe,Dt){if(!xe||xe.key===void 0)return!1;var qe=ze(xe.leftChild,Dt);return qe||Dt(xe)?!0:ze(xe.rightChild,Dt)};this.eraseElementByPos=function(xe){if(xe<0||xe>=le)throw new Error("pos must more than 0 and less than set's size");var Dt=0;ze(Ie,function(qe){return xe===Dt?(he(qe),!0):(++Dt,!1)})},this.eraseElementByValue=function(xe){if(!this.empty()){var Dt=Oe(Ie,xe);Dt===void 0||Dt.key===void 0||ie(Dt.key,xe)!==0||he(Dt)}};var pe=function(xe,Dt){if(!xe||xe.key===void 0)throw new Error("unknown error");var qe=ie(Dt,xe.key);return qe<0?xe.leftChild?pe(xe.leftChild,Dt):(xe.leftChild=new oe.default,xe.leftChild.parent=xe,xe.leftChild.brother=xe.rightChild,xe.rightChild&&(xe.rightChild.brother=xe.leftChild),xe.leftChild):qe>0?xe.rightChild?pe(xe.rightChild,Dt):(xe.rightChild=new oe.default,xe.rightChild.parent=xe,xe.rightChild.brother=xe.leftChild,xe.leftChild&&(xe.leftChild.brother=xe.rightChild),xe.rightChild):xe},Ve=function(xe){var Dt=xe.parent;if(!Dt){if(xe===Ie)return;throw new Error("unknown error")}if(Dt.color!==oe.default.TreeNodeColorType.black&&Dt.color===oe.default.TreeNodeColorType.red){var qe=Dt.brother,kt=Dt.parent;if(!kt)throw new Error("unknown error");if(qe&&qe.color===oe.default.TreeNodeColorType.red)qe.color=Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red,Ve(kt);else if(!qe||qe.color===oe.default.TreeNodeColorType.black){if(Dt===kt.leftChild){if(xe===Dt.leftChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var Et=kt.rotateRight();kt===Ie&&(Ie=Et)}else if(xe===Dt.rightChild){var Et=Dt.rotateLeft();kt===Ie&&(Ie=Et),Ve(Dt)}}else if(Dt===kt.rightChild){if(xe===Dt.leftChild){var Et=Dt.rotateRight();kt===Ie&&(Ie=Et),Ve(Dt)}else if(xe===Dt.rightChild){Dt.color=oe.default.TreeNodeColorType.black,kt.color=oe.default.TreeNodeColorType.red;var Et=kt.rotateLeft();kt===Ie&&(Ie=Et)}}}}};this.insert=function(xe){if(xe==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty()){++le,Ie.key=xe,Ie.color=oe.default.TreeNodeColorType.black;return}var Dt=pe(Ie,xe);Dt.key!==void 0&&ie(Dt.key,xe)===0||(++le,Dt.key=xe,Ve(Dt),Ie.color=oe.default.TreeNodeColorType.black)};var Oe=function(xe,Dt){if(!(!xe||xe.key===void 0)){var qe=ie(Dt,xe.key);return qe<0?Oe(xe.leftChild,Dt):qe>0?Oe(xe.rightChild,Dt):xe}};this.find=function(xe){var Dt=Oe(Ie,xe);return Dt!==void 0&&Dt.key!==void 0&&ie(Dt.key,xe)===0};var _e=function(xe,Dt){if(!(!xe||xe.key===void 0)){var qe=ie(xe.key,Dt);if(qe===0)return xe.key;if(qe<0)return _e(xe.rightChild,Dt);var kt=_e(xe.leftChild,Dt);return kt!==void 0?kt:xe.key}};this.lowerBound=function(xe){return _e(Ie,xe)};var At=function(xe,Dt){if(!(!xe||xe.key===void 0)){var qe=ie(xe.key,Dt);if(qe<=0)return At(xe.rightChild,Dt);var kt=At(xe.leftChild,Dt);return kt!==void 0?kt:xe.key}};this.upperBound=function(xe){return At(Ie,xe)};var $e=function(xe,Dt){if(!(!xe||xe.key===void 0)){var qe=ie(xe.key,Dt);if(qe===0)return xe.key;if(qe>0)return $e(xe.leftChild,Dt);var kt=$e(xe.rightChild,Dt);return kt!==void 0?kt:xe.key}};this.reverseLowerBound=function(xe){return $e(Ie,xe)};var Fe=function(xe,Dt){if(!(!xe||xe.key===void 0)){var qe=ie(xe.key,Dt);if(qe>=0)return Fe(xe.leftChild,Dt);var kt=Fe(xe.rightChild,Dt);return kt!==void 0?kt:xe.key}};this.reverseUpperBound=function(xe){return Fe(Ie,xe)},this.union=function(xe){var Dt=this;xe.forEach(function(qe){return Dt.insert(qe)})},this.getHeight=function(){if(this.empty())return 0;var xe=function(Dt){return Dt?Math.max(xe(Dt.leftChild),xe(Dt.rightChild))+1:1};return xe(Ie)};var Ue=function(xe){return k(this,function(Dt){switch(Dt.label){case 0:return!xe||xe.key===void 0?[2]:[5,$(Ue(xe.leftChild))];case 1:return Dt.sent(),[4,xe.key];case 2:return Dt.sent(),[5,$(Ue(xe.rightChild))];case 3:return Dt.sent(),[2]}})};this[Symbol.iterator]=function(){return Ue(Ie)},Ce.forEach(function(xe){return ae.insert(xe)}),Object.freeze(this)}Object.freeze(re),V.default=re},{"../Base/TreeNode":25}],34:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});function k($){var oe=this;$===void 0&&($=[]);var re=0,Ce=[];this.size=function(){return re},this.empty=function(){return re===0},this.clear=function(){re=0,Ce.length=0},this.push=function(ie){Ce.push(ie),++re},this.pop=function(){Ce.pop(),re>0&&--re},this.top=function(){return Ce[re-1]},$.forEach(function(ie){return oe.push(ie)}),Object.freeze(this)}Object.freeze(k),V.default=k},{}],35:[function(r,g,V){var k=this&&this.__generator||function(ie,ae){var le={label:0,sent:function(){if(de[0]&1)throw de[1];return de[1]},trys:[],ops:[]},Ie,ue,de,Ne;return Ne={next:he(0),throw:he(1),return:he(2)},typeof Symbol=="function"&&(Ne[Symbol.iterator]=function(){return this}),Ne;function he(pe){return function(Ve){return ze([pe,Ve])}}function ze(pe){if(Ie)throw new TypeError("Generator is already executing.");for(;le;)try{if(Ie=1,ue&&(de=pe[0]&2?ue.return:pe[0]?ue.throw||((de=ue.return)&&de.call(ue),0):ue.next)&&!(de=de.call(ue,pe[1])).done)return de;switch(ue=0,de&&(pe=[pe[0]&2,de.value]),pe[0]){case 0:case 1:de=pe;break;case 4:return le.label++,{value:pe[1],done:!1};case 5:le.label++,ue=pe[1],pe=[0];continue;case 7:pe=le.ops.pop(),le.trys.pop();continue;default:if(de=le.trys,!(de=de.length>0&&de[de.length-1])&&(pe[0]===6||pe[0]===2)){le=0;continue}if(pe[0]===3&&(!de||pe[1]>de[0]&&pe[1]<de[3])){le.label=pe[1];break}if(pe[0]===6&&le.label<de[1]){le.label=de[1],de=pe;break}if(de&&le.label<de[2]){le.label=de[2],le.ops.push(pe);break}de[2]&&le.ops.pop(),le.trys.pop();continue}pe=ae.call(ie,le)}catch(Ve){pe=[6,Ve],ue=0}finally{Ie=de=0}if(pe[0]&5)throw pe[1];return{value:pe[0]?pe[1]:void 0,done:!0}}},$=this&&this.__read||function(ie,ae){var le=typeof Symbol=="function"&&ie[Symbol.iterator];if(!le)return ie;var Ie=le.call(ie),ue,de=[],Ne;try{for(;(ae===void 0||ae-- >0)&&!(ue=Ie.next()).done;)de.push(ue.value)}catch(he){Ne={error:he}}finally{try{ue&&!ue.done&&(le=Ie.return)&&le.call(Ie)}finally{if(Ne)throw Ne.error}}return de},oe=this&&this.__spreadArray||function(ie,ae,le){if(le||arguments.length===2)for(var Ie=0,ue=ae.length,de;Ie<ue;Ie++)(de||!(Ie in ae))&&(de||(de=Array.prototype.slice.call(ae,0,Ie)),de[Ie]=ae[Ie]);return ie.concat(de||Array.prototype.slice.call(ae))},re=this&&this.__values||function(ie){var ae=typeof Symbol=="function"&&Symbol.iterator,le=ae&&ie[ae],Ie=0;if(le)return le.call(ie);if(ie&&typeof ie.length=="number")return{next:function(){return ie&&Ie>=ie.length&&(ie=void 0),{value:ie&&ie[Ie++],done:!ie}}};throw new TypeError(ae?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(V,"__esModule",{value:!0});function Ce(ie){var ae=this;ie===void 0&&(ie=[]);var le=0,Ie=[];this.size=function(){return le},this.empty=function(){return le===0},this.clear=function(){le=0,Ie.length=0},this.front=function(){if(!this.empty())return Ie[0]},this.back=function(){if(!this.empty())return Ie[le-1]},this.forEach=function(ue){Ie.forEach(ue)},this.getElementByPos=function(ue){if(ue<0||ue>=le)throw new Error("pos must more than 0 and less than vector's size");return Ie[ue]},this.eraseElementByPos=function(ue){if(ue<0||ue>=le)throw new Error("pos must more than 0 and less than vector's size");for(var de=ue;de<le-1;++de)Ie[de]=Ie[de+1];this.popBack()},this.eraseElementByValue=function(ue){var de=[];this.forEach(function(he){he!==ue&&de.push(he)}),de.forEach(function(he,ze){Ie[ze]=he});for(var Ne=de.length;le>Ne;)this.popBack()},this.pushBack=function(ue){Ie.push(ue),++le},this.popBack=function(){Ie.pop(),le>0&&--le},this.setElementByPos=function(ue,de){if(ue<0||ue>=le)throw new Error("pos must more than 0 and less than vector's size");Ie[ue]=de},this.insert=function(ue,de,Ne){if(Ne===void 0&&(Ne=1),ue<0||ue>le)throw new Error("pos must more than 0 and less than or equal to vector's size");Ie.splice.apply(Ie,oe([ue,0],$(new Array(Ne).fill(de)),!1)),le+=Ne},this.find=function(ue){return Ie.includes(ue)},this.reverse=function(){Ie.reverse()},this.unique=function(){var ue,de=[];this.forEach(function(he,ze){(ze===0||he!==ue)&&(de.push(he),ue=he)}),de.forEach(function(he,ze){Ie[ze]=he});for(var Ne=de.length;le>Ne;)this.popBack()},this.sort=function(ue){Ie.sort(ue)},this[Symbol.iterator]=function(){return function(){return k(this,function(ue){switch(ue.label){case 0:return[5,re(Ie)];case 1:return[2,ue.sent()]}})}()},ie.forEach(function(ue){return ae.pushBack(ue)}),Object.freeze(this)}Object.freeze(Ce),V.default=Ce},{}],36:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0}),V.HashMap=V.HashSet=V.Map=V.Set=V.PriorityQueue=V.Deque=V.LinkList=V.Queue=V.Stack=V.Vector=void 0;var k=r("./Vector/Vector");V.Vector=k.default;var $=r("./Stack/Stack");V.Stack=$.default;var oe=r("./Queue/Queue");V.Queue=oe.default;var re=r("./LinkList/LinkList");V.LinkList=re.default;var Ce=r("./Deque/Deque");V.Deque=Ce.default;var ie=r("./PriorityQueue/PriorityQueue");V.PriorityQueue=ie.default;var ae=r("./Set/Set");V.Set=ae.default;var le=r("./Map/Map");V.Map=le.default;var Ie=r("./HashSet/HashSet");V.HashSet=Ie.default;var ue=r("./HashMap/HashMap");V.HashMap=ue.default},{"./Deque/Deque":26,"./HashMap/HashMap":27,"./HashSet/HashSet":28,"./LinkList/LinkList":29,"./Map/Map":30,"./PriorityQueue/PriorityQueue":31,"./Queue/Queue":32,"./Set/Set":33,"./Stack/Stack":34,"./Vector/Vector":35}],37:[function(r,g,V){const k=r("yallist"),$=Symbol("max"),oe=Symbol("length"),re=Symbol("lengthCalculator"),Ce=Symbol("allowStale"),ie=Symbol("maxAge"),ae=Symbol("dispose"),le=Symbol("noDisposeOnSet"),Ie=Symbol("lruList"),ue=Symbol("cache"),de=Symbol("updateAgeOnGet"),Ne=()=>1;class he{constructor(Fe){if(typeof Fe=="number"&&(Fe={max:Fe}),Fe||(Fe={}),Fe.max&&(typeof Fe.max!="number"||Fe.max<0))throw new TypeError("max must be a non-negative number");this[$]=Fe.max||1/0;const Ue=Fe.length||Ne;if(this[re]=typeof Ue!="function"?Ne:Ue,this[Ce]=Fe.stale||!1,Fe.maxAge&&typeof Fe.maxAge!="number")throw new TypeError("maxAge must be a number");this[ie]=Fe.maxAge||0,this[ae]=Fe.dispose,this[le]=Fe.noDisposeOnSet||!1,this[de]=Fe.updateAgeOnGet||!1,this.reset()}set max(Fe){if(typeof Fe!="number"||Fe<0)throw new TypeError("max must be a non-negative number");this[$]=Fe||1/0,Ve(this)}get max(){return this[$]}set allowStale(Fe){this[Ce]=!!Fe}get allowStale(){return this[Ce]}set maxAge(Fe){if(typeof Fe!="number")throw new TypeError("maxAge must be a non-negative number");this[ie]=Fe,Ve(this)}get maxAge(){return this[ie]}set lengthCalculator(Fe){typeof Fe!="function"&&(Fe=Ne),Fe!==this[re]&&(this[re]=Fe,this[oe]=0,this[Ie].forEach(Ue=>{Ue.length=this[re](Ue.value,Ue.key),this[oe]+=Ue.length})),Ve(this)}get lengthCalculator(){return this[re]}get length(){return this[oe]}get itemCount(){return this[Ie].length}rforEach(Fe,Ue){Ue=Ue||this;for(let xe=this[Ie].tail;xe!==null;){const Dt=xe.prev;At(this,Fe,xe,Ue),xe=Dt}}forEach(Fe,Ue){Ue=Ue||this;for(let xe=this[Ie].head;xe!==null;){const Dt=xe.next;At(this,Fe,xe,Ue),xe=Dt}}keys(){return this[Ie].toArray().map(Fe=>Fe.key)}values(){return this[Ie].toArray().map(Fe=>Fe.value)}reset(){this[ae]&&this[Ie]&&this[Ie].length&&this[Ie].forEach(Fe=>this[ae](Fe.key,Fe.value)),this[ue]=new Map,this[Ie]=new k,this[oe]=0}dump(){return this[Ie].map(Fe=>pe(this,Fe)?!1:{k:Fe.key,v:Fe.value,e:Fe.now+(Fe.maxAge||0)}).toArray().filter(Fe=>Fe)}dumpLru(){return this[Ie]}set(Fe,Ue,xe){if(xe=xe||this[ie],xe&&typeof xe!="number")throw new TypeError("maxAge must be a number");const Dt=xe?Date.now():0,qe=this[re](Ue,Fe);if(this[ue].has(Fe)){if(qe>this[$])return Oe(this,this[ue].get(Fe)),!1;const jt=this[ue].get(Fe).value;return this[ae]&&(this[le]||this[ae](Fe,jt.value)),jt.now=Dt,jt.maxAge=xe,jt.value=Ue,this[oe]+=qe-jt.length,jt.length=qe,this.get(Fe),Ve(this),!0}const kt=new _e(Fe,Ue,qe,Dt,xe);return kt.length>this[$]?(this[ae]&&this[ae](Fe,Ue),!1):(this[oe]+=kt.length,this[Ie].unshift(kt),this[ue].set(Fe,this[Ie].head),Ve(this),!0)}has(Fe){if(!this[ue].has(Fe))return!1;const Ue=this[ue].get(Fe).value;return!pe(this,Ue)}get(Fe){return ze(this,Fe,!0)}peek(Fe){return ze(this,Fe,!1)}pop(){const Fe=this[Ie].tail;return Fe?(Oe(this,Fe),Fe.value):null}del(Fe){Oe(this,this[ue].get(Fe))}load(Fe){this.reset();const Ue=Date.now();for(let xe=Fe.length-1;xe>=0;xe--){const Dt=Fe[xe],qe=Dt.e||0;if(qe===0)this.set(Dt.k,Dt.v);else{const kt=qe-Ue;kt>0&&this.set(Dt.k,Dt.v,kt)}}}prune(){this[ue].forEach((Fe,Ue)=>ze(this,Ue,!1))}}const ze=($e,Fe,Ue)=>{const xe=$e[ue].get(Fe);if(xe){const Dt=xe.value;if(pe($e,Dt)){if(Oe($e,xe),!$e[Ce])return}else Ue&&($e[de]&&(xe.value.now=Date.now()),$e[Ie].unshiftNode(xe));return Dt.value}},pe=($e,Fe)=>{if(!Fe||!Fe.maxAge&&!$e[ie])return!1;const Ue=Date.now()-Fe.now;return Fe.maxAge?Ue>Fe.maxAge:$e[ie]&&Ue>$e[ie]},Ve=$e=>{if($e[oe]>$e[$])for(let Fe=$e[Ie].tail;$e[oe]>$e[$]&&Fe!==null;){const Ue=Fe.prev;Oe($e,Fe),Fe=Ue}},Oe=($e,Fe)=>{if(Fe){const Ue=Fe.value;$e[ae]&&$e[ae](Ue.key,Ue.value),$e[oe]-=Ue.length,$e[ue].delete(Ue.key),$e[Ie].removeNode(Fe)}};class _e{constructor(Fe,Ue,xe,Dt,qe){this.key=Fe,this.value=Ue,this.length=xe,this.now=Dt,this.maxAge=qe||0}}const At=($e,Fe,Ue,xe)=>{let Dt=Ue.value;pe($e,Dt)&&(Oe($e,Ue),$e[Ce]||(Dt=void 0)),Dt&&Fe.call(xe,Dt.value,Dt.key,$e)};g.exports=he},{yallist:83}],38:[function(r,g,V){(function(k){(function(){const $=g.exports;$.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},$.codes={};for(const re in $.types){const Ce=$.types[re];$.codes[Ce]=re}$.CMD_SHIFT=4,$.CMD_MASK=240,$.DUP_MASK=8,$.QOS_MASK=3,$.QOS_SHIFT=1,$.RETAIN_MASK=1,$.VARBYTEINT_MASK=127,$.VARBYTEINT_FIN_MASK=128,$.VARBYTEINT_MAX=268435455,$.SESSIONPRESENT_MASK=1,$.SESSIONPRESENT_HEADER=k.from([$.SESSIONPRESENT_MASK]),$.CONNACK_HEADER=k.from([$.codes.connack<<$.CMD_SHIFT]),$.USERNAME_MASK=128,$.PASSWORD_MASK=64,$.WILL_RETAIN_MASK=32,$.WILL_QOS_MASK=24,$.WILL_QOS_SHIFT=3,$.WILL_FLAG_MASK=4,$.CLEAN_SESSION_MASK=2,$.CONNECT_HEADER=k.from([$.codes.connect<<$.CMD_SHIFT]),$.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},$.propertiesCodes={};for(const re in $.properties){const Ce=$.properties[re];$.propertiesCodes[Ce]=re}$.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"};function oe(re){return[0,1,2].map(Ce=>[0,1].map(ie=>[0,1].map(ae=>{const le=k.alloc(1);return le.writeUInt8($.codes[re]<<$.CMD_SHIFT|(ie?$.DUP_MASK:0)|Ce<<$.QOS_SHIFT|ae,0,!0),le})))}$.PUBLISH_HEADER=oe("publish"),$.SUBSCRIBE_HEADER=oe("subscribe"),$.SUBSCRIBE_OPTIONS_QOS_MASK=3,$.SUBSCRIBE_OPTIONS_NL_MASK=1,$.SUBSCRIBE_OPTIONS_NL_SHIFT=2,$.SUBSCRIBE_OPTIONS_RAP_MASK=1,$.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,$.SUBSCRIBE_OPTIONS_RH_MASK=3,$.SUBSCRIBE_OPTIONS_RH_SHIFT=4,$.SUBSCRIBE_OPTIONS_RH=[0,16,32],$.SUBSCRIBE_OPTIONS_NL=4,$.SUBSCRIBE_OPTIONS_RAP=8,$.SUBSCRIBE_OPTIONS_QOS=[0,1,2],$.UNSUBSCRIBE_HEADER=oe("unsubscribe"),$.ACKS={unsuback:oe("unsuback"),puback:oe("puback"),pubcomp:oe("pubcomp"),pubrel:oe("pubrel"),pubrec:oe("pubrec")},$.SUBACK_HEADER=k.from([$.codes.suback<<$.CMD_SHIFT]),$.VERSION3=k.from([3]),$.VERSION4=k.from([4]),$.VERSION5=k.from([5]),$.VERSION131=k.from([131]),$.VERSION132=k.from([132]),$.QOS=[0,1,2].map(re=>k.from([re])),$.EMPTY={pingreq:k.from([$.codes.pingreq<<4,0]),pingresp:k.from([$.codes.pingresp<<4,0]),disconnect:k.from([$.codes.disconnect<<4,0])}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],39:[function(r,g,V){(function(k){(function(){const $=r("./writeToStream"),oe=r("events");function re(ie,ae){const le=new Ce;return $(ie,le,ae),le.concat()}class Ce extends oe{constructor(){super(),this._array=new Array(20),this._i=0}write(ae){return this._array[this._i++]=ae,!0}concat(){let ae=0;const le=new Array(this._array.length),Ie=this._array;let ue=0,de;for(de=0;de<Ie.length&&Ie[de]!==void 0;de++)typeof Ie[de]!="string"?le[de]=Ie[de].length:le[de]=k.byteLength(Ie[de]),ae+=le[de];const Ne=k.allocUnsafe(ae);for(de=0;de<Ie.length&&Ie[de]!==void 0;de++)typeof Ie[de]!="string"?(Ie[de].copy(Ne,ue),ue+=le[de]):(Ne.write(Ie[de],ue),ue+=le[de]);return Ne}}g.exports=re}).call(this)}).call(this,r("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(r,g,V){V.parser=r("./parser").parser,V.generate=r("./generate"),V.writeToStream=r("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(r,g,V){(function(k){(function(){const oe={},re=k.isBuffer(k.from([1,2]).subarray(0,1));function Ce(Ie){const ue=k.allocUnsafe(2);return ue.writeUInt8(Ie>>8,0),ue.writeUInt8(Ie&255,0+1),ue}function ie(){for(let Ie=0;Ie<65536;Ie++)oe[Ie]=Ce(Ie)}function ae(Ie){let de=0,Ne=0;const he=k.allocUnsafe(4);do de=Ie%128|0,Ie=Ie/128|0,Ie>0&&(de=de|128),he.writeUInt8(de,Ne++);while(Ie>0&&Ne<4);return Ie>0&&(Ne=0),re?he.subarray(0,Ne):he.slice(0,Ne)}function le(Ie){const ue=k.allocUnsafe(4);return ue.writeUInt32BE(Ie,0),ue}g.exports={cache:oe,generateCache:ie,generateNumber:Ce,genBufVariableByteInt:ae,generate4ByteBuffer:le}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],42:[function(r,g,V){class k{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}g.exports=k},{}],43:[function(r,g,V){const k=r("bl"),$=r("events"),oe=r("./packet"),re=r("./constants"),Ce=r("debug")("mqtt-packet:parser");class ie extends ${constructor(){super(),this.parser=this.constructor.parser}static parser(le){return this instanceof ie?(this.settings=le||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new ie().parser(le)}_resetState(){Ce("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new oe,this.error=null,this._list=k(),this._stateCounter=0}parse(le){for(this.error&&this._resetState(),this._list.append(le),Ce("parse: current state: %s",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,Ce("parse: state complete. _stateCounter is now: %d",this._stateCounter),Ce("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return Ce("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const le=this._list.readUInt8(0);return this.packet.cmd=re.types[le>>re.CMD_SHIFT],this.packet.retain=(le&re.RETAIN_MASK)!==0,this.packet.qos=le>>re.QOS_SHIFT&re.QOS_MASK,this.packet.dup=(le&re.DUP_MASK)!==0,Ce("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const le=this._parseVarByteNum(!0);return le&&(this.packet.length=le.value,this._list.consume(le.bytes)),Ce("_parseLength %d",le.value),!!le}_parsePayload(){Ce("_parsePayload: payload %O",this._list);let le=!1;if(this.packet.length===0||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}le=!0}return Ce("_parsePayload complete result: %s",le),le}_parseConnect(){Ce("_parseConnect");let le,Ie,ue,de;const Ne={},he=this.packet,ze=this._parseString();if(ze===null)return this._emitError(new Error("Cannot parse protocolId"));if(ze!=="MQTT"&&ze!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(he.protocolId=ze,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(he.protocolVersion=this._list.readUInt8(this._pos),he.protocolVersion>=128&&(he.bridgeMode=!0,he.protocolVersion=he.protocolVersion-128),he.protocolVersion!==3&&he.protocolVersion!==4&&he.protocolVersion!==5)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(Ne.username=this._list.readUInt8(this._pos)&re.USERNAME_MASK,Ne.password=this._list.readUInt8(this._pos)&re.PASSWORD_MASK,Ne.will=this._list.readUInt8(this._pos)&re.WILL_FLAG_MASK,Ne.will&&(he.will={},he.will.retain=(this._list.readUInt8(this._pos)&re.WILL_RETAIN_MASK)!==0,he.will.qos=(this._list.readUInt8(this._pos)&re.WILL_QOS_MASK)>>re.WILL_QOS_SHIFT),he.clean=(this._list.readUInt8(this._pos)&re.CLEAN_SESSION_MASK)!==0,this._pos++,he.keepalive=this._parseNum(),he.keepalive===-1)return this._emitError(new Error("Packet too short"));if(he.protocolVersion===5){const Ve=this._parseProperties();Object.getOwnPropertyNames(Ve).length&&(he.properties=Ve)}const pe=this._parseString();if(pe===null)return this._emitError(new Error("Packet too short"));if(he.clientId=pe,Ce("_parseConnect: packet.clientId: %s",he.clientId),Ne.will){if(he.protocolVersion===5){const Ve=this._parseProperties();Object.getOwnPropertyNames(Ve).length&&(he.will.properties=Ve)}if(le=this._parseString(),le===null)return this._emitError(new Error("Cannot parse will topic"));if(he.will.topic=le,Ce("_parseConnect: packet.will.topic: %s",he.will.topic),Ie=this._parseBuffer(),Ie===null)return this._emitError(new Error("Cannot parse will payload"));he.will.payload=Ie,Ce("_parseConnect: packet.will.paylaod: %s",he.will.payload)}if(Ne.username){if(de=this._parseString(),de===null)return this._emitError(new Error("Cannot parse username"));he.username=de,Ce("_parseConnect: packet.username: %s",he.username)}if(Ne.password){if(ue=this._parseBuffer(),ue===null)return this._emitError(new Error("Cannot parse password"));he.password=ue}return this.settings=he,Ce("_parseConnect: complete"),he}_parseConnack(){Ce("_parseConnack");const le=this.packet;if(this._list.length<1)return null;if(le.sessionPresent=!!(this._list.readUInt8(this._pos++)&re.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?le.reasonCode=this._list.readUInt8(this._pos++):le.reasonCode=0;else{if(this._list.length<2)return null;le.returnCode=this._list.readUInt8(this._pos++)}if(le.returnCode===-1||le.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}Ce("_parseConnack: complete")}_parsePublish(){Ce("_parsePublish");const le=this.packet;if(le.topic=this._parseString(),le.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(le.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}le.payload=this._list.slice(this._pos,le.length),Ce("_parsePublish: payload from buffer list: %o",le.payload)}}_parseSubscribe(){Ce("_parseSubscribe");const le=this.packet;let Ie,ue,de,Ne,he,ze,pe;if(le.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(le.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const Ve=this._parseProperties();Object.getOwnPropertyNames(Ve).length&&(le.properties=Ve)}for(;this._pos<le.length;){if(Ie=this._parseString(),Ie===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=le.length)return this._emitError(new Error("Malformed Subscribe Payload"));ue=this._parseByte(),de=ue&re.SUBSCRIBE_OPTIONS_QOS_MASK,ze=(ue>>re.SUBSCRIBE_OPTIONS_NL_SHIFT&re.SUBSCRIBE_OPTIONS_NL_MASK)!==0,he=(ue>>re.SUBSCRIBE_OPTIONS_RAP_SHIFT&re.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,Ne=ue>>re.SUBSCRIBE_OPTIONS_RH_SHIFT&re.SUBSCRIBE_OPTIONS_RH_MASK,pe={topic:Ie,qos:de},this.settings.protocolVersion===5?(pe.nl=ze,pe.rap=he,pe.rh=Ne):this.settings.bridgeMode&&(pe.rh=0,pe.rap=!0,pe.nl=!0),Ce("_parseSubscribe: push subscription `%s` to subscription",pe),le.subscriptions.push(pe)}}}_parseSuback(){Ce("_parseSuback");const le=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){Ce("_parseUnsubscribe");const le=this.packet;if(le.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}for(;this._pos<le.length;){const Ie=this._parseString();if(Ie===null)return this._emitError(new Error("Cannot parse topic"));Ce("_parseUnsubscribe: push topic `%s` to unsubscriptions",Ie),le.unsubscriptions.push(Ie)}}}_parseUnsuback(){Ce("_parseUnsuback");const le=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(this.settings.protocolVersion===5){const Ie=this._parseProperties();for(Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie),le.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){Ce("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const le=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5&&(le.length>2?(le.reasonCode=this._parseByte(),Ce("_parseConfirmation: packet.reasonCode `%d`",le.reasonCode)):le.reasonCode=0,le.length>3)){const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}return!0}_parseDisconnect(){const le=this.packet;if(Ce("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?le.reasonCode=this._parseByte():le.reasonCode=0;const Ie=this._parseProperties();Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie)}return Ce("_parseDisconnect result: true"),!0}_parseAuth(){Ce("_parseAuth");const le=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));le.reasonCode=this._parseByte();const Ie=this._parseProperties();return Object.getOwnPropertyNames(Ie).length&&(le.properties=Ie),Ce("_parseAuth: result: true"),!0}_parseMessageId(){const le=this.packet;return le.messageId=this._parseNum(),le.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(Ce("_parseMessageId: packet.messageId %d",le.messageId),!0)}_parseString(le){const Ie=this._parseNum(),ue=Ie+this._pos;if(Ie===-1||ue>this._list.length||ue>this.packet.length)return null;const de=this._list.toString("utf8",this._pos,ue);return this._pos+=Ie,Ce("_parseString: result: %s",de),de}_parseStringPair(){return Ce("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const le=this._parseNum(),Ie=le+this._pos;if(le===-1||Ie>this._list.length||Ie>this.packet.length)return null;const ue=this._list.slice(this._pos,Ie);return this._pos+=le,Ce("_parseBuffer: result: %o",ue),ue}_parseNum(){if(this._list.length-this._pos<2)return-1;const le=this._list.readUInt16BE(this._pos);return this._pos+=2,Ce("_parseNum: result: %s",le),le}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const le=this._list.readUInt32BE(this._pos);return this._pos+=4,Ce("_parse4ByteNum: result: %s",le),le}_parseVarByteNum(le){Ce("_parseVarByteNum");const Ie=4;let ue=0,de=1,Ne=0,he=!1,ze;const pe=this._pos?this._pos:0;for(;ue<Ie&&pe+ue<this._list.length;){if(ze=this._list.readUInt8(pe+ue++),Ne+=de*(ze&re.VARBYTEINT_MASK),de*=128,!(ze&re.VARBYTEINT_FIN_MASK)){he=!0;break}if(this._list.length<=ue)break}return!he&&ue===Ie&&this._list.length>=ue&&this._emitError(new Error("Invalid variable byte integer")),pe&&(this._pos+=ue),he=he?le?{bytes:ue,value:Ne}:Ne:!1,Ce("_parseVarByteNum: result: %o",he),he}_parseByte(){let le;return this._pos<this._list.length&&(le=this._list.readUInt8(this._pos),this._pos++),Ce("_parseByte: result: %o",le),le}_parseByType(le){switch(Ce("_parseByType: type: %s",le),le){case"byte":return this._parseByte()!==0;case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){Ce("_parseProperties");const le=this._parseVarByteNum(),ue=this._pos+le,de={};for(;this._pos<ue;){const Ne=this._parseByte();if(!Ne)return this._emitError(new Error("Cannot parse property code type")),!1;const he=re.propertiesCodes[Ne];if(!he)return this._emitError(new Error("Unknown property")),!1;if(he==="userProperties"){de[he]||(de[he]=Object.create(null));const ze=this._parseByType(re.propertiesTypes[he]);if(de[he][ze.name])if(Array.isArray(de[he][ze.name]))de[he][ze.name].push(ze.value);else{const pe=de[he][ze.name];de[he][ze.name]=[pe],de[he][ze.name].push(ze.value)}else de[he][ze.name]=ze.value;continue}de[he]?Array.isArray(de[he])?de[he].push(this._parseByType(re.propertiesTypes[he])):(de[he]=[de[he]],de[he].push(this._parseByType(re.propertiesTypes[he]))):de[he]=this._parseByType(re.propertiesTypes[he])}return de}_newPacket(){return Ce("_newPacket"),this.packet&&(this._list.consume(this.packet.length),Ce("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),Ce("_newPacket: new packet"),this.packet=new oe,this._pos=0,!0}_emitError(le){Ce("_emitError"),this.error=le,this.emit("error",le)}}g.exports=ie},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(r,g,V){(function(k){(function(){const $=r("./constants"),oe=k.allocUnsafe(0),re=k.from([0]),Ce=r("./numbers"),ie=r("process-nextick-args").nextTick,ae=r("debug")("mqtt-packet:writeToStream"),le=Ce.cache,Ie=Ce.generateNumber,ue=Ce.generateCache,de=Ce.genBufVariableByteInt,Ne=Ce.generate4ByteBuffer;let he=ni,ze=!0;function pe(wi,li,fi){switch(ae("generate called"),li.cork&&(li.cork(),ie(Ve,li)),ze&&(ze=!1,ue()),ae("generate: packet.cmd: %s",wi.cmd),wi.cmd){case"connect":return Oe(wi,li);case"connack":return _e(wi,li,fi);case"publish":return At(wi,li,fi);case"puback":case"pubrec":case"pubrel":case"pubcomp":return $e(wi,li,fi);case"subscribe":return Fe(wi,li,fi);case"suback":return Ue(wi,li,fi);case"unsubscribe":return xe(wi,li,fi);case"unsuback":return Dt(wi,li,fi);case"pingreq":case"pingresp":return qe(wi,li);case"disconnect":return kt(wi,li,fi);case"auth":return Et(wi,li,fi);default:return li.emit("error",new Error("Unknown command")),!1}}Object.defineProperty(pe,"cacheNumbers",{get(){return he===ni},set(wi){wi?((!le||Object.keys(le).length===0)&&(ze=!0),he=ni):(ze=!1,he=ri)}});function Ve(wi){wi.uncork()}function Oe(wi,li,fi){const Mi=wi||{},Ni=Mi.protocolId||"MQTT";let pi=Mi.protocolVersion||4;const vi=Mi.will;let bi=Mi.clean;const ai=Mi.keepalive||0,Ii=Mi.clientId||"",oi=Mi.username,ei=Mi.password,ii=Mi.properties;bi===void 0&&(bi=!0);let si=0;if(!Ni||typeof Ni!="string"&&!k.isBuffer(Ni))return li.emit("error",new Error("Invalid protocolId")),!1;if(si+=Ni.length+2,pi!==3&&pi!==4&&pi!==5)return li.emit("error",new Error("Invalid protocol version")),!1;if(si+=1,(typeof Ii=="string"||k.isBuffer(Ii))&&(Ii||pi>=4)&&(Ii||bi))si+=k.byteLength(Ii)+2;else{if(pi<4)return li.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(bi*1===0)return li.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof ai!="number"||ai<0||ai>65535||ai%1!==0)return li.emit("error",new Error("Invalid keepalive")),!1;if(si+=2,si+=1,pi===5){var zi=gi(li,ii);if(!zi)return!1;si+=zi.length}if(vi){if(typeof vi!="object")return li.emit("error",new Error("Invalid will")),!1;if(!vi.topic||typeof vi.topic!="string")return li.emit("error",new Error("Invalid will topic")),!1;if(si+=k.byteLength(vi.topic)+2,si+=2,vi.payload)if(vi.payload.length>=0)typeof vi.payload=="string"?si+=k.byteLength(vi.payload):si+=vi.payload.length;else return li.emit("error",new Error("Invalid will payload")),!1;var mi={};if(pi===5){if(mi=gi(li,vi.properties),!mi)return!1;si+=mi.length}}let Si=!1;if(oi!=null)if(yi(oi))Si=!0,si+=k.byteLength(oi)+2;else return li.emit("error",new Error("Invalid username")),!1;if(ei!=null){if(!Si)return li.emit("error",new Error("Username is required to use password")),!1;if(yi(ei))si+=Ai(ei)+2;else return li.emit("error",new Error("Invalid password")),!1}li.write($.CONNECT_HEADER),ti(li,si),Ci(li,Ni),Mi.bridgeMode&&(pi+=128),li.write(pi===131?$.VERSION131:pi===132?$.VERSION132:pi===4?$.VERSION4:pi===5?$.VERSION5:$.VERSION3);let xi=0;return xi|=oi!=null?$.USERNAME_MASK:0,xi|=ei!=null?$.PASSWORD_MASK:0,xi|=vi&&vi.retain?$.WILL_RETAIN_MASK:0,xi|=vi&&vi.qos?vi.qos<<$.WILL_QOS_SHIFT:0,xi|=vi?$.WILL_FLAG_MASK:0,xi|=bi?$.CLEAN_SESSION_MASK:0,li.write(k.from([xi])),he(li,ai),pi===5&&zi.write(),Ci(li,Ii),vi&&(pi===5&&mi.write(),Lt(li,vi.topic),Ci(li,vi.payload)),oi!=null&&Ci(li,oi),ei!=null&&Ci(li,ei),!0}function _e(wi,li,fi){const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Mi===5?Ni.reasonCode:Ni.returnCode,vi=Ni.properties;let bi=2;if(typeof pi!="number")return li.emit("error",new Error("Invalid return code")),!1;let ai=null;if(Mi===5){if(ai=gi(li,vi),!ai)return!1;bi+=ai.length}return li.write($.CONNACK_HEADER),ti(li,bi),li.write(Ni.sessionPresent?$.SESSIONPRESENT_HEADER:re),li.write(k.from([pi])),ai!=null&&ai.write(),!0}function At(wi,li,fi){ae("publish: packet: %o",wi);const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.qos||0,vi=Ni.retain?$.RETAIN_MASK:0,bi=Ni.topic,ai=Ni.payload||oe,Ii=Ni.messageId,oi=Ni.properties;let ei=0;if(typeof bi=="string")ei+=k.byteLength(bi)+2;else if(k.isBuffer(bi))ei+=bi.length+2;else return li.emit("error",new Error("Invalid topic")),!1;if(k.isBuffer(ai)?ei+=ai.length:ei+=k.byteLength(ai),pi&&typeof Ii!="number")return li.emit("error",new Error("Invalid messageId")),!1;pi&&(ei+=2);let ii=null;if(Mi===5){if(ii=gi(li,oi),!ii)return!1;ei+=ii.length}return li.write($.PUBLISH_HEADER[pi][Ni.dup?1:0][vi?1:0]),ti(li,ei),he(li,Ai(bi)),li.write(bi),pi>0&&he(li,Ii),ii!=null&&ii.write(),ae("publish: payload: %o",ai),li.write(ai)}function $e(wi,li,fi){const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.cmd||"puback",vi=Ni.messageId,bi=Ni.dup&&pi==="pubrel"?$.DUP_MASK:0;let ai=0;const Ii=Ni.reasonCode,oi=Ni.properties;let ei=Mi===5?3:2;if(pi==="pubrel"&&(ai=1),typeof vi!="number")return li.emit("error",new Error("Invalid messageId")),!1;let ii=null;if(Mi===5&&typeof oi=="object"){if(ii=di(li,oi,fi,ei),!ii)return!1;ei+=ii.length}return li.write($.ACKS[pi][ai][bi][0]),ti(li,ei),he(li,vi),Mi===5&&li.write(k.from([Ii])),ii!==null&&ii.write(),!0}function Fe(wi,li,fi){ae("subscribe: packet: ");const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.dup?$.DUP_MASK:0,vi=Ni.messageId,bi=Ni.subscriptions,ai=Ni.properties;let Ii=0;if(typeof vi!="number")return li.emit("error",new Error("Invalid messageId")),!1;Ii+=2;let oi=null;if(Mi===5){if(oi=gi(li,ai),!oi)return!1;Ii+=oi.length}if(typeof bi=="object"&&bi.length)for(let ii=0;ii<bi.length;ii+=1){const si=bi[ii].topic,zi=bi[ii].qos;if(typeof si!="string")return li.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof zi!="number")return li.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(Mi===5){if(typeof(bi[ii].nl||!1)!="boolean")return li.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(bi[ii].rap||!1)!="boolean")return li.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const xi=bi[ii].rh||0;if(typeof xi!="number"||xi>2)return li.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}Ii+=k.byteLength(si)+2+1}else return li.emit("error",new Error("Invalid subscriptions")),!1;ae("subscribe: writing to stream: %o",$.SUBSCRIBE_HEADER),li.write($.SUBSCRIBE_HEADER[1][pi?1:0][0]),ti(li,Ii),he(li,vi),oi!==null&&oi.write();let ei=!0;for(const ii of bi){const si=ii.topic,zi=ii.qos,mi=+ii.nl,Si=+ii.rap,xi=ii.rh;let Gi;Lt(li,si),Gi=$.SUBSCRIBE_OPTIONS_QOS[zi],Mi===5&&(Gi|=mi?$.SUBSCRIBE_OPTIONS_NL:0,Gi|=Si?$.SUBSCRIBE_OPTIONS_RAP:0,Gi|=xi?$.SUBSCRIBE_OPTIONS_RH[xi]:0),ei=li.write(k.from([Gi]))}return ei}function Ue(wi,li,fi){const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.messageId,vi=Ni.granted,bi=Ni.properties;let ai=0;if(typeof pi!="number")return li.emit("error",new Error("Invalid messageId")),!1;if(ai+=2,typeof vi=="object"&&vi.length)for(let oi=0;oi<vi.length;oi+=1){if(typeof vi[oi]!="number")return li.emit("error",new Error("Invalid qos vector")),!1;ai+=1}else return li.emit("error",new Error("Invalid qos vector")),!1;let Ii=null;if(Mi===5){if(Ii=di(li,bi,fi,ai),!Ii)return!1;ai+=Ii.length}return li.write($.SUBACK_HEADER),ti(li,ai),he(li,pi),Ii!==null&&Ii.write(),li.write(k.from(vi))}function xe(wi,li,fi){const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.messageId,vi=Ni.dup?$.DUP_MASK:0,bi=Ni.unsubscriptions,ai=Ni.properties;let Ii=0;if(typeof pi!="number")return li.emit("error",new Error("Invalid messageId")),!1;if(Ii+=2,typeof bi=="object"&&bi.length)for(let ii=0;ii<bi.length;ii+=1){if(typeof bi[ii]!="string")return li.emit("error",new Error("Invalid unsubscriptions")),!1;Ii+=k.byteLength(bi[ii])+2}else return li.emit("error",new Error("Invalid unsubscriptions")),!1;let oi=null;if(Mi===5){if(oi=gi(li,ai),!oi)return!1;Ii+=oi.length}li.write($.UNSUBSCRIBE_HEADER[1][vi?1:0][0]),ti(li,Ii),he(li,pi),oi!==null&&oi.write();let ei=!0;for(let ii=0;ii<bi.length;ii++)ei=Lt(li,bi[ii]);return ei}function Dt(wi,li,fi){const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.messageId,vi=Ni.dup?$.DUP_MASK:0,bi=Ni.granted,ai=Ni.properties,Ii=Ni.cmd,oi=0;let ei=2;if(typeof pi!="number")return li.emit("error",new Error("Invalid messageId")),!1;if(Mi===5)if(typeof bi=="object"&&bi.length)for(let si=0;si<bi.length;si+=1){if(typeof bi[si]!="number")return li.emit("error",new Error("Invalid qos vector")),!1;ei+=1}else return li.emit("error",new Error("Invalid qos vector")),!1;let ii=null;if(Mi===5){if(ii=di(li,ai,fi,ei),!ii)return!1;ei+=ii.length}return li.write($.ACKS[Ii][oi][vi][0]),ti(li,ei),he(li,pi),ii!==null&&ii.write(),Mi===5&&li.write(k.from(bi)),!0}function qe(wi,li,fi){return li.write($.EMPTY[wi.cmd])}function kt(wi,li,fi){const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.reasonCode,vi=Ni.properties;let bi=Mi===5?1:0,ai=null;if(Mi===5){if(ai=di(li,vi,fi,bi),!ai)return!1;bi+=ai.length}return li.write(k.from([$.codes.disconnect<<4])),ti(li,bi),Mi===5&&li.write(k.from([pi])),ai!==null&&ai.write(),!0}function Et(wi,li,fi){const Mi=fi?fi.protocolVersion:4,Ni=wi||{},pi=Ni.reasonCode,vi=Ni.properties;let bi=Mi===5?1:0;Mi!==5&&li.emit("error",new Error("Invalid mqtt version for auth packet"));const ai=di(li,vi,fi,bi);return ai?(bi+=ai.length,li.write(k.from([$.codes.auth<<4])),ti(li,bi),li.write(k.from([pi])),ai!==null&&ai.write(),!0):!1}const jt={};function ti(wi,li){if(li>$.VARBYTEINT_MAX)return wi.emit("error",new Error(`Invalid variable byte integer: ${li}`)),!1;let fi=jt[li];return fi||(fi=de(li),li<16384&&(jt[li]=fi)),ae("writeVarByteInt: writing to stream: %o",fi),wi.write(fi)}function Lt(wi,li){const fi=k.byteLength(li);return he(wi,fi),ae("writeString: %s",li),wi.write(li,"utf8")}function Pt(wi,li,fi){Lt(wi,li),Lt(wi,fi)}function ni(wi,li){return ae("writeNumberCached: number: %d",li),ae("writeNumberCached: %o",le[li]),wi.write(le[li])}function ri(wi,li){const fi=Ie(li);return ae("writeNumberGenerated: %o",fi),wi.write(fi)}function ui(wi,li){const fi=Ne(li);return ae("write4ByteNumber: %o",fi),wi.write(fi)}function Ci(wi,li){typeof li=="string"?Lt(wi,li):li?(he(wi,li.length),wi.write(li)):he(wi,0)}function gi(wi,li){if(typeof li!="object"||li.length!=null)return{length:1,write(){ci(wi,{},0)}};let fi=0;function Mi(pi,vi){const bi=$.propertiesTypes[pi];let ai=0;switch(bi){case"byte":{if(typeof vi!="boolean")return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=1+1;break}case"int8":{if(typeof vi!="number"||vi<0||vi>255)return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=1+1;break}case"binary":{if(vi&&vi===null)return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=1+k.byteLength(vi)+2;break}case"int16":{if(typeof vi!="number"||vi<0||vi>65535)return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=1+2;break}case"int32":{if(typeof vi!="number"||vi<0||vi>4294967295)return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=1+4;break}case"var":{if(typeof vi!="number"||vi<0||vi>268435455)return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=1+k.byteLength(de(vi));break}case"string":{if(typeof vi!="string")return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=1+2+k.byteLength(vi.toString());break}case"pair":{if(typeof vi!="object")return wi.emit("error",new Error(`Invalid ${pi}: ${vi}`)),!1;ai+=Object.getOwnPropertyNames(vi).reduce((Ii,oi)=>{const ei=vi[oi];return Array.isArray(ei)?Ii+=ei.reduce((ii,si)=>(ii+=1+2+k.byteLength(oi.toString())+2+k.byteLength(si.toString()),ii),0):Ii+=1+2+k.byteLength(oi.toString())+2+k.byteLength(vi[oi].toString()),Ii},0);break}default:return wi.emit("error",new Error(`Invalid property ${pi}: ${vi}`)),!1}return ai}if(li)for(const pi in li){let vi=0,bi=0;const ai=li[pi];if(Array.isArray(ai))for(let Ii=0;Ii<ai.length;Ii++){if(bi=Mi(pi,ai[Ii]),!bi)return!1;vi+=bi}else{if(bi=Mi(pi,ai),!bi)return!1;vi=bi}if(!vi)return!1;fi+=vi}return{length:k.byteLength(de(fi))+fi,write(){ci(wi,li,fi)}}}function di(wi,li,fi,Mi){const Ni=["reasonString","userProperties"],pi=fi&&fi.properties&&fi.properties.maximumPacketSize?fi.properties.maximumPacketSize:0;let vi=gi(wi,li);if(pi)for(;Mi+vi.length>pi;){const bi=Ni.shift();if(bi&&li[bi])delete li[bi],vi=gi(wi,li);else return!1}return vi}function hi(wi,li,fi){switch($.propertiesTypes[li]){case"byte":{wi.write(k.from([$.properties[li]])),wi.write(k.from([+fi]));break}case"int8":{wi.write(k.from([$.properties[li]])),wi.write(k.from([fi]));break}case"binary":{wi.write(k.from([$.properties[li]])),Ci(wi,fi);break}case"int16":{wi.write(k.from([$.properties[li]])),he(wi,fi);break}case"int32":{wi.write(k.from([$.properties[li]])),ui(wi,fi);break}case"var":{wi.write(k.from([$.properties[li]])),ti(wi,fi);break}case"string":{wi.write(k.from([$.properties[li]])),Lt(wi,fi);break}case"pair":{Object.getOwnPropertyNames(fi).forEach(Ni=>{const pi=fi[Ni];Array.isArray(pi)?pi.forEach(vi=>{wi.write(k.from([$.properties[li]])),Pt(wi,Ni.toString(),vi.toString())}):(wi.write(k.from([$.properties[li]])),Pt(wi,Ni.toString(),pi.toString()))});break}default:return wi.emit("error",new Error(`Invalid property ${li} value: ${fi}`)),!1}}function ci(wi,li,fi){ti(wi,fi);for(const Mi in li)if(Object.prototype.hasOwnProperty.call(li,Mi)&&li[Mi]!==null){const Ni=li[Mi];if(Array.isArray(Ni))for(let pi=0;pi<Ni.length;pi++)hi(wi,Mi,Ni[pi]);else hi(wi,Mi,Ni)}}function Ai(wi){return wi?wi instanceof k?wi.length:k.byteLength(wi):0}function yi(wi){return typeof wi=="string"||wi instanceof k}g.exports=pe}).call(this)}).call(this,r("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(r,g,V){var k=1e3,$=k*60,oe=$*60,re=oe*24,Ce=re*7,ie=re*365.25;g.exports=function(de,Ne){Ne=Ne||{};var he=typeof de;if(he==="string"&&de.length>0)return ae(de);if(he==="number"&&isFinite(de))return Ne.long?Ie(de):le(de);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(de))};function ae(de){if(de=String(de),!(de.length>100)){var Ne=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(de);if(Ne){var he=parseFloat(Ne[1]),ze=(Ne[2]||"ms").toLowerCase();switch(ze){case"years":case"year":case"yrs":case"yr":case"y":return he*ie;case"weeks":case"week":case"w":return he*Ce;case"days":case"day":case"d":return he*re;case"hours":case"hour":case"hrs":case"hr":case"h":return he*oe;case"minutes":case"minute":case"mins":case"min":case"m":return he*$;case"seconds":case"second":case"secs":case"sec":case"s":return he*k;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return he;default:return}}}}function le(de){var Ne=Math.abs(de);return Ne>=re?Math.round(de/re)+"d":Ne>=oe?Math.round(de/oe)+"h":Ne>=$?Math.round(de/$)+"m":Ne>=k?Math.round(de/k)+"s":de+"ms"}function Ie(de){var Ne=Math.abs(de);return Ne>=re?ue(de,Ne,re,"day"):Ne>=oe?ue(de,Ne,oe,"hour"):Ne>=$?ue(de,Ne,$,"minute"):Ne>=k?ue(de,Ne,k,"second"):de+" ms"}function ue(de,Ne,he,ze){var pe=Ne>=he*1.5;return Math.round(de/he)+" "+ze+(pe?"s":"")}},{}],46:[function(r,g,V){const k=r("./lib/number-allocator.js");g.exports.NumberAllocator=k},{"./lib/number-allocator.js":47}],47:[function(r,g,V){const k=r("js-sdsl").Set,$=r("debug")("number-allocator:trace"),oe=r("debug")("number-allocator:error");function re(ie,ae){this.low=ie,this.high=ae}re.prototype.equals=function(ie){return this.low===ie.low&&this.high===ie.high},re.prototype.compare=function(ie){return this.low<ie.low&&this.high<ie.low?-1:ie.low<this.low&&ie.high<this.low?1:0};function Ce(ie,ae){if(!(this instanceof Ce))return new Ce(ie,ae);this.min=ie,this.max=ae,this.ss=new k([],(le,Ie)=>le.compare(Ie)),$("Create"),this.clear()}Ce.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},Ce.prototype.alloc=function(){if(this.ss.size()===0)return $("alloc():empty"),null;const ie=this.ss.front(),ae=ie.low;return ae+1<=ie.high?++ie.low:this.ss.eraseElementByPos(0),$("alloc():"+ae),ae},Ce.prototype.use=function(ie){const ae=new re(ie,ie),le=this.ss.lowerBound(ae);if(le){if(le.equals(ae))return this.ss.eraseElementByValue(le),$("use():"+ie),!0;if(le.low>ie)return!1;if(le.low===ie)return++le.low,$("use():"+ie),!0;if(le.high===ie)return--le.high,$("use():"+ie),!0;const Ie=le.low;return le.low=ie+1,this.ss.insert(new re(Ie,ie-1)),$("use():"+ie),!0}return $("use():failed"),!1},Ce.prototype.free=function(ie){if(ie<this.min||ie>this.max){oe("free():"+ie+" is out of range");return}const ae=new re(ie,ie),le=this.ss.lowerBound(ae);if(le){if(le.low<=ie&&ie<=le.high){oe("free():"+ie+" has already been vacant");return}if(le===this.ss.front())ie+1===le.low?--le.low:this.ss.insert(ae);else{const Ie=this.ss.reverseLowerBound(ae);Ie.high+1===ie?ie+1===le.low?(this.ss.eraseElementByValue(Ie),le.low=Ie.low):Ie.high=ie:ie+1===le.low?le.low=ie:this.ss.insert(ae)}}else{if(le===this.ss.front()){this.ss.insert(ae);return}const Ie=this.ss.reverseLowerBound(ae);Ie.high+1===ie?Ie.high=ie:this.ss.insert(ae)}$("free():"+ie)},Ce.prototype.clear=function(){$("clear()"),this.ss.clear(),this.ss.insert(new re(this.min,this.max))},Ce.prototype.intervalCount=function(){return this.ss.size()},Ce.prototype.dump=function(){console.log("length:"+this.ss.size());for(const ie of this.ss)console.log(ie)},g.exports=Ce},{debug:18,"js-sdsl":36}],48:[function(r,g,V){var k=r("wrappy");g.exports=k($),g.exports.strict=k(oe),$.proto=$(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return $(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return oe(this)},configurable:!0})});function $(re){var Ce=function(){return Ce.called?Ce.value:(Ce.called=!0,Ce.value=re.apply(this,arguments))};return Ce.called=!1,Ce}function oe(re){var Ce=function(){if(Ce.called)throw new Error(Ce.onceError);return Ce.called=!0,Ce.value=re.apply(this,arguments)},ie=re.name||"Function wrapped with `once`";return Ce.onceError=ie+" shouldn't be called more than once",Ce.called=!1,Ce}},{wrappy:79}],49:[function(r,g,V){(function(k){(function(){typeof k>"u"||!k.version||k.version.indexOf("v0.")===0||k.version.indexOf("v1.")===0&&k.version.indexOf("v1.8.")!==0?g.exports={nextTick:$}:g.exports=k;function $(oe,re,Ce,ie){if(typeof oe!="function")throw new TypeError('"callback" argument must be a function');var ae=arguments.length,le,Ie;switch(ae){case 0:case 1:return k.nextTick(oe);case 2:return k.nextTick(function(){oe.call(null,re)});case 3:return k.nextTick(function(){oe.call(null,re,Ce)});case 4:return k.nextTick(function(){oe.call(null,re,Ce,ie)});default:for(le=new Array(ae-1),Ie=0;Ie<le.length;)le[Ie++]=arguments[Ie];return k.nextTick(function(){oe.apply(null,le)})}}}).call(this)}).call(this,r("_process"))},{_process:50}],50:[function(r,g,V){var k=g.exports={},$,oe;function re(){throw new Error("setTimeout has not been defined")}function Ce(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?$=setTimeout:$=re}catch{$=re}try{typeof clearTimeout=="function"?oe=clearTimeout:oe=Ce}catch{oe=Ce}})();function ie(Ve){if($===setTimeout)return setTimeout(Ve,0);if(($===re||!$)&&setTimeout)return $=setTimeout,setTimeout(Ve,0);try{return $(Ve,0)}catch{try{return $.call(null,Ve,0)}catch{return $.call(this,Ve,0)}}}function ae(Ve){if(oe===clearTimeout)return clearTimeout(Ve);if((oe===Ce||!oe)&&clearTimeout)return oe=clearTimeout,clearTimeout(Ve);try{return oe(Ve)}catch{try{return oe.call(null,Ve)}catch{return oe.call(this,Ve)}}}var le=[],Ie=!1,ue,de=-1;function Ne(){!Ie||!ue||(Ie=!1,ue.length?le=ue.concat(le):de=-1,le.length&&he())}function he(){if(!Ie){var Ve=ie(Ne);Ie=!0;for(var Oe=le.length;Oe;){for(ue=le,le=[];++de<Oe;)ue&&ue[de].run();de=-1,Oe=le.length}ue=null,Ie=!1,ae(Ve)}}k.nextTick=function(Ve){var Oe=new Array(arguments.length-1);if(arguments.length>1)for(var _e=1;_e<arguments.length;_e++)Oe[_e-1]=arguments[_e];le.push(new ze(Ve,Oe)),le.length===1&&!Ie&&ie(he)};function ze(Ve,Oe){this.fun=Ve,this.array=Oe}ze.prototype.run=function(){this.fun.apply(null,this.array)},k.title="browser",k.browser=!0,k.env={},k.argv=[],k.version="",k.versions={};function pe(){}k.on=pe,k.addListener=pe,k.once=pe,k.off=pe,k.removeListener=pe,k.removeAllListeners=pe,k.emit=pe,k.prependListener=pe,k.prependOnceListener=pe,k.listeners=function(Ve){return[]},k.binding=function(Ve){throw new Error("process.binding is not supported")},k.cwd=function(){return"/"},k.chdir=function(Ve){throw new Error("process.chdir is not supported")},k.umask=function(){return 0}},{}],51:[function(r,g,V){(function(k){(function(){(function($){var oe=typeof V=="object"&&V&&!V.nodeType&&V,re=typeof g=="object"&&g&&!g.nodeType&&g,Ce=typeof k=="object"&&k;(Ce.global===Ce||Ce.window===Ce||Ce.self===Ce)&&($=Ce);var ie,ae=2147483647,le=36,Ie=1,ue=26,de=38,Ne=700,he=72,ze=128,pe="-",Ve=/^xn--/,Oe=/[^\x20-\x7E]/,_e=/[\x2E\u3002\uFF0E\uFF61]/g,At={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$e=le-Ie,Fe=Math.floor,Ue=String.fromCharCode,xe;function Dt(gi){throw new RangeError(At[gi])}function qe(gi,di){for(var hi=gi.length,ci=[];hi--;)ci[hi]=di(gi[hi]);return ci}function kt(gi,di){var hi=gi.split("@"),ci="";hi.length>1&&(ci=hi[0]+"@",gi=hi[1]),gi=gi.replace(_e,".");var Ai=gi.split("."),yi=qe(Ai,di).join(".");return ci+yi}function Et(gi){for(var di=[],hi=0,ci=gi.length,Ai,yi;hi<ci;)Ai=gi.charCodeAt(hi++),Ai>=55296&&Ai<=56319&&hi<ci?(yi=gi.charCodeAt(hi++),(yi&64512)==56320?di.push(((Ai&1023)<<10)+(yi&1023)+65536):(di.push(Ai),hi--)):di.push(Ai);return di}function jt(gi){return qe(gi,function(di){var hi="";return di>65535&&(di-=65536,hi+=Ue(di>>>10&1023|55296),di=56320|di&1023),hi+=Ue(di),hi}).join("")}function ti(gi){return gi-48<10?gi-22:gi-65<26?gi-65:gi-97<26?gi-97:le}function Lt(gi,di){return gi+22+75*(gi<26)-((di!=0)<<5)}function Pt(gi,di,hi){var ci=0;for(gi=hi?Fe(gi/Ne):gi>>1,gi+=Fe(gi/di);gi>$e*ue>>1;ci+=le)gi=Fe(gi/$e);return Fe(ci+($e+1)*gi/(gi+de))}function ni(gi){var di=[],hi=gi.length,ci,Ai=0,yi=ze,wi=he,li,fi,Mi,Ni,pi,vi,bi,ai,Ii;for(li=gi.lastIndexOf(pe),li<0&&(li=0),fi=0;fi<li;++fi)gi.charCodeAt(fi)>=128&&Dt("not-basic"),di.push(gi.charCodeAt(fi));for(Mi=li>0?li+1:0;Mi<hi;){for(Ni=Ai,pi=1,vi=le;Mi>=hi&&Dt("invalid-input"),bi=ti(gi.charCodeAt(Mi++)),(bi>=le||bi>Fe((ae-Ai)/pi))&&Dt("overflow"),Ai+=bi*pi,ai=vi<=wi?Ie:vi>=wi+ue?ue:vi-wi,!(bi<ai);vi+=le)Ii=le-ai,pi>Fe(ae/Ii)&&Dt("overflow"),pi*=Ii;ci=di.length+1,wi=Pt(Ai-Ni,ci,Ni==0),Fe(Ai/ci)>ae-yi&&Dt("overflow"),yi+=Fe(Ai/ci),Ai%=ci,di.splice(Ai++,0,yi)}return jt(di)}function ri(gi){var di,hi,ci,Ai,yi,wi,li,fi,Mi,Ni,pi,vi=[],bi,ai,Ii,oi;for(gi=Et(gi),bi=gi.length,di=ze,hi=0,yi=he,wi=0;wi<bi;++wi)pi=gi[wi],pi<128&&vi.push(Ue(pi));for(ci=Ai=vi.length,Ai&&vi.push(pe);ci<bi;){for(li=ae,wi=0;wi<bi;++wi)pi=gi[wi],pi>=di&&pi<li&&(li=pi);for(ai=ci+1,li-di>Fe((ae-hi)/ai)&&Dt("overflow"),hi+=(li-di)*ai,di=li,wi=0;wi<bi;++wi)if(pi=gi[wi],pi<di&&++hi>ae&&Dt("overflow"),pi==di){for(fi=hi,Mi=le;Ni=Mi<=yi?Ie:Mi>=yi+ue?ue:Mi-yi,!(fi<Ni);Mi+=le)oi=fi-Ni,Ii=le-Ni,vi.push(Ue(Lt(Ni+oi%Ii,0))),fi=Fe(oi/Ii);vi.push(Ue(Lt(fi,0))),yi=Pt(hi,ai,ci==Ai),hi=0,++ci}++hi,++di}return vi.join("")}function ui(gi){return kt(gi,function(di){return Ve.test(di)?ni(di.slice(4).toLowerCase()):di})}function Ci(gi){return kt(gi,function(di){return Oe.test(di)?"xn--"+ri(di):di})}if(ie={version:"1.4.1",ucs2:{decode:Et,encode:jt},decode:ni,encode:ri,toASCII:Ci,toUnicode:ui},oe&&re)if(g.exports==oe)re.exports=ie;else for(xe in ie)ie.hasOwnProperty(xe)&&(oe[xe]=ie[xe]);else $.punycode=ie})(this)}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],52:[function(r,g,V){function k(oe,re){return Object.prototype.hasOwnProperty.call(oe,re)}g.exports=function(oe,re,Ce,ie){re=re||"&",Ce=Ce||"=";var ae={};if(typeof oe!="string"||oe.length===0)return ae;var le=/\+/g;oe=oe.split(re);var Ie=1e3;ie&&typeof ie.maxKeys=="number"&&(Ie=ie.maxKeys);var ue=oe.length;Ie>0&&ue>Ie&&(ue=Ie);for(var de=0;de<ue;++de){var Ne=oe[de].replace(le,"%20"),he=Ne.indexOf(Ce),ze,pe,Ve,Oe;he>=0?(ze=Ne.substr(0,he),pe=Ne.substr(he+1)):(ze=Ne,pe=""),Ve=decodeURIComponent(ze),Oe=decodeURIComponent(pe),k(ae,Ve)?$(ae[Ve])?ae[Ve].push(Oe):ae[Ve]=[ae[Ve],Oe]:ae[Ve]=Oe}return ae};var $=Array.isArray||function(oe){return Object.prototype.toString.call(oe)==="[object Array]"}},{}],53:[function(r,g,V){var k=function(Ce){switch(typeof Ce){case"string":return Ce;case"boolean":return Ce?"true":"false";case"number":return isFinite(Ce)?Ce:"";default:return""}};g.exports=function(Ce,ie,ae,le){return ie=ie||"&",ae=ae||"=",Ce===null&&(Ce=void 0),typeof Ce=="object"?oe(re(Ce),function(Ie){var ue=encodeURIComponent(k(Ie))+ae;return $(Ce[Ie])?oe(Ce[Ie],function(de){return ue+encodeURIComponent(k(de))}).join(ie):ue+encodeURIComponent(k(Ce[Ie]))}).join(ie):le?encodeURIComponent(k(le))+ae+encodeURIComponent(k(Ce)):""};var $=Array.isArray||function(Ce){return Object.prototype.toString.call(Ce)==="[object Array]"};function oe(Ce,ie){if(Ce.map)return Ce.map(ie);for(var ae=[],le=0;le<Ce.length;le++)ae.push(ie(Ce[le],le));return ae}var re=Object.keys||function(Ce){var ie=[];for(var ae in Ce)Object.prototype.hasOwnProperty.call(Ce,ae)&&ie.push(ae);return ie}},{}],54:[function(r,g,V){V.decode=V.parse=r("./decode"),V.encode=V.stringify=r("./encode")},{"./decode":52,"./encode":53}],55:[function(r,g,V){function k(le,Ie){le.prototype=Object.create(Ie.prototype),le.prototype.constructor=le,le.__proto__=Ie}var $={};function oe(le,Ie,ue){ue||(ue=Error);function de(he,ze,pe){return typeof Ie=="string"?Ie:Ie(he,ze,pe)}var Ne=function(he){k(ze,he);function ze(pe,Ve,Oe){return he.call(this,de(pe,Ve,Oe))||this}return ze}(ue);Ne.prototype.name=ue.name,Ne.prototype.code=le,$[le]=Ne}function re(le,Ie){if(Array.isArray(le)){var ue=le.length;return le=le.map(function(de){return String(de)}),ue>2?"one of ".concat(Ie," ").concat(le.slice(0,ue-1).join(", "),", or ")+le[ue-1]:ue===2?"one of ".concat(Ie," ").concat(le[0]," or ").concat(le[1]):"of ".concat(Ie," ").concat(le[0])}else return"of ".concat(Ie," ").concat(String(le))}function Ce(le,Ie,ue){return le.substr(!ue||ue<0?0:+ue,Ie.length)===Ie}function ie(le,Ie,ue){return(ue===void 0||ue>le.length)&&(ue=le.length),le.substring(ue-Ie.length,ue)===Ie}function ae(le,Ie,ue){return typeof ue!="number"&&(ue=0),ue+Ie.length>le.length?!1:le.indexOf(Ie,ue)!==-1}oe("ERR_INVALID_OPT_VALUE",function(le,Ie){return'The value "'+Ie+'" is invalid for option "'+le+'"'},TypeError),oe("ERR_INVALID_ARG_TYPE",function(le,Ie,ue){var de;typeof Ie=="string"&&Ce(Ie,"not ")?(de="must not be",Ie=Ie.replace(/^not /,"")):de="must be";var Ne;if(ie(le," argument"))Ne="The ".concat(le," ").concat(de," ").concat(re(Ie,"type"));else{var he=ae(le,".")?"property":"argument";Ne='The "'.concat(le,'" ').concat(he," ").concat(de," ").concat(re(Ie,"type"))}return Ne+=". Received type ".concat(typeof ue),Ne},TypeError),oe("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),oe("ERR_METHOD_NOT_IMPLEMENTED",function(le){return"The "+le+" method is not implemented"}),oe("ERR_STREAM_PREMATURE_CLOSE","Premature close"),oe("ERR_STREAM_DESTROYED",function(le){return"Cannot call "+le+" after a stream was destroyed"}),oe("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),oe("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),oe("ERR_STREAM_WRITE_AFTER_END","write after end"),oe("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),oe("ERR_UNKNOWN_ENCODING",function(le){return"Unknown encoding: "+le},TypeError),oe("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),g.exports.codes=$},{}],56:[function(r,g,V){(function(k){(function(){var $=Object.keys||function(de){var Ne=[];for(var he in de)Ne.push(he);return Ne};g.exports=le;var oe=r("./_stream_readable"),re=r("./_stream_writable");r("inherits")(le,oe);for(var Ce=$(re.prototype),ie=0;ie<Ce.length;ie++){var ae=Ce[ie];le.prototype[ae]||(le.prototype[ae]=re.prototype[ae])}function le(de){if(!(this instanceof le))return new le(de);oe.call(this,de),re.call(this,de),this.allowHalfOpen=!0,de&&(de.readable===!1&&(this.readable=!1),de.writable===!1&&(this.writable=!1),de.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",Ie)))}Object.defineProperty(le.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(le.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(le.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Ie(){this._writableState.ended||k.nextTick(ue,this)}function ue(de){de.end()}Object.defineProperty(le.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(Ne){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=Ne,this._writableState.destroyed=Ne)}})}).call(this)}).call(this,r("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(r,g,V){g.exports=$;var k=r("./_stream_transform");r("inherits")($,k);function $(oe){if(!(this instanceof $))return new $(oe);k.call(this,oe)}$.prototype._transform=function(oe,re,Ce){Ce(null,oe)}},{"./_stream_transform":59,inherits:24}],58:[function(r,g,V){(function(k,$){(function(){g.exports=jt;var oe;jt.ReadableState=Et,r("events").EventEmitter;var re=function(Ii,oi){return Ii.listeners(oi).length},Ce=r("./internal/streams/stream"),ie=r("buffer").Buffer,ae=$.Uint8Array||function(){};function le(ai){return ie.from(ai)}function Ie(ai){return ie.isBuffer(ai)||ai instanceof ae}var ue=r("util"),de;ue&&ue.debuglog?de=ue.debuglog("stream"):de=function(){};var Ne=r("./internal/streams/buffer_list"),he=r("./internal/streams/destroy"),ze=r("./internal/streams/state"),pe=ze.getHighWaterMark,Ve=r("../errors").codes,Oe=Ve.ERR_INVALID_ARG_TYPE,_e=Ve.ERR_STREAM_PUSH_AFTER_EOF,At=Ve.ERR_METHOD_NOT_IMPLEMENTED,$e=Ve.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Fe,Ue,xe;r("inherits")(jt,Ce);var Dt=he.errorOrDestroy,qe=["error","close","destroy","pause","resume"];function kt(ai,Ii,oi){if(typeof ai.prependListener=="function")return ai.prependListener(Ii,oi);!ai._events||!ai._events[Ii]?ai.on(Ii,oi):Array.isArray(ai._events[Ii])?ai._events[Ii].unshift(oi):ai._events[Ii]=[oi,ai._events[Ii]]}function Et(ai,Ii,oi){oe=oe||r("./_stream_duplex"),ai=ai||{},typeof oi!="boolean"&&(oi=Ii instanceof oe),this.objectMode=!!ai.objectMode,oi&&(this.objectMode=this.objectMode||!!ai.readableObjectMode),this.highWaterMark=pe(this,ai,"readableHighWaterMark",oi),this.buffer=new Ne,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=ai.emitClose!==!1,this.autoDestroy=!!ai.autoDestroy,this.destroyed=!1,this.defaultEncoding=ai.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,ai.encoding&&(Fe||(Fe=r("string_decoder/").StringDecoder),this.decoder=new Fe(ai.encoding),this.encoding=ai.encoding)}function jt(ai){if(oe=oe||r("./_stream_duplex"),!(this instanceof jt))return new jt(ai);var Ii=this instanceof oe;this._readableState=new Et(ai,this,Ii),this.readable=!0,ai&&(typeof ai.read=="function"&&(this._read=ai.read),typeof ai.destroy=="function"&&(this._destroy=ai.destroy)),Ce.call(this)}Object.defineProperty(jt.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(Ii){this._readableState&&(this._readableState.destroyed=Ii)}}),jt.prototype.destroy=he.destroy,jt.prototype._undestroy=he.undestroy,jt.prototype._destroy=function(ai,Ii){Ii(ai)},jt.prototype.push=function(ai,Ii){var oi=this._readableState,ei;return oi.objectMode?ei=!0:typeof ai=="string"&&(Ii=Ii||oi.defaultEncoding,Ii!==oi.encoding&&(ai=ie.from(ai,Ii),Ii=""),ei=!0),ti(this,ai,Ii,!1,ei)},jt.prototype.unshift=function(ai){return ti(this,ai,null,!0,!1)};function ti(ai,Ii,oi,ei,ii){de("readableAddChunk",Ii);var si=ai._readableState;if(Ii===null)si.reading=!1,Ci(ai,si);else{var zi;if(ii||(zi=Pt(si,Ii)),zi)Dt(ai,zi);else if(si.objectMode||Ii&&Ii.length>0)if(typeof Ii!="string"&&!si.objectMode&&Object.getPrototypeOf(Ii)!==ie.prototype&&(Ii=le(Ii)),ei)si.endEmitted?Dt(ai,new $e):Lt(ai,si,Ii,!0);else if(si.ended)Dt(ai,new _e);else{if(si.destroyed)return!1;si.reading=!1,si.decoder&&!oi?(Ii=si.decoder.write(Ii),si.objectMode||Ii.length!==0?Lt(ai,si,Ii,!1):hi(ai,si)):Lt(ai,si,Ii,!1)}else ei||(si.reading=!1,hi(ai,si))}return!si.ended&&(si.length<si.highWaterMark||si.length===0)}function Lt(ai,Ii,oi,ei){Ii.flowing&&Ii.length===0&&!Ii.sync?(Ii.awaitDrain=0,ai.emit("data",oi)):(Ii.length+=Ii.objectMode?1:oi.length,ei?Ii.buffer.unshift(oi):Ii.buffer.push(oi),Ii.needReadable&&gi(ai)),hi(ai,Ii)}function Pt(ai,Ii){var oi;return!Ie(Ii)&&typeof Ii!="string"&&Ii!==void 0&&!ai.objectMode&&(oi=new Oe("chunk",["string","Buffer","Uint8Array"],Ii)),oi}jt.prototype.isPaused=function(){return this._readableState.flowing===!1},jt.prototype.setEncoding=function(ai){Fe||(Fe=r("string_decoder/").StringDecoder);var Ii=new Fe(ai);this._readableState.decoder=Ii,this._readableState.encoding=this._readableState.decoder.encoding;for(var oi=this._readableState.buffer.head,ei="";oi!==null;)ei+=Ii.write(oi.data),oi=oi.next;return this._readableState.buffer.clear(),ei!==""&&this._readableState.buffer.push(ei),this._readableState.length=ei.length,this};var ni=1073741824;function ri(ai){return ai>=ni?ai=ni:(ai--,ai|=ai>>>1,ai|=ai>>>2,ai|=ai>>>4,ai|=ai>>>8,ai|=ai>>>16,ai++),ai}function ui(ai,Ii){return ai<=0||Ii.length===0&&Ii.ended?0:Ii.objectMode?1:ai!==ai?Ii.flowing&&Ii.length?Ii.buffer.head.data.length:Ii.length:(ai>Ii.highWaterMark&&(Ii.highWaterMark=ri(ai)),ai<=Ii.length?ai:Ii.ended?Ii.length:(Ii.needReadable=!0,0))}jt.prototype.read=function(ai){de("read",ai),ai=parseInt(ai,10);var Ii=this._readableState,oi=ai;if(ai!==0&&(Ii.emittedReadable=!1),ai===0&&Ii.needReadable&&((Ii.highWaterMark!==0?Ii.length>=Ii.highWaterMark:Ii.length>0)||Ii.ended))return de("read: emitReadable",Ii.length,Ii.ended),Ii.length===0&&Ii.ended?pi(this):gi(this),null;if(ai=ui(ai,Ii),ai===0&&Ii.ended)return Ii.length===0&&pi(this),null;var ei=Ii.needReadable;de("need readable",ei),(Ii.length===0||Ii.length-ai<Ii.highWaterMark)&&(ei=!0,de("length less than watermark",ei)),Ii.ended||Ii.reading?(ei=!1,de("reading or ended",ei)):ei&&(de("do read"),Ii.reading=!0,Ii.sync=!0,Ii.length===0&&(Ii.needReadable=!0),this._read(Ii.highWaterMark),Ii.sync=!1,Ii.reading||(ai=ui(oi,Ii)));var ii;return ai>0?ii=Ni(ai,Ii):ii=null,ii===null?(Ii.needReadable=Ii.length<=Ii.highWaterMark,ai=0):(Ii.length-=ai,Ii.awaitDrain=0),Ii.length===0&&(Ii.ended||(Ii.needReadable=!0),oi!==ai&&Ii.ended&&pi(this)),ii!==null&&this.emit("data",ii),ii};function Ci(ai,Ii){if(de("onEofChunk"),!Ii.ended){if(Ii.decoder){var oi=Ii.decoder.end();oi&&oi.length&&(Ii.buffer.push(oi),Ii.length+=Ii.objectMode?1:oi.length)}Ii.ended=!0,Ii.sync?gi(ai):(Ii.needReadable=!1,Ii.emittedReadable||(Ii.emittedReadable=!0,di(ai)))}}function gi(ai){var Ii=ai._readableState;de("emitReadable",Ii.needReadable,Ii.emittedReadable),Ii.needReadable=!1,Ii.emittedReadable||(de("emitReadable",Ii.flowing),Ii.emittedReadable=!0,k.nextTick(di,ai))}function di(ai){var Ii=ai._readableState;de("emitReadable_",Ii.destroyed,Ii.length,Ii.ended),!Ii.destroyed&&(Ii.length||Ii.ended)&&(ai.emit("readable"),Ii.emittedReadable=!1),Ii.needReadable=!Ii.flowing&&!Ii.ended&&Ii.length<=Ii.highWaterMark,Mi(ai)}function hi(ai,Ii){Ii.readingMore||(Ii.readingMore=!0,k.nextTick(ci,ai,Ii))}function ci(ai,Ii){for(;!Ii.reading&&!Ii.ended&&(Ii.length<Ii.highWaterMark||Ii.flowing&&Ii.length===0);){var oi=Ii.length;if(de("maybeReadMore read 0"),ai.read(0),oi===Ii.length)break}Ii.readingMore=!1}jt.prototype._read=function(ai){Dt(this,new At("_read()"))},jt.prototype.pipe=function(ai,Ii){var oi=this,ei=this._readableState;switch(ei.pipesCount){case 0:ei.pipes=ai;break;case 1:ei.pipes=[ei.pipes,ai];break;default:ei.pipes.push(ai);break}ei.pipesCount+=1,de("pipe count=%d opts=%j",ei.pipesCount,Ii);var ii=(!Ii||Ii.end!==!1)&&ai!==k.stdout&&ai!==k.stderr,si=ii?mi:Vi;ei.endEmitted?k.nextTick(si):oi.once("end",si),ai.on("unpipe",zi);function zi(ki,Hi){de("onunpipe"),ki===oi&&Hi&&Hi.hasUnpiped===!1&&(Hi.hasUnpiped=!0,Gi())}function mi(){de("onend"),ai.end()}var Si=Ai(oi);ai.on("drain",Si);var xi=!1;function Gi(){de("cleanup"),ai.removeListener("close",Zi),ai.removeListener("finish",Wi),ai.removeListener("drain",Si),ai.removeListener("error",Oi),ai.removeListener("unpipe",zi),oi.removeListener("end",mi),oi.removeListener("end",Vi),oi.removeListener("data",Bi),xi=!0,ei.awaitDrain&&(!ai._writableState||ai._writableState.needDrain)&&Si()}oi.on("data",Bi);function Bi(ki){de("ondata");var Hi=ai.write(ki);de("dest.write",Hi),Hi===!1&&((ei.pipesCount===1&&ei.pipes===ai||ei.pipesCount>1&&bi(ei.pipes,ai)!==-1)&&!xi&&(de("false write response, pause",ei.awaitDrain),ei.awaitDrain++),oi.pause())}function Oi(ki){de("onerror",ki),Vi(),ai.removeListener("error",Oi),re(ai,"error")===0&&Dt(ai,ki)}kt(ai,"error",Oi);function Zi(){ai.removeListener("finish",Wi),Vi()}ai.once("close",Zi);function Wi(){de("onfinish"),ai.removeListener("close",Zi),Vi()}ai.once("finish",Wi);function Vi(){de("unpipe"),oi.unpipe(ai)}return ai.emit("pipe",oi),ei.flowing||(de("pipe resume"),oi.resume()),ai};function Ai(ai){return function(){var oi=ai._readableState;de("pipeOnDrain",oi.awaitDrain),oi.awaitDrain&&oi.awaitDrain--,oi.awaitDrain===0&&re(ai,"data")&&(oi.flowing=!0,Mi(ai))}}jt.prototype.unpipe=function(ai){var Ii=this._readableState,oi={hasUnpiped:!1};if(Ii.pipesCount===0)return this;if(Ii.pipesCount===1)return ai&&ai!==Ii.pipes?this:(ai||(ai=Ii.pipes),Ii.pipes=null,Ii.pipesCount=0,Ii.flowing=!1,ai&&ai.emit("unpipe",this,oi),this);if(!ai){var ei=Ii.pipes,ii=Ii.pipesCount;Ii.pipes=null,Ii.pipesCount=0,Ii.flowing=!1;for(var si=0;si<ii;si++)ei[si].emit("unpipe",this,{hasUnpiped:!1});return this}var zi=bi(Ii.pipes,ai);return zi===-1?this:(Ii.pipes.splice(zi,1),Ii.pipesCount-=1,Ii.pipesCount===1&&(Ii.pipes=Ii.pipes[0]),ai.emit("unpipe",this,oi),this)},jt.prototype.on=function(ai,Ii){var oi=Ce.prototype.on.call(this,ai,Ii),ei=this._readableState;return ai==="data"?(ei.readableListening=this.listenerCount("readable")>0,ei.flowing!==!1&&this.resume()):ai==="readable"&&!ei.endEmitted&&!ei.readableListening&&(ei.readableListening=ei.needReadable=!0,ei.flowing=!1,ei.emittedReadable=!1,de("on readable",ei.length,ei.reading),ei.length?gi(this):ei.reading||k.nextTick(wi,this)),oi},jt.prototype.addListener=jt.prototype.on,jt.prototype.removeListener=function(ai,Ii){var oi=Ce.prototype.removeListener.call(this,ai,Ii);return ai==="readable"&&k.nextTick(yi,this),oi},jt.prototype.removeAllListeners=function(ai){var Ii=Ce.prototype.removeAllListeners.apply(this,arguments);return(ai==="readable"||ai===void 0)&&k.nextTick(yi,this),Ii};function yi(ai){var Ii=ai._readableState;Ii.readableListening=ai.listenerCount("readable")>0,Ii.resumeScheduled&&!Ii.paused?Ii.flowing=!0:ai.listenerCount("data")>0&&ai.resume()}function wi(ai){de("readable nexttick read 0"),ai.read(0)}jt.prototype.resume=function(){var ai=this._readableState;return ai.flowing||(de("resume"),ai.flowing=!ai.readableListening,li(this,ai)),ai.paused=!1,this};function li(ai,Ii){Ii.resumeScheduled||(Ii.resumeScheduled=!0,k.nextTick(fi,ai,Ii))}function fi(ai,Ii){de("resume",Ii.reading),Ii.reading||ai.read(0),Ii.resumeScheduled=!1,ai.emit("resume"),Mi(ai),Ii.flowing&&!Ii.reading&&ai.read(0)}jt.prototype.pause=function(){return de("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(de("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Mi(ai){var Ii=ai._readableState;for(de("flow",Ii.flowing);Ii.flowing&&ai.read()!==null;);}jt.prototype.wrap=function(ai){var Ii=this,oi=this._readableState,ei=!1;ai.on("end",function(){if(de("wrapped end"),oi.decoder&&!oi.ended){var zi=oi.decoder.end();zi&&zi.length&&Ii.push(zi)}Ii.push(null)}),ai.on("data",function(zi){if(de("wrapped data"),oi.decoder&&(zi=oi.decoder.write(zi)),!(oi.objectMode&&zi==null)&&!(!oi.objectMode&&(!zi||!zi.length))){var mi=Ii.push(zi);mi||(ei=!0,ai.pause())}});for(var ii in ai)this[ii]===void 0&&typeof ai[ii]=="function"&&(this[ii]=function(mi){return function(){return ai[mi].apply(ai,arguments)}}(ii));for(var si=0;si<qe.length;si++)ai.on(qe[si],this.emit.bind(this,qe[si]));return this._read=function(zi){de("wrapped _read",zi),ei&&(ei=!1,ai.resume())},this},typeof Symbol=="function"&&(jt.prototype[Symbol.asyncIterator]=function(){return Ue===void 0&&(Ue=r("./internal/streams/async_iterator")),Ue(this)}),Object.defineProperty(jt.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(jt.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(jt.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(Ii){this._readableState&&(this._readableState.flowing=Ii)}}),jt._fromList=Ni,Object.defineProperty(jt.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function Ni(ai,Ii){if(Ii.length===0)return null;var oi;return Ii.objectMode?oi=Ii.buffer.shift():!ai||ai>=Ii.length?(Ii.decoder?oi=Ii.buffer.join(""):Ii.buffer.length===1?oi=Ii.buffer.first():oi=Ii.buffer.concat(Ii.length),Ii.buffer.clear()):oi=Ii.buffer.consume(ai,Ii.decoder),oi}function pi(ai){var Ii=ai._readableState;de("endReadable",Ii.endEmitted),Ii.endEmitted||(Ii.ended=!0,k.nextTick(vi,Ii,ai))}function vi(ai,Ii){if(de("endReadableNT",ai.endEmitted,ai.length),!ai.endEmitted&&ai.length===0&&(ai.endEmitted=!0,Ii.readable=!1,Ii.emit("end"),ai.autoDestroy)){var oi=Ii._writableState;(!oi||oi.autoDestroy&&oi.finished)&&Ii.destroy()}}typeof Symbol=="function"&&(jt.from=function(ai,Ii){return xe===void 0&&(xe=r("./internal/streams/from")),xe(jt,ai,Ii)});function bi(ai,Ii){for(var oi=0,ei=ai.length;oi<ei;oi++)if(ai[oi]===Ii)return oi;return-1}}).call(this)}).call(this,r("_process"),typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/async_iterator":61,"./internal/streams/buffer_list":62,"./internal/streams/destroy":63,"./internal/streams/from":65,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,events:22,inherits:24,"string_decoder/":75,util:16}],59:[function(r,g,V){g.exports=le;var k=r("../errors").codes,$=k.ERR_METHOD_NOT_IMPLEMENTED,oe=k.ERR_MULTIPLE_CALLBACK,re=k.ERR_TRANSFORM_ALREADY_TRANSFORMING,Ce=k.ERR_TRANSFORM_WITH_LENGTH_0,ie=r("./_stream_duplex");r("inherits")(le,ie);function ae(de,Ne){var he=this._transformState;he.transforming=!1;var ze=he.writecb;if(ze===null)return this.emit("error",new oe);he.writechunk=null,he.writecb=null,Ne!=null&&this.push(Ne),ze(de);var pe=this._readableState;pe.reading=!1,(pe.needReadable||pe.length<pe.highWaterMark)&&this._read(pe.highWaterMark)}function le(de){if(!(this instanceof le))return new le(de);ie.call(this,de),this._transformState={afterTransform:ae.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,de&&(typeof de.transform=="function"&&(this._transform=de.transform),typeof de.flush=="function"&&(this._flush=de.flush)),this.on("prefinish",Ie)}function Ie(){var de=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(Ne,he){ue(de,Ne,he)}):ue(this,null,null)}le.prototype.push=function(de,Ne){return this._transformState.needTransform=!1,ie.prototype.push.call(this,de,Ne)},le.prototype._transform=function(de,Ne,he){he(new $("_transform()"))},le.prototype._write=function(de,Ne,he){var ze=this._transformState;if(ze.writecb=he,ze.writechunk=de,ze.writeencoding=Ne,!ze.transforming){var pe=this._readableState;(ze.needTransform||pe.needReadable||pe.length<pe.highWaterMark)&&this._read(pe.highWaterMark)}},le.prototype._read=function(de){var Ne=this._transformState;Ne.writechunk!==null&&!Ne.transforming?(Ne.transforming=!0,this._transform(Ne.writechunk,Ne.writeencoding,Ne.afterTransform)):Ne.needTransform=!0},le.prototype._destroy=function(de,Ne){ie.prototype._destroy.call(this,de,function(he){Ne(he)})};function ue(de,Ne,he){if(Ne)return de.emit("error",Ne);if(he!=null&&de.push(he),de._writableState.length)throw new Ce;if(de._transformState.transforming)throw new re;return de.push(null)}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(r,g,V){(function(k,$){(function(){g.exports=Et;function oe(Mi){var Ni=this;this.next=null,this.entry=null,this.finish=function(){fi(Ni,Mi)}}var re;Et.WritableState=qe;var Ce={deprecate:r("util-deprecate")},ie=r("./internal/streams/stream"),ae=r("buffer").Buffer,le=$.Uint8Array||function(){};function Ie(Mi){return ae.from(Mi)}function ue(Mi){return ae.isBuffer(Mi)||Mi instanceof le}var de=r("./internal/streams/destroy"),Ne=r("./internal/streams/state"),he=Ne.getHighWaterMark,ze=r("../errors").codes,pe=ze.ERR_INVALID_ARG_TYPE,Ve=ze.ERR_METHOD_NOT_IMPLEMENTED,Oe=ze.ERR_MULTIPLE_CALLBACK,_e=ze.ERR_STREAM_CANNOT_PIPE,At=ze.ERR_STREAM_DESTROYED,$e=ze.ERR_STREAM_NULL_VALUES,Fe=ze.ERR_STREAM_WRITE_AFTER_END,Ue=ze.ERR_UNKNOWN_ENCODING,xe=de.errorOrDestroy;r("inherits")(Et,ie);function Dt(){}function qe(Mi,Ni,pi){re=re||r("./_stream_duplex"),Mi=Mi||{},typeof pi!="boolean"&&(pi=Ni instanceof re),this.objectMode=!!Mi.objectMode,pi&&(this.objectMode=this.objectMode||!!Mi.writableObjectMode),this.highWaterMark=he(this,Mi,"writableHighWaterMark",pi),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var vi=Mi.decodeStrings===!1;this.decodeStrings=!vi,this.defaultEncoding=Mi.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(bi){Ci(Ni,bi)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Mi.emitClose!==!1,this.autoDestroy=!!Mi.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new oe(this)}qe.prototype.getBuffer=function(){for(var Ni=this.bufferedRequest,pi=[];Ni;)pi.push(Ni),Ni=Ni.next;return pi},function(){try{Object.defineProperty(qe.prototype,"buffer",{get:Ce.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var kt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(kt=Function.prototype[Symbol.hasInstance],Object.defineProperty(Et,Symbol.hasInstance,{value:function(Ni){return kt.call(this,Ni)?!0:this!==Et?!1:Ni&&Ni._writableState instanceof qe}})):kt=function(Ni){return Ni instanceof this};function Et(Mi){re=re||r("./_stream_duplex");var Ni=this instanceof re;if(!Ni&&!kt.call(Et,this))return new Et(Mi);this._writableState=new qe(Mi,this,Ni),this.writable=!0,Mi&&(typeof Mi.write=="function"&&(this._write=Mi.write),typeof Mi.writev=="function"&&(this._writev=Mi.writev),typeof Mi.destroy=="function"&&(this._destroy=Mi.destroy),typeof Mi.final=="function"&&(this._final=Mi.final)),ie.call(this)}Et.prototype.pipe=function(){xe(this,new _e)};function jt(Mi,Ni){var pi=new Fe;xe(Mi,pi),k.nextTick(Ni,pi)}function ti(Mi,Ni,pi,vi){var bi;return pi===null?bi=new $e:typeof pi!="string"&&!Ni.objectMode&&(bi=new pe("chunk",["string","Buffer"],pi)),bi?(xe(Mi,bi),k.nextTick(vi,bi),!1):!0}Et.prototype.write=function(Mi,Ni,pi){var vi=this._writableState,bi=!1,ai=!vi.objectMode&&ue(Mi);return ai&&!ae.isBuffer(Mi)&&(Mi=Ie(Mi)),typeof Ni=="function"&&(pi=Ni,Ni=null),ai?Ni="buffer":Ni||(Ni=vi.defaultEncoding),typeof pi!="function"&&(pi=Dt),vi.ending?jt(this,pi):(ai||ti(this,vi,Mi,pi))&&(vi.pendingcb++,bi=Pt(this,vi,ai,Mi,Ni,pi)),bi},Et.prototype.cork=function(){this._writableState.corked++},Et.prototype.uncork=function(){var Mi=this._writableState;Mi.corked&&(Mi.corked--,!Mi.writing&&!Mi.corked&&!Mi.bufferProcessing&&Mi.bufferedRequest&&hi(this,Mi))},Et.prototype.setDefaultEncoding=function(Ni){if(typeof Ni=="string"&&(Ni=Ni.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Ni+"").toLowerCase())>-1))throw new Ue(Ni);return this._writableState.defaultEncoding=Ni,this},Object.defineProperty(Et.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Lt(Mi,Ni,pi){return!Mi.objectMode&&Mi.decodeStrings!==!1&&typeof Ni=="string"&&(Ni=ae.from(Ni,pi)),Ni}Object.defineProperty(Et.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Pt(Mi,Ni,pi,vi,bi,ai){if(!pi){var Ii=Lt(Ni,vi,bi);vi!==Ii&&(pi=!0,bi="buffer",vi=Ii)}var oi=Ni.objectMode?1:vi.length;Ni.length+=oi;var ei=Ni.length<Ni.highWaterMark;if(ei||(Ni.needDrain=!0),Ni.writing||Ni.corked){var ii=Ni.lastBufferedRequest;Ni.lastBufferedRequest={chunk:vi,encoding:bi,isBuf:pi,callback:ai,next:null},ii?ii.next=Ni.lastBufferedRequest:Ni.bufferedRequest=Ni.lastBufferedRequest,Ni.bufferedRequestCount+=1}else ni(Mi,Ni,!1,oi,vi,bi,ai);return ei}function ni(Mi,Ni,pi,vi,bi,ai,Ii){Ni.writelen=vi,Ni.writecb=Ii,Ni.writing=!0,Ni.sync=!0,Ni.destroyed?Ni.onwrite(new At("write")):pi?Mi._writev(bi,Ni.onwrite):Mi._write(bi,ai,Ni.onwrite),Ni.sync=!1}function ri(Mi,Ni,pi,vi,bi){--Ni.pendingcb,pi?(k.nextTick(bi,vi),k.nextTick(wi,Mi,Ni),Mi._writableState.errorEmitted=!0,xe(Mi,vi)):(bi(vi),Mi._writableState.errorEmitted=!0,xe(Mi,vi),wi(Mi,Ni))}function ui(Mi){Mi.writing=!1,Mi.writecb=null,Mi.length-=Mi.writelen,Mi.writelen=0}function Ci(Mi,Ni){var pi=Mi._writableState,vi=pi.sync,bi=pi.writecb;if(typeof bi!="function")throw new Oe;if(ui(pi),Ni)ri(Mi,pi,vi,Ni,bi);else{var ai=ci(pi)||Mi.destroyed;!ai&&!pi.corked&&!pi.bufferProcessing&&pi.bufferedRequest&&hi(Mi,pi),vi?k.nextTick(gi,Mi,pi,ai,bi):gi(Mi,pi,ai,bi)}}function gi(Mi,Ni,pi,vi){pi||di(Mi,Ni),Ni.pendingcb--,vi(),wi(Mi,Ni)}function di(Mi,Ni){Ni.length===0&&Ni.needDrain&&(Ni.needDrain=!1,Mi.emit("drain"))}function hi(Mi,Ni){Ni.bufferProcessing=!0;var pi=Ni.bufferedRequest;if(Mi._writev&&pi&&pi.next){var vi=Ni.bufferedRequestCount,bi=new Array(vi),ai=Ni.corkedRequestsFree;ai.entry=pi;for(var Ii=0,oi=!0;pi;)bi[Ii]=pi,pi.isBuf||(oi=!1),pi=pi.next,Ii+=1;bi.allBuffers=oi,ni(Mi,Ni,!0,Ni.length,bi,"",ai.finish),Ni.pendingcb++,Ni.lastBufferedRequest=null,ai.next?(Ni.corkedRequestsFree=ai.next,ai.next=null):Ni.corkedRequestsFree=new oe(Ni),Ni.bufferedRequestCount=0}else{for(;pi;){var ei=pi.chunk,ii=pi.encoding,si=pi.callback,zi=Ni.objectMode?1:ei.length;if(ni(Mi,Ni,!1,zi,ei,ii,si),pi=pi.next,Ni.bufferedRequestCount--,Ni.writing)break}pi===null&&(Ni.lastBufferedRequest=null)}Ni.bufferedRequest=pi,Ni.bufferProcessing=!1}Et.prototype._write=function(Mi,Ni,pi){pi(new Ve("_write()"))},Et.prototype._writev=null,Et.prototype.end=function(Mi,Ni,pi){var vi=this._writableState;return typeof Mi=="function"?(pi=Mi,Mi=null,Ni=null):typeof Ni=="function"&&(pi=Ni,Ni=null),Mi!=null&&this.write(Mi,Ni),vi.corked&&(vi.corked=1,this.uncork()),vi.ending||li(this,vi,pi),this},Object.defineProperty(Et.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function ci(Mi){return Mi.ending&&Mi.length===0&&Mi.bufferedRequest===null&&!Mi.finished&&!Mi.writing}function Ai(Mi,Ni){Mi._final(function(pi){Ni.pendingcb--,pi&&xe(Mi,pi),Ni.prefinished=!0,Mi.emit("prefinish"),wi(Mi,Ni)})}function yi(Mi,Ni){!Ni.prefinished&&!Ni.finalCalled&&(typeof Mi._final=="function"&&!Ni.destroyed?(Ni.pendingcb++,Ni.finalCalled=!0,k.nextTick(Ai,Mi,Ni)):(Ni.prefinished=!0,Mi.emit("prefinish")))}function wi(Mi,Ni){var pi=ci(Ni);if(pi&&(yi(Mi,Ni),Ni.pendingcb===0&&(Ni.finished=!0,Mi.emit("finish"),Ni.autoDestroy))){var vi=Mi._readableState;(!vi||vi.autoDestroy&&vi.endEmitted)&&Mi.destroy()}return pi}function li(Mi,Ni,pi){Ni.ending=!0,wi(Mi,Ni),pi&&(Ni.finished?k.nextTick(pi):Mi.once("finish",pi)),Ni.ended=!0,Mi.writable=!1}function fi(Mi,Ni,pi){var vi=Mi.entry;for(Mi.entry=null;vi;){var bi=vi.callback;Ni.pendingcb--,bi(pi),vi=vi.next}Ni.corkedRequestsFree.next=Mi}Object.defineProperty(Et.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(Ni){this._writableState&&(this._writableState.destroyed=Ni)}}),Et.prototype.destroy=de.destroy,Et.prototype._undestroy=de.undestroy,Et.prototype._destroy=function(Mi,Ni){Ni(Mi)}}).call(this)}).call(this,r("_process"),typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/destroy":63,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,inherits:24,"util-deprecate":78}],61:[function(r,g,V){(function(k){(function(){var $;function oe(At,$e,Fe){return $e in At?Object.defineProperty(At,$e,{value:Fe,enumerable:!0,configurable:!0,writable:!0}):At[$e]=Fe,At}var re=r("./end-of-stream"),Ce=Symbol("lastResolve"),ie=Symbol("lastReject"),ae=Symbol("error"),le=Symbol("ended"),Ie=Symbol("lastPromise"),ue=Symbol("handlePromise"),de=Symbol("stream");function Ne(At,$e){return{value:At,done:$e}}function he(At){var $e=At[Ce];if($e!==null){var Fe=At[de].read();Fe!==null&&(At[Ie]=null,At[Ce]=null,At[ie]=null,$e(Ne(Fe,!1)))}}function ze(At){k.nextTick(he,At)}function pe(At,$e){return function(Fe,Ue){At.then(function(){if($e[le]){Fe(Ne(void 0,!0));return}$e[ue](Fe,Ue)},Ue)}}var Ve=Object.getPrototypeOf(function(){}),Oe=Object.setPrototypeOf(($={get stream(){return this[de]},next:function(){var $e=this,Fe=this[ae];if(Fe!==null)return Promise.reject(Fe);if(this[le])return Promise.resolve(Ne(void 0,!0));if(this[de].destroyed)return new Promise(function(qe,kt){k.nextTick(function(){$e[ae]?kt($e[ae]):qe(Ne(void 0,!0))})});var Ue=this[Ie],xe;if(Ue)xe=new Promise(pe(Ue,this));else{var Dt=this[de].read();if(Dt!==null)return Promise.resolve(Ne(Dt,!1));xe=new Promise(this[ue])}return this[Ie]=xe,xe}},oe($,Symbol.asyncIterator,function(){return this}),oe($,"return",function(){var $e=this;return new Promise(function(Fe,Ue){$e[de].destroy(null,function(xe){if(xe){Ue(xe);return}Fe(Ne(void 0,!0))})})}),$),Ve),_e=function($e){var Fe,Ue=Object.create(Oe,(Fe={},oe(Fe,de,{value:$e,writable:!0}),oe(Fe,Ce,{value:null,writable:!0}),oe(Fe,ie,{value:null,writable:!0}),oe(Fe,ae,{value:null,writable:!0}),oe(Fe,le,{value:$e._readableState.endEmitted,writable:!0}),oe(Fe,ue,{value:function(Dt,qe){var kt=Ue[de].read();kt?(Ue[Ie]=null,Ue[Ce]=null,Ue[ie]=null,Dt(Ne(kt,!1))):(Ue[Ce]=Dt,Ue[ie]=qe)},writable:!0}),Fe));return Ue[Ie]=null,re($e,function(xe){if(xe&&xe.code!=="ERR_STREAM_PREMATURE_CLOSE"){var Dt=Ue[ie];Dt!==null&&(Ue[Ie]=null,Ue[Ce]=null,Ue[ie]=null,Dt(xe)),Ue[ae]=xe;return}var qe=Ue[Ce];qe!==null&&(Ue[Ie]=null,Ue[Ce]=null,Ue[ie]=null,qe(Ne(void 0,!0))),Ue[le]=!0}),$e.on("readable",ze.bind(null,Ue)),Ue};g.exports=_e}).call(this)}).call(this,r("_process"))},{"./end-of-stream":64,_process:50}],62:[function(r,g,V){function k(he,ze){var pe=Object.keys(he);if(Object.getOwnPropertySymbols){var Ve=Object.getOwnPropertySymbols(he);ze&&(Ve=Ve.filter(function(Oe){return Object.getOwnPropertyDescriptor(he,Oe).enumerable})),pe.push.apply(pe,Ve)}return pe}function $(he){for(var ze=1;ze<arguments.length;ze++){var pe=arguments[ze]!=null?arguments[ze]:{};ze%2?k(Object(pe),!0).forEach(function(Ve){oe(he,Ve,pe[Ve])}):Object.getOwnPropertyDescriptors?Object.defineProperties(he,Object.getOwnPropertyDescriptors(pe)):k(Object(pe)).forEach(function(Ve){Object.defineProperty(he,Ve,Object.getOwnPropertyDescriptor(pe,Ve))})}return he}function oe(he,ze,pe){return ze in he?Object.defineProperty(he,ze,{value:pe,enumerable:!0,configurable:!0,writable:!0}):he[ze]=pe,he}function re(he,ze){if(!(he instanceof ze))throw new TypeError("Cannot call a class as a function")}function Ce(he,ze){for(var pe=0;pe<ze.length;pe++){var Ve=ze[pe];Ve.enumerable=Ve.enumerable||!1,Ve.configurable=!0,"value"in Ve&&(Ve.writable=!0),Object.defineProperty(he,Ve.key,Ve)}}function ie(he,ze,pe){return ze&&Ce(he.prototype,ze),pe&&Ce(he,pe),he}var ae=r("buffer"),le=ae.Buffer,Ie=r("util"),ue=Ie.inspect,de=ue&&ue.custom||"inspect";function Ne(he,ze,pe){le.prototype.copy.call(he,ze,pe)}g.exports=function(){function he(){re(this,he),this.head=null,this.tail=null,this.length=0}return ie(he,[{key:"push",value:function(pe){var Ve={data:pe,next:null};this.length>0?this.tail.next=Ve:this.head=Ve,this.tail=Ve,++this.length}},{key:"unshift",value:function(pe){var Ve={data:pe,next:this.head};this.length===0&&(this.tail=Ve),this.head=Ve,++this.length}},{key:"shift",value:function(){if(this.length!==0){var pe=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,pe}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(pe){if(this.length===0)return"";for(var Ve=this.head,Oe=""+Ve.data;Ve=Ve.next;)Oe+=pe+Ve.data;return Oe}},{key:"concat",value:function(pe){if(this.length===0)return le.alloc(0);for(var Ve=le.allocUnsafe(pe>>>0),Oe=this.head,_e=0;Oe;)Ne(Oe.data,Ve,_e),_e+=Oe.data.length,Oe=Oe.next;return Ve}},{key:"consume",value:function(pe,Ve){var Oe;return pe<this.head.data.length?(Oe=this.head.data.slice(0,pe),this.head.data=this.head.data.slice(pe)):pe===this.head.data.length?Oe=this.shift():Oe=Ve?this._getString(pe):this._getBuffer(pe),Oe}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(pe){var Ve=this.head,Oe=1,_e=Ve.data;for(pe-=_e.length;Ve=Ve.next;){var At=Ve.data,$e=pe>At.length?At.length:pe;if($e===At.length?_e+=At:_e+=At.slice(0,pe),pe-=$e,pe===0){$e===At.length?(++Oe,Ve.next?this.head=Ve.next:this.head=this.tail=null):(this.head=Ve,Ve.data=At.slice($e));break}++Oe}return this.length-=Oe,_e}},{key:"_getBuffer",value:function(pe){var Ve=le.allocUnsafe(pe),Oe=this.head,_e=1;for(Oe.data.copy(Ve),pe-=Oe.data.length;Oe=Oe.next;){var At=Oe.data,$e=pe>At.length?At.length:pe;if(At.copy(Ve,Ve.length-pe,0,$e),pe-=$e,pe===0){$e===At.length?(++_e,Oe.next?this.head=Oe.next:this.head=this.tail=null):(this.head=Oe,Oe.data=At.slice($e));break}++_e}return this.length-=_e,Ve}},{key:de,value:function(pe,Ve){return ue(this,$({},Ve,{depth:0,customInspect:!1}))}}]),he}()},{buffer:17,util:16}],63:[function(r,g,V){(function(k){(function(){function $(le,Ie){var ue=this,de=this._readableState&&this._readableState.destroyed,Ne=this._writableState&&this._writableState.destroyed;return de||Ne?(Ie?Ie(le):le&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,k.nextTick(ie,this,le)):k.nextTick(ie,this,le)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(le||null,function(he){!Ie&&he?ue._writableState?ue._writableState.errorEmitted?k.nextTick(re,ue):(ue._writableState.errorEmitted=!0,k.nextTick(oe,ue,he)):k.nextTick(oe,ue,he):Ie?(k.nextTick(re,ue),Ie(he)):k.nextTick(re,ue)}),this)}function oe(le,Ie){ie(le,Ie),re(le)}function re(le){le._writableState&&!le._writableState.emitClose||le._readableState&&!le._readableState.emitClose||le.emit("close")}function Ce(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function ie(le,Ie){le.emit("error",Ie)}function ae(le,Ie){var ue=le._readableState,de=le._writableState;ue&&ue.autoDestroy||de&&de.autoDestroy?le.destroy(Ie):le.emit("error",Ie)}g.exports={destroy:$,undestroy:Ce,errorOrDestroy:ae}}).call(this)}).call(this,r("_process"))},{_process:50}],64:[function(r,g,V){var k=r("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function $(ie){var ae=!1;return function(){if(!ae){ae=!0;for(var le=arguments.length,Ie=new Array(le),ue=0;ue<le;ue++)Ie[ue]=arguments[ue];ie.apply(this,Ie)}}}function oe(){}function re(ie){return ie.setHeader&&typeof ie.abort=="function"}function Ce(ie,ae,le){if(typeof ae=="function")return Ce(ie,null,ae);ae||(ae={}),le=$(le||oe);var Ie=ae.readable||ae.readable!==!1&&ie.readable,ue=ae.writable||ae.writable!==!1&&ie.writable,de=function(){ie.writable||he()},Ne=ie._writableState&&ie._writableState.finished,he=function(){ue=!1,Ne=!0,Ie||le.call(ie)},ze=ie._readableState&&ie._readableState.endEmitted,pe=function(){Ie=!1,ze=!0,ue||le.call(ie)},Ve=function($e){le.call(ie,$e)},Oe=function(){var $e;if(Ie&&!ze)return(!ie._readableState||!ie._readableState.ended)&&($e=new k),le.call(ie,$e);if(ue&&!Ne)return(!ie._writableState||!ie._writableState.ended)&&($e=new k),le.call(ie,$e)},_e=function(){ie.req.on("finish",he)};return re(ie)?(ie.on("complete",he),ie.on("abort",Oe),ie.req?_e():ie.on("request",_e)):ue&&!ie._writableState&&(ie.on("end",de),ie.on("close",de)),ie.on("end",pe),ie.on("finish",he),ae.error!==!1&&ie.on("error",Ve),ie.on("close",Oe),function(){ie.removeListener("complete",he),ie.removeListener("abort",Oe),ie.removeListener("request",_e),ie.req&&ie.req.removeListener("finish",he),ie.removeListener("end",de),ie.removeListener("close",de),ie.removeListener("finish",he),ie.removeListener("end",pe),ie.removeListener("error",Ve),ie.removeListener("close",Oe)}}g.exports=Ce},{"../../../errors":55}],65:[function(r,g,V){g.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(r,g,V){var k;function $(he){var ze=!1;return function(){ze||(ze=!0,he.apply(void 0,arguments))}}var oe=r("../../../errors").codes,re=oe.ERR_MISSING_ARGS,Ce=oe.ERR_STREAM_DESTROYED;function ie(he){if(he)throw he}function ae(he){return he.setHeader&&typeof he.abort=="function"}function le(he,ze,pe,Ve){Ve=$(Ve);var Oe=!1;he.on("close",function(){Oe=!0}),k===void 0&&(k=r("./end-of-stream")),k(he,{readable:ze,writable:pe},function(At){if(At)return Ve(At);Oe=!0,Ve()});var _e=!1;return function(At){if(!Oe&&!_e){if(_e=!0,ae(he))return he.abort();if(typeof he.destroy=="function")return he.destroy();Ve(At||new Ce("pipe"))}}}function Ie(he){he()}function ue(he,ze){return he.pipe(ze)}function de(he){return!he.length||typeof he[he.length-1]!="function"?ie:he.pop()}function Ne(){for(var he=arguments.length,ze=new Array(he),pe=0;pe<he;pe++)ze[pe]=arguments[pe];var Ve=de(ze);if(Array.isArray(ze[0])&&(ze=ze[0]),ze.length<2)throw new re("streams");var Oe,_e=ze.map(function(At,$e){var Fe=$e<ze.length-1,Ue=$e>0;return le(At,Fe,Ue,function(xe){Oe||(Oe=xe),xe&&_e.forEach(Ie),!Fe&&(_e.forEach(Ie),Ve(Oe))})});return ze.reduce(ue)}g.exports=Ne},{"../../../errors":55,"./end-of-stream":64}],67:[function(r,g,V){var k=r("../../../errors").codes.ERR_INVALID_OPT_VALUE;function $(re,Ce,ie){return re.highWaterMark!=null?re.highWaterMark:Ce?re[ie]:null}function oe(re,Ce,ie,ae){var le=$(Ce,ae,ie);if(le!=null){if(!(isFinite(le)&&Math.floor(le)===le)||le<0){var Ie=ae?ie:"highWaterMark";throw new k(Ie,le)}return Math.floor(le)}return re.objectMode?16:16*1024}g.exports={getHighWaterMark:oe}},{"../../../errors":55}],68:[function(r,g,V){g.exports=r("events").EventEmitter},{events:22}],69:[function(r,g,V){V=g.exports=r("./lib/_stream_readable.js"),V.Stream=V,V.Readable=V,V.Writable=r("./lib/_stream_writable.js"),V.Duplex=r("./lib/_stream_duplex.js"),V.Transform=r("./lib/_stream_transform.js"),V.PassThrough=r("./lib/_stream_passthrough.js"),V.finished=r("./lib/internal/streams/end-of-stream.js"),V.pipeline=r("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":56,"./lib/_stream_passthrough.js":57,"./lib/_stream_readable.js":58,"./lib/_stream_transform.js":59,"./lib/_stream_writable.js":60,"./lib/internal/streams/end-of-stream.js":64,"./lib/internal/streams/pipeline.js":66}],70:[function(r,g,V){function k(oe,re,Ce){var ie=this;this._callback=oe,this._args=Ce,this._interval=setInterval(oe,re,this._args),this.reschedule=function(ae){ae||(ae=ie._interval),ie._interval&&clearInterval(ie._interval),ie._interval=setInterval(ie._callback,ae,ie._args)},this.clear=function(){ie._interval&&(clearInterval(ie._interval),ie._interval=void 0)},this.destroy=function(){ie._interval&&clearInterval(ie._interval),ie._callback=void 0,ie._interval=void 0,ie._args=void 0}}function $(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("interval needed");var oe;if(arguments.length>0){oe=new Array(arguments.length-2);for(var re=0;re<oe.length;re++)oe[re]=arguments[re+2]}return new k(arguments[0],arguments[1],oe)}g.exports=$},{}],71:[function(r,g,V){g.exports=r("./index.js")()},{"./index.js":72}],72:[function(r,g,V){(function(k){(function(){g.exports=oe;function $(Ce){return Ce instanceof k?k.from(Ce):new Ce.constructor(Ce.buffer.slice(),Ce.byteOffset,Ce.length)}function oe(Ce){if(Ce=Ce||{},Ce.circles)return re(Ce);return Ce.proto?le:ae;function ie(Ie,ue){for(var de=Object.keys(Ie),Ne=new Array(de.length),he=0;he<de.length;he++){var ze=de[he],pe=Ie[ze];typeof pe!="object"||pe===null?Ne[ze]=pe:pe instanceof Date?Ne[ze]=new Date(pe):ArrayBuffer.isView(pe)?Ne[ze]=$(pe):Ne[ze]=ue(pe)}return Ne}function ae(Ie){if(typeof Ie!="object"||Ie===null)return Ie;if(Ie instanceof Date)return new Date(Ie);if(Array.isArray(Ie))return ie(Ie,ae);if(Ie instanceof Map)return new Map(ie(Array.from(Ie),ae));if(Ie instanceof Set)return new Set(ie(Array.from(Ie),ae));var ue={};for(var de in Ie)if(Object.hasOwnProperty.call(Ie,de)!==!1){var Ne=Ie[de];typeof Ne!="object"||Ne===null?ue[de]=Ne:Ne instanceof Date?ue[de]=new Date(Ne):Ne instanceof Map?ue[de]=new Map(ie(Array.from(Ne),ae)):Ne instanceof Set?ue[de]=new Set(ie(Array.from(Ne),ae)):ArrayBuffer.isView(Ne)?ue[de]=$(Ne):ue[de]=ae(Ne)}return ue}function le(Ie){if(typeof Ie!="object"||Ie===null)return Ie;if(Ie instanceof Date)return new Date(Ie);if(Array.isArray(Ie))return ie(Ie,le);if(Ie instanceof Map)return new Map(ie(Array.from(Ie),le));if(Ie instanceof Set)return new Set(ie(Array.from(Ie),le));var ue={};for(var de in Ie){var Ne=Ie[de];typeof Ne!="object"||Ne===null?ue[de]=Ne:Ne instanceof Date?ue[de]=new Date(Ne):Ne instanceof Map?ue[de]=new Map(ie(Array.from(Ne),le)):Ne instanceof Set?ue[de]=new Set(ie(Array.from(Ne),le)):ArrayBuffer.isView(Ne)?ue[de]=$(Ne):ue[de]=le(Ne)}return ue}}function re(Ce){var ie=[],ae=[];return Ce.proto?ue:Ie;function le(de,Ne){for(var he=Object.keys(de),ze=new Array(he.length),pe=0;pe<he.length;pe++){var Ve=he[pe],Oe=de[Ve];if(typeof Oe!="object"||Oe===null)ze[Ve]=Oe;else if(Oe instanceof Date)ze[Ve]=new Date(Oe);else if(ArrayBuffer.isView(Oe))ze[Ve]=$(Oe);else{var _e=ie.indexOf(Oe);_e!==-1?ze[Ve]=ae[_e]:ze[Ve]=Ne(Oe)}}return ze}function Ie(de){if(typeof de!="object"||de===null)return de;if(de instanceof Date)return new Date(de);if(Array.isArray(de))return le(de,Ie);if(de instanceof Map)return new Map(le(Array.from(de),Ie));if(de instanceof Set)return new Set(le(Array.from(de),Ie));var Ne={};ie.push(de),ae.push(Ne);for(var he in de)if(Object.hasOwnProperty.call(de,he)!==!1){var ze=de[he];if(typeof ze!="object"||ze===null)Ne[he]=ze;else if(ze instanceof Date)Ne[he]=new Date(ze);else if(ze instanceof Map)Ne[he]=new Map(le(Array.from(ze),Ie));else if(ze instanceof Set)Ne[he]=new Set(le(Array.from(ze),Ie));else if(ArrayBuffer.isView(ze))Ne[he]=$(ze);else{var pe=ie.indexOf(ze);pe!==-1?Ne[he]=ae[pe]:Ne[he]=Ie(ze)}}return ie.pop(),ae.pop(),Ne}function ue(de){if(typeof de!="object"||de===null)return de;if(de instanceof Date)return new Date(de);if(Array.isArray(de))return le(de,ue);if(de instanceof Map)return new Map(le(Array.from(de),ue));if(de instanceof Set)return new Set(le(Array.from(de),ue));var Ne={};ie.push(de),ae.push(Ne);for(var he in de){var ze=de[he];if(typeof ze!="object"||ze===null)Ne[he]=ze;else if(ze instanceof Date)Ne[he]=new Date(ze);else if(ze instanceof Map)Ne[he]=new Map(le(Array.from(ze),ue));else if(ze instanceof Set)Ne[he]=new Set(le(Array.from(ze),ue));else if(ArrayBuffer.isView(ze))Ne[he]=$(ze);else{var pe=ie.indexOf(ze);pe!==-1?Ne[he]=ae[pe]:Ne[he]=ue(ze)}}return ie.pop(),ae.pop(),Ne}}}).call(this)}).call(this,r("buffer").Buffer)},{buffer:17}],73:[function(r,g,V){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var k=r("buffer"),$=k.Buffer;function oe(Ce,ie){for(var ae in Ce)ie[ae]=Ce[ae]}$.from&&$.alloc&&$.allocUnsafe&&$.allocUnsafeSlow?g.exports=k:(oe(k,V),V.Buffer=re);function re(Ce,ie,ae){return $(Ce,ie,ae)}re.prototype=Object.create($.prototype),oe($,re),re.from=function(Ce,ie,ae){if(typeof Ce=="number")throw new TypeError("Argument must not be a number");return $(Ce,ie,ae)},re.alloc=function(Ce,ie,ae){if(typeof Ce!="number")throw new TypeError("Argument must be a number");var le=$(Ce);return ie!==void 0?typeof ae=="string"?le.fill(ie,ae):le.fill(ie):le.fill(0),le},re.allocUnsafe=function(Ce){if(typeof Ce!="number")throw new TypeError("Argument must be a number");return $(Ce)},re.allocUnsafeSlow=function(Ce){if(typeof Ce!="number")throw new TypeError("Argument must be a number");return k.SlowBuffer(Ce)}},{buffer:17}],74:[function(r,g,V){g.exports=k;function k(oe){var re=oe._readableState;return re?re.objectMode||typeof oe._duplexState=="number"?oe.read():oe.read($(re)):null}function $(oe){return oe.buffer.length?oe.buffer.head?oe.buffer.head.data.length:oe.buffer[0].length:oe.length}},{}],75:[function(r,g,V){var k=r("safe-buffer").Buffer,$=k.isEncoding||function(_e){switch(_e=""+_e,_e&&_e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function oe(_e){if(!_e)return"utf8";for(var At;;)switch(_e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return _e;default:if(At)return;_e=(""+_e).toLowerCase(),At=!0}}function re(_e){var At=oe(_e);if(typeof At!="string"&&(k.isEncoding===$||!$(_e)))throw new Error("Unknown encoding: "+_e);return At||_e}V.StringDecoder=Ce;function Ce(_e){this.encoding=re(_e);var At;switch(this.encoding){case"utf16le":this.text=Ne,this.end=he,At=4;break;case"utf8":this.fillLast=Ie,At=4;break;case"base64":this.text=ze,this.end=pe,At=3;break;default:this.write=Ve,this.end=Oe;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=k.allocUnsafe(At)}Ce.prototype.write=function(_e){if(_e.length===0)return"";var At,$e;if(this.lastNeed){if(At=this.fillLast(_e),At===void 0)return"";$e=this.lastNeed,this.lastNeed=0}else $e=0;return $e<_e.length?At?At+this.text(_e,$e):this.text(_e,$e):At||""},Ce.prototype.end=de,Ce.prototype.text=ue,Ce.prototype.fillLast=function(_e){if(this.lastNeed<=_e.length)return _e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,_e.length),this.lastNeed-=_e.length};function ie(_e){return _e<=127?0:_e>>5===6?2:_e>>4===14?3:_e>>3===30?4:_e>>6===2?-1:-2}function ae(_e,At,$e){var Fe=At.length-1;if(Fe<$e)return 0;var Ue=ie(At[Fe]);return Ue>=0?(Ue>0&&(_e.lastNeed=Ue-1),Ue):--Fe<$e||Ue===-2?0:(Ue=ie(At[Fe]),Ue>=0?(Ue>0&&(_e.lastNeed=Ue-2),Ue):--Fe<$e||Ue===-2?0:(Ue=ie(At[Fe]),Ue>=0?(Ue>0&&(Ue===2?Ue=0:_e.lastNeed=Ue-3),Ue):0))}function le(_e,At,$e){if((At[0]&192)!==128)return _e.lastNeed=0,"�";if(_e.lastNeed>1&&At.length>1){if((At[1]&192)!==128)return _e.lastNeed=1,"�";if(_e.lastNeed>2&&At.length>2&&(At[2]&192)!==128)return _e.lastNeed=2,"�"}}function Ie(_e){var At=this.lastTotal-this.lastNeed,$e=le(this,_e);if($e!==void 0)return $e;if(this.lastNeed<=_e.length)return _e.copy(this.lastChar,At,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_e.copy(this.lastChar,At,0,_e.length),this.lastNeed-=_e.length}function ue(_e,At){var $e=ae(this,_e,At);if(!this.lastNeed)return _e.toString("utf8",At);this.lastTotal=$e;var Fe=_e.length-($e-this.lastNeed);return _e.copy(this.lastChar,0,Fe),_e.toString("utf8",At,Fe)}function de(_e){var At=_e&&_e.length?this.write(_e):"";return this.lastNeed?At+"�":At}function Ne(_e,At){if((_e.length-At)%2===0){var $e=_e.toString("utf16le",At);if($e){var Fe=$e.charCodeAt($e.length-1);if(Fe>=55296&&Fe<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=_e[_e.length-2],this.lastChar[1]=_e[_e.length-1],$e.slice(0,-1)}return $e}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=_e[_e.length-1],_e.toString("utf16le",At,_e.length-1)}function he(_e){var At=_e&&_e.length?this.write(_e):"";if(this.lastNeed){var $e=this.lastTotal-this.lastNeed;return At+this.lastChar.toString("utf16le",0,$e)}return At}function ze(_e,At){var $e=(_e.length-At)%3;return $e===0?_e.toString("base64",At):(this.lastNeed=3-$e,this.lastTotal=3,$e===1?this.lastChar[0]=_e[_e.length-1]:(this.lastChar[0]=_e[_e.length-2],this.lastChar[1]=_e[_e.length-1]),_e.toString("base64",At,_e.length-$e))}function pe(_e){var At=_e&&_e.length?this.write(_e):"";return this.lastNeed?At+this.lastChar.toString("base64",0,3-this.lastNeed):At}function Ve(_e){return _e.toString(this.encoding)}function Oe(_e){return _e&&_e.length?this.write(_e):""}},{"safe-buffer":73}],76:[function(r,g,V){var k=r("punycode"),$=r("./util");V.parse=At,V.resolve=Fe,V.resolveObject=Ue,V.format=$e,V.Url=oe;function oe(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var re=/^([a-z0-9.+-]+:)/i,Ce=/:[0-9]*$/,ie=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,ae=["<",">",'"',"`"," ","\r",`
1156
1156
  `," "],le=["{","}","|","\\","^","`"].concat(ae),Ie=["'"].concat(le),ue=["%","/","?",";","#"].concat(Ie),de=["/","?","#"],Ne=255,he=/^[+a-z0-9A-Z_-]{0,63}$/,ze=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,pe={javascript:!0,"javascript:":!0},Ve={javascript:!0,"javascript:":!0},Oe={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_e=r("querystring");function At(xe,Dt,qe){if(xe&&$.isObject(xe)&&xe instanceof oe)return xe;var kt=new oe;return kt.parse(xe,Dt,qe),kt}oe.prototype.parse=function(xe,Dt,qe){if(!$.isString(xe))throw new TypeError("Parameter 'url' must be a string, not "+typeof xe);var kt=xe.indexOf("?"),Et=kt!==-1&&kt<xe.indexOf("#")?"?":"#",jt=xe.split(Et),ti=/\\/g;jt[0]=jt[0].replace(ti,"/"),xe=jt.join(Et);var Lt=xe;if(Lt=Lt.trim(),!qe&&xe.split("#").length===1){var Pt=ie.exec(Lt);if(Pt)return this.path=Lt,this.href=Lt,this.pathname=Pt[1],Pt[2]?(this.search=Pt[2],Dt?this.query=_e.parse(this.search.substr(1)):this.query=this.search.substr(1)):Dt&&(this.search="",this.query={}),this}var ni=re.exec(Lt);if(ni){ni=ni[0];var ri=ni.toLowerCase();this.protocol=ri,Lt=Lt.substr(ni.length)}if(qe||ni||Lt.match(/^\/\/[^@\/]+@[^@\/]+/)){var ui=Lt.substr(0,2)==="//";ui&&!(ni&&Ve[ni])&&(Lt=Lt.substr(2),this.slashes=!0)}if(!Ve[ni]&&(ui||ni&&!Oe[ni])){for(var Ci=-1,gi=0;gi<de.length;gi++){var di=Lt.indexOf(de[gi]);di!==-1&&(Ci===-1||di<Ci)&&(Ci=di)}var hi,ci;Ci===-1?ci=Lt.lastIndexOf("@"):ci=Lt.lastIndexOf("@",Ci),ci!==-1&&(hi=Lt.slice(0,ci),Lt=Lt.slice(ci+1),this.auth=decodeURIComponent(hi)),Ci=-1;for(var gi=0;gi<ue.length;gi++){var di=Lt.indexOf(ue[gi]);di!==-1&&(Ci===-1||di<Ci)&&(Ci=di)}Ci===-1&&(Ci=Lt.length),this.host=Lt.slice(0,Ci),Lt=Lt.slice(Ci),this.parseHost(),this.hostname=this.hostname||"";var Ai=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!Ai)for(var yi=this.hostname.split(/\./),gi=0,wi=yi.length;gi<wi;gi++){var li=yi[gi];if(li&&!li.match(he)){for(var fi="",Mi=0,Ni=li.length;Mi<Ni;Mi++)li.charCodeAt(Mi)>127?fi+="x":fi+=li[Mi];if(!fi.match(he)){var pi=yi.slice(0,gi),vi=yi.slice(gi+1),bi=li.match(ze);bi&&(pi.push(bi[1]),vi.unshift(bi[2])),vi.length&&(Lt="/"+vi.join(".")+Lt),this.hostname=pi.join(".");break}}}this.hostname.length>Ne?this.hostname="":this.hostname=this.hostname.toLowerCase(),Ai||(this.hostname=k.toASCII(this.hostname));var ai=this.port?":"+this.port:"",Ii=this.hostname||"";this.host=Ii+ai,this.href+=this.host,Ai&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),Lt[0]!=="/"&&(Lt="/"+Lt))}if(!pe[ri])for(var gi=0,wi=Ie.length;gi<wi;gi++){var oi=Ie[gi];if(Lt.indexOf(oi)!==-1){var ei=encodeURIComponent(oi);ei===oi&&(ei=escape(oi)),Lt=Lt.split(oi).join(ei)}}var ii=Lt.indexOf("#");ii!==-1&&(this.hash=Lt.substr(ii),Lt=Lt.slice(0,ii));var si=Lt.indexOf("?");if(si!==-1?(this.search=Lt.substr(si),this.query=Lt.substr(si+1),Dt&&(this.query=_e.parse(this.query)),Lt=Lt.slice(0,si)):Dt&&(this.search="",this.query={}),Lt&&(this.pathname=Lt),Oe[ri]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var ai=this.pathname||"",zi=this.search||"";this.path=ai+zi}return this.href=this.format(),this};function $e(xe){return $.isString(xe)&&(xe=At(xe)),xe instanceof oe?xe.format():oe.prototype.format.call(xe)}oe.prototype.format=function(){var xe=this.auth||"";xe&&(xe=encodeURIComponent(xe),xe=xe.replace(/%3A/i,":"),xe+="@");var Dt=this.protocol||"",qe=this.pathname||"",kt=this.hash||"",Et=!1,jt="";this.host?Et=xe+this.host:this.hostname&&(Et=xe+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(Et+=":"+this.port)),this.query&&$.isObject(this.query)&&Object.keys(this.query).length&&(jt=_e.stringify(this.query));var ti=this.search||jt&&"?"+jt||"";return Dt&&Dt.substr(-1)!==":"&&(Dt+=":"),this.slashes||(!Dt||Oe[Dt])&&Et!==!1?(Et="//"+(Et||""),qe&&qe.charAt(0)!=="/"&&(qe="/"+qe)):Et||(Et=""),kt&&kt.charAt(0)!=="#"&&(kt="#"+kt),ti&&ti.charAt(0)!=="?"&&(ti="?"+ti),qe=qe.replace(/[?#]/g,function(Lt){return encodeURIComponent(Lt)}),ti=ti.replace("#","%23"),Dt+Et+qe+ti+kt};function Fe(xe,Dt){return At(xe,!1,!0).resolve(Dt)}oe.prototype.resolve=function(xe){return this.resolveObject(At(xe,!1,!0)).format()};function Ue(xe,Dt){return xe?At(xe,!1,!0).resolveObject(Dt):Dt}oe.prototype.resolveObject=function(xe){if($.isString(xe)){var Dt=new oe;Dt.parse(xe,!1,!0),xe=Dt}for(var qe=new oe,kt=Object.keys(this),Et=0;Et<kt.length;Et++){var jt=kt[Et];qe[jt]=this[jt]}if(qe.hash=xe.hash,xe.href==="")return qe.href=qe.format(),qe;if(xe.slashes&&!xe.protocol){for(var ti=Object.keys(xe),Lt=0;Lt<ti.length;Lt++){var Pt=ti[Lt];Pt!=="protocol"&&(qe[Pt]=xe[Pt])}return Oe[qe.protocol]&&qe.hostname&&!qe.pathname&&(qe.path=qe.pathname="/"),qe.href=qe.format(),qe}if(xe.protocol&&xe.protocol!==qe.protocol){if(!Oe[xe.protocol]){for(var ni=Object.keys(xe),ri=0;ri<ni.length;ri++){var ui=ni[ri];qe[ui]=xe[ui]}return qe.href=qe.format(),qe}if(qe.protocol=xe.protocol,!xe.host&&!Ve[xe.protocol]){for(var wi=(xe.pathname||"").split("/");wi.length&&!(xe.host=wi.shift()););xe.host||(xe.host=""),xe.hostname||(xe.hostname=""),wi[0]!==""&&wi.unshift(""),wi.length<2&&wi.unshift(""),qe.pathname=wi.join("/")}else qe.pathname=xe.pathname;if(qe.search=xe.search,qe.query=xe.query,qe.host=xe.host||"",qe.auth=xe.auth,qe.hostname=xe.hostname||xe.host,qe.port=xe.port,qe.pathname||qe.search){var Ci=qe.pathname||"",gi=qe.search||"";qe.path=Ci+gi}return qe.slashes=qe.slashes||xe.slashes,qe.href=qe.format(),qe}var di=qe.pathname&&qe.pathname.charAt(0)==="/",hi=xe.host||xe.pathname&&xe.pathname.charAt(0)==="/",ci=hi||di||qe.host&&xe.pathname,Ai=ci,yi=qe.pathname&&qe.pathname.split("/")||[],wi=xe.pathname&&xe.pathname.split("/")||[],li=qe.protocol&&!Oe[qe.protocol];if(li&&(qe.hostname="",qe.port=null,qe.host&&(yi[0]===""?yi[0]=qe.host:yi.unshift(qe.host)),qe.host="",xe.protocol&&(xe.hostname=null,xe.port=null,xe.host&&(wi[0]===""?wi[0]=xe.host:wi.unshift(xe.host)),xe.host=null),ci=ci&&(wi[0]===""||yi[0]==="")),hi)qe.host=xe.host||xe.host===""?xe.host:qe.host,qe.hostname=xe.hostname||xe.hostname===""?xe.hostname:qe.hostname,qe.search=xe.search,qe.query=xe.query,yi=wi;else if(wi.length)yi||(yi=[]),yi.pop(),yi=yi.concat(wi),qe.search=xe.search,qe.query=xe.query;else if(!$.isNullOrUndefined(xe.search)){if(li){qe.hostname=qe.host=yi.shift();var fi=qe.host&&qe.host.indexOf("@")>0?qe.host.split("@"):!1;fi&&(qe.auth=fi.shift(),qe.host=qe.hostname=fi.shift())}return qe.search=xe.search,qe.query=xe.query,(!$.isNull(qe.pathname)||!$.isNull(qe.search))&&(qe.path=(qe.pathname?qe.pathname:"")+(qe.search?qe.search:"")),qe.href=qe.format(),qe}if(!yi.length)return qe.pathname=null,qe.search?qe.path="/"+qe.search:qe.path=null,qe.href=qe.format(),qe;for(var Mi=yi.slice(-1)[0],Ni=(qe.host||xe.host||yi.length>1)&&(Mi==="."||Mi==="..")||Mi==="",pi=0,vi=yi.length;vi>=0;vi--)Mi=yi[vi],Mi==="."?yi.splice(vi,1):Mi===".."?(yi.splice(vi,1),pi++):pi&&(yi.splice(vi,1),pi--);if(!ci&&!Ai)for(;pi--;pi)yi.unshift("..");ci&&yi[0]!==""&&(!yi[0]||yi[0].charAt(0)!=="/")&&yi.unshift(""),Ni&&yi.join("/").substr(-1)!=="/"&&yi.push("");var bi=yi[0]===""||yi[0]&&yi[0].charAt(0)==="/";if(li){qe.hostname=qe.host=bi?"":yi.length?yi.shift():"";var fi=qe.host&&qe.host.indexOf("@")>0?qe.host.split("@"):!1;fi&&(qe.auth=fi.shift(),qe.host=qe.hostname=fi.shift())}return ci=ci||qe.host&&yi.length,ci&&!bi&&yi.unshift(""),yi.length?qe.pathname=yi.join("/"):(qe.pathname=null,qe.path=null),(!$.isNull(qe.pathname)||!$.isNull(qe.search))&&(qe.path=(qe.pathname?qe.pathname:"")+(qe.search?qe.search:"")),qe.auth=xe.auth||qe.auth,qe.slashes=qe.slashes||xe.slashes,qe.href=qe.format(),qe},oe.prototype.parseHost=function(){var xe=this.host,Dt=Ce.exec(xe);Dt&&(Dt=Dt[0],Dt!==":"&&(this.port=Dt.substr(1)),xe=xe.substr(0,xe.length-Dt.length)),xe&&(this.hostname=xe)}},{"./util":77,punycode:51,querystring:54}],77:[function(r,g,V){g.exports={isString:function(k){return typeof k=="string"},isObject:function(k){return typeof k=="object"&&k!==null},isNull:function(k){return k===null},isNullOrUndefined:function(k){return k==null}}},{}],78:[function(r,g,V){(function(k){(function(){g.exports=$;function $(re,Ce){if(oe("noDeprecation"))return re;var ie=!1;function ae(){if(!ie){if(oe("throwDeprecation"))throw new Error(Ce);oe("traceDeprecation")?console.trace(Ce):console.warn(Ce),ie=!0}return re.apply(this,arguments)}return ae}function oe(re){try{if(!k.localStorage)return!1}catch{return!1}var Ce=k.localStorage[re];return Ce==null?!1:String(Ce).toLowerCase()==="true"}}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],79:[function(r,g,V){g.exports=k;function k($,oe){if($&&oe)return k($)(oe);if(typeof $!="function")throw new TypeError("need wrapper function");return Object.keys($).forEach(function(Ce){re[Ce]=$[Ce]}),re;function re(){for(var Ce=new Array(arguments.length),ie=0;ie<Ce.length;ie++)Ce[ie]=arguments[ie];var ae=$.apply(this,Ce),le=Ce[Ce.length-1];return typeof ae=="function"&&ae!==le&&Object.keys(le).forEach(function(Ie){ae[Ie]=le[Ie]}),ae}}},{}],80:[function(r,g,V){g.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],81:[function(r,g,V){g.exports=$;var k=Object.prototype.hasOwnProperty;function $(){for(var oe={},re=0;re<arguments.length;re++){var Ce=arguments[re];for(var ie in Ce)k.call(Ce,ie)&&(oe[ie]=Ce[ie])}return oe}},{}],82:[function(r,g,V){g.exports=function(k){k.prototype[Symbol.iterator]=function*(){for(let $=this.head;$;$=$.next)yield $.value}}},{}],83:[function(r,g,V){g.exports=k,k.Node=Ce,k.create=k;function k(ie){var ae=this;if(ae instanceof k||(ae=new k),ae.tail=null,ae.head=null,ae.length=0,ie&&typeof ie.forEach=="function")ie.forEach(function(ue){ae.push(ue)});else if(arguments.length>0)for(var le=0,Ie=arguments.length;le<Ie;le++)ae.push(arguments[le]);return ae}k.prototype.removeNode=function(ie){if(ie.list!==this)throw new Error("removing node which does not belong to this list");var ae=ie.next,le=ie.prev;return ae&&(ae.prev=le),le&&(le.next=ae),ie===this.head&&(this.head=ae),ie===this.tail&&(this.tail=le),ie.list.length--,ie.next=null,ie.prev=null,ie.list=null,ae},k.prototype.unshiftNode=function(ie){if(ie!==this.head){ie.list&&ie.list.removeNode(ie);var ae=this.head;ie.list=this,ie.next=ae,ae&&(ae.prev=ie),this.head=ie,this.tail||(this.tail=ie),this.length++}},k.prototype.pushNode=function(ie){if(ie!==this.tail){ie.list&&ie.list.removeNode(ie);var ae=this.tail;ie.list=this,ie.prev=ae,ae&&(ae.next=ie),this.tail=ie,this.head||(this.head=ie),this.length++}},k.prototype.push=function(){for(var ie=0,ae=arguments.length;ie<ae;ie++)oe(this,arguments[ie]);return this.length},k.prototype.unshift=function(){for(var ie=0,ae=arguments.length;ie<ae;ie++)re(this,arguments[ie]);return this.length},k.prototype.pop=function(){if(this.tail){var ie=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,ie}},k.prototype.shift=function(){if(this.head){var ie=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,ie}},k.prototype.forEach=function(ie,ae){ae=ae||this;for(var le=this.head,Ie=0;le!==null;Ie++)ie.call(ae,le.value,Ie,this),le=le.next},k.prototype.forEachReverse=function(ie,ae){ae=ae||this;for(var le=this.tail,Ie=this.length-1;le!==null;Ie--)ie.call(ae,le.value,Ie,this),le=le.prev},k.prototype.get=function(ie){for(var ae=0,le=this.head;le!==null&&ae<ie;ae++)le=le.next;if(ae===ie&&le!==null)return le.value},k.prototype.getReverse=function(ie){for(var ae=0,le=this.tail;le!==null&&ae<ie;ae++)le=le.prev;if(ae===ie&&le!==null)return le.value},k.prototype.map=function(ie,ae){ae=ae||this;for(var le=new k,Ie=this.head;Ie!==null;)le.push(ie.call(ae,Ie.value,this)),Ie=Ie.next;return le},k.prototype.mapReverse=function(ie,ae){ae=ae||this;for(var le=new k,Ie=this.tail;Ie!==null;)le.push(ie.call(ae,Ie.value,this)),Ie=Ie.prev;return le},k.prototype.reduce=function(ie,ae){var le,Ie=this.head;if(arguments.length>1)le=ae;else if(this.head)Ie=this.head.next,le=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var ue=0;Ie!==null;ue++)le=ie(le,Ie.value,ue),Ie=Ie.next;return le},k.prototype.reduceReverse=function(ie,ae){var le,Ie=this.tail;if(arguments.length>1)le=ae;else if(this.tail)Ie=this.tail.prev,le=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var ue=this.length-1;Ie!==null;ue--)le=ie(le,Ie.value,ue),Ie=Ie.prev;return le},k.prototype.toArray=function(){for(var ie=new Array(this.length),ae=0,le=this.head;le!==null;ae++)ie[ae]=le.value,le=le.next;return ie},k.prototype.toArrayReverse=function(){for(var ie=new Array(this.length),ae=0,le=this.tail;le!==null;ae++)ie[ae]=le.value,le=le.prev;return ie},k.prototype.slice=function(ie,ae){ae=ae||this.length,ae<0&&(ae+=this.length),ie=ie||0,ie<0&&(ie+=this.length);var le=new k;if(ae<ie||ae<0)return le;ie<0&&(ie=0),ae>this.length&&(ae=this.length);for(var Ie=0,ue=this.head;ue!==null&&Ie<ie;Ie++)ue=ue.next;for(;ue!==null&&Ie<ae;Ie++,ue=ue.next)le.push(ue.value);return le},k.prototype.sliceReverse=function(ie,ae){ae=ae||this.length,ae<0&&(ae+=this.length),ie=ie||0,ie<0&&(ie+=this.length);var le=new k;if(ae<ie||ae<0)return le;ie<0&&(ie=0),ae>this.length&&(ae=this.length);for(var Ie=this.length,ue=this.tail;ue!==null&&Ie>ae;Ie--)ue=ue.prev;for(;ue!==null&&Ie>ie;Ie--,ue=ue.prev)le.push(ue.value);return le},k.prototype.splice=function(ie,ae,...le){ie>this.length&&(ie=this.length-1),ie<0&&(ie=this.length+ie);for(var Ie=0,ue=this.head;ue!==null&&Ie<ie;Ie++)ue=ue.next;for(var de=[],Ie=0;ue&&Ie<ae;Ie++)de.push(ue.value),ue=this.removeNode(ue);ue===null&&(ue=this.tail),ue!==this.head&&ue!==this.tail&&(ue=ue.prev);for(var Ie=0;Ie<le.length;Ie++)ue=$(this,ue,le[Ie]);return de},k.prototype.reverse=function(){for(var ie=this.head,ae=this.tail,le=ie;le!==null;le=le.prev){var Ie=le.prev;le.prev=le.next,le.next=Ie}return this.head=ae,this.tail=ie,this};function $(ie,ae,le){var Ie=ae===ie.head?new Ce(le,null,ae,ie):new Ce(le,ae,ae.next,ie);return Ie.next===null&&(ie.tail=Ie),Ie.prev===null&&(ie.head=Ie),ie.length++,Ie}function oe(ie,ae){ie.tail=new Ce(ae,ie.tail,null,ie),ie.head||(ie.head=ie.tail),ie.length++}function re(ie,ae){ie.head=new Ce(ae,null,ie.head,ie),ie.tail||(ie.tail=ie.head),ie.length++}function Ce(ie,ae,le,Ie){if(!(this instanceof Ce))return new Ce(ie,ae,le,Ie);this.list=Ie,this.value=ie,ae?(ae.next=this,this.prev=ae):this.prev=null,le?(le.prev=this,this.next=le):this.next=null}try{r("./iterator.js")(k)}catch{}},{"./iterator.js":82}]},{},[12])(12)})})(mqtt);var mqttExports=mqtt.exports;let client;const sub=(i,n,r,g,V)=>{client=mqttExports.connect(i,{username:n,password:r}),client.on("connect",()=>{console.log("MQTT服务器连接成功"),console.log(client.options.clientId),client.subscribe(g,{qos:1})}),client.on("message",V)},close=()=>{client&&client.end&&client.end(!0,{},()=>{console.log("MQTT服务连接关闭")})},_hoisted_1=["transform"],_hoisted_2=["transform","onClick"],_hoisted_3=["transform"],_hoisted_4=["xlink:href","id","transform"],_hoisted_5=["id"],_sfc_main=vue.defineComponent({__name:"index",props:{data:{},canvasDrag:{type:Boolean,default:!0}},emits:["onMessage"],setup(i,{expose:n,emit:r}){const g=i;vue.useCssVars(he=>({df1aa048:vue.unref(oe)}));const V=vue.getCurrentInstance();Object.keys(vueComp).forEach(he=>{var ze;Object.keys((ze=V==null?void 0:V.appContext)==null?void 0:ze.components).includes(he)||V==null||V.appContext.app.component(he,vueComp[he])});const k=vue.reactive(g.data??{layout_center:{x:0,y:0},config:{svg:{background_color:"#fff",scale:1,grid_color:"#ebebeb"},net:{mqtt:{url:"",user:"",pwd:"",topics:""}}},done_json:[]}),$=useGlobalStore(pinia),oe=vue.computed(()=>$.intention==EGlobalStoreIntention.MoveCanvas?"grab":"default"),re=he=>{if($.mouse_info.state!=EMouseInfoState.Down&&$.intention!==EGlobalStoreIntention.Connection)return;if(!g.canvasDrag){console.log(g.canvasDrag);return}const{clientX:ze,clientY:pe}=he;$.mouse_info.new_position_x=$.mouse_info.now_position_x+ze-$.mouse_info.position_x,$.mouse_info.new_position_y=$.mouse_info.now_position_y+pe-$.mouse_info.position_y,$.intention==EGlobalStoreIntention.MoveCanvas&&(k.layout_center.x=$.mouse_info.new_position_x,k.layout_center.y=$.mouse_info.new_position_y)},Ce=()=>{$.mouse_info.state==EMouseInfoState.Down&&($.intention!=EGlobalStoreIntention.Select&&($.intention=EGlobalStoreIntention.None),$.mouse_info={state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0})},ie=he=>{const{clientX:ze,clientY:pe}=he;$.intention=EGlobalStoreIntention.MoveCanvas,$.mouse_info={state:EMouseInfoState.Down,position_x:ze,position_y:pe,now_position_x:k.layout_center.x,now_position_y:k.layout_center.y,new_position_x:k.layout_center.x,new_position_y:k.layout_center.y}};function ae(he){he!=null&&he.wheelDelta&&(he.wheelDelta>0?k.config.svg.scale=parseFloat((k.config.svg.scale+.1).toFixed(1)):k.config.svg.scale=parseFloat((k.config.svg.scale-.1).toFixed(1)))}const le=(he,ze,pe)=>({x:he.x-he.width/2*ze+he.width/2,y:he.y-he.height/2*pe+he.height/2,width:he.width*ze,height:he.height*pe}),Ie=(he,ze,pe)=>setArrItemByID(he,ze,pe,k.done_json),ue=he=>{var ze;if(((ze=he.events)==null?void 0:ze.length)>0){for(let pe of he.events)if(pe.type===EEventType.Click||pe.type===EEventType.Change){if(pe.condition&&pe.condition.type!=="None"&&pe.condition.type==="Relation"&&pe.condition.Relation&&pe.condition.Relation.relation){const Ve=pe.condition.Relation.key,Oe=pe.condition.Relation.relation,_e=valFormat(pe.condition.Relation.val),At=valFormat(pe.condition.Relation.val2);if(he.props.hasOwnProperty(Ve)){const $e=he.props[Ve].val;if(!de($e,Oe,_e,At))continue}}if(pe.action===EEventAction.ChangeAttr){if(pe.attrs&&pe.attrs.length>0){let Ve;if(pe.target){for(let Oe of $.done_json)if(Oe.id===pe.target){Ve=Oe;break}}else Ve=he;if(!Ve)continue;for(let Oe of pe.attrs)Ve.state&&Ve.state.hasOwnProperty(Oe.key)?Ve.state[Oe.key].default=valFormat(Oe.val):Ve.props.hasOwnProperty(Oe.key)&&(Ve.props[Oe.key].val=valFormat(Oe.val))}}else pe.action===EEventAction.JavaScript&&new Function(pe.scripts)()}}},de=(he,ze,pe,Ve)=>{switch(ze){case">":return he>pe;case">=":return he>=pe;case"<":return he<pe;case"<=":return he<=pe;case"==":return he==pe;case"!=":return he!=pe;case">=,=<":return he>=pe&&he<=Ve;case"<,>":return he<pe||he>Ve}};vue.onMounted(()=>{Ne()}),vue.onBeforeUnmount(close);const Ne=()=>{const he=k.config.net.mqtt;he&&he.url&&he.user&&he.pwd&&he.topics&&sub(he.url,he.user,he.pwd,he.topics,(ze,pe)=>{console.log(ze),console.log(pe.toString()),r("onMessage",{topics:ze,message:pe})})};return n({setNodeAttrByID:Ie}),(he,ze)=>(vue.openBlock(),vue.createElementBlock("div",{class:"canvas",onMousedown:ie,onMousemove:re,onMouseup:Ce,onMousewheel:ae},[(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",style:vue.normalizeStyle({backgroundColor:vue.unref(k).config.svg.background_color}),width:"100%",height:"100%"},[vue.createElementVNode("g",{transform:`translate(${vue.unref(k).layout_center.x},${vue.unref(k).layout_center.y})rotate(0)scale(${vue.unref(k).config.svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(k).done_json,pe=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:pe.id,transform:`translate(${pe.x},${pe.y})rotate(0)scale(1)`,onClick:Ve=>ue(pe)},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(pe)}`)},[vue.createElementVNode("g",{transform:`translate(${pe.actual_bound.x+pe.actual_bound.width/2},${pe.actual_bound.y+pe.actual_bound.height/2})rotate(${pe.rotate}) scale(1) translate(${-(pe.actual_bound.x+pe.actual_bound.width/2)},${-(pe.actual_bound.y+pe.actual_bound.height/2)})`},[pe.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$e,{key:0,"item-info":pe},null,8,["item-info"])):pe.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${pe.name}`},vue.unref(prosToVBind)(pe),{width:"100",height:"100",id:pe.id,transform:`translate(${pe.actual_bound.x+pe.actual_bound.width/2},${pe.actual_bound.y+pe.actual_bound.height/2}) scale(${pe.scale_x},${pe.scale_y}) translate(${-(pe.actual_bound.x+pe.actual_bound.width/2)},${-(pe.actual_bound.y+pe.actual_bound.height/2)})`}),null,16,_hoisted_4)):pe.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(pe.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(pe),{width:"100",height:"100",id:pe.id,onOnChange:Ve=>ue(pe),transform:`translate(${pe.actual_bound.x+pe.actual_bound.width/2},${pe.actual_bound.y+pe.actual_bound.height/2}) scale(${pe.scale_x},${pe.scale_y}) translate(${-(pe.actual_bound.x+pe.actual_bound.width/2)},${-(pe.actual_bound.y+pe.actual_bound.height/2)})`}),null,16,["id","onOnChange","transform"])):pe.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},le(pe.actual_bound,pe.scale_x,pe.scale_y),{id:`foreign-object${pe.id}`}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(pe.tag),vue.mergeProps(vue.unref(prosToVBind)(pe),{id:pe.id,onOnChange:Ve=>ue(pe),transform:`translate(${pe.actual_bound.x+pe.actual_bound.width/2},${pe.actual_bound.y+pe.actual_bound.height/2}) scale(${pe.scale_x},${pe.scale_y}) translate(${-(pe.actual_bound.x+pe.actual_bound.width/2)},${-(pe.actual_bound.y+pe.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(pe.tag_slot),1)]),_:2},1040,["id","onOnChange","transform"]))],16,_hoisted_5)):vue.createCommentVNode("",!0)],8,_hoisted_3)],2)],8,_hoisted_2)),[[vue.vShow,pe.display]])),128))],8,_hoisted_1)],4))],32))}}),index_vue_vue_type_style_index_0_scoped_27739ba5_lang="",index=_export_sfc(_sfc_main,[["__scopeId","data-v-27739ba5"]]);exports.SvgEditor=index$1,exports.SvgViewer=index,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});