@zhangqingcq/vgce 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
package/dist/vgce.umd.cjs CHANGED
@@ -241,7 +241,7 @@ echarts.use([`+re+"]);":"Unknown series "+V))}return}if(g==="tooltip"){if(S){pro
241
241
 
242
242
  `:"<br/>",w=g.join(A);this._showOrMove(d,function(){this._updateContentNotChangedOnAxis(n,h)?this._updatePosition(d,v,c[0],c[1],this._tooltipContent,h):this._showTooltipContent(d,w,h,Math.random()+"",c[0],c[1],v,null,p)})},r.prototype._showSeriesItemTooltip=function(n,o,a){var u=this._ecModel,c=getECData(o),d=c.seriesIndex,f=u.getSeriesByIndex(d),h=c.dataModel||f,y=c.dataIndex,g=c.dataType,p=h.getData(g),v=this._renderMode,_=n.positionDefault,b=buildTooltipModel([p.getItemModel(y),h,f&&(f.coordinateSystem||{}).model],this._tooltipModel,_?{position:_}:null),A=b.get("trigger");if(!(A!=null&&A!=="item")){var w=h.getDataParams(y,g),T=new TooltipMarkupStyleCreator;w.marker=T.makeTooltipMarker("item",convertToColorString(w.color),v);var S=normalizeTooltipFormatResult(h.formatTooltip(y,!1,g)),x=b.get("order"),L=b.get("valueFormatter"),M=S.frag,O=M?buildTooltipMarkup(L?extend({valueFormatter:L},M):M,T,v,x,u.get("useUTC"),b.get("textStyle")):S.text,ie="item_"+h.name+"_"+y;this._showOrMove(b,function(){this._showTooltipContent(b,O,w,ie,n.offsetX,n.offsetY,n.position,n.target,T)}),a({type:"showTip",dataIndexInside:y,dataIndex:p.getRawIndex(y),seriesIndex:d,from:this.uid})}},r.prototype._showComponentItemTooltip=function(n,o,a){var u=this._renderMode==="html",c=getECData(o),d=c.tooltipConfig,f=d.option||{},h=f.encodeHTMLContent;if(isString$2(f)){var y=f;f={content:y,formatter:y},h=!0}h&&u&&f.content&&(f=clone$2(f),f.content=encodeHTML(f.content));var g=[f],p=this._ecModel.getComponent(c.componentMainType,c.componentIndex);p&&g.push(p),g.push({formatter:f.content});var v=n.positionDefault,_=buildTooltipModel(g,this._tooltipModel,v?{position:v}:null),b=_.get("content"),A=Math.random()+"",w=new TooltipMarkupStyleCreator;this._showOrMove(_,function(){var T=clone$2(_.get("formatterParams")||{});this._showTooltipContent(_,b,T,A,n.offsetX,n.offsetY,n.position,o,w)}),a({type:"showTip",from:this.uid})},r.prototype._showTooltipContent=function(n,o,a,u,c,d,f,h,y){if(this._ticket="",!(!n.get("showContent")||!n.get("show"))){var g=this._tooltipContent;g.setEnterable(n.get("enterable"));var p=n.get("formatter");f=f||n.get("position");var v=o,_=this._getNearestPoint([c,d],a,n.get("trigger"),n.get("borderColor")),b=_.color;if(p)if(isString$2(p)){var A=n.ecModel.get("useUTC"),w=isArray$1(a)?a[0]:a,T=w&&w.axisType&&w.axisType.indexOf("time")>=0;v=p,T&&(v=format$1(w.axisValue,v,A)),v=formatTpl(v,a,!0)}else if(isFunction$1(p)){var S=bind$1(function(x,L){x===this._ticket&&(g.setContent(L,y,n,b,f),this._updatePosition(n,f,c,d,g,a,h))},this);this._ticket=u,v=p(a,u,S)}else v=p;g.setContent(v,y,n,b,f),g.show(n,b),this._updatePosition(n,f,c,d,g,a,h)}},r.prototype._getNearestPoint=function(n,o,a,u){if(a==="axis"||isArray$1(o))return{color:u||(this._renderMode==="html"?"#fff":"none")};if(!isArray$1(o))return{color:u||o.color||o.borderColor}},r.prototype._updatePosition=function(n,o,a,u,c,d,f){var h=this._api.getWidth(),y=this._api.getHeight();o=o||n.get("position");var g=c.getSize(),p=n.get("align"),v=n.get("verticalAlign"),_=f&&f.getBoundingRect().clone();if(f&&_.applyTransform(f.transform),isFunction$1(o)&&(o=o([a,u],d,c.el,_,{viewSize:[h,y],contentSize:g.slice()})),isArray$1(o))a=parsePercent(o[0],h),u=parsePercent(o[1],y);else if(isObject$3(o)){var b=o;b.width=g[0],b.height=g[1];var A=getLayoutRect(b,{width:h,height:y});a=A.x,u=A.y,p=null,v=null}else if(isString$2(o)&&f){var w=calcTooltipPosition(o,_,g,n.get("borderWidth"));a=w[0],u=w[1]}else{var w=refixTooltipPosition(a,u,c,h,y,p?null:20,v?null:20);a=w[0],u=w[1]}if(p&&(a-=isCenterAlign(p)?g[0]/2:p==="right"?g[0]:0),v&&(u-=isCenterAlign(v)?g[1]/2:v==="bottom"?g[1]:0),shouldTooltipConfine(n)){var w=confineTooltipPosition(a,u,c,h,y);a=w[0],u=w[1]}c.moveTo(a,u)},r.prototype._updateContentNotChangedOnAxis=function(n,o){var a=this._lastDataByCoordSys,u=this._cbParamsList,c=!!a&&a.length===n.length;return c&&each$4(a,function(d,f){var h=d.dataByAxis||[],y=n[f]||{},g=y.dataByAxis||[];c=c&&h.length===g.length,c&&each$4(h,function(p,v){var _=g[v]||{},b=p.seriesDataIndices||[],A=_.seriesDataIndices||[];c=c&&p.value===_.value&&p.axisType===_.axisType&&p.axisId===_.axisId&&b.length===A.length,c&&each$4(b,function(w,T){var S=A[T];c=c&&w.seriesIndex===S.seriesIndex&&w.dataIndex===S.dataIndex}),u&&each$4(p.seriesDataIndices,function(w){var T=w.seriesIndex,S=o[T],x=u[T];S&&x&&x.data!==S.data&&(c=!1)})})}),this._lastDataByCoordSys=n,this._cbParamsList=o,!!c},r.prototype._hide=function(n){this._lastDataByCoordSys=null,n({type:"hideTip",from:this.uid})},r.prototype.dispose=function(n,o){env$1.node||!o.getDom()||(clear(this,"_updatePosition"),this._tooltipContent.dispose(),unregister("itemTooltip",o))},r.type="tooltip",r}(ComponentView$1);function buildTooltipModel(i,r,n){var o=r.ecModel,a;n?(a=new Model$1(n,o,o),a=new Model$1(r.option,a,o)):a=r;for(var u=i.length-1;u>=0;u--){var c=i[u];c&&(c instanceof Model$1&&(c=c.get("tooltip",!0)),isString$2(c)&&(c={formatter:c}),c&&(a=new Model$1(c,a,o)))}return a}function makeDispatchAction(i,r){return i.dispatchAction||bind$1(r.dispatchAction,r)}function refixTooltipPosition(i,r,n,o,a,u,c){var d=n.getSize(),f=d[0],h=d[1];return u!=null&&(i+f+u+2>o?i-=f+u:i+=u),c!=null&&(r+h+c>a?r-=h+c:r+=c),[i,r]}function confineTooltipPosition(i,r,n,o,a){var u=n.getSize(),c=u[0],d=u[1];return i=Math.min(i+c,o)-c,r=Math.min(r+d,a)-d,i=Math.max(i,0),r=Math.max(r,0),[i,r]}function calcTooltipPosition(i,r,n,o){var a=n[0],u=n[1],c=Math.ceil(Math.SQRT2*o)+8,d=0,f=0,h=r.width,y=r.height;switch(i){case"inside":d=r.x+h/2-a/2,f=r.y+y/2-u/2;break;case"top":d=r.x+h/2-a/2,f=r.y-u-c;break;case"bottom":d=r.x+h/2-a/2,f=r.y+y+c;break;case"left":d=r.x-a-c,f=r.y+y/2-u/2;break;case"right":d=r.x+h+c,f=r.y+y/2-u/2}return[d,f]}function isCenterAlign(i){return i==="center"||i==="middle"}function findComponentReference(i,r,n){var o=preParseFinder(i).queryOptionMap,a=o.keys()[0];if(!(!a||a==="series")){var u=queryReferringComponents(r,a,o.get(a),{useDefault:!1,enableAll:!1,enableNone:!1}),c=u.models[0];if(c){var d=n.getViewOfComponentModel(c),f;if(d.group.traverse(function(h){var y=getECData(h).tooltipConfig;if(y&&y.name===i.name)return f=h,!0}),f)return{componentMainType:a,componentIndex:c.componentIndex,el:f}}}}const TooltipView$1=TooltipView;function install$4(i){use(install$5),i.registerComponentModel(TooltipModel$1),i.registerComponentView(TooltipView$1),i.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},noop$1),i.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},noop$1)}var TitleModel=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n.layoutMode={type:"box",ignoreSize:!0},n}return r.type="title",r.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:"#464646"},subtextStyle:{fontSize:12,color:"#6E7079"}},r}(ComponentModel$1),TitleView=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n}return r.prototype.render=function(n,o,a){if(this.group.removeAll(),!!n.get("show")){var u=this.group,c=n.getModel("textStyle"),d=n.getModel("subtextStyle"),f=n.get("textAlign"),h=retrieve2(n.get("textBaseline"),n.get("textVerticalAlign")),y=new ZRText$1({style:createTextStyle(c,{text:n.get("text"),fill:c.getTextColor()},{disableBox:!0}),z2:10}),g=y.getBoundingRect(),p=n.get("subtext"),v=new ZRText$1({style:createTextStyle(d,{text:p,fill:d.getTextColor(),y:g.height+n.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),_=n.get("link"),b=n.get("sublink"),A=n.get("triggerEvent",!0);y.silent=!_&&!A,v.silent=!b&&!A,_&&y.on("click",function(){windowOpen(_,"_"+n.get("target"))}),b&&v.on("click",function(){windowOpen(b,"_"+n.get("subtarget"))}),getECData(y).eventData=getECData(v).eventData=A?{componentType:"title",componentIndex:n.componentIndex}:null,u.add(y),p&&u.add(v);var w=u.getBoundingRect(),T=n.getBoxLayoutParams();T.width=w.width,T.height=w.height;var S=getLayoutRect(T,{width:a.getWidth(),height:a.getHeight()},n.get("padding"));f||(f=n.get("left")||n.get("right"),f==="middle"&&(f="center"),f==="right"?S.x+=S.width:f==="center"&&(S.x+=S.width/2)),h||(h=n.get("top")||n.get("bottom"),h==="center"&&(h="middle"),h==="bottom"?S.y+=S.height:h==="middle"&&(S.y+=S.height/2),h=h||"top"),u.x=S.x,u.y=S.y,u.markRedraw();var x={align:f,verticalAlign:h};y.setStyle(x),v.setStyle(x),w=u.getBoundingRect();var L=S.margin,M=n.getItemStyle(["color","opacity"]);M.fill=n.get("backgroundColor");var O=new Rect$1({shape:{x:w.x-L[3],y:w.y-L[0],width:w.width+L[1]+L[3],height:w.height+L[0]+L[2],r:n.get("borderRadius")},style:M,subPixelOptimize:!0,silent:!0});u.add(O)}},r.type="title",r}(ComponentView$1);function install$3(i){i.registerComponentModel(TitleModel),i.registerComponentView(TitleView)}var getDefaultSelectorOptions=function(i,r){if(r==="all")return{type:"all",title:i.getLocaleModel().get(["legend","selector","all"])};if(r==="inverse")return{type:"inverse",title:i.getLocaleModel().get(["legend","selector","inverse"])}},LegendModel=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n.layoutMode={type:"box",ignoreSize:!0},n}return r.prototype.init=function(n,o,a){this.mergeDefaultAndTheme(n,a),n.selected=n.selected||{},this._updateSelector(n)},r.prototype.mergeOption=function(n,o){i.prototype.mergeOption.call(this,n,o),this._updateSelector(n)},r.prototype._updateSelector=function(n){var o=n.selector,a=this.ecModel;o===!0&&(o=n.selector=["all","inverse"]),isArray$1(o)&&each$4(o,function(u,c){isString$2(u)&&(u={type:u}),o[c]=merge(u,getDefaultSelectorOptions(a,u.type))})},r.prototype.optionUpdated=function(){this._updateData(this.ecModel);var n=this._data;if(n[0]&&this.get("selectedMode")==="single"){for(var o=!1,a=0;a<n.length;a++){var u=n[a].get("name");if(this.isSelected(u)){this.select(u),o=!0;break}}!o&&this.select(n[0].get("name"))}},r.prototype._updateData=function(n){var o=[],a=[];n.eachRawSeries(function(f){var h=f.name;a.push(h);var y;if(f.legendVisualProvider){var g=f.legendVisualProvider,p=g.getAllNames();n.isSeriesFiltered(f)||(a=a.concat(p)),p.length?o=o.concat(p):y=!0}else y=!0;y&&isNameSpecified(f)&&o.push(f.name)}),this._availableNames=a;var u=this.get("data")||o,c=createHashMap(),d=map$1(u,function(f){return(isString$2(f)||isNumber$1(f))&&(f={name:f}),c.get(f.name)?null:(c.set(f.name,!0),new Model$1(f,this,this.ecModel))},this);this._data=filter(d,function(f){return!!f})},r.prototype.getData=function(){return this._data},r.prototype.select=function(n){var o=this.option.selected,a=this.get("selectedMode");if(a==="single"){var u=this._data;each$4(u,function(c){o[c.get("name")]=!1})}o[n]=!0},r.prototype.unSelect=function(n){this.get("selectedMode")!=="single"&&(this.option.selected[n]=!1)},r.prototype.toggleSelected=function(n){var o=this.option.selected;o.hasOwnProperty(n)||(o[n]=!0),this[o[n]?"unSelect":"select"](n)},r.prototype.allSelect=function(){var n=this._data,o=this.option.selected;each$4(n,function(a){o[a.get("name",!0)]=!0})},r.prototype.inverseSelect=function(){var n=this._data,o=this.option.selected;each$4(n,function(a){var u=a.get("name",!0);o.hasOwnProperty(u)||(o[u]=!0),o[u]=!o[u]})},r.prototype.isSelected=function(n){var o=this.option.selected;return!(o.hasOwnProperty(n)&&!o[n])&&indexOf(this._availableNames,n)>=0},r.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},r.type="legend.plain",r.dependencies=["series"],r.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},r}(ComponentModel$1);const LegendModel$1=LegendModel;var curry=curry$1,each=each$4,Group$1=Group$3,LegendView=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n.newlineDisabled=!1,n}return r.prototype.init=function(){this.group.add(this._contentGroup=new Group$1),this.group.add(this._selectorGroup=new Group$1),this._isFirstRender=!0},r.prototype.getContentGroup=function(){return this._contentGroup},r.prototype.getSelectorGroup=function(){return this._selectorGroup},r.prototype.render=function(n,o,a){var u=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!n.get("show",!0)){var c=n.get("align"),d=n.get("orient");(!c||c==="auto")&&(c=n.get("left")==="right"&&d==="vertical"?"right":"left");var f=n.get("selector",!0),h=n.get("selectorPosition",!0);f&&(!h||h==="auto")&&(h=d==="horizontal"?"end":"start"),this.renderInner(c,n,o,a,f,d,h);var y=n.getBoxLayoutParams(),g={width:a.getWidth(),height:a.getHeight()},p=n.get("padding"),v=getLayoutRect(y,g,p),_=this.layoutInner(n,c,v,u,f,h),b=getLayoutRect(defaults({width:_.width,height:_.height},y),g,p);this.group.x=b.x-_.x,this.group.y=b.y-_.y,this.group.markRedraw(),this.group.add(this._backgroundEl=makeBackground(_,n))}},r.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},r.prototype.renderInner=function(n,o,a,u,c,d,f){var h=this.getContentGroup(),y=createHashMap(),g=o.get("selectedMode"),p=[];a.eachRawSeries(function(v){!v.get("legendHoverLink")&&p.push(v.id)}),each(o.getData(),function(v,_){var b=v.get("name");if(!this.newlineDisabled&&(b===""||b===`
243
243
  `)){var A=new Group$1;A.newline=!0,h.add(A);return}var w=a.getSeriesByName(b)[0];if(!y.get(b)){if(w){var T=w.getData(),S=T.getVisual("legendLineStyle")||{},x=T.getVisual("legendIcon"),L=T.getVisual("style"),M=this._createItem(w,b,_,v,o,n,S,L,x,g,u);M.on("click",curry(dispatchSelectAction,b,null,u,p)).on("mouseover",curry(dispatchHighlightAction,w.name,null,u,p)).on("mouseout",curry(dispatchDownplayAction,w.name,null,u,p)),a.ssr&&M.eachChild(function(O){var ie=getECData(O);ie.seriesIndex=w.seriesIndex,ie.dataIndex=_,ie.ssrType="legend"}),y.set(b,!0)}else a.eachRawSeries(function(O){if(!y.get(b)&&O.legendVisualProvider){var ie=O.legendVisualProvider;if(!ie.containName(b))return;var $=ie.indexOfName(b),z=ie.getItemVisual($,"style"),V=ie.getItemVisual($,"legendIcon"),re=parse(z.fill);re&&re[3]===0&&(re[3]=.2,z=extend(extend({},z),{fill:stringify(re,"rgba")}));var F=this._createItem(O,b,_,v,o,n,{},z,V,g,u);F.on("click",curry(dispatchSelectAction,null,b,u,p)).on("mouseover",curry(dispatchHighlightAction,null,b,u,p)).on("mouseout",curry(dispatchDownplayAction,null,b,u,p)),a.ssr&&F.eachChild(function(pe){var le=getECData(pe);le.seriesIndex=O.seriesIndex,le.dataIndex=_,le.ssrType="legend"}),y.set(b,!0)}},this);process.env.NODE_ENV!=="production"&&(y.get(b)||console.warn(b+" series not exists. Legend data should be same with series name or data name."))}},this),c&&this._createSelector(c,o,u,d,f)},r.prototype._createSelector=function(n,o,a,u,c){var d=this.getSelectorGroup();each(n,function(h){var y=h.type,g=new ZRText$1({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){a.dispatchAction({type:y==="all"?"legendAllSelect":"legendInverseSelect"})}});d.add(g);var p=o.getModel("selectorLabel"),v=o.getModel(["emphasis","selectorLabel"]);setLabelStyle(g,{normal:p,emphasis:v},{defaultText:h.title}),enableHoverEmphasis(g)})},r.prototype._createItem=function(n,o,a,u,c,d,f,h,y,g,p){var v=n.visualDrawType,_=c.get("itemWidth"),b=c.get("itemHeight"),A=c.isSelected(o),w=u.get("symbolRotate"),T=u.get("symbolKeepAspect"),S=u.get("icon");y=S||y||"roundRect";var x=getLegendStyle(y,u,f,h,v,A,p),L=new Group$1,M=u.getModel("textStyle");if(isFunction$1(n.getLegendIcon)&&(!S||S==="inherit"))L.add(n.getLegendIcon({itemWidth:_,itemHeight:b,icon:y,iconRotate:w,itemStyle:x.itemStyle,lineStyle:x.lineStyle,symbolKeepAspect:T}));else{var O=S==="inherit"&&n.getData().getVisual("symbol")?w==="inherit"?n.getData().getVisual("symbolRotate"):w:0;L.add(getDefaultLegendIcon({itemWidth:_,itemHeight:b,icon:y,iconRotate:O,itemStyle:x.itemStyle,lineStyle:x.lineStyle,symbolKeepAspect:T}))}var ie=d==="left"?_+5:-5,$=d,z=c.get("formatter"),V=o;isString$2(z)&&z?V=z.replace("{name}",o??""):isFunction$1(z)&&(V=z(o));var re=A?M.getTextColor():u.get("inactiveColor");L.add(new ZRText$1({style:createTextStyle(M,{text:V,x:ie,y:b/2,fill:re,align:$,verticalAlign:"middle"},{inheritColor:re})}));var F=new Rect$1({shape:L.getBoundingRect(),style:{fill:"transparent"}}),pe=u.getModel("tooltip");return pe.get("show")&&setTooltipConfig({el:F,componentModel:c,itemName:o,itemTooltipOption:pe.option}),L.add(F),L.eachChild(function(le){le.silent=!0}),F.silent=!g,this.getContentGroup().add(L),enableHoverEmphasis(L),L.__legendDataIndex=a,L},r.prototype.layoutInner=function(n,o,a,u,c,d){var f=this.getContentGroup(),h=this.getSelectorGroup();box(n.get("orient"),f,n.get("itemGap"),a.width,a.height);var y=f.getBoundingRect(),g=[-y.x,-y.y];if(h.markRedraw(),f.markRedraw(),c){box("horizontal",h,n.get("selectorItemGap",!0));var p=h.getBoundingRect(),v=[-p.x,-p.y],_=n.get("selectorButtonGap",!0),b=n.getOrient().index,A=b===0?"width":"height",w=b===0?"height":"width",T=b===0?"y":"x";d==="end"?v[b]+=y[A]+_:g[b]+=p[A]+_,v[1-b]+=y[w]/2-p[w]/2,h.x=v[0],h.y=v[1],f.x=g[0],f.y=g[1];var S={x:0,y:0};return S[A]=y[A]+_+p[A],S[w]=Math.max(y[w],p[w]),S[T]=Math.min(0,p[T]+v[1-b]),S}else return f.x=g[0],f.y=g[1],this.group.getBoundingRect()},r.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},r.type="legend.plain",r}(ComponentView$1);function getLegendStyle(i,r,n,o,a,u,c){function d(A,w){A.lineWidth==="auto"&&(A.lineWidth=w.lineWidth>0?2:0),each(A,function(T,S){A[S]==="inherit"&&(A[S]=w[S])})}var f=r.getModel("itemStyle"),h=f.getItemStyle(),y=i.lastIndexOf("empty",0)===0?"fill":"stroke",g=f.getShallow("decal");h.decal=!g||g==="inherit"?o.decal:createOrUpdatePatternFromDecal(g,c),h.fill==="inherit"&&(h.fill=o[a]),h.stroke==="inherit"&&(h.stroke=o[y]),h.opacity==="inherit"&&(h.opacity=(a==="fill"?o:n).opacity),d(h,o);var p=r.getModel("lineStyle"),v=p.getLineStyle();if(d(v,n),h.fill==="auto"&&(h.fill=o.fill),h.stroke==="auto"&&(h.stroke=o.fill),v.stroke==="auto"&&(v.stroke=o.fill),!u){var _=r.get("inactiveBorderWidth"),b=h[y];h.lineWidth=_==="auto"?o.lineWidth>0&&b?2:0:h.lineWidth,h.fill=r.get("inactiveColor"),h.stroke=r.get("inactiveBorderColor"),v.stroke=p.get("inactiveColor"),v.lineWidth=p.get("inactiveWidth")}return{itemStyle:h,lineStyle:v}}function getDefaultLegendIcon(i){var r=i.icon||"roundRect",n=createSymbol(r,0,0,i.itemWidth,i.itemHeight,i.itemStyle.fill,i.symbolKeepAspect);return n.setStyle(i.itemStyle),n.rotation=(i.iconRotate||0)*Math.PI/180,n.setOrigin([i.itemWidth/2,i.itemHeight/2]),r.indexOf("empty")>-1&&(n.style.stroke=n.style.fill,n.style.fill="#fff",n.style.lineWidth=2),n}function dispatchSelectAction(i,r,n,o){dispatchDownplayAction(i,r,n,o),n.dispatchAction({type:"legendToggleSelect",name:i??r}),dispatchHighlightAction(i,r,n,o)}function isUseHoverLayer(i){for(var r=i.getZr().storage.getDisplayList(),n,o=0,a=r.length;o<a&&!(n=r[o].states.emphasis);)o++;return n&&n.hoverLayer}function dispatchHighlightAction(i,r,n,o){isUseHoverLayer(n)||n.dispatchAction({type:"highlight",seriesName:i,name:r,excludeSeriesId:o})}function dispatchDownplayAction(i,r,n,o){isUseHoverLayer(n)||n.dispatchAction({type:"downplay",seriesName:i,name:r,excludeSeriesId:o})}const LegendView$1=LegendView;function legendFilter(i){var r=i.findComponents({mainType:"legend"});r&&r.length&&i.filterSeries(function(n){for(var o=0;o<r.length;o++)if(!r[o].isSelected(n.name))return!1;return!0})}function legendSelectActionHandler(i,r,n){var o={},a=i==="toggleSelected",u;return n.eachComponent("legend",function(c){a&&u!=null?c[u?"select":"unSelect"](r.name):i==="allSelect"||i==="inverseSelect"?c[i]():(c[i](r.name),u=c.isSelected(r.name));var d=c.getData();each$4(d,function(f){var h=f.get("name");if(!(h===`
244
- `||h==="")){var y=c.isSelected(h);o.hasOwnProperty(h)?o[h]=o[h]&&y:o[h]=y}})}),i==="allSelect"||i==="inverseSelect"?{selected:o}:{name:r.name,selected:o}}function installLegendAction(i){i.registerAction("legendToggleSelect","legendselectchanged",curry$1(legendSelectActionHandler,"toggleSelected")),i.registerAction("legendAllSelect","legendselectall",curry$1(legendSelectActionHandler,"allSelect")),i.registerAction("legendInverseSelect","legendinverseselect",curry$1(legendSelectActionHandler,"inverseSelect")),i.registerAction("legendSelect","legendselected",curry$1(legendSelectActionHandler,"select")),i.registerAction("legendUnSelect","legendunselected",curry$1(legendSelectActionHandler,"unSelect"))}function install$2(i){i.registerComponentModel(LegendModel$1),i.registerComponentView(LegendView$1),i.registerProcessor(i.PRIORITY.PROCESSOR.SERIES_FILTER,legendFilter),i.registerSubTypeDefaulter("legend",function(){return"plain"}),installLegendAction(i)}var ScrollableLegendModel=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n}return r.prototype.setScrollDataIndex=function(n){this.option.scrollDataIndex=n},r.prototype.init=function(n,o,a){var u=getLayoutParams(n);i.prototype.init.call(this,n,o,a),mergeAndNormalizeLayoutParams(this,n,u)},r.prototype.mergeOption=function(n,o){i.prototype.mergeOption.call(this,n,o),mergeAndNormalizeLayoutParams(this,this.option,n)},r.type="legend.scroll",r.defaultOption=inheritDefaultOption(LegendModel$1.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:"end",pageFormatter:"{current}/{total}",pageIcons:{horizontal:["M0,0L12,-10L12,10z","M0,0L-12,-10L-12,10z"],vertical:["M0,0L20,0L10,-20z","M0,0L20,0L10,20z"]},pageIconColor:"#2f4554",pageIconInactiveColor:"#aaa",pageIconSize:15,pageTextStyle:{color:"#333"},animationDurationUpdate:800}),r}(LegendModel$1);function mergeAndNormalizeLayoutParams(i,r,n){var o=i.getOrient(),a=[1,1];a[o.index]=0,mergeLayoutParam(r,n,{type:"box",ignoreSize:!!a})}const ScrollableLegendModel$1=ScrollableLegendModel;var Group=Group$3,WH=["width","height"],XY=["x","y"],ScrollableLegendView=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n.newlineDisabled=!0,n._currentIndex=0,n}return r.prototype.init=function(){i.prototype.init.call(this),this.group.add(this._containerGroup=new Group),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new Group)},r.prototype.resetInner=function(){i.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},r.prototype.renderInner=function(n,o,a,u,c,d,f){var h=this;i.prototype.renderInner.call(this,n,o,a,u,c,d,f);var y=this._controllerGroup,g=o.get("pageIconSize",!0),p=isArray$1(g)?g:[g,g];_("pagePrev",0);var v=o.getModel("pageTextStyle");y.add(new ZRText$1({name:"pageText",style:{text:"xx/xx",fill:v.getTextColor(),font:v.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),_("pageNext",1);function _(b,A){var w=b+"DataIndex",T=createIcon(o.get("pageIcons",!0)[o.getOrient().name][A],{onclick:bind$1(h._pageGo,h,w,o,u)},{x:-p[0]/2,y:-p[1]/2,width:p[0],height:p[1]});T.name=b,y.add(T)}},r.prototype.layoutInner=function(n,o,a,u,c,d){var f=this.getSelectorGroup(),h=n.getOrient().index,y=WH[h],g=XY[h],p=WH[1-h],v=XY[1-h];c&&box("horizontal",f,n.get("selectorItemGap",!0));var _=n.get("selectorButtonGap",!0),b=f.getBoundingRect(),A=[-b.x,-b.y],w=clone$2(a);c&&(w[y]=a[y]-b[y]-_);var T=this._layoutContentAndController(n,u,w,h,y,p,v,g);if(c){if(d==="end")A[h]+=T[y]+_;else{var S=b[y]+_;A[h]-=S,T[g]-=S}T[y]+=b[y]+_,A[1-h]+=T[v]+T[p]/2-b[p]/2,T[p]=Math.max(T[p],b[p]),T[v]=Math.min(T[v],b[v]+A[1-h]),f.x=A[0],f.y=A[1],f.markRedraw()}return T},r.prototype._layoutContentAndController=function(n,o,a,u,c,d,f,h){var y=this.getContentGroup(),g=this._containerGroup,p=this._controllerGroup;box(n.get("orient"),y,n.get("itemGap"),u?a.width:null,u?null:a.height),box("horizontal",p,n.get("pageButtonItemGap",!0));var v=y.getBoundingRect(),_=p.getBoundingRect(),b=this._showController=v[c]>a[c],A=[-v.x,-v.y];o||(A[u]=y[h]);var w=[0,0],T=[-_.x,-_.y],S=retrieve2(n.get("pageButtonGap",!0),n.get("itemGap",!0));if(b){var x=n.get("pageButtonPosition",!0);x==="end"?T[u]+=a[c]-_[c]:w[u]+=_[c]+S}T[1-u]+=v[d]/2-_[d]/2,y.setPosition(A),g.setPosition(w),p.setPosition(T);var L={x:0,y:0};if(L[c]=b?a[c]:v[c],L[d]=Math.max(v[d],_[d]),L[f]=Math.min(0,_[f]+T[1-u]),g.__rectSize=a[c],b){var M={x:0,y:0};M[c]=Math.max(a[c]-_[c]-S,0),M[d]=L[d],g.setClipPath(new Rect$1({shape:M})),g.__rectSize=M[c]}else p.eachChild(function(ie){ie.attr({invisible:!0,silent:!0})});var O=this._getPageInfo(n);return O.pageIndex!=null&&updateProps$1(y,{x:O.contentPosition[0],y:O.contentPosition[1]},b?n:null),this._updatePageInfoView(n,O),L},r.prototype._pageGo=function(n,o,a){var u=this._getPageInfo(o)[n];u!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:u,legendId:o.id})},r.prototype._updatePageInfoView=function(n,o){var a=this._controllerGroup;each$4(["pagePrev","pageNext"],function(y){var g=y+"DataIndex",p=o[g]!=null,v=a.childOfName(y);v&&(v.setStyle("fill",p?n.get("pageIconColor",!0):n.get("pageIconInactiveColor",!0)),v.cursor=p?"pointer":"default")});var u=a.childOfName("pageText"),c=n.get("pageFormatter"),d=o.pageIndex,f=d!=null?d+1:0,h=o.pageCount;u&&c&&u.setStyle("text",isString$2(c)?c.replace("{current}",f==null?"":f+"").replace("{total}",h==null?"":h+""):c({current:f,total:h}))},r.prototype._getPageInfo=function(n){var o=n.get("scrollDataIndex",!0),a=this.getContentGroup(),u=this._containerGroup.__rectSize,c=n.getOrient().index,d=WH[c],f=XY[c],h=this._findTargetItemIndex(o),y=a.children(),g=y[h],p=y.length,v=p?1:0,_={contentPosition:[a.x,a.y],pageCount:v,pageIndex:v-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!g)return _;var b=x(g);_.contentPosition[c]=-b.s;for(var A=h+1,w=b,T=b,S=null;A<=p;++A)S=x(y[A]),(!S&&T.e>w.s+u||S&&!L(S,w.s))&&(T.i>w.i?w=T:w=S,w&&(_.pageNextDataIndex==null&&(_.pageNextDataIndex=w.i),++_.pageCount)),T=S;for(var A=h-1,w=b,T=b,S=null;A>=-1;--A)S=x(y[A]),(!S||!L(T,S.s))&&w.i<T.i&&(T=w,_.pagePrevDataIndex==null&&(_.pagePrevDataIndex=w.i),++_.pageCount,++_.pageIndex),w=S;return _;function x(M){if(M){var O=M.getBoundingRect(),ie=O[f]+M[f];return{s:ie,e:ie+O[d],i:M.__legendDataIndex}}}function L(M,O){return M.e>=O&&M.s<=O+u}},r.prototype._findTargetItemIndex=function(n){if(!this._showController)return 0;var o,a=this.getContentGroup(),u;return a.eachChild(function(c,d){var f=c.__legendDataIndex;u==null&&f!=null&&(u=d),f===n&&(o=d)}),o??u},r.type="legend.scroll",r}(LegendView$1);const ScrollableLegendView$1=ScrollableLegendView;function installScrollableLegendAction(i){i.registerAction("legendScroll","legendscroll",function(r,n){var o=r.scrollDataIndex;o!=null&&n.eachComponent({mainType:"legend",subType:"scroll",query:r},function(a){a.setScrollDataIndex(o)})})}function install$1(i){use(install$2),i.registerComponentModel(ScrollableLegendModel$1),i.registerComponentView(ScrollableLegendView$1),installScrollableLegendAction(i)}function install(i){use(install$2),use(install$1)}const _sfc_main$I=vue.defineComponent({__name:"pie-charts",props:{title:{type:String,default:"标题"},seriesName:{type:String,default:"详情"},seriesData:{type:Array,default:()=>[]}},setup(i){use([install$7,install$6,install$3,install$4,install]),vue.provide(VChart.THEME_KEY,"dark");const r=i,n=vue.reactive({title:{text:r.title,left:"center"},tooltip:{trigger:"item",formatter:"{a} <br/>{b} : {c} ({d}%)"},legend:{orient:"vertical",left:"left"},series:[{name:r.seriesName,type:"pie",radius:"55%",center:["50%","60%"],data:r.seriesData,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]});return vue.watch(r,o=>{n.title.text=o.title,n.series[0].name=o.seriesName,n.series[0].data=o.seriesData}),(o,a)=>(vue.openBlock(),vue.createBlock(vue.unref(VChart),{class:"chart",option:vue.unref(n),autoresize:""},null,8,["option"]))}}),pieCharts_vue_vue_type_style_index_0_scoped_fec2cbf2_lang="",PieCharts=_export_sfc$1(_sfc_main$I,[["__scopeId","data-v-fec2cbf2"]]),_hoisted_1$g=["id"],_hoisted_2$e=["id"],_hoisted_3$b=["fill"],_hoisted_4$9=["fill"],_hoisted_5$8=["fill"],_hoisted_6$7=vue.createElementVNode("path",{d:"M375.466667 709.214815l-25.6 137.481481c0 2.844444 1.896296 5.688889 7.585185 10.42963l65.422222 54.992593c5.688889 4.740741 15.17037 8.533333 23.703704 10.429629l36.029629-193.422222-107.14074-19.911111z",fill:"#2D4375"},null,-1),_hoisted_7$7=vue.createElementVNode("path",{d:"M482.607407 729.125926l-36.029629 193.422222c9.481481 1.896296 18.014815 1.896296 25.6-0.948148l80.592592-27.496296c6.637037-1.896296 10.42963-4.740741 11.377778-6.637037L589.748148 749.037037l-107.140741-19.911111z",fill:"#1E2D4F"},null,-1),_hoisted_8$7=["fill-opacity"],_hoisted_9$6=["fill-opacity"],_hoisted_10$5=["fill-opacity"],_hoisted_11$4=vue.createElementVNode("path",{d:"M593.540741 807.822222c1.896296-7.585185-3.792593-15.17037-11.377778-16.118518l-107.140741-19.911111-4.740741 27.496296 107.140741 19.911111c6.637037 0.948148 14.222222-3.792593 16.118519-11.377778z",fill:"#CEEFF6"},null,-1),_hoisted_12$3=vue.createElementVNode("path",{d:"M366.933333 750.933333c-7.585185-1.896296-15.17037 3.792593-16.118518 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.14074 19.911111 4.740741-27.496297-107.140741-19.911111zM356.503704 808.77037c-7.585185-1.896296-15.17037 3.792593-16.118519 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.140741 19.911111 4.74074-27.496297-107.14074-19.911111z",fill:"#FFFFFF"},null,-1),_hoisted_13$3=vue.createElementVNode("path",{d:"M570.785185 848.592593l-107.140741-19.911112-4.74074 27.496297 107.14074 19.911111c7.585185 1.896296 15.17037-3.792593 16.118519-11.377778 1.896296-7.585185-2.844444-15.17037-11.377778-16.118518z",fill:"#CEEFF6"},null,-1),_hoisted_14$3=["xlink:href","width","height"],_sfc_main$H=vue.defineComponent({__name:"light-a",props:{id:{default:""},isOpen:{type:Boolean,default:!1},height:{default:100},width:{default:100}},emits:["onChange"],setup(i,{emit:r}){const n=i,o=r;return vue.watch(()=>n.isOpen,()=>{o("onChange")}),(a,u)=>(vue.openBlock(),vue.createElementBlock("g",{id:n.id,style:{cursor:"pointer"}},[vue.createElementVNode("symbol",{id:`${n.id}light-121`,viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{d:"M565.096296 289.185185s-0.948148 0 0 0c-110.933333-20.859259-208.592593 40.77037-237.985185 148.859259-14.222222 53.096296-24.651852 101.451852 44.562963 221.866667 14.222222 25.6 11.377778 70.162963 8.533333 95.762963-1.896296 14.222222 64.474074 36.02963 89.125926 42.666667l95.762963-509.155556z",fill:n.isOpen?"#FDB813":"#cccccc"},null,8,_hoisted_3$b),vue.createElementVNode("path",{d:"M732.918519 513.896296c11.377778-111.881481-56.888889-203.851852-166.874075-224.711111h-0.948148L469.333333 798.340741c25.6 2.844444 94.814815 6.637037 98.607408-7.585185 6.637037-25.6 20.859259-67.318519 42.666666-86.281482C719.644444 618.192593 727.22963 568.888889 732.918519 513.896296z",fill:n.isOpen?"#FD9B13":"#bbbbbb"},null,8,_hoisted_4$9),vue.createElementVNode("path",{d:"M467.437037 806.874074c-7.585185-0.948148-12.325926-7.585185-14.222222-14.222222l-38.874074-256c-0.948148-5.688889 0.948148-11.377778 4.74074-15.170371 3.792593-3.792593 9.481481-5.688889 15.170371-4.74074l167.822222 31.288889c5.688889 0.948148 10.42963 4.740741 12.325926 9.481481 1.896296 4.740741 1.896296 11.377778-0.948148 16.118519L486.4 798.340741c-3.792593 6.637037-11.377778 10.42963-18.962963 8.533333z m-14.222222-251.259259l27.496296 182.992592L572.681481 578.37037l-119.466666-22.755555z",fill:n.isOpen?"#F12A3F":"#666666"},null,8,_hoisted_5$8),_hoisted_6$7,_hoisted_7$7,vue.createElementVNode("path",{d:"M612.503704 217.125926c-3.792593 18.014815-20.859259 29.392593-38.874074 26.548148-18.014815-3.792593-30.340741-20.859259-26.548149-38.874074l18.962963-100.503704c3.792593-18.014815 20.859259-29.392593 38.874075-26.548148 18.014815 3.792593 30.340741 20.859259 26.548148 38.874074l-18.962963 100.503704z",fill:"#FDB813","fill-opacity":n.isOpen?1:0},null,8,_hoisted_8$7),vue.createElementVNode("path",{d:"M382.103704 228.503704c10.42963 15.17037 6.637037 36.02963-8.533334 46.459259-15.17037 10.42963-36.02963 6.637037-46.459259-8.533333l-57.837037-84.385186c-10.42963-15.17037-6.637037-36.02963 8.533333-46.459259 15.17037-10.42963 36.02963-6.637037 46.45926 8.533334l57.837037 84.385185zM757.57037 298.666667c-15.17037 10.42963-18.962963 31.288889-8.533333 46.459259 10.42963 15.17037 31.288889 18.962963 46.459259 8.533333l84.385185-57.837037c15.17037-10.42963 18.962963-31.288889 8.533334-46.459259-10.42963-15.17037-31.288889-18.962963-46.459259-8.533333l-84.385186 57.837037z",fill:"#FDB813","fill-opacity":n.isOpen?1:0},null,8,_hoisted_9$6),vue.createElementVNode("path",{d:"M252.207407 361.244444c18.014815 3.792593 30.340741 20.859259 26.548149 38.874075-3.792593 18.014815-20.859259 29.392593-38.874075 26.548148l-100.503703-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874074 3.792593-18.014815 20.859259-29.392593 38.874074-26.548149l100.503703 18.962963zM931.081481 488.296296c18.014815 3.792593 30.340741 20.859259 26.548149 38.874074-3.792593 18.014815-20.859259 29.392593-38.874074 26.548149l-100.503704-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874075 3.792593-18.014815 20.859259-29.392593 38.874074-26.548148l100.503703 18.962963z",fill:"#FDB813","fill-opacity":n.isOpen?1:0},null,8,_hoisted_10$5),_hoisted_11$4,_hoisted_12$3,_hoisted_13$3],8,_hoisted_2$e),vue.createElementVNode("use",{"xlink:href":`#${n.id}light-121`,width:a.width,height:a.height},null,8,_hoisted_14$3)],8,_hoisted_1$g))}}),_hoisted_1$f=["id"],_hoisted_2$d=["id"],_hoisted_3$a=["fill"],_hoisted_4$8=["fill"],_hoisted_5$7=["fill"],_hoisted_6$6=["from","to"],_hoisted_7$6=["fill"],_hoisted_8$6=["from","to"],_hoisted_9$5=["fill"],_hoisted_10$4=["fill"],_hoisted_11$3=["fill"],_hoisted_12$2=["from","to"],_hoisted_13$2=["fill"],_hoisted_14$2=["xlink:href"],_sfc_main$G=vue.defineComponent({__name:"clock-a",props:{id:{default:""},centerColor:{default:"#EBF257"},secondsColor:{default:"#E83E24"},circleColor:{default:"#F45AFC"},minutesColor:{default:"#50E68E"},hoursColor:{default:"#9A36E7"},scaleColor:{default:"#4942CF"},backgroundColor:{default:"#ffffff"},borderColor:{default:"#B3A7FF"}},setup(i){const r=i,n=new Date(Number(window.sessionStorage.getItem("editorLoadTime")||"0")),o=n.getSeconds()+1,a=n.getMinutes(),u=Math.floor((n.getHours()+(a+o/60)/60)*30);return(c,d)=>(vue.openBlock(),vue.createElementBlock("g",{id:r.id},[vue.createElementVNode("symbol",{id:`${r.id}clock-a-n`,viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{d:"M512.3 518.9m-469.2 0a469.2 469.2 0 1 0 938.4 0 469.2 469.2 0 1 0-938.4 0Z",fill:r.borderColor},null,8,_hoisted_3$a),vue.createElementVNode("path",{d:"M512.3 518.9m-392.5 0a392.5 392.5 0 1 0 785 0 392.5 392.5 0 1 0-785 0Z",fill:r.backgroundColor},null,8,_hoisted_4$8),vue.createElementVNode("path",{d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1L318.3 337.1c-6.8-6.8-6.8-17.9 0-24.8 6.8-6.8 17.9-6.8 24.8 0L524.7 494c6.8 6.8 6.8 17.9 0 24.8-3.5 3.3-7.9 5-12.4 5z",fill:r.minutesColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${45+vue.unref(a)*6} 512.3 506.3`,to:`${405+vue.unref(a)*6} 512.3 506.3`,dur:"3600s",repeatCount:"indefinite"},null,8,_hoisted_6$6)],8,_hoisted_5$7),vue.createElementVNode("path",{d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1-6.8-6.8-6.8-17.9 0-24.8l130.8-130.8c6.8-6.8 17.9-6.8 24.8 0 6.8 6.8 6.8 17.9 0 24.8L524.7 518.7c-3.5 3.4-7.9 5.1-12.4 5.1z",fill:r.hoursColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${-45+vue.unref(u)} 512.3 506.3`,to:`${315+vue.unref(u)} 512.3 506.3`,dur:"43200s",repeatCount:"indefinite"},null,8,_hoisted_8$6)],8,_hoisted_7$6),vue.createElementVNode("path",{d:"M512.3 506.3m-47.5 0a47.5 47.5 0 1 0 95 0 47.5 47.5 0 1 0-95 0Z",fill:r.circleColor},null,8,_hoisted_9$5),vue.createElementVNode("path",{d:"M512.3 218.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM512.3 880.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM812.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3zM150.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3z",fill:r.scaleColor},null,8,_hoisted_10$4),vue.createElementVNode("path",{d:"M296.9 733.5c-2.2 0-4.5-0.9-6.2-2.6-3.4-3.4-3.4-9 0-12.4L540 469.2c3.4-3.4 9-3.4 12.4 0 3.4 3.4 3.4 9 0 12.4L303.1 731c-1.7 1.7-4 2.5-6.2 2.5z",fill:r.secondsColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${135.5+o*6} 512.3 506.3`,to:`${495.5+o*6} 512.3 506.3`,dur:"60s",repeatCount:"indefinite"},null,8,_hoisted_12$2)],8,_hoisted_11$3),vue.createElementVNode("path",{d:"M512.3 506.3m-22.8 0a22.8 22.8 0 1 0 45.6 0 22.8 22.8 0 1 0-45.6 0Z",fill:r.centerColor},null,8,_hoisted_13$2)],8,_hoisted_2$d),vue.createElementVNode("use",{"xlink:href":`#${r.id}clock-a-n`,width:"100",height:"100"},null,8,_hoisted_14$2)],8,_hoisted_1$f))}}),_sfc_main$F=vue.defineComponent({__name:"text-box",props:{width:{default:250},height:{default:150},bgColor:{default:"#ffffff"},bgOpacity:{default:50},borderColor:{default:"#000000"},borderWidth:{default:1},borderRadius:{default:5},borderOpacity:{default:100}},setup(i){const r=i,n=vue.computed(()=>({width:(r.width>0?r.width:0)+"px",height:(r.height>0?r.height:0)+"px",borderRadius:(r.borderRadius>0?r.borderRadius:0)+"px"})),o=vue.computed(()=>({border:`${r.borderWidth>0?r.borderWidth:0}px solid ${r.borderColor}`,borderRadius:(r.borderRadius>0?r.borderRadius:0)+"px",opacity:(r.borderOpacity>0?r.borderOpacity<100?r.borderOpacity:100:0)/100})),a=vue.computed(()=>({backgroundColor:r.bgColor,opacity:(r.bgOpacity>0?r.bgOpacity<100?r.bgOpacity:100:0)/100,borderRadius:r.borderRadius+"px"}));return(u,c)=>(vue.openBlock(),vue.createElementBlock("div",{class:"outM",style:vue.normalizeStyle(n.value)},[vue.createElementVNode("div",{class:"wallI",style:vue.normalizeStyle(a.value)},null,4),vue.createElementVNode("div",{class:"borderB",style:vue.normalizeStyle(o.value)},null,4)],4))}}),textBox_vue_vue_type_style_index_0_scoped_4ab181ea_lang="",TextBox=_export_sfc$1(_sfc_main$F,[["__scopeId","data-v-4ab181ea"]]),vueComp={"svg-text":_sfc_main$L,"el-button":elementPlus.ElButton,"progress-a":_sfc_main$N,"el-tag":elementPlus.ElTag,"common-table":_sfc_main$K,"pie-charts":PieCharts,"switch-r":_sfc_main$M,"now-time":NowTime,"light-a":_sfc_main$H,"clock-a":_sfc_main$G,"text-box":TextBox},config=[...t$b,...t$1],useGlobalStore=pinia$1.defineStore("global-store",{state:()=>({config_center:config,intention:EGlobalStoreIntention.None,create_svg_info:null,done_json:[],mouse_info:{state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},handle_svg_info:null,scale_info:{type:EScaleInfoType.None,scale_times:{x:1,y:1},scale_item_info:{x:0,y:0},symmetric_point:{x:0,y:0}},rotate_info:{angle:0},connection_line_node_info:{init_pos:{x:0,y:0},point_index:0}}),actions:{setCreateInfo(i){this.intention=EGlobalStoreIntention.Create,this.create_svg_info=i},setDoneJson(i){isOfType(i,"id")?(this.done_json.push(i),vue.nextTick(()=>{setSvgActualInfo(i)})):this.done_json=objectDeepClone(i),vue.nextTick(()=>{useHistoryRecord(objectDeepClone(this.done_json))})},setHandleSvgInfo(i,r){let n=r;i?(!n&&n!=0&&(n=this.done_json.findIndex(o=>o.id===i.id)??-1),this.handle_svg_info={info:i,index:n}):this.handle_svg_info=i},spliceDoneJson(i){const r=useGlobalStore(),o=r.done_json.splice(i,1)[0];unbindAnchors(o.id),useHistoryRecord(r.done_json)}}}),useSvgEditLayoutStore=pinia$1.defineStore("svg-edit-layout-store",{state:()=>({left_nav:!0,right_nav:!0,center_offset:{x:0,y:0},canvasInfo:{with:0,height:0,top:0,left:0}})}),stopEvent=i=>{i.stopPropagation()},preventDefault=i=>{i.preventDefault()},myFixed=(i,r)=>Number(i.toFixed(r));function componentsRegister(i){var o,a;const r=vue.getCurrentInstance(),n=i?Object.assign(vueComp,i):vueComp;for(let u in n)!((o=r==null?void 0:r.appContext)!=null&&o.components.hasOwnProperty(u))&&vueComp.hasOwnProperty(u)&&((a=r==null?void 0:r.appContext)==null||a.app.component(u,vueComp[u]))}function setEditorLoadTime(){window.sessionStorage.setItem("editorLoadTime",new Date().getTime().toString())}const randomString=i=>{i=i||10;const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=r.length;let o="";for(let a=0;a<i;a++){let u=n;a===0&&(u=n-10),o+=r.charAt(Math.floor(Math.random()*u))}return o},isOfType=(i,r)=>i[r]!==void 0,getCoordinateOffset=(i,r)=>i/2*(r-1),angleToRadian=i=>i*Math.PI/180,calculateRotatedPointCoordinate=(i,r,n)=>({x:myFixed((i.x-r.x)*Math.cos(angleToRadian(n))-(i.y-r.y)*Math.sin(angleToRadian(n))+r.x,1),y:myFixed((i.x-r.x)*Math.sin(angleToRadian(n))+(i.y-r.y)*Math.cos(angleToRadian(n))+r.y,1)}),getCenterPoint=(i,r)=>({x:i.x+(r.x-i.x)/2,y:i.y+(r.y-i.y)/2}),positionArrToPath=i=>{let r="";for(let n=0;n<i.length;n++)n===0?r+=`M ${i[n].x} ${i[n].y}`:r+=` L ${i[n].x} ${i[n].y}`;return r},getSvgNowPosition=(i,r,n)=>n+(r-i),objectDeepClone=(i,r={})=>i?JSON.parse(JSON.stringify(i)):r,setSvgActualInfo=(i,r)=>{var a,u;const n=document.querySelector(`#${i.id}`),o=document.querySelector(`#rect${i.id}`);if(n){let c=0,d=0,f=0,h=0;if(i.type===EDoneJsonType.Vue){f=((a=i.props.width)==null?void 0:a.val)||n.offsetWidth||100,h=((u=i.props.height)==null?void 0:u.val)||n.offsetHeight||100,c=50-f/2,d=50-h/2;const y=document.querySelector(`#foreign-object${i.id}`);y&&(y.getAttribute("x")==="0"&&y.getAttribute("y")==="0"&&y.getAttribute("width")==="0"&&y.getAttribute("height")==="0"||r)&&(y.setAttribute("x",c.toString()),y.setAttribute("y",d.toString()),y.setAttribute("width",f.toString()),y.setAttribute("height",h.toString()))}else{const y=n.getBBox();c=myFixed(y.x,0),d=myFixed(y.y,0),f=myFixed(y.width,0),h=myFixed(y.height,0)}o&&(o.getAttribute("x")==="0"&&o.getAttribute("y")==="0"&&o.getAttribute("width")==="0"&&o.getAttribute("height")==="0"||r)&&(o.setAttribute("x",c.toString()),o.setAttribute("y",d.toString()),o.setAttribute("width",f.toString()),o.setAttribute("height",h.toString())),(i.actual_bound.x===0&&i.actual_bound.y===0&&i.actual_bound.width===0&&i.actual_bound.height===0||r)&&(i.actual_bound={x:c,y:d,width:f,height:h}),i.center_position={x:i.x+i.actual_bound.x+f/2,y:i.y+i.actual_bound.y+h/2},i.point_coordinate.tl={x:i.center_position.x-f*i.scale_x/2,y:i.center_position.y-h*i.scale_y/2},i.point_coordinate.tc={x:i.center_position.x,y:i.center_position.y-h*i.scale_y/2},i.point_coordinate.tr={x:i.center_position.x+f*i.scale_x/2,y:i.center_position.y-h*i.scale_y/2},i.point_coordinate.l={x:i.center_position.x-f*i.scale_x/2,y:i.center_position.y},i.point_coordinate.r={x:i.center_position.x+f*i.scale_x/2,y:i.center_position.y},i.point_coordinate.bl={x:i.center_position.x-f*i.scale_x/2,y:i.center_position.y+h*i.scale_y/2},i.point_coordinate.bc={x:i.center_position.x,y:i.center_position.y+h*i.scale_y/2},i.point_coordinate.br={x:i.center_position.x+f*i.scale_x/2,y:i.center_position.y+h*i.scale_y/2},i.rotate!==0&&setAfterRotationPointCoordinate(i),moveAnchors(i)}},resetHandlePointOld=i=>{for(const r of Object.keys(i.point_coordinate))i.point_coordinate_old&&(i.point_coordinate_old[r].x=0,i.point_coordinate_old[r].y=0)},moveHandlePoint=(i,r,n)=>{const o=useGlobalStore(pinia),a=r??o.mouse_info.new_position_x-o.mouse_info.position_x,u=n??o.mouse_info.new_position_y-o.mouse_info.position_y;for(const c of Object.keys(i.point_coordinate))r!==void 0&&n!==void 0?(i.point_coordinate[c].x+=a,i.point_coordinate[c].y+=u):i.point_coordinate_old&&(i.point_coordinate[c].x=i.point_coordinate_old[c].x+a,i.point_coordinate[c].y=i.point_coordinate_old[c].y+u)},moveAnchors=i=>{var n,o,a,u;const r=useGlobalStore(pinia);for(let c of r.done_json)if(c.type===EDoneJsonType.ConnectionLine){if(((o=(n=c.bind_anchors)==null?void 0:n.start)==null?void 0:o.target_id)===i.id){const d=getAnchorPosByAnchorType(c.bind_anchors.start.type,i);c.props.point_position.val[0]={x:d.x-c.x,y:d.y-c.y}}if(((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===i.id){const d=getAnchorPosByAnchorType(c.bind_anchors.end.type,i);c.props.point_position.val[c.props.point_position.val.length-1]={x:d.x-c.x,y:d.y-c.y}}}},unbindAnchors=i=>{var n,o,a,u;const r=useGlobalStore(pinia);for(let c of r.done_json)c.type===EDoneJsonType.ConnectionLine&&(((o=(n=c.bind_anchors)==null?void 0:n.start)==null?void 0:o.target_id)===i&&(c.bind_anchors.start=null),((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===i&&(c.bind_anchors.end=null))},getAnchorPosByAnchorType=(i,r)=>i===ELineBindAnchors.BottomCenter?r.point_coordinate.bc:i===ELineBindAnchors.Left?r.point_coordinate.l:i===ELineBindAnchors.Right?r.point_coordinate.r:r.point_coordinate.tc,setAfterRotationPointCoordinate=i=>{i.point_coordinate={tl:calculateRotatedPointCoordinate(i.point_coordinate.tl,i.center_position,i.rotate),tc:calculateRotatedPointCoordinate(i.point_coordinate.tc,i.center_position,i.rotate),tr:calculateRotatedPointCoordinate(i.point_coordinate.tr,i.center_position,i.rotate),l:calculateRotatedPointCoordinate(i.point_coordinate.l,i.center_position,i.rotate),r:calculateRotatedPointCoordinate(i.point_coordinate.r,i.center_position,i.rotate),bl:calculateRotatedPointCoordinate(i.point_coordinate.bl,i.center_position,i.rotate),bc:calculateRotatedPointCoordinate(i.point_coordinate.bc,i.center_position,i.rotate),br:calculateRotatedPointCoordinate(i.point_coordinate.br,i.center_position,i.rotate)}},prosToVBind=(i,r=[])=>{let n={};if(i.state){for(const o in i.state)if(i.state.hasOwnProperty(o)&&o===i.defaultState){for(let a in i.state[o])a!=="label"&&(n[lodashEs.kebabCase(a)]=i.state[o][a]);break}}for(const o in i.props)r.indexOf(o)<0&&(n[lodashEs.kebabCase(o)]=i.props[o].val);return n},setArrItemByID=(id,key,val,json_arr)=>new Promise(res=>{const find_item=json_arr.find(i=>i.id===id);find_item||res({status:!1,msg:"要设置的id不存在"}),eval(`find_item.${key} = val;`),res({status:!0,msg:"操作成功"})}),getCommonClass=i=>!i.common_animations||!i.common_animations.val?"":`common-ani animate__animated animate__${i.common_animations.val} animate__${i.common_animations.speed} animate__${i.common_animations.repeat} animate__${i.common_animations.delay}`,numberArray=i=>{let r=[];for(let n=0;n<i;n++)r.push(n);return r},getStringWidth=(i,r=12)=>{if(i.length>0){let n=document.createElement("span");n.style.fontSize=r+"px",n.style.fontFamily="inherit",n.innerHTML=i,n.style.opacity="0",n.style.position="fixed",n.style.top="3000px",document.body.append(n);const o=n.clientWidth;return document.body.removeChild(n),o}return 0},valFormat=i=>/false|true/.test(i)?i!=="false":/^\d+(\.\d+)?$/.test(i)?Number(i):i,createLine=(i,r,n)=>{i.preventDefault();const o=useGlobalStore(pinia),a=useConfigStore(pinia),u=useSvgEditLayoutStore(pinia),{clientX:c,clientY:d}=i;let f=objectDeepClone(a.connection_line),h=0,y=0;if(r&&n){f.bind_anchors.start={type:r,target_id:n.id};let p=getAnchorPosByAnchorType(r,n);h=p.x,y=p.y}else h=Math.round((c-u.canvasInfo.left)/a.svg.scale-u.center_offset.x),y=Math.round((d-u.canvasInfo.top)/a.svg.scale-u.center_offset.y);const g={id:randomString(),x:h,y,client:{x:h,y},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},...f};g.props.point_position.val.push({x:0,y:0}),o.setDoneJson(g),o.setHandleSvgInfo(g,o.done_json.length-1),o.intention=EGlobalStoreIntention.Connection,o.mouse_info={state:EMouseInfoState.Down,position_x:h,position_y:y,now_position_x:h,now_position_y:y,new_position_x:0,new_position_y:0}},getZoomPosition=(i,r,n,o)=>{const a=i.layerX,u=i.layerY,c=n.x,d=n.y,f=myFixed(o?r-.1:r+.1,1),h=myFixed(c+a*(f-1)/f,1),y=myFixed(d+u*(f-1)/f,1);n.x=myFixed(h/r-(a-h)*(r-1)/r,2),n.y=myFixed(y/r-(u-y)*(r-1)/r,2)};Object.seal({name:"straight-line",title:"直线",type:EDoneJsonType.StraightLine,config:{can_zoom:!1,have_anchor:!1,actual_rect:!1},display:!0,props:{fill:{title:"填充色",type:EConfigItemPropsType.Color,val:"#ff0000"},start_x:{title:"起点x坐标",type:EConfigItemPropsType.InputNumber,val:0},start_y:{title:"起点y坐标",type:EConfigItemPropsType.InputNumber,val:0},end_x:{title:"终点x坐标",type:EConfigItemPropsType.InputNumber,val:0},end_y:{title:"终点y坐标",type:EConfigItemPropsType.InputNumber,val:0}},bind_anchors:{start:null,end:null},events:[]});const connection_line_system={name:"connection_line",title:"连接线",type:EDoneJsonType.ConnectionLine,config:{can_zoom:!1,have_anchor:!1,actual_rect:!1},display:!0,props:{stroke:{title:"线条颜色",type:EConfigItemPropsType.Color,val:"#ff0000"},"stroke-width":{title:"线条宽度",type:EConfigItemPropsType.InputNumber,val:2},point_r:{title:"节点半径",type:EConfigItemPropsType.InputNumber,val:4},point_position:{title:"点坐标",type:EConfigItemPropsType.JsonEdit,val:[]}},animations:{type:{title:"动画类型",type:EConfigItemPropsType.Select,val:EConfigAnimationsType.None,options:[{label:"无",value:EConfigAnimationsType.None},{label:"电流",value:EConfigAnimationsType.Electricity},{label:"轨迹",value:EConfigAnimationsType.Track},{label:"水珠",value:EConfigAnimationsType.WaterDrop}]},dur:{title:"持续时间",type:EConfigItemPropsType.InputNumber,val:20},repeatCount:{title:"循环次数",type:EConfigItemPropsType.Input,val:"indefinite",disabled:!0},color:{title:"颜色",type:EConfigItemPropsType.Color,val:"#602a00"},reverse:{title:"反转动画",type:EConfigItemPropsType.Switch,val:!1}},bind_anchors:{start:null,end:null},events:[]},common_animate_list=[{label:"进入",children:[{label:"渐显",value:"fadeIn"},{label:"向右进入",value:"fadeInLeft"},{label:"向左进入",value:"fadeInRight"},{label:"向上进入",value:"fadeInUp"},{label:"向下进入",value:"fadeInDown"},{label:"向右长距进入",value:"fadeInLeftBig"},{label:"向左长距进入",value:"fadeInRightBig"},{label:"向上长距进入",value:"fadeInUpBig"},{label:"向下长距进入",value:"fadeInDownBig"},{label:"旋转进入",value:"rotateIn"},{label:"左顺时针旋转",value:"rotateInDownLeft"},{label:"右逆时针旋转",value:"rotateInDownRight"},{label:"左逆时针旋转",value:"rotateInUpLeft"},{label:"右逆时针旋转",value:"rotateInUpRight"},{label:"弹入",value:"bounceIn"},{label:"向右弹入",value:"bounceInLeft"},{label:"向左弹入",value:"bounceInRight"},{label:"向上弹入",value:"bounceInUp"},{label:"向下弹入",value:"bounceInDown"},{label:"光速从右进入",value:"lightSpeedInRight"},{label:"光速从左进入",value:"lightSpeedInLeft"},{label:"光速从右退出",value:"lightSpeedOutRight"},{label:"光速从左退出",value:"lightSpeedOutLeft"},{label:"Y轴旋转",value:"flip"},{label:"中心X轴旋转",value:"flipInX"},{label:"中心Y轴旋转",value:"flipInY"},{label:"左长半径旋转",value:"rollIn"},{label:"由小变大进入",value:"zoomIn"},{label:"左变大进入",value:"zoomInLeft"},{label:"右变大进入",value:"zoomInRight"},{label:"向上变大进入",value:"zoomInUp"},{label:"向下变大进入",value:"zoomInDown"},{label:"向右滑动展开",value:"slideInLeft"},{label:"向左滑动展开",value:"slideInRight"},{label:"向上滑动展开",value:"slideInUp"},{label:"向下滑动展开",value:"slideInDown"}]},{label:"强调",children:[{label:"弹跳",value:"bounce"},{label:"闪烁",value:"flash"},{label:"放大缩小",value:"pulse"},{label:"放大缩小弹簧",value:"rubberBand"},{label:"左右晃动",value:"headShake"},{label:"左右扇形摇摆",value:"swing"},{label:"放大晃动缩小",value:"tada"},{label:"扇形摇摆",value:"wobble"},{label:"左右上下晃动",value:"jello"},{label:"Y轴旋转",value:"flip"}]},{label:"退出",children:[{label:"渐隐",value:"fadeOut"},{label:"向左退出",value:"fadeOutLeft"},{label:"向右退出",value:"fadeOutRight"},{label:"向上退出",value:"fadeOutUp"},{label:"向下退出",value:"fadeOutDown"},{label:"向左长距退出",value:"fadeOutLeftBig"},{label:"向右长距退出",value:"fadeOutRightBig"},{label:"向上长距退出",value:"fadeOutUpBig"},{label:"向下长距退出",value:"fadeOutDownBig"},{label:"旋转退出",value:"rotateOut"},{label:"左顺时针旋转",value:"rotateOutDownLeft"},{label:"右逆时针旋转",value:"rotateOutDownRight"},{label:"左逆时针旋转",value:"rotateOutUpLeft"},{label:"右逆时针旋转",value:"rotateOutUpRight"},{label:"弹出",value:"bounceOut"},{label:"向左弹出",value:"bounceOutLeft"},{label:"向右弹出",value:"bounceOutRight"},{label:"向上弹出",value:"bounceOutUp"},{label:"向下弹出",value:"bounceOutDown"},{label:"中心X轴旋转",value:"flipOutX"},{label:"中心Y轴旋转",value:"flipOutY"},{label:"左长半径旋转",value:"rollOut"},{label:"由小变大退出",value:"zoomOut"},{label:"左变大退出",value:"zoomOutLeft"},{label:"右变大退出",value:"zoomOutRight"},{label:"向上变大退出",value:"zoomOutUp"},{label:"向下变大退出",value:"zoomOutDown"},{label:"向左滑动收起",value:"slideOutLeft"},{label:"向右滑动收起",value:"slideOutRight"},{label:"向上滑动收起",value:"slideOutUp"},{label:"向下滑动收起",value:"slideOutDown"}]}];let l=localStorage.getItem("svg-editor-config"),s,t;if(l){let i=JSON.parse(l);t=i.connection_line,s=i.svg}else t=objectDeepClone(connection_line_system),s={background_color:"#fff",scale:1,grid:!0,grid_color:"#ebebeb",ruler:!0};const useConfigStore=pinia$1.defineStore("config-store",{state:()=>({svg:s,connection_line:t,net:{mqtt:{url:"",user:"",pwd:"",topics:""}}}),getters:{},actions:{}});var EContextMenuInfoType=(i=>(i.Copy="Copy",i.Delete="Delete",i.MoveUpOneLevel="MoveUpOneLevel",i.MoveDownOneLevel="MoveDownOneLevel",i.MoveUpTopLevel="MoveUpTopLevel",i.MoveDownTopLevel="MoveDownTopLevel",i))(EContextMenuInfoType||{});const useEditPrivateStore=pinia$1.defineStore("edit-private-store",{state:()=>({old_done_components:[],history_doneComponent:[],history_now_index:0,is_record_history:!0,max_record_times:10}),getters:{getTopBtnUndoStatus(i){return i.history_now_index>=1},getTopBtnRedoStatus(i){return i.history_now_index+1!=i.history_doneComponent.length}},actions:{topUndoBtnClick(){if(console.log("撤销"),this.history_now_index<1)return;const i=useGlobalStore();this.is_record_history=!1,this.history_now_index-=1,i.setDoneJson(this.history_doneComponent[this.history_now_index])},topRedoBtnClick(){if(console.log("重做"),this.history_now_index+1==this.history_doneComponent.length)return;const i=useGlobalStore();this.is_record_history=!1,this.history_now_index+=1,i.setDoneJson(this.history_doneComponent[this.history_now_index])}}}),useContextMenuStore=pinia$1.defineStore("context-menu-store",{state:()=>({display:!1,info:{[EContextMenuInfoType.Copy]:{title:"复制",hot_key:"Ctrl + c",enable:!0},[EContextMenuInfoType.Delete]:{title:"删除",hot_key:"Delete",enable:!0},[EContextMenuInfoType.MoveUpTopLevel]:{title:"置于顶层",hot_key:"Ctrl + →",enable:!0},[EContextMenuInfoType.MoveDownTopLevel]:{title:"置于底层",hot_key:"Ctrl + ←",enable:!0},[EContextMenuInfoType.MoveUpOneLevel]:{title:"置于上一层",hot_key:"Ctrl + ↑",enable:!0},[EContextMenuInfoType.MoveDownOneLevel]:{title:"置于下一层",hot_key:"Ctrl + ↓",enable:!0}}}),actions:{onContextMenuClick(i){const r=useGlobalStore();if(r.handle_svg_info)switch(r.intention=EGlobalStoreIntention.Select,i){case EContextMenuInfoType.Copy:const n=objectDeepClone(r.handle_svg_info.info);n.id=randomString(),n.title+="-copy",n.x+=10,n.y+=10,r.setDoneJson(n),this.display=!1,r.setHandleSvgInfo(n,r.done_json.length);break;case EContextMenuInfoType.Delete:r.spliceDoneJson(r.handle_svg_info.index),this.display=!1,r.setHandleSvgInfo(null),r.intention=EGlobalStoreIntention.None;break;case EContextMenuInfoType.MoveUpOneLevel:if(r.done_json.length===1||r.handle_svg_info.index===r.done_json.length-1)return;const o=r.handle_svg_info.info;r.done_json[r.handle_svg_info.index]=r.done_json[r.handle_svg_info.index+1],r.done_json[r.handle_svg_info.index+1]=o,useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(o,r.handle_svg_info.index+1);break;case EContextMenuInfoType.MoveDownOneLevel:if(r.done_json.length===1||r.handle_svg_info.index===0)return;const a=r.handle_svg_info.info;r.done_json[r.handle_svg_info.index]=r.done_json[r.handle_svg_info.index-1],r.done_json[r.handle_svg_info.index-1]=a,useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(a,r.handle_svg_info.index-1);break;case EContextMenuInfoType.MoveDownTopLevel:if(r.done_json.length===1||r.handle_svg_info.index===0)return;const u=r.handle_svg_info.info;r.done_json.splice(r.handle_svg_info.index,1),r.done_json.unshift(u),useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(u,0);break;case EContextMenuInfoType.MoveUpTopLevel:if(r.done_json.length===1||r.handle_svg_info.index===r.done_json.length)return;const c=r.handle_svg_info.info;r.done_json.splice(r.handle_svg_info.index,1),r.done_json.push(c),useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(c,r.done_json.length-1);break}}}}),pinia=pinia$1.createPinia(),useHistoryRecord=i=>{const r=useEditPrivateStore();r.is_record_history&&(r.history_now_index+1<r.history_doneComponent.length&&r.history_doneComponent.splice(r.history_now_index+1),r.history_doneComponent.push(i),r.history_now_index=r.history_doneComponent.length-1,r.history_doneComponent.length>r.max_record_times&&(r.history_doneComponent.shift(),r.history_now_index=r.history_doneComponent.length-1)),r.is_record_history=!0},useImportDataModel=i=>{try{const r=JSON.parse(i);if(!r.config||!r.layout_center||!r.done_json)return elementPlus.ElMessage.error("请导入正确的数据模型!"),!1;const n=useGlobalStore(pinia),o=useSvgEditLayoutStore(pinia),a=useConfigStore(pinia);return a.$state=r.config,o.center_offset=r.layout_center,n.setDoneJson(r.done_json),!0}catch(r){return elementPlus.ElMessage.error("请导入正确的数据模型!"),console.error(r),!1}},_hoisted_1$e={"aria-hidden":"true"},_hoisted_2$c=["xlink:href"],_sfc_main$E=vue.defineComponent({__name:"svg-analysis",props:{name:{},props:{default:()=>({})}},setup(i){const r=i,n=vue.computed(()=>`#svg-${r.name}`);return(o,a)=>(vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$e,[vue.createElementVNode("use",vue.mergeProps({"xlink:href":vue.unref(n)},r.props),null,16,_hoisted_2$c)]))}});var EVisibleConfKey=(i=>(i.ImportJson="ImportJson",i.ExportJson="ExportJson",i.ImportFile="ImportFile",i))(EVisibleConfKey||{});const _withScopeId$2=i=>(vue.pushScopeId("data-v-01c79e12"),i=i(),vue.popScopeId(),i),_hoisted_1$d={class:"flex justify-between",style:{width:"100%"}},_hoisted_2$b={class:"flex items-center justify-between",style:{width:"250px"}},_hoisted_3$9=_withScopeId$2(()=>vue.createElementVNode("div",{class:"flex items-center"},[vue.createElementVNode("span",{class:"logo-title"},"Svg Editor")],-1)),_hoisted_4$7={class:"flex justify-between",style:{width:"calc(100% - 440px)"}},_hoisted_5$6={class:"flex items-center"},_hoisted_6$5={class:"flex items-center mr-20px"},_hoisted_7$5={class:"flex items-center",style:{width:"250px"}},_hoisted_8$5=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title",style:{"padding-top":"16px"}},"多选",-1)),_hoisted_9$4=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区域按住鼠标左键可以框选(图形坐标在框选区域即判定被选中),也可以按住ctrl+鼠标左键点图形进行多选",-1)),_hoisted_10$3=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_11$2=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"拖动画布",-1)),_hoisted_12$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区域按住右键可拖动画布,右侧面板‘图纸’栏可微调或重置位置",-1)),_hoisted_13$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_14$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"画布缩放",-1)),_hoisted_15$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区使用鼠标滚轮或者右侧面板‘图纸’栏可控制画布缩放",-1)),_hoisted_16$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_17$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"标尺辅助线",-1)),_hoisted_18$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"在标尺区域按住鼠标左键并拖动即可创建标尺辅助线,将标尺辅助线拖动到标尺区域即可删除标尺辅助线",-1)),_hoisted_19=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_20=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"组件尺寸",-1)),_hoisted_21=_withScopeId$2(()=>vue.createElementVNode("div",null,[vue.createElementVNode("p",null," 大多数组件可以通过选中组件然后拖动交互点或在右侧‘外观’栏改变外形尺寸,或通过右侧‘数据’栏直接或间接改变外形尺寸;"),vue.createElementVNode("p",null,"少数特殊组件仅可通过右侧'数据'栏直接或间接改变外形尺寸")],-1)),_hoisted_22=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_23=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"连线样式",-1)),_hoisted_24=_withScopeId$2(()=>vue.createElementVNode("div",null,"在右侧‘连线’栏可以统一配置连线样式,配置后先增加的线会应用新样式,之前的线样式不变,如需改变,可选中线手动更改或删除重画 ",-1)),_hoisted_25=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_26=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"横线和竖线",-1)),_hoisted_27=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null," 点击编辑器顶部连线按钮会进入连线状态,该状态下在画板点击鼠标左键即可开始画线,移动并再次点击左键创建新的节点,右键结束画线并退出连线状态;"),vue.createElementVNode("p",null,"画线的时候按住ctrl即可画竖线,按住shift即可画横线")],-1)),_hoisted_28=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_29=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"绑定锚点",-1)),_hoisted_30=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null,"组件在未选中时,鼠标经过组件时会出现锚点,鼠标悬浮在锚点上时,会有交互样式,点击左键即可以锚点为起点创建连线;"),vue.createElementVNode("p",null,"同样,在连线时鼠标经过锚点时,会出现锚点交互样式,点击左键即可以锚点为连线终点结束连线;"),vue.createElementVNode("p",null,"这两种情况下的连线会绑定组件上的锚点,如需解绑,参考下面的‘锚点解绑’;"),vue.createElementVNode("p",null,"同样,也可先画线,再选中连线绑定想要绑定的组件锚点(连线只有首尾节点可以绑定锚点)")],-1)),_hoisted_31=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_32=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"线段选中",-1)),_hoisted_33=_withScopeId$2(()=>vue.createElementVNode("div",null," 若线段绑定了锚点,移动线段,绑定的锚点不会移动。若是想将线段整体移动,需要先解绑,参考下面的‘锚点解绑’ ",-1)),_hoisted_34=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_35=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"锚点解绑",-1)),_hoisted_36=_withScopeId$2(()=>vue.createElementVNode("div",{style:{"padding-bottom":"14px"}}," 选中线段,在右侧‘数据’栏里解除绑定;或者鼠标左键拖拽连线上需要解绑的节点",-1)),_sfc_main$D=vue.defineComponent({__name:"top-panel",emits:["changeVisible","onReturn","onPreview","onSave"],setup(i,{emit:r}){const n=useSvgEditLayoutStore(pinia),o=useGlobalStore(pinia),a=useEditPrivateStore(pinia),u=useConfigStore(pinia),c=r,d=()=>{o.done_json.length<=0||o.setDoneJson([]),o.intention=EGlobalStoreIntention.None},f=g=>{const p={layout_center:n.center_offset,config:u.$state,done_json:o.done_json};c(g,p)},h=vue.ref(!1),y=vue.computed({get:()=>o.intention===EGlobalStoreIntention.Connection,set(g){o.intention=g?EGlobalStoreIntention.Connection:EGlobalStoreIntention.None,g&&o.setHandleSvgInfo(null)}});return(g,p)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$d,[vue.createElementVNode("div",_hoisted_2$b,[_hoisted_3$9,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:p[0]||(p[0]=v=>vue.unref(n).left_nav=!vue.unref(n).left_nav),title:vue.unref(n).left_nav?"隐藏左侧菜单":"显示左侧菜单"},{default:vue.withCtx(()=>[vue.unref(n).left_nav?(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:0,name:"menu-unfold"})):(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:1,name:"menu-fold"}))]),_:1},8,["title"])]),vue.createElementVNode("div",_hoisted_4$7,[vue.createElementVNode("div",_hoisted_5$6,[vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"撤销 ctrl+z",size:24,class:vue.normalizeClass(`${vue.unref(a).getTopBtnUndoStatus?"bt-Icon":"icon-disable"} ml-20px`),onClick:p[1]||(p[1]=()=>vue.unref(a).topUndoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(a).getTopBtnUndoStatus?"undo":"undo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"重做 ctrl+shift+z",class:vue.normalizeClass(`${vue.unref(a).getTopBtnRedoStatus?"bt-Icon":"icon-disable"} ml-5px`),size:24,onClick:p[2]||(p[2]=()=>vue.unref(a).topRedoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(a).getTopBtnRedoStatus?"redo":"redo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"清空 ctrl+delete",class:vue.normalizeClass(vue.unref(o).done_json.length>0?"bt-Icon":"icon-disable"),size:24,onClick:d},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(o).done_json.length>0?"delete":"delete-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"导入数据模型",class:"bt-Icon",size:24,onClick:p[3]||(p[3]=v=>c("changeVisible",vue.unref(EVisibleConfKey).ImportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"import"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"导出数据模型",size:24,class:"bt-Icon ml-5px",onClick:p[4]||(p[4]=v=>c("changeVisible",vue.unref(EVisibleConfKey).ExportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"export"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"创建连线",class:vue.normalizeClass(["bt-Icon",{active:vue.unref(y)}]),size:24,onClick:p[5]||(p[5]=v=>y.value=!vue.unref(y))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(y)?"line-active":"line"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"说明",class:"bt-Icon",size:24,onClick:p[6]||(p[6]=v=>h.value=!vue.unref(h))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"question"})]),_:1})]),vue.createElementVNode("div",_hoisted_6$5,[vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"返回",class:"bt-Icon",size:24,onClick:p[7]||(p[7]=v=>f("onReturn"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"return"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"保存",class:"bt-Icon",size:24,onClick:p[8]||(p[8]=v=>f("onSave"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"save"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"预览",class:"bt-Icon",size:22,onClick:p[9]||(p[9]=v=>f("onPreview"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"preview"})]),_:1})])]),vue.createElementVNode("div",_hoisted_7$5,[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:p[10]||(p[10]=v=>vue.unref(n).right_nav=!vue.unref(n).right_nav),title:vue.unref(n).right_nav?"隐藏右侧菜单":"显示右侧菜单"},{default:vue.withCtx(()=>[vue.unref(n).right_nav?(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:0,name:"menu-fold"})):(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:1,name:"menu-unfold"}))]),_:1},8,["title"])])]),vue.createVNode(vue.unref(elementPlus.ElDialog),{modelValue:vue.unref(h),"onUpdate:modelValue":p[11]||(p[11]=v=>vue.isRef(h)?h.value=v:null),title:"使用说明",width:"60%"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{"max-height":"60vh"},{default:vue.withCtx(()=>[_hoisted_8$5,_hoisted_9$4,_hoisted_10$3,_hoisted_11$2,_hoisted_12$1,_hoisted_13$1,_hoisted_14$1,_hoisted_15$1,_hoisted_16$1,_hoisted_17$1,_hoisted_18$1,_hoisted_19,_hoisted_20,_hoisted_21,_hoisted_22,_hoisted_23,_hoisted_24,_hoisted_25,_hoisted_26,_hoisted_27,_hoisted_28,_hoisted_29,_hoisted_30,_hoisted_31,_hoisted_32,_hoisted_33,_hoisted_34,_hoisted_35,_hoisted_36]),_:1})]),_:1},8,["modelValue"])],64))}}),topPanel_vue_vue_type_style_index_0_scoped_01c79e12_lang="",TopPanel=_export_sfc$1(_sfc_main$D,[["__scopeId","data-v-01c79e12"]]),_hoisted_1$c={class:"component-group flex flex-wrap"},_hoisted_2$a=["onDragstart","title"],_sfc_main$C=vue.defineComponent({__name:"left-panel",props:{customToolbar:{}},setup(i){const r=useGlobalStore(pinia),n=i,o=vue.ref(n.customToolbar&&Object.keys(n.customToolbar).length>0?n.customToolbar:r.config_center),a=vue.ref(["stateful","stateless","have_animation","custom_svg_group","element-ui","custom-vue","echarts"]),u=f=>{r.setCreateInfo(c(f))},c=f=>(f!=null&&f.props&&!lodashEs.isEmpty(f.props)&&Object.keys(f.props).forEach((h,y)=>{f.props[h].sort=String(y)}),f),d=f=>{var h;if(((h=f.dataTransfer)==null?void 0:h.dropEffect)!=="copy"){elementPlus.ElMessage.warning("请将组件拖到画布中!"),r.intention=EGlobalStoreIntention.None;return}};return(f,h)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElCollapse),{modelValue:vue.unref(a),"onUpdate:modelValue":h[0]||(h[0]=y=>vue.isRef(a)?a.value=y:null),style:{"border-top":"none"}},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(o),y=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElCollapseItem),{name:y.groupType,key:y.title},{title:vue.withCtx(()=>[vue.createElementVNode("div",null,vue.toDisplayString(y.title),1)]),default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$c,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(y.list,g=>(vue.openBlock(),vue.createElementBlock("div",{class:"ideal",key:g.name,draggable:"true",onDragstart:p=>u(g),onDragend:d,title:g.title},[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:35,class:"flex items-center"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:g.name,props:vue.unref(prosToVBind)(g,["width","height","maxHeight"])},null,8,["name","props"])]),_:2},1024)],40,_hoisted_2$a))),128))])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]))}}),leftPanel_vue_vue_type_style_index_0_scoped_8aba8565_lang="",LeftPanel=_export_sfc$1(_sfc_main$C,[["__scopeId","data-v-8aba8565"]]),calculateLeftTop=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate(r,o,-n);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightTop=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate(r,o,-n);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightBottom=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(r,o,-n),u=calculateRotatedPointCoordinate(i,o,-n);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateLeftBottom=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(r,o,-n),u=calculateRotatedPointCoordinate(i,o,-n);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateTop=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateRight=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},calculateBottom=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateLeft=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},_hoisted_1$b={style:{"vector-effect":"non-scaling-stroke"}},_hoisted_2$9=["fill","x","y"],_hoisted_3$8=["cx","cy"],_hoisted_4$6=["x1","y1","x2","y2"],_hoisted_5$5=["fill","x","y"],_hoisted_6$4=["fill","x","y"],_hoisted_7$4=["fill","x","y"],_hoisted_8$4=["fill","x","y"],_hoisted_9$3=["fill","x","y"],_hoisted_10$2=["fill","x","y"],_hoisted_11$1=["fill","x","y"],_sfc_main$B=vue.defineComponent({__name:"handle-panel",props:{itemInfo:{}},setup(i){vue.useCssVars(p=>({"5c831aea":vue.unref(c)}));const r=i,n=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=vue.ref(4),c=vue.ref("#ab712e"),d=[{start:338,end:23,cursor:"nw",type:EScaleInfoType.TopLeft},{start:23,end:68,cursor:"n",type:EScaleInfoType.TopCenter},{start:68,end:113,cursor:"ne",type:EScaleInfoType.TopRight},{start:293,end:338,cursor:"w",type:EScaleInfoType.Left},{start:113,end:158,cursor:"e",type:EScaleInfoType.Right},{start:248,end:293,cursor:"sw",type:EScaleInfoType.BottomLeft},{start:203,end:248,cursor:"s",type:EScaleInfoType.BottomCenter},{start:158,end:203,cursor:"se",type:EScaleInfoType.BottomRight}],f=vue.computed(()=>r.itemInfo.config.can_zoom),h=(p,v)=>{console.log("handMousedown",v);const{clientX:_,clientY:b}=v;v.stopPropagation(),n.intention=EGlobalStoreIntention.Zoom;const A=Math.round((_-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),w=Math.round((b-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);n.mouse_info={state:EMouseInfoState.Down,position_x:A,position_y:w,now_position_x:A,now_position_y:w,new_position_x:0,new_position_y:0},n.scale_info={type:p,scale_times:{x:r.itemInfo.scale_x,y:r.itemInfo.scale_y},scale_item_info:{x:r.itemInfo.x,y:r.itemInfo.y},symmetric_point:{x:A+Math.abs(A-r.itemInfo.center_position.x)*2*(A>r.itemInfo.center_position.x?-1:1),y:w+Math.abs(w-r.itemInfo.center_position.y)*2*(w>r.itemInfo.center_position.y?-1:1)}}},y=p=>{const{clientX:v,clientY:_}=p,b=Math.round((v-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),A=Math.round((_-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);p.stopPropagation(),n.intention=EGlobalStoreIntention.Rotate,n.rotate_info={angle:r.itemInfo.rotate},n.mouse_info={state:EMouseInfoState.Down,position_x:b,position_y:A,now_position_x:b,now_position_y:A,new_position_x:0,new_position_y:0}},g=p=>{const v=(p+r.itemInfo.rotate)%360,_=d.find(b=>b.start<=v&&b.end>v);return _?{cursor:_.cursor+"-resize",type:_.type}:{cursor:"nw-resize",type:EScaleInfoType.TopLeft}};return(p,v)=>(vue.openBlock(),vue.createElementBlock("g",_hoisted_1$b,[vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tl",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(0).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[0]||(v[0]=_=>h(vue.unref(EScaleInfoType).TopLeft,_))},null,44,_hoisted_2$9),[[vue.vShow,vue.unref(f)]]),vue.createElementVNode("circle",{cx:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2,cy:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)-24,r:4,class:"rotate-circle",onMousedown:y},null,40,_hoisted_3$8),vue.createElementVNode("line",{x1:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2,y1:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),x2:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2,y2:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)-20,style:vue.normalizeStyle({stroke:vue.unref(c),"stroke-width":2})},null,12,_hoisted_4$6),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tc",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(45).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2-vue.unref(u),y:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[1]||(v[1]=_=>h(vue.unref(EScaleInfoType).TopCenter,_))},null,44,_hoisted_5$5),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tr",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(90).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width-vue.unref(u)+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[2]||(v[2]=_=>h(vue.unref(EScaleInfoType).TopRight,_))},null,44,_hoisted_6$4),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_l",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(315).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[3]||(v[3]=_=>h(vue.unref(EScaleInfoType).Left,_))},null,44,_hoisted_7$4),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_r",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(135).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)+r.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[4]||(v[4]=_=>h(vue.unref(EScaleInfoType).Right,_))},null,44,_hoisted_8$4),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_bl",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(270).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height*r.itemInfo.scale_y-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[5]||(v[5]=_=>h(vue.unref(EScaleInfoType).BottomLeft,_))},null,44,_hoisted_9$3),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_bc",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(225).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)+r.itemInfo.actual_bound.width/2,y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[6]||(v[6]=_=>h(vue.unref(EScaleInfoType).BottomCenter,_))},null,44,_hoisted_10$2),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_br",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(180).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)+r.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[7]||(v[7]=_=>h(vue.unref(EScaleInfoType).BottomRight,_))},null,44,_hoisted_11$1),[[vue.vShow,vue.unref(f)]])]))}}),handlePanel_vue_vue_type_style_index_0_scoped_e6622df8_lang="",HandlePanel=_export_sfc$1(_sfc_main$B,[["__scopeId","data-v-e6622df8"]]),_hoisted_1$a=["fill"],_hoisted_2$8=["cx","cy","r"],_hoisted_3$7=["cx","cy","r"],_hoisted_4$5=["cx","cy","r"],_hoisted_5$4=["cx","cy","r"],_hoisted_6$3=["cx","cy","r"],_hoisted_7$3=["cx","cy","r"],_hoisted_8$3=["cx","cy","r"],_hoisted_9$2=["cx","cy","r"],_sfc_main$A=vue.defineComponent({__name:"connection-panel",props:{itemInfo:{}},setup(i){const r=i,n=vue.ref(4),o=vue.ref("#ab712e"),a=vue.ref(4),u=vue.ref(12),c=useGlobalStore(pinia),d=useSvgEditLayoutStore(pinia),f=vue.computed(()=>r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2-n.value+a.value),h=vue.computed(()=>r.itemInfo.actual_bound.y-n.value-getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),y=vue.computed(()=>r.itemInfo.actual_bound.x-n.value+r.itemInfo.actual_bound.width+getCoordinateOffset(r.itemInfo.actual_bound.width,r.itemInfo.scale_x)+a.value),g=vue.computed(()=>r.itemInfo.actual_bound.y-n.value+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),p=vue.computed(()=>r.itemInfo.actual_bound.x-n.value+r.itemInfo.actual_bound.width/2+a.value),v=vue.computed(()=>r.itemInfo.actual_bound.y-n.value+r.itemInfo.actual_bound.height+getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),_=vue.computed(()=>r.itemInfo.actual_bound.x-n.value-getCoordinateOffset(r.itemInfo.actual_bound.width,r.itemInfo.scale_x)+a.value),b=vue.computed(()=>r.itemInfo.actual_bound.y-n.value+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),A=(T,S)=>{var x;c.intention===EGlobalStoreIntention.SetConnectionLineNode&&(T.stopPropagation(),(x=c.handle_svg_info)!=null&&x.info.bind_anchors&&c.connection_line_node_info&&(c.connection_line_node_info.point_index===0?c.handle_svg_info.info.bind_anchors.start={type:S,target_id:r.itemInfo.id}:c.connection_line_node_info.point_index===c.handle_svg_info.info.props.point_position.val.length-1&&(c.handle_svg_info.info.bind_anchors.end={type:S,target_id:r.itemInfo.id}),c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(r.itemInfo)})))},w=(T,S)=>{var x;c.intention===EGlobalStoreIntention.None?(createLine(T,S,r.itemInfo),c.handle_svg_info&&(c.handle_svg_info.info.props.point_position.val.length!==1?c.handle_svg_info.info.props.point_position.val.push({x:c.mouse_info.new_position_x-c.mouse_info.position_x-d.center_offset.x,y:c.mouse_info.new_position_y-c.mouse_info.position_y-d.center_offset.y}):c.handle_svg_info.info.props.point_position.val.push({x:0,y:0}))):c.intention===EGlobalStoreIntention.Connection&&(T.stopPropagation(),(x=c.handle_svg_info)!=null&&x.info.bind_anchors&&(c.handle_svg_info.info.bind_anchors.end={type:S,target_id:r.itemInfo.id},c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(r.itemInfo)})))};return(T,S)=>(vue.openBlock(),vue.createElementBlock("g",{style:{"vector-effect":"non-scaling-stroke"},class:"connect-points",fill:vue.unref(o),"stroke-width":"2",stroke:"rgba(0,0,0,0)"},[vue.createElementVNode("g",{onMousedown:S[0]||(S[0]=x=>w(x,vue.unref(ELineBindAnchors).TopCenter)),onMouseup:S[1]||(S[1]=x=>A(x,vue.unref(ELineBindAnchors).TopCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(f),cy:vue.unref(h),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_2$8),vue.createElementVNode("circle",{id:"connection_tc",cx:vue.unref(f),cy:vue.unref(h),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_3$7)],32),vue.createElementVNode("g",{onMousedown:S[2]||(S[2]=x=>w(x,vue.unref(ELineBindAnchors).Right)),onMouseup:S[3]||(S[3]=x=>A(x,vue.unref(ELineBindAnchors).Right))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(y),cy:vue.unref(g),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_4$5),vue.createElementVNode("circle",{id:"connection_r",cx:vue.unref(y),cy:vue.unref(g),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_5$4)],32),vue.createElementVNode("g",{onMousedown:S[4]||(S[4]=x=>w(x,vue.unref(ELineBindAnchors).BottomCenter)),onMouseup:S[5]||(S[5]=x=>A(x,vue.unref(ELineBindAnchors).BottomCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(p),cy:vue.unref(v),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_6$3),vue.createElementVNode("circle",{id:"connection_bc",cx:vue.unref(p),cy:vue.unref(v),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_7$3)],32),vue.createElementVNode("g",{onMousedown:S[6]||(S[6]=x=>w(x,vue.unref(ELineBindAnchors).Left)),onMouseup:S[7]||(S[7]=x=>A(x,vue.unref(ELineBindAnchors).Left))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(_),cy:vue.unref(b),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_8$3),vue.createElementVNode("circle",{id:"connection_l",cx:vue.unref(_),cy:vue.unref(b),r:vue.unref(a),style:{cursor:"crosshair"},"pointer-events":"all"},null,8,_hoisted_9$2)],32)],8,_hoisted_1$a))}}),connectionPanel_vue_vue_type_style_index_0_scoped_fb729c7a_lang="",ConnectionPanel=_export_sfc$1(_sfc_main$A,[["__scopeId","data-v-fb729c7a"]]),_hoisted_1$9=["d","stroke-width"],_hoisted_2$7=["d","stroke-width"],_hoisted_3$6=["id","d","stroke","stroke-width","stroke-dasharray"],_hoisted_4$4=["from","to","dur","repeatCount"],_hoisted_5$3=["d","stroke","stroke-width","stroke-dasharray"],_hoisted_6$2=["from","to","dur","repeatCount"],_hoisted_7$2=["r","fill"],_hoisted_8$2=["path","dur","repeatCount"],_hoisted_9$1=["cx","cy","r","stroke-width"],_hoisted_10$1=["cx","cy","r","stroke","onMousedown"],_sfc_main$z=vue.defineComponent({__name:"connection-line",props:{itemInfo:{},pointVisible:{type:Boolean,default:!1}},setup(i){const r=i,n=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=(c,d,f,h)=>{if(n.intention===EGlobalStoreIntention.Connection)return;n.setHandleSvgInfo(r.itemInfo);const{clientX:y,clientY:g}=d;d.stopPropagation(),n.connection_line_node_info={init_pos:{x:f,y:h},point_index:c},n.intention=EGlobalStoreIntention.SetConnectionLineNode,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((y-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((g-a.canvasInfo.top)/o.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0}};return(c,d)=>{var f,h,y,g,p,v;return vue.openBlock(),vue.createElementBlock("g",{style:vue.normalizeStyle({cursor:vue.unref(n).intention===vue.unref(EGlobalStoreIntention).Connection?"crosshair":"move"})},[vue.withDirectives(vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#DE4517","stroke-width":Math.ceil(r.itemInfo.props["stroke-width"].val*1.2)+1,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_1$9),[[vue.vShow,r.itemInfo.selected||r.itemInfo.id===((f=vue.unref(n).handle_svg_info)==null?void 0:f.info.id)]]),vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#fff","stroke-opacity":".01","stroke-width":r.itemInfo.props["stroke-width"].val,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_2$7),vue.createElementVNode("path",{id:r.itemInfo.id,d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none",stroke:((h=r.itemInfo.animations)==null?void 0:h.type.val)===vue.unref(EConfigAnimationsType).Electricity?r.itemInfo.animations.color.val:r.itemInfo.props.stroke.val,"stroke-width":r.itemInfo.props["stroke-width"].val,"stroke-dashoffset":"0","stroke-dasharray":((y=r.itemInfo.animations)==null?void 0:y.type.val)===vue.unref(EConfigAnimationsType).Electricity?r.itemInfo.props["stroke-width"].val*3:0,"stroke-linejoin":"round"},[((g=r.itemInfo.animations)==null?void 0:g.type.val)===vue.unref(EConfigAnimationsType).Electricity?(vue.openBlock(),vue.createElementBlock("animate",{key:0,attributeName:"stroke-dashoffset",from:r.itemInfo.animations.reverse.val?0:1e3,to:r.itemInfo.animations.reverse.val?1e3:0,dur:`${r.itemInfo.animations.dur.val}s`,repeatCount:r.itemInfo.animations.repeatCount.val},null,8,_hoisted_4$4)):vue.createCommentVNode("",!0)],8,_hoisted_3$6),((p=r.itemInfo.animations)==null?void 0:p.type.val)===vue.unref(EConfigAnimationsType).WaterDrop?(vue.openBlock(),vue.createElementBlock("path",{key:0,d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:r.itemInfo.animations.color.val,"stroke-width":r.itemInfo.props["stroke-width"].val,"stroke-dasharray":r.itemInfo.props["stroke-width"].val*3,"stroke-dashoffset":"0","stroke-linecap":"round","stroke-linejoin":"round"},[vue.createElementVNode("animate",{attributeName:"stroke-dashoffset",from:r.itemInfo.animations.reverse.val?0:1e3,to:r.itemInfo.animations.reverse.val?1e3:0,dur:`${r.itemInfo.animations.dur.val}s`,repeatCount:r.itemInfo.animations.repeatCount.val,fill:"freeze"},null,8,_hoisted_6$2)],8,_hoisted_5$3)):((v=r.itemInfo.animations)==null?void 0:v.type.val)===vue.unref(EConfigAnimationsType).Track?(vue.openBlock(),vue.createElementBlock("circle",{key:1,cx:"0",cy:"0",r:Math.ceil(r.itemInfo.props["stroke-width"].val*.6)+2,fill:r.itemInfo.animations.color.val},[vue.createElementVNode("animateMotion",{path:vue.unref(positionArrToPath)(r.itemInfo.animations.reverse.val?[...r.itemInfo.props.point_position.val].reverse():r.itemInfo.props.point_position.val),dur:`${r.itemInfo.animations.dur.val}s`,repeatCount:r.itemInfo.animations.repeatCount.val},null,8,_hoisted_8$2)],8,_hoisted_7$2)):vue.createCommentVNode("",!0),vue.createElementVNode("g",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.itemInfo.props.point_position.val,(_,b)=>{var A;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("circle",{key:b,cx:_.x,cy:_.y,r:r.itemInfo.props.point_r.val+1,fill:"none","fill-opacity":"0","stroke-width":Math.ceil(r.itemInfo.props.point_r.val*.2)+1,stroke:"#DE4517"},null,8,_hoisted_9$1)),[[vue.vShow,r.itemInfo.selected||r.itemInfo.id===((A=vue.unref(n).handle_svg_info)==null?void 0:A.info.id)]])}),128)),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.itemInfo.props.point_position.val,(_,b)=>(vue.openBlock(),vue.createElementBlock("circle",{key:b,cx:_.x,cy:_.y,r:r.itemInfo.props.point_r.val,"stroke-width":"1",stroke:r.itemInfo.props.stroke.val,fill:"#fff",style:{cursor:"pointer"},onMousedown:A=>u(b,A,_.x,_.y)},null,40,_hoisted_10$1))),128))])],4)}}}),_hoisted_1$8={class:"coverLayer"},_hoisted_2$6={xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%"},_hoisted_3$5={id:"pattern_grid",patternUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},_hoisted_4$3=["stroke"],_hoisted_5$2=["stroke"],_hoisted_6$1=["stroke"],_hoisted_7$1=["stroke"],_hoisted_8$1={key:0,width:"100%",height:"100%",fill:"url(#pattern_grid)"},_hoisted_9=["transform"],_hoisted_10=["transform"],_hoisted_11=["transform","onMousedown","onMouseup","onMouseenter","onMouseleave","onContextmenu"],_hoisted_12=["xlink:href","width","height","id","transform"],_hoisted_13=["id"],_hoisted_14=["id","x1","y1","x2","y2"],_hoisted_15=["id"],_hoisted_16=["x","y","height","width"],_hoisted_17=["onClick"],_hoisted_18={class:"shortcut"},_sfc_main$y=vue.defineComponent({__name:"center-panel",props:{vueComp:{}},setup(i,{expose:r}){vue.useCssVars(Ie=>({"32de9888":vue.unref(g)}));const n=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=useEditPrivateStore(pinia),c=useContextMenuStore(pinia);componentsRegister(i.vueComp);const f=vue.ref(),h=vue.ref(),y={MoveCanvas:"grab",Rotate:"url('/src/assets/icons/rotate.svg'), auto",Connection:"crosshair",SetConnectionLineNode:"crosshair"},g=vue.computed(()=>Object.keys(y).indexOf(n.intention)>-1?y[n.intention]:"default"),p=vue.reactive({handle_panel:vue.computed(()=>n.intention===EGlobalStoreIntention.Select||n.intention===EGlobalStoreIntention.Zoom||n.intention===EGlobalStoreIntention.Rotate),connection_panel:!1,connection_line:!1,select_item:{info:null,index:-1}}),v=vue.ref({a:{x:0,y:0},b:{x:0,y:0}}),_=vue.computed(()=>n.intention===EGlobalStoreIntention.SelectArea&&v.value.b.x&&v.value.b.y?{with:Math.abs(v.value.b.x-v.value.a.x),height:Math.abs(v.value.b.y-v.value.a.y),x:v.value.a.x<v.value.b.x?v.value.a.x:v.value.b.x,y:v.value.a.y<v.value.b.y?v.value.a.y:v.value.b.y}:{with:0,height:0,x:0,y:0}),b=vue.computed(()=>{let Ie=0;for(let At of n.done_json)At.selected&&Ie++;return Ie>0});let A=!1,w=!1;const T=Ie=>{var At;if(n.intention!=EGlobalStoreIntention.None){if(n.intention==EGlobalStoreIntention.Create){if(!n.create_svg_info){console.error("要创建的数据获取失败");return}const _e=Math.floor(Ie.offsetX/o.svg.scale-a.center_offset.x),qe=Math.floor(Ie.offsetY/o.svg.scale-a.center_offset.y),In={id:randomString(),x:_e,y:qe,client:{x:_e,y:qe},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},selected:!1,...objectDeepClone(n.create_svg_info)};n.setDoneJson(In),n.setHandleSvgInfo(In,n.done_json.length),n.intention=EGlobalStoreIntention.None}(At=h.value)==null||At.focus()}},S=Ie=>{Ie.preventDefault()},x=Ie=>{Ie.preventDefault()},L=(Ie,At,_e)=>{var qe,In,vn;if((qe=h.value)==null||qe.focus(),n.intention===EGlobalStoreIntention.Connection){_e.stopPropagation();return}if(_e.preventDefault(),_e.stopPropagation(),_e.ctrlKey&&_e.button===0)((In=n.handle_svg_info)!=null&&In.index||((vn=n.handle_svg_info)==null?void 0:vn.index)===0)&&(n.done_json[n.handle_svg_info.index].selected=!0,n.setHandleSvgInfo(null),n.intention=EGlobalStoreIntention.None),Ie.selected=!Ie.selected;else if(b.value){n.intention=EGlobalStoreIntention.GroupMove,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((_e.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0};for(let Pt of n.done_json)Pt.selected&&(Pt.old_position={x:Pt.x,y:Pt.y},Pt.point_coordinate_old=objectDeepClone(Pt.point_coordinate))}else n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo(Ie,At),n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((_e.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:Ie.x,now_position_y:Ie.y,new_position_x:0,new_position_y:0},Ie.point_coordinate_old=objectDeepClone(Ie.point_coordinate)},M=(Ie,At,_e)=>{if(!(n.intention===EGlobalStoreIntention.Connection||n.mouse_info.state!=EMouseInfoState.Down)&&b.value&&!A&&["SelectArea","Move","Select"].indexOf(n.intention)<0){for(let qe of n.done_json)qe.selected=!1,qe.old_position={x:0,y:0},resetHandlePointOld(qe);n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo(Ie,At),n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((_e.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:Ie.x,now_position_y:Ie.y,new_position_x:0,new_position_y:0}}},O=(Ie,At,_e)=>{_e.preventDefault(),_e.stopPropagation(),p.connection_panel=!0,p.connection_line=!0,!((n.intention===EGlobalStoreIntention.Connection||n.intention===EGlobalStoreIntention.SetConnectionLineNode)&&Ie.type===EDoneJsonType.ConnectionLine)&&(p.select_item.info=Ie,p.select_item.index=At)},ie=(Ie,At,_e)=>{_e.preventDefault(),_e.stopPropagation(),!((n.intention===EGlobalStoreIntention.Connection||n.intention===EGlobalStoreIntention.SetConnectionLineNode)&&Ie.type===EDoneJsonType.ConnectionLine)&&(p.connection_panel=!1,p.connection_line=!1,p.select_item.info=null,p.select_item.index=-1)},$=Ie=>{var vn,Pt,he,Ue,Dt,jt,Et,Ce,ue,$e,Ne,Oe,Lt,kt,Cn,oe;if(n.mouse_info.state!=EMouseInfoState.Down&&n.intention!==EGlobalStoreIntention.Connection)return;const{clientX:At,clientY:_e}=Ie;n.mouse_info.new_position_x=Math.round((At-a.canvasInfo.left)/o.svg.scale),n.mouse_info.new_position_y=Math.round((_e-a.canvasInfo.top)/o.svg.scale);const qe=Math.round(n.mouse_info.new_position_x-n.mouse_info.position_x+n.mouse_info.now_position_x),In=Math.round(n.mouse_info.new_position_y-n.mouse_info.position_y+n.mouse_info.now_position_y);if((vn=n.handle_svg_info)!=null&&vn.info&&(n.intention===EGlobalStoreIntention.Select||n.intention===EGlobalStoreIntention.Move)){if(n.handle_svg_info.info.x=qe,n.handle_svg_info.info.y=In,n.handle_svg_info.info.client={x:qe,y:In},n.intention=EGlobalStoreIntention.Move,moveHandlePoint(n.handle_svg_info.info),moveAnchors(n.handle_svg_info.info),n.handle_svg_info.info.type===EDoneJsonType.ConnectionLine){if((Pt=n.handle_svg_info.info.bind_anchors)!=null&&Pt.start){let ae=null;for(let Y of n.done_json)Y.id===((Ue=(he=n.handle_svg_info.info.bind_anchors)==null?void 0:he.start)==null?void 0:Ue.target_id)&&(ae=Y);ae&&moveAnchors(ae)}if((Dt=n.handle_svg_info.info.bind_anchors)!=null&&Dt.end){let ae=null;for(let Y of n.done_json)Y.id===((Et=(jt=n.handle_svg_info.info.bind_anchors)==null?void 0:jt.end)==null?void 0:Et.target_id)&&(ae=Y);ae&&moveAnchors(ae)}}}else if(n.intention===EGlobalStoreIntention.MoveCanvas)a.center_offset.x=qe,a.center_offset.y=In;else if(n.intention===EGlobalStoreIntention.SelectArea)v.value.b.x=n.mouse_info.new_position_x-a.center_offset.x,v.value.b.y=n.mouse_info.new_position_y-a.center_offset.y;else if(n.intention===EGlobalStoreIntention.GroupMove){A=!0;for(let ae of n.done_json)if(ae.selected&&ae.old_position){const Y=Math.round(n.mouse_info.new_position_x-n.mouse_info.position_x+ae.old_position.x),k=Math.round(n.mouse_info.new_position_y-n.mouse_info.position_y+ae.old_position.y);if(ae.x=Y,ae.y=k,ae.client={x:Y,y:k},moveHandlePoint(ae),moveAnchors(ae),ae.type===EDoneJsonType.ConnectionLine&&((Ce=ae.bind_anchors)!=null&&Ce.end)){let D=null;for(let j of n.done_json)j.id===(($e=(ue=ae.bind_anchors)==null?void 0:ue.end)==null?void 0:$e.target_id)&&(D=j);D&&moveAnchors(D)}}}else if(n.intention===EGlobalStoreIntention.Zoom){if(!n.handle_svg_info)return;const ae={x:n.mouse_info.new_position_x-a.center_offset.x,y:n.mouse_info.new_position_y-a.center_offset.y};let Y={width:0,height:0,is_old_width:!1,is_old_height:!1};if(n.scale_info.type===EScaleInfoType.TopLeft?Y=calculateLeftTop(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.TopRight?Y=calculateRightTop(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.BottomRight?Y=calculateRightBottom(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.BottomLeft?Y=calculateLeftBottom(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.TopCenter?Y=calculateTop(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client):n.scale_info.type===EScaleInfoType.Right?Y=calculateRight(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client):n.scale_info.type===EScaleInfoType.BottomCenter?Y=calculateBottom(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client):n.scale_info.type===EScaleInfoType.Left&&(Y=calculateLeft(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client)),n.handle_svg_info&&Y.width>0&&Y.height>0){const k=Y.is_old_width?1:myFixed(Y.width/n.handle_svg_info.info.actual_bound.width,3),D=Y.is_old_height?1:myFixed(Y.height/n.handle_svg_info.info.actual_bound.height,3),j=getCenterPoint(ae,n.scale_info.symmetric_point);k>0&&n.scale_info.type!==EScaleInfoType.TopCenter&&n.scale_info.type!==EScaleInfoType.BottomCenter&&(n.handle_svg_info.info.scale_x=k,n.handle_svg_info.info.x=Math.round(getSvgNowPosition(n.handle_svg_info.info.center_position.x,j.x,n.handle_svg_info.info.client.x))),D>0&&n.scale_info.type!==EScaleInfoType.Left&&n.scale_info.type!==EScaleInfoType.Right&&(n.handle_svg_info.info.scale_y=D,n.handle_svg_info.info.y=Math.round(getSvgNowPosition(n.handle_svg_info.info.center_position.y,j.y,n.handle_svg_info.info.client.y)))}}else if(n.intention===EGlobalStoreIntention.Rotate){if(!n.handle_svg_info)return;const ae=Math.atan2(n.mouse_info.position_y-n.handle_svg_info.info.y,n.mouse_info.position_x-n.handle_svg_info.info.x)/(Math.PI/180),Y=Math.atan2(n.mouse_info.new_position_y-a.center_offset.y-n.handle_svg_info.info.y,n.mouse_info.new_position_x-a.center_offset.x-n.handle_svg_info.info.x)/(Math.PI/180);n.handle_svg_info.info.rotate=myFixed(n.rotate_info.angle+Y-ae,2)}else if(n.intention===EGlobalStoreIntention.Connection&&n.handle_svg_info){const ae=(Ne=n.handle_svg_info)==null?void 0:Ne.info.props.point_position.val.length,Y=n.mouse_info.new_position_x-n.mouse_info.position_x-a.center_offset.x,k=n.mouse_info.new_position_y-n.mouse_info.position_y-a.center_offset.y,D=n.handle_svg_info.info.props.point_position.val[ae-2],j=((Lt=(Oe=n.handle_svg_info)==null?void 0:Oe.info.props.point_r)==null?void 0:Lt.val)+2||4;let xe=D.x<Y?-j:D.x>Y?j:0,hn=D.y<k?-j:D.y>k?j:0;Ie.ctrlKey?n.handle_svg_info.info.props.point_position.val[ae-1]={x:D.x,y:k+hn}:Ie.shiftKey?n.handle_svg_info.info.props.point_position.val[ae-1]={x:Y+xe,y:D.y}:n.handle_svg_info.info.props.point_position.val[ae-1]={x:Y+xe,y:k+hn}}else if(n.intention===EGlobalStoreIntention.SetConnectionLineNode&&n.handle_svg_info){!w&&(n.connection_line_node_info.point_index===n.handle_svg_info.info.props.point_position.val.length-1||n.connection_line_node_info.point_index===0)&&(w=!0);const ae=(kt=n.handle_svg_info)==null?void 0:kt.info.props.point_position.val.length,Y=getSvgNowPosition(n.mouse_info.position_x,n.mouse_info.new_position_x,n.connection_line_node_info.init_pos.x),k=getSvgNowPosition(n.mouse_info.position_y,n.mouse_info.new_position_y,n.connection_line_node_info.init_pos.y),D=n.handle_svg_info.info.props.point_position.val[ae-2],j=((oe=(Cn=n.handle_svg_info)==null?void 0:Cn.info.props.point_r)==null?void 0:oe.val)+2||4;let xe=D.x<Y?-j:D.x>Y?j:0,hn=D.y<k?-j:D.y>k?j:0;n.handle_svg_info.info.props.point_position.val[n.connection_line_node_info.point_index]={x:Y+xe,y:k+hn}}},z=()=>{var Ie,At,_e,qe;if(n.mouse_info.state==EMouseInfoState.Down){if((Ie=n.handle_svg_info)!=null&&Ie.info&&n.intention==EGlobalStoreIntention.Move)setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.intention=EGlobalStoreIntention.None,n.setDoneJson(n.done_json);else if(n.intention==EGlobalStoreIntention.GroupMove)A&&(A=!1,n.intention=EGlobalStoreIntention.None);else if((At=n.handle_svg_info)!=null&&At.info&&n.intention==EGlobalStoreIntention.Zoom)n.handle_svg_info.info.client={x:n.handle_svg_info.info.x,y:n.handle_svg_info.info.y},n.intention=EGlobalStoreIntention.None,setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.setDoneJson(n.done_json);else if(n.intention===EGlobalStoreIntention.Rotate&&((_e=n.handle_svg_info)!=null&&_e.info))setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.setDoneJson(n.done_json),n.intention=EGlobalStoreIntention.None;else{if(n.intention===EGlobalStoreIntention.Connection)return;if(n.intention===EGlobalStoreIntention.SetConnectionLineNode)w&&((qe=n.handle_svg_info)!=null&&qe.info.bind_anchors)&&(n.connection_line_node_info.point_index===0?n.handle_svg_info.info.bind_anchors.start=null:n.handle_svg_info.info.bind_anchors.end=null),n.intention=EGlobalStoreIntention.None,w=!1;else if(n.intention===EGlobalStoreIntention.SelectArea){n.setHandleSvgInfo(null);for(let In of n.done_json){const vn=_.value;In.selected=In.x>vn.x&&In.x<vn.x+vn.with&&In.y>vn.y&&In.y<vn.y+vn.height}n.intention=EGlobalStoreIntention.None}else n.intention!=EGlobalStoreIntention.Select&&(n.intention=EGlobalStoreIntention.None)}n.mouse_info={state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},c.display=!1}},V=Ie=>{const{clientX:At,clientY:_e}=Ie;if(n.intention===EGlobalStoreIntention.Connection){n.handle_svg_info||createLine(Ie),n.handle_svg_info&&(Ie.button===0?n.handle_svg_info.info.props.point_position.val.length!==1?n.handle_svg_info.info.props.point_position.val.push({x:n.mouse_info.new_position_x-n.mouse_info.position_x-a.center_offset.x,y:n.mouse_info.new_position_y-n.mouse_info.position_y-a.center_offset.y}):n.handle_svg_info.info.props.point_position.val.push({x:0,y:0}):Ie.button===2&&(n.intention=EGlobalStoreIntention.None,setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.setHandleSvgInfo(null)));return}Ie.button===0?(n.intention=EGlobalStoreIntention.SelectArea,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((At-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),position_y:Math.round((_e-a.canvasInfo.top)/o.svg.scale-a.center_offset.y),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},v.value={a:{x:n.mouse_info.position_x,y:n.mouse_info.position_y},b:{x:0,y:0}}):Ie.button===2&&(n.intention=EGlobalStoreIntention.MoveCanvas,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((At-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e-a.canvasInfo.top)/o.svg.scale),now_position_x:a.center_offset.x,now_position_y:a.center_offset.y,new_position_x:0,new_position_y:0})};function re(Ie){Ie!=null&&Ie.wheelDelta&&(Ie.wheelDelta>0?(o.svg.scale=myFixed(o.svg.scale+.1,1),getZoomPosition(Ie,o.svg.scale,a.center_offset,!0)):o.svg.scale>.1&&(o.svg.scale=myFixed(o.svg.scale-.1,1),getZoomPosition(Ie,o.svg.scale,a.center_offset,!1)))}const F=Ie=>{Ie.stopPropagation(),Ie.preventDefault()},pe=(Ie,At,_e)=>{n.intention!==EGlobalStoreIntention.Connection&&f.value&&(n.intention=EGlobalStoreIntention.ContextMenu,n.setHandleSvgInfo(Ie,At),f.value.style.left=_e.pageX+"px",f.value.style.top=_e.pageY+"px",c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!0,At===n.done_json.length-1&&(c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=!1),At===0&&(c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!1),c.display=!0)},le=(Ie,At,_e)=>({x:myFixed(Ie.x-Ie.width/2*At+Ie.width/2,1),y:myFixed(Ie.y-Ie.height/2*_e+Ie.height/2,1),width:myFixed(Ie.width*At,1),height:myFixed(Ie.height*_e,1)}),de=Ie=>{Ie.preventDefault();let At=[];if(!Ie.ctrlKey&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].indexOf(Ie.key)>-1&&(b.value?At=n.done_json.map((_e,qe)=>({selected:_e.selected,i:qe})).filter(_e=>_e.selected).map(_e=>_e.i):n.handle_svg_info&&At.push(n.handle_svg_info.index)),!Ie.ctrlKey&&Ie.key=="ArrowUp"){for(let _e of At)n.done_json[_e].y-=1,n.done_json[_e].client.y-=1,moveHandlePoint(n.done_json[_e],0,-1),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else if(!Ie.ctrlKey&&Ie.key=="ArrowDown"){for(let _e of At)n.done_json[_e].y+=1,n.done_json[_e].client.y+=1,moveHandlePoint(n.done_json[_e],0,1),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else if(!Ie.ctrlKey&&Ie.key=="ArrowLeft"){for(let _e of At)n.done_json[_e].x-=1,n.done_json[_e].client.x-=1,moveHandlePoint(n.done_json[_e],-1,0),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else if(!Ie.ctrlKey&&Ie.key=="ArrowRight"){for(let _e of At)n.done_json[_e].x+=1,n.done_json[_e].client.x+=1,moveHandlePoint(n.done_json[_e],1,0),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else Ie.ctrlKey&&Ie.key.toLowerCase()=="c"?c.onContextMenuClick(EContextMenuInfoType.Copy):!Ie.ctrlKey&&Ie.key=="Delete"?b.value?(n.setDoneJson(n.done_json.filter(_e=>!_e.selected)),n.setHandleSvgInfo(n.done_json[n.done_json.length-1],n.done_json.length-1)):c.onContextMenuClick(EContextMenuInfoType.Delete):Ie.ctrlKey&&Ie.key=="ArrowUp"?c.onContextMenuClick(EContextMenuInfoType.MoveUpOneLevel):Ie.ctrlKey&&Ie.key=="ArrowDown"?c.onContextMenuClick(EContextMenuInfoType.MoveDownOneLevel):Ie.ctrlKey&&Ie.key=="ArrowLeft"?c.onContextMenuClick(EContextMenuInfoType.MoveDownTopLevel):Ie.ctrlKey&&Ie.key=="ArrowRight"?c.onContextMenuClick(EContextMenuInfoType.MoveUpTopLevel):Ie.ctrlKey&&Ie.shiftKey&&Ie.key.toLowerCase()=="z"?u.topRedoBtnClick():Ie.ctrlKey&&Ie.key.toLowerCase()=="z"?u.topUndoBtnClick():Ie.ctrlKey&&Ie.key.toLowerCase()=="delete"&&(n.done_json.length<=0||n.setDoneJson([]))},Fe=()=>{setSvgActualInfo(n.done_json[n.handle_svg_info.index],!0)};return vue.onMounted(()=>{var Ie;(Ie=h.value)==null||Ie.focus(),vue.nextTick(function(){var _e;const At=(_e=h.value)==null?void 0:_e.getBoundingClientRect();a.canvasInfo={height:(At==null?void 0:At.height)||0,with:(At==null?void 0:At.width)||0,top:(At==null?void 0:At.top)||0,left:(At==null?void 0:At.left)||0}})}),r({onCanvasMouseUp:z}),(Ie,At)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",{ref_key:"canvasRef",ref:h,class:"canvas",style:vue.normalizeStyle({backgroundColor:vue.unref(o).svg.background_color,position:"relative"}),tabindex:"0",onDrop:T,onDragenter:S,onDragover:x,onMousedown:V,onMousemove:$,onMouseup:z,onContextmenu:F,onKeydown:de,onMousewheel:re},[vue.renderSlot(Ie.$slots,"background",{},void 0,!0),vue.createElementVNode("div",_hoisted_1$8,[(vue.openBlock(),vue.createElementBlock("svg",_hoisted_2$6,[vue.createElementVNode("defs",null,[vue.createElementVNode("pattern",_hoisted_3$5,[vue.createElementVNode("line",{x1:"0",y1:"0",x2:"0",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_4$3),vue.createElementVNode("line",{x1:"10",y1:"0",x2:"10",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_5$2),vue.createElementVNode("line",{x1:"0",y1:"0",x2:"20",y2:"0",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_6$1),vue.createElementVNode("line",{x1:"0",y1:"10",x2:"20",y2:"10",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_7$1)])]),vue.unref(o).svg.grid?(vue.openBlock(),vue.createElementBlock("rect",_hoisted_8$1)):vue.createCommentVNode("",!0),vue.createElementVNode("g",{transform:`translate(${vue.unref(a).center_offset.x*vue.unref(o).svg.scale},${vue.unref(a).center_offset.y*vue.unref(o).svg.scale})rotate(0)scale(${vue.unref(o).svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(n).done_json,(_e,qe)=>{var In,vn,Pt,he,Ue,Dt,jt,Et,Ce,ue,$e,Ne,Oe,Lt;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:_e.id,transform:`translate(${_e.x},${_e.y})rotate(0)scale(1)`},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(_e)}`)},[vue.createElementVNode("g",{transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2})rotate(${_e.rotate}) scale(1) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`,onMousedown:kt=>L(_e,qe,kt),onMouseup:kt=>M(_e,qe,kt),onMouseenter:kt=>O(_e,qe,kt),onMouseleave:kt=>ie(_e,qe,kt),onContextmenu:kt=>pe(_e,qe,kt)},[_e.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$z,{key:0,"item-info":_e,"point-visible":vue.unref(p).connection_line&&((In=vue.unref(p).select_item.info)==null?void 0:In.id)==_e.id},null,8,["item-info","point-visible"])):_e.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${_e.name}`,ref_for:!0},vue.unref(prosToVBind)(_e,["height","width"]),{width:((Pt=(vn=_e.props)==null?void 0:vn.width)==null?void 0:Pt.val)??100,height:((Ue=(he=_e.props)==null?void 0:he.height)==null?void 0:Ue.val)??100,id:_e.id,transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2}) scale(${_e.scale_x},${_e.scale_y}) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`}),null,16,_hoisted_12)):_e.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(_e.tag),vue.mergeProps({key:2,ref_for:!0},vue.unref(prosToVBind)(_e,["height","width"]),{width:((jt=(Dt=_e.props)==null?void 0:Dt.width)==null?void 0:jt.val)??100,height:((Ce=(Et=_e.props)==null?void 0:Et.height)==null?void 0:Ce.val)??100,id:_e.id,onResize:Fe,transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2}) scale(${_e.scale_x},${_e.scale_y}) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`}),null,16,["width","height","id","transform"])):_e.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3,ref_for:!0},le(_e.actual_bound,_e.scale_x,_e.scale_y),{id:`foreign-object${_e.id}`,class:"foreignObject"}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(_e.tag),vue.mergeProps({ref_for:!0},vue.unref(prosToVBind)(_e),{id:_e.id,transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2}) scale(${_e.scale_x},${_e.scale_y}) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(_e.tag_slot),1)]),_:2},1040,["id","transform"]))],16,_hoisted_13)):_e.type===vue.unref(EDoneJsonType).StraightLine?(vue.openBlock(),vue.createElementBlock("line",{key:4,id:_e.id,x1:_e.props.start_x.val,y1:_e.props.start_y.val,x2:_e.props.end_x.val,y2:_e.props.end_y.val,fill:"#FF0000",stroke:"#FF0000","stroke-width":"2"},null,8,_hoisted_14)):vue.createCommentVNode("",!0),_e.config.actual_rect?(vue.openBlock(),vue.createElementBlock("rect",vue.mergeProps({key:5,id:`rect${_e.id}`,fill:"black","fill-opacity":"0",ref_for:!0},le(_e.actual_bound,_e.scale_x,_e.scale_y),{style:{stroke:"none","stroke-width":"2","stroke-miterlimit":"10"},class:{"svg-item-none":!_e.selected&&(vue.unref(n).intention==vue.unref(EGlobalStoreIntention).None||vue.unref(n).intention==vue.unref(EGlobalStoreIntention).Select),"svg-item-move":vue.unref(n).intention==vue.unref(EGlobalStoreIntention).Move&&((ue=vue.unref(n).handle_svg_info)==null?void 0:ue.info.id)==_e.id,"svg-item-select":vue.unref(n).intention==vue.unref(EGlobalStoreIntention).Select&&(($e=vue.unref(n).handle_svg_info)==null?void 0:$e.info.id)==_e.id,"svg-item-in-group":_e.selected}}),null,16,_hoisted_15)):vue.createCommentVNode("",!0),((Ne=vue.unref(n).handle_svg_info)==null?void 0:Ne.info.id)===_e.id&&vue.unref(p).handle_panel&&_e.type!==vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(HandlePanel,{key:6,"item-info":_e},null,8,["item-info"])):vue.createCommentVNode("",!0),!_e.selected&&((Oe=vue.unref(p).select_item.info)==null?void 0:Oe.id)==_e.id&&vue.unref(p).connection_panel&&_e.config.have_anchor&&vue.unref(n).intention!==vue.unref(EGlobalStoreIntention).SelectArea&&(vue.unref(n).intention!==vue.unref(EGlobalStoreIntention).Select||_e.id!==((Lt=vue.unref(n).handle_svg_info)==null?void 0:Lt.info.id))?(vue.openBlock(),vue.createBlock(ConnectionPanel,{key:7,onContextmenu:F,"item-info":_e},null,8,["item-info"])):vue.createCommentVNode("",!0)],40,_hoisted_11)],2)],8,_hoisted_10)),[[vue.vShow,_e.display]])}),128)),vue.createElementVNode("rect",{x:vue.unref(_).x,y:vue.unref(_).y,height:vue.unref(_).height,width:vue.unref(_).with,stroke:"#107cec",fill:"#107cec","fill-opacity":".2"},null,8,_hoisted_16)],8,_hoisted_9)]))])],36),vue.withDirectives(vue.createElementVNode("ul",{ref_key:"contextMenuRef",ref:f,class:"contextMenu"},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(c).info,(_e,qe)=>(vue.openBlock(),vue.createElementBlock("li",{key:_e.title,onClick:In=>vue.unref(c).onContextMenuClick(qe)},[vue.createElementVNode("p",{class:vue.normalizeClass(_e.enable?"":"disabled")},[vue.createTextVNode(vue.toDisplayString(_e.title)+" ",1),vue.createElementVNode("span",_hoisted_18,vue.toDisplayString(_e.hot_key),1)],2)],8,_hoisted_17))),128))],512),[[vue.vShow,vue.unref(c).display]])],64))}}),centerPanel_vue_vue_type_style_index_0_scoped_1b085626_lang="",CenterPanel=_export_sfc$1(_sfc_main$y,[["__scopeId","data-v-1b085626"]]);/*! Element Plus Icons Vue v2.3.1 */var aim_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Aim",__name:"aim",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"}),vue.createElementVNode("path",{fill:"currentColor",d:"M512 96a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V128a32 32 0 0 1 32-32m0 576a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V704a32 32 0 0 1 32-32M96 512a32 32 0 0 1 32-32h192a32 32 0 0 1 0 64H128a32 32 0 0 1-32-32m576 0a32 32 0 0 1 32-32h192a32 32 0 1 1 0 64H704a32 32 0 0 1-32-32"})]))}}),aim_default=aim_vue_vue_type_script_setup_true_lang_default,arrow_down_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"ArrowDown",__name:"arrow-down",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"})]))}}),arrow_down_default=arrow_down_vue_vue_type_script_setup_true_lang_default,circle_check_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"CircleCheck",__name:"circle-check",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"}),vue.createElementVNode("path",{fill:"currentColor",d:"M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"})]))}}),circle_check_default=circle_check_vue_vue_type_script_setup_true_lang_default,circle_close_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"CircleClose",__name:"circle-close",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"}),vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"})]))}}),circle_close_default=circle_close_vue_vue_type_script_setup_true_lang_default,close_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Close",__name:"close",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}}),close_default=close_vue_vue_type_script_setup_true_lang_default,hide_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Hide",__name:"hide",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"}),vue.createElementVNode("path",{fill:"currentColor",d:"M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"})]))}}),hide_default=hide_vue_vue_type_script_setup_true_lang_default,loading_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Loading",__name:"loading",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"})]))}}),loading_default=loading_vue_vue_type_script_setup_true_lang_default,view_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"View",__name:"view",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"})]))}}),view_default=view_vue_vue_type_script_setup_true_lang_default,MapShim=function(){if(typeof Map<"u")return Map;function i(r,n){var o=-1;return r.some(function(a,u){return a[0]===n?(o=u,!0):!1}),o}return function(){function r(){this.__entries__=[]}return Object.defineProperty(r.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),r.prototype.get=function(n){var o=i(this.__entries__,n),a=this.__entries__[o];return a&&a[1]},r.prototype.set=function(n,o){var a=i(this.__entries__,n);~a?this.__entries__[a][1]=o:this.__entries__.push([n,o])},r.prototype.delete=function(n){var o=this.__entries__,a=i(o,n);~a&&o.splice(a,1)},r.prototype.has=function(n){return!!~i(this.__entries__,n)},r.prototype.clear=function(){this.__entries__.splice(0)},r.prototype.forEach=function(n,o){o===void 0&&(o=null);for(var a=0,u=this.__entries__;a<u.length;a++){var c=u[a];n.call(o,c[1],c[0])}},r}()}(),isBrowser=typeof window<"u"&&typeof document<"u"&&window.document===document,global$1=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),requestAnimationFrame$1=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(global$1):function(i){return setTimeout(function(){return i(Date.now())},1e3/60)}}(),trailingTimeout=2;function throttle(i,r){var n=!1,o=!1,a=0;function u(){n&&(n=!1,i()),o&&d()}function c(){requestAnimationFrame$1(u)}function d(){var f=Date.now();if(n){if(f-a<trailingTimeout)return;o=!0}else n=!0,o=!1,setTimeout(c,r);a=f}return d}var REFRESH_DELAY=20,transitionKeys=["top","right","bottom","left","width","height","size","weight"],mutationObserverSupported=typeof MutationObserver<"u",ResizeObserverController=function(){function i(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=throttle(this.refresh.bind(this),REFRESH_DELAY)}return i.prototype.addObserver=function(r){~this.observers_.indexOf(r)||this.observers_.push(r),this.connected_||this.connect_()},i.prototype.removeObserver=function(r){var n=this.observers_,o=n.indexOf(r);~o&&n.splice(o,1),!n.length&&this.connected_&&this.disconnect_()},i.prototype.refresh=function(){var r=this.updateObservers_();r&&this.refresh()},i.prototype.updateObservers_=function(){var r=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return r.forEach(function(n){return n.broadcastActive()}),r.length>0},i.prototype.connect_=function(){!isBrowser||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),mutationObserverSupported?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},i.prototype.disconnect_=function(){!isBrowser||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},i.prototype.onTransitionEnd_=function(r){var n=r.propertyName,o=n===void 0?"":n,a=transitionKeys.some(function(u){return!!~o.indexOf(u)});a&&this.refresh()},i.getInstance=function(){return this.instance_||(this.instance_=new i),this.instance_},i.instance_=null,i}(),defineConfigurable=function(i,r){for(var n=0,o=Object.keys(r);n<o.length;n++){var a=o[n];Object.defineProperty(i,a,{value:r[a],enumerable:!1,writable:!1,configurable:!0})}return i},getWindowOf=function(i){var r=i&&i.ownerDocument&&i.ownerDocument.defaultView;return r||global$1},emptyRect=createRectInit(0,0,0,0);function toFloat(i){return parseFloat(i)||0}function getBordersSize(i){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return r.reduce(function(o,a){var u=i["border-"+a+"-width"];return o+toFloat(u)},0)}function getPaddings(i){for(var r=["top","right","bottom","left"],n={},o=0,a=r;o<a.length;o++){var u=a[o],c=i["padding-"+u];n[u]=toFloat(c)}return n}function getSVGContentRect(i){var r=i.getBBox();return createRectInit(0,0,r.width,r.height)}function getHTMLElementContentRect(i){var r=i.clientWidth,n=i.clientHeight;if(!r&&!n)return emptyRect;var o=getWindowOf(i).getComputedStyle(i),a=getPaddings(o),u=a.left+a.right,c=a.top+a.bottom,d=toFloat(o.width),f=toFloat(o.height);if(o.boxSizing==="border-box"&&(Math.round(d+u)!==r&&(d-=getBordersSize(o,"left","right")+u),Math.round(f+c)!==n&&(f-=getBordersSize(o,"top","bottom")+c)),!isDocumentElement(i)){var h=Math.round(d+u)-r,y=Math.round(f+c)-n;Math.abs(h)!==1&&(d-=h),Math.abs(y)!==1&&(f-=y)}return createRectInit(a.left,a.top,d,f)}var isSVGGraphicsElement=function(){return typeof SVGGraphicsElement<"u"?function(i){return i instanceof getWindowOf(i).SVGGraphicsElement}:function(i){return i instanceof getWindowOf(i).SVGElement&&typeof i.getBBox=="function"}}();function isDocumentElement(i){return i===getWindowOf(i).document.documentElement}function getContentRect(i){return isBrowser?isSVGGraphicsElement(i)?getSVGContentRect(i):getHTMLElementContentRect(i):emptyRect}function createReadOnlyRect(i){var r=i.x,n=i.y,o=i.width,a=i.height,u=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,c=Object.create(u.prototype);return defineConfigurable(c,{x:r,y:n,width:o,height:a,top:n,right:r+o,bottom:a+n,left:r}),c}function createRectInit(i,r,n,o){return{x:i,y:r,width:n,height:o}}var ResizeObservation=function(){function i(r){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=createRectInit(0,0,0,0),this.target=r}return i.prototype.isActive=function(){var r=getContentRect(this.target);return this.contentRect_=r,r.width!==this.broadcastWidth||r.height!==this.broadcastHeight},i.prototype.broadcastRect=function(){var r=this.contentRect_;return this.broadcastWidth=r.width,this.broadcastHeight=r.height,r},i}(),ResizeObserverEntry=function(){function i(r,n){var o=createReadOnlyRect(n);defineConfigurable(this,{target:r,contentRect:o})}return i}(),ResizeObserverSPI=function(){function i(r,n,o){if(this.activeObservations_=[],this.observations_=new MapShim,typeof r!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=r,this.controller_=n,this.callbackCtx_=o}return i.prototype.observe=function(r){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(r instanceof getWindowOf(r).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(r)||(n.set(r,new ResizeObservation(r)),this.controller_.addObserver(this),this.controller_.refresh())}},i.prototype.unobserve=function(r){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(r instanceof getWindowOf(r).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(r)&&(n.delete(r),n.size||this.controller_.removeObserver(this))}},i.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},i.prototype.gatherActive=function(){var r=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&r.activeObservations_.push(n)})},i.prototype.broadcastActive=function(){if(this.hasActive()){var r=this.callbackCtx_,n=this.activeObservations_.map(function(o){return new ResizeObserverEntry(o.target,o.broadcastRect())});this.callback_.call(r,n,r),this.clearActive()}},i.prototype.clearActive=function(){this.activeObservations_.splice(0)},i.prototype.hasActive=function(){return this.activeObservations_.length>0},i}(),observers=typeof WeakMap<"u"?new WeakMap:new MapShim,ResizeObserver$1=function(){function i(r){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=ResizeObserverController.getInstance(),o=new ResizeObserverSPI(r,n,this);observers.set(this,o)}return i}();["observe","unobserve","disconnect"].forEach(function(i){ResizeObserver$1.prototype[i]=function(){var r;return(r=observers.get(this))[i].apply(r,arguments)}});var index$1=function(){return typeof global$1.ResizeObserver<"u"?global$1.ResizeObserver:ResizeObserver$1}();const Events=["blur","input","change","changeSelectionStyle","changeSession","copy","focus","paste"],VAceEditor=vue.defineComponent({name:"VAceEditor",props:{value:{type:String,required:!0},lang:{type:String,default:"text"},theme:{type:String,default:"chrome"},options:Object,placeholder:String,readonly:Boolean,wrap:Boolean,printMargin:{type:[Boolean,Number],default:!0},minLines:Number,maxLines:Number},emits:["update:value","init",...Events],render(){return vue.h("div")},mounted(){const i=this._editor=vue.markRaw(ace.edit(this.$el,{placeholder:this.placeholder,readOnly:this.readonly,value:this.value,mode:"ace/mode/"+this.lang,theme:"ace/theme/"+this.theme,wrap:this.wrap,printMargin:this.printMargin,useWorker:!1,minLines:this.minLines,maxLines:this.maxLines,...this.options}));this._contentBackup=this.value,this._isSettingContent=!1,i.on("change",()=>{if(this._isSettingContent)return;const r=i.getValue();this._contentBackup=r,this.$emit("update:value",r)}),Events.forEach(r=>{const n="on"+vue.capitalize(r);typeof this.$.vnode.props[n]=="function"&&i.on(r,this.$emit.bind(this,r))}),this._ro=new index$1(()=>i.resize()),this._ro.observe(this.$el),this.$emit("init",i)},beforeUnmount(){var i,r;(i=this._ro)===null||i===void 0||i.disconnect(),(r=this._editor)===null||r===void 0||r.destroy()},methods:{focus(){this._editor.focus()},blur(){this._editor.blur()},selectAll(){this._editor.selectAll()},getAceInstance(){return this._editor}},watch:{value(i){if(this._contentBackup!==i){try{this._isSettingContent=!0,this._editor.setValue(i,1)}finally{this._isSettingContent=!1}this._contentBackup=i}},theme(i){this._editor.setTheme("ace/theme/"+i)},options(i){this._editor.setOptions(i)},readonly(i){this._editor.setReadOnly(i)},placeholder(i){this._editor.setOption("placeholder",i)},wrap(i){this._editor.setWrapBehavioursEnabled(i)},printMargin(i){this._editor.setOption("printMargin",i)},lang(i){this._editor.setOption("mode","ace/mode/"+i)},minLines(i){this._editor.setOption("minLines",i)},maxLines(i){this._editor.setOption("maxLines",i)}}}),themeUrl2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9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL3RoZW1lL2tyX3RoZW1lIl0sIGZ1bmN0aW9uKG0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBtb2R1bGUgPT0gIm9iamVjdCIgJiYgdHlwZW9mIGV4cG9ydHMgPT0gIm9iamVjdCIgJiYgbW9kdWxlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IG07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pKCk7CiAgICAgICAgICAgIA==",modeJsonUrl="data:application/javascript;base64,YWNlLmRlZmluZSgiYWNlL21vZGUvanNvbl9oaWdobGlnaHRfcnVsZXMiLFsicmVxdWlyZSIsImV4cG9ydHMiLCJtb2R1bGUiLCJhY2UvbGliL29vcCIsImFjZS9tb2RlL3RleHRfaGlnaGxpZ2h0X3J1bGVzIl0sIGZ1bmN0aW9uKHJlcXVpcmUsIGV4cG9ydHMsIG1vZHVsZSl7InVzZSBzdHJpY3QiOwp2YXIgb29wID0gcmVxdWlyZSgiLi4vbGliL29vcCIpOwp2YXIgVGV4dEhpZ2hsaWdodFJ1bGVzID0gcmVxdWlyZSgiLi90ZXh0X2hpZ2hsaWdodF9ydWxlcyIpLlRleHRIaWdobGlnaHRSdWxlczsKdmFyIEpzb25IaWdobGlnaHRSdWxlcyA9IGZ1bmN0aW9uICgpIHsKICAgIHRoaXMuJHJ1bGVzID0gewogICAgICAgICJzdGFydCI6IFsKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdG9rZW46ICJ2YXJpYWJsZSIsCiAgICAgICAgICAgICAgICByZWdleDogJ1siXSg/Oig/OlxcXFwuKXwoPzpbXiJcXFxcXSkpKj9bIl1cXHMqKD89OiknCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAic3RyaW5nIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAnIicsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RyaW5nIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lm51bWVyaWMiLAogICAgICAgICAgICAgICAgcmVnZXg6ICIwW3hYXVswLTlhLWZBLUZdK1xcYiIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJjb25zdGFudC5udW1lcmljIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAiWystXT9cXGQrKD86KD86XFwuXFxkKik/KD86W2VFXVsrLV0/XFxkKyk/KT9cXGIiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29uc3RhbnQubGFuZ3VhZ2UuYm9vbGVhbiIsCiAgICAgICAgICAgICAgICByZWdleDogIig/OnRydWV8ZmFsc2UpXFxiIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbJ10oPzooPzpcXFxcLil8KD86W14nXFxcXF0pKSo/WyddIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbW1lbnQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXC9cXC8uKiQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29tbWVudC5zdGFydCIsCiAgICAgICAgICAgICAgICByZWdleDogIlxcL1xcKiIsCiAgICAgICAgICAgICAgICBuZXh0OiAiY29tbWVudCIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5scGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbWyh7XSIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5ycGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbXFxdKX1dIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInB1bmN0dWF0aW9uLm9wZXJhdG9yIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAvWyxdLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXHMrIgogICAgICAgICAgICB9CiAgICAgICAgXSwKICAgICAgICAic3RyaW5nIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lmxhbmd1YWdlLmVzY2FwZSIsCiAgICAgICAgICAgICAgICByZWdleDogL1xcKD86eFswLTlhLWZBLUZdezJ9fHVbMC05YS1mQS1GXXs0fXxbIlxcXC9iZm5ydF0pLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInN0cmluZyIsCiAgICAgICAgICAgICAgICByZWdleDogJyJ8JCcsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RhcnQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIGRlZmF1bHRUb2tlbjogInN0cmluZyIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImNvbW1lbnQiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29tbWVudC5lbmQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXCpcXC8iLAogICAgICAgICAgICAgICAgbmV4dDogInN0YXJ0IgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICBkZWZhdWx0VG9rZW46ICJjb21tZW50IgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfTsKfTsKb29wLmluaGVyaXRzKEpzb25IaWdobGlnaHRSdWxlcywgVGV4dEhpZ2hsaWdodFJ1bGVzKTsKZXhwb3J0cy5Kc29uSGlnaGxpZ2h0UnVsZXMgPSBKc29uSGlnaGxp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c2Vzc2lvbiwgcm93KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKGZvbGRTdHlsZSAhPSAiYWxsIikKICAgICAgICAgICAgICAgICAgICByYW5nZSA9IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHJhbmdlOwogICAgICAgIH0KICAgICAgICBpZiAoZm9sZFN0eWxlID09PSAibWFya2JlZ2luIikKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIHZhciBtYXRjaCA9IGxpbmUubWF0Y2godGhpcy5mb2xkaW5nU3RvcE1hcmtlcik7CiAgICAgICAgaWYgKG1hdGNoKSB7CiAgICAgICAgICAgIHZhciBpID0gbWF0Y2guaW5kZXggKyBtYXRjaFswXS5sZW5ndGg7CiAgICAgICAgICAgIGlmIChtYXRjaFsxXSkKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNsb3NpbmdCcmFja2V0QmxvY2soc2Vzc2lvbiwgbWF0Y2hbMV0sIHJvdywgaSk7CiAgICAgICAgICAgIHJldHVybiBzZXNzaW9uLmdldENvbW1lbnRGb2xkUmFuZ2Uocm93LCBpLCAtMSk7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuZ2V0U2VjdGlvblJhbmdlID0gZnVuY3Rpb24gKHNlc3Npb24sIHJvdykgewogICAgICAgIHZhciBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgdmFyIHN0YXJ0SW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgdmFyIHN0YXJ0Um93ID0gcm93OwogICAgICAgIHZhciBzdGFydENvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIHJvdyA9IHJvdyArIDE7CiAgICAgICAgdmFyIGVuZFJvdyA9IHJvdzsKICAgICAgICB2YXIgbWF4Um93ID0gc2Vzc2lvbi5nZXRMZW5ndGgoKTsKICAgICAgICB3aGlsZSAoKytyb3cgPCBtYXhSb3cpIHsKICAgICAgICAgICAgbGluZSA9IHNlc3Npb24uZ2V0TGluZShyb3cpOwogICAgICAgICAgICB2YXIgaW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgICAgIGlmIChpbmRlbnQgPT09IC0xKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChzdGFydEluZGVudCA+IGluZGVudCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB2YXIgc3ViUmFuZ2UgPSB0aGlzLmdldEZvbGRXaWRnZXRSYW5nZShzZXNzaW9uLCAiYWxsIiwgcm93KTsKICAgICAgICAgICAgaWYgKHN1YlJhbmdlKSB7CiAgICAgICAgICAgICAgICBpZiAoc3ViUmFuZ2Uuc3RhcnQucm93IDw9IHN0YXJ0Um93KSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmIChzdWJSYW5nZS5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgcm93ID0gc3ViUmFuZ2UuZW5kLnJvdzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKHN0YXJ0SW5kZW50ID09IGluZGVudCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGVuZFJvdyA9IHJvdzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG5ldyBSYW5nZShzdGFydFJvdywgc3RhcnRDb2x1bW4sIGVuZFJvdywgc2Vzc2lvbi5nZXRMaW5lKGVuZFJvdykubGVuZ3RoKTsKICAgIH07CiAgICB0aGlzLmdldENvbW1lbnRSZWdpb25CbG9jayA9IGZ1bmN0aW9uIChzZXNzaW9uLCBsaW5lLCByb3cpIHsKICAgICAgICB2YXIgc3RhcnRDb2x1bW4gPSBsaW5lLnNlYXJjaCgvXHMqJC8pOwogICAgICAgIHZhciBtYXhSb3cgPSBzZXNzaW9uLmdldExlbmd0aCgpOwogICAgICAgIHZhciBzdGFydFJvdyA9IHJvdzsKICAgICAgICB2YXIgcmUgPSAvXlxzKig/OlwvXCp8XC9cL3wtLSkjPyhlbmQpP3JlZ2lvblxiLzsKICAgICAgICB2YXIgZGVwdGggPSAxOwogICAgICAgIHdoaWxlICgrK3JvdyA8IG1heFJvdykgewogICAgICAgICAgICBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgICAgIHZhciBtID0gcmUuZXhlYyhsaW5lKTsKICAgICAgICAgICAgaWYgKCFtKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChtWzFdKQogICAgICAgICAgICAgICAgZGVwdGgtLTsKICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgZGVwdGgrKzsKICAgICAgICAgICAgaWYgKCFkZXB0aCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICB2YXIgZW5kUm93ID0gcm93OwogICAgICAgIGlmIChlbmRSb3cgPiBzdGFydFJvdykgewogICAgICAgICAgICByZXR1cm4gbmV3IFJhbmdlKHN0YXJ0Um93LCBzdGFydENvbHVtbiwgZW5kUm93LCBsaW5lLmxlbmd0aCk7CiAgICAgICAgfQogICAgfTsKfSkuY2FsbChGb2xkTW9kZS5wcm90b3R5cGUpOwoKfSk7CgphY2UuZGVmaW5lKCJhY2UvbW9kZS9qc29uIixbInJlcXVpcmUiLCJleHBvcnRzIiwibW9kdWxlIiwiYWNlL2xpYi9vb3AiLCJhY2UvbW9kZS90ZXh0IiwiYWNlL21vZGUvanNvbl9oaWdobGlnaHRfcnVsZXMiLCJhY2UvbW9kZS9tYXRjaGluZ19icmFjZV9vdXRkZW50IiwiYWNlL21vZGUvYmVoYXZpb3VyL2NzdHlsZSIsImFjZS9tb2RlL2ZvbGRpbmcvY3N0eWxlIiwiYWNlL3dvcmtlci93b3JrZXJfY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sgc3RhcnQ6ICIvKiIsIGVuZDogIiovIiB9OwogICAgdGhpcy5nZXROZXh0TGluZUluZGVudCA9IGZ1bmN0aW9uIChzdGF0ZSwgbGluZSwgdGFiKSB7CiAgICAgICAgdmFyIGluZGVudCA9IHRoaXMuJGdldEluZGVudChsaW5lKTsKICAgICAgICBpZiAoc3RhdGUgPT0gInN0YXJ0IikgewogICAgICAgICAgICB2YXIgbWF0Y2ggPSBsaW5lLm1hdGNoKC9eLipbXHtcKFxbXVxzKiQvKTsKICAgICAgICAgICAgaWYgKG1hdGNoKSB7CiAgICAgICAgICAgICAgICBpbmRlbnQgKz0gdGFiOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiBpbmRlbnQ7CiAgICB9OwogICAgdGhpcy5jaGVja091dGRlbnQgPSBmdW5jdGlvbiAoc3RhdGUsIGxpbmUsIGlucHV0KSB7CiAgICAgICAgcmV0dXJuIHRoaXMuJG91dGRlbnQuY2hlY2tPdXRkZW50KGxpbmUsIGlucHV0KTsKICAgIH07CiAgICB0aGlzLmF1dG9PdXRkZW50ID0gZnVuY3Rpb24gKHN0YXRlLCBkb2MsIHJvdykgewogICAgICAgIHRoaXMuJG91dGRlbnQuYXV0b091dGRlbnQoZG9jLCByb3cpOwogICAgfTsKICAgIHRoaXMuY3JlYXRlV29ya2VyID0gZnVuY3Rpb24gKHNlc3Npb24pIHsKICAgICAgICB2YXIgd29ya2VyID0gbmV3IFdvcmtlckNsaWVudChbImFjZSJdLCAiYWNlL21vZGUvanNvbl93b3JrZXIiLCAiSnNvbldvcmtlciIpOwogICAgICAgIHdvcmtlci5hdHRhY2hUb0RvY3VtZW50KHNlc3Npb24uZ2V0RG9jdW1lbnQoKSk7CiAgICAgICAgd29ya2VyLm9uKCJhbm5vdGF0ZSIsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIHNlc3Npb24uc2V0QW5ub3RhdGlvbnMoZS5kYXRhKTsKICAgICAgICB9KTsKICAgICAgICB3b3JrZXIub24oInRlcm1pbmF0ZSIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgc2Vzc2lvbi5jbGVhckFubm90YXRpb25zKCk7CiAgICAgICAgfSk7CiAgICAgICAgcmV0dXJuIHdvcmtlcjsKICAgIH07CiAgICB0aGlzLiRpZCA9ICJhY2UvbW9kZS9qc29uIjsKfSkuY2FsbChNb2RlLnByb3RvdHlwZSk7CmV4cG9ydHMuTW9kZSA9IE1vZGU7Cgp9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL21vZGUvanNvbiJdLCBmdW5jdGlvbihtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgbW9kdWxlID09ICJvYmplY3QiICYmIHR5cGVvZiBleHBvcnRzID09ICJvYmplY3QiICYmIG1vZHVsZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlLmV4cG9ydHMgPSBtOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KSgpOwogICAgICAgICAgICA=",workerJsonUrl="data:application/javascript;base64,Im5vIHVzZSBzdHJpY3QiOwohKGZ1bmN0aW9uKHdpbmRvdykgewppZiAodHlwZW9mIHdpbmRvdy53aW5kb3cgIT0gInVuZGVmaW5lZCIgJiYgd2luZG93LmRvY3VtZW50KQogICAgcmV0dXJuOwppZiAod2luZG93LnJlcXVpcmUgJiYgd2luZG93LmRlZmluZSkKICAgIHJldHVybjsKCmlmICghd2luZG93LmNvbnNvbGUpIHsKICAgIHdpbmRvdy5jb25zb2xlID0gZnVuY3Rpb24oKSB7CiAgICAgICAgdmFyIG1zZ3MgPSBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMsIDApOwogICAgICAgIHBvc3RNZXNzYWdlKHt0eXBlOiAibG9nIiwgZGF0YTogbXNnc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JZC5zcGxpdCgiLyIpLnNsaWNlKDAsIC0xKS5qb2luKCIvIik7CiAgICAgICAgbW9kdWxlTmFtZSA9IChiYXNlID8gYmFzZSArICIvIiA6ICIiKSArIG1vZHVsZU5hbWU7CiAgICAgICAgCiAgICAgICAgd2hpbGUgKG1vZHVsZU5hbWUuaW5kZXhPZigiLiIpICE9PSAtMSAmJiBwcmV2aW91cyAhPSBtb2R1bGVOYW1lKSB7CiAgICAgICAgICAgIHZhciBwcmV2aW91cyA9IG1vZHVsZU5hbWU7CiAgICAgICAgICAgIG1vZHVsZU5hbWUgPSBtb2R1bGVOYW1lLnJlcGxhY2UoL15cLlwvLywgIiIpLnJlcGxhY2UoL1wvXC5cLy8sICIvIikucmVwbGFjZSgvW15cL10rXC9cLlwuXC8vLCAiIik7CiAgICAgICAgfQogICAgfQogICAgCiAgICByZXR1cm4gbW9kdWxlTmFtZTsKfTsKCndpbmRvdy5yZXF1aXJlID0gZnVuY3Rpb24gcmVxdWlyZShwYXJlbnRJZCwgaWQpIHsKICAgIGlmICghaWQpIHsKICAgICAgICBpZCA9IHBhcmVudElkOwogICAgICAgIHBhcmVudElkID0gbnVsbDsKICAgIH0KICAgIGlmICghaWQuY2hhckF0KQogICAgICAgIHRocm93IG5ldyBFcnJvcigid29ya2VyLmpzIHJlcXVpcmUoKSBhY2NlcHRzIG9ubHkgKHBhcmVudElkLCBpZCkgYXMgYXJndW1lbnRzIik7CgogICAgaWQgPSB3aW5kb3cubm9ybWFsaXplTW9kdWxlKHBhcmVudElkLCBpZCk7CgogICAgdmFyIG1vZHVsZSA9IHdpbmRvdy5yZXF1aXJlLm1vZHVsZXNbaWRdOwogICAgaWYgKG1vZHVsZSkgewogICAgICAgIGlmICghbW9kdWxlLmluaXRpYWxpemVkKSB7CiAgICAgICAgICAgIG1vZHVsZS5pbml0aWFsaXplZCA9IHRydWU7CiAgICAgICAgICAgIG1vZHVsZS5leHBvcnRzID0gbW9kdWxlLmZhY3RvcnkoKS5leHBvcnR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IHRlc3RQYXRoLmxhc3RJbmRleE9mKCIvIik7CiAgICAgICAgaWYgKGkgPT09IC0xKSBicmVhazsKICAgICAgICB0YWlsID0gdGVzdFBhdGguc3Vic3RyKGkpICsgdGFpbDsKICAgICAgICB0ZXN0UGF0aCA9IHRlc3RQYXRoLnNsaWNlKDAsIGkpOwogICAgfQogICAgcmV0dXJuIGlkOwp9CndpbmRvdy5yZXF1aXJlLm1vZHVsZXMgPSB7fTsKd2luZG93LnJlcXVpcmUudGxucyA9IHt9OwoKd2luZG93LmRlZmluZSA9IGZ1bmN0aW9uKGlkLCBkZXBzLCBmYWN0b3J5KSB7CiAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA9PSAyKSB7CiAgICAgICAgZmFjdG9yeSA9IGRlcHM7CiAgICAgICAgaWYgKHR5cGVvZiBpZCAhPSAic3RyaW5nIikgewogICAgICAgICAgICBkZXBzID0gaWQ7CiAgICAgICAgICAgIGlkID0gd2luZG93LnJlcXVpcmUuaWQ7CiAgICAgICAgfQogICAgfSBlbHNlIGlmIChhcmd1bWVudHMubGVuZ3RoID09IDEpIHsKICAgICAgICBmYWN0b3J5ID0gaWQ7CiAgICAgICAgZGVwcyA9IFtdOwogICAgICAgIGlkID0gd2luZG93LnJlcXVpcmUuaWQ7CiAgICB9CiAgICAKICAgIGlmICh0eXBlb2YgZmFjdG9yeSAhPSAiZnVuY3Rpb24iKSB7CiAgICAgICAgd2luZG93LnJlcXVpcmUubW9kdWxlc1tpZF0gPSB7CiAgICAgICAgICAgIGV4cG9ydHM6IGZhY3RvcnksCiAgICAgICAgICAgIGluaXRpYWxpemVkOiB0cnVlCiAgICAgICAgfTsKICAgICAgICByZXR1cm47CiAgICB9CgogICAgaWYgKCFkZXBzLmxlbmd0aCkKICAgICAgICAvLyBJZiB0aGVyZSBpcyBubyBkZXBlbmRlbmNpZXMsIHdlIGluamVjdCAicmVxdWlyZSIsICJleHBvcnRzIiBhbmQKICAgICAgICAvLyAibW9kdWxlIiBhcyBkZXBlbmRlbmNpZXMsIHRvIHByb3ZpZGUgQ29tbW9uSlMgY29tcGF0aWJpbGl0eS4KICAgICAgICBkZXBzID0gWyJyZXF1aXJlIiwgImV4cG9ydHMiLCAibW9kdWxlIl07CgogICAgdmFyIHJlcSA9IGZ1bmN0aW9uKGNoaWxkSWQpIHsKICAgICAgICByZXR1cm4gd2luZG93LnJlcXVpcmUoaWQsIGNoaWxkSWQpOwogICAgfTsKCiAgICB3aW5kb3cucmVxdWlyZS5tb2R1bGVzW2lkXSA9IHsKICAgICAgICBleHBvcnRzOiB7fSwKICAgICAgICBmYWN0b3J5OiBmdW5jdGlvbigpIHsKICAgICAgICAgICAgdmFyIG1vZHVsZSA9IHRoaXM7CiAgICAgICAgICAgIHZhciByZXR1cm5FeHBvcnRzID0gZmFjdG9yeS5hcHBseSh0aGlzLCBkZXBzLnNsaWNlKDAsIGZhY3RvcnkubGVuZ3RoKS5tYXAoZnVuY3Rpb24oZGVwKSB7CiAgICAgICAgICAgICAgICBzd2l0Y2ggKGRlcCkgewogICAgICAgICAgICAgICAgICAgIC8vIEJlY2F1c2UgInJlcXVpcmUiLCAiZXhwb3J0cyIgYW5kICJtb2R1bGUiIGFyZW4ndCBhY3R1YWwKICAgICAgICAgICAgICAgICAgICAvLyBkZXBlbmRlbmNpZXMsIHdlIG11c3QgaGFuZGxlIHRoZW0gc2VwZXJhdGVseS4KICAgICAgICAgICAgICAgICAgICBjYXNlICJyZXF1aXJlIjogcmV0dXJuIHJlcTsKICAgICAgICAgICAgICAgICAgICBjYXNlICJleHBvcnRzIjogcmV0dXJuIG1vZHVsZS5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgIGNhc2UgIm1vZHVsZSI6ICByZXR1cm4gbW9kdWxlOwogICAgICAgICAgICAgICAgICAgIC8vIEJ1dCBmb3IgYWxsIG90aGVyIGRlcGVuZGVuY2llcywgd2UgY2FuIGp1c3QgZ28gYWhlYWQgYW5kCiAgICAgICAgICAgICAgICAgICAgLy8gcmVxdWlyZSB0aGVtLgogICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6ICAgICAgICByZXR1cm4gcmVxKGRlcCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgaWYgKHJldHVybkV4cG9ydHMpCiAgICAgICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IHJldHVybkV4cG9ydHM7CiAgICAgICAgICAgIHJldHVybiBtb2R1bGU7CiAgICAgICAgfQogICAgfTsKfTsKd2luZG93LmRlZmluZS5hbWQgPSB7fTsKd2luZG93LnJlcXVpcmUudGxucyA9IHt9Owp3aW5kb3cuaW5pdEJhc2VVcmxzICA9IGZ1bmN0aW9uIGluaXRCYXNlVXJscyh0b3BMZXZlbE5hbWVzcGFjZXMpIHsKICAgIGZvciAodmFyIGkgaW4gdG9wTGV2ZWxOYW1lc3BhY2VzKQogICAgICAgIHRoaXMucmVxdWlyZS50bG5zW2ldID0gdG9wTGV2ZWxOYW1lc3BhY2VzW2ldOwp9OwoKd2luZG93LmluaXRTZW5kZXIgPSBmdW5jdGlvbiBpbml0U2VuZGVyKCkgewoKICAgIHZhciBFdmVudEVtaXR0ZXIgPSB3aW5kb3cucmVxdWlyZSgiYWNlL2xpYi9ldmVudF9lbWl0dGVyIikuRXZlbnRFbWl0dGVyOwogICAgdmFyIG9vcCA9IHdpbmRvdy5yZXF1aXJlKCJhY2UvbGliL29vcCIpOwogICAgCiAgICB2YXIgU2VuZGVyID0gZnVuY3Rpb24oKSB7fTsKICAgIAogICAgKGZ1bmN0aW9uKCkgewogICAgICAgIAogICAgICAgIG9vcC5pbXBsZW1lbnQodGhpcywgRXZlbnRFbWl0dGVyKTsKICAgICAgICAgICAgICAgIAogICAgICAgIHRoaXMuY2FsbGJhY2sgPSBmdW5jdGlvbihkYXRhLCBjYWxsYmFja0lkKSB7CiAgICAgICAgICAgIHBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIHR5cGU6ICJjYWxsIiwKICAgICAgICAgICAgICAgIGlkOiBjYWxsYmFja0lkLAogICAgICAgICAgICAgICAgZGF0YTogZGF0YQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgCiAgICAgICAgdGhpcy5lbWl0ID0gZnVuY3Rpb24obmFtZSwgZGF0YSkgewogICAgICAgICAgICBwb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICB0eXBlOiAiZXZlbnQiLAogICAgICAgICAgICAgICAgbmFtZTogbmFtZSwKICAgICAgICAgICAgICAgIGRhdGE6IGRhdGEKICAgICAgICAgICAgfSk7CiAgICAgICAgfTsKICAgICAgICAKICAgIH0pLmNhbGwoU2VuZGVyLnByb3RvdHlwZSk7CiAgICAKICAgIHJldHVybiBuZXcgU2VuZGVyKCk7Cn07Cgp2YXIgbWFpbiA9IHdpbmRvdy5tYWluID0gbnVsbDsKdmFyIHNlbmRlciA9IHdpbmRvdy5zZW5kZXIgPSBudWxsOwoKd2luZG93Lm9ubWVzc2FnZSA9IGZ1bmN0aW9uKGUpIHsKICAgIHZhciBtc2cgPSBlLmRhdGE7CiAgICBpZiAobXNnLmV2ZW50ICYmIHNlbmRlcikgewogICAgICAgIHNlbmRlci5fc2lnbmFsKG1zZy5ldmVudCwgbXNnLmRhdGEpOwogICAgfQogICAgZWxzZSBpZiAobXNnLmNvbW1hbmQpIHsKICAgICAgICBpZiAobWFpblttc2cuY29tbWFuZF0pCiAgICAgICAgICAgIG1haW5bbXNnLmNvbW1hbmRdLmFwcGx5KG1haW4sIG1zZy5hcmdzKTsKICAgICAgICBlbHNlIGlmICh3aW5kb3dbbXNnLmNvbW1hbmRdKQogICAgICAgICAgICB3aW5kb3dbbXNnLmNvbW1hbmRdLmFwcGx5KHdpbmRvdywgbXNnLmFyZ3MpOwogICAgICAgIGVsc2UKICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCJVbmtub3duIGNvbW1hbmQ6IiArIG1zZy5jb21tYW5kKTsKICAgIH0KICAgIGVsc2UgaWYgKG1zZy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ggKGRlbHRhLmFjdGlvbikgewogICAgICAgIGNhc2UgImluc2VydCI6CiAgICAgICAgICAgIHZhciBsaW5lcyA9IGRlbHRhLmxpbmVzOwogICAgICAgICAgICBpZiAobGluZXMubGVuZ3RoID09PSAxKSB7CiAgICAgICAgICAgICAgICBkb2NMaW5lc1tyb3ddID0gbGluZS5zdWJzdHJpbmcoMCwgc3RhcnRDb2x1bW4pICsgZGVsdGEubGluZXNbMF0gKyBsaW5lLnN1YnN0cmluZyhzdGFydENvbHVtbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICB2YXIgYXJncyA9IFtyb3csIDFdLmNvbmNhdChkZWx0YS5saW5lcyk7CiAgICAgICAgICAgICAgICBkb2NMaW5lcy5zcGxpY2UuYXBwbHkoZG9jTGluZXMsIGFyZ3MpOwogICAgICAgICAgICAgICAgZG9jTGluZXNbcm93XSA9IGxpbmUuc3Vic3RyaW5nKDAsIHN0YXJ0Q29sdW1uKSArIGRvY0xpbmVzW3Jvd107CiAgICAgICAgICAgICAgICBkb2NMaW5lc1tyb3cgKyBkZWx0YS5saW5lcy5sZW5ndGggLSAxXSArPSBsaW5lLnN1YnN0cmluZyhzdGFydENvbHVtbik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgY2FzZSAicmVtb3ZlIjoKICAgICAgICAgICAgdmFyIGVuZENvbHVtbiA9IGRlbHRhLmVuZC5jb2x1bW47CiAgICAgICAgICAgIHZhciBlbmRSb3cgPSBkZWx0YS5lbmQucm93OwogICAgICAgICAgICBpZiAocm93ID09PSBlbmRSb3cpIHsKICAgICAgICAgICAgICAgIGRvY0xpbmVzW3Jvd10gPSBsaW5lLnN1YnN0cmluZygwLCBzdGFydENvbHVtbikgKyBsaW5lLnN1YnN0cmluZyhlbmRDb2x1bW4pOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgZG9jTGluZXMuc3Bs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CiAgICAgICAgICAgICJdIC0+IFsiICsgdGhpcy5lbmQucm93ICsgIi8iICsgdGhpcy5lbmQuY29sdW1uICsgIl0iKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMDsKICAgIH07CiAgICB0aGlzLmNvbXBhcmVSYW5nZSA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAsIGVuZCA9IHJhbmdlLmVuZCwgc3RhcnQgPSByYW5nZS5zdGFydDsKICAgICAgICBjbXAgPSB0aGlzLmNvbXBhcmUoZW5kLnJvdywgZW5kLmNvbHVtbik7CiAgICAgICAgaWYgKGNtcCA9PSAxKSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSBpZiAoY21wID09IDApIHsKICAgICAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAoY21wID09IC0xKSB7CiAgICAgICAgICAgIHJldHVybiAtMjsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gLTEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDQyOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlUG9pbnQgPSBmdW5jdGlvbiAocCkgewogICAgICAgIHJldHVybiB0aGlzLmNvbXBhcmUocC5yb3csIHAuY29sdW1uKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zUmFuZ2UgPSBmdW5jdGlvbiAocmFuZ2UpIHsKICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlUG9pbnQocmFuZ2Uuc3RhcnQpID09IDAgJiYgdGhpcy5jb21wYXJlUG9pbnQocmFuZ2UuZW5kKSA9PSAwOwogICAgfTsKICAgIHRoaXMuaW50ZXJzZWN0cyA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAgPSB0aGlzLmNvbXBhcmVSYW5nZShyYW5nZSk7CiAgICAgICAgcmV0dXJuIChjbXAgPT0gLTEgfHwgY21wID09IDAgfHwgY21wID09IDEpOwogICAgfTsKICAgIHRoaXMuaXNFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4gdGhpcy5lbmQucm93ID09IHJvdyAmJiB0aGlzLmVuZC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuaXNTdGFydCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHJldHVybiB0aGlzLnN0YXJ0LnJvdyA9PSByb3cgJiYgdGhpcy5zdGFydC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuc2V0U3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IHJvdy5jb2x1bW47CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93LnJvdzsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5zZXRFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSByb3cuY29sdW1uOwogICAgICAgICAgICB0aGlzLmVuZC5yb3cgPSByb3cucm93OwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgdGhpcy5lbmQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSBjb2x1bW47CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuaW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc0VuZChyb3csIGNvbHVtbikgfHwgdGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlU3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodGhpcy5jb21wYXJlKHJvdywgY29sdW1uKSA9PSAwKSB7CiAgICAgICAgICAgIGlmICh0aGlzLmlzRW5kKHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlRW5kID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuY29tcGFyZSA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICghdGhpcy5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgIGlmIChyb3cgPT09IHRoaXMuc3RhcnQucm93KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gY29sdW1uIDwgdGhpcy5zdGFydC5jb2x1bW4gPyAtMSA6IChjb2x1bW4gPiB0aGlzLmVuZC5jb2x1bW4gPyAxIDogMCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuc3RhcnQucm93KQogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHJvdyA+IHRoaXMuZW5kLnJvdykKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09PSByb3cpCiAgICAgICAgICAgIHJldHVybiBjb2x1bW4gPj0gdGhpcy5zdGFydC5jb2x1bW4gPyAwIDogLTE7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PT0gcm93KQogICAgICAgICAgICByZXR1cm4gY29sdW1uIDw9IHRoaXMuZW5kLmNvbHVtbiA/IDAgOiAxOwogICAgICAgIHJldHVybiAwOwogICAgfTsKICAgIHRoaXMuY29tcGFyZVN0YXJ0ID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09IHJvdyAmJiB0aGlzLnN0YXJ0LmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbik7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuY29tcGFyZUVuZCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPT0gcm93ICYmIHRoaXMuZW5kLmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlSW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PSByb3cgJiYgdGhpcy5lbmQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAodGhpcy5zdGFydC5yb3cgPT0gcm93ICYmIHRoaXMuc3RhcnQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jbGlwUm93cyA9IGZ1bmN0aW9uIChmaXJzdFJvdywgbGFzdFJvdykgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPiBsYXN0Um93KQogICAgICAgICAgICB2YXIgZW5kID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLmVuZC5yb3cgPCBmaXJzdFJvdykKICAgICAgICAgICAgdmFyIGVuZCA9IHsgcm93OiBmaXJzdFJvdywgY29sdW1uOiAwIH07CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID4gbGFzdFJvdykKICAgICAgICAgICAgdmFyIHN0YXJ0ID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLnN0YXJ0LnJvdyA8IGZpcnN0Um93KQogICAgICAgICAgICB2YXIgc3RhcnQgPSB7IHJvdzogZmlyc3RSb3csIGNvbHVtbjogMCB9OwogICAgICAgIHJldHVybiBSYW5nZS5mcm9tUG9pbnRzKHN0YXJ0IHx8IHRoaXMuc3RhcnQsIGVuZCB8fCB0aGlzLmVuZCk7CiAgICB9OwogICAgdGhpcy5leHRlbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICB2YXIgY21wID0gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICBpZiAoY21wID09IDApCiAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgIGVsc2UgaWYgKGNtcCA9PSAtMSkKICAgICAgICAgICAgdmFyIHN0YXJ0ID0geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgICAgICBlbHNlCiAgICAgICAgICAgIHZhciBlbmQgPSB7IHJvdzogcm93LCBjb2x1bW46IGNvbHVtbiB9OwogICAgICAgIHJldHVybiBSYW5nZS5mcm9tUG9pbnRzKHN0YXJ0IHx8IHRoaXMuc3RhcnQsIGVuZCB8fCB0aGlzLmVuZCk7CiAgICB9OwogICAg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9OwogICAgICAgIH0KICAgICAgICBpZiAoJHBvaW50c0luT3JkZXIoZGVsdGFFbmQsIHBvaW50LCAhbW92ZUlmRXF1YWwpKSB7CiAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICByb3c6IHBvaW50LnJvdyArIGRlbHRhUm93U2hpZnQsCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbiArIChwb2ludC5yb3cgPT0gZGVsdGFFbmQucm93ID8gZGVsdGFDb2xTaGlmdCA6IDApCiAgICAgICAgICAgIH07CiAgICAgICAgfQogICAgICAgIHJldHVybiB7CiAgICAgICAgICAgIHJvdzogZGVsdGFTdGFydC5yb3csCiAgICAgICAgICAgIGNvbHVtbjogZGVsdGFTdGFydC5jb2x1bW4KICAgICAgICB9OwogICAgfQogICAgdGhpcy5zZXRQb3NpdGlvbiA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbiwgbm9DbGlwKSB7CiAgICAgICAgdmFyIHBvczsKICAgICAgICBpZiAobm9DbGlwKSB7CiAgICAgICAgICAgIHBvcyA9IHsKICAgICAgICAgICAgICAgIHJvdzogcm93LAogICAgICAgICAgICAgICAgY29sdW1uOiBjb2x1bW4KICAgICAgICAgICAgfTsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHBvcyA9IHRoaXMuJGNsaXBQb3NpdGlvblRvRG9jdW1lbnQocm93LCBjb2x1bW4pOwogICAgICAgIH0KICAgICAgICBpZiAodGhpcy5yb3cgPT0gcG9zLnJvdyAmJiB0aGlzLmNvbHVtbiA9PSBwb3MuY29sdW1uKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgdmFyIG9sZCA9IHsKICAgICAgICAgICAgcm93OiB0aGlzLnJvdywKICAgICAgICAgICAgY29sdW1uOiB0aGlzLmNvbHVtbgogICAgICAgIH07CiAgICAgICAgdGhpcy5yb3cgPSBwb3Mucm93OwogICAgICAgIHRoaXMuY29sdW1uID0gcG9zLmNvbHVtbjsK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NoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lQ2hhcmFjdGVyID0gZnVuY3Rpb24gKCkgewogICAgICAgIHN3aXRjaCAodGhpcy4kbmV3TGluZU1vZGUpIHsKICAgICAgICAgICAgY2FzZSAid2luZG93cyI6CiAgICAgICAgICAgICAgICByZXR1cm4gIlxyXG4iOwogICAgICAgICAgICBjYXNlICJ1bml4IjoKICAgICAgICAgICAgICAgIHJldHVybiAiXG4iOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuJGF1dG9OZXdMaW5lIHx8ICJcbiI7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuJGF1dG9OZXdMaW5lID0gIiI7CiAgICB0aGlzLiRuZXdMaW5lTW9kZSA9ICJhdXRvIjsKICAgIHRoaXMuc2V0TmV3TGluZU1vZGUgPSBmdW5jdGlvbiAobmV3TGluZU1vZGUpIHsKICAgICAgICBpZiAodGhpcy4kbmV3TGluZU1vZGUgPT09IG5ld0xpbmVNb2RlKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgdGhpcy4kbmV3TGluZU1vZGUgPSBuZXdMaW5lTW9kZTsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lTW9kZSA9IGZ1bmN0aW9uICgpIHsKICAgICAgICByZXR1cm4gdGhpcy4kbmV3TGluZU1vZGU7CiAgICB9OwogICAgdGhpcy5pc05ld0xpbmUgPSBmdW5jdGlvbiAodGV4dCkgewogICAgICAgIHJldHVybiAodGV4dCA9PSAiXHJcbiIgfHwgdGV4dCA9PSAiXHIiIHx8IHRleHQgPT0gIlxuIik7CiAgICB9OwogICAgdGhpcy5nZXRMaW5lID0gZnVuY3Rpb24gKHJvdykgewogICAgICAgIHJldHVybiB0aGlzLiRsaW5lc1tyb3ddIHx8ICIiOwogICAgfTsKICAg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ICB0aGlzLmluc2VydCA9IGZ1bmN0aW9uIChwb3NpdGlvbiwgdGV4dCkgewogICAgICAgIGlmICh0aGlzLmdldExlbmd0aCgpIDw9IDEpCiAgICAgICAgICAgIHRoaXMuJGRldGVjdE5ld0xpbmUodGV4dCk7CiAgICAgICAgcmV0dXJuIHRoaXMuaW5zZXJ0TWVyZ2VkTGluZXMocG9zaXRpb24sIHRoaXMuJHNwbGl0KHRleHQpKTsKICAgIH07CiAgICB0aGlzLmluc2VydEluTGluZSA9IGZ1bmN0aW9uIChwb3NpdGlvbiwgdGV4dCkgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhwb3NpdGlvbi5yb3csIHBvc2l0aW9uLmNvbHVtbik7CiAgICAgICAgdmFyIGVuZCA9IHRoaXMucG9zKHBvc2l0aW9uLnJvdywgcG9zaXRpb24uY29sdW1uICsgdGV4dC5sZW5ndGgpOwogICAgICAgIHRoaXMuYXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCwKICAgICAgICAgICAgZW5kOiBlbmQsCiAgICAgICAgICAgIGFjdGlvbjogImluc2VydCIsCiAgICAgICAgICAgIGxpbmVzOiBbdGV4dF0KICAgICAgICB9LCB0cnVlKTsKICAgICAgICByZXR1cm4gdGhpcy5jbG9uZVBvcyhlbmQpOwogICAgfTsKICAgIHRoaXMuY2xpcHBlZFBvcyA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHZhciBsZW5ndGggPSB0aGlzLmdldExlbmd0aCgpOwogICAgICAgIGlmIChyb3cgPT09IHVuZGVmaW5lZCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGg7CiAgICAgICAgfQogICAgICAgIGVsc2UgaWYgKHJvdyA8IDApIHsKICAgICAgICAgICAgcm93ID0gMDsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAocm93ID49IGxlbmd0aCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGggLSAxOwogICAgICAgICAgICBjb2x1bW4gPSB1bmRlZmluZWQ7CiAgICAgICAgfQogICAgICAgIHZhciBsaW5lID0gdGhpcy5nZXRMaW5lKHJvdyk7CiAgICAgICAgaWYgKGNvbHVtbiA9PSB1bmRlZmluZWQpCiAgICAgICAgICAgIGNvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIGNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KGNvbHVtbiwgMCksIGxpbmUubGVuZ3RoKTsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLmNsb25lUG9zID0gZnVuY3Rpb24gKHBvcykgewogICAgICAgIHJldHVybiB7IHJvdzogcG9zLnJvdywgY29sdW1uOiBwb3MuY29sdW1uIH07CiAgICB9OwogICAgdGhpcy5wb3MgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLiRjbGlwUG9zaXRpb24gPSBmdW5jdGlvbiAocG9zaXRpb24pIHsKICAgICAgICB2YXIgbGVuZ3RoID0gdGhpcy5nZXRMZW5ndGgoKTsKICAgICAgICBpZiAocG9zaXRpb24ucm93ID49IGxlbmd0aCkgewogICAgICAgICAgICBwb3NpdGlvbi5yb3cgPSBNYXRoLm1heCgwLCBsZW5ndGggLSAxKTsKICAgICAgICAgICAgcG9zaXRpb24uY29sdW1uID0gdGhpcy5nZXRMaW5lKGxlbmd0aCAtIDEpLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHBvc2l0aW9uLnJvdyA9IE1hdGgubWF4KDAsIHBvc2l0aW9uLnJvdyk7CiAgICAgICAgICAgIHBvc2l0aW9uLmNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KHBvc2l0aW9uLmNvbHVtbiwgMCksIHRoaXMuZ2V0TGluZShwb3NpdGlvbi5yb3cpLmxlbmd0aCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBwb3NpdGlvbjsKICAgIH07CiAgICB0aGlzLmluc2VydEZ1bGxMaW5lcyA9IGZ1bmN0aW9uIChyb3csIGxpbmVzKSB7CiAgICAgICAgcm93ID0gTWF0aC5taW4oTWF0aC5tYXgocm93LCAwKSwgdGhpcy5nZXRMZW5ndGgoKSk7CiAgICAgICAgdmFyIGNvbHVtbiA9IDA7CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuZ2V0TGVuZ3RoKCkpIHsKICAgICAgICAgICAgbGluZXMgPSBsaW5lcy5jb25jYXQoWyIiXSk7CiAgICAgICAgICAgIGNvbHVtbiA9IDA7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICBsaW5lcyA9IFsiIl0uY29uY2F0KGxpbmVzKTsKICAgICAgICAgICAgcm93LS07CiAgICAgICAgICAgIGNvbHVtbiA9IHRoaXMuJGxpbmVzW3Jvd10ubGVuZ3RoOwogICAgICAgIH0KICAgICAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzKHsgcm93OiByb3csIGNvbHVtbjogY29sdW1uIH0sIGxpbmVzKTsKICAgIH07CiAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzID0gZnVuY3Rpb24gKHBvc2l0aW9uLCBsaW5lcykgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhwb3NpdGlvbi5yb3csIHBvc2l0aW9uLmNvbHVtbik7CiAgICAgICAgdmFyIGVuZCA9IHsKICAgICAgICAgICAgcm93OiBzdGFydC5yb3cgKyBsaW5lcy5sZW5ndGggLSAxLAogICAgICAgICAgICBjb2x1bW46IChsaW5lcy5sZW5ndGggPT0gMSA/IHN0YXJ0LmNvbHVtbiA6IDApICsgbGluZXNbbGluZXMubGVuZ3RoIC0gMV0ubGVuZ3RoCiAgICAgICAgfTsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoewogICAgICAgICAgICBzdGFydDogc3RhcnQsCiAgICAgICAgICAgIGVuZDogZW5kLAogICAgICAgICAgICBhY3Rpb246ICJpbnNlcnQiLAogICAgICAgICAgICBsaW5lczogbGluZXMKICAgICAgICB9KTsKICAgICAgICByZXR1cm4gdGhpcy5jbG9uZVBvcyhlbmQpOwogICAgfTsKICAgIHRoaXMucmVtb3ZlID0gZnVuY3Rpb24gKHJhbmdlKSB7CiAgICAgICAgdmFyIHN0YXJ0ID0gdGhpcy5jbGlwcGVkUG9zKHJhbmdlLnN0YXJ0LnJvdywgcmFuZ2Uuc3RhcnQuY29sdW1uKTsKICAgICAgICB2YXIgZW5kID0gdGhpcy5jbGlwcGVkUG9zKHJhbmdlLmVuZC5yb3csIHJhbmdlLmVuZC5jb2x1bW4pOwogICAgICAgIHRoaXMuYXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCwKICAgICAgICAgICAgZW5kOiBlbmQsCiAgICAgICAgICAgIGFjdGlvbjogInJlbW92ZSIsCiAgICAgICAgICAgIGxpbmVzOiB0aGlzLmdldExpbmVzRm9yUmFuZ2UoeyBzdGFydDogc3RhcnQsIGVuZDogZW5kIH0pCiAgICAgICAgfSk7CiAgICAgICAgcmV0dXJuIHRoaXMuY2xvbmVQb3Moc3RhcnQpOwogICAgfTsKICAgIHRoaXMucmVtb3ZlSW5MaW5lID0gZnVuY3Rpb24gKHJvdywgc3RhcnRDb2x1bW4sIGVuZENvbHVtbikgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhyb3csIHN0YXJ0Q29sdW1uKTsKICAgICAgICB2YXIgZW5kID0gdGhpcy5jbGlwcGVkUG9zKHJvdywgZW5kQ29sdW1uKTsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoewogICAgICAgICAgICBzdGFydDogc3RhcnQsCiAgICAgICAgICAgIGVuZDogZW5kLAogICAgICAgICAgICBhY3Rpb246ICJyZW1vdmUiLAogICAgICAgICAgICBsaW5lczogdGhpcy5n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IDA7IGZyb20gPCBsOyBmcm9tID0gdG8pIHsKICAgICAgICAgICAgdG8gKz0gTUFYIC0gMTsKICAgICAgICAgICAgdmFyIGNodW5rID0gbGluZXMuc2xpY2UoZnJvbSwgdG8pOwogICAgICAgICAgICBjaHVuay5wdXNoKCIiKTsKICAgICAgICAgICAgdGhpcy5hcHBseURlbHRhKHsKICAgICAgICAgICAgICAgIHN0YXJ0OiB0aGlzLnBvcyhyb3cgKyBmcm9tLCBjb2x1bW4pLAogICAgICAgICAgICAgICAgZW5kOiB0aGlzLnBvcyhyb3cgKyB0bywgY29sdW1uID0gMCksCiAgICAgICAgICAgICAgICBhY3Rpb246IGRlbHRhLmFjdGlvbiwKICAgICAgICAgICAgICAgIGxpbmVzOiBjaHVuawogICAgICAgICAgICB9LCB0cnVlKTsKICAgICAgICB9CiAgICAgICAgZGVsdGEubGluZXMgPSBsaW5lcy5zbGljZShmcm9tKTsKICAgICAgICBkZWx0YS5zdGFydC5yb3cgPSByb3cgKyBmcm9tOwogICAgICAgIGRlbHRhLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoZGVsdGEsIHRydWUpOwogICAgfTsKICAgIHRoaXMucmV2ZXJ0RGVsdGEgPSBmdW5jdGlvbiAoZGVsdGEpIHsKICAgICAgICB0aGlzLiRzYWZlQXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiB0aGlzLmNsb25lUG9zKGRlbHRhLnN0YXJ0KSwKICAgICAgICAgICAgZW5kOiB0aGlzLmNsb25lUG9zKGRlbHRhLmVuZCksCiAgICAgICAgICAgIGFjdGlvbjogKGRlbHRhLmFjdGlvbiA9PSAiaW5zZXJ0IiA/ICJyZW1vdmUiIDogImluc2VydCIpLAogICAgICAgICAgICBsaW5lczogZGVsdGEubGluZXMuc2xpY2UoKQogICAgICAgIH0pOwogICAgfTsKICAgIHRoaXMuaW5kZXhUb1Bvc2l0aW9uID0gZnVuY3Rpb24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5T2JqZWN0ID0gZnVuY3Rpb24gKG9iaikgewogICAgdmFyIGNvcHkgPSB7fTsKICAgIGZvciAodmFyIGtleSBpbiBvYmopIHsKICAgICAgICBjb3B5W2tleV0gPSBvYmpba2V5XTsKICAgIH0KICAgIHJldHVybiBjb3B5Owp9OwpleHBvcnRzLmNvcHlBcnJheSA9IGZ1bmN0aW9uIChhcnJheSkgewogICAgdmFyIGNvcHkgPSBbXTsKICAgIGZvciAodmFyIGkgPSAwLCBsID0gYXJyYXkubGVuZ3RoOyBpIDwgbDsgaSsrKSB7CiAgICAgICAgaWYgKGFycmF5W2ldICYmIHR5cGVvZiBhcnJheVtpXSA9PSAib2JqZWN0IikKICAgICAgICAgICAgY29weVtpXSA9IHRoaXMuY29weU9iamVjdChhcnJheVtpXSk7CiAgICAgICAgZWxzZQogICAgICAgICAgICBjb3B5W2ldID0gYXJyYXlbaV07CiAgICB9CiAgICByZXR1cm4gY29weTsKfTsKZXhwb3J0cy5kZWVwQ29weSA9IGZ1bmN0aW9uIGRlZXBDb3B5KG9iaikgewogICAgaWYgKHR5cGVvZiBvYmogIT09ICJvYmplY3QiIHx8ICFvYmopCiAgICAgICAgcmV0dXJuIG9iajsKICAgIHZhciBjb3B5OwogICAgaWYgKEFycmF5LmlzQXJyYXkob2JqKSkgewogICAgICAgIGNvcHkgPSBbXTsKICAgICAgICBmb3IgKHZhciBrZXkgPSAwOyBrZXkgPCBvYmoubGVuZ3RoOyBrZXkrKykgewogICAgICAgICAgICBjb3B5W2tleV0gPSBkZWVwQ29weShvYmpba2V5XSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBjb3B5OwogICAgfQogICAgaWYgKE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChvYmopICE9PSAiW29iamVjdCBPYmplY3RdIikKICAgICAgICByZXR1cm4gb2JqOwogICAgY29weSA9IHt9OwogICAgZm9yICh2YXIga2V5IGluIG9iaikKICAgICAgICBjb3B5W2tleV0gPSBkZWVwQ29weShv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p2YXIgRG9jdW1lbnQgPSByZXF1aXJlKCIuLi9kb2N1bWVudCIpLkRvY3VtZW50Owp2YXIgbGFuZyA9IHJlcXVpcmUoIi4uL2xpYi9sYW5nIik7CiAgICAKdmFyIE1pcnJvciA9IGV4cG9ydHMuTWlycm9yID0gZnVuY3Rpb24oc2VuZGVyKSB7CiAgICB0aGlzLnNlbmRlciA9IHNlbmRlcjsKICAgIHZhciBkb2MgPSB0aGlzLmRvYyA9IG5ldyBEb2N1bWVudCgiIik7CiAgICAKICAgIHZhciBkZWZlcnJlZFVwZGF0ZSA9IHRoaXMuZGVmZXJyZWRVcGRhdGUgPSBsYW5nLmRlbGF5ZWRDYWxsKHRoaXMub25VcGRhdGUuYmluZCh0aGlzKSk7CiAgICAKICAgIHZhciBfc2VsZiA9IHRoaXM7CiAgICBzZW5kZXIub24oImNoYW5nZSIsIGZ1bmN0aW9uKGUpIHsKICAgICAgICB2YXIgZGF0YSA9IGUuZGF0YTsKICAgICAgICBpZiAoZGF0YVswXS5zdGFydCkgewogICAgICAgICAgICBkb2MuYXBwbHlEZWx0YXMoZGF0YSk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBkYXRhLmxlbmd0aDsgaSArPSAyKSB7CiAgICAgICAgICAgICAgICB2YXIgZCwgZXJyOyAKICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGRhdGFbaSsxXSkpIHsKICAgICAgICAgICAgICAgICAgICBkID0ge2FjdGlvbjogImluc2VydCIsIHN0YXJ0OiBkYXRhW2ldLCBsaW5lczogZGF0YVtpKzFdfTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgZCA9IHthY3Rpb246ICJyZW1vdmUiLCBzdGFydDogZGF0YVtpXSwgZW5kOiBkYXRhW2krMV19OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBpZiAoKGQuYWN0aW9uID09ICJpbnNlcnQiID8gZC5zdGFydCA6IGQuZW5kKS5yb3cgPj0gZG9jLiRsaW5lcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICBlcnIgPSBuZXcgRXJyb3IoIkludmFsaWQgZGVsdGEiKTsKICAgICAgICAgICAgICAgICAgICBlcnIuZGF0YSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogX3NlbGYuJHBhdGgsCiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzTGVuZ3RoOiBkb2MuJGxpbmVzLmxlbmd0aCwKICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQ6IGQuc3RhcnQsCiAgICAgICAgICAgICAgICAgICAgICAgIGVuZDogZC5lbmQKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHRocm93IGVycjsKICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICBkb2MuYXBwbHlEZWx0YShkLCB0cnVlKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoX3NlbGYuJHRpbWVvdXQpCiAgICAgICAgICAgIHJldHVybiBkZWZlcnJlZFVwZGF0ZS5zY2hlZHVsZShfc2VsZi4kdGltZW91dCk7CiAgICAgICAgX3NlbGYub25VcGRhdGUoKTsKICAgIH0pOwp9OwoKKGZ1bmN0aW9uKCkgewogICAgCiAgICB0aGlzLiR0aW1lb3V0ID0gNTAwOwogICAgCiAgICB0aGlzLnNldFRpbWVvdXQgPSBmdW5jdGlvbih0aW1lb3V0KSB7CiAgICAgICAgdGhpcy4kdGltZW91dCA9IHRpbWVvdXQ7CiAgICB9OwogICAgCiAgICB0aGlzLnNldFZhbHVlID0gZnVuY3Rpb24odmFsdWUpIHsKICAgICAgICB0aGlzLmRvYy5zZXRWYWx1ZSh2YWx1ZSk7CiAgICAgICAgdGhpcy5kZWZlcnJlZFVwZGF0ZS5zY2hlZHVsZSh0aGlzLiR0aW1lb3V0KTsKICAgIH07CiAgICAKICAgIHRoaXMuZ2V0VmFsdWUgPSBmdW5jdGlvbihjYWxsYmFja0lkKSB7CiAgICAgICAgdGhpcy5zZW5kZXIuY2FsbGJhY2sodGhpcy5kb2MuZ2V0VmFsdWUoKSwgY2FsbGJhY2tJZCk7CiAgICB9OwogICAgCiAgICB0aGlzLm9uVXBkYXRlID0gZnVuY3Rpb24oKSB7CiAgICB9OwogICAgCiAgICB0aGlzLmlzUGVuZGluZyA9IGZ1bmN0aW9uKCkgewogICAgICAgIHJldHVybiB0aGlzLmRlZmVycmVkVXBkYXRlLmlzUGVuZGluZygpOwogICAgfTsKICAgIAp9KS5jYWxsKE1pcnJvci5wcm90b3R5cGUpOwoKfSk7CgphY2UuZGVmaW5lKCJhY2UvbW9kZS9qc29uL2pzb25fcGFyc2UiLFtdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpIHsKInVzZSBzdHJpY3QiOwoKICAgIHZhciBhdCwgICAgIC8vIFRoZSBpbmRleCBvZiB0aGUgY3VycmVudCBjaGFyYWN0ZXIKICAgICAgICBjaCwgICAgIC8vIFRoZSBjdXJyZW50IGNoYXJhY3RlcgogICAgICAgIGVzY2FwZWUgPSB7CiAgICAgICAgICAgICciJzogICciJywKICAgICAgICAgICAgJ1xcJzogJ1xcJywKICAgICAgICAgICAgJy8nOiAgJy8nLAogICAgICAgICAgICBiOiAgICAnXGInLAogICAgICAgICAgICBmOiAgICAnXGYnLAogICAgICAgICAgICBuOiAgICAnXG4nLAogICAgICAgICAgICByOiAgICAnXHInLAogICAgICAgICAgICB0OiAgICAnXHQnCiAgICAgICAgfSwKICAgICAgICB0ZXh0LAoKICAgICAgICBlcnJvciA9IGZ1bmN0aW9uIChtKSB7CgogICAgICAgICAgICB0aHJvdyB7CiAgICAgICAgICAgICAgICBuYW1lOiAgICAnU3ludGF4RXJyb3InLAogICAgICAgICAgICAgICAgbWVzc2FnZTogbSwKICAgICAgICAgICAgICAgIGF0OiAgICAgIGF0LAogICAgICAgICAgICAgICAgdGV4dDogICAgdGV4dAogICAgICAgICAgICB9OwogICAgICAgIH0sCgogICAgICAgIG5leHQgPSBmdW5jdGlvbiAoYykgewoKICAgICAgICAgICAgaWYgKGMgJiYgYyAhPT0gY2gpIHsKICAgICAgICAgICAgICAgIGVycm9yKCJFeHBlY3RlZCAnIiArIGMgKyAiJyBpbnN0ZWFkIG9mICciICsgY2ggKyAiJyIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBjaCA9IHRleHQuY2hhckF0KGF0KTsKICAgICAgICAgICAgYXQgKz0gMTsKICAgICAgICAgICAgcmV0dXJuIGNoOwogICAgICAgIH0sCgogICAgICAgIG51bWJlciA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHZhciBudW1iZXIsCiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnJzsKCiAgICAgICAgICAgIGlmIChjaCA9PT0gJy0nKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnLSc7CiAgICAgICAgICAgICAgICBuZXh0KCctJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgd2hpbGUgKGNoID49ICcwJyAmJiBjaCA8PSAnOScpIHsKICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICcuJykgewogICAgICAgICAgICAgICAgc3RyaW5nICs9ICcuJzsKICAgICAgICAgICAgICAgIHdoaWxlIChuZXh0KCkgJiYgY2ggPj0gJzAnICYmIGNoIDw9ICc5JykgewogICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICdlJyB8fCBjaCA9PT0gJ0UnKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgKz0gY2g7CiAgICAgICAgICAgICAgICBuZXh0KCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICctJyB8fCBjaCA9PT0gJysnKSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHdoaWxlIChjaCA+PSAnMCcgJiYgY2ggPD0gJzknKSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBudW1iZXIgPSArc3RyaW5nOwogICAgICAgICAgICBpZiAoaXNOYU4obnVtYmVyKSkgewogICAgICAgICAgICAgICAgZXJyb3IoIkJhZCBudW1iZXIiKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHJldHVybiBudW1iZXI7CiAgICAgICAgICAgIH0KICAgICAgICB9LAoKICAgICAgICBzdHJpbmcgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICB2YXIgaGV4LAogICAgICAgICAgICAgICAgaSwKICAgICAgICAgICAgICAgIHN0cmluZyA9ICcnLAogICAgICAgICAgICAgICAgdWZmZmY7CgogICAgICAgICAgICBpZiAoY2ggPT09ICciJykgewogICAgICAgICAgICAgICAgd2hpbGUgKG5leHQoKSkgewogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJyInKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0cmluZzsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAnXFwnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoID09PSAndScpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVmZmZmID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCA0OyBpICs9IDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXggPSBwYXJzZUludChuZXh0KCksIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzRmluaXRlKGhleCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVmZmZmID0gdWZmZmYgKiAxNiArIGhleDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKHVmZmZmKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgZXNjYXBlZVtjaF0gPT09ICdzdHJpbmcnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgKz0gZXNjYXBlZVtjaF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT0gIlxuIiB8fCBjaCA9PSAiXHIiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXJyb3IoIkJhZCBzdHJpbmciKTsKICAgICAgICB9LAoKICAgICAgICB3aGl0ZSA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHdoaWxlIChjaCAmJiBjaCA8PSAnICcpIHsKICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgfQogICAgICAgIH0sCgogICAgICAgIHdvcmQgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICBzd2l0Y2ggKGNoKSB7CiAgICAgICAgICAgIGNhc2UgJ3QnOgogICAgICAgICAgICAgICAgbmV4dCgndCcpOwogICAgICAgICAgICAgICAgbmV4dCgncicpOwogICAgICAgICAgICAgICAgbmV4dCgndScpOwogICAgICAgICAgICAgICAgbmV4dCgnZScpOwogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIGNhc2UgJ2YnOgogICAgICAgICAgICAgICAgbmV4dCgnZicpOwogICAgICAgICAgICAgICAgbmV4dCgnYScpOwogICAgICAgICAgICAgICAgbmV4dCgnbCcpOwogICAgICAgICAgICAgICAgbmV4dCgncycpOwogICAgICAgICAgICAgICAgbmV4dCgnZScpOwogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICBjYXNlICduJzoKICAgICAgICAgICAgICAgIG5leHQoJ24nKTsKICAgICAgICAgICAgICAgIG5leHQoJ3UnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2wnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2wnKTsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVycm9yKCJVbmV4cGVjdGVkICciICsgY2ggKyAiJyIpOwogICAgICAgIH0sCgogICAgICAgIHZhbHVlLCAgLy8gUGxhY2UgaG9sZGVyIGZvciB0aGUgdmFsdWUgZnVuY3Rpb24uCgogICAgICAgIGFycmF5ID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgdmFyIGFycmF5ID0gW107CgogICAgICAgICAgICBpZiAoY2ggPT09ICdbJykgewogICAgICAgICAgICAgICAgbmV4dCgnWycpOwogICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnXScpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhcnJheTsgICAvLyBlbXB0eSBhcnJheQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGNoKSB7CiAgICAgICAgICAgICAgICAgICAgYXJyYXkucHVzaCh2YWx1ZSgpKTsKICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoJ10nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFycmF5OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBuZXh0KCcsJyk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBlcnJvcigiQmFkIGFycmF5Iik7CiAgICAgICAgfSwKCiAgICAgICAgb2JqZWN0ID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgdmFyIGtleSwKICAgICAgICAgICAgICAgIG9iamVjdCA9IHt9OwoKICAgICAgICAgICAgaWYgKGNoID09PSAneycpIHsKICAgICAgICAgICAgICAgIG5leHQoJ3snKTsKICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICd9JykgewogICAgICAgICAgICAgICAgICAgIG5leHQoJ30nKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gb2JqZWN0OyAgIC8vIGVtcHR5IG9iamVjdAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGNoKSB7CiAgICAgICAgICAgICAgICAgICAga2V5ID0gc3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgICAgICBuZXh0KCc6Jyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iamVjdCwga2V5KSkgewogICAgICAgICAgICAgICAgICAgICAgICBlcnJvcignRHVwbGljYXRlIGtleSAiJyArIGtleSArICciJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIG9iamVjdFtrZXldID0gdmFsdWUoKTsKICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ30nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoJ30nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9iamVjdDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnLCcpOwogICAgICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXJyb3IoIkJhZCBvYmplY3QiKTsKICAgICAgICB9OwoKICAgIHZhbHVlID0gZnVuY3Rpb24gKCkgewoKICAgICAgICB3aGl0ZSgpOwogICAgICAgIHN3aXRjaCAoY2gpIHsKICAgICAgICBjYXNlICd7JzoKICAgICAgICAgICAgcmV0dXJuIG9iamVjdCgpOwogICAgICAgIGNhc2UgJ1snOgogICAgICAgICAgICByZXR1cm4gYXJyYXkoKTsKICAgICAgICBjYXNlICciJzoKICAgICAgICAgICAgcmV0dXJuIHN0cmluZygpOwogICAgICAgIGNhc2UgJy0nOgogICAgICAgICAgICByZXR1cm4gbnVtYmVyKCk7CiAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgcmV0dXJuIGNoID49ICcwJyAmJiBjaCA8PSAnOScgPyBudW1iZXIoKSA6IHdvcmQoKTsKICAgICAgICB9CiAgICB9OwoKICAgIHJldHVybiBmdW5jdGlvbiAoc291cmNlLCByZXZpdmVyKSB7CiAgICAgICAgdmFyIHJlc3VsdDsKCiAgICAgICAgdGV4dCA9IHNvdXJjZTsKICAgICAgICBhdCA9IDA7CiAgICAgICAgY2ggPSAnICc7CiAgICAgICAgcmVzdWx0ID0gdmFsdWUoKTsKICAgICAgICB3aGl0ZSgpOwogICAgICAgIGlmIChjaCkgewogICAgICAgICAgICBlcnJvcigiU3ludGF4IGVycm9yIik7CiAgICAgICAgfQoKICAgICAgICByZXR1cm4gdHlwZW9mIHJldml2ZXIgPT09ICdmdW5jdGlvbicgPyBmdW5jdGlvbiB3YWxrKGhvbGRlciwga2V5KSB7CiAgICAgICAgICAgIHZhciBrLCB2LCB2YWx1ZSA9IGhvbGRlcltrZXldOwogICAgICAgICAgICBpZiAodmFsdWUgJiYgdHlwZW9mIHZhbHVlID09PSAnb2JqZWN0JykgewogICAgICAgICAgICAgICAgZm9yIChrIGluIHZhbHVlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKHZhbHVlLCBrKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2ID0gd2Fsayh2YWx1ZSwgayk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2ICE9PSB1bmRlZmluZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlW2tdID0gdjsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB2YWx1ZVtrXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gcmV2aXZlci5jYWxsKGhvbGRlciwga2V5LCB2YWx1ZSk7CiAgICAgICAgfSh7Jyc6IHJlc3VsdH0sICcnKSA6IHJlc3VsdDsKICAgIH07Cn0pOwoKYWNlLmRlZmluZSgiYWNlL21vZGUvanNvbl93b3JrZXIiLFtdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpIHsKInVzZSBzdHJpY3QiOwoKdmFyIG9vcCA9IHJlcXVpcmUoIi4uL2xpYi9vb3AiKTsKdmFyIE1pcnJvciA9IHJlcXVpcmUoIi4uL3dvcmtlci9taXJyb3IiKS5NaXJyb3I7CnZhciBwYXJzZSA9IHJlcXVpcmUoIi4vanNvbi9qc29uX3BhcnNlIik7Cgp2YXIgSnNvbldvcmtlciA9IGV4cG9ydHMuSnNvbldvcmtlciA9IGZ1bmN0aW9uKHNlbmRlcikgewogICAgTWlycm9yLmNhbGwodGhpcywgc2VuZGVyKTsKICAgIHRoaXMuc2V0VGltZW91dCgyMDApOwp9OwoKb29wLmluaGVyaXRzKEpzb25Xb3JrZXIsIE1pcnJvcik7CgooZnVuY3Rpb24oKSB7CgogICAgdGhpcy5vblVwZGF0ZSA9IGZ1bmN0aW9uKCkgewogICAgICAgIHZhciB2YWx1ZSA9IHRoaXMuZG9jLmdldFZhbHVlKCk7CiAgICAgICAgdmFyIGVycm9ycyA9IFtdOwogICAgICAgIHRyeSB7CiAgICAgICAgICAgIGlmICh2YWx1ZSkKICAgICAgICAgICAgICAgIHBhcnNlKHZhbHVlKTsKICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgIHZhciBwb3MgPSB0aGlzLmRvYy5pbmRleFRvUG9zaXRpb24oZS5hdC0xKTsKICAgICAgICAgICAgZXJyb3JzLnB1c2goewogICAgICAgICAgICAgICAgcm93OiBwb3Mucm93LAogICAgICAgICAgICAgICAgY29sdW1uOiBwb3MuY29sdW1uLAogICAgICAgICAgICAgICAgdGV4dDogZS5tZXNzYWdlLAogICAgICAgICAgICAgICAgdHlwZTogImVycm9yIgogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgdGhpcy5zZW5kZXIuZW1pdCgiYW5ub3RhdGUiLCBlcnJvcnMpOwogICAgfTsKCn0pLmNhbGwoSnNvbldvcmtlci5wcm90b3R5cGUpOwoKfSk7Cg==";ace.config.setModuleUrl("ace/theme/kr_theme",themeUrl2),ace.config.setModuleUrl("ace/mode/json",modeJsonUrl),ace.config.setModuleUrl("ace/mode/json_worker",workerJsonUrl);const _sfc_main$x=vue.defineComponent({__name:"code-edit-modal",props:{modelValue:{default:()=>({})},lang:{default:"json"},title:{default:"编辑"}},emits:["update:modelValue","close"],setup(i,{emit:r}){const n=i,o=vue.ref(!1),a=r,u=vue.computed({get(){return n.lang==="json"?JSON.stringify(n.modelValue,null,2):n.modelValue},set(c){n.lang==="json"?a("update:modelValue",JSON.parse(c)):a("update:modelValue",c)}});return(c,d)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElButton),{onClick:d[0]||(d[0]=f=>o.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("···")]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDialog),{class:"modal-full",modelValue:vue.unref(o),"onUpdate:modelValue":d[2]||(d[2]=f=>vue.isRef(o)?o.value=f:null),title:n.title,width:"60%",onClose:d[3]||(d[3]=f=>a("close"))},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(VAceEditor),{value:vue.unref(u),"onUpdate:value":d[1]||(d[1]=f=>vue.isRef(u)?u.value=f:null),lang:n.lang,theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value","lang"])]),_:1},8,["modelValue","title"])]))}}),_hoisted_1$7={class:"one-row-txt",style:{width:"78px"}},_hoisted_2$5={key:1},_hoisted_3$4={class:"one-row-txt",style:{width:"145px"}},_hoisted_4$2={key:1},_sfc_main$w=vue.defineComponent({__name:"dynamic-el-form-item",props:{objInfo:{default:()=>({})},hide:{default:()=>[]},code:{type:Boolean,default:!1}},emits:["change"],setup(i,{emit:r}){const n=r,o=i,a=vue.computed(()=>{var h;const c={};let d=0,f=[];for(let y of Object.keys(o.objInfo)){const g=(h=o.objInfo[y])==null?void 0:h.sort;if(g){const p=Number(g);p>d&&(d=p)}if(g)c[g]=y;else return Object.keys(o.objInfo).map(p=>({...o.objInfo[p],_key:p}))}for(let y=0;y<d+1;y++){const g=String(y);f.push({...o.objInfo[c[g]],_key:c[g]})}return f});function u(c){let d=window.setTimeout(function(){n("change",c),clearTimeout(d),d=null},200)}return(c,d)=>(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(a),f=>(vue.openBlock(),vue.createElementBlock("div",{key:f._key},[o.code?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,class:"props-row",size:"small"},{label:vue.withCtx(()=>[vue.unref(getStringWidth)(String(f._key))>78?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:String(f._key),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$7,vue.toDisplayString(f._key),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$5,vue.toDisplayString(f._key),1))]),default:vue.withCtx(()=>[vue.unref(getStringWidth)(String(f.val))>145?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:JSON.stringify(f.val),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$4,vue.toDisplayString(f.val),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$2,vue.toDisplayString(f.val),1))]),_:2},1024)):vue.createCommentVNode("",!0),o.hide.indexOf(String(f._key))<0?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:1,label:f.title,size:"small"},{default:vue.withCtx(()=>[f.type===vue.unref(EConfigItemPropsType).Select?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSelect),{key:0,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,placeholder:"Select",size:"small",disabled:!!(f!=null&&f.disabled),onChange:u},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(f.options,h=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).InputNumber?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInputNumber),{key:1,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Input?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:2,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Textarea?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:3,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,autosize:"",type:"textarea",disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Color?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElColorPicker),{key:4,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Switch?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSwitch),{key:5,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).JsonEdit?(vue.openBlock(),vue.createBlock(_sfc_main$x,{key:6,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onClose:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):vue.createCommentVNode("",!0)]),_:2},1032,["label"])):vue.createCommentVNode("",!0)]))),128))}}),dynamicElFormItem_vue_vue_type_style_index_0_scoped_b2819020_lang="",dynamicElFormItem_vue_vue_type_style_index_1_lang="",DynamicElFormItem=_export_sfc$1(_sfc_main$w,[["__scopeId","data-v-b2819020"]]),_hoisted_1$6={style:{height:"100%"}},_hoisted_2$4={class:"flex flex-wrap"},_hoisted_3$3=["onMouseenter","onClick"],_sfc_main$v=vue.defineComponent({__name:"common-animate",props:{val:{}},emits:["updateCommonAniVal"],setup(i,{emit:r}){const n=i,o=r,a=vue.ref(n.val),u=vue.ref(!1),c=vue.ref("进入"),d=vue.ref(null),f=h=>{o("updateCommonAniVal",h),u.value=!1};return vue.watch(()=>n.val,h=>{a.value=h}),(h,y)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$6,[vue.unref(a)?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:0,closable:"",onClose:y[0]||(y[0]=g=>f("")),onClick:y[1]||(y[1]=g=>u.value=!0),style:{cursor:"pointer"}},{default:vue.withCtx(()=>{var g;return[vue.createTextVNode(vue.toDisplayString((g=vue.unref(common_animate_list).map(p=>p.children).reduce((p,v)=>p.concat(v)).find(p=>p.value==vue.unref(a)))==null?void 0:g.label)+" ",1),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:10},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"setting"})]),_:1})]}),_:1})):(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:1,type:"success",style:{cursor:"pointer"},onClick:y[2]||(y[2]=g=>u.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("新增")]),_:1})),vue.createVNode(vue.unref(elementPlus.ElDrawer),{modelValue:vue.unref(u),"onUpdate:modelValue":y[5]||(y[5]=g=>vue.isRef(u)?u.value=g:null),title:"选择动画",direction:"ltr"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElTabs),{modelValue:vue.unref(c),"onUpdate:modelValue":y[4]||(y[4]=g=>vue.isRef(c)?c.value=g:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(common_animate_list),g=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTabPane),{label:g.label,name:g.label,key:g.label},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{height:"500px"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_2$4,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(g.children,(p,v)=>(vue.openBlock(),vue.createElementBlock("div",{class:"animate",key:v,onMouseenter:_=>d.value=v,onMouseleave:y[3]||(y[3]=_=>d.value=null),onClick:_=>f(p.value)},[vue.createElementVNode("div",{class:vue.normalizeClass(`${vue.unref(d)==v?`animate__animated animate__${p.value} animate__slow animate__infinite`:""}`)},vue.toDisplayString(p.label),3)],40,_hoisted_3$3))),128))])]),_:2},1024)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]))}}),commonAnimate_vue_vue_type_style_index_0_scoped_2668f60c_lang="",CommonAnimate=_export_sfc$1(_sfc_main$v,[["__scopeId","data-v-2668f60c"]]),_sfc_main$u=vue.defineComponent({__name:"component-tree",setup(i){const r=useGlobalStore(pinia),n=vue.computed(()=>{var u;return((u=r.handle_svg_info)==null?void 0:u.info.id)??""}),o=u=>{for(let c of r.done_json)c.selected=!1,c.old_position={x:0,y:0};r.intention=EGlobalStoreIntention.Select,r.setHandleSvgInfo(u)},a={children:"children",label:"title"};return(u,c)=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTree),{class:"tree-v",data:vue.unref(r).done_json,props:a,onNodeClick:o,"default-expand-all":!0,"expand-on-click-node":!1,"highlight-current":!!vue.unref(n),"node-key":"id","current-node-key":vue.unref(n)},null,8,["data","highlight-current","current-node-key"]))}}),_withScopeId$1=i=>(vue.pushScopeId("data-v-98320511"),i=i(),vue.popScopeId(),i),_hoisted_1$5={class:"wall-l"},_hoisted_2$3={class:"head-l"},_hoisted_3$2=_withScopeId$1(()=>vue.createElementVNode("span",null,"key",-1)),_hoisted_4$1=_withScopeId$1(()=>vue.createElementVNode("span",null,"value",-1)),_hoisted_5$1={class:"row-l"},_sfc_main$t=vue.defineComponent({__name:"list",props:{modelValue:{default:()=>[{key:"",val:""}]}},emits:["update:modelValue"],setup(i,{emit:r}){const n=i,o=r,a=vue.computed({get(){return n.modelValue},set(d){o("update:modelValue",d)}}),u=()=>{a.value.push({key:"",val:""})},c=d=>{a.value.splice(d,1)};return(d,f)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$5,[vue.createElementVNode("div",_hoisted_2$3,[_hoisted_3$2,_hoisted_4$1,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:u},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"add"})]),_:1})]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(a),(h,y)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,[vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:h.key,"onUpdate:modelValue":g=>h.key=g,size:"small",placeholder:"key"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:h.val,"onUpdate:modelValue":g=>h.val=g,size:"small",placeholder:"value"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:g=>c(y)},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"delete"})]),_:2},1032,["onClick"])]))),256))]))}}),list_vue_vue_type_style_index_0_scoped_98320511_lang="",List=_export_sfc$1(_sfc_main$t,[["__scopeId","data-v-98320511"]]),composeEventHandlers=(i,r,{checkForDefaultPrevented:n=!0}={})=>a=>{const u=i==null?void 0:i(a);if(n===!1||!u)return r==null?void 0:r(a)};var _a;const isClient=typeof window<"u",isString$1=i=>typeof i=="string",noop=()=>{},isIOS=isClient&&((_a=window==null?void 0:window.navigator)==null?void 0:_a.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function resolveUnref(i){return typeof i=="function"?i():vue.unref(i)}function createFilterWrapper(i,r){function n(...o){return new Promise((a,u)=>{Promise.resolve(i(()=>r.apply(this,o),{fn:r,thisArg:this,args:o})).then(a).catch(u)})}return n}function debounceFilter(i,r={}){let n,o,a=noop;const u=d=>{clearTimeout(d),a(),a=noop};return d=>{const f=resolveUnref(i),h=resolveUnref(r.maxWait);return n&&u(n),f<=0||h!==void 0&&h<=0?(o&&(u(o),o=null),Promise.resolve(d())):new Promise((y,g)=>{a=r.rejectOnCancel?g:y,h&&!o&&(o=setTimeout(()=>{n&&u(n),o=null,y(d())},h)),n=setTimeout(()=>{o&&u(o),o=null,y(d())},f)})}}function identity(i){return i}function tryOnScopeDispose(i){return vue.getCurrentScope()?(vue.onScopeDispose(i),!0):!1}function useDebounceFn(i,r=200,n={}){return createFilterWrapper(debounceFilter(r,n),i)}function refDebounced(i,r=200,n={}){const o=vue.ref(i.value),a=useDebounceFn(()=>{o.value=i.value},r,n);return vue.watch(i,()=>a()),o}function tryOnMounted(i,r=!0){vue.getCurrentInstance()?vue.onMounted(i):r?i():vue.nextTick(i)}function unrefElement(i){var r;const n=resolveUnref(i);return(r=n==null?void 0:n.$el)!=null?r:n}const defaultWindow=isClient?window:void 0;function useEventListener(...i){let r,n,o,a;if(isString$1(i[0])||Array.isArray(i[0])?([n,o,a]=i,r=defaultWindow):[r,n,o,a]=i,!r)return noop;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const u=[],c=()=>{u.forEach(y=>y()),u.length=0},d=(y,g,p,v)=>(y.addEventListener(g,p,v),()=>y.removeEventListener(g,p,v)),f=vue.watch(()=>[unrefElement(r),resolveUnref(a)],([y,g])=>{c(),y&&u.push(...n.flatMap(p=>o.map(v=>d(y,p,v,g))))},{immediate:!0,flush:"post"}),h=()=>{f(),c()};return tryOnScopeDispose(h),h}let _iOSWorkaround=!1;function onClickOutside(i,r,n={}){const{window:o=defaultWindow,ignore:a=[],capture:u=!0,detectIframe:c=!1}=n;if(!o)return;isIOS&&!_iOSWorkaround&&(_iOSWorkaround=!0,Array.from(o.document.body.children).forEach(p=>p.addEventListener("click",noop)));let d=!0;const f=p=>a.some(v=>{if(typeof v=="string")return Array.from(o.document.querySelectorAll(v)).some(_=>_===p.target||p.composedPath().includes(_));{const _=unrefElement(v);return _&&(p.target===_||p.composedPath().includes(_))}}),y=[useEventListener(o,"click",p=>{const v=unrefElement(i);if(!(!v||v===p.target||p.composedPath().includes(v))){if(p.detail===0&&(d=!f(p)),!d){d=!0;return}r(p)}},{passive:!0,capture:u}),useEventListener(o,"pointerdown",p=>{const v=unrefElement(i);v&&(d=!p.composedPath().includes(v)&&!f(p))},{passive:!0}),c&&useEventListener(o,"blur",p=>{var v;const _=unrefElement(i);((v=o.document.activeElement)==null?void 0:v.tagName)==="IFRAME"&&!(_!=null&&_.contains(o.document.activeElement))&&r(p)})].filter(Boolean);return()=>y.forEach(p=>p())}function useSupported(i,r=!1){const n=vue.ref(),o=()=>n.value=!!i();return o(),tryOnMounted(o,r),n}const _global=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},globalKey="__vueuse_ssr_handlers__";_global[globalKey]=_global[globalKey]||{};var __getOwnPropSymbols$g=Object.getOwnPropertySymbols,__hasOwnProp$g=Object.prototype.hasOwnProperty,__propIsEnum$g=Object.prototype.propertyIsEnumerable,__objRest$2=(i,r)=>{var n={};for(var o in i)__hasOwnProp$g.call(i,o)&&r.indexOf(o)<0&&(n[o]=i[o]);if(i!=null&&__getOwnPropSymbols$g)for(var o of __getOwnPropSymbols$g(i))r.indexOf(o)<0&&__propIsEnum$g.call(i,o)&&(n[o]=i[o]);return n};function useResizeObserver(i,r,n={}){const o=n,{window:a=defaultWindow}=o,u=__objRest$2(o,["window"]);let c;const d=useSupported(()=>a&&"ResizeObserver"in a),f=()=>{c&&(c.disconnect(),c=void 0)},h=vue.watch(()=>unrefElement(i),g=>{f(),d.value&&a&&g&&(c=new ResizeObserver(r),c.observe(g,u))},{immediate:!0,flush:"post"}),y=()=>{f(),h()};return tryOnScopeDispose(y),{isSupported:d,stop:y}}var __getOwnPropSymbols$8=Object.getOwnPropertySymbols,__hasOwnProp$8=Object.prototype.hasOwnProperty,__propIsEnum$8=Object.prototype.propertyIsEnumerable,__objRest$1=(i,r)=>{var n={};for(var o in i)__hasOwnProp$8.call(i,o)&&r.indexOf(o)<0&&(n[o]=i[o]);if(i!=null&&__getOwnPropSymbols$8)for(var o of __getOwnPropSymbols$8(i))r.indexOf(o)<0&&__propIsEnum$8.call(i,o)&&(n[o]=i[o]);return n};function useMutationObserver(i,r,n={}){const o=n,{window:a=defaultWindow}=o,u=__objRest$1(o,["window"]);let c;const d=useSupported(()=>a&&"MutationObserver"in a),f=()=>{c&&(c.disconnect(),c=void 0)},h=vue.watch(()=>unrefElement(i),g=>{f(),d.value&&a&&g&&(c=new MutationObserver(r),c.observe(g,u))},{immediate:!0}),y=()=>{f(),h()};return tryOnScopeDispose(y),{isSupported:d,stop:y}}var SwipeDirection;(function(i){i.UP="UP",i.RIGHT="RIGHT",i.DOWN="DOWN",i.LEFT="LEFT",i.NONE="NONE"})(SwipeDirection||(SwipeDirection={}));var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,r,n)=>r in i?__defProp(i,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[r]=n,__spreadValues=(i,r)=>{for(var n in r||(r={}))__hasOwnProp.call(r,n)&&__defNormalProp(i,n,r[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(r))__propIsEnum.call(r,n)&&__defNormalProp(i,n,r[n]);return i};const _TransitionPresets={easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]};__spreadValues({linear:identity},_TransitionPresets);const isFirefox=()=>isClient&&/firefox/i.test(window.navigator.userAgent);/**
244
+ `||h==="")){var y=c.isSelected(h);o.hasOwnProperty(h)?o[h]=o[h]&&y:o[h]=y}})}),i==="allSelect"||i==="inverseSelect"?{selected:o}:{name:r.name,selected:o}}function installLegendAction(i){i.registerAction("legendToggleSelect","legendselectchanged",curry$1(legendSelectActionHandler,"toggleSelected")),i.registerAction("legendAllSelect","legendselectall",curry$1(legendSelectActionHandler,"allSelect")),i.registerAction("legendInverseSelect","legendinverseselect",curry$1(legendSelectActionHandler,"inverseSelect")),i.registerAction("legendSelect","legendselected",curry$1(legendSelectActionHandler,"select")),i.registerAction("legendUnSelect","legendunselected",curry$1(legendSelectActionHandler,"unSelect"))}function install$2(i){i.registerComponentModel(LegendModel$1),i.registerComponentView(LegendView$1),i.registerProcessor(i.PRIORITY.PROCESSOR.SERIES_FILTER,legendFilter),i.registerSubTypeDefaulter("legend",function(){return"plain"}),installLegendAction(i)}var ScrollableLegendModel=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n}return r.prototype.setScrollDataIndex=function(n){this.option.scrollDataIndex=n},r.prototype.init=function(n,o,a){var u=getLayoutParams(n);i.prototype.init.call(this,n,o,a),mergeAndNormalizeLayoutParams(this,n,u)},r.prototype.mergeOption=function(n,o){i.prototype.mergeOption.call(this,n,o),mergeAndNormalizeLayoutParams(this,this.option,n)},r.type="legend.scroll",r.defaultOption=inheritDefaultOption(LegendModel$1.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:"end",pageFormatter:"{current}/{total}",pageIcons:{horizontal:["M0,0L12,-10L12,10z","M0,0L-12,-10L-12,10z"],vertical:["M0,0L20,0L10,-20z","M0,0L20,0L10,20z"]},pageIconColor:"#2f4554",pageIconInactiveColor:"#aaa",pageIconSize:15,pageTextStyle:{color:"#333"},animationDurationUpdate:800}),r}(LegendModel$1);function mergeAndNormalizeLayoutParams(i,r,n){var o=i.getOrient(),a=[1,1];a[o.index]=0,mergeLayoutParam(r,n,{type:"box",ignoreSize:!!a})}const ScrollableLegendModel$1=ScrollableLegendModel;var Group=Group$3,WH=["width","height"],XY=["x","y"],ScrollableLegendView=function(i){__extends(r,i);function r(){var n=i!==null&&i.apply(this,arguments)||this;return n.type=r.type,n.newlineDisabled=!0,n._currentIndex=0,n}return r.prototype.init=function(){i.prototype.init.call(this),this.group.add(this._containerGroup=new Group),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new Group)},r.prototype.resetInner=function(){i.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},r.prototype.renderInner=function(n,o,a,u,c,d,f){var h=this;i.prototype.renderInner.call(this,n,o,a,u,c,d,f);var y=this._controllerGroup,g=o.get("pageIconSize",!0),p=isArray$1(g)?g:[g,g];_("pagePrev",0);var v=o.getModel("pageTextStyle");y.add(new ZRText$1({name:"pageText",style:{text:"xx/xx",fill:v.getTextColor(),font:v.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),_("pageNext",1);function _(b,A){var w=b+"DataIndex",T=createIcon(o.get("pageIcons",!0)[o.getOrient().name][A],{onclick:bind$1(h._pageGo,h,w,o,u)},{x:-p[0]/2,y:-p[1]/2,width:p[0],height:p[1]});T.name=b,y.add(T)}},r.prototype.layoutInner=function(n,o,a,u,c,d){var f=this.getSelectorGroup(),h=n.getOrient().index,y=WH[h],g=XY[h],p=WH[1-h],v=XY[1-h];c&&box("horizontal",f,n.get("selectorItemGap",!0));var _=n.get("selectorButtonGap",!0),b=f.getBoundingRect(),A=[-b.x,-b.y],w=clone$2(a);c&&(w[y]=a[y]-b[y]-_);var T=this._layoutContentAndController(n,u,w,h,y,p,v,g);if(c){if(d==="end")A[h]+=T[y]+_;else{var S=b[y]+_;A[h]-=S,T[g]-=S}T[y]+=b[y]+_,A[1-h]+=T[v]+T[p]/2-b[p]/2,T[p]=Math.max(T[p],b[p]),T[v]=Math.min(T[v],b[v]+A[1-h]),f.x=A[0],f.y=A[1],f.markRedraw()}return T},r.prototype._layoutContentAndController=function(n,o,a,u,c,d,f,h){var y=this.getContentGroup(),g=this._containerGroup,p=this._controllerGroup;box(n.get("orient"),y,n.get("itemGap"),u?a.width:null,u?null:a.height),box("horizontal",p,n.get("pageButtonItemGap",!0));var v=y.getBoundingRect(),_=p.getBoundingRect(),b=this._showController=v[c]>a[c],A=[-v.x,-v.y];o||(A[u]=y[h]);var w=[0,0],T=[-_.x,-_.y],S=retrieve2(n.get("pageButtonGap",!0),n.get("itemGap",!0));if(b){var x=n.get("pageButtonPosition",!0);x==="end"?T[u]+=a[c]-_[c]:w[u]+=_[c]+S}T[1-u]+=v[d]/2-_[d]/2,y.setPosition(A),g.setPosition(w),p.setPosition(T);var L={x:0,y:0};if(L[c]=b?a[c]:v[c],L[d]=Math.max(v[d],_[d]),L[f]=Math.min(0,_[f]+T[1-u]),g.__rectSize=a[c],b){var M={x:0,y:0};M[c]=Math.max(a[c]-_[c]-S,0),M[d]=L[d],g.setClipPath(new Rect$1({shape:M})),g.__rectSize=M[c]}else p.eachChild(function(ie){ie.attr({invisible:!0,silent:!0})});var O=this._getPageInfo(n);return O.pageIndex!=null&&updateProps$1(y,{x:O.contentPosition[0],y:O.contentPosition[1]},b?n:null),this._updatePageInfoView(n,O),L},r.prototype._pageGo=function(n,o,a){var u=this._getPageInfo(o)[n];u!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:u,legendId:o.id})},r.prototype._updatePageInfoView=function(n,o){var a=this._controllerGroup;each$4(["pagePrev","pageNext"],function(y){var g=y+"DataIndex",p=o[g]!=null,v=a.childOfName(y);v&&(v.setStyle("fill",p?n.get("pageIconColor",!0):n.get("pageIconInactiveColor",!0)),v.cursor=p?"pointer":"default")});var u=a.childOfName("pageText"),c=n.get("pageFormatter"),d=o.pageIndex,f=d!=null?d+1:0,h=o.pageCount;u&&c&&u.setStyle("text",isString$2(c)?c.replace("{current}",f==null?"":f+"").replace("{total}",h==null?"":h+""):c({current:f,total:h}))},r.prototype._getPageInfo=function(n){var o=n.get("scrollDataIndex",!0),a=this.getContentGroup(),u=this._containerGroup.__rectSize,c=n.getOrient().index,d=WH[c],f=XY[c],h=this._findTargetItemIndex(o),y=a.children(),g=y[h],p=y.length,v=p?1:0,_={contentPosition:[a.x,a.y],pageCount:v,pageIndex:v-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!g)return _;var b=x(g);_.contentPosition[c]=-b.s;for(var A=h+1,w=b,T=b,S=null;A<=p;++A)S=x(y[A]),(!S&&T.e>w.s+u||S&&!L(S,w.s))&&(T.i>w.i?w=T:w=S,w&&(_.pageNextDataIndex==null&&(_.pageNextDataIndex=w.i),++_.pageCount)),T=S;for(var A=h-1,w=b,T=b,S=null;A>=-1;--A)S=x(y[A]),(!S||!L(T,S.s))&&w.i<T.i&&(T=w,_.pagePrevDataIndex==null&&(_.pagePrevDataIndex=w.i),++_.pageCount,++_.pageIndex),w=S;return _;function x(M){if(M){var O=M.getBoundingRect(),ie=O[f]+M[f];return{s:ie,e:ie+O[d],i:M.__legendDataIndex}}}function L(M,O){return M.e>=O&&M.s<=O+u}},r.prototype._findTargetItemIndex=function(n){if(!this._showController)return 0;var o,a=this.getContentGroup(),u;return a.eachChild(function(c,d){var f=c.__legendDataIndex;u==null&&f!=null&&(u=d),f===n&&(o=d)}),o??u},r.type="legend.scroll",r}(LegendView$1);const ScrollableLegendView$1=ScrollableLegendView;function installScrollableLegendAction(i){i.registerAction("legendScroll","legendscroll",function(r,n){var o=r.scrollDataIndex;o!=null&&n.eachComponent({mainType:"legend",subType:"scroll",query:r},function(a){a.setScrollDataIndex(o)})})}function install$1(i){use(install$2),i.registerComponentModel(ScrollableLegendModel$1),i.registerComponentView(ScrollableLegendView$1),installScrollableLegendAction(i)}function install(i){use(install$2),use(install$1)}const _sfc_main$I=vue.defineComponent({__name:"pie-charts",props:{title:{type:String,default:"标题"},seriesName:{type:String,default:"详情"},seriesData:{type:Array,default:()=>[]}},setup(i){use([install$7,install$6,install$3,install$4,install]),vue.provide(VChart.THEME_KEY,"dark");const r=i,n=vue.reactive({title:{text:r.title,left:"center"},tooltip:{trigger:"item",formatter:"{a} <br/>{b} : {c} ({d}%)"},legend:{orient:"vertical",left:"left"},series:[{name:r.seriesName,type:"pie",radius:"55%",center:["50%","60%"],data:r.seriesData,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]});return vue.watch(r,o=>{n.title.text=o.title,n.series[0].name=o.seriesName,n.series[0].data=o.seriesData}),(o,a)=>(vue.openBlock(),vue.createBlock(vue.unref(VChart),{class:"chart",option:vue.unref(n),autoresize:""},null,8,["option"]))}}),pieCharts_vue_vue_type_style_index_0_scoped_fec2cbf2_lang="",PieCharts=_export_sfc$1(_sfc_main$I,[["__scopeId","data-v-fec2cbf2"]]),_hoisted_1$g=["id"],_hoisted_2$e=["id"],_hoisted_3$b=["fill"],_hoisted_4$9=["fill"],_hoisted_5$8=["fill"],_hoisted_6$7=vue.createElementVNode("path",{d:"M375.466667 709.214815l-25.6 137.481481c0 2.844444 1.896296 5.688889 7.585185 10.42963l65.422222 54.992593c5.688889 4.740741 15.17037 8.533333 23.703704 10.429629l36.029629-193.422222-107.14074-19.911111z",fill:"#2D4375"},null,-1),_hoisted_7$7=vue.createElementVNode("path",{d:"M482.607407 729.125926l-36.029629 193.422222c9.481481 1.896296 18.014815 1.896296 25.6-0.948148l80.592592-27.496296c6.637037-1.896296 10.42963-4.740741 11.377778-6.637037L589.748148 749.037037l-107.140741-19.911111z",fill:"#1E2D4F"},null,-1),_hoisted_8$7=["fill-opacity"],_hoisted_9$6=["fill-opacity"],_hoisted_10$5=["fill-opacity"],_hoisted_11$4=vue.createElementVNode("path",{d:"M593.540741 807.822222c1.896296-7.585185-3.792593-15.17037-11.377778-16.118518l-107.140741-19.911111-4.740741 27.496296 107.140741 19.911111c6.637037 0.948148 14.222222-3.792593 16.118519-11.377778z",fill:"#CEEFF6"},null,-1),_hoisted_12$3=vue.createElementVNode("path",{d:"M366.933333 750.933333c-7.585185-1.896296-15.17037 3.792593-16.118518 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.14074 19.911111 4.740741-27.496297-107.140741-19.911111zM356.503704 808.77037c-7.585185-1.896296-15.17037 3.792593-16.118519 11.377778-1.896296 7.585185 3.792593 15.17037 11.377778 16.118519l107.140741 19.911111 4.74074-27.496297-107.14074-19.911111z",fill:"#FFFFFF"},null,-1),_hoisted_13$3=vue.createElementVNode("path",{d:"M570.785185 848.592593l-107.140741-19.911112-4.74074 27.496297 107.14074 19.911111c7.585185 1.896296 15.17037-3.792593 16.118519-11.377778 1.896296-7.585185-2.844444-15.17037-11.377778-16.118518z",fill:"#CEEFF6"},null,-1),_hoisted_14$3=["xlink:href","width","height"],_sfc_main$H=vue.defineComponent({__name:"light-a",props:{id:{default:""},isOpen:{type:Boolean,default:!1},height:{default:100},width:{default:100}},emits:["onChange"],setup(i,{emit:r}){const n=i,o=r;return vue.watch(()=>n.isOpen,()=>{o("onChange")}),(a,u)=>(vue.openBlock(),vue.createElementBlock("g",{id:n.id,style:{cursor:"pointer"}},[vue.createElementVNode("symbol",{id:`${n.id}light-121`,viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{d:"M565.096296 289.185185s-0.948148 0 0 0c-110.933333-20.859259-208.592593 40.77037-237.985185 148.859259-14.222222 53.096296-24.651852 101.451852 44.562963 221.866667 14.222222 25.6 11.377778 70.162963 8.533333 95.762963-1.896296 14.222222 64.474074 36.02963 89.125926 42.666667l95.762963-509.155556z",fill:n.isOpen?"#FDB813":"#cccccc"},null,8,_hoisted_3$b),vue.createElementVNode("path",{d:"M732.918519 513.896296c11.377778-111.881481-56.888889-203.851852-166.874075-224.711111h-0.948148L469.333333 798.340741c25.6 2.844444 94.814815 6.637037 98.607408-7.585185 6.637037-25.6 20.859259-67.318519 42.666666-86.281482C719.644444 618.192593 727.22963 568.888889 732.918519 513.896296z",fill:n.isOpen?"#FD9B13":"#bbbbbb"},null,8,_hoisted_4$9),vue.createElementVNode("path",{d:"M467.437037 806.874074c-7.585185-0.948148-12.325926-7.585185-14.222222-14.222222l-38.874074-256c-0.948148-5.688889 0.948148-11.377778 4.74074-15.170371 3.792593-3.792593 9.481481-5.688889 15.170371-4.74074l167.822222 31.288889c5.688889 0.948148 10.42963 4.740741 12.325926 9.481481 1.896296 4.740741 1.896296 11.377778-0.948148 16.118519L486.4 798.340741c-3.792593 6.637037-11.377778 10.42963-18.962963 8.533333z m-14.222222-251.259259l27.496296 182.992592L572.681481 578.37037l-119.466666-22.755555z",fill:n.isOpen?"#F12A3F":"#666666"},null,8,_hoisted_5$8),_hoisted_6$7,_hoisted_7$7,vue.createElementVNode("path",{d:"M612.503704 217.125926c-3.792593 18.014815-20.859259 29.392593-38.874074 26.548148-18.014815-3.792593-30.340741-20.859259-26.548149-38.874074l18.962963-100.503704c3.792593-18.014815 20.859259-29.392593 38.874075-26.548148 18.014815 3.792593 30.340741 20.859259 26.548148 38.874074l-18.962963 100.503704z",fill:"#FDB813","fill-opacity":n.isOpen?1:0},null,8,_hoisted_8$7),vue.createElementVNode("path",{d:"M382.103704 228.503704c10.42963 15.17037 6.637037 36.02963-8.533334 46.459259-15.17037 10.42963-36.02963 6.637037-46.459259-8.533333l-57.837037-84.385186c-10.42963-15.17037-6.637037-36.02963 8.533333-46.459259 15.17037-10.42963 36.02963-6.637037 46.45926 8.533334l57.837037 84.385185zM757.57037 298.666667c-15.17037 10.42963-18.962963 31.288889-8.533333 46.459259 10.42963 15.17037 31.288889 18.962963 46.459259 8.533333l84.385185-57.837037c15.17037-10.42963 18.962963-31.288889 8.533334-46.459259-10.42963-15.17037-31.288889-18.962963-46.459259-8.533333l-84.385186 57.837037z",fill:"#FDB813","fill-opacity":n.isOpen?1:0},null,8,_hoisted_9$6),vue.createElementVNode("path",{d:"M252.207407 361.244444c18.014815 3.792593 30.340741 20.859259 26.548149 38.874075-3.792593 18.014815-20.859259 29.392593-38.874075 26.548148l-100.503703-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874074 3.792593-18.014815 20.859259-29.392593 38.874074-26.548149l100.503703 18.962963zM931.081481 488.296296c18.014815 3.792593 30.340741 20.859259 26.548149 38.874074-3.792593 18.014815-20.859259 29.392593-38.874074 26.548149l-100.503704-18.962963c-18.014815-3.792593-30.340741-20.859259-26.548148-38.874075 3.792593-18.014815 20.859259-29.392593 38.874074-26.548148l100.503703 18.962963z",fill:"#FDB813","fill-opacity":n.isOpen?1:0},null,8,_hoisted_10$5),_hoisted_11$4,_hoisted_12$3,_hoisted_13$3],8,_hoisted_2$e),vue.createElementVNode("use",{"xlink:href":`#${n.id}light-121`,width:a.width,height:a.height},null,8,_hoisted_14$3)],8,_hoisted_1$g))}}),_hoisted_1$f=["id"],_hoisted_2$d=["id"],_hoisted_3$a=["fill"],_hoisted_4$8=["fill"],_hoisted_5$7=["fill"],_hoisted_6$6=["from","to"],_hoisted_7$6=["fill"],_hoisted_8$6=["from","to"],_hoisted_9$5=["fill"],_hoisted_10$4=["fill"],_hoisted_11$3=["fill"],_hoisted_12$2=["from","to"],_hoisted_13$2=["fill"],_hoisted_14$2=["xlink:href"],_sfc_main$G=vue.defineComponent({__name:"clock-a",props:{id:{default:""},centerColor:{default:"#EBF257"},secondsColor:{default:"#E83E24"},circleColor:{default:"#F45AFC"},minutesColor:{default:"#50E68E"},hoursColor:{default:"#9A36E7"},scaleColor:{default:"#4942CF"},backgroundColor:{default:"#ffffff"},borderColor:{default:"#B3A7FF"}},setup(i){const r=i,n=new Date(Number(window.sessionStorage.getItem("editorLoadTime")||"0")),o=n.getSeconds()+1,a=n.getMinutes(),u=Math.floor((n.getHours()+(a+o/60)/60)*30);return(c,d)=>(vue.openBlock(),vue.createElementBlock("g",{id:r.id},[vue.createElementVNode("symbol",{id:`${r.id}clock-a-n`,viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{d:"M512.3 518.9m-469.2 0a469.2 469.2 0 1 0 938.4 0 469.2 469.2 0 1 0-938.4 0Z",fill:r.borderColor},null,8,_hoisted_3$a),vue.createElementVNode("path",{d:"M512.3 518.9m-392.5 0a392.5 392.5 0 1 0 785 0 392.5 392.5 0 1 0-785 0Z",fill:r.backgroundColor},null,8,_hoisted_4$8),vue.createElementVNode("path",{d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1L318.3 337.1c-6.8-6.8-6.8-17.9 0-24.8 6.8-6.8 17.9-6.8 24.8 0L524.7 494c6.8 6.8 6.8 17.9 0 24.8-3.5 3.3-7.9 5-12.4 5z",fill:r.minutesColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${45+vue.unref(a)*6} 512.3 506.3`,to:`${405+vue.unref(a)*6} 512.3 506.3`,dur:"3600s",repeatCount:"indefinite"},null,8,_hoisted_6$6)],8,_hoisted_5$7),vue.createElementVNode("path",{d:"M512.3 523.8c-4.5 0-9-1.7-12.4-5.1-6.8-6.8-6.8-17.9 0-24.8l130.8-130.8c6.8-6.8 17.9-6.8 24.8 0 6.8 6.8 6.8 17.9 0 24.8L524.7 518.7c-3.5 3.4-7.9 5.1-12.4 5.1z",fill:r.hoursColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${-45+vue.unref(u)} 512.3 506.3`,to:`${315+vue.unref(u)} 512.3 506.3`,dur:"43200s",repeatCount:"indefinite"},null,8,_hoisted_8$6)],8,_hoisted_7$6),vue.createElementVNode("path",{d:"M512.3 506.3m-47.5 0a47.5 47.5 0 1 0 95 0 47.5 47.5 0 1 0-95 0Z",fill:r.circleColor},null,8,_hoisted_9$5),vue.createElementVNode("path",{d:"M512.3 218.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM512.3 880.8c-9 0-16.3-7.3-16.3-16.3v-29.1c0-9 7.3-16.3 16.3-16.3s16.3 7.3 16.3 16.3v29.1c0 9-7.4 16.3-16.3 16.3zM812.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3zM150.4 518.9c0-9 7.3-16.3 16.3-16.3h29.1c9 0 16.3 7.3 16.3 16.3s-7.3 16.3-16.3 16.3h-29.1c-8.9 0-16.3-7.3-16.3-16.3z",fill:r.scaleColor},null,8,_hoisted_10$4),vue.createElementVNode("path",{d:"M296.9 733.5c-2.2 0-4.5-0.9-6.2-2.6-3.4-3.4-3.4-9 0-12.4L540 469.2c3.4-3.4 9-3.4 12.4 0 3.4 3.4 3.4 9 0 12.4L303.1 731c-1.7 1.7-4 2.5-6.2 2.5z",fill:r.secondsColor},[vue.createElementVNode("animateTransform",{attributeName:"transform",attributeType:"XML",type:"rotate",from:`${135.5+o*6} 512.3 506.3`,to:`${495.5+o*6} 512.3 506.3`,dur:"60s",repeatCount:"indefinite"},null,8,_hoisted_12$2)],8,_hoisted_11$3),vue.createElementVNode("path",{d:"M512.3 506.3m-22.8 0a22.8 22.8 0 1 0 45.6 0 22.8 22.8 0 1 0-45.6 0Z",fill:r.centerColor},null,8,_hoisted_13$2)],8,_hoisted_2$d),vue.createElementVNode("use",{"xlink:href":`#${r.id}clock-a-n`,width:"100",height:"100"},null,8,_hoisted_14$2)],8,_hoisted_1$f))}}),_sfc_main$F=vue.defineComponent({__name:"text-box",props:{width:{default:250},height:{default:150},bgColor:{default:"#ffffff"},bgOpacity:{default:50},borderColor:{default:"#000000"},borderWidth:{default:1},borderRadius:{default:5},borderOpacity:{default:100}},setup(i){const r=i,n=vue.computed(()=>({width:(r.width>0?r.width:0)+"px",height:(r.height>0?r.height:0)+"px",borderRadius:(r.borderRadius>0?r.borderRadius:0)+"px"})),o=vue.computed(()=>({border:`${r.borderWidth>0?r.borderWidth:0}px solid ${r.borderColor}`,borderRadius:(r.borderRadius>0?r.borderRadius:0)+"px",opacity:(r.borderOpacity>0?r.borderOpacity<100?r.borderOpacity:100:0)/100})),a=vue.computed(()=>({backgroundColor:r.bgColor,opacity:(r.bgOpacity>0?r.bgOpacity<100?r.bgOpacity:100:0)/100,borderRadius:r.borderRadius+"px"}));return(u,c)=>(vue.openBlock(),vue.createElementBlock("div",{class:"outM",style:vue.normalizeStyle(n.value)},[vue.createElementVNode("div",{class:"wallI",style:vue.normalizeStyle(a.value)},null,4),vue.createElementVNode("div",{class:"borderB",style:vue.normalizeStyle(o.value)},null,4)],4))}}),textBox_vue_vue_type_style_index_0_scoped_4ab181ea_lang="",TextBox=_export_sfc$1(_sfc_main$F,[["__scopeId","data-v-4ab181ea"]]),vueComp={"svg-text":_sfc_main$L,"el-button":elementPlus.ElButton,"progress-a":_sfc_main$N,"el-tag":elementPlus.ElTag,"common-table":_sfc_main$K,"pie-charts":PieCharts,"switch-r":_sfc_main$M,"now-time":NowTime,"light-a":_sfc_main$H,"clock-a":_sfc_main$G,"text-box":TextBox},config=[...t$b,...t$1],useGlobalStore=pinia$1.defineStore("global-store",{state:()=>({config_center:config,intention:EGlobalStoreIntention.None,create_svg_info:null,done_json:[],mouse_info:{state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},handle_svg_info:null,scale_info:{type:EScaleInfoType.None,scale_times:{x:1,y:1},scale_item_info:{x:0,y:0},symmetric_point:{x:0,y:0}},rotate_info:{angle:0},connection_line_node_info:{init_pos:{x:0,y:0},point_index:0}}),actions:{setCreateInfo(i){this.intention=EGlobalStoreIntention.Create,this.create_svg_info=i},setDoneJson(i){isOfType(i,"id")?(this.done_json.push(i),vue.nextTick(()=>{setSvgActualInfo(i)})):this.done_json=objectDeepClone(i),vue.nextTick(()=>{useHistoryRecord(objectDeepClone(this.done_json))})},setHandleSvgInfo(i,r){let n=r;i?(!n&&n!=0&&(n=this.done_json.findIndex(o=>o.id===i.id)??-1),this.handle_svg_info={info:i,index:n}):this.handle_svg_info=i},spliceDoneJson(i){const r=useGlobalStore(),o=r.done_json.splice(i,1)[0];unbindAnchors(o.id),useHistoryRecord(r.done_json)}}}),useSvgEditLayoutStore=pinia$1.defineStore("svg-edit-layout-store",{state:()=>({left_nav:!0,right_nav:!0,center_offset:{x:0,y:0},canvasInfo:{with:0,height:0,top:0,left:0}})}),stopEvent=i=>{i.stopPropagation()},preventDefault=i=>{i.preventDefault()},myFixed=(i,r)=>Number(i.toFixed(r));function componentsRegister(i){var o,a;const r=vue.getCurrentInstance(),n=i?Object.assign(vueComp,i):vueComp;for(let u in n)!((o=r==null?void 0:r.appContext)!=null&&o.components.hasOwnProperty(u))&&vueComp.hasOwnProperty(u)&&((a=r==null?void 0:r.appContext)==null||a.app.component(u,vueComp[u]))}function setEditorLoadTime(){window.sessionStorage.setItem("editorLoadTime",new Date().getTime().toString())}const randomString=i=>{i=i||10;const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=r.length;let o="";for(let a=0;a<i;a++){let u=n;a===0&&(u=n-10),o+=r.charAt(Math.floor(Math.random()*u))}return o},isOfType=(i,r)=>i[r]!==void 0,getCoordinateOffset=(i,r)=>i/2*(r-1),angleToRadian=i=>i*Math.PI/180,calculateRotatedPointCoordinate=(i,r,n)=>({x:myFixed((i.x-r.x)*Math.cos(angleToRadian(n))-(i.y-r.y)*Math.sin(angleToRadian(n))+r.x,1),y:myFixed((i.x-r.x)*Math.sin(angleToRadian(n))+(i.y-r.y)*Math.cos(angleToRadian(n))+r.y,1)}),getCenterPoint=(i,r)=>({x:i.x+(r.x-i.x)/2,y:i.y+(r.y-i.y)/2}),positionArrToPath=i=>{let r="";for(let n=0;n<i.length;n++)n===0?r+=`M ${i[n].x} ${i[n].y}`:r+=` L ${i[n].x} ${i[n].y}`;return r},getSvgNowPosition=(i,r,n)=>n+(r-i),objectDeepClone=(i,r={})=>i?JSON.parse(JSON.stringify(i)):r,setSvgActualInfo=(i,r)=>{var a,u;const n=document.querySelector(`#${i.id}`),o=document.querySelector(`#rect${i.id}`);if(n){let c=0,d=0,f=0,h=0;if(i.type===EDoneJsonType.Vue){f=((a=i.props.width)==null?void 0:a.val)||n.offsetWidth||100,h=((u=i.props.height)==null?void 0:u.val)||n.offsetHeight||100,c=50-f/2,d=50-h/2;const y=document.querySelector(`#foreign-object${i.id}`);y&&(y.getAttribute("x")==="0"&&y.getAttribute("y")==="0"&&y.getAttribute("width")==="0"&&y.getAttribute("height")==="0"||r)&&(y.setAttribute("x",c.toString()),y.setAttribute("y",d.toString()),y.setAttribute("width",f.toString()),y.setAttribute("height",h.toString()))}else{const y=n.getBBox();c=myFixed(y.x,0),d=myFixed(y.y,0),f=myFixed(y.width,0),h=myFixed(y.height,0)}o&&(o.getAttribute("x")==="0"&&o.getAttribute("y")==="0"&&o.getAttribute("width")==="0"&&o.getAttribute("height")==="0"||r)&&(o.setAttribute("x",c.toString()),o.setAttribute("y",d.toString()),o.setAttribute("width",f.toString()),o.setAttribute("height",h.toString())),(i.actual_bound.x===0&&i.actual_bound.y===0&&i.actual_bound.width===0&&i.actual_bound.height===0||r)&&(i.actual_bound={x:c,y:d,width:f,height:h}),i.center_position={x:i.x+i.actual_bound.x+f/2,y:i.y+i.actual_bound.y+h/2},i.point_coordinate.tl={x:i.center_position.x-f*i.scale_x/2,y:i.center_position.y-h*i.scale_y/2},i.point_coordinate.tc={x:i.center_position.x,y:i.center_position.y-h*i.scale_y/2},i.point_coordinate.tr={x:i.center_position.x+f*i.scale_x/2,y:i.center_position.y-h*i.scale_y/2},i.point_coordinate.l={x:i.center_position.x-f*i.scale_x/2,y:i.center_position.y},i.point_coordinate.r={x:i.center_position.x+f*i.scale_x/2,y:i.center_position.y},i.point_coordinate.bl={x:i.center_position.x-f*i.scale_x/2,y:i.center_position.y+h*i.scale_y/2},i.point_coordinate.bc={x:i.center_position.x,y:i.center_position.y+h*i.scale_y/2},i.point_coordinate.br={x:i.center_position.x+f*i.scale_x/2,y:i.center_position.y+h*i.scale_y/2},i.rotate!==0&&setAfterRotationPointCoordinate(i),moveAnchors(i)}},resetHandlePointOld=i=>{for(const r of Object.keys(i.point_coordinate))i.point_coordinate_old&&(i.point_coordinate_old[r].x=0,i.point_coordinate_old[r].y=0)},moveHandlePoint=(i,r,n)=>{const o=useGlobalStore(pinia),a=r??o.mouse_info.new_position_x-o.mouse_info.position_x,u=n??o.mouse_info.new_position_y-o.mouse_info.position_y;for(const c of Object.keys(i.point_coordinate))r!==void 0&&n!==void 0?(i.point_coordinate[c].x+=a,i.point_coordinate[c].y+=u):i.point_coordinate_old&&(i.point_coordinate[c].x=i.point_coordinate_old[c].x+a,i.point_coordinate[c].y=i.point_coordinate_old[c].y+u)},moveAnchors=i=>{var n,o,a,u;const r=useGlobalStore(pinia);for(let c of r.done_json)if(c.type===EDoneJsonType.ConnectionLine){if(((o=(n=c.bind_anchors)==null?void 0:n.start)==null?void 0:o.target_id)===i.id){const d=getAnchorPosByAnchorType(c.bind_anchors.start.type,i);c.props.point_position.val[0]={x:d.x-c.x,y:d.y-c.y}}if(((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===i.id){const d=getAnchorPosByAnchorType(c.bind_anchors.end.type,i);c.props.point_position.val[c.props.point_position.val.length-1]={x:d.x-c.x,y:d.y-c.y}}}},unbindAnchors=i=>{var n,o,a,u;const r=useGlobalStore(pinia);for(let c of r.done_json)c.type===EDoneJsonType.ConnectionLine&&(((o=(n=c.bind_anchors)==null?void 0:n.start)==null?void 0:o.target_id)===i&&(c.bind_anchors.start=null),((u=(a=c.bind_anchors)==null?void 0:a.end)==null?void 0:u.target_id)===i&&(c.bind_anchors.end=null))},getAnchorPosByAnchorType=(i,r)=>i===ELineBindAnchors.BottomCenter?r.point_coordinate.bc:i===ELineBindAnchors.Left?r.point_coordinate.l:i===ELineBindAnchors.Right?r.point_coordinate.r:r.point_coordinate.tc,setAfterRotationPointCoordinate=i=>{i.point_coordinate={tl:calculateRotatedPointCoordinate(i.point_coordinate.tl,i.center_position,i.rotate),tc:calculateRotatedPointCoordinate(i.point_coordinate.tc,i.center_position,i.rotate),tr:calculateRotatedPointCoordinate(i.point_coordinate.tr,i.center_position,i.rotate),l:calculateRotatedPointCoordinate(i.point_coordinate.l,i.center_position,i.rotate),r:calculateRotatedPointCoordinate(i.point_coordinate.r,i.center_position,i.rotate),bl:calculateRotatedPointCoordinate(i.point_coordinate.bl,i.center_position,i.rotate),bc:calculateRotatedPointCoordinate(i.point_coordinate.bc,i.center_position,i.rotate),br:calculateRotatedPointCoordinate(i.point_coordinate.br,i.center_position,i.rotate)}},prosToVBind=(i,r=[])=>{let n={};if(i.state){for(const o in i.state)if(i.state.hasOwnProperty(o)&&o===i.defaultState){for(let a in i.state[o])a!=="label"&&(n[lodashEs.kebabCase(a)]=i.state[o][a]);break}}for(const o in i.props)r.indexOf(o)<0&&(n[lodashEs.kebabCase(o)]=i.props[o].val);return n},setArrItemByID=(id,key,val,json_arr)=>new Promise(res=>{const find_item=json_arr.find(i=>i.id===id);find_item||res({status:!1,msg:"要设置的id不存在"}),eval(`find_item.${key} = val;`),res({status:!0,msg:"操作成功"})}),getCommonClass=i=>!i.common_animations||!i.common_animations.val?"":`common-ani animate__animated animate__${i.common_animations.val} animate__${i.common_animations.speed} animate__${i.common_animations.repeat} animate__${i.common_animations.delay}`,numberArray=i=>{let r=[];for(let n=0;n<i;n++)r.push(n);return r},getStringWidth=(i,r=12)=>{if(i.length>0){let n=document.createElement("span");n.style.fontSize=r+"px",n.style.fontFamily="inherit",n.innerHTML=i,n.style.opacity="0",n.style.position="fixed",n.style.top="3000px",document.body.append(n);const o=n.clientWidth;return document.body.removeChild(n),o}return 0},valFormat=i=>/false|true/.test(i)?i!=="false":/^\d+(\.\d+)?$/.test(i)?Number(i):i,createLine=(i,r,n)=>{i.preventDefault();const o=useGlobalStore(pinia),a=useConfigStore(pinia),u=useSvgEditLayoutStore(pinia),{clientX:c,clientY:d}=i;let f=objectDeepClone(a.connection_line),h=0,y=0;if(r&&n){f.bind_anchors.start={type:r,target_id:n.id};let p=getAnchorPosByAnchorType(r,n);h=p.x,y=p.y}else h=Math.round((c-u.canvasInfo.left)/a.svg.scale-u.center_offset.x),y=Math.round((d-u.canvasInfo.top)/a.svg.scale-u.center_offset.y);const g={id:randomString(),x:h,y,client:{x:h,y},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},...f};g.props.point_position.val.push({x:0,y:0}),o.setDoneJson(g),o.setHandleSvgInfo(g,o.done_json.length-1),o.intention=EGlobalStoreIntention.Connection,o.mouse_info={state:EMouseInfoState.Down,position_x:h,position_y:y,now_position_x:h,now_position_y:y,new_position_x:0,new_position_y:0}},getZoomPosition=(i,r,n,o)=>{const a=i.layerX,u=i.layerY,c=n.x,d=n.y,f=myFixed(o?r-.1:r+.1,1),h=myFixed(c+a*(f-1)/f,1),y=myFixed(d+u*(f-1)/f,1);n.x=myFixed(h/r-(a-h)*(r-1)/r,2),n.y=myFixed(y/r-(u-y)*(r-1)/r,2)};Object.seal({name:"straight-line",title:"直线",type:EDoneJsonType.StraightLine,config:{can_zoom:!1,have_anchor:!1,actual_rect:!1},display:!0,props:{fill:{title:"填充色",type:EConfigItemPropsType.Color,val:"#ff0000"},start_x:{title:"起点x坐标",type:EConfigItemPropsType.InputNumber,val:0},start_y:{title:"起点y坐标",type:EConfigItemPropsType.InputNumber,val:0},end_x:{title:"终点x坐标",type:EConfigItemPropsType.InputNumber,val:0},end_y:{title:"终点y坐标",type:EConfigItemPropsType.InputNumber,val:0}},bind_anchors:{start:null,end:null},events:[]});const connection_line_system={name:"connection_line",title:"连接线",type:EDoneJsonType.ConnectionLine,config:{can_zoom:!1,have_anchor:!1,actual_rect:!1},display:!0,props:{stroke:{title:"线条颜色",type:EConfigItemPropsType.Color,val:"#ff0000"},"stroke-width":{title:"线条宽度",type:EConfigItemPropsType.InputNumber,val:2},point_r:{title:"节点半径",type:EConfigItemPropsType.InputNumber,val:4},point_position:{title:"点坐标",type:EConfigItemPropsType.JsonEdit,val:[]}},animations:{type:{title:"动画类型",type:EConfigItemPropsType.Select,val:EConfigAnimationsType.None,options:[{label:"无",value:EConfigAnimationsType.None},{label:"电流",value:EConfigAnimationsType.Electricity},{label:"轨迹",value:EConfigAnimationsType.Track},{label:"水珠",value:EConfigAnimationsType.WaterDrop}]},dur:{title:"持续时间",type:EConfigItemPropsType.InputNumber,val:20},repeatCount:{title:"循环次数",type:EConfigItemPropsType.Input,val:"indefinite",disabled:!0},color:{title:"颜色",type:EConfigItemPropsType.Color,val:"#602a00"},reverse:{title:"反转动画",type:EConfigItemPropsType.Switch,val:!1}},bind_anchors:{start:null,end:null},events:[]},common_animate_list=[{label:"进入",children:[{label:"渐显",value:"fadeIn"},{label:"向右进入",value:"fadeInLeft"},{label:"向左进入",value:"fadeInRight"},{label:"向上进入",value:"fadeInUp"},{label:"向下进入",value:"fadeInDown"},{label:"向右长距进入",value:"fadeInLeftBig"},{label:"向左长距进入",value:"fadeInRightBig"},{label:"向上长距进入",value:"fadeInUpBig"},{label:"向下长距进入",value:"fadeInDownBig"},{label:"旋转进入",value:"rotateIn"},{label:"左顺时针旋转",value:"rotateInDownLeft"},{label:"右逆时针旋转",value:"rotateInDownRight"},{label:"左逆时针旋转",value:"rotateInUpLeft"},{label:"右逆时针旋转",value:"rotateInUpRight"},{label:"弹入",value:"bounceIn"},{label:"向右弹入",value:"bounceInLeft"},{label:"向左弹入",value:"bounceInRight"},{label:"向上弹入",value:"bounceInUp"},{label:"向下弹入",value:"bounceInDown"},{label:"光速从右进入",value:"lightSpeedInRight"},{label:"光速从左进入",value:"lightSpeedInLeft"},{label:"光速从右退出",value:"lightSpeedOutRight"},{label:"光速从左退出",value:"lightSpeedOutLeft"},{label:"Y轴旋转",value:"flip"},{label:"中心X轴旋转",value:"flipInX"},{label:"中心Y轴旋转",value:"flipInY"},{label:"左长半径旋转",value:"rollIn"},{label:"由小变大进入",value:"zoomIn"},{label:"左变大进入",value:"zoomInLeft"},{label:"右变大进入",value:"zoomInRight"},{label:"向上变大进入",value:"zoomInUp"},{label:"向下变大进入",value:"zoomInDown"},{label:"向右滑动展开",value:"slideInLeft"},{label:"向左滑动展开",value:"slideInRight"},{label:"向上滑动展开",value:"slideInUp"},{label:"向下滑动展开",value:"slideInDown"}]},{label:"强调",children:[{label:"弹跳",value:"bounce"},{label:"闪烁",value:"flash"},{label:"放大缩小",value:"pulse"},{label:"放大缩小弹簧",value:"rubberBand"},{label:"左右晃动",value:"headShake"},{label:"左右扇形摇摆",value:"swing"},{label:"放大晃动缩小",value:"tada"},{label:"扇形摇摆",value:"wobble"},{label:"左右上下晃动",value:"jello"},{label:"Y轴旋转",value:"flip"}]},{label:"退出",children:[{label:"渐隐",value:"fadeOut"},{label:"向左退出",value:"fadeOutLeft"},{label:"向右退出",value:"fadeOutRight"},{label:"向上退出",value:"fadeOutUp"},{label:"向下退出",value:"fadeOutDown"},{label:"向左长距退出",value:"fadeOutLeftBig"},{label:"向右长距退出",value:"fadeOutRightBig"},{label:"向上长距退出",value:"fadeOutUpBig"},{label:"向下长距退出",value:"fadeOutDownBig"},{label:"旋转退出",value:"rotateOut"},{label:"左顺时针旋转",value:"rotateOutDownLeft"},{label:"右逆时针旋转",value:"rotateOutDownRight"},{label:"左逆时针旋转",value:"rotateOutUpLeft"},{label:"右逆时针旋转",value:"rotateOutUpRight"},{label:"弹出",value:"bounceOut"},{label:"向左弹出",value:"bounceOutLeft"},{label:"向右弹出",value:"bounceOutRight"},{label:"向上弹出",value:"bounceOutUp"},{label:"向下弹出",value:"bounceOutDown"},{label:"中心X轴旋转",value:"flipOutX"},{label:"中心Y轴旋转",value:"flipOutY"},{label:"左长半径旋转",value:"rollOut"},{label:"由小变大退出",value:"zoomOut"},{label:"左变大退出",value:"zoomOutLeft"},{label:"右变大退出",value:"zoomOutRight"},{label:"向上变大退出",value:"zoomOutUp"},{label:"向下变大退出",value:"zoomOutDown"},{label:"向左滑动收起",value:"slideOutLeft"},{label:"向右滑动收起",value:"slideOutRight"},{label:"向上滑动收起",value:"slideOutUp"},{label:"向下滑动收起",value:"slideOutDown"}]}];let l=localStorage.getItem("svg-editor-config"),s,t;if(l){let i=JSON.parse(l);t=i.connection_line,s=i.svg}else t=objectDeepClone(connection_line_system),s={background_color:"#fff",scale:1,grid:!0,grid_color:"#ebebeb",ruler:!0};const useConfigStore=pinia$1.defineStore("config-store",{state:()=>({svg:s,connection_line:t,net:{mqtt:{url:"",user:"",pwd:"",topics:""}}}),getters:{},actions:{}});var EContextMenuInfoType=(i=>(i.Copy="Copy",i.Delete="Delete",i.MoveUpOneLevel="MoveUpOneLevel",i.MoveDownOneLevel="MoveDownOneLevel",i.MoveUpTopLevel="MoveUpTopLevel",i.MoveDownTopLevel="MoveDownTopLevel",i))(EContextMenuInfoType||{});const useEditPrivateStore=pinia$1.defineStore("edit-private-store",{state:()=>({old_done_components:[],history_doneComponent:[],history_now_index:0,is_record_history:!0,max_record_times:10}),getters:{getTopBtnUndoStatus(i){return i.history_now_index>=1},getTopBtnRedoStatus(i){return i.history_now_index+1!=i.history_doneComponent.length}},actions:{topUndoBtnClick(){if(console.log("撤销"),this.history_now_index<1)return;const i=useGlobalStore();this.is_record_history=!1,this.history_now_index-=1,i.setDoneJson(this.history_doneComponent[this.history_now_index])},topRedoBtnClick(){if(console.log("重做"),this.history_now_index+1==this.history_doneComponent.length)return;const i=useGlobalStore();this.is_record_history=!1,this.history_now_index+=1,i.setDoneJson(this.history_doneComponent[this.history_now_index])}}}),useContextMenuStore=pinia$1.defineStore("context-menu-store",{state:()=>({display:!1,info:{[EContextMenuInfoType.Copy]:{title:"复制",hot_key:"Ctrl + c",enable:!0},[EContextMenuInfoType.Delete]:{title:"删除",hot_key:"Delete",enable:!0},[EContextMenuInfoType.MoveUpTopLevel]:{title:"置于顶层",hot_key:"Ctrl + →",enable:!0},[EContextMenuInfoType.MoveDownTopLevel]:{title:"置于底层",hot_key:"Ctrl + ←",enable:!0},[EContextMenuInfoType.MoveUpOneLevel]:{title:"置于上一层",hot_key:"Ctrl + ↑",enable:!0},[EContextMenuInfoType.MoveDownOneLevel]:{title:"置于下一层",hot_key:"Ctrl + ↓",enable:!0}}}),actions:{onContextMenuClick(i){const r=useGlobalStore();if(r.handle_svg_info)switch(r.intention=EGlobalStoreIntention.Select,i){case EContextMenuInfoType.Copy:const n=objectDeepClone(r.handle_svg_info.info);n.id=randomString(),n.title+="-copy",n.x+=10,n.y+=10,r.setDoneJson(n),this.display=!1,r.setHandleSvgInfo(n,r.done_json.length);break;case EContextMenuInfoType.Delete:r.spliceDoneJson(r.handle_svg_info.index),this.display=!1,r.setHandleSvgInfo(null),r.intention=EGlobalStoreIntention.None;break;case EContextMenuInfoType.MoveUpOneLevel:if(r.done_json.length===1||r.handle_svg_info.index===r.done_json.length-1)return;const o=r.handle_svg_info.info;r.done_json[r.handle_svg_info.index]=r.done_json[r.handle_svg_info.index+1],r.done_json[r.handle_svg_info.index+1]=o,useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(o,r.handle_svg_info.index+1);break;case EContextMenuInfoType.MoveDownOneLevel:if(r.done_json.length===1||r.handle_svg_info.index===0)return;const a=r.handle_svg_info.info;r.done_json[r.handle_svg_info.index]=r.done_json[r.handle_svg_info.index-1],r.done_json[r.handle_svg_info.index-1]=a,useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(a,r.handle_svg_info.index-1);break;case EContextMenuInfoType.MoveDownTopLevel:if(r.done_json.length===1||r.handle_svg_info.index===0)return;const u=r.handle_svg_info.info;r.done_json.splice(r.handle_svg_info.index,1),r.done_json.unshift(u),useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(u,0);break;case EContextMenuInfoType.MoveUpTopLevel:if(r.done_json.length===1||r.handle_svg_info.index===r.done_json.length)return;const c=r.handle_svg_info.info;r.done_json.splice(r.handle_svg_info.index,1),r.done_json.push(c),useHistoryRecord(r.done_json),this.display=!1,r.setHandleSvgInfo(c,r.done_json.length-1);break}}}}),pinia=pinia$1.createPinia(),useHistoryRecord=i=>{const r=useEditPrivateStore();r.is_record_history&&(r.history_now_index+1<r.history_doneComponent.length&&r.history_doneComponent.splice(r.history_now_index+1),r.history_doneComponent.push(i),r.history_now_index=r.history_doneComponent.length-1,r.history_doneComponent.length>r.max_record_times&&(r.history_doneComponent.shift(),r.history_now_index=r.history_doneComponent.length-1)),r.is_record_history=!0},useImportDataModel=i=>{try{const r=JSON.parse(i);if(!r.config||!r.layout_center||!r.done_json)return elementPlus.ElMessage.error("请导入正确的数据模型!"),!1;const n=useGlobalStore(pinia),o=useSvgEditLayoutStore(pinia),a=useConfigStore(pinia);return a.$state=r.config,o.center_offset=r.layout_center,n.setDoneJson(r.done_json),!0}catch(r){return elementPlus.ElMessage.error("请导入正确的数据模型!"),console.error(r),!1}},_hoisted_1$e={"aria-hidden":"true"},_hoisted_2$c=["xlink:href"],_sfc_main$E=vue.defineComponent({__name:"svg-analysis",props:{name:{},props:{default:()=>({})}},setup(i){const r=i,n=vue.computed(()=>`#svg-${r.name}`);return(o,a)=>(vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$e,[vue.createElementVNode("use",vue.mergeProps({"xlink:href":vue.unref(n)},r.props),null,16,_hoisted_2$c)]))}});var EVisibleConfKey=(i=>(i.ImportJson="ImportJson",i.ExportJson="ExportJson",i.ImportFile="ImportFile",i))(EVisibleConfKey||{});const _withScopeId$2=i=>(vue.pushScopeId("data-v-c6f23032"),i=i(),vue.popScopeId(),i),_hoisted_1$d={class:"flex justify-between",style:{width:"100%"}},_hoisted_2$b={class:"flex items-center justify-between",style:{width:"250px"}},_hoisted_3$9=_withScopeId$2(()=>vue.createElementVNode("div",{class:"flex items-center"},[vue.createElementVNode("span",{class:"logo-title"},"Svg Editor")],-1)),_hoisted_4$7={class:"flex justify-between",style:{width:"calc(100% - 440px)"}},_hoisted_5$6={class:"flex items-center"},_hoisted_6$5={class:"flex items-center mr-20px"},_hoisted_7$5={class:"flex items-center",style:{width:"250px"}},_hoisted_8$5=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title",style:{"padding-top":"16px"}},"多选",-1)),_hoisted_9$4=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区域按住鼠标左键可以框选(图形坐标在框选区域即判定被选中),也可以按住ctrl+鼠标左键点图形进行多选",-1)),_hoisted_10$3=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_11$2=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"拖动画布",-1)),_hoisted_12$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布空白区域按住右键可拖动画布,右侧面板‘图纸’栏可微调或重置位置",-1)),_hoisted_13$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_14$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"画布缩放",-1)),_hoisted_15$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"在画布中使用鼠标滚轮或者右侧面板‘图纸’栏可控制画布缩放,鼠标滚轮以鼠标位置为缩放中心,图纸栏以图纸原点(默认在左上角)为缩放中心",-1)),_hoisted_16$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_17$1=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"标尺辅助线",-1)),_hoisted_18$1=_withScopeId$2(()=>vue.createElementVNode("div",null,"在标尺区域按住鼠标左键并拖动即可创建标尺辅助线,将标尺辅助线拖动到标尺区域即可删除标尺辅助线",-1)),_hoisted_19=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_20=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"组件尺寸",-1)),_hoisted_21=_withScopeId$2(()=>vue.createElementVNode("div",null,[vue.createElementVNode("p",null," 大多数组件可以通过选中组件然后拖动交互点或在右侧‘外观’栏改变外形尺寸,或通过右侧‘数据’栏直接或间接改变外形尺寸;"),vue.createElementVNode("p",null,"少数特殊组件仅可通过右侧'数据'栏直接或间接改变外形尺寸")],-1)),_hoisted_22=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_23=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"连线样式",-1)),_hoisted_24=_withScopeId$2(()=>vue.createElementVNode("div",null,"在右侧‘连线’栏可以统一配置连线样式,配置后先增加的线会应用新样式,之前的线样式不变,如需改变,可选中线手动更改或删除重画 ",-1)),_hoisted_25=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_26=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"横线和竖线",-1)),_hoisted_27=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null," 点击编辑器顶部连线按钮会进入连线状态,该状态下在画板点击鼠标左键即可开始画线,移动并再次点击左键创建新的节点,右键结束画线并退出连线状态;"),vue.createElementVNode("p",null,"画线的时候按住ctrl即可画竖线,按住shift即可画横线")],-1)),_hoisted_28=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_29=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"绑定锚点",-1)),_hoisted_30=_withScopeId$2(()=>vue.createElementVNode("div",{class:"guide-text"},[vue.createElementVNode("p",null,"组件在未选中时,鼠标经过组件时会出现锚点,鼠标悬浮在锚点上时,会有交互样式,点击左键即可以锚点为起点创建连线;"),vue.createElementVNode("p",null,"同样,在连线时鼠标经过锚点时,会出现锚点交互样式,点击左键即可以锚点为连线终点结束连线;"),vue.createElementVNode("p",null,"这两种情况下的连线会绑定组件上的锚点,如需解绑,参考下面的‘锚点解绑’;"),vue.createElementVNode("p",null,"同样,也可先画线,再选中连线绑定想要绑定的组件锚点(连线只有首尾节点可以绑定锚点)")],-1)),_hoisted_31=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_32=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"线段选中",-1)),_hoisted_33=_withScopeId$2(()=>vue.createElementVNode("div",null," 若线段绑定了锚点,移动线段,绑定的锚点不会移动。若是想将线段整体移动,需要先解绑,参考下面的‘锚点解绑’ ",-1)),_hoisted_34=_withScopeId$2(()=>vue.createElementVNode("div",{class:"el-divider el-divider--horizontal",role:"separator",style:{"--el-border-style":"solid"}},null,-1)),_hoisted_35=_withScopeId$2(()=>vue.createElementVNode("div",{class:"font-bold mb-10px text-15px guide-title"},"锚点解绑",-1)),_hoisted_36=_withScopeId$2(()=>vue.createElementVNode("div",{style:{"padding-bottom":"14px"}}," 选中线段,在右侧‘数据’栏里解除绑定;或者鼠标左键拖拽连线上需要解绑的节点",-1)),_sfc_main$D=vue.defineComponent({__name:"top-panel",emits:["changeVisible","onReturn","onPreview","onSave"],setup(i,{emit:r}){const n=useSvgEditLayoutStore(pinia),o=useGlobalStore(pinia),a=useEditPrivateStore(pinia),u=useConfigStore(pinia),c=r,d=()=>{o.done_json.length<=0||o.setDoneJson([]),o.intention=EGlobalStoreIntention.None},f=g=>{const p={layout_center:n.center_offset,config:u.$state,done_json:o.done_json};c(g,p)},h=vue.ref(!1),y=vue.computed({get:()=>o.intention===EGlobalStoreIntention.Connection,set(g){o.intention=g?EGlobalStoreIntention.Connection:EGlobalStoreIntention.None,g&&o.setHandleSvgInfo(null)}});return(g,p)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$d,[vue.createElementVNode("div",_hoisted_2$b,[_hoisted_3$9,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:p[0]||(p[0]=v=>vue.unref(n).left_nav=!vue.unref(n).left_nav),title:vue.unref(n).left_nav?"隐藏左侧菜单":"显示左侧菜单"},{default:vue.withCtx(()=>[vue.unref(n).left_nav?(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:0,name:"menu-unfold"})):(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:1,name:"menu-fold"}))]),_:1},8,["title"])]),vue.createElementVNode("div",_hoisted_4$7,[vue.createElementVNode("div",_hoisted_5$6,[vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"撤销 ctrl+z",size:24,class:vue.normalizeClass(`${vue.unref(a).getTopBtnUndoStatus?"bt-Icon":"icon-disable"} ml-20px`),onClick:p[1]||(p[1]=()=>vue.unref(a).topUndoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(a).getTopBtnUndoStatus?"undo":"undo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"重做 ctrl+shift+z",class:vue.normalizeClass(`${vue.unref(a).getTopBtnRedoStatus?"bt-Icon":"icon-disable"} ml-5px`),size:24,onClick:p[2]||(p[2]=()=>vue.unref(a).topRedoBtnClick())},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(a).getTopBtnRedoStatus?"redo":"redo-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"清空 ctrl+delete",class:vue.normalizeClass(vue.unref(o).done_json.length>0?"bt-Icon":"icon-disable"),size:24,onClick:d},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(o).done_json.length>0?"delete":"delete-gray"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"导入数据模型",class:"bt-Icon",size:24,onClick:p[3]||(p[3]=v=>c("changeVisible",vue.unref(EVisibleConfKey).ImportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"import"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"导出数据模型",size:24,class:"bt-Icon ml-5px",onClick:p[4]||(p[4]=v=>c("changeVisible",vue.unref(EVisibleConfKey).ExportJson,!0))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"export"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"创建连线",class:vue.normalizeClass(["bt-Icon",{active:vue.unref(y)}]),size:24,onClick:p[5]||(p[5]=v=>y.value=!vue.unref(y))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:vue.unref(y)?"line-active":"line"},null,8,["name"])]),_:1},8,["class"]),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"说明",class:"bt-Icon",size:24,onClick:p[6]||(p[6]=v=>h.value=!vue.unref(h))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"question"})]),_:1})]),vue.createElementVNode("div",_hoisted_6$5,[vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"返回",class:"bt-Icon",size:24,onClick:p[7]||(p[7]=v=>f("onReturn"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"return"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"保存",class:"bt-Icon",size:24,onClick:p[8]||(p[8]=v=>f("onSave"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"save"})]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDivider),{direction:"vertical"}),vue.createVNode(vue.unref(elementPlus.ElIcon),{title:"预览",class:"bt-Icon",size:22,onClick:p[9]||(p[9]=v=>f("onPreview"))},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"preview"})]),_:1})])]),vue.createElementVNode("div",_hoisted_7$5,[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:24,class:"bt-Icon",onClick:p[10]||(p[10]=v=>vue.unref(n).right_nav=!vue.unref(n).right_nav),title:vue.unref(n).right_nav?"隐藏右侧菜单":"显示右侧菜单"},{default:vue.withCtx(()=>[vue.unref(n).right_nav?(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:0,name:"menu-fold"})):(vue.openBlock(),vue.createBlock(_sfc_main$E,{key:1,name:"menu-unfold"}))]),_:1},8,["title"])])]),vue.createVNode(vue.unref(elementPlus.ElDialog),{modelValue:vue.unref(h),"onUpdate:modelValue":p[11]||(p[11]=v=>vue.isRef(h)?h.value=v:null),title:"使用说明",width:"60%"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{"max-height":"60vh"},{default:vue.withCtx(()=>[_hoisted_8$5,_hoisted_9$4,_hoisted_10$3,_hoisted_11$2,_hoisted_12$1,_hoisted_13$1,_hoisted_14$1,_hoisted_15$1,_hoisted_16$1,_hoisted_17$1,_hoisted_18$1,_hoisted_19,_hoisted_20,_hoisted_21,_hoisted_22,_hoisted_23,_hoisted_24,_hoisted_25,_hoisted_26,_hoisted_27,_hoisted_28,_hoisted_29,_hoisted_30,_hoisted_31,_hoisted_32,_hoisted_33,_hoisted_34,_hoisted_35,_hoisted_36]),_:1})]),_:1},8,["modelValue"])],64))}}),topPanel_vue_vue_type_style_index_0_scoped_c6f23032_lang="",TopPanel=_export_sfc$1(_sfc_main$D,[["__scopeId","data-v-c6f23032"]]),_hoisted_1$c={class:"component-group flex flex-wrap"},_hoisted_2$a=["onDragstart","title"],_sfc_main$C=vue.defineComponent({__name:"left-panel",props:{customToolbar:{}},setup(i){const r=useGlobalStore(pinia),n=i,o=vue.ref(n.customToolbar&&Object.keys(n.customToolbar).length>0?n.customToolbar:r.config_center),a=vue.ref(["stateful","stateless","have_animation","custom_svg_group","element-ui","custom-vue","echarts"]),u=f=>{r.setCreateInfo(c(f))},c=f=>(f!=null&&f.props&&!lodashEs.isEmpty(f.props)&&Object.keys(f.props).forEach((h,y)=>{f.props[h].sort=String(y)}),f),d=f=>{var h;if(((h=f.dataTransfer)==null?void 0:h.dropEffect)!=="copy"){elementPlus.ElMessage.warning("请将组件拖到画布中!"),r.intention=EGlobalStoreIntention.None;return}};return(f,h)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElCollapse),{modelValue:vue.unref(a),"onUpdate:modelValue":h[0]||(h[0]=y=>vue.isRef(a)?a.value=y:null),style:{"border-top":"none"}},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(o),y=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElCollapseItem),{name:y.groupType,key:y.title},{title:vue.withCtx(()=>[vue.createElementVNode("div",null,vue.toDisplayString(y.title),1)]),default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$c,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(y.list,g=>(vue.openBlock(),vue.createElementBlock("div",{class:"ideal",key:g.name,draggable:"true",onDragstart:p=>u(g),onDragend:d,title:g.title},[vue.createVNode(vue.unref(elementPlus.ElIcon),{size:35,class:"flex items-center"},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:g.name,props:vue.unref(prosToVBind)(g,["width","height","maxHeight"])},null,8,["name","props"])]),_:2},1024)],40,_hoisted_2$a))),128))])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]))}}),leftPanel_vue_vue_type_style_index_0_scoped_8aba8565_lang="",LeftPanel=_export_sfc$1(_sfc_main$C,[["__scopeId","data-v-8aba8565"]]),calculateLeftTop=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate(r,o,-n);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightTop=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate(r,o,-n);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateRightBottom=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(r,o,-n),u=calculateRotatedPointCoordinate(i,o,-n);return{width:u.x-a.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateLeftBottom=(i,r,n)=>{const o=getCenterPoint(i,r),a=calculateRotatedPointCoordinate(r,o,-n),u=calculateRotatedPointCoordinate(i,o,-n);return{width:a.x-u.x,height:u.y-a.y,is_old_width:!1,is_old_height:!1}},calculateTop=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateRight=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},calculateBottom=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:o.x,y:a.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:1,height:Math.round(c),is_old_width:!0,is_old_height:!1}},calculateLeft=(i,r,n,o)=>{const a=calculateRotatedPointCoordinate(i,o,-n),u=calculateRotatedPointCoordinate({x:a.x,y:o.y},o,n),c=Math.sqrt((u.x-r.x)**2+(u.y-r.y)**2);return{width:Math.round(c),height:1,is_old_width:!1,is_old_height:!0}},_hoisted_1$b={style:{"vector-effect":"non-scaling-stroke"}},_hoisted_2$9=["fill","x","y"],_hoisted_3$8=["cx","cy"],_hoisted_4$6=["x1","y1","x2","y2"],_hoisted_5$5=["fill","x","y"],_hoisted_6$4=["fill","x","y"],_hoisted_7$4=["fill","x","y"],_hoisted_8$4=["fill","x","y"],_hoisted_9$3=["fill","x","y"],_hoisted_10$2=["fill","x","y"],_hoisted_11$1=["fill","x","y"],_sfc_main$B=vue.defineComponent({__name:"handle-panel",props:{itemInfo:{}},setup(i){vue.useCssVars(p=>({"5c831aea":vue.unref(c)}));const r=i,n=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=vue.ref(4),c=vue.ref("#ab712e"),d=[{start:338,end:23,cursor:"nw",type:EScaleInfoType.TopLeft},{start:23,end:68,cursor:"n",type:EScaleInfoType.TopCenter},{start:68,end:113,cursor:"ne",type:EScaleInfoType.TopRight},{start:293,end:338,cursor:"w",type:EScaleInfoType.Left},{start:113,end:158,cursor:"e",type:EScaleInfoType.Right},{start:248,end:293,cursor:"sw",type:EScaleInfoType.BottomLeft},{start:203,end:248,cursor:"s",type:EScaleInfoType.BottomCenter},{start:158,end:203,cursor:"se",type:EScaleInfoType.BottomRight}],f=vue.computed(()=>r.itemInfo.config.can_zoom),h=(p,v)=>{console.log("handMousedown",v);const{clientX:_,clientY:b}=v;v.stopPropagation(),n.intention=EGlobalStoreIntention.Zoom;const A=Math.round((_-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),w=Math.round((b-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);n.mouse_info={state:EMouseInfoState.Down,position_x:A,position_y:w,now_position_x:A,now_position_y:w,new_position_x:0,new_position_y:0},n.scale_info={type:p,scale_times:{x:r.itemInfo.scale_x,y:r.itemInfo.scale_y},scale_item_info:{x:r.itemInfo.x,y:r.itemInfo.y},symmetric_point:{x:A+Math.abs(A-r.itemInfo.center_position.x)*2*(A>r.itemInfo.center_position.x?-1:1),y:w+Math.abs(w-r.itemInfo.center_position.y)*2*(w>r.itemInfo.center_position.y?-1:1)}}},y=p=>{const{clientX:v,clientY:_}=p,b=Math.round((v-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),A=Math.round((_-a.canvasInfo.top)/o.svg.scale-a.center_offset.y);p.stopPropagation(),n.intention=EGlobalStoreIntention.Rotate,n.rotate_info={angle:r.itemInfo.rotate},n.mouse_info={state:EMouseInfoState.Down,position_x:b,position_y:A,now_position_x:b,now_position_y:A,new_position_x:0,new_position_y:0}},g=p=>{const v=(p+r.itemInfo.rotate)%360,_=d.find(b=>b.start<=v&&b.end>v);return _?{cursor:_.cursor+"-resize",type:_.type}:{cursor:"nw-resize",type:EScaleInfoType.TopLeft}};return(p,v)=>(vue.openBlock(),vue.createElementBlock("g",_hoisted_1$b,[vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tl",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(0).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[0]||(v[0]=_=>h(vue.unref(EScaleInfoType).TopLeft,_))},null,44,_hoisted_2$9),[[vue.vShow,vue.unref(f)]]),vue.createElementVNode("circle",{cx:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2,cy:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)-24,r:4,class:"rotate-circle",onMousedown:y},null,40,_hoisted_3$8),vue.createElementVNode("line",{x1:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2,y1:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),x2:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2,y2:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)-20,style:vue.normalizeStyle({stroke:vue.unref(c),"stroke-width":2})},null,12,_hoisted_4$6),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tc",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(45).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2-vue.unref(u),y:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[1]||(v[1]=_=>h(vue.unref(EScaleInfoType).TopCenter,_))},null,44,_hoisted_5$5),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_tr",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(90).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width-vue.unref(u)+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[2]||(v[2]=_=>h(vue.unref(EScaleInfoType).TopRight,_))},null,44,_hoisted_6$4),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_l",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(315).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[3]||(v[3]=_=>h(vue.unref(EScaleInfoType).Left,_))},null,44,_hoisted_7$4),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_r",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(135).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)+r.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[4]||(v[4]=_=>h(vue.unref(EScaleInfoType).Right,_))},null,44,_hoisted_8$4),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_bl",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(270).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height*r.itemInfo.scale_y-vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[5]||(v[5]=_=>h(vue.unref(EScaleInfoType).BottomLeft,_))},null,44,_hoisted_9$3),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_bc",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(225).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)+r.itemInfo.actual_bound.width/2,y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[6]||(v[6]=_=>h(vue.unref(EScaleInfoType).BottomCenter,_))},null,44,_hoisted_10$2),[[vue.vShow,vue.unref(f)]]),vue.withDirectives(vue.createElementVNode("rect",{id:"resize_br",width:"8",height:"8",fill:vue.unref(c),style:vue.normalizeStyle({cursor:g(180).cursor,"vector-effect":"non-scaling-stroke"}),"pointer-events":"all",x:r.itemInfo.actual_bound.x-vue.unref(u)+r.itemInfo.actual_bound.width+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.width,r.itemInfo.scale_x),y:r.itemInfo.actual_bound.y-vue.unref(u)+r.itemInfo.actual_bound.height+vue.unref(getCoordinateOffset)(r.itemInfo.actual_bound.height,r.itemInfo.scale_y),stroke:"rgba(0,0,0,0)",onMousedown:v[7]||(v[7]=_=>h(vue.unref(EScaleInfoType).BottomRight,_))},null,44,_hoisted_11$1),[[vue.vShow,vue.unref(f)]])]))}}),handlePanel_vue_vue_type_style_index_0_scoped_e6622df8_lang="",HandlePanel=_export_sfc$1(_sfc_main$B,[["__scopeId","data-v-e6622df8"]]),_hoisted_1$a=["fill"],_hoisted_2$8=["cx","cy","r"],_hoisted_3$7=["cx","cy","r"],_hoisted_4$5=["cx","cy","r"],_hoisted_5$4=["cx","cy","r"],_hoisted_6$3=["cx","cy","r"],_hoisted_7$3=["cx","cy","r"],_hoisted_8$3=["cx","cy","r"],_hoisted_9$2=["cx","cy","r"],_sfc_main$A=vue.defineComponent({__name:"connection-panel",props:{itemInfo:{}},setup(i){const r=i,n=vue.ref(4),o=vue.ref("#ab712e"),a=vue.ref(4),u=vue.ref(12),c=useGlobalStore(pinia),d=useSvgEditLayoutStore(pinia),f=vue.computed(()=>r.itemInfo.actual_bound.x+r.itemInfo.actual_bound.width/2-n.value+a.value),h=vue.computed(()=>r.itemInfo.actual_bound.y-n.value-getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),y=vue.computed(()=>r.itemInfo.actual_bound.x-n.value+r.itemInfo.actual_bound.width+getCoordinateOffset(r.itemInfo.actual_bound.width,r.itemInfo.scale_x)+a.value),g=vue.computed(()=>r.itemInfo.actual_bound.y-n.value+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),p=vue.computed(()=>r.itemInfo.actual_bound.x-n.value+r.itemInfo.actual_bound.width/2+a.value),v=vue.computed(()=>r.itemInfo.actual_bound.y-n.value+r.itemInfo.actual_bound.height+getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),_=vue.computed(()=>r.itemInfo.actual_bound.x-n.value-getCoordinateOffset(r.itemInfo.actual_bound.width,r.itemInfo.scale_x)+a.value),b=vue.computed(()=>r.itemInfo.actual_bound.y-n.value+r.itemInfo.actual_bound.height*r.itemInfo.scale_y/2-getCoordinateOffset(r.itemInfo.actual_bound.height,r.itemInfo.scale_y)+a.value),A=(T,S)=>{var x;c.intention===EGlobalStoreIntention.SetConnectionLineNode&&(T.stopPropagation(),(x=c.handle_svg_info)!=null&&x.info.bind_anchors&&c.connection_line_node_info&&(c.connection_line_node_info.point_index===0?c.handle_svg_info.info.bind_anchors.start={type:S,target_id:r.itemInfo.id}:c.connection_line_node_info.point_index===c.handle_svg_info.info.props.point_position.val.length-1&&(c.handle_svg_info.info.bind_anchors.end={type:S,target_id:r.itemInfo.id}),c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(r.itemInfo)})))},w=(T,S)=>{var x;c.intention===EGlobalStoreIntention.None?(createLine(T,S,r.itemInfo),c.handle_svg_info&&(c.handle_svg_info.info.props.point_position.val.length!==1?c.handle_svg_info.info.props.point_position.val.push({x:c.mouse_info.new_position_x-c.mouse_info.position_x-d.center_offset.x,y:c.mouse_info.new_position_y-c.mouse_info.position_y-d.center_offset.y}):c.handle_svg_info.info.props.point_position.val.push({x:0,y:0}))):c.intention===EGlobalStoreIntention.Connection&&(T.stopPropagation(),(x=c.handle_svg_info)!=null&&x.info.bind_anchors&&(c.handle_svg_info.info.bind_anchors.end={type:S,target_id:r.itemInfo.id},c.intention=EGlobalStoreIntention.None,c.setHandleSvgInfo(null),vue.nextTick(function(){moveAnchors(r.itemInfo)})))};return(T,S)=>(vue.openBlock(),vue.createElementBlock("g",{style:{"vector-effect":"non-scaling-stroke"},class:"connect-points",fill:vue.unref(o),"stroke-width":"2",stroke:"rgba(0,0,0,0)"},[vue.createElementVNode("g",{onMousedown:S[0]||(S[0]=x=>w(x,vue.unref(ELineBindAnchors).TopCenter)),onMouseup:S[1]||(S[1]=x=>A(x,vue.unref(ELineBindAnchors).TopCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(f),cy:vue.unref(h),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_2$8),vue.createElementVNode("circle",{id:"connection_tc",cx:vue.unref(f),cy:vue.unref(h),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_3$7)],32),vue.createElementVNode("g",{onMousedown:S[2]||(S[2]=x=>w(x,vue.unref(ELineBindAnchors).Right)),onMouseup:S[3]||(S[3]=x=>A(x,vue.unref(ELineBindAnchors).Right))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(y),cy:vue.unref(g),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_4$5),vue.createElementVNode("circle",{id:"connection_r",cx:vue.unref(y),cy:vue.unref(g),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_5$4)],32),vue.createElementVNode("g",{onMousedown:S[4]||(S[4]=x=>w(x,vue.unref(ELineBindAnchors).BottomCenter)),onMouseup:S[5]||(S[5]=x=>A(x,vue.unref(ELineBindAnchors).BottomCenter))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(p),cy:vue.unref(v),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_6$3),vue.createElementVNode("circle",{id:"connection_bc",cx:vue.unref(p),cy:vue.unref(v),r:vue.unref(a),"pointer-events":"all"},null,8,_hoisted_7$3)],32),vue.createElementVNode("g",{onMousedown:S[6]||(S[6]=x=>w(x,vue.unref(ELineBindAnchors).Left)),onMouseup:S[7]||(S[7]=x=>A(x,vue.unref(ELineBindAnchors).Left))},[vue.createElementVNode("circle",{class:"out-circle",cx:vue.unref(_),cy:vue.unref(b),r:vue.unref(u),"fill-opacity":".3"},null,8,_hoisted_8$3),vue.createElementVNode("circle",{id:"connection_l",cx:vue.unref(_),cy:vue.unref(b),r:vue.unref(a),style:{cursor:"crosshair"},"pointer-events":"all"},null,8,_hoisted_9$2)],32)],8,_hoisted_1$a))}}),connectionPanel_vue_vue_type_style_index_0_scoped_fb729c7a_lang="",ConnectionPanel=_export_sfc$1(_sfc_main$A,[["__scopeId","data-v-fb729c7a"]]),_hoisted_1$9=["d","stroke-width"],_hoisted_2$7=["d","stroke-width"],_hoisted_3$6=["id","d","stroke","stroke-width","stroke-dasharray"],_hoisted_4$4=["from","to","dur","repeatCount"],_hoisted_5$3=["d","stroke","stroke-width","stroke-dasharray"],_hoisted_6$2=["from","to","dur","repeatCount"],_hoisted_7$2=["r","fill"],_hoisted_8$2=["path","dur","repeatCount"],_hoisted_9$1=["cx","cy","r","stroke-width"],_hoisted_10$1=["cx","cy","r","stroke","onMousedown"],_sfc_main$z=vue.defineComponent({__name:"connection-line",props:{itemInfo:{},pointVisible:{type:Boolean,default:!1}},setup(i){const r=i,n=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=(c,d,f,h)=>{if(n.intention===EGlobalStoreIntention.Connection)return;n.setHandleSvgInfo(r.itemInfo);const{clientX:y,clientY:g}=d;d.stopPropagation(),n.connection_line_node_info={init_pos:{x:f,y:h},point_index:c},n.intention=EGlobalStoreIntention.SetConnectionLineNode,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((y-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((g-a.canvasInfo.top)/o.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0}};return(c,d)=>{var f,h,y,g,p,v;return vue.openBlock(),vue.createElementBlock("g",{style:vue.normalizeStyle({cursor:vue.unref(n).intention===vue.unref(EGlobalStoreIntention).Connection?"crosshair":"move"})},[vue.withDirectives(vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#DE4517","stroke-width":Math.ceil(r.itemInfo.props["stroke-width"].val*1.2)+1,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_1$9),[[vue.vShow,r.itemInfo.selected||r.itemInfo.id===((f=vue.unref(n).handle_svg_info)==null?void 0:f.info.id)]]),vue.createElementVNode("path",{d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:"#fff","stroke-opacity":".01","stroke-width":r.itemInfo.props["stroke-width"].val,"stroke-linecap":"round","stroke-linejoin":"round"},null,8,_hoisted_2$7),vue.createElementVNode("path",{id:r.itemInfo.id,d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none",stroke:((h=r.itemInfo.animations)==null?void 0:h.type.val)===vue.unref(EConfigAnimationsType).Electricity?r.itemInfo.animations.color.val:r.itemInfo.props.stroke.val,"stroke-width":r.itemInfo.props["stroke-width"].val,"stroke-dashoffset":"0","stroke-dasharray":((y=r.itemInfo.animations)==null?void 0:y.type.val)===vue.unref(EConfigAnimationsType).Electricity?r.itemInfo.props["stroke-width"].val*3:0,"stroke-linejoin":"round"},[((g=r.itemInfo.animations)==null?void 0:g.type.val)===vue.unref(EConfigAnimationsType).Electricity?(vue.openBlock(),vue.createElementBlock("animate",{key:0,attributeName:"stroke-dashoffset",from:r.itemInfo.animations.reverse.val?0:1e3,to:r.itemInfo.animations.reverse.val?1e3:0,dur:`${r.itemInfo.animations.dur.val}s`,repeatCount:r.itemInfo.animations.repeatCount.val},null,8,_hoisted_4$4)):vue.createCommentVNode("",!0)],8,_hoisted_3$6),((p=r.itemInfo.animations)==null?void 0:p.type.val)===vue.unref(EConfigAnimationsType).WaterDrop?(vue.openBlock(),vue.createElementBlock("path",{key:0,d:vue.unref(positionArrToPath)(r.itemInfo.props.point_position.val),fill:"none","fill-opacity":"0",stroke:r.itemInfo.animations.color.val,"stroke-width":r.itemInfo.props["stroke-width"].val,"stroke-dasharray":r.itemInfo.props["stroke-width"].val*3,"stroke-dashoffset":"0","stroke-linecap":"round","stroke-linejoin":"round"},[vue.createElementVNode("animate",{attributeName:"stroke-dashoffset",from:r.itemInfo.animations.reverse.val?0:1e3,to:r.itemInfo.animations.reverse.val?1e3:0,dur:`${r.itemInfo.animations.dur.val}s`,repeatCount:r.itemInfo.animations.repeatCount.val,fill:"freeze"},null,8,_hoisted_6$2)],8,_hoisted_5$3)):((v=r.itemInfo.animations)==null?void 0:v.type.val)===vue.unref(EConfigAnimationsType).Track?(vue.openBlock(),vue.createElementBlock("circle",{key:1,cx:"0",cy:"0",r:Math.ceil(r.itemInfo.props["stroke-width"].val*.6)+2,fill:r.itemInfo.animations.color.val},[vue.createElementVNode("animateMotion",{path:vue.unref(positionArrToPath)(r.itemInfo.animations.reverse.val?[...r.itemInfo.props.point_position.val].reverse():r.itemInfo.props.point_position.val),dur:`${r.itemInfo.animations.dur.val}s`,repeatCount:r.itemInfo.animations.repeatCount.val},null,8,_hoisted_8$2)],8,_hoisted_7$2)):vue.createCommentVNode("",!0),vue.createElementVNode("g",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.itemInfo.props.point_position.val,(_,b)=>{var A;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("circle",{key:b,cx:_.x,cy:_.y,r:r.itemInfo.props.point_r.val+1,fill:"none","fill-opacity":"0","stroke-width":Math.ceil(r.itemInfo.props.point_r.val*.2)+1,stroke:"#DE4517"},null,8,_hoisted_9$1)),[[vue.vShow,r.itemInfo.selected||r.itemInfo.id===((A=vue.unref(n).handle_svg_info)==null?void 0:A.info.id)]])}),128)),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.itemInfo.props.point_position.val,(_,b)=>(vue.openBlock(),vue.createElementBlock("circle",{key:b,cx:_.x,cy:_.y,r:r.itemInfo.props.point_r.val,"stroke-width":"1",stroke:r.itemInfo.props.stroke.val,fill:"#fff",style:{cursor:"pointer"},onMousedown:A=>u(b,A,_.x,_.y)},null,40,_hoisted_10$1))),128))])],4)}}}),_hoisted_1$8={class:"coverLayer"},_hoisted_2$6={xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%"},_hoisted_3$5={id:"pattern_grid",patternUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},_hoisted_4$3=["stroke"],_hoisted_5$2=["stroke"],_hoisted_6$1=["stroke"],_hoisted_7$1=["stroke"],_hoisted_8$1={key:0,width:"100%",height:"100%",fill:"url(#pattern_grid)"},_hoisted_9=["transform"],_hoisted_10=["transform"],_hoisted_11=["transform","onMousedown","onMouseup","onMouseenter","onMouseleave","onContextmenu"],_hoisted_12=["xlink:href","width","height","id","transform"],_hoisted_13=["id"],_hoisted_14=["id","x1","y1","x2","y2"],_hoisted_15=["id"],_hoisted_16=["x","y","height","width"],_hoisted_17=["onClick"],_hoisted_18={class:"shortcut"},_sfc_main$y=vue.defineComponent({__name:"center-panel",props:{vueComp:{}},setup(i,{expose:r}){vue.useCssVars(Ie=>({"32de9888":vue.unref(g)}));const n=useGlobalStore(pinia),o=useConfigStore(pinia),a=useSvgEditLayoutStore(pinia),u=useEditPrivateStore(pinia),c=useContextMenuStore(pinia);componentsRegister(i.vueComp);const f=vue.ref(),h=vue.ref(),y={MoveCanvas:"grab",Rotate:"url('/src/assets/icons/rotate.svg'), auto",Connection:"crosshair",SetConnectionLineNode:"crosshair"},g=vue.computed(()=>Object.keys(y).indexOf(n.intention)>-1?y[n.intention]:"default"),p=vue.reactive({handle_panel:vue.computed(()=>n.intention===EGlobalStoreIntention.Select||n.intention===EGlobalStoreIntention.Zoom||n.intention===EGlobalStoreIntention.Rotate),connection_panel:!1,connection_line:!1,select_item:{info:null,index:-1}}),v=vue.ref({a:{x:0,y:0},b:{x:0,y:0}}),_=vue.computed(()=>n.intention===EGlobalStoreIntention.SelectArea&&v.value.b.x&&v.value.b.y?{with:Math.abs(v.value.b.x-v.value.a.x),height:Math.abs(v.value.b.y-v.value.a.y),x:v.value.a.x<v.value.b.x?v.value.a.x:v.value.b.x,y:v.value.a.y<v.value.b.y?v.value.a.y:v.value.b.y}:{with:0,height:0,x:0,y:0}),b=vue.computed(()=>{let Ie=0;for(let At of n.done_json)At.selected&&Ie++;return Ie>0});let A=!1,w=!1;const T=Ie=>{var At;if(n.intention!=EGlobalStoreIntention.None){if(n.intention==EGlobalStoreIntention.Create){if(!n.create_svg_info){console.error("要创建的数据获取失败");return}const _e=Math.floor(Ie.offsetX/o.svg.scale-a.center_offset.x),qe=Math.floor(Ie.offsetY/o.svg.scale-a.center_offset.y),In={id:randomString(),x:_e,y:qe,client:{x:_e,y:qe},scale_x:1,scale_y:1,rotate:0,actual_bound:{x:0,y:0,width:0,height:0},center_position:{x:0,y:0},point_coordinate:{tl:{x:0,y:0},tc:{x:0,y:0},tr:{x:0,y:0},l:{x:0,y:0},r:{x:0,y:0},bl:{x:0,y:0},bc:{x:0,y:0},br:{x:0,y:0}},selected:!1,...objectDeepClone(n.create_svg_info)};n.setDoneJson(In),n.setHandleSvgInfo(In,n.done_json.length),n.intention=EGlobalStoreIntention.None}(At=h.value)==null||At.focus()}},S=Ie=>{Ie.preventDefault()},x=Ie=>{Ie.preventDefault()},L=(Ie,At,_e)=>{var qe,In,vn;if((qe=h.value)==null||qe.focus(),n.intention===EGlobalStoreIntention.Connection){_e.stopPropagation();return}if(_e.preventDefault(),_e.stopPropagation(),_e.ctrlKey&&_e.button===0)((In=n.handle_svg_info)!=null&&In.index||((vn=n.handle_svg_info)==null?void 0:vn.index)===0)&&(n.done_json[n.handle_svg_info.index].selected=!0,n.setHandleSvgInfo(null),n.intention=EGlobalStoreIntention.None),Ie.selected=!Ie.selected;else if(b.value){n.intention=EGlobalStoreIntention.GroupMove,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((_e.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0};for(let Pt of n.done_json)Pt.selected&&(Pt.old_position={x:Pt.x,y:Pt.y},Pt.point_coordinate_old=objectDeepClone(Pt.point_coordinate))}else n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo(Ie,At),n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((_e.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:Ie.x,now_position_y:Ie.y,new_position_x:0,new_position_y:0},Ie.point_coordinate_old=objectDeepClone(Ie.point_coordinate)},M=(Ie,At,_e)=>{if(!(n.intention===EGlobalStoreIntention.Connection||n.mouse_info.state!=EMouseInfoState.Down)&&b.value&&!A&&["SelectArea","Move","Select"].indexOf(n.intention)<0){for(let qe of n.done_json)qe.selected=!1,qe.old_position={x:0,y:0},resetHandlePointOld(qe);n.intention=EGlobalStoreIntention.Select,n.setHandleSvgInfo(Ie,At),n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((_e.clientX-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e.clientY-a.canvasInfo.top)/o.svg.scale),now_position_x:Ie.x,now_position_y:Ie.y,new_position_x:0,new_position_y:0}}},O=(Ie,At,_e)=>{_e.preventDefault(),_e.stopPropagation(),p.connection_panel=!0,p.connection_line=!0,!((n.intention===EGlobalStoreIntention.Connection||n.intention===EGlobalStoreIntention.SetConnectionLineNode)&&Ie.type===EDoneJsonType.ConnectionLine)&&(p.select_item.info=Ie,p.select_item.index=At)},ie=(Ie,At,_e)=>{_e.preventDefault(),_e.stopPropagation(),!((n.intention===EGlobalStoreIntention.Connection||n.intention===EGlobalStoreIntention.SetConnectionLineNode)&&Ie.type===EDoneJsonType.ConnectionLine)&&(p.connection_panel=!1,p.connection_line=!1,p.select_item.info=null,p.select_item.index=-1)},$=Ie=>{var vn,Pt,he,Ue,Dt,jt,Et,Ce,ue,$e,Ne,Oe,Lt,kt,Cn,oe;if(n.mouse_info.state!=EMouseInfoState.Down&&n.intention!==EGlobalStoreIntention.Connection)return;const{clientX:At,clientY:_e}=Ie;n.mouse_info.new_position_x=Math.round((At-a.canvasInfo.left)/o.svg.scale),n.mouse_info.new_position_y=Math.round((_e-a.canvasInfo.top)/o.svg.scale);const qe=Math.round(n.mouse_info.new_position_x-n.mouse_info.position_x+n.mouse_info.now_position_x),In=Math.round(n.mouse_info.new_position_y-n.mouse_info.position_y+n.mouse_info.now_position_y);if((vn=n.handle_svg_info)!=null&&vn.info&&(n.intention===EGlobalStoreIntention.Select||n.intention===EGlobalStoreIntention.Move)){if(n.handle_svg_info.info.x=qe,n.handle_svg_info.info.y=In,n.handle_svg_info.info.client={x:qe,y:In},n.intention=EGlobalStoreIntention.Move,moveHandlePoint(n.handle_svg_info.info),moveAnchors(n.handle_svg_info.info),n.handle_svg_info.info.type===EDoneJsonType.ConnectionLine){if((Pt=n.handle_svg_info.info.bind_anchors)!=null&&Pt.start){let ae=null;for(let Y of n.done_json)Y.id===((Ue=(he=n.handle_svg_info.info.bind_anchors)==null?void 0:he.start)==null?void 0:Ue.target_id)&&(ae=Y);ae&&moveAnchors(ae)}if((Dt=n.handle_svg_info.info.bind_anchors)!=null&&Dt.end){let ae=null;for(let Y of n.done_json)Y.id===((Et=(jt=n.handle_svg_info.info.bind_anchors)==null?void 0:jt.end)==null?void 0:Et.target_id)&&(ae=Y);ae&&moveAnchors(ae)}}}else if(n.intention===EGlobalStoreIntention.MoveCanvas)a.center_offset.x=qe,a.center_offset.y=In;else if(n.intention===EGlobalStoreIntention.SelectArea)v.value.b.x=n.mouse_info.new_position_x-a.center_offset.x,v.value.b.y=n.mouse_info.new_position_y-a.center_offset.y;else if(n.intention===EGlobalStoreIntention.GroupMove){A=!0;for(let ae of n.done_json)if(ae.selected&&ae.old_position){const Y=Math.round(n.mouse_info.new_position_x-n.mouse_info.position_x+ae.old_position.x),k=Math.round(n.mouse_info.new_position_y-n.mouse_info.position_y+ae.old_position.y);if(ae.x=Y,ae.y=k,ae.client={x:Y,y:k},moveHandlePoint(ae),moveAnchors(ae),ae.type===EDoneJsonType.ConnectionLine&&((Ce=ae.bind_anchors)!=null&&Ce.end)){let D=null;for(let j of n.done_json)j.id===(($e=(ue=ae.bind_anchors)==null?void 0:ue.end)==null?void 0:$e.target_id)&&(D=j);D&&moveAnchors(D)}}}else if(n.intention===EGlobalStoreIntention.Zoom){if(!n.handle_svg_info)return;const ae={x:n.mouse_info.new_position_x-a.center_offset.x,y:n.mouse_info.new_position_y-a.center_offset.y};let Y={width:0,height:0,is_old_width:!1,is_old_height:!1};if(n.scale_info.type===EScaleInfoType.TopLeft?Y=calculateLeftTop(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.TopRight?Y=calculateRightTop(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.BottomRight?Y=calculateRightBottom(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.BottomLeft?Y=calculateLeftBottom(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate):n.scale_info.type===EScaleInfoType.TopCenter?Y=calculateTop(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client):n.scale_info.type===EScaleInfoType.Right?Y=calculateRight(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client):n.scale_info.type===EScaleInfoType.BottomCenter?Y=calculateBottom(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client):n.scale_info.type===EScaleInfoType.Left&&(Y=calculateLeft(ae,n.scale_info.symmetric_point,n.handle_svg_info.info.rotate,n.handle_svg_info.info.client)),n.handle_svg_info&&Y.width>0&&Y.height>0){const k=Y.is_old_width?1:myFixed(Y.width/n.handle_svg_info.info.actual_bound.width,3),D=Y.is_old_height?1:myFixed(Y.height/n.handle_svg_info.info.actual_bound.height,3),j=getCenterPoint(ae,n.scale_info.symmetric_point);k>0&&n.scale_info.type!==EScaleInfoType.TopCenter&&n.scale_info.type!==EScaleInfoType.BottomCenter&&(n.handle_svg_info.info.scale_x=k,n.handle_svg_info.info.x=Math.round(getSvgNowPosition(n.handle_svg_info.info.center_position.x,j.x,n.handle_svg_info.info.client.x))),D>0&&n.scale_info.type!==EScaleInfoType.Left&&n.scale_info.type!==EScaleInfoType.Right&&(n.handle_svg_info.info.scale_y=D,n.handle_svg_info.info.y=Math.round(getSvgNowPosition(n.handle_svg_info.info.center_position.y,j.y,n.handle_svg_info.info.client.y)))}}else if(n.intention===EGlobalStoreIntention.Rotate){if(!n.handle_svg_info)return;const ae=Math.atan2(n.mouse_info.position_y-n.handle_svg_info.info.y,n.mouse_info.position_x-n.handle_svg_info.info.x)/(Math.PI/180),Y=Math.atan2(n.mouse_info.new_position_y-a.center_offset.y-n.handle_svg_info.info.y,n.mouse_info.new_position_x-a.center_offset.x-n.handle_svg_info.info.x)/(Math.PI/180);n.handle_svg_info.info.rotate=myFixed(n.rotate_info.angle+Y-ae,2)}else if(n.intention===EGlobalStoreIntention.Connection&&n.handle_svg_info){const ae=(Ne=n.handle_svg_info)==null?void 0:Ne.info.props.point_position.val.length,Y=n.mouse_info.new_position_x-n.mouse_info.position_x-a.center_offset.x,k=n.mouse_info.new_position_y-n.mouse_info.position_y-a.center_offset.y,D=n.handle_svg_info.info.props.point_position.val[ae-2],j=((Lt=(Oe=n.handle_svg_info)==null?void 0:Oe.info.props.point_r)==null?void 0:Lt.val)+2||4;let xe=D.x<Y?-j:D.x>Y?j:0,hn=D.y<k?-j:D.y>k?j:0;Ie.ctrlKey?n.handle_svg_info.info.props.point_position.val[ae-1]={x:D.x,y:k+hn}:Ie.shiftKey?n.handle_svg_info.info.props.point_position.val[ae-1]={x:Y+xe,y:D.y}:n.handle_svg_info.info.props.point_position.val[ae-1]={x:Y+xe,y:k+hn}}else if(n.intention===EGlobalStoreIntention.SetConnectionLineNode&&n.handle_svg_info){!w&&(n.connection_line_node_info.point_index===n.handle_svg_info.info.props.point_position.val.length-1||n.connection_line_node_info.point_index===0)&&(w=!0);const ae=(kt=n.handle_svg_info)==null?void 0:kt.info.props.point_position.val.length,Y=getSvgNowPosition(n.mouse_info.position_x,n.mouse_info.new_position_x,n.connection_line_node_info.init_pos.x),k=getSvgNowPosition(n.mouse_info.position_y,n.mouse_info.new_position_y,n.connection_line_node_info.init_pos.y),D=n.handle_svg_info.info.props.point_position.val[ae-2],j=((oe=(Cn=n.handle_svg_info)==null?void 0:Cn.info.props.point_r)==null?void 0:oe.val)+2||4;let xe=D.x<Y?-j:D.x>Y?j:0,hn=D.y<k?-j:D.y>k?j:0;n.handle_svg_info.info.props.point_position.val[n.connection_line_node_info.point_index]={x:Y+xe,y:k+hn}}},z=()=>{var Ie,At,_e,qe;if(n.mouse_info.state==EMouseInfoState.Down){if((Ie=n.handle_svg_info)!=null&&Ie.info&&n.intention==EGlobalStoreIntention.Move)setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.intention=EGlobalStoreIntention.None,n.setDoneJson(n.done_json);else if(n.intention==EGlobalStoreIntention.GroupMove)A&&(A=!1,n.intention=EGlobalStoreIntention.None);else if((At=n.handle_svg_info)!=null&&At.info&&n.intention==EGlobalStoreIntention.Zoom)n.handle_svg_info.info.client={x:n.handle_svg_info.info.x,y:n.handle_svg_info.info.y},n.intention=EGlobalStoreIntention.None,setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.setDoneJson(n.done_json);else if(n.intention===EGlobalStoreIntention.Rotate&&((_e=n.handle_svg_info)!=null&&_e.info))setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.setDoneJson(n.done_json),n.intention=EGlobalStoreIntention.None;else{if(n.intention===EGlobalStoreIntention.Connection)return;if(n.intention===EGlobalStoreIntention.SetConnectionLineNode)w&&((qe=n.handle_svg_info)!=null&&qe.info.bind_anchors)&&(n.connection_line_node_info.point_index===0?n.handle_svg_info.info.bind_anchors.start=null:n.handle_svg_info.info.bind_anchors.end=null),n.intention=EGlobalStoreIntention.None,w=!1;else if(n.intention===EGlobalStoreIntention.SelectArea){n.setHandleSvgInfo(null);for(let In of n.done_json){const vn=_.value;In.selected=In.x>vn.x&&In.x<vn.x+vn.with&&In.y>vn.y&&In.y<vn.y+vn.height}n.intention=EGlobalStoreIntention.None}else n.intention!=EGlobalStoreIntention.Select&&(n.intention=EGlobalStoreIntention.None)}n.mouse_info={state:EMouseInfoState.Up,position_x:0,position_y:0,now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},c.display=!1}},V=Ie=>{const{clientX:At,clientY:_e}=Ie;if(n.intention===EGlobalStoreIntention.Connection){n.handle_svg_info||createLine(Ie),n.handle_svg_info&&(Ie.button===0?n.handle_svg_info.info.props.point_position.val.length!==1?n.handle_svg_info.info.props.point_position.val.push({x:n.mouse_info.new_position_x-n.mouse_info.position_x-a.center_offset.x,y:n.mouse_info.new_position_y-n.mouse_info.position_y-a.center_offset.y}):n.handle_svg_info.info.props.point_position.val.push({x:0,y:0}):Ie.button===2&&(n.intention=EGlobalStoreIntention.None,setSvgActualInfo(n.done_json[n.handle_svg_info.index]),n.setHandleSvgInfo(null)));return}Ie.button===0?(n.intention=EGlobalStoreIntention.SelectArea,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((At-a.canvasInfo.left)/o.svg.scale-a.center_offset.x),position_y:Math.round((_e-a.canvasInfo.top)/o.svg.scale-a.center_offset.y),now_position_x:0,now_position_y:0,new_position_x:0,new_position_y:0},v.value={a:{x:n.mouse_info.position_x,y:n.mouse_info.position_y},b:{x:0,y:0}}):Ie.button===2&&(n.intention=EGlobalStoreIntention.MoveCanvas,n.mouse_info={state:EMouseInfoState.Down,position_x:Math.round((At-a.canvasInfo.left)/o.svg.scale),position_y:Math.round((_e-a.canvasInfo.top)/o.svg.scale),now_position_x:a.center_offset.x,now_position_y:a.center_offset.y,new_position_x:0,new_position_y:0})};function re(Ie){Ie!=null&&Ie.wheelDelta&&(Ie.wheelDelta>0?(o.svg.scale=myFixed(o.svg.scale+.1,1),getZoomPosition(Ie,o.svg.scale,a.center_offset,!0)):o.svg.scale>.1&&(o.svg.scale=myFixed(o.svg.scale-.1,1),getZoomPosition(Ie,o.svg.scale,a.center_offset,!1)))}const F=Ie=>{Ie.stopPropagation(),Ie.preventDefault()},pe=(Ie,At,_e)=>{n.intention!==EGlobalStoreIntention.Connection&&f.value&&(n.intention=EGlobalStoreIntention.ContextMenu,n.setHandleSvgInfo(Ie,At),f.value.style.left=_e.pageX+"px",f.value.style.top=_e.pageY+"px",c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!0,At===n.done_json.length-1&&(c.info.MoveUpOneLevel.enable=c.info.MoveUpTopLevel.enable=!1),At===0&&(c.info.MoveDownOneLevel.enable=c.info.MoveDownTopLevel.enable=!1),c.display=!0)},le=(Ie,At,_e)=>({x:myFixed(Ie.x-Ie.width/2*At+Ie.width/2,1),y:myFixed(Ie.y-Ie.height/2*_e+Ie.height/2,1),width:myFixed(Ie.width*At,1),height:myFixed(Ie.height*_e,1)}),de=Ie=>{Ie.preventDefault();let At=[];if(!Ie.ctrlKey&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].indexOf(Ie.key)>-1&&(b.value?At=n.done_json.map((_e,qe)=>({selected:_e.selected,i:qe})).filter(_e=>_e.selected).map(_e=>_e.i):n.handle_svg_info&&At.push(n.handle_svg_info.index)),!Ie.ctrlKey&&Ie.key=="ArrowUp"){for(let _e of At)n.done_json[_e].y-=1,n.done_json[_e].client.y-=1,moveHandlePoint(n.done_json[_e],0,-1),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else if(!Ie.ctrlKey&&Ie.key=="ArrowDown"){for(let _e of At)n.done_json[_e].y+=1,n.done_json[_e].client.y+=1,moveHandlePoint(n.done_json[_e],0,1),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else if(!Ie.ctrlKey&&Ie.key=="ArrowLeft"){for(let _e of At)n.done_json[_e].x-=1,n.done_json[_e].client.x-=1,moveHandlePoint(n.done_json[_e],-1,0),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else if(!Ie.ctrlKey&&Ie.key=="ArrowRight"){for(let _e of At)n.done_json[_e].x+=1,n.done_json[_e].client.x+=1,moveHandlePoint(n.done_json[_e],1,0),moveAnchors(n.done_json[_e]);useHistoryRecord(n.done_json)}else Ie.ctrlKey&&Ie.key.toLowerCase()=="c"?c.onContextMenuClick(EContextMenuInfoType.Copy):!Ie.ctrlKey&&Ie.key=="Delete"?b.value?(n.setDoneJson(n.done_json.filter(_e=>!_e.selected)),n.setHandleSvgInfo(n.done_json[n.done_json.length-1],n.done_json.length-1)):c.onContextMenuClick(EContextMenuInfoType.Delete):Ie.ctrlKey&&Ie.key=="ArrowUp"?c.onContextMenuClick(EContextMenuInfoType.MoveUpOneLevel):Ie.ctrlKey&&Ie.key=="ArrowDown"?c.onContextMenuClick(EContextMenuInfoType.MoveDownOneLevel):Ie.ctrlKey&&Ie.key=="ArrowLeft"?c.onContextMenuClick(EContextMenuInfoType.MoveDownTopLevel):Ie.ctrlKey&&Ie.key=="ArrowRight"?c.onContextMenuClick(EContextMenuInfoType.MoveUpTopLevel):Ie.ctrlKey&&Ie.shiftKey&&Ie.key.toLowerCase()=="z"?u.topRedoBtnClick():Ie.ctrlKey&&Ie.key.toLowerCase()=="z"?u.topUndoBtnClick():Ie.ctrlKey&&Ie.key.toLowerCase()=="delete"&&(n.done_json.length<=0||n.setDoneJson([]))},Fe=()=>{setSvgActualInfo(n.done_json[n.handle_svg_info.index],!0)};return vue.onMounted(()=>{var Ie;(Ie=h.value)==null||Ie.focus(),vue.nextTick(function(){var _e;const At=(_e=h.value)==null?void 0:_e.getBoundingClientRect();a.canvasInfo={height:(At==null?void 0:At.height)||0,with:(At==null?void 0:At.width)||0,top:(At==null?void 0:At.top)||0,left:(At==null?void 0:At.left)||0}})}),r({onCanvasMouseUp:z}),(Ie,At)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",{ref_key:"canvasRef",ref:h,class:"canvas",style:vue.normalizeStyle({backgroundColor:vue.unref(o).svg.background_color,position:"relative"}),tabindex:"0",onDrop:T,onDragenter:S,onDragover:x,onMousedown:V,onMousemove:$,onMouseup:z,onContextmenu:F,onKeydown:de,onMousewheel:re},[vue.renderSlot(Ie.$slots,"background",{},void 0,!0),vue.createElementVNode("div",_hoisted_1$8,[(vue.openBlock(),vue.createElementBlock("svg",_hoisted_2$6,[vue.createElementVNode("defs",null,[vue.createElementVNode("pattern",_hoisted_3$5,[vue.createElementVNode("line",{x1:"0",y1:"0",x2:"0",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_4$3),vue.createElementVNode("line",{x1:"10",y1:"0",x2:"10",y2:"20",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_5$2),vue.createElementVNode("line",{x1:"0",y1:"0",x2:"20",y2:"0",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_6$1),vue.createElementVNode("line",{x1:"0",y1:"10",x2:"20",y2:"10",stroke:vue.unref(o).svg.grid_color},null,8,_hoisted_7$1)])]),vue.unref(o).svg.grid?(vue.openBlock(),vue.createElementBlock("rect",_hoisted_8$1)):vue.createCommentVNode("",!0),vue.createElementVNode("g",{transform:`translate(${vue.unref(a).center_offset.x*vue.unref(o).svg.scale},${vue.unref(a).center_offset.y*vue.unref(o).svg.scale})rotate(0)scale(${vue.unref(o).svg.scale})`},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(n).done_json,(_e,qe)=>{var In,vn,Pt,he,Ue,Dt,jt,Et,Ce,ue,$e,Ne,Oe,Lt;return vue.withDirectives((vue.openBlock(),vue.createElementBlock("g",{key:_e.id,transform:`translate(${_e.x},${_e.y})rotate(0)scale(1)`},[vue.createElementVNode("g",{class:vue.normalizeClass(`${vue.unref(getCommonClass)(_e)}`)},[vue.createElementVNode("g",{transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2})rotate(${_e.rotate}) scale(1) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`,onMousedown:kt=>L(_e,qe,kt),onMouseup:kt=>M(_e,qe,kt),onMouseenter:kt=>O(_e,qe,kt),onMouseleave:kt=>ie(_e,qe,kt),onContextmenu:kt=>pe(_e,qe,kt)},[_e.type===vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(_sfc_main$z,{key:0,"item-info":_e,"point-visible":vue.unref(p).connection_line&&((In=vue.unref(p).select_item.info)==null?void 0:In.id)==_e.id},null,8,["item-info","point-visible"])):_e.type===vue.unref(EDoneJsonType).File?(vue.openBlock(),vue.createElementBlock("use",vue.mergeProps({key:1,"xlink:href":`#svg-${_e.name}`,ref_for:!0},vue.unref(prosToVBind)(_e,["height","width"]),{width:((Pt=(vn=_e.props)==null?void 0:vn.width)==null?void 0:Pt.val)??100,height:((Ue=(he=_e.props)==null?void 0:he.height)==null?void 0:Ue.val)??100,id:_e.id,transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2}) scale(${_e.scale_x},${_e.scale_y}) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`}),null,16,_hoisted_12)):_e.type===vue.unref(EDoneJsonType).CustomSvg?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(_e.tag),vue.mergeProps({key:2,ref_for:!0},vue.unref(prosToVBind)(_e,["height","width"]),{width:((jt=(Dt=_e.props)==null?void 0:Dt.width)==null?void 0:jt.val)??100,height:((Ce=(Et=_e.props)==null?void 0:Et.height)==null?void 0:Ce.val)??100,id:_e.id,onResize:Fe,transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2}) scale(${_e.scale_x},${_e.scale_y}) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`}),null,16,["width","height","id","transform"])):_e.type===vue.unref(EDoneJsonType).Vue?(vue.openBlock(),vue.createElementBlock("foreignObject",vue.mergeProps({key:3,ref_for:!0},le(_e.actual_bound,_e.scale_x,_e.scale_y),{id:`foreign-object${_e.id}`,class:"foreignObject"}),[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(_e.tag),vue.mergeProps({ref_for:!0},vue.unref(prosToVBind)(_e),{id:_e.id,transform:`translate(${_e.actual_bound.x+_e.actual_bound.width/2},${_e.actual_bound.y+_e.actual_bound.height/2}) scale(${_e.scale_x},${_e.scale_y}) translate(${-(_e.actual_bound.x+_e.actual_bound.width/2)},${-(_e.actual_bound.y+_e.actual_bound.height/2)})`}),{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(_e.tag_slot),1)]),_:2},1040,["id","transform"]))],16,_hoisted_13)):_e.type===vue.unref(EDoneJsonType).StraightLine?(vue.openBlock(),vue.createElementBlock("line",{key:4,id:_e.id,x1:_e.props.start_x.val,y1:_e.props.start_y.val,x2:_e.props.end_x.val,y2:_e.props.end_y.val,fill:"#FF0000",stroke:"#FF0000","stroke-width":"2"},null,8,_hoisted_14)):vue.createCommentVNode("",!0),_e.config.actual_rect?(vue.openBlock(),vue.createElementBlock("rect",vue.mergeProps({key:5,id:`rect${_e.id}`,fill:"black","fill-opacity":"0",ref_for:!0},le(_e.actual_bound,_e.scale_x,_e.scale_y),{style:{stroke:"none","stroke-width":"2","stroke-miterlimit":"10"},class:{"svg-item-none":!_e.selected&&(vue.unref(n).intention==vue.unref(EGlobalStoreIntention).None||vue.unref(n).intention==vue.unref(EGlobalStoreIntention).Select),"svg-item-move":vue.unref(n).intention==vue.unref(EGlobalStoreIntention).Move&&((ue=vue.unref(n).handle_svg_info)==null?void 0:ue.info.id)==_e.id,"svg-item-select":vue.unref(n).intention==vue.unref(EGlobalStoreIntention).Select&&(($e=vue.unref(n).handle_svg_info)==null?void 0:$e.info.id)==_e.id,"svg-item-in-group":_e.selected}}),null,16,_hoisted_15)):vue.createCommentVNode("",!0),((Ne=vue.unref(n).handle_svg_info)==null?void 0:Ne.info.id)===_e.id&&vue.unref(p).handle_panel&&_e.type!==vue.unref(EDoneJsonType).ConnectionLine?(vue.openBlock(),vue.createBlock(HandlePanel,{key:6,"item-info":_e},null,8,["item-info"])):vue.createCommentVNode("",!0),!_e.selected&&((Oe=vue.unref(p).select_item.info)==null?void 0:Oe.id)==_e.id&&vue.unref(p).connection_panel&&_e.config.have_anchor&&vue.unref(n).intention!==vue.unref(EGlobalStoreIntention).SelectArea&&(vue.unref(n).intention!==vue.unref(EGlobalStoreIntention).Select||_e.id!==((Lt=vue.unref(n).handle_svg_info)==null?void 0:Lt.info.id))?(vue.openBlock(),vue.createBlock(ConnectionPanel,{key:7,onContextmenu:F,"item-info":_e},null,8,["item-info"])):vue.createCommentVNode("",!0)],40,_hoisted_11)],2)],8,_hoisted_10)),[[vue.vShow,_e.display]])}),128)),vue.createElementVNode("rect",{x:vue.unref(_).x,y:vue.unref(_).y,height:vue.unref(_).height,width:vue.unref(_).with,stroke:"#107cec",fill:"#107cec","fill-opacity":".2"},null,8,_hoisted_16)],8,_hoisted_9)]))])],36),vue.withDirectives(vue.createElementVNode("ul",{ref_key:"contextMenuRef",ref:f,class:"contextMenu"},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(c).info,(_e,qe)=>(vue.openBlock(),vue.createElementBlock("li",{key:_e.title,onClick:In=>vue.unref(c).onContextMenuClick(qe)},[vue.createElementVNode("p",{class:vue.normalizeClass(_e.enable?"":"disabled")},[vue.createTextVNode(vue.toDisplayString(_e.title)+" ",1),vue.createElementVNode("span",_hoisted_18,vue.toDisplayString(_e.hot_key),1)],2)],8,_hoisted_17))),128))],512),[[vue.vShow,vue.unref(c).display]])],64))}}),centerPanel_vue_vue_type_style_index_0_scoped_1b085626_lang="",CenterPanel=_export_sfc$1(_sfc_main$y,[["__scopeId","data-v-1b085626"]]);/*! Element Plus Icons Vue v2.3.1 */var aim_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Aim",__name:"aim",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"}),vue.createElementVNode("path",{fill:"currentColor",d:"M512 96a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V128a32 32 0 0 1 32-32m0 576a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V704a32 32 0 0 1 32-32M96 512a32 32 0 0 1 32-32h192a32 32 0 0 1 0 64H128a32 32 0 0 1-32-32m576 0a32 32 0 0 1 32-32h192a32 32 0 1 1 0 64H704a32 32 0 0 1-32-32"})]))}}),aim_default=aim_vue_vue_type_script_setup_true_lang_default,arrow_down_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"ArrowDown",__name:"arrow-down",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"})]))}}),arrow_down_default=arrow_down_vue_vue_type_script_setup_true_lang_default,circle_check_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"CircleCheck",__name:"circle-check",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"}),vue.createElementVNode("path",{fill:"currentColor",d:"M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"})]))}}),circle_check_default=circle_check_vue_vue_type_script_setup_true_lang_default,circle_close_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"CircleClose",__name:"circle-close",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"}),vue.createElementVNode("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"})]))}}),circle_close_default=circle_close_vue_vue_type_script_setup_true_lang_default,close_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Close",__name:"close",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}}),close_default=close_vue_vue_type_script_setup_true_lang_default,hide_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Hide",__name:"hide",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"}),vue.createElementVNode("path",{fill:"currentColor",d:"M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"})]))}}),hide_default=hide_vue_vue_type_script_setup_true_lang_default,loading_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"Loading",__name:"loading",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"})]))}}),loading_default=loading_vue_vue_type_script_setup_true_lang_default,view_vue_vue_type_script_setup_true_lang_default=vue.defineComponent({name:"View",__name:"view",setup(i){return(r,n)=>(vue.openBlock(),vue.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[vue.createElementVNode("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"})]))}}),view_default=view_vue_vue_type_script_setup_true_lang_default,MapShim=function(){if(typeof Map<"u")return Map;function i(r,n){var o=-1;return r.some(function(a,u){return a[0]===n?(o=u,!0):!1}),o}return function(){function r(){this.__entries__=[]}return Object.defineProperty(r.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),r.prototype.get=function(n){var o=i(this.__entries__,n),a=this.__entries__[o];return a&&a[1]},r.prototype.set=function(n,o){var a=i(this.__entries__,n);~a?this.__entries__[a][1]=o:this.__entries__.push([n,o])},r.prototype.delete=function(n){var o=this.__entries__,a=i(o,n);~a&&o.splice(a,1)},r.prototype.has=function(n){return!!~i(this.__entries__,n)},r.prototype.clear=function(){this.__entries__.splice(0)},r.prototype.forEach=function(n,o){o===void 0&&(o=null);for(var a=0,u=this.__entries__;a<u.length;a++){var c=u[a];n.call(o,c[1],c[0])}},r}()}(),isBrowser=typeof window<"u"&&typeof document<"u"&&window.document===document,global$1=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),requestAnimationFrame$1=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(global$1):function(i){return setTimeout(function(){return i(Date.now())},1e3/60)}}(),trailingTimeout=2;function throttle(i,r){var n=!1,o=!1,a=0;function u(){n&&(n=!1,i()),o&&d()}function c(){requestAnimationFrame$1(u)}function d(){var f=Date.now();if(n){if(f-a<trailingTimeout)return;o=!0}else n=!0,o=!1,setTimeout(c,r);a=f}return d}var REFRESH_DELAY=20,transitionKeys=["top","right","bottom","left","width","height","size","weight"],mutationObserverSupported=typeof MutationObserver<"u",ResizeObserverController=function(){function i(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=throttle(this.refresh.bind(this),REFRESH_DELAY)}return i.prototype.addObserver=function(r){~this.observers_.indexOf(r)||this.observers_.push(r),this.connected_||this.connect_()},i.prototype.removeObserver=function(r){var n=this.observers_,o=n.indexOf(r);~o&&n.splice(o,1),!n.length&&this.connected_&&this.disconnect_()},i.prototype.refresh=function(){var r=this.updateObservers_();r&&this.refresh()},i.prototype.updateObservers_=function(){var r=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return r.forEach(function(n){return n.broadcastActive()}),r.length>0},i.prototype.connect_=function(){!isBrowser||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),mutationObserverSupported?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},i.prototype.disconnect_=function(){!isBrowser||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},i.prototype.onTransitionEnd_=function(r){var n=r.propertyName,o=n===void 0?"":n,a=transitionKeys.some(function(u){return!!~o.indexOf(u)});a&&this.refresh()},i.getInstance=function(){return this.instance_||(this.instance_=new i),this.instance_},i.instance_=null,i}(),defineConfigurable=function(i,r){for(var n=0,o=Object.keys(r);n<o.length;n++){var a=o[n];Object.defineProperty(i,a,{value:r[a],enumerable:!1,writable:!1,configurable:!0})}return i},getWindowOf=function(i){var r=i&&i.ownerDocument&&i.ownerDocument.defaultView;return r||global$1},emptyRect=createRectInit(0,0,0,0);function toFloat(i){return parseFloat(i)||0}function getBordersSize(i){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return r.reduce(function(o,a){var u=i["border-"+a+"-width"];return o+toFloat(u)},0)}function getPaddings(i){for(var r=["top","right","bottom","left"],n={},o=0,a=r;o<a.length;o++){var u=a[o],c=i["padding-"+u];n[u]=toFloat(c)}return n}function getSVGContentRect(i){var r=i.getBBox();return createRectInit(0,0,r.width,r.height)}function getHTMLElementContentRect(i){var r=i.clientWidth,n=i.clientHeight;if(!r&&!n)return emptyRect;var o=getWindowOf(i).getComputedStyle(i),a=getPaddings(o),u=a.left+a.right,c=a.top+a.bottom,d=toFloat(o.width),f=toFloat(o.height);if(o.boxSizing==="border-box"&&(Math.round(d+u)!==r&&(d-=getBordersSize(o,"left","right")+u),Math.round(f+c)!==n&&(f-=getBordersSize(o,"top","bottom")+c)),!isDocumentElement(i)){var h=Math.round(d+u)-r,y=Math.round(f+c)-n;Math.abs(h)!==1&&(d-=h),Math.abs(y)!==1&&(f-=y)}return createRectInit(a.left,a.top,d,f)}var isSVGGraphicsElement=function(){return typeof SVGGraphicsElement<"u"?function(i){return i instanceof getWindowOf(i).SVGGraphicsElement}:function(i){return i instanceof getWindowOf(i).SVGElement&&typeof i.getBBox=="function"}}();function isDocumentElement(i){return i===getWindowOf(i).document.documentElement}function getContentRect(i){return isBrowser?isSVGGraphicsElement(i)?getSVGContentRect(i):getHTMLElementContentRect(i):emptyRect}function createReadOnlyRect(i){var r=i.x,n=i.y,o=i.width,a=i.height,u=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,c=Object.create(u.prototype);return defineConfigurable(c,{x:r,y:n,width:o,height:a,top:n,right:r+o,bottom:a+n,left:r}),c}function createRectInit(i,r,n,o){return{x:i,y:r,width:n,height:o}}var ResizeObservation=function(){function i(r){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=createRectInit(0,0,0,0),this.target=r}return i.prototype.isActive=function(){var r=getContentRect(this.target);return this.contentRect_=r,r.width!==this.broadcastWidth||r.height!==this.broadcastHeight},i.prototype.broadcastRect=function(){var r=this.contentRect_;return this.broadcastWidth=r.width,this.broadcastHeight=r.height,r},i}(),ResizeObserverEntry=function(){function i(r,n){var o=createReadOnlyRect(n);defineConfigurable(this,{target:r,contentRect:o})}return i}(),ResizeObserverSPI=function(){function i(r,n,o){if(this.activeObservations_=[],this.observations_=new MapShim,typeof r!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=r,this.controller_=n,this.callbackCtx_=o}return i.prototype.observe=function(r){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(r instanceof getWindowOf(r).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(r)||(n.set(r,new ResizeObservation(r)),this.controller_.addObserver(this),this.controller_.refresh())}},i.prototype.unobserve=function(r){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(r instanceof getWindowOf(r).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(r)&&(n.delete(r),n.size||this.controller_.removeObserver(this))}},i.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},i.prototype.gatherActive=function(){var r=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&r.activeObservations_.push(n)})},i.prototype.broadcastActive=function(){if(this.hasActive()){var r=this.callbackCtx_,n=this.activeObservations_.map(function(o){return new ResizeObserverEntry(o.target,o.broadcastRect())});this.callback_.call(r,n,r),this.clearActive()}},i.prototype.clearActive=function(){this.activeObservations_.splice(0)},i.prototype.hasActive=function(){return this.activeObservations_.length>0},i}(),observers=typeof WeakMap<"u"?new WeakMap:new MapShim,ResizeObserver$1=function(){function i(r){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=ResizeObserverController.getInstance(),o=new ResizeObserverSPI(r,n,this);observers.set(this,o)}return i}();["observe","unobserve","disconnect"].forEach(function(i){ResizeObserver$1.prototype[i]=function(){var r;return(r=observers.get(this))[i].apply(r,arguments)}});var index$1=function(){return typeof global$1.ResizeObserver<"u"?global$1.ResizeObserver:ResizeObserver$1}();const Events=["blur","input","change","changeSelectionStyle","changeSession","copy","focus","paste"],VAceEditor=vue.defineComponent({name:"VAceEditor",props:{value:{type:String,required:!0},lang:{type:String,default:"text"},theme:{type:String,default:"chrome"},options:Object,placeholder:String,readonly:Boolean,wrap:Boolean,printMargin:{type:[Boolean,Number],default:!0},minLines:Number,maxLines:Number},emits:["update:value","init",...Events],render(){return vue.h("div")},mounted(){const i=this._editor=vue.markRaw(ace.edit(this.$el,{placeholder:this.placeholder,readOnly:this.readonly,value:this.value,mode:"ace/mode/"+this.lang,theme:"ace/theme/"+this.theme,wrap:this.wrap,printMargin:this.printMargin,useWorker:!1,minLines:this.minLines,maxLines:this.maxLines,...this.options}));this._contentBackup=this.value,this._isSettingContent=!1,i.on("change",()=>{if(this._isSettingContent)return;const r=i.getValue();this._contentBackup=r,this.$emit("update:value",r)}),Events.forEach(r=>{const n="on"+vue.capitalize(r);typeof this.$.vnode.props[n]=="function"&&i.on(r,this.$emit.bind(this,r))}),this._ro=new index$1(()=>i.resize()),this._ro.observe(this.$el),this.$emit("init",i)},beforeUnmount(){var i,r;(i=this._ro)===null||i===void 0||i.disconnect(),(r=this._editor)===null||r===void 0||r.destroy()},methods:{focus(){this._editor.focus()},blur(){this._editor.blur()},selectAll(){this._editor.selectAll()},getAceInstance(){return this._editor}},watch:{value(i){if(this._contentBackup!==i){try{this._isSettingContent=!0,this._editor.setValue(i,1)}finally{this._isSettingContent=!1}this._contentBackup=i}},theme(i){this._editor.setTheme("ace/theme/"+i)},options(i){this._editor.setOptions(i)},readonly(i){this._editor.setReadOnly(i)},placeholder(i){this._editor.setOption("placeholder",i)},wrap(i){this._editor.setWrapBehavioursEnabled(i)},printMargin(i){this._editor.setOption("printMargin",i)},lang(i){this._editor.setOption("mode","ace/mode/"+i)},minLines(i){this._editor.setOption("minLines",i)},maxLines(i){this._editor.setOption("maxLines",i)}}}),themeUrl2="data:application/javascript;base64,YWNlLmRlZmluZSgiYWNlL3RoZW1lL2tyX3RoZW1lLmNzcyIsWyJyZXF1aXJlIiwiZXhwb3J0cyIsIm1vZHVsZSJdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpe21vZHVsZS5leHBvcnRzID0gIi5hY2Uta3ItdGhlbWUgLmFjZV9ndXR0ZXIge1xuICBiYWNrZ3JvdW5kOiAjMWMxOTE3O1xuICBjb2xvcjogI0ZDRkZFMFxufVxuXG4uYWNlLWtyLXRoZW1lIC5hY2VfcHJpbnQtbWFyZ2luIHtcbiAgd2lkdGg6IDFweDtcbiAgYmFja2dyb3VuZDogIzFjMTkxN1xufVxuXG4uYWNlLWtyLXRoZW1lIHtcbiAgYmFja2dyb3VuZC1jb2xvcjogIzBCMEEwOTtcbiAgY29sb3I6ICNGQ0ZGRTBcbn1cblxuLmFjZS1rci10aGVtZSAuYWNlX2N1cnNvciB7XG4gIGNvbG9yOiAjRkY5OTAwXG59XG5cbi5hY2Uta3ItdGhlbWUgLmFjZV9tYXJrZXItbGF5ZXIgLmFjZV9zZWxlY3Rpb24ge1xuICBiYWNrZ3JvdW5kOiByZ2JhKDE3MCwgMCwgMjU1LCAwLj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XVpcmUiLCJleHBvcnRzIiwibW9kdWxlIiwiYWNlL3RoZW1lL2tyX3RoZW1lLmNzcyIsImFjZS9saWIvZG9tIl0sIGZ1bmN0aW9uKHJlcXVpcmUsIGV4cG9ydHMsIG1vZHVsZSl7ZXhwb3J0cy5pc0RhcmsgPSB0cnVlOwpleHBvcnRzLmNzc0NsYXNzID0gImFjZS1rci10aGVtZSI7CmV4cG9ydHMuY3NzVGV4dCA9IHJlcXVpcmUoIi4va3JfdGhlbWUuY3NzIik7CnZhciBkb20gPSByZXF1aXJlKCIuLi9saWIvZG9tIik7CmRvbS5pbXBvcnRDc3NTdHJpbmcoZXhwb3J0cy5jc3NUZXh0LCBleHBvcnRzLmNzc0NsYXNzLCBmYWxzZSk7Cgp9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL3RoZW1lL2tyX3RoZW1lIl0sIGZ1bmN0aW9uKG0pIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBtb2R1bGUgPT0gIm9iamVjdCIgJiYgdHlwZW9mIGV4cG9ydHMgPT0gIm9iamVjdCIgJiYgbW9kdWxlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IG07CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0pKCk7CiAgICAgICAgICAgIA==",modeJsonUrl="data:application/javascript;base64,YWNlLmRlZmluZSgiYWNlL21vZGUvanNvbl9oaWdobGlnaHRfcnVsZXMiLFsicmVxdWlyZSIsImV4cG9ydHMiLCJtb2R1bGUiLCJhY2UvbGliL29vcCIsImFjZS9tb2RlL3RleHRfaGlnaGxpZ2h0X3J1bGVzIl0sIGZ1bmN0aW9uKHJlcXVpcmUsIGV4cG9ydHMsIG1vZHVsZSl7InVzZSBzdHJpY3QiOwp2YXIgb29wID0gcmVxdWlyZSgiLi4vbGliL29vcCIpOwp2YXIgVGV4dEhpZ2hsaWdodFJ1bGVzID0gcmVxdWlyZSgiLi90ZXh0X2hpZ2hsaWdodF9ydWxlcyIpLlRleHRIaWdobGlnaHRSdWxlczsKdmFyIEpzb25IaWdobGlnaHRSdWxlcyA9IGZ1bmN0aW9uICgpIHsKICAgIHRoaXMuJHJ1bGVzID0gewogICAgICAgICJzdGFydCI6IFsKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdG9rZW46ICJ2YXJpYWJsZSIsCiAgICAgICAgICAgICAgICByZWdleDogJ1siXSg/Oig/OlxcXFwuKXwoPzpbXiJcXFxcXSkpKj9bIl1cXHMqKD89OiknCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAic3RyaW5nIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAnIicsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RyaW5nIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lm51bWVyaWMiLAogICAgICAgICAgICAgICAgcmVnZXg6ICIwW3hYXVswLTlhLWZBLUZdK1xcYiIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJjb25zdGFudC5udW1lcmljIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAiWystXT9cXGQrKD86KD86XFwuXFxkKik/KD86W2VFXVsrLV0/XFxkKyk/KT9cXGIiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29uc3RhbnQubGFuZ3VhZ2UuYm9vbGVhbiIsCiAgICAgICAgICAgICAgICByZWdleDogIig/OnRydWV8ZmFsc2UpXFxiIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbJ10oPzooPzpcXFxcLil8KD86W14nXFxcXF0pKSo/WyddIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbW1lbnQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXC9cXC8uKiQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRva2VuOiAiY29tbWVudC5zdGFydCIsCiAgICAgICAgICAgICAgICByZWdleDogIlxcL1xcKiIsCiAgICAgICAgICAgICAgICBuZXh0OiAiY29tbWVudCIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5scGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbWyh7XSIKICAgICAgICAgICAgfSwgewogICAgICAgICAgICAgICAgdG9rZW46ICJwYXJlbi5ycGFyZW4iLAogICAgICAgICAgICAgICAgcmVnZXg6ICJbXFxdKX1dIgogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInB1bmN0dWF0aW9uLm9wZXJhdG9yIiwKICAgICAgICAgICAgICAgIHJlZ2V4OiAvWyxdLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInRleHQiLAogICAgICAgICAgICAgICAgcmVnZXg6ICJcXHMrIgogICAgICAgICAgICB9CiAgICAgICAgXSwKICAgICAgICAic3RyaW5nIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB0b2tlbjogImNvbnN0YW50Lmxhbmd1YWdlLmVzY2FwZSIsCiAgICAgICAgICAgICAgICByZWdleDogL1xcKD86eFswLTlhLWZBLUZdezJ9fHVbMC05YS1mQS1GXXs0fXxbIlxcXC9iZm5ydF0pLwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0b2tlbjogInN0cmluZyIsCiAgICAgICAgICAgICAgICByZWdleDogJyJ8JCcsCiAgICAgICAgICAgICAgICBuZXh0OiAic3RhcnQiCiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIGRlZmF1bHRUb2tlbjogInN0cmluZyIKICAgICAgICAgICAg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7CiAgICAgICAgICAgIGlmIChtYXRjaFsxXSkKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLm9wZW5pbmdCcmFja2V0QmxvY2soc2Vzc2lvbiwgbWF0Y2hbMV0sIHJvdywgaSk7CiAgICAgICAgICAgIHZhciByYW5nZSA9IHNlc3Npb24uZ2V0Q29tbWVudEZvbGRSYW5nZShyb3csIGkgKyBtYXRjaFswXS5sZW5ndGgsIDEpOwogICAgICAgICAgICBpZiAocmFuZ2UgJiYgIXJhbmdlLmlzTXVsdGlMaW5lKCkpIHsKICAgICAgICAgICAgICAgIGlmIChmb3JjZU11bHRpbGluZSkgewogICAgICAgICAgICAgICAgICAgIHJhbmdlID0gdGhpcy5nZXRTZWN0aW9uUmFuZ2Uoc2Vzc2lvbiwgcm93KTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKGZvbGRTdHlsZSAhPSAiYWxsIikKICAgICAgICAgICAgICAgICAgICByYW5nZSA9IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIHJhbmdlOwogICAgICAgIH0KICAgICAgICBpZiAoZm9sZFN0eWxlID09PSAibWFya2JlZ2luIikKICAgICAgICAgICAgcmV0dXJuOwogICAgICAgIHZhciBtYXRjaCA9IGxpbmUubWF0Y2godGhpcy5mb2xkaW5nU3RvcE1hcmtlcik7CiAgICAgICAgaWYgKG1hdGNoKSB7CiAgICAgICAgICAgIHZhciBpID0gbWF0Y2guaW5kZXggKyBtYXRjaFswXS5sZW5ndGg7CiAgICAgICAgICAgIGlmIChtYXRjaFsxXSkKICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmNsb3NpbmdCcmFja2V0QmxvY2soc2Vzc2lvbiwgbWF0Y2hbMV0sIHJvdywgaSk7CiAgICAgICAgICAgIHJldHVybiBzZXNzaW9uLmdldENvbW1lbnRGb2xkUmFuZ2Uocm93LCBpLCAtMSk7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuZ2V0U2VjdGlvblJhbmdlID0gZnVuY3Rpb24gKHNlc3Npb24sIHJvdykgewogICAgICAgIHZhciBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgdmFyIHN0YXJ0SW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgdmFyIHN0YXJ0Um93ID0gcm93OwogICAgICAgIHZhciBzdGFydENvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIHJvdyA9IHJvdyArIDE7CiAgICAgICAgdmFyIGVuZFJvdyA9IHJvdzsKICAgICAgICB2YXIgbWF4Um93ID0gc2Vzc2lvbi5nZXRMZW5ndGgoKTsKICAgICAgICB3aGlsZSAoKytyb3cgPCBtYXhSb3cpIHsKICAgICAgICAgICAgbGluZSA9IHNlc3Npb24uZ2V0TGluZShyb3cpOwogICAgICAgICAgICB2YXIgaW5kZW50ID0gbGluZS5zZWFyY2goL1xTLyk7CiAgICAgICAgICAgIGlmIChpbmRlbnQgPT09IC0xKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChzdGFydEluZGVudCA+IGluZGVudCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICB2YXIgc3ViUmFuZ2UgPSB0aGlzLmdldEZvbGRXaWRnZXRSYW5nZShzZXNzaW9uLCAiYWxsIiwgcm93KTsKICAgICAgICAgICAgaWYgKHN1YlJhbmdlKSB7CiAgICAgICAgICAgICAgICBpZiAoc3ViUmFuZ2Uuc3RhcnQucm93IDw9IHN0YXJ0Um93KSB7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmIChzdWJSYW5nZS5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgcm93ID0gc3ViUmFuZ2UuZW5kLnJvdzsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYgKHN0YXJ0SW5kZW50ID09IGluZGVudCkgewogICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGVuZFJvdyA9IHJvdzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIG5ldyBSYW5nZShzdGFydFJvdywgc3RhcnRDb2x1bW4sIGVuZFJvdywgc2Vzc2lvbi5nZXRMaW5lKGVuZFJvdykubGVuZ3RoKTsKICAgIH07CiAgICB0aGlzLmdldENvbW1lbnRSZWdpb25CbG9jayA9IGZ1bmN0aW9uIChzZXNzaW9uLCBsaW5lLCByb3cpIHsKICAgICAgICB2YXIgc3RhcnRDb2x1bW4gPSBsaW5lLnNlYXJjaCgvXHMqJC8pOwogICAgICAgIHZhciBtYXhSb3cgPSBzZXNzaW9uLmdldExlbmd0aCgpOwogICAgICAgIHZhciBzdGFydFJvdyA9IHJvdzsKICAgICAgICB2YXIgcmUgPSAvXlxzKig/OlwvXCp8XC9cL3wtLSkjPyhlbmQpP3JlZ2lvblxiLzsKICAgICAgICB2YXIgZGVwdGggPSAxOwogICAgICAgIHdoaWxlICgrK3JvdyA8IG1heFJvdykgewogICAgICAgICAgICBsaW5lID0gc2Vzc2lvbi5nZXRMaW5lKHJvdyk7CiAgICAgICAgICAgIHZhciBtID0gcmUuZXhlYyhsaW5lKTsKICAgICAgICAgICAgaWYgKCFtKQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIGlmIChtWzFdKQogICAgICAgICAgICAgICAgZGVwdGgtLTsKICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgZGVwdGgrKzsKICAgICAgICAgICAgaWYgKCFkZXB0aCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICB2YXIgZW5kUm93ID0gcm93OwogICAgICAgIGlmIChlbmRSb3cgPiBzdGFydFJvdykgewogICAgICAgICAgICByZXR1cm4gbmV3IFJhbmdlKHN0YXJ0Um93LCBzdGFydEN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lbnQoZG9jLCByb3cpOwogICAgfTsKICAgIHRoaXMuY3JlYXRlV29ya2VyID0gZnVuY3Rpb24gKHNlc3Npb24pIHsKICAgICAgICB2YXIgd29ya2VyID0gbmV3IFdvcmtlckNsaWVudChbImFjZSJdLCAiYWNlL21vZGUvanNvbl93b3JrZXIiLCAiSnNvbldvcmtlciIpOwogICAgICAgIHdvcmtlci5hdHRhY2hUb0RvY3VtZW50KHNlc3Npb24uZ2V0RG9jdW1lbnQoKSk7CiAgICAgICAgd29ya2VyLm9uKCJhbm5vdGF0ZSIsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIHNlc3Npb24uc2V0QW5ub3RhdGlvbnMoZS5kYXRhKTsKICAgICAgICB9KTsKICAgICAgICB3b3JrZXIub24oInRlcm1pbmF0ZSIsIGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgc2Vzc2lvbi5jbGVhckFubm90YXRpb25zKCk7CiAgICAgICAgfSk7CiAgICAgICAgcmV0dXJuIHdvcmtlcjsKICAgIH07CiAgICB0aGlzLiRpZCA9ICJhY2UvbW9kZS9qc29uIjsKfSkuY2FsbChNb2RlLnByb3RvdHlwZSk7CmV4cG9ydHMuTW9kZSA9IE1vZGU7Cgp9KTsgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgIGFjZS5yZXF1aXJlKFsiYWNlL21vZGUvanNvbiJdLCBmdW5jdGlvbihtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgbW9kdWxlID09ICJvYmplY3QiICYmIHR5cGVvZiBleHBvcnRzID09ICJvYmplY3QiICYmIG1vZHVsZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlLmV4cG9ydHMgPSBtOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICB9KSgpOwogICAgICAgICAgICA=",workerJsonUrl="data:application/javascript;base64,Im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gpIHsKICAgICAgICB2YXIgYWxpYXMgPSBwYXRoc1t0ZXN0UGF0aF07CiAgICAgICAgaWYgKHR5cGVvZiBhbGlhcyA9PSAic3RyaW5nIikgewogICAgICAgICAgICByZXR1cm4gYWxpYXMgKyB0YWlsOwogICAgICAgIH0gZWxzZSBpZiAoYWxpYXMpIHsKICAgICAgICAgICAgcmV0dXJuICBhbGlhcy5sb2NhdGlvbi5yZXBsYWNlKC9cLyokLywgIi8iKSArICh0YWlsIHx8IGFsaWFzLm1haW4gfHwgYWxpYXMubmFtZSk7CiAgICAgICAgfSBlbHNlIGlmIChhbGlhcyA9PT0gZmFsc2UpIHsKICAgICAgICAgICAgcmV0dXJuICIiOwogICAgICAgIH0KICAgICAgICB2YXIgaSA9IHRlc3RQYXRoLmxhc3RJbmRleE9mKCIvIik7CiAgICAgICAgaWYgKGkgPT09IC0xKSBicmVhazsKICAgICAgICB0YWlsID0gdGVzdFBhdGguc3Vic3RyKGkpICsgdGFpbDsKICAgICAgICB0ZXN0UGF0aCA9IHRlc3RQYXRoLnNsaWNlKDAsIGkpOwogICAgfQogICAgcmV0dXJuIGlkOwp9CndpbmRvdy5yZXF1aXJlLm1vZHVsZXMgPSB7fTsKd2luZG93LnJlcXVpcmUudGxucyA9IHt9OwoKd2luZG93LmRlZmluZSA9IGZ1bmN0aW9uKGlkLCBkZXBzLCBmYWN0b3J5KSB7CiAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA9PSAyKSB7CiAgICAgICAgZmFjdG9yeSA9IGRlcHM7CiAgICAgICAgaWYgKHR5cGVvZiBpZCAhPSAic3RyaW5nIikgewogICAgICAgICAgICBkZXBzID0gaWQ7CiAgICAgICAgICAgIGlkID0gd2luZG93LnJlcXVpcmUuaWQ7CiAgICAgICAgfQogICAgfSBlbHNlIGlmIChhcmd1bWVudHMubGVuZ3RoID09IDEpIHsKICAgICAgICBmYWN0b3J5ID0gaWQ7CiAgICAgICAgZGVwcyA9IFtdOwogICAgICAgIGlkID0gd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ICAgICAgICAgICAgICAgICAvLyBkZXBlbmRlbmNpZXMsIHdlIG11c3QgaGFuZGxlIHRoZW0gc2VwZXJhdGVseS4KICAgICAgICAgICAgICAgICAgICBjYXNlICJyZXF1aXJlIjogcmV0dXJuIHJlcTsKICAgICAgICAgICAgICAgICAgICBjYXNlICJleHBvcnRzIjogcmV0dXJuIG1vZHVsZS5leHBvcnRzOwogICAgICAgICAgICAgICAgICAgIGNhc2UgIm1vZHVsZSI6ICByZXR1cm4gbW9kdWxlOwogICAgICAgICAgICAgICAgICAgIC8vIEJ1dCBmb3IgYWxsIG90aGVyIGRlcGVuZGVuY2llcywgd2UgY2FuIGp1c3QgZ28gYWhlYWQgYW5kCiAgICAgICAgICAgICAgICAgICAgLy8gcmVxdWlyZSB0aGVtLgogICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6ICAgICAgICByZXR1cm4gcmVxKGRlcCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0pKTsKICAgICAgICAgICAgaWYgKHJldHVybkV4cG9ydHMpCiAgICAgICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IHJldHVybkV4cG9ydHM7CiAgICAgICAgICAgIHJldHVybiBtb2R1bGU7CiAgICAgICAgfQogICAgfTsKfTsKd2luZG93LmRlZmluZS5hbWQgPSB7fTsKd2luZG93LnJlcXVpcmUudGxucyA9IHt9Owp3aW5kb3cuaW5pdEJhc2VVcmxzICA9IGZ1bmN0aW9uIGluaXRCYXNlVXJscyh0b3BMZXZlbE5hbWVzcGFjZXMpIHsKICAgIGZvciAodmFyIGkgaW4gdG9wTGV2ZWxOYW1lc3BhY2VzKQogICAgICAgIHRoaXMucmVxdWlyZS50bG5zW2ldID0gdG9wTGV2ZWxOYW1lc3BhY2VzW2ldOwp9OwoKd2luZG93LmluaXRTZW5kZXIgPSBmdW5jdGlvbiBpbml0U2VuZGVyKCkgewoKICAgIHZhciBFdmVudEVtaXR0ZXIgPSB3aW5kb3cucmVxdWlyZSgiYWNlL2xpYi9ldmVudF9lbWl0dGVyIikuRXZlbnRFbWl0dGVyOwogICAgdmFyIG9vcCA9IHdpbmRvdy5yZXF1aXJlKCJhY2UvbGliL29vcCIpOwogICAgCiAgICB2YXIgU2VuZGVyID0gZnVuY3Rpb24oKSB7fTsKICAgIAogICAgKGZ1bmN0aW9uKCkgewogICAgICAgIAogICAgICAgIG9vcC5pbXBsZW1lbnQodGhpcywgRXZlbnRFbWl0dGVyKTsKICAgICAgICAgICAgICAgIAogICAgICAgIHRoaXMuY2FsbGJhY2sgPSBmdW5jdGlvbihkYXRhLCBjYWxsYmFja0lkKSB7CiAgICAgICAgICAgIHBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgIHR5cGU6ICJjYWxsIiwKICAgICAgICAgICAgICAgIGlkOiBjYWxsYmFja0lkLAogICAgICAgICAgICAgICAgZGF0YTogZGF0YQogICAgICAgICAgICB9KTsKICAgICAgICB9OwogICAgCiAgICAgICAgdGhpcy5lbWl0ID0gZnVuY3Rpb24obmFtZSwgZGF0YSkgewogICAgICAgICAgICBwb3N0TWVzc2FnZSh7CiAgICAgICAgICAgICAgICB0eXBlOiAiZXZlbnQiLAogICAgICAgICAgICAgICAgbmFtZTogbmFtZSwKICAgICAgICAgICAgICAgIGRhdGE6IGRhdGEKICAgICAgICAgICAgfSk7CiAgICAgICAgfTsKICAgICAgICAKICAgIH0pLmNhbGwoU2VuZGVyLnByb3RvdHlwZSk7CiAgICAKICAgIHJldHVybiBuZXcgU2VuZGVyKCk7Cn07Cgp2YXIgbWFpbiA9IHdpbmRvdy5tYWluID0gbnVsbDsKdmFyIHNlbmRlciA9IHdpbmRvdy5zZW5kZXIgPSBudWxsOwoKd2luZG93Lm9ubWVzc2FnZSA9IGZ1bmN0aW9uKGUpIHsKICAgIHZhciBtc2cgPSBlLmRhdGE7CiAgICBpZiAobXNnLmV2ZW50ICYmIHNlbmRlcikgewogICAgICAgIHNlbmRlci5fc2lnbmFsKG1zZy5ldmVudCwgbXN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dlKSB7CiAgICAgICAgcmV0dXJuIHRoaXMuc3RhcnQucm93ID09PSByYW5nZS5zdGFydC5yb3cgJiYKICAgICAgICAgICAgdGhpcy5lbmQucm93ID09PSByYW5nZS5lbmQucm93ICYmCiAgICAgICAgICAgIHRoaXMuc3RhcnQuY29sdW1uID09PSByYW5nZS5zdGFydC5jb2x1bW4gJiYKICAgICAgICAgICAgdGhpcy5lbmQuY29sdW1uID09PSByYW5nZS5lbmQuY29sdW1uOwogICAgfTsKICAgIHRoaXMudG9TdHJpbmcgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgcmV0dXJuICgiUmFuZ2U6IFsiICsgdGhpcy5zdGFydC5yb3cgKyAiLyIgKyB0aGlzLnN0YXJ0LmNvbHVtbiArCiAgICAgICAgICAgICJdIC0+IFsiICsgdGhpcy5lbmQucm93ICsgIi8iICsgdGhpcy5lbmQuY29sdW1uICsgIl0iKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMDsKICAgIH07CiAgICB0aGlzLmNvbXBhcmVSYW5nZSA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAsIGVuZCA9IHJhbmdlLmVuZCwgc3RhcnQgPSByYW5nZS5zdGFydDsKICAgICAgICBjbXAgPSB0aGlzLmNvbXBhcmUoZW5kLnJvdywgZW5kLmNvbHVtbik7CiAgICAgICAgaWYgKGNtcCA9PSAxKSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSBpZiAoY21wID09IDApIHsKICAgICAgICAgICAgICAgIHJldHVybiAxOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAoY21wID09IC0xKSB7CiAgICAgICAgICAgIHJldHVybiAtMjsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIGNtcCA9IHRoaXMuY29tcGFyZShzdGFydC5yb3csIHN0YXJ0LmNvbHVtbik7CiAgICAgICAgICAgIGlmIChjbXAgPT0gLTEpIHsKICAgICAgICAgICAgICAgIHJldHVybiAtMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIGlmIChjbXAgPT0gMSkgewogICAgICAgICAgICAgICAgcmV0dXJuIDQyOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlUG9pbnQgPSBmdW5jdGlvbiAocCkgewogICAgICAgIHJldHVybiB0aGlzLmNvbXBhcmUocC5yb3csIHAuY29sdW1uKTsKICAgIH07CiAgICB0aGlzLmNvbnRhaW5zUmFuZ2UgPSBmdW5jdGlvbiAocmFuZ2UpIHsKICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlUG9pbnQocmFuZ2Uuc3RhcnQpID09IDAgJiYgdGhpcy5jb21wYXJlUG9pbnQocmFuZ2UuZW5kKSA9PSAwOwogICAgfTsKICAgIHRoaXMuaW50ZXJzZWN0cyA9IGZ1bmN0aW9uIChyYW5nZSkgewogICAgICAgIHZhciBjbXAgPSB0aGlzLmNvbXBhcmVSYW5nZShyYW5nZSk7CiAgICAgICAgcmV0dXJuIChjbXAgPT0gLTEgfHwgY21wID09IDAgfHwgY21wID09IDEpOwogICAgfTsKICAgIHRoaXMuaXNFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4gdGhpcy5lbmQucm93ID09IHJvdyAmJiB0aGlzLmVuZC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuaXNTdGFydCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHJldHVybiB0aGlzLnN0YXJ0LnJvdyA9PSByb3cgJiYgdGhpcy5zdGFydC5jb2x1bW4gPT0gY29sdW1uOwogICAgfTsKICAgIHRoaXMuc2V0U3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IHJvdy5jb2x1bW47CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93LnJvdzsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHRoaXMuc3RhcnQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5zZXRFbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodHlwZW9mIHJvdyA9PSAib2JqZWN0IikgewogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSByb3cuY29sdW1uOwogICAgICAgICAgICB0aGlzLmVuZC5yb3cgPSByb3cucm93OwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgdGhpcy5lbmQucm93ID0gcm93OwogICAgICAgICAgICB0aGlzLmVuZC5jb2x1bW4gPSBjb2x1bW47CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuaW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc0VuZChyb3csIGNvbHVtbikgfHwgdGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlU3RhcnQgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICBpZiAodGhpcy5jb21wYXJlKHJvdywgY29sdW1uKSA9PSAwKSB7CiAgICAgICAgICAgIGlmICh0aGlzLmlzRW5kKHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuaW5zaWRlRW5kID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuY29tcGFyZShyb3csIGNvbHVtbikgPT0gMCkgewogICAgICAgICAgICBpZiAodGhpcy5pc1N0YXJ0KHJvdywgY29sdW1uKSkgewogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfTsKICAgIHRoaXMuY29tcGFyZSA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICghdGhpcy5pc011bHRpTGluZSgpKSB7CiAgICAgICAgICAgIGlmIChyb3cgPT09IHRoaXMuc3RhcnQucm93KSB7CiAgICAgICAgICAgICAgICByZXR1cm4gY29sdW1uIDwgdGhpcy5zdGFydC5jb2x1bW4gPyAtMSA6IChjb2x1bW4gPiB0aGlzLmVuZC5jb2x1bW4gPyAxIDogMCk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuc3RhcnQucm93KQogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgaWYgKHJvdyA+IHRoaXMuZW5kLnJvdykKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09PSByb3cpCiAgICAgICAgICAgIHJldHVybiBjb2x1bW4gPj0gdGhpcy5zdGFydC5jb2x1bW4gPyAwIDogLTE7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PT0gcm93KQogICAgICAgICAgICByZXR1cm4gY29sdW1uIDw9IHRoaXMuZW5kLmNvbHVtbiA/IDAgOiAxOwogICAgICAgIHJldHVybiAwOwogICAgfTsKICAgIHRoaXMuY29tcGFyZVN0YXJ0ID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID09IHJvdyAmJiB0aGlzLnN0YXJ0LmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgIH0KICAgICAgICBlbHNlIHsKICAgICAgICAgICAgcmV0dXJuIHRoaXMuY29tcGFyZShyb3csIGNvbHVtbik7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuY29tcGFyZUVuZCA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPT0gcm93ICYmIHRoaXMuZW5kLmNvbHVtbiA9PSBjb2x1bW4pIHsKICAgICAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jb21wYXJlSW5zaWRlID0gZnVuY3Rpb24gKHJvdywgY29sdW1uKSB7CiAgICAgICAgaWYgKHRoaXMuZW5kLnJvdyA9PSByb3cgJiYgdGhpcy5lbmQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAodGhpcy5zdGFydC5yb3cgPT0gcm93ICYmIHRoaXMuc3RhcnQuY29sdW1uID09IGNvbHVtbikgewogICAgICAgICAgICByZXR1cm4gLTE7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICByZXR1cm4gdGhpcy5jb21wYXJlKHJvdywgY29sdW1uKTsKICAgICAgICB9CiAgICB9OwogICAgdGhpcy5jbGlwUm93cyA9IGZ1bmN0aW9uIChmaXJzdFJvdywgbGFzdFJvdykgewogICAgICAgIGlmICh0aGlzLmVuZC5yb3cgPiBsYXN0Um93KQogICAgICAgICAgICB2YXIgZW5kID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLmVuZC5yb3cgPCBmaXJzdFJvdykKICAgICAgICAgICAgdmFyIGVuZCA9IHsgcm93OiBmaXJzdFJvdywgY29sdW1uOiAwIH07CiAgICAgICAgaWYgKHRoaXMuc3RhcnQucm93ID4gbGFzdFJvdykKICAgICAgICAgICAgdmFyIHN0YXJ0ID0geyByb3c6IGxhc3RSb3cgKyAxLCBjb2x1bW46IDAgfTsKICAgICAgICBlbHNlIGlmICh0aGlzLnN0YXJ0LnJvdyA8IGZpcnN0Um93KQogICAgICAgICAgICB2YXIgc3RhcnQgPSB7IHJvdzogZmlyc3RSb3csIGNvbHVtbjogMCB9OwogICAgICAgIHJldHVybiBSYW5nZS5mcm9tUG9pbnRzKHN0YXJ0IHx8IHRoaXMuc3RhcnQsIGVuZCB8fCB0aGlzLmVuZCk7CiAgICB9OwogICAgdGhpcy5leHRlbmQgPSBmdW5jdGlvbiAocm93LCBjb2x1b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mVuZC5jb2x1bW4gLSBkZWx0YS5zdGFydC5jb2x1bW4pOwogICAgICAgIHZhciBkZWx0YVN0YXJ0ID0gZGVsdGEuc3RhcnQ7CiAgICAgICAgdmFyIGRlbHRhRW5kID0gZGVsdGFJc0luc2VydCA/IGRlbHRhU3RhcnQgOiBkZWx0YS5lbmQ7IC8vIENvbGxhcHNlIGluc2VydCByYW5nZS4KICAgICAgICBpZiAoJHBvaW50c0luT3JkZXIocG9pbnQsIGRlbHRhU3RhcnQsIG1vdmVJZkVxdWFsKSkgewogICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgICAgcm93OiBwb2ludC5yb3csCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbgogICAgICAgICAgICB9OwogICAgICAgIH0KICAgICAgICBpZiAoJHBvaW50c0luT3JkZXIoZGVsdGFFbmQsIHBvaW50LCAhbW92ZUlmRXF1YWwpKSB7CiAgICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgICAgICByb3c6IHBvaW50LnJvdyArIGRlbHRhUm93U2hpZnQsCiAgICAgICAgICAgICAgICBjb2x1bW46IHBvaW50LmNvbHVtbiArIChwb2ludC5yb3cgPT0gZGVsdGFFbmQucm93ID8gZGVsdGFDb2xTaGlmdCA6IDApCiAgICAgICAgICAgIH07CiAgICAgICAgfQogICAgICAgIHJldHVybiB7CiAgICAgICAgICAgIHJvdzogZGVsdGFTdGFydC5yb3csCiAgICAgICAgICAgIGNvbHVtbjogZGVsdGFTdGFydC5jb2x1bW4KICAgICAgICB9OwogICAgfQogICAgdGhpcy5zZXRQb3NpdGlvbiA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbiwgbm9DbGlwKSB7CiAgICAgICAgdmFyIHBvczsKICAgICAgICBpZiAobm9DbGlwKSB7CiAgICAgICAgICAgIHBvcyA9IHsKICAgICAgICAgICAgICAgIHJvdzogcm93LAogICAgICAgICAgICAgICAgY29sdW1uOiBjb2x1bW4KICAgICAgICAgICAgfTsKIC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cbiIpLnNwbGl0KCJcbiIpOwogICAgICAgIH07CiAgICB9CiAgICBlbHNlIHsKICAgICAgICB0aGlzLiRzcGxpdCA9IGZ1bmN0aW9uICh0ZXh0KSB7CiAgICAgICAgICAgIHJldHVybiB0ZXh0LnNwbGl0KC9cclxufFxyfFxuLyk7CiAgICAgICAgfTsKICAgIH0KICAgIHRoaXMuJGRldGVjdE5ld0xpbmUgPSBmdW5jdGlvbiAodGV4dCkgewogICAgICAgIHZhciBtYXRjaCA9IHRleHQubWF0Y2goL14uKj8oXHJcbnxccnxcbikvbSk7CiAgICAgICAgdGhpcy4kYXV0b05ld0xpbmUgPSBtYXRjaCA/IG1hdGNoWzFdIDogIlxuIjsKICAgICAgICB0aGlzLl9zaWduYWwoImNoYW5nZU5ld0xpbmVNb2RlIik7CiAgICB9OwogICAgdGhpcy5nZXROZXdMaW5lQ2hhcmFjdGVyID0gZnVuY3Rpb24gKCkgewogICAgICAgIHN3aXRjaCAodGhpcy4kbmV3TGluZU1vZGUpIHsKICAgICAgICAgICAgY2FzZSAid2luZG93cyI6CiAgICAgICAgICAgICAgICByZXR1cm4gIlxyXG4iOwogICAgICAgICAgICBjYXNlICJ1bml4IjoKICAgICAgICAgICAgICAgIHJldHVybiAiXG4iOwogICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuJGF1dG9OZXdMaW5lIHx8ICJcbiI7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuJGF1dG9OZXdMaW5lID0gIiI7CiAgICB0aGlzLiRuZXdMaW5lTW9kZSA9ICJhdXRvIjsKICAgIHRoaXMuc2V0TmV3TGluZU1vZGUgPSBmdW5jdGlvbiAobmV3TGluZU1vZGUpIHsKICAgICAgICBpZiAodGhpcy4kbmV3TGluZU1vZGUgPT09IG5ld0xpbmVNb2RlKQogICAgICAgICAgICByZXR1cm47CiAgICAgICAgdGhpcy4kbmV3TGluZU1vZGUgPSBuZXdMaW5lTW9kZTsKICAgICA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LCB0cnVlKTsKICAgICAgICByZXR1cm4gdGhpcy5jbG9uZVBvcyhlbmQpOwogICAgfTsKICAgIHRoaXMuY2xpcHBlZFBvcyA9IGZ1bmN0aW9uIChyb3csIGNvbHVtbikgewogICAgICAgIHZhciBsZW5ndGggPSB0aGlzLmdldExlbmd0aCgpOwogICAgICAgIGlmIChyb3cgPT09IHVuZGVmaW5lZCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGg7CiAgICAgICAgfQogICAgICAgIGVsc2UgaWYgKHJvdyA8IDApIHsKICAgICAgICAgICAgcm93ID0gMDsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAocm93ID49IGxlbmd0aCkgewogICAgICAgICAgICByb3cgPSBsZW5ndGggLSAxOwogICAgICAgICAgICBjb2x1bW4gPSB1bmRlZmluZWQ7CiAgICAgICAgfQogICAgICAgIHZhciBsaW5lID0gdGhpcy5nZXRMaW5lKHJvdyk7CiAgICAgICAgaWYgKGNvbHVtbiA9PSB1bmRlZmluZWQpCiAgICAgICAgICAgIGNvbHVtbiA9IGxpbmUubGVuZ3RoOwogICAgICAgIGNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KGNvbHVtbiwgMCksIGxpbmUubGVuZ3RoKTsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLmNsb25lUG9zID0gZnVuY3Rpb24gKHBvcykgewogICAgICAgIHJldHVybiB7IHJvdzogcG9zLnJvdywgY29sdW1uOiBwb3MuY29sdW1uIH07CiAgICB9OwogICAgdGhpcy5wb3MgPSBmdW5jdGlvbiAocm93LCBjb2x1bW4pIHsKICAgICAgICByZXR1cm4geyByb3c6IHJvdywgY29sdW1uOiBjb2x1bW4gfTsKICAgIH07CiAgICB0aGlzLiRjbGlwUG9zaXRpb24gPSBmdW5jdGlvbiAocG9zaXRpb24pIHsKICAgICAgICB2YXIgbGVuZ3RoID0gdGhpcy5nZXRMZW5ndGgoKTsKICAgICAgICBpZiAocG9zaXRpb24ucm93ID49IGxlbmd0aCkgewogICAgICAgICAgICBwb3NpdGlvbi5yb3cgPSBNYXRoLm1heCgwLCBsZW5ndGggLSAxKTsKICAgICAgICAgICAgcG9zaXRpb24uY29sdW1uID0gdGhpcy5nZXRMaW5lKGxlbmd0aCAtIDEpLmxlbmd0aDsKICAgICAgICB9CiAgICAgICAgZWxzZSB7CiAgICAgICAgICAgIHBvc2l0aW9uLnJvdyA9IE1hdGgubWF4KDAsIHBvc2l0aW9uLnJvdyk7CiAgICAgICAgICAgIHBvc2l0aW9uLmNvbHVtbiA9IE1hdGgubWluKE1hdGgubWF4KHBvc2l0aW9uLmNvbHVtbiwgMCksIHRoaXMuZ2V0TGluZShwb3NpdGlvbi5yb3cpLmxlbmd0aCk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBwb3NpdGlvbjsKICAgIH07CiAgICB0aGlzLmluc2VydEZ1bGxMaW5lcyA9IGZ1bmN0aW9uIChyb3csIGxpbmVzKSB7CiAgICAgICAgcm93ID0gTWF0aC5taW4oTWF0aC5tYXgocm93LCAwKSwgdGhpcy5nZXRMZW5ndGgoKSk7CiAgICAgICAgdmFyIGNvbHVtbiA9IDA7CiAgICAgICAgaWYgKHJvdyA8IHRoaXMuZ2V0TGVuZ3RoKCkpIHsKICAgICAgICAgICAgbGluZXMgPSBsaW5lcy5jb25jYXQoWyIiXSk7CiAgICAgICAgICAgIGNvbHVtbiA9IDA7CiAgICAgICAgfQogICAgICAgIGVsc2UgewogICAgICAgICAgICBsaW5lcyA9IFsiIl0uY29uY2F0KGxpbmVzKTsKICAgICAgICAgICAgcm93LS07CiAgICAgICAgICAgIGNvbHVtbiA9IHRoaXMuJGxpbmVzW3Jvd10ubGVuZ3RoOwogICAgICAgIH0KICAgICAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzKHsgcm93OiByb3csIGNvbHVtbjogY29sdW1uIH0sIGxpbmVzKTsKICAgIH07CiAgICB0aGlzLmluc2VydE1lcmdlZExpbmVzID0gZnVuY3Rpb24gKHBvc2l0aW9uLCBsaW5lcykgewogICAgICAgIHZhciBzdGFydCA9IHRoaXMuY2xpcHBlZFBvcyhwb3NpdGlvbi5yb3csIHBvc2l0aW9uLmNvbHVtbik7CiAgICAgICAgdmFyIGVuZCA9IHsKICAgICAgICAgICAgcm93OiBzdGFydC5yb3cgKyBsaW5lcy5sZW5ndGggLSAxLAogICAgICAgICAgICBjb2x1bW46IChsaW5lcy5sZW5ndGggPT0gMSA/IHN0YXJ0LmNvbHVtbiA6IDApICsgbGluZXNbbGluZXMubGVuZ3RoIC0gMV0ubGVuZ3RoCiAgICAgICAgfTsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoewogICAgICAgICAgICBzdGFydDogc3RhcnQsCiAgICAgICAgICAgIGVuZDogZW5kLAogICAgICAgICAgICBhY3Rpb246ICJpbnNlcnQiLAogICAgICAgICAgICBsaW5lczogbGluZXMKICAgICAgICB9KTsKICAgICAgICByZXR1cm4gdGhpcy5jbG9uZVBvcyhlbmQpOwogICAgfTsKICAgIHRoaXMucmVtb3ZlID0gZnVuY3Rpb24gKHJhbmdlKSB7CiAgICAgICAgdmFyIHN0YXJ0ID0gdGhpcy5jbGlwcGVkUG9zKHJhbmdlLnN0YXJ0LnJvdywgcmFuZ2Uuc3RhcnQuY29sdW1uKTsKICAgICAgICB2YXIgZW5kID0gdGhpcy5jbGlwcGVkUG9zKHJhbmdlLmVuZC5yb3csIHJhbmdlLmVuZC5jb2x1bW4pOwogICAgICAgIHRoaXMuYXBwbHlEZWx0YSh7CiAgICAgICAgICAgIHN0YXJ0OiBzdGFydCwKICAgICAgICAgICAgZW5kOiBlbmQsCiAgICAgICAgICAgIGFjdGlvbjogInJlbW92ZSIsCiAgICAgICAgICAgIGxpbmVzOiB0aGlzLmdldExpbmVzRm9yUmFuZ2UoeyBzdGFydDogc3RhcnQsIGVuZDogZW5kIH0pCiAgICAgICAgfSk7CiAgICAgICAgcmV0dXJuIHRoaX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GFydC5yb3cgPD0gZG9jTGVuZ3RoKSB7CiAgICAgICAgICAgIHRoaXMuYXBwbHlEZWx0YShkZWx0YSk7CiAgICAgICAgfQogICAgfTsKICAgIHRoaXMuJHNwbGl0QW5kYXBwbHlMYXJnZURlbHRhID0gZnVuY3Rpb24gKGRlbHRhLCBNQVgpIHsKICAgICAgICB2YXIgbGluZXMgPSBkZWx0YS5saW5lczsKICAgICAgICB2YXIgbCA9IGxpbmVzLmxlbmd0aCAtIE1BWCArIDE7CiAgICAgICAgdmFyIHJvdyA9IGRlbHRhLnN0YXJ0LnJvdzsKICAgICAgICB2YXIgY29sdW1uID0gZGVsdGEuc3RhcnQuY29sdW1uOwogICAgICAgIGZvciAodmFyIGZyb20gPSAwLCB0byA9IDA7IGZyb20gPCBsOyBmcm9tID0gdG8pIHsKICAgICAgICAgICAgdG8gKz0gTUFYIC0gMTsKICAgICAgICAgICAgdmFyIGNodW5rID0gbGluZXMuc2xpY2UoZnJvbSwgdG8pOwogICAgICAgICAgICBjaHVuay5wdXNoKCIiKTsKICAgICAgICAgICAgdGhpcy5hcHBseURlbHRhKHsKICAgICAgICAgICAgICAgIHN0YXJ0OiB0aGlzLnBvcyhyb3cgKyBmcm9tLCBjb2x1bW4pLAogICAgICAgICAgICAgICAgZW5kOiB0aGlzLnBvcyhyb3cgKyB0bywgY29sdW1uID0gMCksCiAgICAgICAgICAgICAgICBhY3Rpb246IGRlbHRhLmFjdGlvbiwKICAgICAgICAgICAgICAgIGxpbmVzOiBjaHVuawogICAgICAgICAgICB9LCB0cnVlKTsKICAgICAgICB9CiAgICAgICAgZGVsdGEubGluZXMgPSBsaW5lcy5zbGljZShmcm9tKTsKICAgICAgICBkZWx0YS5zdGFydC5yb3cgPSByb3cgKyBmcm9tOwogICAgICAgIGRlbHRhLnN0YXJ0LmNvbHVtbiA9IGNvbHVtbjsKICAgICAgICB0aGlzLmFwcGx5RGVsdGEoZGVsdGEsIHRydWUpOwogICAgfTsKICAgIHRoaXMucmV2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AgaWYgKEFycmF5LmlzQXJyYXkob2JqKSkgewogICAgICAgIGNvcHkgPSBbXTsKICAgICAgICBmb3IgKHZhciBrZXkgPSAwOyBrZXkgPCBvYmoubGVuZ3RoOyBrZXkrKykgewogICAgICAgICAgICBjb3B5W2tleV0gPSBkZWVwQ29weShvYmpba2V5XSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBjb3B5OwogICAgfQogICAgaWYgKE9iamVjdC5wcm90b3R5cGUudG9TdHJpbmcuY2FsbChvYmopICE9PSAiW29iamVjdCBPYmplY3RdIikKICAgICAgICByZXR1cm4gb2JqOwogICAgY29weSA9IHt9OwogICAgZm9yICh2YXIga2V5IGluIG9iaikKICAgICAgICBjb3B5W2tleV0gPSBkZWVwQ29weShvYmpba2V5XSk7CiAgICByZXR1cm4gY29weTsKfTsKZXhwb3J0cy5hcnJheVRvTWFwID0gZnVuY3Rpb24gKGFycikgewogICAgdmFyIG1hcCA9IHt9OwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHsKICAgICAgICBtYXBbYXJyW2ldXSA9IDE7CiAgICB9CiAgICByZXR1cm4gbWFwOwp9OwpleHBvcnRzLmNyZWF0ZU1hcCA9IGZ1bmN0aW9uIChwcm9wcykgewogICAgdmFyIG1hcCA9IE9iamVjdC5jcmVhdGUobnVsbCk7CiAgICBmb3IgKHZhciBpIGluIHByb3BzKSB7CiAgICAgICAgbWFwW2ldID0gcHJvcHNbaV07CiAgICB9CiAgICByZXR1cm4gbWFwOwp9OwpleHBvcnRzLmFycmF5UmVtb3ZlID0gZnVuY3Rpb24gKGFycmF5LCB2YWx1ZSkgewogICAgZm9yICh2YXIgaSA9IDA7IGkgPD0gYXJyYXkubGVuZ3RoOyBpKyspIHsKICAgICAgICBpZiAodmFsdWUgPT09IGFycmF5W2ldKSB7CiAgICAgICAgICAgIGFycmF5LnNwbGljZShpLCAxKTsKICAgICAgICB9CiAgICB9Cn07CmV4cG9ydHMuZXNjYX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hLmxlbmd0aDsgaSArPSAyKSB7CiAgICAgICAgICAgICAgICB2YXIgZCwgZXJyOyAKICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGRhdGFbaSsxXSkpIHsKICAgICAgICAgICAgICAgICAgICBkID0ge2FjdGlvbjogImluc2VydCIsIHN0YXJ0OiBkYXRhW2ldLCBsaW5lczogZGF0YVtpKzFdfTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgZCA9IHthY3Rpb246ICJyZW1vdmUiLCBzdGFydDogZGF0YVtpXSwgZW5kOiBkYXRhW2krMV19OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICBpZiAoKGQuYWN0aW9uID09ICJpbnNlcnQiID8gZC5zdGFydCA6IGQuZW5kKS5yb3cgPj0gZG9jLiRsaW5lcy5sZW5ndGgpIHsKICAgICAgICAgICAgICAgICAgICBlcnIgPSBuZXcgRXJyb3IoIkludmFsaWQgZGVsdGEiKTsKICAgICAgICAgICAgICAgICAgICBlcnIuZGF0YSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogX3NlbGYuJHBhdGgsCiAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzTGVuZ3RoOiBkb2MuJGxpbmVzLmxlbmd0aCwKICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQ6IGQuc3RhcnQsCiAgICAgICAgICAgICAgICAgICAgICAgIGVuZDogZC5lbmQKICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgIHRocm93IGVycjsKICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICBkb2MuYXBwbHlEZWx0YShkLCB0cnVlKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoX3NlbGYuJHRpbWVvdXQpCiAgICAgICAgICAgIHJldHVybiBkZWZlcnJlZFVwZGF0ZS5zY2hlZHVsZShfc2VsZi4kdGltZW91dCk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ogICciJywKICAgICAgICAgICAgJ1xcJzogJ1xcJywKICAgICAgICAgICAgJy8nOiAgJy8nLAogICAgICAgICAgICBiOiAgICAnXGInLAogICAgICAgICAgICBmOiAgICAnXGYnLAogICAgICAgICAgICBuOiAgICAnXG4nLAogICAgICAgICAgICByOiAgICAnXHInLAogICAgICAgICAgICB0OiAgICAnXHQnCiAgICAgICAgfSwKICAgICAgICB0ZXh0LAoKICAgICAgICBlcnJvciA9IGZ1bmN0aW9uIChtKSB7CgogICAgICAgICAgICB0aHJvdyB7CiAgICAgICAgICAgICAgICBuYW1lOiAgICAnU3ludGF4RXJyb3InLAogICAgICAgICAgICAgICAgbWVzc2FnZTogbSwKICAgICAgICAgICAgICAgIGF0OiAgICAgIGF0LAogICAgICAgICAgICAgICAgdGV4dDogICAgdGV4dAogICAgICAgICAgICB9OwogICAgICAgIH0sCgogICAgICAgIG5leHQgPSBmdW5jdGlvbiAoYykgewoKICAgICAgICAgICAgaWYgKGMgJiYgYyAhPT0gY2gpIHsKICAgICAgICAgICAgICAgIGVycm9yKCJFeHBlY3RlZCAnIiArIGMgKyAiJyBpbnN0ZWFkIG9mICciICsgY2ggKyAiJyIpOwogICAgICAgICAgICB9CgogICAgICAgICAgICBjaCA9IHRleHQuY2hhckF0KGF0KTsKICAgICAgICAgICAgYXQgKz0gMTsKICAgICAgICAgICAgcmV0dXJuIGNoOwogICAgICAgIH0sCgogICAgICAgIG51bWJlciA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHZhciBudW1iZXIsCiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnJzsKCiAgICAgICAgICAgIGlmIChjaCA9PT0gJy0nKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgPSAnLSc7CiAgICAgICAgICAgICAgICBuZXh0KCctJyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgd2hpbGUgKGNoID49ICcwJyAmJiBjaCA8PSAnOScpIHsKICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICcuJykgewogICAgICAgICAgICAgICAgc3RyaW5nICs9ICcuJzsKICAgICAgICAgICAgICAgIHdoaWxlIChuZXh0KCkgJiYgY2ggPj0gJzAnICYmIGNoIDw9ICc5JykgewogICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZiAoY2ggPT09ICdlJyB8fCBjaCA9PT0gJ0UnKSB7CiAgICAgICAgICAgICAgICBzdHJpbmcgKz0gY2g7CiAgICAgICAgICAgICAgICBuZXh0KCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICctJyB8fCBjaCA9PT0gJysnKSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHdoaWxlIChjaCA+PSAnMCcgJiYgY2ggPD0gJzknKSB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nICs9IGNoOwogICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBudW1iZXIgPSArc3RyaW5nOwogICAgICAgICAgICBpZiAoaXNOYU4obnVtYmVyKSkgewogICAgICAgICAgICAgICAgZXJyb3IoIkJhZCBudW1iZXIiKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHJldHVybiBudW1iZXI7CiAgICAgICAgICAgIH0KICAgICAgICB9LAoKICAgICAgICBzdHJpbmcgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICB2YXIgaGV4LAogICAgICAgICAgICAgICAgaSwKICAgICAgICAgICAgICAgIHN0cmluZyA9ICcnLAogICAgICAgICAgICAgICAgdWZmZmY7CgogICAgICAgICAgICBpZiAoY2ggPT09ICciJykgewogICAgICAgICAgICAgICAgd2hpbGUgKG5leHQoKSkgewogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJyInKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0cmluZzsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09PSAnXFwnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoID09PSAndScpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVmZmZmID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCA0OyBpICs9IDEpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXggPSBwYXJzZUludChuZXh0KCksIDE2KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzRmluaXRlKGhleCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVmZmZmID0gdWZmZmYgKiAxNiArIGhleDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBTdHJpbmcuZnJvbUNoYXJDb2RlKHVmZmZmKTsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgZXNjYXBlZVtjaF0gPT09ICdzdHJpbmcnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJpbmcgKz0gZXNjYXBlZVtjaF07CiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT0gIlxuIiB8fCBjaCA9PSAiXHIiKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZyArPSBjaDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXJyb3IoIkJhZCBzdHJpbmciKTsKICAgICAgICB9LAoKICAgICAgICB3aGl0ZSA9IGZ1bmN0aW9uICgpIHsKCiAgICAgICAgICAgIHdoaWxlIChjaCAmJiBjaCA8PSAnICcpIHsKICAgICAgICAgICAgICAgIG5leHQoKTsKICAgICAgICAgICAgfQogICAgICAgIH0sCgogICAgICAgIHdvcmQgPSBmdW5jdGlvbiAoKSB7CgogICAgICAgICAgICBzd2l0Y2ggKGNoKSB7CiAgICAgICAgICAgIGNhc2UgJ3QnOgogICAgICAgICAgICAgICAgbmV4dCgndCcpOwogICAgICAgICAgICAgICAgbmV4dCgncicpOwogICAgICAgICAgICAgICAgbmV4dCgndScpOwogICAgICAgICAgICAgICAgbmV4dCgnZScpOwogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIGNhc2UgJ2YnOgogICAgICAgICAgICAgICAgbmV4dCgnZicpOwogICAgICAgICAgICAgICAgbmV4dCgnYScpOwogICAgICAgICAgICAgICAgbmV4dCgnbCcpOwogICAgICAgICAgICAgICAgbmV4dCgncycpOwogICAgICAgICAgICAgICAgbmV4dCgnZScpOwogICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICAgICBjYXNlICduJzoKICAgICAgICAgICAgICAgIG5leHQoJ24nKTsKICAgICAgICAgICAgICAgIG5leHQoJ3UnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2wnKTsKICAgICAgICAgICAgICAgIG5leHQoJ2wnKTsKICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVycm9yKCJVbmV4cGVjdGVkICciICsgY2ggKyAiJyIpOwogICAgICAgIH0sCgogICAgICAgIHZhbHVlLCAgLy8gUGxhY2UgaG9sZGVyIGZvciB0aGUgdmFsdWUgZnVuY3Rpb24uCgogICAgICAgIGFycmF5ID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgdmFyIGFycmF5ID0gW107CgogICAgICAgICAgICBpZiAoY2ggPT09ICdbJykgewogICAgICAgICAgICAgICAgbmV4dCgnWycpOwogICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnXScpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBhcnJheTsgICAvLyBlbXB0eSBhcnJheQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGNoKSB7CiAgICAgICAgICAgICAgICAgICAgYXJyYXkucHVzaCh2YWx1ZSgpKTsKICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ10nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoJ10nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFycmF5OwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBuZXh0KCcsJyk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBlcnJvcigiQmFkIGFycmF5Iik7CiAgICAgICAgfSwKCiAgICAgICAgb2JqZWN0ID0gZnVuY3Rpb24gKCkgewoKICAgICAgICAgICAgdmFyIGtleSwKICAgICAgICAgICAgICAgIG9iamVjdCA9IHt9OwoKICAgICAgICAgICAgaWYgKGNoID09PSAneycpIHsKICAgICAgICAgICAgICAgIG5leHQoJ3snKTsKICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICBpZiAoY2ggPT09ICd9JykgewogICAgICAgICAgICAgICAgICAgIG5leHQoJ30nKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gb2JqZWN0OyAgIC8vIGVtcHR5IG9iamVjdAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgd2hpbGUgKGNoKSB7CiAgICAgICAgICAgICAgICAgICAga2V5ID0gc3RyaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgd2hpdGUoKTsKICAgICAgICAgICAgICAgICAgICBuZXh0KCc6Jyk7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKG9iamVjdCwga2V5KSkgewogICAgICAgICAgICAgICAgICAgICAgICBlcnJvcignRHVwbGljYXRlIGtleSAiJyArIGtleSArICciJyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIG9iamVjdFtrZXldID0gdmFsdWUoKTsKICAgICAgICAgICAgICAgICAgICB3aGl0ZSgpOwogICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PT0gJ30nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIG5leHQoJ30nKTsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG9iamVjdDsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgbmV4dCgnLCcpOwogICAgICAgICAgICAgICAgICAgIHdoaXRlKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZXJyb3IoIkJhZCBvYmplY3QiKTsKICAgICAgICB9OwoKICAgIHZhbHVlID0gZnVuY3Rpb24gKCkgewoKICAgICAgICB3aGl0ZSgpOwogICAgICAgIHN3aXRjaCAoY2gpIHsKICAgICAgICBjYXNlICd7JzoKICAgICAgICAgICAgcmV0dXJuIG9iamVjdCgpOwogICAgICAgIGNhc2UgJ1snOgogICAgICAgICAgICByZXR1cm4gYXJyYXkoKTsKICAgICAgICBjYXNlICciJzoKICAgICAgICAgICAgcmV0dXJuIHN0cmluZygpOwogICAgICAgIGNhc2UgJy0nOgogICAgICAgICAgICByZXR1cm4gbnVtYmVyKCk7CiAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgcmV0dXJuIGNoID49ICcwJyAmJiBjaCA8PSAnOScgPyBudW1iZXIoKSA6IHdvcmQoKTsKICAgICAgICB9CiAgICB9OwoKICAgIHJldHVybiBmdW5jdGlvbiAoc291cmNlLCByZXZpdmVyKSB7CiAgICAgICAgdmFyIHJlc3VsdDsKCiAgICAgICAgdGV4dCA9IHNvdXJjZTsKICAgICAgICBhdCA9IDA7CiAgICAgICAgY2ggPSAnICc7CiAgICAgICAgcmVzdWx0ID0gdmFsdWUoKTsKICAgICAgICB3aGl0ZSgpOwogICAgICAgIGlmIChjaCkgewogICAgICAgICAgICBlcnJvcigiU3ludGF4IGVycm9yIik7CiAgICAgICAgfQoKICAgICAgICByZXR1cm4gdHlwZW9mIHJldml2ZXIgPT09ICdmdW5jdGlvbicgPyBmdW5jdGlvbiB3YWxrKGhvbGRlciwga2V5KSB7CiAgICAgICAgICAgIHZhciBrLCB2LCB2YWx1ZSA9IGhvbGRlcltrZXldOwogICAgICAgICAgICBpZiAodmFsdWUgJiYgdHlwZW9mIHZhbHVlID09PSAnb2JqZWN0JykgewogICAgICAgICAgICAgICAgZm9yIChrIGluIHZhbHVlKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKE9iamVjdC5oYXNPd25Qcm9wZXJ0eS5jYWxsKHZhbHVlLCBrKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2ID0gd2Fsayh2YWx1ZSwgayk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2ICE9PSB1bmRlZmluZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlW2tdID0gdjsKICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSB2YWx1ZVtrXTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gcmV2aXZlci5jYWxsKGhvbGRlciwga2V5LCB2YWx1ZSk7CiAgICAgICAgfSh7Jyc6IHJlc3VsdH0sICcnKSA6IHJlc3VsdDsKICAgIH07Cn0pOwoKYWNlLmRlZmluZSgiYWNlL21vZGUvanNvbl93b3JrZXIiLFtdLCBmdW5jdGlvbihyZXF1aXJlLCBleHBvcnRzLCBtb2R1bGUpIHsKInVzZSBzdHJpY3QiOwoKdmFyIG9vcCA9IHJlcXVpcmUoIi4uL2xpYi9vb3AiKTsKdmFyIE1pcnJvciA9IHJlcXVpcmUoIi4uL3dvcmtlci9taXJyb3IiKS5NaXJyb3I7CnZhciBwYXJzZSA9IHJlcXVpcmUoIi4vanNvbi9qc29uX3BhcnNlIik7Cgp2YXIgSnNvbldvcmtlciA9IGV4cG9ydHMuSnNvbldvcmtlciA9IGZ1bmN0aW9uKHNlbmRlcikgewogICAgTWlycm9yLmNhbGwodGhpcywgc2VuZGVyKTsKICAgIHRoaXMuc2V0VGltZW91dCgyMDApOwp9OwoKb29wLmluaGVyaXRzKEpzb25Xb3JrZXIsIE1pcnJvcik7CgooZnVuY3Rpb24oKSB7CgogICAgdGhpcy5vblVwZGF0ZSA9IGZ1bmN0aW9uKCkgewogICAgICAgIHZhciB2YWx1ZSA9IHRoaXMuZG9jLmdldFZhbHVlKCk7CiAgICAgICAgdmFyIGVycm9ycyA9IFtdOwogICAgICAgIHRyeSB7CiAgICAgICAgICAgIGlmICh2YWx1ZSkKICAgICAgICAgICAgICAgIHBhcnNlKHZhbHVlKTsKICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgIHZhciBwb3MgPSB0aGlzLmRvYy5pbmRleFRvUG9zaXRpb24oZS5hdC0xKTsKICAgICAgICAgICAgZXJyb3JzLnB1c2goewogICAgICAgICAgICAgICAgcm93OiBwb3Mucm93LAogICAgICAgICAgICAgICAgY29sdW1uOiBwb3MuY29sdW1uLAogICAgICAgICAgICAgICAgdGV4dDogZS5tZXNzYWdlLAogICAgICAgICAgICAgICAgdHlwZTogImVycm9yIgogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgdGhpcy5zZW5kZXIuZW1pdCgiYW5ub3RhdGUiLCBlcnJvcnMpOwogICAgfTsKCn0pLmNhbGwoSnNvbldvcmtlci5wcm90b3R5cGUpOwoKfSk7Cg==";ace.config.setModuleUrl("ace/theme/kr_theme",themeUrl2),ace.config.setModuleUrl("ace/mode/json",modeJsonUrl),ace.config.setModuleUrl("ace/mode/json_worker",workerJsonUrl);const _sfc_main$x=vue.defineComponent({__name:"code-edit-modal",props:{modelValue:{default:()=>({})},lang:{default:"json"},title:{default:"编辑"}},emits:["update:modelValue","close"],setup(i,{emit:r}){const n=i,o=vue.ref(!1),a=r,u=vue.computed({get(){return n.lang==="json"?JSON.stringify(n.modelValue,null,2):n.modelValue},set(c){n.lang==="json"?a("update:modelValue",JSON.parse(c)):a("update:modelValue",c)}});return(c,d)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createVNode(vue.unref(elementPlus.ElButton),{onClick:d[0]||(d[0]=f=>o.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("···")]),_:1}),vue.createVNode(vue.unref(elementPlus.ElDialog),{class:"modal-full",modelValue:vue.unref(o),"onUpdate:modelValue":d[2]||(d[2]=f=>vue.isRef(o)?o.value=f:null),title:n.title,width:"60%",onClose:d[3]||(d[3]=f=>a("close"))},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(VAceEditor),{value:vue.unref(u),"onUpdate:value":d[1]||(d[1]=f=>vue.isRef(u)?u.value=f:null),lang:n.lang,theme:"kr_theme",style:{height:"400px"},options:{useWorker:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0}},null,8,["value","lang"])]),_:1},8,["modelValue","title"])]))}}),_hoisted_1$7={class:"one-row-txt",style:{width:"78px"}},_hoisted_2$5={key:1},_hoisted_3$4={class:"one-row-txt",style:{width:"145px"}},_hoisted_4$2={key:1},_sfc_main$w=vue.defineComponent({__name:"dynamic-el-form-item",props:{objInfo:{default:()=>({})},hide:{default:()=>[]},code:{type:Boolean,default:!1}},emits:["change"],setup(i,{emit:r}){const n=r,o=i,a=vue.computed(()=>{var h;const c={};let d=0,f=[];for(let y of Object.keys(o.objInfo)){const g=(h=o.objInfo[y])==null?void 0:h.sort;if(g){const p=Number(g);p>d&&(d=p)}if(g)c[g]=y;else return Object.keys(o.objInfo).map(p=>({...o.objInfo[p],_key:p}))}for(let y=0;y<d+1;y++){const g=String(y);f.push({...o.objInfo[c[g]],_key:c[g]})}return f});function u(c){let d=window.setTimeout(function(){n("change",c),clearTimeout(d),d=null},200)}return(c,d)=>(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(a),f=>(vue.openBlock(),vue.createElementBlock("div",{key:f._key},[o.code?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:0,class:"props-row",size:"small"},{label:vue.withCtx(()=>[vue.unref(getStringWidth)(String(f._key))>78?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:String(f._key),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1$7,vue.toDisplayString(f._key),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$5,vue.toDisplayString(f._key),1))]),default:vue.withCtx(()=>[vue.unref(getStringWidth)(String(f.val))>145?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTooltip),{key:0,content:JSON.stringify(f.val),placement:"left","popper-class":"props-popper"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_3$4,vue.toDisplayString(f.val),1)]),_:2},1032,["content"])):(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$2,vue.toDisplayString(f.val),1))]),_:2},1024)):vue.createCommentVNode("",!0),o.hide.indexOf(String(f._key))<0?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElFormItem),{key:1,label:f.title,size:"small"},{default:vue.withCtx(()=>[f.type===vue.unref(EConfigItemPropsType).Select?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSelect),{key:0,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,placeholder:"Select",size:"small",disabled:!!(f!=null&&f.disabled),onChange:u},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(f.options,h=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElOption),{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).InputNumber?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInputNumber),{key:1,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Input?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:2,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Textarea?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElInput),{key:3,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,autosize:"",type:"textarea",disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Color?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElColorPicker),{key:4,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).Switch?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElSwitch),{key:5,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onChange:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):f.type===vue.unref(EConfigItemPropsType).JsonEdit?(vue.openBlock(),vue.createBlock(_sfc_main$x,{key:6,modelValue:o.objInfo[f._key].val,"onUpdate:modelValue":h=>o.objInfo[f._key].val=h,disabled:!!(f!=null&&f.disabled),onClose:u},null,8,["modelValue","onUpdate:modelValue","disabled"])):vue.createCommentVNode("",!0)]),_:2},1032,["label"])):vue.createCommentVNode("",!0)]))),128))}}),dynamicElFormItem_vue_vue_type_style_index_0_scoped_b2819020_lang="",dynamicElFormItem_vue_vue_type_style_index_1_lang="",DynamicElFormItem=_export_sfc$1(_sfc_main$w,[["__scopeId","data-v-b2819020"]]),_hoisted_1$6={style:{height:"100%"}},_hoisted_2$4={class:"flex flex-wrap"},_hoisted_3$3=["onMouseenter","onClick"],_sfc_main$v=vue.defineComponent({__name:"common-animate",props:{val:{}},emits:["updateCommonAniVal"],setup(i,{emit:r}){const n=i,o=r,a=vue.ref(n.val),u=vue.ref(!1),c=vue.ref("进入"),d=vue.ref(null),f=h=>{o("updateCommonAniVal",h),u.value=!1};return vue.watch(()=>n.val,h=>{a.value=h}),(h,y)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$6,[vue.unref(a)?(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:0,closable:"",onClose:y[0]||(y[0]=g=>f("")),onClick:y[1]||(y[1]=g=>u.value=!0),style:{cursor:"pointer"}},{default:vue.withCtx(()=>{var g;return[vue.createTextVNode(vue.toDisplayString((g=vue.unref(common_animate_list).map(p=>p.children).reduce((p,v)=>p.concat(v)).find(p=>p.value==vue.unref(a)))==null?void 0:g.label)+" ",1),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:10},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"setting"})]),_:1})]}),_:1})):(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTag),{key:1,type:"success",style:{cursor:"pointer"},onClick:y[2]||(y[2]=g=>u.value=!0)},{default:vue.withCtx(()=>[vue.createTextVNode("新增")]),_:1})),vue.createVNode(vue.unref(elementPlus.ElDrawer),{modelValue:vue.unref(u),"onUpdate:modelValue":y[5]||(y[5]=g=>vue.isRef(u)?u.value=g:null),title:"选择动画",direction:"ltr"},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElTabs),{modelValue:vue.unref(c),"onUpdate:modelValue":y[4]||(y[4]=g=>vue.isRef(c)?c.value=g:null)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(common_animate_list),g=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTabPane),{label:g.label,name:g.label,key:g.label},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(elementPlus.ElScrollbar),{height:"500px"},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_2$4,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(g.children,(p,v)=>(vue.openBlock(),vue.createElementBlock("div",{class:"animate",key:v,onMouseenter:_=>d.value=v,onMouseleave:y[3]||(y[3]=_=>d.value=null),onClick:_=>f(p.value)},[vue.createElementVNode("div",{class:vue.normalizeClass(`${vue.unref(d)==v?`animate__animated animate__${p.value} animate__slow animate__infinite`:""}`)},vue.toDisplayString(p.label),3)],40,_hoisted_3$3))),128))])]),_:2},1024)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])]))}}),commonAnimate_vue_vue_type_style_index_0_scoped_2668f60c_lang="",CommonAnimate=_export_sfc$1(_sfc_main$v,[["__scopeId","data-v-2668f60c"]]),_sfc_main$u=vue.defineComponent({__name:"component-tree",setup(i){const r=useGlobalStore(pinia),n=vue.computed(()=>{var u;return((u=r.handle_svg_info)==null?void 0:u.info.id)??""}),o=u=>{for(let c of r.done_json)c.selected=!1,c.old_position={x:0,y:0};r.intention=EGlobalStoreIntention.Select,r.setHandleSvgInfo(u)},a={children:"children",label:"title"};return(u,c)=>(vue.openBlock(),vue.createBlock(vue.unref(elementPlus.ElTree),{class:"tree-v",data:vue.unref(r).done_json,props:a,onNodeClick:o,"default-expand-all":!0,"expand-on-click-node":!1,"highlight-current":!!vue.unref(n),"node-key":"id","current-node-key":vue.unref(n)},null,8,["data","highlight-current","current-node-key"]))}}),_withScopeId$1=i=>(vue.pushScopeId("data-v-98320511"),i=i(),vue.popScopeId(),i),_hoisted_1$5={class:"wall-l"},_hoisted_2$3={class:"head-l"},_hoisted_3$2=_withScopeId$1(()=>vue.createElementVNode("span",null,"key",-1)),_hoisted_4$1=_withScopeId$1(()=>vue.createElementVNode("span",null,"value",-1)),_hoisted_5$1={class:"row-l"},_sfc_main$t=vue.defineComponent({__name:"list",props:{modelValue:{default:()=>[{key:"",val:""}]}},emits:["update:modelValue"],setup(i,{emit:r}){const n=i,o=r,a=vue.computed({get(){return n.modelValue},set(d){o("update:modelValue",d)}}),u=()=>{a.value.push({key:"",val:""})},c=d=>{a.value.splice(d,1)};return(d,f)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$5,[vue.createElementVNode("div",_hoisted_2$3,[_hoisted_3$2,_hoisted_4$1,vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:u},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"add"})]),_:1})]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(a),(h,y)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,[vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:h.key,"onUpdate:modelValue":g=>h.key=g,size:"small",placeholder:"key"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElInput),{class:"content-l",modelValue:h.val,"onUpdate:modelValue":g=>h.val=g,size:"small",placeholder:"value"},null,8,["modelValue","onUpdate:modelValue"]),vue.createVNode(vue.unref(elementPlus.ElIcon),{size:16,class:"bt-Icon",onClick:g=>c(y)},{default:vue.withCtx(()=>[vue.createVNode(_sfc_main$E,{name:"delete"})]),_:2},1032,["onClick"])]))),256))]))}}),list_vue_vue_type_style_index_0_scoped_98320511_lang="",List=_export_sfc$1(_sfc_main$t,[["__scopeId","data-v-98320511"]]),composeEventHandlers=(i,r,{checkForDefaultPrevented:n=!0}={})=>a=>{const u=i==null?void 0:i(a);if(n===!1||!u)return r==null?void 0:r(a)};var _a;const isClient=typeof window<"u",isString$1=i=>typeof i=="string",noop=()=>{},isIOS=isClient&&((_a=window==null?void 0:window.navigator)==null?void 0:_a.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function resolveUnref(i){return typeof i=="function"?i():vue.unref(i)}function createFilterWrapper(i,r){function n(...o){return new Promise((a,u)=>{Promise.resolve(i(()=>r.apply(this,o),{fn:r,thisArg:this,args:o})).then(a).catch(u)})}return n}function debounceFilter(i,r={}){let n,o,a=noop;const u=d=>{clearTimeout(d),a(),a=noop};return d=>{const f=resolveUnref(i),h=resolveUnref(r.maxWait);return n&&u(n),f<=0||h!==void 0&&h<=0?(o&&(u(o),o=null),Promise.resolve(d())):new Promise((y,g)=>{a=r.rejectOnCancel?g:y,h&&!o&&(o=setTimeout(()=>{n&&u(n),o=null,y(d())},h)),n=setTimeout(()=>{o&&u(o),o=null,y(d())},f)})}}function identity(i){return i}function tryOnScopeDispose(i){return vue.getCurrentScope()?(vue.onScopeDispose(i),!0):!1}function useDebounceFn(i,r=200,n={}){return createFilterWrapper(debounceFilter(r,n),i)}function refDebounced(i,r=200,n={}){const o=vue.ref(i.value),a=useDebounceFn(()=>{o.value=i.value},r,n);return vue.watch(i,()=>a()),o}function tryOnMounted(i,r=!0){vue.getCurrentInstance()?vue.onMounted(i):r?i():vue.nextTick(i)}function unrefElement(i){var r;const n=resolveUnref(i);return(r=n==null?void 0:n.$el)!=null?r:n}const defaultWindow=isClient?window:void 0;function useEventListener(...i){let r,n,o,a;if(isString$1(i[0])||Array.isArray(i[0])?([n,o,a]=i,r=defaultWindow):[r,n,o,a]=i,!r)return noop;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const u=[],c=()=>{u.forEach(y=>y()),u.length=0},d=(y,g,p,v)=>(y.addEventListener(g,p,v),()=>y.removeEventListener(g,p,v)),f=vue.watch(()=>[unrefElement(r),resolveUnref(a)],([y,g])=>{c(),y&&u.push(...n.flatMap(p=>o.map(v=>d(y,p,v,g))))},{immediate:!0,flush:"post"}),h=()=>{f(),c()};return tryOnScopeDispose(h),h}let _iOSWorkaround=!1;function onClickOutside(i,r,n={}){const{window:o=defaultWindow,ignore:a=[],capture:u=!0,detectIframe:c=!1}=n;if(!o)return;isIOS&&!_iOSWorkaround&&(_iOSWorkaround=!0,Array.from(o.document.body.children).forEach(p=>p.addEventListener("click",noop)));let d=!0;const f=p=>a.some(v=>{if(typeof v=="string")return Array.from(o.document.querySelectorAll(v)).some(_=>_===p.target||p.composedPath().includes(_));{const _=unrefElement(v);return _&&(p.target===_||p.composedPath().includes(_))}}),y=[useEventListener(o,"click",p=>{const v=unrefElement(i);if(!(!v||v===p.target||p.composedPath().includes(v))){if(p.detail===0&&(d=!f(p)),!d){d=!0;return}r(p)}},{passive:!0,capture:u}),useEventListener(o,"pointerdown",p=>{const v=unrefElement(i);v&&(d=!p.composedPath().includes(v)&&!f(p))},{passive:!0}),c&&useEventListener(o,"blur",p=>{var v;const _=unrefElement(i);((v=o.document.activeElement)==null?void 0:v.tagName)==="IFRAME"&&!(_!=null&&_.contains(o.document.activeElement))&&r(p)})].filter(Boolean);return()=>y.forEach(p=>p())}function useSupported(i,r=!1){const n=vue.ref(),o=()=>n.value=!!i();return o(),tryOnMounted(o,r),n}const _global=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},globalKey="__vueuse_ssr_handlers__";_global[globalKey]=_global[globalKey]||{};var __getOwnPropSymbols$g=Object.getOwnPropertySymbols,__hasOwnProp$g=Object.prototype.hasOwnProperty,__propIsEnum$g=Object.prototype.propertyIsEnumerable,__objRest$2=(i,r)=>{var n={};for(var o in i)__hasOwnProp$g.call(i,o)&&r.indexOf(o)<0&&(n[o]=i[o]);if(i!=null&&__getOwnPropSymbols$g)for(var o of __getOwnPropSymbols$g(i))r.indexOf(o)<0&&__propIsEnum$g.call(i,o)&&(n[o]=i[o]);return n};function useResizeObserver(i,r,n={}){const o=n,{window:a=defaultWindow}=o,u=__objRest$2(o,["window"]);let c;const d=useSupported(()=>a&&"ResizeObserver"in a),f=()=>{c&&(c.disconnect(),c=void 0)},h=vue.watch(()=>unrefElement(i),g=>{f(),d.value&&a&&g&&(c=new ResizeObserver(r),c.observe(g,u))},{immediate:!0,flush:"post"}),y=()=>{f(),h()};return tryOnScopeDispose(y),{isSupported:d,stop:y}}var __getOwnPropSymbols$8=Object.getOwnPropertySymbols,__hasOwnProp$8=Object.prototype.hasOwnProperty,__propIsEnum$8=Object.prototype.propertyIsEnumerable,__objRest$1=(i,r)=>{var n={};for(var o in i)__hasOwnProp$8.call(i,o)&&r.indexOf(o)<0&&(n[o]=i[o]);if(i!=null&&__getOwnPropSymbols$8)for(var o of __getOwnPropSymbols$8(i))r.indexOf(o)<0&&__propIsEnum$8.call(i,o)&&(n[o]=i[o]);return n};function useMutationObserver(i,r,n={}){const o=n,{window:a=defaultWindow}=o,u=__objRest$1(o,["window"]);let c;const d=useSupported(()=>a&&"MutationObserver"in a),f=()=>{c&&(c.disconnect(),c=void 0)},h=vue.watch(()=>unrefElement(i),g=>{f(),d.value&&a&&g&&(c=new MutationObserver(r),c.observe(g,u))},{immediate:!0}),y=()=>{f(),h()};return tryOnScopeDispose(y),{isSupported:d,stop:y}}var SwipeDirection;(function(i){i.UP="UP",i.RIGHT="RIGHT",i.DOWN="DOWN",i.LEFT="LEFT",i.NONE="NONE"})(SwipeDirection||(SwipeDirection={}));var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,r,n)=>r in i?__defProp(i,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[r]=n,__spreadValues=(i,r)=>{for(var n in r||(r={}))__hasOwnProp.call(r,n)&&__defNormalProp(i,n,r[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(r))__propIsEnum.call(r,n)&&__defNormalProp(i,n,r[n]);return i};const _TransitionPresets={easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]};__spreadValues({linear:identity},_TransitionPresets);const isFirefox=()=>isClient&&/firefox/i.test(window.navigator.userAgent);/**
245
245
  * @vue/shared v3.4.37
246
246
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
247
247
  * @license MIT