@zhangqingcq/vgce 0.0.28 → 0.0.30

Sign up to get free protection for your applications and to get access to all the features.
package/dist/vgce.umd.cjs CHANGED
@@ -1261,4 +1261,4 @@ styles.join("\\n")
1261
1261
  background: #25282c;
1262
1262
  color: #c1c1c1;
1263
1263
  }`,"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($,re,oe){var Ce=0,ie=$.length;ie===0&&oe();for(var ae=0;ae<ie;ae++)re($[ae],function(le,Ie){Ce++,Ce===ie&&oe(le,Ie)})};var k=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;g.retrievePrecedingIdentifier=function($,re,oe){oe=oe||k;for(var Ce=[],ie=re-1;ie>=0&&oe.test($[ie]);ie--)Ce.push($[ie]);return Ce.reverse().join("")},g.retrieveFollowingIdentifier=function($,re,oe){oe=oe||k;for(var Ce=[],ie=re;ie<$.length&&oe.test($[ie]);ie++)Ce.push($[ie]);return Ce},g.getCompletionPrefix=function($){var re=$.getCursorPosition(),oe=$.session.getLine(re.row),Ce;return $.completers.forEach(function(ie){ie.identifierRegexps&&ie.identifierRegexps.forEach(function(ae){!Ce&&ae&&(Ce=this.retrievePrecedingIdentifier(oe,re.column,ae))}.bind(this))}.bind(this)),Ce||this.retrievePrecedingIdentifier(oe,re.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,re=r("./autocomplete/popup").getAriaId,oe=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:re(this.popup.getRow())}),de.keyBinding.addKeyboardHandler(this.keyboardHandler);var pe=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 ze=pe.layerConfig.lineHeight,xe=pe.$cursorLayer.getPixelPosition(this.base,!0);xe.left-=this.popup.getTextLeftOffset();var Oe=de.container.getBoundingClientRect();xe.top+=Oe.top-pe.layerConfig.offset,xe.left+=Oe.left-de.renderer.scrollLeft,xe.left+=pe.gutterWidth,this.popup.show(xe,ze)}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(),pe=de.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(de.relatedTarget),ze=this.popup&&this.popup.container;Ne!=he&&Ne.parentNode!=ze&&!pe&&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 pe=this.editor.selection.getAllRanges(),ze=0,xe;xe=pe[ze];ze++)xe.start.column-=he.filterText.length,this.editor.session.remove(xe);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(),pe=de.getCursorPosition(),ze=oe.getCompletionPrefix(de);this.base=he.doc.createAnchor(pe.row,pe.column-ze.length),this.base.$insertRight=!0;var xe=[],Oe=de.completers.length;return de.completers.forEach(function(_e,At){_e.getCompletions(de,he,pe,ze,function($e,Fe){!$e&&Fe&&(xe=xe.concat(Fe)),Ne(null,{prefix:oe.getCompletionPrefix(de),matches:xe,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(),pe=this.editor.session.getTextRange({start:this.base,end:he});if(pe==this.completions.filterText)return;if(this.completions.setFilter(pe),!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==pe&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,pe,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 ze=this.gatherCompletionsId,xe=function(Fe){if(Fe.finished)return this.detach()}.bind(this),Oe=function(Fe){var Ue=Fe.prefix,Ve=Fe.matches;this.completions=new ue(Ve),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 xe(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 Ve=Ue.prefix,Dt=Ue&&Ue.matches;if(!Dt||!Dt.length)return xe(Ue);if(!(Ve.indexOf(Ue.prefix)!==0||ze!=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()]),pe=null;if(!he||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();if(this.editor.completers.some(function(ze){return ze.getDocTooltip&&(pe=ze.getDocTooltip(he)),pe}),!pe&&typeof he!="string"&&(pe=he),typeof pe=="string"&&(pe={docText:pe}),!pe||!(pe.docHTML||pe.docText))return this.hideDocTooltip();this.showDocTooltip(pe)},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,pe=he.container.getBoundingClientRect();Ne.style.top=he.container.style.top,Ne.style.bottom=he.container.style.bottom,Ne.style.display="block",window.innerWidth-pe.right<320?pe.left<320?he.isTopdown?(Ne.style.top=pe.bottom+"px",Ne.style.left=pe.left+"px",Ne.style.right="",Ne.style.bottom=""):(Ne.style.top=he.container.offsetTop-Ne.offsetHeight+"px",Ne.style.left=pe.left+"px",Ne.style.right="",Ne.style.bottom=""):(Ne.style.right=window.innerWidth-pe.left+"px",Ne.style.left=""):(Ne.style.left=pe.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(pe,ze){return ze.exactMatch-pe.exactMatch||ze.$score-pe.$score||(pe.caption||pe.value).localeCompare(ze.caption||ze.value)});var he=null;Ne=Ne.filter(function(pe){var ze=pe.snippet||pe.caption||pe.value;return ze===he?!1:(he=ze,!0)}),this.filtered=Ne},this.filterCompletions=function(de,Ne){var he=[],pe=Ne.toUpperCase(),ze=Ne.toLowerCase();e:for(var xe=0,Oe;Oe=de[xe];xe++){var _e=Oe.caption||Oe.value||Oe.snippet;if(_e){var At=-1,$e=0,Fe=0,Ue,Ve;if(this.exactMatch){if(Ne!==_e.substr(0,Ne.length))continue e}else{var Dt=_e.toLowerCase().indexOf(ze);if(Dt>-1)Fe=Dt;else for(var qe=0;qe<Ne.length;qe++){var kt=_e.indexOf(ze[qe],At+1),jt=_e.indexOf(pe[qe],At+1);if(Ue=kt>=0&&(jt<0||kt<jt)?kt:jt,Ue<0)continue e;Ve=Ue-At-1,Ve>0&&(At===-1&&(Fe+=10),Fe+=Ve,$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 re(Ce,ie){var ae=Ce.getTextRange(k.fromPoints({row:0,column:0},ie));return ae.split($).length-1}function oe(Ce,ie){var ae=re(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),pe=le.length-he;Ie[de]?Ie[de]=Math.max(pe,Ie[de]):Ie[de]=pe}}),Ie}g.getCompletions=function(Ce,ie,ae,le,Ie){var ue=oe(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,re=r("../config"),oe=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),Ve=_e.$mode.getCompletions(Ue,_e,At,$e);Fe(null,Ve)}},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=[],Ve=_e.getTokenAt(At.row,At.column);Ve&&Ve.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 jt=Dt[kt]||[],Pt=jt.length;Pt--;){var ti=jt[Pt],ei=ti.name||ti.tabTrigger;ei&&qe.push({caption:ei,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>",oe.escapeHTML(Oe.caption),"</b>","<hr></hr>",oe.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=re.$modes[Oe]),Oe&&(k.files||(k.files={}),pe(Oe.$id,Oe.snippetFileId),Oe.modes&&Oe.modes.forEach(he))},pe=function(Oe,_e){!_e||!Oe||k.files[Oe]||(k.files[Oe]={},re.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)})))}))},ze=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)}}},xe=r("../editor").Editor;r("../config").defineOptions(xe.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",ze)):this.commands.removeListener("afterExec",ze)},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","close"],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]=re=>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]=re=>vue.isRef(g)?g.value=re:null),title:r.title,width:"60%",onClose:$[3]||($[3]=re=>n("close"))},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(VAceEditor),{value:vue.unref(V),"onUpdate:value":$[1]||($[1]=re=>vue.isRef(V)?V.value=re: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}},emits:["change"],setup(i,{emit:n}){const r=i;function g(V){let k=window.setTimeout(function(){n("change",V),clearTimeout(k),k=null},200)}return(V,k)=>(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.objInfo,($,re)=>(vue.openBlock(),vue.createElementBlock("div",{key:re},[r.code?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,class:"props-row",size:"small"},{label:vue.withCtx(()=>[vue.unref(getStringWidth)(String(re))>78?(vue.openBlock(),vue.createBlock(vue.unref(ElTooltip),{key:0,content:String(re),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$7,vue.toDisplayString(re),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$5,vue.toDisplayString(re),1))]),default:vue.withCtx(()=>[vue.unref(getStringWidth)(String($.val))>145?(vue.openBlock(),vue.createBlock(vue.unref(ElTooltip),{key:0,content:JSON.stringify($.val),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$5,vue.toDisplayString($.val),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$3,vue.toDisplayString($.val),1))]),_:2},1024)):vue.createCommentVNode("",!0),r.hide.indexOf(String(re))<0?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:1,label:$.title,size:"small"},{default:vue.withCtx(()=>[$.type===vue.unref(EConfigItemPropsType).Select?(vue.openBlock(),vue.createBlock(vue.unref(ElSelect),{key:0,modelValue:$.val,"onUpdate:modelValue":oe=>$.val=oe,placeholder:"Select",size:"small",disabled:!!($!=null&&$.disabled),onChange:g},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList($.options,oe=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:oe.value,label:oe.label,value:oe.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])):$.type===vue.unref(EConfigItemPropsType).InputNumber?(vue.openBlock(),vue.createBlock(vue.unref(ElInputNumber),{key:1,modelValue:$.val,"onUpdate:modelValue":oe=>$.val=oe,disabled:!!($!=null&&$.disabled),onChange:g},null,8,["modelValue","onUpdate:modelValue","disabled"])):$.type===vue.unref(EConfigItemPropsType).Input?(vue.openBlock(),vue.createBlock(vue.unref(ElInput),{key:2,modelValue:$.val,"onUpdate:modelValue":oe=>$.val=oe,disabled:!!($!=null&&$.disabled),onChange:g},null,8,["modelValue","onUpdate:modelValue","disabled"])):$.type===vue.unref(EConfigItemPropsType).Textarea?(vue.openBlock(),vue.createBlock(vue.unref(ElInput),{key:3,modelValue:$.val,"onUpdate:modelValue":oe=>$.val=oe,autosize:"",type:"textarea",disabled:!!($!=null&&$.disabled),onChange:g},null,8,["modelValue","onUpdate:modelValue","disabled"])):$.type===vue.unref(EConfigItemPropsType).Color?(vue.openBlock(),vue.createBlock(vue.unref(ElColorPicker),{key:4,modelValue:$.val,"onUpdate:modelValue":oe=>$.val=oe,disabled:!!($!=null&&$.disabled),onChange:g},null,8,["modelValue","onUpdate:modelValue","disabled"])):$.type===vue.unref(EConfigItemPropsType).Switch?(vue.openBlock(),vue.createBlock(vue.unref(ElSwitch),{key:5,modelValue:$.val,"onUpdate:modelValue":oe=>$.val=oe,disabled:!!($!=null&&$.disabled),onChange:g},null,8,["modelValue","onUpdate:modelValue","disabled"])):$.type===vue.unref(EConfigItemPropsType).JsonEdit?(vue.openBlock(),vue.createBlock(_sfc_main$c,{key:6,modelValue:$.val,"onUpdate:modelValue":oe=>$.val=oe,disabled:!!($!=null&&$.disabled),onClose:g},null,8,["modelValue","onUpdate:modelValue","disabled"])):vue.createCommentVNode("",!0)]),_:2},1032,["label"])):vue.createCommentVNode("",!0)]))),128))}}),dynamicElFormItem_vue_vue_type_style_index_0_scoped_df8be28f_lang="",dynamicElFormItem_vue_vue_type_style_index_1_lang="",DynamicElFormItem=_export_sfc(_sfc_main$b,[["__scopeId","data-v-df8be28f"]]),_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),re=oe=>{n("updateCommonAniVal",oe),V.value=!1};return vue.watch(()=>r.val,oe=>{g.value=oe}),(oe,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=>re("")),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=>re(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_2668f60c_lang="",CommonAnimate=_export_sfc(_sfc_main$a,[["__scopeId","data-v-2668f60c"]]),_sfc_main$9=vue.defineComponent({__name:"component-tree",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 re of n.done_json)re.selected=!1,re.old_position={x:0,y:0};n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo($)},V={children:"children",label:"title"};return($,re)=>(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-98320511"),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($,re)=>(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),(oe,Ce)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,[vue.createVNode(vue.unref(ElInput),{class:"content-l",modelValue:oe.key,"onUpdate:modelValue":ie=>oe.key=ie,size:"small",placeholder:"key"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(ElInput),{class:"content-l",modelValue:oe.val,"onUpdate:modelValue":ie=>oe.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_98320511_lang="",List=_export_sfc(_sfc_main$8,[["__scopeId","data-v-98320511"]]),_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($,re)=>{var oe,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":re[0]||(re[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":re[1]||(re[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":re[2]||(re[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":re[3]||(re[3]=ie=>vue.unref(g).Relation.val=ie)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(g).type==="Relation"&&(((oe=vue.unref(g).Relation)==null?void 0:oe.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":re[4]||(re[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)}}),re=vue.computed(()=>g.done_json.filter(ie=>ie.type!==EDoneJsonType.ConnectionLine).map(ie=>({label:ie.title,value:ie.id}))),oe=[{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(re),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(oe,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-9b4c5da1"),i=i(),vue.popScopeId(),i),_hoisted_1$3=_withScopeId(()=>vue.createElementVNode("span",{style:{"font-weight":"bold"}},"MQTT",-1)),_hoisted_2$2={key:2},_hoisted_3$2={class:"events-title"},_sfc_main$5=vue.defineComponent({__name:"right-panel",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 re=vue.ref(numberArray(20)),oe=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=(ue,de,Ne)=>{vue.nextTick(function(){if(r.handle_svg_info){const he=r.done_json[r.handle_svg_info.index];Ne?setSvgActualInfo(he,Ne):setSvgActualInfo(he),moveAnchors(he)}})};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(oe),"onUpdate:modelValue":de[12]||(de[12]=Ne=>vue.isRef(oe)?oe.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[34]||(de[34]=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(()=>{var Ne,he,pe,ze;return[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]=xe=>vue.unref(r).handle_svg_info.info.title=xe)},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]=xe=>vue.unref(r).handle_svg_info.info.x=xe),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]=xe=>vue.unref(r).handle_svg_info.info.y=xe),onChange:Ie},null,8,["modelValue"])]),_:1}),vue.withDirectives(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]=xe=>vue.unref(r).handle_svg_info.info.scale_x=xe),onChange:Ie},null,8,["modelValue"])]),_:1},512),[[vue.vShow,(he=(Ne=vue.unref(r).handle_svg_info)==null?void 0:Ne.info)==null?void 0:he.config.can_zoom]]),vue.withDirectives(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]=xe=>vue.unref(r).handle_svg_info.info.scale_y=xe),onChange:Ie},null,8,["modelValue"])]),_:1},512),[[vue.vShow,(ze=(pe=vue.unref(r).handle_svg_info)==null?void 0:pe.info)==null?void 0:ze.config.can_zoom]]),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]=xe=>vue.unref(r).handle_svg_info.info.rotate=xe),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]=xe=>vue.unref(r).handle_svg_info.info.display=xe)},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,pe,ze,xe,Oe,_e,At;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]=$e=>vue.unref(r).handle_svg_info.info.id=$e)},null,8,["modelValue"])]),_:1}),(he=(Ne=vue.unref(r).handle_svg_info)==null?void 0:Ne.info)!=null&&he.state?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:0,class:"props-row",label:"state",size:"small"},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(vue.unref(r).handle_svg_info.info.defaultState),1)]),_:1})):vue.createCommentVNode("",!0),(ze=(pe=vue.unref(r).handle_svg_info)==null?void 0:pe.info)!=null&&ze.state?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:1,label:"状态",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.defaultState,"onUpdate:modelValue":de[22]||(de[22]=$e=>vue.unref(r).handle_svg_info.info.defaultState=$e),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(r).handle_svg_info.info.state,($e,Fe)=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:"state"+String(Fe),label:$e.label,value:Fe},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),(xe=vue.unref(r).handle_svg_info.info)!=null&&xe.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]=$e=>vue.unref(r).handle_svg_info.info.tag_slot=$e),onInput:de[24]||(de[24]=$e=>Ie($e,null,!0))},null,8,["modelValue"])]),_:1})])):vue.createCommentVNode("",!0),vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(r).handle_svg_info.info.props,code:"",onChange:de[25]||(de[25]=$e=>Ie($e,null,!0))},null,8,["obj-info"]),vue.unref(r).handle_svg_info.info.animations?(vue.openBlock(),vue.createBlock(vue.unref(ElFormItem),{key:3,label:vue.unref(r).handle_svg_info.info.animations.type.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(ElSelect),{modelValue:vue.unref(r).handle_svg_info.info.animations.type.val,"onUpdate:modelValue":de[26]||(de[26]=$e=>vue.unref(r).handle_svg_info.info.animations.type.val=$e),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(r).handle_svg_info.info.animations.type.options,$e=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:$e.value,label:$e.label,value:$e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):vue.createCommentVNode("",!0),((Oe=vue.unref(r).handle_svg_info.info.animations)==null?void 0:Oe.type.val)!=="None"?(vue.openBlock(),vue.createBlock(DynamicElFormItem,{key:4,"obj-info":vue.unref(r).handle_svg_info.info.animations,hide:["type","repeatCount"]},null,8,["obj-info"])):vue.createCommentVNode("",!0),((_e=vue.unref(r).handle_svg_info)==null?void 0:_e.info.type)===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$6,{key:5,modelValue:vue.unref(r).handle_svg_info.info.bind_anchors.start,"onUpdate:modelValue":de[27]||(de[27]=$e=>vue.unref(r).handle_svg_info.info.bind_anchors.start=$e),title:"绑定起点"},null,8,["modelValue"])):vue.createCommentVNode("",!0),((At=vue.unref(r).handle_svg_info)==null?void 0:At.info.type)===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$6,{key:6,modelValue:vue.unref(r).handle_svg_info.info.bind_anchors.end,"onUpdate:modelValue":de[28]||(de[28]=$e=>vue.unref(r).handle_svg_info.info.bind_anchors.end=$e),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(re),"onUpdate:modelValue":de[29]||(de[29]=Ne=>vue.isRef(re)?re.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(pe=>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":pe=>Ne.type=pe},{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":pe=>Ne.action=pe,onChange:pe=>ie(pe,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":pe=>Ne.target=pe,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":pe=>Ne.attrs=pe},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":pe=>Ne.scripts=pe,lang:"javascript"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),vue.createVNode(Condition,{modelValue:Ne.condition,"onUpdate:modelValue":pe=>Ne.condition=pe},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[30]||(de[30]=he=>{var pe;return $((pe=vue.unref(r).handle_svg_info)==null?void 0:pe.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[31]||(de[31]=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[32]||(de[32]=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[33]||(de[33]=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)}}),rightPanel_vue_vue_type_style_index_0_scoped_9b4c5da1_lang="",rightPanel_vue_vue_type_style_index_1_lang="",RightPanel=_export_sfc(_sfc_main$5,[["__scopeId","data-v-9b4c5da1"]]),_sfc_main$4=vue.defineComponent({__name:"export-json",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]=re=>vue.isRef(n)?n.value=re: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:"import-json",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]=re=>vue.isRef(r)?r.value=re: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:"vue3-ruler-tool",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,re=vue.ref(0),oe=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,pe="";const ze=vue.ref(null),xe=vue.ref(null),Oe=vue.ref(null),_e=vue.ref(null),At=vue.computed(()=>({width:re.value+"px",height:oe.value+"px"})),$e=vue.computed(()=>({padding:$+"px 0px 0px "+$+"px"})),Fe=vue.computed(()=>{let ci=0,Ai=0;return ae.value.map(yi=>{const ui=yi.type==="h";return{id:`${yi.type}_${ui?ci++:Ai++}`,type:yi.type,title:yi.site.toFixed(0)+"px",[ui?"top":"left"]:yi.site*g.svg.scale+$+r.center_offset[ui?"y":"x"]*g.svg.scale}})});r.$subscribe(ci=>{var Ai,yi,ui,Ci;((yi=(Ai=ci.events)==null?void 0:Ai.target)!=null&&yi.hasOwnProperty("left_nav")||(Ci=(ui=ci.events)==null?void 0:ui.target)!=null&&Ci.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")&&jt()}),vue.onMounted(()=>{V(document,"mousemove",ti),V(document,"mouseup",ni),Ue(),V(window,"resize",Ve)}),vue.onBeforeUnmount(()=>{k(document,"mousemove",ti),k(document,"mouseup",ni),k(window,"resize",Ve)});const Ue=()=>{kt(),jt()},Ve=()=>{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(xe.value.parentNode,null);re.value=parseInt(ci.getPropertyValue("width")),oe.value=parseInt(ci.getPropertyValue("height")),Ne=Oe.value.clientWidth,he=_e.value.clientHeight},jt=()=>{Pt(Ce.value,re.value,r.center_offset.x),Pt(ie.value,oe.value,r.center_offset.y)},Pt=(ci,Ai,yi)=>{if(ci.length===0)for(let ui=0;ui<Ai;ui+=n.stepLength)ui%n.stepLength===0&&ci.push({id:Number((ui/g.svg.scale-yi).toFixed(0))});else ci.forEach((ui,Ci)=>{ui.id=Number((Ci*n.stepLength/g.svg.scale-yi).toFixed(0))})},ti=ci=>{jt(),ei(ci)},ei=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}},Et=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":Ii(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":Ii(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}},Ii=(ci,Ai,yi,ui)=>{if(Ai<yi){let Ci;Fe.value.forEach((zi,Mi)=>{zi.id===pe&&(Ci=Mi)}),ci.splice(Ci,1)}else{let Ci;Fe.value.forEach((zi,Mi)=>{zi.id===pe&&(Ci=Mi)}),ci.splice(Ci,1,{type:ui,site:Ai})}},wi=()=>{Et("x")},ai=()=>{Et("y")},di=ci=>{le.value=!0,Ie="h",pe=ci},hi=ci=>{le.value=!0,Ie="v",pe=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:xe},[vue.withDirectives(vue.createElementVNode("section",null,[vue.createElementVNode("div",{ref_key:"horizontalRuler",ref:_e,class:"vue-ruler-h",onMousedown:vue.withModifiers(wi,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(Ce),(yi,ui)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({left:ui*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(ai,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(ie),(yi,ui)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({top:ui*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:ui=>qe(yi)},null,46,_hoisted_3$1))),128))],512),[[vue.vShow,n.visible]]),vue.createElementVNode("div",{ref_key:"content",ref:ze,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))}}),vue3RulerTool_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),re=useEditPrivateStore(pinia),oe=vue.ref(),Ce=vue.reactive({[EVisibleConfKey.ExportJson]:!1,[EVisibleConfKey.ImportJson]:!1,[EVisibleConfKey.ImportFile]:!1}),ie=(he,pe)=>{Ce[he]=pe},ae=vue.ref();ae.value=()=>{oe.value.onImportJson(),ie(EVisibleConfKey.ImportJson,!1)};const le=he=>["text/plain","application/json"].indexOf(he.type)<0?(ElMessage.error("仅支持的格式:txt、json"),!1):(fileRead(he).then(pe=>{oe.value.setVal(pe),ElMessage.success("文件读取成功!")}),!1),Ie=he=>{V.setDoneJson(he)};vue.onMounted(()=>{re.history_doneComponent=[],re.history_now_index=0,g.data?useImportDataModel(g.data):V.setDoneJson([]),V.intention=EGlobalStoreIntention.None});const{appContext:ue}=vue.getCurrentInstance();function de(he){r("onReturn",{data:he,isChange:re.getTopBtnUndoStatus})}function Ne(he){g.saveFile?ElMessageBox.prompt("请输入文件名","保存",{cancelButtonText:"取消",confirmButtonText:"保存"},ue).then(pe=>{fileWrite(he,pe.value.trim()),r("onSave",he)}).catch(pe=>{console.log(pe)}):r("onSave",he)}return n({setGraphNodeJson:Ie}),(he,pe)=>(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:de,onOnPreview:pe[0]||(pe[0]=ze=>r("onPreview",ze)),onOnSave:Ne})]),_: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":pe[2]||(pe[2]=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:pe[1]||(pe[1]=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:oe},null,512)]),_:1},8,["modelValue"]),vue.createVNode(vue.unref(ElDialog),{class:"modal-full",modelValue:vue.unref(Ce).ExportJson,"onUpdate:modelValue":pe[3]||(pe[3]=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_dda67146_lang="",index=_export_sfc(_sfc_main$1,[["__scopeId","data-v-dda67146"]]);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(re)return re(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 re=typeof commonjsRequire=="function"&&commonjsRequire,oe=0;oe<k.length;oe++)$(k[oe]);return $}return r}()({1:[function(r,g,V){(function(k,$){(function(){const re=r("events").EventEmitter,oe=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"),pe=r("xtend"),ze=r("debug")("mqttjs:client"),xe=k?k.nextTick:function(ei){setTimeout(ei,0)},Oe=$.setImmediate||function(ei){xe(ei)},_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(ei,Et){if(ei.options.protocolVersion===5&&Et.cmd==="publish"){let ni;Et.properties&&(ni=Et.properties.topicAlias);const ri=Et.topic.toString();if(ei.topicAliasSend)if(ni){if(ri.length!==0&&(ze("applyTopicAlias :: register topic: %s - alias: %d",ri,ni),!ei.topicAliasSend.put(ri,ni)))return ze("applyTopicAlias :: error out of range. topic: %s - alias: %d",ri,ni),new Error("Sending Topic Alias out of range")}else ri.length!==0&&(ei.options.autoAssignTopicAlias?(ni=ei.topicAliasSend.getAliasByTopic(ri),ni?(Et.topic="",Et.properties={...Et.properties,topicAlias:ni},ze("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",ri,ni)):(ni=ei.topicAliasSend.getLruAlias(),ei.topicAliasSend.put(ri,ni),Et.properties={...Et.properties,topicAlias:ni},ze("applyTopicAlias :: auto assign topic: %s - alias: %d",ri,ni))):ei.options.autoUseTopicAlias&&(ni=ei.topicAliasSend.getAliasByTopic(ri),ni&&(Et.topic="",Et.properties={...Et.properties,topicAlias:ni},ze("applyTopicAlias :: auto use topic: %s - alias: %d",ri,ni))));else if(ni)return ze("applyTopicAlias :: error out of range. topic: %s - alias: %d",ri,ni),new Error("Sending Topic Alias out of range")}}function Ve(ei,Et){let ni;Et.properties&&(ni=Et.properties.topicAlias);let ri=Et.topic.toString();if(ri.length===0){if(typeof ni>"u")return new Error("Unregistered Topic Alias");if(ri=ei.topicAliasSend.getTopicByAlias(ni),typeof ri>"u")return new Error("Unregistered Topic Alias");Et.topic=ri}ni&&delete Et.properties.topicAlias}function Dt(ei,Et,ni){ze("sendPacket :: packet: %O",Et),ze("sendPacket :: emitting `packetsend`"),ei.emit("packetsend",Et),ze("sendPacket :: writing to stream");const ri=ae.writeToStream(Et,ei.stream,ei.options);ze("sendPacket :: writeToStream result %s",ri),!ri&&ni&&ni!==Pt?(ze("sendPacket :: handle events on `drain` once through callback."),ei.stream.once("drain",ni)):ni&&(ze("sendPacket :: invoking cb"),ni())}function qe(ei){ei&&(ze("flush: queue exists? %b",!!ei),Object.keys(ei).forEach(function(Et){typeof ei[Et].cb=="function"&&(ei[Et].cb(new Error("Connection closed")),delete ei[Et])}))}function kt(ei){ei&&(ze("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(ei).forEach(function(Et){ei[Et].volatile&&typeof ei[Et].cb=="function"&&(ei[Et].cb(new Error("Connection closed")),delete ei[Et])}))}function jt(ei,Et,ni,ri){ze("storeAndSend :: store packet with cmd %s to outgoingStore",Et.cmd);let Ii=Et,wi;if(Ii.cmd==="publish"&&(Ii=Ne(Et),wi=Ve(ei,Ii),wi))return ni&&ni(wi);ei.outgoingStore.put(Ii,function(di){if(di)return ni&&ni(di);ri(),Dt(ei,Et,ni)})}function Pt(ei){ze("nop ::",ei)}function ti(ei,Et){let ni;const ri=this;if(!(this instanceof ti))return new ti(ei,Et);this.options=Et||{};for(ni in _e)typeof this.options[ni]>"u"?this.options[ni]=_e[ni]:this.options[ni]=Et[ni];ze("MqttClient :: options.protocol",Et.protocol),ze("MqttClient :: options.protocolVersion",Et.protocolVersion),ze("MqttClient :: options.username",Et.username),ze("MqttClient :: options.keepalive",Et.keepalive),ze("MqttClient :: options.reconnectPeriod",Et.reconnectPeriod),ze("MqttClient :: options.rejectUnauthorized",Et.rejectUnauthorized),ze("MqttClient :: options.topicAliasMaximum",Et.topicAliasMaximum),this.options.clientId=typeof Et.clientId=="string"?Et.clientId:Fe(),ze("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=Et.protocolVersion===5&&Et.customHandleAcks?Et.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=ei,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new le:this.options.messageIdProvider,this.outgoingStore=Et.outgoingStore||new oe,this.incomingStore=Et.incomingStore||new oe,this.queueQoSZero=Et.queueQoSZero===void 0?!0:Et.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,Et.topicAliasMaximum>0&&(Et.topicAliasMaximum>65535?ze("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new Ce(Et.topicAliasMaximum)),this.on("connect",function(){const Ii=this.queue;function wi(){const ai=Ii.shift();ze("deliver :: entry %o",ai);let di=null;if(!ai){ri._resubscribe();return}di=ai.packet,ze("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){ai.cb&&ai.cb(ci),wi()}):(ze("messageId: %d has already used. The message is skipped and removed.",di.messageId),wi())}ze("connect :: sending queued packets"),wi()}),this.on("close",function(){ze("close :: connected set to `false`"),this.connected=!1,ze("close :: clearing connackTimer"),clearTimeout(this.connackTimer),ze("close :: clearing ping timer"),ri.pingTimer!==null&&(ri.pingTimer.clear(),ri.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),ze("close :: calling _setupReconnect"),this._setupReconnect()}),re.call(this),ze("MqttClient :: setting up stream"),this._setupStream()}ue(ti,re),ti.prototype._setupStream=function(){const ei=this,Et=new Ie,ni=ae.parser(this.options);let ri=null;const Ii=[];ze("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),ze("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),ni.on("packet",function(ci){ze("parser :: on packet push to packets array."),Ii.push(ci)});function wi(){if(Ii.length)xe(ai);else{const ci=ri;ri=null,ci()}}function ai(){ze("work :: getting next packet in queue");const ci=Ii.shift();if(ci)ze("work :: packet pulled from queue"),ei._handlePacket(ci,wi);else{ze("work :: no packets in queue");const Ai=ri;ri=null,ze("work :: done flag is %s",!!Ai),Ai&&Ai()}}Et._write=function(ci,Ai,yi){ri=yi,ze("writable stream :: parsing buffer"),ni.parse(ci),ai()};function di(ci){ze("streamErrorHandler :: error",ci.message),At.includes(ci.code)?(ze("streamErrorHandler :: emitting error"),ei.emit("error",ci)):Pt(ci)}ze("_setupStream :: pipe stream to writable stream"),this.stream.pipe(Et),this.stream.on("error",di),this.stream.on("close",function(){ze("(%s)stream :: on close",ei.options.clientId),kt(ei.outgoing),ze("stream: emit close to MqttClient"),ei.emit("close")}),ze("_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 ei.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=pe({cmd:"auth",reasonCode:0},this.options.authPacket);Dt(this,ci)}}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){ze("!!connectTimeout hit!! Calling _cleanUp with force `true`"),ei._cleanUp(!0)},this.options.connectTimeout)},ti.prototype._handlePacket=function(ei,Et){const ni=this.options;if(ni.protocolVersion===5&&ni.properties&&ni.properties.maximumPacketSize&&ni.properties.maximumPacketSize<ei.length)return this.emit("error",new Error("exceeding packets size "+ei.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(ze("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",ei),ei.cmd){case"publish":this._handlePublish(ei,Et);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(ei),Et();break;case"pubrel":this._handlePubrel(ei,Et);break;case"connack":this._handleConnack(ei),Et();break;case"auth":this._handleAuth(ei),Et();break;case"pingresp":this._handlePingresp(ei),Et();break;case"disconnect":this._handleDisconnect(ei),Et();break}},ti.prototype._checkDisconnecting=function(ei){return this.disconnecting&&(ei&&ei!==Pt?ei(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},ti.prototype.publish=function(ei,Et,ni,ri){ze("publish :: message `%s` to topic `%s`",Et,ei);const Ii=this.options;if(typeof ni=="function"&&(ri=ni,ni=null),ni=pe({qos:0,retain:!1,dup:!1},ni),this._checkDisconnecting(ri))return this;const ai=this,di=function(){let hi=0;if((ni.qos===1||ni.qos===2)&&(hi=ai._nextId(),hi===null))return ze("No messageId left"),!1;const ci={cmd:"publish",topic:ei,payload:Et,qos:ni.qos,retain:ni.retain,messageId:hi,dup:ni.dup};switch(Ii.protocolVersion===5&&(ci.properties=ni.properties),ze("publish :: qos",ni.qos),ni.qos){case 1:case 2:ai.outgoing[ci.messageId]={volatile:!1,cb:ri||Pt},ze("MqttClient:publish: packet cmd: %s",ci.cmd),ai._sendPacket(ci,void 0,ni.cbStorePut);break;default:ze("MqttClient:publish: packet cmd: %s",ci.cmd),ai._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 ei=this,Et=new Array(arguments.length);for(let yi=0;yi<arguments.length;yi++)Et[yi]=arguments[yi];const ni=[];let ri=Et.shift();const Ii=ri.resubscribe;let wi=Et.pop()||Pt,ai=Et.pop();const di=this.options.protocolVersion;delete ri.resubscribe,typeof ri=="string"&&(ri=[ri]),typeof wi!="function"&&(ai=wi,wi=Pt);const hi=he.validateTopics(ri);if(hi!==null)return Oe(wi,new Error("Invalid topic "+hi)),this;if(this._checkDisconnecting(wi))return ze("subscribe: discconecting true"),this;const ci={qos:0};if(di===5&&(ci.nl=!1,ci.rap=!1,ci.rh=0),ai=pe(ci,ai),Array.isArray(ri)?ri.forEach(function(yi){if(ze("subscribe: array topic %s",yi),!Object.prototype.hasOwnProperty.call(ei._resubscribeTopics,yi)||ei._resubscribeTopics[yi].qos<ai.qos||Ii){const ui={topic:yi,qos:ai.qos};di===5&&(ui.nl=ai.nl,ui.rap=ai.rap,ui.rh=ai.rh,ui.properties=ai.properties),ze("subscribe: pushing topic `%s` and qos `%s` to subs list",ui.topic,ui.qos),ni.push(ui)}}):Object.keys(ri).forEach(function(yi){if(ze("subscribe: object topic %s",yi),!Object.prototype.hasOwnProperty.call(ei._resubscribeTopics,yi)||ei._resubscribeTopics[yi].qos<ri[yi].qos||Ii){const ui={topic:yi,qos:ri[yi].qos};di===5&&(ui.nl=ri[yi].nl,ui.rap=ri[yi].rap,ui.rh=ri[yi].rh,ui.properties=ai.properties),ze("subscribe: pushing `%s` to subs list",ui),ni.push(ui)}}),!ni.length)return wi(null,[]),this;const Ai=function(){const yi=ei._nextId();if(yi===null)return ze("No messageId left"),!1;const ui={cmd:"subscribe",subscriptions:ni,qos:1,retain:!1,dup:!1,messageId:yi};if(ai.properties&&(ui.properties=ai.properties),ei.options.resubscribe){ze("subscribe :: resubscribe true");const Ci=[];ni.forEach(function(zi){if(ei.options.reconnectPeriod>0){const Mi={qos:zi.qos};di===5&&(Mi.nl=zi.nl||!1,Mi.rap=zi.rap||!1,Mi.rh=zi.rh||0,Mi.properties=zi.properties),ei._resubscribeTopics[zi.topic]=Mi,Ci.push(zi.topic)}}),ei.messageIdToTopic[ui.messageId]=Ci}return ei.outgoing[ui.messageId]={volatile:!0,cb:function(Ci,zi){if(!Ci){const Mi=zi.granted;for(let Ni=0;Ni<Mi.length;Ni+=1)ni[Ni].qos=Mi[Ni]}wi(Ci,ni)}},ze("subscribe :: call _sendPacket"),ei._sendPacket(ui),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!Ai())&&this._storeProcessingQueue.push({invoke:Ai,callback:wi}),this},ti.prototype.unsubscribe=function(){const ei=this,Et=new Array(arguments.length);for(let di=0;di<arguments.length;di++)Et[di]=arguments[di];let ni=Et.shift(),ri=Et.pop()||Pt,Ii=Et.pop();typeof ni=="string"&&(ni=[ni]),typeof ri!="function"&&(Ii=ri,ri=Pt);const wi=he.validateTopics(ni);if(wi!==null)return Oe(ri,new Error("Invalid topic "+wi)),this;if(ei._checkDisconnecting(ri))return this;const ai=function(){const di=ei._nextId();if(di===null)return ze("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),ei.options.resubscribe&&hi.unsubscriptions.forEach(function(ci){delete ei._resubscribeTopics[ci]}),typeof Ii=="object"&&Ii.properties&&(hi.properties=Ii.properties),ei.outgoing[hi.messageId]={volatile:!0,cb:ri},ze("unsubscribe: call _sendPacket"),ei._sendPacket(hi),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!ai())&&this._storeProcessingQueue.push({invoke:ai,callback:ri}),this},ti.prototype.end=function(ei,Et,ni){const ri=this;ze("end :: (%s)",this.options.clientId),(ei==null||typeof ei!="boolean")&&(ni=Et||Pt,Et=ei,ei=!1,typeof Et!="object"&&(ni=Et,Et=null,typeof ni!="function"&&(ni=Pt))),typeof Et!="object"&&(ni=Et,Et=null),ze("end :: cb? %s",!!ni),ni=ni||Pt;function Ii(){ze("end :: closeStores: closing incoming and outgoing stores"),ri.disconnected=!0,ri.incomingStore.close(function(ai){ri.outgoingStore.close(function(di){if(ze("end :: closeStores: emitting end"),ri.emit("end"),ni){const hi=ai||di;ze("end :: closeStores: invoking callback with args"),ni(hi)}})}),ri._deferredReconnect&&ri._deferredReconnect()}function wi(){ze("end :: (%s) :: finish :: calling _cleanUp with force %s",ri.options.clientId,ei),ri._cleanUp(ei,()=>{ze("end :: finish :: calling process.nextTick on closeStores"),xe(Ii.bind(ri))},Et)}return this.disconnecting?(ni(),this):(this._clearReconnect(),this.disconnecting=!0,!ei&&Object.keys(this.outgoing).length>0?(ze("end :: (%s) :: calling finish in 10ms once outgoing is empty",ri.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,wi,10))):(ze("end :: (%s) :: immediately calling finish",ri.options.clientId),wi()),this)},ti.prototype.removeOutgoingMessage=function(ei){const Et=this.outgoing[ei]?this.outgoing[ei].cb:null;return delete this.outgoing[ei],this.outgoingStore.del({messageId:ei},function(){Et(new Error("Message removed"))}),this},ti.prototype.reconnect=function(ei){ze("client reconnect");const Et=this,ni=function(){ei?(Et.options.incomingStore=ei.incomingStore,Et.options.outgoingStore=ei.outgoingStore):(Et.options.incomingStore=null,Et.options.outgoingStore=null),Et.incomingStore=Et.options.incomingStore||new oe,Et.outgoingStore=Et.options.outgoingStore||new oe,Et.disconnecting=!1,Et.disconnected=!1,Et._deferredReconnect=null,Et._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=ni:ni(),this},ti.prototype._reconnect=function(){ze("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),ze("client already connected. disconnecting first.")):(ze("_reconnect: calling _setupStream"),this._setupStream())},ti.prototype._setupReconnect=function(){const ei=this;!ei.disconnecting&&!ei.reconnectTimer&&ei.options.reconnectPeriod>0?(this.reconnecting||(ze("_setupReconnect :: emit `offline` state"),this.emit("offline"),ze("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),ze("_setupReconnect :: setting reconnectTimer for %d ms",ei.options.reconnectPeriod),ei.reconnectTimer=setInterval(function(){ze("reconnectTimer :: reconnect triggered!"),ei._reconnect()},ei.options.reconnectPeriod)):ze("_setupReconnect :: doing nothing...")},ti.prototype._clearReconnect=function(){ze("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},ti.prototype._cleanUp=function(ei,Et){const ni=arguments[2];if(Et&&(ze("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",Et)),ze("_cleanUp :: forced? %s",ei),ei)this.options.reconnectPeriod===0&&this.options.clean&&qe(this.outgoing),ze("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const ri=pe({cmd:"disconnect"},ni);ze("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(ri,Oe.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(ze("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(ze("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),Et&&!this.connected&&(ze("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",Et),Et())},ti.prototype._sendPacket=function(ei,Et,ni){ze("_sendPacket :: (%s) :: start",this.options.clientId),ni=ni||Pt,Et=Et||Pt;const ri=Ue(this,ei);if(ri){Et(ri);return}if(!this.connected){if(ei.cmd==="auth"){this._shiftPingInterval(),Dt(this,ei,Et);return}ze("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(ei,Et,ni);return}switch(this._shiftPingInterval(),ei.cmd){case"publish":break;case"pubrel":jt(this,ei,Et,ni);return;default:Dt(this,ei,Et);return}switch(ei.qos){case 2:case 1:jt(this,ei,Et,ni);break;case 0:default:Dt(this,ei,Et);break}ze("_sendPacket :: (%s) :: end",this.options.clientId)},ti.prototype._storePacket=function(ei,Et,ni){ze("_storePacket :: packet: %o",ei),ze("_storePacket :: cb? %s",!!Et),ni=ni||Pt;let ri=ei;if(ri.cmd==="publish"){ri=Ne(ei);const Ii=Ve(this,ri);if(Ii)return Et&&Et(Ii)}(ri.qos||0)===0&&this.queueQoSZero||ri.cmd!=="publish"?this.queue.push({packet:ri,cb:Et}):ri.qos>0?(Et=this.outgoing[ri.messageId]?this.outgoing[ri.messageId].cb:null,this.outgoingStore.put(ri,function(Ii){if(Ii)return Et&&Et(Ii);ni()})):Et&&Et(new Error("No connection to broker"))},ti.prototype._setupPingTimer=function(){ze("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const ei=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=de(function(){ei._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(){ze("_checkPing :: checking ping..."),this.pingResp?(ze("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(ze("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},ti.prototype._handlePingresp=function(){this.pingResp=!0},ti.prototype._handleConnack=function(ei){ze("_handleConnack");const Et=this.options,ri=Et.protocolVersion===5?ei.reasonCode:ei.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,ei.properties){if(ei.properties.topicAliasMaximum){if(ei.properties.topicAliasMaximum>65535){this.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}ei.properties.topicAliasMaximum>0&&(this.topicAliasSend=new ie(ei.properties.topicAliasMaximum))}ei.properties.serverKeepAlive&&Et.keepalive&&(Et.keepalive=ei.properties.serverKeepAlive,this._shiftPingInterval()),ei.properties.maximumPacketSize&&(Et.properties||(Et.properties={}),Et.properties.maximumPacketSize=ei.properties.maximumPacketSize)}if(ri===0)this.reconnecting=!1,this._onConnect(ei);else if(ri>0){const Ii=new Error("Connection refused: "+$e[ri]);Ii.code=ri,this.emit("error",Ii)}},ti.prototype._handleAuth=function(ei){const ni=this.options.protocolVersion,ri=ni===5?ei.reasonCode:ei.returnCode;if(ni!==5){const wi=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+ni);wi.code=ri,this.emit("error",wi);return}const Ii=this;this.handleAuth(ei,function(wi,ai){if(wi){Ii.emit("error",wi);return}if(ri===24)Ii.reconnecting=!1,Ii._sendPacket(ai);else{const di=new Error("Connection refused: "+$e[ri]);wi.code=ri,Ii.emit("error",di)}})},ti.prototype.handleAuth=function(ei,Et){Et()},ti.prototype._handlePublish=function(ei,Et){ze("_handlePublish: packet %o",ei),Et=typeof Et<"u"?Et:Pt;let ni=ei.topic.toString();const ri=ei.payload,Ii=ei.qos,wi=ei.messageId,ai=this,di=this.options,hi=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let ci;if(ei.properties&&(ci=ei.properties.topicAlias),typeof ci<"u")if(ni.length===0)if(ci>0&&ci<=65535){const Ai=this.topicAliasRecv.getTopicByAlias(ci);if(Ai)ni=Ai,ze("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",ni,ci);else{ze("_handlePublish :: unregistered topic alias. alias: %d",ci),this.emit("error",new Error("Received unregistered Topic Alias"));return}}else{ze("_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))ze("_handlePublish :: registered topic: %s - alias: %d",ni,ci);else{ze("_handlePublish :: topic alias out of range. alias: %d",ci),this.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(ze("_handlePublish: qos %d",Ii),Ii){case 2:{di.customHandleAcks(ni,ri,ei,function(ci,Ai){if(ci instanceof Error||(Ai=ci,ci=null),ci)return ai.emit("error",ci);if(hi.indexOf(Ai)===-1)return ai.emit("error",new Error("Wrong reason code for pubrec"));Ai?ai._sendPacket({cmd:"pubrec",messageId:wi,reasonCode:Ai},Et):ai.incomingStore.put(ei,function(){ai._sendPacket({cmd:"pubrec",messageId:wi},Et)})});break}case 1:{di.customHandleAcks(ni,ri,ei,function(ci,Ai){if(ci instanceof Error||(Ai=ci,ci=null),ci)return ai.emit("error",ci);if(hi.indexOf(Ai)===-1)return ai.emit("error",new Error("Wrong reason code for puback"));Ai||ai.emit("message",ni,ri,ei),ai.handleMessage(ei,function(yi){if(yi)return Et&&Et(yi);ai._sendPacket({cmd:"puback",messageId:wi,reasonCode:Ai},Et)})});break}case 0:this.emit("message",ni,ri,ei),this.handleMessage(ei,Et);break;default:ze("_handlePublish: unknown QoS. Doing nothing.");break}},ti.prototype.handleMessage=function(ei,Et){Et()},ti.prototype._handleAck=function(ei){const Et=ei.messageId,ni=ei.cmd;let ri=null;const Ii=this.outgoing[Et]?this.outgoing[Et].cb:null,wi=this;let ai;if(!Ii){ze("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(ze("_handleAck :: packet type",ni),ni){case"pubcomp":case"puback":{const di=ei.reasonCode;di&&di>0&&di!==16&&(ai=new Error("Publish error: "+$e[di]),ai.code=di,Ii(ai,ei)),delete this.outgoing[Et],this.outgoingStore.del(ei,Ii),this.messageIdProvider.deallocate(Et),this._invokeStoreProcessingQueue();break}case"pubrec":{ri={cmd:"pubrel",qos:2,messageId:Et};const di=ei.reasonCode;di&&di>0&&di!==16?(ai=new Error("Publish error: "+$e[di]),ai.code=di,Ii(ai,ei)):this._sendPacket(ri);break}case"suback":{delete this.outgoing[Et],this.messageIdProvider.deallocate(Et);for(let di=0;di<ei.granted.length;di++)if(ei.granted[di]&128){const hi=this.messageIdToTopic[Et];hi&&hi.forEach(function(ci){delete wi._resubscribeTopics[ci]})}this._invokeStoreProcessingQueue(),Ii(null,ei);break}case"unsuback":{delete this.outgoing[Et],this.messageIdProvider.deallocate(Et),this._invokeStoreProcessingQueue(),Ii(null);break}default:wi.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")},ti.prototype._handlePubrel=function(ei,Et){ze("handling pubrel packet"),Et=typeof Et<"u"?Et:Pt;const ni=ei.messageId,ri=this,Ii={cmd:"pubcomp",messageId:ni};ri.incomingStore.get(ei,function(wi,ai){wi?ri._sendPacket(Ii,Et):(ri.emit("message",ai.topic,ai.payload,ai),ri.handleMessage(ai,function(di){if(di)return Et(di);ri.incomingStore.del(ai,Pt),ri._sendPacket(Ii,Et)}))})},ti.prototype._handleDisconnect=function(ei){this.emit("disconnect",ei)},ti.prototype._nextId=function(){return this.messageIdProvider.allocate()},ti.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},ti.prototype._resubscribe=function(){ze("_resubscribe");const ei=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion===5&&!this.connackPacket.sessionPresent)&&ei.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){ze("_resubscribe: protocolVersion 5");for(let Et=0;Et<ei.length;Et++){const ni={};ni[ei[Et]]=this._resubscribeTopics[ei[Et]],ni.resubscribe=!0,this.subscribe(ni,{properties:ni[ei[Et]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},ti.prototype._onConnect=function(ei){if(this.disconnected){this.emit("connect",ei);return}const Et=this;this.connackPacket=ei,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0;function ni(){let ri=Et.outgoingStore.createStream();function Ii(){Et._storeProcessing=!1,Et._packetIdsDuringStoreProcessing={}}Et.once("close",wi),ri.on("error",function(di){Ii(),Et._flushStoreProcessingQueue(),Et.removeListener("close",wi),Et.emit("error",di)});function wi(){ri.destroy(),ri=null,Et._flushStoreProcessingQueue(),Ii()}function ai(){if(!ri)return;Et._storeProcessing=!0;const di=ri.read(1);let hi;if(!di){ri.once("readable",ai);return}if(Et._packetIdsDuringStoreProcessing[di.messageId]){ai();return}!Et.disconnecting&&!Et.reconnectTimer?(hi=Et.outgoing[di.messageId]?Et.outgoing[di.messageId].cb:null,Et.outgoing[di.messageId]={volatile:!1,cb:function(ci,Ai){hi&&hi(ci,Ai),ai()}},Et._packetIdsDuringStoreProcessing[di.messageId]=!0,Et.messageIdProvider.register(di.messageId)?Et._sendPacket(di):ze("messageId: %d has already used.",di.messageId)):ri.destroy&&ri.destroy()}ri.on("end",function(){let di=!0;for(const hi in Et._packetIdsDuringStoreProcessing)if(!Et._packetIdsDuringStoreProcessing[hi]){di=!1;break}di?(Ii(),Et.removeListener("close",wi),Et._invokeAllStoreProcessingQueue(),Et.emit("connect",ei)):ni()}),ai()}ni()},ti.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const ei=this._storeProcessingQueue[0];if(ei&&ei.invoke())return this._storeProcessingQueue.shift(),!0}return!1},ti.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},ti.prototype._flushStoreProcessingQueue=function(){for(const ei of this._storeProcessingQueue)ei.cbStorePut&&ei.cbStorePut(new Error("Connection closed")),ei.callback&&ei.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,re=r("duplexify");let oe,Ce,ie,ae=!1;function le(){const he=new $;return he._write=function(pe,ze,xe){oe.sendSocketMessage({data:pe.buffer,success:function(){xe()},fail:function(){xe(new Error)}})},he._flush=function(ze){oe.closeSocket({success:function(){ze()}})},he}function Ie(he){he.hostname||(he.hostname="localhost"),he.path||(he.path="/"),he.wsOptions||(he.wsOptions={})}function ue(he,pe){const ze=he.protocol==="alis"?"wss":"ws";let xe=ze+"://"+he.hostname+he.path;return he.port&&he.port!==80&&he.port!==443&&(xe=ze+"://"+he.hostname+":"+he.port+he.path),typeof he.transformWsUrl=="function"&&(xe=he.transformWsUrl(xe,he,pe)),xe}function de(){ae||(ae=!0,oe.onSocketOpen(function(){ie.setReadable(Ce),ie.setWritable(Ce),ie.emit("connect")}),oe.onSocketMessage(function(he){if(typeof he.data=="string"){const pe=k.from(he.data,"base64");Ce.push(pe)}else{const pe=new FileReader;pe.addEventListener("load",function(){let ze=pe.result;ze instanceof ArrayBuffer?ze=k.from(ze):ze=k.from(ze,"utf8"),Ce.push(ze)}),pe.readAsArrayBuffer(he.data)}}),oe.onSocketClose(function(){ie.end(),ie.destroy()}),oe.onSocketError(function(he){ie.destroy(he)}))}function Ne(he,pe){if(pe.hostname=pe.hostname||pe.host,!pe.hostname)throw new Error("Could not determine host. Specify host manually.");const ze=pe.protocolId==="MQIsdp"&&pe.protocolVersion===3?"mqttv3.1":"mqtt";Ie(pe);const xe=ue(pe,he);return oe=pe.my,oe.connectSocket({url:xe,protocols:ze}),Ce=le(),ie=re.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 re(oe,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=re},{debug:18,net:16}],4:[function(r,g,V){const k=r("tls"),$=r("net"),re=r("debug")("mqttjs:tls");function oe(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,re("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=oe},{debug:18,net:16,tls:16}],5:[function(r,g,V){(function(k){(function(){const{Buffer:$}=r("buffer"),re=r("ws"),oe=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(xe,Oe){let _e=xe.protocol+"://"+xe.hostname+":"+xe.port+xe.path;return typeof xe.transformWsUrl=="function"&&(_e=xe.transformWsUrl(_e,xe,Oe)),_e}function ue(xe){const Oe=xe;return xe.hostname||(Oe.hostname="localhost"),xe.port||(xe.protocol==="wss"?Oe.port=443:Oe.port=80),xe.path||(Oe.path="/"),xe.wsOptions||(Oe.wsOptions={}),!le&&xe.protocol==="wss"&&ae.forEach(function(_e){Object.prototype.hasOwnProperty.call(xe,_e)&&!Object.prototype.hasOwnProperty.call(xe.wsOptions,_e)&&(Oe.wsOptions[_e]=xe[_e])}),Oe}function de(xe){const Oe=ue(xe);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(xe,Oe,_e){oe("createWebSocket"),oe("protocol: "+_e.protocolId+" "+_e.protocolVersion);const At=_e.protocolId==="MQIsdp"&&_e.protocolVersion===3?"mqttv3.1":"mqtt";return oe("creating new Websocket for url: "+Oe+" and protocol: "+At),new re(Oe,[At],_e.wsOptions)}function he(xe,Oe){const _e=Oe.protocolId==="MQIsdp"&&Oe.protocolVersion===3?"mqttv3.1":"mqtt",At=Ie(Oe,xe),$e=new WebSocket(At,[_e]);return $e.binaryType="arraybuffer",$e}function pe(xe,Oe){oe("streamBuilder");const _e=ue(Oe),At=Ie(_e,xe),$e=Ne(xe,At,_e),Fe=re.createWebSocketStream($e,_e.wsOptions);return Fe.url=At,$e.on("close",()=>{Fe.destroy()}),Fe}function ze(xe,Oe){oe("browserStreamBuilder");let _e;const $e=de(Oe).browserBufferSize||1024*512,Fe=Oe.browserBufferTimeout||1e3,Ue=!Oe.objectMode,Ve=he(xe,Oe),Dt=kt(Oe,ni,ri);Oe.objectMode||(Dt._writev=Et),Dt.on("close",()=>{Ve.close()});const qe=typeof Ve.addEventListener<"u";Ve.readyState===Ve.OPEN?_e=Dt:(_e=_e=Ce(void 0,void 0,Oe),Oe.objectMode||(_e._writev=Et),qe?Ve.addEventListener("open",jt):Ve.onopen=jt),_e.socket=Ve,qe?(Ve.addEventListener("close",Pt),Ve.addEventListener("error",ti),Ve.addEventListener("message",ei)):(Ve.onclose=Pt,Ve.onerror=ti,Ve.onmessage=ei);function kt(Ii,wi,ai){const di=new ie({objectModeMode:Ii.objectMode});return di._write=wi,di._flush=ai,di}function jt(){_e.setReadable(Dt),_e.setWritable(Dt),_e.emit("connect")}function Pt(){_e.end(),_e.destroy()}function ti(Ii){_e.destroy(Ii)}function ei(Ii){let wi=Ii.data;wi instanceof ArrayBuffer?wi=$.from(wi):wi=$.from(wi,"utf8"),Dt.push(wi)}function Et(Ii,wi){const ai=new Array(Ii.length);for(let di=0;di<Ii.length;di++)typeof Ii[di].chunk=="string"?ai[di]=$.from(Ii[di],"utf8"):ai[di]=Ii[di].chunk;this._write($.concat(ai),"binary",wi)}function ni(Ii,wi,ai){Ve.bufferedAmount>$e&&setTimeout(ni,Fe,Ii,wi,ai),Ue&&typeof Ii=="string"&&(Ii=$.from(Ii,"utf8"));try{Ve.send(Ii)}catch(di){return ai(di)}ai()}function ri(Ii){Ve.close(),Ii()}return _e}le?g.exports=ze:g.exports=pe}).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,re=r("duplexify");let oe,Ce,ie;function ae(){const Ne=new $;return Ne._write=function(he,pe,ze){oe.send({data:he.buffer,success:function(){ze()},fail:function(xe){ze(new Error(xe))}})},Ne._flush=function(pe){oe.close({success:function(){pe()}})},Ne}function le(Ne){Ne.hostname||(Ne.hostname="localhost"),Ne.path||(Ne.path="/"),Ne.wsOptions||(Ne.wsOptions={})}function Ie(Ne,he){const pe=Ne.protocol==="wxs"?"wss":"ws";let ze=pe+"://"+Ne.hostname+Ne.path;return Ne.port&&Ne.port!==80&&Ne.port!==443&&(ze=pe+"://"+Ne.hostname+":"+Ne.port+Ne.path),typeof Ne.transformWsUrl=="function"&&(ze=Ne.transformWsUrl(ze,Ne,he)),ze}function ue(){oe.onOpen(function(){ie.setReadable(Ce),ie.setWritable(Ce),ie.emit("connect")}),oe.onMessage(function(Ne){let he=Ne.data;he instanceof ArrayBuffer?he=k.from(he):he=k.from(he,"utf8"),Ce.push(he)}),oe.onClose(function(){ie.end(),ie.destroy()}),oe.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 pe=he.protocolId==="MQIsdp"&&he.protocolVersion===3?"mqttv3.1":"mqtt";le(he);const ze=Ie(he,Ne);oe=wx.connectSocket({url:ze,protocols:[pe]}),Ce=ae(),ie=re.obj(),ie._destroy=function(Oe,_e){oe.close({success:function(){_e&&_e(Oe)}})};const xe=ie.destroy;return ie.destroy=function(){ie.destroy=xe;const Oe=this;setTimeout(function(){oe.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,re={objectMode:!0},oe={clean:!0};function Ce(ie){if(!(this instanceof Ce))return new Ce(ie);this.options=ie||{},this.options=k(oe,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 $(re),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($,re){return re===0||re>this.max?!1:(this.aliasToTopic[re]=$,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 re(oe){if(!(this instanceof re))return new re(oe);oe>0&&(this.aliasToTopic=new k({max:oe}),this.topicToAlias={},this.numberAllocator=new $(1,oe),this.max=oe,this.length=0)}re.prototype.put=function(oe,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,oe),this.topicToAlias[oe]=Ce,this.numberAllocator.use(Ce),this.length=this.aliasToTopic.length,!0},re.prototype.getTopicByAlias=function(oe){return this.aliasToTopic.get(oe)},re.prototype.getAliasByTopic=function(oe){const Ce=this.topicToAlias[oe];return typeof Ce<"u"&&this.aliasToTopic.get(Ce),Ce},re.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},re.prototype.getLruAlias=function(){const oe=this.numberAllocator.firstVacant();return oe||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},g.exports=re},{"lru-cache":37,"number-allocator":46}],11:[function(r,g,V){function k(re){const oe=re.split("/");for(let Ce=0;Ce<oe.length;Ce++)if(oe[Ce]!=="+"){if(oe[Ce]==="#")return Ce===oe.length-1;if(oe[Ce].indexOf("+")!==-1||oe[Ce].indexOf("#")!==-1)return!1}return!0}function $(re){if(re.length===0)return"empty_topic_list";for(let oe=0;oe<re.length;oe++)if(!k(re[oe]))return re[oe];return null}g.exports={validateTopics:$}},{}],12:[function(r,g,V){(function(k){(function(){const $=r("../client"),re=r("../store"),oe=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 pe=oe.parse(ue,!0);if(pe.port!=null&&(pe.port=Number(pe.port)),de=Ce(pe,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 pe=["mqtts","wss"].indexOf(de.protocol)!==-1;de.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(ze,xe){return pe&&xe%2===0?!1:typeof ae[ze]=="function"})[0]}if(de.clean===!1&&!de.clientId)throw new Error("Missing clientId for unclean clients");de.protocol&&(de.defaultProtocol=de.protocol);function Ne(pe){return de.servers&&((!pe._reconnectCount||pe._reconnectCount===de.servers.length)&&(pe._reconnectCount=0),de.host=de.servers[pe._reconnectCount].host,de.port=de.servers[pe._reconnectCount].port,de.protocol=de.servers[pe._reconnectCount].protocol?de.servers[pe._reconnectCount].protocol:de.defaultProtocol,de.hostname=de.host,pe._reconnectCount++),ie("calling streambuilder for",de.protocol),ae[de.protocol](pe,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=re}).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=[],$=[],re=typeof Uint8Array<"u"?Uint8Array:Array,oe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ce=0,ie=oe.length;Ce<ie;++Ce)k[Ce]=oe[Ce],$[oe.charCodeAt(Ce)]=Ce;$["-".charCodeAt(0)]=62,$["_".charCodeAt(0)]=63;function ae(pe){var ze=pe.length;if(ze%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var xe=pe.indexOf("=");xe===-1&&(xe=ze);var Oe=xe===ze?0:4-xe%4;return[xe,Oe]}function le(pe){var ze=ae(pe),xe=ze[0],Oe=ze[1];return(xe+Oe)*3/4-Oe}function Ie(pe,ze,xe){return(ze+xe)*3/4-xe}function ue(pe){var ze,xe=ae(pe),Oe=xe[0],_e=xe[1],At=new re(Ie(pe,Oe,_e)),$e=0,Fe=_e>0?Oe-4:Oe,Ue;for(Ue=0;Ue<Fe;Ue+=4)ze=$[pe.charCodeAt(Ue)]<<18|$[pe.charCodeAt(Ue+1)]<<12|$[pe.charCodeAt(Ue+2)]<<6|$[pe.charCodeAt(Ue+3)],At[$e++]=ze>>16&255,At[$e++]=ze>>8&255,At[$e++]=ze&255;return _e===2&&(ze=$[pe.charCodeAt(Ue)]<<2|$[pe.charCodeAt(Ue+1)]>>4,At[$e++]=ze&255),_e===1&&(ze=$[pe.charCodeAt(Ue)]<<10|$[pe.charCodeAt(Ue+1)]<<4|$[pe.charCodeAt(Ue+2)]>>2,At[$e++]=ze>>8&255,At[$e++]=ze&255),At}function de(pe){return k[pe>>18&63]+k[pe>>12&63]+k[pe>>6&63]+k[pe&63]}function Ne(pe,ze,xe){for(var Oe,_e=[],At=ze;At<xe;At+=3)Oe=(pe[At]<<16&16711680)+(pe[At+1]<<8&65280)+(pe[At+2]&255),_e.push(de(Oe));return _e.join("")}function he(pe){for(var ze,xe=pe.length,Oe=xe%3,_e=[],At=16383,$e=0,Fe=xe-Oe;$e<Fe;$e+=At)_e.push(Ne(pe,$e,$e+At>Fe?Fe:$e+At));return Oe===1?(ze=pe[xe-1],_e.push(k[ze>>2]+k[ze<<4&63]+"==")):Oe===2&&(ze=(pe[xe-2]<<8)+pe[xe-1],_e.push(k[ze>>10]+k[ze>>4&63]+k[ze<<2&63]+"=")),_e.join("")}},{}],14:[function(r,g,V){const{Buffer:k}=r("buffer"),$=Symbol.for("BufferList");function re(oe){if(!(this instanceof re))return new re(oe);re._init.call(this,oe)}re._init=function(Ce){Object.defineProperty(this,$,{value:!0}),this._bufs=[],this.length=0,Ce&&this.append(Ce)},re.prototype._new=function(Ce){return new re(Ce)},re.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}},re.prototype._reverseOffset=function(oe){const Ce=oe[0];let ie=oe[1];for(let ae=0;ae<Ce;ae++)ie+=this._bufs[ae].length;return ie},re.prototype.get=function(Ce){if(Ce>this.length||Ce<0)return;const ie=this._offset(Ce);return this._bufs[ie[0]][ie[1]]},re.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)},re.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,pe=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 ze=0;ze<this._bufs.length;ze++)this._bufs[ze].copy(Ce,he),he+=this._bufs[ze].length;return Ce}if(Ne<=this._bufs[ue[0]].length-pe)return Ie?this._bufs[ue[0]].copy(Ce,ie,pe,pe+Ne):this._bufs[ue[0]].slice(pe,pe+Ne);Ie||(Ce=k.allocUnsafe(de));for(let ze=ue[0];ze<this._bufs.length;ze++){const xe=this._bufs[ze].length-pe;if(Ne>xe)this._bufs[ze].copy(Ce,he,pe),he+=xe;else{this._bufs[ze].copy(Ce,he,pe,pe+Ne),he+=xe;break}Ne-=xe,pe&&(pe=0)}return Ce.length>he?Ce.slice(0,he):Ce},re.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)},re.prototype.toString=function(Ce,ie,ae){return this.slice(ie,ae).toString(Ce)},re.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},re.prototype.duplicate=function(){const Ce=this._new();for(let ie=0;ie<this._bufs.length;ie++)Ce.append(this._bufs[ie]);return Ce},re.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},re.prototype._appendBuffer=function(Ce){this._bufs.push(Ce),this.length+=Ce.length},re.prototype.indexOf=function(oe,Ce,ie){if(ie===void 0&&typeof Ce=="string"&&(ie=Ce,Ce=void 0),typeof oe=="function"||Array.isArray(oe))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof oe=="number"?oe=k.from([oe]):typeof oe=="string"?oe=k.from(oe,ie):this._isBufferList(oe)?oe=oe.slice():Array.isArray(oe.buffer)?oe=k.from(oe.buffer,oe.byteOffset,oe.byteLength):k.isBuffer(oe)||(oe=k.from(oe)),Ce=Number(Ce||0),isNaN(Ce)&&(Ce=0),Ce<0&&(Ce=this.length+Ce),Ce<0&&(Ce=0),oe.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>=oe.length){const Ne=ue.indexOf(oe,Ie);if(Ne!==-1)return this._reverseOffset([le,Ne]);Ie=ue.length-oe.length+1}else{const Ne=this._reverseOffset([le,Ie]);if(this._match(Ne,oe))return Ne;Ie++}Ie=0}return-1},re.prototype._match=function(oe,Ce){if(this.length-oe<Ce.length)return!1;for(let ie=0;ie<Ce.length;ie++)if(this.get(oe+ie)!==Ce[ie])return!1;return!0},function(){const oe={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 oe)(function(ie){oe[ie]===null?re.prototype[ie]=function(ae,le){return this.slice(ae,ae+le)[ie](0,le)}:re.prototype[ie]=function(ae=0){return this.slice(ae,ae+oe[ie])[ie](0)}})(Ce)}(),re.prototype._isBufferList=function(Ce){return Ce instanceof re||re.isBufferList(Ce)},re.isBufferList=function(Ce){return Ce!=null&&Ce[$]},g.exports=re},{buffer:17}],15:[function(r,g,V){const k=r("readable-stream").Duplex,$=r("inherits"),re=r("./BufferList");function oe(Ce){if(!(this instanceof oe))return new oe(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}re._init.call(this,Ce),k.call(this)}$(oe,k),Object.assign(oe.prototype,re.prototype),oe.prototype._new=function(ie){return new oe(ie)},oe.prototype._write=function(ie,ae,le){this._appendBuffer(ie),typeof le=="function"&&le()},oe.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)},oe.prototype.end=function(ie){k.prototype.end.call(this,ie),this._callback&&(this._callback(null,this.slice()),this._callback=null)},oe.prototype._destroy=function(ie,ae){this._bufs.length=0,this.length=0,ae(ie)},oe.prototype._isBufferList=function(ie){return ie instanceof oe||ie instanceof re||oe.isBufferList(ie)},oe.isBufferList=re.isBufferList,g.exports=oe,g.exports.BufferListStream=oe,g.exports.BufferList=re},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(r,g,V){},{}],17:[function(r,g,V){(function(k){(function(){var $=r("base64-js"),re=r("ieee754");V.Buffer=ae,V.SlowBuffer=Oe,V.INSPECT_MAX_BYTES=50;var oe=2147483647;V.kMaxLength=oe,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>oe)throw new RangeError('The value "'+oi+'" is invalid for option "size"');var Lt=new Uint8Array(oi);return Lt.__proto__=ae.prototype,Lt}function ae(oi,Lt,ii){if(typeof oi=="number"){if(typeof Lt=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return de(oi)}return le(oi,Lt,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,Lt,ii){if(typeof oi=="string")return Ne(oi,Lt);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(si(oi,ArrayBuffer)||oi&&si(oi.buffer,ArrayBuffer))return pe(oi,Lt,ii);if(typeof oi=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var gi=oi.valueOf&&oi.valueOf();if(gi!=null&&gi!==oi)return ae.from(gi,Lt,ii);var fi=ze(oi);if(fi)return fi;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof oi[Symbol.toPrimitive]=="function")return ae.from(oi[Symbol.toPrimitive]("string"),Lt,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,Lt,ii){return le(oi,Lt,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,Lt,ii){return Ie(oi),oi<=0?ie(oi):Lt!==void 0?typeof ii=="string"?ie(oi).fill(Lt,ii):ie(oi).fill(Lt):ie(oi)}ae.alloc=function(oi,Lt,ii){return ue(oi,Lt,ii)};function de(oi){return Ie(oi),ie(oi<0?0:xe(oi)|0)}ae.allocUnsafe=function(oi){return de(oi)},ae.allocUnsafeSlow=function(oi){return de(oi)};function Ne(oi,Lt){if((typeof Lt!="string"||Lt==="")&&(Lt="utf8"),!ae.isEncoding(Lt))throw new TypeError("Unknown encoding: "+Lt);var ii=_e(oi,Lt)|0,gi=ie(ii),fi=gi.write(oi,Lt);return fi!==ii&&(gi=gi.slice(0,fi)),gi}function he(oi){for(var Lt=oi.length<0?0:xe(oi.length)|0,ii=ie(Lt),gi=0;gi<Lt;gi+=1)ii[gi]=oi[gi]&255;return ii}function pe(oi,Lt,ii){if(Lt<0||oi.byteLength<Lt)throw new RangeError('"offset" is outside of buffer bounds');if(oi.byteLength<Lt+(ii||0))throw new RangeError('"length" is outside of buffer bounds');var gi;return Lt===void 0&&ii===void 0?gi=new Uint8Array(oi):ii===void 0?gi=new Uint8Array(oi,Lt):gi=new Uint8Array(oi,Lt,ii),gi.__proto__=ae.prototype,gi}function ze(oi){if(ae.isBuffer(oi)){var Lt=xe(oi.length)|0,ii=ie(Lt);return ii.length===0||oi.copy(ii,0,0,Lt),ii}if(oi.length!==void 0)return typeof oi.length!="number"||li(oi.length)?ie(0):he(oi);if(oi.type==="Buffer"&&Array.isArray(oi.data))return he(oi.data)}function xe(oi){if(oi>=oe)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+oe.toString(16)+" bytes");return oi|0}function Oe(oi){return+oi!=oi&&(oi=0),ae.alloc(+oi)}ae.isBuffer=function(Lt){return Lt!=null&&Lt._isBuffer===!0&&Lt!==ae.prototype},ae.compare=function(Lt,ii){if(si(Lt,Uint8Array)&&(Lt=ae.from(Lt,Lt.offset,Lt.byteLength)),si(ii,Uint8Array)&&(ii=ae.from(ii,ii.offset,ii.byteLength)),!ae.isBuffer(Lt)||!ae.isBuffer(ii))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Lt===ii)return 0;for(var gi=Lt.length,fi=ii.length,pi=0,Si=Math.min(gi,fi);pi<Si;++pi)if(Lt[pi]!==ii[pi]){gi=Lt[pi],fi=ii[pi];break}return gi<fi?-1:fi<gi?1:0},ae.isEncoding=function(Lt){switch(String(Lt).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(Lt,ii){if(!Array.isArray(Lt))throw new TypeError('"list" argument must be an Array of Buffers');if(Lt.length===0)return ae.alloc(0);var gi;if(ii===void 0)for(ii=0,gi=0;gi<Lt.length;++gi)ii+=Lt[gi].length;var fi=ae.allocUnsafe(ii),pi=0;for(gi=0;gi<Lt.length;++gi){var Si=Lt[gi];if(si(Si,Uint8Array)&&(Si=ae.from(Si)),!ae.isBuffer(Si))throw new TypeError('"list" argument must be an Array of Buffers');Si.copy(fi,pi),pi+=Si.length}return fi};function _e(oi,Lt){if(ae.isBuffer(oi))return oi.length;if(ArrayBuffer.isView(oi)||si(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,gi=arguments.length>2&&arguments[2]===!0;if(!gi&&ii===0)return 0;for(var fi=!1;;)switch(Lt){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(fi)return gi?-1:Mi(oi).length;Lt=(""+Lt).toLowerCase(),fi=!0}}ae.byteLength=_e;function At(oi,Lt,ii){var gi=!1;if((Lt===void 0||Lt<0)&&(Lt=0),Lt>this.length||((ii===void 0||ii>this.length)&&(ii=this.length),ii<=0)||(ii>>>=0,Lt>>>=0,ii<=Lt))return"";for(oi||(oi="utf8");;)switch(oi){case"hex":return wi(this,Lt,ii);case"utf8":case"utf-8":return ei(this,Lt,ii);case"ascii":return ri(this,Lt,ii);case"latin1":case"binary":return Ii(this,Lt,ii);case"base64":return ti(this,Lt,ii);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ai(this,Lt,ii);default:if(gi)throw new TypeError("Unknown encoding: "+oi);oi=(oi+"").toLowerCase(),gi=!0}}ae.prototype._isBuffer=!0;function $e(oi,Lt,ii){var gi=oi[Lt];oi[Lt]=oi[ii],oi[ii]=gi}ae.prototype.swap16=function(){var Lt=this.length;if(Lt%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var ii=0;ii<Lt;ii+=2)$e(this,ii,ii+1);return this},ae.prototype.swap32=function(){var Lt=this.length;if(Lt%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var ii=0;ii<Lt;ii+=4)$e(this,ii,ii+3),$e(this,ii+1,ii+2);return this},ae.prototype.swap64=function(){var Lt=this.length;if(Lt%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var ii=0;ii<Lt;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 Lt=this.length;return Lt===0?"":arguments.length===0?ei(this,0,Lt):At.apply(this,arguments)},ae.prototype.toLocaleString=ae.prototype.toString,ae.prototype.equals=function(Lt){if(!ae.isBuffer(Lt))throw new TypeError("Argument must be a Buffer");return this===Lt?!0:ae.compare(this,Lt)===0},ae.prototype.inspect=function(){var Lt="",ii=V.INSPECT_MAX_BYTES;return Lt=this.toString("hex",0,ii).replace(/(.{2})/g,"$1 ").trim(),this.length>ii&&(Lt+=" ... "),"<Buffer "+Lt+">"},ae.prototype.compare=function(Lt,ii,gi,fi,pi){if(si(Lt,Uint8Array)&&(Lt=ae.from(Lt,Lt.offset,Lt.byteLength)),!ae.isBuffer(Lt))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Lt);if(ii===void 0&&(ii=0),gi===void 0&&(gi=Lt?Lt.length:0),fi===void 0&&(fi=0),pi===void 0&&(pi=this.length),ii<0||gi>Lt.length||fi<0||pi>this.length)throw new RangeError("out of range index");if(fi>=pi&&ii>=gi)return 0;if(fi>=pi)return-1;if(ii>=gi)return 1;if(ii>>>=0,gi>>>=0,fi>>>=0,pi>>>=0,this===Lt)return 0;for(var Si=pi-fi,xi=gi-ii,Gi=Math.min(Si,xi),Bi=this.slice(fi,pi),Oi=Lt.slice(ii,gi),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,Lt,ii,gi,fi){if(oi.length===0)return-1;if(typeof ii=="string"?(gi=ii,ii=0):ii>2147483647?ii=2147483647:ii<-2147483648&&(ii=-2147483648),ii=+ii,li(ii)&&(ii=fi?0:oi.length-1),ii<0&&(ii=oi.length+ii),ii>=oi.length){if(fi)return-1;ii=oi.length-1}else if(ii<0)if(fi)ii=0;else return-1;if(typeof Lt=="string"&&(Lt=ae.from(Lt,gi)),ae.isBuffer(Lt))return Lt.length===0?-1:Ue(oi,Lt,ii,gi,fi);if(typeof Lt=="number")return Lt=Lt&255,typeof Uint8Array.prototype.indexOf=="function"?fi?Uint8Array.prototype.indexOf.call(oi,Lt,ii):Uint8Array.prototype.lastIndexOf.call(oi,Lt,ii):Ue(oi,[Lt],ii,gi,fi);throw new TypeError("val must be string, number or Buffer")}function Ue(oi,Lt,ii,gi,fi){var pi=1,Si=oi.length,xi=Lt.length;if(gi!==void 0&&(gi=String(gi).toLowerCase(),gi==="ucs2"||gi==="ucs-2"||gi==="utf16le"||gi==="utf-16le")){if(oi.length<2||Lt.length<2)return-1;pi=2,Si/=2,xi/=2,ii/=2}function Gi(Vi,ki){return pi===1?Vi[ki]:Vi.readUInt16BE(ki*pi)}var Bi;if(fi){var Oi=-1;for(Bi=ii;Bi<Si;Bi++)if(Gi(oi,Bi)===Gi(Lt,Oi===-1?0:Bi-Oi)){if(Oi===-1&&(Oi=Bi),Bi-Oi+1===xi)return Oi*pi}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(Lt,Wi)){Zi=!1;break}if(Zi)return Bi}return-1}ae.prototype.includes=function(Lt,ii,gi){return this.indexOf(Lt,ii,gi)!==-1},ae.prototype.indexOf=function(Lt,ii,gi){return Fe(this,Lt,ii,gi,!0)},ae.prototype.lastIndexOf=function(Lt,ii,gi){return Fe(this,Lt,ii,gi,!1)};function Ve(oi,Lt,ii,gi){ii=Number(ii)||0;var fi=oi.length-ii;gi?(gi=Number(gi),gi>fi&&(gi=fi)):gi=fi;var pi=Lt.length;gi>pi/2&&(gi=pi/2);for(var Si=0;Si<gi;++Si){var xi=parseInt(Lt.substr(Si*2,2),16);if(li(xi))return Si;oi[ii+Si]=xi}return Si}function Dt(oi,Lt,ii,gi){return bi(Mi(Lt,oi.length-ii),oi,ii,gi)}function qe(oi,Lt,ii,gi){return bi(Ni(Lt),oi,ii,gi)}function kt(oi,Lt,ii,gi){return qe(oi,Lt,ii,gi)}function jt(oi,Lt,ii,gi){return bi(vi(Lt),oi,ii,gi)}function Pt(oi,Lt,ii,gi){return bi(mi(Lt,oi.length-ii),oi,ii,gi)}ae.prototype.write=function(Lt,ii,gi,fi){if(ii===void 0)fi="utf8",gi=this.length,ii=0;else if(gi===void 0&&typeof ii=="string")fi=ii,gi=this.length,ii=0;else if(isFinite(ii))ii=ii>>>0,isFinite(gi)?(gi=gi>>>0,fi===void 0&&(fi="utf8")):(fi=gi,gi=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var pi=this.length-ii;if((gi===void 0||gi>pi)&&(gi=pi),Lt.length>0&&(gi<0||ii<0)||ii>this.length)throw new RangeError("Attempt to write outside buffer bounds");fi||(fi="utf8");for(var Si=!1;;)switch(fi){case"hex":return Ve(this,Lt,ii,gi);case"utf8":case"utf-8":return Dt(this,Lt,ii,gi);case"ascii":return qe(this,Lt,ii,gi);case"latin1":case"binary":return kt(this,Lt,ii,gi);case"base64":return jt(this,Lt,ii,gi);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pt(this,Lt,ii,gi);default:if(Si)throw new TypeError("Unknown encoding: "+fi);fi=(""+fi).toLowerCase(),Si=!0}},ae.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ti(oi,Lt,ii){return Lt===0&&ii===oi.length?$.fromByteArray(oi):$.fromByteArray(oi.slice(Lt,ii))}function ei(oi,Lt,ii){ii=Math.min(oi.length,ii);for(var gi=[],fi=Lt;fi<ii;){var pi=oi[fi],Si=null,xi=pi>239?4:pi>223?3:pi>191?2:1;if(fi+xi<=ii){var Gi,Bi,Oi,Zi;switch(xi){case 1:pi<128&&(Si=pi);break;case 2:Gi=oi[fi+1],(Gi&192)===128&&(Zi=(pi&31)<<6|Gi&63,Zi>127&&(Si=Zi));break;case 3:Gi=oi[fi+1],Bi=oi[fi+2],(Gi&192)===128&&(Bi&192)===128&&(Zi=(pi&15)<<12|(Gi&63)<<6|Bi&63,Zi>2047&&(Zi<55296||Zi>57343)&&(Si=Zi));break;case 4:Gi=oi[fi+1],Bi=oi[fi+2],Oi=oi[fi+3],(Gi&192)===128&&(Bi&192)===128&&(Oi&192)===128&&(Zi=(pi&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,gi.push(Si>>>10&1023|55296),Si=56320|Si&1023),gi.push(Si),fi+=xi}return ni(gi)}var Et=4096;function ni(oi){var Lt=oi.length;if(Lt<=Et)return String.fromCharCode.apply(String,oi);for(var ii="",gi=0;gi<Lt;)ii+=String.fromCharCode.apply(String,oi.slice(gi,gi+=Et));return ii}function ri(oi,Lt,ii){var gi="";ii=Math.min(oi.length,ii);for(var fi=Lt;fi<ii;++fi)gi+=String.fromCharCode(oi[fi]&127);return gi}function Ii(oi,Lt,ii){var gi="";ii=Math.min(oi.length,ii);for(var fi=Lt;fi<ii;++fi)gi+=String.fromCharCode(oi[fi]);return gi}function wi(oi,Lt,ii){var gi=oi.length;(!Lt||Lt<0)&&(Lt=0),(!ii||ii<0||ii>gi)&&(ii=gi);for(var fi="",pi=Lt;pi<ii;++pi)fi+=zi(oi[pi]);return fi}function ai(oi,Lt,ii){for(var gi=oi.slice(Lt,ii),fi="",pi=0;pi<gi.length;pi+=2)fi+=String.fromCharCode(gi[pi]+gi[pi+1]*256);return fi}ae.prototype.slice=function(Lt,ii){var gi=this.length;Lt=~~Lt,ii=ii===void 0?gi:~~ii,Lt<0?(Lt+=gi,Lt<0&&(Lt=0)):Lt>gi&&(Lt=gi),ii<0?(ii+=gi,ii<0&&(ii=0)):ii>gi&&(ii=gi),ii<Lt&&(ii=Lt);var fi=this.subarray(Lt,ii);return fi.__proto__=ae.prototype,fi};function di(oi,Lt,ii){if(oi%1!==0||oi<0)throw new RangeError("offset is not uint");if(oi+Lt>ii)throw new RangeError("Trying to access beyond buffer length")}ae.prototype.readUIntLE=function(Lt,ii,gi){Lt=Lt>>>0,ii=ii>>>0,gi||di(Lt,ii,this.length);for(var fi=this[Lt],pi=1,Si=0;++Si<ii&&(pi*=256);)fi+=this[Lt+Si]*pi;return fi},ae.prototype.readUIntBE=function(Lt,ii,gi){Lt=Lt>>>0,ii=ii>>>0,gi||di(Lt,ii,this.length);for(var fi=this[Lt+--ii],pi=1;ii>0&&(pi*=256);)fi+=this[Lt+--ii]*pi;return fi},ae.prototype.readUInt8=function(Lt,ii){return Lt=Lt>>>0,ii||di(Lt,1,this.length),this[Lt]},ae.prototype.readUInt16LE=function(Lt,ii){return Lt=Lt>>>0,ii||di(Lt,2,this.length),this[Lt]|this[Lt+1]<<8},ae.prototype.readUInt16BE=function(Lt,ii){return Lt=Lt>>>0,ii||di(Lt,2,this.length),this[Lt]<<8|this[Lt+1]},ae.prototype.readUInt32LE=function(Lt,ii){return Lt=Lt>>>0,ii||di(Lt,4,this.length),(this[Lt]|this[Lt+1]<<8|this[Lt+2]<<16)+this[Lt+3]*16777216},ae.prototype.readUInt32BE=function(Lt,ii){return Lt=Lt>>>0,ii||di(Lt,4,this.length),this[Lt]*16777216+(this[Lt+1]<<16|this[Lt+2]<<8|this[Lt+3])},ae.prototype.readIntLE=function(Lt,ii,gi){Lt=Lt>>>0,ii=ii>>>0,gi||di(Lt,ii,this.length);for(var fi=this[Lt],pi=1,Si=0;++Si<ii&&(pi*=256);)fi+=this[Lt+Si]*pi;return pi*=128,fi>=pi&&(fi-=Math.pow(2,8*ii)),fi},ae.prototype.readIntBE=function(Lt,ii,gi){Lt=Lt>>>0,ii=ii>>>0,gi||di(Lt,ii,this.length);for(var fi=ii,pi=1,Si=this[Lt+--fi];fi>0&&(pi*=256);)Si+=this[Lt+--fi]*pi;return pi*=128,Si>=pi&&(Si-=Math.pow(2,8*ii)),Si},ae.prototype.readInt8=function(Lt,ii){return Lt=Lt>>>0,ii||di(Lt,1,this.length),this[Lt]&128?(255-this[Lt]+1)*-1:this[Lt]},ae.prototype.readInt16LE=function(Lt,ii){Lt=Lt>>>0,ii||di(Lt,2,this.length);var gi=this[Lt]|this[Lt+1]<<8;return gi&32768?gi|4294901760:gi},ae.prototype.readInt16BE=function(Lt,ii){Lt=Lt>>>0,ii||di(Lt,2,this.length);var gi=this[Lt+1]|this[Lt]<<8;return gi&32768?gi|4294901760:gi},ae.prototype.readInt32LE=function(Lt,ii){return Lt=Lt>>>0,ii||di(Lt,4,this.length),this[Lt]|this[Lt+1]<<8|this[Lt+2]<<16|this[Lt+3]<<24},ae.prototype.readInt32BE=function(Lt,ii){return Lt=Lt>>>0,ii||di(Lt,4,this.length),this[Lt]<<24|this[Lt+1]<<16|this[Lt+2]<<8|this[Lt+3]},ae.prototype.readFloatLE=function(Lt,ii){return Lt=Lt>>>0,ii||di(Lt,4,this.length),re.read(this,Lt,!0,23,4)},ae.prototype.readFloatBE=function(Lt,ii){return Lt=Lt>>>0,ii||di(Lt,4,this.length),re.read(this,Lt,!1,23,4)},ae.prototype.readDoubleLE=function(Lt,ii){return Lt=Lt>>>0,ii||di(Lt,8,this.length),re.read(this,Lt,!0,52,8)},ae.prototype.readDoubleBE=function(Lt,ii){return Lt=Lt>>>0,ii||di(Lt,8,this.length),re.read(this,Lt,!1,52,8)};function hi(oi,Lt,ii,gi,fi,pi){if(!ae.isBuffer(oi))throw new TypeError('"buffer" argument must be a Buffer instance');if(Lt>fi||Lt<pi)throw new RangeError('"value" argument is out of bounds');if(ii+gi>oi.length)throw new RangeError("Index out of range")}ae.prototype.writeUIntLE=function(Lt,ii,gi,fi){if(Lt=+Lt,ii=ii>>>0,gi=gi>>>0,!fi){var pi=Math.pow(2,8*gi)-1;hi(this,Lt,ii,gi,pi,0)}var Si=1,xi=0;for(this[ii]=Lt&255;++xi<gi&&(Si*=256);)this[ii+xi]=Lt/Si&255;return ii+gi},ae.prototype.writeUIntBE=function(Lt,ii,gi,fi){if(Lt=+Lt,ii=ii>>>0,gi=gi>>>0,!fi){var pi=Math.pow(2,8*gi)-1;hi(this,Lt,ii,gi,pi,0)}var Si=gi-1,xi=1;for(this[ii+Si]=Lt&255;--Si>=0&&(xi*=256);)this[ii+Si]=Lt/xi&255;return ii+gi},ae.prototype.writeUInt8=function(Lt,ii,gi){return Lt=+Lt,ii=ii>>>0,gi||hi(this,Lt,ii,1,255,0),this[ii]=Lt&255,ii+1},ae.prototype.writeUInt16LE=function(Lt,ii,gi){return Lt=+Lt,ii=ii>>>0,gi||hi(this,Lt,ii,2,65535,0),this[ii]=Lt&255,this[ii+1]=Lt>>>8,ii+2},ae.prototype.writeUInt16BE=function(Lt,ii,gi){return Lt=+Lt,ii=ii>>>0,gi||hi(this,Lt,ii,2,65535,0),this[ii]=Lt>>>8,this[ii+1]=Lt&255,ii+2},ae.prototype.writeUInt32LE=function(Lt,ii,gi){return Lt=+Lt,ii=ii>>>0,gi||hi(this,Lt,ii,4,4294967295,0),this[ii+3]=Lt>>>24,this[ii+2]=Lt>>>16,this[ii+1]=Lt>>>8,this[ii]=Lt&255,ii+4},ae.prototype.writeUInt32BE=function(Lt,ii,gi){return Lt=+Lt,ii=ii>>>0,gi||hi(this,Lt,ii,4,4294967295,0),this[ii]=Lt>>>24,this[ii+1]=Lt>>>16,this[ii+2]=Lt>>>8,this[ii+3]=Lt&255,ii+4},ae.prototype.writeIntLE=function(Lt,ii,gi,fi){if(Lt=+Lt,ii=ii>>>0,!fi){var pi=Math.pow(2,8*gi-1);hi(this,Lt,ii,gi,pi-1,-pi)}var Si=0,xi=1,Gi=0;for(this[ii]=Lt&255;++Si<gi&&(xi*=256);)Lt<0&&Gi===0&&this[ii+Si-1]!==0&&(Gi=1),this[ii+Si]=(Lt/xi>>0)-Gi&255;return ii+gi},ae.prototype.writeIntBE=function(Lt,ii,gi,fi){if(Lt=+Lt,ii=ii>>>0,!fi){var pi=Math.pow(2,8*gi-1);hi(this,Lt,ii,gi,pi-1,-pi)}var Si=gi-1,xi=1,Gi=0;for(this[ii+Si]=Lt&255;--Si>=0&&(xi*=256);)Lt<0&&Gi===0&&this[ii+Si+1]!==0&&(Gi=1),this[ii+Si]=(Lt/xi>>0)-Gi&255;return ii+gi},ae.prototype.writeInt8=function(Lt,ii,gi){return Lt=+Lt,ii=ii>>>0,gi||hi(this,Lt,ii,1,127,-128),Lt<0&&(Lt=255+Lt+1),this[ii]=Lt&255,ii+1},ae.prototype.writeInt16LE=function(Lt,ii,gi){return Lt=+Lt,ii=ii>>>0,gi||hi(this,Lt,ii,2,32767,-32768),this[ii]=Lt&255,this[ii+1]=Lt>>>8,ii+2},ae.prototype.writeInt16BE=function(Lt,ii,gi){return Lt=+Lt,ii=ii>>>0,gi||hi(this,Lt,ii,2,32767,-32768),this[ii]=Lt>>>8,this[ii+1]=Lt&255,ii+2},ae.prototype.writeInt32LE=function(Lt,ii,gi){return Lt=+Lt,ii=ii>>>0,gi||hi(this,Lt,ii,4,2147483647,-2147483648),this[ii]=Lt&255,this[ii+1]=Lt>>>8,this[ii+2]=Lt>>>16,this[ii+3]=Lt>>>24,ii+4},ae.prototype.writeInt32BE=function(Lt,ii,gi){return Lt=+Lt,ii=ii>>>0,gi||hi(this,Lt,ii,4,2147483647,-2147483648),Lt<0&&(Lt=4294967295+Lt+1),this[ii]=Lt>>>24,this[ii+1]=Lt>>>16,this[ii+2]=Lt>>>8,this[ii+3]=Lt&255,ii+4};function ci(oi,Lt,ii,gi,fi,pi){if(ii+gi>oi.length)throw new RangeError("Index out of range");if(ii<0)throw new RangeError("Index out of range")}function Ai(oi,Lt,ii,gi,fi){return Lt=+Lt,ii=ii>>>0,fi||ci(oi,Lt,ii,4),re.write(oi,Lt,ii,gi,23,4),ii+4}ae.prototype.writeFloatLE=function(Lt,ii,gi){return Ai(this,Lt,ii,!0,gi)},ae.prototype.writeFloatBE=function(Lt,ii,gi){return Ai(this,Lt,ii,!1,gi)};function yi(oi,Lt,ii,gi,fi){return Lt=+Lt,ii=ii>>>0,fi||ci(oi,Lt,ii,8),re.write(oi,Lt,ii,gi,52,8),ii+8}ae.prototype.writeDoubleLE=function(Lt,ii,gi){return yi(this,Lt,ii,!0,gi)},ae.prototype.writeDoubleBE=function(Lt,ii,gi){return yi(this,Lt,ii,!1,gi)},ae.prototype.copy=function(Lt,ii,gi,fi){if(!ae.isBuffer(Lt))throw new TypeError("argument should be a Buffer");if(gi||(gi=0),!fi&&fi!==0&&(fi=this.length),ii>=Lt.length&&(ii=Lt.length),ii||(ii=0),fi>0&&fi<gi&&(fi=gi),fi===gi||Lt.length===0||this.length===0)return 0;if(ii<0)throw new RangeError("targetStart out of bounds");if(gi<0||gi>=this.length)throw new RangeError("Index out of range");if(fi<0)throw new RangeError("sourceEnd out of bounds");fi>this.length&&(fi=this.length),Lt.length-ii<fi-gi&&(fi=Lt.length-ii+gi);var pi=fi-gi;if(this===Lt&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(ii,gi,fi);else if(this===Lt&&gi<ii&&ii<fi)for(var Si=pi-1;Si>=0;--Si)Lt[Si+ii]=this[Si+gi];else Uint8Array.prototype.set.call(Lt,this.subarray(gi,fi),ii);return pi},ae.prototype.fill=function(Lt,ii,gi,fi){if(typeof Lt=="string"){if(typeof ii=="string"?(fi=ii,ii=0,gi=this.length):typeof gi=="string"&&(fi=gi,gi=this.length),fi!==void 0&&typeof fi!="string")throw new TypeError("encoding must be a string");if(typeof fi=="string"&&!ae.isEncoding(fi))throw new TypeError("Unknown encoding: "+fi);if(Lt.length===1){var pi=Lt.charCodeAt(0);(fi==="utf8"&&pi<128||fi==="latin1")&&(Lt=pi)}}else typeof Lt=="number"&&(Lt=Lt&255);if(ii<0||this.length<ii||this.length<gi)throw new RangeError("Out of range index");if(gi<=ii)return this;ii=ii>>>0,gi=gi===void 0?this.length:gi>>>0,Lt||(Lt=0);var Si;if(typeof Lt=="number")for(Si=ii;Si<gi;++Si)this[Si]=Lt;else{var xi=ae.isBuffer(Lt)?Lt:ae.from(Lt,fi),Gi=xi.length;if(Gi===0)throw new TypeError('The value "'+Lt+'" is invalid for argument "value"');for(Si=0;Si<gi-ii;++Si)this[Si+ii]=xi[Si%Gi]}return this};var ui=/[^+/0-9A-Za-z-_]/g;function Ci(oi){if(oi=oi.split("=")[0],oi=oi.trim().replace(ui,""),oi.length<2)return"";for(;oi.length%4!==0;)oi=oi+"=";return oi}function zi(oi){return oi<16?"0"+oi.toString(16):oi.toString(16)}function Mi(oi,Lt){Lt=Lt||1/0;for(var ii,gi=oi.length,fi=null,pi=[],Si=0;Si<gi;++Si){if(ii=oi.charCodeAt(Si),ii>55295&&ii<57344){if(!fi){if(ii>56319){(Lt-=3)>-1&&pi.push(239,191,189);continue}else if(Si+1===gi){(Lt-=3)>-1&&pi.push(239,191,189);continue}fi=ii;continue}if(ii<56320){(Lt-=3)>-1&&pi.push(239,191,189),fi=ii;continue}ii=(fi-55296<<10|ii-56320)+65536}else fi&&(Lt-=3)>-1&&pi.push(239,191,189);if(fi=null,ii<128){if((Lt-=1)<0)break;pi.push(ii)}else if(ii<2048){if((Lt-=2)<0)break;pi.push(ii>>6|192,ii&63|128)}else if(ii<65536){if((Lt-=3)<0)break;pi.push(ii>>12|224,ii>>6&63|128,ii&63|128)}else if(ii<1114112){if((Lt-=4)<0)break;pi.push(ii>>18|240,ii>>12&63|128,ii>>6&63|128,ii&63|128)}else throw new Error("Invalid code point")}return pi}function Ni(oi){for(var Lt=[],ii=0;ii<oi.length;++ii)Lt.push(oi.charCodeAt(ii)&255);return Lt}function mi(oi,Lt){for(var ii,gi,fi,pi=[],Si=0;Si<oi.length&&!((Lt-=2)<0);++Si)ii=oi.charCodeAt(Si),gi=ii>>8,fi=ii%256,pi.push(fi),pi.push(gi);return pi}function vi(oi){return $.toByteArray(Ci(oi))}function bi(oi,Lt,ii,gi){for(var fi=0;fi<gi&&!(fi+ii>=Lt.length||fi>=oi.length);++fi)Lt[fi+ii]=oi[fi];return fi}function si(oi,Lt){return oi instanceof Lt||oi!=null&&oi.constructor!=null&&oi.constructor.name!=null&&oi.constructor.name===Lt.name}function li(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=re,V.save=oe,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 re(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 oe(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($){oe.debug=oe,oe.default=oe,oe.coerce=ue,oe.disable=ae,oe.enable=ie,oe.enabled=le,oe.humanize=r("ms"),oe.destroy=de,Object.keys($).forEach(Ne=>{oe[Ne]=$[Ne]}),oe.names=[],oe.skips=[],oe.formatters={};function re(Ne){let he=0;for(let pe=0;pe<Ne.length;pe++)he=(he<<5)-he+Ne.charCodeAt(pe),he|=0;return oe.colors[Math.abs(he)%oe.colors.length]}oe.selectColor=re;function oe(Ne){let he,pe=null,ze,xe;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]=oe.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=oe.formatters[qe];if(typeof kt=="function"){const jt=_e[Ue];Dt=kt.call(At,jt),_e.splice(Ue,1),Ue--}return Dt}),oe.formatArgs.call(At,_e),(At.log||oe.log).apply(At,_e)}return Oe.namespace=Ne,Oe.useColors=oe.useColors(),Oe.color=oe.selectColor(Ne),Oe.extend=Ce,Oe.destroy=oe.destroy,Object.defineProperty(Oe,"enabled",{enumerable:!0,configurable:!1,get:()=>pe!==null?pe:(ze!==oe.namespaces&&(ze=oe.namespaces,xe=oe.enabled(Ne)),xe),set:_e=>{pe=_e}}),typeof oe.init=="function"&&oe.init(Oe),Oe}function Ce(Ne,he){const pe=oe(this.namespace+(typeof he>"u"?":":he)+Ne);return pe.log=this.log,pe}function ie(Ne){oe.save(Ne),oe.namespaces=Ne,oe.names=[],oe.skips=[];let he;const pe=(typeof Ne=="string"?Ne:"").split(/[\s,]+/),ze=pe.length;for(he=0;he<ze;he++)pe[he]&&(Ne=pe[he].replace(/\*/g,".*?"),Ne[0]==="-"?oe.skips.push(new RegExp("^"+Ne.substr(1)+"$")):oe.names.push(new RegExp("^"+Ne+"$")))}function ae(){const Ne=[...oe.names.map(Ie),...oe.skips.map(Ie).map(he=>"-"+he)].join(",");return oe.enable(""),Ne}function le(Ne){if(Ne[Ne.length-1]==="*")return!0;let he,pe;for(he=0,pe=oe.skips.length;he<pe;he++)if(oe.skips[he].test(Ne))return!1;for(he=0,pe=oe.names.length;he<pe;he++)if(oe.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 oe.enable(oe.load()),oe}g.exports=k},{ms:45}],20:[function(r,g,V){(function(k,$){(function(){var re=r("readable-stream"),oe=r("end-of-stream"),Ce=r("inherits"),ie=r("stream-shift"),ae=$.from&&$.from!==Uint8Array.from?$.from([0]):new $([0]),le=function(ze,xe){ze._corked?ze.once("uncork",xe):xe()},Ie=function(ze,xe){ze._autoDestroy&&ze.destroy(xe)},ue=function(ze,xe){return function(Oe){Oe?Ie(ze,Oe.message==="premature close"?null:Oe):xe&&!ze._ended&&ze.end()}},de=function(ze,xe){if(!ze||ze._writableState&&ze._writableState.finished)return xe();if(ze._writableState)return ze.end(xe);ze.end(),xe()},Ne=function(){},he=function(ze){return new re.Readable({objectMode:!0,highWaterMark:16}).wrap(ze)},pe=function(ze,xe,Oe){if(!(this instanceof pe))return new pe(ze,xe,Oe);re.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,ze&&this.setWritable(ze),xe&&this.setReadable(xe)};Ce(pe,re.Duplex),pe.obj=function(ze,xe,Oe){return Oe||(Oe={}),Oe.objectMode=!0,Oe.highWaterMark=16,new pe(ze,xe,Oe)},pe.prototype.cork=function(){++this._corked===1&&this.emit("cork")},pe.prototype.uncork=function(){this._corked&&--this._corked===0&&this.emit("uncork")},pe.prototype.setWritable=function(ze){if(this._unwrite&&this._unwrite(),this.destroyed){ze&&ze.destroy&&ze.destroy();return}if(ze===null||ze===!1){this.end();return}var xe=this,Oe=oe(ze,{writable:!0,readable:!1},ue(this,this._forwardEnd)),_e=function(){var $e=xe._ondrain;xe._ondrain=null,$e&&$e()},At=function(){xe._writable.removeListener("drain",_e),Oe()};this._unwrite&&k.nextTick(_e),this._writable=ze,this._writable.on("drain",_e),this._unwrite=At,this.uncork()},pe.prototype.setReadable=function(ze){if(this._unread&&this._unread(),this.destroyed){ze&&ze.destroy&&ze.destroy();return}if(ze===null||ze===!1){this.push(null),this.resume();return}var xe=this,Oe=oe(ze,{writable:!1,readable:!0},ue(this)),_e=function(){xe._forward()},At=function(){xe.push(null)},$e=function(){xe._readable2.removeListener("readable",_e),xe._readable2.removeListener("end",At),Oe()};this._drained=!0,this._readable=ze,this._readable2=ze._readableState?ze:he(ze),this._readable2.on("readable",_e),this._readable2.on("end",At),this._unread=$e,this._forward()},pe.prototype._read=function(){this._drained=!0,this._forward()},pe.prototype._forward=function(){if(!(this._forwarding||!this._readable2||!this._drained)){this._forwarding=!0;for(var ze;this._drained&&(ze=ie(this._readable2))!==null;)this.destroyed||(this._drained=this.push(ze));this._forwarding=!1}},pe.prototype.destroy=function(ze,xe){if(xe||(xe=Ne),this.destroyed)return xe(null);this.destroyed=!0;var Oe=this;k.nextTick(function(){Oe._destroy(ze),xe(null)})},pe.prototype._destroy=function(ze){if(ze){var xe=this._ondrain;this._ondrain=null,xe?xe(ze):this.emit("error",ze)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},pe.prototype._write=function(ze,xe,Oe){if(!this.destroyed){if(this._corked)return le(this,this._write.bind(this,ze,xe,Oe));if(ze===ae)return this._finish(Oe);if(!this._writable)return Oe();this._writable.write(ze)===!1?this._ondrain=Oe:this.destroyed||Oe()}},pe.prototype._finish=function(ze){var xe=this;this.emit("preend"),le(this,function(){de(xe._forwardEnd&&xe._writable,function(){xe._writableState.prefinished===!1&&(xe._writableState.prefinished=!0),xe.emit("prefinish"),le(xe,ze)})})},pe.prototype.end=function(ze,xe,Oe){return typeof ze=="function"?this.end(null,null,ze):typeof xe=="function"?this.end(ze,null,xe):(this._ended=!0,ze&&this.write(ze),!this._writableState.ending&&!this._writableState.destroyed&&this.write(ae),re.Writable.prototype.end.call(this,Oe))},g.exports=pe}).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"),re=function(){},oe=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||re);var ue=ae._writableState,de=ae._readableState,Ne=le.readable||le.readable!==!1&&ae.readable,he=le.writable||le.writable!==!1&&ae.writable,pe=!1,ze=function(){ae.writable||xe()},xe=function(){he=!1,Ne||Ie.call(ae)},Oe=function(){Ne=!1,he||Ie.call(ae)},_e=function(Ve){Ie.call(ae,Ve?new Error("exited with error code: "+Ve):null)},At=function(Ve){Ie.call(ae,Ve)},$e=function(){k.nextTick(Fe)},Fe=function(){if(!pe){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",xe)};return oe(ae)?(ae.on("complete",xe),ae.on("abort",$e),ae.req?Ue():ae.on("request",Ue)):he&&!ue&&(ae.on("end",ze),ae.on("close",ze)),Ce(ae)&&ae.on("exit",_e),ae.on("end",Oe),ae.on("finish",xe),le.error!==!1&&ae.on("error",At),ae.on("close",$e),function(){pe=!0,ae.removeListener("complete",xe),ae.removeListener("abort",$e),ae.removeListener("request",Ue),ae.req&&ae.req.removeListener("finish",xe),ae.removeListener("end",ze),ae.removeListener("close",ze),ae.removeListener("finish",xe),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||Ve,re=Function.prototype.bind||Dt;function oe(){(!this._events||!Object.prototype.hasOwnProperty.call(this,"_events"))&&(this._events=k(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}g.exports=oe,oe.EventEmitter=oe,oe.prototype._events=void 0,oe.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(oe,"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}}):oe.defaultMaxListeners=Ce,oe.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?oe.defaultMaxListeners:qe._maxListeners}oe.prototype.getMaxListeners=function(){return le(this)};function Ie(qe,kt,jt){if(kt)qe.call(jt);else for(var Pt=qe.length,ti=$e(qe,Pt),ei=0;ei<Pt;++ei)ti[ei].call(jt)}function ue(qe,kt,jt,Pt){if(kt)qe.call(jt,Pt);else for(var ti=qe.length,ei=$e(qe,ti),Et=0;Et<ti;++Et)ei[Et].call(jt,Pt)}function de(qe,kt,jt,Pt,ti){if(kt)qe.call(jt,Pt,ti);else for(var ei=qe.length,Et=$e(qe,ei),ni=0;ni<ei;++ni)Et[ni].call(jt,Pt,ti)}function Ne(qe,kt,jt,Pt,ti,ei){if(kt)qe.call(jt,Pt,ti,ei);else for(var Et=qe.length,ni=$e(qe,Et),ri=0;ri<Et;++ri)ni[ri].call(jt,Pt,ti,ei)}function he(qe,kt,jt,Pt){if(kt)qe.apply(jt,Pt);else for(var ti=qe.length,ei=$e(qe,ti),Et=0;Et<ti;++Et)ei[Et].apply(jt,Pt)}oe.prototype.emit=function(kt){var jt,Pt,ti,ei,Et,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&&(jt=arguments[1]),jt instanceof Error)throw jt;var Ii=new Error('Unhandled "error" event. ('+jt+")");throw Ii.context=jt,Ii}if(Pt=ni[kt],!Pt)return!1;var wi=typeof Pt=="function";switch(ti=arguments.length,ti){case 1:Ie(Pt,wi,this);break;case 2:ue(Pt,wi,this,arguments[1]);break;case 3:de(Pt,wi,this,arguments[1],arguments[2]);break;case 4:Ne(Pt,wi,this,arguments[1],arguments[2],arguments[3]);break;default:for(ei=new Array(ti-1),Et=1;Et<ti;Et++)ei[Et-1]=arguments[Et];he(Pt,wi,this,ei)}return!0};function pe(qe,kt,jt,Pt){var ti,ei,Et;if(typeof jt!="function")throw new TypeError('"listener" argument must be a function');if(ei=qe._events,ei?(ei.newListener&&(qe.emit("newListener",kt,jt.listener?jt.listener:jt),ei=qe._events),Et=ei[kt]):(ei=qe._events=k(null),qe._eventsCount=0),!Et)Et=ei[kt]=jt,++qe._eventsCount;else if(typeof Et=="function"?Et=ei[kt]=Pt?[jt,Et]:[Et,jt]:Pt?Et.unshift(jt):Et.push(jt),!Et.warned&&(ti=le(qe),ti&&ti>0&&Et.length>ti)){Et.warned=!0;var ni=new Error("Possible EventEmitter memory leak detected. "+Et.length+' "'+String(kt)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');ni.name="MaxListenersExceededWarning",ni.emitter=qe,ni.type=kt,ni.count=Et.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",ni.name,ni.message)}return qe}oe.prototype.addListener=function(kt,jt){return pe(this,kt,jt,!1)},oe.prototype.on=oe.prototype.addListener,oe.prototype.prependListener=function(kt,jt){return pe(this,kt,jt,!0)};function ze(){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 xe(qe,kt,jt){var Pt={fired:!1,wrapFn:void 0,target:qe,type:kt,listener:jt},ti=re.call(ze,Pt);return ti.listener=jt,Pt.wrapFn=ti,ti}oe.prototype.once=function(kt,jt){if(typeof jt!="function")throw new TypeError('"listener" argument must be a function');return this.on(kt,xe(this,kt,jt)),this},oe.prototype.prependOnceListener=function(kt,jt){if(typeof jt!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(kt,xe(this,kt,jt)),this},oe.prototype.removeListener=function(kt,jt){var Pt,ti,ei,Et,ni;if(typeof jt!="function")throw new TypeError('"listener" argument must be a function');if(ti=this._events,!ti)return this;if(Pt=ti[kt],!Pt)return this;if(Pt===jt||Pt.listener===jt)--this._eventsCount===0?this._events=k(null):(delete ti[kt],ti.removeListener&&this.emit("removeListener",kt,Pt.listener||jt));else if(typeof Pt!="function"){for(ei=-1,Et=Pt.length-1;Et>=0;Et--)if(Pt[Et]===jt||Pt[Et].listener===jt){ni=Pt[Et].listener,ei=Et;break}if(ei<0)return this;ei===0?Pt.shift():At(Pt,ei),Pt.length===1&&(ti[kt]=Pt[0]),ti.removeListener&&this.emit("removeListener",kt,ni||jt)}return this},oe.prototype.removeAllListeners=function(kt){var jt,Pt,ti;if(Pt=this._events,!Pt)return this;if(!Pt.removeListener)return arguments.length===0?(this._events=k(null),this._eventsCount=0):Pt[kt]&&(--this._eventsCount===0?this._events=k(null):delete Pt[kt]),this;if(arguments.length===0){var ei=$(Pt),Et;for(ti=0;ti<ei.length;++ti)Et=ei[ti],Et!=="removeListener"&&this.removeAllListeners(Et);return this.removeAllListeners("removeListener"),this._events=k(null),this._eventsCount=0,this}if(jt=Pt[kt],typeof jt=="function")this.removeListener(kt,jt);else if(jt)for(ti=jt.length-1;ti>=0;ti--)this.removeListener(kt,jt[ti]);return this};function Oe(qe,kt,jt){var Pt=qe._events;if(!Pt)return[];var ti=Pt[kt];return ti?typeof ti=="function"?jt?[ti.listener||ti]:[ti]:jt?Fe(ti):$e(ti,ti.length):[]}oe.prototype.listeners=function(kt){return Oe(this,kt,!0)},oe.prototype.rawListeners=function(kt){return Oe(this,kt,!1)},oe.listenerCount=function(qe,kt){return typeof qe.listenerCount=="function"?qe.listenerCount(kt):_e.call(qe,kt)},oe.prototype.listenerCount=_e;function _e(qe){var kt=this._events;if(kt){var jt=kt[qe];if(typeof jt=="function")return 1;if(jt)return jt.length}return 0}oe.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function At(qe,kt){for(var jt=kt,Pt=jt+1,ti=qe.length;Pt<ti;jt+=1,Pt+=1)qe[jt]=qe[Pt];qe.pop()}function $e(qe,kt){for(var jt=new Array(kt),Pt=0;Pt<kt;++Pt)jt[Pt]=qe[Pt];return jt}function Fe(qe){for(var kt=new Array(qe.length),jt=0;jt<kt.length;++jt)kt[jt]=qe[jt].listener||qe[jt];return kt}function Ue(qe){var kt=function(){};return kt.prototype=qe,new kt}function Ve(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,$,re,oe,Ce){var ie,ae,le=Ce*8-oe-1,Ie=(1<<le)-1,ue=Ie>>1,de=-7,Ne=re?Ce-1:0,he=re?-1:1,pe=k[$+Ne];for(Ne+=he,ie=pe&(1<<-de)-1,pe>>=-de,de+=le;de>0;ie=ie*256+k[$+Ne],Ne+=he,de-=8);for(ae=ie&(1<<-de)-1,ie>>=-de,de+=oe;de>0;ae=ae*256+k[$+Ne],Ne+=he,de-=8);if(ie===0)ie=1-ue;else{if(ie===Ie)return ae?NaN:(pe?-1:1)*(1/0);ae=ae+Math.pow(2,oe),ie=ie-ue}return(pe?-1:1)*ae*Math.pow(2,ie-oe)},V.write=function(k,$,re,oe,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,pe=oe?0:ie-1,ze=oe?1:-1,xe=$<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[re+pe]=le&255,pe+=ze,le/=256,Ce-=8);for(ae=ae<<Ce|le,ue+=Ce;ue>0;k[re+pe]=ae&255,pe+=ze,ae/=256,ue-=8);k[re+pe-ze]|=xe*128}},{}],24:[function(r,g,V){typeof Object.create=="function"?g.exports=function($,re){re&&($.super_=re,$.prototype=Object.create(re.prototype,{constructor:{value:$,enumerable:!1,writable:!0,configurable:!0}}))}:g.exports=function($,re){if(re){$.super_=re;var oe=function(){};oe.prototype=re.prototype,$.prototype=new oe,$.prototype.constructor=$}}},{}],25:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});var k=function(){function $(re,oe){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=re,this.value=oe}return $.prototype.rotateLeft=function(){var re=this.parent,oe=this.brother,Ce=this.leftChild,ie=this.rightChild;if(!ie)throw new Error("unknown error");var ae=ie.leftChild,le=ie.rightChild;return re&&(re.leftChild===this?re.leftChild=ie:re.rightChild===this&&(re.rightChild=ie)),ie.parent=re,ie.brother=oe,ie.leftChild=this,ie.rightChild=le,oe&&(oe.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 re=this.parent,oe=this.brother,Ce=this.leftChild;if(!Ce)throw new Error("unknown error");var ie=this.rightChild,ae=Ce.leftChild,le=Ce.rightChild;return re&&(re.leftChild===this?re.leftChild=Ce:re.rightChild===this&&(re.rightChild=Ce)),Ce.parent=re,Ce.brother=oe,Ce.leftChild=ae,Ce.rightChild=this,oe&&(oe.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(re,oe){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=oe.call(re,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 $(re){var oe=this;re===void 0&&(re=[]);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(pe){if(!this.empty()){var ze=0;if(ie===le){for(var xe=ae;xe<=Ie;++xe)pe(Ce[ie][xe],ze++);return}for(var xe=ae;xe<$.bucketSize;++xe)pe(Ce[ie][xe],ze++);for(var xe=ie+1;xe<le;++xe)for(var Oe=0;Oe<$.bucketSize;++Oe)pe(Ce[xe][Oe],ze++);for(var xe=0;xe<=Ie;++xe)pe(Ce[le][xe],ze++)}};var Ne=function(pe){var ze=ie*$.bucketSize+ae,xe=ze+pe,Oe=le*$.bucketSize+Ie;if(xe<ze||xe>Oe)throw new Error("pos should more than 0 and less than queue's size");var _e=Math.floor(xe/$.bucketSize),At=xe%$.bucketSize;return{curNodeBucketIndex:_e,curNodePointerIndex:At}};this.getElementByPos=function(pe){var ze=Ne(pe),xe=ze.curNodeBucketIndex,Oe=ze.curNodePointerIndex;return Ce[xe][Oe]},this.eraseElementByPos=function(pe){var ze=this;if(pe<0||pe>de)throw new Error("pos should more than 0 and less than queue's size");if(pe===0)this.popFront();else if(pe===this.size())this.popBack();else{for(var xe=[],Oe=pe+1;Oe<de;++Oe)xe.push(this.getElementByPos(Oe));this.cut(pe),this.popBack(),xe.forEach(function(_e){return ze.pushBack(_e)})}},this.eraseElementByValue=function(pe){if(!this.empty()){var ze=[];this.forEach(function(_e){_e!==pe&&ze.push(_e)});for(var xe=ze.length,Oe=0;Oe<xe;++Oe)this.setElementByPos(Oe,ze[Oe]);this.cut(xe-1)}};var he=function(pe){for(var ze=[],xe=pe*$.sigma,Oe=Math.max(Math.ceil(xe/$.bucketSize),2),_e=0;_e<Oe;++_e)ze.push(new Array($.bucketSize));var At=Math.ceil(pe/$.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 Ve=0;Ve<$.bucketSize;++Ve)if(ze[$e+_e][Ve]=this.front(),this.popFront(),this.empty()){Fe=$e+_e,Ue=Ve;break}if(this.empty())break}Ce=ze,ie=$e,ae=0,le=Fe,Ie=Ue,ue=Oe,de=pe};this.pushBack=function(pe){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]=pe},this.popBack=function(){this.empty()||(this.size()!==1&&(Ie>0?--Ie:ie<le&&(--le,Ie=$.bucketSize-1)),de>0&&--de)},this.setElementByPos=function(pe,ze){var xe=Ne(pe),Oe=xe.curNodeBucketIndex,_e=xe.curNodePointerIndex;Ce[Oe][_e]=ze},this.insert=function(pe,ze,xe){var Oe=this;if(xe===void 0&&(xe=1),pe===0)for(;xe--;)this.pushFront(ze);else if(pe===this.size())for(;xe--;)this.pushBack(ze);else{for(var _e=[],At=pe;At<de;++At)_e.push(this.getElementByPos(At));this.cut(pe-1);for(var At=0;At<xe;++At)this.pushBack(ze);_e.forEach(function($e){return Oe.pushBack($e)})}},this.find=function(pe){if(ie===le){for(var ze=ae;ze<=Ie;++ze)if(Ce[ie][ze]===pe)return!0;return!1}for(var ze=ae;ze<$.bucketSize;++ze)if(Ce[ie][ze]===pe)return!0;for(var ze=ie+1;ze<le;++ze)for(var xe=0;xe<$.bucketSize;++xe)if(Ce[ze][xe]===pe)return!0;for(var ze=0;ze<=Ie;++ze)if(Ce[le][ze]===pe)return!0;return!1},this.reverse=function(){for(var pe=0,ze=de-1;pe<ze;){var xe=this.getElementByPos(pe);this.setElementByPos(pe,this.getElementByPos(ze)),this.setElementByPos(ze,xe),++pe,--ze}},this.unique=function(){if(!this.empty()){var pe=[],ze=this.front();this.forEach(function(Oe,_e){(_e===0||Oe!==ze)&&(pe.push(Oe),ze=Oe)});for(var xe=0;xe<de;++xe)this.setElementByPos(xe,pe[xe]);this.cut(pe.length-1)}},this.sort=function(pe){var ze=[];this.forEach(function(Oe){ze.push(Oe)}),ze.sort(pe);for(var xe=0;xe<de;++xe)this.setElementByPos(xe,ze[xe])},this.pushFront=function(pe){this.empty()||(ie===0&&ae===0&&he.call(this,this.size()),ae>0?--ae:ie>0&&(--ie,ae=$.bucketSize-1)),++de,Ce[ie][ae]=pe},this.popFront=function(){this.empty()||(this.size()!==1&&(ae<$.bucketSize-1?++ae:ie<le&&(++ie,ae=0)),de>0&&--de)},this.shrinkToFit=function(){var pe=this,ze=[];this.forEach(function(At){ze.push(At)});var xe=ze.length;Ce=[];for(var Oe=Math.ceil(xe/$.bucketSize),_e=0;_e<Oe;++_e)Ce.push(new Array($.bucketSize));this.clear(),ze.forEach(function(At){return pe.pushBack(At)})},this.cut=function(pe){if(pe<0){this.clear();return}var ze=Ne(pe),xe=ze.curNodeBucketIndex,Oe=ze.curNodePointerIndex;le=xe,Ie=Oe,de=pe+1},this[Symbol.iterator]=function(){return function(){var ze,ze,ze,pe,ze;return k(this,function(xe){switch(xe.label){case 0:if(de===0)return[2];if(ie!==le)return[3,5];ze=ae,xe.label=1;case 1:return ze<=Ie?[4,Ce[ie][ze]]:[3,4];case 2:xe.sent(),xe.label=3;case 3:return++ze,[3,1];case 4:return[2];case 5:ze=ae,xe.label=6;case 6:return ze<$.bucketSize?[4,Ce[ie][ze]]:[3,9];case 7:xe.sent(),xe.label=8;case 8:return++ze,[3,6];case 9:ze=ie+1,xe.label=10;case 10:if(!(ze<le))return[3,15];pe=0,xe.label=11;case 11:return pe<$.bucketSize?[4,Ce[ze][pe]]:[3,14];case 12:xe.sent(),xe.label=13;case 13:return++pe,[3,11];case 14:return++ze,[3,10];case 15:ze=0,xe.label=16;case 16:return ze<=Ie?[4,Ce[le][ze]]:[3,19];case 17:xe.sent(),xe.label=18;case 18:return++ze,[3,16];case 19:return[2]}})}()},function(){var pe=$.bucketSize;re.size?pe=re.size():re.length&&(pe=re.length);var ze=pe*$.sigma;ue=Math.ceil(ze/$.bucketSize),ue=Math.max(ue,3);for(var xe=0;xe<ue;++xe)Ce.push(new Array($.bucketSize));var Oe=Math.ceil(pe/$.bucketSize);ie=Math.floor(ue/2)-Math.floor(Oe/2),le=ie,re.forEach(function(_e){return oe.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(ze){return function(xe){return pe([ze,xe])}}function pe(ze){if(Ie)throw new TypeError("Generator is already executing.");for(;le;)try{if(Ie=1,ue&&(de=ze[0]&2?ue.return:ze[0]?ue.throw||((de=ue.return)&&de.call(ue),0):ue.next)&&!(de=de.call(ue,ze[1])).done)return de;switch(ue=0,de&&(ze=[ze[0]&2,de.value]),ze[0]){case 0:case 1:de=ze;break;case 4:return le.label++,{value:ze[1],done:!1};case 5:le.label++,ue=ze[1],ze=[0];continue;case 7:ze=le.ops.pop(),le.trys.pop();continue;default:if(de=le.trys,!(de=de.length>0&&de[de.length-1])&&(ze[0]===6||ze[0]===2)){le=0;continue}if(ze[0]===3&&(!de||ze[1]>de[0]&&ze[1]<de[3])){le.label=ze[1];break}if(ze[0]===6&&le.label<de[1]){le.label=de[1],de=ze;break}if(de&&le.label<de[2]){le.label=de[2],le.ops.push(ze);break}de[2]&&le.ops.pop(),le.trys.pop();continue}ze=ae.call(ie,le)}catch(xe){ze=[6,xe],ue=0}finally{Ie=de=0}if(ze[0]&5)throw ze[1];return{value:ze[0]?ze[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 re=r("../LinkList/LinkList"),oe=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(pe){var ze,xe,Oe=0,_e="";if(typeof pe=="number")Oe=Math.floor(pe),Oe=(Oe<<5)-Oe,Oe=Oe&Oe;else{typeof pe!="string"?_e=JSON.stringify(pe):_e=pe;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(Ve){ze={error:Ve}}finally{try{$e&&!$e.done&&(xe=At.return)&&xe.call(At)}finally{if(ze)throw ze.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(pe){var ze=0;de.forEach(function(xe){xe.forEach(function(Oe){pe(Oe,ze++)})})};var he=function(pe){if(!(pe>=Ce.maxSize)){Ne=pe*2;var ze=[];de.forEach(function(xe,Oe){if(!xe.empty()){if(xe instanceof re.default&&xe.size()===1){var _e=xe.front(),At=_e.key,$e=_e.value;ze[le(At)&Ne-1]=new re.default([{key:At,value:$e}])}else if(xe instanceof oe.default){var Fe=new re.default,Ue=new re.default;xe.forEach(function(qe){var kt=le(qe.key);kt&pe?Ue.pushBack(qe):Fe.pushBack(qe)}),Fe.size()>Ce.untreeifyThreshold?ze[Oe]=new oe.default(Fe):Fe.size()&&(ze[Oe]=Fe),Ue.size()>Ce.untreeifyThreshold?ze[Oe+pe]=new oe.default(Ue):Ue.size()&&(ze[Oe+pe]=Ue)}else{var Ve=new re.default,Dt=new re.default;xe.forEach(function(qe){var kt=le(qe.key);kt&pe?Dt.pushBack(qe):Ve.pushBack(qe)}),Ve.size()&&(ze[Oe]=Ve),Dt.size()&&(ze[Oe+pe]=Dt)}de[Oe].clear()}}),de=ze}};this.setElement=function(pe,ze){var xe,Oe;if(pe==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(ze==null){this.eraseElementByKey(pe);return}var _e=le(pe)&Ne-1;if(!de[_e])++ue,de[_e]=new re.default([{key:pe,value:ze}]);else{var At=de[_e].size();if(de[_e]instanceof re.default){try{for(var $e=$(de[_e]),Fe=$e.next();!Fe.done;Fe=$e.next()){var Ue=Fe.value;if(Ue.key===pe){Ue.value=ze;return}}}catch(Dt){xe={error:Dt}}finally{try{Fe&&!Fe.done&&(Oe=$e.return)&&Oe.call($e)}finally{if(xe)throw xe.error}}de[_e].pushBack({key:pe,value:ze}),de[_e].size()>=Ce.treeifyThreshold&&(de[_e]=new oe.default(de[_e]))}else de[_e].setElement(pe,ze);var Ve=de[_e].size();ue+=Ve-At}ue>Ne*Ce.sigma&&he.call(this,Ne)},this.getElementByKey=function(pe){var ze,xe,Oe=le(pe)&Ne-1;if(de[Oe]){if(de[Oe]instanceof oe.default)return de[Oe].getElementByKey(pe);try{for(var _e=$(de[Oe]),At=_e.next();!At.done;At=_e.next()){var $e=At.value;if($e.key===pe)return $e.value}}catch(Fe){ze={error:Fe}}finally{try{At&&!At.done&&(xe=_e.return)&&xe.call(_e)}finally{if(ze)throw ze.error}}}},this.eraseElementByKey=function(pe){var ze,xe,Oe=le(pe)&Ne-1;if(de[Oe]){var _e=de[Oe].size();if(de[Oe]instanceof oe.default)de[Oe].eraseElementByKey(pe),de[Oe].size()<=Ce.untreeifyThreshold&&(de[Oe]=new re.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===pe){de[Oe].eraseElementByPos(At);break}}}catch(Dt){ze={error:Dt}}finally{try{Fe&&!Fe.done&&(xe=$e.return)&&xe.call($e)}finally{if(ze)throw ze.error}}}var Ve=de[Oe].size();ue+=Ve-_e}},this.find=function(pe){var ze,xe,Oe=le(pe)&Ne-1;if(!de[Oe])return!1;if(de[Oe]instanceof oe.default)return de[Oe].find(pe);try{for(var _e=$(de[Oe]),At=_e.next();!At.done;At=_e.next()){var $e=At.value;if($e.key===pe)return!0}}catch(Fe){ze={error:Fe}}finally{try{At&&!At.done&&(xe=_e.return)&&xe.call(_e)}finally{if(ze)throw ze.error}}return!1},this[Symbol.iterator]=function(){return function(){var pe,ze,xe,Oe,_e,At,$e;return k(this,function(Fe){switch(Fe.label){case 0:pe=0,Fe.label=1;case 1:if(!(pe<Ne))return[3,10];for(;pe<Ne&&!de[pe];)++pe;if(pe>=Ne)return[3,10];Fe.label=2;case 2:Fe.trys.push([2,7,8,9]),ze=(At=void 0,$(de[pe])),xe=ze.next(),Fe.label=3;case 3:return xe.done?[3,6]:(Oe=xe.value,[4,Oe]);case 4:Fe.sent(),Fe.label=5;case 5:return xe=ze.next(),[3,3];case 6:return[3,9];case 7:return _e=Fe.sent(),At={error:_e},[3,9];case 8:try{xe&&!xe.done&&($e=ze.return)&&$e.call(ze)}finally{if(At)throw At.error}return[7];case 9:return++pe,[3,1];case 10:return[2]}})}()},ie.forEach(function(pe){var ze=pe.key,xe=pe.value;return Ie.setElement(ze,xe)}),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(ze){return function(xe){return pe([ze,xe])}}function pe(ze){if(Ie)throw new TypeError("Generator is already executing.");for(;le;)try{if(Ie=1,ue&&(de=ze[0]&2?ue.return:ze[0]?ue.throw||((de=ue.return)&&de.call(ue),0):ue.next)&&!(de=de.call(ue,ze[1])).done)return de;switch(ue=0,de&&(ze=[ze[0]&2,de.value]),ze[0]){case 0:case 1:de=ze;break;case 4:return le.label++,{value:ze[1],done:!1};case 5:le.label++,ue=ze[1],ze=[0];continue;case 7:ze=le.ops.pop(),le.trys.pop();continue;default:if(de=le.trys,!(de=de.length>0&&de[de.length-1])&&(ze[0]===6||ze[0]===2)){le=0;continue}if(ze[0]===3&&(!de||ze[1]>de[0]&&ze[1]<de[3])){le.label=ze[1];break}if(ze[0]===6&&le.label<de[1]){le.label=de[1],de=ze;break}if(de&&le.label<de[2]){le.label=de[2],le.ops.push(ze);break}de[2]&&le.ops.pop(),le.trys.pop();continue}ze=ae.call(ie,le)}catch(xe){ze=[6,xe],ue=0}finally{Ie=de=0}if(ze[0]&5)throw ze[1];return{value:ze[0]?ze[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 re=r("../Set/Set"),oe=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(pe){var ze=0,xe="";if(typeof pe=="number")ze=Math.floor(pe),ze=(ze<<5)-ze,ze=ze&ze;else{typeof pe!="string"?xe=JSON.stringify(pe):xe=pe;for(var Oe=0;Oe<xe.length;Oe++){var _e=xe.charCodeAt(Oe);ze=(ze<<5)-ze+_e,ze=ze&ze}}return ze^=ze>>>16,ze},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(pe){var ze=0;de.forEach(function(xe){xe.forEach(function(Oe){pe(Oe,ze++)})})};var he=function(pe){if(!(pe>=Ce.maxSize)){Ne=pe*2;var ze=[];de.forEach(function(xe,Oe){if(!xe.empty()){if(xe instanceof oe.default&&xe.size()===1){var _e=xe.front();if(_e===void 0)throw new Error("unknown error");ze[le(_e)&Ne-1]=new oe.default([_e])}else if(xe instanceof re.default){var At=new oe.default,$e=new oe.default;xe.forEach(function(Ve){var Dt=le(Ve);Dt&pe?$e.pushBack(Ve):At.pushBack(Ve)}),At.size()>Ce.untreeifyThreshold?ze[Oe]=new re.default(At):At.size()&&(ze[Oe]=At),$e.size()>Ce.untreeifyThreshold?ze[Oe+pe]=new re.default($e):$e.size()&&(ze[Oe+pe]=$e)}else{var Fe=new oe.default,Ue=new oe.default;xe.forEach(function(Ve){var Dt=le(Ve);Dt&pe?Ue.pushBack(Ve):Fe.pushBack(Ve)}),Fe.size()&&(ze[Oe]=Fe),Ue.size()&&(ze[Oe+pe]=Ue)}de[Oe].clear()}}),de=ze}};this.insert=function(pe){if(pe==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var ze=le(pe)&Ne-1;if(!de[ze])de[ze]=new oe.default([pe]),++ue;else{var xe=de[ze].size();if(de[ze]instanceof oe.default){if(de[ze].find(pe))return;de[ze].pushBack(pe),de[ze].size()>=Ce.treeifyThreshold&&(de[ze]=new re.default(de[ze]))}else de[ze].insert(pe);var Oe=de[ze].size();ue+=Oe-xe}ue>Ne*Ce.sigma&&he.call(this,Ne)},this.eraseElementByValue=function(pe){var ze=le(pe)&Ne-1;if(de[ze]){var xe=de[ze].size();de[ze].eraseElementByValue(pe),de[ze]instanceof re.default&&de[ze].size()<=Ce.untreeifyThreshold&&(de[ze]=new oe.default(de[ze]));var Oe=de[ze].size();ue+=Oe-xe}},this.find=function(pe){var ze=le(pe)&Ne-1;return de[ze]?de[ze].find(pe):!1},this[Symbol.iterator]=function(){return function(){var pe,ze,xe,Oe,_e,At,$e;return k(this,function(Fe){switch(Fe.label){case 0:pe=0,Fe.label=1;case 1:if(!(pe<Ne))return[3,10];for(;pe<Ne&&!de[pe];)++pe;if(pe>=Ne)return[3,10];Fe.label=2;case 2:Fe.trys.push([2,7,8,9]),ze=(At=void 0,$(de[pe])),xe=ze.next(),Fe.label=3;case 3:return xe.done?[3,6]:(Oe=xe.value,[4,Oe]);case 4:Fe.sent(),Fe.label=5;case 5:return xe=ze.next(),[3,3];case 6:return[3,9];case 7:return _e=Fe.sent(),At={error:_e},[3,9];case 8:try{xe&&!xe.done&&($e=ze.return)&&$e.call(ze)}finally{if(At)throw At.error}return[7];case 9:return++pe,[3,1];case 10:return[2]}})}()},ie.forEach(function(pe){return Ie.insert(pe)}),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(oe,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(pe){return Ne([he,pe])}}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(oe,ie)}catch(pe){he=[6,pe],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 oe(Ce){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=Ce}return oe}();function re(oe){var Ce=this;oe===void 0&&(oe=[]);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 pe=Ne.next;for(ie+=de;de--;)Ne.next=new $(ue),Ne.next.pre=Ne,Ne=Ne.next;Ne.next=pe,pe&&(pe.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]}})}()},oe.forEach(function(Ie){return Ce.pushBack(Ie)}),Object.freeze(this)}Object.freeze(re),V.default=re},{}],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(pe){return function(ze){return he([pe,ze])}}function he(pe){if(le)throw new TypeError("Generator is already executing.");for(;ae;)try{if(le=1,Ie&&(ue=pe[0]&2?Ie.return:pe[0]?Ie.throw||((ue=Ie.return)&&ue.call(Ie),0):Ie.next)&&!(ue=ue.call(Ie,pe[1])).done)return ue;switch(Ie=0,ue&&(pe=[pe[0]&2,ue.value]),pe[0]){case 0:case 1:ue=pe;break;case 4:return ae.label++,{value:pe[1],done:!1};case 5:ae.label++,Ie=pe[1],pe=[0];continue;case 7:pe=ae.ops.pop(),ae.trys.pop();continue;default:if(ue=ae.trys,!(ue=ue.length>0&&ue[ue.length-1])&&(pe[0]===6||pe[0]===2)){ae=0;continue}if(pe[0]===3&&(!ue||pe[1]>ue[0]&&pe[1]<ue[3])){ae.label=pe[1];break}if(pe[0]===6&&ae.label<ue[1]){ae.label=ue[1],ue=pe;break}if(ue&&ae.label<ue[2]){ae.label=ue[2],ae.ops.push(pe);break}ue[2]&&ae.ops.pop(),ae.trys.pop();continue}pe=ie.call(Ce,ae)}catch(ze){pe=[6,ze],Ie=0}finally{le=ue=0}if(pe[0]&5)throw pe[1];return{value:pe[0]?pe[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 re=r("../Base/TreeNode");function oe(Ce,ie){var ae=this;Ce===void 0&&(Ce=[]),ie=ie||function(Ve,Dt){return Ve<Dt?-1:Ve>Dt?1:0};var le=0,Ie=new re.default;Ie.color=re.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(Ve){if(!Ve||Ve.key===void 0)throw new Error("unknown error");return Ve.leftChild?ue(Ve.leftChild):Ve},de=function(Ve){if(!Ve||Ve.key===void 0)throw new Error("unknown error");return Ve.rightChild?de(Ve.rightChild):Ve};this.front=function(){if(!this.empty()){var Ve=ue(Ie);if(Ve.key===void 0||Ve.value===void 0)throw new Error("unknown error");return{key:Ve.key,value:Ve.value}}},this.back=function(){if(!this.empty()){var Ve=de(Ie);if(Ve.key===void 0||Ve.value===void 0)throw new Error("unknown error");return{key:Ve.key,value:Ve.value}}},this.forEach=function(Ve){var Dt,qe,kt=0;try{for(var jt=$(this),Pt=jt.next();!Pt.done;Pt=jt.next()){var ti=Pt.value;Ve(ti,kt++)}}catch(ei){Dt={error:ei}}finally{try{Pt&&!Pt.done&&(qe=jt.return)&&qe.call(jt)}finally{if(Dt)throw Dt.error}}},this.getElementByPos=function(Ve){var Dt,qe;if(Ve<0||Ve>=this.size())throw new Error("pos must more than 0 and less than set's size");var kt=0;try{for(var jt=$(this),Pt=jt.next();!Pt.done;Pt=jt.next()){var ti=Pt.value;if(kt===Ve)return ti;++kt}}catch(ei){Dt={error:ei}}finally{try{Pt&&!Pt.done&&(qe=jt.return)&&qe.call(jt)}finally{if(Dt)throw Dt.error}}throw new Error("unknown Error")};var Ne=function(Ve,Dt){if(!(!Ve||Ve.key===void 0||Ve.value===void 0)){var qe=ie(Ve.key,Dt);return qe===0?{key:Ve.key,value:Ve.value}:qe<0?Ne(Ve.rightChild,Dt):Ne(Ve.leftChild,Dt)||{key:Ve.key,value:Ve.value}}};this.lowerBound=function(Ve){return Ne(Ie,Ve)};var he=function(Ve,Dt){if(!(!Ve||Ve.key===void 0||Ve.value===void 0)){var qe=ie(Ve.key,Dt);return qe<=0?he(Ve.rightChild,Dt):he(Ve.leftChild,Dt)||{key:Ve.key,value:Ve.value}}};this.upperBound=function(Ve){return he(Ie,Ve)};var pe=function(Ve,Dt){if(!(!Ve||Ve.key===void 0||Ve.value===void 0)){var qe=ie(Ve.key,Dt);return qe===0?{key:Ve.key,value:Ve.value}:qe>0?pe(Ve.leftChild,Dt):pe(Ve.rightChild,Dt)||{key:Ve.key,value:Ve.value}}};this.reverseLowerBound=function(Ve){return pe(Ie,Ve)};var ze=function(Ve,Dt){if(!(!Ve||Ve.key===void 0||Ve.value===void 0)){var qe=ie(Ve.key,Dt);return qe>=0?ze(Ve.leftChild,Dt):ze(Ve.rightChild,Dt)||{key:Ve.key,value:Ve.value}}};this.reverseUpperBound=function(Ve){return ze(Ie,Ve)};var xe=function(Ve){var Dt=Ve.parent;if(!Dt){if(Ve===Ie)return;throw new Error("unknown error")}if(Ve.color===re.default.TreeNodeColorType.red){Ve.color=re.default.TreeNodeColorType.black;return}var qe=Ve.brother;if(!qe)throw new Error("unknown error");if(Ve===Dt.leftChild){if(qe.color===re.default.TreeNodeColorType.red){qe.color=re.default.TreeNodeColorType.black,Dt.color=re.default.TreeNodeColorType.red;var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),xe(Ve)}else if(qe.color===re.default.TreeNodeColorType.black)if(qe.rightChild&&qe.rightChild.color===re.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=re.default.TreeNodeColorType.black,qe.rightChild&&(qe.rightChild.color=re.default.TreeNodeColorType.black);var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),Ve.color=re.default.TreeNodeColorType.black}else if((!qe.rightChild||qe.rightChild.color===re.default.TreeNodeColorType.black)&&qe.leftChild&&qe.leftChild.color===re.default.TreeNodeColorType.red){qe.color=re.default.TreeNodeColorType.red,qe.leftChild&&(qe.leftChild.color=re.default.TreeNodeColorType.black);var kt=qe.rotateRight();Ie===qe&&(Ie=kt),xe(Ve)}else(!qe.leftChild||qe.leftChild.color===re.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===re.default.TreeNodeColorType.black)&&(qe.color=re.default.TreeNodeColorType.red,xe(Dt))}else if(Ve===Dt.rightChild){if(qe.color===re.default.TreeNodeColorType.red){qe.color=re.default.TreeNodeColorType.black,Dt.color=re.default.TreeNodeColorType.red;var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),xe(Ve)}else if(qe.color===re.default.TreeNodeColorType.black)if(qe.leftChild&&qe.leftChild.color===re.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=re.default.TreeNodeColorType.black,qe.leftChild&&(qe.leftChild.color=re.default.TreeNodeColorType.black);var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),Ve.color=re.default.TreeNodeColorType.black}else if((!qe.leftChild||qe.leftChild.color===re.default.TreeNodeColorType.black)&&qe.rightChild&&qe.rightChild.color===re.default.TreeNodeColorType.red){qe.color=re.default.TreeNodeColorType.red,qe.rightChild&&(qe.rightChild.color=re.default.TreeNodeColorType.black);var kt=qe.rotateLeft();Ie===qe&&(Ie=kt),xe(Ve)}else(!qe.leftChild||qe.leftChild.color===re.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===re.default.TreeNodeColorType.black)&&(qe.color=re.default.TreeNodeColorType.red,xe(Dt))}},Oe=function(Ve){for(var Dt=Ve;Dt.leftChild||Dt.rightChild;){if(Dt.rightChild){Dt=ue(Dt.rightChild);var qe=Ve.key;Ve.key=Dt.key,Dt.key=qe;var kt=Ve.value;Ve.value=Dt.value,Dt.value=kt,Ve=Dt}if(Dt.leftChild){Dt=de(Dt.leftChild);var qe=Ve.key;Ve.key=Dt.key,Dt.key=qe;var kt=Ve.value;Ve.value=Dt.value,Dt.value=kt,Ve=Dt}}xe(Dt),Dt&&Dt.remove(),--le,Ie.color=re.default.TreeNodeColorType.black},_e=function(Ve,Dt){if(!Ve||Ve.key===void 0)return!1;var qe=_e(Ve.leftChild,Dt);return qe||Dt(Ve)?!0:_e(Ve.rightChild,Dt)};this.eraseElementByPos=function(Ve){if(Ve<0||Ve>=le)throw new Error("pos must more than 0 and less than set's size");var Dt=0;_e(Ie,function(qe){return Ve===Dt?(Oe(qe),!0):(++Dt,!1)})},this.eraseElementByKey=function(Ve){if(!this.empty()){var Dt=Fe(Ie,Ve);Dt===void 0||Dt.key===void 0||ie(Dt.key,Ve)!==0||Oe(Dt)}};var At=function(Ve,Dt){if(!Ve||Ve.key===void 0)throw new Error("unknown error");var qe=ie(Dt,Ve.key);return qe<0?Ve.leftChild?At(Ve.leftChild,Dt):(Ve.leftChild=new re.default,Ve.leftChild.parent=Ve,Ve.leftChild.brother=Ve.rightChild,Ve.rightChild&&(Ve.rightChild.brother=Ve.leftChild),Ve.leftChild):qe>0?Ve.rightChild?At(Ve.rightChild,Dt):(Ve.rightChild=new re.default,Ve.rightChild.parent=Ve,Ve.rightChild.brother=Ve.leftChild,Ve.leftChild&&(Ve.leftChild.brother=Ve.rightChild),Ve.rightChild):Ve},$e=function(Ve){var Dt=Ve.parent;if(!Dt){if(Ve===Ie)return;throw new Error("unknown error")}if(Dt.color!==re.default.TreeNodeColorType.black&&Dt.color===re.default.TreeNodeColorType.red){var qe=Dt.brother,kt=Dt.parent;if(!kt)throw new Error("unknown error");if(qe&&qe.color===re.default.TreeNodeColorType.red)qe.color=Dt.color=re.default.TreeNodeColorType.black,kt.color=re.default.TreeNodeColorType.red,$e(kt);else if(!qe||qe.color===re.default.TreeNodeColorType.black){if(Dt===kt.leftChild){if(Ve===Dt.leftChild){Dt.color=re.default.TreeNodeColorType.black,kt.color=re.default.TreeNodeColorType.red;var jt=kt.rotateRight();kt===Ie&&(Ie=jt)}else if(Ve===Dt.rightChild){var jt=Dt.rotateLeft();kt===Ie&&(Ie=jt),$e(Dt)}}else if(Dt===kt.rightChild){if(Ve===Dt.leftChild){var jt=Dt.rotateRight();kt===Ie&&(Ie=jt),$e(Dt)}else if(Ve===Dt.rightChild){Dt.color=re.default.TreeNodeColorType.black,kt.color=re.default.TreeNodeColorType.red;var jt=kt.rotateLeft();kt===Ie&&(Ie=jt)}}}}};this.setElement=function(Ve,Dt){if(Ve==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(Dt==null){this.eraseElementByKey(Ve);return}if(this.empty()){++le,Ie.key=Ve,Ie.value=Dt,Ie.color=re.default.TreeNodeColorType.black;return}var qe=At(Ie,Ve);if(qe.key!==void 0&&ie(qe.key,Ve)===0){qe.value=Dt;return}++le,qe.key=Ve,qe.value=Dt,$e(qe),Ie.color=re.default.TreeNodeColorType.black};var Fe=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Dt,Ve.key);return qe<0?Fe(Ve.leftChild,Dt):qe>0?Fe(Ve.rightChild,Dt):Ve}};this.find=function(Ve){return!!Fe(Ie,Ve)},this.getElementByKey=function(Ve){var Dt=Fe(Ie,Ve);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(Ve){var Dt=this;Ve.forEach(function(qe){var kt=qe.key,jt=qe.value;return Dt.setElement(kt,jt)})},this.getHeight=function(){if(this.empty())return 0;var Ve=function(Dt){return Dt?Math.max(Ve(Dt.leftChild),Ve(Dt.rightChild))+1:1};return Ve(Ie)};var Ue=function(Ve){return k(this,function(Dt){switch(Dt.label){case 0:return!Ve||Ve.key===void 0||Ve.value===void 0?[2]:[5,$(Ue(Ve.leftChild))];case 1:return Dt.sent(),[4,{key:Ve.key,value:Ve.value}];case 2:return Dt.sent(),[5,$(Ue(Ve.rightChild))];case 3:return Dt.sent(),[2]}})};this[Symbol.iterator]=function(){return Ue(Ie)},Ce.forEach(function(Ve){var Dt=Ve.key,qe=Ve.value;return ae.setElement(Dt,qe)}),Object.freeze(this)}Object.freeze(oe),V.default=oe},{"../Base/TreeNode":25}],31:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});function k($,re){$===void 0&&($=[]),re=re||function(le,Ie){return le>Ie?-1:le<Ie?1:0};var oe=[];$.forEach(function(le){return oe.push(le)});var Ce=oe.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=oe[le];oe[le]=oe[Ie],oe[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&&re(oe[le],oe[Ie])>0&&ie(le,Ie),ue<Ce&&re(oe[le],oe[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&&re(oe[de],oe[Ne])>0&&(he=Ne),re(oe[Ie],oe[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,oe.length=0},this.push=function(le){if(oe.push(le),++Ce,Ce!==1)for(var Ie=Ce-1;Ie>0;){var ue=Math.floor((Ie-1)/2);if(re(oe[ue],le)<=0)break;ae(ue),Ie=ue}},this.pop=function(){if(!this.empty()){if(this.size()===1){--Ce;return}var le=oe[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()&&re(oe[ue],oe[de])>0&&(Ne=de),re(oe[Ne],le)>=0)break;oe[Ie]=oe[Ne],Ie=Ne}oe[Ie]=le}},this.top=function(){return oe[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 $(re){re===void 0&&(re=[]);var oe=new k.default(re);this.size=function(){return oe.size()},this.empty=function(){return oe.empty()},this.clear=function(){oe.clear()},this.push=function(Ce){oe.pushBack(Ce)},this.pop=function(){oe.popFront()},this.front=function(){return oe.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(pe){return function(ze){return he([pe,ze])}}function he(pe){if(le)throw new TypeError("Generator is already executing.");for(;ae;)try{if(le=1,Ie&&(ue=pe[0]&2?Ie.return:pe[0]?Ie.throw||((ue=Ie.return)&&ue.call(Ie),0):Ie.next)&&!(ue=ue.call(Ie,pe[1])).done)return ue;switch(Ie=0,ue&&(pe=[pe[0]&2,ue.value]),pe[0]){case 0:case 1:ue=pe;break;case 4:return ae.label++,{value:pe[1],done:!1};case 5:ae.label++,Ie=pe[1],pe=[0];continue;case 7:pe=ae.ops.pop(),ae.trys.pop();continue;default:if(ue=ae.trys,!(ue=ue.length>0&&ue[ue.length-1])&&(pe[0]===6||pe[0]===2)){ae=0;continue}if(pe[0]===3&&(!ue||pe[1]>ue[0]&&pe[1]<ue[3])){ae.label=pe[1];break}if(pe[0]===6&&ae.label<ue[1]){ae.label=ue[1],ue=pe;break}if(ue&&ae.label<ue[2]){ae.label=ue[2],ae.ops.push(pe);break}ue[2]&&ae.ops.pop(),ae.trys.pop();continue}pe=ie.call(Ce,ae)}catch(ze){pe=[6,ze],Ie=0}finally{le=ue=0}if(pe[0]&5)throw pe[1];return{value:pe[0]?pe[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 re=r("../Base/TreeNode");function oe(Ce,ie){var ae=this;Ce===void 0&&(Ce=[]),ie=ie||function(Ve,Dt){return Ve<Dt?-1:Ve>Dt?1:0};var le=0,Ie=new re.default;Ie.color=re.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=re.default.TreeNodeColorType.black};var ue=function(Ve){if(!Ve||Ve.key===void 0)throw new Error("unknown error");return Ve.leftChild?ue(Ve.leftChild):Ve},de=function(Ve){if(!Ve||Ve.key===void 0)throw new Error("unknown error");return Ve.rightChild?de(Ve.rightChild):Ve};this.front=function(){if(!this.empty()){var Ve=ue(Ie);return Ve.key}},this.back=function(){if(!this.empty()){var Ve=de(Ie);return Ve.key}},this.forEach=function(Ve){var Dt,qe,kt=0;try{for(var jt=$(this),Pt=jt.next();!Pt.done;Pt=jt.next()){var ti=Pt.value;Ve(ti,kt++)}}catch(ei){Dt={error:ei}}finally{try{Pt&&!Pt.done&&(qe=jt.return)&&qe.call(jt)}finally{if(Dt)throw Dt.error}}},this.getElementByPos=function(Ve){var Dt,qe;if(Ve<0||Ve>=this.size())throw new Error("pos must more than 0 and less than set's size");var kt=0;try{for(var jt=$(this),Pt=jt.next();!Pt.done;Pt=jt.next()){var ti=Pt.value;if(kt===Ve)return ti;++kt}}catch(ei){Dt={error:ei}}finally{try{Pt&&!Pt.done&&(qe=jt.return)&&qe.call(jt)}finally{if(Dt)throw Dt.error}}throw new Error("unknown error")};var Ne=function(Ve){var Dt=Ve.parent;if(!Dt){if(Ve===Ie)return;throw new Error("unknown error")}if(Ve.color===re.default.TreeNodeColorType.red){Ve.color=re.default.TreeNodeColorType.black;return}var qe=Ve.brother;if(!qe)throw new Error("unknown error");if(Ve===Dt.leftChild){if(qe.color===re.default.TreeNodeColorType.red){qe.color=re.default.TreeNodeColorType.black,Dt.color=re.default.TreeNodeColorType.red;var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),Ne(Ve)}else if(qe.color===re.default.TreeNodeColorType.black)if(qe.rightChild&&qe.rightChild.color===re.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=re.default.TreeNodeColorType.black,qe.rightChild&&(qe.rightChild.color=re.default.TreeNodeColorType.black);var kt=Dt.rotateLeft();Ie===Dt&&(Ie=kt),Ve.color=re.default.TreeNodeColorType.black}else if((!qe.rightChild||qe.rightChild.color===re.default.TreeNodeColorType.black)&&qe.leftChild&&qe.leftChild.color===re.default.TreeNodeColorType.red){qe.color=re.default.TreeNodeColorType.red,qe.leftChild&&(qe.leftChild.color=re.default.TreeNodeColorType.black);var kt=qe.rotateRight();Ie===qe&&(Ie=kt),Ne(Ve)}else(!qe.leftChild||qe.leftChild.color===re.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===re.default.TreeNodeColorType.black)&&(qe.color=re.default.TreeNodeColorType.red,Ne(Dt))}else if(Ve===Dt.rightChild){if(qe.color===re.default.TreeNodeColorType.red){qe.color=re.default.TreeNodeColorType.black,Dt.color=re.default.TreeNodeColorType.red;var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),Ne(Ve)}else if(qe.color===re.default.TreeNodeColorType.black)if(qe.leftChild&&qe.leftChild.color===re.default.TreeNodeColorType.red){qe.color=Dt.color,Dt.color=re.default.TreeNodeColorType.black,qe.leftChild&&(qe.leftChild.color=re.default.TreeNodeColorType.black);var kt=Dt.rotateRight();Ie===Dt&&(Ie=kt),Ve.color=re.default.TreeNodeColorType.black}else if((!qe.leftChild||qe.leftChild.color===re.default.TreeNodeColorType.black)&&qe.rightChild&&qe.rightChild.color===re.default.TreeNodeColorType.red){qe.color=re.default.TreeNodeColorType.red,qe.rightChild&&(qe.rightChild.color=re.default.TreeNodeColorType.black);var kt=qe.rotateLeft();Ie===qe&&(Ie=kt),Ne(Ve)}else(!qe.leftChild||qe.leftChild.color===re.default.TreeNodeColorType.black)&&(!qe.rightChild||qe.rightChild.color===re.default.TreeNodeColorType.black)&&(qe.color=re.default.TreeNodeColorType.red,Ne(Dt))}},he=function(Ve){for(var Dt=Ve;Dt.leftChild||Dt.rightChild;){if(Dt.rightChild){Dt=ue(Dt.rightChild);var qe=Ve.key;Ve.key=Dt.key,Dt.key=qe,Ve=Dt}if(Dt.leftChild){Dt=de(Dt.leftChild);var qe=Ve.key;Ve.key=Dt.key,Dt.key=qe,Ve=Dt}}Ne(Dt),Dt&&Dt.remove(),--le,Ie.color=re.default.TreeNodeColorType.black},pe=function(Ve,Dt){if(!Ve||Ve.key===void 0)return!1;var qe=pe(Ve.leftChild,Dt);return qe||Dt(Ve)?!0:pe(Ve.rightChild,Dt)};this.eraseElementByPos=function(Ve){if(Ve<0||Ve>=le)throw new Error("pos must more than 0 and less than set's size");var Dt=0;pe(Ie,function(qe){return Ve===Dt?(he(qe),!0):(++Dt,!1)})},this.eraseElementByValue=function(Ve){if(!this.empty()){var Dt=Oe(Ie,Ve);Dt===void 0||Dt.key===void 0||ie(Dt.key,Ve)!==0||he(Dt)}};var ze=function(Ve,Dt){if(!Ve||Ve.key===void 0)throw new Error("unknown error");var qe=ie(Dt,Ve.key);return qe<0?Ve.leftChild?ze(Ve.leftChild,Dt):(Ve.leftChild=new re.default,Ve.leftChild.parent=Ve,Ve.leftChild.brother=Ve.rightChild,Ve.rightChild&&(Ve.rightChild.brother=Ve.leftChild),Ve.leftChild):qe>0?Ve.rightChild?ze(Ve.rightChild,Dt):(Ve.rightChild=new re.default,Ve.rightChild.parent=Ve,Ve.rightChild.brother=Ve.leftChild,Ve.leftChild&&(Ve.leftChild.brother=Ve.rightChild),Ve.rightChild):Ve},xe=function(Ve){var Dt=Ve.parent;if(!Dt){if(Ve===Ie)return;throw new Error("unknown error")}if(Dt.color!==re.default.TreeNodeColorType.black&&Dt.color===re.default.TreeNodeColorType.red){var qe=Dt.brother,kt=Dt.parent;if(!kt)throw new Error("unknown error");if(qe&&qe.color===re.default.TreeNodeColorType.red)qe.color=Dt.color=re.default.TreeNodeColorType.black,kt.color=re.default.TreeNodeColorType.red,xe(kt);else if(!qe||qe.color===re.default.TreeNodeColorType.black){if(Dt===kt.leftChild){if(Ve===Dt.leftChild){Dt.color=re.default.TreeNodeColorType.black,kt.color=re.default.TreeNodeColorType.red;var jt=kt.rotateRight();kt===Ie&&(Ie=jt)}else if(Ve===Dt.rightChild){var jt=Dt.rotateLeft();kt===Ie&&(Ie=jt),xe(Dt)}}else if(Dt===kt.rightChild){if(Ve===Dt.leftChild){var jt=Dt.rotateRight();kt===Ie&&(Ie=jt),xe(Dt)}else if(Ve===Dt.rightChild){Dt.color=re.default.TreeNodeColorType.black,kt.color=re.default.TreeNodeColorType.red;var jt=kt.rotateLeft();kt===Ie&&(Ie=jt)}}}}};this.insert=function(Ve){if(Ve==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=Ve,Ie.color=re.default.TreeNodeColorType.black;return}var Dt=ze(Ie,Ve);Dt.key!==void 0&&ie(Dt.key,Ve)===0||(++le,Dt.key=Ve,xe(Dt),Ie.color=re.default.TreeNodeColorType.black)};var Oe=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Dt,Ve.key);return qe<0?Oe(Ve.leftChild,Dt):qe>0?Oe(Ve.rightChild,Dt):Ve}};this.find=function(Ve){var Dt=Oe(Ie,Ve);return Dt!==void 0&&Dt.key!==void 0&&ie(Dt.key,Ve)===0};var _e=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Ve.key,Dt);if(qe===0)return Ve.key;if(qe<0)return _e(Ve.rightChild,Dt);var kt=_e(Ve.leftChild,Dt);return kt!==void 0?kt:Ve.key}};this.lowerBound=function(Ve){return _e(Ie,Ve)};var At=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Ve.key,Dt);if(qe<=0)return At(Ve.rightChild,Dt);var kt=At(Ve.leftChild,Dt);return kt!==void 0?kt:Ve.key}};this.upperBound=function(Ve){return At(Ie,Ve)};var $e=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Ve.key,Dt);if(qe===0)return Ve.key;if(qe>0)return $e(Ve.leftChild,Dt);var kt=$e(Ve.rightChild,Dt);return kt!==void 0?kt:Ve.key}};this.reverseLowerBound=function(Ve){return $e(Ie,Ve)};var Fe=function(Ve,Dt){if(!(!Ve||Ve.key===void 0)){var qe=ie(Ve.key,Dt);if(qe>=0)return Fe(Ve.leftChild,Dt);var kt=Fe(Ve.rightChild,Dt);return kt!==void 0?kt:Ve.key}};this.reverseUpperBound=function(Ve){return Fe(Ie,Ve)},this.union=function(Ve){var Dt=this;Ve.forEach(function(qe){return Dt.insert(qe)})},this.getHeight=function(){if(this.empty())return 0;var Ve=function(Dt){return Dt?Math.max(Ve(Dt.leftChild),Ve(Dt.rightChild))+1:1};return Ve(Ie)};var Ue=function(Ve){return k(this,function(Dt){switch(Dt.label){case 0:return!Ve||Ve.key===void 0?[2]:[5,$(Ue(Ve.leftChild))];case 1:return Dt.sent(),[4,Ve.key];case 2:return Dt.sent(),[5,$(Ue(Ve.rightChild))];case 3:return Dt.sent(),[2]}})};this[Symbol.iterator]=function(){return Ue(Ie)},Ce.forEach(function(Ve){return ae.insert(Ve)}),Object.freeze(this)}Object.freeze(oe),V.default=oe},{"../Base/TreeNode":25}],34:[function(r,g,V){Object.defineProperty(V,"__esModule",{value:!0});function k($){var re=this;$===void 0&&($=[]);var oe=0,Ce=[];this.size=function(){return oe},this.empty=function(){return oe===0},this.clear=function(){oe=0,Ce.length=0},this.push=function(ie){Ce.push(ie),++oe},this.pop=function(){Ce.pop(),oe>0&&--oe},this.top=function(){return Ce[oe-1]},$.forEach(function(ie){return re.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(ze){return function(xe){return pe([ze,xe])}}function pe(ze){if(Ie)throw new TypeError("Generator is already executing.");for(;le;)try{if(Ie=1,ue&&(de=ze[0]&2?ue.return:ze[0]?ue.throw||((de=ue.return)&&de.call(ue),0):ue.next)&&!(de=de.call(ue,ze[1])).done)return de;switch(ue=0,de&&(ze=[ze[0]&2,de.value]),ze[0]){case 0:case 1:de=ze;break;case 4:return le.label++,{value:ze[1],done:!1};case 5:le.label++,ue=ze[1],ze=[0];continue;case 7:ze=le.ops.pop(),le.trys.pop();continue;default:if(de=le.trys,!(de=de.length>0&&de[de.length-1])&&(ze[0]===6||ze[0]===2)){le=0;continue}if(ze[0]===3&&(!de||ze[1]>de[0]&&ze[1]<de[3])){le.label=ze[1];break}if(ze[0]===6&&le.label<de[1]){le.label=de[1],de=ze;break}if(de&&le.label<de[2]){le.label=de[2],le.ops.push(ze);break}de[2]&&le.ops.pop(),le.trys.pop();continue}ze=ae.call(ie,le)}catch(xe){ze=[6,xe],ue=0}finally{Ie=de=0}if(ze[0]&5)throw ze[1];return{value:ze[0]?ze[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},re=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))},oe=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,pe){Ie[pe]=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,re([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,pe){(pe===0||he!==ue)&&(de.push(he),ue=he)}),de.forEach(function(he,pe){Ie[pe]=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,oe(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 re=r("./Queue/Queue");V.Queue=re.default;var oe=r("./LinkList/LinkList");V.LinkList=oe.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"),re=Symbol("length"),oe=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[oe]=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,xe(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,xe(this)}get maxAge(){return this[ie]}set lengthCalculator(Fe){typeof Fe!="function"&&(Fe=Ne),Fe!==this[oe]&&(this[oe]=Fe,this[re]=0,this[Ie].forEach(Ue=>{Ue.length=this[oe](Ue.value,Ue.key),this[re]+=Ue.length})),xe(this)}get lengthCalculator(){return this[oe]}get length(){return this[re]}get itemCount(){return this[Ie].length}rforEach(Fe,Ue){Ue=Ue||this;for(let Ve=this[Ie].tail;Ve!==null;){const Dt=Ve.prev;At(this,Fe,Ve,Ue),Ve=Dt}}forEach(Fe,Ue){Ue=Ue||this;for(let Ve=this[Ie].head;Ve!==null;){const Dt=Ve.next;At(this,Fe,Ve,Ue),Ve=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[re]=0}dump(){return this[Ie].map(Fe=>ze(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,Ve){if(Ve=Ve||this[ie],Ve&&typeof Ve!="number")throw new TypeError("maxAge must be a number");const Dt=Ve?Date.now():0,qe=this[oe](Ue,Fe);if(this[ue].has(Fe)){if(qe>this[$])return Oe(this,this[ue].get(Fe)),!1;const Pt=this[ue].get(Fe).value;return this[ae]&&(this[le]||this[ae](Fe,Pt.value)),Pt.now=Dt,Pt.maxAge=Ve,Pt.value=Ue,this[re]+=qe-Pt.length,Pt.length=qe,this.get(Fe),xe(this),!0}const kt=new _e(Fe,Ue,qe,Dt,Ve);return kt.length>this[$]?(this[ae]&&this[ae](Fe,Ue),!1):(this[re]+=kt.length,this[Ie].unshift(kt),this[ue].set(Fe,this[Ie].head),xe(this),!0)}has(Fe){if(!this[ue].has(Fe))return!1;const Ue=this[ue].get(Fe).value;return!ze(this,Ue)}get(Fe){return pe(this,Fe,!0)}peek(Fe){return pe(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 Ve=Fe.length-1;Ve>=0;Ve--){const Dt=Fe[Ve],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)=>pe(this,Ue,!1))}}const pe=($e,Fe,Ue)=>{const Ve=$e[ue].get(Fe);if(Ve){const Dt=Ve.value;if(ze($e,Dt)){if(Oe($e,Ve),!$e[Ce])return}else Ue&&($e[de]&&(Ve.value.now=Date.now()),$e[Ie].unshiftNode(Ve));return Dt.value}},ze=($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]},xe=$e=>{if($e[re]>$e[$])for(let Fe=$e[Ie].tail;$e[re]>$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[re]-=Ue.length,$e[ue].delete(Ue.key),$e[Ie].removeNode(Fe)}};class _e{constructor(Fe,Ue,Ve,Dt,qe){this.key=Fe,this.value=Ue,this.length=Ve,this.now=Dt,this.maxAge=qe||0}}const At=($e,Fe,Ue,Ve)=>{let Dt=Ue.value;ze($e,Dt)&&(Oe($e,Ue),$e[Ce]||(Dt=void 0)),Dt&&Fe.call(Ve,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 oe in $.types){const Ce=$.types[oe];$.codes[Ce]=oe}$.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 oe in $.properties){const Ce=$.properties[oe];$.propertiesCodes[Ce]=oe}$.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 re(oe){return[0,1,2].map(Ce=>[0,1].map(ie=>[0,1].map(ae=>{const le=k.alloc(1);return le.writeUInt8($.codes[oe]<<$.CMD_SHIFT|(ie?$.DUP_MASK:0)|Ce<<$.QOS_SHIFT|ae,0,!0),le})))}$.PUBLISH_HEADER=re("publish"),$.SUBSCRIBE_HEADER=re("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=re("unsubscribe"),$.ACKS={unsuback:re("unsuback"),puback:re("puback"),pubcomp:re("pubcomp"),pubrel:re("pubrel"),pubrec:re("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(oe=>k.from([oe])),$.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"),re=r("events");function oe(ie,ae){const le=new Ce;return $(ie,le,ae),le.concat()}class Ce extends re{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=oe}).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 re={},oe=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++)re[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),oe?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:re,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"),re=r("./packet"),oe=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 re,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=oe.types[le>>oe.CMD_SHIFT],this.packet.retain=(le&oe.RETAIN_MASK)!==0,this.packet.qos=le>>oe.QOS_SHIFT&oe.QOS_MASK,this.packet.dup=(le&oe.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,pe=this._parseString();if(pe===null)return this._emitError(new Error("Cannot parse protocolId"));if(pe!=="MQTT"&&pe!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(he.protocolId=pe,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)&oe.USERNAME_MASK,Ne.password=this._list.readUInt8(this._pos)&oe.PASSWORD_MASK,Ne.will=this._list.readUInt8(this._pos)&oe.WILL_FLAG_MASK,Ne.will&&(he.will={},he.will.retain=(this._list.readUInt8(this._pos)&oe.WILL_RETAIN_MASK)!==0,he.will.qos=(this._list.readUInt8(this._pos)&oe.WILL_QOS_MASK)>>oe.WILL_QOS_SHIFT),he.clean=(this._list.readUInt8(this._pos)&oe.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 xe=this._parseProperties();Object.getOwnPropertyNames(xe).length&&(he.properties=xe)}const ze=this._parseString();if(ze===null)return this._emitError(new Error("Packet too short"));if(he.clientId=ze,Ce("_parseConnect: packet.clientId: %s",he.clientId),Ne.will){if(he.protocolVersion===5){const xe=this._parseProperties();Object.getOwnPropertyNames(xe).length&&(he.will.properties=xe)}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++)&oe.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,pe,ze;if(le.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(le.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const xe=this._parseProperties();Object.getOwnPropertyNames(xe).length&&(le.properties=xe)}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&oe.SUBSCRIBE_OPTIONS_QOS_MASK,pe=(ue>>oe.SUBSCRIBE_OPTIONS_NL_SHIFT&oe.SUBSCRIBE_OPTIONS_NL_MASK)!==0,he=(ue>>oe.SUBSCRIBE_OPTIONS_RAP_SHIFT&oe.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,Ne=ue>>oe.SUBSCRIBE_OPTIONS_RH_SHIFT&oe.SUBSCRIBE_OPTIONS_RH_MASK,ze={topic:Ie,qos:de},this.settings.protocolVersion===5?(ze.nl=pe,ze.rap=he,ze.rh=Ne):this.settings.bridgeMode&&(ze.rh=0,ze.rap=!0,ze.nl=!0),Ce("_parseSubscribe: push subscription `%s` to subscription",ze),le.subscriptions.push(ze)}}}_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,pe;const ze=this._pos?this._pos:0;for(;ue<Ie&&ze+ue<this._list.length;){if(pe=this._list.readUInt8(ze+ue++),Ne+=de*(pe&oe.VARBYTEINT_MASK),de*=128,!(pe&oe.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")),ze&&(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=oe.propertiesCodes[Ne];if(!he)return this._emitError(new Error("Unknown property")),!1;if(he==="userProperties"){de[he]||(de[he]=Object.create(null));const pe=this._parseByType(oe.propertiesTypes[he]);if(de[he][pe.name])if(Array.isArray(de[he][pe.name]))de[he][pe.name].push(pe.value);else{const ze=de[he][pe.name];de[he][pe.name]=[ze],de[he][pe.name].push(pe.value)}else de[he][pe.name]=pe.value;continue}de[he]?Array.isArray(de[he])?de[he].push(this._parseByType(oe.propertiesTypes[he])):(de[he]=[de[he]],de[he].push(this._parseByType(oe.propertiesTypes[he]))):de[he]=this._parseByType(oe.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 re,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"),re=k.allocUnsafe(0),oe=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,pe=!0;function ze(ui,Ci,zi){switch(ae("generate called"),Ci.cork&&(Ci.cork(),ie(xe,Ci)),pe&&(pe=!1,ue()),ae("generate: packet.cmd: %s",ui.cmd),ui.cmd){case"connect":return Oe(ui,Ci);case"connack":return _e(ui,Ci,zi);case"publish":return At(ui,Ci,zi);case"puback":case"pubrec":case"pubrel":case"pubcomp":return $e(ui,Ci,zi);case"subscribe":return Fe(ui,Ci,zi);case"suback":return Ue(ui,Ci,zi);case"unsubscribe":return Ve(ui,Ci,zi);case"unsuback":return Dt(ui,Ci,zi);case"pingreq":case"pingresp":return qe(ui,Ci);case"disconnect":return kt(ui,Ci,zi);case"auth":return jt(ui,Ci,zi);default:return Ci.emit("error",new Error("Unknown command")),!1}}Object.defineProperty(ze,"cacheNumbers",{get(){return he===ni},set(ui){ui?((!le||Object.keys(le).length===0)&&(pe=!0),he=ni):(pe=!1,he=ri)}});function xe(ui){ui.uncork()}function Oe(ui,Ci,zi){const Mi=ui||{},Ni=Mi.protocolId||"MQTT";let mi=Mi.protocolVersion||4;const vi=Mi.will;let bi=Mi.clean;const si=Mi.keepalive||0,li=Mi.clientId||"",oi=Mi.username,Lt=Mi.password,ii=Mi.properties;bi===void 0&&(bi=!0);let gi=0;if(!Ni||typeof Ni!="string"&&!k.isBuffer(Ni))return Ci.emit("error",new Error("Invalid protocolId")),!1;if(gi+=Ni.length+2,mi!==3&&mi!==4&&mi!==5)return Ci.emit("error",new Error("Invalid protocol version")),!1;if(gi+=1,(typeof li=="string"||k.isBuffer(li))&&(li||mi>=4)&&(li||bi))gi+=k.byteLength(li)+2;else{if(mi<4)return Ci.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(bi*1===0)return Ci.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof si!="number"||si<0||si>65535||si%1!==0)return Ci.emit("error",new Error("Invalid keepalive")),!1;if(gi+=2,gi+=1,mi===5){var fi=ai(Ci,ii);if(!fi)return!1;gi+=fi.length}if(vi){if(typeof vi!="object")return Ci.emit("error",new Error("Invalid will")),!1;if(!vi.topic||typeof vi.topic!="string")return Ci.emit("error",new Error("Invalid will topic")),!1;if(gi+=k.byteLength(vi.topic)+2,gi+=2,vi.payload)if(vi.payload.length>=0)typeof vi.payload=="string"?gi+=k.byteLength(vi.payload):gi+=vi.payload.length;else return Ci.emit("error",new Error("Invalid will payload")),!1;var pi={};if(mi===5){if(pi=ai(Ci,vi.properties),!pi)return!1;gi+=pi.length}}let Si=!1;if(oi!=null)if(yi(oi))Si=!0,gi+=k.byteLength(oi)+2;else return Ci.emit("error",new Error("Invalid username")),!1;if(Lt!=null){if(!Si)return Ci.emit("error",new Error("Username is required to use password")),!1;if(yi(Lt))gi+=Ai(Lt)+2;else return Ci.emit("error",new Error("Invalid password")),!1}Ci.write($.CONNECT_HEADER),ti(Ci,gi),wi(Ci,Ni),Mi.bridgeMode&&(mi+=128),Ci.write(mi===131?$.VERSION131:mi===132?$.VERSION132:mi===4?$.VERSION4:mi===5?$.VERSION5:$.VERSION3);let xi=0;return xi|=oi!=null?$.USERNAME_MASK:0,xi|=Lt!=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,Ci.write(k.from([xi])),he(Ci,si),mi===5&&fi.write(),wi(Ci,li),vi&&(mi===5&&pi.write(),ei(Ci,vi.topic),wi(Ci,vi.payload)),oi!=null&&wi(Ci,oi),Lt!=null&&wi(Ci,Lt),!0}function _e(ui,Ci,zi){const Mi=zi?zi.protocolVersion:4,Ni=ui||{},mi=Mi===5?Ni.reasonCode:Ni.returnCode,vi=Ni.properties;let bi=2;if(typeof mi!="number")return Ci.emit("error",new Error("Invalid return code")),!1;let si=null;if(Mi===5){if(si=ai(Ci,vi),!si)return!1;bi+=si.length}return Ci.write($.CONNACK_HEADER),ti(Ci,bi),Ci.write(Ni.sessionPresent?$.SESSIONPRESENT_HEADER:oe),Ci.write(k.from([mi])),si!=null&&si.write(),!0}function At(ui,Ci,zi){ae("publish: packet: %o",ui);const Mi=zi?zi.protocolVersion:4,Ni=ui||{},mi=Ni.qos||0,vi=Ni.retain?$.RETAIN_MASK:0,bi=Ni.topic,si=Ni.payload||re,li=Ni.messageId,oi=Ni.properties;let Lt=0;if(typeof bi=="string")Lt+=k.byteLength(bi)+2;else if(k.isBuffer(bi))Lt+=bi.length+2;else return Ci.emit("error",new Error("Invalid topic")),!1;if(k.isBuffer(si)?Lt+=si.length:Lt+=k.byteLength(si),mi&&typeof li!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;mi&&(Lt+=2);let ii=null;if(Mi===5){if(ii=ai(Ci,oi),!ii)return!1;Lt+=ii.length}return Ci.write($.PUBLISH_HEADER[mi][Ni.dup?1:0][vi?1:0]),ti(Ci,Lt),he(Ci,Ai(bi)),Ci.write(bi),mi>0&&he(Ci,li),ii!=null&&ii.write(),ae("publish: payload: %o",si),Ci.write(si)}function $e(ui,Ci,zi){const Mi=zi?zi.protocolVersion:4,Ni=ui||{},mi=Ni.cmd||"puback",vi=Ni.messageId,bi=Ni.dup&&mi==="pubrel"?$.DUP_MASK:0;let si=0;const li=Ni.reasonCode,oi=Ni.properties;let Lt=Mi===5?3:2;if(mi==="pubrel"&&(si=1),typeof vi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;let ii=null;if(Mi===5&&typeof oi=="object"){if(ii=di(Ci,oi,zi,Lt),!ii)return!1;Lt+=ii.length}return Ci.write($.ACKS[mi][si][bi][0]),ti(Ci,Lt),he(Ci,vi),Mi===5&&Ci.write(k.from([li])),ii!==null&&ii.write(),!0}function Fe(ui,Ci,zi){ae("subscribe: packet: ");const Mi=zi?zi.protocolVersion:4,Ni=ui||{},mi=Ni.dup?$.DUP_MASK:0,vi=Ni.messageId,bi=Ni.subscriptions,si=Ni.properties;let li=0;if(typeof vi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;li+=2;let oi=null;if(Mi===5){if(oi=ai(Ci,si),!oi)return!1;li+=oi.length}if(typeof bi=="object"&&bi.length)for(let ii=0;ii<bi.length;ii+=1){const gi=bi[ii].topic,fi=bi[ii].qos;if(typeof gi!="string")return Ci.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof fi!="number")return Ci.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(Mi===5){if(typeof(bi[ii].nl||!1)!="boolean")return Ci.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(bi[ii].rap||!1)!="boolean")return Ci.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const xi=bi[ii].rh||0;if(typeof xi!="number"||xi>2)return Ci.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}li+=k.byteLength(gi)+2+1}else return Ci.emit("error",new Error("Invalid subscriptions")),!1;ae("subscribe: writing to stream: %o",$.SUBSCRIBE_HEADER),Ci.write($.SUBSCRIBE_HEADER[1][mi?1:0][0]),ti(Ci,li),he(Ci,vi),oi!==null&&oi.write();let Lt=!0;for(const ii of bi){const gi=ii.topic,fi=ii.qos,pi=+ii.nl,Si=+ii.rap,xi=ii.rh;let Gi;ei(Ci,gi),Gi=$.SUBSCRIBE_OPTIONS_QOS[fi],Mi===5&&(Gi|=pi?$.SUBSCRIBE_OPTIONS_NL:0,Gi|=Si?$.SUBSCRIBE_OPTIONS_RAP:0,Gi|=xi?$.SUBSCRIBE_OPTIONS_RH[xi]:0),Lt=Ci.write(k.from([Gi]))}return Lt}function Ue(ui,Ci,zi){const Mi=zi?zi.protocolVersion:4,Ni=ui||{},mi=Ni.messageId,vi=Ni.granted,bi=Ni.properties;let si=0;if(typeof mi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;if(si+=2,typeof vi=="object"&&vi.length)for(let oi=0;oi<vi.length;oi+=1){if(typeof vi[oi]!="number")return Ci.emit("error",new Error("Invalid qos vector")),!1;si+=1}else return Ci.emit("error",new Error("Invalid qos vector")),!1;let li=null;if(Mi===5){if(li=di(Ci,bi,zi,si),!li)return!1;si+=li.length}return Ci.write($.SUBACK_HEADER),ti(Ci,si),he(Ci,mi),li!==null&&li.write(),Ci.write(k.from(vi))}function Ve(ui,Ci,zi){const Mi=zi?zi.protocolVersion:4,Ni=ui||{},mi=Ni.messageId,vi=Ni.dup?$.DUP_MASK:0,bi=Ni.unsubscriptions,si=Ni.properties;let li=0;if(typeof mi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;if(li+=2,typeof bi=="object"&&bi.length)for(let ii=0;ii<bi.length;ii+=1){if(typeof bi[ii]!="string")return Ci.emit("error",new Error("Invalid unsubscriptions")),!1;li+=k.byteLength(bi[ii])+2}else return Ci.emit("error",new Error("Invalid unsubscriptions")),!1;let oi=null;if(Mi===5){if(oi=ai(Ci,si),!oi)return!1;li+=oi.length}Ci.write($.UNSUBSCRIBE_HEADER[1][vi?1:0][0]),ti(Ci,li),he(Ci,mi),oi!==null&&oi.write();let Lt=!0;for(let ii=0;ii<bi.length;ii++)Lt=ei(Ci,bi[ii]);return Lt}function Dt(ui,Ci,zi){const Mi=zi?zi.protocolVersion:4,Ni=ui||{},mi=Ni.messageId,vi=Ni.dup?$.DUP_MASK:0,bi=Ni.granted,si=Ni.properties,li=Ni.cmd,oi=0;let Lt=2;if(typeof mi!="number")return Ci.emit("error",new Error("Invalid messageId")),!1;if(Mi===5)if(typeof bi=="object"&&bi.length)for(let gi=0;gi<bi.length;gi+=1){if(typeof bi[gi]!="number")return Ci.emit("error",new Error("Invalid qos vector")),!1;Lt+=1}else return Ci.emit("error",new Error("Invalid qos vector")),!1;let ii=null;if(Mi===5){if(ii=di(Ci,si,zi,Lt),!ii)return!1;Lt+=ii.length}return Ci.write($.ACKS[li][oi][vi][0]),ti(Ci,Lt),he(Ci,mi),ii!==null&&ii.write(),Mi===5&&Ci.write(k.from(bi)),!0}function qe(ui,Ci,zi){return Ci.write($.EMPTY[ui.cmd])}function kt(ui,Ci,zi){const Mi=zi?zi.protocolVersion:4,Ni=ui||{},mi=Ni.reasonCode,vi=Ni.properties;let bi=Mi===5?1:0,si=null;if(Mi===5){if(si=di(Ci,vi,zi,bi),!si)return!1;bi+=si.length}return Ci.write(k.from([$.codes.disconnect<<4])),ti(Ci,bi),Mi===5&&Ci.write(k.from([mi])),si!==null&&si.write(),!0}function jt(ui,Ci,zi){const Mi=zi?zi.protocolVersion:4,Ni=ui||{},mi=Ni.reasonCode,vi=Ni.properties;let bi=Mi===5?1:0;Mi!==5&&Ci.emit("error",new Error("Invalid mqtt version for auth packet"));const si=di(Ci,vi,zi,bi);return si?(bi+=si.length,Ci.write(k.from([$.codes.auth<<4])),ti(Ci,bi),Ci.write(k.from([mi])),si!==null&&si.write(),!0):!1}const Pt={};function ti(ui,Ci){if(Ci>$.VARBYTEINT_MAX)return ui.emit("error",new Error(`Invalid variable byte integer: ${Ci}`)),!1;let zi=Pt[Ci];return zi||(zi=de(Ci),Ci<16384&&(Pt[Ci]=zi)),ae("writeVarByteInt: writing to stream: %o",zi),ui.write(zi)}function ei(ui,Ci){const zi=k.byteLength(Ci);return he(ui,zi),ae("writeString: %s",Ci),ui.write(Ci,"utf8")}function Et(ui,Ci,zi){ei(ui,Ci),ei(ui,zi)}function ni(ui,Ci){return ae("writeNumberCached: number: %d",Ci),ae("writeNumberCached: %o",le[Ci]),ui.write(le[Ci])}function ri(ui,Ci){const zi=Ie(Ci);return ae("writeNumberGenerated: %o",zi),ui.write(zi)}function Ii(ui,Ci){const zi=Ne(Ci);return ae("write4ByteNumber: %o",zi),ui.write(zi)}function wi(ui,Ci){typeof Ci=="string"?ei(ui,Ci):Ci?(he(ui,Ci.length),ui.write(Ci)):he(ui,0)}function ai(ui,Ci){if(typeof Ci!="object"||Ci.length!=null)return{length:1,write(){ci(ui,{},0)}};let zi=0;function Mi(mi,vi){const bi=$.propertiesTypes[mi];let si=0;switch(bi){case"byte":{if(typeof vi!="boolean")return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;si+=1+1;break}case"int8":{if(typeof vi!="number"||vi<0||vi>255)return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;si+=1+1;break}case"binary":{if(vi&&vi===null)return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;si+=1+k.byteLength(vi)+2;break}case"int16":{if(typeof vi!="number"||vi<0||vi>65535)return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;si+=1+2;break}case"int32":{if(typeof vi!="number"||vi<0||vi>4294967295)return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;si+=1+4;break}case"var":{if(typeof vi!="number"||vi<0||vi>268435455)return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;si+=1+k.byteLength(de(vi));break}case"string":{if(typeof vi!="string")return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;si+=1+2+k.byteLength(vi.toString());break}case"pair":{if(typeof vi!="object")return ui.emit("error",new Error(`Invalid ${mi}: ${vi}`)),!1;si+=Object.getOwnPropertyNames(vi).reduce((li,oi)=>{const Lt=vi[oi];return Array.isArray(Lt)?li+=Lt.reduce((ii,gi)=>(ii+=1+2+k.byteLength(oi.toString())+2+k.byteLength(gi.toString()),ii),0):li+=1+2+k.byteLength(oi.toString())+2+k.byteLength(vi[oi].toString()),li},0);break}default:return ui.emit("error",new Error(`Invalid property ${mi}: ${vi}`)),!1}return si}if(Ci)for(const mi in Ci){let vi=0,bi=0;const si=Ci[mi];if(Array.isArray(si))for(let li=0;li<si.length;li++){if(bi=Mi(mi,si[li]),!bi)return!1;vi+=bi}else{if(bi=Mi(mi,si),!bi)return!1;vi=bi}if(!vi)return!1;zi+=vi}return{length:k.byteLength(de(zi))+zi,write(){ci(ui,Ci,zi)}}}function di(ui,Ci,zi,Mi){const Ni=["reasonString","userProperties"],mi=zi&&zi.properties&&zi.properties.maximumPacketSize?zi.properties.maximumPacketSize:0;let vi=ai(ui,Ci);if(mi)for(;Mi+vi.length>mi;){const bi=Ni.shift();if(bi&&Ci[bi])delete Ci[bi],vi=ai(ui,Ci);else return!1}return vi}function hi(ui,Ci,zi){switch($.propertiesTypes[Ci]){case"byte":{ui.write(k.from([$.properties[Ci]])),ui.write(k.from([+zi]));break}case"int8":{ui.write(k.from([$.properties[Ci]])),ui.write(k.from([zi]));break}case"binary":{ui.write(k.from([$.properties[Ci]])),wi(ui,zi);break}case"int16":{ui.write(k.from([$.properties[Ci]])),he(ui,zi);break}case"int32":{ui.write(k.from([$.properties[Ci]])),Ii(ui,zi);break}case"var":{ui.write(k.from([$.properties[Ci]])),ti(ui,zi);break}case"string":{ui.write(k.from([$.properties[Ci]])),ei(ui,zi);break}case"pair":{Object.getOwnPropertyNames(zi).forEach(Ni=>{const mi=zi[Ni];Array.isArray(mi)?mi.forEach(vi=>{ui.write(k.from([$.properties[Ci]])),Et(ui,Ni.toString(),vi.toString())}):(ui.write(k.from([$.properties[Ci]])),Et(ui,Ni.toString(),mi.toString()))});break}default:return ui.emit("error",new Error(`Invalid property ${Ci} value: ${zi}`)),!1}}function ci(ui,Ci,zi){ti(ui,zi);for(const Mi in Ci)if(Object.prototype.hasOwnProperty.call(Ci,Mi)&&Ci[Mi]!==null){const Ni=Ci[Mi];if(Array.isArray(Ni))for(let mi=0;mi<Ni.length;mi++)hi(ui,Mi,Ni[mi]);else hi(ui,Mi,Ni)}}function Ai(ui){return ui?ui instanceof k?ui.length:k.byteLength(ui):0}function yi(ui){return typeof ui=="string"||ui instanceof k}g.exports=ze}).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,re=$*60,oe=re*24,Ce=oe*7,ie=oe*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]),pe=(Ne[2]||"ms").toLowerCase();switch(pe){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*oe;case"hours":case"hour":case"hrs":case"hr":case"h":return he*re;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>=oe?Math.round(de/oe)+"d":Ne>=re?Math.round(de/re)+"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>=oe?ue(de,Ne,oe,"day"):Ne>=re?ue(de,Ne,re,"hour"):Ne>=$?ue(de,Ne,$,"minute"):Ne>=k?ue(de,Ne,k,"second"):de+" ms"}function ue(de,Ne,he,pe){var ze=Ne>=he*1.5;return Math.round(de/he)+" "+pe+(ze?"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"),re=r("debug")("number-allocator:error");function oe(ie,ae){this.low=ie,this.high=ae}oe.prototype.equals=function(ie){return this.low===ie.low&&this.high===ie.high},oe.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 oe(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 oe(Ie,ie-1)),$("use():"+ie),!0}return $("use():failed"),!1},Ce.prototype.free=function(ie){if(ie<this.min||ie>this.max){re("free():"+ie+" is out of range");return}const ae=new oe(ie,ie),le=this.ss.lowerBound(ae);if(le){if(le.low<=ie&&ie<=le.high){re("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 oe(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(re),$.proto=$(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return $(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return re(this)},configurable:!0})});function $(oe){var Ce=function(){return Ce.called?Ce.value:(Ce.called=!0,Ce.value=oe.apply(this,arguments))};return Ce.called=!1,Ce}function re(oe){var Ce=function(){if(Ce.called)throw new Error(Ce.onceError);return Ce.called=!0,Ce.value=oe.apply(this,arguments)},ie=oe.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 $(re,oe,Ce,ie){if(typeof re!="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(re);case 2:return k.nextTick(function(){re.call(null,oe)});case 3:return k.nextTick(function(){re.call(null,oe,Ce)});case 4:return k.nextTick(function(){re.call(null,oe,Ce,ie)});default:for(le=new Array(ae-1),Ie=0;Ie<le.length;)le[Ie++]=arguments[Ie];return k.nextTick(function(){re.apply(null,le)})}}}).call(this)}).call(this,r("_process"))},{_process:50}],50:[function(r,g,V){var k=g.exports={},$,re;function oe(){throw new Error("setTimeout has not been defined")}function Ce(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?$=setTimeout:$=oe}catch{$=oe}try{typeof clearTimeout=="function"?re=clearTimeout:re=Ce}catch{re=Ce}})();function ie(xe){if($===setTimeout)return setTimeout(xe,0);if(($===oe||!$)&&setTimeout)return $=setTimeout,setTimeout(xe,0);try{return $(xe,0)}catch{try{return $.call(null,xe,0)}catch{return $.call(this,xe,0)}}}function ae(xe){if(re===clearTimeout)return clearTimeout(xe);if((re===Ce||!re)&&clearTimeout)return re=clearTimeout,clearTimeout(xe);try{return re(xe)}catch{try{return re.call(null,xe)}catch{return re.call(this,xe)}}}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 xe=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(xe)}}k.nextTick=function(xe){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 pe(xe,Oe)),le.length===1&&!Ie&&ie(he)};function pe(xe,Oe){this.fun=xe,this.array=Oe}pe.prototype.run=function(){this.fun.apply(null,this.array)},k.title="browser",k.browser=!0,k.env={},k.argv=[],k.version="",k.versions={};function ze(){}k.on=ze,k.addListener=ze,k.once=ze,k.off=ze,k.removeListener=ze,k.removeAllListeners=ze,k.emit=ze,k.prependListener=ze,k.prependOnceListener=ze,k.listeners=function(xe){return[]},k.binding=function(xe){throw new Error("process.binding is not supported")},k.cwd=function(){return"/"},k.chdir=function(xe){throw new Error("process.chdir is not supported")},k.umask=function(){return 0}},{}],51:[function(r,g,V){(function(k){(function(){(function($){var re=typeof V=="object"&&V&&!V.nodeType&&V,oe=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,pe=128,ze="-",xe=/^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,Ve;function Dt(ai){throw new RangeError(At[ai])}function qe(ai,di){for(var hi=ai.length,ci=[];hi--;)ci[hi]=di(ai[hi]);return ci}function kt(ai,di){var hi=ai.split("@"),ci="";hi.length>1&&(ci=hi[0]+"@",ai=hi[1]),ai=ai.replace(_e,".");var Ai=ai.split("."),yi=qe(Ai,di).join(".");return ci+yi}function jt(ai){for(var di=[],hi=0,ci=ai.length,Ai,yi;hi<ci;)Ai=ai.charCodeAt(hi++),Ai>=55296&&Ai<=56319&&hi<ci?(yi=ai.charCodeAt(hi++),(yi&64512)==56320?di.push(((Ai&1023)<<10)+(yi&1023)+65536):(di.push(Ai),hi--)):di.push(Ai);return di}function Pt(ai){return qe(ai,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(ai){return ai-48<10?ai-22:ai-65<26?ai-65:ai-97<26?ai-97:le}function ei(ai,di){return ai+22+75*(ai<26)-((di!=0)<<5)}function Et(ai,di,hi){var ci=0;for(ai=hi?Fe(ai/Ne):ai>>1,ai+=Fe(ai/di);ai>$e*ue>>1;ci+=le)ai=Fe(ai/$e);return Fe(ci+($e+1)*ai/(ai+de))}function ni(ai){var di=[],hi=ai.length,ci,Ai=0,yi=pe,ui=he,Ci,zi,Mi,Ni,mi,vi,bi,si,li;for(Ci=ai.lastIndexOf(ze),Ci<0&&(Ci=0),zi=0;zi<Ci;++zi)ai.charCodeAt(zi)>=128&&Dt("not-basic"),di.push(ai.charCodeAt(zi));for(Mi=Ci>0?Ci+1:0;Mi<hi;){for(Ni=Ai,mi=1,vi=le;Mi>=hi&&Dt("invalid-input"),bi=ti(ai.charCodeAt(Mi++)),(bi>=le||bi>Fe((ae-Ai)/mi))&&Dt("overflow"),Ai+=bi*mi,si=vi<=ui?Ie:vi>=ui+ue?ue:vi-ui,!(bi<si);vi+=le)li=le-si,mi>Fe(ae/li)&&Dt("overflow"),mi*=li;ci=di.length+1,ui=Et(Ai-Ni,ci,Ni==0),Fe(Ai/ci)>ae-yi&&Dt("overflow"),yi+=Fe(Ai/ci),Ai%=ci,di.splice(Ai++,0,yi)}return Pt(di)}function ri(ai){var di,hi,ci,Ai,yi,ui,Ci,zi,Mi,Ni,mi,vi=[],bi,si,li,oi;for(ai=jt(ai),bi=ai.length,di=pe,hi=0,yi=he,ui=0;ui<bi;++ui)mi=ai[ui],mi<128&&vi.push(Ue(mi));for(ci=Ai=vi.length,Ai&&vi.push(ze);ci<bi;){for(Ci=ae,ui=0;ui<bi;++ui)mi=ai[ui],mi>=di&&mi<Ci&&(Ci=mi);for(si=ci+1,Ci-di>Fe((ae-hi)/si)&&Dt("overflow"),hi+=(Ci-di)*si,di=Ci,ui=0;ui<bi;++ui)if(mi=ai[ui],mi<di&&++hi>ae&&Dt("overflow"),mi==di){for(zi=hi,Mi=le;Ni=Mi<=yi?Ie:Mi>=yi+ue?ue:Mi-yi,!(zi<Ni);Mi+=le)oi=zi-Ni,li=le-Ni,vi.push(Ue(ei(Ni+oi%li,0))),zi=Fe(oi/li);vi.push(Ue(ei(zi,0))),yi=Et(hi,si,ci==Ai),hi=0,++ci}++hi,++di}return vi.join("")}function Ii(ai){return kt(ai,function(di){return xe.test(di)?ni(di.slice(4).toLowerCase()):di})}function wi(ai){return kt(ai,function(di){return Oe.test(di)?"xn--"+ri(di):di})}if(ie={version:"1.4.1",ucs2:{decode:jt,encode:Pt},decode:ni,encode:ri,toASCII:wi,toUnicode:Ii},re&&oe)if(g.exports==re)oe.exports=ie;else for(Ve in ie)ie.hasOwnProperty(Ve)&&(re[Ve]=ie[Ve]);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(re,oe){return Object.prototype.hasOwnProperty.call(re,oe)}g.exports=function(re,oe,Ce,ie){oe=oe||"&",Ce=Ce||"=";var ae={};if(typeof re!="string"||re.length===0)return ae;var le=/\+/g;re=re.split(oe);var Ie=1e3;ie&&typeof ie.maxKeys=="number"&&(Ie=ie.maxKeys);var ue=re.length;Ie>0&&ue>Ie&&(ue=Ie);for(var de=0;de<ue;++de){var Ne=re[de].replace(le,"%20"),he=Ne.indexOf(Ce),pe,ze,xe,Oe;he>=0?(pe=Ne.substr(0,he),ze=Ne.substr(he+1)):(pe=Ne,ze=""),xe=decodeURIComponent(pe),Oe=decodeURIComponent(ze),k(ae,xe)?$(ae[xe])?ae[xe].push(Oe):ae[xe]=[ae[xe],Oe]:ae[xe]=Oe}return ae};var $=Array.isArray||function(re){return Object.prototype.toString.call(re)==="[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"?re(oe(Ce),function(Ie){var ue=encodeURIComponent(k(Ie))+ae;return $(Ce[Ie])?re(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 re(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 oe=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 re(le,Ie,ue){ue||(ue=Error);function de(he,pe,ze){return typeof Ie=="string"?Ie:Ie(he,pe,ze)}var Ne=function(he){k(pe,he);function pe(ze,xe,Oe){return he.call(this,de(ze,xe,Oe))||this}return pe}(ue);Ne.prototype.name=ue.name,Ne.prototype.code=le,$[le]=Ne}function oe(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}re("ERR_INVALID_OPT_VALUE",function(le,Ie){return'The value "'+Ie+'" is invalid for option "'+le+'"'},TypeError),re("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(oe(Ie,"type"));else{var he=ae(le,".")?"property":"argument";Ne='The "'.concat(le,'" ').concat(he," ").concat(de," ").concat(oe(Ie,"type"))}return Ne+=". Received type ".concat(typeof ue),Ne},TypeError),re("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),re("ERR_METHOD_NOT_IMPLEMENTED",function(le){return"The "+le+" method is not implemented"}),re("ERR_STREAM_PREMATURE_CLOSE","Premature close"),re("ERR_STREAM_DESTROYED",function(le){return"Cannot call "+le+" after a stream was destroyed"}),re("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),re("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),re("ERR_STREAM_WRITE_AFTER_END","write after end"),re("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),re("ERR_UNKNOWN_ENCODING",function(le){return"Unknown encoding: "+le},TypeError),re("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 re=r("./_stream_readable"),oe=r("./_stream_writable");r("inherits")(le,re);for(var Ce=$(oe.prototype),ie=0;ie<Ce.length;ie++){var ae=Ce[ie];le.prototype[ae]||(le.prototype[ae]=oe.prototype[ae])}function le(de){if(!(this instanceof le))return new le(de);re.call(this,de),oe.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 $(re){if(!(this instanceof $))return new $(re);k.call(this,re)}$.prototype._transform=function(re,oe,Ce){Ce(null,re)}},{"./_stream_transform":59,inherits:24}],58:[function(r,g,V){(function(k,$){(function(){g.exports=Pt;var re;Pt.ReadableState=jt,r("events").EventEmitter;var oe=function(li,oi){return li.listeners(oi).length},Ce=r("./internal/streams/stream"),ie=r("buffer").Buffer,ae=$.Uint8Array||function(){};function le(si){return ie.from(si)}function Ie(si){return ie.isBuffer(si)||si 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"),pe=r("./internal/streams/state"),ze=pe.getHighWaterMark,xe=r("../errors").codes,Oe=xe.ERR_INVALID_ARG_TYPE,_e=xe.ERR_STREAM_PUSH_AFTER_EOF,At=xe.ERR_METHOD_NOT_IMPLEMENTED,$e=xe.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,Fe,Ue,Ve;r("inherits")(Pt,Ce);var Dt=he.errorOrDestroy,qe=["error","close","destroy","pause","resume"];function kt(si,li,oi){if(typeof si.prependListener=="function")return si.prependListener(li,oi);!si._events||!si._events[li]?si.on(li,oi):Array.isArray(si._events[li])?si._events[li].unshift(oi):si._events[li]=[oi,si._events[li]]}function jt(si,li,oi){re=re||r("./_stream_duplex"),si=si||{},typeof oi!="boolean"&&(oi=li instanceof re),this.objectMode=!!si.objectMode,oi&&(this.objectMode=this.objectMode||!!si.readableObjectMode),this.highWaterMark=ze(this,si,"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=si.emitClose!==!1,this.autoDestroy=!!si.autoDestroy,this.destroyed=!1,this.defaultEncoding=si.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,si.encoding&&(Fe||(Fe=r("string_decoder/").StringDecoder),this.decoder=new Fe(si.encoding),this.encoding=si.encoding)}function Pt(si){if(re=re||r("./_stream_duplex"),!(this instanceof Pt))return new Pt(si);var li=this instanceof re;this._readableState=new jt(si,this,li),this.readable=!0,si&&(typeof si.read=="function"&&(this._read=si.read),typeof si.destroy=="function"&&(this._destroy=si.destroy)),Ce.call(this)}Object.defineProperty(Pt.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(li){this._readableState&&(this._readableState.destroyed=li)}}),Pt.prototype.destroy=he.destroy,Pt.prototype._undestroy=he.undestroy,Pt.prototype._destroy=function(si,li){li(si)},Pt.prototype.push=function(si,li){var oi=this._readableState,Lt;return oi.objectMode?Lt=!0:typeof si=="string"&&(li=li||oi.defaultEncoding,li!==oi.encoding&&(si=ie.from(si,li),li=""),Lt=!0),ti(this,si,li,!1,Lt)},Pt.prototype.unshift=function(si){return ti(this,si,null,!0,!1)};function ti(si,li,oi,Lt,ii){de("readableAddChunk",li);var gi=si._readableState;if(li===null)gi.reading=!1,wi(si,gi);else{var fi;if(ii||(fi=Et(gi,li)),fi)Dt(si,fi);else if(gi.objectMode||li&&li.length>0)if(typeof li!="string"&&!gi.objectMode&&Object.getPrototypeOf(li)!==ie.prototype&&(li=le(li)),Lt)gi.endEmitted?Dt(si,new $e):ei(si,gi,li,!0);else if(gi.ended)Dt(si,new _e);else{if(gi.destroyed)return!1;gi.reading=!1,gi.decoder&&!oi?(li=gi.decoder.write(li),gi.objectMode||li.length!==0?ei(si,gi,li,!1):hi(si,gi)):ei(si,gi,li,!1)}else Lt||(gi.reading=!1,hi(si,gi))}return!gi.ended&&(gi.length<gi.highWaterMark||gi.length===0)}function ei(si,li,oi,Lt){li.flowing&&li.length===0&&!li.sync?(li.awaitDrain=0,si.emit("data",oi)):(li.length+=li.objectMode?1:oi.length,Lt?li.buffer.unshift(oi):li.buffer.push(oi),li.needReadable&&ai(si)),hi(si,li)}function Et(si,li){var oi;return!Ie(li)&&typeof li!="string"&&li!==void 0&&!si.objectMode&&(oi=new Oe("chunk",["string","Buffer","Uint8Array"],li)),oi}Pt.prototype.isPaused=function(){return this._readableState.flowing===!1},Pt.prototype.setEncoding=function(si){Fe||(Fe=r("string_decoder/").StringDecoder);var li=new Fe(si);this._readableState.decoder=li,this._readableState.encoding=this._readableState.decoder.encoding;for(var oi=this._readableState.buffer.head,Lt="";oi!==null;)Lt+=li.write(oi.data),oi=oi.next;return this._readableState.buffer.clear(),Lt!==""&&this._readableState.buffer.push(Lt),this._readableState.length=Lt.length,this};var ni=1073741824;function ri(si){return si>=ni?si=ni:(si--,si|=si>>>1,si|=si>>>2,si|=si>>>4,si|=si>>>8,si|=si>>>16,si++),si}function Ii(si,li){return si<=0||li.length===0&&li.ended?0:li.objectMode?1:si!==si?li.flowing&&li.length?li.buffer.head.data.length:li.length:(si>li.highWaterMark&&(li.highWaterMark=ri(si)),si<=li.length?si:li.ended?li.length:(li.needReadable=!0,0))}Pt.prototype.read=function(si){de("read",si),si=parseInt(si,10);var li=this._readableState,oi=si;if(si!==0&&(li.emittedReadable=!1),si===0&&li.needReadable&&((li.highWaterMark!==0?li.length>=li.highWaterMark:li.length>0)||li.ended))return de("read: emitReadable",li.length,li.ended),li.length===0&&li.ended?mi(this):ai(this),null;if(si=Ii(si,li),si===0&&li.ended)return li.length===0&&mi(this),null;var Lt=li.needReadable;de("need readable",Lt),(li.length===0||li.length-si<li.highWaterMark)&&(Lt=!0,de("length less than watermark",Lt)),li.ended||li.reading?(Lt=!1,de("reading or ended",Lt)):Lt&&(de("do read"),li.reading=!0,li.sync=!0,li.length===0&&(li.needReadable=!0),this._read(li.highWaterMark),li.sync=!1,li.reading||(si=Ii(oi,li)));var ii;return si>0?ii=Ni(si,li):ii=null,ii===null?(li.needReadable=li.length<=li.highWaterMark,si=0):(li.length-=si,li.awaitDrain=0),li.length===0&&(li.ended||(li.needReadable=!0),oi!==si&&li.ended&&mi(this)),ii!==null&&this.emit("data",ii),ii};function wi(si,li){if(de("onEofChunk"),!li.ended){if(li.decoder){var oi=li.decoder.end();oi&&oi.length&&(li.buffer.push(oi),li.length+=li.objectMode?1:oi.length)}li.ended=!0,li.sync?ai(si):(li.needReadable=!1,li.emittedReadable||(li.emittedReadable=!0,di(si)))}}function ai(si){var li=si._readableState;de("emitReadable",li.needReadable,li.emittedReadable),li.needReadable=!1,li.emittedReadable||(de("emitReadable",li.flowing),li.emittedReadable=!0,k.nextTick(di,si))}function di(si){var li=si._readableState;de("emitReadable_",li.destroyed,li.length,li.ended),!li.destroyed&&(li.length||li.ended)&&(si.emit("readable"),li.emittedReadable=!1),li.needReadable=!li.flowing&&!li.ended&&li.length<=li.highWaterMark,Mi(si)}function hi(si,li){li.readingMore||(li.readingMore=!0,k.nextTick(ci,si,li))}function ci(si,li){for(;!li.reading&&!li.ended&&(li.length<li.highWaterMark||li.flowing&&li.length===0);){var oi=li.length;if(de("maybeReadMore read 0"),si.read(0),oi===li.length)break}li.readingMore=!1}Pt.prototype._read=function(si){Dt(this,new At("_read()"))},Pt.prototype.pipe=function(si,li){var oi=this,Lt=this._readableState;switch(Lt.pipesCount){case 0:Lt.pipes=si;break;case 1:Lt.pipes=[Lt.pipes,si];break;default:Lt.pipes.push(si);break}Lt.pipesCount+=1,de("pipe count=%d opts=%j",Lt.pipesCount,li);var ii=(!li||li.end!==!1)&&si!==k.stdout&&si!==k.stderr,gi=ii?pi:Vi;Lt.endEmitted?k.nextTick(gi):oi.once("end",gi),si.on("unpipe",fi);function fi(ki,Hi){de("onunpipe"),ki===oi&&Hi&&Hi.hasUnpiped===!1&&(Hi.hasUnpiped=!0,Gi())}function pi(){de("onend"),si.end()}var Si=Ai(oi);si.on("drain",Si);var xi=!1;function Gi(){de("cleanup"),si.removeListener("close",Zi),si.removeListener("finish",Wi),si.removeListener("drain",Si),si.removeListener("error",Oi),si.removeListener("unpipe",fi),oi.removeListener("end",pi),oi.removeListener("end",Vi),oi.removeListener("data",Bi),xi=!0,Lt.awaitDrain&&(!si._writableState||si._writableState.needDrain)&&Si()}oi.on("data",Bi);function Bi(ki){de("ondata");var Hi=si.write(ki);de("dest.write",Hi),Hi===!1&&((Lt.pipesCount===1&&Lt.pipes===si||Lt.pipesCount>1&&bi(Lt.pipes,si)!==-1)&&!xi&&(de("false write response, pause",Lt.awaitDrain),Lt.awaitDrain++),oi.pause())}function Oi(ki){de("onerror",ki),Vi(),si.removeListener("error",Oi),oe(si,"error")===0&&Dt(si,ki)}kt(si,"error",Oi);function Zi(){si.removeListener("finish",Wi),Vi()}si.once("close",Zi);function Wi(){de("onfinish"),si.removeListener("close",Zi),Vi()}si.once("finish",Wi);function Vi(){de("unpipe"),oi.unpipe(si)}return si.emit("pipe",oi),Lt.flowing||(de("pipe resume"),oi.resume()),si};function Ai(si){return function(){var oi=si._readableState;de("pipeOnDrain",oi.awaitDrain),oi.awaitDrain&&oi.awaitDrain--,oi.awaitDrain===0&&oe(si,"data")&&(oi.flowing=!0,Mi(si))}}Pt.prototype.unpipe=function(si){var li=this._readableState,oi={hasUnpiped:!1};if(li.pipesCount===0)return this;if(li.pipesCount===1)return si&&si!==li.pipes?this:(si||(si=li.pipes),li.pipes=null,li.pipesCount=0,li.flowing=!1,si&&si.emit("unpipe",this,oi),this);if(!si){var Lt=li.pipes,ii=li.pipesCount;li.pipes=null,li.pipesCount=0,li.flowing=!1;for(var gi=0;gi<ii;gi++)Lt[gi].emit("unpipe",this,{hasUnpiped:!1});return this}var fi=bi(li.pipes,si);return fi===-1?this:(li.pipes.splice(fi,1),li.pipesCount-=1,li.pipesCount===1&&(li.pipes=li.pipes[0]),si.emit("unpipe",this,oi),this)},Pt.prototype.on=function(si,li){var oi=Ce.prototype.on.call(this,si,li),Lt=this._readableState;return si==="data"?(Lt.readableListening=this.listenerCount("readable")>0,Lt.flowing!==!1&&this.resume()):si==="readable"&&!Lt.endEmitted&&!Lt.readableListening&&(Lt.readableListening=Lt.needReadable=!0,Lt.flowing=!1,Lt.emittedReadable=!1,de("on readable",Lt.length,Lt.reading),Lt.length?ai(this):Lt.reading||k.nextTick(ui,this)),oi},Pt.prototype.addListener=Pt.prototype.on,Pt.prototype.removeListener=function(si,li){var oi=Ce.prototype.removeListener.call(this,si,li);return si==="readable"&&k.nextTick(yi,this),oi},Pt.prototype.removeAllListeners=function(si){var li=Ce.prototype.removeAllListeners.apply(this,arguments);return(si==="readable"||si===void 0)&&k.nextTick(yi,this),li};function yi(si){var li=si._readableState;li.readableListening=si.listenerCount("readable")>0,li.resumeScheduled&&!li.paused?li.flowing=!0:si.listenerCount("data")>0&&si.resume()}function ui(si){de("readable nexttick read 0"),si.read(0)}Pt.prototype.resume=function(){var si=this._readableState;return si.flowing||(de("resume"),si.flowing=!si.readableListening,Ci(this,si)),si.paused=!1,this};function Ci(si,li){li.resumeScheduled||(li.resumeScheduled=!0,k.nextTick(zi,si,li))}function zi(si,li){de("resume",li.reading),li.reading||si.read(0),li.resumeScheduled=!1,si.emit("resume"),Mi(si),li.flowing&&!li.reading&&si.read(0)}Pt.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(si){var li=si._readableState;for(de("flow",li.flowing);li.flowing&&si.read()!==null;);}Pt.prototype.wrap=function(si){var li=this,oi=this._readableState,Lt=!1;si.on("end",function(){if(de("wrapped end"),oi.decoder&&!oi.ended){var fi=oi.decoder.end();fi&&fi.length&&li.push(fi)}li.push(null)}),si.on("data",function(fi){if(de("wrapped data"),oi.decoder&&(fi=oi.decoder.write(fi)),!(oi.objectMode&&fi==null)&&!(!oi.objectMode&&(!fi||!fi.length))){var pi=li.push(fi);pi||(Lt=!0,si.pause())}});for(var ii in si)this[ii]===void 0&&typeof si[ii]=="function"&&(this[ii]=function(pi){return function(){return si[pi].apply(si,arguments)}}(ii));for(var gi=0;gi<qe.length;gi++)si.on(qe[gi],this.emit.bind(this,qe[gi]));return this._read=function(fi){de("wrapped _read",fi),Lt&&(Lt=!1,si.resume())},this},typeof Symbol=="function"&&(Pt.prototype[Symbol.asyncIterator]=function(){return Ue===void 0&&(Ue=r("./internal/streams/async_iterator")),Ue(this)}),Object.defineProperty(Pt.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(Pt.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(Pt.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(li){this._readableState&&(this._readableState.flowing=li)}}),Pt._fromList=Ni,Object.defineProperty(Pt.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function Ni(si,li){if(li.length===0)return null;var oi;return li.objectMode?oi=li.buffer.shift():!si||si>=li.length?(li.decoder?oi=li.buffer.join(""):li.buffer.length===1?oi=li.buffer.first():oi=li.buffer.concat(li.length),li.buffer.clear()):oi=li.buffer.consume(si,li.decoder),oi}function mi(si){var li=si._readableState;de("endReadable",li.endEmitted),li.endEmitted||(li.ended=!0,k.nextTick(vi,li,si))}function vi(si,li){if(de("endReadableNT",si.endEmitted,si.length),!si.endEmitted&&si.length===0&&(si.endEmitted=!0,li.readable=!1,li.emit("end"),si.autoDestroy)){var oi=li._writableState;(!oi||oi.autoDestroy&&oi.finished)&&li.destroy()}}typeof Symbol=="function"&&(Pt.from=function(si,li){return Ve===void 0&&(Ve=r("./internal/streams/from")),Ve(Pt,si,li)});function bi(si,li){for(var oi=0,Lt=si.length;oi<Lt;oi++)if(si[oi]===li)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,re=k.ERR_MULTIPLE_CALLBACK,oe=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 pe=he.writecb;if(pe===null)return this.emit("error",new re);he.writechunk=null,he.writecb=null,Ne!=null&&this.push(Ne),pe(de);var ze=this._readableState;ze.reading=!1,(ze.needReadable||ze.length<ze.highWaterMark)&&this._read(ze.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 pe=this._transformState;if(pe.writecb=he,pe.writechunk=de,pe.writeencoding=Ne,!pe.transforming){var ze=this._readableState;(pe.needTransform||ze.needReadable||ze.length<ze.highWaterMark)&&this._read(ze.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 oe;return de.push(null)}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(r,g,V){(function(k,$){(function(){g.exports=jt;function re(Mi){var Ni=this;this.next=null,this.entry=null,this.finish=function(){zi(Ni,Mi)}}var oe;jt.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,pe=r("../errors").codes,ze=pe.ERR_INVALID_ARG_TYPE,xe=pe.ERR_METHOD_NOT_IMPLEMENTED,Oe=pe.ERR_MULTIPLE_CALLBACK,_e=pe.ERR_STREAM_CANNOT_PIPE,At=pe.ERR_STREAM_DESTROYED,$e=pe.ERR_STREAM_NULL_VALUES,Fe=pe.ERR_STREAM_WRITE_AFTER_END,Ue=pe.ERR_UNKNOWN_ENCODING,Ve=de.errorOrDestroy;r("inherits")(jt,ie);function Dt(){}function qe(Mi,Ni,mi){oe=oe||r("./_stream_duplex"),Mi=Mi||{},typeof mi!="boolean"&&(mi=Ni instanceof oe),this.objectMode=!!Mi.objectMode,mi&&(this.objectMode=this.objectMode||!!Mi.writableObjectMode),this.highWaterMark=he(this,Mi,"writableHighWaterMark",mi),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){wi(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 re(this)}qe.prototype.getBuffer=function(){for(var Ni=this.bufferedRequest,mi=[];Ni;)mi.push(Ni),Ni=Ni.next;return mi},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(jt,Symbol.hasInstance,{value:function(Ni){return kt.call(this,Ni)?!0:this!==jt?!1:Ni&&Ni._writableState instanceof qe}})):kt=function(Ni){return Ni instanceof this};function jt(Mi){oe=oe||r("./_stream_duplex");var Ni=this instanceof oe;if(!Ni&&!kt.call(jt,this))return new jt(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)}jt.prototype.pipe=function(){Ve(this,new _e)};function Pt(Mi,Ni){var mi=new Fe;Ve(Mi,mi),k.nextTick(Ni,mi)}function ti(Mi,Ni,mi,vi){var bi;return mi===null?bi=new $e:typeof mi!="string"&&!Ni.objectMode&&(bi=new ze("chunk",["string","Buffer"],mi)),bi?(Ve(Mi,bi),k.nextTick(vi,bi),!1):!0}jt.prototype.write=function(Mi,Ni,mi){var vi=this._writableState,bi=!1,si=!vi.objectMode&&ue(Mi);return si&&!ae.isBuffer(Mi)&&(Mi=Ie(Mi)),typeof Ni=="function"&&(mi=Ni,Ni=null),si?Ni="buffer":Ni||(Ni=vi.defaultEncoding),typeof mi!="function"&&(mi=Dt),vi.ending?Pt(this,mi):(si||ti(this,vi,Mi,mi))&&(vi.pendingcb++,bi=Et(this,vi,si,Mi,Ni,mi)),bi},jt.prototype.cork=function(){this._writableState.corked++},jt.prototype.uncork=function(){var Mi=this._writableState;Mi.corked&&(Mi.corked--,!Mi.writing&&!Mi.corked&&!Mi.bufferProcessing&&Mi.bufferedRequest&&hi(this,Mi))},jt.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(jt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ei(Mi,Ni,mi){return!Mi.objectMode&&Mi.decodeStrings!==!1&&typeof Ni=="string"&&(Ni=ae.from(Ni,mi)),Ni}Object.defineProperty(jt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Et(Mi,Ni,mi,vi,bi,si){if(!mi){var li=ei(Ni,vi,bi);vi!==li&&(mi=!0,bi="buffer",vi=li)}var oi=Ni.objectMode?1:vi.length;Ni.length+=oi;var Lt=Ni.length<Ni.highWaterMark;if(Lt||(Ni.needDrain=!0),Ni.writing||Ni.corked){var ii=Ni.lastBufferedRequest;Ni.lastBufferedRequest={chunk:vi,encoding:bi,isBuf:mi,callback:si,next:null},ii?ii.next=Ni.lastBufferedRequest:Ni.bufferedRequest=Ni.lastBufferedRequest,Ni.bufferedRequestCount+=1}else ni(Mi,Ni,!1,oi,vi,bi,si);return Lt}function ni(Mi,Ni,mi,vi,bi,si,li){Ni.writelen=vi,Ni.writecb=li,Ni.writing=!0,Ni.sync=!0,Ni.destroyed?Ni.onwrite(new At("write")):mi?Mi._writev(bi,Ni.onwrite):Mi._write(bi,si,Ni.onwrite),Ni.sync=!1}function ri(Mi,Ni,mi,vi,bi){--Ni.pendingcb,mi?(k.nextTick(bi,vi),k.nextTick(ui,Mi,Ni),Mi._writableState.errorEmitted=!0,Ve(Mi,vi)):(bi(vi),Mi._writableState.errorEmitted=!0,Ve(Mi,vi),ui(Mi,Ni))}function Ii(Mi){Mi.writing=!1,Mi.writecb=null,Mi.length-=Mi.writelen,Mi.writelen=0}function wi(Mi,Ni){var mi=Mi._writableState,vi=mi.sync,bi=mi.writecb;if(typeof bi!="function")throw new Oe;if(Ii(mi),Ni)ri(Mi,mi,vi,Ni,bi);else{var si=ci(mi)||Mi.destroyed;!si&&!mi.corked&&!mi.bufferProcessing&&mi.bufferedRequest&&hi(Mi,mi),vi?k.nextTick(ai,Mi,mi,si,bi):ai(Mi,mi,si,bi)}}function ai(Mi,Ni,mi,vi){mi||di(Mi,Ni),Ni.pendingcb--,vi(),ui(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 mi=Ni.bufferedRequest;if(Mi._writev&&mi&&mi.next){var vi=Ni.bufferedRequestCount,bi=new Array(vi),si=Ni.corkedRequestsFree;si.entry=mi;for(var li=0,oi=!0;mi;)bi[li]=mi,mi.isBuf||(oi=!1),mi=mi.next,li+=1;bi.allBuffers=oi,ni(Mi,Ni,!0,Ni.length,bi,"",si.finish),Ni.pendingcb++,Ni.lastBufferedRequest=null,si.next?(Ni.corkedRequestsFree=si.next,si.next=null):Ni.corkedRequestsFree=new re(Ni),Ni.bufferedRequestCount=0}else{for(;mi;){var Lt=mi.chunk,ii=mi.encoding,gi=mi.callback,fi=Ni.objectMode?1:Lt.length;if(ni(Mi,Ni,!1,fi,Lt,ii,gi),mi=mi.next,Ni.bufferedRequestCount--,Ni.writing)break}mi===null&&(Ni.lastBufferedRequest=null)}Ni.bufferedRequest=mi,Ni.bufferProcessing=!1}jt.prototype._write=function(Mi,Ni,mi){mi(new xe("_write()"))},jt.prototype._writev=null,jt.prototype.end=function(Mi,Ni,mi){var vi=this._writableState;return typeof Mi=="function"?(mi=Mi,Mi=null,Ni=null):typeof Ni=="function"&&(mi=Ni,Ni=null),Mi!=null&&this.write(Mi,Ni),vi.corked&&(vi.corked=1,this.uncork()),vi.ending||Ci(this,vi,mi),this},Object.defineProperty(jt.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(mi){Ni.pendingcb--,mi&&Ve(Mi,mi),Ni.prefinished=!0,Mi.emit("prefinish"),ui(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 ui(Mi,Ni){var mi=ci(Ni);if(mi&&(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 mi}function Ci(Mi,Ni,mi){Ni.ending=!0,ui(Mi,Ni),mi&&(Ni.finished?k.nextTick(mi):Mi.once("finish",mi)),Ni.ended=!0,Mi.writable=!1}function zi(Mi,Ni,mi){var vi=Mi.entry;for(Mi.entry=null;vi;){var bi=vi.callback;Ni.pendingcb--,bi(mi),vi=vi.next}Ni.corkedRequestsFree.next=Mi}Object.defineProperty(jt.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(Ni){this._writableState&&(this._writableState.destroyed=Ni)}}),jt.prototype.destroy=de.destroy,jt.prototype._undestroy=de.undestroy,jt.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 re(At,$e,Fe){return $e in At?Object.defineProperty(At,$e,{value:Fe,enumerable:!0,configurable:!0,writable:!0}):At[$e]=Fe,At}var oe=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 pe(At){k.nextTick(he,At)}function ze(At,$e){return function(Fe,Ue){At.then(function(){if($e[le]){Fe(Ne(void 0,!0));return}$e[ue](Fe,Ue)},Ue)}}var xe=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],Ve;if(Ue)Ve=new Promise(ze(Ue,this));else{var Dt=this[de].read();if(Dt!==null)return Promise.resolve(Ne(Dt,!1));Ve=new Promise(this[ue])}return this[Ie]=Ve,Ve}},re($,Symbol.asyncIterator,function(){return this}),re($,"return",function(){var $e=this;return new Promise(function(Fe,Ue){$e[de].destroy(null,function(Ve){if(Ve){Ue(Ve);return}Fe(Ne(void 0,!0))})})}),$),xe),_e=function($e){var Fe,Ue=Object.create(Oe,(Fe={},re(Fe,de,{value:$e,writable:!0}),re(Fe,Ce,{value:null,writable:!0}),re(Fe,ie,{value:null,writable:!0}),re(Fe,ae,{value:null,writable:!0}),re(Fe,le,{value:$e._readableState.endEmitted,writable:!0}),re(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,oe($e,function(Ve){if(Ve&&Ve.code!=="ERR_STREAM_PREMATURE_CLOSE"){var Dt=Ue[ie];Dt!==null&&(Ue[Ie]=null,Ue[Ce]=null,Ue[ie]=null,Dt(Ve)),Ue[ae]=Ve;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",pe.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,pe){var ze=Object.keys(he);if(Object.getOwnPropertySymbols){var xe=Object.getOwnPropertySymbols(he);pe&&(xe=xe.filter(function(Oe){return Object.getOwnPropertyDescriptor(he,Oe).enumerable})),ze.push.apply(ze,xe)}return ze}function $(he){for(var pe=1;pe<arguments.length;pe++){var ze=arguments[pe]!=null?arguments[pe]:{};pe%2?k(Object(ze),!0).forEach(function(xe){re(he,xe,ze[xe])}):Object.getOwnPropertyDescriptors?Object.defineProperties(he,Object.getOwnPropertyDescriptors(ze)):k(Object(ze)).forEach(function(xe){Object.defineProperty(he,xe,Object.getOwnPropertyDescriptor(ze,xe))})}return he}function re(he,pe,ze){return pe in he?Object.defineProperty(he,pe,{value:ze,enumerable:!0,configurable:!0,writable:!0}):he[pe]=ze,he}function oe(he,pe){if(!(he instanceof pe))throw new TypeError("Cannot call a class as a function")}function Ce(he,pe){for(var ze=0;ze<pe.length;ze++){var xe=pe[ze];xe.enumerable=xe.enumerable||!1,xe.configurable=!0,"value"in xe&&(xe.writable=!0),Object.defineProperty(he,xe.key,xe)}}function ie(he,pe,ze){return pe&&Ce(he.prototype,pe),ze&&Ce(he,ze),he}var ae=r("buffer"),le=ae.Buffer,Ie=r("util"),ue=Ie.inspect,de=ue&&ue.custom||"inspect";function Ne(he,pe,ze){le.prototype.copy.call(he,pe,ze)}g.exports=function(){function he(){oe(this,he),this.head=null,this.tail=null,this.length=0}return ie(he,[{key:"push",value:function(ze){var xe={data:ze,next:null};this.length>0?this.tail.next=xe:this.head=xe,this.tail=xe,++this.length}},{key:"unshift",value:function(ze){var xe={data:ze,next:this.head};this.length===0&&(this.tail=xe),this.head=xe,++this.length}},{key:"shift",value:function(){if(this.length!==0){var ze=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,ze}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(ze){if(this.length===0)return"";for(var xe=this.head,Oe=""+xe.data;xe=xe.next;)Oe+=ze+xe.data;return Oe}},{key:"concat",value:function(ze){if(this.length===0)return le.alloc(0);for(var xe=le.allocUnsafe(ze>>>0),Oe=this.head,_e=0;Oe;)Ne(Oe.data,xe,_e),_e+=Oe.data.length,Oe=Oe.next;return xe}},{key:"consume",value:function(ze,xe){var Oe;return ze<this.head.data.length?(Oe=this.head.data.slice(0,ze),this.head.data=this.head.data.slice(ze)):ze===this.head.data.length?Oe=this.shift():Oe=xe?this._getString(ze):this._getBuffer(ze),Oe}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(ze){var xe=this.head,Oe=1,_e=xe.data;for(ze-=_e.length;xe=xe.next;){var At=xe.data,$e=ze>At.length?At.length:ze;if($e===At.length?_e+=At:_e+=At.slice(0,ze),ze-=$e,ze===0){$e===At.length?(++Oe,xe.next?this.head=xe.next:this.head=this.tail=null):(this.head=xe,xe.data=At.slice($e));break}++Oe}return this.length-=Oe,_e}},{key:"_getBuffer",value:function(ze){var xe=le.allocUnsafe(ze),Oe=this.head,_e=1;for(Oe.data.copy(xe),ze-=Oe.data.length;Oe=Oe.next;){var At=Oe.data,$e=ze>At.length?At.length:ze;if(At.copy(xe,xe.length-ze,0,$e),ze-=$e,ze===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,xe}},{key:de,value:function(ze,xe){return ue(this,$({},xe,{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(oe,ue):(ue._writableState.errorEmitted=!0,k.nextTick(re,ue,he)):k.nextTick(re,ue,he):Ie?(k.nextTick(oe,ue),Ie(he)):k.nextTick(oe,ue)}),this)}function re(le,Ie){ie(le,Ie),oe(le)}function oe(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 re(){}function oe(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||re);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)},pe=ie._readableState&&ie._readableState.endEmitted,ze=function(){Ie=!1,pe=!0,ue||le.call(ie)},xe=function($e){le.call(ie,$e)},Oe=function(){var $e;if(Ie&&!pe)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 oe(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",ze),ie.on("finish",he),ae.error!==!1&&ie.on("error",xe),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",ze),ie.removeListener("error",xe),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 pe=!1;return function(){pe||(pe=!0,he.apply(void 0,arguments))}}var re=r("../../../errors").codes,oe=re.ERR_MISSING_ARGS,Ce=re.ERR_STREAM_DESTROYED;function ie(he){if(he)throw he}function ae(he){return he.setHeader&&typeof he.abort=="function"}function le(he,pe,ze,xe){xe=$(xe);var Oe=!1;he.on("close",function(){Oe=!0}),k===void 0&&(k=r("./end-of-stream")),k(he,{readable:pe,writable:ze},function(At){if(At)return xe(At);Oe=!0,xe()});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();xe(At||new Ce("pipe"))}}}function Ie(he){he()}function ue(he,pe){return he.pipe(pe)}function de(he){return!he.length||typeof he[he.length-1]!="function"?ie:he.pop()}function Ne(){for(var he=arguments.length,pe=new Array(he),ze=0;ze<he;ze++)pe[ze]=arguments[ze];var xe=de(pe);if(Array.isArray(pe[0])&&(pe=pe[0]),pe.length<2)throw new oe("streams");var Oe,_e=pe.map(function(At,$e){var Fe=$e<pe.length-1,Ue=$e>0;return le(At,Fe,Ue,function(Ve){Oe||(Oe=Ve),Ve&&_e.forEach(Ie),!Fe&&(_e.forEach(Ie),xe(Oe))})});return pe.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 $(oe,Ce,ie){return oe.highWaterMark!=null?oe.highWaterMark:Ce?oe[ie]:null}function re(oe,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 oe.objectMode?16:16*1024}g.exports={getHighWaterMark:re}},{"../../../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(re,oe,Ce){var ie=this;this._callback=re,this._args=Ce,this._interval=setInterval(re,oe,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 re;if(arguments.length>0){re=new Array(arguments.length-2);for(var oe=0;oe<re.length;oe++)re[oe]=arguments[oe+2]}return new k(arguments[0],arguments[1],re)}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=re;function $(Ce){return Ce instanceof k?k.from(Ce):new Ce.constructor(Ce.buffer.slice(),Ce.byteOffset,Ce.length)}function re(Ce){if(Ce=Ce||{},Ce.circles)return oe(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 pe=de[he],ze=Ie[pe];typeof ze!="object"||ze===null?Ne[pe]=ze:ze instanceof Date?Ne[pe]=new Date(ze):ArrayBuffer.isView(ze)?Ne[pe]=$(ze):Ne[pe]=ue(ze)}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 oe(Ce){var ie=[],ae=[];return Ce.proto?ue:Ie;function le(de,Ne){for(var he=Object.keys(de),pe=new Array(he.length),ze=0;ze<he.length;ze++){var xe=he[ze],Oe=de[xe];if(typeof Oe!="object"||Oe===null)pe[xe]=Oe;else if(Oe instanceof Date)pe[xe]=new Date(Oe);else if(ArrayBuffer.isView(Oe))pe[xe]=$(Oe);else{var _e=ie.indexOf(Oe);_e!==-1?pe[xe]=ae[_e]:pe[xe]=Ne(Oe)}}return pe}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 pe=de[he];if(typeof pe!="object"||pe===null)Ne[he]=pe;else if(pe instanceof Date)Ne[he]=new Date(pe);else if(pe instanceof Map)Ne[he]=new Map(le(Array.from(pe),Ie));else if(pe instanceof Set)Ne[he]=new Set(le(Array.from(pe),Ie));else if(ArrayBuffer.isView(pe))Ne[he]=$(pe);else{var ze=ie.indexOf(pe);ze!==-1?Ne[he]=ae[ze]:Ne[he]=Ie(pe)}}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 pe=de[he];if(typeof pe!="object"||pe===null)Ne[he]=pe;else if(pe instanceof Date)Ne[he]=new Date(pe);else if(pe instanceof Map)Ne[he]=new Map(le(Array.from(pe),ue));else if(pe instanceof Set)Ne[he]=new Set(le(Array.from(pe),ue));else if(ArrayBuffer.isView(pe))Ne[he]=$(pe);else{var ze=ie.indexOf(pe);ze!==-1?Ne[he]=ae[ze]:Ne[he]=ue(pe)}}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 re(Ce,ie){for(var ae in Ce)ie[ae]=Ce[ae]}$.from&&$.alloc&&$.allocUnsafe&&$.allocUnsafeSlow?g.exports=k:(re(k,V),V.Buffer=oe);function oe(Ce,ie,ae){return $(Ce,ie,ae)}oe.prototype=Object.create($.prototype),re($,oe),oe.from=function(Ce,ie,ae){if(typeof Ce=="number")throw new TypeError("Argument must not be a number");return $(Ce,ie,ae)},oe.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},oe.allocUnsafe=function(Ce){if(typeof Ce!="number")throw new TypeError("Argument must be a number");return $(Ce)},oe.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(re){var oe=re._readableState;return oe?oe.objectMode||typeof re._duplexState=="number"?re.read():re.read($(oe)):null}function $(re){return re.buffer.length?re.buffer.head?re.buffer.head.data.length:re.buffer[0].length:re.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 re(_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 oe(_e){var At=re(_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=oe(_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=pe,this.end=ze,At=3;break;default:this.write=xe,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 pe(_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 ze(_e){var At=_e&&_e.length?this.write(_e):"";return this.lastNeed?At+this.lastChar.toString("base64",0,3-this.lastNeed):At}function xe(_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=re;function re(){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 oe=/^([a-z0-9.+-]+:)/i,Ce=/:[0-9]*$/,ie=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,ae=["<",">",'"',"`"," ","\r",`
1264
- `," "],le=["{","}","|","\\","^","`"].concat(ae),Ie=["'"].concat(le),ue=["%","/","?",";","#"].concat(Ie),de=["/","?","#"],Ne=255,he=/^[+a-z0-9A-Z_-]{0,63}$/,pe=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ze={javascript:!0,"javascript:":!0},xe={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(Ve,Dt,qe){if(Ve&&$.isObject(Ve)&&Ve instanceof re)return Ve;var kt=new re;return kt.parse(Ve,Dt,qe),kt}re.prototype.parse=function(Ve,Dt,qe){if(!$.isString(Ve))throw new TypeError("Parameter 'url' must be a string, not "+typeof Ve);var kt=Ve.indexOf("?"),jt=kt!==-1&&kt<Ve.indexOf("#")?"?":"#",Pt=Ve.split(jt),ti=/\\/g;Pt[0]=Pt[0].replace(ti,"/"),Ve=Pt.join(jt);var ei=Ve;if(ei=ei.trim(),!qe&&Ve.split("#").length===1){var Et=ie.exec(ei);if(Et)return this.path=ei,this.href=ei,this.pathname=Et[1],Et[2]?(this.search=Et[2],Dt?this.query=_e.parse(this.search.substr(1)):this.query=this.search.substr(1)):Dt&&(this.search="",this.query={}),this}var ni=oe.exec(ei);if(ni){ni=ni[0];var ri=ni.toLowerCase();this.protocol=ri,ei=ei.substr(ni.length)}if(qe||ni||ei.match(/^\/\/[^@\/]+@[^@\/]+/)){var Ii=ei.substr(0,2)==="//";Ii&&!(ni&&xe[ni])&&(ei=ei.substr(2),this.slashes=!0)}if(!xe[ni]&&(Ii||ni&&!Oe[ni])){for(var wi=-1,ai=0;ai<de.length;ai++){var di=ei.indexOf(de[ai]);di!==-1&&(wi===-1||di<wi)&&(wi=di)}var hi,ci;wi===-1?ci=ei.lastIndexOf("@"):ci=ei.lastIndexOf("@",wi),ci!==-1&&(hi=ei.slice(0,ci),ei=ei.slice(ci+1),this.auth=decodeURIComponent(hi)),wi=-1;for(var ai=0;ai<ue.length;ai++){var di=ei.indexOf(ue[ai]);di!==-1&&(wi===-1||di<wi)&&(wi=di)}wi===-1&&(wi=ei.length),this.host=ei.slice(0,wi),ei=ei.slice(wi),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(/\./),ai=0,ui=yi.length;ai<ui;ai++){var Ci=yi[ai];if(Ci&&!Ci.match(he)){for(var zi="",Mi=0,Ni=Ci.length;Mi<Ni;Mi++)Ci.charCodeAt(Mi)>127?zi+="x":zi+=Ci[Mi];if(!zi.match(he)){var mi=yi.slice(0,ai),vi=yi.slice(ai+1),bi=Ci.match(pe);bi&&(mi.push(bi[1]),vi.unshift(bi[2])),vi.length&&(ei="/"+vi.join(".")+ei),this.hostname=mi.join(".");break}}}this.hostname.length>Ne?this.hostname="":this.hostname=this.hostname.toLowerCase(),Ai||(this.hostname=k.toASCII(this.hostname));var si=this.port?":"+this.port:"",li=this.hostname||"";this.host=li+si,this.href+=this.host,Ai&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),ei[0]!=="/"&&(ei="/"+ei))}if(!ze[ri])for(var ai=0,ui=Ie.length;ai<ui;ai++){var oi=Ie[ai];if(ei.indexOf(oi)!==-1){var Lt=encodeURIComponent(oi);Lt===oi&&(Lt=escape(oi)),ei=ei.split(oi).join(Lt)}}var ii=ei.indexOf("#");ii!==-1&&(this.hash=ei.substr(ii),ei=ei.slice(0,ii));var gi=ei.indexOf("?");if(gi!==-1?(this.search=ei.substr(gi),this.query=ei.substr(gi+1),Dt&&(this.query=_e.parse(this.query)),ei=ei.slice(0,gi)):Dt&&(this.search="",this.query={}),ei&&(this.pathname=ei),Oe[ri]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var si=this.pathname||"",fi=this.search||"";this.path=si+fi}return this.href=this.format(),this};function $e(Ve){return $.isString(Ve)&&(Ve=At(Ve)),Ve instanceof re?Ve.format():re.prototype.format.call(Ve)}re.prototype.format=function(){var Ve=this.auth||"";Ve&&(Ve=encodeURIComponent(Ve),Ve=Ve.replace(/%3A/i,":"),Ve+="@");var Dt=this.protocol||"",qe=this.pathname||"",kt=this.hash||"",jt=!1,Pt="";this.host?jt=Ve+this.host:this.hostname&&(jt=Ve+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(jt+=":"+this.port)),this.query&&$.isObject(this.query)&&Object.keys(this.query).length&&(Pt=_e.stringify(this.query));var ti=this.search||Pt&&"?"+Pt||"";return Dt&&Dt.substr(-1)!==":"&&(Dt+=":"),this.slashes||(!Dt||Oe[Dt])&&jt!==!1?(jt="//"+(jt||""),qe&&qe.charAt(0)!=="/"&&(qe="/"+qe)):jt||(jt=""),kt&&kt.charAt(0)!=="#"&&(kt="#"+kt),ti&&ti.charAt(0)!=="?"&&(ti="?"+ti),qe=qe.replace(/[?#]/g,function(ei){return encodeURIComponent(ei)}),ti=ti.replace("#","%23"),Dt+jt+qe+ti+kt};function Fe(Ve,Dt){return At(Ve,!1,!0).resolve(Dt)}re.prototype.resolve=function(Ve){return this.resolveObject(At(Ve,!1,!0)).format()};function Ue(Ve,Dt){return Ve?At(Ve,!1,!0).resolveObject(Dt):Dt}re.prototype.resolveObject=function(Ve){if($.isString(Ve)){var Dt=new re;Dt.parse(Ve,!1,!0),Ve=Dt}for(var qe=new re,kt=Object.keys(this),jt=0;jt<kt.length;jt++){var Pt=kt[jt];qe[Pt]=this[Pt]}if(qe.hash=Ve.hash,Ve.href==="")return qe.href=qe.format(),qe;if(Ve.slashes&&!Ve.protocol){for(var ti=Object.keys(Ve),ei=0;ei<ti.length;ei++){var Et=ti[ei];Et!=="protocol"&&(qe[Et]=Ve[Et])}return Oe[qe.protocol]&&qe.hostname&&!qe.pathname&&(qe.path=qe.pathname="/"),qe.href=qe.format(),qe}if(Ve.protocol&&Ve.protocol!==qe.protocol){if(!Oe[Ve.protocol]){for(var ni=Object.keys(Ve),ri=0;ri<ni.length;ri++){var Ii=ni[ri];qe[Ii]=Ve[Ii]}return qe.href=qe.format(),qe}if(qe.protocol=Ve.protocol,!Ve.host&&!xe[Ve.protocol]){for(var ui=(Ve.pathname||"").split("/");ui.length&&!(Ve.host=ui.shift()););Ve.host||(Ve.host=""),Ve.hostname||(Ve.hostname=""),ui[0]!==""&&ui.unshift(""),ui.length<2&&ui.unshift(""),qe.pathname=ui.join("/")}else qe.pathname=Ve.pathname;if(qe.search=Ve.search,qe.query=Ve.query,qe.host=Ve.host||"",qe.auth=Ve.auth,qe.hostname=Ve.hostname||Ve.host,qe.port=Ve.port,qe.pathname||qe.search){var wi=qe.pathname||"",ai=qe.search||"";qe.path=wi+ai}return qe.slashes=qe.slashes||Ve.slashes,qe.href=qe.format(),qe}var di=qe.pathname&&qe.pathname.charAt(0)==="/",hi=Ve.host||Ve.pathname&&Ve.pathname.charAt(0)==="/",ci=hi||di||qe.host&&Ve.pathname,Ai=ci,yi=qe.pathname&&qe.pathname.split("/")||[],ui=Ve.pathname&&Ve.pathname.split("/")||[],Ci=qe.protocol&&!Oe[qe.protocol];if(Ci&&(qe.hostname="",qe.port=null,qe.host&&(yi[0]===""?yi[0]=qe.host:yi.unshift(qe.host)),qe.host="",Ve.protocol&&(Ve.hostname=null,Ve.port=null,Ve.host&&(ui[0]===""?ui[0]=Ve.host:ui.unshift(Ve.host)),Ve.host=null),ci=ci&&(ui[0]===""||yi[0]==="")),hi)qe.host=Ve.host||Ve.host===""?Ve.host:qe.host,qe.hostname=Ve.hostname||Ve.hostname===""?Ve.hostname:qe.hostname,qe.search=Ve.search,qe.query=Ve.query,yi=ui;else if(ui.length)yi||(yi=[]),yi.pop(),yi=yi.concat(ui),qe.search=Ve.search,qe.query=Ve.query;else if(!$.isNullOrUndefined(Ve.search)){if(Ci){qe.hostname=qe.host=yi.shift();var zi=qe.host&&qe.host.indexOf("@")>0?qe.host.split("@"):!1;zi&&(qe.auth=zi.shift(),qe.host=qe.hostname=zi.shift())}return qe.search=Ve.search,qe.query=Ve.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||Ve.host||yi.length>1)&&(Mi==="."||Mi==="..")||Mi==="",mi=0,vi=yi.length;vi>=0;vi--)Mi=yi[vi],Mi==="."?yi.splice(vi,1):Mi===".."?(yi.splice(vi,1),mi++):mi&&(yi.splice(vi,1),mi--);if(!ci&&!Ai)for(;mi--;mi)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(Ci){qe.hostname=qe.host=bi?"":yi.length?yi.shift():"";var zi=qe.host&&qe.host.indexOf("@")>0?qe.host.split("@"):!1;zi&&(qe.auth=zi.shift(),qe.host=qe.hostname=zi.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=Ve.auth||qe.auth,qe.slashes=qe.slashes||Ve.slashes,qe.href=qe.format(),qe},re.prototype.parseHost=function(){var Ve=this.host,Dt=Ce.exec(Ve);Dt&&(Dt=Dt[0],Dt!==":"&&(this.port=Dt.substr(1)),Ve=Ve.substr(0,Ve.length-Dt.length)),Ve&&(this.hostname=Ve)}},{"./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 $(oe,Ce){if(re("noDeprecation"))return oe;var ie=!1;function ae(){if(!ie){if(re("throwDeprecation"))throw new Error(Ce);re("traceDeprecation")?console.trace(Ce):console.warn(Ce),ie=!0}return oe.apply(this,arguments)}return ae}function re(oe){try{if(!k.localStorage)return!1}catch{return!1}var Ce=k.localStorage[oe];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($,re){if($&&re)return k($)(re);if(typeof $!="function")throw new TypeError("need wrapper function");return Object.keys($).forEach(function(Ce){oe[Ce]=$[Ce]}),oe;function oe(){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 re={},oe=0;oe<arguments.length;oe++){var Ce=arguments[oe];for(var ie in Ce)k.call(Ce,ie)&&(re[ie]=Ce[ie])}return re}},{}],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++)re(this,arguments[ie]);return this.length},k.prototype.unshift=function(){for(var ie=0,ae=arguments.length;ie<ae;ie++)oe(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 re(ie,ae){ie.tail=new Ce(ae,ie.tail,null,ie),ie.head||(ie.head=ie.tail),ie.length++}function oe(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:"svg-viewer",props:{data:{},canvasDrag:{type:Boolean,default:!0}},emits:["onMessage"],setup(i,{expose:n,emit:r}){const g=i;vue.useCssVars(pe=>({cdcd61c4:vue.unref(re)}));const V=vue.getCurrentInstance();Object.keys(vueComp).forEach(pe=>{var ze;Object.keys((ze=V==null?void 0:V.appContext)==null?void 0:ze.components).includes(pe)||V==null||V.appContext.app.component(pe,vueComp[pe])});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),re=vue.computed(()=>$.intention==EGlobalStoreIntention.MoveCanvas?"grab":"default"),oe=pe=>{if($.mouse_info.state!=EMouseInfoState.Down&&$.intention!==EGlobalStoreIntention.Connection||!g.canvasDrag)return;const{clientX:ze,clientY:xe}=pe;$.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+xe-$.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=pe=>{const{clientX:ze,clientY:xe}=pe;$.intention=EGlobalStoreIntention.MoveCanvas,$.mouse_info={state:EMouseInfoState.Down,position_x:ze,position_y:xe,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(pe){pe!=null&&pe.wheelDelta&&(pe.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=(pe,ze,xe)=>({x:pe.x-pe.width/2*ze+pe.width/2,y:pe.y-pe.height/2*xe+pe.height/2,width:pe.width*ze,height:pe.height*xe}),Ie=(pe,ze,xe)=>setArrItemByID(pe,ze,xe,k.done_json),ue=pe=>{var xe;let ze=!1;if(((xe=pe.events)==null?void 0:xe.length)>0){for(let Oe of pe.events)if(Oe.type===EEventType.Click){ze=!0;break}}return{cursor:ze?"pointer":"default"}},de=(pe,ze)=>{var xe;if(((xe=pe.events)==null?void 0:xe.length)>0){for(let Oe of pe.events)if(Oe.type===ze){if(Oe.condition&&Oe.condition.type!=="None"&&Oe.condition.type==="Relation"&&Oe.condition.Relation&&Oe.condition.Relation.relation){const _e=Oe.condition.Relation.key,At=Oe.condition.Relation.relation,$e=valFormat(Oe.condition.Relation.val),Fe=valFormat(Oe.condition.Relation.val2);if(pe.props.hasOwnProperty(_e)){const Ue=pe.props[_e].val;if(!Ne(Ue,At,$e,Fe))continue}}if(Oe.action===EEventAction.ChangeAttr){if(Oe.attrs&&Oe.attrs.length>0){let _e;if(Oe.target){for(let At of $.done_json)if(At.id===Oe.target){_e=At;break}}else _e=pe;if(!_e)continue;console.log(_e,Oe);for(let At of Oe.attrs)_e.state&&_e.state.hasOwnProperty(At.key)?_e.state[At.key].default=valFormat(At.val):_e.props.hasOwnProperty(At.key)&&(_e.props[At.key].val=valFormat(At.val))}}else Oe.action===EEventAction.JavaScript&&new Function(Oe.scripts)()}}},Ne=(pe,ze,xe,Oe)=>{switch(ze){case">":return pe>xe;case">=":return pe>=xe;case"<":return pe<xe;case"<=":return pe<=xe;case"==":return pe==xe;case"!=":return pe!=xe;case">=,=<":return pe>=xe&&pe<=Oe;case"<,>":return pe<xe||pe>Oe}};vue.onMounted(()=>{he()}),vue.onBeforeUnmount(close);const he=()=>{const pe=k.config.net.mqtt;pe&&pe.url&&pe.user&&pe.pwd&&pe.topics&&sub(pe.url,pe.user,pe.pwd,pe.topics,(ze,xe)=>{console.log(ze),console.log(xe.toString()),r("onMessage",{topics:ze,message:xe})})};return n({setNodeAttrByID:Ie}),(pe,ze)=>(vue.openBlock(),vue.createElementBlock("div",{class:"canvas",onMousedown:ie,onMousemove:oe,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,xe=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:xe.id,transform:`translate(${xe.x},${xe.y})rotate(0)scale(1)`,style:vue.normalizeStyle(ue(xe)),onClick:Oe=>de(xe,vue.unref(EEventType).Click)},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(xe)}`)},[vue.createElementVNode("g",{transform:`translate(${xe.actual_bound.x+xe.actual_bound.width/2},${xe.actual_bound.y+xe.actual_bound.height/2})rotate(${xe.rotate}) scale(1) translate(${-(xe.actual_bound.x+xe.actual_bound.width/2)},${-(xe.actual_bound.y+xe.actual_bound.height/2)})`},[xe.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$e,{key:0,"item-info":xe},null,8,["item-info"])):xe.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${xe.name}`},vue.unref(prosToVBind)(xe),{width:"100",height:"100",id:xe.id,transform:`translate(${xe.actual_bound.x+xe.actual_bound.width/2},${xe.actual_bound.y+xe.actual_bound.height/2}) scale(${xe.scale_x},${xe.scale_y}) translate(${-(xe.actual_bound.x+xe.actual_bound.width/2)},${-(xe.actual_bound.y+xe.actual_bound.height/2)})`}),null,16,_hoisted_4)):xe.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(xe.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(xe),{width:"100",height:"100",id:xe.id,onOnChange:Oe=>de(xe,vue.unref(EEventType).Change),transform:`translate(${xe.actual_bound.x+xe.actual_bound.width/2},${xe.actual_bound.y+xe.actual_bound.height/2}) scale(${xe.scale_x},${xe.scale_y}) translate(${-(xe.actual_bound.x+xe.actual_bound.width/2)},${-(xe.actual_bound.y+xe.actual_bound.height/2)})`}),null,16,["id","onOnChange","transform"])):xe.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},le(xe.actual_bound,xe.scale_x,xe.scale_y),{id:`foreign-object${xe.id}`}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(xe.tag),vue.mergeProps(vue.unref(prosToVBind)(xe),{id:xe.id,onOnChange:Oe=>de(xe,vue.unref(EEventType).Change),transform:`translate(${xe.actual_bound.x+xe.actual_bound.width/2},${xe.actual_bound.y+xe.actual_bound.height/2}) scale(${xe.scale_x},${xe.scale_y}) translate(${-(xe.actual_bound.x+xe.actual_bound.width/2)},${-(xe.actual_bound.y+xe.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(xe.tag_slot),1)]),_:2},1040,["id","onOnChange","transform"]))],16,_hoisted_5)):vue.createCommentVNode("",!0)],8,_hoisted_3)],2)],12,_hoisted_2)),[[vue.vShow,xe.display]])),128))],8,_hoisted_1)],4))],32))}}),svgViewer_vue_vue_type_style_index_0_scoped_a34ab3c3_lang="",svgViewer=_export_sfc(_sfc_main,[["__scopeId","data-v-a34ab3c3"]]);exports.SvgEditor=index,exports.SvgViewer=svgViewer,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
1264
+ `," "],le=["{","}","|","\\","^","`"].concat(ae),Ie=["'"].concat(le),ue=["%","/","?",";","#"].concat(Ie),de=["/","?","#"],Ne=255,he=/^[+a-z0-9A-Z_-]{0,63}$/,pe=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ze={javascript:!0,"javascript:":!0},xe={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(Ve,Dt,qe){if(Ve&&$.isObject(Ve)&&Ve instanceof re)return Ve;var kt=new re;return kt.parse(Ve,Dt,qe),kt}re.prototype.parse=function(Ve,Dt,qe){if(!$.isString(Ve))throw new TypeError("Parameter 'url' must be a string, not "+typeof Ve);var kt=Ve.indexOf("?"),jt=kt!==-1&&kt<Ve.indexOf("#")?"?":"#",Pt=Ve.split(jt),ti=/\\/g;Pt[0]=Pt[0].replace(ti,"/"),Ve=Pt.join(jt);var ei=Ve;if(ei=ei.trim(),!qe&&Ve.split("#").length===1){var Et=ie.exec(ei);if(Et)return this.path=ei,this.href=ei,this.pathname=Et[1],Et[2]?(this.search=Et[2],Dt?this.query=_e.parse(this.search.substr(1)):this.query=this.search.substr(1)):Dt&&(this.search="",this.query={}),this}var ni=oe.exec(ei);if(ni){ni=ni[0];var ri=ni.toLowerCase();this.protocol=ri,ei=ei.substr(ni.length)}if(qe||ni||ei.match(/^\/\/[^@\/]+@[^@\/]+/)){var Ii=ei.substr(0,2)==="//";Ii&&!(ni&&xe[ni])&&(ei=ei.substr(2),this.slashes=!0)}if(!xe[ni]&&(Ii||ni&&!Oe[ni])){for(var wi=-1,ai=0;ai<de.length;ai++){var di=ei.indexOf(de[ai]);di!==-1&&(wi===-1||di<wi)&&(wi=di)}var hi,ci;wi===-1?ci=ei.lastIndexOf("@"):ci=ei.lastIndexOf("@",wi),ci!==-1&&(hi=ei.slice(0,ci),ei=ei.slice(ci+1),this.auth=decodeURIComponent(hi)),wi=-1;for(var ai=0;ai<ue.length;ai++){var di=ei.indexOf(ue[ai]);di!==-1&&(wi===-1||di<wi)&&(wi=di)}wi===-1&&(wi=ei.length),this.host=ei.slice(0,wi),ei=ei.slice(wi),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(/\./),ai=0,ui=yi.length;ai<ui;ai++){var Ci=yi[ai];if(Ci&&!Ci.match(he)){for(var zi="",Mi=0,Ni=Ci.length;Mi<Ni;Mi++)Ci.charCodeAt(Mi)>127?zi+="x":zi+=Ci[Mi];if(!zi.match(he)){var mi=yi.slice(0,ai),vi=yi.slice(ai+1),bi=Ci.match(pe);bi&&(mi.push(bi[1]),vi.unshift(bi[2])),vi.length&&(ei="/"+vi.join(".")+ei),this.hostname=mi.join(".");break}}}this.hostname.length>Ne?this.hostname="":this.hostname=this.hostname.toLowerCase(),Ai||(this.hostname=k.toASCII(this.hostname));var si=this.port?":"+this.port:"",li=this.hostname||"";this.host=li+si,this.href+=this.host,Ai&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),ei[0]!=="/"&&(ei="/"+ei))}if(!ze[ri])for(var ai=0,ui=Ie.length;ai<ui;ai++){var oi=Ie[ai];if(ei.indexOf(oi)!==-1){var Lt=encodeURIComponent(oi);Lt===oi&&(Lt=escape(oi)),ei=ei.split(oi).join(Lt)}}var ii=ei.indexOf("#");ii!==-1&&(this.hash=ei.substr(ii),ei=ei.slice(0,ii));var gi=ei.indexOf("?");if(gi!==-1?(this.search=ei.substr(gi),this.query=ei.substr(gi+1),Dt&&(this.query=_e.parse(this.query)),ei=ei.slice(0,gi)):Dt&&(this.search="",this.query={}),ei&&(this.pathname=ei),Oe[ri]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var si=this.pathname||"",fi=this.search||"";this.path=si+fi}return this.href=this.format(),this};function $e(Ve){return $.isString(Ve)&&(Ve=At(Ve)),Ve instanceof re?Ve.format():re.prototype.format.call(Ve)}re.prototype.format=function(){var Ve=this.auth||"";Ve&&(Ve=encodeURIComponent(Ve),Ve=Ve.replace(/%3A/i,":"),Ve+="@");var Dt=this.protocol||"",qe=this.pathname||"",kt=this.hash||"",jt=!1,Pt="";this.host?jt=Ve+this.host:this.hostname&&(jt=Ve+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(jt+=":"+this.port)),this.query&&$.isObject(this.query)&&Object.keys(this.query).length&&(Pt=_e.stringify(this.query));var ti=this.search||Pt&&"?"+Pt||"";return Dt&&Dt.substr(-1)!==":"&&(Dt+=":"),this.slashes||(!Dt||Oe[Dt])&&jt!==!1?(jt="//"+(jt||""),qe&&qe.charAt(0)!=="/"&&(qe="/"+qe)):jt||(jt=""),kt&&kt.charAt(0)!=="#"&&(kt="#"+kt),ti&&ti.charAt(0)!=="?"&&(ti="?"+ti),qe=qe.replace(/[?#]/g,function(ei){return encodeURIComponent(ei)}),ti=ti.replace("#","%23"),Dt+jt+qe+ti+kt};function Fe(Ve,Dt){return At(Ve,!1,!0).resolve(Dt)}re.prototype.resolve=function(Ve){return this.resolveObject(At(Ve,!1,!0)).format()};function Ue(Ve,Dt){return Ve?At(Ve,!1,!0).resolveObject(Dt):Dt}re.prototype.resolveObject=function(Ve){if($.isString(Ve)){var Dt=new re;Dt.parse(Ve,!1,!0),Ve=Dt}for(var qe=new re,kt=Object.keys(this),jt=0;jt<kt.length;jt++){var Pt=kt[jt];qe[Pt]=this[Pt]}if(qe.hash=Ve.hash,Ve.href==="")return qe.href=qe.format(),qe;if(Ve.slashes&&!Ve.protocol){for(var ti=Object.keys(Ve),ei=0;ei<ti.length;ei++){var Et=ti[ei];Et!=="protocol"&&(qe[Et]=Ve[Et])}return Oe[qe.protocol]&&qe.hostname&&!qe.pathname&&(qe.path=qe.pathname="/"),qe.href=qe.format(),qe}if(Ve.protocol&&Ve.protocol!==qe.protocol){if(!Oe[Ve.protocol]){for(var ni=Object.keys(Ve),ri=0;ri<ni.length;ri++){var Ii=ni[ri];qe[Ii]=Ve[Ii]}return qe.href=qe.format(),qe}if(qe.protocol=Ve.protocol,!Ve.host&&!xe[Ve.protocol]){for(var ui=(Ve.pathname||"").split("/");ui.length&&!(Ve.host=ui.shift()););Ve.host||(Ve.host=""),Ve.hostname||(Ve.hostname=""),ui[0]!==""&&ui.unshift(""),ui.length<2&&ui.unshift(""),qe.pathname=ui.join("/")}else qe.pathname=Ve.pathname;if(qe.search=Ve.search,qe.query=Ve.query,qe.host=Ve.host||"",qe.auth=Ve.auth,qe.hostname=Ve.hostname||Ve.host,qe.port=Ve.port,qe.pathname||qe.search){var wi=qe.pathname||"",ai=qe.search||"";qe.path=wi+ai}return qe.slashes=qe.slashes||Ve.slashes,qe.href=qe.format(),qe}var di=qe.pathname&&qe.pathname.charAt(0)==="/",hi=Ve.host||Ve.pathname&&Ve.pathname.charAt(0)==="/",ci=hi||di||qe.host&&Ve.pathname,Ai=ci,yi=qe.pathname&&qe.pathname.split("/")||[],ui=Ve.pathname&&Ve.pathname.split("/")||[],Ci=qe.protocol&&!Oe[qe.protocol];if(Ci&&(qe.hostname="",qe.port=null,qe.host&&(yi[0]===""?yi[0]=qe.host:yi.unshift(qe.host)),qe.host="",Ve.protocol&&(Ve.hostname=null,Ve.port=null,Ve.host&&(ui[0]===""?ui[0]=Ve.host:ui.unshift(Ve.host)),Ve.host=null),ci=ci&&(ui[0]===""||yi[0]==="")),hi)qe.host=Ve.host||Ve.host===""?Ve.host:qe.host,qe.hostname=Ve.hostname||Ve.hostname===""?Ve.hostname:qe.hostname,qe.search=Ve.search,qe.query=Ve.query,yi=ui;else if(ui.length)yi||(yi=[]),yi.pop(),yi=yi.concat(ui),qe.search=Ve.search,qe.query=Ve.query;else if(!$.isNullOrUndefined(Ve.search)){if(Ci){qe.hostname=qe.host=yi.shift();var zi=qe.host&&qe.host.indexOf("@")>0?qe.host.split("@"):!1;zi&&(qe.auth=zi.shift(),qe.host=qe.hostname=zi.shift())}return qe.search=Ve.search,qe.query=Ve.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||Ve.host||yi.length>1)&&(Mi==="."||Mi==="..")||Mi==="",mi=0,vi=yi.length;vi>=0;vi--)Mi=yi[vi],Mi==="."?yi.splice(vi,1):Mi===".."?(yi.splice(vi,1),mi++):mi&&(yi.splice(vi,1),mi--);if(!ci&&!Ai)for(;mi--;mi)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(Ci){qe.hostname=qe.host=bi?"":yi.length?yi.shift():"";var zi=qe.host&&qe.host.indexOf("@")>0?qe.host.split("@"):!1;zi&&(qe.auth=zi.shift(),qe.host=qe.hostname=zi.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=Ve.auth||qe.auth,qe.slashes=qe.slashes||Ve.slashes,qe.href=qe.format(),qe},re.prototype.parseHost=function(){var Ve=this.host,Dt=Ce.exec(Ve);Dt&&(Dt=Dt[0],Dt!==":"&&(this.port=Dt.substr(1)),Ve=Ve.substr(0,Ve.length-Dt.length)),Ve&&(this.hostname=Ve)}},{"./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 $(oe,Ce){if(re("noDeprecation"))return oe;var ie=!1;function ae(){if(!ie){if(re("throwDeprecation"))throw new Error(Ce);re("traceDeprecation")?console.trace(Ce):console.warn(Ce),ie=!0}return oe.apply(this,arguments)}return ae}function re(oe){try{if(!k.localStorage)return!1}catch{return!1}var Ce=k.localStorage[oe];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($,re){if($&&re)return k($)(re);if(typeof $!="function")throw new TypeError("need wrapper function");return Object.keys($).forEach(function(Ce){oe[Ce]=$[Ce]}),oe;function oe(){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 re={},oe=0;oe<arguments.length;oe++){var Ce=arguments[oe];for(var ie in Ce)k.call(Ce,ie)&&(re[ie]=Ce[ie])}return re}},{}],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++)re(this,arguments[ie]);return this.length},k.prototype.unshift=function(){for(var ie=0,ae=arguments.length;ie<ae;ie++)oe(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 re(ie,ae){ie.tail=new Ce(ae,ie.tail,null,ie),ie.head||(ie.head=ie.tail),ie.length++}function oe(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:"svg-viewer",props:{data:{},canvasDrag:{type:Boolean,default:!0}},emits:["onMessage"],setup(i,{expose:n,emit:r}){const g=i;vue.useCssVars(pe=>({"62dc10d1":vue.unref(re)}));const V=vue.getCurrentInstance();Object.keys(vueComp).forEach(pe=>{var ze;Object.keys((ze=V==null?void 0:V.appContext)==null?void 0:ze.components).includes(pe)||V==null||V.appContext.app.component(pe,vueComp[pe])});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),re=vue.computed(()=>$.intention==EGlobalStoreIntention.MoveCanvas?"grab":"default"),oe=pe=>{if($.mouse_info.state!=EMouseInfoState.Down&&$.intention!==EGlobalStoreIntention.Connection||!g.canvasDrag)return;const{clientX:ze,clientY:xe}=pe;$.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+xe-$.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=pe=>{const{clientX:ze,clientY:xe}=pe;$.intention=EGlobalStoreIntention.MoveCanvas,$.mouse_info={state:EMouseInfoState.Down,position_x:ze,position_y:xe,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(pe){pe!=null&&pe.wheelDelta&&(pe.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=(pe,ze,xe)=>({x:pe.x-pe.width/2*ze+pe.width/2,y:pe.y-pe.height/2*xe+pe.height/2,width:pe.width*ze,height:pe.height*xe}),Ie=(pe,ze,xe)=>setArrItemByID(pe,ze,xe,k.done_json),ue=pe=>{var xe;let ze=!1;if(((xe=pe.events)==null?void 0:xe.length)>0){for(let Oe of pe.events)if(Oe.type===EEventType.Click){ze=!0;break}}return{cursor:ze?"pointer":"default"}},de=(pe,ze)=>{var xe;if(console.log(pe.events,ze),((xe=pe.events)==null?void 0:xe.length)>0){for(let Oe of pe.events)if(Oe.type===ze){if(Oe.condition&&Oe.condition.type!=="None"&&Oe.condition.type==="Relation"&&Oe.condition.Relation&&Oe.condition.Relation.relation){const _e=Oe.condition.Relation.key,At=Oe.condition.Relation.relation,$e=valFormat(Oe.condition.Relation.val),Fe=valFormat(Oe.condition.Relation.val2);if(pe.props.hasOwnProperty(_e)){const Ue=pe.props[_e].val;if(!Ne(Ue,At,$e,Fe))continue}}if(Oe.action===EEventAction.ChangeAttr){if(Oe.attrs&&Oe.attrs.length>0){let _e;if(Oe.target){for(let At of k.done_json)if(At.id===Oe.target){_e=At;break}}else _e=pe;if(!_e)continue;for(let At of Oe.attrs)At.key==="state"?_e.defaultState=valFormat(At.val):_e.props.hasOwnProperty(At.key)&&(_e.props[At.key].val=valFormat(At.val))}}else Oe.action===EEventAction.JavaScript&&new Function(Oe.scripts)()}}},Ne=(pe,ze,xe,Oe)=>{switch(ze){case">":return pe>xe;case">=":return pe>=xe;case"<":return pe<xe;case"<=":return pe<=xe;case"==":return pe==xe;case"!=":return pe!=xe;case">=,=<":return pe>=xe&&pe<=Oe;case"<,>":return pe<xe||pe>Oe}};vue.onMounted(()=>{he()}),vue.onBeforeUnmount(close);const he=()=>{const pe=k.config.net.mqtt;pe&&pe.url&&pe.user&&pe.pwd&&pe.topics&&sub(pe.url,pe.user,pe.pwd,pe.topics,(ze,xe)=>{console.log(ze),console.log(xe.toString()),r("onMessage",{topics:ze,message:xe})})};return n({setNodeAttrByID:Ie}),(pe,ze)=>(vue.openBlock(),vue.createElementBlock("div",{class:"canvas",onMousedown:ie,onMousemove:oe,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,xe=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:xe.id,transform:`translate(${xe.x},${xe.y})rotate(0)scale(1)`,style:vue.normalizeStyle(ue(xe)),onClick:Oe=>de(xe,vue.unref(EEventType).Click)},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(xe)}`)},[vue.createElementVNode("g",{transform:`translate(${xe.actual_bound.x+xe.actual_bound.width/2},${xe.actual_bound.y+xe.actual_bound.height/2})rotate(${xe.rotate}) scale(1) translate(${-(xe.actual_bound.x+xe.actual_bound.width/2)},${-(xe.actual_bound.y+xe.actual_bound.height/2)})`},[xe.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$e,{key:0,"item-info":xe},null,8,["item-info"])):xe.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${xe.name}`},vue.unref(prosToVBind)(xe),{width:"100",height:"100",id:xe.id,transform:`translate(${xe.actual_bound.x+xe.actual_bound.width/2},${xe.actual_bound.y+xe.actual_bound.height/2}) scale(${xe.scale_x},${xe.scale_y}) translate(${-(xe.actual_bound.x+xe.actual_bound.width/2)},${-(xe.actual_bound.y+xe.actual_bound.height/2)})`}),null,16,_hoisted_4)):xe.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(xe.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(xe),{width:"100",height:"100",id:xe.id,onOnChange:Oe=>de(xe,vue.unref(EEventType).Change),transform:`translate(${xe.actual_bound.x+xe.actual_bound.width/2},${xe.actual_bound.y+xe.actual_bound.height/2}) scale(${xe.scale_x},${xe.scale_y}) translate(${-(xe.actual_bound.x+xe.actual_bound.width/2)},${-(xe.actual_bound.y+xe.actual_bound.height/2)})`}),null,16,["id","onOnChange","transform"])):xe.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},le(xe.actual_bound,xe.scale_x,xe.scale_y),{id:`foreign-object${xe.id}`}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(xe.tag),vue.mergeProps(vue.unref(prosToVBind)(xe),{id:xe.id,onOnChange:Oe=>de(xe,vue.unref(EEventType).Change),transform:`translate(${xe.actual_bound.x+xe.actual_bound.width/2},${xe.actual_bound.y+xe.actual_bound.height/2}) scale(${xe.scale_x},${xe.scale_y}) translate(${-(xe.actual_bound.x+xe.actual_bound.width/2)},${-(xe.actual_bound.y+xe.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(xe.tag_slot),1)]),_:2},1040,["id","onOnChange","transform"]))],16,_hoisted_5)):vue.createCommentVNode("",!0)],8,_hoisted_3)],2)],12,_hoisted_2)),[[vue.vShow,xe.display]])),128))],8,_hoisted_1)],4))],32))}}),svgViewer_vue_vue_type_style_index_0_scoped_afb9c18a_lang="",svgViewer=_export_sfc(_sfc_main,[["__scopeId","data-v-afb9c18a"]]);exports.SvgEditor=index,exports.SvgViewer=svgViewer,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});