@zhangqingcq/vgce 0.1.16 → 0.1.18
Sign up to get free protection for your applications and to get access to all the features.
package/dist/vgce.umd.cjs
CHANGED
@@ -241,7 +241,7 @@ echarts.use([`+re+"]);":"Unknown series "+V))}return}if(g==="tooltip"){if(S){pro
|
|
241
241
|
|
242
242
|
`:"<br/>",w=g.join(A);this._showOrMove(d,function(){this._updateContentNotChangedOnAxis(n,h)?this._updatePosition(d,v,c[0],c[1],this._tooltipContent,h):this._showTooltipContent(d,w,h,Math.random()+"",c[0],c[1],v,null,p)})},r.prototype._showSeriesItemTooltip=function(n,o,a){var u=this._ecModel,c=getECData(o),d=c.seriesIndex,f=u.getSeriesByIndex(d),h=c.dataModel||f,y=c.dataIndex,g=c.dataType,p=h.getData(g),v=this._renderMode,_=n.positionDefault,b=buildTooltipModel([p.getItemModel(y),h,f&&(f.coordinateSystem||{}).model],this._tooltipModel,_?{position:_}:null),A=b.get("trigger");if(!(A!=null&&A!=="item")){var w=h.getDataParams(y,g),T=new TooltipMarkupStyleCreator;w.marker=T.makeTooltipMarker("item",convertToColorString(w.color),v);var S=normalizeTooltipFormatResult(h.formatTooltip(y,!1,g)),x=b.get("order"),L=b.get("valueFormatter"),M=S.frag,O=M?buildTooltipMarkup(L?extend({valueFormatter:L},M):M,T,v,x,u.get("useUTC"),b.get("textStyle")):S.text,ie="item_"+h.name+"_"+y;this._showOrMove(b,function(){this._showTooltipContent(b,O,w,ie,n.offsetX,n.offsetY,n.position,n.target,T)}),a({type:"showTip",dataIndexInside:y,dataIndex:p.getRawIndex(y),seriesIndex:d,from:this.uid})}},r.prototype._showComponentItemTooltip=function(n,o,a){var u=this._renderMode==="html",c=getECData(o),d=c.tooltipConfig,f=d.option||{},h=f.encodeHTMLContent;if(isString$2(f)){var y=f;f={content:y,formatter:y},h=!0}h&&u&&f.content&&(f=clone$2(f),f.content=encodeHTML(f.content));var g=[f],p=this._ecModel.getComponent(c.componentMainType,c.componentIndex);p&&g.push(p),g.push({formatter:f.content});var v=n.positionDefault,_=buildTooltipModel(g,this._tooltipModel,v?{position:v}:null),b=_.get("content"),A=Math.random()+"",w=new TooltipMarkupStyleCreator;this._showOrMove(_,function(){var T=clone$2(_.get("formatterParams")||{});this._showTooltipContent(_,b,T,A,n.offsetX,n.offsetY,n.position,o,w)}),a({type:"showTip",from:this.uid})},r.prototype._showTooltipContent=function(n,o,a,u,c,d,f,h,y){if(this._ticket="",!(!n.get("showContent")||!n.get("show"))){var g=this._tooltipContent;g.setEnterable(n.get("enterable"));var p=n.get("formatter");f=f||n.get("position");var v=o,_=this._getNearestPoint([c,d],a,n.get("trigger"),n.get("borderColor")),b=_.color;if(p)if(isString$2(p)){var A=n.ecModel.get("useUTC"),w=isArray$1(a)?a[0]:a,T=w&&w.axisType&&w.axisType.indexOf("time")>=0;v=p,T&&(v=format$1(w.axisValue,v,A)),v=formatTpl(v,a,!0)}else if(isFunction$1(p)){var S=bind$1(function(x,L){x===this._ticket&&(g.setContent(L,y,n,b,f),this._updatePosition(n,f,c,d,g,a,h))},this);this._ticket=u,v=p(a,u,S)}else v=p;g.setContent(v,y,n,b,f),g.show(n,b),this._updatePosition(n,f,c,d,g,a,h)}},r.prototype._getNearestPoint=function(n,o,a,u){if(a==="axis"||isArray$1(o))return{color:u||(this._renderMode==="html"?"#fff":"none")};if(!isArray$1(o))return{color:u||o.color||o.borderColor}},r.prototype._updatePosition=function(n,o,a,u,c,d,f){var h=this._api.getWidth(),y=this._api.getHeight();o=o||n.get("position");var g=c.getSize(),p=n.get("align"),v=n.get("verticalAlign"),_=f&&f.getBoundingRect().clone();if(f&&_.applyTransform(f.transform),isFunction$1(o)&&(o=o([a,u],d,c.el,_,{viewSize:[h,y],contentSize:g.slice()})),isArray$1(o))a=parsePercent(o[0],h),u=parsePercent(o[1],y);else if(isObject$3(o)){var b=o;b.width=g[0],b.height=g[1];var A=getLayoutRect(b,{width:h,height:y});a=A.x,u=A.y,p=null,v=null}else if(isString$2(o)&&f){var w=calcTooltipPosition(o,_,g,n.get("borderWidth"));a=w[0],u=w[1]}else{var w=refixTooltipPosition(a,u,c,h,y,p?null:20,v?null:20);a=w[0],u=w[1]}if(p&&(a-=isCenterAlign(p)?g[0]/2:p==="right"?g[0]:0),v&&(u-=isCenterAlign(v)?g[1]/2:v==="bottom"?g[1]:0),shouldTooltipConfine(n)){var w=confineTooltipPosition(a,u,c,h,y);a=w[0],u=w[1]}c.moveTo(a,u)},r.prototype._updateContentNotChangedOnAxis=function(n,o){var a=this._lastDataByCoordSys,u=this._cbParamsList,c=!!a&&a.length===n.length;return c&&each$4(a,function(d,f){var h=d.dataByAxis||[],y=n[f]||{},g=y.dataByAxis||[];c=c&&h.length===g.length,c&&each$4(h,function(p,v){var _=g[v]||{},b=p.seriesDataIndices||[],A=_.seriesDataIndices||[];c=c&&p.value===_.value&&p.axisType===_.axisType&&p.axisId===_.axisId&&b.length===A.length,c&&each$4(b,function(w,T){var S=A[T];c=c&&w.seriesIndex===S.seriesIndex&&w.dataIndex===S.dataIndex}),u&&each$4(p.seriesDataIndices,function(w){var T=w.seriesIndex,S=o[T],x=u[T];S&&x&&x.data!==S.data&&(c=!1)})})}),this._lastDataByCoordSys=n,this._cbParamsList=o,!!c},r.prototype._hide=function(n){this._lastDataByCoordSys=null,n({type:"hideTip",from:this.uid})},r.prototype.dispose=function(n,o){env$1.node||!o.getDom()||(clear(this,"_updatePosition"),this._tooltipContent.dispose(),unregister("itemTooltip",o))},r.type="tooltip",r}(ComponentView$1);function buildTooltipModel(i,r,n){var o=r.ecModel,a;n?(a=new Model$1(n,o,o),a=new Model$1(r.option,a,o)):a=r;for(var u=i.length-1;u>=0;u--){var c=i[u];c&&(c instanceof Model$1&&(c=c.get("tooltip",!0)),isString$2(c)&&(c={formatter:c}),c&&(a=new Model$1(c,a,o)))}return a}function makeDispatchAction(i,r){return i.dispatchAction||bind$1(r.dispatchAction,r)}function refixTooltipPosition(i,r,n,o,a,u,c){var d=n.getSize(),f=d[0],h=d[1];return u!=null&&(i+f+u+2>o?i-=f+u:i+=u),c!=null&&(r+h+c>a?r-=h+c:r+=c),[i,r]}function confineTooltipPosition(i,r,n,o,a){var u=n.getSize(),c=u[0],d=u[1];return i=Math.min(i+c,o)-c,r=Math.min(r+d,a)-d,i=Math.max(i,0),r=Math.max(r,0),[i,r]}function calcTooltipPosition(i,r,n,o){var a=n[0],u=n[1],c=Math.ceil(Math.SQRT2*o)+8,d=0,f=0,h=r.width,y=r.height;switch(i){case"inside":d=r.x+h/2-a/2,f=r.y+y/2-u/2;break;case"top":d=r.x+h/2-a/2,f=r.y-u-c;break;case"bottom":d=r.x+h/2-a/2,f=r.y+y+c;break;case"left":d=r.x-a-c,f=r.y+y/2-u/2;break;case"right":d=r.x+h+c,f=r.y+y/2-u/2}return[d,f]}function isCenterAlign(i){return i==="center"||i==="middle"}function findComponentReference(i,r,n){var o=preParseFinder(i).queryOptionMap,a=o.keys()[0];if(!(!a||a==="series")){var u=queryReferringComponents(r,a,o.get(a),{useDefault:!1,enableAll:!1,enableNone:!1}),c=u.models[0];if(c){var d=n.getViewOfComponentModel(c),f;if(d.group.traverse(function(h){var y=getECData(h).tooltipConfig;if(y&&y.name===i.name)return f=h,!0}),f)return{componentMainType:a,componentIndex:c.componentIndex,el:f}}}}const TooltipView$1=TooltipView;function install$4(i){use(install$5),i.registerComponentModel(TooltipModel$1),i.registerComponentView(TooltipView$1),i.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},noop$1),i.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},noop$1)}var TitleModel=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n.layoutMode={type:"box",ignoreSize:!0},n}return r.type="title",r.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:"#464646"},subtextStyle:{fontSize:12,color:"#6E7079"}},r}(ComponentModel$1),TitleView=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n}return r.prototype.render=function(n,o,a){if(this.group.removeAll(),!!n.get("show")){var u=this.group,c=n.getModel("textStyle"),d=n.getModel("subtextStyle"),f=n.get("textAlign"),h=retrieve2(n.get("textBaseline"),n.get("textVerticalAlign")),y=new ZRText$1({style:createTextStyle(c,{text:n.get("text"),fill:c.getTextColor()},{disableBox:!0}),z2:10}),g=y.getBoundingRect(),p=n.get("subtext"),v=new ZRText$1({style:createTextStyle(d,{text:p,fill:d.getTextColor(),y:g.height+n.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),_=n.get("link"),b=n.get("sublink"),A=n.get("triggerEvent",!0);y.silent=!_&&!A,v.silent=!b&&!A,_&&y.on("click",function(){windowOpen(_,"_"+n.get("target"))}),b&&v.on("click",function(){windowOpen(b,"_"+n.get("subtarget"))}),getECData(y).eventData=getECData(v).eventData=A?{componentType:"title",componentIndex:n.componentIndex}:null,u.add(y),p&&u.add(v);var w=u.getBoundingRect(),T=n.getBoxLayoutParams();T.width=w.width,T.height=w.height;var S=getLayoutRect(T,{width:a.getWidth(),height:a.getHeight()},n.get("padding"));f||(f=n.get("left")||n.get("right"),f==="middle"&&(f="center"),f==="right"?S.x+=S.width:f==="center"&&(S.x+=S.width/2)),h||(h=n.get("top")||n.get("bottom"),h==="center"&&(h="middle"),h==="bottom"?S.y+=S.height:h==="middle"&&(S.y+=S.height/2),h=h||"top"),u.x=S.x,u.y=S.y,u.markRedraw();var x={align:f,verticalAlign:h};y.setStyle(x),v.setStyle(x),w=u.getBoundingRect();var L=S.margin,M=n.getItemStyle(["color","opacity"]);M.fill=n.get("backgroundColor");var O=new Rect$1({shape:{x:w.x-L[3],y:w.y-L[0],width:w.width+L[1]+L[3],height:w.height+L[0]+L[2],r:n.get("borderRadius")},style:M,subPixelOptimize:!0,silent:!0});u.add(O)}},r.type="title",r}(ComponentView$1);function install$3(i){i.registerComponentModel(TitleModel),i.registerComponentView(TitleView)}var getDefaultSelectorOptions=function(i,r){if(r==="all")return{type:"all",title:i.getLocaleModel().get(["legend","selector","all"])};if(r==="inverse")return{type:"inverse",title:i.getLocaleModel().get(["legend","selector","inverse"])}},LegendModel=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n.layoutMode={type:"box",ignoreSize:!0},n}return r.prototype.init=function(n,o,a){this.mergeDefaultAndTheme(n,a),n.selected=n.selected||{},this._updateSelector(n)},r.prototype.mergeOption=function(n,o){i.prototype.mergeOption.call(this,n,o),this._updateSelector(n)},r.prototype._updateSelector=function(n){var o=n.selector,a=this.ecModel;o===!0&&(o=n.selector=["all","inverse"]),isArray$1(o)&&each$4(o,function(u,c){isString$2(u)&&(u={type:u}),o[c]=merge(u,getDefaultSelectorOptions(a,u.type))})},r.prototype.optionUpdated=function(){this._updateData(this.ecModel);var n=this._data;if(n[0]&&this.get("selectedMode")==="single"){for(var o=!1,a=0;a<n.length;a++){var u=n[a].get("name");if(this.isSelected(u)){this.select(u),o=!0;break}}!o&&this.select(n[0].get("name"))}},r.prototype._updateData=function(n){var o=[],a=[];n.eachRawSeries(function(f){var h=f.name;a.push(h);var y;if(f.legendVisualProvider){var g=f.legendVisualProvider,p=g.getAllNames();n.isSeriesFiltered(f)||(a=a.concat(p)),p.length?o=o.concat(p):y=!0}else y=!0;y&&isNameSpecified(f)&&o.push(f.name)}),this._availableNames=a;var u=this.get("data")||o,c=createHashMap(),d=map$1(u,function(f){return(isString$2(f)||isNumber$1(f))&&(f={name:f}),c.get(f.name)?null:(c.set(f.name,!0),new Model$1(f,this,this.ecModel))},this);this._data=filter(d,function(f){return!!f})},r.prototype.getData=function(){return this._data},r.prototype.select=function(n){var o=this.option.selected,a=this.get("selectedMode");if(a==="single"){var u=this._data;each$4(u,function(c){o[c.get("name")]=!1})}o[n]=!0},r.prototype.unSelect=function(n){this.get("selectedMode")!=="single"&&(this.option.selected[n]=!1)},r.prototype.toggleSelected=function(n){var o=this.option.selected;o.hasOwnProperty(n)||(o[n]=!0),this[o[n]?"unSelect":"select"](n)},r.prototype.allSelect=function(){var n=this._data,o=this.option.selected;each$4(n,function(a){o[a.get("name",!0)]=!0})},r.prototype.inverseSelect=function(){var n=this._data,o=this.option.selected;each$4(n,function(a){var u=a.get("name",!0);o.hasOwnProperty(u)||(o[u]=!0),o[u]=!o[u]})},r.prototype.isSelected=function(n){var o=this.option.selected;return!(o.hasOwnProperty(n)&&!o[n])&&indexOf(this._availableNames,n)>=0},r.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},r.type="legend.plain",r.dependencies=["series"],r.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},r}(ComponentModel$1);const LegendModel$1=LegendModel;var curry=curry$1,each=each$4,Group$1=Group$3,LegendView=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n.newlineDisabled=!1,n}return r.prototype.init=function(){this.group.add(this._contentGroup=new Group$1),this.group.add(this._selectorGroup=new Group$1),this._isFirstRender=!0},r.prototype.getContentGroup=function(){return this._contentGroup},r.prototype.getSelectorGroup=function(){return this._selectorGroup},r.prototype.render=function(n,o,a){var u=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!n.get("show",!0)){var c=n.get("align"),d=n.get("orient");(!c||c==="auto")&&(c=n.get("left")==="right"&&d==="vertical"?"right":"left");var f=n.get("selector",!0),h=n.get("selectorPosition",!0);f&&(!h||h==="auto")&&(h=d==="horizontal"?"end":"start"),this.renderInner(c,n,o,a,f,d,h);var y=n.getBoxLayoutParams(),g={width:a.getWidth(),height:a.getHeight()},p=n.get("padding"),v=getLayoutRect(y,g,p),_=this.layoutInner(n,c,v,u,f,h),b=getLayoutRect(defaults({width:_.width,height:_.height},y),g,p);this.group.x=b.x-_.x,this.group.y=b.y-_.y,this.group.markRedraw(),this.group.add(this._backgroundEl=makeBackground(_,n))}},r.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},r.prototype.renderInner=function(n,o,a,u,c,d,f){var h=this.getContentGroup(),y=createHashMap(),g=o.get("selectedMode"),p=[];a.eachRawSeries(function(v){!v.get("legendHoverLink")&&p.push(v.id)}),each(o.getData(),function(v,_){var b=v.get("name");if(!this.newlineDisabled&&(b===""||b===`
|
243
243
|
`)){var A=new Group$1;A.newline=!0,h.add(A);return}var w=a.getSeriesByName(b)[0];if(!y.get(b)){if(w){var T=w.getData(),S=T.getVisual("legendLineStyle")||{},x=T.getVisual("legendIcon"),L=T.getVisual("style"),M=this._createItem(w,b,_,v,o,n,S,L,x,g,u);M.on("click",curry(dispatchSelectAction,b,null,u,p)).on("mouseover",curry(dispatchHighlightAction,w.name,null,u,p)).on("mouseout",curry(dispatchDownplayAction,w.name,null,u,p)),a.ssr&&M.eachChild(function(O){var ie=getECData(O);ie.seriesIndex=w.seriesIndex,ie.dataIndex=_,ie.ssrType="legend"}),y.set(b,!0)}else a.eachRawSeries(function(O){if(!y.get(b)&&O.legendVisualProvider){var ie=O.legendVisualProvider;if(!ie.containName(b))return;var $=ie.indexOfName(b),z=ie.getItemVisual($,"style"),V=ie.getItemVisual($,"legendIcon"),re=parse(z.fill);re&&re[3]===0&&(re[3]=.2,z=extend(extend({},z),{fill:stringify(re,"rgba")}));var F=this._createItem(O,b,_,v,o,n,{},z,V,g,u);F.on("click",curry(dispatchSelectAction,null,b,u,p)).on("mouseover",curry(dispatchHighlightAction,null,b,u,p)).on("mouseout",curry(dispatchDownplayAction,null,b,u,p)),a.ssr&&F.eachChild(function(pe){var le=getECData(pe);le.seriesIndex=O.seriesIndex,le.dataIndex=_,le.ssrType="legend"}),y.set(b,!0)}},this);process.env.NODE_ENV!=="production"&&(y.get(b)||console.warn(b+" series not exists. Legend data should be same with series name or data name."))}},this),c&&this._createSelector(c,o,u,d,f)},r.prototype._createSelector=function(n,o,a,u,c){var d=this.getSelectorGroup();each(n,function(h){var y=h.type,g=new ZRText$1({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){a.dispatchAction({type:y==="all"?"legendAllSelect":"legendInverseSelect"})}});d.add(g);var p=o.getModel("selectorLabel"),v=o.getModel(["emphasis","selectorLabel"]);setLabelStyle(g,{normal:p,emphasis:v},{defaultText:h.title}),enableHoverEmphasis(g)})},r.prototype._createItem=function(n,o,a,u,c,d,f,h,y,g,p){var v=n.visualDrawType,_=c.get("itemWidth"),b=c.get("itemHeight"),A=c.isSelected(o),w=u.get("symbolRotate"),T=u.get("symbolKeepAspect"),S=u.get("icon");y=S||y||"roundRect";var x=getLegendStyle(y,u,f,h,v,A,p),L=new Group$1,M=u.getModel("textStyle");if(isFunction$1(n.getLegendIcon)&&(!S||S==="inherit"))L.add(n.getLegendIcon({itemWidth:_,itemHeight:b,icon:y,iconRotate:w,itemStyle:x.itemStyle,lineStyle:x.lineStyle,symbolKeepAspect:T}));else{var O=S==="inherit"&&n.getData().getVisual("symbol")?w==="inherit"?n.getData().getVisual("symbolRotate"):w:0;L.add(getDefaultLegendIcon({itemWidth:_,itemHeight:b,icon:y,iconRotate:O,itemStyle:x.itemStyle,lineStyle:x.lineStyle,symbolKeepAspect:T}))}var ie=d==="left"?_+5:-5,$=d,z=c.get("formatter"),V=o;isString$2(z)&&z?V=z.replace("{name}",o??""):isFunction$1(z)&&(V=z(o));var re=A?M.getTextColor():u.get("inactiveColor");L.add(new ZRText$1({style:createTextStyle(M,{text:V,x:ie,y:b/2,fill:re,align:$,verticalAlign:"middle"},{inheritColor:re})}));var F=new Rect$1({shape:L.getBoundingRect(),style:{fill:"transparent"}}),pe=u.getModel("tooltip");return pe.get("show")&&setTooltipConfig({el:F,componentModel:c,itemName:o,itemTooltipOption:pe.option}),L.add(F),L.eachChild(function(le){le.silent=!0}),F.silent=!g,this.getContentGroup().add(L),enableHoverEmphasis(L),L.__legendDataIndex=a,L},r.prototype.layoutInner=function(n,o,a,u,c,d){var f=this.getContentGroup(),h=this.getSelectorGroup();box(n.get("orient"),f,n.get("itemGap"),a.width,a.height);var y=f.getBoundingRect(),g=[-y.x,-y.y];if(h.markRedraw(),f.markRedraw(),c){box("horizontal",h,n.get("selectorItemGap",!0));var p=h.getBoundingRect(),v=[-p.x,-p.y],_=n.get("selectorButtonGap",!0),b=n.getOrient().index,A=b===0?"width":"height",w=b===0?"height":"width",T=b===0?"y":"x";d==="end"?v[b]+=y[A]+_:g[b]+=p[A]+_,v[1-b]+=y[w]/2-p[w]/2,h.x=v[0],h.y=v[1],f.x=g[0],f.y=g[1];var S={x:0,y:0};return S[A]=y[A]+_+p[A],S[w]=Math.max(y[w],p[w]),S[T]=Math.min(0,p[T]+v[1-b]),S}else return f.x=g[0],f.y=g[1],this.group.getBoundingRect()},r.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},r.type="legend.plain",r}(ComponentView$1);function getLegendStyle(i,r,n,o,a,u,c){function d(A,w){A.lineWidth==="auto"&&(A.lineWidth=w.lineWidth>0?2:0),each(A,function(T,S){A[S]==="inherit"&&(A[S]=w[S])})}var f=r.getModel("itemStyle"),h=f.getItemStyle(),y=i.lastIndexOf("empty",0)===0?"fill":"stroke",g=f.getShallow("decal");h.decal=!g||g==="inherit"?o.decal:createOrUpdatePatternFromDecal(g,c),h.fill==="inherit"&&(h.fill=o[a]),h.stroke==="inherit"&&(h.stroke=o[y]),h.opacity==="inherit"&&(h.opacity=(a==="fill"?o:n).opacity),d(h,o);var p=r.getModel("lineStyle"),v=p.getLineStyle();if(d(v,n),h.fill==="auto"&&(h.fill=o.fill),h.stroke==="auto"&&(h.stroke=o.fill),v.stroke==="auto"&&(v.stroke=o.fill),!u){var _=r.get("inactiveBorderWidth"),b=h[y];h.lineWidth=_==="auto"?o.lineWidth>0&&b?2:0:h.lineWidth,h.fill=r.get("inactiveColor"),h.stroke=r.get("inactiveBorderColor"),v.stroke=p.get("inactiveColor"),v.lineWidth=p.get("inactiveWidth")}return{itemStyle:h,lineStyle:v}}function getDefaultLegendIcon(i){var r=i.icon||"roundRect",n=createSymbol(r,0,0,i.itemWidth,i.itemHeight,i.itemStyle.fill,i.symbolKeepAspect);return n.setStyle(i.itemStyle),n.rotation=(i.iconRotate||0)*Math.PI/180,n.setOrigin([i.itemWidth/2,i.itemHeight/2]),r.indexOf("empty")>-1&&(n.style.stroke=n.style.fill,n.style.fill="#fff",n.style.lineWidth=2),n}function dispatchSelectAction(i,r,n,o){dispatchDownplayAction(i,r,n,o),n.dispatchAction({type:"legendToggleSelect",name:i??r}),dispatchHighlightAction(i,r,n,o)}function isUseHoverLayer(i){for(var r=i.getZr().storage.getDisplayList(),n,o=0,a=r.length;o<a&&!(n=r[o].states.emphasis);)o++;return n&&n.hoverLayer}function dispatchHighlightAction(i,r,n,o){isUseHoverLayer(n)||n.dispatchAction({type:"highlight",seriesName:i,name:r,excludeSeriesId:o})}function dispatchDownplayAction(i,r,n,o){isUseHoverLayer(n)||n.dispatchAction({type:"downplay",seriesName:i,name:r,excludeSeriesId:o})}const LegendView$1=LegendView;function legendFilter(i){var r=i.findComponents({mainType:"legend"});r&&r.length&&i.filterSeries(function(n){for(var o=0;o<r.length;o++)if(!r[o].isSelected(n.name))return!1;return!0})}function legendSelectActionHandler(i,r,n){var o={},a=i==="toggleSelected",u;return n.eachComponent("legend",function(c){a&&u!=null?c[u?"select":"unSelect"](r.name):i==="allSelect"||i==="inverseSelect"?c[i]():(c[i](r.name),u=c.isSelected(r.name));var d=c.getData();each$4(d,function(f){var h=f.get("name");if(!(h===`
|
244
|
-
`||h==="")){var y=c.isSelected(h);o.hasOwnProperty(h)?o[h]=o[h]&&y:o[h]=y}})}),i==="allSelect"||i==="inverseSelect"?{selected:o}:{name:r.name,selected:o}}function installLegendAction(i){i.registerAction("legendToggleSelect","legendselectchanged",curry$1(legendSelectActionHandler,"toggleSelected")),i.registerAction("legendAllSelect","legendselectall",curry$1(legendSelectActionHandler,"allSelect")),i.registerAction("legendInverseSelect","legendinverseselect",curry$1(legendSelectActionHandler,"inverseSelect")),i.registerAction("legendSelect","legendselected",curry$1(legendSelectActionHandler,"select")),i.registerAction("legendUnSelect","legendunselected",curry$1(legendSelectActionHandler,"unSelect"))}function install$2(i){i.registerComponentModel(LegendModel$1),i.registerComponentView(LegendView$1),i.registerProcessor(i.PRIORITY.PROCESSOR.SERIES_FILTER,legendFilter),i.registerSubTypeDefaulter("legend",function(){return"plain"}),installLegendAction(i)}var ScrollableLegendModel=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n}return r.prototype.setScrollDataIndex=function(n){this.option.scrollDataIndex=n},r.prototype.init=function(n,o,a){var u=getLayoutParams(n);i.prototype.init.call(this,n,o,a),mergeAndNormalizeLayoutParams(this,n,u)},r.prototype.mergeOption=function(n,o){i.prototype.mergeOption.call(this,n,o),mergeAndNormalizeLayoutParams(this,this.option,n)},r.type="legend.scroll",r.defaultOption=inheritDefaultOption(LegendModel$1.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:"end",pageFormatter:"{current}/{total}",pageIcons:{horizontal:["M0,0L12,-10L12,10z","M0,0L-12,-10L-12,10z"],vertical:["M0,0L20,0L10,-20z","M0,0L20,0L10,20z"]},pageIconColor:"#2f4554",pageIconInactiveColor:"#aaa",pageIconSize:15,pageTextStyle:{color:"#333"},animationDurationUpdate:800}),r}(LegendModel$1);function mergeAndNormalizeLayoutParams(i,r,n){var o=i.getOrient(),a=[1,1];a[o.index]=0,mergeLayoutParam(r,n,{type:"box",ignoreSize:!!a})}const ScrollableLegendModel$1=ScrollableLegendModel;var Group=Group$3,WH=["width","height"],XY=["x","y"],ScrollableLegendView=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n.newlineDisabled=!0,n._currentIndex=0,n}return r.prototype.init=function(){i.prototype.init.call(this),this.group.add(this._containerGroup=new Group),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new Group)},r.prototype.resetInner=function(){i.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},r.prototype.renderInner=function(n,o,a,u,c,d,f){var h=this;i.prototype.renderInner.call(this,n,o,a,u,c,d,f);var y=this._controllerGroup,g=o.get("pageIconSize",!0),p=isArray$1(g)?g:[g,g];_("pagePrev",0);var v=o.getModel("pageTextStyle");y.add(new ZRText$1({name:"pageText",style:{text:"xx/xx",fill:v.getTextColor(),font:v.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),_("pageNext",1);function _(b,A){var w=b+"DataIndex",T=createIcon(o.get("pageIcons",!0)[o.getOrient().name][A],{onclick:bind$1(h._pageGo,h,w,o,u)},{x:-p[0]/2,y:-p[1]/2,width:p[0],height:p[1]});T.name=b,y.add(T)}},r.prototype.layoutInner=function(n,o,a,u,c,d){var f=this.getSelectorGroup(),h=n.getOrient().index,y=WH[h],g=XY[h],p=WH[1-h],v=XY[1-h];c&&box("horizontal",f,n.get("selectorItemGap",!0));var _=n.get("selectorButtonGap",!0),b=f.getBoundingRect(),A=[-b.x,-b.y],w=clone$2(a);c&&(w[y]=a[y]-b[y]-_);var T=this._layoutContentAndController(n,u,w,h,y,p,v,g);if(c){if(d==="end")A[h]+=T[y]+_;else{var S=b[y]+_;A[h]-=S,T[g]-=S}T[y]+=b[y]+_,A[1-h]+=T[v]+T[p]/2-b[p]/2,T[p]=Math.max(T[p],b[p]),T[v]=Math.min(T[v],b[v]+A[1-h]),f.x=A[0],f.y=A[1],f.markRedraw()}return T},r.prototype._layoutContentAndController=function(n,o,a,u,c,d,f,h){var y=this.getContentGroup(),g=this._containerGroup,p=this._controllerGroup;box(n.get("orient"),y,n.get("itemGap"),u?a.width:null,u?null:a.height),box("horizontal",p,n.get("pageButtonItemGap",!0));var v=y.getBoundingRect(),_=p.getBoundingRect(),b=this._showController=v[c]>a[c],A=[-v.x,-v.y];o||(A[u]=y[h]);var w=[0,0],T=[-_.x,-_.y],S=retrieve2(n.get("pageButtonGap",!0),n.get("itemGap",!0));if(b){var x=n.get("pageButtonPosition",!0);x==="end"?T[u]+=a[c]-_[c]:w[u]+=_[c]+S}T[1-u]+=v[d]/2-_[d]/2,y.setPosition(A),g.setPosition(w),p.setPosition(T);var L={x:0,y:0};if(L[c]=b?a[c]:v[c],L[d]=Math.max(v[d],_[d]),L[f]=Math.min(0,_[f]+T[1-u]),g.__rectSize=a[c],b){var M={x:0,y:0};M[c]=Math.max(a[c]-_[c]-S,0),M[d]=L[d],g.setClipPath(new Rect$1({shape:M})),g.__rectSize=M[c]}else p.eachChild(function(ie){ie.attr({invisible:!0,silent:!0})});var O=this._getPageInfo(n);return O.pageIndex!=null&&updateProps$1(y,{x:O.contentPosition[0],y:O.contentPosition[1]},b?n:null),this._updatePageInfoView(n,O),L},r.prototype._pageGo=function(n,o,a){var u=this._getPageInfo(o)[n];u!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:u,legendId:o.id})},r.prototype._updatePageInfoView=function(n,o){var a=this._controllerGroup;each$4(["pagePrev","pageNext"],function(y){var g=y+"DataIndex",p=o[g]!=null,v=a.childOfName(y);v&&(v.setStyle("fill",p?n.get("pageIconColor",!0):n.get("pageIconInactiveColor",!0)),v.cursor=p?"pointer":"default")});var u=a.childOfName("pageText"),c=n.get("pageFormatter"),d=o.pageIndex,f=d!=null?d+1:0,h=o.pageCount;u&&c&&u.setStyle("text",isString$2(c)?c.replace("{current}",f==null?"":f+"").replace("{total}",h==null?"":h+""):c({current:f,total:h}))},r.prototype._getPageInfo=function(n){var o=n.get("scrollDataIndex",!0),a=this.getContentGroup(),u=this._containerGroup.__rectSize,c=n.getOrient().index,d=WH[c],f=XY[c],h=this._findTargetItemIndex(o),y=a.children(),g=y[h],p=y.length,v=p?1:0,_={contentPosition:[a.x,a.y],pageCount:v,pageIndex:v-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!g)return _;var b=x(g);_.contentPosition[c]=-b.s;for(var A=h+1,w=b,T=b,S=null;A<=p;++A)S=x(y[A]),(!S&&T.e>w.s+u||S&&!L(S,w.s))&&(T.i>w.i?w=T:w=S,w&&(_.pageNextDataIndex==null&&(_.pageNextDataIndex=w.i),++_.pageCount)),T=S;for(var A=h-1,w=b,T=b,S=null;A>=-1;--A)S=x(y[A]),(!S||!L(T,S.s))&&w.i<T.i&&(T=w,_.pagePrevDataIndex==null&&(_.pagePrevDataIndex=w.i),++_.pageCount,++_.pageIndex),w=S;return _;function x(M){if(M){var O=M.getBoundingRect(),ie=O[f]+M[f];return{s:ie,e:ie+O[d],i:M.__legendDataIndex}}}function L(M,O){return M.e>=O&&M.s<=O+u}},r.prototype._findTargetItemIndex=function(n){if(!this._showController)return 0;var o,a=this.getContentGroup(),u;return a.eachChild(function(c,d){var f=c.__legendDataIndex;u==null&&f!=null&&(u=d),f===n&&(o=d)}),o??u},r.type="legend.scroll",r}(LegendView$1);const ScrollableLegendView$1=ScrollableLegendView;function installScrollableLegendAction(i){i.registerAction("legendScroll","legendscroll",function(r,n){var o=r.scrollDataIndex;o!=null&&n.eachComponent({mainType:"legend",subType:"scroll",query:r},function(a){a.setScrollDataIndex(o)})})}function install$1(i){use(install$2),i.registerComponentModel(ScrollableLegendModel$1),i.registerComponentView(ScrollableLegendView$1),installScrollableLegendAction(i)}function install(i){use(install$2),use(install$1)}const _sfc_main$I=vue.defineComponent({__name:"pie-charts",props:{title:{type:String,default:"标题"},seriesName:{type:String,default:"详情"},seriesData:{type:Array,default:()=>[]}},setup(i){use([install$7,install$6,install$3,install$4,install]),vue.provide(VChart.THEME_KEY,"dark");const r=i,n=vue.reactive({title:{text:r.title,left:"center"},tooltip:{trigger:"item",formatter:"{a} <br/>{b} : {c} ({d}%)"},legend:{orient:"vertical",left:"left"},series:[{name:r.seriesName,type:"pie",radius:"55%",center:["50%","60%"],data:r.seriesData,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]});return vue.watch(r,o=>{n.title.text=o.title,n.series[0].name=o.seriesName,n.series[0].data=o.seriesData}),(o,a)=>(vue.openBlock(),vue.createBlock(vue.unref(VChart),{class:"chart",option:vue.unref(n),autoresize:""},null,8,["option"]))}}),pieCharts_vue_vue_type_style_index_0_scoped_fec2cbf2_lang="",PieCharts=_export_sfc$1(_sfc_main$I,[["__scopeId","data-v-fec2cbf2"]]),_hoisted_1$g=["id"],_hoisted_2$e=["id"],_hoisted_3$b=["fill"],_hoisted_4$9=["fill"],_hoisted_5$8=["fill"],_hoisted_6$7=vue.createElementVNode("path",{d:"M375.466667 709.214815l-25.6 137.481481c0 2.844444 1.896296 5.688889 7.585185 10.42963l65.422222 54.992593c5.688889 4.740741 15.17037 8.533333 23.703704 10.429629l36.029629-193.422222-107.14074-19.911111z",fill:"#2D4375"},null,-1),_hoisted_7$7=vue.createElementVNode("path",{d:"M482.607407 729.125926l-36.029629 193.422222c9.481481 1.896296 18.014815 1.896296 25.6-0.948148l80.592592-27.496296c6.637037-1.896296 10.42963-4.740741 11.377778-6.637037L589.748148 749.037037l-107.140741-19.911111z",fill:"#1E2D4F"},null,-1),_hoisted_8$7=["fill-opacity"],_hoisted_9$6=["fill-opacity"],_hoisted_10$5=["fill-opacity"],_hoisted_11$4=vue.createElementVNode("path",{d:"M593.540741 807.822222c1.896296-7.585185-3.792593-15.17037-11.377778-16.118518l-107.140741-19.911111-4.740741 27.496296 107.140741 19.911111c6.637037 0.948148 14.222222-3.792593 16.118519-11.377778z",fill:"#CEEFF6"},null,-1),_hoisted_12$3=vue.createElementVNode("path",{d:"M366.933333 750.933333c-7.585185-1.896296-15.17037 3.792593-16.118518 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.14074 19.911111 4.740741-27.496297-107.140741-19.911111zM356.503704 808.77037c-7.585185-1.896296-15.17037 3.792593-16.118519 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.140741 19.911111 4.74074-27.496297-107.14074-19.911111z",fill:"#FFFFFF"},null,-1),_hoisted_13$3=vue.createElementVNode("path",{d:"M570.785185 848.592593l-107.140741-19.911112-4.74074 27.496297 107.14074 19.911111c7.585185 1.896296 15.17037-3.792593 16.118519-11.377778 1.896296-7.585185-2.844444-15.17037-11.377778-16.118518z",fill:"#CEEFF6"},null,-1),_hoisted_14$3=["xlink:href","width","height"],_sfc_main$H=vue.defineComponent({__name:"light-a",props:{id:{default:""},isOpen:{type:Boolean,default:!1},height:{default:100},width:{default:100}},emits:["onChange"],setup(i,{emit:r}){const n=i,o=r;return vue.watch(()=>n.isOpen,()=>{o("onChange")}),(a,u)=>(vue.openBlock(),vue.createElementBlock("g",{id:n.id,style:{cursor:"pointer"}},[vue.createElementVNode("symbol",{id:`${n.id}light-121`,viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{d:"M565.096296 289.185185s-0.948148 0 0 0c-110.933333-20.859259-208.592593 40.77037-237.985185 148.859259-14.222222 53.096296-24.651852 101.451852 44.562963 221.866667 14.222222 25.6 11.377778 70.162963 8.533333 95.762963-1.896296 14.222222 64.474074 36.02963 89.125926 42.666667l95.762963-509.155556z",fill:n.isOpen?"#FDB813":"#cccccc"},null,8,_hoisted_3$b),vue.createElementVNode("path",{d:"M732.918519 513.896296c11.377778-111.881481-56.888889-203.851852-166.874075-224.711111h-0.948148L469.333333 798.340741c25.6 2.844444 94.814815 6.637037 98.607408-7.585185 6.637037-25.6 20.859259-67.318519 42.666666-86.281482C719.644444 618.192593 727.22963 568.888889 732.918519 513.896296z",fill:n.isOpen?"#FD9B13":"#bbbbbb"},null,8,_hoisted_4$9),vue.createElementVNode("path",{d:"M467.437037 806.874074c-7.585185-0.948148-12.325926-7.585185-14.222222-14.222222l-38.874074-256c-0.948148-5.688889 0.948148-11.377778 4.74074-15.170371 3.792593-3.792593 9.481481-5.688889 15.170371-4.74074l167.822222 31.288889c5.688889 0.948148 10.42963 4.740741 12.325926 9.481481 1.896296 4.740741 1.896296 11.377778-0.948148 16.118519L486.4 798.340741c-3.792593 6.637037-11.377778 10.42963-18.962963 8.533333z m-14.222222-251.259259l27.496296 182.992592L572.681481 578.37037l-119.466666-22.755555z",fill:n.isOpen?"#F12A3F":"#666666"},null,8,_hoisted_5$8),_hoisted_6$7,_hoisted_7$7,vue.createElementVNode("path",{d:"M612.503704 217.125926c-3.792593 18.014815-20.859259 29.392593-38.874074 26.548148-18.014815-3.792593-30.340741-20.859259-26.548149-38.874074l18.962963-100.503704c3.792593-18.014815 20.859259-29.392593 38.874075-26.548148 18.014815 3.792593 30.340741 20.859259 26.548148 38.874074l-18.962963 100.503704z",fill:"#FDB813","fill-opacity":n.isOpen?1:0},null,8,_hoisted_8$7),vue.createElementVNode("path",{d:"M382.103704 228.503704c10.42963 15.17037 6.637037 36.02963-8.533334 46.459259-15.17037 10.42963-36.02963 6.637037-46.459259-8.533333l-57.837037-84.385186c-10.42963-15.17037-6.637037-36.02963 8.533333-46.459259 15.17037-10.42963 36.02963-6.637037 46.45926 8.533334l57.837037 84.385185zM757.57037 298.666667c-15.17037 10.42963-18.962963 31.288889-8.533333 46.459259 10.42963 15.17037 31.288889 18.962963 46.459259 8.533333l84.385185-57.837037c15.17037-10.42963 18.962963-31.288889 8.533334-46.459259-10.42963-15.17037-31.288889-18.962963-46.459259-8.533333l-84.385186 57.837037z",fill:"#FDB813","fill-opacity":n.isOpen?1:0},null,8,_hoisted_9$6),vue.createElementVNode("path",{d:"M252.207407 361.244444c18.014815 3.792593 30.340741 20.859259 26.548149 38.874075-3.792593 18.014815-20.859259 29.392593-38.874075 26.548148l-100.503703-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874074 3.792593-18.014815 20.859259-29.392593 38.874074-26.548149l100.503703 18.962963zM931.081481 488.296296c18.014815 3.792593 30.340741 20.859259 26.548149 38.874074-3.792593 18.014815-20.859259 29.392593-38.874074 26.548149l-100.503704-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874075 3.792593-18.014815 20.859259-29.392593 38.874074-26.548148l100.503703 18.962963z",fill:"#FDB813","fill-opacity":n.isOpen?1:0},null,8,_hoisted_10$5),_hoisted_11$4,_hoisted_12$3,_hoisted_13$3],8,_hoisted_2$e),vue.createElementVNode("use",{"xlink:href":`#${n.id}light-121`,width:a.width,height:a.height},null,8,_hoisted_14$3)],8,_hoisted_1$g))}}),_hoisted_1$f=["id"],_hoisted_2$d=["id"],_hoisted_3$a=["fill"],_hoisted_4$8=["fill"],_hoisted_5$7=["fill"],_hoisted_6$6=["from","to"],_hoisted_7$6=["fill"],_hoisted_8$6=["from","to"],_hoisted_9$5=["fill"],_hoisted_10$4=["fill"],_hoisted_11$3=["fill"],_hoisted_12$2=["from","to"],_hoisted_13$2=["fill"],_hoisted_14$2=["xlink:href"],_sfc_main$G=vue.defineComponent({__name:"clock-a",props:{id:{default:""},centerColor:{default:"#EBF257"},secondsColor:{default:"#E83E24"},circleColor:{default:"#F45AFC"},minutesColor:{default:"#50E68E"},hoursColor:{default:"#9A36E7"},scaleColor:{default:"#4942CF"},backgroundColor:{default:"#ffffff"},borderColor:{default:"#B3A7FF"}},setup(i){const r=i,n=new Date(Number(window.sessionStorage.getItem("editorLoadTime")||"0")),o=n.getSeconds()+1,a=n.getMinutes(),u=Math.floor((n.getHours()+(a+o/60)/60)*30);return(c,d)=>(vue.openBlock(),vue.createElementBlock("g",{id:r.id},[vue.createElementVNode("symbol",{id:`${r.id}clock-a-n`,viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{d:"M512.3 518.9m-469.2 0a469.2 469.2 0 1 0 938.4 0 469.2 469.2 0 1 0-938.4 0Z",fill:r.borderColor},null,8,_hoisted_3$a),vue.createElementVNode("path",{d:"M512.3 518.9m-392.5 0a392.5 392.5 0 1 0 785 0 392.5 392.5 0 1 0-785 0Z",fill:r.backgroundColor},null,8,_hoisted_4$8),vue.createElementVNode("path",{d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1L318.3 337.1c-6.8-6.8-6.8-17.9 0-24.8 6.8-6.8 17.9-6.8 24.8 0L524.7 494c6.8 6.8 6.8 17.9 0 24.8-3.5 3.3-7.9 5-12.4 5z",fill:r.minutesColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${45+vue.unref(a)*6} 512.3 506.3`,to:`${405+vue.unref(a)*6} 512.3 506.3`,dur:"3600s",repeatCount:"indefinite"},null,8,_hoisted_6$6)],8,_hoisted_5$7),vue.createElementVNode("path",{d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1-6.8-6.8-6.8-17.9 0-24.8l130.8-130.8c6.8-6.8 17.9-6.8 24.8 0 6.8 6.8 6.8 17.9 0 24.8L524.7 518.7c-3.5 3.4-7.9 5.1-12.4 5.1z",fill:r.hoursColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${-45+vue.unref(u)} 512.3 506.3`,to:`${315+vue.unref(u)} 512.3 506.3`,dur:"43200s",repeatCount:"indefinite"},null,8,_hoisted_8$6)],8,_hoisted_7$6),vue.createElementVNode("path",{d:"M512.3 506.3m-47.5 0a47.5 47.5 0 1 0 95 0 47.5 47.5 0 1 0-95 0Z",fill:r.circleColor},null,8,_hoisted_9$5),vue.createElementVNode("path",{d:"M512.3 218.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM512.3 880.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM812.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3zM150.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3z",fill:r.scaleColor},null,8,_hoisted_10$4),vue.createElementVNode("path",{d:"M296.9 733.5c-2.2 0-4.5-0.9-6.2-2.6-3.4-3.4-3.4-9 0-12.4L540 469.2c3.4-3.4 9-3.4 12.4 0 3.4 3.4 3.4 9 0 12.4L303.1 731c-1.7 1.7-4 2.5-6.2 2.5z",fill:r.secondsColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${135.5+o*6} 512.3 506.3`,to:`${495.5+o*6} 512.3 506.3`,dur:"60s",repeatCount:"indefinite"},null,8,_hoisted_12$2)],8,_hoisted_11$3),vue.createElementVNode("path",{d:"M512.3 506.3m-22.8 0a22.8 22.8 0 1 0 45.6 0 22.8 22.8 0 1 0-45.6 0Z",fill:r.centerColor},null,8,_hoisted_13$2)],8,_hoisted_2$d),vue.createElementVNode("use",{"xlink:href":`#${r.id}clock-a-n`,width:"100",height:"100"},null,8,_hoisted_14$2)],8,_hoisted_1$f))}}),_sfc_main$F=vue.defineComponent({__name:"text-box",props:{width:{default:250},height:{default:150},bgColor:{default:"#ffffff"},bgOpacity:{default:50},borderColor:{default:"#000000"},borderWidth:{default:1},borderRadius:{default:5},borderOpacity:{default:100}},setup(i){const r=i,n=vue.computed(()=>({width:(r.width>0?r.width:0)+"px",height:(r.height>0?r.height:0)+"px",borderRadius:(r.borderRadius>0?r.borderRadius:0)+"px"})),o=vue.computed(()=>({border:`${r.borderWidth>0?r.borderWidth:0}px solid ${r.borderColor}`,borderRadius:(r.borderRadius>0?r.borderRadius:0)+"px",opacity:(r.borderOpacity>0?r.borderOpacity<100?r.borderOpacity:100:0)/100})),a=vue.computed(()=>({backgroundColor:r.bgColor,opacity:(r.bgOpacity>0?r.bgOpacity<100?r.bgOpacity:100:0)/100,borderRadius:r.borderRadius+"px"}));return(u,c)=>(vue.openBlock(),vue.createElementBlock("div",{class:"outM",style:vue.normalizeStyle(n.value)},[vue.createElementVNode("div",{class:"wallI",style:vue.normalizeStyle(a.value)},null,4),vue.createElementVNode("div",{class:"borderB",style:vue.normalizeStyle(o.value)},null,4)],4))}}),textBox_vue_vue_type_style_index_0_scoped_4ab181ea_lang="",TextBox=_export_sfc$1(_sfc_main$F,[["__scopeId","data-v-4ab181ea"]]),vueComp={"svg-text":_sfc_main$L,"el-button":elementPlus.ElButton,"progress-a":_sfc_main$N,"el-tag":elementPlus.ElTag,"common-table":_sfc_main$K,"pie-charts":PieCharts,"switch-r":_sfc_main$M,"now-time":NowTime,"light-a":_sfc_main$H,"clock-a":_sfc_main$G,"text-box":TextBox},config=[...t$b,...t$1],useGlobalStore=pinia$1.defineStore("global-store",{state:()=>({config_center:config,intention:EGlobalStoreIntention.None,create_svg_info:null,done_json:[],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},handle_svg_info:null,scale_info:{type:EScaleInfoType.None,scale_times:{x:1,y:1},scale_item_info:{x:0,y:0},symmetric_point:{x:0,y:0}},rotate_info:{angle:0},connection_line_node_info:{init_pos:{x:0,y:0},point_index:0}}),actions:{setCreateInfo(i){this.intention=EGlobalStoreIntention.Create,this.create_svg_info=i},setDoneJson(i){isOfType(i,"id")?(this.done_json.push(i),vue.nextTick(()=>{setSvgActualInfo(i)})):this.done_json=objectDeepClone(i),vue.nextTick(()=>{useHistoryRecord(objectDeepClone(this.done_json))})},setHandleSvgInfo(i,r){let n=r;i?(!n&&n!=0&&(n=this.done_json.findIndex(o=>o.id===i.id)??-1),this.handle_svg_info={info:i,index:n}):this.handle_svg_info=i},spliceDoneJson(i){const r=useGlobalStore(),o=r.done_json.splice(i,1)[0];unbindAnchors(o.id),useHistoryRecord(r.done_json)}}}),useSvgEditLayoutStore=pinia$1.defineStore("svg-edit-layout-store",{state:()=>({left_nav:!0,right_nav:!0,center_offset:{x:0,y:0},canvasInfo:{with:0,height:0,top:0,left:0}})}),stopEvent=i=>{i.stopPropagation()},preventDefault=i=>{i.preventDefault()},myFixed=(i,r)=>Number(i.toFixed(r));function componentsRegister(i){var o,a;const r=vue.getCurrentInstance(),n=i?Object.assign(vueComp,i):vueComp;for(let u in n)!((o=r==null?void 0:r.appContext)!=null&&o.components.hasOwnProperty(u))&&vueComp.hasOwnProperty(u)&&((a=r==null?void 0:r.appContext)==null||a.app.component(u,vueComp[u]))}function setEditorLoadTime(){window.sessionStorage.setItem("editorLoadTime",new Date().getTime().toString())}const randomString=i=>{i=i||10;const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=r.length;let o="";for(let a=0;a<i;a++){let u=n;a===0&&(u=n-10),o+=r.charAt(Math.floor(Math.random()*u))}return o},isOfType=(i,r)=>i[r]!==void 0,getCoordinateOffset=(i,r)=>i/2*(r-1),angleToRadian=i=>i*Math.PI/180,calculateRotatedPointCoordinate=(i,r,n)=>({x:myFixed((i.x-r.x)*Math.cos(angleToRadian(n))-(i.y-r.y)*Math.sin(angleToRadian(n))+r.x,1),y:myFixed((i.x-r.x)*Math.sin(angleToRadian(n))+(i.y-r.y)*Math.cos(angleToRadian(n))+r.y,1)}),getCenterPoint=(i,r)=>({x:i.x+(r.x-i.x)/2,y:i.y+(r.y-i.y)/2}),positionArrToPath=i=>{let r="";for(let n=0;n<i.length;n++)n===0?r+=`M ${i[n].x} ${i[n].y}`:r+=` L ${i[n].x} ${i[n].y}`;return r},getSvgNowPosition=(i,r,n)=>n+(r-i),objectDeepClone=(i,r={})=>i?JSON.parse(JSON.stringify(i)):r,setSvgActualInfo=(i,r)=>{var a,u;const n=document.querySelector(`#${i.id}`),o=document.querySelector(`#rect${i.id}`);if(n){let c=0,d=0,f=0,h=0;if(i.type===EDoneJsonType.Vue){f=((a=i.props.width)==null?void 0:a.val)||n.offsetWidth||100,h=((u=i.props.height)==null?void 0:u.val)||n.offsetHeight||100,c=50-f/2,d=50-h/2;const y=document.querySelector(`#foreign-object${i.id}`);y&&(y.getAttribute("x")==="0"&&y.getAttribute("y")==="0"&&y.getAttribute("width")==="0"&&y.getAttribute("height")==="0"||r)&&(y.setAttribute("x",c.toString()),y.setAttribute("y",d.toString()),y.setAttribute("width",f.toString()),y.setAttribute("height",h.toString()))}else{const y=n.getBBox();c=myFixed(y.x,0),d=myFixed(y.y,0),f=myFixed(y.width,0),h=myFixed(y.height,0)}o&&(o.getAttribute("x")==="0"&&o.getAttribute("y")==="0"&&o.getAttribute("width")==="0"&&o.getAttribute("height")==="0"||r)&&(o.setAttribute("x",c.toString()),o.setAttribute("y",d.toString()),o.setAttribute("width",f.toString()),o.setAttribute("height",h.toString())),(i.actual_bound.x===0&&i.actual_bound.y===0&&i.actual_bound.width===0&&i.actual_bound.height===0||r)&&(i.actual_bound={x:c,y:d,width:f,height:h}),i.center_position={x:i.x+i.actual_bound.x+f/2,y:i.y+i.actual_bound.y+h/2},i.point_coordinate.tl={x:i.center_position.x-f*i.scale_x/2,y:i.center_position.y-h*i.scale_y/2},i.point_coordinate.tc={x:i.center_position.x,y:i.center_position.y-h*i.scale_y/2},i.point_coordinate.tr={x:i.center_position.x+f*i.scale_x/2,y:i.center_position.y-h*i.scale_y/2},i.point_coordinate.l={x:i.center_position.x-f*i.scale_x/2,y:i.center_position.y},i.point_coordinate.r={x:i.center_position.x+f*i.scale_x/2,y:i.center_position.y},i.point_coordinate.bl={x:i.center_position.x-f*i.scale_x/2,y:i.center_position.y+h*i.scale_y/2},i.point_coordinate.bc={x:i.center_position.x,y:i.center_position.y+h*i.scale_y/2},i.point_coordinate.br={x:i.center_position.x+f*i.scale_x/2,y:i.center_position.y+h*i.scale_y/2},i.rotate!==0&&setAfterRotationPointCoordinate(i),moveAnchors(i)}},resetHandlePointOld=i=>{for(const r of Object.keys(i.point_coordinate))i.point_coordinate_old&&(i.point_coordinate_old[r].x=0,i.point_coordinate_old[r].y=0)},moveHandlePoint=(i,r,n)=>{const o=useGlobalStore(pinia),a=r??o.mouse_info.new_position_x-o.mouse_info.position_x,u=n??o.mouse_info.new_position_y-o.mouse_info.position_y;for(const c of Object.keys(i.point_coordinate))r!==void 0&&n!==void 0?(i.point_coordinate[c].x+=a,i.point_coordinate[c].y+=u):i.point_coordinate_old&&(i.point_coordinate[c].x=i.point_coordinate_old[c].x+a,i.point_coordinate[c].y=i.point_coordinate_old[c].y+u)},moveAnchors=i=>{var n,o,a,u;const r=useGlobalStore(pinia);for(let c of r.done_json)if(c.type===EDoneJsonType.ConnectionLine){if(((o=(n=c.bind_anchors)==null?void 0:n.start)==null?void 0:o.target_id)===i.id){const d=getAnchorPosByAnchorType(c.bind_anchors.start.type,i);c.props.point_position.val[0]={x:d.x-c.x,y:d.y-c.y}}if(((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===i.id){const d=getAnchorPosByAnchorType(c.bind_anchors.end.type,i);c.props.point_position.val[c.props.point_position.val.length-1]={x:d.x-c.x,y:d.y-c.y}}}},unbindAnchors=i=>{var n,o,a,u;const r=useGlobalStore(pinia);for(let c of r.done_json)c.type===EDoneJsonType.ConnectionLine&&(((o=(n=c.bind_anchors)==null?void 0:n.start)==null?void 0:o.target_id)===i&&(c.bind_anchors.start=null),((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===i&&(c.bind_anchors.end=null))},getAnchorPosByAnchorType=(i,r)=>i===ELineBindAnchors.BottomCenter?r.point_coordinate.bc:i===ELineBindAnchors.Left?r.point_coordinate.l:i===ELineBindAnchors.Right?r.point_coordinate.r:r.point_coordinate.tc,setAfterRotationPointCoordinate=i=>{i.point_coordinate={tl:calculateRotatedPointCoordinate(i.point_coordinate.tl,i.center_position,i.rotate),tc:calculateRotatedPointCoordinate(i.point_coordinate.tc,i.center_position,i.rotate),tr:calculateRotatedPointCoordinate(i.point_coordinate.tr,i.center_position,i.rotate),l:calculateRotatedPointCoordinate(i.point_coordinate.l,i.center_position,i.rotate),r:calculateRotatedPointCoordinate(i.point_coordinate.r,i.center_position,i.rotate),bl:calculateRotatedPointCoordinate(i.point_coordinate.bl,i.center_position,i.rotate),bc:calculateRotatedPointCoordinate(i.point_coordinate.bc,i.center_position,i.rotate),br:calculateRotatedPointCoordinate(i.point_coordinate.br,i.center_position,i.rotate)}},prosToVBind=(i,r=[])=>{let n={};if(i.state){for(const o in i.state)if(i.state.hasOwnProperty(o)&&o===i.defaultState){for(let a in i.state[o])a!=="label"&&(n[lodashEs.kebabCase(a)]=i.state[o][a]);break}}for(const o in i.props)r.indexOf(o)<0&&(n[lodashEs.kebabCase(o)]=i.props[o].val);return n},setArrItemByID=(id,key,val,json_arr)=>new Promise(res=>{const find_item=json_arr.find(i=>i.id===id);find_item||res({status:!1,msg:"要设置的id不存在"}),eval(`find_item.${key} = val;`),res({status:!0,msg:"操作成功"})}),getCommonClass=i=>!i.common_animations||!i.common_animations.val?"":`common-ani animate__animated animate__${i.common_animations.val} animate__${i.common_animations.speed} animate__${i.common_animations.repeat} animate__${i.common_animations.delay}`,numberArray=i=>{let r=[];for(let n=0;n<i;n++)r.push(n);return r},getStringWidth=(i,r=12)=>{if(i.length>0){let n=document.createElement("span");n.style.fontSize=r+"px",n.style.fontFamily="inherit",n.innerHTML=i,n.style.opacity="0",n.style.position="fixed",n.style.top="3000px",document.body.append(n);const o=n.clientWidth;return document.body.removeChild(n),o}return 0},valFormat=i=>/false|true/.test(i)?i!=="false":/^\d+(\.\d+)?$/.test(i)?Number(i):i,createLine=(i,r,n)=>{i.preventDefault();const o=useGlobalStore(pinia),a=useConfigStore(pinia),u=useSvgEditLayoutStore(pinia),{clientX:c,clientY:d}=i;let f=objectDeepClone(a.connection_line),h=0,y=0;if(r&&n){f.bind_anchors.start={type:r,target_id:n.id};let p=getAnchorPosByAnchorType(r,n);h=p.x,y=p.y}else h=Math.round((c-u.canvasInfo.left)/a.svg.scale-u.center_offset.x),y=Math.round((d-u.canvasInfo.top)/a.svg.scale-u.center_offset.y);const g={id:randomString(),x:h,y,client:{x:h,y},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},...f};g.props.point_position.val.push({x:0,y:0}),o.setDoneJson(g),o.setHandleSvgInfo(g,o.done_json.length-1),o.intention=EGlobalStoreIntention.Connection,o.mouse_info={state:EMouseInfoState.Down,position_x:h,position_y:y,now_position_x:h,now_position_y:y,new_position_x:0,new_position_y:0}},getZoomPosition=(i,r,n,o)=>{const a=i.layerX,u=i.layerY,c=n.x,d=n.y,f=myFixed(o?r-.1:r+.1,1),h=myFixed(c+a*(f-1)/f,1),y=myFixed(d+u*(f-1)/f,1);n.x=myFixed(h/r-(a-h)*(r-1)/r,2),n.y=myFixed(y/r-(u-y)*(r-1)/r,2)};Object.seal({name:"straight-line",title:"直线",type:EDoneJsonType.StraightLine,config:{can_zoom:!1,have_anchor:!1,actual_rect:!1},display:!0,props:{fill:{title:"填充色",type:EConfigItemPropsType.Color,val:"#ff0000"},start_x:{title:"起点x坐标",type:EConfigItemPropsType.InputNumber,val:0},start_y:{title:"起点y坐标",type:EConfigItemPropsType.InputNumber,val:0},end_x:{title:"终点x坐标",type:EConfigItemPropsType.InputNumber,val:0},end_y:{title:"终点y坐标",type:EConfigItemPropsType.InputNumber,val:0}},bind_anchors:{start:null,end:null},events:[]});const connection_line_system={name:"connection_line",title:"连接线",type:EDoneJsonType.ConnectionLine,config:{can_zoom:!1,have_anchor:!1,actual_rect:!1},display:!0,props:{stroke:{title:"线条颜色",type:EConfigItemPropsType.Color,val:"#ff0000"},"stroke-width":{title:"线条宽度",type:EConfigItemPropsType.InputNumber,val:2},point_r:{title:"节点半径",type:EConfigItemPropsType.InputNumber,val:4},point_position:{title:"点坐标",type:EConfigItemPropsType.JsonEdit,val:[]}},animations:{type:{title:"动画类型",type:EConfigItemPropsType.Select,val:EConfigAnimationsType.None,options:[{label:"无",value:EConfigAnimationsType.None},{label:"电流",value:EConfigAnimationsType.Electricity},{label:"轨迹",value:EConfigAnimationsType.Track},{label:"水珠",value:EConfigAnimationsType.WaterDrop}]},dur:{title:"持续时间",type:EConfigItemPropsType.InputNumber,val:20},repeatCount:{title:"循环次数",type:EConfigItemPropsType.Input,val:"indefinite",disabled:!0},color:{title:"颜色",type:EConfigItemPropsType.Color,val:"#602a00"},reverse:{title:"反转动画",type:EConfigItemPropsType.Switch,val:!1}},bind_anchors:{start:null,end:null},events:[]},common_animate_list=[{label:"进入",children:[{label:"渐显",value:"fadeIn"},{label:"向右进入",value:"fadeInLeft"},{label:"向左进入",value:"fadeInRight"},{label:"向上进入",value:"fadeInUp"},{label:"向下进入",value:"fadeInDown"},{label:"向右长距进入",value:"fadeInLeftBig"},{label:"向左长距进入",value:"fadeInRightBig"},{label:"向上长距进入",value:"fadeInUpBig"},{label:"向下长距进入",value:"fadeInDownBig"},{label:"旋转进入",value:"rotateIn"},{label:"左顺时针旋转",value:"rotateInDownLeft"},{label:"右逆时针旋转",value:"rotateInDownRight"},{label:"左逆时针旋转",value:"rotateInUpLeft"},{label:"右逆时针旋转",value:"rotateInUpRight"},{label:"弹入",value:"bounceIn"},{label:"向右弹入",value:"bounceInLeft"},{label:"向左弹入",value:"bounceInRight"},{label:"向上弹入",value:"bounceInUp"},{label:"向下弹入",value:"bounceInDown"},{label:"光速从右进入",value:"lightSpeedInRight"},{label:"光速从左进入",value:"lightSpeedInLeft"},{label:"光速从右退出",value:"lightSpeedOutRight"},{label:"光速从左退出",value:"lightSpeedOutLeft"},{label:"Y轴旋转",value:"flip"},{label:"中心X轴旋转",value:"flipInX"},{label:"中心Y轴旋转",value:"flipInY"},{label:"左长半径旋转",value:"rollIn"},{label:"由小变大进入",value:"zoomIn"},{label:"左变大进入",value:"zoomInLeft"},{label:"右变大进入",value:"zoomInRight"},{label:"向上变大进入",value:"zoomInUp"},{label:"向下变大进入",value:"zoomInDown"},{label:"向右滑动展开",value:"slideInLeft"},{label:"向左滑动展开",value:"slideInRight"},{label:"向上滑动展开",value:"slideInUp"},{label:"向下滑动展开",value:"slideInDown"}]},{label:"强调",children:[{label:"弹跳",value:"bounce"},{label:"闪烁",value:"flash"},{label:"放大缩小",value:"pulse"},{label:"放大缩小弹簧",value:"rubberBand"},{label:"左右晃动",value:"headShake"},{label:"左右扇形摇摆",value:"swing"},{label:"放大晃动缩小",value:"tada"},{label:"扇形摇摆",value:"wobble"},{label:"左右上下晃动",value:"jello"},{label:"Y轴旋转",value:"flip"}]},{label:"退出",children:[{label:"渐隐",value:"fadeOut"},{label:"向左退出",value:"fadeOutLeft"},{label:"向右退出",value:"fadeOutRight"},{label:"向上退出",value:"fadeOutUp"},{label:"向下退出",value:"fadeOutDown"},{label:"向左长距退出",value:"fadeOutLeftBig"},{label:"向右长距退出",value:"fadeOutRightBig"},{label:"向上长距退出",value:"fadeOutUpBig"},{label:"向下长距退出",value:"fadeOutDownBig"},{label:"旋转退出",value:"rotateOut"},{label:"左顺时针旋转",value:"rotateOutDownLeft"},{label:"右逆时针旋转",value:"rotateOutDownRight"},{label:"左逆时针旋转",value:"rotateOutUpLeft"},{label:"右逆时针旋转",value:"rotateOutUpRight"},{label:"弹出",value:"bounceOut"},{label:"向左弹出",value:"bounceOutLeft"},{label:"向右弹出",value:"bounceOutRight"},{label:"向上弹出",value:"bounceOutUp"},{label:"向下弹出",value:"bounceOutDown"},{label:"中心X轴旋转",value:"flipOutX"},{label:"中心Y轴旋转",value:"flipOutY"},{label:"左长半径旋转",value:"rollOut"},{label:"由小变大退出",value:"zoomOut"},{label:"左变大退出",value:"zoomOutLeft"},{label:"右变大退出",value:"zoomOutRight"},{label:"向上变大退出",value:"zoomOutUp"},{label:"向下变大退出",value:"zoomOutDown"},{label:"向左滑动收起",value:"slideOutLeft"},{label:"向右滑动收起",value:"slideOutRight"},{label:"向上滑动收起",value:"slideOutUp"},{label:"向下滑动收起",value:"slideOutDown"}]}];let l=localStorage.getItem("svg-editor-config"),s,t;if(l){let i=JSON.parse(l);t=i.connection_line,s=i.svg}else t=objectDeepClone(connection_line_system),s={background_color:"#fff",scale:1,grid:!0,grid_color:"#ebebeb",ruler:!0};const useConfigStore=pinia$1.defineStore("config-store",{state:()=>({svg:s,connection_line:t,net:{mqtt:{url:"",user:"",pwd:"",topics:""}}}),getters:{},actions:{}});var EContextMenuInfoType=(i=>(i.Copy="Copy",i.Delete="Delete",i.MoveUpOneLevel="MoveUpOneLevel",i.MoveDownOneLevel="MoveDownOneLevel",i.MoveUpTopLevel="MoveUpTopLevel",i.MoveDownTopLevel="MoveDownTopLevel",i))(EContextMenuInfoType||{});const useEditPrivateStore=pinia$1.defineStore("edit-private-store",{state:()=>({old_done_components:[],history_doneComponent:[],history_now_index:0,is_record_history:!0,max_record_times:10}),getters:{getTopBtnUndoStatus(i){return i.history_now_index>=1},getTopBtnRedoStatus(i){return i.history_now_index+1!=i.history_doneComponent.length}},actions:{topUndoBtnClick(){if(console.log("撤销"),this.history_now_index<1)return;const i=useGlobalStore();this.is_record_history=!1,this.history_now_index-=1,i.setDoneJson(this.history_doneComponent[this.history_now_index])},topRedoBtnClick(){if(console.log("重做"),this.history_now_index+1==this.history_doneComponent.length)return;const i=useGlobalStore();this.is_record_history=!1,this.history_now_index+=1,i.setDoneJson(this.history_doneComponent[this.history_now_index])}}}),useContextMenuStore=pinia$1.defineStore("context-menu-store",{state:()=>({display:!1,info:{[EContextMenuInfoType.Copy]:{title:"复制",hot_key:"Ctrl + c",enable:!0},[EContextMenuInfoType.Delete]:{title:"删除",hot_key:"Delete",enable:!0},[EContextMenuInfoType.MoveUpTopLevel]:{title:"置于顶层",hot_key:"Ctrl + →",enable:!0},[EContextMenuInfoType.MoveDownTopLevel]:{title:"置于底层",hot_key:"Ctrl + ←",enable:!0},[EContextMenuInfoType.MoveUpOneLevel]:{title:"置于上一层",hot_key:"Ctrl + ↑",enable:!0},[EContextMenuInfoType.MoveDownOneLevel]:{title:"置于下一层",hot_key:"Ctrl + ↓",enable:!0}}}),actions:{onContextMenuClick(i){const r=useGlobalStore();if(r.handle_svg_info)switch(r.intention=EGlobalStoreIntention.Select,i){case EContextMenuInfoType.Copy:const n=objectDeepClone(r.handle_svg_info.info);n.id=randomString(),n.title+="-copy",n.x+=10,n.y+=10,r.setDoneJson(n),this.display=!1,r.setHandleSvgInfo(n,r.done_json.length);break;case EContextMenuInfoType.Delete:r.spliceDoneJson(r.handle_svg_info.index),this.display=!1,r.setHandleSvgInfo(null),r.intention=EGlobalStoreIntention.None;break;case EContextMenuInfoType.MoveUpOneLevel:if(r.done_json.length===1||r.handle_svg_info.index===r.done_json.length-1)return;const o=r.handle_svg_info.info;r.done_json[r.handle_svg_info.index]=r.done_json[r.handle_svg_info.index+1],r.done_json[r.handle_svg_info.index+1]=o,useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(o,r.handle_svg_info.index+1);break;case EContextMenuInfoType.MoveDownOneLevel:if(r.done_json.length===1||r.handle_svg_info.index===0)return;const a=r.handle_svg_info.info;r.done_json[r.handle_svg_info.index]=r.done_json[r.handle_svg_info.index-1],r.done_json[r.handle_svg_info.index-1]=a,useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(a,r.handle_svg_info.index-1);break;case EContextMenuInfoType.MoveDownTopLevel:if(r.done_json.length===1||r.handle_svg_info.index===0)return;const u=r.handle_svg_info.info;r.done_json.splice(r.handle_svg_info.index,1),r.done_json.unshift(u),useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(u,0);break;case EContextMenuInfoType.MoveUpTopLevel:if(r.done_json.length===1||r.handle_svg_info.index===r.done_json.length)return;const c=r.handle_svg_info.info;r.done_json.splice(r.handle_svg_info.index,1),r.done_json.push(c),useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(c,r.done_json.length-1);break}}}}),pinia=pinia$1.createPinia(),useHistoryRecord=i=>{const r=useEditPrivateStore();r.is_record_history&&(r.history_now_index+1<r.history_doneComponent.length&&r.history_doneComponent.splice(r.history_now_index+1),r.history_doneComponent.push(i),r.history_now_index=r.history_doneComponent.length-1,r.history_doneComponent.length>r.max_record_times&&(r.history_doneComponent.shift(),r.history_now_index=r.history_doneComponent.length-1)),r.is_record_history=!0},useImportDataModel=i=>{try{const r=JSON.parse(i);if(!r.config||!r.layout_center||!r.done_json)return elementPlus.ElMessage.error("请导入正确的数据模型!"),!1;const n=useGlobalStore(pinia),o=useSvgEditLayoutStore(pinia),a=useConfigStore(pinia);return a.$state=r.config,o.center_offset=r.layout_center,n.setDoneJson(r.done_json),!0}catch(r){return elementPlus.ElMessage.error("请导入正确的数据模型!"),console.error(r),!1}},_hoisted_1$e={"aria-hidden":"true"},_hoisted_2$c=["xlink:href"],_sfc_main$E=vue.defineComponent({__name:"svg-analysis",props:{name:{},props:{default:()=>({})}},setup(i){const r=i,n=vue.computed(()=>`#svg-${r.name}`);return(o,a)=>(vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$e,[vue.createElementVNode("use",vue.mergeProps({"xlink:href":vue.unref(n)},r.props),null,16,_hoisted_2$c)]))}});var EVisibleConfKey=(i=>(i.ImportJson="ImportJson",i.ExportJson="ExportJson",i.ImportFile="ImportFile",i))(EVisibleConfKey||{});const _withScopeId$2=i=>(vue.pushScopeId("data-v-01c79e12"),i=i(),vue.popScopeId(),i),_hoisted_1$d={class:"flex justify-between",style:{width:"100%"}},_hoisted_2$b={class:"flex items-center justify-between",style:{width:"250px"}},_hoisted_3$9=_withScopeId$2(()=>vue.createElementVNode("div",{class:"flex items-center"},[vue.createElementVNode("span",{class:"logo-title"},"Svg Editor")],-1)),_hoisted_4$7={class:"flex justify-between",style:{width:"calc(100% - 440px)"}},_hoisted_5$6={class:"flex items-center"},_hoisted_6$5={class:"flex items-center mr-20px"},_hoisted_7$5={class:"flex items-center",style:{width:"250px"}},_hoisted_8$5=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title",style:{"padding-top":"16px"}},"多选",-1)),_hoisted_9$4=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区域按住鼠标左键可以框选(图形坐标在框选区域即判定被选中),也可以按住ctrl+鼠标左键点图形进行多选",-1)),_hoisted_10$3=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_11$2=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"拖动画布",-1)),_hoisted_12$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区域按住右键可拖动画布,右侧面板‘图纸’栏可微调或重置位置",-1)),_hoisted_13$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_14$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"画布缩放",-1)),_hoisted_15$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区使用鼠标滚轮或者右侧面板‘图纸’栏可控制画布缩放",-1)),_hoisted_16$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_17$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"标尺辅助线",-1)),_hoisted_18$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"在标尺区域按住鼠标左键并拖动即可创建标尺辅助线,将标尺辅助线拖动到标尺区域即可删除标尺辅助线",-1)),_hoisted_19=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_20=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"组件尺寸",-1)),_hoisted_21=_withScopeId$2(()=>vue.createElementVNode("div",null,[vue.createElementVNode("p",null," 大多数组件可以通过选中组件然后拖动交互点或在右侧‘外观’栏改变外形尺寸,或通过右侧‘数据’栏直接或间接改变外形尺寸;"),vue.createElementVNode("p",null,"少数特殊组件仅可通过右侧'数据'栏直接或间接改变外形尺寸")],-1)),_hoisted_22=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_23=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"连线样式",-1)),_hoisted_24=_withScopeId$2(()=>vue.createElementVNode("div",null,"在右侧‘连线’栏可以统一配置连线样式,配置后先增加的线会应用新样式,之前的线样式不变,如需改变,可选中线手动更改或删除重画 ",-1)),_hoisted_25=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_26=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"横线和竖线",-1)),_hoisted_27=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null," 点击编辑器顶部连线按钮会进入连线状态,该状态下在画板点击鼠标左键即可开始画线,移动并再次点击左键创建新的节点,右键结束画线并退出连线状态;"),vue.createElementVNode("p",null,"画线的时候按住ctrl即可画竖线,按住shift即可画横线")],-1)),_hoisted_28=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_29=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"绑定锚点",-1)),_hoisted_30=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null,"组件在未选中时,鼠标经过组件时会出现锚点,鼠标悬浮在锚点上时,会有交互样式,点击左键即可以锚点为起点创建连线;"),vue.createElementVNode("p",null,"同样,在连线时鼠标经过锚点时,会出现锚点交互样式,点击左键即可以锚点为连线终点结束连线;"),vue.createElementVNode("p",null,"这两种情况下的连线会绑定组件上的锚点,如需解绑,参考下面的‘锚点解绑’;"),vue.createElementVNode("p",null,"同样,也可先画线,再选中连线绑定想要绑定的组件锚点(连线只有首尾节点可以绑定锚点)")],-1)),_hoisted_31=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_32=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"线段选中",-1)),_hoisted_33=_withScopeId$2(()=>vue.createElementVNode("div",null," 若线段绑定了锚点,移动线段,绑定的锚点不会移动。若是想将线段整体移动,需要先解绑,参考下面的‘锚点解绑’ ",-1)),_hoisted_34=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_35=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"锚点解绑",-1)),_hoisted_36=_withScopeId$2(()=>vue.createElementVNode("div",{style:{"padding-bottom":"14px"}}," 选中线段,在右侧‘数据’栏里解除绑定;或者鼠标左键拖拽连线上需要解绑的节点",-1)),_sfc_main$D=vue.defineComponent({__name:"top-panel",emits:["changeVisible","onReturn","onPreview","onSave"],setup(i,{emit:r}){const n=useSvgEditLayoutStore(pinia),o=useGlobalStore(pinia),a=useEditPrivateStore(pinia),u=useConfigStore(pinia),c=r,d=()=>{o.done_json.length<=0||o.setDoneJson([]),o.intention=EGlobalStoreIntention.None},f=g=>{const p={layout_center:n.center_offset,config:u.$state,done_json:o.done_json};c(g,p)},h=vue.ref(!1),y=vue.computed({get:()=>o.intention===EGlobalStoreIntention.Connection,set(g){o.intention=g?EGlobalStoreIntention.Connection:EGlobalStoreIntention.None,g&&o.setHandleSvgInfo(null)}});return(g,p)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$d,[vue.createElementVNode("div",_hoisted_2$b,[_hoisted_3$9,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:p[0]||(p[0]=v=>vue.unref(n).left_nav=!vue.unref(n).left_nav),title:vue.unref(n).left_nav?"隐藏左侧菜单":"显示左侧菜单"},{default:vue.withCtx(()=>[vue.unref(n).left_nav?(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:0,name:"menu-unfold"})):(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:1,name:"menu-fold"}))]),_:1},8,["title"])]),vue.createElementVNode("div",_hoisted_4$7,[vue.createElementVNode("div",_hoisted_5$6,[vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"撤销 ctrl+z",size:24,class:vue.normalizeClass(`${vue.unref(a).getTopBtnUndoStatus?"bt-Icon":"icon-disable"} ml-20px`),onClick:p[1]||(p[1]=()=>vue.unref(a).topUndoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(a).getTopBtnUndoStatus?"undo":"undo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"重做 ctrl+shift+z",class:vue.normalizeClass(`${vue.unref(a).getTopBtnRedoStatus?"bt-Icon":"icon-disable"} ml-5px`),size:24,onClick:p[2]||(p[2]=()=>vue.unref(a).topRedoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(a).getTopBtnRedoStatus?"redo":"redo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"清空 ctrl+delete",class:vue.normalizeClass(vue.unref(o).done_json.length>0?"bt-Icon":"icon-disable"),size:24,onClick:d},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(o).done_json.length>0?"delete":"delete-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"导入数据模型",class:"bt-Icon",size:24,onClick:p[3]||(p[3]=v=>c("changeVisible",vue.unref(EVisibleConfKey).ImportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"import"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"导出数据模型",size:24,class:"bt-Icon ml-5px",onClick:p[4]||(p[4]=v=>c("changeVisible",vue.unref(EVisibleConfKey).ExportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"export"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"创建连线",class:vue.normalizeClass(["bt-Icon",{active:vue.unref(y)}]),size:24,onClick:p[5]||(p[5]=v=>y.value=!vue.unref(y))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(y)?"line-active":"line"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"说明",class:"bt-Icon",size:24,onClick:p[6]||(p[6]=v=>h.value=!vue.unref(h))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"question"})]),_:1})]),vue.createElementVNode("div",_hoisted_6$5,[vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"返回",class:"bt-Icon",size:24,onClick:p[7]||(p[7]=v=>f("onReturn"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"return"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"保存",class:"bt-Icon",size:24,onClick:p[8]||(p[8]=v=>f("onSave"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"save"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"预览",class:"bt-Icon",size:22,onClick:p[9]||(p[9]=v=>f("onPreview"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"preview"})]),_:1})])]),vue.createElementVNode("div",_hoisted_7$5,[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:p[10]||(p[10]=v=>vue.unref(n).right_nav=!vue.unref(n).right_nav),title:vue.unref(n).right_nav?"隐藏右侧菜单":"显示右侧菜单"},{default:vue.withCtx(()=>[vue.unref(n).right_nav?(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:0,name:"menu-fold"})):(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:1,name:"menu-unfold"}))]),_:1},8,["title"])])]),vue.createVNode(vue.unref(elementPlus.ElDialog),{modelValue:vue.unref(h),"onUpdate:modelValue":p[11]||(p[11]=v=>vue.isRef(h)?h.value=v:null),title:"使用说明",width:"60%"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{"max-height":"60vh"},{default:vue.withCtx(()=>[_hoisted_8$5,_hoisted_9$4,_hoisted_10$3,_hoisted_11$2,_hoisted_12$1,_hoisted_13$1,_hoisted_14$1,_hoisted_15$1,_hoisted_16$1,_hoisted_17$1,_hoisted_18$1,_hoisted_19,_hoisted_20,_hoisted_21,_hoisted_22,_hoisted_23,_hoisted_24,_hoisted_25,_hoisted_26,_hoisted_27,_hoisted_28,_hoisted_29,_hoisted_30,_hoisted_31,_hoisted_32,_hoisted_33,_hoisted_34,_hoisted_35,_hoisted_36]),_:1})]),_:1},8,["modelValue"])],64))}}),topPanel_vue_vue_type_style_index_0_scoped_01c79e12_lang="",TopPanel=_export_sfc$1(_sfc_main$D,[["__scopeId","data-v-01c79e12"]]),_hoisted_1$c={class:"component-group flex flex-wrap"},_hoisted_2$a=["onDragstart","title"],_sfc_main$C=vue.defineComponent({__name:"left-panel",props:{customToolbar:{}},setup(i){const r=useGlobalStore(pinia),n=i,o=vue.ref(n.customToolbar&&Object.keys(n.customToolbar).length>0?n.customToolbar:r.config_center),a=vue.ref(["stateful","stateless","have_animation","custom_svg_group","element-ui","custom-vue","echarts"]),u=f=>{r.setCreateInfo(c(f))},c=f=>(f!=null&&f.props&&!lodashEs.isEmpty(f.props)&&Object.keys(f.props).forEach((h,y)=>{f.props[h].sort=String(y)}),f),d=f=>{var h;if(((h=f.dataTransfer)==null?void 0:h.dropEffect)!=="copy"){elementPlus.ElMessage.warning("请将组件拖到画布中!"),r.intention=EGlobalStoreIntention.None;return}};return(f,h)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElCollapse),{modelValue:vue.unref(a),"onUpdate:modelValue":h[0]||(h[0]=y=>vue.isRef(a)?a.value=y:null),style:{"border-top":"none"}},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(o),y=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElCollapseItem),{name:y.groupType,key:y.title},{title:vue.withCtx(()=>[vue.createElementVNode("div",null,vue.toDisplayString(y.title),1)]),default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$c,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(y.list,g=>(vue.openBlock(),vue.createElementBlock("div",{class:"ideal",key:g.name,draggable:"true",onDragstart:p=>u(g),onDragend:d,title:g.title},[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:35,class:"flex items-center"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:g.name,props:vue.unref(prosToVBind)(g,["width","height","maxHeight"])},null,8,["name","props"])]),_:2},1024)],40,_hoisted_2$a))),128))])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]))}}),leftPanel_vue_vue_type_style_index_0_scoped_8aba8565_lang="",LeftPanel=_export_sfc$1(_sfc_main$C,[["__scopeId","data-v-8aba8565"]]),calculateLeftTop=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate(r,o,-n);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightTop=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate(r,o,-n);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightBottom=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(r,o,-n),u=calculateRotatedPointCoordinate(i,o,-n);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateLeftBottom=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(r,o,-n),u=calculateRotatedPointCoordinate(i,o,-n);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateTop=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateRight=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},calculateBottom=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateLeft=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},_hoisted_1$b={style:{"vector-effect":"non-scaling-stroke"}},_hoisted_2$9=["fill","x","y"],_hoisted_3$8=["cx","cy"],_hoisted_4$6=["x1","y1","x2","y2"],_hoisted_5$5=["fill","x","y"],_hoisted_6$4=["fill","x","y"],_hoisted_7$4=["fill","x","y"],_hoisted_8$4=["fill","x","y"],_hoisted_9$3=["fill","x","y"],_hoisted_10$2=["fill","x","y"],_hoisted_11$1=["fill","x","y"],_sfc_main$B=vue.defineComponent({__name:"handle-panel",props:{itemInfo:{}},setup(i){vue.useCssVars(p=>({"5c831aea":vue.unref(c)}));const r=i,n=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=vue.ref(4),c=vue.ref("#ab712e"),d=[{start:338,end:23,cursor:"nw",type:EScaleInfoType.TopLeft},{start:23,end:68,cursor:"n",type:EScaleInfoType.TopCenter},{start:68,end:113,cursor:"ne",type:EScaleInfoType.TopRight},{start:293,end:338,cursor:"w",type:EScaleInfoType.Left},{start:113,end:158,cursor:"e",type:EScaleInfoType.Right},{start:248,end:293,cursor:"sw",type:EScaleInfoType.BottomLeft},{start:203,end:248,cursor:"s",type:EScaleInfoType.BottomCenter},{start:158,end:203,cursor:"se",type:EScaleInfoType.BottomRight}],f=vue.computed(()=>r.itemInfo.config.can_zoom),h=(p,v)=>{console.log("handMousedown",v);const{clientX:_,clientY:b}=v;v.stopPropagation(),n.intention=EGlobalStoreIntention.Zoom;const A=Math.round((_-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),w=Math.round((b-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);n.mouse_info={state:EMouseInfoState.Down,position_x:A,position_y:w,now_position_x:A,now_position_y:w,new_position_x:0,new_position_y:0},n.scale_info={type:p,scale_times:{x:r.itemInfo.scale_x,y:r.itemInfo.scale_y},scale_item_info:{x:r.itemInfo.x,y:r.itemInfo.y},symmetric_point:{x:A+Math.abs(A-r.itemInfo.center_position.x)*2*(A>r.itemInfo.center_position.x?-1:1),y:w+Math.abs(w-r.itemInfo.center_position.y)*2*(w>r.itemInfo.center_position.y?-1:1)}}},y=p=>{const{clientX:v,clientY:_}=p,b=Math.round((v-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),A=Math.round((_-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);p.stopPropagation(),n.intention=EGlobalStoreIntention.Rotate,n.rotate_info={angle:r.itemInfo.rotate},n.mouse_info={state:EMouseInfoState.Down,position_x:b,position_y:A,now_position_x:b,now_position_y:A,new_position_x:0,new_position_y:0}},g=p=>{const v=(p+r.itemInfo.rotate)%360,_=d.find(b=>b.start<=v&&b.end>v);return _?{cursor:_.cursor+"-resize",type:_.type}:{cursor:"nw-resize",type:EScaleInfoType.TopLeft}};return(p,v)=>(vue.openBlock(),vue.createElementBlock("g",_hoisted_1$b,[vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tl",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(0).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[0]||(v[0]=_=>h(vue.unref(EScaleInfoType).TopLeft,_))},null,44,_hoisted_2$9),[[vue.vShow,vue.unref(f)]]),vue.createElementVNode("circle",{cx:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2,cy:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)-24,r:4,class:"rotate-circle",onMousedown:y},null,40,_hoisted_3$8),vue.createElementVNode("line",{x1:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2,y1:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),x2:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2,y2:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)-20,style:vue.normalizeStyle({stroke:vue.unref(c),"stroke-width":2})},null,12,_hoisted_4$6),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tc",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(45).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2-vue.unref(u),y:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[1]||(v[1]=_=>h(vue.unref(EScaleInfoType).TopCenter,_))},null,44,_hoisted_5$5),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tr",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(90).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width-vue.unref(u)+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[2]||(v[2]=_=>h(vue.unref(EScaleInfoType).TopRight,_))},null,44,_hoisted_6$4),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_l",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(315).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[3]||(v[3]=_=>h(vue.unref(EScaleInfoType).Left,_))},null,44,_hoisted_7$4),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_r",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(135).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)+r.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[4]||(v[4]=_=>h(vue.unref(EScaleInfoType).Right,_))},null,44,_hoisted_8$4),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_bl",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(270).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height*r.itemInfo.scale_y-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[5]||(v[5]=_=>h(vue.unref(EScaleInfoType).BottomLeft,_))},null,44,_hoisted_9$3),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_bc",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(225).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)+r.itemInfo.actual_bound.width/2,y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[6]||(v[6]=_=>h(vue.unref(EScaleInfoType).BottomCenter,_))},null,44,_hoisted_10$2),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_br",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(180).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)+r.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[7]||(v[7]=_=>h(vue.unref(EScaleInfoType).BottomRight,_))},null,44,_hoisted_11$1),[[vue.vShow,vue.unref(f)]])]))}}),handlePanel_vue_vue_type_style_index_0_scoped_e6622df8_lang="",HandlePanel=_export_sfc$1(_sfc_main$B,[["__scopeId","data-v-e6622df8"]]),_hoisted_1$a=["fill"],_hoisted_2$8=["cx","cy","r"],_hoisted_3$7=["cx","cy","r"],_hoisted_4$5=["cx","cy","r"],_hoisted_5$4=["cx","cy","r"],_hoisted_6$3=["cx","cy","r"],_hoisted_7$3=["cx","cy","r"],_hoisted_8$3=["cx","cy","r"],_hoisted_9$2=["cx","cy","r"],_sfc_main$A=vue.defineComponent({__name:"connection-panel",props:{itemInfo:{}},setup(i){const r=i,n=vue.ref(4),o=vue.ref("#ab712e"),a=vue.ref(4),u=vue.ref(12),c=useGlobalStore(pinia),d=useSvgEditLayoutStore(pinia),f=vue.computed(()=>r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2-n.value+a.value),h=vue.computed(()=>r.itemInfo.actual_bound.y-n.value-getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),y=vue.computed(()=>r.itemInfo.actual_bound.x-n.value+r.itemInfo.actual_bound.width+getCoordinateOffset(r.itemInfo.actual_bound.width,r.itemInfo.scale_x)+a.value),g=vue.computed(()=>r.itemInfo.actual_bound.y-n.value+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),p=vue.computed(()=>r.itemInfo.actual_bound.x-n.value+r.itemInfo.actual_bound.width/2+a.value),v=vue.computed(()=>r.itemInfo.actual_bound.y-n.value+r.itemInfo.actual_bound.height+getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),_=vue.computed(()=>r.itemInfo.actual_bound.x-n.value-getCoordinateOffset(r.itemInfo.actual_bound.width,r.itemInfo.scale_x)+a.value),b=vue.computed(()=>r.itemInfo.actual_bound.y-n.value+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),A=(T,S)=>{var x;c.intention===EGlobalStoreIntention.SetConnectionLineNode&&(T.stopPropagation(),(x=c.handle_svg_info)!=null&&x.info.bind_anchors&&c.connection_line_node_info&&(c.connection_line_node_info.point_index===0?c.handle_svg_info.info.bind_anchors.start={type:S,target_id:r.itemInfo.id}:c.connection_line_node_info.point_index===c.handle_svg_info.info.props.point_position.val.length-1&&(c.handle_svg_info.info.bind_anchors.end={type:S,target_id:r.itemInfo.id}),c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(r.itemInfo)})))},w=(T,S)=>{var x;c.intention===EGlobalStoreIntention.None?(createLine(T,S,r.itemInfo),c.handle_svg_info&&(c.handle_svg_info.info.props.point_position.val.length!==1?c.handle_svg_info.info.props.point_position.val.push({x:c.mouse_info.new_position_x-c.mouse_info.position_x-d.center_offset.x,y:c.mouse_info.new_position_y-c.mouse_info.position_y-d.center_offset.y}):c.handle_svg_info.info.props.point_position.val.push({x:0,y:0}))):c.intention===EGlobalStoreIntention.Connection&&(T.stopPropagation(),(x=c.handle_svg_info)!=null&&x.info.bind_anchors&&(c.handle_svg_info.info.bind_anchors.end={type:S,target_id:r.itemInfo.id},c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(r.itemInfo)})))};return(T,S)=>(vue.openBlock(),vue.createElementBlock("g",{style:{"vector-effect":"non-scaling-stroke"},class:"connect-points",fill:vue.unref(o),"stroke-width":"2",stroke:"rgba(0,0,0,0)"},[vue.createElementVNode("g",{onMousedown:S[0]||(S[0]=x=>w(x,vue.unref(ELineBindAnchors).TopCenter)),onMouseup:S[1]||(S[1]=x=>A(x,vue.unref(ELineBindAnchors).TopCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(f),cy:vue.unref(h),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_2$8),vue.createElementVNode("circle",{id:"connection_tc",cx:vue.unref(f),cy:vue.unref(h),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_3$7)],32),vue.createElementVNode("g",{onMousedown:S[2]||(S[2]=x=>w(x,vue.unref(ELineBindAnchors).Right)),onMouseup:S[3]||(S[3]=x=>A(x,vue.unref(ELineBindAnchors).Right))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(y),cy:vue.unref(g),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_4$5),vue.createElementVNode("circle",{id:"connection_r",cx:vue.unref(y),cy:vue.unref(g),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_5$4)],32),vue.createElementVNode("g",{onMousedown:S[4]||(S[4]=x=>w(x,vue.unref(ELineBindAnchors).BottomCenter)),onMouseup:S[5]||(S[5]=x=>A(x,vue.unref(ELineBindAnchors).BottomCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(p),cy:vue.unref(v),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_6$3),vue.createElementVNode("circle",{id:"connection_bc",cx:vue.unref(p),cy:vue.unref(v),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_7$3)],32),vue.createElementVNode("g",{onMousedown:S[6]||(S[6]=x=>w(x,vue.unref(ELineBindAnchors).Left)),onMouseup:S[7]||(S[7]=x=>A(x,vue.unref(ELineBindAnchors).Left))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(_),cy:vue.unref(b),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_8$3),vue.createElementVNode("circle",{id:"connection_l",cx:vue.unref(_),cy:vue.unref(b),r:vue.unref(a),style:{cursor:"crosshair"},"pointer-events":"all"},null,8,_hoisted_9$2)],32)],8,_hoisted_1$a))}}),connectionPanel_vue_vue_type_style_index_0_scoped_fb729c7a_lang="",ConnectionPanel=_export_sfc$1(_sfc_main$A,[["__scopeId","data-v-fb729c7a"]]),_hoisted_1$9=["d","stroke-width"],_hoisted_2$7=["d","stroke-width"],_hoisted_3$6=["id","d","stroke","stroke-width","stroke-dasharray"],_hoisted_4$4=["from","to","dur","repeatCount"],_hoisted_5$3=["d","stroke","stroke-width","stroke-dasharray"],_hoisted_6$2=["from","to","dur","repeatCount"],_hoisted_7$2=["r","fill"],_hoisted_8$2=["path","dur","repeatCount"],_hoisted_9$1=["cx","cy","r","stroke-width"],_hoisted_10$1=["cx","cy","r","stroke","onMousedown"],_sfc_main$z=vue.defineComponent({__name:"connection-line",props:{itemInfo:{},pointVisible:{type:Boolean,default:!1}},setup(i){const r=i,n=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=(c,d,f,h)=>{if(n.intention===EGlobalStoreIntention.Connection)return;n.setHandleSvgInfo(r.itemInfo);const{clientX:y,clientY:g}=d;d.stopPropagation(),n.connection_line_node_info={init_pos:{x:f,y:h},point_index:c},n.intention=EGlobalStoreIntention.SetConnectionLineNode,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((y-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((g-a.canvasInfo.top)/o.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0}};return(c,d)=>{var f,h,y,g,p,v;return vue.openBlock(),vue.createElementBlock("g",{style:vue.normalizeStyle({cursor:vue.unref(n).intention===vue.unref(EGlobalStoreIntention).Connection?"crosshair":"move"})},[vue.withDirectives(vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#DE4517","stroke-width":Math.ceil(r.itemInfo.props["stroke-width"].val*1.2)+1,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_1$9),[[vue.vShow,r.itemInfo.selected||r.itemInfo.id===((f=vue.unref(n).handle_svg_info)==null?void 0:f.info.id)]]),vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#fff","stroke-opacity":".01","stroke-width":r.itemInfo.props["stroke-width"].val,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_2$7),vue.createElementVNode("path",{id:r.itemInfo.id,d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none",stroke:((h=r.itemInfo.animations)==null?void 0:h.type.val)===vue.unref(EConfigAnimationsType).Electricity?r.itemInfo.animations.color.val:r.itemInfo.props.stroke.val,"stroke-width":r.itemInfo.props["stroke-width"].val,"stroke-dashoffset":"0","stroke-dasharray":((y=r.itemInfo.animations)==null?void 0:y.type.val)===vue.unref(EConfigAnimationsType).Electricity?r.itemInfo.props["stroke-width"].val*3:0,"stroke-linejoin":"round"},[((g=r.itemInfo.animations)==null?void 0:g.type.val)===vue.unref(EConfigAnimationsType).Electricity?(vue.openBlock(),vue.createElementBlock("animate",{key:0,attributeName:"stroke-dashoffset",from:r.itemInfo.animations.reverse.val?0:1e3,to:r.itemInfo.animations.reverse.val?1e3:0,dur:`${r.itemInfo.animations.dur.val}s`,repeatCount:r.itemInfo.animations.repeatCount.val},null,8,_hoisted_4$4)):vue.createCommentVNode("",!0)],8,_hoisted_3$6),((p=r.itemInfo.animations)==null?void 0:p.type.val)===vue.unref(EConfigAnimationsType).WaterDrop?(vue.openBlock(),vue.createElementBlock("path",{key:0,d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:r.itemInfo.animations.color.val,"stroke-width":r.itemInfo.props["stroke-width"].val,"stroke-dasharray":r.itemInfo.props["stroke-width"].val*3,"stroke-dashoffset":"0","stroke-linecap":"round","stroke-linejoin":"round"},[vue.createElementVNode("animate",{attributeName:"stroke-dashoffset",from:r.itemInfo.animations.reverse.val?0:1e3,to:r.itemInfo.animations.reverse.val?1e3:0,dur:`${r.itemInfo.animations.dur.val}s`,repeatCount:r.itemInfo.animations.repeatCount.val,fill:"freeze"},null,8,_hoisted_6$2)],8,_hoisted_5$3)):((v=r.itemInfo.animations)==null?void 0:v.type.val)===vue.unref(EConfigAnimationsType).Track?(vue.openBlock(),vue.createElementBlock("circle",{key:1,cx:"0",cy:"0",r:Math.ceil(r.itemInfo.props["stroke-width"].val*.6)+2,fill:r.itemInfo.animations.color.val},[vue.createElementVNode("animateMotion",{path:vue.unref(positionArrToPath)(r.itemInfo.animations.reverse.val?[...r.itemInfo.props.point_position.val].reverse():r.itemInfo.props.point_position.val),dur:`${r.itemInfo.animations.dur.val}s`,repeatCount:r.itemInfo.animations.repeatCount.val},null,8,_hoisted_8$2)],8,_hoisted_7$2)):vue.createCommentVNode("",!0),vue.createElementVNode("g",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.itemInfo.props.point_position.val,(_,b)=>{var A;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("circle",{key:b,cx:_.x,cy:_.y,r:r.itemInfo.props.point_r.val+1,fill:"none","fill-opacity":"0","stroke-width":Math.ceil(r.itemInfo.props.point_r.val*.2)+1,stroke:"#DE4517"},null,8,_hoisted_9$1)),[[vue.vShow,r.itemInfo.selected||r.itemInfo.id===((A=vue.unref(n).handle_svg_info)==null?void 0:A.info.id)]])}),128)),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.itemInfo.props.point_position.val,(_,b)=>(vue.openBlock(),vue.createElementBlock("circle",{key:b,cx:_.x,cy:_.y,r:r.itemInfo.props.point_r.val,"stroke-width":"1",stroke:r.itemInfo.props.stroke.val,fill:"#fff",style:{cursor:"pointer"},onMousedown:A=>u(b,A,_.x,_.y)},null,40,_hoisted_10$1))),128))])],4)}}}),_hoisted_1$8={class:"coverLayer"},_hoisted_2$6={xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%"},_hoisted_3$5={id:"pattern_grid",patternUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},_hoisted_4$3=["stroke"],_hoisted_5$2=["stroke"],_hoisted_6$1=["stroke"],_hoisted_7$1=["stroke"],_hoisted_8$1={key:0,width:"100%",height:"100%",fill:"url(#pattern_grid)"},_hoisted_9=["transform"],_hoisted_10=["transform"],_hoisted_11=["transform","onMousedown","onMouseup","onMouseenter","onMouseleave","onContextmenu"],_hoisted_12=["xlink:href","width","height","id","transform"],_hoisted_13=["id"],_hoisted_14=["id","x1","y1","x2","y2"],_hoisted_15=["id"],_hoisted_16=["x","y","height","width"],_hoisted_17=["onClick"],_hoisted_18={class:"shortcut"},_sfc_main$y=vue.defineComponent({__name:"center-panel",props:{vueComp:{}},setup(i,{expose:r}){vue.useCssVars(Ie=>({"32de9888":vue.unref(g)}));const n=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=useEditPrivateStore(pinia),c=useContextMenuStore(pinia);componentsRegister(i.vueComp);const f=vue.ref(),h=vue.ref(),y={MoveCanvas:"grab",Rotate:"url('/src/assets/icons/rotate.svg'), auto",Connection:"crosshair",SetConnectionLineNode:"crosshair"},g=vue.computed(()=>Object.keys(y).indexOf(n.intention)>-1?y[n.intention]:"default"),p=vue.reactive({handle_panel:vue.computed(()=>n.intention===EGlobalStoreIntention.Select||n.intention===EGlobalStoreIntention.Zoom||n.intention===EGlobalStoreIntention.Rotate),connection_panel:!1,connection_line:!1,select_item:{info:null,index:-1}}),v=vue.ref({a:{x:0,y:0},b:{x:0,y:0}}),_=vue.computed(()=>n.intention===EGlobalStoreIntention.SelectArea&&v.value.b.x&&v.value.b.y?{with:Math.abs(v.value.b.x-v.value.a.x),height:Math.abs(v.value.b.y-v.value.a.y),x:v.value.a.x<v.value.b.x?v.value.a.x:v.value.b.x,y:v.value.a.y<v.value.b.y?v.value.a.y:v.value.b.y}:{with:0,height:0,x:0,y:0}),b=vue.computed(()=>{let Ie=0;for(let At of n.done_json)At.selected&&Ie++;return Ie>0});let A=!1,w=!1;const T=Ie=>{var At;if(n.intention!=EGlobalStoreIntention.None){if(n.intention==EGlobalStoreIntention.Create){if(!n.create_svg_info){console.error("要创建的数据获取失败");return}const _e=Math.floor(Ie.offsetX/o.svg.scale-a.center_offset.x),qe=Math.floor(Ie.offsetY/o.svg.scale-a.center_offset.y),In={id:randomString(),x:_e,y:qe,client:{x:_e,y:qe},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},selected:!1,...objectDeepClone(n.create_svg_info)};n.setDoneJson(In),n.setHandleSvgInfo(In,n.done_json.length),n.intention=EGlobalStoreIntention.None}(At=h.value)==null||At.focus()}},S=Ie=>{Ie.preventDefault()},x=Ie=>{Ie.preventDefault()},L=(Ie,At,_e)=>{var qe,In,vn;if((qe=h.value)==null||qe.focus(),n.intention===EGlobalStoreIntention.Connection){_e.stopPropagation();return}if(_e.preventDefault(),_e.stopPropagation(),_e.ctrlKey&&_e.button===0)((In=n.handle_svg_info)!=null&&In.index||((vn=n.handle_svg_info)==null?void 0:vn.index)===0)&&(n.done_json[n.handle_svg_info.index].selected=!0,n.setHandleSvgInfo(null),n.intention=EGlobalStoreIntention.None),Ie.selected=!Ie.selected;else if(b.value){n.intention=EGlobalStoreIntention.GroupMove,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((_e.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0};for(let Pt of n.done_json)Pt.selected&&(Pt.old_position={x:Pt.x,y:Pt.y},Pt.point_coordinate_old=objectDeepClone(Pt.point_coordinate))}else n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo(Ie,At),n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((_e.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:Ie.x,now_position_y:Ie.y,new_position_x:0,new_position_y:0},Ie.point_coordinate_old=objectDeepClone(Ie.point_coordinate)},M=(Ie,At,_e)=>{if(!(n.intention===EGlobalStoreIntention.Connection||n.mouse_info.state!=EMouseInfoState.Down)&&b.value&&!A&&["SelectArea","Move","Select"].indexOf(n.intention)<0){for(let qe of n.done_json)qe.selected=!1,qe.old_position={x:0,y:0},resetHandlePointOld(qe);n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo(Ie,At),n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((_e.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:Ie.x,now_position_y:Ie.y,new_position_x:0,new_position_y:0}}},O=(Ie,At,_e)=>{_e.preventDefault(),_e.stopPropagation(),p.connection_panel=!0,p.connection_line=!0,!((n.intention===EGlobalStoreIntention.Connection||n.intention===EGlobalStoreIntention.SetConnectionLineNode)&&Ie.type===EDoneJsonType.ConnectionLine)&&(p.select_item.info=Ie,p.select_item.index=At)},ie=(Ie,At,_e)=>{_e.preventDefault(),_e.stopPropagation(),!((n.intention===EGlobalStoreIntention.Connection||n.intention===EGlobalStoreIntention.SetConnectionLineNode)&&Ie.type===EDoneJsonType.ConnectionLine)&&(p.connection_panel=!1,p.connection_line=!1,p.select_item.info=null,p.select_item.index=-1)},$=Ie=>{var vn,Pt,he,Ue,Dt,jt,Et,Ce,ue,$e,Ne,Oe,Lt,kt,Cn,oe;if(n.mouse_info.state!=EMouseInfoState.Down&&n.intention!==EGlobalStoreIntention.Connection)return;const{clientX:At,clientY:_e}=Ie;n.mouse_info.new_position_x=Math.round((At-a.canvasInfo.left)/o.svg.scale),n.mouse_info.new_position_y=Math.round((_e-a.canvasInfo.top)/o.svg.scale);const qe=Math.round(n.mouse_info.new_position_x-n.mouse_info.position_x+n.mouse_info.now_position_x),In=Math.round(n.mouse_info.new_position_y-n.mouse_info.position_y+n.mouse_info.now_position_y);if((vn=n.handle_svg_info)!=null&&vn.info&&(n.intention===EGlobalStoreIntention.Select||n.intention===EGlobalStoreIntention.Move)){if(n.handle_svg_info.info.x=qe,n.handle_svg_info.info.y=In,n.handle_svg_info.info.client={x:qe,y:In},n.intention=EGlobalStoreIntention.Move,moveHandlePoint(n.handle_svg_info.info),moveAnchors(n.handle_svg_info.info),n.handle_svg_info.info.type===EDoneJsonType.ConnectionLine){if((Pt=n.handle_svg_info.info.bind_anchors)!=null&&Pt.start){let ae=null;for(let Y of n.done_json)Y.id===((Ue=(he=n.handle_svg_info.info.bind_anchors)==null?void 0:he.start)==null?void 0:Ue.target_id)&&(ae=Y);ae&&moveAnchors(ae)}if((Dt=n.handle_svg_info.info.bind_anchors)!=null&&Dt.end){let ae=null;for(let Y of n.done_json)Y.id===((Et=(jt=n.handle_svg_info.info.bind_anchors)==null?void 0:jt.end)==null?void 0:Et.target_id)&&(ae=Y);ae&&moveAnchors(ae)}}}else if(n.intention===EGlobalStoreIntention.MoveCanvas)a.center_offset.x=qe,a.center_offset.y=In;else if(n.intention===EGlobalStoreIntention.SelectArea)v.value.b.x=n.mouse_info.new_position_x-a.center_offset.x,v.value.b.y=n.mouse_info.new_position_y-a.center_offset.y;else if(n.intention===EGlobalStoreIntention.GroupMove){A=!0;for(let ae of n.done_json)if(ae.selected&&ae.old_position){const Y=Math.round(n.mouse_info.new_position_x-n.mouse_info.position_x+ae.old_position.x),k=Math.round(n.mouse_info.new_position_y-n.mouse_info.position_y+ae.old_position.y);if(ae.x=Y,ae.y=k,ae.client={x:Y,y:k},moveHandlePoint(ae),moveAnchors(ae),ae.type===EDoneJsonType.ConnectionLine&&((Ce=ae.bind_anchors)!=null&&Ce.end)){let D=null;for(let j of n.done_json)j.id===(($e=(ue=ae.bind_anchors)==null?void 0:ue.end)==null?void 0:$e.target_id)&&(D=j);D&&moveAnchors(D)}}}else if(n.intention===EGlobalStoreIntention.Zoom){if(!n.handle_svg_info)return;const ae={x:n.mouse_info.new_position_x-a.center_offset.x,y:n.mouse_info.new_position_y-a.center_offset.y};let Y={width:0,height:0,is_old_width:!1,is_old_height:!1};if(n.scale_info.type===EScaleInfoType.TopLeft?Y=calculateLeftTop(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.TopRight?Y=calculateRightTop(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.BottomRight?Y=calculateRightBottom(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.BottomLeft?Y=calculateLeftBottom(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.TopCenter?Y=calculateTop(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client):n.scale_info.type===EScaleInfoType.Right?Y=calculateRight(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client):n.scale_info.type===EScaleInfoType.BottomCenter?Y=calculateBottom(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client):n.scale_info.type===EScaleInfoType.Left&&(Y=calculateLeft(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client)),n.handle_svg_info&&Y.width>0&&Y.height>0){const k=Y.is_old_width?1:myFixed(Y.width/n.handle_svg_info.info.actual_bound.width,3),D=Y.is_old_height?1:myFixed(Y.height/n.handle_svg_info.info.actual_bound.height,3),j=getCenterPoint(ae,n.scale_info.symmetric_point);k>0&&n.scale_info.type!==EScaleInfoType.TopCenter&&n.scale_info.type!==EScaleInfoType.BottomCenter&&(n.handle_svg_info.info.scale_x=k,n.handle_svg_info.info.x=Math.round(getSvgNowPosition(n.handle_svg_info.info.center_position.x,j.x,n.handle_svg_info.info.client.x))),D>0&&n.scale_info.type!==EScaleInfoType.Left&&n.scale_info.type!==EScaleInfoType.Right&&(n.handle_svg_info.info.scale_y=D,n.handle_svg_info.info.y=Math.round(getSvgNowPosition(n.handle_svg_info.info.center_position.y,j.y,n.handle_svg_info.info.client.y)))}}else if(n.intention===EGlobalStoreIntention.Rotate){if(!n.handle_svg_info)return;const ae=Math.atan2(n.mouse_info.position_y-n.handle_svg_info.info.y,n.mouse_info.position_x-n.handle_svg_info.info.x)/(Math.PI/180),Y=Math.atan2(n.mouse_info.new_position_y-a.center_offset.y-n.handle_svg_info.info.y,n.mouse_info.new_position_x-a.center_offset.x-n.handle_svg_info.info.x)/(Math.PI/180);n.handle_svg_info.info.rotate=myFixed(n.rotate_info.angle+Y-ae,2)}else if(n.intention===EGlobalStoreIntention.Connection&&n.handle_svg_info){const ae=(Ne=n.handle_svg_info)==null?void 0:Ne.info.props.point_position.val.length,Y=n.mouse_info.new_position_x-n.mouse_info.position_x-a.center_offset.x,k=n.mouse_info.new_position_y-n.mouse_info.position_y-a.center_offset.y,D=n.handle_svg_info.info.props.point_position.val[ae-2],j=((Lt=(Oe=n.handle_svg_info)==null?void 0:Oe.info.props.point_r)==null?void 0:Lt.val)+2||4;let xe=D.x<Y?-j:D.x>Y?j:0,hn=D.y<k?-j:D.y>k?j:0;Ie.ctrlKey?n.handle_svg_info.info.props.point_position.val[ae-1]={x:D.x,y:k+hn}:Ie.shiftKey?n.handle_svg_info.info.props.point_position.val[ae-1]={x:Y+xe,y:D.y}:n.handle_svg_info.info.props.point_position.val[ae-1]={x:Y+xe,y:k+hn}}else if(n.intention===EGlobalStoreIntention.SetConnectionLineNode&&n.handle_svg_info){!w&&(n.connection_line_node_info.point_index===n.handle_svg_info.info.props.point_position.val.length-1||n.connection_line_node_info.point_index===0)&&(w=!0);const ae=(kt=n.handle_svg_info)==null?void 0:kt.info.props.point_position.val.length,Y=getSvgNowPosition(n.mouse_info.position_x,n.mouse_info.new_position_x,n.connection_line_node_info.init_pos.x),k=getSvgNowPosition(n.mouse_info.position_y,n.mouse_info.new_position_y,n.connection_line_node_info.init_pos.y),D=n.handle_svg_info.info.props.point_position.val[ae-2],j=((oe=(Cn=n.handle_svg_info)==null?void 0:Cn.info.props.point_r)==null?void 0:oe.val)+2||4;let xe=D.x<Y?-j:D.x>Y?j:0,hn=D.y<k?-j:D.y>k?j:0;n.handle_svg_info.info.props.point_position.val[n.connection_line_node_info.point_index]={x:Y+xe,y:k+hn}}},z=()=>{var Ie,At,_e,qe;if(n.mouse_info.state==EMouseInfoState.Down){if((Ie=n.handle_svg_info)!=null&&Ie.info&&n.intention==EGlobalStoreIntention.Move)setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.intention=EGlobalStoreIntention.None,n.setDoneJson(n.done_json);else if(n.intention==EGlobalStoreIntention.GroupMove)A&&(A=!1,n.intention=EGlobalStoreIntention.None);else if((At=n.handle_svg_info)!=null&&At.info&&n.intention==EGlobalStoreIntention.Zoom)n.handle_svg_info.info.client={x:n.handle_svg_info.info.x,y:n.handle_svg_info.info.y},n.intention=EGlobalStoreIntention.None,setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.setDoneJson(n.done_json);else if(n.intention===EGlobalStoreIntention.Rotate&&((_e=n.handle_svg_info)!=null&&_e.info))setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.setDoneJson(n.done_json),n.intention=EGlobalStoreIntention.None;else{if(n.intention===EGlobalStoreIntention.Connection)return;if(n.intention===EGlobalStoreIntention.SetConnectionLineNode)w&&((qe=n.handle_svg_info)!=null&&qe.info.bind_anchors)&&(n.connection_line_node_info.point_index===0?n.handle_svg_info.info.bind_anchors.start=null:n.handle_svg_info.info.bind_anchors.end=null),n.intention=EGlobalStoreIntention.None,w=!1;else if(n.intention===EGlobalStoreIntention.SelectArea){n.setHandleSvgInfo(null);for(let In of n.done_json){const vn=_.value;In.selected=In.x>vn.x&&In.x<vn.x+vn.with&&In.y>vn.y&&In.y<vn.y+vn.height}n.intention=EGlobalStoreIntention.None}else n.intention!=EGlobalStoreIntention.Select&&(n.intention=EGlobalStoreIntention.None)}n.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},c.display=!1}},V=Ie=>{const{clientX:At,clientY:_e}=Ie;if(n.intention===EGlobalStoreIntention.Connection){n.handle_svg_info||createLine(Ie),n.handle_svg_info&&(Ie.button===0?n.handle_svg_info.info.props.point_position.val.length!==1?n.handle_svg_info.info.props.point_position.val.push({x:n.mouse_info.new_position_x-n.mouse_info.position_x-a.center_offset.x,y:n.mouse_info.new_position_y-n.mouse_info.position_y-a.center_offset.y}):n.handle_svg_info.info.props.point_position.val.push({x:0,y:0}):Ie.button===2&&(n.intention=EGlobalStoreIntention.None,setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.setHandleSvgInfo(null)));return}Ie.button===0?(n.intention=EGlobalStoreIntention.SelectArea,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((At-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),position_y:Math.round((_e-a.canvasInfo.top)/o.svg.scale-a.center_offset.y),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},v.value={a:{x:n.mouse_info.position_x,y:n.mouse_info.position_y},b:{x:0,y:0}}):Ie.button===2&&(n.intention=EGlobalStoreIntention.MoveCanvas,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((At-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e-a.canvasInfo.top)/o.svg.scale),now_position_x:a.center_offset.x,now_position_y:a.center_offset.y,new_position_x:0,new_position_y:0})};function re(Ie){Ie!=null&&Ie.wheelDelta&&(Ie.wheelDelta>0?(o.svg.scale=myFixed(o.svg.scale+.1,1),getZoomPosition(Ie,o.svg.scale,a.center_offset,!0)):o.svg.scale>.1&&(o.svg.scale=myFixed(o.svg.scale-.1,1),getZoomPosition(Ie,o.svg.scale,a.center_offset,!1)))}const F=Ie=>{Ie.stopPropagation(),Ie.preventDefault()},pe=(Ie,At,_e)=>{n.intention!==EGlobalStoreIntention.Connection&&f.value&&(n.intention=EGlobalStoreIntention.ContextMenu,n.setHandleSvgInfo(Ie,At),f.value.style.left=_e.pageX+"px",f.value.style.top=_e.pageY+"px",c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!0,At===n.done_json.length-1&&(c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=!1),At===0&&(c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!1),c.display=!0)},le=(Ie,At,_e)=>({x:myFixed(Ie.x-Ie.width/2*At+Ie.width/2,1),y:myFixed(Ie.y-Ie.height/2*_e+Ie.height/2,1),width:myFixed(Ie.width*At,1),height:myFixed(Ie.height*_e,1)}),de=Ie=>{Ie.preventDefault();let At=[];if(!Ie.ctrlKey&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].indexOf(Ie.key)>-1&&(b.value?At=n.done_json.map((_e,qe)=>({selected:_e.selected,i:qe})).filter(_e=>_e.selected).map(_e=>_e.i):n.handle_svg_info&&At.push(n.handle_svg_info.index)),!Ie.ctrlKey&&Ie.key=="ArrowUp"){for(let _e of At)n.done_json[_e].y-=1,n.done_json[_e].client.y-=1,moveHandlePoint(n.done_json[_e],0,-1),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else if(!Ie.ctrlKey&&Ie.key=="ArrowDown"){for(let _e of At)n.done_json[_e].y+=1,n.done_json[_e].client.y+=1,moveHandlePoint(n.done_json[_e],0,1),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else if(!Ie.ctrlKey&&Ie.key=="ArrowLeft"){for(let _e of At)n.done_json[_e].x-=1,n.done_json[_e].client.x-=1,moveHandlePoint(n.done_json[_e],-1,0),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else if(!Ie.ctrlKey&&Ie.key=="ArrowRight"){for(let _e of At)n.done_json[_e].x+=1,n.done_json[_e].client.x+=1,moveHandlePoint(n.done_json[_e],1,0),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else Ie.ctrlKey&&Ie.key.toLowerCase()=="c"?c.onContextMenuClick(EContextMenuInfoType.Copy):!Ie.ctrlKey&&Ie.key=="Delete"?b.value?(n.setDoneJson(n.done_json.filter(_e=>!_e.selected)),n.setHandleSvgInfo(n.done_json[n.done_json.length-1],n.done_json.length-1)):c.onContextMenuClick(EContextMenuInfoType.Delete):Ie.ctrlKey&&Ie.key=="ArrowUp"?c.onContextMenuClick(EContextMenuInfoType.MoveUpOneLevel):Ie.ctrlKey&&Ie.key=="ArrowDown"?c.onContextMenuClick(EContextMenuInfoType.MoveDownOneLevel):Ie.ctrlKey&&Ie.key=="ArrowLeft"?c.onContextMenuClick(EContextMenuInfoType.MoveDownTopLevel):Ie.ctrlKey&&Ie.key=="ArrowRight"?c.onContextMenuClick(EContextMenuInfoType.MoveUpTopLevel):Ie.ctrlKey&&Ie.shiftKey&&Ie.key.toLowerCase()=="z"?u.topRedoBtnClick():Ie.ctrlKey&&Ie.key.toLowerCase()=="z"?u.topUndoBtnClick():Ie.ctrlKey&&Ie.key.toLowerCase()=="delete"&&(n.done_json.length<=0||n.setDoneJson([]))},Fe=()=>{setSvgActualInfo(n.done_json[n.handle_svg_info.index],!0)};return vue.onMounted(()=>{var Ie;(Ie=h.value)==null||Ie.focus(),vue.nextTick(function(){var _e;const At=(_e=h.value)==null?void 0:_e.getBoundingClientRect();a.canvasInfo={height:(At==null?void 0:At.height)||0,with:(At==null?void 0:At.width)||0,top:(At==null?void 0:At.top)||0,left:(At==null?void 0:At.left)||0}})}),r({onCanvasMouseUp:z}),(Ie,At)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",{ref_key:"canvasRef",ref:h,class:"canvas",style:vue.normalizeStyle({backgroundColor:vue.unref(o).svg.background_color,position:"relative"}),tabindex:"0",onDrop:T,onDragenter:S,onDragover:x,onMousedown:V,onMousemove:$,onMouseup:z,onContextmenu:F,onKeydown:de,onMousewheel:re},[vue.renderSlot(Ie.$slots,"background",{},void 0,!0),vue.createElementVNode("div",_hoisted_1$8,[(vue.openBlock(),vue.createElementBlock("svg",_hoisted_2$6,[vue.createElementVNode("defs",null,[vue.createElementVNode("pattern",_hoisted_3$5,[vue.createElementVNode("line",{x1:"0",y1:"0",x2:"0",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_4$3),vue.createElementVNode("line",{x1:"10",y1:"0",x2:"10",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_5$2),vue.createElementVNode("line",{x1:"0",y1:"0",x2:"20",y2:"0",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_6$1),vue.createElementVNode("line",{x1:"0",y1:"10",x2:"20",y2:"10",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_7$1)])]),vue.unref(o).svg.grid?(vue.openBlock(),vue.createElementBlock("rect",_hoisted_8$1)):vue.createCommentVNode("",!0),vue.createElementVNode("g",{transform:`translate(${vue.unref(a).center_offset.x*vue.unref(o).svg.scale},${vue.unref(a).center_offset.y*vue.unref(o).svg.scale})rotate(0)scale(${vue.unref(o).svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(n).done_json,(_e,qe)=>{var In,vn,Pt,he,Ue,Dt,jt,Et,Ce,ue,$e,Ne,Oe,Lt;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:_e.id,transform:`translate(${_e.x},${_e.y})rotate(0)scale(1)`},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(_e)}`)},[vue.createElementVNode("g",{transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2})rotate(${_e.rotate}) scale(1) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`,onMousedown:kt=>L(_e,qe,kt),onMouseup:kt=>M(_e,qe,kt),onMouseenter:kt=>O(_e,qe,kt),onMouseleave:kt=>ie(_e,qe,kt),onContextmenu:kt=>pe(_e,qe,kt)},[_e.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$z,{key:0,"item-info":_e,"point-visible":vue.unref(p).connection_line&&((In=vue.unref(p).select_item.info)==null?void 0:In.id)==_e.id},null,8,["item-info","point-visible"])):_e.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${_e.name}`,ref_for:!0},vue.unref(prosToVBind)(_e,["height","width"]),{width:((Pt=(vn=_e.props)==null?void 0:vn.width)==null?void 0:Pt.val)??100,height:((Ue=(he=_e.props)==null?void 0:he.height)==null?void 0:Ue.val)??100,id:_e.id,transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2}) scale(${_e.scale_x},${_e.scale_y}) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`}),null,16,_hoisted_12)):_e.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(_e.tag),vue.mergeProps({key:2,ref_for:!0},vue.unref(prosToVBind)(_e,["height","width"]),{width:((jt=(Dt=_e.props)==null?void 0:Dt.width)==null?void 0:jt.val)??100,height:((Ce=(Et=_e.props)==null?void 0:Et.height)==null?void 0:Ce.val)??100,id:_e.id,onResize:Fe,transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2}) scale(${_e.scale_x},${_e.scale_y}) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`}),null,16,["width","height","id","transform"])):_e.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3,ref_for:!0},le(_e.actual_bound,_e.scale_x,_e.scale_y),{id:`foreign-object${_e.id}`,class:"foreignObject"}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(_e.tag),vue.mergeProps({ref_for:!0},vue.unref(prosToVBind)(_e),{id:_e.id,transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2}) scale(${_e.scale_x},${_e.scale_y}) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(_e.tag_slot),1)]),_:2},1040,["id","transform"]))],16,_hoisted_13)):_e.type===vue.unref(EDoneJsonType).StraightLine?(vue.openBlock(),vue.createElementBlock("line",{key:4,id:_e.id,x1:_e.props.start_x.val,y1:_e.props.start_y.val,x2:_e.props.end_x.val,y2:_e.props.end_y.val,fill:"#FF0000",stroke:"#FF0000","stroke-width":"2"},null,8,_hoisted_14)):vue.createCommentVNode("",!0),_e.config.actual_rect?(vue.openBlock(),vue.createElementBlock("rect",vue.mergeProps({key:5,id:`rect${_e.id}`,fill:"black","fill-opacity":"0",ref_for:!0},le(_e.actual_bound,_e.scale_x,_e.scale_y),{style:{stroke:"none","stroke-width":"2","stroke-miterlimit":"10"},class:{"svg-item-none":!_e.selected&&(vue.unref(n).intention==vue.unref(EGlobalStoreIntention).None||vue.unref(n).intention==vue.unref(EGlobalStoreIntention).Select),"svg-item-move":vue.unref(n).intention==vue.unref(EGlobalStoreIntention).Move&&((ue=vue.unref(n).handle_svg_info)==null?void 0:ue.info.id)==_e.id,"svg-item-select":vue.unref(n).intention==vue.unref(EGlobalStoreIntention).Select&&(($e=vue.unref(n).handle_svg_info)==null?void 0:$e.info.id)==_e.id,"svg-item-in-group":_e.selected}}),null,16,_hoisted_15)):vue.createCommentVNode("",!0),((Ne=vue.unref(n).handle_svg_info)==null?void 0:Ne.info.id)===_e.id&&vue.unref(p).handle_panel&&_e.type!==vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(HandlePanel,{key:6,"item-info":_e},null,8,["item-info"])):vue.createCommentVNode("",!0),!_e.selected&&((Oe=vue.unref(p).select_item.info)==null?void 0:Oe.id)==_e.id&&vue.unref(p).connection_panel&&_e.config.have_anchor&&vue.unref(n).intention!==vue.unref(EGlobalStoreIntention).SelectArea&&(vue.unref(n).intention!==vue.unref(EGlobalStoreIntention).Select||_e.id!==((Lt=vue.unref(n).handle_svg_info)==null?void 0:Lt.info.id))?(vue.openBlock(),vue.createBlock(ConnectionPanel,{key:7,onContextmenu:F,"item-info":_e},null,8,["item-info"])):vue.createCommentVNode("",!0)],40,_hoisted_11)],2)],8,_hoisted_10)),[[vue.vShow,_e.display]])}),128)),vue.createElementVNode("rect",{x:vue.unref(_).x,y:vue.unref(_).y,height:vue.unref(_).height,width:vue.unref(_).with,stroke:"#107cec",fill:"#107cec","fill-opacity":".2"},null,8,_hoisted_16)],8,_hoisted_9)]))])],36),vue.withDirectives(vue.createElementVNode("ul",{ref_key:"contextMenuRef",ref:f,class:"contextMenu"},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(c).info,(_e,qe)=>(vue.openBlock(),vue.createElementBlock("li",{key:_e.title,onClick:In=>vue.unref(c).onContextMenuClick(qe)},[vue.createElementVNode("p",{class:vue.normalizeClass(_e.enable?"":"disabled")},[vue.createTextVNode(vue.toDisplayString(_e.title)+" ",1),vue.createElementVNode("span",_hoisted_18,vue.toDisplayString(_e.hot_key),1)],2)],8,_hoisted_17))),128))],512),[[vue.vShow,vue.unref(c).display]])],64))}}),centerPanel_vue_vue_type_style_index_0_scoped_1b085626_lang="",CenterPanel=_export_sfc$1(_sfc_main$y,[["__scopeId","data-v-1b085626"]]);/*! Element Plus Icons Vue v2.3.1 */var aim_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Aim",__name:"aim",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"}),vue.createElementVNode("path",{fill:"currentColor",d:"M512 96a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V128a32 32 0 0 1 32-32m0 576a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V704a32 32 0 0 1 32-32M96 512a32 32 0 0 1 32-32h192a32 32 0 0 1 0 64H128a32 32 0 0 1-32-32m576 0a32 32 0 0 1 32-32h192a32 32 0 1 1 0 64H704a32 32 0 0 1-32-32"})]))}}),aim_default=aim_vue_vue_type_script_setup_true_lang_default,arrow_down_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"ArrowDown",__name:"arrow-down",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"})]))}}),arrow_down_default=arrow_down_vue_vue_type_script_setup_true_lang_default,circle_check_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"CircleCheck",__name:"circle-check",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"}),vue.createElementVNode("path",{fill:"currentColor",d:"M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"})]))}}),circle_check_default=circle_check_vue_vue_type_script_setup_true_lang_default,circle_close_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"CircleClose",__name:"circle-close",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"}),vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"})]))}}),circle_close_default=circle_close_vue_vue_type_script_setup_true_lang_default,close_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Close",__name:"close",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}}),close_default=close_vue_vue_type_script_setup_true_lang_default,hide_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Hide",__name:"hide",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"}),vue.createElementVNode("path",{fill:"currentColor",d:"M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"})]))}}),hide_default=hide_vue_vue_type_script_setup_true_lang_default,loading_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Loading",__name:"loading",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"})]))}}),loading_default=loading_vue_vue_type_script_setup_true_lang_default,view_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"View",__name:"view",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"})]))}}),view_default=view_vue_vue_type_script_setup_true_lang_default,MapShim=function(){if(typeof Map<"u")return Map;function i(r,n){var o=-1;return r.some(function(a,u){return a[0]===n?(o=u,!0):!1}),o}return function(){function r(){this.__entries__=[]}return Object.defineProperty(r.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),r.prototype.get=function(n){var o=i(this.__entries__,n),a=this.__entries__[o];return a&&a[1]},r.prototype.set=function(n,o){var a=i(this.__entries__,n);~a?this.__entries__[a][1]=o:this.__entries__.push([n,o])},r.prototype.delete=function(n){var o=this.__entries__,a=i(o,n);~a&&o.splice(a,1)},r.prototype.has=function(n){return!!~i(this.__entries__,n)},r.prototype.clear=function(){this.__entries__.splice(0)},r.prototype.forEach=function(n,o){o===void 0&&(o=null);for(var a=0,u=this.__entries__;a<u.length;a++){var c=u[a];n.call(o,c[1],c[0])}},r}()}(),isBrowser=typeof window<"u"&&typeof document<"u"&&window.document===document,global$1=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),requestAnimationFrame$1=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(global$1):function(i){return setTimeout(function(){return i(Date.now())},1e3/60)}}(),trailingTimeout=2;function throttle(i,r){var n=!1,o=!1,a=0;function u(){n&&(n=!1,i()),o&&d()}function c(){requestAnimationFrame$1(u)}function d(){var f=Date.now();if(n){if(f-a<trailingTimeout)return;o=!0}else n=!0,o=!1,setTimeout(c,r);a=f}return d}var REFRESH_DELAY=20,transitionKeys=["top","right","bottom","left","width","height","size","weight"],mutationObserverSupported=typeof MutationObserver<"u",ResizeObserverController=function(){function i(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=throttle(this.refresh.bind(this),REFRESH_DELAY)}return i.prototype.addObserver=function(r){~this.observers_.indexOf(r)||this.observers_.push(r),this.connected_||this.connect_()},i.prototype.removeObserver=function(r){var n=this.observers_,o=n.indexOf(r);~o&&n.splice(o,1),!n.length&&this.connected_&&this.disconnect_()},i.prototype.refresh=function(){var r=this.updateObservers_();r&&this.refresh()},i.prototype.updateObservers_=function(){var r=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return r.forEach(function(n){return n.broadcastActive()}),r.length>0},i.prototype.connect_=function(){!isBrowser||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),mutationObserverSupported?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},i.prototype.disconnect_=function(){!isBrowser||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},i.prototype.onTransitionEnd_=function(r){var n=r.propertyName,o=n===void 0?"":n,a=transitionKeys.some(function(u){return!!~o.indexOf(u)});a&&this.refresh()},i.getInstance=function(){return this.instance_||(this.instance_=new i),this.instance_},i.instance_=null,i}(),defineConfigurable=function(i,r){for(var n=0,o=Object.keys(r);n<o.length;n++){var a=o[n];Object.defineProperty(i,a,{value:r[a],enumerable:!1,writable:!1,configurable:!0})}return i},getWindowOf=function(i){var r=i&&i.ownerDocument&&i.ownerDocument.defaultView;return r||global$1},emptyRect=createRectInit(0,0,0,0);function toFloat(i){return parseFloat(i)||0}function getBordersSize(i){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return r.reduce(function(o,a){var u=i["border-"+a+"-width"];return o+toFloat(u)},0)}function getPaddings(i){for(var r=["top","right","bottom","left"],n={},o=0,a=r;o<a.length;o++){var u=a[o],c=i["padding-"+u];n[u]=toFloat(c)}return n}function getSVGContentRect(i){var r=i.getBBox();return createRectInit(0,0,r.width,r.height)}function getHTMLElementContentRect(i){var r=i.clientWidth,n=i.clientHeight;if(!r&&!n)return emptyRect;var o=getWindowOf(i).getComputedStyle(i),a=getPaddings(o),u=a.left+a.right,c=a.top+a.bottom,d=toFloat(o.width),f=toFloat(o.height);if(o.boxSizing==="border-box"&&(Math.round(d+u)!==r&&(d-=getBordersSize(o,"left","right")+u),Math.round(f+c)!==n&&(f-=getBordersSize(o,"top","bottom")+c)),!isDocumentElement(i)){var h=Math.round(d+u)-r,y=Math.round(f+c)-n;Math.abs(h)!==1&&(d-=h),Math.abs(y)!==1&&(f-=y)}return createRectInit(a.left,a.top,d,f)}var isSVGGraphicsElement=function(){return typeof SVGGraphicsElement<"u"?function(i){return i instanceof getWindowOf(i).SVGGraphicsElement}:function(i){return i instanceof getWindowOf(i).SVGElement&&typeof i.getBBox=="function"}}();function isDocumentElement(i){return i===getWindowOf(i).document.documentElement}function getContentRect(i){return isBrowser?isSVGGraphicsElement(i)?getSVGContentRect(i):getHTMLElementContentRect(i):emptyRect}function createReadOnlyRect(i){var r=i.x,n=i.y,o=i.width,a=i.height,u=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,c=Object.create(u.prototype);return defineConfigurable(c,{x:r,y:n,width:o,height:a,top:n,right:r+o,bottom:a+n,left:r}),c}function createRectInit(i,r,n,o){return{x:i,y:r,width:n,height:o}}var ResizeObservation=function(){function i(r){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=createRectInit(0,0,0,0),this.target=r}return i.prototype.isActive=function(){var r=getContentRect(this.target);return this.contentRect_=r,r.width!==this.broadcastWidth||r.height!==this.broadcastHeight},i.prototype.broadcastRect=function(){var r=this.contentRect_;return this.broadcastWidth=r.width,this.broadcastHeight=r.height,r},i}(),ResizeObserverEntry=function(){function i(r,n){var o=createReadOnlyRect(n);defineConfigurable(this,{target:r,contentRect:o})}return i}(),ResizeObserverSPI=function(){function i(r,n,o){if(this.activeObservations_=[],this.observations_=new MapShim,typeof r!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=r,this.controller_=n,this.callbackCtx_=o}return i.prototype.observe=function(r){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(r instanceof getWindowOf(r).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(r)||(n.set(r,new ResizeObservation(r)),this.controller_.addObserver(this),this.controller_.refresh())}},i.prototype.unobserve=function(r){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(r instanceof getWindowOf(r).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(r)&&(n.delete(r),n.size||this.controller_.removeObserver(this))}},i.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},i.prototype.gatherActive=function(){var r=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&r.activeObservations_.push(n)})},i.prototype.broadcastActive=function(){if(this.hasActive()){var r=this.callbackCtx_,n=this.activeObservations_.map(function(o){return new ResizeObserverEntry(o.target,o.broadcastRect())});this.callback_.call(r,n,r),this.clearActive()}},i.prototype.clearActive=function(){this.activeObservations_.splice(0)},i.prototype.hasActive=function(){return this.activeObservations_.length>0},i}(),observers=typeof WeakMap<"u"?new WeakMap:new MapShim,ResizeObserver$1=function(){function i(r){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=ResizeObserverController.getInstance(),o=new ResizeObserverSPI(r,n,this);observers.set(this,o)}return i}();["observe","unobserve","disconnect"].forEach(function(i){ResizeObserver$1.prototype[i]=function(){var r;return(r=observers.get(this))[i].apply(r,arguments)}});var index$1=function(){return typeof global$1.ResizeObserver<"u"?global$1.ResizeObserver:ResizeObserver$1}();const Events=["blur","input","change","changeSelectionStyle","changeSession","copy","focus","paste"],VAceEditor=vue.defineComponent({name:"VAceEditor",props:{value:{type:String,required:!0},lang:{type:String,default:"text"},theme:{type:String,default:"chrome"},options:Object,placeholder:String,readonly:Boolean,wrap:Boolean,printMargin:{type:[Boolean,Number],default:!0},minLines:Number,maxLines:Number},emits:["update:value","init",...Events],render(){return vue.h("div")},mounted(){const i=this._editor=vue.markRaw(ace.edit(this.$el,{placeholder:this.placeholder,readOnly:this.readonly,value:this.value,mode:"ace/mode/"+this.lang,theme:"ace/theme/"+this.theme,wrap:this.wrap,printMargin:this.printMargin,useWorker:!1,minLines:this.minLines,maxLines:this.maxLines,...this.options}));this._contentBackup=this.value,this._isSettingContent=!1,i.on("change",()=>{if(this._isSettingContent)return;const r=i.getValue();this._contentBackup=r,this.$emit("update:value",r)}),Events.forEach(r=>{const n="on"+vue.capitalize(r);typeof this.$.vnode.props[n]=="function"&&i.on(r,this.$emit.bind(this,r))}),this._ro=new index$1(()=>i.resize()),this._ro.observe(this.$el),this.$emit("init",i)},beforeUnmount(){var i,r;(i=this._ro)===null||i===void 0||i.disconnect(),(r=this._editor)===null||r===void 0||r.destroy()},methods:{focus(){this._editor.focus()},blur(){this._editor.blur()},selectAll(){this._editor.selectAll()},getAceInstance(){return this._editor}},watch:{value(i){if(this._contentBackup!==i){try{this._isSettingContent=!0,this._editor.setValue(i,1)}finally{this._isSettingContent=!1}this._contentBackup=i}},theme(i){this._editor.setTheme("ace/theme/"+i)},options(i){this._editor.setOptions(i)},readonly(i){this._editor.setReadOnly(i)},placeholder(i){this._editor.setOption("placeholder",i)},wrap(i){this._editor.setWrapBehavioursEnabled(i)},printMargin(i){this._editor.setOption("printMargin",i)},lang(i){this._editor.setOption("mode","ace/mode/"+i)},minLines(i){this._editor.setOption("minLines",i)},maxLines(i){this._editor.setOption("ma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LCBmYWxzZSk7Cgp9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL3RoZW1lL2tyX3RoZW1lIl0sIGZ1bmN0aW9uKG0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBtb2R1bGUgPT0gIm9iamVjdCIgJiYgdHlwZW9mIGV4cG9ydHMgPT0gIm9iamVjdCIgJiYgbW9kdWxlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IG07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pKCk7CiAgICAgICAgICAgIA==",modeJsonUrl="data:application/javascript;base64,YWNlLmRlZmluZSgiYWNlL21vZGUvanNvbl9oaWdobGlnaHRfcnVsZXMiLFsicmVxdWlyZSIsImV4cG9ydHMiLCJtb2R1bGUiLCJhY2UvbGliL29vcCIsImFjZS9tb2RlL3RleHRfaGlnaGxpZ2h0X3J1bGVzIl0sIGZ1bmN0aW9uKHJlcXVpcmUsIGV4cG9ydHMsIG1vZHVsZSl7InVzZSBzdHJpY3QiOwp2YXIgb29wID0gcmVxdWlyZSgiLi4vbGliL29vcCIpOwp2YXIgVGV4dEhpZ2hsaWdodFJ1bGVzID0gcmVxdWlyZSgiLi90ZXh0X2hpZ2hsaWdodF9ydWxlcyIpLlRleHRIaWdobGlnaHRSdWxlczsKdmFyIEpzb25IaWdobGlnaHRSdWxlcyA9IGZ1bmN0aW9uICgpIHsKICAgIHRoaXMuJHJ1bGVzID0gewogICAgICAgICJzdGFydCI6IFsKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdG9rZW46ICJ2YXJpYWJsZSIsCiAgICAgICAgICAgICAgICByZWdleDogJ1siXSg/Oig/OlxcXFwuKXwoPzpbXiJcXFxcXSkpKj9bIl1cXHMqKD89OiknCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAic3RyaW5nIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAnIicsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RyaW5nIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lm51bWVyaWMiLAogICAgICAgICAgICAgICAgcmVnZXg6ICIwW3hYXVswLTlhLWZBLUZdK1xcYiIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJjb25zdGFudC5udW1lcmljIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAiWystXT9cXGQrKD86KD86XFwuXFxkKik/KD86W2VFXVsrLV0/XFxkKyk/KT9cXGIiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29uc3RhbnQubGFuZ3VhZ2UuYm9vbGVhbiIsCiAgICAgICAgICAgICAgICByZWdleDogIig/OnRydWV8ZmFsc2UpXFxiIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbJ10oPzooPzpcXFxcLil8KD86W14nXFxcXF0pKSo/WyddIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbW1lbnQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXC9cXC8uKiQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29tbWVudC5zdGFydCIsCiAgICAgICAgICAgICAgICByZWdleDogIlxcL1xcKiIsCiAgICAgICAgICAgICAgICBuZXh0OiAiY29tbWVudCIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5scGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbWyh7XSIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5ycGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbXFxdKX1dIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInB1bmN0dWF0aW9uLm9wZXJhdG9yIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAvWyxdLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXHMrIgogICAgICAgICAgICB9CiAgICAgICAgXSwKICAgICAgICAic3RyaW5nIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lmxhbmd1YWdlLmVzY2FwZSIsCiAgICAgICAgICAgICAgICByZWdleDogL1xcKD86eFswLTlhLWZBLUZdezJ9fHVbMC05YS1mQS1GXXs0fXxbIlxcXC9iZm5ydF0pLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInN0cmluZyIsCiAgICAgICAgICAgICAgICByZWdleDogJyJ8JCcsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RhcnQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIGRlZmF1bHRUb2tlbjogInN0cmluZyIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImNvbW1lbnQiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29tbWVudC5lbmQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXCpcXC8iLAogICAgICAgICAgICAgICAgbmV4dDogInN0YXJ0IgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICBkZWZhdWx0VG9rZW46ICJjb21tZW50IgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfTsKfTsKb29wLmluaGVyaXRzKEpzb25IaWdobGlnaHRSdWxlcywgVGV4dEhpZ2hsaWdodFJ1bGVzKTsKZXhwb3J0cy5Kc29uSGlnaGxpZ2h0UnVsZXM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N0aW9uUmFuZ2Uoc2Vzc2lvbiwgcm93KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKGZvbGRTdHlsZSAhPSAiYWxsIikKICAgICAgICAgICAgICAgICAgICByYW5nZSA9IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHJhbmdlOwogICAgICAgIH0KICAgICAgICBpZiAoZm9sZFN0eWxlID09PSAibWFya2JlZ2luIikKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIHZhciBtYXRjaCA9IGxpbmUubWF0Y2godGhpcy5mb2xkaW5nU3RvcE1hcmtlcik7CiAgICAgICAgaWYgKG1hdGNoKSB7CiAgICAgICAgICAgIHZhciBpID0gbWF0Y2guaW5kZXggKyBtYXRjaFswXS5sZW5ndGg7CiAgICAgICAgICAgIGlmIChtYXRjaFsxXSkKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNsb3NpbmdCcmFja2V0QmxvY2soc2Vzc2lvbiwgbWF0Y2hbMV0sIHJvdywgaSk7CiAgICAgICAgICAgIHJldHVybiBzZXNzaW9uLmdldENvbW1lbnRGb2xkUmFuZ2Uocm93LCBpLCAtMSk7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuZ2V0U2VjdGlvblJhbmdlID0gZnVuY3Rpb24gKHNlc3Npb24sIHJvdykgewogICAgICAgIHZhciBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgdmFyIHN0YXJ0SW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgdmFyIHN0YXJ0Um93ID0gcm93OwogICAgICAgIHZhciBzdGFydENvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIHJvdyA9IHJvdyArIDE7CiAgICAgICAgdmFyIGVuZFJvdyA9IHJvdzsKICAgICAgICB2YXIgbWF4Um93ID0gc2Vzc2lvbi5nZXRMZW5ndGgoKTsKICAgICAgICB3aGlsZSAoKytyb3cgPCBtYXhSb3cpIHsKICAgICAgICAgICAgbGluZSA9IHNlc3Npb24uZ2V0TGluZShyb3cpOwogICAgICAgICAgICB2YXIgaW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgICAgIGlmIChpbmRlbnQgPT09IC0xKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChzdGFydEluZGVudCA+IGluZGVudCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB2YXIgc3ViUmFuZ2UgPSB0aGlzLmdldEZvbGRXaWRnZXRSYW5nZShzZXNzaW9uLCAiYWxsIiwgcm93KTsKICAgICAgICAgICAgaWYgKHN1YlJhbmdlKSB7CiAgICAgICAgICAgICAgICBpZiAoc3ViUmFuZ2Uuc3RhcnQucm93IDw9IHN0YXJ0Um93KSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmIChzdWJSYW5nZS5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgcm93ID0gc3ViUmFuZ2UuZW5kLnJvdzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKHN0YXJ0SW5kZW50ID09IGluZGVudCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGVuZFJvdyA9IHJvdzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG5ldyBSYW5nZShzdGFydFJvdywgc3RhcnRDb2x1bW4sIGVuZFJvdywgc2Vzc2lvbi5nZXRMaW5lKGVuZFJvdykubGVuZ3RoKTsKICAgIH07CiAgICB0aGlzLmdldENvbW1lbnRSZWdpb25CbG9jayA9IGZ1bmN0aW9uIChzZXNzaW9uLCBsaW5lLCByb3cpIHsKICAgICAgICB2YXIgc3RhcnRDb2x1bW4gPSBsaW5lLnNlYXJjaCgvXHMqJC8pOwogICAgICAgIHZhciBtYXhSb3cgPSBzZXNzaW9uLmdldExlbmd0aCgpOwogICAgICAgIHZhciBzdGFydFJvdyA9IHJvdzsKICAgICAgICB2YXIgcmUgPSAvXlxzKig/OlwvXCp8XC9cL3wtLSkjPyhlbmQpP3JlZ2lvblxiLzsKICAgICAgICB2YXIgZGVwdGggPSAxOwogICAgICAgIHdoaWxlICgrK3JvdyA8IG1heFJvdykgewogICAgICAgICAgICBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgICAgIHZhciBtID0gcmUuZXhlYyhsaW5lKTsKICAgICAgICAgICAgaWYgKCFtKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChtWzFdKQogICAgICAgICAgICAgICAgZGVwdGgtLTsKICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgZGVwdGgrKzsKICAgICAgICAgICAgaWYgKCFkZXB0aCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICB2YXIgZW5kUm93ID0gcm93OwogICAgICAgIGlmIChlbmRSb3cgPiBzdGFydFJvdykgewogICAgICAgICAgICByZXR1cm4gbmV3IFJhbmdlKHN0YXJ0Um93LCBzdGFydENvbHVtbiwgZW5kUm93LCBsaW5lLmxlbmd0aCk7CiAgICAgICAgfQogICAgfTsKfSkuY2FsbChGb2xkTW9kZS5wcm90b3R5cGUpOwoKfSk7CgphY2UuZGVmaW5lKCJhY2UvbW9kZS9qc29uIixbInJlcXVpcmUiLCJleHBvcnRzIiwibW9kdWxlIiwiYWNlL2xpYi9vb3AiLCJhY2UvbW9kZS90ZXh0IiwiYWNlL21vZGUvanNvbl9oaWdobGlnaHRfcnVsZXMiLCJhY2UvbW9kZS9tYXRjaGluZ19icmFjZV9vdXRkZW50IiwiYWNlL21vZGUvYmVoYXZpb3VyL2NzdHlsZSIsImFjZS9tb2RlL2ZvbGRpbmcvY3N0eWxlIiwiYWNlL3d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2NrQ29tbWVudCA9IHsgc3RhcnQ6ICIvKiIsIGVuZDogIiovIiB9OwogICAgdGhpcy5nZXROZXh0TGluZUluZGVudCA9IGZ1bmN0aW9uIChzdGF0ZSwgbGluZSwgdGFiKSB7CiAgICAgICAgdmFyIGluZGVudCA9IHRoaXMuJGdldEluZGVudChsaW5lKTsKICAgICAgICBpZiAoc3RhdGUgPT0gInN0YXJ0IikgewogICAgICAgICAgICB2YXIgbWF0Y2ggPSBsaW5lLm1hdGNoKC9eLipbXHtcKFxbXVxzKiQvKTsKICAgICAgICAgICAgaWYgKG1hdGNoKSB7CiAgICAgICAgICAgICAgICBpbmRlbnQgKz0gdGFiOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBpbmRlbnQ7CiAgICB9OwogICAgdGhpcy5jaGVja091dGRlbnQgPSBmdW5jdGlvbiAoc3RhdGUsIGxpbmUsIGlucHV0KSB7CiAgICAgICAgcmV0dXJuIHRoaXMuJG91dGRlbnQuY2hlY2tPdXRkZW50KGxpbmUsIGlucHV0KTsKICAgIH07CiAgICB0aGlzLmF1dG9PdXRkZW50ID0gZnVuY3Rpb24gKHN0YXRlLCBkb2MsIHJvdykgewogICAgICAgIHRoaXMuJG91dGRlbnQuYXV0b091dGRlbnQoZG9jLCByb3cpOwogICAgfTsKICAgIHRoaXMuY3JlYXRlV29ya2VyID0gZnVuY3Rpb24gKHNlc3Npb24pIHsKICAgICAgICB2YXIgd29ya2VyID0gbmV3IFdvcmtlckNsaWVudChbImFjZSJdLCAiYWNlL21vZGUvanNvbl93b3JrZXIiLCAiSnNvbldvcmtlciIpOwogICAgICAgIHdvcmtlci5hdHRhY2hUb0RvY3VtZW50KHNlc3Npb24uZ2V0RG9jdW1lbnQoKSk7CiAgICAgICAgd29ya2VyLm9uKCJhbm5vdGF0ZSIsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIHNlc3Npb24uc2V0QW5ub3RhdGlvbnMoZS5kYXRhKTsKICAgICAgICB9KTsKICAgICAgICB3b3JrZXIub24oInRlcm1pbmF0ZSIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgc2Vzc2lvbi5jbGVhckFubm90YXRpb25zKCk7CiAgICAgICAgfSk7CiAgICAgICAgcmV0dXJuIHdvcmtlcjsKICAgIH07CiAgICB0aGlzLiRpZCA9ICJhY2UvbW9kZS9qc29uIjsKfSkuY2FsbChNb2RlLnByb3RvdHlwZSk7CmV4cG9ydHMuTW9kZSA9IE1vZGU7Cgp9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL21vZGUvanNvbiJdLCBmdW5jdGlvbihtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgbW9kdWxlID09ICJvYmplY3QiICYmIHR5cGVvZiBleHBvcnRzID09ICJvYmplY3QiICYmIG1vZHVsZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlLmV4cG9ydHMgPSBtOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KSgpOwogICAgICAgICAgICA=",workerJsonUrl="data:application/javascript;base64,Im5vIHVzZSBzdHJpY3QiOwohKGZ1bmN0aW9uKHdpbmRvdykgewppZiAodHlwZW9mIHdpbmRvdy53aW5kb3cgIT0gInVuZGVmaW5lZCIgJiYgd2luZG93LmRvY3VtZW50KQogICAgcmV0dXJuOwppZiAod2luZG93LnJlcXVpcmUgJiYgd2luZG93LmRlZmluZSkKICAgIHJldHVybjsKCmlmICghd2luZG93LmNvbnNvbGUpIHsKICAgIHdpbmRvdy5jb25zb2xlID0gZnVuY3Rpb24oKSB7CiAgICAgICAgdmFyIG1zZ3MgPSBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMsIDApOwogICAgICAgIHBvc3RNZXNzYWdlKHt0eXBlOiAibG9n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hc2UgPSBwYXJlbnRJZC5zcGxpdCgiLyIpLnNsaWNlKDAsIC0xKS5qb2luKCIvIik7CiAgICAgICAgbW9kdWxlTmFtZSA9IChiYXNlID8gYmFzZSArICIvIiA6ICIiKSArIG1vZHVsZU5hbWU7CiAgICAgICAgCiAgICAgICAgd2hpbGUgKG1vZHVsZU5hbWUuaW5kZXhPZigiLiIpICE9PSAtMSAmJiBwcmV2aW91cyAhPSBtb2R1bGVOYW1lKSB7CiAgICAgICAgICAgIHZhciBwcmV2aW91cyA9IG1vZHVsZU5hbWU7CiAgICAgICAgICAgIG1vZHVsZU5hbWUgPSBtb2R1bGVOYW1lLnJlcGxhY2UoL15cLlwvLywgIiIpLnJlcGxhY2UoL1wvXC5cLy8sICIvIikucmVwbGFjZSgvW15cL10rXC9cLlwuXC8vLCAiIik7CiAgICAgICAgfQogICAgfQogICAgCiAgICByZXR1cm4gbW9kdWxlTmFtZTsKfTsKCndpbmRvdy5yZXF1aXJlID0gZnVuY3Rpb24gcmVxdWlyZShwYXJlbnRJZCwgaWQpIHsKICAgIGlmICghaWQpIHsKICAgICAgICBpZCA9IHBhcmVudElkOwogICAgICAgIHBhcmVudElkID0gbnVsbDsKICAgIH0KICAgIGlmICghaWQuY2hhckF0KQogICAgICAgIHRocm93IG5ldyBFcnJvcigid29ya2VyLmpzIHJlcXVpcmUoKSBhY2NlcHRzIG9ubHkgKHBhcmVudElkLCBpZCkgYXMgYXJndW1lbnRzIik7CgogICAgaWQgPSB3aW5kb3cubm9ybWFsaXplTW9kdWxlKHBhcmVudElkLCBpZCk7CgogICAgdmFyIG1vZHVsZSA9IHdpbmRvdy5yZXF1aXJlLm1vZHVsZXNbaWRdOwogICAgaWYgKG1vZHVsZSkgewogICAgICAgIGlmICghbW9kdWxlLmluaXRpYWxpemVkKSB7CiAgICAgICAgICAgIG1vZHVsZS5pbml0aWFsaXplZCA9IHRydWU7CiAgICAgICAgICAgIG1vZHVsZS5leHBvcnRzID0gbW9kdWxlLmZhY3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AgICAgICB2YXIgaSA9IHRlc3RQYXRoLmxhc3RJbmRleE9mKCIvIik7CiAgICAgICAgaWYgKGkgPT09IC0xKSBicmVhazsKICAgICAgICB0YWlsID0gdGVzdFBhdGguc3Vic3RyKGkpICsgdGFpbDsKICAgICAgICB0ZXN0UGF0aCA9IHRlc3RQYXRoLnNsaWNlKDAsIGkpOwogICAgfQogICAgcmV0dXJuIGlkOwp9CndpbmRvdy5yZXF1aXJlLm1vZHVsZXMgPSB7fTsKd2luZG93LnJlcXVpcmUudGxucyA9IHt9OwoKd2luZG93LmRlZmluZSA9IGZ1bmN0aW9uKGlkLCBkZXBzLCBmYWN0b3J5KSB7CiAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA9PSAyKSB7CiAgICAgICAgZmFjdG9yeSA9IGRlcHM7CiAgICAgICAgaWYgKHR5cGVvZiBpZCAhPSAic3RyaW5nIikgewogICAgICAgICAgICBkZXBzID0gaWQ7CiAgICAgICAgICAgIGlkID0gd2luZG93LnJlcXVpcmUuaWQ7CiAgICAgICAgfQogICAgfSBlbHNlIGlmIChhcmd1bWVudHMubGVuZ3RoID09IDEpIHsKICAgICAgICBmYWN0b3J5ID0gaWQ7CiAgICAgICAgZGVwcyA9IFtdOwogICAgICAgIGlkID0gd2luZG93LnJlcXVpcmUuaWQ7CiAgICB9CiAgICAKICAgIGlmICh0eXBlb2YgZmFjdG9yeSAhPSAiZnVuY3Rpb24iKSB7CiAgICAgICAgd2luZG93LnJlcXVpcmUubW9kdWxlc1tpZF0gPSB7CiAgICAgICAgICAgIGV4cG9ydHM6IGZhY3RvcnksCiAgICAgICAgICAgIGluaXRpYWxpemVkOiB0cnVlCiAgICAgICAgfTsKICAgICAgICByZXR1cm47CiAgICB9CgogICAgaWYgKCFkZXBzLmxlbmd0aCkKICAgICAgICAvLyBJZiB0aGVyZSBpcyBubyBkZXBlbmRlbmNpZXMsIHdlIGluamVjdCAicmVxdWlyZSIsICJleHBvcnRzIiBhbmQKICAgICAgICAvLy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ICAgICAgICAgLy8gcmVxdWlyZSB0aGVtLgogICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6ICAgICAgICByZXR1cm4gcmVxKGRlcCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgaWYgKHJldHVybkV4cG9ydHMpCiAgICAgICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IHJldHVybkV4cG9ydHM7CiAgICAgICAgICAgIHJldHVybiBtb2R1bGU7CiAgICAgICAgfQogICAgfTsKfTsKd2luZG93LmRlZmluZS5hbWQgPSB7fTsKd2luZG93LnJlcXVpcmUudGxucyA9IHt9Owp3aW5kb3cuaW5pdEJhc2VVcmxzICA9IGZ1bmN0aW9uIGluaXRCYXNlVXJscyh0b3BMZXZlbE5hbWVzcGFjZXMpIHsKICAgIGZvciAodmFyIGkgaW4gdG9wTGV2ZWxOYW1lc3BhY2VzKQogICAgICAgIHRoaXMucmVxdWlyZS50bG5zW2ldID0gdG9wTGV2ZWxOYW1lc3BhY2VzW2ldOwp9OwoKd2luZG93LmluaXRTZW5kZXIgPSBmdW5jdGlvbiBpbml0U2VuZGVyKCkgewoKICAgIHZhciBFdmVudEVtaXR0ZXIgPSB3aW5kb3cucmVxdWlyZSgiYWNlL2xpYi9ldmVudF9lbWl0dGVyIikuRXZlbnRFbWl0dGVyOwogICAgdmFyIG9vcCA9IHdpbmRvdy5yZXF1aXJlKCJhY2UvbGliL29vcCIpOwogICAgCiAgICB2YXIgU2VuZGVyID0gZnVuY3Rpb24oKSB7fTsKICAgIAogICAgKGZ1bmN0aW9uKCkgewogICAgICAgIAogICAgICAgIG9vcC5pbXBsZW1lbnQodGhpcywgRXZlbnRFbWl0dGVyKTsKICAgICAgICAgICAgICAgIAogICAgICAgIHRoaXMuY2FsbGJhY2sgPSBmdW5jdGlvbihkYXRhLCBjYWxsYmFja0lkKSB7CiAgICAgICAgICAgIHBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIHR5cGU6ICJjYWxsIiwKICAgICAgICAgICAgICAgIGlkOiBjYWxsYmFja0lkLAogICAgICAgICAgICAgICAgZGF0YTogZGF0YQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgCiAgICAgICAgdGhpcy5lbWl0ID0gZnVuY3Rpb24obmFtZSwgZGF0YSkgewogICAgICAgICAgICBwb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICB0eXBlOiAiZXZlbnQiLAogICAgICAgICAgICAgICAgbmFtZTogbmFtZSwKICAgICAgICAgICAgICAgIGRhdGE6IGRhdGEKICAgICAgICAgICAgfSk7CiAgICAgICAgfTsKICAgICAgICAKICAgIH0pLmNhbGwoU2VuZGVyLnByb3RvdHlwZSk7CiAgICAKICAgIHJldHVybiBuZXcgU2VuZGVyKCk7Cn07Cgp2YXIgbWFpbiA9IHdpbmRvdy5tYWluID0gbnVsbDsKdmFyIHNlbmRlciA9IHdpbmRvdy5zZW5kZXIgPSBudWxsOwoKd2luZG93Lm9ubWVzc2FnZSA9IGZ1bmN0aW9uKGUpIHsKICAgIHZhciBtc2cgPSBlLmRhdGE7CiAgICBpZiAobXNnLmV2ZW50ICYmIHNlbmRlcikgewogICAgICAgIHNlbmRlci5fc2lnbmFsKG1zZy5ldmVudCwgbXNnLmRhdGEpOwogICAgfQogICAgZWxzZSBpZiAobXNnLmNvbW1hbmQpIHsKICAgICAgICBpZiAobWFpblttc2cuY29tbWFuZF0pCiAgICAgICAgICAgIG1haW5bbXNnLmNvbW1hbmRdLmFwcGx5KG1haW4sIG1zZy5hcmdzKTsKICAgICAgICBlbHNlIGlmICh3aW5kb3dbbXNnLmNvbW1hbmRdKQogICAgICAgICAgICB3aW5kb3dbbXNnLmNvbW1hbmRdLmFwcGx5KHdpbmRvdywgbXNnLmFyZ3MpOwogICAgICAgIGVsc2UKICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJVbmtub3duIGNvbW1hbmQ6IiArIG1zZy5jb21tYW5kKTsKICAgIH0KICAgIG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7CiAgICBzd2l0Y2ggKGRlbHRhLmFjdGlvbikgewogICAgICAgIGNhc2UgImluc2VydCI6CiAgICAgICAgICAgIHZhciBsaW5lcyA9IGRlbHRhLmxpbmVzOwogICAgICAgICAgICBpZiAobGluZXMubGVuZ3RoID09PSAxKSB7CiAgICAgICAgICAgICAgICBkb2NMaW5lc1tyb3ddID0gbGluZS5zdWJzdHJpbmcoMCwgc3RhcnRDb2x1bW4pICsgZGVsdGEubGluZXNbMF0gKyBsaW5lLnN1YnN0cmluZyhzdGFydENvbHVtbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICB2YXIgYXJncyA9IFtyb3csIDFdLmNvbmNhdChkZWx0YS5saW5lcyk7CiAgICAgICAgICAgICAgICBkb2NMaW5lcy5zcGxpY2UuYXBwbHkoZG9jTGluZXMsIGFyZ3MpOwogICAgICAgICAgICAgICAgZG9jTGluZXNbcm93XSA9IGxpbmUuc3Vic3RyaW5nKDAsIHN0YXJ0Q29sdW1uKSArIGRvY0xpbmVzW3Jvd107CiAgICAgICAgICAgICAgICBkb2NMaW5lc1tyb3cgKyBkZWx0YS5saW5lcy5sZW5ndGggLSAxXSArPSBsaW5lLnN1YnN0cmluZyhzdGFydENvbHVtbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgY2FzZSAicmVtb3ZlIjoKICAgICAgICAgICAgdmFyIGVuZENvbHVtbiA9IGRlbHRhLmVuZC5jb2x1bW47CiAgICAgICAgICAgIHZhciBlbmRSb3cgPSBkZWx0YS5lbmQucm93OwogICAgICAgICAgICBpZiAocm93ID09PSBlbmRSb3cpIHsKICAgICAgICAgICAgICAgIGRvY0xpbmVzW3Jvd10gPSBsaW5lLnN1YnN0cmluZygwLCBzdGFydENvbHVtbikgKyBsaW5lLnN1YnN0cmluZyhlbmRDb2x1bW4pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICA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YXJ0LmNvbHVtbiArCiAgICAgICAgICAgICJdIC0+IFsiICsgdGhpcy5lbmQucm93ICsgIi8iICsgdGhpcy5lbmQuY29sdW1uICsgIl0iKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMDsKICAgIH07CiAgICB0aGlzLmNvbXBhcmVSYW5nZSA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAsIGVuZCA9IHJhbmdlLmVuZCwgc3RhcnQgPSByYW5nZS5zdGFydDsKICAgICAgICBjbXAgPSB0aGlzLmNvbXBhcmUoZW5kLnJvdywgZW5kLmNvbHVtbik7CiAgICAgICAgaWYgKGNtcCA9PSAxKSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSBpZiAoY21wID09IDApIHsKICAgICAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAoY21wID09IC0xKSB7CiAgICAgICAgICAgIHJldHVybiAtMjsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gLTEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDQyOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlUG9pbnQgPSBmdW5jdGlvbiAocCkgewogICAgICAgIHJldHVybiB0aGlzLmNvbXBhcmUocC5yb3csIHAuY29sdW1uKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zUmFuZ2UgPSBmdW5jdGlvbiAocmFuZ2UpIHsKICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlUG9pbnQocmFuZ2Uuc3RhcnQpID09IDAgJiYgdGhpcy5jb21wYXJlUG9pbnQocmFuZ2UuZW5kKSA9PSAwOwogICAgfTsKICAgIHRoaXMuaW50ZXJzZWN0cyA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAgPSB0aGlzLmNvbXBhcmVSYW5nZShyYW5nZSk7CiAgICAgICAgcmV0dXJuIChjbXAgPT0gLTEgfHwgY21wID09IDAgfHwgY21wID09IDEpOwogICAgfTsKICAgIHRoaXMuaXNFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4gdGhpcy5lbmQucm93ID09IHJvdyAmJiB0aGlzLmVuZC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuaXNTdGFydCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHJldHVybiB0aGlzLnN0YXJ0LnJvdyA9PSByb3cgJiYgdGhpcy5zdGFydC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuc2V0U3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IHJvdy5jb2x1bW47CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93LnJvdzsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5zZXRFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSByb3cuY29sdW1uOwogICAgICAgICAgICB0aGlzLmVuZC5yb3cgPSByb3cucm93OwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgdGhpcy5lbmQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSBjb2x1bW47CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuaW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc0VuZChyb3csIGNvbHVtbikgfHwgdGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlU3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodGhpcy5jb21wYXJlKHJvdywgY29sdW1uKSA9PSAwKSB7CiAgICAgICAgICAgIGlmICh0aGlzLmlzRW5kKHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlRW5kID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuY29tcGFyZSA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICghdGhpcy5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgIGlmIChyb3cgPT09IHRoaXMuc3RhcnQucm93KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gY29sdW1uIDwgdGhpcy5zdGFydC5jb2x1bW4gPyAtMSA6IChjb2x1bW4gPiB0aGlzLmVuZC5jb2x1bW4gPyAxIDogMCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuc3RhcnQucm93KQogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHJvdyA+IHRoaXMuZW5kLnJvdykKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09PSByb3cpCiAgICAgICAgICAgIHJldHVybiBjb2x1bW4gPj0gdGhpcy5zdGFydC5jb2x1bW4gPyAwIDogLTE7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PT0gcm93KQogICAgICAgICAgICByZXR1cm4gY29sdW1uIDw9IHRoaXMuZW5kLmNvbHVtbiA/IDAgOiAxOwogICAgICAgIHJldHVybiAwOwogICAgfTsKICAgIHRoaXMuY29tcGFyZVN0YXJ0ID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09IHJvdyAmJiB0aGlzLnN0YXJ0LmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbik7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuY29tcGFyZUVuZCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPT0gcm93ICYmIHRoaXMuZW5kLmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlSW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PSByb3cgJiYgdGhpcy5lbmQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAodGhpcy5zdGFydC5yb3cgPT0gcm93ICYmIHRoaXMuc3RhcnQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jbGlwUm93cyA9IGZ1bmN0aW9uIChmaXJzdFJvdywgbGFzdFJvdykgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPiBsYXN0Um93KQogICAgICAgICAgICB2YXIgZW5kID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLmVuZC5yb3cgPCBmaXJzdFJvdykKICAgICAgICAgICAgdmFyIGVuZCA9IHsgcm93OiBmaXJzdFJvdywgY29sdW1uOiAwIH07CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID4gbGFzdFJvdykKICAgICAgICAgICAgdmFyIHN0YXJ0ID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLnN0YXJ0LnJvdyA8IGZpcnN0Um93KQogICAgICAgICAgICB2YXIgc3RhcnQgPSB7IHJvdzogZmlyc3RSb3csIGNvbHVtbjogMCB9OwogICAgICAgIHJldHVybiBSYW5nZS5mcm9tUG9pbnRzKHN0YXJ0IHx8IHRoaXMuc3RhcnQsIGVuZCB8fCB0aGlzLmVuZCk7CiAgICB9OwogICAgdGhpcy5leHRlbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICB2YXIgY21wID0gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICBpZiAoY21wID09IDApCiAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGVsc2UgaWYgKGNtcCA9PSAtMSkKICAgICAgICAgICAgdmFyIHN0YXJ0ID0geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgICAgICBlbHNlCiAgICAgICAgICAgIHZhciBlbmQgPSB7IHJvdzogcm93LCBjb2x1bW46IGNvbHVtbiB9OwogICAgICAgIHJldHVybiBSYW5nZS5mcm9tUG9pbnRzKHN0YXJ0IHx8IHRoaXMuc3RhcnQsIGVuZCB8fCB0aGlzLmVuZ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VtbgogICAgICAgICAgICB9OwogICAgICAgIH0KICAgICAgICBpZiAoJHBvaW50c0luT3JkZXIoZGVsdGFFbmQsIHBvaW50LCAhbW92ZUlmRXF1YWwpKSB7CiAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICByb3c6IHBvaW50LnJvdyArIGRlbHRhUm93U2hpZnQsCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbiArIChwb2ludC5yb3cgPT0gZGVsdGFFbmQucm93ID8gZGVsdGFDb2xTaGlmdCA6IDApCiAgICAgICAgICAgIH07CiAgICAgICAgfQogICAgICAgIHJldHVybiB7CiAgICAgICAgICAgIHJvdzogZGVsdGFTdGFydC5yb3csCiAgICAgICAgICAgIGNvbHVtbjogZGVsdGFTdGFydC5jb2x1bW4KICAgICAgICB9OwogICAgfQogICAgdGhpcy5zZXRQb3NpdGlvbiA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbiwgbm9DbGlwKSB7CiAgICAgICAgdmFyIHBvczsKICAgICAgICBpZiAobm9DbGlwKSB7CiAgICAgICAgICAgIHBvcyA9IHsKICAgICAgICAgICAgICAgIHJvdzogcm93LAogICAgICAgICAgICAgICAgY29sdW1uOiBjb2x1bW4KICAgICAgICAgICAgfTsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHBvcyA9IHRoaXMuJGNsaXBQb3NpdGlvblRvRG9jdW1lbnQocm93LCBjb2x1bW4pOwogICAgICAgIH0KICAgICAgICBpZiAodGhpcy5yb3cgPT0gcG9zLnJvdyAmJiB0aGlzLmNvbHVtbiA9PSBwb3MuY29sdW1uKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgdmFyIG9sZCA9IHsKICAgICAgICAgICAgcm93OiB0aGlzLnJvdywKICAgICAgICAgICAgY29sdW1uOiB0aGlzLmNvbHVtbgogICAgICAgIH07CiAgICAgICAgdGhpcy5yb3cgPSBwb3Mucm93OwogICAgICAgIHRoaXMuY29sdW1uID0g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aGlzLl9zaWduYWwoImNoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lQ2hhcmFjdGVyID0gZnVuY3Rpb24gKCkgewogICAgICAgIHN3aXRjaCAodGhpcy4kbmV3TGluZU1vZGUpIHsKICAgICAgICAgICAgY2FzZSAid2luZG93cyI6CiAgICAgICAgICAgICAgICByZXR1cm4gIlxyXG4iOwogICAgICAgICAgICBjYXNlICJ1bml4IjoKICAgICAgICAgICAgICAgIHJldHVybiAiXG4iOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuJGF1dG9OZXdMaW5lIHx8ICJcbiI7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuJGF1dG9OZXdMaW5lID0gIiI7CiAgICB0aGlzLiRuZXdMaW5lTW9kZSA9ICJhdXRvIjsKICAgIHRoaXMuc2V0TmV3TGluZU1vZGUgPSBmdW5jdGlvbiAobmV3TGluZU1vZGUpIHsKICAgICAgICBpZiAodGhpcy4kbmV3TGluZU1vZGUgPT09IG5ld0xpbmVNb2RlKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgdGhpcy4kbmV3TGluZU1vZGUgPSBuZXdMaW5lTW9kZTsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lTW9kZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICByZXR1cm4gdGhpcy4kbmV3TGluZU1vZGU7CiAgICB9OwogICAgdGhpcy5pc05ld0xpbmUgPSBmdW5jdGlvbiAodGV4dCkgewogICAgICAgIHJldHVybiAodGV4dCA9PSAiXHJcbiIgfHwgdGV4dCA9PSAiXHIiIHx8IHRleHQgPT0gIlxuIik7CiAgICB9OwogICAgdGhpcy5nZXRMaW5lID0gZnVuY3Rpb24gKHJvdykgewogICAgICAgIHJldHVybiB0aGlzLiRsaW5lc1tyb3ddIHx8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JdKTsKICAgIH07CiAgICB0aGlzLmluc2VydCA9IGZ1bmN0aW9uIChwb3NpdGlvbiwgdGV4dCkgewogICAgICAgIGlmICh0aGlzLmdldExlbmd0aCgpIDw9IDEpCiAgICAgICAgICAgIHRoaXMuJGRldGVjdE5ld0xpbmUodGV4dCk7CiAgICAgICAgcmV0dXJuIHRoaXMuaW5zZXJ0TWVyZ2VkTGluZXMocG9zaXRpb24sIHRoaXMuJHNwbGl0KHRleHQpKTsKICAgIH07CiAgICB0aGlzLmluc2VydEluTGluZSA9IGZ1bmN0aW9uIChwb3NpdGlvbiwgdGV4dCkgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhwb3NpdGlvbi5yb3csIHBvc2l0aW9uLmNvbHVtbik7CiAgICAgICAgdmFyIGVuZCA9IHRoaXMucG9zKHBvc2l0aW9uLnJvdywgcG9zaXRpb24uY29sdW1uICsgdGV4dC5sZW5ndGgpOwogICAgICAgIHRoaXMuYXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCwKICAgICAgICAgICAgZW5kOiBlbmQsCiAgICAgICAgICAgIGFjdGlvbjogImluc2VydCIsCiAgICAgICAgICAgIGxpbmVzOiBbdGV4dF0KICAgICAgICB9LCB0cnVlKTsKICAgICAgICByZXR1cm4gdGhpcy5jbG9uZVBvcyhlbmQpOwogICAgfTsKICAgIHRoaXMuY2xpcHBlZFBvcyA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHZhciBsZW5ndGggPSB0aGlzLmdldExlbmd0aCgpOwogICAgICAgIGlmIChyb3cgPT09IHVuZGVmaW5lZCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGg7CiAgICAgICAgfQogICAgICAgIGVsc2UgaWYgKHJvdyA8IDApIHsKICAgICAgICAgICAgcm93ID0gMDsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAocm93ID49IGxlbmd0aCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGggLSAxOwogICAgICAgICAgICBjb2x1bW4gPSB1bmRlZmluZWQ7CiAgICAgICAgfQogICAgICAgIHZhciBsaW5lID0gdGhpcy5nZXRMaW5lKHJvdyk7CiAgICAgICAgaWYgKGNvbHVtbiA9PSB1bmRlZmluZWQpCiAgICAgICAgICAgIGNvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIGNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KGNvbHVtbiwgMCksIGxpbmUubGVuZ3RoKTsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLmNsb25lUG9zID0gZnVuY3Rpb24gKHBvcykgewogICAgICAgIHJldHVybiB7IHJvdzogcG9zLnJvdywgY29sdW1uOiBwb3MuY29sdW1uIH07CiAgICB9OwogICAgdGhpcy5wb3MgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLiRjbGlwUG9zaXRpb24gPSBmdW5jdGlvbiAocG9zaXRpb24pIHsKICAgICAgICB2YXIgbGVuZ3RoID0gdGhpcy5nZXRMZW5ndGgoKTsKICAgICAgICBpZiAocG9zaXRpb24ucm93ID49IGxlbmd0aCkgewogICAgICAgICAgICBwb3NpdGlvbi5yb3cgPSBNYXRoLm1heCgwLCBsZW5ndGggLSAxKTsKICAgICAgICAgICAgcG9zaXRpb24uY29sdW1uID0gdGhpcy5nZXRMaW5lKGxlbmd0aCAtIDEpLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHBvc2l0aW9uLnJvdyA9IE1hdGgubWF4KDAsIHBvc2l0aW9uLnJvdyk7CiAgICAgICAgICAgIHBvc2l0aW9uLmNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KHBvc2l0aW9uLmNvbHVtbiwgMCksIHRoaXMuZ2V0TGluZShwb3NpdGlvbi5yb3cpLmxlbmd0aCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBwb3NpdGlvbjsKICAgIH07CiAgICB0aGlzLmluc2VydEZ1bGxMaW5lcyA9IGZ1bmN0aW9uIChyb3csIGxpbmVzKSB7CiAgICAgICAgcm93ID0gTWF0aC5taW4oTWF0aC5tYXgocm93LCAwKSwgdGhpcy5nZXRMZW5ndGgoKSk7CiAgICAgICAgdmFyIGNvbHVtbiA9IDA7CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuZ2V0TGVuZ3RoKCkpIHsKICAgICAgICAgICAgbGluZXMgPSBsaW5lcy5jb25jYXQoWyIiXSk7CiAgICAgICAgICAgIGNvbHVtbiA9IDA7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICBsaW5lcyA9IFsiIl0uY29uY2F0KGxpbmVzKTsKICAgICAgICAgICAgcm93LS07CiAgICAgICAgICAgIGNvbHVtbiA9IHRoaXMuJGxpbmVzW3Jvd10ubGVuZ3RoOwogICAgICAgIH0KICAgICAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzKHsgcm93OiByb3csIGNvbHVtbjogY29sdW1uIH0sIGxpbmVzKTsKICAgIH07CiAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzID0gZnVuY3Rpb24gKHBvc2l0aW9uLCBsaW5lcykgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhwb3NpdGlvbi5yb3csIHBvc2l0aW9uLmNvbHVtbik7CiAgICAgICAgdmFyIGVuZCA9IHsKICAgICAgICAgICAgcm93OiBzdGFydC5yb3cgKyBsaW5lcy5sZW5ndGggLSAxLAogICAgICAgICAgICBjb2x1bW46IChsaW5lcy5sZW5ndGggPT0gMSA/IHN0YXJ0LmNvbHVtbiA6IDApICsgbGluZXNbbGluZXMubGVuZ3RoIC0gMV0ubGVuZ3RoCiAgICAgICAgfTsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoewogICAgICAgICAgICBzdGFydDogc3RhcnQsCiAgICAgICAgICAgIGVuZDogZW5kLAogICAgICAgICAgICBhY3Rpb246ICJpbnNlcnQiLAogICAgICAgICAgICBsaW5lczogbGluZXMKICAgICAgICB9KTsKICAgICAgICByZXR1cm4gdGhpcy5jbG9uZVBvcyhlbmQpOwogICAgfTsKICAgIHRoaXMucmVtb3ZlID0gZnVuY3Rpb24gKHJhbmdlKSB7CiAgICAgICAgdmFyIHN0YXJ0ID0gdGhpcy5jbGlwcGVkUG9zKHJhbmdlLnN0YXJ0LnJvdywgcmFuZ2Uuc3RhcnQuY29sdW1uKTsKICAgICAgICB2YXIgZW5kID0gdGhpcy5jbGlwcGVkUG9zKHJhbmdlLmVuZC5yb3csIHJhbmdlLmVuZC5jb2x1bW4pOwogICAgICAgIHRoaXMuYXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCwKICAgICAgICAgICAgZW5kOiBlbmQsCiAgICAgICAgICAgIGFjdGlvbjogInJlbW92ZSIsCiAgICAgICAgICAgIGxpbmVzOiB0aGlzLmdldExpbmVzRm9yUmFuZ2UoeyBzdGFydDogc3RhcnQsIGVuZDogZW5kIH0pCiAgICAgICAgfSk7CiAgICAgICAgcmV0dXJuIHRoaXMuY2xvbmVQb3Moc3RhcnQpOwogICAgfTsKICAgIHRoaXMucmVtb3ZlSW5MaW5lID0gZnVuY3Rpb24gKHJvdywgc3RhcnRDb2x1bW4sIGVuZENvbHVtbikgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhyb3csIHN0YXJ0Q29sdW1uKTsKICAgICAgICB2YXIgZW5kID0gdGhpcy5jbGlwcGVkUG9zKHJvdywgZW5kQ29sdW1uKTsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoewogICAgICAgICAgICBzdGFydDogc3RhcnQsCiAgICAgICAgICAgIGVuZDogZW5kLAogICAgICAgICAgICBhY3Rpb246ICJyZW1vdmUiLAogICAgICAgICAgIC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RSb3csIGVuZENvbCk7CiAgICAgICAgdmFyIGRlbGV0ZWRMaW5lcyA9IHRoaXMuJGxpbmVzLnNsaWNlKGZpcnN0Um93LCBsYXN0Um93ICsgMSk7CiAgICAgICAgdGhpcy5hcHBseURlbHRhKHsKICAgICAgICAgICAgc3RhcnQ6IHJhbmdlLnN0YXJ0LAogICAgICAgICAgICBlbmQ6IHJhbmdlLmVuZCwKICAgICAgICAgICAgYWN0aW9uOiAicmVtb3ZlIiwKICAgICAgICAgICAgbGluZXM6IHRoaXMuZ2V0TGluZXNGb3JSYW5nZShyYW5nZSkKICAgICAgICB9KTsKICAgICAgICByZXR1cm4gZGVsZXRlZExpbmVzOwogICAgfTsKICAgIHRoaXMucmVtb3ZlTmV3TGluZSA9IGZ1bmN0aW9uIChyb3cpIHsKICAgICAgICBpZiAocm93IDwgdGhpcy5nZXRMZW5ndGgoKSAtIDEgJiYgcm93ID49IDApIHsKICAgICAgICAgICAgdGhpcy5hcHBseURlbHRhKHsKICAgICAgICAgICAgICAgIHN0YXJ0OiB0aGlzLnBvcyhyb3csIHRoaXMuZ2V0TGluZShyb3cpLmxlbmd0aCksCiAgICAgICAgICAgICAgICBlbmQ6IHRoaXMucG9zKHJvdyArIDEsIDApLAogICAgICAgICAgICAgICAgYWN0aW9uOiAicmVtb3ZlIiwKICAgICAgICAgICAgICAgIGxpbmVzOiBbIiIsICIiXQogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5yZXBsYWNlID0gZnVuY3Rpb24gKHJhbmdlLCB0ZXh0KSB7CiAgICAgICAgaWYgKCEocmFuZ2UgaW5zdGFuY2VvZiBSYW5nZSkpCiAgICAgICAgICAgIHJhbmdlID0gUmFuZ2UuZnJvbVBvaW50cyhyYW5nZS5zdGFydCwgcmFuZ2UuZW5kKTsKICAgICAgICBpZiAodGV4dC5sZW5ndGggPT09IDAgJiYgcmFuZ2UuaXNFbXB0eSgpKQogICAgICAgICAgICByZXR1cm4gcmFuZ2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Zyb20gPSAwLCB0byA9IDA7IGZyb20gPCBsOyBmcm9tID0gdG8pIHsKICAgICAgICAgICAgdG8gKz0gTUFYIC0gMTsKICAgICAgICAgICAgdmFyIGNodW5rID0gbGluZXMuc2xpY2UoZnJvbSwgdG8pOwogICAgICAgICAgICBjaHVuay5wdXNoKCIiKTsKICAgICAgICAgICAgdGhpcy5hcHBseURlbHRhKHsKICAgICAgICAgICAgICAgIHN0YXJ0OiB0aGlzLnBvcyhyb3cgKyBmcm9tLCBjb2x1bW4pLAogICAgICAgICAgICAgICAgZW5kOiB0aGlzLnBvcyhyb3cgKyB0bywgY29sdW1uID0gMCksCiAgICAgICAgICAgICAgICBhY3Rpb246IGRlbHRhLmFjdGlvbiwKICAgICAgICAgICAgICAgIGxpbmVzOiBjaHVuawogICAgICAgICAgICB9LCB0cnVlKTsKICAgICAgICB9CiAgICAgICAgZGVsdGEubGluZXMgPSBsaW5lcy5zbGljZShmcm9tKTsKICAgICAgICBkZWx0YS5zdGFydC5yb3cgPSByb3cgKyBmcm9tOwogICAgICAgIGRlbHRhLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoZGVsdGEsIHRydWUpOwogICAgfTsKICAgIHRoaXMucmV2ZXJ0RGVsdGEgPSBmdW5jdGlvbiAoZGVsdGEpIHsKICAgICAgICB0aGlzLiRzYWZlQXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiB0aGlzLmNsb25lUG9zKGRlbHRhLnN0YXJ0KSwKICAgICAgICAgICAgZW5kOiB0aGlzLmNsb25lUG9zKGRlbHRhLmVuZCksCiAgICAgICAgICAgIGFjdGlvbjogKGRlbHRhLmFjdGlvbiA9PSAiaW5zZXJ0IiA/ICJyZW1vdmUiIDogImluc2VydCIpLAogICAgICAgICAgICBsaW5lczogZGVsdGEubGluZXMuc2xpY2UoKQogICAgICAgIH0pOwogICAgfTsKICAgIHRoaXMuaW5kZXhUb1Bvc2l0aW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KZXhwb3J0cy5jb3B5T2JqZWN0ID0gZnVuY3Rpb24gKG9iaikgewogICAgdmFyIGNvcHkgPSB7fTsKICAgIGZvciAodmFyIGtleSBpbiBvYmopIHsKICAgICAgICBjb3B5W2tleV0gPSBvYmpba2V5XTsKICAgIH0KICAgIHJldHVybiBjb3B5Owp9OwpleHBvcnRzLmNvcHlBcnJheSA9IGZ1bmN0aW9uIChhcnJheSkgewogICAgdmFyIGNvcHkgPSBbXTsKICAgIGZvciAodmFyIGkgPSAwLCBsID0gYXJyYXkubGVuZ3RoOyBpIDwgbDsgaSsrKSB7CiAgICAgICAgaWYgKGFycmF5W2ldICYmIHR5cGVvZiBhcnJheVtpXSA9PSAib2JqZWN0IikKICAgICAgICAgICAgY29weVtpXSA9IHRoaXMuY29weU9iamVjdChhcnJheVtpXSk7CiAgICAgICAgZWxzZQogICAgICAgICAgICBjb3B5W2ldID0gYXJyYXlbaV07CiAgICB9CiAgICByZXR1cm4gY29weTsKfTsKZXhwb3J0cy5kZWVwQ29weSA9IGZ1bmN0aW9uIGRlZXBDb3B5KG9iaikgewogICAgaWYgKHR5cGVvZiBvYmogIT09ICJvYmplY3QiIHx8ICFvYmopCiAgICAgICAgcmV0dXJuIG9iajsKICAgIHZhciBjb3B5OwogICAgaWYgKEFycmF5LmlzQXJyYXkob2JqKSkgewogICAgICAgIGNvcHkgPSBbXTsKICAgICAgICBmb3IgKHZhciBrZXkgPSAwOyBrZXkgPCBvYmoubGVuZ3RoOyBrZXkrKykgewogICAgICAgICAgICBjb3B5W2tleV0gPSBkZWVwQ29weShvYmpba2V5XSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBjb3B5OwogICAgfQogICAgaWYgKE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChvYmopICE9PSAiW29iamVjdCBPYmplY3RdIikKICAgICAgICByZXR1cm4gb2JqOwogICAgY29weSA9IHt9OwogICAgZm9yICh2YXIga2V5IGluIG9iaikKICAgICAgICBjb3B5W2tleV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NlIHN0cmljdCI7Cgp2YXIgRG9jdW1lbnQgPSByZXF1aXJlKCIuLi9kb2N1bWVudCIpLkRvY3VtZW50Owp2YXIgbGFuZyA9IHJlcXVpcmUoIi4uL2xpYi9sYW5nIik7CiAgICAKdmFyIE1pcnJvciA9IGV4cG9ydHMuTWlycm9yID0gZnVuY3Rpb24oc2VuZGVyKSB7CiAgICB0aGlzLnNlbmRlciA9IHNlbmRlcjsKICAgIHZhciBkb2MgPSB0aGlzLmRvYyA9IG5ldyBEb2N1bWVudCgiIik7CiAgICAKICAgIHZhciBkZWZlcnJlZFVwZGF0ZSA9IHRoaXMuZGVmZXJyZWRVcGRhdGUgPSBsYW5nLmRlbGF5ZWRDYWxsKHRoaXMub25VcGRhdGUuYmluZCh0aGlzKSk7CiAgICAKICAgIHZhciBfc2VsZiA9IHRoaXM7CiAgICBzZW5kZXIub24oImNoYW5nZSIsIGZ1bmN0aW9uKGUpIHsKICAgICAgICB2YXIgZGF0YSA9IGUuZGF0YTsKICAgICAgICBpZiAoZGF0YVswXS5zdGFydCkgewogICAgICAgICAgICBkb2MuYXBwbHlEZWx0YXMoZGF0YSk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBkYXRhLmxlbmd0aDsgaSArPSAyKSB7CiAgICAgICAgICAgICAgICB2YXIgZCwgZXJyOyAKICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGRhdGFbaSsxXSkpIHsKICAgICAgICAgICAgICAgICAgICBkID0ge2FjdGlvbjogImluc2VydCIsIHN0YXJ0OiBkYXRhW2ldLCBsaW5lczogZGF0YVtpKzFdfTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgZCA9IHthY3Rpb246ICJyZW1vdmUiLCBzdGFydDogZGF0YVtpXSwgZW5kOiBkYXRhW2krMV19OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBpZiAoKGQuYWN0aW9uID09ICJpbnNlcnQiID8gZC5zdGFydCA6IGQuZW5kKS5yb3cgPj0gZG9jLiRsaW5lcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICBlcnIgPSBuZXcgRXJyb3IoIkludmFsaWQgZGVsdGEiKTsKICAgICAgICAgICAgICAgICAgICBlcnIuZGF0YSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogX3NlbGYuJHBhdGgsCiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzTGVuZ3RoOiBkb2MuJGxpbmVzLmxlbmd0aCwKICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQ6IGQuc3RhcnQsCiAgICAgICAgICAgICAgICAgICAgICAgIGVuZDogZC5lbmQKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHRocm93IGVycjsKICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICBkb2MuYXBwbHlEZWx0YShkLCB0cnVlKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoX3NlbGYuJHRpbWVvdXQpCiAgICAgICAgICAgIHJldHVybiBkZWZlcnJlZFVwZGF0ZS5zY2hlZHVsZShfc2VsZi4kdGltZW91dCk7CiAgICAgICAgX3NlbGYub25VcGRhdGUoKTsKICAgIH0pOwp9OwoKKGZ1bmN0aW9uKCkgewogICAgCiAgICB0aGlzLiR0aW1lb3V0ID0gNTAwOwogICAgCiAgICB0aGlzLnNldFRpbWVvdXQgPSBmdW5jdGlvbih0aW1lb3V0KSB7CiAgICAgICAgdGhpcy4kdGltZW91dCA9IHRpbWVvdXQ7CiAgICB9OwogICAgCiAgICB0aGlzLnNldFZhbHVlID0gZnVuY3Rpb24odmFsdWUpIHsKICAgICAgICB0aGlzLmRvYy5zZXRWYWx1ZSh2YWx1ZSk7CiAgICAgICAgdGhpcy5kZWZlcnJlZFVwZGF0ZS5zY2hlZHVsZSh0aGlzLiR0aW1lb3V0KTsKICAgIH07CiAgICAKICAgIHRoaXMuZ2V0VmFsdWUgPSBmdW5jdGlvbihjYWxsYmFja0lkKSB7CiAgICAgICAgdGhpcy5zZW5kZXIuY2FsbGJhY2sodGhpcy5kb2MuZ2V0VmFsdWUoKSwgY2FsbGJhY2tJZCk7CiAgICB9OwogICAgCiAgICB0aGlzLm9uVXBkYXRlID0gZnVuY3Rpb24oKSB7CiAgICB9OwogICAgCiAgICB0aGlzLmlzUGVuZGluZyA9IGZ1bmN0aW9uKCkgewogICAgICAgIHJldHVybiB0aGlzLmRlZmVycmVkVXBkYXRlLmlzUGVuZGluZygpOwogICAgfTsKICAgIAp9KS5jYWxsKE1pcnJvci5wcm90b3R5cGUpOwoKfSk7CgphY2UuZGVmaW5lKCJhY2UvbW9kZS9qc29uL2pzb25fcGFyc2UiLFtdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpIHsKInVzZSBzdHJpY3QiOwoKICAgIHZhciBhdCwgICAgIC8vIFRoZSBpbmRleCBvZiB0aGUgY3VycmVudCBjaGFyYWN0ZXIKICAgICAgICBjaCwgICAgIC8vIFRoZSBjdXJyZW50IGNoYXJhY3RlcgogICAgICAgIGVzY2FwZWUgPSB7CiAgICAgICAgICAgICciJzogICciJywKICAgICAgICAgICAgJ1xcJzogJ1xcJywKICAgICAgICAgICAgJy8nOiAgJy8nLAogICAgICAgICAgICBiOiAgICAnXGInLAogICAgICAgICAgICBmOiAgICAnXGYnLAogICAgICAgICAgICBuOiAgICAnXG4nLAogICAgICAgICAgICByOiAgICAnXHInLAogICAgICAgICAgICB0OiAgICAnXHQnCiAgICAgICAgfSwKICAgICAgICB0ZXh0LAoKICAgICAgICBlcnJvciA9IGZ1bmN0aW9uIChtKSB7CgogICAgICAgICAgICB0aHJvdyB7CiAgICAgICAgICAgICAgICBuYW1lOiAgICAnU3ludGF4RXJyb3InLAogICAgICAgICAgICAgICAgbWVzc2FnZTogbSwKICAgICAgICAgICAgICAgIGF0OiAgICAgIGF0LAogICAgICAgICAgICAgICAgdGV4dDogICAgdGV4dAogICAgICAgICAgICB9OwogICAgICAgIH0sCgogICAgICAgIG5leHQgPSBmdW5jdGlvbiAoYykgewoKICAgICAgICAgICAgaWYgKGMgJiYgYyAhPT0gY2gpIHsKICAgICAgICAgICAgICAgIGVycm9yKCJFeHBlY3RlZCAnIiArIGMgKyAiJyBpbnN0ZWFkIG9mICciICsgY2ggKyAiJyIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBjaCA9IHRleHQuY2hhckF0KGF0KTsKICAgICAgICAgICAgYXQgKz0gMTsKICAgICAgICAgICAgcmV0dXJuIGNoOwogICAgICAgIH0sCgogICAgICAgIG51bWJlciA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHZhciBudW1iZXIsCiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnJzsKCiAgICAgICAgICAgIGlmIChjaCA9PT0gJy0nKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnLSc7CiAgICAgICAgICAgICAgICBuZXh0KCctJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgd2hpbGUgKGNoID49ICcwJyAmJiBjaCA8PSAnOScpIHsKICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICcuJykgewogICAgICAgICAgICAgICAgc3RyaW5nICs9ICcuJzsKICAgICAgICAgICAgICAgIHdoaWxlIChuZXh0KCkgJiYgY2ggPj0gJzAnICYmIGNoIDw9ICc5JykgewogICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICdlJyB8fCBjaCA9PT0gJ0UnKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgKz0gY2g7CiAgICAgICAgICAgICAgICBuZXh0KCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICctJyB8fCBjaCA9PT0gJysnKSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHdoaWxlIChjaCA+PSAnMCcgJiYgY2ggPD0gJzknKSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBudW1iZXIgPSArc3RyaW5nOwogICAgICAgICAgICBpZiAoaXNOYU4obnVtYmVyKSkgewogICAgICAgICAgICAgICAgZXJyb3IoIkJhZCBudW1iZXIiKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHJldHVybiBudW1iZXI7CiAgICAgICAgICAgIH0KICAgICAgICB9LAoKICAgICAgICBzdHJpbmcgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICB2YXIgaGV4LAogICAgICAgICAgICAgICAgaSwKICAgICAgICAgICAgICAgIHN0cmluZyA9ICcnLAogICAgICAgICAgICAgICAgdWZmZmY7CgogICAgICAgICAgICBpZiAoY2ggPT09ICciJykgewogICAgICAgICAgICAgICAgd2hpbGUgKG5leHQoKSkgewogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJyInKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0cmluZzsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAnXFwnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoID09PSAndScpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVmZmZmID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCA0OyBpICs9IDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXggPSBwYXJzZUludChuZXh0KCksIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzRmluaXRlKGhleCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVmZmZmID0gdWZmZmYgKiAxNiArIGhleDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKHVmZmZmKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgZXNjYXBlZVtjaF0gPT09ICdzdHJpbmcnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgKz0gZXNjYXBlZVtjaF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT0gIlxuIiB8fCBjaCA9PSAiXHIiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXJyb3IoIkJhZCBzdHJpbmciKTsKICAgICAgICB9LAoKICAgICAgICB3aGl0ZSA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHdoaWxlIChjaCAmJiBjaCA8PSAnICcpIHsKICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgfQogICAgICAgIH0sCgogICAgICAgIHdvcmQgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICBzd2l0Y2ggKGNoKSB7CiAgICAgICAgICAgIGNhc2UgJ3QnOgogICAgICAgICAgICAgICAgbmV4dCgndCcpOwogICAgICAgICAgICAgICAgbmV4dCgncicpOwogICAgICAgICAgICAgICAgbmV4dCgndScpOwogICAgICAgICAgICAgICAgbmV4dCgnZScpOwogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIGNhc2UgJ2YnOgogICAgICAgICAgICAgICAgbmV4dCgnZicpOwogICAgICAgICAgICAgICAgbmV4dCgnYScpOwogICAgICAgICAgICAgICAgbmV4dCgnbCcpOwogICAgICAgICAgICAgICAgbmV4dCgncycpOwogICAgICAgICAgICAgICAgbmV4dCgnZScpOwogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICBjYXNlICduJzoKICAgICAgICAgICAgICAgIG5leHQoJ24nKTsKICAgICAgICAgICAgICAgIG5leHQoJ3UnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2wnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2wnKTsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVycm9yKCJVbmV4cGVjdGVkICciICsgY2ggKyAiJyIpOwogICAgICAgIH0sCgogICAgICAgIHZhbHVlLCAgLy8gUGxhY2UgaG9sZGVyIGZvciB0aGUgdmFsdWUgZnVuY3Rpb24uCgogICAgICAgIGFycmF5ID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgdmFyIGFycmF5ID0gW107CgogICAgICAgICAgICBpZiAoY2ggPT09ICdbJykgewogICAgICAgICAgICAgICAgbmV4dCgnWycpOwogICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnXScpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhcnJheTsgICAvLyBlbXB0eSBhcnJheQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGNoKSB7CiAgICAgICAgICAgICAgICAgICAgYXJyYXkucHVzaCh2YWx1ZSgpKTsKICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoJ10nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFycmF5OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBuZXh0KCcsJyk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBlcnJvcigiQmFkIGFycmF5Iik7CiAgICAgICAgfSwKCiAgICAgICAgb2JqZWN0ID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgdmFyIGtleSwKICAgICAgICAgICAgICAgIG9iamVjdCA9IHt9OwoKICAgICAgICAgICAgaWYgKGNoID09PSAneycpIHsKICAgICAgICAgICAgICAgIG5leHQoJ3snKTsKICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICd9JykgewogICAgICAgICAgICAgICAgICAgIG5leHQoJ30nKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gb2JqZWN0OyAgIC8vIGVtcHR5IG9iamVjdAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGNoKSB7CiAgICAgICAgICAgICAgICAgICAga2V5ID0gc3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgICAgICBuZXh0KCc6Jyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iamVjdCwga2V5KSkgewogICAgICAgICAgICAgICAgICAgICAgICBlcnJvcignRHVwbGljYXRlIGtleSAiJyArIGtleSArICciJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIG9iamVjdFtrZXldID0gdmFsdWUoKTsKICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ30nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoJ30nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9iamVjdDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnLCcpOwogICAgICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXJyb3IoIkJhZCBvYmplY3QiKTsKICAgICAgICB9OwoKICAgIHZhbHVlID0gZnVuY3Rpb24gKCkgewoKICAgICAgICB3aGl0ZSgpOwogICAgICAgIHN3aXRjaCAoY2gpIHsKICAgICAgICBjYXNlICd7JzoKICAgICAgICAgICAgcmV0dXJuIG9iamVjdCgpOwogICAgICAgIGNhc2UgJ1snOgogICAgICAgICAgICByZXR1cm4gYXJyYXkoKTsKICAgICAgICBjYXNlICciJzoKICAgICAgICAgICAgcmV0dXJuIHN0cmluZygpOwogICAgICAgIGNhc2UgJy0nOgogICAgICAgICAgICByZXR1cm4gbnVtYmVyKCk7CiAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgcmV0dXJuIGNoID49ICcwJyAmJiBjaCA8PSAnOScgPyBudW1iZXIoKSA6IHdvcmQoKTsKICAgICAgICB9CiAgICB9OwoKICAgIHJldHVybiBmdW5jdGlvbiAoc291cmNlLCByZXZpdmVyKSB7CiAgICAgICAgdmFyIHJlc3VsdDsKCiAgICAgICAgdGV4dCA9IHNvdXJjZTsKICAgICAgICBhdCA9IDA7CiAgICAgICAgY2ggPSAnICc7CiAgICAgICAgcmVzdWx0ID0gdmFsdWUoKTsKICAgICAgICB3aGl0ZSgpOwogICAgICAgIGlmIChjaCkgewogICAgICAgICAgICBlcnJvcigiU3ludGF4IGVycm9yIik7CiAgICAgICAgfQoKICAgICAgICByZXR1cm4gdHlwZW9mIHJldml2ZXIgPT09ICdmdW5jdGlvbicgPyBmdW5jdGlvbiB3YWxrKGhvbGRlciwga2V5KSB7CiAgICAgICAgICAgIHZhciBrLCB2LCB2YWx1ZSA9IGhvbGRlcltrZXldOwogICAgICAgICAgICBpZiAodmFsdWUgJiYgdHlwZW9mIHZhbHVlID09PSAnb2JqZWN0JykgewogICAgICAgICAgICAgICAgZm9yIChrIGluIHZhbHVlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKHZhbHVlLCBrKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2ID0gd2Fsayh2YWx1ZSwgayk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2ICE9PSB1bmRlZmluZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlW2tdID0gdjsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB2YWx1ZVtrXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gcmV2aXZlci5jYWxsKGhvbGRlciwga2V5LCB2YWx1ZSk7CiAgICAgICAgfSh7Jyc6IHJlc3VsdH0sICcnKSA6IHJlc3VsdDsKICAgIH07Cn0pOwoKYWNlLmRlZmluZSgiYWNlL21vZGUvanNvbl93b3JrZXIiLFtdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpIHsKInVzZSBzdHJpY3QiOwoKdmFyIG9vcCA9IHJlcXVpcmUoIi4uL2xpYi9vb3AiKTsKdmFyIE1pcnJvciA9IHJlcXVpcmUoIi4uL3dvcmtlci9taXJyb3IiKS5NaXJyb3I7CnZhciBwYXJzZSA9IHJlcXVpcmUoIi4vanNvbi9qc29uX3BhcnNlIik7Cgp2YXIgSnNvbldvcmtlciA9IGV4cG9ydHMuSnNvbldvcmtlciA9IGZ1bmN0aW9uKHNlbmRlcikgewogICAgTWlycm9yLmNhbGwodGhpcywgc2VuZGVyKTsKICAgIHRoaXMuc2V0VGltZW91dCgyMDApOwp9OwoKb29wLmluaGVyaXRzKEpzb25Xb3JrZXIsIE1pcnJvcik7CgooZnVuY3Rpb24oKSB7CgogICAgdGhpcy5vblVwZGF0ZSA9IGZ1bmN0aW9uKCkgewogICAgICAgIHZhciB2YWx1ZSA9IHRoaXMuZG9jLmdldFZhbHVlKCk7CiAgICAgICAgdmFyIGVycm9ycyA9IFtdOwogICAgICAgIHRyeSB7CiAgICAgICAgICAgIGlmICh2YWx1ZSkKICAgICAgICAgICAgICAgIHBhcnNlKHZhbHVlKTsKICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgIHZhciBwb3MgPSB0aGlzLmRvYy5pbmRleFRvUG9zaXRpb24oZS5hdC0xKTsKICAgICAgICAgICAgZXJyb3JzLnB1c2goewogICAgICAgICAgICAgICAgcm93OiBwb3Mucm93LAogICAgICAgICAgICAgICAgY29sdW1uOiBwb3MuY29sdW1uLAogICAgICAgICAgICAgICAgdGV4dDogZS5tZXNzYWdlLAogICAgICAgICAgICAgICAgdHlwZTogImVycm9yIgogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgdGhpcy5zZW5kZXIuZW1pdCgiYW5ub3RhdGUiLCBlcnJvcnMpOwogICAgfTsKCn0pLmNhbGwoSnNvbldvcmtlci5wcm90b3R5cGUpOwoKfSk7Cg==";ace.config.setModuleUrl("ace/theme/kr_theme",themeUrl2),ace.config.setModuleUrl("ace/mode/json",modeJsonUrl),ace.config.setModuleUrl("ace/mode/json_worker",workerJsonUrl);const _sfc_main$x=vue.defineComponent({__name:"code-edit-modal",props:{modelValue:{default:()=>({})},lang:{default:"json"},title:{default:"编辑"}},emits:["update:modelValue","close"],setup(i,{emit:r}){const n=i,o=vue.ref(!1),a=r,u=vue.computed({get(){return n.lang==="json"?JSON.stringify(n.modelValue,null,2):n.modelValue},set(c){n.lang==="json"?a("update:modelValue",JSON.parse(c)):a("update:modelValue",c)}});return(c,d)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElButton),{onClick:d[0]||(d[0]=f=>o.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("···")]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDialog),{class:"modal-full",modelValue:vue.unref(o),"onUpdate:modelValue":d[2]||(d[2]=f=>vue.isRef(o)?o.value=f:null),title:n.title,width:"60%",onClose:d[3]||(d[3]=f=>a("close"))},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(VAceEditor),{value:vue.unref(u),"onUpdate:value":d[1]||(d[1]=f=>vue.isRef(u)?u.value=f:null),lang:n.lang,theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value","lang"])]),_:1},8,["modelValue","title"])]))}}),_hoisted_1$7={class:"one-row-txt",style:{width:"78px"}},_hoisted_2$5={key:1},_hoisted_3$4={class:"one-row-txt",style:{width:"145px"}},_hoisted_4$2={key:1},_sfc_main$w=vue.defineComponent({__name:"dynamic-el-form-item",props:{objInfo:{default:()=>({})},hide:{default:()=>[]},code:{type:Boolean,default:!1}},emits:["change"],setup(i,{emit:r}){const n=r,o=i,a=vue.computed(()=>{var h;const c={};let d=0,f=[];for(let y of Object.keys(o.objInfo)){const g=(h=o.objInfo[y])==null?void 0:h.sort;if(g){const p=Number(g);p>d&&(d=p)}if(g)c[g]=y;else return Object.keys(o.objInfo).map(p=>({...o.objInfo[p],_key:p}))}for(let y=0;y<d+1;y++){const g=String(y);f.push({...o.objInfo[c[g]],_key:c[g]})}return f});function u(c){let d=window.setTimeout(function(){n("change",c),clearTimeout(d),d=null},200)}return(c,d)=>(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(a),f=>(vue.openBlock(),vue.createElementBlock("div",{key:f._key},[o.code?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,class:"props-row",size:"small"},{label:vue.withCtx(()=>[vue.unref(getStringWidth)(String(f._key))>78?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:String(f._key),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$7,vue.toDisplayString(f._key),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$5,vue.toDisplayString(f._key),1))]),default:vue.withCtx(()=>[vue.unref(getStringWidth)(String(f.val))>145?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:JSON.stringify(f.val),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$4,vue.toDisplayString(f.val),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$2,vue.toDisplayString(f.val),1))]),_:2},1024)):vue.createCommentVNode("",!0),o.hide.indexOf(String(f._key))<0?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:1,label:f.title,size:"small"},{default:vue.withCtx(()=>[f.type===vue.unref(EConfigItemPropsType).Select?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSelect),{key:0,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,placeholder:"Select",size:"small",disabled:!!(f!=null&&f.disabled),onChange:u},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(f.options,h=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).InputNumber?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInputNumber),{key:1,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Input?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:2,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Textarea?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:3,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,autosize:"",type:"textarea",disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Color?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElColorPicker),{key:4,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Switch?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSwitch),{key:5,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).JsonEdit?(vue.openBlock(),vue.createBlock(_sfc_main$x,{key:6,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onClose:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):vue.createCommentVNode("",!0)]),_:2},1032,["label"])):vue.createCommentVNode("",!0)]))),128))}}),dynamicElFormItem_vue_vue_type_style_index_0_scoped_b2819020_lang="",dynamicElFormItem_vue_vue_type_style_index_1_lang="",DynamicElFormItem=_export_sfc$1(_sfc_main$w,[["__scopeId","data-v-b2819020"]]),_hoisted_1$6={style:{height:"100%"}},_hoisted_2$4={class:"flex flex-wrap"},_hoisted_3$3=["onMouseenter","onClick"],_sfc_main$v=vue.defineComponent({__name:"common-animate",props:{val:{}},emits:["updateCommonAniVal"],setup(i,{emit:r}){const n=i,o=r,a=vue.ref(n.val),u=vue.ref(!1),c=vue.ref("进入"),d=vue.ref(null),f=h=>{o("updateCommonAniVal",h),u.value=!1};return vue.watch(()=>n.val,h=>{a.value=h}),(h,y)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$6,[vue.unref(a)?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:0,closable:"",onClose:y[0]||(y[0]=g=>f("")),onClick:y[1]||(y[1]=g=>u.value=!0),style:{cursor:"pointer"}},{default:vue.withCtx(()=>{var g;return[vue.createTextVNode(vue.toDisplayString((g=vue.unref(common_animate_list).map(p=>p.children).reduce((p,v)=>p.concat(v)).find(p=>p.value==vue.unref(a)))==null?void 0:g.label)+" ",1),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:10},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"setting"})]),_:1})]}),_:1})):(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:1,type:"success",style:{cursor:"pointer"},onClick:y[2]||(y[2]=g=>u.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("新增")]),_:1})),vue.createVNode(vue.unref(elementPlus.ElDrawer),{modelValue:vue.unref(u),"onUpdate:modelValue":y[5]||(y[5]=g=>vue.isRef(u)?u.value=g:null),title:"选择动画",direction:"ltr"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElTabs),{modelValue:vue.unref(c),"onUpdate:modelValue":y[4]||(y[4]=g=>vue.isRef(c)?c.value=g:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(common_animate_list),g=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTabPane),{label:g.label,name:g.label,key:g.label},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{height:"500px"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_2$4,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(g.children,(p,v)=>(vue.openBlock(),vue.createElementBlock("div",{class:"animate",key:v,onMouseenter:_=>d.value=v,onMouseleave:y[3]||(y[3]=_=>d.value=null),onClick:_=>f(p.value)},[vue.createElementVNode("div",{class:vue.normalizeClass(`${vue.unref(d)==v?`animate__animated animate__${p.value} animate__slow animate__infinite`:""}`)},vue.toDisplayString(p.label),3)],40,_hoisted_3$3))),128))])]),_:2},1024)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]))}}),commonAnimate_vue_vue_type_style_index_0_scoped_2668f60c_lang="",CommonAnimate=_export_sfc$1(_sfc_main$v,[["__scopeId","data-v-2668f60c"]]),_sfc_main$u=vue.defineComponent({__name:"component-tree",setup(i){const r=useGlobalStore(pinia),n=vue.computed(()=>{var u;return((u=r.handle_svg_info)==null?void 0:u.info.id)??""}),o=u=>{for(let c of r.done_json)c.selected=!1,c.old_position={x:0,y:0};r.intention=EGlobalStoreIntention.Select,r.setHandleSvgInfo(u)},a={children:"children",label:"title"};return(u,c)=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTree),{class:"tree-v",data:vue.unref(r).done_json,props:a,onNodeClick:o,"default-expand-all":!0,"expand-on-click-node":!1,"highlight-current":!!vue.unref(n),"node-key":"id","current-node-key":vue.unref(n)},null,8,["data","highlight-current","current-node-key"]))}}),_withScopeId$1=i=>(vue.pushScopeId("data-v-98320511"),i=i(),vue.popScopeId(),i),_hoisted_1$5={class:"wall-l"},_hoisted_2$3={class:"head-l"},_hoisted_3$2=_withScopeId$1(()=>vue.createElementVNode("span",null,"key",-1)),_hoisted_4$1=_withScopeId$1(()=>vue.createElementVNode("span",null,"value",-1)),_hoisted_5$1={class:"row-l"},_sfc_main$t=vue.defineComponent({__name:"list",props:{modelValue:{default:()=>[{key:"",val:""}]}},emits:["update:modelValue"],setup(i,{emit:r}){const n=i,o=r,a=vue.computed({get(){return n.modelValue},set(d){o("update:modelValue",d)}}),u=()=>{a.value.push({key:"",val:""})},c=d=>{a.value.splice(d,1)};return(d,f)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$5,[vue.createElementVNode("div",_hoisted_2$3,[_hoisted_3$2,_hoisted_4$1,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:u},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"add"})]),_:1})]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(a),(h,y)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,[vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:h.key,"onUpdate:modelValue":g=>h.key=g,size:"small",placeholder:"key"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:h.val,"onUpdate:modelValue":g=>h.val=g,size:"small",placeholder:"value"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:g=>c(y)},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"delete"})]),_:2},1032,["onClick"])]))),256))]))}}),list_vue_vue_type_style_index_0_scoped_98320511_lang="",List=_export_sfc$1(_sfc_main$t,[["__scopeId","data-v-98320511"]]),composeEventHandlers=(i,r,{checkForDefaultPrevented:n=!0}={})=>a=>{const u=i==null?void 0:i(a);if(n===!1||!u)return r==null?void 0:r(a)};var _a;const isClient=typeof window<"u",isString$1=i=>typeof i=="string",noop=()=>{},isIOS=isClient&&((_a=window==null?void 0:window.navigator)==null?void 0:_a.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function resolveUnref(i){return typeof i=="function"?i():vue.unref(i)}function createFilterWrapper(i,r){function n(...o){return new Promise((a,u)=>{Promise.resolve(i(()=>r.apply(this,o),{fn:r,thisArg:this,args:o})).then(a).catch(u)})}return n}function debounceFilter(i,r={}){let n,o,a=noop;const u=d=>{clearTimeout(d),a(),a=noop};return d=>{const f=resolveUnref(i),h=resolveUnref(r.maxWait);return n&&u(n),f<=0||h!==void 0&&h<=0?(o&&(u(o),o=null),Promise.resolve(d())):new Promise((y,g)=>{a=r.rejectOnCancel?g:y,h&&!o&&(o=setTimeout(()=>{n&&u(n),o=null,y(d())},h)),n=setTimeout(()=>{o&&u(o),o=null,y(d())},f)})}}function identity(i){return i}function tryOnScopeDispose(i){return vue.getCurrentScope()?(vue.onScopeDispose(i),!0):!1}function useDebounceFn(i,r=200,n={}){return createFilterWrapper(debounceFilter(r,n),i)}function refDebounced(i,r=200,n={}){const o=vue.ref(i.value),a=useDebounceFn(()=>{o.value=i.value},r,n);return vue.watch(i,()=>a()),o}function tryOnMounted(i,r=!0){vue.getCurrentInstance()?vue.onMounted(i):r?i():vue.nextTick(i)}function unrefElement(i){var r;const n=resolveUnref(i);return(r=n==null?void 0:n.$el)!=null?r:n}const defaultWindow=isClient?window:void 0;function useEventListener(...i){let r,n,o,a;if(isString$1(i[0])||Array.isArray(i[0])?([n,o,a]=i,r=defaultWindow):[r,n,o,a]=i,!r)return noop;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const u=[],c=()=>{u.forEach(y=>y()),u.length=0},d=(y,g,p,v)=>(y.addEventListener(g,p,v),()=>y.removeEventListener(g,p,v)),f=vue.watch(()=>[unrefElement(r),resolveUnref(a)],([y,g])=>{c(),y&&u.push(...n.flatMap(p=>o.map(v=>d(y,p,v,g))))},{immediate:!0,flush:"post"}),h=()=>{f(),c()};return tryOnScopeDispose(h),h}let _iOSWorkaround=!1;function onClickOutside(i,r,n={}){const{window:o=defaultWindow,ignore:a=[],capture:u=!0,detectIframe:c=!1}=n;if(!o)return;isIOS&&!_iOSWorkaround&&(_iOSWorkaround=!0,Array.from(o.document.body.children).forEach(p=>p.addEventListener("click",noop)));let d=!0;const f=p=>a.some(v=>{if(typeof v=="string")return Array.from(o.document.querySelectorAll(v)).some(_=>_===p.target||p.composedPath().includes(_));{const _=unrefElement(v);return _&&(p.target===_||p.composedPath().includes(_))}}),y=[useEventListener(o,"click",p=>{const v=unrefElement(i);if(!(!v||v===p.target||p.composedPath().includes(v))){if(p.detail===0&&(d=!f(p)),!d){d=!0;return}r(p)}},{passive:!0,capture:u}),useEventListener(o,"pointerdown",p=>{const v=unrefElement(i);v&&(d=!p.composedPath().includes(v)&&!f(p))},{passive:!0}),c&&useEventListener(o,"blur",p=>{var v;const _=unrefElement(i);((v=o.document.activeElement)==null?void 0:v.tagName)==="IFRAME"&&!(_!=null&&_.contains(o.document.activeElement))&&r(p)})].filter(Boolean);return()=>y.forEach(p=>p())}function useSupported(i,r=!1){const n=vue.ref(),o=()=>n.value=!!i();return o(),tryOnMounted(o,r),n}const _global=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},globalKey="__vueuse_ssr_handlers__";_global[globalKey]=_global[globalKey]||{};var __getOwnPropSymbols$g=Object.getOwnPropertySymbols,__hasOwnProp$g=Object.prototype.hasOwnProperty,__propIsEnum$g=Object.prototype.propertyIsEnumerable,__objRest$2=(i,r)=>{var n={};for(var o in i)__hasOwnProp$g.call(i,o)&&r.indexOf(o)<0&&(n[o]=i[o]);if(i!=null&&__getOwnPropSymbols$g)for(var o of __getOwnPropSymbols$g(i))r.indexOf(o)<0&&__propIsEnum$g.call(i,o)&&(n[o]=i[o]);return n};function useResizeObserver(i,r,n={}){const o=n,{window:a=defaultWindow}=o,u=__objRest$2(o,["window"]);let c;const d=useSupported(()=>a&&"ResizeObserver"in a),f=()=>{c&&(c.disconnect(),c=void 0)},h=vue.watch(()=>unrefElement(i),g=>{f(),d.value&&a&&g&&(c=new ResizeObserver(r),c.observe(g,u))},{immediate:!0,flush:"post"}),y=()=>{f(),h()};return tryOnScopeDispose(y),{isSupported:d,stop:y}}var __getOwnPropSymbols$8=Object.getOwnPropertySymbols,__hasOwnProp$8=Object.prototype.hasOwnProperty,__propIsEnum$8=Object.prototype.propertyIsEnumerable,__objRest$1=(i,r)=>{var n={};for(var o in i)__hasOwnProp$8.call(i,o)&&r.indexOf(o)<0&&(n[o]=i[o]);if(i!=null&&__getOwnPropSymbols$8)for(var o of __getOwnPropSymbols$8(i))r.indexOf(o)<0&&__propIsEnum$8.call(i,o)&&(n[o]=i[o]);return n};function useMutationObserver(i,r,n={}){const o=n,{window:a=defaultWindow}=o,u=__objRest$1(o,["window"]);let c;const d=useSupported(()=>a&&"MutationObserver"in a),f=()=>{c&&(c.disconnect(),c=void 0)},h=vue.watch(()=>unrefElement(i),g=>{f(),d.value&&a&&g&&(c=new MutationObserver(r),c.observe(g,u))},{immediate:!0}),y=()=>{f(),h()};return tryOnScopeDispose(y),{isSupported:d,stop:y}}var SwipeDirection;(function(i){i.UP="UP",i.RIGHT="RIGHT",i.DOWN="DOWN",i.LEFT="LEFT",i.NONE="NONE"})(SwipeDirection||(SwipeDirection={}));var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,r,n)=>r in i?__defProp(i,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[r]=n,__spreadValues=(i,r)=>{for(var n in r||(r={}))__hasOwnProp.call(r,n)&&__defNormalProp(i,n,r[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(r))__propIsEnum.call(r,n)&&__defNormalProp(i,n,r[n]);return i};const _TransitionPresets={easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]};__spreadValues({linear:identity},_TransitionPresets);const isFirefox=()=>isClient&&/firefox/i.test(window.navigator.userAgent);/**
|
244
|
+
`||h==="")){var y=c.isSelected(h);o.hasOwnProperty(h)?o[h]=o[h]&&y:o[h]=y}})}),i==="allSelect"||i==="inverseSelect"?{selected:o}:{name:r.name,selected:o}}function installLegendAction(i){i.registerAction("legendToggleSelect","legendselectchanged",curry$1(legendSelectActionHandler,"toggleSelected")),i.registerAction("legendAllSelect","legendselectall",curry$1(legendSelectActionHandler,"allSelect")),i.registerAction("legendInverseSelect","legendinverseselect",curry$1(legendSelectActionHandler,"inverseSelect")),i.registerAction("legendSelect","legendselected",curry$1(legendSelectActionHandler,"select")),i.registerAction("legendUnSelect","legendunselected",curry$1(legendSelectActionHandler,"unSelect"))}function install$2(i){i.registerComponentModel(LegendModel$1),i.registerComponentView(LegendView$1),i.registerProcessor(i.PRIORITY.PROCESSOR.SERIES_FILTER,legendFilter),i.registerSubTypeDefaulter("legend",function(){return"plain"}),installLegendAction(i)}var ScrollableLegendModel=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n}return r.prototype.setScrollDataIndex=function(n){this.option.scrollDataIndex=n},r.prototype.init=function(n,o,a){var u=getLayoutParams(n);i.prototype.init.call(this,n,o,a),mergeAndNormalizeLayoutParams(this,n,u)},r.prototype.mergeOption=function(n,o){i.prototype.mergeOption.call(this,n,o),mergeAndNormalizeLayoutParams(this,this.option,n)},r.type="legend.scroll",r.defaultOption=inheritDefaultOption(LegendModel$1.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:"end",pageFormatter:"{current}/{total}",pageIcons:{horizontal:["M0,0L12,-10L12,10z","M0,0L-12,-10L-12,10z"],vertical:["M0,0L20,0L10,-20z","M0,0L20,0L10,20z"]},pageIconColor:"#2f4554",pageIconInactiveColor:"#aaa",pageIconSize:15,pageTextStyle:{color:"#333"},animationDurationUpdate:800}),r}(LegendModel$1);function mergeAndNormalizeLayoutParams(i,r,n){var o=i.getOrient(),a=[1,1];a[o.index]=0,mergeLayoutParam(r,n,{type:"box",ignoreSize:!!a})}const ScrollableLegendModel$1=ScrollableLegendModel;var Group=Group$3,WH=["width","height"],XY=["x","y"],ScrollableLegendView=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n.newlineDisabled=!0,n._currentIndex=0,n}return r.prototype.init=function(){i.prototype.init.call(this),this.group.add(this._containerGroup=new Group),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new Group)},r.prototype.resetInner=function(){i.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},r.prototype.renderInner=function(n,o,a,u,c,d,f){var h=this;i.prototype.renderInner.call(this,n,o,a,u,c,d,f);var y=this._controllerGroup,g=o.get("pageIconSize",!0),p=isArray$1(g)?g:[g,g];_("pagePrev",0);var v=o.getModel("pageTextStyle");y.add(new ZRText$1({name:"pageText",style:{text:"xx/xx",fill:v.getTextColor(),font:v.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),_("pageNext",1);function _(b,A){var w=b+"DataIndex",T=createIcon(o.get("pageIcons",!0)[o.getOrient().name][A],{onclick:bind$1(h._pageGo,h,w,o,u)},{x:-p[0]/2,y:-p[1]/2,width:p[0],height:p[1]});T.name=b,y.add(T)}},r.prototype.layoutInner=function(n,o,a,u,c,d){var f=this.getSelectorGroup(),h=n.getOrient().index,y=WH[h],g=XY[h],p=WH[1-h],v=XY[1-h];c&&box("horizontal",f,n.get("selectorItemGap",!0));var _=n.get("selectorButtonGap",!0),b=f.getBoundingRect(),A=[-b.x,-b.y],w=clone$2(a);c&&(w[y]=a[y]-b[y]-_);var T=this._layoutContentAndController(n,u,w,h,y,p,v,g);if(c){if(d==="end")A[h]+=T[y]+_;else{var S=b[y]+_;A[h]-=S,T[g]-=S}T[y]+=b[y]+_,A[1-h]+=T[v]+T[p]/2-b[p]/2,T[p]=Math.max(T[p],b[p]),T[v]=Math.min(T[v],b[v]+A[1-h]),f.x=A[0],f.y=A[1],f.markRedraw()}return T},r.prototype._layoutContentAndController=function(n,o,a,u,c,d,f,h){var y=this.getContentGroup(),g=this._containerGroup,p=this._controllerGroup;box(n.get("orient"),y,n.get("itemGap"),u?a.width:null,u?null:a.height),box("horizontal",p,n.get("pageButtonItemGap",!0));var v=y.getBoundingRect(),_=p.getBoundingRect(),b=this._showController=v[c]>a[c],A=[-v.x,-v.y];o||(A[u]=y[h]);var w=[0,0],T=[-_.x,-_.y],S=retrieve2(n.get("pageButtonGap",!0),n.get("itemGap",!0));if(b){var x=n.get("pageButtonPosition",!0);x==="end"?T[u]+=a[c]-_[c]:w[u]+=_[c]+S}T[1-u]+=v[d]/2-_[d]/2,y.setPosition(A),g.setPosition(w),p.setPosition(T);var L={x:0,y:0};if(L[c]=b?a[c]:v[c],L[d]=Math.max(v[d],_[d]),L[f]=Math.min(0,_[f]+T[1-u]),g.__rectSize=a[c],b){var M={x:0,y:0};M[c]=Math.max(a[c]-_[c]-S,0),M[d]=L[d],g.setClipPath(new Rect$1({shape:M})),g.__rectSize=M[c]}else p.eachChild(function(ie){ie.attr({invisible:!0,silent:!0})});var O=this._getPageInfo(n);return O.pageIndex!=null&&updateProps$1(y,{x:O.contentPosition[0],y:O.contentPosition[1]},b?n:null),this._updatePageInfoView(n,O),L},r.prototype._pageGo=function(n,o,a){var u=this._getPageInfo(o)[n];u!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:u,legendId:o.id})},r.prototype._updatePageInfoView=function(n,o){var a=this._controllerGroup;each$4(["pagePrev","pageNext"],function(y){var g=y+"DataIndex",p=o[g]!=null,v=a.childOfName(y);v&&(v.setStyle("fill",p?n.get("pageIconColor",!0):n.get("pageIconInactiveColor",!0)),v.cursor=p?"pointer":"default")});var u=a.childOfName("pageText"),c=n.get("pageFormatter"),d=o.pageIndex,f=d!=null?d+1:0,h=o.pageCount;u&&c&&u.setStyle("text",isString$2(c)?c.replace("{current}",f==null?"":f+"").replace("{total}",h==null?"":h+""):c({current:f,total:h}))},r.prototype._getPageInfo=function(n){var o=n.get("scrollDataIndex",!0),a=this.getContentGroup(),u=this._containerGroup.__rectSize,c=n.getOrient().index,d=WH[c],f=XY[c],h=this._findTargetItemIndex(o),y=a.children(),g=y[h],p=y.length,v=p?1:0,_={contentPosition:[a.x,a.y],pageCount:v,pageIndex:v-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!g)return _;var b=x(g);_.contentPosition[c]=-b.s;for(var A=h+1,w=b,T=b,S=null;A<=p;++A)S=x(y[A]),(!S&&T.e>w.s+u||S&&!L(S,w.s))&&(T.i>w.i?w=T:w=S,w&&(_.pageNextDataIndex==null&&(_.pageNextDataIndex=w.i),++_.pageCount)),T=S;for(var A=h-1,w=b,T=b,S=null;A>=-1;--A)S=x(y[A]),(!S||!L(T,S.s))&&w.i<T.i&&(T=w,_.pagePrevDataIndex==null&&(_.pagePrevDataIndex=w.i),++_.pageCount,++_.pageIndex),w=S;return _;function x(M){if(M){var O=M.getBoundingRect(),ie=O[f]+M[f];return{s:ie,e:ie+O[d],i:M.__legendDataIndex}}}function L(M,O){return M.e>=O&&M.s<=O+u}},r.prototype._findTargetItemIndex=function(n){if(!this._showController)return 0;var o,a=this.getContentGroup(),u;return a.eachChild(function(c,d){var f=c.__legendDataIndex;u==null&&f!=null&&(u=d),f===n&&(o=d)}),o??u},r.type="legend.scroll",r}(LegendView$1);const ScrollableLegendView$1=ScrollableLegendView;function installScrollableLegendAction(i){i.registerAction("legendScroll","legendscroll",function(r,n){var o=r.scrollDataIndex;o!=null&&n.eachComponent({mainType:"legend",subType:"scroll",query:r},function(a){a.setScrollDataIndex(o)})})}function install$1(i){use(install$2),i.registerComponentModel(ScrollableLegendModel$1),i.registerComponentView(ScrollableLegendView$1),installScrollableLegendAction(i)}function install(i){use(install$2),use(install$1)}const _sfc_main$I=vue.defineComponent({__name:"pie-charts",props:{title:{type:String,default:"标题"},seriesName:{type:String,default:"详情"},seriesData:{type:Array,default:()=>[]}},setup(i){use([install$7,install$6,install$3,install$4,install]),vue.provide(VChart.THEME_KEY,"dark");const r=i,n=vue.reactive({title:{text:r.title,left:"center"},tooltip:{trigger:"item",formatter:"{a} <br/>{b} : {c} ({d}%)"},legend:{orient:"vertical",left:"left"},series:[{name:r.seriesName,type:"pie",radius:"55%",center:["50%","60%"],data:r.seriesData,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]});return vue.watch(r,o=>{n.title.text=o.title,n.series[0].name=o.seriesName,n.series[0].data=o.seriesData}),(o,a)=>(vue.openBlock(),vue.createBlock(vue.unref(VChart),{class:"chart",option:vue.unref(n),autoresize:""},null,8,["option"]))}}),pieCharts_vue_vue_type_style_index_0_scoped_fec2cbf2_lang="",PieCharts=_export_sfc$1(_sfc_main$I,[["__scopeId","data-v-fec2cbf2"]]),_hoisted_1$g=["id"],_hoisted_2$e=["id"],_hoisted_3$b=["fill"],_hoisted_4$9=["fill"],_hoisted_5$8=["fill"],_hoisted_6$7=vue.createElementVNode("path",{d:"M375.466667 709.214815l-25.6 137.481481c0 2.844444 1.896296 5.688889 7.585185 10.42963l65.422222 54.992593c5.688889 4.740741 15.17037 8.533333 23.703704 10.429629l36.029629-193.422222-107.14074-19.911111z",fill:"#2D4375"},null,-1),_hoisted_7$7=vue.createElementVNode("path",{d:"M482.607407 729.125926l-36.029629 193.422222c9.481481 1.896296 18.014815 1.896296 25.6-0.948148l80.592592-27.496296c6.637037-1.896296 10.42963-4.740741 11.377778-6.637037L589.748148 749.037037l-107.140741-19.911111z",fill:"#1E2D4F"},null,-1),_hoisted_8$7=["fill-opacity"],_hoisted_9$6=["fill-opacity"],_hoisted_10$5=["fill-opacity"],_hoisted_11$4=vue.createElementVNode("path",{d:"M593.540741 807.822222c1.896296-7.585185-3.792593-15.17037-11.377778-16.118518l-107.140741-19.911111-4.740741 27.496296 107.140741 19.911111c6.637037 0.948148 14.222222-3.792593 16.118519-11.377778z",fill:"#CEEFF6"},null,-1),_hoisted_12$3=vue.createElementVNode("path",{d:"M366.933333 750.933333c-7.585185-1.896296-15.17037 3.792593-16.118518 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.14074 19.911111 4.740741-27.496297-107.140741-19.911111zM356.503704 808.77037c-7.585185-1.896296-15.17037 3.792593-16.118519 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.140741 19.911111 4.74074-27.496297-107.14074-19.911111z",fill:"#FFFFFF"},null,-1),_hoisted_13$3=vue.createElementVNode("path",{d:"M570.785185 848.592593l-107.140741-19.911112-4.74074 27.496297 107.14074 19.911111c7.585185 1.896296 15.17037-3.792593 16.118519-11.377778 1.896296-7.585185-2.844444-15.17037-11.377778-16.118518z",fill:"#CEEFF6"},null,-1),_hoisted_14$3=["xlink:href","width","height"],_sfc_main$H=vue.defineComponent({__name:"light-a",props:{id:{default:""},isOpen:{type:Boolean,default:!1},height:{default:100},width:{default:100}},emits:["onChange"],setup(i,{emit:r}){const n=i,o=r;return vue.watch(()=>n.isOpen,()=>{o("onChange")}),(a,u)=>(vue.openBlock(),vue.createElementBlock("g",{id:n.id,style:{cursor:"pointer"}},[vue.createElementVNode("symbol",{id:`${n.id}light-121`,viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{d:"M565.096296 289.185185s-0.948148 0 0 0c-110.933333-20.859259-208.592593 40.77037-237.985185 148.859259-14.222222 53.096296-24.651852 101.451852 44.562963 221.866667 14.222222 25.6 11.377778 70.162963 8.533333 95.762963-1.896296 14.222222 64.474074 36.02963 89.125926 42.666667l95.762963-509.155556z",fill:n.isOpen?"#FDB813":"#cccccc"},null,8,_hoisted_3$b),vue.createElementVNode("path",{d:"M732.918519 513.896296c11.377778-111.881481-56.888889-203.851852-166.874075-224.711111h-0.948148L469.333333 798.340741c25.6 2.844444 94.814815 6.637037 98.607408-7.585185 6.637037-25.6 20.859259-67.318519 42.666666-86.281482C719.644444 618.192593 727.22963 568.888889 732.918519 513.896296z",fill:n.isOpen?"#FD9B13":"#bbbbbb"},null,8,_hoisted_4$9),vue.createElementVNode("path",{d:"M467.437037 806.874074c-7.585185-0.948148-12.325926-7.585185-14.222222-14.222222l-38.874074-256c-0.948148-5.688889 0.948148-11.377778 4.74074-15.170371 3.792593-3.792593 9.481481-5.688889 15.170371-4.74074l167.822222 31.288889c5.688889 0.948148 10.42963 4.740741 12.325926 9.481481 1.896296 4.740741 1.896296 11.377778-0.948148 16.118519L486.4 798.340741c-3.792593 6.637037-11.377778 10.42963-18.962963 8.533333z m-14.222222-251.259259l27.496296 182.992592L572.681481 578.37037l-119.466666-22.755555z",fill:n.isOpen?"#F12A3F":"#666666"},null,8,_hoisted_5$8),_hoisted_6$7,_hoisted_7$7,vue.createElementVNode("path",{d:"M612.503704 217.125926c-3.792593 18.014815-20.859259 29.392593-38.874074 26.548148-18.014815-3.792593-30.340741-20.859259-26.548149-38.874074l18.962963-100.503704c3.792593-18.014815 20.859259-29.392593 38.874075-26.548148 18.014815 3.792593 30.340741 20.859259 26.548148 38.874074l-18.962963 100.503704z",fill:"#FDB813","fill-opacity":n.isOpen?1:0},null,8,_hoisted_8$7),vue.createElementVNode("path",{d:"M382.103704 228.503704c10.42963 15.17037 6.637037 36.02963-8.533334 46.459259-15.17037 10.42963-36.02963 6.637037-46.459259-8.533333l-57.837037-84.385186c-10.42963-15.17037-6.637037-36.02963 8.533333-46.459259 15.17037-10.42963 36.02963-6.637037 46.45926 8.533334l57.837037 84.385185zM757.57037 298.666667c-15.17037 10.42963-18.962963 31.288889-8.533333 46.459259 10.42963 15.17037 31.288889 18.962963 46.459259 8.533333l84.385185-57.837037c15.17037-10.42963 18.962963-31.288889 8.533334-46.459259-10.42963-15.17037-31.288889-18.962963-46.459259-8.533333l-84.385186 57.837037z",fill:"#FDB813","fill-opacity":n.isOpen?1:0},null,8,_hoisted_9$6),vue.createElementVNode("path",{d:"M252.207407 361.244444c18.014815 3.792593 30.340741 20.859259 26.548149 38.874075-3.792593 18.014815-20.859259 29.392593-38.874075 26.548148l-100.503703-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874074 3.792593-18.014815 20.859259-29.392593 38.874074-26.548149l100.503703 18.962963zM931.081481 488.296296c18.014815 3.792593 30.340741 20.859259 26.548149 38.874074-3.792593 18.014815-20.859259 29.392593-38.874074 26.548149l-100.503704-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874075 3.792593-18.014815 20.859259-29.392593 38.874074-26.548148l100.503703 18.962963z",fill:"#FDB813","fill-opacity":n.isOpen?1:0},null,8,_hoisted_10$5),_hoisted_11$4,_hoisted_12$3,_hoisted_13$3],8,_hoisted_2$e),vue.createElementVNode("use",{"xlink:href":`#${n.id}light-121`,width:a.width,height:a.height},null,8,_hoisted_14$3)],8,_hoisted_1$g))}}),_hoisted_1$f=["id"],_hoisted_2$d=["id"],_hoisted_3$a=["fill"],_hoisted_4$8=["fill"],_hoisted_5$7=["fill"],_hoisted_6$6=["from","to"],_hoisted_7$6=["fill"],_hoisted_8$6=["from","to"],_hoisted_9$5=["fill"],_hoisted_10$4=["fill"],_hoisted_11$3=["fill"],_hoisted_12$2=["from","to"],_hoisted_13$2=["fill"],_hoisted_14$2=["xlink:href"],_sfc_main$G=vue.defineComponent({__name:"clock-a",props:{id:{default:""},centerColor:{default:"#EBF257"},secondsColor:{default:"#E83E24"},circleColor:{default:"#F45AFC"},minutesColor:{default:"#50E68E"},hoursColor:{default:"#9A36E7"},scaleColor:{default:"#4942CF"},backgroundColor:{default:"#ffffff"},borderColor:{default:"#B3A7FF"}},setup(i){const r=i,n=new Date(Number(window.sessionStorage.getItem("editorLoadTime")||"0")),o=n.getSeconds()+1,a=n.getMinutes(),u=Math.floor((n.getHours()+(a+o/60)/60)*30);return(c,d)=>(vue.openBlock(),vue.createElementBlock("g",{id:r.id},[vue.createElementVNode("symbol",{id:`${r.id}clock-a-n`,viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{d:"M512.3 518.9m-469.2 0a469.2 469.2 0 1 0 938.4 0 469.2 469.2 0 1 0-938.4 0Z",fill:r.borderColor},null,8,_hoisted_3$a),vue.createElementVNode("path",{d:"M512.3 518.9m-392.5 0a392.5 392.5 0 1 0 785 0 392.5 392.5 0 1 0-785 0Z",fill:r.backgroundColor},null,8,_hoisted_4$8),vue.createElementVNode("path",{d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1L318.3 337.1c-6.8-6.8-6.8-17.9 0-24.8 6.8-6.8 17.9-6.8 24.8 0L524.7 494c6.8 6.8 6.8 17.9 0 24.8-3.5 3.3-7.9 5-12.4 5z",fill:r.minutesColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${45+vue.unref(a)*6} 512.3 506.3`,to:`${405+vue.unref(a)*6} 512.3 506.3`,dur:"3600s",repeatCount:"indefinite"},null,8,_hoisted_6$6)],8,_hoisted_5$7),vue.createElementVNode("path",{d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1-6.8-6.8-6.8-17.9 0-24.8l130.8-130.8c6.8-6.8 17.9-6.8 24.8 0 6.8 6.8 6.8 17.9 0 24.8L524.7 518.7c-3.5 3.4-7.9 5.1-12.4 5.1z",fill:r.hoursColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${-45+vue.unref(u)} 512.3 506.3`,to:`${315+vue.unref(u)} 512.3 506.3`,dur:"43200s",repeatCount:"indefinite"},null,8,_hoisted_8$6)],8,_hoisted_7$6),vue.createElementVNode("path",{d:"M512.3 506.3m-47.5 0a47.5 47.5 0 1 0 95 0 47.5 47.5 0 1 0-95 0Z",fill:r.circleColor},null,8,_hoisted_9$5),vue.createElementVNode("path",{d:"M512.3 218.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM512.3 880.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM812.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3zM150.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3z",fill:r.scaleColor},null,8,_hoisted_10$4),vue.createElementVNode("path",{d:"M296.9 733.5c-2.2 0-4.5-0.9-6.2-2.6-3.4-3.4-3.4-9 0-12.4L540 469.2c3.4-3.4 9-3.4 12.4 0 3.4 3.4 3.4 9 0 12.4L303.1 731c-1.7 1.7-4 2.5-6.2 2.5z",fill:r.secondsColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${135.5+o*6} 512.3 506.3`,to:`${495.5+o*6} 512.3 506.3`,dur:"60s",repeatCount:"indefinite"},null,8,_hoisted_12$2)],8,_hoisted_11$3),vue.createElementVNode("path",{d:"M512.3 506.3m-22.8 0a22.8 22.8 0 1 0 45.6 0 22.8 22.8 0 1 0-45.6 0Z",fill:r.centerColor},null,8,_hoisted_13$2)],8,_hoisted_2$d),vue.createElementVNode("use",{"xlink:href":`#${r.id}clock-a-n`,width:"100",height:"100"},null,8,_hoisted_14$2)],8,_hoisted_1$f))}}),_sfc_main$F=vue.defineComponent({__name:"text-box",props:{width:{default:250},height:{default:150},bgColor:{default:"#ffffff"},bgOpacity:{default:50},borderColor:{default:"#000000"},borderWidth:{default:1},borderRadius:{default:5},borderOpacity:{default:100}},setup(i){const r=i,n=vue.computed(()=>({width:(r.width>0?r.width:0)+"px",height:(r.height>0?r.height:0)+"px",borderRadius:(r.borderRadius>0?r.borderRadius:0)+"px"})),o=vue.computed(()=>({border:`${r.borderWidth>0?r.borderWidth:0}px solid ${r.borderColor}`,borderRadius:(r.borderRadius>0?r.borderRadius:0)+"px",opacity:(r.borderOpacity>0?r.borderOpacity<100?r.borderOpacity:100:0)/100})),a=vue.computed(()=>({backgroundColor:r.bgColor,opacity:(r.bgOpacity>0?r.bgOpacity<100?r.bgOpacity:100:0)/100,borderRadius:r.borderRadius+"px"}));return(u,c)=>(vue.openBlock(),vue.createElementBlock("div",{class:"outM",style:vue.normalizeStyle(n.value)},[vue.createElementVNode("div",{class:"wallI",style:vue.normalizeStyle(a.value)},null,4),vue.createElementVNode("div",{class:"borderB",style:vue.normalizeStyle(o.value)},null,4)],4))}}),textBox_vue_vue_type_style_index_0_scoped_4ab181ea_lang="",TextBox=_export_sfc$1(_sfc_main$F,[["__scopeId","data-v-4ab181ea"]]),vueComp={"svg-text":_sfc_main$L,"el-button":elementPlus.ElButton,"progress-a":_sfc_main$N,"el-tag":elementPlus.ElTag,"common-table":_sfc_main$K,"pie-charts":PieCharts,"switch-r":_sfc_main$M,"now-time":NowTime,"light-a":_sfc_main$H,"clock-a":_sfc_main$G,"text-box":TextBox},config=[...t$b,...t$1],useGlobalStore=pinia$1.defineStore("global-store",{state:()=>({config_center:config,intention:EGlobalStoreIntention.None,create_svg_info:null,done_json:[],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},handle_svg_info:null,scale_info:{type:EScaleInfoType.None,scale_times:{x:1,y:1},scale_item_info:{x:0,y:0},symmetric_point:{x:0,y:0}},rotate_info:{angle:0},connection_line_node_info:{init_pos:{x:0,y:0},point_index:0}}),actions:{setCreateInfo(i){this.intention=EGlobalStoreIntention.Create,this.create_svg_info=i},setDoneJson(i){isOfType(i,"id")?(this.done_json.push(i),vue.nextTick(()=>{setSvgActualInfo(i)})):this.done_json=objectDeepClone(i),vue.nextTick(()=>{useHistoryRecord(objectDeepClone(this.done_json))})},setHandleSvgInfo(i,r){let n=r;i?(!n&&n!=0&&(n=this.done_json.findIndex(o=>o.id===i.id)??-1),this.handle_svg_info={info:i,index:n}):this.handle_svg_info=i},spliceDoneJson(i){const r=useGlobalStore(),o=r.done_json.splice(i,1)[0];unbindAnchors(o.id),useHistoryRecord(r.done_json)}}}),useSvgEditLayoutStore=pinia$1.defineStore("svg-edit-layout-store",{state:()=>({left_nav:!0,right_nav:!0,center_offset:{x:0,y:0},canvasInfo:{with:0,height:0,top:0,left:0}})}),stopEvent=i=>{i.stopPropagation()},preventDefault=i=>{i.preventDefault()},myFixed=(i,r)=>Number(i.toFixed(r));function componentsRegister(i){var o,a;const r=vue.getCurrentInstance(),n=i?Object.assign(vueComp,i):vueComp;for(let u in n)!((o=r==null?void 0:r.appContext)!=null&&o.components.hasOwnProperty(u))&&vueComp.hasOwnProperty(u)&&((a=r==null?void 0:r.appContext)==null||a.app.component(u,vueComp[u]))}function setEditorLoadTime(){window.sessionStorage.setItem("editorLoadTime",new Date().getTime().toString())}const randomString=i=>{i=i||10;const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=r.length;let o="";for(let a=0;a<i;a++){let u=n;a===0&&(u=n-10),o+=r.charAt(Math.floor(Math.random()*u))}return o},isOfType=(i,r)=>i[r]!==void 0,getCoordinateOffset=(i,r)=>i/2*(r-1),angleToRadian=i=>i*Math.PI/180,calculateRotatedPointCoordinate=(i,r,n)=>({x:myFixed((i.x-r.x)*Math.cos(angleToRadian(n))-(i.y-r.y)*Math.sin(angleToRadian(n))+r.x,1),y:myFixed((i.x-r.x)*Math.sin(angleToRadian(n))+(i.y-r.y)*Math.cos(angleToRadian(n))+r.y,1)}),getCenterPoint=(i,r)=>({x:i.x+(r.x-i.x)/2,y:i.y+(r.y-i.y)/2}),positionArrToPath=i=>{let r="";for(let n=0;n<i.length;n++)n===0?r+=`M ${i[n].x} ${i[n].y}`:r+=` L ${i[n].x} ${i[n].y}`;return r},getSvgNowPosition=(i,r,n)=>n+(r-i),objectDeepClone=(i,r={})=>i?JSON.parse(JSON.stringify(i)):r,setSvgActualInfo=(i,r)=>{var a,u;const n=document.querySelector(`#${i.id}`),o=document.querySelector(`#rect${i.id}`);if(n){let c=0,d=0,f=0,h=0;if(i.type===EDoneJsonType.Vue){f=((a=i.props.width)==null?void 0:a.val)||n.offsetWidth||100,h=((u=i.props.height)==null?void 0:u.val)||n.offsetHeight||100,c=50-f/2,d=50-h/2;const y=document.querySelector(`#foreign-object${i.id}`);y&&(y.getAttribute("x")==="0"&&y.getAttribute("y")==="0"&&y.getAttribute("width")==="0"&&y.getAttribute("height")==="0"||r)&&(y.setAttribute("x",c.toString()),y.setAttribute("y",d.toString()),y.setAttribute("width",f.toString()),y.setAttribute("height",h.toString()))}else{const y=n.getBBox();c=myFixed(y.x,0),d=myFixed(y.y,0),f=myFixed(y.width,0),h=myFixed(y.height,0)}o&&(o.getAttribute("x")==="0"&&o.getAttribute("y")==="0"&&o.getAttribute("width")==="0"&&o.getAttribute("height")==="0"||r)&&(o.setAttribute("x",c.toString()),o.setAttribute("y",d.toString()),o.setAttribute("width",f.toString()),o.setAttribute("height",h.toString())),(i.actual_bound.x===0&&i.actual_bound.y===0&&i.actual_bound.width===0&&i.actual_bound.height===0||r)&&(i.actual_bound={x:c,y:d,width:f,height:h}),i.center_position={x:i.x+i.actual_bound.x+f/2,y:i.y+i.actual_bound.y+h/2},i.point_coordinate.tl={x:i.center_position.x-f*i.scale_x/2,y:i.center_position.y-h*i.scale_y/2},i.point_coordinate.tc={x:i.center_position.x,y:i.center_position.y-h*i.scale_y/2},i.point_coordinate.tr={x:i.center_position.x+f*i.scale_x/2,y:i.center_position.y-h*i.scale_y/2},i.point_coordinate.l={x:i.center_position.x-f*i.scale_x/2,y:i.center_position.y},i.point_coordinate.r={x:i.center_position.x+f*i.scale_x/2,y:i.center_position.y},i.point_coordinate.bl={x:i.center_position.x-f*i.scale_x/2,y:i.center_position.y+h*i.scale_y/2},i.point_coordinate.bc={x:i.center_position.x,y:i.center_position.y+h*i.scale_y/2},i.point_coordinate.br={x:i.center_position.x+f*i.scale_x/2,y:i.center_position.y+h*i.scale_y/2},i.rotate!==0&&setAfterRotationPointCoordinate(i),moveAnchors(i)}},resetHandlePointOld=i=>{for(const r of Object.keys(i.point_coordinate))i.point_coordinate_old&&(i.point_coordinate_old[r].x=0,i.point_coordinate_old[r].y=0)},moveHandlePoint=(i,r,n)=>{const o=useGlobalStore(pinia),a=r??o.mouse_info.new_position_x-o.mouse_info.position_x,u=n??o.mouse_info.new_position_y-o.mouse_info.position_y;for(const c of Object.keys(i.point_coordinate))r!==void 0&&n!==void 0?(i.point_coordinate[c].x+=a,i.point_coordinate[c].y+=u):i.point_coordinate_old&&(i.point_coordinate[c].x=i.point_coordinate_old[c].x+a,i.point_coordinate[c].y=i.point_coordinate_old[c].y+u)},moveAnchors=i=>{var n,o,a,u;const r=useGlobalStore(pinia);for(let c of r.done_json)if(c.type===EDoneJsonType.ConnectionLine){if(((o=(n=c.bind_anchors)==null?void 0:n.start)==null?void 0:o.target_id)===i.id){const d=getAnchorPosByAnchorType(c.bind_anchors.start.type,i);c.props.point_position.val[0]={x:d.x-c.x,y:d.y-c.y}}if(((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===i.id){const d=getAnchorPosByAnchorType(c.bind_anchors.end.type,i);c.props.point_position.val[c.props.point_position.val.length-1]={x:d.x-c.x,y:d.y-c.y}}}},unbindAnchors=i=>{var n,o,a,u;const r=useGlobalStore(pinia);for(let c of r.done_json)c.type===EDoneJsonType.ConnectionLine&&(((o=(n=c.bind_anchors)==null?void 0:n.start)==null?void 0:o.target_id)===i&&(c.bind_anchors.start=null),((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===i&&(c.bind_anchors.end=null))},getAnchorPosByAnchorType=(i,r)=>i===ELineBindAnchors.BottomCenter?r.point_coordinate.bc:i===ELineBindAnchors.Left?r.point_coordinate.l:i===ELineBindAnchors.Right?r.point_coordinate.r:r.point_coordinate.tc,setAfterRotationPointCoordinate=i=>{i.point_coordinate={tl:calculateRotatedPointCoordinate(i.point_coordinate.tl,i.center_position,i.rotate),tc:calculateRotatedPointCoordinate(i.point_coordinate.tc,i.center_position,i.rotate),tr:calculateRotatedPointCoordinate(i.point_coordinate.tr,i.center_position,i.rotate),l:calculateRotatedPointCoordinate(i.point_coordinate.l,i.center_position,i.rotate),r:calculateRotatedPointCoordinate(i.point_coordinate.r,i.center_position,i.rotate),bl:calculateRotatedPointCoordinate(i.point_coordinate.bl,i.center_position,i.rotate),bc:calculateRotatedPointCoordinate(i.point_coordinate.bc,i.center_position,i.rotate),br:calculateRotatedPointCoordinate(i.point_coordinate.br,i.center_position,i.rotate)}},prosToVBind=(i,r=[])=>{let n={};if(i.state){for(const o in i.state)if(i.state.hasOwnProperty(o)&&o===i.defaultState){for(let a in i.state[o])a!=="label"&&(n[lodashEs.kebabCase(a)]=i.state[o][a]);break}}for(const o in i.props)r.indexOf(o)<0&&(n[lodashEs.kebabCase(o)]=i.props[o].val);return n},setArrItemByID=(id,key,val,json_arr)=>new Promise(res=>{const find_item=json_arr.find(i=>i.id===id);find_item||res({status:!1,msg:"要设置的id不存在"}),eval(`find_item.${key} = val;`),res({status:!0,msg:"操作成功"})}),getCommonClass=i=>!i.common_animations||!i.common_animations.val?"":`common-ani animate__animated animate__${i.common_animations.val} animate__${i.common_animations.speed} animate__${i.common_animations.repeat} animate__${i.common_animations.delay}`,numberArray=i=>{let r=[];for(let n=0;n<i;n++)r.push(n);return r},getStringWidth=(i,r=12)=>{if(i.length>0){let n=document.createElement("span");n.style.fontSize=r+"px",n.style.fontFamily="inherit",n.innerHTML=i,n.style.opacity="0",n.style.position="fixed",n.style.top="3000px",document.body.append(n);const o=n.clientWidth;return document.body.removeChild(n),o}return 0},valFormat=i=>/false|true/.test(i)?i!=="false":/^\d+(\.\d+)?$/.test(i)?Number(i):i,createLine=(i,r,n)=>{i.preventDefault();const o=useGlobalStore(pinia),a=useConfigStore(pinia),u=useSvgEditLayoutStore(pinia),{clientX:c,clientY:d}=i;let f=objectDeepClone(a.connection_line),h=0,y=0;if(r&&n){f.bind_anchors.start={type:r,target_id:n.id};let p=getAnchorPosByAnchorType(r,n);h=p.x,y=p.y}else h=Math.round((c-u.canvasInfo.left)/a.svg.scale-u.center_offset.x),y=Math.round((d-u.canvasInfo.top)/a.svg.scale-u.center_offset.y);const g={id:randomString(),x:h,y,client:{x:h,y},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},...f};g.props.point_position.val.push({x:0,y:0}),o.setDoneJson(g),o.setHandleSvgInfo(g,o.done_json.length-1),o.intention=EGlobalStoreIntention.Connection,o.mouse_info={state:EMouseInfoState.Down,position_x:h,position_y:y,now_position_x:h,now_position_y:y,new_position_x:0,new_position_y:0}},getZoomPosition=(i,r,n,o)=>{const a=i.layerX,u=i.layerY,c=n.x,d=n.y,f=myFixed(o?r-.1:r+.1,1),h=myFixed(c+a*(f-1)/f,1),y=myFixed(d+u*(f-1)/f,1);n.x=myFixed(h/r-(a-h)*(r-1)/r,2),n.y=myFixed(y/r-(u-y)*(r-1)/r,2)};Object.seal({name:"straight-line",title:"直线",type:EDoneJsonType.StraightLine,config:{can_zoom:!1,have_anchor:!1,actual_rect:!1},display:!0,props:{fill:{title:"填充色",type:EConfigItemPropsType.Color,val:"#ff0000"},start_x:{title:"起点x坐标",type:EConfigItemPropsType.InputNumber,val:0},start_y:{title:"起点y坐标",type:EConfigItemPropsType.InputNumber,val:0},end_x:{title:"终点x坐标",type:EConfigItemPropsType.InputNumber,val:0},end_y:{title:"终点y坐标",type:EConfigItemPropsType.InputNumber,val:0}},bind_anchors:{start:null,end:null},events:[]});const connection_line_system={name:"connection_line",title:"连接线",type:EDoneJsonType.ConnectionLine,config:{can_zoom:!1,have_anchor:!1,actual_rect:!1},display:!0,props:{stroke:{title:"线条颜色",type:EConfigItemPropsType.Color,val:"#ff0000"},"stroke-width":{title:"线条宽度",type:EConfigItemPropsType.InputNumber,val:2},point_r:{title:"节点半径",type:EConfigItemPropsType.InputNumber,val:4},point_position:{title:"点坐标",type:EConfigItemPropsType.JsonEdit,val:[]}},animations:{type:{title:"动画类型",type:EConfigItemPropsType.Select,val:EConfigAnimationsType.None,options:[{label:"无",value:EConfigAnimationsType.None},{label:"电流",value:EConfigAnimationsType.Electricity},{label:"轨迹",value:EConfigAnimationsType.Track},{label:"水珠",value:EConfigAnimationsType.WaterDrop}]},dur:{title:"持续时间",type:EConfigItemPropsType.InputNumber,val:20},repeatCount:{title:"循环次数",type:EConfigItemPropsType.Input,val:"indefinite",disabled:!0},color:{title:"颜色",type:EConfigItemPropsType.Color,val:"#602a00"},reverse:{title:"反转动画",type:EConfigItemPropsType.Switch,val:!1}},bind_anchors:{start:null,end:null},events:[]},common_animate_list=[{label:"进入",children:[{label:"渐显",value:"fadeIn"},{label:"向右进入",value:"fadeInLeft"},{label:"向左进入",value:"fadeInRight"},{label:"向上进入",value:"fadeInUp"},{label:"向下进入",value:"fadeInDown"},{label:"向右长距进入",value:"fadeInLeftBig"},{label:"向左长距进入",value:"fadeInRightBig"},{label:"向上长距进入",value:"fadeInUpBig"},{label:"向下长距进入",value:"fadeInDownBig"},{label:"旋转进入",value:"rotateIn"},{label:"左顺时针旋转",value:"rotateInDownLeft"},{label:"右逆时针旋转",value:"rotateInDownRight"},{label:"左逆时针旋转",value:"rotateInUpLeft"},{label:"右逆时针旋转",value:"rotateInUpRight"},{label:"弹入",value:"bounceIn"},{label:"向右弹入",value:"bounceInLeft"},{label:"向左弹入",value:"bounceInRight"},{label:"向上弹入",value:"bounceInUp"},{label:"向下弹入",value:"bounceInDown"},{label:"光速从右进入",value:"lightSpeedInRight"},{label:"光速从左进入",value:"lightSpeedInLeft"},{label:"光速从右退出",value:"lightSpeedOutRight"},{label:"光速从左退出",value:"lightSpeedOutLeft"},{label:"Y轴旋转",value:"flip"},{label:"中心X轴旋转",value:"flipInX"},{label:"中心Y轴旋转",value:"flipInY"},{label:"左长半径旋转",value:"rollIn"},{label:"由小变大进入",value:"zoomIn"},{label:"左变大进入",value:"zoomInLeft"},{label:"右变大进入",value:"zoomInRight"},{label:"向上变大进入",value:"zoomInUp"},{label:"向下变大进入",value:"zoomInDown"},{label:"向右滑动展开",value:"slideInLeft"},{label:"向左滑动展开",value:"slideInRight"},{label:"向上滑动展开",value:"slideInUp"},{label:"向下滑动展开",value:"slideInDown"}]},{label:"强调",children:[{label:"弹跳",value:"bounce"},{label:"闪烁",value:"flash"},{label:"放大缩小",value:"pulse"},{label:"放大缩小弹簧",value:"rubberBand"},{label:"左右晃动",value:"headShake"},{label:"左右扇形摇摆",value:"swing"},{label:"放大晃动缩小",value:"tada"},{label:"扇形摇摆",value:"wobble"},{label:"左右上下晃动",value:"jello"},{label:"Y轴旋转",value:"flip"}]},{label:"退出",children:[{label:"渐隐",value:"fadeOut"},{label:"向左退出",value:"fadeOutLeft"},{label:"向右退出",value:"fadeOutRight"},{label:"向上退出",value:"fadeOutUp"},{label:"向下退出",value:"fadeOutDown"},{label:"向左长距退出",value:"fadeOutLeftBig"},{label:"向右长距退出",value:"fadeOutRightBig"},{label:"向上长距退出",value:"fadeOutUpBig"},{label:"向下长距退出",value:"fadeOutDownBig"},{label:"旋转退出",value:"rotateOut"},{label:"左顺时针旋转",value:"rotateOutDownLeft"},{label:"右逆时针旋转",value:"rotateOutDownRight"},{label:"左逆时针旋转",value:"rotateOutUpLeft"},{label:"右逆时针旋转",value:"rotateOutUpRight"},{label:"弹出",value:"bounceOut"},{label:"向左弹出",value:"bounceOutLeft"},{label:"向右弹出",value:"bounceOutRight"},{label:"向上弹出",value:"bounceOutUp"},{label:"向下弹出",value:"bounceOutDown"},{label:"中心X轴旋转",value:"flipOutX"},{label:"中心Y轴旋转",value:"flipOutY"},{label:"左长半径旋转",value:"rollOut"},{label:"由小变大退出",value:"zoomOut"},{label:"左变大退出",value:"zoomOutLeft"},{label:"右变大退出",value:"zoomOutRight"},{label:"向上变大退出",value:"zoomOutUp"},{label:"向下变大退出",value:"zoomOutDown"},{label:"向左滑动收起",value:"slideOutLeft"},{label:"向右滑动收起",value:"slideOutRight"},{label:"向上滑动收起",value:"slideOutUp"},{label:"向下滑动收起",value:"slideOutDown"}]}];let l=localStorage.getItem("svg-editor-config"),s,t;if(l){let i=JSON.parse(l);t=i.connection_line,s=i.svg}else t=objectDeepClone(connection_line_system),s={background_color:"#fff",scale:1,grid:!0,grid_color:"#ebebeb",ruler:!0};const useConfigStore=pinia$1.defineStore("config-store",{state:()=>({svg:s,connection_line:t,net:{mqtt:{url:"",user:"",pwd:"",topics:""}}}),getters:{},actions:{}});var EContextMenuInfoType=(i=>(i.Copy="Copy",i.Delete="Delete",i.MoveUpOneLevel="MoveUpOneLevel",i.MoveDownOneLevel="MoveDownOneLevel",i.MoveUpTopLevel="MoveUpTopLevel",i.MoveDownTopLevel="MoveDownTopLevel",i))(EContextMenuInfoType||{});const useEditPrivateStore=pinia$1.defineStore("edit-private-store",{state:()=>({old_done_components:[],history_doneComponent:[],history_now_index:0,is_record_history:!0,max_record_times:10}),getters:{getTopBtnUndoStatus(i){return i.history_now_index>=1},getTopBtnRedoStatus(i){return i.history_now_index+1!=i.history_doneComponent.length}},actions:{topUndoBtnClick(){if(console.log("撤销"),this.history_now_index<1)return;const i=useGlobalStore();this.is_record_history=!1,this.history_now_index-=1,i.setDoneJson(this.history_doneComponent[this.history_now_index])},topRedoBtnClick(){if(console.log("重做"),this.history_now_index+1==this.history_doneComponent.length)return;const i=useGlobalStore();this.is_record_history=!1,this.history_now_index+=1,i.setDoneJson(this.history_doneComponent[this.history_now_index])}}}),useContextMenuStore=pinia$1.defineStore("context-menu-store",{state:()=>({display:!1,info:{[EContextMenuInfoType.Copy]:{title:"复制",hot_key:"Ctrl + c",enable:!0},[EContextMenuInfoType.Delete]:{title:"删除",hot_key:"Delete",enable:!0},[EContextMenuInfoType.MoveUpTopLevel]:{title:"置于顶层",hot_key:"Ctrl + →",enable:!0},[EContextMenuInfoType.MoveDownTopLevel]:{title:"置于底层",hot_key:"Ctrl + ←",enable:!0},[EContextMenuInfoType.MoveUpOneLevel]:{title:"置于上一层",hot_key:"Ctrl + ↑",enable:!0},[EContextMenuInfoType.MoveDownOneLevel]:{title:"置于下一层",hot_key:"Ctrl + ↓",enable:!0}}}),actions:{onContextMenuClick(i){const r=useGlobalStore();if(r.handle_svg_info)switch(r.intention=EGlobalStoreIntention.Select,i){case EContextMenuInfoType.Copy:const n=objectDeepClone(r.handle_svg_info.info);n.id=randomString(),n.title+="-copy",n.x+=10,n.y+=10,r.setDoneJson(n),this.display=!1,r.setHandleSvgInfo(n,r.done_json.length);break;case EContextMenuInfoType.Delete:r.spliceDoneJson(r.handle_svg_info.index),this.display=!1,r.setHandleSvgInfo(null),r.intention=EGlobalStoreIntention.None;break;case EContextMenuInfoType.MoveUpOneLevel:if(r.done_json.length===1||r.handle_svg_info.index===r.done_json.length-1)return;const o=r.handle_svg_info.info;r.done_json[r.handle_svg_info.index]=r.done_json[r.handle_svg_info.index+1],r.done_json[r.handle_svg_info.index+1]=o,useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(o,r.handle_svg_info.index+1);break;case EContextMenuInfoType.MoveDownOneLevel:if(r.done_json.length===1||r.handle_svg_info.index===0)return;const a=r.handle_svg_info.info;r.done_json[r.handle_svg_info.index]=r.done_json[r.handle_svg_info.index-1],r.done_json[r.handle_svg_info.index-1]=a,useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(a,r.handle_svg_info.index-1);break;case EContextMenuInfoType.MoveDownTopLevel:if(r.done_json.length===1||r.handle_svg_info.index===0)return;const u=r.handle_svg_info.info;r.done_json.splice(r.handle_svg_info.index,1),r.done_json.unshift(u),useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(u,0);break;case EContextMenuInfoType.MoveUpTopLevel:if(r.done_json.length===1||r.handle_svg_info.index===r.done_json.length)return;const c=r.handle_svg_info.info;r.done_json.splice(r.handle_svg_info.index,1),r.done_json.push(c),useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(c,r.done_json.length-1);break}}}}),pinia=pinia$1.createPinia(),useHistoryRecord=i=>{const r=useEditPrivateStore();r.is_record_history&&(r.history_now_index+1<r.history_doneComponent.length&&r.history_doneComponent.splice(r.history_now_index+1),r.history_doneComponent.push(i),r.history_now_index=r.history_doneComponent.length-1,r.history_doneComponent.length>r.max_record_times&&(r.history_doneComponent.shift(),r.history_now_index=r.history_doneComponent.length-1)),r.is_record_history=!0},useImportDataModel=i=>{try{const r=JSON.parse(i);if(!r.config||!r.layout_center||!r.done_json)return elementPlus.ElMessage.error("请导入正确的数据模型!"),!1;const n=useGlobalStore(pinia),o=useSvgEditLayoutStore(pinia),a=useConfigStore(pinia);return a.$state=r.config,o.center_offset=r.layout_center,n.setDoneJson(r.done_json),!0}catch(r){return elementPlus.ElMessage.error("请导入正确的数据模型!"),console.error(r),!1}},_hoisted_1$e={"aria-hidden":"true"},_hoisted_2$c=["xlink:href"],_sfc_main$E=vue.defineComponent({__name:"svg-analysis",props:{name:{},props:{default:()=>({})}},setup(i){const r=i,n=vue.computed(()=>`#svg-${r.name}`);return(o,a)=>(vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$e,[vue.createElementVNode("use",vue.mergeProps({"xlink:href":vue.unref(n)},r.props),null,16,_hoisted_2$c)]))}});var EVisibleConfKey=(i=>(i.ImportJson="ImportJson",i.ExportJson="ExportJson",i.ImportFile="ImportFile",i))(EVisibleConfKey||{});const _withScopeId$2=i=>(vue.pushScopeId("data-v-c6f23032"),i=i(),vue.popScopeId(),i),_hoisted_1$d={class:"flex justify-between",style:{width:"100%"}},_hoisted_2$b={class:"flex items-center justify-between",style:{width:"250px"}},_hoisted_3$9=_withScopeId$2(()=>vue.createElementVNode("div",{class:"flex items-center"},[vue.createElementVNode("span",{class:"logo-title"},"Svg Editor")],-1)),_hoisted_4$7={class:"flex justify-between",style:{width:"calc(100% - 440px)"}},_hoisted_5$6={class:"flex items-center"},_hoisted_6$5={class:"flex items-center mr-20px"},_hoisted_7$5={class:"flex items-center",style:{width:"250px"}},_hoisted_8$5=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title",style:{"padding-top":"16px"}},"多选",-1)),_hoisted_9$4=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区域按住鼠标左键可以框选(图形坐标在框选区域即判定被选中),也可以按住ctrl+鼠标左键点图形进行多选",-1)),_hoisted_10$3=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_11$2=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"拖动画布",-1)),_hoisted_12$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区域按住右键可拖动画布,右侧面板‘图纸’栏可微调或重置位置",-1)),_hoisted_13$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_14$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"画布缩放",-1)),_hoisted_15$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布中使用鼠标滚轮或者右侧面板‘图纸’栏可控制画布缩放,鼠标滚轮以鼠标位置为缩放中心,图纸栏以图纸原点(默认在左上角)为缩放中心",-1)),_hoisted_16$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_17$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"标尺辅助线",-1)),_hoisted_18$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"在标尺区域按住鼠标左键并拖动即可创建标尺辅助线,将标尺辅助线拖动到标尺区域即可删除标尺辅助线",-1)),_hoisted_19=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_20=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"组件尺寸",-1)),_hoisted_21=_withScopeId$2(()=>vue.createElementVNode("div",null,[vue.createElementVNode("p",null," 大多数组件可以通过选中组件然后拖动交互点或在右侧‘外观’栏改变外形尺寸,或通过右侧‘数据’栏直接或间接改变外形尺寸;"),vue.createElementVNode("p",null,"少数特殊组件仅可通过右侧'数据'栏直接或间接改变外形尺寸")],-1)),_hoisted_22=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_23=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"连线样式",-1)),_hoisted_24=_withScopeId$2(()=>vue.createElementVNode("div",null,"在右侧‘连线’栏可以统一配置连线样式,配置后先增加的线会应用新样式,之前的线样式不变,如需改变,可选中线手动更改或删除重画 ",-1)),_hoisted_25=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_26=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"横线和竖线",-1)),_hoisted_27=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null," 点击编辑器顶部连线按钮会进入连线状态,该状态下在画板点击鼠标左键即可开始画线,移动并再次点击左键创建新的节点,右键结束画线并退出连线状态;"),vue.createElementVNode("p",null,"画线的时候按住ctrl即可画竖线,按住shift即可画横线")],-1)),_hoisted_28=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_29=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"绑定锚点",-1)),_hoisted_30=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null,"组件在未选中时,鼠标经过组件时会出现锚点,鼠标悬浮在锚点上时,会有交互样式,点击左键即可以锚点为起点创建连线;"),vue.createElementVNode("p",null,"同样,在连线时鼠标经过锚点时,会出现锚点交互样式,点击左键即可以锚点为连线终点结束连线;"),vue.createElementVNode("p",null,"这两种情况下的连线会绑定组件上的锚点,如需解绑,参考下面的‘锚点解绑’;"),vue.createElementVNode("p",null,"同样,也可先画线,再选中连线绑定想要绑定的组件锚点(连线只有首尾节点可以绑定锚点)")],-1)),_hoisted_31=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_32=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"线段选中",-1)),_hoisted_33=_withScopeId$2(()=>vue.createElementVNode("div",null," 若线段绑定了锚点,移动线段,绑定的锚点不会移动。若是想将线段整体移动,需要先解绑,参考下面的‘锚点解绑’ ",-1)),_hoisted_34=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_35=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"锚点解绑",-1)),_hoisted_36=_withScopeId$2(()=>vue.createElementVNode("div",{style:{"padding-bottom":"14px"}}," 选中线段,在右侧‘数据’栏里解除绑定;或者鼠标左键拖拽连线上需要解绑的节点",-1)),_sfc_main$D=vue.defineComponent({__name:"top-panel",emits:["changeVisible","onReturn","onPreview","onSave"],setup(i,{emit:r}){const n=useSvgEditLayoutStore(pinia),o=useGlobalStore(pinia),a=useEditPrivateStore(pinia),u=useConfigStore(pinia),c=r,d=()=>{o.done_json.length<=0||o.setDoneJson([]),o.intention=EGlobalStoreIntention.None},f=g=>{const p={layout_center:n.center_offset,config:u.$state,done_json:o.done_json};c(g,p)},h=vue.ref(!1),y=vue.computed({get:()=>o.intention===EGlobalStoreIntention.Connection,set(g){o.intention=g?EGlobalStoreIntention.Connection:EGlobalStoreIntention.None,g&&o.setHandleSvgInfo(null)}});return(g,p)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$d,[vue.createElementVNode("div",_hoisted_2$b,[_hoisted_3$9,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:p[0]||(p[0]=v=>vue.unref(n).left_nav=!vue.unref(n).left_nav),title:vue.unref(n).left_nav?"隐藏左侧菜单":"显示左侧菜单"},{default:vue.withCtx(()=>[vue.unref(n).left_nav?(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:0,name:"menu-unfold"})):(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:1,name:"menu-fold"}))]),_:1},8,["title"])]),vue.createElementVNode("div",_hoisted_4$7,[vue.createElementVNode("div",_hoisted_5$6,[vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"撤销 ctrl+z",size:24,class:vue.normalizeClass(`${vue.unref(a).getTopBtnUndoStatus?"bt-Icon":"icon-disable"} ml-20px`),onClick:p[1]||(p[1]=()=>vue.unref(a).topUndoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(a).getTopBtnUndoStatus?"undo":"undo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"重做 ctrl+shift+z",class:vue.normalizeClass(`${vue.unref(a).getTopBtnRedoStatus?"bt-Icon":"icon-disable"} ml-5px`),size:24,onClick:p[2]||(p[2]=()=>vue.unref(a).topRedoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(a).getTopBtnRedoStatus?"redo":"redo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"清空 ctrl+delete",class:vue.normalizeClass(vue.unref(o).done_json.length>0?"bt-Icon":"icon-disable"),size:24,onClick:d},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(o).done_json.length>0?"delete":"delete-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"导入数据模型",class:"bt-Icon",size:24,onClick:p[3]||(p[3]=v=>c("changeVisible",vue.unref(EVisibleConfKey).ImportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"import"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"导出数据模型",size:24,class:"bt-Icon ml-5px",onClick:p[4]||(p[4]=v=>c("changeVisible",vue.unref(EVisibleConfKey).ExportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"export"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"创建连线",class:vue.normalizeClass(["bt-Icon",{active:vue.unref(y)}]),size:24,onClick:p[5]||(p[5]=v=>y.value=!vue.unref(y))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(y)?"line-active":"line"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"说明",class:"bt-Icon",size:24,onClick:p[6]||(p[6]=v=>h.value=!vue.unref(h))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"question"})]),_:1})]),vue.createElementVNode("div",_hoisted_6$5,[vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"返回",class:"bt-Icon",size:24,onClick:p[7]||(p[7]=v=>f("onReturn"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"return"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"保存",class:"bt-Icon",size:24,onClick:p[8]||(p[8]=v=>f("onSave"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"save"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"预览",class:"bt-Icon",size:22,onClick:p[9]||(p[9]=v=>f("onPreview"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"preview"})]),_:1})])]),vue.createElementVNode("div",_hoisted_7$5,[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:p[10]||(p[10]=v=>vue.unref(n).right_nav=!vue.unref(n).right_nav),title:vue.unref(n).right_nav?"隐藏右侧菜单":"显示右侧菜单"},{default:vue.withCtx(()=>[vue.unref(n).right_nav?(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:0,name:"menu-fold"})):(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:1,name:"menu-unfold"}))]),_:1},8,["title"])])]),vue.createVNode(vue.unref(elementPlus.ElDialog),{modelValue:vue.unref(h),"onUpdate:modelValue":p[11]||(p[11]=v=>vue.isRef(h)?h.value=v:null),title:"使用说明",width:"60%"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{"max-height":"60vh"},{default:vue.withCtx(()=>[_hoisted_8$5,_hoisted_9$4,_hoisted_10$3,_hoisted_11$2,_hoisted_12$1,_hoisted_13$1,_hoisted_14$1,_hoisted_15$1,_hoisted_16$1,_hoisted_17$1,_hoisted_18$1,_hoisted_19,_hoisted_20,_hoisted_21,_hoisted_22,_hoisted_23,_hoisted_24,_hoisted_25,_hoisted_26,_hoisted_27,_hoisted_28,_hoisted_29,_hoisted_30,_hoisted_31,_hoisted_32,_hoisted_33,_hoisted_34,_hoisted_35,_hoisted_36]),_:1})]),_:1},8,["modelValue"])],64))}}),topPanel_vue_vue_type_style_index_0_scoped_c6f23032_lang="",TopPanel=_export_sfc$1(_sfc_main$D,[["__scopeId","data-v-c6f23032"]]),_hoisted_1$c={class:"component-group flex flex-wrap"},_hoisted_2$a=["onDragstart","title"],_sfc_main$C=vue.defineComponent({__name:"left-panel",props:{customToolbar:{}},setup(i){const r=useGlobalStore(pinia),n=i,o=vue.ref(n.customToolbar&&Object.keys(n.customToolbar).length>0?n.customToolbar:r.config_center),a=vue.ref(["stateful","stateless","have_animation","custom_svg_group","element-ui","custom-vue","echarts"]),u=f=>{r.setCreateInfo(c(f))},c=f=>(f!=null&&f.props&&!lodashEs.isEmpty(f.props)&&Object.keys(f.props).forEach((h,y)=>{f.props[h].sort=String(y)}),f),d=f=>{var h;if(((h=f.dataTransfer)==null?void 0:h.dropEffect)!=="copy"){elementPlus.ElMessage.warning("请将组件拖到画布中!"),r.intention=EGlobalStoreIntention.None;return}};return(f,h)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElCollapse),{modelValue:vue.unref(a),"onUpdate:modelValue":h[0]||(h[0]=y=>vue.isRef(a)?a.value=y:null),style:{"border-top":"none"}},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(o),y=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElCollapseItem),{name:y.groupType,key:y.title},{title:vue.withCtx(()=>[vue.createElementVNode("div",null,vue.toDisplayString(y.title),1)]),default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$c,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(y.list,g=>(vue.openBlock(),vue.createElementBlock("div",{class:"ideal",key:g.name,draggable:"true",onDragstart:p=>u(g),onDragend:d,title:g.title},[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:35,class:"flex items-center"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:g.name,props:vue.unref(prosToVBind)(g,["width","height","maxHeight"])},null,8,["name","props"])]),_:2},1024)],40,_hoisted_2$a))),128))])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]))}}),leftPanel_vue_vue_type_style_index_0_scoped_8aba8565_lang="",LeftPanel=_export_sfc$1(_sfc_main$C,[["__scopeId","data-v-8aba8565"]]),calculateLeftTop=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate(r,o,-n);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightTop=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate(r,o,-n);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightBottom=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(r,o,-n),u=calculateRotatedPointCoordinate(i,o,-n);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateLeftBottom=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(r,o,-n),u=calculateRotatedPointCoordinate(i,o,-n);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateTop=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateRight=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},calculateBottom=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateLeft=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},_hoisted_1$b={style:{"vector-effect":"non-scaling-stroke"}},_hoisted_2$9=["fill","x","y"],_hoisted_3$8=["cx","cy"],_hoisted_4$6=["x1","y1","x2","y2"],_hoisted_5$5=["fill","x","y"],_hoisted_6$4=["fill","x","y"],_hoisted_7$4=["fill","x","y"],_hoisted_8$4=["fill","x","y"],_hoisted_9$3=["fill","x","y"],_hoisted_10$2=["fill","x","y"],_hoisted_11$1=["fill","x","y"],_sfc_main$B=vue.defineComponent({__name:"handle-panel",props:{itemInfo:{}},setup(i){vue.useCssVars(p=>({"5c831aea":vue.unref(c)}));const r=i,n=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=vue.ref(4),c=vue.ref("#ab712e"),d=[{start:338,end:23,cursor:"nw",type:EScaleInfoType.TopLeft},{start:23,end:68,cursor:"n",type:EScaleInfoType.TopCenter},{start:68,end:113,cursor:"ne",type:EScaleInfoType.TopRight},{start:293,end:338,cursor:"w",type:EScaleInfoType.Left},{start:113,end:158,cursor:"e",type:EScaleInfoType.Right},{start:248,end:293,cursor:"sw",type:EScaleInfoType.BottomLeft},{start:203,end:248,cursor:"s",type:EScaleInfoType.BottomCenter},{start:158,end:203,cursor:"se",type:EScaleInfoType.BottomRight}],f=vue.computed(()=>r.itemInfo.config.can_zoom),h=(p,v)=>{console.log("handMousedown",v);const{clientX:_,clientY:b}=v;v.stopPropagation(),n.intention=EGlobalStoreIntention.Zoom;const A=Math.round((_-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),w=Math.round((b-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);n.mouse_info={state:EMouseInfoState.Down,position_x:A,position_y:w,now_position_x:A,now_position_y:w,new_position_x:0,new_position_y:0},n.scale_info={type:p,scale_times:{x:r.itemInfo.scale_x,y:r.itemInfo.scale_y},scale_item_info:{x:r.itemInfo.x,y:r.itemInfo.y},symmetric_point:{x:A+Math.abs(A-r.itemInfo.center_position.x)*2*(A>r.itemInfo.center_position.x?-1:1),y:w+Math.abs(w-r.itemInfo.center_position.y)*2*(w>r.itemInfo.center_position.y?-1:1)}}},y=p=>{const{clientX:v,clientY:_}=p,b=Math.round((v-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),A=Math.round((_-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);p.stopPropagation(),n.intention=EGlobalStoreIntention.Rotate,n.rotate_info={angle:r.itemInfo.rotate},n.mouse_info={state:EMouseInfoState.Down,position_x:b,position_y:A,now_position_x:b,now_position_y:A,new_position_x:0,new_position_y:0}},g=p=>{const v=(p+r.itemInfo.rotate)%360,_=d.find(b=>b.start<=v&&b.end>v);return _?{cursor:_.cursor+"-resize",type:_.type}:{cursor:"nw-resize",type:EScaleInfoType.TopLeft}};return(p,v)=>(vue.openBlock(),vue.createElementBlock("g",_hoisted_1$b,[vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tl",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(0).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[0]||(v[0]=_=>h(vue.unref(EScaleInfoType).TopLeft,_))},null,44,_hoisted_2$9),[[vue.vShow,vue.unref(f)]]),vue.createElementVNode("circle",{cx:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2,cy:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)-24,r:4,class:"rotate-circle",onMousedown:y},null,40,_hoisted_3$8),vue.createElementVNode("line",{x1:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2,y1:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),x2:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2,y2:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)-20,style:vue.normalizeStyle({stroke:vue.unref(c),"stroke-width":2})},null,12,_hoisted_4$6),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tc",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(45).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2-vue.unref(u),y:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[1]||(v[1]=_=>h(vue.unref(EScaleInfoType).TopCenter,_))},null,44,_hoisted_5$5),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tr",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(90).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width-vue.unref(u)+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[2]||(v[2]=_=>h(vue.unref(EScaleInfoType).TopRight,_))},null,44,_hoisted_6$4),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_l",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(315).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[3]||(v[3]=_=>h(vue.unref(EScaleInfoType).Left,_))},null,44,_hoisted_7$4),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_r",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(135).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)+r.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[4]||(v[4]=_=>h(vue.unref(EScaleInfoType).Right,_))},null,44,_hoisted_8$4),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_bl",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(270).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height*r.itemInfo.scale_y-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[5]||(v[5]=_=>h(vue.unref(EScaleInfoType).BottomLeft,_))},null,44,_hoisted_9$3),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_bc",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(225).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)+r.itemInfo.actual_bound.width/2,y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[6]||(v[6]=_=>h(vue.unref(EScaleInfoType).BottomCenter,_))},null,44,_hoisted_10$2),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_br",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(180).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)+r.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[7]||(v[7]=_=>h(vue.unref(EScaleInfoType).BottomRight,_))},null,44,_hoisted_11$1),[[vue.vShow,vue.unref(f)]])]))}}),handlePanel_vue_vue_type_style_index_0_scoped_e6622df8_lang="",HandlePanel=_export_sfc$1(_sfc_main$B,[["__scopeId","data-v-e6622df8"]]),_hoisted_1$a=["fill"],_hoisted_2$8=["cx","cy","r"],_hoisted_3$7=["cx","cy","r"],_hoisted_4$5=["cx","cy","r"],_hoisted_5$4=["cx","cy","r"],_hoisted_6$3=["cx","cy","r"],_hoisted_7$3=["cx","cy","r"],_hoisted_8$3=["cx","cy","r"],_hoisted_9$2=["cx","cy","r"],_sfc_main$A=vue.defineComponent({__name:"connection-panel",props:{itemInfo:{}},setup(i){const r=i,n=vue.ref(4),o=vue.ref("#ab712e"),a=vue.ref(4),u=vue.ref(12),c=useGlobalStore(pinia),d=useSvgEditLayoutStore(pinia),f=vue.computed(()=>r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2-n.value+a.value),h=vue.computed(()=>r.itemInfo.actual_bound.y-n.value-getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),y=vue.computed(()=>r.itemInfo.actual_bound.x-n.value+r.itemInfo.actual_bound.width+getCoordinateOffset(r.itemInfo.actual_bound.width,r.itemInfo.scale_x)+a.value),g=vue.computed(()=>r.itemInfo.actual_bound.y-n.value+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),p=vue.computed(()=>r.itemInfo.actual_bound.x-n.value+r.itemInfo.actual_bound.width/2+a.value),v=vue.computed(()=>r.itemInfo.actual_bound.y-n.value+r.itemInfo.actual_bound.height+getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),_=vue.computed(()=>r.itemInfo.actual_bound.x-n.value-getCoordinateOffset(r.itemInfo.actual_bound.width,r.itemInfo.scale_x)+a.value),b=vue.computed(()=>r.itemInfo.actual_bound.y-n.value+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),A=(T,S)=>{var x;c.intention===EGlobalStoreIntention.SetConnectionLineNode&&(T.stopPropagation(),(x=c.handle_svg_info)!=null&&x.info.bind_anchors&&c.connection_line_node_info&&(c.connection_line_node_info.point_index===0?c.handle_svg_info.info.bind_anchors.start={type:S,target_id:r.itemInfo.id}:c.connection_line_node_info.point_index===c.handle_svg_info.info.props.point_position.val.length-1&&(c.handle_svg_info.info.bind_anchors.end={type:S,target_id:r.itemInfo.id}),c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(r.itemInfo)})))},w=(T,S)=>{var x;c.intention===EGlobalStoreIntention.None?(createLine(T,S,r.itemInfo),c.handle_svg_info&&(c.handle_svg_info.info.props.point_position.val.length!==1?c.handle_svg_info.info.props.point_position.val.push({x:c.mouse_info.new_position_x-c.mouse_info.position_x-d.center_offset.x,y:c.mouse_info.new_position_y-c.mouse_info.position_y-d.center_offset.y}):c.handle_svg_info.info.props.point_position.val.push({x:0,y:0}))):c.intention===EGlobalStoreIntention.Connection&&(T.stopPropagation(),(x=c.handle_svg_info)!=null&&x.info.bind_anchors&&(c.handle_svg_info.info.bind_anchors.end={type:S,target_id:r.itemInfo.id},c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(r.itemInfo)})))};return(T,S)=>(vue.openBlock(),vue.createElementBlock("g",{style:{"vector-effect":"non-scaling-stroke"},class:"connect-points",fill:vue.unref(o),"stroke-width":"2",stroke:"rgba(0,0,0,0)"},[vue.createElementVNode("g",{onMousedown:S[0]||(S[0]=x=>w(x,vue.unref(ELineBindAnchors).TopCenter)),onMouseup:S[1]||(S[1]=x=>A(x,vue.unref(ELineBindAnchors).TopCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(f),cy:vue.unref(h),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_2$8),vue.createElementVNode("circle",{id:"connection_tc",cx:vue.unref(f),cy:vue.unref(h),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_3$7)],32),vue.createElementVNode("g",{onMousedown:S[2]||(S[2]=x=>w(x,vue.unref(ELineBindAnchors).Right)),onMouseup:S[3]||(S[3]=x=>A(x,vue.unref(ELineBindAnchors).Right))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(y),cy:vue.unref(g),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_4$5),vue.createElementVNode("circle",{id:"connection_r",cx:vue.unref(y),cy:vue.unref(g),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_5$4)],32),vue.createElementVNode("g",{onMousedown:S[4]||(S[4]=x=>w(x,vue.unref(ELineBindAnchors).BottomCenter)),onMouseup:S[5]||(S[5]=x=>A(x,vue.unref(ELineBindAnchors).BottomCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(p),cy:vue.unref(v),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_6$3),vue.createElementVNode("circle",{id:"connection_bc",cx:vue.unref(p),cy:vue.unref(v),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_7$3)],32),vue.createElementVNode("g",{onMousedown:S[6]||(S[6]=x=>w(x,vue.unref(ELineBindAnchors).Left)),onMouseup:S[7]||(S[7]=x=>A(x,vue.unref(ELineBindAnchors).Left))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(_),cy:vue.unref(b),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_8$3),vue.createElementVNode("circle",{id:"connection_l",cx:vue.unref(_),cy:vue.unref(b),r:vue.unref(a),style:{cursor:"crosshair"},"pointer-events":"all"},null,8,_hoisted_9$2)],32)],8,_hoisted_1$a))}}),connectionPanel_vue_vue_type_style_index_0_scoped_fb729c7a_lang="",ConnectionPanel=_export_sfc$1(_sfc_main$A,[["__scopeId","data-v-fb729c7a"]]),_hoisted_1$9=["d","stroke-width"],_hoisted_2$7=["d","stroke-width"],_hoisted_3$6=["id","d","stroke","stroke-width","stroke-dasharray"],_hoisted_4$4=["from","to","dur","repeatCount"],_hoisted_5$3=["d","stroke","stroke-width","stroke-dasharray"],_hoisted_6$2=["from","to","dur","repeatCount"],_hoisted_7$2=["r","fill"],_hoisted_8$2=["path","dur","repeatCount"],_hoisted_9$1=["cx","cy","r","stroke-width"],_hoisted_10$1=["cx","cy","r","stroke","onMousedown"],_sfc_main$z=vue.defineComponent({__name:"connection-line",props:{itemInfo:{},pointVisible:{type:Boolean,default:!1}},setup(i){const r=i,n=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=(c,d,f,h)=>{if(n.intention===EGlobalStoreIntention.Connection)return;n.setHandleSvgInfo(r.itemInfo);const{clientX:y,clientY:g}=d;d.stopPropagation(),n.connection_line_node_info={init_pos:{x:f,y:h},point_index:c},n.intention=EGlobalStoreIntention.SetConnectionLineNode,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((y-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((g-a.canvasInfo.top)/o.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0}};return(c,d)=>{var f,h,y,g,p,v;return vue.openBlock(),vue.createElementBlock("g",{style:vue.normalizeStyle({cursor:vue.unref(n).intention===vue.unref(EGlobalStoreIntention).Connection?"crosshair":"move"})},[vue.withDirectives(vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#DE4517","stroke-width":Math.ceil(r.itemInfo.props["stroke-width"].val*1.2)+1,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_1$9),[[vue.vShow,r.itemInfo.selected||r.itemInfo.id===((f=vue.unref(n).handle_svg_info)==null?void 0:f.info.id)]]),vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#fff","stroke-opacity":".01","stroke-width":r.itemInfo.props["stroke-width"].val,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_2$7),vue.createElementVNode("path",{id:r.itemInfo.id,d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none",stroke:((h=r.itemInfo.animations)==null?void 0:h.type.val)===vue.unref(EConfigAnimationsType).Electricity?r.itemInfo.animations.color.val:r.itemInfo.props.stroke.val,"stroke-width":r.itemInfo.props["stroke-width"].val,"stroke-dashoffset":"0","stroke-dasharray":((y=r.itemInfo.animations)==null?void 0:y.type.val)===vue.unref(EConfigAnimationsType).Electricity?r.itemInfo.props["stroke-width"].val*3:0,"stroke-linejoin":"round"},[((g=r.itemInfo.animations)==null?void 0:g.type.val)===vue.unref(EConfigAnimationsType).Electricity?(vue.openBlock(),vue.createElementBlock("animate",{key:0,attributeName:"stroke-dashoffset",from:r.itemInfo.animations.reverse.val?0:1e3,to:r.itemInfo.animations.reverse.val?1e3:0,dur:`${r.itemInfo.animations.dur.val}s`,repeatCount:r.itemInfo.animations.repeatCount.val},null,8,_hoisted_4$4)):vue.createCommentVNode("",!0)],8,_hoisted_3$6),((p=r.itemInfo.animations)==null?void 0:p.type.val)===vue.unref(EConfigAnimationsType).WaterDrop?(vue.openBlock(),vue.createElementBlock("path",{key:0,d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:r.itemInfo.animations.color.val,"stroke-width":r.itemInfo.props["stroke-width"].val,"stroke-dasharray":r.itemInfo.props["stroke-width"].val*3,"stroke-dashoffset":"0","stroke-linecap":"round","stroke-linejoin":"round"},[vue.createElementVNode("animate",{attributeName:"stroke-dashoffset",from:r.itemInfo.animations.reverse.val?0:1e3,to:r.itemInfo.animations.reverse.val?1e3:0,dur:`${r.itemInfo.animations.dur.val}s`,repeatCount:r.itemInfo.animations.repeatCount.val,fill:"freeze"},null,8,_hoisted_6$2)],8,_hoisted_5$3)):((v=r.itemInfo.animations)==null?void 0:v.type.val)===vue.unref(EConfigAnimationsType).Track?(vue.openBlock(),vue.createElementBlock("circle",{key:1,cx:"0",cy:"0",r:Math.ceil(r.itemInfo.props["stroke-width"].val*.6)+2,fill:r.itemInfo.animations.color.val},[vue.createElementVNode("animateMotion",{path:vue.unref(positionArrToPath)(r.itemInfo.animations.reverse.val?[...r.itemInfo.props.point_position.val].reverse():r.itemInfo.props.point_position.val),dur:`${r.itemInfo.animations.dur.val}s`,repeatCount:r.itemInfo.animations.repeatCount.val},null,8,_hoisted_8$2)],8,_hoisted_7$2)):vue.createCommentVNode("",!0),vue.createElementVNode("g",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.itemInfo.props.point_position.val,(_,b)=>{var A;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("circle",{key:b,cx:_.x,cy:_.y,r:r.itemInfo.props.point_r.val+1,fill:"none","fill-opacity":"0","stroke-width":Math.ceil(r.itemInfo.props.point_r.val*.2)+1,stroke:"#DE4517"},null,8,_hoisted_9$1)),[[vue.vShow,r.itemInfo.selected||r.itemInfo.id===((A=vue.unref(n).handle_svg_info)==null?void 0:A.info.id)]])}),128)),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.itemInfo.props.point_position.val,(_,b)=>(vue.openBlock(),vue.createElementBlock("circle",{key:b,cx:_.x,cy:_.y,r:r.itemInfo.props.point_r.val,"stroke-width":"1",stroke:r.itemInfo.props.stroke.val,fill:"#fff",style:{cursor:"pointer"},onMousedown:A=>u(b,A,_.x,_.y)},null,40,_hoisted_10$1))),128))])],4)}}}),_hoisted_1$8={class:"coverLayer"},_hoisted_2$6={xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%"},_hoisted_3$5={id:"pattern_grid",patternUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},_hoisted_4$3=["stroke"],_hoisted_5$2=["stroke"],_hoisted_6$1=["stroke"],_hoisted_7$1=["stroke"],_hoisted_8$1={key:0,width:"100%",height:"100%",fill:"url(#pattern_grid)"},_hoisted_9=["transform"],_hoisted_10=["transform"],_hoisted_11=["transform","onMousedown","onMouseup","onMouseenter","onMouseleave","onContextmenu"],_hoisted_12=["xlink:href","width","height","id","transform"],_hoisted_13=["id"],_hoisted_14=["id","x1","y1","x2","y2"],_hoisted_15=["id"],_hoisted_16=["x","y","height","width"],_hoisted_17=["onClick"],_hoisted_18={class:"shortcut"},_sfc_main$y=vue.defineComponent({__name:"center-panel",props:{vueComp:{}},setup(i,{expose:r}){vue.useCssVars(Ie=>({"32de9888":vue.unref(g)}));const n=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=useEditPrivateStore(pinia),c=useContextMenuStore(pinia);componentsRegister(i.vueComp);const f=vue.ref(),h=vue.ref(),y={MoveCanvas:"grab",Rotate:"url('/src/assets/icons/rotate.svg'), auto",Connection:"crosshair",SetConnectionLineNode:"crosshair"},g=vue.computed(()=>Object.keys(y).indexOf(n.intention)>-1?y[n.intention]:"default"),p=vue.reactive({handle_panel:vue.computed(()=>n.intention===EGlobalStoreIntention.Select||n.intention===EGlobalStoreIntention.Zoom||n.intention===EGlobalStoreIntention.Rotate),connection_panel:!1,connection_line:!1,select_item:{info:null,index:-1}}),v=vue.ref({a:{x:0,y:0},b:{x:0,y:0}}),_=vue.computed(()=>n.intention===EGlobalStoreIntention.SelectArea&&v.value.b.x&&v.value.b.y?{with:Math.abs(v.value.b.x-v.value.a.x),height:Math.abs(v.value.b.y-v.value.a.y),x:v.value.a.x<v.value.b.x?v.value.a.x:v.value.b.x,y:v.value.a.y<v.value.b.y?v.value.a.y:v.value.b.y}:{with:0,height:0,x:0,y:0}),b=vue.computed(()=>{let Ie=0;for(let At of n.done_json)At.selected&&Ie++;return Ie>0});let A=!1,w=!1;const T=Ie=>{var At;if(n.intention!=EGlobalStoreIntention.None){if(n.intention==EGlobalStoreIntention.Create){if(!n.create_svg_info){console.error("要创建的数据获取失败");return}const _e=Math.floor(Ie.offsetX/o.svg.scale-a.center_offset.x),qe=Math.floor(Ie.offsetY/o.svg.scale-a.center_offset.y),In={id:randomString(),x:_e,y:qe,client:{x:_e,y:qe},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},selected:!1,...objectDeepClone(n.create_svg_info)};n.setDoneJson(In),n.setHandleSvgInfo(In,n.done_json.length),n.intention=EGlobalStoreIntention.None}(At=h.value)==null||At.focus()}},S=Ie=>{Ie.preventDefault()},x=Ie=>{Ie.preventDefault()},L=(Ie,At,_e)=>{var qe,In,vn;if((qe=h.value)==null||qe.focus(),n.intention===EGlobalStoreIntention.Connection){_e.stopPropagation();return}if(_e.preventDefault(),_e.stopPropagation(),_e.ctrlKey&&_e.button===0)((In=n.handle_svg_info)!=null&&In.index||((vn=n.handle_svg_info)==null?void 0:vn.index)===0)&&(n.done_json[n.handle_svg_info.index].selected=!0,n.setHandleSvgInfo(null),n.intention=EGlobalStoreIntention.None),Ie.selected=!Ie.selected;else if(b.value){n.intention=EGlobalStoreIntention.GroupMove,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((_e.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0};for(let Pt of n.done_json)Pt.selected&&(Pt.old_position={x:Pt.x,y:Pt.y},Pt.point_coordinate_old=objectDeepClone(Pt.point_coordinate))}else n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo(Ie,At),n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((_e.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:Ie.x,now_position_y:Ie.y,new_position_x:0,new_position_y:0},Ie.point_coordinate_old=objectDeepClone(Ie.point_coordinate)},M=(Ie,At,_e)=>{if(!(n.intention===EGlobalStoreIntention.Connection||n.mouse_info.state!=EMouseInfoState.Down)&&b.value&&!A&&["SelectArea","Move","Select"].indexOf(n.intention)<0){for(let qe of n.done_json)qe.selected=!1,qe.old_position={x:0,y:0},resetHandlePointOld(qe);n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo(Ie,At),n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((_e.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:Ie.x,now_position_y:Ie.y,new_position_x:0,new_position_y:0}}},O=(Ie,At,_e)=>{_e.preventDefault(),_e.stopPropagation(),p.connection_panel=!0,p.connection_line=!0,!((n.intention===EGlobalStoreIntention.Connection||n.intention===EGlobalStoreIntention.SetConnectionLineNode)&&Ie.type===EDoneJsonType.ConnectionLine)&&(p.select_item.info=Ie,p.select_item.index=At)},ie=(Ie,At,_e)=>{_e.preventDefault(),_e.stopPropagation(),!((n.intention===EGlobalStoreIntention.Connection||n.intention===EGlobalStoreIntention.SetConnectionLineNode)&&Ie.type===EDoneJsonType.ConnectionLine)&&(p.connection_panel=!1,p.connection_line=!1,p.select_item.info=null,p.select_item.index=-1)},$=Ie=>{var vn,Pt,he,Ue,Dt,jt,Et,Ce,ue,$e,Ne,Oe,Lt,kt,Cn,oe;if(n.mouse_info.state!=EMouseInfoState.Down&&n.intention!==EGlobalStoreIntention.Connection)return;const{clientX:At,clientY:_e}=Ie;n.mouse_info.new_position_x=Math.round((At-a.canvasInfo.left)/o.svg.scale),n.mouse_info.new_position_y=Math.round((_e-a.canvasInfo.top)/o.svg.scale);const qe=Math.round(n.mouse_info.new_position_x-n.mouse_info.position_x+n.mouse_info.now_position_x),In=Math.round(n.mouse_info.new_position_y-n.mouse_info.position_y+n.mouse_info.now_position_y);if((vn=n.handle_svg_info)!=null&&vn.info&&(n.intention===EGlobalStoreIntention.Select||n.intention===EGlobalStoreIntention.Move)){if(n.handle_svg_info.info.x=qe,n.handle_svg_info.info.y=In,n.handle_svg_info.info.client={x:qe,y:In},n.intention=EGlobalStoreIntention.Move,moveHandlePoint(n.handle_svg_info.info),moveAnchors(n.handle_svg_info.info),n.handle_svg_info.info.type===EDoneJsonType.ConnectionLine){if((Pt=n.handle_svg_info.info.bind_anchors)!=null&&Pt.start){let ae=null;for(let Y of n.done_json)Y.id===((Ue=(he=n.handle_svg_info.info.bind_anchors)==null?void 0:he.start)==null?void 0:Ue.target_id)&&(ae=Y);ae&&moveAnchors(ae)}if((Dt=n.handle_svg_info.info.bind_anchors)!=null&&Dt.end){let ae=null;for(let Y of n.done_json)Y.id===((Et=(jt=n.handle_svg_info.info.bind_anchors)==null?void 0:jt.end)==null?void 0:Et.target_id)&&(ae=Y);ae&&moveAnchors(ae)}}}else if(n.intention===EGlobalStoreIntention.MoveCanvas)a.center_offset.x=qe,a.center_offset.y=In;else if(n.intention===EGlobalStoreIntention.SelectArea)v.value.b.x=n.mouse_info.new_position_x-a.center_offset.x,v.value.b.y=n.mouse_info.new_position_y-a.center_offset.y;else if(n.intention===EGlobalStoreIntention.GroupMove){A=!0;for(let ae of n.done_json)if(ae.selected&&ae.old_position){const Y=Math.round(n.mouse_info.new_position_x-n.mouse_info.position_x+ae.old_position.x),k=Math.round(n.mouse_info.new_position_y-n.mouse_info.position_y+ae.old_position.y);if(ae.x=Y,ae.y=k,ae.client={x:Y,y:k},moveHandlePoint(ae),moveAnchors(ae),ae.type===EDoneJsonType.ConnectionLine&&((Ce=ae.bind_anchors)!=null&&Ce.end)){let D=null;for(let j of n.done_json)j.id===(($e=(ue=ae.bind_anchors)==null?void 0:ue.end)==null?void 0:$e.target_id)&&(D=j);D&&moveAnchors(D)}}}else if(n.intention===EGlobalStoreIntention.Zoom){if(!n.handle_svg_info)return;const ae={x:n.mouse_info.new_position_x-a.center_offset.x,y:n.mouse_info.new_position_y-a.center_offset.y};let Y={width:0,height:0,is_old_width:!1,is_old_height:!1};if(n.scale_info.type===EScaleInfoType.TopLeft?Y=calculateLeftTop(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.TopRight?Y=calculateRightTop(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.BottomRight?Y=calculateRightBottom(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.BottomLeft?Y=calculateLeftBottom(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.TopCenter?Y=calculateTop(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client):n.scale_info.type===EScaleInfoType.Right?Y=calculateRight(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client):n.scale_info.type===EScaleInfoType.BottomCenter?Y=calculateBottom(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client):n.scale_info.type===EScaleInfoType.Left&&(Y=calculateLeft(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client)),n.handle_svg_info&&Y.width>0&&Y.height>0){const k=Y.is_old_width?1:myFixed(Y.width/n.handle_svg_info.info.actual_bound.width,3),D=Y.is_old_height?1:myFixed(Y.height/n.handle_svg_info.info.actual_bound.height,3),j=getCenterPoint(ae,n.scale_info.symmetric_point);k>0&&n.scale_info.type!==EScaleInfoType.TopCenter&&n.scale_info.type!==EScaleInfoType.BottomCenter&&(n.handle_svg_info.info.scale_x=k,n.handle_svg_info.info.x=Math.round(getSvgNowPosition(n.handle_svg_info.info.center_position.x,j.x,n.handle_svg_info.info.client.x))),D>0&&n.scale_info.type!==EScaleInfoType.Left&&n.scale_info.type!==EScaleInfoType.Right&&(n.handle_svg_info.info.scale_y=D,n.handle_svg_info.info.y=Math.round(getSvgNowPosition(n.handle_svg_info.info.center_position.y,j.y,n.handle_svg_info.info.client.y)))}}else if(n.intention===EGlobalStoreIntention.Rotate){if(!n.handle_svg_info)return;const ae=Math.atan2(n.mouse_info.position_y-n.handle_svg_info.info.y,n.mouse_info.position_x-n.handle_svg_info.info.x)/(Math.PI/180),Y=Math.atan2(n.mouse_info.new_position_y-a.center_offset.y-n.handle_svg_info.info.y,n.mouse_info.new_position_x-a.center_offset.x-n.handle_svg_info.info.x)/(Math.PI/180);n.handle_svg_info.info.rotate=myFixed(n.rotate_info.angle+Y-ae,2)}else if(n.intention===EGlobalStoreIntention.Connection&&n.handle_svg_info){const ae=(Ne=n.handle_svg_info)==null?void 0:Ne.info.props.point_position.val.length,Y=n.mouse_info.new_position_x-n.mouse_info.position_x-a.center_offset.x,k=n.mouse_info.new_position_y-n.mouse_info.position_y-a.center_offset.y,D=n.handle_svg_info.info.props.point_position.val[ae-2],j=((Lt=(Oe=n.handle_svg_info)==null?void 0:Oe.info.props.point_r)==null?void 0:Lt.val)+2||4;let xe=D.x<Y?-j:D.x>Y?j:0,hn=D.y<k?-j:D.y>k?j:0;Ie.ctrlKey?n.handle_svg_info.info.props.point_position.val[ae-1]={x:D.x,y:k+hn}:Ie.shiftKey?n.handle_svg_info.info.props.point_position.val[ae-1]={x:Y+xe,y:D.y}:n.handle_svg_info.info.props.point_position.val[ae-1]={x:Y+xe,y:k+hn}}else if(n.intention===EGlobalStoreIntention.SetConnectionLineNode&&n.handle_svg_info){!w&&(n.connection_line_node_info.point_index===n.handle_svg_info.info.props.point_position.val.length-1||n.connection_line_node_info.point_index===0)&&(w=!0);const ae=(kt=n.handle_svg_info)==null?void 0:kt.info.props.point_position.val.length,Y=getSvgNowPosition(n.mouse_info.position_x,n.mouse_info.new_position_x,n.connection_line_node_info.init_pos.x),k=getSvgNowPosition(n.mouse_info.position_y,n.mouse_info.new_position_y,n.connection_line_node_info.init_pos.y),D=n.handle_svg_info.info.props.point_position.val[ae-2],j=((oe=(Cn=n.handle_svg_info)==null?void 0:Cn.info.props.point_r)==null?void 0:oe.val)+2||4;let xe=D.x<Y?-j:D.x>Y?j:0,hn=D.y<k?-j:D.y>k?j:0;n.handle_svg_info.info.props.point_position.val[n.connection_line_node_info.point_index]={x:Y+xe,y:k+hn}}},z=()=>{var Ie,At,_e,qe;if(n.mouse_info.state==EMouseInfoState.Down){if((Ie=n.handle_svg_info)!=null&&Ie.info&&n.intention==EGlobalStoreIntention.Move)setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.intention=EGlobalStoreIntention.None,n.setDoneJson(n.done_json);else if(n.intention==EGlobalStoreIntention.GroupMove)A&&(A=!1,n.intention=EGlobalStoreIntention.None);else if((At=n.handle_svg_info)!=null&&At.info&&n.intention==EGlobalStoreIntention.Zoom)n.handle_svg_info.info.client={x:n.handle_svg_info.info.x,y:n.handle_svg_info.info.y},n.intention=EGlobalStoreIntention.None,setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.setDoneJson(n.done_json);else if(n.intention===EGlobalStoreIntention.Rotate&&((_e=n.handle_svg_info)!=null&&_e.info))setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.setDoneJson(n.done_json),n.intention=EGlobalStoreIntention.None;else{if(n.intention===EGlobalStoreIntention.Connection)return;if(n.intention===EGlobalStoreIntention.SetConnectionLineNode)w&&((qe=n.handle_svg_info)!=null&&qe.info.bind_anchors)&&(n.connection_line_node_info.point_index===0?n.handle_svg_info.info.bind_anchors.start=null:n.handle_svg_info.info.bind_anchors.end=null),n.intention=EGlobalStoreIntention.None,w=!1;else if(n.intention===EGlobalStoreIntention.SelectArea){n.setHandleSvgInfo(null);for(let In of n.done_json){const vn=_.value;In.selected=In.x>vn.x&&In.x<vn.x+vn.with&&In.y>vn.y&&In.y<vn.y+vn.height}n.intention=EGlobalStoreIntention.None}else n.intention!=EGlobalStoreIntention.Select&&(n.intention=EGlobalStoreIntention.None)}n.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},c.display=!1}},V=Ie=>{const{clientX:At,clientY:_e}=Ie;if(n.intention===EGlobalStoreIntention.Connection){n.handle_svg_info||createLine(Ie),n.handle_svg_info&&(Ie.button===0?n.handle_svg_info.info.props.point_position.val.length!==1?n.handle_svg_info.info.props.point_position.val.push({x:n.mouse_info.new_position_x-n.mouse_info.position_x-a.center_offset.x,y:n.mouse_info.new_position_y-n.mouse_info.position_y-a.center_offset.y}):n.handle_svg_info.info.props.point_position.val.push({x:0,y:0}):Ie.button===2&&(n.intention=EGlobalStoreIntention.None,setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.setHandleSvgInfo(null)));return}Ie.button===0?(n.intention=EGlobalStoreIntention.SelectArea,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((At-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),position_y:Math.round((_e-a.canvasInfo.top)/o.svg.scale-a.center_offset.y),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},v.value={a:{x:n.mouse_info.position_x,y:n.mouse_info.position_y},b:{x:0,y:0}}):Ie.button===2&&(n.intention=EGlobalStoreIntention.MoveCanvas,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((At-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e-a.canvasInfo.top)/o.svg.scale),now_position_x:a.center_offset.x,now_position_y:a.center_offset.y,new_position_x:0,new_position_y:0})};function re(Ie){Ie!=null&&Ie.wheelDelta&&(Ie.wheelDelta>0?(o.svg.scale=myFixed(o.svg.scale+.1,1),getZoomPosition(Ie,o.svg.scale,a.center_offset,!0)):o.svg.scale>.1&&(o.svg.scale=myFixed(o.svg.scale-.1,1),getZoomPosition(Ie,o.svg.scale,a.center_offset,!1)))}const F=Ie=>{Ie.stopPropagation(),Ie.preventDefault()},pe=(Ie,At,_e)=>{n.intention!==EGlobalStoreIntention.Connection&&f.value&&(n.intention=EGlobalStoreIntention.ContextMenu,n.setHandleSvgInfo(Ie,At),f.value.style.left=_e.pageX+"px",f.value.style.top=_e.pageY+"px",c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!0,At===n.done_json.length-1&&(c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=!1),At===0&&(c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!1),c.display=!0)},le=(Ie,At,_e)=>({x:myFixed(Ie.x-Ie.width/2*At+Ie.width/2,1),y:myFixed(Ie.y-Ie.height/2*_e+Ie.height/2,1),width:myFixed(Ie.width*At,1),height:myFixed(Ie.height*_e,1)}),de=Ie=>{Ie.preventDefault();let At=[];if(!Ie.ctrlKey&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].indexOf(Ie.key)>-1&&(b.value?At=n.done_json.map((_e,qe)=>({selected:_e.selected,i:qe})).filter(_e=>_e.selected).map(_e=>_e.i):n.handle_svg_info&&At.push(n.handle_svg_info.index)),!Ie.ctrlKey&&Ie.key=="ArrowUp"){for(let _e of At)n.done_json[_e].y-=1,n.done_json[_e].client.y-=1,moveHandlePoint(n.done_json[_e],0,-1),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else if(!Ie.ctrlKey&&Ie.key=="ArrowDown"){for(let _e of At)n.done_json[_e].y+=1,n.done_json[_e].client.y+=1,moveHandlePoint(n.done_json[_e],0,1),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else if(!Ie.ctrlKey&&Ie.key=="ArrowLeft"){for(let _e of At)n.done_json[_e].x-=1,n.done_json[_e].client.x-=1,moveHandlePoint(n.done_json[_e],-1,0),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else if(!Ie.ctrlKey&&Ie.key=="ArrowRight"){for(let _e of At)n.done_json[_e].x+=1,n.done_json[_e].client.x+=1,moveHandlePoint(n.done_json[_e],1,0),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else Ie.ctrlKey&&Ie.key.toLowerCase()=="c"?c.onContextMenuClick(EContextMenuInfoType.Copy):!Ie.ctrlKey&&Ie.key=="Delete"?b.value?(n.setDoneJson(n.done_json.filter(_e=>!_e.selected)),n.setHandleSvgInfo(n.done_json[n.done_json.length-1],n.done_json.length-1)):c.onContextMenuClick(EContextMenuInfoType.Delete):Ie.ctrlKey&&Ie.key=="ArrowUp"?c.onContextMenuClick(EContextMenuInfoType.MoveUpOneLevel):Ie.ctrlKey&&Ie.key=="ArrowDown"?c.onContextMenuClick(EContextMenuInfoType.MoveDownOneLevel):Ie.ctrlKey&&Ie.key=="ArrowLeft"?c.onContextMenuClick(EContextMenuInfoType.MoveDownTopLevel):Ie.ctrlKey&&Ie.key=="ArrowRight"?c.onContextMenuClick(EContextMenuInfoType.MoveUpTopLevel):Ie.ctrlKey&&Ie.shiftKey&&Ie.key.toLowerCase()=="z"?u.topRedoBtnClick():Ie.ctrlKey&&Ie.key.toLowerCase()=="z"?u.topUndoBtnClick():Ie.ctrlKey&&Ie.key.toLowerCase()=="delete"&&(n.done_json.length<=0||n.setDoneJson([]))},Fe=()=>{setSvgActualInfo(n.done_json[n.handle_svg_info.index],!0)};return vue.onMounted(()=>{var Ie;(Ie=h.value)==null||Ie.focus(),vue.nextTick(function(){var _e;const At=(_e=h.value)==null?void 0:_e.getBoundingClientRect();a.canvasInfo={height:(At==null?void 0:At.height)||0,with:(At==null?void 0:At.width)||0,top:(At==null?void 0:At.top)||0,left:(At==null?void 0:At.left)||0}})}),r({onCanvasMouseUp:z}),(Ie,At)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",{ref_key:"canvasRef",ref:h,class:"canvas",style:vue.normalizeStyle({backgroundColor:vue.unref(o).svg.background_color,position:"relative"}),tabindex:"0",onDrop:T,onDragenter:S,onDragover:x,onMousedown:V,onMousemove:$,onMouseup:z,onContextmenu:F,onKeydown:de,onMousewheel:re},[vue.renderSlot(Ie.$slots,"background",{},void 0,!0),vue.createElementVNode("div",_hoisted_1$8,[(vue.openBlock(),vue.createElementBlock("svg",_hoisted_2$6,[vue.createElementVNode("defs",null,[vue.createElementVNode("pattern",_hoisted_3$5,[vue.createElementVNode("line",{x1:"0",y1:"0",x2:"0",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_4$3),vue.createElementVNode("line",{x1:"10",y1:"0",x2:"10",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_5$2),vue.createElementVNode("line",{x1:"0",y1:"0",x2:"20",y2:"0",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_6$1),vue.createElementVNode("line",{x1:"0",y1:"10",x2:"20",y2:"10",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_7$1)])]),vue.unref(o).svg.grid?(vue.openBlock(),vue.createElementBlock("rect",_hoisted_8$1)):vue.createCommentVNode("",!0),vue.createElementVNode("g",{transform:`translate(${vue.unref(a).center_offset.x*vue.unref(o).svg.scale},${vue.unref(a).center_offset.y*vue.unref(o).svg.scale})rotate(0)scale(${vue.unref(o).svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(n).done_json,(_e,qe)=>{var In,vn,Pt,he,Ue,Dt,jt,Et,Ce,ue,$e,Ne,Oe,Lt;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:_e.id,transform:`translate(${_e.x},${_e.y})rotate(0)scale(1)`},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(_e)}`)},[vue.createElementVNode("g",{transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2})rotate(${_e.rotate}) scale(1) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`,onMousedown:kt=>L(_e,qe,kt),onMouseup:kt=>M(_e,qe,kt),onMouseenter:kt=>O(_e,qe,kt),onMouseleave:kt=>ie(_e,qe,kt),onContextmenu:kt=>pe(_e,qe,kt)},[_e.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$z,{key:0,"item-info":_e,"point-visible":vue.unref(p).connection_line&&((In=vue.unref(p).select_item.info)==null?void 0:In.id)==_e.id},null,8,["item-info","point-visible"])):_e.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${_e.name}`,ref_for:!0},vue.unref(prosToVBind)(_e,["height","width"]),{width:((Pt=(vn=_e.props)==null?void 0:vn.width)==null?void 0:Pt.val)??100,height:((Ue=(he=_e.props)==null?void 0:he.height)==null?void 0:Ue.val)??100,id:_e.id,transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2}) scale(${_e.scale_x},${_e.scale_y}) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`}),null,16,_hoisted_12)):_e.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(_e.tag),vue.mergeProps({key:2,ref_for:!0},vue.unref(prosToVBind)(_e,["height","width"]),{width:((jt=(Dt=_e.props)==null?void 0:Dt.width)==null?void 0:jt.val)??100,height:((Ce=(Et=_e.props)==null?void 0:Et.height)==null?void 0:Ce.val)??100,id:_e.id,onResize:Fe,transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2}) scale(${_e.scale_x},${_e.scale_y}) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`}),null,16,["width","height","id","transform"])):_e.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3,ref_for:!0},le(_e.actual_bound,_e.scale_x,_e.scale_y),{id:`foreign-object${_e.id}`,class:"foreignObject"}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(_e.tag),vue.mergeProps({ref_for:!0},vue.unref(prosToVBind)(_e),{id:_e.id,transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2}) scale(${_e.scale_x},${_e.scale_y}) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(_e.tag_slot),1)]),_:2},1040,["id","transform"]))],16,_hoisted_13)):_e.type===vue.unref(EDoneJsonType).StraightLine?(vue.openBlock(),vue.createElementBlock("line",{key:4,id:_e.id,x1:_e.props.start_x.val,y1:_e.props.start_y.val,x2:_e.props.end_x.val,y2:_e.props.end_y.val,fill:"#FF0000",stroke:"#FF0000","stroke-width":"2"},null,8,_hoisted_14)):vue.createCommentVNode("",!0),_e.config.actual_rect?(vue.openBlock(),vue.createElementBlock("rect",vue.mergeProps({key:5,id:`rect${_e.id}`,fill:"black","fill-opacity":"0",ref_for:!0},le(_e.actual_bound,_e.scale_x,_e.scale_y),{style:{stroke:"none","stroke-width":"2","stroke-miterlimit":"10"},class:{"svg-item-none":!_e.selected&&(vue.unref(n).intention==vue.unref(EGlobalStoreIntention).None||vue.unref(n).intention==vue.unref(EGlobalStoreIntention).Select),"svg-item-move":vue.unref(n).intention==vue.unref(EGlobalStoreIntention).Move&&((ue=vue.unref(n).handle_svg_info)==null?void 0:ue.info.id)==_e.id,"svg-item-select":vue.unref(n).intention==vue.unref(EGlobalStoreIntention).Select&&(($e=vue.unref(n).handle_svg_info)==null?void 0:$e.info.id)==_e.id,"svg-item-in-group":_e.selected}}),null,16,_hoisted_15)):vue.createCommentVNode("",!0),((Ne=vue.unref(n).handle_svg_info)==null?void 0:Ne.info.id)===_e.id&&vue.unref(p).handle_panel&&_e.type!==vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(HandlePanel,{key:6,"item-info":_e},null,8,["item-info"])):vue.createCommentVNode("",!0),!_e.selected&&((Oe=vue.unref(p).select_item.info)==null?void 0:Oe.id)==_e.id&&vue.unref(p).connection_panel&&_e.config.have_anchor&&vue.unref(n).intention!==vue.unref(EGlobalStoreIntention).SelectArea&&(vue.unref(n).intention!==vue.unref(EGlobalStoreIntention).Select||_e.id!==((Lt=vue.unref(n).handle_svg_info)==null?void 0:Lt.info.id))?(vue.openBlock(),vue.createBlock(ConnectionPanel,{key:7,onContextmenu:F,"item-info":_e},null,8,["item-info"])):vue.createCommentVNode("",!0)],40,_hoisted_11)],2)],8,_hoisted_10)),[[vue.vShow,_e.display]])}),128)),vue.createElementVNode("rect",{x:vue.unref(_).x,y:vue.unref(_).y,height:vue.unref(_).height,width:vue.unref(_).with,stroke:"#107cec",fill:"#107cec","fill-opacity":".2"},null,8,_hoisted_16)],8,_hoisted_9)]))])],36),vue.withDirectives(vue.createElementVNode("ul",{ref_key:"contextMenuRef",ref:f,class:"contextMenu"},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(c).info,(_e,qe)=>(vue.openBlock(),vue.createElementBlock("li",{key:_e.title,onClick:In=>vue.unref(c).onContextMenuClick(qe)},[vue.createElementVNode("p",{class:vue.normalizeClass(_e.enable?"":"disabled")},[vue.createTextVNode(vue.toDisplayString(_e.title)+" ",1),vue.createElementVNode("span",_hoisted_18,vue.toDisplayString(_e.hot_key),1)],2)],8,_hoisted_17))),128))],512),[[vue.vShow,vue.unref(c).display]])],64))}}),centerPanel_vue_vue_type_style_index_0_scoped_1b085626_lang="",CenterPanel=_export_sfc$1(_sfc_main$y,[["__scopeId","data-v-1b085626"]]);/*! Element Plus Icons Vue v2.3.1 */var aim_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Aim",__name:"aim",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"}),vue.createElementVNode("path",{fill:"currentColor",d:"M512 96a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V128a32 32 0 0 1 32-32m0 576a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V704a32 32 0 0 1 32-32M96 512a32 32 0 0 1 32-32h192a32 32 0 0 1 0 64H128a32 32 0 0 1-32-32m576 0a32 32 0 0 1 32-32h192a32 32 0 1 1 0 64H704a32 32 0 0 1-32-32"})]))}}),aim_default=aim_vue_vue_type_script_setup_true_lang_default,arrow_down_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"ArrowDown",__name:"arrow-down",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"})]))}}),arrow_down_default=arrow_down_vue_vue_type_script_setup_true_lang_default,circle_check_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"CircleCheck",__name:"circle-check",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"}),vue.createElementVNode("path",{fill:"currentColor",d:"M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"})]))}}),circle_check_default=circle_check_vue_vue_type_script_setup_true_lang_default,circle_close_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"CircleClose",__name:"circle-close",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"}),vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"})]))}}),circle_close_default=circle_close_vue_vue_type_script_setup_true_lang_default,close_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Close",__name:"close",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}}),close_default=close_vue_vue_type_script_setup_true_lang_default,hide_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Hide",__name:"hide",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"}),vue.createElementVNode("path",{fill:"currentColor",d:"M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"})]))}}),hide_default=hide_vue_vue_type_script_setup_true_lang_default,loading_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Loading",__name:"loading",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"})]))}}),loading_default=loading_vue_vue_type_script_setup_true_lang_default,view_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"View",__name:"view",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"})]))}}),view_default=view_vue_vue_type_script_setup_true_lang_default,MapShim=function(){if(typeof Map<"u")return Map;function i(r,n){var o=-1;return r.some(function(a,u){return a[0]===n?(o=u,!0):!1}),o}return function(){function r(){this.__entries__=[]}return Object.defineProperty(r.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),r.prototype.get=function(n){var o=i(this.__entries__,n),a=this.__entries__[o];return a&&a[1]},r.prototype.set=function(n,o){var a=i(this.__entries__,n);~a?this.__entries__[a][1]=o:this.__entries__.push([n,o])},r.prototype.delete=function(n){var o=this.__entries__,a=i(o,n);~a&&o.splice(a,1)},r.prototype.has=function(n){return!!~i(this.__entries__,n)},r.prototype.clear=function(){this.__entries__.splice(0)},r.prototype.forEach=function(n,o){o===void 0&&(o=null);for(var a=0,u=this.__entries__;a<u.length;a++){var c=u[a];n.call(o,c[1],c[0])}},r}()}(),isBrowser=typeof window<"u"&&typeof document<"u"&&window.document===document,global$1=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),requestAnimationFrame$1=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(global$1):function(i){return setTimeout(function(){return i(Date.now())},1e3/60)}}(),trailingTimeout=2;function throttle(i,r){var n=!1,o=!1,a=0;function u(){n&&(n=!1,i()),o&&d()}function c(){requestAnimationFrame$1(u)}function d(){var f=Date.now();if(n){if(f-a<trailingTimeout)return;o=!0}else n=!0,o=!1,setTimeout(c,r);a=f}return d}var REFRESH_DELAY=20,transitionKeys=["top","right","bottom","left","width","height","size","weight"],mutationObserverSupported=typeof MutationObserver<"u",ResizeObserverController=function(){function i(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=throttle(this.refresh.bind(this),REFRESH_DELAY)}return i.prototype.addObserver=function(r){~this.observers_.indexOf(r)||this.observers_.push(r),this.connected_||this.connect_()},i.prototype.removeObserver=function(r){var n=this.observers_,o=n.indexOf(r);~o&&n.splice(o,1),!n.length&&this.connected_&&this.disconnect_()},i.prototype.refresh=function(){var r=this.updateObservers_();r&&this.refresh()},i.prototype.updateObservers_=function(){var r=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return r.forEach(function(n){return n.broadcastActive()}),r.length>0},i.prototype.connect_=function(){!isBrowser||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),mutationObserverSupported?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},i.prototype.disconnect_=function(){!isBrowser||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},i.prototype.onTransitionEnd_=function(r){var n=r.propertyName,o=n===void 0?"":n,a=transitionKeys.some(function(u){return!!~o.indexOf(u)});a&&this.refresh()},i.getInstance=function(){return this.instance_||(this.instance_=new i),this.instance_},i.instance_=null,i}(),defineConfigurable=function(i,r){for(var n=0,o=Object.keys(r);n<o.length;n++){var a=o[n];Object.defineProperty(i,a,{value:r[a],enumerable:!1,writable:!1,configurable:!0})}return i},getWindowOf=function(i){var r=i&&i.ownerDocument&&i.ownerDocument.defaultView;return r||global$1},emptyRect=createRectInit(0,0,0,0);function toFloat(i){return parseFloat(i)||0}function getBordersSize(i){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return r.reduce(function(o,a){var u=i["border-"+a+"-width"];return o+toFloat(u)},0)}function getPaddings(i){for(var r=["top","right","bottom","left"],n={},o=0,a=r;o<a.length;o++){var u=a[o],c=i["padding-"+u];n[u]=toFloat(c)}return n}function getSVGContentRect(i){var r=i.getBBox();return createRectInit(0,0,r.width,r.height)}function getHTMLElementContentRect(i){var r=i.clientWidth,n=i.clientHeight;if(!r&&!n)return emptyRect;var o=getWindowOf(i).getComputedStyle(i),a=getPaddings(o),u=a.left+a.right,c=a.top+a.bottom,d=toFloat(o.width),f=toFloat(o.height);if(o.boxSizing==="border-box"&&(Math.round(d+u)!==r&&(d-=getBordersSize(o,"left","right")+u),Math.round(f+c)!==n&&(f-=getBordersSize(o,"top","bottom")+c)),!isDocumentElement(i)){var h=Math.round(d+u)-r,y=Math.round(f+c)-n;Math.abs(h)!==1&&(d-=h),Math.abs(y)!==1&&(f-=y)}return createRectInit(a.left,a.top,d,f)}var isSVGGraphicsElement=function(){return typeof SVGGraphicsElement<"u"?function(i){return i instanceof getWindowOf(i).SVGGraphicsElement}:function(i){return i instanceof getWindowOf(i).SVGElement&&typeof i.getBBox=="function"}}();function isDocumentElement(i){return i===getWindowOf(i).document.documentElement}function getContentRect(i){return isBrowser?isSVGGraphicsElement(i)?getSVGContentRect(i):getHTMLElementContentRect(i):emptyRect}function createReadOnlyRect(i){var r=i.x,n=i.y,o=i.width,a=i.height,u=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,c=Object.create(u.prototype);return defineConfigurable(c,{x:r,y:n,width:o,height:a,top:n,right:r+o,bottom:a+n,left:r}),c}function createRectInit(i,r,n,o){return{x:i,y:r,width:n,height:o}}var ResizeObservation=function(){function i(r){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=createRectInit(0,0,0,0),this.target=r}return i.prototype.isActive=function(){var r=getContentRect(this.target);return this.contentRect_=r,r.width!==this.broadcastWidth||r.height!==this.broadcastHeight},i.prototype.broadcastRect=function(){var r=this.contentRect_;return this.broadcastWidth=r.width,this.broadcastHeight=r.height,r},i}(),ResizeObserverEntry=function(){function i(r,n){var o=createReadOnlyRect(n);defineConfigurable(this,{target:r,contentRect:o})}return i}(),ResizeObserverSPI=function(){function i(r,n,o){if(this.activeObservations_=[],this.observations_=new MapShim,typeof r!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=r,this.controller_=n,this.callbackCtx_=o}return i.prototype.observe=function(r){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(r instanceof getWindowOf(r).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(r)||(n.set(r,new ResizeObservation(r)),this.controller_.addObserver(this),this.controller_.refresh())}},i.prototype.unobserve=function(r){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(r instanceof getWindowOf(r).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(r)&&(n.delete(r),n.size||this.controller_.removeObserver(this))}},i.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},i.prototype.gatherActive=function(){var r=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&r.activeObservations_.push(n)})},i.prototype.broadcastActive=function(){if(this.hasActive()){var r=this.callbackCtx_,n=this.activeObservations_.map(function(o){return new ResizeObserverEntry(o.target,o.broadcastRect())});this.callback_.call(r,n,r),this.clearActive()}},i.prototype.clearActive=function(){this.activeObservations_.splice(0)},i.prototype.hasActive=function(){return this.activeObservations_.length>0},i}(),observers=typeof WeakMap<"u"?new WeakMap:new MapShim,ResizeObserver$1=function(){function i(r){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=ResizeObserverController.getInstance(),o=new ResizeObserverSPI(r,n,this);observers.set(this,o)}return i}();["observe","unobserve","disconnect"].forEach(function(i){ResizeObserver$1.prototype[i]=function(){var r;return(r=observers.get(this))[i].apply(r,arguments)}});var index$1=function(){return typeof global$1.ResizeObserver<"u"?global$1.ResizeObserver:ResizeObserver$1}();const Events=["blur","input","change","changeSelectionStyle","changeSession","copy","focus","paste"],VAceEditor=vue.defineComponent({name:"VAceEditor",props:{value:{type:String,required:!0},lang:{type:String,default:"text"},theme:{type:String,default:"chrome"},options:Object,placeholder:String,readonly:Boolean,wrap:Boolean,printMargin:{type:[Boolean,Number],default:!0},minLines:Number,maxLines:Number},emits:["update:value","init",...Events],render(){return vue.h("div")},mounted(){const i=this._editor=vue.markRaw(ace.edit(this.$el,{placeholder:this.placeholder,readOnly:this.readonly,value:this.value,mode:"ace/mode/"+this.lang,theme:"ace/theme/"+this.theme,wrap:this.wrap,printMargin:this.printMargin,useWorker:!1,minLines:this.minLines,maxLines:this.maxLines,...this.options}));this._contentBackup=this.value,this._isSettingContent=!1,i.on("change",()=>{if(this._isSettingContent)return;const r=i.getValue();this._contentBackup=r,this.$emit("update:value",r)}),Events.forEach(r=>{const n="on"+vue.capitalize(r);typeof this.$.vnode.props[n]=="function"&&i.on(r,this.$emit.bind(this,r))}),this._ro=new index$1(()=>i.resize()),this._ro.observe(this.$el),this.$emit("init",i)},beforeUnmount(){var i,r;(i=this._ro)===null||i===void 0||i.disconnect(),(r=this._editor)===null||r===void 0||r.destroy()},methods:{focus(){this._editor.focus()},blur(){this._editor.blur()},selectAll(){this._editor.selectAll()},getAceInstance(){return this._editor}},watch:{value(i){if(this._contentBackup!==i){try{this._isSettingContent=!0,this._editor.setValue(i,1)}finally{this._isSettingContent=!1}this._contentBackup=i}},theme(i){this._editor.setTheme("ace/theme/"+i)},options(i){this._editor.setOptions(i)},readonly(i){this._editor.setReadOnly(i)},placeholder(i){this._editor.setOption("placeholder",i)},wrap(i){this._editor.setWrapBehavioursEnabled(i)},printMargin(i){this._editor.setOption("printMargin",i)},lang(i){this._editor.setOption("mode","ace/mode/"+i)},minLines(i){this._editor.setOption("minLines",i)},maxLines(i){this._editor.setOption("maxLines",i)}}}),themeUrl2="data:application/javascript;base64,YWNlLmRlZmluZSgiYWNlL3RoZW1lL2tyX3RoZW1lLmNzcyIsWyJyZXF1aXJlIiwiZXhwb3J0cyIsIm1vZHVsZSJdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpe21vZHVsZS5leHBvcnRzID0gIi5hY2Uta3ItdGhlbWUgLmFjZV9ndXR0ZXIge1xuICBiYWNrZ3JvdW5kOiAjMWMxOTE3O1xuICBjb2xvcjogI0ZDRkZFMFxufVxuXG4uYWNlLWtyLXRoZW1lIC5hY2VfcHJpbnQtbWFyZ2luIHtcbiAgd2lkdGg6IDFweDtcbiAgYmFja2dyb3VuZDogIzFjMTkxN1xufVxuXG4uYWNlLWtyLXRoZW1lIHtcbiAgYmFja2dyb3VuZC1jb2xvcjogIzBCMEEwOTtcbiAgY29sb3I6ICNGQ0ZGRTBcbn1cblxuLmFjZS1rci10aGVtZSAuYWNlX2N1cnNvciB7XG4gIGNvbG9yOiAjRkY5OTAwXG59XG5cbi5hY2Uta3ItdGhlbWUgLmFjZV9tYXJrZXItbGF5ZXIgLmFjZV9zZWxlY3Rpb24ge1xuICBiYWNrZ3JvdW5kOiByZ2JhKD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lL2tyX3RoZW1lIixbInJlcXVpcmUiLCJleHBvcnRzIiwibW9kdWxlIiwiYWNlL3RoZW1lL2tyX3RoZW1lLmNzcyIsImFjZS9saWIvZG9tIl0sIGZ1bmN0aW9uKHJlcXVpcmUsIGV4cG9ydHMsIG1vZHVsZSl7ZXhwb3J0cy5pc0RhcmsgPSB0cnVlOwpleHBvcnRzLmNzc0NsYXNzID0gImFjZS1rci10aGVtZSI7CmV4cG9ydHMuY3NzVGV4dCA9IHJlcXVpcmUoIi4va3JfdGhlbWUuY3NzIik7CnZhciBkb20gPSByZXF1aXJlKCIuLi9saWIvZG9tIik7CmRvbS5pbXBvcnRDc3NTdHJpbmcoZXhwb3J0cy5jc3NUZXh0LCBleHBvcnRzLmNzc0NsYXNzLCBmYWxzZSk7Cgp9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL3RoZW1lL2tyX3RoZW1lIl0sIGZ1bmN0aW9uKG0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBtb2R1bGUgPT0gIm9iamVjdCIgJiYgdHlwZW9mIGV4cG9ydHMgPT0gIm9iamVjdCIgJiYgbW9kdWxlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IG07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pKCk7CiAgICAgICAgICAgIA==",modeJsonUrl="data:application/javascript;base64,YWNlLmRlZmluZSgiYWNlL21vZGUvanNvbl9oaWdobGlnaHRfcnVsZXMiLFsicmVxdWlyZSIsImV4cG9ydHMiLCJtb2R1bGUiLCJhY2UvbGliL29vcCIsImFjZS9tb2RlL3RleHRfaGlnaGxpZ2h0X3J1bGVzIl0sIGZ1bmN0aW9uKHJlcXVpcmUsIGV4cG9ydHMsIG1vZHVsZSl7InVzZSBzdHJpY3QiOwp2YXIgb29wID0gcmVxdWlyZSgiLi4vbGliL29vcCIpOwp2YXIgVGV4dEhpZ2hsaWdodFJ1bGVzID0gcmVxdWlyZSgiLi90ZXh0X2hpZ2hsaWdodF9ydWxlcyIpLlRleHRIaWdobGlnaHRSdWxlczsKdmFyIEpzb25IaWdobGlnaHRSdWxlcyA9IGZ1bmN0aW9uICgpIHsKICAgIHRoaXMuJHJ1bGVzID0gewogICAgICAgICJzdGFydCI6IFsKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdG9rZW46ICJ2YXJpYWJsZSIsCiAgICAgICAgICAgICAgICByZWdleDogJ1siXSg/Oig/OlxcXFwuKXwoPzpbXiJcXFxcXSkpKj9bIl1cXHMqKD89OiknCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAic3RyaW5nIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAnIicsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RyaW5nIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lm51bWVyaWMiLAogICAgICAgICAgICAgICAgcmVnZXg6ICIwW3hYXVswLTlhLWZBLUZdK1xcYiIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJjb25zdGFudC5udW1lcmljIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAiWystXT9cXGQrKD86KD86XFwuXFxkKik/KD86W2VFXVsrLV0/XFxkKyk/KT9cXGIiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29uc3RhbnQubGFuZ3VhZ2UuYm9vbGVhbiIsCiAgICAgICAgICAgICAgICByZWdleDogIig/OnRydWV8ZmFsc2UpXFxiIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbJ10oPzooPzpcXFxcLil8KD86W14nXFxcXF0pKSo/WyddIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbW1lbnQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXC9cXC8uKiQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29tbWVudC5zdGFydCIsCiAgICAgICAgICAgICAgICByZWdleDogIlxcL1xcKiIsCiAgICAgICAgICAgICAgICBuZXh0OiAiY29tbWVudCIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5scGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbWyh7XSIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5ycGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbXFxdKX1dIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInB1bmN0dWF0aW9uLm9wZXJhdG9yIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAvWyxdLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXHMrIgogICAgICAgICAgICB9CiAgICAgICAgXSwKICAgICAgICAic3RyaW5nIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lmxhbmd1YWdlLmVzY2FwZSIsCiAgICAgICAgICAgICAgICByZWdleDogL1xcKD86eFswLTlhLWZBLUZdezJ9fHVbMC05YS1mQS1GXXs0fXxbIlxcXC9iZm5ydF0pLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInN0cmluZyIsCiAgICAgICAgICAgICAgICByZWdleDogJyJ8JCcsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RhcnQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIGRlZmF1bHRUb2tlbjogInN0cmluZyIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImNvbW1lbnQiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29tbWVudC5lbmQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXCpcXC8iLAogICAgICAgICAgICAgICAgbmV4dDogInN0YXJ0IgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICBkZWZhdWx0VG9rZW46ICJjb21tZW50IgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfTsKfTsKb29wLmluaGVyaXRzKEpzb25IaWdobGlnaHRSdWxlcywgVGV4dEhpZ2hsaWdodFJ1bGVzKTsKZXhwb3J0cy5Kc29uSGlnaGxpZ2h0UnVsZXMgPSBKc29uSGlnaGxpZ2h0UnVsZXM7Cgp9KTsKCmFjZS5kZWZpbmUoImFjZS9tb2RlL21hdGNoaW5nX2JyYWNlX291dGRlbnQiLFsicmVxdWlyZSIsImV4cG9ydHMiLCJtb2R1bGUiLCJhY2UvcmFuZ2UiXSwgZnVuY3Rpb24ocmVxdWlyZSwgZXhwb3J0cywgbW9kdWxlKXsidXNlIHN0cmljdCI7CnZhciBSYW5nZSA9IHJlcXVpcmUoIi4uL3JhbmdlIikuUmFuZ2U7CnZhciBNYXRjaGluZ0JyYWNlT3V0ZGVudCA9IGZ1bmN0aW9uICgpIHsgfTsKKGZ1bmN0aW9uICgpIHsKICAgIHRoaXMuY2hlY2tPdXRkZW50ID0gZnVuY3Rpb24gKGxpbmUsIGlucHV0KSB7CiAgICAgICAgaWYgKCEvXlxzKyQvLnRlc3QobGluZSkpCiAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICByZXR1cm4gL15ccypcfS8udGVzdChpbnB1dCk7CiAgICB9OwogICAgdGhpcy5hdXRvT3V0ZGVudCA9IGZ1bmN0aW9uIChkb2MsIHJvdykgewogICAgICAgIHZhciBsaW5lID0gZG9jLmdldExpbmUocm93KTsKICAgICAgICB2Y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BpID0gbWF0Y2guaW5kZXg7CiAgICAgICAgICAgIGlmIChtYXRjaFsxXSkKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm9wZW5pbmdCcmFja2V0QmxvY2soc2Vzc2lvbiwgbWF0Y2hbMV0sIHJvdywgaSk7CiAgICAgICAgICAgIHZhciByYW5nZSA9IHNlc3Npb24uZ2V0Q29tbWVudEZvbGRSYW5nZShyb3csIGkgKyBtYXRjaFswXS5sZW5ndGgsIDEpOwogICAgICAgICAgICBpZiAocmFuZ2UgJiYgIXJhbmdlLmlzTXVsdGlMaW5lKCkpIHsKICAgICAgICAgICAgICAgIGlmIChmb3JjZU11bHRpbGluZSkgewogICAgICAgICAgICAgICAgICAgIHJhbmdlID0gdGhpcy5nZXRTZWN0aW9uUmFuZ2Uoc2Vzc2lvbiwgcm93KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKGZvbGRTdHlsZSAhPSAiYWxsIikKICAgICAgICAgICAgICAgICAgICByYW5nZSA9IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHJhbmdlOwogICAgICAgIH0KICAgICAgICBpZiAoZm9sZFN0eWxlID09PSAibWFya2JlZ2luIikKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIHZhciBtYXRjaCA9IGxpbmUubWF0Y2godGhpcy5mb2xkaW5nU3RvcE1hcmtlcik7CiAgICAgICAgaWYgKG1hdGNoKSB7CiAgICAgICAgICAgIHZhciBpID0gbWF0Y2guaW5kZXggKyBtYXRjaFswXS5sZW5ndGg7CiAgICAgICAgICAgIGlmIChtYXRjaFsxXSkKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNsb3NpbmdCcmFja2V0QmxvY2soc2Vzc2lvbiwgbWF0Y2hbMV0sIHJvdywgaSk7CiAgICAgICAgICAgIHJldHVybiBzZXNzaW9uLmdldENvbW1lbnRGb2xkUmFuZ2Uocm93LCBpLCAtMSk7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuZ2V0U2VjdGlvblJhbmdlID0gZnVuY3Rpb24gKHNlc3Npb24sIHJvdykgewogICAgICAgIHZhciBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgdmFyIHN0YXJ0SW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgdmFyIHN0YXJ0Um93ID0gcm93OwogICAgICAgIHZhciBzdGFydENvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIHJvdyA9IHJvdyArIDE7CiAgICAgICAgdmFyIGVuZFJvdyA9IHJvdzsKICAgICAgICB2YXIgbWF4Um93ID0gc2Vzc2lvbi5nZXRMZW5ndGgoKTsKICAgICAgICB3aGlsZSAoKytyb3cgPCBtYXhSb3cpIHsKICAgICAgICAgICAgbGluZSA9IHNlc3Npb24uZ2V0TGluZShyb3cpOwogICAgICAgICAgICB2YXIgaW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgICAgIGlmIChpbmRlbnQgPT09IC0xKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChzdGFydEluZGVudCA+IGluZGVudCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB2YXIgc3ViUmFuZ2UgPSB0aGlzLmdldEZvbGRXaWRnZXRSYW5nZShzZXNzaW9uLCAiYWxsIiwgcm93KTsKICAgICAgICAgICAgaWYgKHN1YlJhbmdlKSB7CiAgICAgICAgICAgICAgICBpZiAoc3ViUmFuZ2Uuc3RhcnQucm93IDw9IHN0YXJ0Um93KSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmIChzdWJSYW5nZS5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgcm93ID0gc3ViUmFuZ2UuZW5kLnJvdzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKHN0YXJ0SW5kZW50ID09IGluZGVudCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGVuZFJvdyA9IHJvdzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG5ldyBSYW5nZShzdGFydFJvdywgc3RhcnRDb2x1bW4sIGVuZFJvdywgc2Vzc2lvbi5nZXRMaW5lKGVuZFJvdykubGVuZ3RoKTsKICAgIH07CiAgICB0aGlzLmdldENvbW1lbnRSZWdpb25CbG9jayA9IGZ1bmN0aW9uIChzZXNzaW9uLCBsaW5lLCByb3cpIHsKICAgICAgICB2YXIgc3RhcnRDb2x1bW4gPSBsaW5lLnNlYXJjaCgvXHMqJC8pOwogICAgICAgIHZhciBtYXhSb3cgPSBzZXNzaW9uLmdldExlbmd0aCgpOwogICAgICAgIHZhciBzdGFydFJvdyA9IHJvdzsKICAgICAgICB2YXIgcmUgPSAvXlxzKig/OlwvXCp8XC9cL3wtLSkjPyhlbmQpP3JlZ2lvblxiLzsKICAgICAgICB2YXIgZGVwdGggPSAxOwogICAgICAgIHdoaWxlICgrK3JvdyA8IG1heFJvdykgewogICAgICAgICAgICBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgICAgIHZhciBtID0gcmUuZXhlYyhsaW5lKTsKICAgICAgICAgICAgaWYgKCFtKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChtWzFdKQogICAgICAgICAgICAgICAgZGVwdGgtLTsKICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgZGVwdGgrKzsKICAgICAgICAgICAgaWYgKCFkZXB0aCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICB2YXIgZW5kUm93ID0gcm93OwogICAgICAgIGlmIChlbmRSb3cgPiBzdGFydFJvdykgewogICAgICAgICAgICByZXR1cm4gbmV3IFJhbmdlK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JG91dGRlbnQuYXV0b091dGRlbnQoZG9jLCByb3cpOwogICAgfTsKICAgIHRoaXMuY3JlYXRlV29ya2VyID0gZnVuY3Rpb24gKHNlc3Npb24pIHsKICAgICAgICB2YXIgd29ya2VyID0gbmV3IFdvcmtlckNsaWVudChbImFjZSJdLCAiYWNlL21vZGUvanNvbl93b3JrZXIiLCAiSnNvbldvcmtlciIpOwogICAgICAgIHdvcmtlci5hdHRhY2hUb0RvY3VtZW50KHNlc3Npb24uZ2V0RG9jdW1lbnQoKSk7CiAgICAgICAgd29ya2VyLm9uKCJhbm5vdGF0ZSIsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIHNlc3Npb24uc2V0QW5ub3RhdGlvbnMoZS5kYXRhKTsKICAgICAgICB9KTsKICAgICAgICB3b3JrZXIub24oInRlcm1pbmF0ZSIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgc2Vzc2lvbi5jbGVhckFubm90YXRpb25zKCk7CiAgICAgICAgfSk7CiAgICAgICAgcmV0dXJuIHdvcmtlcjsKICAgIH07CiAgICB0aGlzLiRpZCA9ICJhY2UvbW9kZS9qc29uIjsKfSkuY2FsbChNb2RlLnByb3RvdHlwZSk7CmV4cG9ydHMuTW9kZSA9IE1vZGU7Cgp9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL21vZGUvanNvbiJdLCBmdW5jdGlvbihtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgbW9kdWxlID09ICJvYmplY3QiICYmIHR5cGVvZiBleHBvcnRzID09ICJvYmplY3QiICYmIG1vZHVsZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlLmV4cG9ydHMgPSBtOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KSgpOwogICAgICAgICAgICA=",workerJsonUrl="data:application/javascript;base64,Im5vIHVzZSBzdHJpY3QiOwohKGZ1bmN0aW9uKHdpbmRvdykgewppZiAodHlwZW9mIHdpbmRvdy53aW5kb3cgIT0gInVuZGVmaW5lZCIgJiYgd2luZG93LmRvY3VtZW50KQogICAgcmV0dXJuOwppZiAod2luZG93LnJlcXVpcmUgJiYgd2luZG93LmRlZmluZSkKICAgIHJldHVybjsKCmlmICghd2luZG93LmNvbnNvbGUpIHsKICAgIHdpbmRvdy5jb25zb2xlID0gZnVuY3Rpb24oKSB7CiAgICAgICAgdmFyIG1zZ3MgPSBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMsIDApOwogICAgICAgIHBvc3RNZXNzYWdlKHt0eXBlOiAibG9nIiwgZGF0YTogbXNnc30pOwogICAgfTsKICAgIHdpbmRvdy5jb25zb2xlLmVycm9yID0KICAgIHdpbmRvdy5jb25zb2xlLndhcm4gPSAKICAgIHdpbmRvdy5jb25zb2xlLmxvZyA9CiAgICB3aW5kb3cuY29uc29sZS50cmFjZSA9IHdpbmRvdy5jb25zb2xlOwp9CndpbmRvdy53aW5kb3cgPSB3aW5kb3c7CndpbmRvdy5hY2UgPSB3aW5kb3c7Cgp3aW5kb3cub25lcnJvciA9IGZ1bmN0aW9uKG1lc3NhZ2UsIGZpbGUsIGxpbmUsIGNvbCwgZXJyKSB7CiAgICBwb3N0TWVzc2FnZSh7dHlwZTogImVycm9yIiwgZGF0YTogewogICAgICAgIG1lc3NhZ2U6IG1lc3NhZ2UsCiAgICAgICAgZGF0YTogZXJyICYmIGVyci5kYXRhLAogICAgICAgIGZpbGU6IGZpbGUsCiAgICAgICAgbGluZTogbGluZSwgCiAgICAgICAgY29sOiBjb2wsCiAgICAgICAgc3RhY2s6IGVyciAmJiBlcnIuc3RhY2sKICAgIH19KTsKfTsKCndpbmRvdy5ub3JtYWxpemVNb2R1bGUgPSBmdW5jdGlvbihwYXJlbnRJZCwgbW9kdWxlTmFtZSkgewogICA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yZW4ndCBhY3R1YWwKICAgICAgICAgICAgICAgICAgICAvLyBkZXBlbmRlbmNpZXMsIHdlIG11c3QgaGFuZGxlIHRoZW0gc2VwZXJhdGVseS4KICAgICAgICAgICAgICAgICAgICBjYXNlICJyZXF1aXJlIjogcmV0dXJuIHJlcTsKICAgICAgICAgICAgICAgICAgICBjYXNlICJleHBvcnRzIjogcmV0dXJuIG1vZHVsZS5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgIGNhc2UgIm1vZHVsZSI6ICByZXR1cm4gbW9kdWxlOwogICAgICAgICAgICAgICAgICAgIC8vIEJ1dCBmb3IgYWxsIG90aGVyIGRlcGVuZGVuY2llcywgd2UgY2FuIGp1c3QgZ28gYWhlYWQgYW5kCiAgICAgICAgICAgICAgICAgICAgLy8gcmVxdWlyZSB0aGVtLgogICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6ICAgICAgICByZXR1cm4gcmVxKGRlcCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgaWYgKHJldHVybkV4cG9ydHMpCiAgICAgICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IHJldHVybkV4cG9ydHM7CiAgICAgICAgICAgIHJldHVybiBtb2R1bGU7CiAgICAgICAgfQogICAgfTsKfTsKd2luZG93LmRlZmluZS5hbWQgPSB7fTsKd2luZG93LnJlcXVpcmUudGxucyA9IHt9Owp3aW5kb3cuaW5pdEJhc2VVcmxzICA9IGZ1bmN0aW9uIGluaXRCYXNlVXJscyh0b3BMZXZlbE5hbWVzcGFjZXMpIHsKICAgIGZvciAodmFyIGkgaW4gdG9wTGV2ZWxOYW1lc3BhY2VzKQogICAgICAgIHRoaXMucmVxdWlyZS50bG5zW2ldID0gdG9wTGV2ZWxOYW1lc3BhY2VzW2ldOwp9OwoKd2luZG93LmluaXRTZW5kZXIgPSBmdW5jdGlvbiBpbml0U2VuZGVyKCkgewoKICAgIHZhciBFdmVudEVtaXR0ZXIgPSB3aW5kb3cucmVxdWlyZSgiYWNlL2xpYi9ldmVudF9lbWl0dGVyIikuRXZlbnRFbWl0dGVyOwogICAgdmFyIG9vcCA9IHdpbmRvdy5yZXF1aXJlKCJhY2UvbGliL29vcCIpOwogICAgCiAgICB2YXIgU2VuZGVyID0gZnVuY3Rpb24oKSB7fTsKICAgIAogICAgKGZ1bmN0aW9uKCkgewogICAgICAgIAogICAgICAgIG9vcC5pbXBsZW1lbnQodGhpcywgRXZlbnRFbWl0dGVyKTsKICAgICAgICAgICAgICAgIAogICAgICAgIHRoaXMuY2FsbGJhY2sgPSBmdW5jdGlvbihkYXRhLCBjYWxsYmFja0lkKSB7CiAgICAgICAgICAgIHBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIHR5cGU6ICJjYWxsIiwKICAgICAgICAgICAgICAgIGlkOiBjYWxsYmFja0lkLAogICAgICAgICAgICAgICAgZGF0YTogZGF0YQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgCiAgICAgICAgdGhpcy5lbWl0ID0gZnVuY3Rpb24obmFtZSwgZGF0YSkgewogICAgICAgICAgICBwb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICB0eXBlOiAiZXZlbnQiLAogICAgICAgICAgICAgICAgbmFtZTogbmFtZSwKICAgICAgICAgICAgICAgIGRhdGE6IGRhdGEKICAgICAgICAgICAgfSk7CiAgICAgICAgfTsKICAgICAgICAKICAgIH0pLmNhbGwoU2VuZGVyLnByb3RvdHlwZSk7CiAgICAKICAgIHJldHVybiBuZXcgU2VuZGVyKCk7Cn07Cgp2YXIgbWFpbiA9IHdpbmRvdy5tYWluID0gbnVsbDsKdmFyIHNlbmRlciA9IHdpbmRvdy5zZW5kZXIgPSBudWxsOwoKd2luZG93Lm9ubWVzc2FnZSA9IGZ1bmN0aW9uKGUpIHsKICAgIHZhciBtc2cgPSBlLmRhdGE7CiAgICBpZiAobXNnLmV2ZW50ICYmIHNlbmRlcikgewogICAgICAgIHNlbmRlci5fc2lnbm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0gZnVuY3Rpb24gKHJhbmdlKSB7CiAgICAgICAgcmV0dXJuIHRoaXMuc3RhcnQucm93ID09PSByYW5nZS5zdGFydC5yb3cgJiYKICAgICAgICAgICAgdGhpcy5lbmQucm93ID09PSByYW5nZS5lbmQucm93ICYmCiAgICAgICAgICAgIHRoaXMuc3RhcnQuY29sdW1uID09PSByYW5nZS5zdGFydC5jb2x1bW4gJiYKICAgICAgICAgICAgdGhpcy5lbmQuY29sdW1uID09PSByYW5nZS5lbmQuY29sdW1uOwogICAgfTsKICAgIHRoaXMudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgcmV0dXJuICgiUmFuZ2U6IFsiICsgdGhpcy5zdGFydC5yb3cgKyAiLyIgKyB0aGlzLnN0YXJ0LmNvbHVtbiArCiAgICAgICAgICAgICJdIC0+IFsiICsgdGhpcy5lbmQucm93ICsgIi8iICsgdGhpcy5lbmQuY29sdW1uICsgIl0iKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMDsKICAgIH07CiAgICB0aGlzLmNvbXBhcmVSYW5nZSA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAsIGVuZCA9IHJhbmdlLmVuZCwgc3RhcnQgPSByYW5nZS5zdGFydDsKICAgICAgICBjbXAgPSB0aGlzLmNvbXBhcmUoZW5kLnJvdywgZW5kLmNvbHVtbik7CiAgICAgICAgaWYgKGNtcCA9PSAxKSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSBpZiAoY21wID09IDApIHsKICAgICAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAoY21wID09IC0xKSB7CiAgICAgICAgICAgIHJldHVybiAtMjsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gLTEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDQyOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlUG9pbnQgPSBmdW5jdGlvbiAocCkgewogICAgICAgIHJldHVybiB0aGlzLmNvbXBhcmUocC5yb3csIHAuY29sdW1uKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zUmFuZ2UgPSBmdW5jdGlvbiAocmFuZ2UpIHsKICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlUG9pbnQocmFuZ2Uuc3RhcnQpID09IDAgJiYgdGhpcy5jb21wYXJlUG9pbnQocmFuZ2UuZW5kKSA9PSAwOwogICAgfTsKICAgIHRoaXMuaW50ZXJzZWN0cyA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAgPSB0aGlzLmNvbXBhcmVSYW5nZShyYW5nZSk7CiAgICAgICAgcmV0dXJuIChjbXAgPT0gLTEgfHwgY21wID09IDAgfHwgY21wID09IDEpOwogICAgfTsKICAgIHRoaXMuaXNFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4gdGhpcy5lbmQucm93ID09IHJvdyAmJiB0aGlzLmVuZC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuaXNTdGFydCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHJldHVybiB0aGlzLnN0YXJ0LnJvdyA9PSByb3cgJiYgdGhpcy5zdGFydC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuc2V0U3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IHJvdy5jb2x1bW47CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93LnJvdzsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5zZXRFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSByb3cuY29sdW1uOwogICAgICAgICAgICB0aGlzLmVuZC5yb3cgPSByb3cucm93OwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgdGhpcy5lbmQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSBjb2x1bW47CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuaW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc0VuZChyb3csIGNvbHVtbikgfHwgdGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlU3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodGhpcy5jb21wYXJlKHJvdywgY29sdW1uKSA9PSAwKSB7CiAgICAgICAgICAgIGlmICh0aGlzLmlzRW5kKHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlRW5kID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuY29tcGFyZSA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICghdGhpcy5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgIGlmIChyb3cgPT09IHRoaXMuc3RhcnQucm93KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gY29sdW1uIDwgdGhpcy5zdGFydC5jb2x1bW4gPyAtMSA6IChjb2x1bW4gPiB0aGlzLmVuZC5jb2x1bW4gPyAxIDogMCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuc3RhcnQucm93KQogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHJvdyA+IHRoaXMuZW5kLnJvdykKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09PSByb3cpCiAgICAgICAgICAgIHJldHVybiBjb2x1bW4gPj0gdGhpcy5zdGFydC5jb2x1bW4gPyAwIDogLTE7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PT0gcm93KQogICAgICAgICAgICByZXR1cm4gY29sdW1uIDw9IHRoaXMuZW5kLmNvbHVtbiA/IDAgOiAxOwogICAgICAgIHJldHVybiAwOwogICAgfTsKICAgIHRoaXMuY29tcGFyZVN0YXJ0ID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09IHJvdyAmJiB0aGlzLnN0YXJ0LmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbik7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuY29tcGFyZUVuZCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPT0gcm93ICYmIHRoaXMuZW5kLmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlSW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PSByb3cgJiYgdGhpcy5lbmQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAodGhpcy5zdGFydC5yb3cgPT0gcm93ICYmIHRoaXMuc3RhcnQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jbGlwUm93cyA9IGZ1bmN0aW9uIChmaXJzdFJvdywgbGFzdFJvdykgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPiBsYXN0Um93KQogICAgICAgICAgICB2YXIgZW5kID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLmVuZC5yb3cgPCBmaXJzdFJvdykKICAgICAgICAgICAgdmFyIGVuZCA9IHsgcm93OiBmaXJzdFJvdywgY29sdW1uOiAwIH07CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID4gbGFzdFJvdykKICAgICAgICAgICAgdmFyIHN0YXJ0ID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLnN0YXJ0LnJvdyA8IGZpcnN0Um93KQogICAgICAgICAgICB2YXIgc3RhcnQgPSB7IHJvdzogZmlyc3RSb3csIGNvbHVtbjogMCB9OwogICAgICAgIHJldHVybiBSYW5nZS5mcm9tUG9pbnRzKHN0YXJ0IHx8IHRoaXMuc3RhcnQsIGVuZCB8fCB0aGlzLmVuZCk7CiAgICB9OwogICAgdGhpcy5leHRlbmQgPSBmdW5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AxIDogLTEpICogKGRlbHRhLmVuZC5jb2x1bW4gLSBkZWx0YS5zdGFydC5jb2x1bW4pOwogICAgICAgIHZhciBkZWx0YVN0YXJ0ID0gZGVsdGEuc3RhcnQ7CiAgICAgICAgdmFyIGRlbHRhRW5kID0gZGVsdGFJc0luc2VydCA/IGRlbHRhU3RhcnQgOiBkZWx0YS5lbmQ7IC8vIENvbGxhcHNlIGluc2VydCByYW5nZS4KICAgICAgICBpZiAoJHBvaW50c0luT3JkZXIocG9pbnQsIGRlbHRhU3RhcnQsIG1vdmVJZkVxdWFsKSkgewogICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgcm93OiBwb2ludC5yb3csCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbgogICAgICAgICAgICB9OwogICAgICAgIH0KICAgICAgICBpZiAoJHBvaW50c0luT3JkZXIoZGVsdGFFbmQsIHBvaW50LCAhbW92ZUlmRXF1YWwpKSB7CiAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICByb3c6IHBvaW50LnJvdyArIGRlbHRhUm93U2hpZnQsCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbiArIChwb2ludC5yb3cgPT0gZGVsdGFFbmQucm93ID8gZGVsdGFDb2xTaGlmdCA6IDApCiAgICAgICAgICAgIH07CiAgICAgICAgfQogICAgICAgIHJldHVybiB7CiAgICAgICAgICAgIHJvdzogZGVsdGFTdGFydC5yb3csCiAgICAgICAgICAgIGNvbHVtbjogZGVsdGFTdGFydC5jb2x1bW4KICAgICAgICB9OwogICAgfQogICAgdGhpcy5zZXRQb3NpdGlvbiA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbiwgbm9DbGlwKSB7CiAgICAgICAgdmFyIHBvczsKICAgICAgICBpZiAobm9DbGlwKSB7CiAgICAgICAgICAgIHBvcyA9IHsKICAgICAgICAgICAgICAgIHJvdzogcm93LAogICAgICAgICAgICAgICAgY29sdW1uOiBjb2x1bW4KICAgICAgICAgICAgfTsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHBvcyA9IHRoaXMuJGNsaXBQb3NpdGlvblRvRG9jdW1lbnQocm93LCBjb2x1bW4pOwogICAgICAgIH0KICAgICAgICBpZiAodGhpcy5yb3cgPT0gcG9zLnJvdyAmJiB0aGlzLmNvbHVtbiA9PSBwb3MuY29sdW1uKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgdmFyIG9sZCA9IHsKICAgICAgICAgICAgcm93OiB0aGlzLnJvdywKICAgICAgICAgICAgY29sdW1uOiB0aGlzLmNvbHVtbgogICAgICAgIH07CiAgICAgICAgdGhpcy5yb3cgPSBwb3Mucm93OwogICAgICAgIHRoaXMuY29sdW1uID0gcG9zLmNvbHVtbjsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZSIsIHsKICAgICAgICAgICAgb2xkOiBvbGQsCiAgICAgICAgICAgIHZhbHVlOiBwb3MKICAgICAgICB9KTsKICAgIH07CiAgICB0aGlzLmRldGFjaCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICB0aGlzLmRvY3VtZW50Lm9mZigiY2hhbmdlIiwgdGhpcy4kb25DaGFuZ2UpOwogICAgfTsKICAgIHRoaXMuYXR0YWNoID0gZnVuY3Rpb24gKGRvYykgewogICAgICAgIHRoaXMuZG9jdW1lbnQgPSBkb2MgfHwgdGhpcy5kb2N1bWVudDsKICAgICAgICB0aGlzLmRvY3VtZW50Lm9uKCJjaGFuZ2UiLCB0aGlzLiRvbkNoYW5nZSk7CiAgICB9OwogICAgdGhpcy4kY2xpcFBvc2l0aW9uVG9Eb2N1bWVudCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHZhciBwb3MgPSB7fTsKICAgICAgICBpZiAocm93ID49IHRoaXMuZG9jdW1lbnQuZ2V0TGVuZ3RoKCkpIHsKICAgICAgICAgICAgcG9zLnJvdyA9IE1hdGgubWF4KDAsIHRoaXMuZG9jdW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sYWNlKC9cclxufFxyL2csICJcbiIpLnNwbGl0KCJcbiIpOwogICAgICAgIH07CiAgICB9CiAgICBlbHNlIHsKICAgICAgICB0aGlzLiRzcGxpdCA9IGZ1bmN0aW9uICh0ZXh0KSB7CiAgICAgICAgICAgIHJldHVybiB0ZXh0LnNwbGl0KC9cclxufFxyfFxuLyk7CiAgICAgICAgfTsKICAgIH0KICAgIHRoaXMuJGRldGVjdE5ld0xpbmUgPSBmdW5jdGlvbiAodGV4dCkgewogICAgICAgIHZhciBtYXRjaCA9IHRleHQubWF0Y2goL14uKj8oXHJcbnxccnxcbikvbSk7CiAgICAgICAgdGhpcy4kYXV0b05ld0xpbmUgPSBtYXRjaCA/IG1hdGNoWzFdIDogIlxuIjsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lQ2hhcmFjdGVyID0gZnVuY3Rpb24gKCkgewogICAgICAgIHN3aXRjaCAodGhpcy4kbmV3TGluZU1vZGUpIHsKICAgICAgICAgICAgY2FzZSAid2luZG93cyI6CiAgICAgICAgICAgICAgICByZXR1cm4gIlxyXG4iOwogICAgICAgICAgICBjYXNlICJ1bml4IjoKICAgICAgICAgICAgICAgIHJldHVybiAiXG4iOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuJGF1dG9OZXdMaW5lIHx8ICJcbiI7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuJGF1dG9OZXdMaW5lID0gIiI7CiAgICB0aGlzLiRuZXdMaW5lTW9kZSA9ICJhdXRvIjsKICAgIHRoaXMuc2V0TmV3TGluZU1vZGUgPSBmdW5jdGlvbiAobmV3TGluZU1vZGUpIHsKICAgICAgICBpZiAodGhpcy4kbmV3TGluZU1vZGUgPT09IG5ld0xpbmVNb2RlKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgdGhpcy4kbmV3TGluZU1vZGUgPSBuZ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iBbdGV4dF0KICAgICAgICB9LCB0cnVlKTsKICAgICAgICByZXR1cm4gdGhpcy5jbG9uZVBvcyhlbmQpOwogICAgfTsKICAgIHRoaXMuY2xpcHBlZFBvcyA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHZhciBsZW5ndGggPSB0aGlzLmdldExlbmd0aCgpOwogICAgICAgIGlmIChyb3cgPT09IHVuZGVmaW5lZCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGg7CiAgICAgICAgfQogICAgICAgIGVsc2UgaWYgKHJvdyA8IDApIHsKICAgICAgICAgICAgcm93ID0gMDsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAocm93ID49IGxlbmd0aCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGggLSAxOwogICAgICAgICAgICBjb2x1bW4gPSB1bmRlZmluZWQ7CiAgICAgICAgfQogICAgICAgIHZhciBsaW5lID0gdGhpcy5nZXRMaW5lKHJvdyk7CiAgICAgICAgaWYgKGNvbHVtbiA9PSB1bmRlZmluZWQpCiAgICAgICAgICAgIGNvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIGNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KGNvbHVtbiwgMCksIGxpbmUubGVuZ3RoKTsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLmNsb25lUG9zID0gZnVuY3Rpb24gKHBvcykgewogICAgICAgIHJldHVybiB7IHJvdzogcG9zLnJvdywgY29sdW1uOiBwb3MuY29sdW1uIH07CiAgICB9OwogICAgdGhpcy5wb3MgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLiRjbGlwUG9zaXRpb24gPSBmdW5jdGlvbiAocG9zaXRpb24pIHsKICAgICAgICB2YXIgbGVuZ3RoID0gdGhpcy5nZXRMZW5ndGgoKTsKICAgICAgICBpZiAocG9zaXRpb24ucm93ID49IGxlbmd0aCkgewogICAgICAgICAgICBwb3NpdGlvbi5yb3cgPSBNYXRoLm1heCgwLCBsZW5ndGggLSAxKTsKICAgICAgICAgICAgcG9zaXRpb24uY29sdW1uID0gdGhpcy5nZXRMaW5lKGxlbmd0aCAtIDEpLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHBvc2l0aW9uLnJvdyA9IE1hdGgubWF4KDAsIHBvc2l0aW9uLnJvdyk7CiAgICAgICAgICAgIHBvc2l0aW9uLmNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KHBvc2l0aW9uLmNvbHVtbiwgMCksIHRoaXMuZ2V0TGluZShwb3NpdGlvbi5yb3cpLmxlbmd0aCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBwb3NpdGlvbjsKICAgIH07CiAgICB0aGlzLmluc2VydEZ1bGxMaW5lcyA9IGZ1bmN0aW9uIChyb3csIGxpbmVzKSB7CiAgICAgICAgcm93ID0gTWF0aC5taW4oTWF0aC5tYXgocm93LCAwKSwgdGhpcy5nZXRMZW5ndGgoKSk7CiAgICAgICAgdmFyIGNvbHVtbiA9IDA7CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuZ2V0TGVuZ3RoKCkpIHsKICAgICAgICAgICAgbGluZXMgPSBsaW5lcy5jb25jYXQoWyIiXSk7CiAgICAgICAgICAgIGNvbHVtbiA9IDA7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICBsaW5lcyA9IFsiIl0uY29uY2F0KGxpbmVzKTsKICAgICAgICAgICAgcm93LS07CiAgICAgICAgICAgIGNvbHVtbiA9IHRoaXMuJGxpbmVzW3Jvd10ubGVuZ3RoOwogICAgICAgIH0KICAgICAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzKHsgcm93OiByb3csIGNvbHVtbjogY29sdW1uIH0sIGxpbmVzKTsKICAgIH07CiAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzID0gZnVuY3Rpb24gKHBvc2l0aW9uLCBsaW5lcykgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhwb3NpdGlvbi5yb3csIHBvc2l0aW9uLmNvbHVtbik7CiAgICAgICAgdmFyIGVuZCA9IHsKICAgICAgICAgICAgcm93OiBzdGFydC5yb3cgKyBsaW5lcy5sZW5ndGggLSAxLAogICAgICAgICAgICBjb2x1bW46IChsaW5lcy5sZW5ndGggPT0gMSA/IHN0YXJ0LmNvbHVtbiA6IDApICsgbGluZXNbbGluZXMubGVuZ3RoIC0gMV0ubGVuZ3RoCiAgICAgICAgfTsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoewogICAgICAgICAgICBzdGFydDogc3RhcnQsCiAgICAgICAgICAgIGVuZDogZW5kLAogICAgICAgICAgICBhY3Rpb246ICJpbnNlcnQiLAogICAgICAgICAgICBsaW5lczogbGluZXMKICAgICAgICB9KTsKICAgICAgICByZXR1cm4gdGhpcy5jbG9uZVBvcyhlbmQpOwogICAgfTsKICAgIHRoaXMucmVtb3ZlID0gZnVuY3Rpb24gKHJhbmdlKSB7CiAgICAgICAgdmFyIHN0YXJ0ID0gdGhpcy5jbGlwcGVkUG9zKHJhbmdlLnN0YXJ0LnJvdywgcmFuZ2Uuc3RhcnQuY29sdW1uKTsKICAgICAgICB2YXIgZW5kID0gdGhpcy5jbGlwcGVkUG9zKHJhbmdlLmVuZC5yb3csIHJhbmdlLmVuZC5jb2x1bW4pOwogICAgICAgIHRoaXMuYXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCwKICAgICAgICAgICAgZW5kOiBlbmQsCiAgICAgICAgICAgIGFjdGlvbjogInJlbW92ZSIsCiAgICAgICAgICAgIGxpbmVzOiB0aGlzLmdldExpbmVzRm9yUmFuZ2UoeyBzdGFydDogc3RhcnQsIGVuZDogZW5kIH0pCiAgICAgICAgfSk7CiAg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J0IiAmJiBkZWx0YS5zdGFydC5yb3cgPD0gZG9jTGVuZ3RoKSB7CiAgICAgICAgICAgIHRoaXMuYXBwbHlEZWx0YShkZWx0YSk7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuJHNwbGl0QW5kYXBwbHlMYXJnZURlbHRhID0gZnVuY3Rpb24gKGRlbHRhLCBNQVgpIHsKICAgICAgICB2YXIgbGluZXMgPSBkZWx0YS5saW5lczsKICAgICAgICB2YXIgbCA9IGxpbmVzLmxlbmd0aCAtIE1BWCArIDE7CiAgICAgICAgdmFyIHJvdyA9IGRlbHRhLnN0YXJ0LnJvdzsKICAgICAgICB2YXIgY29sdW1uID0gZGVsdGEuc3RhcnQuY29sdW1uOwogICAgICAgIGZvciAodmFyIGZyb20gPSAwLCB0byA9IDA7IGZyb20gPCBsOyBmcm9tID0gdG8pIHsKICAgICAgICAgICAgdG8gKz0gTUFYIC0gMTsKICAgICAgICAgICAgdmFyIGNodW5rID0gbGluZXMuc2xpY2UoZnJvbSwgdG8pOwogICAgICAgICAgICBjaHVuay5wdXNoKCIiKTsKICAgICAgICAgICAgdGhpcy5hcHBseURlbHRhKHsKICAgICAgICAgICAgICAgIHN0YXJ0OiB0aGlzLnBvcyhyb3cgKyBmcm9tLCBjb2x1bW4pLAogICAgICAgICAgICAgICAgZW5kOiB0aGlzLnBvcyhyb3cgKyB0bywgY29sdW1uID0gMCksCiAgICAgICAgICAgICAgICBhY3Rpb246IGRlbHRhLmFjdGlvbiwKICAgICAgICAgICAgICAgIGxpbmVzOiBjaHVuawogICAgICAgICAgICB9LCB0cnVlKTsKICAgICAgICB9CiAgICAgICAgZGVsdGEubGluZXMgPSBsaW5lcy5zbGljZShmcm9tKTsKICAgICAgICBkZWx0YS5zdGFydC5yb3cgPSByb3cgKyBmcm9tOwogICAgICAgIGRlbHRhLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoZGVsdGEsIHRydWUpOwogIC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sKICAgIHZhciBjb3B5OwogICAgaWYgKEFycmF5LmlzQXJyYXkob2JqKSkgewogICAgICAgIGNvcHkgPSBbXTsKICAgICAgICBmb3IgKHZhciBrZXkgPSAwOyBrZXkgPCBvYmoubGVuZ3RoOyBrZXkrKykgewogICAgICAgICAgICBjb3B5W2tleV0gPSBkZWVwQ29weShvYmpba2V5XSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBjb3B5OwogICAgfQogICAgaWYgKE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChvYmopICE9PSAiW29iamVjdCBPYmplY3RdIikKICAgICAgICByZXR1cm4gb2JqOwogICAgY29weSA9IHt9OwogICAgZm9yICh2YXIga2V5IGluIG9iaikKICAgICAgICBjb3B5W2tleV0gPSBkZWVwQ29weShvYmpba2V5XSk7CiAgICByZXR1cm4gY29weTsKfTsKZXhwb3J0cy5hcnJheVRvTWFwID0gZnVuY3Rpb24gKGFycikgewogICAgdmFyIG1hcCA9IHt9OwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHsKICAgICAgICBtYXBbYXJyW2ldXSA9IDE7CiAgICB9CiAgICByZXR1cm4gbWFwOwp9OwpleHBvcnRzLmNyZWF0ZU1hcCA9IGZ1bmN0aW9uIChwcm9wcykgewogICAgdmFyIG1hcCA9IE9iamVjdC5jcmVhdGUobnVsbCk7CiAgICBmb3IgKHZhciBpIGluIHByb3BzKSB7CiAgICAgICAgbWFwW2ldID0gcHJvcHNbaV07CiAgICB9CiAgICByZXR1cm4gbWFwOwp9OwpleHBvcnRzLmFycmF5UmVtb3ZlID0gZnVuY3Rpb24gKGFycmF5LCB2YWx1ZSkgewogICAgZm9yICh2YXIgaSA9IDA7IGkgPD0gYXJyYXkubGVuZ3RoOyBpKyspIHsKICAgICAgICBpZiAodmFsdWUgPT09IGFycmF5W2ldKSB7CiAgICAgICAgICAgIGFycmF5LnNwbGljZShpLCAxKTsKICAgICAgICB9CiAgICB9C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gaSA9IDA7IGkgPCBkYXRhLmxlbmd0aDsgaSArPSAyKSB7CiAgICAgICAgICAgICAgICB2YXIgZCwgZXJyOyAKICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGRhdGFbaSsxXSkpIHsKICAgICAgICAgICAgICAgICAgICBkID0ge2FjdGlvbjogImluc2VydCIsIHN0YXJ0OiBkYXRhW2ldLCBsaW5lczogZGF0YVtpKzFdfTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgZCA9IHthY3Rpb246ICJyZW1vdmUiLCBzdGFydDogZGF0YVtpXSwgZW5kOiBkYXRhW2krMV19OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBpZiAoKGQuYWN0aW9uID09ICJpbnNlcnQiID8gZC5zdGFydCA6IGQuZW5kKS5yb3cgPj0gZG9jLiRsaW5lcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICBlcnIgPSBuZXcgRXJyb3IoIkludmFsaWQgZGVsdGEiKTsKICAgICAgICAgICAgICAgICAgICBlcnIuZGF0YSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogX3NlbGYuJHBhdGgsCiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzTGVuZ3RoOiBkb2MuJGxpbmVzLmxlbmd0aCwKICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQ6IGQuc3RhcnQsCiAgICAgICAgICAgICAgICAgICAgICAgIGVuZDogZC5lbmQKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHRocm93IGVycjsKICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICBkb2MuYXBwbHlEZWx0YShkLCB0cnVlKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoX3NlbGYuJHRpbWVvdXQpCiAgICAgICAgICAgIHJldHVybiBkZWZlcnJlZFVwZGF0ZS5zY2hlZHVs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SB7CiAgICAgICAgICAgICciJzogICciJywKICAgICAgICAgICAgJ1xcJzogJ1xcJywKICAgICAgICAgICAgJy8nOiAgJy8nLAogICAgICAgICAgICBiOiAgICAnXGInLAogICAgICAgICAgICBmOiAgICAnXGYnLAogICAgICAgICAgICBuOiAgICAnXG4nLAogICAgICAgICAgICByOiAgICAnXHInLAogICAgICAgICAgICB0OiAgICAnXHQnCiAgICAgICAgfSwKICAgICAgICB0ZXh0LAoKICAgICAgICBlcnJvciA9IGZ1bmN0aW9uIChtKSB7CgogICAgICAgICAgICB0aHJvdyB7CiAgICAgICAgICAgICAgICBuYW1lOiAgICAnU3ludGF4RXJyb3InLAogICAgICAgICAgICAgICAgbWVzc2FnZTogbSwKICAgICAgICAgICAgICAgIGF0OiAgICAgIGF0LAogICAgICAgICAgICAgICAgdGV4dDogICAgdGV4dAogICAgICAgICAgICB9OwogICAgICAgIH0sCgogICAgICAgIG5leHQgPSBmdW5jdGlvbiAoYykgewoKICAgICAgICAgICAgaWYgKGMgJiYgYyAhPT0gY2gpIHsKICAgICAgICAgICAgICAgIGVycm9yKCJFeHBlY3RlZCAnIiArIGMgKyAiJyBpbnN0ZWFkIG9mICciICsgY2ggKyAiJyIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBjaCA9IHRleHQuY2hhckF0KGF0KTsKICAgICAgICAgICAgYXQgKz0gMTsKICAgICAgICAgICAgcmV0dXJuIGNoOwogICAgICAgIH0sCgogICAgICAgIG51bWJlciA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHZhciBudW1iZXIsCiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnJzsKCiAgICAgICAgICAgIGlmIChjaCA9PT0gJy0nKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnLSc7CiAgICAgICAgICAgICAgICBuZXh0KCctJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgd2hpbGUgKGNoID49ICcwJyAmJiBjaCA8PSAnOScpIHsKICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICcuJykgewogICAgICAgICAgICAgICAgc3RyaW5nICs9ICcuJzsKICAgICAgICAgICAgICAgIHdoaWxlIChuZXh0KCkgJiYgY2ggPj0gJzAnICYmIGNoIDw9ICc5JykgewogICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICdlJyB8fCBjaCA9PT0gJ0UnKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgKz0gY2g7CiAgICAgICAgICAgICAgICBuZXh0KCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICctJyB8fCBjaCA9PT0gJysnKSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHdoaWxlIChjaCA+PSAnMCcgJiYgY2ggPD0gJzknKSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBudW1iZXIgPSArc3RyaW5nOwogICAgICAgICAgICBpZiAoaXNOYU4obnVtYmVyKSkgewogICAgICAgICAgICAgICAgZXJyb3IoIkJhZCBudW1iZXIiKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHJldHVybiBudW1iZXI7CiAgICAgICAgICAgIH0KICAgICAgICB9LAoKICAgICAgICBzdHJpbmcgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICB2YXIgaGV4LAogICAgICAgICAgICAgICAgaSwKICAgICAgICAgICAgICAgIHN0cmluZyA9ICcnLAogICAgICAgICAgICAgICAgdWZmZmY7CgogICAgICAgICAgICBpZiAoY2ggPT09ICciJykgewogICAgICAgICAgICAgICAgd2hpbGUgKG5leHQoKSkgewogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJyInKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0cmluZzsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAnXFwnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoID09PSAndScpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVmZmZmID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCA0OyBpICs9IDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXggPSBwYXJzZUludChuZXh0KCksIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzRmluaXRlKGhleCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVmZmZmID0gdWZmZmYgKiAxNiArIGhleDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKHVmZmZmKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgZXNjYXBlZVtjaF0gPT09ICdzdHJpbmcnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgKz0gZXNjYXBlZVtjaF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT0gIlxuIiB8fCBjaCA9PSAiXHIiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXJyb3IoIkJhZCBzdHJpbmciKTsKICAgICAgICB9LAoKICAgICAgICB3aGl0ZSA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHdoaWxlIChjaCAmJiBjaCA8PSAnICcpIHsKICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgfQogICAgICAgIH0sCgogICAgICAgIHdvcmQgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICBzd2l0Y2ggKGNoKSB7CiAgICAgICAgICAgIGNhc2UgJ3QnOgogICAgICAgICAgICAgICAgbmV4dCgndCcpOwogICAgICAgICAgICAgICAgbmV4dCgncicpOwogICAgICAgICAgICAgICAgbmV4dCgndScpOwogICAgICAgICAgICAgICAgbmV4dCgnZScpOwogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIGNhc2UgJ2YnOgogICAgICAgICAgICAgICAgbmV4dCgnZicpOwogICAgICAgICAgICAgICAgbmV4dCgnYScpOwogICAgICAgICAgICAgICAgbmV4dCgnbCcpOwogICAgICAgICAgICAgICAgbmV4dCgncycpOwogICAgICAgICAgICAgICAgbmV4dCgnZScpOwogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICBjYXNlICduJzoKICAgICAgICAgICAgICAgIG5leHQoJ24nKTsKICAgICAgICAgICAgICAgIG5leHQoJ3UnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2wnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2wnKTsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVycm9yKCJVbmV4cGVjdGVkICciICsgY2ggKyAiJyIpOwogICAgICAgIH0sCgogICAgICAgIHZhbHVlLCAgLy8gUGxhY2UgaG9sZGVyIGZvciB0aGUgdmFsdWUgZnVuY3Rpb24uCgogICAgICAgIGFycmF5ID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgdmFyIGFycmF5ID0gW107CgogICAgICAgICAgICBpZiAoY2ggPT09ICdbJykgewogICAgICAgICAgICAgICAgbmV4dCgnWycpOwogICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnXScpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhcnJheTsgICAvLyBlbXB0eSBhcnJheQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGNoKSB7CiAgICAgICAgICAgICAgICAgICAgYXJyYXkucHVzaCh2YWx1ZSgpKTsKICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoJ10nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFycmF5OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBuZXh0KCcsJyk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBlcnJvcigiQmFkIGFycmF5Iik7CiAgICAgICAgfSwKCiAgICAgICAgb2JqZWN0ID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgdmFyIGtleSwKICAgICAgICAgICAgICAgIG9iamVjdCA9IHt9OwoKICAgICAgICAgICAgaWYgKGNoID09PSAneycpIHsKICAgICAgICAgICAgICAgIG5leHQoJ3snKTsKICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICd9JykgewogICAgICAgICAgICAgICAgICAgIG5leHQoJ30nKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gb2JqZWN0OyAgIC8vIGVtcHR5IG9iamVjdAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGNoKSB7CiAgICAgICAgICAgICAgICAgICAga2V5ID0gc3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgICAgICBuZXh0KCc6Jyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iamVjdCwga2V5KSkgewogICAgICAgICAgICAgICAgICAgICAgICBlcnJvcignRHVwbGljYXRlIGtleSAiJyArIGtleSArICciJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIG9iamVjdFtrZXldID0gdmFsdWUoKTsKICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ30nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoJ30nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9iamVjdDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnLCcpOwogICAgICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXJyb3IoIkJhZCBvYmplY3QiKTsKICAgICAgICB9OwoKICAgIHZhbHVlID0gZnVuY3Rpb24gKCkgewoKICAgICAgICB3aGl0ZSgpOwogICAgICAgIHN3aXRjaCAoY2gpIHsKICAgICAgICBjYXNlICd7JzoKICAgICAgICAgICAgcmV0dXJuIG9iamVjdCgpOwogICAgICAgIGNhc2UgJ1snOgogICAgICAgICAgICByZXR1cm4gYXJyYXkoKTsKICAgICAgICBjYXNlICciJzoKICAgICAgICAgICAgcmV0dXJuIHN0cmluZygpOwogICAgICAgIGNhc2UgJy0nOgogICAgICAgICAgICByZXR1cm4gbnVtYmVyKCk7CiAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgcmV0dXJuIGNoID49ICcwJyAmJiBjaCA8PSAnOScgPyBudW1iZXIoKSA6IHdvcmQoKTsKICAgICAgICB9CiAgICB9OwoKICAgIHJldHVybiBmdW5jdGlvbiAoc291cmNlLCByZXZpdmVyKSB7CiAgICAgICAgdmFyIHJlc3VsdDsKCiAgICAgICAgdGV4dCA9IHNvdXJjZTsKICAgICAgICBhdCA9IDA7CiAgICAgICAgY2ggPSAnICc7CiAgICAgICAgcmVzdWx0ID0gdmFsdWUoKTsKICAgICAgICB3aGl0ZSgpOwogICAgICAgIGlmIChjaCkgewogICAgICAgICAgICBlcnJvcigiU3ludGF4IGVycm9yIik7CiAgICAgICAgfQoKICAgICAgICByZXR1cm4gdHlwZW9mIHJldml2ZXIgPT09ICdmdW5jdGlvbicgPyBmdW5jdGlvbiB3YWxrKGhvbGRlciwga2V5KSB7CiAgICAgICAgICAgIHZhciBrLCB2LCB2YWx1ZSA9IGhvbGRlcltrZXldOwogICAgICAgICAgICBpZiAodmFsdWUgJiYgdHlwZW9mIHZhbHVlID09PSAnb2JqZWN0JykgewogICAgICAgICAgICAgICAgZm9yIChrIGluIHZhbHVlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKHZhbHVlLCBrKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2ID0gd2Fsayh2YWx1ZSwgayk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2ICE9PSB1bmRlZmluZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlW2tdID0gdjsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB2YWx1ZVtrXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gcmV2aXZlci5jYWxsKGhvbGRlciwga2V5LCB2YWx1ZSk7CiAgICAgICAgfSh7Jyc6IHJlc3VsdH0sICcnKSA6IHJlc3VsdDsKICAgIH07Cn0pOwoKYWNlLmRlZmluZSgiYWNlL21vZGUvanNvbl93b3JrZXIiLFtdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpIHsKInVzZSBzdHJpY3QiOwoKdmFyIG9vcCA9IHJlcXVpcmUoIi4uL2xpYi9vb3AiKTsKdmFyIE1pcnJvciA9IHJlcXVpcmUoIi4uL3dvcmtlci9taXJyb3IiKS5NaXJyb3I7CnZhciBwYXJzZSA9IHJlcXVpcmUoIi4vanNvbi9qc29uX3BhcnNlIik7Cgp2YXIgSnNvbldvcmtlciA9IGV4cG9ydHMuSnNvbldvcmtlciA9IGZ1bmN0aW9uKHNlbmRlcikgewogICAgTWlycm9yLmNhbGwodGhpcywgc2VuZGVyKTsKICAgIHRoaXMuc2V0VGltZW91dCgyMDApOwp9OwoKb29wLmluaGVyaXRzKEpzb25Xb3JrZXIsIE1pcnJvcik7CgooZnVuY3Rpb24oKSB7CgogICAgdGhpcy5vblVwZGF0ZSA9IGZ1bmN0aW9uKCkgewogICAgICAgIHZhciB2YWx1ZSA9IHRoaXMuZG9jLmdldFZhbHVlKCk7CiAgICAgICAgdmFyIGVycm9ycyA9IFtdOwogICAgICAgIHRyeSB7CiAgICAgICAgICAgIGlmICh2YWx1ZSkKICAgICAgICAgICAgICAgIHBhcnNlKHZhbHVlKTsKICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgIHZhciBwb3MgPSB0aGlzLmRvYy5pbmRleFRvUG9zaXRpb24oZS5hdC0xKTsKICAgICAgICAgICAgZXJyb3JzLnB1c2goewogICAgICAgICAgICAgICAgcm93OiBwb3Mucm93LAogICAgICAgICAgICAgICAgY29sdW1uOiBwb3MuY29sdW1uLAogICAgICAgICAgICAgICAgdGV4dDogZS5tZXNzYWdlLAogICAgICAgICAgICAgICAgdHlwZTogImVycm9yIgogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgdGhpcy5zZW5kZXIuZW1pdCgiYW5ub3RhdGUiLCBlcnJvcnMpOwogICAgfTsKCn0pLmNhbGwoSnNvbldvcmtlci5wcm90b3R5cGUpOwoKfSk7Cg==";ace.config.setModuleUrl("ace/theme/kr_theme",themeUrl2),ace.config.setModuleUrl("ace/mode/json",modeJsonUrl),ace.config.setModuleUrl("ace/mode/json_worker",workerJsonUrl);const _sfc_main$x=vue.defineComponent({__name:"code-edit-modal",props:{modelValue:{default:()=>({})},lang:{default:"json"},title:{default:"编辑"}},emits:["update:modelValue","close"],setup(i,{emit:r}){const n=i,o=vue.ref(!1),a=r,u=vue.computed({get(){return n.lang==="json"?JSON.stringify(n.modelValue,null,2):n.modelValue},set(c){n.lang==="json"?a("update:modelValue",JSON.parse(c)):a("update:modelValue",c)}});return(c,d)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElButton),{onClick:d[0]||(d[0]=f=>o.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("···")]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDialog),{class:"modal-full",modelValue:vue.unref(o),"onUpdate:modelValue":d[2]||(d[2]=f=>vue.isRef(o)?o.value=f:null),title:n.title,width:"60%",onClose:d[3]||(d[3]=f=>a("close"))},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(VAceEditor),{value:vue.unref(u),"onUpdate:value":d[1]||(d[1]=f=>vue.isRef(u)?u.value=f:null),lang:n.lang,theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value","lang"])]),_:1},8,["modelValue","title"])]))}}),_hoisted_1$7={class:"one-row-txt",style:{width:"78px"}},_hoisted_2$5={key:1},_hoisted_3$4={class:"one-row-txt",style:{width:"145px"}},_hoisted_4$2={key:1},_sfc_main$w=vue.defineComponent({__name:"dynamic-el-form-item",props:{objInfo:{default:()=>({})},hide:{default:()=>[]},code:{type:Boolean,default:!1}},emits:["change"],setup(i,{emit:r}){const n=r,o=i,a=vue.computed(()=>{var h;const c={};let d=0,f=[];for(let y of Object.keys(o.objInfo)){const g=(h=o.objInfo[y])==null?void 0:h.sort;if(g){const p=Number(g);p>d&&(d=p)}if(g)c[g]=y;else return Object.keys(o.objInfo).map(p=>({...o.objInfo[p],_key:p}))}for(let y=0;y<d+1;y++){const g=String(y);f.push({...o.objInfo[c[g]],_key:c[g]})}return f});function u(c){let d=window.setTimeout(function(){n("change",c),clearTimeout(d),d=null},200)}return(c,d)=>(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(a),f=>(vue.openBlock(),vue.createElementBlock("div",{key:f._key},[o.code?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,class:"props-row",size:"small"},{label:vue.withCtx(()=>[vue.unref(getStringWidth)(String(f._key))>78?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:String(f._key),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$7,vue.toDisplayString(f._key),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$5,vue.toDisplayString(f._key),1))]),default:vue.withCtx(()=>[vue.unref(getStringWidth)(String(f.val))>145?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:JSON.stringify(f.val),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$4,vue.toDisplayString(f.val),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$2,vue.toDisplayString(f.val),1))]),_:2},1024)):vue.createCommentVNode("",!0),o.hide.indexOf(String(f._key))<0?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:1,label:f.title,size:"small"},{default:vue.withCtx(()=>[f.type===vue.unref(EConfigItemPropsType).Select?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSelect),{key:0,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,placeholder:"Select",size:"small",disabled:!!(f!=null&&f.disabled),onChange:u},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(f.options,h=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).InputNumber?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInputNumber),{key:1,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Input?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:2,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Textarea?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:3,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,autosize:"",type:"textarea",disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Color?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElColorPicker),{key:4,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Switch?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSwitch),{key:5,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).JsonEdit?(vue.openBlock(),vue.createBlock(_sfc_main$x,{key:6,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onClose:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):vue.createCommentVNode("",!0)]),_:2},1032,["label"])):vue.createCommentVNode("",!0)]))),128))}}),dynamicElFormItem_vue_vue_type_style_index_0_scoped_b2819020_lang="",dynamicElFormItem_vue_vue_type_style_index_1_lang="",DynamicElFormItem=_export_sfc$1(_sfc_main$w,[["__scopeId","data-v-b2819020"]]),_hoisted_1$6={style:{height:"100%"}},_hoisted_2$4={class:"flex flex-wrap"},_hoisted_3$3=["onMouseenter","onClick"],_sfc_main$v=vue.defineComponent({__name:"common-animate",props:{val:{}},emits:["updateCommonAniVal"],setup(i,{emit:r}){const n=i,o=r,a=vue.ref(n.val),u=vue.ref(!1),c=vue.ref("进入"),d=vue.ref(null),f=h=>{o("updateCommonAniVal",h),u.value=!1};return vue.watch(()=>n.val,h=>{a.value=h}),(h,y)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$6,[vue.unref(a)?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:0,closable:"",onClose:y[0]||(y[0]=g=>f("")),onClick:y[1]||(y[1]=g=>u.value=!0),style:{cursor:"pointer"}},{default:vue.withCtx(()=>{var g;return[vue.createTextVNode(vue.toDisplayString((g=vue.unref(common_animate_list).map(p=>p.children).reduce((p,v)=>p.concat(v)).find(p=>p.value==vue.unref(a)))==null?void 0:g.label)+" ",1),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:10},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"setting"})]),_:1})]}),_:1})):(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:1,type:"success",style:{cursor:"pointer"},onClick:y[2]||(y[2]=g=>u.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("新增")]),_:1})),vue.createVNode(vue.unref(elementPlus.ElDrawer),{modelValue:vue.unref(u),"onUpdate:modelValue":y[5]||(y[5]=g=>vue.isRef(u)?u.value=g:null),title:"选择动画",direction:"ltr"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElTabs),{modelValue:vue.unref(c),"onUpdate:modelValue":y[4]||(y[4]=g=>vue.isRef(c)?c.value=g:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(common_animate_list),g=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTabPane),{label:g.label,name:g.label,key:g.label},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{height:"500px"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_2$4,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(g.children,(p,v)=>(vue.openBlock(),vue.createElementBlock("div",{class:"animate",key:v,onMouseenter:_=>d.value=v,onMouseleave:y[3]||(y[3]=_=>d.value=null),onClick:_=>f(p.value)},[vue.createElementVNode("div",{class:vue.normalizeClass(`${vue.unref(d)==v?`animate__animated animate__${p.value} animate__slow animate__infinite`:""}`)},vue.toDisplayString(p.label),3)],40,_hoisted_3$3))),128))])]),_:2},1024)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]))}}),commonAnimate_vue_vue_type_style_index_0_scoped_2668f60c_lang="",CommonAnimate=_export_sfc$1(_sfc_main$v,[["__scopeId","data-v-2668f60c"]]),_sfc_main$u=vue.defineComponent({__name:"component-tree",setup(i){const r=useGlobalStore(pinia),n=vue.computed(()=>{var u;return((u=r.handle_svg_info)==null?void 0:u.info.id)??""}),o=u=>{for(let c of r.done_json)c.selected=!1,c.old_position={x:0,y:0};r.intention=EGlobalStoreIntention.Select,r.setHandleSvgInfo(u)},a={children:"children",label:"title"};return(u,c)=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTree),{class:"tree-v",data:vue.unref(r).done_json,props:a,onNodeClick:o,"default-expand-all":!0,"expand-on-click-node":!1,"highlight-current":!!vue.unref(n),"node-key":"id","current-node-key":vue.unref(n)},null,8,["data","highlight-current","current-node-key"]))}}),_withScopeId$1=i=>(vue.pushScopeId("data-v-98320511"),i=i(),vue.popScopeId(),i),_hoisted_1$5={class:"wall-l"},_hoisted_2$3={class:"head-l"},_hoisted_3$2=_withScopeId$1(()=>vue.createElementVNode("span",null,"key",-1)),_hoisted_4$1=_withScopeId$1(()=>vue.createElementVNode("span",null,"value",-1)),_hoisted_5$1={class:"row-l"},_sfc_main$t=vue.defineComponent({__name:"list",props:{modelValue:{default:()=>[{key:"",val:""}]}},emits:["update:modelValue"],setup(i,{emit:r}){const n=i,o=r,a=vue.computed({get(){return n.modelValue},set(d){o("update:modelValue",d)}}),u=()=>{a.value.push({key:"",val:""})},c=d=>{a.value.splice(d,1)};return(d,f)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$5,[vue.createElementVNode("div",_hoisted_2$3,[_hoisted_3$2,_hoisted_4$1,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:u},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"add"})]),_:1})]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(a),(h,y)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,[vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:h.key,"onUpdate:modelValue":g=>h.key=g,size:"small",placeholder:"key"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:h.val,"onUpdate:modelValue":g=>h.val=g,size:"small",placeholder:"value"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:g=>c(y)},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"delete"})]),_:2},1032,["onClick"])]))),256))]))}}),list_vue_vue_type_style_index_0_scoped_98320511_lang="",List=_export_sfc$1(_sfc_main$t,[["__scopeId","data-v-98320511"]]),composeEventHandlers=(i,r,{checkForDefaultPrevented:n=!0}={})=>a=>{const u=i==null?void 0:i(a);if(n===!1||!u)return r==null?void 0:r(a)};var _a;const isClient=typeof window<"u",isString$1=i=>typeof i=="string",noop=()=>{},isIOS=isClient&&((_a=window==null?void 0:window.navigator)==null?void 0:_a.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function resolveUnref(i){return typeof i=="function"?i():vue.unref(i)}function createFilterWrapper(i,r){function n(...o){return new Promise((a,u)=>{Promise.resolve(i(()=>r.apply(this,o),{fn:r,thisArg:this,args:o})).then(a).catch(u)})}return n}function debounceFilter(i,r={}){let n,o,a=noop;const u=d=>{clearTimeout(d),a(),a=noop};return d=>{const f=resolveUnref(i),h=resolveUnref(r.maxWait);return n&&u(n),f<=0||h!==void 0&&h<=0?(o&&(u(o),o=null),Promise.resolve(d())):new Promise((y,g)=>{a=r.rejectOnCancel?g:y,h&&!o&&(o=setTimeout(()=>{n&&u(n),o=null,y(d())},h)),n=setTimeout(()=>{o&&u(o),o=null,y(d())},f)})}}function identity(i){return i}function tryOnScopeDispose(i){return vue.getCurrentScope()?(vue.onScopeDispose(i),!0):!1}function useDebounceFn(i,r=200,n={}){return createFilterWrapper(debounceFilter(r,n),i)}function refDebounced(i,r=200,n={}){const o=vue.ref(i.value),a=useDebounceFn(()=>{o.value=i.value},r,n);return vue.watch(i,()=>a()),o}function tryOnMounted(i,r=!0){vue.getCurrentInstance()?vue.onMounted(i):r?i():vue.nextTick(i)}function unrefElement(i){var r;const n=resolveUnref(i);return(r=n==null?void 0:n.$el)!=null?r:n}const defaultWindow=isClient?window:void 0;function useEventListener(...i){let r,n,o,a;if(isString$1(i[0])||Array.isArray(i[0])?([n,o,a]=i,r=defaultWindow):[r,n,o,a]=i,!r)return noop;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const u=[],c=()=>{u.forEach(y=>y()),u.length=0},d=(y,g,p,v)=>(y.addEventListener(g,p,v),()=>y.removeEventListener(g,p,v)),f=vue.watch(()=>[unrefElement(r),resolveUnref(a)],([y,g])=>{c(),y&&u.push(...n.flatMap(p=>o.map(v=>d(y,p,v,g))))},{immediate:!0,flush:"post"}),h=()=>{f(),c()};return tryOnScopeDispose(h),h}let _iOSWorkaround=!1;function onClickOutside(i,r,n={}){const{window:o=defaultWindow,ignore:a=[],capture:u=!0,detectIframe:c=!1}=n;if(!o)return;isIOS&&!_iOSWorkaround&&(_iOSWorkaround=!0,Array.from(o.document.body.children).forEach(p=>p.addEventListener("click",noop)));let d=!0;const f=p=>a.some(v=>{if(typeof v=="string")return Array.from(o.document.querySelectorAll(v)).some(_=>_===p.target||p.composedPath().includes(_));{const _=unrefElement(v);return _&&(p.target===_||p.composedPath().includes(_))}}),y=[useEventListener(o,"click",p=>{const v=unrefElement(i);if(!(!v||v===p.target||p.composedPath().includes(v))){if(p.detail===0&&(d=!f(p)),!d){d=!0;return}r(p)}},{passive:!0,capture:u}),useEventListener(o,"pointerdown",p=>{const v=unrefElement(i);v&&(d=!p.composedPath().includes(v)&&!f(p))},{passive:!0}),c&&useEventListener(o,"blur",p=>{var v;const _=unrefElement(i);((v=o.document.activeElement)==null?void 0:v.tagName)==="IFRAME"&&!(_!=null&&_.contains(o.document.activeElement))&&r(p)})].filter(Boolean);return()=>y.forEach(p=>p())}function useSupported(i,r=!1){const n=vue.ref(),o=()=>n.value=!!i();return o(),tryOnMounted(o,r),n}const _global=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},globalKey="__vueuse_ssr_handlers__";_global[globalKey]=_global[globalKey]||{};var __getOwnPropSymbols$g=Object.getOwnPropertySymbols,__hasOwnProp$g=Object.prototype.hasOwnProperty,__propIsEnum$g=Object.prototype.propertyIsEnumerable,__objRest$2=(i,r)=>{var n={};for(var o in i)__hasOwnProp$g.call(i,o)&&r.indexOf(o)<0&&(n[o]=i[o]);if(i!=null&&__getOwnPropSymbols$g)for(var o of __getOwnPropSymbols$g(i))r.indexOf(o)<0&&__propIsEnum$g.call(i,o)&&(n[o]=i[o]);return n};function useResizeObserver(i,r,n={}){const o=n,{window:a=defaultWindow}=o,u=__objRest$2(o,["window"]);let c;const d=useSupported(()=>a&&"ResizeObserver"in a),f=()=>{c&&(c.disconnect(),c=void 0)},h=vue.watch(()=>unrefElement(i),g=>{f(),d.value&&a&&g&&(c=new ResizeObserver(r),c.observe(g,u))},{immediate:!0,flush:"post"}),y=()=>{f(),h()};return tryOnScopeDispose(y),{isSupported:d,stop:y}}var __getOwnPropSymbols$8=Object.getOwnPropertySymbols,__hasOwnProp$8=Object.prototype.hasOwnProperty,__propIsEnum$8=Object.prototype.propertyIsEnumerable,__objRest$1=(i,r)=>{var n={};for(var o in i)__hasOwnProp$8.call(i,o)&&r.indexOf(o)<0&&(n[o]=i[o]);if(i!=null&&__getOwnPropSymbols$8)for(var o of __getOwnPropSymbols$8(i))r.indexOf(o)<0&&__propIsEnum$8.call(i,o)&&(n[o]=i[o]);return n};function useMutationObserver(i,r,n={}){const o=n,{window:a=defaultWindow}=o,u=__objRest$1(o,["window"]);let c;const d=useSupported(()=>a&&"MutationObserver"in a),f=()=>{c&&(c.disconnect(),c=void 0)},h=vue.watch(()=>unrefElement(i),g=>{f(),d.value&&a&&g&&(c=new MutationObserver(r),c.observe(g,u))},{immediate:!0}),y=()=>{f(),h()};return tryOnScopeDispose(y),{isSupported:d,stop:y}}var SwipeDirection;(function(i){i.UP="UP",i.RIGHT="RIGHT",i.DOWN="DOWN",i.LEFT="LEFT",i.NONE="NONE"})(SwipeDirection||(SwipeDirection={}));var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,r,n)=>r in i?__defProp(i,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[r]=n,__spreadValues=(i,r)=>{for(var n in r||(r={}))__hasOwnProp.call(r,n)&&__defNormalProp(i,n,r[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(r))__propIsEnum.call(r,n)&&__defNormalProp(i,n,r[n]);return i};const _TransitionPresets={easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]};__spreadValues({linear:identity},_TransitionPresets);const isFirefox=()=>isClient&&/firefox/i.test(window.navigator.userAgent);/**
|
245
245
|
* @vue/shared v3.4.37
|
246
246
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
247
247
|
* @license MIT
|
@@ -271,4 +271,4 @@ usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`),{initialZIndex:o,curr
|
|
271
271
|
right:0 !important;
|
272
272
|
`,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(i){const r=window.getComputedStyle(i),n=r.getPropertyValue("box-sizing"),o=Number.parseFloat(r.getPropertyValue("padding-bottom"))+Number.parseFloat(r.getPropertyValue("padding-top")),a=Number.parseFloat(r.getPropertyValue("border-bottom-width"))+Number.parseFloat(r.getPropertyValue("border-top-width"));return{contextStyle:CONTEXT_STYLE.map(c=>`${c}:${r.getPropertyValue(c)}`).join(";"),paddingSize:o,borderSize:a,boxSizing:n}}function calcTextareaHeight(i,r=1,n){var o;hiddenTextarea||(hiddenTextarea=document.createElement("textarea"),document.body.appendChild(hiddenTextarea));const{paddingSize:a,borderSize:u,boxSizing:c,contextStyle:d}=calculateNodeStyling(i);hiddenTextarea.setAttribute("style",`${d};${HIDDEN_STYLE}`),hiddenTextarea.value=i.value||i.placeholder||"";let f=hiddenTextarea.scrollHeight;const h={};c==="border-box"?f=f+u:c==="content-box"&&(f=f-a),hiddenTextarea.value="";const y=hiddenTextarea.scrollHeight-a;if(isNumber(r)){let g=y*r;c==="border-box"&&(g=g+a+u),f=Math.max(g,f),h.minHeight=`${g}px`}if(isNumber(n)){let g=y*n;c==="border-box"&&(g=g+a+u),f=Math.min(g,f)}return h.height=`${f}px`,(o=hiddenTextarea.parentNode)==null||o.removeChild(hiddenTextarea),hiddenTextarea=void 0,h}const inputProps=buildProps({id:{type:String,default:void 0},size:useSizeProp,disabled:Boolean,modelValue:{type:definePropType([String,Number,Object]),default:""},maxlength:{type:[String,Number]},minlength:{type:[String,Number]},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:Boolean,clearable:Boolean,showPassword:Boolean,showWordLimit:Boolean,suffixIcon:{type:iconPropType},prefixIcon:{type:iconPropType},containerRole:{type:String,default:void 0},tabindex:{type:[String,Number],default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:definePropType([Object,Array,String]),default:()=>mutable({})},autofocus:Boolean,rows:{type:Number,default:2},...useAriaProps(["ariaLabel"])}),inputEmits={[UPDATE_MODEL_EVENT]:i=>isString(i),input:i=>isString(i),change:i=>isString(i),focus:i=>i instanceof FocusEvent,blur:i=>i instanceof FocusEvent,clear:()=>!0,mouseleave:i=>i instanceof MouseEvent,mouseenter:i=>i instanceof MouseEvent,keydown:i=>i instanceof Event,compositionstart:i=>i instanceof CompositionEvent,compositionupdate:i=>i instanceof CompositionEvent,compositionend:i=>i instanceof CompositionEvent},__default__$9=vue.defineComponent({name:"ElInput",inheritAttrs:!1}),_sfc_main$p=vue.defineComponent({...__default__$9,props:inputProps,emits:inputEmits,setup(i,{expose:r,emit:n}){const o=i,a=vue.useAttrs(),u=vue.useSlots(),c=vue.computed(()=>{const j={};return o.containerRole==="combobox"&&(j["aria-haspopup"]=a["aria-haspopup"],j["aria-owns"]=a["aria-owns"],j["aria-expanded"]=a["aria-expanded"]),j}),d=vue.computed(()=>[o.type==="textarea"?A.b():b.b(),b.m(v.value),b.is("disabled",_.value),b.is("exceed",qe.value),{[b.b("group")]:u.prepend||u.append,[b.m("prefix")]:u.prefix||o.prefixIcon,[b.m("suffix")]:u.suffix||o.suffixIcon||o.clearable||o.showPassword,[b.bm("suffix","password-clear")]:Fe.value&&Ie.value,[b.b("hidden")]:o.type==="hidden"},a.class]),f=vue.computed(()=>[b.e("wrapper"),b.is("focus",$.value)]),h=useAttrs({excludeKeys:vue.computed(()=>Object.keys(c.value))}),{form:y,formItem:g}=useFormItem(),{inputId:p}=useFormItemInputId(o,{formItemContext:g}),v=useFormSize(),_=useFormDisabled(),b=useNamespace("input"),A=useNamespace("textarea"),w=vue.shallowRef(),T=vue.shallowRef(),S=vue.ref(!1),x=vue.ref(!1),L=vue.ref(),M=vue.shallowRef(o.inputStyle),O=vue.computed(()=>w.value||T.value),{wrapperRef:ie,isFocused:$}=useFocusController(O,{afterBlur(){var j;o.validateEvent&&((j=g==null?void 0:g.validate)==null||j.call(g,"blur").catch(xe=>debugWarn(xe)))}}),z=vue.computed(()=>{var j;return(j=y==null?void 0:y.statusIcon)!=null?j:!1}),V=vue.computed(()=>(g==null?void 0:g.validateState)||""),re=vue.computed(()=>V.value&&ValidateComponentsMap[V.value]),F=vue.computed(()=>x.value?view_default:hide_default),pe=vue.computed(()=>[a.style]),le=vue.computed(()=>[o.inputStyle,M.value,{resize:o.resize}]),de=vue.computed(()=>lodashEs.isNil(o.modelValue)?"":String(o.modelValue)),Fe=vue.computed(()=>o.clearable&&!_.value&&!o.readonly&&!!de.value&&($.value||S.value)),Ie=vue.computed(()=>o.showPassword&&!_.value&&!o.readonly&&!!de.value&&(!!de.value||$.value)),At=vue.computed(()=>o.showWordLimit&&!!o.maxlength&&(o.type==="text"||o.type==="textarea")&&!_.value&&!o.readonly&&!o.showPassword),_e=vue.computed(()=>de.value.length),qe=vue.computed(()=>!!At.value&&_e.value>Number(o.maxlength)),In=vue.computed(()=>!!u.suffix||!!o.suffixIcon||Fe.value||o.showPassword||At.value||!!V.value&&z.value),[vn,Pt]=useCursor(w);useResizeObserver(T,j=>{if(Dt(),!At.value||o.resize!=="both")return;const xe=j[0],{width:hn}=xe.contentRect;L.value={right:`calc(100% - ${hn+15+6}px)`}});const he=()=>{const{type:j,autosize:xe}=o;if(!(!isClient||j!=="textarea"||!T.value))if(xe){const hn=isObject(xe)?xe.minRows:void 0,_n=isObject(xe)?xe.maxRows:void 0,Sn=calcTextareaHeight(T.value,hn,_n);M.value={overflowY:"hidden",...Sn},vue.nextTick(()=>{T.value.offsetHeight,M.value=Sn})}else M.value={minHeight:calcTextareaHeight(T.value).minHeight}},Dt=(j=>{let xe=!1;return()=>{var hn;if(xe||!o.autosize)return;((hn=T.value)==null?void 0:hn.offsetParent)===null||(j(),xe=!0)}})(he),jt=()=>{const j=O.value,xe=o.formatter?o.formatter(de.value):de.value;!j||j.value===xe||(j.value=xe)},Et=async j=>{vn();let{value:xe}=j.target;if(o.formatter&&(xe=o.parser?o.parser(xe):xe),!ue.value){if(xe===de.value){jt();return}n(UPDATE_MODEL_EVENT,xe),n("input",xe),await vue.nextTick(),jt(),Pt()}},Ce=j=>{n("change",j.target.value)},{isComposing:ue,handleCompositionStart:$e,handleCompositionUpdate:Ne,handleCompositionEnd:Oe}=useComposition({emit:n,afterComposition:Et}),Lt=()=>{x.value=!x.value,kt()},kt=async()=>{var j;await vue.nextTick(),(j=O.value)==null||j.focus()},Cn=()=>{var j;return(j=O.value)==null?void 0:j.blur()},oe=j=>{S.value=!1,n("mouseleave",j)},ae=j=>{S.value=!0,n("mouseenter",j)},Y=j=>{n("keydown",j)},k=()=>{var j;(j=O.value)==null||j.select()},D=()=>{n(UPDATE_MODEL_EVENT,""),n("change",""),n("clear"),n("input","")};return vue.watch(()=>o.modelValue,()=>{var j;vue.nextTick(()=>he()),o.validateEvent&&((j=g==null?void 0:g.validate)==null||j.call(g,"change").catch(xe=>debugWarn(xe)))}),vue.watch(de,()=>jt()),vue.watch(()=>o.type,async()=>{await vue.nextTick(),jt(),he()}),vue.onMounted(()=>{!o.formatter&&o.parser&&debugWarn("ElInput","If you set the parser, you also need to set the formatter."),jt(),vue.nextTick(he)}),r({input:w,textarea:T,ref:O,textareaStyle:le,autosize:vue.toRef(o,"autosize"),isComposing:ue,focus:kt,blur:Cn,select:k,clear:D,resizeTextarea:he}),(j,xe)=>(vue.openBlock(),vue.createElementBlock("div",vue.mergeProps(vue.unref(c),{class:[vue.unref(d),{[vue.unref(b).bm("group","append")]:j.$slots.append,[vue.unref(b).bm("group","prepend")]:j.$slots.prepend}],style:vue.unref(pe),role:j.containerRole,onMouseenter:ae,onMouseleave:oe}),[vue.createCommentVNode(" input "),j.type!=="textarea"?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:0},[vue.createCommentVNode(" prepend slot "),j.$slots.prepend?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:vue.normalizeClass(vue.unref(b).be("group","prepend"))},[vue.renderSlot(j.$slots,"prepend")],2)):vue.createCommentVNode("v-if",!0),vue.createElementVNode("div",{ref_key:"wrapperRef",ref:ie,class:vue.normalizeClass(vue.unref(f))},[vue.createCommentVNode(" prefix slot "),j.$slots.prefix||j.prefixIcon?(vue.openBlock(),vue.createElementBlock("span",{key:0,class:vue.normalizeClass(vue.unref(b).e("prefix"))},[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(b).e("prefix-inner"))},[vue.renderSlot(j.$slots,"prefix"),j.prefixIcon?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:0,class:vue.normalizeClass(vue.unref(b).e("icon"))},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(j.prefixIcon)))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0)],2)],2)):vue.createCommentVNode("v-if",!0),vue.createElementVNode("input",vue.mergeProps({id:vue.unref(p),ref_key:"input",ref:w,class:vue.unref(b).e("inner")},vue.unref(h),{minlength:j.minlength,maxlength:j.maxlength,type:j.showPassword?x.value?"text":"password":j.type,disabled:vue.unref(_),readonly:j.readonly,autocomplete:j.autocomplete,tabindex:j.tabindex,"aria-label":j.ariaLabel,placeholder:j.placeholder,style:j.inputStyle,form:j.form,autofocus:j.autofocus,onCompositionstart:vue.unref($e),onCompositionupdate:vue.unref(Ne),onCompositionend:vue.unref(Oe),onInput:Et,onChange:Ce,onKeydown:Y}),null,16,["id","minlength","maxlength","type","disabled","readonly","autocomplete","tabindex","aria-label","placeholder","form","autofocus","onCompositionstart","onCompositionupdate","onCompositionend"]),vue.createCommentVNode(" suffix slot "),vue.unref(In)?(vue.openBlock(),vue.createElementBlock("span",{key:1,class:vue.normalizeClass(vue.unref(b).e("suffix"))},[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(b).e("suffix-inner"))},[!vue.unref(Fe)||!vue.unref(Ie)||!vue.unref(At)?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:0},[vue.renderSlot(j.$slots,"suffix"),j.suffixIcon?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:0,class:vue.normalizeClass(vue.unref(b).e("icon"))},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(j.suffixIcon)))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0)],64)):vue.createCommentVNode("v-if",!0),vue.unref(Fe)?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:1,class:vue.normalizeClass([vue.unref(b).e("icon"),vue.unref(b).e("clear")]),onMousedown:vue.withModifiers(vue.unref(NOOP),["prevent"]),onClick:D},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(circle_close_default))]),_:1},8,["class","onMousedown"])):vue.createCommentVNode("v-if",!0),vue.unref(Ie)?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:2,class:vue.normalizeClass([vue.unref(b).e("icon"),vue.unref(b).e("password")]),onClick:Lt},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(vue.unref(F))))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0),vue.unref(At)?(vue.openBlock(),vue.createElementBlock("span",{key:3,class:vue.normalizeClass(vue.unref(b).e("count"))},[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(b).e("count-inner"))},vue.toDisplayString(vue.unref(_e))+" / "+vue.toDisplayString(j.maxlength),3)],2)):vue.createCommentVNode("v-if",!0),vue.unref(V)&&vue.unref(re)&&vue.unref(z)?(vue.openBlock(),vue.createBlock(vue.unref(ElIcon),{key:4,class:vue.normalizeClass([vue.unref(b).e("icon"),vue.unref(b).e("validateIcon"),vue.unref(b).is("loading",vue.unref(V)==="validating")])},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(vue.unref(re))))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0)],2)],2)):vue.createCommentVNode("v-if",!0)],2),vue.createCommentVNode(" append slot "),j.$slots.append?(vue.openBlock(),vue.createElementBlock("div",{key:1,class:vue.normalizeClass(vue.unref(b).be("group","append"))},[vue.renderSlot(j.$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(p),ref_key:"textarea",ref:T,class:[vue.unref(A).e("inner"),vue.unref(b).is("focus",vue.unref($))]},vue.unref(h),{minlength:j.minlength,maxlength:j.maxlength,tabindex:j.tabindex,disabled:vue.unref(_),readonly:j.readonly,autocomplete:j.autocomplete,style:vue.unref(le),"aria-label":j.ariaLabel,placeholder:j.placeholder,form:j.form,autofocus:j.autofocus,rows:j.rows,onCompositionstart:vue.unref($e),onCompositionupdate:vue.unref(Ne),onCompositionend:vue.unref(Oe),onInput:Et,onChange:Ce,onKeydown:Y}),null,16,["id","minlength","maxlength","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form","autofocus","rows","onCompositionstart","onCompositionupdate","onCompositionend"]),vue.unref(At)?(vue.openBlock(),vue.createElementBlock("span",{key:0,style:vue.normalizeStyle(L.value),class:vue.normalizeClass(vue.unref(b).e("count"))},vue.toDisplayString(vue.unref(_e))+" / "+vue.toDisplayString(j.maxlength),7)):vue.createCommentVNode("v-if",!0)],64))],16,["role"]))}});var Input=_export_sfc(_sfc_main$p,[["__file","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:i,size:r,bar:n})=>({[n.size]:r,transform:`translate${n.axis}(${i}%)`}),scrollbarContextKey=Symbol("scrollbarContextKey"),thumbProps=buildProps({vertical:Boolean,size:String,move:Number,ratio:{type:Number,required:!0},always:Boolean}),COMPONENT_NAME$2="Thumb",_sfc_main$o=vue.defineComponent({__name:"thumb",props:thumbProps,setup(i){const r=i,n=vue.inject(scrollbarContextKey),o=useNamespace("scrollbar");n||throwError(COMPONENT_NAME$2,"can not inject scrollbar context");const a=vue.ref(),u=vue.ref(),c=vue.ref({}),d=vue.ref(!1);let f=!1,h=!1,y=isClient?document.onselectstart:null;const g=vue.computed(()=>BAR_MAP[r.vertical?"vertical":"horizontal"]),p=vue.computed(()=>renderThumbStyle({size:r.size,move:r.move,bar:g.value})),v=vue.computed(()=>a.value[g.value.offset]**2/n.wrapElement[g.value.scrollSize]/r.ratio/u.value[g.value.offset]),_=M=>{var O;if(M.stopPropagation(),M.ctrlKey||[1,2].includes(M.button))return;(O=window.getSelection())==null||O.removeAllRanges(),A(M);const ie=M.currentTarget;ie&&(c.value[g.value.axis]=ie[g.value.offset]-(M[g.value.client]-ie.getBoundingClientRect()[g.value.direction]))},b=M=>{if(!u.value||!a.value||!n.wrapElement)return;const O=Math.abs(M.target.getBoundingClientRect()[g.value.direction]-M[g.value.client]),ie=u.value[g.value.offset]/2,$=(O-ie)*100*v.value/a.value[g.value.offset];n.wrapElement[g.value.scroll]=$*n.wrapElement[g.value.scrollSize]/100},A=M=>{M.stopImmediatePropagation(),f=!0,document.addEventListener("mousemove",w),document.addEventListener("mouseup",T),y=document.onselectstart,document.onselectstart=()=>!1},w=M=>{if(!a.value||!u.value||f===!1)return;const O=c.value[g.value.axis];if(!O)return;const ie=(a.value.getBoundingClientRect()[g.value.direction]-M[g.value.client])*-1,$=u.value[g.value.offset]-O,z=(ie-$)*100*v.value/a.value[g.value.offset];n.wrapElement[g.value.scroll]=z*n.wrapElement[g.value.scrollSize]/100},T=()=>{f=!1,c.value[g.value.axis]=0,document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",T),L(),h&&(d.value=!1)},S=()=>{h=!1,d.value=!!r.size},x=()=>{h=!0,d.value=f};vue.onBeforeUnmount(()=>{L(),document.removeEventListener("mouseup",T)});const L=()=>{document.onselectstart!==y&&(document.onselectstart=y)};return useEventListener(vue.toRef(n,"scrollbarElement"),"mousemove",S),useEventListener(vue.toRef(n,"scrollbarElement"),"mouseleave",x),(M,O)=>(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:b},[vue.createElementVNode("div",{ref_key:"thumb",ref:u,class:vue.normalizeClass(vue.unref(o).e("thumb")),style:vue.normalizeStyle(vue.unref(p)),onMousedown:_},null,38)],34),[[vue.vShow,M.always||d.value]])]),_:1},8,["name"]))}});var Thumb=_export_sfc(_sfc_main$o,[["__file","thumb.vue"]]);const barProps=buildProps({always:{type:Boolean,default:!0},minSize:{type:Number,required:!0}}),_sfc_main$n=vue.defineComponent({__name:"bar",props:barProps,setup(i,{expose:r}){const n=i,o=vue.inject(scrollbarContextKey),a=vue.ref(0),u=vue.ref(0),c=vue.ref(""),d=vue.ref(""),f=vue.ref(1),h=vue.ref(1);return r({handleScroll:p=>{if(p){const v=p.offsetHeight-GAP,_=p.offsetWidth-GAP;u.value=p.scrollTop*100/v*f.value,a.value=p.scrollLeft*100/_*h.value}},update:()=>{const p=o==null?void 0:o.wrapElement;if(!p)return;const v=p.offsetHeight-GAP,_=p.offsetWidth-GAP,b=v**2/p.scrollHeight,A=_**2/p.scrollWidth,w=Math.max(b,n.minSize),T=Math.max(A,n.minSize);f.value=b/(v-b)/(w/(v-w)),h.value=A/(_-A)/(T/(_-T)),d.value=w+GAP<v?`${w}px`:"",c.value=T+GAP<_?`${T}px`:""}}),(p,v)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createVNode(Thumb,{move:a.value,ratio:h.value,size:c.value,always:p.always},null,8,["move","ratio","size","always"]),vue.createVNode(Thumb,{move:u.value,ratio:f.value,size:d.value,vertical:"",always:p.always},null,8,["move","ratio","size","always"])],64))}});var Bar=_export_sfc(_sfc_main$n,[["__file","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},id:String,role:String,...useAriaProps(["ariaLabel","ariaOrientation"])}),scrollbarEmits={scroll:({scrollTop:i,scrollLeft:r})=>[i,r].every(isNumber)},COMPONENT_NAME$1="ElScrollbar",__default__$8=vue.defineComponent({name:COMPONENT_NAME$1}),_sfc_main$m=vue.defineComponent({...__default__$8,props:scrollbarProps,emits:scrollbarEmits,setup(i,{expose:r,emit:n}){const o=i,a=useNamespace("scrollbar");let u,c,d=0,f=0;const h=vue.ref(),y=vue.ref(),g=vue.ref(),p=vue.ref(),v=vue.computed(()=>{const L={};return o.height&&(L.height=addUnit(o.height)),o.maxHeight&&(L.maxHeight=addUnit(o.maxHeight)),[o.wrapStyle,L]}),_=vue.computed(()=>[o.wrapClass,a.e("wrap"),{[a.em("wrap","hidden-default")]:!o.native}]),b=vue.computed(()=>[a.e("view"),o.viewClass]),A=()=>{var L;y.value&&((L=p.value)==null||L.handleScroll(y.value),d=y.value.scrollTop,f=y.value.scrollLeft,n("scroll",{scrollTop:y.value.scrollTop,scrollLeft:y.value.scrollLeft}))};function w(L,M){isObject(L)?y.value.scrollTo(L):isNumber(L)&&isNumber(M)&&y.value.scrollTo(L,M)}const T=L=>{if(!isNumber(L)){debugWarn(COMPONENT_NAME$1,"value must be a number");return}y.value.scrollTop=L},S=L=>{if(!isNumber(L)){debugWarn(COMPONENT_NAME$1,"value must be a number");return}y.value.scrollLeft=L},x=()=>{var L;(L=p.value)==null||L.update()};return vue.watch(()=>o.noresize,L=>{L?(u==null||u(),c==null||c()):({stop:u}=useResizeObserver(g,x),c=useEventListener("resize",x))},{immediate:!0}),vue.watch(()=>[o.maxHeight,o.height],()=>{o.native||vue.nextTick(()=>{var L;x(),y.value&&((L=p.value)==null||L.handleScroll(y.value))})}),vue.provide(scrollbarContextKey,vue.reactive({scrollbarElement:h,wrapElement:y})),vue.onActivated(()=>{y.value.scrollTop=d,y.value.scrollLeft=f}),vue.onMounted(()=>{o.native||vue.nextTick(()=>{x()})}),vue.onUpdated(()=>x()),r({wrapRef:y,update:x,scrollTo:w,setScrollTop:T,setScrollLeft:S,handleScroll:A}),(L,M)=>(vue.openBlock(),vue.createElementBlock("div",{ref_key:"scrollbarRef",ref:h,class:vue.normalizeClass(vue.unref(a).b())},[vue.createElementVNode("div",{ref_key:"wrapRef",ref:y,class:vue.normalizeClass(vue.unref(_)),style:vue.normalizeStyle(vue.unref(v)),onScroll:A},[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(L.tag),{id:L.id,ref_key:"resizeRef",ref:g,class:vue.normalizeClass(vue.unref(b)),style:vue.normalizeStyle(L.viewStyle),role:L.role,"aria-label":L.ariaLabel,"aria-orientation":L.ariaOrientation},{default:vue.withCtx(()=>[vue.renderSlot(L.$slots,"default")]),_:3},8,["id","class","style","role","aria-label","aria-orientation"]))],38),L.native?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createBlock(Bar,{key:0,ref_key:"barRef",ref:p,always:L.always,"min-size":L.minSize},null,8,["always","min-size"]))],2))}});var Scrollbar=_export_sfc(_sfc_main$m,[["__file","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$l=vue.defineComponent({...__default__$7,props:popperProps,setup(i,{expose:r}){const n=i,o=vue.ref(),a=vue.ref(),u=vue.ref(),c=vue.ref(),d=vue.computed(()=>n.role),f={triggerRef:o,popperInstanceRef:a,contentRef:u,referenceRef:c,role:d};return r(f),vue.provide(POPPER_INJECTION_KEY,f),(h,y)=>vue.renderSlot(h.$slots,"default")}});var Popper=_export_sfc(_sfc_main$l,[["__file","popper.vue"]]);const popperArrowProps=buildProps({arrowOffset:{type:Number,default:5}}),__default__$6=vue.defineComponent({name:"ElPopperArrow",inheritAttrs:!1}),_sfc_main$k=vue.defineComponent({...__default__$6,props:popperArrowProps,setup(i,{expose:r}){const n=i,o=useNamespace("popper"),{arrowOffset:a,arrowRef:u,arrowStyle:c}=vue.inject(POPPER_CONTENT_INJECTION_KEY,void 0);return vue.watch(()=>n.arrowOffset,d=>{a.value=d}),vue.onBeforeUnmount(()=>{u.value=void 0}),r({arrowRef:u}),(d,f)=>(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$k,[["__file","arrow.vue"]]);const NAME="ElOnlyChild",OnlyChild=vue.defineComponent({name:NAME,setup(i,{slots:r,attrs:n}){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 d=(c=r.default)==null?void 0:c.call(r,n);if(!d)return null;if(d.length>1)return debugWarn(NAME,"requires exact only one valid child."),null;const f=findFirstLegitChild(d);return f?vue.withDirectives(vue.cloneVNode(f,n),[[u]]):(debugWarn(NAME,"no valid child node found"),null)}}});function findFirstLegitChild(i){if(!i)return null;const r=i;for(const n of r){if(isObject(n))switch(n.type){case vue.Comment:continue;case vue.Text:case"svg":return wrapTextContent(n);case vue.Fragment:return findFirstLegitChild(n.children);default:return n}return wrapTextContent(n)}return null}function wrapTextContent(i){const r=useNamespace("only-child");return vue.createVNode("span",{class:r.e("content")},[i])}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$j=vue.defineComponent({...__default__$5,props:popperTriggerProps,setup(i,{expose:r}){const n=i,{role:o,triggerRef:a}=vue.inject(POPPER_INJECTION_KEY,void 0);useForwardRef(a);const u=vue.computed(()=>d.value?n.id:void 0),c=vue.computed(()=>{if(o&&o.value==="tooltip")return n.open&&n.id?n.id:void 0}),d=vue.computed(()=>{if(o&&o.value!=="tooltip")return o.value}),f=vue.computed(()=>d.value?`${n.open}`:void 0);let h;const y=["onMouseenter","onMouseleave","onClick","onKeydown","onFocus","onBlur","onContextmenu"];return vue.onMounted(()=>{vue.watch(()=>n.virtualRef,g=>{g&&(a.value=unrefElement(g))},{immediate:!0}),vue.watch(a,(g,p)=>{h==null||h(),h=void 0,isElement(g)&&(y.forEach(v=>{var _;const b=n[v];b&&(g.addEventListener(v.slice(2).toLowerCase(),b),(_=p==null?void 0:p.removeEventListener)==null||_.call(p,v.slice(2).toLowerCase(),b))}),h=vue.watch([u,c,d,f],v=>{["aria-controls","aria-describedby","aria-haspopup","aria-expanded"].forEach((_,b)=>{lodashEs.isNil(v[b])?g.removeAttribute(_):g.setAttribute(_,v[b])})},{immediate:!0})),isElement(p)&&["aria-controls","aria-describedby","aria-haspopup","aria-expanded"].forEach(v=>p.removeAttribute(v))},{immediate:!0})}),vue.onBeforeUnmount(()=>{if(h==null||h(),h=void 0,a.value&&isElement(a.value)){const g=a.value;y.forEach(p=>{const v=n[p];v&&g.removeEventListener(p.slice(2).toLowerCase(),v)}),a.value=void 0}}),r({triggerRef:a}),(g,p)=>g.virtualTriggering?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createBlock(vue.unref(OnlyChild),vue.mergeProps({key:0},g.$attrs,{"aria-controls":vue.unref(u),"aria-describedby":vue.unref(c),"aria-expanded":vue.unref(f),"aria-haspopup":vue.unref(d)}),{default:vue.withCtx(()=>[vue.renderSlot(g.$slots,"default")]),_:3},16,["aria-controls","aria-describedby","aria-expanded","aria-haspopup"]))}});var ElPopperTrigger=_export_sfc(_sfc_main$j,[["__file","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=i=>{const r=[],n=document.createTreeWalker(i,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(;n.nextNode();)r.push(n.currentNode);return r},getVisibleElement=(i,r)=>{for(const n of i)if(!isHidden(n,r))return n},isHidden=(i,r)=>{if(process.env.NODE_ENV==="test")return!1;if(getComputedStyle(i).visibility==="hidden")return!0;for(;i;){if(r&&i===r)return!1;if(getComputedStyle(i).display==="none")return!0;i=i.parentElement}return!1},getEdges=i=>{const r=obtainAllFocusableElements(i),n=getVisibleElement(r,i),o=getVisibleElement(r.reverse(),i);return[n,o]},isSelectable=i=>i instanceof HTMLInputElement&&"select"in i,tryFocus=(i,r)=>{if(i&&i.focus){const n=document.activeElement;i.focus({preventScroll:!0}),lastAutomatedFocusTimestamp.value=window.performance.now(),i!==n&&isSelectable(i)&&r&&i.select()}};function removeFromStack(i,r){const n=[...i],o=i.indexOf(r);return o!==-1&&n.splice(o,1),n}const createFocusableStack=()=>{let i=[];return{push:o=>{const a=i[0];a&&o!==a&&a.pause(),i=removeFromStack(i,o),i.unshift(o)},remove:o=>{var a,u;i=removeFromStack(i,o),(u=(a=i[0])==null?void 0:a.resume)==null||u.call(a)}}},focusFirstDescendant=(i,r=!1)=>{const n=document.activeElement;for(const o of i)if(tryFocus(o,r),document.activeElement!==n)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=i=>new CustomEvent(FOCUSOUT_PREVENTED,{...FOCUSOUT_PREVENTED_OPTS,detail:i}),_sfc_main$i=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(i,{emit:r}){const n=vue.ref();let o,a;const{focusReason:u}=useFocusReason();useEscapeKeydown(_=>{i.trapped&&!c.paused&&r("release-requested",_)});const c={paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}},d=_=>{if(!i.loop&&!i.trapped||c.paused)return;const{key:b,altKey:A,ctrlKey:w,metaKey:T,currentTarget:S,shiftKey:x}=_,{loop:L}=i,M=b===EVENT_CODE.tab&&!A&&!w&&!T,O=document.activeElement;if(M&&O){const ie=S,[$,z]=getEdges(ie);if($&&z){if(!x&&O===z){const re=createFocusOutPreventedEvent({focusReason:u.value});r("focusout-prevented",re),re.defaultPrevented||(_.preventDefault(),L&&tryFocus($,!0))}else if(x&&[$,ie].includes(O)){const re=createFocusOutPreventedEvent({focusReason:u.value});r("focusout-prevented",re),re.defaultPrevented||(_.preventDefault(),L&&tryFocus(z,!0))}}else if(O===ie){const re=createFocusOutPreventedEvent({focusReason:u.value});r("focusout-prevented",re),re.defaultPrevented||_.preventDefault()}}};vue.provide(FOCUS_TRAP_INJECTION_KEY,{focusTrapRef:n,onKeydown:d}),vue.watch(()=>i.focusTrapEl,_=>{_&&(n.value=_)},{immediate:!0}),vue.watch([n],([_],[b])=>{_&&(_.addEventListener("keydown",d),_.addEventListener("focusin",y),_.addEventListener("focusout",g)),b&&(b.removeEventListener("keydown",d),b.removeEventListener("focusin",y),b.removeEventListener("focusout",g))});const f=_=>{r(ON_TRAP_FOCUS_EVT,_)},h=_=>r(ON_RELEASE_FOCUS_EVT,_),y=_=>{const b=vue.unref(n);if(!b)return;const A=_.target,w=_.relatedTarget,T=A&&b.contains(A);i.trapped||w&&b.contains(w)||(o=w),T&&r("focusin",_),!c.paused&&i.trapped&&(T?a=A:tryFocus(a,!0))},g=_=>{const b=vue.unref(n);if(!(c.paused||!b))if(i.trapped){const A=_.relatedTarget;!lodashEs.isNil(A)&&!b.contains(A)&&setTimeout(()=>{if(!c.paused&&i.trapped){const w=createFocusOutPreventedEvent({focusReason:u.value});r("focusout-prevented",w),w.defaultPrevented||tryFocus(a,!0)}},0)}else{const A=_.target;A&&b.contains(A)||r("focusout",_)}};async function p(){await vue.nextTick();const _=vue.unref(n);if(_){focusableStack.push(c);const b=_.contains(document.activeElement)?o:document.activeElement;if(o=b,!_.contains(b)){const w=new Event(FOCUS_AFTER_TRAPPED,FOCUS_AFTER_TRAPPED_OPTS);_.addEventListener(FOCUS_AFTER_TRAPPED,f),_.dispatchEvent(w),w.defaultPrevented||vue.nextTick(()=>{let T=i.focusStartEl;isString(T)||(tryFocus(T),document.activeElement!==T&&(T="first")),T==="first"&&focusFirstDescendant(obtainAllFocusableElements(_),!0),(document.activeElement===b||T==="container")&&tryFocus(_)})}}}function v(){const _=vue.unref(n);if(_){_.removeEventListener(FOCUS_AFTER_TRAPPED,f);const b=new CustomEvent(FOCUS_AFTER_RELEASED,{...FOCUS_AFTER_TRAPPED_OPTS,detail:{focusReason:u.value}});_.addEventListener(FOCUS_AFTER_RELEASED,h),_.dispatchEvent(b),!b.defaultPrevented&&(u.value=="keyboard"||!isFocusCausedByUserEvent()||_.contains(document.activeElement))&&tryFocus(o??document.body),_.removeEventListener(FOCUS_AFTER_RELEASED,h),focusableStack.remove(c)}}return vue.onMounted(()=>{i.trapped&&p(),vue.watch(()=>i.trapped,_=>{_?p():v()})}),vue.onBeforeUnmount(()=>{i.trapped&&v(),n.value&&(n.value.removeEventListener("keydown",d),n.value.removeEventListener("focusin",y),n.value.removeEventListener("focusout",g),n.value=void 0)}),{onKeydown:d}}});function _sfc_render$4(i,r,n,o,a,u){return vue.renderSlot(i.$slots,"default",{handleKeydown:i.onKeydown})}var ElFocusTrap=_export_sfc(_sfc_main$i,[["render",_sfc_render$4],["__file","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:definePropType(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},virtualTriggering:Boolean,zIndex:Number,...useAriaProps(["ariaLabel"])}),popperContentEmits={mouseenter:i=>i instanceof MouseEvent,mouseleave:i=>i instanceof MouseEvent,focus:()=>!0,blur:()=>!0,close:()=>!0},buildPopperOptions=(i,r=[])=>{const{placement:n,strategy:o,popperOptions:a}=i,u={placement:n,strategy:o,...a,modifiers:[...genModifiers(i),...r]};return deriveExtraModifiers(u,a==null?void 0:a.modifiers),u},unwrapMeasurableEl=i=>{if(isClient)return unrefElement(i)};function genModifiers(i){const{offset:r,gpuAcceleration:n,fallbackPlacements:o}=i;return[{name:"offset",options:{offset:[0,r??12]}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5,fallbackPlacements:o}},{name:"computeStyles",options:{gpuAcceleration:n}}]}function deriveExtraModifiers(i,r){r&&(i.modifiers=[...i.modifiers,...r??[]])}const DEFAULT_ARROW_OFFSET=0,usePopperContent=i=>{const{popperInstanceRef:r,contentRef:n,triggerRef:o,role:a}=vue.inject(POPPER_INJECTION_KEY,void 0),u=vue.ref(),c=vue.ref(),d=vue.computed(()=>({name:"eventListeners",enabled:!!i.visible})),f=vue.computed(()=>{var w;const T=vue.unref(u),S=(w=vue.unref(c))!=null?w:DEFAULT_ARROW_OFFSET;return{name:"arrow",enabled:!lodashEs.isUndefined(T),options:{element:T,padding:S}}}),h=vue.computed(()=>({onFirstUpdate:()=>{_()},...buildPopperOptions(i,[vue.unref(f),vue.unref(d)])})),y=vue.computed(()=>unwrapMeasurableEl(i.referenceEl)||vue.unref(o)),{attributes:g,state:p,styles:v,update:_,forceUpdate:b,instanceRef:A}=usePopper(y,n,h);return vue.watch(A,w=>r.value=w),vue.onMounted(()=>{vue.watch(()=>{var w;return(w=vue.unref(y))==null?void 0:w.getBoundingClientRect()},()=>{_()})}),{attributes:g,arrowRef:u,contentRef:n,instanceRef:A,state:p,styles:v,role:a,forceUpdate:b,update:_}},usePopperContentDOM=(i,{attributes:r,styles:n,role:o})=>{const{nextZIndex:a}=useZIndex(),u=useNamespace("popper"),c=vue.computed(()=>vue.unref(r).popper),d=vue.ref(isNumber(i.zIndex)?i.zIndex:a()),f=vue.computed(()=>[u.b(),u.is("pure",i.pure),u.is(i.effect),i.popperClass]),h=vue.computed(()=>[{zIndex:vue.unref(d)},vue.unref(n).popper,i.popperStyle||{}]),y=vue.computed(()=>o.value==="dialog"?"false":void 0),g=vue.computed(()=>vue.unref(n).arrow||{});return{ariaModal:y,arrowStyle:g,contentAttrs:c,contentClass:f,contentStyle:h,contentZIndex:d,updateZIndex:()=>{d.value=isNumber(i.zIndex)?i.zIndex:a()}}},usePopperContentFocusTrap=(i,r)=>{const n=vue.ref(!1),o=vue.ref();return{focusStartRef:o,trapped:n,onFocusAfterReleased:h=>{var y;((y=h.detail)==null?void 0:y.focusReason)!=="pointer"&&(o.value="first",r("blur"))},onFocusAfterTrapped:()=>{r("focus")},onFocusInTrap:h=>{i.visible&&!n.value&&(h.target&&(o.value=h.target),n.value=!0)},onFocusoutPrevented:h=>{i.trapping||(h.detail.focusReason==="pointer"&&h.preventDefault(),n.value=!1)},onReleaseRequested:()=>{n.value=!1,r("close")}}},__default__$4=vue.defineComponent({name:"ElPopperContent"}),_sfc_main$h=vue.defineComponent({...__default__$4,props:popperContentProps,emits:popperContentEmits,setup(i,{expose:r,emit:n}){const o=i,{focusStartRef:a,trapped:u,onFocusAfterReleased:c,onFocusAfterTrapped:d,onFocusInTrap:f,onFocusoutPrevented:h,onReleaseRequested:y}=usePopperContentFocusTrap(o,n),{attributes:g,arrowRef:p,contentRef:v,styles:_,instanceRef:b,role:A,update:w}=usePopperContent(o),{ariaModal:T,arrowStyle:S,contentAttrs:x,contentClass:L,contentStyle:M,updateZIndex:O}=usePopperContentDOM(o,{styles:_,attributes:g,role:A}),ie=vue.inject(formItemContextKey,void 0),$=vue.ref();vue.provide(POPPER_CONTENT_INJECTION_KEY,{arrowStyle:S,arrowRef:p,arrowOffset:$}),ie&&vue.provide(formItemContextKey,{...ie,addInputId:NOOP,removeInputId:NOOP});let z;const V=(F=!0)=>{w(),F&&O()},re=()=>{V(!1),o.visible&&o.focusOnShow?u.value=!0:o.visible===!1&&(u.value=!1)};return vue.onMounted(()=>{vue.watch(()=>o.triggerTargetEl,(F,pe)=>{z==null||z(),z=void 0;const le=vue.unref(F||v.value),de=vue.unref(pe||v.value);isElement(le)&&(z=vue.watch([A,()=>o.ariaLabel,T,()=>o.id],Fe=>{["role","aria-label","aria-modal","id"].forEach((Ie,At)=>{lodashEs.isNil(Fe[At])?le.removeAttribute(Ie):le.setAttribute(Ie,Fe[At])})},{immediate:!0})),de!==le&&isElement(de)&&["role","aria-label","aria-modal","id"].forEach(Fe=>{de.removeAttribute(Fe)})},{immediate:!0}),vue.watch(()=>o.visible,re,{immediate:!0})}),vue.onBeforeUnmount(()=>{z==null||z(),z=void 0}),r({popperContentRef:v,popperInstanceRef:b,updatePopper:V,contentStyle:M}),(F,pe)=>(vue.openBlock(),vue.createElementBlock("div",vue.mergeProps({ref_key:"contentRef",ref:v},vue.unref(x),{style:vue.unref(M),class:vue.unref(L),tabindex:"-1",onMouseenter:le=>F.$emit("mouseenter",le),onMouseleave:le=>F.$emit("mouseleave",le)}),[vue.createVNode(vue.unref(ElFocusTrap),{trapped:vue.unref(u),"trap-on-focus-in":!0,"focus-trap-el":vue.unref(v),"focus-start-el":vue.unref(a),onFocusAfterTrapped:vue.unref(d),onFocusAfterReleased:vue.unref(c),onFocusin:vue.unref(f),onFocusoutPrevented:vue.unref(h),onReleaseRequested:vue.unref(y)},{default:vue.withCtx(()=>[vue.renderSlot(F.$slots,"default")]),_:3},8,["trapped","focus-trap-el","focus-start-el","onFocusAfterTrapped","onFocusAfterReleased","onFocusin","onFocusoutPrevented","onReleaseRequested"])],16,["onMouseenter","onMouseleave"]))}});var ElPopperContent=_export_sfc(_sfc_main$h,[["__file","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:Boolean,persistent:Boolean,visible:{type:definePropType(Boolean),default:null},transition:String,teleported:{type:Boolean,default:!0},disabled:Boolean,...useAriaProps(["ariaLabel"])}),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=(i,r)=>isArray(i)?i.includes(r):i===r,whenTrigger=(i,r,n)=>o=>{isTriggerType(vue.unref(i),r)&&n(o)},__default__$3=vue.defineComponent({name:"ElTooltipTrigger"}),_sfc_main$g=vue.defineComponent({...__default__$3,props:useTooltipTriggerProps,setup(i,{expose:r}){const n=i,o=useNamespace("tooltip"),{controlled:a,id:u,open:c,onOpen:d,onClose:f,onToggle:h}=vue.inject(TOOLTIP_INJECTION_KEY,void 0),y=vue.ref(null),g=()=>{if(vue.unref(a)||n.disabled)return!0},p=vue.toRef(n,"trigger"),v=composeEventHandlers(g,whenTrigger(p,"hover",d)),_=composeEventHandlers(g,whenTrigger(p,"hover",f)),b=composeEventHandlers(g,whenTrigger(p,"click",x=>{x.button===0&&h(x)})),A=composeEventHandlers(g,whenTrigger(p,"focus",d)),w=composeEventHandlers(g,whenTrigger(p,"focus",f)),T=composeEventHandlers(g,whenTrigger(p,"contextmenu",x=>{x.preventDefault(),h(x)})),S=composeEventHandlers(g,x=>{const{code:L}=x;n.triggerKeys.includes(L)&&(x.preventDefault(),h(x))});return r({triggerRef:y}),(x,L)=>(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(w),onClick:vue.unref(b),onContextmenu:vue.unref(T),onFocus:vue.unref(A),onMouseenter:vue.unref(v),onMouseleave:vue.unref(_),onKeydown:vue.unref(S)},{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$g,[["__file","trigger.vue"]]);const teleportProps=buildProps({to:{type:definePropType([String,Object]),required:!0},disabled:Boolean}),_sfc_main$f=vue.defineComponent({__name:"teleport",props:teleportProps,setup(i){return(r,n)=>r.disabled?vue.renderSlot(r.$slots,"default",{key:0}):(vue.openBlock(),vue.createBlock(vue.Teleport,{key:1,to:r.to},[vue.renderSlot(r.$slots,"default")],8,["to"]))}});var Teleport=_export_sfc(_sfc_main$f,[["__file","teleport.vue"]]);const ElTeleport=withInstall(Teleport),__default__$2=vue.defineComponent({name:"ElTooltipContent",inheritAttrs:!1}),_sfc_main$e=vue.defineComponent({...__default__$2,props:useTooltipContentProps,setup(i,{expose:r}){const n=i,{selector:o}=usePopperContainerId(),a=useNamespace("tooltip"),u=vue.ref(null);let c;const{controlled:d,id:f,open:h,trigger:y,onClose:g,onOpen:p,onShow:v,onHide:_,onBeforeShow:b,onBeforeHide:A}=vue.inject(TOOLTIP_INJECTION_KEY,void 0),w=vue.computed(()=>n.transition||`${a.namespace.value}-fade-in-linear`),T=vue.computed(()=>process.env.NODE_ENV==="test"?!0:n.persistent);vue.onBeforeUnmount(()=>{c==null||c()});const S=vue.computed(()=>vue.unref(T)?!0:vue.unref(h)),x=vue.computed(()=>n.disabled?!1:vue.unref(h)),L=vue.computed(()=>n.appendTo||o.value),M=vue.computed(()=>{var de;return(de=n.style)!=null?de:{}}),O=vue.computed(()=>!vue.unref(h)),ie=()=>{_()},$=()=>{if(vue.unref(d))return!0},z=composeEventHandlers($,()=>{n.enterable&&vue.unref(y)==="hover"&&p()}),V=composeEventHandlers($,()=>{vue.unref(y)==="hover"&&g()}),re=()=>{var de,Fe;(Fe=(de=u.value)==null?void 0:de.updatePopper)==null||Fe.call(de),b==null||b()},F=()=>{A==null||A()},pe=()=>{v(),c=onClickOutside(vue.computed(()=>{var de;return(de=u.value)==null?void 0:de.popperContentRef}),()=>{if(vue.unref(d))return;vue.unref(y)!=="hover"&&g()})},le=()=>{n.virtualTriggering||g()};return vue.watch(()=>vue.unref(h),de=>{de||c==null||c()},{flush:"post"}),vue.watch(()=>n.content,()=>{var de,Fe;(Fe=(de=u.value)==null?void 0:de.updatePopper)==null||Fe.call(de)}),r({contentRef:u}),(de,Fe)=>(vue.openBlock(),vue.createBlock(vue.unref(ElTeleport),{disabled:!de.teleported,to:vue.unref(L)},{default:vue.withCtx(()=>[vue.createVNode(vue.Transition,{name:vue.unref(w),onAfterLeave:ie,onBeforeEnter:re,onAfterEnter:pe,onBeforeLeave:F},{default:vue.withCtx(()=>[vue.unref(S)?vue.withDirectives((vue.openBlock(),vue.createBlock(vue.unref(ElPopperContent),vue.mergeProps({key:0,id:vue.unref(f),ref_key:"contentRef",ref:u},de.$attrs,{"aria-label":de.ariaLabel,"aria-hidden":vue.unref(O),"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(z),onMouseleave:vue.unref(V),onBlur:le,onClose:vue.unref(g)}),{default:vue.withCtx(()=>[vue.renderSlot(de.$slots,"default")]),_: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"])]),_:3},8,["disabled","to"]))}});var ElTooltipContent=_export_sfc(_sfc_main$e,[["__file","content.vue"]]);const __default__$1=vue.defineComponent({name:"ElTooltip"}),_sfc_main$d=vue.defineComponent({...__default__$1,props:useTooltipProps,emits:tooltipEmits,setup(i,{expose:r,emit:n}){const o=i;usePopperContainer();const a=useId(),u=vue.ref(),c=vue.ref(),d=()=>{var w;const T=vue.unref(u);T&&((w=T.popperInstanceRef)==null||w.update())},f=vue.ref(!1),h=vue.ref(),{show:y,hide:g,hasUpdateHandler:p}=useTooltipModelToggle({indicator:f,toggleReason:h}),{onOpen:v,onClose:_}=useDelayedToggle({showAfter:vue.toRef(o,"showAfter"),hideAfter:vue.toRef(o,"hideAfter"),autoClose:vue.toRef(o,"autoClose"),open:y,close:g}),b=vue.computed(()=>isBoolean(o.visible)&&!p.value);vue.provide(TOOLTIP_INJECTION_KEY,{controlled:b,id:a,open:vue.readonly(f),trigger:vue.toRef(o,"trigger"),onOpen:w=>{v(w)},onClose:w=>{_(w)},onToggle:w=>{vue.unref(f)?_(w):v(w)},onShow:()=>{n("show",h.value)},onHide:()=>{n("hide",h.value)},onBeforeShow:()=>{n("before-show",h.value)},onBeforeHide:()=>{n("before-hide",h.value)},updatePopper:d}),vue.watch(()=>o.disabled,w=>{w&&f.value&&(f.value=!1)});const A=w=>{var T,S;const x=(S=(T=c.value)==null?void 0:T.contentRef)==null?void 0:S.popperContentRef,L=(w==null?void 0:w.relatedTarget)||document.activeElement;return x&&x.contains(L)};return vue.onDeactivated(()=>f.value&&g()),r({popperRef:u,contentRef:c,isFocusInsideContent:A,updatePopper:d,onOpen:v,onClose:_,hide:g}),(w,T)=>(vue.openBlock(),vue.createBlock(vue.unref(ElPopper),{ref_key:"popperRef",ref:u,role:w.role},{default:vue.withCtx(()=>[vue.createVNode(ElTooltipTrigger,{disabled:w.disabled,trigger:w.trigger,"trigger-keys":w.triggerKeys,"virtual-ref":w.virtualRef,"virtual-triggering":w.virtualTriggering},{default:vue.withCtx(()=>[w.$slots.default?vue.renderSlot(w.$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":w.ariaLabel,"boundaries-padding":w.boundariesPadding,content:w.content,disabled:w.disabled,effect:w.effect,enterable:w.enterable,"fallback-placements":w.fallbackPlacements,"hide-after":w.hideAfter,"gpu-acceleration":w.gpuAcceleration,offset:w.offset,persistent:w.persistent,"popper-class":w.popperClass,"popper-style":w.popperStyle,placement:w.placement,"popper-options":w.popperOptions,pure:w.pure,"raw-content":w.rawContent,"reference-el":w.referenceEl,"trigger-target-el":w.triggerTargetEl,"show-after":w.showAfter,strategy:w.strategy,teleported:w.teleported,transition:w.transition,"virtual-triggering":w.virtualTriggering,"z-index":w.zIndex,"append-to":w.appendTo},{default:vue.withCtx(()=>[vue.renderSlot(w.$slots,"content",{},()=>[w.rawContent?(vue.openBlock(),vue.createElementBlock("span",{key:0,innerHTML:w.content},null,8,["innerHTML"])):(vue.openBlock(),vue.createElementBlock("span",{key:1},vue.toDisplayString(w.content),1))]),w.showArrow?(vue.openBlock(),vue.createBlock(vue.unref(ElPopperArrow),{key:0,"arrow-offset":w.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","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;if(isClient){let i;document.addEventListener("mousedown",r=>i=r),document.addEventListener("mouseup",r=>{if(i){for(const n of nodeList.values())for(const{documentHandler:o}of n)o(r,i);i=void 0}})}function createDocumentHandler(i,r){let n=[];return Array.isArray(r.arg)?n=r.arg:isElement(r.arg)&&n.push(r.arg),function(o,a){const u=r.instance.popperRef,c=o.target,d=a==null?void 0:a.target,f=!r||!r.instance,h=!c||!d,y=i.contains(c)||i.contains(d),g=i===c,p=n.length&&n.some(_=>_==null?void 0:_.contains(c))||n.length&&n.includes(d),v=u&&(u.contains(c)||u.contains(d));f||h||y||g||p||v||r.value(o,a)}}const ClickOutside={beforeMount(i,r){nodeList.has(i)||nodeList.set(i,[]),nodeList.get(i).push({documentHandler:createDocumentHandler(i,r),bindingFn:r.value})},updated(i,r){nodeList.has(i)||nodeList.set(i,[]);const n=nodeList.get(i),o=n.findIndex(u=>u.bindingFn===r.oldValue),a={documentHandler:createDocumentHandler(i,r),bindingFn:r.value};o>=0?n.splice(o,1,a):n.push(a)},unmounted(i){nodeList.delete(i)}},tagProps=buildProps({type:{type:String,values:["primary","success","info","warning","danger"],default:"primary"},closable:Boolean,disableTransitions:Boolean,hit:Boolean,color:String,size:{type:String,values:componentSizes},effect:{type:String,values:["dark","light","plain"],default:"light"},round:Boolean}),tagEmits={close:i=>i instanceof MouseEvent,click:i=>i instanceof MouseEvent},__default__=vue.defineComponent({name:"ElTag"}),_sfc_main$c=vue.defineComponent({...__default__,props:tagProps,emits:tagEmits,setup(i,{emit:r}){const n=i,o=useFormSize(),a=useNamespace("tag"),u=vue.computed(()=>{const{type:f,hit:h,effect:y,closable:g,round:p}=n;return[a.b(),a.is("closable",g),a.m(f||"primary"),a.m(o.value),a.m(y),a.is("hit",h),a.is("round",p)]}),c=f=>{r("close",f)},d=f=>{r("click",f)};return(f,h)=>f.disableTransitions?(vue.openBlock(),vue.createElementBlock("span",{key:0,class:vue.normalizeClass(vue.unref(u)),style:vue.normalizeStyle({backgroundColor:f.color}),onClick:d},[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(a).e("content"))},[vue.renderSlot(f.$slots,"default")],2),f.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:f.color}),onClick:d},[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(a).e("content"))},[vue.renderSlot(f.$slots,"default")],2),f.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","tag.vue"]]);const ElTag=withInstall(Tag),selectGroupKey=Symbol("ElSelectGroup"),selectKey=Symbol("ElSelect");function useOption(i,r){const n=vue.inject(selectKey),o=vue.inject(selectGroupKey,{disabled:!1}),a=vue.computed(()=>y(lodashEs.castArray(n.props.modelValue),i.value)),u=vue.computed(()=>{var v;if(n.props.multiple){const _=lodashEs.castArray((v=n.props.modelValue)!=null?v:[]);return!a.value&&_.length>=n.props.multipleLimit&&n.props.multipleLimit>0}else return!1}),c=vue.computed(()=>i.label||(isObject(i.value)?"":i.value)),d=vue.computed(()=>i.value||i.label||""),f=vue.computed(()=>i.disabled||r.groupDisabled||u.value),h=vue.getCurrentInstance(),y=(v=[],_)=>{if(isObject(i.value)){const b=n.props.valueKey;return v&&v.some(A=>vue.toRaw(lodashEs.get(A,b))===lodashEs.get(_,b))}else return v&&v.includes(_)},g=()=>{!i.disabled&&!o.disabled&&(n.states.hoveringIndex=n.optionsArray.indexOf(h.proxy))},p=v=>{const _=new RegExp(escapeStringRegexp(v),"i");r.visible=_.test(c.value)||i.created};return vue.watch(()=>c.value,()=>{!i.created&&!n.props.remote&&n.setSelected()}),vue.watch(()=>i.value,(v,_)=>{const{remote:b,valueKey:A}=n.props;if(v!==_&&(n.onOptionDestroy(_,h.proxy),n.onOptionCreate(h.proxy)),!i.created&&!b){if(A&&isObject(v)&&isObject(_)&&v[A]===_[A])return;n.setSelected()}}),vue.watch(()=>o.disabled,()=>{r.groupDisabled=o.disabled},{immediate:!0}),{select:n,currentLabel:c,currentValue:d,itemSelected:a,isDisabled:f,hoverItem:g,updateOption:p}}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:Boolean},setup(i){const r=useNamespace("select"),n=useId(),o=vue.computed(()=>[r.be("dropdown","item"),r.is("disabled",vue.unref(d)),r.is("selected",vue.unref(c)),r.is("hovering",vue.unref(p))]),a=vue.reactive({index:-1,groupDisabled:!1,visible:!0,hover:!1}),{currentLabel:u,itemSelected:c,isDisabled:d,select:f,hoverItem:h,updateOption:y}=useOption(i,a),{visible:g,hover:p}=vue.toRefs(a),v=vue.getCurrentInstance().proxy;f.onOptionCreate(v),vue.onBeforeUnmount(()=>{const b=v.value,{selected:A}=f.states,T=(f.props.multiple?A:[A]).some(S=>S.value===v.value);vue.nextTick(()=>{f.states.cachedOptions.get(b)===v&&!T&&f.states.cachedOptions.delete(b)}),f.onOptionDestroy(b,v)});function _(){d.value||f.handleOptionSelect(v)}return{ns:r,id:n,containerKls:o,currentLabel:u,itemSelected:c,isDisabled:d,select:f,hoverItem:h,updateOption:y,visible:g,hover:p,selectOptionClick:_,states:a}}});function _sfc_render$3(i,r,n,o,a,u){return vue.withDirectives((vue.openBlock(),vue.createElementBlock("li",{id:i.id,class:vue.normalizeClass(i.containerKls),role:"option","aria-disabled":i.isDisabled||void 0,"aria-selected":i.itemSelected,onMouseenter:i.hoverItem,onClick:vue.withModifiers(i.selectOptionClick,["stop"])},[vue.renderSlot(i.$slots,"default",{},()=>[vue.createElementVNode("span",null,vue.toDisplayString(i.currentLabel),1)])],42,["id","aria-disabled","aria-selected","onMouseenter","onClick"])),[[vue.vShow,i.visible]])}var Option=_export_sfc(_sfc_main$b,[["render",_sfc_render$3],["__file","option.vue"]]);const _sfc_main$a=vue.defineComponent({name:"ElSelectDropdown",componentName:"ElSelectDropdown",setup(){const i=vue.inject(selectKey),r=useNamespace("select"),n=vue.computed(()=>i.props.popperClass),o=vue.computed(()=>i.props.multiple),a=vue.computed(()=>i.props.fitInputWidth),u=vue.ref("");function c(){var d;u.value=`${(d=i.selectRef)==null?void 0:d.offsetWidth}px`}return vue.onMounted(()=>{c(),useResizeObserver(i.selectRef,c)}),{ns:r,minWidth:u,popperClass:n,isMultiple:o,isFitInputWidth:a}}});function _sfc_render$2(i,r,n,o,a,u){return vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass([i.ns.b("dropdown"),i.ns.is("multiple",i.isMultiple),i.popperClass]),style:vue.normalizeStyle({[i.isFitInputWidth?"width":"minWidth"]:i.minWidth})},[i.$slots.header?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:vue.normalizeClass(i.ns.be("dropdown","header"))},[vue.renderSlot(i.$slots,"header")],2)):vue.createCommentVNode("v-if",!0),vue.renderSlot(i.$slots,"default"),i.$slots.footer?(vue.openBlock(),vue.createElementBlock("div",{key:1,class:vue.normalizeClass(i.ns.be("dropdown","footer"))},[vue.renderSlot(i.$slots,"footer")],2)):vue.createCommentVNode("v-if",!0)],6)}var ElSelectMenu=_export_sfc(_sfc_main$a,[["render",_sfc_render$2],["__file","select-dropdown.vue"]]);const MINIMUM_INPUT_WIDTH=11,useSelect=(i,r)=>{const{t:n}=useLocale(),o=useId(),a=useNamespace("select"),u=useNamespace("input"),c=vue.reactive({inputValue:"",options:new Map,cachedOptions:new Map,disabledOptions:new Map,optionValues:[],selected:i.multiple?[]:{},selectionWidth:0,calculatorWidth:0,collapseItemWidth:0,selectedLabel:"",hoveringIndex:-1,previousQuery:null,inputHovering:!1,menuVisibleOnFocus:!1,isBeforeHide:!1}),d=vue.ref(null),f=vue.ref(null),h=vue.ref(null),y=vue.ref(null),g=vue.ref(null),p=vue.ref(null),v=vue.ref(null),_=vue.ref(null),b=vue.ref(null),A=vue.ref(null),w=vue.ref(null),T=vue.ref(null),{isComposing:S,handleCompositionStart:x,handleCompositionUpdate:L,handleCompositionEnd:M}=useComposition({afterComposition:bn=>xn(bn)}),{wrapperRef:O,isFocused:ie,handleBlur:$}=useFocusController(g,{afterFocus(){i.automaticDropdown&&!z.value&&(z.value=!0,c.menuVisibleOnFocus=!0)},beforeBlur(bn){var En,Rn;return((En=h.value)==null?void 0:En.isFocusInsideContent(bn))||((Rn=y.value)==null?void 0:Rn.isFocusInsideContent(bn))},afterBlur(){z.value=!1,c.menuVisibleOnFocus=!1}}),z=vue.ref(!1),V=vue.ref(),{form:re,formItem:F}=useFormItem(),{inputId:pe}=useFormItemInputId(i,{formItemContext:F}),{valueOnClear:le,isEmptyValue:de}=useEmptyValues(i),Fe=vue.computed(()=>i.disabled||(re==null?void 0:re.disabled)),Ie=vue.computed(()=>isArray(i.modelValue)?i.modelValue.length>0:!de(i.modelValue)),At=vue.computed(()=>i.clearable&&!Fe.value&&c.inputHovering&&Ie.value),_e=vue.computed(()=>i.remote&&i.filterable&&!i.remoteShowSuffix?"":i.suffixIcon),qe=vue.computed(()=>a.is("reverse",_e.value&&z.value)),In=vue.computed(()=>(F==null?void 0:F.validateState)||""),vn=vue.computed(()=>ValidateComponentsMap[In.value]),Pt=vue.computed(()=>i.remote?300:0),he=vue.computed(()=>i.loading?i.loadingText||n("el.select.loading"):i.remote&&!c.inputValue&&c.options.size===0?!1:i.filterable&&c.inputValue&&c.options.size>0&&Ue.value===0?i.noMatchText||n("el.select.noMatch"):c.options.size===0?i.noDataText||n("el.select.noData"):null),Ue=vue.computed(()=>Dt.value.filter(bn=>bn.visible).length),Dt=vue.computed(()=>{const bn=Array.from(c.options.values()),En=[];return c.optionValues.forEach(Rn=>{const Bn=bn.findIndex(Dn=>Dn.value===Rn);Bn>-1&&En.push(bn[Bn])}),En.length>=bn.length?En:bn}),jt=vue.computed(()=>Array.from(c.cachedOptions.values())),Et=vue.computed(()=>{const bn=Dt.value.filter(En=>!En.created).some(En=>En.currentLabel===c.inputValue);return i.filterable&&i.allowCreate&&c.inputValue!==""&&!bn}),Ce=()=>{i.filterable&&isFunction(i.filterMethod)||i.filterable&&i.remote&&isFunction(i.remoteMethod)||Dt.value.forEach(bn=>{var En;(En=bn.updateOption)==null||En.call(bn,c.inputValue)})},ue=useFormSize(),$e=vue.computed(()=>["small"].includes(ue.value)?"small":"default"),Ne=vue.computed({get(){return z.value&&he.value!==!1},set(bn){z.value=bn}}),Oe=vue.computed(()=>{if(i.multiple&&!isUndefined(i.modelValue))return lodashEs.castArray(i.modelValue).length===0&&!c.inputValue;const bn=isArray(i.modelValue)?i.modelValue[0]:i.modelValue;return i.filterable||isUndefined(bn)?!c.inputValue:!0}),Lt=vue.computed(()=>{var bn;const En=(bn=i.placeholder)!=null?bn:n("el.select.placeholder");return i.multiple||!Ie.value?En:c.selectedLabel}),kt=vue.computed(()=>isIOS?null:"mouseenter");vue.watch(()=>i.modelValue,(bn,En)=>{i.multiple&&i.filterable&&!i.reserveKeyword&&(c.inputValue="",Cn("")),ae(),!lodashEs.isEqual(bn,En)&&i.validateEvent&&(F==null||F.validate("change").catch(Rn=>debugWarn(Rn)))},{flush:"post",deep:!0}),vue.watch(()=>z.value,bn=>{bn?Cn(c.inputValue):(c.inputValue="",c.previousQuery=null,c.isBeforeHide=!0),r("visible-change",bn)}),vue.watch(()=>c.options.entries(),()=>{var bn;if(!isClient)return;const En=((bn=d.value)==null?void 0:bn.querySelectorAll("input"))||[];(!i.filterable&&!i.defaultFirstOption&&!isUndefined(i.modelValue)||!Array.from(En).includes(document.activeElement))&&ae(),i.defaultFirstOption&&(i.filterable||i.remote)&&Ue.value&&oe()},{flush:"post"}),vue.watch(()=>c.hoveringIndex,bn=>{isNumber(bn)&&bn>-1?V.value=Dt.value[bn]||{}:V.value={},Dt.value.forEach(En=>{En.hover=V.value===En})}),vue.watchEffect(()=>{c.isBeforeHide||Ce()});const Cn=bn=>{c.previousQuery===bn||S.value||(c.previousQuery=bn,i.filterable&&isFunction(i.filterMethod)?i.filterMethod(bn):i.filterable&&i.remote&&isFunction(i.remoteMethod)&&i.remoteMethod(bn),i.defaultFirstOption&&(i.filterable||i.remote)&&Ue.value?vue.nextTick(oe):vue.nextTick(k))},oe=()=>{const bn=Dt.value.filter(Bn=>Bn.visible&&!Bn.disabled&&!Bn.states.groupDisabled),En=bn.find(Bn=>Bn.created),Rn=bn[0];c.hoveringIndex=Nn(Dt.value,En||Rn)},ae=()=>{if(i.multiple)c.selectedLabel="";else{const En=isArray(i.modelValue)?i.modelValue[0]:i.modelValue,Rn=Y(En);c.selectedLabel=Rn.currentLabel,c.selected=Rn;return}const bn=[];isUndefined(i.modelValue)||lodashEs.castArray(i.modelValue).forEach(En=>{bn.push(Y(En))}),c.selected=bn},Y=bn=>{let En;const Rn=toRawType(bn).toLowerCase()==="object",Bn=toRawType(bn).toLowerCase()==="null",Dn=toRawType(bn).toLowerCase()==="undefined";for(let Zn=c.cachedOptions.size-1;Zn>=0;Zn--){const kn=jt.value[Zn];if(Rn?lodashEs.get(kn.value,i.valueKey)===lodashEs.get(bn,i.valueKey):kn.value===bn){En={value:bn,currentLabel:kn.currentLabel,get isDisabled(){return kn.isDisabled}};break}}if(En)return En;const Hn=Rn?bn.label:!Bn&&!Dn?bn:"";return{value:bn,currentLabel:Hn}},k=()=>{i.multiple?c.hoveringIndex=Dt.value.findIndex(bn=>c.selected.some(En=>Un(En)===Un(bn))):c.hoveringIndex=Dt.value.findIndex(bn=>Un(bn)===Un(c.selected))},D=()=>{c.selectionWidth=f.value.getBoundingClientRect().width},j=()=>{c.calculatorWidth=p.value.getBoundingClientRect().width},xe=()=>{c.collapseItemWidth=w.value.getBoundingClientRect().width},hn=()=>{var bn,En;(En=(bn=h.value)==null?void 0:bn.updatePopper)==null||En.call(bn)},_n=()=>{var bn,En;(En=(bn=y.value)==null?void 0:bn.updatePopper)==null||En.call(bn)},Sn=()=>{c.inputValue.length>0&&!z.value&&(z.value=!0),Cn(c.inputValue)},xn=bn=>{if(c.inputValue=bn.target.value,i.remote)Ln();else return Sn()},Ln=lodashEs.debounce(()=>{Sn()},Pt.value),Ve=bn=>{lodashEs.isEqual(i.modelValue,bn)||r(CHANGE_EVENT,bn)},ze=bn=>lodashEs.findLastIndex(bn,En=>!c.disabledOptions.has(En)),wn=bn=>{if(i.multiple&&bn.code!==EVENT_CODE.delete&&bn.target.value.length<=0){const En=lodashEs.castArray(i.modelValue).slice(),Rn=ze(En);if(Rn<0)return;const Bn=En[Rn];En.splice(Rn,1),r(UPDATE_MODEL_EVENT,En),Ve(En),r("remove-tag",Bn)}},An=(bn,En)=>{const Rn=c.selected.indexOf(En);if(Rn>-1&&!Fe.value){const Bn=lodashEs.castArray(i.modelValue).slice();Bn.splice(Rn,1),r(UPDATE_MODEL_EVENT,Bn),Ve(Bn),r("remove-tag",En.value)}bn.stopPropagation(),Fn()},Tn=bn=>{bn.stopPropagation();const En=i.multiple?[]:le.value;if(i.multiple)for(const Rn of c.selected)Rn.isDisabled&&En.push(Rn.value);r(UPDATE_MODEL_EVENT,En),Ve(En),c.hoveringIndex=-1,z.value=!1,r("clear"),Fn()},Pn=bn=>{var En;if(i.multiple){const Rn=lodashEs.castArray((En=i.modelValue)!=null?En:[]).slice(),Bn=Nn(Rn,bn.value);Bn>-1?Rn.splice(Bn,1):(i.multipleLimit<=0||Rn.length<i.multipleLimit)&&Rn.push(bn.value),r(UPDATE_MODEL_EVENT,Rn),Ve(Rn),bn.created&&Cn(""),i.filterable&&!i.reserveKeyword&&(c.inputValue="")}else r(UPDATE_MODEL_EVENT,bn.value),Ve(bn.value),z.value=!1;Fn(),!z.value&&vue.nextTick(()=>{Gn(bn)})},Nn=(bn=[],En)=>{if(!isObject(En))return bn.indexOf(En);const Rn=i.valueKey;let Bn=-1;return bn.some((Dn,Hn)=>vue.toRaw(lodashEs.get(Dn,Rn))===lodashEs.get(En,Rn)?(Bn=Hn,!0):!1),Bn},Gn=bn=>{var En,Rn,Bn,Dn,Hn;const jn=isArray(bn)?bn[0]:bn;let Zn=null;if(jn!=null&&jn.value){const kn=Dt.value.filter(qn=>qn.value===jn.value);kn.length>0&&(Zn=kn[0].$el)}if(h.value&&Zn){const kn=(Dn=(Bn=(Rn=(En=h.value)==null?void 0:En.popperRef)==null?void 0:Rn.contentRef)==null?void 0:Bn.querySelector)==null?void 0:Dn.call(Bn,`.${a.be("dropdown","wrap")}`);kn&&scrollIntoView(kn,Zn)}(Hn=T.value)==null||Hn.handleScroll()},Vn=bn=>{c.options.set(bn.value,bn),c.cachedOptions.set(bn.value,bn),bn.disabled&&c.disabledOptions.set(bn.value,bn)},Kn=(bn,En)=>{c.options.get(bn)===En&&c.options.delete(bn)},Jn=vue.computed(()=>{var bn,En;return(En=(bn=h.value)==null?void 0:bn.popperRef)==null?void 0:En.contentRef}),Xn=()=>{c.isBeforeHide=!1,vue.nextTick(()=>Gn(c.selected))},Fn=()=>{var bn;(bn=g.value)==null||bn.focus()},zn=()=>{$n()},Yn=bn=>{Tn(bn)},$n=bn=>{if(z.value=!1,ie.value){const En=new FocusEvent("focus",bn);vue.nextTick(()=>$(En))}},Wn=()=>{c.inputValue.length>0?c.inputValue="":z.value=!1},On=()=>{Fe.value||(isIOS&&(c.inputHovering=!0),c.menuVisibleOnFocus?c.menuVisibleOnFocus=!1:z.value=!z.value)},Mn=()=>{z.value?Dt.value[c.hoveringIndex]&&Pn(Dt.value[c.hoveringIndex]):On()},Un=bn=>isObject(bn.value)?lodashEs.get(bn.value,i.valueKey):bn.value,er=vue.computed(()=>Dt.value.filter(bn=>bn.visible).every(bn=>bn.disabled)),tr=vue.computed(()=>i.multiple?i.collapseTags?c.selected.slice(0,i.maxCollapseTags):c.selected:[]),nr=vue.computed(()=>i.multiple?i.collapseTags?c.selected.slice(i.maxCollapseTags):[]:[]),Qn=bn=>{if(!z.value){z.value=!0;return}if(!(c.options.size===0||c.filteredOptionsCount===0||S.value)&&!er.value){bn==="next"?(c.hoveringIndex++,c.hoveringIndex===c.options.size&&(c.hoveringIndex=0)):bn==="prev"&&(c.hoveringIndex--,c.hoveringIndex<0&&(c.hoveringIndex=c.options.size-1));const En=Dt.value[c.hoveringIndex];(En.disabled===!0||En.states.groupDisabled===!0||!En.visible)&&Qn(bn),vue.nextTick(()=>Gn(V.value))}},rr=()=>{if(!f.value)return 0;const bn=window.getComputedStyle(f.value);return Number.parseFloat(bn.gap||"6px")},ir=vue.computed(()=>{const bn=rr();return{maxWidth:`${w.value&&i.maxCollapseTags===1?c.selectionWidth-c.collapseItemWidth-bn:c.selectionWidth}px`}}),or=vue.computed(()=>({maxWidth:`${c.selectionWidth}px`})),ar=vue.computed(()=>({width:`${Math.max(c.calculatorWidth,MINIMUM_INPUT_WIDTH)}px`}));return useResizeObserver(f,D),useResizeObserver(p,j),useResizeObserver(b,hn),useResizeObserver(O,hn),useResizeObserver(A,_n),useResizeObserver(w,xe),vue.onMounted(()=>{ae()}),{inputId:pe,contentId:o,nsSelect:a,nsInput:u,states:c,isFocused:ie,expanded:z,optionsArray:Dt,hoverOption:V,selectSize:ue,filteredOptionsCount:Ue,resetCalculatorWidth:j,updateTooltip:hn,updateTagTooltip:_n,debouncedOnInputChange:Ln,onInput:xn,deletePrevTag:wn,deleteTag:An,deleteSelected:Tn,handleOptionSelect:Pn,scrollToOption:Gn,hasModelValue:Ie,shouldShowPlaceholder:Oe,currentPlaceholder:Lt,mouseEnterEventName:kt,showClose:At,iconComponent:_e,iconReverse:qe,validateState:In,validateIcon:vn,showNewOption:Et,updateOptions:Ce,collapseTagSize:$e,setSelected:ae,selectDisabled:Fe,emptyText:he,handleCompositionStart:x,handleCompositionUpdate:L,handleCompositionEnd:M,onOptionCreate:Vn,onOptionDestroy:Kn,handleMenuEnter:Xn,focus:Fn,blur:zn,handleClearClick:Yn,handleClickOutside:$n,handleEsc:Wn,toggleMenu:On,selectOption:Mn,getValueKey:Un,navigateOptions:Qn,dropdownMenuVisible:Ne,showTagList:tr,collapseTagList:nr,tagStyle:ir,collapseTagStyle:or,inputStyle:ar,popperRef:Jn,inputRef:g,tooltipRef:h,tagTooltipRef:y,calculatorRef:p,prefixRef:v,suffixRef:_,selectRef:d,wrapperRef:O,selectionRef:f,scrollbarRef:T,menuRef:b,tagMenuRef:A,collapseItemRef:w}};var ElOptions=vue.defineComponent({name:"ElOptions",setup(i,{slots:r}){const n=vue.inject(selectKey);let o=[];return()=>{var a,u;const c=(a=r.default)==null?void 0:a.call(r),d=[];function f(h){isArray(h)&&h.forEach(y=>{var g,p,v,_;const b=(g=(y==null?void 0:y.type)||{})==null?void 0:g.name;b==="ElOptionGroup"?f(!isString(y.children)&&!isArray(y.children)&&isFunction((p=y.children)==null?void 0:p.default)?(v=y.children)==null?void 0:v.default():y.children):b==="ElOption"?d.push((_=y.props)==null?void 0:_.value):isArray(y.children)&&f(y.children)})}return c.length&&f((u=c[0])==null?void 0:u.children),lodashEs.isEqual(d,o)||(o=d,n&&(n.states.optionValues=d)),c}}});const SelectProps=buildProps({name:String,id:String,modelValue:{type:[Array,String,Number,Boolean,Object],default:void 0},autocomplete:{type:String,default:"off"},automaticDropdown:Boolean,size:useSizeProp,effect:{type:definePropType(String),default:"light"},disabled:Boolean,clearable:Boolean,filterable:Boolean,allowCreate:Boolean,loading:Boolean,popperClass:{type:String,default:""},popperOptions:{type:definePropType(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:Boolean,maxCollapseTags:{type:Number,default:1},teleported:useTooltipContentProps.teleported,persistent:{type:Boolean,default:!0},clearIcon:{type:iconPropType,default:circle_close_default},fitInputWidth:Boolean,suffixIcon:{type:iconPropType,default:arrow_down_default},tagType:{...tagProps.type,default:"info"},tagEffect:{...tagProps.effect,default:"light"},validateEvent:{type:Boolean,default:!0},remoteShowSuffix:Boolean,placement:{type:definePropType(String),values:Ee,default:"bottom-start"},fallbackPlacements:{type:definePropType(Array),default:["bottom-start","top-start","right","left"]},...useEmptyValuesProps,...useAriaProps(["ariaLabel"])}),COMPONENT_NAME="ElSelect",_sfc_main$9=vue.defineComponent({name:COMPONENT_NAME,componentName:COMPONENT_NAME,components:{ElSelectMenu,ElOption:Option,ElOptions,ElTag,ElScrollbar,ElTooltip,ElIcon},directives:{ClickOutside},props:SelectProps,emits:[UPDATE_MODEL_EVENT,CHANGE_EVENT,"remove-tag","clear","visible-change","focus","blur"],setup(i,{emit:r}){const n=useSelect(i,r);return vue.provide(selectKey,vue.reactive({props:i,states:n.states,optionsArray:n.optionsArray,handleOptionSelect:n.handleOptionSelect,onOptionCreate:n.onOptionCreate,onOptionDestroy:n.onOptionDestroy,selectRef:n.selectRef,setSelected:n.setSelected})),{...n}}});function _sfc_render$1(i,r,n,o,a,u){const c=vue.resolveComponent("el-tag"),d=vue.resolveComponent("el-tooltip"),f=vue.resolveComponent("el-icon"),h=vue.resolveComponent("el-option"),y=vue.resolveComponent("el-options"),g=vue.resolveComponent("el-scrollbar"),p=vue.resolveComponent("el-select-menu"),v=vue.resolveDirective("click-outside");return vue.withDirectives((vue.openBlock(),vue.createElementBlock("div",{ref:"selectRef",class:vue.normalizeClass([i.nsSelect.b(),i.nsSelect.m(i.selectSize)]),[vue.toHandlerKey(i.mouseEnterEventName)]:_=>i.states.inputHovering=!0,onMouseleave:_=>i.states.inputHovering=!1},[vue.createVNode(d,{ref:"tooltipRef",visible:i.dropdownMenuVisible,placement:i.placement,teleported:i.teleported,"popper-class":[i.nsSelect.e("popper"),i.popperClass],"popper-options":i.popperOptions,"fallback-placements":i.fallbackPlacements,effect:i.effect,pure:"",trigger:"click",transition:`${i.nsSelect.namespace.value}-zoom-in-top`,"stop-popper-mouse-event":!1,"gpu-acceleration":!1,persistent:i.persistent,onBeforeShow:i.handleMenuEnter,onHide:_=>i.states.isBeforeHide=!1},{default:vue.withCtx(()=>{var _;return[vue.createElementVNode("div",{ref:"wrapperRef",class:vue.normalizeClass([i.nsSelect.e("wrapper"),i.nsSelect.is("focused",i.isFocused),i.nsSelect.is("hovering",i.states.inputHovering),i.nsSelect.is("filterable",i.filterable),i.nsSelect.is("disabled",i.selectDisabled)]),onClick:vue.withModifiers(i.toggleMenu,["prevent","stop"])},[i.$slots.prefix?(vue.openBlock(),vue.createElementBlock("div",{key:0,ref:"prefixRef",class:vue.normalizeClass(i.nsSelect.e("prefix"))},[vue.renderSlot(i.$slots,"prefix")],2)):vue.createCommentVNode("v-if",!0),vue.createElementVNode("div",{ref:"selectionRef",class:vue.normalizeClass([i.nsSelect.e("selection"),i.nsSelect.is("near",i.multiple&&!i.$slots.prefix&&!!i.states.selected.length)])},[i.multiple?vue.renderSlot(i.$slots,"tag",{key:0},()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(i.showTagList,b=>(vue.openBlock(),vue.createElementBlock("div",{key:i.getValueKey(b),class:vue.normalizeClass(i.nsSelect.e("selected-item"))},[vue.createVNode(c,{closable:!i.selectDisabled&&!b.isDisabled,size:i.collapseTagSize,type:i.tagType,effect:i.tagEffect,"disable-transitions":"",style:vue.normalizeStyle(i.tagStyle),onClose:A=>i.deleteTag(A,b)},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(i.nsSelect.e("tags-text"))},[vue.renderSlot(i.$slots,"label",{label:b.currentLabel,value:b.value},()=>[vue.createTextVNode(vue.toDisplayString(b.currentLabel),1)])],2)]),_:2},1032,["closable","size","type","effect","style","onClose"])],2))),128)),i.collapseTags&&i.states.selected.length>i.maxCollapseTags?(vue.openBlock(),vue.createBlock(d,{key:0,ref:"tagTooltipRef",disabled:i.dropdownMenuVisible||!i.collapseTagsTooltip,"fallback-placements":["bottom","top","right","left"],effect:i.effect,placement:"bottom",teleported:i.teleported},{default:vue.withCtx(()=>[vue.createElementVNode("div",{ref:"collapseItemRef",class:vue.normalizeClass(i.nsSelect.e("selected-item"))},[vue.createVNode(c,{closable:!1,size:i.collapseTagSize,type:i.tagType,effect:i.tagEffect,"disable-transitions":"",style:vue.normalizeStyle(i.collapseTagStyle)},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(i.nsSelect.e("tags-text"))}," + "+vue.toDisplayString(i.states.selected.length-i.maxCollapseTags),3)]),_:1},8,["size","type","effect","style"])],2)]),content:vue.withCtx(()=>[vue.createElementVNode("div",{ref:"tagMenuRef",class:vue.normalizeClass(i.nsSelect.e("selection"))},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(i.collapseTagList,b=>(vue.openBlock(),vue.createElementBlock("div",{key:i.getValueKey(b),class:vue.normalizeClass(i.nsSelect.e("selected-item"))},[vue.createVNode(c,{class:"in-tooltip",closable:!i.selectDisabled&&!b.isDisabled,size:i.collapseTagSize,type:i.tagType,effect:i.tagEffect,"disable-transitions":"",onClose:A=>i.deleteTag(A,b)},{default:vue.withCtx(()=>[vue.createElementVNode("span",{class:vue.normalizeClass(i.nsSelect.e("tags-text"))},[vue.renderSlot(i.$slots,"label",{label:b.currentLabel,value:b.value},()=>[vue.createTextVNode(vue.toDisplayString(b.currentLabel),1)])],2)]),_:2},1032,["closable","size","type","effect","onClose"])],2))),128))],2)]),_:3},8,["disabled","effect","teleported"])):vue.createCommentVNode("v-if",!0)]):vue.createCommentVNode("v-if",!0),i.selectDisabled?vue.createCommentVNode("v-if",!0):(vue.openBlock(),vue.createElementBlock("div",{key:1,class:vue.normalizeClass([i.nsSelect.e("selected-item"),i.nsSelect.e("input-wrapper"),i.nsSelect.is("hidden",!i.filterable)])},[vue.withDirectives(vue.createElementVNode("input",{id:i.inputId,ref:"inputRef","onUpdate:modelValue":b=>i.states.inputValue=b,type:"text",name:i.name,class:vue.normalizeClass([i.nsSelect.e("input"),i.nsSelect.is(i.selectSize)]),disabled:i.selectDisabled,autocomplete:i.autocomplete,style:vue.normalizeStyle(i.inputStyle),role:"combobox",readonly:!i.filterable,spellcheck:"false","aria-activedescendant":((_=i.hoverOption)==null?void 0:_.id)||"","aria-controls":i.contentId,"aria-expanded":i.dropdownMenuVisible,"aria-label":i.ariaLabel,"aria-autocomplete":"none","aria-haspopup":"listbox",onKeydown:[vue.withKeys(vue.withModifiers(b=>i.navigateOptions("next"),["stop","prevent"]),["down"]),vue.withKeys(vue.withModifiers(b=>i.navigateOptions("prev"),["stop","prevent"]),["up"]),vue.withKeys(vue.withModifiers(i.handleEsc,["stop","prevent"]),["esc"]),vue.withKeys(vue.withModifiers(i.selectOption,["stop","prevent"]),["enter"]),vue.withKeys(vue.withModifiers(i.deletePrevTag,["stop"]),["delete"])],onCompositionstart:i.handleCompositionStart,onCompositionupdate:i.handleCompositionUpdate,onCompositionend:i.handleCompositionEnd,onInput:i.onInput,onClick:vue.withModifiers(i.toggleMenu,["stop"])},null,46,["id","onUpdate:modelValue","name","disabled","autocomplete","readonly","aria-activedescendant","aria-controls","aria-expanded","aria-label","onKeydown","onCompositionstart","onCompositionupdate","onCompositionend","onInput","onClick"]),[[vue.vModelText,i.states.inputValue]]),i.filterable?(vue.openBlock(),vue.createElementBlock("span",{key:0,ref:"calculatorRef","aria-hidden":"true",class:vue.normalizeClass(i.nsSelect.e("input-calculator")),textContent:vue.toDisplayString(i.states.inputValue)},null,10,["textContent"])):vue.createCommentVNode("v-if",!0)],2)),i.shouldShowPlaceholder?(vue.openBlock(),vue.createElementBlock("div",{key:2,class:vue.normalizeClass([i.nsSelect.e("selected-item"),i.nsSelect.e("placeholder"),i.nsSelect.is("transparent",!i.hasModelValue||i.expanded&&!i.states.inputValue)])},[i.hasModelValue?vue.renderSlot(i.$slots,"label",{key:0,label:i.currentPlaceholder,value:i.modelValue},()=>[vue.createElementVNode("span",null,vue.toDisplayString(i.currentPlaceholder),1)]):(vue.openBlock(),vue.createElementBlock("span",{key:1},vue.toDisplayString(i.currentPlaceholder),1))],2)):vue.createCommentVNode("v-if",!0)],2),vue.createElementVNode("div",{ref:"suffixRef",class:vue.normalizeClass(i.nsSelect.e("suffix"))},[i.iconComponent&&!i.showClose?(vue.openBlock(),vue.createBlock(f,{key:0,class:vue.normalizeClass([i.nsSelect.e("caret"),i.nsSelect.e("icon"),i.iconReverse])},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(i.iconComponent)))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0),i.showClose&&i.clearIcon?(vue.openBlock(),vue.createBlock(f,{key:1,class:vue.normalizeClass([i.nsSelect.e("caret"),i.nsSelect.e("icon")]),onClick:i.handleClearClick},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(i.clearIcon)))]),_:1},8,["class","onClick"])):vue.createCommentVNode("v-if",!0),i.validateState&&i.validateIcon?(vue.openBlock(),vue.createBlock(f,{key:2,class:vue.normalizeClass([i.nsInput.e("icon"),i.nsInput.e("validateIcon")])},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(i.validateIcon)))]),_:1},8,["class"])):vue.createCommentVNode("v-if",!0)],2)],10,["onClick"])]}),content:vue.withCtx(()=>[vue.createVNode(p,{ref:"menuRef"},{default:vue.withCtx(()=>[i.$slots.header?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:vue.normalizeClass(i.nsSelect.be("dropdown","header")),onClick:vue.withModifiers(()=>{},["stop"])},[vue.renderSlot(i.$slots,"header")],10,["onClick"])):vue.createCommentVNode("v-if",!0),vue.withDirectives(vue.createVNode(g,{id:i.contentId,ref:"scrollbarRef",tag:"ul","wrap-class":i.nsSelect.be("dropdown","wrap"),"view-class":i.nsSelect.be("dropdown","list"),class:vue.normalizeClass([i.nsSelect.is("empty",i.filteredOptionsCount===0)]),role:"listbox","aria-label":i.ariaLabel,"aria-orientation":"vertical"},{default:vue.withCtx(()=>[i.showNewOption?(vue.openBlock(),vue.createBlock(h,{key:0,value:i.states.inputValue,created:!0},null,8,["value"])):vue.createCommentVNode("v-if",!0),vue.createVNode(y,null,{default:vue.withCtx(()=>[vue.renderSlot(i.$slots,"default")]),_:3})]),_:3},8,["id","wrap-class","view-class","class","aria-label"]),[[vue.vShow,i.states.options.size>0&&!i.loading]]),i.$slots.loading&&i.loading?(vue.openBlock(),vue.createElementBlock("div",{key:1,class:vue.normalizeClass(i.nsSelect.be("dropdown","loading"))},[vue.renderSlot(i.$slots,"loading")],2)):i.loading||i.filteredOptionsCount===0?(vue.openBlock(),vue.createElementBlock("div",{key:2,class:vue.normalizeClass(i.nsSelect.be("dropdown","empty"))},[vue.renderSlot(i.$slots,"empty",{},()=>[vue.createElementVNode("span",null,vue.toDisplayString(i.emptyText),1)])],2)):vue.createCommentVNode("v-if",!0),i.$slots.footer?(vue.openBlock(),vue.createElementBlock("div",{key:3,class:vue.normalizeClass(i.nsSelect.be("dropdown","footer")),onClick:vue.withModifiers(()=>{},["stop"])},[vue.renderSlot(i.$slots,"footer")],10,["onClick"])):vue.createCommentVNode("v-if",!0)]),_:3},512)]),_:3},8,["visible","placement","teleported","popper-class","popper-options","fallback-placements","effect","transition","persistent","onBeforeShow","onHide"])],16,["onMouseleave"])),[[v,i.handleClickOutside,i.popperRef]])}var Select=_export_sfc(_sfc_main$9,[["render",_sfc_render$1],["__file","select.vue"]]);const _sfc_main$8=vue.defineComponent({name:"ElOptionGroup",componentName:"ElOptionGroup",props:{label:String,disabled:Boolean},setup(i){const r=useNamespace("select"),n=vue.ref(null),o=vue.getCurrentInstance(),a=vue.ref([]);vue.provide(selectGroupKey,vue.reactive({...vue.toRefs(i)}));const u=vue.computed(()=>a.value.some(h=>h.visible===!0)),c=h=>{var y,g;return((y=h.type)==null?void 0:y.name)==="ElOption"&&!!((g=h.component)!=null&&g.proxy)},d=h=>{const y=lodashEs.castArray(h),g=[];return y.forEach(p=>{var v,_;c(p)?g.push(p.component.proxy):(v=p.children)!=null&&v.length?g.push(...d(p.children)):(_=p.component)!=null&&_.subTree&&g.push(...d(p.component.subTree))}),g},f=()=>{a.value=d(o.subTree)};return vue.onMounted(()=>{f()}),useMutationObserver(n,f,{attributes:!0,subtree:!0,childList:!0}),{groupRef:n,visible:u,ns:r}}});function _sfc_render(i,r,n,o,a,u){return vue.withDirectives((vue.openBlock(),vue.createElementBlock("ul",{ref:"groupRef",class:vue.normalizeClass(i.ns.be("group","wrap"))},[vue.createElementVNode("li",{class:vue.normalizeClass(i.ns.be("group","title"))},vue.toDisplayString(i.label),3),vue.createElementVNode("li",null,[vue.createElementVNode("ul",{class:vue.normalizeClass(i.ns.b("group"))},[vue.renderSlot(i.$slots,"default")],2)])],2)),[[vue.vShow,i.visible]])}var OptionGroup=_export_sfc(_sfc_main$8,[["render",_sfc_render],["__file","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(i,{emit:r}){const n=i,o=r,a=vue.computed({get(){return n.modelValue},set(d){o("update:modelValue",d)}}),u=[{label:"大于",val:"greater"},{label:"大于等于",val:">="},{label:"小于",val:"<"},{label:"小于等于",val:"<="},{label:"等于",val:"=="},{label:"不等于",val:"!="},{label:"介于",val:">=,=<"},{label:"不介于",val:"<,>"}],c=d=>{d!=="None"&&(a.value.Relation={key:"",relation:"",val:"",val2:""}),o("update:modelValue",a)};return(d,f)=>{var h,y;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(a).type,"onUpdate:modelValue":f[0]||(f[0]=g=>vue.unref(a).type=g),onChange:c},{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(a).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(a).Relation.key,"onUpdate:modelValue":f[1]||(f[1]=g=>vue.unref(a).Relation.key=g)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(a).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(a).Relation.relation,"onUpdate:modelValue":f[2]||(f[2]=g=>vue.unref(a).Relation.relation=g)},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(u,(g,p)=>vue.createVNode(vue.unref(ElOption),{value:g.val,label:g.label,key:"rop"+p},null,8,["value","label"])),64))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(a).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(a).Relation.val,"onUpdate:modelValue":f[3]||(f[3]=g=>vue.unref(a).Relation.val=g)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(a).type==="Relation"&&(((h=vue.unref(a).Relation)==null?void 0:h.relation)===">=,=<"||((y=vue.unref(a).Relation)==null?void 0:y.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(a).Relation.val2,"onUpdate:modelValue":f[4]||(f[4]=g=>vue.unref(a).Relation.val2=g)},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(i,{emit:r}){const n=useGlobalStore(pinia),o=r,a=i,u=vue.computed({get(){return a.modelValue!==null},set(g){let p=null;g&&(p={target_id:"",type:""}),o("update:modelValue",p)}}),c=vue.computed({get(){var g;return((g=a.modelValue)==null?void 0:g.target_id)??void 0},set(g){let p=null;u.value&&(p={target_id:g,type:d.value}),o("update:modelValue",p)}}),d=vue.computed({get(){var g;return((g=a.modelValue)==null?void 0:g.type)??void 0},set(g){let p=null;u.value&&(p={target_id:c.value,type:g}),o("update:modelValue",p)}}),f=vue.computed(()=>n.done_json.filter(g=>g.type!==EDoneJsonType.ConnectionLine).map(g=>({label:g.title,value:g.id}))),h=[{label:"上锚点",value:ELineBindAnchors.TopCenter},{label:"右锚点",value:ELineBindAnchors.Right},{label:"下锚点",value:ELineBindAnchors.BottomCenter},{label:"左锚点",value:ELineBindAnchors.Left}];function y(){vue.nextTick(function(){var g,p;if(u.value&&((g=a.modelValue)!=null&&g.target_id)&&((p=a.modelValue)!=null&&p.type)&&n.handle_svg_info){let v=null;for(let _ of n.done_json)_.id===a.modelValue.target_id&&(v=_);v&&(setSvgActualInfo(v),moveAnchors(v))}})}return(g,p)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:a.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSwitch),{modelValue:vue.unref(u),"onUpdate:modelValue":p[0]||(p[0]=v=>vue.isRef(u)?u.value=v:null),onChange:y},null,8,["modelValue"])]),_:1},8,["label"]),vue.unref(u)?(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(c),"onUpdate:modelValue":p[1]||(p[1]=v=>vue.isRef(c)?c.value=v:null),onChange:y},{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(u)?(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(d),"onUpdate:modelValue":p[2]||(p[2]=v=>vue.isRef(d)?d.value=v:null),onChange:y},{default:vue.withCtx(()=>[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(h,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=i=>(vue.pushScopeId("data-v-6ec5856f"),i=i(),vue.popScopeId(),i),_hoisted_1$3=_withScopeId(()=>vue.createElementVNode("span",{style:{"font-weight":"bold"}},"MQTT",-1)),_hoisted_2$2={key:2},_hoisted_3$1={class:"events-title"},_sfc_main$5=vue.defineComponent({__name:"right-panel",setup(i){const r=useConfigStore(pinia),n=useGlobalStore(pinia),o=useSvgEditLayoutStore(pinia),a=vue.ref("page"),u=vue.ref("style"),c=(_,b)=>{_!=null&&_.common_animations&&(_.common_animations.val=b)};r.$subscribe((_,b)=>{_.storeId==="config-store"&&localStorage.setItem("svg-editor-config",JSON.stringify(b))});const d=vue.ref(numberArray(20)),f=vue.ref(["MQTT"]),h=vue.ref();h.value=()=>{var b,A;let _={type:EEventType.Null,action:EEventAction.Null,target:"",scripts:"",condition:{type:EConditionType.None}};(A=(b=n.handle_svg_info)==null?void 0:b.info)==null||A.events.push(_)};const y=(_,b)=>{_==="ChangeAttr"?b.attrs=[{key:"",val:""}]:delete b.attrs},g=_=>{var b,A;(A=(b=n.handle_svg_info)==null?void 0:b.info)==null||A.events.splice(_,1)},p=()=>{o.center_offset={x:0,y:0}},v=(_,b,A)=>{vue.nextTick(function(){if(n.handle_svg_info){const w=n.done_json[n.handle_svg_info.index];A?setSvgActualInfo(w,A):setSvgActualInfo(w),moveAnchors(w)}})};return(_,b)=>vue.unref(n).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":b[13]||(b[13]=A=>vue.isRef(a)?a.value=A: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(r).svg.background_color,"onUpdate:modelValue":b[0]||(b[0]=A=>vue.unref(r).svg.background_color=A)},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:p,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":b[1]||(b[1]=A=>vue.unref(o).center_offset.x=A)},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":b[2]||(b[2]=A=>vue.unref(o).center_offset.y=A)},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(r).svg.scale,"onUpdate:modelValue":b[3]||(b[3]=A=>vue.unref(r).svg.scale=A),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(r).svg.ruler,"onUpdate:modelValue":b[4]||(b[4]=A=>vue.unref(r).svg.ruler=A)},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(r).svg.grid,"onUpdate:modelValue":b[5]||(b[5]=A=>vue.unref(r).svg.grid=A)},null,8,["modelValue"])]),_:1}),vue.unref(r).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(r).svg.grid_color,"onUpdate:modelValue":b[6]||(b[6]=A=>vue.unref(r).svg.grid_color=A)},null,8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0)]),_:1})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElTabPane),{label:"连线",name:"line"},{default:vue.withCtx(()=>[vue.unref(r).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(r).connection_line.props,hide:["point_position"]},null,8,["obj-info"])]),_:1})):vue.createCommentVNode("",!0),vue.unref(r).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(r).connection_line.animations.type.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(r).connection_line.animations.type.val,"onUpdate:modelValue":b[7]||(b[7]=A=>vue.unref(r).connection_line.animations.type.val=A),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(r).connection_line.animations.type.options,A=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:A.value,label:A.label,value:A.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),vue.unref(r).connection_line.animations.type.val!=="None"?(vue.openBlock(),vue.createBlock(DynamicElFormItem,{key:0,"obj-info":vue.unref(r).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(f),"onUpdate:modelValue":b[12]||(b[12]=A=>vue.isRef(f)?f.value=A: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(r).net.mqtt.url,"onUpdate:modelValue":b[8]||(b[8]=A=>vue.unref(r).net.mqtt.url=A),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(r).net.mqtt.user,"onUpdate:modelValue":b[9]||(b[9]=A=>vue.unref(r).net.mqtt.user=A),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(r).net.mqtt.pwd,"onUpdate:modelValue":b[10]||(b[10]=A=>vue.unref(r).net.mqtt.pwd=A),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(r).net.mqtt.topics,"onUpdate:modelValue":b[11]||(b[11]=A=>vue.unref(r).net.mqtt.topics=A),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$u)]),_:1})]),_:1},8,["modelValue"])):vue.unref(n).intention==vue.unref(EGlobalStoreIntention).Select&&vue.unref(n).handle_svg_info?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTabs),{key:1,class:"mx-2 rightTabs",modelValue:vue.unref(u),"onUpdate:modelValue":b[34]||(b[34]=A=>vue.isRef(u)?u.value=A: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 A,w,T,S;return[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"标题",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(n).handle_svg_info.info.title,"onUpdate:modelValue":b[14]||(b[14]=x=>vue.unref(n).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(n).handle_svg_info.info.x,"onUpdate:modelValue":b[15]||(b[15]=x=>vue.unref(n).handle_svg_info.info.x=x),onChange:v},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(n).handle_svg_info.info.y,"onUpdate:modelValue":b[16]||(b[16]=x=>vue.unref(n).handle_svg_info.info.y=x),onChange:v},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(n).handle_svg_info.info.scale_x,"onUpdate:modelValue":b[17]||(b[17]=x=>vue.unref(n).handle_svg_info.info.scale_x=x),onChange:v},null,8,["modelValue"])]),_:1},512),[[vue.vShow,(w=(A=vue.unref(n).handle_svg_info)==null?void 0:A.info)==null?void 0:w.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(n).handle_svg_info.info.scale_y,"onUpdate:modelValue":b[18]||(b[18]=x=>vue.unref(n).handle_svg_info.info.scale_y=x),onChange:v},null,8,["modelValue"])]),_:1},512),[[vue.vShow,(S=(T=vue.unref(n).handle_svg_info)==null?void 0:T.info)==null?void 0:S.config.can_zoom]]),vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"旋转",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInputNumber),{modelValue:vue.unref(n).handle_svg_info.info.rotate,"onUpdate:modelValue":b[19]||(b[19]=x=>vue.unref(n).handle_svg_info.info.rotate=x),onChange:v},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).handle_svg_info.info.display,"onUpdate:modelValue":b[20]||(b[20]=x=>vue.unref(n).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 A,w,T,S,x,L,M,O;return[vue.createVNode(vue.unref(elementPlus.ElFormItem),{label:"ID",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElInput),{modelValue:vue.unref(n).handle_svg_info.info.id,"onUpdate:modelValue":b[21]||(b[21]=ie=>vue.unref(n).handle_svg_info.info.id=ie)},null,8,["modelValue"])]),_:1}),(w=(A=vue.unref(n).handle_svg_info)==null?void 0:A.info)!=null&&w.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(n).handle_svg_info.info.defaultState),1)]),_:1})):vue.createCommentVNode("",!0),(S=(T=vue.unref(n).handle_svg_info)==null?void 0:T.info)!=null&&S.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(n).handle_svg_info.info.defaultState,"onUpdate:modelValue":b[22]||(b[22]=ie=>vue.unref(n).handle_svg_info.info.defaultState=ie),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(n).handle_svg_info.info.state,(ie,$)=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:"state"+String($),label:ie.label,value:$},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):vue.createCommentVNode("",!0),(x=vue.unref(n).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(n).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(n).handle_svg_info.info.tag_slot,"onUpdate:modelValue":b[23]||(b[23]=ie=>vue.unref(n).handle_svg_info.info.tag_slot=ie),onInput:b[24]||(b[24]=ie=>v(ie,null,!0))},null,8,["modelValue"])]),_:1})])):vue.createCommentVNode("",!0),vue.createVNode(DynamicElFormItem,{"obj-info":vue.unref(n).handle_svg_info.info.props,code:"",onChange:b[25]||(b[25]=ie=>v(ie,null,!0))},null,8,["obj-info"]),vue.unref(n).handle_svg_info.info.animations?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:3,label:vue.unref(n).handle_svg_info.info.animations.type.title,size:"small"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElSelect),{modelValue:vue.unref(n).handle_svg_info.info.animations.type.val,"onUpdate:modelValue":b[26]||(b[26]=ie=>vue.unref(n).handle_svg_info.info.animations.type.val=ie),placeholder:"Select",size:"small"},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(n).handle_svg_info.info.animations.type.options,ie=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:ie.value,label:ie.label,value:ie.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):vue.createCommentVNode("",!0),((L=vue.unref(n).handle_svg_info.info.animations)==null?void 0:L.type.val)!=="None"?(vue.openBlock(),vue.createBlock(DynamicElFormItem,{key:4,"obj-info":vue.unref(n).handle_svg_info.info.animations,hide:["type","repeatCount"]},null,8,["obj-info"])):vue.createCommentVNode("",!0),((M=vue.unref(n).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(n).handle_svg_info.info.bind_anchors.start,"onUpdate:modelValue":b[27]||(b[27]=ie=>vue.unref(n).handle_svg_info.info.bind_anchors.start=ie),title:"绑定起点"},null,8,["modelValue"])):vue.createCommentVNode("",!0),((O=vue.unref(n).handle_svg_info)==null?void 0:O.info.type)===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$6,{key:6,modelValue:vue.unref(n).handle_svg_info.info.bind_anchors.end,"onUpdate:modelValue":b[28]||(b[28]=ie=>vue.unref(n).handle_svg_info.info.bind_anchors.end=ie),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(h)},{default:vue.withCtx(()=>[vue.createTextVNode("添加事件")]),_:1},8,["onClick"]),vue.createVNode(vue.unref(elementPlus.ElCollapse),{modelValue:vue.unref(d),"onUpdate:modelValue":b[29]||(b[29]=A=>vue.isRef(d)?d.value=A:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(n).handle_svg_info.info.events,(A,w)=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElCollapseItem),{name:w,key:"event"+w},{title:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$1,[vue.createElementVNode("span",null,"事件"+vue.toDisplayString(w+1),1),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:vue.withModifiers(T=>g(w),["stop"])},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{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:A.type,"onUpdate:modelValue":T=>A.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:A.action,"onUpdate:modelValue":T=>A.action=T,onChange:T=>y(T,A)},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElOption),{value:"ChangeAttr",label:"改变属性"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"JavaScript",label:"执行 JavaScript"}),vue.createVNode(vue.unref(elementPlus.ElOption),{value:"Emit",label:"emit 事件"})]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1024),A.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:A.target,"onUpdate:modelValue":T=>A.target=T,placeholder:"默认自身"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),A.action==="ChangeAttr"?(vue.openBlock(),vue.createBlock(List,{key:1,modelValue:A.attrs,"onUpdate:modelValue":T=>A.attrs=T},null,8,["modelValue","onUpdate:modelValue"])):vue.createCommentVNode("",!0),A.action==="JavaScript"?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:2,label:"JavaScript",size:"small"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$x,{modelValue:A.scripts,"onUpdate:modelValue":T=>A.scripts=T,lang:"javascript"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024)):vue.createCommentVNode("",!0),vue.createVNode(Condition,{modelValue:A.condition,"onUpdate:modelValue":T=>A.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 A;return[(A=vue.unref(n).handle_svg_info)!=null&&A.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(n).handle_svg_info.info.animations},null,8,["obj-info"])]),_:1})):vue.unref(n).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:b[30]||(b[30]=w=>{var T;return c((T=vue.unref(n).handle_svg_info)==null?void 0:T.info,w)}),val:vue.unref(n).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(n).handle_svg_info.info.common_animations.delay,"onUpdate:modelValue":b[31]||(b[31]=w=>vue.unref(n).handle_svg_info.info.common_animations.delay=w)},{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(n).handle_svg_info.info.common_animations.speed,"onUpdate:modelValue":b[32]||(b[32]=w=>vue.unref(n).handle_svg_info.info.common_animations.speed=w)},{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(n).handle_svg_info.info.common_animations.repeat,"onUpdate:modelValue":b[33]||(b[33]=w=>vue.unref(n).handle_svg_info.info.common_animations.repeat=w)},{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$u)]),_:1})]),_:1},8,["modelValue"])):vue.createCommentVNode("",!0)}}),rightPanel_vue_vue_type_style_index_0_scoped_6ec5856f_lang="",rightPanel_vue_vue_type_style_index_1_lang="",RightPanel=_export_sfc$1(_sfc_main$5,[["__scopeId","data-v-6ec5856f"]]),_sfc_main$4=vue.defineComponent({__name:"export-json",setup(i){const r=vue.ref(""),n=useGlobalStore(pinia),o=useSvgEditLayoutStore(pinia),a=useConfigStore(pinia);return vue.onMounted(()=>{const u={layout_center:o.center_offset,config:a.$state,done_json:n.done_json};r.value=JSON.stringify(u,null,2)}),(u,c)=>(vue.openBlock(),vue.createBlock(vue.unref(VAceEditor),{value:vue.unref(r),"onUpdate:value":c[0]||(c[0]=d=>vue.isRef(r)?r.value=d:null),lang:"json",theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value"]))}}),_sfc_main$3=vue.defineComponent({__name:"import-json",setup(i,{expose:r}){const n=vue.ref("");return r({setVal:u=>{n.value=u},onImportJson:()=>{useImportDataModel(n.value)&&elementPlus.ElMessage.success("导入成功")}}),(u,c)=>(vue.openBlock(),vue.createBlock(vue.unref(VAceEditor),{value:vue.unref(n),"onUpdate:value":c[0]||(c[0]=d=>vue.isRef(n)?n.value=d:null),lang:"json",theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value"]))}}),_hoisted_1$2=["title","onMousedown"],_hoisted_2$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(i,{emit:r}){const n=r,o=i,a=useSvgEditLayoutStore(pinia),u=useConfigStore(pinia),c=function(){return function(Ce,ue,$e){Ce&&ue&&$e&&Ce.addEventListener(ue,$e,!1)}}(),d=function(){return function(Ce,ue,$e){Ce&&ue&&Ce.removeEventListener(ue,$e,!1)}}();let f=18,h=vue.ref(0),y=vue.ref(0),g=vue.ref([]),p=vue.ref([]);const v=vue.ref([]);let _=vue.ref(!1),b="",A=vue.ref(-999),w=vue.ref(-999),T=18,S=18,x="";const L=vue.ref(null),M=vue.ref(null),O=vue.ref(null),ie=vue.ref(null),$=vue.computed(()=>({width:h.value+"px",height:y.value+"px"})),z=vue.computed(()=>({padding:f+"px 0px 0px "+f+"px"})),V=vue.computed(()=>{let Ce=0,ue=0;return v.value.map($e=>{const Ne=$e.type==="h";return{id:`${$e.type}_${Ne?Ce++:ue++}`,type:$e.type,title:$e.site.toFixed(0)+"px",[Ne?"top":"left"]:$e.site*u.svg.scale+f+a.center_offset[Ne?"y":"x"]*u.svg.scale}})});a.$subscribe(Ce=>{var ue,$e,Ne,Oe;(($e=(ue=Ce.events)==null?void 0:ue.target)!=null&&$e.hasOwnProperty("left_nav")||(Oe=(Ne=Ce.events)==null?void 0:Ne.target)!=null&&Oe.hasOwnProperty("right_nav"))&&window.setTimeout(re,420)}),u.$subscribe(Ce=>{var ue,$e;($e=(ue=Ce.events)==null?void 0:ue.target)!=null&&$e.hasOwnProperty("scale")&&Fe()}),vue.onMounted(()=>{c(document,"mousemove",At),c(document,"mouseup",In),re(),c(window,"resize",F)}),vue.onBeforeUnmount(()=>{d(document,"mousemove",At),d(document,"mouseup",In),d(window,"resize",F)});const re=()=>{de(),Fe()},F=()=>{g.value=[],p.value=[],re()},pe=({type:Ce,top:ue,left:$e})=>Ce==="h"?{top:ue+"px"}:{left:$e+"px"},le=({type:Ce,id:ue})=>Ce==="h"?Dt(ue):jt(ue),de=()=>{const Ce=window.getComputedStyle(M.value.parentNode,null);h.value=parseInt(Ce.getPropertyValue("width")),y.value=parseInt(Ce.getPropertyValue("height")),T=O.value.clientWidth,S=ie.value.clientHeight},Fe=()=>{Ie(g.value,h.value,a.center_offset.x),Ie(p.value,y.value,a.center_offset.y)},Ie=(Ce,ue,$e)=>{if(Ce.length===0)for(let Ne=0;Ne<ue;Ne+=o.stepLength)Ne%o.stepLength===0&&Ce.push({id:myFixed(Ne/u.svg.scale-$e,0)});else Ce.forEach((Ne,Oe)=>{Ne.id=myFixed(Oe*o.stepLength/u.svg.scale-$e,0)})},At=Ce=>{Fe(),_e(Ce)},_e=Ce=>{if(!(Ce.layerX===Ce.x||Ce.layerY===Ce.y))switch(b){case"x":_.value&&(w.value=Ce.layerY);break;case"y":_.value&&(A.value=Ce.layerX);break;case"h":_.value&&(w.value=Ce.layerY);break;case"v":_.value&&(A.value=Ce.layerX);break}},qe=Ce=>{_.value=!0,b=Ce},In=Ce=>{vn(Ce)},vn=Ce=>{if(_.value){switch(_.value=!1,b){case"x":const ue=Math.round((Ce.layerY-f)/u.svg.scale-a.center_offset.y);if(ue<=0){w.value=-999;return}v.value.push({type:"h",site:ue});break;case"y":const $e=Math.round((Ce.layerX-f)/u.svg.scale-a.center_offset.x);if($e<=0){A.value=-999;return}v.value.push({type:"v",site:$e});break;case"h":Pt(v.value,Math.round((Ce.layerY-f)/u.svg.scale-a.center_offset.y),Math.round(S/u.svg.scale-a.center_offset.y),"h");break;case"v":Pt(v.value,Math.round((Ce.layerX-f)/u.svg.scale-a.center_offset.x),Math.round(T/u.svg.scale-a.center_offset.x),"v");break}w.value=A.value=-999}},Pt=(Ce,ue,$e,Ne)=>{if(ue<$e){let Oe;V.value.forEach((Lt,kt)=>{Lt.id===x&&(Oe=kt)}),Ce.splice(Oe,1)}else{let Oe;V.value.forEach((Lt,kt)=>{Lt.id===x&&(Oe=kt)}),Ce.splice(Oe,1,{type:Ne,site:ue})}},he=()=>{qe("x")},Ue=()=>{qe("y")},Dt=Ce=>{_.value=!0,b="h",x=Ce},jt=Ce=>{_.value=!0,b="v",x=Ce},Et=()=>{n("onLineMouseUp")};return(Ce,ue)=>(vue.openBlock(),vue.createElementBlock("div",{style:vue.normalizeStyle(vue.unref($)),class:"vue-ruler-wrapper",onselectStart:"return false;",ref_key:"el",ref:M},[vue.withDirectives(vue.createElementVNode("section",null,[vue.createElementVNode("div",{ref_key:"horizontalRuler",ref:ie,class:"vue-ruler-h",onMousedown:vue.withModifiers(he,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(g),($e,Ne)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({left:Ne*Ce.stepLength+"px"}),class:"n"},vue.toDisplayString($e.id),5))),256))],544),vue.createElementVNode("div",{ref_key:"verticalRuler",ref:O,class:"vue-ruler-v",onMousedown:vue.withModifiers(Ue,["stop"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(p),($e,Ne)=>(vue.openBlock(),vue.createElementBlock("span",{style:vue.normalizeStyle({top:Ne*Ce.stepLength+"px"}),class:"n"},vue.toDisplayString($e.id),5))),256))],544),vue.createElementVNode("div",{style:vue.normalizeStyle({top:vue.unref(w)+"px"}),class:"vue-ruler-ref-dot-h"},[vue.createElementVNode("span",null,vue.toDisplayString(Math.round((vue.unref(w)-vue.unref(S))/vue.unref(u).svg.scale-vue.unref(a).center_offset.y)),1)],4),vue.createElementVNode("div",{style:vue.normalizeStyle({left:vue.unref(A)+"px"}),class:"vue-ruler-ref-dot-v"},[vue.createElementVNode("span",null,vue.toDisplayString(Math.round((vue.unref(A)-vue.unref(T))/vue.unref(u).svg.scale-vue.unref(a).center_offset.x)),1)],4),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(V),$e=>(vue.openBlock(),vue.createElementBlock("div",{title:$e.title,style:vue.normalizeStyle(pe($e)),key:$e.id,class:vue.normalizeClass(`vue-ruler-ref-line-${$e.type}`),onMousedown:Ne=>le($e),onMouseup:Et,onContextmenu:ue[0]||(ue[0]=(...Ne)=>vue.unref(preventDefault)&&vue.unref(preventDefault)(...Ne))},null,46,_hoisted_1$2))),128))],512),[[vue.vShow,o.visible]]),vue.createElementVNode("div",{ref_key:"content",ref:L,class:"vue-ruler-content",style:vue.normalizeStyle(vue.unref(z))},[vue.renderSlot(Ce.$slots,"default")],4),vue.withDirectives(vue.createElementVNode("div",_hoisted_2$1,null,512),[[vue.vShow,vue.unref(_)]])],4))}}),vue3RulerTool_vue_vue_type_style_index_0_lang="";function fileWrite(i,r=new Date(Date.now()).toLocaleString()){const n=JSON.stringify(i),o=new Blob([n]);let a=document.createElement("a");a.download=r+".json",a.style.display="none",a.href=URL.createObjectURL(o),document.body.appendChild(a),a.click(),document.body.removeChild(a)}function fileRead(i){return new Promise((r,n)=>{let o=new FileReader;o.readAsText(i,"UTF-8"),o.onload=function(a){a&&a.target?r(a.target.result):n("文件读取错误")}})}const _hoisted_1$1={class:"canvas-main-pc"},_sfc_main$1=vue.defineComponent({__name:"index",props:{customToolbar:{},vueComp:{},data:{},saveFile:{type:Boolean,default:!1}},emits:["onReturn","onPreview","onSave"],setup(i,{expose:r,emit:n}){setEditorLoadTime();const o=n,a=i,u=useGlobalStore(pinia),c=useSvgEditLayoutStore(pinia),d=useConfigStore(pinia),f=useEditPrivateStore(pinia),h=vue.ref(),y=vue.ref(),g=vue.reactive({[EVisibleConfKey.ExportJson]:!1,[EVisibleConfKey.ImportJson]:!1,[EVisibleConfKey.ImportFile]:!1}),p=(x,L)=>{g[x]=L},v=vue.ref();v.value=()=>{y.value.onImportJson(),p(EVisibleConfKey.ImportJson,!1)};const _=x=>["text/plain","application/json"].indexOf(x.type)<0?(elementPlus.ElMessage.error("仅支持的格式:txt、json"),!1):(fileRead(x).then(L=>{y.value.setVal(L),elementPlus.ElMessage.success("文件读取成功!")}),!1),b=x=>{u.setDoneJson(x)};vue.onMounted(()=>{f.history_doneComponent=[],f.history_now_index=0,a.data?useImportDataModel(a.data):u.setDoneJson([]),u.intention=EGlobalStoreIntention.None});const{appContext:A}=vue.getCurrentInstance();function w(x){o("onReturn",{data:x,isChange:f.getTopBtnUndoStatus})}function T(x){a.saveFile?elementPlus.ElMessageBox.prompt("请输入文件名","保存",{cancelButtonText:"取消",confirmButtonText:"保存"},A).then(L=>{fileWrite(x,L.value.trim()),o("onSave",x)}).catch(L=>{console.log(L)}):o("onSave",x)}function S(){h.value.onCanvasMouseUp()}return r({setGraphNodeJson:b}),(x,L)=>(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:p,onOnReturn:w,onOnPreview:L[0]||(L[0]=M=>o("onPreview",M)),onOnSave:T})]),_: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(c).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":a.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(d).svg.ruler,onOnLineMouseUp:S},{default:vue.withCtx(()=>[vue.createVNode(CenterPanel,{ref_key:"centerRef",ref:h,vueComp:a.vueComp},{background:vue.withCtx(()=>[vue.renderSlot(x.$slots,"background",{},void 0,!0)]),_:3},8,["vueComp"])]),_:3},8,["visible"])])]),_:3}),vue.createVNode(vue.unref(elementPlus.ElAside),{class:vue.normalizeClass(["side-nav",vue.unref(c).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"])]),_:3})]),_:3}),vue.createVNode(vue.unref(elementPlus.ElDialog),{class:"modal-full",modelValue:vue.unref(g).ImportJson,"onUpdate:modelValue":L[2]||(L[2]=M=>vue.unref(g).ImportJson=M),title:"导入数据",width:"60%","destroy-on-close":""},{footer:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElUpload),{beforeUpload:_,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:L[1]||(L[1]=M=>p(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:y},null,512)]),_:1},8,["modelValue"]),vue.createVNode(vue.unref(elementPlus.ElDialog),{class:"modal-full",modelValue:vue.unref(g).ExportJson,"onUpdate:modelValue":L[3]||(L[3]=M=>vue.unref(g).ExportJson=M),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_ed6b1a90_lang="",index=_export_sfc$1(_sfc_main$1,[["__scopeId","data-v-ed6b1a90"]]);function commonjsRequire(i){throw new Error('Could not dynamically require "'+i+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var mqtt={exports:{}};(function(i,r){(function(n){i.exports=n()})(function(){return function(){function n(o,a,u){function c(h,y){if(!a[h]){if(!o[h]){var g=typeof commonjsRequire=="function"&&commonjsRequire;if(!y&&g)return g(h,!0);if(d)return d(h,!0);var p=new Error("Cannot find module '"+h+"'");throw p.code="MODULE_NOT_FOUND",p}var v=a[h]={exports:{}};o[h][0].call(v.exports,function(_){var b=o[h][1][_];return c(b||_)},v,v.exports,n,o,a,u)}return a[h].exports}for(var d=typeof commonjsRequire=="function"&&commonjsRequire,f=0;f<u.length;f++)c(u[f]);return c}return n}()({1:[function(n,o,a){var u=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(a,"__esModule",{value:!0}),a.TypedEventEmitter=void 0;const c=u(n("events")),d=n("./shared");class f{}a.TypedEventEmitter=f,(0,d.applyMixin)(f,c.default)},{"./shared":17,events:49}],2:[function(n,o,a){(function(u,c){(function(){var d=this&&this.__createBinding||(Object.create?function(V,re,F,pe){pe===void 0&&(pe=F);var le=Object.getOwnPropertyDescriptor(re,F);(!le||("get"in le?!re.__esModule:le.writable||le.configurable))&&(le={enumerable:!0,get:function(){return re[F]}}),Object.defineProperty(V,pe,le)}:function(V,re,F,pe){pe===void 0&&(pe=F),V[pe]=re[F]}),f=this&&this.__setModuleDefault||(Object.create?function(V,re){Object.defineProperty(V,"default",{enumerable:!0,value:re})}:function(V,re){V.default=re}),h=this&&this.__importStar||function(V){if(V&&V.__esModule)return V;var re={};if(V!=null)for(var F in V)F!=="default"&&Object.prototype.hasOwnProperty.call(V,F)&&d(re,V,F);return f(re,V),re},y=this&&this.__importDefault||function(V){return V&&V.__esModule?V:{default:V}};Object.defineProperty(a,"__esModule",{value:!0});const g=y(n("./topic-alias-recv")),p=y(n("mqtt-packet")),v=y(n("./default-message-id-provider")),_=n("readable-stream"),b=y(n("reinterval")),A=y(n("rfdc/default")),w=h(n("./validations")),T=y(n("debug")),S=y(n("./store")),x=y(n("./handlers")),L=n("./TypedEmitter"),M=u?u.nextTick:V=>{setTimeout(V,0)},O=c.setImmediate||((...V)=>{const re=V.shift();M(()=>{re(...V)})}),ie={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0,writeCache:!0},$=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND","ETIMEDOUT"];class z extends L.TypedEventEmitter{static defaultId(){return`mqttjs_${Math.random().toString(16).substr(2,8)}`}constructor(re,F){super(),this.options=F||{};for(const pe in ie)typeof this.options[pe]>"u"?this.options[pe]=ie[pe]:this.options[pe]=F[pe];this.log=this.options.log||(0,T.default)("mqttjs:client"),this.noop=this._noop.bind(this),this.log("MqttClient :: options.protocol",F.protocol),this.log("MqttClient :: options.protocolVersion",F.protocolVersion),this.log("MqttClient :: options.username",F.username),this.log("MqttClient :: options.keepalive",F.keepalive),this.log("MqttClient :: options.reconnectPeriod",F.reconnectPeriod),this.log("MqttClient :: options.rejectUnauthorized",F.rejectUnauthorized),this.log("MqttClient :: options.properties.topicAliasMaximum",F.properties?F.properties.topicAliasMaximum:void 0),this.options.clientId=typeof F.clientId=="string"?F.clientId:z.defaultId(),this.log("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=F.protocolVersion===5&&F.customHandleAcks?F.customHandleAcks:(...pe)=>{pe[3](null,0)},this.options.writeCache||(p.default.writeToStream.cacheNumbers=!1),this.streamBuilder=re,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new v.default:this.options.messageIdProvider,this.outgoingStore=F.outgoingStore||new S.default,this.incomingStore=F.incomingStore||new S.default,this.queueQoSZero=F.queueQoSZero===void 0?!0:F.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.reconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,F.properties&&F.properties.topicAliasMaximum>0&&(F.properties.topicAliasMaximum>65535?this.log("MqttClient :: options.properties.topicAliasMaximum is out of range"):this.topicAliasRecv=new g.default(F.properties.topicAliasMaximum)),this.on("connect",()=>{const{queue:pe}=this,le=()=>{const de=pe.shift();this.log("deliver :: entry %o",de);let Fe=null;if(!de){this._resubscribe();return}Fe=de.packet,this.log("deliver :: call _sendPacket for %o",Fe);let Ie=!0;Fe.messageId&&Fe.messageId!==0&&(this.messageIdProvider.register(Fe.messageId)||(Ie=!1)),Ie?this._sendPacket(Fe,At=>{de.cb&&de.cb(At),le()}):(this.log("messageId: %d has already used. The message is skipped and removed.",Fe.messageId),le())};this.log("connect :: sending queued packets"),le()}),this.on("close",()=>{this.log("close :: connected set to `false`"),this.connected=!1,this.log("close :: clearing connackTimer"),clearTimeout(this.connackTimer),this.log("close :: clearing ping timer"),this.pingTimer!==null&&(this.pingTimer.clear(),this.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),this.log("close :: calling _setupReconnect"),this._setupReconnect()}),this.options.manualConnect||(this.log("MqttClient :: setting up stream"),this.connect())}handleAuth(re,F){F()}handleMessage(re,F){F()}_nextId(){return this.messageIdProvider.allocate()}getLastMessageId(){return this.messageIdProvider.getLastAllocated()}connect(){var re;const F=new _.Writable,pe=p.default.parser(this.options);let le=null;const de=[];this.log("connect :: calling method to clear reconnect"),this._clearReconnect(),this.log("connect :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),pe.on("packet",qe=>{this.log("parser :: on packet push to packets array."),de.push(qe)});const Fe=()=>{this.log("work :: getting next packet in queue");const qe=de.shift();if(qe)this.log("work :: packet pulled from queue"),(0,x.default)(this,qe,Ie);else{this.log("work :: no packets in queue");const In=le;le=null,this.log("work :: done flag is %s",!!In),In&&In()}},Ie=()=>{if(de.length)M(Fe);else{const qe=le;le=null,qe()}};F._write=(qe,In,vn)=>{le=vn,this.log("writable stream :: parsing buffer"),pe.parse(qe),Fe()};const At=qe=>{this.log("streamErrorHandler :: error",qe.message),$.includes(qe.code)?(this.log("streamErrorHandler :: emitting error"),this.emit("error",qe)):this.noop(qe)};this.log("connect :: pipe stream to writable stream"),this.stream.pipe(F),this.stream.on("error",At),this.stream.on("close",()=>{this.log("(%s)stream :: on close",this.options.clientId),this._flushVolatile(),this.log("stream: emit close to MqttClient"),this.emit("close")}),this.log("connect: sending packet `connect`");const _e={cmd:"connect",protocolId:this.options.protocolId,protocolVersion:this.options.protocolVersion,clean:this.options.clean,clientId:this.options.clientId,keepalive:this.options.keepalive,username:this.options.username,password:this.options.password,properties:this.options.properties};if(this.options.will&&(_e.will=Object.assign(Object.assign({},this.options.will),{payload:(re=this.options.will)===null||re===void 0?void 0:re.payload})),this.topicAliasRecv&&(_e.properties||(_e.properties={}),this.topicAliasRecv&&(_e.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(_e),pe.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return this.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 qe=Object.assign({cmd:"auth",reasonCode:0},this.options.authPacket);this._writePacket(qe)}}return this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(()=>{this.log("!!connectTimeout hit!! Calling _cleanUp with force `true`"),this._cleanUp(!0)},this.options.connectTimeout),this}publish(re,F,pe,le){this.log("publish :: message `%s` to topic `%s`",F,re);const{options:de}=this;typeof pe=="function"&&(le=pe,pe=null),pe=pe||{},pe=Object.assign(Object.assign({},{qos:0,retain:!1,dup:!1}),pe);const{qos:Ie,retain:At,dup:_e,properties:qe,cbStorePut:In}=pe;if(this._checkDisconnecting(le))return this;const vn=()=>{let Pt=0;if((Ie===1||Ie===2)&&(Pt=this._nextId(),Pt===null))return this.log("No messageId left"),!1;const he={cmd:"publish",topic:re,payload:F,qos:Ie,retain:At,messageId:Pt,dup:_e};switch(de.protocolVersion===5&&(he.properties=qe),this.log("publish :: qos",Ie),Ie){case 1:case 2:this.outgoing[he.messageId]={volatile:!1,cb:le||this.noop},this.log("MqttClient:publish: packet cmd: %s",he.cmd),this._sendPacket(he,void 0,In);break;default:this.log("MqttClient:publish: packet cmd: %s",he.cmd),this._sendPacket(he,le,In);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!vn())&&this._storeProcessingQueue.push({invoke:vn,cbStorePut:pe.cbStorePut,callback:le}),this}publishAsync(re,F,pe){return new Promise((le,de)=>{this.publish(re,F,pe,(Fe,Ie)=>{Fe?de(Fe):le(Ie)})})}subscribe(re,F,pe){const le=this.options.protocolVersion;typeof F=="function"&&(pe=F),pe=pe||this.noop;let de=!1,Fe=[];typeof re=="string"?(re=[re],Fe=re):Array.isArray(re)?Fe=re:typeof re=="object"&&(de=re.resubscribe,delete re.resubscribe,Fe=Object.keys(re));const Ie=w.validateTopics(Fe);if(Ie!==null)return O(pe,new Error(`Invalid topic ${Ie}`)),this;if(this._checkDisconnecting(pe))return this.log("subscribe: discconecting true"),this;const At={qos:0};le===5&&(At.nl=!1,At.rap=!1,At.rh=0),F=Object.assign(Object.assign({},At),F);const _e=F.properties,qe=[],In=(Pt,he)=>{if(he=he||F,!Object.prototype.hasOwnProperty.call(this._resubscribeTopics,Pt)||this._resubscribeTopics[Pt].qos<he.qos||de){const Ue={topic:Pt,qos:he.qos};le===5&&(Ue.nl=he.nl,Ue.rap=he.rap,Ue.rh=he.rh,Ue.properties=_e),this.log("subscribe: pushing topic `%s` and qos `%s` to subs list",Ue.topic,Ue.qos),qe.push(Ue)}};if(Array.isArray(re)?re.forEach(Pt=>{this.log("subscribe: array topic %s",Pt),In(Pt)}):Object.keys(re).forEach(Pt=>{this.log("subscribe: object topic %s, %o",Pt,re[Pt]),In(Pt,re[Pt])}),!qe.length)return pe(null,[]),this;const vn=()=>{const Pt=this._nextId();if(Pt===null)return this.log("No messageId left"),!1;const he={cmd:"subscribe",subscriptions:qe,messageId:Pt};if(_e&&(he.properties=_e),this.options.resubscribe){this.log("subscribe :: resubscribe true");const Ue=[];qe.forEach(Dt=>{if(this.options.reconnectPeriod>0){const jt={qos:Dt.qos};le===5&&(jt.nl=Dt.nl||!1,jt.rap=Dt.rap||!1,jt.rh=Dt.rh||0,jt.properties=Dt.properties),this._resubscribeTopics[Dt.topic]=jt,Ue.push(Dt.topic)}}),this.messageIdToTopic[he.messageId]=Ue}return this.outgoing[he.messageId]={volatile:!0,cb(Ue,Dt){if(!Ue){const{granted:jt}=Dt;for(let Et=0;Et<jt.length;Et+=1)qe[Et].qos=jt[Et]}pe(Ue,qe)}},this.log("subscribe :: call _sendPacket"),this._sendPacket(he),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!vn())&&this._storeProcessingQueue.push({invoke:vn,callback:pe}),this}subscribeAsync(re,F){return new Promise((pe,le)=>{this.subscribe(re,F,(de,Fe)=>{de?le(de):pe(Fe)})})}unsubscribe(re,F,pe){typeof re=="string"&&(re=[re]),typeof F=="function"&&(pe=F),pe=pe||this.noop;const le=w.validateTopics(re);if(le!==null)return O(pe,new Error(`Invalid topic ${le}`)),this;if(this._checkDisconnecting(pe))return this;const de=()=>{const Fe=this._nextId();if(Fe===null)return this.log("No messageId left"),!1;const Ie={cmd:"unsubscribe",messageId:Fe,unsubscriptions:[]};return typeof re=="string"?Ie.unsubscriptions=[re]:Array.isArray(re)&&(Ie.unsubscriptions=re),this.options.resubscribe&&Ie.unsubscriptions.forEach(At=>{delete this._resubscribeTopics[At]}),typeof F=="object"&&F.properties&&(Ie.properties=F.properties),this.outgoing[Ie.messageId]={volatile:!0,cb:pe},this.log("unsubscribe: call _sendPacket"),this._sendPacket(Ie),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!de())&&this._storeProcessingQueue.push({invoke:de,callback:pe}),this}unsubscribeAsync(re,F){return new Promise((pe,le)=>{this.unsubscribe(re,F,(de,Fe)=>{de?le(de):pe(Fe)})})}end(re,F,pe){this.log("end :: (%s)",this.options.clientId),(re==null||typeof re!="boolean")&&(pe=pe||F,F=re,re=!1),typeof F!="object"&&(pe=pe||F,F=null),this.log("end :: cb? %s",!!pe),(!pe||typeof pe!="function")&&(pe=this.noop);const le=()=>{this.log("end :: closeStores: closing incoming and outgoing stores"),this.disconnected=!0,this.incomingStore.close(Fe=>{this.outgoingStore.close(Ie=>{if(this.log("end :: closeStores: emitting end"),this.emit("end"),pe){const At=Fe||Ie;this.log("end :: closeStores: invoking callback with args"),pe(At)}})}),this._deferredReconnect&&this._deferredReconnect()},de=()=>{this.log("end :: (%s) :: finish :: calling _cleanUp with force %s",this.options.clientId,re),this._cleanUp(re,()=>{this.log("end :: finish :: calling process.nextTick on closeStores"),M(le)},F)};return this.disconnecting?(pe(),this):(this._clearReconnect(),this.disconnecting=!0,!re&&Object.keys(this.outgoing).length>0?(this.log("end :: (%s) :: calling finish in 10ms once outgoing is empty",this.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,de,10))):(this.log("end :: (%s) :: immediately calling finish",this.options.clientId),de()),this)}endAsync(re,F){return new Promise((pe,le)=>{this.end(re,F,de=>{de?le(de):pe()})})}removeOutgoingMessage(re){if(this.outgoing[re]){const{cb:F}=this.outgoing[re];this._removeOutgoingAndStoreMessage(re,()=>{F(new Error("Message removed"))})}return this}reconnect(re){this.log("client reconnect");const F=()=>{re?(this.options.incomingStore=re.incomingStore,this.options.outgoingStore=re.outgoingStore):(this.options.incomingStore=null,this.options.outgoingStore=null),this.incomingStore=this.options.incomingStore||new S.default,this.outgoingStore=this.options.outgoingStore||new S.default,this.disconnecting=!1,this.disconnected=!1,this._deferredReconnect=null,this._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=F:F(),this}_flushVolatile(){this.outgoing&&(this.log("_flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(this.outgoing).forEach(re=>{this.outgoing[re].volatile&&typeof this.outgoing[re].cb=="function"&&(this.outgoing[re].cb(new Error("Connection closed")),delete this.outgoing[re])}))}_flush(){this.outgoing&&(this.log("_flush: queue exists? %b",!!this.outgoing),Object.keys(this.outgoing).forEach(re=>{typeof this.outgoing[re].cb=="function"&&(this.outgoing[re].cb(new Error("Connection closed")),delete this.outgoing[re])}))}_removeTopicAliasAndRecoverTopicName(re){let F;re.properties&&(F=re.properties.topicAlias);let pe=re.topic.toString();if(this.log("_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o",F,pe),pe.length===0){if(typeof F>"u")return new Error("Unregistered Topic Alias");if(pe=this.topicAliasSend.getTopicByAlias(F),typeof pe>"u")return new Error("Unregistered Topic Alias");re.topic=pe}F&&delete re.properties.topicAlias}_checkDisconnecting(re){return this.disconnecting&&(re&&re!==this.noop?re(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting}_reconnect(){this.log("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this.connect()}),this.log("client already connected. disconnecting first.")):(this.log("_reconnect: calling connect"),this.connect())}_setupReconnect(){!this.disconnecting&&!this.reconnectTimer&&this.options.reconnectPeriod>0?(this.reconnecting||(this.log("_setupReconnect :: emit `offline` state"),this.emit("offline"),this.log("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),this.log("_setupReconnect :: setting reconnectTimer for %d ms",this.options.reconnectPeriod),this.reconnectTimer=setInterval(()=>{this.log("reconnectTimer :: reconnect triggered!"),this._reconnect()},this.options.reconnectPeriod)):this.log("_setupReconnect :: doing nothing...")}_clearReconnect(){this.log("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)}_cleanUp(re,F,pe={}){if(F&&(this.log("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",F)),this.log("_cleanUp :: forced? %s",re),re)this.options.reconnectPeriod===0&&this.options.clean&&this._flush(),this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const le=Object.assign({cmd:"disconnect"},pe);this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(le,()=>{this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),O(()=>{this.stream.end(()=>{this.log("_cleanUp :: (%s) :: stream destroyed",this.options.clientId)})})})}this.disconnecting||(this.log("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(this.log("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),F&&!this.connected&&(this.log("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",F),F())}_storeAndSend(re,F,pe){this.log("storeAndSend :: store packet with cmd %s to outgoingStore",re.cmd);let le=re,de;if(le.cmd==="publish"&&(le=(0,A.default)(re),de=this._removeTopicAliasAndRecoverTopicName(le),de))return F&&F(de);this.outgoingStore.put(le,Fe=>{if(Fe)return F&&F(Fe);pe(),this._writePacket(re,F)})}_applyTopicAlias(re){if(this.options.protocolVersion===5&&re.cmd==="publish"){let F;re.properties&&(F=re.properties.topicAlias);const pe=re.topic.toString();if(this.topicAliasSend)if(F){if(pe.length!==0&&(this.log("applyTopicAlias :: register topic: %s - alias: %d",pe,F),!this.topicAliasSend.put(pe,F)))return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",pe,F),new Error("Sending Topic Alias out of range")}else pe.length!==0&&(this.options.autoAssignTopicAlias?(F=this.topicAliasSend.getAliasByTopic(pe),F?(re.topic="",re.properties=Object.assign(Object.assign({},re.properties),{topicAlias:F}),this.log("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",pe,F)):(F=this.topicAliasSend.getLruAlias(),this.topicAliasSend.put(pe,F),re.properties=Object.assign(Object.assign({},re.properties),{topicAlias:F}),this.log("applyTopicAlias :: auto assign topic: %s - alias: %d",pe,F))):this.options.autoUseTopicAlias&&(F=this.topicAliasSend.getAliasByTopic(pe),F&&(re.topic="",re.properties=Object.assign(Object.assign({},re.properties),{topicAlias:F}),this.log("applyTopicAlias :: auto use topic: %s - alias: %d",pe,F))));else if(F)return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",pe,F),new Error("Sending Topic Alias out of range")}}_noop(re){this.log("noop ::",re)}_writePacket(re,F){this.log("_writePacket :: packet: %O",re),this.log("_writePacket :: emitting `packetsend`"),this.emit("packetsend",re),this._shiftPingInterval(),this.log("_writePacket :: writing to stream");const pe=p.default.writeToStream(re,this.stream,this.options);this.log("_writePacket :: writeToStream result %s",pe),!pe&&F&&F!==this.noop?(this.log("_writePacket :: handle events on `drain` once through callback."),this.stream.once("drain",F)):F&&(this.log("_writePacket :: invoking cb"),F())}_sendPacket(re,F,pe,le){this.log("_sendPacket :: (%s) :: start",this.options.clientId),pe=pe||this.noop,F=F||this.noop;const de=this._applyTopicAlias(re);if(de){F(de);return}if(!this.connected){if(re.cmd==="auth"){this._writePacket(re,F);return}this.log("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(re,F,pe);return}if(le){this._writePacket(re,F);return}switch(re.cmd){case"publish":break;case"pubrel":this._storeAndSend(re,F,pe);return;default:this._writePacket(re,F);return}switch(re.qos){case 2:case 1:this._storeAndSend(re,F,pe);break;case 0:default:this._writePacket(re,F);break}this.log("_sendPacket :: (%s) :: end",this.options.clientId)}_storePacket(re,F,pe){this.log("_storePacket :: packet: %o",re),this.log("_storePacket :: cb? %s",!!F),pe=pe||this.noop;let le=re;if(le.cmd==="publish"){le=(0,A.default)(re);const Fe=this._removeTopicAliasAndRecoverTopicName(le);if(Fe)return F&&F(Fe)}const de=le.qos||0;de===0&&this.queueQoSZero||le.cmd!=="publish"?this.queue.push({packet:le,cb:F}):de>0?(F=this.outgoing[le.messageId]?this.outgoing[le.messageId].cb:null,this.outgoingStore.put(le,Fe=>{if(Fe)return F&&F(Fe);pe()})):F&&F(new Error("No connection to broker"))}_setupPingTimer(){this.log("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive),!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=(0,b.default)(()=>{this._checkPing()},this.options.keepalive*1e3))}_shiftPingInterval(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(this.options.keepalive*1e3)}_checkPing(){this.log("_checkPing :: checking ping..."),this.pingResp?(this.log("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(this.log("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))}_resubscribe(){this.log("_resubscribe");const re=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion>=4&&!this.connackPacket.sessionPresent)&&re.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){this.log("_resubscribe: protocolVersion 5");for(let F=0;F<re.length;F++){const pe={};pe[re[F]]=this._resubscribeTopics[re[F]],pe.resubscribe=!0,this.subscribe(pe,{properties:pe[re[F]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1}_onConnect(re){if(this.disconnected){this.emit("connect",re);return}this.connackPacket=re,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0;const F=()=>{let pe=this.outgoingStore.createStream();const le=()=>{pe.destroy(),pe=null,this._flushStoreProcessingQueue(),de()},de=()=>{this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={}};this.once("close",le),pe.on("error",Ie=>{de(),this._flushStoreProcessingQueue(),this.removeListener("close",le),this.emit("error",Ie)});const Fe=()=>{if(!pe)return;const Ie=pe.read(1);let At;if(!Ie){pe.once("readable",Fe);return}if(this._storeProcessing=!0,this._packetIdsDuringStoreProcessing[Ie.messageId]){Fe();return}!this.disconnecting&&!this.reconnectTimer?(At=this.outgoing[Ie.messageId]?this.outgoing[Ie.messageId].cb:null,this.outgoing[Ie.messageId]={volatile:!1,cb(_e,qe){At&&At(_e,qe),Fe()}},this._packetIdsDuringStoreProcessing[Ie.messageId]=!0,this.messageIdProvider.register(Ie.messageId)?this._sendPacket(Ie,void 0,void 0,!0):this.log("messageId: %d has already used.",Ie.messageId)):pe.destroy&&pe.destroy()};pe.on("end",()=>{let Ie=!0;for(const At in this._packetIdsDuringStoreProcessing)if(!this._packetIdsDuringStoreProcessing[At]){Ie=!1;break}Ie?(de(),this.removeListener("close",le),this._invokeAllStoreProcessingQueue(),this.emit("connect",re)):F()}),Fe()};F()}_invokeStoreProcessingQueue(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){const re=this._storeProcessingQueue[0];if(re&&re.invoke())return this._storeProcessingQueue.shift(),!0}return!1}_invokeAllStoreProcessingQueue(){for(;this._invokeStoreProcessingQueue(););}_flushStoreProcessingQueue(){for(const re of this._storeProcessingQueue)re.cbStorePut&&re.cbStorePut(new Error("Connection closed")),re.callback&&re.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)}_removeOutgoingAndStoreMessage(re,F){delete this.outgoing[re],this.outgoingStore.del({messageId:re},(pe,le)=>{F(pe,le),this.messageIdProvider.deallocate(re),this._invokeStoreProcessingQueue()})}}a.default=z}).call(this)}).call(this,n("_process"),typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{"./TypedEmitter":1,"./default-message-id-provider":9,"./handlers":13,"./store":18,"./topic-alias-recv":19,"./validations":22,_process:102,debug:30,"mqtt-packet":75,"readable-stream":125,reinterval:131,"rfdc/default":132}],3:[function(n,o,a){var u=this&&this.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(a,"__esModule",{value:!0});const c=n("buffer"),d=n("readable-stream"),f=u(n("duplexify"));let h,y,g,p=!1;function v(){const T=new d.Transform;return T._write=(S,x,L)=>{h.sendSocketMessage({data:S.buffer,success(){L()},fail(){L(new Error)}})},T._flush=S=>{h.closeSocket({success(){S()}})},T}function _(T){T.hostname||(T.hostname="localhost"),T.path||(T.path="/"),T.wsOptions||(T.wsOptions={})}function b(T,S){const x=T.protocol==="alis"?"wss":"ws";let L=`${x}://${T.hostname}${T.path}`;return T.port&&T.port!==80&&T.port!==443&&(L=`${x}://${T.hostname}:${T.port}${T.path}`),typeof T.transformWsUrl=="function"&&(L=T.transformWsUrl(L,T,S)),L}function A(){p||(p=!0,h.onSocketOpen(()=>{g.setReadable(y),g.setWritable(y),g.emit("connect")}),h.onSocketMessage(T=>{if(typeof T.data=="string"){const S=c.Buffer.from(T.data,"base64");y.push(S)}else{const S=new FileReader;S.addEventListener("load",()=>{let x=S.result;x instanceof ArrayBuffer?x=c.Buffer.from(x):x=c.Buffer.from(x,"utf8"),y.push(x)}),S.readAsArrayBuffer(T.data)}}),h.onSocketClose(()=>{g.end(),g.destroy()}),h.onSocketError(T=>{g.destroy(T)}))}const w=(T,S)=>{if(S.hostname=S.hostname||S.host,!S.hostname)throw new Error("Could not determine host. Specify host manually.");const x=S.protocolId==="MQIsdp"&&S.protocolVersion===3?"mqttv3.1":"mqtt";_(S);const L=b(S,T);return h=S.my,h.connectSocket({url:L,protocols:x}),y=v(),g=f.default.obj(),A(),g};a.default=w},{buffer:29,duplexify:32,"readable-stream":125}],4:[function(n,o,a){var u=this&&this.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(a,"__esModule",{value:!0}),a.connectAsync=void 0;const c=u(n("debug")),d=u(n("url")),f=u(n("../client")),h=u(n("../is-browser")),y=(0,c.default)("mqttjs"),g={};h.default?(g.wx=n("./wx").default,g.wxs=n("./wx").default,g.ali=n("./ali").default,g.alis=n("./ali").default):(g.mqtt=n("./tcp").default,g.tcp=n("./tcp").default,g.ssl=n("./tls").default,g.tls=g.ssl,g.mqtts=n("./tls").default),g.ws=n("./ws").default,g.wss=n("./ws").default;function p(b){let A;b.auth&&(A=b.auth.match(/^(.+):(.+)$/),A?(b.username=A[1],b.password=A[2]):b.username=b.auth)}function v(b,A){if(y("connecting to an MQTT broker..."),typeof b=="object"&&!A&&(A=b,b=""),A=A||{},b&&typeof b=="string"){const S=d.default.parse(b,!0);if(S.port!=null&&(S.port=Number(S.port)),A=Object.assign(Object.assign({},S),A),A.protocol===null)throw new Error("Missing protocol");A.protocol=A.protocol.replace(/:$/,"")}if(p(A),A.query&&typeof A.query.clientId=="string"&&(A.clientId=A.query.clientId),A.cert&&A.key)if(A.protocol){if(["mqtts","wss","wxs","alis"].indexOf(A.protocol)===-1)switch(A.protocol){case"mqtt":A.protocol="mqtts";break;case"ws":A.protocol="wss";break;case"wx":A.protocol="wxs";break;case"ali":A.protocol="alis";break;default:throw new Error(`Unknown protocol for secure connection: "${A.protocol}"!`)}}else throw new Error("Missing secure protocol key");if(!g[A.protocol]){const S=["mqtts","wss"].indexOf(A.protocol)!==-1;A.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((x,L)=>S&&L%2===0?!1:typeof g[x]=="function")[0]}if(A.clean===!1&&!A.clientId)throw new Error("Missing clientId for unclean clients");A.protocol&&(A.defaultProtocol=A.protocol);function w(S){return A.servers&&((!S._reconnectCount||S._reconnectCount===A.servers.length)&&(S._reconnectCount=0),A.host=A.servers[S._reconnectCount].host,A.port=A.servers[S._reconnectCount].port,A.protocol=A.servers[S._reconnectCount].protocol?A.servers[S._reconnectCount].protocol:A.defaultProtocol,A.hostname=A.host,S._reconnectCount++),y("calling streambuilder for",A.protocol),g[A.protocol](S,A)}const T=new f.default(w,A);return T.on("error",()=>{}),T}function _(b,A,w=!0){return new Promise((T,S)=>{const x=v(b,A),L={connect:O=>{M(),T(x)},end:()=>{M(),T(x)},error:O=>{M(),x.end(),S(O)}};w===!1&&(L.close=()=>{L.error(new Error("Couldn't connect to server"))});function M(){Object.keys(L).forEach(O=>{x.off(O,L[O])})}Object.keys(L).forEach(O=>{x.on(O,L[O])})})}a.connectAsync=_,a.default=v},{"../client":2,"../is-browser":16,"./ali":3,"./tcp":5,"./tls":6,"./ws":7,"./wx":8,debug:30,url:137}],5:[function(n,o,a){var u=this&&this.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(a,"__esModule",{value:!0});const c=u(n("net")),f=(0,u(n("debug")).default)("mqttjs:tcp"),h=(y,g)=>{g.port=g.port||1883,g.hostname=g.hostname||g.host||"localhost";const{port:p}=g,v=g.hostname;return f("port %d and host %s",p,v),c.default.createConnection(p,v)};a.default=h},{debug:30,net:26}],6:[function(n,o,a){var u=this&&this.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(a,"__esModule",{value:!0});const c=u(n("tls")),d=u(n("net")),h=(0,u(n("debug")).default)("mqttjs:tls"),y=(g,p)=>{p.port=p.port||8883,p.host=p.hostname||p.host||"localhost",d.default.isIP(p.host)===0&&(p.servername=p.host),p.rejectUnauthorized=p.rejectUnauthorized!==!1,delete p.path,h("port %d host %s rejectUnauthorized %b",p.port,p.host,p.rejectUnauthorized);const v=c.default.connect(p);v.on("secureConnect",()=>{p.rejectUnauthorized&&!v.authorized?v.emit("error",new Error("TLS not authorized")):v.removeListener("error",_)});function _(b){p.rejectUnauthorized&&g.emit("error",b),v.end()}return v.on("error",_),v};a.default=y},{debug:30,net:26,tls:26}],7:[function(n,o,a){var u=this&&this.__importDefault||function(L){return L&&L.__esModule?L:{default:L}};Object.defineProperty(a,"__esModule",{value:!0});const c=n("buffer"),d=u(n("ws")),f=u(n("debug")),h=u(n("duplexify")),y=n("readable-stream"),g=u(n("../is-browser")),p=(0,f.default)("mqttjs:ws"),v=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];function _(L,M){let O=`${L.protocol}://${L.hostname}:${L.port}${L.path}`;return typeof L.transformWsUrl=="function"&&(O=L.transformWsUrl(O,L,M)),O}function b(L){const M=L;return L.hostname||(M.hostname="localhost"),L.port||(L.protocol==="wss"?M.port=443:M.port=80),L.path||(M.path="/"),L.wsOptions||(M.wsOptions={}),!g.default&&L.protocol==="wss"&&v.forEach(O=>{Object.prototype.hasOwnProperty.call(L,O)&&!Object.prototype.hasOwnProperty.call(L.wsOptions,O)&&(M.wsOptions[O]=L[O])}),M}function A(L){const M=b(L);if(M.hostname||(M.hostname=M.host),!M.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");const O=new URL(document.URL);M.hostname=O.hostname,M.port||(M.port=Number(O.port))}return M.objectMode===void 0&&(M.objectMode=!(M.binary===!0||M.binary===void 0)),M}function w(L,M,O){p("createWebSocket"),p(`protocol: ${O.protocolId} ${O.protocolVersion}`);const ie=O.protocolId==="MQIsdp"&&O.protocolVersion===3?"mqttv3.1":"mqtt";p(`creating new Websocket for url: ${M} and protocol: ${ie}`);let $;return O.createWebsocket?$=O.createWebsocket(M,[ie],O):$=new d.default(M,[ie],O.wsOptions),$}function T(L,M){const O=M.protocolId==="MQIsdp"&&M.protocolVersion===3?"mqttv3.1":"mqtt",ie=_(M,L);let $;return M.createWebsocket?$=M.createWebsocket(ie,[O],M):$=new WebSocket(ie,[O]),$.binaryType="arraybuffer",$}const S=(L,M)=>{p("streamBuilder");const O=b(M),ie=_(O,L),$=w(L,ie,O),z=d.default.createWebSocketStream($,O.wsOptions);return z.url=ie,$.on("close",()=>{z.destroy()}),z},x=(L,M)=>{p("browserStreamBuilder");let O;const $=A(M).browserBufferSize||1024*512,z=M.browserBufferTimeout||1e3,V=!M.objectMode,re=T(L,M),F=le(M,qe,In);M.objectMode||(F._writev=_e),F.on("close",()=>{re.close()});const pe=typeof re.addEventListener<"u";re.readyState===re.OPEN?O=F:(O=(0,h.default)(void 0,void 0,M),M.objectMode||(O._writev=_e),pe?re.addEventListener("open",de):re.onopen=de),O.socket=re,pe?(re.addEventListener("close",Fe),re.addEventListener("error",Ie),re.addEventListener("message",At)):(re.onclose=Fe,re.onerror=Ie,re.onmessage=At);function le(vn,Pt,he){const Ue=new y.Transform({objectMode:vn.objectMode});return Ue._write=Pt,Ue._flush=he,Ue}function de(){O.setReadable(F),O.setWritable(F),O.emit("connect")}function Fe(){O.end(),O.destroy()}function Ie(vn){O.destroy(vn)}function At(vn){let{data:Pt}=vn;Pt instanceof ArrayBuffer?Pt=c.Buffer.from(Pt):Pt=c.Buffer.from(Pt,"utf8"),F.push(Pt)}function _e(vn,Pt){const he=new Array(vn.length);for(let Ue=0;Ue<vn.length;Ue++)typeof vn[Ue].chunk=="string"?he[Ue]=c.Buffer.from(vn[Ue],"utf8"):he[Ue]=vn[Ue].chunk;this._write(c.Buffer.concat(he),"binary",Pt)}function qe(vn,Pt,he){re.bufferedAmount>$&&setTimeout(qe,z,vn,Pt,he),V&&typeof vn=="string"&&(vn=c.Buffer.from(vn,"utf8"));try{re.send(vn)}catch(Ue){return he(Ue)}he()}function In(vn){re.close(),vn()}return O};a.default=g.default?x:S},{"../is-browser":16,buffer:29,debug:30,duplexify:32,"readable-stream":125,ws:141}],8:[function(n,o,a){var u=this&&this.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(a,"__esModule",{value:!0});const c=n("buffer"),d=n("readable-stream"),f=u(n("duplexify"));let h,y,g;function p(){const w=new d.Transform;return w._write=(T,S,x)=>{h.send({data:T.buffer,success(){x()},fail(L){x(new Error(L))}})},w._flush=T=>{h.close({success(){T()}})},w}function v(w){w.hostname||(w.hostname="localhost"),w.path||(w.path="/"),w.wsOptions||(w.wsOptions={})}function _(w,T){const S=w.protocol==="wxs"?"wss":"ws";let x=`${S}://${w.hostname}${w.path}`;return w.port&&w.port!==80&&w.port!==443&&(x=`${S}://${w.hostname}:${w.port}${w.path}`),typeof w.transformWsUrl=="function"&&(x=w.transformWsUrl(x,w,T)),x}function b(){h.onOpen(()=>{g.setReadable(y),g.setWritable(y),g.emit("connect")}),h.onMessage(w=>{let{data:T}=w;T instanceof ArrayBuffer?T=c.Buffer.from(T):T=c.Buffer.from(T,"utf8"),y.push(T)}),h.onClose(()=>{g.emit("close"),g.end(),g.destroy()}),h.onError(w=>{g.destroy(new Error(w.errMsg))})}const A=(w,T)=>{if(T.hostname=T.hostname||T.host,!T.hostname)throw new Error("Could not determine host. Specify host manually.");const S=T.protocolId==="MQIsdp"&&T.protocolVersion===3?"mqttv3.1":"mqtt";v(T);const x=_(T,w);h=wx.connectSocket({url:x,protocols:[S]}),y=p(),g=f.default.obj(),g._destroy=(M,O)=>{h.close({success(){O&&O(M)}})};const L=g.destroy;return g.destroy=()=>{g.destroy=L,setTimeout(()=>{h.close({fail(){g._destroy(new Error)}})},0)},b(),g};a.default=A},{buffer:29,duplexify:32,"readable-stream":125}],9:[function(n,o,a){Object.defineProperty(a,"__esModule",{value:!0});class u{constructor(){this.nextId=Math.max(1,Math.floor(Math.random()*65535))}allocate(){const d=this.nextId++;return this.nextId===65536&&(this.nextId=1),d}getLastAllocated(){return this.nextId===1?65535:this.nextId-1}register(d){return!0}deallocate(d){}clear(){}}a.default=u},{}],10:[function(n,o,a){Object.defineProperty(a,"__esModule",{value:!0}),a.ReasonCodes=void 0,a.ReasonCodes={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"};const u=(c,d)=>{const{messageId:f}=d,h=d.cmd;let y=null;const g=c.outgoing[f]?c.outgoing[f].cb:null;let p;if(!g){c.log("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(c.log("_handleAck :: packet type",h),h){case"pubcomp":case"puback":{const v=d.reasonCode;v&&v>0&&v!==16?(p=new Error(`Publish error: ${a.ReasonCodes[v]}`),p.code=v,c._removeOutgoingAndStoreMessage(f,()=>{g(p,d)})):c._removeOutgoingAndStoreMessage(f,g);break}case"pubrec":{y={cmd:"pubrel",qos:2,messageId:f};const v=d.reasonCode;v&&v>0&&v!==16?(p=new Error(`Publish error: ${a.ReasonCodes[v]}`),p.code=v,c._removeOutgoingAndStoreMessage(f,()=>{g(p,d)})):c._sendPacket(y);break}case"suback":{delete c.outgoing[f],c.messageIdProvider.deallocate(f);const v=d.granted;for(let _=0;_<v.length;_++)if(v[_]&128){const b=c.messageIdToTopic[f];b&&b.forEach(A=>{delete c._resubscribeTopics[A]})}delete c.messageIdToTopic[f],c._invokeStoreProcessingQueue(),g(null,d);break}case"unsuback":{delete c.outgoing[f],c.messageIdProvider.deallocate(f),c._invokeStoreProcessingQueue(),g(null);break}default:c.emit("error",new Error("unrecognized packet type"))}c.disconnecting&&Object.keys(c.outgoing).length===0&&c.emit("outgoingEmpty")};a.default=u},{}],11:[function(n,o,a){Object.defineProperty(a,"__esModule",{value:!0});const u=n("../shared"),c=n("./ack"),d=(f,h)=>{const{options:y}=f,g=y.protocolVersion,p=g===5?h.reasonCode:h.returnCode;if(g!==5){const v=new u.ErrorWithReasonCode(`Protocol error: Auth packets are only supported in MQTT 5. Your version:${g}`,p);f.emit("error",v);return}f.handleAuth(h,(v,_)=>{if(v){f.emit("error",v);return}if(p===24)f.reconnecting=!1,f._sendPacket(_);else{const b=new u.ErrorWithReasonCode(`Connection refused: ${c.ReasonCodes[p]}`,p);f.emit("error",b)}})};a.default=d},{"../shared":17,"./ack":10}],12:[function(n,o,a){var u=this&&this.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(a,"__esModule",{value:!0});const c=n("./ack"),d=u(n("../topic-alias-send")),f=n("../shared"),h=(y,g)=>{y.log("_handleConnack");const{options:p}=y,_=p.protocolVersion===5?g.reasonCode:g.returnCode;if(clearTimeout(y.connackTimer),delete y.topicAliasSend,g.properties){if(g.properties.topicAliasMaximum){if(g.properties.topicAliasMaximum>65535){y.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}g.properties.topicAliasMaximum>0&&(y.topicAliasSend=new d.default(g.properties.topicAliasMaximum))}g.properties.serverKeepAlive&&p.keepalive&&(p.keepalive=g.properties.serverKeepAlive,y._shiftPingInterval()),g.properties.maximumPacketSize&&(p.properties||(p.properties={}),p.properties.maximumPacketSize=g.properties.maximumPacketSize)}if(_===0)y.reconnecting=!1,y._onConnect(g);else if(_>0){const b=new f.ErrorWithReasonCode(`Connection refused: ${c.ReasonCodes[_]}`,_);y.emit("error",b)}};a.default=h},{"../shared":17,"../topic-alias-send":20,"./ack":10}],13:[function(n,o,a){var u=this&&this.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(a,"__esModule",{value:!0});const c=u(n("./publish")),d=u(n("./auth")),f=u(n("./connack")),h=u(n("./ack")),y=u(n("./pubrel")),g=(p,v,_)=>{const{options:b}=p;if(b.protocolVersion===5&&b.properties&&b.properties.maximumPacketSize&&b.properties.maximumPacketSize<v.length)return p.emit("error",new Error(`exceeding packets size ${v.cmd}`)),p.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),p;switch(p.log("_handlePacket :: emitting packetreceive"),p.emit("packetreceive",v),v.cmd){case"publish":(0,c.default)(p,v,_);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":(0,h.default)(p,v),_();break;case"pubrel":(0,y.default)(p,v,_);break;case"connack":(0,f.default)(p,v),_();break;case"auth":(0,d.default)(p,v),_();break;case"pingresp":p.pingResp=!0,_();break;case"disconnect":p.emit("disconnect",v),_();break;default:p.log("_handlePacket :: unknown command"),_();break}};a.default=g},{"./ack":10,"./auth":11,"./connack":12,"./publish":14,"./pubrel":15}],14:[function(n,o,a){Object.defineProperty(a,"__esModule",{value:!0});const u=[0,16,128,131,135,144,145,151,153],c=(d,f,h)=>{d.log("handlePublish: packet %o",f),h=typeof h<"u"?h:d.noop;let y=f.topic.toString();const g=f.payload,{qos:p}=f,{messageId:v}=f,{options:_}=d;if(d.options.protocolVersion===5){let b;if(f.properties&&(b=f.properties.topicAlias),typeof b<"u")if(y.length===0)if(b>0&&b<=65535){const A=d.topicAliasRecv.getTopicByAlias(b);if(A)y=A,d.log("handlePublish :: topic complemented by alias. topic: %s - alias: %d",y,b);else{d.log("handlePublish :: unregistered topic alias. alias: %d",b),d.emit("error",new Error("Received unregistered Topic Alias"));return}}else{d.log("handlePublish :: topic alias out of range. alias: %d",b),d.emit("error",new Error("Received Topic Alias is out of range"));return}else if(d.topicAliasRecv.put(y,b))d.log("handlePublish :: registered topic: %s - alias: %d",y,b);else{d.log("handlePublish :: topic alias out of range. alias: %d",b),d.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(d.log("handlePublish: qos %d",p),p){case 2:{_.customHandleAcks(y,g,f,(b,A)=>{if(typeof b=="number"&&(A=b,b=null),b)return d.emit("error",b);if(u.indexOf(A)===-1)return d.emit("error",new Error("Wrong reason code for pubrec"));A?d._sendPacket({cmd:"pubrec",messageId:v,reasonCode:A},h):d.incomingStore.put(f,()=>{d._sendPacket({cmd:"pubrec",messageId:v},h)})});break}case 1:{_.customHandleAcks(y,g,f,(b,A)=>{if(typeof b=="number"&&(A=b,b=null),b)return d.emit("error",b);if(u.indexOf(A)===-1)return d.emit("error",new Error("Wrong reason code for puback"));A||d.emit("message",y,g,f),d.handleMessage(f,w=>{if(w)return h&&h(w);d._sendPacket({cmd:"puback",messageId:v,reasonCode:A},h)})});break}case 0:d.emit("message",y,g,f),d.handleMessage(f,h);break;default:d.log("handlePublish: unknown QoS. Doing nothing.");break}};a.default=c},{}],15:[function(n,o,a){Object.defineProperty(a,"__esModule",{value:!0});const u=(c,d,f)=>{c.log("handling pubrel packet");const h=typeof f<"u"?f:c.noop,{messageId:y}=d,g={cmd:"pubcomp",messageId:y};c.incomingStore.get(d,(p,v)=>{p?c._sendPacket(g,h):(c.emit("message",v.topic,v.payload,v),c.handleMessage(v,_=>{if(_)return h(_);c.incomingStore.del(v,c.noop),c._sendPacket(g,h)}))})};a.default=u},{}],16:[function(n,o,a){Object.defineProperty(a,"__esModule",{value:!0});const u=typeof window<"u"&&typeof window.document<"u"||typeof self<"u"&&typeof self.postMessage=="function";a.default=u},{}],17:[function(n,o,a){Object.defineProperty(a,"__esModule",{value:!0}),a.applyMixin=a.ErrorWithReasonCode=void 0;class u extends Error{constructor(f,h){super(f),this.code=h,Object.setPrototypeOf(this,u.prototype),Object.getPrototypeOf(this).name="ErrorWithReasonCode"}}a.ErrorWithReasonCode=u;function c(d,f,h=!1){var y;const g=[f];for(;;){const p=g[0],v=Object.getPrototypeOf(p);if(v!=null&&v.prototype)g.unshift(v);else break}for(const p of g)for(const v of Object.getOwnPropertyNames(p.prototype))(h||v!=="constructor")&&Object.defineProperty(d.prototype,v,(y=Object.getOwnPropertyDescriptor(p.prototype,v))!==null&&y!==void 0?y:Object.create(null))}a.applyMixin=c},{}],18:[function(n,o,a){Object.defineProperty(a,"__esModule",{value:!0});const u=n("readable-stream"),c={objectMode:!0},d={clean:!0};class f{constructor(y){this.options=y||{},this.options=Object.assign(Object.assign({},d),y),this._inflights=new Map}put(y,g){return this._inflights.set(y.messageId,y),g&&g(),this}createStream(){const y=new u.Readable(c),g=[];let p=!1,v=0;return this._inflights.forEach((_,b)=>{g.push(_)}),y._read=()=>{!p&&v<g.length?y.push(g[v++]):y.push(null)},y.destroy=_=>{if(!p)return p=!0,setTimeout(()=>{y.emit("close")},0),y},y}del(y,g){const p=this._inflights.get(y.messageId);return p?(this._inflights.delete(y.messageId),g(null,p)):g&&g(new Error("missing packet")),this}get(y,g){const p=this._inflights.get(y.messageId);return p?g(null,p):g&&g(new Error("missing packet")),this}close(y){this.options.clean&&(this._inflights=null),y&&y()}}a.default=f},{"readable-stream":125}],19:[function(n,o,a){Object.defineProperty(a,"__esModule",{value:!0});class u{constructor(d){this.aliasToTopic={},this.max=d}put(d,f){return f===0||f>this.max?!1:(this.aliasToTopic[f]=d,this.length=Object.keys(this.aliasToTopic).length,!0)}getTopicByAlias(d){return this.aliasToTopic[d]}clear(){this.aliasToTopic={}}}a.default=u},{}],20:[function(n,o,a){var u=this&&this.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(a,"__esModule",{value:!0});const c=u(n("lru-cache")),d=n("number-allocator");class f{constructor(y){y>0&&(this.aliasToTopic=new c.default({max:y}),this.topicToAlias={},this.numberAllocator=new d.NumberAllocator(1,y),this.max=y,this.length=0)}put(y,g){if(g===0||g>this.max)return!1;const p=this.aliasToTopic.get(g);return p&&delete this.topicToAlias[p],this.aliasToTopic.set(g,y),this.topicToAlias[y]=g,this.numberAllocator.use(g),this.length=this.aliasToTopic.size,!0}getTopicByAlias(y){return this.aliasToTopic.get(y)}getAliasByTopic(y){const g=this.topicToAlias[y];return typeof g<"u"&&this.aliasToTopic.get(g),g}clear(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0}getLruAlias(){const y=this.numberAllocator.firstVacant();return y||[...this.aliasToTopic.keys()][this.aliasToTopic.size-1]}}a.default=f},{"lru-cache":72,"number-allocator":98}],21:[function(n,o,a){Object.defineProperty(a,"__esModule",{value:!0});const u=n("number-allocator");class c{constructor(){this.numberAllocator=new u.NumberAllocator(1,65535)}allocate(){return this.lastId=this.numberAllocator.alloc(),this.lastId}getLastAllocated(){return this.lastId}register(f){return this.numberAllocator.use(f)}deallocate(f){this.numberAllocator.free(f)}clear(){this.numberAllocator.clear()}}a.default=c},{"number-allocator":98}],22:[function(n,o,a){Object.defineProperty(a,"__esModule",{value:!0}),a.validateTopics=a.validateTopic=void 0;function u(d){const f=d.split("/");for(let h=0;h<f.length;h++)if(f[h]!=="+"){if(f[h]==="#")return h===f.length-1;if(f[h].indexOf("+")!==-1||f[h].indexOf("#")!==-1)return!1}return!0}a.validateTopic=u;function c(d){if(d.length===0)return"empty_topic_list";for(let f=0;f<d.length;f++)if(!u(d[f]))return d[f];return null}a.validateTopics=c},{}],23:[function(n,o,a){var u=this&&this.__createBinding||(Object.create?function(A,w,T,S){S===void 0&&(S=T);var x=Object.getOwnPropertyDescriptor(w,T);(!x||("get"in x?!w.__esModule:x.writable||x.configurable))&&(x={enumerable:!0,get:function(){return w[T]}}),Object.defineProperty(A,S,x)}:function(A,w,T,S){S===void 0&&(S=T),A[S]=w[T]}),c=this&&this.__setModuleDefault||(Object.create?function(A,w){Object.defineProperty(A,"default",{enumerable:!0,value:w})}:function(A,w){A.default=w}),d=this&&this.__importStar||function(A){if(A&&A.__esModule)return A;var w={};if(A!=null)for(var T in A)T!=="default"&&Object.prototype.hasOwnProperty.call(A,T)&&u(w,A,T);return c(w,A),w},f=this&&this.__exportStar||function(A,w){for(var T in A)T!=="default"&&!Object.prototype.hasOwnProperty.call(w,T)&&u(w,A,T)},h=this&&this.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(a,"__esModule",{value:!0}),a.ReasonCodes=a.UniqueMessageIdProvider=a.DefaultMessageIdProvider=a.Store=a.MqttClient=a.connectAsync=a.connect=a.Client=void 0;const y=h(n("./lib/client"));a.MqttClient=y.default;const g=h(n("./lib/default-message-id-provider"));a.DefaultMessageIdProvider=g.default;const p=h(n("./lib/unique-message-id-provider"));a.UniqueMessageIdProvider=p.default;const v=h(n("./lib/store"));a.Store=v.default;const _=d(n("./lib/connect"));a.connect=_.default,Object.defineProperty(a,"connectAsync",{enumerable:!0,get:function(){return _.connectAsync}}),a.Client=y.default,f(n("./lib/client"),a),f(n("./lib/shared"),a);var b=n("./lib/handlers/ack");Object.defineProperty(a,"ReasonCodes",{enumerable:!0,get:function(){return b.ReasonCodes}})},{"./lib/client":2,"./lib/connect":4,"./lib/default-message-id-provider":9,"./lib/handlers/ack":10,"./lib/shared":17,"./lib/store":18,"./lib/unique-message-id-provider":21}],24:[function(n,o,a){const{AbortController:u,AbortSignal:c}=typeof self<"u"?self:typeof window<"u"?window:void 0;o.exports=u,o.exports.AbortSignal=c,o.exports.default=u},{}],25:[function(n,o,a){a.byteLength=p,a.toByteArray=_,a.fromByteArray=w;for(var u=[],c=[],d=typeof Uint8Array<"u"?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,y=f.length;h<y;++h)u[h]=f[h],c[f.charCodeAt(h)]=h;c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63;function g(T){var S=T.length;if(S%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var x=T.indexOf("=");x===-1&&(x=S);var L=x===S?0:4-x%4;return[x,L]}function p(T){var S=g(T),x=S[0],L=S[1];return(x+L)*3/4-L}function v(T,S,x){return(S+x)*3/4-x}function _(T){var S,x=g(T),L=x[0],M=x[1],O=new d(v(T,L,M)),ie=0,$=M>0?L-4:L,z;for(z=0;z<$;z+=4)S=c[T.charCodeAt(z)]<<18|c[T.charCodeAt(z+1)]<<12|c[T.charCodeAt(z+2)]<<6|c[T.charCodeAt(z+3)],O[ie++]=S>>16&255,O[ie++]=S>>8&255,O[ie++]=S&255;return M===2&&(S=c[T.charCodeAt(z)]<<2|c[T.charCodeAt(z+1)]>>4,O[ie++]=S&255),M===1&&(S=c[T.charCodeAt(z)]<<10|c[T.charCodeAt(z+1)]<<4|c[T.charCodeAt(z+2)]>>2,O[ie++]=S>>8&255,O[ie++]=S&255),O}function b(T){return u[T>>18&63]+u[T>>12&63]+u[T>>6&63]+u[T&63]}function A(T,S,x){for(var L,M=[],O=S;O<x;O+=3)L=(T[O]<<16&16711680)+(T[O+1]<<8&65280)+(T[O+2]&255),M.push(b(L));return M.join("")}function w(T){for(var S,x=T.length,L=x%3,M=[],O=16383,ie=0,$=x-L;ie<$;ie+=O)M.push(A(T,ie,ie+O>$?$:ie+O));return L===1?(S=T[x-1],M.push(u[S>>2]+u[S<<4&63]+"==")):L===2&&(S=(T[x-2]<<8)+T[x-1],M.push(u[S>>10]+u[S>>4&63]+u[S<<2&63]+"=")),M.join("")}},{}],26:[function(n,o,a){},{}],27:[function(n,o,a){var u=n("buffer"),c=u.Buffer;function d(h,y){for(var g in h)y[g]=h[g]}c.from&&c.alloc&&c.allocUnsafe&&c.allocUnsafeSlow?o.exports=u:(d(u,a),a.Buffer=f);function f(h,y,g){return c(h,y,g)}d(c,f),f.from=function(h,y,g){if(typeof h=="number")throw new TypeError("Argument must not be a number");return c(h,y,g)},f.alloc=function(h,y,g){if(typeof h!="number")throw new TypeError("Argument must be a number");var p=c(h);return y!==void 0?typeof g=="string"?p.fill(y,g):p.fill(y):p.fill(0),p},f.allocUnsafe=function(h){if(typeof h!="number")throw new TypeError("Argument must be a number");return c(h)},f.allocUnsafeSlow=function(h){if(typeof h!="number")throw new TypeError("Argument must be a number");return u.SlowBuffer(h)}},{buffer:29}],28:[function(n,o,a){var u=n("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 d(M){if(!M)return"utf8";for(var O;;)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(O)return;M=(""+M).toLowerCase(),O=!0}}function f(M){var O=d(M);if(typeof O!="string"&&(u.isEncoding===c||!c(M)))throw new Error("Unknown encoding: "+M);return O||M}a.StringDecoder=h;function h(M){this.encoding=f(M);var O;switch(this.encoding){case"utf16le":this.text=A,this.end=w,O=4;break;case"utf8":this.fillLast=v,O=4;break;case"base64":this.text=T,this.end=S,O=3;break;default:this.write=x,this.end=L;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=u.allocUnsafe(O)}h.prototype.write=function(M){if(M.length===0)return"";var O,ie;if(this.lastNeed){if(O=this.fillLast(M),O===void 0)return"";ie=this.lastNeed,this.lastNeed=0}else ie=0;return ie<M.length?O?O+this.text(M,ie):this.text(M,ie):O||""},h.prototype.end=b,h.prototype.text=_,h.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 y(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,O,ie){var $=O.length-1;if($<ie)return 0;var z=y(O[$]);return z>=0?(z>0&&(M.lastNeed=z-1),z):--$<ie||z===-2?0:(z=y(O[$]),z>=0?(z>0&&(M.lastNeed=z-2),z):--$<ie||z===-2?0:(z=y(O[$]),z>=0?(z>0&&(z===2?z=0:M.lastNeed=z-3),z):0))}function p(M,O,ie){if((O[0]&192)!==128)return M.lastNeed=0,"�";if(M.lastNeed>1&&O.length>1){if((O[1]&192)!==128)return M.lastNeed=1,"�";if(M.lastNeed>2&&O.length>2&&(O[2]&192)!==128)return M.lastNeed=2,"�"}}function v(M){var O=this.lastTotal-this.lastNeed,ie=p(this,M);if(ie!==void 0)return ie;if(this.lastNeed<=M.length)return M.copy(this.lastChar,O,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);M.copy(this.lastChar,O,0,M.length),this.lastNeed-=M.length}function _(M,O){var ie=g(this,M,O);if(!this.lastNeed)return M.toString("utf8",O);this.lastTotal=ie;var $=M.length-(ie-this.lastNeed);return M.copy(this.lastChar,0,$),M.toString("utf8",O,$)}function b(M){var O=M&&M.length?this.write(M):"";return this.lastNeed?O+"�":O}function A(M,O){if((M.length-O)%2===0){var ie=M.toString("utf16le",O);if(ie){var $=ie.charCodeAt(ie.length-1);if($>=55296&&$<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=M[M.length-2],this.lastChar[1]=M[M.length-1],ie.slice(0,-1)}return ie}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=M[M.length-1],M.toString("utf16le",O,M.length-1)}function w(M){var O=M&&M.length?this.write(M):"";if(this.lastNeed){var ie=this.lastTotal-this.lastNeed;return O+this.lastChar.toString("utf16le",0,ie)}return O}function T(M,O){var ie=(M.length-O)%3;return ie===0?M.toString("base64",O):(this.lastNeed=3-ie,this.lastTotal=3,ie===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",O,M.length-ie))}function S(M){var O=M&&M.length?this.write(M):"";return this.lastNeed?O+this.lastChar.toString("base64",0,3-this.lastNeed):O}function x(M){return M.toString(this.encoding)}function L(M){return M&&M.length?this.write(M):""}},{"safe-buffer":27}],29:[function(n,o,a){(function(u){(function(){var c=n("base64-js"),d=n("ieee754");a.Buffer=g,a.SlowBuffer=L,a.INSPECT_MAX_BYTES=50;var f=2147483647;a.kMaxLength=f,g.TYPED_ARRAY_SUPPORT=h(),!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 h(){try{var Y=new Uint8Array(1);return Y.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},Y.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 y(Y){if(Y>f)throw new RangeError('The value "'+Y+'" is invalid for option "size"');var k=new Uint8Array(Y);return k.__proto__=g.prototype,k}function g(Y,k,D){if(typeof Y=="number"){if(typeof k=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return b(Y)}return p(Y,k,D)}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 p(Y,k,D){if(typeof Y=="string")return A(Y,k);if(ArrayBuffer.isView(Y))return w(Y);if(Y==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Y);if(oe(Y,ArrayBuffer)||Y&&oe(Y.buffer,ArrayBuffer))return T(Y,k,D);if(typeof Y=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var j=Y.valueOf&&Y.valueOf();if(j!=null&&j!==Y)return g.from(j,k,D);var xe=S(Y);if(xe)return xe;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Y[Symbol.toPrimitive]=="function")return g.from(Y[Symbol.toPrimitive]("string"),k,D);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Y)}g.from=function(Y,k,D){return p(Y,k,D)},g.prototype.__proto__=Uint8Array.prototype,g.__proto__=Uint8Array;function v(Y){if(typeof Y!="number")throw new TypeError('"size" argument must be of type number');if(Y<0)throw new RangeError('The value "'+Y+'" is invalid for option "size"')}function _(Y,k,D){return v(Y),Y<=0?y(Y):k!==void 0?typeof D=="string"?y(Y).fill(k,D):y(Y).fill(k):y(Y)}g.alloc=function(Y,k,D){return _(Y,k,D)};function b(Y){return v(Y),y(Y<0?0:x(Y)|0)}g.allocUnsafe=function(Y){return b(Y)},g.allocUnsafeSlow=function(Y){return b(Y)};function A(Y,k){if((typeof k!="string"||k==="")&&(k="utf8"),!g.isEncoding(k))throw new TypeError("Unknown encoding: "+k);var D=M(Y,k)|0,j=y(D),xe=j.write(Y,k);return xe!==D&&(j=j.slice(0,xe)),j}function w(Y){for(var k=Y.length<0?0:x(Y.length)|0,D=y(k),j=0;j<k;j+=1)D[j]=Y[j]&255;return D}function T(Y,k,D){if(k<0||Y.byteLength<k)throw new RangeError('"offset" is outside of buffer bounds');if(Y.byteLength<k+(D||0))throw new RangeError('"length" is outside of buffer bounds');var j;return k===void 0&&D===void 0?j=new Uint8Array(Y):D===void 0?j=new Uint8Array(Y,k):j=new Uint8Array(Y,k,D),j.__proto__=g.prototype,j}function S(Y){if(g.isBuffer(Y)){var k=x(Y.length)|0,D=y(k);return D.length===0||Y.copy(D,0,0,k),D}if(Y.length!==void 0)return typeof Y.length!="number"||ae(Y.length)?y(0):w(Y);if(Y.type==="Buffer"&&Array.isArray(Y.data))return w(Y.data)}function x(Y){if(Y>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return Y|0}function L(Y){return+Y!=Y&&(Y=0),g.alloc(+Y)}g.isBuffer=function(k){return k!=null&&k._isBuffer===!0&&k!==g.prototype},g.compare=function(k,D){if(oe(k,Uint8Array)&&(k=g.from(k,k.offset,k.byteLength)),oe(D,Uint8Array)&&(D=g.from(D,D.offset,D.byteLength)),!g.isBuffer(k)||!g.isBuffer(D))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(k===D)return 0;for(var j=k.length,xe=D.length,hn=0,_n=Math.min(j,xe);hn<_n;++hn)if(k[hn]!==D[hn]){j=k[hn],xe=D[hn];break}return j<xe?-1:xe<j?1:0},g.isEncoding=function(k){switch(String(k).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(k,D){if(!Array.isArray(k))throw new TypeError('"list" argument must be an Array of Buffers');if(k.length===0)return g.alloc(0);var j;if(D===void 0)for(D=0,j=0;j<k.length;++j)D+=k[j].length;var xe=g.allocUnsafe(D),hn=0;for(j=0;j<k.length;++j){var _n=k[j];if(oe(_n,Uint8Array)&&(_n=g.from(_n)),!g.isBuffer(_n))throw new TypeError('"list" argument must be an Array of Buffers');_n.copy(xe,hn),hn+=_n.length}return xe};function M(Y,k){if(g.isBuffer(Y))return Y.length;if(ArrayBuffer.isView(Y)||oe(Y,ArrayBuffer))return Y.byteLength;if(typeof Y!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Y);var D=Y.length,j=arguments.length>2&&arguments[2]===!0;if(!j&&D===0)return 0;for(var xe=!1;;)switch(k){case"ascii":case"latin1":case"binary":return D;case"utf8":case"utf-8":return Ne(Y).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D*2;case"hex":return D>>>1;case"base64":return kt(Y).length;default:if(xe)return j?-1:Ne(Y).length;k=(""+k).toLowerCase(),xe=!0}}g.byteLength=M;function O(Y,k,D){var j=!1;if((k===void 0||k<0)&&(k=0),k>this.length||((D===void 0||D>this.length)&&(D=this.length),D<=0)||(D>>>=0,k>>>=0,D<=k))return"";for(Y||(Y="utf8");;)switch(Y){case"hex":return vn(this,k,D);case"utf8":case"utf-8":return Ie(this,k,D);case"ascii":return qe(this,k,D);case"latin1":case"binary":return In(this,k,D);case"base64":return Fe(this,k,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pt(this,k,D);default:if(j)throw new TypeError("Unknown encoding: "+Y);Y=(Y+"").toLowerCase(),j=!0}}g.prototype._isBuffer=!0;function ie(Y,k,D){var j=Y[k];Y[k]=Y[D],Y[D]=j}g.prototype.swap16=function(){var k=this.length;if(k%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var D=0;D<k;D+=2)ie(this,D,D+1);return this},g.prototype.swap32=function(){var k=this.length;if(k%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var D=0;D<k;D+=4)ie(this,D,D+3),ie(this,D+1,D+2);return this},g.prototype.swap64=function(){var k=this.length;if(k%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var D=0;D<k;D+=8)ie(this,D,D+7),ie(this,D+1,D+6),ie(this,D+2,D+5),ie(this,D+3,D+4);return this},g.prototype.toString=function(){var k=this.length;return k===0?"":arguments.length===0?Ie(this,0,k):O.apply(this,arguments)},g.prototype.toLocaleString=g.prototype.toString,g.prototype.equals=function(k){if(!g.isBuffer(k))throw new TypeError("Argument must be a Buffer");return this===k?!0:g.compare(this,k)===0},g.prototype.inspect=function(){var k="",D=a.INSPECT_MAX_BYTES;return k=this.toString("hex",0,D).replace(/(.{2})/g,"$1 ").trim(),this.length>D&&(k+=" ... "),"<Buffer "+k+">"},g.prototype.compare=function(k,D,j,xe,hn){if(oe(k,Uint8Array)&&(k=g.from(k,k.offset,k.byteLength)),!g.isBuffer(k))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof k);if(D===void 0&&(D=0),j===void 0&&(j=k?k.length:0),xe===void 0&&(xe=0),hn===void 0&&(hn=this.length),D<0||j>k.length||xe<0||hn>this.length)throw new RangeError("out of range index");if(xe>=hn&&D>=j)return 0;if(xe>=hn)return-1;if(D>=j)return 1;if(D>>>=0,j>>>=0,xe>>>=0,hn>>>=0,this===k)return 0;for(var _n=hn-xe,Sn=j-D,xn=Math.min(_n,Sn),Ln=this.slice(xe,hn),Ve=k.slice(D,j),ze=0;ze<xn;++ze)if(Ln[ze]!==Ve[ze]){_n=Ln[ze],Sn=Ve[ze];break}return _n<Sn?-1:Sn<_n?1:0};function $(Y,k,D,j,xe){if(Y.length===0)return-1;if(typeof D=="string"?(j=D,D=0):D>2147483647?D=2147483647:D<-2147483648&&(D=-2147483648),D=+D,ae(D)&&(D=xe?0:Y.length-1),D<0&&(D=Y.length+D),D>=Y.length){if(xe)return-1;D=Y.length-1}else if(D<0)if(xe)D=0;else return-1;if(typeof k=="string"&&(k=g.from(k,j)),g.isBuffer(k))return k.length===0?-1:z(Y,k,D,j,xe);if(typeof k=="number")return k=k&255,typeof Uint8Array.prototype.indexOf=="function"?xe?Uint8Array.prototype.indexOf.call(Y,k,D):Uint8Array.prototype.lastIndexOf.call(Y,k,D):z(Y,[k],D,j,xe);throw new TypeError("val must be string, number or Buffer")}function z(Y,k,D,j,xe){var hn=1,_n=Y.length,Sn=k.length;if(j!==void 0&&(j=String(j).toLowerCase(),j==="ucs2"||j==="ucs-2"||j==="utf16le"||j==="utf-16le")){if(Y.length<2||k.length<2)return-1;hn=2,_n/=2,Sn/=2,D/=2}function xn(An,Tn){return hn===1?An[Tn]:An.readUInt16BE(Tn*hn)}var Ln;if(xe){var Ve=-1;for(Ln=D;Ln<_n;Ln++)if(xn(Y,Ln)===xn(k,Ve===-1?0:Ln-Ve)){if(Ve===-1&&(Ve=Ln),Ln-Ve+1===Sn)return Ve*hn}else Ve!==-1&&(Ln-=Ln-Ve),Ve=-1}else for(D+Sn>_n&&(D=_n-Sn),Ln=D;Ln>=0;Ln--){for(var ze=!0,wn=0;wn<Sn;wn++)if(xn(Y,Ln+wn)!==xn(k,wn)){ze=!1;break}if(ze)return Ln}return-1}g.prototype.includes=function(k,D,j){return this.indexOf(k,D,j)!==-1},g.prototype.indexOf=function(k,D,j){return $(this,k,D,j,!0)},g.prototype.lastIndexOf=function(k,D,j){return $(this,k,D,j,!1)};function V(Y,k,D,j){D=Number(D)||0;var xe=Y.length-D;j?(j=Number(j),j>xe&&(j=xe)):j=xe;var hn=k.length;j>hn/2&&(j=hn/2);for(var _n=0;_n<j;++_n){var Sn=parseInt(k.substr(_n*2,2),16);if(ae(Sn))return _n;Y[D+_n]=Sn}return _n}function re(Y,k,D,j){return Cn(Ne(k,Y.length-D),Y,D,j)}function F(Y,k,D,j){return Cn(Oe(k),Y,D,j)}function pe(Y,k,D,j){return F(Y,k,D,j)}function le(Y,k,D,j){return Cn(kt(k),Y,D,j)}function de(Y,k,D,j){return Cn(Lt(k,Y.length-D),Y,D,j)}g.prototype.write=function(k,D,j,xe){if(D===void 0)xe="utf8",j=this.length,D=0;else if(j===void 0&&typeof D=="string")xe=D,j=this.length,D=0;else if(isFinite(D))D=D>>>0,isFinite(j)?(j=j>>>0,xe===void 0&&(xe="utf8")):(xe=j,j=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var hn=this.length-D;if((j===void 0||j>hn)&&(j=hn),k.length>0&&(j<0||D<0)||D>this.length)throw new RangeError("Attempt to write outside buffer bounds");xe||(xe="utf8");for(var _n=!1;;)switch(xe){case"hex":return V(this,k,D,j);case"utf8":case"utf-8":return re(this,k,D,j);case"ascii":return F(this,k,D,j);case"latin1":case"binary":return pe(this,k,D,j);case"base64":return le(this,k,D,j);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return de(this,k,D,j);default:if(_n)throw new TypeError("Unknown encoding: "+xe);xe=(""+xe).toLowerCase(),_n=!0}},g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Fe(Y,k,D){return k===0&&D===Y.length?c.fromByteArray(Y):c.fromByteArray(Y.slice(k,D))}function Ie(Y,k,D){D=Math.min(Y.length,D);for(var j=[],xe=k;xe<D;){var hn=Y[xe],_n=null,Sn=hn>239?4:hn>223?3:hn>191?2:1;if(xe+Sn<=D){var xn,Ln,Ve,ze;switch(Sn){case 1:hn<128&&(_n=hn);break;case 2:xn=Y[xe+1],(xn&192)===128&&(ze=(hn&31)<<6|xn&63,ze>127&&(_n=ze));break;case 3:xn=Y[xe+1],Ln=Y[xe+2],(xn&192)===128&&(Ln&192)===128&&(ze=(hn&15)<<12|(xn&63)<<6|Ln&63,ze>2047&&(ze<55296||ze>57343)&&(_n=ze));break;case 4:xn=Y[xe+1],Ln=Y[xe+2],Ve=Y[xe+3],(xn&192)===128&&(Ln&192)===128&&(Ve&192)===128&&(ze=(hn&15)<<18|(xn&63)<<12|(Ln&63)<<6|Ve&63,ze>65535&&ze<1114112&&(_n=ze))}}_n===null?(_n=65533,Sn=1):_n>65535&&(_n-=65536,j.push(_n>>>10&1023|55296),_n=56320|_n&1023),j.push(_n),xe+=Sn}return _e(j)}var At=4096;function _e(Y){var k=Y.length;if(k<=At)return String.fromCharCode.apply(String,Y);for(var D="",j=0;j<k;)D+=String.fromCharCode.apply(String,Y.slice(j,j+=At));return D}function qe(Y,k,D){var j="";D=Math.min(Y.length,D);for(var xe=k;xe<D;++xe)j+=String.fromCharCode(Y[xe]&127);return j}function In(Y,k,D){var j="";D=Math.min(Y.length,D);for(var xe=k;xe<D;++xe)j+=String.fromCharCode(Y[xe]);return j}function vn(Y,k,D){var j=Y.length;(!k||k<0)&&(k=0),(!D||D<0||D>j)&&(D=j);for(var xe="",hn=k;hn<D;++hn)xe+=$e(Y[hn]);return xe}function Pt(Y,k,D){for(var j=Y.slice(k,D),xe="",hn=0;hn<j.length;hn+=2)xe+=String.fromCharCode(j[hn]+j[hn+1]*256);return xe}g.prototype.slice=function(k,D){var j=this.length;k=~~k,D=D===void 0?j:~~D,k<0?(k+=j,k<0&&(k=0)):k>j&&(k=j),D<0?(D+=j,D<0&&(D=0)):D>j&&(D=j),D<k&&(D=k);var xe=this.subarray(k,D);return xe.__proto__=g.prototype,xe};function he(Y,k,D){if(Y%1!==0||Y<0)throw new RangeError("offset is not uint");if(Y+k>D)throw new RangeError("Trying to access beyond buffer length")}g.prototype.readUIntLE=function(k,D,j){k=k>>>0,D=D>>>0,j||he(k,D,this.length);for(var xe=this[k],hn=1,_n=0;++_n<D&&(hn*=256);)xe+=this[k+_n]*hn;return xe},g.prototype.readUIntBE=function(k,D,j){k=k>>>0,D=D>>>0,j||he(k,D,this.length);for(var xe=this[k+--D],hn=1;D>0&&(hn*=256);)xe+=this[k+--D]*hn;return xe},g.prototype.readUInt8=function(k,D){return k=k>>>0,D||he(k,1,this.length),this[k]},g.prototype.readUInt16LE=function(k,D){return k=k>>>0,D||he(k,2,this.length),this[k]|this[k+1]<<8},g.prototype.readUInt16BE=function(k,D){return k=k>>>0,D||he(k,2,this.length),this[k]<<8|this[k+1]},g.prototype.readUInt32LE=function(k,D){return k=k>>>0,D||he(k,4,this.length),(this[k]|this[k+1]<<8|this[k+2]<<16)+this[k+3]*16777216},g.prototype.readUInt32BE=function(k,D){return k=k>>>0,D||he(k,4,this.length),this[k]*16777216+(this[k+1]<<16|this[k+2]<<8|this[k+3])},g.prototype.readIntLE=function(k,D,j){k=k>>>0,D=D>>>0,j||he(k,D,this.length);for(var xe=this[k],hn=1,_n=0;++_n<D&&(hn*=256);)xe+=this[k+_n]*hn;return hn*=128,xe>=hn&&(xe-=Math.pow(2,8*D)),xe},g.prototype.readIntBE=function(k,D,j){k=k>>>0,D=D>>>0,j||he(k,D,this.length);for(var xe=D,hn=1,_n=this[k+--xe];xe>0&&(hn*=256);)_n+=this[k+--xe]*hn;return hn*=128,_n>=hn&&(_n-=Math.pow(2,8*D)),_n},g.prototype.readInt8=function(k,D){return k=k>>>0,D||he(k,1,this.length),this[k]&128?(255-this[k]+1)*-1:this[k]},g.prototype.readInt16LE=function(k,D){k=k>>>0,D||he(k,2,this.length);var j=this[k]|this[k+1]<<8;return j&32768?j|4294901760:j},g.prototype.readInt16BE=function(k,D){k=k>>>0,D||he(k,2,this.length);var j=this[k+1]|this[k]<<8;return j&32768?j|4294901760:j},g.prototype.readInt32LE=function(k,D){return k=k>>>0,D||he(k,4,this.length),this[k]|this[k+1]<<8|this[k+2]<<16|this[k+3]<<24},g.prototype.readInt32BE=function(k,D){return k=k>>>0,D||he(k,4,this.length),this[k]<<24|this[k+1]<<16|this[k+2]<<8|this[k+3]},g.prototype.readFloatLE=function(k,D){return k=k>>>0,D||he(k,4,this.length),d.read(this,k,!0,23,4)},g.prototype.readFloatBE=function(k,D){return k=k>>>0,D||he(k,4,this.length),d.read(this,k,!1,23,4)},g.prototype.readDoubleLE=function(k,D){return k=k>>>0,D||he(k,8,this.length),d.read(this,k,!0,52,8)},g.prototype.readDoubleBE=function(k,D){return k=k>>>0,D||he(k,8,this.length),d.read(this,k,!1,52,8)};function Ue(Y,k,D,j,xe,hn){if(!g.isBuffer(Y))throw new TypeError('"buffer" argument must be a Buffer instance');if(k>xe||k<hn)throw new RangeError('"value" argument is out of bounds');if(D+j>Y.length)throw new RangeError("Index out of range")}g.prototype.writeUIntLE=function(k,D,j,xe){if(k=+k,D=D>>>0,j=j>>>0,!xe){var hn=Math.pow(2,8*j)-1;Ue(this,k,D,j,hn,0)}var _n=1,Sn=0;for(this[D]=k&255;++Sn<j&&(_n*=256);)this[D+Sn]=k/_n&255;return D+j},g.prototype.writeUIntBE=function(k,D,j,xe){if(k=+k,D=D>>>0,j=j>>>0,!xe){var hn=Math.pow(2,8*j)-1;Ue(this,k,D,j,hn,0)}var _n=j-1,Sn=1;for(this[D+_n]=k&255;--_n>=0&&(Sn*=256);)this[D+_n]=k/Sn&255;return D+j},g.prototype.writeUInt8=function(k,D,j){return k=+k,D=D>>>0,j||Ue(this,k,D,1,255,0),this[D]=k&255,D+1},g.prototype.writeUInt16LE=function(k,D,j){return k=+k,D=D>>>0,j||Ue(this,k,D,2,65535,0),this[D]=k&255,this[D+1]=k>>>8,D+2},g.prototype.writeUInt16BE=function(k,D,j){return k=+k,D=D>>>0,j||Ue(this,k,D,2,65535,0),this[D]=k>>>8,this[D+1]=k&255,D+2},g.prototype.writeUInt32LE=function(k,D,j){return k=+k,D=D>>>0,j||Ue(this,k,D,4,4294967295,0),this[D+3]=k>>>24,this[D+2]=k>>>16,this[D+1]=k>>>8,this[D]=k&255,D+4},g.prototype.writeUInt32BE=function(k,D,j){return k=+k,D=D>>>0,j||Ue(this,k,D,4,4294967295,0),this[D]=k>>>24,this[D+1]=k>>>16,this[D+2]=k>>>8,this[D+3]=k&255,D+4},g.prototype.writeIntLE=function(k,D,j,xe){if(k=+k,D=D>>>0,!xe){var hn=Math.pow(2,8*j-1);Ue(this,k,D,j,hn-1,-hn)}var _n=0,Sn=1,xn=0;for(this[D]=k&255;++_n<j&&(Sn*=256);)k<0&&xn===0&&this[D+_n-1]!==0&&(xn=1),this[D+_n]=(k/Sn>>0)-xn&255;return D+j},g.prototype.writeIntBE=function(k,D,j,xe){if(k=+k,D=D>>>0,!xe){var hn=Math.pow(2,8*j-1);Ue(this,k,D,j,hn-1,-hn)}var _n=j-1,Sn=1,xn=0;for(this[D+_n]=k&255;--_n>=0&&(Sn*=256);)k<0&&xn===0&&this[D+_n+1]!==0&&(xn=1),this[D+_n]=(k/Sn>>0)-xn&255;return D+j},g.prototype.writeInt8=function(k,D,j){return k=+k,D=D>>>0,j||Ue(this,k,D,1,127,-128),k<0&&(k=255+k+1),this[D]=k&255,D+1},g.prototype.writeInt16LE=function(k,D,j){return k=+k,D=D>>>0,j||Ue(this,k,D,2,32767,-32768),this[D]=k&255,this[D+1]=k>>>8,D+2},g.prototype.writeInt16BE=function(k,D,j){return k=+k,D=D>>>0,j||Ue(this,k,D,2,32767,-32768),this[D]=k>>>8,this[D+1]=k&255,D+2},g.prototype.writeInt32LE=function(k,D,j){return k=+k,D=D>>>0,j||Ue(this,k,D,4,2147483647,-2147483648),this[D]=k&255,this[D+1]=k>>>8,this[D+2]=k>>>16,this[D+3]=k>>>24,D+4},g.prototype.writeInt32BE=function(k,D,j){return k=+k,D=D>>>0,j||Ue(this,k,D,4,2147483647,-2147483648),k<0&&(k=4294967295+k+1),this[D]=k>>>24,this[D+1]=k>>>16,this[D+2]=k>>>8,this[D+3]=k&255,D+4};function Dt(Y,k,D,j,xe,hn){if(D+j>Y.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("Index out of range")}function jt(Y,k,D,j,xe){return k=+k,D=D>>>0,xe||Dt(Y,k,D,4),d.write(Y,k,D,j,23,4),D+4}g.prototype.writeFloatLE=function(k,D,j){return jt(this,k,D,!0,j)},g.prototype.writeFloatBE=function(k,D,j){return jt(this,k,D,!1,j)};function Et(Y,k,D,j,xe){return k=+k,D=D>>>0,xe||Dt(Y,k,D,8),d.write(Y,k,D,j,52,8),D+8}g.prototype.writeDoubleLE=function(k,D,j){return Et(this,k,D,!0,j)},g.prototype.writeDoubleBE=function(k,D,j){return Et(this,k,D,!1,j)},g.prototype.copy=function(k,D,j,xe){if(!g.isBuffer(k))throw new TypeError("argument should be a Buffer");if(j||(j=0),!xe&&xe!==0&&(xe=this.length),D>=k.length&&(D=k.length),D||(D=0),xe>0&&xe<j&&(xe=j),xe===j||k.length===0||this.length===0)return 0;if(D<0)throw new RangeError("targetStart out of bounds");if(j<0||j>=this.length)throw new RangeError("Index out of range");if(xe<0)throw new RangeError("sourceEnd out of bounds");xe>this.length&&(xe=this.length),k.length-D<xe-j&&(xe=k.length-D+j);var hn=xe-j;if(this===k&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(D,j,xe);else if(this===k&&j<D&&D<xe)for(var _n=hn-1;_n>=0;--_n)k[_n+D]=this[_n+j];else Uint8Array.prototype.set.call(k,this.subarray(j,xe),D);return hn},g.prototype.fill=function(k,D,j,xe){if(typeof k=="string"){if(typeof D=="string"?(xe=D,D=0,j=this.length):typeof j=="string"&&(xe=j,j=this.length),xe!==void 0&&typeof xe!="string")throw new TypeError("encoding must be a string");if(typeof xe=="string"&&!g.isEncoding(xe))throw new TypeError("Unknown encoding: "+xe);if(k.length===1){var hn=k.charCodeAt(0);(xe==="utf8"&&hn<128||xe==="latin1")&&(k=hn)}}else typeof k=="number"&&(k=k&255);if(D<0||this.length<D||this.length<j)throw new RangeError("Out of range index");if(j<=D)return this;D=D>>>0,j=j===void 0?this.length:j>>>0,k||(k=0);var _n;if(typeof k=="number")for(_n=D;_n<j;++_n)this[_n]=k;else{var Sn=g.isBuffer(k)?k:g.from(k,xe),xn=Sn.length;if(xn===0)throw new TypeError('The value "'+k+'" is invalid for argument "value"');for(_n=0;_n<j-D;++_n)this[_n+D]=Sn[_n%xn]}return this};var Ce=/[^+/0-9A-Za-z-_]/g;function ue(Y){if(Y=Y.split("=")[0],Y=Y.trim().replace(Ce,""),Y.length<2)return"";for(;Y.length%4!==0;)Y=Y+"=";return Y}function $e(Y){return Y<16?"0"+Y.toString(16):Y.toString(16)}function Ne(Y,k){k=k||1/0;for(var D,j=Y.length,xe=null,hn=[],_n=0;_n<j;++_n){if(D=Y.charCodeAt(_n),D>55295&&D<57344){if(!xe){if(D>56319){(k-=3)>-1&&hn.push(239,191,189);continue}else if(_n+1===j){(k-=3)>-1&&hn.push(239,191,189);continue}xe=D;continue}if(D<56320){(k-=3)>-1&&hn.push(239,191,189),xe=D;continue}D=(xe-55296<<10|D-56320)+65536}else xe&&(k-=3)>-1&&hn.push(239,191,189);if(xe=null,D<128){if((k-=1)<0)break;hn.push(D)}else if(D<2048){if((k-=2)<0)break;hn.push(D>>6|192,D&63|128)}else if(D<65536){if((k-=3)<0)break;hn.push(D>>12|224,D>>6&63|128,D&63|128)}else if(D<1114112){if((k-=4)<0)break;hn.push(D>>18|240,D>>12&63|128,D>>6&63|128,D&63|128)}else throw new Error("Invalid code point")}return hn}function Oe(Y){for(var k=[],D=0;D<Y.length;++D)k.push(Y.charCodeAt(D)&255);return k}function Lt(Y,k){for(var D,j,xe,hn=[],_n=0;_n<Y.length&&!((k-=2)<0);++_n)D=Y.charCodeAt(_n),j=D>>8,xe=D%256,hn.push(xe),hn.push(j);return hn}function kt(Y){return c.toByteArray(ue(Y))}function Cn(Y,k,D,j){for(var xe=0;xe<j&&!(xe+D>=k.length||xe>=Y.length);++xe)k[xe+D]=Y[xe];return xe}function oe(Y,k){return Y instanceof k||Y!=null&&Y.constructor!=null&&Y.constructor.name!=null&&Y.constructor.name===k.name}function ae(Y){return Y!==Y}}).call(this)}).call(this,n("buffer").Buffer)},{"base64-js":25,buffer:29,ieee754:50}],30:[function(n,o,a){(function(u){(function(){a.formatArgs=d,a.save=f,a.load=h,a.useColors=c,a.storage=y(),a.destroy=(()=>{let p=!1;return()=>{p||(p=!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 d(p){if(p[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+p[0]+(this.useColors?"%c ":" ")+"+"+o.exports.humanize(this.diff),!this.useColors)return;const v="color: "+this.color;p.splice(1,0,v,"color: inherit");let _=0,b=0;p[0].replace(/%[a-zA-Z%]/g,A=>{A!=="%%"&&(_++,A==="%c"&&(b=_))}),p.splice(b,0,v)}a.log=console.debug||console.log||(()=>{});function f(p){try{p?a.storage.setItem("debug",p):a.storage.removeItem("debug")}catch{}}function h(){let p;try{p=a.storage.getItem("debug")}catch{}return!p&&typeof u<"u"&&"env"in u&&(p=u.env.DEBUG),p}function y(){try{return localStorage}catch{}}o.exports=n("./common")(a);const{formatters:g}=o.exports;g.j=function(p){try{return JSON.stringify(p)}catch(v){return"[UnexpectedJSONParseError]: "+v.message}}}).call(this)}).call(this,n("_process"))},{"./common":31,_process:102}],31:[function(n,o,a){function u(c){f.debug=f,f.default=f,f.coerce=_,f.disable=g,f.enable=y,f.enabled=p,f.humanize=n("ms"),f.destroy=b,Object.keys(c).forEach(A=>{f[A]=c[A]}),f.names=[],f.skips=[],f.formatters={};function d(A){let w=0;for(let T=0;T<A.length;T++)w=(w<<5)-w+A.charCodeAt(T),w|=0;return f.colors[Math.abs(w)%f.colors.length]}f.selectColor=d;function f(A){let w,T=null,S,x;function L(...M){if(!L.enabled)return;const O=L,ie=Number(new Date),$=ie-(w||ie);O.diff=$,O.prev=w,O.curr=ie,w=ie,M[0]=f.coerce(M[0]),typeof M[0]!="string"&&M.unshift("%O");let z=0;M[0]=M[0].replace(/%([a-zA-Z%])/g,(re,F)=>{if(re==="%%")return"%";z++;const pe=f.formatters[F];if(typeof pe=="function"){const le=M[z];re=pe.call(O,le),M.splice(z,1),z--}return re}),f.formatArgs.call(O,M),(O.log||f.log).apply(O,M)}return L.namespace=A,L.useColors=f.useColors(),L.color=f.selectColor(A),L.extend=h,L.destroy=f.destroy,Object.defineProperty(L,"enabled",{enumerable:!0,configurable:!1,get:()=>T!==null?T:(S!==f.namespaces&&(S=f.namespaces,x=f.enabled(A)),x),set:M=>{T=M}}),typeof f.init=="function"&&f.init(L),L}function h(A,w){const T=f(this.namespace+(typeof w>"u"?":":w)+A);return T.log=this.log,T}function y(A){f.save(A),f.namespaces=A,f.names=[],f.skips=[];let w;const T=(typeof A=="string"?A:"").split(/[\s,]+/),S=T.length;for(w=0;w<S;w++)T[w]&&(A=T[w].replace(/\*/g,".*?"),A[0]==="-"?f.skips.push(new RegExp("^"+A.slice(1)+"$")):f.names.push(new RegExp("^"+A+"$")))}function g(){const A=[...f.names.map(v),...f.skips.map(v).map(w=>"-"+w)].join(",");return f.enable(""),A}function p(A){if(A[A.length-1]==="*")return!0;let w,T;for(w=0,T=f.skips.length;w<T;w++)if(f.skips[w].test(A))return!1;for(w=0,T=f.names.length;w<T;w++)if(f.names[w].test(A))return!0;return!1}function v(A){return A.toString().substring(2,A.toString().length-2).replace(/\.\*\?$/,"*")}function _(A){return A instanceof Error?A.stack||A.message:A}function b(){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 f.enable(f.load()),f}o.exports=u},{ms:97}],32:[function(n,o,a){(function(u,c){(function(){var d=n("readable-stream"),f=n("end-of-stream"),h=n("inherits"),y=n("stream-shift"),g=c.from&&c.from!==Uint8Array.from?c.from([0]):new c([0]),p=function(S,x){S._corked?S.once("uncork",x):x()},v=function(S,x){S._autoDestroy&&S.destroy(x)},_=function(S,x){return function(L){L?v(S,L.message==="premature close"?null:L):x&&!S._ended&&S.end()}},b=function(S,x){if(!S||S._writableState&&S._writableState.finished)return x();if(S._writableState)return S.end(x);S.end(),x()},A=function(){},w=function(S){return new d.Readable({objectMode:!0,highWaterMark:16}).wrap(S)},T=function(S,x,L){if(!(this instanceof T))return new T(S,x,L);d.Duplex.call(this,L),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!L||L.autoDestroy!==!1,this._forwardDestroy=!L||L.destroy!==!1,this._forwardEnd=!L||L.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,S&&this.setWritable(S),x&&this.setReadable(x)};h(T,d.Duplex),T.obj=function(S,x,L){return L||(L={}),L.objectMode=!0,L.highWaterMark=16,new T(S,x,L)},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(S){if(this._unwrite&&this._unwrite(),this.destroyed){S&&S.destroy&&S.destroy();return}if(S===null||S===!1){this.end();return}var x=this,L=f(S,{writable:!0,readable:!1},_(this,this._forwardEnd)),M=function(){var ie=x._ondrain;x._ondrain=null,ie&&ie()},O=function(){x._writable.removeListener("drain",M),L()};this._unwrite&&u.nextTick(M),this._writable=S,this._writable.on("drain",M),this._unwrite=O,this.uncork()},T.prototype.setReadable=function(S){if(this._unread&&this._unread(),this.destroyed){S&&S.destroy&&S.destroy();return}if(S===null||S===!1){this.push(null),this.resume();return}var x=this,L=f(S,{writable:!1,readable:!0},_(this)),M=function(){x._forward()},O=function(){x.push(null)},ie=function(){x._readable2.removeListener("readable",M),x._readable2.removeListener("end",O),L()};this._drained=!0,this._readable=S,this._readable2=S._readableState?S:w(S),this._readable2.on("readable",M),this._readable2.on("end",O),this._unread=ie,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 S;this._drained&&(S=y(this._readable2))!==null;)this.destroyed||(this._drained=this.push(S));this._forwarding=!1}},T.prototype.destroy=function(S,x){if(x||(x=A),this.destroyed)return x(null);this.destroyed=!0;var L=this;u.nextTick(function(){L._destroy(S),x(null)})},T.prototype._destroy=function(S){if(S){var x=this._ondrain;this._ondrain=null,x?x(S):this.emit("error",S)}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(S,x,L){if(!this.destroyed){if(this._corked)return p(this,this._write.bind(this,S,x,L));if(S===g)return this._finish(L);if(!this._writable)return L();this._writable.write(S)===!1?this._ondrain=L:this.destroyed||L()}},T.prototype._finish=function(S){var x=this;this.emit("preend"),p(this,function(){b(x._forwardEnd&&x._writable,function(){x._writableState.prefinished===!1&&(x._writableState.prefinished=!0),x.emit("prefinish"),p(x,S)})})},T.prototype.end=function(S,x,L){return typeof S=="function"?this.end(null,null,S):typeof x=="function"?this.end(S,null,x):(this._ended=!0,S&&this.write(S),!this._writableState.ending&&!this._writableState.destroyed&&this.write(g),d.Writable.prototype.end.call(this,L))},o.exports=T}).call(this)}).call(this,n("_process"),n("buffer").Buffer)},{_process:102,buffer:29,"end-of-stream":48,inherits:51,"readable-stream":47,"stream-shift":135}],33:[function(n,o,a){function u(p,v){p.prototype=Object.create(v.prototype),p.prototype.constructor=p,p.__proto__=v}var c={};function d(p,v,_){_||(_=Error);function b(w,T,S){return typeof v=="string"?v:v(w,T,S)}var A=function(w){u(T,w);function T(S,x,L){return w.call(this,b(S,x,L))||this}return T}(_);A.prototype.name=_.name,A.prototype.code=p,c[p]=A}function f(p,v){if(Array.isArray(p)){var _=p.length;return p=p.map(function(b){return String(b)}),_>2?"one of ".concat(v," ").concat(p.slice(0,_-1).join(", "),", or ")+p[_-1]:_===2?"one of ".concat(v," ").concat(p[0]," or ").concat(p[1]):"of ".concat(v," ").concat(p[0])}else return"of ".concat(v," ").concat(String(p))}function h(p,v,_){return p.substr(!_||_<0?0:+_,v.length)===v}function y(p,v,_){return(_===void 0||_>p.length)&&(_=p.length),p.substring(_-v.length,_)===v}function g(p,v,_){return typeof _!="number"&&(_=0),_+v.length>p.length?!1:p.indexOf(v,_)!==-1}d("ERR_INVALID_OPT_VALUE",function(p,v){return'The value "'+v+'" is invalid for option "'+p+'"'},TypeError),d("ERR_INVALID_ARG_TYPE",function(p,v,_){var b;typeof v=="string"&&h(v,"not ")?(b="must not be",v=v.replace(/^not /,"")):b="must be";var A;if(y(p," argument"))A="The ".concat(p," ").concat(b," ").concat(f(v,"type"));else{var w=g(p,".")?"property":"argument";A='The "'.concat(p,'" ').concat(w," ").concat(b," ").concat(f(v,"type"))}return A+=". Received type ".concat(typeof _),A},TypeError),d("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),d("ERR_METHOD_NOT_IMPLEMENTED",function(p){return"The "+p+" method is not implemented"}),d("ERR_STREAM_PREMATURE_CLOSE","Premature close"),d("ERR_STREAM_DESTROYED",function(p){return"Cannot call "+p+" after a stream was destroyed"}),d("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),d("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),d("ERR_STREAM_WRITE_AFTER_END","write after end"),d("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),d("ERR_UNKNOWN_ENCODING",function(p){return"Unknown encoding: "+p},TypeError),d("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),o.exports.codes=c},{}],34:[function(n,o,a){(function(u){(function(){var c=Object.keys||function(b){var A=[];for(var w in b)A.push(w);return A};o.exports=p;var d=n("./_stream_readable"),f=n("./_stream_writable");n("inherits")(p,d);for(var h=c(f.prototype),y=0;y<h.length;y++){var g=h[y];p.prototype[g]||(p.prototype[g]=f.prototype[g])}function p(b){if(!(this instanceof p))return new p(b);d.call(this,b),f.call(this,b),this.allowHalfOpen=!0,b&&(b.readable===!1&&(this.readable=!1),b.writable===!1&&(this.writable=!1),b.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",v)))}Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(p.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(p.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function v(){this._writableState.ended||u.nextTick(_,this)}function _(b){b.end()}Object.defineProperty(p.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(A){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=A,this._writableState.destroyed=A)}})}).call(this)}).call(this,n("_process"))},{"./_stream_readable":36,"./_stream_writable":38,_process:102,inherits:51}],35:[function(n,o,a){o.exports=c;var u=n("./_stream_transform");n("inherits")(c,u);function c(d){if(!(this instanceof c))return new c(d);u.call(this,d)}c.prototype._transform=function(d,f,h){h(null,d)}},{"./_stream_transform":37,inherits:51}],36:[function(n,o,a){(function(u,c){(function(){o.exports=de;var d;de.ReadableState=le,n("events").EventEmitter;var f=function(ae,Y){return ae.listeners(Y).length},h=n("./internal/streams/stream"),y=n("buffer").Buffer,g=c.Uint8Array||function(){};function p(oe){return y.from(oe)}function v(oe){return y.isBuffer(oe)||oe instanceof g}var _=n("util"),b;_&&_.debuglog?b=_.debuglog("stream"):b=function(){};var A=n("./internal/streams/buffer_list"),w=n("./internal/streams/destroy"),T=n("./internal/streams/state"),S=T.getHighWaterMark,x=n("../errors").codes,L=x.ERR_INVALID_ARG_TYPE,M=x.ERR_STREAM_PUSH_AFTER_EOF,O=x.ERR_METHOD_NOT_IMPLEMENTED,ie=x.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,$,z,V;n("inherits")(de,h);var re=w.errorOrDestroy,F=["error","close","destroy","pause","resume"];function pe(oe,ae,Y){if(typeof oe.prependListener=="function")return oe.prependListener(ae,Y);!oe._events||!oe._events[ae]?oe.on(ae,Y):Array.isArray(oe._events[ae])?oe._events[ae].unshift(Y):oe._events[ae]=[Y,oe._events[ae]]}function le(oe,ae,Y){d=d||n("./_stream_duplex"),oe=oe||{},typeof Y!="boolean"&&(Y=ae instanceof d),this.objectMode=!!oe.objectMode,Y&&(this.objectMode=this.objectMode||!!oe.readableObjectMode),this.highWaterMark=S(this,oe,"readableHighWaterMark",Y),this.buffer=new A,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=oe.emitClose!==!1,this.autoDestroy=!!oe.autoDestroy,this.destroyed=!1,this.defaultEncoding=oe.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,oe.encoding&&($||($=n("string_decoder/").StringDecoder),this.decoder=new $(oe.encoding),this.encoding=oe.encoding)}function de(oe){if(d=d||n("./_stream_duplex"),!(this instanceof de))return new de(oe);var ae=this instanceof d;this._readableState=new le(oe,this,ae),this.readable=!0,oe&&(typeof oe.read=="function"&&(this._read=oe.read),typeof oe.destroy=="function"&&(this._destroy=oe.destroy)),h.call(this)}Object.defineProperty(de.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(ae){this._readableState&&(this._readableState.destroyed=ae)}}),de.prototype.destroy=w.destroy,de.prototype._undestroy=w.undestroy,de.prototype._destroy=function(oe,ae){ae(oe)},de.prototype.push=function(oe,ae){var Y=this._readableState,k;return Y.objectMode?k=!0:typeof oe=="string"&&(ae=ae||Y.defaultEncoding,ae!==Y.encoding&&(oe=y.from(oe,ae),ae=""),k=!0),Fe(this,oe,ae,!1,k)},de.prototype.unshift=function(oe){return Fe(this,oe,null,!0,!1)};function Fe(oe,ae,Y,k,D){b("readableAddChunk",ae);var j=oe._readableState;if(ae===null)j.reading=!1,vn(oe,j);else{var xe;if(D||(xe=At(j,ae)),xe)re(oe,xe);else if(j.objectMode||ae&&ae.length>0)if(typeof ae!="string"&&!j.objectMode&&Object.getPrototypeOf(ae)!==y.prototype&&(ae=p(ae)),k)j.endEmitted?re(oe,new ie):Ie(oe,j,ae,!0);else if(j.ended)re(oe,new M);else{if(j.destroyed)return!1;j.reading=!1,j.decoder&&!Y?(ae=j.decoder.write(ae),j.objectMode||ae.length!==0?Ie(oe,j,ae,!1):Ue(oe,j)):Ie(oe,j,ae,!1)}else k||(j.reading=!1,Ue(oe,j))}return!j.ended&&(j.length<j.highWaterMark||j.length===0)}function Ie(oe,ae,Y,k){ae.flowing&&ae.length===0&&!ae.sync?(ae.awaitDrain=0,oe.emit("data",Y)):(ae.length+=ae.objectMode?1:Y.length,k?ae.buffer.unshift(Y):ae.buffer.push(Y),ae.needReadable&&Pt(oe)),Ue(oe,ae)}function At(oe,ae){var Y;return!v(ae)&&typeof ae!="string"&&ae!==void 0&&!oe.objectMode&&(Y=new L("chunk",["string","Buffer","Uint8Array"],ae)),Y}de.prototype.isPaused=function(){return this._readableState.flowing===!1},de.prototype.setEncoding=function(oe){$||($=n("string_decoder/").StringDecoder);var ae=new $(oe);this._readableState.decoder=ae,this._readableState.encoding=this._readableState.decoder.encoding;for(var Y=this._readableState.buffer.head,k="";Y!==null;)k+=ae.write(Y.data),Y=Y.next;return this._readableState.buffer.clear(),k!==""&&this._readableState.buffer.push(k),this._readableState.length=k.length,this};var _e=1073741824;function qe(oe){return oe>=_e?oe=_e:(oe--,oe|=oe>>>1,oe|=oe>>>2,oe|=oe>>>4,oe|=oe>>>8,oe|=oe>>>16,oe++),oe}function In(oe,ae){return oe<=0||ae.length===0&&ae.ended?0:ae.objectMode?1:oe!==oe?ae.flowing&&ae.length?ae.buffer.head.data.length:ae.length:(oe>ae.highWaterMark&&(ae.highWaterMark=qe(oe)),oe<=ae.length?oe:ae.ended?ae.length:(ae.needReadable=!0,0))}de.prototype.read=function(oe){b("read",oe),oe=parseInt(oe,10);var ae=this._readableState,Y=oe;if(oe!==0&&(ae.emittedReadable=!1),oe===0&&ae.needReadable&&((ae.highWaterMark!==0?ae.length>=ae.highWaterMark:ae.length>0)||ae.ended))return b("read: emitReadable",ae.length,ae.ended),ae.length===0&&ae.ended?Lt(this):Pt(this),null;if(oe=In(oe,ae),oe===0&&ae.ended)return ae.length===0&&Lt(this),null;var k=ae.needReadable;b("need readable",k),(ae.length===0||ae.length-oe<ae.highWaterMark)&&(k=!0,b("length less than watermark",k)),ae.ended||ae.reading?(k=!1,b("reading or ended",k)):k&&(b("do read"),ae.reading=!0,ae.sync=!0,ae.length===0&&(ae.needReadable=!0),this._read(ae.highWaterMark),ae.sync=!1,ae.reading||(oe=In(Y,ae)));var D;return oe>0?D=Oe(oe,ae):D=null,D===null?(ae.needReadable=ae.length<=ae.highWaterMark,oe=0):(ae.length-=oe,ae.awaitDrain=0),ae.length===0&&(ae.ended||(ae.needReadable=!0),Y!==oe&&ae.ended&&Lt(this)),D!==null&&this.emit("data",D),D};function vn(oe,ae){if(b("onEofChunk"),!ae.ended){if(ae.decoder){var Y=ae.decoder.end();Y&&Y.length&&(ae.buffer.push(Y),ae.length+=ae.objectMode?1:Y.length)}ae.ended=!0,ae.sync?Pt(oe):(ae.needReadable=!1,ae.emittedReadable||(ae.emittedReadable=!0,he(oe)))}}function Pt(oe){var ae=oe._readableState;b("emitReadable",ae.needReadable,ae.emittedReadable),ae.needReadable=!1,ae.emittedReadable||(b("emitReadable",ae.flowing),ae.emittedReadable=!0,u.nextTick(he,oe))}function he(oe){var ae=oe._readableState;b("emitReadable_",ae.destroyed,ae.length,ae.ended),!ae.destroyed&&(ae.length||ae.ended)&&(oe.emit("readable"),ae.emittedReadable=!1),ae.needReadable=!ae.flowing&&!ae.ended&&ae.length<=ae.highWaterMark,Ne(oe)}function Ue(oe,ae){ae.readingMore||(ae.readingMore=!0,u.nextTick(Dt,oe,ae))}function Dt(oe,ae){for(;!ae.reading&&!ae.ended&&(ae.length<ae.highWaterMark||ae.flowing&&ae.length===0);){var Y=ae.length;if(b("maybeReadMore read 0"),oe.read(0),Y===ae.length)break}ae.readingMore=!1}de.prototype._read=function(oe){re(this,new O("_read()"))},de.prototype.pipe=function(oe,ae){var Y=this,k=this._readableState;switch(k.pipesCount){case 0:k.pipes=oe;break;case 1:k.pipes=[k.pipes,oe];break;default:k.pipes.push(oe);break}k.pipesCount+=1,b("pipe count=%d opts=%j",k.pipesCount,ae);var D=(!ae||ae.end!==!1)&&oe!==u.stdout&&oe!==u.stderr,j=D?hn:An;k.endEmitted?u.nextTick(j):Y.once("end",j),oe.on("unpipe",xe);function xe(Tn,Pn){b("onunpipe"),Tn===Y&&Pn&&Pn.hasUnpiped===!1&&(Pn.hasUnpiped=!0,xn())}function hn(){b("onend"),oe.end()}var _n=jt(Y);oe.on("drain",_n);var Sn=!1;function xn(){b("cleanup"),oe.removeListener("close",ze),oe.removeListener("finish",wn),oe.removeListener("drain",_n),oe.removeListener("error",Ve),oe.removeListener("unpipe",xe),Y.removeListener("end",hn),Y.removeListener("end",An),Y.removeListener("data",Ln),Sn=!0,k.awaitDrain&&(!oe._writableState||oe._writableState.needDrain)&&_n()}Y.on("data",Ln);function Ln(Tn){b("ondata");var Pn=oe.write(Tn);b("dest.write",Pn),Pn===!1&&((k.pipesCount===1&&k.pipes===oe||k.pipesCount>1&&Cn(k.pipes,oe)!==-1)&&!Sn&&(b("false write response, pause",k.awaitDrain),k.awaitDrain++),Y.pause())}function Ve(Tn){b("onerror",Tn),An(),oe.removeListener("error",Ve),f(oe,"error")===0&&re(oe,Tn)}pe(oe,"error",Ve);function ze(){oe.removeListener("finish",wn),An()}oe.once("close",ze);function wn(){b("onfinish"),oe.removeListener("close",ze),An()}oe.once("finish",wn);function An(){b("unpipe"),Y.unpipe(oe)}return oe.emit("pipe",Y),k.flowing||(b("pipe resume"),Y.resume()),oe};function jt(oe){return function(){var Y=oe._readableState;b("pipeOnDrain",Y.awaitDrain),Y.awaitDrain&&Y.awaitDrain--,Y.awaitDrain===0&&f(oe,"data")&&(Y.flowing=!0,Ne(oe))}}de.prototype.unpipe=function(oe){var ae=this._readableState,Y={hasUnpiped:!1};if(ae.pipesCount===0)return this;if(ae.pipesCount===1)return oe&&oe!==ae.pipes?this:(oe||(oe=ae.pipes),ae.pipes=null,ae.pipesCount=0,ae.flowing=!1,oe&&oe.emit("unpipe",this,Y),this);if(!oe){var k=ae.pipes,D=ae.pipesCount;ae.pipes=null,ae.pipesCount=0,ae.flowing=!1;for(var j=0;j<D;j++)k[j].emit("unpipe",this,{hasUnpiped:!1});return this}var xe=Cn(ae.pipes,oe);return xe===-1?this:(ae.pipes.splice(xe,1),ae.pipesCount-=1,ae.pipesCount===1&&(ae.pipes=ae.pipes[0]),oe.emit("unpipe",this,Y),this)},de.prototype.on=function(oe,ae){var Y=h.prototype.on.call(this,oe,ae),k=this._readableState;return oe==="data"?(k.readableListening=this.listenerCount("readable")>0,k.flowing!==!1&&this.resume()):oe==="readable"&&!k.endEmitted&&!k.readableListening&&(k.readableListening=k.needReadable=!0,k.flowing=!1,k.emittedReadable=!1,b("on readable",k.length,k.reading),k.length?Pt(this):k.reading||u.nextTick(Ce,this)),Y},de.prototype.addListener=de.prototype.on,de.prototype.removeListener=function(oe,ae){var Y=h.prototype.removeListener.call(this,oe,ae);return oe==="readable"&&u.nextTick(Et,this),Y},de.prototype.removeAllListeners=function(oe){var ae=h.prototype.removeAllListeners.apply(this,arguments);return(oe==="readable"||oe===void 0)&&u.nextTick(Et,this),ae};function Et(oe){var ae=oe._readableState;ae.readableListening=oe.listenerCount("readable")>0,ae.resumeScheduled&&!ae.paused?ae.flowing=!0:oe.listenerCount("data")>0&&oe.resume()}function Ce(oe){b("readable nexttick read 0"),oe.read(0)}de.prototype.resume=function(){var oe=this._readableState;return oe.flowing||(b("resume"),oe.flowing=!oe.readableListening,ue(this,oe)),oe.paused=!1,this};function ue(oe,ae){ae.resumeScheduled||(ae.resumeScheduled=!0,u.nextTick($e,oe,ae))}function $e(oe,ae){b("resume",ae.reading),ae.reading||oe.read(0),ae.resumeScheduled=!1,oe.emit("resume"),Ne(oe),ae.flowing&&!ae.reading&&oe.read(0)}de.prototype.pause=function(){return b("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(b("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Ne(oe){var ae=oe._readableState;for(b("flow",ae.flowing);ae.flowing&&oe.read()!==null;);}de.prototype.wrap=function(oe){var ae=this,Y=this._readableState,k=!1;oe.on("end",function(){if(b("wrapped end"),Y.decoder&&!Y.ended){var xe=Y.decoder.end();xe&&xe.length&&ae.push(xe)}ae.push(null)}),oe.on("data",function(xe){if(b("wrapped data"),Y.decoder&&(xe=Y.decoder.write(xe)),!(Y.objectMode&&xe==null)&&!(!Y.objectMode&&(!xe||!xe.length))){var hn=ae.push(xe);hn||(k=!0,oe.pause())}});for(var D in oe)this[D]===void 0&&typeof oe[D]=="function"&&(this[D]=function(hn){return function(){return oe[hn].apply(oe,arguments)}}(D));for(var j=0;j<F.length;j++)oe.on(F[j],this.emit.bind(this,F[j]));return this._read=function(xe){b("wrapped _read",xe),k&&(k=!1,oe.resume())},this},typeof Symbol=="function"&&(de.prototype[Symbol.asyncIterator]=function(){return z===void 0&&(z=n("./internal/streams/async_iterator")),z(this)}),Object.defineProperty(de.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(de.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(de.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(ae){this._readableState&&(this._readableState.flowing=ae)}}),de._fromList=Oe,Object.defineProperty(de.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function Oe(oe,ae){if(ae.length===0)return null;var Y;return ae.objectMode?Y=ae.buffer.shift():!oe||oe>=ae.length?(ae.decoder?Y=ae.buffer.join(""):ae.buffer.length===1?Y=ae.buffer.first():Y=ae.buffer.concat(ae.length),ae.buffer.clear()):Y=ae.buffer.consume(oe,ae.decoder),Y}function Lt(oe){var ae=oe._readableState;b("endReadable",ae.endEmitted),ae.endEmitted||(ae.ended=!0,u.nextTick(kt,ae,oe))}function kt(oe,ae){if(b("endReadableNT",oe.endEmitted,oe.length),!oe.endEmitted&&oe.length===0&&(oe.endEmitted=!0,ae.readable=!1,ae.emit("end"),oe.autoDestroy)){var Y=ae._writableState;(!Y||Y.autoDestroy&&Y.finished)&&ae.destroy()}}typeof Symbol=="function"&&(de.from=function(oe,ae){return V===void 0&&(V=n("./internal/streams/from")),V(de,oe,ae)});function Cn(oe,ae){for(var Y=0,k=oe.length;Y<k;Y++)if(oe[Y]===ae)return Y;return-1}}).call(this)}).call(this,n("_process"),typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":33,"./_stream_duplex":34,"./internal/streams/async_iterator":39,"./internal/streams/buffer_list":40,"./internal/streams/destroy":41,"./internal/streams/from":43,"./internal/streams/state":45,"./internal/streams/stream":46,_process:102,buffer:29,events:49,inherits:51,"string_decoder/":136,util:26}],37:[function(n,o,a){o.exports=p;var u=n("../errors").codes,c=u.ERR_METHOD_NOT_IMPLEMENTED,d=u.ERR_MULTIPLE_CALLBACK,f=u.ERR_TRANSFORM_ALREADY_TRANSFORMING,h=u.ERR_TRANSFORM_WITH_LENGTH_0,y=n("./_stream_duplex");n("inherits")(p,y);function g(b,A){var w=this._transformState;w.transforming=!1;var T=w.writecb;if(T===null)return this.emit("error",new d);w.writechunk=null,w.writecb=null,A!=null&&this.push(A),T(b);var S=this._readableState;S.reading=!1,(S.needReadable||S.length<S.highWaterMark)&&this._read(S.highWaterMark)}function p(b){if(!(this instanceof p))return new p(b);y.call(this,b),this._transformState={afterTransform:g.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,b&&(typeof b.transform=="function"&&(this._transform=b.transform),typeof b.flush=="function"&&(this._flush=b.flush)),this.on("prefinish",v)}function v(){var b=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(A,w){_(b,A,w)}):_(this,null,null)}p.prototype.push=function(b,A){return this._transformState.needTransform=!1,y.prototype.push.call(this,b,A)},p.prototype._transform=function(b,A,w){w(new c("_transform()"))},p.prototype._write=function(b,A,w){var T=this._transformState;if(T.writecb=w,T.writechunk=b,T.writeencoding=A,!T.transforming){var S=this._readableState;(T.needTransform||S.needReadable||S.length<S.highWaterMark)&&this._read(S.highWaterMark)}},p.prototype._read=function(b){var A=this._transformState;A.writechunk!==null&&!A.transforming?(A.transforming=!0,this._transform(A.writechunk,A.writeencoding,A.afterTransform)):A.needTransform=!0},p.prototype._destroy=function(b,A){y.prototype._destroy.call(this,b,function(w){A(w)})};function _(b,A,w){if(A)return b.emit("error",A);if(w!=null&&b.push(w),b._writableState.length)throw new h;if(b._transformState.transforming)throw new f;return b.push(null)}},{"../errors":33,"./_stream_duplex":34,inherits:51}],38:[function(n,o,a){(function(u,c){(function(){o.exports=le;function d(Ne){var Oe=this;this.next=null,this.entry=null,this.finish=function(){$e(Oe,Ne)}}var f;le.WritableState=F;var h={deprecate:n("util-deprecate")},y=n("./internal/streams/stream"),g=n("buffer").Buffer,p=c.Uint8Array||function(){};function v(Ne){return g.from(Ne)}function _(Ne){return g.isBuffer(Ne)||Ne instanceof p}var b=n("./internal/streams/destroy"),A=n("./internal/streams/state"),w=A.getHighWaterMark,T=n("../errors").codes,S=T.ERR_INVALID_ARG_TYPE,x=T.ERR_METHOD_NOT_IMPLEMENTED,L=T.ERR_MULTIPLE_CALLBACK,M=T.ERR_STREAM_CANNOT_PIPE,O=T.ERR_STREAM_DESTROYED,ie=T.ERR_STREAM_NULL_VALUES,$=T.ERR_STREAM_WRITE_AFTER_END,z=T.ERR_UNKNOWN_ENCODING,V=b.errorOrDestroy;n("inherits")(le,y);function re(){}function F(Ne,Oe,Lt){f=f||n("./_stream_duplex"),Ne=Ne||{},typeof Lt!="boolean"&&(Lt=Oe instanceof f),this.objectMode=!!Ne.objectMode,Lt&&(this.objectMode=this.objectMode||!!Ne.writableObjectMode),this.highWaterMark=w(this,Ne,"writableHighWaterMark",Lt),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var kt=Ne.decodeStrings===!1;this.decodeStrings=!kt,this.defaultEncoding=Ne.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Cn){vn(Oe,Cn)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=Ne.emitClose!==!1,this.autoDestroy=!!Ne.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new d(this)}F.prototype.getBuffer=function(){for(var Oe=this.bufferedRequest,Lt=[];Oe;)Lt.push(Oe),Oe=Oe.next;return Lt},function(){try{Object.defineProperty(F.prototype,"buffer",{get:h.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var pe;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(pe=Function.prototype[Symbol.hasInstance],Object.defineProperty(le,Symbol.hasInstance,{value:function(Oe){return pe.call(this,Oe)?!0:this!==le?!1:Oe&&Oe._writableState instanceof F}})):pe=function(Oe){return Oe instanceof this};function le(Ne){f=f||n("./_stream_duplex");var Oe=this instanceof f;if(!Oe&&!pe.call(le,this))return new le(Ne);this._writableState=new F(Ne,this,Oe),this.writable=!0,Ne&&(typeof Ne.write=="function"&&(this._write=Ne.write),typeof Ne.writev=="function"&&(this._writev=Ne.writev),typeof Ne.destroy=="function"&&(this._destroy=Ne.destroy),typeof Ne.final=="function"&&(this._final=Ne.final)),y.call(this)}le.prototype.pipe=function(){V(this,new M)};function de(Ne,Oe){var Lt=new $;V(Ne,Lt),u.nextTick(Oe,Lt)}function Fe(Ne,Oe,Lt,kt){var Cn;return Lt===null?Cn=new ie:typeof Lt!="string"&&!Oe.objectMode&&(Cn=new S("chunk",["string","Buffer"],Lt)),Cn?(V(Ne,Cn),u.nextTick(kt,Cn),!1):!0}le.prototype.write=function(Ne,Oe,Lt){var kt=this._writableState,Cn=!1,oe=!kt.objectMode&&_(Ne);return oe&&!g.isBuffer(Ne)&&(Ne=v(Ne)),typeof Oe=="function"&&(Lt=Oe,Oe=null),oe?Oe="buffer":Oe||(Oe=kt.defaultEncoding),typeof Lt!="function"&&(Lt=re),kt.ending?de(this,Lt):(oe||Fe(this,kt,Ne,Lt))&&(kt.pendingcb++,Cn=At(this,kt,oe,Ne,Oe,Lt)),Cn},le.prototype.cork=function(){this._writableState.corked++},le.prototype.uncork=function(){var Ne=this._writableState;Ne.corked&&(Ne.corked--,!Ne.writing&&!Ne.corked&&!Ne.bufferProcessing&&Ne.bufferedRequest&&Ue(this,Ne))},le.prototype.setDefaultEncoding=function(Oe){if(typeof Oe=="string"&&(Oe=Oe.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Oe+"").toLowerCase())>-1))throw new z(Oe);return this._writableState.defaultEncoding=Oe,this},Object.defineProperty(le.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Ie(Ne,Oe,Lt){return!Ne.objectMode&&Ne.decodeStrings!==!1&&typeof Oe=="string"&&(Oe=g.from(Oe,Lt)),Oe}Object.defineProperty(le.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function At(Ne,Oe,Lt,kt,Cn,oe){if(!Lt){var ae=Ie(Oe,kt,Cn);kt!==ae&&(Lt=!0,Cn="buffer",kt=ae)}var Y=Oe.objectMode?1:kt.length;Oe.length+=Y;var k=Oe.length<Oe.highWaterMark;if(k||(Oe.needDrain=!0),Oe.writing||Oe.corked){var D=Oe.lastBufferedRequest;Oe.lastBufferedRequest={chunk:kt,encoding:Cn,isBuf:Lt,callback:oe,next:null},D?D.next=Oe.lastBufferedRequest:Oe.bufferedRequest=Oe.lastBufferedRequest,Oe.bufferedRequestCount+=1}else _e(Ne,Oe,!1,Y,kt,Cn,oe);return k}function _e(Ne,Oe,Lt,kt,Cn,oe,ae){Oe.writelen=kt,Oe.writecb=ae,Oe.writing=!0,Oe.sync=!0,Oe.destroyed?Oe.onwrite(new O("write")):Lt?Ne._writev(Cn,Oe.onwrite):Ne._write(Cn,oe,Oe.onwrite),Oe.sync=!1}function qe(Ne,Oe,Lt,kt,Cn){--Oe.pendingcb,Lt?(u.nextTick(Cn,kt),u.nextTick(Ce,Ne,Oe),Ne._writableState.errorEmitted=!0,V(Ne,kt)):(Cn(kt),Ne._writableState.errorEmitted=!0,V(Ne,kt),Ce(Ne,Oe))}function In(Ne){Ne.writing=!1,Ne.writecb=null,Ne.length-=Ne.writelen,Ne.writelen=0}function vn(Ne,Oe){var Lt=Ne._writableState,kt=Lt.sync,Cn=Lt.writecb;if(typeof Cn!="function")throw new L;if(In(Lt),Oe)qe(Ne,Lt,kt,Oe,Cn);else{var oe=Dt(Lt)||Ne.destroyed;!oe&&!Lt.corked&&!Lt.bufferProcessing&&Lt.bufferedRequest&&Ue(Ne,Lt),kt?u.nextTick(Pt,Ne,Lt,oe,Cn):Pt(Ne,Lt,oe,Cn)}}function Pt(Ne,Oe,Lt,kt){Lt||he(Ne,Oe),Oe.pendingcb--,kt(),Ce(Ne,Oe)}function he(Ne,Oe){Oe.length===0&&Oe.needDrain&&(Oe.needDrain=!1,Ne.emit("drain"))}function Ue(Ne,Oe){Oe.bufferProcessing=!0;var Lt=Oe.bufferedRequest;if(Ne._writev&&Lt&&Lt.next){var kt=Oe.bufferedRequestCount,Cn=new Array(kt),oe=Oe.corkedRequestsFree;oe.entry=Lt;for(var ae=0,Y=!0;Lt;)Cn[ae]=Lt,Lt.isBuf||(Y=!1),Lt=Lt.next,ae+=1;Cn.allBuffers=Y,_e(Ne,Oe,!0,Oe.length,Cn,"",oe.finish),Oe.pendingcb++,Oe.lastBufferedRequest=null,oe.next?(Oe.corkedRequestsFree=oe.next,oe.next=null):Oe.corkedRequestsFree=new d(Oe),Oe.bufferedRequestCount=0}else{for(;Lt;){var k=Lt.chunk,D=Lt.encoding,j=Lt.callback,xe=Oe.objectMode?1:k.length;if(_e(Ne,Oe,!1,xe,k,D,j),Lt=Lt.next,Oe.bufferedRequestCount--,Oe.writing)break}Lt===null&&(Oe.lastBufferedRequest=null)}Oe.bufferedRequest=Lt,Oe.bufferProcessing=!1}le.prototype._write=function(Ne,Oe,Lt){Lt(new x("_write()"))},le.prototype._writev=null,le.prototype.end=function(Ne,Oe,Lt){var kt=this._writableState;return typeof Ne=="function"?(Lt=Ne,Ne=null,Oe=null):typeof Oe=="function"&&(Lt=Oe,Oe=null),Ne!=null&&this.write(Ne,Oe),kt.corked&&(kt.corked=1,this.uncork()),kt.ending||ue(this,kt,Lt),this},Object.defineProperty(le.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Dt(Ne){return Ne.ending&&Ne.length===0&&Ne.bufferedRequest===null&&!Ne.finished&&!Ne.writing}function jt(Ne,Oe){Ne._final(function(Lt){Oe.pendingcb--,Lt&&V(Ne,Lt),Oe.prefinished=!0,Ne.emit("prefinish"),Ce(Ne,Oe)})}function Et(Ne,Oe){!Oe.prefinished&&!Oe.finalCalled&&(typeof Ne._final=="function"&&!Oe.destroyed?(Oe.pendingcb++,Oe.finalCalled=!0,u.nextTick(jt,Ne,Oe)):(Oe.prefinished=!0,Ne.emit("prefinish")))}function Ce(Ne,Oe){var Lt=Dt(Oe);if(Lt&&(Et(Ne,Oe),Oe.pendingcb===0&&(Oe.finished=!0,Ne.emit("finish"),Oe.autoDestroy))){var kt=Ne._readableState;(!kt||kt.autoDestroy&&kt.endEmitted)&&Ne.destroy()}return Lt}function ue(Ne,Oe,Lt){Oe.ending=!0,Ce(Ne,Oe),Lt&&(Oe.finished?u.nextTick(Lt):Ne.once("finish",Lt)),Oe.ended=!0,Ne.writable=!1}function $e(Ne,Oe,Lt){var kt=Ne.entry;for(Ne.entry=null;kt;){var Cn=kt.callback;Oe.pendingcb--,Cn(Lt),kt=kt.next}Oe.corkedRequestsFree.next=Ne}Object.defineProperty(le.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(Oe){this._writableState&&(this._writableState.destroyed=Oe)}}),le.prototype.destroy=b.destroy,le.prototype._undestroy=b.undestroy,le.prototype._destroy=function(Ne,Oe){Oe(Ne)}}).call(this)}).call(this,n("_process"),typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":33,"./_stream_duplex":34,"./internal/streams/destroy":41,"./internal/streams/state":45,"./internal/streams/stream":46,_process:102,buffer:29,inherits:51,"util-deprecate":139}],39:[function(n,o,a){(function(u){(function(){var c;function d(O,ie,$){return ie in O?Object.defineProperty(O,ie,{value:$,enumerable:!0,configurable:!0,writable:!0}):O[ie]=$,O}var f=n("./end-of-stream"),h=Symbol("lastResolve"),y=Symbol("lastReject"),g=Symbol("error"),p=Symbol("ended"),v=Symbol("lastPromise"),_=Symbol("handlePromise"),b=Symbol("stream");function A(O,ie){return{value:O,done:ie}}function w(O){var ie=O[h];if(ie!==null){var $=O[b].read();$!==null&&(O[v]=null,O[h]=null,O[y]=null,ie(A($,!1)))}}function T(O){u.nextTick(w,O)}function S(O,ie){return function($,z){O.then(function(){if(ie[p]){$(A(void 0,!0));return}ie[_]($,z)},z)}}var x=Object.getPrototypeOf(function(){}),L=Object.setPrototypeOf((c={get stream(){return this[b]},next:function(){var ie=this,$=this[g];if($!==null)return Promise.reject($);if(this[p])return Promise.resolve(A(void 0,!0));if(this[b].destroyed)return new Promise(function(F,pe){u.nextTick(function(){ie[g]?pe(ie[g]):F(A(void 0,!0))})});var z=this[v],V;if(z)V=new Promise(S(z,this));else{var re=this[b].read();if(re!==null)return Promise.resolve(A(re,!1));V=new Promise(this[_])}return this[v]=V,V}},d(c,Symbol.asyncIterator,function(){return this}),d(c,"return",function(){var ie=this;return new Promise(function($,z){ie[b].destroy(null,function(V){if(V){z(V);return}$(A(void 0,!0))})})}),c),x),M=function(ie){var $,z=Object.create(L,($={},d($,b,{value:ie,writable:!0}),d($,h,{value:null,writable:!0}),d($,y,{value:null,writable:!0}),d($,g,{value:null,writable:!0}),d($,p,{value:ie._readableState.endEmitted,writable:!0}),d($,_,{value:function(re,F){var pe=z[b].read();pe?(z[v]=null,z[h]=null,z[y]=null,re(A(pe,!1))):(z[h]=re,z[y]=F)},writable:!0}),$));return z[v]=null,f(ie,function(V){if(V&&V.code!=="ERR_STREAM_PREMATURE_CLOSE"){var re=z[y];re!==null&&(z[v]=null,z[h]=null,z[y]=null,re(V)),z[g]=V;return}var F=z[h];F!==null&&(z[v]=null,z[h]=null,z[y]=null,F(A(void 0,!0))),z[p]=!0}),ie.on("readable",T.bind(null,z)),z};o.exports=M}).call(this)}).call(this,n("_process"))},{"./end-of-stream":42,_process:102}],40:[function(n,o,a){function u(w,T){var S=Object.keys(w);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(w);T&&(x=x.filter(function(L){return Object.getOwnPropertyDescriptor(w,L).enumerable})),S.push.apply(S,x)}return S}function c(w){for(var T=1;T<arguments.length;T++){var S=arguments[T]!=null?arguments[T]:{};T%2?u(Object(S),!0).forEach(function(x){d(w,x,S[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(S)):u(Object(S)).forEach(function(x){Object.defineProperty(w,x,Object.getOwnPropertyDescriptor(S,x))})}return w}function d(w,T,S){return T in w?Object.defineProperty(w,T,{value:S,enumerable:!0,configurable:!0,writable:!0}):w[T]=S,w}function f(w,T){if(!(w instanceof T))throw new TypeError("Cannot call a class as a function")}function h(w,T){for(var S=0;S<T.length;S++){var x=T[S];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(w,x.key,x)}}function y(w,T,S){return T&&h(w.prototype,T),S&&h(w,S),w}var g=n("buffer"),p=g.Buffer,v=n("util"),_=v.inspect,b=_&&_.custom||"inspect";function A(w,T,S){p.prototype.copy.call(w,T,S)}o.exports=function(){function w(){f(this,w),this.head=null,this.tail=null,this.length=0}return y(w,[{key:"push",value:function(S){var x={data:S,next:null};this.length>0?this.tail.next=x:this.head=x,this.tail=x,++this.length}},{key:"unshift",value:function(S){var x={data:S,next:this.head};this.length===0&&(this.tail=x),this.head=x,++this.length}},{key:"shift",value:function(){if(this.length!==0){var S=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,S}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(S){if(this.length===0)return"";for(var x=this.head,L=""+x.data;x=x.next;)L+=S+x.data;return L}},{key:"concat",value:function(S){if(this.length===0)return p.alloc(0);for(var x=p.allocUnsafe(S>>>0),L=this.head,M=0;L;)A(L.data,x,M),M+=L.data.length,L=L.next;return x}},{key:"consume",value:function(S,x){var L;return S<this.head.data.length?(L=this.head.data.slice(0,S),this.head.data=this.head.data.slice(S)):S===this.head.data.length?L=this.shift():L=x?this._getString(S):this._getBuffer(S),L}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(S){var x=this.head,L=1,M=x.data;for(S-=M.length;x=x.next;){var O=x.data,ie=S>O.length?O.length:S;if(ie===O.length?M+=O:M+=O.slice(0,S),S-=ie,S===0){ie===O.length?(++L,x.next?this.head=x.next:this.head=this.tail=null):(this.head=x,x.data=O.slice(ie));break}++L}return this.length-=L,M}},{key:"_getBuffer",value:function(S){var x=p.allocUnsafe(S),L=this.head,M=1;for(L.data.copy(x),S-=L.data.length;L=L.next;){var O=L.data,ie=S>O.length?O.length:S;if(O.copy(x,x.length-S,0,ie),S-=ie,S===0){ie===O.length?(++M,L.next?this.head=L.next:this.head=this.tail=null):(this.head=L,L.data=O.slice(ie));break}++M}return this.length-=M,x}},{key:b,value:function(S,x){return _(this,c({},x,{depth:0,customInspect:!1}))}}]),w}()},{buffer:29,util:26}],41:[function(n,o,a){(function(u){(function(){function c(p,v){var _=this,b=this._readableState&&this._readableState.destroyed,A=this._writableState&&this._writableState.destroyed;return b||A?(v?v(p):p&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,u.nextTick(y,this,p)):u.nextTick(y,this,p)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(p||null,function(w){!v&&w?_._writableState?_._writableState.errorEmitted?u.nextTick(f,_):(_._writableState.errorEmitted=!0,u.nextTick(d,_,w)):u.nextTick(d,_,w):v?(u.nextTick(f,_),v(w)):u.nextTick(f,_)}),this)}function d(p,v){y(p,v),f(p)}function f(p){p._writableState&&!p._writableState.emitClose||p._readableState&&!p._readableState.emitClose||p.emit("close")}function h(){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 y(p,v){p.emit("error",v)}function g(p,v){var _=p._readableState,b=p._writableState;_&&_.autoDestroy||b&&b.autoDestroy?p.destroy(v):p.emit("error",v)}o.exports={destroy:c,undestroy:h,errorOrDestroy:g}}).call(this)}).call(this,n("_process"))},{_process:102}],42:[function(n,o,a){var u=n("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function c(y){var g=!1;return function(){if(!g){g=!0;for(var p=arguments.length,v=new Array(p),_=0;_<p;_++)v[_]=arguments[_];y.apply(this,v)}}}function d(){}function f(y){return y.setHeader&&typeof y.abort=="function"}function h(y,g,p){if(typeof g=="function")return h(y,null,g);g||(g={}),p=c(p||d);var v=g.readable||g.readable!==!1&&y.readable,_=g.writable||g.writable!==!1&&y.writable,b=function(){y.writable||w()},A=y._writableState&&y._writableState.finished,w=function(){_=!1,A=!0,v||p.call(y)},T=y._readableState&&y._readableState.endEmitted,S=function(){v=!1,T=!0,_||p.call(y)},x=function(ie){p.call(y,ie)},L=function(){var ie;if(v&&!T)return(!y._readableState||!y._readableState.ended)&&(ie=new u),p.call(y,ie);if(_&&!A)return(!y._writableState||!y._writableState.ended)&&(ie=new u),p.call(y,ie)},M=function(){y.req.on("finish",w)};return f(y)?(y.on("complete",w),y.on("abort",L),y.req?M():y.on("request",M)):_&&!y._writableState&&(y.on("end",b),y.on("close",b)),y.on("end",S),y.on("finish",w),g.error!==!1&&y.on("error",x),y.on("close",L),function(){y.removeListener("complete",w),y.removeListener("abort",L),y.removeListener("request",M),y.req&&y.req.removeListener("finish",w),y.removeListener("end",b),y.removeListener("close",b),y.removeListener("finish",w),y.removeListener("end",S),y.removeListener("error",x),y.removeListener("close",L)}}o.exports=h},{"../../../errors":33}],43:[function(n,o,a){o.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],44:[function(n,o,a){var u;function c(w){var T=!1;return function(){T||(T=!0,w.apply(void 0,arguments))}}var d=n("../../../errors").codes,f=d.ERR_MISSING_ARGS,h=d.ERR_STREAM_DESTROYED;function y(w){if(w)throw w}function g(w){return w.setHeader&&typeof w.abort=="function"}function p(w,T,S,x){x=c(x);var L=!1;w.on("close",function(){L=!0}),u===void 0&&(u=n("./end-of-stream")),u(w,{readable:T,writable:S},function(O){if(O)return x(O);L=!0,x()});var M=!1;return function(O){if(!L&&!M){if(M=!0,g(w))return w.abort();if(typeof w.destroy=="function")return w.destroy();x(O||new h("pipe"))}}}function v(w){w()}function _(w,T){return w.pipe(T)}function b(w){return!w.length||typeof w[w.length-1]!="function"?y:w.pop()}function A(){for(var w=arguments.length,T=new Array(w),S=0;S<w;S++)T[S]=arguments[S];var x=b(T);if(Array.isArray(T[0])&&(T=T[0]),T.length<2)throw new f("streams");var L,M=T.map(function(O,ie){var $=ie<T.length-1,z=ie>0;return p(O,$,z,function(V){L||(L=V),V&&M.forEach(v),!$&&(M.forEach(v),x(L))})});return T.reduce(_)}o.exports=A},{"../../../errors":33,"./end-of-stream":42}],45:[function(n,o,a){var u=n("../../../errors").codes.ERR_INVALID_OPT_VALUE;function c(f,h,y){return f.highWaterMark!=null?f.highWaterMark:h?f[y]:null}function d(f,h,y,g){var p=c(h,g,y);if(p!=null){if(!(isFinite(p)&&Math.floor(p)===p)||p<0){var v=g?y:"highWaterMark";throw new u(v,p)}return Math.floor(p)}return f.objectMode?16:16*1024}o.exports={getHighWaterMark:d}},{"../../../errors":33}],46:[function(n,o,a){o.exports=n("events").EventEmitter},{events:49}],47:[function(n,o,a){a=o.exports=n("./lib/_stream_readable.js"),a.Stream=a,a.Readable=a,a.Writable=n("./lib/_stream_writable.js"),a.Duplex=n("./lib/_stream_duplex.js"),a.Transform=n("./lib/_stream_transform.js"),a.PassThrough=n("./lib/_stream_passthrough.js"),a.finished=n("./lib/internal/streams/end-of-stream.js"),a.pipeline=n("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":34,"./lib/_stream_passthrough.js":35,"./lib/_stream_readable.js":36,"./lib/_stream_transform.js":37,"./lib/_stream_writable.js":38,"./lib/internal/streams/end-of-stream.js":42,"./lib/internal/streams/pipeline.js":44}],48:[function(n,o,a){(function(u){(function(){var c=n("once"),d=function(){},f=function(g){return g.setHeader&&typeof g.abort=="function"},h=function(g){return g.stdio&&Array.isArray(g.stdio)&&g.stdio.length===3},y=function(g,p,v){if(typeof p=="function")return y(g,null,p);p||(p={}),v=c(v||d);var _=g._writableState,b=g._readableState,A=p.readable||p.readable!==!1&&g.readable,w=p.writable||p.writable!==!1&&g.writable,T=!1,S=function(){g.writable||x()},x=function(){w=!1,A||v.call(g)},L=function(){A=!1,w||v.call(g)},M=function(V){v.call(g,V?new Error("exited with error code: "+V):null)},O=function(V){v.call(g,V)},ie=function(){u.nextTick($)},$=function(){if(!T){if(A&&!(b&&b.ended&&!b.destroyed))return v.call(g,new Error("premature close"));if(w&&!(_&&_.ended&&!_.destroyed))return v.call(g,new Error("premature close"))}},z=function(){g.req.on("finish",x)};return f(g)?(g.on("complete",x),g.on("abort",ie),g.req?z():g.on("request",z)):w&&!_&&(g.on("end",S),g.on("close",S)),h(g)&&g.on("exit",M),g.on("end",L),g.on("finish",x),p.error!==!1&&g.on("error",O),g.on("close",ie),function(){T=!0,g.removeListener("complete",x),g.removeListener("abort",ie),g.removeListener("request",z),g.req&&g.req.removeListener("finish",x),g.removeListener("end",S),g.removeListener("close",S),g.removeListener("finish",x),g.removeListener("exit",M),g.removeListener("end",L),g.removeListener("error",O),g.removeListener("close",ie)}};o.exports=y}).call(this)}).call(this,n("_process"))},{_process:102,once:100}],49:[function(n,o,a){var u=typeof Reflect=="object"?Reflect:null,c=u&&typeof u.apply=="function"?u.apply:function(z,V,re){return Function.prototype.apply.call(z,V,re)},d;u&&typeof u.ownKeys=="function"?d=u.ownKeys:Object.getOwnPropertySymbols?d=function(z){return Object.getOwnPropertyNames(z).concat(Object.getOwnPropertySymbols(z))}:d=function(z){return Object.getOwnPropertyNames(z)};function f($){console&&console.warn&&console.warn($)}var h=Number.isNaN||function(z){return z!==z};function y(){y.init.call(this)}o.exports=y,o.exports.once=M,y.EventEmitter=y,y.prototype._events=void 0,y.prototype._eventsCount=0,y.prototype._maxListeners=void 0;var g=10;function p($){if(typeof $!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof $)}Object.defineProperty(y,"defaultMaxListeners",{enumerable:!0,get:function(){return g},set:function($){if(typeof $!="number"||$<0||h($))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+$+".");g=$}}),y.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},y.prototype.setMaxListeners=function(z){if(typeof z!="number"||z<0||h(z))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+z+".");return this._maxListeners=z,this};function v($){return $._maxListeners===void 0?y.defaultMaxListeners:$._maxListeners}y.prototype.getMaxListeners=function(){return v(this)},y.prototype.emit=function(z){for(var V=[],re=1;re<arguments.length;re++)V.push(arguments[re]);var F=z==="error",pe=this._events;if(pe!==void 0)F=F&&pe.error===void 0;else if(!F)return!1;if(F){var le;if(V.length>0&&(le=V[0]),le instanceof Error)throw le;var de=new Error("Unhandled error."+(le?" ("+le.message+")":""));throw de.context=le,de}var Fe=pe[z];if(Fe===void 0)return!1;if(typeof Fe=="function")c(Fe,this,V);else for(var Ie=Fe.length,At=S(Fe,Ie),re=0;re<Ie;++re)c(At[re],this,V);return!0};function _($,z,V,re){var F,pe,le;if(p(V),pe=$._events,pe===void 0?(pe=$._events=Object.create(null),$._eventsCount=0):(pe.newListener!==void 0&&($.emit("newListener",z,V.listener?V.listener:V),pe=$._events),le=pe[z]),le===void 0)le=pe[z]=V,++$._eventsCount;else if(typeof le=="function"?le=pe[z]=re?[V,le]:[le,V]:re?le.unshift(V):le.push(V),F=v($),F>0&&le.length>F&&!le.warned){le.warned=!0;var de=new Error("Possible EventEmitter memory leak detected. "+le.length+" "+String(z)+" listeners added. Use emitter.setMaxListeners() to increase limit");de.name="MaxListenersExceededWarning",de.emitter=$,de.type=z,de.count=le.length,f(de)}return $}y.prototype.addListener=function(z,V){return _(this,z,V,!1)},y.prototype.on=y.prototype.addListener,y.prototype.prependListener=function(z,V){return _(this,z,V,!0)};function b(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function A($,z,V){var re={fired:!1,wrapFn:void 0,target:$,type:z,listener:V},F=b.bind(re);return F.listener=V,re.wrapFn=F,F}y.prototype.once=function(z,V){return p(V),this.on(z,A(this,z,V)),this},y.prototype.prependOnceListener=function(z,V){return p(V),this.prependListener(z,A(this,z,V)),this},y.prototype.removeListener=function(z,V){var re,F,pe,le,de;if(p(V),F=this._events,F===void 0)return this;if(re=F[z],re===void 0)return this;if(re===V||re.listener===V)--this._eventsCount===0?this._events=Object.create(null):(delete F[z],F.removeListener&&this.emit("removeListener",z,re.listener||V));else if(typeof re!="function"){for(pe=-1,le=re.length-1;le>=0;le--)if(re[le]===V||re[le].listener===V){de=re[le].listener,pe=le;break}if(pe<0)return this;pe===0?re.shift():x(re,pe),re.length===1&&(F[z]=re[0]),F.removeListener!==void 0&&this.emit("removeListener",z,de||V)}return this},y.prototype.off=y.prototype.removeListener,y.prototype.removeAllListeners=function(z){var V,re,F;if(re=this._events,re===void 0)return this;if(re.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):re[z]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete re[z]),this;if(arguments.length===0){var pe=Object.keys(re),le;for(F=0;F<pe.length;++F)le=pe[F],le!=="removeListener"&&this.removeAllListeners(le);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(V=re[z],typeof V=="function")this.removeListener(z,V);else if(V!==void 0)for(F=V.length-1;F>=0;F--)this.removeListener(z,V[F]);return this};function w($,z,V){var re=$._events;if(re===void 0)return[];var F=re[z];return F===void 0?[]:typeof F=="function"?V?[F.listener||F]:[F]:V?L(F):S(F,F.length)}y.prototype.listeners=function(z){return w(this,z,!0)},y.prototype.rawListeners=function(z){return w(this,z,!1)},y.listenerCount=function($,z){return typeof $.listenerCount=="function"?$.listenerCount(z):T.call($,z)},y.prototype.listenerCount=T;function T($){var z=this._events;if(z!==void 0){var V=z[$];if(typeof V=="function")return 1;if(V!==void 0)return V.length}return 0}y.prototype.eventNames=function(){return this._eventsCount>0?d(this._events):[]};function S($,z){for(var V=new Array(z),re=0;re<z;++re)V[re]=$[re];return V}function x($,z){for(;z+1<$.length;z++)$[z]=$[z+1];$.pop()}function L($){for(var z=new Array($.length),V=0;V<z.length;++V)z[V]=$[V].listener||$[V];return z}function M($,z){return new Promise(function(V,re){function F(le){$.removeListener(z,pe),re(le)}function pe(){typeof $.removeListener=="function"&&$.removeListener("error",F),V([].slice.call(arguments))}ie($,z,pe,{once:!0}),z!=="error"&&O($,F,{once:!0})})}function O($,z,V){typeof $.on=="function"&&ie($,"error",z,V)}function ie($,z,V,re){if(typeof $.on=="function")re.once?$.once(z,V):$.on(z,V);else if(typeof $.addEventListener=="function")$.addEventListener(z,function F(pe){re.once&&$.removeEventListener(z,F),V(pe)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof $)}},{}],50:[function(n,o,a){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */a.read=function(u,c,d,f,h){var y,g,p=h*8-f-1,v=(1<<p)-1,_=v>>1,b=-7,A=d?h-1:0,w=d?-1:1,T=u[c+A];for(A+=w,y=T&(1<<-b)-1,T>>=-b,b+=p;b>0;y=y*256+u[c+A],A+=w,b-=8);for(g=y&(1<<-b)-1,y>>=-b,b+=f;b>0;g=g*256+u[c+A],A+=w,b-=8);if(y===0)y=1-_;else{if(y===v)return g?NaN:(T?-1:1)*(1/0);g=g+Math.pow(2,f),y=y-_}return(T?-1:1)*g*Math.pow(2,y-f)},a.write=function(u,c,d,f,h,y){var g,p,v,_=y*8-h-1,b=(1<<_)-1,A=b>>1,w=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=f?0:y-1,S=f?1:-1,x=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(p=isNaN(c)?1:0,g=b):(g=Math.floor(Math.log(c)/Math.LN2),c*(v=Math.pow(2,-g))<1&&(g--,v*=2),g+A>=1?c+=w/v:c+=w*Math.pow(2,1-A),c*v>=2&&(g++,v/=2),g+A>=b?(p=0,g=b):g+A>=1?(p=(c*v-1)*Math.pow(2,h),g=g+A):(p=c*Math.pow(2,A-1)*Math.pow(2,h),g=0));h>=8;u[d+T]=p&255,T+=S,p/=256,h-=8);for(g=g<<h|p,_+=h;_>0;u[d+T]=g&255,T+=S,g/=256,_-=8);u[d+T-S]|=x*128}},{}],51:[function(n,o,a){typeof Object.create=="function"?o.exports=function(c,d){d&&(c.super_=d,c.prototype=Object.create(d.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}))}:o.exports=function(c,d){if(d){c.super_=d;var f=function(){};f.prototype=d.prototype,c.prototype=new f,c.prototype.constructor=c}}},{}],52:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.ContainerIterator=a.Container=a.Base=void 0;class u{constructor(h=0){this.iteratorType=h}equals(h){return this.o===h.o}}a.ContainerIterator=u;class c{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return this.i===0}}a.Base=c;class d extends c{}a.Container=d},{}],53:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.HashContainerIterator=a.HashContainer=void 0;var u=n("../../ContainerBase"),c=f(n("../../../utils/checkObject")),d=n("../../../utils/throwError");function f(g){return g&&g.t?g:{default:g}}class h extends u.ContainerIterator{constructor(p,v,_){super(_),this.o=p,this.h=v,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,d.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,d.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,d.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,d.throwIteratorAccessError)(),this.o=this.o.L,this})}}a.HashContainerIterator=h;class y extends u.Container{constructor(){super(),this.H=[],this.g={},this.HASH_TAG=Symbol("@@HASH_TAG"),Object.setPrototypeOf(this.g,null),this.h={},this.h.L=this.h.B=this.p=this._=this.h}V(p){const{L:v,B:_}=p;v.B=_,_.L=v,p===this.p&&(this.p=_),p===this._&&(this._=v),this.i-=1}M(p,v,_){_===void 0&&(_=(0,c.default)(p));let b;if(_){const A=p[this.HASH_TAG];if(A!==void 0)return this.H[A].l=v,this.i;Object.defineProperty(p,this.HASH_TAG,{value:this.H.length,configurable:!0}),b={u:p,l:v,L:this._,B:this.h},this.H.push(b)}else{const A=this.g[p];if(A)return A.l=v,this.i;b={u:p,l:v,L:this._,B:this.h},this.g[p]=b}return this.i===0?(this.p=b,this.h.B=b):this._.B=b,this._=b,this.h.L=b,++this.i}I(p,v){if(v===void 0&&(v=(0,c.default)(p)),v){const _=p[this.HASH_TAG];return _===void 0?this.h:this.H[_]}else return this.g[p]||this.h}clear(){const p=this.HASH_TAG;this.H.forEach(function(v){delete v.u[p]}),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h}eraseElementByKey(p,v){let _;if(v===void 0&&(v=(0,c.default)(p)),v){const b=p[this.HASH_TAG];if(b===void 0)return!1;delete p[this.HASH_TAG],_=this.H[b],delete this.H[b]}else{if(_=this.g[p],_===void 0)return!1;delete this.g[p]}return this.V(_),!0}eraseElementByIterator(p){const v=p.o;return v===this.h&&(0,d.throwIteratorAccessError)(),this.V(v),p.next()}eraseElementByPos(p){if(p<0||p>this.i-1)throw new RangeError;let v=this.p;for(;p--;)v=v.B;return this.V(v),this.i}}a.HashContainer=y},{"../../../utils/checkObject":70,"../../../utils/throwError":71,"../../ContainerBase":52}],54:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.default=void 0;var u=n("./Base"),c=f(n("../../utils/checkObject")),d=n("../../utils/throwError");function f(p){return p&&p.t?p:{default:p}}class h extends u.HashContainerIterator{constructor(v,_,b,A){super(v,_,A),this.container=b}get pointer(){this.o===this.h&&(0,d.throwIteratorAccessError)();const v=this;return new Proxy([],{get(_,b){if(b==="0")return v.o.u;if(b==="1")return v.o.l},set(_,b,A){if(b!=="1")throw new TypeError("props must be 1");return v.o.l=A,!0}})}copy(){return new h(this.o,this.h,this.container,this.iteratorType)}}class y extends u.HashContainer{constructor(v=[]){super();const _=this;v.forEach(function(b){_.setElement(b[0],b[1])})}begin(){return new h(this.p,this.h,this)}end(){return new h(this.h,this.h,this)}rBegin(){return new h(this._,this.h,this,1)}rEnd(){return new h(this.h,this.h,this,1)}front(){if(this.i!==0)return[this.p.u,this.p.l]}back(){if(this.i!==0)return[this._.u,this._.l]}setElement(v,_,b){return this.M(v,_,b)}getElementByKey(v,_){if(_===void 0&&(_=(0,c.default)(v)),_){const A=v[this.HASH_TAG];return A!==void 0?this.H[A].l:void 0}const b=this.g[v];return b?b.l:void 0}getElementByPos(v){if(v<0||v>this.i-1)throw new RangeError;let _=this.p;for(;v--;)_=_.B;return[_.u,_.l]}find(v,_){const b=this.I(v,_);return new h(b,this.h,this)}forEach(v){let _=0,b=this.p;for(;b!==this.h;)v([b.u,b.l],_++,this),b=b.B}[Symbol.iterator](){return(function*(){let v=this.p;for(;v!==this.h;)yield[v.u,v.l],v=v.B}).bind(this)()}}var g=y;a.default=g},{"../../utils/checkObject":70,"../../utils/throwError":71,"./Base":53}],55:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.default=void 0;var u=n("./Base"),c=n("../../utils/throwError");class d extends u.HashContainerIterator{constructor(g,p,v,_){super(g,p,_),this.container=v}get pointer(){return this.o===this.h&&(0,c.throwIteratorAccessError)(),this.o.u}copy(){return new d(this.o,this.h,this.container,this.iteratorType)}}class f extends u.HashContainer{constructor(g=[]){super();const p=this;g.forEach(function(v){p.insert(v)})}begin(){return new d(this.p,this.h,this)}end(){return new d(this.h,this.h,this)}rBegin(){return new d(this._,this.h,this,1)}rEnd(){return new d(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(g,p){return this.M(g,void 0,p)}getElementByPos(g){if(g<0||g>this.i-1)throw new RangeError;let p=this.p;for(;g--;)p=p.B;return p.u}find(g,p){const v=this.I(g,p);return new d(v,this.h,this)}forEach(g){let p=0,v=this.p;for(;v!==this.h;)g(v.u,p++,this),v=v.B}[Symbol.iterator](){return(function*(){let g=this.p;for(;g!==this.h;)yield g.u,g=g.B}).bind(this)()}}var h=f;a.default=h},{"../../utils/throwError":71,"./Base":53}],56:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.default=void 0;var u=n("../ContainerBase");class c extends u.Base{constructor(h=[],y=function(p,v){return p>v?-1:p<v?1:0},g=!0){if(super(),this.v=y,Array.isArray(h))this.C=g?[...h]:h;else{this.C=[];const v=this;h.forEach(function(_){v.C.push(_)})}this.i=this.C.length;const p=this.i>>1;for(let v=this.i-1>>1;v>=0;--v)this.k(v,p)}m(h){const y=this.C[h];for(;h>0;){const g=h-1>>1,p=this.C[g];if(this.v(p,y)<=0)break;this.C[h]=p,h=g}this.C[h]=y}k(h,y){const g=this.C[h];for(;h<y;){let p=h<<1|1;const v=p+1;let _=this.C[p];if(v<this.i&&this.v(_,this.C[v])>0&&(p=v,_=this.C[v]),this.v(_,g)>=0)break;this.C[h]=_,h=p}this.C[h]=g}clear(){this.i=0,this.C.length=0}push(h){this.C.push(h),this.m(this.i),this.i+=1}pop(){if(this.i===0)return;const h=this.C[0],y=this.C.pop();return this.i-=1,this.i&&(this.C[0]=y,this.k(0,this.i>>1)),h}top(){return this.C[0]}find(h){return this.C.indexOf(h)>=0}remove(h){const y=this.C.indexOf(h);return y<0?!1:(y===0?this.pop():y===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(y,1,this.C.pop()),this.i-=1,this.m(y),this.k(y,this.i>>1)),!0)}updateItem(h){const y=this.C.indexOf(h);return y<0?!1:(this.m(y),this.k(y,this.i>>1),!0)}toArray(){return[...this.C]}}var d=c;a.default=d},{"../ContainerBase":52}],57:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.default=void 0;var u=n("../ContainerBase");class c extends u.Base{constructor(h=[]){super(),this.j=0,this.q=[];const y=this;h.forEach(function(g){y.push(g)})}clear(){this.q=[],this.i=this.j=0}push(h){const y=this.q.length;if(this.j/y>.5&&this.j+this.i>=y&&y>4096){const g=this.i;for(let p=0;p<g;++p)this.q[p]=this.q[this.j+p];this.j=0,this.q[this.i]=h}else this.q[this.j+this.i]=h;return++this.i}pop(){if(this.i===0)return;const h=this.q[this.j++];return this.i-=1,h}front(){if(this.i!==0)return this.q[this.j]}}var d=c;a.default=d},{"../ContainerBase":52}],58:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.default=void 0;var u=n("../ContainerBase");class c extends u.Base{constructor(h=[]){super(),this.S=[];const y=this;h.forEach(function(g){y.push(g)})}clear(){this.i=0,this.S=[]}push(h){return this.S.push(h),this.i+=1,this.i}pop(){if(this.i!==0)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}}var d=c;a.default=d},{"../ContainerBase":52}],59:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.RandomIterator=void 0;var u=n("../../ContainerBase"),c=n("../../../utils/throwError");class d extends u.ContainerIterator{constructor(h,y){super(y),this.o=h,this.iteratorType===0?(this.pre=function(){return this.o===0&&(0,c.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,c.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,c.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return this.o===-1&&(0,c.throwIteratorAccessError)(),this.o-=1,this})}get pointer(){return this.container.getElementByPos(this.o)}set pointer(h){this.container.setElementByPos(this.o,h)}}a.RandomIterator=d},{"../../../utils/throwError":71,"../../ContainerBase":52}],60:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.default=void 0;var u=n("../../ContainerBase");class c extends u.Container{}var d=c;a.default=d},{"../../ContainerBase":52}],61:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.default=void 0;var u=d(n("./Base")),c=n("./Base/RandomIterator");function d(g){return g&&g.t?g:{default:g}}class f extends c.RandomIterator{constructor(p,v,_){super(p,_),this.container=v}copy(){return new f(this.o,this.container,this.iteratorType)}}class h extends u.default{constructor(p=[],v=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];const _=(()=>{if(typeof p.length=="number")return p.length;if(typeof p.size=="number")return p.size;if(typeof p.size=="function")return p.size();throw new TypeError("Cannot get the length or size of the container")})();this.F=v,this.P=Math.max(Math.ceil(_/this.F),1);for(let w=0;w<this.P;++w)this.A.push(new Array(this.F));const b=Math.ceil(_/this.F);this.j=this.R=(this.P>>1)-(b>>1),this.D=this.N=this.F-_%this.F>>1;const A=this;p.forEach(function(w){A.pushBack(w)})}T(){const p=[],v=Math.max(this.P>>1,1);for(let _=0;_<v;++_)p[_]=new Array(this.F);for(let _=this.j;_<this.P;++_)p[p.length]=this.A[_];for(let _=0;_<this.R;++_)p[p.length]=this.A[_];p[p.length]=[...this.A[this.R]],this.j=v,this.R=p.length-1;for(let _=0;_<v;++_)p[p.length]=new Array(this.F);this.A=p,this.P=p.length}O(p){const v=this.D+p+1,_=v%this.F;let b=_-1,A=this.j+(v-_)/this.F;return _===0&&(A-=1),A%=this.P,b<0&&(b+=this.F),{curNodeBucketIndex:A,curNodePointerIndex:b}}clear(){this.A=[new Array(this.F)],this.P=1,this.j=this.R=this.i=0,this.D=this.N=this.F>>1}begin(){return new f(0,this)}end(){return new f(this.i,this)}rBegin(){return new f(this.i-1,this,1)}rEnd(){return new f(-1,this,1)}front(){if(this.i!==0)return this.A[this.j][this.D]}back(){if(this.i!==0)return this.A[this.R][this.N]}pushBack(p){return this.i&&(this.N<this.F-1?this.N+=1:this.R<this.P-1?(this.R+=1,this.N=0):(this.R=0,this.N=0),this.R===this.j&&this.N===this.D&&this.T()),this.i+=1,this.A[this.R][this.N]=p,this.i}popBack(){if(this.i===0)return;const p=this.A[this.R][this.N];return this.i!==1&&(this.N>0?this.N-=1:this.R>0?(this.R-=1,this.N=this.F-1):(this.R=this.P-1,this.N=this.F-1)),this.i-=1,p}pushFront(p){return this.i&&(this.D>0?this.D-=1:this.j>0?(this.j-=1,this.D=this.F-1):(this.j=this.P-1,this.D=this.F-1),this.j===this.R&&this.D===this.N&&this.T()),this.i+=1,this.A[this.j][this.D]=p,this.i}popFront(){if(this.i===0)return;const p=this.A[this.j][this.D];return this.i!==1&&(this.D<this.F-1?this.D+=1:this.j<this.P-1?(this.j+=1,this.D=0):(this.j=0,this.D=0)),this.i-=1,p}getElementByPos(p){if(p<0||p>this.i-1)throw new RangeError;const{curNodeBucketIndex:v,curNodePointerIndex:_}=this.O(p);return this.A[v][_]}setElementByPos(p,v){if(p<0||p>this.i-1)throw new RangeError;const{curNodeBucketIndex:_,curNodePointerIndex:b}=this.O(p);this.A[_][b]=v}insert(p,v,_=1){if(p<0||p>this.i)throw new RangeError;if(p===0)for(;_--;)this.pushFront(v);else if(p===this.i)for(;_--;)this.pushBack(v);else{const b=[];for(let A=p;A<this.i;++A)b.push(this.getElementByPos(A));this.cut(p-1);for(let A=0;A<_;++A)this.pushBack(v);for(let A=0;A<b.length;++A)this.pushBack(b[A])}return this.i}cut(p){if(p<0)return this.clear(),0;const{curNodeBucketIndex:v,curNodePointerIndex:_}=this.O(p);return this.R=v,this.N=_,this.i=p+1,this.i}eraseElementByPos(p){if(p<0||p>this.i-1)throw new RangeError;if(p===0)this.popFront();else if(p===this.i-1)this.popBack();else{const v=[];for(let b=p+1;b<this.i;++b)v.push(this.getElementByPos(b));this.cut(p),this.popBack();const _=this;v.forEach(function(b){_.pushBack(b)})}return this.i}eraseElementByValue(p){if(this.i===0)return 0;const v=[];for(let b=0;b<this.i;++b){const A=this.getElementByPos(b);A!==p&&v.push(A)}const _=v.length;for(let b=0;b<_;++b)this.setElementByPos(b,v[b]);return this.cut(_-1)}eraseElementByIterator(p){const v=p.o;return this.eraseElementByPos(v),p=p.next(),p}find(p){for(let v=0;v<this.i;++v)if(this.getElementByPos(v)===p)return new f(v,this);return this.end()}reverse(){let p=0,v=this.i-1;for(;p<v;){const _=this.getElementByPos(p);this.setElementByPos(p,this.getElementByPos(v)),this.setElementByPos(v,_),p+=1,v-=1}}unique(){if(this.i<=1)return this.i;let p=1,v=this.getElementByPos(0);for(let _=1;_<this.i;++_){const b=this.getElementByPos(_);b!==v&&(v=b,this.setElementByPos(p++,b))}for(;this.i>p;)this.popBack();return this.i}sort(p){const v=[];for(let _=0;_<this.i;++_)v.push(this.getElementByPos(_));v.sort(p);for(let _=0;_<this.i;++_)this.setElementByPos(_,v[_])}shrinkToFit(){if(this.i===0)return;const p=[];this.forEach(function(v){p.push(v)}),this.P=Math.max(Math.ceil(this.i/this.F),1),this.i=this.j=this.R=this.D=this.N=0,this.A=[];for(let v=0;v<this.P;++v)this.A.push(new Array(this.F));for(let v=0;v<p.length;++v)this.pushBack(p[v])}forEach(p){for(let v=0;v<this.i;++v)p(this.getElementByPos(v),v,this)}[Symbol.iterator](){return(function*(){for(let p=0;p<this.i;++p)yield this.getElementByPos(p)}).bind(this)()}}var y=h;a.default=y},{"./Base":60,"./Base/RandomIterator":59}],62:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.default=void 0;var u=f(n("./Base")),c=n("../ContainerBase"),d=n("../../utils/throwError");function f(p){return p&&p.t?p:{default:p}}class h extends c.ContainerIterator{constructor(v,_,b,A){super(A),this.o=v,this.h=_,this.container=b,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,d.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,d.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,d.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,d.throwIteratorAccessError)(),this.o=this.o.L,this})}get pointer(){return this.o===this.h&&(0,d.throwIteratorAccessError)(),this.o.l}set pointer(v){this.o===this.h&&(0,d.throwIteratorAccessError)(),this.o.l=v}copy(){return new h(this.o,this.h,this.container,this.iteratorType)}}class y extends u.default{constructor(v=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;const _=this;v.forEach(function(b){_.pushBack(b)})}V(v){const{L:_,B:b}=v;_.B=b,b.L=_,v===this.p&&(this.p=b),v===this._&&(this._=_),this.i-=1}G(v,_){const b=_.B,A={l:v,L:_,B:b};_.B=A,b.L=A,_===this.h&&(this.p=A),b===this.h&&(this._=A),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new h(this.p,this.h,this)}end(){return new h(this.h,this.h,this)}rBegin(){return new h(this._,this.h,this,1)}rEnd(){return new h(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(v){if(v<0||v>this.i-1)throw new RangeError;let _=this.p;for(;v--;)_=_.B;return _.l}eraseElementByPos(v){if(v<0||v>this.i-1)throw new RangeError;let _=this.p;for(;v--;)_=_.B;return this.V(_),this.i}eraseElementByValue(v){let _=this.p;for(;_!==this.h;)_.l===v&&this.V(_),_=_.B;return this.i}eraseElementByIterator(v){const _=v.o;return _===this.h&&(0,d.throwIteratorAccessError)(),v=v.next(),this.V(_),v}pushBack(v){return this.G(v,this._),this.i}popBack(){if(this.i===0)return;const v=this._.l;return this.V(this._),v}pushFront(v){return this.G(v,this.h),this.i}popFront(){if(this.i===0)return;const v=this.p.l;return this.V(this.p),v}setElementByPos(v,_){if(v<0||v>this.i-1)throw new RangeError;let b=this.p;for(;v--;)b=b.B;b.l=_}insert(v,_,b=1){if(v<0||v>this.i)throw new RangeError;if(b<=0)return this.i;if(v===0)for(;b--;)this.pushFront(_);else if(v===this.i)for(;b--;)this.pushBack(_);else{let A=this.p;for(let T=1;T<v;++T)A=A.B;const w=A.B;for(this.i+=b;b--;)A.B={l:_,L:A},A.B.L=A,A=A.B;A.B=w,w.L=A}return this.i}find(v){let _=this.p;for(;_!==this.h;){if(_.l===v)return new h(_,this.h,this);_=_.B}return this.end()}reverse(){if(this.i<=1)return;let v=this.p,_=this._,b=0;for(;b<<1<this.i;){const A=v.l;v.l=_.l,_.l=A,v=v.B,_=_.L,b+=1}}unique(){if(this.i<=1)return this.i;let v=this.p;for(;v!==this.h;){let _=v;for(;_.B!==this.h&&_.l===_.B.l;)_=_.B,this.i-=1;v.B=_.B,v.B.L=v,v=v.B}return this.i}sort(v){if(this.i<=1)return;const _=[];this.forEach(function(A){_.push(A)}),_.sort(v);let b=this.p;_.forEach(function(A){b.l=A,b=b.B})}merge(v){const _=this;if(this.i===0)v.forEach(function(b){_.pushBack(b)});else{let b=this.p;v.forEach(function(A){for(;b!==_.h&&b.l<=A;)b=b.B;_.G(A,b.L)})}return this.i}forEach(v){let _=this.p,b=0;for(;_!==this.h;)v(_.l,b++,this),_=_.B}[Symbol.iterator](){return(function*(){if(this.i===0)return;let v=this.p;for(;v!==this.h;)yield v.l,v=v.B}).bind(this)()}}var g=y;a.default=g},{"../../utils/throwError":71,"../ContainerBase":52,"./Base":60}],63:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.default=void 0;var u=d(n("./Base")),c=n("./Base/RandomIterator");function d(g){return g&&g.t?g:{default:g}}class f extends c.RandomIterator{constructor(p,v,_){super(p,_),this.container=v}copy(){return new f(this.o,this.container,this.iteratorType)}}class h extends u.default{constructor(p=[],v=!0){if(super(),Array.isArray(p))this.J=v?[...p]:p,this.i=p.length;else{this.J=[];const _=this;p.forEach(function(b){_.pushBack(b)})}}clear(){this.i=0,this.J.length=0}begin(){return new f(0,this)}end(){return new f(this.i,this)}rBegin(){return new f(this.i-1,this,1)}rEnd(){return new f(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(p){if(p<0||p>this.i-1)throw new RangeError;return this.J[p]}eraseElementByPos(p){if(p<0||p>this.i-1)throw new RangeError;return this.J.splice(p,1),this.i-=1,this.i}eraseElementByValue(p){let v=0;for(let _=0;_<this.i;++_)this.J[_]!==p&&(this.J[v++]=this.J[_]);return this.i=this.J.length=v,this.i}eraseElementByIterator(p){const v=p.o;return p=p.next(),this.eraseElementByPos(v),p}pushBack(p){return this.J.push(p),this.i+=1,this.i}popBack(){if(this.i!==0)return this.i-=1,this.J.pop()}setElementByPos(p,v){if(p<0||p>this.i-1)throw new RangeError;this.J[p]=v}insert(p,v,_=1){if(p<0||p>this.i)throw new RangeError;return this.J.splice(p,0,...new Array(_).fill(v)),this.i+=_,this.i}find(p){for(let v=0;v<this.i;++v)if(this.J[v]===p)return new f(v,this);return this.end()}reverse(){this.J.reverse()}unique(){let p=1;for(let v=1;v<this.i;++v)this.J[v]!==this.J[v-1]&&(this.J[p++]=this.J[v]);return this.i=this.J.length=p,this.i}sort(p){this.J.sort(p)}forEach(p){for(let v=0;v<this.i;++v)p(this.J[v],v,this)}[Symbol.iterator](){return(function*(){yield*this.J}).bind(this)()}}var y=h;a.default=y},{"./Base":60,"./Base/RandomIterator":59}],64:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.default=void 0;var u=n("../../ContainerBase"),c=n("../../../utils/throwError");class d extends u.ContainerIterator{constructor(y,g,p){super(p),this.o=y,this.h=g,this.iteratorType===0?(this.pre=function(){return this.o===this.h.U&&(0,c.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,c.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,c.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,c.throwIteratorAccessError)(),this.o=this.o.L(),this})}get index(){let y=this.o;const g=this.h.tt;if(y===this.h)return g?g.rt-1:0;let p=0;for(y.U&&(p+=y.U.rt);y!==g;){const v=y.tt;y===v.W&&(p+=1,v.U&&(p+=v.U.rt)),y=v}return p}}var f=d;a.default=f},{"../../../utils/throwError":71,"../../ContainerBase":52}],65:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.TreeNodeEnableIndex=a.TreeNode=void 0;class u{constructor(f,h){this.ee=1,this.u=void 0,this.l=void 0,this.U=void 0,this.W=void 0,this.tt=void 0,this.u=f,this.l=h}L(){let f=this;if(f.ee===1&&f.tt.tt===f)f=f.W;else if(f.U)for(f=f.U;f.W;)f=f.W;else{let h=f.tt;for(;h.U===f;)f=h,h=f.tt;f=h}return f}B(){let f=this;if(f.W){for(f=f.W;f.U;)f=f.U;return f}else{let h=f.tt;for(;h.W===f;)f=h,h=f.tt;return f.W!==h?h:f}}te(){const f=this.tt,h=this.W,y=h.U;return f.tt===this?f.tt=h:f.U===this?f.U=h:f.W=h,h.tt=f,h.U=this,this.tt=h,this.W=y,y&&(y.tt=this),h}se(){const f=this.tt,h=this.U,y=h.W;return f.tt===this?f.tt=h:f.U===this?f.U=h:f.W=h,h.tt=f,h.W=this,this.tt=h,this.U=y,y&&(y.tt=this),h}}a.TreeNode=u;class c extends u{constructor(){super(...arguments),this.rt=1}te(){const f=super.te();return this.ie(),f.ie(),f}se(){const f=super.se();return this.ie(),f.ie(),f}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}}a.TreeNodeEnableIndex=c},{}],66:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.default=void 0;var u=n("./TreeNode"),c=n("../../ContainerBase"),d=n("../../../utils/throwError");class f extends c.Container{constructor(g=function(v,_){return v<_?-1:v>_?1:0},p=!1){super(),this.Y=void 0,this.v=g,p?(this.re=u.TreeNodeEnableIndex,this.M=function(v,_,b){const A=this.ne(v,_,b);if(A){let w=A.tt;for(;w!==this.h;)w.rt+=1,w=w.tt;const T=this.he(A);if(T){const{parentNode:S,grandParent:x,curNode:L}=T;S.ie(),x.ie(),L.ie()}}return this.i},this.V=function(v){let _=this.fe(v);for(;_!==this.h;)_.rt-=1,_=_.tt}):(this.re=u.TreeNode,this.M=function(v,_,b){const A=this.ne(v,_,b);return A&&this.he(A),this.i},this.V=this.fe),this.h=new this.re}X(g,p){let v=this.h;for(;g;){const _=this.v(g.u,p);if(_<0)g=g.W;else if(_>0)v=g,g=g.U;else return g}return v}Z(g,p){let v=this.h;for(;g;)this.v(g.u,p)<=0?g=g.W:(v=g,g=g.U);return v}$(g,p){let v=this.h;for(;g;){const _=this.v(g.u,p);if(_<0)v=g,g=g.W;else if(_>0)g=g.U;else return g}return v}rr(g,p){let v=this.h;for(;g;)this.v(g.u,p)<0?(v=g,g=g.W):g=g.U;return v}ue(g){for(;;){const p=g.tt;if(p===this.h)return;if(g.ee===1){g.ee=0;return}if(g===p.U){const v=p.W;if(v.ee===1)v.ee=0,p.ee=1,p===this.Y?this.Y=p.te():p.te();else if(v.W&&v.W.ee===1){v.ee=p.ee,p.ee=0,v.W.ee=0,p===this.Y?this.Y=p.te():p.te();return}else v.U&&v.U.ee===1?(v.ee=1,v.U.ee=0,v.se()):(v.ee=1,g=p)}else{const v=p.U;if(v.ee===1)v.ee=0,p.ee=1,p===this.Y?this.Y=p.se():p.se();else if(v.U&&v.U.ee===1){v.ee=p.ee,p.ee=0,v.U.ee=0,p===this.Y?this.Y=p.se():p.se();return}else v.W&&v.W.ee===1?(v.ee=1,v.W.ee=0,v.te()):(v.ee=1,g=p)}}}fe(g){if(this.i===1)return this.clear(),this.h;let p=g;for(;p.U||p.W;){if(p.W)for(p=p.W;p.U;)p=p.U;else p=p.U;[g.u,p.u]=[p.u,g.u],[g.l,p.l]=[p.l,g.l],g=p}this.h.U===p?this.h.U=p.tt:this.h.W===p&&(this.h.W=p.tt),this.ue(p);const v=p.tt;return p===v.U?v.U=void 0:v.W=void 0,this.i-=1,this.Y.ee=0,v}oe(g,p){return g===void 0?!1:this.oe(g.U,p)||p(g)?!0:this.oe(g.W,p)}he(g){for(;;){const p=g.tt;if(p.ee===0)return;const v=p.tt;if(p===v.U){const _=v.W;if(_&&_.ee===1){if(_.ee=p.ee=0,v===this.Y)return;v.ee=1,g=v;continue}else if(g===p.W){if(g.ee=0,g.U&&(g.U.tt=p),g.W&&(g.W.tt=v),p.W=g.U,v.U=g.W,g.U=p,g.W=v,v===this.Y)this.Y=g,this.h.tt=g;else{const b=v.tt;b.U===v?b.U=g:b.W=g}return g.tt=v.tt,p.tt=g,v.tt=g,v.ee=1,{parentNode:p,grandParent:v,curNode:g}}else p.ee=0,v===this.Y?this.Y=v.se():v.se(),v.ee=1}else{const _=v.U;if(_&&_.ee===1){if(_.ee=p.ee=0,v===this.Y)return;v.ee=1,g=v;continue}else if(g===p.U){if(g.ee=0,g.U&&(g.U.tt=v),g.W&&(g.W.tt=p),v.W=g.U,p.U=g.W,g.U=v,g.W=p,v===this.Y)this.Y=g,this.h.tt=g;else{const b=v.tt;b.U===v?b.U=g:b.W=g}return g.tt=v.tt,p.tt=g,v.tt=g,v.ee=1,{parentNode:p,grandParent:v,curNode:g}}else p.ee=0,v===this.Y?this.Y=v.te():v.te(),v.ee=1}return}}ne(g,p,v){if(this.Y===void 0){this.i+=1,this.Y=new this.re(g,p),this.Y.ee=0,this.Y.tt=this.h,this.h.tt=this.Y,this.h.U=this.Y,this.h.W=this.Y;return}let _;const b=this.h.U,A=this.v(b.u,g);if(A===0){b.l=p;return}else if(A>0)b.U=new this.re(g,p),b.U.tt=b,_=b.U,this.h.U=_;else{const w=this.h.W,T=this.v(w.u,g);if(T===0){w.l=p;return}else if(T<0)w.W=new this.re(g,p),w.W.tt=w,_=w.W,this.h.W=_;else{if(v!==void 0){const S=v.o;if(S!==this.h){const x=this.v(S.u,g);if(x===0){S.l=p;return}else if(x>0){const L=S.L(),M=this.v(L.u,g);if(M===0){L.l=p;return}else M<0&&(_=new this.re(g,p),L.W===void 0?(L.W=_,_.tt=L):(S.U=_,_.tt=S))}}}if(_===void 0)for(_=this.Y;;){const S=this.v(_.u,g);if(S>0){if(_.U===void 0){_.U=new this.re(g,p),_.U.tt=_,_=_.U;break}_=_.U}else if(S<0){if(_.W===void 0){_.W=new this.re(g,p),_.W.tt=_,_=_.W;break}_=_.W}else{_.l=p;return}}}}return this.i+=1,_}I(g,p){for(;g;){const v=this.v(g.u,p);if(v<0)g=g.W;else if(v>0)g=g.U;else return g}return g||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}updateKeyByIterator(g,p){const v=g.o;if(v===this.h&&(0,d.throwIteratorAccessError)(),this.i===1)return v.u=p,!0;if(v===this.h.U)return this.v(v.B().u,p)>0?(v.u=p,!0):!1;if(v===this.h.W)return this.v(v.L().u,p)<0?(v.u=p,!0):!1;const _=v.L().u;if(this.v(_,p)>=0)return!1;const b=v.B().u;return this.v(b,p)<=0?!1:(v.u=p,!0)}eraseElementByPos(g){if(g<0||g>this.i-1)throw new RangeError;let p=0;const v=this;return this.oe(this.Y,function(_){return g===p?(v.V(_),!0):(p+=1,!1)}),this.i}eraseElementByKey(g){if(this.i===0)return!1;const p=this.I(this.Y,g);return p===this.h?!1:(this.V(p),!0)}eraseElementByIterator(g){const p=g.o;p===this.h&&(0,d.throwIteratorAccessError)();const v=p.W===void 0;return g.iteratorType===0?v&&g.next():(!v||p.U===void 0)&&g.next(),this.V(p),g}forEach(g){let p=0;for(const v of this)g(v,p++,this)}getElementByPos(g){if(g<0||g>this.i-1)throw new RangeError;let p,v=0;for(const _ of this){if(v===g){p=_;break}v+=1}return p}getHeight(){if(this.i===0)return 0;const g=function(p){return p?Math.max(g(p.U),g(p.W))+1:0};return g(this.Y)}}var h=f;a.default=h},{"../../../utils/throwError":71,"../../ContainerBase":52,"./TreeNode":65}],67:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.default=void 0;var u=f(n("./Base")),c=f(n("./Base/TreeIterator")),d=n("../../utils/throwError");function f(p){return p&&p.t?p:{default:p}}class h extends c.default{constructor(v,_,b,A){super(v,_,A),this.container=b}get pointer(){this.o===this.h&&(0,d.throwIteratorAccessError)();const v=this;return new Proxy([],{get(_,b){if(b==="0")return v.o.u;if(b==="1")return v.o.l},set(_,b,A){if(b!=="1")throw new TypeError("props must be 1");return v.o.l=A,!0}})}copy(){return new h(this.o,this.h,this.container,this.iteratorType)}}class y extends u.default{constructor(v=[],_,b){super(_,b);const A=this;v.forEach(function(w){A.setElement(w[0],w[1])})}*K(v){v!==void 0&&(yield*this.K(v.U),yield[v.u,v.l],yield*this.K(v.W))}begin(){return new h(this.h.U||this.h,this.h,this)}end(){return new h(this.h,this.h,this)}rBegin(){return new h(this.h.W||this.h,this.h,this,1)}rEnd(){return new h(this.h,this.h,this,1)}front(){if(this.i===0)return;const v=this.h.U;return[v.u,v.l]}back(){if(this.i===0)return;const v=this.h.W;return[v.u,v.l]}lowerBound(v){const _=this.X(this.Y,v);return new h(_,this.h,this)}upperBound(v){const _=this.Z(this.Y,v);return new h(_,this.h,this)}reverseLowerBound(v){const _=this.$(this.Y,v);return new h(_,this.h,this)}reverseUpperBound(v){const _=this.rr(this.Y,v);return new h(_,this.h,this)}setElement(v,_,b){return this.M(v,_,b)}find(v){const _=this.I(this.Y,v);return new h(_,this.h,this)}getElementByKey(v){return this.I(this.Y,v).l}union(v){const _=this;return v.forEach(function(b){_.setElement(b[0],b[1])}),this.i}[Symbol.iterator](){return this.K(this.Y)}}var g=y;a.default=g},{"../../utils/throwError":71,"./Base":66,"./Base/TreeIterator":64}],68:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.default=void 0;var u=f(n("./Base")),c=f(n("./Base/TreeIterator")),d=n("../../utils/throwError");function f(p){return p&&p.t?p:{default:p}}class h extends c.default{constructor(v,_,b,A){super(v,_,A),this.container=b}get pointer(){return this.o===this.h&&(0,d.throwIteratorAccessError)(),this.o.u}copy(){return new h(this.o,this.h,this.container,this.iteratorType)}}class y extends u.default{constructor(v=[],_,b){super(_,b);const A=this;v.forEach(function(w){A.insert(w)})}*K(v){v!==void 0&&(yield*this.K(v.U),yield v.u,yield*this.K(v.W))}begin(){return new h(this.h.U||this.h,this.h,this)}end(){return new h(this.h,this.h,this)}rBegin(){return new h(this.h.W||this.h,this.h,this,1)}rEnd(){return new h(this.h,this.h,this,1)}front(){return this.h.U?this.h.U.u:void 0}back(){return this.h.W?this.h.W.u:void 0}insert(v,_){return this.M(v,void 0,_)}find(v){const _=this.I(this.Y,v);return new h(_,this.h,this)}lowerBound(v){const _=this.X(this.Y,v);return new h(_,this.h,this)}upperBound(v){const _=this.Z(this.Y,v);return new h(_,this.h,this)}reverseLowerBound(v){const _=this.$(this.Y,v);return new h(_,this.h,this)}reverseUpperBound(v){const _=this.rr(this.Y,v);return new h(_,this.h,this)}union(v){const _=this;return v.forEach(function(b){_.insert(b)}),this.i}[Symbol.iterator](){return this.K(this.Y)}}var g=y;a.default=g},{"../../utils/throwError":71,"./Base":66,"./Base/TreeIterator":64}],69:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),Object.defineProperty(a,"Deque",{enumerable:!0,get:function(){return y.default}}),Object.defineProperty(a,"HashMap",{enumerable:!0,get:function(){return _.default}}),Object.defineProperty(a,"HashSet",{enumerable:!0,get:function(){return v.default}}),Object.defineProperty(a,"LinkList",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(a,"OrderedMap",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(a,"OrderedSet",{enumerable:!0,get:function(){return g.default}}),Object.defineProperty(a,"PriorityQueue",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(a,"Queue",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(a,"Stack",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(a,"Vector",{enumerable:!0,get:function(){return f.default}});var u=b(n("./container/OtherContainer/Stack")),c=b(n("./container/OtherContainer/Queue")),d=b(n("./container/OtherContainer/PriorityQueue")),f=b(n("./container/SequentialContainer/Vector")),h=b(n("./container/SequentialContainer/LinkList")),y=b(n("./container/SequentialContainer/Deque")),g=b(n("./container/TreeContainer/OrderedSet")),p=b(n("./container/TreeContainer/OrderedMap")),v=b(n("./container/HashContainer/HashSet")),_=b(n("./container/HashContainer/HashMap"));function b(A){return A&&A.t?A:{default:A}}},{"./container/HashContainer/HashMap":54,"./container/HashContainer/HashSet":55,"./container/OtherContainer/PriorityQueue":56,"./container/OtherContainer/Queue":57,"./container/OtherContainer/Stack":58,"./container/SequentialContainer/Deque":61,"./container/SequentialContainer/LinkList":62,"./container/SequentialContainer/Vector":63,"./container/TreeContainer/OrderedMap":67,"./container/TreeContainer/OrderedSet":68}],70:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.default=u;function u(c){const d=typeof c;return d==="object"&&c!==null||d==="function"}},{}],71:[function(n,o,a){Object.defineProperty(a,"t",{value:!0}),a.throwIteratorAccessError=u;function u(){throw new RangeError("Iterator access denied!")}},{}],72:[function(n,o,a){(function(u){(function(){const c=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,f=typeof AbortController=="function"?AbortController:class{constructor(){this.signal=new g}abort($=new Error("This operation was aborted")){this.signal.reason=this.signal.reason||$,this.signal.aborted=!0,this.signal.dispatchEvent({type:"abort",target:this.signal})}},h=typeof AbortSignal=="function",y=typeof f.AbortSignal=="function",g=h?AbortSignal:y?f.AbortController:class{constructor(){this.reason=void 0,this.aborted=!1,this._listeners=[]}dispatchEvent($){$.type==="abort"&&(this.aborted=!0,this.onabort($),this._listeners.forEach(z=>z($),this))}onabort(){}addEventListener($,z){$==="abort"&&this._listeners.push(z)}removeEventListener($,z){$==="abort"&&(this._listeners=this._listeners.filter(V=>V!==z))}},p=new Set,v=(ie,$)=>{const z=`LRU_CACHE_OPTION_${ie}`;w(z)&&T(z,`${ie} option`,`options.${$}`,O)},_=(ie,$)=>{const z=`LRU_CACHE_METHOD_${ie}`;if(w(z)){const{prototype:V}=O,{get:re}=Object.getOwnPropertyDescriptor(V,ie);T(z,`${ie} method`,`cache.${$}()`,re)}},b=(ie,$)=>{const z=`LRU_CACHE_PROPERTY_${ie}`;if(w(z)){const{prototype:V}=O,{get:re}=Object.getOwnPropertyDescriptor(V,ie);T(z,`${ie} property`,`cache.${$}`,re)}},A=(...ie)=>{typeof u=="object"&&u&&typeof u.emitWarning=="function"?u.emitWarning(...ie):console.error(...ie)},w=ie=>!p.has(ie),T=(ie,$,z,V)=>{p.add(ie);const re=`The ${$} is deprecated. Please use ${z} instead.`;A(re,"DeprecationWarning",ie,V)},S=ie=>ie&&ie===Math.floor(ie)&&ie>0&&isFinite(ie),x=ie=>S(ie)?ie<=Math.pow(2,8)?Uint8Array:ie<=Math.pow(2,16)?Uint16Array:ie<=Math.pow(2,32)?Uint32Array:ie<=Number.MAX_SAFE_INTEGER?L:null:null;class L extends Array{constructor($){super($),this.fill(0)}}class M{constructor($){if($===0)return[];const z=x($);this.heap=new z($),this.length=0}push($){this.heap[this.length++]=$}pop(){return this.heap[--this.length]}}class O{constructor($={}){const{max:z=0,ttl:V,ttlResolution:re=1,ttlAutopurge:F,updateAgeOnGet:pe,updateAgeOnHas:le,allowStale:de,dispose:Fe,disposeAfter:Ie,noDisposeOnSet:At,noUpdateTTL:_e,maxSize:qe=0,maxEntrySize:In=0,sizeCalculation:vn,fetchMethod:Pt,fetchContext:he,noDeleteOnFetchRejection:Ue,noDeleteOnStaleGet:Dt,allowStaleOnFetchRejection:jt,allowStaleOnFetchAbort:Et,ignoreFetchAbort:Ce}=$,{length:ue,maxAge:$e,stale:Ne}=$ instanceof O?{}:$;if(z!==0&&!S(z))throw new TypeError("max option must be a nonnegative integer");const Oe=z?x(z):Array;if(!Oe)throw new Error("invalid max value: "+z);if(this.max=z,this.maxSize=qe,this.maxEntrySize=In||this.maxSize,this.sizeCalculation=vn||ue,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=Pt||null,this.fetchMethod&&typeof this.fetchMethod!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.fetchContext=he,!this.fetchMethod&&he!==void 0)throw new TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=new Array(z).fill(null),this.valList=new Array(z).fill(null),this.next=new Oe(z),this.prev=new Oe(z),this.head=0,this.tail=0,this.free=new M(z),this.initialFill=1,this.size=0,typeof Fe=="function"&&(this.dispose=Fe),typeof Ie=="function"?(this.disposeAfter=Ie,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!At,this.noUpdateTTL=!!_e,this.noDeleteOnFetchRejection=!!Ue,this.allowStaleOnFetchRejection=!!jt,this.allowStaleOnFetchAbort=!!Et,this.ignoreFetchAbort=!!Ce,this.maxEntrySize!==0){if(this.maxSize!==0&&!S(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");if(!S(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!de||!!Ne,this.noDeleteOnStaleGet=!!Dt,this.updateAgeOnGet=!!pe,this.updateAgeOnHas=!!le,this.ttlResolution=S(re)||re===0?re:1,this.ttlAutopurge=!!F,this.ttl=V||$e||0,this.ttl){if(!S(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(this.max===0&&this.ttl===0&&this.maxSize===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){const Lt="LRU_CACHE_UNBOUNDED";w(Lt)&&(p.add(Lt),A("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Lt,O))}Ne&&v("stale","allowStale"),$e&&v("maxAge","ttl"),ue&&v("length","sizeCalculation")}getRemainingTTL($){return this.has($,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new L(this.max),this.starts=new L(this.max),this.setItemTTL=(V,re,F=c.now())=>{if(this.starts[V]=re!==0?F:0,this.ttls[V]=re,re!==0&&this.ttlAutopurge){const pe=setTimeout(()=>{this.isStale(V)&&this.delete(this.keyList[V])},re+1);pe.unref&&pe.unref()}},this.updateItemAge=V=>{this.starts[V]=this.ttls[V]!==0?c.now():0},this.statusTTL=(V,re)=>{V&&(V.ttl=this.ttls[re],V.start=this.starts[re],V.now=$||z(),V.remainingTTL=V.now+V.ttl-V.start)};let $=0;const z=()=>{const V=c.now();if(this.ttlResolution>0){$=V;const re=setTimeout(()=>$=0,this.ttlResolution);re.unref&&re.unref()}return V};this.getRemainingTTL=V=>{const re=this.keyMap.get(V);return re===void 0?0:this.ttls[re]===0||this.starts[re]===0?1/0:this.starts[re]+this.ttls[re]-($||z())},this.isStale=V=>this.ttls[V]!==0&&this.starts[V]!==0&&($||z())-this.starts[V]>this.ttls[V]}updateItemAge($){}statusTTL($,z){}setItemTTL($,z,V){}isStale($){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new L(this.max),this.removeItemSize=$=>{this.calculatedSize-=this.sizes[$],this.sizes[$]=0},this.requireSize=($,z,V,re)=>{if(this.isBackgroundFetch(z))return 0;if(!S(V))if(re){if(typeof re!="function")throw new TypeError("sizeCalculation must be a function");if(V=re(z,$),!S(V))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return V},this.addItemSize=($,z,V)=>{if(this.sizes[$]=z,this.maxSize){const re=this.maxSize-this.sizes[$];for(;this.calculatedSize>re;)this.evict(!0)}this.calculatedSize+=this.sizes[$],V&&(V.entrySize=z,V.totalCalculatedSize=this.calculatedSize)}}removeItemSize($){}addItemSize($,z){}requireSize($,z,V,re){if(V||re)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}*indexes({allowStale:$=this.allowStale}={}){if(this.size)for(let z=this.tail;!(!this.isValidIndex(z)||(($||!this.isStale(z))&&(yield z),z===this.head));)z=this.prev[z]}*rindexes({allowStale:$=this.allowStale}={}){if(this.size)for(let z=this.head;!(!this.isValidIndex(z)||(($||!this.isStale(z))&&(yield z),z===this.tail));)z=this.next[z]}isValidIndex($){return $!==void 0&&this.keyMap.get(this.keyList[$])===$}*entries(){for(const $ of this.indexes())this.valList[$]!==void 0&&this.keyList[$]!==void 0&&!this.isBackgroundFetch(this.valList[$])&&(yield[this.keyList[$],this.valList[$]])}*rentries(){for(const $ of this.rindexes())this.valList[$]!==void 0&&this.keyList[$]!==void 0&&!this.isBackgroundFetch(this.valList[$])&&(yield[this.keyList[$],this.valList[$]])}*keys(){for(const $ of this.indexes())this.keyList[$]!==void 0&&!this.isBackgroundFetch(this.valList[$])&&(yield this.keyList[$])}*rkeys(){for(const $ of this.rindexes())this.keyList[$]!==void 0&&!this.isBackgroundFetch(this.valList[$])&&(yield this.keyList[$])}*values(){for(const $ of this.indexes())this.valList[$]!==void 0&&!this.isBackgroundFetch(this.valList[$])&&(yield this.valList[$])}*rvalues(){for(const $ of this.rindexes())this.valList[$]!==void 0&&!this.isBackgroundFetch(this.valList[$])&&(yield this.valList[$])}[Symbol.iterator](){return this.entries()}find($,z){for(const V of this.indexes()){const re=this.valList[V],F=this.isBackgroundFetch(re)?re.__staleWhileFetching:re;if(F!==void 0&&$(F,this.keyList[V],this))return this.get(this.keyList[V],z)}}forEach($,z=this){for(const V of this.indexes()){const re=this.valList[V],F=this.isBackgroundFetch(re)?re.__staleWhileFetching:re;F!==void 0&&$.call(z,F,this.keyList[V],this)}}rforEach($,z=this){for(const V of this.rindexes()){const re=this.valList[V],F=this.isBackgroundFetch(re)?re.__staleWhileFetching:re;F!==void 0&&$.call(z,F,this.keyList[V],this)}}get prune(){return _("prune","purgeStale"),this.purgeStale}purgeStale(){let $=!1;for(const z of this.rindexes({allowStale:!0}))this.isStale(z)&&(this.delete(this.keyList[z]),$=!0);return $}dump(){const $=[];for(const z of this.indexes({allowStale:!0})){const V=this.keyList[z],re=this.valList[z],F=this.isBackgroundFetch(re)?re.__staleWhileFetching:re;if(F===void 0)continue;const pe={value:F};if(this.ttls){pe.ttl=this.ttls[z];const le=c.now()-this.starts[z];pe.start=Math.floor(Date.now()-le)}this.sizes&&(pe.size=this.sizes[z]),$.unshift([V,pe])}return $}load($){this.clear();for(const[z,V]of $){if(V.start){const re=Date.now()-V.start;V.start=c.now()-re}this.set(z,V.value,V)}}dispose($,z,V){}set($,z,{ttl:V=this.ttl,start:re,noDisposeOnSet:F=this.noDisposeOnSet,size:pe=0,sizeCalculation:le=this.sizeCalculation,noUpdateTTL:de=this.noUpdateTTL,status:Fe}={}){if(pe=this.requireSize($,z,pe,le),this.maxEntrySize&&pe>this.maxEntrySize)return Fe&&(Fe.set="miss",Fe.maxEntrySizeExceeded=!0),this.delete($),this;let Ie=this.size===0?void 0:this.keyMap.get($);if(Ie===void 0)Ie=this.newIndex(),this.keyList[Ie]=$,this.valList[Ie]=z,this.keyMap.set($,Ie),this.next[this.tail]=Ie,this.prev[Ie]=this.tail,this.tail=Ie,this.size++,this.addItemSize(Ie,pe,Fe),Fe&&(Fe.set="add"),de=!1;else{this.moveToTail(Ie);const At=this.valList[Ie];if(z!==At){if(this.isBackgroundFetch(At)?At.__abortController.abort(new Error("replaced")):F||(this.dispose(At,$,"set"),this.disposeAfter&&this.disposed.push([At,$,"set"])),this.removeItemSize(Ie),this.valList[Ie]=z,this.addItemSize(Ie,pe,Fe),Fe){Fe.set="replace";const _e=At&&this.isBackgroundFetch(At)?At.__staleWhileFetching:At;_e!==void 0&&(Fe.oldValue=_e)}}else Fe&&(Fe.set="update")}if(V!==0&&this.ttl===0&&!this.ttls&&this.initializeTTLTracking(),de||this.setItemTTL(Ie,V,re),this.statusTTL(Fe,Ie),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return this.size===0?this.tail:this.size===this.max&&this.max!==0?this.evict(!1):this.free.length!==0?this.free.pop():this.initialFill++}pop(){if(this.size){const $=this.valList[this.head];return this.evict(!0),$}}evict($){const z=this.head,V=this.keyList[z],re=this.valList[z];return this.isBackgroundFetch(re)?re.__abortController.abort(new Error("evicted")):(this.dispose(re,V,"evict"),this.disposeAfter&&this.disposed.push([re,V,"evict"])),this.removeItemSize(z),$&&(this.keyList[z]=null,this.valList[z]=null,this.free.push(z)),this.head=this.next[z],this.keyMap.delete(V),this.size--,z}has($,{updateAgeOnHas:z=this.updateAgeOnHas,status:V}={}){const re=this.keyMap.get($);if(re!==void 0)if(this.isStale(re))V&&(V.has="stale",this.statusTTL(V,re));else return z&&this.updateItemAge(re),V&&(V.has="hit"),this.statusTTL(V,re),!0;else V&&(V.has="miss");return!1}peek($,{allowStale:z=this.allowStale}={}){const V=this.keyMap.get($);if(V!==void 0&&(z||!this.isStale(V))){const re=this.valList[V];return this.isBackgroundFetch(re)?re.__staleWhileFetching:re}}backgroundFetch($,z,V,re){const F=z===void 0?void 0:this.valList[z];if(this.isBackgroundFetch(F))return F;const pe=new f;V.signal&&V.signal.addEventListener("abort",()=>pe.abort(V.signal.reason));const le={signal:pe.signal,options:V,context:re},de=(qe,In=!1)=>{const{aborted:vn}=pe.signal,Pt=V.ignoreFetchAbort&&qe!==void 0;return V.status&&(vn&&!In?(V.status.fetchAborted=!0,V.status.fetchError=pe.signal.reason,Pt&&(V.status.fetchAbortIgnored=!0)):V.status.fetchResolved=!0),vn&&!Pt&&!In?Ie(pe.signal.reason):(this.valList[z]===_e&&(qe===void 0?_e.__staleWhileFetching?this.valList[z]=_e.__staleWhileFetching:this.delete($):(V.status&&(V.status.fetchUpdated=!0),this.set($,qe,le.options))),qe)},Fe=qe=>(V.status&&(V.status.fetchRejected=!0,V.status.fetchError=qe),Ie(qe)),Ie=qe=>{const{aborted:In}=pe.signal,vn=In&&V.allowStaleOnFetchAbort,Pt=vn||V.allowStaleOnFetchRejection,he=Pt||V.noDeleteOnFetchRejection;if(this.valList[z]===_e&&(!he||_e.__staleWhileFetching===void 0?this.delete($):vn||(this.valList[z]=_e.__staleWhileFetching)),Pt)return V.status&&_e.__staleWhileFetching!==void 0&&(V.status.returnedStale=!0),_e.__staleWhileFetching;if(_e.__returned===_e)throw qe},At=(qe,In)=>{this.fetchMethod($,F,le).then(vn=>qe(vn),In),pe.signal.addEventListener("abort",()=>{(!V.ignoreFetchAbort||V.allowStaleOnFetchAbort)&&(qe(),V.allowStaleOnFetchAbort&&(qe=vn=>de(vn,!0)))})};V.status&&(V.status.fetchDispatched=!0);const _e=new Promise(At).then(de,Fe);return _e.__abortController=pe,_e.__staleWhileFetching=F,_e.__returned=null,z===void 0?(this.set($,_e,{...le.options,status:void 0}),z=this.keyMap.get($)):this.valList[z]=_e,_e}isBackgroundFetch($){return $&&typeof $=="object"&&typeof $.then=="function"&&Object.prototype.hasOwnProperty.call($,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call($,"__returned")&&($.__returned===$||$.__returned===null)}async fetch($,{allowStale:z=this.allowStale,updateAgeOnGet:V=this.updateAgeOnGet,noDeleteOnStaleGet:re=this.noDeleteOnStaleGet,ttl:F=this.ttl,noDisposeOnSet:pe=this.noDisposeOnSet,size:le=0,sizeCalculation:de=this.sizeCalculation,noUpdateTTL:Fe=this.noUpdateTTL,noDeleteOnFetchRejection:Ie=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:At=this.allowStaleOnFetchRejection,ignoreFetchAbort:_e=this.ignoreFetchAbort,allowStaleOnFetchAbort:qe=this.allowStaleOnFetchAbort,fetchContext:In=this.fetchContext,forceRefresh:vn=!1,status:Pt,signal:he}={}){if(!this.fetchMethod)return Pt&&(Pt.fetch="get"),this.get($,{allowStale:z,updateAgeOnGet:V,noDeleteOnStaleGet:re,status:Pt});const Ue={allowStale:z,updateAgeOnGet:V,noDeleteOnStaleGet:re,ttl:F,noDisposeOnSet:pe,size:le,sizeCalculation:de,noUpdateTTL:Fe,noDeleteOnFetchRejection:Ie,allowStaleOnFetchRejection:At,allowStaleOnFetchAbort:qe,ignoreFetchAbort:_e,status:Pt,signal:he};let Dt=this.keyMap.get($);if(Dt===void 0){Pt&&(Pt.fetch="miss");const jt=this.backgroundFetch($,Dt,Ue,In);return jt.__returned=jt}else{const jt=this.valList[Dt];if(this.isBackgroundFetch(jt)){const Ne=z&&jt.__staleWhileFetching!==void 0;return Pt&&(Pt.fetch="inflight",Ne&&(Pt.returnedStale=!0)),Ne?jt.__staleWhileFetching:jt.__returned=jt}const Et=this.isStale(Dt);if(!vn&&!Et)return Pt&&(Pt.fetch="hit"),this.moveToTail(Dt),V&&this.updateItemAge(Dt),this.statusTTL(Pt,Dt),jt;const Ce=this.backgroundFetch($,Dt,Ue,In),ue=Ce.__staleWhileFetching!==void 0,$e=ue&&z;return Pt&&(Pt.fetch=ue&&Et?"stale":"refresh",$e&&Et&&(Pt.returnedStale=!0)),$e?Ce.__staleWhileFetching:Ce.__returned=Ce}}get($,{allowStale:z=this.allowStale,updateAgeOnGet:V=this.updateAgeOnGet,noDeleteOnStaleGet:re=this.noDeleteOnStaleGet,status:F}={}){const pe=this.keyMap.get($);if(pe!==void 0){const le=this.valList[pe],de=this.isBackgroundFetch(le);return this.statusTTL(F,pe),this.isStale(pe)?(F&&(F.get="stale"),de?(F&&(F.returnedStale=z&&le.__staleWhileFetching!==void 0),z?le.__staleWhileFetching:void 0):(re||this.delete($),F&&(F.returnedStale=z),z?le:void 0)):(F&&(F.get="hit"),de?le.__staleWhileFetching:(this.moveToTail(pe),V&&this.updateItemAge(pe),le))}else F&&(F.get="miss")}connect($,z){this.prev[z]=$,this.next[$]=z}moveToTail($){$!==this.tail&&($===this.head?this.head=this.next[$]:this.connect(this.prev[$],this.next[$]),this.connect(this.tail,$),this.tail=$)}get del(){return _("del","delete"),this.delete}delete($){let z=!1;if(this.size!==0){const V=this.keyMap.get($);if(V!==void 0)if(z=!0,this.size===1)this.clear();else{this.removeItemSize(V);const re=this.valList[V];this.isBackgroundFetch(re)?re.__abortController.abort(new Error("deleted")):(this.dispose(re,$,"delete"),this.disposeAfter&&this.disposed.push([re,$,"delete"])),this.keyMap.delete($),this.keyList[V]=null,this.valList[V]=null,V===this.tail?this.tail=this.prev[V]:V===this.head?this.head=this.next[V]:(this.next[this.prev[V]]=this.next[V],this.prev[this.next[V]]=this.prev[V]),this.size--,this.free.push(V)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return z}clear(){for(const $ of this.rindexes({allowStale:!0})){const z=this.valList[$];if(this.isBackgroundFetch(z))z.__abortController.abort(new Error("deleted"));else{const V=this.keyList[$];this.dispose(z,V,"delete"),this.disposeAfter&&this.disposed.push([z,V,"delete"])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return _("reset","clear"),this.clear}get length(){return b("length","size"),this.size}static get AbortController(){return f}static get AbortSignal(){return g}}o.exports=O}).call(this)}).call(this,n("_process"))},{_process:102}],73:[function(n,o,a){const u=o.exports,{Buffer:c}=n("buffer");u.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"},u.requiredHeaderFlags={1:0,2:0,4:0,5:0,6:2,7:0,8:2,9:0,10:2,11:0,12:0,13:0,14:0,15:0},u.requiredHeaderFlagsErrors={};for(const f in u.requiredHeaderFlags){const h=u.requiredHeaderFlags[f];u.requiredHeaderFlagsErrors[f]="Invalid header flag bits, must be 0x"+h.toString(16)+" for "+u.types[f]+" packet"}u.codes={};for(const f in u.types){const h=u.types[f];u.codes[h]=f}u.CMD_SHIFT=4,u.CMD_MASK=240,u.DUP_MASK=8,u.QOS_MASK=3,u.QOS_SHIFT=1,u.RETAIN_MASK=1,u.VARBYTEINT_MASK=127,u.VARBYTEINT_FIN_MASK=128,u.VARBYTEINT_MAX=268435455,u.SESSIONPRESENT_MASK=1,u.SESSIONPRESENT_HEADER=c.from([u.SESSIONPRESENT_MASK]),u.CONNACK_HEADER=c.from([u.codes.connack<<u.CMD_SHIFT]),u.USERNAME_MASK=128,u.PASSWORD_MASK=64,u.WILL_RETAIN_MASK=32,u.WILL_QOS_MASK=24,u.WILL_QOS_SHIFT=3,u.WILL_FLAG_MASK=4,u.CLEAN_SESSION_MASK=2,u.CONNECT_HEADER=c.from([u.codes.connect<<u.CMD_SHIFT]),u.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},u.propertiesCodes={};for(const f in u.properties){const h=u.properties[f];u.propertiesCodes[h]=f}u.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 d(f){return[0,1,2].map(h=>[0,1].map(y=>[0,1].map(g=>{const p=c.alloc(1);return p.writeUInt8(u.codes[f]<<u.CMD_SHIFT|(y?u.DUP_MASK:0)|h<<u.QOS_SHIFT|g,0,!0),p})))}u.PUBLISH_HEADER=d("publish"),u.SUBSCRIBE_HEADER=d("subscribe"),u.SUBSCRIBE_OPTIONS_QOS_MASK=3,u.SUBSCRIBE_OPTIONS_NL_MASK=1,u.SUBSCRIBE_OPTIONS_NL_SHIFT=2,u.SUBSCRIBE_OPTIONS_RAP_MASK=1,u.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,u.SUBSCRIBE_OPTIONS_RH_MASK=3,u.SUBSCRIBE_OPTIONS_RH_SHIFT=4,u.SUBSCRIBE_OPTIONS_RH=[0,16,32],u.SUBSCRIBE_OPTIONS_NL=4,u.SUBSCRIBE_OPTIONS_RAP=8,u.SUBSCRIBE_OPTIONS_QOS=[0,1,2],u.UNSUBSCRIBE_HEADER=d("unsubscribe"),u.ACKS={unsuback:d("unsuback"),puback:d("puback"),pubcomp:d("pubcomp"),pubrel:d("pubrel"),pubrec:d("pubrec")},u.SUBACK_HEADER=c.from([u.codes.suback<<u.CMD_SHIFT]),u.VERSION3=c.from([3]),u.VERSION4=c.from([4]),u.VERSION5=c.from([5]),u.VERSION131=c.from([131]),u.VERSION132=c.from([132]),u.QOS=[0,1,2].map(f=>c.from([f])),u.EMPTY={pingreq:c.from([u.codes.pingreq<<4,0]),pingresp:c.from([u.codes.pingresp<<4,0]),disconnect:c.from([u.codes.disconnect<<4,0])},u.MQTT5_PUBACK_PUBREC_CODES={0:"Success",16:"No matching subscribers",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",144:"Topic Name invalid",145:"Packet identifier in use",151:"Quota exceeded",153:"Payload format invalid"},u.MQTT5_PUBREL_PUBCOMP_CODES={0:"Success",146:"Packet Identifier not found"},u.MQTT5_SUBACK_CODES={0:"Granted QoS 0",1:"Granted QoS 1",2:"Granted QoS 2",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use",151:"Quota exceeded",158:"Shared Subscriptions not supported",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"},u.MQTT5_UNSUBACK_CODES={0:"Success",17:"No subscription existed",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use"},u.MQTT5_DISCONNECT_CODES={0:"Normal disconnection",4:"Disconnect with Will Message",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",135:"Not authorized",137:"Server busy",139:"Server shutting down",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",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"},u.MQTT5_AUTH_CODES={0:"Success",24:"Continue authentication",25:"Re-authenticate"}},{buffer:29}],74:[function(n,o,a){const u=n("./writeToStream"),c=n("events"),{Buffer:d}=n("buffer");function f(y,g){const p=new h;return u(y,p,g),p.concat()}class h extends c{constructor(){super(),this._array=new Array(20),this._i=0}write(g){return this._array[this._i++]=g,!0}concat(){let g=0;const p=new Array(this._array.length),v=this._array;let _=0,b;for(b=0;b<v.length&&v[b]!==void 0;b++)typeof v[b]!="string"?p[b]=v[b].length:p[b]=d.byteLength(v[b]),g+=p[b];const A=d.allocUnsafe(g);for(b=0;b<v.length&&v[b]!==void 0;b++)typeof v[b]!="string"?(v[b].copy(A,_),_+=p[b]):(A.write(v[b],_),_+=p[b]);return A}destroy(g){g&&this.emit("error",g)}}o.exports=f},{"./writeToStream":96,buffer:29,events:49}],75:[function(n,o,a){a.parser=n("./parser").parser,a.generate=n("./generate"),a.writeToStream=n("./writeToStream")},{"./generate":74,"./parser":95,"./writeToStream":96}],76:[function(n,o,a){const{Buffer:u}=n("buffer"),c=Symbol.for("BufferList");function d(f){if(!(this instanceof d))return new d(f);d._init.call(this,f)}d._init=function(h){Object.defineProperty(this,c,{value:!0}),this._bufs=[],this.length=0,h&&this.append(h)},d.prototype._new=function(h){return new d(h)},d.prototype._offset=function(h){if(h===0)return[0,0];let y=0;for(let g=0;g<this._bufs.length;g++){const p=y+this._bufs[g].length;if(h<p||g===this._bufs.length-1)return[g,h-y];y=p}},d.prototype._reverseOffset=function(f){const h=f[0];let y=f[1];for(let g=0;g<h;g++)y+=this._bufs[g].length;return y},d.prototype.get=function(h){if(h>this.length||h<0)return;const y=this._offset(h);return this._bufs[y[0]][y[1]]},d.prototype.slice=function(h,y){return typeof h=="number"&&h<0&&(h+=this.length),typeof y=="number"&&y<0&&(y+=this.length),this.copy(null,0,h,y)},d.prototype.copy=function(h,y,g,p){if((typeof g!="number"||g<0)&&(g=0),(typeof p!="number"||p>this.length)&&(p=this.length),g>=this.length||p<=0)return h||u.alloc(0);const v=!!h,_=this._offset(g),b=p-g;let A=b,w=v&&y||0,T=_[1];if(g===0&&p===this.length){if(!v)return this._bufs.length===1?this._bufs[0]:u.concat(this._bufs,this.length);for(let S=0;S<this._bufs.length;S++)this._bufs[S].copy(h,w),w+=this._bufs[S].length;return h}if(A<=this._bufs[_[0]].length-T)return v?this._bufs[_[0]].copy(h,y,T,T+A):this._bufs[_[0]].slice(T,T+A);v||(h=u.allocUnsafe(b));for(let S=_[0];S<this._bufs.length;S++){const x=this._bufs[S].length-T;if(A>x)this._bufs[S].copy(h,w,T),w+=x;else{this._bufs[S].copy(h,w,T,T+A),w+=x;break}A-=x,T&&(T=0)}return h.length>w?h.slice(0,w):h},d.prototype.shallowSlice=function(h,y){if(h=h||0,y=typeof y!="number"?this.length:y,h<0&&(h+=this.length),y<0&&(y+=this.length),h===y)return this._new();const g=this._offset(h),p=this._offset(y),v=this._bufs.slice(g[0],p[0]+1);return p[1]===0?v.pop():v[v.length-1]=v[v.length-1].slice(0,p[1]),g[1]!==0&&(v[0]=v[0].slice(g[1])),this._new(v)},d.prototype.toString=function(h,y,g){return this.slice(y,g).toString(h)},d.prototype.consume=function(h){if(h=Math.trunc(h),Number.isNaN(h)||h<=0)return this;for(;this._bufs.length;)if(h>=this._bufs[0].length)h-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(h),this.length-=h;break}return this},d.prototype.duplicate=function(){const h=this._new();for(let y=0;y<this._bufs.length;y++)h.append(this._bufs[y]);return h},d.prototype.append=function(h){if(h==null)return this;if(h.buffer)this._appendBuffer(u.from(h.buffer,h.byteOffset,h.byteLength));else if(Array.isArray(h))for(let y=0;y<h.length;y++)this.append(h[y]);else if(this._isBufferList(h))for(let y=0;y<h._bufs.length;y++)this.append(h._bufs[y]);else typeof h=="number"&&(h=h.toString()),this._appendBuffer(u.from(h));return this},d.prototype._appendBuffer=function(h){this._bufs.push(h),this.length+=h.length},d.prototype.indexOf=function(f,h,y){if(y===void 0&&typeof h=="string"&&(y=h,h=void 0),typeof f=="function"||Array.isArray(f))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof f=="number"?f=u.from([f]):typeof f=="string"?f=u.from(f,y):this._isBufferList(f)?f=f.slice():Array.isArray(f.buffer)?f=u.from(f.buffer,f.byteOffset,f.byteLength):u.isBuffer(f)||(f=u.from(f)),h=Number(h||0),isNaN(h)&&(h=0),h<0&&(h=this.length+h),h<0&&(h=0),f.length===0)return h>this.length?this.length:h;const g=this._offset(h);let p=g[0],v=g[1];for(;p<this._bufs.length;p++){const _=this._bufs[p];for(;v<_.length;)if(_.length-v>=f.length){const A=_.indexOf(f,v);if(A!==-1)return this._reverseOffset([p,A]);v=_.length-f.length+1}else{const A=this._reverseOffset([p,v]);if(this._match(A,f))return A;v++}v=0}return-1},d.prototype._match=function(f,h){if(this.length-f<h.length)return!1;for(let y=0;y<h.length;y++)if(this.get(f+y)!==h[y])return!1;return!0},function(){const f={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 h in f)(function(y){f[y]===null?d.prototype[y]=function(g,p){return this.slice(g,g+p)[y](0,p)}:d.prototype[y]=function(g=0){return this.slice(g,g+f[y])[y](0)}})(h)}(),d.prototype._isBufferList=function(h){return h instanceof d||d.isBufferList(h)},d.isBufferList=function(h){return h!=null&&h[c]},o.exports=d},{buffer:29}],77:[function(n,o,a){const u=n("readable-stream").Duplex,c=n("inherits"),d=n("./BufferList");function f(h){if(!(this instanceof f))return new f(h);if(typeof h=="function"){this._callback=h;const y=(function(p){this._callback&&(this._callback(p),this._callback=null)}).bind(this);this.on("pipe",function(p){p.on("error",y)}),this.on("unpipe",function(p){p.removeListener("error",y)}),h=null}d._init.call(this,h),u.call(this)}c(f,u),Object.assign(f.prototype,d.prototype),f.prototype._new=function(y){return new f(y)},f.prototype._write=function(y,g,p){this._appendBuffer(y),typeof p=="function"&&p()},f.prototype._read=function(y){if(!this.length)return this.push(null);y=Math.min(y,this.length),this.push(this.slice(0,y)),this.consume(y)},f.prototype.end=function(y){u.prototype.end.call(this,y),this._callback&&(this._callback(null,this.slice()),this._callback=null)},f.prototype._destroy=function(y,g){this._bufs.length=0,this.length=0,g(y)},f.prototype._isBufferList=function(y){return y instanceof f||y instanceof d||f.isBufferList(y)},f.isBufferList=d.isBufferList,o.exports=f,o.exports.BufferListStream=f,o.exports.BufferList=d},{"./BufferList":76,inherits:51,"readable-stream":92}],78:[function(n,o,a){arguments[4][33][0].apply(a,arguments)},{dup:33}],79:[function(n,o,a){arguments[4][34][0].apply(a,arguments)},{"./_stream_readable":81,"./_stream_writable":83,_process:102,dup:34,inherits:51}],80:[function(n,o,a){arguments[4][35][0].apply(a,arguments)},{"./_stream_transform":82,dup:35,inherits:51}],81:[function(n,o,a){arguments[4][36][0].apply(a,arguments)},{"../errors":78,"./_stream_duplex":79,"./internal/streams/async_iterator":84,"./internal/streams/buffer_list":85,"./internal/streams/destroy":86,"./internal/streams/from":88,"./internal/streams/state":90,"./internal/streams/stream":91,_process:102,buffer:29,dup:36,events:49,inherits:51,"string_decoder/":136,util:26}],82:[function(n,o,a){arguments[4][37][0].apply(a,arguments)},{"../errors":78,"./_stream_duplex":79,dup:37,inherits:51}],83:[function(n,o,a){arguments[4][38][0].apply(a,arguments)},{"../errors":78,"./_stream_duplex":79,"./internal/streams/destroy":86,"./internal/streams/state":90,"./internal/streams/stream":91,_process:102,buffer:29,dup:38,inherits:51,"util-deprecate":139}],84:[function(n,o,a){arguments[4][39][0].apply(a,arguments)},{"./end-of-stream":87,_process:102,dup:39}],85:[function(n,o,a){arguments[4][40][0].apply(a,arguments)},{buffer:29,dup:40,util:26}],86:[function(n,o,a){arguments[4][41][0].apply(a,arguments)},{_process:102,dup:41}],87:[function(n,o,a){arguments[4][42][0].apply(a,arguments)},{"../../../errors":78,dup:42}],88:[function(n,o,a){arguments[4][43][0].apply(a,arguments)},{dup:43}],89:[function(n,o,a){arguments[4][44][0].apply(a,arguments)},{"../../../errors":78,"./end-of-stream":87,dup:44}],90:[function(n,o,a){arguments[4][45][0].apply(a,arguments)},{"../../../errors":78,dup:45}],91:[function(n,o,a){arguments[4][46][0].apply(a,arguments)},{dup:46,events:49}],92:[function(n,o,a){arguments[4][47][0].apply(a,arguments)},{"./lib/_stream_duplex.js":79,"./lib/_stream_passthrough.js":80,"./lib/_stream_readable.js":81,"./lib/_stream_transform.js":82,"./lib/_stream_writable.js":83,"./lib/internal/streams/end-of-stream.js":87,"./lib/internal/streams/pipeline.js":89,dup:47}],93:[function(n,o,a){const{Buffer:u}=n("buffer"),c=65536,d={},f=u.isBuffer(u.from([1,2]).subarray(0,1));function h(v){const _=u.allocUnsafe(2);return _.writeUInt8(v>>8,0),_.writeUInt8(v&255,0+1),_}function y(){for(let v=0;v<c;v++)d[v]=h(v)}function g(v){let b=0,A=0;const w=u.allocUnsafe(4);do b=v%128|0,v=v/128|0,v>0&&(b=b|128),w.writeUInt8(b,A++);while(v>0&&A<4);return v>0&&(A=0),f?w.subarray(0,A):w.slice(0,A)}function p(v){const _=u.allocUnsafe(4);return _.writeUInt32BE(v,0),_}o.exports={cache:d,generateCache:y,generateNumber:h,genBufVariableByteInt:g,generate4ByteBuffer:p}},{buffer:29}],94:[function(n,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},{}],95:[function(n,o,a){const u=n("bl"),c=n("events"),d=n("./packet"),f=n("./constants"),h=n("debug")("mqtt-packet:parser");class y extends c{constructor(){super(),this.parser=this.constructor.parser}static parser(p){return this instanceof y?(this.settings=p||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new y().parser(p)}_resetState(){h("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new d,this.error=null,this._list=u(),this._stateCounter=0}parse(p){for(this.error&&this._resetState(),this._list.append(p),h("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++,h("parse: state complete. _stateCounter is now: %d",this._stateCounter),h("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return h("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const p=this._list.readUInt8(0),v=p>>f.CMD_SHIFT;this.packet.cmd=f.types[v];const _=p&15,b=f.requiredHeaderFlags[v];return b!=null&&_!==b?this._emitError(new Error(f.requiredHeaderFlagsErrors[v])):(this.packet.retain=(p&f.RETAIN_MASK)!==0,this.packet.qos=p>>f.QOS_SHIFT&f.QOS_MASK,this.packet.qos>2?this._emitError(new Error("Packet must not have both QoS bits set to 1")):(this.packet.dup=(p&f.DUP_MASK)!==0,h("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0))}_parseLength(){const p=this._parseVarByteNum(!0);return p&&(this.packet.length=p.value,this._list.consume(p.bytes)),h("_parseLength %d",p.value),!!p}_parsePayload(){h("_parsePayload: payload %O",this._list);let p=!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"))}p=!0}return h("_parsePayload complete result: %s",p),p}_parseConnect(){h("_parseConnect");let p,v,_,b;const A={},w=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(w.protocolId=T,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(w.protocolVersion=this._list.readUInt8(this._pos),w.protocolVersion>=128&&(w.bridgeMode=!0,w.protocolVersion=w.protocolVersion-128),w.protocolVersion!==3&&w.protocolVersion!==4&&w.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(this._list.readUInt8(this._pos)&1)return this._emitError(new Error("Connect flag bit 0 must be 0, but got 1"));A.username=this._list.readUInt8(this._pos)&f.USERNAME_MASK,A.password=this._list.readUInt8(this._pos)&f.PASSWORD_MASK,A.will=this._list.readUInt8(this._pos)&f.WILL_FLAG_MASK;const S=!!(this._list.readUInt8(this._pos)&f.WILL_RETAIN_MASK),x=(this._list.readUInt8(this._pos)&f.WILL_QOS_MASK)>>f.WILL_QOS_SHIFT;if(A.will)w.will={},w.will.retain=S,w.will.qos=x;else{if(S)return this._emitError(new Error("Will Retain Flag must be set to zero when Will Flag is set to 0"));if(x)return this._emitError(new Error("Will QoS must be set to zero when Will Flag is set to 0"))}if(w.clean=(this._list.readUInt8(this._pos)&f.CLEAN_SESSION_MASK)!==0,this._pos++,w.keepalive=this._parseNum(),w.keepalive===-1)return this._emitError(new Error("Packet too short"));if(w.protocolVersion===5){const M=this._parseProperties();Object.getOwnPropertyNames(M).length&&(w.properties=M)}const L=this._parseString();if(L===null)return this._emitError(new Error("Packet too short"));if(w.clientId=L,h("_parseConnect: packet.clientId: %s",w.clientId),A.will){if(w.protocolVersion===5){const M=this._parseProperties();Object.getOwnPropertyNames(M).length&&(w.will.properties=M)}if(p=this._parseString(),p===null)return this._emitError(new Error("Cannot parse will topic"));if(w.will.topic=p,h("_parseConnect: packet.will.topic: %s",w.will.topic),v=this._parseBuffer(),v===null)return this._emitError(new Error("Cannot parse will payload"));w.will.payload=v,h("_parseConnect: packet.will.paylaod: %s",w.will.payload)}if(A.username){if(b=this._parseString(),b===null)return this._emitError(new Error("Cannot parse username"));w.username=b,h("_parseConnect: packet.username: %s",w.username)}if(A.password){if(_=this._parseBuffer(),_===null)return this._emitError(new Error("Cannot parse password"));w.password=_}return this.settings=w,h("_parseConnect: complete"),w}_parseConnack(){h("_parseConnack");const p=this.packet;if(this._list.length<1)return null;const v=this._list.readUInt8(this._pos++);if(v>1)return this._emitError(new Error("Invalid connack flags, bits 7-1 must be set to 0"));if(p.sessionPresent=!!(v&f.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?p.reasonCode=this._list.readUInt8(this._pos++):p.reasonCode=0;else{if(this._list.length<2)return null;p.returnCode=this._list.readUInt8(this._pos++)}if(p.returnCode===-1||p.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){const _=this._parseProperties();Object.getOwnPropertyNames(_).length&&(p.properties=_)}h("_parseConnack: complete")}_parsePublish(){h("_parsePublish");const p=this.packet;if(p.topic=this._parseString(),p.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(p.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(p.properties=v)}p.payload=this._list.slice(this._pos,p.length),h("_parsePublish: payload from buffer list: %o",p.payload)}}_parseSubscribe(){h("_parseSubscribe");const p=this.packet;let v,_,b,A,w,T,S;if(p.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const x=this._parseProperties();Object.getOwnPropertyNames(x).length&&(p.properties=x)}if(p.length<=0)return this._emitError(new Error("Malformed subscribe, no payload specified"));for(;this._pos<p.length;){if(v=this._parseString(),v===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=p.length)return this._emitError(new Error("Malformed Subscribe Payload"));if(_=this._parseByte(),this.settings.protocolVersion===5){if(_&192)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-6 must be 0"))}else if(_&252)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-2 must be 0"));if(b=_&f.SUBSCRIBE_OPTIONS_QOS_MASK,b>2)return this._emitError(new Error("Invalid subscribe QoS, must be <= 2"));if(T=(_>>f.SUBSCRIBE_OPTIONS_NL_SHIFT&f.SUBSCRIBE_OPTIONS_NL_MASK)!==0,w=(_>>f.SUBSCRIBE_OPTIONS_RAP_SHIFT&f.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,A=_>>f.SUBSCRIBE_OPTIONS_RH_SHIFT&f.SUBSCRIBE_OPTIONS_RH_MASK,A>2)return this._emitError(new Error("Invalid retain handling, must be <= 2"));S={topic:v,qos:b},this.settings.protocolVersion===5?(S.nl=T,S.rap=w,S.rh=A):this.settings.bridgeMode&&(S.rh=0,S.rap=!0,S.nl=!0),h("_parseSubscribe: push subscription `%s` to subscription",S),p.subscriptions.push(S)}}}_parseSuback(){h("_parseSuback");const p=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(p.properties=v)}if(p.length<=0)return this._emitError(new Error("Malformed suback, no payload specified"));for(;this._pos<this.packet.length;){const v=this._list.readUInt8(this._pos++);if(this.settings.protocolVersion===5){if(!f.MQTT5_SUBACK_CODES[v])return this._emitError(new Error("Invalid suback code"))}else if(v>2&&v!==128)return this._emitError(new Error("Invalid suback QoS, must be 0, 1, 2 or 128"));this.packet.granted.push(v)}}}_parseUnsubscribe(){h("_parseUnsubscribe");const p=this.packet;if(p.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(p.properties=v)}if(p.length<=0)return this._emitError(new Error("Malformed unsubscribe, no payload specified"));for(;this._pos<p.length;){const v=this._parseString();if(v===null)return this._emitError(new Error("Cannot parse topic"));h("_parseUnsubscribe: push topic `%s` to unsubscriptions",v),p.unsubscriptions.push(v)}}}_parseUnsuback(){h("_parseUnsuback");const p=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if((this.settings.protocolVersion===3||this.settings.protocolVersion===4)&&p.length!==2)return this._emitError(new Error("Malformed unsuback, payload length must be 2"));if(p.length<=0)return this._emitError(new Error("Malformed unsuback, no payload specified"));if(this.settings.protocolVersion===5){const v=this._parseProperties();for(Object.getOwnPropertyNames(v).length&&(p.properties=v),p.granted=[];this._pos<this.packet.length;){const _=this._list.readUInt8(this._pos++);if(!f.MQTT5_UNSUBACK_CODES[_])return this._emitError(new Error("Invalid unsuback code"));this.packet.granted.push(_)}}}_parseConfirmation(){h("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const p=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5){if(p.length>2){switch(p.reasonCode=this._parseByte(),this.packet.cmd){case"puback":case"pubrec":if(!f.MQTT5_PUBACK_PUBREC_CODES[p.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break;case"pubrel":case"pubcomp":if(!f.MQTT5_PUBREL_PUBCOMP_CODES[p.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break}h("_parseConfirmation: packet.reasonCode `%d`",p.reasonCode)}else p.reasonCode=0;if(p.length>3){const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(p.properties=v)}}return!0}_parseDisconnect(){const p=this.packet;if(h("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?(p.reasonCode=this._parseByte(),f.MQTT5_DISCONNECT_CODES[p.reasonCode]||this._emitError(new Error("Invalid disconnect reason code"))):p.reasonCode=0;const v=this._parseProperties();Object.getOwnPropertyNames(v).length&&(p.properties=v)}return h("_parseDisconnect result: true"),!0}_parseAuth(){h("_parseAuth");const p=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));if(p.reasonCode=this._parseByte(),!f.MQTT5_AUTH_CODES[p.reasonCode])return this._emitError(new Error("Invalid auth reason code"));const v=this._parseProperties();return Object.getOwnPropertyNames(v).length&&(p.properties=v),h("_parseAuth: result: true"),!0}_parseMessageId(){const p=this.packet;return p.messageId=this._parseNum(),p.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(h("_parseMessageId: packet.messageId %d",p.messageId),!0)}_parseString(p){const v=this._parseNum(),_=v+this._pos;if(v===-1||_>this._list.length||_>this.packet.length)return null;const b=this._list.toString("utf8",this._pos,_);return this._pos+=v,h("_parseString: result: %s",b),b}_parseStringPair(){return h("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const p=this._parseNum(),v=p+this._pos;if(p===-1||v>this._list.length||v>this.packet.length)return null;const _=this._list.slice(this._pos,v);return this._pos+=p,h("_parseBuffer: result: %o",_),_}_parseNum(){if(this._list.length-this._pos<2)return-1;const p=this._list.readUInt16BE(this._pos);return this._pos+=2,h("_parseNum: result: %s",p),p}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const p=this._list.readUInt32BE(this._pos);return this._pos+=4,h("_parse4ByteNum: result: %s",p),p}_parseVarByteNum(p){h("_parseVarByteNum");const v=4;let _=0,b=1,A=0,w=!1,T;const S=this._pos?this._pos:0;for(;_<v&&S+_<this._list.length;){if(T=this._list.readUInt8(S+_++),A+=b*(T&f.VARBYTEINT_MASK),b*=128,!(T&f.VARBYTEINT_FIN_MASK)){w=!0;break}if(this._list.length<=_)break}return!w&&_===v&&this._list.length>=_&&this._emitError(new Error("Invalid variable byte integer")),S&&(this._pos+=_),w?p?w={bytes:_,value:A}:w=A:w=!1,h("_parseVarByteNum: result: %o",w),w}_parseByte(){let p;return this._pos<this._list.length&&(p=this._list.readUInt8(this._pos),this._pos++),h("_parseByte: result: %o",p),p}_parseByType(p){switch(h("_parseByType: type: %s",p),p){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(){h("_parseProperties");const p=this._parseVarByteNum(),_=this._pos+p,b={};for(;this._pos<_;){const A=this._parseByte();if(!A)return this._emitError(new Error("Cannot parse property code type")),!1;const w=f.propertiesCodes[A];if(!w)return this._emitError(new Error("Unknown property")),!1;if(w==="userProperties"){b[w]||(b[w]=Object.create(null));const T=this._parseByType(f.propertiesTypes[w]);if(b[w][T.name])if(Array.isArray(b[w][T.name]))b[w][T.name].push(T.value);else{const S=b[w][T.name];b[w][T.name]=[S],b[w][T.name].push(T.value)}else b[w][T.name]=T.value;continue}b[w]?Array.isArray(b[w])?b[w].push(this._parseByType(f.propertiesTypes[w])):(b[w]=[b[w]],b[w].push(this._parseByType(f.propertiesTypes[w]))):b[w]=this._parseByType(f.propertiesTypes[w])}return b}_newPacket(){return h("_newPacket"),this.packet&&(this._list.consume(this.packet.length),h("_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)),h("_newPacket: new packet"),this.packet=new d,this._pos=0,!0}_emitError(p){h("_emitError",p),this.error=p,this.emit("error",p)}}o.exports=y},{"./constants":73,"./packet":94,bl:77,debug:30,events:49}],96:[function(n,o,a){const u=n("./constants"),{Buffer:c}=n("buffer"),d=c.allocUnsafe(0),f=c.from([0]),h=n("./numbers"),y=n("process-nextick-args").nextTick,g=n("debug")("mqtt-packet:writeToStream"),p=h.cache,v=h.generateNumber,_=h.generateCache,b=h.genBufVariableByteInt,A=h.generate4ByteBuffer;let w=_e,T=!0;function S(Ce,ue,$e){switch(g("generate called"),ue.cork&&(ue.cork(),y(x,ue)),T&&(T=!1,_()),g("generate: packet.cmd: %s",Ce.cmd),Ce.cmd){case"connect":return L(Ce,ue);case"connack":return M(Ce,ue,$e);case"publish":return O(Ce,ue,$e);case"puback":case"pubrec":case"pubrel":case"pubcomp":return ie(Ce,ue,$e);case"subscribe":return $(Ce,ue,$e);case"suback":return z(Ce,ue,$e);case"unsubscribe":return V(Ce,ue,$e);case"unsuback":return re(Ce,ue,$e);case"pingreq":case"pingresp":return F(Ce,ue);case"disconnect":return pe(Ce,ue,$e);case"auth":return le(Ce,ue,$e);default:return ue.destroy(new Error("Unknown command")),!1}}Object.defineProperty(S,"cacheNumbers",{get(){return w===_e},set(Ce){Ce?((!p||Object.keys(p).length===0)&&(T=!0),w=_e):(T=!1,w=qe)}});function x(Ce){Ce.uncork()}function L(Ce,ue,$e){const Ne=Ce||{},Oe=Ne.protocolId||"MQTT";let Lt=Ne.protocolVersion||4;const kt=Ne.will;let Cn=Ne.clean;const oe=Ne.keepalive||0,ae=Ne.clientId||"",Y=Ne.username,k=Ne.password,D=Ne.properties;Cn===void 0&&(Cn=!0);let j=0;if(!Oe||typeof Oe!="string"&&!c.isBuffer(Oe))return ue.destroy(new Error("Invalid protocolId")),!1;if(j+=Oe.length+2,Lt!==3&&Lt!==4&&Lt!==5)return ue.destroy(new Error("Invalid protocol version")),!1;if(j+=1,(typeof ae=="string"||c.isBuffer(ae))&&(ae||Lt>=4)&&(ae||Cn))j+=c.byteLength(ae)+2;else{if(Lt<4)return ue.destroy(new Error("clientId must be supplied before 3.1.1")),!1;if(Cn*1===0)return ue.destroy(new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof oe!="number"||oe<0||oe>65535||oe%1!==0)return ue.destroy(new Error("Invalid keepalive")),!1;j+=2,j+=1;let xe,hn;if(Lt===5){if(xe=Pt(ue,D),!xe)return!1;j+=xe.length}if(kt){if(typeof kt!="object")return ue.destroy(new Error("Invalid will")),!1;if(!kt.topic||typeof kt.topic!="string")return ue.destroy(new Error("Invalid will topic")),!1;if(j+=c.byteLength(kt.topic)+2,j+=2,kt.payload)if(kt.payload.length>=0)typeof kt.payload=="string"?j+=c.byteLength(kt.payload):j+=kt.payload.length;else return ue.destroy(new Error("Invalid will payload")),!1;if(hn={},Lt===5){if(hn=Pt(ue,kt.properties),!hn)return!1;j+=hn.length}}let _n=!1;if(Y!=null)if(Et(Y))_n=!0,j+=c.byteLength(Y)+2;else return ue.destroy(new Error("Invalid username")),!1;if(k!=null){if(!_n)return ue.destroy(new Error("Username is required to use password")),!1;if(Et(k))j+=jt(k)+2;else return ue.destroy(new Error("Invalid password")),!1}ue.write(u.CONNECT_HEADER),Fe(ue,j),vn(ue,Oe),Ne.bridgeMode&&(Lt+=128),ue.write(Lt===131?u.VERSION131:Lt===132?u.VERSION132:Lt===4?u.VERSION4:Lt===5?u.VERSION5:u.VERSION3);let Sn=0;return Sn|=Y!=null?u.USERNAME_MASK:0,Sn|=k!=null?u.PASSWORD_MASK:0,Sn|=kt&&kt.retain?u.WILL_RETAIN_MASK:0,Sn|=kt&&kt.qos?kt.qos<<u.WILL_QOS_SHIFT:0,Sn|=kt?u.WILL_FLAG_MASK:0,Sn|=Cn?u.CLEAN_SESSION_MASK:0,ue.write(c.from([Sn])),w(ue,oe),Lt===5&&xe.write(),vn(ue,ae),kt&&(Lt===5&&hn.write(),Ie(ue,kt.topic),vn(ue,kt.payload)),Y!=null&&vn(ue,Y),k!=null&&vn(ue,k),!0}function M(Ce,ue,$e){const Ne=$e?$e.protocolVersion:4,Oe=Ce||{},Lt=Ne===5?Oe.reasonCode:Oe.returnCode,kt=Oe.properties;let Cn=2;if(typeof Lt!="number")return ue.destroy(new Error("Invalid return code")),!1;let oe=null;if(Ne===5){if(oe=Pt(ue,kt),!oe)return!1;Cn+=oe.length}return ue.write(u.CONNACK_HEADER),Fe(ue,Cn),ue.write(Oe.sessionPresent?u.SESSIONPRESENT_HEADER:f),ue.write(c.from([Lt])),oe!=null&&oe.write(),!0}function O(Ce,ue,$e){g("publish: packet: %o",Ce);const Ne=$e?$e.protocolVersion:4,Oe=Ce||{},Lt=Oe.qos||0,kt=Oe.retain?u.RETAIN_MASK:0,Cn=Oe.topic,oe=Oe.payload||d,ae=Oe.messageId,Y=Oe.properties;let k=0;if(typeof Cn=="string")k+=c.byteLength(Cn)+2;else if(c.isBuffer(Cn))k+=Cn.length+2;else return ue.destroy(new Error("Invalid topic")),!1;if(c.isBuffer(oe)?k+=oe.length:k+=c.byteLength(oe),Lt&&typeof ae!="number")return ue.destroy(new Error("Invalid messageId")),!1;Lt&&(k+=2);let D=null;if(Ne===5){if(D=Pt(ue,Y),!D)return!1;k+=D.length}return ue.write(u.PUBLISH_HEADER[Lt][Oe.dup?1:0][kt?1:0]),Fe(ue,k),w(ue,jt(Cn)),ue.write(Cn),Lt>0&&w(ue,ae),D!=null&&D.write(),g("publish: payload: %o",oe),ue.write(oe)}function ie(Ce,ue,$e){const Ne=$e?$e.protocolVersion:4,Oe=Ce||{},Lt=Oe.cmd||"puback",kt=Oe.messageId,Cn=Oe.dup&&Lt==="pubrel"?u.DUP_MASK:0;let oe=0;const ae=Oe.reasonCode,Y=Oe.properties;let k=Ne===5?3:2;if(Lt==="pubrel"&&(oe=1),typeof kt!="number")return ue.destroy(new Error("Invalid messageId")),!1;let D=null;if(Ne===5&&typeof Y=="object"){if(D=he(ue,Y,$e,k),!D)return!1;k+=D.length}return ue.write(u.ACKS[Lt][oe][Cn][0]),k===3&&(k+=ae!==0?1:-1),Fe(ue,k),w(ue,kt),Ne===5&&k!==2&&ue.write(c.from([ae])),D!==null?D.write():k===4&&ue.write(c.from([0])),!0}function $(Ce,ue,$e){g("subscribe: packet: ");const Ne=$e?$e.protocolVersion:4,Oe=Ce||{},Lt=Oe.dup?u.DUP_MASK:0,kt=Oe.messageId,Cn=Oe.subscriptions,oe=Oe.properties;let ae=0;if(typeof kt!="number")return ue.destroy(new Error("Invalid messageId")),!1;ae+=2;let Y=null;if(Ne===5){if(Y=Pt(ue,oe),!Y)return!1;ae+=Y.length}if(typeof Cn=="object"&&Cn.length)for(let D=0;D<Cn.length;D+=1){const j=Cn[D].topic,xe=Cn[D].qos;if(typeof j!="string")return ue.destroy(new Error("Invalid subscriptions - invalid topic")),!1;if(typeof xe!="number")return ue.destroy(new Error("Invalid subscriptions - invalid qos")),!1;if(Ne===5){if(typeof(Cn[D].nl||!1)!="boolean")return ue.destroy(new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(Cn[D].rap||!1)!="boolean")return ue.destroy(new Error("Invalid subscriptions - invalid Retain as Published")),!1;const Sn=Cn[D].rh||0;if(typeof Sn!="number"||Sn>2)return ue.destroy(new Error("Invalid subscriptions - invalid Retain Handling")),!1}ae+=c.byteLength(j)+2+1}else return ue.destroy(new Error("Invalid subscriptions")),!1;g("subscribe: writing to stream: %o",u.SUBSCRIBE_HEADER),ue.write(u.SUBSCRIBE_HEADER[1][Lt?1:0][0]),Fe(ue,ae),w(ue,kt),Y!==null&&Y.write();let k=!0;for(const D of Cn){const j=D.topic,xe=D.qos,hn=+D.nl,_n=+D.rap,Sn=D.rh;let xn;Ie(ue,j),xn=u.SUBSCRIBE_OPTIONS_QOS[xe],Ne===5&&(xn|=hn?u.SUBSCRIBE_OPTIONS_NL:0,xn|=_n?u.SUBSCRIBE_OPTIONS_RAP:0,xn|=Sn?u.SUBSCRIBE_OPTIONS_RH[Sn]:0),k=ue.write(c.from([xn]))}return k}function z(Ce,ue,$e){const Ne=$e?$e.protocolVersion:4,Oe=Ce||{},Lt=Oe.messageId,kt=Oe.granted,Cn=Oe.properties;let oe=0;if(typeof Lt!="number")return ue.destroy(new Error("Invalid messageId")),!1;if(oe+=2,typeof kt=="object"&&kt.length)for(let Y=0;Y<kt.length;Y+=1){if(typeof kt[Y]!="number")return ue.destroy(new Error("Invalid qos vector")),!1;oe+=1}else return ue.destroy(new Error("Invalid qos vector")),!1;let ae=null;if(Ne===5){if(ae=he(ue,Cn,$e,oe),!ae)return!1;oe+=ae.length}return ue.write(u.SUBACK_HEADER),Fe(ue,oe),w(ue,Lt),ae!==null&&ae.write(),ue.write(c.from(kt))}function V(Ce,ue,$e){const Ne=$e?$e.protocolVersion:4,Oe=Ce||{},Lt=Oe.messageId,kt=Oe.dup?u.DUP_MASK:0,Cn=Oe.unsubscriptions,oe=Oe.properties;let ae=0;if(typeof Lt!="number")return ue.destroy(new Error("Invalid messageId")),!1;if(ae+=2,typeof Cn=="object"&&Cn.length)for(let D=0;D<Cn.length;D+=1){if(typeof Cn[D]!="string")return ue.destroy(new Error("Invalid unsubscriptions")),!1;ae+=c.byteLength(Cn[D])+2}else return ue.destroy(new Error("Invalid unsubscriptions")),!1;let Y=null;if(Ne===5){if(Y=Pt(ue,oe),!Y)return!1;ae+=Y.length}ue.write(u.UNSUBSCRIBE_HEADER[1][kt?1:0][0]),Fe(ue,ae),w(ue,Lt),Y!==null&&Y.write();let k=!0;for(let D=0;D<Cn.length;D++)k=Ie(ue,Cn[D]);return k}function re(Ce,ue,$e){const Ne=$e?$e.protocolVersion:4,Oe=Ce||{},Lt=Oe.messageId,kt=Oe.dup?u.DUP_MASK:0,Cn=Oe.granted,oe=Oe.properties,ae=Oe.cmd,Y=0;let k=2;if(typeof Lt!="number")return ue.destroy(new Error("Invalid messageId")),!1;if(Ne===5)if(typeof Cn=="object"&&Cn.length)for(let j=0;j<Cn.length;j+=1){if(typeof Cn[j]!="number")return ue.destroy(new Error("Invalid qos vector")),!1;k+=1}else return ue.destroy(new Error("Invalid qos vector")),!1;let D=null;if(Ne===5){if(D=he(ue,oe,$e,k),!D)return!1;k+=D.length}return ue.write(u.ACKS[ae][Y][kt][0]),Fe(ue,k),w(ue,Lt),D!==null&&D.write(),Ne===5&&ue.write(c.from(Cn)),!0}function F(Ce,ue,$e){return ue.write(u.EMPTY[Ce.cmd])}function pe(Ce,ue,$e){const Ne=$e?$e.protocolVersion:4,Oe=Ce||{},Lt=Oe.reasonCode,kt=Oe.properties;let Cn=Ne===5?1:0,oe=null;if(Ne===5){if(oe=he(ue,kt,$e,Cn),!oe)return!1;Cn+=oe.length}return ue.write(c.from([u.codes.disconnect<<4])),Fe(ue,Cn),Ne===5&&ue.write(c.from([Lt])),oe!==null&&oe.write(),!0}function le(Ce,ue,$e){const Ne=$e?$e.protocolVersion:4,Oe=Ce||{},Lt=Oe.reasonCode,kt=Oe.properties;let Cn=Ne===5?1:0;Ne!==5&&ue.destroy(new Error("Invalid mqtt version for auth packet"));const oe=he(ue,kt,$e,Cn);return oe?(Cn+=oe.length,ue.write(c.from([u.codes.auth<<4])),Fe(ue,Cn),ue.write(c.from([Lt])),oe!==null&&oe.write(),!0):!1}const de={};function Fe(Ce,ue){if(ue>u.VARBYTEINT_MAX)return Ce.destroy(new Error(`Invalid variable byte integer: ${ue}`)),!1;let $e=de[ue];return $e||($e=b(ue),ue<16384&&(de[ue]=$e)),g("writeVarByteInt: writing to stream: %o",$e),Ce.write($e)}function Ie(Ce,ue){const $e=c.byteLength(ue);return w(Ce,$e),g("writeString: %s",ue),Ce.write(ue,"utf8")}function At(Ce,ue,$e){Ie(Ce,ue),Ie(Ce,$e)}function _e(Ce,ue){return g("writeNumberCached: number: %d",ue),g("writeNumberCached: %o",p[ue]),Ce.write(p[ue])}function qe(Ce,ue){const $e=v(ue);return g("writeNumberGenerated: %o",$e),Ce.write($e)}function In(Ce,ue){const $e=A(ue);return g("write4ByteNumber: %o",$e),Ce.write($e)}function vn(Ce,ue){typeof ue=="string"?Ie(Ce,ue):ue?(w(Ce,ue.length),Ce.write(ue)):w(Ce,0)}function Pt(Ce,ue){if(typeof ue!="object"||ue.length!=null)return{length:1,write(){Dt(Ce,{},0)}};let $e=0;function Ne(Lt,kt){const Cn=u.propertiesTypes[Lt];let oe=0;switch(Cn){case"byte":{if(typeof kt!="boolean")return Ce.destroy(new Error(`Invalid ${Lt}: ${kt}`)),!1;oe+=1+1;break}case"int8":{if(typeof kt!="number"||kt<0||kt>255)return Ce.destroy(new Error(`Invalid ${Lt}: ${kt}`)),!1;oe+=1+1;break}case"binary":{if(kt&&kt===null)return Ce.destroy(new Error(`Invalid ${Lt}: ${kt}`)),!1;oe+=1+c.byteLength(kt)+2;break}case"int16":{if(typeof kt!="number"||kt<0||kt>65535)return Ce.destroy(new Error(`Invalid ${Lt}: ${kt}`)),!1;oe+=1+2;break}case"int32":{if(typeof kt!="number"||kt<0||kt>4294967295)return Ce.destroy(new Error(`Invalid ${Lt}: ${kt}`)),!1;oe+=1+4;break}case"var":{if(typeof kt!="number"||kt<0||kt>268435455)return Ce.destroy(new Error(`Invalid ${Lt}: ${kt}`)),!1;oe+=1+c.byteLength(b(kt));break}case"string":{if(typeof kt!="string")return Ce.destroy(new Error(`Invalid ${Lt}: ${kt}`)),!1;oe+=1+2+c.byteLength(kt.toString());break}case"pair":{if(typeof kt!="object")return Ce.destroy(new Error(`Invalid ${Lt}: ${kt}`)),!1;oe+=Object.getOwnPropertyNames(kt).reduce((ae,Y)=>{const k=kt[Y];return Array.isArray(k)?ae+=k.reduce((D,j)=>(D+=1+2+c.byteLength(Y.toString())+2+c.byteLength(j.toString()),D),0):ae+=1+2+c.byteLength(Y.toString())+2+c.byteLength(kt[Y].toString()),ae},0);break}default:return Ce.destroy(new Error(`Invalid property ${Lt}: ${kt}`)),!1}return oe}if(ue)for(const Lt in ue){let kt=0,Cn=0;const oe=ue[Lt];if(Array.isArray(oe))for(let ae=0;ae<oe.length;ae++){if(Cn=Ne(Lt,oe[ae]),!Cn)return!1;kt+=Cn}else{if(Cn=Ne(Lt,oe),!Cn)return!1;kt=Cn}if(!kt)return!1;$e+=kt}return{length:c.byteLength(b($e))+$e,write(){Dt(Ce,ue,$e)}}}function he(Ce,ue,$e,Ne){const Oe=["reasonString","userProperties"],Lt=$e&&$e.properties&&$e.properties.maximumPacketSize?$e.properties.maximumPacketSize:0;let kt=Pt(Ce,ue);if(Lt)for(;Ne+kt.length>Lt;){const Cn=Oe.shift();if(Cn&&ue[Cn])delete ue[Cn],kt=Pt(Ce,ue);else return!1}return kt}function Ue(Ce,ue,$e){switch(u.propertiesTypes[ue]){case"byte":{Ce.write(c.from([u.properties[ue]])),Ce.write(c.from([+$e]));break}case"int8":{Ce.write(c.from([u.properties[ue]])),Ce.write(c.from([$e]));break}case"binary":{Ce.write(c.from([u.properties[ue]])),vn(Ce,$e);break}case"int16":{Ce.write(c.from([u.properties[ue]])),w(Ce,$e);break}case"int32":{Ce.write(c.from([u.properties[ue]])),In(Ce,$e);break}case"var":{Ce.write(c.from([u.properties[ue]])),Fe(Ce,$e);break}case"string":{Ce.write(c.from([u.properties[ue]])),Ie(Ce,$e);break}case"pair":{Object.getOwnPropertyNames($e).forEach(Oe=>{const Lt=$e[Oe];Array.isArray(Lt)?Lt.forEach(kt=>{Ce.write(c.from([u.properties[ue]])),At(Ce,Oe.toString(),kt.toString())}):(Ce.write(c.from([u.properties[ue]])),At(Ce,Oe.toString(),Lt.toString()))});break}default:return Ce.destroy(new Error(`Invalid property ${ue} value: ${$e}`)),!1}}function Dt(Ce,ue,$e){Fe(Ce,$e);for(const Ne in ue)if(Object.prototype.hasOwnProperty.call(ue,Ne)&&ue[Ne]!==null){const Oe=ue[Ne];if(Array.isArray(Oe))for(let Lt=0;Lt<Oe.length;Lt++)Ue(Ce,Ne,Oe[Lt]);else Ue(Ce,Ne,Oe)}}function jt(Ce){return Ce?Ce instanceof c?Ce.length:c.byteLength(Ce):0}function Et(Ce){return typeof Ce=="string"||Ce instanceof c}o.exports=S},{"./constants":73,"./numbers":93,buffer:29,debug:30,"process-nextick-args":101}],97:[function(n,o,a){var u=1e3,c=u*60,d=c*60,f=d*24,h=f*7,y=f*365.25;o.exports=function(b,A){A=A||{};var w=typeof b;if(w==="string"&&b.length>0)return g(b);if(w==="number"&&isFinite(b))return A.long?v(b):p(b);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(b))};function g(b){if(b=String(b),!(b.length>100)){var A=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(b);if(A){var w=parseFloat(A[1]),T=(A[2]||"ms").toLowerCase();switch(T){case"years":case"year":case"yrs":case"yr":case"y":return w*y;case"weeks":case"week":case"w":return w*h;case"days":case"day":case"d":return w*f;case"hours":case"hour":case"hrs":case"hr":case"h":return w*d;case"minutes":case"minute":case"mins":case"min":case"m":return w*c;case"seconds":case"second":case"secs":case"sec":case"s":return w*u;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return w;default:return}}}}function p(b){var A=Math.abs(b);return A>=f?Math.round(b/f)+"d":A>=d?Math.round(b/d)+"h":A>=c?Math.round(b/c)+"m":A>=u?Math.round(b/u)+"s":b+"ms"}function v(b){var A=Math.abs(b);return A>=f?_(b,A,f,"day"):A>=d?_(b,A,d,"hour"):A>=c?_(b,A,c,"minute"):A>=u?_(b,A,u,"second"):b+" ms"}function _(b,A,w,T){var S=A>=w*1.5;return Math.round(b/w)+" "+T+(S?"s":"")}},{}],98:[function(n,o,a){const u=n("./lib/number-allocator.js");o.exports.NumberAllocator=u},{"./lib/number-allocator.js":99}],99:[function(n,o,a){const u=n("js-sdsl").OrderedSet,c=n("debug")("number-allocator:trace"),d=n("debug")("number-allocator:error");function f(y,g){this.low=y,this.high=g}f.prototype.equals=function(y){return this.low===y.low&&this.high===y.high},f.prototype.compare=function(y){return this.low<y.low&&this.high<y.low?-1:y.low<this.low&&y.high<this.low?1:0};function h(y,g){if(!(this instanceof h))return new h(y,g);this.min=y,this.max=g,this.ss=new u([],(p,v)=>p.compare(v)),c("Create"),this.clear()}h.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},h.prototype.alloc=function(){if(this.ss.size()===0)return c("alloc():empty"),null;const y=this.ss.begin(),g=y.pointer.low,p=y.pointer.high,v=g;return v+1<=p?this.ss.updateKeyByIterator(y,new f(g+1,p)):this.ss.eraseElementByPos(0),c("alloc():"+v),v},h.prototype.use=function(y){const g=new f(y,y),p=this.ss.lowerBound(g);if(!p.equals(this.ss.end())){const v=p.pointer.low,_=p.pointer.high;return p.pointer.equals(g)?(this.ss.eraseElementByIterator(p),c("use():"+y),!0):v>y?!1:v===y?(this.ss.updateKeyByIterator(p,new f(v+1,_)),c("use():"+y),!0):_===y?(this.ss.updateKeyByIterator(p,new f(v,_-1)),c("use():"+y),!0):(this.ss.updateKeyByIterator(p,new f(y+1,_)),this.ss.insert(new f(v,y-1)),c("use():"+y),!0)}return c("use():failed"),!1},h.prototype.free=function(y){if(y<this.min||y>this.max){d("free():"+y+" is out of range");return}const g=new f(y,y),p=this.ss.upperBound(g);if(p.equals(this.ss.end())){if(p.equals(this.ss.begin())){this.ss.insert(g);return}p.pre();const v=p.pointer.high;p.pointer.high+1===y?this.ss.updateKeyByIterator(p,new f(v,y)):this.ss.insert(g)}else if(p.equals(this.ss.begin()))if(y+1===p.pointer.low){const v=p.pointer.high;this.ss.updateKeyByIterator(p,new f(y,v))}else this.ss.insert(g);else{const v=p.pointer.low,_=p.pointer.high;p.pre();const b=p.pointer.low;p.pointer.high+1===y?y+1===v?(this.ss.eraseElementByIterator(p),this.ss.updateKeyByIterator(p,new f(b,_))):this.ss.updateKeyByIterator(p,new f(b,y)):y+1===v?(this.ss.eraseElementByIterator(p.next()),this.ss.insert(new f(y,_))):this.ss.insert(g)}c("free():"+y)},h.prototype.clear=function(){c("clear()"),this.ss.clear(),this.ss.insert(new f(this.min,this.max))},h.prototype.intervalCount=function(){return this.ss.size()},h.prototype.dump=function(){console.log("length:"+this.ss.size());for(const y of this.ss)console.log(y)},o.exports=h},{debug:30,"js-sdsl":69}],100:[function(n,o,a){var u=n("wrappy");o.exports=u(c),o.exports.strict=u(d),c.proto=c(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return c(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return d(this)},configurable:!0})});function c(f){var h=function(){return h.called?h.value:(h.called=!0,h.value=f.apply(this,arguments))};return h.called=!1,h}function d(f){var h=function(){if(h.called)throw new Error(h.onceError);return h.called=!0,h.value=f.apply(this,arguments)},y=f.name||"Function wrapped with `once`";return h.onceError=y+" shouldn't be called more than once",h.called=!1,h}},{wrappy:140}],101:[function(n,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(d,f,h,y){if(typeof d!="function")throw new TypeError('"callback" argument must be a function');var g=arguments.length,p,v;switch(g){case 0:case 1:return u.nextTick(d);case 2:return u.nextTick(function(){d.call(null,f)});case 3:return u.nextTick(function(){d.call(null,f,h)});case 4:return u.nextTick(function(){d.call(null,f,h,y)});default:for(p=new Array(g-1),v=0;v<p.length;)p[v++]=arguments[v];return u.nextTick(function(){d.apply(null,p)})}}}).call(this)}).call(this,n("_process"))},{_process:102}],102:[function(n,o,a){var u=o.exports={},c,d;function f(){throw new Error("setTimeout has not been defined")}function h(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?c=setTimeout:c=f}catch{c=f}try{typeof clearTimeout=="function"?d=clearTimeout:d=h}catch{d=h}})();function y(x){if(c===setTimeout)return setTimeout(x,0);if((c===f||!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(d===clearTimeout)return clearTimeout(x);if((d===h||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(x);try{return d(x)}catch{try{return d.call(null,x)}catch{return d.call(this,x)}}}var p=[],v=!1,_,b=-1;function A(){!v||!_||(v=!1,_.length?p=_.concat(p):b=-1,p.length&&w())}function w(){if(!v){var x=y(A);v=!0;for(var L=p.length;L;){for(_=p,p=[];++b<L;)_&&_[b].run();b=-1,L=p.length}_=null,v=!1,g(x)}}u.nextTick=function(x){var L=new Array(arguments.length-1);if(arguments.length>1)for(var M=1;M<arguments.length;M++)L[M-1]=arguments[M];p.push(new T(x,L)),p.length===1&&!v&&y(w)};function T(x,L){this.fun=x,this.array=L}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 S(){}u.on=S,u.addListener=S,u.once=S,u.off=S,u.removeListener=S,u.removeAllListeners=S,u.emit=S,u.prependListener=S,u.prependOnceListener=S,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}},{}],103:[function(n,o,a){(function(u){(function(){(function(c){var d=typeof a=="object"&&a&&!a.nodeType&&a,f=typeof o=="object"&&o&&!o.nodeType&&o,h=typeof u=="object"&&u;(h.global===h||h.window===h||h.self===h)&&(c=h);var y,g=2147483647,p=36,v=1,_=26,b=38,A=700,w=72,T=128,S="-",x=/^xn--/,L=/[^\x20-\x7E]/,M=/[\x2E\u3002\uFF0E\uFF61]/g,O={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ie=p-v,$=Math.floor,z=String.fromCharCode,V;function re(Pt){throw new RangeError(O[Pt])}function F(Pt,he){for(var Ue=Pt.length,Dt=[];Ue--;)Dt[Ue]=he(Pt[Ue]);return Dt}function pe(Pt,he){var Ue=Pt.split("@"),Dt="";Ue.length>1&&(Dt=Ue[0]+"@",Pt=Ue[1]),Pt=Pt.replace(M,".");var jt=Pt.split("."),Et=F(jt,he).join(".");return Dt+Et}function le(Pt){for(var he=[],Ue=0,Dt=Pt.length,jt,Et;Ue<Dt;)jt=Pt.charCodeAt(Ue++),jt>=55296&&jt<=56319&&Ue<Dt?(Et=Pt.charCodeAt(Ue++),(Et&64512)==56320?he.push(((jt&1023)<<10)+(Et&1023)+65536):(he.push(jt),Ue--)):he.push(jt);return he}function de(Pt){return F(Pt,function(he){var Ue="";return he>65535&&(he-=65536,Ue+=z(he>>>10&1023|55296),he=56320|he&1023),Ue+=z(he),Ue}).join("")}function Fe(Pt){return Pt-48<10?Pt-22:Pt-65<26?Pt-65:Pt-97<26?Pt-97:p}function Ie(Pt,he){return Pt+22+75*(Pt<26)-((he!=0)<<5)}function At(Pt,he,Ue){var Dt=0;for(Pt=Ue?$(Pt/A):Pt>>1,Pt+=$(Pt/he);Pt>ie*_>>1;Dt+=p)Pt=$(Pt/ie);return $(Dt+(ie+1)*Pt/(Pt+b))}function _e(Pt){var he=[],Ue=Pt.length,Dt,jt=0,Et=T,Ce=w,ue,$e,Ne,Oe,Lt,kt,Cn,oe,ae;for(ue=Pt.lastIndexOf(S),ue<0&&(ue=0),$e=0;$e<ue;++$e)Pt.charCodeAt($e)>=128&&re("not-basic"),he.push(Pt.charCodeAt($e));for(Ne=ue>0?ue+1:0;Ne<Ue;){for(Oe=jt,Lt=1,kt=p;Ne>=Ue&&re("invalid-input"),Cn=Fe(Pt.charCodeAt(Ne++)),(Cn>=p||Cn>$((g-jt)/Lt))&&re("overflow"),jt+=Cn*Lt,oe=kt<=Ce?v:kt>=Ce+_?_:kt-Ce,!(Cn<oe);kt+=p)ae=p-oe,Lt>$(g/ae)&&re("overflow"),Lt*=ae;Dt=he.length+1,Ce=At(jt-Oe,Dt,Oe==0),$(jt/Dt)>g-Et&&re("overflow"),Et+=$(jt/Dt),jt%=Dt,he.splice(jt++,0,Et)}return de(he)}function qe(Pt){var he,Ue,Dt,jt,Et,Ce,ue,$e,Ne,Oe,Lt,kt=[],Cn,oe,ae,Y;for(Pt=le(Pt),Cn=Pt.length,he=T,Ue=0,Et=w,Ce=0;Ce<Cn;++Ce)Lt=Pt[Ce],Lt<128&&kt.push(z(Lt));for(Dt=jt=kt.length,jt&&kt.push(S);Dt<Cn;){for(ue=g,Ce=0;Ce<Cn;++Ce)Lt=Pt[Ce],Lt>=he&&Lt<ue&&(ue=Lt);for(oe=Dt+1,ue-he>$((g-Ue)/oe)&&re("overflow"),Ue+=(ue-he)*oe,he=ue,Ce=0;Ce<Cn;++Ce)if(Lt=Pt[Ce],Lt<he&&++Ue>g&&re("overflow"),Lt==he){for($e=Ue,Ne=p;Oe=Ne<=Et?v:Ne>=Et+_?_:Ne-Et,!($e<Oe);Ne+=p)Y=$e-Oe,ae=p-Oe,kt.push(z(Ie(Oe+Y%ae,0))),$e=$(Y/ae);kt.push(z(Ie($e,0))),Et=At(Ue,oe,Dt==jt),Ue=0,++Dt}++Ue,++he}return kt.join("")}function In(Pt){return pe(Pt,function(he){return x.test(he)?_e(he.slice(4).toLowerCase()):he})}function vn(Pt){return pe(Pt,function(he){return L.test(he)?"xn--"+qe(he):he})}if(y={version:"1.4.1",ucs2:{decode:le,encode:de},decode:_e,encode:qe,toASCII:vn,toUnicode:In},d&&f)if(o.exports==d)f.exports=y;else for(V in y)y.hasOwnProperty(V)&&(d[V]=y[V]);else c.punycode=y})(this)}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],104:[function(n,o,a){function u(d,f){return Object.prototype.hasOwnProperty.call(d,f)}o.exports=function(d,f,h,y){f=f||"&",h=h||"=";var g={};if(typeof d!="string"||d.length===0)return g;var p=/\+/g;d=d.split(f);var v=1e3;y&&typeof y.maxKeys=="number"&&(v=y.maxKeys);var _=d.length;v>0&&_>v&&(_=v);for(var b=0;b<_;++b){var A=d[b].replace(p,"%20"),w=A.indexOf(h),T,S,x,L;w>=0?(T=A.substr(0,w),S=A.substr(w+1)):(T=A,S=""),x=decodeURIComponent(T),L=decodeURIComponent(S),u(g,x)?c(g[x])?g[x].push(L):g[x]=[g[x],L]:g[x]=L}return g};var c=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"}},{}],105:[function(n,o,a){var u=function(h){switch(typeof h){case"string":return h;case"boolean":return h?"true":"false";case"number":return isFinite(h)?h:"";default:return""}};o.exports=function(h,y,g,p){return y=y||"&",g=g||"=",h===null&&(h=void 0),typeof h=="object"?d(f(h),function(v){var _=encodeURIComponent(u(v))+g;return c(h[v])?d(h[v],function(b){return _+encodeURIComponent(u(b))}).join(y):_+encodeURIComponent(u(h[v]))}).join(y):p?encodeURIComponent(u(p))+g+encodeURIComponent(u(h)):""};var c=Array.isArray||function(h){return Object.prototype.toString.call(h)==="[object Array]"};function d(h,y){if(h.map)return h.map(y);for(var g=[],p=0;p<h.length;p++)g.push(y(h[p],p));return g}var f=Object.keys||function(h){var y=[];for(var g in h)Object.prototype.hasOwnProperty.call(h,g)&&y.push(g);return y}},{}],106:[function(n,o,a){a.decode=a.parse=n("./decode"),a.encode=a.stringify=n("./encode")},{"./decode":104,"./encode":105}],107:[function(n,o,a){const{AbortError:u,codes:c}=n("../../ours/errors"),{isNodeStream:d,isWebStream:f,kControllerErrorFunction:h}=n("./utils"),y=n("./end-of-stream"),{ERR_INVALID_ARG_TYPE:g}=c,p=(v,_)=>{if(typeof v!="object"||!("aborted"in v))throw new g(_,"AbortSignal",v)};o.exports.addAbortSignal=function(_,b){if(p(_,"signal"),!d(b)&&!f(b))throw new g("stream",["ReadableStream","WritableStream","Stream"],b);return o.exports.addAbortSignalNoValidate(_,b)},o.exports.addAbortSignalNoValidate=function(v,_){if(typeof v!="object"||!("aborted"in v))return _;const b=d(_)?()=>{_.destroy(new u(void 0,{cause:v.reason}))}:()=>{_[h](new u(void 0,{cause:v.reason}))};return v.aborted?b():(v.addEventListener("abort",b),y(_,()=>v.removeEventListener("abort",b))),_}},{"../../ours/errors":126,"./end-of-stream":113,"./utils":122}],108:[function(n,o,a){const{StringPrototypeSlice:u,SymbolIterator:c,TypedArrayPrototypeSet:d,Uint8Array:f}=n("../../ours/primordials"),{Buffer:h}=n("buffer"),{inspect:y}=n("../../ours/util");o.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(p){const v={data:p,next:null};this.length>0?this.tail.next=v:this.head=v,this.tail=v,++this.length}unshift(p){const v={data:p,next:this.head};this.length===0&&(this.tail=v),this.head=v,++this.length}shift(){if(this.length===0)return;const p=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,p}clear(){this.head=this.tail=null,this.length=0}join(p){if(this.length===0)return"";let v=this.head,_=""+v.data;for(;(v=v.next)!==null;)_+=p+v.data;return _}concat(p){if(this.length===0)return h.alloc(0);const v=h.allocUnsafe(p>>>0);let _=this.head,b=0;for(;_;)d(v,_.data,b),b+=_.data.length,_=_.next;return v}consume(p,v){const _=this.head.data;if(p<_.length){const b=_.slice(0,p);return this.head.data=_.slice(p),b}return p===_.length?this.shift():v?this._getString(p):this._getBuffer(p)}first(){return this.head.data}*[c](){for(let p=this.head;p;p=p.next)yield p.data}_getString(p){let v="",_=this.head,b=0;do{const A=_.data;if(p>A.length)v+=A,p-=A.length;else{p===A.length?(v+=A,++b,_.next?this.head=_.next:this.head=this.tail=null):(v+=u(A,0,p),this.head=_,_.data=u(A,p));break}++b}while((_=_.next)!==null);return this.length-=b,v}_getBuffer(p){const v=h.allocUnsafe(p),_=p;let b=this.head,A=0;do{const w=b.data;if(p>w.length)d(v,w,_-p),p-=w.length;else{p===w.length?(d(v,w,_-p),++A,b.next?this.head=b.next:this.head=this.tail=null):(d(v,new f(w.buffer,w.byteOffset,p),_-p),this.head=b,b.data=w.slice(p));break}++A}while((b=b.next)!==null);return this.length-=A,v}[Symbol.for("nodejs.util.inspect.custom")](p,v){return y(this,{...v,depth:0,customInspect:!1})}}},{"../../ours/primordials":127,"../../ours/util":128,buffer:29}],109:[function(n,o,a){const{pipeline:u}=n("./pipeline"),c=n("./duplex"),{destroyer:d}=n("./destroy"),{isNodeStream:f,isReadable:h,isWritable:y,isWebStream:g,isTransformStream:p,isWritableStream:v,isReadableStream:_}=n("./utils"),{AbortError:b,codes:{ERR_INVALID_ARG_VALUE:A,ERR_MISSING_ARGS:w}}=n("../../ours/errors"),T=n("./end-of-stream");o.exports=function(...x){if(x.length===0)throw new w("streams");if(x.length===1)return c.from(x[0]);const L=[...x];if(typeof x[0]=="function"&&(x[0]=c.from(x[0])),typeof x[x.length-1]=="function"){const de=x.length-1;x[de]=c.from(x[de])}for(let de=0;de<x.length;++de)if(!(!f(x[de])&&!g(x[de]))){if(de<x.length-1&&!(h(x[de])||_(x[de])||p(x[de])))throw new A(`streams[${de}]`,L[de],"must be readable");if(de>0&&!(y(x[de])||v(x[de])||p(x[de])))throw new A(`streams[${de}]`,L[de],"must be writable")}let M,O,ie,$,z;function V(de){const Fe=$;$=null,Fe?Fe(de):de?z.destroy(de):!le&&!pe&&z.destroy()}const re=x[0],F=u(x,V),pe=!!(y(re)||v(re)||p(re)),le=!!(h(F)||_(F)||p(F));if(z=new c({writableObjectMode:!!(re!=null&&re.writableObjectMode),readableObjectMode:!!(F!=null&&F.writableObjectMode),writable:pe,readable:le}),pe){if(f(re))z._write=function(Fe,Ie,At){re.write(Fe,Ie)?At():M=At},z._final=function(Fe){re.end(),O=Fe},re.on("drain",function(){if(M){const Fe=M;M=null,Fe()}});else if(g(re)){const Ie=(p(re)?re.writable:re).getWriter();z._write=async function(At,_e,qe){try{await Ie.ready,Ie.write(At).catch(()=>{}),qe()}catch(In){qe(In)}},z._final=async function(At){try{await Ie.ready,Ie.close().catch(()=>{}),O=At}catch(_e){At(_e)}}}const de=p(F)?F.readable:F;T(de,()=>{if(O){const Fe=O;O=null,Fe()}})}if(le){if(f(F))F.on("readable",function(){if(ie){const de=ie;ie=null,de()}}),F.on("end",function(){z.push(null)}),z._read=function(){for(;;){const de=F.read();if(de===null){ie=z._read;return}if(!z.push(de))return}};else if(g(F)){const Fe=(p(F)?F.readable:F).getReader();z._read=async function(){for(;;)try{const{value:Ie,done:At}=await Fe.read();if(!z.push(Ie))return;if(At){z.push(null);return}}catch{return}}}}return z._destroy=function(de,Fe){!de&&$!==null&&(de=new b),ie=null,M=null,O=null,$===null?Fe(de):($=Fe,f(F)&&d(F,de))},z}},{"../../ours/errors":126,"./destroy":110,"./duplex":111,"./end-of-stream":113,"./pipeline":118,"./utils":122}],110:[function(n,o,a){const u=n("process/"),{aggregateTwoErrors:c,codes:{ERR_MULTIPLE_CALLBACK:d},AbortError:f}=n("../../ours/errors"),{Symbol:h}=n("../../ours/primordials"),{kDestroyed:y,isDestroyed:g,isFinished:p,isServerRequest:v}=n("./utils"),_=h("kDestroy"),b=h("kConstruct");function A(le,de,Fe){le&&(le.stack,de&&!de.errored&&(de.errored=le),Fe&&!Fe.errored&&(Fe.errored=le))}function w(le,de){const Fe=this._readableState,Ie=this._writableState,At=Ie||Fe;return Ie!=null&&Ie.destroyed||Fe!=null&&Fe.destroyed?(typeof de=="function"&&de(),this):(A(le,Ie,Fe),Ie&&(Ie.destroyed=!0),Fe&&(Fe.destroyed=!0),At.constructed?T(this,le,de):this.once(_,function(_e){T(this,c(_e,le),de)}),this)}function T(le,de,Fe){let Ie=!1;function At(_e){if(Ie)return;Ie=!0;const qe=le._readableState,In=le._writableState;A(_e,In,qe),In&&(In.closed=!0),qe&&(qe.closed=!0),typeof Fe=="function"&&Fe(_e),_e?u.nextTick(S,le,_e):u.nextTick(x,le)}try{le._destroy(de||null,At)}catch(_e){At(_e)}}function S(le,de){L(le,de),x(le)}function x(le){const de=le._readableState,Fe=le._writableState;Fe&&(Fe.closeEmitted=!0),de&&(de.closeEmitted=!0),(Fe!=null&&Fe.emitClose||de!=null&&de.emitClose)&&le.emit("close")}function L(le,de){const Fe=le._readableState,Ie=le._writableState;Ie!=null&&Ie.errorEmitted||Fe!=null&&Fe.errorEmitted||(Ie&&(Ie.errorEmitted=!0),Fe&&(Fe.errorEmitted=!0),le.emit("error",de))}function M(){const le=this._readableState,de=this._writableState;le&&(le.constructed=!0,le.closed=!1,le.closeEmitted=!1,le.destroyed=!1,le.errored=null,le.errorEmitted=!1,le.reading=!1,le.ended=le.readable===!1,le.endEmitted=le.readable===!1),de&&(de.constructed=!0,de.destroyed=!1,de.closed=!1,de.closeEmitted=!1,de.errored=null,de.errorEmitted=!1,de.finalCalled=!1,de.prefinished=!1,de.ended=de.writable===!1,de.ending=de.writable===!1,de.finished=de.writable===!1)}function O(le,de,Fe){const Ie=le._readableState,At=le._writableState;if(At!=null&&At.destroyed||Ie!=null&&Ie.destroyed)return this;Ie!=null&&Ie.autoDestroy||At!=null&&At.autoDestroy?le.destroy(de):de&&(de.stack,At&&!At.errored&&(At.errored=de),Ie&&!Ie.errored&&(Ie.errored=de),Fe?u.nextTick(L,le,de):L(le,de))}function ie(le,de){if(typeof le._construct!="function")return;const Fe=le._readableState,Ie=le._writableState;Fe&&(Fe.constructed=!1),Ie&&(Ie.constructed=!1),le.once(b,de),!(le.listenerCount(b)>1)&&u.nextTick($,le)}function $(le){let de=!1;function Fe(Ie){if(de){O(le,Ie??new d);return}de=!0;const At=le._readableState,_e=le._writableState,qe=_e||At;At&&(At.constructed=!0),_e&&(_e.constructed=!0),qe.destroyed?le.emit(_,Ie):Ie?O(le,Ie,!0):u.nextTick(z,le)}try{le._construct(Ie=>{u.nextTick(Fe,Ie)})}catch(Ie){u.nextTick(Fe,Ie)}}function z(le){le.emit(b)}function V(le){return(le==null?void 0:le.setHeader)&&typeof le.abort=="function"}function re(le){le.emit("close")}function F(le,de){le.emit("error",de),u.nextTick(re,le)}function pe(le,de){!le||g(le)||(!de&&!p(le)&&(de=new f),v(le)?(le.socket=null,le.destroy(de)):V(le)?le.abort():V(le.req)?le.req.abort():typeof le.destroy=="function"?le.destroy(de):typeof le.close=="function"?le.close():de?u.nextTick(F,le,de):u.nextTick(re,le),le.destroyed||(le[y]=!0))}o.exports={construct:ie,destroyer:pe,destroy:w,undestroy:M,errorOrDestroy:O}},{"../../ours/errors":126,"../../ours/primordials":127,"./utils":122,"process/":102}],111:[function(n,o,a){const{ObjectDefineProperties:u,ObjectGetOwnPropertyDescriptor:c,ObjectKeys:d,ObjectSetPrototypeOf:f}=n("../../ours/primordials");o.exports=g;const h=n("./readable"),y=n("./writable");f(g.prototype,h.prototype),f(g,h);{const b=d(y.prototype);for(let A=0;A<b.length;A++){const w=b[A];g.prototype[w]||(g.prototype[w]=y.prototype[w])}}function g(b){if(!(this instanceof g))return new g(b);h.call(this,b),y.call(this,b),b?(this.allowHalfOpen=b.allowHalfOpen!==!1,b.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),b.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}u(g.prototype,{writable:{__proto__:null,...c(y.prototype,"writable")},writableHighWaterMark:{__proto__:null,...c(y.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...c(y.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...c(y.prototype,"writableBuffer")},writableLength:{__proto__:null,...c(y.prototype,"writableLength")},writableFinished:{__proto__:null,...c(y.prototype,"writableFinished")},writableCorked:{__proto__:null,...c(y.prototype,"writableCorked")},writableEnded:{__proto__:null,...c(y.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...c(y.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(b){this._readableState&&this._writableState&&(this._readableState.destroyed=b,this._writableState.destroyed=b)}}});let p;function v(){return p===void 0&&(p={}),p}g.fromWeb=function(b,A){return v().newStreamDuplexFromReadableWritablePair(b,A)},g.toWeb=function(b){return v().newReadableWritablePairFromDuplex(b)};let _;g.from=function(b){return _||(_=n("./duplexify")),_(b,"body")}},{"../../ours/primordials":127,"./duplexify":112,"./readable":119,"./writable":123}],112:[function(n,o,a){const u=n("process/"),c=n("buffer"),{isReadable:d,isWritable:f,isIterable:h,isNodeStream:y,isReadableNodeStream:g,isWritableNodeStream:p,isDuplexNodeStream:v}=n("./utils"),_=n("./end-of-stream"),{AbortError:b,codes:{ERR_INVALID_ARG_TYPE:A,ERR_INVALID_RETURN_VALUE:w}}=n("../../ours/errors"),{destroyer:T}=n("./destroy"),S=n("./duplex"),x=n("./readable"),{createDeferredPromise:L}=n("../../ours/util"),M=n("./from"),O=globalThis.Blob||c.Blob,ie=typeof O<"u"?function(le){return le instanceof O}:function(le){return!1},$=globalThis.AbortController||n("abort-controller").AbortController,{FunctionPrototypeCall:z}=n("../../ours/primordials");class V extends S{constructor(le){super(le),(le==null?void 0:le.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),(le==null?void 0:le.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}o.exports=function pe(le,de){if(v(le))return le;if(g(le))return F({readable:le});if(p(le))return F({writable:le});if(y(le))return F({writable:!1,readable:!1});if(typeof le=="function"){const{value:Ie,write:At,final:_e,destroy:qe}=re(le);if(h(Ie))return M(V,Ie,{objectMode:!0,write:At,final:_e,destroy:qe});const In=Ie==null?void 0:Ie.then;if(typeof In=="function"){let vn;const Pt=z(In,Ie,he=>{if(he!=null)throw new w("nully","body",he)},he=>{T(vn,he)});return vn=new V({objectMode:!0,readable:!1,write:At,final(he){_e(async()=>{try{await Pt,u.nextTick(he,null)}catch(Ue){u.nextTick(he,Ue)}})},destroy:qe})}throw new w("Iterable, AsyncIterable or AsyncFunction",de,Ie)}if(ie(le))return pe(le.arrayBuffer());if(h(le))return M(V,le,{objectMode:!0,writable:!1});if(typeof(le==null?void 0:le.writable)=="object"||typeof(le==null?void 0:le.readable)=="object"){const Ie=le!=null&&le.readable?g(le==null?void 0:le.readable)?le==null?void 0:le.readable:pe(le.readable):void 0,At=le!=null&&le.writable?p(le==null?void 0:le.writable)?le==null?void 0:le.writable:pe(le.writable):void 0;return F({readable:Ie,writable:At})}const Fe=le==null?void 0:le.then;if(typeof Fe=="function"){let Ie;return z(Fe,le,At=>{At!=null&&Ie.push(At),Ie.push(null)},At=>{T(Ie,At)}),Ie=new V({objectMode:!0,writable:!1,read(){}})}throw new A(de,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],le)};function re(pe){let{promise:le,resolve:de}=L();const Fe=new $,Ie=Fe.signal;return{value:pe(async function*(){for(;;){const _e=le;le=null;const{chunk:qe,done:In,cb:vn}=await _e;if(u.nextTick(vn),In)return;if(Ie.aborted)throw new b(void 0,{cause:Ie.reason});({promise:le,resolve:de}=L()),yield qe}}(),{signal:Ie}),write(_e,qe,In){const vn=de;de=null,vn({chunk:_e,done:!1,cb:In})},final(_e){const qe=de;de=null,qe({done:!0,cb:_e})},destroy(_e,qe){Fe.abort(),qe(_e)}}}function F(pe){const le=pe.readable&&typeof pe.readable.read!="function"?x.wrap(pe.readable):pe.readable,de=pe.writable;let Fe=!!d(le),Ie=!!f(de),At,_e,qe,In,vn;function Pt(he){const Ue=In;In=null,Ue?Ue(he):he&&vn.destroy(he)}return vn=new V({readableObjectMode:!!(le!=null&&le.readableObjectMode),writableObjectMode:!!(de!=null&&de.writableObjectMode),readable:Fe,writable:Ie}),Ie&&(_(de,he=>{Ie=!1,he&&T(le,he),Pt(he)}),vn._write=function(he,Ue,Dt){de.write(he,Ue)?Dt():At=Dt},vn._final=function(he){de.end(),_e=he},de.on("drain",function(){if(At){const he=At;At=null,he()}}),de.on("finish",function(){if(_e){const he=_e;_e=null,he()}})),Fe&&(_(le,he=>{Fe=!1,he&&T(le,he),Pt(he)}),le.on("readable",function(){if(qe){const he=qe;qe=null,he()}}),le.on("end",function(){vn.push(null)}),vn._read=function(){for(;;){const he=le.read();if(he===null){qe=vn._read;return}if(!vn.push(he))return}}),vn._destroy=function(he,Ue){!he&&In!==null&&(he=new b),qe=null,At=null,_e=null,In===null?Ue(he):(In=Ue,T(de,he),T(le,he))},vn}},{"../../ours/errors":126,"../../ours/primordials":127,"../../ours/util":128,"./destroy":110,"./duplex":111,"./end-of-stream":113,"./from":114,"./readable":119,"./utils":122,"abort-controller":24,buffer:29,"process/":102}],113:[function(n,o,a){const u=n("process/"),{AbortError:c,codes:d}=n("../../ours/errors"),{ERR_INVALID_ARG_TYPE:f,ERR_STREAM_PREMATURE_CLOSE:h}=d,{kEmptyObject:y,once:g}=n("../../ours/util"),{validateAbortSignal:p,validateFunction:v,validateObject:_,validateBoolean:b}=n("../validators"),{Promise:A,PromisePrototypeThen:w}=n("../../ours/primordials"),{isClosed:T,isReadable:S,isReadableNodeStream:x,isReadableStream:L,isReadableFinished:M,isReadableErrored:O,isWritable:ie,isWritableNodeStream:$,isWritableStream:z,isWritableFinished:V,isWritableErrored:re,isNodeStream:F,willEmitClose:pe,kIsClosedPromise:le}=n("./utils");function de(qe){return qe.setHeader&&typeof qe.abort=="function"}const Fe=()=>{};function Ie(qe,In,vn){var Pt,he;if(arguments.length===2?(vn=In,In=y):In==null?In=y:_(In,"options"),v(vn,"callback"),p(In.signal,"options.signal"),vn=g(vn),L(qe)||z(qe))return At(qe,In,vn);if(!F(qe))throw new f("stream",["ReadableStream","WritableStream","Stream"],qe);const Ue=(Pt=In.readable)!==null&&Pt!==void 0?Pt:x(qe),Dt=(he=In.writable)!==null&&he!==void 0?he:$(qe),jt=qe._writableState,Et=qe._readableState,Ce=()=>{qe.writable||Ne()};let ue=pe(qe)&&x(qe)===Ue&&$(qe)===Dt,$e=V(qe,!1);const Ne=()=>{$e=!0,qe.destroyed&&(ue=!1),!(ue&&(!qe.readable||Ue))&&(!Ue||Oe)&&vn.call(qe)};let Oe=M(qe,!1);const Lt=()=>{Oe=!0,qe.destroyed&&(ue=!1),!(ue&&(!qe.writable||Dt))&&(!Dt||$e)&&vn.call(qe)},kt=D=>{vn.call(qe,D)};let Cn=T(qe);const oe=()=>{Cn=!0;const D=re(qe)||O(qe);if(D&&typeof D!="boolean")return vn.call(qe,D);if(Ue&&!Oe&&x(qe,!0)&&!M(qe,!1))return vn.call(qe,new h);if(Dt&&!$e&&!V(qe,!1))return vn.call(qe,new h);vn.call(qe)},ae=()=>{Cn=!0;const D=re(qe)||O(qe);if(D&&typeof D!="boolean")return vn.call(qe,D);vn.call(qe)},Y=()=>{qe.req.on("finish",Ne)};de(qe)?(qe.on("complete",Ne),ue||qe.on("abort",oe),qe.req?Y():qe.on("request",Y)):Dt&&!jt&&(qe.on("end",Ce),qe.on("close",Ce)),!ue&&typeof qe.aborted=="boolean"&&qe.on("aborted",oe),qe.on("end",Lt),qe.on("finish",Ne),In.error!==!1&&qe.on("error",kt),qe.on("close",oe),Cn?u.nextTick(oe):jt!=null&&jt.errorEmitted||Et!=null&&Et.errorEmitted?ue||u.nextTick(ae):(!Ue&&(!ue||S(qe))&&($e||ie(qe)===!1)||!Dt&&(!ue||ie(qe))&&(Oe||S(qe)===!1)||Et&&qe.req&&qe.aborted)&&u.nextTick(ae);const k=()=>{vn=Fe,qe.removeListener("aborted",oe),qe.removeListener("complete",Ne),qe.removeListener("abort",oe),qe.removeListener("request",Y),qe.req&&qe.req.removeListener("finish",Ne),qe.removeListener("end",Ce),qe.removeListener("close",Ce),qe.removeListener("finish",Ne),qe.removeListener("end",Lt),qe.removeListener("error",kt),qe.removeListener("close",oe)};if(In.signal&&!Cn){const D=()=>{const j=vn;k(),j.call(qe,new c(void 0,{cause:In.signal.reason}))};if(In.signal.aborted)u.nextTick(D);else{const j=vn;vn=g((...xe)=>{In.signal.removeEventListener("abort",D),j.apply(qe,xe)}),In.signal.addEventListener("abort",D)}}return k}function At(qe,In,vn){let Pt=!1,he=Fe;if(In.signal)if(he=()=>{Pt=!0,vn.call(qe,new c(void 0,{cause:In.signal.reason}))},In.signal.aborted)u.nextTick(he);else{const Dt=vn;vn=g((...jt)=>{In.signal.removeEventListener("abort",he),Dt.apply(qe,jt)}),In.signal.addEventListener("abort",he)}const Ue=(...Dt)=>{Pt||u.nextTick(()=>vn.apply(qe,Dt))};return w(qe[le].promise,Ue,Ue),Fe}function _e(qe,In){var vn;let Pt=!1;return In===null&&(In=y),(vn=In)!==null&&vn!==void 0&&vn.cleanup&&(b(In.cleanup,"cleanup"),Pt=In.cleanup),new A((he,Ue)=>{const Dt=Ie(qe,In,jt=>{Pt&&Dt(),jt?Ue(jt):he()})})}o.exports=Ie,o.exports.finished=_e},{"../../ours/errors":126,"../../ours/primordials":127,"../../ours/util":128,"../validators":124,"./utils":122,"process/":102}],114:[function(n,o,a){const u=n("process/"),{PromisePrototypeThen:c,SymbolAsyncIterator:d,SymbolIterator:f}=n("../../ours/primordials"),{Buffer:h}=n("buffer"),{ERR_INVALID_ARG_TYPE:y,ERR_STREAM_NULL_VALUES:g}=n("../../ours/errors").codes;function p(v,_,b){let A;if(typeof _=="string"||_ instanceof h)return new v({objectMode:!0,...b,read(){this.push(_),this.push(null)}});let w;if(_&&_[d])w=!0,A=_[d]();else if(_&&_[f])w=!1,A=_[f]();else throw new y("iterable",["Iterable"],_);const T=new v({objectMode:!0,highWaterMark:1,...b});let S=!1;T._read=function(){S||(S=!0,L())},T._destroy=function(M,O){c(x(M),()=>u.nextTick(O,M),ie=>u.nextTick(O,ie||M))};async function x(M){const O=M!=null,ie=typeof A.throw=="function";if(O&&ie){const{value:$,done:z}=await A.throw(M);if(await $,z)return}if(typeof A.return=="function"){const{value:$}=await A.return();await $}}async function L(){for(;;){try{const{value:M,done:O}=w?await A.next():A.next();if(O)T.push(null);else{const ie=M&&typeof M.then=="function"?await M:M;if(ie===null)throw S=!1,new g;if(T.push(ie))continue;S=!1}}catch(M){T.destroy(M)}break}}return T}o.exports=p},{"../../ours/errors":126,"../../ours/primordials":127,buffer:29,"process/":102}],115:[function(n,o,a){const{ArrayIsArray:u,ObjectSetPrototypeOf:c}=n("../../ours/primordials"),{EventEmitter:d}=n("events");function f(y){d.call(this,y)}c(f.prototype,d.prototype),c(f,d),f.prototype.pipe=function(y,g){const p=this;function v(x){y.writable&&y.write(x)===!1&&p.pause&&p.pause()}p.on("data",v);function _(){p.readable&&p.resume&&p.resume()}y.on("drain",_),!y._isStdio&&(!g||g.end!==!1)&&(p.on("end",A),p.on("close",w));let b=!1;function A(){b||(b=!0,y.end())}function w(){b||(b=!0,typeof y.destroy=="function"&&y.destroy())}function T(x){S(),d.listenerCount(this,"error")===0&&this.emit("error",x)}h(p,"error",T),h(y,"error",T);function S(){p.removeListener("data",v),y.removeListener("drain",_),p.removeListener("end",A),p.removeListener("close",w),p.removeListener("error",T),y.removeListener("error",T),p.removeListener("end",S),p.removeListener("close",S),y.removeListener("close",S)}return p.on("end",S),p.on("close",S),y.on("close",S),y.emit("pipe",p),y};function h(y,g,p){if(typeof y.prependListener=="function")return y.prependListener(g,p);!y._events||!y._events[g]?y.on(g,p):u(y._events[g])?y._events[g].unshift(p):y._events[g]=[p,y._events[g]]}o.exports={Stream:f,prependListener:h}},{"../../ours/primordials":127,events:49}],116:[function(n,o,a){const u=globalThis.AbortController||n("abort-controller").AbortController,{codes:{ERR_INVALID_ARG_VALUE:c,ERR_INVALID_ARG_TYPE:d,ERR_MISSING_ARGS:f,ERR_OUT_OF_RANGE:h},AbortError:y}=n("../../ours/errors"),{validateAbortSignal:g,validateInteger:p,validateObject:v}=n("../validators"),_=n("../../ours/primordials").Symbol("kWeak"),{finished:b}=n("./end-of-stream"),A=n("./compose"),{addAbortSignalNoValidate:w}=n("./add-abort-signal"),{isWritable:T,isNodeStream:S}=n("./utils"),{ArrayPrototypePush:x,MathFloor:L,Number:M,NumberIsNaN:O,Promise:ie,PromiseReject:$,PromisePrototypeThen:z,Symbol:V}=n("../../ours/primordials"),re=V("kEmpty"),F=V("kEof");function pe(Et,Ce){if(Ce!=null&&v(Ce,"options"),(Ce==null?void 0:Ce.signal)!=null&&g(Ce.signal,"options.signal"),S(Et)&&!T(Et))throw new c("stream",Et,"must be writable");const ue=A(this,Et);return Ce!=null&&Ce.signal&&w(Ce.signal,ue),ue}function le(Et,Ce){if(typeof Et!="function")throw new d("fn",["Function","AsyncFunction"],Et);Ce!=null&&v(Ce,"options"),(Ce==null?void 0:Ce.signal)!=null&&g(Ce.signal,"options.signal");let ue=1;return(Ce==null?void 0:Ce.concurrency)!=null&&(ue=L(Ce.concurrency)),p(ue,"concurrency",1),(async function*(){var Ne,Oe;const Lt=new u,kt=this,Cn=[],oe=Lt.signal,ae={signal:oe},Y=()=>Lt.abort();Ce!=null&&(Ne=Ce.signal)!==null&&Ne!==void 0&&Ne.aborted&&Y(),Ce==null||(Oe=Ce.signal)===null||Oe===void 0||Oe.addEventListener("abort",Y);let k,D,j=!1;function xe(){j=!0}async function hn(){try{for await(let xn of kt){var _n;if(j)return;if(oe.aborted)throw new y;try{xn=Et(xn,ae)}catch(Ln){xn=$(Ln)}xn!==re&&(typeof((_n=xn)===null||_n===void 0?void 0:_n.catch)=="function"&&xn.catch(xe),Cn.push(xn),k&&(k(),k=null),!j&&Cn.length&&Cn.length>=ue&&await new ie(Ln=>{D=Ln}))}Cn.push(F)}catch(xn){const Ln=$(xn);z(Ln,void 0,xe),Cn.push(Ln)}finally{var Sn;j=!0,k&&(k(),k=null),Ce==null||(Sn=Ce.signal)===null||Sn===void 0||Sn.removeEventListener("abort",Y)}}hn();try{for(;;){for(;Cn.length>0;){const _n=await Cn[0];if(_n===F)return;if(oe.aborted)throw new y;_n!==re&&(yield _n),Cn.shift(),D&&(D(),D=null)}await new ie(_n=>{k=_n})}}finally{Lt.abort(),j=!0,D&&(D(),D=null)}}).call(this)}function de(Et=void 0){return Et!=null&&v(Et,"options"),(Et==null?void 0:Et.signal)!=null&&g(Et.signal,"options.signal"),(async function*(){let ue=0;for await(const Ne of this){var $e;if(Et!=null&&($e=Et.signal)!==null&&$e!==void 0&&$e.aborted)throw new y({cause:Et.signal.reason});yield[ue++,Ne]}}).call(this)}async function Fe(Et,Ce=void 0){for await(const ue of qe.call(this,Et,Ce))return!0;return!1}async function Ie(Et,Ce=void 0){if(typeof Et!="function")throw new d("fn",["Function","AsyncFunction"],Et);return!await Fe.call(this,async(...ue)=>!await Et(...ue),Ce)}async function At(Et,Ce){for await(const ue of qe.call(this,Et,Ce))return ue}async function _e(Et,Ce){if(typeof Et!="function")throw new d("fn",["Function","AsyncFunction"],Et);async function ue($e,Ne){return await Et($e,Ne),re}for await(const $e of le.call(this,ue,Ce));}function qe(Et,Ce){if(typeof Et!="function")throw new d("fn",["Function","AsyncFunction"],Et);async function ue($e,Ne){return await Et($e,Ne)?$e:re}return le.call(this,ue,Ce)}class In extends f{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function vn(Et,Ce,ue){var $e;if(typeof Et!="function")throw new d("reducer",["Function","AsyncFunction"],Et);ue!=null&&v(ue,"options"),(ue==null?void 0:ue.signal)!=null&&g(ue.signal,"options.signal");let Ne=arguments.length>1;if(ue!=null&&($e=ue.signal)!==null&&$e!==void 0&&$e.aborted){const oe=new y(void 0,{cause:ue.signal.reason});throw this.once("error",()=>{}),await b(this.destroy(oe)),oe}const Oe=new u,Lt=Oe.signal;if(ue!=null&&ue.signal){const oe={once:!0,[_]:this};ue.signal.addEventListener("abort",()=>Oe.abort(),oe)}let kt=!1;try{for await(const oe of this){var Cn;if(kt=!0,ue!=null&&(Cn=ue.signal)!==null&&Cn!==void 0&&Cn.aborted)throw new y;Ne?Ce=await Et(Ce,oe,{signal:Lt}):(Ce=oe,Ne=!0)}if(!kt&&!Ne)throw new In}finally{Oe.abort()}return Ce}async function Pt(Et){Et!=null&&v(Et,"options"),(Et==null?void 0:Et.signal)!=null&&g(Et.signal,"options.signal");const Ce=[];for await(const $e of this){var ue;if(Et!=null&&(ue=Et.signal)!==null&&ue!==void 0&&ue.aborted)throw new y(void 0,{cause:Et.signal.reason});x(Ce,$e)}return Ce}function he(Et,Ce){const ue=le.call(this,Et,Ce);return(async function*(){for await(const Ne of ue)yield*Ne}).call(this)}function Ue(Et){if(Et=M(Et),O(Et))return 0;if(Et<0)throw new h("number",">= 0",Et);return Et}function Dt(Et,Ce=void 0){return Ce!=null&&v(Ce,"options"),(Ce==null?void 0:Ce.signal)!=null&&g(Ce.signal,"options.signal"),Et=Ue(Et),(async function*(){var $e;if(Ce!=null&&($e=Ce.signal)!==null&&$e!==void 0&&$e.aborted)throw new y;for await(const Oe of this){var Ne;if(Ce!=null&&(Ne=Ce.signal)!==null&&Ne!==void 0&&Ne.aborted)throw new y;Et--<=0&&(yield Oe)}}).call(this)}function jt(Et,Ce=void 0){return Ce!=null&&v(Ce,"options"),(Ce==null?void 0:Ce.signal)!=null&&g(Ce.signal,"options.signal"),Et=Ue(Et),(async function*(){var $e;if(Ce!=null&&($e=Ce.signal)!==null&&$e!==void 0&&$e.aborted)throw new y;for await(const Oe of this){var Ne;if(Ce!=null&&(Ne=Ce.signal)!==null&&Ne!==void 0&&Ne.aborted)throw new y;if(Et-- >0)yield Oe;else return}}).call(this)}o.exports.streamReturningOperators={asIndexedPairs:de,drop:Dt,filter:qe,flatMap:he,map:le,take:jt,compose:pe},o.exports.promiseReturningOperators={every:Ie,forEach:_e,reduce:vn,toArray:Pt,some:Fe,find:At}},{"../../ours/errors":126,"../../ours/primordials":127,"../validators":124,"./add-abort-signal":107,"./compose":109,"./end-of-stream":113,"./utils":122,"abort-controller":24}],117:[function(n,o,a){const{ObjectSetPrototypeOf:u}=n("../../ours/primordials");o.exports=d;const c=n("./transform");u(d.prototype,c.prototype),u(d,c);function d(f){if(!(this instanceof d))return new d(f);c.call(this,f)}d.prototype._transform=function(f,h,y){y(null,f)}},{"../../ours/primordials":127,"./transform":121}],118:[function(n,o,a){const u=n("process/"),{ArrayIsArray:c,Promise:d,SymbolAsyncIterator:f}=n("../../ours/primordials"),h=n("./end-of-stream"),{once:y}=n("../../ours/util"),g=n("./destroy"),p=n("./duplex"),{aggregateTwoErrors:v,codes:{ERR_INVALID_ARG_TYPE:_,ERR_INVALID_RETURN_VALUE:b,ERR_MISSING_ARGS:A,ERR_STREAM_DESTROYED:w,ERR_STREAM_PREMATURE_CLOSE:T},AbortError:S}=n("../../ours/errors"),{validateFunction:x,validateAbortSignal:L}=n("../validators"),{isIterable:M,isReadable:O,isReadableNodeStream:ie,isNodeStream:$,isTransformStream:z,isWebStream:V,isReadableStream:re,isReadableEnded:F}=n("./utils"),pe=globalThis.AbortController||n("abort-controller").AbortController;let le,de;function Fe(Ue,Dt,jt){let Et=!1;Ue.on("close",()=>{Et=!0});const Ce=h(Ue,{readable:Dt,writable:jt},ue=>{Et=!ue});return{destroy:ue=>{Et||(Et=!0,g.destroyer(Ue,ue||new w("pipe")))},cleanup:Ce}}function Ie(Ue){return x(Ue[Ue.length-1],"streams[stream.length - 1]"),Ue.pop()}function At(Ue){if(M(Ue))return Ue;if(ie(Ue))return _e(Ue);throw new _("val",["Readable","Iterable","AsyncIterable"],Ue)}async function*_e(Ue){de||(de=n("./readable")),yield*de.prototype[f].call(Ue)}async function qe(Ue,Dt,jt,{end:Et}){let Ce,ue=null;const $e=Lt=>{if(Lt&&(Ce=Lt),ue){const kt=ue;ue=null,kt()}},Ne=()=>new d((Lt,kt)=>{Ce?kt(Ce):ue=()=>{Ce?kt(Ce):Lt()}});Dt.on("drain",$e);const Oe=h(Dt,{readable:!1},$e);try{Dt.writableNeedDrain&&await Ne();for await(const Lt of Ue)Dt.write(Lt)||await Ne();Et&&Dt.end(),await Ne(),jt()}catch(Lt){jt(Ce!==Lt?v(Ce,Lt):Lt)}finally{Oe(),Dt.off("drain",$e)}}async function In(Ue,Dt,jt,{end:Et}){z(Dt)&&(Dt=Dt.writable);const Ce=Dt.getWriter();try{for await(const ue of Ue)await Ce.ready,Ce.write(ue).catch(()=>{});await Ce.ready,Et&&await Ce.close(),jt()}catch(ue){try{await Ce.abort(ue),jt(ue)}catch($e){jt($e)}}}function vn(...Ue){return Pt(Ue,y(Ie(Ue)))}function Pt(Ue,Dt,jt){if(Ue.length===1&&c(Ue[0])&&(Ue=Ue[0]),Ue.length<2)throw new A("streams");const Et=new pe,Ce=Et.signal,ue=jt==null?void 0:jt.signal,$e=[];L(ue,"options.signal");function Ne(){ae(new S)}ue==null||ue.addEventListener("abort",Ne);let Oe,Lt;const kt=[];let Cn=0;function oe(j){ae(j,--Cn===0)}function ae(j,xe){if(j&&(!Oe||Oe.code==="ERR_STREAM_PREMATURE_CLOSE")&&(Oe=j),!(!Oe&&!xe)){for(;kt.length;)kt.shift()(Oe);ue==null||ue.removeEventListener("abort",Ne),Et.abort(),xe&&(Oe||$e.forEach(hn=>hn()),u.nextTick(Dt,Oe,Lt))}}let Y;for(let j=0;j<Ue.length;j++){const xe=Ue[j],hn=j<Ue.length-1,_n=j>0,Sn=hn||(jt==null?void 0:jt.end)!==!1,xn=j===Ue.length-1;if($(xe)){let Ln=function(Ve){Ve&&Ve.name!=="AbortError"&&Ve.code!=="ERR_STREAM_PREMATURE_CLOSE"&&oe(Ve)};if(Sn){const{destroy:Ve,cleanup:ze}=Fe(xe,hn,_n);kt.push(Ve),O(xe)&&xn&&$e.push(ze)}xe.on("error",Ln),O(xe)&&xn&&$e.push(()=>{xe.removeListener("error",Ln)})}if(j===0)if(typeof xe=="function"){if(Y=xe({signal:Ce}),!M(Y))throw new b("Iterable, AsyncIterable or Stream","source",Y)}else M(xe)||ie(xe)||z(xe)?Y=xe:Y=p.from(xe);else if(typeof xe=="function"){if(z(Y)){var k;Y=At((k=Y)===null||k===void 0?void 0:k.readable)}else Y=At(Y);if(Y=xe(Y,{signal:Ce}),hn){if(!M(Y,!0))throw new b("AsyncIterable",`transform[${j-1}]`,Y)}else{var D;le||(le=n("./passthrough"));const Ln=new le({objectMode:!0}),Ve=(D=Y)===null||D===void 0?void 0:D.then;if(typeof Ve=="function")Cn++,Ve.call(Y,An=>{Lt=An,An!=null&&Ln.write(An),Sn&&Ln.end(),u.nextTick(oe)},An=>{Ln.destroy(An),u.nextTick(oe,An)});else if(M(Y,!0))Cn++,qe(Y,Ln,oe,{end:Sn});else if(re(Y)||z(Y)){const An=Y.readable||Y;Cn++,qe(An,Ln,oe,{end:Sn})}else throw new b("AsyncIterable or Promise","destination",Y);Y=Ln;const{destroy:ze,cleanup:wn}=Fe(Y,!1,!0);kt.push(ze),xn&&$e.push(wn)}}else if($(xe)){if(ie(Y)){Cn+=2;const Ln=he(Y,xe,oe,{end:Sn});O(xe)&&xn&&$e.push(Ln)}else if(z(Y)||re(Y)){const Ln=Y.readable||Y;Cn++,qe(Ln,xe,oe,{end:Sn})}else if(M(Y))Cn++,qe(Y,xe,oe,{end:Sn});else throw new _("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],Y);Y=xe}else if(V(xe)){if(ie(Y))Cn++,In(At(Y),xe,oe,{end:Sn});else if(re(Y)||M(Y))Cn++,In(Y,xe,oe,{end:Sn});else if(z(Y))Cn++,In(Y.readable,xe,oe,{end:Sn});else throw new _("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],Y);Y=xe}else Y=p.from(xe)}return(Ce!=null&&Ce.aborted||ue!=null&&ue.aborted)&&u.nextTick(Ne),Y}function he(Ue,Dt,jt,{end:Et}){let Ce=!1;if(Dt.on("close",()=>{Ce||jt(new T)}),Ue.pipe(Dt,{end:!1}),Et){let ue=function(){Ce=!0,Dt.end()};F(Ue)?u.nextTick(ue):Ue.once("end",ue)}else jt();return h(Ue,{readable:!0,writable:!1},ue=>{const $e=Ue._readableState;ue&&ue.code==="ERR_STREAM_PREMATURE_CLOSE"&&$e&&$e.ended&&!$e.errored&&!$e.errorEmitted?Ue.once("end",jt).once("error",jt):jt(ue)}),h(Dt,{readable:!1,writable:!0},jt)}o.exports={pipelineImpl:Pt,pipeline:vn}},{"../../ours/errors":126,"../../ours/primordials":127,"../../ours/util":128,"../validators":124,"./destroy":110,"./duplex":111,"./end-of-stream":113,"./passthrough":117,"./readable":119,"./utils":122,"abort-controller":24,"process/":102}],119:[function(n,o,a){const u=n("process/"),{ArrayPrototypeIndexOf:c,NumberIsInteger:d,NumberIsNaN:f,NumberParseInt:h,ObjectDefineProperties:y,ObjectKeys:g,ObjectSetPrototypeOf:p,Promise:v,SafeSet:_,SymbolAsyncIterator:b,Symbol:A}=n("../../ours/primordials");o.exports=he,he.ReadableState=Pt;const{EventEmitter:w}=n("events"),{Stream:T,prependListener:S}=n("./legacy"),{Buffer:x}=n("buffer"),{addAbortSignal:L}=n("./add-abort-signal"),M=n("./end-of-stream");let O=n("../../ours/util").debuglog("stream",Ve=>{O=Ve});const ie=n("./buffer_list"),$=n("./destroy"),{getHighWaterMark:z,getDefaultHighWaterMark:V}=n("./state"),{aggregateTwoErrors:re,codes:{ERR_INVALID_ARG_TYPE:F,ERR_METHOD_NOT_IMPLEMENTED:pe,ERR_OUT_OF_RANGE:le,ERR_STREAM_PUSH_AFTER_EOF:de,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:Fe}}=n("../../ours/errors"),{validateObject:Ie}=n("../validators"),At=A("kPaused"),{StringDecoder:_e}=n("string_decoder"),qe=n("./from");p(he.prototype,T.prototype),p(he,T);const In=()=>{},{errorOrDestroy:vn}=$;function Pt(Ve,ze,wn){typeof wn!="boolean"&&(wn=ze instanceof n("./duplex")),this.objectMode=!!(Ve&&Ve.objectMode),wn&&(this.objectMode=this.objectMode||!!(Ve&&Ve.readableObjectMode)),this.highWaterMark=Ve?z(this,Ve,"readableHighWaterMark",wn):V(!1),this.buffer=new ie,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[At]=null,this.errorEmitted=!1,this.emitClose=!Ve||Ve.emitClose!==!1,this.autoDestroy=!Ve||Ve.autoDestroy!==!1,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=Ve&&Ve.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,Ve&&Ve.encoding&&(this.decoder=new _e(Ve.encoding),this.encoding=Ve.encoding)}function he(Ve){if(!(this instanceof he))return new he(Ve);const ze=this instanceof n("./duplex");this._readableState=new Pt(Ve,this,ze),Ve&&(typeof Ve.read=="function"&&(this._read=Ve.read),typeof Ve.destroy=="function"&&(this._destroy=Ve.destroy),typeof Ve.construct=="function"&&(this._construct=Ve.construct),Ve.signal&&!ze&&L(Ve.signal,this)),T.call(this,Ve),$.construct(this,()=>{this._readableState.needReadable&&Oe(this,this._readableState)})}he.prototype.destroy=$.destroy,he.prototype._undestroy=$.undestroy,he.prototype._destroy=function(Ve,ze){ze(Ve)},he.prototype[w.captureRejectionSymbol]=function(Ve){this.destroy(Ve)},he.prototype.push=function(Ve,ze){return Ue(this,Ve,ze,!1)},he.prototype.unshift=function(Ve,ze){return Ue(this,Ve,ze,!0)};function Ue(Ve,ze,wn,An){O("readableAddChunk",ze);const Tn=Ve._readableState;let Pn;if(Tn.objectMode||(typeof ze=="string"?(wn=wn||Tn.defaultEncoding,Tn.encoding!==wn&&(An&&Tn.encoding?ze=x.from(ze,wn).toString(Tn.encoding):(ze=x.from(ze,wn),wn=""))):ze instanceof x?wn="":T._isUint8Array(ze)?(ze=T._uint8ArrayToBuffer(ze),wn=""):ze!=null&&(Pn=new F("chunk",["string","Buffer","Uint8Array"],ze))),Pn)vn(Ve,Pn);else if(ze===null)Tn.reading=!1,ue(Ve,Tn);else if(Tn.objectMode||ze&&ze.length>0)if(An)if(Tn.endEmitted)vn(Ve,new Fe);else{if(Tn.destroyed||Tn.errored)return!1;Dt(Ve,Tn,ze,!0)}else if(Tn.ended)vn(Ve,new de);else{if(Tn.destroyed||Tn.errored)return!1;Tn.reading=!1,Tn.decoder&&!wn?(ze=Tn.decoder.write(ze),Tn.objectMode||ze.length!==0?Dt(Ve,Tn,ze,!1):Oe(Ve,Tn)):Dt(Ve,Tn,ze,!1)}else An||(Tn.reading=!1,Oe(Ve,Tn));return!Tn.ended&&(Tn.length<Tn.highWaterMark||Tn.length===0)}function Dt(Ve,ze,wn,An){ze.flowing&&ze.length===0&&!ze.sync&&Ve.listenerCount("data")>0?(ze.multiAwaitDrain?ze.awaitDrainWriters.clear():ze.awaitDrainWriters=null,ze.dataEmitted=!0,Ve.emit("data",wn)):(ze.length+=ze.objectMode?1:wn.length,An?ze.buffer.unshift(wn):ze.buffer.push(wn),ze.needReadable&&$e(Ve)),Oe(Ve,ze)}he.prototype.isPaused=function(){const Ve=this._readableState;return Ve[At]===!0||Ve.flowing===!1},he.prototype.setEncoding=function(Ve){const ze=new _e(Ve);this._readableState.decoder=ze,this._readableState.encoding=this._readableState.decoder.encoding;const wn=this._readableState.buffer;let An="";for(const Tn of wn)An+=ze.write(Tn);return wn.clear(),An!==""&&wn.push(An),this._readableState.length=An.length,this};const jt=1073741824;function Et(Ve){if(Ve>jt)throw new le("size","<= 1GiB",Ve);return Ve--,Ve|=Ve>>>1,Ve|=Ve>>>2,Ve|=Ve>>>4,Ve|=Ve>>>8,Ve|=Ve>>>16,Ve++,Ve}function Ce(Ve,ze){return Ve<=0||ze.length===0&&ze.ended?0:ze.objectMode?1:f(Ve)?ze.flowing&&ze.length?ze.buffer.first().length:ze.length:Ve<=ze.length?Ve:ze.ended?ze.length:0}he.prototype.read=function(Ve){O("read",Ve),Ve===void 0?Ve=NaN:d(Ve)||(Ve=h(Ve,10));const ze=this._readableState,wn=Ve;if(Ve>ze.highWaterMark&&(ze.highWaterMark=Et(Ve)),Ve!==0&&(ze.emittedReadable=!1),Ve===0&&ze.needReadable&&((ze.highWaterMark!==0?ze.length>=ze.highWaterMark:ze.length>0)||ze.ended))return O("read: emitReadable",ze.length,ze.ended),ze.length===0&&ze.ended?hn(this):$e(this),null;if(Ve=Ce(Ve,ze),Ve===0&&ze.ended)return ze.length===0&&hn(this),null;let An=ze.needReadable;if(O("need readable",An),(ze.length===0||ze.length-Ve<ze.highWaterMark)&&(An=!0,O("length less than watermark",An)),ze.ended||ze.reading||ze.destroyed||ze.errored||!ze.constructed)An=!1,O("reading, ended or constructing",An);else if(An){O("do read"),ze.reading=!0,ze.sync=!0,ze.length===0&&(ze.needReadable=!0);try{this._read(ze.highWaterMark)}catch(Pn){vn(this,Pn)}ze.sync=!1,ze.reading||(Ve=Ce(wn,ze))}let Tn;return Ve>0?Tn=xe(Ve,ze):Tn=null,Tn===null?(ze.needReadable=ze.length<=ze.highWaterMark,Ve=0):(ze.length-=Ve,ze.multiAwaitDrain?ze.awaitDrainWriters.clear():ze.awaitDrainWriters=null),ze.length===0&&(ze.ended||(ze.needReadable=!0),wn!==Ve&&ze.ended&&hn(this)),Tn!==null&&!ze.errorEmitted&&!ze.closeEmitted&&(ze.dataEmitted=!0,this.emit("data",Tn)),Tn};function ue(Ve,ze){if(O("onEofChunk"),!ze.ended){if(ze.decoder){const wn=ze.decoder.end();wn&&wn.length&&(ze.buffer.push(wn),ze.length+=ze.objectMode?1:wn.length)}ze.ended=!0,ze.sync?$e(Ve):(ze.needReadable=!1,ze.emittedReadable=!0,Ne(Ve))}}function $e(Ve){const ze=Ve._readableState;O("emitReadable",ze.needReadable,ze.emittedReadable),ze.needReadable=!1,ze.emittedReadable||(O("emitReadable",ze.flowing),ze.emittedReadable=!0,u.nextTick(Ne,Ve))}function Ne(Ve){const ze=Ve._readableState;O("emitReadable_",ze.destroyed,ze.length,ze.ended),!ze.destroyed&&!ze.errored&&(ze.length||ze.ended)&&(Ve.emit("readable"),ze.emittedReadable=!1),ze.needReadable=!ze.flowing&&!ze.ended&&ze.length<=ze.highWaterMark,k(Ve)}function Oe(Ve,ze){!ze.readingMore&&ze.constructed&&(ze.readingMore=!0,u.nextTick(Lt,Ve,ze))}function Lt(Ve,ze){for(;!ze.reading&&!ze.ended&&(ze.length<ze.highWaterMark||ze.flowing&&ze.length===0);){const wn=ze.length;if(O("maybeReadMore read 0"),Ve.read(0),wn===ze.length)break}ze.readingMore=!1}he.prototype._read=function(Ve){throw new pe("_read()")},he.prototype.pipe=function(Ve,ze){const wn=this,An=this._readableState;An.pipes.length===1&&(An.multiAwaitDrain||(An.multiAwaitDrain=!0,An.awaitDrainWriters=new _(An.awaitDrainWriters?[An.awaitDrainWriters]:[]))),An.pipes.push(Ve),O("pipe count=%d opts=%j",An.pipes.length,ze);const Pn=(!ze||ze.end!==!1)&&Ve!==u.stdout&&Ve!==u.stderr?Gn:Wn;An.endEmitted?u.nextTick(Pn):wn.once("end",Pn),Ve.on("unpipe",Nn);function Nn(On,Mn){O("onunpipe"),On===wn&&Mn&&Mn.hasUnpiped===!1&&(Mn.hasUnpiped=!0,Jn())}function Gn(){O("onend"),Ve.end()}let Vn,Kn=!1;function Jn(){O("cleanup"),Ve.removeListener("close",Yn),Ve.removeListener("finish",$n),Vn&&Ve.removeListener("drain",Vn),Ve.removeListener("error",zn),Ve.removeListener("unpipe",Nn),wn.removeListener("end",Gn),wn.removeListener("end",Wn),wn.removeListener("data",Fn),Kn=!0,Vn&&An.awaitDrainWriters&&(!Ve._writableState||Ve._writableState.needDrain)&&Vn()}function Xn(){Kn||(An.pipes.length===1&&An.pipes[0]===Ve?(O("false write response, pause",0),An.awaitDrainWriters=Ve,An.multiAwaitDrain=!1):An.pipes.length>1&&An.pipes.includes(Ve)&&(O("false write response, pause",An.awaitDrainWriters.size),An.awaitDrainWriters.add(Ve)),wn.pause()),Vn||(Vn=kt(wn,Ve),Ve.on("drain",Vn))}wn.on("data",Fn);function Fn(On){O("ondata");const Mn=Ve.write(On);O("dest.write",Mn),Mn===!1&&Xn()}function zn(On){if(O("onerror",On),Wn(),Ve.removeListener("error",zn),Ve.listenerCount("error")===0){const Mn=Ve._writableState||Ve._readableState;Mn&&!Mn.errorEmitted?vn(Ve,On):Ve.emit("error",On)}}S(Ve,"error",zn);function Yn(){Ve.removeListener("finish",$n),Wn()}Ve.once("close",Yn);function $n(){O("onfinish"),Ve.removeListener("close",Yn),Wn()}Ve.once("finish",$n);function Wn(){O("unpipe"),wn.unpipe(Ve)}return Ve.emit("pipe",wn),Ve.writableNeedDrain===!0?An.flowing&&Xn():An.flowing||(O("pipe resume"),wn.resume()),Ve};function kt(Ve,ze){return function(){const An=Ve._readableState;An.awaitDrainWriters===ze?(O("pipeOnDrain",1),An.awaitDrainWriters=null):An.multiAwaitDrain&&(O("pipeOnDrain",An.awaitDrainWriters.size),An.awaitDrainWriters.delete(ze)),(!An.awaitDrainWriters||An.awaitDrainWriters.size===0)&&Ve.listenerCount("data")&&Ve.resume()}}he.prototype.unpipe=function(Ve){const ze=this._readableState,wn={hasUnpiped:!1};if(ze.pipes.length===0)return this;if(!Ve){const Tn=ze.pipes;ze.pipes=[],this.pause();for(let Pn=0;Pn<Tn.length;Pn++)Tn[Pn].emit("unpipe",this,{hasUnpiped:!1});return this}const An=c(ze.pipes,Ve);return An===-1?this:(ze.pipes.splice(An,1),ze.pipes.length===0&&this.pause(),Ve.emit("unpipe",this,wn),this)},he.prototype.on=function(Ve,ze){const wn=T.prototype.on.call(this,Ve,ze),An=this._readableState;return Ve==="data"?(An.readableListening=this.listenerCount("readable")>0,An.flowing!==!1&&this.resume()):Ve==="readable"&&!An.endEmitted&&!An.readableListening&&(An.readableListening=An.needReadable=!0,An.flowing=!1,An.emittedReadable=!1,O("on readable",An.length,An.reading),An.length?$e(this):An.reading||u.nextTick(oe,this)),wn},he.prototype.addListener=he.prototype.on,he.prototype.removeListener=function(Ve,ze){const wn=T.prototype.removeListener.call(this,Ve,ze);return Ve==="readable"&&u.nextTick(Cn,this),wn},he.prototype.off=he.prototype.removeListener,he.prototype.removeAllListeners=function(Ve){const ze=T.prototype.removeAllListeners.apply(this,arguments);return(Ve==="readable"||Ve===void 0)&&u.nextTick(Cn,this),ze};function Cn(Ve){const ze=Ve._readableState;ze.readableListening=Ve.listenerCount("readable")>0,ze.resumeScheduled&&ze[At]===!1?ze.flowing=!0:Ve.listenerCount("data")>0?Ve.resume():ze.readableListening||(ze.flowing=null)}function oe(Ve){O("readable nexttick read 0"),Ve.read(0)}he.prototype.resume=function(){const Ve=this._readableState;return Ve.flowing||(O("resume"),Ve.flowing=!Ve.readableListening,ae(this,Ve)),Ve[At]=!1,this};function ae(Ve,ze){ze.resumeScheduled||(ze.resumeScheduled=!0,u.nextTick(Y,Ve,ze))}function Y(Ve,ze){O("resume",ze.reading),ze.reading||Ve.read(0),ze.resumeScheduled=!1,Ve.emit("resume"),k(Ve),ze.flowing&&!ze.reading&&Ve.read(0)}he.prototype.pause=function(){return O("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(O("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[At]=!0,this};function k(Ve){const ze=Ve._readableState;for(O("flow",ze.flowing);ze.flowing&&Ve.read()!==null;);}he.prototype.wrap=function(Ve){let ze=!1;Ve.on("data",An=>{!this.push(An)&&Ve.pause&&(ze=!0,Ve.pause())}),Ve.on("end",()=>{this.push(null)}),Ve.on("error",An=>{vn(this,An)}),Ve.on("close",()=>{this.destroy()}),Ve.on("destroy",()=>{this.destroy()}),this._read=()=>{ze&&Ve.resume&&(ze=!1,Ve.resume())};const wn=g(Ve);for(let An=1;An<wn.length;An++){const Tn=wn[An];this[Tn]===void 0&&typeof Ve[Tn]=="function"&&(this[Tn]=Ve[Tn].bind(Ve))}return this},he.prototype[b]=function(){return D(this)},he.prototype.iterator=function(Ve){return Ve!==void 0&&Ie(Ve,"options"),D(this,Ve)};function D(Ve,ze){typeof Ve.read!="function"&&(Ve=he.wrap(Ve,{objectMode:!0}));const wn=j(Ve,ze);return wn.stream=Ve,wn}async function*j(Ve,ze){let wn=In;function An(Nn){this===Ve?(wn(),wn=In):wn=Nn}Ve.on("readable",An);let Tn;const Pn=M(Ve,{writable:!1},Nn=>{Tn=Nn?re(Tn,Nn):null,wn(),wn=In});try{for(;;){const Nn=Ve.destroyed?null:Ve.read();if(Nn!==null)yield Nn;else{if(Tn)throw Tn;if(Tn===null)return;await new v(An)}}}catch(Nn){throw Tn=re(Tn,Nn),Tn}finally{(Tn||(ze==null?void 0:ze.destroyOnReturn)!==!1)&&(Tn===void 0||Ve._readableState.autoDestroy)?$.destroyer(Ve,null):(Ve.off("readable",An),Pn())}}y(he.prototype,{readable:{__proto__:null,get(){const Ve=this._readableState;return!!Ve&&Ve.readable!==!1&&!Ve.destroyed&&!Ve.errorEmitted&&!Ve.endEmitted},set(Ve){this._readableState&&(this._readableState.readable=!!Ve)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(Ve){this._readableState&&(this._readableState.flowing=Ve)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(Ve){this._readableState&&(this._readableState.destroyed=Ve)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),y(Pt.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[At]!==!1},set(Ve){this[At]=!!Ve}}}),he._fromList=xe;function xe(Ve,ze){if(ze.length===0)return null;let wn;return ze.objectMode?wn=ze.buffer.shift():!Ve||Ve>=ze.length?(ze.decoder?wn=ze.buffer.join(""):ze.buffer.length===1?wn=ze.buffer.first():wn=ze.buffer.concat(ze.length),ze.buffer.clear()):wn=ze.buffer.consume(Ve,ze.decoder),wn}function hn(Ve){const ze=Ve._readableState;O("endReadable",ze.endEmitted),ze.endEmitted||(ze.ended=!0,u.nextTick(_n,ze,Ve))}function _n(Ve,ze){if(O("endReadableNT",Ve.endEmitted,Ve.length),!Ve.errored&&!Ve.closeEmitted&&!Ve.endEmitted&&Ve.length===0){if(Ve.endEmitted=!0,ze.emit("end"),ze.writable&&ze.allowHalfOpen===!1)u.nextTick(Sn,ze);else if(Ve.autoDestroy){const wn=ze._writableState;(!wn||wn.autoDestroy&&(wn.finished||wn.writable===!1))&&ze.destroy()}}}function Sn(Ve){Ve.writable&&!Ve.writableEnded&&!Ve.destroyed&&Ve.end()}he.from=function(Ve,ze){return qe(he,Ve,ze)};let xn;function Ln(){return xn===void 0&&(xn={}),xn}he.fromWeb=function(Ve,ze){return Ln().newStreamReadableFromReadableStream(Ve,ze)},he.toWeb=function(Ve,ze){return Ln().newReadableStreamFromStreamReadable(Ve,ze)},he.wrap=function(Ve,ze){var wn,An;return new he({objectMode:(wn=(An=Ve.readableObjectMode)!==null&&An!==void 0?An:Ve.objectMode)!==null&&wn!==void 0?wn:!0,...ze,destroy(Tn,Pn){$.destroyer(Ve,Tn),Pn(Tn)}}).wrap(Ve)}},{"../../ours/errors":126,"../../ours/primordials":127,"../../ours/util":128,"../validators":124,"./add-abort-signal":107,"./buffer_list":108,"./destroy":110,"./duplex":111,"./end-of-stream":113,"./from":114,"./legacy":115,"./state":120,buffer:29,events:49,"process/":102,string_decoder:28}],120:[function(n,o,a){const{MathFloor:u,NumberIsInteger:c}=n("../../ours/primordials"),{ERR_INVALID_ARG_VALUE:d}=n("../../ours/errors").codes;function f(g,p,v){return g.highWaterMark!=null?g.highWaterMark:p?g[v]:null}function h(g){return g?16:16*1024}function y(g,p,v,_){const b=f(p,_,v);if(b!=null){if(!c(b)||b<0){const A=_?`options.${v}`:"options.highWaterMark";throw new d(A,b)}return u(b)}return h(g.objectMode)}o.exports={getHighWaterMark:y,getDefaultHighWaterMark:h}},{"../../ours/errors":126,"../../ours/primordials":127}],121:[function(n,o,a){const{ObjectSetPrototypeOf:u,Symbol:c}=n("../../ours/primordials");o.exports=g;const{ERR_METHOD_NOT_IMPLEMENTED:d}=n("../../ours/errors").codes,f=n("./duplex"),{getHighWaterMark:h}=n("./state");u(g.prototype,f.prototype),u(g,f);const y=c("kCallback");function g(_){if(!(this instanceof g))return new g(_);const b=_?h(this,_,"readableHighWaterMark",!0):null;b===0&&(_={..._,highWaterMark:null,readableHighWaterMark:b,writableHighWaterMark:_.writableHighWaterMark||0}),f.call(this,_),this._readableState.sync=!1,this[y]=null,_&&(typeof _.transform=="function"&&(this._transform=_.transform),typeof _.flush=="function"&&(this._flush=_.flush)),this.on("prefinish",v)}function p(_){typeof this._flush=="function"&&!this.destroyed?this._flush((b,A)=>{if(b){_?_(b):this.destroy(b);return}A!=null&&this.push(A),this.push(null),_&&_()}):(this.push(null),_&&_())}function v(){this._final!==p&&p.call(this)}g.prototype._final=p,g.prototype._transform=function(_,b,A){throw new d("_transform()")},g.prototype._write=function(_,b,A){const w=this._readableState,T=this._writableState,S=w.length;this._transform(_,b,(x,L)=>{if(x){A(x);return}L!=null&&this.push(L),T.ended||S===w.length||w.length<w.highWaterMark?A():this[y]=A})},g.prototype._read=function(){if(this[y]){const _=this[y];this[y]=null,_()}}},{"../../ours/errors":126,"../../ours/primordials":127,"./duplex":111,"./state":120}],122:[function(n,o,a){const{Symbol:u,SymbolAsyncIterator:c,SymbolIterator:d,SymbolFor:f}=n("../../ours/primordials"),h=u("kDestroyed"),y=u("kIsErrored"),g=u("kIsReadable"),p=u("kIsDisturbed"),v=f("nodejs.webstream.isClosedPromise"),_=f("nodejs.webstream.controllerErrorFunction");function b(he,Ue=!1){var Dt;return!!(he&&typeof he.pipe=="function"&&typeof he.on=="function"&&(!Ue||typeof he.pause=="function"&&typeof he.resume=="function")&&(!he._writableState||((Dt=he._readableState)===null||Dt===void 0?void 0:Dt.readable)!==!1)&&(!he._writableState||he._readableState))}function A(he){var Ue;return!!(he&&typeof he.write=="function"&&typeof he.on=="function"&&(!he._readableState||((Ue=he._writableState)===null||Ue===void 0?void 0:Ue.writable)!==!1))}function w(he){return!!(he&&typeof he.pipe=="function"&&he._readableState&&typeof he.on=="function"&&typeof he.write=="function")}function T(he){return he&&(he._readableState||he._writableState||typeof he.write=="function"&&typeof he.on=="function"||typeof he.pipe=="function"&&typeof he.on=="function")}function S(he){return!!(he&&!T(he)&&typeof he.pipeThrough=="function"&&typeof he.getReader=="function"&&typeof he.cancel=="function")}function x(he){return!!(he&&!T(he)&&typeof he.getWriter=="function"&&typeof he.abort=="function")}function L(he){return!!(he&&!T(he)&&typeof he.readable=="object"&&typeof he.writable=="object")}function M(he){return S(he)||x(he)||L(he)}function O(he,Ue){return he==null?!1:Ue===!0?typeof he[c]=="function":Ue===!1?typeof he[d]=="function":typeof he[c]=="function"||typeof he[d]=="function"}function ie(he){if(!T(he))return null;const Ue=he._writableState,Dt=he._readableState,jt=Ue||Dt;return!!(he.destroyed||he[h]||jt!=null&&jt.destroyed)}function $(he){if(!A(he))return null;if(he.writableEnded===!0)return!0;const Ue=he._writableState;return Ue!=null&&Ue.errored?!1:typeof(Ue==null?void 0:Ue.ended)!="boolean"?null:Ue.ended}function z(he,Ue){if(!A(he))return null;if(he.writableFinished===!0)return!0;const Dt=he._writableState;return Dt!=null&&Dt.errored?!1:typeof(Dt==null?void 0:Dt.finished)!="boolean"?null:!!(Dt.finished||Ue===!1&&Dt.ended===!0&&Dt.length===0)}function V(he){if(!b(he))return null;if(he.readableEnded===!0)return!0;const Ue=he._readableState;return!Ue||Ue.errored?!1:typeof(Ue==null?void 0:Ue.ended)!="boolean"?null:Ue.ended}function re(he,Ue){if(!b(he))return null;const Dt=he._readableState;return Dt!=null&&Dt.errored?!1:typeof(Dt==null?void 0:Dt.endEmitted)!="boolean"?null:!!(Dt.endEmitted||Ue===!1&&Dt.ended===!0&&Dt.length===0)}function F(he){return he&&he[g]!=null?he[g]:typeof(he==null?void 0:he.readable)!="boolean"?null:ie(he)?!1:b(he)&&he.readable&&!re(he)}function pe(he){return typeof(he==null?void 0:he.writable)!="boolean"?null:ie(he)?!1:A(he)&&he.writable&&!$(he)}function le(he,Ue){return T(he)?ie(he)?!0:!((Ue==null?void 0:Ue.readable)!==!1&&F(he)||(Ue==null?void 0:Ue.writable)!==!1&&pe(he)):null}function de(he){var Ue,Dt;return T(he)?he.writableErrored?he.writableErrored:(Ue=(Dt=he._writableState)===null||Dt===void 0?void 0:Dt.errored)!==null&&Ue!==void 0?Ue:null:null}function Fe(he){var Ue,Dt;return T(he)?he.readableErrored?he.readableErrored:(Ue=(Dt=he._readableState)===null||Dt===void 0?void 0:Dt.errored)!==null&&Ue!==void 0?Ue:null:null}function Ie(he){if(!T(he))return null;if(typeof he.closed=="boolean")return he.closed;const Ue=he._writableState,Dt=he._readableState;return typeof(Ue==null?void 0:Ue.closed)=="boolean"||typeof(Dt==null?void 0:Dt.closed)=="boolean"?(Ue==null?void 0:Ue.closed)||(Dt==null?void 0:Dt.closed):typeof he._closed=="boolean"&&At(he)?he._closed:null}function At(he){return typeof he._closed=="boolean"&&typeof he._defaultKeepAlive=="boolean"&&typeof he._removedConnection=="boolean"&&typeof he._removedContLen=="boolean"}function _e(he){return typeof he._sent100=="boolean"&&At(he)}function qe(he){var Ue;return typeof he._consuming=="boolean"&&typeof he._dumped=="boolean"&&((Ue=he.req)===null||Ue===void 0?void 0:Ue.upgradeOrConnect)===void 0}function In(he){if(!T(he))return null;const Ue=he._writableState,Dt=he._readableState,jt=Ue||Dt;return!jt&&_e(he)||!!(jt&&jt.autoDestroy&&jt.emitClose&&jt.closed===!1)}function vn(he){var Ue;return!!(he&&((Ue=he[p])!==null&&Ue!==void 0?Ue:he.readableDidRead||he.readableAborted))}function Pt(he){var Ue,Dt,jt,Et,Ce,ue,$e,Ne,Oe,Lt;return!!(he&&((Ue=(Dt=(jt=(Et=(Ce=(ue=he[y])!==null&&ue!==void 0?ue:he.readableErrored)!==null&&Ce!==void 0?Ce:he.writableErrored)!==null&&Et!==void 0?Et:($e=he._readableState)===null||$e===void 0?void 0:$e.errorEmitted)!==null&&jt!==void 0?jt:(Ne=he._writableState)===null||Ne===void 0?void 0:Ne.errorEmitted)!==null&&Dt!==void 0?Dt:(Oe=he._readableState)===null||Oe===void 0?void 0:Oe.errored)!==null&&Ue!==void 0?Ue:!((Lt=he._writableState)===null||Lt===void 0)&&Lt.errored))}o.exports={kDestroyed:h,isDisturbed:vn,kIsDisturbed:p,isErrored:Pt,kIsErrored:y,isReadable:F,kIsReadable:g,kIsClosedPromise:v,kControllerErrorFunction:_,isClosed:Ie,isDestroyed:ie,isDuplexNodeStream:w,isFinished:le,isIterable:O,isReadableNodeStream:b,isReadableStream:S,isReadableEnded:V,isReadableFinished:re,isReadableErrored:Fe,isNodeStream:T,isWebStream:M,isWritable:pe,isWritableNodeStream:A,isWritableStream:x,isWritableEnded:$,isWritableFinished:z,isWritableErrored:de,isServerRequest:qe,isServerResponse:_e,willEmitClose:In,isTransformStream:L}},{"../../ours/primordials":127}],123:[function(n,o,a){const u=n("process/"),{ArrayPrototypeSlice:c,Error:d,FunctionPrototypeSymbolHasInstance:f,ObjectDefineProperty:h,ObjectDefineProperties:y,ObjectSetPrototypeOf:g,StringPrototypeToLowerCase:p,Symbol:v,SymbolHasInstance:_}=n("../../ours/primordials");o.exports=_e,_e.WritableState=Ie;const{EventEmitter:b}=n("events"),A=n("./legacy").Stream,{Buffer:w}=n("buffer"),T=n("./destroy"),{addAbortSignal:S}=n("./add-abort-signal"),{getHighWaterMark:x,getDefaultHighWaterMark:L}=n("./state"),{ERR_INVALID_ARG_TYPE:M,ERR_METHOD_NOT_IMPLEMENTED:O,ERR_MULTIPLE_CALLBACK:ie,ERR_STREAM_CANNOT_PIPE:$,ERR_STREAM_DESTROYED:z,ERR_STREAM_ALREADY_FINISHED:V,ERR_STREAM_NULL_VALUES:re,ERR_STREAM_WRITE_AFTER_END:F,ERR_UNKNOWN_ENCODING:pe}=n("../../ours/errors").codes,{errorOrDestroy:le}=T;g(_e.prototype,A.prototype),g(_e,A);function de(){}const Fe=v("kOnFinished");function Ie(oe,ae,Y){typeof Y!="boolean"&&(Y=ae instanceof n("./duplex")),this.objectMode=!!(oe&&oe.objectMode),Y&&(this.objectMode=this.objectMode||!!(oe&&oe.writableObjectMode)),this.highWaterMark=oe?x(this,oe,"writableHighWaterMark",Y):L(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const k=!!(oe&&oe.decodeStrings===!1);this.decodeStrings=!k,this.defaultEncoding=oe&&oe.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=he.bind(void 0,ae),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,At(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!oe||oe.emitClose!==!1,this.autoDestroy=!oe||oe.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Fe]=[]}function At(oe){oe.buffered=[],oe.bufferedIndex=0,oe.allBuffers=!0,oe.allNoop=!0}Ie.prototype.getBuffer=function(){return c(this.buffered,this.bufferedIndex)},h(Ie.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function _e(oe){const ae=this instanceof n("./duplex");if(!ae&&!f(_e,this))return new _e(oe);this._writableState=new Ie(oe,this,ae),oe&&(typeof oe.write=="function"&&(this._write=oe.write),typeof oe.writev=="function"&&(this._writev=oe.writev),typeof oe.destroy=="function"&&(this._destroy=oe.destroy),typeof oe.final=="function"&&(this._final=oe.final),typeof oe.construct=="function"&&(this._construct=oe.construct),oe.signal&&S(oe.signal,this)),A.call(this,oe),T.construct(this,()=>{const Y=this._writableState;Y.writing||Et(this,Y),Ne(this,Y)})}h(_e,_,{__proto__:null,value:function(oe){return f(this,oe)?!0:this!==_e?!1:oe&&oe._writableState instanceof Ie}}),_e.prototype.pipe=function(){le(this,new $)};function qe(oe,ae,Y,k){const D=oe._writableState;if(typeof Y=="function")k=Y,Y=D.defaultEncoding;else{if(!Y)Y=D.defaultEncoding;else if(Y!=="buffer"&&!w.isEncoding(Y))throw new pe(Y);typeof k!="function"&&(k=de)}if(ae===null)throw new re;if(!D.objectMode)if(typeof ae=="string")D.decodeStrings!==!1&&(ae=w.from(ae,Y),Y="buffer");else if(ae instanceof w)Y="buffer";else if(A._isUint8Array(ae))ae=A._uint8ArrayToBuffer(ae),Y="buffer";else throw new M("chunk",["string","Buffer","Uint8Array"],ae);let j;return D.ending?j=new F:D.destroyed&&(j=new z("write")),j?(u.nextTick(k,j),le(oe,j,!0),j):(D.pendingcb++,In(oe,D,ae,Y,k))}_e.prototype.write=function(oe,ae,Y){return qe(this,oe,ae,Y)===!0},_e.prototype.cork=function(){this._writableState.corked++},_e.prototype.uncork=function(){const oe=this._writableState;oe.corked&&(oe.corked--,oe.writing||Et(this,oe))},_e.prototype.setDefaultEncoding=function(ae){if(typeof ae=="string"&&(ae=p(ae)),!w.isEncoding(ae))throw new pe(ae);return this._writableState.defaultEncoding=ae,this};function In(oe,ae,Y,k,D){const j=ae.objectMode?1:Y.length;ae.length+=j;const xe=ae.length<ae.highWaterMark;return xe||(ae.needDrain=!0),ae.writing||ae.corked||ae.errored||!ae.constructed?(ae.buffered.push({chunk:Y,encoding:k,callback:D}),ae.allBuffers&&k!=="buffer"&&(ae.allBuffers=!1),ae.allNoop&&D!==de&&(ae.allNoop=!1)):(ae.writelen=j,ae.writecb=D,ae.writing=!0,ae.sync=!0,oe._write(Y,k,ae.onwrite),ae.sync=!1),xe&&!ae.errored&&!ae.destroyed}function vn(oe,ae,Y,k,D,j,xe){ae.writelen=k,ae.writecb=xe,ae.writing=!0,ae.sync=!0,ae.destroyed?ae.onwrite(new z("write")):Y?oe._writev(D,ae.onwrite):oe._write(D,j,ae.onwrite),ae.sync=!1}function Pt(oe,ae,Y,k){--ae.pendingcb,k(Y),jt(ae),le(oe,Y)}function he(oe,ae){const Y=oe._writableState,k=Y.sync,D=Y.writecb;if(typeof D!="function"){le(oe,new ie);return}Y.writing=!1,Y.writecb=null,Y.length-=Y.writelen,Y.writelen=0,ae?(ae.stack,Y.errored||(Y.errored=ae),oe._readableState&&!oe._readableState.errored&&(oe._readableState.errored=ae),k?u.nextTick(Pt,oe,Y,ae,D):Pt(oe,Y,ae,D)):(Y.buffered.length>Y.bufferedIndex&&Et(oe,Y),k?Y.afterWriteTickInfo!==null&&Y.afterWriteTickInfo.cb===D?Y.afterWriteTickInfo.count++:(Y.afterWriteTickInfo={count:1,cb:D,stream:oe,state:Y},u.nextTick(Ue,Y.afterWriteTickInfo)):Dt(oe,Y,1,D))}function Ue({stream:oe,state:ae,count:Y,cb:k}){return ae.afterWriteTickInfo=null,Dt(oe,ae,Y,k)}function Dt(oe,ae,Y,k){for(!ae.ending&&!oe.destroyed&&ae.length===0&&ae.needDrain&&(ae.needDrain=!1,oe.emit("drain"));Y-- >0;)ae.pendingcb--,k();ae.destroyed&&jt(ae),Ne(oe,ae)}function jt(oe){if(oe.writing)return;for(let D=oe.bufferedIndex;D<oe.buffered.length;++D){var ae;const{chunk:j,callback:xe}=oe.buffered[D],hn=oe.objectMode?1:j.length;oe.length-=hn,xe((ae=oe.errored)!==null&&ae!==void 0?ae:new z("write"))}const Y=oe[Fe].splice(0);for(let D=0;D<Y.length;D++){var k;Y[D]((k=oe.errored)!==null&&k!==void 0?k:new z("end"))}At(oe)}function Et(oe,ae){if(ae.corked||ae.bufferProcessing||ae.destroyed||!ae.constructed)return;const{buffered:Y,bufferedIndex:k,objectMode:D}=ae,j=Y.length-k;if(!j)return;let xe=k;if(ae.bufferProcessing=!0,j>1&&oe._writev){ae.pendingcb-=j-1;const hn=ae.allNoop?de:Sn=>{for(let xn=xe;xn<Y.length;++xn)Y[xn].callback(Sn)},_n=ae.allNoop&&xe===0?Y:c(Y,xe);_n.allBuffers=ae.allBuffers,vn(oe,ae,!0,ae.length,_n,"",hn),At(ae)}else{do{const{chunk:hn,encoding:_n,callback:Sn}=Y[xe];Y[xe++]=null;const xn=D?1:hn.length;vn(oe,ae,!1,xn,hn,_n,Sn)}while(xe<Y.length&&!ae.writing);xe===Y.length?At(ae):xe>256?(Y.splice(0,xe),ae.bufferedIndex=0):ae.bufferedIndex=xe}ae.bufferProcessing=!1}_e.prototype._write=function(oe,ae,Y){if(this._writev)this._writev([{chunk:oe,encoding:ae}],Y);else throw new O("_write()")},_e.prototype._writev=null,_e.prototype.end=function(oe,ae,Y){const k=this._writableState;typeof oe=="function"?(Y=oe,oe=null,ae=null):typeof ae=="function"&&(Y=ae,ae=null);let D;if(oe!=null){const j=qe(this,oe,ae);j instanceof d&&(D=j)}return k.corked&&(k.corked=1,this.uncork()),D||(!k.errored&&!k.ending?(k.ending=!0,Ne(this,k,!0),k.ended=!0):k.finished?D=new V("end"):k.destroyed&&(D=new z("end"))),typeof Y=="function"&&(D||k.finished?u.nextTick(Y,D):k[Fe].push(Y)),this};function Ce(oe){return oe.ending&&!oe.destroyed&&oe.constructed&&oe.length===0&&!oe.errored&&oe.buffered.length===0&&!oe.finished&&!oe.writing&&!oe.errorEmitted&&!oe.closeEmitted}function ue(oe,ae){let Y=!1;function k(D){if(Y){le(oe,D??ie());return}if(Y=!0,ae.pendingcb--,D){const j=ae[Fe].splice(0);for(let xe=0;xe<j.length;xe++)j[xe](D);le(oe,D,ae.sync)}else Ce(ae)&&(ae.prefinished=!0,oe.emit("prefinish"),ae.pendingcb++,u.nextTick(Oe,oe,ae))}ae.sync=!0,ae.pendingcb++;try{oe._final(k)}catch(D){k(D)}ae.sync=!1}function $e(oe,ae){!ae.prefinished&&!ae.finalCalled&&(typeof oe._final=="function"&&!ae.destroyed?(ae.finalCalled=!0,ue(oe,ae)):(ae.prefinished=!0,oe.emit("prefinish")))}function Ne(oe,ae,Y){Ce(ae)&&($e(oe,ae),ae.pendingcb===0&&(Y?(ae.pendingcb++,u.nextTick((k,D)=>{Ce(D)?Oe(k,D):D.pendingcb--},oe,ae)):Ce(ae)&&(ae.pendingcb++,Oe(oe,ae))))}function Oe(oe,ae){ae.pendingcb--,ae.finished=!0;const Y=ae[Fe].splice(0);for(let k=0;k<Y.length;k++)Y[k]();if(oe.emit("finish"),ae.autoDestroy){const k=oe._readableState;(!k||k.autoDestroy&&(k.endEmitted||k.readable===!1))&&oe.destroy()}}y(_e.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(oe){this._writableState&&(this._writableState.destroyed=oe)}},writable:{__proto__:null,get(){const oe=this._writableState;return!!oe&&oe.writable!==!1&&!oe.destroyed&&!oe.errored&&!oe.ending&&!oe.ended},set(oe){this._writableState&&(this._writableState.writable=!!oe)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){const oe=this._writableState;return oe?!oe.destroyed&&!oe.ending&&oe.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});const Lt=T.destroy;_e.prototype.destroy=function(oe,ae){const Y=this._writableState;return!Y.destroyed&&(Y.bufferedIndex<Y.buffered.length||Y[Fe].length)&&u.nextTick(jt,Y),Lt.call(this,oe,ae),this},_e.prototype._undestroy=T.undestroy,_e.prototype._destroy=function(oe,ae){ae(oe)},_e.prototype[b.captureRejectionSymbol]=function(oe){this.destroy(oe)};let kt;function Cn(){return kt===void 0&&(kt={}),kt}_e.fromWeb=function(oe,ae){return Cn().newStreamWritableFromWritableStream(oe,ae)},_e.toWeb=function(oe){return Cn().newWritableStreamFromStreamWritable(oe)}},{"../../ours/errors":126,"../../ours/primordials":127,"./add-abort-signal":107,"./destroy":110,"./duplex":111,"./legacy":115,"./state":120,buffer:29,events:49,"process/":102}],124:[function(n,o,a){const{ArrayIsArray:u,ArrayPrototypeIncludes:c,ArrayPrototypeJoin:d,ArrayPrototypeMap:f,NumberIsInteger:h,NumberIsNaN:y,NumberMAX_SAFE_INTEGER:g,NumberMIN_SAFE_INTEGER:p,NumberParseInt:v,ObjectPrototypeHasOwnProperty:_,RegExpPrototypeExec:b,String:A,StringPrototypeToUpperCase:w,StringPrototypeTrim:T}=n("../ours/primordials"),{hideStackFrames:S,codes:{ERR_SOCKET_BAD_PORT:x,ERR_INVALID_ARG_TYPE:L,ERR_INVALID_ARG_VALUE:M,ERR_OUT_OF_RANGE:O,ERR_UNKNOWN_SIGNAL:ie}}=n("../ours/errors"),{normalizeEncoding:$}=n("../ours/util"),{isAsyncFunction:z,isArrayBufferView:V}=n("../ours/util").types,re={};function F(j){return j===(j|0)}function pe(j){return j===j>>>0}const le=/^[0-7]+$/,de="must be a 32-bit unsigned integer or an octal string";function Fe(j,xe,hn){if(typeof j>"u"&&(j=hn),typeof j=="string"){if(b(le,j)===null)throw new M(xe,j,de);j=v(j,8)}return _e(j,xe),j}const Ie=S((j,xe,hn=p,_n=g)=>{if(typeof j!="number")throw new L(xe,"number",j);if(!h(j))throw new O(xe,"an integer",j);if(j<hn||j>_n)throw new O(xe,`>= ${hn} && <= ${_n}`,j)}),At=S((j,xe,hn=-2147483648,_n=2147483647)=>{if(typeof j!="number")throw new L(xe,"number",j);if(!h(j))throw new O(xe,"an integer",j);if(j<hn||j>_n)throw new O(xe,`>= ${hn} && <= ${_n}`,j)}),_e=S((j,xe,hn=!1)=>{if(typeof j!="number")throw new L(xe,"number",j);if(!h(j))throw new O(xe,"an integer",j);const _n=hn?1:0,Sn=4294967295;if(j<_n||j>Sn)throw new O(xe,`>= ${_n} && <= ${Sn}`,j)});function qe(j,xe){if(typeof j!="string")throw new L(xe,"string",j)}function In(j,xe,hn=void 0,_n){if(typeof j!="number")throw new L(xe,"number",j);if(hn!=null&&j<hn||_n!=null&&j>_n||(hn!=null||_n!=null)&&y(j))throw new O(xe,`${hn!=null?`>= ${hn}`:""}${hn!=null&&_n!=null?" && ":""}${_n!=null?`<= ${_n}`:""}`,j)}const vn=S((j,xe,hn)=>{if(!c(hn,j)){const Sn="must be one of: "+d(f(hn,xn=>typeof xn=="string"?`'${xn}'`:A(xn)),", ");throw new M(xe,j,Sn)}});function Pt(j,xe){if(typeof j!="boolean")throw new L(xe,"boolean",j)}function he(j,xe,hn){return j==null||!_(j,xe)?hn:j[xe]}const Ue=S((j,xe,hn=null)=>{const _n=he(hn,"allowArray",!1),Sn=he(hn,"allowFunction",!1);if(!he(hn,"nullable",!1)&&j===null||!_n&&u(j)||typeof j!="object"&&(!Sn||typeof j!="function"))throw new L(xe,"Object",j)}),Dt=S((j,xe)=>{if(j!=null&&typeof j!="object"&&typeof j!="function")throw new L(xe,"a dictionary",j)}),jt=S((j,xe,hn=0)=>{if(!u(j))throw new L(xe,"Array",j);if(j.length<hn){const _n=`must be longer than ${hn}`;throw new M(xe,j,_n)}});function Et(j,xe){jt(j,xe);for(let hn=0;hn<j.length;hn++)qe(j[hn],`${xe}[${hn}]`)}function Ce(j,xe){jt(j,xe);for(let hn=0;hn<j.length;hn++)Pt(j[hn],`${xe}[${hn}]`)}function ue(j,xe="signal"){if(qe(j,xe),re[j]===void 0)throw re[w(j)]!==void 0?new ie(j+" (signals must use all capital letters)"):new ie(j)}const $e=S((j,xe="buffer")=>{if(!V(j))throw new L(xe,["Buffer","TypedArray","DataView"],j)});function Ne(j,xe){const hn=$(xe),_n=j.length;if(hn==="hex"&&_n%2!==0)throw new M("encoding",xe,`is invalid for data of length ${_n}`)}function Oe(j,xe="Port",hn=!0){if(typeof j!="number"&&typeof j!="string"||typeof j=="string"&&T(j).length===0||+j!==+j>>>0||j>65535||j===0&&!hn)throw new x(xe,j,hn);return j|0}const Lt=S((j,xe)=>{if(j!==void 0&&(j===null||typeof j!="object"||!("aborted"in j)))throw new L(xe,"AbortSignal",j)}),kt=S((j,xe)=>{if(typeof j!="function")throw new L(xe,"Function",j)}),Cn=S((j,xe)=>{if(typeof j!="function"||z(j))throw new L(xe,"Function",j)}),oe=S((j,xe)=>{if(j!==void 0)throw new L(xe,"undefined",j)});function ae(j,xe,hn){if(!c(hn,j))throw new L(xe,`('${d(hn,"|")}')`,j)}const Y=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function k(j,xe){if(typeof j>"u"||!b(Y,j))throw new M(xe,j,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function D(j){if(typeof j=="string")return k(j,"hints"),j;if(u(j)){const xe=j.length;let hn="";if(xe===0)return hn;for(let _n=0;_n<xe;_n++){const Sn=j[_n];k(Sn,"hints"),hn+=Sn,_n!==xe-1&&(hn+=", ")}return hn}throw new M("hints",j,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}o.exports={isInt32:F,isUint32:pe,parseFileMode:Fe,validateArray:jt,validateStringArray:Et,validateBooleanArray:Ce,validateBoolean:Pt,validateBuffer:$e,validateDictionary:Dt,validateEncoding:Ne,validateFunction:kt,validateInt32:At,validateInteger:Ie,validateNumber:In,validateObject:Ue,validateOneOf:vn,validatePlainFunction:Cn,validatePort:Oe,validateSignalName:ue,validateString:qe,validateUint32:_e,validateUndefined:oe,validateUnion:ae,validateAbortSignal:Lt,validateLinkHeaderValue:D}},{"../ours/errors":126,"../ours/primordials":127,"../ours/util":128}],125:[function(n,o,a){const u=n("../stream"),c=n("../stream/promises"),d=u.Readable.destroy;o.exports=u.Readable,o.exports._uint8ArrayToBuffer=u._uint8ArrayToBuffer,o.exports._isUint8Array=u._isUint8Array,o.exports.isDisturbed=u.isDisturbed,o.exports.isErrored=u.isErrored,o.exports.isReadable=u.isReadable,o.exports.Readable=u.Readable,o.exports.Writable=u.Writable,o.exports.Duplex=u.Duplex,o.exports.Transform=u.Transform,o.exports.PassThrough=u.PassThrough,o.exports.addAbortSignal=u.addAbortSignal,o.exports.finished=u.finished,o.exports.destroy=u.destroy,o.exports.destroy=d,o.exports.pipeline=u.pipeline,o.exports.compose=u.compose,Object.defineProperty(u,"promises",{configurable:!0,enumerable:!0,get(){return c}}),o.exports.Stream=u.Stream,o.exports.default=o.exports},{"../stream":129,"../stream/promises":130}],126:[function(n,o,a){const{format:u,inspect:c,AggregateError:d}=n("./util"),f=globalThis.AggregateError||d,h=Symbol("kIsNodeError"),y=["string","function","number","object","Function","Object","boolean","bigint","symbol"],g=/^([A-Z][a-z0-9]*)+$/,p="__node_internal_",v={};function _(L,M){if(!L)throw new v.ERR_INTERNAL_ASSERTION(M)}function b(L){let M="",O=L.length;const ie=L[0]==="-"?1:0;for(;O>=ie+4;O-=3)M=`_${L.slice(O-3,O)}${M}`;return`${L.slice(0,O)}${M}`}function A(L,M,O){if(typeof M=="function")return _(M.length<=O.length,`Code: ${L}; The provided arguments length (${O.length}) does not match the required ones (${M.length}).`),M(...O);const ie=(M.match(/%[dfijoOs]/g)||[]).length;return _(ie===O.length,`Code: ${L}; The provided arguments length (${O.length}) does not match the required ones (${ie}).`),O.length===0?M:u(M,...O)}function w(L,M,O){O||(O=Error);class ie extends O{constructor(...z){super(A(L,M,z))}toString(){return`${this.name} [${L}]: ${this.message}`}}Object.defineProperties(ie.prototype,{name:{value:O.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${L}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),ie.prototype.code=L,ie.prototype[h]=!0,v[L]=ie}function T(L){const M=p+L.name;return Object.defineProperty(L,"name",{value:M}),L}function S(L,M){if(L&&M&&L!==M){if(Array.isArray(M.errors))return M.errors.push(L),M;const O=new f([M,L],M.message);return O.code=M.code,O}return L||M}class x extends Error{constructor(M="The operation was aborted",O=void 0){if(O!==void 0&&typeof O!="object")throw new v.ERR_INVALID_ARG_TYPE("options","Object",O);super(M,O),this.code="ABORT_ERR",this.name="AbortError"}}w("ERR_ASSERTION","%s",Error),w("ERR_INVALID_ARG_TYPE",(L,M,O)=>{_(typeof L=="string","'name' must be a string"),Array.isArray(M)||(M=[M]);let ie="The ";L.endsWith(" argument")?ie+=`${L} `:ie+=`"${L}" ${L.includes(".")?"property":"argument"} `,ie+="must be ";const $=[],z=[],V=[];for(const F of M)_(typeof F=="string","All expected entries have to be of type string"),y.includes(F)?$.push(F.toLowerCase()):g.test(F)?z.push(F):(_(F!=="object",'The value "object" should be written as "Object"'),V.push(F));if(z.length>0){const F=$.indexOf("object");F!==-1&&($.splice($,F,1),z.push("Object"))}if($.length>0){switch($.length){case 1:ie+=`of type ${$[0]}`;break;case 2:ie+=`one of type ${$[0]} or ${$[1]}`;break;default:{const F=$.pop();ie+=`one of type ${$.join(", ")}, or ${F}`}}(z.length>0||V.length>0)&&(ie+=" or ")}if(z.length>0){switch(z.length){case 1:ie+=`an instance of ${z[0]}`;break;case 2:ie+=`an instance of ${z[0]} or ${z[1]}`;break;default:{const F=z.pop();ie+=`an instance of ${z.join(", ")}, or ${F}`}}V.length>0&&(ie+=" or ")}switch(V.length){case 0:break;case 1:V[0].toLowerCase()!==V[0]&&(ie+="an "),ie+=`${V[0]}`;break;case 2:ie+=`one of ${V[0]} or ${V[1]}`;break;default:{const F=V.pop();ie+=`one of ${V.join(", ")}, or ${F}`}}if(O==null)ie+=`. Received ${O}`;else if(typeof O=="function"&&O.name)ie+=`. Received function ${O.name}`;else if(typeof O=="object"){var re;if((re=O.constructor)!==null&&re!==void 0&&re.name)ie+=`. Received an instance of ${O.constructor.name}`;else{const F=c(O,{depth:-1});ie+=`. Received ${F}`}}else{let F=c(O,{colors:!1});F.length>25&&(F=`${F.slice(0,25)}...`),ie+=`. Received type ${typeof O} (${F})`}return ie},TypeError),w("ERR_INVALID_ARG_VALUE",(L,M,O="is invalid")=>{let ie=c(M);return ie.length>128&&(ie=ie.slice(0,128)+"..."),`The ${L.includes(".")?"property":"argument"} '${L}' ${O}. Received ${ie}`},TypeError),w("ERR_INVALID_RETURN_VALUE",(L,M,O)=>{var ie;const $=O!=null&&(ie=O.constructor)!==null&&ie!==void 0&&ie.name?`instance of ${O.constructor.name}`:`type ${typeof O}`;return`Expected ${L} to be returned from the "${M}" function but got ${$}.`},TypeError),w("ERR_MISSING_ARGS",(...L)=>{_(L.length>0,"At least one arg needs to be specified");let M;const O=L.length;switch(L=(Array.isArray(L)?L:[L]).map(ie=>`"${ie}"`).join(" or "),O){case 1:M+=`The ${L[0]} argument`;break;case 2:M+=`The ${L[0]} and ${L[1]} arguments`;break;default:{const ie=L.pop();M+=`The ${L.join(", ")}, and ${ie} arguments`}break}return`${M} must be specified`},TypeError),w("ERR_OUT_OF_RANGE",(L,M,O)=>{_(M,'Missing "range" argument');let ie;return Number.isInteger(O)&&Math.abs(O)>2**32?ie=b(String(O)):typeof O=="bigint"?(ie=String(O),(O>2n**32n||O<-(2n**32n))&&(ie=b(ie)),ie+="n"):ie=c(O),`The value of "${L}" is out of range. It must be ${M}. Received ${ie}`},RangeError),w("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),w("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),w("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),w("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),w("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),w("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),w("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),w("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),w("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),w("ERR_STREAM_WRITE_AFTER_END","write after end",Error),w("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),o.exports={AbortError:x,aggregateTwoErrors:T(S),hideStackFrames:T,codes:v}},{"./util":128}],127:[function(n,o,a){o.exports={ArrayIsArray(u){return Array.isArray(u)},ArrayPrototypeIncludes(u,c){return u.includes(c)},ArrayPrototypeIndexOf(u,c){return u.indexOf(c)},ArrayPrototypeJoin(u,c){return u.join(c)},ArrayPrototypeMap(u,c){return u.map(c)},ArrayPrototypePop(u,c){return u.pop(c)},ArrayPrototypePush(u,c){return u.push(c)},ArrayPrototypeSlice(u,c,d){return u.slice(c,d)},Error,FunctionPrototypeCall(u,c,...d){return u.call(c,...d)},FunctionPrototypeSymbolHasInstance(u,c){return Function.prototype[Symbol.hasInstance].call(u,c)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(u,c){return Object.defineProperties(u,c)},ObjectDefineProperty(u,c,d){return Object.defineProperty(u,c,d)},ObjectGetOwnPropertyDescriptor(u,c){return Object.getOwnPropertyDescriptor(u,c)},ObjectKeys(u){return Object.keys(u)},ObjectSetPrototypeOf(u,c){return Object.setPrototypeOf(u,c)},Promise,PromisePrototypeCatch(u,c){return u.catch(c)},PromisePrototypeThen(u,c,d){return u.then(c,d)},PromiseReject(u){return Promise.reject(u)},ReflectApply:Reflect.apply,RegExpPrototypeTest(u,c){return u.test(c)},SafeSet:Set,String,StringPrototypeSlice(u,c,d){return u.slice(c,d)},StringPrototypeToLowerCase(u){return u.toLowerCase()},StringPrototypeToUpperCase(u){return u.toUpperCase()},StringPrototypeTrim(u){return u.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet(u,c,d){return u.set(c,d)},Uint8Array}},{}],128:[function(n,o,a){const u=n("buffer"),c=Object.getPrototypeOf(async function(){}).constructor,d=globalThis.Blob||u.Blob,f=typeof d<"u"?function(g){return g instanceof d}:function(g){return!1};class h extends Error{constructor(g){if(!Array.isArray(g))throw new TypeError(`Expected input to be an Array, got ${typeof g}`);let p="";for(let v=0;v<g.length;v++)p+=` ${g[v].stack}
|
273
273
|
`;super(p),this.name="AggregateError",this.errors=g}}o.exports={AggregateError:h,kEmptyObject:Object.freeze({}),once(y){let g=!1;return function(...p){g||(g=!0,y.apply(this,p))}},createDeferredPromise:function(){let y,g;return{promise:new Promise((v,_)=>{y=v,g=_}),resolve:y,reject:g}},promisify(y){return new Promise((g,p)=>{y((v,..._)=>v?p(v):g(..._))})},debuglog(){return function(){}},format(y,...g){return y.replace(/%([sdifj])/g,function(...[p,v]){const _=g.shift();return v==="f"?_.toFixed(6):v==="j"?JSON.stringify(_):v==="s"&&typeof _=="object"?`${_.constructor!==Object?_.constructor.name:""} {}`.trim():_.toString()})},inspect(y){switch(typeof y){case"string":if(y.includes("'"))if(y.includes('"')){if(!y.includes("`")&&!y.includes("${"))return`\`${y}\``}else return`"${y}"`;return`'${y}'`;case"number":return isNaN(y)?"NaN":Object.is(y,-0)?String(y):y;case"bigint":return`${String(y)}n`;case"boolean":case"undefined":return String(y);case"object":return"{}"}},types:{isAsyncFunction(y){return y instanceof c},isArrayBufferView(y){return ArrayBuffer.isView(y)}},isBlob:f},o.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")},{buffer:29}],129:[function(n,o,a){const{Buffer:u}=n("buffer"),{ObjectDefineProperty:c,ObjectKeys:d,ReflectApply:f}=n("./ours/primordials"),{promisify:{custom:h}}=n("./ours/util"),{streamReturningOperators:y,promiseReturningOperators:g}=n("./internal/streams/operators"),{codes:{ERR_ILLEGAL_CONSTRUCTOR:p}}=n("./ours/errors"),v=n("./internal/streams/compose"),{pipeline:_}=n("./internal/streams/pipeline"),{destroyer:b}=n("./internal/streams/destroy"),A=n("./internal/streams/end-of-stream"),w=n("./stream/promises"),T=n("./internal/streams/utils"),S=o.exports=n("./internal/streams/legacy").Stream;S.isDisturbed=T.isDisturbed,S.isErrored=T.isErrored,S.isReadable=T.isReadable,S.Readable=n("./internal/streams/readable");for(const L of d(y)){let O=function(...ie){if(new.target)throw p();return S.Readable.from(f(M,this,ie))};const M=y[L];c(O,"name",{__proto__:null,value:M.name}),c(O,"length",{__proto__:null,value:M.length}),c(S.Readable.prototype,L,{__proto__:null,value:O,enumerable:!1,configurable:!0,writable:!0})}for(const L of d(g)){let O=function(...ie){if(new.target)throw p();return f(M,this,ie)};const M=g[L];c(O,"name",{__proto__:null,value:M.name}),c(O,"length",{__proto__:null,value:M.length}),c(S.Readable.prototype,L,{__proto__:null,value:O,enumerable:!1,configurable:!0,writable:!0})}S.Writable=n("./internal/streams/writable"),S.Duplex=n("./internal/streams/duplex"),S.Transform=n("./internal/streams/transform"),S.PassThrough=n("./internal/streams/passthrough"),S.pipeline=_;const{addAbortSignal:x}=n("./internal/streams/add-abort-signal");S.addAbortSignal=x,S.finished=A,S.destroy=b,S.compose=v,c(S,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return w}}),c(_,h,{__proto__:null,enumerable:!0,get(){return w.pipeline}}),c(A,h,{__proto__:null,enumerable:!0,get(){return w.finished}}),S.Stream=S,S._isUint8Array=function(M){return M instanceof Uint8Array},S._uint8ArrayToBuffer=function(M){return u.from(M.buffer,M.byteOffset,M.byteLength)}},{"./internal/streams/add-abort-signal":107,"./internal/streams/compose":109,"./internal/streams/destroy":110,"./internal/streams/duplex":111,"./internal/streams/end-of-stream":113,"./internal/streams/legacy":115,"./internal/streams/operators":116,"./internal/streams/passthrough":117,"./internal/streams/pipeline":118,"./internal/streams/readable":119,"./internal/streams/transform":121,"./internal/streams/utils":122,"./internal/streams/writable":123,"./ours/errors":126,"./ours/primordials":127,"./ours/util":128,"./stream/promises":130,buffer:29}],130:[function(n,o,a){const{ArrayPrototypePop:u,Promise:c}=n("../ours/primordials"),{isIterable:d,isNodeStream:f,isWebStream:h}=n("../internal/streams/utils"),{pipelineImpl:y}=n("../internal/streams/pipeline"),{finished:g}=n("../internal/streams/end-of-stream");n("../../lib/stream.js");function p(...v){return new c((_,b)=>{let A,w;const T=v[v.length-1];if(T&&typeof T=="object"&&!f(T)&&!d(T)&&!h(T)){const S=u(v);A=S.signal,w=S.end}y(v,(S,x)=>{S?b(S):_(x)},{signal:A,end:w})})}o.exports={finished:g,pipeline:p}},{"../../lib/stream.js":129,"../internal/streams/end-of-stream":113,"../internal/streams/pipeline":118,"../internal/streams/utils":122,"../ours/primordials":127}],131:[function(n,o,a){function u(d,f,h){var y=this;this._callback=d,this._args=h,this._interval=setInterval(d,f,this._args),this.reschedule=function(g){g||(g=y._interval),y._interval&&clearInterval(y._interval),y._interval=setInterval(y._callback,g,y._args)},this.clear=function(){y._interval&&(clearInterval(y._interval),y._interval=void 0)},this.destroy=function(){y._interval&&clearInterval(y._interval),y._callback=void 0,y._interval=void 0,y._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 d;if(arguments.length>0){d=new Array(arguments.length-2);for(var f=0;f<d.length;f++)d[f]=arguments[f+2]}return new u(arguments[0],arguments[1],d)}o.exports=c},{}],132:[function(n,o,a){o.exports=n("./index.js")()},{"./index.js":133}],133:[function(n,o,a){(function(u){(function(){o.exports=d;function c(h){return h instanceof u?u.from(h):new h.constructor(h.buffer.slice(),h.byteOffset,h.length)}function d(h){if(h=h||{},h.circles)return f(h);return h.proto?p:g;function y(v,_){for(var b=Object.keys(v),A=new Array(b.length),w=0;w<b.length;w++){var T=b[w],S=v[T];typeof S!="object"||S===null?A[T]=S:S instanceof Date?A[T]=new Date(S):ArrayBuffer.isView(S)?A[T]=c(S):A[T]=_(S)}return A}function g(v){if(typeof v!="object"||v===null)return v;if(v instanceof Date)return new Date(v);if(Array.isArray(v))return y(v,g);if(v instanceof Map)return new Map(y(Array.from(v),g));if(v instanceof Set)return new Set(y(Array.from(v),g));var _={};for(var b in v)if(Object.hasOwnProperty.call(v,b)!==!1){var A=v[b];typeof A!="object"||A===null?_[b]=A:A instanceof Date?_[b]=new Date(A):A instanceof Map?_[b]=new Map(y(Array.from(A),g)):A instanceof Set?_[b]=new Set(y(Array.from(A),g)):ArrayBuffer.isView(A)?_[b]=c(A):_[b]=g(A)}return _}function p(v){if(typeof v!="object"||v===null)return v;if(v instanceof Date)return new Date(v);if(Array.isArray(v))return y(v,p);if(v instanceof Map)return new Map(y(Array.from(v),p));if(v instanceof Set)return new Set(y(Array.from(v),p));var _={};for(var b in v){var A=v[b];typeof A!="object"||A===null?_[b]=A:A instanceof Date?_[b]=new Date(A):A instanceof Map?_[b]=new Map(y(Array.from(A),p)):A instanceof Set?_[b]=new Set(y(Array.from(A),p)):ArrayBuffer.isView(A)?_[b]=c(A):_[b]=p(A)}return _}}function f(h){var y=[],g=[];return h.proto?_:v;function p(b,A){for(var w=Object.keys(b),T=new Array(w.length),S=0;S<w.length;S++){var x=w[S],L=b[x];if(typeof L!="object"||L===null)T[x]=L;else if(L instanceof Date)T[x]=new Date(L);else if(ArrayBuffer.isView(L))T[x]=c(L);else{var M=y.indexOf(L);M!==-1?T[x]=g[M]:T[x]=A(L)}}return T}function v(b){if(typeof b!="object"||b===null)return b;if(b instanceof Date)return new Date(b);if(Array.isArray(b))return p(b,v);if(b instanceof Map)return new Map(p(Array.from(b),v));if(b instanceof Set)return new Set(p(Array.from(b),v));var A={};y.push(b),g.push(A);for(var w in b)if(Object.hasOwnProperty.call(b,w)!==!1){var T=b[w];if(typeof T!="object"||T===null)A[w]=T;else if(T instanceof Date)A[w]=new Date(T);else if(T instanceof Map)A[w]=new Map(p(Array.from(T),v));else if(T instanceof Set)A[w]=new Set(p(Array.from(T),v));else if(ArrayBuffer.isView(T))A[w]=c(T);else{var S=y.indexOf(T);S!==-1?A[w]=g[S]:A[w]=v(T)}}return y.pop(),g.pop(),A}function _(b){if(typeof b!="object"||b===null)return b;if(b instanceof Date)return new Date(b);if(Array.isArray(b))return p(b,_);if(b instanceof Map)return new Map(p(Array.from(b),_));if(b instanceof Set)return new Set(p(Array.from(b),_));var A={};y.push(b),g.push(A);for(var w in b){var T=b[w];if(typeof T!="object"||T===null)A[w]=T;else if(T instanceof Date)A[w]=new Date(T);else if(T instanceof Map)A[w]=new Map(p(Array.from(T),_));else if(T instanceof Set)A[w]=new Set(p(Array.from(T),_));else if(ArrayBuffer.isView(T))A[w]=c(T);else{var S=y.indexOf(T);S!==-1?A[w]=g[S]:A[w]=_(T)}}return y.pop(),g.pop(),A}}}).call(this)}).call(this,n("buffer").Buffer)},{buffer:29}],134:[function(n,o,a){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var u=n("buffer"),c=u.Buffer;function d(h,y){for(var g in h)y[g]=h[g]}c.from&&c.alloc&&c.allocUnsafe&&c.allocUnsafeSlow?o.exports=u:(d(u,a),a.Buffer=f);function f(h,y,g){return c(h,y,g)}f.prototype=Object.create(c.prototype),d(c,f),f.from=function(h,y,g){if(typeof h=="number")throw new TypeError("Argument must not be a number");return c(h,y,g)},f.alloc=function(h,y,g){if(typeof h!="number")throw new TypeError("Argument must be a number");var p=c(h);return y!==void 0?typeof g=="string"?p.fill(y,g):p.fill(y):p.fill(0),p},f.allocUnsafe=function(h){if(typeof h!="number")throw new TypeError("Argument must be a number");return c(h)},f.allocUnsafeSlow=function(h){if(typeof h!="number")throw new TypeError("Argument must be a number");return u.SlowBuffer(h)}},{buffer:29}],135:[function(n,o,a){o.exports=u;function u(d){var f=d._readableState;return f?f.objectMode||typeof d._duplexState=="number"?d.read():d.read(c(f)):null}function c(d){return d.buffer.length?d.buffer.head?d.buffer.head.data.length:d.buffer[0].length:d.length}},{}],136:[function(n,o,a){arguments[4][28][0].apply(a,arguments)},{dup:28,"safe-buffer":134}],137:[function(n,o,a){var u=n("punycode"),c=n("./util");a.parse=O,a.resolve=$,a.resolveObject=z,a.format=ie,a.Url=d;function d(){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 f=/^([a-z0-9.+-]+:)/i,h=/:[0-9]*$/,y=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,g=["<",">",'"',"`"," ","\r",`
|
274
|
-
`," "],p=["{","}","|","\\","^","`"].concat(g),v=["'"].concat(p),_=["%","/","?",";","#"].concat(v),b=["/","?","#"],A=255,w=/^[+a-z0-9A-Z_-]{0,63}$/,T=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,S={javascript:!0,"javascript:":!0},x={javascript:!0,"javascript:":!0},L={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},M=n("querystring");function O(V,re,F){if(V&&c.isObject(V)&&V instanceof d)return V;var pe=new d;return pe.parse(V,re,F),pe}d.prototype.parse=function(V,re,F){if(!c.isString(V))throw new TypeError("Parameter 'url' must be a string, not "+typeof V);var pe=V.indexOf("?"),le=pe!==-1&&pe<V.indexOf("#")?"?":"#",de=V.split(le),Fe=/\\/g;de[0]=de[0].replace(Fe,"/"),V=de.join(le);var Ie=V;if(Ie=Ie.trim(),!F&&V.split("#").length===1){var At=y.exec(Ie);if(At)return this.path=Ie,this.href=Ie,this.pathname=At[1],At[2]?(this.search=At[2],re?this.query=M.parse(this.search.substr(1)):this.query=this.search.substr(1)):re&&(this.search="",this.query={}),this}var _e=f.exec(Ie);if(_e){_e=_e[0];var qe=_e.toLowerCase();this.protocol=qe,Ie=Ie.substr(_e.length)}if(F||_e||Ie.match(/^\/\/[^@\/]+@[^@\/]+/)){var In=Ie.substr(0,2)==="//";In&&!(_e&&x[_e])&&(Ie=Ie.substr(2),this.slashes=!0)}if(!x[_e]&&(In||_e&&!L[_e])){for(var vn=-1,Pt=0;Pt<b.length;Pt++){var he=Ie.indexOf(b[Pt]);he!==-1&&(vn===-1||he<vn)&&(vn=he)}var Ue,Dt;vn===-1?Dt=Ie.lastIndexOf("@"):Dt=Ie.lastIndexOf("@",vn),Dt!==-1&&(Ue=Ie.slice(0,Dt),Ie=Ie.slice(Dt+1),this.auth=decodeURIComponent(Ue)),vn=-1;for(var Pt=0;Pt<_.length;Pt++){var he=Ie.indexOf(_[Pt]);he!==-1&&(vn===-1||he<vn)&&(vn=he)}vn===-1&&(vn=Ie.length),this.host=Ie.slice(0,vn),Ie=Ie.slice(vn),this.parseHost(),this.hostname=this.hostname||"";var jt=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!jt)for(var Et=this.hostname.split(/\./),Pt=0,Ce=Et.length;Pt<Ce;Pt++){var ue=Et[Pt];if(ue&&!ue.match(w)){for(var $e="",Ne=0,Oe=ue.length;Ne<Oe;Ne++)ue.charCodeAt(Ne)>127?$e+="x":$e+=ue[Ne];if(!$e.match(w)){var Lt=Et.slice(0,Pt),kt=Et.slice(Pt+1),Cn=ue.match(T);Cn&&(Lt.push(Cn[1]),kt.unshift(Cn[2])),kt.length&&(Ie="/"+kt.join(".")+Ie),this.hostname=Lt.join(".");break}}}this.hostname.length>A?this.hostname="":this.hostname=this.hostname.toLowerCase(),jt||(this.hostname=u.toASCII(this.hostname));var oe=this.port?":"+this.port:"",ae=this.hostname||"";this.host=ae+oe,this.href+=this.host,jt&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),Ie[0]!=="/"&&(Ie="/"+Ie))}if(!S[qe])for(var Pt=0,Ce=v.length;Pt<Ce;Pt++){var Y=v[Pt];if(Ie.indexOf(Y)!==-1){var k=encodeURIComponent(Y);k===Y&&(k=escape(Y)),Ie=Ie.split(Y).join(k)}}var D=Ie.indexOf("#");D!==-1&&(this.hash=Ie.substr(D),Ie=Ie.slice(0,D));var j=Ie.indexOf("?");if(j!==-1?(this.search=Ie.substr(j),this.query=Ie.substr(j+1),re&&(this.query=M.parse(this.query)),Ie=Ie.slice(0,j)):re&&(this.search="",this.query={}),Ie&&(this.pathname=Ie),L[qe]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var oe=this.pathname||"",xe=this.search||"";this.path=oe+xe}return this.href=this.format(),this};function ie(V){return c.isString(V)&&(V=O(V)),V instanceof d?V.format():d.prototype.format.call(V)}d.prototype.format=function(){var V=this.auth||"";V&&(V=encodeURIComponent(V),V=V.replace(/%3A/i,":"),V+="@");var re=this.protocol||"",F=this.pathname||"",pe=this.hash||"",le=!1,de="";this.host?le=V+this.host:this.hostname&&(le=V+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(le+=":"+this.port)),this.query&&c.isObject(this.query)&&Object.keys(this.query).length&&(de=M.stringify(this.query));var Fe=this.search||de&&"?"+de||"";return re&&re.substr(-1)!==":"&&(re+=":"),this.slashes||(!re||L[re])&&le!==!1?(le="//"+(le||""),F&&F.charAt(0)!=="/"&&(F="/"+F)):le||(le=""),pe&&pe.charAt(0)!=="#"&&(pe="#"+pe),Fe&&Fe.charAt(0)!=="?"&&(Fe="?"+Fe),F=F.replace(/[?#]/g,function(Ie){return encodeURIComponent(Ie)}),Fe=Fe.replace("#","%23"),re+le+F+Fe+pe};function $(V,re){return O(V,!1,!0).resolve(re)}d.prototype.resolve=function(V){return this.resolveObject(O(V,!1,!0)).format()};function z(V,re){return V?O(V,!1,!0).resolveObject(re):re}d.prototype.resolveObject=function(V){if(c.isString(V)){var re=new d;re.parse(V,!1,!0),V=re}for(var F=new d,pe=Object.keys(this),le=0;le<pe.length;le++){var de=pe[le];F[de]=this[de]}if(F.hash=V.hash,V.href==="")return F.href=F.format(),F;if(V.slashes&&!V.protocol){for(var Fe=Object.keys(V),Ie=0;Ie<Fe.length;Ie++){var At=Fe[Ie];At!=="protocol"&&(F[At]=V[At])}return L[F.protocol]&&F.hostname&&!F.pathname&&(F.path=F.pathname="/"),F.href=F.format(),F}if(V.protocol&&V.protocol!==F.protocol){if(!L[V.protocol]){for(var _e=Object.keys(V),qe=0;qe<_e.length;qe++){var In=_e[qe];F[In]=V[In]}return F.href=F.format(),F}if(F.protocol=V.protocol,!V.host&&!x[V.protocol]){for(var Ce=(V.pathname||"").split("/");Ce.length&&!(V.host=Ce.shift()););V.host||(V.host=""),V.hostname||(V.hostname=""),Ce[0]!==""&&Ce.unshift(""),Ce.length<2&&Ce.unshift(""),F.pathname=Ce.join("/")}else F.pathname=V.pathname;if(F.search=V.search,F.query=V.query,F.host=V.host||"",F.auth=V.auth,F.hostname=V.hostname||V.host,F.port=V.port,F.pathname||F.search){var vn=F.pathname||"",Pt=F.search||"";F.path=vn+Pt}return F.slashes=F.slashes||V.slashes,F.href=F.format(),F}var he=F.pathname&&F.pathname.charAt(0)==="/",Ue=V.host||V.pathname&&V.pathname.charAt(0)==="/",Dt=Ue||he||F.host&&V.pathname,jt=Dt,Et=F.pathname&&F.pathname.split("/")||[],Ce=V.pathname&&V.pathname.split("/")||[],ue=F.protocol&&!L[F.protocol];if(ue&&(F.hostname="",F.port=null,F.host&&(Et[0]===""?Et[0]=F.host:Et.unshift(F.host)),F.host="",V.protocol&&(V.hostname=null,V.port=null,V.host&&(Ce[0]===""?Ce[0]=V.host:Ce.unshift(V.host)),V.host=null),Dt=Dt&&(Ce[0]===""||Et[0]==="")),Ue)F.host=V.host||V.host===""?V.host:F.host,F.hostname=V.hostname||V.hostname===""?V.hostname:F.hostname,F.search=V.search,F.query=V.query,Et=Ce;else if(Ce.length)Et||(Et=[]),Et.pop(),Et=Et.concat(Ce),F.search=V.search,F.query=V.query;else if(!c.isNullOrUndefined(V.search)){if(ue){F.hostname=F.host=Et.shift();var $e=F.host&&F.host.indexOf("@")>0?F.host.split("@"):!1;$e&&(F.auth=$e.shift(),F.host=F.hostname=$e.shift())}return F.search=V.search,F.query=V.query,(!c.isNull(F.pathname)||!c.isNull(F.search))&&(F.path=(F.pathname?F.pathname:"")+(F.search?F.search:"")),F.href=F.format(),F}if(!Et.length)return F.pathname=null,F.search?F.path="/"+F.search:F.path=null,F.href=F.format(),F;for(var Ne=Et.slice(-1)[0],Oe=(F.host||V.host||Et.length>1)&&(Ne==="."||Ne==="..")||Ne==="",Lt=0,kt=Et.length;kt>=0;kt--)Ne=Et[kt],Ne==="."?Et.splice(kt,1):Ne===".."?(Et.splice(kt,1),Lt++):Lt&&(Et.splice(kt,1),Lt--);if(!Dt&&!jt)for(;Lt--;Lt)Et.unshift("..");Dt&&Et[0]!==""&&(!Et[0]||Et[0].charAt(0)!=="/")&&Et.unshift(""),Oe&&Et.join("/").substr(-1)!=="/"&&Et.push("");var Cn=Et[0]===""||Et[0]&&Et[0].charAt(0)==="/";if(ue){F.hostname=F.host=Cn?"":Et.length?Et.shift():"";var $e=F.host&&F.host.indexOf("@")>0?F.host.split("@"):!1;$e&&(F.auth=$e.shift(),F.host=F.hostname=$e.shift())}return Dt=Dt||F.host&&Et.length,Dt&&!Cn&&Et.unshift(""),Et.length?F.pathname=Et.join("/"):(F.pathname=null,F.path=null),(!c.isNull(F.pathname)||!c.isNull(F.search))&&(F.path=(F.pathname?F.pathname:"")+(F.search?F.search:"")),F.auth=V.auth||F.auth,F.slashes=F.slashes||V.slashes,F.href=F.format(),F},d.prototype.parseHost=function(){var V=this.host,re=h.exec(V);re&&(re=re[0],re!==":"&&(this.port=re.substr(1)),V=V.substr(0,V.length-re.length)),V&&(this.hostname=V)}},{"./util":138,punycode:103,querystring:106}],138:[function(n,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}}},{}],139:[function(n,o,a){(function(u){(function(){o.exports=c;function c(f,h){if(d("noDeprecation"))return f;var y=!1;function g(){if(!y){if(d("throwDeprecation"))throw new Error(h);d("traceDeprecation")?console.trace(h):console.warn(h),y=!0}return f.apply(this,arguments)}return g}function d(f){try{if(!u.localStorage)return!1}catch{return!1}var h=u.localStorage[f];return h==null?!1:String(h).toLowerCase()==="true"}}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],140:[function(n,o,a){o.exports=u;function u(c,d){if(c&&d)return u(c)(d);if(typeof c!="function")throw new TypeError("need wrapper function");return Object.keys(c).forEach(function(h){f[h]=c[h]}),f;function f(){for(var h=new Array(arguments.length),y=0;y<h.length;y++)h[y]=arguments[y];var g=c.apply(this,h),p=h[h.length-1];return typeof g=="function"&&g!==p&&Object.keys(p).forEach(function(v){g[v]=p[v]}),g}}},{}],141:[function(n,o,a){o.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}]},{},[23])(23)})})(mqtt);var mqttExports=mqtt.exports;let client;const sub=(i,r,n,o,a)=>{const u=i.trim();if(!/^wss?:\/\/.*$/.test(u)){console.error('编辑器MQTT通信只支持ws协议 (url必须以"ws://"开头)');return}client=mqttExports.connect(u,{username:r.trim(),password:n.trim(),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={class:"coverLayer"},_hoisted_2={xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%"},_hoisted_3=["transform"],_hoisted_4=["transform","onClick"],_hoisted_5=["transform"],_hoisted_6=["xlink:href","width","height","id","transform"],_hoisted_7=["id"],_hoisted_8={class:"can-not-select canvasInfoTxt"},_sfc_main=vue.defineComponent({__name:"svg-viewer",props:{vueComp:{},data:{},canvasDrag:{type:Boolean,default:!0},showCanvasInfo:{type:Boolean,default:!0}},emits:["onMessage","onEvent"],setup(i,{expose:r,emit:n}){vue.useCssVars(S=>({"5af92a76":vue.unref(d)})),setEditorLoadTime();const o=n,a=i,u=useGlobalStore(pinia);componentsRegister(a.vueComp);const c=vue.reactive(a.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:[]}),d=vue.computed(()=>u.intention==EGlobalStoreIntention.MoveCanvas?"grab":"default"),f=S=>{if(u.mouse_info.state!=EMouseInfoState.Down&&u.intention!==EGlobalStoreIntention.Connection||!a.canvasDrag)return;const{clientX:x,clientY:L}=S;u.mouse_info.new_position_x=Math.round(x/c.config.svg.scale),u.mouse_info.new_position_y=Math.round(L/c.config.svg.scale);const M=Math.round(u.mouse_info.new_position_x-u.mouse_info.position_x+u.mouse_info.now_position_x),O=Math.round(u.mouse_info.new_position_y-u.mouse_info.position_y+u.mouse_info.now_position_y);u.intention==EGlobalStoreIntention.MoveCanvas&&(c.layout_center.x=M,c.layout_center.y=O)},h=()=>{u.mouse_info.state==EMouseInfoState.Down&&(u.intention!=EGlobalStoreIntention.Select&&(u.intention=EGlobalStoreIntention.None),u.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})},y=S=>{const{clientX:x,clientY:L}=S;u.intention=EGlobalStoreIntention.MoveCanvas,u.mouse_info={state:EMouseInfoState.Down,position_x:Math.round(x/c.config.svg.scale),position_y:Math.round(L/c.config.svg.scale),now_position_x:c.layout_center.x,now_position_y:c.layout_center.y,new_position_x:0,new_position_y:0}};function g(S){S!=null&&S.wheelDelta&&(S.wheelDelta>0?(c.config.svg.scale=myFixed(c.config.svg.scale+.1,1),getZoomPosition(S,c.config.svg.scale,c.layout_center,!0)):(c.config.svg.scale=myFixed(c.config.svg.scale-.1,1),getZoomPosition(S,c.config.svg.scale,c.layout_center,!1)))}const p=(S,x,L)=>({x:S.x-S.width/2*x+S.width/2,y:S.y-S.height/2*L+S.height/2,width:S.width*x,height:S.height*L}),v=S=>{var L;let x=!1;if(((L=S.events)==null?void 0:L.length)>0){for(let M of S.events)if(M.type===EEventType.Click){x=!0;break}}return{cursor:x?"pointer":"default"}},_=(S,x)=>{var L;if(((L=S.events)==null?void 0:L.length)>0){for(let M of S.events)if(M.type===x){if(M.condition&&M.condition.type!=="None"&&M.condition.type==="Relation"&&M.condition.Relation&&M.condition.Relation.relation){const O=M.condition.Relation.key,ie=M.condition.Relation.relation,$=valFormat(M.condition.Relation.val),z=valFormat(M.condition.Relation.val2);if(S.props.hasOwnProperty(O)){const V=S.props[O].val;if(!b(V,ie,$,z))continue}}if(M.action===EEventAction.ChangeAttr){if(M.attrs&&M.attrs.length>0){let O;if(M.target){for(let ie of c.done_json)if(ie.id===M.target){O=ie;break}}else O=S;if(!O)continue;for(let ie of M.attrs)ie.key==="state"?O.defaultState=valFormat(ie.val):O.props.hasOwnProperty(ie.key)&&(O.props[ie.key].val=valFormat(ie.val))}}else if(M.action===EEventAction.JavaScript)new Function(M.scripts)();else if(M.action===EEventAction.Emit){const O=["id","name","common_animations","display","props","title","type","x","y"],ie={};O.forEach($=>{var z;(z=S==null?void 0:S.hasOwnProperty)!=null&&z.call(S,$)&&(ie[$]=S[$])}),o("onEvent",{event:M,target:ie})}}}},b=(S,x,L,M)=>{switch(x){case">":return S>L;case">=":return S>=L;case"<":return S<L;case"<=":return S<=L;case"==":return S==L;case"!=":return S!=L;case">=,=<":return S>=L&&S<=M;case"<,>":return S<L||S>M}},A=()=>{c.layout_center={x:0,y:0}},w=()=>{const S=c.config.net.mqtt;S&&S.url&&S.user&&S.pwd&&S.topics&&sub(S.url,S.user,S.pwd,S.topics,(x,L)=>{console.log(x),console.log(L.toString()),o("onMessage",{topics:x,message:L})})},T=(S,x,L)=>setArrItemByID(S,x,L,c.done_json);return vue.onMounted(()=>{w()}),vue.onBeforeUnmount(close),r({setNodeAttrByID:T}),(S,x)=>(vue.openBlock(),vue.createElementBlock("div",{class:"canvas",style:vue.normalizeStyle({backgroundColor:vue.unref(c).config.svg.background_color,position:"relative"}),onMousedown:y,onMousemove:f,onMouseup:h,onMousewheel:g,onContextmenu:x[3]||(x[3]=(...L)=>vue.unref(preventDefault)&&vue.unref(preventDefault)(...L))},[vue.renderSlot(S.$slots,"background",{},void 0,!0),vue.createElementVNode("div",_hoisted_1,[(vue.openBlock(),vue.createElementBlock("svg",_hoisted_2,[vue.createElementVNode("g",{transform:`translate(${vue.unref(c).layout_center.x*vue.unref(c).config.svg.scale},${vue.unref(c).layout_center.y*vue.unref(c).config.svg.scale})rotate(0)scale(${vue.unref(c).config.svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(c).done_json,L=>{var M,O,ie,$,z,V,re,F;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:L.id,transform:`translate(${L.x},${L.y})rotate(0)scale(1)`,style:vue.normalizeStyle(v(L)),onClick:pe=>_(L,vue.unref(EEventType).Click),onMousedown:x[0]||(x[0]=(...pe)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...pe)),onMousemove:x[1]||(x[1]=(...pe)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...pe)),onMouseup:x[2]||(x[2]=(...pe)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...pe))},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(L)}`)},[vue.createElementVNode("g",{transform:`translate(${L.actual_bound.x+L.actual_bound.width/2},${L.actual_bound.y+L.actual_bound.height/2})rotate(${L.rotate}) scale(1) translate(${-(L.actual_bound.x+L.actual_bound.width/2)},${-(L.actual_bound.y+L.actual_bound.height/2)})`},[L.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$z,{key:0,"item-info":L},null,8,["item-info"])):L.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${L.name}`,ref_for:!0},vue.unref(prosToVBind)(L,["height","width"]),{width:((O=(M=L.props)==null?void 0:M.width)==null?void 0:O.val)??100,height:(($=(ie=L.props)==null?void 0:ie.height)==null?void 0:$.val)??100,id:L.id,transform:`translate(${L.actual_bound.x+L.actual_bound.width/2},${L.actual_bound.y+L.actual_bound.height/2}) scale(${L.scale_x},${L.scale_y}) translate(${-(L.actual_bound.x+L.actual_bound.width/2)},${-(L.actual_bound.y+L.actual_bound.height/2)})`}),null,16,_hoisted_6)):L.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(L.tag),vue.mergeProps({key:2,ref_for:!0},vue.unref(prosToVBind)(L,["height","width"]),{width:((V=(z=L.props)==null?void 0:z.width)==null?void 0:V.val)??100,height:((F=(re=L.props)==null?void 0:re.height)==null?void 0:F.val)??100,id:L.id,onOnChange:pe=>_(L,vue.unref(EEventType).Change),transform:`translate(${L.actual_bound.x+L.actual_bound.width/2},${L.actual_bound.y+L.actual_bound.height/2}) scale(${L.scale_x},${L.scale_y}) translate(${-(L.actual_bound.x+L.actual_bound.width/2)},${-(L.actual_bound.y+L.actual_bound.height/2)})`}),null,16,["width","height","id","onOnChange","transform"])):L.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3,ref_for:!0},p(L.actual_bound,L.scale_x,L.scale_y),{id:`foreign-object${L.id}`,class:"foreignObject"}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(L.tag),vue.mergeProps({ref_for:!0},vue.unref(prosToVBind)(L),{id:L.id,onOnChange:pe=>_(L,vue.unref(EEventType).Change),transform:`translate(${L.actual_bound.x+L.actual_bound.width/2},${L.actual_bound.y+L.actual_bound.height/2}) scale(${L.scale_x},${L.scale_y}) translate(${-(L.actual_bound.x+L.actual_bound.width/2)},${-(L.actual_bound.y+L.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(L.tag_slot),1)]),_:2},1040,["id","onOnChange","transform"]))],16,_hoisted_7)):vue.createCommentVNode("",!0)],8,_hoisted_5)],2)],44,_hoisted_4)),[[vue.vShow,L.display]])}),128))],8,_hoisted_3)]))]),vue.withDirectives(vue.createElementVNode("div",_hoisted_8,[vue.createTextVNode("缩放倍数:"+vue.toDisplayString(vue.unref(c).config.svg.scale)+"倍,画布位置:"+vue.toDisplayString(vue.unref(myFixed)(vue.unref(c).layout_center.x,2))+","+vue.toDisplayString(vue.unref(myFixed)(vue.unref(c).layout_center.y,2))+" ",1),vue.createVNode(vue.unref(elementPlus.ElIcon),{class:"icoP",size:14,onClick:A,title:"重置位置"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(aim_default))]),_:1})],512),[[vue.vShow,S.showCanvasInfo]])],36))}}),svgViewer_vue_vue_type_style_index_0_scoped_86bbdc9c_lang="",svgViewer=_export_sfc$1(_sfc_main,[["__scopeId","data-v-86bbdc9c"]]);exports.SvgEditor=index,exports.SvgViewer=svgViewer,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
274
|
+
`," "],p=["{","}","|","\\","^","`"].concat(g),v=["'"].concat(p),_=["%","/","?",";","#"].concat(v),b=["/","?","#"],A=255,w=/^[+a-z0-9A-Z_-]{0,63}$/,T=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,S={javascript:!0,"javascript:":!0},x={javascript:!0,"javascript:":!0},L={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},M=n("querystring");function O(V,re,F){if(V&&c.isObject(V)&&V instanceof d)return V;var pe=new d;return pe.parse(V,re,F),pe}d.prototype.parse=function(V,re,F){if(!c.isString(V))throw new TypeError("Parameter 'url' must be a string, not "+typeof V);var pe=V.indexOf("?"),le=pe!==-1&&pe<V.indexOf("#")?"?":"#",de=V.split(le),Fe=/\\/g;de[0]=de[0].replace(Fe,"/"),V=de.join(le);var Ie=V;if(Ie=Ie.trim(),!F&&V.split("#").length===1){var At=y.exec(Ie);if(At)return this.path=Ie,this.href=Ie,this.pathname=At[1],At[2]?(this.search=At[2],re?this.query=M.parse(this.search.substr(1)):this.query=this.search.substr(1)):re&&(this.search="",this.query={}),this}var _e=f.exec(Ie);if(_e){_e=_e[0];var qe=_e.toLowerCase();this.protocol=qe,Ie=Ie.substr(_e.length)}if(F||_e||Ie.match(/^\/\/[^@\/]+@[^@\/]+/)){var In=Ie.substr(0,2)==="//";In&&!(_e&&x[_e])&&(Ie=Ie.substr(2),this.slashes=!0)}if(!x[_e]&&(In||_e&&!L[_e])){for(var vn=-1,Pt=0;Pt<b.length;Pt++){var he=Ie.indexOf(b[Pt]);he!==-1&&(vn===-1||he<vn)&&(vn=he)}var Ue,Dt;vn===-1?Dt=Ie.lastIndexOf("@"):Dt=Ie.lastIndexOf("@",vn),Dt!==-1&&(Ue=Ie.slice(0,Dt),Ie=Ie.slice(Dt+1),this.auth=decodeURIComponent(Ue)),vn=-1;for(var Pt=0;Pt<_.length;Pt++){var he=Ie.indexOf(_[Pt]);he!==-1&&(vn===-1||he<vn)&&(vn=he)}vn===-1&&(vn=Ie.length),this.host=Ie.slice(0,vn),Ie=Ie.slice(vn),this.parseHost(),this.hostname=this.hostname||"";var jt=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!jt)for(var Et=this.hostname.split(/\./),Pt=0,Ce=Et.length;Pt<Ce;Pt++){var ue=Et[Pt];if(ue&&!ue.match(w)){for(var $e="",Ne=0,Oe=ue.length;Ne<Oe;Ne++)ue.charCodeAt(Ne)>127?$e+="x":$e+=ue[Ne];if(!$e.match(w)){var Lt=Et.slice(0,Pt),kt=Et.slice(Pt+1),Cn=ue.match(T);Cn&&(Lt.push(Cn[1]),kt.unshift(Cn[2])),kt.length&&(Ie="/"+kt.join(".")+Ie),this.hostname=Lt.join(".");break}}}this.hostname.length>A?this.hostname="":this.hostname=this.hostname.toLowerCase(),jt||(this.hostname=u.toASCII(this.hostname));var oe=this.port?":"+this.port:"",ae=this.hostname||"";this.host=ae+oe,this.href+=this.host,jt&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),Ie[0]!=="/"&&(Ie="/"+Ie))}if(!S[qe])for(var Pt=0,Ce=v.length;Pt<Ce;Pt++){var Y=v[Pt];if(Ie.indexOf(Y)!==-1){var k=encodeURIComponent(Y);k===Y&&(k=escape(Y)),Ie=Ie.split(Y).join(k)}}var D=Ie.indexOf("#");D!==-1&&(this.hash=Ie.substr(D),Ie=Ie.slice(0,D));var j=Ie.indexOf("?");if(j!==-1?(this.search=Ie.substr(j),this.query=Ie.substr(j+1),re&&(this.query=M.parse(this.query)),Ie=Ie.slice(0,j)):re&&(this.search="",this.query={}),Ie&&(this.pathname=Ie),L[qe]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var oe=this.pathname||"",xe=this.search||"";this.path=oe+xe}return this.href=this.format(),this};function ie(V){return c.isString(V)&&(V=O(V)),V instanceof d?V.format():d.prototype.format.call(V)}d.prototype.format=function(){var V=this.auth||"";V&&(V=encodeURIComponent(V),V=V.replace(/%3A/i,":"),V+="@");var re=this.protocol||"",F=this.pathname||"",pe=this.hash||"",le=!1,de="";this.host?le=V+this.host:this.hostname&&(le=V+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(le+=":"+this.port)),this.query&&c.isObject(this.query)&&Object.keys(this.query).length&&(de=M.stringify(this.query));var Fe=this.search||de&&"?"+de||"";return re&&re.substr(-1)!==":"&&(re+=":"),this.slashes||(!re||L[re])&&le!==!1?(le="//"+(le||""),F&&F.charAt(0)!=="/"&&(F="/"+F)):le||(le=""),pe&&pe.charAt(0)!=="#"&&(pe="#"+pe),Fe&&Fe.charAt(0)!=="?"&&(Fe="?"+Fe),F=F.replace(/[?#]/g,function(Ie){return encodeURIComponent(Ie)}),Fe=Fe.replace("#","%23"),re+le+F+Fe+pe};function $(V,re){return O(V,!1,!0).resolve(re)}d.prototype.resolve=function(V){return this.resolveObject(O(V,!1,!0)).format()};function z(V,re){return V?O(V,!1,!0).resolveObject(re):re}d.prototype.resolveObject=function(V){if(c.isString(V)){var re=new d;re.parse(V,!1,!0),V=re}for(var F=new d,pe=Object.keys(this),le=0;le<pe.length;le++){var de=pe[le];F[de]=this[de]}if(F.hash=V.hash,V.href==="")return F.href=F.format(),F;if(V.slashes&&!V.protocol){for(var Fe=Object.keys(V),Ie=0;Ie<Fe.length;Ie++){var At=Fe[Ie];At!=="protocol"&&(F[At]=V[At])}return L[F.protocol]&&F.hostname&&!F.pathname&&(F.path=F.pathname="/"),F.href=F.format(),F}if(V.protocol&&V.protocol!==F.protocol){if(!L[V.protocol]){for(var _e=Object.keys(V),qe=0;qe<_e.length;qe++){var In=_e[qe];F[In]=V[In]}return F.href=F.format(),F}if(F.protocol=V.protocol,!V.host&&!x[V.protocol]){for(var Ce=(V.pathname||"").split("/");Ce.length&&!(V.host=Ce.shift()););V.host||(V.host=""),V.hostname||(V.hostname=""),Ce[0]!==""&&Ce.unshift(""),Ce.length<2&&Ce.unshift(""),F.pathname=Ce.join("/")}else F.pathname=V.pathname;if(F.search=V.search,F.query=V.query,F.host=V.host||"",F.auth=V.auth,F.hostname=V.hostname||V.host,F.port=V.port,F.pathname||F.search){var vn=F.pathname||"",Pt=F.search||"";F.path=vn+Pt}return F.slashes=F.slashes||V.slashes,F.href=F.format(),F}var he=F.pathname&&F.pathname.charAt(0)==="/",Ue=V.host||V.pathname&&V.pathname.charAt(0)==="/",Dt=Ue||he||F.host&&V.pathname,jt=Dt,Et=F.pathname&&F.pathname.split("/")||[],Ce=V.pathname&&V.pathname.split("/")||[],ue=F.protocol&&!L[F.protocol];if(ue&&(F.hostname="",F.port=null,F.host&&(Et[0]===""?Et[0]=F.host:Et.unshift(F.host)),F.host="",V.protocol&&(V.hostname=null,V.port=null,V.host&&(Ce[0]===""?Ce[0]=V.host:Ce.unshift(V.host)),V.host=null),Dt=Dt&&(Ce[0]===""||Et[0]==="")),Ue)F.host=V.host||V.host===""?V.host:F.host,F.hostname=V.hostname||V.hostname===""?V.hostname:F.hostname,F.search=V.search,F.query=V.query,Et=Ce;else if(Ce.length)Et||(Et=[]),Et.pop(),Et=Et.concat(Ce),F.search=V.search,F.query=V.query;else if(!c.isNullOrUndefined(V.search)){if(ue){F.hostname=F.host=Et.shift();var $e=F.host&&F.host.indexOf("@")>0?F.host.split("@"):!1;$e&&(F.auth=$e.shift(),F.host=F.hostname=$e.shift())}return F.search=V.search,F.query=V.query,(!c.isNull(F.pathname)||!c.isNull(F.search))&&(F.path=(F.pathname?F.pathname:"")+(F.search?F.search:"")),F.href=F.format(),F}if(!Et.length)return F.pathname=null,F.search?F.path="/"+F.search:F.path=null,F.href=F.format(),F;for(var Ne=Et.slice(-1)[0],Oe=(F.host||V.host||Et.length>1)&&(Ne==="."||Ne==="..")||Ne==="",Lt=0,kt=Et.length;kt>=0;kt--)Ne=Et[kt],Ne==="."?Et.splice(kt,1):Ne===".."?(Et.splice(kt,1),Lt++):Lt&&(Et.splice(kt,1),Lt--);if(!Dt&&!jt)for(;Lt--;Lt)Et.unshift("..");Dt&&Et[0]!==""&&(!Et[0]||Et[0].charAt(0)!=="/")&&Et.unshift(""),Oe&&Et.join("/").substr(-1)!=="/"&&Et.push("");var Cn=Et[0]===""||Et[0]&&Et[0].charAt(0)==="/";if(ue){F.hostname=F.host=Cn?"":Et.length?Et.shift():"";var $e=F.host&&F.host.indexOf("@")>0?F.host.split("@"):!1;$e&&(F.auth=$e.shift(),F.host=F.hostname=$e.shift())}return Dt=Dt||F.host&&Et.length,Dt&&!Cn&&Et.unshift(""),Et.length?F.pathname=Et.join("/"):(F.pathname=null,F.path=null),(!c.isNull(F.pathname)||!c.isNull(F.search))&&(F.path=(F.pathname?F.pathname:"")+(F.search?F.search:"")),F.auth=V.auth||F.auth,F.slashes=F.slashes||V.slashes,F.href=F.format(),F},d.prototype.parseHost=function(){var V=this.host,re=h.exec(V);re&&(re=re[0],re!==":"&&(this.port=re.substr(1)),V=V.substr(0,V.length-re.length)),V&&(this.hostname=V)}},{"./util":138,punycode:103,querystring:106}],138:[function(n,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}}},{}],139:[function(n,o,a){(function(u){(function(){o.exports=c;function c(f,h){if(d("noDeprecation"))return f;var y=!1;function g(){if(!y){if(d("throwDeprecation"))throw new Error(h);d("traceDeprecation")?console.trace(h):console.warn(h),y=!0}return f.apply(this,arguments)}return g}function d(f){try{if(!u.localStorage)return!1}catch{return!1}var h=u.localStorage[f];return h==null?!1:String(h).toLowerCase()==="true"}}).call(this)}).call(this,typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:typeof window<"u"?window:{})},{}],140:[function(n,o,a){o.exports=u;function u(c,d){if(c&&d)return u(c)(d);if(typeof c!="function")throw new TypeError("need wrapper function");return Object.keys(c).forEach(function(h){f[h]=c[h]}),f;function f(){for(var h=new Array(arguments.length),y=0;y<h.length;y++)h[y]=arguments[y];var g=c.apply(this,h),p=h[h.length-1];return typeof g=="function"&&g!==p&&Object.keys(p).forEach(function(v){g[v]=p[v]}),g}}},{}],141:[function(n,o,a){o.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}]},{},[23])(23)})})(mqtt);var mqttExports=mqtt.exports;let client;const sub=(i,r,n,o,a)=>{const u=i.trim();if(!/^wss?:\/\/.*$/.test(u)){console.error('编辑器MQTT通信只支持ws协议 (url必须以"ws://"开头)');return}client=mqttExports.connect(u,{username:r.trim(),password:n.trim(),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={class:"coverLayer"},_hoisted_2={xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%"},_hoisted_3=["transform"],_hoisted_4=["transform","onClick"],_hoisted_5=["transform"],_hoisted_6=["xlink:href","width","height","id","transform"],_hoisted_7=["id"],_hoisted_8={class:"can-not-select canvasInfoTxt"},_sfc_main=vue.defineComponent({__name:"svg-viewer",props:{vueComp:{},data:{},canvasDrag:{type:Boolean,default:!0},showCanvasInfo:{type:Boolean,default:!0}},emits:["onMessage","onEvent"],setup(i,{expose:r,emit:n}){vue.useCssVars(S=>({"51655a09":vue.unref(d)})),setEditorLoadTime();const o=n,a=i,u=useGlobalStore(pinia);componentsRegister(a.vueComp);const c=vue.reactive(a.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:[]}),d=vue.computed(()=>u.intention==EGlobalStoreIntention.MoveCanvas?"grab":"default"),f=S=>{if(u.mouse_info.state!=EMouseInfoState.Down&&u.intention!==EGlobalStoreIntention.Connection||!a.canvasDrag)return;const{clientX:x,clientY:L}=S;u.mouse_info.new_position_x=Math.round(x/c.config.svg.scale),u.mouse_info.new_position_y=Math.round(L/c.config.svg.scale);const M=Math.round(u.mouse_info.new_position_x-u.mouse_info.position_x+u.mouse_info.now_position_x),O=Math.round(u.mouse_info.new_position_y-u.mouse_info.position_y+u.mouse_info.now_position_y);u.intention==EGlobalStoreIntention.MoveCanvas&&(c.layout_center.x=M,c.layout_center.y=O)},h=()=>{u.mouse_info.state==EMouseInfoState.Down&&(u.intention!=EGlobalStoreIntention.Select&&(u.intention=EGlobalStoreIntention.None),u.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})},y=S=>{const{clientX:x,clientY:L}=S;u.intention=EGlobalStoreIntention.MoveCanvas,u.mouse_info={state:EMouseInfoState.Down,position_x:Math.round(x/c.config.svg.scale),position_y:Math.round(L/c.config.svg.scale),now_position_x:c.layout_center.x,now_position_y:c.layout_center.y,new_position_x:0,new_position_y:0}};function g(S){S!=null&&S.wheelDelta&&(S.wheelDelta>0?(c.config.svg.scale=myFixed(c.config.svg.scale+.1,1),getZoomPosition(S,c.config.svg.scale,c.layout_center,!0)):(c.config.svg.scale=myFixed(c.config.svg.scale-.1,1),getZoomPosition(S,c.config.svg.scale,c.layout_center,!1)))}const p=(S,x,L)=>({x:S.x-S.width/2*x+S.width/2,y:S.y-S.height/2*L+S.height/2,width:S.width*x,height:S.height*L}),v=S=>{var L;let x=!1;if(((L=S.events)==null?void 0:L.length)>0){for(let M of S.events)if(M.type===EEventType.Click){x=!0;break}}return{cursor:x?"pointer":"default"}},_=(S,x)=>{var L;if(((L=S.events)==null?void 0:L.length)>0){for(let M of S.events)if(M.type===x){if(M.condition&&M.condition.type!=="None"&&M.condition.type==="Relation"&&M.condition.Relation&&M.condition.Relation.relation){const O=M.condition.Relation.key,ie=M.condition.Relation.relation,$=valFormat(M.condition.Relation.val),z=valFormat(M.condition.Relation.val2);if(S.props.hasOwnProperty(O)){const V=S.props[O].val;if(!b(V,ie,$,z))continue}}if(M.action===EEventAction.ChangeAttr){if(M.attrs&&M.attrs.length>0){let O;if(M.target){for(let ie of c.done_json)if(ie.id===M.target){O=ie;break}}else O=S;if(!O)continue;for(let ie of M.attrs)ie.key==="state"?O.defaultState=valFormat(ie.val):ie.key==="display"?O.display=valFormat(ie.val):O.props.hasOwnProperty(ie.key)&&(O.props[ie.key].val=valFormat(ie.val))}}else if(M.action===EEventAction.JavaScript)new Function(M.scripts)();else if(M.action===EEventAction.Emit){const O=["id","name","common_animations","display","props","title","type","x","y"],ie={};O.forEach($=>{var z;(z=S==null?void 0:S.hasOwnProperty)!=null&&z.call(S,$)&&(ie[$]=S[$])}),o("onEvent",{event:M,target:ie})}}}},b=(S,x,L,M)=>{switch(x){case">":return S>L;case">=":return S>=L;case"<":return S<L;case"<=":return S<=L;case"==":return S==L;case"!=":return S!=L;case">=,=<":return S>=L&&S<=M;case"<,>":return S<L||S>M}},A=()=>{c.layout_center={x:0,y:0}},w=()=>{const S=c.config.net.mqtt;S&&S.url&&S.user&&S.pwd&&S.topics&&sub(S.url,S.user,S.pwd,S.topics,(x,L)=>{console.log(x),console.log(L.toString()),o("onMessage",{topics:x,message:L})})},T=(S,x,L)=>setArrItemByID(S,x,L,c.done_json);return vue.onMounted(()=>{w()}),vue.onBeforeUnmount(close),r({setNodeAttrByID:T}),(S,x)=>(vue.openBlock(),vue.createElementBlock("div",{class:"canvas",style:vue.normalizeStyle({backgroundColor:vue.unref(c).config.svg.background_color,position:"relative"}),onMousedown:y,onMousemove:f,onMouseup:h,onMousewheel:g,onContextmenu:x[3]||(x[3]=(...L)=>vue.unref(preventDefault)&&vue.unref(preventDefault)(...L))},[vue.renderSlot(S.$slots,"background",{},void 0,!0),vue.createElementVNode("div",_hoisted_1,[(vue.openBlock(),vue.createElementBlock("svg",_hoisted_2,[vue.createElementVNode("g",{transform:`translate(${vue.unref(c).layout_center.x*vue.unref(c).config.svg.scale},${vue.unref(c).layout_center.y*vue.unref(c).config.svg.scale})rotate(0)scale(${vue.unref(c).config.svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(c).done_json,L=>{var M,O,ie,$,z,V,re,F;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:L.id,transform:`translate(${L.x},${L.y})rotate(0)scale(1)`,style:vue.normalizeStyle(v(L)),onClick:pe=>_(L,vue.unref(EEventType).Click),onMousedown:x[0]||(x[0]=(...pe)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...pe)),onMousemove:x[1]||(x[1]=(...pe)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...pe)),onMouseup:x[2]||(x[2]=(...pe)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...pe))},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(L)}`)},[vue.createElementVNode("g",{transform:`translate(${L.actual_bound.x+L.actual_bound.width/2},${L.actual_bound.y+L.actual_bound.height/2})rotate(${L.rotate}) scale(1) translate(${-(L.actual_bound.x+L.actual_bound.width/2)},${-(L.actual_bound.y+L.actual_bound.height/2)})`},[L.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$z,{key:0,"item-info":L},null,8,["item-info"])):L.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${L.name}`,ref_for:!0},vue.unref(prosToVBind)(L,["height","width"]),{width:((O=(M=L.props)==null?void 0:M.width)==null?void 0:O.val)??100,height:(($=(ie=L.props)==null?void 0:ie.height)==null?void 0:$.val)??100,id:L.id,transform:`translate(${L.actual_bound.x+L.actual_bound.width/2},${L.actual_bound.y+L.actual_bound.height/2}) scale(${L.scale_x},${L.scale_y}) translate(${-(L.actual_bound.x+L.actual_bound.width/2)},${-(L.actual_bound.y+L.actual_bound.height/2)})`}),null,16,_hoisted_6)):L.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(L.tag),vue.mergeProps({key:2,ref_for:!0},vue.unref(prosToVBind)(L,["height","width"]),{width:((V=(z=L.props)==null?void 0:z.width)==null?void 0:V.val)??100,height:((F=(re=L.props)==null?void 0:re.height)==null?void 0:F.val)??100,id:L.id,onOnChange:pe=>_(L,vue.unref(EEventType).Change),transform:`translate(${L.actual_bound.x+L.actual_bound.width/2},${L.actual_bound.y+L.actual_bound.height/2}) scale(${L.scale_x},${L.scale_y}) translate(${-(L.actual_bound.x+L.actual_bound.width/2)},${-(L.actual_bound.y+L.actual_bound.height/2)})`}),null,16,["width","height","id","onOnChange","transform"])):L.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3,ref_for:!0},p(L.actual_bound,L.scale_x,L.scale_y),{id:`foreign-object${L.id}`,class:"foreignObject"}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(L.tag),vue.mergeProps({ref_for:!0},vue.unref(prosToVBind)(L),{id:L.id,onOnChange:pe=>_(L,vue.unref(EEventType).Change),transform:`translate(${L.actual_bound.x+L.actual_bound.width/2},${L.actual_bound.y+L.actual_bound.height/2}) scale(${L.scale_x},${L.scale_y}) translate(${-(L.actual_bound.x+L.actual_bound.width/2)},${-(L.actual_bound.y+L.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(L.tag_slot),1)]),_:2},1040,["id","onOnChange","transform"]))],16,_hoisted_7)):vue.createCommentVNode("",!0)],8,_hoisted_5)],2)],44,_hoisted_4)),[[vue.vShow,L.display]])}),128))],8,_hoisted_3)]))]),vue.withDirectives(vue.createElementVNode("div",_hoisted_8,[vue.createTextVNode("缩放倍数:"+vue.toDisplayString(vue.unref(c).config.svg.scale)+"倍,画布位置:"+vue.toDisplayString(vue.unref(myFixed)(vue.unref(c).layout_center.x,2))+","+vue.toDisplayString(vue.unref(myFixed)(vue.unref(c).layout_center.y,2))+" ",1),vue.createVNode(vue.unref(elementPlus.ElIcon),{class:"icoP",size:14,onClick:A,title:"重置位置"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(aim_default))]),_:1})],512),[[vue.vShow,S.showCanvasInfo]])],36))}}),svgViewer_vue_vue_type_style_index_0_scoped_f5237156_lang="",svgViewer=_export_sfc$1(_sfc_main,[["__scopeId","data-v-f5237156"]]);exports.SvgEditor=index,exports.SvgViewer=svgViewer,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|