@zhangqingcq/vgce 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
package/dist/vgce.umd.cjs CHANGED
@@ -274,4 +274,4 @@ usage: app.provide(ID_INJECTION_KEY, {
274
274
  top:0 !important;
275
275
  right:0 !important;
276
276
  `,CONTEXT_STYLE=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing"];function calculateNodeStyling(r){const n=window.getComputedStyle(r),i=n.getPropertyValue("box-sizing"),o=Number.parseFloat(n.getPropertyValue("padding-bottom"))+Number.parseFloat(n.getPropertyValue("padding-top")),a=Number.parseFloat(n.getPropertyValue("border-bottom-width"))+Number.parseFloat(n.getPropertyValue("border-top-width"));return{contextStyle:CONTEXT_STYLE.map(c=>`${c}:${n.getPropertyValue(c)}`).join(";"),paddingSize:o,borderSize:a,boxSizing:i}}function calcTextareaHeight(r,n=1,i){var o;hiddenTextarea||(hiddenTextarea=document.createElement("textarea"),document.body.appendChild(hiddenTextarea));const{paddingSize:a,borderSize:u,boxSizing:c,contextStyle:f}=calculateNodeStyling(r);hiddenTextarea.setAttribute("style",`${f};${HIDDEN_STYLE}`),hiddenTextarea.value=r.value||r.placeholder||"";let d=hiddenTextarea.scrollHeight;const p={};c==="border-box"?d=d+u:c==="content-box"&&(d=d-a),hiddenTextarea.value="";const h=hiddenTextarea.scrollHeight-a;if(isNumber(n)){let g=h*n;c==="border-box"&&(g=g+a+u),d=Math.max(g,d),p.minHeight=`${g}px`}if(isNumber(i)){let g=h*i;c==="border-box"&&(g=g+a+u),d=Math.min(g,d)}return p.height=`${d}px`,(o=hiddenTextarea.parentNode)==null||o.removeChild(hiddenTextarea),hiddenTextarea=void 0,p}const inputProps=buildProps({id:{type:String,default:void 0},size:useSizeProp,disabled:Boolean,modelValue:{type:definePropType([String,Number,Object]),default:""},type:{type:String,default:"text"},resize:{type:String,values:["none","both","horizontal","vertical"]},autosize:{type:definePropType([Boolean,Object]),default:!1},autocomplete:{type:String,default:"off"},formatter:{type:Function},parser:{type:Function},placeholder:{type:String},form:{type:String},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},showPassword:{type:Boolean,default:!1},showWordLimit:{type:Boolean,default:!1},suffixIcon:{type:iconPropType},prefixIcon:{type:iconPropType},containerRole:{type:String,default:void 0},label:{type:String,default:void 0},tabindex:{type:[String,Number],default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:definePropType([Object,Array,String]),default:()=>mutable({})}}),inputEmits={[UPDATE_MODEL_EVENT]:r=>isString(r),input:r=>isString(r),change:r=>isString(r),focus:r=>r instanceof FocusEvent,blur:r=>r instanceof FocusEvent,clear:()=>!0,mouseleave:r=>r instanceof MouseEvent,mouseenter:r=>r instanceof MouseEvent,keydown:r=>r instanceof Event,compositionstart:r=>r instanceof CompositionEvent,compositionupdate:r=>r instanceof CompositionEvent,compositionend:r=>r instanceof CompositionEvent},_hoisted_1$7=["role"],_hoisted_2$5=["id","type","disabled","formatter","parser","readonly","autocomplete","tabindex","aria-label","placeholder","form"],_hoisted_3$4=["id","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form"],__default__$9=vue.defineComponent({name:"ElInput",inheritAttrs:!1}),_sfc_main$o=vue.defineComponent({...__default__$9,props:inputProps,emits:inputEmits,setup(r,{expose:n,emit:i}){const o=r,a=vue.useAttrs(),u=vue.useSlots(),c=vue.computed(()=>{const qe={};return o.containerRole==="combobox"&&(qe["aria-haspopup"]=a["aria-haspopup"],qe["aria-owns"]=a["aria-owns"],qe["aria-expanded"]=a["aria-expanded"]),qe}),f=vue.computed(()=>[o.type==="textarea"?S.b():_.b(),_.m(y.value),_.is("disabled",A.value),_.is("exceed",Fe.value),{[_.b("group")]:u.prepend||u.append,[_.bm("group","append")]:u.append,[_.bm("group","prepend")]:u.prepend,[_.m("prefix")]:u.prefix||o.prefixIcon,[_.m("suffix")]:u.suffix||o.suffixIcon||o.clearable||o.showPassword,[_.bm("suffix","password-clear")]:Ie.value&&Oe.value},a.class]),d=vue.computed(()=>[_.e("wrapper"),_.is("focus",oe.value)]),p=useAttrs({excludeKeys:vue.computed(()=>Object.keys(c.value))}),{form:h,formItem:g}=useFormItem(),{inputId:v}=useFormItemInputId(o,{formItemContext:g}),y=useFormSize(),A=useFormDisabled(),_=useNamespace("input"),S=useNamespace("textarea"),b=vue.shallowRef(),T=vue.shallowRef(),w=vue.ref(!1),x=vue.ref(!1),k=vue.ref(!1),M=vue.ref(),D=vue.shallowRef(o.inputStyle),z=vue.computed(()=>b.value||T.value),{wrapperRef:j,isFocused:oe,handleFocus:L,handleBlur:F}=useFocusController(z,{afterBlur(){var qe;o.validateEvent&&((qe=g==null?void 0:g.validate)==null||qe.call(g,"blur").catch(jt=>debugWarn(jt)))}}),O=vue.computed(()=>{var qe;return(qe=h==null?void 0:h.statusIcon)!=null?qe:!1}),ue=vue.computed(()=>(g==null?void 0:g.validateState)||""),_e=vue.computed(()=>ue.value&&ValidateComponentsMap[ue.value]),Ce=vue.computed(()=>k.value?view_default:hide_default),de=vue.computed(()=>[a.style,o.inputStyle]),ie=vue.computed(()=>[o.inputStyle,D.value,{resize:o.resize}]),Y=vue.computed(()=>lodashEs.isNil(o.modelValue)?"":String(o.modelValue)),Ie=vue.computed(()=>o.clearable&&!A.value&&!o.readonly&&!!Y.value&&(oe.value||w.value)),Oe=vue.computed(()=>o.showPassword&&!A.value&&!o.readonly&&!!Y.value&&(!!Y.value||oe.value)),kt=vue.computed(()=>o.showWordLimit&&!!p.value.maxlength&&(o.type==="text"||o.type==="textarea")&&!A.value&&!o.readonly&&!o.showPassword),Dt=vue.computed(()=>Y.value.length),Fe=vue.computed(()=>!!kt.value&&Dt.value>Number(p.value.maxlength)),$e=vue.computed(()=>!!u.suffix||!!o.suffixIcon||Ie.value||o.showPassword||kt.value||!!ue.value&&O.value),[Cn,Lt]=useCursor(b);useResizeObserver(T,qe=>{if(Ne(),!kt.value||o.resize!=="both")return;const jt=qe[0],{width:An}=jt.contentRect;M.value={right:`calc(100% - ${An+15+6}px)`}});const In=()=>{const{type:qe,autosize:jt}=o;if(!(!isClient||qe!=="textarea"||!T.value))if(jt){const An=isObject(jt)?jt.minRows:void 0,wn=isObject(jt)?jt.maxRows:void 0,En=calcTextareaHeight(T.value,An,wn);D.value={overflowY:"hidden",...En},vue.nextTick(()=>{T.value.offsetHeight,D.value=En})}else D.value={minHeight:calcTextareaHeight(T.value).minHeight}},Ne=(qe=>{let jt=!1;return()=>{var An;if(jt||!o.autosize)return;((An=T.value)==null?void 0:An.offsetParent)===null||(qe(),jt=!0)}})(In),pe=()=>{const qe=z.value,jt=o.formatter?o.formatter(Y.value):Y.value;!qe||qe.value===jt||(qe.value=jt)},At=async qe=>{Cn();let{value:jt}=qe.target;if(o.formatter&&(jt=o.parser?o.parser(jt):jt),!x.value){if(jt===Y.value){pe();return}i(UPDATE_MODEL_EVENT,jt),i("input",jt),await vue.nextTick(),pe(),Lt()}},Ve=qe=>{i("change",qe.target.value)},xe=qe=>{i("compositionstart",qe),x.value=!0},ze=qe=>{var jt;i("compositionupdate",qe);const An=(jt=qe.target)==null?void 0:jt.value,wn=An[An.length-1]||"";x.value=!isKorean(wn)},Pt=qe=>{i("compositionend",qe),x.value&&(x.value=!1,At(qe))},hn=()=>{k.value=!k.value,ae()},ae=async()=>{var qe;await vue.nextTick(),(qe=z.value)==null||qe.focus()},le=()=>{var qe;return(qe=z.value)==null?void 0:qe.blur()},re=qe=>{w.value=!1,i("mouseleave",qe)},V=qe=>{w.value=!0,i("mouseenter",qe)},$=qe=>{i("keydown",qe)},he=()=>{var qe;(qe=z.value)==null||qe.select()},Ue=()=>{i(UPDATE_MODEL_EVENT,""),i("change",""),i("clear"),i("input","")};return vue.watch(()=>o.modelValue,()=>{var qe;vue.nextTick(()=>In()),o.validateEvent&&((qe=g==null?void 0:g.validate)==null||qe.call(g,"change").catch(jt=>debugWarn(jt)))}),vue.watch(Y,()=>pe()),vue.watch(()=>o.type,async()=>{await vue.nextTick(),pe(),In()}),vue.onMounted(()=>{!o.formatter&&o.parser&&debugWarn("ElInput","If you set the parser, you also need to set the formatter."),pe(),vue.nextTick(In)}),n({input:b,textarea:T,ref:z,textareaStyle:ie,autosize:vue.toRef(o,"autosize"),focus:ae,blur:le,select:he,clear:Ue,resizeTextarea:In}),(qe,jt)=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("div",vue.mergeProps(vue.unref(c),{class:vue.unref(f),style:vue.unref(de),role:qe.containerRole,onMouseenter:V,onMouseleave:re}),[vue.createCommentVNode(" input "),qe.type!=="textarea"?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:0},[vue.createCommentVNode(" prepend slot "),qe.$slots.prepend?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:vue.normalizeClass(vue.unref(_).be("group","prepend"))},[vue.renderSlot(qe.$slots,"prepend")],2)):vue.createCommentVNode("v-if",!0),vue.createElementVNode("div",{ref_key:"wrapperRef",ref:j,class:vue.normalizeClass(vue.unref(d))},[vue.createCommentVNode(" prefix slot "),qe.$slots.prefix||qe.prefixIcon?(vue.openBlock(),vue.createElementBlock("span",{key:0,class:vue.normalizeClass(vue.unref(_).e("prefix"))},[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(_).e("prefix-inner"))},[vue.renderSlot(qe.$slots,"prefix"),qe.prefixIcon?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:0,class:vue.normalizeClass(vue.unref(_).e("icon"))},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(qe.prefixIcon)))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0)],2)],2)):vue.createCommentVNode("v-if",!0),vue.createElementVNode("input",vue.mergeProps({id:vue.unref(v),ref_key:"input",ref:b,class:vue.unref(_).e("inner")},vue.unref(p),{type:qe.showPassword?k.value?"text":"password":qe.type,disabled:vue.unref(A),formatter:qe.formatter,parser:qe.parser,readonly:qe.readonly,autocomplete:qe.autocomplete,tabindex:qe.tabindex,"aria-label":qe.label,placeholder:qe.placeholder,style:qe.inputStyle,form:o.form,onCompositionstart:xe,onCompositionupdate:ze,onCompositionend:Pt,onInput:At,onFocus:jt[0]||(jt[0]=(...An)=>vue.unref(L)&&vue.unref(L)(...An)),onBlur:jt[1]||(jt[1]=(...An)=>vue.unref(F)&&vue.unref(F)(...An)),onChange:Ve,onKeydown:$}),null,16,_hoisted_2$5),vue.createCommentVNode(" suffix slot "),vue.unref($e)?(vue.openBlock(),vue.createElementBlock("span",{key:1,class:vue.normalizeClass(vue.unref(_).e("suffix"))},[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(_).e("suffix-inner"))},[!vue.unref(Ie)||!vue.unref(Oe)||!vue.unref(kt)?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:0},[vue.renderSlot(qe.$slots,"suffix"),qe.suffixIcon?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:0,class:vue.normalizeClass(vue.unref(_).e("icon"))},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(qe.suffixIcon)))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0)],64)):vue.createCommentVNode("v-if",!0),vue.unref(Ie)?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:1,class:vue.normalizeClass([vue.unref(_).e("icon"),vue.unref(_).e("clear")]),onMousedown:vue.withModifiers(vue.unref(NOOP),["prevent"]),onClick:Ue},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(circle_close_default))]),_:1},8,["class","onMousedown"])):vue.createCommentVNode("v-if",!0),vue.unref(Oe)?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:2,class:vue.normalizeClass([vue.unref(_).e("icon"),vue.unref(_).e("password")]),onClick:hn},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(vue.unref(Ce))))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0),vue.unref(kt)?(vue.openBlock(),vue.createElementBlock("span",{key:3,class:vue.normalizeClass(vue.unref(_).e("count"))},[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(_).e("count-inner"))},vue.toDisplayString(vue.unref(Dt))+" / "+vue.toDisplayString(vue.unref(p).maxlength),3)],2)):vue.createCommentVNode("v-if",!0),vue.unref(ue)&&vue.unref(_e)&&vue.unref(O)?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:4,class:vue.normalizeClass([vue.unref(_).e("icon"),vue.unref(_).e("validateIcon"),vue.unref(_).is("loading",vue.unref(ue)==="validating")])},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(vue.unref(_e))))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0)],2)],2)):vue.createCommentVNode("v-if",!0)],2),vue.createCommentVNode(" append slot "),qe.$slots.append?(vue.openBlock(),vue.createElementBlock("div",{key:1,class:vue.normalizeClass(vue.unref(_).be("group","append"))},[vue.renderSlot(qe.$slots,"append")],2)):vue.createCommentVNode("v-if",!0)],64)):(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:1},[vue.createCommentVNode(" textarea "),vue.createElementVNode("textarea",vue.mergeProps({id:vue.unref(v),ref_key:"textarea",ref:T,class:vue.unref(S).e("inner")},vue.unref(p),{tabindex:qe.tabindex,disabled:vue.unref(A),readonly:qe.readonly,autocomplete:qe.autocomplete,style:vue.unref(ie),"aria-label":qe.label,placeholder:qe.placeholder,form:o.form,onCompositionstart:xe,onCompositionupdate:ze,onCompositionend:Pt,onInput:At,onFocus:jt[2]||(jt[2]=(...An)=>vue.unref(L)&&vue.unref(L)(...An)),onBlur:jt[3]||(jt[3]=(...An)=>vue.unref(F)&&vue.unref(F)(...An)),onChange:Ve,onKeydown:$}),null,16,_hoisted_3$4),vue.unref(kt)?(vue.openBlock(),vue.createElementBlock("span",{key:0,style:vue.normalizeStyle(M.value),class:vue.normalizeClass(vue.unref(_).e("count"))},vue.toDisplayString(vue.unref(Dt))+" / "+vue.toDisplayString(vue.unref(p).maxlength),7)):vue.createCommentVNode("v-if",!0)],64))],16,_hoisted_1$7)),[[vue.vShow,qe.type!=="hidden"]])}});var Input=_export_sfc(_sfc_main$o,[["__file","/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);const ElInput=withInstall(Input),GAP=4,BAR_MAP={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},renderThumbStyle=({move:r,size:n,bar:i})=>({[i.size]:n,transform:`translate${i.axis}(${r}%)`}),scrollbarContextKey=Symbol("scrollbarContextKey"),thumbProps=buildProps({vertical:Boolean,size:String,move:Number,ratio:{type:Number,required:!0},always:Boolean}),COMPONENT_NAME$2="Thumb",_sfc_main$n=vue.defineComponent({__name:"thumb",props:thumbProps,setup(r){const n=r,i=vue.inject(scrollbarContextKey),o=useNamespace("scrollbar");i||throwError(COMPONENT_NAME$2,"can not inject scrollbar context");const a=vue.ref(),u=vue.ref(),c=vue.ref({}),f=vue.ref(!1);let d=!1,p=!1,h=isClient?document.onselectstart:null;const g=vue.computed(()=>BAR_MAP[n.vertical?"vertical":"horizontal"]),v=vue.computed(()=>renderThumbStyle({size:n.size,move:n.move,bar:g.value})),y=vue.computed(()=>a.value[g.value.offset]**2/i.wrapElement[g.value.scrollSize]/n.ratio/u.value[g.value.offset]),A=M=>{var D;if(M.stopPropagation(),M.ctrlKey||[1,2].includes(M.button))return;(D=window.getSelection())==null||D.removeAllRanges(),S(M);const z=M.currentTarget;z&&(c.value[g.value.axis]=z[g.value.offset]-(M[g.value.client]-z.getBoundingClientRect()[g.value.direction]))},_=M=>{if(!u.value||!a.value||!i.wrapElement)return;const D=Math.abs(M.target.getBoundingClientRect()[g.value.direction]-M[g.value.client]),z=u.value[g.value.offset]/2,j=(D-z)*100*y.value/a.value[g.value.offset];i.wrapElement[g.value.scroll]=j*i.wrapElement[g.value.scrollSize]/100},S=M=>{M.stopImmediatePropagation(),d=!0,document.addEventListener("mousemove",b),document.addEventListener("mouseup",T),h=document.onselectstart,document.onselectstart=()=>!1},b=M=>{if(!a.value||!u.value||d===!1)return;const D=c.value[g.value.axis];if(!D)return;const z=(a.value.getBoundingClientRect()[g.value.direction]-M[g.value.client])*-1,j=u.value[g.value.offset]-D,oe=(z-j)*100*y.value/a.value[g.value.offset];i.wrapElement[g.value.scroll]=oe*i.wrapElement[g.value.scrollSize]/100},T=()=>{d=!1,c.value[g.value.axis]=0,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",T),k(),p&&(f.value=!1)},w=()=>{p=!1,f.value=!!n.size},x=()=>{p=!0,f.value=d};vue.onBeforeUnmount(()=>{k(),document.removeEventListener("mouseup",T)});const k=()=>{document.onselectstart!==h&&(document.onselectstart=h)};return useEventListener(vue.toRef(i,"scrollbarElement"),"mousemove",w),useEventListener(vue.toRef(i,"scrollbarElement"),"mouseleave",x),(M,D)=>(vue.openBlock(),vue.createBlock(vue.Transition,{name:vue.unref(o).b("fade"),persisted:""},{default:vue.withCtx(()=>[vue.withDirectives(vue.createElementVNode("div",{ref_key:"instance",ref:a,class:vue.normalizeClass([vue.unref(o).e("bar"),vue.unref(o).is(vue.unref(g).key)]),onMousedown:_},[vue.createElementVNode("div",{ref_key:"thumb",ref:u,class:vue.normalizeClass(vue.unref(o).e("thumb")),style:vue.normalizeStyle(vue.unref(v)),onMousedown:A},null,38)],34),[[vue.vShow,M.always||f.value]])]),_:1},8,["name"]))}});var Thumb=_export_sfc(_sfc_main$n,[["__file","/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);const barProps=buildProps({always:{type:Boolean,default:!0},width:String,height:String,ratioX:{type:Number,default:1},ratioY:{type:Number,default:1}}),_sfc_main$m=vue.defineComponent({__name:"bar",props:barProps,setup(r,{expose:n}){const i=r,o=vue.ref(0),a=vue.ref(0);return n({handleScroll:c=>{if(c){const f=c.offsetHeight-GAP,d=c.offsetWidth-GAP;a.value=c.scrollTop*100/f*i.ratioY,o.value=c.scrollLeft*100/d*i.ratioX}}}),(c,f)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createVNode(Thumb,{move:o.value,ratio:c.ratioX,size:c.width,always:c.always},null,8,["move","ratio","size","always"]),vue.createVNode(Thumb,{move:a.value,ratio:c.ratioY,size:c.height,vertical:"",always:c.always},null,8,["move","ratio","size","always"])],64))}});var Bar=_export_sfc(_sfc_main$m,[["__file","/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);const scrollbarProps=buildProps({height:{type:[String,Number],default:""},maxHeight:{type:[String,Number],default:""},native:{type:Boolean,default:!1},wrapStyle:{type:definePropType([String,Object,Array]),default:""},wrapClass:{type:[String,Array],default:""},viewClass:{type:[String,Array],default:""},viewStyle:{type:[String,Array,Object],default:""},noresize:Boolean,tag:{type:String,default:"div"},always:Boolean,minSize:{type:Number,default:20}}),scrollbarEmits={scroll:({scrollTop:r,scrollLeft:n})=>[r,n].every(isNumber)},COMPONENT_NAME$1="ElScrollbar",__default__$8=vue.defineComponent({name:COMPONENT_NAME$1}),_sfc_main$l=vue.defineComponent({...__default__$8,props:scrollbarProps,emits:scrollbarEmits,setup(r,{expose:n,emit:i}){const o=r,a=useNamespace("scrollbar");let u,c;const f=vue.ref(),d=vue.ref(),p=vue.ref(),h=vue.ref("0"),g=vue.ref("0"),v=vue.ref(),y=vue.ref(1),A=vue.ref(1),_=vue.computed(()=>{const D={};return o.height&&(D.height=addUnit(o.height)),o.maxHeight&&(D.maxHeight=addUnit(o.maxHeight)),[o.wrapStyle,D]}),S=vue.computed(()=>[o.wrapClass,a.e("wrap"),{[a.em("wrap","hidden-default")]:!o.native}]),b=vue.computed(()=>[a.e("view"),o.viewClass]),T=()=>{var D;d.value&&((D=v.value)==null||D.handleScroll(d.value),i("scroll",{scrollTop:d.value.scrollTop,scrollLeft:d.value.scrollLeft}))};function w(D,z){isObject(D)?d.value.scrollTo(D):isNumber(D)&&isNumber(z)&&d.value.scrollTo(D,z)}const x=D=>{if(!isNumber(D)){debugWarn(COMPONENT_NAME$1,"value must be a number");return}d.value.scrollTop=D},k=D=>{if(!isNumber(D)){debugWarn(COMPONENT_NAME$1,"value must be a number");return}d.value.scrollLeft=D},M=()=>{if(!d.value)return;const D=d.value.offsetHeight-GAP,z=d.value.offsetWidth-GAP,j=D**2/d.value.scrollHeight,oe=z**2/d.value.scrollWidth,L=Math.max(j,o.minSize),F=Math.max(oe,o.minSize);y.value=j/(D-j)/(L/(D-L)),A.value=oe/(z-oe)/(F/(z-F)),g.value=L+GAP<D?`${L}px`:"",h.value=F+GAP<z?`${F}px`:""};return vue.watch(()=>o.noresize,D=>{D?(u==null||u(),c==null||c()):({stop:u}=useResizeObserver(p,M),c=useEventListener("resize",M))},{immediate:!0}),vue.watch(()=>[o.maxHeight,o.height],()=>{o.native||vue.nextTick(()=>{var D;M(),d.value&&((D=v.value)==null||D.handleScroll(d.value))})}),vue.provide(scrollbarContextKey,vue.reactive({scrollbarElement:f,wrapElement:d})),vue.onMounted(()=>{o.native||vue.nextTick(()=>{M()})}),vue.onUpdated(()=>M()),n({wrapRef:d,update:M,scrollTo:w,setScrollTop:x,setScrollLeft:k,handleScroll:T}),(D,z)=>(vue.openBlock(),vue.createElementBlock("div",{ref_key:"scrollbarRef",ref:f,class:vue.normalizeClass(vue.unref(a).b())},[vue.createElementVNode("div",{ref_key:"wrapRef",ref:d,class:vue.normalizeClass(vue.unref(S)),style:vue.normalizeStyle(vue.unref(_)),onScroll:T},[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(D.tag),{ref_key:"resizeRef",ref:p,class:vue.normalizeClass(vue.unref(b)),style:vue.normalizeStyle(D.viewStyle)},{default:vue.withCtx(()=>[vue.renderSlot(D.$slots,"default")]),_:3},8,["class","style"]))],38),D.native?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createBlock(Bar,{key:0,ref_key:"barRef",ref:v,height:g.value,width:h.value,always:D.always,"ratio-x":A.value,"ratio-y":y.value},null,8,["height","width","always","ratio-x","ratio-y"]))],2))}});var Scrollbar=_export_sfc(_sfc_main$l,[["__file","/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);const ElScrollbar=withInstall(Scrollbar),POPPER_INJECTION_KEY=Symbol("popper"),POPPER_CONTENT_INJECTION_KEY=Symbol("popperContent"),roleTypes=["dialog","grid","group","listbox","menu","navigation","tooltip","tree"],popperProps=buildProps({role:{type:String,values:roleTypes,default:"tooltip"}}),__default__$7=vue.defineComponent({name:"ElPopper",inheritAttrs:!1}),_sfc_main$k=vue.defineComponent({...__default__$7,props:popperProps,setup(r,{expose:n}){const i=r,o=vue.ref(),a=vue.ref(),u=vue.ref(),c=vue.ref(),f=vue.computed(()=>i.role),d={triggerRef:o,popperInstanceRef:a,contentRef:u,referenceRef:c,role:f};return n(d),vue.provide(POPPER_INJECTION_KEY,d),(p,h)=>vue.renderSlot(p.$slots,"default")}});var Popper=_export_sfc(_sfc_main$k,[["__file","/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);const popperArrowProps=buildProps({arrowOffset:{type:Number,default:5}}),__default__$6=vue.defineComponent({name:"ElPopperArrow",inheritAttrs:!1}),_sfc_main$j=vue.defineComponent({...__default__$6,props:popperArrowProps,setup(r,{expose:n}){const i=r,o=useNamespace("popper"),{arrowOffset:a,arrowRef:u,arrowStyle:c}=vue.inject(POPPER_CONTENT_INJECTION_KEY,void 0);return vue.watch(()=>i.arrowOffset,f=>{a.value=f}),vue.onBeforeUnmount(()=>{u.value=void 0}),n({arrowRef:u}),(f,d)=>(vue.openBlock(),vue.createElementBlock("span",{ref_key:"arrowRef",ref:u,class:vue.normalizeClass(vue.unref(o).e("arrow")),style:vue.normalizeStyle(vue.unref(c)),"data-popper-arrow":""},null,6))}});var ElPopperArrow=_export_sfc(_sfc_main$j,[["__file","/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);const NAME="ElOnlyChild",OnlyChild=vue.defineComponent({name:NAME,setup(r,{slots:n,attrs:i}){var o;const a=vue.inject(FORWARD_REF_INJECTION_KEY),u=useForwardRefDirective((o=a==null?void 0:a.setForwardRef)!=null?o:NOOP);return()=>{var c;const f=(c=n.default)==null?void 0:c.call(n,i);if(!f)return null;if(f.length>1)return debugWarn(NAME,"requires exact only one valid child."),null;const d=findFirstLegitChild(f);return d?vue.withDirectives(vue.cloneVNode(d,i),[[u]]):(debugWarn(NAME,"no valid child node found"),null)}}});function findFirstLegitChild(r){if(!r)return null;const n=r;for(const i of n){if(isObject(i))switch(i.type){case vue.Comment:continue;case vue.Text:case"svg":return wrapTextContent(i);case vue.Fragment:return findFirstLegitChild(i.children);default:return i}return wrapTextContent(i)}return null}function wrapTextContent(r){const n=useNamespace("only-child");return vue.createVNode("span",{class:n.e("content")},[r])}const popperTriggerProps=buildProps({virtualRef:{type:definePropType(Object)},virtualTriggering:Boolean,onMouseenter:{type:definePropType(Function)},onMouseleave:{type:definePropType(Function)},onClick:{type:definePropType(Function)},onKeydown:{type:definePropType(Function)},onFocus:{type:definePropType(Function)},onBlur:{type:definePropType(Function)},onContextmenu:{type:definePropType(Function)},id:String,open:Boolean}),__default__$5=vue.defineComponent({name:"ElPopperTrigger",inheritAttrs:!1}),_sfc_main$i=vue.defineComponent({...__default__$5,props:popperTriggerProps,setup(r,{expose:n}){const i=r,{role:o,triggerRef:a}=vue.inject(POPPER_INJECTION_KEY,void 0);useForwardRef(a);const u=vue.computed(()=>f.value?i.id:void 0),c=vue.computed(()=>{if(o&&o.value==="tooltip")return i.open&&i.id?i.id:void 0}),f=vue.computed(()=>{if(o&&o.value!=="tooltip")return o.value}),d=vue.computed(()=>f.value?`${i.open}`:void 0);let p;return vue.onMounted(()=>{vue.watch(()=>i.virtualRef,h=>{h&&(a.value=unrefElement(h))},{immediate:!0}),vue.watch(a,(h,g)=>{p==null||p(),p=void 0,isElement(h)&&(["onMouseenter","onMouseleave","onClick","onKeydown","onFocus","onBlur","onContextmenu"].forEach(v=>{var y;const A=i[v];A&&(h.addEventListener(v.slice(2).toLowerCase(),A),(y=g==null?void 0:g.removeEventListener)==null||y.call(g,v.slice(2).toLowerCase(),A))}),p=vue.watch([u,c,f,d],v=>{["aria-controls","aria-describedby","aria-haspopup","aria-expanded"].forEach((y,A)=>{lodashEs.isNil(v[A])?h.removeAttribute(y):h.setAttribute(y,v[A])})},{immediate:!0})),isElement(g)&&["aria-controls","aria-describedby","aria-haspopup","aria-expanded"].forEach(v=>g.removeAttribute(v))},{immediate:!0})}),vue.onBeforeUnmount(()=>{p==null||p(),p=void 0}),n({triggerRef:a}),(h,g)=>h.virtualTriggering?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createBlock(vue.unref(OnlyChild),vue.mergeProps({key:0},h.$attrs,{"aria-controls":vue.unref(u),"aria-describedby":vue.unref(c),"aria-expanded":vue.unref(d),"aria-haspopup":vue.unref(f)}),{default:vue.withCtx(()=>[vue.renderSlot(h.$slots,"default")]),_:3},16,["aria-controls","aria-describedby","aria-expanded","aria-haspopup"]))}});var ElPopperTrigger=_export_sfc(_sfc_main$i,[["__file","/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);const FOCUS_AFTER_TRAPPED="focus-trap.focus-after-trapped",FOCUS_AFTER_RELEASED="focus-trap.focus-after-released",FOCUSOUT_PREVENTED="focus-trap.focusout-prevented",FOCUS_AFTER_TRAPPED_OPTS={cancelable:!0,bubbles:!1},FOCUSOUT_PREVENTED_OPTS={cancelable:!0,bubbles:!1},ON_TRAP_FOCUS_EVT="focusAfterTrapped",ON_RELEASE_FOCUS_EVT="focusAfterReleased",FOCUS_TRAP_INJECTION_KEY=Symbol("elFocusTrap"),focusReason=vue.ref(),lastUserFocusTimestamp=vue.ref(0),lastAutomatedFocusTimestamp=vue.ref(0);let focusReasonUserCount=0;const obtainAllFocusableElements=r=>{const n=[],i=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const a=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||a?NodeFilter.FILTER_SKIP:o.tabIndex>=0||o===document.activeElement?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)n.push(i.currentNode);return n},getVisibleElement=(r,n)=>{for(const i of r)if(!isHidden(i,n))return i},isHidden=(r,n)=>{if(process.env.NODE_ENV==="test")return!1;if(getComputedStyle(r).visibility==="hidden")return!0;for(;r;){if(n&&r===n)return!1;if(getComputedStyle(r).display==="none")return!0;r=r.parentElement}return!1},getEdges=r=>{const n=obtainAllFocusableElements(r),i=getVisibleElement(n,r),o=getVisibleElement(n.reverse(),r);return[i,o]},isSelectable=r=>r instanceof HTMLInputElement&&"select"in r,tryFocus=(r,n)=>{if(r&&r.focus){const i=document.activeElement;r.focus({preventScroll:!0}),lastAutomatedFocusTimestamp.value=window.performance.now(),r!==i&&isSelectable(r)&&n&&r.select()}};function removeFromStack(r,n){const i=[...r],o=r.indexOf(n);return o!==-1&&i.splice(o,1),i}const createFocusableStack=()=>{let r=[];return{push:o=>{const a=r[0];a&&o!==a&&a.pause(),r=removeFromStack(r,o),r.unshift(o)},remove:o=>{var a,u;r=removeFromStack(r,o),(u=(a=r[0])==null?void 0:a.resume)==null||u.call(a)}}},focusFirstDescendant=(r,n=!1)=>{const i=document.activeElement;for(const o of r)if(tryFocus(o,n),document.activeElement!==i)return},focusableStack=createFocusableStack(),isFocusCausedByUserEvent=()=>lastUserFocusTimestamp.value>lastAutomatedFocusTimestamp.value,notifyFocusReasonPointer=()=>{focusReason.value="pointer",lastUserFocusTimestamp.value=window.performance.now()},notifyFocusReasonKeydown=()=>{focusReason.value="keyboard",lastUserFocusTimestamp.value=window.performance.now()},useFocusReason=()=>(vue.onMounted(()=>{focusReasonUserCount===0&&(document.addEventListener("mousedown",notifyFocusReasonPointer),document.addEventListener("touchstart",notifyFocusReasonPointer),document.addEventListener("keydown",notifyFocusReasonKeydown)),focusReasonUserCount++}),vue.onBeforeUnmount(()=>{focusReasonUserCount--,focusReasonUserCount<=0&&(document.removeEventListener("mousedown",notifyFocusReasonPointer),document.removeEventListener("touchstart",notifyFocusReasonPointer),document.removeEventListener("keydown",notifyFocusReasonKeydown))}),{focusReason,lastUserFocusTimestamp,lastAutomatedFocusTimestamp}),createFocusOutPreventedEvent=r=>new CustomEvent(FOCUSOUT_PREVENTED,{...FOCUSOUT_PREVENTED_OPTS,detail:r}),_sfc_main$h=vue.defineComponent({name:"ElFocusTrap",inheritAttrs:!1,props:{loop:Boolean,trapped:Boolean,focusTrapEl:Object,focusStartEl:{type:[Object,String],default:"first"}},emits:[ON_TRAP_FOCUS_EVT,ON_RELEASE_FOCUS_EVT,"focusin","focusout","focusout-prevented","release-requested"],setup(r,{emit:n}){const i=vue.ref();let o,a;const{focusReason:u}=useFocusReason();useEscapeKeydown(A=>{r.trapped&&!c.paused&&n("release-requested",A)});const c={paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}},f=A=>{if(!r.loop&&!r.trapped||c.paused)return;const{key:_,altKey:S,ctrlKey:b,metaKey:T,currentTarget:w,shiftKey:x}=A,{loop:k}=r,M=_===EVENT_CODE.tab&&!S&&!b&&!T,D=document.activeElement;if(M&&D){const z=w,[j,oe]=getEdges(z);if(j&&oe){if(!x&&D===oe){const F=createFocusOutPreventedEvent({focusReason:u.value});n("focusout-prevented",F),F.defaultPrevented||(A.preventDefault(),k&&tryFocus(j,!0))}else if(x&&[j,z].includes(D)){const F=createFocusOutPreventedEvent({focusReason:u.value});n("focusout-prevented",F),F.defaultPrevented||(A.preventDefault(),k&&tryFocus(oe,!0))}}else if(D===z){const F=createFocusOutPreventedEvent({focusReason:u.value});n("focusout-prevented",F),F.defaultPrevented||A.preventDefault()}}};vue.provide(FOCUS_TRAP_INJECTION_KEY,{focusTrapRef:i,onKeydown:f}),vue.watch(()=>r.focusTrapEl,A=>{A&&(i.value=A)},{immediate:!0}),vue.watch([i],([A],[_])=>{A&&(A.addEventListener("keydown",f),A.addEventListener("focusin",h),A.addEventListener("focusout",g)),_&&(_.removeEventListener("keydown",f),_.removeEventListener("focusin",h),_.removeEventListener("focusout",g))});const d=A=>{n(ON_TRAP_FOCUS_EVT,A)},p=A=>n(ON_RELEASE_FOCUS_EVT,A),h=A=>{const _=vue.unref(i);if(!_)return;const S=A.target,b=A.relatedTarget,T=S&&_.contains(S);r.trapped||b&&_.contains(b)||(o=b),T&&n("focusin",A),!c.paused&&r.trapped&&(T?a=S:tryFocus(a,!0))},g=A=>{const _=vue.unref(i);if(!(c.paused||!_))if(r.trapped){const S=A.relatedTarget;!lodashEs.isNil(S)&&!_.contains(S)&&setTimeout(()=>{if(!c.paused&&r.trapped){const b=createFocusOutPreventedEvent({focusReason:u.value});n("focusout-prevented",b),b.defaultPrevented||tryFocus(a,!0)}},0)}else{const S=A.target;S&&_.contains(S)||n("focusout",A)}};async function v(){await vue.nextTick();const A=vue.unref(i);if(A){focusableStack.push(c);const _=A.contains(document.activeElement)?o:document.activeElement;if(o=_,!A.contains(_)){const b=new Event(FOCUS_AFTER_TRAPPED,FOCUS_AFTER_TRAPPED_OPTS);A.addEventListener(FOCUS_AFTER_TRAPPED,d),A.dispatchEvent(b),b.defaultPrevented||vue.nextTick(()=>{let T=r.focusStartEl;isString(T)||(tryFocus(T),document.activeElement!==T&&(T="first")),T==="first"&&focusFirstDescendant(obtainAllFocusableElements(A),!0),(document.activeElement===_||T==="container")&&tryFocus(A)})}}}function y(){const A=vue.unref(i);if(A){A.removeEventListener(FOCUS_AFTER_TRAPPED,d);const _=new CustomEvent(FOCUS_AFTER_RELEASED,{...FOCUS_AFTER_TRAPPED_OPTS,detail:{focusReason:u.value}});A.addEventListener(FOCUS_AFTER_RELEASED,p),A.dispatchEvent(_),!_.defaultPrevented&&(u.value=="keyboard"||!isFocusCausedByUserEvent()||A.contains(document.activeElement))&&tryFocus(o??document.body),A.removeEventListener(FOCUS_AFTER_RELEASED,d),focusableStack.remove(c)}}return vue.onMounted(()=>{r.trapped&&v(),vue.watch(()=>r.trapped,A=>{A?v():y()})}),vue.onBeforeUnmount(()=>{r.trapped&&y()}),{onKeydown:f}}});function _sfc_render$4(r,n,i,o,a,u){return vue.renderSlot(r.$slots,"default",{handleKeydown:r.onKeydown})}var ElFocusTrap=_export_sfc(_sfc_main$h,[["render",_sfc_render$4],["__file","/home/runner/work/element-plus/element-plus/packages/components/focus-trap/src/focus-trap.vue"]]);const POSITIONING_STRATEGIES=["fixed","absolute"],popperCoreConfigProps=buildProps({boundariesPadding:{type:Number,default:0},fallbackPlacements:{type:definePropType(Array),default:void 0},gpuAcceleration:{type:Boolean,default:!0},offset:{type:Number,default:12},placement:{type:String,values:Ee,default:"bottom"},popperOptions:{type:definePropType(Object),default:()=>({})},strategy:{type:String,values:POSITIONING_STRATEGIES,default:"absolute"}}),popperContentProps=buildProps({...popperCoreConfigProps,id:String,style:{type:definePropType([String,Array,Object])},className:{type:definePropType([String,Array,Object])},effect:{type:String,default:"dark"},visible:Boolean,enterable:{type:Boolean,default:!0},pure:Boolean,focusOnShow:{type:Boolean,default:!1},trapping:{type:Boolean,default:!1},popperClass:{type:definePropType([String,Array,Object])},popperStyle:{type:definePropType([String,Array,Object])},referenceEl:{type:definePropType(Object)},triggerTargetEl:{type:definePropType(Object)},stopPopperMouseEvent:{type:Boolean,default:!0},ariaLabel:{type:String,default:void 0},virtualTriggering:Boolean,zIndex:Number}),popperContentEmits={mouseenter:r=>r instanceof MouseEvent,mouseleave:r=>r instanceof MouseEvent,focus:()=>!0,blur:()=>!0,close:()=>!0},buildPopperOptions=(r,n=[])=>{const{placement:i,strategy:o,popperOptions:a}=r,u={placement:i,strategy:o,...a,modifiers:[...genModifiers(r),...n]};return deriveExtraModifiers(u,a==null?void 0:a.modifiers),u},unwrapMeasurableEl=r=>{if(isClient)return unrefElement(r)};function genModifiers(r){const{offset:n,gpuAcceleration:i,fallbackPlacements:o}=r;return[{name:"offset",options:{offset:[0,n??12]}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5,fallbackPlacements:o}},{name:"computeStyles",options:{gpuAcceleration:i}}]}function deriveExtraModifiers(r,n){n&&(r.modifiers=[...r.modifiers,...n??[]])}const DEFAULT_ARROW_OFFSET=0,usePopperContent=r=>{const{popperInstanceRef:n,contentRef:i,triggerRef:o,role:a}=vue.inject(POPPER_INJECTION_KEY,void 0),u=vue.ref(),c=vue.ref(),f=vue.computed(()=>({name:"eventListeners",enabled:!!r.visible})),d=vue.computed(()=>{var b;const T=vue.unref(u),w=(b=vue.unref(c))!=null?b:DEFAULT_ARROW_OFFSET;return{name:"arrow",enabled:!lodashEs.isUndefined(T),options:{element:T,padding:w}}}),p=vue.computed(()=>({onFirstUpdate:()=>{A()},...buildPopperOptions(r,[vue.unref(d),vue.unref(f)])})),h=vue.computed(()=>unwrapMeasurableEl(r.referenceEl)||vue.unref(o)),{attributes:g,state:v,styles:y,update:A,forceUpdate:_,instanceRef:S}=usePopper(h,i,p);return vue.watch(S,b=>n.value=b),vue.onMounted(()=>{vue.watch(()=>{var b;return(b=vue.unref(h))==null?void 0:b.getBoundingClientRect()},()=>{A()})}),{attributes:g,arrowRef:u,contentRef:i,instanceRef:S,state:v,styles:y,role:a,forceUpdate:_,update:A}},usePopperContentDOM=(r,{attributes:n,styles:i,role:o})=>{const{nextZIndex:a}=useZIndex(),u=useNamespace("popper"),c=vue.computed(()=>vue.unref(n).popper),f=vue.ref(r.zIndex||a()),d=vue.computed(()=>[u.b(),u.is("pure",r.pure),u.is(r.effect),r.popperClass]),p=vue.computed(()=>[{zIndex:vue.unref(f)},vue.unref(i).popper,r.popperStyle||{}]),h=vue.computed(()=>o.value==="dialog"?"false":void 0),g=vue.computed(()=>vue.unref(i).arrow||{});return{ariaModal:h,arrowStyle:g,contentAttrs:c,contentClass:d,contentStyle:p,contentZIndex:f,updateZIndex:()=>{f.value=r.zIndex||a()}}},usePopperContentFocusTrap=(r,n)=>{const i=vue.ref(!1),o=vue.ref();return{focusStartRef:o,trapped:i,onFocusAfterReleased:p=>{var h;((h=p.detail)==null?void 0:h.focusReason)!=="pointer"&&(o.value="first",n("blur"))},onFocusAfterTrapped:()=>{n("focus")},onFocusInTrap:p=>{r.visible&&!i.value&&(p.target&&(o.value=p.target),i.value=!0)},onFocusoutPrevented:p=>{r.trapping||(p.detail.focusReason==="pointer"&&p.preventDefault(),i.value=!1)},onReleaseRequested:()=>{i.value=!1,n("close")}}},__default__$4=vue.defineComponent({name:"ElPopperContent"}),_sfc_main$g=vue.defineComponent({...__default__$4,props:popperContentProps,emits:popperContentEmits,setup(r,{expose:n,emit:i}){const o=r,{focusStartRef:a,trapped:u,onFocusAfterReleased:c,onFocusAfterTrapped:f,onFocusInTrap:d,onFocusoutPrevented:p,onReleaseRequested:h}=usePopperContentFocusTrap(o,i),{attributes:g,arrowRef:v,contentRef:y,styles:A,instanceRef:_,role:S,update:b}=usePopperContent(o),{ariaModal:T,arrowStyle:w,contentAttrs:x,contentClass:k,contentStyle:M,updateZIndex:D}=usePopperContentDOM(o,{styles:A,attributes:g,role:S}),z=vue.inject(formItemContextKey,void 0),j=vue.ref();vue.provide(POPPER_CONTENT_INJECTION_KEY,{arrowStyle:w,arrowRef:v,arrowOffset:j}),z&&(z.addInputId||z.removeInputId)&&vue.provide(formItemContextKey,{...z,addInputId:NOOP,removeInputId:NOOP});let oe;const L=(O=!0)=>{b(),O&&D()},F=()=>{L(!1),o.visible&&o.focusOnShow?u.value=!0:o.visible===!1&&(u.value=!1)};return vue.onMounted(()=>{vue.watch(()=>o.triggerTargetEl,(O,ue)=>{oe==null||oe(),oe=void 0;const _e=vue.unref(O||y.value),Ce=vue.unref(ue||y.value);isElement(_e)&&(oe=vue.watch([S,()=>o.ariaLabel,T,()=>o.id],de=>{["role","aria-label","aria-modal","id"].forEach((ie,Y)=>{lodashEs.isNil(de[Y])?_e.removeAttribute(ie):_e.setAttribute(ie,de[Y])})},{immediate:!0})),Ce!==_e&&isElement(Ce)&&["role","aria-label","aria-modal","id"].forEach(de=>{Ce.removeAttribute(de)})},{immediate:!0}),vue.watch(()=>o.visible,F,{immediate:!0})}),vue.onBeforeUnmount(()=>{oe==null||oe(),oe=void 0}),n({popperContentRef:y,popperInstanceRef:_,updatePopper:L,contentStyle:M}),(O,ue)=>(vue.openBlock(),vue.createElementBlock("div",vue.mergeProps({ref_key:"contentRef",ref:y},vue.unref(x),{style:vue.unref(M),class:vue.unref(k),tabindex:"-1",onMouseenter:ue[0]||(ue[0]=_e=>O.$emit("mouseenter",_e)),onMouseleave:ue[1]||(ue[1]=_e=>O.$emit("mouseleave",_e))}),[vue.createVNode(vue.unref(ElFocusTrap),{trapped:vue.unref(u),"trap-on-focus-in":!0,"focus-trap-el":vue.unref(y),"focus-start-el":vue.unref(a),onFocusAfterTrapped:vue.unref(f),onFocusAfterReleased:vue.unref(c),onFocusin:vue.unref(d),onFocusoutPrevented:vue.unref(p),onReleaseRequested:vue.unref(h)},{default:vue.withCtx(()=>[vue.renderSlot(O.$slots,"default")]),_:3},8,["trapped","focus-trap-el","focus-start-el","onFocusAfterTrapped","onFocusAfterReleased","onFocusin","onFocusoutPrevented","onReleaseRequested"])],16))}});var ElPopperContent=_export_sfc(_sfc_main$g,[["__file","/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);const ElPopper=withInstall(Popper),TOOLTIP_INJECTION_KEY=Symbol("elTooltip"),useTooltipContentProps=buildProps({...useDelayedToggleProps,...popperContentProps,appendTo:{type:definePropType([String,Object])},content:{type:String,default:""},rawContent:{type:Boolean,default:!1},persistent:Boolean,ariaLabel:String,visible:{type:definePropType(Boolean),default:null},transition:String,teleported:{type:Boolean,default:!0},disabled:Boolean}),useTooltipTriggerProps=buildProps({...popperTriggerProps,disabled:Boolean,trigger:{type:definePropType([String,Array]),default:"hover"},triggerKeys:{type:definePropType(Array),default:()=>[EVENT_CODE.enter,EVENT_CODE.space]}}),{useModelToggleProps:useTooltipModelToggleProps,useModelToggleEmits:useTooltipModelToggleEmits,useModelToggle:useTooltipModelToggle}=createModelToggleComposable("visible"),useTooltipProps=buildProps({...popperProps,...useTooltipModelToggleProps,...useTooltipContentProps,...useTooltipTriggerProps,...popperArrowProps,showArrow:{type:Boolean,default:!0}}),tooltipEmits=[...useTooltipModelToggleEmits,"before-show","before-hide","show","hide","open","close"],isTriggerType=(r,n)=>isArray(r)?r.includes(n):r===n,whenTrigger=(r,n,i)=>o=>{isTriggerType(vue.unref(r),n)&&i(o)},__default__$3=vue.defineComponent({name:"ElTooltipTrigger"}),_sfc_main$f=vue.defineComponent({...__default__$3,props:useTooltipTriggerProps,setup(r,{expose:n}){const i=r,o=useNamespace("tooltip"),{controlled:a,id:u,open:c,onOpen:f,onClose:d,onToggle:p}=vue.inject(TOOLTIP_INJECTION_KEY,void 0),h=vue.ref(null),g=()=>{if(vue.unref(a)||i.disabled)return!0},v=vue.toRef(i,"trigger"),y=composeEventHandlers(g,whenTrigger(v,"hover",f)),A=composeEventHandlers(g,whenTrigger(v,"hover",d)),_=composeEventHandlers(g,whenTrigger(v,"click",x=>{x.button===0&&p(x)})),S=composeEventHandlers(g,whenTrigger(v,"focus",f)),b=composeEventHandlers(g,whenTrigger(v,"focus",d)),T=composeEventHandlers(g,whenTrigger(v,"contextmenu",x=>{x.preventDefault(),p(x)})),w=composeEventHandlers(g,x=>{const{code:k}=x;i.triggerKeys.includes(k)&&(x.preventDefault(),p(x))});return n({triggerRef:h}),(x,k)=>(vue.openBlock(),vue.createBlock(vue.unref(ElPopperTrigger),{id:vue.unref(u),"virtual-ref":x.virtualRef,open:vue.unref(c),"virtual-triggering":x.virtualTriggering,class:vue.normalizeClass(vue.unref(o).e("trigger")),onBlur:vue.unref(b),onClick:vue.unref(_),onContextmenu:vue.unref(T),onFocus:vue.unref(S),onMouseenter:vue.unref(y),onMouseleave:vue.unref(A),onKeydown:vue.unref(w)},{default:vue.withCtx(()=>[vue.renderSlot(x.$slots,"default")]),_:3},8,["id","virtual-ref","open","virtual-triggering","class","onBlur","onClick","onContextmenu","onFocus","onMouseenter","onMouseleave","onKeydown"]))}});var ElTooltipTrigger=_export_sfc(_sfc_main$f,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/trigger.vue"]]);const __default__$2=vue.defineComponent({name:"ElTooltipContent",inheritAttrs:!1}),_sfc_main$e=vue.defineComponent({...__default__$2,props:useTooltipContentProps,setup(r,{expose:n}){const i=r,{selector:o}=usePopperContainerId(),a=useNamespace("tooltip"),u=vue.ref(null),c=vue.ref(!1),{controlled:f,id:d,open:p,trigger:h,onClose:g,onOpen:v,onShow:y,onHide:A,onBeforeShow:_,onBeforeHide:S}=vue.inject(TOOLTIP_INJECTION_KEY,void 0),b=vue.computed(()=>i.transition||`${a.namespace.value}-fade-in-linear`),T=vue.computed(()=>process.env.NODE_ENV==="test"?!0:i.persistent);vue.onBeforeUnmount(()=>{c.value=!0});const w=vue.computed(()=>vue.unref(T)?!0:vue.unref(p)),x=vue.computed(()=>i.disabled?!1:vue.unref(p)),k=vue.computed(()=>i.appendTo||o.value),M=vue.computed(()=>{var de;return(de=i.style)!=null?de:{}}),D=vue.computed(()=>!vue.unref(p)),z=()=>{A()},j=()=>{if(vue.unref(f))return!0},oe=composeEventHandlers(j,()=>{i.enterable&&vue.unref(h)==="hover"&&v()}),L=composeEventHandlers(j,()=>{vue.unref(h)==="hover"&&g()}),F=()=>{var de,ie;(ie=(de=u.value)==null?void 0:de.updatePopper)==null||ie.call(de),_==null||_()},O=()=>{S==null||S()},ue=()=>{y(),Ce=onClickOutside(vue.computed(()=>{var de;return(de=u.value)==null?void 0:de.popperContentRef}),()=>{if(vue.unref(f))return;vue.unref(h)!=="hover"&&g()})},_e=()=>{i.virtualTriggering||g()};let Ce;return vue.watch(()=>vue.unref(p),de=>{de||Ce==null||Ce()},{flush:"post"}),vue.watch(()=>i.content,()=>{var de,ie;(ie=(de=u.value)==null?void 0:de.updatePopper)==null||ie.call(de)}),n({contentRef:u}),(de,ie)=>(vue.openBlock(),vue.createBlock(vue.Teleport,{disabled:!de.teleported,to:vue.unref(k)},[vue.createVNode(vue.Transition,{name:vue.unref(b),onAfterLeave:z,onBeforeEnter:F,onAfterEnter:ue,onBeforeLeave:O},{default:vue.withCtx(()=>[vue.unref(w)?vue.withDirectives((vue.openBlock(),vue.createBlock(vue.unref(ElPopperContent),vue.mergeProps({key:0,id:vue.unref(d),ref_key:"contentRef",ref:u},de.$attrs,{"aria-label":de.ariaLabel,"aria-hidden":vue.unref(D),"boundaries-padding":de.boundariesPadding,"fallback-placements":de.fallbackPlacements,"gpu-acceleration":de.gpuAcceleration,offset:de.offset,placement:de.placement,"popper-options":de.popperOptions,strategy:de.strategy,effect:de.effect,enterable:de.enterable,pure:de.pure,"popper-class":de.popperClass,"popper-style":[de.popperStyle,vue.unref(M)],"reference-el":de.referenceEl,"trigger-target-el":de.triggerTargetEl,visible:vue.unref(x),"z-index":de.zIndex,onMouseenter:vue.unref(oe),onMouseleave:vue.unref(L),onBlur:_e,onClose:vue.unref(g)}),{default:vue.withCtx(()=>[c.value?vue.createCommentVNode("v-if",!0):vue.renderSlot(de.$slots,"default",{key:0})]),_:3},16,["id","aria-label","aria-hidden","boundaries-padding","fallback-placements","gpu-acceleration","offset","placement","popper-options","strategy","effect","enterable","pure","popper-class","popper-style","reference-el","trigger-target-el","visible","z-index","onMouseenter","onMouseleave","onClose"])),[[vue.vShow,vue.unref(x)]]):vue.createCommentVNode("v-if",!0)]),_:3},8,["name"])],8,["disabled","to"]))}});var ElTooltipContent=_export_sfc(_sfc_main$e,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);const _hoisted_1$6=["innerHTML"],_hoisted_2$4={key:1},__default__$1=vue.defineComponent({name:"ElTooltip"}),_sfc_main$d=vue.defineComponent({...__default__$1,props:useTooltipProps,emits:tooltipEmits,setup(r,{expose:n,emit:i}){const o=r;usePopperContainer();const a=useId(),u=vue.ref(),c=vue.ref(),f=()=>{var b;const T=vue.unref(u);T&&((b=T.popperInstanceRef)==null||b.update())},d=vue.ref(!1),p=vue.ref(),{show:h,hide:g,hasUpdateHandler:v}=useTooltipModelToggle({indicator:d,toggleReason:p}),{onOpen:y,onClose:A}=useDelayedToggle({showAfter:vue.toRef(o,"showAfter"),hideAfter:vue.toRef(o,"hideAfter"),autoClose:vue.toRef(o,"autoClose"),open:h,close:g}),_=vue.computed(()=>isBoolean(o.visible)&&!v.value);vue.provide(TOOLTIP_INJECTION_KEY,{controlled:_,id:a,open:vue.readonly(d),trigger:vue.toRef(o,"trigger"),onOpen:b=>{y(b)},onClose:b=>{A(b)},onToggle:b=>{vue.unref(d)?A(b):y(b)},onShow:()=>{i("show",p.value)},onHide:()=>{i("hide",p.value)},onBeforeShow:()=>{i("before-show",p.value)},onBeforeHide:()=>{i("before-hide",p.value)},updatePopper:f}),vue.watch(()=>o.disabled,b=>{b&&d.value&&(d.value=!1)});const S=()=>{var b,T;const w=(T=(b=c.value)==null?void 0:b.contentRef)==null?void 0:T.popperContentRef;return w&&w.contains(document.activeElement)};return vue.onDeactivated(()=>d.value&&g()),n({popperRef:u,contentRef:c,isFocusInsideContent:S,updatePopper:f,onOpen:y,onClose:A,hide:g}),(b,T)=>(vue.openBlock(),vue.createBlock(vue.unref(ElPopper),{ref_key:"popperRef",ref:u,role:b.role},{default:vue.withCtx(()=>[vue.createVNode(ElTooltipTrigger,{disabled:b.disabled,trigger:b.trigger,"trigger-keys":b.triggerKeys,"virtual-ref":b.virtualRef,"virtual-triggering":b.virtualTriggering},{default:vue.withCtx(()=>[b.$slots.default?vue.renderSlot(b.$slots,"default",{key:0}):vue.createCommentVNode("v-if",!0)]),_:3},8,["disabled","trigger","trigger-keys","virtual-ref","virtual-triggering"]),vue.createVNode(ElTooltipContent,{ref_key:"contentRef",ref:c,"aria-label":b.ariaLabel,"boundaries-padding":b.boundariesPadding,content:b.content,disabled:b.disabled,effect:b.effect,enterable:b.enterable,"fallback-placements":b.fallbackPlacements,"hide-after":b.hideAfter,"gpu-acceleration":b.gpuAcceleration,offset:b.offset,persistent:b.persistent,"popper-class":b.popperClass,"popper-style":b.popperStyle,placement:b.placement,"popper-options":b.popperOptions,pure:b.pure,"raw-content":b.rawContent,"reference-el":b.referenceEl,"trigger-target-el":b.triggerTargetEl,"show-after":b.showAfter,strategy:b.strategy,teleported:b.teleported,transition:b.transition,"virtual-triggering":b.virtualTriggering,"z-index":b.zIndex,"append-to":b.appendTo},{default:vue.withCtx(()=>[vue.renderSlot(b.$slots,"content",{},()=>[b.rawContent?(vue.openBlock(),vue.createElementBlock("span",{key:0,innerHTML:b.content},null,8,_hoisted_1$6)):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$4,vue.toDisplayString(b.content),1))]),b.showArrow?(vue.openBlock(),vue.createBlock(vue.unref(ElPopperArrow),{key:0,"arrow-offset":b.arrowOffset},null,8,["arrow-offset"])):vue.createCommentVNode("v-if",!0)]),_:3},8,["aria-label","boundaries-padding","content","disabled","effect","enterable","fallback-placements","hide-after","gpu-acceleration","offset","persistent","popper-class","popper-style","placement","popper-options","pure","raw-content","reference-el","trigger-target-el","show-after","strategy","teleported","transition","virtual-triggering","z-index","append-to"])]),_:3},8,["role"]))}});var Tooltip=_export_sfc(_sfc_main$d,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/tooltip.vue"]]);const ElTooltip=withInstall(Tooltip);var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const nodeList=new Map;let startClick;isClient&&(document.addEventListener("mousedown",r=>startClick=r),document.addEventListener("mouseup",r=>{for(const n of nodeList.values())for(const{documentHandler:i}of n)i(r,startClick)}));function createDocumentHandler(r,n){let i=[];return Array.isArray(n.arg)?i=n.arg:isElement(n.arg)&&i.push(n.arg),function(o,a){const u=n.instance.popperRef,c=o.target,f=a==null?void 0:a.target,d=!n||!n.instance,p=!c||!f,h=r.contains(c)||r.contains(f),g=r===c,v=i.length&&i.some(A=>A==null?void 0:A.contains(c))||i.length&&i.includes(f),y=u&&(u.contains(c)||u.contains(f));d||p||h||g||v||y||n.value(o,a)}}const ClickOutside={beforeMount(r,n){nodeList.has(r)||nodeList.set(r,[]),nodeList.get(r).push({documentHandler:createDocumentHandler(r,n),bindingFn:n.value})},updated(r,n){nodeList.has(r)||nodeList.set(r,[]);const i=nodeList.get(r),o=i.findIndex(u=>u.bindingFn===n.oldValue),a={documentHandler:createDocumentHandler(r,n),bindingFn:n.value};o>=0?i.splice(o,1,a):i.push(a)},unmounted(r){nodeList.delete(r)}},tagProps=buildProps({type:{type:String,values:["success","info","warning","danger",""],default:""},closable:Boolean,disableTransitions:Boolean,hit:Boolean,color:{type:String,default:""},size:{type:String,values:componentSizes,default:""},effect:{type:String,values:["dark","light","plain"],default:"light"},round:Boolean}),tagEmits={close:r=>r instanceof MouseEvent,click:r=>r instanceof MouseEvent},__default__=vue.defineComponent({name:"ElTag"}),_sfc_main$c=vue.defineComponent({...__default__,props:tagProps,emits:tagEmits,setup(r,{emit:n}){const i=r,o=useFormSize(),a=useNamespace("tag"),u=vue.computed(()=>{const{type:d,hit:p,effect:h,closable:g,round:v}=i;return[a.b(),a.is("closable",g),a.m(d),a.m(o.value),a.m(h),a.is("hit",p),a.is("round",v)]}),c=d=>{n("close",d)},f=d=>{n("click",d)};return(d,p)=>d.disableTransitions?(vue.openBlock(),vue.createElementBlock("span",{key:0,class:vue.normalizeClass(vue.unref(u)),style:vue.normalizeStyle({backgroundColor:d.color}),onClick:f},[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(a).e("content"))},[vue.renderSlot(d.$slots,"default")],2),d.closable?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:0,class:vue.normalizeClass(vue.unref(a).e("close")),onClick:vue.withModifiers(c,["stop"])},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(close_default))]),_:1},8,["class","onClick"])):vue.createCommentVNode("v-if",!0)],6)):(vue.openBlock(),vue.createBlock(vue.Transition,{key:1,name:`${vue.unref(a).namespace.value}-zoom-in-center`,appear:""},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(u)),style:vue.normalizeStyle({backgroundColor:d.color}),onClick:f},[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(a).e("content"))},[vue.renderSlot(d.$slots,"default")],2),d.closable?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:0,class:vue.normalizeClass(vue.unref(a).e("close")),onClick:vue.withModifiers(c,["stop"])},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(close_default))]),_:1},8,["class","onClick"])):vue.createCommentVNode("v-if",!0)],6)]),_:3},8,["name"]))}});var Tag=_export_sfc(_sfc_main$c,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tag/src/tag.vue"]]);const ElTag=withInstall(Tag),selectGroupKey=Symbol("ElSelectGroup"),selectKey=Symbol("ElSelect");function useOption(r,n){const i=vue.inject(selectKey),o=vue.inject(selectGroupKey,{disabled:!1}),a=vue.computed(()=>Object.prototype.toString.call(r.value).toLowerCase()==="[object object]"),u=vue.computed(()=>i.props.multiple?g(i.props.modelValue,r.value):v(r.value,i.props.modelValue)),c=vue.computed(()=>{if(i.props.multiple){const _=i.props.modelValue||[];return!u.value&&_.length>=i.props.multipleLimit&&i.props.multipleLimit>0}else return!1}),f=vue.computed(()=>r.label||(a.value?"":r.value)),d=vue.computed(()=>r.value||r.label||""),p=vue.computed(()=>r.disabled||n.groupDisabled||c.value),h=vue.getCurrentInstance(),g=(_=[],S)=>{if(a.value){const b=i.props.valueKey;return _&&_.some(T=>vue.toRaw(lodashEs.get(T,b))===lodashEs.get(S,b))}else return _&&_.includes(S)},v=(_,S)=>{if(a.value){const{valueKey:b}=i.props;return lodashEs.get(_,b)===lodashEs.get(S,b)}else return _===S},y=()=>{!r.disabled&&!o.disabled&&(i.hoverIndex=i.optionsArray.indexOf(h.proxy))};vue.watch(()=>f.value,()=>{!r.created&&!i.props.remote&&i.setSelected()}),vue.watch(()=>r.value,(_,S)=>{const{remote:b,valueKey:T}=i.props;if(Object.is(_,S)||(i.onOptionDestroy(S,h.proxy),i.onOptionCreate(h.proxy)),!r.created&&!b){if(T&&typeof _=="object"&&typeof S=="object"&&_[T]===S[T])return;i.setSelected()}}),vue.watch(()=>o.disabled,()=>{n.groupDisabled=o.disabled},{immediate:!0});const{queryChange:A}=vue.toRaw(i);return vue.watch(A,_=>{const{query:S}=vue.unref(_),b=new RegExp(escapeStringRegexp(S),"i");n.visible=b.test(f.value)||r.created,n.visible||i.filteredOptionsCount--},{immediate:!0}),{select:i,currentLabel:f,currentValue:d,itemSelected:u,isDisabled:p,hoverItem:y}}const _sfc_main$b=vue.defineComponent({name:"ElOption",componentName:"ElOption",props:{value:{required:!0,type:[String,Number,Boolean,Object]},label:[String,Number],created:Boolean,disabled:{type:Boolean,default:!1}},setup(r){const n=useNamespace("select"),i=vue.computed(()=>[n.be("dropdown","item"),n.is("disabled",vue.unref(c)),{selected:vue.unref(u),hover:vue.unref(h)}]),o=vue.reactive({index:-1,groupDisabled:!1,visible:!0,hitState:!1,hover:!1}),{currentLabel:a,itemSelected:u,isDisabled:c,select:f,hoverItem:d}=useOption(r,o),{visible:p,hover:h}=vue.toRefs(o),g=vue.getCurrentInstance().proxy;f.onOptionCreate(g),vue.onBeforeUnmount(()=>{const y=g.value,{selected:A}=f,S=(f.props.multiple?A:[A]).some(b=>b.value===g.value);vue.nextTick(()=>{f.cachedOptions.get(y)===g&&!S&&f.cachedOptions.delete(y)}),f.onOptionDestroy(y,g)});function v(){r.disabled!==!0&&o.groupDisabled!==!0&&f.handleOptionSelect(g)}return{ns:n,containerKls:i,currentLabel:a,itemSelected:u,isDisabled:c,select:f,hoverItem:d,visible:p,hover:h,selectOptionClick:v,states:o}}});function _sfc_render$3(r,n,i,o,a,u){return vue.withDirectives((vue.openBlock(),vue.createElementBlock("li",{class:vue.normalizeClass(r.containerKls),onMouseenter:n[0]||(n[0]=(...c)=>r.hoverItem&&r.hoverItem(...c)),onClick:n[1]||(n[1]=vue.withModifiers((...c)=>r.selectOptionClick&&r.selectOptionClick(...c),["stop"]))},[vue.renderSlot(r.$slots,"default",{},()=>[vue.createElementVNode("span",null,vue.toDisplayString(r.currentLabel),1)])],34)),[[vue.vShow,r.visible]])}var Option=_export_sfc(_sfc_main$b,[["render",_sfc_render$3],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/option.vue"]]);const _sfc_main$a=vue.defineComponent({name:"ElSelectDropdown",componentName:"ElSelectDropdown",setup(){const r=vue.inject(selectKey),n=useNamespace("select"),i=vue.computed(()=>r.props.popperClass),o=vue.computed(()=>r.props.multiple),a=vue.computed(()=>r.props.fitInputWidth),u=vue.ref("");function c(){var f;u.value=`${(f=r.selectWrapper)==null?void 0:f.offsetWidth}px`}return vue.onMounted(()=>{c(),useResizeObserver(r.selectWrapper,c)}),{ns:n,minWidth:u,popperClass:i,isMultiple:o,isFitInputWidth:a}}});function _sfc_render$2(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass([r.ns.b("dropdown"),r.ns.is("multiple",r.isMultiple),r.popperClass]),style:vue.normalizeStyle({[r.isFitInputWidth?"width":"minWidth"]:r.minWidth})},[vue.renderSlot(r.$slots,"default")],6)}var ElSelectMenu=_export_sfc(_sfc_main$a,[["render",_sfc_render$2],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/select-dropdown.vue"]]);function useSelectStates(r){const{t:n}=useLocale();return vue.reactive({options:new Map,cachedOptions:new Map,createdLabel:null,createdSelected:!1,selected:r.multiple?[]:{},inputLength:20,inputWidth:0,optionsCount:0,filteredOptionsCount:0,visible:!1,selectedLabel:"",hoverIndex:-1,query:"",previousQuery:null,inputHovering:!1,cachedPlaceHolder:"",currentPlaceholder:n("el.select.placeholder"),menuVisibleOnFocus:!1,isOnComposition:!1,prefixWidth:11,mouseEnter:!1})}let ignoreFocusEvent=!1;const useSelect=(r,n,i)=>{const{t:o}=useLocale(),a=useNamespace("select");useDeprecated({from:"suffixTransition",replacement:"override style scheme",version:"2.3.0",scope:"props",ref:"https://element-plus.org/en-US/component/select.html#select-attributes"},vue.computed(()=>r.suffixTransition===!1));const u=vue.ref(null),c=vue.ref(null),f=vue.ref(null),d=vue.ref(null),p=vue.ref(null),h=vue.ref(null),g=vue.ref(null),v=vue.ref(null),y=vue.ref(-1),A=vue.shallowRef({query:""}),_=vue.shallowRef(""),S=vue.ref([]);let b=0;const{form:T,formItem:w}=useFormItem(),x=vue.computed(()=>!r.filterable||r.multiple||!n.visible),k=vue.computed(()=>r.disabled||(T==null?void 0:T.disabled)),M=vue.computed(()=>{const vn=r.multiple?Array.isArray(r.modelValue)&&r.modelValue.length>0:r.modelValue!==void 0&&r.modelValue!==null&&r.modelValue!=="";return r.clearable&&!k.value&&n.inputHovering&&vn}),D=vue.computed(()=>r.remote&&r.filterable&&!r.remoteShowSuffix?"":r.suffixIcon),z=vue.computed(()=>a.is("reverse",D.value&&n.visible&&r.suffixTransition)),j=vue.computed(()=>r.remote?300:0),oe=vue.computed(()=>r.loading?r.loadingText||o("el.select.loading"):r.remote&&n.query===""&&n.options.size===0?!1:r.filterable&&n.query&&n.options.size>0&&n.filteredOptionsCount===0?r.noMatchText||o("el.select.noMatch"):n.options.size===0?r.noDataText||o("el.select.noData"):null),L=vue.computed(()=>{const vn=Array.from(n.options.values()),_n=[];return S.value.forEach(bn=>{const Sn=vn.findIndex(Ln=>Ln.currentLabel===bn);Sn>-1&&_n.push(vn[Sn])}),_n.length?_n:vn}),F=vue.computed(()=>Array.from(n.cachedOptions.values())),O=vue.computed(()=>{const vn=L.value.filter(_n=>!_n.created).some(_n=>_n.currentLabel===n.query);return r.filterable&&r.allowCreate&&n.query!==""&&!vn}),ue=useFormSize(),_e=vue.computed(()=>["small"].includes(ue.value)?"small":"default"),Ce=vue.computed({get(){return n.visible&&oe.value!==!1},set(vn){n.visible=vn}});vue.watch([()=>k.value,()=>ue.value,()=>T==null?void 0:T.size],()=>{vue.nextTick(()=>{de()})}),vue.watch(()=>r.placeholder,vn=>{n.cachedPlaceHolder=n.currentPlaceholder=vn,r.multiple&&Array.isArray(r.modelValue)&&r.modelValue.length>0&&(n.currentPlaceholder="")}),vue.watch(()=>r.modelValue,(vn,_n)=>{r.multiple&&(de(),vn&&vn.length>0||c.value&&n.query!==""?n.currentPlaceholder="":n.currentPlaceholder=n.cachedPlaceHolder,r.filterable&&!r.reserveKeyword&&(n.query="",ie(n.query))),Oe(),r.filterable&&!r.multiple&&(n.inputLength=20),!lodashEs.isEqual(vn,_n)&&r.validateEvent&&(w==null||w.validate("change").catch(bn=>debugWarn(bn)))},{flush:"post",deep:!0}),vue.watch(()=>n.visible,vn=>{var _n,bn,Sn,Ln,Bn;vn?((bn=(_n=d.value)==null?void 0:_n.updatePopper)==null||bn.call(_n),r.filterable&&(n.filteredOptionsCount=n.optionsCount,n.query=r.remote?"":n.selectedLabel,(Ln=(Sn=f.value)==null?void 0:Sn.focus)==null||Ln.call(Sn),r.multiple?(Bn=c.value)==null||Bn.focus():n.selectedLabel&&(n.currentPlaceholder=`${n.selectedLabel}`,n.selectedLabel=""),ie(n.query),!r.multiple&&!r.remote&&(A.value.query="",vue.triggerRef(A),vue.triggerRef(_)))):(r.filterable&&(isFunction(r.filterMethod)&&r.filterMethod(""),isFunction(r.remoteMethod)&&r.remoteMethod("")),c.value&&c.value.blur(),n.query="",n.previousQuery=null,n.selectedLabel="",n.inputLength=20,n.menuVisibleOnFocus=!1,Dt(),vue.nextTick(()=>{c.value&&c.value.value===""&&n.selected.length===0&&(n.currentPlaceholder=n.cachedPlaceHolder)}),r.multiple||(n.selected&&(r.filterable&&r.allowCreate&&n.createdSelected&&n.createdLabel?n.selectedLabel=n.createdLabel:n.selectedLabel=n.selected.currentLabel,r.filterable&&(n.query=n.selectedLabel)),r.filterable&&(n.currentPlaceholder=n.cachedPlaceHolder))),i.emit("visible-change",vn)}),vue.watch(()=>n.options.entries(),()=>{var vn,_n,bn;if(!isClient)return;(_n=(vn=d.value)==null?void 0:vn.updatePopper)==null||_n.call(vn),r.multiple&&de();const Sn=((bn=g.value)==null?void 0:bn.querySelectorAll("input"))||[];Array.from(Sn).includes(document.activeElement)||Oe(),r.defaultFirstOption&&(r.filterable||r.remote)&&n.filteredOptionsCount&&Ie()},{flush:"post"}),vue.watch(()=>n.hoverIndex,vn=>{isNumber(vn)&&vn>-1?y.value=L.value[vn]||{}:y.value={},L.value.forEach(_n=>{_n.hover=y.value===_n})});const de=()=>{vue.nextTick(()=>{var vn,_n;if(!u.value)return;const bn=u.value.$el.querySelector("input");b=b||(bn.clientHeight>0?bn.clientHeight+2:0);const Sn=h.value,Ln=getComponentSize(ue.value||(T==null?void 0:T.size)),Bn=ue.value||Ln===b||b<=0?Ln:b;!(bn.offsetParent===null)&&(bn.style.height=`${(n.selected.length===0?Bn:Math.max(Sn?Sn.clientHeight+(Sn.clientHeight>Bn?6:0):0,Bn))-2}px`),n.visible&&oe.value!==!1&&((_n=(vn=d.value)==null?void 0:vn.updatePopper)==null||_n.call(vn))})},ie=async vn=>{if(!(n.previousQuery===vn||n.isOnComposition)){if(n.previousQuery===null&&(isFunction(r.filterMethod)||isFunction(r.remoteMethod))){n.previousQuery=vn;return}n.previousQuery=vn,vue.nextTick(()=>{var _n,bn;n.visible&&((bn=(_n=d.value)==null?void 0:_n.updatePopper)==null||bn.call(_n))}),n.hoverIndex=-1,r.multiple&&r.filterable&&vue.nextTick(()=>{const _n=c.value.value.length*15+20;n.inputLength=r.collapseTags?Math.min(50,_n):_n,Y(),de()}),r.remote&&isFunction(r.remoteMethod)?(n.hoverIndex=-1,r.remoteMethod(vn)):isFunction(r.filterMethod)?(r.filterMethod(vn),vue.triggerRef(_)):(n.filteredOptionsCount=n.optionsCount,A.value.query=vn,vue.triggerRef(A),vue.triggerRef(_)),r.defaultFirstOption&&(r.filterable||r.remote)&&n.filteredOptionsCount&&(await vue.nextTick(),Ie())}},Y=()=>{n.currentPlaceholder!==""&&(n.currentPlaceholder=c.value.value?"":n.cachedPlaceHolder)},Ie=()=>{const vn=L.value.filter(Sn=>Sn.visible&&!Sn.disabled&&!Sn.states.groupDisabled),_n=vn.find(Sn=>Sn.created),bn=vn[0];n.hoverIndex=xe(L.value,_n||bn)},Oe=()=>{var vn;if(r.multiple)n.selectedLabel="";else{const bn=kt(r.modelValue);(vn=bn.props)!=null&&vn.created?(n.createdLabel=bn.props.value,n.createdSelected=!0):n.createdSelected=!1,n.selectedLabel=bn.currentLabel,n.selected=bn,r.filterable&&(n.query=n.selectedLabel);return}const _n=[];Array.isArray(r.modelValue)&&r.modelValue.forEach(bn=>{_n.push(kt(bn))}),n.selected=_n,vue.nextTick(()=>{de()})},kt=vn=>{let _n;const bn=toRawType(vn).toLowerCase()==="object",Sn=toRawType(vn).toLowerCase()==="null",Ln=toRawType(vn).toLowerCase()==="undefined";for(let Dn=n.cachedOptions.size-1;Dn>=0;Dn--){const Vn=F.value[Dn];if(bn?lodashEs.get(Vn.value,r.valueKey)===lodashEs.get(vn,r.valueKey):Vn.value===vn){_n={value:vn,currentLabel:Vn.currentLabel,isDisabled:Vn.isDisabled};break}}if(_n)return _n;const Bn=bn?vn.label:!Sn&&!Ln?vn:"",On={value:vn,currentLabel:Bn};return r.multiple&&(On.hitState=!1),On},Dt=()=>{setTimeout(()=>{const vn=r.valueKey;r.multiple?n.selected.length>0?n.hoverIndex=Math.min.apply(null,n.selected.map(_n=>L.value.findIndex(bn=>lodashEs.get(bn,vn)===lodashEs.get(_n,vn)))):n.hoverIndex=-1:n.hoverIndex=L.value.findIndex(_n=>Tn(_n)===Tn(n.selected))},300)},Fe=()=>{var vn,_n;$e(),(_n=(vn=d.value)==null?void 0:vn.updatePopper)==null||_n.call(vn),r.multiple&&de()},$e=()=>{var vn;n.inputWidth=(vn=u.value)==null?void 0:vn.$el.offsetWidth},Cn=()=>{r.filterable&&n.query!==n.selectedLabel&&(n.query=n.selectedLabel,ie(n.query))},Lt=lodashEs.debounce(()=>{Cn()},j.value),In=lodashEs.debounce(vn=>{ie(vn.target.value)},j.value),Et=vn=>{lodashEs.isEqual(r.modelValue,vn)||i.emit(CHANGE_EVENT,vn)},Ne=vn=>{if(vn.code!==EVENT_CODE.delete){if(vn.target.value.length<=0&&!re()){const _n=r.modelValue.slice();_n.pop(),i.emit(UPDATE_MODEL_EVENT,_n),Et(_n)}vn.target.value.length===1&&r.modelValue.length===0&&(n.currentPlaceholder=n.cachedPlaceHolder)}},pe=(vn,_n)=>{const bn=n.selected.indexOf(_n);if(bn>-1&&!k.value){const Sn=r.modelValue.slice();Sn.splice(bn,1),i.emit(UPDATE_MODEL_EVENT,Sn),Et(Sn),i.emit("remove-tag",_n.value)}vn.stopPropagation()},At=vn=>{vn.stopPropagation();const _n=r.multiple?[]:"";if(!isString(_n))for(const bn of n.selected)bn.isDisabled&&_n.push(bn.value);i.emit(UPDATE_MODEL_EVENT,_n),Et(_n),n.hoverIndex=-1,n.visible=!1,i.emit("clear")},Ve=vn=>{var _n;if(r.multiple){const bn=(r.modelValue||[]).slice(),Sn=xe(bn,vn.value);Sn>-1?bn.splice(Sn,1):(r.multipleLimit<=0||bn.length<r.multipleLimit)&&bn.push(vn.value),i.emit(UPDATE_MODEL_EVENT,bn),Et(bn),vn.created&&(n.query="",ie(""),n.inputLength=20),r.filterable&&((_n=c.value)==null||_n.focus())}else i.emit(UPDATE_MODEL_EVENT,vn.value),Et(vn.value),n.visible=!1;ze(),!n.visible&&vue.nextTick(()=>{Pt(vn)})},xe=(vn=[],_n)=>{if(!isObject(_n))return vn.indexOf(_n);const bn=r.valueKey;let Sn=-1;return vn.some((Ln,Bn)=>vue.toRaw(lodashEs.get(Ln,bn))===lodashEs.get(_n,bn)?(Sn=Bn,!0):!1),Sn},ze=()=>{const vn=c.value||u.value;vn&&(vn==null||vn.focus())},Pt=vn=>{var _n,bn,Sn,Ln,Bn;const On=Array.isArray(vn)?vn[0]:vn;let Dn=null;if(On!=null&&On.value){const Vn=L.value.filter(Zn=>Zn.value===On.value);Vn.length>0&&(Dn=Vn[0].$el)}if(d.value&&Dn){const Vn=(Ln=(Sn=(bn=(_n=d.value)==null?void 0:_n.popperRef)==null?void 0:bn.contentRef)==null?void 0:Sn.querySelector)==null?void 0:Ln.call(Sn,`.${a.be("dropdown","wrap")}`);Vn&&scrollIntoView(Vn,Dn)}(Bn=v.value)==null||Bn.handleScroll()},hn=vn=>{n.optionsCount++,n.filteredOptionsCount++,n.options.set(vn.value,vn),n.cachedOptions.set(vn.value,vn)},ae=(vn,_n)=>{n.options.get(vn)===_n&&(n.optionsCount--,n.filteredOptionsCount--,n.options.delete(vn))},le=vn=>{vn.code!==EVENT_CODE.backspace&&re(!1),n.inputLength=c.value.value.length*15+20,de()},re=vn=>{if(!Array.isArray(n.selected))return;const _n=n.selected[n.selected.length-1];if(_n)return vn===!0||vn===!1?(_n.hitState=vn,vn):(_n.hitState=!_n.hitState,_n.hitState)},V=vn=>{const _n=vn.target.value;if(vn.type==="compositionend")n.isOnComposition=!1,vue.nextTick(()=>ie(_n));else{const bn=_n[_n.length-1]||"";n.isOnComposition=!isKorean(bn)}},$=()=>{vue.nextTick(()=>Pt(n.selected))},he=vn=>{ignoreFocusEvent?ignoreFocusEvent=!1:((r.automaticDropdown||r.filterable)&&(r.filterable&&!n.visible&&(n.menuVisibleOnFocus=!0),n.visible=!0),i.emit("focus",vn))},Ue=()=>{var vn,_n,bn;n.visible=!1,(vn=u.value)==null||vn.blur(),(bn=(_n=f.value)==null?void 0:_n.blur)==null||bn.call(_n)},qe=vn=>{setTimeout(()=>{var _n;if((_n=d.value)!=null&&_n.isFocusInsideContent()){ignoreFocusEvent=!0;return}n.visible&&An(),i.emit("blur",vn)})},jt=vn=>{At(vn)},An=()=>{n.visible=!1},wn=vn=>{n.visible&&(vn.preventDefault(),vn.stopPropagation(),n.visible=!1)},En=vn=>{var _n;vn&&!n.mouseEnter||k.value||(n.menuVisibleOnFocus?n.menuVisibleOnFocus=!1:(!d.value||!d.value.isFocusInsideContent())&&(n.visible=!n.visible),n.visible&&((_n=c.value||u.value)==null||_n.focus()))},xn=()=>{n.visible?L.value[n.hoverIndex]&&Ve(L.value[n.hoverIndex]):En()},Tn=vn=>isObject(vn.value)?lodashEs.get(vn.value,r.valueKey):vn.value,Pn=vue.computed(()=>L.value.filter(vn=>vn.visible).every(vn=>vn.disabled)),kn=vue.computed(()=>n.selected.slice(0,r.maxCollapseTags)),Rn=vue.computed(()=>n.selected.slice(r.maxCollapseTags)),Nn=vn=>{if(!n.visible){n.visible=!0;return}if(!(n.options.size===0||n.filteredOptionsCount===0)&&!n.isOnComposition&&!Pn.value){vn==="next"?(n.hoverIndex++,n.hoverIndex===n.options.size&&(n.hoverIndex=0)):vn==="prev"&&(n.hoverIndex--,n.hoverIndex<0&&(n.hoverIndex=n.options.size-1));const _n=L.value[n.hoverIndex];(_n.disabled===!0||_n.states.groupDisabled===!0||!_n.visible)&&Nn(vn),vue.nextTick(()=>Pt(y.value))}};return{optionList:S,optionsArray:L,selectSize:ue,handleResize:Fe,debouncedOnInputChange:Lt,debouncedQueryChange:In,deletePrevTag:Ne,deleteTag:pe,deleteSelected:At,handleOptionSelect:Ve,scrollToOption:Pt,readonly:x,resetInputHeight:de,showClose:M,iconComponent:D,iconReverse:z,showNewOption:O,collapseTagSize:_e,setSelected:Oe,managePlaceholder:Y,selectDisabled:k,emptyText:oe,toggleLastOptionHitState:re,resetInputState:le,handleComposition:V,onOptionCreate:hn,onOptionDestroy:ae,handleMenuEnter:$,handleFocus:he,blur:Ue,handleBlur:qe,handleClearClick:jt,handleClose:An,handleKeydownEscape:wn,toggleMenu:En,selectOption:xn,getValueKey:Tn,navigateOptions:Nn,handleDeleteTooltipTag:(vn,_n)=>{var bn,Sn;pe(vn,_n),(Sn=(bn=p.value)==null?void 0:bn.updatePopper)==null||Sn.call(bn)},dropMenuVisible:Ce,queryChange:A,groupQueryChange:_,showTagList:kn,collapseTagList:Rn,reference:u,input:c,iOSInput:f,tooltipRef:d,tagTooltipRef:p,tags:h,selectWrapper:g,scrollbar:v,handleMouseEnter:()=>{n.mouseEnter=!0},handleMouseLeave:()=>{n.mouseEnter=!1}}};var ElOptions=vue.defineComponent({name:"ElOptions",emits:["update-options"],setup(r,{slots:n,emit:i}){let o=[];function a(u,c){if(u.length!==c.length)return!1;for(const[f]of u.entries())if(u[f]!=c[f])return!1;return!0}return()=>{var u,c;const f=(u=n.default)==null?void 0:u.call(n),d=[];function p(h){Array.isArray(h)&&h.forEach(g=>{var v,y,A,_;const S=(v=(g==null?void 0:g.type)||{})==null?void 0:v.name;S==="ElOptionGroup"?p(!isString(g.children)&&!Array.isArray(g.children)&&isFunction((y=g.children)==null?void 0:y.default)?(A=g.children)==null?void 0:A.default():g.children):S==="ElOption"?d.push((_=g.props)==null?void 0:_.label):Array.isArray(g.children)&&p(g.children)})}return f.length&&p((c=f[0])==null?void 0:c.children),a(d,o)||(o=d,i("update-options",d)),f}}});const COMPONENT_NAME="ElSelect",_sfc_main$9=vue.defineComponent({name:COMPONENT_NAME,componentName:COMPONENT_NAME,components:{ElInput,ElSelectMenu,ElOption:Option,ElOptions,ElTag,ElScrollbar,ElTooltip,ElIcon},directives:{ClickOutside},props:{name:String,id:String,modelValue:{type:[Array,String,Number,Boolean,Object],default:void 0},autocomplete:{type:String,default:"off"},automaticDropdown:Boolean,size:{type:String,validator:isValidComponentSize},effect:{type:String,default:"light"},disabled:Boolean,clearable:Boolean,filterable:Boolean,allowCreate:Boolean,loading:Boolean,popperClass:{type:String,default:""},popperOptions:{type:Object,default:()=>({})},remote:Boolean,loadingText:String,noMatchText:String,noDataText:String,remoteMethod:Function,filterMethod:Function,multiple:Boolean,multipleLimit:{type:Number,default:0},placeholder:{type:String},defaultFirstOption:Boolean,reserveKeyword:{type:Boolean,default:!0},valueKey:{type:String,default:"value"},collapseTags:Boolean,collapseTagsTooltip:{type:Boolean,default:!1},maxCollapseTags:{type:Number,default:1},teleported:useTooltipContentProps.teleported,persistent:{type:Boolean,default:!0},clearIcon:{type:iconPropType,default:circle_close_default},fitInputWidth:{type:Boolean,default:!1},suffixIcon:{type:iconPropType,default:arrow_down_default},tagType:{...tagProps.type,default:"info"},validateEvent:{type:Boolean,default:!0},remoteShowSuffix:{type:Boolean,default:!1},suffixTransition:{type:Boolean,default:!0},placement:{type:String,values:Ee,default:"bottom-start"}},emits:[UPDATE_MODEL_EVENT,CHANGE_EVENT,"remove-tag","clear","visible-change","focus","blur"],setup(r,n){const i=useNamespace("select"),o=useNamespace("input"),{t:a}=useLocale(),u=useSelectStates(r),{optionList:c,optionsArray:f,selectSize:d,readonly:p,handleResize:h,collapseTagSize:g,debouncedOnInputChange:v,debouncedQueryChange:y,deletePrevTag:A,deleteTag:_,deleteSelected:S,handleOptionSelect:b,scrollToOption:T,setSelected:w,resetInputHeight:x,managePlaceholder:k,showClose:M,selectDisabled:D,iconComponent:z,iconReverse:j,showNewOption:oe,emptyText:L,toggleLastOptionHitState:F,resetInputState:O,handleComposition:ue,onOptionCreate:_e,onOptionDestroy:Ce,handleMenuEnter:de,handleFocus:ie,blur:Y,handleBlur:Ie,handleClearClick:Oe,handleClose:kt,handleKeydownEscape:Dt,toggleMenu:Fe,selectOption:$e,getValueKey:Cn,navigateOptions:Lt,handleDeleteTooltipTag:In,dropMenuVisible:Et,reference:Ne,input:pe,iOSInput:At,tooltipRef:Ve,tagTooltipRef:xe,tags:ze,selectWrapper:Pt,scrollbar:hn,queryChange:ae,groupQueryChange:le,handleMouseEnter:re,handleMouseLeave:V,showTagList:$,collapseTagList:he}=useSelect(r,u,n),{focus:Ue}=useFocus(Ne),{inputWidth:qe,selected:jt,inputLength:An,filteredOptionsCount:wn,visible:En,selectedLabel:xn,hoverIndex:Tn,query:Pn,inputHovering:kn,currentPlaceholder:Rn,menuVisibleOnFocus:Nn,isOnComposition:$n,options:Fn,cachedOptions:Wn,optionsCount:vn,prefixWidth:_n}=vue.toRefs(u),bn=vue.computed(()=>{const Mn=[i.b()],Gn=vue.unref(d);return Gn&&Mn.push(i.m(Gn)),r.disabled&&Mn.push(i.m("disabled")),Mn}),Sn=vue.computed(()=>[i.e("tags"),i.is("disabled",vue.unref(D))]),Ln=vue.computed(()=>[i.b("tags-wrapper"),{"has-prefix":vue.unref(_n)&&vue.unref(jt).length}]),Bn=vue.computed(()=>[i.e("input"),i.is(vue.unref(d)),i.is("disabled",vue.unref(D))]),On=vue.computed(()=>[i.e("input"),i.is(vue.unref(d)),i.em("input","iOS")]),Dn=vue.computed(()=>[i.is("empty",!r.allowCreate&&!!vue.unref(Pn)&&vue.unref(wn)===0)]),Vn=vue.computed(()=>({maxWidth:`${vue.unref(qe)-32}px`,width:"100%"})),Zn=vue.computed(()=>({maxWidth:`${vue.unref(qe)>123?vue.unref(qe)-123:vue.unref(qe)-75}px`})),Hn=vue.computed(()=>({marginLeft:`${vue.unref(_n)}px`,flexGrow:1,width:`${vue.unref(An)/(vue.unref(qe)-32)}%`,maxWidth:`${vue.unref(qe)-42}px`}));vue.provide(selectKey,vue.reactive({props:r,options:Fn,optionsArray:f,cachedOptions:Wn,optionsCount:vn,filteredOptionsCount:wn,hoverIndex:Tn,handleOptionSelect:b,onOptionCreate:_e,onOptionDestroy:Ce,selectWrapper:Pt,selected:jt,setSelected:w,queryChange:ae,groupQueryChange:le})),vue.onMounted(()=>{u.cachedPlaceHolder=Rn.value=r.placeholder||(()=>a("el.select.placeholder")),r.multiple&&Array.isArray(r.modelValue)&&r.modelValue.length>0&&(Rn.value=""),useResizeObserver(Pt,h),r.remote&&r.multiple&&x(),vue.nextTick(()=>{const Mn=Ne.value&&Ne.value.$el;if(Mn&&(qe.value=Mn.getBoundingClientRect().width,n.slots.prefix)){const Gn=Mn.querySelector(`.${o.e("prefix")}`);_n.value=Math.max(Gn.getBoundingClientRect().width+11,30)}}),w()}),r.multiple&&!Array.isArray(r.modelValue)&&n.emit(UPDATE_MODEL_EVENT,[]),!r.multiple&&Array.isArray(r.modelValue)&&n.emit(UPDATE_MODEL_EVENT,"");const zn=vue.computed(()=>{var Mn,Gn;return(Gn=(Mn=Ve.value)==null?void 0:Mn.popperRef)==null?void 0:Gn.contentRef});return{isIOS,onOptionsRendered:Mn=>{c.value=Mn},prefixWidth:_n,selectSize:d,readonly:p,handleResize:h,collapseTagSize:g,debouncedOnInputChange:v,debouncedQueryChange:y,deletePrevTag:A,deleteTag:_,handleDeleteTooltipTag:In,deleteSelected:S,handleOptionSelect:b,scrollToOption:T,inputWidth:qe,selected:jt,inputLength:An,filteredOptionsCount:wn,visible:En,selectedLabel:xn,hoverIndex:Tn,query:Pn,inputHovering:kn,currentPlaceholder:Rn,menuVisibleOnFocus:Nn,isOnComposition:$n,options:Fn,resetInputHeight:x,managePlaceholder:k,showClose:M,selectDisabled:D,iconComponent:z,iconReverse:j,showNewOption:oe,emptyText:L,toggleLastOptionHitState:F,resetInputState:O,handleComposition:ue,handleMenuEnter:de,handleFocus:ie,blur:Y,handleBlur:Ie,handleClearClick:Oe,handleClose:kt,handleKeydownEscape:Dt,toggleMenu:Fe,selectOption:$e,getValueKey:Cn,navigateOptions:Lt,dropMenuVisible:Et,focus:Ue,reference:Ne,input:pe,iOSInput:At,tooltipRef:Ve,popperPaneRef:zn,tags:ze,selectWrapper:Pt,scrollbar:hn,wrapperKls:bn,tagsKls:Sn,tagWrapperKls:Ln,inputKls:Bn,iOSInputKls:On,scrollbarKls:Dn,selectTagsStyle:Vn,nsSelect:i,tagTextStyle:Zn,inputStyle:Hn,handleMouseEnter:re,handleMouseLeave:V,showTagList:$,collapseTagList:he,tagTooltipRef:xe}}}),_hoisted_1$5=["disabled","autocomplete"],_hoisted_2$3=["disabled"],_hoisted_3$3={style:{height:"100%",display:"flex","justify-content":"center","align-items":"center"}};function _sfc_render$1(r,n,i,o,a,u){const c=vue.resolveComponent("el-tag"),f=vue.resolveComponent("el-tooltip"),d=vue.resolveComponent("el-icon"),p=vue.resolveComponent("el-input"),h=vue.resolveComponent("el-option"),g=vue.resolveComponent("el-options"),v=vue.resolveComponent("el-scrollbar"),y=vue.resolveComponent("el-select-menu"),A=vue.resolveDirective("click-outside");return vue.withDirectives((vue.openBlock(),vue.createElementBlock("div",{ref:"selectWrapper",class:vue.normalizeClass(r.wrapperKls),onMouseenter:n[21]||(n[21]=(..._)=>r.handleMouseEnter&&r.handleMouseEnter(..._)),onMouseleave:n[22]||(n[22]=(..._)=>r.handleMouseLeave&&r.handleMouseLeave(..._)),onClick:n[23]||(n[23]=vue.withModifiers((..._)=>r.toggleMenu&&r.toggleMenu(..._),["stop"]))},[vue.createVNode(f,{ref:"tooltipRef",visible:r.dropMenuVisible,placement:r.placement,teleported:r.teleported,"popper-class":[r.nsSelect.e("popper"),r.popperClass],"popper-options":r.popperOptions,"fallback-placements":["bottom-start","top-start","right","left"],effect:r.effect,pure:"",trigger:"click",transition:`${r.nsSelect.namespace.value}-zoom-in-top`,"stop-popper-mouse-event":!1,"gpu-acceleration":!1,persistent:r.persistent,onShow:r.handleMenuEnter},{default:vue.withCtx(()=>[vue.createElementVNode("div",{class:"select-trigger",onMouseenter:n[19]||(n[19]=_=>r.inputHovering=!0),onMouseleave:n[20]||(n[20]=_=>r.inputHovering=!1)},[r.multiple?(vue.openBlock(),vue.createElementBlock("div",{key:0,ref:"tags",class:vue.normalizeClass(r.tagsKls),style:vue.normalizeStyle(r.selectTagsStyle)},[r.collapseTags&&r.selected.length?(vue.openBlock(),vue.createBlock(vue.Transition,{key:0,onAfterLeave:r.resetInputHeight},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(r.tagWrapperKls)},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.showTagList,_=>(vue.openBlock(),vue.createBlock(c,{key:r.getValueKey(_),closable:!r.selectDisabled&&!_.isDisabled,size:r.collapseTagSize,hit:_.hitState,type:r.tagType,"disable-transitions":"",onClose:S=>r.deleteTag(S,_)},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(r.nsSelect.e("tags-text")),style:vue.normalizeStyle(r.tagTextStyle)},vue.toDisplayString(_.currentLabel),7)]),_:2},1032,["closable","size","hit","type","onClose"]))),128)),r.selected.length>r.maxCollapseTags?(vue.openBlock(),vue.createBlock(c,{key:0,closable:!1,size:r.collapseTagSize,type:r.tagType,"disable-transitions":""},{default:vue.withCtx(()=>[r.collapseTagsTooltip?(vue.openBlock(),vue.createBlock(f,{key:0,ref:"tagTooltipRef",disabled:r.dropMenuVisible,"fallback-placements":["bottom","top","right","left"],effect:r.effect,placement:"bottom",teleported:r.teleported},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(r.nsSelect.e("tags-text"))},"+ "+vue.toDisplayString(r.selected.length-r.maxCollapseTags),3)]),content:vue.withCtx(()=>[vue.createElementVNode("div",{class:vue.normalizeClass(r.nsSelect.e("collapse-tags"))},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.collapseTagList,_=>(vue.openBlock(),vue.createElementBlock("div",{key:r.getValueKey(_),class:vue.normalizeClass(r.nsSelect.e("collapse-tag"))},[vue.createVNode(c,{class:"in-tooltip",closable:!r.selectDisabled&&!_.isDisabled,size:r.collapseTagSize,hit:_.hitState,type:r.tagType,"disable-transitions":"",style:{margin:"2px"},onClose:S=>r.handleDeleteTooltipTag(S,_)},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(r.nsSelect.e("tags-text")),style:vue.normalizeStyle({maxWidth:r.inputWidth-75+"px"})},vue.toDisplayString(_.currentLabel),7)]),_:2},1032,["closable","size","hit","type","onClose"])],2))),128))],2)]),_:1},8,["disabled","effect","teleported"])):(vue.openBlock(),vue.createElementBlock("span",{key:1,class:vue.normalizeClass(r.nsSelect.e("tags-text"))},"+ "+vue.toDisplayString(r.selected.length-r.maxCollapseTags),3))]),_:1},8,["size","type"])):vue.createCommentVNode("v-if",!0)],2)]),_:1},8,["onAfterLeave"])):vue.createCommentVNode("v-if",!0),r.collapseTags?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createBlock(vue.Transition,{key:1,onAfterLeave:r.resetInputHeight},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(r.tagWrapperKls),style:vue.normalizeStyle(r.prefixWidth&&r.selected.length?{marginLeft:`${r.prefixWidth}px`}:"")},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.selected,_=>(vue.openBlock(),vue.createBlock(c,{key:r.getValueKey(_),closable:!r.selectDisabled&&!_.isDisabled,size:r.collapseTagSize,hit:_.hitState,type:r.tagType,"disable-transitions":"",onClose:S=>r.deleteTag(S,_)},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(r.nsSelect.e("tags-text")),style:vue.normalizeStyle({maxWidth:r.inputWidth-75+"px"})},vue.toDisplayString(_.currentLabel),7)]),_:2},1032,["closable","size","hit","type","onClose"]))),128))],6)]),_:1},8,["onAfterLeave"])),r.filterable&&!r.selectDisabled?vue.withDirectives((vue.openBlock(),vue.createElementBlock("input",{key:2,ref:"input","onUpdate:modelValue":n[0]||(n[0]=_=>r.query=_),type:"text",class:vue.normalizeClass(r.inputKls),disabled:r.selectDisabled,autocomplete:r.autocomplete,style:vue.normalizeStyle(r.inputStyle),onFocus:n[1]||(n[1]=(..._)=>r.handleFocus&&r.handleFocus(..._)),onBlur:n[2]||(n[2]=(..._)=>r.handleBlur&&r.handleBlur(..._)),onKeyup:n[3]||(n[3]=(..._)=>r.managePlaceholder&&r.managePlaceholder(..._)),onKeydown:[n[4]||(n[4]=(..._)=>r.resetInputState&&r.resetInputState(..._)),n[5]||(n[5]=vue.withKeys(vue.withModifiers(_=>r.navigateOptions("next"),["prevent"]),["down"])),n[6]||(n[6]=vue.withKeys(vue.withModifiers(_=>r.navigateOptions("prev"),["prevent"]),["up"])),n[7]||(n[7]=vue.withKeys((..._)=>r.handleKeydownEscape&&r.handleKeydownEscape(..._),["esc"])),n[8]||(n[8]=vue.withKeys(vue.withModifiers((..._)=>r.selectOption&&r.selectOption(..._),["stop","prevent"]),["enter"])),n[9]||(n[9]=vue.withKeys((..._)=>r.deletePrevTag&&r.deletePrevTag(..._),["delete"])),n[10]||(n[10]=vue.withKeys(_=>r.visible=!1,["tab"]))],onCompositionstart:n[11]||(n[11]=(..._)=>r.handleComposition&&r.handleComposition(..._)),onCompositionupdate:n[12]||(n[12]=(..._)=>r.handleComposition&&r.handleComposition(..._)),onCompositionend:n[13]||(n[13]=(..._)=>r.handleComposition&&r.handleComposition(..._)),onInput:n[14]||(n[14]=(..._)=>r.debouncedQueryChange&&r.debouncedQueryChange(..._))},null,46,_hoisted_1$5)),[[vue.vModelText,r.query]]):vue.createCommentVNode("v-if",!0)],6)):vue.createCommentVNode("v-if",!0),vue.createCommentVNode(" fix: https://github.com/element-plus/element-plus/issues/11415 "),r.isIOS&&!r.multiple&&r.filterable&&r.readonly?(vue.openBlock(),vue.createElementBlock("input",{key:1,ref:"iOSInput",class:vue.normalizeClass(r.iOSInputKls),disabled:r.selectDisabled,type:"text"},null,10,_hoisted_2$3)):vue.createCommentVNode("v-if",!0),vue.createVNode(p,{id:r.id,ref:"reference",modelValue:r.selectedLabel,"onUpdate:modelValue":n[15]||(n[15]=_=>r.selectedLabel=_),type:"text",placeholder:typeof r.currentPlaceholder=="function"?r.currentPlaceholder():r.currentPlaceholder,name:r.name,autocomplete:r.autocomplete,size:r.selectSize,disabled:r.selectDisabled,readonly:r.readonly,"validate-event":!1,class:vue.normalizeClass([r.nsSelect.is("focus",r.visible)]),tabindex:r.multiple&&r.filterable?-1:void 0,onFocus:r.handleFocus,onBlur:r.handleBlur,onInput:r.debouncedOnInputChange,onPaste:r.debouncedOnInputChange,onCompositionstart:r.handleComposition,onCompositionupdate:r.handleComposition,onCompositionend:r.handleComposition,onKeydown:[n[16]||(n[16]=vue.withKeys(vue.withModifiers(_=>r.navigateOptions("next"),["stop","prevent"]),["down"])),n[17]||(n[17]=vue.withKeys(vue.withModifiers(_=>r.navigateOptions("prev"),["stop","prevent"]),["up"])),vue.withKeys(vue.withModifiers(r.selectOption,["stop","prevent"]),["enter"]),vue.withKeys(r.handleKeydownEscape,["esc"]),n[18]||(n[18]=vue.withKeys(_=>r.visible=!1,["tab"]))]},vue.createSlots({suffix:vue.withCtx(()=>[r.iconComponent&&!r.showClose?(vue.openBlock(),vue.createBlock(d,{key:0,class:vue.normalizeClass([r.nsSelect.e("caret"),r.nsSelect.e("icon"),r.iconReverse])},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(r.iconComponent)))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0),r.showClose&&r.clearIcon?(vue.openBlock(),vue.createBlock(d,{key:1,class:vue.normalizeClass([r.nsSelect.e("caret"),r.nsSelect.e("icon")]),onClick:r.handleClearClick},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(r.clearIcon)))]),_:1},8,["class","onClick"])):vue.createCommentVNode("v-if",!0)]),_:2},[r.$slots.prefix?{name:"prefix",fn:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$3,[vue.renderSlot(r.$slots,"prefix")])])}:void 0]),1032,["id","modelValue","placeholder","name","autocomplete","size","disabled","readonly","class","tabindex","onFocus","onBlur","onInput","onPaste","onCompositionstart","onCompositionupdate","onCompositionend","onKeydown"])],32)]),content:vue.withCtx(()=>[vue.createVNode(y,null,{default:vue.withCtx(()=>[vue.withDirectives(vue.createVNode(v,{ref:"scrollbar",tag:"ul","wrap-class":r.nsSelect.be("dropdown","wrap"),"view-class":r.nsSelect.be("dropdown","list"),class:vue.normalizeClass(r.scrollbarKls)},{default:vue.withCtx(()=>[r.showNewOption?(vue.openBlock(),vue.createBlock(h,{key:0,value:r.query,created:!0},null,8,["value"])):vue.createCommentVNode("v-if",!0),vue.createVNode(g,{onUpdateOptions:r.onOptionsRendered},{default:vue.withCtx(()=>[vue.renderSlot(r.$slots,"default")]),_:3},8,["onUpdateOptions"])]),_:3},8,["wrap-class","view-class","class"]),[[vue.vShow,r.options.size>0&&!r.loading]]),r.emptyText&&(!r.allowCreate||r.loading||r.allowCreate&&r.options.size===0)?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:0},[r.$slots.empty?vue.renderSlot(r.$slots,"empty",{key:0}):(vue.openBlock(),vue.createElementBlock("p",{key:1,class:vue.normalizeClass(r.nsSelect.be("dropdown","empty"))},vue.toDisplayString(r.emptyText),3))],64)):vue.createCommentVNode("v-if",!0)]),_:3})]),_:3},8,["visible","placement","teleported","popper-class","popper-options","effect","transition","persistent","onShow"])],34)),[[A,r.handleClose,r.popperPaneRef]])}var Select=_export_sfc(_sfc_main$9,[["render",_sfc_render$1],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/select.vue"]]);const _sfc_main$8=vue.defineComponent({name:"ElOptionGroup",componentName:"ElOptionGroup",props:{label:String,disabled:{type:Boolean,default:!1}},setup(r){const n=useNamespace("select"),i=vue.ref(!0),o=vue.getCurrentInstance(),a=vue.ref([]);vue.provide(selectGroupKey,vue.reactive({...vue.toRefs(r)}));const u=vue.inject(selectKey);vue.onMounted(()=>{a.value=c(o.subTree)});const c=d=>{const p=[];return Array.isArray(d.children)&&d.children.forEach(h=>{var g;h.type&&h.type.name==="ElOption"&&h.component&&h.component.proxy?p.push(h.component.proxy):(g=h.children)!=null&&g.length&&p.push(...c(h))}),p},{groupQueryChange:f}=vue.toRaw(u);return vue.watch(f,()=>{i.value=a.value.some(d=>d.visible===!0)},{flush:"post"}),{visible:i,ns:n}}});function _sfc_render(r,n,i,o,a,u){return vue.withDirectives((vue.openBlock(),vue.createElementBlock("ul",{class:vue.normalizeClass(r.ns.be("group","wrap"))},[vue.createElementVNode("li",{class:vue.normalizeClass(r.ns.be("group","title"))},vue.toDisplayString(r.label),3),vue.createElementVNode("li",null,[vue.createElementVNode("ul",{class:vue.normalizeClass(r.ns.b("group"))},[vue.renderSlot(r.$slots,"default")],2)])],2)),[[vue.vShow,r.visible]])}var OptionGroup=_export_sfc(_sfc_main$8,[["render",_sfc_render],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/option-group.vue"]]);const ElSelect=withInstall(Select,{Option,OptionGroup}),ElOption=withNoopInstall(Option);withNoopInstall(OptionGroup);const _hoisted_1$4={class:"c-wall-d"},_sfc_main$7=vue.defineComponent({__name:"condition",props:{modelValue:{default:()=>({type:EConditionType.None})}},emits:["update:modelValue"],setup(r,{emit:n}){const i=r,o=vue.computed({get(){return i.modelValue},set(c){n("update:modelValue",c)}}),a=[{label:"大于",val:"greater"},{label:"大于等于",val:">="},{label:"小于",val:"<"},{label:"小于等于",val:"<="},{label:"等于",val:"=="},{label:"不等于",val:"!="},{label:"介于",val:">=,=<"},{label:"不介于",val:"<,>"}],u=c=>{c!=="None"&&(o.value.Relation={key:"",relation:"",val:"",val2:""}),n("update:modelValue",o)};return(c,f)=>{var d,p;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(o).type,"onUpdate:modelValue":f[0]||(f[0]=h=>vue.unref(o).type=h),onChange:u},{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(o).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(o).Relation.key,"onUpdate:modelValue":f[1]||(f[1]=h=>vue.unref(o).Relation.key=h)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(o).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(o).Relation.relation,"onUpdate:modelValue":f[2]||(f[2]=h=>vue.unref(o).Relation.relation=h)},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(a,(h,g)=>vue.createVNode(vue.unref(ElOption),{value:h.val,label:h.label,key:"rop"+g},null,8,["value","label"])),64))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(o).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(o).Relation.val,"onUpdate:modelValue":f[3]||(f[3]=h=>vue.unref(o).Relation.val=h)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(o).type==="Relation"&&(((d=vue.unref(o).Relation)==null?void 0:d.relation)===">=,=<"||((p=vue.unref(o).Relation)==null?void 0:p.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(o).Relation.val2,"onUpdate:modelValue":f[4]||(f[4]=h=>vue.unref(o).Relation.val2=h)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)])}}}),condition_vue_vue_type_style_index_0_scoped_f43f10e6_lang="",Condition=_export_sfc$1(_sfc_main$7,[["__scopeId","data-v-f43f10e6"]]),_sfc_main$6=vue.defineComponent({__name:"bind-anchor",props:{modelValue:{},title:{}},emits:["update:modelValue"],setup(r,{emit:n}){const i=r,o=useGlobalStore(pinia),a=vue.computed({get(){return i.modelValue!==null},set(h){let g=null;h&&(g={target_id:"",type:""}),n("update:modelValue",g)}}),u=vue.computed({get(){var h;return((h=i.modelValue)==null?void 0:h.target_id)??void 0},set(h){let g=null;a.value&&(g={target_id:h,type:c.value}),n("update:modelValue",g)}}),c=vue.computed({get(){var h;return((h=i.modelValue)==null?void 0:h.type)??void 0},set(h){let g=null;a.value&&(g={target_id:u.value,type:h}),n("update:modelValue",g)}}),f=vue.computed(()=>o.done_json.filter(h=>h.type!==EDoneJsonType.ConnectionLine).map(h=>({label:h.title,value:h.id}))),d=[{label:"上锚点",value:ELineBindAnchors.TopCenter},{label:"右锚点",value:ELineBindAnchors.Right},{label:"下锚点",value:ELineBindAnchors.BottomCenter},{label:"左锚点",value:ELineBindAnchors.Left}];function p(){vue.nextTick(function(){var h,g;if(a.value&&((h=i.modelValue)!=null&&h.target_id)&&((g=i.modelValue)!=null&&g.type)&&o.handle_svg_info){let v=null;for(let y of o.done_json)y.id===i.modelValue.target_id&&(v=y);v&&(setSvgActualInfo(v),moveAnchors(v))}})}return(h,g)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:i.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSwitch),{modelValue:vue.unref(a),"onUpdate:modelValue":g[0]||(g[0]=v=>vue.isRef(a)?a.value=v:null),onChange:p},null,8,["modelValue"])]),_:1},8,["label"]),vue.unref(a)?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,label:"绑定对象",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(u),"onUpdate:modelValue":g[1]||(g[1]=v=>vue.isRef(u)?u.value=v:null),onChange:p},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(f),v=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:v.value,label:v.label,value:v.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(a)?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:1,label:"绑定位置",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(c),"onUpdate:modelValue":g[2]||(g[2]=v=>vue.isRef(c)?c.value=v:null),onChange:p},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(d,v=>vue.createVNode(vue.unref(elementPlus.ElOption),{key:v.value,label:v.label,value:v.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)],64))}}),_withScopeId=r=>(vue.pushScopeId("data-v-9b4c5da1"),r=r(),vue.popScopeId(),r),_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(r){const n=useConfigStore(pinia),i=useGlobalStore(pinia),o=useSvgEditLayoutStore(pinia),a=vue.ref("page"),u=vue.ref("style"),c=(A,_)=>{A!=null&&A.common_animations&&(A.common_animations.val=_)};n.$subscribe((A,_)=>{A.storeId==="config-store"&&localStorage.setItem("svg-editor-config",JSON.stringify(_))});const f=vue.ref(numberArray(20)),d=vue.ref(["MQTT"]),p=vue.ref();p.value=()=>{var _,S;let A={type:EEventType.Null,action:EEventAction.Null,target:"",scripts:"",condition:{type:EConditionType.None}};(S=(_=i.handle_svg_info)==null?void 0:_.info)==null||S.events.push(A)};const h=(A,_)=>{A==="ChangeAttr"?_.attrs=[{key:"",val:""}]:delete _.attrs},g=A=>{var _,S;(S=(_=i.handle_svg_info)==null?void 0:_.info)==null||S.events.splice(A,1)},v=()=>{o.center_offset={x:0,y:0}},y=(A,_,S)=>{vue.nextTick(function(){if(i.handle_svg_info){const b=i.done_json[i.handle_svg_info.index];S?setSvgActualInfo(b,S):setSvgActualInfo(b),moveAnchors(b)}})};return(A,_)=>vue.unref(i).intention!=vue.unref(EGlobalStoreIntention).Select?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTabs),{key:0,class:"mx-2 rightTabs",modelValue:vue.unref(a),"onUpdate:modelValue":_[13]||(_[13]=S=>vue.isRef(a)?a.value=S:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"图纸",name:"page"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"背景色",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElColorPicker),{modelValue:vue.unref(n).svg.background_color,"onUpdate:modelValue":_[0]||(_[0]=S=>vue.unref(n).svg.background_color=S)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"画布",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElButton),{size:"small",onClick:v,icon:vue.unref(aim_default)},{default:vue.withCtx(()=>[vue.createTextVNode("重置位置")]),_:1},8,["icon"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"X轴偏移",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(o).center_offset.x,"onUpdate:modelValue":_[1]||(_[1]=S=>vue.unref(o).center_offset.x=S)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"Y轴偏移",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(o).center_offset.y,"onUpdate:modelValue":_[2]||(_[2]=S=>vue.unref(o).center_offset.y=S)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(n).svg.scale,"onUpdate:modelValue":_[3]||(_[3]=S=>vue.unref(n).svg.scale=S),step:.1,"step-strictly":""},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"标尺",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSwitch),{modelValue:vue.unref(n).svg.ruler,"onUpdate:modelValue":_[4]||(_[4]=S=>vue.unref(n).svg.ruler=S)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"网格",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSwitch),{modelValue:vue.unref(n).svg.grid,"onUpdate:modelValue":_[5]||(_[5]=S=>vue.unref(n).svg.grid=S)},null,8,["modelValue"])]),_:1}),vue.unref(n).svg.grid?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,label:"网格颜色",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElColorPicker),{modelValue:vue.unref(n).svg.grid_color,"onUpdate:modelValue":_[6]||(_[6]=S=>vue.unref(n).svg.grid_color=S)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)]),_:1})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"连线",name:"line"},{default:vue.withCtx(()=>[vue.unref(n).connection_line.props?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.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(elementPlus.ElForm),{key:1,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:vue.unref(n).connection_line.animations.type.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(n).connection_line.animations.type.val,"onUpdate:modelValue":_[7]||(_[7]=S=>vue.unref(n).connection_line.animations.type.val=S),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,S=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:S.value,label:S.label,value:S.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(elementPlus.ElTabPane),{label:"通信",name:"net"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElCollapse),{modelValue:vue.unref(d),"onUpdate:modelValue":_[12]||(_[12]=S=>vue.isRef(d)?d.value=S:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElCollapseItem),{name:"MQTT"},{title:vue.withCtx(()=>[_hoisted_1$3]),default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"URL",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(n).net.mqtt.url,"onUpdate:modelValue":_[8]||(_[8]=S=>vue.unref(n).net.mqtt.url=S),placeholder:"如 ws://127.0.0.1:4500"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"用户名",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(n).net.mqtt.user,"onUpdate:modelValue":_[9]||(_[9]=S=>vue.unref(n).net.mqtt.user=S),placeholder:"username"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"密码",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(n).net.mqtt.pwd,"onUpdate:modelValue":_[10]||(_[10]=S=>vue.unref(n).net.mqtt.pwd=S),placeholder:"password"},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"Topics",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(n).net.mqtt.topics,"onUpdate:modelValue":_[11]||(_[11]=S=>vue.unref(n).net.mqtt.topics=S),placeholder:"topics"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"结构",name:"tree"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$t)]),_:1})]),_:1},8,["modelValue"])):vue.unref(i).intention==vue.unref(EGlobalStoreIntention).Select&&vue.unref(i).handle_svg_info?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTabs),{key:1,class:"mx-2 rightTabs",modelValue:vue.unref(u),"onUpdate:modelValue":_[34]||(_[34]=S=>vue.isRef(u)?u.value=S:null)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"外观",name:"style"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElForm),{"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>{var S,b,T,w;return[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"标题",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(i).handle_svg_info.info.title,"onUpdate:modelValue":_[14]||(_[14]=x=>vue.unref(i).handle_svg_info.info.title=x)},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"X坐标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(i).handle_svg_info.info.x,"onUpdate:modelValue":_[15]||(_[15]=x=>vue.unref(i).handle_svg_info.info.x=x),onChange:y},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"Y坐标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(i).handle_svg_info.info.y,"onUpdate:modelValue":_[16]||(_[16]=x=>vue.unref(i).handle_svg_info.info.y=x),onChange:y},null,8,["modelValue"])]),_:1}),vue.withDirectives(vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"X缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(i).handle_svg_info.info.scale_x,"onUpdate:modelValue":_[17]||(_[17]=x=>vue.unref(i).handle_svg_info.info.scale_x=x),onChange:y},null,8,["modelValue"])]),_:1},512),[[vue.vShow,(b=(S=vue.unref(i).handle_svg_info)==null?void 0:S.info)==null?void 0:b.config.can_zoom]]),vue.withDirectives(vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"Y缩放",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(i).handle_svg_info.info.scale_y,"onUpdate:modelValue":_[18]||(_[18]=x=>vue.unref(i).handle_svg_info.info.scale_y=x),onChange:y},null,8,["modelValue"])]),_:1},512),[[vue.vShow,(w=(T=vue.unref(i).handle_svg_info)==null?void 0:T.info)==null?void 0:w.config.can_zoom]]),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"旋转",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(i).handle_svg_info.info.rotate,"onUpdate:modelValue":_[19]||(_[19]=x=>vue.unref(i).handle_svg_info.info.rotate=x),onChange:y},null,8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"显示",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSwitch),{modelValue:vue.unref(i).handle_svg_info.info.display,"onUpdate:modelValue":_[20]||(_[20]=x=>vue.unref(i).handle_svg_info.info.display=x)},null,8,["modelValue"])]),_:1})]}),_:1})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"数据",name:"data"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElForm),{"label-width":"90px","label-position":"left"},{default:vue.withCtx(()=>{var S,b,T,w,x,k,M,D;return[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"ID",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(i).handle_svg_info.info.id,"onUpdate:modelValue":_[21]||(_[21]=z=>vue.unref(i).handle_svg_info.info.id=z)},null,8,["modelValue"])]),_:1}),(b=(S=vue.unref(i).handle_svg_info)==null?void 0:S.info)!=null&&b.state?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,class:"props-row",label:"state",size:"small"},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(vue.unref(i).handle_svg_info.info.defaultState),1)]),_:1})):vue.createCommentVNode("",!0),(w=(T=vue.unref(i).handle_svg_info)==null?void 0:T.info)!=null&&w.state?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:1,label:"状态",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(i).handle_svg_info.info.defaultState,"onUpdate:modelValue":_[22]||(_[22]=z=>vue.unref(i).handle_svg_info.info.defaultState=z),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(i).handle_svg_info.info.state,(z,j)=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:"state"+String(j),label:z.label,value:j},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),(x=vue.unref(i).handle_svg_info.info)!=null&&x.hasOwnProperty("tag_slot")?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$2,[vue.createVNode(vue.unref(elementPlus.ElFormItem),{class:"props-row",label:"tag_slot",size:"small"},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(vue.unref(i).handle_svg_info.info.tag_slot),1)]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"文字插槽",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(i).handle_svg_info.info.tag_slot,"onUpdate:modelValue":_[23]||(_[23]=z=>vue.unref(i).handle_svg_info.info.tag_slot=z),onInput:_[24]||(_[24]=z=>y(z,null,!0))},null,8,["modelValue"])]),_:1})])):vue.createCommentVNode("",!0),vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(i).handle_svg_info.info.props,code:"",onChange:_[25]||(_[25]=z=>y(z,null,!0))},null,8,["obj-info"]),vue.unref(i).handle_svg_info.info.animations?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:3,label:vue.unref(i).handle_svg_info.info.animations.type.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(i).handle_svg_info.info.animations.type.val,"onUpdate:modelValue":_[26]||(_[26]=z=>vue.unref(i).handle_svg_info.info.animations.type.val=z),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(i).handle_svg_info.info.animations.type.options,z=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:z.value,label:z.label,value:z.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):vue.createCommentVNode("",!0),((k=vue.unref(i).handle_svg_info.info.animations)==null?void 0:k.type.val)!=="None"?(vue.openBlock(),vue.createBlock(DynamicElFormItem,{key:4,"obj-info":vue.unref(i).handle_svg_info.info.animations,hide:["type","repeatCount"]},null,8,["obj-info"])):vue.createCommentVNode("",!0),((M=vue.unref(i).handle_svg_info)==null?void 0:M.info.type)===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$6,{key:5,modelValue:vue.unref(i).handle_svg_info.info.bind_anchors.start,"onUpdate:modelValue":_[27]||(_[27]=z=>vue.unref(i).handle_svg_info.info.bind_anchors.start=z),title:"绑定起点"},null,8,["modelValue"])):vue.createCommentVNode("",!0),((D=vue.unref(i).handle_svg_info)==null?void 0:D.info.type)===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$6,{key:6,modelValue:vue.unref(i).handle_svg_info.info.bind_anchors.end,"onUpdate:modelValue":_[28]||(_[28]=z=>vue.unref(i).handle_svg_info.info.bind_anchors.end=z),title:"绑定终点"},null,8,["modelValue"])):vue.createCommentVNode("",!0)]}),_:1})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"事件",name:"event"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElButton),{type:"primary",style:{width:"100%"},onClick:vue.unref(p)},{default:vue.withCtx(()=>[vue.createTextVNode("添加事件")]),_:1},8,["onClick"]),vue.createVNode(vue.unref(elementPlus.ElCollapse),{modelValue:vue.unref(f),"onUpdate:modelValue":_[29]||(_[29]=S=>vue.isRef(f)?f.value=S:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(i).handle_svg_info.info.events,(S,b)=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElCollapseItem),{name:b,key:"event"+b},{title:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$2,[vue.createElementVNode("span",null,"事件"+vue.toDisplayString(b+1),1),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:vue.withModifiers(T=>g(b),["stop"])},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"delete"})]),_:2},1032,["onClick"])])]),default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElForm),{"label-width":"90px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"类型",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:S.type,"onUpdate:modelValue":T=>S.type=T},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElOption),{value:"Click",label:"点击"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"Change",label:"值改变"})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"行为",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:S.action,"onUpdate:modelValue":T=>S.action=T,onChange:T=>h(T,S)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElOption),{value:"ChangeAttr",label:"改变属性"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"JavaScript",label:"执行JavaScript"})]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1024),S.action==="ChangeAttr"?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,label:"目标",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:S.target,"onUpdate:modelValue":T=>S.target=T,placeholder:"默认自身"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),S.action==="ChangeAttr"?(vue.openBlock(),vue.createBlock(List,{key:1,modelValue:S.attrs,"onUpdate:modelValue":T=>S.attrs=T},null,8,["modelValue","onUpdate:modelValue"])):vue.createCommentVNode("",!0),S.action==="JavaScript"?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:2,label:"JavaScript",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$w,{modelValue:S.scripts,"onUpdate:modelValue":T=>S.scripts=T,lang:"javascript"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),vue.createVNode(Condition,{modelValue:S.condition,"onUpdate:modelValue":T=>S.condition=T},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"动效",name:"animation"},{default:vue.withCtx(()=>{var S;return[(S=vue.unref(i).handle_svg_info)!=null&&S.info.animations?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElForm),{key:0,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(i).handle_svg_info.info.animations},null,8,["obj-info"])]),_:1})):vue.unref(i).handle_svg_info.info.common_animations?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElForm),{key:1,"label-width":"60px","label-position":"left"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"动画效果",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(CommonAnimate,{onUpdateCommonAniVal:_[30]||(_[30]=b=>{var T;return c((T=vue.unref(i).handle_svg_info)==null?void 0:T.info,b)}),val:vue.unref(i).handle_svg_info.info.common_animations.val},null,8,["val"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"延迟",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(i).handle_svg_info.info.common_animations.delay,"onUpdate:modelValue":_[31]||(_[31]=b=>vue.unref(i).handle_svg_info.info.common_animations.delay=b)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElOption),{value:"delay-0s",label:"无"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"delay-1s",label:"1秒"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"delay-2s",label:"2秒"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"delay-3s",label:"3秒"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"delay-4s",label:"4秒"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"delay-5s",label:"5秒"})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"动画速度",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(i).handle_svg_info.info.common_animations.speed,"onUpdate:modelValue":_[32]||(_[32]=b=>vue.unref(i).handle_svg_info.info.common_animations.speed=b)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElOption),{value:"slow",label:"慢"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"slower",label:"最慢"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"fast",label:"快"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"faster",label:"最快"})]),_:1},8,["modelValue"])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"循环次数",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(i).handle_svg_info.info.common_animations.repeat,"onUpdate:modelValue":_[33]||(_[33]=b=>vue.unref(i).handle_svg_info.info.common_animations.repeat=b)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElOption),{value:"repeat-1",label:"一次"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"repeat-2",label:"两次"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"repeat-3",label:"三次"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"infinite",label:"无限次"})]),_:1},8,["modelValue"])]),_:1})]),_:1})):vue.createCommentVNode("",!0)]}),_:1}),vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"结构",name:"tree"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$t)]),_: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$1(_sfc_main$5,[["__scopeId","data-v-9b4c5da1"]]),_sfc_main$4=vue.defineComponent({__name:"export-json",setup(r){const n=vue.ref(""),i=useGlobalStore(pinia),o=useSvgEditLayoutStore(pinia),a=useConfigStore(pinia);return vue.onMounted(()=>{const u={layout_center:o.center_offset,config:a.$state,done_json:i.done_json};n.value=JSON.stringify(u,null,2)}),(u,c)=>(vue.openBlock(),vue.createBlock(vue.unref(VAceEditor),{value:vue.unref(n),"onUpdate:value":c[0]||(c[0]=f=>vue.isRef(n)?n.value=f: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(r,{expose:n}){const i=vue.ref("");return n({setVal:u=>{i.value=u},onImportJson:()=>{useImportDataModel(i.value)&&elementPlus.ElMessage.success("导入成功")}}),(u,c)=>(vue.openBlock(),vue.createBlock(vue.unref(VAceEditor),{value:vue.unref(i),"onUpdate:value":c[0]||(c[0]=f=>vue.isRef(i)?i.value=f: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}},emits:["onLineMouseUp"],setup(r,{emit:n}){const i=r,o=useSvgEditLayoutStore(pinia),a=useConfigStore(pinia),u=function(){return function(Et,Ne,pe){Et&&Ne&&pe&&Et.addEventListener(Ne,pe,!1)}}(),c=function(){return function(Et,Ne,pe){Et&&Ne&&Et.removeEventListener(Ne,pe,!1)}}();let f=18,d=vue.ref(0),p=vue.ref(0),h=vue.ref([]),g=vue.ref([]);const v=vue.ref([]);let y=vue.ref(!1),A="",_=vue.ref(-999),S=vue.ref(-999),b=18,T=18,w="";const x=vue.ref(null),k=vue.ref(null),M=vue.ref(null),D=vue.ref(null),z=vue.computed(()=>({width:d.value+"px",height:p.value+"px"})),j=vue.computed(()=>({padding:f+"px 0px 0px "+f+"px"})),oe=vue.computed(()=>{let Et=0,Ne=0;return v.value.map(pe=>{const At=pe.type==="h";return{id:`${pe.type}_${At?Et++:Ne++}`,type:pe.type,title:pe.site.toFixed(0)+"px",[At?"top":"left"]:pe.site*a.svg.scale+f+o.center_offset[At?"y":"x"]*a.svg.scale}})});o.$subscribe(Et=>{var Ne,pe,At,Ve;((pe=(Ne=Et.events)==null?void 0:Ne.target)!=null&&pe.hasOwnProperty("left_nav")||(Ve=(At=Et.events)==null?void 0:At.target)!=null&&Ve.hasOwnProperty("right_nav"))&&window.setTimeout(L,420)}),a.$subscribe(Et=>{var Ne,pe;(pe=(Ne=Et.events)==null?void 0:Ne.target)!=null&&pe.hasOwnProperty("scale")&&Ce()}),vue.onMounted(()=>{u(document,"mousemove",ie),u(document,"mouseup",Oe),L(),u(window,"resize",F)}),vue.onBeforeUnmount(()=>{c(document,"mousemove",ie),c(document,"mouseup",Oe),c(window,"resize",F)});const L=()=>{_e(),Ce()},F=()=>{h.value=[],g.value=[],L()},O=({type:Et,top:Ne,left:pe})=>Et==="h"?{top:Ne+"px"}:{left:pe+"px"},ue=({type:Et,id:Ne})=>Et==="h"?Cn(Ne):Lt(Ne),_e=()=>{const Et=window.getComputedStyle(k.value.parentNode,null);d.value=parseInt(Et.getPropertyValue("width")),p.value=parseInt(Et.getPropertyValue("height")),b=M.value.clientWidth,T=D.value.clientHeight},Ce=()=>{de(h.value,d.value,o.center_offset.x),de(g.value,p.value,o.center_offset.y)},de=(Et,Ne,pe)=>{if(Et.length===0)for(let At=0;At<Ne;At+=i.stepLength)At%i.stepLength===0&&Et.push({id:Number((At/a.svg.scale-pe).toFixed(0))});else Et.forEach((At,Ve)=>{At.id=Number((Ve*i.stepLength/a.svg.scale-pe).toFixed(0))})},ie=Et=>{Ce(),Y(Et)},Y=Et=>{if(!(Et.layerX===Et.x||Et.layerY===Et.y))switch(A){case"x":y.value&&(S.value=Et.layerY);break;case"y":y.value&&(_.value=Et.layerX);break;case"h":y.value&&(S.value=Et.layerY);break;case"v":y.value&&(_.value=Et.layerX);break}},Ie=Et=>{y.value=!0,A=Et},Oe=Et=>{kt(Et)},kt=Et=>{if(y.value){switch(y.value=!1,A){case"x":const Ne=Math.round((Et.layerY-f)/a.svg.scale-o.center_offset.y);if(Ne<=0){S.value=-999;return}v.value.push({type:"h",site:Ne});break;case"y":const pe=Math.round((Et.layerX-f)/a.svg.scale-o.center_offset.x);if(pe<=0){_.value=-999;return}v.value.push({type:"v",site:pe});break;case"h":Dt(v.value,Math.round((Et.layerY-f)/a.svg.scale-o.center_offset.y),Math.round(T/a.svg.scale-o.center_offset.y),"h");break;case"v":Dt(v.value,Math.round((Et.layerX-f)/a.svg.scale-o.center_offset.x),Math.round(b/a.svg.scale-o.center_offset.x),"v");break}S.value=_.value=-999}},Dt=(Et,Ne,pe,At)=>{if(Ne<pe){let Ve;oe.value.forEach((xe,ze)=>{xe.id===w&&(Ve=ze)}),Et.splice(Ve,1)}else{let Ve;oe.value.forEach((xe,ze)=>{xe.id===w&&(Ve=ze)}),Et.splice(Ve,1,{type:At,site:Ne})}},Fe=()=>{Ie("x")},$e=()=>{Ie("y")},Cn=Et=>{y.value=!0,A="h",w=Et},Lt=Et=>{y.value=!0,A="v",w=Et},In=()=>{n("onLineMouseUp")};return(Et,Ne)=>(vue.openBlock(),vue.createElementBlock("div",{style:vue.normalizeStyle(vue.unref(z)),class:"vue-ruler-wrapper",onselectStart:"return false;",ref_key:"el",ref:k},[vue.withDirectives(vue.createElementVNode("section",null,[vue.createElementVNode("div",{ref_key:"horizontalRuler",ref:D,class:"vue-ruler-h",onMousedown:vue.withModifiers(Fe,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(h),(pe,At)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({left:At*Et.stepLength+"px"}),class:"n"},vue.toDisplayString(pe.id),5))),256))],40,_hoisted_1$2),vue.createElementVNode("div",{ref_key:"verticalRuler",ref:M,class:"vue-ruler-v",onMousedown:vue.withModifiers($e,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(g),(pe,At)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({top:At*Et.stepLength+"px"}),class:"n"},vue.toDisplayString(pe.id),5))),256))],40,_hoisted_2$1),vue.createElementVNode("div",{style:vue.normalizeStyle({top:vue.unref(S)+"px"}),class:"vue-ruler-ref-dot-h"},[vue.createElementVNode("span",null,vue.toDisplayString(Math.round((vue.unref(S)-vue.unref(T))/vue.unref(a).svg.scale)),1)],4),vue.createElementVNode("div",{style:vue.normalizeStyle({left:vue.unref(_)+"px"}),class:"vue-ruler-ref-dot-v"},[vue.createElementVNode("span",null,vue.toDisplayString(Math.round((vue.unref(_)-vue.unref(b))/vue.unref(a).svg.scale)),1)],4),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(oe),pe=>(vue.openBlock(),vue.createElementBlock("div",{title:pe.title,style:vue.normalizeStyle(O(pe)),key:pe.id,class:vue.normalizeClass(`vue-ruler-ref-line-${pe.type}`),onMousedown:At=>ue(pe),onMouseup:In,onContextmenu:Ne[0]||(Ne[0]=(...At)=>vue.unref(preventDefault)&&vue.unref(preventDefault)(...At))},null,46,_hoisted_3$1))),128))],512),[[vue.vShow,i.visible]]),vue.createElementVNode("div",{ref_key:"content",ref:x,class:"vue-ruler-content",style:vue.normalizeStyle(vue.unref(j))},[vue.renderSlot(Et.$slots,"default")],4),vue.withDirectives(vue.createElementVNode("div",_hoisted_4$1,null,512),[[vue.vShow,vue.unref(y)]])],4))}}),vue3RulerTool_vue_vue_type_style_index_0_lang="";function fileWrite(r,n=new Date(Date.now()).toLocaleString()){const i=JSON.stringify(r),o=new Blob([i]);let a=document.createElement("a");a.download=n+".json",a.style.display="none",a.href=URL.createObjectURL(o),document.body.appendChild(a),a.click(),document.body.removeChild(a)}function fileRead(r){return new Promise((n,i)=>{let o=new FileReader;o.readAsText(r,"UTF-8"),o.onload=function(a){a&&a.target?n(a.target.result):i("文件读取错误")}})}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(r,{expose:n,emit:i}){const o=r;setEditorLoadTime();const a=useGlobalStore(pinia),u=useSvgEditLayoutStore(pinia),c=useConfigStore(pinia),f=useEditPrivateStore(pinia),d=vue.ref(),p=vue.ref(),h=vue.reactive({[EVisibleConfKey.ExportJson]:!1,[EVisibleConfKey.ImportJson]:!1,[EVisibleConfKey.ImportFile]:!1}),g=(w,x)=>{h[w]=x},v=vue.ref();v.value=()=>{p.value.onImportJson(),g(EVisibleConfKey.ImportJson,!1)};const y=w=>["text/plain","application/json"].indexOf(w.type)<0?(elementPlus.ElMessage.error("仅支持的格式:txt、json"),!1):(fileRead(w).then(x=>{p.value.setVal(x),elementPlus.ElMessage.success("文件读取成功!")}),!1),A=w=>{a.setDoneJson(w)};vue.onMounted(()=>{f.history_doneComponent=[],f.history_now_index=0,o.data?useImportDataModel(o.data):a.setDoneJson([]),a.intention=EGlobalStoreIntention.None});const{appContext:_}=vue.getCurrentInstance();function S(w){i("onReturn",{data:w,isChange:f.getTopBtnUndoStatus})}function b(w){o.saveFile?elementPlus.ElMessageBox.prompt("请输入文件名","保存",{cancelButtonText:"取消",confirmButtonText:"保存"},_).then(x=>{fileWrite(w,x.value.trim()),i("onSave",w)}).catch(x=>{console.log(x)}):i("onSave",w)}function T(){d.value.onCanvasMouseUp()}return n({setGraphNodeJson:A}),(w,x)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElContainer),null,{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElHeader),{class:"top-el-header"},{default:vue.withCtx(()=>[vue.createVNode(TopPanel,{onChangeVisible:g,onOnReturn:S,onOnPreview:x[0]||(x[0]=k=>i("onPreview",k)),onOnSave:b})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElContainer),{class:"middle"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElAside),{class:vue.normalizeClass(["side-nav",vue.unref(u).left_nav?"show-nav":"hide-nav"]),style:{"border-right":"1px solid #efefef"}},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{class:"el-scroll-pc"},{default:vue.withCtx(()=>[vue.createVNode(LeftPanel,{class:"content-left","custom-toolbar":o.customToolbar},null,8,["custom-toolbar"])]),_:1})]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.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(c).svg.ruler,onOnLineMouseUp:T},{default:vue.withCtx(()=>[vue.createVNode(CenterPanel,{ref_key:"centerRef",ref:d},null,512)]),_:1},8,["visible"])])]),_:1}),vue.createVNode(vue.unref(elementPlus.ElAside),{class:vue.normalizeClass(["side-nav",vue.unref(u).right_nav?"show-nav":"hide-nav"]),style:{"border-left":"1px solid #efefef"}},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{class:"el-scroll-pc"},{default:vue.withCtx(()=>[vue.createVNode(RightPanel)]),_:1})]),_:1},8,["class"])]),_:1})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDialog),{class:"modal-full",modelValue:vue.unref(h).ImportJson,"onUpdate:modelValue":x[2]||(x[2]=k=>vue.unref(h).ImportJson=k),title:"导入数据",width:"60%","destroy-on-close":""},{footer:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElUpload),{beforeUpload:y,style:{display:"inline-flex","margin-right":"12px"},multiple:!1,"show-file-list":!1,limit:1},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElButton),{onClick:x[1]||(x[1]=k=>g(vue.unref(EVisibleConfKey).ImportFile,!0))},{default:vue.withCtx(()=>[vue.createTextVNode("读取文件")]),_:1})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElButton),{type:"primary",onClick:vue.unref(v)},{default:vue.withCtx(()=>[vue.createTextVNode("导入数据")]),_:1},8,["onClick"])]),default:vue.withCtx(()=>[vue.createVNode(_sfc_main$3,{ref_key:"importJsonRef",ref:p},null,512)]),_:1},8,["modelValue"]),vue.createVNode(vue.unref(elementPlus.ElDialog),{class:"modal-full",modelValue:vue.unref(h).ExportJson,"onUpdate:modelValue":x[3]||(x[3]=k=>vue.unref(h).ExportJson=k),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_01ceb0c4_lang="",index=_export_sfc$1(_sfc_main$1,[["__scopeId","data-v-01ceb0c4"]]);function commonjsRequire(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var mqtt={exports:{}};(function(r,n){(function(i){r.exports=i()})(function(){return function(){function i(o,a,u){function c(p,h){if(!a[p]){if(!o[p]){var g=typeof commonjsRequire=="function"&&commonjsRequire;if(!h&&g)return g(p,!0);if(f)return f(p,!0);var v=new Error("Cannot find module '"+p+"'");throw v.code="MODULE_NOT_FOUND",v}var y=a[p]={exports:{}};o[p][0].call(y.exports,function(A){var _=o[p][1][A];return c(_||A)},y,y.exports,i,o,a,u)}return a[p].exports}for(var f=typeof commonjsRequire=="function"&&commonjsRequire,d=0;d<u.length;d++)c(u[d]);return c}return i}()({1:[function(i,o,a){(function(u,c){(function(){const f=i("events").EventEmitter,d=i("./store"),p=i("./topic-alias-recv"),h=i("./topic-alias-send"),g=i("mqtt-packet"),v=i("./default-message-id-provider"),y=i("readable-stream").Writable,A=i("inherits"),_=i("reinterval"),S=i("rfdc/default"),b=i("./validations"),T=i("xtend"),w=i("debug")("mqttjs:client"),x=u?u.nextTick:function(ie){setTimeout(ie,0)},k=c.setImmediate||function(ie){x(ie)},M={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0},D=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],z={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 j(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function oe(ie,Y){if(ie.options.protocolVersion===5&&Y.cmd==="publish"){let Ie;Y.properties&&(Ie=Y.properties.topicAlias);const Oe=Y.topic.toString();if(ie.topicAliasSend)if(Ie){if(Oe.length!==0&&(w("applyTopicAlias :: register topic: %s - alias: %d",Oe,Ie),!ie.topicAliasSend.put(Oe,Ie)))return w("applyTopicAlias :: error out of range. topic: %s - alias: %d",Oe,Ie),new Error("Sending Topic Alias out of range")}else Oe.length!==0&&(ie.options.autoAssignTopicAlias?(Ie=ie.topicAliasSend.getAliasByTopic(Oe),Ie?(Y.topic="",Y.properties={...Y.properties,topicAlias:Ie},w("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",Oe,Ie)):(Ie=ie.topicAliasSend.getLruAlias(),ie.topicAliasSend.put(Oe,Ie),Y.properties={...Y.properties,topicAlias:Ie},w("applyTopicAlias :: auto assign topic: %s - alias: %d",Oe,Ie))):ie.options.autoUseTopicAlias&&(Ie=ie.topicAliasSend.getAliasByTopic(Oe),Ie&&(Y.topic="",Y.properties={...Y.properties,topicAlias:Ie},w("applyTopicAlias :: auto use topic: %s - alias: %d",Oe,Ie))));else if(Ie)return w("applyTopicAlias :: error out of range. topic: %s - alias: %d",Oe,Ie),new Error("Sending Topic Alias out of range")}}function L(ie,Y){let Ie;Y.properties&&(Ie=Y.properties.topicAlias);let Oe=Y.topic.toString();if(Oe.length===0){if(typeof Ie>"u")return new Error("Unregistered Topic Alias");if(Oe=ie.topicAliasSend.getTopicByAlias(Ie),typeof Oe>"u")return new Error("Unregistered Topic Alias");Y.topic=Oe}Ie&&delete Y.properties.topicAlias}function F(ie,Y,Ie){w("sendPacket :: packet: %O",Y),w("sendPacket :: emitting `packetsend`"),ie.emit("packetsend",Y),w("sendPacket :: writing to stream");const Oe=g.writeToStream(Y,ie.stream,ie.options);w("sendPacket :: writeToStream result %s",Oe),!Oe&&Ie&&Ie!==Ce?(w("sendPacket :: handle events on `drain` once through callback."),ie.stream.once("drain",Ie)):Ie&&(w("sendPacket :: invoking cb"),Ie())}function O(ie){ie&&(w("flush: queue exists? %b",!!ie),Object.keys(ie).forEach(function(Y){typeof ie[Y].cb=="function"&&(ie[Y].cb(new Error("Connection closed")),delete ie[Y])}))}function ue(ie){ie&&(w("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(ie).forEach(function(Y){ie[Y].volatile&&typeof ie[Y].cb=="function"&&(ie[Y].cb(new Error("Connection closed")),delete ie[Y])}))}function _e(ie,Y,Ie,Oe){w("storeAndSend :: store packet with cmd %s to outgoingStore",Y.cmd);let kt=Y,Dt;if(kt.cmd==="publish"&&(kt=S(Y),Dt=L(ie,kt),Dt))return Ie&&Ie(Dt);ie.outgoingStore.put(kt,function($e){if($e)return Ie&&Ie($e);Oe(),F(ie,Y,Ie)})}function Ce(ie){w("nop ::",ie)}function de(ie,Y){let Ie;const Oe=this;if(!(this instanceof de))return new de(ie,Y);this.options=Y||{};for(Ie in M)typeof this.options[Ie]>"u"?this.options[Ie]=M[Ie]:this.options[Ie]=Y[Ie];w("MqttClient :: options.protocol",Y.protocol),w("MqttClient :: options.protocolVersion",Y.protocolVersion),w("MqttClient :: options.username",Y.username),w("MqttClient :: options.keepalive",Y.keepalive),w("MqttClient :: options.reconnectPeriod",Y.reconnectPeriod),w("MqttClient :: options.rejectUnauthorized",Y.rejectUnauthorized),w("MqttClient :: options.topicAliasMaximum",Y.topicAliasMaximum),this.options.clientId=typeof Y.clientId=="string"?Y.clientId:j(),w("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=Y.protocolVersion===5&&Y.customHandleAcks?Y.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=ie,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new v:this.options.messageIdProvider,this.outgoingStore=Y.outgoingStore||new d,this.incomingStore=Y.incomingStore||new d,this.queueQoSZero=Y.queueQoSZero===void 0?!0:Y.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,Y.topicAliasMaximum>0&&(Y.topicAliasMaximum>65535?w("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new p(Y.topicAliasMaximum)),this.on("connect",function(){const kt=this.queue;function Dt(){const Fe=kt.shift();w("deliver :: entry %o",Fe);let $e=null;if(!Fe){Oe._resubscribe();return}$e=Fe.packet,w("deliver :: call _sendPacket for %o",$e);let Cn=!0;$e.messageId&&$e.messageId!==0&&(Oe.messageIdProvider.register($e.messageId)||(Cn=!1)),Cn?Oe._sendPacket($e,function(Lt){Fe.cb&&Fe.cb(Lt),Dt()}):(w("messageId: %d has already used. The message is skipped and removed.",$e.messageId),Dt())}w("connect :: sending queued packets"),Dt()}),this.on("close",function(){w("close :: connected set to `false`"),this.connected=!1,w("close :: clearing connackTimer"),clearTimeout(this.connackTimer),w("close :: clearing ping timer"),Oe.pingTimer!==null&&(Oe.pingTimer.clear(),Oe.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),w("close :: calling _setupReconnect"),this._setupReconnect()}),f.call(this),w("MqttClient :: setting up stream"),this._setupStream()}A(de,f),de.prototype._setupStream=function(){const ie=this,Y=new y,Ie=g.parser(this.options);let Oe=null;const kt=[];w("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),w("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),Ie.on("packet",function(Lt){w("parser :: on packet push to packets array."),kt.push(Lt)});function Dt(){if(kt.length)x(Fe);else{const Lt=Oe;Oe=null,Lt()}}function Fe(){w("work :: getting next packet in queue");const Lt=kt.shift();if(Lt)w("work :: packet pulled from queue"),ie._handlePacket(Lt,Dt);else{w("work :: no packets in queue");const In=Oe;Oe=null,w("work :: done flag is %s",!!In),In&&In()}}Y._write=function(Lt,In,Et){Oe=Et,w("writable stream :: parsing buffer"),Ie.parse(Lt),Fe()};function $e(Lt){w("streamErrorHandler :: error",Lt.message),D.includes(Lt.code)?(w("streamErrorHandler :: emitting error"),ie.emit("error",Lt)):Ce(Lt)}w("_setupStream :: pipe stream to writable stream"),this.stream.pipe(Y),this.stream.on("error",$e),this.stream.on("close",function(){w("(%s)stream :: on close",ie.options.clientId),ue(ie.outgoing),w("stream: emit close to MqttClient"),ie.emit("close")}),w("_setupStream: sending packet `connect`");const Cn=Object.create(this.options);if(Cn.cmd="connect",this.topicAliasRecv&&(Cn.properties||(Cn.properties={}),this.topicAliasRecv&&(Cn.properties.topicAliasMaximum=this.topicAliasRecv.max)),F(this,Cn),Ie.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return ie.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 Lt=T({cmd:"auth",reasonCode:0},this.options.authPacket);F(this,Lt)}}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){w("!!connectTimeout hit!! Calling _cleanUp with force `true`"),ie._cleanUp(!0)},this.options.connectTimeout)},de.prototype._handlePacket=function(ie,Y){const Ie=this.options;if(Ie.protocolVersion===5&&Ie.properties&&Ie.properties.maximumPacketSize&&Ie.properties.maximumPacketSize<ie.length)return this.emit("error",new Error("exceeding packets size "+ie.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(w("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",ie),ie.cmd){case"publish":this._handlePublish(ie,Y);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(ie),Y();break;case"pubrel":this._handlePubrel(ie,Y);break;case"connack":this._handleConnack(ie),Y();break;case"auth":this._handleAuth(ie),Y();break;case"pingresp":this._handlePingresp(ie),Y();break;case"disconnect":this._handleDisconnect(ie),Y();break}},de.prototype._checkDisconnecting=function(ie){return this.disconnecting&&(ie&&ie!==Ce?ie(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},de.prototype.publish=function(ie,Y,Ie,Oe){w("publish :: message `%s` to topic `%s`",Y,ie);const kt=this.options;if(typeof Ie=="function"&&(Oe=Ie,Ie=null),Ie=T({qos:0,retain:!1,dup:!1},Ie),this._checkDisconnecting(Oe))return this;const Fe=this,$e=function(){let Cn=0;if((Ie.qos===1||Ie.qos===2)&&(Cn=Fe._nextId(),Cn===null))return w("No messageId left"),!1;const Lt={cmd:"publish",topic:ie,payload:Y,qos:Ie.qos,retain:Ie.retain,messageId:Cn,dup:Ie.dup};switch(kt.protocolVersion===5&&(Lt.properties=Ie.properties),w("publish :: qos",Ie.qos),Ie.qos){case 1:case 2:Fe.outgoing[Lt.messageId]={volatile:!1,cb:Oe||Ce},w("MqttClient:publish: packet cmd: %s",Lt.cmd),Fe._sendPacket(Lt,void 0,Ie.cbStorePut);break;default:w("MqttClient:publish: packet cmd: %s",Lt.cmd),Fe._sendPacket(Lt,Oe,Ie.cbStorePut);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!$e())&&this._storeProcessingQueue.push({invoke:$e,cbStorePut:Ie.cbStorePut,callback:Oe}),this},de.prototype.subscribe=function(){const ie=this,Y=new Array(arguments.length);for(let Et=0;Et<arguments.length;Et++)Y[Et]=arguments[Et];const Ie=[];let Oe=Y.shift();const kt=Oe.resubscribe;let Dt=Y.pop()||Ce,Fe=Y.pop();const $e=this.options.protocolVersion;delete Oe.resubscribe,typeof Oe=="string"&&(Oe=[Oe]),typeof Dt!="function"&&(Fe=Dt,Dt=Ce);const Cn=b.validateTopics(Oe);if(Cn!==null)return k(Dt,new Error("Invalid topic "+Cn)),this;if(this._checkDisconnecting(Dt))return w("subscribe: discconecting true"),this;const Lt={qos:0};if($e===5&&(Lt.nl=!1,Lt.rap=!1,Lt.rh=0),Fe=T(Lt,Fe),Array.isArray(Oe)?Oe.forEach(function(Et){if(w("subscribe: array topic %s",Et),!Object.prototype.hasOwnProperty.call(ie._resubscribeTopics,Et)||ie._resubscribeTopics[Et].qos<Fe.qos||kt){const Ne={topic:Et,qos:Fe.qos};$e===5&&(Ne.nl=Fe.nl,Ne.rap=Fe.rap,Ne.rh=Fe.rh,Ne.properties=Fe.properties),w("subscribe: pushing topic `%s` and qos `%s` to subs list",Ne.topic,Ne.qos),Ie.push(Ne)}}):Object.keys(Oe).forEach(function(Et){if(w("subscribe: object topic %s",Et),!Object.prototype.hasOwnProperty.call(ie._resubscribeTopics,Et)||ie._resubscribeTopics[Et].qos<Oe[Et].qos||kt){const Ne={topic:Et,qos:Oe[Et].qos};$e===5&&(Ne.nl=Oe[Et].nl,Ne.rap=Oe[Et].rap,Ne.rh=Oe[Et].rh,Ne.properties=Fe.properties),w("subscribe: pushing `%s` to subs list",Ne),Ie.push(Ne)}}),!Ie.length)return Dt(null,[]),this;const In=function(){const Et=ie._nextId();if(Et===null)return w("No messageId left"),!1;const Ne={cmd:"subscribe",subscriptions:Ie,qos:1,retain:!1,dup:!1,messageId:Et};if(Fe.properties&&(Ne.properties=Fe.properties),ie.options.resubscribe){w("subscribe :: resubscribe true");const pe=[];Ie.forEach(function(At){if(ie.options.reconnectPeriod>0){const Ve={qos:At.qos};$e===5&&(Ve.nl=At.nl||!1,Ve.rap=At.rap||!1,Ve.rh=At.rh||0,Ve.properties=At.properties),ie._resubscribeTopics[At.topic]=Ve,pe.push(At.topic)}}),ie.messageIdToTopic[Ne.messageId]=pe}return ie.outgoing[Ne.messageId]={volatile:!0,cb:function(pe,At){if(!pe){const Ve=At.granted;for(let xe=0;xe<Ve.length;xe+=1)Ie[xe].qos=Ve[xe]}Dt(pe,Ie)}},w("subscribe :: call _sendPacket"),ie._sendPacket(Ne),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!In())&&this._storeProcessingQueue.push({invoke:In,callback:Dt}),this},de.prototype.unsubscribe=function(){const ie=this,Y=new Array(arguments.length);for(let $e=0;$e<arguments.length;$e++)Y[$e]=arguments[$e];let Ie=Y.shift(),Oe=Y.pop()||Ce,kt=Y.pop();typeof Ie=="string"&&(Ie=[Ie]),typeof Oe!="function"&&(kt=Oe,Oe=Ce);const Dt=b.validateTopics(Ie);if(Dt!==null)return k(Oe,new Error("Invalid topic "+Dt)),this;if(ie._checkDisconnecting(Oe))return this;const Fe=function(){const $e=ie._nextId();if($e===null)return w("No messageId left"),!1;const Cn={cmd:"unsubscribe",qos:1,messageId:$e};return typeof Ie=="string"?Cn.unsubscriptions=[Ie]:Array.isArray(Ie)&&(Cn.unsubscriptions=Ie),ie.options.resubscribe&&Cn.unsubscriptions.forEach(function(Lt){delete ie._resubscribeTopics[Lt]}),typeof kt=="object"&&kt.properties&&(Cn.properties=kt.properties),ie.outgoing[Cn.messageId]={volatile:!0,cb:Oe},w("unsubscribe: call _sendPacket"),ie._sendPacket(Cn),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!Fe())&&this._storeProcessingQueue.push({invoke:Fe,callback:Oe}),this},de.prototype.end=function(ie,Y,Ie){const Oe=this;w("end :: (%s)",this.options.clientId),(ie==null||typeof ie!="boolean")&&(Ie=Y||Ce,Y=ie,ie=!1,typeof Y!="object"&&(Ie=Y,Y=null,typeof Ie!="function"&&(Ie=Ce))),typeof Y!="object"&&(Ie=Y,Y=null),w("end :: cb? %s",!!Ie),Ie=Ie||Ce;function kt(){w("end :: closeStores: closing incoming and outgoing stores"),Oe.disconnected=!0,Oe.incomingStore.close(function(Fe){Oe.outgoingStore.close(function($e){if(w("end :: closeStores: emitting end"),Oe.emit("end"),Ie){const Cn=Fe||$e;w("end :: closeStores: invoking callback with args"),Ie(Cn)}})}),Oe._deferredReconnect&&Oe._deferredReconnect()}function Dt(){w("end :: (%s) :: finish :: calling _cleanUp with force %s",Oe.options.clientId,ie),Oe._cleanUp(ie,()=>{w("end :: finish :: calling process.nextTick on closeStores"),x(kt.bind(Oe))},Y)}return this.disconnecting?(Ie(),this):(this._clearReconnect(),this.disconnecting=!0,!ie&&Object.keys(this.outgoing).length>0?(w("end :: (%s) :: calling finish in 10ms once outgoing is empty",Oe.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,Dt,10))):(w("end :: (%s) :: immediately calling finish",Oe.options.clientId),Dt()),this)},de.prototype.removeOutgoingMessage=function(ie){const Y=this.outgoing[ie]?this.outgoing[ie].cb:null;return delete this.outgoing[ie],this.outgoingStore.del({messageId:ie},function(){Y(new Error("Message removed"))}),this},de.prototype.reconnect=function(ie){w("client reconnect");const Y=this,Ie=function(){ie?(Y.options.incomingStore=ie.incomingStore,Y.options.outgoingStore=ie.outgoingStore):(Y.options.incomingStore=null,Y.options.outgoingStore=null),Y.incomingStore=Y.options.incomingStore||new d,Y.outgoingStore=Y.options.outgoingStore||new d,Y.disconnecting=!1,Y.disconnected=!1,Y._deferredReconnect=null,Y._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=Ie:Ie(),this},de.prototype._reconnect=function(){w("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),w("client already connected. disconnecting first.")):(w("_reconnect: calling _setupStream"),this._setupStream())},de.prototype._setupReconnect=function(){const ie=this;!ie.disconnecting&&!ie.reconnectTimer&&ie.options.reconnectPeriod>0?(this.reconnecting||(w("_setupReconnect :: emit `offline` state"),this.emit("offline"),w("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),w("_setupReconnect :: setting reconnectTimer for %d ms",ie.options.reconnectPeriod),ie.reconnectTimer=setInterval(function(){w("reconnectTimer :: reconnect triggered!"),ie._reconnect()},ie.options.reconnectPeriod)):w("_setupReconnect :: doing nothing...")},de.prototype._clearReconnect=function(){w("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},de.prototype._cleanUp=function(ie,Y){const Ie=arguments[2];if(Y&&(w("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",Y)),w("_cleanUp :: forced? %s",ie),ie)this.options.reconnectPeriod===0&&this.options.clean&&O(this.outgoing),w("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const Oe=T({cmd:"disconnect"},Ie);w("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(Oe,k.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(w("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(w("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),Y&&!this.connected&&(w("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",Y),Y())},de.prototype._sendPacket=function(ie,Y,Ie){w("_sendPacket :: (%s) :: start",this.options.clientId),Ie=Ie||Ce,Y=Y||Ce;const Oe=oe(this,ie);if(Oe){Y(Oe);return}if(!this.connected){if(ie.cmd==="auth"){this._shiftPingInterval(),F(this,ie,Y);return}w("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(ie,Y,Ie);return}switch(this._shiftPingInterval(),ie.cmd){case"publish":break;case"pubrel":_e(this,ie,Y,Ie);return;default:F(this,ie,Y);return}switch(ie.qos){case 2:case 1:_e(this,ie,Y,Ie);break;case 0:default:F(this,ie,Y);break}w("_sendPacket :: (%s) :: end",this.options.clientId)},de.prototype._storePacket=function(ie,Y,Ie){w("_storePacket :: packet: %o",ie),w("_storePacket :: cb? %s",!!Y),Ie=Ie||Ce;let Oe=ie;if(Oe.cmd==="publish"){Oe=S(ie);const kt=L(this,Oe);if(kt)return Y&&Y(kt)}(Oe.qos||0)===0&&this.queueQoSZero||Oe.cmd!=="publish"?this.queue.push({packet:Oe,cb:Y}):Oe.qos>0?(Y=this.outgoing[Oe.messageId]?this.outgoing[Oe.messageId].cb:null,this.outgoingStore.put(Oe,function(kt){if(kt)return Y&&Y(kt);Ie()})):Y&&Y(new Error("No connection to broker"))},de.prototype._setupPingTimer=function(){w("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const ie=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=_(function(){ie._checkPing()},this.options.keepalive*1e3))},de.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(this.options.keepalive*1e3)},de.prototype._checkPing=function(){w("_checkPing :: checking ping..."),this.pingResp?(w("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(w("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},de.prototype._handlePingresp=function(){this.pingResp=!0},de.prototype._handleConnack=function(ie){w("_handleConnack");const Y=this.options,Oe=Y.protocolVersion===5?ie.reasonCode:ie.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,ie.properties){if(ie.properties.topicAliasMaximum){if(ie.properties.topicAliasMaximum>65535){this.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}ie.properties.topicAliasMaximum>0&&(this.topicAliasSend=new h(ie.properties.topicAliasMaximum))}ie.properties.serverKeepAlive&&Y.keepalive&&(Y.keepalive=ie.properties.serverKeepAlive,this._shiftPingInterval()),ie.properties.maximumPacketSize&&(Y.properties||(Y.properties={}),Y.properties.maximumPacketSize=ie.properties.maximumPacketSize)}if(Oe===0)this.reconnecting=!1,this._onConnect(ie);else if(Oe>0){const kt=new Error("Connection refused: "+z[Oe]);kt.code=Oe,this.emit("error",kt)}},de.prototype._handleAuth=function(ie){const Ie=this.options.protocolVersion,Oe=Ie===5?ie.reasonCode:ie.returnCode;if(Ie!==5){const Dt=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+Ie);Dt.code=Oe,this.emit("error",Dt);return}const kt=this;this.handleAuth(ie,function(Dt,Fe){if(Dt){kt.emit("error",Dt);return}if(Oe===24)kt.reconnecting=!1,kt._sendPacket(Fe);else{const $e=new Error("Connection refused: "+z[Oe]);Dt.code=Oe,kt.emit("error",$e)}})},de.prototype.handleAuth=function(ie,Y){Y()},de.prototype._handlePublish=function(ie,Y){w("_handlePublish: packet %o",ie),Y=typeof Y<"u"?Y:Ce;let Ie=ie.topic.toString();const Oe=ie.payload,kt=ie.qos,Dt=ie.messageId,Fe=this,$e=this.options,Cn=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let Lt;if(ie.properties&&(Lt=ie.properties.topicAlias),typeof Lt<"u")if(Ie.length===0)if(Lt>0&&Lt<=65535){const In=this.topicAliasRecv.getTopicByAlias(Lt);if(In)Ie=In,w("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",Ie,Lt);else{w("_handlePublish :: unregistered topic alias. alias: %d",Lt),this.emit("error",new Error("Received unregistered Topic Alias"));return}}else{w("_handlePublish :: topic alias out of range. alias: %d",Lt),this.emit("error",new Error("Received Topic Alias is out of range"));return}else if(this.topicAliasRecv.put(Ie,Lt))w("_handlePublish :: registered topic: %s - alias: %d",Ie,Lt);else{w("_handlePublish :: topic alias out of range. alias: %d",Lt),this.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(w("_handlePublish: qos %d",kt),kt){case 2:{$e.customHandleAcks(Ie,Oe,ie,function(Lt,In){if(Lt instanceof Error||(In=Lt,Lt=null),Lt)return Fe.emit("error",Lt);if(Cn.indexOf(In)===-1)return Fe.emit("error",new Error("Wrong reason code for pubrec"));In?Fe._sendPacket({cmd:"pubrec",messageId:Dt,reasonCode:In},Y):Fe.incomingStore.put(ie,function(){Fe._sendPacket({cmd:"pubrec",messageId:Dt},Y)})});break}case 1:{$e.customHandleAcks(Ie,Oe,ie,function(Lt,In){if(Lt instanceof Error||(In=Lt,Lt=null),Lt)return Fe.emit("error",Lt);if(Cn.indexOf(In)===-1)return Fe.emit("error",new Error("Wrong reason code for puback"));In||Fe.emit("message",Ie,Oe,ie),Fe.handleMessage(ie,function(Et){if(Et)return Y&&Y(Et);Fe._sendPacket({cmd:"puback",messageId:Dt,reasonCode:In},Y)})});break}case 0:this.emit("message",Ie,Oe,ie),this.handleMessage(ie,Y);break;default:w("_handlePublish: unknown QoS. Doing nothing.");break}},de.prototype.handleMessage=function(ie,Y){Y()},de.prototype._handleAck=function(ie){const Y=ie.messageId,Ie=ie.cmd;let Oe=null;const kt=this.outgoing[Y]?this.outgoing[Y].cb:null,Dt=this;let Fe;if(!kt){w("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(w("_handleAck :: packet type",Ie),Ie){case"pubcomp":case"puback":{const $e=ie.reasonCode;$e&&$e>0&&$e!==16&&(Fe=new Error("Publish error: "+z[$e]),Fe.code=$e,kt(Fe,ie)),delete this.outgoing[Y],this.outgoingStore.del(ie,kt),this.messageIdProvider.deallocate(Y),this._invokeStoreProcessingQueue();break}case"pubrec":{Oe={cmd:"pubrel",qos:2,messageId:Y};const $e=ie.reasonCode;$e&&$e>0&&$e!==16?(Fe=new Error("Publish error: "+z[$e]),Fe.code=$e,kt(Fe,ie)):this._sendPacket(Oe);break}case"suback":{delete this.outgoing[Y],this.messageIdProvider.deallocate(Y);for(let $e=0;$e<ie.granted.length;$e++)if(ie.granted[$e]&128){const Cn=this.messageIdToTopic[Y];Cn&&Cn.forEach(function(Lt){delete Dt._resubscribeTopics[Lt]})}this._invokeStoreProcessingQueue(),kt(null,ie);break}case"unsuback":{delete this.outgoing[Y],this.messageIdProvider.deallocate(Y),this._invokeStoreProcessingQueue(),kt(null);break}default:Dt.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")},de.prototype._handlePubrel=function(ie,Y){w("handling pubrel packet"),Y=typeof Y<"u"?Y:Ce;const Ie=ie.messageId,Oe=this,kt={cmd:"pubcomp",messageId:Ie};Oe.incomingStore.get(ie,function(Dt,Fe){Dt?Oe._sendPacket(kt,Y):(Oe.emit("message",Fe.topic,Fe.payload,Fe),Oe.handleMessage(Fe,function($e){if($e)return Y($e);Oe.incomingStore.del(Fe,Ce),Oe._sendPacket(kt,Y)}))})},de.prototype._handleDisconnect=function(ie){this.emit("disconnect",ie)},de.prototype._nextId=function(){return this.messageIdProvider.allocate()},de.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},de.prototype._resubscribe=function(){w("_resubscribe");const ie=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion===5&&!this.connackPacket.sessionPresent)&&ie.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){w("_resubscribe: protocolVersion 5");for(let Y=0;Y<ie.length;Y++){const Ie={};Ie[ie[Y]]=this._resubscribeTopics[ie[Y]],Ie.resubscribe=!0,this.subscribe(Ie,{properties:Ie[ie[Y]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},de.prototype._onConnect=function(ie){if(this.disconnected){this.emit("connect",ie);return}const Y=this;this.connackPacket=ie,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0;function Ie(){let Oe=Y.outgoingStore.createStream();function kt(){Y._storeProcessing=!1,Y._packetIdsDuringStoreProcessing={}}Y.once("close",Dt),Oe.on("error",function($e){kt(),Y._flushStoreProcessingQueue(),Y.removeListener("close",Dt),Y.emit("error",$e)});function Dt(){Oe.destroy(),Oe=null,Y._flushStoreProcessingQueue(),kt()}function Fe(){if(!Oe)return;Y._storeProcessing=!0;const $e=Oe.read(1);let Cn;if(!$e){Oe.once("readable",Fe);return}if(Y._packetIdsDuringStoreProcessing[$e.messageId]){Fe();return}!Y.disconnecting&&!Y.reconnectTimer?(Cn=Y.outgoing[$e.messageId]?Y.outgoing[$e.messageId].cb:null,Y.outgoing[$e.messageId]={volatile:!1,cb:function(Lt,In){Cn&&Cn(Lt,In),Fe()}},Y._packetIdsDuringStoreProcessing[$e.messageId]=!0,Y.messageIdProvider.register($e.messageId)?Y._sendPacket($e):w("messageId: %d has already used.",$e.messageId)):Oe.destroy&&Oe.destroy()}Oe.on("end",function(){let $e=!0;for(const Cn in Y._packetIdsDuringStoreProcessing)if(!Y._packetIdsDuringStoreProcessing[Cn]){$e=!1;break}$e?(kt(),Y.removeListener("close",Dt),Y._invokeAllStoreProcessingQueue(),Y.emit("connect",ie)):Ie()}),Fe()}Ie()},de.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const ie=this._storeProcessingQueue[0];if(ie&&ie.invoke())return this._storeProcessingQueue.shift(),!0}return!1},de.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},de.prototype._flushStoreProcessingQueue=function(){for(const ie of this._storeProcessingQueue)ie.cbStorePut&&ie.cbStorePut(new Error("Connection closed")),ie.callback&&ie.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},o.exports=de}).call(this)}).call(this,i("_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(i,o,a){const{Buffer:u}=i("buffer"),c=i("readable-stream").Transform,f=i("duplexify");let d,p,h,g=!1;function v(){const b=new c;return b._write=function(T,w,x){d.sendSocketMessage({data:T.buffer,success:function(){x()},fail:function(){x(new Error)}})},b._flush=function(w){d.closeSocket({success:function(){w()}})},b}function y(b){b.hostname||(b.hostname="localhost"),b.path||(b.path="/"),b.wsOptions||(b.wsOptions={})}function A(b,T){const w=b.protocol==="alis"?"wss":"ws";let x=w+"://"+b.hostname+b.path;return b.port&&b.port!==80&&b.port!==443&&(x=w+"://"+b.hostname+":"+b.port+b.path),typeof b.transformWsUrl=="function"&&(x=b.transformWsUrl(x,b,T)),x}function _(){g||(g=!0,d.onSocketOpen(function(){h.setReadable(p),h.setWritable(p),h.emit("connect")}),d.onSocketMessage(function(b){if(typeof b.data=="string"){const T=u.from(b.data,"base64");p.push(T)}else{const T=new FileReader;T.addEventListener("load",function(){let w=T.result;w instanceof ArrayBuffer?w=u.from(w):w=u.from(w,"utf8"),p.push(w)}),T.readAsArrayBuffer(b.data)}}),d.onSocketClose(function(){h.end(),h.destroy()}),d.onSocketError(function(b){h.destroy(b)}))}function S(b,T){if(T.hostname=T.hostname||T.host,!T.hostname)throw new Error("Could not determine host. Specify host manually.");const w=T.protocolId==="MQIsdp"&&T.protocolVersion===3?"mqttv3.1":"mqtt";y(T);const x=A(T,b);return d=T.my,d.connectSocket({url:x,protocols:w}),p=v(),h=f.obj(),_(),h}o.exports=S},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(i,o,a){const u=i("net"),c=i("debug")("mqttjs:tcp");function f(d,p){p.port=p.port||1883,p.hostname=p.hostname||p.host||"localhost";const h=p.port,g=p.hostname;return c("port %d and host %s",h,g),u.createConnection(h,g)}o.exports=f},{debug:18,net:16}],4:[function(i,o,a){const u=i("tls"),c=i("net"),f=i("debug")("mqttjs:tls");function d(p,h){h.port=h.port||8883,h.host=h.hostname||h.host||"localhost",c.isIP(h.host)===0&&(h.servername=h.host),h.rejectUnauthorized=h.rejectUnauthorized!==!1,delete h.path,f("port %d host %s rejectUnauthorized %b",h.port,h.host,h.rejectUnauthorized);const g=u.connect(h);g.on("secureConnect",function(){h.rejectUnauthorized&&!g.authorized?g.emit("error",new Error("TLS not authorized")):g.removeListener("error",v)});function v(y){h.rejectUnauthorized&&p.emit("error",y),g.end()}return g.on("error",v),g}o.exports=d},{debug:18,net:16,tls:16}],5:[function(i,o,a){(function(u){(function(){const{Buffer:c}=i("buffer"),f=i("ws"),d=i("debug")("mqttjs:ws"),p=i("duplexify"),h=i("readable-stream").Transform,g=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],v=typeof u<"u"&&u.title==="browser"||typeof __webpack_require__=="function";function y(x,k){let M=x.protocol+"://"+x.hostname+":"+x.port+x.path;return typeof x.transformWsUrl=="function"&&(M=x.transformWsUrl(M,x,k)),M}function A(x){const k=x;return x.hostname||(k.hostname="localhost"),x.port||(x.protocol==="wss"?k.port=443:k.port=80),x.path||(k.path="/"),x.wsOptions||(k.wsOptions={}),!v&&x.protocol==="wss"&&g.forEach(function(M){Object.prototype.hasOwnProperty.call(x,M)&&!Object.prototype.hasOwnProperty.call(x.wsOptions,M)&&(k.wsOptions[M]=x[M])}),k}function _(x){const k=A(x);if(k.hostname||(k.hostname=k.host),!k.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");const M=new URL(document.URL);k.hostname=M.hostname,k.port||(k.port=M.port)}return k.objectMode===void 0&&(k.objectMode=!(k.binary===!0||k.binary===void 0)),k}function S(x,k,M){d("createWebSocket"),d("protocol: "+M.protocolId+" "+M.protocolVersion);const D=M.protocolId==="MQIsdp"&&M.protocolVersion===3?"mqttv3.1":"mqtt";return d("creating new Websocket for url: "+k+" and protocol: "+D),new f(k,[D],M.wsOptions)}function b(x,k){const M=k.protocolId==="MQIsdp"&&k.protocolVersion===3?"mqttv3.1":"mqtt",D=y(k,x),z=new WebSocket(D,[M]);return z.binaryType="arraybuffer",z}function T(x,k){d("streamBuilder");const M=A(k),D=y(M,x),z=S(x,D,M),j=f.createWebSocketStream(z,M.wsOptions);return j.url=D,z.on("close",()=>{j.destroy()}),j}function w(x,k){d("browserStreamBuilder");let M;const z=_(k).browserBufferSize||1024*512,j=k.browserBufferTimeout||1e3,oe=!k.objectMode,L=b(x,k),F=ue(k,Ie,Oe);k.objectMode||(F._writev=Y),F.on("close",()=>{L.close()});const O=typeof L.addEventListener<"u";L.readyState===L.OPEN?M=F:(M=M=p(void 0,void 0,k),k.objectMode||(M._writev=Y),O?L.addEventListener("open",_e):L.onopen=_e),M.socket=L,O?(L.addEventListener("close",Ce),L.addEventListener("error",de),L.addEventListener("message",ie)):(L.onclose=Ce,L.onerror=de,L.onmessage=ie);function ue(kt,Dt,Fe){const $e=new h({objectModeMode:kt.objectMode});return $e._write=Dt,$e._flush=Fe,$e}function _e(){M.setReadable(F),M.setWritable(F),M.emit("connect")}function Ce(){M.end(),M.destroy()}function de(kt){M.destroy(kt)}function ie(kt){let Dt=kt.data;Dt instanceof ArrayBuffer?Dt=c.from(Dt):Dt=c.from(Dt,"utf8"),F.push(Dt)}function Y(kt,Dt){const Fe=new Array(kt.length);for(let $e=0;$e<kt.length;$e++)typeof kt[$e].chunk=="string"?Fe[$e]=c.from(kt[$e],"utf8"):Fe[$e]=kt[$e].chunk;this._write(c.concat(Fe),"binary",Dt)}function Ie(kt,Dt,Fe){L.bufferedAmount>z&&setTimeout(Ie,j,kt,Dt,Fe),oe&&typeof kt=="string"&&(kt=c.from(kt,"utf8"));try{L.send(kt)}catch($e){return Fe($e)}Fe()}function Oe(kt){L.close(),kt()}return M}v?o.exports=w:o.exports=T}).call(this)}).call(this,i("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(i,o,a){const{Buffer:u}=i("buffer"),c=i("readable-stream").Transform,f=i("duplexify");let d,p,h;function g(){const S=new c;return S._write=function(b,T,w){d.send({data:b.buffer,success:function(){w()},fail:function(x){w(new Error(x))}})},S._flush=function(T){d.close({success:function(){T()}})},S}function v(S){S.hostname||(S.hostname="localhost"),S.path||(S.path="/"),S.wsOptions||(S.wsOptions={})}function y(S,b){const T=S.protocol==="wxs"?"wss":"ws";let w=T+"://"+S.hostname+S.path;return S.port&&S.port!==80&&S.port!==443&&(w=T+"://"+S.hostname+":"+S.port+S.path),typeof S.transformWsUrl=="function"&&(w=S.transformWsUrl(w,S,b)),w}function A(){d.onOpen(function(){h.setReadable(p),h.setWritable(p),h.emit("connect")}),d.onMessage(function(S){let b=S.data;b instanceof ArrayBuffer?b=u.from(b):b=u.from(b,"utf8"),p.push(b)}),d.onClose(function(){h.end(),h.destroy()}),d.onError(function(S){h.destroy(new Error(S.errMsg))})}function _(S,b){if(b.hostname=b.hostname||b.host,!b.hostname)throw new Error("Could not determine host. Specify host manually.");const T=b.protocolId==="MQIsdp"&&b.protocolVersion===3?"mqttv3.1":"mqtt";v(b);const w=y(b,S);d=wx.connectSocket({url:w,protocols:[T]}),p=g(),h=f.obj(),h._destroy=function(k,M){d.close({success:function(){M&&M(k)}})};const x=h.destroy;return h.destroy=function(){h.destroy=x;const k=this;setTimeout(function(){d.close({fail:function(){k._destroy(new Error)}})},0)}.bind(h),A(),h}o.exports=_},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(i,o,a){function u(){if(!(this instanceof u))return new u;this.nextId=Math.max(1,Math.floor(Math.random()*65535))}u.prototype.allocate=function(){const c=this.nextId++;return this.nextId===65536&&(this.nextId=1),c},u.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},u.prototype.register=function(c){return!0},u.prototype.deallocate=function(c){},u.prototype.clear=function(){},o.exports=u},{}],8:[function(i,o,a){const u=i("xtend"),c=i("readable-stream").Readable,f={objectMode:!0},d={clean:!0};function p(h){if(!(this instanceof p))return new p(h);this.options=h||{},this.options=u(d,h),this._inflights=new Map}p.prototype.put=function(h,g){return this._inflights.set(h.messageId,h),g&&g(),this},p.prototype.createStream=function(){const h=new c(f),g=[];let v=!1,y=0;return this._inflights.forEach(function(A,_){g.push(A)}),h._read=function(){!v&&y<g.length?this.push(g[y++]):this.push(null)},h.destroy=function(){if(v)return;const A=this;v=!0,setTimeout(function(){A.emit("close")},0)},h},p.prototype.del=function(h,g){return h=this._inflights.get(h.messageId),h?(this._inflights.delete(h.messageId),g(null,h)):g&&g(new Error("missing packet")),this},p.prototype.get=function(h,g){return h=this._inflights.get(h.messageId),h?g(null,h):g&&g(new Error("missing packet")),this},p.prototype.close=function(h){this.options.clean&&(this._inflights=null),h&&h()},o.exports=p},{"readable-stream":69,xtend:81}],9:[function(i,o,a){function u(c){if(!(this instanceof u))return new u(c);this.aliasToTopic={},this.max=c}u.prototype.put=function(c,f){return f===0||f>this.max?!1:(this.aliasToTopic[f]=c,this.length=Object.keys(this.aliasToTopic).length,!0)},u.prototype.getTopicByAlias=function(c){return this.aliasToTopic[c]},u.prototype.clear=function(){this.aliasToTopic={}},o.exports=u},{}],10:[function(i,o,a){const u=i("lru-cache"),c=i("number-allocator").NumberAllocator;function f(d){if(!(this instanceof f))return new f(d);d>0&&(this.aliasToTopic=new u({max:d}),this.topicToAlias={},this.numberAllocator=new c(1,d),this.max=d,this.length=0)}f.prototype.put=function(d,p){if(p===0||p>this.max)return!1;const h=this.aliasToTopic.get(p);return h&&delete this.topicToAlias[h],this.aliasToTopic.set(p,d),this.topicToAlias[d]=p,this.numberAllocator.use(p),this.length=this.aliasToTopic.length,!0},f.prototype.getTopicByAlias=function(d){return this.aliasToTopic.get(d)},f.prototype.getAliasByTopic=function(d){const p=this.topicToAlias[d];return typeof p<"u"&&this.aliasToTopic.get(p),p},f.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},f.prototype.getLruAlias=function(){const d=this.numberAllocator.firstVacant();return d||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},o.exports=f},{"lru-cache":37,"number-allocator":46}],11:[function(i,o,a){function u(f){const d=f.split("/");for(let p=0;p<d.length;p++)if(d[p]!=="+"){if(d[p]==="#")return p===d.length-1;if(d[p].indexOf("+")!==-1||d[p].indexOf("#")!==-1)return!1}return!0}function c(f){if(f.length===0)return"empty_topic_list";for(let d=0;d<f.length;d++)if(!u(f[d]))return f[d];return null}o.exports={validateTopics:c}},{}],12:[function(i,o,a){(function(u){(function(){const c=i("../client"),f=i("../store"),d=i("url"),p=i("xtend"),h=i("debug")("mqttjs"),g={};typeof u<"u"&&u.title!=="browser"||typeof __webpack_require__!="function"?(g.mqtt=i("./tcp"),g.tcp=i("./tcp"),g.ssl=i("./tls"),g.tls=i("./tls"),g.mqtts=i("./tls")):(g.wx=i("./wx"),g.wxs=i("./wx"),g.ali=i("./ali"),g.alis=i("./ali")),g.ws=i("./ws"),g.wss=i("./ws");function v(A){let _;A.auth&&(_=A.auth.match(/^(.+):(.+)$/),_?(A.username=_[1],A.password=_[2]):A.username=A.auth)}function y(A,_){if(h("connecting to an MQTT broker..."),typeof A=="object"&&!_&&(_=A,A=null),_=_||{},A){const T=d.parse(A,!0);if(T.port!=null&&(T.port=Number(T.port)),_=p(T,_),_.protocol===null)throw new Error("Missing protocol");_.protocol=_.protocol.replace(/:$/,"")}if(v(_),_.query&&typeof _.query.clientId=="string"&&(_.clientId=_.query.clientId),_.cert&&_.key)if(_.protocol){if(["mqtts","wss","wxs","alis"].indexOf(_.protocol)===-1)switch(_.protocol){case"mqtt":_.protocol="mqtts";break;case"ws":_.protocol="wss";break;case"wx":_.protocol="wxs";break;case"ali":_.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+_.protocol+'"!')}}else throw new Error("Missing secure protocol key");if(!g[_.protocol]){const T=["mqtts","wss"].indexOf(_.protocol)!==-1;_.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(w,x){return T&&x%2===0?!1:typeof g[w]=="function"})[0]}if(_.clean===!1&&!_.clientId)throw new Error("Missing clientId for unclean clients");_.protocol&&(_.defaultProtocol=_.protocol);function S(T){return _.servers&&((!T._reconnectCount||T._reconnectCount===_.servers.length)&&(T._reconnectCount=0),_.host=_.servers[T._reconnectCount].host,_.port=_.servers[T._reconnectCount].port,_.protocol=_.servers[T._reconnectCount].protocol?_.servers[T._reconnectCount].protocol:_.defaultProtocol,_.hostname=_.host,T._reconnectCount++),h("calling streambuilder for",_.protocol),g[_.protocol](T,_)}const b=new c(S,_);return b.on("error",function(){}),b}o.exports=y,o.exports.connect=y,o.exports.MqttClient=c,o.exports.Store=f}).call(this)}).call(this,i("_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(i,o,a){a.byteLength=v,a.toByteArray=A,a.fromByteArray=b;for(var u=[],c=[],f=typeof Uint8Array<"u"?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,h=d.length;p<h;++p)u[p]=d[p],c[d.charCodeAt(p)]=p;c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63;function g(T){var w=T.length;if(w%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var x=T.indexOf("=");x===-1&&(x=w);var k=x===w?0:4-x%4;return[x,k]}function v(T){var w=g(T),x=w[0],k=w[1];return(x+k)*3/4-k}function y(T,w,x){return(w+x)*3/4-x}function A(T){var w,x=g(T),k=x[0],M=x[1],D=new f(y(T,k,M)),z=0,j=M>0?k-4:k,oe;for(oe=0;oe<j;oe+=4)w=c[T.charCodeAt(oe)]<<18|c[T.charCodeAt(oe+1)]<<12|c[T.charCodeAt(oe+2)]<<6|c[T.charCodeAt(oe+3)],D[z++]=w>>16&255,D[z++]=w>>8&255,D[z++]=w&255;return M===2&&(w=c[T.charCodeAt(oe)]<<2|c[T.charCodeAt(oe+1)]>>4,D[z++]=w&255),M===1&&(w=c[T.charCodeAt(oe)]<<10|c[T.charCodeAt(oe+1)]<<4|c[T.charCodeAt(oe+2)]>>2,D[z++]=w>>8&255,D[z++]=w&255),D}function _(T){return u[T>>18&63]+u[T>>12&63]+u[T>>6&63]+u[T&63]}function S(T,w,x){for(var k,M=[],D=w;D<x;D+=3)k=(T[D]<<16&16711680)+(T[D+1]<<8&65280)+(T[D+2]&255),M.push(_(k));return M.join("")}function b(T){for(var w,x=T.length,k=x%3,M=[],D=16383,z=0,j=x-k;z<j;z+=D)M.push(S(T,z,z+D>j?j:z+D));return k===1?(w=T[x-1],M.push(u[w>>2]+u[w<<4&63]+"==")):k===2&&(w=(T[x-2]<<8)+T[x-1],M.push(u[w>>10]+u[w>>4&63]+u[w<<2&63]+"=")),M.join("")}},{}],14:[function(i,o,a){const{Buffer:u}=i("buffer"),c=Symbol.for("BufferList");function f(d){if(!(this instanceof f))return new f(d);f._init.call(this,d)}f._init=function(p){Object.defineProperty(this,c,{value:!0}),this._bufs=[],this.length=0,p&&this.append(p)},f.prototype._new=function(p){return new f(p)},f.prototype._offset=function(p){if(p===0)return[0,0];let h=0;for(let g=0;g<this._bufs.length;g++){const v=h+this._bufs[g].length;if(p<v||g===this._bufs.length-1)return[g,p-h];h=v}},f.prototype._reverseOffset=function(d){const p=d[0];let h=d[1];for(let g=0;g<p;g++)h+=this._bufs[g].length;return h},f.prototype.get=function(p){if(p>this.length||p<0)return;const h=this._offset(p);return this._bufs[h[0]][h[1]]},f.prototype.slice=function(p,h){return typeof p=="number"&&p<0&&(p+=this.length),typeof h=="number"&&h<0&&(h+=this.length),this.copy(null,0,p,h)},f.prototype.copy=function(p,h,g,v){if((typeof g!="number"||g<0)&&(g=0),(typeof v!="number"||v>this.length)&&(v=this.length),g>=this.length||v<=0)return p||u.alloc(0);const y=!!p,A=this._offset(g),_=v-g;let S=_,b=y&&h||0,T=A[1];if(g===0&&v===this.length){if(!y)return this._bufs.length===1?this._bufs[0]:u.concat(this._bufs,this.length);for(let w=0;w<this._bufs.length;w++)this._bufs[w].copy(p,b),b+=this._bufs[w].length;return p}if(S<=this._bufs[A[0]].length-T)return y?this._bufs[A[0]].copy(p,h,T,T+S):this._bufs[A[0]].slice(T,T+S);y||(p=u.allocUnsafe(_));for(let w=A[0];w<this._bufs.length;w++){const x=this._bufs[w].length-T;if(S>x)this._bufs[w].copy(p,b,T),b+=x;else{this._bufs[w].copy(p,b,T,T+S),b+=x;break}S-=x,T&&(T=0)}return p.length>b?p.slice(0,b):p},f.prototype.shallowSlice=function(p,h){if(p=p||0,h=typeof h!="number"?this.length:h,p<0&&(p+=this.length),h<0&&(h+=this.length),p===h)return this._new();const g=this._offset(p),v=this._offset(h),y=this._bufs.slice(g[0],v[0]+1);return v[1]===0?y.pop():y[y.length-1]=y[y.length-1].slice(0,v[1]),g[1]!==0&&(y[0]=y[0].slice(g[1])),this._new(y)},f.prototype.toString=function(p,h,g){return this.slice(h,g).toString(p)},f.prototype.consume=function(p){if(p=Math.trunc(p),Number.isNaN(p)||p<=0)return this;for(;this._bufs.length;)if(p>=this._bufs[0].length)p-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(p),this.length-=p;break}return this},f.prototype.duplicate=function(){const p=this._new();for(let h=0;h<this._bufs.length;h++)p.append(this._bufs[h]);return p},f.prototype.append=function(p){if(p==null)return this;if(p.buffer)this._appendBuffer(u.from(p.buffer,p.byteOffset,p.byteLength));else if(Array.isArray(p))for(let h=0;h<p.length;h++)this.append(p[h]);else if(this._isBufferList(p))for(let h=0;h<p._bufs.length;h++)this.append(p._bufs[h]);else typeof p=="number"&&(p=p.toString()),this._appendBuffer(u.from(p));return this},f.prototype._appendBuffer=function(p){this._bufs.push(p),this.length+=p.length},f.prototype.indexOf=function(d,p,h){if(h===void 0&&typeof p=="string"&&(h=p,p=void 0),typeof d=="function"||Array.isArray(d))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof d=="number"?d=u.from([d]):typeof d=="string"?d=u.from(d,h):this._isBufferList(d)?d=d.slice():Array.isArray(d.buffer)?d=u.from(d.buffer,d.byteOffset,d.byteLength):u.isBuffer(d)||(d=u.from(d)),p=Number(p||0),isNaN(p)&&(p=0),p<0&&(p=this.length+p),p<0&&(p=0),d.length===0)return p>this.length?this.length:p;const g=this._offset(p);let v=g[0],y=g[1];for(;v<this._bufs.length;v++){const A=this._bufs[v];for(;y<A.length;)if(A.length-y>=d.length){const S=A.indexOf(d,y);if(S!==-1)return this._reverseOffset([v,S]);y=A.length-d.length+1}else{const S=this._reverseOffset([v,y]);if(this._match(S,d))return S;y++}y=0}return-1},f.prototype._match=function(d,p){if(this.length-d<p.length)return!1;for(let h=0;h<p.length;h++)if(this.get(d+h)!==p[h])return!1;return!0},function(){const d={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 p in d)(function(h){d[h]===null?f.prototype[h]=function(g,v){return this.slice(g,g+v)[h](0,v)}:f.prototype[h]=function(g=0){return this.slice(g,g+d[h])[h](0)}})(p)}(),f.prototype._isBufferList=function(p){return p instanceof f||f.isBufferList(p)},f.isBufferList=function(p){return p!=null&&p[c]},o.exports=f},{buffer:17}],15:[function(i,o,a){const u=i("readable-stream").Duplex,c=i("inherits"),f=i("./BufferList");function d(p){if(!(this instanceof d))return new d(p);if(typeof p=="function"){this._callback=p;const h=function(v){this._callback&&(this._callback(v),this._callback=null)}.bind(this);this.on("pipe",function(v){v.on("error",h)}),this.on("unpipe",function(v){v.removeListener("error",h)}),p=null}f._init.call(this,p),u.call(this)}c(d,u),Object.assign(d.prototype,f.prototype),d.prototype._new=function(h){return new d(h)},d.prototype._write=function(h,g,v){this._appendBuffer(h),typeof v=="function"&&v()},d.prototype._read=function(h){if(!this.length)return this.push(null);h=Math.min(h,this.length),this.push(this.slice(0,h)),this.consume(h)},d.prototype.end=function(h){u.prototype.end.call(this,h),this._callback&&(this._callback(null,this.slice()),this._callback=null)},d.prototype._destroy=function(h,g){this._bufs.length=0,this.length=0,g(h)},d.prototype._isBufferList=function(h){return h instanceof d||h instanceof f||d.isBufferList(h)},d.isBufferList=f.isBufferList,o.exports=d,o.exports.BufferListStream=d,o.exports.BufferList=f},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(i,o,a){},{}],17:[function(i,o,a){(function(u){(function(){var c=i("base64-js"),f=i("ieee754");a.Buffer=g,a.SlowBuffer=k,a.INSPECT_MAX_BYTES=50;var d=2147483647;a.kMaxLength=d,g.TYPED_ARRAY_SUPPORT=p(),!g.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 p(){try{var re=new Uint8Array(1);return re.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},re.foo()===42}catch{return!1}}Object.defineProperty(g.prototype,"parent",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.buffer}}),Object.defineProperty(g.prototype,"offset",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.byteOffset}});function h(re){if(re>d)throw new RangeError('The value "'+re+'" is invalid for option "size"');var V=new Uint8Array(re);return V.__proto__=g.prototype,V}function g(re,V,$){if(typeof re=="number"){if(typeof V=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _(re)}return v(re,V,$)}typeof Symbol<"u"&&Symbol.species!=null&&g[Symbol.species]===g&&Object.defineProperty(g,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),g.poolSize=8192;function v(re,V,$){if(typeof re=="string")return S(re,V);if(ArrayBuffer.isView(re))return b(re);if(re==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof re);if(ae(re,ArrayBuffer)||re&&ae(re.buffer,ArrayBuffer))return T(re,V,$);if(typeof re=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var he=re.valueOf&&re.valueOf();if(he!=null&&he!==re)return g.from(he,V,$);var Ue=w(re);if(Ue)return Ue;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof re[Symbol.toPrimitive]=="function")return g.from(re[Symbol.toPrimitive]("string"),V,$);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof re)}g.from=function(re,V,$){return v(re,V,$)},g.prototype.__proto__=Uint8Array.prototype,g.__proto__=Uint8Array;function y(re){if(typeof re!="number")throw new TypeError('"size" argument must be of type number');if(re<0)throw new RangeError('The value "'+re+'" is invalid for option "size"')}function A(re,V,$){return y(re),re<=0?h(re):V!==void 0?typeof $=="string"?h(re).fill(V,$):h(re).fill(V):h(re)}g.alloc=function(re,V,$){return A(re,V,$)};function _(re){return y(re),h(re<0?0:x(re)|0)}g.allocUnsafe=function(re){return _(re)},g.allocUnsafeSlow=function(re){return _(re)};function S(re,V){if((typeof V!="string"||V==="")&&(V="utf8"),!g.isEncoding(V))throw new TypeError("Unknown encoding: "+V);var $=M(re,V)|0,he=h($),Ue=he.write(re,V);return Ue!==$&&(he=he.slice(0,Ue)),he}function b(re){for(var V=re.length<0?0:x(re.length)|0,$=h(V),he=0;he<V;he+=1)$[he]=re[he]&255;return $}function T(re,V,$){if(V<0||re.byteLength<V)throw new RangeError('"offset" is outside of buffer bounds');if(re.byteLength<V+($||0))throw new RangeError('"length" is outside of buffer bounds');var he;return V===void 0&&$===void 0?he=new Uint8Array(re):$===void 0?he=new Uint8Array(re,V):he=new Uint8Array(re,V,$),he.__proto__=g.prototype,he}function w(re){if(g.isBuffer(re)){var V=x(re.length)|0,$=h(V);return $.length===0||re.copy($,0,0,V),$}if(re.length!==void 0)return typeof re.length!="number"||le(re.length)?h(0):b(re);if(re.type==="Buffer"&&Array.isArray(re.data))return b(re.data)}function x(re){if(re>=d)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+d.toString(16)+" bytes");return re|0}function k(re){return+re!=re&&(re=0),g.alloc(+re)}g.isBuffer=function(V){return V!=null&&V._isBuffer===!0&&V!==g.prototype},g.compare=function(V,$){if(ae(V,Uint8Array)&&(V=g.from(V,V.offset,V.byteLength)),ae($,Uint8Array)&&($=g.from($,$.offset,$.byteLength)),!g.isBuffer(V)||!g.isBuffer($))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(V===$)return 0;for(var he=V.length,Ue=$.length,qe=0,jt=Math.min(he,Ue);qe<jt;++qe)if(V[qe]!==$[qe]){he=V[qe],Ue=$[qe];break}return he<Ue?-1:Ue<he?1:0},g.isEncoding=function(V){switch(String(V).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}},g.concat=function(V,$){if(!Array.isArray(V))throw new TypeError('"list" argument must be an Array of Buffers');if(V.length===0)return g.alloc(0);var he;if($===void 0)for($=0,he=0;he<V.length;++he)$+=V[he].length;var Ue=g.allocUnsafe($),qe=0;for(he=0;he<V.length;++he){var jt=V[he];if(ae(jt,Uint8Array)&&(jt=g.from(jt)),!g.isBuffer(jt))throw new TypeError('"list" argument must be an Array of Buffers');jt.copy(Ue,qe),qe+=jt.length}return Ue};function M(re,V){if(g.isBuffer(re))return re.length;if(ArrayBuffer.isView(re)||ae(re,ArrayBuffer))return re.byteLength;if(typeof re!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof re);var $=re.length,he=arguments.length>2&&arguments[2]===!0;if(!he&&$===0)return 0;for(var Ue=!1;;)switch(V){case"ascii":case"latin1":case"binary":return $;case"utf8":case"utf-8":return Ve(re).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $*2;case"hex":return $>>>1;case"base64":return Pt(re).length;default:if(Ue)return he?-1:Ve(re).length;V=(""+V).toLowerCase(),Ue=!0}}g.byteLength=M;function D(re,V,$){var he=!1;if((V===void 0||V<0)&&(V=0),V>this.length||(($===void 0||$>this.length)&&($=this.length),$<=0)||($>>>=0,V>>>=0,$<=V))return"";for(re||(re="utf8");;)switch(re){case"hex":return Dt(this,V,$);case"utf8":case"utf-8":return ie(this,V,$);case"ascii":return Oe(this,V,$);case"latin1":case"binary":return kt(this,V,$);case"base64":return de(this,V,$);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fe(this,V,$);default:if(he)throw new TypeError("Unknown encoding: "+re);re=(re+"").toLowerCase(),he=!0}}g.prototype._isBuffer=!0;function z(re,V,$){var he=re[V];re[V]=re[$],re[$]=he}g.prototype.swap16=function(){var V=this.length;if(V%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var $=0;$<V;$+=2)z(this,$,$+1);return this},g.prototype.swap32=function(){var V=this.length;if(V%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var $=0;$<V;$+=4)z(this,$,$+3),z(this,$+1,$+2);return this},g.prototype.swap64=function(){var V=this.length;if(V%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var $=0;$<V;$+=8)z(this,$,$+7),z(this,$+1,$+6),z(this,$+2,$+5),z(this,$+3,$+4);return this},g.prototype.toString=function(){var V=this.length;return V===0?"":arguments.length===0?ie(this,0,V):D.apply(this,arguments)},g.prototype.toLocaleString=g.prototype.toString,g.prototype.equals=function(V){if(!g.isBuffer(V))throw new TypeError("Argument must be a Buffer");return this===V?!0:g.compare(this,V)===0},g.prototype.inspect=function(){var V="",$=a.INSPECT_MAX_BYTES;return V=this.toString("hex",0,$).replace(/(.{2})/g,"$1 ").trim(),this.length>$&&(V+=" ... "),"<Buffer "+V+">"},g.prototype.compare=function(V,$,he,Ue,qe){if(ae(V,Uint8Array)&&(V=g.from(V,V.offset,V.byteLength)),!g.isBuffer(V))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof V);if($===void 0&&($=0),he===void 0&&(he=V?V.length:0),Ue===void 0&&(Ue=0),qe===void 0&&(qe=this.length),$<0||he>V.length||Ue<0||qe>this.length)throw new RangeError("out of range index");if(Ue>=qe&&$>=he)return 0;if(Ue>=qe)return-1;if($>=he)return 1;if($>>>=0,he>>>=0,Ue>>>=0,qe>>>=0,this===V)return 0;for(var jt=qe-Ue,An=he-$,wn=Math.min(jt,An),En=this.slice(Ue,qe),xn=V.slice($,he),Tn=0;Tn<wn;++Tn)if(En[Tn]!==xn[Tn]){jt=En[Tn],An=xn[Tn];break}return jt<An?-1:An<jt?1:0};function j(re,V,$,he,Ue){if(re.length===0)return-1;if(typeof $=="string"?(he=$,$=0):$>2147483647?$=2147483647:$<-2147483648&&($=-2147483648),$=+$,le($)&&($=Ue?0:re.length-1),$<0&&($=re.length+$),$>=re.length){if(Ue)return-1;$=re.length-1}else if($<0)if(Ue)$=0;else return-1;if(typeof V=="string"&&(V=g.from(V,he)),g.isBuffer(V))return V.length===0?-1:oe(re,V,$,he,Ue);if(typeof V=="number")return V=V&255,typeof Uint8Array.prototype.indexOf=="function"?Ue?Uint8Array.prototype.indexOf.call(re,V,$):Uint8Array.prototype.lastIndexOf.call(re,V,$):oe(re,[V],$,he,Ue);throw new TypeError("val must be string, number or Buffer")}function oe(re,V,$,he,Ue){var qe=1,jt=re.length,An=V.length;if(he!==void 0&&(he=String(he).toLowerCase(),he==="ucs2"||he==="ucs-2"||he==="utf16le"||he==="utf-16le")){if(re.length<2||V.length<2)return-1;qe=2,jt/=2,An/=2,$/=2}function wn(kn,Rn){return qe===1?kn[Rn]:kn.readUInt16BE(Rn*qe)}var En;if(Ue){var xn=-1;for(En=$;En<jt;En++)if(wn(re,En)===wn(V,xn===-1?0:En-xn)){if(xn===-1&&(xn=En),En-xn+1===An)return xn*qe}else xn!==-1&&(En-=En-xn),xn=-1}else for($+An>jt&&($=jt-An),En=$;En>=0;En--){for(var Tn=!0,Pn=0;Pn<An;Pn++)if(wn(re,En+Pn)!==wn(V,Pn)){Tn=!1;break}if(Tn)return En}return-1}g.prototype.includes=function(V,$,he){return this.indexOf(V,$,he)!==-1},g.prototype.indexOf=function(V,$,he){return j(this,V,$,he,!0)},g.prototype.lastIndexOf=function(V,$,he){return j(this,V,$,he,!1)};function L(re,V,$,he){$=Number($)||0;var Ue=re.length-$;he?(he=Number(he),he>Ue&&(he=Ue)):he=Ue;var qe=V.length;he>qe/2&&(he=qe/2);for(var jt=0;jt<he;++jt){var An=parseInt(V.substr(jt*2,2),16);if(le(An))return jt;re[$+jt]=An}return jt}function F(re,V,$,he){return hn(Ve(V,re.length-$),re,$,he)}function O(re,V,$,he){return hn(xe(V),re,$,he)}function ue(re,V,$,he){return O(re,V,$,he)}function _e(re,V,$,he){return hn(Pt(V),re,$,he)}function Ce(re,V,$,he){return hn(ze(V,re.length-$),re,$,he)}g.prototype.write=function(V,$,he,Ue){if($===void 0)Ue="utf8",he=this.length,$=0;else if(he===void 0&&typeof $=="string")Ue=$,he=this.length,$=0;else if(isFinite($))$=$>>>0,isFinite(he)?(he=he>>>0,Ue===void 0&&(Ue="utf8")):(Ue=he,he=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var qe=this.length-$;if((he===void 0||he>qe)&&(he=qe),V.length>0&&(he<0||$<0)||$>this.length)throw new RangeError("Attempt to write outside buffer bounds");Ue||(Ue="utf8");for(var jt=!1;;)switch(Ue){case"hex":return L(this,V,$,he);case"utf8":case"utf-8":return F(this,V,$,he);case"ascii":return O(this,V,$,he);case"latin1":case"binary":return ue(this,V,$,he);case"base64":return _e(this,V,$,he);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ce(this,V,$,he);default:if(jt)throw new TypeError("Unknown encoding: "+Ue);Ue=(""+Ue).toLowerCase(),jt=!0}},g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function de(re,V,$){return V===0&&$===re.length?c.fromByteArray(re):c.fromByteArray(re.slice(V,$))}function ie(re,V,$){$=Math.min(re.length,$);for(var he=[],Ue=V;Ue<$;){var qe=re[Ue],jt=null,An=qe>239?4:qe>223?3:qe>191?2:1;if(Ue+An<=$){var wn,En,xn,Tn;switch(An){case 1:qe<128&&(jt=qe);break;case 2:wn=re[Ue+1],(wn&192)===128&&(Tn=(qe&31)<<6|wn&63,Tn>127&&(jt=Tn));break;case 3:wn=re[Ue+1],En=re[Ue+2],(wn&192)===128&&(En&192)===128&&(Tn=(qe&15)<<12|(wn&63)<<6|En&63,Tn>2047&&(Tn<55296||Tn>57343)&&(jt=Tn));break;case 4:wn=re[Ue+1],En=re[Ue+2],xn=re[Ue+3],(wn&192)===128&&(En&192)===128&&(xn&192)===128&&(Tn=(qe&15)<<18|(wn&63)<<12|(En&63)<<6|xn&63,Tn>65535&&Tn<1114112&&(jt=Tn))}}jt===null?(jt=65533,An=1):jt>65535&&(jt-=65536,he.push(jt>>>10&1023|55296),jt=56320|jt&1023),he.push(jt),Ue+=An}return Ie(he)}var Y=4096;function Ie(re){var V=re.length;if(V<=Y)return String.fromCharCode.apply(String,re);for(var $="",he=0;he<V;)$+=String.fromCharCode.apply(String,re.slice(he,he+=Y));return $}function Oe(re,V,$){var he="";$=Math.min(re.length,$);for(var Ue=V;Ue<$;++Ue)he+=String.fromCharCode(re[Ue]&127);return he}function kt(re,V,$){var he="";$=Math.min(re.length,$);for(var Ue=V;Ue<$;++Ue)he+=String.fromCharCode(re[Ue]);return he}function Dt(re,V,$){var he=re.length;(!V||V<0)&&(V=0),(!$||$<0||$>he)&&($=he);for(var Ue="",qe=V;qe<$;++qe)Ue+=At(re[qe]);return Ue}function Fe(re,V,$){for(var he=re.slice(V,$),Ue="",qe=0;qe<he.length;qe+=2)Ue+=String.fromCharCode(he[qe]+he[qe+1]*256);return Ue}g.prototype.slice=function(V,$){var he=this.length;V=~~V,$=$===void 0?he:~~$,V<0?(V+=he,V<0&&(V=0)):V>he&&(V=he),$<0?($+=he,$<0&&($=0)):$>he&&($=he),$<V&&($=V);var Ue=this.subarray(V,$);return Ue.__proto__=g.prototype,Ue};function $e(re,V,$){if(re%1!==0||re<0)throw new RangeError("offset is not uint");if(re+V>$)throw new RangeError("Trying to access beyond buffer length")}g.prototype.readUIntLE=function(V,$,he){V=V>>>0,$=$>>>0,he||$e(V,$,this.length);for(var Ue=this[V],qe=1,jt=0;++jt<$&&(qe*=256);)Ue+=this[V+jt]*qe;return Ue},g.prototype.readUIntBE=function(V,$,he){V=V>>>0,$=$>>>0,he||$e(V,$,this.length);for(var Ue=this[V+--$],qe=1;$>0&&(qe*=256);)Ue+=this[V+--$]*qe;return Ue},g.prototype.readUInt8=function(V,$){return V=V>>>0,$||$e(V,1,this.length),this[V]},g.prototype.readUInt16LE=function(V,$){return V=V>>>0,$||$e(V,2,this.length),this[V]|this[V+1]<<8},g.prototype.readUInt16BE=function(V,$){return V=V>>>0,$||$e(V,2,this.length),this[V]<<8|this[V+1]},g.prototype.readUInt32LE=function(V,$){return V=V>>>0,$||$e(V,4,this.length),(this[V]|this[V+1]<<8|this[V+2]<<16)+this[V+3]*16777216},g.prototype.readUInt32BE=function(V,$){return V=V>>>0,$||$e(V,4,this.length),this[V]*16777216+(this[V+1]<<16|this[V+2]<<8|this[V+3])},g.prototype.readIntLE=function(V,$,he){V=V>>>0,$=$>>>0,he||$e(V,$,this.length);for(var Ue=this[V],qe=1,jt=0;++jt<$&&(qe*=256);)Ue+=this[V+jt]*qe;return qe*=128,Ue>=qe&&(Ue-=Math.pow(2,8*$)),Ue},g.prototype.readIntBE=function(V,$,he){V=V>>>0,$=$>>>0,he||$e(V,$,this.length);for(var Ue=$,qe=1,jt=this[V+--Ue];Ue>0&&(qe*=256);)jt+=this[V+--Ue]*qe;return qe*=128,jt>=qe&&(jt-=Math.pow(2,8*$)),jt},g.prototype.readInt8=function(V,$){return V=V>>>0,$||$e(V,1,this.length),this[V]&128?(255-this[V]+1)*-1:this[V]},g.prototype.readInt16LE=function(V,$){V=V>>>0,$||$e(V,2,this.length);var he=this[V]|this[V+1]<<8;return he&32768?he|4294901760:he},g.prototype.readInt16BE=function(V,$){V=V>>>0,$||$e(V,2,this.length);var he=this[V+1]|this[V]<<8;return he&32768?he|4294901760:he},g.prototype.readInt32LE=function(V,$){return V=V>>>0,$||$e(V,4,this.length),this[V]|this[V+1]<<8|this[V+2]<<16|this[V+3]<<24},g.prototype.readInt32BE=function(V,$){return V=V>>>0,$||$e(V,4,this.length),this[V]<<24|this[V+1]<<16|this[V+2]<<8|this[V+3]},g.prototype.readFloatLE=function(V,$){return V=V>>>0,$||$e(V,4,this.length),f.read(this,V,!0,23,4)},g.prototype.readFloatBE=function(V,$){return V=V>>>0,$||$e(V,4,this.length),f.read(this,V,!1,23,4)},g.prototype.readDoubleLE=function(V,$){return V=V>>>0,$||$e(V,8,this.length),f.read(this,V,!0,52,8)},g.prototype.readDoubleBE=function(V,$){return V=V>>>0,$||$e(V,8,this.length),f.read(this,V,!1,52,8)};function Cn(re,V,$,he,Ue,qe){if(!g.isBuffer(re))throw new TypeError('"buffer" argument must be a Buffer instance');if(V>Ue||V<qe)throw new RangeError('"value" argument is out of bounds');if($+he>re.length)throw new RangeError("Index out of range")}g.prototype.writeUIntLE=function(V,$,he,Ue){if(V=+V,$=$>>>0,he=he>>>0,!Ue){var qe=Math.pow(2,8*he)-1;Cn(this,V,$,he,qe,0)}var jt=1,An=0;for(this[$]=V&255;++An<he&&(jt*=256);)this[$+An]=V/jt&255;return $+he},g.prototype.writeUIntBE=function(V,$,he,Ue){if(V=+V,$=$>>>0,he=he>>>0,!Ue){var qe=Math.pow(2,8*he)-1;Cn(this,V,$,he,qe,0)}var jt=he-1,An=1;for(this[$+jt]=V&255;--jt>=0&&(An*=256);)this[$+jt]=V/An&255;return $+he},g.prototype.writeUInt8=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,1,255,0),this[$]=V&255,$+1},g.prototype.writeUInt16LE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,2,65535,0),this[$]=V&255,this[$+1]=V>>>8,$+2},g.prototype.writeUInt16BE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,2,65535,0),this[$]=V>>>8,this[$+1]=V&255,$+2},g.prototype.writeUInt32LE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,4,4294967295,0),this[$+3]=V>>>24,this[$+2]=V>>>16,this[$+1]=V>>>8,this[$]=V&255,$+4},g.prototype.writeUInt32BE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,4,4294967295,0),this[$]=V>>>24,this[$+1]=V>>>16,this[$+2]=V>>>8,this[$+3]=V&255,$+4},g.prototype.writeIntLE=function(V,$,he,Ue){if(V=+V,$=$>>>0,!Ue){var qe=Math.pow(2,8*he-1);Cn(this,V,$,he,qe-1,-qe)}var jt=0,An=1,wn=0;for(this[$]=V&255;++jt<he&&(An*=256);)V<0&&wn===0&&this[$+jt-1]!==0&&(wn=1),this[$+jt]=(V/An>>0)-wn&255;return $+he},g.prototype.writeIntBE=function(V,$,he,Ue){if(V=+V,$=$>>>0,!Ue){var qe=Math.pow(2,8*he-1);Cn(this,V,$,he,qe-1,-qe)}var jt=he-1,An=1,wn=0;for(this[$+jt]=V&255;--jt>=0&&(An*=256);)V<0&&wn===0&&this[$+jt+1]!==0&&(wn=1),this[$+jt]=(V/An>>0)-wn&255;return $+he},g.prototype.writeInt8=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,1,127,-128),V<0&&(V=255+V+1),this[$]=V&255,$+1},g.prototype.writeInt16LE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,2,32767,-32768),this[$]=V&255,this[$+1]=V>>>8,$+2},g.prototype.writeInt16BE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,2,32767,-32768),this[$]=V>>>8,this[$+1]=V&255,$+2},g.prototype.writeInt32LE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,4,2147483647,-2147483648),this[$]=V&255,this[$+1]=V>>>8,this[$+2]=V>>>16,this[$+3]=V>>>24,$+4},g.prototype.writeInt32BE=function(V,$,he){return V=+V,$=$>>>0,he||Cn(this,V,$,4,2147483647,-2147483648),V<0&&(V=4294967295+V+1),this[$]=V>>>24,this[$+1]=V>>>16,this[$+2]=V>>>8,this[$+3]=V&255,$+4};function Lt(re,V,$,he,Ue,qe){if($+he>re.length)throw new RangeError("Index out of range");if($<0)throw new RangeError("Index out of range")}function In(re,V,$,he,Ue){return V=+V,$=$>>>0,Ue||Lt(re,V,$,4),f.write(re,V,$,he,23,4),$+4}g.prototype.writeFloatLE=function(V,$,he){return In(this,V,$,!0,he)},g.prototype.writeFloatBE=function(V,$,he){return In(this,V,$,!1,he)};function Et(re,V,$,he,Ue){return V=+V,$=$>>>0,Ue||Lt(re,V,$,8),f.write(re,V,$,he,52,8),$+8}g.prototype.writeDoubleLE=function(V,$,he){return Et(this,V,$,!0,he)},g.prototype.writeDoubleBE=function(V,$,he){return Et(this,V,$,!1,he)},g.prototype.copy=function(V,$,he,Ue){if(!g.isBuffer(V))throw new TypeError("argument should be a Buffer");if(he||(he=0),!Ue&&Ue!==0&&(Ue=this.length),$>=V.length&&($=V.length),$||($=0),Ue>0&&Ue<he&&(Ue=he),Ue===he||V.length===0||this.length===0)return 0;if($<0)throw new RangeError("targetStart out of bounds");if(he<0||he>=this.length)throw new RangeError("Index out of range");if(Ue<0)throw new RangeError("sourceEnd out of bounds");Ue>this.length&&(Ue=this.length),V.length-$<Ue-he&&(Ue=V.length-$+he);var qe=Ue-he;if(this===V&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin($,he,Ue);else if(this===V&&he<$&&$<Ue)for(var jt=qe-1;jt>=0;--jt)V[jt+$]=this[jt+he];else Uint8Array.prototype.set.call(V,this.subarray(he,Ue),$);return qe},g.prototype.fill=function(V,$,he,Ue){if(typeof V=="string"){if(typeof $=="string"?(Ue=$,$=0,he=this.length):typeof he=="string"&&(Ue=he,he=this.length),Ue!==void 0&&typeof Ue!="string")throw new TypeError("encoding must be a string");if(typeof Ue=="string"&&!g.isEncoding(Ue))throw new TypeError("Unknown encoding: "+Ue);if(V.length===1){var qe=V.charCodeAt(0);(Ue==="utf8"&&qe<128||Ue==="latin1")&&(V=qe)}}else typeof V=="number"&&(V=V&255);if($<0||this.length<$||this.length<he)throw new RangeError("Out of range index");if(he<=$)return this;$=$>>>0,he=he===void 0?this.length:he>>>0,V||(V=0);var jt;if(typeof V=="number")for(jt=$;jt<he;++jt)this[jt]=V;else{var An=g.isBuffer(V)?V:g.from(V,Ue),wn=An.length;if(wn===0)throw new TypeError('The value "'+V+'" is invalid for argument "value"');for(jt=0;jt<he-$;++jt)this[jt+$]=An[jt%wn]}return this};var Ne=/[^+/0-9A-Za-z-_]/g;function pe(re){if(re=re.split("=")[0],re=re.trim().replace(Ne,""),re.length<2)return"";for(;re.length%4!==0;)re=re+"=";return re}function At(re){return re<16?"0"+re.toString(16):re.toString(16)}function Ve(re,V){V=V||1/0;for(var $,he=re.length,Ue=null,qe=[],jt=0;jt<he;++jt){if($=re.charCodeAt(jt),$>55295&&$<57344){if(!Ue){if($>56319){(V-=3)>-1&&qe.push(239,191,189);continue}else if(jt+1===he){(V-=3)>-1&&qe.push(239,191,189);continue}Ue=$;continue}if($<56320){(V-=3)>-1&&qe.push(239,191,189),Ue=$;continue}$=(Ue-55296<<10|$-56320)+65536}else Ue&&(V-=3)>-1&&qe.push(239,191,189);if(Ue=null,$<128){if((V-=1)<0)break;qe.push($)}else if($<2048){if((V-=2)<0)break;qe.push($>>6|192,$&63|128)}else if($<65536){if((V-=3)<0)break;qe.push($>>12|224,$>>6&63|128,$&63|128)}else if($<1114112){if((V-=4)<0)break;qe.push($>>18|240,$>>12&63|128,$>>6&63|128,$&63|128)}else throw new Error("Invalid code point")}return qe}function xe(re){for(var V=[],$=0;$<re.length;++$)V.push(re.charCodeAt($)&255);return V}function ze(re,V){for(var $,he,Ue,qe=[],jt=0;jt<re.length&&!((V-=2)<0);++jt)$=re.charCodeAt(jt),he=$>>8,Ue=$%256,qe.push(Ue),qe.push(he);return qe}function Pt(re){return c.toByteArray(pe(re))}function hn(re,V,$,he){for(var Ue=0;Ue<he&&!(Ue+$>=V.length||Ue>=re.length);++Ue)V[Ue+$]=re[Ue];return Ue}function ae(re,V){return re instanceof V||re!=null&&re.constructor!=null&&re.constructor.name!=null&&re.constructor.name===V.name}function le(re){return re!==re}}).call(this)}).call(this,i("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(i,o,a){(function(u){(function(){a.formatArgs=f,a.save=d,a.load=p,a.useColors=c,a.storage=h(),a.destroy=(()=>{let v=!1;return()=>{v||(v=!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`."))}})(),a.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 c(){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 f(v){if(v[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+v[0]+(this.useColors?"%c ":" ")+"+"+o.exports.humanize(this.diff),!this.useColors)return;const y="color: "+this.color;v.splice(1,0,y,"color: inherit");let A=0,_=0;v[0].replace(/%[a-zA-Z%]/g,S=>{S!=="%%"&&(A++,S==="%c"&&(_=A))}),v.splice(_,0,y)}a.log=console.debug||console.log||(()=>{});function d(v){try{v?a.storage.setItem("debug",v):a.storage.removeItem("debug")}catch{}}function p(){let v;try{v=a.storage.getItem("debug")}catch{}return!v&&typeof u<"u"&&"env"in u&&(v=u.env.DEBUG),v}function h(){try{return localStorage}catch{}}o.exports=i("./common")(a);const{formatters:g}=o.exports;g.j=function(v){try{return JSON.stringify(v)}catch(y){return"[UnexpectedJSONParseError]: "+y.message}}}).call(this)}).call(this,i("_process"))},{"./common":19,_process:50}],19:[function(i,o,a){function u(c){d.debug=d,d.default=d,d.coerce=A,d.disable=g,d.enable=h,d.enabled=v,d.humanize=i("ms"),d.destroy=_,Object.keys(c).forEach(S=>{d[S]=c[S]}),d.names=[],d.skips=[],d.formatters={};function f(S){let b=0;for(let T=0;T<S.length;T++)b=(b<<5)-b+S.charCodeAt(T),b|=0;return d.colors[Math.abs(b)%d.colors.length]}d.selectColor=f;function d(S){let b,T=null,w,x;function k(...M){if(!k.enabled)return;const D=k,z=Number(new Date),j=z-(b||z);D.diff=j,D.prev=b,D.curr=z,b=z,M[0]=d.coerce(M[0]),typeof M[0]!="string"&&M.unshift("%O");let oe=0;M[0]=M[0].replace(/%([a-zA-Z%])/g,(F,O)=>{if(F==="%%")return"%";oe++;const ue=d.formatters[O];if(typeof ue=="function"){const _e=M[oe];F=ue.call(D,_e),M.splice(oe,1),oe--}return F}),d.formatArgs.call(D,M),(D.log||d.log).apply(D,M)}return k.namespace=S,k.useColors=d.useColors(),k.color=d.selectColor(S),k.extend=p,k.destroy=d.destroy,Object.defineProperty(k,"enabled",{enumerable:!0,configurable:!1,get:()=>T!==null?T:(w!==d.namespaces&&(w=d.namespaces,x=d.enabled(S)),x),set:M=>{T=M}}),typeof d.init=="function"&&d.init(k),k}function p(S,b){const T=d(this.namespace+(typeof b>"u"?":":b)+S);return T.log=this.log,T}function h(S){d.save(S),d.namespaces=S,d.names=[],d.skips=[];let b;const T=(typeof S=="string"?S:"").split(/[\s,]+/),w=T.length;for(b=0;b<w;b++)T[b]&&(S=T[b].replace(/\*/g,".*?"),S[0]==="-"?d.skips.push(new RegExp("^"+S.substr(1)+"$")):d.names.push(new RegExp("^"+S+"$")))}function g(){const S=[...d.names.map(y),...d.skips.map(y).map(b=>"-"+b)].join(",");return d.enable(""),S}function v(S){if(S[S.length-1]==="*")return!0;let b,T;for(b=0,T=d.skips.length;b<T;b++)if(d.skips[b].test(S))return!1;for(b=0,T=d.names.length;b<T;b++)if(d.names[b].test(S))return!0;return!1}function y(S){return S.toString().substring(2,S.toString().length-2).replace(/\.\*\?$/,"*")}function A(S){return S instanceof Error?S.stack||S.message:S}function _(){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 d.enable(d.load()),d}o.exports=u},{ms:45}],20:[function(i,o,a){(function(u,c){(function(){var f=i("readable-stream"),d=i("end-of-stream"),p=i("inherits"),h=i("stream-shift"),g=c.from&&c.from!==Uint8Array.from?c.from([0]):new c([0]),v=function(w,x){w._corked?w.once("uncork",x):x()},y=function(w,x){w._autoDestroy&&w.destroy(x)},A=function(w,x){return function(k){k?y(w,k.message==="premature close"?null:k):x&&!w._ended&&w.end()}},_=function(w,x){if(!w||w._writableState&&w._writableState.finished)return x();if(w._writableState)return w.end(x);w.end(),x()},S=function(){},b=function(w){return new f.Readable({objectMode:!0,highWaterMark:16}).wrap(w)},T=function(w,x,k){if(!(this instanceof T))return new T(w,x,k);f.Duplex.call(this,k),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!k||k.autoDestroy!==!1,this._forwardDestroy=!k||k.destroy!==!1,this._forwardEnd=!k||k.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,w&&this.setWritable(w),x&&this.setReadable(x)};p(T,f.Duplex),T.obj=function(w,x,k){return k||(k={}),k.objectMode=!0,k.highWaterMark=16,new T(w,x,k)},T.prototype.cork=function(){++this._corked===1&&this.emit("cork")},T.prototype.uncork=function(){this._corked&&--this._corked===0&&this.emit("uncork")},T.prototype.setWritable=function(w){if(this._unwrite&&this._unwrite(),this.destroyed){w&&w.destroy&&w.destroy();return}if(w===null||w===!1){this.end();return}var x=this,k=d(w,{writable:!0,readable:!1},A(this,this._forwardEnd)),M=function(){var z=x._ondrain;x._ondrain=null,z&&z()},D=function(){x._writable.removeListener("drain",M),k()};this._unwrite&&u.nextTick(M),this._writable=w,this._writable.on("drain",M),this._unwrite=D,this.uncork()},T.prototype.setReadable=function(w){if(this._unread&&this._unread(),this.destroyed){w&&w.destroy&&w.destroy();return}if(w===null||w===!1){this.push(null),this.resume();return}var x=this,k=d(w,{writable:!1,readable:!0},A(this)),M=function(){x._forward()},D=function(){x.push(null)},z=function(){x._readable2.removeListener("readable",M),x._readable2.removeListener("end",D),k()};this._drained=!0,this._readable=w,this._readable2=w._readableState?w:b(w),this._readable2.on("readable",M),this._readable2.on("end",D),this._unread=z,this._forward()},T.prototype._read=function(){this._drained=!0,this._forward()},T.prototype._forward=function(){if(!(this._forwarding||!this._readable2||!this._drained)){this._forwarding=!0;for(var w;this._drained&&(w=h(this._readable2))!==null;)this.destroyed||(this._drained=this.push(w));this._forwarding=!1}},T.prototype.destroy=function(w,x){if(x||(x=S),this.destroyed)return x(null);this.destroyed=!0;var k=this;u.nextTick(function(){k._destroy(w),x(null)})},T.prototype._destroy=function(w){if(w){var x=this._ondrain;this._ondrain=null,x?x(w):this.emit("error",w)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},T.prototype._write=function(w,x,k){if(!this.destroyed){if(this._corked)return v(this,this._write.bind(this,w,x,k));if(w===g)return this._finish(k);if(!this._writable)return k();this._writable.write(w)===!1?this._ondrain=k:this.destroyed||k()}},T.prototype._finish=function(w){var x=this;this.emit("preend"),v(this,function(){_(x._forwardEnd&&x._writable,function(){x._writableState.prefinished===!1&&(x._writableState.prefinished=!0),x.emit("prefinish"),v(x,w)})})},T.prototype.end=function(w,x,k){return typeof w=="function"?this.end(null,null,w):typeof x=="function"?this.end(w,null,x):(this._ended=!0,w&&this.write(w),!this._writableState.ending&&!this._writableState.destroyed&&this.write(g),f.Writable.prototype.end.call(this,k))},o.exports=T}).call(this)}).call(this,i("_process"),i("buffer").Buffer)},{_process:50,buffer:17,"end-of-stream":21,inherits:24,"readable-stream":69,"stream-shift":74}],21:[function(i,o,a){(function(u){(function(){var c=i("once"),f=function(){},d=function(g){return g.setHeader&&typeof g.abort=="function"},p=function(g){return g.stdio&&Array.isArray(g.stdio)&&g.stdio.length===3},h=function(g,v,y){if(typeof v=="function")return h(g,null,v);v||(v={}),y=c(y||f);var A=g._writableState,_=g._readableState,S=v.readable||v.readable!==!1&&g.readable,b=v.writable||v.writable!==!1&&g.writable,T=!1,w=function(){g.writable||x()},x=function(){b=!1,S||y.call(g)},k=function(){S=!1,b||y.call(g)},M=function(L){y.call(g,L?new Error("exited with error code: "+L):null)},D=function(L){y.call(g,L)},z=function(){u.nextTick(j)},j=function(){if(!T){if(S&&!(_&&_.ended&&!_.destroyed))return y.call(g,new Error("premature close"));if(b&&!(A&&A.ended&&!A.destroyed))return y.call(g,new Error("premature close"))}},oe=function(){g.req.on("finish",x)};return d(g)?(g.on("complete",x),g.on("abort",z),g.req?oe():g.on("request",oe)):b&&!A&&(g.on("end",w),g.on("close",w)),p(g)&&g.on("exit",M),g.on("end",k),g.on("finish",x),v.error!==!1&&g.on("error",D),g.on("close",z),function(){T=!0,g.removeListener("complete",x),g.removeListener("abort",z),g.removeListener("request",oe),g.req&&g.req.removeListener("finish",x),g.removeListener("end",w),g.removeListener("close",w),g.removeListener("finish",x),g.removeListener("exit",M),g.removeListener("end",k),g.removeListener("error",D),g.removeListener("close",z)}};o.exports=h}).call(this)}).call(this,i("_process"))},{_process:50,once:48}],22:[function(i,o,a){var u=Object.create||oe,c=Object.keys||L,f=Function.prototype.bind||F;function d(){(!this._events||!Object.prototype.hasOwnProperty.call(this,"_events"))&&(this._events=u(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}o.exports=d,d.EventEmitter=d,d.prototype._events=void 0,d.prototype._maxListeners=void 0;var p=10,h;try{var g={};Object.defineProperty&&Object.defineProperty(g,"x",{value:0}),h=g.x===0}catch{h=!1}h?Object.defineProperty(d,"defaultMaxListeners",{enumerable:!0,get:function(){return p},set:function(O){if(typeof O!="number"||O<0||O!==O)throw new TypeError('"defaultMaxListeners" must be a positive number');p=O}}):d.defaultMaxListeners=p,d.prototype.setMaxListeners=function(ue){if(typeof ue!="number"||ue<0||isNaN(ue))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=ue,this};function v(O){return O._maxListeners===void 0?d.defaultMaxListeners:O._maxListeners}d.prototype.getMaxListeners=function(){return v(this)};function y(O,ue,_e){if(ue)O.call(_e);else for(var Ce=O.length,de=z(O,Ce),ie=0;ie<Ce;++ie)de[ie].call(_e)}function A(O,ue,_e,Ce){if(ue)O.call(_e,Ce);else for(var de=O.length,ie=z(O,de),Y=0;Y<de;++Y)ie[Y].call(_e,Ce)}function _(O,ue,_e,Ce,de){if(ue)O.call(_e,Ce,de);else for(var ie=O.length,Y=z(O,ie),Ie=0;Ie<ie;++Ie)Y[Ie].call(_e,Ce,de)}function S(O,ue,_e,Ce,de,ie){if(ue)O.call(_e,Ce,de,ie);else for(var Y=O.length,Ie=z(O,Y),Oe=0;Oe<Y;++Oe)Ie[Oe].call(_e,Ce,de,ie)}function b(O,ue,_e,Ce){if(ue)O.apply(_e,Ce);else for(var de=O.length,ie=z(O,de),Y=0;Y<de;++Y)ie[Y].apply(_e,Ce)}d.prototype.emit=function(ue){var _e,Ce,de,ie,Y,Ie,Oe=ue==="error";if(Ie=this._events,Ie)Oe=Oe&&Ie.error==null;else if(!Oe)return!1;if(Oe){if(arguments.length>1&&(_e=arguments[1]),_e instanceof Error)throw _e;var kt=new Error('Unhandled "error" event. ('+_e+")");throw kt.context=_e,kt}if(Ce=Ie[ue],!Ce)return!1;var Dt=typeof Ce=="function";switch(de=arguments.length,de){case 1:y(Ce,Dt,this);break;case 2:A(Ce,Dt,this,arguments[1]);break;case 3:_(Ce,Dt,this,arguments[1],arguments[2]);break;case 4:S(Ce,Dt,this,arguments[1],arguments[2],arguments[3]);break;default:for(ie=new Array(de-1),Y=1;Y<de;Y++)ie[Y-1]=arguments[Y];b(Ce,Dt,this,ie)}return!0};function T(O,ue,_e,Ce){var de,ie,Y;if(typeof _e!="function")throw new TypeError('"listener" argument must be a function');if(ie=O._events,ie?(ie.newListener&&(O.emit("newListener",ue,_e.listener?_e.listener:_e),ie=O._events),Y=ie[ue]):(ie=O._events=u(null),O._eventsCount=0),!Y)Y=ie[ue]=_e,++O._eventsCount;else if(typeof Y=="function"?Y=ie[ue]=Ce?[_e,Y]:[Y,_e]:Ce?Y.unshift(_e):Y.push(_e),!Y.warned&&(de=v(O),de&&de>0&&Y.length>de)){Y.warned=!0;var Ie=new Error("Possible EventEmitter memory leak detected. "+Y.length+' "'+String(ue)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');Ie.name="MaxListenersExceededWarning",Ie.emitter=O,Ie.type=ue,Ie.count=Y.length,typeof console=="object"&&console.warn&&console.warn("%s: %s",Ie.name,Ie.message)}return O}d.prototype.addListener=function(ue,_e){return T(this,ue,_e,!1)},d.prototype.on=d.prototype.addListener,d.prototype.prependListener=function(ue,_e){return T(this,ue,_e,!0)};function w(){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 O=new Array(arguments.length),ue=0;ue<O.length;++ue)O[ue]=arguments[ue];this.listener.apply(this.target,O)}}function x(O,ue,_e){var Ce={fired:!1,wrapFn:void 0,target:O,type:ue,listener:_e},de=f.call(w,Ce);return de.listener=_e,Ce.wrapFn=de,de}d.prototype.once=function(ue,_e){if(typeof _e!="function")throw new TypeError('"listener" argument must be a function');return this.on(ue,x(this,ue,_e)),this},d.prototype.prependOnceListener=function(ue,_e){if(typeof _e!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(ue,x(this,ue,_e)),this},d.prototype.removeListener=function(ue,_e){var Ce,de,ie,Y,Ie;if(typeof _e!="function")throw new TypeError('"listener" argument must be a function');if(de=this._events,!de)return this;if(Ce=de[ue],!Ce)return this;if(Ce===_e||Ce.listener===_e)--this._eventsCount===0?this._events=u(null):(delete de[ue],de.removeListener&&this.emit("removeListener",ue,Ce.listener||_e));else if(typeof Ce!="function"){for(ie=-1,Y=Ce.length-1;Y>=0;Y--)if(Ce[Y]===_e||Ce[Y].listener===_e){Ie=Ce[Y].listener,ie=Y;break}if(ie<0)return this;ie===0?Ce.shift():D(Ce,ie),Ce.length===1&&(de[ue]=Ce[0]),de.removeListener&&this.emit("removeListener",ue,Ie||_e)}return this},d.prototype.removeAllListeners=function(ue){var _e,Ce,de;if(Ce=this._events,!Ce)return this;if(!Ce.removeListener)return arguments.length===0?(this._events=u(null),this._eventsCount=0):Ce[ue]&&(--this._eventsCount===0?this._events=u(null):delete Ce[ue]),this;if(arguments.length===0){var ie=c(Ce),Y;for(de=0;de<ie.length;++de)Y=ie[de],Y!=="removeListener"&&this.removeAllListeners(Y);return this.removeAllListeners("removeListener"),this._events=u(null),this._eventsCount=0,this}if(_e=Ce[ue],typeof _e=="function")this.removeListener(ue,_e);else if(_e)for(de=_e.length-1;de>=0;de--)this.removeListener(ue,_e[de]);return this};function k(O,ue,_e){var Ce=O._events;if(!Ce)return[];var de=Ce[ue];return de?typeof de=="function"?_e?[de.listener||de]:[de]:_e?j(de):z(de,de.length):[]}d.prototype.listeners=function(ue){return k(this,ue,!0)},d.prototype.rawListeners=function(ue){return k(this,ue,!1)},d.listenerCount=function(O,ue){return typeof O.listenerCount=="function"?O.listenerCount(ue):M.call(O,ue)},d.prototype.listenerCount=M;function M(O){var ue=this._events;if(ue){var _e=ue[O];if(typeof _e=="function")return 1;if(_e)return _e.length}return 0}d.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function D(O,ue){for(var _e=ue,Ce=_e+1,de=O.length;Ce<de;_e+=1,Ce+=1)O[_e]=O[Ce];O.pop()}function z(O,ue){for(var _e=new Array(ue),Ce=0;Ce<ue;++Ce)_e[Ce]=O[Ce];return _e}function j(O){for(var ue=new Array(O.length),_e=0;_e<ue.length;++_e)ue[_e]=O[_e].listener||O[_e];return ue}function oe(O){var ue=function(){};return ue.prototype=O,new ue}function L(O){for(var ue in O)Object.prototype.hasOwnProperty.call(O,ue);return ue}function F(O){var ue=this;return function(){return ue.apply(O,arguments)}}},{}],23:[function(i,o,a){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */a.read=function(u,c,f,d,p){var h,g,v=p*8-d-1,y=(1<<v)-1,A=y>>1,_=-7,S=f?p-1:0,b=f?-1:1,T=u[c+S];for(S+=b,h=T&(1<<-_)-1,T>>=-_,_+=v;_>0;h=h*256+u[c+S],S+=b,_-=8);for(g=h&(1<<-_)-1,h>>=-_,_+=d;_>0;g=g*256+u[c+S],S+=b,_-=8);if(h===0)h=1-A;else{if(h===y)return g?NaN:(T?-1:1)*(1/0);g=g+Math.pow(2,d),h=h-A}return(T?-1:1)*g*Math.pow(2,h-d)},a.write=function(u,c,f,d,p,h){var g,v,y,A=h*8-p-1,_=(1<<A)-1,S=_>>1,b=p===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=d?0:h-1,w=d?1:-1,x=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(v=isNaN(c)?1:0,g=_):(g=Math.floor(Math.log(c)/Math.LN2),c*(y=Math.pow(2,-g))<1&&(g--,y*=2),g+S>=1?c+=b/y:c+=b*Math.pow(2,1-S),c*y>=2&&(g++,y/=2),g+S>=_?(v=0,g=_):g+S>=1?(v=(c*y-1)*Math.pow(2,p),g=g+S):(v=c*Math.pow(2,S-1)*Math.pow(2,p),g=0));p>=8;u[f+T]=v&255,T+=w,v/=256,p-=8);for(g=g<<p|v,A+=p;A>0;u[f+T]=g&255,T+=w,g/=256,A-=8);u[f+T-w]|=x*128}},{}],24:[function(i,o,a){typeof Object.create=="function"?o.exports=function(c,f){f&&(c.super_=f,c.prototype=Object.create(f.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}))}:o.exports=function(c,f){if(f){c.super_=f;var d=function(){};d.prototype=f.prototype,c.prototype=new d,c.prototype.constructor=c}}},{}],25:[function(i,o,a){Object.defineProperty(a,"__esModule",{value:!0});var u=function(){function c(f,d){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=f,this.value=d}return c.prototype.rotateLeft=function(){var f=this.parent,d=this.brother,p=this.leftChild,h=this.rightChild;if(!h)throw new Error("unknown error");var g=h.leftChild,v=h.rightChild;return f&&(f.leftChild===this?f.leftChild=h:f.rightChild===this&&(f.rightChild=h)),h.parent=f,h.brother=d,h.leftChild=this,h.rightChild=v,d&&(d.brother=h),this.parent=h,this.brother=v,this.leftChild=p,this.rightChild=g,v&&(v.parent=h,v.brother=this),p&&(p.parent=this,p.brother=g),g&&(g.parent=this,g.brother=p),h},c.prototype.rotateRight=function(){var f=this.parent,d=this.brother,p=this.leftChild;if(!p)throw new Error("unknown error");var h=this.rightChild,g=p.leftChild,v=p.rightChild;return f&&(f.leftChild===this?f.leftChild=p:f.rightChild===this&&(f.rightChild=p)),p.parent=f,p.brother=d,p.leftChild=g,p.rightChild=this,d&&(d.brother=p),g&&(g.parent=p,g.brother=this),this.parent=p,this.brother=g,this.leftChild=v,this.rightChild=h,v&&(v.parent=this,v.brother=h),h&&(h.parent=this,h.brother=v),p},c.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},c.TreeNodeColorType={red:!0,black:!1},c}();Object.freeze(u),a.default=u},{}],26:[function(i,o,a){var u=this&&this.__generator||function(f,d){var p={label:0,sent:function(){if(v[0]&1)throw v[1];return v[1]},trys:[],ops:[]},h,g,v,y;return y={next:A(0),throw:A(1),return:A(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function A(S){return function(b){return _([S,b])}}function _(S){if(h)throw new TypeError("Generator is already executing.");for(;p;)try{if(h=1,g&&(v=S[0]&2?g.return:S[0]?g.throw||((v=g.return)&&v.call(g),0):g.next)&&!(v=v.call(g,S[1])).done)return v;switch(g=0,v&&(S=[S[0]&2,v.value]),S[0]){case 0:case 1:v=S;break;case 4:return p.label++,{value:S[1],done:!1};case 5:p.label++,g=S[1],S=[0];continue;case 7:S=p.ops.pop(),p.trys.pop();continue;default:if(v=p.trys,!(v=v.length>0&&v[v.length-1])&&(S[0]===6||S[0]===2)){p=0;continue}if(S[0]===3&&(!v||S[1]>v[0]&&S[1]<v[3])){p.label=S[1];break}if(S[0]===6&&p.label<v[1]){p.label=v[1],v=S;break}if(v&&p.label<v[2]){p.label=v[2],p.ops.push(S);break}v[2]&&p.ops.pop(),p.trys.pop();continue}S=d.call(f,p)}catch(b){S=[6,b],g=0}finally{h=v=0}if(S[0]&5)throw S[1];return{value:S[0]?S[1]:void 0,done:!0}}};Object.defineProperty(a,"__esModule",{value:!0}),c.sigma=3,c.bucketSize=5e3;function c(f){var d=this;f===void 0&&(f=[]);var p=[],h=0,g=0,v=0,y=0,A=0,_=0;this.size=function(){return _},this.empty=function(){return _===0},this.clear=function(){h=v=g=y=A=_=0,b.call(this,c.bucketSize),_=0},this.front=function(){return p[h][g]},this.back=function(){return p[v][y]},this.forEach=function(T){if(!this.empty()){var w=0;if(h===v){for(var x=g;x<=y;++x)T(p[h][x],w++);return}for(var x=g;x<c.bucketSize;++x)T(p[h][x],w++);for(var x=h+1;x<v;++x)for(var k=0;k<c.bucketSize;++k)T(p[x][k],w++);for(var x=0;x<=y;++x)T(p[v][x],w++)}};var S=function(T){var w=h*c.bucketSize+g,x=w+T,k=v*c.bucketSize+y;if(x<w||x>k)throw new Error("pos should more than 0 and less than queue's size");var M=Math.floor(x/c.bucketSize),D=x%c.bucketSize;return{curNodeBucketIndex:M,curNodePointerIndex:D}};this.getElementByPos=function(T){var w=S(T),x=w.curNodeBucketIndex,k=w.curNodePointerIndex;return p[x][k]},this.eraseElementByPos=function(T){var w=this;if(T<0||T>_)throw new Error("pos should more than 0 and less than queue's size");if(T===0)this.popFront();else if(T===this.size())this.popBack();else{for(var x=[],k=T+1;k<_;++k)x.push(this.getElementByPos(k));this.cut(T),this.popBack(),x.forEach(function(M){return w.pushBack(M)})}},this.eraseElementByValue=function(T){if(!this.empty()){var w=[];this.forEach(function(M){M!==T&&w.push(M)});for(var x=w.length,k=0;k<x;++k)this.setElementByPos(k,w[k]);this.cut(x-1)}};var b=function(T){for(var w=[],x=T*c.sigma,k=Math.max(Math.ceil(x/c.bucketSize),2),M=0;M<k;++M)w.push(new Array(c.bucketSize));var D=Math.ceil(T/c.bucketSize),z=Math.floor(k/2)-Math.floor(D/2),j=z,oe=0;if(this.size())for(var M=0;M<D;++M){for(var L=0;L<c.bucketSize;++L)if(w[z+M][L]=this.front(),this.popFront(),this.empty()){j=z+M,oe=L;break}if(this.empty())break}p=w,h=z,g=0,v=j,y=oe,A=k,_=T};this.pushBack=function(T){this.empty()||(v===A-1&&y===c.bucketSize-1&&b.call(this,this.size()),y<c.bucketSize-1?++y:v<A-1&&(++v,y=0)),++_,p[v][y]=T},this.popBack=function(){this.empty()||(this.size()!==1&&(y>0?--y:h<v&&(--v,y=c.bucketSize-1)),_>0&&--_)},this.setElementByPos=function(T,w){var x=S(T),k=x.curNodeBucketIndex,M=x.curNodePointerIndex;p[k][M]=w},this.insert=function(T,w,x){var k=this;if(x===void 0&&(x=1),T===0)for(;x--;)this.pushFront(w);else if(T===this.size())for(;x--;)this.pushBack(w);else{for(var M=[],D=T;D<_;++D)M.push(this.getElementByPos(D));this.cut(T-1);for(var D=0;D<x;++D)this.pushBack(w);M.forEach(function(z){return k.pushBack(z)})}},this.find=function(T){if(h===v){for(var w=g;w<=y;++w)if(p[h][w]===T)return!0;return!1}for(var w=g;w<c.bucketSize;++w)if(p[h][w]===T)return!0;for(var w=h+1;w<v;++w)for(var x=0;x<c.bucketSize;++x)if(p[w][x]===T)return!0;for(var w=0;w<=y;++w)if(p[v][w]===T)return!0;return!1},this.reverse=function(){for(var T=0,w=_-1;T<w;){var x=this.getElementByPos(T);this.setElementByPos(T,this.getElementByPos(w)),this.setElementByPos(w,x),++T,--w}},this.unique=function(){if(!this.empty()){var T=[],w=this.front();this.forEach(function(k,M){(M===0||k!==w)&&(T.push(k),w=k)});for(var x=0;x<_;++x)this.setElementByPos(x,T[x]);this.cut(T.length-1)}},this.sort=function(T){var w=[];this.forEach(function(k){w.push(k)}),w.sort(T);for(var x=0;x<_;++x)this.setElementByPos(x,w[x])},this.pushFront=function(T){this.empty()||(h===0&&g===0&&b.call(this,this.size()),g>0?--g:h>0&&(--h,g=c.bucketSize-1)),++_,p[h][g]=T},this.popFront=function(){this.empty()||(this.size()!==1&&(g<c.bucketSize-1?++g:h<v&&(++h,g=0)),_>0&&--_)},this.shrinkToFit=function(){var T=this,w=[];this.forEach(function(D){w.push(D)});var x=w.length;p=[];for(var k=Math.ceil(x/c.bucketSize),M=0;M<k;++M)p.push(new Array(c.bucketSize));this.clear(),w.forEach(function(D){return T.pushBack(D)})},this.cut=function(T){if(T<0){this.clear();return}var w=S(T),x=w.curNodeBucketIndex,k=w.curNodePointerIndex;v=x,y=k,_=T+1},this[Symbol.iterator]=function(){return function(){var w,w,w,T,w;return u(this,function(x){switch(x.label){case 0:if(_===0)return[2];if(h!==v)return[3,5];w=g,x.label=1;case 1:return w<=y?[4,p[h][w]]:[3,4];case 2:x.sent(),x.label=3;case 3:return++w,[3,1];case 4:return[2];case 5:w=g,x.label=6;case 6:return w<c.bucketSize?[4,p[h][w]]:[3,9];case 7:x.sent(),x.label=8;case 8:return++w,[3,6];case 9:w=h+1,x.label=10;case 10:if(!(w<v))return[3,15];T=0,x.label=11;case 11:return T<c.bucketSize?[4,p[w][T]]:[3,14];case 12:x.sent(),x.label=13;case 13:return++T,[3,11];case 14:return++w,[3,10];case 15:w=0,x.label=16;case 16:return w<=y?[4,p[v][w]]:[3,19];case 17:x.sent(),x.label=18;case 18:return++w,[3,16];case 19:return[2]}})}()},function(){var T=c.bucketSize;f.size?T=f.size():f.length&&(T=f.length);var w=T*c.sigma;A=Math.ceil(w/c.bucketSize),A=Math.max(A,3);for(var x=0;x<A;++x)p.push(new Array(c.bucketSize));var k=Math.ceil(T/c.bucketSize);h=Math.floor(A/2)-Math.floor(k/2),v=h,f.forEach(function(M){return d.pushBack(M)})}(),Object.freeze(this)}Object.freeze(c),a.default=c},{}],27:[function(i,o,a){var u=this&&this.__generator||function(h,g){var v={label:0,sent:function(){if(_[0]&1)throw _[1];return _[1]},trys:[],ops:[]},y,A,_,S;return S={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function b(w){return function(x){return T([w,x])}}function T(w){if(y)throw new TypeError("Generator is already executing.");for(;v;)try{if(y=1,A&&(_=w[0]&2?A.return:w[0]?A.throw||((_=A.return)&&_.call(A),0):A.next)&&!(_=_.call(A,w[1])).done)return _;switch(A=0,_&&(w=[w[0]&2,_.value]),w[0]){case 0:case 1:_=w;break;case 4:return v.label++,{value:w[1],done:!1};case 5:v.label++,A=w[1],w=[0];continue;case 7:w=v.ops.pop(),v.trys.pop();continue;default:if(_=v.trys,!(_=_.length>0&&_[_.length-1])&&(w[0]===6||w[0]===2)){v=0;continue}if(w[0]===3&&(!_||w[1]>_[0]&&w[1]<_[3])){v.label=w[1];break}if(w[0]===6&&v.label<_[1]){v.label=_[1],_=w;break}if(_&&v.label<_[2]){v.label=_[2],v.ops.push(w);break}_[2]&&v.ops.pop(),v.trys.pop();continue}w=g.call(h,v)}catch(x){w=[6,x],A=0}finally{y=_=0}if(w[0]&5)throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}},c=this&&this.__values||function(h){var g=typeof Symbol=="function"&&Symbol.iterator,v=g&&h[g],y=0;if(v)return v.call(h);if(h&&typeof h.length=="number")return{next:function(){return h&&y>=h.length&&(h=void 0),{value:h&&h[y++],done:!h}}};throw new TypeError(g?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(a,"__esModule",{value:!0});var f=i("../LinkList/LinkList"),d=i("../Map/Map");p.initSize=16,p.maxSize=1<<30,p.sigma=.75,p.treeifyThreshold=8,p.untreeifyThreshold=6,p.minTreeifySize=64;function p(h,g,v){var y=this;if(h===void 0&&(h=[]),g===void 0&&(g=p.initSize),v=v||function(T){var w,x,k=0,M="";if(typeof T=="number")k=Math.floor(T),k=(k<<5)-k,k=k&k;else{typeof T!="string"?M=JSON.stringify(T):M=T;try{for(var D=c(M),z=D.next();!z.done;z=D.next()){var j=z.value,oe=j.charCodeAt(0);k=(k<<5)-k+oe,k=k&k}}catch(L){w={error:L}}finally{try{z&&!z.done&&(x=D.return)&&x.call(D)}finally{if(w)throw w.error}}}return k^=k>>>16,k},g&g-1)throw new Error("initBucketNum must be 2 to the power of n");var A=0,_=[],S=Math.max(p.initSize,Math.min(p.maxSize,g));this.size=function(){return A},this.empty=function(){return A===0},this.clear=function(){A=0,S=g,_=[]},this.forEach=function(T){var w=0;_.forEach(function(x){x.forEach(function(k){T(k,w++)})})};var b=function(T){if(!(T>=p.maxSize)){S=T*2;var w=[];_.forEach(function(x,k){if(!x.empty()){if(x instanceof f.default&&x.size()===1){var M=x.front(),D=M.key,z=M.value;w[v(D)&S-1]=new f.default([{key:D,value:z}])}else if(x instanceof d.default){var j=new f.default,oe=new f.default;x.forEach(function(O){var ue=v(O.key);ue&T?oe.pushBack(O):j.pushBack(O)}),j.size()>p.untreeifyThreshold?w[k]=new d.default(j):j.size()&&(w[k]=j),oe.size()>p.untreeifyThreshold?w[k+T]=new d.default(oe):oe.size()&&(w[k+T]=oe)}else{var L=new f.default,F=new f.default;x.forEach(function(O){var ue=v(O.key);ue&T?F.pushBack(O):L.pushBack(O)}),L.size()&&(w[k]=L),F.size()&&(w[k+T]=F)}_[k].clear()}}),_=w}};this.setElement=function(T,w){var x,k;if(T==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(w==null){this.eraseElementByKey(T);return}var M=v(T)&S-1;if(!_[M])++A,_[M]=new f.default([{key:T,value:w}]);else{var D=_[M].size();if(_[M]instanceof f.default){try{for(var z=c(_[M]),j=z.next();!j.done;j=z.next()){var oe=j.value;if(oe.key===T){oe.value=w;return}}}catch(F){x={error:F}}finally{try{j&&!j.done&&(k=z.return)&&k.call(z)}finally{if(x)throw x.error}}_[M].pushBack({key:T,value:w}),_[M].size()>=p.treeifyThreshold&&(_[M]=new d.default(_[M]))}else _[M].setElement(T,w);var L=_[M].size();A+=L-D}A>S*p.sigma&&b.call(this,S)},this.getElementByKey=function(T){var w,x,k=v(T)&S-1;if(_[k]){if(_[k]instanceof d.default)return _[k].getElementByKey(T);try{for(var M=c(_[k]),D=M.next();!D.done;D=M.next()){var z=D.value;if(z.key===T)return z.value}}catch(j){w={error:j}}finally{try{D&&!D.done&&(x=M.return)&&x.call(M)}finally{if(w)throw w.error}}}},this.eraseElementByKey=function(T){var w,x,k=v(T)&S-1;if(_[k]){var M=_[k].size();if(_[k]instanceof d.default)_[k].eraseElementByKey(T),_[k].size()<=p.untreeifyThreshold&&(_[k]=new f.default(_[k]));else{var D=-1;try{for(var z=c(_[k]),j=z.next();!j.done;j=z.next()){var oe=j.value;if(++D,oe.key===T){_[k].eraseElementByPos(D);break}}}catch(F){w={error:F}}finally{try{j&&!j.done&&(x=z.return)&&x.call(z)}finally{if(w)throw w.error}}}var L=_[k].size();A+=L-M}},this.find=function(T){var w,x,k=v(T)&S-1;if(!_[k])return!1;if(_[k]instanceof d.default)return _[k].find(T);try{for(var M=c(_[k]),D=M.next();!D.done;D=M.next()){var z=D.value;if(z.key===T)return!0}}catch(j){w={error:j}}finally{try{D&&!D.done&&(x=M.return)&&x.call(M)}finally{if(w)throw w.error}}return!1},this[Symbol.iterator]=function(){return function(){var T,w,x,k,M,D,z;return u(this,function(j){switch(j.label){case 0:T=0,j.label=1;case 1:if(!(T<S))return[3,10];for(;T<S&&!_[T];)++T;if(T>=S)return[3,10];j.label=2;case 2:j.trys.push([2,7,8,9]),w=(D=void 0,c(_[T])),x=w.next(),j.label=3;case 3:return x.done?[3,6]:(k=x.value,[4,k]);case 4:j.sent(),j.label=5;case 5:return x=w.next(),[3,3];case 6:return[3,9];case 7:return M=j.sent(),D={error:M},[3,9];case 8:try{x&&!x.done&&(z=w.return)&&z.call(w)}finally{if(D)throw D.error}return[7];case 9:return++T,[3,1];case 10:return[2]}})}()},h.forEach(function(T){var w=T.key,x=T.value;return y.setElement(w,x)}),Object.freeze(this)}Object.freeze(p),a.default=p},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(i,o,a){var u=this&&this.__generator||function(h,g){var v={label:0,sent:function(){if(_[0]&1)throw _[1];return _[1]},trys:[],ops:[]},y,A,_,S;return S={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function b(w){return function(x){return T([w,x])}}function T(w){if(y)throw new TypeError("Generator is already executing.");for(;v;)try{if(y=1,A&&(_=w[0]&2?A.return:w[0]?A.throw||((_=A.return)&&_.call(A),0):A.next)&&!(_=_.call(A,w[1])).done)return _;switch(A=0,_&&(w=[w[0]&2,_.value]),w[0]){case 0:case 1:_=w;break;case 4:return v.label++,{value:w[1],done:!1};case 5:v.label++,A=w[1],w=[0];continue;case 7:w=v.ops.pop(),v.trys.pop();continue;default:if(_=v.trys,!(_=_.length>0&&_[_.length-1])&&(w[0]===6||w[0]===2)){v=0;continue}if(w[0]===3&&(!_||w[1]>_[0]&&w[1]<_[3])){v.label=w[1];break}if(w[0]===6&&v.label<_[1]){v.label=_[1],_=w;break}if(_&&v.label<_[2]){v.label=_[2],v.ops.push(w);break}_[2]&&v.ops.pop(),v.trys.pop();continue}w=g.call(h,v)}catch(x){w=[6,x],A=0}finally{y=_=0}if(w[0]&5)throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}},c=this&&this.__values||function(h){var g=typeof Symbol=="function"&&Symbol.iterator,v=g&&h[g],y=0;if(v)return v.call(h);if(h&&typeof h.length=="number")return{next:function(){return h&&y>=h.length&&(h=void 0),{value:h&&h[y++],done:!h}}};throw new TypeError(g?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(a,"__esModule",{value:!0});var f=i("../Set/Set"),d=i("../LinkList/LinkList");p.initSize=16,p.maxSize=1<<30,p.sigma=.75,p.treeifyThreshold=8,p.untreeifyThreshold=6,p.minTreeifySize=64;function p(h,g,v){var y=this;if(h===void 0&&(h=[]),g===void 0&&(g=p.initSize),v=v||function(T){var w=0,x="";if(typeof T=="number")w=Math.floor(T),w=(w<<5)-w,w=w&w;else{typeof T!="string"?x=JSON.stringify(T):x=T;for(var k=0;k<x.length;k++){var M=x.charCodeAt(k);w=(w<<5)-w+M,w=w&w}}return w^=w>>>16,w},g&g-1)throw new Error("initBucketNum must be 2 to the power of n");var A=0,_=[],S=Math.max(p.initSize,Math.min(p.maxSize,g));this.size=function(){return A},this.empty=function(){return A===0},this.clear=function(){A=0,S=g,_=[]},this.forEach=function(T){var w=0;_.forEach(function(x){x.forEach(function(k){T(k,w++)})})};var b=function(T){if(!(T>=p.maxSize)){S=T*2;var w=[];_.forEach(function(x,k){if(!x.empty()){if(x instanceof d.default&&x.size()===1){var M=x.front();if(M===void 0)throw new Error("unknown error");w[v(M)&S-1]=new d.default([M])}else if(x instanceof f.default){var D=new d.default,z=new d.default;x.forEach(function(L){var F=v(L);F&T?z.pushBack(L):D.pushBack(L)}),D.size()>p.untreeifyThreshold?w[k]=new f.default(D):D.size()&&(w[k]=D),z.size()>p.untreeifyThreshold?w[k+T]=new f.default(z):z.size()&&(w[k+T]=z)}else{var j=new d.default,oe=new d.default;x.forEach(function(L){var F=v(L);F&T?oe.pushBack(L):j.pushBack(L)}),j.size()&&(w[k]=j),oe.size()&&(w[k+T]=oe)}_[k].clear()}}),_=w}};this.insert=function(T){if(T==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var w=v(T)&S-1;if(!_[w])_[w]=new d.default([T]),++A;else{var x=_[w].size();if(_[w]instanceof d.default){if(_[w].find(T))return;_[w].pushBack(T),_[w].size()>=p.treeifyThreshold&&(_[w]=new f.default(_[w]))}else _[w].insert(T);var k=_[w].size();A+=k-x}A>S*p.sigma&&b.call(this,S)},this.eraseElementByValue=function(T){var w=v(T)&S-1;if(_[w]){var x=_[w].size();_[w].eraseElementByValue(T),_[w]instanceof f.default&&_[w].size()<=p.untreeifyThreshold&&(_[w]=new d.default(_[w]));var k=_[w].size();A+=k-x}},this.find=function(T){var w=v(T)&S-1;return _[w]?_[w].find(T):!1},this[Symbol.iterator]=function(){return function(){var T,w,x,k,M,D,z;return u(this,function(j){switch(j.label){case 0:T=0,j.label=1;case 1:if(!(T<S))return[3,10];for(;T<S&&!_[T];)++T;if(T>=S)return[3,10];j.label=2;case 2:j.trys.push([2,7,8,9]),w=(D=void 0,c(_[T])),x=w.next(),j.label=3;case 3:return x.done?[3,6]:(k=x.value,[4,k]);case 4:j.sent(),j.label=5;case 5:return x=w.next(),[3,3];case 6:return[3,9];case 7:return M=j.sent(),D={error:M},[3,9];case 8:try{x&&!x.done&&(z=w.return)&&z.call(w)}finally{if(D)throw D.error}return[7];case 9:return++T,[3,1];case 10:return[2]}})}()},h.forEach(function(T){return y.insert(T)}),Object.freeze(this)}Object.freeze(p),a.default=p},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(i,o,a){var u=this&&this.__generator||function(d,p){var h={label:0,sent:function(){if(y[0]&1)throw y[1];return y[1]},trys:[],ops:[]},g,v,y,A;return A={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function _(b){return function(T){return S([b,T])}}function S(b){if(g)throw new TypeError("Generator is already executing.");for(;h;)try{if(g=1,v&&(y=b[0]&2?v.return:b[0]?v.throw||((y=v.return)&&y.call(v),0):v.next)&&!(y=y.call(v,b[1])).done)return y;switch(v=0,y&&(b=[b[0]&2,y.value]),b[0]){case 0:case 1:y=b;break;case 4:return h.label++,{value:b[1],done:!1};case 5:h.label++,v=b[1],b=[0];continue;case 7:b=h.ops.pop(),h.trys.pop();continue;default:if(y=h.trys,!(y=y.length>0&&y[y.length-1])&&(b[0]===6||b[0]===2)){h=0;continue}if(b[0]===3&&(!y||b[1]>y[0]&&b[1]<y[3])){h.label=b[1];break}if(b[0]===6&&h.label<y[1]){h.label=y[1],y=b;break}if(y&&h.label<y[2]){h.label=y[2],h.ops.push(b);break}y[2]&&h.ops.pop(),h.trys.pop();continue}b=p.call(d,h)}catch(T){b=[6,T],v=0}finally{g=y=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}};Object.defineProperty(a,"__esModule",{value:!0});var c=function(){function d(p){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=p}return d}();function f(d){var p=this;d===void 0&&(d=[]);var h=0,g=void 0,v=void 0;this.size=function(){return h},this.empty=function(){return h===0},this.clear=function(){g=v=void 0,h=0},this.front=function(){return g==null?void 0:g.value},this.back=function(){return v==null?void 0:v.value},this.forEach=function(y){for(var A=g,_=0;A;){if(A.value===void 0)throw new Error("unknown error");y(A.value,_++),A=A.next}},this.getElementByPos=function(y){if(y<0||y>=h)throw new Error("pos must more then 0 and less then the list length");for(var A=g;y--&&A;)A=A.next;if(!A||A.value===void 0)throw new Error("unknown error");return A.value},this.eraseElementByPos=function(y){if(y<0||y>=h)throw new Error("erase pos must more then 0 and less then the list length");if(y===0)this.popFront();else if(y===h-1)this.popBack();else{for(var A=g;y--;){if(!(A!=null&&A.next))throw new Error("unknown error");A=A.next}if(!A||!A.pre||!A.next)throw new Error("unknown error");var _=A.pre,S=A.next;S.pre=_,_.next=S,h>0&&--h}},this.eraseElementByValue=function(y){for(;g&&g.value===y;)this.popFront();for(;v&&v.value===y;)this.popBack();if(g)for(var A=g;A;){if(A.value===y){var _=A.pre,S=A.next;S&&(S.pre=_),_&&(_.next=S),h>0&&--h}A=A.next}},this.pushBack=function(y){if(y==null)throw new Error("you can't push null or undefined here");++h;var A=new c(y);v?(v.next=A,A.pre=v,v=A):g=v=A},this.popBack=function(){v&&(h>0&&--h,v&&(g===v?g=v=void 0:(v=v.pre,v&&(v.next=void 0))))},this.setElementByPos=function(y,A){if(A==null)throw new Error("you can't set null or undefined here");if(y<0||y>=h)throw new Error("pos must more then 0 and less then the list length");for(var _=g;y--;){if(!_)throw new Error("unknown error");_=_.next}_&&(_.value=A)},this.insert=function(y,A,_){if(_===void 0&&(_=1),A==null)throw new Error("you can't insert null or undefined here");if(y<0||y>h)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(_<0)throw new Error("insert size must more than 0");if(y===0)for(;_--;)this.pushFront(A);else if(y===h)for(;_--;)this.pushBack(A);else{for(var S=g,b=1;b<y;++b){if(!(S!=null&&S.next))throw new Error("unknown error");S=S==null?void 0:S.next}if(!S)throw new Error("unknown error");var T=S.next;for(h+=_;_--;)S.next=new c(A),S.next.pre=S,S=S.next;S.next=T,T&&(T.pre=S)}},this.find=function(y){for(var A=g;A;){if(A.value===y)return!0;A=A.next}return!1},this.reverse=function(){for(var y=g,A=v,_=0;y&&A&&_*2<h;){var S=y.value;y.value=A.value,A.value=S,y=y.next,A=A.pre,++_}},this.unique=function(){for(var y=g;y;){for(var A=y;A&&A.next&&A.value===A.next.value;)A=A.next,h>0&&--h;y.next=A.next,y.next&&(y.next.pre=y),y=y.next}},this.sort=function(y){var A=[];this.forEach(function(S){A.push(S)}),A.sort(y);var _=g;A.forEach(function(S){_&&(_.value=S,_=_.next)})},this.pushFront=function(y){if(y==null)throw new Error("you can't push null or undefined here");++h;var A=new c(y);g?(A.next=g,g.pre=A,g=A):g=v=A},this.popFront=function(){g&&(h>0&&--h,g&&(g===v?g=v=void 0:(g=g.next,g&&(g.pre=void 0))))},this.merge=function(y){var A=this,_=g;y.forEach(function(S){for(;_&&_.value!==void 0&&_.value<=S;)_=_.next;if(_===void 0)A.pushBack(S),_=v;else if(_===g)A.pushFront(S),_=g;else{++h;var b=_.pre;b&&(b.next=new c(S),b.next.pre=b,b.next.next=_,_&&(_.pre=b.next))}})},this[Symbol.iterator]=function(){return function(){var y;return u(this,function(A){switch(A.label){case 0:y=g,A.label=1;case 1:if(y===void 0)return[3,3];if(!y.value)throw new Error("unknown error");return[4,y.value];case 2:return A.sent(),y=y.next,[3,1];case 3:return[2]}})}()},d.forEach(function(y){return p.pushBack(y)}),Object.freeze(this)}Object.freeze(f),a.default=f},{}],30:[function(i,o,a){var u=this&&this.__generator||function(p,h){var g={label:0,sent:function(){if(A[0]&1)throw A[1];return A[1]},trys:[],ops:[]},v,y,A,_;return _={next:S(0),throw:S(1),return:S(2)},typeof Symbol=="function"&&(_[Symbol.iterator]=function(){return this}),_;function S(T){return function(w){return b([T,w])}}function b(T){if(v)throw new TypeError("Generator is already executing.");for(;g;)try{if(v=1,y&&(A=T[0]&2?y.return:T[0]?y.throw||((A=y.return)&&A.call(y),0):y.next)&&!(A=A.call(y,T[1])).done)return A;switch(y=0,A&&(T=[T[0]&2,A.value]),T[0]){case 0:case 1:A=T;break;case 4:return g.label++,{value:T[1],done:!1};case 5:g.label++,y=T[1],T=[0];continue;case 7:T=g.ops.pop(),g.trys.pop();continue;default:if(A=g.trys,!(A=A.length>0&&A[A.length-1])&&(T[0]===6||T[0]===2)){g=0;continue}if(T[0]===3&&(!A||T[1]>A[0]&&T[1]<A[3])){g.label=T[1];break}if(T[0]===6&&g.label<A[1]){g.label=A[1],A=T;break}if(A&&g.label<A[2]){g.label=A[2],g.ops.push(T);break}A[2]&&g.ops.pop(),g.trys.pop();continue}T=h.call(p,g)}catch(w){T=[6,w],y=0}finally{v=A=0}if(T[0]&5)throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}},c=this&&this.__values||function(p){var h=typeof Symbol=="function"&&Symbol.iterator,g=h&&p[h],v=0;if(g)return g.call(p);if(p&&typeof p.length=="number")return{next:function(){return p&&v>=p.length&&(p=void 0),{value:p&&p[v++],done:!p}}};throw new TypeError(h?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(a,"__esModule",{value:!0});var f=i("../Base/TreeNode");function d(p,h){var g=this;p===void 0&&(p=[]),h=h||function(L,F){return L<F?-1:L>F?1:0};var v=0,y=new f.default;y.color=f.default.TreeNodeColorType.black,this.size=function(){return v},this.empty=function(){return v===0},this.clear=function(){v=0,y.key=y.value=void 0,y.leftChild=y.rightChild=y.brother=void 0};var A=function(L){if(!L||L.key===void 0)throw new Error("unknown error");return L.leftChild?A(L.leftChild):L},_=function(L){if(!L||L.key===void 0)throw new Error("unknown error");return L.rightChild?_(L.rightChild):L};this.front=function(){if(!this.empty()){var L=A(y);if(L.key===void 0||L.value===void 0)throw new Error("unknown error");return{key:L.key,value:L.value}}},this.back=function(){if(!this.empty()){var L=_(y);if(L.key===void 0||L.value===void 0)throw new Error("unknown error");return{key:L.key,value:L.value}}},this.forEach=function(L){var F,O,ue=0;try{for(var _e=c(this),Ce=_e.next();!Ce.done;Ce=_e.next()){var de=Ce.value;L(de,ue++)}}catch(ie){F={error:ie}}finally{try{Ce&&!Ce.done&&(O=_e.return)&&O.call(_e)}finally{if(F)throw F.error}}},this.getElementByPos=function(L){var F,O;if(L<0||L>=this.size())throw new Error("pos must more than 0 and less than set's size");var ue=0;try{for(var _e=c(this),Ce=_e.next();!Ce.done;Ce=_e.next()){var de=Ce.value;if(ue===L)return de;++ue}}catch(ie){F={error:ie}}finally{try{Ce&&!Ce.done&&(O=_e.return)&&O.call(_e)}finally{if(F)throw F.error}}throw new Error("unknown Error")};var S=function(L,F){if(!(!L||L.key===void 0||L.value===void 0)){var O=h(L.key,F);return O===0?{key:L.key,value:L.value}:O<0?S(L.rightChild,F):S(L.leftChild,F)||{key:L.key,value:L.value}}};this.lowerBound=function(L){return S(y,L)};var b=function(L,F){if(!(!L||L.key===void 0||L.value===void 0)){var O=h(L.key,F);return O<=0?b(L.rightChild,F):b(L.leftChild,F)||{key:L.key,value:L.value}}};this.upperBound=function(L){return b(y,L)};var T=function(L,F){if(!(!L||L.key===void 0||L.value===void 0)){var O=h(L.key,F);return O===0?{key:L.key,value:L.value}:O>0?T(L.leftChild,F):T(L.rightChild,F)||{key:L.key,value:L.value}}};this.reverseLowerBound=function(L){return T(y,L)};var w=function(L,F){if(!(!L||L.key===void 0||L.value===void 0)){var O=h(L.key,F);return O>=0?w(L.leftChild,F):w(L.rightChild,F)||{key:L.key,value:L.value}}};this.reverseUpperBound=function(L){return w(y,L)};var x=function(L){var F=L.parent;if(!F){if(L===y)return;throw new Error("unknown error")}if(L.color===f.default.TreeNodeColorType.red){L.color=f.default.TreeNodeColorType.black;return}var O=L.brother;if(!O)throw new Error("unknown error");if(L===F.leftChild){if(O.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.black,F.color=f.default.TreeNodeColorType.red;var ue=F.rotateLeft();y===F&&(y=ue),x(L)}else if(O.color===f.default.TreeNodeColorType.black)if(O.rightChild&&O.rightChild.color===f.default.TreeNodeColorType.red){O.color=F.color,F.color=f.default.TreeNodeColorType.black,O.rightChild&&(O.rightChild.color=f.default.TreeNodeColorType.black);var ue=F.rotateLeft();y===F&&(y=ue),L.color=f.default.TreeNodeColorType.black}else if((!O.rightChild||O.rightChild.color===f.default.TreeNodeColorType.black)&&O.leftChild&&O.leftChild.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.red,O.leftChild&&(O.leftChild.color=f.default.TreeNodeColorType.black);var ue=O.rotateRight();y===O&&(y=ue),x(L)}else(!O.leftChild||O.leftChild.color===f.default.TreeNodeColorType.black)&&(!O.rightChild||O.rightChild.color===f.default.TreeNodeColorType.black)&&(O.color=f.default.TreeNodeColorType.red,x(F))}else if(L===F.rightChild){if(O.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.black,F.color=f.default.TreeNodeColorType.red;var ue=F.rotateRight();y===F&&(y=ue),x(L)}else if(O.color===f.default.TreeNodeColorType.black)if(O.leftChild&&O.leftChild.color===f.default.TreeNodeColorType.red){O.color=F.color,F.color=f.default.TreeNodeColorType.black,O.leftChild&&(O.leftChild.color=f.default.TreeNodeColorType.black);var ue=F.rotateRight();y===F&&(y=ue),L.color=f.default.TreeNodeColorType.black}else if((!O.leftChild||O.leftChild.color===f.default.TreeNodeColorType.black)&&O.rightChild&&O.rightChild.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.red,O.rightChild&&(O.rightChild.color=f.default.TreeNodeColorType.black);var ue=O.rotateLeft();y===O&&(y=ue),x(L)}else(!O.leftChild||O.leftChild.color===f.default.TreeNodeColorType.black)&&(!O.rightChild||O.rightChild.color===f.default.TreeNodeColorType.black)&&(O.color=f.default.TreeNodeColorType.red,x(F))}},k=function(L){for(var F=L;F.leftChild||F.rightChild;){if(F.rightChild){F=A(F.rightChild);var O=L.key;L.key=F.key,F.key=O;var ue=L.value;L.value=F.value,F.value=ue,L=F}if(F.leftChild){F=_(F.leftChild);var O=L.key;L.key=F.key,F.key=O;var ue=L.value;L.value=F.value,F.value=ue,L=F}}x(F),F&&F.remove(),--v,y.color=f.default.TreeNodeColorType.black},M=function(L,F){if(!L||L.key===void 0)return!1;var O=M(L.leftChild,F);return O||F(L)?!0:M(L.rightChild,F)};this.eraseElementByPos=function(L){if(L<0||L>=v)throw new Error("pos must more than 0 and less than set's size");var F=0;M(y,function(O){return L===F?(k(O),!0):(++F,!1)})},this.eraseElementByKey=function(L){if(!this.empty()){var F=j(y,L);F===void 0||F.key===void 0||h(F.key,L)!==0||k(F)}};var D=function(L,F){if(!L||L.key===void 0)throw new Error("unknown error");var O=h(F,L.key);return O<0?L.leftChild?D(L.leftChild,F):(L.leftChild=new f.default,L.leftChild.parent=L,L.leftChild.brother=L.rightChild,L.rightChild&&(L.rightChild.brother=L.leftChild),L.leftChild):O>0?L.rightChild?D(L.rightChild,F):(L.rightChild=new f.default,L.rightChild.parent=L,L.rightChild.brother=L.leftChild,L.leftChild&&(L.leftChild.brother=L.rightChild),L.rightChild):L},z=function(L){var F=L.parent;if(!F){if(L===y)return;throw new Error("unknown error")}if(F.color!==f.default.TreeNodeColorType.black&&F.color===f.default.TreeNodeColorType.red){var O=F.brother,ue=F.parent;if(!ue)throw new Error("unknown error");if(O&&O.color===f.default.TreeNodeColorType.red)O.color=F.color=f.default.TreeNodeColorType.black,ue.color=f.default.TreeNodeColorType.red,z(ue);else if(!O||O.color===f.default.TreeNodeColorType.black){if(F===ue.leftChild){if(L===F.leftChild){F.color=f.default.TreeNodeColorType.black,ue.color=f.default.TreeNodeColorType.red;var _e=ue.rotateRight();ue===y&&(y=_e)}else if(L===F.rightChild){var _e=F.rotateLeft();ue===y&&(y=_e),z(F)}}else if(F===ue.rightChild){if(L===F.leftChild){var _e=F.rotateRight();ue===y&&(y=_e),z(F)}else if(L===F.rightChild){F.color=f.default.TreeNodeColorType.black,ue.color=f.default.TreeNodeColorType.red;var _e=ue.rotateLeft();ue===y&&(y=_e)}}}}};this.setElement=function(L,F){if(L==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(F==null){this.eraseElementByKey(L);return}if(this.empty()){++v,y.key=L,y.value=F,y.color=f.default.TreeNodeColorType.black;return}var O=D(y,L);if(O.key!==void 0&&h(O.key,L)===0){O.value=F;return}++v,O.key=L,O.value=F,z(O),y.color=f.default.TreeNodeColorType.black};var j=function(L,F){if(!(!L||L.key===void 0)){var O=h(F,L.key);return O<0?j(L.leftChild,F):O>0?j(L.rightChild,F):L}};this.find=function(L){return!!j(y,L)},this.getElementByKey=function(L){var F=j(y,L);if((F==null?void 0:F.key)===void 0||(F==null?void 0:F.value)===void 0)throw new Error("unknown error");return F.value},this.union=function(L){var F=this;L.forEach(function(O){var ue=O.key,_e=O.value;return F.setElement(ue,_e)})},this.getHeight=function(){if(this.empty())return 0;var L=function(F){return F?Math.max(L(F.leftChild),L(F.rightChild))+1:1};return L(y)};var oe=function(L){return u(this,function(F){switch(F.label){case 0:return!L||L.key===void 0||L.value===void 0?[2]:[5,c(oe(L.leftChild))];case 1:return F.sent(),[4,{key:L.key,value:L.value}];case 2:return F.sent(),[5,c(oe(L.rightChild))];case 3:return F.sent(),[2]}})};this[Symbol.iterator]=function(){return oe(y)},p.forEach(function(L){var F=L.key,O=L.value;return g.setElement(F,O)}),Object.freeze(this)}Object.freeze(d),a.default=d},{"../Base/TreeNode":25}],31:[function(i,o,a){Object.defineProperty(a,"__esModule",{value:!0});function u(c,f){c===void 0&&(c=[]),f=f||function(v,y){return v>y?-1:v<y?1:0};var d=[];c.forEach(function(v){return d.push(v)});var p=d.length,h=function(v,y){if(v<0||v>=p)throw new Error("unknown error");if(y<0||y>=p)throw new Error("unknown error");var A=d[v];d[v]=d[y],d[y]=A},g=function(v){if(v<0||v>=p)throw new Error("unknown error");var y=v*2+1,A=v*2+2;y<p&&f(d[v],d[y])>0&&h(v,y),A<p&&f(d[v],d[A])>0&&h(v,A)};(function(){for(var v=Math.floor((p-1)/2);v>=0;--v)for(var y=v,A=y*2+1;A<p;){var _=A,S=_+1,b=_;if(S<p&&f(d[_],d[S])>0&&(b=S),f(d[y],d[b])<=0)break;h(y,b),y=b,A=y*2+1}})(),this.size=function(){return p},this.empty=function(){return p===0},this.clear=function(){p=0,d.length=0},this.push=function(v){if(d.push(v),++p,p!==1)for(var y=p-1;y>0;){var A=Math.floor((y-1)/2);if(f(d[A],v)<=0)break;g(A),y=A}},this.pop=function(){if(!this.empty()){if(this.size()===1){--p;return}var v=d[p-1];--p;for(var y=0;y<this.size();){var A=y*2+1,_=y*2+2;if(A>=this.size())break;var S=A;if(_<this.size()&&f(d[A],d[_])>0&&(S=_),f(d[S],v)>=0)break;d[y]=d[S],y=S}d[y]=v}},this.top=function(){return d[0]},Object.freeze(this)}Object.freeze(u),a.default=u},{}],32:[function(i,o,a){Object.defineProperty(a,"__esModule",{value:!0});var u=i("../LinkList/LinkList");function c(f){f===void 0&&(f=[]);var d=new u.default(f);this.size=function(){return d.size()},this.empty=function(){return d.empty()},this.clear=function(){d.clear()},this.push=function(p){d.pushBack(p)},this.pop=function(){d.popFront()},this.front=function(){return d.front()},Object.freeze(this)}Object.freeze(c),a.default=c},{"../LinkList/LinkList":29}],33:[function(i,o,a){var u=this&&this.__generator||function(p,h){var g={label:0,sent:function(){if(A[0]&1)throw A[1];return A[1]},trys:[],ops:[]},v,y,A,_;return _={next:S(0),throw:S(1),return:S(2)},typeof Symbol=="function"&&(_[Symbol.iterator]=function(){return this}),_;function S(T){return function(w){return b([T,w])}}function b(T){if(v)throw new TypeError("Generator is already executing.");for(;g;)try{if(v=1,y&&(A=T[0]&2?y.return:T[0]?y.throw||((A=y.return)&&A.call(y),0):y.next)&&!(A=A.call(y,T[1])).done)return A;switch(y=0,A&&(T=[T[0]&2,A.value]),T[0]){case 0:case 1:A=T;break;case 4:return g.label++,{value:T[1],done:!1};case 5:g.label++,y=T[1],T=[0];continue;case 7:T=g.ops.pop(),g.trys.pop();continue;default:if(A=g.trys,!(A=A.length>0&&A[A.length-1])&&(T[0]===6||T[0]===2)){g=0;continue}if(T[0]===3&&(!A||T[1]>A[0]&&T[1]<A[3])){g.label=T[1];break}if(T[0]===6&&g.label<A[1]){g.label=A[1],A=T;break}if(A&&g.label<A[2]){g.label=A[2],g.ops.push(T);break}A[2]&&g.ops.pop(),g.trys.pop();continue}T=h.call(p,g)}catch(w){T=[6,w],y=0}finally{v=A=0}if(T[0]&5)throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}},c=this&&this.__values||function(p){var h=typeof Symbol=="function"&&Symbol.iterator,g=h&&p[h],v=0;if(g)return g.call(p);if(p&&typeof p.length=="number")return{next:function(){return p&&v>=p.length&&(p=void 0),{value:p&&p[v++],done:!p}}};throw new TypeError(h?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(a,"__esModule",{value:!0});var f=i("../Base/TreeNode");function d(p,h){var g=this;p===void 0&&(p=[]),h=h||function(L,F){return L<F?-1:L>F?1:0};var v=0,y=new f.default;y.color=f.default.TreeNodeColorType.black,this.size=function(){return v},this.empty=function(){return v===0},this.clear=function(){v=0,y.key=void 0,y.leftChild=y.rightChild=y.brother=y.parent=void 0,y.color=f.default.TreeNodeColorType.black};var A=function(L){if(!L||L.key===void 0)throw new Error("unknown error");return L.leftChild?A(L.leftChild):L},_=function(L){if(!L||L.key===void 0)throw new Error("unknown error");return L.rightChild?_(L.rightChild):L};this.front=function(){if(!this.empty()){var L=A(y);return L.key}},this.back=function(){if(!this.empty()){var L=_(y);return L.key}},this.forEach=function(L){var F,O,ue=0;try{for(var _e=c(this),Ce=_e.next();!Ce.done;Ce=_e.next()){var de=Ce.value;L(de,ue++)}}catch(ie){F={error:ie}}finally{try{Ce&&!Ce.done&&(O=_e.return)&&O.call(_e)}finally{if(F)throw F.error}}},this.getElementByPos=function(L){var F,O;if(L<0||L>=this.size())throw new Error("pos must more than 0 and less than set's size");var ue=0;try{for(var _e=c(this),Ce=_e.next();!Ce.done;Ce=_e.next()){var de=Ce.value;if(ue===L)return de;++ue}}catch(ie){F={error:ie}}finally{try{Ce&&!Ce.done&&(O=_e.return)&&O.call(_e)}finally{if(F)throw F.error}}throw new Error("unknown error")};var S=function(L){var F=L.parent;if(!F){if(L===y)return;throw new Error("unknown error")}if(L.color===f.default.TreeNodeColorType.red){L.color=f.default.TreeNodeColorType.black;return}var O=L.brother;if(!O)throw new Error("unknown error");if(L===F.leftChild){if(O.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.black,F.color=f.default.TreeNodeColorType.red;var ue=F.rotateLeft();y===F&&(y=ue),S(L)}else if(O.color===f.default.TreeNodeColorType.black)if(O.rightChild&&O.rightChild.color===f.default.TreeNodeColorType.red){O.color=F.color,F.color=f.default.TreeNodeColorType.black,O.rightChild&&(O.rightChild.color=f.default.TreeNodeColorType.black);var ue=F.rotateLeft();y===F&&(y=ue),L.color=f.default.TreeNodeColorType.black}else if((!O.rightChild||O.rightChild.color===f.default.TreeNodeColorType.black)&&O.leftChild&&O.leftChild.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.red,O.leftChild&&(O.leftChild.color=f.default.TreeNodeColorType.black);var ue=O.rotateRight();y===O&&(y=ue),S(L)}else(!O.leftChild||O.leftChild.color===f.default.TreeNodeColorType.black)&&(!O.rightChild||O.rightChild.color===f.default.TreeNodeColorType.black)&&(O.color=f.default.TreeNodeColorType.red,S(F))}else if(L===F.rightChild){if(O.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.black,F.color=f.default.TreeNodeColorType.red;var ue=F.rotateRight();y===F&&(y=ue),S(L)}else if(O.color===f.default.TreeNodeColorType.black)if(O.leftChild&&O.leftChild.color===f.default.TreeNodeColorType.red){O.color=F.color,F.color=f.default.TreeNodeColorType.black,O.leftChild&&(O.leftChild.color=f.default.TreeNodeColorType.black);var ue=F.rotateRight();y===F&&(y=ue),L.color=f.default.TreeNodeColorType.black}else if((!O.leftChild||O.leftChild.color===f.default.TreeNodeColorType.black)&&O.rightChild&&O.rightChild.color===f.default.TreeNodeColorType.red){O.color=f.default.TreeNodeColorType.red,O.rightChild&&(O.rightChild.color=f.default.TreeNodeColorType.black);var ue=O.rotateLeft();y===O&&(y=ue),S(L)}else(!O.leftChild||O.leftChild.color===f.default.TreeNodeColorType.black)&&(!O.rightChild||O.rightChild.color===f.default.TreeNodeColorType.black)&&(O.color=f.default.TreeNodeColorType.red,S(F))}},b=function(L){for(var F=L;F.leftChild||F.rightChild;){if(F.rightChild){F=A(F.rightChild);var O=L.key;L.key=F.key,F.key=O,L=F}if(F.leftChild){F=_(F.leftChild);var O=L.key;L.key=F.key,F.key=O,L=F}}S(F),F&&F.remove(),--v,y.color=f.default.TreeNodeColorType.black},T=function(L,F){if(!L||L.key===void 0)return!1;var O=T(L.leftChild,F);return O||F(L)?!0:T(L.rightChild,F)};this.eraseElementByPos=function(L){if(L<0||L>=v)throw new Error("pos must more than 0 and less than set's size");var F=0;T(y,function(O){return L===F?(b(O),!0):(++F,!1)})},this.eraseElementByValue=function(L){if(!this.empty()){var F=k(y,L);F===void 0||F.key===void 0||h(F.key,L)!==0||b(F)}};var w=function(L,F){if(!L||L.key===void 0)throw new Error("unknown error");var O=h(F,L.key);return O<0?L.leftChild?w(L.leftChild,F):(L.leftChild=new f.default,L.leftChild.parent=L,L.leftChild.brother=L.rightChild,L.rightChild&&(L.rightChild.brother=L.leftChild),L.leftChild):O>0?L.rightChild?w(L.rightChild,F):(L.rightChild=new f.default,L.rightChild.parent=L,L.rightChild.brother=L.leftChild,L.leftChild&&(L.leftChild.brother=L.rightChild),L.rightChild):L},x=function(L){var F=L.parent;if(!F){if(L===y)return;throw new Error("unknown error")}if(F.color!==f.default.TreeNodeColorType.black&&F.color===f.default.TreeNodeColorType.red){var O=F.brother,ue=F.parent;if(!ue)throw new Error("unknown error");if(O&&O.color===f.default.TreeNodeColorType.red)O.color=F.color=f.default.TreeNodeColorType.black,ue.color=f.default.TreeNodeColorType.red,x(ue);else if(!O||O.color===f.default.TreeNodeColorType.black){if(F===ue.leftChild){if(L===F.leftChild){F.color=f.default.TreeNodeColorType.black,ue.color=f.default.TreeNodeColorType.red;var _e=ue.rotateRight();ue===y&&(y=_e)}else if(L===F.rightChild){var _e=F.rotateLeft();ue===y&&(y=_e),x(F)}}else if(F===ue.rightChild){if(L===F.leftChild){var _e=F.rotateRight();ue===y&&(y=_e),x(F)}else if(L===F.rightChild){F.color=f.default.TreeNodeColorType.black,ue.color=f.default.TreeNodeColorType.red;var _e=ue.rotateLeft();ue===y&&(y=_e)}}}}};this.insert=function(L){if(L==null)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty()){++v,y.key=L,y.color=f.default.TreeNodeColorType.black;return}var F=w(y,L);F.key!==void 0&&h(F.key,L)===0||(++v,F.key=L,x(F),y.color=f.default.TreeNodeColorType.black)};var k=function(L,F){if(!(!L||L.key===void 0)){var O=h(F,L.key);return O<0?k(L.leftChild,F):O>0?k(L.rightChild,F):L}};this.find=function(L){var F=k(y,L);return F!==void 0&&F.key!==void 0&&h(F.key,L)===0};var M=function(L,F){if(!(!L||L.key===void 0)){var O=h(L.key,F);if(O===0)return L.key;if(O<0)return M(L.rightChild,F);var ue=M(L.leftChild,F);return ue!==void 0?ue:L.key}};this.lowerBound=function(L){return M(y,L)};var D=function(L,F){if(!(!L||L.key===void 0)){var O=h(L.key,F);if(O<=0)return D(L.rightChild,F);var ue=D(L.leftChild,F);return ue!==void 0?ue:L.key}};this.upperBound=function(L){return D(y,L)};var z=function(L,F){if(!(!L||L.key===void 0)){var O=h(L.key,F);if(O===0)return L.key;if(O>0)return z(L.leftChild,F);var ue=z(L.rightChild,F);return ue!==void 0?ue:L.key}};this.reverseLowerBound=function(L){return z(y,L)};var j=function(L,F){if(!(!L||L.key===void 0)){var O=h(L.key,F);if(O>=0)return j(L.leftChild,F);var ue=j(L.rightChild,F);return ue!==void 0?ue:L.key}};this.reverseUpperBound=function(L){return j(y,L)},this.union=function(L){var F=this;L.forEach(function(O){return F.insert(O)})},this.getHeight=function(){if(this.empty())return 0;var L=function(F){return F?Math.max(L(F.leftChild),L(F.rightChild))+1:1};return L(y)};var oe=function(L){return u(this,function(F){switch(F.label){case 0:return!L||L.key===void 0?[2]:[5,c(oe(L.leftChild))];case 1:return F.sent(),[4,L.key];case 2:return F.sent(),[5,c(oe(L.rightChild))];case 3:return F.sent(),[2]}})};this[Symbol.iterator]=function(){return oe(y)},p.forEach(function(L){return g.insert(L)}),Object.freeze(this)}Object.freeze(d),a.default=d},{"../Base/TreeNode":25}],34:[function(i,o,a){Object.defineProperty(a,"__esModule",{value:!0});function u(c){var f=this;c===void 0&&(c=[]);var d=0,p=[];this.size=function(){return d},this.empty=function(){return d===0},this.clear=function(){d=0,p.length=0},this.push=function(h){p.push(h),++d},this.pop=function(){p.pop(),d>0&&--d},this.top=function(){return p[d-1]},c.forEach(function(h){return f.push(h)}),Object.freeze(this)}Object.freeze(u),a.default=u},{}],35:[function(i,o,a){var u=this&&this.__generator||function(h,g){var v={label:0,sent:function(){if(_[0]&1)throw _[1];return _[1]},trys:[],ops:[]},y,A,_,S;return S={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(S[Symbol.iterator]=function(){return this}),S;function b(w){return function(x){return T([w,x])}}function T(w){if(y)throw new TypeError("Generator is already executing.");for(;v;)try{if(y=1,A&&(_=w[0]&2?A.return:w[0]?A.throw||((_=A.return)&&_.call(A),0):A.next)&&!(_=_.call(A,w[1])).done)return _;switch(A=0,_&&(w=[w[0]&2,_.value]),w[0]){case 0:case 1:_=w;break;case 4:return v.label++,{value:w[1],done:!1};case 5:v.label++,A=w[1],w=[0];continue;case 7:w=v.ops.pop(),v.trys.pop();continue;default:if(_=v.trys,!(_=_.length>0&&_[_.length-1])&&(w[0]===6||w[0]===2)){v=0;continue}if(w[0]===3&&(!_||w[1]>_[0]&&w[1]<_[3])){v.label=w[1];break}if(w[0]===6&&v.label<_[1]){v.label=_[1],_=w;break}if(_&&v.label<_[2]){v.label=_[2],v.ops.push(w);break}_[2]&&v.ops.pop(),v.trys.pop();continue}w=g.call(h,v)}catch(x){w=[6,x],A=0}finally{y=_=0}if(w[0]&5)throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}},c=this&&this.__read||function(h,g){var v=typeof Symbol=="function"&&h[Symbol.iterator];if(!v)return h;var y=v.call(h),A,_=[],S;try{for(;(g===void 0||g-- >0)&&!(A=y.next()).done;)_.push(A.value)}catch(b){S={error:b}}finally{try{A&&!A.done&&(v=y.return)&&v.call(y)}finally{if(S)throw S.error}}return _},f=this&&this.__spreadArray||function(h,g,v){if(v||arguments.length===2)for(var y=0,A=g.length,_;y<A;y++)(_||!(y in g))&&(_||(_=Array.prototype.slice.call(g,0,y)),_[y]=g[y]);return h.concat(_||Array.prototype.slice.call(g))},d=this&&this.__values||function(h){var g=typeof Symbol=="function"&&Symbol.iterator,v=g&&h[g],y=0;if(v)return v.call(h);if(h&&typeof h.length=="number")return{next:function(){return h&&y>=h.length&&(h=void 0),{value:h&&h[y++],done:!h}}};throw new TypeError(g?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(a,"__esModule",{value:!0});function p(h){var g=this;h===void 0&&(h=[]);var v=0,y=[];this.size=function(){return v},this.empty=function(){return v===0},this.clear=function(){v=0,y.length=0},this.front=function(){if(!this.empty())return y[0]},this.back=function(){if(!this.empty())return y[v-1]},this.forEach=function(A){y.forEach(A)},this.getElementByPos=function(A){if(A<0||A>=v)throw new Error("pos must more than 0 and less than vector's size");return y[A]},this.eraseElementByPos=function(A){if(A<0||A>=v)throw new Error("pos must more than 0 and less than vector's size");for(var _=A;_<v-1;++_)y[_]=y[_+1];this.popBack()},this.eraseElementByValue=function(A){var _=[];this.forEach(function(b){b!==A&&_.push(b)}),_.forEach(function(b,T){y[T]=b});for(var S=_.length;v>S;)this.popBack()},this.pushBack=function(A){y.push(A),++v},this.popBack=function(){y.pop(),v>0&&--v},this.setElementByPos=function(A,_){if(A<0||A>=v)throw new Error("pos must more than 0 and less than vector's size");y[A]=_},this.insert=function(A,_,S){if(S===void 0&&(S=1),A<0||A>v)throw new Error("pos must more than 0 and less than or equal to vector's size");y.splice.apply(y,f([A,0],c(new Array(S).fill(_)),!1)),v+=S},this.find=function(A){return y.includes(A)},this.reverse=function(){y.reverse()},this.unique=function(){var A,_=[];this.forEach(function(b,T){(T===0||b!==A)&&(_.push(b),A=b)}),_.forEach(function(b,T){y[T]=b});for(var S=_.length;v>S;)this.popBack()},this.sort=function(A){y.sort(A)},this[Symbol.iterator]=function(){return function(){return u(this,function(A){switch(A.label){case 0:return[5,d(y)];case 1:return[2,A.sent()]}})}()},h.forEach(function(A){return g.pushBack(A)}),Object.freeze(this)}Object.freeze(p),a.default=p},{}],36:[function(i,o,a){Object.defineProperty(a,"__esModule",{value:!0}),a.HashMap=a.HashSet=a.Map=a.Set=a.PriorityQueue=a.Deque=a.LinkList=a.Queue=a.Stack=a.Vector=void 0;var u=i("./Vector/Vector");a.Vector=u.default;var c=i("./Stack/Stack");a.Stack=c.default;var f=i("./Queue/Queue");a.Queue=f.default;var d=i("./LinkList/LinkList");a.LinkList=d.default;var p=i("./Deque/Deque");a.Deque=p.default;var h=i("./PriorityQueue/PriorityQueue");a.PriorityQueue=h.default;var g=i("./Set/Set");a.Set=g.default;var v=i("./Map/Map");a.Map=v.default;var y=i("./HashSet/HashSet");a.HashSet=y.default;var A=i("./HashMap/HashMap");a.HashMap=A.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(i,o,a){const u=i("yallist"),c=Symbol("max"),f=Symbol("length"),d=Symbol("lengthCalculator"),p=Symbol("allowStale"),h=Symbol("maxAge"),g=Symbol("dispose"),v=Symbol("noDisposeOnSet"),y=Symbol("lruList"),A=Symbol("cache"),_=Symbol("updateAgeOnGet"),S=()=>1;class b{constructor(j){if(typeof j=="number"&&(j={max:j}),j||(j={}),j.max&&(typeof j.max!="number"||j.max<0))throw new TypeError("max must be a non-negative number");this[c]=j.max||1/0;const oe=j.length||S;if(this[d]=typeof oe!="function"?S:oe,this[p]=j.stale||!1,j.maxAge&&typeof j.maxAge!="number")throw new TypeError("maxAge must be a number");this[h]=j.maxAge||0,this[g]=j.dispose,this[v]=j.noDisposeOnSet||!1,this[_]=j.updateAgeOnGet||!1,this.reset()}set max(j){if(typeof j!="number"||j<0)throw new TypeError("max must be a non-negative number");this[c]=j||1/0,x(this)}get max(){return this[c]}set allowStale(j){this[p]=!!j}get allowStale(){return this[p]}set maxAge(j){if(typeof j!="number")throw new TypeError("maxAge must be a non-negative number");this[h]=j,x(this)}get maxAge(){return this[h]}set lengthCalculator(j){typeof j!="function"&&(j=S),j!==this[d]&&(this[d]=j,this[f]=0,this[y].forEach(oe=>{oe.length=this[d](oe.value,oe.key),this[f]+=oe.length})),x(this)}get lengthCalculator(){return this[d]}get length(){return this[f]}get itemCount(){return this[y].length}rforEach(j,oe){oe=oe||this;for(let L=this[y].tail;L!==null;){const F=L.prev;D(this,j,L,oe),L=F}}forEach(j,oe){oe=oe||this;for(let L=this[y].head;L!==null;){const F=L.next;D(this,j,L,oe),L=F}}keys(){return this[y].toArray().map(j=>j.key)}values(){return this[y].toArray().map(j=>j.value)}reset(){this[g]&&this[y]&&this[y].length&&this[y].forEach(j=>this[g](j.key,j.value)),this[A]=new Map,this[y]=new u,this[f]=0}dump(){return this[y].map(j=>w(this,j)?!1:{k:j.key,v:j.value,e:j.now+(j.maxAge||0)}).toArray().filter(j=>j)}dumpLru(){return this[y]}set(j,oe,L){if(L=L||this[h],L&&typeof L!="number")throw new TypeError("maxAge must be a number");const F=L?Date.now():0,O=this[d](oe,j);if(this[A].has(j)){if(O>this[c])return k(this,this[A].get(j)),!1;const Ce=this[A].get(j).value;return this[g]&&(this[v]||this[g](j,Ce.value)),Ce.now=F,Ce.maxAge=L,Ce.value=oe,this[f]+=O-Ce.length,Ce.length=O,this.get(j),x(this),!0}const ue=new M(j,oe,O,F,L);return ue.length>this[c]?(this[g]&&this[g](j,oe),!1):(this[f]+=ue.length,this[y].unshift(ue),this[A].set(j,this[y].head),x(this),!0)}has(j){if(!this[A].has(j))return!1;const oe=this[A].get(j).value;return!w(this,oe)}get(j){return T(this,j,!0)}peek(j){return T(this,j,!1)}pop(){const j=this[y].tail;return j?(k(this,j),j.value):null}del(j){k(this,this[A].get(j))}load(j){this.reset();const oe=Date.now();for(let L=j.length-1;L>=0;L--){const F=j[L],O=F.e||0;if(O===0)this.set(F.k,F.v);else{const ue=O-oe;ue>0&&this.set(F.k,F.v,ue)}}}prune(){this[A].forEach((j,oe)=>T(this,oe,!1))}}const T=(z,j,oe)=>{const L=z[A].get(j);if(L){const F=L.value;if(w(z,F)){if(k(z,L),!z[p])return}else oe&&(z[_]&&(L.value.now=Date.now()),z[y].unshiftNode(L));return F.value}},w=(z,j)=>{if(!j||!j.maxAge&&!z[h])return!1;const oe=Date.now()-j.now;return j.maxAge?oe>j.maxAge:z[h]&&oe>z[h]},x=z=>{if(z[f]>z[c])for(let j=z[y].tail;z[f]>z[c]&&j!==null;){const oe=j.prev;k(z,j),j=oe}},k=(z,j)=>{if(j){const oe=j.value;z[g]&&z[g](oe.key,oe.value),z[f]-=oe.length,z[A].delete(oe.key),z[y].removeNode(j)}};class M{constructor(j,oe,L,F,O){this.key=j,this.value=oe,this.length=L,this.now=F,this.maxAge=O||0}}const D=(z,j,oe,L)=>{let F=oe.value;w(z,F)&&(k(z,oe),z[p]||(F=void 0)),F&&j.call(L,F.value,F.key,z)};o.exports=b},{yallist:83}],38:[function(i,o,a){(function(u){(function(){const c=o.exports;c.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"},c.codes={};for(const d in c.types){const p=c.types[d];c.codes[p]=d}c.CMD_SHIFT=4,c.CMD_MASK=240,c.DUP_MASK=8,c.QOS_MASK=3,c.QOS_SHIFT=1,c.RETAIN_MASK=1,c.VARBYTEINT_MASK=127,c.VARBYTEINT_FIN_MASK=128,c.VARBYTEINT_MAX=268435455,c.SESSIONPRESENT_MASK=1,c.SESSIONPRESENT_HEADER=u.from([c.SESSIONPRESENT_MASK]),c.CONNACK_HEADER=u.from([c.codes.connack<<c.CMD_SHIFT]),c.USERNAME_MASK=128,c.PASSWORD_MASK=64,c.WILL_RETAIN_MASK=32,c.WILL_QOS_MASK=24,c.WILL_QOS_SHIFT=3,c.WILL_FLAG_MASK=4,c.CLEAN_SESSION_MASK=2,c.CONNECT_HEADER=u.from([c.codes.connect<<c.CMD_SHIFT]),c.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},c.propertiesCodes={};for(const d in c.properties){const p=c.properties[d];c.propertiesCodes[p]=d}c.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 f(d){return[0,1,2].map(p=>[0,1].map(h=>[0,1].map(g=>{const v=u.alloc(1);return v.writeUInt8(c.codes[d]<<c.CMD_SHIFT|(h?c.DUP_MASK:0)|p<<c.QOS_SHIFT|g,0,!0),v})))}c.PUBLISH_HEADER=f("publish"),c.SUBSCRIBE_HEADER=f("subscribe"),c.SUBSCRIBE_OPTIONS_QOS_MASK=3,c.SUBSCRIBE_OPTIONS_NL_MASK=1,c.SUBSCRIBE_OPTIONS_NL_SHIFT=2,c.SUBSCRIBE_OPTIONS_RAP_MASK=1,c.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,c.SUBSCRIBE_OPTIONS_RH_MASK=3,c.SUBSCRIBE_OPTIONS_RH_SHIFT=4,c.SUBSCRIBE_OPTIONS_RH=[0,16,32],c.SUBSCRIBE_OPTIONS_NL=4,c.SUBSCRIBE_OPTIONS_RAP=8,c.SUBSCRIBE_OPTIONS_QOS=[0,1,2],c.UNSUBSCRIBE_HEADER=f("unsubscribe"),c.ACKS={unsuback:f("unsuback"),puback:f("puback"),pubcomp:f("pubcomp"),pubrel:f("pubrel"),pubrec:f("pubrec")},c.SUBACK_HEADER=u.from([c.codes.suback<<c.CMD_SHIFT]),c.VERSION3=u.from([3]),c.VERSION4=u.from([4]),c.VERSION5=u.from([5]),c.VERSION131=u.from([131]),c.VERSION132=u.from([132]),c.QOS=[0,1,2].map(d=>u.from([d])),c.EMPTY={pingreq:u.from([c.codes.pingreq<<4,0]),pingresp:u.from([c.codes.pingresp<<4,0]),disconnect:u.from([c.codes.disconnect<<4,0])}}).call(this)}).call(this,i("buffer").Buffer)},{buffer:17}],39:[function(i,o,a){(function(u){(function(){const c=i("./writeToStream"),f=i("events");function d(h,g){const v=new p;return c(h,v,g),v.concat()}class p extends f{constructor(){super(),this._array=new Array(20),this._i=0}write(g){return this._array[this._i++]=g,!0}concat(){let g=0;const v=new Array(this._array.length),y=this._array;let A=0,_;for(_=0;_<y.length&&y[_]!==void 0;_++)typeof y[_]!="string"?v[_]=y[_].length:v[_]=u.byteLength(y[_]),g+=v[_];const S=u.allocUnsafe(g);for(_=0;_<y.length&&y[_]!==void 0;_++)typeof y[_]!="string"?(y[_].copy(S,A),A+=v[_]):(S.write(y[_],A),A+=v[_]);return S}}o.exports=d}).call(this)}).call(this,i("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(i,o,a){a.parser=i("./parser").parser,a.generate=i("./generate"),a.writeToStream=i("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(i,o,a){(function(u){(function(){const f={},d=u.isBuffer(u.from([1,2]).subarray(0,1));function p(y){const A=u.allocUnsafe(2);return A.writeUInt8(y>>8,0),A.writeUInt8(y&255,0+1),A}function h(){for(let y=0;y<65536;y++)f[y]=p(y)}function g(y){let _=0,S=0;const b=u.allocUnsafe(4);do _=y%128|0,y=y/128|0,y>0&&(_=_|128),b.writeUInt8(_,S++);while(y>0&&S<4);return y>0&&(S=0),d?b.subarray(0,S):b.slice(0,S)}function v(y){const A=u.allocUnsafe(4);return A.writeUInt32BE(y,0),A}o.exports={cache:f,generateCache:h,generateNumber:p,genBufVariableByteInt:g,generate4ByteBuffer:v}}).call(this)}).call(this,i("buffer").Buffer)},{buffer:17}],42:[function(i,o,a){class u{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}o.exports=u},{}],43:[function(i,o,a){const u=i("bl"),c=i("events"),f=i("./packet"),d=i("./constants"),p=i("debug")("mqtt-packet:parser");class h extends c{constructor(){super(),this.parser=this.constructor.parser}static parser(v){return this instanceof h?(this.settings=v||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new h().parser(v)}_resetState(){p("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new f,this.error=null,this._list=u(),this._stateCounter=0}parse(v){for(this.error&&this._resetState(),this._list.append(v),p("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++,p("parse: state complete. _stateCounter is now: %d",this._stateCounter),p("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return p("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const v=this._list.readUInt8(0);return this.packet.cmd=d.types[v>>d.CMD_SHIFT],this.packet.retain=(v&d.RETAIN_MASK)!==0,this.packet.qos=v>>d.QOS_SHIFT&d.QOS_MASK,this.packet.dup=(v&d.DUP_MASK)!==0,p("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const v=this._parseVarByteNum(!0);return v&&(this.packet.length=v.value,this._list.consume(v.bytes)),p("_parseLength %d",v.value),!!v}_parsePayload(){p("_parsePayload: payload %O",this._list);let v=!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"))}v=!0}return p("_parsePayload complete result: %s",v),v}_parseConnect(){p("_parseConnect");let v,y,A,_;const S={},b=this.packet,T=this._parseString();if(T===null)return this._emitError(new Error("Cannot parse protocolId"));if(T!=="MQTT"&&T!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(b.protocolId=T,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(b.protocolVersion=this._list.readUInt8(this._pos),b.protocolVersion>=128&&(b.bridgeMode=!0,b.protocolVersion=b.protocolVersion-128),b.protocolVersion!==3&&b.protocolVersion!==4&&b.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(S.username=this._list.readUInt8(this._pos)&d.USERNAME_MASK,S.password=this._list.readUInt8(this._pos)&d.PASSWORD_MASK,S.will=this._list.readUInt8(this._pos)&d.WILL_FLAG_MASK,S.will&&(b.will={},b.will.retain=(this._list.readUInt8(this._pos)&d.WILL_RETAIN_MASK)!==0,b.will.qos=(this._list.readUInt8(this._pos)&d.WILL_QOS_MASK)>>d.WILL_QOS_SHIFT),b.clean=(this._list.readUInt8(this._pos)&d.CLEAN_SESSION_MASK)!==0,this._pos++,b.keepalive=this._parseNum(),b.keepalive===-1)return this._emitError(new Error("Packet too short"));if(b.protocolVersion===5){const x=this._parseProperties();Object.getOwnPropertyNames(x).length&&(b.properties=x)}const w=this._parseString();if(w===null)return this._emitError(new Error("Packet too short"));if(b.clientId=w,p("_parseConnect: packet.clientId: %s",b.clientId),S.will){if(b.protocolVersion===5){const x=this._parseProperties();Object.getOwnPropertyNames(x).length&&(b.will.properties=x)}if(v=this._parseString(),v===null)return this._emitError(new Error("Cannot parse will topic"));if(b.will.topic=v,p("_parseConnect: packet.will.topic: %s",b.will.topic),y=this._parseBuffer(),y===null)return this._emitError(new Error("Cannot parse will payload"));b.will.payload=y,p("_parseConnect: packet.will.paylaod: %s",b.will.payload)}if(S.username){if(_=this._parseString(),_===null)return this._emitError(new Error("Cannot parse username"));b.username=_,p("_parseConnect: packet.username: %s",b.username)}if(S.password){if(A=this._parseBuffer(),A===null)return this._emitError(new Error("Cannot parse password"));b.password=A}return this.settings=b,p("_parseConnect: complete"),b}_parseConnack(){p("_parseConnack");const v=this.packet;if(this._list.length<1)return null;if(v.sessionPresent=!!(this._list.readUInt8(this._pos++)&d.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?v.reasonCode=this._list.readUInt8(this._pos++):v.reasonCode=0;else{if(this._list.length<2)return null;v.returnCode=this._list.readUInt8(this._pos++)}if(v.returnCode===-1||v.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){const y=this._parseProperties();Object.getOwnPropertyNames(y).length&&(v.properties=y)}p("_parseConnack: complete")}_parsePublish(){p("_parsePublish");const v=this.packet;if(v.topic=this._parseString(),v.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(v.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){const y=this._parseProperties();Object.getOwnPropertyNames(y).length&&(v.properties=y)}v.payload=this._list.slice(this._pos,v.length),p("_parsePublish: payload from buffer list: %o",v.payload)}}_parseSubscribe(){p("_parseSubscribe");const v=this.packet;let y,A,_,S,b,T,w;if(v.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(v.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const x=this._parseProperties();Object.getOwnPropertyNames(x).length&&(v.properties=x)}for(;this._pos<v.length;){if(y=this._parseString(),y===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=v.length)return this._emitError(new Error("Malformed Subscribe Payload"));A=this._parseByte(),_=A&d.SUBSCRIBE_OPTIONS_QOS_MASK,T=(A>>d.SUBSCRIBE_OPTIONS_NL_SHIFT&d.SUBSCRIBE_OPTIONS_NL_MASK)!==0,b=(A>>d.SUBSCRIBE_OPTIONS_RAP_SHIFT&d.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,S=A>>d.SUBSCRIBE_OPTIONS_RH_SHIFT&d.SUBSCRIBE_OPTIONS_RH_MASK,w={topic:y,qos:_},this.settings.protocolVersion===5?(w.nl=T,w.rap=b,w.rh=S):this.settings.bridgeMode&&(w.rh=0,w.rap=!0,w.nl=!0),p("_parseSubscribe: push subscription `%s` to subscription",w),v.subscriptions.push(w)}}}_parseSuback(){p("_parseSuback");const v=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const y=this._parseProperties();Object.getOwnPropertyNames(y).length&&(v.properties=y)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){p("_parseUnsubscribe");const v=this.packet;if(v.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const y=this._parseProperties();Object.getOwnPropertyNames(y).length&&(v.properties=y)}for(;this._pos<v.length;){const y=this._parseString();if(y===null)return this._emitError(new Error("Cannot parse topic"));p("_parseUnsubscribe: push topic `%s` to unsubscriptions",y),v.unsubscriptions.push(y)}}}_parseUnsuback(){p("_parseUnsuback");const v=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(this.settings.protocolVersion===5){const y=this._parseProperties();for(Object.getOwnPropertyNames(y).length&&(v.properties=y),v.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){p("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const v=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5&&(v.length>2?(v.reasonCode=this._parseByte(),p("_parseConfirmation: packet.reasonCode `%d`",v.reasonCode)):v.reasonCode=0,v.length>3)){const y=this._parseProperties();Object.getOwnPropertyNames(y).length&&(v.properties=y)}return!0}_parseDisconnect(){const v=this.packet;if(p("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?v.reasonCode=this._parseByte():v.reasonCode=0;const y=this._parseProperties();Object.getOwnPropertyNames(y).length&&(v.properties=y)}return p("_parseDisconnect result: true"),!0}_parseAuth(){p("_parseAuth");const v=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));v.reasonCode=this._parseByte();const y=this._parseProperties();return Object.getOwnPropertyNames(y).length&&(v.properties=y),p("_parseAuth: result: true"),!0}_parseMessageId(){const v=this.packet;return v.messageId=this._parseNum(),v.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(p("_parseMessageId: packet.messageId %d",v.messageId),!0)}_parseString(v){const y=this._parseNum(),A=y+this._pos;if(y===-1||A>this._list.length||A>this.packet.length)return null;const _=this._list.toString("utf8",this._pos,A);return this._pos+=y,p("_parseString: result: %s",_),_}_parseStringPair(){return p("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const v=this._parseNum(),y=v+this._pos;if(v===-1||y>this._list.length||y>this.packet.length)return null;const A=this._list.slice(this._pos,y);return this._pos+=v,p("_parseBuffer: result: %o",A),A}_parseNum(){if(this._list.length-this._pos<2)return-1;const v=this._list.readUInt16BE(this._pos);return this._pos+=2,p("_parseNum: result: %s",v),v}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const v=this._list.readUInt32BE(this._pos);return this._pos+=4,p("_parse4ByteNum: result: %s",v),v}_parseVarByteNum(v){p("_parseVarByteNum");const y=4;let A=0,_=1,S=0,b=!1,T;const w=this._pos?this._pos:0;for(;A<y&&w+A<this._list.length;){if(T=this._list.readUInt8(w+A++),S+=_*(T&d.VARBYTEINT_MASK),_*=128,!(T&d.VARBYTEINT_FIN_MASK)){b=!0;break}if(this._list.length<=A)break}return!b&&A===y&&this._list.length>=A&&this._emitError(new Error("Invalid variable byte integer")),w&&(this._pos+=A),b=b?v?{bytes:A,value:S}:S:!1,p("_parseVarByteNum: result: %o",b),b}_parseByte(){let v;return this._pos<this._list.length&&(v=this._list.readUInt8(this._pos),this._pos++),p("_parseByte: result: %o",v),v}_parseByType(v){switch(p("_parseByType: type: %s",v),v){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(){p("_parseProperties");const v=this._parseVarByteNum(),A=this._pos+v,_={};for(;this._pos<A;){const S=this._parseByte();if(!S)return this._emitError(new Error("Cannot parse property code type")),!1;const b=d.propertiesCodes[S];if(!b)return this._emitError(new Error("Unknown property")),!1;if(b==="userProperties"){_[b]||(_[b]=Object.create(null));const T=this._parseByType(d.propertiesTypes[b]);if(_[b][T.name])if(Array.isArray(_[b][T.name]))_[b][T.name].push(T.value);else{const w=_[b][T.name];_[b][T.name]=[w],_[b][T.name].push(T.value)}else _[b][T.name]=T.value;continue}_[b]?Array.isArray(_[b])?_[b].push(this._parseByType(d.propertiesTypes[b])):(_[b]=[_[b]],_[b].push(this._parseByType(d.propertiesTypes[b]))):_[b]=this._parseByType(d.propertiesTypes[b])}return _}_newPacket(){return p("_newPacket"),this.packet&&(this._list.consume(this.packet.length),p("_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)),p("_newPacket: new packet"),this.packet=new f,this._pos=0,!0}_emitError(v){p("_emitError"),this.error=v,this.emit("error",v)}}o.exports=h},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(i,o,a){(function(u){(function(){const c=i("./constants"),f=u.allocUnsafe(0),d=u.from([0]),p=i("./numbers"),h=i("process-nextick-args").nextTick,g=i("debug")("mqtt-packet:writeToStream"),v=p.cache,y=p.generateNumber,A=p.generateCache,_=p.genBufVariableByteInt,S=p.generate4ByteBuffer;let b=Ie,T=!0;function w(Ne,pe,At){switch(g("generate called"),pe.cork&&(pe.cork(),h(x,pe)),T&&(T=!1,A()),g("generate: packet.cmd: %s",Ne.cmd),Ne.cmd){case"connect":return k(Ne,pe);case"connack":return M(Ne,pe,At);case"publish":return D(Ne,pe,At);case"puback":case"pubrec":case"pubrel":case"pubcomp":return z(Ne,pe,At);case"subscribe":return j(Ne,pe,At);case"suback":return oe(Ne,pe,At);case"unsubscribe":return L(Ne,pe,At);case"unsuback":return F(Ne,pe,At);case"pingreq":case"pingresp":return O(Ne,pe);case"disconnect":return ue(Ne,pe,At);case"auth":return _e(Ne,pe,At);default:return pe.emit("error",new Error("Unknown command")),!1}}Object.defineProperty(w,"cacheNumbers",{get(){return b===Ie},set(Ne){Ne?((!v||Object.keys(v).length===0)&&(T=!0),b=Ie):(T=!1,b=Oe)}});function x(Ne){Ne.uncork()}function k(Ne,pe,At){const Ve=Ne||{},xe=Ve.protocolId||"MQTT";let ze=Ve.protocolVersion||4;const Pt=Ve.will;let hn=Ve.clean;const ae=Ve.keepalive||0,le=Ve.clientId||"",re=Ve.username,V=Ve.password,$=Ve.properties;hn===void 0&&(hn=!0);let he=0;if(!xe||typeof xe!="string"&&!u.isBuffer(xe))return pe.emit("error",new Error("Invalid protocolId")),!1;if(he+=xe.length+2,ze!==3&&ze!==4&&ze!==5)return pe.emit("error",new Error("Invalid protocol version")),!1;if(he+=1,(typeof le=="string"||u.isBuffer(le))&&(le||ze>=4)&&(le||hn))he+=u.byteLength(le)+2;else{if(ze<4)return pe.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(hn*1===0)return pe.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof ae!="number"||ae<0||ae>65535||ae%1!==0)return pe.emit("error",new Error("Invalid keepalive")),!1;if(he+=2,he+=1,ze===5){var Ue=Fe(pe,$);if(!Ue)return!1;he+=Ue.length}if(Pt){if(typeof Pt!="object")return pe.emit("error",new Error("Invalid will")),!1;if(!Pt.topic||typeof Pt.topic!="string")return pe.emit("error",new Error("Invalid will topic")),!1;if(he+=u.byteLength(Pt.topic)+2,he+=2,Pt.payload)if(Pt.payload.length>=0)typeof Pt.payload=="string"?he+=u.byteLength(Pt.payload):he+=Pt.payload.length;else return pe.emit("error",new Error("Invalid will payload")),!1;var qe={};if(ze===5){if(qe=Fe(pe,Pt.properties),!qe)return!1;he+=qe.length}}let jt=!1;if(re!=null)if(Et(re))jt=!0,he+=u.byteLength(re)+2;else return pe.emit("error",new Error("Invalid username")),!1;if(V!=null){if(!jt)return pe.emit("error",new Error("Username is required to use password")),!1;if(Et(V))he+=In(V)+2;else return pe.emit("error",new Error("Invalid password")),!1}pe.write(c.CONNECT_HEADER),de(pe,he),Dt(pe,xe),Ve.bridgeMode&&(ze+=128),pe.write(ze===131?c.VERSION131:ze===132?c.VERSION132:ze===4?c.VERSION4:ze===5?c.VERSION5:c.VERSION3);let An=0;return An|=re!=null?c.USERNAME_MASK:0,An|=V!=null?c.PASSWORD_MASK:0,An|=Pt&&Pt.retain?c.WILL_RETAIN_MASK:0,An|=Pt&&Pt.qos?Pt.qos<<c.WILL_QOS_SHIFT:0,An|=Pt?c.WILL_FLAG_MASK:0,An|=hn?c.CLEAN_SESSION_MASK:0,pe.write(u.from([An])),b(pe,ae),ze===5&&Ue.write(),Dt(pe,le),Pt&&(ze===5&&qe.write(),ie(pe,Pt.topic),Dt(pe,Pt.payload)),re!=null&&Dt(pe,re),V!=null&&Dt(pe,V),!0}function M(Ne,pe,At){const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=Ve===5?xe.reasonCode:xe.returnCode,Pt=xe.properties;let hn=2;if(typeof ze!="number")return pe.emit("error",new Error("Invalid return code")),!1;let ae=null;if(Ve===5){if(ae=Fe(pe,Pt),!ae)return!1;hn+=ae.length}return pe.write(c.CONNACK_HEADER),de(pe,hn),pe.write(xe.sessionPresent?c.SESSIONPRESENT_HEADER:d),pe.write(u.from([ze])),ae!=null&&ae.write(),!0}function D(Ne,pe,At){g("publish: packet: %o",Ne);const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.qos||0,Pt=xe.retain?c.RETAIN_MASK:0,hn=xe.topic,ae=xe.payload||f,le=xe.messageId,re=xe.properties;let V=0;if(typeof hn=="string")V+=u.byteLength(hn)+2;else if(u.isBuffer(hn))V+=hn.length+2;else return pe.emit("error",new Error("Invalid topic")),!1;if(u.isBuffer(ae)?V+=ae.length:V+=u.byteLength(ae),ze&&typeof le!="number")return pe.emit("error",new Error("Invalid messageId")),!1;ze&&(V+=2);let $=null;if(Ve===5){if($=Fe(pe,re),!$)return!1;V+=$.length}return pe.write(c.PUBLISH_HEADER[ze][xe.dup?1:0][Pt?1:0]),de(pe,V),b(pe,In(hn)),pe.write(hn),ze>0&&b(pe,le),$!=null&&$.write(),g("publish: payload: %o",ae),pe.write(ae)}function z(Ne,pe,At){const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.cmd||"puback",Pt=xe.messageId,hn=xe.dup&&ze==="pubrel"?c.DUP_MASK:0;let ae=0;const le=xe.reasonCode,re=xe.properties;let V=Ve===5?3:2;if(ze==="pubrel"&&(ae=1),typeof Pt!="number")return pe.emit("error",new Error("Invalid messageId")),!1;let $=null;if(Ve===5&&typeof re=="object"){if($=$e(pe,re,At,V),!$)return!1;V+=$.length}return pe.write(c.ACKS[ze][ae][hn][0]),de(pe,V),b(pe,Pt),Ve===5&&pe.write(u.from([le])),$!==null&&$.write(),!0}function j(Ne,pe,At){g("subscribe: packet: ");const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.dup?c.DUP_MASK:0,Pt=xe.messageId,hn=xe.subscriptions,ae=xe.properties;let le=0;if(typeof Pt!="number")return pe.emit("error",new Error("Invalid messageId")),!1;le+=2;let re=null;if(Ve===5){if(re=Fe(pe,ae),!re)return!1;le+=re.length}if(typeof hn=="object"&&hn.length)for(let $=0;$<hn.length;$+=1){const he=hn[$].topic,Ue=hn[$].qos;if(typeof he!="string")return pe.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof Ue!="number")return pe.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(Ve===5){if(typeof(hn[$].nl||!1)!="boolean")return pe.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(hn[$].rap||!1)!="boolean")return pe.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const An=hn[$].rh||0;if(typeof An!="number"||An>2)return pe.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}le+=u.byteLength(he)+2+1}else return pe.emit("error",new Error("Invalid subscriptions")),!1;g("subscribe: writing to stream: %o",c.SUBSCRIBE_HEADER),pe.write(c.SUBSCRIBE_HEADER[1][ze?1:0][0]),de(pe,le),b(pe,Pt),re!==null&&re.write();let V=!0;for(const $ of hn){const he=$.topic,Ue=$.qos,qe=+$.nl,jt=+$.rap,An=$.rh;let wn;ie(pe,he),wn=c.SUBSCRIBE_OPTIONS_QOS[Ue],Ve===5&&(wn|=qe?c.SUBSCRIBE_OPTIONS_NL:0,wn|=jt?c.SUBSCRIBE_OPTIONS_RAP:0,wn|=An?c.SUBSCRIBE_OPTIONS_RH[An]:0),V=pe.write(u.from([wn]))}return V}function oe(Ne,pe,At){const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.messageId,Pt=xe.granted,hn=xe.properties;let ae=0;if(typeof ze!="number")return pe.emit("error",new Error("Invalid messageId")),!1;if(ae+=2,typeof Pt=="object"&&Pt.length)for(let re=0;re<Pt.length;re+=1){if(typeof Pt[re]!="number")return pe.emit("error",new Error("Invalid qos vector")),!1;ae+=1}else return pe.emit("error",new Error("Invalid qos vector")),!1;let le=null;if(Ve===5){if(le=$e(pe,hn,At,ae),!le)return!1;ae+=le.length}return pe.write(c.SUBACK_HEADER),de(pe,ae),b(pe,ze),le!==null&&le.write(),pe.write(u.from(Pt))}function L(Ne,pe,At){const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.messageId,Pt=xe.dup?c.DUP_MASK:0,hn=xe.unsubscriptions,ae=xe.properties;let le=0;if(typeof ze!="number")return pe.emit("error",new Error("Invalid messageId")),!1;if(le+=2,typeof hn=="object"&&hn.length)for(let $=0;$<hn.length;$+=1){if(typeof hn[$]!="string")return pe.emit("error",new Error("Invalid unsubscriptions")),!1;le+=u.byteLength(hn[$])+2}else return pe.emit("error",new Error("Invalid unsubscriptions")),!1;let re=null;if(Ve===5){if(re=Fe(pe,ae),!re)return!1;le+=re.length}pe.write(c.UNSUBSCRIBE_HEADER[1][Pt?1:0][0]),de(pe,le),b(pe,ze),re!==null&&re.write();let V=!0;for(let $=0;$<hn.length;$++)V=ie(pe,hn[$]);return V}function F(Ne,pe,At){const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.messageId,Pt=xe.dup?c.DUP_MASK:0,hn=xe.granted,ae=xe.properties,le=xe.cmd,re=0;let V=2;if(typeof ze!="number")return pe.emit("error",new Error("Invalid messageId")),!1;if(Ve===5)if(typeof hn=="object"&&hn.length)for(let he=0;he<hn.length;he+=1){if(typeof hn[he]!="number")return pe.emit("error",new Error("Invalid qos vector")),!1;V+=1}else return pe.emit("error",new Error("Invalid qos vector")),!1;let $=null;if(Ve===5){if($=$e(pe,ae,At,V),!$)return!1;V+=$.length}return pe.write(c.ACKS[le][re][Pt][0]),de(pe,V),b(pe,ze),$!==null&&$.write(),Ve===5&&pe.write(u.from(hn)),!0}function O(Ne,pe,At){return pe.write(c.EMPTY[Ne.cmd])}function ue(Ne,pe,At){const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.reasonCode,Pt=xe.properties;let hn=Ve===5?1:0,ae=null;if(Ve===5){if(ae=$e(pe,Pt,At,hn),!ae)return!1;hn+=ae.length}return pe.write(u.from([c.codes.disconnect<<4])),de(pe,hn),Ve===5&&pe.write(u.from([ze])),ae!==null&&ae.write(),!0}function _e(Ne,pe,At){const Ve=At?At.protocolVersion:4,xe=Ne||{},ze=xe.reasonCode,Pt=xe.properties;let hn=Ve===5?1:0;Ve!==5&&pe.emit("error",new Error("Invalid mqtt version for auth packet"));const ae=$e(pe,Pt,At,hn);return ae?(hn+=ae.length,pe.write(u.from([c.codes.auth<<4])),de(pe,hn),pe.write(u.from([ze])),ae!==null&&ae.write(),!0):!1}const Ce={};function de(Ne,pe){if(pe>c.VARBYTEINT_MAX)return Ne.emit("error",new Error(`Invalid variable byte integer: ${pe}`)),!1;let At=Ce[pe];return At||(At=_(pe),pe<16384&&(Ce[pe]=At)),g("writeVarByteInt: writing to stream: %o",At),Ne.write(At)}function ie(Ne,pe){const At=u.byteLength(pe);return b(Ne,At),g("writeString: %s",pe),Ne.write(pe,"utf8")}function Y(Ne,pe,At){ie(Ne,pe),ie(Ne,At)}function Ie(Ne,pe){return g("writeNumberCached: number: %d",pe),g("writeNumberCached: %o",v[pe]),Ne.write(v[pe])}function Oe(Ne,pe){const At=y(pe);return g("writeNumberGenerated: %o",At),Ne.write(At)}function kt(Ne,pe){const At=S(pe);return g("write4ByteNumber: %o",At),Ne.write(At)}function Dt(Ne,pe){typeof pe=="string"?ie(Ne,pe):pe?(b(Ne,pe.length),Ne.write(pe)):b(Ne,0)}function Fe(Ne,pe){if(typeof pe!="object"||pe.length!=null)return{length:1,write(){Lt(Ne,{},0)}};let At=0;function Ve(ze,Pt){const hn=c.propertiesTypes[ze];let ae=0;switch(hn){case"byte":{if(typeof Pt!="boolean")return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=1+1;break}case"int8":{if(typeof Pt!="number"||Pt<0||Pt>255)return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=1+1;break}case"binary":{if(Pt&&Pt===null)return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=1+u.byteLength(Pt)+2;break}case"int16":{if(typeof Pt!="number"||Pt<0||Pt>65535)return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=1+2;break}case"int32":{if(typeof Pt!="number"||Pt<0||Pt>4294967295)return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=1+4;break}case"var":{if(typeof Pt!="number"||Pt<0||Pt>268435455)return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=1+u.byteLength(_(Pt));break}case"string":{if(typeof Pt!="string")return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=1+2+u.byteLength(Pt.toString());break}case"pair":{if(typeof Pt!="object")return Ne.emit("error",new Error(`Invalid ${ze}: ${Pt}`)),!1;ae+=Object.getOwnPropertyNames(Pt).reduce((le,re)=>{const V=Pt[re];return Array.isArray(V)?le+=V.reduce(($,he)=>($+=1+2+u.byteLength(re.toString())+2+u.byteLength(he.toString()),$),0):le+=1+2+u.byteLength(re.toString())+2+u.byteLength(Pt[re].toString()),le},0);break}default:return Ne.emit("error",new Error(`Invalid property ${ze}: ${Pt}`)),!1}return ae}if(pe)for(const ze in pe){let Pt=0,hn=0;const ae=pe[ze];if(Array.isArray(ae))for(let le=0;le<ae.length;le++){if(hn=Ve(ze,ae[le]),!hn)return!1;Pt+=hn}else{if(hn=Ve(ze,ae),!hn)return!1;Pt=hn}if(!Pt)return!1;At+=Pt}return{length:u.byteLength(_(At))+At,write(){Lt(Ne,pe,At)}}}function $e(Ne,pe,At,Ve){const xe=["reasonString","userProperties"],ze=At&&At.properties&&At.properties.maximumPacketSize?At.properties.maximumPacketSize:0;let Pt=Fe(Ne,pe);if(ze)for(;Ve+Pt.length>ze;){const hn=xe.shift();if(hn&&pe[hn])delete pe[hn],Pt=Fe(Ne,pe);else return!1}return Pt}function Cn(Ne,pe,At){switch(c.propertiesTypes[pe]){case"byte":{Ne.write(u.from([c.properties[pe]])),Ne.write(u.from([+At]));break}case"int8":{Ne.write(u.from([c.properties[pe]])),Ne.write(u.from([At]));break}case"binary":{Ne.write(u.from([c.properties[pe]])),Dt(Ne,At);break}case"int16":{Ne.write(u.from([c.properties[pe]])),b(Ne,At);break}case"int32":{Ne.write(u.from([c.properties[pe]])),kt(Ne,At);break}case"var":{Ne.write(u.from([c.properties[pe]])),de(Ne,At);break}case"string":{Ne.write(u.from([c.properties[pe]])),ie(Ne,At);break}case"pair":{Object.getOwnPropertyNames(At).forEach(xe=>{const ze=At[xe];Array.isArray(ze)?ze.forEach(Pt=>{Ne.write(u.from([c.properties[pe]])),Y(Ne,xe.toString(),Pt.toString())}):(Ne.write(u.from([c.properties[pe]])),Y(Ne,xe.toString(),ze.toString()))});break}default:return Ne.emit("error",new Error(`Invalid property ${pe} value: ${At}`)),!1}}function Lt(Ne,pe,At){de(Ne,At);for(const Ve in pe)if(Object.prototype.hasOwnProperty.call(pe,Ve)&&pe[Ve]!==null){const xe=pe[Ve];if(Array.isArray(xe))for(let ze=0;ze<xe.length;ze++)Cn(Ne,Ve,xe[ze]);else Cn(Ne,Ve,xe)}}function In(Ne){return Ne?Ne instanceof u?Ne.length:u.byteLength(Ne):0}function Et(Ne){return typeof Ne=="string"||Ne instanceof u}o.exports=w}).call(this)}).call(this,i("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(i,o,a){var u=1e3,c=u*60,f=c*60,d=f*24,p=d*7,h=d*365.25;o.exports=function(_,S){S=S||{};var b=typeof _;if(b==="string"&&_.length>0)return g(_);if(b==="number"&&isFinite(_))return S.long?y(_):v(_);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(_))};function g(_){if(_=String(_),!(_.length>100)){var S=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(_);if(S){var b=parseFloat(S[1]),T=(S[2]||"ms").toLowerCase();switch(T){case"years":case"year":case"yrs":case"yr":case"y":return b*h;case"weeks":case"week":case"w":return b*p;case"days":case"day":case"d":return b*d;case"hours":case"hour":case"hrs":case"hr":case"h":return b*f;case"minutes":case"minute":case"mins":case"min":case"m":return b*c;case"seconds":case"second":case"secs":case"sec":case"s":return b*u;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return b;default:return}}}}function v(_){var S=Math.abs(_);return S>=d?Math.round(_/d)+"d":S>=f?Math.round(_/f)+"h":S>=c?Math.round(_/c)+"m":S>=u?Math.round(_/u)+"s":_+"ms"}function y(_){var S=Math.abs(_);return S>=d?A(_,S,d,"day"):S>=f?A(_,S,f,"hour"):S>=c?A(_,S,c,"minute"):S>=u?A(_,S,u,"second"):_+" ms"}function A(_,S,b,T){var w=S>=b*1.5;return Math.round(_/b)+" "+T+(w?"s":"")}},{}],46:[function(i,o,a){const u=i("./lib/number-allocator.js");o.exports.NumberAllocator=u},{"./lib/number-allocator.js":47}],47:[function(i,o,a){const u=i("js-sdsl").Set,c=i("debug")("number-allocator:trace"),f=i("debug")("number-allocator:error");function d(h,g){this.low=h,this.high=g}d.prototype.equals=function(h){return this.low===h.low&&this.high===h.high},d.prototype.compare=function(h){return this.low<h.low&&this.high<h.low?-1:h.low<this.low&&h.high<this.low?1:0};function p(h,g){if(!(this instanceof p))return new p(h,g);this.min=h,this.max=g,this.ss=new u([],(v,y)=>v.compare(y)),c("Create"),this.clear()}p.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},p.prototype.alloc=function(){if(this.ss.size()===0)return c("alloc():empty"),null;const h=this.ss.front(),g=h.low;return g+1<=h.high?++h.low:this.ss.eraseElementByPos(0),c("alloc():"+g),g},p.prototype.use=function(h){const g=new d(h,h),v=this.ss.lowerBound(g);if(v){if(v.equals(g))return this.ss.eraseElementByValue(v),c("use():"+h),!0;if(v.low>h)return!1;if(v.low===h)return++v.low,c("use():"+h),!0;if(v.high===h)return--v.high,c("use():"+h),!0;const y=v.low;return v.low=h+1,this.ss.insert(new d(y,h-1)),c("use():"+h),!0}return c("use():failed"),!1},p.prototype.free=function(h){if(h<this.min||h>this.max){f("free():"+h+" is out of range");return}const g=new d(h,h),v=this.ss.lowerBound(g);if(v){if(v.low<=h&&h<=v.high){f("free():"+h+" has already been vacant");return}if(v===this.ss.front())h+1===v.low?--v.low:this.ss.insert(g);else{const y=this.ss.reverseLowerBound(g);y.high+1===h?h+1===v.low?(this.ss.eraseElementByValue(y),v.low=y.low):y.high=h:h+1===v.low?v.low=h:this.ss.insert(g)}}else{if(v===this.ss.front()){this.ss.insert(g);return}const y=this.ss.reverseLowerBound(g);y.high+1===h?y.high=h:this.ss.insert(g)}c("free():"+h)},p.prototype.clear=function(){c("clear()"),this.ss.clear(),this.ss.insert(new d(this.min,this.max))},p.prototype.intervalCount=function(){return this.ss.size()},p.prototype.dump=function(){console.log("length:"+this.ss.size());for(const h of this.ss)console.log(h)},o.exports=p},{debug:18,"js-sdsl":36}],48:[function(i,o,a){var u=i("wrappy");o.exports=u(c),o.exports.strict=u(f),c.proto=c(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return c(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return f(this)},configurable:!0})});function c(d){var p=function(){return p.called?p.value:(p.called=!0,p.value=d.apply(this,arguments))};return p.called=!1,p}function f(d){var p=function(){if(p.called)throw new Error(p.onceError);return p.called=!0,p.value=d.apply(this,arguments)},h=d.name||"Function wrapped with `once`";return p.onceError=h+" shouldn't be called more than once",p.called=!1,p}},{wrappy:79}],49:[function(i,o,a){(function(u){(function(){typeof u>"u"||!u.version||u.version.indexOf("v0.")===0||u.version.indexOf("v1.")===0&&u.version.indexOf("v1.8.")!==0?o.exports={nextTick:c}:o.exports=u;function c(f,d,p,h){if(typeof f!="function")throw new TypeError('"callback" argument must be a function');var g=arguments.length,v,y;switch(g){case 0:case 1:return u.nextTick(f);case 2:return u.nextTick(function(){f.call(null,d)});case 3:return u.nextTick(function(){f.call(null,d,p)});case 4:return u.nextTick(function(){f.call(null,d,p,h)});default:for(v=new Array(g-1),y=0;y<v.length;)v[y++]=arguments[y];return u.nextTick(function(){f.apply(null,v)})}}}).call(this)}).call(this,i("_process"))},{_process:50}],50:[function(i,o,a){var u=o.exports={},c,f;function d(){throw new Error("setTimeout has not been defined")}function p(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?c=setTimeout:c=d}catch{c=d}try{typeof clearTimeout=="function"?f=clearTimeout:f=p}catch{f=p}})();function h(x){if(c===setTimeout)return setTimeout(x,0);if((c===d||!c)&&setTimeout)return c=setTimeout,setTimeout(x,0);try{return c(x,0)}catch{try{return c.call(null,x,0)}catch{return c.call(this,x,0)}}}function g(x){if(f===clearTimeout)return clearTimeout(x);if((f===p||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(x);try{return f(x)}catch{try{return f.call(null,x)}catch{return f.call(this,x)}}}var v=[],y=!1,A,_=-1;function S(){!y||!A||(y=!1,A.length?v=A.concat(v):_=-1,v.length&&b())}function b(){if(!y){var x=h(S);y=!0;for(var k=v.length;k;){for(A=v,v=[];++_<k;)A&&A[_].run();_=-1,k=v.length}A=null,y=!1,g(x)}}u.nextTick=function(x){var k=new Array(arguments.length-1);if(arguments.length>1)for(var M=1;M<arguments.length;M++)k[M-1]=arguments[M];v.push(new T(x,k)),v.length===1&&!y&&h(b)};function T(x,k){this.fun=x,this.array=k}T.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={};function w(){}u.on=w,u.addListener=w,u.once=w,u.off=w,u.removeListener=w,u.removeAllListeners=w,u.emit=w,u.prependListener=w,u.prependOnceListener=w,u.listeners=function(x){return[]},u.binding=function(x){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(x){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},{}],51:[function(i,o,a){(function(u){(function(){(function(c){var f=typeof a=="object"&&a&&!a.nodeType&&a,d=typeof o=="object"&&o&&!o.nodeType&&o,p=typeof u=="object"&&u;(p.global===p||p.window===p||p.self===p)&&(c=p);var h,g=2147483647,v=36,y=1,A=26,_=38,S=700,b=72,T=128,w="-",x=/^xn--/,k=/[^\x20-\x7E]/,M=/[\x2E\u3002\uFF0E\uFF61]/g,D={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},z=v-y,j=Math.floor,oe=String.fromCharCode,L;function F(Fe){throw new RangeError(D[Fe])}function O(Fe,$e){for(var Cn=Fe.length,Lt=[];Cn--;)Lt[Cn]=$e(Fe[Cn]);return Lt}function ue(Fe,$e){var Cn=Fe.split("@"),Lt="";Cn.length>1&&(Lt=Cn[0]+"@",Fe=Cn[1]),Fe=Fe.replace(M,".");var In=Fe.split("."),Et=O(In,$e).join(".");return Lt+Et}function _e(Fe){for(var $e=[],Cn=0,Lt=Fe.length,In,Et;Cn<Lt;)In=Fe.charCodeAt(Cn++),In>=55296&&In<=56319&&Cn<Lt?(Et=Fe.charCodeAt(Cn++),(Et&64512)==56320?$e.push(((In&1023)<<10)+(Et&1023)+65536):($e.push(In),Cn--)):$e.push(In);return $e}function Ce(Fe){return O(Fe,function($e){var Cn="";return $e>65535&&($e-=65536,Cn+=oe($e>>>10&1023|55296),$e=56320|$e&1023),Cn+=oe($e),Cn}).join("")}function de(Fe){return Fe-48<10?Fe-22:Fe-65<26?Fe-65:Fe-97<26?Fe-97:v}function ie(Fe,$e){return Fe+22+75*(Fe<26)-(($e!=0)<<5)}function Y(Fe,$e,Cn){var Lt=0;for(Fe=Cn?j(Fe/S):Fe>>1,Fe+=j(Fe/$e);Fe>z*A>>1;Lt+=v)Fe=j(Fe/z);return j(Lt+(z+1)*Fe/(Fe+_))}function Ie(Fe){var $e=[],Cn=Fe.length,Lt,In=0,Et=T,Ne=b,pe,At,Ve,xe,ze,Pt,hn,ae,le;for(pe=Fe.lastIndexOf(w),pe<0&&(pe=0),At=0;At<pe;++At)Fe.charCodeAt(At)>=128&&F("not-basic"),$e.push(Fe.charCodeAt(At));for(Ve=pe>0?pe+1:0;Ve<Cn;){for(xe=In,ze=1,Pt=v;Ve>=Cn&&F("invalid-input"),hn=de(Fe.charCodeAt(Ve++)),(hn>=v||hn>j((g-In)/ze))&&F("overflow"),In+=hn*ze,ae=Pt<=Ne?y:Pt>=Ne+A?A:Pt-Ne,!(hn<ae);Pt+=v)le=v-ae,ze>j(g/le)&&F("overflow"),ze*=le;Lt=$e.length+1,Ne=Y(In-xe,Lt,xe==0),j(In/Lt)>g-Et&&F("overflow"),Et+=j(In/Lt),In%=Lt,$e.splice(In++,0,Et)}return Ce($e)}function Oe(Fe){var $e,Cn,Lt,In,Et,Ne,pe,At,Ve,xe,ze,Pt=[],hn,ae,le,re;for(Fe=_e(Fe),hn=Fe.length,$e=T,Cn=0,Et=b,Ne=0;Ne<hn;++Ne)ze=Fe[Ne],ze<128&&Pt.push(oe(ze));for(Lt=In=Pt.length,In&&Pt.push(w);Lt<hn;){for(pe=g,Ne=0;Ne<hn;++Ne)ze=Fe[Ne],ze>=$e&&ze<pe&&(pe=ze);for(ae=Lt+1,pe-$e>j((g-Cn)/ae)&&F("overflow"),Cn+=(pe-$e)*ae,$e=pe,Ne=0;Ne<hn;++Ne)if(ze=Fe[Ne],ze<$e&&++Cn>g&&F("overflow"),ze==$e){for(At=Cn,Ve=v;xe=Ve<=Et?y:Ve>=Et+A?A:Ve-Et,!(At<xe);Ve+=v)re=At-xe,le=v-xe,Pt.push(oe(ie(xe+re%le,0))),At=j(re/le);Pt.push(oe(ie(At,0))),Et=Y(Cn,ae,Lt==In),Cn=0,++Lt}++Cn,++$e}return Pt.join("")}function kt(Fe){return ue(Fe,function($e){return x.test($e)?Ie($e.slice(4).toLowerCase()):$e})}function Dt(Fe){return ue(Fe,function($e){return k.test($e)?"xn--"+Oe($e):$e})}if(h={version:"1.4.1",ucs2:{decode:_e,encode:Ce},decode:Ie,encode:Oe,toASCII:Dt,toUnicode:kt},f&&d)if(o.exports==f)d.exports=h;else for(L in h)h.hasOwnProperty(L)&&(f[L]=h[L]);else c.punycode=h})(this)}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],52:[function(i,o,a){function u(f,d){return Object.prototype.hasOwnProperty.call(f,d)}o.exports=function(f,d,p,h){d=d||"&",p=p||"=";var g={};if(typeof f!="string"||f.length===0)return g;var v=/\+/g;f=f.split(d);var y=1e3;h&&typeof h.maxKeys=="number"&&(y=h.maxKeys);var A=f.length;y>0&&A>y&&(A=y);for(var _=0;_<A;++_){var S=f[_].replace(v,"%20"),b=S.indexOf(p),T,w,x,k;b>=0?(T=S.substr(0,b),w=S.substr(b+1)):(T=S,w=""),x=decodeURIComponent(T),k=decodeURIComponent(w),u(g,x)?c(g[x])?g[x].push(k):g[x]=[g[x],k]:g[x]=k}return g};var c=Array.isArray||function(f){return Object.prototype.toString.call(f)==="[object Array]"}},{}],53:[function(i,o,a){var u=function(p){switch(typeof p){case"string":return p;case"boolean":return p?"true":"false";case"number":return isFinite(p)?p:"";default:return""}};o.exports=function(p,h,g,v){return h=h||"&",g=g||"=",p===null&&(p=void 0),typeof p=="object"?f(d(p),function(y){var A=encodeURIComponent(u(y))+g;return c(p[y])?f(p[y],function(_){return A+encodeURIComponent(u(_))}).join(h):A+encodeURIComponent(u(p[y]))}).join(h):v?encodeURIComponent(u(v))+g+encodeURIComponent(u(p)):""};var c=Array.isArray||function(p){return Object.prototype.toString.call(p)==="[object Array]"};function f(p,h){if(p.map)return p.map(h);for(var g=[],v=0;v<p.length;v++)g.push(h(p[v],v));return g}var d=Object.keys||function(p){var h=[];for(var g in p)Object.prototype.hasOwnProperty.call(p,g)&&h.push(g);return h}},{}],54:[function(i,o,a){a.decode=a.parse=i("./decode"),a.encode=a.stringify=i("./encode")},{"./decode":52,"./encode":53}],55:[function(i,o,a){function u(v,y){v.prototype=Object.create(y.prototype),v.prototype.constructor=v,v.__proto__=y}var c={};function f(v,y,A){A||(A=Error);function _(b,T,w){return typeof y=="string"?y:y(b,T,w)}var S=function(b){u(T,b);function T(w,x,k){return b.call(this,_(w,x,k))||this}return T}(A);S.prototype.name=A.name,S.prototype.code=v,c[v]=S}function d(v,y){if(Array.isArray(v)){var A=v.length;return v=v.map(function(_){return String(_)}),A>2?"one of ".concat(y," ").concat(v.slice(0,A-1).join(", "),", or ")+v[A-1]:A===2?"one of ".concat(y," ").concat(v[0]," or ").concat(v[1]):"of ".concat(y," ").concat(v[0])}else return"of ".concat(y," ").concat(String(v))}function p(v,y,A){return v.substr(!A||A<0?0:+A,y.length)===y}function h(v,y,A){return(A===void 0||A>v.length)&&(A=v.length),v.substring(A-y.length,A)===y}function g(v,y,A){return typeof A!="number"&&(A=0),A+y.length>v.length?!1:v.indexOf(y,A)!==-1}f("ERR_INVALID_OPT_VALUE",function(v,y){return'The value "'+y+'" is invalid for option "'+v+'"'},TypeError),f("ERR_INVALID_ARG_TYPE",function(v,y,A){var _;typeof y=="string"&&p(y,"not ")?(_="must not be",y=y.replace(/^not /,"")):_="must be";var S;if(h(v," argument"))S="The ".concat(v," ").concat(_," ").concat(d(y,"type"));else{var b=g(v,".")?"property":"argument";S='The "'.concat(v,'" ').concat(b," ").concat(_," ").concat(d(y,"type"))}return S+=". Received type ".concat(typeof A),S},TypeError),f("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),f("ERR_METHOD_NOT_IMPLEMENTED",function(v){return"The "+v+" method is not implemented"}),f("ERR_STREAM_PREMATURE_CLOSE","Premature close"),f("ERR_STREAM_DESTROYED",function(v){return"Cannot call "+v+" after a stream was destroyed"}),f("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),f("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),f("ERR_STREAM_WRITE_AFTER_END","write after end"),f("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),f("ERR_UNKNOWN_ENCODING",function(v){return"Unknown encoding: "+v},TypeError),f("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),o.exports.codes=c},{}],56:[function(i,o,a){(function(u){(function(){var c=Object.keys||function(_){var S=[];for(var b in _)S.push(b);return S};o.exports=v;var f=i("./_stream_readable"),d=i("./_stream_writable");i("inherits")(v,f);for(var p=c(d.prototype),h=0;h<p.length;h++){var g=p[h];v.prototype[g]||(v.prototype[g]=d.prototype[g])}function v(_){if(!(this instanceof v))return new v(_);f.call(this,_),d.call(this,_),this.allowHalfOpen=!0,_&&(_.readable===!1&&(this.readable=!1),_.writable===!1&&(this.writable=!1),_.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",y)))}Object.defineProperty(v.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(v.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(v.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function y(){this._writableState.ended||u.nextTick(A,this)}function A(_){_.end()}Object.defineProperty(v.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(S){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=S,this._writableState.destroyed=S)}})}).call(this)}).call(this,i("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(i,o,a){o.exports=c;var u=i("./_stream_transform");i("inherits")(c,u);function c(f){if(!(this instanceof c))return new c(f);u.call(this,f)}c.prototype._transform=function(f,d,p){p(null,f)}},{"./_stream_transform":59,inherits:24}],58:[function(i,o,a){(function(u,c){(function(){o.exports=Ce;var f;Ce.ReadableState=_e,i("events").EventEmitter;var d=function(le,re){return le.listeners(re).length},p=i("./internal/streams/stream"),h=i("buffer").Buffer,g=c.Uint8Array||function(){};function v(ae){return h.from(ae)}function y(ae){return h.isBuffer(ae)||ae instanceof g}var A=i("util"),_;A&&A.debuglog?_=A.debuglog("stream"):_=function(){};var S=i("./internal/streams/buffer_list"),b=i("./internal/streams/destroy"),T=i("./internal/streams/state"),w=T.getHighWaterMark,x=i("../errors").codes,k=x.ERR_INVALID_ARG_TYPE,M=x.ERR_STREAM_PUSH_AFTER_EOF,D=x.ERR_METHOD_NOT_IMPLEMENTED,z=x.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,j,oe,L;i("inherits")(Ce,p);var F=b.errorOrDestroy,O=["error","close","destroy","pause","resume"];function ue(ae,le,re){if(typeof ae.prependListener=="function")return ae.prependListener(le,re);!ae._events||!ae._events[le]?ae.on(le,re):Array.isArray(ae._events[le])?ae._events[le].unshift(re):ae._events[le]=[re,ae._events[le]]}function _e(ae,le,re){f=f||i("./_stream_duplex"),ae=ae||{},typeof re!="boolean"&&(re=le instanceof f),this.objectMode=!!ae.objectMode,re&&(this.objectMode=this.objectMode||!!ae.readableObjectMode),this.highWaterMark=w(this,ae,"readableHighWaterMark",re),this.buffer=new S,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=ae.emitClose!==!1,this.autoDestroy=!!ae.autoDestroy,this.destroyed=!1,this.defaultEncoding=ae.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,ae.encoding&&(j||(j=i("string_decoder/").StringDecoder),this.decoder=new j(ae.encoding),this.encoding=ae.encoding)}function Ce(ae){if(f=f||i("./_stream_duplex"),!(this instanceof Ce))return new Ce(ae);var le=this instanceof f;this._readableState=new _e(ae,this,le),this.readable=!0,ae&&(typeof ae.read=="function"&&(this._read=ae.read),typeof ae.destroy=="function"&&(this._destroy=ae.destroy)),p.call(this)}Object.defineProperty(Ce.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(le){this._readableState&&(this._readableState.destroyed=le)}}),Ce.prototype.destroy=b.destroy,Ce.prototype._undestroy=b.undestroy,Ce.prototype._destroy=function(ae,le){le(ae)},Ce.prototype.push=function(ae,le){var re=this._readableState,V;return re.objectMode?V=!0:typeof ae=="string"&&(le=le||re.defaultEncoding,le!==re.encoding&&(ae=h.from(ae,le),le=""),V=!0),de(this,ae,le,!1,V)},Ce.prototype.unshift=function(ae){return de(this,ae,null,!0,!1)};function de(ae,le,re,V,$){_("readableAddChunk",le);var he=ae._readableState;if(le===null)he.reading=!1,Dt(ae,he);else{var Ue;if($||(Ue=Y(he,le)),Ue)F(ae,Ue);else if(he.objectMode||le&&le.length>0)if(typeof le!="string"&&!he.objectMode&&Object.getPrototypeOf(le)!==h.prototype&&(le=v(le)),V)he.endEmitted?F(ae,new z):ie(ae,he,le,!0);else if(he.ended)F(ae,new M);else{if(he.destroyed)return!1;he.reading=!1,he.decoder&&!re?(le=he.decoder.write(le),he.objectMode||le.length!==0?ie(ae,he,le,!1):Cn(ae,he)):ie(ae,he,le,!1)}else V||(he.reading=!1,Cn(ae,he))}return!he.ended&&(he.length<he.highWaterMark||he.length===0)}function ie(ae,le,re,V){le.flowing&&le.length===0&&!le.sync?(le.awaitDrain=0,ae.emit("data",re)):(le.length+=le.objectMode?1:re.length,V?le.buffer.unshift(re):le.buffer.push(re),le.needReadable&&Fe(ae)),Cn(ae,le)}function Y(ae,le){var re;return!y(le)&&typeof le!="string"&&le!==void 0&&!ae.objectMode&&(re=new k("chunk",["string","Buffer","Uint8Array"],le)),re}Ce.prototype.isPaused=function(){return this._readableState.flowing===!1},Ce.prototype.setEncoding=function(ae){j||(j=i("string_decoder/").StringDecoder);var le=new j(ae);this._readableState.decoder=le,this._readableState.encoding=this._readableState.decoder.encoding;for(var re=this._readableState.buffer.head,V="";re!==null;)V+=le.write(re.data),re=re.next;return this._readableState.buffer.clear(),V!==""&&this._readableState.buffer.push(V),this._readableState.length=V.length,this};var Ie=1073741824;function Oe(ae){return ae>=Ie?ae=Ie:(ae--,ae|=ae>>>1,ae|=ae>>>2,ae|=ae>>>4,ae|=ae>>>8,ae|=ae>>>16,ae++),ae}function kt(ae,le){return ae<=0||le.length===0&&le.ended?0:le.objectMode?1:ae!==ae?le.flowing&&le.length?le.buffer.head.data.length:le.length:(ae>le.highWaterMark&&(le.highWaterMark=Oe(ae)),ae<=le.length?ae:le.ended?le.length:(le.needReadable=!0,0))}Ce.prototype.read=function(ae){_("read",ae),ae=parseInt(ae,10);var le=this._readableState,re=ae;if(ae!==0&&(le.emittedReadable=!1),ae===0&&le.needReadable&&((le.highWaterMark!==0?le.length>=le.highWaterMark:le.length>0)||le.ended))return _("read: emitReadable",le.length,le.ended),le.length===0&&le.ended?ze(this):Fe(this),null;if(ae=kt(ae,le),ae===0&&le.ended)return le.length===0&&ze(this),null;var V=le.needReadable;_("need readable",V),(le.length===0||le.length-ae<le.highWaterMark)&&(V=!0,_("length less than watermark",V)),le.ended||le.reading?(V=!1,_("reading or ended",V)):V&&(_("do read"),le.reading=!0,le.sync=!0,le.length===0&&(le.needReadable=!0),this._read(le.highWaterMark),le.sync=!1,le.reading||(ae=kt(re,le)));var $;return ae>0?$=xe(ae,le):$=null,$===null?(le.needReadable=le.length<=le.highWaterMark,ae=0):(le.length-=ae,le.awaitDrain=0),le.length===0&&(le.ended||(le.needReadable=!0),re!==ae&&le.ended&&ze(this)),$!==null&&this.emit("data",$),$};function Dt(ae,le){if(_("onEofChunk"),!le.ended){if(le.decoder){var re=le.decoder.end();re&&re.length&&(le.buffer.push(re),le.length+=le.objectMode?1:re.length)}le.ended=!0,le.sync?Fe(ae):(le.needReadable=!1,le.emittedReadable||(le.emittedReadable=!0,$e(ae)))}}function Fe(ae){var le=ae._readableState;_("emitReadable",le.needReadable,le.emittedReadable),le.needReadable=!1,le.emittedReadable||(_("emitReadable",le.flowing),le.emittedReadable=!0,u.nextTick($e,ae))}function $e(ae){var le=ae._readableState;_("emitReadable_",le.destroyed,le.length,le.ended),!le.destroyed&&(le.length||le.ended)&&(ae.emit("readable"),le.emittedReadable=!1),le.needReadable=!le.flowing&&!le.ended&&le.length<=le.highWaterMark,Ve(ae)}function Cn(ae,le){le.readingMore||(le.readingMore=!0,u.nextTick(Lt,ae,le))}function Lt(ae,le){for(;!le.reading&&!le.ended&&(le.length<le.highWaterMark||le.flowing&&le.length===0);){var re=le.length;if(_("maybeReadMore read 0"),ae.read(0),re===le.length)break}le.readingMore=!1}Ce.prototype._read=function(ae){F(this,new D("_read()"))},Ce.prototype.pipe=function(ae,le){var re=this,V=this._readableState;switch(V.pipesCount){case 0:V.pipes=ae;break;case 1:V.pipes=[V.pipes,ae];break;default:V.pipes.push(ae);break}V.pipesCount+=1,_("pipe count=%d opts=%j",V.pipesCount,le);var $=(!le||le.end!==!1)&&ae!==u.stdout&&ae!==u.stderr,he=$?qe:kn;V.endEmitted?u.nextTick(he):re.once("end",he),ae.on("unpipe",Ue);function Ue(Rn,Nn){_("onunpipe"),Rn===re&&Nn&&Nn.hasUnpiped===!1&&(Nn.hasUnpiped=!0,wn())}function qe(){_("onend"),ae.end()}var jt=In(re);ae.on("drain",jt);var An=!1;function wn(){_("cleanup"),ae.removeListener("close",Tn),ae.removeListener("finish",Pn),ae.removeListener("drain",jt),ae.removeListener("error",xn),ae.removeListener("unpipe",Ue),re.removeListener("end",qe),re.removeListener("end",kn),re.removeListener("data",En),An=!0,V.awaitDrain&&(!ae._writableState||ae._writableState.needDrain)&&jt()}re.on("data",En);function En(Rn){_("ondata");var Nn=ae.write(Rn);_("dest.write",Nn),Nn===!1&&((V.pipesCount===1&&V.pipes===ae||V.pipesCount>1&&hn(V.pipes,ae)!==-1)&&!An&&(_("false write response, pause",V.awaitDrain),V.awaitDrain++),re.pause())}function xn(Rn){_("onerror",Rn),kn(),ae.removeListener("error",xn),d(ae,"error")===0&&F(ae,Rn)}ue(ae,"error",xn);function Tn(){ae.removeListener("finish",Pn),kn()}ae.once("close",Tn);function Pn(){_("onfinish"),ae.removeListener("close",Tn),kn()}ae.once("finish",Pn);function kn(){_("unpipe"),re.unpipe(ae)}return ae.emit("pipe",re),V.flowing||(_("pipe resume"),re.resume()),ae};function In(ae){return function(){var re=ae._readableState;_("pipeOnDrain",re.awaitDrain),re.awaitDrain&&re.awaitDrain--,re.awaitDrain===0&&d(ae,"data")&&(re.flowing=!0,Ve(ae))}}Ce.prototype.unpipe=function(ae){var le=this._readableState,re={hasUnpiped:!1};if(le.pipesCount===0)return this;if(le.pipesCount===1)return ae&&ae!==le.pipes?this:(ae||(ae=le.pipes),le.pipes=null,le.pipesCount=0,le.flowing=!1,ae&&ae.emit("unpipe",this,re),this);if(!ae){var V=le.pipes,$=le.pipesCount;le.pipes=null,le.pipesCount=0,le.flowing=!1;for(var he=0;he<$;he++)V[he].emit("unpipe",this,{hasUnpiped:!1});return this}var Ue=hn(le.pipes,ae);return Ue===-1?this:(le.pipes.splice(Ue,1),le.pipesCount-=1,le.pipesCount===1&&(le.pipes=le.pipes[0]),ae.emit("unpipe",this,re),this)},Ce.prototype.on=function(ae,le){var re=p.prototype.on.call(this,ae,le),V=this._readableState;return ae==="data"?(V.readableListening=this.listenerCount("readable")>0,V.flowing!==!1&&this.resume()):ae==="readable"&&!V.endEmitted&&!V.readableListening&&(V.readableListening=V.needReadable=!0,V.flowing=!1,V.emittedReadable=!1,_("on readable",V.length,V.reading),V.length?Fe(this):V.reading||u.nextTick(Ne,this)),re},Ce.prototype.addListener=Ce.prototype.on,Ce.prototype.removeListener=function(ae,le){var re=p.prototype.removeListener.call(this,ae,le);return ae==="readable"&&u.nextTick(Et,this),re},Ce.prototype.removeAllListeners=function(ae){var le=p.prototype.removeAllListeners.apply(this,arguments);return(ae==="readable"||ae===void 0)&&u.nextTick(Et,this),le};function Et(ae){var le=ae._readableState;le.readableListening=ae.listenerCount("readable")>0,le.resumeScheduled&&!le.paused?le.flowing=!0:ae.listenerCount("data")>0&&ae.resume()}function Ne(ae){_("readable nexttick read 0"),ae.read(0)}Ce.prototype.resume=function(){var ae=this._readableState;return ae.flowing||(_("resume"),ae.flowing=!ae.readableListening,pe(this,ae)),ae.paused=!1,this};function pe(ae,le){le.resumeScheduled||(le.resumeScheduled=!0,u.nextTick(At,ae,le))}function At(ae,le){_("resume",le.reading),le.reading||ae.read(0),le.resumeScheduled=!1,ae.emit("resume"),Ve(ae),le.flowing&&!le.reading&&ae.read(0)}Ce.prototype.pause=function(){return _("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(_("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Ve(ae){var le=ae._readableState;for(_("flow",le.flowing);le.flowing&&ae.read()!==null;);}Ce.prototype.wrap=function(ae){var le=this,re=this._readableState,V=!1;ae.on("end",function(){if(_("wrapped end"),re.decoder&&!re.ended){var Ue=re.decoder.end();Ue&&Ue.length&&le.push(Ue)}le.push(null)}),ae.on("data",function(Ue){if(_("wrapped data"),re.decoder&&(Ue=re.decoder.write(Ue)),!(re.objectMode&&Ue==null)&&!(!re.objectMode&&(!Ue||!Ue.length))){var qe=le.push(Ue);qe||(V=!0,ae.pause())}});for(var $ in ae)this[$]===void 0&&typeof ae[$]=="function"&&(this[$]=function(qe){return function(){return ae[qe].apply(ae,arguments)}}($));for(var he=0;he<O.length;he++)ae.on(O[he],this.emit.bind(this,O[he]));return this._read=function(Ue){_("wrapped _read",Ue),V&&(V=!1,ae.resume())},this},typeof Symbol=="function"&&(Ce.prototype[Symbol.asyncIterator]=function(){return oe===void 0&&(oe=i("./internal/streams/async_iterator")),oe(this)}),Object.defineProperty(Ce.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(Ce.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(Ce.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(le){this._readableState&&(this._readableState.flowing=le)}}),Ce._fromList=xe,Object.defineProperty(Ce.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function xe(ae,le){if(le.length===0)return null;var re;return le.objectMode?re=le.buffer.shift():!ae||ae>=le.length?(le.decoder?re=le.buffer.join(""):le.buffer.length===1?re=le.buffer.first():re=le.buffer.concat(le.length),le.buffer.clear()):re=le.buffer.consume(ae,le.decoder),re}function ze(ae){var le=ae._readableState;_("endReadable",le.endEmitted),le.endEmitted||(le.ended=!0,u.nextTick(Pt,le,ae))}function Pt(ae,le){if(_("endReadableNT",ae.endEmitted,ae.length),!ae.endEmitted&&ae.length===0&&(ae.endEmitted=!0,le.readable=!1,le.emit("end"),ae.autoDestroy)){var re=le._writableState;(!re||re.autoDestroy&&re.finished)&&le.destroy()}}typeof Symbol=="function"&&(Ce.from=function(ae,le){return L===void 0&&(L=i("./internal/streams/from")),L(Ce,ae,le)});function hn(ae,le){for(var re=0,V=ae.length;re<V;re++)if(ae[re]===le)return re;return-1}}).call(this)}).call(this,i("_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(i,o,a){o.exports=v;var u=i("../errors").codes,c=u.ERR_METHOD_NOT_IMPLEMENTED,f=u.ERR_MULTIPLE_CALLBACK,d=u.ERR_TRANSFORM_ALREADY_TRANSFORMING,p=u.ERR_TRANSFORM_WITH_LENGTH_0,h=i("./_stream_duplex");i("inherits")(v,h);function g(_,S){var b=this._transformState;b.transforming=!1;var T=b.writecb;if(T===null)return this.emit("error",new f);b.writechunk=null,b.writecb=null,S!=null&&this.push(S),T(_);var w=this._readableState;w.reading=!1,(w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}function v(_){if(!(this instanceof v))return new v(_);h.call(this,_),this._transformState={afterTransform:g.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,_&&(typeof _.transform=="function"&&(this._transform=_.transform),typeof _.flush=="function"&&(this._flush=_.flush)),this.on("prefinish",y)}function y(){var _=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(S,b){A(_,S,b)}):A(this,null,null)}v.prototype.push=function(_,S){return this._transformState.needTransform=!1,h.prototype.push.call(this,_,S)},v.prototype._transform=function(_,S,b){b(new c("_transform()"))},v.prototype._write=function(_,S,b){var T=this._transformState;if(T.writecb=b,T.writechunk=_,T.writeencoding=S,!T.transforming){var w=this._readableState;(T.needTransform||w.needReadable||w.length<w.highWaterMark)&&this._read(w.highWaterMark)}},v.prototype._read=function(_){var S=this._transformState;S.writechunk!==null&&!S.transforming?(S.transforming=!0,this._transform(S.writechunk,S.writeencoding,S.afterTransform)):S.needTransform=!0},v.prototype._destroy=function(_,S){h.prototype._destroy.call(this,_,function(b){S(b)})};function A(_,S,b){if(S)return _.emit("error",S);if(b!=null&&_.push(b),_._writableState.length)throw new p;if(_._transformState.transforming)throw new d;return _.push(null)}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(i,o,a){(function(u,c){(function(){o.exports=_e;function f(Ve){var xe=this;this.next=null,this.entry=null,this.finish=function(){At(xe,Ve)}}var d;_e.WritableState=O;var p={deprecate:i("util-deprecate")},h=i("./internal/streams/stream"),g=i("buffer").Buffer,v=c.Uint8Array||function(){};function y(Ve){return g.from(Ve)}function A(Ve){return g.isBuffer(Ve)||Ve instanceof v}var _=i("./internal/streams/destroy"),S=i("./internal/streams/state"),b=S.getHighWaterMark,T=i("../errors").codes,w=T.ERR_INVALID_ARG_TYPE,x=T.ERR_METHOD_NOT_IMPLEMENTED,k=T.ERR_MULTIPLE_CALLBACK,M=T.ERR_STREAM_CANNOT_PIPE,D=T.ERR_STREAM_DESTROYED,z=T.ERR_STREAM_NULL_VALUES,j=T.ERR_STREAM_WRITE_AFTER_END,oe=T.ERR_UNKNOWN_ENCODING,L=_.errorOrDestroy;i("inherits")(_e,h);function F(){}function O(Ve,xe,ze){d=d||i("./_stream_duplex"),Ve=Ve||{},typeof ze!="boolean"&&(ze=xe instanceof d),this.objectMode=!!Ve.objectMode,ze&&(this.objectMode=this.objectMode||!!Ve.writableObjectMode),this.highWaterMark=b(this,Ve,"writableHighWaterMark",ze),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Pt=Ve.decodeStrings===!1;this.decodeStrings=!Pt,this.defaultEncoding=Ve.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(hn){Dt(xe,hn)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Ve.emitClose!==!1,this.autoDestroy=!!Ve.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new f(this)}O.prototype.getBuffer=function(){for(var xe=this.bufferedRequest,ze=[];xe;)ze.push(xe),xe=xe.next;return ze},function(){try{Object.defineProperty(O.prototype,"buffer",{get:p.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var ue;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(ue=Function.prototype[Symbol.hasInstance],Object.defineProperty(_e,Symbol.hasInstance,{value:function(xe){return ue.call(this,xe)?!0:this!==_e?!1:xe&&xe._writableState instanceof O}})):ue=function(xe){return xe instanceof this};function _e(Ve){d=d||i("./_stream_duplex");var xe=this instanceof d;if(!xe&&!ue.call(_e,this))return new _e(Ve);this._writableState=new O(Ve,this,xe),this.writable=!0,Ve&&(typeof Ve.write=="function"&&(this._write=Ve.write),typeof Ve.writev=="function"&&(this._writev=Ve.writev),typeof Ve.destroy=="function"&&(this._destroy=Ve.destroy),typeof Ve.final=="function"&&(this._final=Ve.final)),h.call(this)}_e.prototype.pipe=function(){L(this,new M)};function Ce(Ve,xe){var ze=new j;L(Ve,ze),u.nextTick(xe,ze)}function de(Ve,xe,ze,Pt){var hn;return ze===null?hn=new z:typeof ze!="string"&&!xe.objectMode&&(hn=new w("chunk",["string","Buffer"],ze)),hn?(L(Ve,hn),u.nextTick(Pt,hn),!1):!0}_e.prototype.write=function(Ve,xe,ze){var Pt=this._writableState,hn=!1,ae=!Pt.objectMode&&A(Ve);return ae&&!g.isBuffer(Ve)&&(Ve=y(Ve)),typeof xe=="function"&&(ze=xe,xe=null),ae?xe="buffer":xe||(xe=Pt.defaultEncoding),typeof ze!="function"&&(ze=F),Pt.ending?Ce(this,ze):(ae||de(this,Pt,Ve,ze))&&(Pt.pendingcb++,hn=Y(this,Pt,ae,Ve,xe,ze)),hn},_e.prototype.cork=function(){this._writableState.corked++},_e.prototype.uncork=function(){var Ve=this._writableState;Ve.corked&&(Ve.corked--,!Ve.writing&&!Ve.corked&&!Ve.bufferProcessing&&Ve.bufferedRequest&&Cn(this,Ve))},_e.prototype.setDefaultEncoding=function(xe){if(typeof xe=="string"&&(xe=xe.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((xe+"").toLowerCase())>-1))throw new oe(xe);return this._writableState.defaultEncoding=xe,this},Object.defineProperty(_e.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ie(Ve,xe,ze){return!Ve.objectMode&&Ve.decodeStrings!==!1&&typeof xe=="string"&&(xe=g.from(xe,ze)),xe}Object.defineProperty(_e.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Y(Ve,xe,ze,Pt,hn,ae){if(!ze){var le=ie(xe,Pt,hn);Pt!==le&&(ze=!0,hn="buffer",Pt=le)}var re=xe.objectMode?1:Pt.length;xe.length+=re;var V=xe.length<xe.highWaterMark;if(V||(xe.needDrain=!0),xe.writing||xe.corked){var $=xe.lastBufferedRequest;xe.lastBufferedRequest={chunk:Pt,encoding:hn,isBuf:ze,callback:ae,next:null},$?$.next=xe.lastBufferedRequest:xe.bufferedRequest=xe.lastBufferedRequest,xe.bufferedRequestCount+=1}else Ie(Ve,xe,!1,re,Pt,hn,ae);return V}function Ie(Ve,xe,ze,Pt,hn,ae,le){xe.writelen=Pt,xe.writecb=le,xe.writing=!0,xe.sync=!0,xe.destroyed?xe.onwrite(new D("write")):ze?Ve._writev(hn,xe.onwrite):Ve._write(hn,ae,xe.onwrite),xe.sync=!1}function Oe(Ve,xe,ze,Pt,hn){--xe.pendingcb,ze?(u.nextTick(hn,Pt),u.nextTick(Ne,Ve,xe),Ve._writableState.errorEmitted=!0,L(Ve,Pt)):(hn(Pt),Ve._writableState.errorEmitted=!0,L(Ve,Pt),Ne(Ve,xe))}function kt(Ve){Ve.writing=!1,Ve.writecb=null,Ve.length-=Ve.writelen,Ve.writelen=0}function Dt(Ve,xe){var ze=Ve._writableState,Pt=ze.sync,hn=ze.writecb;if(typeof hn!="function")throw new k;if(kt(ze),xe)Oe(Ve,ze,Pt,xe,hn);else{var ae=Lt(ze)||Ve.destroyed;!ae&&!ze.corked&&!ze.bufferProcessing&&ze.bufferedRequest&&Cn(Ve,ze),Pt?u.nextTick(Fe,Ve,ze,ae,hn):Fe(Ve,ze,ae,hn)}}function Fe(Ve,xe,ze,Pt){ze||$e(Ve,xe),xe.pendingcb--,Pt(),Ne(Ve,xe)}function $e(Ve,xe){xe.length===0&&xe.needDrain&&(xe.needDrain=!1,Ve.emit("drain"))}function Cn(Ve,xe){xe.bufferProcessing=!0;var ze=xe.bufferedRequest;if(Ve._writev&&ze&&ze.next){var Pt=xe.bufferedRequestCount,hn=new Array(Pt),ae=xe.corkedRequestsFree;ae.entry=ze;for(var le=0,re=!0;ze;)hn[le]=ze,ze.isBuf||(re=!1),ze=ze.next,le+=1;hn.allBuffers=re,Ie(Ve,xe,!0,xe.length,hn,"",ae.finish),xe.pendingcb++,xe.lastBufferedRequest=null,ae.next?(xe.corkedRequestsFree=ae.next,ae.next=null):xe.corkedRequestsFree=new f(xe),xe.bufferedRequestCount=0}else{for(;ze;){var V=ze.chunk,$=ze.encoding,he=ze.callback,Ue=xe.objectMode?1:V.length;if(Ie(Ve,xe,!1,Ue,V,$,he),ze=ze.next,xe.bufferedRequestCount--,xe.writing)break}ze===null&&(xe.lastBufferedRequest=null)}xe.bufferedRequest=ze,xe.bufferProcessing=!1}_e.prototype._write=function(Ve,xe,ze){ze(new x("_write()"))},_e.prototype._writev=null,_e.prototype.end=function(Ve,xe,ze){var Pt=this._writableState;return typeof Ve=="function"?(ze=Ve,Ve=null,xe=null):typeof xe=="function"&&(ze=xe,xe=null),Ve!=null&&this.write(Ve,xe),Pt.corked&&(Pt.corked=1,this.uncork()),Pt.ending||pe(this,Pt,ze),this},Object.defineProperty(_e.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Lt(Ve){return Ve.ending&&Ve.length===0&&Ve.bufferedRequest===null&&!Ve.finished&&!Ve.writing}function In(Ve,xe){Ve._final(function(ze){xe.pendingcb--,ze&&L(Ve,ze),xe.prefinished=!0,Ve.emit("prefinish"),Ne(Ve,xe)})}function Et(Ve,xe){!xe.prefinished&&!xe.finalCalled&&(typeof Ve._final=="function"&&!xe.destroyed?(xe.pendingcb++,xe.finalCalled=!0,u.nextTick(In,Ve,xe)):(xe.prefinished=!0,Ve.emit("prefinish")))}function Ne(Ve,xe){var ze=Lt(xe);if(ze&&(Et(Ve,xe),xe.pendingcb===0&&(xe.finished=!0,Ve.emit("finish"),xe.autoDestroy))){var Pt=Ve._readableState;(!Pt||Pt.autoDestroy&&Pt.endEmitted)&&Ve.destroy()}return ze}function pe(Ve,xe,ze){xe.ending=!0,Ne(Ve,xe),ze&&(xe.finished?u.nextTick(ze):Ve.once("finish",ze)),xe.ended=!0,Ve.writable=!1}function At(Ve,xe,ze){var Pt=Ve.entry;for(Ve.entry=null;Pt;){var hn=Pt.callback;xe.pendingcb--,hn(ze),Pt=Pt.next}xe.corkedRequestsFree.next=Ve}Object.defineProperty(_e.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(xe){this._writableState&&(this._writableState.destroyed=xe)}}),_e.prototype.destroy=_.destroy,_e.prototype._undestroy=_.undestroy,_e.prototype._destroy=function(Ve,xe){xe(Ve)}}).call(this)}).call(this,i("_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(i,o,a){(function(u){(function(){var c;function f(D,z,j){return z in D?Object.defineProperty(D,z,{value:j,enumerable:!0,configurable:!0,writable:!0}):D[z]=j,D}var d=i("./end-of-stream"),p=Symbol("lastResolve"),h=Symbol("lastReject"),g=Symbol("error"),v=Symbol("ended"),y=Symbol("lastPromise"),A=Symbol("handlePromise"),_=Symbol("stream");function S(D,z){return{value:D,done:z}}function b(D){var z=D[p];if(z!==null){var j=D[_].read();j!==null&&(D[y]=null,D[p]=null,D[h]=null,z(S(j,!1)))}}function T(D){u.nextTick(b,D)}function w(D,z){return function(j,oe){D.then(function(){if(z[v]){j(S(void 0,!0));return}z[A](j,oe)},oe)}}var x=Object.getPrototypeOf(function(){}),k=Object.setPrototypeOf((c={get stream(){return this[_]},next:function(){var z=this,j=this[g];if(j!==null)return Promise.reject(j);if(this[v])return Promise.resolve(S(void 0,!0));if(this[_].destroyed)return new Promise(function(O,ue){u.nextTick(function(){z[g]?ue(z[g]):O(S(void 0,!0))})});var oe=this[y],L;if(oe)L=new Promise(w(oe,this));else{var F=this[_].read();if(F!==null)return Promise.resolve(S(F,!1));L=new Promise(this[A])}return this[y]=L,L}},f(c,Symbol.asyncIterator,function(){return this}),f(c,"return",function(){var z=this;return new Promise(function(j,oe){z[_].destroy(null,function(L){if(L){oe(L);return}j(S(void 0,!0))})})}),c),x),M=function(z){var j,oe=Object.create(k,(j={},f(j,_,{value:z,writable:!0}),f(j,p,{value:null,writable:!0}),f(j,h,{value:null,writable:!0}),f(j,g,{value:null,writable:!0}),f(j,v,{value:z._readableState.endEmitted,writable:!0}),f(j,A,{value:function(F,O){var ue=oe[_].read();ue?(oe[y]=null,oe[p]=null,oe[h]=null,F(S(ue,!1))):(oe[p]=F,oe[h]=O)},writable:!0}),j));return oe[y]=null,d(z,function(L){if(L&&L.code!=="ERR_STREAM_PREMATURE_CLOSE"){var F=oe[h];F!==null&&(oe[y]=null,oe[p]=null,oe[h]=null,F(L)),oe[g]=L;return}var O=oe[p];O!==null&&(oe[y]=null,oe[p]=null,oe[h]=null,O(S(void 0,!0))),oe[v]=!0}),z.on("readable",T.bind(null,oe)),oe};o.exports=M}).call(this)}).call(this,i("_process"))},{"./end-of-stream":64,_process:50}],62:[function(i,o,a){function u(b,T){var w=Object.keys(b);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(b);T&&(x=x.filter(function(k){return Object.getOwnPropertyDescriptor(b,k).enumerable})),w.push.apply(w,x)}return w}function c(b){for(var T=1;T<arguments.length;T++){var w=arguments[T]!=null?arguments[T]:{};T%2?u(Object(w),!0).forEach(function(x){f(b,x,w[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(w)):u(Object(w)).forEach(function(x){Object.defineProperty(b,x,Object.getOwnPropertyDescriptor(w,x))})}return b}function f(b,T,w){return T in b?Object.defineProperty(b,T,{value:w,enumerable:!0,configurable:!0,writable:!0}):b[T]=w,b}function d(b,T){if(!(b instanceof T))throw new TypeError("Cannot call a class as a function")}function p(b,T){for(var w=0;w<T.length;w++){var x=T[w];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(b,x.key,x)}}function h(b,T,w){return T&&p(b.prototype,T),w&&p(b,w),b}var g=i("buffer"),v=g.Buffer,y=i("util"),A=y.inspect,_=A&&A.custom||"inspect";function S(b,T,w){v.prototype.copy.call(b,T,w)}o.exports=function(){function b(){d(this,b),this.head=null,this.tail=null,this.length=0}return h(b,[{key:"push",value:function(w){var x={data:w,next:null};this.length>0?this.tail.next=x:this.head=x,this.tail=x,++this.length}},{key:"unshift",value:function(w){var x={data:w,next:this.head};this.length===0&&(this.tail=x),this.head=x,++this.length}},{key:"shift",value:function(){if(this.length!==0){var w=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,w}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(w){if(this.length===0)return"";for(var x=this.head,k=""+x.data;x=x.next;)k+=w+x.data;return k}},{key:"concat",value:function(w){if(this.length===0)return v.alloc(0);for(var x=v.allocUnsafe(w>>>0),k=this.head,M=0;k;)S(k.data,x,M),M+=k.data.length,k=k.next;return x}},{key:"consume",value:function(w,x){var k;return w<this.head.data.length?(k=this.head.data.slice(0,w),this.head.data=this.head.data.slice(w)):w===this.head.data.length?k=this.shift():k=x?this._getString(w):this._getBuffer(w),k}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(w){var x=this.head,k=1,M=x.data;for(w-=M.length;x=x.next;){var D=x.data,z=w>D.length?D.length:w;if(z===D.length?M+=D:M+=D.slice(0,w),w-=z,w===0){z===D.length?(++k,x.next?this.head=x.next:this.head=this.tail=null):(this.head=x,x.data=D.slice(z));break}++k}return this.length-=k,M}},{key:"_getBuffer",value:function(w){var x=v.allocUnsafe(w),k=this.head,M=1;for(k.data.copy(x),w-=k.data.length;k=k.next;){var D=k.data,z=w>D.length?D.length:w;if(D.copy(x,x.length-w,0,z),w-=z,w===0){z===D.length?(++M,k.next?this.head=k.next:this.head=this.tail=null):(this.head=k,k.data=D.slice(z));break}++M}return this.length-=M,x}},{key:_,value:function(w,x){return A(this,c({},x,{depth:0,customInspect:!1}))}}]),b}()},{buffer:17,util:16}],63:[function(i,o,a){(function(u){(function(){function c(v,y){var A=this,_=this._readableState&&this._readableState.destroyed,S=this._writableState&&this._writableState.destroyed;return _||S?(y?y(v):v&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,u.nextTick(h,this,v)):u.nextTick(h,this,v)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(v||null,function(b){!y&&b?A._writableState?A._writableState.errorEmitted?u.nextTick(d,A):(A._writableState.errorEmitted=!0,u.nextTick(f,A,b)):u.nextTick(f,A,b):y?(u.nextTick(d,A),y(b)):u.nextTick(d,A)}),this)}function f(v,y){h(v,y),d(v)}function d(v){v._writableState&&!v._writableState.emitClose||v._readableState&&!v._readableState.emitClose||v.emit("close")}function p(){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 h(v,y){v.emit("error",y)}function g(v,y){var A=v._readableState,_=v._writableState;A&&A.autoDestroy||_&&_.autoDestroy?v.destroy(y):v.emit("error",y)}o.exports={destroy:c,undestroy:p,errorOrDestroy:g}}).call(this)}).call(this,i("_process"))},{_process:50}],64:[function(i,o,a){var u=i("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function c(h){var g=!1;return function(){if(!g){g=!0;for(var v=arguments.length,y=new Array(v),A=0;A<v;A++)y[A]=arguments[A];h.apply(this,y)}}}function f(){}function d(h){return h.setHeader&&typeof h.abort=="function"}function p(h,g,v){if(typeof g=="function")return p(h,null,g);g||(g={}),v=c(v||f);var y=g.readable||g.readable!==!1&&h.readable,A=g.writable||g.writable!==!1&&h.writable,_=function(){h.writable||b()},S=h._writableState&&h._writableState.finished,b=function(){A=!1,S=!0,y||v.call(h)},T=h._readableState&&h._readableState.endEmitted,w=function(){y=!1,T=!0,A||v.call(h)},x=function(z){v.call(h,z)},k=function(){var z;if(y&&!T)return(!h._readableState||!h._readableState.ended)&&(z=new u),v.call(h,z);if(A&&!S)return(!h._writableState||!h._writableState.ended)&&(z=new u),v.call(h,z)},M=function(){h.req.on("finish",b)};return d(h)?(h.on("complete",b),h.on("abort",k),h.req?M():h.on("request",M)):A&&!h._writableState&&(h.on("end",_),h.on("close",_)),h.on("end",w),h.on("finish",b),g.error!==!1&&h.on("error",x),h.on("close",k),function(){h.removeListener("complete",b),h.removeListener("abort",k),h.removeListener("request",M),h.req&&h.req.removeListener("finish",b),h.removeListener("end",_),h.removeListener("close",_),h.removeListener("finish",b),h.removeListener("end",w),h.removeListener("error",x),h.removeListener("close",k)}}o.exports=p},{"../../../errors":55}],65:[function(i,o,a){o.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(i,o,a){var u;function c(b){var T=!1;return function(){T||(T=!0,b.apply(void 0,arguments))}}var f=i("../../../errors").codes,d=f.ERR_MISSING_ARGS,p=f.ERR_STREAM_DESTROYED;function h(b){if(b)throw b}function g(b){return b.setHeader&&typeof b.abort=="function"}function v(b,T,w,x){x=c(x);var k=!1;b.on("close",function(){k=!0}),u===void 0&&(u=i("./end-of-stream")),u(b,{readable:T,writable:w},function(D){if(D)return x(D);k=!0,x()});var M=!1;return function(D){if(!k&&!M){if(M=!0,g(b))return b.abort();if(typeof b.destroy=="function")return b.destroy();x(D||new p("pipe"))}}}function y(b){b()}function A(b,T){return b.pipe(T)}function _(b){return!b.length||typeof b[b.length-1]!="function"?h:b.pop()}function S(){for(var b=arguments.length,T=new Array(b),w=0;w<b;w++)T[w]=arguments[w];var x=_(T);if(Array.isArray(T[0])&&(T=T[0]),T.length<2)throw new d("streams");var k,M=T.map(function(D,z){var j=z<T.length-1,oe=z>0;return v(D,j,oe,function(L){k||(k=L),L&&M.forEach(y),!j&&(M.forEach(y),x(k))})});return T.reduce(A)}o.exports=S},{"../../../errors":55,"./end-of-stream":64}],67:[function(i,o,a){var u=i("../../../errors").codes.ERR_INVALID_OPT_VALUE;function c(d,p,h){return d.highWaterMark!=null?d.highWaterMark:p?d[h]:null}function f(d,p,h,g){var v=c(p,g,h);if(v!=null){if(!(isFinite(v)&&Math.floor(v)===v)||v<0){var y=g?h:"highWaterMark";throw new u(y,v)}return Math.floor(v)}return d.objectMode?16:16*1024}o.exports={getHighWaterMark:f}},{"../../../errors":55}],68:[function(i,o,a){o.exports=i("events").EventEmitter},{events:22}],69:[function(i,o,a){a=o.exports=i("./lib/_stream_readable.js"),a.Stream=a,a.Readable=a,a.Writable=i("./lib/_stream_writable.js"),a.Duplex=i("./lib/_stream_duplex.js"),a.Transform=i("./lib/_stream_transform.js"),a.PassThrough=i("./lib/_stream_passthrough.js"),a.finished=i("./lib/internal/streams/end-of-stream.js"),a.pipeline=i("./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(i,o,a){function u(f,d,p){var h=this;this._callback=f,this._args=p,this._interval=setInterval(f,d,this._args),this.reschedule=function(g){g||(g=h._interval),h._interval&&clearInterval(h._interval),h._interval=setInterval(h._callback,g,h._args)},this.clear=function(){h._interval&&(clearInterval(h._interval),h._interval=void 0)},this.destroy=function(){h._interval&&clearInterval(h._interval),h._callback=void 0,h._interval=void 0,h._args=void 0}}function c(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("interval needed");var f;if(arguments.length>0){f=new Array(arguments.length-2);for(var d=0;d<f.length;d++)f[d]=arguments[d+2]}return new u(arguments[0],arguments[1],f)}o.exports=c},{}],71:[function(i,o,a){o.exports=i("./index.js")()},{"./index.js":72}],72:[function(i,o,a){(function(u){(function(){o.exports=f;function c(p){return p instanceof u?u.from(p):new p.constructor(p.buffer.slice(),p.byteOffset,p.length)}function f(p){if(p=p||{},p.circles)return d(p);return p.proto?v:g;function h(y,A){for(var _=Object.keys(y),S=new Array(_.length),b=0;b<_.length;b++){var T=_[b],w=y[T];typeof w!="object"||w===null?S[T]=w:w instanceof Date?S[T]=new Date(w):ArrayBuffer.isView(w)?S[T]=c(w):S[T]=A(w)}return S}function g(y){if(typeof y!="object"||y===null)return y;if(y instanceof Date)return new Date(y);if(Array.isArray(y))return h(y,g);if(y instanceof Map)return new Map(h(Array.from(y),g));if(y instanceof Set)return new Set(h(Array.from(y),g));var A={};for(var _ in y)if(Object.hasOwnProperty.call(y,_)!==!1){var S=y[_];typeof S!="object"||S===null?A[_]=S:S instanceof Date?A[_]=new Date(S):S instanceof Map?A[_]=new Map(h(Array.from(S),g)):S instanceof Set?A[_]=new Set(h(Array.from(S),g)):ArrayBuffer.isView(S)?A[_]=c(S):A[_]=g(S)}return A}function v(y){if(typeof y!="object"||y===null)return y;if(y instanceof Date)return new Date(y);if(Array.isArray(y))return h(y,v);if(y instanceof Map)return new Map(h(Array.from(y),v));if(y instanceof Set)return new Set(h(Array.from(y),v));var A={};for(var _ in y){var S=y[_];typeof S!="object"||S===null?A[_]=S:S instanceof Date?A[_]=new Date(S):S instanceof Map?A[_]=new Map(h(Array.from(S),v)):S instanceof Set?A[_]=new Set(h(Array.from(S),v)):ArrayBuffer.isView(S)?A[_]=c(S):A[_]=v(S)}return A}}function d(p){var h=[],g=[];return p.proto?A:y;function v(_,S){for(var b=Object.keys(_),T=new Array(b.length),w=0;w<b.length;w++){var x=b[w],k=_[x];if(typeof k!="object"||k===null)T[x]=k;else if(k instanceof Date)T[x]=new Date(k);else if(ArrayBuffer.isView(k))T[x]=c(k);else{var M=h.indexOf(k);M!==-1?T[x]=g[M]:T[x]=S(k)}}return T}function y(_){if(typeof _!="object"||_===null)return _;if(_ instanceof Date)return new Date(_);if(Array.isArray(_))return v(_,y);if(_ instanceof Map)return new Map(v(Array.from(_),y));if(_ instanceof Set)return new Set(v(Array.from(_),y));var S={};h.push(_),g.push(S);for(var b in _)if(Object.hasOwnProperty.call(_,b)!==!1){var T=_[b];if(typeof T!="object"||T===null)S[b]=T;else if(T instanceof Date)S[b]=new Date(T);else if(T instanceof Map)S[b]=new Map(v(Array.from(T),y));else if(T instanceof Set)S[b]=new Set(v(Array.from(T),y));else if(ArrayBuffer.isView(T))S[b]=c(T);else{var w=h.indexOf(T);w!==-1?S[b]=g[w]:S[b]=y(T)}}return h.pop(),g.pop(),S}function A(_){if(typeof _!="object"||_===null)return _;if(_ instanceof Date)return new Date(_);if(Array.isArray(_))return v(_,A);if(_ instanceof Map)return new Map(v(Array.from(_),A));if(_ instanceof Set)return new Set(v(Array.from(_),A));var S={};h.push(_),g.push(S);for(var b in _){var T=_[b];if(typeof T!="object"||T===null)S[b]=T;else if(T instanceof Date)S[b]=new Date(T);else if(T instanceof Map)S[b]=new Map(v(Array.from(T),A));else if(T instanceof Set)S[b]=new Set(v(Array.from(T),A));else if(ArrayBuffer.isView(T))S[b]=c(T);else{var w=h.indexOf(T);w!==-1?S[b]=g[w]:S[b]=A(T)}}return h.pop(),g.pop(),S}}}).call(this)}).call(this,i("buffer").Buffer)},{buffer:17}],73:[function(i,o,a){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var u=i("buffer"),c=u.Buffer;function f(p,h){for(var g in p)h[g]=p[g]}c.from&&c.alloc&&c.allocUnsafe&&c.allocUnsafeSlow?o.exports=u:(f(u,a),a.Buffer=d);function d(p,h,g){return c(p,h,g)}d.prototype=Object.create(c.prototype),f(c,d),d.from=function(p,h,g){if(typeof p=="number")throw new TypeError("Argument must not be a number");return c(p,h,g)},d.alloc=function(p,h,g){if(typeof p!="number")throw new TypeError("Argument must be a number");var v=c(p);return h!==void 0?typeof g=="string"?v.fill(h,g):v.fill(h):v.fill(0),v},d.allocUnsafe=function(p){if(typeof p!="number")throw new TypeError("Argument must be a number");return c(p)},d.allocUnsafeSlow=function(p){if(typeof p!="number")throw new TypeError("Argument must be a number");return u.SlowBuffer(p)}},{buffer:17}],74:[function(i,o,a){o.exports=u;function u(f){var d=f._readableState;return d?d.objectMode||typeof f._duplexState=="number"?f.read():f.read(c(d)):null}function c(f){return f.buffer.length?f.buffer.head?f.buffer.head.data.length:f.buffer[0].length:f.length}},{}],75:[function(i,o,a){var u=i("safe-buffer").Buffer,c=u.isEncoding||function(M){switch(M=""+M,M&&M.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 f(M){if(!M)return"utf8";for(var D;;)switch(M){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 M;default:if(D)return;M=(""+M).toLowerCase(),D=!0}}function d(M){var D=f(M);if(typeof D!="string"&&(u.isEncoding===c||!c(M)))throw new Error("Unknown encoding: "+M);return D||M}a.StringDecoder=p;function p(M){this.encoding=d(M);var D;switch(this.encoding){case"utf16le":this.text=S,this.end=b,D=4;break;case"utf8":this.fillLast=y,D=4;break;case"base64":this.text=T,this.end=w,D=3;break;default:this.write=x,this.end=k;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=u.allocUnsafe(D)}p.prototype.write=function(M){if(M.length===0)return"";var D,z;if(this.lastNeed){if(D=this.fillLast(M),D===void 0)return"";z=this.lastNeed,this.lastNeed=0}else z=0;return z<M.length?D?D+this.text(M,z):this.text(M,z):D||""},p.prototype.end=_,p.prototype.text=A,p.prototype.fillLast=function(M){if(this.lastNeed<=M.length)return M.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);M.copy(this.lastChar,this.lastTotal-this.lastNeed,0,M.length),this.lastNeed-=M.length};function h(M){return M<=127?0:M>>5===6?2:M>>4===14?3:M>>3===30?4:M>>6===2?-1:-2}function g(M,D,z){var j=D.length-1;if(j<z)return 0;var oe=h(D[j]);return oe>=0?(oe>0&&(M.lastNeed=oe-1),oe):--j<z||oe===-2?0:(oe=h(D[j]),oe>=0?(oe>0&&(M.lastNeed=oe-2),oe):--j<z||oe===-2?0:(oe=h(D[j]),oe>=0?(oe>0&&(oe===2?oe=0:M.lastNeed=oe-3),oe):0))}function v(M,D,z){if((D[0]&192)!==128)return M.lastNeed=0,"�";if(M.lastNeed>1&&D.length>1){if((D[1]&192)!==128)return M.lastNeed=1,"�";if(M.lastNeed>2&&D.length>2&&(D[2]&192)!==128)return M.lastNeed=2,"�"}}function y(M){var D=this.lastTotal-this.lastNeed,z=v(this,M);if(z!==void 0)return z;if(this.lastNeed<=M.length)return M.copy(this.lastChar,D,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);M.copy(this.lastChar,D,0,M.length),this.lastNeed-=M.length}function A(M,D){var z=g(this,M,D);if(!this.lastNeed)return M.toString("utf8",D);this.lastTotal=z;var j=M.length-(z-this.lastNeed);return M.copy(this.lastChar,0,j),M.toString("utf8",D,j)}function _(M){var D=M&&M.length?this.write(M):"";return this.lastNeed?D+"�":D}function S(M,D){if((M.length-D)%2===0){var z=M.toString("utf16le",D);if(z){var j=z.charCodeAt(z.length-1);if(j>=55296&&j<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=M[M.length-2],this.lastChar[1]=M[M.length-1],z.slice(0,-1)}return z}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=M[M.length-1],M.toString("utf16le",D,M.length-1)}function b(M){var D=M&&M.length?this.write(M):"";if(this.lastNeed){var z=this.lastTotal-this.lastNeed;return D+this.lastChar.toString("utf16le",0,z)}return D}function T(M,D){var z=(M.length-D)%3;return z===0?M.toString("base64",D):(this.lastNeed=3-z,this.lastTotal=3,z===1?this.lastChar[0]=M[M.length-1]:(this.lastChar[0]=M[M.length-2],this.lastChar[1]=M[M.length-1]),M.toString("base64",D,M.length-z))}function w(M){var D=M&&M.length?this.write(M):"";return this.lastNeed?D+this.lastChar.toString("base64",0,3-this.lastNeed):D}function x(M){return M.toString(this.encoding)}function k(M){return M&&M.length?this.write(M):""}},{"safe-buffer":73}],76:[function(i,o,a){var u=i("punycode"),c=i("./util");a.parse=D,a.resolve=j,a.resolveObject=oe,a.format=z,a.Url=f;function f(){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 d=/^([a-z0-9.+-]+:)/i,p=/:[0-9]*$/,h=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,g=["<",">",'"',"`"," ","\r",`
277
- `," "],v=["{","}","|","\\","^","`"].concat(g),y=["'"].concat(v),A=["%","/","?",";","#"].concat(y),_=["/","?","#"],S=255,b=/^[+a-z0-9A-Z_-]{0,63}$/,T=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,w={javascript:!0,"javascript:":!0},x={javascript:!0,"javascript:":!0},k={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},M=i("querystring");function D(L,F,O){if(L&&c.isObject(L)&&L instanceof f)return L;var ue=new f;return ue.parse(L,F,O),ue}f.prototype.parse=function(L,F,O){if(!c.isString(L))throw new TypeError("Parameter 'url' must be a string, not "+typeof L);var ue=L.indexOf("?"),_e=ue!==-1&&ue<L.indexOf("#")?"?":"#",Ce=L.split(_e),de=/\\/g;Ce[0]=Ce[0].replace(de,"/"),L=Ce.join(_e);var ie=L;if(ie=ie.trim(),!O&&L.split("#").length===1){var Y=h.exec(ie);if(Y)return this.path=ie,this.href=ie,this.pathname=Y[1],Y[2]?(this.search=Y[2],F?this.query=M.parse(this.search.substr(1)):this.query=this.search.substr(1)):F&&(this.search="",this.query={}),this}var Ie=d.exec(ie);if(Ie){Ie=Ie[0];var Oe=Ie.toLowerCase();this.protocol=Oe,ie=ie.substr(Ie.length)}if(O||Ie||ie.match(/^\/\/[^@\/]+@[^@\/]+/)){var kt=ie.substr(0,2)==="//";kt&&!(Ie&&x[Ie])&&(ie=ie.substr(2),this.slashes=!0)}if(!x[Ie]&&(kt||Ie&&!k[Ie])){for(var Dt=-1,Fe=0;Fe<_.length;Fe++){var $e=ie.indexOf(_[Fe]);$e!==-1&&(Dt===-1||$e<Dt)&&(Dt=$e)}var Cn,Lt;Dt===-1?Lt=ie.lastIndexOf("@"):Lt=ie.lastIndexOf("@",Dt),Lt!==-1&&(Cn=ie.slice(0,Lt),ie=ie.slice(Lt+1),this.auth=decodeURIComponent(Cn)),Dt=-1;for(var Fe=0;Fe<A.length;Fe++){var $e=ie.indexOf(A[Fe]);$e!==-1&&(Dt===-1||$e<Dt)&&(Dt=$e)}Dt===-1&&(Dt=ie.length),this.host=ie.slice(0,Dt),ie=ie.slice(Dt),this.parseHost(),this.hostname=this.hostname||"";var In=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!In)for(var Et=this.hostname.split(/\./),Fe=0,Ne=Et.length;Fe<Ne;Fe++){var pe=Et[Fe];if(pe&&!pe.match(b)){for(var At="",Ve=0,xe=pe.length;Ve<xe;Ve++)pe.charCodeAt(Ve)>127?At+="x":At+=pe[Ve];if(!At.match(b)){var ze=Et.slice(0,Fe),Pt=Et.slice(Fe+1),hn=pe.match(T);hn&&(ze.push(hn[1]),Pt.unshift(hn[2])),Pt.length&&(ie="/"+Pt.join(".")+ie),this.hostname=ze.join(".");break}}}this.hostname.length>S?this.hostname="":this.hostname=this.hostname.toLowerCase(),In||(this.hostname=u.toASCII(this.hostname));var ae=this.port?":"+this.port:"",le=this.hostname||"";this.host=le+ae,this.href+=this.host,In&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),ie[0]!=="/"&&(ie="/"+ie))}if(!w[Oe])for(var Fe=0,Ne=y.length;Fe<Ne;Fe++){var re=y[Fe];if(ie.indexOf(re)!==-1){var V=encodeURIComponent(re);V===re&&(V=escape(re)),ie=ie.split(re).join(V)}}var $=ie.indexOf("#");$!==-1&&(this.hash=ie.substr($),ie=ie.slice(0,$));var he=ie.indexOf("?");if(he!==-1?(this.search=ie.substr(he),this.query=ie.substr(he+1),F&&(this.query=M.parse(this.query)),ie=ie.slice(0,he)):F&&(this.search="",this.query={}),ie&&(this.pathname=ie),k[Oe]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var ae=this.pathname||"",Ue=this.search||"";this.path=ae+Ue}return this.href=this.format(),this};function z(L){return c.isString(L)&&(L=D(L)),L instanceof f?L.format():f.prototype.format.call(L)}f.prototype.format=function(){var L=this.auth||"";L&&(L=encodeURIComponent(L),L=L.replace(/%3A/i,":"),L+="@");var F=this.protocol||"",O=this.pathname||"",ue=this.hash||"",_e=!1,Ce="";this.host?_e=L+this.host:this.hostname&&(_e=L+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(_e+=":"+this.port)),this.query&&c.isObject(this.query)&&Object.keys(this.query).length&&(Ce=M.stringify(this.query));var de=this.search||Ce&&"?"+Ce||"";return F&&F.substr(-1)!==":"&&(F+=":"),this.slashes||(!F||k[F])&&_e!==!1?(_e="//"+(_e||""),O&&O.charAt(0)!=="/"&&(O="/"+O)):_e||(_e=""),ue&&ue.charAt(0)!=="#"&&(ue="#"+ue),de&&de.charAt(0)!=="?"&&(de="?"+de),O=O.replace(/[?#]/g,function(ie){return encodeURIComponent(ie)}),de=de.replace("#","%23"),F+_e+O+de+ue};function j(L,F){return D(L,!1,!0).resolve(F)}f.prototype.resolve=function(L){return this.resolveObject(D(L,!1,!0)).format()};function oe(L,F){return L?D(L,!1,!0).resolveObject(F):F}f.prototype.resolveObject=function(L){if(c.isString(L)){var F=new f;F.parse(L,!1,!0),L=F}for(var O=new f,ue=Object.keys(this),_e=0;_e<ue.length;_e++){var Ce=ue[_e];O[Ce]=this[Ce]}if(O.hash=L.hash,L.href==="")return O.href=O.format(),O;if(L.slashes&&!L.protocol){for(var de=Object.keys(L),ie=0;ie<de.length;ie++){var Y=de[ie];Y!=="protocol"&&(O[Y]=L[Y])}return k[O.protocol]&&O.hostname&&!O.pathname&&(O.path=O.pathname="/"),O.href=O.format(),O}if(L.protocol&&L.protocol!==O.protocol){if(!k[L.protocol]){for(var Ie=Object.keys(L),Oe=0;Oe<Ie.length;Oe++){var kt=Ie[Oe];O[kt]=L[kt]}return O.href=O.format(),O}if(O.protocol=L.protocol,!L.host&&!x[L.protocol]){for(var Ne=(L.pathname||"").split("/");Ne.length&&!(L.host=Ne.shift()););L.host||(L.host=""),L.hostname||(L.hostname=""),Ne[0]!==""&&Ne.unshift(""),Ne.length<2&&Ne.unshift(""),O.pathname=Ne.join("/")}else O.pathname=L.pathname;if(O.search=L.search,O.query=L.query,O.host=L.host||"",O.auth=L.auth,O.hostname=L.hostname||L.host,O.port=L.port,O.pathname||O.search){var Dt=O.pathname||"",Fe=O.search||"";O.path=Dt+Fe}return O.slashes=O.slashes||L.slashes,O.href=O.format(),O}var $e=O.pathname&&O.pathname.charAt(0)==="/",Cn=L.host||L.pathname&&L.pathname.charAt(0)==="/",Lt=Cn||$e||O.host&&L.pathname,In=Lt,Et=O.pathname&&O.pathname.split("/")||[],Ne=L.pathname&&L.pathname.split("/")||[],pe=O.protocol&&!k[O.protocol];if(pe&&(O.hostname="",O.port=null,O.host&&(Et[0]===""?Et[0]=O.host:Et.unshift(O.host)),O.host="",L.protocol&&(L.hostname=null,L.port=null,L.host&&(Ne[0]===""?Ne[0]=L.host:Ne.unshift(L.host)),L.host=null),Lt=Lt&&(Ne[0]===""||Et[0]==="")),Cn)O.host=L.host||L.host===""?L.host:O.host,O.hostname=L.hostname||L.hostname===""?L.hostname:O.hostname,O.search=L.search,O.query=L.query,Et=Ne;else if(Ne.length)Et||(Et=[]),Et.pop(),Et=Et.concat(Ne),O.search=L.search,O.query=L.query;else if(!c.isNullOrUndefined(L.search)){if(pe){O.hostname=O.host=Et.shift();var At=O.host&&O.host.indexOf("@")>0?O.host.split("@"):!1;At&&(O.auth=At.shift(),O.host=O.hostname=At.shift())}return O.search=L.search,O.query=L.query,(!c.isNull(O.pathname)||!c.isNull(O.search))&&(O.path=(O.pathname?O.pathname:"")+(O.search?O.search:"")),O.href=O.format(),O}if(!Et.length)return O.pathname=null,O.search?O.path="/"+O.search:O.path=null,O.href=O.format(),O;for(var Ve=Et.slice(-1)[0],xe=(O.host||L.host||Et.length>1)&&(Ve==="."||Ve==="..")||Ve==="",ze=0,Pt=Et.length;Pt>=0;Pt--)Ve=Et[Pt],Ve==="."?Et.splice(Pt,1):Ve===".."?(Et.splice(Pt,1),ze++):ze&&(Et.splice(Pt,1),ze--);if(!Lt&&!In)for(;ze--;ze)Et.unshift("..");Lt&&Et[0]!==""&&(!Et[0]||Et[0].charAt(0)!=="/")&&Et.unshift(""),xe&&Et.join("/").substr(-1)!=="/"&&Et.push("");var hn=Et[0]===""||Et[0]&&Et[0].charAt(0)==="/";if(pe){O.hostname=O.host=hn?"":Et.length?Et.shift():"";var At=O.host&&O.host.indexOf("@")>0?O.host.split("@"):!1;At&&(O.auth=At.shift(),O.host=O.hostname=At.shift())}return Lt=Lt||O.host&&Et.length,Lt&&!hn&&Et.unshift(""),Et.length?O.pathname=Et.join("/"):(O.pathname=null,O.path=null),(!c.isNull(O.pathname)||!c.isNull(O.search))&&(O.path=(O.pathname?O.pathname:"")+(O.search?O.search:"")),O.auth=L.auth||O.auth,O.slashes=O.slashes||L.slashes,O.href=O.format(),O},f.prototype.parseHost=function(){var L=this.host,F=p.exec(L);F&&(F=F[0],F!==":"&&(this.port=F.substr(1)),L=L.substr(0,L.length-F.length)),L&&(this.hostname=L)}},{"./util":77,punycode:51,querystring:54}],77:[function(i,o,a){o.exports={isString:function(u){return typeof u=="string"},isObject:function(u){return typeof u=="object"&&u!==null},isNull:function(u){return u===null},isNullOrUndefined:function(u){return u==null}}},{}],78:[function(i,o,a){(function(u){(function(){o.exports=c;function c(d,p){if(f("noDeprecation"))return d;var h=!1;function g(){if(!h){if(f("throwDeprecation"))throw new Error(p);f("traceDeprecation")?console.trace(p):console.warn(p),h=!0}return d.apply(this,arguments)}return g}function f(d){try{if(!u.localStorage)return!1}catch{return!1}var p=u.localStorage[d];return p==null?!1:String(p).toLowerCase()==="true"}}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],79:[function(i,o,a){o.exports=u;function u(c,f){if(c&&f)return u(c)(f);if(typeof c!="function")throw new TypeError("need wrapper function");return Object.keys(c).forEach(function(p){d[p]=c[p]}),d;function d(){for(var p=new Array(arguments.length),h=0;h<p.length;h++)p[h]=arguments[h];var g=c.apply(this,p),v=p[p.length-1];return typeof g=="function"&&g!==v&&Object.keys(v).forEach(function(y){g[y]=v[y]}),g}}},{}],80:[function(i,o,a){o.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],81:[function(i,o,a){o.exports=c;var u=Object.prototype.hasOwnProperty;function c(){for(var f={},d=0;d<arguments.length;d++){var p=arguments[d];for(var h in p)u.call(p,h)&&(f[h]=p[h])}return f}},{}],82:[function(i,o,a){o.exports=function(u){u.prototype[Symbol.iterator]=function*(){for(let c=this.head;c;c=c.next)yield c.value}}},{}],83:[function(i,o,a){o.exports=u,u.Node=p,u.create=u;function u(h){var g=this;if(g instanceof u||(g=new u),g.tail=null,g.head=null,g.length=0,h&&typeof h.forEach=="function")h.forEach(function(A){g.push(A)});else if(arguments.length>0)for(var v=0,y=arguments.length;v<y;v++)g.push(arguments[v]);return g}u.prototype.removeNode=function(h){if(h.list!==this)throw new Error("removing node which does not belong to this list");var g=h.next,v=h.prev;return g&&(g.prev=v),v&&(v.next=g),h===this.head&&(this.head=g),h===this.tail&&(this.tail=v),h.list.length--,h.next=null,h.prev=null,h.list=null,g},u.prototype.unshiftNode=function(h){if(h!==this.head){h.list&&h.list.removeNode(h);var g=this.head;h.list=this,h.next=g,g&&(g.prev=h),this.head=h,this.tail||(this.tail=h),this.length++}},u.prototype.pushNode=function(h){if(h!==this.tail){h.list&&h.list.removeNode(h);var g=this.tail;h.list=this,h.prev=g,g&&(g.next=h),this.tail=h,this.head||(this.head=h),this.length++}},u.prototype.push=function(){for(var h=0,g=arguments.length;h<g;h++)f(this,arguments[h]);return this.length},u.prototype.unshift=function(){for(var h=0,g=arguments.length;h<g;h++)d(this,arguments[h]);return this.length},u.prototype.pop=function(){if(this.tail){var h=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,h}},u.prototype.shift=function(){if(this.head){var h=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,h}},u.prototype.forEach=function(h,g){g=g||this;for(var v=this.head,y=0;v!==null;y++)h.call(g,v.value,y,this),v=v.next},u.prototype.forEachReverse=function(h,g){g=g||this;for(var v=this.tail,y=this.length-1;v!==null;y--)h.call(g,v.value,y,this),v=v.prev},u.prototype.get=function(h){for(var g=0,v=this.head;v!==null&&g<h;g++)v=v.next;if(g===h&&v!==null)return v.value},u.prototype.getReverse=function(h){for(var g=0,v=this.tail;v!==null&&g<h;g++)v=v.prev;if(g===h&&v!==null)return v.value},u.prototype.map=function(h,g){g=g||this;for(var v=new u,y=this.head;y!==null;)v.push(h.call(g,y.value,this)),y=y.next;return v},u.prototype.mapReverse=function(h,g){g=g||this;for(var v=new u,y=this.tail;y!==null;)v.push(h.call(g,y.value,this)),y=y.prev;return v},u.prototype.reduce=function(h,g){var v,y=this.head;if(arguments.length>1)v=g;else if(this.head)y=this.head.next,v=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var A=0;y!==null;A++)v=h(v,y.value,A),y=y.next;return v},u.prototype.reduceReverse=function(h,g){var v,y=this.tail;if(arguments.length>1)v=g;else if(this.tail)y=this.tail.prev,v=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var A=this.length-1;y!==null;A--)v=h(v,y.value,A),y=y.prev;return v},u.prototype.toArray=function(){for(var h=new Array(this.length),g=0,v=this.head;v!==null;g++)h[g]=v.value,v=v.next;return h},u.prototype.toArrayReverse=function(){for(var h=new Array(this.length),g=0,v=this.tail;v!==null;g++)h[g]=v.value,v=v.prev;return h},u.prototype.slice=function(h,g){g=g||this.length,g<0&&(g+=this.length),h=h||0,h<0&&(h+=this.length);var v=new u;if(g<h||g<0)return v;h<0&&(h=0),g>this.length&&(g=this.length);for(var y=0,A=this.head;A!==null&&y<h;y++)A=A.next;for(;A!==null&&y<g;y++,A=A.next)v.push(A.value);return v},u.prototype.sliceReverse=function(h,g){g=g||this.length,g<0&&(g+=this.length),h=h||0,h<0&&(h+=this.length);var v=new u;if(g<h||g<0)return v;h<0&&(h=0),g>this.length&&(g=this.length);for(var y=this.length,A=this.tail;A!==null&&y>g;y--)A=A.prev;for(;A!==null&&y>h;y--,A=A.prev)v.push(A.value);return v},u.prototype.splice=function(h,g,...v){h>this.length&&(h=this.length-1),h<0&&(h=this.length+h);for(var y=0,A=this.head;A!==null&&y<h;y++)A=A.next;for(var _=[],y=0;A&&y<g;y++)_.push(A.value),A=this.removeNode(A);A===null&&(A=this.tail),A!==this.head&&A!==this.tail&&(A=A.prev);for(var y=0;y<v.length;y++)A=c(this,A,v[y]);return _},u.prototype.reverse=function(){for(var h=this.head,g=this.tail,v=h;v!==null;v=v.prev){var y=v.prev;v.prev=v.next,v.next=y}return this.head=g,this.tail=h,this};function c(h,g,v){var y=g===h.head?new p(v,null,g,h):new p(v,g,g.next,h);return y.next===null&&(h.tail=y),y.prev===null&&(h.head=y),h.length++,y}function f(h,g){h.tail=new p(g,h.tail,null,h),h.head||(h.head=h.tail),h.length++}function d(h,g){h.head=new p(g,null,h.head,h),h.tail||(h.tail=h.head),h.length++}function p(h,g,v,y){if(!(this instanceof p))return new p(h,g,v,y);this.list=y,this.value=h,g?(g.next=this,this.prev=g):this.prev=null,v?(v.prev=this,this.next=v):this.next=null}try{i("./iterator.js")(u)}catch{}},{"./iterator.js":82}]},{},[12])(12)})})(mqtt);var mqttExports=mqtt.exports;let client;const sub=(r,n,i,o,a)=>{client=mqttExports.connect(r,{username:n,password:i}),client.on("connect",()=>{console.log("MQTT服务器连接成功"),console.log(client.options.clientId),client.subscribe(o,{qos:1})}),client.on("message",a)},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(r,{expose:n,emit:i}){const o=r;vue.useCssVars(b=>({eb9e007c:vue.unref(c)})),setEditorLoadTime();const a=useGlobalStore(pinia);componentsRegister();const u=vue.reactive(o.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:[]}),c=vue.computed(()=>a.intention==EGlobalStoreIntention.MoveCanvas?"grab":"default"),f=b=>{if(a.mouse_info.state!=EMouseInfoState.Down&&a.intention!==EGlobalStoreIntention.Connection||!o.canvasDrag)return;const{clientX:T,clientY:w}=b;a.mouse_info.new_position_x=a.mouse_info.now_position_x+T-a.mouse_info.position_x,a.mouse_info.new_position_y=a.mouse_info.now_position_y+w-a.mouse_info.position_y,a.intention==EGlobalStoreIntention.MoveCanvas&&(u.layout_center.x=a.mouse_info.new_position_x,u.layout_center.y=a.mouse_info.new_position_y)},d=()=>{a.mouse_info.state==EMouseInfoState.Down&&(a.intention!=EGlobalStoreIntention.Select&&(a.intention=EGlobalStoreIntention.None),a.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})},p=b=>{const{clientX:T,clientY:w}=b;a.intention=EGlobalStoreIntention.MoveCanvas,a.mouse_info={state:EMouseInfoState.Down,position_x:T,position_y:w,now_position_x:u.layout_center.x,now_position_y:u.layout_center.y,new_position_x:u.layout_center.x,new_position_y:u.layout_center.y}};function h(b){b!=null&&b.wheelDelta&&(b.wheelDelta>0?u.config.svg.scale=parseFloat((u.config.svg.scale+.1).toFixed(1)):u.config.svg.scale=parseFloat((u.config.svg.scale-.1).toFixed(1)))}const g=(b,T,w)=>({x:b.x-b.width/2*T+b.width/2,y:b.y-b.height/2*w+b.height/2,width:b.width*T,height:b.height*w}),v=b=>{var w;let T=!1;if(((w=b.events)==null?void 0:w.length)>0){for(let x of b.events)if(x.type===EEventType.Click){T=!0;break}}return{cursor:T?"pointer":"default"}},y=(b,T)=>{var w;if(console.log(b.events,T),((w=b.events)==null?void 0:w.length)>0){for(let x of b.events)if(x.type===T){if(x.condition&&x.condition.type!=="None"&&x.condition.type==="Relation"&&x.condition.Relation&&x.condition.Relation.relation){const k=x.condition.Relation.key,M=x.condition.Relation.relation,D=valFormat(x.condition.Relation.val),z=valFormat(x.condition.Relation.val2);if(b.props.hasOwnProperty(k)){const j=b.props[k].val;if(!A(j,M,D,z))continue}}if(x.action===EEventAction.ChangeAttr){if(x.attrs&&x.attrs.length>0){let k;if(x.target){for(let M of u.done_json)if(M.id===x.target){k=M;break}}else k=b;if(!k)continue;for(let M of x.attrs)M.key==="state"?k.defaultState=valFormat(M.val):k.props.hasOwnProperty(M.key)&&(k.props[M.key].val=valFormat(M.val))}}else x.action===EEventAction.JavaScript&&new Function(x.scripts)()}}},A=(b,T,w,x)=>{switch(T){case">":return b>w;case">=":return b>=w;case"<":return b<w;case"<=":return b<=w;case"==":return b==w;case"!=":return b!=w;case">=,=<":return b>=w&&b<=x;case"<,>":return b<w||b>x}},_=()=>{const b=u.config.net.mqtt;b&&b.url&&b.user&&b.pwd&&b.topics&&sub(b.url,b.user,b.pwd,b.topics,(T,w)=>{console.log(T),console.log(w.toString()),i("onMessage",{topics:T,message:w})})},S=(b,T,w)=>setArrItemByID(b,T,w,u.done_json);return vue.onMounted(()=>{_()}),vue.onBeforeUnmount(close),n({setNodeAttrByID:S}),(b,T)=>(vue.openBlock(),vue.createElementBlock("div",{class:"canvas",onMousedown:p,onMousemove:f,onMouseup:d,onMousewheel:h,onContextmenu:T[4]||(T[4]=(...w)=>vue.unref(preventDefault)&&vue.unref(preventDefault)(...w))},[(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",style:vue.normalizeStyle({backgroundColor:vue.unref(u).config.svg.background_color}),width:"100%",height:"100%"},[vue.createElementVNode("g",{transform:`translate(${vue.unref(u).layout_center.x},${vue.unref(u).layout_center.y})rotate(0)scale(${vue.unref(u).config.svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(u).done_json,w=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:w.id,transform:`translate(${w.x},${w.y})rotate(0)scale(1)`,style:vue.normalizeStyle(v(w)),onClick:x=>y(w,vue.unref(EEventType).Click),onMousedown:T[0]||(T[0]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x)),onMousemove:T[1]||(T[1]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x)),onMouseup:T[2]||(T[2]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x)),onMousewheel:T[3]||(T[3]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x))},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(w)}`)},[vue.createElementVNode("g",{transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2})rotate(${w.rotate}) scale(1) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`},[w.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$y,{key:0,"item-info":w},null,8,["item-info"])):w.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${w.name}`},vue.unref(prosToVBind)(w),{width:"100",height:"100",id:w.id,transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2}) scale(${w.scale_x},${w.scale_y}) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`}),null,16,_hoisted_4)):w.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(w.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(w),{width:"100",height:"100",id:w.id,onOnChange:x=>y(w,vue.unref(EEventType).Change),transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2}) scale(${w.scale_x},${w.scale_y}) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`}),null,16,["id","onOnChange","transform"])):w.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},g(w.actual_bound,w.scale_x,w.scale_y),{id:`foreign-object${w.id}`,class:"foreignObject"}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(w.tag),vue.mergeProps(vue.unref(prosToVBind)(w),{id:w.id,onOnChange:x=>y(w,vue.unref(EEventType).Change),transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2}) scale(${w.scale_x},${w.scale_y}) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(w.tag_slot),1)]),_:2},1040,["id","onOnChange","transform"]))],16,_hoisted_5)):vue.createCommentVNode("",!0)],8,_hoisted_3)],2)],44,_hoisted_2)),[[vue.vShow,w.display]])),128))],8,_hoisted_1)],4))],32))}}),svgViewer_vue_vue_type_style_index_0_scoped_7cd79a96_lang="",svgViewer=_export_sfc$1(_sfc_main,[["__scopeId","data-v-7cd79a96"]]);exports.SvgEditor=index,exports.SvgViewer=svgViewer,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
277
+ `," "],v=["{","}","|","\\","^","`"].concat(g),y=["'"].concat(v),A=["%","/","?",";","#"].concat(y),_=["/","?","#"],S=255,b=/^[+a-z0-9A-Z_-]{0,63}$/,T=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,w={javascript:!0,"javascript:":!0},x={javascript:!0,"javascript:":!0},k={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},M=i("querystring");function D(L,F,O){if(L&&c.isObject(L)&&L instanceof f)return L;var ue=new f;return ue.parse(L,F,O),ue}f.prototype.parse=function(L,F,O){if(!c.isString(L))throw new TypeError("Parameter 'url' must be a string, not "+typeof L);var ue=L.indexOf("?"),_e=ue!==-1&&ue<L.indexOf("#")?"?":"#",Ce=L.split(_e),de=/\\/g;Ce[0]=Ce[0].replace(de,"/"),L=Ce.join(_e);var ie=L;if(ie=ie.trim(),!O&&L.split("#").length===1){var Y=h.exec(ie);if(Y)return this.path=ie,this.href=ie,this.pathname=Y[1],Y[2]?(this.search=Y[2],F?this.query=M.parse(this.search.substr(1)):this.query=this.search.substr(1)):F&&(this.search="",this.query={}),this}var Ie=d.exec(ie);if(Ie){Ie=Ie[0];var Oe=Ie.toLowerCase();this.protocol=Oe,ie=ie.substr(Ie.length)}if(O||Ie||ie.match(/^\/\/[^@\/]+@[^@\/]+/)){var kt=ie.substr(0,2)==="//";kt&&!(Ie&&x[Ie])&&(ie=ie.substr(2),this.slashes=!0)}if(!x[Ie]&&(kt||Ie&&!k[Ie])){for(var Dt=-1,Fe=0;Fe<_.length;Fe++){var $e=ie.indexOf(_[Fe]);$e!==-1&&(Dt===-1||$e<Dt)&&(Dt=$e)}var Cn,Lt;Dt===-1?Lt=ie.lastIndexOf("@"):Lt=ie.lastIndexOf("@",Dt),Lt!==-1&&(Cn=ie.slice(0,Lt),ie=ie.slice(Lt+1),this.auth=decodeURIComponent(Cn)),Dt=-1;for(var Fe=0;Fe<A.length;Fe++){var $e=ie.indexOf(A[Fe]);$e!==-1&&(Dt===-1||$e<Dt)&&(Dt=$e)}Dt===-1&&(Dt=ie.length),this.host=ie.slice(0,Dt),ie=ie.slice(Dt),this.parseHost(),this.hostname=this.hostname||"";var In=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!In)for(var Et=this.hostname.split(/\./),Fe=0,Ne=Et.length;Fe<Ne;Fe++){var pe=Et[Fe];if(pe&&!pe.match(b)){for(var At="",Ve=0,xe=pe.length;Ve<xe;Ve++)pe.charCodeAt(Ve)>127?At+="x":At+=pe[Ve];if(!At.match(b)){var ze=Et.slice(0,Fe),Pt=Et.slice(Fe+1),hn=pe.match(T);hn&&(ze.push(hn[1]),Pt.unshift(hn[2])),Pt.length&&(ie="/"+Pt.join(".")+ie),this.hostname=ze.join(".");break}}}this.hostname.length>S?this.hostname="":this.hostname=this.hostname.toLowerCase(),In||(this.hostname=u.toASCII(this.hostname));var ae=this.port?":"+this.port:"",le=this.hostname||"";this.host=le+ae,this.href+=this.host,In&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),ie[0]!=="/"&&(ie="/"+ie))}if(!w[Oe])for(var Fe=0,Ne=y.length;Fe<Ne;Fe++){var re=y[Fe];if(ie.indexOf(re)!==-1){var V=encodeURIComponent(re);V===re&&(V=escape(re)),ie=ie.split(re).join(V)}}var $=ie.indexOf("#");$!==-1&&(this.hash=ie.substr($),ie=ie.slice(0,$));var he=ie.indexOf("?");if(he!==-1?(this.search=ie.substr(he),this.query=ie.substr(he+1),F&&(this.query=M.parse(this.query)),ie=ie.slice(0,he)):F&&(this.search="",this.query={}),ie&&(this.pathname=ie),k[Oe]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var ae=this.pathname||"",Ue=this.search||"";this.path=ae+Ue}return this.href=this.format(),this};function z(L){return c.isString(L)&&(L=D(L)),L instanceof f?L.format():f.prototype.format.call(L)}f.prototype.format=function(){var L=this.auth||"";L&&(L=encodeURIComponent(L),L=L.replace(/%3A/i,":"),L+="@");var F=this.protocol||"",O=this.pathname||"",ue=this.hash||"",_e=!1,Ce="";this.host?_e=L+this.host:this.hostname&&(_e=L+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(_e+=":"+this.port)),this.query&&c.isObject(this.query)&&Object.keys(this.query).length&&(Ce=M.stringify(this.query));var de=this.search||Ce&&"?"+Ce||"";return F&&F.substr(-1)!==":"&&(F+=":"),this.slashes||(!F||k[F])&&_e!==!1?(_e="//"+(_e||""),O&&O.charAt(0)!=="/"&&(O="/"+O)):_e||(_e=""),ue&&ue.charAt(0)!=="#"&&(ue="#"+ue),de&&de.charAt(0)!=="?"&&(de="?"+de),O=O.replace(/[?#]/g,function(ie){return encodeURIComponent(ie)}),de=de.replace("#","%23"),F+_e+O+de+ue};function j(L,F){return D(L,!1,!0).resolve(F)}f.prototype.resolve=function(L){return this.resolveObject(D(L,!1,!0)).format()};function oe(L,F){return L?D(L,!1,!0).resolveObject(F):F}f.prototype.resolveObject=function(L){if(c.isString(L)){var F=new f;F.parse(L,!1,!0),L=F}for(var O=new f,ue=Object.keys(this),_e=0;_e<ue.length;_e++){var Ce=ue[_e];O[Ce]=this[Ce]}if(O.hash=L.hash,L.href==="")return O.href=O.format(),O;if(L.slashes&&!L.protocol){for(var de=Object.keys(L),ie=0;ie<de.length;ie++){var Y=de[ie];Y!=="protocol"&&(O[Y]=L[Y])}return k[O.protocol]&&O.hostname&&!O.pathname&&(O.path=O.pathname="/"),O.href=O.format(),O}if(L.protocol&&L.protocol!==O.protocol){if(!k[L.protocol]){for(var Ie=Object.keys(L),Oe=0;Oe<Ie.length;Oe++){var kt=Ie[Oe];O[kt]=L[kt]}return O.href=O.format(),O}if(O.protocol=L.protocol,!L.host&&!x[L.protocol]){for(var Ne=(L.pathname||"").split("/");Ne.length&&!(L.host=Ne.shift()););L.host||(L.host=""),L.hostname||(L.hostname=""),Ne[0]!==""&&Ne.unshift(""),Ne.length<2&&Ne.unshift(""),O.pathname=Ne.join("/")}else O.pathname=L.pathname;if(O.search=L.search,O.query=L.query,O.host=L.host||"",O.auth=L.auth,O.hostname=L.hostname||L.host,O.port=L.port,O.pathname||O.search){var Dt=O.pathname||"",Fe=O.search||"";O.path=Dt+Fe}return O.slashes=O.slashes||L.slashes,O.href=O.format(),O}var $e=O.pathname&&O.pathname.charAt(0)==="/",Cn=L.host||L.pathname&&L.pathname.charAt(0)==="/",Lt=Cn||$e||O.host&&L.pathname,In=Lt,Et=O.pathname&&O.pathname.split("/")||[],Ne=L.pathname&&L.pathname.split("/")||[],pe=O.protocol&&!k[O.protocol];if(pe&&(O.hostname="",O.port=null,O.host&&(Et[0]===""?Et[0]=O.host:Et.unshift(O.host)),O.host="",L.protocol&&(L.hostname=null,L.port=null,L.host&&(Ne[0]===""?Ne[0]=L.host:Ne.unshift(L.host)),L.host=null),Lt=Lt&&(Ne[0]===""||Et[0]==="")),Cn)O.host=L.host||L.host===""?L.host:O.host,O.hostname=L.hostname||L.hostname===""?L.hostname:O.hostname,O.search=L.search,O.query=L.query,Et=Ne;else if(Ne.length)Et||(Et=[]),Et.pop(),Et=Et.concat(Ne),O.search=L.search,O.query=L.query;else if(!c.isNullOrUndefined(L.search)){if(pe){O.hostname=O.host=Et.shift();var At=O.host&&O.host.indexOf("@")>0?O.host.split("@"):!1;At&&(O.auth=At.shift(),O.host=O.hostname=At.shift())}return O.search=L.search,O.query=L.query,(!c.isNull(O.pathname)||!c.isNull(O.search))&&(O.path=(O.pathname?O.pathname:"")+(O.search?O.search:"")),O.href=O.format(),O}if(!Et.length)return O.pathname=null,O.search?O.path="/"+O.search:O.path=null,O.href=O.format(),O;for(var Ve=Et.slice(-1)[0],xe=(O.host||L.host||Et.length>1)&&(Ve==="."||Ve==="..")||Ve==="",ze=0,Pt=Et.length;Pt>=0;Pt--)Ve=Et[Pt],Ve==="."?Et.splice(Pt,1):Ve===".."?(Et.splice(Pt,1),ze++):ze&&(Et.splice(Pt,1),ze--);if(!Lt&&!In)for(;ze--;ze)Et.unshift("..");Lt&&Et[0]!==""&&(!Et[0]||Et[0].charAt(0)!=="/")&&Et.unshift(""),xe&&Et.join("/").substr(-1)!=="/"&&Et.push("");var hn=Et[0]===""||Et[0]&&Et[0].charAt(0)==="/";if(pe){O.hostname=O.host=hn?"":Et.length?Et.shift():"";var At=O.host&&O.host.indexOf("@")>0?O.host.split("@"):!1;At&&(O.auth=At.shift(),O.host=O.hostname=At.shift())}return Lt=Lt||O.host&&Et.length,Lt&&!hn&&Et.unshift(""),Et.length?O.pathname=Et.join("/"):(O.pathname=null,O.path=null),(!c.isNull(O.pathname)||!c.isNull(O.search))&&(O.path=(O.pathname?O.pathname:"")+(O.search?O.search:"")),O.auth=L.auth||O.auth,O.slashes=O.slashes||L.slashes,O.href=O.format(),O},f.prototype.parseHost=function(){var L=this.host,F=p.exec(L);F&&(F=F[0],F!==":"&&(this.port=F.substr(1)),L=L.substr(0,L.length-F.length)),L&&(this.hostname=L)}},{"./util":77,punycode:51,querystring:54}],77:[function(i,o,a){o.exports={isString:function(u){return typeof u=="string"},isObject:function(u){return typeof u=="object"&&u!==null},isNull:function(u){return u===null},isNullOrUndefined:function(u){return u==null}}},{}],78:[function(i,o,a){(function(u){(function(){o.exports=c;function c(d,p){if(f("noDeprecation"))return d;var h=!1;function g(){if(!h){if(f("throwDeprecation"))throw new Error(p);f("traceDeprecation")?console.trace(p):console.warn(p),h=!0}return d.apply(this,arguments)}return g}function f(d){try{if(!u.localStorage)return!1}catch{return!1}var p=u.localStorage[d];return p==null?!1:String(p).toLowerCase()==="true"}}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],79:[function(i,o,a){o.exports=u;function u(c,f){if(c&&f)return u(c)(f);if(typeof c!="function")throw new TypeError("need wrapper function");return Object.keys(c).forEach(function(p){d[p]=c[p]}),d;function d(){for(var p=new Array(arguments.length),h=0;h<p.length;h++)p[h]=arguments[h];var g=c.apply(this,p),v=p[p.length-1];return typeof g=="function"&&g!==v&&Object.keys(v).forEach(function(y){g[y]=v[y]}),g}}},{}],80:[function(i,o,a){o.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],81:[function(i,o,a){o.exports=c;var u=Object.prototype.hasOwnProperty;function c(){for(var f={},d=0;d<arguments.length;d++){var p=arguments[d];for(var h in p)u.call(p,h)&&(f[h]=p[h])}return f}},{}],82:[function(i,o,a){o.exports=function(u){u.prototype[Symbol.iterator]=function*(){for(let c=this.head;c;c=c.next)yield c.value}}},{}],83:[function(i,o,a){o.exports=u,u.Node=p,u.create=u;function u(h){var g=this;if(g instanceof u||(g=new u),g.tail=null,g.head=null,g.length=0,h&&typeof h.forEach=="function")h.forEach(function(A){g.push(A)});else if(arguments.length>0)for(var v=0,y=arguments.length;v<y;v++)g.push(arguments[v]);return g}u.prototype.removeNode=function(h){if(h.list!==this)throw new Error("removing node which does not belong to this list");var g=h.next,v=h.prev;return g&&(g.prev=v),v&&(v.next=g),h===this.head&&(this.head=g),h===this.tail&&(this.tail=v),h.list.length--,h.next=null,h.prev=null,h.list=null,g},u.prototype.unshiftNode=function(h){if(h!==this.head){h.list&&h.list.removeNode(h);var g=this.head;h.list=this,h.next=g,g&&(g.prev=h),this.head=h,this.tail||(this.tail=h),this.length++}},u.prototype.pushNode=function(h){if(h!==this.tail){h.list&&h.list.removeNode(h);var g=this.tail;h.list=this,h.prev=g,g&&(g.next=h),this.tail=h,this.head||(this.head=h),this.length++}},u.prototype.push=function(){for(var h=0,g=arguments.length;h<g;h++)f(this,arguments[h]);return this.length},u.prototype.unshift=function(){for(var h=0,g=arguments.length;h<g;h++)d(this,arguments[h]);return this.length},u.prototype.pop=function(){if(this.tail){var h=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,h}},u.prototype.shift=function(){if(this.head){var h=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,h}},u.prototype.forEach=function(h,g){g=g||this;for(var v=this.head,y=0;v!==null;y++)h.call(g,v.value,y,this),v=v.next},u.prototype.forEachReverse=function(h,g){g=g||this;for(var v=this.tail,y=this.length-1;v!==null;y--)h.call(g,v.value,y,this),v=v.prev},u.prototype.get=function(h){for(var g=0,v=this.head;v!==null&&g<h;g++)v=v.next;if(g===h&&v!==null)return v.value},u.prototype.getReverse=function(h){for(var g=0,v=this.tail;v!==null&&g<h;g++)v=v.prev;if(g===h&&v!==null)return v.value},u.prototype.map=function(h,g){g=g||this;for(var v=new u,y=this.head;y!==null;)v.push(h.call(g,y.value,this)),y=y.next;return v},u.prototype.mapReverse=function(h,g){g=g||this;for(var v=new u,y=this.tail;y!==null;)v.push(h.call(g,y.value,this)),y=y.prev;return v},u.prototype.reduce=function(h,g){var v,y=this.head;if(arguments.length>1)v=g;else if(this.head)y=this.head.next,v=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var A=0;y!==null;A++)v=h(v,y.value,A),y=y.next;return v},u.prototype.reduceReverse=function(h,g){var v,y=this.tail;if(arguments.length>1)v=g;else if(this.tail)y=this.tail.prev,v=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var A=this.length-1;y!==null;A--)v=h(v,y.value,A),y=y.prev;return v},u.prototype.toArray=function(){for(var h=new Array(this.length),g=0,v=this.head;v!==null;g++)h[g]=v.value,v=v.next;return h},u.prototype.toArrayReverse=function(){for(var h=new Array(this.length),g=0,v=this.tail;v!==null;g++)h[g]=v.value,v=v.prev;return h},u.prototype.slice=function(h,g){g=g||this.length,g<0&&(g+=this.length),h=h||0,h<0&&(h+=this.length);var v=new u;if(g<h||g<0)return v;h<0&&(h=0),g>this.length&&(g=this.length);for(var y=0,A=this.head;A!==null&&y<h;y++)A=A.next;for(;A!==null&&y<g;y++,A=A.next)v.push(A.value);return v},u.prototype.sliceReverse=function(h,g){g=g||this.length,g<0&&(g+=this.length),h=h||0,h<0&&(h+=this.length);var v=new u;if(g<h||g<0)return v;h<0&&(h=0),g>this.length&&(g=this.length);for(var y=this.length,A=this.tail;A!==null&&y>g;y--)A=A.prev;for(;A!==null&&y>h;y--,A=A.prev)v.push(A.value);return v},u.prototype.splice=function(h,g,...v){h>this.length&&(h=this.length-1),h<0&&(h=this.length+h);for(var y=0,A=this.head;A!==null&&y<h;y++)A=A.next;for(var _=[],y=0;A&&y<g;y++)_.push(A.value),A=this.removeNode(A);A===null&&(A=this.tail),A!==this.head&&A!==this.tail&&(A=A.prev);for(var y=0;y<v.length;y++)A=c(this,A,v[y]);return _},u.prototype.reverse=function(){for(var h=this.head,g=this.tail,v=h;v!==null;v=v.prev){var y=v.prev;v.prev=v.next,v.next=y}return this.head=g,this.tail=h,this};function c(h,g,v){var y=g===h.head?new p(v,null,g,h):new p(v,g,g.next,h);return y.next===null&&(h.tail=y),y.prev===null&&(h.head=y),h.length++,y}function f(h,g){h.tail=new p(g,h.tail,null,h),h.head||(h.head=h.tail),h.length++}function d(h,g){h.head=new p(g,null,h.head,h),h.tail||(h.tail=h.head),h.length++}function p(h,g,v,y){if(!(this instanceof p))return new p(h,g,v,y);this.list=y,this.value=h,g?(g.next=this,this.prev=g):this.prev=null,v?(v.prev=this,this.next=v):this.next=null}try{i("./iterator.js")(u)}catch{}},{"./iterator.js":82}]},{},[12])(12)})})(mqtt);var mqttExports=mqtt.exports;let client;const sub=(r,n,i,o,a)=>{client=mqttExports.connect(r,{username:n,password:i,reconnectPeriod:6e5}),client.on("connect",()=>{console.log("MQTT服务器连接成功"),console.log(client.options.clientId),client.subscribe(o,{qos:1})}),client.on("message",a)},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(r,{expose:n,emit:i}){const o=r;vue.useCssVars(b=>({"2560e28f":vue.unref(c)})),setEditorLoadTime();const a=useGlobalStore(pinia);componentsRegister();const u=vue.reactive(o.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:[]}),c=vue.computed(()=>a.intention==EGlobalStoreIntention.MoveCanvas?"grab":"default"),f=b=>{if(a.mouse_info.state!=EMouseInfoState.Down&&a.intention!==EGlobalStoreIntention.Connection||!o.canvasDrag)return;const{clientX:T,clientY:w}=b;a.mouse_info.new_position_x=a.mouse_info.now_position_x+T-a.mouse_info.position_x,a.mouse_info.new_position_y=a.mouse_info.now_position_y+w-a.mouse_info.position_y,a.intention==EGlobalStoreIntention.MoveCanvas&&(u.layout_center.x=a.mouse_info.new_position_x,u.layout_center.y=a.mouse_info.new_position_y)},d=()=>{a.mouse_info.state==EMouseInfoState.Down&&(a.intention!=EGlobalStoreIntention.Select&&(a.intention=EGlobalStoreIntention.None),a.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})},p=b=>{const{clientX:T,clientY:w}=b;a.intention=EGlobalStoreIntention.MoveCanvas,a.mouse_info={state:EMouseInfoState.Down,position_x:T,position_y:w,now_position_x:u.layout_center.x,now_position_y:u.layout_center.y,new_position_x:u.layout_center.x,new_position_y:u.layout_center.y}};function h(b){b!=null&&b.wheelDelta&&(b.wheelDelta>0?u.config.svg.scale=parseFloat((u.config.svg.scale+.1).toFixed(1)):u.config.svg.scale=parseFloat((u.config.svg.scale-.1).toFixed(1)))}const g=(b,T,w)=>({x:b.x-b.width/2*T+b.width/2,y:b.y-b.height/2*w+b.height/2,width:b.width*T,height:b.height*w}),v=b=>{var w;let T=!1;if(((w=b.events)==null?void 0:w.length)>0){for(let x of b.events)if(x.type===EEventType.Click){T=!0;break}}return{cursor:T?"pointer":"default"}},y=(b,T)=>{var w;if(console.log(b.events,T),((w=b.events)==null?void 0:w.length)>0){for(let x of b.events)if(x.type===T){if(x.condition&&x.condition.type!=="None"&&x.condition.type==="Relation"&&x.condition.Relation&&x.condition.Relation.relation){const k=x.condition.Relation.key,M=x.condition.Relation.relation,D=valFormat(x.condition.Relation.val),z=valFormat(x.condition.Relation.val2);if(b.props.hasOwnProperty(k)){const j=b.props[k].val;if(!A(j,M,D,z))continue}}if(x.action===EEventAction.ChangeAttr){if(x.attrs&&x.attrs.length>0){let k;if(x.target){for(let M of u.done_json)if(M.id===x.target){k=M;break}}else k=b;if(!k)continue;for(let M of x.attrs)M.key==="state"?k.defaultState=valFormat(M.val):k.props.hasOwnProperty(M.key)&&(k.props[M.key].val=valFormat(M.val))}}else x.action===EEventAction.JavaScript&&new Function(x.scripts)()}}},A=(b,T,w,x)=>{switch(T){case">":return b>w;case">=":return b>=w;case"<":return b<w;case"<=":return b<=w;case"==":return b==w;case"!=":return b!=w;case">=,=<":return b>=w&&b<=x;case"<,>":return b<w||b>x}},_=()=>{const b=u.config.net.mqtt;b&&b.url&&b.user&&b.pwd&&b.topics&&sub(b.url,b.user,b.pwd,b.topics,(T,w)=>{console.log(T),console.log(w.toString()),i("onMessage",{topics:T,message:w})})},S=(b,T,w)=>setArrItemByID(b,T,w,u.done_json);return vue.onMounted(()=>{_()}),vue.onBeforeUnmount(close),n({setNodeAttrByID:S}),(b,T)=>(vue.openBlock(),vue.createElementBlock("div",{class:"canvas",onMousedown:p,onMousemove:f,onMouseup:d,onMousewheel:h,onContextmenu:T[4]||(T[4]=(...w)=>vue.unref(preventDefault)&&vue.unref(preventDefault)(...w))},[(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",style:vue.normalizeStyle({backgroundColor:vue.unref(u).config.svg.background_color}),width:"100%",height:"100%"},[vue.createElementVNode("g",{transform:`translate(${vue.unref(u).layout_center.x},${vue.unref(u).layout_center.y})rotate(0)scale(${vue.unref(u).config.svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(u).done_json,w=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:w.id,transform:`translate(${w.x},${w.y})rotate(0)scale(1)`,style:vue.normalizeStyle(v(w)),onClick:x=>y(w,vue.unref(EEventType).Click),onMousedown:T[0]||(T[0]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x)),onMousemove:T[1]||(T[1]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x)),onMouseup:T[2]||(T[2]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x)),onMousewheel:T[3]||(T[3]=(...x)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...x))},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(w)}`)},[vue.createElementVNode("g",{transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2})rotate(${w.rotate}) scale(1) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`},[w.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$y,{key:0,"item-info":w},null,8,["item-info"])):w.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${w.name}`},vue.unref(prosToVBind)(w),{width:"100",height:"100",id:w.id,transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2}) scale(${w.scale_x},${w.scale_y}) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`}),null,16,_hoisted_4)):w.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(w.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(w),{width:"100",height:"100",id:w.id,onOnChange:x=>y(w,vue.unref(EEventType).Change),transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2}) scale(${w.scale_x},${w.scale_y}) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`}),null,16,["id","onOnChange","transform"])):w.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},g(w.actual_bound,w.scale_x,w.scale_y),{id:`foreign-object${w.id}`,class:"foreignObject"}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(w.tag),vue.mergeProps(vue.unref(prosToVBind)(w),{id:w.id,onOnChange:x=>y(w,vue.unref(EEventType).Change),transform:`translate(${w.actual_bound.x+w.actual_bound.width/2},${w.actual_bound.y+w.actual_bound.height/2}) scale(${w.scale_x},${w.scale_y}) translate(${-(w.actual_bound.x+w.actual_bound.width/2)},${-(w.actual_bound.y+w.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(w.tag_slot),1)]),_:2},1040,["id","onOnChange","transform"]))],16,_hoisted_5)):vue.createCommentVNode("",!0)],8,_hoisted_3)],2)],44,_hoisted_2)),[[vue.vShow,w.display]])),128))],8,_hoisted_1)],4))],32))}}),svgViewer_vue_vue_type_style_index_0_scoped_5171fc53_lang="",svgViewer=_export_sfc$1(_sfc_main,[["__scopeId","data-v-5171fc53"]]);exports.SvgEditor=index,exports.SvgViewer=svgViewer,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});