@zhangqingcq/vgce 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
package/dist/vgce.umd.cjs
CHANGED
@@ -248,7 +248,7 @@ echarts.use([`+F+"]);":"Unknown series "+L))}return}if(g==="tooltip"){if(w){proc
|
|
248
248
|
|
249
249
|
`:"<br/>",b=g.join(S);this._showOrMove(f,function(){this._updateContentNotChangedOnAxis(i,p)?this._updatePosition(f,y,c[0],c[1],this._tooltipContent,p):this._showTooltipContent(f,b,p,Math.random()+"",c[0],c[1],y,null,v)})},n.prototype._showSeriesItemTooltip=function(i,o,a){var u=this._ecModel,c=getECData(o),f=c.seriesIndex,d=u.getSeriesByIndex(f),p=c.dataModel||d,h=c.dataIndex,g=c.dataType,v=p.getData(g),y=this._renderMode,A=i.positionDefault,_=buildTooltipModel([v.getItemModel(h),p,d&&(d.coordinateSystem||{}).model],this._tooltipModel,A?{position:A}:null),S=_.get("trigger");if(!(S!=null&&S!=="item")){var b=p.getDataParams(h,g),T=new TooltipMarkupStyleCreator;b.marker=T.makeTooltipMarker("item",convertToColorString(b.color),y);var w=normalizeTooltipFormatResult(p.formatTooltip(h,!1,g)),x=_.get("order"),k=_.get("valueFormatter"),M=w.frag,D=M?buildTooltipMarkup(k?extend({valueFormatter:k},M):M,T,y,x,u.get("useUTC"),_.get("textStyle")):w.text,z="item_"+p.name+"_"+h;this._showOrMove(_,function(){this._showTooltipContent(_,D,b,z,i.offsetX,i.offsetY,i.position,i.target,T)}),a({type:"showTip",dataIndexInside:h,dataIndex:v.getRawIndex(h),seriesIndex:f,from:this.uid})}},n.prototype._showComponentItemTooltip=function(i,o,a){var u=getECData(o),c=u.tooltipConfig,f=c.option||{};if(isString$2(f)){var d=f;f={content:d,formatter:d}}var p=[f],h=this._ecModel.getComponent(u.componentMainType,u.componentIndex);h&&p.push(h),p.push({formatter:f.content});var g=i.positionDefault,v=buildTooltipModel(p,this._tooltipModel,g?{position:g}:null),y=v.get("content"),A=Math.random()+"",_=new TooltipMarkupStyleCreator;this._showOrMove(v,function(){var S=clone$2(v.get("formatterParams")||{});this._showTooltipContent(v,y,S,A,i.offsetX,i.offsetY,i.position,o,_)}),a({type:"showTip",from:this.uid})},n.prototype._showTooltipContent=function(i,o,a,u,c,f,d,p,h){if(this._ticket="",!(!i.get("showContent")||!i.get("show"))){var g=this._tooltipContent;g.setEnterable(i.get("enterable"));var v=i.get("formatter");d=d||i.get("position");var y=o,A=this._getNearestPoint([c,f],a,i.get("trigger"),i.get("borderColor")),_=A.color;if(v)if(isString$2(v)){var S=i.ecModel.get("useUTC"),b=isArray$1(a)?a[0]:a,T=b&&b.axisType&&b.axisType.indexOf("time")>=0;y=v,T&&(y=format$1(b.axisValue,y,S)),y=formatTpl(y,a,!0)}else if(isFunction$1(v)){var w=bind$1(function(x,k){x===this._ticket&&(g.setContent(k,h,i,_,d),this._updatePosition(i,d,c,f,g,a,p))},this);this._ticket=u,y=v(a,u,w)}else y=v;g.setContent(y,h,i,_,d),g.show(i,_),this._updatePosition(i,d,c,f,g,a,p)}},n.prototype._getNearestPoint=function(i,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}},n.prototype._updatePosition=function(i,o,a,u,c,f,d){var p=this._api.getWidth(),h=this._api.getHeight();o=o||i.get("position");var g=c.getSize(),v=i.get("align"),y=i.get("verticalAlign"),A=d&&d.getBoundingRect().clone();if(d&&A.applyTransform(d.transform),isFunction$1(o)&&(o=o([a,u],f,c.el,A,{viewSize:[p,h],contentSize:g.slice()})),isArray$1(o))a=parsePercent(o[0],p),u=parsePercent(o[1],h);else if(isObject$3(o)){var _=o;_.width=g[0],_.height=g[1];var S=getLayoutRect(_,{width:p,height:h});a=S.x,u=S.y,v=null,y=null}else if(isString$2(o)&&d){var b=calcTooltipPosition(o,A,g,i.get("borderWidth"));a=b[0],u=b[1]}else{var b=refixTooltipPosition(a,u,c,p,h,v?null:20,y?null:20);a=b[0],u=b[1]}if(v&&(a-=isCenterAlign(v)?g[0]/2:v==="right"?g[0]:0),y&&(u-=isCenterAlign(y)?g[1]/2:y==="bottom"?g[1]:0),shouldTooltipConfine(i)){var b=confineTooltipPosition(a,u,c,p,h);a=b[0],u=b[1]}c.moveTo(a,u)},n.prototype._updateContentNotChangedOnAxis=function(i,o){var a=this._lastDataByCoordSys,u=this._cbParamsList,c=!!a&&a.length===i.length;return c&&each$4(a,function(f,d){var p=f.dataByAxis||[],h=i[d]||{},g=h.dataByAxis||[];c=c&&p.length===g.length,c&&each$4(p,function(v,y){var A=g[y]||{},_=v.seriesDataIndices||[],S=A.seriesDataIndices||[];c=c&&v.value===A.value&&v.axisType===A.axisType&&v.axisId===A.axisId&&_.length===S.length,c&&each$4(_,function(b,T){var w=S[T];c=c&&b.seriesIndex===w.seriesIndex&&b.dataIndex===w.dataIndex}),u&&each$4(v.seriesDataIndices,function(b){var T=b.seriesIndex,w=o[T],x=u[T];w&&x&&x.data!==w.data&&(c=!1)})})}),this._lastDataByCoordSys=i,this._cbParamsList=o,!!c},n.prototype._hide=function(i){this._lastDataByCoordSys=null,i({type:"hideTip",from:this.uid})},n.prototype.dispose=function(i,o){env$1.node||!o.getDom()||(clear(this,"_updatePosition"),this._tooltipContent.dispose(),unregister("itemTooltip",o))},n.type="tooltip",n}(ComponentView$1);function buildTooltipModel(r,n,i){var o=n.ecModel,a;i?(a=new Model$1(i,o,o),a=new Model$1(n.option,a,o)):a=n;for(var u=r.length-1;u>=0;u--){var c=r[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(r,n){return r.dispatchAction||bind$1(n.dispatchAction,n)}function refixTooltipPosition(r,n,i,o,a,u,c){var f=i.getSize(),d=f[0],p=f[1];return u!=null&&(r+d+u+2>o?r-=d+u:r+=u),c!=null&&(n+p+c>a?n-=p+c:n+=c),[r,n]}function confineTooltipPosition(r,n,i,o,a){var u=i.getSize(),c=u[0],f=u[1];return r=Math.min(r+c,o)-c,n=Math.min(n+f,a)-f,r=Math.max(r,0),n=Math.max(n,0),[r,n]}function calcTooltipPosition(r,n,i,o){var a=i[0],u=i[1],c=Math.ceil(Math.SQRT2*o)+8,f=0,d=0,p=n.width,h=n.height;switch(r){case"inside":f=n.x+p/2-a/2,d=n.y+h/2-u/2;break;case"top":f=n.x+p/2-a/2,d=n.y-u-c;break;case"bottom":f=n.x+p/2-a/2,d=n.y+h+c;break;case"left":f=n.x-a-c,d=n.y+h/2-u/2;break;case"right":f=n.x+p+c,d=n.y+h/2-u/2}return[f,d]}function isCenterAlign(r){return r==="center"||r==="middle"}function findComponentReference(r,n,i){var o=preParseFinder(r).queryOptionMap,a=o.keys()[0];if(!(!a||a==="series")){var u=queryReferringComponents(n,a,o.get(a),{useDefault:!1,enableAll:!1,enableNone:!1}),c=u.models[0];if(c){var f=i.getViewOfComponentModel(c),d;if(f.group.traverse(function(p){var h=getECData(p).tooltipConfig;if(h&&h.name===r.name)return d=p,!0}),d)return{componentMainType:a,componentIndex:c.componentIndex,el:d}}}}const TooltipView$1=TooltipView;function install$4(r){use(install$5),r.registerComponentModel(TooltipModel$1),r.registerComponentView(TooltipView$1),r.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},noop$1),r.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},noop$1)}var TitleModel=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i.layoutMode={type:"box",ignoreSize:!0},i}return n.type="title",n.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"}},n}(ComponentModel$1),TitleView=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i}return n.prototype.render=function(i,o,a){if(this.group.removeAll(),!!i.get("show")){var u=this.group,c=i.getModel("textStyle"),f=i.getModel("subtextStyle"),d=i.get("textAlign"),p=retrieve2(i.get("textBaseline"),i.get("textVerticalAlign")),h=new ZRText$1({style:createTextStyle(c,{text:i.get("text"),fill:c.getTextColor()},{disableBox:!0}),z2:10}),g=h.getBoundingRect(),v=i.get("subtext"),y=new ZRText$1({style:createTextStyle(f,{text:v,fill:f.getTextColor(),y:g.height+i.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),A=i.get("link"),_=i.get("sublink"),S=i.get("triggerEvent",!0);h.silent=!A&&!S,y.silent=!_&&!S,A&&h.on("click",function(){windowOpen(A,"_"+i.get("target"))}),_&&y.on("click",function(){windowOpen(_,"_"+i.get("subtarget"))}),getECData(h).eventData=getECData(y).eventData=S?{componentType:"title",componentIndex:i.componentIndex}:null,u.add(h),v&&u.add(y);var b=u.getBoundingRect(),T=i.getBoxLayoutParams();T.width=b.width,T.height=b.height;var w=getLayoutRect(T,{width:a.getWidth(),height:a.getHeight()},i.get("padding"));d||(d=i.get("left")||i.get("right"),d==="middle"&&(d="center"),d==="right"?w.x+=w.width:d==="center"&&(w.x+=w.width/2)),p||(p=i.get("top")||i.get("bottom"),p==="center"&&(p="middle"),p==="bottom"?w.y+=w.height:p==="middle"&&(w.y+=w.height/2),p=p||"top"),u.x=w.x,u.y=w.y,u.markRedraw();var x={align:d,verticalAlign:p};h.setStyle(x),y.setStyle(x),b=u.getBoundingRect();var k=w.margin,M=i.getItemStyle(["color","opacity"]);M.fill=i.get("backgroundColor");var D=new Rect$1({shape:{x:b.x-k[3],y:b.y-k[0],width:b.width+k[1]+k[3],height:b.height+k[0]+k[2],r:i.get("borderRadius")},style:M,subPixelOptimize:!0,silent:!0});u.add(D)}},n.type="title",n}(ComponentView$1);function install$3(r){r.registerComponentModel(TitleModel),r.registerComponentView(TitleView)}var getDefaultSelectorOptions=function(r,n){if(n==="all")return{type:"all",title:r.getLocaleModel().get(["legend","selector","all"])};if(n==="inverse")return{type:"inverse",title:r.getLocaleModel().get(["legend","selector","inverse"])}},LegendModel=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i.layoutMode={type:"box",ignoreSize:!0},i}return n.prototype.init=function(i,o,a){this.mergeDefaultAndTheme(i,a),i.selected=i.selected||{},this._updateSelector(i)},n.prototype.mergeOption=function(i,o){r.prototype.mergeOption.call(this,i,o),this._updateSelector(i)},n.prototype._updateSelector=function(i){var o=i.selector,a=this.ecModel;o===!0&&(o=i.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))})},n.prototype.optionUpdated=function(){this._updateData(this.ecModel);var i=this._data;if(i[0]&&this.get("selectedMode")==="single"){for(var o=!1,a=0;a<i.length;a++){var u=i[a].get("name");if(this.isSelected(u)){this.select(u),o=!0;break}}!o&&this.select(i[0].get("name"))}},n.prototype._updateData=function(i){var o=[],a=[];i.eachRawSeries(function(d){var p=d.name;a.push(p);var h;if(d.legendVisualProvider){var g=d.legendVisualProvider,v=g.getAllNames();i.isSeriesFiltered(d)||(a=a.concat(v)),v.length?o=o.concat(v):h=!0}else h=!0;h&&isNameSpecified(d)&&o.push(d.name)}),this._availableNames=a;var u=this.get("data")||o,c=createHashMap(),f=map$1(u,function(d){return(isString$2(d)||isNumber$1(d))&&(d={name:d}),c.get(d.name)?null:(c.set(d.name,!0),new Model$1(d,this,this.ecModel))},this);this._data=filter(f,function(d){return!!d})},n.prototype.getData=function(){return this._data},n.prototype.select=function(i){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[i]=!0},n.prototype.unSelect=function(i){this.get("selectedMode")!=="single"&&(this.option.selected[i]=!1)},n.prototype.toggleSelected=function(i){var o=this.option.selected;o.hasOwnProperty(i)||(o[i]=!0),this[o[i]?"unSelect":"select"](i)},n.prototype.allSelect=function(){var i=this._data,o=this.option.selected;each$4(i,function(a){o[a.get("name",!0)]=!0})},n.prototype.inverseSelect=function(){var i=this._data,o=this.option.selected;each$4(i,function(a){var u=a.get("name",!0);o.hasOwnProperty(u)||(o[u]=!0),o[u]=!o[u]})},n.prototype.isSelected=function(i){var o=this.option.selected;return!(o.hasOwnProperty(i)&&!o[i])&&indexOf(this._availableNames,i)>=0},n.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},n.type="legend.plain",n.dependencies=["series"],n.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}},n}(ComponentModel$1);const LegendModel$1=LegendModel;var curry=curry$1,each=each$4,Group$1=Group$3,LegendView=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i.newlineDisabled=!1,i}return n.prototype.init=function(){this.group.add(this._contentGroup=new Group$1),this.group.add(this._selectorGroup=new Group$1),this._isFirstRender=!0},n.prototype.getContentGroup=function(){return this._contentGroup},n.prototype.getSelectorGroup=function(){return this._selectorGroup},n.prototype.render=function(i,o,a){var u=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!i.get("show",!0)){var c=i.get("align"),f=i.get("orient");(!c||c==="auto")&&(c=i.get("left")==="right"&&f==="vertical"?"right":"left");var d=i.get("selector",!0),p=i.get("selectorPosition",!0);d&&(!p||p==="auto")&&(p=f==="horizontal"?"end":"start"),this.renderInner(c,i,o,a,d,f,p);var h=i.getBoxLayoutParams(),g={width:a.getWidth(),height:a.getHeight()},v=i.get("padding"),y=getLayoutRect(h,g,v),A=this.layoutInner(i,c,y,u,d,p),_=getLayoutRect(defaults({width:A.width,height:A.height},h),g,v);this.group.x=_.x-A.x,this.group.y=_.y-A.y,this.group.markRedraw(),this.group.add(this._backgroundEl=makeBackground(A,i))}},n.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},n.prototype.renderInner=function(i,o,a,u,c,f,d){var p=this.getContentGroup(),h=createHashMap(),g=o.get("selectedMode"),v=[];a.eachRawSeries(function(y){!y.get("legendHoverLink")&&v.push(y.id)}),each(o.getData(),function(y,A){var _=y.get("name");if(!this.newlineDisabled&&(_===""||_===`
|
250
250
|
`)){var S=new Group$1;S.newline=!0,p.add(S);return}var b=a.getSeriesByName(_)[0];if(!h.get(_)){if(b){var T=b.getData(),w=T.getVisual("legendLineStyle")||{},x=T.getVisual("legendIcon"),k=T.getVisual("style"),M=this._createItem(b,_,A,y,o,i,w,k,x,g,u);M.on("click",curry(dispatchSelectAction,_,null,u,v)).on("mouseover",curry(dispatchHighlightAction,b.name,null,u,v)).on("mouseout",curry(dispatchDownplayAction,b.name,null,u,v)),h.set(_,!0)}else a.eachRawSeries(function(D){if(!h.get(_)&&D.legendVisualProvider){var z=D.legendVisualProvider;if(!z.containName(_))return;var j=z.indexOfName(_),oe=z.getItemVisual(j,"style"),L=z.getItemVisual(j,"legendIcon"),F=parse(oe.fill);F&&F[3]===0&&(F[3]=.2,oe=extend(extend({},oe),{fill:stringify(F,"rgba")}));var O=this._createItem(D,_,A,y,o,i,{},oe,L,g,u);O.on("click",curry(dispatchSelectAction,null,_,u,v)).on("mouseover",curry(dispatchHighlightAction,null,_,u,v)).on("mouseout",curry(dispatchDownplayAction,null,_,u,v)),h.set(_,!0)}},this);process.env.NODE_ENV!=="production"&&(h.get(_)||console.warn(_+" series not exists. Legend data should be same with series name or data name."))}},this),c&&this._createSelector(c,o,u,f,d)},n.prototype._createSelector=function(i,o,a,u,c){var f=this.getSelectorGroup();each(i,function(p){var h=p.type,g=new ZRText$1({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){a.dispatchAction({type:h==="all"?"legendAllSelect":"legendInverseSelect"})}});f.add(g);var v=o.getModel("selectorLabel"),y=o.getModel(["emphasis","selectorLabel"]);setLabelStyle(g,{normal:v,emphasis:y},{defaultText:p.title}),enableHoverEmphasis(g)})},n.prototype._createItem=function(i,o,a,u,c,f,d,p,h,g,v){var y=i.visualDrawType,A=c.get("itemWidth"),_=c.get("itemHeight"),S=c.isSelected(o),b=u.get("symbolRotate"),T=u.get("symbolKeepAspect"),w=u.get("icon");h=w||h||"roundRect";var x=getLegendStyle(h,u,d,p,y,S,v),k=new Group$1,M=u.getModel("textStyle");if(isFunction$1(i.getLegendIcon)&&(!w||w==="inherit"))k.add(i.getLegendIcon({itemWidth:A,itemHeight:_,icon:h,iconRotate:b,itemStyle:x.itemStyle,lineStyle:x.lineStyle,symbolKeepAspect:T}));else{var D=w==="inherit"&&i.getData().getVisual("symbol")?b==="inherit"?i.getData().getVisual("symbolRotate"):b:0;k.add(getDefaultLegendIcon({itemWidth:A,itemHeight:_,icon:h,iconRotate:D,itemStyle:x.itemStyle,lineStyle:x.lineStyle,symbolKeepAspect:T}))}var z=f==="left"?A+5:-5,j=f,oe=c.get("formatter"),L=o;isString$2(oe)&&oe?L=oe.replace("{name}",o??""):isFunction$1(oe)&&(L=oe(o));var F=u.get("inactiveColor");k.add(new ZRText$1({style:createTextStyle(M,{text:L,x:z,y:_/2,fill:S?M.getTextColor():F,align:j,verticalAlign:"middle"})}));var O=new Rect$1({shape:k.getBoundingRect(),invisible:!0}),ue=u.getModel("tooltip");return ue.get("show")&&setTooltipConfig({el:O,componentModel:c,itemName:o,itemTooltipOption:ue.option}),k.add(O),k.eachChild(function(_e){_e.silent=!0}),O.silent=!g,this.getContentGroup().add(k),enableHoverEmphasis(k),k.__legendDataIndex=a,k},n.prototype.layoutInner=function(i,o,a,u,c,f){var d=this.getContentGroup(),p=this.getSelectorGroup();box(i.get("orient"),d,i.get("itemGap"),a.width,a.height);var h=d.getBoundingRect(),g=[-h.x,-h.y];if(p.markRedraw(),d.markRedraw(),c){box("horizontal",p,i.get("selectorItemGap",!0));var v=p.getBoundingRect(),y=[-v.x,-v.y],A=i.get("selectorButtonGap",!0),_=i.getOrient().index,S=_===0?"width":"height",b=_===0?"height":"width",T=_===0?"y":"x";f==="end"?y[_]+=h[S]+A:g[_]+=v[S]+A,y[1-_]+=h[b]/2-v[b]/2,p.x=y[0],p.y=y[1],d.x=g[0],d.y=g[1];var w={x:0,y:0};return w[S]=h[S]+A+v[S],w[b]=Math.max(h[b],v[b]),w[T]=Math.min(0,v[T]+y[1-_]),w}else return d.x=g[0],d.y=g[1],this.group.getBoundingRect()},n.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},n.type="legend.plain",n}(ComponentView$1);function getLegendStyle(r,n,i,o,a,u,c){function f(S,b){S.lineWidth==="auto"&&(S.lineWidth=b.lineWidth>0?2:0),each(S,function(T,w){S[w]==="inherit"&&(S[w]=b[w])})}var d=n.getModel("itemStyle"),p=d.getItemStyle(),h=r.lastIndexOf("empty",0)===0?"fill":"stroke",g=d.getShallow("decal");p.decal=!g||g==="inherit"?o.decal:createOrUpdatePatternFromDecal(g,c),p.fill==="inherit"&&(p.fill=o[a]),p.stroke==="inherit"&&(p.stroke=o[h]),p.opacity==="inherit"&&(p.opacity=(a==="fill"?o:i).opacity),f(p,o);var v=n.getModel("lineStyle"),y=v.getLineStyle();if(f(y,i),p.fill==="auto"&&(p.fill=o.fill),p.stroke==="auto"&&(p.stroke=o.fill),y.stroke==="auto"&&(y.stroke=o.fill),!u){var A=n.get("inactiveBorderWidth"),_=p[h];p.lineWidth=A==="auto"?o.lineWidth>0&&_?2:0:p.lineWidth,p.fill=n.get("inactiveColor"),p.stroke=n.get("inactiveBorderColor"),y.stroke=v.get("inactiveColor"),y.lineWidth=v.get("inactiveWidth")}return{itemStyle:p,lineStyle:y}}function getDefaultLegendIcon(r){var n=r.icon||"roundRect",i=createSymbol(n,0,0,r.itemWidth,r.itemHeight,r.itemStyle.fill,r.symbolKeepAspect);return i.setStyle(r.itemStyle),i.rotation=(r.iconRotate||0)*Math.PI/180,i.setOrigin([r.itemWidth/2,r.itemHeight/2]),n.indexOf("empty")>-1&&(i.style.stroke=i.style.fill,i.style.fill="#fff",i.style.lineWidth=2),i}function dispatchSelectAction(r,n,i,o){dispatchDownplayAction(r,n,i,o),i.dispatchAction({type:"legendToggleSelect",name:r??n}),dispatchHighlightAction(r,n,i,o)}function isUseHoverLayer(r){for(var n=r.getZr().storage.getDisplayList(),i,o=0,a=n.length;o<a&&!(i=n[o].states.emphasis);)o++;return i&&i.hoverLayer}function dispatchHighlightAction(r,n,i,o){isUseHoverLayer(i)||i.dispatchAction({type:"highlight",seriesName:r,name:n,excludeSeriesId:o})}function dispatchDownplayAction(r,n,i,o){isUseHoverLayer(i)||i.dispatchAction({type:"downplay",seriesName:r,name:n,excludeSeriesId:o})}const LegendView$1=LegendView;function legendFilter(r){var n=r.findComponents({mainType:"legend"});n&&n.length&&r.filterSeries(function(i){for(var o=0;o<n.length;o++)if(!n[o].isSelected(i.name))return!1;return!0})}function legendSelectActionHandler(r,n,i){var o={},a=r==="toggleSelected",u;return i.eachComponent("legend",function(c){a&&u!=null?c[u?"select":"unSelect"](n.name):r==="allSelect"||r==="inverseSelect"?c[r]():(c[r](n.name),u=c.isSelected(n.name));var f=c.getData();each$4(f,function(d){var p=d.get("name");if(!(p===`
|
251
|
-
`||p==="")){var h=c.isSelected(p);o.hasOwnProperty(p)?o[p]=o[p]&&h:o[p]=h}})}),r==="allSelect"||r==="inverseSelect"?{selected:o}:{name:n.name,selected:o}}function installLegendAction(r){r.registerAction("legendToggleSelect","legendselectchanged",curry$1(legendSelectActionHandler,"toggleSelected")),r.registerAction("legendAllSelect","legendselectall",curry$1(legendSelectActionHandler,"allSelect")),r.registerAction("legendInverseSelect","legendinverseselect",curry$1(legendSelectActionHandler,"inverseSelect")),r.registerAction("legendSelect","legendselected",curry$1(legendSelectActionHandler,"select")),r.registerAction("legendUnSelect","legendunselected",curry$1(legendSelectActionHandler,"unSelect"))}function install$2(r){r.registerComponentModel(LegendModel$1),r.registerComponentView(LegendView$1),r.registerProcessor(r.PRIORITY.PROCESSOR.SERIES_FILTER,legendFilter),r.registerSubTypeDefaulter("legend",function(){return"plain"}),installLegendAction(r)}var ScrollableLegendModel=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i}return n.prototype.setScrollDataIndex=function(i){this.option.scrollDataIndex=i},n.prototype.init=function(i,o,a){var u=getLayoutParams(i);r.prototype.init.call(this,i,o,a),mergeAndNormalizeLayoutParams(this,i,u)},n.prototype.mergeOption=function(i,o){r.prototype.mergeOption.call(this,i,o),mergeAndNormalizeLayoutParams(this,this.option,i)},n.type="legend.scroll",n.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}),n}(LegendModel$1);function mergeAndNormalizeLayoutParams(r,n,i){var o=r.getOrient(),a=[1,1];a[o.index]=0,mergeLayoutParam(n,i,{type:"box",ignoreSize:!!a})}const ScrollableLegendModel$1=ScrollableLegendModel;var Group=Group$3,WH=["width","height"],XY=["x","y"],ScrollableLegendView=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i.newlineDisabled=!0,i._currentIndex=0,i}return n.prototype.init=function(){r.prototype.init.call(this),this.group.add(this._containerGroup=new Group),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new Group)},n.prototype.resetInner=function(){r.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},n.prototype.renderInner=function(i,o,a,u,c,f,d){var p=this;r.prototype.renderInner.call(this,i,o,a,u,c,f,d);var h=this._controllerGroup,g=o.get("pageIconSize",!0),v=isArray$1(g)?g:[g,g];A("pagePrev",0);var y=o.getModel("pageTextStyle");h.add(new ZRText$1({name:"pageText",style:{text:"xx/xx",fill:y.getTextColor(),font:y.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),A("pageNext",1);function A(_,S){var b=_+"DataIndex",T=createIcon(o.get("pageIcons",!0)[o.getOrient().name][S],{onclick:bind$1(p._pageGo,p,b,o,u)},{x:-v[0]/2,y:-v[1]/2,width:v[0],height:v[1]});T.name=_,h.add(T)}},n.prototype.layoutInner=function(i,o,a,u,c,f){var d=this.getSelectorGroup(),p=i.getOrient().index,h=WH[p],g=XY[p],v=WH[1-p],y=XY[1-p];c&&box("horizontal",d,i.get("selectorItemGap",!0));var A=i.get("selectorButtonGap",!0),_=d.getBoundingRect(),S=[-_.x,-_.y],b=clone$2(a);c&&(b[h]=a[h]-_[h]-A);var T=this._layoutContentAndController(i,u,b,p,h,v,y,g);if(c){if(f==="end")S[p]+=T[h]+A;else{var w=_[h]+A;S[p]-=w,T[g]-=w}T[h]+=_[h]+A,S[1-p]+=T[y]+T[v]/2-_[v]/2,T[v]=Math.max(T[v],_[v]),T[y]=Math.min(T[y],_[y]+S[1-p]),d.x=S[0],d.y=S[1],d.markRedraw()}return T},n.prototype._layoutContentAndController=function(i,o,a,u,c,f,d,p){var h=this.getContentGroup(),g=this._containerGroup,v=this._controllerGroup;box(i.get("orient"),h,i.get("itemGap"),u?a.width:null,u?null:a.height),box("horizontal",v,i.get("pageButtonItemGap",!0));var y=h.getBoundingRect(),A=v.getBoundingRect(),_=this._showController=y[c]>a[c],S=[-y.x,-y.y];o||(S[u]=h[p]);var b=[0,0],T=[-A.x,-A.y],w=retrieve2(i.get("pageButtonGap",!0),i.get("itemGap",!0));if(_){var x=i.get("pageButtonPosition",!0);x==="end"?T[u]+=a[c]-A[c]:b[u]+=A[c]+w}T[1-u]+=y[f]/2-A[f]/2,h.setPosition(S),g.setPosition(b),v.setPosition(T);var k={x:0,y:0};if(k[c]=_?a[c]:y[c],k[f]=Math.max(y[f],A[f]),k[d]=Math.min(0,A[d]+T[1-u]),g.__rectSize=a[c],_){var M={x:0,y:0};M[c]=Math.max(a[c]-A[c]-w,0),M[f]=k[f],g.setClipPath(new Rect$1({shape:M})),g.__rectSize=M[c]}else v.eachChild(function(z){z.attr({invisible:!0,silent:!0})});var D=this._getPageInfo(i);return D.pageIndex!=null&&updateProps$1(h,{x:D.contentPosition[0],y:D.contentPosition[1]},_?i:null),this._updatePageInfoView(i,D),k},n.prototype._pageGo=function(i,o,a){var u=this._getPageInfo(o)[i];u!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:u,legendId:o.id})},n.prototype._updatePageInfoView=function(i,o){var a=this._controllerGroup;each$4(["pagePrev","pageNext"],function(h){var g=h+"DataIndex",v=o[g]!=null,y=a.childOfName(h);y&&(y.setStyle("fill",v?i.get("pageIconColor",!0):i.get("pageIconInactiveColor",!0)),y.cursor=v?"pointer":"default")});var u=a.childOfName("pageText"),c=i.get("pageFormatter"),f=o.pageIndex,d=f!=null?f+1:0,p=o.pageCount;u&&c&&u.setStyle("text",isString$2(c)?c.replace("{current}",d==null?"":d+"").replace("{total}",p==null?"":p+""):c({current:d,total:p}))},n.prototype._getPageInfo=function(i){var o=i.get("scrollDataIndex",!0),a=this.getContentGroup(),u=this._containerGroup.__rectSize,c=i.getOrient().index,f=WH[c],d=XY[c],p=this._findTargetItemIndex(o),h=a.children(),g=h[p],v=h.length,y=v?1:0,A={contentPosition:[a.x,a.y],pageCount:y,pageIndex:y-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!g)return A;var _=x(g);A.contentPosition[c]=-_.s;for(var S=p+1,b=_,T=_,w=null;S<=v;++S)w=x(h[S]),(!w&&T.e>b.s+u||w&&!k(w,b.s))&&(T.i>b.i?b=T:b=w,b&&(A.pageNextDataIndex==null&&(A.pageNextDataIndex=b.i),++A.pageCount)),T=w;for(var S=p-1,b=_,T=_,w=null;S>=-1;--S)w=x(h[S]),(!w||!k(T,w.s))&&b.i<T.i&&(T=b,A.pagePrevDataIndex==null&&(A.pagePrevDataIndex=b.i),++A.pageCount,++A.pageIndex),b=w;return A;function x(M){if(M){var D=M.getBoundingRect(),z=D[d]+M[d];return{s:z,e:z+D[f],i:M.__legendDataIndex}}}function k(M,D){return M.e>=D&&M.s<=D+u}},n.prototype._findTargetItemIndex=function(i){if(!this._showController)return 0;var o,a=this.getContentGroup(),u;return a.eachChild(function(c,f){var d=c.__legendDataIndex;u==null&&d!=null&&(u=f),d===i&&(o=f)}),o??u},n.type="legend.scroll",n}(LegendView$1);const ScrollableLegendView$1=ScrollableLegendView;function installScrollableLegendAction(r){r.registerAction("legendScroll","legendscroll",function(n,i){var o=n.scrollDataIndex;o!=null&&i.eachComponent({mainType:"legend",subType:"scroll",query:n},function(a){a.setScrollDataIndex(o)})})}function install$1(r){use(install$2),r.registerComponentModel(ScrollableLegendModel$1),r.registerComponentView(ScrollableLegendView$1),installScrollableLegendAction(r)}function install(r){use(install$2),use(install$1)}const _sfc_main$G=vue.defineComponent({__name:"pie-charts",props:{title:{type:String,default:"标题"},seriesName:{type:String,default:"详情"},seriesData:{type:Array,default:()=>[]}},setup(r){const n=r;use([install$7,install$6,install$3,install$4,install]),vue.provide(VChart.THEME_KEY,"dark");const i=vue.reactive({title:{text:n.title,left:"center"},tooltip:{trigger:"item",formatter:"{a} <br/>{b} : {c} ({d}%)"},legend:{orient:"vertical",left:"left"},series:[{name:n.seriesName,type:"pie",radius:"55%",center:["50%","60%"],data:n.seriesData,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]});return vue.watch(n,o=>{i.title.text=o.title,i.series[0].name=o.seriesName,i.series[0].data=o.seriesData}),(o,a)=>(vue.openBlock(),vue.createBlock(vue.unref(VChart),{class:"chart",option:vue.unref(i),autoresize:""},null,8,["option"]))}}),pieCharts_vue_vue_type_style_index_0_scoped_fec2cbf2_lang="",PieCharts=_export_sfc$1(_sfc_main$G,[["__scopeId","data-v-fec2cbf2"]]),_hoisted_1$k=["id"],_hoisted_2$h=["id"],_hoisted_3$e=["fill"],_hoisted_4$a=["fill"],_hoisted_5$8=["fill"],_hoisted_6$6=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$6=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$6=["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$4=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"],_sfc_main$F=vue.defineComponent({__name:"light-a",props:{id:{default:""},isOpen:{type:Boolean,default:!1}},emits:["onChange"],setup(r,{emit:n}){const i=r;return vue.watch(()=>i.isOpen,()=>{n("onChange")}),(o,a)=>(vue.openBlock(),vue.createElementBlock("g",{id:i.id,style:{cursor:"pointer"}},[vue.createElementVNode("symbol",{id:`${i.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:i.isOpen?"#FDB813":"#cccccc"},null,8,_hoisted_3$e),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:i.isOpen?"#FD9B13":"#bbbbbb"},null,8,_hoisted_4$a),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:i.isOpen?"#F12A3F":"#666666"},null,8,_hoisted_5$8),_hoisted_6$6,_hoisted_7$6,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":i.isOpen?1:0},null,8,_hoisted_8$6),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":i.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":i.isOpen?1:0},null,8,_hoisted_10$5),_hoisted_11$4,_hoisted_12$4,_hoisted_13$3],8,_hoisted_2$h),vue.createElementVNode("use",{"xlink:href":`#${i.id}light-121`,width:"100",height:"100"},null,8,_hoisted_14$3)],8,_hoisted_1$k))}}),_hoisted_1$j=["id"],_hoisted_2$g=["id"],_hoisted_3$d=["fill"],_hoisted_4$9=["fill"],_hoisted_5$7=["fill"],_hoisted_6$5=["from","to"],_hoisted_7$5=["fill"],_hoisted_8$5=["from","to"],_hoisted_9$5=["fill"],_hoisted_10$4=["fill"],_hoisted_11$3=["fill"],_hoisted_12$3=["from","to"],_hoisted_13$2=["fill"],_hoisted_14$2=["xlink:href"],_sfc_main$E=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(r){const n=r,i=new Date(Number(window.sessionStorage.getItem("editorLoadTime")||"0")),o=i.getSeconds()+1,a=i.getMinutes(),u=Math.floor((i.getHours()+(a+o/60)/60)*30);return(c,f)=>(vue.openBlock(),vue.createElementBlock("g",{id:n.id},[vue.createElementVNode("symbol",{id:`${n.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:n.borderColor},null,8,_hoisted_3$d),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:n.backgroundColor},null,8,_hoisted_4$9),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:n.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$5)],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:n.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$5)],8,_hoisted_7$5),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:n.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:n.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:n.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$3)],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:n.centerColor},null,8,_hoisted_13$2)],8,_hoisted_2$g),vue.createElementVNode("use",{"xlink:href":`#${n.id}clock-a-n`,width:"100",height:"100"},null,8,_hoisted_14$2)],8,_hoisted_1$j))}}),vueComp={"svg-text":_sfc_main$J,"el-button":elementPlus.ElButton,"progress-a":_sfc_main$L,"el-tag":elementPlus.ElTag,"common-table":_sfc_main$I,"pie-charts":PieCharts,"switch-r":_sfc_main$K,"now-time":NowTime,"light-a":_sfc_main$F,"clock-a":_sfc_main$E},config=[...svg_config,...vue_config],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(r){this.intention=EGlobalStoreIntention.Create,this.create_svg_info=r},setDoneJson(r){isOfType(r,"id")?(this.done_json.push(r),vue.nextTick(()=>{setSvgActualInfo(r)})):this.done_json=objectDeepClone(r),vue.nextTick(()=>{useHistoryRecord(objectDeepClone(this.done_json))})},setHandleSvgInfo(r,n){let i=n;r?(!i&&i!=0&&(i=this.done_json.findIndex(o=>o.id===r.id)??-1),this.handle_svg_info={info:r,index:i}):this.handle_svg_info=r},spliceDoneJson(r){const n=useGlobalStore(),o=n.done_json.splice(r,1)[0];unbindAnchors(o.id),useHistoryRecord(n.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=r=>{r.stopPropagation()},preventDefault=r=>{r.preventDefault()};function componentsRegister(){var n,i;const r=vue.getCurrentInstance();for(let o in vueComp)!((n=r==null?void 0:r.appContext)!=null&&n.components.hasOwnProperty(o))&&vueComp.hasOwnProperty(o)&&((i=r==null?void 0:r.appContext)==null||i.app.component(o,vueComp[o]))}function setEditorLoadTime(){window.sessionStorage.setItem("editorLoadTime",new Date().getTime().toString())}const randomString=r=>{r=r||10;const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=n.length;let o="";for(let a=0;a<r;a++){let u=i;a===0&&(u=i-10),o+=n.charAt(Math.floor(Math.random()*u))}return o},isOfType=(r,n)=>r[n]!==void 0,getCoordinateOffset=(r,n)=>r/2*(n-1),angleToRadian=r=>r*Math.PI/180,calculateRotatedPointCoordinate=(r,n,i)=>({x:parseFloat(((r.x-n.x)*Math.cos(angleToRadian(i))-(r.y-n.y)*Math.sin(angleToRadian(i))+n.x).toFixed(1)),y:parseFloat(((r.x-n.x)*Math.sin(angleToRadian(i))+(r.y-n.y)*Math.cos(angleToRadian(i))+n.y).toFixed(1))}),getCenterPoint=(r,n)=>({x:r.x+(n.x-r.x)/2,y:r.y+(n.y-r.y)/2}),positionArrToPath=r=>{let n="";for(let i=0;i<r.length;i++)i===0?n+=`M ${r[i].x} ${r[i].y}`:n+=` L ${r[i].x} ${r[i].y}`;return n},getSvgNowPosition=(r,n,i)=>i+(n-r),objectDeepClone=(r,n={})=>r?JSON.parse(JSON.stringify(r)):n,setSvgActualInfo=(r,n)=>{var a,u;const i=document.querySelector(`#${r.id}`),o=document.querySelector(`#rect${r.id}`);if(i){let c=0,f=0,d=0,p=0;if(r.type===EDoneJsonType.Vue){d=((a=r.props.width)==null?void 0:a.val)||i.offsetWidth||100,p=((u=r.props.height)==null?void 0:u.val)||i.offsetHeight||100,c=50-d/2,f=50-p/2;const h=document.querySelector(`#foreign-object${r.id}`);h&&(h.getAttribute("x")==="0"&&h.getAttribute("y")==="0"&&h.getAttribute("width")==="0"&&h.getAttribute("height")==="0"||n)&&(h.setAttribute("x",c.toString()),h.setAttribute("y",f.toString()),h.setAttribute("width",d.toString()),h.setAttribute("height",p.toString()))}else{const h=i.getBBox();c=parseFloat(h.x.toFixed(0)),f=parseFloat(h.y.toFixed(0)),d=parseFloat(h.width.toFixed(0)),p=parseFloat(h.height.toFixed(0))}o&&(o.getAttribute("x")==="0"&&o.getAttribute("y")==="0"&&o.getAttribute("width")==="0"&&o.getAttribute("height")==="0"||n)&&(o.setAttribute("x",c.toString()),o.setAttribute("y",f.toString()),o.setAttribute("width",d.toString()),o.setAttribute("height",p.toString())),(r.actual_bound.x===0&&r.actual_bound.y===0&&r.actual_bound.width===0&&r.actual_bound.height===0||n)&&(r.actual_bound={x:c,y:f,width:d,height:p}),r.center_position={x:r.x+r.actual_bound.x+d/2,y:r.y+r.actual_bound.y+p/2},r.point_coordinate.tl={x:r.center_position.x-d*r.scale_x/2,y:r.center_position.y-p*r.scale_y/2},r.point_coordinate.tc={x:r.center_position.x,y:r.center_position.y-p*r.scale_y/2},r.point_coordinate.tr={x:r.center_position.x+d*r.scale_x/2,y:r.center_position.y-p*r.scale_y/2},r.point_coordinate.l={x:r.center_position.x-d*r.scale_x/2,y:r.center_position.y},r.point_coordinate.r={x:r.center_position.x+d*r.scale_x/2,y:r.center_position.y},r.point_coordinate.bl={x:r.center_position.x-d*r.scale_x/2,y:r.center_position.y+p*r.scale_y/2},r.point_coordinate.bc={x:r.center_position.x,y:r.center_position.y+p*r.scale_y/2},r.point_coordinate.br={x:r.center_position.x+d*r.scale_x/2,y:r.center_position.y+p*r.scale_y/2},r.rotate!==0&&setAfterRotationPointCoordinate(r),moveAnchors(r)}},resetHandlePointOld=r=>{for(const n of Object.keys(r.point_coordinate))r.point_coordinate_old&&(r.point_coordinate_old[n].x=0,r.point_coordinate_old[n].y=0)},moveHandlePoint=(r,n,i)=>{const o=useGlobalStore(pinia),a=n??o.mouse_info.new_position_x-o.mouse_info.position_x,u=i??o.mouse_info.new_position_y-o.mouse_info.position_y;for(const c of Object.keys(r.point_coordinate))n!==void 0&&i!==void 0?(r.point_coordinate[c].x+=a,r.point_coordinate[c].y+=u):r.point_coordinate_old&&(r.point_coordinate[c].x=r.point_coordinate_old[c].x+a,r.point_coordinate[c].y=r.point_coordinate_old[c].y+u)},moveAnchors=r=>{var i,o,a,u;const n=useGlobalStore(pinia);for(let c of n.done_json)if(c.type===EDoneJsonType.ConnectionLine){if(((o=(i=c.bind_anchors)==null?void 0:i.start)==null?void 0:o.target_id)===r.id){const f=getAnchorPosByAnchorType(c.bind_anchors.start.type,r);c.props.point_position.val[0]={x:f.x-c.x,y:f.y-c.y}}if(((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===r.id){const f=getAnchorPosByAnchorType(c.bind_anchors.end.type,r);c.props.point_position.val[c.props.point_position.val.length-1]={x:f.x-c.x,y:f.y-c.y}}}},unbindAnchors=r=>{var i,o,a,u;const n=useGlobalStore(pinia);for(let c of n.done_json)c.type===EDoneJsonType.ConnectionLine&&(((o=(i=c.bind_anchors)==null?void 0:i.start)==null?void 0:o.target_id)===r&&(c.bind_anchors.start=null),((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===r&&(c.bind_anchors.end=null))},getAnchorPosByAnchorType=(r,n)=>r===ELineBindAnchors.BottomCenter?n.point_coordinate.bc:r===ELineBindAnchors.Left?n.point_coordinate.l:r===ELineBindAnchors.Right?n.point_coordinate.r:n.point_coordinate.tc,setAfterRotationPointCoordinate=r=>{r.point_coordinate={tl:calculateRotatedPointCoordinate(r.point_coordinate.tl,r.center_position,r.rotate),tc:calculateRotatedPointCoordinate(r.point_coordinate.tc,r.center_position,r.rotate),tr:calculateRotatedPointCoordinate(r.point_coordinate.tr,r.center_position,r.rotate),l:calculateRotatedPointCoordinate(r.point_coordinate.l,r.center_position,r.rotate),r:calculateRotatedPointCoordinate(r.point_coordinate.r,r.center_position,r.rotate),bl:calculateRotatedPointCoordinate(r.point_coordinate.bl,r.center_position,r.rotate),bc:calculateRotatedPointCoordinate(r.point_coordinate.bc,r.center_position,r.rotate),br:calculateRotatedPointCoordinate(r.point_coordinate.br,r.center_position,r.rotate)}},prosToVBind=(r,n=[])=>{let i={};if(r.state){for(const o in r.state)if(r.state.hasOwnProperty(o)&&o===r.defaultState){for(let a in r.state[o])a!=="label"&&(i[lodashEs.kebabCase(a)]=r.state[o][a]);break}}for(const o in r.props)n.indexOf(o)<0&&(i[lodashEs.kebabCase(o)]=r.props[o].val);return i},setArrItemByID=(id,key,val,json_arr)=>new Promise(res=>{const find_item=json_arr.find(r=>r.id===id);find_item||res({status:!1,msg:"要设置的id不存在"}),eval(`find_item.${key} = val;`),res({status:!0,msg:"操作成功"})}),getCommonClass=r=>!r.common_animations||!r.common_animations.val?"":`common-ani animate__animated animate__${r.common_animations.val} animate__${r.common_animations.speed} animate__${r.common_animations.repeat} animate__${r.common_animations.delay}`,numberArray=r=>{let n=[];for(let i=0;i<r;i++)n.push(i);return n},getStringWidth=(r,n=12)=>{if(r.length>0){let i=document.createElement("span");i.style.fontSize=n+"px",i.style.fontFamily="inherit",i.innerHTML=r,i.style.opacity="0",i.style.position="fixed",i.style.top="3000px",document.body.append(i);const o=i.clientWidth;return document.body.removeChild(i),o}return 0},valFormat=r=>/false|true/.test(r)?r!=="false":/^\d+(\.\d+)?$/.test(r)?Number(r):r,createLine=(r,n,i)=>{r.preventDefault();const o=useGlobalStore(pinia),a=useConfigStore(pinia),u=useSvgEditLayoutStore(pinia),{clientX:c,clientY:f}=r;let d=objectDeepClone(a.connection_line),p=0,h=0;if(n&&i){d.bind_anchors.start={type:n,target_id:i.id};let v=getAnchorPosByAnchorType(n,i);p=v.x,h=v.y}else p=Math.round((c-u.canvasInfo.left)/a.svg.scale-u.center_offset.x),h=Math.round((f-u.canvasInfo.top)/a.svg.scale-u.center_offset.y);const g={id:randomString(),x:p,y:h,client:{x:p,y:h},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}},...d};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:p,position_y:h,now_position_x:p,now_position_y:h,new_position_x:0,new_position_y:0}};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:"#0a7ae2"},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 r=JSON.parse(l);t=r.connection_line,s=r.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=(r=>(r.Copy="Copy",r.Delete="Delete",r.MoveUpOneLevel="MoveUpOneLevel",r.MoveDownOneLevel="MoveDownOneLevel",r.MoveUpTopLevel="MoveUpTopLevel",r.MoveDownTopLevel="MoveDownTopLevel",r))(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(r){return r.history_now_index>=1},getTopBtnRedoStatus(r){return r.history_now_index+1!=r.history_doneComponent.length}},actions:{topUndoBtnClick(){if(console.log("撤销"),this.history_now_index<1)return;const r=useGlobalStore();this.is_record_history=!1,this.history_now_index-=1,r.setDoneJson(this.history_doneComponent[this.history_now_index])},topRedoBtnClick(){if(console.log("重做"),this.history_now_index+1==this.history_doneComponent.length)return;const r=useGlobalStore();this.is_record_history=!1,this.history_now_index+=1,r.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(r){const n=useGlobalStore();if(n.handle_svg_info)switch(n.intention=EGlobalStoreIntention.Select,r){case EContextMenuInfoType.Copy:const i=objectDeepClone(n.handle_svg_info.info);i.id=randomString(),i.title+="-copy",i.x+=10,i.y+=10,n.setDoneJson(i),this.display=!1,n.setHandleSvgInfo(i,n.done_json.length);break;case EContextMenuInfoType.Delete:n.spliceDoneJson(n.handle_svg_info.index),this.display=!1,n.setHandleSvgInfo(null),n.intention=EGlobalStoreIntention.None;break;case EContextMenuInfoType.MoveUpOneLevel:if(n.done_json.length===1||n.handle_svg_info.index===n.done_json.length-1)return;const o=n.handle_svg_info.info;n.done_json[n.handle_svg_info.index]=n.done_json[n.handle_svg_info.index+1],n.done_json[n.handle_svg_info.index+1]=o,useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(o,n.handle_svg_info.index+1);break;case EContextMenuInfoType.MoveDownOneLevel:if(n.done_json.length===1||n.handle_svg_info.index===0)return;const a=n.handle_svg_info.info;n.done_json[n.handle_svg_info.index]=n.done_json[n.handle_svg_info.index-1],n.done_json[n.handle_svg_info.index-1]=a,useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(a,n.handle_svg_info.index-1);break;case EContextMenuInfoType.MoveDownTopLevel:if(n.done_json.length===1||n.handle_svg_info.index===0)return;const u=n.handle_svg_info.info;n.done_json.splice(n.handle_svg_info.index,1),n.done_json.unshift(u),useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(u,0);break;case EContextMenuInfoType.MoveUpTopLevel:if(n.done_json.length===1||n.handle_svg_info.index===n.done_json.length)return;const c=n.handle_svg_info.info;n.done_json.splice(n.handle_svg_info.index,1),n.done_json.push(c),useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(c,n.done_json.length-1);break}}}}),pinia=pinia$1.createPinia(),useHistoryRecord=r=>{const n=useEditPrivateStore();n.is_record_history&&(n.history_now_index+1<n.history_doneComponent.length&&n.history_doneComponent.splice(n.history_now_index+1),n.history_doneComponent.push(r),n.history_now_index=n.history_doneComponent.length-1,n.history_doneComponent.length>n.max_record_times&&(n.history_doneComponent.shift(),n.history_now_index=n.history_doneComponent.length-1)),n.is_record_history=!0},useImportDataModel=r=>{try{const n=JSON.parse(r);if(!n.config||!n.layout_center||!n.done_json)return elementPlus.ElMessage.error("请导入正确的数据模型!"),!1;const i=useGlobalStore(pinia),o=useSvgEditLayoutStore(pinia),a=useConfigStore(pinia);return a.$state=n.config,o.center_offset=n.layout_center,i.setDoneJson(n.done_json),!0}catch(n){return elementPlus.ElMessage.error("请导入正确的数据模型!"),console.error(n),!1}},_hoisted_1$i={"aria-hidden":"true"},_hoisted_2$f=["xlink:href"],_sfc_main$D=vue.defineComponent({__name:"svg-analysis",props:{name:{},props:{default:()=>({})}},setup(r){const n=r,i=vue.computed(()=>`#svg-${n.name}`);return(o,a)=>(vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$i,[vue.createElementVNode("use",vue.mergeProps({"xlink:href":vue.unref(i)},n.props),null,16,_hoisted_2$f)]))}});var EVisibleConfKey=(r=>(r.ImportJson="ImportJson",r.ExportJson="ExportJson",r.ImportFile="ImportFile",r))(EVisibleConfKey||{});const _withScopeId$2=r=>(vue.pushScopeId("data-v-62907637"),r=r(),vue.popScopeId(),r),_hoisted_1$h={class:"flex justify-between",style:{width:"100%"}},_hoisted_2$e={class:"flex items-center justify-between",style:{width:"250px"}},_hoisted_3$c=_withScopeId$2(()=>vue.createElementVNode("div",{class:"flex items-center"},[vue.createElementVNode("span",{class:"logo-title"},"Svg Editor")],-1)),_hoisted_4$8={class:"flex justify-between",style:{width:"calc(100% - 440px)"}},_hoisted_5$6={class:"flex items-center"},_hoisted_6$4={class:"flex items-center mr-20px"},_hoisted_7$4={class:"flex items-center",style:{width:"250px"}},_hoisted_8$4=_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$2=_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$2=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_17=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"标尺辅助线",-1)),_hoisted_18=_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$1=_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$1=_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$1=_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$1=_withScopeId$2(()=>vue.createElementVNode("div",{style:{"padding-bottom":"14px"}}," 选中线段,在右侧‘数据’栏里解除绑定;或者鼠标左键拖拽连线上需要解绑的节点",-1)),_sfc_main$C=vue.defineComponent({__name:"top-panel",emits:["changeVisible","onReturn","onPreview","onSave"],setup(r,{emit:n}){const i=useSvgEditLayoutStore(pinia),o=useGlobalStore(pinia),a=useEditPrivateStore(pinia),u=useConfigStore(pinia),c=()=>{o.done_json.length<=0||o.setDoneJson([]),o.intention=EGlobalStoreIntention.None},f=h=>{const g={layout_center:i.center_offset,config:u.$state,done_json:o.done_json};n(h,g)},d=vue.ref(!1),p=vue.computed({get:()=>o.intention===EGlobalStoreIntention.Connection,set(h){o.intention=h?EGlobalStoreIntention.Connection:EGlobalStoreIntention.None,h&&o.setHandleSvgInfo(null)}});return(h,g)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$h,[vue.createElementVNode("div",_hoisted_2$e,[_hoisted_3$c,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:g[0]||(g[0]=v=>vue.unref(i).left_nav=!vue.unref(i).left_nav),title:vue.unref(i).left_nav?"隐藏左侧菜单":"显示左侧菜单"},{default:vue.withCtx(()=>[vue.unref(i).left_nav?(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:0,name:"menu-unfold"})):(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:1,name:"menu-fold"}))]),_:1},8,["title"])]),vue.createElementVNode("div",_hoisted_4$8,[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:g[1]||(g[1]=()=>vue.unref(a).topUndoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{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:g[2]||(g[2]=()=>vue.unref(a).topRedoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{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:c},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{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:g[3]||(g[3]=v=>n("changeVisible",vue.unref(EVisibleConfKey).ImportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"import"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"导出数据模型",size:24,class:"bt-Icon ml-5px",onClick:g[4]||(g[4]=v=>n("changeVisible",vue.unref(EVisibleConfKey).ExportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{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(p)}]),size:24,onClick:g[5]||(g[5]=v=>p.value=!vue.unref(p))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:vue.unref(p)?"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:g[6]||(g[6]=v=>d.value=!vue.unref(d))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"question"})]),_:1})]),vue.createElementVNode("div",_hoisted_6$4,[vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"返回",class:"bt-Icon",size:24,onClick:g[7]||(g[7]=v=>f("onReturn"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"return"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"保存",class:"bt-Icon",size:24,onClick:g[8]||(g[8]=v=>f("onSave"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"save"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"预览",class:"bt-Icon",size:22,onClick:g[9]||(g[9]=v=>f("onPreview"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"preview"})]),_:1})])]),vue.createElementVNode("div",_hoisted_7$4,[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:g[10]||(g[10]=v=>vue.unref(i).right_nav=!vue.unref(i).right_nav),title:vue.unref(i).right_nav?"隐藏右侧菜单":"显示右侧菜单"},{default:vue.withCtx(()=>[vue.unref(i).right_nav?(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:0,name:"menu-fold"})):(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:1,name:"menu-unfold"}))]),_:1},8,["title"])])]),vue.createVNode(vue.unref(elementPlus.ElDialog),{modelValue:vue.unref(d),"onUpdate:modelValue":g[11]||(g[11]=v=>vue.isRef(d)?d.value=v:null),title:"使用说明",width:"60%",class:"guide-dialog"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{"max-height":"60vh"},{default:vue.withCtx(()=>[_hoisted_8$4,_hoisted_9$4,_hoisted_10$3,_hoisted_11$2,_hoisted_12$2,_hoisted_13$1,_hoisted_14$1,_hoisted_15$1,_hoisted_16$2,_hoisted_17,_hoisted_18,_hoisted_19,_hoisted_20,_hoisted_21,_hoisted_22$1,_hoisted_23,_hoisted_24,_hoisted_25,_hoisted_26$1,_hoisted_27,_hoisted_28,_hoisted_29,_hoisted_30,_hoisted_31,_hoisted_32$1,_hoisted_33,_hoisted_34,_hoisted_35,_hoisted_36$1]),_:1})]),_:1},8,["modelValue"])],64))}}),topPanel_vue_vue_type_style_index_0_scoped_62907637_lang="",topPanel_vue_vue_type_style_index_1_lang="",TopPanel=_export_sfc$1(_sfc_main$C,[["__scopeId","data-v-62907637"]]),_hoisted_1$g={class:"component-group flex flex-wrap"},_hoisted_2$d=["onDragstart","title"],_sfc_main$B=vue.defineComponent({__name:"left-panel",props:{customToolbar:{}},setup(r){const n=r,i=useGlobalStore(pinia),o=vue.ref(n.customToolbar&&Object.keys(n.customToolbar).length>0?n.customToolbar:i.config_center),a=vue.ref(["stateful","stateless","have_animation","custom_svg_group","element-ui","custom-vue","echarts"]),u=f=>{i.setCreateInfo(f)},c=f=>{var d;if(((d=f.dataTransfer)==null?void 0:d.dropEffect)!=="copy"){elementPlus.ElMessage.warning("请将组件拖到画布中!"),i.intention=EGlobalStoreIntention.None;return}};return(f,d)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElCollapse),{modelValue:vue.unref(a),"onUpdate:modelValue":d[0]||(d[0]=p=>vue.isRef(a)?a.value=p:null),style:{"border-top":"none"}},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(o),p=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElCollapseItem),{name:p.groupType,key:p.title},{title:vue.withCtx(()=>[vue.createElementVNode("div",null,vue.toDisplayString(p.title),1)]),default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$g,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(p.list,h=>(vue.openBlock(),vue.createElementBlock("div",{class:"ideal",key:h.name,draggable:"true",onDragstart:g=>u(h),onDragend:c,title:h.title},[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:35,class:"flex items-center"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:h.name,props:vue.unref(prosToVBind)(h,["width","height","maxHeight"])},null,8,["name","props"])]),_:2},1024)],40,_hoisted_2$d))),128))])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]))}}),leftPanel_vue_vue_type_style_index_0_scoped_d7403cfd_lang="",LeftPanel=_export_sfc$1(_sfc_main$B,[["__scopeId","data-v-d7403cfd"]]),calculateLeftTop=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate(n,o,-i);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightTop=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate(n,o,-i);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightBottom=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(n,o,-i),u=calculateRotatedPointCoordinate(r,o,-i);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateLeftBottom=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(n,o,-i),u=calculateRotatedPointCoordinate(r,o,-i);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateTop=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateRight=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},calculateBottom=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateLeft=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},_hoisted_1$f={style:{"vector-effect":"non-scaling-stroke"}},_hoisted_2$c=["fill","x","y"],_hoisted_3$b=["cx","cy"],_hoisted_4$7=["x1","y1","x2","y2"],_hoisted_5$5=["fill","x","y"],_hoisted_6$3=["fill","x","y"],_hoisted_7$3=["fill","x","y"],_hoisted_8$3=["fill","x","y"],_hoisted_9$3=["fill","x","y"],_hoisted_10$2=["fill","x","y"],_hoisted_11$1=["fill","x","y"],_sfc_main$A=vue.defineComponent({__name:"handle-panel",props:{itemInfo:{}},setup(r){const n=r;vue.useCssVars(v=>({"5c831aea":vue.unref(c)}));const i=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=vue.ref(4),c=vue.ref("#ab712e"),f=[{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}],d=vue.computed(()=>n.itemInfo.config.can_zoom),p=(v,y)=>{console.log("handMousedown",y);const{clientX:A,clientY:_}=y;y.stopPropagation(),i.intention=EGlobalStoreIntention.Zoom;const S=Math.round((A-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),b=Math.round((_-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);i.mouse_info={state:EMouseInfoState.Down,position_x:S,position_y:b,now_position_x:S,now_position_y:b,new_position_x:0,new_position_y:0},i.scale_info={type:v,scale_times:{x:n.itemInfo.scale_x,y:n.itemInfo.scale_y},scale_item_info:{x:n.itemInfo.x,y:n.itemInfo.y},symmetric_point:{x:S+Math.abs(S-n.itemInfo.center_position.x)*2*(S>n.itemInfo.center_position.x?-1:1),y:b+Math.abs(b-n.itemInfo.center_position.y)*2*(b>n.itemInfo.center_position.y?-1:1)}}},h=v=>{const{clientX:y,clientY:A}=v,_=Math.round((y-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),S=Math.round((A-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);v.stopPropagation(),i.intention=EGlobalStoreIntention.Rotate,i.rotate_info={angle:n.itemInfo.rotate},i.mouse_info={state:EMouseInfoState.Down,position_x:_,position_y:S,now_position_x:_,now_position_y:S,new_position_x:0,new_position_y:0}},g=v=>{const y=(v+n.itemInfo.rotate)%360,A=f.find(_=>_.start<=y&&_.end>y);return A?{cursor:A.cursor+"-resize",type:A.type}:{cursor:"nw-resize",type:EScaleInfoType.TopLeft}};return(v,y)=>(vue.openBlock(),vue.createElementBlock("g",_hoisted_1$f,[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:n.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[0]||(y[0]=A=>p(vue.unref(EScaleInfoType).TopLeft,A))},null,44,_hoisted_2$c),[[vue.vShow,vue.unref(d)]]),vue.createElementVNode("circle",{cx:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,cy:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)-24,r:4,class:"rotate-circle",onMousedown:h},null,40,_hoisted_3$b),vue.createElementVNode("line",{x1:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,y1:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),x2:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,y2:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)-20,style:vue.normalizeStyle({stroke:vue.unref(c),"stroke-width":2})},null,12,_hoisted_4$7),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:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2-vue.unref(u),y:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[1]||(y[1]=A=>p(vue.unref(EScaleInfoType).TopCenter,A))},null,44,_hoisted_5$5),[[vue.vShow,vue.unref(d)]]),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:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width-vue.unref(u)+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[2]||(y[2]=A=>p(vue.unref(EScaleInfoType).TopRight,A))},null,44,_hoisted_6$3),[[vue.vShow,vue.unref(d)]]),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:n.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[3]||(y[3]=A=>p(vue.unref(EScaleInfoType).Left,A))},null,44,_hoisted_7$3),[[vue.vShow,vue.unref(d)]]),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:n.itemInfo.actual_bound.x-vue.unref(u)+n.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[4]||(y[4]=A=>p(vue.unref(EScaleInfoType).Right,A))},null,44,_hoisted_8$3),[[vue.vShow,vue.unref(d)]]),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:n.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[5]||(y[5]=A=>p(vue.unref(EScaleInfoType).BottomLeft,A))},null,44,_hoisted_9$3),[[vue.vShow,vue.unref(d)]]),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:n.itemInfo.actual_bound.x-vue.unref(u)+n.itemInfo.actual_bound.width/2,y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[6]||(y[6]=A=>p(vue.unref(EScaleInfoType).BottomCenter,A))},null,44,_hoisted_10$2),[[vue.vShow,vue.unref(d)]]),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:n.itemInfo.actual_bound.x-vue.unref(u)+n.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[7]||(y[7]=A=>p(vue.unref(EScaleInfoType).BottomRight,A))},null,44,_hoisted_11$1),[[vue.vShow,vue.unref(d)]])]))}}),handlePanel_vue_vue_type_style_index_0_scoped_e6622df8_lang="",HandlePanel=_export_sfc$1(_sfc_main$A,[["__scopeId","data-v-e6622df8"]]),_hoisted_1$e=["fill"],_hoisted_2$b=["cx","cy","r"],_hoisted_3$a=["cx","cy","r"],_hoisted_4$6=["cx","cy","r"],_hoisted_5$4=["cx","cy","r"],_hoisted_6$2=["cx","cy","r"],_hoisted_7$2=["cx","cy","r"],_hoisted_8$2=["cx","cy","r"],_hoisted_9$2=["cx","cy","r"],_sfc_main$z=vue.defineComponent({__name:"connection-panel",props:{itemInfo:{}},setup(r){const n=r,i=vue.ref(4),o=vue.ref("#ab712e"),a=vue.ref(4),u=vue.ref(12),c=useGlobalStore(pinia),f=useSvgEditLayoutStore(pinia),d=vue.computed(()=>n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2-i.value+a.value),p=vue.computed(()=>n.itemInfo.actual_bound.y-i.value-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),h=vue.computed(()=>n.itemInfo.actual_bound.x-i.value+n.itemInfo.actual_bound.width+getCoordinateOffset(n.itemInfo.actual_bound.width,n.itemInfo.scale_x)+a.value),g=vue.computed(()=>n.itemInfo.actual_bound.y-i.value+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),v=vue.computed(()=>n.itemInfo.actual_bound.x-i.value+n.itemInfo.actual_bound.width/2+a.value),y=vue.computed(()=>n.itemInfo.actual_bound.y-i.value+n.itemInfo.actual_bound.height+getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),A=vue.computed(()=>n.itemInfo.actual_bound.x-i.value-getCoordinateOffset(n.itemInfo.actual_bound.width,n.itemInfo.scale_x)+a.value),_=vue.computed(()=>n.itemInfo.actual_bound.y-i.value+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),S=(T,w)=>{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:w,target_id:n.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:w,target_id:n.itemInfo.id}),c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(n.itemInfo)})))},b=(T,w)=>{var x;c.intention===EGlobalStoreIntention.None?(createLine(T,w,n.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-f.center_offset.x,y:c.mouse_info.new_position_y-c.mouse_info.position_y-f.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:w,target_id:n.itemInfo.id},c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(n.itemInfo)})))};return(T,w)=>(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:w[0]||(w[0]=x=>b(x,vue.unref(ELineBindAnchors).TopCenter)),onMouseup:w[1]||(w[1]=x=>S(x,vue.unref(ELineBindAnchors).TopCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(d),cy:vue.unref(p),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_2$b),vue.createElementVNode("circle",{id:"connection_tc",cx:vue.unref(d),cy:vue.unref(p),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_3$a)],32),vue.createElementVNode("g",{onMousedown:w[2]||(w[2]=x=>b(x,vue.unref(ELineBindAnchors).Right)),onMouseup:w[3]||(w[3]=x=>S(x,vue.unref(ELineBindAnchors).Right))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(h),cy:vue.unref(g),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_4$6),vue.createElementVNode("circle",{id:"connection_r",cx:vue.unref(h),cy:vue.unref(g),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_5$4)],32),vue.createElementVNode("g",{onMousedown:w[4]||(w[4]=x=>b(x,vue.unref(ELineBindAnchors).BottomCenter)),onMouseup:w[5]||(w[5]=x=>S(x,vue.unref(ELineBindAnchors).BottomCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(v),cy:vue.unref(y),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_6$2),vue.createElementVNode("circle",{id:"connection_bc",cx:vue.unref(v),cy:vue.unref(y),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_7$2)],32),vue.createElementVNode("g",{onMousedown:w[6]||(w[6]=x=>b(x,vue.unref(ELineBindAnchors).Left)),onMouseup:w[7]||(w[7]=x=>S(x,vue.unref(ELineBindAnchors).Left))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(A),cy:vue.unref(_),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_8$2),vue.createElementVNode("circle",{id:"connection_l",cx:vue.unref(A),cy:vue.unref(_),r:vue.unref(a),style:{cursor:"crosshair"},"pointer-events":"all"},null,8,_hoisted_9$2)],32)],8,_hoisted_1$e))}}),connectionPanel_vue_vue_type_style_index_0_scoped_fb729c7a_lang="",ConnectionPanel=_export_sfc$1(_sfc_main$z,[["__scopeId","data-v-fb729c7a"]]),_hoisted_1$d=["d","stroke-width"],_hoisted_2$a=["d","stroke-width"],_hoisted_3$9=["id","d","stroke","stroke-width","stroke-dasharray"],_hoisted_4$5=["from","to","dur","repeatCount"],_hoisted_5$3=["d","stroke","stroke-width","stroke-dasharray"],_hoisted_6$1=["from","to","dur","repeatCount"],_hoisted_7$1=["r","fill"],_hoisted_8$1=["path","dur","repeatCount"],_hoisted_9$1=["cx","cy","r"],_hoisted_10$1=["cx","cy","r","stroke","onMousedown"],_sfc_main$y=vue.defineComponent({__name:"connection-line",props:{itemInfo:{},pointVisible:{type:Boolean,default:!1}},setup(r){const n=r,i=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=(c,f,d,p)=>{if(i.intention===EGlobalStoreIntention.Connection)return;i.setHandleSvgInfo(n.itemInfo);const{clientX:h,clientY:g}=f;f.stopPropagation(),i.connection_line_node_info={init_pos:{x:d,y:p},point_index:c},i.intention=EGlobalStoreIntention.SetConnectionLineNode,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((h-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,f)=>{var d,p,h,g,v,y;return vue.openBlock(),vue.createElementBlock("g",{style:vue.normalizeStyle({cursor:vue.unref(i).intention===vue.unref(EGlobalStoreIntention).Connection?"crosshair":"move"})},[vue.withDirectives(vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#DE4517","stroke-width":n.itemInfo.props["stroke-width"].val+1,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_1$d),[[vue.vShow,n.itemInfo.selected||n.itemInfo.id===((d=vue.unref(i).handle_svg_info)==null?void 0:d.info.id)]]),vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#fff","stroke-opacity":".01","stroke-width":n.itemInfo.props["stroke-width"].val,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_2$a),vue.createElementVNode("path",{id:n.itemInfo.id,d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none",stroke:((p=n.itemInfo.animations)==null?void 0:p.type.val)===vue.unref(EConfigAnimationsType).Electricity?n.itemInfo.animations.color.val:n.itemInfo.props.stroke.val,"stroke-width":n.itemInfo.props["stroke-width"].val,"stroke-dashoffset":"0","stroke-dasharray":((h=n.itemInfo.animations)==null?void 0:h.type.val)===vue.unref(EConfigAnimationsType).Electricity?n.itemInfo.props["stroke-width"].val*3:0,"stroke-linejoin":"round"},[((g=n.itemInfo.animations)==null?void 0:g.type.val)===vue.unref(EConfigAnimationsType).Electricity?(vue.openBlock(),vue.createElementBlock("animate",{key:0,attributeName:"stroke-dashoffset",from:n.itemInfo.animations.reverse.val?0:1e3,to:n.itemInfo.animations.reverse.val?1e3:0,dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val},null,8,_hoisted_4$5)):vue.createCommentVNode("",!0)],8,_hoisted_3$9),((v=n.itemInfo.animations)==null?void 0:v.type.val)===vue.unref(EConfigAnimationsType).WaterDrop?(vue.openBlock(),vue.createElementBlock("path",{key:0,d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:n.itemInfo.animations.color.val,"stroke-width":n.itemInfo.props["stroke-width"].val,"stroke-dasharray":n.itemInfo.props["stroke-width"].val*3,"stroke-dashoffset":"0","stroke-linecap":"round","stroke-linejoin":"round"},[vue.createElementVNode("animate",{attributeName:"stroke-dashoffset",from:n.itemInfo.animations.reverse.val?0:1e3,to:n.itemInfo.animations.reverse.val?1e3:0,dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val,fill:"freeze"},null,8,_hoisted_6$1)],8,_hoisted_5$3)):((y=n.itemInfo.animations)==null?void 0:y.type.val)===vue.unref(EConfigAnimationsType).Track?(vue.openBlock(),vue.createElementBlock("circle",{key:1,cx:"0",cy:"0",r:Math.ceil(n.itemInfo.props["stroke-width"].val*.6)+2,fill:n.itemInfo.animations.color.val},[vue.createElementVNode("animateMotion",{path:vue.unref(positionArrToPath)(n.itemInfo.animations.reverse.val?[...n.itemInfo.props.point_position.val].reverse():n.itemInfo.props.point_position.val),dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val},null,8,_hoisted_8$1)],8,_hoisted_7$1)):vue.createCommentVNode("",!0),vue.createElementVNode("g",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.itemInfo.props.point_position.val,(A,_)=>{var S;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("circle",{key:_,cx:A.x,cy:A.y,r:n.itemInfo.props.point_r.val+1,fill:"none","fill-opacity":"0","stroke-width":"1",stroke:"#DE4517"},null,8,_hoisted_9$1)),[[vue.vShow,n.itemInfo.selected||n.itemInfo.id===((S=vue.unref(i).handle_svg_info)==null?void 0:S.info.id)]])}),128)),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.itemInfo.props.point_position.val,(A,_)=>(vue.openBlock(),vue.createElementBlock("circle",{key:_,cx:A.x,cy:A.y,r:n.itemInfo.props.point_r.val,"stroke-width":"1",stroke:n.itemInfo.props.stroke.val,fill:"#fff",style:{cursor:"pointer"},onMousedown:S=>u(_,S,A.x,A.y)},null,40,_hoisted_10$1))),128))])],4)}}}),_hoisted_1$c={id:"pattern_grid",patternUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},_hoisted_2$9=["stroke"],_hoisted_3$8=["stroke"],_hoisted_4$4=["stroke"],_hoisted_5$2=["stroke"],_hoisted_6={key:0,width:"100%",height:"100%",fill:"url(#pattern_grid)"},_hoisted_7=["transform"],_hoisted_8=["transform"],_hoisted_9=["transform","onMousedown","onMouseup","onMouseenter","onMouseleave","onContextmenu"],_hoisted_10=["xlink:href","id","transform"],_hoisted_11=["id"],_hoisted_12$1=["id","x1","y1","x2","y2"],_hoisted_13=["id"],_hoisted_14=["x","y","height","width"],_hoisted_15=["onClick"],_hoisted_16$1={class:"shortcut"},_sfc_main$x=vue.defineComponent({__name:"center-panel",setup(r,{expose:n}){vue.useCssVars(de=>({"2e4aaeb1":vue.unref(h)}));const i=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=useEditPrivateStore(pinia),c=useContextMenuStore(pinia);componentsRegister();const f=vue.ref(),d=vue.ref(),p={MoveCanvas:"grab",Rotate:"url('/src/assets/icons/rotate.svg'), auto",Connection:"crosshair",SetConnectionLineNode:"crosshair"},h=vue.computed(()=>Object.keys(p).indexOf(i.intention)>-1?p[i.intention]:"default"),g=vue.reactive({handle_panel:vue.computed(()=>i.intention===EGlobalStoreIntention.Select||i.intention===EGlobalStoreIntention.Zoom||i.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}}),y=vue.computed(()=>i.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}),A=vue.computed(()=>{let de=0;for(let ie of i.done_json)ie.selected&&de++;return de>0});let _=!1,S=!1;const b=de=>{var ie;if(i.intention!=EGlobalStoreIntention.None){if(i.intention==EGlobalStoreIntention.Create){if(!i.create_svg_info){console.error("要创建的数据获取失败");return}const Y=Math.floor(de.offsetX/o.svg.scale-a.center_offset.x),Ie=Math.floor(de.offsetY/o.svg.scale-a.center_offset.y),Oe={id:randomString(),x:Y,y:Ie,client:{x:Y,y:Ie},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(i.create_svg_info)};i.setDoneJson(Oe),i.setHandleSvgInfo(Oe,i.done_json.length),i.intention=EGlobalStoreIntention.None}(ie=d.value)==null||ie.focus()}},T=de=>{de.preventDefault()},w=de=>{de.preventDefault()},x=(de,ie,Y)=>{var Ie,Oe,kt;if((Ie=d.value)==null||Ie.focus(),i.intention===EGlobalStoreIntention.Connection){Y.stopPropagation();return}if(Y.preventDefault(),Y.stopPropagation(),Y.ctrlKey&&Y.button===0)((Oe=i.handle_svg_info)!=null&&Oe.index||((kt=i.handle_svg_info)==null?void 0:kt.index)===0)&&(i.done_json[i.handle_svg_info.index].selected=!0,i.setHandleSvgInfo(null),i.intention=EGlobalStoreIntention.None),de.selected=!de.selected;else if(A.value){i.intention=EGlobalStoreIntention.GroupMove,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Y.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y.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 Dt of i.done_json)Dt.selected&&(Dt.old_position={x:Dt.x,y:Dt.y},Dt.point_coordinate_old=objectDeepClone(Dt.point_coordinate))}else i.intention=EGlobalStoreIntention.Select,i.setHandleSvgInfo(de,ie),i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Y.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:de.x,now_position_y:de.y,new_position_x:0,new_position_y:0},de.point_coordinate_old=objectDeepClone(de.point_coordinate)},k=(de,ie,Y)=>{if(!(i.intention===EGlobalStoreIntention.Connection||i.mouse_info.state!=EMouseInfoState.Down)&&A.value&&!_&&["SelectArea","Move","Select"].indexOf(i.intention)<0){for(let Ie of i.done_json)Ie.selected=!1,Ie.old_position={x:0,y:0},resetHandlePointOld(Ie);i.intention=EGlobalStoreIntention.Select,i.setHandleSvgInfo(de,ie),i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Y.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:de.x,now_position_y:de.y,new_position_x:0,new_position_y:0}}},M=(de,ie,Y)=>{Y.preventDefault(),Y.stopPropagation(),g.connection_panel=!0,g.connection_line=!0,!((i.intention===EGlobalStoreIntention.Connection||i.intention===EGlobalStoreIntention.SetConnectionLineNode)&&de.type===EDoneJsonType.ConnectionLine)&&(g.select_item.info=de,g.select_item.index=ie)},D=(de,ie,Y)=>{Y.preventDefault(),Y.stopPropagation(),!((i.intention===EGlobalStoreIntention.Connection||i.intention===EGlobalStoreIntention.SetConnectionLineNode)&&de.type===EDoneJsonType.ConnectionLine)&&(g.connection_panel=!1,g.connection_line=!1,g.select_item.info=null,g.select_item.index=-1)},z=de=>{var kt,Dt,Fe,$e,Cn,Lt,In,Et,Ne,pe,At,Ve,xe,ze,Pt,hn;if(i.mouse_info.state!=EMouseInfoState.Down&&i.intention!==EGlobalStoreIntention.Connection)return;const{clientX:ie,clientY:Y}=de;i.mouse_info.new_position_x=Math.round((ie-a.canvasInfo.left)/o.svg.scale),i.mouse_info.new_position_y=Math.round((Y-a.canvasInfo.top)/o.svg.scale);const Ie=Math.round(i.mouse_info.new_position_x-i.mouse_info.position_x+i.mouse_info.now_position_x),Oe=Math.round(i.mouse_info.new_position_y-i.mouse_info.position_y+i.mouse_info.now_position_y);if((kt=i.handle_svg_info)!=null&&kt.info&&(i.intention===EGlobalStoreIntention.Select||i.intention===EGlobalStoreIntention.Move)){if(i.handle_svg_info.info.x=Ie,i.handle_svg_info.info.y=Oe,i.handle_svg_info.info.client={x:Ie,y:Oe},i.intention=EGlobalStoreIntention.Move,moveHandlePoint(i.handle_svg_info.info),moveAnchors(i.handle_svg_info.info),i.handle_svg_info.info.type===EDoneJsonType.ConnectionLine){if((Dt=i.handle_svg_info.info.bind_anchors)!=null&&Dt.start){let ae=null;for(let le of i.done_json)le.id===(($e=(Fe=i.handle_svg_info.info.bind_anchors)==null?void 0:Fe.start)==null?void 0:$e.target_id)&&(ae=le);ae&&moveAnchors(ae)}if((Cn=i.handle_svg_info.info.bind_anchors)!=null&&Cn.end){let ae=null;for(let le of i.done_json)le.id===((In=(Lt=i.handle_svg_info.info.bind_anchors)==null?void 0:Lt.end)==null?void 0:In.target_id)&&(ae=le);ae&&moveAnchors(ae)}}}else if(i.intention===EGlobalStoreIntention.MoveCanvas)a.center_offset.x=Ie,a.center_offset.y=Oe;else if(i.intention===EGlobalStoreIntention.SelectArea)v.value.b.x=i.mouse_info.new_position_x-a.center_offset.x,v.value.b.y=i.mouse_info.new_position_y-a.center_offset.y;else if(i.intention===EGlobalStoreIntention.GroupMove){_=!0;for(let ae of i.done_json)if(ae.selected&&ae.old_position){const le=Math.round(i.mouse_info.new_position_x-i.mouse_info.position_x+ae.old_position.x),re=Math.round(i.mouse_info.new_position_y-i.mouse_info.position_y+ae.old_position.y);if(ae.x=le,ae.y=re,ae.client={x:le,y:re},moveHandlePoint(ae),moveAnchors(ae),ae.type===EDoneJsonType.ConnectionLine&&((Et=ae.bind_anchors)!=null&&Et.end)){let V=null;for(let $ of i.done_json)$.id===((pe=(Ne=ae.bind_anchors)==null?void 0:Ne.end)==null?void 0:pe.target_id)&&(V=$);V&&moveAnchors(V)}}}else if(i.intention===EGlobalStoreIntention.Zoom){if(!i.handle_svg_info)return;const ae={x:i.mouse_info.new_position_x-a.center_offset.x,y:i.mouse_info.new_position_y-a.center_offset.y};let le={width:0,height:0,is_old_width:!1,is_old_height:!1};if(i.scale_info.type===EScaleInfoType.TopLeft?le=calculateLeftTop(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.TopRight?le=calculateRightTop(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.BottomRight?le=calculateRightBottom(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.BottomLeft?le=calculateLeftBottom(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.TopCenter?le=calculateTop(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client):i.scale_info.type===EScaleInfoType.Right?le=calculateRight(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client):i.scale_info.type===EScaleInfoType.BottomCenter?le=calculateBottom(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client):i.scale_info.type===EScaleInfoType.Left&&(le=calculateLeft(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client)),i.handle_svg_info&&le.width>0&&le.height>0){const re=le.is_old_width?1:parseFloat((le.width/i.handle_svg_info.info.actual_bound.width).toFixed(3)),V=le.is_old_height?1:parseFloat((le.height/i.handle_svg_info.info.actual_bound.height).toFixed(3)),$=getCenterPoint(ae,i.scale_info.symmetric_point);re>0&&i.scale_info.type!==EScaleInfoType.TopCenter&&i.scale_info.type!==EScaleInfoType.BottomCenter&&(i.handle_svg_info.info.scale_x=re,i.handle_svg_info.info.x=Math.round(getSvgNowPosition(i.handle_svg_info.info.center_position.x,$.x,i.handle_svg_info.info.client.x))),V>0&&i.scale_info.type!==EScaleInfoType.Left&&i.scale_info.type!==EScaleInfoType.Right&&(i.handle_svg_info.info.scale_y=V,i.handle_svg_info.info.y=Math.round(getSvgNowPosition(i.handle_svg_info.info.center_position.y,$.y,i.handle_svg_info.info.client.y)))}}else if(i.intention===EGlobalStoreIntention.Rotate){if(!i.handle_svg_info)return;const ae=Math.atan2(i.mouse_info.position_y-i.handle_svg_info.info.y,i.mouse_info.position_x-i.handle_svg_info.info.x)/(Math.PI/180),le=Math.atan2(i.mouse_info.new_position_y-a.center_offset.y-i.handle_svg_info.info.y,i.mouse_info.new_position_x-a.center_offset.x-i.handle_svg_info.info.x)/(Math.PI/180);i.handle_svg_info.info.rotate=parseFloat((i.rotate_info.angle+le-ae).toFixed(2))}else if(i.intention===EGlobalStoreIntention.Connection&&i.handle_svg_info){const ae=(At=i.handle_svg_info)==null?void 0:At.info.props.point_position.val.length,le=i.mouse_info.new_position_x-i.mouse_info.position_x-a.center_offset.x,re=i.mouse_info.new_position_y-i.mouse_info.position_y-a.center_offset.y,V=i.handle_svg_info.info.props.point_position.val[ae-2],$=((xe=(Ve=i.handle_svg_info)==null?void 0:Ve.info.props.point_r)==null?void 0:xe.val)+2||4;let he=V.x<le?-$:V.x>le?$:0,Ue=V.y<re?-$:V.y>re?$:0;de.ctrlKey?i.handle_svg_info.info.props.point_position.val[ae-1]={x:V.x,y:re+Ue}:de.shiftKey?i.handle_svg_info.info.props.point_position.val[ae-1]={x:le+he,y:V.y}:i.handle_svg_info.info.props.point_position.val[ae-1]={x:le+he,y:re+Ue}}else if(i.intention===EGlobalStoreIntention.SetConnectionLineNode&&i.handle_svg_info){!S&&(i.connection_line_node_info.point_index===i.handle_svg_info.info.props.point_position.val.length-1||i.connection_line_node_info.point_index===0)&&(S=!0);const ae=(ze=i.handle_svg_info)==null?void 0:ze.info.props.point_position.val.length,le=getSvgNowPosition(i.mouse_info.position_x,i.mouse_info.new_position_x,i.connection_line_node_info.init_pos.x),re=getSvgNowPosition(i.mouse_info.position_y,i.mouse_info.new_position_y,i.connection_line_node_info.init_pos.y),V=i.handle_svg_info.info.props.point_position.val[ae-2],$=((hn=(Pt=i.handle_svg_info)==null?void 0:Pt.info.props.point_r)==null?void 0:hn.val)+2||4;let he=V.x<le?-$:V.x>le?$:0,Ue=V.y<re?-$:V.y>re?$:0;i.handle_svg_info.info.props.point_position.val[i.connection_line_node_info.point_index]={x:le+he,y:re+Ue}}},j=()=>{var de,ie,Y,Ie;if(i.mouse_info.state==EMouseInfoState.Down){if((de=i.handle_svg_info)!=null&&de.info&&i.intention==EGlobalStoreIntention.Move)setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.intention=EGlobalStoreIntention.None,i.setDoneJson(i.done_json);else if(i.intention==EGlobalStoreIntention.GroupMove)_&&(_=!1,i.intention=EGlobalStoreIntention.None);else if((ie=i.handle_svg_info)!=null&&ie.info&&i.intention==EGlobalStoreIntention.Zoom)i.handle_svg_info.info.client={x:i.handle_svg_info.info.x,y:i.handle_svg_info.info.y},i.intention=EGlobalStoreIntention.None,setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.setDoneJson(i.done_json);else if(i.intention===EGlobalStoreIntention.Rotate&&((Y=i.handle_svg_info)!=null&&Y.info))setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.setDoneJson(i.done_json),i.intention=EGlobalStoreIntention.None;else{if(i.intention===EGlobalStoreIntention.Connection)return;if(i.intention===EGlobalStoreIntention.SetConnectionLineNode)S&&((Ie=i.handle_svg_info)!=null&&Ie.info.bind_anchors)&&(i.connection_line_node_info.point_index===0?i.handle_svg_info.info.bind_anchors.start=null:i.handle_svg_info.info.bind_anchors.end=null),i.intention=EGlobalStoreIntention.None,S=!1;else if(i.intention===EGlobalStoreIntention.SelectArea){i.setHandleSvgInfo(null);for(let Oe of i.done_json){const kt=y.value;Oe.selected=Oe.x>kt.x&&Oe.x<kt.x+kt.with&&Oe.y>kt.y&&Oe.y<kt.y+kt.height}i.intention=EGlobalStoreIntention.None}else i.intention!=EGlobalStoreIntention.Select&&(i.intention=EGlobalStoreIntention.None)}i.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}},oe=de=>{const{clientX:ie,clientY:Y}=de;if(i.intention===EGlobalStoreIntention.Connection){i.handle_svg_info||createLine(de),i.handle_svg_info&&(de.button===0?i.handle_svg_info.info.props.point_position.val.length!==1?i.handle_svg_info.info.props.point_position.val.push({x:i.mouse_info.new_position_x-i.mouse_info.position_x-a.center_offset.x,y:i.mouse_info.new_position_y-i.mouse_info.position_y-a.center_offset.y}):i.handle_svg_info.info.props.point_position.val.push({x:0,y:0}):de.button===2&&(i.intention=EGlobalStoreIntention.None,setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.setHandleSvgInfo(null)));return}de.button===0?(i.intention=EGlobalStoreIntention.SelectArea,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((ie-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),position_y:Math.round((Y-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:i.mouse_info.position_x,y:i.mouse_info.position_y},b:{x:0,y:0}}):de.button===2&&(i.intention=EGlobalStoreIntention.MoveCanvas,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((ie-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y-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 L(de){de!=null&&de.wheelDelta&&(de.wheelDelta>0?o.svg.scale=parseFloat((o.svg.scale+.1).toFixed(1)):o.svg.scale=parseFloat((o.svg.scale-.1).toFixed(1)))}const F=de=>{de.stopPropagation(),de.preventDefault()},O=(de,ie,Y)=>{i.intention!==EGlobalStoreIntention.Connection&&f.value&&(i.intention=EGlobalStoreIntention.ContextMenu,i.setHandleSvgInfo(de,ie),f.value.style.left=Y.pageX+"px",f.value.style.top=Y.pageY+"px",c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!0,ie===i.done_json.length-1&&(c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=!1),ie===0&&(c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!1),c.display=!0)},ue=(de,ie,Y)=>({x:parseFloat((de.x-de.width/2*ie+de.width/2).toFixed(1)),y:parseFloat((de.y-de.height/2*Y+de.height/2).toFixed(1)),width:parseFloat((de.width*ie).toFixed(1)),height:parseFloat((de.height*Y).toFixed(1))}),_e=de=>{de.preventDefault();let ie=[];if(!de.ctrlKey&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].indexOf(de.key)>-1&&(A.value?ie=i.done_json.map((Y,Ie)=>({selected:Y.selected,i:Ie})).filter(Y=>Y.selected).map(Y=>Y.i):i.handle_svg_info&&ie.push(i.handle_svg_info.index)),!de.ctrlKey&&de.key=="ArrowUp"){for(let Y of ie)i.done_json[Y].y-=1,i.done_json[Y].client.y-=1,moveHandlePoint(i.done_json[Y],0,-1),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else if(!de.ctrlKey&&de.key=="ArrowDown"){for(let Y of ie)i.done_json[Y].y+=1,i.done_json[Y].client.y+=1,moveHandlePoint(i.done_json[Y],0,1),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else if(!de.ctrlKey&&de.key=="ArrowLeft"){for(let Y of ie)i.done_json[Y].x-=1,i.done_json[Y].client.x-=1,moveHandlePoint(i.done_json[Y],-1,0),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else if(!de.ctrlKey&&de.key=="ArrowRight"){for(let Y of ie)i.done_json[Y].x+=1,i.done_json[Y].client.x+=1,moveHandlePoint(i.done_json[Y],1,0),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else de.ctrlKey&&de.key.toLowerCase()=="c"?c.onContextMenuClick(EContextMenuInfoType.Copy):!de.ctrlKey&&de.key=="Delete"?A.value?(i.setDoneJson(i.done_json.filter(Y=>!Y.selected)),i.setHandleSvgInfo(i.done_json[i.done_json.length-1],i.done_json.length-1)):c.onContextMenuClick(EContextMenuInfoType.Delete):de.ctrlKey&&de.key=="ArrowUp"?c.onContextMenuClick(EContextMenuInfoType.MoveUpOneLevel):de.ctrlKey&&de.key=="ArrowDown"?c.onContextMenuClick(EContextMenuInfoType.MoveDownOneLevel):de.ctrlKey&&de.key=="ArrowLeft"?c.onContextMenuClick(EContextMenuInfoType.MoveDownTopLevel):de.ctrlKey&&de.key=="ArrowRight"?c.onContextMenuClick(EContextMenuInfoType.MoveUpTopLevel):de.ctrlKey&&de.shiftKey&&de.key.toLowerCase()=="z"?u.topRedoBtnClick():de.ctrlKey&&de.key.toLowerCase()=="z"?u.topUndoBtnClick():de.ctrlKey&&de.key.toLowerCase()=="delete"&&(i.done_json.length<=0||i.setDoneJson([]))},Ce=()=>{setSvgActualInfo(i.done_json[i.handle_svg_info.index],!0)};return vue.onMounted(()=>{var de;(de=d.value)==null||de.focus(),vue.nextTick(function(){var Y;const ie=(Y=d.value)==null?void 0:Y.getBoundingClientRect();a.canvasInfo={height:(ie==null?void 0:ie.height)||0,with:(ie==null?void 0:ie.width)||0,top:(ie==null?void 0:ie.top)||0,left:(ie==null?void 0:ie.left)||0}})}),n({onCanvasMouseUp:j}),(de,ie)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",{class:"canvas",tabindex:"0",ref_key:"canvasRef",ref:d,onDrop:b,onDragenter:T,onDragover:w,onMousedown:oe,onMousemove:z,onMouseup:j,onContextmenu:F,onKeydown:_e,onMousewheel:L},[(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",style:vue.normalizeStyle({backgroundColor:vue.unref(o).svg.background_color}),width:"100%",height:"100%"},[vue.createElementVNode("defs",null,[vue.createElementVNode("pattern",_hoisted_1$c,[vue.createElementVNode("line",{x1:"0",y1:"0",x2:"0",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_2$9),vue.createElementVNode("line",{x1:"10",y1:"0",x2:"10",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_3$8),vue.createElementVNode("line",{x1:"0",y1:"0",x2:"20",y2:"0",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_4$4),vue.createElementVNode("line",{x1:"0",y1:"10",x2:"20",y2:"10",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_5$2)])]),vue.unref(o).svg.grid?(vue.openBlock(),vue.createElementBlock("rect",_hoisted_6)):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(i).done_json,(Y,Ie)=>{var Oe,kt,Dt,Fe,$e,Cn;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:Y.id,transform:`translate(${Y.x},${Y.y})rotate(0)scale(1)`,onMousewheel:ie[0]||(ie[0]=(...Lt)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...Lt))},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(Y)}`)},[vue.createElementVNode("g",{transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2})rotate(${Y.rotate}) scale(1) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`,onMousedown:Lt=>x(Y,Ie,Lt),onMouseup:Lt=>k(Y,Ie,Lt),onMouseenter:Lt=>M(Y,Ie,Lt),onMouseleave:Lt=>D(Y,Ie,Lt),onContextmenu:Lt=>O(Y,Ie,Lt)},[Y.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$y,{key:0,"item-info":Y,"point-visible":vue.unref(g).connection_line&&((Oe=vue.unref(g).select_item.info)==null?void 0:Oe.id)==Y.id},null,8,["item-info","point-visible"])):Y.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${Y.name}`},vue.unref(prosToVBind)(Y),{width:"100",height:"100",id:Y.id,transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2}) scale(${Y.scale_x},${Y.scale_y}) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`}),null,16,_hoisted_10)):Y.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(Y.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(Y),{width:"100",height:"100",id:Y.id,onResize:Ce,transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2}) scale(${Y.scale_x},${Y.scale_y}) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`}),null,16,["id","transform"])):Y.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},ue(Y.actual_bound,Y.scale_x,Y.scale_y),{id:`foreign-object${Y.id}`,class:"foreignObject"}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(Y.tag),vue.mergeProps(vue.unref(prosToVBind)(Y),{id:Y.id,transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2}) scale(${Y.scale_x},${Y.scale_y}) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(Y.tag_slot),1)]),_:2},1040,["id","transform"]))],16,_hoisted_11)):Y.type===vue.unref(EDoneJsonType).StraightLine?(vue.openBlock(),vue.createElementBlock("line",{key:4,id:Y.id,x1:Y.props.start_x.val,y1:Y.props.start_y.val,x2:Y.props.end_x.val,y2:Y.props.end_y.val,fill:"#FF0000",stroke:"#FF0000","stroke-width":"2"},null,8,_hoisted_12$1)):vue.createCommentVNode("",!0),Y.config.actual_rect?(vue.openBlock(),vue.createElementBlock("rect",vue.mergeProps({key:5,id:`rect${Y.id}`,fill:"black","fill-opacity":"0"},ue(Y.actual_bound,Y.scale_x,Y.scale_y),{style:{stroke:"none","stroke-width":"2","stroke-miterlimit":"10"},class:{"svg-item-none":!Y.selected&&(vue.unref(i).intention==vue.unref(EGlobalStoreIntention).None||vue.unref(i).intention==vue.unref(EGlobalStoreIntention).Select),"svg-item-move":vue.unref(i).intention==vue.unref(EGlobalStoreIntention).Move&&((kt=vue.unref(i).handle_svg_info)==null?void 0:kt.info.id)==Y.id,"svg-item-select":vue.unref(i).intention==vue.unref(EGlobalStoreIntention).Select&&((Dt=vue.unref(i).handle_svg_info)==null?void 0:Dt.info.id)==Y.id,"svg-item-in-group":Y.selected}}),null,16,_hoisted_13)):vue.createCommentVNode("",!0),((Fe=vue.unref(i).handle_svg_info)==null?void 0:Fe.info.id)===Y.id&&vue.unref(g).handle_panel&&Y.type!==vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(HandlePanel,{key:6,"item-info":Y},null,8,["item-info"])):vue.createCommentVNode("",!0),!Y.selected&&(($e=vue.unref(g).select_item.info)==null?void 0:$e.id)==Y.id&&vue.unref(g).connection_panel&&Y.config.have_anchor&&vue.unref(i).intention!==vue.unref(EGlobalStoreIntention).SelectArea&&(vue.unref(i).intention!==vue.unref(EGlobalStoreIntention).Select||Y.id!==((Cn=vue.unref(i).handle_svg_info)==null?void 0:Cn.info.id))?(vue.openBlock(),vue.createBlock(ConnectionPanel,{key:7,onContextmenu:F,"item-info":Y},null,8,["item-info"])):vue.createCommentVNode("",!0)],40,_hoisted_9)],2)],40,_hoisted_8)),[[vue.vShow,Y.display]])}),128)),vue.createElementVNode("rect",{x:vue.unref(y).x,y:vue.unref(y).y,height:vue.unref(y).height,width:vue.unref(y).with,stroke:"#107cec",fill:"#107cec","fill-opacity":".2"},null,8,_hoisted_14)],8,_hoisted_7)],4))],544),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,(Y,Ie)=>(vue.openBlock(),vue.createElementBlock("li",{key:Y.title,onClick:Oe=>vue.unref(c).onContextMenuClick(Ie)},[vue.createElementVNode("p",{class:vue.normalizeClass(Y.enable?"":"disabled")},[vue.createTextVNode(vue.toDisplayString(Y.title)+" ",1),vue.createElementVNode("span",_hoisted_16$1,vue.toDisplayString(Y.hot_key),1)],2)],8,_hoisted_15))),128))],512),[[vue.vShow,vue.unref(c).display]])],64))}}),centerPanel_vue_vue_type_style_index_0_scoped_d3ea847c_lang="",CenterPanel=_export_sfc$1(_sfc_main$x,[["__scopeId","data-v-d3ea847c"]]);/*! Element Plus Icons Vue v2.1.0 */var export_helper_default=(r,n)=>{let i=r.__vccOpts||r;for(let[o,a]of n)i[o]=a;return i},aim_vue_vue_type_script_lang_default={name:"Aim"},_hoisted_12={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_22=vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),_hoisted_32=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-32zm0 576a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V704a32 32 0 0 1 32-32zM96 512a32 32 0 0 1 32-32h192a32 32 0 0 1 0 64H128a32 32 0 0 1-32-32zm576 0a32 32 0 0 1 32-32h192a32 32 0 1 1 0 64H704a32 32 0 0 1-32-32z"},null,-1),_hoisted_42=[_hoisted_22,_hoisted_32];function _sfc_render2(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_12,_hoisted_42)}var aim_default=export_helper_default(aim_vue_vue_type_script_lang_default,[["render",_sfc_render2],["__file","aim.vue"]]),arrow_down_vue_vue_type_script_lang_default={name:"ArrowDown"},_hoisted_16={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_26=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"},null,-1),_hoisted_36=[_hoisted_26];function _sfc_render6(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_16,_hoisted_36)}var arrow_down_default=export_helper_default(arrow_down_vue_vue_type_script_lang_default,[["render",_sfc_render6],["__file","arrow-down.vue"]]),circle_check_vue_vue_type_script_lang_default={name:"CircleCheck"},_hoisted_149={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_249=vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),_hoisted_348=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"},null,-1),_hoisted_415=[_hoisted_249,_hoisted_348];function _sfc_render49(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_149,_hoisted_415)}var circle_check_default=export_helper_default(circle_check_vue_vue_type_script_lang_default,[["render",_sfc_render49],["__file","circle-check.vue"]]),circle_close_vue_vue_type_script_lang_default={name:"CircleClose"},_hoisted_151={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_251=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.248L466.752 512z"},null,-1),_hoisted_350=vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),_hoisted_416=[_hoisted_251,_hoisted_350];function _sfc_render51(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_151,_hoisted_416)}var circle_close_default=export_helper_default(circle_close_vue_vue_type_script_lang_default,[["render",_sfc_render51],["__file","circle-close.vue"]]),close_vue_vue_type_script_lang_default={name:"Close"},_hoisted_156={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_256=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"},null,-1),_hoisted_355=[_hoisted_256];function _sfc_render56(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_156,_hoisted_355)}var close_default=export_helper_default(close_vue_vue_type_script_lang_default,[["render",_sfc_render56],["__file","close.vue"]]),hide_vue_vue_type_script_lang_default={name:"Hide"},_hoisted_1133={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_2133=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.2L371.2 588.8ZM889.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"},null,-1),_hoisted_3132=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"},null,-1),_hoisted_438=[_hoisted_2133,_hoisted_3132];function _sfc_render133(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1133,_hoisted_438)}var hide_default=export_helper_default(hide_vue_vue_type_script_lang_default,[["render",_sfc_render133],["__file","hide.vue"]]),loading_vue_vue_type_script_lang_default={name:"Loading"},_hoisted_1150={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_2150=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-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.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 0zm-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"},null,-1),_hoisted_3149=[_hoisted_2150];function _sfc_render150(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1150,_hoisted_3149)}var loading_default=export_helper_default(loading_vue_vue_type_script_lang_default,[["render",_sfc_render150],["__file","loading.vue"]]),view_vue_vue_type_script_lang_default={name:"View"},_hoisted_1283={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_2283=vue.createElementVNode("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 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-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"},null,-1),_hoisted_3282=[_hoisted_2283];function _sfc_render283(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1283,_hoisted_3282)}var view_default=export_helper_default(view_vue_vue_type_script_lang_default,[["render",_sfc_render283],["__file","view.vue"]]),MapShim=function(){if(typeof Map<"u")return Map;function r(n,i){var o=-1;return n.some(function(a,u){return a[0]===i?(o=u,!0):!1}),o}return function(){function n(){this.__entries__=[]}return Object.defineProperty(n.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),n.prototype.get=function(i){var o=r(this.__entries__,i),a=this.__entries__[o];return a&&a[1]},n.prototype.set=function(i,o){var a=r(this.__entries__,i);~a?this.__entries__[a][1]=o:this.__entries__.push([i,o])},n.prototype.delete=function(i){var o=this.__entries__,a=r(o,i);~a&&o.splice(a,1)},n.prototype.has=function(i){return!!~r(this.__entries__,i)},n.prototype.clear=function(){this.__entries__.splice(0)},n.prototype.forEach=function(i,o){o===void 0&&(o=null);for(var a=0,u=this.__entries__;a<u.length;a++){var c=u[a];i.call(o,c[1],c[0])}},n}()}(),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(r){return setTimeout(function(){return r(Date.now())},1e3/60)}}(),trailingTimeout=2;function throttle(r,n){var i=!1,o=!1,a=0;function u(){i&&(i=!1,r()),o&&f()}function c(){requestAnimationFrame$1(u)}function f(){var d=Date.now();if(i){if(d-a<trailingTimeout)return;o=!0}else i=!0,o=!1,setTimeout(c,n);a=d}return f}var REFRESH_DELAY=20,transitionKeys=["top","right","bottom","left","width","height","size","weight"],mutationObserverSupported=typeof MutationObserver<"u",ResizeObserverController=function(){function r(){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 r.prototype.addObserver=function(n){~this.observers_.indexOf(n)||this.observers_.push(n),this.connected_||this.connect_()},r.prototype.removeObserver=function(n){var i=this.observers_,o=i.indexOf(n);~o&&i.splice(o,1),!i.length&&this.connected_&&this.disconnect_()},r.prototype.refresh=function(){var n=this.updateObservers_();n&&this.refresh()},r.prototype.updateObservers_=function(){var n=this.observers_.filter(function(i){return i.gatherActive(),i.hasActive()});return n.forEach(function(i){return i.broadcastActive()}),n.length>0},r.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)},r.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)},r.prototype.onTransitionEnd_=function(n){var i=n.propertyName,o=i===void 0?"":i,a=transitionKeys.some(function(u){return!!~o.indexOf(u)});a&&this.refresh()},r.getInstance=function(){return this.instance_||(this.instance_=new r),this.instance_},r.instance_=null,r}(),defineConfigurable=function(r,n){for(var i=0,o=Object.keys(n);i<o.length;i++){var a=o[i];Object.defineProperty(r,a,{value:n[a],enumerable:!1,writable:!1,configurable:!0})}return r},getWindowOf=function(r){var n=r&&r.ownerDocument&&r.ownerDocument.defaultView;return n||global$1},emptyRect=createRectInit(0,0,0,0);function toFloat(r){return parseFloat(r)||0}function getBordersSize(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return n.reduce(function(o,a){var u=r["border-"+a+"-width"];return o+toFloat(u)},0)}function getPaddings(r){for(var n=["top","right","bottom","left"],i={},o=0,a=n;o<a.length;o++){var u=a[o],c=r["padding-"+u];i[u]=toFloat(c)}return i}function getSVGContentRect(r){var n=r.getBBox();return createRectInit(0,0,n.width,n.height)}function getHTMLElementContentRect(r){var n=r.clientWidth,i=r.clientHeight;if(!n&&!i)return emptyRect;var o=getWindowOf(r).getComputedStyle(r),a=getPaddings(o),u=a.left+a.right,c=a.top+a.bottom,f=toFloat(o.width),d=toFloat(o.height);if(o.boxSizing==="border-box"&&(Math.round(f+u)!==n&&(f-=getBordersSize(o,"left","right")+u),Math.round(d+c)!==i&&(d-=getBordersSize(o,"top","bottom")+c)),!isDocumentElement(r)){var p=Math.round(f+u)-n,h=Math.round(d+c)-i;Math.abs(p)!==1&&(f-=p),Math.abs(h)!==1&&(d-=h)}return createRectInit(a.left,a.top,f,d)}var isSVGGraphicsElement=function(){return typeof SVGGraphicsElement<"u"?function(r){return r instanceof getWindowOf(r).SVGGraphicsElement}:function(r){return r instanceof getWindowOf(r).SVGElement&&typeof r.getBBox=="function"}}();function isDocumentElement(r){return r===getWindowOf(r).document.documentElement}function getContentRect(r){return isBrowser?isSVGGraphicsElement(r)?getSVGContentRect(r):getHTMLElementContentRect(r):emptyRect}function createReadOnlyRect(r){var n=r.x,i=r.y,o=r.width,a=r.height,u=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,c=Object.create(u.prototype);return defineConfigurable(c,{x:n,y:i,width:o,height:a,top:i,right:n+o,bottom:a+i,left:n}),c}function createRectInit(r,n,i,o){return{x:r,y:n,width:i,height:o}}var ResizeObservation=function(){function r(n){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=createRectInit(0,0,0,0),this.target=n}return r.prototype.isActive=function(){var n=getContentRect(this.target);return this.contentRect_=n,n.width!==this.broadcastWidth||n.height!==this.broadcastHeight},r.prototype.broadcastRect=function(){var n=this.contentRect_;return this.broadcastWidth=n.width,this.broadcastHeight=n.height,n},r}(),ResizeObserverEntry=function(){function r(n,i){var o=createReadOnlyRect(i);defineConfigurable(this,{target:n,contentRect:o})}return r}(),ResizeObserverSPI=function(){function r(n,i,o){if(this.activeObservations_=[],this.observations_=new MapShim,typeof n!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=n,this.controller_=i,this.callbackCtx_=o}return r.prototype.observe=function(n){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(n instanceof getWindowOf(n).Element))throw new TypeError('parameter 1 is not of type "Element".');var i=this.observations_;i.has(n)||(i.set(n,new ResizeObservation(n)),this.controller_.addObserver(this),this.controller_.refresh())}},r.prototype.unobserve=function(n){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(n instanceof getWindowOf(n).Element))throw new TypeError('parameter 1 is not of type "Element".');var i=this.observations_;i.has(n)&&(i.delete(n),i.size||this.controller_.removeObserver(this))}},r.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},r.prototype.gatherActive=function(){var n=this;this.clearActive(),this.observations_.forEach(function(i){i.isActive()&&n.activeObservations_.push(i)})},r.prototype.broadcastActive=function(){if(this.hasActive()){var n=this.callbackCtx_,i=this.activeObservations_.map(function(o){return new ResizeObserverEntry(o.target,o.broadcastRect())});this.callback_.call(n,i,n),this.clearActive()}},r.prototype.clearActive=function(){this.activeObservations_.splice(0)},r.prototype.hasActive=function(){return this.activeObservations_.length>0},r}(),observers=typeof WeakMap<"u"?new WeakMap:new MapShim,ResizeObserver$1=function(){function r(n){if(!(this instanceof r))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var i=ResizeObserverController.getInstance(),o=new ResizeObserverSPI(n,i,this);observers.set(this,o)}return r}();["observe","unobserve","disconnect"].forEach(function(r){ResizeObserver$1.prototype[r]=function(){var n;return(n=observers.get(this))[r].apply(n,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({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 r=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,r.on("change",()=>{if(this._isSettingContent)return;const n=r.getValue();this._contentBackup=n,this.$emit("update:value",n)}),Events.forEach(n=>{const i="on"+vue.capitalize(n);typeof this.$.vnode.props[i]=="function"&&r.on(n,this.$emit.bind(this,n))}),this._ro=new index$1(()=>r.resize()),this._ro.observe(this.$el),this.$emit("init",r)},beforeUnmount(){var r,n;(r=this._ro)===null||r===void 0||r.disconnect(),(n=this._editor)===null||n===void 0||n.destroy()},methods:{focus(){this._editor.focus()},blur(){this._editor.blur()},selectAll(){this._editor.selectAll()}},watch:{value(r){if(this._contentBackup!==r){try{this._isSettingContent=!0,this._editor.setValue(r,1)}finally{this._isSettingContent=!1}this._contentBackup=r}},theme(r){this._editor.setTheme("ace/theme/"+r)},options(r){this._editor.setOptions(r)},readonly(r){this._editor.setReadOnly(r)},placeholder(r){this._editor.setOption("placeholder",r)},wrap(r){this._editor.setWrapBehavioursEnabled(r)},printMargin(r){this._editor.setOption("printMargin",r)},lang(r){this._editor.setOption("mode","ace/mode/"+r)},minLines(r){this._editor.setOption("minLines",r)},maxLines(r){this._editor.setOption("maxLines",r)}}}),themeUrl2="data:application/javascript;base64,YWNlLmRlZmluZSgiYWNlL3RoZW1lL2tyX3RoZW1lLmNzcyIsWyJyZXF1aXJlIiwiZXhwb3J0cyIsIm1vZHVsZSJdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpe21vZHVsZS5leHBvcnRzID0gIi5hY2Uta3ItdGhlbWUgLmFjZV9ndXR0ZXIge1xuICBiYWNrZ3JvdW5kOiAjMWMxOTE3O1xuICBjb2xvcjogI0ZDRkZFMFxufVxuXG4uYWNlLWtyLXRoZW1lIC5hY2VfcHJpbnQtbWFyZ2luIHtcbiAgd2lkdGg6IDFweDtcbiAgYmFja2dyb3VuZDogIzFjMTkxN1xufVxuXG4uYWNlLWtyLXRoZW1lIHtcbiAgYmFja2dyb3VuZC1jb2xvcjogIzBCMEEwOTtcbiAgY29sb3I6ICNGQ0ZGRTBcbn1cblxuLmFjZS1rci10aGVtZSAuYWNlX2N1cnNvciB7XG4gIGNvbG9yOiAjRkY5OTAwXG59XG5cbi5hY2Uta3ItdGhlbWUgLmFjZV9tYXJrZXItbGF5ZXIgLmFjZV9zZWxlY3Rpb24ge1xuICBiYWNrZ3JvdW5kOiByZ2JhKDE3MCwgMCwgMjU1LCAwLjQ1KVxufVxuXG4uYWNlLWtyLXRoZW1lLmFjZV9tdWx0aXNlbGVjdCAuYWNlX3NlbGVjdGlvbi5hY2Vfc3RhcnQge1xuICBib3gtc2hhZG93OiAwIDAgM3B4IDBweCAjMEIwQTA5O1xufVxuXG4uYWNlLWtyLXRoZW1lIC5hY2VfbWFya2VyLWxheWVyIC5hY2Vfc3RlcCB7XG4gIGJhY2tncm91bmQ6IHJnYigxMDIsIDgyLCAwKVxufVxu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i4va3JfdGhlbWUuY3NzIik7CnZhciBkb20gPSByZXF1aXJlKCIuLi9saWIvZG9tIik7CmRvbS5pbXBvcnRDc3NTdHJpbmcoZXhwb3J0cy5jc3NUZXh0LCBleHBvcnRzLmNzc0NsYXNzLCBmYWxzZSk7Cgp9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL3RoZW1lL2tyX3RoZW1lIl0sIGZ1bmN0aW9uKG0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBtb2R1bGUgPT0gIm9iamVjdCIgJiYgdHlwZW9mIGV4cG9ydHMgPT0gIm9iamVjdCIgJiYgbW9kdWxlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IG07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pKCk7CiAgICAgICAgICAgIA==",modeJsonUrl="data:application/javascript;base64,YWNlLmRlZmluZSgiYWNlL21vZGUvanNvbl9oaWdobGlnaHRfcnVsZXMiLFsicmVxdWlyZSIsImV4cG9ydHMiLCJtb2R1bGUiLCJhY2UvbGliL29vcCIsImFjZS9tb2RlL3RleHRfaGlnaGxpZ2h0X3J1bGVzIl0sIGZ1bmN0aW9uKHJlcXVpcmUsIGV4cG9ydHMsIG1vZHVsZSl7InVzZSBzdHJpY3QiOwp2YXIgb29wID0gcmVxdWlyZSgiLi4vbGliL29vcCIpOwp2YXIgVGV4dEhpZ2hsaWdodFJ1bGVzID0gcmVxdWlyZSgiLi90ZXh0X2hpZ2hsaWdodF9ydWxlcyIpLlRleHRIaWdobGlnaHRSdWxlczsKdmFyIEpzb25IaWdobGlnaHRSdWxlcyA9IGZ1bmN0aW9uICgpIHsKICAgIHRoaXMuJHJ1bGVzID0gewogICAgICAgICJzdGFydCI6IFsKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdG9rZW46ICJ2YXJpYWJsZSIsCiAgICAgICAgICAgICAgICByZWdleDogJ1siXSg/Oig/OlxcXFwuKXwoPzpbXiJcXFxcXSkpKj9bIl1cXHMqKD89OiknCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAic3RyaW5nIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAnIicsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RyaW5nIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lm51bWVyaWMiLAogICAgICAgICAgICAgICAgcmVnZXg6ICIwW3hYXVswLTlhLWZBLUZdK1xcYiIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJjb25zdGFudC5udW1lcmljIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAiWystXT9cXGQrKD86KD86XFwuXFxkKik/KD86W2VFXVsrLV0/XFxkKyk/KT9cXGIiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29uc3RhbnQubGFuZ3VhZ2UuYm9vbGVhbiIsCiAgICAgICAgICAgICAgICByZWdleDogIig/OnRydWV8ZmFsc2UpXFxiIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbJ10oPzooPzpcXFxcLil8KD86W14nXFxcXF0pKSo/WyddIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbW1lbnQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXC9cXC8uKiQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29tbWVudC5zdGFydCIsCiAgICAgICAgICAgICAgICByZWdleDogIlxcL1xcKiIsCiAgICAgICAgICAgICAgICBuZXh0OiAiY29tbWVudCIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5scGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbWyh7XSIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5ycGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbXFxdKX1dIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInB1bmN0dWF0aW9uLm9wZXJhdG9yIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAvWyxdLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXHMrIgogICAgICAgICAgICB9CiAgICAgICAgXSwKICAgICAgICAic3RyaW5nIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lmxhbmd1YWdlLmVzY2FwZSIsCiAgICAgICAgICAgICAgICByZWdleDogL1xcKD86eFswLTlhLWZBLUZdezJ9fHVbMC05YS1mQS1GXXs0fXxbIlxcXC9iZm5ydF0pLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInN0cmluZyIsCiAgICAgICAgICAgICAgICByZWdleDogJyJ8JCcsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RhcnQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIGRlZmF1bHRUb2tlbjogInN0cmluZyIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImNvbW1lbnQiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29tbWVudC5lbmQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXCpcXC8iLAogICAgICAgICAgICAgICAgbmV4dDogInN0YXJ0IgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICBkZWZhdWx0VG9rZW46ICJjb21tZW50IgogICAgICAgICAg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AocmFuZ2UgJiYgIXJhbmdlLmlzTXVsdGlMaW5lKCkpIHsKICAgICAgICAgICAgICAgIGlmIChmb3JjZU11bHRpbGluZSkgewogICAgICAgICAgICAgICAgICAgIHJhbmdlID0gdGhpcy5nZXRTZWN0aW9uUmFuZ2Uoc2Vzc2lvbiwgcm93KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKGZvbGRTdHlsZSAhPSAiYWxsIikKICAgICAgICAgICAgICAgICAgICByYW5nZSA9IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHJhbmdlOwogICAgICAgIH0KICAgICAgICBpZiAoZm9sZFN0eWxlID09PSAibWFya2JlZ2luIikKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIHZhciBtYXRjaCA9IGxpbmUubWF0Y2godGhpcy5mb2xkaW5nU3RvcE1hcmtlcik7CiAgICAgICAgaWYgKG1hdGNoKSB7CiAgICAgICAgICAgIHZhciBpID0gbWF0Y2guaW5kZXggKyBtYXRjaFswXS5sZW5ndGg7CiAgICAgICAgICAgIGlmIChtYXRjaFsxXSkKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNsb3NpbmdCcmFja2V0QmxvY2soc2Vzc2lvbiwgbWF0Y2hbMV0sIHJvdywgaSk7CiAgICAgICAgICAgIHJldHVybiBzZXNzaW9uLmdldENvbW1lbnRGb2xkUmFuZ2Uocm93LCBpLCAtMSk7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuZ2V0U2VjdGlvblJhbmdlID0gZnVuY3Rpb24gKHNlc3Npb24sIHJvdykgewogICAgICAgIHZhciBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgdmFyIHN0YXJ0SW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgdmFyIHN0YXJ0Um93ID0gcm93OwogICAgICAgIHZhciBzdGFydENvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIHJvdyA9IHJvdyArIDE7CiAgICAgICAgdmFyIGVuZFJvdyA9IHJvdzsKICAgICAgICB2YXIgbWF4Um93ID0gc2Vzc2lvbi5nZXRMZW5ndGgoKTsKICAgICAgICB3aGlsZSAoKytyb3cgPCBtYXhSb3cpIHsKICAgICAgICAgICAgbGluZSA9IHNlc3Npb24uZ2V0TGluZShyb3cpOwogICAgICAgICAgICB2YXIgaW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgICAgIGlmIChpbmRlbnQgPT09IC0xKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChzdGFydEluZGVudCA+IGluZGVudCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB2YXIgc3ViUmFuZ2UgPSB0aGlzLmdldEZvbGRXaWRnZXRSYW5nZShzZXNzaW9uLCAiYWxsIiwgcm93KTsKICAgICAgICAgICAgaWYgKHN1YlJhbmdlKSB7CiAgICAgICAgICAgICAgICBpZiAoc3ViUmFuZ2Uuc3RhcnQucm93IDw9IHN0YXJ0Um93KSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmIChzdWJSYW5nZS5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgcm93ID0gc3ViUmFuZ2UuZW5kLnJvdzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKHN0YXJ0SW5kZW50ID09IGluZGVudCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGVuZFJvdyA9IHJvdzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG5ldyBSYW5nZShzdGFydFJvdywgc3RhcnRDb2x1bW4sIGVuZFJvdywgc2Vzc2lvbi5nZXRMaW5lKGVuZFJvdykubGVuZ3RoKTsKICAgIH07CiAgICB0aGlzLmdldENvbW1lbnRSZWdpb25CbG9jayA9IGZ1bmN0aW9uIChzZXNzaW9uLCBsaW5lLCByb3cpIHsKICAgICAgICB2YXIgc3RhcnRDb2x1bW4gPSBsaW5lLnNlYXJjaCgvXHMqJC8pOwogICAgICAgIHZhciBtYXhSb3cgPSBzZXNzaW9uLmdldExlbmd0aCgpOwogICAgICAgIHZhciBzdGFydFJvdyA9IHJvdzsKICAgICAgICB2YXIgcmUgPSAvXlxzKig/OlwvXCp8XC9cL3wtLSkjPyhlbmQpP3JlZ2lvblxiLzsKICAgICAgICB2YXIgZGVwdGggPSAxOwogICAgICAgIHdoaWxlICgrK3JvdyA8IG1heFJvdykgewogICAgICAgICAgICBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgICAgIHZhciBtID0gcmUuZXhlYyhsaW5lKTsKICAgICAgICAgICAgaWYgKCFtKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChtWzFdKQogICAgICAgICAgICAgICAgZGVwdGgtLTsKICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgZGVwdGgrKzsKICAgICAgICAgICAgaWYgKCFkZXB0aCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICB2YXIgZW5kUm93ID0gcm93OwogICAgICAgIGlmIChlbmRSb3cgPiBzdGFydFJvdykgewogICAgICAgICAgICByZXR1cm4gbmV3IFJhbmdlKHN0YXJ0Um93LCBzdGFydENvbHVtbiwgZW5kUm93LCBsaW5lLmxlbmd0aCk7CiAgICAgICAgfQogICAgfTsKfSkuY2FsbChGb2xkTW9kZS5wcm90b3R5cGUpOwoKfSk7CgphY2UuZGVmaW5lKCJhY2UvbW9kZS9qc29uIixbInJlcXVpcmUiLCJleHBvcnRzIiwibW9kdWxlIiwiYWNlL2xpYi9vb3AiLCJhY2UvbW9kZS90ZXh0IiwiYWNlL21vZGUvanNvbl9oaWdobGlnaHRf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9sZE1vZGUoKTsKfTsKb29wLmluaGVyaXRzKE1vZGUsIFRleHRNb2RlKTsKKGZ1bmN0aW9uICgpIHsKICAgIHRoaXMubGluZUNvbW1lbnRTdGFydCA9ICIvLyI7CiAgICB0aGlzLmJsb2NrQ29tbWVudCA9IHsgc3RhcnQ6ICIvKiIsIGVuZDogIiovIiB9OwogICAgdGhpcy5nZXROZXh0TGluZUluZGVudCA9IGZ1bmN0aW9uIChzdGF0ZSwgbGluZSwgdGFiKSB7CiAgICAgICAgdmFyIGluZGVudCA9IHRoaXMuJGdldEluZGVudChsaW5lKTsKICAgICAgICBpZiAoc3RhdGUgPT0gInN0YXJ0IikgewogICAgICAgICAgICB2YXIgbWF0Y2ggPSBsaW5lLm1hdGNoKC9eLipbXHtcKFxbXVxzKiQvKTsKICAgICAgICAgICAgaWYgKG1hdGNoKSB7CiAgICAgICAgICAgICAgICBpbmRlbnQgKz0gdGFiOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBpbmRlbnQ7CiAgICB9OwogICAgdGhpcy5jaGVja091dGRlbnQgPSBmdW5jdGlvbiAoc3RhdGUsIGxpbmUsIGlucHV0KSB7CiAgICAgICAgcmV0dXJuIHRoaXMuJG91dGRlbnQuY2hlY2tPdXRkZW50KGxpbmUsIGlucHV0KTsKICAgIH07CiAgICB0aGlzLmF1dG9PdXRkZW50ID0gZnVuY3Rpb24gKHN0YXRlLCBkb2MsIHJvdykgewogICAgICAgIHRoaXMuJG91dGRlbnQuYXV0b091dGRlbnQoZG9jLCByb3cpOwogICAgfTsKICAgIHRoaXMuY3JlYXRlV29ya2VyID0gZnVuY3Rpb24gKHNlc3Npb24pIHsKICAgICAgICB2YXIgd29ya2VyID0gbmV3IFdvcmtlckNsaWVudChbImFjZSJdLCAiYWNlL21vZGUvanNvbl93b3JrZXIiLCAiSnNvbldvcmtlciIpOwogICAgICAgIHdvcmtlci5hdHRhY2hUb0RvY3VtZW50KHNlc3Npb24uZ2V0RG9jdW1lbnQoKSk7CiAgICAgICAgd29ya2VyLm9uKCJhbm5vdGF0ZSIsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIHNlc3Npb24uc2V0QW5ub3RhdGlvbnMoZS5kYXRhKTsKICAgICAgICB9KTsKICAgICAgICB3b3JrZXIub24oInRlcm1pbmF0ZSIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgc2Vzc2lvbi5jbGVhckFubm90YXRpb25zKCk7CiAgICAgICAgfSk7CiAgICAgICAgcmV0dXJuIHdvcmtlcjsKICAgIH07CiAgICB0aGlzLiRpZCA9ICJhY2UvbW9kZS9qc29uIjsKfSkuY2FsbChNb2RlLnByb3RvdHlwZSk7CmV4cG9ydHMuTW9kZSA9IE1vZGU7Cgp9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL21vZGUvanNvbiJdLCBmdW5jdGlvbihtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgbW9kdWxlID09ICJvYmplY3QiICYmIHR5cGVvZiBleHBvcnRzID09ICJvYmplY3QiICYmIG1vZHVsZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlLmV4cG9ydHMgPSBtOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KSgpOwogICAgICAgICAgICA=",workerJsonUrl="data:application/javascript;base64,Im5vIHVzZSBzdHJpY3QiOwohKGZ1bmN0aW9uKHdpbmRvdykgewppZiAodHlwZW9mIHdpbmRvdy53aW5kb3cgIT0gInVuZGVmaW5lZCIgJiYgd2luZG93LmRvY3VtZW50KQogICAgcmV0dXJuOwppZiAod2luZG93LnJlcXVpcmUgJiYgd2luZG93LmRlZmluZSkKICAgIHJldHVybjsKCmlmICghd2luZG93LmNvbnNvbGUpIHsKICAgIHdpbmRvdy5jb25zb2xlID0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ICh0YWlsIHx8IGFsaWFzLm1haW4gfHwgYWxpYXMubmFtZSk7CiAgICAgICAgfSBlbHNlIGlmIChhbGlhcyA9PT0gZmFsc2UpIHsKICAgICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICB2YXIgaSA9IHRlc3RQYXRoLmxhc3RJbmRleE9mKCIvIik7CiAgICAgICAgaWYgKGkgPT09IC0xKSBicmVhazsKICAgICAgICB0YWlsID0gdGVzdFBhdGguc3Vic3RyKGkpICsgdGFpbDsKICAgICAgICB0ZXN0UGF0aCA9IHRlc3RQYXRoLnNsaWNlKDAsIGkpOwogICAgfQogICAgcmV0dXJuIGlkOwp9CndpbmRvdy5yZXF1aXJlLm1vZHVsZXMgPSB7fTsKd2luZG93LnJlcXVpcmUudGxucyA9IHt9OwoKd2luZG93LmRlZmluZSA9IGZ1bmN0aW9uKGlkLCBkZXBzLCBmYWN0b3J5KSB7CiAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA9PSAyKSB7CiAgICAgICAgZmFjdG9yeSA9IGRlcHM7CiAgICAgICAgaWYgKHR5cGVvZiBpZCAhPSAic3RyaW5nIikgewogICAgICAgICAgICBkZXBzID0gaWQ7CiAgICAgICAgICAgIGlkID0gd2luZG93LnJlcXVpcmUuaWQ7CiAgICAgICAgfQogICAgfSBlbHNlIGlmIChhcmd1bWVudHMubGVuZ3RoID09IDEpIHsKICAgICAgICBmYWN0b3J5ID0gaWQ7CiAgICAgICAgZGVwcyA9IFtdOwogICAgICAgIGlkID0gd2luZG93LnJlcXVpcmUuaWQ7CiAgICB9CiAgICAKICAgIGlmICh0eXBlb2YgZmFjdG9yeSAhPSAiZnVuY3Rpb24iKSB7CiAgICAgICAgd2luZG93LnJlcXVpcmUubW9kdWxlc1tpZF0gPSB7CiAgICAgICAgICAgIGV4cG9ydHM6IGZhY3RvcnksCiAgICAgICAgICAgIGluaXRpYWxpemVkOiB0cnVlCiAgICAgICAgfTsKICAgICAgICByZXR1cm47CiAgICB9CgogICAgaWYgKCFkZXBzLmxlbmd0aCkKICAgICAgICAvLyBJZiB0aGVyZSBpcyBubyBkZXBlbmRlbmNpZXMsIHdlIGluamVjdCAicmVxdWlyZSIsICJleHBvcnRzIiBhbmQKICAgICAgICAvLyAibW9kdWxlIiBhcyBkZXBlbmRlbmNpZXMsIHRvIHByb3ZpZGUgQ29tbW9uSlMgY29tcGF0aWJpbGl0eS4KICAgICAgICBkZXBzID0gWyJyZXF1aXJlIiwgImV4cG9ydHMiLCAibW9kdWxlIl07CgogICAgdmFyIHJlcSA9IGZ1bmN0aW9uKGNoaWxkSWQpIHsKICAgICAgICByZXR1cm4gd2luZG93LnJlcXVpcmUoaWQsIGNoaWxkSWQpOwogICAgfTsKCiAgICB3aW5kb3cucmVxdWlyZS5tb2R1bGVzW2lkXSA9IHsKICAgICAgICBleHBvcnRzOiB7fSwKICAgICAgICBmYWN0b3J5OiBmdW5jdGlvbigpIHsKICAgICAgICAgICAgdmFyIG1vZHVsZSA9IHRoaXM7CiAgICAgICAgICAgIHZhciByZXR1cm5FeHBvcnRzID0gZmFjdG9yeS5hcHBseSh0aGlzLCBkZXBzLnNsaWNlKDAsIGZhY3RvcnkubGVuZ3RoKS5tYXAoZnVuY3Rpb24oZGVwKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKGRlcCkgewogICAgICAgICAgICAgICAgICAgIC8vIEJlY2F1c2UgInJlcXVpcmUiLCAiZXhwb3J0cyIgYW5kICJtb2R1bGUiIGFyZW4ndCBhY3R1YWwKICAgICAgICAgICAgICAgICAgICAvLyBkZXBlbmRlbmNpZXMsIHdlIG11c3QgaGFuZGxlIHRoZW0gc2VwZXJhdGVseS4KICAgICAgICAgICAgICAgICAgICBjYXNlICJyZXF1aXJlIjogcmV0dXJuIHJlcTsKICAgICAgICAgICAgICAgICAgICBjYXNlICJleHBvcnRzIjogcmV0dXJuIG1vZHVsZS5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgIGNhc2UgIm1vZHVsZSI6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AgICAgICAgICAgIAogICAgICAgIHRoaXMuY2FsbGJhY2sgPSBmdW5jdGlvbihkYXRhLCBjYWxsYmFja0lkKSB7CiAgICAgICAgICAgIHBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIHR5cGU6ICJjYWxsIiwKICAgICAgICAgICAgICAgIGlkOiBjYWxsYmFja0lkLAogICAgICAgICAgICAgICAgZGF0YTogZGF0YQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgCiAgICAgICAgdGhpcy5lbWl0ID0gZnVuY3Rpb24obmFtZSwgZGF0YSkgewogICAgICAgICAgICBwb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICB0eXBlOiAiZXZlbnQiLAogICAgICAgICAgICAgICAgbmFtZTogbmFtZSwKICAgICAgICAgICAgICAgIGRhdGE6IGRhdGEKICAgICAgICAgICAgfSk7CiAgICAgICAgfTsKICAgICAgICAKICAgIH0pLmNhbGwoU2VuZGVyLnByb3RvdHlwZSk7CiAgICAKICAgIHJldHVybiBuZXcgU2VuZGVyKCk7Cn07Cgp2YXIgbWFpbiA9IHdpbmRvdy5tYWluID0gbnVsbDsKdmFyIHNlbmRlciA9IHdpbmRvdy5zZW5kZXIgPSBudWxsOwoKd2luZG93Lm9ubWVzc2FnZSA9IGZ1bmN0aW9uKGUpIHsKICAgIHZhciBtc2cgPSBlLmRhdGE7CiAgICBpZiAobXNnLmV2ZW50ICYmIHNlbmRlcikgewogICAgICAgIHNlbmRlci5fc2lnbmFsKG1zZy5ldmVudCwgbXNnLmRhdGEpOwogICAgfQogICAgZWxzZSBpZiAobXNnLmNvbW1hbmQpIHsKICAgICAgICBpZiAobWFpblttc2cuY29tbWFuZF0pCiAgICAgICAgICAgIG1haW5bbXNnLmNvbW1hbmRdLmFwcGx5KG1haW4sIG1zZy5hcmdzKTsKICAgICAgICBlbHNlIGlmICh3aW5kb3dbbXNnLmNvbW1hbmRdKQogICAgICAgICAgICB3aW5kb3dbbXNnLmNvbW1hbmRdLmFwcGx5KHdpbmRvdywgbXNnLmFyZ3MpOwogICAgICAgIGVsc2UKICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJVbmtub3duIGNvbW1hbmQ6IiArIG1zZy5jb21tYW5kKTsKICAgIH0KICAgIGVsc2UgaWYgKG1zZy5pbml0KSB7CiAgICAgICAgd2luZG93LmluaXRCYXNlVXJscyhtc2cudGxucyk7CiAgICAgICAgc2VuZGVyID0gd2luZG93LnNlbmRlciA9IHdpbmRvdy5pbml0U2VuZGVyKCk7CiAgICAgICAgdmFyIGNsYXp6ID0gdGhpcy5yZXF1aXJlKG1zZy5tb2R1bGUpW21zZy5jbGFzc25hbWVdOwogICAgICAgIG1haW4gPSB3aW5kb3cubWFpbiA9IG5ldyBjbGF6eihzZW5kZXIpOwogICAgfQp9Owp9KSh0aGlzKTsKCmFjZS5kZWZpbmUoImFjZS9saWIvb29wIixbXSwgZnVuY3Rpb24ocmVxdWlyZSwgZXhwb3J0cywgbW9kdWxlKXsidXNlIHN0cmljdCI7CmV4cG9ydHMuaW5oZXJpdHMgPSBmdW5jdGlvbiAoY3Rvciwgc3VwZXJDdG9yKSB7CiAgICBjdG9yLnN1cGVyXyA9IHN1cGVyQ3RvcjsKICAgIGN0b3IucHJvdG90eXBlID0gT2JqZWN0LmNyZWF0ZShzdXBlckN0b3IucHJvdG90eXBlLCB7CiAgICAgICAgY29uc3RydWN0b3I6IHsKICAgICAgICAgICAgdmFsdWU6IGN0b3IsCiAgICAgICAgICAgIGVudW1lcmFibGU6IGZhbHNlLAogICAgICAgICAgICB3cml0YWJsZTogdHJ1ZSwKICAgICAgICAgICAgY29uZmlndXJhYmxlOiB0cnVlCiAgICAgICAgfQogICAgfSk7Cn07CmV4cG9ydHMubWl4aW4gPSBmdW5jdGlvbiAob2JqLCBtaXhpbikgewogICAgZm9yICh2YXIga2V5IGluIG1peGluKSB7CiAgICAgICAgb2JqW2tleV0gPSBtaXhpbltrZXldOwogICAgfQogICAgcmV0dXJuIG9iajsKfT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IHZhciByb3cgPSBkZWx0YS5zdGFydC5yb3c7CiAgICB2YXIgc3RhcnRDb2x1bW4gPSBkZWx0YS5zdGFydC5jb2x1bW47CiAgICB2YXIgbGluZSA9IGRvY0xpbmVzW3Jvd10gfHwgIiI7CiAgICBzd2l0Y2ggKGRlbHRhLmFjdGlvbikgewogICAgICAgIGNhc2UgImluc2VydCI6CiAgICAgICAgICAgIHZhciBsaW5lcyA9IGRlbHRhLmxpbmVzOwogICAgICAgICAgICBpZiAobGluZXMubGVuZ3RoID09PSAxKSB7CiAgICAgICAgICAgICAgICBkb2NMaW5lc1tyb3ddID0gbGluZS5zdWJzdHJpbmcoMCwgc3RhcnRDb2x1bW4pICsgZGVsdGEubGluZXNbMF0gKyBsaW5lLnN1YnN0cmluZyhzdGFydENvbHVtbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICB2YXIgYXJncyA9IFtyb3csIDFdLmNvbmNhdChkZWx0YS5saW5lcyk7CiAgICAgICAgICAgICAgICBkb2NMaW5lcy5zcGxpY2UuYXBwbHkoZG9jTGluZXMsIGFyZ3MpOwogICAgICAgICAgICAgICAgZG9jTGluZXNbcm93XSA9IGxpbmUuc3Vic3RyaW5nKDAsIHN0YXJ0Q29sdW1uKSArIGRvY0xpbmVzW3Jvd107CiAgICAgICAgICAgICAgICBkb2NMaW5lc1tyb3cgKyBkZWx0YS5saW5lcy5sZW5ndGggLSAxXSArPSBsaW5lLnN1YnN0cmluZyhzdGFydENvbHVtbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgY2FzZSAicmVtb3ZlIjoKICAgICAgICAgICAgdmFyIGVuZENvbHVtbiA9IGRlbHRhLmVuZC5jb2x1bW47CiAgICAgICAgICAgIHZhciBlbmRSb3cgPSBkZWx0YS5lbmQucm93OwogICAgICAgICAgICBpZiAocm93ID09PSBlbmRSb3cpIHsKICAgICAgICAgICAgICAgIGRvY0xpbmVzW3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XIgPSB0aGlzLl9kZWZhdWx0SGFuZGxlcnNbZXZlbnROYW1lXTsKICAgICAgICBpZiAoIWxpc3RlbmVycy5sZW5ndGggJiYgIWRlZmF1bHRIYW5kbGVyKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgaWYgKHR5cGVvZiBlICE9ICJvYmplY3QiIHx8ICFlKQogICAgICAgICAgICBlID0ge307CiAgICAgICAgaWYgKCFlLnR5cGUpCiAgICAgICAgICAgIGUudHlwZSA9IGV2ZW50TmFtZTsKICAgICAgICBpZiAoIWUuc3RvcFByb3BhZ2F0aW9uKQogICAgICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbiA9IHN0b3BQcm9wYWdhdGlvbjsKICAgICAgICBpZiAoIWUucHJldmVudERlZmF1bHQpCiAgICAgICAgICAgIGUucHJldmVudERlZmF1bHQgPSBwcmV2ZW50RGVmYXVsdDsKICAgICAgICBsaXN0ZW5lcnMgPSBsaXN0ZW5lcnMuc2xpY2UoKTsKICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxpc3RlbmVycy5sZW5ndGg7IGkrKykgewogICAgICAgICAgICBsaXN0ZW5lcnNbaV0oZSwgdGhpcyk7CiAgICAgICAgICAgIGlmIChlLnByb3BhZ2F0aW9uU3RvcHBlZCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICBpZiAoZGVmYXVsdEhhbmRsZXIgJiYgIWUuZGVmYXVsdFByZXZlbnRlZCkKICAgICAgICAgICAgcmV0dXJuIGRlZmF1bHRIYW5kbGVyKGUsIHRoaXMpOwogICAgfTsKRXZlbnRFbWl0dGVyLl9zaWduYWwgPSBmdW5jdGlvbiAoZXZlbnROYW1lLCBlKSB7CiAgICB2YXIgbGlzdGVuZXJzID0gKHRoaXMuX2V2ZW50UmVnaXN0cnkgfHwge30pW2V2ZW50TmFtZV07CiAgICBpZiAoIWxpc3RlbmVycykKICAgICAgICByZXR1cm47CiAgICBsaXN0ZW5lcnMgPSBsaXN0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aXN0cnlbZXZlbnROYW1lXTsKICAgICAgICBpZiAoIWxpc3RlbmVycykKICAgICAgICAgICAgbGlzdGVuZXJzID0gdGhpcy5fZXZlbnRSZWdpc3RyeVtldmVudE5hbWVdID0gW107CiAgICAgICAgaWYgKGxpc3RlbmVycy5pbmRleE9mKGNhbGxiYWNrKSA9PSAtMSkKICAgICAgICAgICAgbGlzdGVuZXJzW2NhcHR1cmluZyA/ICJ1bnNoaWZ0IiA6ICJwdXNoIl0oY2FsbGJhY2spOwogICAgICAgIHJldHVybiBjYWxsYmFjazsKICAgIH07CkV2ZW50RW1pdHRlci5vZmYgPQogICAgRXZlbnRFbWl0dGVyLnJlbW92ZUxpc3RlbmVyID0KICAgICAgICBFdmVudEVtaXR0ZXIucmVtb3ZlRXZlbnRMaXN0ZW5lciA9IGZ1bmN0aW9uIChldmVudE5hbWUsIGNhbGxiYWNrKSB7CiAgICAgICAgICAgIHRoaXMuX2V2ZW50UmVnaXN0cnkgPSB0aGlzLl9ldmVudFJlZ2lzdHJ5IHx8IHt9OwogICAgICAgICAgICB2YXIgbGlzdGVuZXJzID0gdGhpcy5fZXZlbnRSZWdpc3RyeVtldmVudE5hbWVdOwogICAgICAgICAgICBpZiAoIWxpc3RlbmVycykKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgdmFyIGluZGV4ID0gbGlzdGVuZXJzLmluZGV4T2YoY2FsbGJhY2spOwogICAgICAgICAgICBpZiAoaW5kZXggIT09IC0xKQogICAgICAgICAgICAgICAgbGlzdGVuZXJzLnNwbGljZShpbmRleCwgMSk7CiAgICAgICAgfTsKRXZlbnRFbWl0dGVyLnJlbW92ZUFsbExpc3RlbmVycyA9IGZ1bmN0aW9uIChldmVudE5hbWUpIHsKICAgIGlmICghZXZlbnROYW1lKQogICAgICAgIHRoaXMuX2V2ZW50UmVnaXN0cnkgPSB0aGlzLl9kZWZhdWx0SGFuZGxlcnMgPSB1bmRlZmluZWQ7CiAgICBpZiAodGhpcy5fZXZ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W1uOwogICAgfTsKICAgIHRoaXMudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgcmV0dXJuICgiUmFuZ2U6IFsiICsgdGhpcy5zdGFydC5yb3cgKyAiLyIgKyB0aGlzLnN0YXJ0LmNvbHVtbiArCiAgICAgICAgICAgICJdIC0+IFsiICsgdGhpcy5lbmQucm93ICsgIi8iICsgdGhpcy5lbmQuY29sdW1uICsgIl0iKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMDsKICAgIH07CiAgICB0aGlzLmNvbXBhcmVSYW5nZSA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAsIGVuZCA9IHJhbmdlLmVuZCwgc3RhcnQgPSByYW5nZS5zdGFydDsKICAgICAgICBjbXAgPSB0aGlzLmNvbXBhcmUoZW5kLnJvdywgZW5kLmNvbHVtbik7CiAgICAgICAgaWYgKGNtcCA9PSAxKSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSBpZiAoY21wID09IDApIHsKICAgICAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAoY21wID09IC0xKSB7CiAgICAgICAgICAgIHJldHVybiAtMjsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gLTEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDQyOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlUG9pbnQgPSBmdW5jdGlvbiAocCkgewogICAgICAgIHJldHVybiB0aGlzLmNvbXBhcmUocC5yb3csIHAuY29sdW1uKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zUmFuZ2UgPSBmdW5jdGlvbiAocmFuZ2UpIHsKICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlUG9pbnQocmFuZ2Uuc3RhcnQpID09IDAgJiYgdGhpcy5jb21wYXJlUG9pbnQocmFuZ2UuZW5kKSA9PSAwOwogICAgfTsKICAgIHRoaXMuaW50ZXJzZWN0cyA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAgPSB0aGlzLmNvbXBhcmVSYW5nZShyYW5nZSk7CiAgICAgICAgcmV0dXJuIChjbXAgPT0gLTEgfHwgY21wID09IDAgfHwgY21wID09IDEpOwogICAgfTsKICAgIHRoaXMuaXNFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4gdGhpcy5lbmQucm93ID09IHJvdyAmJiB0aGlzLmVuZC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuaXNTdGFydCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHJldHVybiB0aGlzLnN0YXJ0LnJvdyA9PSByb3cgJiYgdGhpcy5zdGFydC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuc2V0U3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IHJvdy5jb2x1bW47CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93LnJvdzsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5zZXRFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSByb3cuY29sdW1uOwogICAgICAgICAgICB0aGlzLmVuZC5yb3cgPSByb3cucm93OwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgdGhpcy5lbmQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSBjb2x1bW47CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuaW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc0VuZChyb3csIGNvbHVtbikgfHwgdGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlU3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodGhpcy5jb21wYXJlKHJvdywgY29sdW1uKSA9PSAwKSB7CiAgICAgICAgICAgIGlmICh0aGlzLmlzRW5kKHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlRW5kID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuY29tcGFyZSA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICghdGhpcy5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgIGlmIChyb3cgPT09IHRoaXMuc3RhcnQucm93KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gY29sdW1uIDwgdGhpcy5zdGFydC5jb2x1bW4gPyAtMSA6IChjb2x1bW4gPiB0aGlzLmVuZC5jb2x1bW4gPyAxIDogMCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuc3RhcnQucm93KQogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHJvdyA+IHRoaXMuZW5kLnJvdykKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09PSByb3cpCiAgICAgICAgICAgIHJldHVybiBjb2x1bW4gPj0gdGhpcy5zdGFydC5jb2x1bW4gPyAwIDogLTE7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PT0gcm93KQogICAgICAgICAgICByZXR1cm4gY29sdW1uIDw9IHRoaXMuZW5kLmNvbHVtbiA/IDAgOiAxOwogICAgICAgIHJldHVybiAwOwogICAgfTsKICAgIHRoaXMuY29tcGFyZVN0YXJ0ID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09IHJvdyAmJiB0aGlzLnN0YXJ0LmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbik7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuY29tcGFyZUVuZCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPT0gcm93ICYmIHRoaXMuZW5kLmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlSW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PSByb3cgJiYgdGhpcy5lbmQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAodGhpcy5zdGFydC5yb3cgPT0gcm93ICYmIHRoaXMuc3RhcnQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jbGlwUm93cyA9IGZ1bmN0aW9uIChmaXJzdFJvdywgbGFzdFJvdykgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPiBsYXN0Um93KQogICAgICAgICAgICB2YXIgZW5kID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLmVuZC5yb3cgPCBmaXJzdFJvdykKICAgICAgICAgICAgdmFyIGVuZCA9IHsgcm93OiBmaXJzdFJvdywgY29sdW1uOiAwIH07CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID4gbGFzdFJvdykKICAgICAgICAgICAgdmFyIHN0YXJ0ID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLnN0YXJ0LnJvdyA8IGZpcnN0Um93KQogICAgICAgICAgICB2YXIgc3RhcnQgPSB7IHJvdzogZmlyc3RSb3csIGNvbHVtbjogMCB9OwogICAgICAgIHJldHVybiBSYW5nZS5mcm9tUG9pbnRzKHN0YXJ0IHx8IHRoaXMuc3RhcnQsIGVuZCB8fCB0aGlzLmVuZCk7CiAgICB9OwogICAgdGhpcy5leHRlbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICB2YXIgY21wID0gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICBpZiAoY21wID09IDApCiAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGVsc2UgaWYgKGNtcCA9PSAtMSkKICAgICAgICAgICAgdmFyIHN0YXJ0ID0geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgICAgICBlbHNlCiAgICAgICAgICAgIHZhciB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sIGRlbHRhU3RhcnQsIG1vdmVJZkVxdWFsKSkgewogICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgcm93OiBwb2ludC5yb3csCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbgogICAgICAgICAgICB9OwogICAgICAgIH0KICAgICAgICBpZiAoJHBvaW50c0luT3JkZXIoZGVsdGFFbmQsIHBvaW50LCAhbW92ZUlmRXF1YWwpKSB7CiAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICByb3c6IHBvaW50LnJvdyArIGRlbHRhUm93U2hpZnQsCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbiArIChwb2ludC5yb3cgPT0gZGVsdGFFbmQucm93ID8gZGVsdGFDb2xTaGlmdCA6IDApCiAgICAgICAgICAgIH07CiAgICAgICAgfQogICAgICAgIHJldHVybiB7CiAgICAgICAgICAgIHJvdzogZGVsdGFTdGFydC5yb3csCiAgICAgICAgICAgIGNvbHVtbjogZGVsdGFTdGFydC5jb2x1bW4KICAgICAgICB9OwogICAgfQogICAgdGhpcy5zZXRQb3NpdGlvbiA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbiwgbm9DbGlwKSB7CiAgICAgICAgdmFyIHBvczsKICAgICAgICBpZiAobm9DbGlwKSB7CiAgICAgICAgICAgIHBvcyA9IHsKICAgICAgICAgICAgICAgIHJvdzogcm93LAogICAgICAgICAgICAgICAgY29sdW1uOiBjb2x1bW4KICAgICAgICAgICAgfTsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHBvcyA9IHRoaXMuJGNsaXBQb3NpdGlvblRvRG9jdW1lbnQocm93LCBjb2x1bW4pOwogICAgICAgIH0KICAgICAgICBpZiAodGhpcy5yb3cgPT0gcG9zLnJvdyAmJiB0aGlzLmNvbHVtbiA9PSBwb3MuY29sdW1uKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgdmFyIG9sZCA9IHsKICAgICAg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IHZhciBtYXRjaCA9IHRleHQubWF0Y2goL14uKj8oXHJcbnxccnxcbikvbSk7CiAgICAgICAgdGhpcy4kYXV0b05ld0xpbmUgPSBtYXRjaCA/IG1hdGNoWzFdIDogIlxuIjsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lQ2hhcmFjdGVyID0gZnVuY3Rpb24gKCkgewogICAgICAgIHN3aXRjaCAodGhpcy4kbmV3TGluZU1vZGUpIHsKICAgICAgICAgICAgY2FzZSAid2luZG93cyI6CiAgICAgICAgICAgICAgICByZXR1cm4gIlxyXG4iOwogICAgICAgICAgICBjYXNlICJ1bml4IjoKICAgICAgICAgICAgICAgIHJldHVybiAiXG4iOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuJGF1dG9OZXdMaW5lIHx8ICJcbiI7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuJGF1dG9OZXdMaW5lID0gIiI7CiAgICB0aGlzLiRuZXdMaW5lTW9kZSA9ICJhdXRvIjsKICAgIHRoaXMuc2V0TmV3TGluZU1vZGUgPSBmdW5jdGlvbiAobmV3TGluZU1vZGUpIHsKICAgICAgICBpZiAodGhpcy4kbmV3TGluZU1vZGUgPT09IG5ld0xpbmVNb2RlKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgdGhpcy4kbmV3TGluZU1vZGUgPSBuZXdMaW5lTW9kZTsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lTW9kZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICByZXR1cm4gdGhpcy4kbmV3TGluZU1vZGU7CiAgICB9OwogICAgdGhpcy5pc05ld0xpbmUgPSBmdW5jdGlvbiAodGV4dCkgewogICAgICAgIHJldHVybiAodGV4dCA9PSAiXHJcbiIgfHwgd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nNlcnRNZXJnZWRMaW5lcyhwb3NpdGlvbiwgWycnLCAnJ10pIGluc3RlYWQuIik7CiAgICAgICAgcmV0dXJuIHRoaXMuaW5zZXJ0TWVyZ2VkTGluZXMocG9zaXRpb24sIFsiIiwgIiJdKTsKICAgIH07CiAgICB0aGlzLmluc2VydCA9IGZ1bmN0aW9uIChwb3NpdGlvbiwgdGV4dCkgewogICAgICAgIGlmICh0aGlzLmdldExlbmd0aCgpIDw9IDEpCiAgICAgICAgICAgIHRoaXMuJGRldGVjdE5ld0xpbmUodGV4dCk7CiAgICAgICAgcmV0dXJuIHRoaXMuaW5zZXJ0TWVyZ2VkTGluZXMocG9zaXRpb24sIHRoaXMuJHNwbGl0KHRleHQpKTsKICAgIH07CiAgICB0aGlzLmluc2VydEluTGluZSA9IGZ1bmN0aW9uIChwb3NpdGlvbiwgdGV4dCkgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhwb3NpdGlvbi5yb3csIHBvc2l0aW9uLmNvbHVtbik7CiAgICAgICAgdmFyIGVuZCA9IHRoaXMucG9zKHBvc2l0aW9uLnJvdywgcG9zaXRpb24uY29sdW1uICsgdGV4dC5sZW5ndGgpOwogICAgICAgIHRoaXMuYXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCwKICAgICAgICAgICAgZW5kOiBlbmQsCiAgICAgICAgICAgIGFjdGlvbjogImluc2VydCIsCiAgICAgICAgICAgIGxpbmVzOiBbdGV4dF0KICAgICAgICB9LCB0cnVlKTsKICAgICAgICByZXR1cm4gdGhpcy5jbG9uZVBvcyhlbmQpOwogICAgfTsKICAgIHRoaXMuY2xpcHBlZFBvcyA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHZhciBsZW5ndGggPSB0aGlzLmdldExlbmd0aCgpOwogICAgICAgIGlmIChyb3cgPT09IHVuZGVmaW5lZCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGg7CiAgICAgICAgfQogICAgICAgIGVsc2UgaWYgKHJvdyA8IDApIHsKICAgICAgICAgICAgcm93ID0gMDsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAocm93ID49IGxlbmd0aCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGggLSAxOwogICAgICAgICAgICBjb2x1bW4gPSB1bmRlZmluZWQ7CiAgICAgICAgfQogICAgICAgIHZhciBsaW5lID0gdGhpcy5nZXRMaW5lKHJvdyk7CiAgICAgICAgaWYgKGNvbHVtbiA9PSB1bmRlZmluZWQpCiAgICAgICAgICAgIGNvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIGNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KGNvbHVtbiwgMCksIGxpbmUubGVuZ3RoKTsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLmNsb25lUG9zID0gZnVuY3Rpb24gKHBvcykgewogICAgICAgIHJldHVybiB7IHJvdzogcG9zLnJvdywgY29sdW1uOiBwb3MuY29sdW1uIH07CiAgICB9OwogICAgdGhpcy5wb3MgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLiRjbGlwUG9zaXRpb24gPSBmdW5jdGlvbiAocG9zaXRpb24pIHsKICAgICAgICB2YXIgbGVuZ3RoID0gdGhpcy5nZXRMZW5ndGgoKTsKICAgICAgICBpZiAocG9zaXRpb24ucm93ID49IGxlbmd0aCkgewogICAgICAgICAgICBwb3NpdGlvbi5yb3cgPSBNYXRoLm1heCgwLCBsZW5ndGggLSAxKTsKICAgICAgICAgICAgcG9zaXRpb24uY29sdW1uID0gdGhpcy5nZXRMaW5lKGxlbmd0aCAtIDEpLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHBvc2l0aW9uLnJvdyA9IE1hdGgubWF4KDAsIHBvc2l0aW9uLnJvdyk7CiAgICAgICAgICAgIHBvc2l0aW9uLmNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KHBvc2l0aW9uLmNvbHVtbiwgMCksIHRoaXMuZ2V0TGluZShwb3NpdGlvbi5yb3cpLmxlbmd0aCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBwb3NpdGlvbjsKICAgIH07CiAgICB0aGlzLmluc2VydEZ1bGxMaW5lcyA9IGZ1bmN0aW9uIChyb3csIGxpbmVzKSB7CiAgICAgICAgcm93ID0gTWF0aC5taW4oTWF0aC5tYXgocm93LCAwKSwgdGhpcy5nZXRMZW5ndGgoKSk7CiAgICAgICAgdmFyIGNvbHVtbiA9IDA7CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuZ2V0TGVuZ3RoKCkpIHsKICAgICAgICAgICAgbGluZXMgPSBsaW5lcy5jb25jYXQoWyIiXSk7CiAgICAgICAgICAgIGNvbHVtbiA9IDA7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICBsaW5lcyA9IFsiIl0uY29uY2F0KGxpbmVzKTsKICAgICAgICAgICAgcm93LS07CiAgICAgICAgICAgIGNvbHVtbiA9IHRoaXMuJGxpbmVzW3Jvd10ubGVuZ3RoOwogICAgICAgIH0KICAgICAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzKHsgcm93OiByb3csIGNvbHVtbjogY29sdW1uIH0sIGxpbmVzKTsKICAgIH07CiAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzID0gZnVuY3Rpb24gKHBvc2l0aW9uLCBsaW5lcykgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhwb3NpdGlvbi5yb3csIHBvc2l0aW9uLmNvbHVtbik7CiAgICAgICAgdmFyIGVuZCA9IHsKICAgICAgICAgICAgcm93OiBzdGFydC5yb3cgKyBsaW5lcy5sZW5ndGggLSAxLAogICAgICAgICAgICBjb2x1bW46IChsaW5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d0aCAtIE1BWCArIDE7CiAgICAgICAgdmFyIHJvdyA9IGRlbHRhLnN0YXJ0LnJvdzsKICAgICAgICB2YXIgY29sdW1uID0gZGVsdGEuc3RhcnQuY29sdW1uOwogICAgICAgIGZvciAodmFyIGZyb20gPSAwLCB0byA9IDA7IGZyb20gPCBsOyBmcm9tID0gdG8pIHsKICAgICAgICAgICAgdG8gKz0gTUFYIC0gMTsKICAgICAgICAgICAgdmFyIGNodW5rID0gbGluZXMuc2xpY2UoZnJvbSwgdG8pOwogICAgICAgICAgICBjaHVuay5wdXNoKCIiKTsKICAgICAgICAgICAgdGhpcy5hcHBseURlbHRhKHsKICAgICAgICAgICAgICAgIHN0YXJ0OiB0aGlzLnBvcyhyb3cgKyBmcm9tLCBjb2x1bW4pLAogICAgICAgICAgICAgICAgZW5kOiB0aGlzLnBvcyhyb3cgKyB0bywgY29sdW1uID0gMCksCiAgICAgICAgICAgICAgICBhY3Rpb246IGRlbHRhLmFjdGlvbiwKICAgICAgICAgICAgICAgIGxpbmVzOiBjaHVuawogICAgICAgICAgICB9LCB0cnVlKTsKICAgICAgICB9CiAgICAgICAgZGVsdGEubGluZXMgPSBsaW5lcy5zbGljZShmcm9tKTsKICAgICAgICBkZWx0YS5zdGFydC5yb3cgPSByb3cgKyBmcm9tOwogICAgICAgIGRlbHRhLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoZGVsdGEsIHRydWUpOwogICAgfTsKICAgIHRoaXMucmV2ZXJ0RGVsdGEgPSBmdW5jdGlvbiAoZGVsdGEpIHsKICAgICAgICB0aGlzLiRzYWZlQXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiB0aGlzLmNsb25lUG9zKGRlbHRhLnN0YXJ0KSwKICAgICAgICAgICAgZW5kOiB0aGlzLmNsb25lUG9zKGRlbHRhLmVuZCksCiAgICAgICAgICAgIGFjdGlvbjogKGRlbHRhLmFjdGlvbiA9PSAiaW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CAnJyk7Cn07CmV4cG9ydHMuc3RyaW5nVHJpbVJpZ2h0ID0gZnVuY3Rpb24gKHN0cmluZykgewogICAgcmV0dXJuIHN0cmluZy5yZXBsYWNlKHRyaW1FbmRSZWdleHAsICcnKTsKfTsKZXhwb3J0cy5jb3B5T2JqZWN0ID0gZnVuY3Rpb24gKG9iaikgewogICAgdmFyIGNvcHkgPSB7fTsKICAgIGZvciAodmFyIGtleSBpbiBvYmopIHsKICAgICAgICBjb3B5W2tleV0gPSBvYmpba2V5XTsKICAgIH0KICAgIHJldHVybiBjb3B5Owp9OwpleHBvcnRzLmNvcHlBcnJheSA9IGZ1bmN0aW9uIChhcnJheSkgewogICAgdmFyIGNvcHkgPSBbXTsKICAgIGZvciAodmFyIGkgPSAwLCBsID0gYXJyYXkubGVuZ3RoOyBpIDwgbDsgaSsrKSB7CiAgICAgICAgaWYgKGFycmF5W2ldICYmIHR5cGVvZiBhcnJheVtpXSA9PSAib2JqZWN0IikKICAgICAgICAgICAgY29weVtpXSA9IHRoaXMuY29weU9iamVjdChhcnJheVtpXSk7CiAgICAgICAgZWxzZQogICAgICAgICAgICBjb3B5W2ldID0gYXJyYXlbaV07CiAgICB9CiAgICByZXR1cm4gY29weTsKfTsKZXhwb3J0cy5kZWVwQ29weSA9IGZ1bmN0aW9uIGRlZXBDb3B5KG9iaikgewogICAgaWYgKHR5cGVvZiBvYmogIT09ICJvYmplY3QiIHx8ICFvYmopCiAgICAgICAgcmV0dXJuIG9iajsKICAgIHZhciBjb3B5OwogICAgaWYgKEFycmF5LmlzQXJyYXkob2JqKSkgewogICAgICAgIGNvcHkgPSBbXTsKICAgICAgICBmb3IgKHZhciBrZXkgPSAwOyBrZXkgPCBvYmoubGVuZ3RoOyBrZXkrKykgewogICAgICAgICAgICBjb3B5W2tleV0gPSBkZWVwQ29weShvYmpba2V5XSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBjb3B5OwogICAgfQogICAgaWYgKE9iamVjdC5wcm90b3R5cGUudG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AgICAgICAgICAgICAgZCA9IHthY3Rpb246ICJyZW1vdmUiLCBzdGFydDogZGF0YVtpXSwgZW5kOiBkYXRhW2krMV19OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBpZiAoKGQuYWN0aW9uID09ICJpbnNlcnQiID8gZC5zdGFydCA6IGQuZW5kKS5yb3cgPj0gZG9jLiRsaW5lcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICBlcnIgPSBuZXcgRXJyb3IoIkludmFsaWQgZGVsdGEiKTsKICAgICAgICAgICAgICAgICAgICBlcnIuZGF0YSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogX3NlbGYuJHBhdGgsCiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzTGVuZ3RoOiBkb2MuJGxpbmVzLmxlbmd0aCwKICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQ6IGQuc3RhcnQsCiAgICAgICAgICAgICAgICAgICAgICAgIGVuZDogZC5lbmQKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHRocm93IGVycjsKICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICBkb2MuYXBwbHlEZWx0YShkLCB0cnVlKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoX3NlbGYuJHRpbWVvdXQpCiAgICAgICAgICAgIHJldHVybiBkZWZlcnJlZFVwZGF0ZS5zY2hlZHVsZShfc2VsZi4kdGltZW91dCk7CiAgICAgICAgX3NlbGYub25VcGRhdGUoKTsKICAgIH0pOwp9OwoKKGZ1bmN0aW9uKCkgewogICAgCiAgICB0aGlzLiR0aW1lb3V0ID0gNTAwOwogICAgCiAgICB0aGlzLnNldFRpbWVvdXQgPSBmdW5jdGlvbih0aW1lb3V0KSB7CiAgICAgICAgdGhpcy4kdGltZW91dCA9IHRpbWVvdXQ7CiAgICB9OwogICAgCiAgICB0aGlzLnNldFZhbHVlID0gZnVuY3Rpb24odmFsdWUpIHsKICAgICAgICB0aGlzLmRvYy5zZXRWYWx1ZSh2YWx1ZSk7CiAgICAgICAgdGhpcy5kZWZlcnJlZFVwZGF0ZS5zY2hlZHVsZSh0aGlzLiR0aW1lb3V0KTsKICAgIH07CiAgICAKICAgIHRoaXMuZ2V0VmFsdWUgPSBmdW5jdGlvbihjYWxsYmFja0lkKSB7CiAgICAgICAgdGhpcy5zZW5kZXIuY2FsbGJhY2sodGhpcy5kb2MuZ2V0VmFsdWUoKSwgY2FsbGJhY2tJZCk7CiAgICB9OwogICAgCiAgICB0aGlzLm9uVXBkYXRlID0gZnVuY3Rpb24oKSB7CiAgICB9OwogICAgCiAgICB0aGlzLmlzUGVuZGluZyA9IGZ1bmN0aW9uKCkgewogICAgICAgIHJldHVybiB0aGlzLmRlZmVycmVkVXBkYXRlLmlzUGVuZGluZygpOwogICAgfTsKICAgIAp9KS5jYWxsKE1pcnJvci5wcm90b3R5cGUpOwoKfSk7CgphY2UuZGVmaW5lKCJhY2UvbW9kZS9qc29uL2pzb25fcGFyc2UiLFtdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpIHsKInVzZSBzdHJpY3QiOwoKICAgIHZhciBhdCwgICAgIC8vIFRoZSBpbmRleCBvZiB0aGUgY3VycmVudCBjaGFyYWN0ZXIKICAgICAgICBjaCwgICAgIC8vIFRoZSBjdXJyZW50IGNoYXJhY3RlcgogICAgICAgIGVzY2FwZWUgPSB7CiAgICAgICAgICAgICciJzogICciJywKICAgICAgICAgICAgJ1xcJzogJ1xcJywKICAgICAgICAgICAgJy8nOiAgJy8nLAogICAgICAgICAgICBiOiAgICAnXGInLAogICAgICAgICAgICBmOiAgICAnXGYnLAogICAgICAgICAgICBuOiAgICAnXG4nLAogICAgICAgICAgICByOiAgICAnXHInLAogICAgICAgICAgICB0OiAgICAnXHQnCiAgICAgICAgfSwKICAgICAgICB0ZXh0LAoKICAgICAgICBlcnJvciA9IGZ1bmN0aW9uIChtKSB7CgogICAgICAgICAgICB0aHJvdyB7CiAgICAgICAgICAgICAgICBuYW1lOiAgICAnU3ludGF4RXJyb3InLAogICAgICAgICAgICAgICAgbWVzc2FnZTogbSwKICAgICAgICAgICAgICAgIGF0OiAgICAgIGF0LAogICAgICAgICAgICAgICAgdGV4dDogICAgdGV4dAogICAgICAgICAgICB9OwogICAgICAgIH0sCgogICAgICAgIG5leHQgPSBmdW5jdGlvbiAoYykgewoKICAgICAgICAgICAgaWYgKGMgJiYgYyAhPT0gY2gpIHsKICAgICAgICAgICAgICAgIGVycm9yKCJFeHBlY3RlZCAnIiArIGMgKyAiJyBpbnN0ZWFkIG9mICciICsgY2ggKyAiJyIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBjaCA9IHRleHQuY2hhckF0KGF0KTsKICAgICAgICAgICAgYXQgKz0gMTsKICAgICAgICAgICAgcmV0dXJuIGNoOwogICAgICAgIH0sCgogICAgICAgIG51bWJlciA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHZhciBudW1iZXIsCiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnJzsKCiAgICAgICAgICAgIGlmIChjaCA9PT0gJy0nKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnLSc7CiAgICAgICAgICAgICAgICBuZXh0KCctJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgd2hpbGUgKGNoID49ICcwJyAmJiBjaCA8PSAnOScpIHsKICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICcuJykgewogICAgICAgICAgICAgICAgc3RyaW5nICs9ICcuJzsKICAgICAgICAgICAgICAgIHdoaWxlIChuZXh0KCkgJiYgY2ggPj0gJzAnICYmIGNoIDw9ICc5JykgewogICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICdlJyB8fCBjaCA9PT0gJ0UnKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgKz0gY2g7CiAgICAgICAgICAgICAgICBuZXh0KCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICctJyB8fCBjaCA9PT0gJysnKSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHdoaWxlIChjaCA+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$w=vue.defineComponent({__name:"code-edit-modal",props:{modelValue:{default:()=>({})},lang:{default:"json"},title:{default:"编辑"}},emits:["update:modelValue","close"],setup(r,{emit:n}){const i=r,o=vue.ref(!1),a=vue.computed({get(){return i.lang==="json"?JSON.stringify(i.modelValue,null,2):i.modelValue},set(u){i.lang==="json"?n("update:modelValue",JSON.parse(u)):n("update:modelValue",u)}});return(u,c)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElButton),{onClick:c[0]||(c[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":c[2]||(c[2]=f=>vue.isRef(o)?o.value=f:null),title:i.title,width:"60%",onClose:c[3]||(c[3]=f=>n("close"))},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(VAceEditor),{value:vue.unref(a),"onUpdate:value":c[1]||(c[1]=f=>vue.isRef(a)?a.value=f:null),lang:i.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$b={class:"one-row-txt",style:{width:"78px"}},_hoisted_2$8={key:1},_hoisted_3$7={class:"one-row-txt",style:{width:"145px"}},_hoisted_4$3={key:1},_sfc_main$v=vue.defineComponent({__name:"dynamic-el-form-item",props:{objInfo:{default:()=>({})},hide:{default:()=>[]},code:{type:Boolean,default:!1}},emits:["change"],setup(r,{emit:n}){const i=r;function o(a){let u=window.setTimeout(function(){n("change",a),clearTimeout(u),u=null},200)}return(a,u)=>(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(i.objInfo,(c,f)=>(vue.openBlock(),vue.createElementBlock("div",{key:f},[i.code?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,class:"props-row",size:"small"},{label:vue.withCtx(()=>[vue.unref(getStringWidth)(String(f))>78?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:String(f),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$b,vue.toDisplayString(f),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$8,vue.toDisplayString(f),1))]),default:vue.withCtx(()=>[vue.unref(getStringWidth)(String(c.val))>145?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:JSON.stringify(c.val),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$7,vue.toDisplayString(c.val),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$3,vue.toDisplayString(c.val),1))]),_:2},1024)):vue.createCommentVNode("",!0),i.hide.indexOf(String(f))<0?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:1,label:c.title,size:"small"},{default:vue.withCtx(()=>[c.type===vue.unref(EConfigItemPropsType).Select?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSelect),{key:0,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,placeholder:"Select",size:"small",disabled:!!(c!=null&&c.disabled),onChange:o},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(c.options,d=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).InputNumber?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInputNumber),{key:1,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Input?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:2,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Textarea?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:3,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,autosize:"",type:"textarea",disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Color?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElColorPicker),{key:4,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Switch?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSwitch),{key:5,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).JsonEdit?(vue.openBlock(),vue.createBlock(_sfc_main$w,{key:6,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onClose:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):vue.createCommentVNode("",!0)]),_:2},1032,["label"])):vue.createCommentVNode("",!0)]))),128))}}),dynamicElFormItem_vue_vue_type_style_index_0_scoped_df8be28f_lang="",dynamicElFormItem_vue_vue_type_style_index_1_lang="",DynamicElFormItem=_export_sfc$1(_sfc_main$v,[["__scopeId","data-v-df8be28f"]]),_hoisted_1$a={style:{height:"100%"}},_hoisted_2$7={class:"flex flex-wrap"},_hoisted_3$6=["onMouseenter","onClick"],_sfc_main$u=vue.defineComponent({__name:"common-animate",props:{val:{}},emits:["updateCommonAniVal"],setup(r,{emit:n}){const i=r,o=vue.ref(i.val),a=vue.ref(!1),u=vue.ref("进入"),c=vue.ref(null),f=d=>{n("updateCommonAniVal",d),a.value=!1};return vue.watch(()=>i.val,d=>{o.value=d}),(d,p)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$a,[vue.unref(o)?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:0,closable:"",onClose:p[0]||(p[0]=h=>f("")),onClick:p[1]||(p[1]=h=>a.value=!0),style:{cursor:"pointer"}},{default:vue.withCtx(()=>{var h;return[vue.createTextVNode(vue.toDisplayString((h=vue.unref(common_animate_list).map(g=>g.children).reduce((g,v)=>g.concat(v)).find(g=>g.value==vue.unref(o)))==null?void 0:h.label)+" ",1),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:10},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"setting"})]),_:1})]}),_:1})):(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:1,type:"success",style:{cursor:"pointer"},onClick:p[2]||(p[2]=h=>a.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("新增")]),_:1})),vue.createVNode(vue.unref(elementPlus.ElDrawer),{modelValue:vue.unref(a),"onUpdate:modelValue":p[5]||(p[5]=h=>vue.isRef(a)?a.value=h:null),title:"选择动画",direction:"ltr"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElTabs),{modelValue:vue.unref(u),"onUpdate:modelValue":p[4]||(p[4]=h=>vue.isRef(u)?u.value=h:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(common_animate_list),h=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTabPane),{label:h.label,name:h.label,key:h.label},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{height:"500px"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_2$7,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(h.children,(g,v)=>(vue.openBlock(),vue.createElementBlock("div",{class:"animate",key:v,onMouseenter:y=>c.value=v,onMouseleave:p[3]||(p[3]=y=>c.value=null),onClick:y=>f(g.value)},[vue.createElementVNode("div",{class:vue.normalizeClass(`${vue.unref(c)==v?`animate__animated animate__${g.value} animate__slow animate__infinite`:""}`)},vue.toDisplayString(g.label),3)],40,_hoisted_3$6))),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$u,[["__scopeId","data-v-2668f60c"]]),_sfc_main$t=vue.defineComponent({__name:"component-tree",setup(r){const n=useGlobalStore(pinia),i=vue.computed(()=>{var u;return((u=n.handle_svg_info)==null?void 0:u.info.id)??""}),o=u=>{for(let c of n.done_json)c.selected=!1,c.old_position={x:0,y:0};n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo(u)},a={children:"children",label:"title"};return(u,c)=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTree),{class:"tree-v",data:vue.unref(n).done_json,props:a,onNodeClick:o,"default-expand-all":!0,"expand-on-click-node":!1,"highlight-current":!!vue.unref(i),"node-key":"id","current-node-key":vue.unref(i)},null,8,["data","highlight-current","current-node-key"]))}}),_withScopeId$1=r=>(vue.pushScopeId("data-v-98320511"),r=r(),vue.popScopeId(),r),_hoisted_1$9={class:"wall-l"},_hoisted_2$6={class:"head-l"},_hoisted_3$5=_withScopeId$1(()=>vue.createElementVNode("span",null,"key",-1)),_hoisted_4$2=_withScopeId$1(()=>vue.createElementVNode("span",null,"value",-1)),_hoisted_5$1={class:"row-l"},_sfc_main$s=vue.defineComponent({__name:"list",props:{modelValue:{default:()=>[{key:"",val:""}]}},emits:["update:modelValue"],setup(r,{emit:n}){const i=r,o=vue.computed({get(){return i.modelValue},set(c){n("update:modelValue",c)}}),a=()=>{o.value.push({key:"",val:""})},u=c=>{o.value.splice(c,1)};return(c,f)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$9,[vue.createElementVNode("div",_hoisted_2$6,[_hoisted_3$5,_hoisted_4$2,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:a},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"add"})]),_:1})]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(o),(d,p)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,[vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:d.key,"onUpdate:modelValue":h=>d.key=h,size:"small",placeholder:"key"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:d.val,"onUpdate:modelValue":h=>d.val=h,size:"small",placeholder:"value"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:h=>u(p)},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"delete"})]),_:2},1032,["onClick"])]))),256))]))}}),list_vue_vue_type_style_index_0_scoped_98320511_lang="",List=_export_sfc$1(_sfc_main$s,[["__scopeId","data-v-98320511"]]),composeEventHandlers=(r,n,{checkForDefaultPrevented:i=!0}={})=>a=>{const u=r==null?void 0:r(a);if(i===!1||!u)return n==null?void 0:n(a)};var _a;const isClient=typeof window<"u",isString$1=r=>typeof r=="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(r){return typeof r=="function"?r():vue.unref(r)}function createFilterWrapper(r,n){function i(...o){return new Promise((a,u)=>{Promise.resolve(r(()=>n.apply(this,o),{fn:n,thisArg:this,args:o})).then(a).catch(u)})}return i}function debounceFilter(r,n={}){let i,o,a=noop;const u=f=>{clearTimeout(f),a(),a=noop};return f=>{const d=resolveUnref(r),p=resolveUnref(n.maxWait);return i&&u(i),d<=0||p!==void 0&&p<=0?(o&&(u(o),o=null),Promise.resolve(f())):new Promise((h,g)=>{a=n.rejectOnCancel?g:h,p&&!o&&(o=setTimeout(()=>{i&&u(i),o=null,h(f())},p)),i=setTimeout(()=>{o&&u(o),o=null,h(f())},d)})}}function identity(r){return r}function tryOnScopeDispose(r){return vue.getCurrentScope()?(vue.onScopeDispose(r),!0):!1}function useDebounceFn(r,n=200,i={}){return createFilterWrapper(debounceFilter(n,i),r)}function refDebounced(r,n=200,i={}){const o=vue.ref(r.value),a=useDebounceFn(()=>{o.value=r.value},n,i);return vue.watch(r,()=>a()),o}function tryOnMounted(r,n=!0){vue.getCurrentInstance()?vue.onMounted(r):n?r():vue.nextTick(r)}function unrefElement(r){var n;const i=resolveUnref(r);return(n=i==null?void 0:i.$el)!=null?n:i}const defaultWindow=isClient?window:void 0;function useEventListener(...r){let n,i,o,a;if(isString$1(r[0])||Array.isArray(r[0])?([i,o,a]=r,n=defaultWindow):[n,i,o,a]=r,!n)return noop;Array.isArray(i)||(i=[i]),Array.isArray(o)||(o=[o]);const u=[],c=()=>{u.forEach(h=>h()),u.length=0},f=(h,g,v,y)=>(h.addEventListener(g,v,y),()=>h.removeEventListener(g,v,y)),d=vue.watch(()=>[unrefElement(n),resolveUnref(a)],([h,g])=>{c(),h&&u.push(...i.flatMap(v=>o.map(y=>f(h,v,y,g))))},{immediate:!0,flush:"post"}),p=()=>{d(),c()};return tryOnScopeDispose(p),p}let _iOSWorkaround=!1;function onClickOutside(r,n,i={}){const{window:o=defaultWindow,ignore:a=[],capture:u=!0,detectIframe:c=!1}=i;if(!o)return;isIOS&&!_iOSWorkaround&&(_iOSWorkaround=!0,Array.from(o.document.body.children).forEach(v=>v.addEventListener("click",noop)));let f=!0;const d=v=>a.some(y=>{if(typeof y=="string")return Array.from(o.document.querySelectorAll(y)).some(A=>A===v.target||v.composedPath().includes(A));{const A=unrefElement(y);return A&&(v.target===A||v.composedPath().includes(A))}}),h=[useEventListener(o,"click",v=>{const y=unrefElement(r);if(!(!y||y===v.target||v.composedPath().includes(y))){if(v.detail===0&&(f=!d(v)),!f){f=!0;return}n(v)}},{passive:!0,capture:u}),useEventListener(o,"pointerdown",v=>{const y=unrefElement(r);y&&(f=!v.composedPath().includes(y)&&!d(v))},{passive:!0}),c&&useEventListener(o,"blur",v=>{var y;const A=unrefElement(r);((y=o.document.activeElement)==null?void 0:y.tagName)==="IFRAME"&&!(A!=null&&A.contains(o.document.activeElement))&&n(v)})].filter(Boolean);return()=>h.forEach(v=>v())}function useSupported(r,n=!1){const i=vue.ref(),o=()=>i.value=!!r();return o(),tryOnMounted(o,n),i}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=(r,n)=>{var i={};for(var o in r)__hasOwnProp$g.call(r,o)&&n.indexOf(o)<0&&(i[o]=r[o]);if(r!=null&&__getOwnPropSymbols$g)for(var o of __getOwnPropSymbols$g(r))n.indexOf(o)<0&&__propIsEnum$g.call(r,o)&&(i[o]=r[o]);return i};function useResizeObserver(r,n,i={}){const o=i,{window:a=defaultWindow}=o,u=__objRest$2(o,["window"]);let c;const f=useSupported(()=>a&&"ResizeObserver"in a),d=()=>{c&&(c.disconnect(),c=void 0)},p=vue.watch(()=>unrefElement(r),g=>{d(),f.value&&a&&g&&(c=new ResizeObserver(n),c.observe(g,u))},{immediate:!0,flush:"post"}),h=()=>{d(),p()};return tryOnScopeDispose(h),{isSupported:f,stop:h}}var SwipeDirection;(function(r){r.UP="UP",r.RIGHT="RIGHT",r.DOWN="DOWN",r.LEFT="LEFT",r.NONE="NONE"})(SwipeDirection||(SwipeDirection={}));var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(r,n,i)=>n in r?__defProp(r,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[n]=i,__spreadValues=(r,n)=>{for(var i in n||(n={}))__hasOwnProp.call(n,i)&&__defNormalProp(r,i,n[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(n))__propIsEnum.call(n,i)&&__defNormalProp(r,i,n[i]);return r};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);process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const NOOP=()=>{},hasOwnProperty=Object.prototype.hasOwnProperty,hasOwn=(r,n)=>hasOwnProperty.call(r,n),isArray=Array.isArray,isFunction=r=>typeof r=="function",isString=r=>typeof r=="string",isObject=r=>r!==null&&typeof r=="object",objectToString=Object.prototype.toString,toTypeString=r=>objectToString.call(r),toRawType=r=>toTypeString(r).slice(8,-1),isUndefined=r=>r===void 0,isBoolean=r=>typeof r=="boolean",isNumber=r=>typeof r=="number",isElement=r=>typeof Element>"u"?!1:r instanceof Element,isStringNumber=r=>isString(r)?!Number.isNaN(Number(r)):!1,escapeStringRegexp=(r="")=>r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d"),getProp=(r,n,i)=>({get value(){return lodashEs.get(r,n,i)},set value(o){lodashEs.set(r,n,o)}});class ElementPlusError extends Error{constructor(n){super(n),this.name="ElementPlusError"}}function throwError(r,n){throw new ElementPlusError(`[${r}] ${n}`)}function debugWarn(r,n){if(process.env.NODE_ENV!=="production"){const i=isString(r)?new ElementPlusError(`[${r}] ${n}`):r;console.warn(i)}}const SCOPE$1="utils/dom/style";function addUnit(r,n="px"){if(!r)return"";if(isNumber(r)||isStringNumber(r))return`${r}${n}`;if(isString(r))return r;debugWarn(SCOPE$1,"binding value must be a string or number")}function scrollIntoView(r,n){if(!isClient)return;if(!n){r.scrollTop=0;return}const i=[];let o=n.offsetParent;for(;o!==null&&r!==o&&r.contains(o);)i.push(o),o=o.offsetParent;const a=n.offsetTop+i.reduce((d,p)=>d+p.offsetTop,0),u=a+n.offsetHeight,c=r.scrollTop,f=c+r.clientHeight;a<c?r.scrollTop=a:u>f&&(r.scrollTop=u-r.clientHeight)}const epPropKey="__epPropKey",definePropType=r=>r,isEpProp=r=>isObject(r)&&!!r[epPropKey],buildProp=(r,n)=>{if(!isObject(r)||isEpProp(r))return r;const{values:i,required:o,default:a,type:u,validator:c}=r,d={type:u,required:!!o,validator:i||c?p=>{let h=!1,g=[];if(i&&(g=Array.from(i),hasOwn(r,"default")&&g.push(a),h||(h=g.includes(p))),c&&(h||(h=c(p))),!h&&g.length>0){const v=[...new Set(g)].map(y=>JSON.stringify(y)).join(", ");vue.warn(`Invalid prop: validation failed${n?` for prop "${n}"`:""}. Expected one of [${v}], got value ${JSON.stringify(p)}.`)}return h}:void 0,[epPropKey]:!0};return hasOwn(r,"default")&&(d.default=a),d},buildProps=r=>lodashEs.fromPairs(Object.entries(r).map(([n,i])=>[n,buildProp(i,n)])),iconPropType=definePropType([String,Object,Function]),ValidateComponentsMap={validating:loading_default,success:circle_check_default,error:circle_close_default},withInstall=(r,n)=>{if(r.install=i=>{for(const o of[r,...Object.values(n??{})])i.component(o.name,o)},n)for(const[i,o]of Object.entries(n))r[i]=o;return r},withNoopInstall=r=>(r.install=NOOP,r),EVENT_CODE={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace",numpadEnter:"NumpadEnter",pageUp:"PageUp",pageDown:"PageDown",home:"Home",end:"End"},UPDATE_MODEL_EVENT="update:modelValue",CHANGE_EVENT="change",componentSizes=["","default","small","large"],componentSizeMap={large:40,default:32,small:24},getComponentSize=r=>componentSizeMap[r||"default"],isValidComponentSize=r=>["",...componentSizes].includes(r),isKorean=r=>/([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(r),mutable=r=>r,DEFAULT_EXCLUDE_KEYS=["class","style"],LISTENER_PREFIX=/^on[A-Z]/,useAttrs=(r={})=>{const{excludeListeners:n=!1,excludeKeys:i}=r,o=vue.computed(()=>((i==null?void 0:i.value)||[]).concat(DEFAULT_EXCLUDE_KEYS)),a=vue.getCurrentInstance();return a?vue.computed(()=>{var u;return lodashEs.fromPairs(Object.entries((u=a.proxy)==null?void 0:u.$attrs).filter(([c])=>!o.value.includes(c)&&!(n&&LISTENER_PREFIX.test(c))))}):(debugWarn("use-attrs","getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function"),vue.computed(()=>({})))},useDeprecated=({from:r,replacement:n,scope:i,version:o,ref:a,type:u="API"},c)=>{vue.watch(()=>vue.unref(c),f=>{f&&debugWarn(i,`[${u}] ${r} is about to be deprecated in version ${o}, please use ${n} instead.
|
251
|
+
`||p==="")){var h=c.isSelected(p);o.hasOwnProperty(p)?o[p]=o[p]&&h:o[p]=h}})}),r==="allSelect"||r==="inverseSelect"?{selected:o}:{name:n.name,selected:o}}function installLegendAction(r){r.registerAction("legendToggleSelect","legendselectchanged",curry$1(legendSelectActionHandler,"toggleSelected")),r.registerAction("legendAllSelect","legendselectall",curry$1(legendSelectActionHandler,"allSelect")),r.registerAction("legendInverseSelect","legendinverseselect",curry$1(legendSelectActionHandler,"inverseSelect")),r.registerAction("legendSelect","legendselected",curry$1(legendSelectActionHandler,"select")),r.registerAction("legendUnSelect","legendunselected",curry$1(legendSelectActionHandler,"unSelect"))}function install$2(r){r.registerComponentModel(LegendModel$1),r.registerComponentView(LegendView$1),r.registerProcessor(r.PRIORITY.PROCESSOR.SERIES_FILTER,legendFilter),r.registerSubTypeDefaulter("legend",function(){return"plain"}),installLegendAction(r)}var ScrollableLegendModel=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i}return n.prototype.setScrollDataIndex=function(i){this.option.scrollDataIndex=i},n.prototype.init=function(i,o,a){var u=getLayoutParams(i);r.prototype.init.call(this,i,o,a),mergeAndNormalizeLayoutParams(this,i,u)},n.prototype.mergeOption=function(i,o){r.prototype.mergeOption.call(this,i,o),mergeAndNormalizeLayoutParams(this,this.option,i)},n.type="legend.scroll",n.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}),n}(LegendModel$1);function mergeAndNormalizeLayoutParams(r,n,i){var o=r.getOrient(),a=[1,1];a[o.index]=0,mergeLayoutParam(n,i,{type:"box",ignoreSize:!!a})}const ScrollableLegendModel$1=ScrollableLegendModel;var Group=Group$3,WH=["width","height"],XY=["x","y"],ScrollableLegendView=function(r){__extends(n,r);function n(){var i=r!==null&&r.apply(this,arguments)||this;return i.type=n.type,i.newlineDisabled=!0,i._currentIndex=0,i}return n.prototype.init=function(){r.prototype.init.call(this),this.group.add(this._containerGroup=new Group),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new Group)},n.prototype.resetInner=function(){r.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},n.prototype.renderInner=function(i,o,a,u,c,f,d){var p=this;r.prototype.renderInner.call(this,i,o,a,u,c,f,d);var h=this._controllerGroup,g=o.get("pageIconSize",!0),v=isArray$1(g)?g:[g,g];A("pagePrev",0);var y=o.getModel("pageTextStyle");h.add(new ZRText$1({name:"pageText",style:{text:"xx/xx",fill:y.getTextColor(),font:y.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),A("pageNext",1);function A(_,S){var b=_+"DataIndex",T=createIcon(o.get("pageIcons",!0)[o.getOrient().name][S],{onclick:bind$1(p._pageGo,p,b,o,u)},{x:-v[0]/2,y:-v[1]/2,width:v[0],height:v[1]});T.name=_,h.add(T)}},n.prototype.layoutInner=function(i,o,a,u,c,f){var d=this.getSelectorGroup(),p=i.getOrient().index,h=WH[p],g=XY[p],v=WH[1-p],y=XY[1-p];c&&box("horizontal",d,i.get("selectorItemGap",!0));var A=i.get("selectorButtonGap",!0),_=d.getBoundingRect(),S=[-_.x,-_.y],b=clone$2(a);c&&(b[h]=a[h]-_[h]-A);var T=this._layoutContentAndController(i,u,b,p,h,v,y,g);if(c){if(f==="end")S[p]+=T[h]+A;else{var w=_[h]+A;S[p]-=w,T[g]-=w}T[h]+=_[h]+A,S[1-p]+=T[y]+T[v]/2-_[v]/2,T[v]=Math.max(T[v],_[v]),T[y]=Math.min(T[y],_[y]+S[1-p]),d.x=S[0],d.y=S[1],d.markRedraw()}return T},n.prototype._layoutContentAndController=function(i,o,a,u,c,f,d,p){var h=this.getContentGroup(),g=this._containerGroup,v=this._controllerGroup;box(i.get("orient"),h,i.get("itemGap"),u?a.width:null,u?null:a.height),box("horizontal",v,i.get("pageButtonItemGap",!0));var y=h.getBoundingRect(),A=v.getBoundingRect(),_=this._showController=y[c]>a[c],S=[-y.x,-y.y];o||(S[u]=h[p]);var b=[0,0],T=[-A.x,-A.y],w=retrieve2(i.get("pageButtonGap",!0),i.get("itemGap",!0));if(_){var x=i.get("pageButtonPosition",!0);x==="end"?T[u]+=a[c]-A[c]:b[u]+=A[c]+w}T[1-u]+=y[f]/2-A[f]/2,h.setPosition(S),g.setPosition(b),v.setPosition(T);var k={x:0,y:0};if(k[c]=_?a[c]:y[c],k[f]=Math.max(y[f],A[f]),k[d]=Math.min(0,A[d]+T[1-u]),g.__rectSize=a[c],_){var M={x:0,y:0};M[c]=Math.max(a[c]-A[c]-w,0),M[f]=k[f],g.setClipPath(new Rect$1({shape:M})),g.__rectSize=M[c]}else v.eachChild(function(z){z.attr({invisible:!0,silent:!0})});var D=this._getPageInfo(i);return D.pageIndex!=null&&updateProps$1(h,{x:D.contentPosition[0],y:D.contentPosition[1]},_?i:null),this._updatePageInfoView(i,D),k},n.prototype._pageGo=function(i,o,a){var u=this._getPageInfo(o)[i];u!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:u,legendId:o.id})},n.prototype._updatePageInfoView=function(i,o){var a=this._controllerGroup;each$4(["pagePrev","pageNext"],function(h){var g=h+"DataIndex",v=o[g]!=null,y=a.childOfName(h);y&&(y.setStyle("fill",v?i.get("pageIconColor",!0):i.get("pageIconInactiveColor",!0)),y.cursor=v?"pointer":"default")});var u=a.childOfName("pageText"),c=i.get("pageFormatter"),f=o.pageIndex,d=f!=null?f+1:0,p=o.pageCount;u&&c&&u.setStyle("text",isString$2(c)?c.replace("{current}",d==null?"":d+"").replace("{total}",p==null?"":p+""):c({current:d,total:p}))},n.prototype._getPageInfo=function(i){var o=i.get("scrollDataIndex",!0),a=this.getContentGroup(),u=this._containerGroup.__rectSize,c=i.getOrient().index,f=WH[c],d=XY[c],p=this._findTargetItemIndex(o),h=a.children(),g=h[p],v=h.length,y=v?1:0,A={contentPosition:[a.x,a.y],pageCount:y,pageIndex:y-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!g)return A;var _=x(g);A.contentPosition[c]=-_.s;for(var S=p+1,b=_,T=_,w=null;S<=v;++S)w=x(h[S]),(!w&&T.e>b.s+u||w&&!k(w,b.s))&&(T.i>b.i?b=T:b=w,b&&(A.pageNextDataIndex==null&&(A.pageNextDataIndex=b.i),++A.pageCount)),T=w;for(var S=p-1,b=_,T=_,w=null;S>=-1;--S)w=x(h[S]),(!w||!k(T,w.s))&&b.i<T.i&&(T=b,A.pagePrevDataIndex==null&&(A.pagePrevDataIndex=b.i),++A.pageCount,++A.pageIndex),b=w;return A;function x(M){if(M){var D=M.getBoundingRect(),z=D[d]+M[d];return{s:z,e:z+D[f],i:M.__legendDataIndex}}}function k(M,D){return M.e>=D&&M.s<=D+u}},n.prototype._findTargetItemIndex=function(i){if(!this._showController)return 0;var o,a=this.getContentGroup(),u;return a.eachChild(function(c,f){var d=c.__legendDataIndex;u==null&&d!=null&&(u=f),d===i&&(o=f)}),o??u},n.type="legend.scroll",n}(LegendView$1);const ScrollableLegendView$1=ScrollableLegendView;function installScrollableLegendAction(r){r.registerAction("legendScroll","legendscroll",function(n,i){var o=n.scrollDataIndex;o!=null&&i.eachComponent({mainType:"legend",subType:"scroll",query:n},function(a){a.setScrollDataIndex(o)})})}function install$1(r){use(install$2),r.registerComponentModel(ScrollableLegendModel$1),r.registerComponentView(ScrollableLegendView$1),installScrollableLegendAction(r)}function install(r){use(install$2),use(install$1)}const _sfc_main$G=vue.defineComponent({__name:"pie-charts",props:{title:{type:String,default:"标题"},seriesName:{type:String,default:"详情"},seriesData:{type:Array,default:()=>[]}},setup(r){const n=r;use([install$7,install$6,install$3,install$4,install]),vue.provide(VChart.THEME_KEY,"dark");const i=vue.reactive({title:{text:n.title,left:"center"},tooltip:{trigger:"item",formatter:"{a} <br/>{b} : {c} ({d}%)"},legend:{orient:"vertical",left:"left"},series:[{name:n.seriesName,type:"pie",radius:"55%",center:["50%","60%"],data:n.seriesData,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]});return vue.watch(n,o=>{i.title.text=o.title,i.series[0].name=o.seriesName,i.series[0].data=o.seriesData}),(o,a)=>(vue.openBlock(),vue.createBlock(vue.unref(VChart),{class:"chart",option:vue.unref(i),autoresize:""},null,8,["option"]))}}),pieCharts_vue_vue_type_style_index_0_scoped_fec2cbf2_lang="",PieCharts=_export_sfc$1(_sfc_main$G,[["__scopeId","data-v-fec2cbf2"]]),_hoisted_1$k=["id"],_hoisted_2$h=["id"],_hoisted_3$e=["fill"],_hoisted_4$a=["fill"],_hoisted_5$8=["fill"],_hoisted_6$6=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$6=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$6=["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$4=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"],_sfc_main$F=vue.defineComponent({__name:"light-a",props:{id:{default:""},isOpen:{type:Boolean,default:!1}},emits:["onChange"],setup(r,{emit:n}){const i=r;return vue.watch(()=>i.isOpen,()=>{n("onChange")}),(o,a)=>(vue.openBlock(),vue.createElementBlock("g",{id:i.id,style:{cursor:"pointer"}},[vue.createElementVNode("symbol",{id:`${i.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:i.isOpen?"#FDB813":"#cccccc"},null,8,_hoisted_3$e),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:i.isOpen?"#FD9B13":"#bbbbbb"},null,8,_hoisted_4$a),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:i.isOpen?"#F12A3F":"#666666"},null,8,_hoisted_5$8),_hoisted_6$6,_hoisted_7$6,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":i.isOpen?1:0},null,8,_hoisted_8$6),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":i.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":i.isOpen?1:0},null,8,_hoisted_10$5),_hoisted_11$4,_hoisted_12$4,_hoisted_13$3],8,_hoisted_2$h),vue.createElementVNode("use",{"xlink:href":`#${i.id}light-121`,width:"100",height:"100"},null,8,_hoisted_14$3)],8,_hoisted_1$k))}}),_hoisted_1$j=["id"],_hoisted_2$g=["id"],_hoisted_3$d=["fill"],_hoisted_4$9=["fill"],_hoisted_5$7=["fill"],_hoisted_6$5=["from","to"],_hoisted_7$5=["fill"],_hoisted_8$5=["from","to"],_hoisted_9$5=["fill"],_hoisted_10$4=["fill"],_hoisted_11$3=["fill"],_hoisted_12$3=["from","to"],_hoisted_13$2=["fill"],_hoisted_14$2=["xlink:href"],_sfc_main$E=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(r){const n=r,i=new Date(Number(window.sessionStorage.getItem("editorLoadTime")||"0")),o=i.getSeconds()+1,a=i.getMinutes(),u=Math.floor((i.getHours()+(a+o/60)/60)*30);return(c,f)=>(vue.openBlock(),vue.createElementBlock("g",{id:n.id},[vue.createElementVNode("symbol",{id:`${n.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:n.borderColor},null,8,_hoisted_3$d),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:n.backgroundColor},null,8,_hoisted_4$9),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:n.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$5)],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:n.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$5)],8,_hoisted_7$5),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:n.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:n.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:n.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$3)],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:n.centerColor},null,8,_hoisted_13$2)],8,_hoisted_2$g),vue.createElementVNode("use",{"xlink:href":`#${n.id}clock-a-n`,width:"100",height:"100"},null,8,_hoisted_14$2)],8,_hoisted_1$j))}}),vueComp={"svg-text":_sfc_main$J,"el-button":elementPlus.ElButton,"progress-a":_sfc_main$L,"el-tag":elementPlus.ElTag,"common-table":_sfc_main$I,"pie-charts":PieCharts,"switch-r":_sfc_main$K,"now-time":NowTime,"light-a":_sfc_main$F,"clock-a":_sfc_main$E},config=[...svg_config,...vue_config],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(r){this.intention=EGlobalStoreIntention.Create,this.create_svg_info=r},setDoneJson(r){isOfType(r,"id")?(this.done_json.push(r),vue.nextTick(()=>{setSvgActualInfo(r)})):this.done_json=objectDeepClone(r),vue.nextTick(()=>{useHistoryRecord(objectDeepClone(this.done_json))})},setHandleSvgInfo(r,n){let i=n;r?(!i&&i!=0&&(i=this.done_json.findIndex(o=>o.id===r.id)??-1),this.handle_svg_info={info:r,index:i}):this.handle_svg_info=r},spliceDoneJson(r){const n=useGlobalStore(),o=n.done_json.splice(r,1)[0];unbindAnchors(o.id),useHistoryRecord(n.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=r=>{r.stopPropagation()},preventDefault=r=>{r.preventDefault()};function componentsRegister(){var n,i;const r=vue.getCurrentInstance();for(let o in vueComp)!((n=r==null?void 0:r.appContext)!=null&&n.components.hasOwnProperty(o))&&vueComp.hasOwnProperty(o)&&((i=r==null?void 0:r.appContext)==null||i.app.component(o,vueComp[o]))}function setEditorLoadTime(){window.sessionStorage.setItem("editorLoadTime",new Date().getTime().toString())}const randomString=r=>{r=r||10;const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=n.length;let o="";for(let a=0;a<r;a++){let u=i;a===0&&(u=i-10),o+=n.charAt(Math.floor(Math.random()*u))}return o},isOfType=(r,n)=>r[n]!==void 0,getCoordinateOffset=(r,n)=>r/2*(n-1),angleToRadian=r=>r*Math.PI/180,calculateRotatedPointCoordinate=(r,n,i)=>({x:parseFloat(((r.x-n.x)*Math.cos(angleToRadian(i))-(r.y-n.y)*Math.sin(angleToRadian(i))+n.x).toFixed(1)),y:parseFloat(((r.x-n.x)*Math.sin(angleToRadian(i))+(r.y-n.y)*Math.cos(angleToRadian(i))+n.y).toFixed(1))}),getCenterPoint=(r,n)=>({x:r.x+(n.x-r.x)/2,y:r.y+(n.y-r.y)/2}),positionArrToPath=r=>{let n="";for(let i=0;i<r.length;i++)i===0?n+=`M ${r[i].x} ${r[i].y}`:n+=` L ${r[i].x} ${r[i].y}`;return n},getSvgNowPosition=(r,n,i)=>i+(n-r),objectDeepClone=(r,n={})=>r?JSON.parse(JSON.stringify(r)):n,setSvgActualInfo=(r,n)=>{var a,u;const i=document.querySelector(`#${r.id}`),o=document.querySelector(`#rect${r.id}`);if(i){let c=0,f=0,d=0,p=0;if(r.type===EDoneJsonType.Vue){d=((a=r.props.width)==null?void 0:a.val)||i.offsetWidth||100,p=((u=r.props.height)==null?void 0:u.val)||i.offsetHeight||100,c=50-d/2,f=50-p/2;const h=document.querySelector(`#foreign-object${r.id}`);h&&(h.getAttribute("x")==="0"&&h.getAttribute("y")==="0"&&h.getAttribute("width")==="0"&&h.getAttribute("height")==="0"||n)&&(h.setAttribute("x",c.toString()),h.setAttribute("y",f.toString()),h.setAttribute("width",d.toString()),h.setAttribute("height",p.toString()))}else{const h=i.getBBox();c=parseFloat(h.x.toFixed(0)),f=parseFloat(h.y.toFixed(0)),d=parseFloat(h.width.toFixed(0)),p=parseFloat(h.height.toFixed(0))}o&&(o.getAttribute("x")==="0"&&o.getAttribute("y")==="0"&&o.getAttribute("width")==="0"&&o.getAttribute("height")==="0"||n)&&(o.setAttribute("x",c.toString()),o.setAttribute("y",f.toString()),o.setAttribute("width",d.toString()),o.setAttribute("height",p.toString())),(r.actual_bound.x===0&&r.actual_bound.y===0&&r.actual_bound.width===0&&r.actual_bound.height===0||n)&&(r.actual_bound={x:c,y:f,width:d,height:p}),r.center_position={x:r.x+r.actual_bound.x+d/2,y:r.y+r.actual_bound.y+p/2},r.point_coordinate.tl={x:r.center_position.x-d*r.scale_x/2,y:r.center_position.y-p*r.scale_y/2},r.point_coordinate.tc={x:r.center_position.x,y:r.center_position.y-p*r.scale_y/2},r.point_coordinate.tr={x:r.center_position.x+d*r.scale_x/2,y:r.center_position.y-p*r.scale_y/2},r.point_coordinate.l={x:r.center_position.x-d*r.scale_x/2,y:r.center_position.y},r.point_coordinate.r={x:r.center_position.x+d*r.scale_x/2,y:r.center_position.y},r.point_coordinate.bl={x:r.center_position.x-d*r.scale_x/2,y:r.center_position.y+p*r.scale_y/2},r.point_coordinate.bc={x:r.center_position.x,y:r.center_position.y+p*r.scale_y/2},r.point_coordinate.br={x:r.center_position.x+d*r.scale_x/2,y:r.center_position.y+p*r.scale_y/2},r.rotate!==0&&setAfterRotationPointCoordinate(r),moveAnchors(r)}},resetHandlePointOld=r=>{for(const n of Object.keys(r.point_coordinate))r.point_coordinate_old&&(r.point_coordinate_old[n].x=0,r.point_coordinate_old[n].y=0)},moveHandlePoint=(r,n,i)=>{const o=useGlobalStore(pinia),a=n??o.mouse_info.new_position_x-o.mouse_info.position_x,u=i??o.mouse_info.new_position_y-o.mouse_info.position_y;for(const c of Object.keys(r.point_coordinate))n!==void 0&&i!==void 0?(r.point_coordinate[c].x+=a,r.point_coordinate[c].y+=u):r.point_coordinate_old&&(r.point_coordinate[c].x=r.point_coordinate_old[c].x+a,r.point_coordinate[c].y=r.point_coordinate_old[c].y+u)},moveAnchors=r=>{var i,o,a,u;const n=useGlobalStore(pinia);for(let c of n.done_json)if(c.type===EDoneJsonType.ConnectionLine){if(((o=(i=c.bind_anchors)==null?void 0:i.start)==null?void 0:o.target_id)===r.id){const f=getAnchorPosByAnchorType(c.bind_anchors.start.type,r);c.props.point_position.val[0]={x:f.x-c.x,y:f.y-c.y}}if(((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===r.id){const f=getAnchorPosByAnchorType(c.bind_anchors.end.type,r);c.props.point_position.val[c.props.point_position.val.length-1]={x:f.x-c.x,y:f.y-c.y}}}},unbindAnchors=r=>{var i,o,a,u;const n=useGlobalStore(pinia);for(let c of n.done_json)c.type===EDoneJsonType.ConnectionLine&&(((o=(i=c.bind_anchors)==null?void 0:i.start)==null?void 0:o.target_id)===r&&(c.bind_anchors.start=null),((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===r&&(c.bind_anchors.end=null))},getAnchorPosByAnchorType=(r,n)=>r===ELineBindAnchors.BottomCenter?n.point_coordinate.bc:r===ELineBindAnchors.Left?n.point_coordinate.l:r===ELineBindAnchors.Right?n.point_coordinate.r:n.point_coordinate.tc,setAfterRotationPointCoordinate=r=>{r.point_coordinate={tl:calculateRotatedPointCoordinate(r.point_coordinate.tl,r.center_position,r.rotate),tc:calculateRotatedPointCoordinate(r.point_coordinate.tc,r.center_position,r.rotate),tr:calculateRotatedPointCoordinate(r.point_coordinate.tr,r.center_position,r.rotate),l:calculateRotatedPointCoordinate(r.point_coordinate.l,r.center_position,r.rotate),r:calculateRotatedPointCoordinate(r.point_coordinate.r,r.center_position,r.rotate),bl:calculateRotatedPointCoordinate(r.point_coordinate.bl,r.center_position,r.rotate),bc:calculateRotatedPointCoordinate(r.point_coordinate.bc,r.center_position,r.rotate),br:calculateRotatedPointCoordinate(r.point_coordinate.br,r.center_position,r.rotate)}},prosToVBind=(r,n=[])=>{let i={};if(r.state){for(const o in r.state)if(r.state.hasOwnProperty(o)&&o===r.defaultState){for(let a in r.state[o])a!=="label"&&(i[lodashEs.kebabCase(a)]=r.state[o][a]);break}}for(const o in r.props)n.indexOf(o)<0&&(i[lodashEs.kebabCase(o)]=r.props[o].val);return i},setArrItemByID=(id,key,val,json_arr)=>new Promise(res=>{const find_item=json_arr.find(r=>r.id===id);find_item||res({status:!1,msg:"要设置的id不存在"}),eval(`find_item.${key} = val;`),res({status:!0,msg:"操作成功"})}),getCommonClass=r=>!r.common_animations||!r.common_animations.val?"":`common-ani animate__animated animate__${r.common_animations.val} animate__${r.common_animations.speed} animate__${r.common_animations.repeat} animate__${r.common_animations.delay}`,numberArray=r=>{let n=[];for(let i=0;i<r;i++)n.push(i);return n},getStringWidth=(r,n=12)=>{if(r.length>0){let i=document.createElement("span");i.style.fontSize=n+"px",i.style.fontFamily="inherit",i.innerHTML=r,i.style.opacity="0",i.style.position="fixed",i.style.top="3000px",document.body.append(i);const o=i.clientWidth;return document.body.removeChild(i),o}return 0},valFormat=r=>/false|true/.test(r)?r!=="false":/^\d+(\.\d+)?$/.test(r)?Number(r):r,createLine=(r,n,i)=>{r.preventDefault();const o=useGlobalStore(pinia),a=useConfigStore(pinia),u=useSvgEditLayoutStore(pinia),{clientX:c,clientY:f}=r;let d=objectDeepClone(a.connection_line),p=0,h=0;if(n&&i){d.bind_anchors.start={type:n,target_id:i.id};let v=getAnchorPosByAnchorType(n,i);p=v.x,h=v.y}else p=Math.round((c-u.canvasInfo.left)/a.svg.scale-u.center_offset.x),h=Math.round((f-u.canvasInfo.top)/a.svg.scale-u.center_offset.y);const g={id:randomString(),x:p,y:h,client:{x:p,y:h},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}},...d};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:p,position_y:h,now_position_x:p,now_position_y:h,new_position_x:0,new_position_y:0}};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:"#0a7ae2"},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 r=JSON.parse(l);t=r.connection_line,s=r.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=(r=>(r.Copy="Copy",r.Delete="Delete",r.MoveUpOneLevel="MoveUpOneLevel",r.MoveDownOneLevel="MoveDownOneLevel",r.MoveUpTopLevel="MoveUpTopLevel",r.MoveDownTopLevel="MoveDownTopLevel",r))(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(r){return r.history_now_index>=1},getTopBtnRedoStatus(r){return r.history_now_index+1!=r.history_doneComponent.length}},actions:{topUndoBtnClick(){if(console.log("撤销"),this.history_now_index<1)return;const r=useGlobalStore();this.is_record_history=!1,this.history_now_index-=1,r.setDoneJson(this.history_doneComponent[this.history_now_index])},topRedoBtnClick(){if(console.log("重做"),this.history_now_index+1==this.history_doneComponent.length)return;const r=useGlobalStore();this.is_record_history=!1,this.history_now_index+=1,r.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(r){const n=useGlobalStore();if(n.handle_svg_info)switch(n.intention=EGlobalStoreIntention.Select,r){case EContextMenuInfoType.Copy:const i=objectDeepClone(n.handle_svg_info.info);i.id=randomString(),i.title+="-copy",i.x+=10,i.y+=10,n.setDoneJson(i),this.display=!1,n.setHandleSvgInfo(i,n.done_json.length);break;case EContextMenuInfoType.Delete:n.spliceDoneJson(n.handle_svg_info.index),this.display=!1,n.setHandleSvgInfo(null),n.intention=EGlobalStoreIntention.None;break;case EContextMenuInfoType.MoveUpOneLevel:if(n.done_json.length===1||n.handle_svg_info.index===n.done_json.length-1)return;const o=n.handle_svg_info.info;n.done_json[n.handle_svg_info.index]=n.done_json[n.handle_svg_info.index+1],n.done_json[n.handle_svg_info.index+1]=o,useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(o,n.handle_svg_info.index+1);break;case EContextMenuInfoType.MoveDownOneLevel:if(n.done_json.length===1||n.handle_svg_info.index===0)return;const a=n.handle_svg_info.info;n.done_json[n.handle_svg_info.index]=n.done_json[n.handle_svg_info.index-1],n.done_json[n.handle_svg_info.index-1]=a,useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(a,n.handle_svg_info.index-1);break;case EContextMenuInfoType.MoveDownTopLevel:if(n.done_json.length===1||n.handle_svg_info.index===0)return;const u=n.handle_svg_info.info;n.done_json.splice(n.handle_svg_info.index,1),n.done_json.unshift(u),useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(u,0);break;case EContextMenuInfoType.MoveUpTopLevel:if(n.done_json.length===1||n.handle_svg_info.index===n.done_json.length)return;const c=n.handle_svg_info.info;n.done_json.splice(n.handle_svg_info.index,1),n.done_json.push(c),useHistoryRecord(n.done_json),this.display=!1,n.setHandleSvgInfo(c,n.done_json.length-1);break}}}}),pinia=pinia$1.createPinia(),useHistoryRecord=r=>{const n=useEditPrivateStore();n.is_record_history&&(n.history_now_index+1<n.history_doneComponent.length&&n.history_doneComponent.splice(n.history_now_index+1),n.history_doneComponent.push(r),n.history_now_index=n.history_doneComponent.length-1,n.history_doneComponent.length>n.max_record_times&&(n.history_doneComponent.shift(),n.history_now_index=n.history_doneComponent.length-1)),n.is_record_history=!0},useImportDataModel=r=>{try{const n=JSON.parse(r);if(!n.config||!n.layout_center||!n.done_json)return elementPlus.ElMessage.error("请导入正确的数据模型!"),!1;const i=useGlobalStore(pinia),o=useSvgEditLayoutStore(pinia),a=useConfigStore(pinia);return a.$state=n.config,o.center_offset=n.layout_center,i.setDoneJson(n.done_json),!0}catch(n){return elementPlus.ElMessage.error("请导入正确的数据模型!"),console.error(n),!1}},_hoisted_1$i={"aria-hidden":"true"},_hoisted_2$f=["xlink:href"],_sfc_main$D=vue.defineComponent({__name:"svg-analysis",props:{name:{},props:{default:()=>({})}},setup(r){const n=r,i=vue.computed(()=>`#svg-${n.name}`);return(o,a)=>(vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$i,[vue.createElementVNode("use",vue.mergeProps({"xlink:href":vue.unref(i)},n.props),null,16,_hoisted_2$f)]))}});var EVisibleConfKey=(r=>(r.ImportJson="ImportJson",r.ExportJson="ExportJson",r.ImportFile="ImportFile",r))(EVisibleConfKey||{});const _withScopeId$2=r=>(vue.pushScopeId("data-v-62907637"),r=r(),vue.popScopeId(),r),_hoisted_1$h={class:"flex justify-between",style:{width:"100%"}},_hoisted_2$e={class:"flex items-center justify-between",style:{width:"250px"}},_hoisted_3$c=_withScopeId$2(()=>vue.createElementVNode("div",{class:"flex items-center"},[vue.createElementVNode("span",{class:"logo-title"},"Svg Editor")],-1)),_hoisted_4$8={class:"flex justify-between",style:{width:"calc(100% - 440px)"}},_hoisted_5$6={class:"flex items-center"},_hoisted_6$4={class:"flex items-center mr-20px"},_hoisted_7$4={class:"flex items-center",style:{width:"250px"}},_hoisted_8$4=_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$2=_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$2=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_17=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"标尺辅助线",-1)),_hoisted_18=_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$1=_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$1=_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$1=_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$1=_withScopeId$2(()=>vue.createElementVNode("div",{style:{"padding-bottom":"14px"}}," 选中线段,在右侧‘数据’栏里解除绑定;或者鼠标左键拖拽连线上需要解绑的节点",-1)),_sfc_main$C=vue.defineComponent({__name:"top-panel",emits:["changeVisible","onReturn","onPreview","onSave"],setup(r,{emit:n}){const i=useSvgEditLayoutStore(pinia),o=useGlobalStore(pinia),a=useEditPrivateStore(pinia),u=useConfigStore(pinia),c=()=>{o.done_json.length<=0||o.setDoneJson([]),o.intention=EGlobalStoreIntention.None},f=h=>{const g={layout_center:i.center_offset,config:u.$state,done_json:o.done_json};n(h,g)},d=vue.ref(!1),p=vue.computed({get:()=>o.intention===EGlobalStoreIntention.Connection,set(h){o.intention=h?EGlobalStoreIntention.Connection:EGlobalStoreIntention.None,h&&o.setHandleSvgInfo(null)}});return(h,g)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$h,[vue.createElementVNode("div",_hoisted_2$e,[_hoisted_3$c,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:g[0]||(g[0]=v=>vue.unref(i).left_nav=!vue.unref(i).left_nav),title:vue.unref(i).left_nav?"隐藏左侧菜单":"显示左侧菜单"},{default:vue.withCtx(()=>[vue.unref(i).left_nav?(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:0,name:"menu-unfold"})):(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:1,name:"menu-fold"}))]),_:1},8,["title"])]),vue.createElementVNode("div",_hoisted_4$8,[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:g[1]||(g[1]=()=>vue.unref(a).topUndoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{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:g[2]||(g[2]=()=>vue.unref(a).topRedoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{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:c},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{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:g[3]||(g[3]=v=>n("changeVisible",vue.unref(EVisibleConfKey).ImportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"import"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"导出数据模型",size:24,class:"bt-Icon ml-5px",onClick:g[4]||(g[4]=v=>n("changeVisible",vue.unref(EVisibleConfKey).ExportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{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(p)}]),size:24,onClick:g[5]||(g[5]=v=>p.value=!vue.unref(p))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:vue.unref(p)?"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:g[6]||(g[6]=v=>d.value=!vue.unref(d))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"question"})]),_:1})]),vue.createElementVNode("div",_hoisted_6$4,[vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"返回",class:"bt-Icon",size:24,onClick:g[7]||(g[7]=v=>f("onReturn"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"return"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"保存",class:"bt-Icon",size:24,onClick:g[8]||(g[8]=v=>f("onSave"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"save"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"预览",class:"bt-Icon",size:22,onClick:g[9]||(g[9]=v=>f("onPreview"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"preview"})]),_:1})])]),vue.createElementVNode("div",_hoisted_7$4,[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:g[10]||(g[10]=v=>vue.unref(i).right_nav=!vue.unref(i).right_nav),title:vue.unref(i).right_nav?"隐藏右侧菜单":"显示右侧菜单"},{default:vue.withCtx(()=>[vue.unref(i).right_nav?(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:0,name:"menu-fold"})):(vue.openBlock(),vue.createBlock(_sfc_main$D,{key:1,name:"menu-unfold"}))]),_:1},8,["title"])])]),vue.createVNode(vue.unref(elementPlus.ElDialog),{modelValue:vue.unref(d),"onUpdate:modelValue":g[11]||(g[11]=v=>vue.isRef(d)?d.value=v:null),title:"使用说明",width:"60%",class:"guide-dialog"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{"max-height":"60vh"},{default:vue.withCtx(()=>[_hoisted_8$4,_hoisted_9$4,_hoisted_10$3,_hoisted_11$2,_hoisted_12$2,_hoisted_13$1,_hoisted_14$1,_hoisted_15$1,_hoisted_16$2,_hoisted_17,_hoisted_18,_hoisted_19,_hoisted_20,_hoisted_21,_hoisted_22$1,_hoisted_23,_hoisted_24,_hoisted_25,_hoisted_26$1,_hoisted_27,_hoisted_28,_hoisted_29,_hoisted_30,_hoisted_31,_hoisted_32$1,_hoisted_33,_hoisted_34,_hoisted_35,_hoisted_36$1]),_:1})]),_:1},8,["modelValue"])],64))}}),topPanel_vue_vue_type_style_index_0_scoped_62907637_lang="",topPanel_vue_vue_type_style_index_1_lang="",TopPanel=_export_sfc$1(_sfc_main$C,[["__scopeId","data-v-62907637"]]),_hoisted_1$g={class:"component-group flex flex-wrap"},_hoisted_2$d=["onDragstart","title"],_sfc_main$B=vue.defineComponent({__name:"left-panel",props:{customToolbar:{}},setup(r){const n=r,i=useGlobalStore(pinia),o=vue.ref(n.customToolbar&&Object.keys(n.customToolbar).length>0?n.customToolbar:i.config_center),a=vue.ref(["stateful","stateless","have_animation","custom_svg_group","element-ui","custom-vue","echarts"]),u=f=>{i.setCreateInfo(f)},c=f=>{var d;if(((d=f.dataTransfer)==null?void 0:d.dropEffect)!=="copy"){elementPlus.ElMessage.warning("请将组件拖到画布中!"),i.intention=EGlobalStoreIntention.None;return}};return(f,d)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElCollapse),{modelValue:vue.unref(a),"onUpdate:modelValue":d[0]||(d[0]=p=>vue.isRef(a)?a.value=p:null),style:{"border-top":"none"}},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(o),p=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElCollapseItem),{name:p.groupType,key:p.title},{title:vue.withCtx(()=>[vue.createElementVNode("div",null,vue.toDisplayString(p.title),1)]),default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$g,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(p.list,h=>(vue.openBlock(),vue.createElementBlock("div",{class:"ideal",key:h.name,draggable:"true",onDragstart:g=>u(h),onDragend:c,title:h.title},[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:35,class:"flex items-center"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:h.name,props:vue.unref(prosToVBind)(h,["width","height","maxHeight"])},null,8,["name","props"])]),_:2},1024)],40,_hoisted_2$d))),128))])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]))}}),leftPanel_vue_vue_type_style_index_0_scoped_d7403cfd_lang="",LeftPanel=_export_sfc$1(_sfc_main$B,[["__scopeId","data-v-d7403cfd"]]),calculateLeftTop=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate(n,o,-i);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightTop=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate(n,o,-i);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightBottom=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(n,o,-i),u=calculateRotatedPointCoordinate(r,o,-i);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateLeftBottom=(r,n,i)=>{const o=getCenterPoint(r,n),a=calculateRotatedPointCoordinate(n,o,-i),u=calculateRotatedPointCoordinate(r,o,-i);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateTop=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateRight=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},calculateBottom=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateLeft=(r,n,i,o)=>{const a=calculateRotatedPointCoordinate(r,o,-i),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,i),c=Math.sqrt((u.x-n.x)**2+(u.y-n.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},_hoisted_1$f={style:{"vector-effect":"non-scaling-stroke"}},_hoisted_2$c=["fill","x","y"],_hoisted_3$b=["cx","cy"],_hoisted_4$7=["x1","y1","x2","y2"],_hoisted_5$5=["fill","x","y"],_hoisted_6$3=["fill","x","y"],_hoisted_7$3=["fill","x","y"],_hoisted_8$3=["fill","x","y"],_hoisted_9$3=["fill","x","y"],_hoisted_10$2=["fill","x","y"],_hoisted_11$1=["fill","x","y"],_sfc_main$A=vue.defineComponent({__name:"handle-panel",props:{itemInfo:{}},setup(r){const n=r;vue.useCssVars(v=>({"5c831aea":vue.unref(c)}));const i=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=vue.ref(4),c=vue.ref("#ab712e"),f=[{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}],d=vue.computed(()=>n.itemInfo.config.can_zoom),p=(v,y)=>{console.log("handMousedown",y);const{clientX:A,clientY:_}=y;y.stopPropagation(),i.intention=EGlobalStoreIntention.Zoom;const S=Math.round((A-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),b=Math.round((_-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);i.mouse_info={state:EMouseInfoState.Down,position_x:S,position_y:b,now_position_x:S,now_position_y:b,new_position_x:0,new_position_y:0},i.scale_info={type:v,scale_times:{x:n.itemInfo.scale_x,y:n.itemInfo.scale_y},scale_item_info:{x:n.itemInfo.x,y:n.itemInfo.y},symmetric_point:{x:S+Math.abs(S-n.itemInfo.center_position.x)*2*(S>n.itemInfo.center_position.x?-1:1),y:b+Math.abs(b-n.itemInfo.center_position.y)*2*(b>n.itemInfo.center_position.y?-1:1)}}},h=v=>{const{clientX:y,clientY:A}=v,_=Math.round((y-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),S=Math.round((A-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);v.stopPropagation(),i.intention=EGlobalStoreIntention.Rotate,i.rotate_info={angle:n.itemInfo.rotate},i.mouse_info={state:EMouseInfoState.Down,position_x:_,position_y:S,now_position_x:_,now_position_y:S,new_position_x:0,new_position_y:0}},g=v=>{const y=(v+n.itemInfo.rotate)%360,A=f.find(_=>_.start<=y&&_.end>y);return A?{cursor:A.cursor+"-resize",type:A.type}:{cursor:"nw-resize",type:EScaleInfoType.TopLeft}};return(v,y)=>(vue.openBlock(),vue.createElementBlock("g",_hoisted_1$f,[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:n.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[0]||(y[0]=A=>p(vue.unref(EScaleInfoType).TopLeft,A))},null,44,_hoisted_2$c),[[vue.vShow,vue.unref(d)]]),vue.createElementVNode("circle",{cx:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,cy:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)-24,r:4,class:"rotate-circle",onMousedown:h},null,40,_hoisted_3$b),vue.createElementVNode("line",{x1:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,y1:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),x2:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2,y2:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)-20,style:vue.normalizeStyle({stroke:vue.unref(c),"stroke-width":2})},null,12,_hoisted_4$7),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:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2-vue.unref(u),y:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[1]||(y[1]=A=>p(vue.unref(EScaleInfoType).TopCenter,A))},null,44,_hoisted_5$5),[[vue.vShow,vue.unref(d)]]),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:n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width-vue.unref(u)+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[2]||(y[2]=A=>p(vue.unref(EScaleInfoType).TopRight,A))},null,44,_hoisted_6$3),[[vue.vShow,vue.unref(d)]]),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:n.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[3]||(y[3]=A=>p(vue.unref(EScaleInfoType).Left,A))},null,44,_hoisted_7$3),[[vue.vShow,vue.unref(d)]]),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:n.itemInfo.actual_bound.x-vue.unref(u)+n.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[4]||(y[4]=A=>p(vue.unref(EScaleInfoType).Right,A))},null,44,_hoisted_8$3),[[vue.vShow,vue.unref(d)]]),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:n.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height*n.itemInfo.scale_y-vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[5]||(y[5]=A=>p(vue.unref(EScaleInfoType).BottomLeft,A))},null,44,_hoisted_9$3),[[vue.vShow,vue.unref(d)]]),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:n.itemInfo.actual_bound.x-vue.unref(u)+n.itemInfo.actual_bound.width/2,y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[6]||(y[6]=A=>p(vue.unref(EScaleInfoType).BottomCenter,A))},null,44,_hoisted_10$2),[[vue.vShow,vue.unref(d)]]),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:n.itemInfo.actual_bound.x-vue.unref(u)+n.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.width,n.itemInfo.scale_x),y:n.itemInfo.actual_bound.y-vue.unref(u)+n.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(n.itemInfo.actual_bound.height,n.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:y[7]||(y[7]=A=>p(vue.unref(EScaleInfoType).BottomRight,A))},null,44,_hoisted_11$1),[[vue.vShow,vue.unref(d)]])]))}}),handlePanel_vue_vue_type_style_index_0_scoped_e6622df8_lang="",HandlePanel=_export_sfc$1(_sfc_main$A,[["__scopeId","data-v-e6622df8"]]),_hoisted_1$e=["fill"],_hoisted_2$b=["cx","cy","r"],_hoisted_3$a=["cx","cy","r"],_hoisted_4$6=["cx","cy","r"],_hoisted_5$4=["cx","cy","r"],_hoisted_6$2=["cx","cy","r"],_hoisted_7$2=["cx","cy","r"],_hoisted_8$2=["cx","cy","r"],_hoisted_9$2=["cx","cy","r"],_sfc_main$z=vue.defineComponent({__name:"connection-panel",props:{itemInfo:{}},setup(r){const n=r,i=vue.ref(4),o=vue.ref("#ab712e"),a=vue.ref(4),u=vue.ref(12),c=useGlobalStore(pinia),f=useSvgEditLayoutStore(pinia),d=vue.computed(()=>n.itemInfo.actual_bound.x+n.itemInfo.actual_bound.width/2-i.value+a.value),p=vue.computed(()=>n.itemInfo.actual_bound.y-i.value-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),h=vue.computed(()=>n.itemInfo.actual_bound.x-i.value+n.itemInfo.actual_bound.width+getCoordinateOffset(n.itemInfo.actual_bound.width,n.itemInfo.scale_x)+a.value),g=vue.computed(()=>n.itemInfo.actual_bound.y-i.value+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),v=vue.computed(()=>n.itemInfo.actual_bound.x-i.value+n.itemInfo.actual_bound.width/2+a.value),y=vue.computed(()=>n.itemInfo.actual_bound.y-i.value+n.itemInfo.actual_bound.height+getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),A=vue.computed(()=>n.itemInfo.actual_bound.x-i.value-getCoordinateOffset(n.itemInfo.actual_bound.width,n.itemInfo.scale_x)+a.value),_=vue.computed(()=>n.itemInfo.actual_bound.y-i.value+n.itemInfo.actual_bound.height*n.itemInfo.scale_y/2-getCoordinateOffset(n.itemInfo.actual_bound.height,n.itemInfo.scale_y)+a.value),S=(T,w)=>{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:w,target_id:n.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:w,target_id:n.itemInfo.id}),c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(n.itemInfo)})))},b=(T,w)=>{var x;c.intention===EGlobalStoreIntention.None?(createLine(T,w,n.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-f.center_offset.x,y:c.mouse_info.new_position_y-c.mouse_info.position_y-f.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:w,target_id:n.itemInfo.id},c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(n.itemInfo)})))};return(T,w)=>(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:w[0]||(w[0]=x=>b(x,vue.unref(ELineBindAnchors).TopCenter)),onMouseup:w[1]||(w[1]=x=>S(x,vue.unref(ELineBindAnchors).TopCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(d),cy:vue.unref(p),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_2$b),vue.createElementVNode("circle",{id:"connection_tc",cx:vue.unref(d),cy:vue.unref(p),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_3$a)],32),vue.createElementVNode("g",{onMousedown:w[2]||(w[2]=x=>b(x,vue.unref(ELineBindAnchors).Right)),onMouseup:w[3]||(w[3]=x=>S(x,vue.unref(ELineBindAnchors).Right))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(h),cy:vue.unref(g),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_4$6),vue.createElementVNode("circle",{id:"connection_r",cx:vue.unref(h),cy:vue.unref(g),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_5$4)],32),vue.createElementVNode("g",{onMousedown:w[4]||(w[4]=x=>b(x,vue.unref(ELineBindAnchors).BottomCenter)),onMouseup:w[5]||(w[5]=x=>S(x,vue.unref(ELineBindAnchors).BottomCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(v),cy:vue.unref(y),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_6$2),vue.createElementVNode("circle",{id:"connection_bc",cx:vue.unref(v),cy:vue.unref(y),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_7$2)],32),vue.createElementVNode("g",{onMousedown:w[6]||(w[6]=x=>b(x,vue.unref(ELineBindAnchors).Left)),onMouseup:w[7]||(w[7]=x=>S(x,vue.unref(ELineBindAnchors).Left))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(A),cy:vue.unref(_),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_8$2),vue.createElementVNode("circle",{id:"connection_l",cx:vue.unref(A),cy:vue.unref(_),r:vue.unref(a),style:{cursor:"crosshair"},"pointer-events":"all"},null,8,_hoisted_9$2)],32)],8,_hoisted_1$e))}}),connectionPanel_vue_vue_type_style_index_0_scoped_fb729c7a_lang="",ConnectionPanel=_export_sfc$1(_sfc_main$z,[["__scopeId","data-v-fb729c7a"]]),_hoisted_1$d=["d","stroke-width"],_hoisted_2$a=["d","stroke-width"],_hoisted_3$9=["id","d","stroke","stroke-width","stroke-dasharray"],_hoisted_4$5=["from","to","dur","repeatCount"],_hoisted_5$3=["d","stroke","stroke-width","stroke-dasharray"],_hoisted_6$1=["from","to","dur","repeatCount"],_hoisted_7$1=["r","fill"],_hoisted_8$1=["path","dur","repeatCount"],_hoisted_9$1=["cx","cy","r"],_hoisted_10$1=["cx","cy","r","stroke","onMousedown"],_sfc_main$y=vue.defineComponent({__name:"connection-line",props:{itemInfo:{},pointVisible:{type:Boolean,default:!1}},setup(r){const n=r,i=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=(c,f,d,p)=>{if(i.intention===EGlobalStoreIntention.Connection)return;i.setHandleSvgInfo(n.itemInfo);const{clientX:h,clientY:g}=f;f.stopPropagation(),i.connection_line_node_info={init_pos:{x:d,y:p},point_index:c},i.intention=EGlobalStoreIntention.SetConnectionLineNode,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((h-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,f)=>{var d,p,h,g,v,y;return vue.openBlock(),vue.createElementBlock("g",{style:vue.normalizeStyle({cursor:vue.unref(i).intention===vue.unref(EGlobalStoreIntention).Connection?"crosshair":"move"})},[vue.withDirectives(vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#DE4517","stroke-width":n.itemInfo.props["stroke-width"].val+1,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_1$d),[[vue.vShow,n.itemInfo.selected||n.itemInfo.id===((d=vue.unref(i).handle_svg_info)==null?void 0:d.info.id)]]),vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#fff","stroke-opacity":".01","stroke-width":n.itemInfo.props["stroke-width"].val,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_2$a),vue.createElementVNode("path",{id:n.itemInfo.id,d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none",stroke:((p=n.itemInfo.animations)==null?void 0:p.type.val)===vue.unref(EConfigAnimationsType).Electricity?n.itemInfo.animations.color.val:n.itemInfo.props.stroke.val,"stroke-width":n.itemInfo.props["stroke-width"].val,"stroke-dashoffset":"0","stroke-dasharray":((h=n.itemInfo.animations)==null?void 0:h.type.val)===vue.unref(EConfigAnimationsType).Electricity?n.itemInfo.props["stroke-width"].val*3:0,"stroke-linejoin":"round"},[((g=n.itemInfo.animations)==null?void 0:g.type.val)===vue.unref(EConfigAnimationsType).Electricity?(vue.openBlock(),vue.createElementBlock("animate",{key:0,attributeName:"stroke-dashoffset",from:n.itemInfo.animations.reverse.val?0:1e3,to:n.itemInfo.animations.reverse.val?1e3:0,dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val},null,8,_hoisted_4$5)):vue.createCommentVNode("",!0)],8,_hoisted_3$9),((v=n.itemInfo.animations)==null?void 0:v.type.val)===vue.unref(EConfigAnimationsType).WaterDrop?(vue.openBlock(),vue.createElementBlock("path",{key:0,d:vue.unref(positionArrToPath)(n.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:n.itemInfo.animations.color.val,"stroke-width":n.itemInfo.props["stroke-width"].val,"stroke-dasharray":n.itemInfo.props["stroke-width"].val*3,"stroke-dashoffset":"0","stroke-linecap":"round","stroke-linejoin":"round"},[vue.createElementVNode("animate",{attributeName:"stroke-dashoffset",from:n.itemInfo.animations.reverse.val?0:1e3,to:n.itemInfo.animations.reverse.val?1e3:0,dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val,fill:"freeze"},null,8,_hoisted_6$1)],8,_hoisted_5$3)):((y=n.itemInfo.animations)==null?void 0:y.type.val)===vue.unref(EConfigAnimationsType).Track?(vue.openBlock(),vue.createElementBlock("circle",{key:1,cx:"0",cy:"0",r:Math.ceil(n.itemInfo.props["stroke-width"].val*.6)+2,fill:n.itemInfo.animations.color.val},[vue.createElementVNode("animateMotion",{path:vue.unref(positionArrToPath)(n.itemInfo.animations.reverse.val?[...n.itemInfo.props.point_position.val].reverse():n.itemInfo.props.point_position.val),dur:`${n.itemInfo.animations.dur.val}s`,repeatCount:n.itemInfo.animations.repeatCount.val},null,8,_hoisted_8$1)],8,_hoisted_7$1)):vue.createCommentVNode("",!0),vue.createElementVNode("g",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.itemInfo.props.point_position.val,(A,_)=>{var S;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("circle",{key:_,cx:A.x,cy:A.y,r:n.itemInfo.props.point_r.val+1,fill:"none","fill-opacity":"0","stroke-width":"1",stroke:"#DE4517"},null,8,_hoisted_9$1)),[[vue.vShow,n.itemInfo.selected||n.itemInfo.id===((S=vue.unref(i).handle_svg_info)==null?void 0:S.info.id)]])}),128)),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.itemInfo.props.point_position.val,(A,_)=>(vue.openBlock(),vue.createElementBlock("circle",{key:_,cx:A.x,cy:A.y,r:n.itemInfo.props.point_r.val,"stroke-width":"1",stroke:n.itemInfo.props.stroke.val,fill:"#fff",style:{cursor:"pointer"},onMousedown:S=>u(_,S,A.x,A.y)},null,40,_hoisted_10$1))),128))])],4)}}}),_hoisted_1$c={id:"pattern_grid",patternUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},_hoisted_2$9=["stroke"],_hoisted_3$8=["stroke"],_hoisted_4$4=["stroke"],_hoisted_5$2=["stroke"],_hoisted_6={key:0,width:"100%",height:"100%",fill:"url(#pattern_grid)"},_hoisted_7=["transform"],_hoisted_8=["transform"],_hoisted_9=["transform","onMousedown","onMouseup","onMouseenter","onMouseleave","onContextmenu"],_hoisted_10=["xlink:href","id","transform"],_hoisted_11=["id"],_hoisted_12$1=["id","x1","y1","x2","y2"],_hoisted_13=["id"],_hoisted_14=["x","y","height","width"],_hoisted_15=["onClick"],_hoisted_16$1={class:"shortcut"},_sfc_main$x=vue.defineComponent({__name:"center-panel",setup(r,{expose:n}){vue.useCssVars(de=>({"49c79b5f":vue.unref(h)}));const i=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=useEditPrivateStore(pinia),c=useContextMenuStore(pinia);componentsRegister();const f=vue.ref(),d=vue.ref(),p={MoveCanvas:"grab",Rotate:"url('/src/assets/icons/rotate.svg'), auto",Connection:"crosshair",SetConnectionLineNode:"crosshair"},h=vue.computed(()=>Object.keys(p).indexOf(i.intention)>-1?p[i.intention]:"default"),g=vue.reactive({handle_panel:vue.computed(()=>i.intention===EGlobalStoreIntention.Select||i.intention===EGlobalStoreIntention.Zoom||i.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}}),y=vue.computed(()=>i.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}),A=vue.computed(()=>{let de=0;for(let ie of i.done_json)ie.selected&&de++;return de>0});let _=!1,S=!1;const b=de=>{var ie;if(i.intention!=EGlobalStoreIntention.None){if(i.intention==EGlobalStoreIntention.Create){if(!i.create_svg_info){console.error("要创建的数据获取失败");return}const Y=Math.floor(de.offsetX/o.svg.scale-a.center_offset.x),Ie=Math.floor(de.offsetY/o.svg.scale-a.center_offset.y),Oe={id:randomString(),x:Y,y:Ie,client:{x:Y,y:Ie},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(i.create_svg_info)};i.setDoneJson(Oe),i.setHandleSvgInfo(Oe,i.done_json.length),i.intention=EGlobalStoreIntention.None}(ie=d.value)==null||ie.focus()}},T=de=>{de.preventDefault()},w=de=>{de.preventDefault()},x=(de,ie,Y)=>{var Ie,Oe,kt;if((Ie=d.value)==null||Ie.focus(),i.intention===EGlobalStoreIntention.Connection){Y.stopPropagation();return}if(Y.preventDefault(),Y.stopPropagation(),Y.ctrlKey&&Y.button===0)((Oe=i.handle_svg_info)!=null&&Oe.index||((kt=i.handle_svg_info)==null?void 0:kt.index)===0)&&(i.done_json[i.handle_svg_info.index].selected=!0,i.setHandleSvgInfo(null),i.intention=EGlobalStoreIntention.None),de.selected=!de.selected;else if(A.value){i.intention=EGlobalStoreIntention.GroupMove,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Y.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y.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 Dt of i.done_json)Dt.selected&&(Dt.old_position={x:Dt.x,y:Dt.y},Dt.point_coordinate_old=objectDeepClone(Dt.point_coordinate))}else i.intention=EGlobalStoreIntention.Select,i.setHandleSvgInfo(de,ie),i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Y.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:de.x,now_position_y:de.y,new_position_x:0,new_position_y:0},de.point_coordinate_old=objectDeepClone(de.point_coordinate)},k=(de,ie,Y)=>{if(!(i.intention===EGlobalStoreIntention.Connection||i.mouse_info.state!=EMouseInfoState.Down)&&A.value&&!_&&["SelectArea","Move","Select"].indexOf(i.intention)<0){for(let Ie of i.done_json)Ie.selected=!1,Ie.old_position={x:0,y:0},resetHandlePointOld(Ie);i.intention=EGlobalStoreIntention.Select,i.setHandleSvgInfo(de,ie),i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((Y.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:de.x,now_position_y:de.y,new_position_x:0,new_position_y:0}}},M=(de,ie,Y)=>{Y.preventDefault(),Y.stopPropagation(),g.connection_panel=!0,g.connection_line=!0,!((i.intention===EGlobalStoreIntention.Connection||i.intention===EGlobalStoreIntention.SetConnectionLineNode)&&de.type===EDoneJsonType.ConnectionLine)&&(g.select_item.info=de,g.select_item.index=ie)},D=(de,ie,Y)=>{Y.preventDefault(),Y.stopPropagation(),!((i.intention===EGlobalStoreIntention.Connection||i.intention===EGlobalStoreIntention.SetConnectionLineNode)&&de.type===EDoneJsonType.ConnectionLine)&&(g.connection_panel=!1,g.connection_line=!1,g.select_item.info=null,g.select_item.index=-1)},z=de=>{var kt,Dt,Fe,$e,Cn,Lt,In,Et,Ne,pe,At,Ve,xe,ze,Pt,hn;if(i.mouse_info.state!=EMouseInfoState.Down&&i.intention!==EGlobalStoreIntention.Connection)return;const{clientX:ie,clientY:Y}=de;i.mouse_info.new_position_x=Math.round((ie-a.canvasInfo.left)/o.svg.scale),i.mouse_info.new_position_y=Math.round((Y-a.canvasInfo.top)/o.svg.scale);const Ie=Math.round(i.mouse_info.new_position_x-i.mouse_info.position_x+i.mouse_info.now_position_x),Oe=Math.round(i.mouse_info.new_position_y-i.mouse_info.position_y+i.mouse_info.now_position_y);if((kt=i.handle_svg_info)!=null&&kt.info&&(i.intention===EGlobalStoreIntention.Select||i.intention===EGlobalStoreIntention.Move)){if(i.handle_svg_info.info.x=Ie,i.handle_svg_info.info.y=Oe,i.handle_svg_info.info.client={x:Ie,y:Oe},i.intention=EGlobalStoreIntention.Move,moveHandlePoint(i.handle_svg_info.info),moveAnchors(i.handle_svg_info.info),i.handle_svg_info.info.type===EDoneJsonType.ConnectionLine){if((Dt=i.handle_svg_info.info.bind_anchors)!=null&&Dt.start){let ae=null;for(let le of i.done_json)le.id===(($e=(Fe=i.handle_svg_info.info.bind_anchors)==null?void 0:Fe.start)==null?void 0:$e.target_id)&&(ae=le);ae&&moveAnchors(ae)}if((Cn=i.handle_svg_info.info.bind_anchors)!=null&&Cn.end){let ae=null;for(let le of i.done_json)le.id===((In=(Lt=i.handle_svg_info.info.bind_anchors)==null?void 0:Lt.end)==null?void 0:In.target_id)&&(ae=le);ae&&moveAnchors(ae)}}}else if(i.intention===EGlobalStoreIntention.MoveCanvas)a.center_offset.x=Ie,a.center_offset.y=Oe;else if(i.intention===EGlobalStoreIntention.SelectArea)v.value.b.x=i.mouse_info.new_position_x-a.center_offset.x,v.value.b.y=i.mouse_info.new_position_y-a.center_offset.y;else if(i.intention===EGlobalStoreIntention.GroupMove){_=!0;for(let ae of i.done_json)if(ae.selected&&ae.old_position){const le=Math.round(i.mouse_info.new_position_x-i.mouse_info.position_x+ae.old_position.x),re=Math.round(i.mouse_info.new_position_y-i.mouse_info.position_y+ae.old_position.y);if(ae.x=le,ae.y=re,ae.client={x:le,y:re},moveHandlePoint(ae),moveAnchors(ae),ae.type===EDoneJsonType.ConnectionLine&&((Et=ae.bind_anchors)!=null&&Et.end)){let V=null;for(let $ of i.done_json)$.id===((pe=(Ne=ae.bind_anchors)==null?void 0:Ne.end)==null?void 0:pe.target_id)&&(V=$);V&&moveAnchors(V)}}}else if(i.intention===EGlobalStoreIntention.Zoom){if(!i.handle_svg_info)return;const ae={x:i.mouse_info.new_position_x-a.center_offset.x,y:i.mouse_info.new_position_y-a.center_offset.y};let le={width:0,height:0,is_old_width:!1,is_old_height:!1};if(i.scale_info.type===EScaleInfoType.TopLeft?le=calculateLeftTop(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.TopRight?le=calculateRightTop(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.BottomRight?le=calculateRightBottom(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.BottomLeft?le=calculateLeftBottom(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate):i.scale_info.type===EScaleInfoType.TopCenter?le=calculateTop(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client):i.scale_info.type===EScaleInfoType.Right?le=calculateRight(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client):i.scale_info.type===EScaleInfoType.BottomCenter?le=calculateBottom(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client):i.scale_info.type===EScaleInfoType.Left&&(le=calculateLeft(ae,i.scale_info.symmetric_point,i.handle_svg_info.info.rotate,i.handle_svg_info.info.client)),i.handle_svg_info&&le.width>0&&le.height>0){const re=le.is_old_width?1:parseFloat((le.width/i.handle_svg_info.info.actual_bound.width).toFixed(3)),V=le.is_old_height?1:parseFloat((le.height/i.handle_svg_info.info.actual_bound.height).toFixed(3)),$=getCenterPoint(ae,i.scale_info.symmetric_point);re>0&&i.scale_info.type!==EScaleInfoType.TopCenter&&i.scale_info.type!==EScaleInfoType.BottomCenter&&(i.handle_svg_info.info.scale_x=re,i.handle_svg_info.info.x=Math.round(getSvgNowPosition(i.handle_svg_info.info.center_position.x,$.x,i.handle_svg_info.info.client.x))),V>0&&i.scale_info.type!==EScaleInfoType.Left&&i.scale_info.type!==EScaleInfoType.Right&&(i.handle_svg_info.info.scale_y=V,i.handle_svg_info.info.y=Math.round(getSvgNowPosition(i.handle_svg_info.info.center_position.y,$.y,i.handle_svg_info.info.client.y)))}}else if(i.intention===EGlobalStoreIntention.Rotate){if(!i.handle_svg_info)return;const ae=Math.atan2(i.mouse_info.position_y-i.handle_svg_info.info.y,i.mouse_info.position_x-i.handle_svg_info.info.x)/(Math.PI/180),le=Math.atan2(i.mouse_info.new_position_y-a.center_offset.y-i.handle_svg_info.info.y,i.mouse_info.new_position_x-a.center_offset.x-i.handle_svg_info.info.x)/(Math.PI/180);i.handle_svg_info.info.rotate=parseFloat((i.rotate_info.angle+le-ae).toFixed(2))}else if(i.intention===EGlobalStoreIntention.Connection&&i.handle_svg_info){const ae=(At=i.handle_svg_info)==null?void 0:At.info.props.point_position.val.length,le=i.mouse_info.new_position_x-i.mouse_info.position_x-a.center_offset.x,re=i.mouse_info.new_position_y-i.mouse_info.position_y-a.center_offset.y,V=i.handle_svg_info.info.props.point_position.val[ae-2],$=((xe=(Ve=i.handle_svg_info)==null?void 0:Ve.info.props.point_r)==null?void 0:xe.val)+2||4;let he=V.x<le?-$:V.x>le?$:0,Ue=V.y<re?-$:V.y>re?$:0;de.ctrlKey?i.handle_svg_info.info.props.point_position.val[ae-1]={x:V.x,y:re+Ue}:de.shiftKey?i.handle_svg_info.info.props.point_position.val[ae-1]={x:le+he,y:V.y}:i.handle_svg_info.info.props.point_position.val[ae-1]={x:le+he,y:re+Ue}}else if(i.intention===EGlobalStoreIntention.SetConnectionLineNode&&i.handle_svg_info){!S&&(i.connection_line_node_info.point_index===i.handle_svg_info.info.props.point_position.val.length-1||i.connection_line_node_info.point_index===0)&&(S=!0);const ae=(ze=i.handle_svg_info)==null?void 0:ze.info.props.point_position.val.length,le=getSvgNowPosition(i.mouse_info.position_x,i.mouse_info.new_position_x,i.connection_line_node_info.init_pos.x),re=getSvgNowPosition(i.mouse_info.position_y,i.mouse_info.new_position_y,i.connection_line_node_info.init_pos.y),V=i.handle_svg_info.info.props.point_position.val[ae-2],$=((hn=(Pt=i.handle_svg_info)==null?void 0:Pt.info.props.point_r)==null?void 0:hn.val)+2||4;let he=V.x<le?-$:V.x>le?$:0,Ue=V.y<re?-$:V.y>re?$:0;i.handle_svg_info.info.props.point_position.val[i.connection_line_node_info.point_index]={x:le+he,y:re+Ue}}},j=()=>{var de,ie,Y,Ie;if(i.mouse_info.state==EMouseInfoState.Down){if((de=i.handle_svg_info)!=null&&de.info&&i.intention==EGlobalStoreIntention.Move)setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.intention=EGlobalStoreIntention.None,i.setDoneJson(i.done_json);else if(i.intention==EGlobalStoreIntention.GroupMove)_&&(_=!1,i.intention=EGlobalStoreIntention.None);else if((ie=i.handle_svg_info)!=null&&ie.info&&i.intention==EGlobalStoreIntention.Zoom)i.handle_svg_info.info.client={x:i.handle_svg_info.info.x,y:i.handle_svg_info.info.y},i.intention=EGlobalStoreIntention.None,setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.setDoneJson(i.done_json);else if(i.intention===EGlobalStoreIntention.Rotate&&((Y=i.handle_svg_info)!=null&&Y.info))setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.setDoneJson(i.done_json),i.intention=EGlobalStoreIntention.None;else{if(i.intention===EGlobalStoreIntention.Connection)return;if(i.intention===EGlobalStoreIntention.SetConnectionLineNode)S&&((Ie=i.handle_svg_info)!=null&&Ie.info.bind_anchors)&&(i.connection_line_node_info.point_index===0?i.handle_svg_info.info.bind_anchors.start=null:i.handle_svg_info.info.bind_anchors.end=null),i.intention=EGlobalStoreIntention.None,S=!1;else if(i.intention===EGlobalStoreIntention.SelectArea){i.setHandleSvgInfo(null);for(let Oe of i.done_json){const kt=y.value;Oe.selected=Oe.x>kt.x&&Oe.x<kt.x+kt.with&&Oe.y>kt.y&&Oe.y<kt.y+kt.height}i.intention=EGlobalStoreIntention.None}else i.intention!=EGlobalStoreIntention.Select&&(i.intention=EGlobalStoreIntention.None)}i.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}},oe=de=>{const{clientX:ie,clientY:Y}=de;if(i.intention===EGlobalStoreIntention.Connection){i.handle_svg_info||createLine(de),i.handle_svg_info&&(de.button===0?i.handle_svg_info.info.props.point_position.val.length!==1?i.handle_svg_info.info.props.point_position.val.push({x:i.mouse_info.new_position_x-i.mouse_info.position_x-a.center_offset.x,y:i.mouse_info.new_position_y-i.mouse_info.position_y-a.center_offset.y}):i.handle_svg_info.info.props.point_position.val.push({x:0,y:0}):de.button===2&&(i.intention=EGlobalStoreIntention.None,setSvgActualInfo(i.done_json[i.handle_svg_info.index]),i.setHandleSvgInfo(null)));return}de.button===0?(i.intention=EGlobalStoreIntention.SelectArea,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((ie-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),position_y:Math.round((Y-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:i.mouse_info.position_x,y:i.mouse_info.position_y},b:{x:0,y:0}}):de.button===2&&(i.intention=EGlobalStoreIntention.MoveCanvas,i.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((ie-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((Y-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 L(de){de!=null&&de.wheelDelta&&(de.wheelDelta>0?o.svg.scale=parseFloat((o.svg.scale+.1).toFixed(1)):o.svg.scale=parseFloat((o.svg.scale-.1).toFixed(1)))}const F=de=>{de.stopPropagation(),de.preventDefault()},O=(de,ie,Y)=>{i.intention!==EGlobalStoreIntention.Connection&&f.value&&(i.intention=EGlobalStoreIntention.ContextMenu,i.setHandleSvgInfo(de,ie),f.value.style.left=Y.pageX+"px",f.value.style.top=Y.pageY+"px",c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!0,ie===i.done_json.length-1&&(c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=!1),ie===0&&(c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!1),c.display=!0)},ue=(de,ie,Y)=>({x:parseFloat((de.x-de.width/2*ie+de.width/2).toFixed(1)),y:parseFloat((de.y-de.height/2*Y+de.height/2).toFixed(1)),width:parseFloat((de.width*ie).toFixed(1)),height:parseFloat((de.height*Y).toFixed(1))}),_e=de=>{de.preventDefault();let ie=[];if(!de.ctrlKey&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].indexOf(de.key)>-1&&(A.value?ie=i.done_json.map((Y,Ie)=>({selected:Y.selected,i:Ie})).filter(Y=>Y.selected).map(Y=>Y.i):i.handle_svg_info&&ie.push(i.handle_svg_info.index)),!de.ctrlKey&&de.key=="ArrowUp"){for(let Y of ie)i.done_json[Y].y-=1,i.done_json[Y].client.y-=1,moveHandlePoint(i.done_json[Y],0,-1),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else if(!de.ctrlKey&&de.key=="ArrowDown"){for(let Y of ie)i.done_json[Y].y+=1,i.done_json[Y].client.y+=1,moveHandlePoint(i.done_json[Y],0,1),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else if(!de.ctrlKey&&de.key=="ArrowLeft"){for(let Y of ie)i.done_json[Y].x-=1,i.done_json[Y].client.x-=1,moveHandlePoint(i.done_json[Y],-1,0),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else if(!de.ctrlKey&&de.key=="ArrowRight"){for(let Y of ie)i.done_json[Y].x+=1,i.done_json[Y].client.x+=1,moveHandlePoint(i.done_json[Y],1,0),moveAnchors(i.done_json[Y]);useHistoryRecord(i.done_json)}else de.ctrlKey&&de.key.toLowerCase()=="c"?c.onContextMenuClick(EContextMenuInfoType.Copy):!de.ctrlKey&&de.key=="Delete"?A.value?(i.setDoneJson(i.done_json.filter(Y=>!Y.selected)),i.setHandleSvgInfo(i.done_json[i.done_json.length-1],i.done_json.length-1)):c.onContextMenuClick(EContextMenuInfoType.Delete):de.ctrlKey&&de.key=="ArrowUp"?c.onContextMenuClick(EContextMenuInfoType.MoveUpOneLevel):de.ctrlKey&&de.key=="ArrowDown"?c.onContextMenuClick(EContextMenuInfoType.MoveDownOneLevel):de.ctrlKey&&de.key=="ArrowLeft"?c.onContextMenuClick(EContextMenuInfoType.MoveDownTopLevel):de.ctrlKey&&de.key=="ArrowRight"?c.onContextMenuClick(EContextMenuInfoType.MoveUpTopLevel):de.ctrlKey&&de.shiftKey&&de.key.toLowerCase()=="z"?u.topRedoBtnClick():de.ctrlKey&&de.key.toLowerCase()=="z"?u.topUndoBtnClick():de.ctrlKey&&de.key.toLowerCase()=="delete"&&(i.done_json.length<=0||i.setDoneJson([]))},Ce=()=>{setSvgActualInfo(i.done_json[i.handle_svg_info.index],!0)};return vue.onMounted(()=>{var de;(de=d.value)==null||de.focus(),vue.nextTick(function(){var Y;const ie=(Y=d.value)==null?void 0:Y.getBoundingClientRect();a.canvasInfo={height:(ie==null?void 0:ie.height)||0,with:(ie==null?void 0:ie.width)||0,top:(ie==null?void 0:ie.top)||0,left:(ie==null?void 0:ie.left)||0}})}),n({onCanvasMouseUp:j}),(de,ie)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",{class:"canvas",tabindex:"0",ref_key:"canvasRef",ref:d,onDrop:b,onDragenter:T,onDragover:w,onMousedown:oe,onMousemove:z,onMouseup:j,onContextmenu:F,onKeydown:_e,onMousewheel:L},[(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",style:vue.normalizeStyle({backgroundColor:vue.unref(o).svg.background_color}),width:"100%",height:"100%"},[vue.createElementVNode("defs",null,[vue.createElementVNode("pattern",_hoisted_1$c,[vue.createElementVNode("line",{x1:"0",y1:"0",x2:"0",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_2$9),vue.createElementVNode("line",{x1:"10",y1:"0",x2:"10",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_3$8),vue.createElementVNode("line",{x1:"0",y1:"0",x2:"20",y2:"0",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_4$4),vue.createElementVNode("line",{x1:"0",y1:"10",x2:"20",y2:"10",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_5$2)])]),vue.unref(o).svg.grid?(vue.openBlock(),vue.createElementBlock("rect",_hoisted_6)):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(i).done_json,(Y,Ie)=>{var Oe,kt,Dt,Fe,$e,Cn;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:Y.id,transform:`translate(${Y.x},${Y.y})rotate(0)scale(1)`,onMousewheel:ie[0]||(ie[0]=(...Lt)=>vue.unref(stopEvent)&&vue.unref(stopEvent)(...Lt))},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(Y)}`)},[vue.createElementVNode("g",{transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2})rotate(${Y.rotate}) scale(1) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`,onMousedown:Lt=>x(Y,Ie,Lt),onMouseup:Lt=>k(Y,Ie,Lt),onMouseenter:Lt=>M(Y,Ie,Lt),onMouseleave:Lt=>D(Y,Ie,Lt),onContextmenu:Lt=>O(Y,Ie,Lt)},[Y.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$y,{key:0,"item-info":Y,"point-visible":vue.unref(g).connection_line&&((Oe=vue.unref(g).select_item.info)==null?void 0:Oe.id)==Y.id},null,8,["item-info","point-visible"])):Y.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${Y.name}`},vue.unref(prosToVBind)(Y),{width:"100",height:"100",id:Y.id,transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2}) scale(${Y.scale_x},${Y.scale_y}) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`}),null,16,_hoisted_10)):Y.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(Y.tag),vue.mergeProps({key:2},vue.unref(prosToVBind)(Y),{width:"100",height:"100",id:Y.id,onResize:Ce,transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2}) scale(${Y.scale_x},${Y.scale_y}) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`}),null,16,["id","transform"])):Y.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3},ue(Y.actual_bound,Y.scale_x,Y.scale_y),{id:`foreign-object${Y.id}`,class:"foreignObject"}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(Y.tag),vue.mergeProps(vue.unref(prosToVBind)(Y),{id:Y.id,transform:`translate(${Y.actual_bound.x+Y.actual_bound.width/2},${Y.actual_bound.y+Y.actual_bound.height/2}) scale(${Y.scale_x},${Y.scale_y}) translate(${-(Y.actual_bound.x+Y.actual_bound.width/2)},${-(Y.actual_bound.y+Y.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(Y.tag_slot),1)]),_:2},1040,["id","transform"]))],16,_hoisted_11)):Y.type===vue.unref(EDoneJsonType).StraightLine?(vue.openBlock(),vue.createElementBlock("line",{key:4,id:Y.id,x1:Y.props.start_x.val,y1:Y.props.start_y.val,x2:Y.props.end_x.val,y2:Y.props.end_y.val,fill:"#FF0000",stroke:"#FF0000","stroke-width":"2"},null,8,_hoisted_12$1)):vue.createCommentVNode("",!0),Y.config.actual_rect?(vue.openBlock(),vue.createElementBlock("rect",vue.mergeProps({key:5,id:`rect${Y.id}`,fill:"black","fill-opacity":"0"},ue(Y.actual_bound,Y.scale_x,Y.scale_y),{style:{stroke:"none","stroke-width":"2","stroke-miterlimit":"10"},class:{"svg-item-none":!Y.selected&&(vue.unref(i).intention==vue.unref(EGlobalStoreIntention).None||vue.unref(i).intention==vue.unref(EGlobalStoreIntention).Select),"svg-item-move":vue.unref(i).intention==vue.unref(EGlobalStoreIntention).Move&&((kt=vue.unref(i).handle_svg_info)==null?void 0:kt.info.id)==Y.id,"svg-item-select":vue.unref(i).intention==vue.unref(EGlobalStoreIntention).Select&&((Dt=vue.unref(i).handle_svg_info)==null?void 0:Dt.info.id)==Y.id,"svg-item-in-group":Y.selected}}),null,16,_hoisted_13)):vue.createCommentVNode("",!0),((Fe=vue.unref(i).handle_svg_info)==null?void 0:Fe.info.id)===Y.id&&vue.unref(g).handle_panel&&Y.type!==vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(HandlePanel,{key:6,"item-info":Y},null,8,["item-info"])):vue.createCommentVNode("",!0),!Y.selected&&(($e=vue.unref(g).select_item.info)==null?void 0:$e.id)==Y.id&&vue.unref(g).connection_panel&&Y.config.have_anchor&&vue.unref(i).intention!==vue.unref(EGlobalStoreIntention).SelectArea&&(vue.unref(i).intention!==vue.unref(EGlobalStoreIntention).Select||Y.id!==((Cn=vue.unref(i).handle_svg_info)==null?void 0:Cn.info.id))?(vue.openBlock(),vue.createBlock(ConnectionPanel,{key:7,onContextmenu:F,"item-info":Y},null,8,["item-info"])):vue.createCommentVNode("",!0)],40,_hoisted_9)],2)],40,_hoisted_8)),[[vue.vShow,Y.display]])}),128)),vue.createElementVNode("rect",{x:vue.unref(y).x,y:vue.unref(y).y,height:vue.unref(y).height,width:vue.unref(y).with,stroke:"#107cec",fill:"#107cec","fill-opacity":".2"},null,8,_hoisted_14)],8,_hoisted_7)],4))],544),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,(Y,Ie)=>(vue.openBlock(),vue.createElementBlock("li",{key:Y.title,onClick:Oe=>vue.unref(c).onContextMenuClick(Ie)},[vue.createElementVNode("p",{class:vue.normalizeClass(Y.enable?"":"disabled")},[vue.createTextVNode(vue.toDisplayString(Y.title)+" ",1),vue.createElementVNode("span",_hoisted_16$1,vue.toDisplayString(Y.hot_key),1)],2)],8,_hoisted_15))),128))],512),[[vue.vShow,vue.unref(c).display]])],64))}}),centerPanel_vue_vue_type_style_index_0_scoped_97a3211c_lang="",CenterPanel=_export_sfc$1(_sfc_main$x,[["__scopeId","data-v-97a3211c"]]);/*! Element Plus Icons Vue v2.1.0 */var export_helper_default=(r,n)=>{let i=r.__vccOpts||r;for(let[o,a]of n)i[o]=a;return i},aim_vue_vue_type_script_lang_default={name:"Aim"},_hoisted_12={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_22=vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),_hoisted_32=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-32zm0 576a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V704a32 32 0 0 1 32-32zM96 512a32 32 0 0 1 32-32h192a32 32 0 0 1 0 64H128a32 32 0 0 1-32-32zm576 0a32 32 0 0 1 32-32h192a32 32 0 1 1 0 64H704a32 32 0 0 1-32-32z"},null,-1),_hoisted_42=[_hoisted_22,_hoisted_32];function _sfc_render2(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_12,_hoisted_42)}var aim_default=export_helper_default(aim_vue_vue_type_script_lang_default,[["render",_sfc_render2],["__file","aim.vue"]]),arrow_down_vue_vue_type_script_lang_default={name:"ArrowDown"},_hoisted_16={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_26=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"},null,-1),_hoisted_36=[_hoisted_26];function _sfc_render6(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_16,_hoisted_36)}var arrow_down_default=export_helper_default(arrow_down_vue_vue_type_script_lang_default,[["render",_sfc_render6],["__file","arrow-down.vue"]]),circle_check_vue_vue_type_script_lang_default={name:"CircleCheck"},_hoisted_149={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_249=vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),_hoisted_348=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"},null,-1),_hoisted_415=[_hoisted_249,_hoisted_348];function _sfc_render49(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_149,_hoisted_415)}var circle_check_default=export_helper_default(circle_check_vue_vue_type_script_lang_default,[["render",_sfc_render49],["__file","circle-check.vue"]]),circle_close_vue_vue_type_script_lang_default={name:"CircleClose"},_hoisted_151={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_251=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.248L466.752 512z"},null,-1),_hoisted_350=vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),_hoisted_416=[_hoisted_251,_hoisted_350];function _sfc_render51(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_151,_hoisted_416)}var circle_close_default=export_helper_default(circle_close_vue_vue_type_script_lang_default,[["render",_sfc_render51],["__file","circle-close.vue"]]),close_vue_vue_type_script_lang_default={name:"Close"},_hoisted_156={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_256=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"},null,-1),_hoisted_355=[_hoisted_256];function _sfc_render56(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_156,_hoisted_355)}var close_default=export_helper_default(close_vue_vue_type_script_lang_default,[["render",_sfc_render56],["__file","close.vue"]]),hide_vue_vue_type_script_lang_default={name:"Hide"},_hoisted_1133={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_2133=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.2L371.2 588.8ZM889.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"},null,-1),_hoisted_3132=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"},null,-1),_hoisted_438=[_hoisted_2133,_hoisted_3132];function _sfc_render133(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1133,_hoisted_438)}var hide_default=export_helper_default(hide_vue_vue_type_script_lang_default,[["render",_sfc_render133],["__file","hide.vue"]]),loading_vue_vue_type_script_lang_default={name:"Loading"},_hoisted_1150={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_2150=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-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.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 0zm-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"},null,-1),_hoisted_3149=[_hoisted_2150];function _sfc_render150(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1150,_hoisted_3149)}var loading_default=export_helper_default(loading_vue_vue_type_script_lang_default,[["render",_sfc_render150],["__file","loading.vue"]]),view_vue_vue_type_script_lang_default={name:"View"},_hoisted_1283={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},_hoisted_2283=vue.createElementVNode("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 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-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"},null,-1),_hoisted_3282=[_hoisted_2283];function _sfc_render283(r,n,i,o,a,u){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1283,_hoisted_3282)}var view_default=export_helper_default(view_vue_vue_type_script_lang_default,[["render",_sfc_render283],["__file","view.vue"]]),MapShim=function(){if(typeof Map<"u")return Map;function r(n,i){var o=-1;return n.some(function(a,u){return a[0]===i?(o=u,!0):!1}),o}return function(){function n(){this.__entries__=[]}return Object.defineProperty(n.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),n.prototype.get=function(i){var o=r(this.__entries__,i),a=this.__entries__[o];return a&&a[1]},n.prototype.set=function(i,o){var a=r(this.__entries__,i);~a?this.__entries__[a][1]=o:this.__entries__.push([i,o])},n.prototype.delete=function(i){var o=this.__entries__,a=r(o,i);~a&&o.splice(a,1)},n.prototype.has=function(i){return!!~r(this.__entries__,i)},n.prototype.clear=function(){this.__entries__.splice(0)},n.prototype.forEach=function(i,o){o===void 0&&(o=null);for(var a=0,u=this.__entries__;a<u.length;a++){var c=u[a];i.call(o,c[1],c[0])}},n}()}(),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(r){return setTimeout(function(){return r(Date.now())},1e3/60)}}(),trailingTimeout=2;function throttle(r,n){var i=!1,o=!1,a=0;function u(){i&&(i=!1,r()),o&&f()}function c(){requestAnimationFrame$1(u)}function f(){var d=Date.now();if(i){if(d-a<trailingTimeout)return;o=!0}else i=!0,o=!1,setTimeout(c,n);a=d}return f}var REFRESH_DELAY=20,transitionKeys=["top","right","bottom","left","width","height","size","weight"],mutationObserverSupported=typeof MutationObserver<"u",ResizeObserverController=function(){function r(){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 r.prototype.addObserver=function(n){~this.observers_.indexOf(n)||this.observers_.push(n),this.connected_||this.connect_()},r.prototype.removeObserver=function(n){var i=this.observers_,o=i.indexOf(n);~o&&i.splice(o,1),!i.length&&this.connected_&&this.disconnect_()},r.prototype.refresh=function(){var n=this.updateObservers_();n&&this.refresh()},r.prototype.updateObservers_=function(){var n=this.observers_.filter(function(i){return i.gatherActive(),i.hasActive()});return n.forEach(function(i){return i.broadcastActive()}),n.length>0},r.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)},r.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)},r.prototype.onTransitionEnd_=function(n){var i=n.propertyName,o=i===void 0?"":i,a=transitionKeys.some(function(u){return!!~o.indexOf(u)});a&&this.refresh()},r.getInstance=function(){return this.instance_||(this.instance_=new r),this.instance_},r.instance_=null,r}(),defineConfigurable=function(r,n){for(var i=0,o=Object.keys(n);i<o.length;i++){var a=o[i];Object.defineProperty(r,a,{value:n[a],enumerable:!1,writable:!1,configurable:!0})}return r},getWindowOf=function(r){var n=r&&r.ownerDocument&&r.ownerDocument.defaultView;return n||global$1},emptyRect=createRectInit(0,0,0,0);function toFloat(r){return parseFloat(r)||0}function getBordersSize(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return n.reduce(function(o,a){var u=r["border-"+a+"-width"];return o+toFloat(u)},0)}function getPaddings(r){for(var n=["top","right","bottom","left"],i={},o=0,a=n;o<a.length;o++){var u=a[o],c=r["padding-"+u];i[u]=toFloat(c)}return i}function getSVGContentRect(r){var n=r.getBBox();return createRectInit(0,0,n.width,n.height)}function getHTMLElementContentRect(r){var n=r.clientWidth,i=r.clientHeight;if(!n&&!i)return emptyRect;var o=getWindowOf(r).getComputedStyle(r),a=getPaddings(o),u=a.left+a.right,c=a.top+a.bottom,f=toFloat(o.width),d=toFloat(o.height);if(o.boxSizing==="border-box"&&(Math.round(f+u)!==n&&(f-=getBordersSize(o,"left","right")+u),Math.round(d+c)!==i&&(d-=getBordersSize(o,"top","bottom")+c)),!isDocumentElement(r)){var p=Math.round(f+u)-n,h=Math.round(d+c)-i;Math.abs(p)!==1&&(f-=p),Math.abs(h)!==1&&(d-=h)}return createRectInit(a.left,a.top,f,d)}var isSVGGraphicsElement=function(){return typeof SVGGraphicsElement<"u"?function(r){return r instanceof getWindowOf(r).SVGGraphicsElement}:function(r){return r instanceof getWindowOf(r).SVGElement&&typeof r.getBBox=="function"}}();function isDocumentElement(r){return r===getWindowOf(r).document.documentElement}function getContentRect(r){return isBrowser?isSVGGraphicsElement(r)?getSVGContentRect(r):getHTMLElementContentRect(r):emptyRect}function createReadOnlyRect(r){var n=r.x,i=r.y,o=r.width,a=r.height,u=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,c=Object.create(u.prototype);return defineConfigurable(c,{x:n,y:i,width:o,height:a,top:i,right:n+o,bottom:a+i,left:n}),c}function createRectInit(r,n,i,o){return{x:r,y:n,width:i,height:o}}var ResizeObservation=function(){function r(n){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=createRectInit(0,0,0,0),this.target=n}return r.prototype.isActive=function(){var n=getContentRect(this.target);return this.contentRect_=n,n.width!==this.broadcastWidth||n.height!==this.broadcastHeight},r.prototype.broadcastRect=function(){var n=this.contentRect_;return this.broadcastWidth=n.width,this.broadcastHeight=n.height,n},r}(),ResizeObserverEntry=function(){function r(n,i){var o=createReadOnlyRect(i);defineConfigurable(this,{target:n,contentRect:o})}return r}(),ResizeObserverSPI=function(){function r(n,i,o){if(this.activeObservations_=[],this.observations_=new MapShim,typeof n!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=n,this.controller_=i,this.callbackCtx_=o}return r.prototype.observe=function(n){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(n instanceof getWindowOf(n).Element))throw new TypeError('parameter 1 is not of type "Element".');var i=this.observations_;i.has(n)||(i.set(n,new ResizeObservation(n)),this.controller_.addObserver(this),this.controller_.refresh())}},r.prototype.unobserve=function(n){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(n instanceof getWindowOf(n).Element))throw new TypeError('parameter 1 is not of type "Element".');var i=this.observations_;i.has(n)&&(i.delete(n),i.size||this.controller_.removeObserver(this))}},r.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},r.prototype.gatherActive=function(){var n=this;this.clearActive(),this.observations_.forEach(function(i){i.isActive()&&n.activeObservations_.push(i)})},r.prototype.broadcastActive=function(){if(this.hasActive()){var n=this.callbackCtx_,i=this.activeObservations_.map(function(o){return new ResizeObserverEntry(o.target,o.broadcastRect())});this.callback_.call(n,i,n),this.clearActive()}},r.prototype.clearActive=function(){this.activeObservations_.splice(0)},r.prototype.hasActive=function(){return this.activeObservations_.length>0},r}(),observers=typeof WeakMap<"u"?new WeakMap:new MapShim,ResizeObserver$1=function(){function r(n){if(!(this instanceof r))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var i=ResizeObserverController.getInstance(),o=new ResizeObserverSPI(n,i,this);observers.set(this,o)}return r}();["observe","unobserve","disconnect"].forEach(function(r){ResizeObserver$1.prototype[r]=function(){var n;return(n=observers.get(this))[r].apply(n,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({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 r=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,r.on("change",()=>{if(this._isSettingContent)return;const n=r.getValue();this._contentBackup=n,this.$emit("update:value",n)}),Events.forEach(n=>{const i="on"+vue.capitalize(n);typeof this.$.vnode.props[i]=="function"&&r.on(n,this.$emit.bind(this,n))}),this._ro=new index$1(()=>r.resize()),this._ro.observe(this.$el),this.$emit("init",r)},beforeUnmount(){var r,n;(r=this._ro)===null||r===void 0||r.disconnect(),(n=this._editor)===null||n===void 0||n.destroy()},methods:{focus(){this._editor.focus()},blur(){this._editor.blur()},selectAll(){this._editor.selectAll()}},watch:{value(r){if(this._contentBackup!==r){try{this._isSettingContent=!0,this._editor.setValue(r,1)}finally{this._isSettingContent=!1}this._contentBackup=r}},theme(r){this._editor.setTheme("ace/theme/"+r)},options(r){this._editor.setOptions(r)},readonly(r){this._editor.setReadOnly(r)},placeholder(r){this._editor.setOption("placeholder",r)},wrap(r){this._editor.setWrapBehavioursEnabled(r)},printMargin(r){this._editor.setOption("printMargin",r)},lang(r){this._editor.setOption("mode","ace/mode/"+r)},minLines(r){this._editor.setOption("minLines",r)},maxLines(r){this._editor.setOption("maxLines",r)}}}),themeUrl2="data:application/javascript;base64,YWNlLmRlZmluZSgiYWNlL3RoZW1lL2tyX3RoZW1lLmNzcyIsWyJyZXF1aXJlIiwiZXhwb3J0cyIsIm1vZHVsZSJdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpe21vZHVsZS5leHBvcnRzID0gIi5hY2Uta3ItdGhlbWUgLmFjZV9ndXR0ZXIge1xuICBiYWNrZ3JvdW5kOiAjMWMxOTE3O1xuICBjb2xvcjogI0ZDRkZFMFxufVxuXG4uYWNlLWtyLXRoZW1lIC5hY2VfcHJpbnQtbWFyZ2luIHtcbiAgd2lkdGg6IDFweDtcbiAgYmFja2dyb3VuZDogIzFjMTkxN1xufVxuXG4uYWNlLWtyLXRoZW1lIHtcbiAgYmFja2dyb3VuZC1jb2xvcjogIzBCMEEwOTtcbiAgY29sb3I6ICNGQ0ZGRTBcbn1cblxuLmFjZS1rci10aGVtZSAuYWNlX2N1cnNvciB7XG4gIGNvbG9yOiAjRkY5OTAwXG59XG5cbi5hY2Uta3ItdGhlbWUgLmFjZV9tYXJrZXItbGF5ZXIgLmFjZV9zZWxlY3Rpb24ge1xuICBiYWNrZ3JvdW5kOiByZ2JhKDE3MCwgMCwgMjU1LCAwLjQ1KVxufVxuXG4uYWNlLWtyLXRoZW1lLmFjZV9tdWx0aXNlbGVjdCAuYWNlX3NlbGVjdGlvbi5hY2Vfc3RhcnQge1xuICBib3gtc2hhZG93OiAwIDAgM3B4IDBweCAjMEIwQTA5O1xufVxuXG4uYWNlLWtyLXRoZW1lIC5hY2VfbWFya2VyLWxheWVyI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YXNzID0gImFjZS1rci10aGVtZSI7CmV4cG9ydHMuY3NzVGV4dCA9IHJlcXVpcmUoIi4va3JfdGhlbWUuY3NzIik7CnZhciBkb20gPSByZXF1aXJlKCIuLi9saWIvZG9tIik7CmRvbS5pbXBvcnRDc3NTdHJpbmcoZXhwb3J0cy5jc3NUZXh0LCBleHBvcnRzLmNzc0NsYXNzLCBmYWxzZSk7Cgp9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL3RoZW1lL2tyX3RoZW1lIl0sIGZ1bmN0aW9uKG0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBtb2R1bGUgPT0gIm9iamVjdCIgJiYgdHlwZW9mIGV4cG9ydHMgPT0gIm9iamVjdCIgJiYgbW9kdWxlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IG07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pKCk7CiAgICAgICAgICAgIA==",modeJsonUrl="data:application/javascript;base64,YWNlLmRlZmluZSgiYWNlL21vZGUvanNvbl9oaWdobGlnaHRfcnVsZXMiLFsicmVxdWlyZSIsImV4cG9ydHMiLCJtb2R1bGUiLCJhY2UvbGliL29vcCIsImFjZS9tb2RlL3RleHRfaGlnaGxpZ2h0X3J1bGVzIl0sIGZ1bmN0aW9uKHJlcXVpcmUsIGV4cG9ydHMsIG1vZHVsZSl7InVzZSBzdHJpY3QiOwp2YXIgb29wID0gcmVxdWlyZSgiLi4vbGliL29vcCIpOwp2YXIgVGV4dEhpZ2hsaWdodFJ1bGVzID0gcmVxdWlyZSgiLi90ZXh0X2hpZ2hsaWdodF9ydWxlcyIpLlRleHRIaWdobGlnaHRSdWxlczsKdmFyIEpzb25IaWdobGlnaHRSdWxlcyA9IGZ1bmN0aW9uICgpIHsKICAgIHRoaXMuJHJ1bGVzID0gewogICAgICAgICJzdGFydCI6IFsKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdG9rZW46ICJ2YXJpYWJsZSIsCiAgICAgICAgICAgICAgICByZWdleDogJ1siXSg/Oig/OlxcXFwuKXwoPzpbXiJcXFxcXSkpKj9bIl1cXHMqKD89OiknCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAic3RyaW5nIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAnIicsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RyaW5nIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lm51bWVyaWMiLAogICAgICAgICAgICAgICAgcmVnZXg6ICIwW3hYXVswLTlhLWZBLUZdK1xcYiIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJjb25zdGFudC5udW1lcmljIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAiWystXT9cXGQrKD86KD86XFwuXFxkKik/KD86W2VFXVsrLV0/XFxkKyk/KT9cXGIiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29uc3RhbnQubGFuZ3VhZ2UuYm9vbGVhbiIsCiAgICAgICAgICAgICAgICByZWdleDogIig/OnRydWV8ZmFsc2UpXFxiIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbJ10oPzooPzpcXFxcLil8KD86W14nXFxcXF0pKSo/WyddIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbW1lbnQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXC9cXC8uKiQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29tbWVudC5zdGFydCIsCiAgICAgICAgICAgICAgICByZWdleDogIlxcL1xcKiIsCiAgICAgICAgICAgICAgICBuZXh0OiAiY29tbWVudCIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5scGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbWyh7XSIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5ycGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbXFxdKX1dIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInB1bmN0dWF0aW9uLm9wZXJhdG9yIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAvWyxdLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXHMrIgogICAgICAgICAgICB9CiAgICAgICAgXSwKICAgICAgICAic3RyaW5nIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lmxhbmd1YWdlLmVzY2FwZSIsCiAgICAgICAgICAgICAgICByZWdleDogL1xcKD86eFswLTlhLWZBLUZdezJ9fHVbMC05YS1mQS1GXXs0fXxbIlxcXC9iZm5ydF0pLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInN0cmluZyIsCiAgICAgICAgICAgICAgICByZWdleDogJyJ8JCcsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RhcnQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIGRlZmF1bHRUb2tlbjogInN0cmluZyIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImNvbW1lbnQiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29tbWVudC5lbmQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXCpcXC8iLAogICAgICAgICAgICAgICAgbmV4dDogInN0YXJ0IgogICAgICAgICAgICB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GRSYW5nZShyb3csIGkgKyBtYXRjaFswXS5sZW5ndGgsIDEpOwogICAgICAgICAgICBpZiAocmFuZ2UgJiYgIXJhbmdlLmlzTXVsdGlMaW5lKCkpIHsKICAgICAgICAgICAgICAgIGlmIChmb3JjZU11bHRpbGluZSkgewogICAgICAgICAgICAgICAgICAgIHJhbmdlID0gdGhpcy5nZXRTZWN0aW9uUmFuZ2Uoc2Vzc2lvbiwgcm93KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKGZvbGRTdHlsZSAhPSAiYWxsIikKICAgICAgICAgICAgICAgICAgICByYW5nZSA9IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHJhbmdlOwogICAgICAgIH0KICAgICAgICBpZiAoZm9sZFN0eWxlID09PSAibWFya2JlZ2luIikKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIHZhciBtYXRjaCA9IGxpbmUubWF0Y2godGhpcy5mb2xkaW5nU3RvcE1hcmtlcik7CiAgICAgICAgaWYgKG1hdGNoKSB7CiAgICAgICAgICAgIHZhciBpID0gbWF0Y2guaW5kZXggKyBtYXRjaFswXS5sZW5ndGg7CiAgICAgICAgICAgIGlmIChtYXRjaFsxXSkKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNsb3NpbmdCcmFja2V0QmxvY2soc2Vzc2lvbiwgbWF0Y2hbMV0sIHJvdywgaSk7CiAgICAgICAgICAgIHJldHVybiBzZXNzaW9uLmdldENvbW1lbnRGb2xkUmFuZ2Uocm93LCBpLCAtMSk7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuZ2V0U2VjdGlvblJhbmdlID0gZnVuY3Rpb24gKHNlc3Npb24sIHJvdykgewogICAgICAgIHZhciBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgdmFyIHN0YXJ0SW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgdmFyIHN0YXJ0Um93ID0gcm93OwogICAgICAgIHZhciBzdGFydENvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIHJvdyA9IHJvdyArIDE7CiAgICAgICAgdmFyIGVuZFJvdyA9IHJvdzsKICAgICAgICB2YXIgbWF4Um93ID0gc2Vzc2lvbi5nZXRMZW5ndGgoKTsKICAgICAgICB3aGlsZSAoKytyb3cgPCBtYXhSb3cpIHsKICAgICAgICAgICAgbGluZSA9IHNlc3Npb24uZ2V0TGluZShyb3cpOwogICAgICAgICAgICB2YXIgaW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgICAgIGlmIChpbmRlbnQgPT09IC0xKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChzdGFydEluZGVudCA+IGluZGVudCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB2YXIgc3ViUmFuZ2UgPSB0aGlzLmdldEZvbGRXaWRnZXRSYW5nZShzZXNzaW9uLCAiYWxsIiwgcm93KTsKICAgICAgICAgICAgaWYgKHN1YlJhbmdlKSB7CiAgICAgICAgICAgICAgICBpZiAoc3ViUmFuZ2Uuc3RhcnQucm93IDw9IHN0YXJ0Um93KSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmIChzdWJSYW5nZS5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgcm93ID0gc3ViUmFuZ2UuZW5kLnJvdzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKHN0YXJ0SW5kZW50ID09IGluZGVudCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGVuZFJvdyA9IHJvdzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG5ldyBSYW5nZShzdGFydFJvdywgc3RhcnRDb2x1bW4sIGVuZFJvdywgc2Vzc2lvbi5nZXRMaW5lKGVuZFJvdykubGVuZ3RoKTsKICAgIH07CiAgICB0aGlzLmdldENvbW1lbnRSZWdpb25CbG9jayA9IGZ1bmN0aW9uIChzZXNzaW9uLCBsaW5lLCByb3cpIHsKICAgICAgICB2YXIgc3RhcnRDb2x1bW4gPSBsaW5lLnNlYXJjaCgvXHMqJC8pOwogICAgICAgIHZhciBtYXhSb3cgPSBzZXNzaW9uLmdldExlbmd0aCgpOwogICAgICAgIHZhciBzdGFydFJvdyA9IHJvdzsKICAgICAgICB2YXIgcmUgPSAvXlxzKig/OlwvXCp8XC9cL3wtLSkjPyhlbmQpP3JlZ2lvblxiLzsKICAgICAgICB2YXIgZGVwdGggPSAxOwogICAgICAgIHdoaWxlICgrK3JvdyA8IG1heFJvdykgewogICAgICAgICAgICBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgICAgIHZhciBtID0gcmUuZXhlYyhsaW5lKTsKICAgICAgICAgICAgaWYgKCFtKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChtWzFdKQogICAgICAgICAgICAgICAgZGVwdGgtLTsKICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgZGVwdGgrKzsKICAgICAgICAgICAgaWYgKCFkZXB0aCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICB2YXIgZW5kUm93ID0gcm93OwogICAgICAgIGlmIChlbmRSb3cgPiBzdGFydFJvdykgewogICAgICAgICAgICByZXR1cm4gbmV3IFJhbmdlKHN0YXJ0Um93LCBzdGFydENvbHVtbiwgZW5kUm93LCBsaW5lLmxlbmd0aCk7CiAgICAgICAgfQogICAgfTsKfSkuY2FsbChGb2xkTW9kZS5wcm90b3R5cGUpOwoKfSk7CgphY2UuZGVmaW5lKCJhY2UvbW9kZS9qc29uIixbInJlcXVpcmUiLCJleHBvcnRzIiwibW9kdWxlIiwiYWNlL2xp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OwogICAgICAgIHdvcmtlci5hdHRhY2hUb0RvY3VtZW50KHNlc3Npb24uZ2V0RG9jdW1lbnQoKSk7CiAgICAgICAgd29ya2VyLm9uKCJhbm5vdGF0ZSIsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIHNlc3Npb24uc2V0QW5ub3RhdGlvbnMoZS5kYXRhKTsKICAgICAgICB9KTsKICAgICAgICB3b3JrZXIub24oInRlcm1pbmF0ZSIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgc2Vzc2lvbi5jbGVhckFubm90YXRpb25zKCk7CiAgICAgICAgfSk7CiAgICAgICAgcmV0dXJuIHdvcmtlcjsKICAgIH07CiAgICB0aGlzLiRpZCA9ICJhY2UvbW9kZS9qc29uIjsKfSkuY2FsbChNb2RlLnByb3RvdHlwZSk7CmV4cG9ydHMuTW9kZSA9IE1vZGU7Cgp9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL21vZGUvanNvbiJdLCBmdW5jdGlvbihtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgbW9kdWxlID09ICJvYmplY3QiICYmIHR5cGVvZiBleHBvcnRzID09ICJvYmplY3QiICYmIG1vZHVsZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlLmV4cG9ydHMgPSBtOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KSgpOwogICAgICAgICAgICA=",workerJsonUrl="data:application/javascript;base64,Im5vIHVzZSBzdHJpY3QiOwohKGZ1bmN0aW9uKHdpbmRvdykgewppZiAodHlwZW9mIHdpbmRvdy53aW5kb3cgIT0gInVuZGVmaW5lZCIgJiYgd2luZG93LmRvY3VtZW50KQogICAgcmV0dXJuOwppZiAod2luZG93LnJlcXVpcmUgJiYgd2luZG93LmRlZmluZSkKICAgI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AgIGluaXRpYWxpemVkOiB0cnVlCiAgICAgICAgfTsKICAgICAgICByZXR1cm47CiAgICB9CgogICAgaWYgKCFkZXBzLmxlbmd0aCkKICAgICAgICAvLyBJZiB0aGVyZSBpcyBubyBkZXBlbmRlbmNpZXMsIHdlIGluamVjdCAicmVxdWlyZSIsICJleHBvcnRzIiBhbmQKICAgICAgICAvLyAibW9kdWxlIiBhcyBkZXBlbmRlbmNpZXMsIHRvIHByb3ZpZGUgQ29tbW9uSlMgY29tcGF0aWJpbGl0eS4KICAgICAgICBkZXBzID0gWyJyZXF1aXJlIiwgImV4cG9ydHMiLCAibW9kdWxlIl07CgogICAgdmFyIHJlcSA9IGZ1bmN0aW9uKGNoaWxkSWQpIHsKICAgICAgICByZXR1cm4gd2luZG93LnJlcXVpcmUoaWQsIGNoaWxkSWQpOwogICAgfTsKCiAgICB3aW5kb3cucmVxdWlyZS5tb2R1bGVzW2lkXSA9IHsKICAgICAgICBleHBvcnRzOiB7fSwKICAgICAgICBmYWN0b3J5OiBmdW5jdGlvbigpIHsKICAgICAgICAgICAgdmFyIG1vZHVsZSA9IHRoaXM7CiAgICAgICAgICAgIHZhciByZXR1cm5FeHBvcnRzID0gZmFjdG9yeS5hcHBseSh0aGlzLCBkZXBzLnNsaWNlKDAsIGZhY3RvcnkubGVuZ3RoKS5tYXAoZnVuY3Rpb24oZGVwKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKGRlcCkgewogICAgICAgICAgICAgICAgICAgIC8vIEJlY2F1c2UgInJlcXVpcmUiLCAiZXhwb3J0cyIgYW5kICJtb2R1bGUiIGFyZW4ndCBhY3R1YWwKICAgICAgICAgICAgICAgICAgICAvLyBkZXBlbmRlbmNpZXMsIHdlIG11c3QgaGFuZGxlIHRoZW0gc2VwZXJhdGVseS4KICAgICAgICAgICAgICAgICAgICBjYXNlICJyZXF1aXJlIjogcmV0dXJuIHJlcTsKICAgICAgICAgICAgICAgICAgICBjYXNlICJleHBvcnRzIjogcmV0dXJuIG1vZHVsZS5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgIGNhc2UgIm1vZHVsZSI6ICByZXR1cm4gbW9kdWxlOwogICAgICAgICAgICAgICAgICAgIC8vIEJ1dCBmb3IgYWxsIG90aGVyIGRlcGVuZGVuY2llcywgd2UgY2FuIGp1c3QgZ28gYWhlYWQgYW5kCiAgICAgICAgICAgICAgICAgICAgLy8gcmVxdWlyZSB0aGVtLgogICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6ICAgICAgICByZXR1cm4gcmVxKGRlcCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgaWYgKHJldHVybkV4cG9ydHMpCiAgICAgICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IHJldHVybkV4cG9ydHM7CiAgICAgICAgICAgIHJldHVybiBtb2R1bGU7CiAgICAgICAgfQogICAgfTsKfTsKd2luZG93LmRlZmluZS5hbWQgPSB7fTsKd2luZG93LnJlcXVpcmUudGxucyA9IHt9Owp3aW5kb3cuaW5pdEJhc2VVcmxzICA9IGZ1bmN0aW9uIGluaXRCYXNlVXJscyh0b3BMZXZlbE5hbWVzcGFjZXMpIHsKICAgIGZvciAodmFyIGkgaW4gdG9wTGV2ZWxOYW1lc3BhY2VzKQogICAgICAgIHRoaXMucmVxdWlyZS50bG5zW2ldID0gdG9wTGV2ZWxOYW1lc3BhY2VzW2ldOwp9OwoKd2luZG93LmluaXRTZW5kZXIgPSBmdW5jdGlvbiBpbml0U2VuZGVyKCkgewoKICAgIHZhciBFdmVudEVtaXR0ZXIgPSB3aW5kb3cucmVxdWlyZSgiYWNlL2xpYi9ldmVudF9lbWl0dGVyIikuRXZlbnRFbWl0dGVyOwogICAgdmFyIG9vcCA9IHdpbmRvdy5yZXF1aXJlKCJhY2UvbGliL29vcCIpOwogICAgCiAgICB2YXIgU2VuZGVyID0gZnVuY3Rpb24oKSB7fTsKICAgIAogICAgKGZ1bmN0aW9uKCkgewogICAgICAgIAogICAgICAgIG9vcC5pbXBsZW1lbnQodGhpcywgRXZlbnRFbWl0dGVyKTsKICAgICAgICAgICAgICAgIAogICAgICAgIHRoaXMuY2FsbGJhY2sgPSBmdW5jdGlvbihkYXRhLCBjYWxsYmFja0lkKSB7CiAgICAgICAgICAgIHBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIHR5cGU6ICJjYWxsIiwKICAgICAgICAgICAgICAgIGlkOiBjYWxsYmFja0lkLAogICAgICAgICAgICAgICAgZGF0YTogZGF0YQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgCiAgICAgICAgdGhpcy5lbWl0ID0gZnVuY3Rpb24obmFtZSwgZGF0YSkgewogICAgICAgICAgICBwb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICB0eXBlOiAiZXZlbnQiLAogICAgICAgICAgICAgICAgbmFtZTogbmFtZSwKICAgICAgICAgICAgICAgIGRhdGE6IGRhdGEKICAgICAgICAgICAgfSk7CiAgICAgICAgfTsKICAgICAgICAKICAgIH0pLmNhbGwoU2VuZGVyLnByb3RvdHlwZSk7CiAgICAKICAgIHJldHVybiBuZXcgU2VuZGVyKCk7Cn07Cgp2YXIgbWFpbiA9IHdpbmRvdy5tYWluID0gbnVsbDsKdmFyIHNlbmRlciA9IHdpbmRvdy5zZW5kZXIgPSBudWxsOwoKd2luZG93Lm9ubWVzc2FnZSA9IGZ1bmN0aW9uKGUpIHsKICAgIHZhciBtc2cgPSBlLmRhdGE7CiAgICBpZiAobXNnLmV2ZW50ICYmIHNlbmRlcikgewogICAgICAgIHNlbmRlci5fc2lnbmFsKG1zZy5ldmVudCwgbXNnLmRhdGEpOwogICAgfQogICAgZWxzZSBpZiAobXNnLmNvbW1hbmQpIHsKICAgICAgICBpZiAobWFpblttc2cuY29tbWFuZF0pCiAgICAgICAgICAgIG1haW5bbXNnLmNvbW1hbmRdLmFwcGx5KG1haW4sIG1zZy5hcmdzKTsKICAgICAgICBlbHNlIGlmICh3aW5kb3db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IGZ1bmN0aW9uIChkb2NMaW5lcywgZGVsdGEsIGRvTm90VmFsaWRhdGUpIHsKICAgIHZhciByb3cgPSBkZWx0YS5zdGFydC5yb3c7CiAgICB2YXIgc3RhcnRDb2x1bW4gPSBkZWx0YS5zdGFydC5jb2x1bW47CiAgICB2YXIgbGluZSA9IGRvY0xpbmVzW3Jvd10gfHwgIiI7CiAgICBzd2l0Y2ggKGRlbHRhLmFjdGlvbikgewogICAgICAgIGNhc2UgImluc2VydCI6CiAgICAgICAgICAgIHZhciBsaW5lcyA9IGRlbHRhLmxpbmVzOwogICAgICAgICAgICBpZiAobGluZXMubGVuZ3RoID09PSAxKSB7CiAgICAgICAgICAgICAgICBkb2NMaW5lc1tyb3ddID0gbGluZS5zdWJzdHJpbmcoMCwgc3RhcnRDb2x1bW4pICsgZGVsdGEubGluZXNbMF0gKyBsaW5lLnN1YnN0cmluZyhzdGFydENvbHVtbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICB2YXIgYXJncyA9IFtyb3csIDFdLmNvbmNhdChkZWx0YS5saW5lcyk7CiAgICAgICAgICAgICAgICBkb2NMaW5lcy5zcGxpY2UuYXBwbHkoZG9jTGluZXMsIGFyZ3MpOwogICAgICAgICAgICAgICAgZG9jTGluZXNbcm93XSA9IGxpbmUuc3Vic3RyaW5nKDAsIHN0YXJ0Q29sdW1uKSArIGRvY0xpbmVzW3Jvd107CiAgICAgICAgICAgICAgICBkb2NMaW5lc1tyb3cgKyBkZWx0YS5saW5lcy5sZW5ndGggLSAxXSArPSBsaW5lLnN1YnN0cmluZyhzdGFydENvbHVtbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgY2FzZSAicmVtb3ZlIjoKICAgICAgICAgICAgdmFyIGVuZENvbHVtbiA9IGRlbHRhLmVuZC5jb2x1bW47CiAgICAgICAgICAgIHZhciBlbmRSb3cgPSBkZWx0YS5lbmQucm93OwogICAgICAg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XN0cnkgfHwge307CiAgICAgICAgdmFyIGxpc3RlbmVycyA9IHRoaXMuX2V2ZW50UmVnaXN0cnlbZXZlbnROYW1lXTsKICAgICAgICBpZiAoIWxpc3RlbmVycykKICAgICAgICAgICAgbGlzdGVuZXJzID0gdGhpcy5fZXZlbnRSZWdpc3RyeVtldmVudE5hbWVdID0gW107CiAgICAgICAgaWYgKGxpc3RlbmVycy5pbmRleE9mKGNhbGxiYWNrKSA9PSAtMSkKICAgICAgICAgICAgbGlzdGVuZXJzW2NhcHR1cmluZyA/ICJ1bnNoaWZ0IiA6ICJwdXNoIl0oY2FsbGJhY2spOwogICAgICAgIHJldHVybiBjYWxsYmFjazsKICAgIH07CkV2ZW50RW1pdHRlci5vZmYgPQogICAgRXZlbnRFbWl0dGVyLnJlbW92ZUxpc3RlbmVyID0KICAgICAgICBFdmVudEVtaXR0ZXIucmVtb3ZlRXZlbnRMaXN0ZW5lciA9IGZ1bmN0aW9uIChldmVudE5hbWUsIGNhbGxiYWNrKSB7CiAgICAgICAgICAgIHRoaXMuX2V2ZW50UmVnaXN0cnkgPSB0aGlzLl9ldmVudFJlZ2lzdHJ5IHx8IHt9OwogICAgICAgICAgICB2YXIgbGlzdGVuZXJzID0gdGhpcy5fZXZlbnRSZWdpc3RyeVtldmVudE5hbWVdOwogICAgICAgICAgICBpZiAoIWxpc3RlbmVycykKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgdmFyIGluZGV4ID0gbGlzdGVuZXJzLmluZGV4T2YoY2FsbGJhY2spOwogICAgICAgICAgICBpZiAoaW5kZXggIT09IC0xKQogICAgICAgICAgICAgICAgbGlzdGVuZXJzLnNwbGljZShpbmRleCwgMSk7CiAgICAgICAgfTsKRXZlbnRFbWl0dGVyLnJlbW92ZUFsbExpc3RlbmVycyA9IGZ1bmN0aW9uIChldmVudE5hbWUpIHsKICAgIGlmICghZXZlbnROYW1lKQogICAgICAgIHRoaXMuX2V2ZW50UmVnaXN0cnkgPSB0aGlz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1bW4gJiYKICAgICAgICAgICAgdGhpcy5lbmQuY29sdW1uID09PSByYW5nZS5lbmQuY29sdW1uOwogICAgfTsKICAgIHRoaXMudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgcmV0dXJuICgiUmFuZ2U6IFsiICsgdGhpcy5zdGFydC5yb3cgKyAiLyIgKyB0aGlzLnN0YXJ0LmNvbHVtbiArCiAgICAgICAgICAgICJdIC0+IFsiICsgdGhpcy5lbmQucm93ICsgIi8iICsgdGhpcy5lbmQuY29sdW1uICsgIl0iKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMDsKICAgIH07CiAgICB0aGlzLmNvbXBhcmVSYW5nZSA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAsIGVuZCA9IHJhbmdlLmVuZCwgc3RhcnQgPSByYW5nZS5zdGFydDsKICAgICAgICBjbXAgPSB0aGlzLmNvbXBhcmUoZW5kLnJvdywgZW5kLmNvbHVtbik7CiAgICAgICAgaWYgKGNtcCA9PSAxKSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSBpZiAoY21wID09IDApIHsKICAgICAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAoY21wID09IC0xKSB7CiAgICAgICAgICAgIHJldHVybiAtMjsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gLTEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDQyOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlUG9pbnQgPSBmdW5jdGlvbiAocCkgewogICAgICAgIHJldHVybiB0aGlzLmNvbXBhcmUocC5yb3csIHAuY29sdW1uKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zUmFuZ2UgPSBmdW5jdGlvbiAocmFuZ2UpIHsKICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlUG9pbnQocmFuZ2Uuc3RhcnQpID09IDAgJiYgdGhpcy5jb21wYXJlUG9pbnQocmFuZ2UuZW5kKSA9PSAwOwogICAgfTsKICAgIHRoaXMuaW50ZXJzZWN0cyA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAgPSB0aGlzLmNvbXBhcmVSYW5nZShyYW5nZSk7CiAgICAgICAgcmV0dXJuIChjbXAgPT0gLTEgfHwgY21wID09IDAgfHwgY21wID09IDEpOwogICAgfTsKICAgIHRoaXMuaXNFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4gdGhpcy5lbmQucm93ID09IHJvdyAmJiB0aGlzLmVuZC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuaXNTdGFydCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHJldHVybiB0aGlzLnN0YXJ0LnJvdyA9PSByb3cgJiYgdGhpcy5zdGFydC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuc2V0U3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IHJvdy5jb2x1bW47CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93LnJvdzsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5zZXRFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSByb3cuY29sdW1uOwogICAgICAgICAgICB0aGlzLmVuZC5yb3cgPSByb3cucm93OwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgdGhpcy5lbmQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSBjb2x1bW47CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuaW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc0VuZChyb3csIGNvbHVtbikgfHwgdGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlU3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodGhpcy5jb21wYXJlKHJvdywgY29sdW1uKSA9PSAwKSB7CiAgICAgICAgICAgIGlmICh0aGlzLmlzRW5kKHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlRW5kID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuY29tcGFyZSA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICghdGhpcy5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgIGlmIChyb3cgPT09IHRoaXMuc3RhcnQucm93KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gY29sdW1uIDwgdGhpcy5zdGFydC5jb2x1bW4gPyAtMSA6IChjb2x1bW4gPiB0aGlzLmVuZC5jb2x1bW4gPyAxIDogMCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuc3RhcnQucm93KQogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHJvdyA+IHRoaXMuZW5kLnJvdykKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09PSByb3cpCiAgICAgICAgICAgIHJldHVybiBjb2x1bW4gPj0gdGhpcy5zdGFydC5jb2x1bW4gPyAwIDogLTE7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PT0gcm93KQogICAgICAgICAgICByZXR1cm4gY29sdW1uIDw9IHRoaXMuZW5kLmNvbHVtbiA/IDAgOiAxOwogICAgICAgIHJldHVybiAwOwogICAgfTsKICAgIHRoaXMuY29tcGFyZVN0YXJ0ID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09IHJvdyAmJiB0aGlzLnN0YXJ0LmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbik7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuY29tcGFyZUVuZCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPT0gcm93ICYmIHRoaXMuZW5kLmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlSW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PSByb3cgJiYgdGhpcy5lbmQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAodGhpcy5zdGFydC5yb3cgPT0gcm93ICYmIHRoaXMuc3RhcnQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jbGlwUm93cyA9IGZ1bmN0aW9uIChmaXJzdFJvdywgbGFzdFJvdykgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPiBsYXN0Um93KQogICAgICAgICAgICB2YXIgZW5kID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLmVuZC5yb3cgPCBmaXJzdFJvdykKICAgICAgICAgICAgdmFyIGVuZCA9IHsgcm93OiBmaXJzdFJvdywgY29sdW1uOiAwIH07CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID4gbGFzdFJvdykKICAgICAgICAgICAgdmFyIHN0YXJ0ID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLnN0YXJ0LnJvdyA8IGZpcnN0Um93KQogICAgICAgICAgICB2YXIgc3RhcnQgPSB7IHJvdzogZmlyc3RSb3csIGNvbHVtbjogMCB9OwogICAgICAgIHJldHVybiBSYW5nZS5mcm9tUG9pbnRzKHN0YXJ0IHx8IHRoaXMuc3RhcnQsIGVuZCB8fCB0aGlzLmVuZCk7CiAgICB9OwogICAgdGhpcy5leHRlbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICB2YXIgY21wID0gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICBpZiAoY21wID09IDApCiAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGVsc2UgaWYgKGNtcCA9PSAtMSkKICAgICAgICAgICAgdmFyIHN0YXJ0ID0geyByb3c6I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GxhcHNlIGluc2VydCByYW5nZS4KICAgICAgICBpZiAoJHBvaW50c0luT3JkZXIocG9pbnQsIGRlbHRhU3RhcnQsIG1vdmVJZkVxdWFsKSkgewogICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgcm93OiBwb2ludC5yb3csCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbgogICAgICAgICAgICB9OwogICAgICAgIH0KICAgICAgICBpZiAoJHBvaW50c0luT3JkZXIoZGVsdGFFbmQsIHBvaW50LCAhbW92ZUlmRXF1YWwpKSB7CiAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICByb3c6IHBvaW50LnJvdyArIGRlbHRhUm93U2hpZnQsCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbiArIChwb2ludC5yb3cgPT0gZGVsdGFFbmQucm93ID8gZGVsdGFDb2xTaGlmdCA6IDApCiAgICAgICAgICAgIH07CiAgICAgICAgfQogICAgICAgIHJldHVybiB7CiAgICAgICAgICAgIHJvdzogZGVsdGFTdGFydC5yb3csCiAgICAgICAgICAgIGNvbHVtbjogZGVsdGFTdGFydC5jb2x1bW4KICAgICAgICB9OwogICAgfQogICAgdGhpcy5zZXRQb3NpdGlvbiA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbiwgbm9DbGlwKSB7CiAgICAgICAgdmFyIHBvczsKICAgICAgICBpZiAobm9DbGlwKSB7CiAgICAgICAgICAgIHBvcyA9IHsKICAgICAgICAgICAgICAgIHJvdzogcm93LAogICAgICAgICAgICAgICAgY29sdW1uOiBjb2x1bW4KICAgICAgICAgICAgfTsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHBvcyA9IHRoaXMuJGNsaXBQb3NpdGlvblRvRG9jdW1lbnQocm93LCBjb2x1bW4pOwogICAgICAgIH0KICAgICAgICBpZiAodGhpcy5yb3cgPT0gcG9zLnJvdyAmJiB0aGlzLmNvbHVtbiA9PSBwb3MuY29sdW1uKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgdmFyIG9sZCA9IHsKICAgICAgICAgICAgcm93OiB0aGlzLnJvdywKICAgICAgICAgICAgY29sdW1uOiB0aGlzLmNvbHVtbgogICAgICAgIH07CiAgICAgICAgdGhpcy5yb3cgPSBwb3Mucm93OwogICAgICAgIHRoaXMuY29sdW1uID0gcG9zLmNvbHVtbjsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZSIsIHsKICAgICAgICAgICAgb2xkOiBvbGQsCiAgICAgICAgICAgIHZhbHVlOiBwb3MKICAgICAgICB9KTsKICAgIH07CiAgICB0aGlzLmRldGFjaCA9IGZ1bmN0aW9uICgpIHsKICAgICAgICB0aGlzLmRvY3VtZW50Lm9mZigiY2hhbmdlIiwgdGhpcy4kb25DaGFuZ2UpOwogICAgfTsKICAgIHRoaXMuYXR0YWNoID0gZnVuY3Rpb24gKGRvYykgewogICAgICAgIHRoaXMuZG9jdW1lbnQgPSBkb2MgfHwgdGhpcy5kb2N1bWVudDsKICAgICAgICB0aGlzLmRvY3VtZW50Lm9uKCJjaGFuZ2UiLCB0aGlzLiRvbkNoYW5nZSk7CiAgICB9OwogICAgdGhpcy4kY2xpcFBvc2l0aW9uVG9Eb2N1bWVudCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHZhciBwb3MgPSB7fTsKICAgICAgICBpZiAocm93ID49IHRoaXMuZG9jdW1lbnQuZ2V0TGVuZ3RoKCkpIHsKICAgICAgICAgICAgcG9zLnJvdyA9IE1hdGgubWF4KDAsIHRoaXMuZG9jdW1lbnQuZ2V0TGVuZ3RoKCkgLSAxKTsKICAgICAgICAgICAgcG9zLmNvbHVtbiA9IHRoaXMuZG9jdW1lbnQuZ2V0TGluZShwb3Mucm93KS5sZW5ndGg7CiAgICAgICAgfQogICAgICAgIGVsc2UgaWYgKHJvdyA8IDApIHsKICAgICAgICAgICAgcG9zLnJvdyA9IDA7CiAgICAgICAgICAgIHB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ICAgIHRoaXMuJGRldGVjdE5ld0xpbmUgPSBmdW5jdGlvbiAodGV4dCkgewogICAgICAgIHZhciBtYXRjaCA9IHRleHQubWF0Y2goL14uKj8oXHJcbnxccnxcbikvbSk7CiAgICAgICAgdGhpcy4kYXV0b05ld0xpbmUgPSBtYXRjaCA/IG1hdGNoWzFdIDogIlxuIjsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lQ2hhcmFjdGVyID0gZnVuY3Rpb24gKCkgewogICAgICAgIHN3aXRjaCAodGhpcy4kbmV3TGluZU1vZGUpIHsKICAgICAgICAgICAgY2FzZSAid2luZG93cyI6CiAgICAgICAgICAgICAgICByZXR1cm4gIlxyXG4iOwogICAgICAgICAgICBjYXNlICJ1bml4IjoKICAgICAgICAgICAgICAgIHJldHVybiAiXG4iOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuJGF1dG9OZXdMaW5lIHx8ICJcbiI7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuJGF1dG9OZXdMaW5lID0gIiI7CiAgICB0aGlzLiRuZXdMaW5lTW9kZSA9ICJhdXRvIjsKICAgIHRoaXMuc2V0TmV3TGluZU1vZGUgPSBmdW5jdGlvbiAobmV3TGluZU1vZGUpIHsKICAgICAgICBpZiAodGhpcy4kbmV3TGluZU1vZGUgPT09IG5ld0xpbmVNb2RlKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgdGhpcy4kbmV3TGluZU1vZGUgPSBuZXdMaW5lTW9kZTsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lTW9kZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICByZXR1cm4gdGhpcy4kbmV3TGluZU1vZGU7CiAgICB9OwogICAgdGhpcy5pc05ld0xpbmUgPSBm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3cgPT09IHVuZGVmaW5lZCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGg7CiAgICAgICAgfQogICAgICAgIGVsc2UgaWYgKHJvdyA8IDApIHsKICAgICAgICAgICAgcm93ID0gMDsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAocm93ID49IGxlbmd0aCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGggLSAxOwogICAgICAgICAgICBjb2x1bW4gPSB1bmRlZmluZWQ7CiAgICAgICAgfQogICAgICAgIHZhciBsaW5lID0gdGhpcy5nZXRMaW5lKHJvdyk7CiAgICAgICAgaWYgKGNvbHVtbiA9PSB1bmRlZmluZWQpCiAgICAgICAgICAgIGNvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIGNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KGNvbHVtbiwgMCksIGxpbmUubGVuZ3RoKTsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLmNsb25lUG9zID0gZnVuY3Rpb24gKHBvcykgewogICAgICAgIHJldHVybiB7IHJvdzogcG9zLnJvdywgY29sdW1uOiBwb3MuY29sdW1uIH07CiAgICB9OwogICAgdGhpcy5wb3MgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLiRjbGlwUG9zaXRpb24gPSBmdW5jdGlvbiAocG9zaXRpb24pIHsKICAgICAgICB2YXIgbGVuZ3RoID0gdGhpcy5nZXRMZW5ndGgoKTsKICAgICAgICBpZiAocG9zaXRpb24ucm93ID49IGxlbmd0aCkgewogICAgICAgICAgICBwb3NpdGlvbi5yb3cgPSBNYXRoLm1heCgwLCBsZW5ndGggLSAxKTsKICAgICAgICAgICAgcG9zaXRpb24uY29sdW1uID0gdGhpcy5nZXRMaW5lKGxlbmd0aCAtIDEpLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHBvc2l0aW9uLnJvdyA9IE1hdGgubWF4KDAsIHBvc2l0aW9uLnJvdyk7CiAgICAgICAgICAgIHBvc2l0aW9uLmNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KHBvc2l0aW9uLmNvbHVtbiwgMCksIHRoaXMuZ2V0TGluZShwb3NpdGlvbi5yb3cpLmxlbmd0aCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBwb3NpdGlvbjsKICAgIH07CiAgICB0aGlzLmluc2VydEZ1bGxMaW5lcyA9IGZ1bmN0aW9uIChyb3csIGxpbmVzKSB7CiAgICAgICAgcm93ID0gTWF0aC5taW4oTWF0aC5tYXgocm93LCAwKSwgdGhpcy5nZXRMZW5ndGgoKSk7CiAgICAgICAgdmFyIGNvbHVtbiA9IDA7CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuZ2V0TGVuZ3RoKCkpIHsKICAgICAgICAgICAgbGluZXMgPSBsaW5lcy5jb25jYXQoWyIiXSk7CiAgICAgICAgICAgIGNvbHVtbiA9IDA7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICBsaW5lcyA9IFsiIl0uY29uY2F0KGxpbmVzKTsKICAgICAgICAgICAgcm93LS07CiAgICAgICAgICAgIGNvbHVtbiA9IHRoaXMuJGxpbmVzW3Jvd10ubGVuZ3RoOwogICAgICAgIH0KICAgICAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzKHsgcm93OiByb3csIGNvbHVtbjogY29sdW1uIH0sIGxpbmVzKTsKICAgIH07CiAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzID0gZnVuY3Rpb24gKHBvc2l0aW9uLCBsaW5lcykgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhwb3NpdGlvbi5yb3csIHBvc2l0aW9uLmNvbHVtbik7CiAgICAgICAgdmFyIGVuZCA9IHsKICAgICAgICAgICAgcm93OiBzd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2YXIgbGluZXMgPSBkZWx0YS5saW5lczsKICAgICAgICB2YXIgbCA9IGxpbmVzLmxlbmd0aCAtIE1BWCArIDE7CiAgICAgICAgdmFyIHJvdyA9IGRlbHRhLnN0YXJ0LnJvdzsKICAgICAgICB2YXIgY29sdW1uID0gZGVsdGEuc3RhcnQuY29sdW1uOwogICAgICAgIGZvciAodmFyIGZyb20gPSAwLCB0byA9IDA7IGZyb20gPCBsOyBmcm9tID0gdG8pIHsKICAgICAgICAgICAgdG8gKz0gTUFYIC0gMTsKICAgICAgICAgICAgdmFyIGNodW5rID0gbGluZXMuc2xpY2UoZnJvbSwgdG8pOwogICAgICAgICAgICBjaHVuay5wdXNoKCIiKTsKICAgICAgICAgICAgdGhpcy5hcHBseURlbHRhKHsKICAgICAgICAgICAgICAgIHN0YXJ0OiB0aGlzLnBvcyhyb3cgKyBmcm9tLCBjb2x1bW4pLAogICAgICAgICAgICAgICAgZW5kOiB0aGlzLnBvcyhyb3cgKyB0bywgY29sdW1uID0gMCksCiAgICAgICAgICAgICAgICBhY3Rpb246IGRlbHRhLmFjdGlvbiwKICAgICAgICAgICAgICAgIGxpbmVzOiBjaHVuawogICAgICAgICAgICB9LCB0cnVlKTsKICAgICAgICB9CiAgICAgICAgZGVsdGEubGluZXMgPSBsaW5lcy5zbGljZShmcm9tKTsKICAgICAgICBkZWx0YS5zdGFydC5yb3cgPSByb3cgKyBmcm9tOwogICAgICAgIGRlbHRhLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoZGVsdGEsIHRydWUpOwogICAgfTsKICAgIHRoaXMucmV2ZXJ0RGVsdGEgPSBmdW5jdGlvbiAoZGVsdGEpIHsKICAgICAgICB0aGlzLiRzYWZlQXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiB0aGlzLmNsb25lUG9zKGRlbHRhLnN0YXJ0KSwKICAgICAgICAgICAgZW5kOiB0aGlzLmNsb25lUG9zKGRl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W5nKSB7CiAgICByZXR1cm4gc3RyaW5nLnJlcGxhY2UodHJpbUJlZ2luUmVnZXhwLCAnJyk7Cn07CmV4cG9ydHMuc3RyaW5nVHJpbVJpZ2h0ID0gZnVuY3Rpb24gKHN0cmluZykgewogICAgcmV0dXJuIHN0cmluZy5yZXBsYWNlKHRyaW1FbmRSZWdleHAsICcnKTsKfTsKZXhwb3J0cy5jb3B5T2JqZWN0ID0gZnVuY3Rpb24gKG9iaikgewogICAgdmFyIGNvcHkgPSB7fTsKICAgIGZvciAodmFyIGtleSBpbiBvYmopIHsKICAgICAgICBjb3B5W2tleV0gPSBvYmpba2V5XTsKICAgIH0KICAgIHJldHVybiBjb3B5Owp9OwpleHBvcnRzLmNvcHlBcnJheSA9IGZ1bmN0aW9uIChhcnJheSkgewogICAgdmFyIGNvcHkgPSBbXTsKICAgIGZvciAodmFyIGkgPSAwLCBsID0gYXJyYXkubGVuZ3RoOyBpIDwgbDsgaSsrKSB7CiAgICAgICAgaWYgKGFycmF5W2ldICYmIHR5cGVvZiBhcnJheVtpXSA9PSAib2JqZWN0IikKICAgICAgICAgICAgY29weVtpXSA9IHRoaXMuY29weU9iamVjdChhcnJheVtpXSk7CiAgICAgICAgZWxzZQogICAgICAgICAgICBjb3B5W2ldID0gYXJyYXlbaV07CiAgICB9CiAgICByZXR1cm4gY29weTsKfTsKZXhwb3J0cy5kZWVwQ29weSA9IGZ1bmN0aW9uIGRlZXBDb3B5KG9iaikgewogICAgaWYgKHR5cGVvZiBvYmogIT09ICJvYmplY3QiIHx8ICFvYmopCiAgICAgICAgcmV0dXJuIG9iajsKICAgIHZhciBjb3B5OwogICAgaWYgKEFycmF5LmlzQXJyYXkob2JqKSkgewogICAgICAgIGNvcHkgPSBbXTsKICAgICAgICBmb3IgKHZhciBrZXkgPSAwOyBrZXkgPCBvYmoubGVuZ3RoOyBrZXkrKykgewogICAgICAgICAgICBjb3B5W2tleV0gPSBkZWVwQ29weShvYmpba2V5XSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBjb3B5OwogICAgfQogICAgaWYgKE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChvYmopICE9PSAiW29iamVjdCBPYmplY3RdIikKICAgICAgICByZXR1cm4gb2JqOwogICAgY29weSA9IHt9OwogICAgZm9yICh2YXIga2V5IGluIG9iaikKICAgICAgICBjb3B5W2tleV0gPSBkZWVwQ29weShvYmpba2V5XSk7CiAgICByZXR1cm4gY29weTsKfTsKZXhwb3J0cy5hcnJheVRvTWFwID0gZnVuY3Rpb24gKGFycikgewogICAgdmFyIG1hcCA9IHt9OwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHsKICAgICAgICBtYXBbYXJyW2ldXSA9IDE7CiAgICB9CiAgICByZXR1cm4gbWFwOwp9OwpleHBvcnRzLmNyZWF0ZU1hcCA9IGZ1bmN0aW9uIChwcm9wcykgewogICAgdmFyIG1hcCA9IE9iamVjdC5jcmVhdGUobnVsbCk7CiAgICBmb3IgKHZhciBpIGluIHByb3BzKSB7CiAgICAgICAgbWFwW2ldID0gcHJvcHNbaV07CiAgICB9CiAgICByZXR1cm4gbWFwOwp9OwpleHBvcnRzLmFycmF5UmVtb3ZlID0gZnVuY3Rpb24gKGFycmF5LCB2YWx1ZSkgewogICAgZm9yICh2YXIgaSA9IDA7IGkgPD0gYXJyYXkubGVuZ3RoOyBpKyspIHsKICAgICAgICBpZiAodmFsdWUgPT09IGFycmF5W2ldKSB7CiAgICAgICAgICAgIGFycmF5LnNwbGljZShpLCAxKTsKICAgICAgICB9CiAgICB9Cn07CmV4cG9ydHMuZXNjYXBlUmVnRXhwID0gZnVuY3Rpb24gKHN0cikgewogICAgcmV0dXJuIHN0ci5yZXBsYWNlKC8oWy4qKz9eJHt9KCl8W1xdXC9cXF0pL2csICdcXCQxJyk7Cn07CmV4cG9ydHMuZXNjYXBlSFRNTCA9IGZ1bmN0aW9uIChzdHIpIHsKICAgIHJldHVybiAoIiIg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LCBsaW5lczogZGF0YVtpKzFdfTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgZCA9IHthY3Rpb246ICJyZW1vdmUiLCBzdGFydDogZGF0YVtpXSwgZW5kOiBkYXRhW2krMV19OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBpZiAoKGQuYWN0aW9uID09ICJpbnNlcnQiID8gZC5zdGFydCA6IGQuZW5kKS5yb3cgPj0gZG9jLiRsaW5lcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICBlcnIgPSBuZXcgRXJyb3IoIkludmFsaWQgZGVsdGEiKTsKICAgICAgICAgICAgICAgICAgICBlcnIuZGF0YSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogX3NlbGYuJHBhdGgsCiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzTGVuZ3RoOiBkb2MuJGxpbmVzLmxlbmd0aCwKICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQ6IGQuc3RhcnQsCiAgICAgICAgICAgICAgICAgICAgICAgIGVuZDogZC5lbmQKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHRocm93IGVycjsKICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICBkb2MuYXBwbHlEZWx0YShkLCB0cnVlKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoX3NlbGYuJHRpbWVvdXQpCiAgICAgICAgICAgIHJldHVybiBkZWZlcnJlZFVwZGF0ZS5zY2hlZHVsZShfc2VsZi4kdGltZW91dCk7CiAgICAgICAgX3NlbGYub25VcGRhdGUoKTsKICAgIH0pOwp9OwoKKGZ1bmN0aW9uKCkgewogICAgCiAgICB0aGlzLiR0aW1lb3V0ID0gNTAwOwogICAgCiAgICB0aGlzLnNldFRpbWVvdXQgPSBmdW5jdGlvbih0aW1lb3V0KSB7CiAgICAgICAgdGhpcy4kdGltZW91dCA9IHRpbWVvdXQ7CiAgICB9OwogICAgCiAgICB0aGlzLnNldFZhbHVlID0gZnVuY3Rpb24odmFsdWUpIHsKICAgICAgICB0aGlzLmRvYy5zZXRWYWx1ZSh2YWx1ZSk7CiAgICAgICAgdGhpcy5kZWZlcnJlZFVwZGF0ZS5zY2hlZHVsZSh0aGlzLiR0aW1lb3V0KTsKICAgIH07CiAgICAKICAgIHRoaXMuZ2V0VmFsdWUgPSBmdW5jdGlvbihjYWxsYmFja0lkKSB7CiAgICAgICAgdGhpcy5zZW5kZXIuY2FsbGJhY2sodGhpcy5kb2MuZ2V0VmFsdWUoKSwgY2FsbGJhY2tJZCk7CiAgICB9OwogICAgCiAgICB0aGlzLm9uVXBkYXRlID0gZnVuY3Rpb24oKSB7CiAgICB9OwogICAgCiAgICB0aGlzLmlzUGVuZGluZyA9IGZ1bmN0aW9uKCkgewogICAgICAgIHJldHVybiB0aGlzLmRlZmVycmVkVXBkYXRlLmlzUGVuZGluZygpOwogICAgfTsKICAgIAp9KS5jYWxsKE1pcnJvci5wcm90b3R5cGUpOwoKfSk7CgphY2UuZGVmaW5lKCJhY2UvbW9kZS9qc29uL2pzb25fcGFyc2UiLFtdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpIHsKInVzZSBzdHJpY3QiOwoKICAgIHZhciBhdCwgICAgIC8vIFRoZSBpbmRleCBvZiB0aGUgY3VycmVudCBjaGFyYWN0ZXIKICAgICAgICBjaCwgICAgIC8vIFRoZSBjdXJyZW50IGNoYXJhY3RlcgogICAgICAgIGVzY2FwZWUgPSB7CiAgICAgICAgICAgICciJzogICciJywKICAgICAgICAgICAgJ1xcJzogJ1xcJywKICAgICAgICAgICAgJy8nOiAgJy8nLAogICAgICAgICAgICBiOiAgICAnXGInLAogICAgICAgICAgICBmOiAgICAnXGYnLAogICAgICAgICAgICBuOiAgICAnXG4nLAogICAgICAgICAgICByOiAgICAnXHInLAogICAgICAgICAgICB0OiAgICAnXHQnCiAgICAgICAgfSwKICAgICAgICB0ZXh0LAoKICAgICAgICBlcnJvciA9IGZ1bmN0aW9uIChtKSB7CgogICAgICAgICAgICB0aHJvdyB7CiAgICAgICAgICAgICAgICBuYW1lOiAgICAnU3ludGF4RXJyb3InLAogICAgICAgICAgICAgICAgbWVzc2FnZTogbSwKICAgICAgICAgICAgICAgIGF0OiAgICAgIGF0LAogICAgICAgICAgICAgICAgdGV4dDogICAgdGV4dAogICAgICAgICAgICB9OwogICAgICAgIH0sCgogICAgICAgIG5leHQgPSBmdW5jdGlvbiAoYykgewoKICAgICAgICAgICAgaWYgKGMgJiYgYyAhPT0gY2gpIHsKICAgICAgICAgICAgICAgIGVycm9yKCJFeHBlY3RlZCAnIiArIGMgKyAiJyBpbnN0ZWFkIG9mICciICsgY2ggKyAiJyIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBjaCA9IHRleHQuY2hhckF0KGF0KTsKICAgICAgICAgICAgYXQgKz0gMTsKICAgICAgICAgICAgcmV0dXJuIGNoOwogICAgICAgIH0sCgogICAgICAgIG51bWJlciA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHZhciBudW1iZXIsCiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnJzsKCiAgICAgICAgICAgIGlmIChjaCA9PT0gJy0nKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnLSc7CiAgICAgICAgICAgICAgICBuZXh0KCctJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgd2hpbGUgKGNoID49ICcwJyAmJiBjaCA8PSAnOScpIHsKICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICcuJykgewogICAgICAgICAgICAgICAgc3RyaW5nICs9ICcuJzsKICAgICAgICAgICAgICAgIHdoaWxlIChuZXh0KCkgJiYgY2ggPj0gJzAnICYmIGNoIDw9ICc5JykgewogICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICdlJyB8fCBjaCA9PT0gJ0UnKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgKz0gY2g7CiAgICAgICAgICAgICAgICBuZXh0KCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICctJyB8fCBjaCA9PT0gJysnKSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHdoaWxlIChjaCA+PSAnMCcgJiYgY2ggPD0gJzknKSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBudW1iZXIgPSArc3RyaW5nOwogICAgICAgICAgICBpZiAoaXNOYU4obnVtYmVyKSkgewogICAgICAgICAgICAgICAgZXJyb3IoIkJhZCBudW1iZXIiKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHJldHVybiBudW1iZXI7CiAgICAgICAgICAgIH0KICAgICAgICB9LAoKICAgICAgICBzdHJpbmcgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICB2YXIgaGV4LAogICAgICAgICAgICAgICAgaSwKICAgICAgICAgICAgICAgIHN0cmluZyA9ICcnLAogICAgICAgICAgICAgICAgdWZmZmY7CgogICAgICAgICAgICBpZiAoY2ggPT09ICciJykgewogICAgICAgICAgICAgICAgd2hpbGUgKG5leHQoKSkgewogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJyInKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0cmluZzsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAnXFwnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoID09PSAndScpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVmZmZmID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCA0OyBpICs9IDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXggPSBwYXJzZUludChuZXh0KCksIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzRmluaXRlKGhleCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVmZmZmID0gdWZmZmYgKiAxNiArIGhleDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKHVmZmZmKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgZXNjYXBlZVtjaF0gPT09ICdzdHJpbmcnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgKz0gZXNjYXBlZVtjaF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT0gIlxuIiB8fCBjaCA9PSAiXHIiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXJyb3IoIkJhZCBzdHJpbmciKTsKICAgICAgICB9LAoKICAgICAgICB3aGl0ZSA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHdoaWxlIChjaCAmJiBjaCA8PSAnICcpIHsKICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgfQogICAgICAgIH0sCgogICAgICAgIHdvcmQgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICBzd2l0Y2ggKGNoKSB7CiAgICAgICAgICAgIGNhc2UgJ3QnOgogICAgICAgICAgICAgICAgbmV4dCgndCcpOwogICAgICAgICAgICAgICAgbmV4dCgncicpOwogICAgICAgICAgICAgICAgbmV4dCgndScpOwogICAgICAgICAgICAgICAgbmV4dCgnZScpOwogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIGNhc2UgJ2YnOgogICAgICAgICAgICAgICAgbmV4dCgnZicpOwogICAgICAgICAgICAgICAgbmV4dCgnYScpOwogICAgICAgICAgICAgICAgbmV4dCgnbCcpOwogICAgICAgICAgICAgICAgbmV4dCgncycpOwogICAgICAgICAgICAgICAgbmV4dCgnZScpOwogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICBjYXNlICduJzoKICAgICAgICAgICAgICAgIG5leHQoJ24nKTsKICAgICAgICAgICAgICAgIG5leHQoJ3UnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2wnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2wnKTsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVycm9yKCJVbmV4cGVjdGVkICciICsgY2ggKyAiJyIpOwogICAgICAgIH0sCgogICAgICAgIHZhbHVlLCAgLy8gUGxhY2UgaG9sZGVyIGZvciB0aGUgdmFsdWUgZnVuY3Rpb24uCgogICAgICAgIGFycmF5ID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgdmFyIGFycmF5ID0gW107CgogICAgICAgICAgICBpZiAoY2ggPT09ICdbJykgewogICAgICAgICAgICAgICAgbmV4dCgnWycpOwogICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnXScpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhcnJheTsgICAvLyBlbXB0eSBhcnJheQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGNoKSB7CiAgICAgICAgICAgICAgICAgICAgYXJyYXkucHVzaCh2YWx1ZSgpKTsKICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoJ10nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFycmF5OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBuZXh0KCcsJyk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBlcnJvcigiQmFkIGFycmF5Iik7CiAgICAgICAgfSwKCiAgICAgICAgb2JqZWN0ID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgdmFyIGtleSwKICAgICAgICAgICAgICAgIG9iamVjdCA9IHt9OwoKICAgICAgICAgICAgaWYgKGNoID09PSAneycpIHsKICAgICAgICAgICAgICAgIG5leHQoJ3snKTsKICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICd9JykgewogICAgICAgICAgICAgICAgICAgIG5leHQoJ30nKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gb2JqZWN0OyAgIC8vIGVtcHR5IG9iamVjdAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGNoKSB7CiAgICAgICAgICAgICAgICAgICAga2V5ID0gc3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgICAgICBuZXh0KCc6Jyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iamVjdCwga2V5KSkgewogICAgICAgICAgICAgICAgICAgICAgICBlcnJvcignRHVwbGljYXRlIGtleSAiJyArIGtleSArICciJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIG9iamVjdFtrZXldID0gdmFsdWUoKTsKICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ30nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoJ30nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9iamVjdDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnLCcpOwogICAgICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXJyb3IoIkJhZCBvYmplY3QiKTsKICAgICAgICB9OwoKICAgIHZhbHVlID0gZnVuY3Rpb24gKCkgewoKICAgICAgICB3aGl0ZSgpOwogICAgICAgIHN3aXRjaCAoY2gpIHsKICAgICAgICBjYXNlICd7JzoKICAgICAgICAgICAgcmV0dXJuIG9iamVjdCgpOwogICAgICAgIGNhc2UgJ1snOgogICAgICAgICAgICByZXR1cm4gYXJyYXkoKTsKICAgICAgICBjYXNlICciJzoKICAgICAgICAgICAgcmV0dXJuIHN0cmluZygpOwogICAgICAgIGNhc2UgJy0nOgogICAgICAgICAgICByZXR1cm4gbnVtYmVyKCk7CiAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgcmV0dXJuIGNoID49ICcwJyAmJiBjaCA8PSAnOScgPyBudW1iZXIoKSA6IHdvcmQoKTsKICAgICAgICB9CiAgICB9OwoKICAgIHJldHVybiBmdW5jdGlvbiAoc291cmNlLCByZXZpdmVyKSB7CiAgICAgICAgdmFyIHJlc3VsdDsKCiAgICAgICAgdGV4dCA9IHNvdXJjZTsKICAgICAgICBhdCA9IDA7CiAgICAgICAgY2ggPSAnICc7CiAgICAgICAgcmVzdWx0ID0gdmFsdWUoKTsKICAgICAgICB3aGl0ZSgpOwogICAgICAgIGlmIChjaCkgewogICAgICAgICAgICBlcnJvcigiU3ludGF4IGVycm9yIik7CiAgICAgICAgfQoKICAgICAgICByZXR1cm4gdHlwZW9mIHJldml2ZXIgPT09ICdmdW5jdGlvbicgPyBmdW5jdGlvbiB3YWxrKGhvbGRlciwga2V5KSB7CiAgICAgICAgICAgIHZhciBrLCB2LCB2YWx1ZSA9IGhvbGRlcltrZXldOwogICAgICAgICAgICBpZiAodmFsdWUgJiYgdHlwZW9mIHZhbHVlID09PSAnb2JqZWN0JykgewogICAgICAgICAgICAgICAgZm9yIChrIGluIHZhbHVlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKHZhbHVlLCBrKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2ID0gd2Fsayh2YWx1ZSwgayk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2ICE9PSB1bmRlZmluZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlW2tdID0gdjsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB2YWx1ZVtrXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm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gICAgICAgICAgICAgdHlwZTogImVycm9yIgogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgdGhpcy5zZW5kZXIuZW1pdCgiYW5ub3RhdGUiLCBlcnJvcnMpOwogICAgfTsKCn0pLmNhbGwoSnNvbldvcmtlci5wcm90b3R5cGUpOwoKfSk7Cg==";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$w=vue.defineComponent({__name:"code-edit-modal",props:{modelValue:{default:()=>({})},lang:{default:"json"},title:{default:"编辑"}},emits:["update:modelValue","close"],setup(r,{emit:n}){const i=r,o=vue.ref(!1),a=vue.computed({get(){return i.lang==="json"?JSON.stringify(i.modelValue,null,2):i.modelValue},set(u){i.lang==="json"?n("update:modelValue",JSON.parse(u)):n("update:modelValue",u)}});return(u,c)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElButton),{onClick:c[0]||(c[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":c[2]||(c[2]=f=>vue.isRef(o)?o.value=f:null),title:i.title,width:"60%",onClose:c[3]||(c[3]=f=>n("close"))},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(VAceEditor),{value:vue.unref(a),"onUpdate:value":c[1]||(c[1]=f=>vue.isRef(a)?a.value=f:null),lang:i.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$b={class:"one-row-txt",style:{width:"78px"}},_hoisted_2$8={key:1},_hoisted_3$7={class:"one-row-txt",style:{width:"145px"}},_hoisted_4$3={key:1},_sfc_main$v=vue.defineComponent({__name:"dynamic-el-form-item",props:{objInfo:{default:()=>({})},hide:{default:()=>[]},code:{type:Boolean,default:!1}},emits:["change"],setup(r,{emit:n}){const i=r;function o(a){let u=window.setTimeout(function(){n("change",a),clearTimeout(u),u=null},200)}return(a,u)=>(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(i.objInfo,(c,f)=>(vue.openBlock(),vue.createElementBlock("div",{key:f},[i.code?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,class:"props-row",size:"small"},{label:vue.withCtx(()=>[vue.unref(getStringWidth)(String(f))>78?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:String(f),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$b,vue.toDisplayString(f),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$8,vue.toDisplayString(f),1))]),default:vue.withCtx(()=>[vue.unref(getStringWidth)(String(c.val))>145?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:JSON.stringify(c.val),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$7,vue.toDisplayString(c.val),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$3,vue.toDisplayString(c.val),1))]),_:2},1024)):vue.createCommentVNode("",!0),i.hide.indexOf(String(f))<0?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:1,label:c.title,size:"small"},{default:vue.withCtx(()=>[c.type===vue.unref(EConfigItemPropsType).Select?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSelect),{key:0,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,placeholder:"Select",size:"small",disabled:!!(c!=null&&c.disabled),onChange:o},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(c.options,d=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).InputNumber?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInputNumber),{key:1,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Input?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:2,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Textarea?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:3,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,autosize:"",type:"textarea",disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Color?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElColorPicker),{key:4,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).Switch?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSwitch),{key:5,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onChange:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):c.type===vue.unref(EConfigItemPropsType).JsonEdit?(vue.openBlock(),vue.createBlock(_sfc_main$w,{key:6,modelValue:c.val,"onUpdate:modelValue":d=>c.val=d,disabled:!!(c!=null&&c.disabled),onClose:o},null,8,["modelValue","onUpdate:modelValue","disabled"])):vue.createCommentVNode("",!0)]),_:2},1032,["label"])):vue.createCommentVNode("",!0)]))),128))}}),dynamicElFormItem_vue_vue_type_style_index_0_scoped_df8be28f_lang="",dynamicElFormItem_vue_vue_type_style_index_1_lang="",DynamicElFormItem=_export_sfc$1(_sfc_main$v,[["__scopeId","data-v-df8be28f"]]),_hoisted_1$a={style:{height:"100%"}},_hoisted_2$7={class:"flex flex-wrap"},_hoisted_3$6=["onMouseenter","onClick"],_sfc_main$u=vue.defineComponent({__name:"common-animate",props:{val:{}},emits:["updateCommonAniVal"],setup(r,{emit:n}){const i=r,o=vue.ref(i.val),a=vue.ref(!1),u=vue.ref("进入"),c=vue.ref(null),f=d=>{n("updateCommonAniVal",d),a.value=!1};return vue.watch(()=>i.val,d=>{o.value=d}),(d,p)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$a,[vue.unref(o)?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:0,closable:"",onClose:p[0]||(p[0]=h=>f("")),onClick:p[1]||(p[1]=h=>a.value=!0),style:{cursor:"pointer"}},{default:vue.withCtx(()=>{var h;return[vue.createTextVNode(vue.toDisplayString((h=vue.unref(common_animate_list).map(g=>g.children).reduce((g,v)=>g.concat(v)).find(g=>g.value==vue.unref(o)))==null?void 0:h.label)+" ",1),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:10},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"setting"})]),_:1})]}),_:1})):(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:1,type:"success",style:{cursor:"pointer"},onClick:p[2]||(p[2]=h=>a.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("新增")]),_:1})),vue.createVNode(vue.unref(elementPlus.ElDrawer),{modelValue:vue.unref(a),"onUpdate:modelValue":p[5]||(p[5]=h=>vue.isRef(a)?a.value=h:null),title:"选择动画",direction:"ltr"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElTabs),{modelValue:vue.unref(u),"onUpdate:modelValue":p[4]||(p[4]=h=>vue.isRef(u)?u.value=h:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(common_animate_list),h=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTabPane),{label:h.label,name:h.label,key:h.label},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{height:"500px"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_2$7,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(h.children,(g,v)=>(vue.openBlock(),vue.createElementBlock("div",{class:"animate",key:v,onMouseenter:y=>c.value=v,onMouseleave:p[3]||(p[3]=y=>c.value=null),onClick:y=>f(g.value)},[vue.createElementVNode("div",{class:vue.normalizeClass(`${vue.unref(c)==v?`animate__animated animate__${g.value} animate__slow animate__infinite`:""}`)},vue.toDisplayString(g.label),3)],40,_hoisted_3$6))),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$u,[["__scopeId","data-v-2668f60c"]]),_sfc_main$t=vue.defineComponent({__name:"component-tree",setup(r){const n=useGlobalStore(pinia),i=vue.computed(()=>{var u;return((u=n.handle_svg_info)==null?void 0:u.info.id)??""}),o=u=>{for(let c of n.done_json)c.selected=!1,c.old_position={x:0,y:0};n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo(u)},a={children:"children",label:"title"};return(u,c)=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTree),{class:"tree-v",data:vue.unref(n).done_json,props:a,onNodeClick:o,"default-expand-all":!0,"expand-on-click-node":!1,"highlight-current":!!vue.unref(i),"node-key":"id","current-node-key":vue.unref(i)},null,8,["data","highlight-current","current-node-key"]))}}),_withScopeId$1=r=>(vue.pushScopeId("data-v-98320511"),r=r(),vue.popScopeId(),r),_hoisted_1$9={class:"wall-l"},_hoisted_2$6={class:"head-l"},_hoisted_3$5=_withScopeId$1(()=>vue.createElementVNode("span",null,"key",-1)),_hoisted_4$2=_withScopeId$1(()=>vue.createElementVNode("span",null,"value",-1)),_hoisted_5$1={class:"row-l"},_sfc_main$s=vue.defineComponent({__name:"list",props:{modelValue:{default:()=>[{key:"",val:""}]}},emits:["update:modelValue"],setup(r,{emit:n}){const i=r,o=vue.computed({get(){return i.modelValue},set(c){n("update:modelValue",c)}}),a=()=>{o.value.push({key:"",val:""})},u=c=>{o.value.splice(c,1)};return(c,f)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$9,[vue.createElementVNode("div",_hoisted_2$6,[_hoisted_3$5,_hoisted_4$2,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:a},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"add"})]),_:1})]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(o),(d,p)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,[vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:d.key,"onUpdate:modelValue":h=>d.key=h,size:"small",placeholder:"key"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:d.val,"onUpdate:modelValue":h=>d.val=h,size:"small",placeholder:"value"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:h=>u(p)},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$D,{name:"delete"})]),_:2},1032,["onClick"])]))),256))]))}}),list_vue_vue_type_style_index_0_scoped_98320511_lang="",List=_export_sfc$1(_sfc_main$s,[["__scopeId","data-v-98320511"]]),composeEventHandlers=(r,n,{checkForDefaultPrevented:i=!0}={})=>a=>{const u=r==null?void 0:r(a);if(i===!1||!u)return n==null?void 0:n(a)};var _a;const isClient=typeof window<"u",isString$1=r=>typeof r=="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(r){return typeof r=="function"?r():vue.unref(r)}function createFilterWrapper(r,n){function i(...o){return new Promise((a,u)=>{Promise.resolve(r(()=>n.apply(this,o),{fn:n,thisArg:this,args:o})).then(a).catch(u)})}return i}function debounceFilter(r,n={}){let i,o,a=noop;const u=f=>{clearTimeout(f),a(),a=noop};return f=>{const d=resolveUnref(r),p=resolveUnref(n.maxWait);return i&&u(i),d<=0||p!==void 0&&p<=0?(o&&(u(o),o=null),Promise.resolve(f())):new Promise((h,g)=>{a=n.rejectOnCancel?g:h,p&&!o&&(o=setTimeout(()=>{i&&u(i),o=null,h(f())},p)),i=setTimeout(()=>{o&&u(o),o=null,h(f())},d)})}}function identity(r){return r}function tryOnScopeDispose(r){return vue.getCurrentScope()?(vue.onScopeDispose(r),!0):!1}function useDebounceFn(r,n=200,i={}){return createFilterWrapper(debounceFilter(n,i),r)}function refDebounced(r,n=200,i={}){const o=vue.ref(r.value),a=useDebounceFn(()=>{o.value=r.value},n,i);return vue.watch(r,()=>a()),o}function tryOnMounted(r,n=!0){vue.getCurrentInstance()?vue.onMounted(r):n?r():vue.nextTick(r)}function unrefElement(r){var n;const i=resolveUnref(r);return(n=i==null?void 0:i.$el)!=null?n:i}const defaultWindow=isClient?window:void 0;function useEventListener(...r){let n,i,o,a;if(isString$1(r[0])||Array.isArray(r[0])?([i,o,a]=r,n=defaultWindow):[n,i,o,a]=r,!n)return noop;Array.isArray(i)||(i=[i]),Array.isArray(o)||(o=[o]);const u=[],c=()=>{u.forEach(h=>h()),u.length=0},f=(h,g,v,y)=>(h.addEventListener(g,v,y),()=>h.removeEventListener(g,v,y)),d=vue.watch(()=>[unrefElement(n),resolveUnref(a)],([h,g])=>{c(),h&&u.push(...i.flatMap(v=>o.map(y=>f(h,v,y,g))))},{immediate:!0,flush:"post"}),p=()=>{d(),c()};return tryOnScopeDispose(p),p}let _iOSWorkaround=!1;function onClickOutside(r,n,i={}){const{window:o=defaultWindow,ignore:a=[],capture:u=!0,detectIframe:c=!1}=i;if(!o)return;isIOS&&!_iOSWorkaround&&(_iOSWorkaround=!0,Array.from(o.document.body.children).forEach(v=>v.addEventListener("click",noop)));let f=!0;const d=v=>a.some(y=>{if(typeof y=="string")return Array.from(o.document.querySelectorAll(y)).some(A=>A===v.target||v.composedPath().includes(A));{const A=unrefElement(y);return A&&(v.target===A||v.composedPath().includes(A))}}),h=[useEventListener(o,"click",v=>{const y=unrefElement(r);if(!(!y||y===v.target||v.composedPath().includes(y))){if(v.detail===0&&(f=!d(v)),!f){f=!0;return}n(v)}},{passive:!0,capture:u}),useEventListener(o,"pointerdown",v=>{const y=unrefElement(r);y&&(f=!v.composedPath().includes(y)&&!d(v))},{passive:!0}),c&&useEventListener(o,"blur",v=>{var y;const A=unrefElement(r);((y=o.document.activeElement)==null?void 0:y.tagName)==="IFRAME"&&!(A!=null&&A.contains(o.document.activeElement))&&n(v)})].filter(Boolean);return()=>h.forEach(v=>v())}function useSupported(r,n=!1){const i=vue.ref(),o=()=>i.value=!!r();return o(),tryOnMounted(o,n),i}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=(r,n)=>{var i={};for(var o in r)__hasOwnProp$g.call(r,o)&&n.indexOf(o)<0&&(i[o]=r[o]);if(r!=null&&__getOwnPropSymbols$g)for(var o of __getOwnPropSymbols$g(r))n.indexOf(o)<0&&__propIsEnum$g.call(r,o)&&(i[o]=r[o]);return i};function useResizeObserver(r,n,i={}){const o=i,{window:a=defaultWindow}=o,u=__objRest$2(o,["window"]);let c;const f=useSupported(()=>a&&"ResizeObserver"in a),d=()=>{c&&(c.disconnect(),c=void 0)},p=vue.watch(()=>unrefElement(r),g=>{d(),f.value&&a&&g&&(c=new ResizeObserver(n),c.observe(g,u))},{immediate:!0,flush:"post"}),h=()=>{d(),p()};return tryOnScopeDispose(h),{isSupported:f,stop:h}}var SwipeDirection;(function(r){r.UP="UP",r.RIGHT="RIGHT",r.DOWN="DOWN",r.LEFT="LEFT",r.NONE="NONE"})(SwipeDirection||(SwipeDirection={}));var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(r,n,i)=>n in r?__defProp(r,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[n]=i,__spreadValues=(r,n)=>{for(var i in n||(n={}))__hasOwnProp.call(n,i)&&__defNormalProp(r,i,n[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(n))__propIsEnum.call(n,i)&&__defNormalProp(r,i,n[i]);return r};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);process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const NOOP=()=>{},hasOwnProperty=Object.prototype.hasOwnProperty,hasOwn=(r,n)=>hasOwnProperty.call(r,n),isArray=Array.isArray,isFunction=r=>typeof r=="function",isString=r=>typeof r=="string",isObject=r=>r!==null&&typeof r=="object",objectToString=Object.prototype.toString,toTypeString=r=>objectToString.call(r),toRawType=r=>toTypeString(r).slice(8,-1),isUndefined=r=>r===void 0,isBoolean=r=>typeof r=="boolean",isNumber=r=>typeof r=="number",isElement=r=>typeof Element>"u"?!1:r instanceof Element,isStringNumber=r=>isString(r)?!Number.isNaN(Number(r)):!1,escapeStringRegexp=(r="")=>r.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d"),getProp=(r,n,i)=>({get value(){return lodashEs.get(r,n,i)},set value(o){lodashEs.set(r,n,o)}});class ElementPlusError extends Error{constructor(n){super(n),this.name="ElementPlusError"}}function throwError(r,n){throw new ElementPlusError(`[${r}] ${n}`)}function debugWarn(r,n){if(process.env.NODE_ENV!=="production"){const i=isString(r)?new ElementPlusError(`[${r}] ${n}`):r;console.warn(i)}}const SCOPE$1="utils/dom/style";function addUnit(r,n="px"){if(!r)return"";if(isNumber(r)||isStringNumber(r))return`${r}${n}`;if(isString(r))return r;debugWarn(SCOPE$1,"binding value must be a string or number")}function scrollIntoView(r,n){if(!isClient)return;if(!n){r.scrollTop=0;return}const i=[];let o=n.offsetParent;for(;o!==null&&r!==o&&r.contains(o);)i.push(o),o=o.offsetParent;const a=n.offsetTop+i.reduce((d,p)=>d+p.offsetTop,0),u=a+n.offsetHeight,c=r.scrollTop,f=c+r.clientHeight;a<c?r.scrollTop=a:u>f&&(r.scrollTop=u-r.clientHeight)}const epPropKey="__epPropKey",definePropType=r=>r,isEpProp=r=>isObject(r)&&!!r[epPropKey],buildProp=(r,n)=>{if(!isObject(r)||isEpProp(r))return r;const{values:i,required:o,default:a,type:u,validator:c}=r,d={type:u,required:!!o,validator:i||c?p=>{let h=!1,g=[];if(i&&(g=Array.from(i),hasOwn(r,"default")&&g.push(a),h||(h=g.includes(p))),c&&(h||(h=c(p))),!h&&g.length>0){const v=[...new Set(g)].map(y=>JSON.stringify(y)).join(", ");vue.warn(`Invalid prop: validation failed${n?` for prop "${n}"`:""}. Expected one of [${v}], got value ${JSON.stringify(p)}.`)}return h}:void 0,[epPropKey]:!0};return hasOwn(r,"default")&&(d.default=a),d},buildProps=r=>lodashEs.fromPairs(Object.entries(r).map(([n,i])=>[n,buildProp(i,n)])),iconPropType=definePropType([String,Object,Function]),ValidateComponentsMap={validating:loading_default,success:circle_check_default,error:circle_close_default},withInstall=(r,n)=>{if(r.install=i=>{for(const o of[r,...Object.values(n??{})])i.component(o.name,o)},n)for(const[i,o]of Object.entries(n))r[i]=o;return r},withNoopInstall=r=>(r.install=NOOP,r),EVENT_CODE={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace",numpadEnter:"NumpadEnter",pageUp:"PageUp",pageDown:"PageDown",home:"Home",end:"End"},UPDATE_MODEL_EVENT="update:modelValue",CHANGE_EVENT="change",componentSizes=["","default","small","large"],componentSizeMap={large:40,default:32,small:24},getComponentSize=r=>componentSizeMap[r||"default"],isValidComponentSize=r=>["",...componentSizes].includes(r),isKorean=r=>/([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(r),mutable=r=>r,DEFAULT_EXCLUDE_KEYS=["class","style"],LISTENER_PREFIX=/^on[A-Z]/,useAttrs=(r={})=>{const{excludeListeners:n=!1,excludeKeys:i}=r,o=vue.computed(()=>((i==null?void 0:i.value)||[]).concat(DEFAULT_EXCLUDE_KEYS)),a=vue.getCurrentInstance();return a?vue.computed(()=>{var u;return lodashEs.fromPairs(Object.entries((u=a.proxy)==null?void 0:u.$attrs).filter(([c])=>!o.value.includes(c)&&!(n&&LISTENER_PREFIX.test(c))))}):(debugWarn("use-attrs","getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function"),vue.computed(()=>({})))},useDeprecated=({from:r,replacement:n,scope:i,version:o,ref:a,type:u="API"},c)=>{vue.watch(()=>vue.unref(c),f=>{f&&debugWarn(i,`[${u}] ${r} is about to be deprecated in version ${o}, please use ${n} instead.
|
252
252
|
For more detail, please visit: ${a}
|
253
253
|
`)},{immediate:!0})},useFocus=r=>({focus:()=>{var n,i;(i=(n=r.value)==null?void 0:n.focus)==null||i.call(n)}});var English={name:"en",el:{colorpicker:{confirm:"OK",clear:"Clear",defaultLabel:"color picker",description:"current color is {color}. press enter to select a new color."},datepicker:{now:"Now",today:"Today",cancel:"Cancel",clear:"Clear",confirm:"OK",dateTablePrompt:"Use the arrow keys and enter to select the day of the month",monthTablePrompt:"Use the arrow keys and enter to select the month",yearTablePrompt:"Use the arrow keys and enter to select the year",selectedDate:"Selected date",selectDate:"Select date",selectTime:"Select time",startDate:"Start Date",startTime:"Start Time",endDate:"End Date",endTime:"End Time",prevYear:"Previous Year",nextYear:"Next Year",prevMonth:"Previous Month",nextMonth:"Next Month",year:"",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",week:"week",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weeksFull:{sun:"Sunday",mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday"},months:{jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Oct",nov:"Nov",dec:"Dec"}},inputNumber:{decrease:"decrease number",increase:"increase number"},select:{loading:"Loading",noMatch:"No matching data",noData:"No data",placeholder:"Select"},dropdown:{toggleDropdown:"Toggle Dropdown"},cascader:{noMatch:"No matching data",loading:"Loading",placeholder:"Select",noData:"No data"},pagination:{goto:"Go to",pagesize:"/page",total:"Total {total}",pageClassifier:"",page:"Page",prev:"Go to previous page",next:"Go to next page",currentPage:"page {pager}",prevPages:"Previous {pager} pages",nextPages:"Next {pager} pages",deprecationWarning:"Deprecated usages detected, please refer to the el-pagination documentation for more details"},dialog:{close:"Close this dialog"},drawer:{close:"Close this dialog"},messagebox:{title:"Message",confirm:"OK",cancel:"Cancel",error:"Illegal input",close:"Close this dialog"},upload:{deleteTip:"press delete to remove",delete:"Delete",preview:"Preview",continue:"Continue"},slider:{defaultLabel:"slider between {min} and {max}",defaultRangeStartLabel:"pick start value",defaultRangeEndLabel:"pick end value"},table:{emptyText:"No Data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},tree:{emptyText:"No Data"},transfer:{noMatch:"No matching data",noData:"No data",titles:["List 1","List 2"],filterPlaceholder:"Enter keyword",noCheckedFormat:"{total} items",hasCheckedFormat:"{checked}/{total} checked"},image:{error:"FAILED"},pageHeader:{title:"Back"},popconfirm:{confirmButtonText:"Yes",cancelButtonText:"No"}}};const buildTranslator=r=>(n,i)=>translate(n,i,vue.unref(r)),translate=(r,n,i)=>lodashEs.get(i,r,r).replace(/\{(\w+)\}/g,(o,a)=>{var u;return`${(u=n==null?void 0:n[a])!=null?u:`{${a}}`}`}),buildLocaleContext=r=>{const n=vue.computed(()=>vue.unref(r).name),i=vue.isRef(r)?r:vue.ref(r);return{lang:n,locale:i,t:buildTranslator(r)}},localeContextKey=Symbol("localeContextKey"),useLocale=r=>{const n=r||vue.inject(localeContextKey,vue.ref());return buildLocaleContext(vue.computed(()=>n.value||English))},defaultNamespace="el",statePrefix="is-",_bem=(r,n,i,o,a)=>{let u=`${r}-${n}`;return i&&(u+=`-${i}`),o&&(u+=`__${o}`),a&&(u+=`--${a}`),u},namespaceContextKey=Symbol("namespaceContextKey"),useGetDerivedNamespace=r=>{const n=r||vue.inject(namespaceContextKey,vue.ref(defaultNamespace));return vue.computed(()=>vue.unref(n)||defaultNamespace)},useNamespace=(r,n)=>{const i=useGetDerivedNamespace(n);return{namespace:i,b:(_="")=>_bem(i.value,r,_,"",""),e:_=>_?_bem(i.value,r,"",_,""):"",m:_=>_?_bem(i.value,r,"","",_):"",be:(_,S)=>_&&S?_bem(i.value,r,_,S,""):"",em:(_,S)=>_&&S?_bem(i.value,r,"",_,S):"",bm:(_,S)=>_&&S?_bem(i.value,r,_,"",S):"",bem:(_,S,b)=>_&&S&&b?_bem(i.value,r,_,S,b):"",is:(_,...S)=>{const b=S.length>=1?S[0]:!0;return _&&b?`${statePrefix}${_}`:""},cssVar:_=>{const S={};for(const b in _)_[b]&&(S[`--${i.value}-${b}`]=_[b]);return S},cssVarName:_=>`--${i.value}-${_}`,cssVarBlock:_=>{const S={};for(const b in _)_[b]&&(S[`--${i.value}-${r}-${b}`]=_[b]);return S},cssVarBlockName:_=>`--${i.value}-${r}-${_}`}},_prop=buildProp({type:definePropType(Boolean),default:null}),_event=buildProp({type:definePropType(Function)}),createModelToggleComposable=r=>{const n=`update:${r}`,i=`onUpdate:${r}`,o=[n],a={[r]:_prop,[i]:_event};return{useModelToggle:({indicator:c,toggleReason:f,shouldHideWhenRouteChanges:d,shouldProceed:p,onShow:h,onHide:g})=>{const v=vue.getCurrentInstance(),{emit:y}=v,A=v.props,_=vue.computed(()=>isFunction(A[i])),S=vue.computed(()=>A[r]===null),b=D=>{c.value!==!0&&(c.value=!0,f&&(f.value=D),isFunction(h)&&h(D))},T=D=>{c.value!==!1&&(c.value=!1,f&&(f.value=D),isFunction(g)&&g(D))},w=D=>{if(A.disabled===!0||isFunction(p)&&!p())return;const z=_.value&&isClient;z&&y(n,!0),(S.value||!z)&&b(D)},x=D=>{if(A.disabled===!0||!isClient)return;const z=_.value&&isClient;z&&y(n,!1),(S.value||!z)&&T(D)},k=D=>{isBoolean(D)&&(A.disabled&&D?_.value&&y(n,!1):c.value!==D&&(D?b():T()))},M=()=>{c.value?x():w()};return vue.watch(()=>A[r],k),d&&v.appContext.config.globalProperties.$route!==void 0&&vue.watch(()=>({...v.proxy.$route}),()=>{d.value&&c.value&&x()}),vue.onMounted(()=>{k(A[r])}),{hide:x,show:w,toggle:M,hasUpdateHandler:_}},useModelToggleProps:a,useModelToggleEmits:o}};createModelToggleComposable("modelValue");const useProp=r=>{const n=vue.getCurrentInstance();return vue.computed(()=>{var i,o;return(o=(i=n==null?void 0:n.proxy)==null?void 0:i.$props)==null?void 0:o[r]})};var E="top",R="bottom",W="right",P="left",me="auto",G=[E,R,W,P],U="start",J="end",Xe="clippingParents",je="viewport",K="popper",Ye="reference",De=G.reduce(function(r,n){return r.concat([n+"-"+U,n+"-"+J])},[]),Ee=[].concat(G,[me]).reduce(function(r,n){return r.concat([n,n+"-"+U,n+"-"+J])},[]),Ge="beforeRead",Je="read",Ke="afterRead",Qe="beforeMain",Ze="main",et="afterMain",tt="beforeWrite",nt="write",rt="afterWrite",ot=[Ge,Je,Ke,Qe,Ze,et,tt,nt,rt];function C(r){return r?(r.nodeName||"").toLowerCase():null}function H(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var n=r.ownerDocument;return n&&n.defaultView||window}return r}function Q(r){var n=H(r).Element;return r instanceof n||r instanceof Element}function B(r){var n=H(r).HTMLElement;return r instanceof n||r instanceof HTMLElement}function Pe(r){if(typeof ShadowRoot>"u")return!1;var n=H(r).ShadowRoot;return r instanceof n||r instanceof ShadowRoot}function Mt(r){var n=r.state;Object.keys(n.elements).forEach(function(i){var o=n.styles[i]||{},a=n.attributes[i]||{},u=n.elements[i];!B(u)||!C(u)||(Object.assign(u.style,o),Object.keys(a).forEach(function(c){var f=a[c];f===!1?u.removeAttribute(c):u.setAttribute(c,f===!0?"":f)}))})}function Rt(r){var n=r.state,i={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(n.elements.popper.style,i.popper),n.styles=i,n.elements.arrow&&Object.assign(n.elements.arrow.style,i.arrow),function(){Object.keys(n.elements).forEach(function(o){var a=n.elements[o],u=n.attributes[o]||{},c=Object.keys(n.styles.hasOwnProperty(o)?n.styles[o]:i[o]),f=c.reduce(function(d,p){return d[p]="",d},{});!B(a)||!C(a)||(Object.assign(a.style,f),Object.keys(u).forEach(function(d){a.removeAttribute(d)}))})}}var Ae={name:"applyStyles",enabled:!0,phase:"write",fn:Mt,effect:Rt,requires:["computeStyles"]};function q(r){return r.split("-")[0]}var X=Math.max,ve=Math.min,Z=Math.round;function ee(r,n){n===void 0&&(n=!1);var i=r.getBoundingClientRect(),o=1,a=1;if(B(r)&&n){var u=r.offsetHeight,c=r.offsetWidth;c>0&&(o=Z(i.width)/c||1),u>0&&(a=Z(i.height)/u||1)}return{width:i.width/o,height:i.height/a,top:i.top/a,right:i.right/o,bottom:i.bottom/a,left:i.left/o,x:i.left/o,y:i.top/a}}function ke(r){var n=ee(r),i=r.offsetWidth,o=r.offsetHeight;return Math.abs(n.width-i)<=1&&(i=n.width),Math.abs(n.height-o)<=1&&(o=n.height),{x:r.offsetLeft,y:r.offsetTop,width:i,height:o}}function it(r,n){var i=n.getRootNode&&n.getRootNode();if(r.contains(n))return!0;if(i&&Pe(i)){var o=n;do{if(o&&r.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function N(r){return H(r).getComputedStyle(r)}function Wt(r){return["table","td","th"].indexOf(C(r))>=0}function I(r){return((Q(r)?r.ownerDocument:r.document)||window.document).documentElement}function ge(r){return C(r)==="html"?r:r.assignedSlot||r.parentNode||(Pe(r)?r.host:null)||I(r)}function at(r){return!B(r)||N(r).position==="fixed"?null:r.offsetParent}function Bt(r){var n=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,i=navigator.userAgent.indexOf("Trident")!==-1;if(i&&B(r)){var o=N(r);if(o.position==="fixed")return null}var a=ge(r);for(Pe(a)&&(a=a.host);B(a)&&["html","body"].indexOf(C(a))<0;){var u=N(a);if(u.transform!=="none"||u.perspective!=="none"||u.contain==="paint"||["transform","perspective"].indexOf(u.willChange)!==-1||n&&u.willChange==="filter"||n&&u.filter&&u.filter!=="none")return a;a=a.parentNode}return null}function se(r){for(var n=H(r),i=at(r);i&&Wt(i)&&N(i).position==="static";)i=at(i);return i&&(C(i)==="html"||C(i)==="body"&&N(i).position==="static")?n:i||Bt(r)||n}function Le(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}function fe(r,n,i){return X(r,ve(n,i))}function St(r,n,i){var o=fe(r,n,i);return o>i?i:o}function st(){return{top:0,right:0,bottom:0,left:0}}function ft(r){return Object.assign({},st(),r)}function ct(r,n){return n.reduce(function(i,o){return i[o]=r,i},{})}var Tt=function(r,n){return r=typeof r=="function"?r(Object.assign({},n.rects,{placement:n.placement})):r,ft(typeof r!="number"?r:ct(r,G))};function Ht(r){var n,i=r.state,o=r.name,a=r.options,u=i.elements.arrow,c=i.modifiersData.popperOffsets,f=q(i.placement),d=Le(f),p=[P,W].indexOf(f)>=0,h=p?"height":"width";if(!(!u||!c)){var g=Tt(a.padding,i),v=ke(u),y=d==="y"?E:P,A=d==="y"?R:W,_=i.rects.reference[h]+i.rects.reference[d]-c[d]-i.rects.popper[h],S=c[d]-i.rects.reference[d],b=se(u),T=b?d==="y"?b.clientHeight||0:b.clientWidth||0:0,w=_/2-S/2,x=g[y],k=T-v[h]-g[A],M=T/2-v[h]/2+w,D=fe(x,M,k),z=d;i.modifiersData[o]=(n={},n[z]=D,n.centerOffset=D-M,n)}}function Ct(r){var n=r.state,i=r.options,o=i.element,a=o===void 0?"[data-popper-arrow]":o;a!=null&&(typeof a=="string"&&(a=n.elements.popper.querySelector(a),!a)||!it(n.elements.popper,a)||(n.elements.arrow=a))}var pt={name:"arrow",enabled:!0,phase:"main",fn:Ht,effect:Ct,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function te(r){return r.split("-")[1]}var qt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Vt(r){var n=r.x,i=r.y,o=window,a=o.devicePixelRatio||1;return{x:Z(n*a)/a||0,y:Z(i*a)/a||0}}function ut(r){var n,i=r.popper,o=r.popperRect,a=r.placement,u=r.variation,c=r.offsets,f=r.position,d=r.gpuAcceleration,p=r.adaptive,h=r.roundOffsets,g=r.isFixed,v=c.x,y=v===void 0?0:v,A=c.y,_=A===void 0?0:A,S=typeof h=="function"?h({x:y,y:_}):{x:y,y:_};y=S.x,_=S.y;var b=c.hasOwnProperty("x"),T=c.hasOwnProperty("y"),w=P,x=E,k=window;if(p){var M=se(i),D="clientHeight",z="clientWidth";if(M===H(i)&&(M=I(i),N(M).position!=="static"&&f==="absolute"&&(D="scrollHeight",z="scrollWidth")),M=M,a===E||(a===P||a===W)&&u===J){x=R;var j=g&&M===k&&k.visualViewport?k.visualViewport.height:M[D];_-=j-o.height,_*=d?1:-1}if(a===P||(a===E||a===R)&&u===J){w=W;var oe=g&&M===k&&k.visualViewport?k.visualViewport.width:M[z];y-=oe-o.width,y*=d?1:-1}}var L=Object.assign({position:f},p&&qt),F=h===!0?Vt({x:y,y:_}):{x:y,y:_};if(y=F.x,_=F.y,d){var O;return Object.assign({},L,(O={},O[x]=T?"0":"",O[w]=b?"0":"",O.transform=(k.devicePixelRatio||1)<=1?"translate("+y+"px, "+_+"px)":"translate3d("+y+"px, "+_+"px, 0)",O))}return Object.assign({},L,(n={},n[x]=T?_+"px":"",n[w]=b?y+"px":"",n.transform="",n))}function Nt(r){var n=r.state,i=r.options,o=i.gpuAcceleration,a=o===void 0?!0:o,u=i.adaptive,c=u===void 0?!0:u,f=i.roundOffsets,d=f===void 0?!0:f,p={placement:q(n.placement),variation:te(n.placement),popper:n.elements.popper,popperRect:n.rects.popper,gpuAcceleration:a,isFixed:n.options.strategy==="fixed"};n.modifiersData.popperOffsets!=null&&(n.styles.popper=Object.assign({},n.styles.popper,ut(Object.assign({},p,{offsets:n.modifiersData.popperOffsets,position:n.options.strategy,adaptive:c,roundOffsets:d})))),n.modifiersData.arrow!=null&&(n.styles.arrow=Object.assign({},n.styles.arrow,ut(Object.assign({},p,{offsets:n.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:d})))),n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-placement":n.placement})}var Me={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Nt,data:{}},ye={passive:!0};function It(r){var n=r.state,i=r.instance,o=r.options,a=o.scroll,u=a===void 0?!0:a,c=o.resize,f=c===void 0?!0:c,d=H(n.elements.popper),p=[].concat(n.scrollParents.reference,n.scrollParents.popper);return u&&p.forEach(function(h){h.addEventListener("scroll",i.update,ye)}),f&&d.addEventListener("resize",i.update,ye),function(){u&&p.forEach(function(h){h.removeEventListener("scroll",i.update,ye)}),f&&d.removeEventListener("resize",i.update,ye)}}var Re={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:It,data:{}},_t={left:"right",right:"left",bottom:"top",top:"bottom"};function be(r){return r.replace(/left|right|bottom|top/g,function(n){return _t[n]})}var zt={start:"end",end:"start"};function lt(r){return r.replace(/start|end/g,function(n){return zt[n]})}function We(r){var n=H(r),i=n.pageXOffset,o=n.pageYOffset;return{scrollLeft:i,scrollTop:o}}function Be(r){return ee(I(r)).left+We(r).scrollLeft}function Ft(r){var n=H(r),i=I(r),o=n.visualViewport,a=i.clientWidth,u=i.clientHeight,c=0,f=0;return o&&(a=o.width,u=o.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(c=o.offsetLeft,f=o.offsetTop)),{width:a,height:u,x:c+Be(r),y:f}}function Ut(r){var n,i=I(r),o=We(r),a=(n=r.ownerDocument)==null?void 0:n.body,u=X(i.scrollWidth,i.clientWidth,a?a.scrollWidth:0,a?a.clientWidth:0),c=X(i.scrollHeight,i.clientHeight,a?a.scrollHeight:0,a?a.clientHeight:0),f=-o.scrollLeft+Be(r),d=-o.scrollTop;return N(a||i).direction==="rtl"&&(f+=X(i.clientWidth,a?a.clientWidth:0)-u),{width:u,height:c,x:f,y:d}}function Se(r){var n=N(r),i=n.overflow,o=n.overflowX,a=n.overflowY;return/auto|scroll|overlay|hidden/.test(i+a+o)}function dt(r){return["html","body","#document"].indexOf(C(r))>=0?r.ownerDocument.body:B(r)&&Se(r)?r:dt(ge(r))}function ce(r,n){var i;n===void 0&&(n=[]);var o=dt(r),a=o===((i=r.ownerDocument)==null?void 0:i.body),u=H(o),c=a?[u].concat(u.visualViewport||[],Se(o)?o:[]):o,f=n.concat(c);return a?f:f.concat(ce(ge(c)))}function Te(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}function Xt(r){var n=ee(r);return n.top=n.top+r.clientTop,n.left=n.left+r.clientLeft,n.bottom=n.top+r.clientHeight,n.right=n.left+r.clientWidth,n.width=r.clientWidth,n.height=r.clientHeight,n.x=n.left,n.y=n.top,n}function ht(r,n){return n===je?Te(Ft(r)):Q(n)?Xt(n):Te(Ut(I(r)))}function Yt(r){var n=ce(ge(r)),i=["absolute","fixed"].indexOf(N(r).position)>=0,o=i&&B(r)?se(r):r;return Q(o)?n.filter(function(a){return Q(a)&&it(a,o)&&C(a)!=="body"}):[]}function Gt(r,n,i){var o=n==="clippingParents"?Yt(r):[].concat(n),a=[].concat(o,[i]),u=a[0],c=a.reduce(function(f,d){var p=ht(r,d);return f.top=X(p.top,f.top),f.right=ve(p.right,f.right),f.bottom=ve(p.bottom,f.bottom),f.left=X(p.left,f.left),f},ht(r,u));return c.width=c.right-c.left,c.height=c.bottom-c.top,c.x=c.left,c.y=c.top,c}function mt(r){var n=r.reference,i=r.element,o=r.placement,a=o?q(o):null,u=o?te(o):null,c=n.x+n.width/2-i.width/2,f=n.y+n.height/2-i.height/2,d;switch(a){case E:d={x:c,y:n.y-i.height};break;case R:d={x:c,y:n.y+n.height};break;case W:d={x:n.x+n.width,y:f};break;case P:d={x:n.x-i.width,y:f};break;default:d={x:n.x,y:n.y}}var p=a?Le(a):null;if(p!=null){var h=p==="y"?"height":"width";switch(u){case U:d[p]=d[p]-(n[h]/2-i[h]/2);break;case J:d[p]=d[p]+(n[h]/2-i[h]/2);break}}return d}function ne(r,n){n===void 0&&(n={});var i=n,o=i.placement,a=o===void 0?r.placement:o,u=i.boundary,c=u===void 0?Xe:u,f=i.rootBoundary,d=f===void 0?je:f,p=i.elementContext,h=p===void 0?K:p,g=i.altBoundary,v=g===void 0?!1:g,y=i.padding,A=y===void 0?0:y,_=ft(typeof A!="number"?A:ct(A,G)),S=h===K?Ye:K,b=r.rects.popper,T=r.elements[v?S:h],w=Gt(Q(T)?T:T.contextElement||I(r.elements.popper),c,d),x=ee(r.elements.reference),k=mt({reference:x,element:b,strategy:"absolute",placement:a}),M=Te(Object.assign({},b,k)),D=h===K?M:x,z={top:w.top-D.top+_.top,bottom:D.bottom-w.bottom+_.bottom,left:w.left-D.left+_.left,right:D.right-w.right+_.right},j=r.modifiersData.offset;if(h===K&&j){var oe=j[a];Object.keys(z).forEach(function(L){var F=[W,R].indexOf(L)>=0?1:-1,O=[E,R].indexOf(L)>=0?"y":"x";z[L]+=oe[O]*F})}return z}function Jt(r,n){n===void 0&&(n={});var i=n,o=i.placement,a=i.boundary,u=i.rootBoundary,c=i.padding,f=i.flipVariations,d=i.allowedAutoPlacements,p=d===void 0?Ee:d,h=te(o),g=h?f?De:De.filter(function(A){return te(A)===h}):G,v=g.filter(function(A){return p.indexOf(A)>=0});v.length===0&&(v=g);var y=v.reduce(function(A,_){return A[_]=ne(r,{placement:_,boundary:a,rootBoundary:u,padding:c})[q(_)],A},{});return Object.keys(y).sort(function(A,_){return y[A]-y[_]})}function Kt(r){if(q(r)===me)return[];var n=be(r);return[lt(r),n,lt(n)]}function Qt(r){var n=r.state,i=r.options,o=r.name;if(!n.modifiersData[o]._skip){for(var a=i.mainAxis,u=a===void 0?!0:a,c=i.altAxis,f=c===void 0?!0:c,d=i.fallbackPlacements,p=i.padding,h=i.boundary,g=i.rootBoundary,v=i.altBoundary,y=i.flipVariations,A=y===void 0?!0:y,_=i.allowedAutoPlacements,S=n.options.placement,b=q(S),T=b===S,w=d||(T||!A?[be(S)]:Kt(S)),x=[S].concat(w).reduce(function(Fe,$e){return Fe.concat(q($e)===me?Jt(n,{placement:$e,boundary:h,rootBoundary:g,padding:p,flipVariations:A,allowedAutoPlacements:_}):$e)},[]),k=n.rects.reference,M=n.rects.popper,D=new Map,z=!0,j=x[0],oe=0;oe<x.length;oe++){var L=x[oe],F=q(L),O=te(L)===U,ue=[E,R].indexOf(F)>=0,_e=ue?"width":"height",Ce=ne(n,{placement:L,boundary:h,rootBoundary:g,altBoundary:v,padding:p}),de=ue?O?W:P:O?R:E;k[_e]>M[_e]&&(de=be(de));var ie=be(de),Y=[];if(u&&Y.push(Ce[F]<=0),f&&Y.push(Ce[de]<=0,Ce[ie]<=0),Y.every(function(Fe){return Fe})){j=L,z=!1;break}D.set(L,Y)}if(z)for(var Ie=A?3:1,Oe=function(Fe){var $e=x.find(function(Cn){var Lt=D.get(Cn);if(Lt)return Lt.slice(0,Fe).every(function(In){return In})});if($e)return j=$e,"break"},kt=Ie;kt>0;kt--){var Dt=Oe(kt);if(Dt==="break")break}n.placement!==j&&(n.modifiersData[o]._skip=!0,n.placement=j,n.reset=!0)}}var vt={name:"flip",enabled:!0,phase:"main",fn:Qt,requiresIfExists:["offset"],data:{_skip:!1}};function gt(r,n,i){return i===void 0&&(i={x:0,y:0}),{top:r.top-n.height-i.y,right:r.right-n.width+i.x,bottom:r.bottom-n.height+i.y,left:r.left-n.width-i.x}}function yt(r){return[E,W,R,P].some(function(n){return r[n]>=0})}function Zt(r){var n=r.state,i=r.name,o=n.rects.reference,a=n.rects.popper,u=n.modifiersData.preventOverflow,c=ne(n,{elementContext:"reference"}),f=ne(n,{altBoundary:!0}),d=gt(c,o),p=gt(f,a,u),h=yt(d),g=yt(p);n.modifiersData[i]={referenceClippingOffsets:d,popperEscapeOffsets:p,isReferenceHidden:h,hasPopperEscaped:g},n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":g})}var bt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Zt};function en(r,n,i){var o=q(r),a=[P,E].indexOf(o)>=0?-1:1,u=typeof i=="function"?i(Object.assign({},n,{placement:r})):i,c=u[0],f=u[1];return c=c||0,f=(f||0)*a,[P,W].indexOf(o)>=0?{x:f,y:c}:{x:c,y:f}}function tn(r){var n=r.state,i=r.options,o=r.name,a=i.offset,u=a===void 0?[0,0]:a,c=Ee.reduce(function(h,g){return h[g]=en(g,n.rects,u),h},{}),f=c[n.placement],d=f.x,p=f.y;n.modifiersData.popperOffsets!=null&&(n.modifiersData.popperOffsets.x+=d,n.modifiersData.popperOffsets.y+=p),n.modifiersData[o]=c}var wt={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:tn};function nn(r){var n=r.state,i=r.name;n.modifiersData[i]=mt({reference:n.rects.reference,element:n.rects.popper,strategy:"absolute",placement:n.placement})}var He={name:"popperOffsets",enabled:!0,phase:"read",fn:nn,data:{}};function rn(r){return r==="x"?"y":"x"}function on(r){var n=r.state,i=r.options,o=r.name,a=i.mainAxis,u=a===void 0?!0:a,c=i.altAxis,f=c===void 0?!1:c,d=i.boundary,p=i.rootBoundary,h=i.altBoundary,g=i.padding,v=i.tether,y=v===void 0?!0:v,A=i.tetherOffset,_=A===void 0?0:A,S=ne(n,{boundary:d,rootBoundary:p,padding:g,altBoundary:h}),b=q(n.placement),T=te(n.placement),w=!T,x=Le(b),k=rn(x),M=n.modifiersData.popperOffsets,D=n.rects.reference,z=n.rects.popper,j=typeof _=="function"?_(Object.assign({},n.rects,{placement:n.placement})):_,oe=typeof j=="number"?{mainAxis:j,altAxis:j}:Object.assign({mainAxis:0,altAxis:0},j),L=n.modifiersData.offset?n.modifiersData.offset[n.placement]:null,F={x:0,y:0};if(M){if(u){var O,ue=x==="y"?E:P,_e=x==="y"?R:W,Ce=x==="y"?"height":"width",de=M[x],ie=de+S[ue],Y=de-S[_e],Ie=y?-z[Ce]/2:0,Oe=T===U?D[Ce]:z[Ce],kt=T===U?-z[Ce]:-D[Ce],Dt=n.elements.arrow,Fe=y&&Dt?ke(Dt):{width:0,height:0},$e=n.modifiersData["arrow#persistent"]?n.modifiersData["arrow#persistent"].padding:st(),Cn=$e[ue],Lt=$e[_e],In=fe(0,D[Ce],Fe[Ce]),Et=w?D[Ce]/2-Ie-In-Cn-oe.mainAxis:Oe-In-Cn-oe.mainAxis,Ne=w?-D[Ce]/2+Ie+In+Lt+oe.mainAxis:kt+In+Lt+oe.mainAxis,pe=n.elements.arrow&&se(n.elements.arrow),At=pe?x==="y"?pe.clientTop||0:pe.clientLeft||0:0,Ve=(O=L==null?void 0:L[x])!=null?O:0,xe=de+Et-Ve-At,ze=de+Ne-Ve,Pt=fe(y?ve(ie,xe):ie,de,y?X(Y,ze):Y);M[x]=Pt,F[x]=Pt-de}if(f){var hn,ae=x==="x"?E:P,le=x==="x"?R:W,re=M[k],V=k==="y"?"height":"width",$=re+S[ae],he=re-S[le],Ue=[E,P].indexOf(b)!==-1,qe=(hn=L==null?void 0:L[k])!=null?hn:0,jt=Ue?$:re-D[V]-z[V]-qe+oe.altAxis,An=Ue?re+D[V]+z[V]-qe-oe.altAxis:he,wn=y&&Ue?St(jt,re,An):fe(y?jt:$,re,y?An:he);M[k]=wn,F[k]=wn-re}n.modifiersData[o]=F}}var xt={name:"preventOverflow",enabled:!0,phase:"main",fn:on,requiresIfExists:["offset"]};function an(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}function sn(r){return r===H(r)||!B(r)?We(r):an(r)}function fn(r){var n=r.getBoundingClientRect(),i=Z(n.width)/r.offsetWidth||1,o=Z(n.height)/r.offsetHeight||1;return i!==1||o!==1}function cn(r,n,i){i===void 0&&(i=!1);var o=B(n),a=B(n)&&fn(n),u=I(n),c=ee(r,a),f={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(o||!o&&!i)&&((C(n)!=="body"||Se(u))&&(f=sn(n)),B(n)?(d=ee(n,!0),d.x+=n.clientLeft,d.y+=n.clientTop):u&&(d.x=Be(u))),{x:c.left+f.scrollLeft-d.x,y:c.top+f.scrollTop-d.y,width:c.width,height:c.height}}function pn(r){var n=new Map,i=new Set,o=[];r.forEach(function(u){n.set(u.name,u)});function a(u){i.add(u.name);var c=[].concat(u.requires||[],u.requiresIfExists||[]);c.forEach(function(f){if(!i.has(f)){var d=n.get(f);d&&a(d)}}),o.push(u)}return r.forEach(function(u){i.has(u.name)||a(u)}),o}function un(r){var n=pn(r);return ot.reduce(function(i,o){return i.concat(n.filter(function(a){return a.phase===o}))},[])}function ln(r){var n;return function(){return n||(n=new Promise(function(i){Promise.resolve().then(function(){n=void 0,i(r())})})),n}}function dn(r){var n=r.reduce(function(i,o){var a=i[o.name];return i[o.name]=a?Object.assign({},a,o,{options:Object.assign({},a.options,o.options),data:Object.assign({},a.data,o.data)}):o,i},{});return Object.keys(n).map(function(i){return n[i]})}var Ot={placement:"bottom",modifiers:[],strategy:"absolute"};function $t(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return!n.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function we(r){r===void 0&&(r={});var n=r,i=n.defaultModifiers,o=i===void 0?[]:i,a=n.defaultOptions,u=a===void 0?Ot:a;return function(c,f,d){d===void 0&&(d=u);var p={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ot,u),modifiersData:{},elements:{reference:c,popper:f},attributes:{},styles:{}},h=[],g=!1,v={state:p,setOptions:function(_){var S=typeof _=="function"?_(p.options):_;A(),p.options=Object.assign({},u,p.options,S),p.scrollParents={reference:Q(c)?ce(c):c.contextElement?ce(c.contextElement):[],popper:ce(f)};var b=un(dn([].concat(o,p.options.modifiers)));return p.orderedModifiers=b.filter(function(T){return T.enabled}),y(),v.update()},forceUpdate:function(){if(!g){var _=p.elements,S=_.reference,b=_.popper;if($t(S,b)){p.rects={reference:cn(S,se(b),p.options.strategy==="fixed"),popper:ke(b)},p.reset=!1,p.placement=p.options.placement,p.orderedModifiers.forEach(function(z){return p.modifiersData[z.name]=Object.assign({},z.data)});for(var T=0;T<p.orderedModifiers.length;T++){if(p.reset===!0){p.reset=!1,T=-1;continue}var w=p.orderedModifiers[T],x=w.fn,k=w.options,M=k===void 0?{}:k,D=w.name;typeof x=="function"&&(p=x({state:p,options:M,name:D,instance:v})||p)}}}},update:ln(function(){return new Promise(function(_){v.forceUpdate(),_(p)})}),destroy:function(){A(),g=!0}};if(!$t(c,f))return v;v.setOptions(d).then(function(_){!g&&d.onFirstUpdate&&d.onFirstUpdate(_)});function y(){p.orderedModifiers.forEach(function(_){var S=_.name,b=_.options,T=b===void 0?{}:b,w=_.effect;if(typeof w=="function"){var x=w({state:p,name:S,instance:v,options:T}),k=function(){};h.push(x||k)}})}function A(){h.forEach(function(_){return _()}),h=[]}return v}}we();var mn=[Re,He,Me,Ae];we({defaultModifiers:mn});var gn=[Re,He,Me,Ae,wt,vt,xt,pt,bt],yn=we({defaultModifiers:gn});const usePopper=(r,n,i={})=>{const o={name:"updateState",enabled:!0,phase:"write",fn:({state:d})=>{const p=deriveState(d);Object.assign(c.value,p)},requires:["computeStyles"]},a=vue.computed(()=>{const{onFirstUpdate:d,placement:p,strategy:h,modifiers:g}=vue.unref(i);return{onFirstUpdate:d,placement:p||"bottom",strategy:h||"absolute",modifiers:[...g||[],o,{name:"applyStyles",enabled:!1}]}}),u=vue.shallowRef(),c=vue.ref({styles:{popper:{position:vue.unref(a).strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),f=()=>{u.value&&(u.value.destroy(),u.value=void 0)};return vue.watch(a,d=>{const p=vue.unref(u);p&&p.setOptions(d)},{deep:!0}),vue.watch([r,n],([d,p])=>{f(),!(!d||!p)&&(u.value=yn(d,p,vue.unref(a)))}),vue.onBeforeUnmount(()=>{f()}),{state:vue.computed(()=>{var d;return{...((d=vue.unref(u))==null?void 0:d.state)||{}}}),styles:vue.computed(()=>vue.unref(c).styles),attributes:vue.computed(()=>vue.unref(c).attributes),update:()=>{var d;return(d=vue.unref(u))==null?void 0:d.update()},forceUpdate:()=>{var d;return(d=vue.unref(u))==null?void 0:d.forceUpdate()},instanceRef:vue.computed(()=>vue.unref(u))}};function deriveState(r){const n=Object.keys(r.elements),i=lodashEs.fromPairs(n.map(a=>[a,r.styles[a]||{}])),o=lodashEs.fromPairs(n.map(a=>[a,r.attributes[a]]));return{styles:i,attributes:o}}function useTimeout(){let r;const n=(o,a)=>{i(),r=window.setTimeout(o,a)},i=()=>window.clearTimeout(r);return tryOnScopeDispose(()=>i()),{registerTimeout:n,cancelTimeout:i}}const defaultIdInjection={prefix:Math.floor(Math.random()*1e4),current:0},ID_INJECTION_KEY=Symbol("elIdInjection"),useIdInjection=()=>vue.getCurrentInstance()?vue.inject(ID_INJECTION_KEY,defaultIdInjection):defaultIdInjection,useId=r=>{const n=useIdInjection();!isClient&&n===defaultIdInjection&&debugWarn("IdInjection",`Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
|
254
254
|
usage: app.provide(ID_INJECTION_KEY, {
|