@a2simcode/dui 0.0.54 → 0.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dui.es.js
CHANGED
|
@@ -8248,12 +8248,11 @@ var XQ = { render: zQ }, $Q = /* @__PURE__ */ $A({
|
|
|
8248
8248
|
components: C.value,
|
|
8249
8249
|
configData: oA.value?.data
|
|
8250
8250
|
})) : tA.value && tA.value.init && tA.value.init([]);
|
|
8251
|
-
}, F = (D
|
|
8251
|
+
}, F = (D) => {
|
|
8252
8252
|
oA.value && n.flowComponentConfigChange && n.flowComponentConfigChange(oA.value.data.type, {
|
|
8253
8253
|
configRef: tA,
|
|
8254
|
-
component: D,
|
|
8255
8254
|
configData: oA.value.data,
|
|
8256
|
-
...
|
|
8255
|
+
...D,
|
|
8257
8256
|
isFlowNode: !0
|
|
8258
8257
|
});
|
|
8259
8258
|
};
|
package/dist/dui.umd.js
CHANGED
|
@@ -23,7 +23,7 @@ Edge: ${e}
|
|
|
23
23
|
Source: ${A}
|
|
24
24
|
Target: ${t}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
|
|
25
25
|
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
|
|
26
|
-
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"},ce=class extends Error{constructor(e,...A){var t;super((t=Pa[e])==null?void 0:t.call(Pa,...A)),this.name="VueFlowError",this.code=e,this.args=A}};function mi(e){return"clientX"in e}function lB(e){return"sourceEvent"in e}function $e(e,A){const t=mi(e);let n,r;return t?(n=e.clientX,r=e.clientY):"touches"in e&&e.touches.length>0?(n=e.touches[0].clientX,r=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(n=e.changedTouches[0].clientX,r=e.changedTouches[0].clientY):(n=0,r=0),{x:n-(A?.left??0),y:r-(A?.top??0)}}var Lr=()=>{var e;return typeof navigator<"u"&&((e=navigator?.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function cB(e){var A,t;return{width:((A=e.dimensions)==null?void 0:A.width)??e.width??0,height:((t=e.dimensions)==null?void 0:t.height)??e.height??0}}function Tr(e,A=[1,1]){return{x:A[0]*Math.round(e.x/A[0]),y:A[1]*Math.round(e.y/A[1])}}var uB=()=>!0;function wi(e){e?.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function dB(e,A,t){const n=[],r={x:e.x-t,y:e.y-t,width:t*2,height:t*2};for(const a of A.values())xr(r,Sr(a))>0&&n.push(a);return n}var fB=250;function gB(e,A,t,n){var r,a;let u=[],d=Number.POSITIVE_INFINITY;const h=dB(e,t,A+fB);for(const g of h){const B=[...((r=g.handleBounds)==null?void 0:r.source)??[],...((a=g.handleBounds)==null?void 0:a.target)??[]];for(const w of B){if(n.nodeId===w.nodeId&&n.type===w.type&&n.id===w.id)continue;const{x:m,y:v}=tn(g,w,w.position,!0),y=Math.sqrt((m-e.x)**2+(v-e.y)**2);y>A||(y<d?(u=[{...w,x:m,y:v}],d=y):y===d&&u.push({...w,x:m,y:v}))}}if(!u.length)return null;if(u.length>1){const g=n.type==="source"?"target":"source";return u.find(B=>B.type===g)??u[0]}return u[0]}function Ga(e,{handle:A,connectionMode:t,fromNodeId:n,fromHandleId:r,fromType:a,doc:u,lib:d,flowId:h,isValidConnection:g=uB},B,w,m,v){const y=a==="target",I=A?u.querySelector(`.${d}-flow__handle[data-id="${h}-${A?.nodeId}-${A?.id}-${A?.type}"]`):null,{x:T,y:D}=$e(e),V=u.elementFromPoint(T,D),b=V?.classList.contains(`${d}-flow__handle`)?V:I,K={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const sA=za(void 0,b),W=b.getAttribute("data-nodeid"),cA=b.getAttribute("data-handleid"),lA=b.classList.contains("connectable"),oA=b.classList.contains("connectableend");if(!W||!sA)return K;const iA={source:y?W:n,sourceHandle:y?cA:r,target:y?n:W,targetHandle:y?r:cA};K.connection=iA,K.isValid=lA&&oA&&(t===nt.Strict?y&&sA==="source"||!y&&sA==="target":W!==n||cA!==r)&&g(iA,{nodes:w,edges:B,sourceNode:m(iA.source),targetNode:m(iA.target)}),K.toHandle=Xa(W,sA,cA,v,t,!0)}return K}function za(e,A){return e||(A?.classList.contains("target")?"target":A?.classList.contains("source")?"source":null)}function hB(e,A){let t=null;return A?t="valid":e&&!A&&(t="invalid"),t}function BB(e,A){let t=null;return A?t=!0:e&&!A&&(t=!1),t}function Xa(e,A,t,n,r,a=!1){var u,d,h;const g=n.get(e);if(!g)return null;const B=r===nt.Strict?(u=g.handleBounds)==null?void 0:u[A]:[...((d=g.handleBounds)==null?void 0:d.source)??[],...((h=g.handleBounds)==null?void 0:h.target)??[]],w=(t?B?.find(m=>m.id===t):B?.[0])??null;return w&&a?{...w,...tn(g,w,w.position,!0)}:w}var Ci={[IA.Left]:IA.Right,[IA.Right]:IA.Left,[IA.Top]:IA.Bottom,[IA.Bottom]:IA.Top},pB=["production","prod"];function Pn(e,...A){$a()&&console.warn(`[Vue Flow]: ${e}`,...A)}function $a(){return!pB.includes(process.env.NODE_ENV||"")}function Ya(e,A,t,n,r){const a=A.querySelectorAll(`.vue-flow__handle.${e}`);return a?.length?Array.from(a).map(u=>{const d=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:r,position:u.getAttribute("data-handlepos"),x:(d.left-t.left)/n,y:(d.top-t.top)/n,...Dr(u)}}):null}function vi(e,A,t,n,r,a=!1,u){r.value=!1,e.selected?(a||e.selected&&A)&&(n([e]),(0,o.nextTick)(()=>{u.blur()})):t([e])}function se(e){return typeof(0,o.unref)(e)<"u"}function mB(e,A,t,n){if(!e||!e.source||!e.target)return t(new ce(ie.EDGE_INVALID,e?.id??"[ID UNKNOWN]")),!1;let r;return ht(e)?r=e:r={...e,id:Fa(e)},r=Qa(r,void 0,n),Zh(r,A)?!1:r}function wB(e,A,t,n,r){if(!A.source||!A.target)return r(new ce(ie.EDGE_INVALID,e.id)),!1;if(!t)return r(new ce(ie.EDGE_NOT_FOUND,e.id)),!1;const{id:a,...u}=e;return{...u,id:n?Fa(A):a,source:A.source,target:A.target,sourceHandle:A.sourceHandle,targetHandle:A.targetHandle}}function Wa(e,A,t){const n={},r=[];for(let a=0;a<e.length;++a){const u=e[a];if(!kt(u)){t(new ce(ie.NODE_INVALID,u?.id));continue}const d=Yh(u,A(u.id),u.parentNode);u.parentNode&&(n[u.parentNode]=!0),r[a]=d}for(const a of r){const u=A(a.parentNode)||r.find(d=>d.id===a.parentNode);a.parentNode&&!u&&t(new ce(ie.NODE_MISSING_PARENT,a.id,a.parentNode)),(a.parentNode||n[a.id])&&(n[a.id]&&(a.isParent=!0),u&&(u.isParent=!0))}return r}function Ja(e,A,t,n,r,a){let u=r;const d=n.get(u)||new Map;n.set(u,d.set(t,A)),u=`${r}-${e}`;const h=n.get(u)||new Map;if(n.set(u,h.set(t,A)),a){u=`${r}-${e}-${a}`;const g=n.get(u)||new Map;n.set(u,g.set(t,A))}}function yi(e,A,t){e.clear();for(const n of t){const{source:r,target:a,sourceHandle:u=null,targetHandle:d=null}=n,h={edgeId:n.id,source:r,target:a,sourceHandle:u,targetHandle:d},g=`${r}-${u}--${a}-${d}`;Ja("source",h,`${a}-${d}--${r}-${u}`,e,r,u),Ja("target",h,g,e,a,d)}}function Za(e,A){if(e.size!==A.size)return!1;for(const t of e)if(!A.has(t))return!1;return!0}function Qi(e,A,t,n,r,a,u,d){const h=[];for(const g of e){const B=ht(g)?g:mB(g,d,r,a);if(!B)continue;const w=t(B.source),m=t(B.target);if(!w||!m){r(new ce(ie.EDGE_SOURCE_TARGET_MISSING,B.id,B.source,B.target));continue}if(!w){r(new ce(ie.EDGE_SOURCE_MISSING,B.id,B.source));continue}if(!m){r(new ce(ie.EDGE_TARGET_MISSING,B.id,B.target));continue}if(A&&!A(B,{edges:d,nodes:u,sourceNode:w,targetNode:m})){r(new ce(ie.EDGE_INVALID,B.id));continue}const v=n(B.id);h.push({...Qa(B,v,a),sourceNode:w,targetNode:m})}return h}var ja=Symbol("vueFlow"),qa=Symbol("nodeId"),Al=Symbol("nodeRef"),CB=Symbol("edgeId"),vB=Symbol("edgeRef"),kr=Symbol("slots");function el(e){const{vueFlowRef:A,snapToGrid:t,snapGrid:n,noDragClassName:r,nodeLookup:a,nodeExtent:u,nodeDragThreshold:d,viewport:h,autoPanOnNodeDrag:g,autoPanSpeed:B,nodesDraggable:w,panBy:m,findNode:v,multiSelectionActive:y,nodesSelectionActive:I,selectNodesOnDrag:T,removeSelectedElements:D,addSelectedNodes:V,updateNodePositions:b,emits:K}=XA(),{onStart:sA,onDrag:W,onStop:cA,onClick:lA,el:oA,disabled:iA,id:AA,selectable:S,dragHandle:eA}=e,H=(0,o.shallowRef)(!1);let X=[],U,L=null,k={x:void 0,y:void 0},N={x:0,y:0},O=null,Y=!1,tA=!1,BA=0,HA=!1;const nA=EB(),Z=({x:fA,y:J})=>{k={x:fA,y:J};let _=!1;if(X=X.map(F=>{const x={x:fA-F.distance.x,y:J-F.distance.y},{computedPosition:G}=pi(F,t.value?Tr(x,n.value):x,K.error,u.value,F.parentNode?v(F.parentNode):void 0);return _=_||F.position.x!==G.x||F.position.y!==G.y,F.position=G,F}),tA=tA||_,!!_&&(b(X,!0,!0),H.value=!0,O)){const[F,x]=Bi({id:AA,dragItems:X,findNode:v});W({event:O,node:F,nodes:x})}},$=()=>{if(!L)return;const[fA,J]=Na(N,L,B.value);if(fA!==0||J!==0){const _={x:(k.x??0)-fA/h.value.zoom,y:(k.y??0)-J/h.value.zoom};m({x:fA,y:J})&&Z(_)}BA=requestAnimationFrame($)},uA=(fA,J)=>{Y=!0;const _=v(AA);!T.value&&!y.value&&_&&(_.selected||D()),_&&(0,o.toValue)(S)&&T.value&&vi(_,y.value,V,D,I,!1,J);const F=nA(fA.sourceEvent);if(k=F,X=nB(a.value,w.value,F,AA),X.length){const[x,G]=Bi({id:AA,dragItems:X,findNode:v});sA({event:fA.sourceEvent,node:x,nodes:G})}},wA=(fA,J)=>{var _;fA.sourceEvent.type==="touchmove"&&fA.sourceEvent.touches.length>1||(tA=!1,d.value===0&&uA(fA,J),k=nA(fA.sourceEvent),L=((_=A.value)==null?void 0:_.getBoundingClientRect())||null,N=$e(fA.sourceEvent,L))},QA=(fA,J)=>{const _=nA(fA.sourceEvent);if(!HA&&Y&&g.value&&(HA=!0,$()),!Y){const F=_.xSnapped-(k.x??0),x=_.ySnapped-(k.y??0);Math.sqrt(F*F+x*x)>d.value&&uA(fA,J)}(k.x!==_.xSnapped||k.y!==_.ySnapped)&&X.length&&Y&&(O=fA.sourceEvent,N=$e(fA.sourceEvent,L),Z(_))},SA=fA=>{let J=!1;if(!Y&&!H.value&&!y.value){const _=fA.sourceEvent,F=nA(_),x=F.xSnapped-(k.x??0),G=F.ySnapped-(k.y??0),P=Math.sqrt(x*x+G*G);P!==0&&P<=d.value&&(lA?.(_),J=!0)}if(X.length&&!J){tA&&(b(X,!1,!1),tA=!1);const[_,F]=Bi({id:AA,dragItems:X,findNode:v});cA({event:fA.sourceEvent,node:_,nodes:F})}X=[],H.value=!1,HA=!1,Y=!1,k={x:void 0,y:void 0},cancelAnimationFrame(BA)};return(0,o.watch)([()=>(0,o.toValue)(iA),oA],([fA,J],_,F)=>{if(J){const x=Te(J);fA||(U=$f().on("start",G=>wA(G,J)).on("drag",G=>QA(G,J)).on("end",G=>SA(G)).filter(G=>{const P=G.target,dA=(0,o.toValue)(eA);return!G.button&&(!r.value||!Ka(P,`.${r.value}`,J)&&(!dA||Ka(P,dA,J)))}),x.call(U)),F(()=>{x.on(".drag",null),U&&(U.on("start",null),U.on("drag",null),U.on("end",null))})}}),H}function yB(){return{doubleClick:yA(),click:yA(),mouseEnter:yA(),mouseMove:yA(),mouseLeave:yA(),contextMenu:yA(),updateStart:yA(),update:yA(),updateEnd:yA()}}function QB(e,A){const t=yB();return t.doubleClick.on(n=>{var r,a;A.edgeDoubleClick(n),(a=(r=e.events)==null?void 0:r.doubleClick)==null||a.call(r,n)}),t.click.on(n=>{var r,a;A.edgeClick(n),(a=(r=e.events)==null?void 0:r.click)==null||a.call(r,n)}),t.mouseEnter.on(n=>{var r,a;A.edgeMouseEnter(n),(a=(r=e.events)==null?void 0:r.mouseEnter)==null||a.call(r,n)}),t.mouseMove.on(n=>{var r,a;A.edgeMouseMove(n),(a=(r=e.events)==null?void 0:r.mouseMove)==null||a.call(r,n)}),t.mouseLeave.on(n=>{var r,a;A.edgeMouseLeave(n),(a=(r=e.events)==null?void 0:r.mouseLeave)==null||a.call(r,n)}),t.contextMenu.on(n=>{var r,a;A.edgeContextMenu(n),(a=(r=e.events)==null?void 0:r.contextMenu)==null||a.call(r,n)}),t.updateStart.on(n=>{var r,a;A.edgeUpdateStart(n),(a=(r=e.events)==null?void 0:r.updateStart)==null||a.call(r,n)}),t.update.on(n=>{var r,a;A.edgeUpdate(n),(a=(r=e.events)==null?void 0:r.update)==null||a.call(r,n)}),t.updateEnd.on(n=>{var r,a;A.edgeUpdateEnd(n),(a=(r=e.events)==null?void 0:r.updateEnd)==null||a.call(r,n)}),Object.entries(t).reduce((n,[r,a])=>(n.emit[r]=a.trigger,n.on[r]=a.on,n),{emit:{},on:{}})}function EB(){const{viewport:e,snapGrid:A,snapToGrid:t,vueFlowRef:n}=XA();return r=>{var a;const u=((a=n.value)==null?void 0:a.getBoundingClientRect())??{left:0,top:0},{x:d,y:h}=$e(lB(r)?r.sourceEvent:r,u),g=Rn({x:d,y:h},e.value),{x:B,y:w}=t.value?Tr(g,A.value):g;return{xSnapped:B,ySnapped:w,...g}}}function Mr(){return!0}function tl({handleId:e,nodeId:A,type:t,isValidConnection:n,edgeUpdaterType:r,onEdgeUpdate:a,onEdgeUpdateEnd:u}){const{id:d,vueFlowRef:h,connectionMode:g,connectionRadius:B,connectOnClick:w,connectionClickStartHandle:m,nodesConnectable:v,autoPanOnConnect:y,autoPanSpeed:I,findNode:T,panBy:D,startConnection:V,updateConnection:b,endConnection:K,emits:sA,viewport:W,edges:cA,nodes:lA,isValidConnection:oA,nodeLookup:iA}=XA();let AA=null,S=!1,eA=null;function H(U){var L;const k=(0,o.toValue)(t)==="target",N=mi(U),O=ya(U.target),Y=U.currentTarget;if(Y&&(N&&U.button===0||!N)){let tA=function(EA){_=$e(EA,SA),Z=gB(Rn(_,W.value,!1,[1,1]),B.value,iA.value,G),F||(x(),F=!0);const FA=Ga(EA,{handle:Z,connectionMode:g.value,fromNodeId:(0,o.toValue)(A),fromHandleId:(0,o.toValue)(e),fromType:k?"target":"source",isValidConnection:nA,doc:O,lib:"vue",flowId:d,nodeLookup:iA.value},cA.value,lA.value,T,iA.value);eA=FA.handleDomNode,AA=FA.connection,S=BB(!!Z,FA.isValid);const NA={...gA,isValid:S,to:FA.toHandle&&S?Kn({x:FA.toHandle.x,y:FA.toHandle.y},W.value):_,toHandle:FA.toHandle,toPosition:S&&FA.toHandle?FA.toHandle.position:Ci[G.position],toNode:FA.toHandle?iA.value.get(FA.toHandle.nodeId):null};if(S&&Z&&gA?.toHandle&&NA.toHandle&&gA.toHandle.type===NA.toHandle.type&&gA.toHandle.nodeId===NA.toHandle.nodeId&&gA.toHandle.id===NA.toHandle.id&&gA.to.x===NA.to.x&&gA.to.y===NA.to.y)return;const OA=Z??FA.toHandle;if(b(OA&&S?Kn({x:OA.x,y:OA.y},W.value):_,OA,hB(!!OA,S)),gA=NA,!Z&&!S&&!eA)return wi(J);AA&&AA.source!==AA.target&&eA&&(wi(J),J=eA,eA.classList.add("connecting","vue-flow__handle-connecting"),eA.classList.toggle("valid",!!S),eA.classList.toggle("vue-flow__handle-valid",!!S))},BA=function(EA){"touches"in EA&&EA.touches.length>0||((Z||eA)&&AA&&S&&(a?a(EA,AA):sA.connect(AA)),sA.connectEnd(EA),r&&u?.(EA),wi(J),cancelAnimationFrame($),K(EA),F=!1,S=!1,AA=null,eA=null,O.removeEventListener("mousemove",tA),O.removeEventListener("mouseup",BA),O.removeEventListener("touchmove",tA),O.removeEventListener("touchend",BA))};const HA=T((0,o.toValue)(A));let nA=(0,o.toValue)(n)||oA.value||Mr;!nA&&HA&&(nA=(k?HA.isValidSourcePos:HA.isValidTargetPos)||Mr);let Z,$=0;const{x:uA,y:wA}=$e(U),QA=za((0,o.toValue)(r),Y),SA=(L=h.value)==null?void 0:L.getBoundingClientRect();if(!SA||!QA)return;const fA=Xa((0,o.toValue)(A),QA,(0,o.toValue)(e),iA.value,g.value);if(!fA)return;let J,_=$e(U,SA),F=!1;const x=()=>{if(!y.value)return;const[EA,FA]=Na(_,SA,I.value);D({x:EA,y:FA}),$=requestAnimationFrame(x)},G={...fA,nodeId:(0,o.toValue)(A),type:QA,position:fA.position},P=iA.value.get((0,o.toValue)(A)),dA={inProgress:!0,isValid:null,from:tn(P,G,IA.Left,!0),fromHandle:G,fromPosition:G.position,fromNode:P,to:_,toHandle:null,toPosition:Ci[G.position],toNode:null};V({nodeId:(0,o.toValue)(A),id:(0,o.toValue)(e),type:QA,position:Y?.getAttribute("data-handlepos")||IA.Top,..._},{x:uA-SA.left,y:wA-SA.top}),sA.connectStart({event:U,nodeId:(0,o.toValue)(A),handleId:(0,o.toValue)(e),handleType:QA});let gA=dA;O.addEventListener("mousemove",tA),O.addEventListener("mouseup",BA),O.addEventListener("touchmove",tA),O.addEventListener("touchend",BA)}}function X(U){var L,k;if(!w.value)return;const N=(0,o.toValue)(t)==="target";if(!m.value){sA.clickConnectStart({event:U,nodeId:(0,o.toValue)(A),handleId:(0,o.toValue)(e)}),V({nodeId:(0,o.toValue)(A),type:(0,o.toValue)(t),id:(0,o.toValue)(e),position:IA.Top,...$e(U)},void 0,!0);return}let O=(0,o.toValue)(n)||oA.value||Mr;const Y=T((0,o.toValue)(A));if(!O&&Y&&(O=(N?Y.isValidSourcePos:Y.isValidTargetPos)||Mr),Y&&(typeof Y.connectable>"u"?v.value:Y.connectable)===!1)return;const tA=ya(U.target),BA=Ga(U,{handle:{nodeId:(0,o.toValue)(A),id:(0,o.toValue)(e),type:(0,o.toValue)(t),position:IA.Top,...$e(U)},connectionMode:g.value,fromNodeId:m.value.nodeId,fromHandleId:m.value.id??null,fromType:m.value.type,isValidConnection:O,doc:tA,lib:"vue",flowId:d,nodeLookup:iA.value},cA.value,lA.value,T,iA.value),HA=((L=BA.connection)==null?void 0:L.source)===((k=BA.connection)==null?void 0:k.target);BA.isValid&&BA.connection&&!HA&&sA.connect(BA.connection),sA.clickConnectEnd(U),K(U,!0)}return{handlePointerDown:H,handleClick:X}}function FB(){return(0,o.inject)(qa,"")}function nl(e){const A=e??FB()??"",t=(0,o.inject)(Al,(0,o.ref)(null)),{findNode:n,edges:r,emits:a}=XA(),u=n(A);return u||a.error(new ce(ie.NODE_NOT_FOUND,A)),{id:A,nodeEl:t,node:u,parentNode:(0,o.computed)(()=>n(u.parentNode)),connectedEdges:(0,o.computed)(()=>Ia([u],r.value))}}function UB(){return{doubleClick:yA(),click:yA(),mouseEnter:yA(),mouseMove:yA(),mouseLeave:yA(),contextMenu:yA(),dragStart:yA(),drag:yA(),dragStop:yA()}}function bB(e,A){const t=UB();return t.doubleClick.on(n=>{var r,a;A.nodeDoubleClick(n),(a=(r=e.events)==null?void 0:r.doubleClick)==null||a.call(r,n)}),t.click.on(n=>{var r,a;A.nodeClick(n),(a=(r=e.events)==null?void 0:r.click)==null||a.call(r,n)}),t.mouseEnter.on(n=>{var r,a;A.nodeMouseEnter(n),(a=(r=e.events)==null?void 0:r.mouseEnter)==null||a.call(r,n)}),t.mouseMove.on(n=>{var r,a;A.nodeMouseMove(n),(a=(r=e.events)==null?void 0:r.mouseMove)==null||a.call(r,n)}),t.mouseLeave.on(n=>{var r,a;A.nodeMouseLeave(n),(a=(r=e.events)==null?void 0:r.mouseLeave)==null||a.call(r,n)}),t.contextMenu.on(n=>{var r,a;A.nodeContextMenu(n),(a=(r=e.events)==null?void 0:r.contextMenu)==null||a.call(r,n)}),t.dragStart.on(n=>{var r,a;A.nodeDragStart(n),(a=(r=e.events)==null?void 0:r.dragStart)==null||a.call(r,n)}),t.drag.on(n=>{var r,a;A.nodeDrag(n),(a=(r=e.events)==null?void 0:r.drag)==null||a.call(r,n)}),t.dragStop.on(n=>{var r,a;A.nodeDragStop(n),(a=(r=e.events)==null?void 0:r.dragStop)==null||a.call(r,n)}),Object.entries(t).reduce((n,[r,a])=>(n.emit[r]=a.trigger,n.on[r]=a.on,n),{emit:{},on:{}})}function rl(){const{getSelectedNodes:e,nodeExtent:A,updateNodePositions:t,findNode:n,snapGrid:r,snapToGrid:a,nodesDraggable:u,emits:d}=XA();return(h,g=!1)=>{const B=a.value?r.value[0]:5,w=a.value?r.value[1]:5,m=g?4:1,v=h.x*B*m,y=h.y*w*m,I=[];for(const T of e.value)if(T.draggable||u&&typeof T.draggable>"u"){const{position:D}=pi(T,{x:T.computedPosition.x+v,y:T.computedPosition.y+y},d.error,A.value,T.parentNode?n(T.parentNode):void 0);I.push({id:T.id,position:D,from:T.position,distance:{x:h.x,y:h.y},dimensions:T.dimensions})}t(I,!0,!1)}}var Or=.1,HB=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function mt(){return Pn("Viewport not initialized yet."),Promise.resolve(!1)}var IB={zoomIn:mt,zoomOut:mt,zoomTo:mt,fitView:mt,setCenter:mt,fitBounds:mt,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:mt,setTransform:mt,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function _B(e){function A(n,r){return new Promise(a=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(r?.interpolate==="linear"?Sn:vr).scaleBy(Ei(e.d3Selection,r?.duration,r?.ease,()=>{a(!0)}),n):a(!1)})}function t(n,r,a,u){return new Promise(d=>{var h;const{x:g,y:B}=va({x:-n,y:-r},e.translateExtent),w=qt.translate(-g,-B).scale(a);e.d3Selection&&e.d3Zoom?(h=e.d3Zoom)==null||h.interpolate(u?.interpolate==="linear"?Sn:vr).transform(Ei(e.d3Selection,u?.duration,u?.ease,()=>{d(!0)}),w):d(!1)})}return(0,o.computed)(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:n=>A(1.2,n),zoomOut:n=>A(1/1.2,n),zoomTo:(n,r)=>new Promise(a=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(r?.interpolate==="linear"?Sn:vr).scaleTo(Ei(e.d3Selection,r?.duration,r?.ease,()=>{a(!0)}),n):a(!1)}),setViewport:(n,r)=>t(n.x,n.y,n.zoom,r),setTransform:(n,r)=>t(n.x,n.y,n.zoom,r),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(n={padding:Or,includeHiddenNodes:!1,duration:0})=>{var r,a;const u=[];for(const B of e.nodes)B.dimensions.width&&B.dimensions.height&&(n?.includeHiddenNodes||!B.hidden)&&(!((r=n.nodes)!=null&&r.length)||(a=n.nodes)!=null&&a.length&&n.nodes.includes(B.id))&&u.push(B);if(!u.length)return Promise.resolve(!1);const{x:d,y:h,zoom:g}=_a(ba(u),e.dimensions.width,e.dimensions.height,n.minZoom??e.minZoom,n.maxZoom??e.maxZoom,n.padding??Or);return t(d,h,g,n)},setCenter:(n,r,a)=>{const u=typeof a?.zoom<"u"?a.zoom:e.maxZoom;return t(e.dimensions.width/2-n*u,e.dimensions.height/2-r*u,u,a)},fitBounds:(n,r={padding:Or})=>{const{x:a,y:u,zoom:d}=_a(n,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??Or);return t(a,u,d,r)},project:n=>Rn(n,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:n=>{if(e.vueFlowRef){const{x:r,y:a}=e.vueFlowRef.getBoundingClientRect();return Rn({x:n.x-r,y:n.y-a},e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:n=>{if(e.vueFlowRef){const{x:r,y:a}=e.vueFlowRef.getBoundingClientRect();return Kn({x:n.x+r,y:n.y+a},e.viewport)}return{x:0,y:0}}}:IB)}function Ei(e,A=0,t=HB,n=()=>{}){const r=typeof A=="number"&&A>0;return r||n(),r?e.transition().duration(A).ease(t).on("end",n):e}function SB(e,A,t){const n=(0,o.effectScope)(!0);return n.run(()=>{const r=()=>{n.run(()=>{let I,T,D=!!(t.nodes.value.length||t.edges.value.length);I=Yt([e.modelValue,()=>{var V,b;return(b=(V=e.modelValue)==null?void 0:V.value)==null?void 0:b.length}],([V])=>{V&&Array.isArray(V)&&(T?.pause(),t.setElements(V),!T&&!D&&V.length?D=!0:T?.resume())}),T=Yt([t.nodes,t.edges,()=>t.edges.value.length,()=>t.nodes.value.length],([V,b])=>{var K;(K=e.modelValue)!=null&&K.value&&Array.isArray(e.modelValue.value)&&(I?.pause(),e.modelValue.value=[...V,...b],(0,o.nextTick)(()=>{I?.resume()}))},{immediate:D}),(0,o.onScopeDispose)(()=>{I?.stop(),T?.stop()})})},a=()=>{n.run(()=>{let I,T,D=!!t.nodes.value.length;I=Yt([e.nodes,()=>{var V,b;return(b=(V=e.nodes)==null?void 0:V.value)==null?void 0:b.length}],([V])=>{V&&Array.isArray(V)&&(T?.pause(),t.setNodes(V),!T&&!D&&V.length?D=!0:T?.resume())}),T=Yt([t.nodes,()=>t.nodes.value.length],([V])=>{var b;(b=e.nodes)!=null&&b.value&&Array.isArray(e.nodes.value)&&(I?.pause(),e.nodes.value=[...V],(0,o.nextTick)(()=>{I?.resume()}))},{immediate:D}),(0,o.onScopeDispose)(()=>{I?.stop(),T?.stop()})})},u=()=>{n.run(()=>{let I,T,D=!!t.edges.value.length;I=Yt([e.edges,()=>{var V,b;return(b=(V=e.edges)==null?void 0:V.value)==null?void 0:b.length}],([V])=>{V&&Array.isArray(V)&&(T?.pause(),t.setEdges(V),!T&&!D&&V.length?D=!0:T?.resume())}),T=Yt([t.edges,()=>t.edges.value.length],([V])=>{var b;(b=e.edges)!=null&&b.value&&Array.isArray(e.edges.value)&&(I?.pause(),e.edges.value=[...V],(0,o.nextTick)(()=>{I?.resume()}))},{immediate:D}),(0,o.onScopeDispose)(()=>{I?.stop(),T?.stop()})})},d=()=>{n.run(()=>{(0,o.watch)(()=>A.maxZoom,()=>{A.maxZoom&&se(A.maxZoom)&&t.setMaxZoom(A.maxZoom)},{immediate:!0})})},h=()=>{n.run(()=>{(0,o.watch)(()=>A.minZoom,()=>{A.minZoom&&se(A.minZoom)&&t.setMinZoom(A.minZoom)},{immediate:!0})})},g=()=>{n.run(()=>{(0,o.watch)(()=>A.translateExtent,()=>{A.translateExtent&&se(A.translateExtent)&&t.setTranslateExtent(A.translateExtent)},{immediate:!0})})},B=()=>{n.run(()=>{(0,o.watch)(()=>A.nodeExtent,()=>{A.nodeExtent&&se(A.nodeExtent)&&t.setNodeExtent(A.nodeExtent)},{immediate:!0})})},w=()=>{n.run(()=>{(0,o.watch)(()=>A.applyDefault,()=>{se(A.applyDefault)&&(t.applyDefault.value=A.applyDefault)},{immediate:!0})})},m=()=>{n.run(()=>{const I=async T=>{let D=T;typeof A.autoConnect=="function"&&(D=await A.autoConnect(T)),D!==!1&&t.addEdges([D])};(0,o.watch)(()=>A.autoConnect,()=>{se(A.autoConnect)&&(t.autoConnect.value=A.autoConnect)},{immediate:!0}),(0,o.watch)(t.autoConnect,(T,D,V)=>{T?t.onConnect(I):t.hooks.value.connect.off(I),V(()=>{t.hooks.value.connect.off(I)})},{immediate:!0})})},v=()=>{const I=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const T of Object.keys(A)){const D=T;if(!I.includes(D)){const V=(0,o.toRef)(()=>A[D]),b=t[D];(0,o.isRef)(b)&&n.run(()=>{(0,o.watch)(V,K=>{se(K)&&(b.value=K)},{immediate:!0})})}}};r(),a(),u(),h(),d(),g(),B(),w(),m(),v()}),()=>n.stop()}function xB(){return{edgesChange:yA(),nodesChange:yA(),nodeDoubleClick:yA(),nodeClick:yA(),nodeMouseEnter:yA(),nodeMouseMove:yA(),nodeMouseLeave:yA(),nodeContextMenu:yA(),nodeDragStart:yA(),nodeDrag:yA(),nodeDragStop:yA(),nodesInitialized:yA(),miniMapNodeClick:yA(),miniMapNodeDoubleClick:yA(),miniMapNodeMouseEnter:yA(),miniMapNodeMouseMove:yA(),miniMapNodeMouseLeave:yA(),connect:yA(),connectStart:yA(),connectEnd:yA(),clickConnectStart:yA(),clickConnectEnd:yA(),paneReady:yA(),init:yA(),move:yA(),moveStart:yA(),moveEnd:yA(),selectionDragStart:yA(),selectionDrag:yA(),selectionDragStop:yA(),selectionContextMenu:yA(),selectionStart:yA(),selectionEnd:yA(),viewportChangeStart:yA(),viewportChange:yA(),viewportChangeEnd:yA(),paneScroll:yA(),paneClick:yA(),paneContextMenu:yA(),paneMouseEnter:yA(),paneMouseMove:yA(),paneMouseLeave:yA(),edgeContextMenu:yA(),edgeMouseEnter:yA(),edgeMouseMove:yA(),edgeMouseLeave:yA(),edgeDoubleClick:yA(),edgeClick:yA(),edgeUpdateStart:yA(),edgeUpdate:yA(),edgeUpdateEnd:yA(),updateNodeInternals:yA(),error:yA(e=>Pn(e.message))}}function DB(e,A){const t=(0,o.getCurrentInstance)();(0,o.onBeforeMount)(()=>{for(const[r,a]of Object.entries(A.value)){const u=d=>{e(r,d)};a.setEmitter(u),Fn(a.removeEmitter),a.setHasEmitListeners(()=>n(r)),Fn(a.removeHasEmitListeners)}});function n(r){var a;const u=NB(r);return!!((a=t?.vnode.props)!=null&&a[u])}}function NB(e){const[A,...t]=e.split(":");return`on${A.replace(/(?:^|-)(\w)/g,(n,r)=>r.toUpperCase())}${t.length?`:${t.join(":")}`:""}`}function ol(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:fi.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:kn.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:Lt.Bezier,style:{}},connectionMode:nt.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:NaN,y:NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:Lr()?"Meta":"Control",zoomActivationKeyCode:Lr()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:xB(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}var LB=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function TB(e,A,t){const n=_B(e),r=_=>{const F=_??[];e.hooks.updateNodeInternals.trigger(F)},a=_=>Jh(_,e.nodes,e.edges),u=_=>Wh(_,e.nodes,e.edges),d=_=>Ia(_,e.edges),h=({id:_,type:F,nodeId:x})=>{var G;const P=_?`-${F}-${_}`:`-${F}`;return Array.from(((G=e.connectionLookup.get(`${x}${P}`))==null?void 0:G.values())??[])},g=_=>{if(_)return A.value.get(_)},B=_=>{if(_)return t.value.get(_)},w=(_,F,x)=>{var G,P;const dA=[];for(const gA of _){const EA={id:gA.id,type:"position",dragging:x,from:gA.from};if(F&&(EA.position=gA.position,gA.parentNode)){const FA=g(gA.parentNode);EA.position={x:EA.position.x-(((G=FA?.computedPosition)==null?void 0:G.x)??0),y:EA.position.y-(((P=FA?.computedPosition)==null?void 0:P.y)??0)}}dA.push(EA)}dA?.length&&e.hooks.nodesChange.trigger(dA)},m=_=>{if(!e.vueFlowRef)return;const F=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!F)return;const x=window.getComputedStyle(F),{m22:G}=new window.DOMMatrixReadOnly(x.transform),P=[];for(const dA of _){const gA=dA,EA=g(gA.id);if(EA){const FA=Dr(gA.nodeElement);if(FA.width&&FA.height&&(EA.dimensions.width!==FA.width||EA.dimensions.height!==FA.height||gA.forceUpdate)){const NA=gA.nodeElement.getBoundingClientRect();EA.dimensions=FA,EA.handleBounds.source=Ya("source",gA.nodeElement,NA,G,EA.id),EA.handleBounds.target=Ya("target",gA.nodeElement,NA,G,EA.id),P.push({id:EA.id,type:"dimensions",dimensions:FA})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&n.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),P.length&&e.hooks.nodesChange.trigger(P)},v=(_,F)=>{const x=new Set,G=new Set;for(const gA of _)kt(gA)?x.add(gA.id):ht(gA)&&G.add(gA.id);const P=pt(A.value,x,!0),dA=pt(t.value,G);if(e.multiSelectionActive){for(const gA of x)P.push(Bt(gA,F));for(const gA of G)dA.push(Bt(gA,F))}P.length&&e.hooks.nodesChange.trigger(P),dA.length&&e.hooks.edgesChange.trigger(dA)},y=_=>{if(e.multiSelectionActive){const F=_.map(x=>Bt(x.id,!0));e.hooks.nodesChange.trigger(F);return}e.hooks.nodesChange.trigger(pt(A.value,new Set(_.map(F=>F.id)),!0)),e.hooks.edgesChange.trigger(pt(t.value))},I=_=>{if(e.multiSelectionActive){const F=_.map(x=>Bt(x.id,!0));e.hooks.edgesChange.trigger(F);return}e.hooks.edgesChange.trigger(pt(t.value,new Set(_.map(F=>F.id)))),e.hooks.nodesChange.trigger(pt(A.value,new Set,!0))},T=_=>{v(_,!0)},D=_=>{const F=(_||e.nodes).map(x=>(x.selected=!1,Bt(x.id,!1)));e.hooks.nodesChange.trigger(F)},V=_=>{const F=(_||e.edges).map(x=>(x.selected=!1,Bt(x.id,!1)));e.hooks.edgesChange.trigger(F)},b=_=>{if(!_||!_.length)return v([],!1);const F=_.reduce((x,G)=>{const P=Bt(G.id,!1);return kt(G)?x.nodes.push(P):x.edges.push(P),x},{nodes:[],edges:[]});F.nodes.length&&e.hooks.nodesChange.trigger(F.nodes),F.edges.length&&e.hooks.edgesChange.trigger(F.edges)},K=_=>{var F;(F=e.d3Zoom)==null||F.scaleExtent([_,e.maxZoom]),e.minZoom=_},sA=_=>{var F;(F=e.d3Zoom)==null||F.scaleExtent([e.minZoom,_]),e.maxZoom=_},W=_=>{var F;(F=e.d3Zoom)==null||F.translateExtent(_),e.translateExtent=_},cA=_=>{e.nodeExtent=_,r()},lA=_=>{var F;(F=e.d3Zoom)==null||F.clickDistance(_)},oA=_=>{e.nodesDraggable=_,e.nodesConnectable=_,e.elementsSelectable=_},iA=_=>{const F=_ instanceof Function?_(e.nodes):_;!e.initialized&&!F.length||(e.nodes=Wa(F,g,e.hooks.error.trigger))},AA=_=>{const F=_ instanceof Function?_(e.edges):_;if(!e.initialized&&!F.length)return;const x=Qi(F,e.isValidConnection,g,B,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);yi(e.connectionLookup,t.value,x),e.edges=x},S=_=>{const F=_ instanceof Function?_([...e.nodes,...e.edges]):_;!e.initialized&&!F.length||(iA(F.filter(kt)),AA(F.filter(ht)))},eA=_=>{let F=_ instanceof Function?_(e.nodes):_;F=Array.isArray(F)?F:[F];const x=Wa(F,g,e.hooks.error.trigger),G=[];for(const P of x)G.push(Ta(P));G.length&&e.hooks.nodesChange.trigger(G)},H=_=>{let F=_ instanceof Function?_(e.edges):_;F=Array.isArray(F)?F:[F];const x=Qi(F,e.isValidConnection,g,B,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),G=[];for(const P of x)G.push(Ta(P));G.length&&e.hooks.edgesChange.trigger(G)},X=(_,F=!0,x=!1)=>{const G=_ instanceof Function?_(e.nodes):_,P=Array.isArray(G)?G:[G],dA=[],gA=[];function EA(NA){const OA=d(NA);for(const KA of OA)(!se(KA.deletable)||KA.deletable)&&gA.push(Ma(KA.id,KA.source,KA.target,KA.sourceHandle,KA.targetHandle))}function FA(NA){const OA=[];for(const KA of e.nodes)KA.parentNode===NA&&OA.push(KA);if(OA.length){for(const KA of OA)dA.push(ka(KA.id));F&&EA(OA);for(const KA of OA)FA(KA.id)}}for(const NA of P){const OA=typeof NA=="string"?g(NA):NA;OA&&(se(OA.deletable)&&!OA.deletable||(dA.push(ka(OA.id)),F&&EA([OA]),x&&FA(OA.id)))}gA.length&&e.hooks.edgesChange.trigger(gA),dA.length&&e.hooks.nodesChange.trigger(dA)},U=_=>{const F=_ instanceof Function?_(e.edges):_,x=Array.isArray(F)?F:[F],G=[];for(const P of x){const dA=typeof P=="string"?B(P):P;dA&&(se(dA.deletable)&&!dA.deletable||G.push(Ma(typeof P=="string"?P:P.id,dA.source,dA.target,dA.sourceHandle,dA.targetHandle)))}e.hooks.edgesChange.trigger(G)},L=(_,F,x=!0)=>{const G=B(_.id);if(!G)return!1;const P=e.edges.indexOf(G),dA=wB(_,F,G,x,e.hooks.error.trigger);if(dA){const[gA]=Qi([dA],e.isValidConnection,g,B,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((EA,FA)=>FA===P?gA:EA),yi(e.connectionLookup,t.value,[gA]),gA}return!1},k=(_,F,x={replace:!1})=>{const G=B(_);if(!G)return;const P=typeof F=="function"?F(G):F;G.data=x.replace?P:{...G.data,...P}},N=_=>La(_,e.nodes),O=_=>{const F=La(_,e.edges);return yi(e.connectionLookup,t.value,F),F},Y=(_,F,x={replace:!1})=>{const G=g(_);if(!G)return;const P=typeof F=="function"?F(G):F;x.replace?e.nodes.splice(e.nodes.indexOf(G),1,P):Object.assign(G,P)},tA=(_,F,x={replace:!1})=>{const G=g(_);if(!G)return;const P=typeof F=="function"?F(G):F;G.data=x.replace?P:{...G.data,...P}},BA=(_,F,x=!1)=>{x?e.connectionClickStartHandle=_:e.connectionStartHandle=_,e.connectionEndHandle=null,e.connectionStatus=null,F&&(e.connectionPosition=F)},HA=(_,F=null,x=null)=>{e.connectionStartHandle&&(e.connectionPosition=_,e.connectionEndHandle=F,e.connectionStatus=x)},nA=(_,F)=>{e.connectionPosition={x:NaN,y:NaN},e.connectionEndHandle=null,e.connectionStatus=null,F?e.connectionClickStartHandle=null:e.connectionStartHandle=null},Z=_=>{const F=$h(_),x=F?null:On(_)?_:g(_.id);return!F&&!x?[null,null,F]:[F?_:Sr(x),x,F]},$=(_,F=!0,x=e.nodes)=>{const[G,P,dA]=Z(_);if(!G)return[];const gA=[];for(const EA of x||e.nodes){if(!dA&&(EA.id===P.id||!EA.computedPosition))continue;const FA=Sr(EA),NA=xr(FA,G);(F&&NA>0||NA>=FA.width*FA.height||NA>=Number(G.width)*Number(G.height))&&gA.push(EA)}return gA},uA=(_,F,x=!0)=>{const[G]=Z(_);if(!G)return!1;const P=xr(G,F);return x&&P>0||P>=Number(G.width)*Number(G.height)},wA=_=>{const{viewport:F,dimensions:x,d3Zoom:G,d3Selection:P,translateExtent:dA}=e;if(!G||!P||!_.x&&!_.y)return!1;const gA=qt.translate(F.x+_.x,F.y+_.y).scale(F.zoom),EA=[[0,0],[x.width,x.height]],FA=G.constrain()(gA,EA,dA),NA=e.viewport.x!==FA.x||e.viewport.y!==FA.y||e.viewport.zoom!==FA.k;return G.transform(P,FA),NA},QA=_=>{const F=_ instanceof Function?_(e):_,x=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];se(F.defaultEdgeOptions)&&(e.defaultEdgeOptions=F.defaultEdgeOptions);const G=F.modelValue||F.nodes||F.edges?[]:void 0;G&&(F.modelValue&&G.push(...F.modelValue),F.nodes&&G.push(...F.nodes),F.edges&&G.push(...F.edges),S(G));const P=()=>{se(F.maxZoom)&&sA(F.maxZoom),se(F.minZoom)&&K(F.minZoom),se(F.translateExtent)&&W(F.translateExtent)};for(const dA of Object.keys(F)){const gA=dA,EA=F[gA];![...LB,...x].includes(gA)&&se(EA)&&(e[gA]=EA)}Xo(()=>e.d3Zoom).not.toBeNull().then(P),e.initialized||(e.initialized=!0)};return{updateNodePositions:w,updateNodeDimensions:m,setElements:S,setNodes:iA,setEdges:AA,addNodes:eA,addEdges:H,removeNodes:X,removeEdges:U,findNode:g,findEdge:B,updateEdge:L,updateEdgeData:k,updateNode:Y,updateNodeData:tA,applyEdgeChanges:O,applyNodeChanges:N,addSelectedElements:T,addSelectedNodes:y,addSelectedEdges:I,setMinZoom:K,setMaxZoom:sA,setTranslateExtent:W,setNodeExtent:cA,setPaneClickDistance:lA,removeSelectedElements:b,removeSelectedNodes:D,removeSelectedEdges:V,startConnection:BA,updateConnection:HA,endConnection:nA,setInteractive:oA,setState:QA,getIntersectingNodes:$,getIncomers:a,getOutgoers:u,getConnectedEdges:d,getHandleConnections:h,isNodeIntersecting:uA,panBy:wA,fitView:_=>n.value.fitView(_),zoomIn:_=>n.value.zoomIn(_),zoomOut:_=>n.value.zoomOut(_),zoomTo:(_,F)=>n.value.zoomTo(_,F),setViewport:(_,F)=>n.value.setViewport(_,F),setTransform:(_,F)=>n.value.setTransform(_,F),getViewport:()=>n.value.getViewport(),getTransform:()=>n.value.getTransform(),setCenter:(_,F,x)=>n.value.setCenter(_,F,x),fitBounds:(_,F)=>n.value.fitBounds(_,F),project:_=>n.value.project(_),screenToFlowCoordinate:_=>n.value.screenToFlowCoordinate(_),flowToScreenCoordinate:_=>n.value.flowToScreenCoordinate(_),toObject:()=>{const _=[],F=[];for(const x of e.nodes){const{computedPosition:G,handleBounds:P,selected:dA,dimensions:gA,isParent:EA,resizing:FA,dragging:NA,events:OA,...KA}=x;_.push(KA)}for(const x of e.edges){const{selected:G,sourceNode:P,targetNode:dA,events:gA,...EA}=x;F.push(EA)}return JSON.parse(JSON.stringify({nodes:_,edges:F,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:_=>new Promise(F=>{const{nodes:x,edges:G,position:P,zoom:dA,viewport:gA}=_;x&&iA(x),G&&AA(G);const[EA,FA]=gA?.x&&gA?.y?[gA.x,gA.y]:P??[null,null];if(EA&&FA){const NA=gA?.zoom||dA||e.viewport.zoom;return Xo(()=>n.value.viewportInitialized).toBe(!0).then(()=>{n.value.setViewport({x:EA,y:FA,zoom:NA}).then(()=>{F(!0)})})}else F(!0)}),updateNodeInternals:r,viewportHelper:n,$reset:()=>{const _=ol();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const F=qt.translate(_.defaultViewport.x??0,_.defaultViewport.y??0).scale(Tt(_.defaultViewport.zoom??1,_.minZoom,_.maxZoom)),x=e.viewportRef.getBoundingClientRect(),G=[[0,0],[x.width,x.height]],P=e.d3Zoom.constrain()(F,G,_.translateExtent);e.d3Zoom.transform(e.d3Selection,P)}QA(_)},$destroy:()=>{}}}var kB=["data-id","data-handleid","data-nodeid","data-handlepos"],nn=(0,o.defineComponent)({name:"Handle",compatConfig:{MODE:3},props:{id:{default:null},type:{},position:{default:()=>IA.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:A}){const t=(0,o.createPropsRestProxy)(e,["position","connectable","connectableStart","connectableEnd","id"]),n=(0,o.toRef)(()=>t.type??"source"),r=(0,o.toRef)(()=>t.isValidConnection??null),{id:a,connectionStartHandle:u,connectionClickStartHandle:d,connectionEndHandle:h,vueFlowRef:g,nodesConnectable:B,noDragClassName:w,noPanClassName:m}=XA(),{id:v,node:y,nodeEl:I,connectedEdges:T}=nl(),D=(0,o.ref)(),V=(0,o.toRef)(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),b=(0,o.toRef)(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),K=(0,o.toRef)(()=>{var AA,S,eA,H,X,U;return((AA=u.value)==null?void 0:AA.nodeId)===v&&((S=u.value)==null?void 0:S.id)===e.id&&((eA=u.value)==null?void 0:eA.type)===n.value||((H=h.value)==null?void 0:H.nodeId)===v&&((X=h.value)==null?void 0:X.id)===e.id&&((U=h.value)==null?void 0:U.type)===n.value}),sA=(0,o.toRef)(()=>{var AA,S,eA;return((AA=d.value)==null?void 0:AA.nodeId)===v&&((S=d.value)==null?void 0:S.id)===e.id&&((eA=d.value)==null?void 0:eA.type)===n.value}),{handlePointerDown:W,handleClick:cA}=tl({nodeId:v,handleId:e.id,isValidConnection:r,type:n}),lA=(0,o.computed)(()=>typeof e.connectable=="string"&&e.connectable==="single"?!T.value.some(AA=>{const S=AA[`${n.value}Handle`];return AA[n.value]!==v?!1:S?S===e.id:!0}):typeof e.connectable=="number"?T.value.filter(AA=>{const S=AA[`${n.value}Handle`];return AA[n.value]!==v?!1:S?S===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,T.value):se(e.connectable)?e.connectable:B.value);(0,o.onMounted)(()=>{var AA;if(!y.dimensions.width||!y.dimensions.height)return;const S=(AA=y.handleBounds[n.value])==null?void 0:AA.find(N=>N.id===e.id);if(!g.value||S)return;const eA=g.value.querySelector(".vue-flow__transformationpane");if(!I.value||!D.value||!eA||!e.id)return;const H=I.value.getBoundingClientRect(),X=D.value.getBoundingClientRect(),U=window.getComputedStyle(eA),{m22:L}=new window.DOMMatrixReadOnly(U.transform),k={id:e.id,position:e.position,x:(X.left-H.left)/L,y:(X.top-H.top)/L,type:n.value,nodeId:v,...Dr(D.value)};y.handleBounds[n.value]=[...y.handleBounds[n.value]??[],k]});function oA(AA){const S=mi(AA);lA.value&&V.value&&(S&&AA.button===0||!S)&&W(AA)}function iA(AA){!v||!d.value&&!V.value||lA.value&&cA(AA)}return A({handleClick:cA,handlePointerDown:W,onClick:iA,onPointerDown:oA}),(AA,S)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"handle",ref:D,"data-id":`${(0,o.unref)(a)}-${(0,o.unref)(v)}-${e.id}-${n.value}`,"data-handleid":e.id,"data-nodeid":(0,o.unref)(v),"data-handlepos":AA.position,class:(0,o.normalizeClass)(["vue-flow__handle",[`vue-flow__handle-${AA.position}`,`vue-flow__handle-${e.id}`,(0,o.unref)(w),(0,o.unref)(m),n.value,{connectable:lA.value,connecting:sA.value,connectablestart:V.value,connectableend:b.value,connectionindicator:lA.value&&(V.value&&!K.value||b.value&&K.value)}]]),onMousedown:oA,onTouchstartPassive:oA,onClick:iA},[(0,o.renderSlot)(AA.$slots,"default",{id:AA.id})],42,kB))}}),Kr=function({sourcePosition:e=IA.Bottom,targetPosition:A=IA.Top,label:t,connectable:n=!0,isValidTargetPos:r,isValidSourcePos:a,data:u}){const d=u.label??t;return[(0,o.h)(nn,{type:"target",position:A,connectable:n,isValidConnection:r}),typeof d!="string"&&d?(0,o.h)(d):(0,o.h)(o.Fragment,[d]),(0,o.h)(nn,{type:"source",position:e,connectable:n,isValidConnection:a})]};Kr.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Kr.inheritAttrs=!1,Kr.compatConfig={MODE:3};var MB=Kr,Rr=function({targetPosition:e=IA.Top,label:A,connectable:t=!0,isValidTargetPos:n,data:r}){const a=r.label??A;return[(0,o.h)(nn,{type:"target",position:e,connectable:t,isValidConnection:n}),typeof a!="string"&&a?(0,o.h)(a):(0,o.h)(o.Fragment,[a])]};Rr.props=["targetPosition","label","isValidTargetPos","connectable","data"],Rr.inheritAttrs=!1,Rr.compatConfig={MODE:3};var OB=Rr,Vr=function({sourcePosition:e=IA.Bottom,label:A,connectable:t=!0,isValidSourcePos:n,data:r}){const a=r.label??A;return[typeof a!="string"&&a?(0,o.h)(a):(0,o.h)(o.Fragment,[a]),(0,o.h)(nn,{type:"source",position:e,connectable:t,isValidConnection:n})]};Vr.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Vr.inheritAttrs=!1,Vr.compatConfig={MODE:3};var KB=Vr,RB=["transform"],VB=["width","height","x","y","rx","ry"],PB=["y"],GB=(0,o.defineComponent)({name:"EdgeText",compatConfig:{MODE:3},props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const A=(0,o.ref)({x:0,y:0,width:0,height:0}),t=(0,o.ref)(null),n=(0,o.computed)(()=>`translate(${e.x-A.value.width/2} ${e.y-A.value.height/2})`);(0,o.onMounted)(r),(0,o.watch)([()=>e.x,()=>e.y,t,()=>e.label],r);function r(){if(!t.value)return;const a=t.value.getBBox();(a.width!==A.value.width||a.height!==A.value.height)&&(A.value=a)}return(a,u)=>((0,o.openBlock)(),(0,o.createElementBlock)("g",{transform:n.value,class:"vue-flow__edge-textwrapper"},[a.labelShowBg?((0,o.openBlock)(),(0,o.createElementBlock)("rect",{key:0,class:"vue-flow__edge-textbg",width:`${A.value.width+2*a.labelBgPadding[0]}px`,height:`${A.value.height+2*a.labelBgPadding[1]}px`,x:-a.labelBgPadding[0],y:-a.labelBgPadding[1],style:(0,o.normalizeStyle)(a.labelBgStyle),rx:a.labelBgBorderRadius,ry:a.labelBgBorderRadius},null,12,VB)):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("text",(0,o.mergeProps)(a.$attrs,{ref_key:"el",ref:t,class:"vue-flow__edge-text",y:A.value.height/2,dy:"0.3em",style:a.labelStyle}),[(0,o.renderSlot)(a.$slots,"default",{},()=>[typeof a.label!="string"?((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)(a.label),{key:0})):((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:1},[(0,o.createTextVNode)((0,o.toDisplayString)(a.label),1)],64))])],16,PB)],8,RB))}}),zB=["id","d","marker-end","marker-start"],XB=["d","stroke-width"],Gn=(0,o.defineComponent)({name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3},props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:A}){const t=(0,o.ref)(null),n=(0,o.ref)(null),r=(0,o.ref)(null),a=(0,o.useAttrs)();return A({pathEl:t,interactionEl:n,labelEl:r}),(u,d)=>((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,[(0,o.createElementVNode)("path",(0,o.mergeProps)((0,o.unref)(a),{id:u.id,ref_key:"pathEl",ref:t,d:u.path,class:"vue-flow__edge-path","marker-end":u.markerEnd,"marker-start":u.markerStart}),null,16,zB),u.interactionWidth?((0,o.openBlock)(),(0,o.createElementBlock)("path",{key:0,ref_key:"interactionEl",ref:n,fill:"none",d:u.path,"stroke-width":u.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,XB)):(0,o.createCommentVNode)("",!0),u.label&&u.labelX&&u.labelY?((0,o.openBlock)(),(0,o.createBlock)(GB,{key:1,ref_key:"labelEl",ref:r,x:u.labelX,y:u.labelY,label:u.label,"label-show-bg":u.labelShowBg,"label-bg-style":u.labelBgStyle,"label-bg-padding":u.labelBgPadding,"label-bg-border-radius":u.labelBgBorderRadius,"label-style":u.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):(0,o.createCommentVNode)("",!0)],64))}});function il({sourceX:e,sourceY:A,targetX:t,targetY:n}){const r=Math.abs(t-e)/2,a=t<e?t+r:t-r,u=Math.abs(n-A)/2;return[a,n<A?n+u:n-u,r,u]}function sl({sourceX:e,sourceY:A,targetX:t,targetY:n,sourceControlX:r,sourceControlY:a,targetControlX:u,targetControlY:d}){const h=e*.125+r*.375+u*.375+t*.125,g=A*.125+a*.375+d*.375+n*.125;return[h,g,Math.abs(h-e),Math.abs(g-A)]}function Pr(e,A){return e>=0?.5*e:A*25*Math.sqrt(-e)}function al({pos:e,x1:A,y1:t,x2:n,y2:r,c:a}){let u,d;switch(e){case IA.Left:u=A-Pr(A-n,a),d=t;break;case IA.Right:u=A+Pr(n-A,a),d=t;break;case IA.Top:u=A,d=t-Pr(t-r,a);break;case IA.Bottom:u=A,d=t+Pr(r-t,a);break}return[u,d]}function Fi(e){const{sourceX:A,sourceY:t,sourcePosition:n=IA.Bottom,targetX:r,targetY:a,targetPosition:u=IA.Top,curvature:d=.25}=e,[h,g]=al({pos:n,x1:A,y1:t,x2:r,y2:a,c:d}),[B,w]=al({pos:u,x1:r,y1:a,x2:A,y2:t,c:d}),[m,v,y,I]=sl({sourceX:A,sourceY:t,targetX:r,targetY:a,sourceControlX:h,sourceControlY:g,targetControlX:B,targetControlY:w});return[`M${A},${t} C${h},${g} ${B},${w} ${r},${a}`,m,v,y,I]}function ll({pos:e,x1:A,y1:t,x2:n,y2:r}){let a,u;switch(e){case IA.Left:case IA.Right:a=.5*(A+n),u=t;break;case IA.Top:case IA.Bottom:a=A,u=.5*(t+r);break}return[a,u]}function cl(e){const{sourceX:A,sourceY:t,sourcePosition:n=IA.Bottom,targetX:r,targetY:a,targetPosition:u=IA.Top}=e,[d,h]=ll({pos:n,x1:A,y1:t,x2:r,y2:a}),[g,B]=ll({pos:u,x1:r,y1:a,x2:A,y2:t}),[w,m,v,y]=sl({sourceX:A,sourceY:t,targetX:r,targetY:a,sourceControlX:d,sourceControlY:h,targetControlX:g,targetControlY:B});return[`M${A},${t} C${d},${h} ${g},${B} ${r},${a}`,w,m,v,y]}var ul={[IA.Left]:{x:-1,y:0},[IA.Right]:{x:1,y:0},[IA.Top]:{x:0,y:-1},[IA.Bottom]:{x:0,y:1}};function $B({source:e,sourcePosition:A=IA.Bottom,target:t}){return A===IA.Left||A===IA.Right?e.x<t.x?{x:1,y:0}:{x:-1,y:0}:e.y<t.y?{x:0,y:1}:{x:0,y:-1}}function dl(e,A){return Math.sqrt((A.x-e.x)**2+(A.y-e.y)**2)}function YB({source:e,sourcePosition:A=IA.Bottom,target:t,targetPosition:n=IA.Top,center:r,offset:a}){const u=ul[A],d=ul[n],h={x:e.x+u.x*a,y:e.y+u.y*a},g={x:t.x+d.x*a,y:t.y+d.y*a},B=$B({source:h,sourcePosition:A,target:g}),w=B.x!==0?"x":"y",m=B[w];let v,y,I;const T={x:0,y:0},D={x:0,y:0},[V,b,K,sA]=il({sourceX:e.x,sourceY:e.y,targetX:t.x,targetY:t.y});if(u[w]*d[w]===-1){y=r.x??V,I=r.y??b;const W=[{x:y,y:h.y},{x:y,y:g.y}],cA=[{x:h.x,y:I},{x:g.x,y:I}];u[w]===m?v=w==="x"?W:cA:v=w==="x"?cA:W}else{const W=[{x:h.x,y:g.y}],cA=[{x:g.x,y:h.y}];if(w==="x"?v=u.x===m?cA:W:v=u.y===m?W:cA,A===n){const iA=Math.abs(e[w]-t[w]);if(iA<=a){const AA=Math.min(a-1,a-iA);u[w]===m?T[w]=(h[w]>e[w]?-1:1)*AA:D[w]=(g[w]>t[w]?-1:1)*AA}}if(A!==n){const iA=w==="x"?"y":"x",AA=u[w]===d[iA],S=h[iA]>g[iA],eA=h[iA]<g[iA];(u[w]===1&&(!AA&&S||AA&&eA)||u[w]!==1&&(!AA&&eA||AA&&S))&&(v=w==="x"?W:cA)}const lA={x:h.x+T.x,y:h.y+T.y},oA={x:g.x+D.x,y:g.y+D.y};Math.max(Math.abs(lA.x-v[0].x),Math.abs(oA.x-v[0].x))>=Math.max(Math.abs(lA.y-v[0].y),Math.abs(oA.y-v[0].y))?(y=(lA.x+oA.x)/2,I=v[0].y):(y=v[0].x,I=(lA.y+oA.y)/2)}return[[e,{x:h.x+T.x,y:h.y+T.y},...v,{x:g.x+D.x,y:g.y+D.y},t],y,I,K,sA]}function WB(e,A,t,n){const r=Math.min(dl(e,A)/2,dl(A,t)/2,n),{x:a,y:u}=A;if(e.x===a&&a===t.x||e.y===u&&u===t.y)return`L${a} ${u}`;if(e.y===u){const h=e.x<t.x?-1:1,g=e.y<t.y?1:-1;return`L ${a+r*h},${u}Q ${a},${u} ${a},${u+r*g}`}const d=e.x<t.x?1:-1;return`L ${a},${u+r*(e.y<t.y?-1:1)}Q ${a},${u} ${a+r*d},${u}`}function Ui(e){const{sourceX:A,sourceY:t,sourcePosition:n=IA.Bottom,targetX:r,targetY:a,targetPosition:u=IA.Top,borderRadius:d=5,centerX:h,centerY:g,offset:B=20}=e,[w,m,v,y,I]=YB({source:{x:A,y:t},sourcePosition:n,target:{x:r,y:a},targetPosition:u,center:{x:h,y:g},offset:B});return[w.reduce((T,D,V)=>{let b;return V>0&&V<w.length-1?b=WB(w[V-1],D,w[V+1],d):b=`${V===0?"M":"L"}${D.x} ${D.y}`,T+=b,T},""),m,v,y,I]}function JB(e){const{sourceX:A,sourceY:t,targetX:n,targetY:r}=e,[a,u,d,h]=il({sourceX:A,sourceY:t,targetX:n,targetY:r});return[`M ${A},${t}L ${n},${r}`,a,u,d,h]}var ZB=(0,o.defineComponent)({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:A}){return()=>{const[t,n,r]=JB(e);return(0,o.h)(Gn,{path:t,labelX:n,labelY:r,...A,...e})}}}),fl=(0,o.defineComponent)({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:A}){return()=>{const[t,n,r]=Ui({...e,sourcePosition:e.sourcePosition??IA.Bottom,targetPosition:e.targetPosition??IA.Top});return(0,o.h)(Gn,{path:t,labelX:n,labelY:r,...A,...e})}}}),jB=(0,o.defineComponent)({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:A}){return()=>(0,o.h)(fl,{...e,...A,borderRadius:0})}}),qB=(0,o.defineComponent)({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:A}){return()=>{const[t,n,r]=Fi({...e,sourcePosition:e.sourcePosition??IA.Bottom,targetPosition:e.targetPosition??IA.Top});return(0,o.h)(Gn,{path:t,labelX:n,labelY:r,...A,...e})}}}),Ap=(0,o.defineComponent)({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:A}){return()=>{const[t,n,r]=cl({...e,sourcePosition:e.sourcePosition??IA.Bottom,targetPosition:e.targetPosition??IA.Top});return(0,o.h)(Gn,{path:t,labelX:n,labelY:r,...A,...e})}}}),ep={input:KB,default:MB,output:OB},tp={default:qB,straight:ZB,step:jB,smoothstep:fl,simplebezier:Ap};function np(e,A,t){const n=(0,o.computed)(()=>y=>A.value.get(y)),r=(0,o.computed)(()=>y=>t.value.get(y)),a=(0,o.computed)(()=>{const y={...tp,...e.edgeTypes},I=Object.keys(y);for(const T of e.edges)T.type&&!I.includes(T.type)&&(y[T.type]=T.type);return y}),u=(0,o.computed)(()=>{const y={...ep,...e.nodeTypes},I=Object.keys(y);for(const T of e.nodes)T.type&&!I.includes(T.type)&&(y[T.type]=T.type);return y}),d=(0,o.computed)(()=>e.onlyRenderVisibleElements?Ha(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),h=(0,o.computed)(()=>{if(e.onlyRenderVisibleElements){const y=[];for(const I of e.edges){const T=A.value.get(I.source),D=A.value.get(I.target);sB({sourcePos:T.computedPosition||{x:0,y:0},targetPos:D.computedPosition||{x:0,y:0},sourceWidth:T.dimensions.width,sourceHeight:T.dimensions.height,targetWidth:D.dimensions.width,targetHeight:D.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&y.push(I)}return y}return e.edges}),g=(0,o.computed)(()=>[...d.value,...h.value]),B=(0,o.computed)(()=>{const y=[];for(const I of e.nodes)I.selected&&y.push(I);return y}),w=(0,o.computed)(()=>{const y=[];for(const I of e.edges)I.selected&&y.push(I);return y}),m=(0,o.computed)(()=>[...B.value,...w.value]),v=(0,o.computed)(()=>{const y=[];for(const I of e.nodes)I.dimensions.width&&I.dimensions.height&&I.handleBounds!==void 0&&y.push(I);return y});return{getNode:n,getEdge:r,getElements:g,getEdgeTypes:a,getNodeTypes:u,getEdges:h,getNodes:d,getSelectedElements:m,getSelectedNodes:B,getSelectedEdges:w,getNodesInitialized:v,areNodesInitialized:(0,o.computed)(()=>d.value.length>0&&v.value.length===d.value.length)}}var rp=class yn{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var A;const t=(A=(0,o.getCurrentInstance)())==null?void 0:A.appContext.app;return yn.instance=t?.config.globalProperties.$vueFlowStorage??yn.instance??new yn,t&&(t.config.globalProperties.$vueFlowStorage=yn.instance),yn.instance}set(A,t){return this.flows.set(A,t)}get(A){return this.flows.get(A)}remove(A){return this.flows.delete(A)}create(A,t){const n=(0,o.reactive)(ol()),r={};for(const[w,m]of Object.entries(n.hooks)){const v=`on${w.charAt(0).toUpperCase()+w.slice(1)}`;r[v]=m.on}const a={};for(const[w,m]of Object.entries(n.hooks))a[w]=m.trigger;const u=(0,o.computed)(()=>{const w=new Map;for(const m of n.nodes)w.set(m.id,m);return w}),d=(0,o.computed)(()=>{const w=new Map;for(const m of n.edges)w.set(m.id,m);return w}),h=np(n,u,d),g=TB(n,u,d);g.setState({...n,...t});const B={...r,...h,...g,...ed(n),nodeLookup:u,edgeLookup:d,emits:a,id:A,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(A)}};return this.set(A,B),B}getId(){return`vue-flow-${this.currentId++}`}};function XA(e){const A=rp.getInstance(),t=(0,o.getCurrentScope)(),n=typeof e=="object",r=n?e:{id:e},a=r.id,u=a??t?.vueFlowId;let d;if(t){const h=(0,o.inject)(ja,null);typeof h<"u"&&h!==null&&(!u||h.id===u)&&(d=h)}if(d||u&&(d=A.get(u)),!d||u&&d.id!==u){const h=a??A.getId(),g=A.create(h,r);d=g,(t??(0,o.effectScope)(!0)).run(()=>{(0,o.watch)(g.applyDefault,(B,w,m)=>{const v=I=>{g.applyNodeChanges(I)},y=I=>{g.applyEdgeChanges(I)};B?(g.onNodesChange(v),g.onEdgesChange(y)):(g.hooks.value.nodesChange.off(v),g.hooks.value.edgesChange.off(y)),m(()=>{g.hooks.value.nodesChange.off(v),g.hooks.value.edgesChange.off(y)})},{immediate:!0}),Fn(()=>{if(d){const B=A.get(d.id);B?B.$destroy():Pn(`No store instance found for id ${d.id} in storage.`)}})})}else n&&d.setState(r);if(t&&((0,o.provide)(ja,d),t.vueFlowId=d.id),n){const h=(0,o.getCurrentInstance)();h?.type.name!=="VueFlow"&&d.emits.error(new ce(ie.USEVUEFLOW_OPTIONS))}return d}function op(e){const{emits:A,dimensions:t}=XA();let n;(0,o.onMounted)(()=>{const r=()=>{var a,u;if(!e.value||!(((u=(a=e.value).checkVisibility)==null?void 0:u.call(a))??!0))return;const d=Dr(e.value);(d.width===0||d.height===0)&&A.error(new ce(ie.MISSING_VIEWPORT_DIMENSIONS)),t.value={width:d.width||500,height:d.height||500}};r(),window.addEventListener("resize",r),e.value&&(n=new ResizeObserver(()=>r()),n.observe(e.value)),(0,o.onBeforeUnmount)(()=>{window.removeEventListener("resize",r),n&&e.value&&n.unobserve(e.value)})})}var ip=(0,o.defineComponent)({name:"UserSelection",compatConfig:{MODE:3},props:{userSelectionRect:{}},setup(e){return(A,t)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:"vue-flow__selection vue-flow__container",style:(0,o.normalizeStyle)({width:`${A.userSelectionRect.width}px`,height:`${A.userSelectionRect.height}px`,transform:`translate(${A.userSelectionRect.x}px, ${A.userSelectionRect.y}px)`})},null,4))}}),sp=["tabIndex"],ap=(0,o.defineComponent)({name:"NodesSelection",compatConfig:{MODE:3},setup(e){const{emits:A,viewport:t,getSelectedNodes:n,noPanClassName:r,disableKeyboardA11y:a,userSelectionActive:u}=XA(),d=rl(),h=(0,o.ref)(null),g=el({el:h,onStart(y){A.selectionDragStart(y),A.nodeDragStart(y)},onDrag(y){A.selectionDrag(y),A.nodeDrag(y)},onStop(y){A.selectionDragStop(y),A.nodeDragStop(y)}});(0,o.onMounted)(()=>{var y;a.value||(y=h.value)==null||y.focus({preventScroll:!0})});const B=(0,o.computed)(()=>ba(n.value)),w=(0,o.computed)(()=>({width:`${B.value.width}px`,height:`${B.value.height}px`,top:`${B.value.y}px`,left:`${B.value.x}px`}));function m(y){A.selectionContextMenu({event:y,nodes:n.value})}function v(y){a.value||An[y.key]&&(y.preventDefault(),d({x:An[y.key].x,y:An[y.key].y},y.shiftKey))}return(y,I)=>!(0,o.unref)(u)&&B.value.width&&B.value.height?((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:0,class:(0,o.normalizeClass)(["vue-flow__nodesselection vue-flow__container",(0,o.unref)(r)]),style:(0,o.normalizeStyle)({transform:`translate(${(0,o.unref)(t).x}px,${(0,o.unref)(t).y}px) scale(${(0,o.unref)(t).zoom})`})},[(0,o.createElementVNode)("div",{ref_key:"el",ref:h,class:(0,o.normalizeClass)([{dragging:(0,o.unref)(g)},"vue-flow__nodesselection-rect"]),style:(0,o.normalizeStyle)(w.value),tabIndex:(0,o.unref)(a)?void 0:-1,onContextmenu:m,onKeydown:v},null,46,sp)],6)):(0,o.createCommentVNode)("",!0)}});function lp(e,A){return{x:e.clientX-A.left,y:e.clientY-A.top}}var cp=(0,o.defineComponent)({name:"Pane",compatConfig:{MODE:3},props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:A,nodes:t,viewport:n,emits:r,userSelectionActive:a,removeSelectedElements:u,userSelectionRect:d,elementsSelectable:h,nodesSelectionActive:g,getSelectedEdges:B,getSelectedNodes:w,removeNodes:m,removeEdges:v,selectionMode:y,deleteKeyCode:I,multiSelectionKeyCode:T,multiSelectionActive:D,edgeLookup:V,nodeLookup:b,connectionLookup:K,defaultEdgeOptions:sA,connectionStartHandle:W,panOnDrag:cA}=XA(),lA=(0,o.shallowRef)(null),oA=(0,o.shallowRef)(new Set),iA=(0,o.shallowRef)(new Set),AA=(0,o.shallowRef)(null),S=(0,o.toRef)(()=>h.value&&(e.isSelecting||a.value)),eA=(0,o.toRef)(()=>W.value!==null);let H=!1,X=!1;const U=Mn(I,{actInsideInputWithModifier:!1}),L=Mn(T);(0,o.watch)(U,nA=>{nA&&(m(w.value),v(B.value),g.value=!1)}),(0,o.watch)(L,nA=>{D.value=nA});function k(nA,Z){return $=>{$.target===Z&&nA?.($)}}function N(nA){if(H||eA.value){H=!1;return}r.paneClick(nA),u(),g.value=!1}function O(nA){var Z;if(Array.isArray(cA.value)&&((Z=cA.value)!=null&&Z.includes(2))){nA.preventDefault();return}r.paneContextMenu(nA)}function Y(nA){r.paneScroll(nA)}function tA(nA){var Z,$,uA;if(AA.value=((Z=A.value)==null?void 0:Z.getBoundingClientRect())??null,!h.value||!e.isSelecting||nA.button!==0||nA.target!==lA.value||!AA.value)return;(uA=($=nA.target)==null?void 0:$.setPointerCapture)==null||uA.call($,nA.pointerId);const{x:wA,y:QA}=lp(nA,AA.value);X=!0,H=!1,u(),d.value={width:0,height:0,startX:wA,startY:QA,x:wA,y:QA},r.selectionStart(nA)}function BA(nA){var Z;if(!AA.value||!d.value)return;H=!0;const{x:$,y:uA}=$e(nA,AA.value),{startX:wA=0,startY:QA=0}=d.value,SA={startX:wA,startY:QA,x:$<wA?$:wA,y:uA<QA?uA:QA,width:Math.abs($-wA),height:Math.abs(uA-QA)},fA=oA.value,J=iA.value;oA.value=new Set(Ha(t.value,SA,n.value,y.value===fi.Partial,!0).map(F=>F.id)),iA.value=new Set;const _=((Z=sA.value)==null?void 0:Z.selectable)??!0;for(const F of oA.value){const x=K.value.get(F);if(x)for(const{edgeId:G}of x.values()){const P=V.value.get(G);P&&(P.selectable??_)&&iA.value.add(G)}}if(!Za(fA,oA.value)){const F=pt(b.value,oA.value,!0);r.nodesChange(F)}if(!Za(J,iA.value)){const F=pt(V.value,iA.value);r.edgesChange(F)}d.value=SA,a.value=!0,g.value=!1}function HA(nA){var Z;nA.button!==0||!X||((Z=nA.target)==null||Z.releasePointerCapture(nA.pointerId),!a.value&&d.value&&nA.target===lA.value&&N(nA),a.value=!1,d.value=null,g.value=oA.value.size>0,r.selectionEnd(nA),e.selectionKeyPressed&&(H=!1),X=!1)}return(nA,Z)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"container",ref:lA,class:(0,o.normalizeClass)(["vue-flow__pane vue-flow__container",{selection:nA.isSelecting}]),onClick:Z[0]||(Z[0]=$=>S.value?void 0:k(N,lA.value)($)),onContextmenu:Z[1]||(Z[1]=$=>k(O,lA.value)($)),onWheelPassive:Z[2]||(Z[2]=$=>k(Y,lA.value)($)),onPointerenter:Z[3]||(Z[3]=$=>S.value?void 0:(0,o.unref)(r).paneMouseEnter($)),onPointerdown:Z[4]||(Z[4]=$=>S.value?tA($):(0,o.unref)(r).paneMouseMove($)),onPointermove:Z[5]||(Z[5]=$=>S.value?BA($):(0,o.unref)(r).paneMouseMove($)),onPointerup:Z[6]||(Z[6]=$=>S.value?HA($):void 0),onPointerleave:Z[7]||(Z[7]=$=>(0,o.unref)(r).paneMouseLeave($))},[(0,o.renderSlot)(nA.$slots,"default"),(0,o.unref)(a)&&(0,o.unref)(d)?((0,o.openBlock)(),(0,o.createBlock)(ip,{key:0,"user-selection-rect":(0,o.unref)(d)},null,8,["user-selection-rect"])):(0,o.createCommentVNode)("",!0),(0,o.unref)(g)&&(0,o.unref)(w).length?((0,o.openBlock)(),(0,o.createBlock)(ap,{key:1})):(0,o.createCommentVNode)("",!0)],34))}}),up=(0,o.defineComponent)({name:"Transform",compatConfig:{MODE:3},setup(e){const{viewport:A,fitViewOnInit:t,fitViewOnInitDone:n}=XA(),r=(0,o.computed)(()=>t.value?!n.value:!1),a=(0,o.computed)(()=>`translate(${A.value.x}px,${A.value.y}px) scale(${A.value.zoom})`);return(u,d)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:"vue-flow__transformationpane vue-flow__container",style:(0,o.normalizeStyle)({transform:a.value,opacity:r.value?0:void 0})},[(0,o.renderSlot)(u.$slots,"default")],4))}}),dp=(0,o.defineComponent)({name:"Viewport",compatConfig:{MODE:3},setup(e){const{minZoom:A,maxZoom:t,defaultViewport:n,translateExtent:r,zoomActivationKeyCode:a,selectionKeyCode:u,panActivationKeyCode:d,panOnScroll:h,panOnScrollMode:g,panOnScrollSpeed:B,panOnDrag:w,zoomOnDoubleClick:m,zoomOnPinch:v,zoomOnScroll:y,preventScrolling:I,noWheelClassName:T,noPanClassName:D,emits:V,connectionStartHandle:b,userSelectionActive:K,paneDragging:sA,d3Zoom:W,d3Selection:cA,d3ZoomHandler:lA,viewport:oA,viewportRef:iA,paneClickDistance:AA}=XA();op(iA);const S=(0,o.shallowRef)(!1),eA=(0,o.shallowRef)(!1);let H=null,X=!1,U=0,L={x:0,y:0,zoom:0};const k=Mn(d),N=Mn(u),O=Mn(a),Y=(0,o.toRef)(()=>(!N.value||N.value&&u.value===!0)&&(k.value||w.value)),tA=(0,o.toRef)(()=>k.value||h.value),BA=(0,o.toRef)(()=>u.value===!0&&Y.value!==!0),HA=(0,o.toRef)(()=>N.value&&u.value!==!0||K.value||BA.value),nA=(0,o.toRef)(()=>b.value!==null);(0,o.onMounted)(()=>{if(!iA.value){Pn("Viewport element is missing");return}const QA=iA.value,SA=QA.getBoundingClientRect(),fA=Kh().clickDistance(AA.value).scaleExtent([A.value,t.value]).translateExtent(r.value),J=Te(QA).call(fA),_=J.on("wheel.zoom"),F=qt.translate(n.value.x??0,n.value.y??0).scale(Tt(n.value.zoom??1,A.value,t.value)),x=[[0,0],[SA.width,SA.height]],G=fA.constrain()(F,x,r.value);fA.transform(J,G),fA.wheelDelta(xa),W.value=fA,cA.value=J,lA.value=_,oA.value={x:G.x,y:G.y,zoom:G.k},fA.on("start",P=>{var dA;if(!P.sourceEvent)return null;U=P.sourceEvent.button,S.value=!0;const gA=uA(P.transform);((dA=P.sourceEvent)==null?void 0:dA.type)==="mousedown"&&(sA.value=!0),L=gA,V.viewportChangeStart(gA),V.moveStart({event:P,flowTransform:gA})}),fA.on("end",P=>{if(!P.sourceEvent)return null;if(S.value=!1,sA.value=!1,Z(Y.value,U??0)&&!X&&V.paneContextMenu(P.sourceEvent),X=!1,$(L,P.transform)){const dA=uA(P.transform);L=dA,V.viewportChangeEnd(dA),V.moveEnd({event:P,flowTransform:dA})}}),fA.filter(P=>{var dA;const gA=O.value||y.value,EA=v.value&&P.ctrlKey,FA=P.button,NA=P.type==="wheel";if(FA===1&&P.type==="mousedown"&&(wA(P,"vue-flow__node")||wA(P,"vue-flow__edge")))return!0;if(!Y.value&&!gA&&!tA.value&&!m.value&&!v.value||K.value||nA.value&&!NA||!m.value&&P.type==="dblclick"||wA(P,T.value)&&NA||wA(P,D.value)&&(!NA||tA.value&&NA&&!O.value)||!v.value&&P.ctrlKey&&NA||!gA&&!tA.value&&!EA&&NA)return!1;if(!v&&P.type==="touchstart"&&((dA=P.touches)==null?void 0:dA.length)>1)return P.preventDefault(),!1;if(!Y.value&&(P.type==="mousedown"||P.type==="touchstart")||BA.value&&Array.isArray(w.value)&&w.value.includes(0)&&FA===0||Array.isArray(w.value)&&!w.value.includes(FA)&&(P.type==="mousedown"||P.type==="touchstart"))return!1;const OA=Array.isArray(w.value)&&w.value.includes(FA)||u.value===!0&&Array.isArray(w.value)&&!w.value.includes(0)||!FA||FA<=1;return(!P.ctrlKey||k.value||NA)&&OA}),(0,o.watch)([K,Y],()=>{K.value&&!S.value?fA.on("zoom",null):K.value||fA.on("zoom",P=>{oA.value={x:P.transform.x,y:P.transform.y,zoom:P.transform.k};const dA=uA(P.transform);X=Z(Y.value,U??0),V.viewportChange(dA),V.move({event:P,flowTransform:dA})})},{immediate:!0}),(0,o.watch)([K,tA,g,O,v,I,T],()=>{tA.value&&!O.value&&!K.value?J.on("wheel.zoom",P=>{if(wA(P,T.value))return!1;const dA=O.value||y.value,gA=v.value&&P.ctrlKey;if(!(!I.value||tA.value||dA||gA))return!1;P.preventDefault(),P.stopImmediatePropagation();const EA=J.property("__zoom").k||1,FA=Lr();if(!k.value&&P.ctrlKey&&v.value&&FA){const qA=Pe(P),it=EA*2**xa(P);fA.scaleTo(J,it,qA,P);return}const NA=P.deltaMode===1?20:1;let OA=g.value===kn.Vertical?0:P.deltaX*NA,KA=g.value===kn.Horizontal?0:P.deltaY*NA;!FA&&P.shiftKey&&g.value!==kn.Vertical&&!OA&&KA&&(OA=KA,KA=0),fA.translateBy(J,-(OA/EA)*B.value,-(KA/EA)*B.value);const ee=uA(J.property("__zoom"));H&&clearTimeout(H),eA.value?(V.move({event:P,flowTransform:ee}),V.viewportChange(ee),H=setTimeout(()=>{V.moveEnd({event:P,flowTransform:ee}),V.viewportChangeEnd(ee),eA.value=!1},150)):(eA.value=!0,V.moveStart({event:P,flowTransform:ee}),V.viewportChangeStart(ee))},{passive:!1}):typeof _<"u"&&J.on("wheel.zoom",function(P,dA){const gA=!I.value&&P.type==="wheel"&&!P.ctrlKey,EA=O.value||y.value,FA=v.value&&P.ctrlKey;if(!EA&&!h.value&&!FA&&P.type==="wheel"||gA||wA(P,T.value))return null;P.preventDefault(),_.call(this,P,dA)},{passive:!1})},{immediate:!0})});function Z(QA,SA){return SA===2&&Array.isArray(QA)&&QA.includes(2)}function $(QA,SA){return QA.x!==SA.x&&!Number.isNaN(SA.x)||QA.y!==SA.y&&!Number.isNaN(SA.y)||QA.zoom!==SA.k&&!Number.isNaN(SA.k)}function uA(QA){return{x:QA.x,y:QA.y,zoom:QA.k}}function wA(QA,SA){return QA.target.closest(`.${SA}`)}return(QA,SA)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"viewportRef",ref:iA,class:"vue-flow__viewport vue-flow__container"},[(0,o.createVNode)(cp,{"is-selecting":HA.value,"selection-key-pressed":(0,o.unref)(N),class:(0,o.normalizeClass)({connecting:nA.value,dragging:(0,o.unref)(sA),draggable:(0,o.unref)(w)===!0||Array.isArray((0,o.unref)(w))&&(0,o.unref)(w).includes(0)})},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(up,null,{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(QA.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),fp=["id"],gp=["id"],hp=["id"],Bp=(0,o.defineComponent)({name:"A11yDescriptions",compatConfig:{MODE:3},setup(e){const{id:A,disableKeyboardA11y:t,ariaLiveMessage:n}=XA();return(r,a)=>((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,[(0,o.createElementVNode)("div",{id:`${(0,o.unref)(ma)}-${(0,o.unref)(A)}`,style:{display:"none"}}," Press enter or space to select a node. "+(0,o.toDisplayString)((0,o.unref)(t)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,fp),(0,o.createElementVNode)("div",{id:`${(0,o.unref)(wa)}-${(0,o.unref)(A)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,gp),(0,o.unref)(t)?(0,o.createCommentVNode)("",!0):((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:0,id:`${(0,o.unref)(Xh)}-${(0,o.unref)(A)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},(0,o.toDisplayString)((0,o.unref)(n)),9,hp))],64))}});function pp(){const e=XA();(0,o.watch)(()=>e.viewportHelper.value.viewportInitialized,A=>{A&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function mp(e,A,t){return t===IA.Left?e-A:t===IA.Right?e+A:e}function wp(e,A,t){return t===IA.Top?e-A:t===IA.Bottom?e+A:e}var bi=function({radius:e=10,centerX:A=0,centerY:t=0,position:n=IA.Top,type:r}){return(0,o.h)("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${r}`,cx:mp(A,e,n),cy:wp(t,e,n),r:e,stroke:"transparent",fill:"transparent"})};bi.props=["radius","centerX","centerY","position","type"],bi.compatConfig={MODE:3};var gl=bi,Cp=(0,o.defineComponent)({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:A,addSelectedEdges:t,connectionMode:n,edgeUpdaterRadius:r,emits:a,nodesSelectionActive:u,noPanClassName:d,getEdgeTypes:h,removeSelectedEdges:g,findEdge:B,findNode:w,isValidConnection:m,multiSelectionActive:v,disableKeyboardA11y:y,elementsSelectable:I,edgesUpdatable:T,edgesFocusable:D,hooks:V}=XA(),b=(0,o.computed)(()=>B(e.id)),{emit:K,on:sA}=QB(b.value,a),W=(0,o.inject)(kr),cA=(0,o.getCurrentInstance)(),lA=(0,o.ref)(!1),oA=(0,o.ref)(!1),iA=(0,o.ref)(""),AA=(0,o.ref)(null),S=(0,o.ref)("source"),eA=(0,o.ref)(null),H=(0,o.toRef)(()=>typeof b.value.selectable>"u"?I.value:b.value.selectable),X=(0,o.toRef)(()=>typeof b.value.updatable>"u"?T.value:b.value.updatable),U=(0,o.toRef)(()=>typeof b.value.focusable>"u"?D.value:b.value.focusable);(0,o.provide)(CB,e.id),(0,o.provide)(vB,eA);const L=(0,o.computed)(()=>b.value.class instanceof Function?b.value.class(b.value):b.value.class),k=(0,o.computed)(()=>b.value.style instanceof Function?b.value.style(b.value):b.value.style),N=(0,o.computed)(()=>{const F=b.value.type||"default",x=W?.[`edge-${F}`];if(x)return x;let G=b.value.template??h.value[F];if(typeof G=="string"&&cA){const P=Object.keys(cA.appContext.components);P&&P.includes(F)&&(G=(0,o.resolveComponent)(F,!1))}return G&&typeof G!="string"?G:(a.error(new ce(ie.EDGE_TYPE_MISSING,G)),!1)}),{handlePointerDown:O}=tl({nodeId:iA,handleId:AA,type:S,isValidConnection:m,edgeUpdaterType:S,onEdgeUpdate:BA,onEdgeUpdateEnd:HA});return()=>{const F=w(b.value.source),x=w(b.value.target),G="pathOptions"in b.value?b.value.pathOptions:{};if(!F&&!x)return a.error(new ce(ie.EDGE_SOURCE_TARGET_MISSING,b.value.id,b.value.source,b.value.target)),null;if(!F)return a.error(new ce(ie.EDGE_SOURCE_MISSING,b.value.id,b.value.source)),null;if(!x)return a.error(new ce(ie.EDGE_TARGET_MISSING,b.value.id,b.value.target)),null;if(!b.value||b.value.hidden||F.hidden||x.hidden)return null;let P;n.value===nt.Strict?P=F.handleBounds.source:P=[...F.handleBounds.source||[],...F.handleBounds.target||[]];const dA=Va(P,b.value.sourceHandle);let gA;n.value===nt.Strict?gA=x.handleBounds.target:gA=[...x.handleBounds.target||[],...x.handleBounds.source||[]];const EA=Va(gA,b.value.targetHandle),FA=dA?.position||IA.Bottom,NA=EA?.position||IA.Top,{x:OA,y:KA}=tn(F,dA,FA),{x:ee,y:qA}=tn(x,EA,NA);return b.value.sourceX=OA,b.value.sourceY=KA,b.value.targetX=ee,b.value.targetY=qA,(0,o.h)("g",{ref:eA,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${N.value===!1?"default":b.value.type||"default"}`,d.value,L.value,{updating:lA.value,selected:b.value.selected,animated:b.value.animated,inactive:!H.value&&!V.value.edgeClick.hasListeners()}],tabIndex:U.value?0:void 0,"aria-label":b.value.ariaLabel===null?void 0:b.value.ariaLabel??`Edge from ${b.value.source} to ${b.value.target}`,"aria-describedby":U.value?`${wa}-${A}`:void 0,"aria-roledescription":"edge",role:U.value?"group":"img",...b.value.domAttributes,onClick:Z,onContextmenu:$,onDblclick:uA,onMouseenter:wA,onMousemove:QA,onMouseleave:SA,onKeyDown:U.value?_:void 0},[oA.value?null:(0,o.h)(N.value===!1?h.value.default:N.value,{id:e.id,sourceNode:F,targetNode:x,source:b.value.source,target:b.value.target,type:b.value.type,updatable:X.value,selected:b.value.selected,animated:b.value.animated,label:b.value.label,labelStyle:b.value.labelStyle,labelShowBg:b.value.labelShowBg,labelBgStyle:b.value.labelBgStyle,labelBgPadding:b.value.labelBgPadding,labelBgBorderRadius:b.value.labelBgBorderRadius,data:b.value.data,events:{...b.value.events,...sA},style:k.value,markerStart:`url('#${Vn(b.value.markerStart,A)}')`,markerEnd:`url('#${Vn(b.value.markerEnd,A)}')`,sourcePosition:FA,targetPosition:NA,sourceX:OA,sourceY:KA,targetX:ee,targetY:qA,sourceHandleId:b.value.sourceHandle,targetHandleId:b.value.targetHandle,interactionWidth:b.value.interactionWidth,...G}),[X.value==="source"||X.value===!0?[(0,o.h)("g",{onMousedown:fA,onMouseenter:Y,onMouseout:tA},(0,o.h)(gl,{position:FA,centerX:OA,centerY:KA,radius:r.value,type:"source","data-type":"source"}))]:null,X.value==="target"||X.value===!0?[(0,o.h)("g",{onMousedown:J,onMouseenter:Y,onMouseout:tA},(0,o.h)(gl,{position:NA,centerX:ee,centerY:qA,radius:r.value,type:"target","data-type":"target"}))]:null]])};function Y(){lA.value=!0}function tA(){lA.value=!1}function BA(F,x){K.update({event:F,edge:b.value,connection:x})}function HA(F){K.updateEnd({event:F,edge:b.value}),oA.value=!1}function nA(F,x){F.button===0&&(oA.value=!0,iA.value=x?b.value.target:b.value.source,AA.value=(x?b.value.targetHandle:b.value.sourceHandle)??null,S.value=x?"target":"source",K.updateStart({event:F,edge:b.value}),O(F))}function Z(F){var x;const G={event:F,edge:b.value};H.value&&(u.value=!1,b.value.selected&&v.value?(g([b.value]),(x=eA.value)==null||x.blur()):t([b.value])),K.click(G)}function $(F){K.contextMenu({event:F,edge:b.value})}function uA(F){K.doubleClick({event:F,edge:b.value})}function wA(F){K.mouseEnter({event:F,edge:b.value})}function QA(F){K.mouseMove({event:F,edge:b.value})}function SA(F){K.mouseLeave({event:F,edge:b.value})}function fA(F){nA(F,!0)}function J(F){nA(F,!1)}function _(F){var x;!y.value&&Ca.includes(F.key)&&H.value&&(F.key==="Escape"?((x=eA.value)==null||x.blur(),g([B(e.id)])):t([B(e.id)]))}}}),vp=(0,o.defineComponent)({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:A,connectionMode:t,connectionStartHandle:n,connectionEndHandle:r,connectionPosition:a,connectionLineType:u,connectionLineStyle:d,connectionLineOptions:h,connectionStatus:g,viewport:B,findNode:w}=XA(),m=(e=(0,o.inject)(kr))==null?void 0:e["connection-line"],v=(0,o.computed)(()=>{var V;return w((V=n.value)==null?void 0:V.nodeId)}),y=(0,o.computed)(()=>{var V;return w((V=r.value)==null?void 0:V.nodeId)??null}),I=(0,o.computed)(()=>({x:(a.value.x-B.value.x)/B.value.zoom,y:(a.value.y-B.value.y)/B.value.zoom})),T=(0,o.computed)(()=>h.value.markerStart?`url(#${Vn(h.value.markerStart,A)})`:""),D=(0,o.computed)(()=>h.value.markerEnd?`url(#${Vn(h.value.markerEnd,A)})`:"");return()=>{var V,b,K;if(!v.value||!n.value)return null;const sA=n.value.id,W=n.value.type,cA=v.value.handleBounds;let lA=cA?.[W]??[];if(t.value===nt.Loose){const k=cA?.[W==="source"?"target":"source"]??[];lA=[...lA,...k]}if(!lA)return null;const oA=(sA?lA.find(k=>k.id===sA):lA[0])??null,iA=oA?.position??IA.Top,{x:AA,y:S}=tn(v.value,oA,iA);let eA=null;y.value&&(t.value===nt.Strict?eA=((V=y.value.handleBounds[W==="source"?"target":"source"])==null?void 0:V.find(k=>{var N;return k.id===((N=r.value)==null?void 0:N.id)}))||null:eA=((b=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:b.find(k=>{var N;return k.id===((N=r.value)==null?void 0:N.id)}))||null);const H=((K=r.value)==null?void 0:K.position)??(iA?Ci[iA]:null);if(!iA||!H)return null;const X=u.value??h.value.type??Lt.Bezier;let U="";const L={sourceX:AA,sourceY:S,sourcePosition:iA,targetX:I.value.x,targetY:I.value.y,targetPosition:H};return X===Lt.Bezier?[U]=Fi(L):X===Lt.Step?[U]=Ui({...L,borderRadius:0}):X===Lt.SmoothStep?[U]=Ui(L):X===Lt.SimpleBezier?[U]=cl(L):U=`M${AA},${S} ${I.value.x},${I.value.y}`,(0,o.h)("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},(0,o.h)("g",{class:"vue-flow__connection"},m?(0,o.h)(m,{sourceX:AA,sourceY:S,sourcePosition:iA,targetX:I.value.x,targetY:I.value.y,targetPosition:H,sourceNode:v.value,sourceHandle:oA,targetNode:y.value,targetHandle:eA,markerEnd:D.value,markerStart:T.value,connectionStatus:g.value}):(0,o.h)("path",{d:U,class:[h.value.class,g.value,"vue-flow__connection-path"],style:{...d.value,...h.value.style},"marker-end":D.value,"marker-start":T.value})))}}}),yp=["id","markerWidth","markerHeight","markerUnits","orient"],Qp=(0,o.defineComponent)({name:"MarkerType",compatConfig:{MODE:3},props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(A,t)=>((0,o.openBlock)(),(0,o.createElementBlock)("marker",{id:A.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${A.width}`,markerHeight:`${A.height}`,markerUnits:A.markerUnits,orient:A.orient},[A.type===(0,o.unref)(rt).ArrowClosed?((0,o.openBlock)(),(0,o.createElementBlock)("polyline",{key:0,style:(0,o.normalizeStyle)({stroke:A.color,fill:A.color,strokeWidth:A.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):(0,o.createCommentVNode)("",!0),A.type===(0,o.unref)(rt).Arrow?((0,o.openBlock)(),(0,o.createElementBlock)("polyline",{key:1,style:(0,o.normalizeStyle)({stroke:A.color,strokeWidth:A.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):(0,o.createCommentVNode)("",!0)],8,yp))}}),Ep={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},Fp=(0,o.defineComponent)({name:"MarkerDefinitions",compatConfig:{MODE:3},setup(e){const{id:A,edges:t,connectionLineOptions:n,defaultMarkerColor:r}=XA(),a=(0,o.computed)(()=>{const u=new Set,d=[],h=g=>{if(g){const B=Vn(g,A);u.has(B)||(typeof g=="object"?d.push({...g,id:B,color:g.color||r.value}):d.push({id:B,color:r.value,type:g}),u.add(B))}};for(const g of[n.value.markerEnd,n.value.markerStart])h(g);for(const g of t.value)for(const B of[g.markerStart,g.markerEnd])h(B);return d.sort((g,B)=>g.id.localeCompare(B.id))});return(u,d)=>((0,o.openBlock)(),(0,o.createElementBlock)("svg",Ep,[(0,o.createElementVNode)("defs",null,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(a.value,h=>((0,o.openBlock)(),(0,o.createBlock)(Qp,{id:h.id,key:h.id,type:h.type,color:h.color,width:h.width,height:h.height,markerUnits:h.markerUnits,"stroke-width":h.strokeWidth,orient:h.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),Up=(0,o.defineComponent)({name:"Edges",compatConfig:{MODE:3},setup(e){const{findNode:A,getEdges:t,elevateEdgesOnSelect:n}=XA();return(r,a)=>((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,[(0,o.createVNode)(Fp),((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)((0,o.unref)(t),u=>((0,o.openBlock)(),(0,o.createElementBlock)("svg",{key:u.id,class:"vue-flow__edges vue-flow__container",style:(0,o.normalizeStyle)({zIndex:(0,o.unref)(aB)(u,(0,o.unref)(A),(0,o.unref)(n))})},[(0,o.createVNode)((0,o.unref)(Cp),{id:u.id},null,8,["id"])],4))),128)),(0,o.createVNode)((0,o.unref)(vp))],64))}}),bp=(0,o.defineComponent)({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:A,noPanClassName:t,selectNodesOnDrag:n,nodesSelectionActive:r,multiSelectionActive:a,emits:u,removeSelectedNodes:d,addSelectedNodes:h,updateNodeDimensions:g,onUpdateNodeInternals:B,getNodeTypes:w,nodeExtent:m,elevateNodesOnSelect:v,disableKeyboardA11y:y,ariaLiveMessage:I,snapToGrid:T,snapGrid:D,nodeDragThreshold:V,nodesDraggable:b,elementsSelectable:K,nodesConnectable:sA,nodesFocusable:W,hooks:cA}=XA(),lA=(0,o.ref)(null);(0,o.provide)(Al,lA),(0,o.provide)(qa,e.id);const oA=(0,o.inject)(kr),iA=(0,o.getCurrentInstance)(),AA=rl(),{node:S,parentNode:eA}=nl(e.id),{emit:H,on:X}=bB(S,u),U=(0,o.toRef)(()=>typeof S.draggable>"u"?b.value:S.draggable),L=(0,o.toRef)(()=>typeof S.selectable>"u"?K.value:S.selectable),k=(0,o.toRef)(()=>typeof S.connectable>"u"?sA.value:S.connectable),N=(0,o.toRef)(()=>typeof S.focusable>"u"?W.value:S.focusable),O=(0,o.computed)(()=>L.value||U.value||cA.value.nodeClick.hasListeners()||cA.value.nodeDoubleClick.hasListeners()||cA.value.nodeMouseEnter.hasListeners()||cA.value.nodeMouseMove.hasListeners()||cA.value.nodeMouseLeave.hasListeners()),Y=(0,o.toRef)(()=>!!S.dimensions.width&&!!S.dimensions.height),tA=(0,o.computed)(()=>{const x=S.type||"default",G=oA?.[`node-${x}`];if(G)return G;let P=S.template||w.value[x];if(typeof P=="string"&&iA){const dA=Object.keys(iA.appContext.components);dA&&dA.includes(x)&&(P=(0,o.resolveComponent)(x,!1))}return P&&typeof P!="string"?P:(u.error(new ce(ie.NODE_TYPE_MISSING,P)),!1)}),BA=el({id:e.id,el:lA,disabled:()=>!U.value,selectable:L,dragHandle:()=>S.dragHandle,onStart(x){H.dragStart(x)},onDrag(x){H.drag(x)},onStop(x){H.dragStop(x)},onClick(x){_(x)}}),HA=(0,o.computed)(()=>S.class instanceof Function?S.class(S):S.class),nA=(0,o.computed)(()=>{const x=(S.style instanceof Function?S.style(S):S.style)||{},G=S.width instanceof Function?S.width(S):S.width,P=S.height instanceof Function?S.height(S):S.height;return!x.width&&G&&(x.width=typeof G=="string"?G:`${G}px`),!x.height&&P&&(x.height=typeof P=="string"?P:`${P}px`),x}),Z=(0,o.toRef)(()=>Number(S.zIndex??nA.value.zIndex??0));return B(x=>{(x.includes(e.id)||!x.length)&&uA()}),(0,o.onMounted)(()=>{(0,o.watch)(()=>S.hidden,(x=!1,G,P)=>{!x&&lA.value&&(e.resizeObserver.observe(lA.value),P(()=>{lA.value&&e.resizeObserver.unobserve(lA.value)}))},{immediate:!0,flush:"post"})}),(0,o.watch)([()=>S.type,()=>S.sourcePosition,()=>S.targetPosition],()=>{(0,o.nextTick)(()=>{g([{id:e.id,nodeElement:lA.value,forceUpdate:!0}])})}),(0,o.watch)([()=>S.position.x,()=>S.position.y,()=>{var x;return(x=eA.value)==null?void 0:x.computedPosition.x},()=>{var x;return(x=eA.value)==null?void 0:x.computedPosition.y},()=>{var x;return(x=eA.value)==null?void 0:x.computedPosition.z},Z,()=>S.selected,()=>S.dimensions.height,()=>S.dimensions.width,()=>{var x;return(x=eA.value)==null?void 0:x.dimensions.height},()=>{var x;return(x=eA.value)==null?void 0:x.dimensions.width}],([x,G,P,dA,gA,EA])=>{const FA={x,y:G,z:EA+(v.value&&S.selected?1e3:0)};typeof P<"u"&&typeof dA<"u"?S.computedPosition=tB({x:P,y:dA,z:gA},FA):S.computedPosition=FA},{flush:"post",immediate:!0}),(0,o.watch)([()=>S.extent,m],([x,G],[P,dA])=>{(x!==P||G!==dA)&&$()}),S.extent==="parent"||typeof S.extent=="object"&&"range"in S.extent&&S.extent.range==="parent"?Xo(()=>Y).toBe(!0).then($):$(),()=>S.hidden?null:(0,o.h)("div",{ref:lA,"data-id":S.id,class:["vue-flow__node",`vue-flow__node-${tA.value===!1?"default":S.type||"default"}`,{[t.value]:U.value,dragging:BA?.value,draggable:U.value,selected:S.selected,selectable:L.value,parent:S.isParent},HA.value],style:{visibility:Y.value?"visible":"hidden",zIndex:S.computedPosition.z??Z.value,transform:`translate(${S.computedPosition.x}px,${S.computedPosition.y}px)`,pointerEvents:O.value?"all":"none",...nA.value},tabIndex:N.value?0:void 0,role:N.value?"group":void 0,"aria-describedby":y.value?void 0:`${ma}-${A}`,"aria-label":S.ariaLabel,"aria-roledescription":"node",...S.domAttributes,onMouseenter:wA,onMousemove:QA,onMouseleave:SA,onContextmenu:fA,onClick:_,onDblclick:J,onKeydown:F},[(0,o.h)(tA.value===!1?w.value.default:tA.value,{id:S.id,type:S.type,data:S.data,events:{...S.events,...X},selected:S.selected,resizing:S.resizing,dragging:BA.value,connectable:k.value,position:S.computedPosition,dimensions:S.dimensions,isValidTargetPos:S.isValidTargetPos,isValidSourcePos:S.isValidSourcePos,parent:S.parentNode,parentNodeId:S.parentNode,zIndex:S.computedPosition.z??Z.value,targetPosition:S.targetPosition,sourcePosition:S.sourcePosition,label:S.label,dragHandle:S.dragHandle,onUpdateNodeInternals:uA})]);function $(){const x=S.computedPosition,{computedPosition:G,position:P}=pi(S,T.value?Tr(x,D.value):x,u.error,m.value,eA.value);(S.computedPosition.x!==G.x||S.computedPosition.y!==G.y)&&(S.computedPosition={...S.computedPosition,...G}),(S.position.x!==P.x||S.position.y!==P.y)&&(S.position=P)}function uA(){lA.value&&g([{id:e.id,nodeElement:lA.value,forceUpdate:!0}])}function wA(x){BA?.value||H.mouseEnter({event:x,node:S})}function QA(x){BA?.value||H.mouseMove({event:x,node:S})}function SA(x){BA?.value||H.mouseLeave({event:x,node:S})}function fA(x){return H.contextMenu({event:x,node:S})}function J(x){return H.doubleClick({event:x,node:S})}function _(x){L.value&&(!n.value||!U.value||V.value>0)&&vi(S,a.value,h,d,r,!1,lA.value),H.click({event:x,node:S})}function F(x){if(!(gi(x)||y.value))if(Ca.includes(x.key)&&L.value){const G=x.key==="Escape";vi(S,a.value,h,d,r,G,lA.value)}else U.value&&S.selected&&An[x.key]&&(x.preventDefault(),I.value=`Moved selected node ${x.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~S.position.x}, y: ${~~S.position.y}`,AA({x:An[x.key].x,y:An[x.key].y},x.shiftKey))}}}),Hp={height:"0",width:"0"},Ip=(0,o.defineComponent)({name:"EdgeLabelRenderer",compatConfig:{MODE:3},setup(e){const{viewportRef:A}=XA(),t=(0,o.toRef)(()=>{var n;return(n=A.value)==null?void 0:n.getElementsByClassName("vue-flow__edge-labels")[0]});return(n,r)=>((0,o.openBlock)(),(0,o.createElementBlock)("svg",null,[((0,o.openBlock)(),(0,o.createElementBlock)("foreignObject",Hp,[((0,o.openBlock)(),(0,o.createBlock)(o.Teleport,{to:t.value,disabled:!t.value},[(0,o.renderSlot)(n.$slots,"default")],8,["to","disabled"]))]))]))}});function _p(e={includeHiddenNodes:!1}){const{nodes:A}=XA();return(0,o.computed)(()=>{if(A.value.length===0)return!1;for(const t of A.value)if((e.includeHiddenNodes||!t.hidden)&&(t?.handleBounds===void 0||t.dimensions.width===0||t.dimensions.height===0))return!1;return!0})}var Sp={class:"vue-flow__nodes vue-flow__container"},xp=(0,o.defineComponent)({name:"Nodes",compatConfig:{MODE:3},setup(e){const{getNodes:A,updateNodeDimensions:t,emits:n}=XA(),r=_p(),a=(0,o.ref)();return(0,o.watch)(r,u=>{u&&(0,o.nextTick)(()=>{n.nodesInitialized(A.value)})},{immediate:!0}),(0,o.onMounted)(()=>{a.value=new ResizeObserver(u=>{const d=u.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));(0,o.nextTick)(()=>t(d))})}),(0,o.onBeforeUnmount)(()=>{var u;return(u=a.value)==null?void 0:u.disconnect()}),(u,d)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",Sp,[a.value?((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,{key:0},(0,o.renderList)((0,o.unref)(A),(h,g,B,w)=>{const m=[h.id];if(w&&w.key===h.id&&(0,o.isMemoSame)(w,m))return w;const v=((0,o.openBlock)(),(0,o.createBlock)((0,o.unref)(bp),{id:h.id,key:h.id,"resize-observer":a.value},null,8,["id","resize-observer"]));return v.memo=m,v},d,0),128)):(0,o.createCommentVNode)("",!0)]))}});function Dp(){const{emits:e}=XA();(0,o.onMounted)(()=>{if($a()){const A=document.querySelector(".vue-flow__pane");A&&window.getComputedStyle(A).zIndex!=="1"&&e.error(new ce(ie.MISSING_STYLES))}})}var Np=(0,o.createElementVNode)("div",{class:"vue-flow__edge-labels"},null,-1),Lp=(0,o.defineComponent)({name:"VueFlow",compatConfig:{MODE:3},props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:A,emit:t}){const n=e,r=(0,o.useSlots)(),a=$o(n,"modelValue",t),u=$o(n,"nodes",t),d=$o(n,"edges",t),h=XA(n),g=SB({modelValue:a,nodes:u,edges:d},n,h);return DB(t,h.hooks),pp(),Dp(),(0,o.provide)(kr,r),(0,o.onUnmounted)(g),A(h),(B,w)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref:(0,o.unref)(h).vueFlowRef,class:"vue-flow"},[(0,o.createVNode)(dp,null,{default:(0,o.withCtx)(()=>[(0,o.createVNode)(Up),Np,(0,o.createVNode)(xp),(0,o.renderSlot)(B.$slots,"zoom-pane")]),_:3}),(0,o.renderSlot)(B.$slots,"default"),(0,o.createVNode)(Bp)],512))}}),Tp=(0,o.defineComponent)({name:"Panel",compatConfig:{MODE:3},props:{position:{}},setup(e){const A=e,{userSelectionActive:t}=XA(),n=(0,o.computed)(()=>`${A.position}`.split("-"));return(r,a)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:(0,o.normalizeClass)(["vue-flow__panel",n.value]),style:(0,o.normalizeStyle)({pointerEvents:(0,o.unref)(t)?"none":"all"})},[(0,o.renderSlot)(r.$slots,"default")],6))}}),ot=(e=>(e.Lines="lines",e.Dots="dots",e))(ot||{}),kp=function({dimensions:e,size:A,color:t}){return(0,o.h)("path",{stroke:t,"stroke-width":A,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},Mp=function({radius:e,color:A}){return(0,o.h)("circle",{cx:e,cy:e,r:e,fill:A})};ot.Lines,ot.Dots;var Op={[ot.Dots]:"#81818a",[ot.Lines]:"#eee"},Kp=["id","x","y","width","height","patternTransform"],Rp={key:2,height:"100",width:"100"},Vp=["fill"],Pp=["x","y","fill"],Gp=(0,o.defineComponent)({name:"Background",compatConfig:{MODE:3},props:{id:{},variant:{default:()=>ot.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:A,viewport:t}=XA(),n=(0,o.computed)(()=>{const u=t.value.zoom,[d,h]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],g=[d*u||1,h*u||1],B=e.size*u,[w,m]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset];return{scaledGap:g,offset:[w*u||1+g[0]/2,m*u||1+g[1]/2],size:B}}),r=(0,o.toRef)(()=>`pattern-${A}${e.id?`-${e.id}`:""}`),a=(0,o.toRef)(()=>e.color||e.patternColor||Op[e.variant||ot.Dots]);return(u,d)=>((0,o.openBlock)(),(0,o.createElementBlock)("svg",{class:"vue-flow__background vue-flow__container",style:(0,o.normalizeStyle)({height:`${u.height>100?100:u.height}%`,width:`${u.width>100?100:u.width}%`})},[(0,o.renderSlot)(u.$slots,"pattern-container",{id:r.value},()=>[(0,o.createElementVNode)("pattern",{id:r.value,x:(0,o.unref)(t).x%n.value.scaledGap[0],y:(0,o.unref)(t).y%n.value.scaledGap[1],width:n.value.scaledGap[0],height:n.value.scaledGap[1],patternTransform:`translate(-${n.value.offset[0]},-${n.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[(0,o.renderSlot)(u.$slots,"pattern",{},()=>[u.variant===(0,o.unref)(ot).Lines?((0,o.openBlock)(),(0,o.createBlock)((0,o.unref)(kp),{key:0,size:u.lineWidth,color:a.value,dimensions:n.value.scaledGap},null,8,["size","color","dimensions"])):u.variant===(0,o.unref)(ot).Dots?((0,o.openBlock)(),(0,o.createBlock)((0,o.unref)(Mp),{key:1,color:a.value,radius:n.value.size/2},null,8,["color","radius"])):(0,o.createCommentVNode)("",!0),u.bgColor?((0,o.openBlock)(),(0,o.createElementBlock)("svg",Rp,[(0,o.createElementVNode)("rect",{width:"100%",height:"100%",fill:u.bgColor},null,8,Vp)])):(0,o.createCommentVNode)("",!0)])],8,Kp)]),(0,o.createElementVNode)("rect",{x:u.x,y:u.y,width:"100%",height:"100%",fill:`url(#${r.value})`},null,8,Pp),(0,o.renderSlot)(u.$slots,"default",{id:r.value})],4))}}),zp={name:"ControlButton",compatConfig:{MODE:3}},Xp=(e,A)=>{const t=e.__vccOpts||e;for(const[n,r]of A)t[n]=r;return t},$p={type:"button",class:"vue-flow__controls-button"};function Yp(e,A,t,n,r,a){return(0,o.openBlock)(),(0,o.createElementBlock)("button",$p,[(0,o.renderSlot)(e.$slots,"default")])}var Gr=Xp(zp,[["render",Yp]]),Wp={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Jp=[(0,o.createElementVNode)("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function Zp(e,A){return(0,o.openBlock)(),(0,o.createElementBlock)("svg",Wp,Jp)}var jp={render:Zp},qp={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Am=[(0,o.createElementVNode)("path",{d:"M0 0h32v4.2H0z"},null,-1)];function em(e,A){return(0,o.openBlock)(),(0,o.createElementBlock)("svg",qp,Am)}var tm={render:em},nm={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},rm=[(0,o.createElementVNode)("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function om(e,A){return(0,o.openBlock)(),(0,o.createElementBlock)("svg",nm,rm)}var im={render:om},sm={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},am=[(0,o.createElementVNode)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function lm(e,A){return(0,o.openBlock)(),(0,o.createElementBlock)("svg",sm,am)}var cm={render:lm},um={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},dm=[(0,o.createElementVNode)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function fm(e,A){return(0,o.openBlock)(),(0,o.createElementBlock)("svg",um,dm)}var gm={render:fm},hm=(0,o.defineComponent)({name:"Controls",compatConfig:{MODE:3},props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Ba.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:A}){const{nodesDraggable:t,nodesConnectable:n,elementsSelectable:r,setInteractive:a,zoomIn:u,zoomOut:d,fitView:h,viewport:g,minZoom:B,maxZoom:w}=XA(),m=(0,o.toRef)(()=>t.value||n.value||r.value),v=(0,o.toRef)(()=>g.value.zoom<=B.value),y=(0,o.toRef)(()=>g.value.zoom>=w.value);function I(){u(),A("zoomIn")}function T(){d(),A("zoomOut")}function D(){h(e.fitViewParams),A("fitView")}function V(){a(!m.value),A("interactionChange",!m.value)}return(b,K)=>((0,o.openBlock)(),(0,o.createBlock)((0,o.unref)(Tp),{class:"vue-flow__controls",position:b.position},{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(b.$slots,"top"),b.showZoom?((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:0},[(0,o.renderSlot)(b.$slots,"control-zoom-in",{},()=>[(0,o.createVNode)(Gr,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:I},{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(b.$slots,"icon-zoom-in",{},()=>[((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)((0,o.unref)(jp))))])]),_:3},8,["disabled"])]),(0,o.renderSlot)(b.$slots,"control-zoom-out",{},()=>[(0,o.createVNode)(Gr,{class:"vue-flow__controls-zoomout",disabled:v.value,onClick:T},{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(b.$slots,"icon-zoom-out",{},()=>[((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)((0,o.unref)(tm))))])]),_:3},8,["disabled"])])],64)):(0,o.createCommentVNode)("",!0),b.showFitView?(0,o.renderSlot)(b.$slots,"control-fit-view",{key:1},()=>[(0,o.createVNode)(Gr,{class:"vue-flow__controls-fitview",onClick:D},{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(b.$slots,"icon-fit-view",{},()=>[((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)((0,o.unref)(im))))])]),_:3})]):(0,o.createCommentVNode)("",!0),b.showInteractive?(0,o.renderSlot)(b.$slots,"control-interactive",{key:2},()=>[b.showInteractive?((0,o.openBlock)(),(0,o.createBlock)(Gr,{key:0,class:"vue-flow__controls-interactive",onClick:V},{default:(0,o.withCtx)(()=>[m.value?(0,o.renderSlot)(b.$slots,"icon-unlock",{key:0},()=>[((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)((0,o.unref)(gm))))]):(0,o.createCommentVNode)("",!0),m.value?(0,o.createCommentVNode)("",!0):(0,o.renderSlot)(b.$slots,"icon-lock",{key:1},()=>[((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)((0,o.unref)(cm))))])]),_:3})):(0,o.createCommentVNode)("",!0)]):(0,o.createCommentVNode)("",!0),(0,o.renderSlot)(b.$slots,"default")]),_:3},8,["position"]))}}),Bm=["onClick"],pm={class:"d-flow-node-menus-item-name"},mm=(0,o.defineComponent)({name:"DNodeMenus",__name:"nodeMenus",props:{fromNodeId:{},handleId:{}},emits:["addNode"],setup(e,{emit:A}){const t=e,n=A,r=(0,o.inject)("d_flow_design_provide",{}),a=r.getFlowComponents?.()||[],u=d=>{n("addNode",d.type),(0,o.nextTick)(()=>{t.handleId==="line"?r.addNodeByLine?.(d.type,t.fromNodeId||""):r.addNode?.(d.type,t.fromNodeId||"",t.handleId||"")})};return(d,h)=>{const g=(0,o.resolveComponent)("j-icon");return(0,o.openBlock)(),(0,o.createElementBlock)("div",{class:"d-flow-node-menus",onClick:(0,o.withModifiers)(()=>{},["stop"])},[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)((0,o.unref)(a),(B,w)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:w,class:"d-flow-node-menus-item",onClick:m=>u(B)},[(0,o.createElementVNode)("div",{class:"d-flow-node-menus-item-icon",style:(0,o.normalizeStyle)({backgroundColor:B.iconColor||"var(--j-color-primary)"})},[(0,o.createVNode)(g,{icon:B.icon||"mdi:source-branch"},null,8,["icon"])],4),(0,o.createElementVNode)("div",pm,(0,o.toDisplayString)(B.name),1)],8,Bm))),128))])}}}),Hi=mm,wm={class:"d-flow-step-name"},Cm={key:0,style:{color:"var(--j-color-text-2)"}},vm={style:{color:"var(--j-color-text)"}},ym=(0,o.defineComponent)({name:"DStepNode",__name:"stepNode",props:{id:{},data:{}},setup(e){const A=e,{onNodeClick:t,onEdgeClick:n,onMoveStart:r,onConnectStart:a,onNodeDragStart:u,removeNodes:d,getEdges:h,getNodes:g,onNodesChange:B}=XA(),w=(0,o.inject)("d_flow_design_provide",{}),m=(0,o.computed)(()=>w.getFlowComponentMap?.value?.[A.data.type]||{}),v=()=>{d(A.id),w.onRemoveNode?.(A.id)},y=(0,o.ref)({});B(eA=>{if(A.data.isInit&&eA.findIndex(H=>H.type==="select"&&H.id===A.id&&H.id==="start"&&H.selected)!==-1){const H=g.value.find(X=>X.id==="start");H&&(H.data.isInit=!1),y.value.s1=!0}});const I=(0,o.ref)(!1),T=eA=>{eA.indexOf("t")!==-1&&!D.value||(I.value=!0,y.value[eA]=!0)},D=(0,o.computed)(()=>h.value.findIndex(eA=>eA.target===A.id)===-1),V=(0,o.ref)(!1),b=()=>{V.value=!0},K=(eA,H)=>{if(h.value.find(U=>U.source===H&&U.target===eA))return!0;const X=h.value.filter(U=>U.target===eA);for(let U=0;U<X.length;U++)if(K(X[U].source,H))return!0;return!1},sA=eA=>V.value?(V.value=!1,!1):K(eA.source,eA.target)?!1:eA.source!==eA.target&&eA.sourceHandle!==eA.targetHandle&&eA.sourceHandle.indexOf("s")!==-1&&eA.targetHandle.indexOf("t")!==-1,W=()=>{AA(),Object.keys(y.value).forEach(eA=>{y.value[eA]=!1})},cA=()=>{W()};t(()=>{console.log("onNodeClick"),I.value?I.value=!1:W()}),n(()=>{W()}),r(()=>{W()}),a(()=>{W()}),u(()=>{W()});const lA=(0,o.ref)(),oA=(0,o.ref)({top:0,left:0,bottom:0,right:0}),iA=(0,o.ref)({getBoundingClientRect:()=>oA.value}),AA=()=>{lA.value?.handleClose()},S=eA=>{const{clientX:H,clientY:X}=eA;oA.value=DOMRect.fromRect({x:H,y:X}),eA.preventDefault(),lA.value?.handleOpen()};return(eA,H)=>{const X=(0,o.resolveComponent)("j-icon"),U=(0,o.resolveComponent)("el-popover"),L=(0,o.resolveComponent)("el-tooltip"),k=(0,o.resolveComponent)("el-dropdown-item"),N=(0,o.resolveComponent)("el-dropdown-menu"),O=(0,o.resolveComponent)("el-dropdown");return(0,o.openBlock)(),(0,o.createElementBlock)("div",{class:"d-flow-step",onContextmenu:(0,o.withModifiers)(S,["stop"])},[(0,o.createElementVNode)("div",{class:"d-flow-step-icon",style:(0,o.normalizeStyle)({backgroundColor:m.value.iconColor||"var(--j-color-primary)"})},[(0,o.createVNode)(X,{icon:m.value.icon||"mdi:source-branch"},null,8,["icon"])],4),(0,o.createElementVNode)("div",wm,(0,o.toDisplayString)(m.value.name),1),e.data.type!=="start"?((0,o.openBlock)(),(0,o.createBlock)(L,{key:0,placement:"top","show-arrow":!1,"popper-class":"d-flow-step-tooltip"},{content:(0,o.withCtx)(()=>[D.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",Cm,[...H[4]||(H[4]=[(0,o.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"点击",-1),(0,o.createTextVNode)("添加节点 ",-1)])])):(0,o.createCommentVNode)("",!0),H[5]||(H[5]=(0,o.createElementVNode)("div",{style:{color:"var(--j-color-text-2)"}},[(0,o.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"拖拽"),(0,o.createTextVNode)("连接节点 ")],-1))]),default:(0,o.withCtx)(()=>[(0,o.createVNode)((0,o.unref)(nn),{onClick:H[1]||(H[1]=Y=>T("t1")),onMousedown:b,id:"t1",class:(0,o.normalizeClass)(["d-flow-step-target-handle",{"d-flow-step-target-handle-notadd":!D.value}]),type:"target",position:(0,o.unref)(IA).Left,"is-valid-connection":sA},{default:(0,o.withCtx)(()=>[D.value?((0,o.openBlock)(),(0,o.createBlock)(U,{key:0,visible:y.value.t1,"onUpdate:visible":H[0]||(H[0]=Y=>y.value.t1=Y),placement:"left","popper-class":"d-flow-step-popper",trigger:"click","show-arrow":!1,"popper-options":{strategy:"fixed"}},{reference:(0,o.withCtx)(()=>[(0,o.createVNode)(X,{class:"d-flow-step-handle-plus",icon:"mdi:plus-circle"})]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(Hi,{"handle-id":"t1","from-node-id":e.id,onAddNode:cA},null,8,["from-node-id"])]),_:1},8,["visible"])):(0,o.createCommentVNode)("",!0)]),_:1},8,["class","position"])]),_:1})):(0,o.createCommentVNode)("",!0),(0,o.createVNode)(L,{placement:"top","show-arrow":!1,"popper-class":"d-flow-step-tooltip"},{content:(0,o.withCtx)(()=>[...H[6]||(H[6]=[(0,o.createElementVNode)("div",{style:{color:"var(--j-color-text-2)"}},[(0,o.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"点击"),(0,o.createTextVNode)("添加节点 ")],-1),(0,o.createElementVNode)("div",{style:{color:"var(--j-color-text-2)"}},[(0,o.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"拖拽"),(0,o.createTextVNode)("连接节点 ")],-1)])]),default:(0,o.withCtx)(()=>[(0,o.createVNode)((0,o.unref)(nn),{onClick:H[3]||(H[3]=Y=>T("s1")),onMousedown:b,id:"s1",class:"d-flow-step-source-handle",type:"source",position:(0,o.unref)(IA).Right,"is-valid-connection":sA},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(U,{visible:y.value.s1,"onUpdate:visible":H[2]||(H[2]=Y=>y.value.s1=Y),placement:"right",trigger:"click","popper-class":"d-flow-step-popper","show-arrow":!1,"popper-options":{strategy:"fixed"}},{reference:(0,o.withCtx)(()=>[(0,o.createVNode)(X,{class:"d-flow-step-handle-plus",icon:"mdi:plus-circle"})]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(Hi,{"handle-id":"s1","from-node-id":e.id,onAddNode:cA},null,8,["from-node-id"])]),_:1},8,["visible"])]),_:1},8,["position"])]),_:1}),(0,o.createVNode)(O,{ref_key:"dropdownRef",ref:lA,"popper-class":"d-flow-step-dropdown","virtual-ref":iA.value,"show-arrow":!1,"popper-options":{modifiers:[{name:"offset",options:{offset:[0,0]}}]},"virtual-triggering":"",trigger:"contextmenu",placement:"bottom-start"},{dropdown:(0,o.withCtx)(()=>[(0,o.createVNode)(N,null,{default:(0,o.withCtx)(()=>[e.data.type!="start"?((0,o.openBlock)(),(0,o.createBlock)(k,{key:0,onClick:v},{default:(0,o.withCtx)(()=>[...H[7]||(H[7]=[(0,o.createTextVNode)("删除",-1)])]),_:1})):(0,o.createCommentVNode)("",!0),m.value.des?((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:1,style:(0,o.normalizeStyle)({width:"160px",padding:"4px 16px 0 16px","font-size":"12px","border-top":e.data.type!="start"?"1px solid var(--j-color-border)":void 0,"margin-top":e.data.type!="start"?"4px":void 0})},[H[8]||(H[8]=(0,o.createElementVNode)("div",{style:{"margin-bottom":"4px",color:"var(--j-color-text-2)"}},"关于",-1)),(0,o.createElementVNode)("div",vm,(0,o.toDisplayString)(m.value.des),1)],4)):(0,o.createCommentVNode)("",!0)]),_:1})]),_:1},8,["virtual-ref"])],32)}}}),Qm=ym,Em=(0,o.defineComponent)({name:"DEdgeWithButton",__name:"edgeWithButton",props:{id:{},sourceX:{},sourceY:{},targetX:{},targetY:{},sourcePosition:{},targetPosition:{},markerEnd:{},style:{}},setup(e){const A=e,{onEdgeMouseEnter:t,onEdgeMouseLeave:n,onNodeClick:r,onEdgeClick:a,onMoveStart:u,onConnectStart:d,onNodeDragStart:h}=XA(),g=(0,o.computed)(()=>Fi(A)),B=(0,o.ref)(!1),w=(0,o.ref)(!1);t(({edge:T})=>{T.id===A.id&&(B.value=!0)}),n(()=>{B.value=!1});const m=(0,o.ref)(!1),v=()=>{m.value=!1,(0,o.nextTick)(()=>{w.value=!1})},y=()=>{w.value=!0,m.value=!0},I=()=>{v()};return r(()=>{v()}),a(()=>{v()}),u(()=>{v()}),d(()=>{v()}),h(()=>{v()}),(T,D)=>{const V=(0,o.resolveComponent)("j-icon"),b=(0,o.resolveComponent)("el-popover");return(0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,[(0,o.createVNode)((0,o.unref)(Gn),{id:e.id,style:(0,o.normalizeStyle)(e.style),path:g.value[0],"marker-end":e.markerEnd},null,8,["id","style","path","marker-end"]),(0,o.createVNode)((0,o.unref)(Ip),null,{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",{style:(0,o.normalizeStyle)({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${g.value[1]}px,${g.value[2]}px)`}),class:"nodrag nopan"},[(0,o.createVNode)(b,{visible:m.value,"show-arrow":!1,placement:"right","popper-class":"d-flow-step-popper"},{reference:(0,o.withCtx)(()=>[(0,o.withDirectives)((0,o.createElementVNode)("div",{onClick:(0,o.withModifiers)(y,["stop"]),class:"d-flow-edge-button"},[(0,o.createVNode)(V,{icon:"mdi:plus-circle"})],512),[[o.vShow,B.value||w.value]])]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(Hi,{"handle-id":"line","from-node-id":e.id,onAddNode:I},null,8,["from-node-id"])]),_:1},8,["visible"])],4)]),_:1})],64)}}}),Fm=Em,Um=(0,o.defineComponent)({name:"DFlow",__name:"flow",props:{nodes:{default:()=>[]},edges:{default:()=>[]}},setup(e){return(A,t)=>((0,o.openBlock)(),(0,o.createBlock)((0,o.unref)(Lp),{"min-zoom":.2,"max-zoom":4,"default-viewport":{zoom:1},"connection-mode":(0,o.unref)(nt).Strict,nodes:e.nodes,edges:e.edges},{"edge-button":(0,o.withCtx)(n=>[(0,o.createVNode)(Fm,{id:n.id,"source-x":n.sourceX,"source-y":n.sourceY,"target-x":n.targetX,"target-y":n.targetY,"source-position":n.sourcePosition,"target-position":n.targetPosition,"marker-end":n.markerEnd,style:(0,o.normalizeStyle)(n.style)},null,8,["id","source-x","source-y","target-x","target-y","source-position","target-position","marker-end","style"])]),"node-step":(0,o.withCtx)(n=>[(0,o.createVNode)(Qm,(0,o.normalizeProps)((0,o.guardReactiveProps)(n)),null,16)]),default:(0,o.withCtx)(()=>[(0,o.createVNode)((0,o.unref)(hm),{position:"bottom-left"}),(0,o.createVNode)((0,o.unref)(Gp))]),_:1},8,["connection-mode","nodes","edges"]))}}),bm=Um,Hm={class:"d-flow-design"},Im={class:"d-flow-design-canvas"},_m={class:"d-flow-design-right"},Sm={class:"d-flow-design-title"},xm={class:"d-flow-design-title-name"},Dm={class:"d-flow-design-panel"},Nm=(0,o.defineComponent)({name:"DFlowDesign",__name:"flowDesign",props:{components:{default:()=>[]},inputParams:{default:()=>({})},flowInit:{},flowComponentConfigInit:{},flowComponentConfigs:{default:()=>({})},flowComponentConfigChange:{}},emits:["nodeClick","edgeClick","paneClick","connect"],setup(e,{expose:A,emit:t}){const n=e,r=t,{addNodes:a,addEdges:u,removeEdges:d,addSelectedNodes:h,removeSelectedNodes:g,onConnect:B,onNodeClick:w,onPaneClick:m,onEdgeClick:v,getNodes:y,getEdges:I}=XA(),T=(0,o.computed)(()=>{const N={};return n.components.forEach(O=>{N[O.type]=O}),N.start={name:"开始",type:"start",icon:"ant-design:play-circle-outlined",des:"执行开始节点"},N}),D={id:"start",type:"step",data:{type:"start",isInit:!1},position:{x:80,y:160}},V=(0,o.ref)([D]),b=(0,o.ref)([]),K=(N,O)=>{if(O.indexOf("t")===-1){const Y=I.value.filter(tA=>tA.source===N.id);if(Y.length>0){let tA=-1e6,BA=0;return Y.forEach(HA=>{tA=Math.max(tA,HA.targetNode.position.y+HA.targetNode.dimensions.height+32),BA=HA.targetNode.position.x||0}),{x:BA,y:tA}}return{x:N.position.x+N.dimensions.width+100,y:N.position.y}}return{x:N.position.x-100-N.dimensions.width,y:N.position.y}},sA=(N,O,Y)=>{const tA=y.value.find(HA=>HA.id===O);if(!tA)return;const BA={id:gt(),type:"step",data:{type:N},position:K(tA,Y)};if(n.flowInit){const HA=n.flowInit(BA.data.type);HA&&Object.keys(HA).forEach(nA=>{BA.data[nA]=HA[nA]})}a(BA),Y.indexOf("t")===-1?u({id:`${O}-${BA.id}`,source:O,target:BA.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:rt.Arrow}):u({id:`${O}-${BA.id}`,source:BA.id,target:O,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:rt.Arrow}),S(BA.id)},W=N=>{const O=y.value.find(Y=>Y.id===N);O&&(O.position.x+=100+O.dimensions.width,I.value.filter(Y=>Y.source===N).forEach(Y=>{W(Y.target)}))},cA=(N,O)=>{const Y=I.value.find(BA=>BA.id===O);if(!Y)return;const tA={id:gt(),type:"step",data:{type:N},position:{x:Y.targetNode.position.x,y:Y.targetNode.position.y}};if(n.flowInit){const BA=n.flowInit(tA.data.type);BA&&Object.keys(BA).forEach(HA=>{tA.data[HA]=BA[HA]})}a(tA),u({id:`${Y.sourceNode.id}-${tA.id}`,source:Y.sourceNode.id,target:tA.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:rt.Arrow}),u({id:`${tA.id}-${Y.targetNode.id}`,source:tA.id,target:Y.targetNode.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:rt.Arrow}),d(O),W(Y.target),S(tA.id)};B(N=>{console.log("onConnect",N),N.type="button",N.markerEnd=rt.Arrow,u(N),r("connect",N)});const lA=()=>n.components||[],oA=(0,o.ref)(),iA=(0,o.computed)(()=>oA.value?T.value[oA.value.data.type]:void 0);w(N=>{oA.value?.id!==N.node.id&&(oA.value=N.node,X()),r("nodeClick",N.node)}),m(()=>{oA.value=void 0,r("paneClick")}),v(N=>{oA.value=void 0,r("edgeClick",N.edge)});const AA=N=>{oA.value?.id===N&&(oA.value=void 0)},S=N=>{oA.value&&g([oA.value]),oA.value=y.value.find(O=>O.id===N),oA.value&&(X(),setTimeout(()=>{oA.value&&h([oA.value])},100))},eA=(0,o.ref)(),H={};Object.keys(n.flowComponentConfigs).forEach(N=>{const O={type:"j-collapse",config:{defaultValue:[]},children:[]};n.flowComponentConfigs[N].forEach((Y,tA)=>{const BA=`_collapse${tA}`;O.config?.defaultValue.push(BA),O.children?.push(Y)}),H[N]=[O]});const X=()=>{const N=H[oA.value?.data.type||""];N&&eA.value?(eA.value.init&&eA.value.init(N,oA.value?.data),n.flowComponentConfigInit&&n.flowComponentConfigInit({configRef:eA,inputParams:n.inputParams,components:y.value,configData:oA.value?.data})):eA.value&&eA.value.init&&eA.value.init([])},U=(N,O)=>{oA.value&&n.flowComponentConfigChange&&n.flowComponentConfigChange(oA.value.data.type,{configRef:eA,component:N,configData:oA.value.data,...O,isFlowNode:!0})};return(0,o.provide)("d_flow_design_provide",{getFlowComponents:lA,addNode:sA,addNodeByLine:cA,onRemoveNode:AA,getFlowComponentMap:T}),A({getData:()=>{const N=[];return y.value.forEach(O=>{N.push({config:O.data,id:O.id,position:O.position,type:O.type})}),I.value.forEach(O=>{N.push({id:O.id,source:O.source,target:O.target,sourceHandle:O.sourceHandle,targetHandle:O.targetHandle,type:"line",config:{},position:{x:0,y:0}})}),N},setData:N=>{if(!N||N.length===0)D.data.isInit=!0,V.value=[D],S(D.id);else{D.data.isInit=!1;const O=[],Y=[];N.forEach(tA=>{if(tA.type==="line")tA.type="button",tA.markerEnd=rt.Arrow,Y.push(tA);else{const BA={id:tA.id,type:tA.type,data:tA.config,position:tA.position};O.push(BA)}}),V.value=O,b.value=Y}}}),(N,O)=>{const Y=(0,o.resolveComponent)("j-icon"),tA=(0,o.resolveComponent)("j-form");return(0,o.openBlock)(),(0,o.createElementBlock)("div",Hm,[(0,o.createElementVNode)("div",Im,[(0,o.createVNode)(bm,{nodes:V.value,edges:b.value},null,8,["nodes","edges"])]),(0,o.withDirectives)((0,o.createElementVNode)("div",_m,[(0,o.createElementVNode)("div",Sm,[(0,o.createElementVNode)("div",{class:"d-flow-design-title-icon",style:(0,o.normalizeStyle)({backgroundColor:iA.value?.iconColor||"var(--j-color-primary)"})},[(0,o.createVNode)(Y,{icon:iA.value?.icon||"mdi:source-branch"},null,8,["icon"])],4),(0,o.createElementVNode)("div",xm,(0,o.toDisplayString)(iA.value?.name||""),1)]),(0,o.createElementVNode)("div",Dm,[(0,o.createVNode)(tA,{config:{labelPosition:"top"},style:{padding:"0"},ref_key:"configRef",ref:eA,onChange:U},null,512)])],512),[[o.vShow,oA.value&&H[oA.value.data.type]]])])}}}),Lm=Nm,hl=ft(Lm),Tm={class:"d-input-flow j-block"},km=(0,o.defineComponent)({name:"DInputFlow",__name:"inputFlow",props:{modelValue:{},type:{},btnText:{default:"事件"},title:{},size:{default:"default"},width:{default:1200},height:{default:800},beforeClose:{},flowComponents:{default:()=>[]},inputParams:{default:()=>({})},flowInit:{},flowComponentConfigInit:{},flowComponentConfigs:{default:()=>({})},flowComponentConfigChange:{}},emits:["update:modelValue","change"],setup(e,{emit:A}){const t=e,n=A,r=(0,o.ref)(),a=(0,o.computed)({get(){return t.modelValue},set(w){n("update:modelValue",w)}}),u=(0,o.computed)(()=>(t.modelValue?.trim(),t.btnText)),d=w=>{const m=typeof w=="string"?w:void 0;try{r.value?.setData(JSON.parse(m||"[]"))}catch{r.value?.setData([])}},h=async()=>{const w=r.value?.getData();return w?JSON.stringify(w):void 0},g=w=>{if(t.beforeClose){const m=typeof w=="string"?w:void 0;return t.beforeClose(m)}return!0},B=w=>{const m=w.value;n("change",{value:typeof m=="string"?m:void 0})};return(w,m)=>{const v=(0,o.resolveComponent)("d-flow-design"),y=(0,o.resolveComponent)("j-input-button");return(0,o.openBlock)(),(0,o.createBlock)(y,(0,o.mergeProps)(w.$attrs,{type:e.type,"btn-text":u.value,title:e.title,size:e.size,width:e.width,height:e.height,"before-close":g,ok:h,open:d,"destroy-on-close":"",modelValue:a.value,"onUpdate:modelValue":m[0]||(m[0]=I=>a.value=I),onChange:B}),{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",Tm,[(0,o.createVNode)(v,{ref_key:"flowRef",ref:r,components:e.flowComponents,"flow-init":e.flowInit,"flow-component-config-init":e.flowComponentConfigInit,"flow-component-configs":e.flowComponentConfigs,"flow-component-config-change":e.flowComponentConfigChange,"input-params":e.inputParams},null,8,["components","flow-init","flow-component-config-init","flow-component-configs","flow-component-config-change","input-params"])])]),_:1},16,["type","btn-text","title","size","width","height","modelValue"])}}}),Mm=km,Bl=ft(Mm),q=class Le{static getElements(A,t=document){if(typeof A=="string"){const n="getElementById"in t?t:void 0;if(n&&!isNaN(+A[0])){const a=n.getElementById(A);return a?[a]:[]}let r=t.querySelectorAll(A);if(!r.length&&A[0]!=="."&&A[0]!=="#"&&(r=t.querySelectorAll("."+A),r.length||(r=t.querySelectorAll("#"+A)),!r.length)){const a=t.querySelector(`[gs-id="${A}"]`);return a?[a]:[]}return Array.from(r)}return[A]}static getElement(A,t=document){if(typeof A=="string"){const n="getElementById"in t?t:void 0;if(!A.length)return null;if(n&&A[0]==="#")return n.getElementById(A.substring(1));if(A[0]==="#"||A[0]==="."||A[0]==="[")return t.querySelector(A);if(n&&!isNaN(+A[0]))return n.getElementById(A);let r=t.querySelector(A);return n&&!r&&(r=n.getElementById(A)),r||(r=t.querySelector("."+A)),r}return A}static lazyLoad(A){return A.lazyLoad||A.grid?.opts?.lazyLoad&&A.lazyLoad!==!1}static createDiv(A,t){const n=document.createElement("div");return A.forEach(r=>{r&&n.classList.add(r)}),t?.appendChild(n),n}static shouldSizeToContent(A,t=!1){return A?.grid&&(t?A.sizeToContent===!0||A.grid.opts.sizeToContent===!0&&A.sizeToContent===void 0:!!A.sizeToContent||A.grid.opts.sizeToContent&&A.sizeToContent!==!1)}static isIntercepted(A,t){return!(A.y>=t.y+t.h||A.y+A.h<=t.y||A.x+A.w<=t.x||A.x>=t.x+t.w)}static isTouching(A,t){return Le.isIntercepted(A,{x:t.x-.5,y:t.y-.5,w:t.w+1,h:t.h+1})}static areaIntercept(A,t){const n=A.x>t.x?A.x:t.x,r=A.x+A.w<t.x+t.w?A.x+A.w:t.x+t.w;if(r<=n)return 0;const a=A.y>t.y?A.y:t.y,u=A.y+A.h<t.y+t.h?A.y+A.h:t.y+t.h;return u<=a?0:(r-n)*(u-a)}static area(A){return A.w*A.h}static sort(A,t=1){return A.sort((r,a)=>{const u=t*((r.y??1e4)-(a.y??1e4));return u===0?t*((r.x??1e4)-(a.x??1e4)):u})}static find(A,t){return t?A.find(n=>n.id===t):void 0}static toBool(A){return typeof A=="boolean"?A:typeof A=="string"?(A=A.toLowerCase(),!(A===""||A==="no"||A==="false"||A==="0")):!!A}static toNumber(A){return A===null||A.length===0?void 0:Number(A)}static parseHeight(A){let t,n="px";if(typeof A=="string")if(A==="auto"||A==="")t=0;else{const r=A.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!r)throw new Error(`Invalid height val = ${A}`);n=r[2]||"px",t=parseFloat(r[1])}else t=A;return{h:t,unit:n}}static defaults(A,...t){return t.forEach(n=>{for(const r in n){if(!n.hasOwnProperty(r))return;A[r]===null||A[r]===void 0?A[r]=n[r]:typeof n[r]=="object"&&typeof A[r]=="object"&&Le.defaults(A[r],n[r])}}),A}static same(A,t){if(typeof A!="object")return A==t;if(typeof A!=typeof t||Object.keys(A).length!==Object.keys(t).length)return!1;for(const n in A)if(A[n]!==t[n])return!1;return!0}static copyPos(A,t,n=!1){return t.x!==void 0&&(A.x=t.x),t.y!==void 0&&(A.y=t.y),t.w!==void 0&&(A.w=t.w),t.h!==void 0&&(A.h=t.h),n&&(t.minW&&(A.minW=t.minW),t.minH&&(A.minH=t.minH),t.maxW&&(A.maxW=t.maxW),t.maxH&&(A.maxH=t.maxH)),A}static samePos(A,t){return A&&t&&A.x===t.x&&A.y===t.y&&(A.w||1)===(t.w||1)&&(A.h||1)===(t.h||1)}static sanitizeMinMax(A){A.minW||delete A.minW,A.minH||delete A.minH,A.maxW||delete A.maxW,A.maxH||delete A.maxH}static removeInternalAndSame(A,t){if(!(typeof A!="object"||typeof t!="object")&&!(Array.isArray(A)||Array.isArray(t)))for(let n in A){const r=A[n],a=t[n];n[0]==="_"||r===a?delete A[n]:r&&typeof r=="object"&&a!==void 0&&(Le.removeInternalAndSame(r,a),Object.keys(r).length||delete A[n])}}static removeInternalForSave(A,t=!0){for(let n in A)(n[0]==="_"||A[n]===null||A[n]===void 0)&&delete A[n];delete A.grid,t&&delete A.el,A.autoPosition||delete A.autoPosition,A.noResize||delete A.noResize,A.noMove||delete A.noMove,A.locked||delete A.locked,(A.w===1||A.w===A.minW)&&delete A.w,(A.h===1||A.h===A.minH)&&delete A.h}static throttle(A,t){let n=!1;return(...r)=>{n||(n=!0,setTimeout(()=>{A(...r),n=!1},t))}}static removePositioningStyles(A){const t=A.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(A){if(!A)return document.scrollingElement||document.documentElement;const t=getComputedStyle(A);return/(auto|scroll)/.test(t.overflow+t.overflowY)?A:Le.getScrollElement(A.parentElement)}static updateScrollPosition(A,t,n){const r=Le.getScrollElement(A);if(!r)return;const a=A.getBoundingClientRect(),u=r.getBoundingClientRect(),d=window.innerHeight||document.documentElement.clientHeight,h=a.bottom-Math.min(u.bottom,d),g=a.top-Math.max(u.top,0),B=r.scrollTop;g<0&&n<0?A.offsetHeight>u.height?r.scrollTop+=n:r.scrollTop+=Math.abs(g)>Math.abs(n)?n:g:h>0&&n>0&&(A.offsetHeight>u.height?r.scrollTop+=n:r.scrollTop+=h>n?n:h),t.top+=r.scrollTop-B}static updateScrollResize(A,t,n){const r=Le.getScrollElement(t),a=r.clientHeight,u=r===Le.getScrollElement()?0:r.getBoundingClientRect().top,d=A.clientY-u,h=d<n,g=d>a-n;h?r.scrollBy({behavior:"smooth",top:d-n}):g&&r.scrollBy({behavior:"smooth",top:n-(a-d)})}static clone(A){return A==null||typeof A!="object"?A:A instanceof Array?[...A]:{...A}}static cloneDeep(A){const t=["parentGrid","el","grid","subGrid","engine"],n=Le.clone(A);for(const r in n)n.hasOwnProperty(r)&&typeof n[r]=="object"&&r.substring(0,2)!=="__"&&!t.find(a=>a===r)&&(n[r]=Le.cloneDeep(A[r]));return n}static cloneNode(A){const t=A.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(A,t){let n;typeof t=="string"?n=Le.getElement(t):n=t,n&&n.appendChild(A)}static addElStyles(A,t){if(t instanceof Object)for(const n in t)t.hasOwnProperty(n)&&(Array.isArray(t[n])?t[n].forEach(r=>{A.style[n]=r}):A.style[n]=t[n])}static initEvent(A,t){const n={type:t.type},r={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:A.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(a=>n[a]=A[a]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(a=>n[a]=A[a]),{...n,...r}}static simulateMouseEvent(A,t,n){const r=A,a=new MouseEvent(t,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:A.screenX,screenY:A.screenY,clientX:A.clientX,clientY:A.clientY,ctrlKey:r.ctrlKey??!1,altKey:r.altKey??!1,shiftKey:r.shiftKey??!1,metaKey:r.metaKey??!1,button:0,relatedTarget:A.target});(n||A.target).dispatchEvent(a)}static getValuesFromTransformedElement(A){const t=document.createElement("div");Le.addElStyles(t,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),A.appendChild(t);const n=t.getBoundingClientRect();return A.removeChild(t),t.remove(),{xScale:1/n.width,yScale:1/n.height,xOffset:n.left,yOffset:n.top}}static swap(A,t,n){if(!A)return;const r=A[t];A[t]=A[n],A[n]=r}static canBeRotated(A){return!(!A||A.w===A.h||A.locked||A.noResize||A.grid?.opts.disableResize||A.minW&&A.minW===A.maxW||A.minH&&A.minH===A.maxH)}},Ii=class Qn{constructor(A={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=A.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=A.maxRow,this._float=A.float,this.nodes=A.nodes||[],this.onChange=A.onChange}batchUpdate(A=!0,t=!0){return!!this.batchMode===A?this:(this.batchMode=A,A?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(A,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!A._moving||A._skipDown||t.y<=A.y)}_fixCollisions(A,t=A,n,r={}){if(this.sortNodes(-1),n=n||this.collide(A,t),!n)return!1;if(A._moving&&!r.nested&&!this.float&&this.swap(A,n))return!0;let a=t;!this._loading&&this._useEntireRowArea(A,t)&&(a={x:0,w:this.column,y:t.y,h:t.h},n=this.collide(A,a,r.skip));let u=!1;const d={nested:!0,pack:!1};let h=0;for(;n=n||this.collide(A,a,r.skip);){if(h++>this.nodes.length*2)throw new Error("Infinite collide check");let g;if(n.locked||this._loading||A._moving&&!A._skipDown&&t.y>A.y&&!this.float&&(!this.collide(n,{...n,y:A.y},A)||!this.collide(n,{...n,y:t.y-n.h},A))){A._skipDown=A._skipDown||t.y>A.y;const B={...t,y:n.y+n.h,...d};g=this._loading&&q.samePos(A,B)?!0:this.moveNode(A,B),(n.locked||this._loading)&&g?q.copyPos(t,A):!n.locked&&g&&r.pack&&(this._packNodes(),t.y=n.y+n.h,q.copyPos(A,t)),u=u||g}else g=this.moveNode(n,{...n,y:t.y+t.h,skip:A,...d});if(!g)return u;n=void 0}return u}collide(A,t=A,n){const r=A._id,a=n?._id;return this.nodes.find(u=>u._id!==r&&u._id!==a&&q.isIntercepted(u,t))}collideAll(A,t=A,n){const r=A._id,a=n?._id;return this.nodes.filter(u=>u._id!==r&&u._id!==a&&q.isIntercepted(u,t))}directionCollideCoverage(A,t,n){if(!t.rect||!A._rect)return;const r=A._rect,a={...t.rect};a.y>r.y?(a.h+=a.y-r.y,a.y=r.y):a.h+=r.y-a.y,a.x>r.x?(a.w+=a.x-r.x,a.x=r.x):a.w+=r.x-a.x;let u,d=.5;for(let h of n){if(h.locked||!h._rect)break;const g=h._rect;let B=Number.MAX_VALUE,w=Number.MAX_VALUE;r.y<g.y?B=(a.y+a.h-g.y)/g.h:r.y+r.h>g.y+g.h&&(B=(g.y+g.h-a.y)/g.h),r.x<g.x?w=(a.x+a.w-g.x)/g.w:r.x+r.w>g.x+g.w&&(w=(g.x+g.w-a.x)/g.w);const m=Math.min(w,B);m>d&&(d=m,u=h)}return t.collide=u,u}cacheRects(A,t,n,r,a,u){return this.nodes.forEach(d=>d._rect={y:d.y*t+n,x:d.x*A+u,w:d.w*A-u-r,h:d.h*t-n-a}),this}swap(A,t){if(!t||t.locked||!A||A.locked)return!1;function n(){const a=t.x,u=t.y;return t.x=A.x,t.y=A.y,A.h!=t.h?(A.x=a,A.y=t.y+t.h):A.w!=t.w?(A.x=t.x+t.w,A.y=u):(A.x=a,A.y=u),A._dirty=t._dirty=!0,!0}let r;if(A.w===t.w&&A.h===t.h&&(A.x===t.x||A.y===t.y)&&(r=q.isTouching(A,t)))return n();if(r!==!1){if(A.w===t.w&&A.x===t.x&&(r||(r=q.isTouching(A,t)))){if(t.y<A.y){const a=A;A=t,t=a}return n()}if(r!==!1){if(A.h===t.h&&A.y===t.y&&(r||(r=q.isTouching(A,t)))){if(t.x<A.x){const a=A;A=t,t=a}return n()}return!1}}}isAreaEmpty(A,t,n,r){const a={x:A||0,y:t||0,w:n||1,h:r||1};return!this.collide(a)}compact(A="compact",t=!0){if(this.nodes.length===0)return this;t&&this.sortNodes();const n=this.batchMode;n||this.batchUpdate();const r=this._inColumnResize;r||(this._inColumnResize=!0);const a=this.nodes;return this.nodes=[],a.forEach((u,d,h)=>{let g;u.locked||(u.autoPosition=!0,A==="list"&&d&&(g=h[d-1])),this.addNode(u,!1,g)}),r||delete this._inColumnResize,n||this.batchUpdate(!1),this}set float(A){this._float!==A&&(this._float=A||!1,A||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(A=1){return this.nodes=q.sort(this.nodes,A),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(A=>{if(A._updating||A._orig===void 0||A.y===A._orig.y)return;let t=A.y;for(;t>A._orig.y;)--t,this.collide(A,{x:A.x,y:t,w:A.w,h:A.h})||(A._dirty=!0,A.y=t)}):this.nodes.forEach((A,t)=>{if(!A.locked)for(;A.y>0;){const n=t===0?0:A.y-1;if(!(t===0||!this.collide(A,{x:A.x,y:n,w:A.w,h:A.h})))break;A._dirty=A.y!==n,A.y=n}}),this)}prepareNode(A,t){A._id=A._id??Qn._idSeq++;const n=A.id;if(n){let a=1;for(;this.nodes.find(u=>u.id===A.id&&u!==A);)A.id=n+"_"+a++}(A.x===void 0||A.y===void 0||A.x===null||A.y===null)&&(A.autoPosition=!0);const r={x:0,y:0,w:1,h:1};return q.defaults(A,r),A.autoPosition||delete A.autoPosition,A.noResize||delete A.noResize,A.noMove||delete A.noMove,q.sanitizeMinMax(A),typeof A.x=="string"&&(A.x=Number(A.x)),typeof A.y=="string"&&(A.y=Number(A.y)),typeof A.w=="string"&&(A.w=Number(A.w)),typeof A.h=="string"&&(A.h=Number(A.h)),isNaN(A.x)&&(A.x=r.x,A.autoPosition=!0),isNaN(A.y)&&(A.y=r.y,A.autoPosition=!0),isNaN(A.w)&&(A.w=r.w),isNaN(A.h)&&(A.h=r.h),this.nodeBoundFix(A,t),A}nodeBoundFix(A,t){const n=A._orig||q.copyPos({},A);if(A.maxW&&(A.w=Math.min(A.w||1,A.maxW)),A.maxH&&(A.h=Math.min(A.h||1,A.maxH)),A.minW&&(A.w=Math.max(A.w||1,A.minW)),A.minH&&(A.h=Math.max(A.h||1,A.minH)),(A.x||0)+(A.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&A._id!=null&&this.findCacheLayout(A,this.defaultColumn)===-1){const r={...A};r.autoPosition||r.x===void 0?(delete r.x,delete r.y):r.x=Math.min(this.defaultColumn-1,r.x),r.w=Math.min(this.defaultColumn,r.w||1),this.cacheOneLayout(r,this.defaultColumn)}return A.w>this.column?A.w=this.column:A.w<1&&(A.w=1),this.maxRow&&A.h>this.maxRow?A.h=this.maxRow:A.h<1&&(A.h=1),A.x<0&&(A.x=0),A.y<0&&(A.y=0),A.x+A.w>this.column&&(t?A.w=this.column-A.x:A.x=this.column-A.w),this.maxRow&&A.y+A.h>this.maxRow&&(t?A.h=this.maxRow-A.y:A.y=this.maxRow-A.h),q.samePos(A,n)||(A._dirty=!0),this}getDirtyNodes(A){return A?this.nodes.filter(t=>t._dirty&&!q.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(A){if(this.batchMode||!this.onChange)return this;const t=(A||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(A=>{delete A._dirty,delete A._lastTried}),this)}saveInitial(){return this.nodes.forEach(A=>{A._orig=q.copyPos({},A),delete A._dirty}),this._hasLocked=this.nodes.some(A=>A.locked),this}restoreInitial(){return this.nodes.forEach(A=>{!A._orig||q.samePos(A,A._orig)||(q.copyPos(A,A._orig),A._dirty=!0)}),this._notify(),this}findEmptyPosition(A,t=this.nodes,n=this.column,r){const a=r?r.y*n+(r.x+r.w):0;let u=!1;for(let d=a;!u;++d){const h=d%n,g=Math.floor(d/n);if(h+A.w>n)continue;const B={x:h,y:g,w:A.w,h:A.h};t.find(w=>q.isIntercepted(B,w))||((A.x!==h||A.y!==g)&&(A._dirty=!0),A.x=h,A.y=g,delete A.autoPosition,u=!0)}return u}addNode(A,t=!1,n){const r=this.nodes.find(u=>u._id===A._id);if(r)return r;this._inColumnResize?this.nodeBoundFix(A):this.prepareNode(A),delete A._temporaryRemoved,delete A._removeDOM;let a;return A.autoPosition&&this.findEmptyPosition(A,this.nodes,this.column,n)&&(delete A.autoPosition,a=!0),this.nodes.push(A),t&&this.addedNodes.push(A),a||this._fixCollisions(A),this.batchMode||this._packNodes()._notify(),A}removeNode(A,t=!0,n=!1){return this.nodes.find(r=>r._id===A._id)?(n&&this.removedNodes.push(A),t&&(A._removeDOM=!0),this.nodes=this.nodes.filter(r=>r._id!==A._id),A._isAboutToRemove||this._packNodes(),this._notify([A]),this):this}removeAll(A=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;A&&this.nodes.forEach(r=>r._removeDOM=!0);const n=this.nodes;return this.removedNodes=t?n:[],this.nodes=[],this._notify(n)}moveNodeCheck(A,t){if(!this.changedPosConstrain(A,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(A,t);let n;const r=new Qn({column:this.column,float:this.float,nodes:this.nodes.map(u=>u._id===A._id?(n={...u},n):{...u})});if(!n)return!1;const a=r.moveNode(n,t)&&r.getRow()<=Math.max(this.getRow(),this.maxRow);if(!a&&!t.resizing&&t.collide){const u=t.collide.el.gridstackNode;if(this.swap(A,u))return this._notify(),!0}return a?(r.nodes.filter(u=>u._dirty).forEach(u=>{const d=this.nodes.find(h=>h._id===u._id);d&&(q.copyPos(d,u),d._dirty=!0)}),this._notify(),!0):!1}willItFit(A){if(delete A._willFitPos,!this.maxRow)return!0;const t=new Qn({column:this.column,float:this.float,nodes:this.nodes.map(r=>({...r}))}),n={...A};return this.cleanupNode(n),delete n.el,delete n._id,delete n.content,delete n.grid,t.addNode(n),t.getRow()<=this.maxRow?(A._willFitPos=q.copyPos({},n),!0):!1}changedPosConstrain(A,t){return t.w=t.w||A.w,t.h=t.h||A.h,A.x!==t.x||A.y!==t.y?!0:(A.maxW&&(t.w=Math.min(t.w,A.maxW)),A.maxH&&(t.h=Math.min(t.h,A.maxH)),A.minW&&(t.w=Math.max(t.w,A.minW)),A.minH&&(t.h=Math.max(t.h,A.minH)),A.w!==t.w||A.h!==t.h)}moveNode(A,t){if(!A||!t)return!1;let n;t.pack===void 0&&!this.batchMode&&(n=t.pack=!0),typeof t.x!="number"&&(t.x=A.x),typeof t.y!="number"&&(t.y=A.y),typeof t.w!="number"&&(t.w=A.w),typeof t.h!="number"&&(t.h=A.h);const r=A.w!==t.w||A.h!==t.h,a=q.copyPos({},A,!0);if(q.copyPos(a,t),this.nodeBoundFix(a,r),q.copyPos(t,a),!t.forceCollide&&q.samePos(A,t))return!1;const u=q.copyPos({},A),d=this.collideAll(A,a,t.skip);let h=!0;if(d.length){const g=A._moving&&!t.nested;let B=g?this.directionCollideCoverage(A,t,d):d[0];if(g&&B&&A.grid?.opts?.subGridDynamic&&!A.grid._isTemp){const w=q.areaIntercept(t.rect,B._rect),m=q.area(t.rect),v=q.area(B._rect);w/(m<v?m:v)>.8&&(B.grid.makeSubGrid(B.el,void 0,A),B=void 0)}B?h=!this._fixCollisions(A,a,B,t):(h=!1,n&&delete t.pack)}return h&&!q.samePos(A,a)&&(A._dirty=!0,q.copyPos(A,a)),t.pack&&this._packNodes()._notify(),!q.samePos(A,u)}getRow(){return this.nodes.reduce((A,t)=>Math.max(A,t.y+t.h),0)}beginUpdate(A){return A._updating||(A._updating=!0,delete A._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const A=this.nodes.find(t=>t._updating);return A&&(delete A._updating,delete A._skipDown),this}save(A=!0,t,n){const r=this._layouts?.length||0;let a;r&&(n?n!==this.column&&(a=this._layouts[n]):this.column!==r-1&&(a=this._layouts[r-1]));const u=[];return this.sortNodes(),this.nodes.forEach(d=>{const h=a?.find(B=>B._id===d._id),g={...d,...h||{}};q.removeInternalForSave(g,!A),t&&t(d,g),u.push(g)}),u}layoutsNodesChange(A){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,n)=>{if(!t||n===this.column)return this;if(n<this.column)this._layouts[n]=void 0;else{const r=n/this.column;A.forEach(a=>{if(!a._orig)return;const u=t.find(d=>d._id===a._id);u&&(u.y>=0&&a.y!==a._orig.y&&(u.y+=a.y-a._orig.y,u.y<0&&(u.y=0)),a.x!==a._orig.x&&(u.x=Math.round(a.x*r),u.x<0&&(u.x=0)),a.w!==a._orig.w&&(u.w=Math.round(a.w*r),u.w<1&&(u.w=1)))})}}),this)}columnChanged(A,t,n="moveScale"){if(!this.nodes.length||!t||A===t)return this;const r=n==="compact"||n==="list";r&&this.sortNodes(1),t<A&&this.cacheLayout(this.nodes,A),this.batchUpdate();let a=[],u=r?this.nodes:q.sort(this.nodes,-1);if(t>A&&this._layouts){const d=this._layouts[t]||[],h=this._layouts.length-1;!d.length&&A!==h&&this._layouts[h]?.length&&(A=h,this._layouts[h].forEach(g=>{const B=u.find(w=>w._id===g._id);B&&(!r&&!g.autoPosition&&(B.x=g.x??B.x,B.y=g.y??B.y),B.w=g.w??B.w,(g.x==null||g.y===void 0)&&(B.autoPosition=!0))})),d.forEach(g=>{const B=u.findIndex(w=>w._id===g._id);if(B!==-1){const w=u[B];if(r){w.w=g.w;return}(g.autoPosition||isNaN(g.x)||isNaN(g.y))&&this.findEmptyPosition(g,a),g.autoPosition||(w.x=g.x??w.x,w.y=g.y??w.y,w.w=g.w??w.w,a.push(w)),u.splice(B,1)}})}if(r)this.compact(n,!1);else{if(u.length)if(typeof n=="function")n(t,A,a,u);else{const d=r||n==="none"?1:t/A,h=n==="move"||n==="moveScale",g=n==="scale"||n==="moveScale";u.forEach(B=>{B.x=t===1?0:h?Math.round(B.x*d):Math.min(B.x,t-1),B.w=t===1||A===1?1:g?Math.round(B.w*d)||1:Math.min(B.w,t),a.push(B)}),u=[]}a=q.sort(a,-1),this._inColumnResize=!0,this.nodes=[],a.forEach(d=>{this.addNode(d,!1),delete d._orig})}return this.nodes.forEach(d=>delete d._orig),this.batchUpdate(!1,!r),delete this._inColumnResize,this}cacheLayout(A,t,n=!1){const r=[];return A.forEach((a,u)=>{a._id===void 0&&(a._id=(a.id?this.nodes.find(d=>d.id===a.id):void 0)?._id??Qn._idSeq++),r[u]={x:a.x,y:a.y,w:a.w,_id:a._id}}),this._layouts=n?[]:this._layouts||[],this._layouts[t]=r,this}cacheOneLayout(A,t){A._id=A._id??Qn._idSeq++;const n={x:A.x,y:A.y,w:A.w,_id:A._id};(A.autoPosition||A.x===void 0)&&(delete n.x,delete n.y,A.autoPosition&&(n.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];const r=this.findCacheLayout(A,t);return r===-1?this._layouts[t].push(n):this._layouts[t][r]=n,this}findCacheLayout(A,t){return this._layouts?.[t]?.findIndex(n=>n._id===A._id)??-1}removeNodeFromLayoutCache(A){if(this._layouts)for(let t=0;t<this._layouts.length;t++){const n=this.findCacheLayout(A,t);n!==-1&&this._layouts[t].splice(n,1)}}cleanupNode(A){for(const t in A)t[0]==="_"&&t!=="_id"&&delete A[t];return this}};Ii._idSeq=0;var Ue={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"},TA=class{},Oe=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0),be=class{};function zr(e,A){e.touches.length>1||(e.cancelable&&e.preventDefault(),q.simulateMouseEvent(e.changedTouches[0],A))}function pl(e,A){e.cancelable&&e.preventDefault(),q.simulateMouseEvent(e,A)}function Xr(e){be.touchHandled||(be.touchHandled=!0,zr(e,"mousedown"))}function $r(e){be.touchHandled&&zr(e,"mousemove")}function Yr(e){if(!be.touchHandled)return;be.pointerLeaveTimeout&&(window.clearTimeout(be.pointerLeaveTimeout),delete be.pointerLeaveTimeout);const A=!!TA.dragElement;zr(e,"mouseup"),A||zr(e,"click"),be.touchHandled=!1}function Wr(e){e.pointerType!=="mouse"&&e.target.releasePointerCapture(e.pointerId)}function ml(e){TA.dragElement&&e.pointerType!=="mouse"&&pl(e,"mouseenter")}function wl(e){TA.dragElement&&e.pointerType!=="mouse"&&(be.pointerLeaveTimeout=window.setTimeout(()=>{delete be.pointerLeaveTimeout,pl(e,"mouseleave")},10))}var Cl=class Qu{constructor(A,t,n){this.host=A,this.dir=t,this.option=n,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){if(this.option.element)try{this.el=this.option.element instanceof HTMLElement?this.option.element:this.host.querySelector(this.option.element)}catch(A){this.option.element=void 0,console.error("Query for resizeable handle failed, falling back",A)}return this.el||(this.el=document.createElement("div"),this.host.appendChild(this.el)),this.el.classList.add("ui-resizable-handle"),this.el.classList.add(`${Qu.prefix}${this.dir}`),this.el.style.zIndex="100",this.el.style.userSelect="none",this.el.addEventListener("mousedown",this._mouseDown),Oe&&(this.el.addEventListener("touchstart",Xr),this.el.addEventListener("pointerdown",Wr)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Oe&&(this.el.removeEventListener("touchstart",Xr),this.el.removeEventListener("pointerdown",Wr)),this.option.element||this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(A){this.mouseDownEvent=A,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Oe&&(this.el.addEventListener("touchmove",$r),this.el.addEventListener("touchend",Yr)),A.stopPropagation(),A.preventDefault()}_mouseMove(A){const t=this.mouseDownEvent;this.moving?this._triggerEvent("move",A):Math.abs(A.x-t.x)+Math.abs(A.y-t.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",A),document.addEventListener("keydown",this._keyEvent)),A.stopPropagation()}_mouseUp(A){this.moving&&(this._triggerEvent("stop",A),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Oe&&(this.el.removeEventListener("touchmove",$r),this.el.removeEventListener("touchend",Yr)),delete this.moving,delete this.mouseDownEvent,A.stopPropagation(),A.preventDefault()}_keyEvent(A){A.key==="Escape"&&(this.host.gridstackNode?.grid?.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(A,t){return this.option[A]&&this.option[A](t),this}};Cl.prefix="ui-resizable-";var _i=class{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,A){this._eventRegister[e]=A}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,A){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](A)}},vl=class gs extends _i{constructor(A,t={}){super(),this.el=A,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const n=this.el.parentElement.getBoundingClientRect(),r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},a=this.temporalRect||r;return{position:{left:(a.left-n.left)*this.rectScale.x,top:(a.top-n.top)*this.rectScale.y},size:{width:a.width*this.rectScale.x,height:a.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(A,t){super.on(A,t)}off(A){super.off(A)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(A){const t=A.handles&&A.handles!==this.option.handles,n=A.autoHide&&A.autoHide!==this.option.autoHide;return Object.keys(A).forEach(r=>this.option[r]=A[r]),t&&(this._removeHandlers(),this._setupHandlers()),n&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(A){return A?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),TA.overResizeElement===this&&delete TA.overResizeElement),this}_mouseOver(A){TA.overResizeElement||TA.dragElement||(TA.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(A){TA.overResizeElement===this&&(delete TA.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(A=>A.trim()).map(A=>new Cl(this.el,A,{element:this.option.element,start:t=>this._resizeStart(t),stop:t=>this._resizeStop(t),move:t=>this._resizing(t,A)})),this}_resizeStart(A){this.sizeToContent=q.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=q.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=A,this._setupHelper(),this._applyChange();const t=q.initEvent(A,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(A,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(A,t),this._applyChange();const n=q.initEvent(A,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(n,this._ui()),this.triggerEvent("resize",n),this}_resizeStop(A){const t=q.initEvent(A,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=gs._originStyleProp.map(n=>this.el.style[n]),this.parentOriginStylePosition=this.el.parentElement.style.position;const A=this.el.parentElement,t=q.getValuesFromTransformedElement(A);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return gs._originStyleProp.forEach((A,t)=>{this.el.style[A]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(A,t){const n=this.startEvent,r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},a=A.clientX-n.clientX,u=this.sizeToContent?0:A.clientY-n.clientY;let d,h;t.indexOf("e")>-1?r.width+=a:t.indexOf("w")>-1&&(r.width-=a,r.left+=a,d=!0),t.indexOf("s")>-1?r.height+=u:t.indexOf("n")>-1&&(r.height-=u,r.top+=u,h=!0);const g=this._constrainSize(r.width,r.height,d,h);return Math.round(r.width)!==Math.round(g.width)&&(t.indexOf("w")>-1&&(r.left+=r.width-g.width),r.width=g.width),Math.round(r.height)!==Math.round(g.height)&&(t.indexOf("n")>-1&&(r.top+=r.height-g.height),r.height=g.height),r}_constrainSize(A,t,n,r){const a=this.option,u=(n?a.maxWidthMoveLeft:a.maxWidth)||Number.MAX_SAFE_INTEGER,d=a.minWidth/this.rectScale.x||A,h=(r?a.maxHeightMoveUp:a.maxHeight)||Number.MAX_SAFE_INTEGER,g=a.minHeight/this.rectScale.y||t;return{width:Math.min(u,Math.max(d,A)),height:Math.min(h,Math.max(g,t))}}_applyChange(){let A={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const{left:t,top:n}=this.el.parentElement.getBoundingClientRect();A={left:t,top:n,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const n=this.temporalRect[t],r=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(n-A[t])*r+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(A=>A.destroy()),delete this.handlers,this}};vl._originStyleProp=["width","height","position","left","top","opacity","zIndex"];var Om='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle',yl=class hs extends _i{constructor(A,t={}){super(),this.el=A,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const n=t?.handle?.substring(1),r=A.gridstackNode;this.dragEls=!n||A.classList.contains(n)?[A]:r?.subGrid?[A.querySelector(t.handle)||A]:Array.from(A.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[A]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(A,t){super.on(A,t)}off(A){super.off(A)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(A=>{A.addEventListener("mousedown",this._mouseDown),Oe&&(A.addEventListener("touchstart",Xr),A.addEventListener("pointerdown",Wr))}),this.el.classList.remove("ui-draggable-disabled"))}disable(A=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),Oe&&(t.removeEventListener("touchstart",Xr),t.removeEventListener("pointerdown",Wr))}),A||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(A){return Object.keys(A).forEach(t=>this.option[t]=A[t]),this}_mouseDown(A){if(be.touchHandled&&A.isTrusted&&(be.touchHandled=!1),!TA.mouseHandled)return A.button!==0||!this.dragEls.find(t=>t===A.target)&&A.target.closest(Om)||this.option.cancel&&A.target.closest(this.option.cancel)||(this.mouseDownEvent=A,delete this.dragging,delete TA.dragElement,delete TA.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Oe&&(A.currentTarget.addEventListener("touchmove",$r),A.currentTarget.addEventListener("touchend",Yr)),A.preventDefault(),document.activeElement&&document.activeElement.blur(),TA.mouseHandled=!0),!0}_callDrag(A){if(!this.dragging)return;const t=q.initEvent(A,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(A){const t=this.mouseDownEvent;if(this.lastDrag=A,this.dragging)if(this._dragFollow(A),TA.pauseDrag){const n=Number.isInteger(TA.pauseDrag)?TA.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(A),n)}else this._callDrag(A);else if(Math.abs(A.x-t.x)+Math.abs(A.y-t.y)>3){this.dragging=!0,TA.dragElement=this;const n=this.el.gridstackNode?.grid;n?TA.dropElement=n.el.ddElement.ddDroppable:delete TA.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=q.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(A,this.el,this.helperContainment),this._setupHelperStyle(A);const r=q.initEvent(A,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(r,this.ui()),this.triggerEvent("dragstart",r),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(A){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Oe&&A.currentTarget&&(A.currentTarget.removeEventListener("touchmove",$r,!0),A.currentTarget.removeEventListener("touchend",Yr,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),TA.dropElement?.el===this.el.parentElement&&delete TA.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const t=q.initEvent(A,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(t),this.triggerEvent("dragstop",t),TA.dropElement&&TA.dropElement.drop(A)}delete this.helper,delete this.mouseDownEvent,delete TA.dragElement,delete TA.dropElement,delete TA.mouseHandled,A.preventDefault()}_keyEvent(A){const t=this.el.gridstackNode,n=t?.grid||TA.dropElement?.el?.gridstack;if(A.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),n?.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&n&&(A.key==="r"||A.key==="R")){if(!q.canBeRotated(t))return;t._origRotate=t._origRotate||{...t._orig},delete t._moving,n.setAnimation(!1).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),t._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",q.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let A=this.el;return typeof this.option.helper=="function"?A=this.option.helper(this.el):this.option.helper==="clone"&&(A=q.cloneNode(this.el)),A.parentElement||q.appendTo(A,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=hs.originStyleProp.map(t=>this.el.style[t]),A}_setupHelperStyle(A){this.helper.classList.add("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.add("grid-stack-dragging");const t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, top",t.position="fixed",this._dragFollow(A),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null)},0),this}_removeHelperStyle(){if(this.helper.classList.remove("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.remove("grid-stack-dragging"),!this.helper?.gridstackNode?._isAboutToRemove&&this.dragElementOriginStyle){const A=this.helper,t=this.dragElementOriginStyle.transition||null;A.style.transition=this.dragElementOriginStyle.transition="none",hs.originStyleProp.forEach(n=>A.style[n]=this.dragElementOriginStyle[n]||null),setTimeout(()=>A.style.transition=t,50)}return delete this.dragElementOriginStyle,this}_dragFollow(A){const t={left:0,top:0},n=this.helper.style,r=this.dragOffset;n.left=(A.clientX+r.offsetLeft-t.left)*this.dragTransform.xScale+"px",n.top=(A.clientY+r.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(A,t,n){let r=0,a=0;n&&(r=this.dragTransform.xOffset,a=this.dragTransform.yOffset);const u=t.getBoundingClientRect();return{left:u.left,top:u.top,offsetLeft:-A.clientX+u.left-r,offsetTop:-A.clientY+u.top-a,width:u.width*this.dragTransform.xScale,height:u.height*this.dragTransform.yScale}}ui(){const A=this.el.parentElement.getBoundingClientRect(),t=this.helper.getBoundingClientRect();return{position:{top:(t.top-A.top)*this.dragTransform.yScale,left:(t.left-A.left)*this.dragTransform.xScale}}}};yl.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];var Km=class extends _i{constructor(e,A={}){super(),this.el=e,this.option=A,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,A){super.on(e,A)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),Oe&&(this.el.addEventListener("pointerenter",ml),this.el.addEventListener("pointerleave",wl)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),Oe&&(this.el.removeEventListener("pointerenter",ml),this.el.removeEventListener("pointerleave",wl)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(A=>this.option[A]=e[A]),this._setupAccept(),this}_mouseEnter(e){if(!TA.dragElement||be.touchHandled&&e.isTrusted||!this._canDrop(TA.dragElement.el))return;e.preventDefault(),e.stopPropagation(),TA.dropElement&&TA.dropElement!==this&&TA.dropElement._mouseLeave(e,!0),TA.dropElement=this;const A=q.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(A,this._ui(TA.dragElement)),this.triggerEvent("dropover",A),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,A=!1){if(!TA.dragElement||TA.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const t=q.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(t,this._ui(TA.dragElement)),this.triggerEvent("dropout",t),TA.dropElement===this&&(delete TA.dropElement,!A)){let n,r=this.el.parentElement;for(;!n&&r;)n=r.ddElement?.ddDroppable,r=r.parentElement;n&&n._mouseEnter(e)}}drop(e){e.preventDefault();const A=q.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(A,this._ui(TA.dragElement)),this.triggerEvent("drop",A)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}},Rm=class Eu{static init(A){return A.ddElement||(A.ddElement=new Eu(A)),A.ddElement}constructor(A){this.el=A}on(A,t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(A)>-1?this.ddDraggable.on(A,t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(A)>-1?this.ddDroppable.on(A,t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(A)>-1&&this.ddResizable.on(A,t),this}off(A){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(A)>-1?this.ddDraggable.off(A):this.ddDroppable&&["drop","dropover","dropout"].indexOf(A)>-1?this.ddDroppable.off(A):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(A)>-1&&this.ddResizable.off(A),this}setupDraggable(A){return this.ddDraggable?this.ddDraggable.updateOption(A):this.ddDraggable=new yl(this.el,A),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(A){return this.ddResizable?this.ddResizable.updateOption(A):this.ddResizable=new vl(this.el,A),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(A){return this.ddDroppable?this.ddDroppable.updateOption(A):this.ddDroppable=new Km(this.el,A),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}},Vm=class{resizable(e,A,t,n){return this._getDDElements(e,A).forEach(r=>{if(A==="disable"||A==="enable")r.ddResizable&&r.ddResizable[A]();else if(A==="destroy")r.ddResizable&&r.cleanResizable();else if(A==="option")r.setupResizable({[t]:n});else{const a=r.el.gridstackNode.grid;let u=r.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";u==="all"&&(u="n,e,s,w,se,sw,ne,nw");const d=!a.opts.alwaysShowResizeHandle;r.setupResizable({...a.opts.resizable,handles:u,autoHide:d,start:A.start,stop:A.stop,resize:A.resize})}}),this}draggable(e,A,t,n){return this._getDDElements(e,A).forEach(r=>{if(A==="disable"||A==="enable")r.ddDraggable&&r.ddDraggable[A]();else if(A==="destroy")r.ddDraggable&&r.cleanDraggable();else if(A==="option")r.setupDraggable({[t]:n});else{const a=r.el.gridstackNode.grid;r.setupDraggable({...a.opts.draggable,start:A.start,stop:A.stop,drag:A.drag})}}),this}dragIn(e,A){return this._getDDElements(e).forEach(t=>t.setupDraggable(A)),this}droppable(e,A,t,n){return typeof A.accept=="function"&&!A._accept&&(A._accept=A.accept,A.accept=r=>A._accept(r)),this._getDDElements(e,A).forEach(r=>{A==="disable"||A==="enable"?r.ddDroppable&&r.ddDroppable[A]():A==="destroy"?r.ddDroppable&&r.cleanDroppable():A==="option"?r.setupDroppable({[t]:n}):r.setupDroppable(A)}),this}isDroppable(e){return!!(e?.ddElement?.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){return!!(e?.ddElement?.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){return!!(e?.ddElement?.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,A,t){return this._getDDElements(e).forEach(n=>n.on(A,r=>{t(r,TA.dragElement?TA.dragElement.el:r.target,TA.dragElement?TA.dragElement.helper:null)})),this}off(e,A){return this._getDDElements(e).forEach(t=>t.off(A)),this}_getDDElements(e,A){const t=e.gridstack||A!=="destroy"&&A!=="disable",n=q.getElements(e);return n.length?n.map(r=>r.ddElement||(t?Rm.init(r):null)).filter(r=>r):[]}},me=new Vm,rn=class LA{static init(A={},t=".grid-stack"){if(typeof document>"u")return null;const n=LA.getGridElement(t);return n?(n.gridstack||(n.gridstack=new LA(n,q.cloneDeep(A))),n.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
|
|
26
|
+
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"},ce=class extends Error{constructor(e,...A){var t;super((t=Pa[e])==null?void 0:t.call(Pa,...A)),this.name="VueFlowError",this.code=e,this.args=A}};function mi(e){return"clientX"in e}function lB(e){return"sourceEvent"in e}function $e(e,A){const t=mi(e);let n,r;return t?(n=e.clientX,r=e.clientY):"touches"in e&&e.touches.length>0?(n=e.touches[0].clientX,r=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(n=e.changedTouches[0].clientX,r=e.changedTouches[0].clientY):(n=0,r=0),{x:n-(A?.left??0),y:r-(A?.top??0)}}var Lr=()=>{var e;return typeof navigator<"u"&&((e=navigator?.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function cB(e){var A,t;return{width:((A=e.dimensions)==null?void 0:A.width)??e.width??0,height:((t=e.dimensions)==null?void 0:t.height)??e.height??0}}function Tr(e,A=[1,1]){return{x:A[0]*Math.round(e.x/A[0]),y:A[1]*Math.round(e.y/A[1])}}var uB=()=>!0;function wi(e){e?.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function dB(e,A,t){const n=[],r={x:e.x-t,y:e.y-t,width:t*2,height:t*2};for(const a of A.values())xr(r,Sr(a))>0&&n.push(a);return n}var fB=250;function gB(e,A,t,n){var r,a;let u=[],d=Number.POSITIVE_INFINITY;const h=dB(e,t,A+fB);for(const g of h){const B=[...((r=g.handleBounds)==null?void 0:r.source)??[],...((a=g.handleBounds)==null?void 0:a.target)??[]];for(const w of B){if(n.nodeId===w.nodeId&&n.type===w.type&&n.id===w.id)continue;const{x:m,y:v}=tn(g,w,w.position,!0),y=Math.sqrt((m-e.x)**2+(v-e.y)**2);y>A||(y<d?(u=[{...w,x:m,y:v}],d=y):y===d&&u.push({...w,x:m,y:v}))}}if(!u.length)return null;if(u.length>1){const g=n.type==="source"?"target":"source";return u.find(B=>B.type===g)??u[0]}return u[0]}function Ga(e,{handle:A,connectionMode:t,fromNodeId:n,fromHandleId:r,fromType:a,doc:u,lib:d,flowId:h,isValidConnection:g=uB},B,w,m,v){const y=a==="target",I=A?u.querySelector(`.${d}-flow__handle[data-id="${h}-${A?.nodeId}-${A?.id}-${A?.type}"]`):null,{x:T,y:D}=$e(e),V=u.elementFromPoint(T,D),b=V?.classList.contains(`${d}-flow__handle`)?V:I,K={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const sA=za(void 0,b),W=b.getAttribute("data-nodeid"),cA=b.getAttribute("data-handleid"),lA=b.classList.contains("connectable"),oA=b.classList.contains("connectableend");if(!W||!sA)return K;const iA={source:y?W:n,sourceHandle:y?cA:r,target:y?n:W,targetHandle:y?r:cA};K.connection=iA,K.isValid=lA&&oA&&(t===nt.Strict?y&&sA==="source"||!y&&sA==="target":W!==n||cA!==r)&&g(iA,{nodes:w,edges:B,sourceNode:m(iA.source),targetNode:m(iA.target)}),K.toHandle=Xa(W,sA,cA,v,t,!0)}return K}function za(e,A){return e||(A?.classList.contains("target")?"target":A?.classList.contains("source")?"source":null)}function hB(e,A){let t=null;return A?t="valid":e&&!A&&(t="invalid"),t}function BB(e,A){let t=null;return A?t=!0:e&&!A&&(t=!1),t}function Xa(e,A,t,n,r,a=!1){var u,d,h;const g=n.get(e);if(!g)return null;const B=r===nt.Strict?(u=g.handleBounds)==null?void 0:u[A]:[...((d=g.handleBounds)==null?void 0:d.source)??[],...((h=g.handleBounds)==null?void 0:h.target)??[]],w=(t?B?.find(m=>m.id===t):B?.[0])??null;return w&&a?{...w,...tn(g,w,w.position,!0)}:w}var Ci={[IA.Left]:IA.Right,[IA.Right]:IA.Left,[IA.Top]:IA.Bottom,[IA.Bottom]:IA.Top},pB=["production","prod"];function Pn(e,...A){$a()&&console.warn(`[Vue Flow]: ${e}`,...A)}function $a(){return!pB.includes(process.env.NODE_ENV||"")}function Ya(e,A,t,n,r){const a=A.querySelectorAll(`.vue-flow__handle.${e}`);return a?.length?Array.from(a).map(u=>{const d=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:r,position:u.getAttribute("data-handlepos"),x:(d.left-t.left)/n,y:(d.top-t.top)/n,...Dr(u)}}):null}function vi(e,A,t,n,r,a=!1,u){r.value=!1,e.selected?(a||e.selected&&A)&&(n([e]),(0,o.nextTick)(()=>{u.blur()})):t([e])}function se(e){return typeof(0,o.unref)(e)<"u"}function mB(e,A,t,n){if(!e||!e.source||!e.target)return t(new ce(ie.EDGE_INVALID,e?.id??"[ID UNKNOWN]")),!1;let r;return ht(e)?r=e:r={...e,id:Fa(e)},r=Qa(r,void 0,n),Zh(r,A)?!1:r}function wB(e,A,t,n,r){if(!A.source||!A.target)return r(new ce(ie.EDGE_INVALID,e.id)),!1;if(!t)return r(new ce(ie.EDGE_NOT_FOUND,e.id)),!1;const{id:a,...u}=e;return{...u,id:n?Fa(A):a,source:A.source,target:A.target,sourceHandle:A.sourceHandle,targetHandle:A.targetHandle}}function Wa(e,A,t){const n={},r=[];for(let a=0;a<e.length;++a){const u=e[a];if(!kt(u)){t(new ce(ie.NODE_INVALID,u?.id));continue}const d=Yh(u,A(u.id),u.parentNode);u.parentNode&&(n[u.parentNode]=!0),r[a]=d}for(const a of r){const u=A(a.parentNode)||r.find(d=>d.id===a.parentNode);a.parentNode&&!u&&t(new ce(ie.NODE_MISSING_PARENT,a.id,a.parentNode)),(a.parentNode||n[a.id])&&(n[a.id]&&(a.isParent=!0),u&&(u.isParent=!0))}return r}function Ja(e,A,t,n,r,a){let u=r;const d=n.get(u)||new Map;n.set(u,d.set(t,A)),u=`${r}-${e}`;const h=n.get(u)||new Map;if(n.set(u,h.set(t,A)),a){u=`${r}-${e}-${a}`;const g=n.get(u)||new Map;n.set(u,g.set(t,A))}}function yi(e,A,t){e.clear();for(const n of t){const{source:r,target:a,sourceHandle:u=null,targetHandle:d=null}=n,h={edgeId:n.id,source:r,target:a,sourceHandle:u,targetHandle:d},g=`${r}-${u}--${a}-${d}`;Ja("source",h,`${a}-${d}--${r}-${u}`,e,r,u),Ja("target",h,g,e,a,d)}}function Za(e,A){if(e.size!==A.size)return!1;for(const t of e)if(!A.has(t))return!1;return!0}function Qi(e,A,t,n,r,a,u,d){const h=[];for(const g of e){const B=ht(g)?g:mB(g,d,r,a);if(!B)continue;const w=t(B.source),m=t(B.target);if(!w||!m){r(new ce(ie.EDGE_SOURCE_TARGET_MISSING,B.id,B.source,B.target));continue}if(!w){r(new ce(ie.EDGE_SOURCE_MISSING,B.id,B.source));continue}if(!m){r(new ce(ie.EDGE_TARGET_MISSING,B.id,B.target));continue}if(A&&!A(B,{edges:d,nodes:u,sourceNode:w,targetNode:m})){r(new ce(ie.EDGE_INVALID,B.id));continue}const v=n(B.id);h.push({...Qa(B,v,a),sourceNode:w,targetNode:m})}return h}var ja=Symbol("vueFlow"),qa=Symbol("nodeId"),Al=Symbol("nodeRef"),CB=Symbol("edgeId"),vB=Symbol("edgeRef"),kr=Symbol("slots");function el(e){const{vueFlowRef:A,snapToGrid:t,snapGrid:n,noDragClassName:r,nodeLookup:a,nodeExtent:u,nodeDragThreshold:d,viewport:h,autoPanOnNodeDrag:g,autoPanSpeed:B,nodesDraggable:w,panBy:m,findNode:v,multiSelectionActive:y,nodesSelectionActive:I,selectNodesOnDrag:T,removeSelectedElements:D,addSelectedNodes:V,updateNodePositions:b,emits:K}=XA(),{onStart:sA,onDrag:W,onStop:cA,onClick:lA,el:oA,disabled:iA,id:AA,selectable:S,dragHandle:eA}=e,H=(0,o.shallowRef)(!1);let X=[],U,L=null,k={x:void 0,y:void 0},N={x:0,y:0},O=null,Y=!1,tA=!1,BA=0,HA=!1;const nA=EB(),Z=({x:fA,y:J})=>{k={x:fA,y:J};let _=!1;if(X=X.map(F=>{const x={x:fA-F.distance.x,y:J-F.distance.y},{computedPosition:G}=pi(F,t.value?Tr(x,n.value):x,K.error,u.value,F.parentNode?v(F.parentNode):void 0);return _=_||F.position.x!==G.x||F.position.y!==G.y,F.position=G,F}),tA=tA||_,!!_&&(b(X,!0,!0),H.value=!0,O)){const[F,x]=Bi({id:AA,dragItems:X,findNode:v});W({event:O,node:F,nodes:x})}},$=()=>{if(!L)return;const[fA,J]=Na(N,L,B.value);if(fA!==0||J!==0){const _={x:(k.x??0)-fA/h.value.zoom,y:(k.y??0)-J/h.value.zoom};m({x:fA,y:J})&&Z(_)}BA=requestAnimationFrame($)},uA=(fA,J)=>{Y=!0;const _=v(AA);!T.value&&!y.value&&_&&(_.selected||D()),_&&(0,o.toValue)(S)&&T.value&&vi(_,y.value,V,D,I,!1,J);const F=nA(fA.sourceEvent);if(k=F,X=nB(a.value,w.value,F,AA),X.length){const[x,G]=Bi({id:AA,dragItems:X,findNode:v});sA({event:fA.sourceEvent,node:x,nodes:G})}},wA=(fA,J)=>{var _;fA.sourceEvent.type==="touchmove"&&fA.sourceEvent.touches.length>1||(tA=!1,d.value===0&&uA(fA,J),k=nA(fA.sourceEvent),L=((_=A.value)==null?void 0:_.getBoundingClientRect())||null,N=$e(fA.sourceEvent,L))},QA=(fA,J)=>{const _=nA(fA.sourceEvent);if(!HA&&Y&&g.value&&(HA=!0,$()),!Y){const F=_.xSnapped-(k.x??0),x=_.ySnapped-(k.y??0);Math.sqrt(F*F+x*x)>d.value&&uA(fA,J)}(k.x!==_.xSnapped||k.y!==_.ySnapped)&&X.length&&Y&&(O=fA.sourceEvent,N=$e(fA.sourceEvent,L),Z(_))},SA=fA=>{let J=!1;if(!Y&&!H.value&&!y.value){const _=fA.sourceEvent,F=nA(_),x=F.xSnapped-(k.x??0),G=F.ySnapped-(k.y??0),P=Math.sqrt(x*x+G*G);P!==0&&P<=d.value&&(lA?.(_),J=!0)}if(X.length&&!J){tA&&(b(X,!1,!1),tA=!1);const[_,F]=Bi({id:AA,dragItems:X,findNode:v});cA({event:fA.sourceEvent,node:_,nodes:F})}X=[],H.value=!1,HA=!1,Y=!1,k={x:void 0,y:void 0},cancelAnimationFrame(BA)};return(0,o.watch)([()=>(0,o.toValue)(iA),oA],([fA,J],_,F)=>{if(J){const x=Te(J);fA||(U=$f().on("start",G=>wA(G,J)).on("drag",G=>QA(G,J)).on("end",G=>SA(G)).filter(G=>{const P=G.target,dA=(0,o.toValue)(eA);return!G.button&&(!r.value||!Ka(P,`.${r.value}`,J)&&(!dA||Ka(P,dA,J)))}),x.call(U)),F(()=>{x.on(".drag",null),U&&(U.on("start",null),U.on("drag",null),U.on("end",null))})}}),H}function yB(){return{doubleClick:yA(),click:yA(),mouseEnter:yA(),mouseMove:yA(),mouseLeave:yA(),contextMenu:yA(),updateStart:yA(),update:yA(),updateEnd:yA()}}function QB(e,A){const t=yB();return t.doubleClick.on(n=>{var r,a;A.edgeDoubleClick(n),(a=(r=e.events)==null?void 0:r.doubleClick)==null||a.call(r,n)}),t.click.on(n=>{var r,a;A.edgeClick(n),(a=(r=e.events)==null?void 0:r.click)==null||a.call(r,n)}),t.mouseEnter.on(n=>{var r,a;A.edgeMouseEnter(n),(a=(r=e.events)==null?void 0:r.mouseEnter)==null||a.call(r,n)}),t.mouseMove.on(n=>{var r,a;A.edgeMouseMove(n),(a=(r=e.events)==null?void 0:r.mouseMove)==null||a.call(r,n)}),t.mouseLeave.on(n=>{var r,a;A.edgeMouseLeave(n),(a=(r=e.events)==null?void 0:r.mouseLeave)==null||a.call(r,n)}),t.contextMenu.on(n=>{var r,a;A.edgeContextMenu(n),(a=(r=e.events)==null?void 0:r.contextMenu)==null||a.call(r,n)}),t.updateStart.on(n=>{var r,a;A.edgeUpdateStart(n),(a=(r=e.events)==null?void 0:r.updateStart)==null||a.call(r,n)}),t.update.on(n=>{var r,a;A.edgeUpdate(n),(a=(r=e.events)==null?void 0:r.update)==null||a.call(r,n)}),t.updateEnd.on(n=>{var r,a;A.edgeUpdateEnd(n),(a=(r=e.events)==null?void 0:r.updateEnd)==null||a.call(r,n)}),Object.entries(t).reduce((n,[r,a])=>(n.emit[r]=a.trigger,n.on[r]=a.on,n),{emit:{},on:{}})}function EB(){const{viewport:e,snapGrid:A,snapToGrid:t,vueFlowRef:n}=XA();return r=>{var a;const u=((a=n.value)==null?void 0:a.getBoundingClientRect())??{left:0,top:0},{x:d,y:h}=$e(lB(r)?r.sourceEvent:r,u),g=Rn({x:d,y:h},e.value),{x:B,y:w}=t.value?Tr(g,A.value):g;return{xSnapped:B,ySnapped:w,...g}}}function Mr(){return!0}function tl({handleId:e,nodeId:A,type:t,isValidConnection:n,edgeUpdaterType:r,onEdgeUpdate:a,onEdgeUpdateEnd:u}){const{id:d,vueFlowRef:h,connectionMode:g,connectionRadius:B,connectOnClick:w,connectionClickStartHandle:m,nodesConnectable:v,autoPanOnConnect:y,autoPanSpeed:I,findNode:T,panBy:D,startConnection:V,updateConnection:b,endConnection:K,emits:sA,viewport:W,edges:cA,nodes:lA,isValidConnection:oA,nodeLookup:iA}=XA();let AA=null,S=!1,eA=null;function H(U){var L;const k=(0,o.toValue)(t)==="target",N=mi(U),O=ya(U.target),Y=U.currentTarget;if(Y&&(N&&U.button===0||!N)){let tA=function(EA){_=$e(EA,SA),Z=gB(Rn(_,W.value,!1,[1,1]),B.value,iA.value,G),F||(x(),F=!0);const FA=Ga(EA,{handle:Z,connectionMode:g.value,fromNodeId:(0,o.toValue)(A),fromHandleId:(0,o.toValue)(e),fromType:k?"target":"source",isValidConnection:nA,doc:O,lib:"vue",flowId:d,nodeLookup:iA.value},cA.value,lA.value,T,iA.value);eA=FA.handleDomNode,AA=FA.connection,S=BB(!!Z,FA.isValid);const NA={...gA,isValid:S,to:FA.toHandle&&S?Kn({x:FA.toHandle.x,y:FA.toHandle.y},W.value):_,toHandle:FA.toHandle,toPosition:S&&FA.toHandle?FA.toHandle.position:Ci[G.position],toNode:FA.toHandle?iA.value.get(FA.toHandle.nodeId):null};if(S&&Z&&gA?.toHandle&&NA.toHandle&&gA.toHandle.type===NA.toHandle.type&&gA.toHandle.nodeId===NA.toHandle.nodeId&&gA.toHandle.id===NA.toHandle.id&&gA.to.x===NA.to.x&&gA.to.y===NA.to.y)return;const OA=Z??FA.toHandle;if(b(OA&&S?Kn({x:OA.x,y:OA.y},W.value):_,OA,hB(!!OA,S)),gA=NA,!Z&&!S&&!eA)return wi(J);AA&&AA.source!==AA.target&&eA&&(wi(J),J=eA,eA.classList.add("connecting","vue-flow__handle-connecting"),eA.classList.toggle("valid",!!S),eA.classList.toggle("vue-flow__handle-valid",!!S))},BA=function(EA){"touches"in EA&&EA.touches.length>0||((Z||eA)&&AA&&S&&(a?a(EA,AA):sA.connect(AA)),sA.connectEnd(EA),r&&u?.(EA),wi(J),cancelAnimationFrame($),K(EA),F=!1,S=!1,AA=null,eA=null,O.removeEventListener("mousemove",tA),O.removeEventListener("mouseup",BA),O.removeEventListener("touchmove",tA),O.removeEventListener("touchend",BA))};const HA=T((0,o.toValue)(A));let nA=(0,o.toValue)(n)||oA.value||Mr;!nA&&HA&&(nA=(k?HA.isValidSourcePos:HA.isValidTargetPos)||Mr);let Z,$=0;const{x:uA,y:wA}=$e(U),QA=za((0,o.toValue)(r),Y),SA=(L=h.value)==null?void 0:L.getBoundingClientRect();if(!SA||!QA)return;const fA=Xa((0,o.toValue)(A),QA,(0,o.toValue)(e),iA.value,g.value);if(!fA)return;let J,_=$e(U,SA),F=!1;const x=()=>{if(!y.value)return;const[EA,FA]=Na(_,SA,I.value);D({x:EA,y:FA}),$=requestAnimationFrame(x)},G={...fA,nodeId:(0,o.toValue)(A),type:QA,position:fA.position},P=iA.value.get((0,o.toValue)(A)),dA={inProgress:!0,isValid:null,from:tn(P,G,IA.Left,!0),fromHandle:G,fromPosition:G.position,fromNode:P,to:_,toHandle:null,toPosition:Ci[G.position],toNode:null};V({nodeId:(0,o.toValue)(A),id:(0,o.toValue)(e),type:QA,position:Y?.getAttribute("data-handlepos")||IA.Top,..._},{x:uA-SA.left,y:wA-SA.top}),sA.connectStart({event:U,nodeId:(0,o.toValue)(A),handleId:(0,o.toValue)(e),handleType:QA});let gA=dA;O.addEventListener("mousemove",tA),O.addEventListener("mouseup",BA),O.addEventListener("touchmove",tA),O.addEventListener("touchend",BA)}}function X(U){var L,k;if(!w.value)return;const N=(0,o.toValue)(t)==="target";if(!m.value){sA.clickConnectStart({event:U,nodeId:(0,o.toValue)(A),handleId:(0,o.toValue)(e)}),V({nodeId:(0,o.toValue)(A),type:(0,o.toValue)(t),id:(0,o.toValue)(e),position:IA.Top,...$e(U)},void 0,!0);return}let O=(0,o.toValue)(n)||oA.value||Mr;const Y=T((0,o.toValue)(A));if(!O&&Y&&(O=(N?Y.isValidSourcePos:Y.isValidTargetPos)||Mr),Y&&(typeof Y.connectable>"u"?v.value:Y.connectable)===!1)return;const tA=ya(U.target),BA=Ga(U,{handle:{nodeId:(0,o.toValue)(A),id:(0,o.toValue)(e),type:(0,o.toValue)(t),position:IA.Top,...$e(U)},connectionMode:g.value,fromNodeId:m.value.nodeId,fromHandleId:m.value.id??null,fromType:m.value.type,isValidConnection:O,doc:tA,lib:"vue",flowId:d,nodeLookup:iA.value},cA.value,lA.value,T,iA.value),HA=((L=BA.connection)==null?void 0:L.source)===((k=BA.connection)==null?void 0:k.target);BA.isValid&&BA.connection&&!HA&&sA.connect(BA.connection),sA.clickConnectEnd(U),K(U,!0)}return{handlePointerDown:H,handleClick:X}}function FB(){return(0,o.inject)(qa,"")}function nl(e){const A=e??FB()??"",t=(0,o.inject)(Al,(0,o.ref)(null)),{findNode:n,edges:r,emits:a}=XA(),u=n(A);return u||a.error(new ce(ie.NODE_NOT_FOUND,A)),{id:A,nodeEl:t,node:u,parentNode:(0,o.computed)(()=>n(u.parentNode)),connectedEdges:(0,o.computed)(()=>Ia([u],r.value))}}function UB(){return{doubleClick:yA(),click:yA(),mouseEnter:yA(),mouseMove:yA(),mouseLeave:yA(),contextMenu:yA(),dragStart:yA(),drag:yA(),dragStop:yA()}}function bB(e,A){const t=UB();return t.doubleClick.on(n=>{var r,a;A.nodeDoubleClick(n),(a=(r=e.events)==null?void 0:r.doubleClick)==null||a.call(r,n)}),t.click.on(n=>{var r,a;A.nodeClick(n),(a=(r=e.events)==null?void 0:r.click)==null||a.call(r,n)}),t.mouseEnter.on(n=>{var r,a;A.nodeMouseEnter(n),(a=(r=e.events)==null?void 0:r.mouseEnter)==null||a.call(r,n)}),t.mouseMove.on(n=>{var r,a;A.nodeMouseMove(n),(a=(r=e.events)==null?void 0:r.mouseMove)==null||a.call(r,n)}),t.mouseLeave.on(n=>{var r,a;A.nodeMouseLeave(n),(a=(r=e.events)==null?void 0:r.mouseLeave)==null||a.call(r,n)}),t.contextMenu.on(n=>{var r,a;A.nodeContextMenu(n),(a=(r=e.events)==null?void 0:r.contextMenu)==null||a.call(r,n)}),t.dragStart.on(n=>{var r,a;A.nodeDragStart(n),(a=(r=e.events)==null?void 0:r.dragStart)==null||a.call(r,n)}),t.drag.on(n=>{var r,a;A.nodeDrag(n),(a=(r=e.events)==null?void 0:r.drag)==null||a.call(r,n)}),t.dragStop.on(n=>{var r,a;A.nodeDragStop(n),(a=(r=e.events)==null?void 0:r.dragStop)==null||a.call(r,n)}),Object.entries(t).reduce((n,[r,a])=>(n.emit[r]=a.trigger,n.on[r]=a.on,n),{emit:{},on:{}})}function rl(){const{getSelectedNodes:e,nodeExtent:A,updateNodePositions:t,findNode:n,snapGrid:r,snapToGrid:a,nodesDraggable:u,emits:d}=XA();return(h,g=!1)=>{const B=a.value?r.value[0]:5,w=a.value?r.value[1]:5,m=g?4:1,v=h.x*B*m,y=h.y*w*m,I=[];for(const T of e.value)if(T.draggable||u&&typeof T.draggable>"u"){const{position:D}=pi(T,{x:T.computedPosition.x+v,y:T.computedPosition.y+y},d.error,A.value,T.parentNode?n(T.parentNode):void 0);I.push({id:T.id,position:D,from:T.position,distance:{x:h.x,y:h.y},dimensions:T.dimensions})}t(I,!0,!1)}}var Or=.1,HB=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function mt(){return Pn("Viewport not initialized yet."),Promise.resolve(!1)}var IB={zoomIn:mt,zoomOut:mt,zoomTo:mt,fitView:mt,setCenter:mt,fitBounds:mt,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:mt,setTransform:mt,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function _B(e){function A(n,r){return new Promise(a=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(r?.interpolate==="linear"?Sn:vr).scaleBy(Ei(e.d3Selection,r?.duration,r?.ease,()=>{a(!0)}),n):a(!1)})}function t(n,r,a,u){return new Promise(d=>{var h;const{x:g,y:B}=va({x:-n,y:-r},e.translateExtent),w=qt.translate(-g,-B).scale(a);e.d3Selection&&e.d3Zoom?(h=e.d3Zoom)==null||h.interpolate(u?.interpolate==="linear"?Sn:vr).transform(Ei(e.d3Selection,u?.duration,u?.ease,()=>{d(!0)}),w):d(!1)})}return(0,o.computed)(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:n=>A(1.2,n),zoomOut:n=>A(1/1.2,n),zoomTo:(n,r)=>new Promise(a=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate(r?.interpolate==="linear"?Sn:vr).scaleTo(Ei(e.d3Selection,r?.duration,r?.ease,()=>{a(!0)}),n):a(!1)}),setViewport:(n,r)=>t(n.x,n.y,n.zoom,r),setTransform:(n,r)=>t(n.x,n.y,n.zoom,r),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(n={padding:Or,includeHiddenNodes:!1,duration:0})=>{var r,a;const u=[];for(const B of e.nodes)B.dimensions.width&&B.dimensions.height&&(n?.includeHiddenNodes||!B.hidden)&&(!((r=n.nodes)!=null&&r.length)||(a=n.nodes)!=null&&a.length&&n.nodes.includes(B.id))&&u.push(B);if(!u.length)return Promise.resolve(!1);const{x:d,y:h,zoom:g}=_a(ba(u),e.dimensions.width,e.dimensions.height,n.minZoom??e.minZoom,n.maxZoom??e.maxZoom,n.padding??Or);return t(d,h,g,n)},setCenter:(n,r,a)=>{const u=typeof a?.zoom<"u"?a.zoom:e.maxZoom;return t(e.dimensions.width/2-n*u,e.dimensions.height/2-r*u,u,a)},fitBounds:(n,r={padding:Or})=>{const{x:a,y:u,zoom:d}=_a(n,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??Or);return t(a,u,d,r)},project:n=>Rn(n,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:n=>{if(e.vueFlowRef){const{x:r,y:a}=e.vueFlowRef.getBoundingClientRect();return Rn({x:n.x-r,y:n.y-a},e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:n=>{if(e.vueFlowRef){const{x:r,y:a}=e.vueFlowRef.getBoundingClientRect();return Kn({x:n.x+r,y:n.y+a},e.viewport)}return{x:0,y:0}}}:IB)}function Ei(e,A=0,t=HB,n=()=>{}){const r=typeof A=="number"&&A>0;return r||n(),r?e.transition().duration(A).ease(t).on("end",n):e}function SB(e,A,t){const n=(0,o.effectScope)(!0);return n.run(()=>{const r=()=>{n.run(()=>{let I,T,D=!!(t.nodes.value.length||t.edges.value.length);I=Yt([e.modelValue,()=>{var V,b;return(b=(V=e.modelValue)==null?void 0:V.value)==null?void 0:b.length}],([V])=>{V&&Array.isArray(V)&&(T?.pause(),t.setElements(V),!T&&!D&&V.length?D=!0:T?.resume())}),T=Yt([t.nodes,t.edges,()=>t.edges.value.length,()=>t.nodes.value.length],([V,b])=>{var K;(K=e.modelValue)!=null&&K.value&&Array.isArray(e.modelValue.value)&&(I?.pause(),e.modelValue.value=[...V,...b],(0,o.nextTick)(()=>{I?.resume()}))},{immediate:D}),(0,o.onScopeDispose)(()=>{I?.stop(),T?.stop()})})},a=()=>{n.run(()=>{let I,T,D=!!t.nodes.value.length;I=Yt([e.nodes,()=>{var V,b;return(b=(V=e.nodes)==null?void 0:V.value)==null?void 0:b.length}],([V])=>{V&&Array.isArray(V)&&(T?.pause(),t.setNodes(V),!T&&!D&&V.length?D=!0:T?.resume())}),T=Yt([t.nodes,()=>t.nodes.value.length],([V])=>{var b;(b=e.nodes)!=null&&b.value&&Array.isArray(e.nodes.value)&&(I?.pause(),e.nodes.value=[...V],(0,o.nextTick)(()=>{I?.resume()}))},{immediate:D}),(0,o.onScopeDispose)(()=>{I?.stop(),T?.stop()})})},u=()=>{n.run(()=>{let I,T,D=!!t.edges.value.length;I=Yt([e.edges,()=>{var V,b;return(b=(V=e.edges)==null?void 0:V.value)==null?void 0:b.length}],([V])=>{V&&Array.isArray(V)&&(T?.pause(),t.setEdges(V),!T&&!D&&V.length?D=!0:T?.resume())}),T=Yt([t.edges,()=>t.edges.value.length],([V])=>{var b;(b=e.edges)!=null&&b.value&&Array.isArray(e.edges.value)&&(I?.pause(),e.edges.value=[...V],(0,o.nextTick)(()=>{I?.resume()}))},{immediate:D}),(0,o.onScopeDispose)(()=>{I?.stop(),T?.stop()})})},d=()=>{n.run(()=>{(0,o.watch)(()=>A.maxZoom,()=>{A.maxZoom&&se(A.maxZoom)&&t.setMaxZoom(A.maxZoom)},{immediate:!0})})},h=()=>{n.run(()=>{(0,o.watch)(()=>A.minZoom,()=>{A.minZoom&&se(A.minZoom)&&t.setMinZoom(A.minZoom)},{immediate:!0})})},g=()=>{n.run(()=>{(0,o.watch)(()=>A.translateExtent,()=>{A.translateExtent&&se(A.translateExtent)&&t.setTranslateExtent(A.translateExtent)},{immediate:!0})})},B=()=>{n.run(()=>{(0,o.watch)(()=>A.nodeExtent,()=>{A.nodeExtent&&se(A.nodeExtent)&&t.setNodeExtent(A.nodeExtent)},{immediate:!0})})},w=()=>{n.run(()=>{(0,o.watch)(()=>A.applyDefault,()=>{se(A.applyDefault)&&(t.applyDefault.value=A.applyDefault)},{immediate:!0})})},m=()=>{n.run(()=>{const I=async T=>{let D=T;typeof A.autoConnect=="function"&&(D=await A.autoConnect(T)),D!==!1&&t.addEdges([D])};(0,o.watch)(()=>A.autoConnect,()=>{se(A.autoConnect)&&(t.autoConnect.value=A.autoConnect)},{immediate:!0}),(0,o.watch)(t.autoConnect,(T,D,V)=>{T?t.onConnect(I):t.hooks.value.connect.off(I),V(()=>{t.hooks.value.connect.off(I)})},{immediate:!0})})},v=()=>{const I=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const T of Object.keys(A)){const D=T;if(!I.includes(D)){const V=(0,o.toRef)(()=>A[D]),b=t[D];(0,o.isRef)(b)&&n.run(()=>{(0,o.watch)(V,K=>{se(K)&&(b.value=K)},{immediate:!0})})}}};r(),a(),u(),h(),d(),g(),B(),w(),m(),v()}),()=>n.stop()}function xB(){return{edgesChange:yA(),nodesChange:yA(),nodeDoubleClick:yA(),nodeClick:yA(),nodeMouseEnter:yA(),nodeMouseMove:yA(),nodeMouseLeave:yA(),nodeContextMenu:yA(),nodeDragStart:yA(),nodeDrag:yA(),nodeDragStop:yA(),nodesInitialized:yA(),miniMapNodeClick:yA(),miniMapNodeDoubleClick:yA(),miniMapNodeMouseEnter:yA(),miniMapNodeMouseMove:yA(),miniMapNodeMouseLeave:yA(),connect:yA(),connectStart:yA(),connectEnd:yA(),clickConnectStart:yA(),clickConnectEnd:yA(),paneReady:yA(),init:yA(),move:yA(),moveStart:yA(),moveEnd:yA(),selectionDragStart:yA(),selectionDrag:yA(),selectionDragStop:yA(),selectionContextMenu:yA(),selectionStart:yA(),selectionEnd:yA(),viewportChangeStart:yA(),viewportChange:yA(),viewportChangeEnd:yA(),paneScroll:yA(),paneClick:yA(),paneContextMenu:yA(),paneMouseEnter:yA(),paneMouseMove:yA(),paneMouseLeave:yA(),edgeContextMenu:yA(),edgeMouseEnter:yA(),edgeMouseMove:yA(),edgeMouseLeave:yA(),edgeDoubleClick:yA(),edgeClick:yA(),edgeUpdateStart:yA(),edgeUpdate:yA(),edgeUpdateEnd:yA(),updateNodeInternals:yA(),error:yA(e=>Pn(e.message))}}function DB(e,A){const t=(0,o.getCurrentInstance)();(0,o.onBeforeMount)(()=>{for(const[r,a]of Object.entries(A.value)){const u=d=>{e(r,d)};a.setEmitter(u),Fn(a.removeEmitter),a.setHasEmitListeners(()=>n(r)),Fn(a.removeHasEmitListeners)}});function n(r){var a;const u=NB(r);return!!((a=t?.vnode.props)!=null&&a[u])}}function NB(e){const[A,...t]=e.split(":");return`on${A.replace(/(?:^|-)(\w)/g,(n,r)=>r.toUpperCase())}${t.length?`:${t.join(":")}`:""}`}function ol(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:fi.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:kn.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:Lt.Bezier,style:{}},connectionMode:nt.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:NaN,y:NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:Lr()?"Meta":"Control",zoomActivationKeyCode:Lr()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:xB(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}var LB=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function TB(e,A,t){const n=_B(e),r=_=>{const F=_??[];e.hooks.updateNodeInternals.trigger(F)},a=_=>Jh(_,e.nodes,e.edges),u=_=>Wh(_,e.nodes,e.edges),d=_=>Ia(_,e.edges),h=({id:_,type:F,nodeId:x})=>{var G;const P=_?`-${F}-${_}`:`-${F}`;return Array.from(((G=e.connectionLookup.get(`${x}${P}`))==null?void 0:G.values())??[])},g=_=>{if(_)return A.value.get(_)},B=_=>{if(_)return t.value.get(_)},w=(_,F,x)=>{var G,P;const dA=[];for(const gA of _){const EA={id:gA.id,type:"position",dragging:x,from:gA.from};if(F&&(EA.position=gA.position,gA.parentNode)){const FA=g(gA.parentNode);EA.position={x:EA.position.x-(((G=FA?.computedPosition)==null?void 0:G.x)??0),y:EA.position.y-(((P=FA?.computedPosition)==null?void 0:P.y)??0)}}dA.push(EA)}dA?.length&&e.hooks.nodesChange.trigger(dA)},m=_=>{if(!e.vueFlowRef)return;const F=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!F)return;const x=window.getComputedStyle(F),{m22:G}=new window.DOMMatrixReadOnly(x.transform),P=[];for(const dA of _){const gA=dA,EA=g(gA.id);if(EA){const FA=Dr(gA.nodeElement);if(FA.width&&FA.height&&(EA.dimensions.width!==FA.width||EA.dimensions.height!==FA.height||gA.forceUpdate)){const NA=gA.nodeElement.getBoundingClientRect();EA.dimensions=FA,EA.handleBounds.source=Ya("source",gA.nodeElement,NA,G,EA.id),EA.handleBounds.target=Ya("target",gA.nodeElement,NA,G,EA.id),P.push({id:EA.id,type:"dimensions",dimensions:FA})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&n.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),P.length&&e.hooks.nodesChange.trigger(P)},v=(_,F)=>{const x=new Set,G=new Set;for(const gA of _)kt(gA)?x.add(gA.id):ht(gA)&&G.add(gA.id);const P=pt(A.value,x,!0),dA=pt(t.value,G);if(e.multiSelectionActive){for(const gA of x)P.push(Bt(gA,F));for(const gA of G)dA.push(Bt(gA,F))}P.length&&e.hooks.nodesChange.trigger(P),dA.length&&e.hooks.edgesChange.trigger(dA)},y=_=>{if(e.multiSelectionActive){const F=_.map(x=>Bt(x.id,!0));e.hooks.nodesChange.trigger(F);return}e.hooks.nodesChange.trigger(pt(A.value,new Set(_.map(F=>F.id)),!0)),e.hooks.edgesChange.trigger(pt(t.value))},I=_=>{if(e.multiSelectionActive){const F=_.map(x=>Bt(x.id,!0));e.hooks.edgesChange.trigger(F);return}e.hooks.edgesChange.trigger(pt(t.value,new Set(_.map(F=>F.id)))),e.hooks.nodesChange.trigger(pt(A.value,new Set,!0))},T=_=>{v(_,!0)},D=_=>{const F=(_||e.nodes).map(x=>(x.selected=!1,Bt(x.id,!1)));e.hooks.nodesChange.trigger(F)},V=_=>{const F=(_||e.edges).map(x=>(x.selected=!1,Bt(x.id,!1)));e.hooks.edgesChange.trigger(F)},b=_=>{if(!_||!_.length)return v([],!1);const F=_.reduce((x,G)=>{const P=Bt(G.id,!1);return kt(G)?x.nodes.push(P):x.edges.push(P),x},{nodes:[],edges:[]});F.nodes.length&&e.hooks.nodesChange.trigger(F.nodes),F.edges.length&&e.hooks.edgesChange.trigger(F.edges)},K=_=>{var F;(F=e.d3Zoom)==null||F.scaleExtent([_,e.maxZoom]),e.minZoom=_},sA=_=>{var F;(F=e.d3Zoom)==null||F.scaleExtent([e.minZoom,_]),e.maxZoom=_},W=_=>{var F;(F=e.d3Zoom)==null||F.translateExtent(_),e.translateExtent=_},cA=_=>{e.nodeExtent=_,r()},lA=_=>{var F;(F=e.d3Zoom)==null||F.clickDistance(_)},oA=_=>{e.nodesDraggable=_,e.nodesConnectable=_,e.elementsSelectable=_},iA=_=>{const F=_ instanceof Function?_(e.nodes):_;!e.initialized&&!F.length||(e.nodes=Wa(F,g,e.hooks.error.trigger))},AA=_=>{const F=_ instanceof Function?_(e.edges):_;if(!e.initialized&&!F.length)return;const x=Qi(F,e.isValidConnection,g,B,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);yi(e.connectionLookup,t.value,x),e.edges=x},S=_=>{const F=_ instanceof Function?_([...e.nodes,...e.edges]):_;!e.initialized&&!F.length||(iA(F.filter(kt)),AA(F.filter(ht)))},eA=_=>{let F=_ instanceof Function?_(e.nodes):_;F=Array.isArray(F)?F:[F];const x=Wa(F,g,e.hooks.error.trigger),G=[];for(const P of x)G.push(Ta(P));G.length&&e.hooks.nodesChange.trigger(G)},H=_=>{let F=_ instanceof Function?_(e.edges):_;F=Array.isArray(F)?F:[F];const x=Qi(F,e.isValidConnection,g,B,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),G=[];for(const P of x)G.push(Ta(P));G.length&&e.hooks.edgesChange.trigger(G)},X=(_,F=!0,x=!1)=>{const G=_ instanceof Function?_(e.nodes):_,P=Array.isArray(G)?G:[G],dA=[],gA=[];function EA(NA){const OA=d(NA);for(const KA of OA)(!se(KA.deletable)||KA.deletable)&&gA.push(Ma(KA.id,KA.source,KA.target,KA.sourceHandle,KA.targetHandle))}function FA(NA){const OA=[];for(const KA of e.nodes)KA.parentNode===NA&&OA.push(KA);if(OA.length){for(const KA of OA)dA.push(ka(KA.id));F&&EA(OA);for(const KA of OA)FA(KA.id)}}for(const NA of P){const OA=typeof NA=="string"?g(NA):NA;OA&&(se(OA.deletable)&&!OA.deletable||(dA.push(ka(OA.id)),F&&EA([OA]),x&&FA(OA.id)))}gA.length&&e.hooks.edgesChange.trigger(gA),dA.length&&e.hooks.nodesChange.trigger(dA)},U=_=>{const F=_ instanceof Function?_(e.edges):_,x=Array.isArray(F)?F:[F],G=[];for(const P of x){const dA=typeof P=="string"?B(P):P;dA&&(se(dA.deletable)&&!dA.deletable||G.push(Ma(typeof P=="string"?P:P.id,dA.source,dA.target,dA.sourceHandle,dA.targetHandle)))}e.hooks.edgesChange.trigger(G)},L=(_,F,x=!0)=>{const G=B(_.id);if(!G)return!1;const P=e.edges.indexOf(G),dA=wB(_,F,G,x,e.hooks.error.trigger);if(dA){const[gA]=Qi([dA],e.isValidConnection,g,B,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((EA,FA)=>FA===P?gA:EA),yi(e.connectionLookup,t.value,[gA]),gA}return!1},k=(_,F,x={replace:!1})=>{const G=B(_);if(!G)return;const P=typeof F=="function"?F(G):F;G.data=x.replace?P:{...G.data,...P}},N=_=>La(_,e.nodes),O=_=>{const F=La(_,e.edges);return yi(e.connectionLookup,t.value,F),F},Y=(_,F,x={replace:!1})=>{const G=g(_);if(!G)return;const P=typeof F=="function"?F(G):F;x.replace?e.nodes.splice(e.nodes.indexOf(G),1,P):Object.assign(G,P)},tA=(_,F,x={replace:!1})=>{const G=g(_);if(!G)return;const P=typeof F=="function"?F(G):F;G.data=x.replace?P:{...G.data,...P}},BA=(_,F,x=!1)=>{x?e.connectionClickStartHandle=_:e.connectionStartHandle=_,e.connectionEndHandle=null,e.connectionStatus=null,F&&(e.connectionPosition=F)},HA=(_,F=null,x=null)=>{e.connectionStartHandle&&(e.connectionPosition=_,e.connectionEndHandle=F,e.connectionStatus=x)},nA=(_,F)=>{e.connectionPosition={x:NaN,y:NaN},e.connectionEndHandle=null,e.connectionStatus=null,F?e.connectionClickStartHandle=null:e.connectionStartHandle=null},Z=_=>{const F=$h(_),x=F?null:On(_)?_:g(_.id);return!F&&!x?[null,null,F]:[F?_:Sr(x),x,F]},$=(_,F=!0,x=e.nodes)=>{const[G,P,dA]=Z(_);if(!G)return[];const gA=[];for(const EA of x||e.nodes){if(!dA&&(EA.id===P.id||!EA.computedPosition))continue;const FA=Sr(EA),NA=xr(FA,G);(F&&NA>0||NA>=FA.width*FA.height||NA>=Number(G.width)*Number(G.height))&&gA.push(EA)}return gA},uA=(_,F,x=!0)=>{const[G]=Z(_);if(!G)return!1;const P=xr(G,F);return x&&P>0||P>=Number(G.width)*Number(G.height)},wA=_=>{const{viewport:F,dimensions:x,d3Zoom:G,d3Selection:P,translateExtent:dA}=e;if(!G||!P||!_.x&&!_.y)return!1;const gA=qt.translate(F.x+_.x,F.y+_.y).scale(F.zoom),EA=[[0,0],[x.width,x.height]],FA=G.constrain()(gA,EA,dA),NA=e.viewport.x!==FA.x||e.viewport.y!==FA.y||e.viewport.zoom!==FA.k;return G.transform(P,FA),NA},QA=_=>{const F=_ instanceof Function?_(e):_,x=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];se(F.defaultEdgeOptions)&&(e.defaultEdgeOptions=F.defaultEdgeOptions);const G=F.modelValue||F.nodes||F.edges?[]:void 0;G&&(F.modelValue&&G.push(...F.modelValue),F.nodes&&G.push(...F.nodes),F.edges&&G.push(...F.edges),S(G));const P=()=>{se(F.maxZoom)&&sA(F.maxZoom),se(F.minZoom)&&K(F.minZoom),se(F.translateExtent)&&W(F.translateExtent)};for(const dA of Object.keys(F)){const gA=dA,EA=F[gA];![...LB,...x].includes(gA)&&se(EA)&&(e[gA]=EA)}Xo(()=>e.d3Zoom).not.toBeNull().then(P),e.initialized||(e.initialized=!0)};return{updateNodePositions:w,updateNodeDimensions:m,setElements:S,setNodes:iA,setEdges:AA,addNodes:eA,addEdges:H,removeNodes:X,removeEdges:U,findNode:g,findEdge:B,updateEdge:L,updateEdgeData:k,updateNode:Y,updateNodeData:tA,applyEdgeChanges:O,applyNodeChanges:N,addSelectedElements:T,addSelectedNodes:y,addSelectedEdges:I,setMinZoom:K,setMaxZoom:sA,setTranslateExtent:W,setNodeExtent:cA,setPaneClickDistance:lA,removeSelectedElements:b,removeSelectedNodes:D,removeSelectedEdges:V,startConnection:BA,updateConnection:HA,endConnection:nA,setInteractive:oA,setState:QA,getIntersectingNodes:$,getIncomers:a,getOutgoers:u,getConnectedEdges:d,getHandleConnections:h,isNodeIntersecting:uA,panBy:wA,fitView:_=>n.value.fitView(_),zoomIn:_=>n.value.zoomIn(_),zoomOut:_=>n.value.zoomOut(_),zoomTo:(_,F)=>n.value.zoomTo(_,F),setViewport:(_,F)=>n.value.setViewport(_,F),setTransform:(_,F)=>n.value.setTransform(_,F),getViewport:()=>n.value.getViewport(),getTransform:()=>n.value.getTransform(),setCenter:(_,F,x)=>n.value.setCenter(_,F,x),fitBounds:(_,F)=>n.value.fitBounds(_,F),project:_=>n.value.project(_),screenToFlowCoordinate:_=>n.value.screenToFlowCoordinate(_),flowToScreenCoordinate:_=>n.value.flowToScreenCoordinate(_),toObject:()=>{const _=[],F=[];for(const x of e.nodes){const{computedPosition:G,handleBounds:P,selected:dA,dimensions:gA,isParent:EA,resizing:FA,dragging:NA,events:OA,...KA}=x;_.push(KA)}for(const x of e.edges){const{selected:G,sourceNode:P,targetNode:dA,events:gA,...EA}=x;F.push(EA)}return JSON.parse(JSON.stringify({nodes:_,edges:F,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:_=>new Promise(F=>{const{nodes:x,edges:G,position:P,zoom:dA,viewport:gA}=_;x&&iA(x),G&&AA(G);const[EA,FA]=gA?.x&&gA?.y?[gA.x,gA.y]:P??[null,null];if(EA&&FA){const NA=gA?.zoom||dA||e.viewport.zoom;return Xo(()=>n.value.viewportInitialized).toBe(!0).then(()=>{n.value.setViewport({x:EA,y:FA,zoom:NA}).then(()=>{F(!0)})})}else F(!0)}),updateNodeInternals:r,viewportHelper:n,$reset:()=>{const _=ol();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const F=qt.translate(_.defaultViewport.x??0,_.defaultViewport.y??0).scale(Tt(_.defaultViewport.zoom??1,_.minZoom,_.maxZoom)),x=e.viewportRef.getBoundingClientRect(),G=[[0,0],[x.width,x.height]],P=e.d3Zoom.constrain()(F,G,_.translateExtent);e.d3Zoom.transform(e.d3Selection,P)}QA(_)},$destroy:()=>{}}}var kB=["data-id","data-handleid","data-nodeid","data-handlepos"],nn=(0,o.defineComponent)({name:"Handle",compatConfig:{MODE:3},props:{id:{default:null},type:{},position:{default:()=>IA.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:A}){const t=(0,o.createPropsRestProxy)(e,["position","connectable","connectableStart","connectableEnd","id"]),n=(0,o.toRef)(()=>t.type??"source"),r=(0,o.toRef)(()=>t.isValidConnection??null),{id:a,connectionStartHandle:u,connectionClickStartHandle:d,connectionEndHandle:h,vueFlowRef:g,nodesConnectable:B,noDragClassName:w,noPanClassName:m}=XA(),{id:v,node:y,nodeEl:I,connectedEdges:T}=nl(),D=(0,o.ref)(),V=(0,o.toRef)(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),b=(0,o.toRef)(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),K=(0,o.toRef)(()=>{var AA,S,eA,H,X,U;return((AA=u.value)==null?void 0:AA.nodeId)===v&&((S=u.value)==null?void 0:S.id)===e.id&&((eA=u.value)==null?void 0:eA.type)===n.value||((H=h.value)==null?void 0:H.nodeId)===v&&((X=h.value)==null?void 0:X.id)===e.id&&((U=h.value)==null?void 0:U.type)===n.value}),sA=(0,o.toRef)(()=>{var AA,S,eA;return((AA=d.value)==null?void 0:AA.nodeId)===v&&((S=d.value)==null?void 0:S.id)===e.id&&((eA=d.value)==null?void 0:eA.type)===n.value}),{handlePointerDown:W,handleClick:cA}=tl({nodeId:v,handleId:e.id,isValidConnection:r,type:n}),lA=(0,o.computed)(()=>typeof e.connectable=="string"&&e.connectable==="single"?!T.value.some(AA=>{const S=AA[`${n.value}Handle`];return AA[n.value]!==v?!1:S?S===e.id:!0}):typeof e.connectable=="number"?T.value.filter(AA=>{const S=AA[`${n.value}Handle`];return AA[n.value]!==v?!1:S?S===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(y,T.value):se(e.connectable)?e.connectable:B.value);(0,o.onMounted)(()=>{var AA;if(!y.dimensions.width||!y.dimensions.height)return;const S=(AA=y.handleBounds[n.value])==null?void 0:AA.find(N=>N.id===e.id);if(!g.value||S)return;const eA=g.value.querySelector(".vue-flow__transformationpane");if(!I.value||!D.value||!eA||!e.id)return;const H=I.value.getBoundingClientRect(),X=D.value.getBoundingClientRect(),U=window.getComputedStyle(eA),{m22:L}=new window.DOMMatrixReadOnly(U.transform),k={id:e.id,position:e.position,x:(X.left-H.left)/L,y:(X.top-H.top)/L,type:n.value,nodeId:v,...Dr(D.value)};y.handleBounds[n.value]=[...y.handleBounds[n.value]??[],k]});function oA(AA){const S=mi(AA);lA.value&&V.value&&(S&&AA.button===0||!S)&&W(AA)}function iA(AA){!v||!d.value&&!V.value||lA.value&&cA(AA)}return A({handleClick:cA,handlePointerDown:W,onClick:iA,onPointerDown:oA}),(AA,S)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"handle",ref:D,"data-id":`${(0,o.unref)(a)}-${(0,o.unref)(v)}-${e.id}-${n.value}`,"data-handleid":e.id,"data-nodeid":(0,o.unref)(v),"data-handlepos":AA.position,class:(0,o.normalizeClass)(["vue-flow__handle",[`vue-flow__handle-${AA.position}`,`vue-flow__handle-${e.id}`,(0,o.unref)(w),(0,o.unref)(m),n.value,{connectable:lA.value,connecting:sA.value,connectablestart:V.value,connectableend:b.value,connectionindicator:lA.value&&(V.value&&!K.value||b.value&&K.value)}]]),onMousedown:oA,onTouchstartPassive:oA,onClick:iA},[(0,o.renderSlot)(AA.$slots,"default",{id:AA.id})],42,kB))}}),Kr=function({sourcePosition:e=IA.Bottom,targetPosition:A=IA.Top,label:t,connectable:n=!0,isValidTargetPos:r,isValidSourcePos:a,data:u}){const d=u.label??t;return[(0,o.h)(nn,{type:"target",position:A,connectable:n,isValidConnection:r}),typeof d!="string"&&d?(0,o.h)(d):(0,o.h)(o.Fragment,[d]),(0,o.h)(nn,{type:"source",position:e,connectable:n,isValidConnection:a})]};Kr.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Kr.inheritAttrs=!1,Kr.compatConfig={MODE:3};var MB=Kr,Rr=function({targetPosition:e=IA.Top,label:A,connectable:t=!0,isValidTargetPos:n,data:r}){const a=r.label??A;return[(0,o.h)(nn,{type:"target",position:e,connectable:t,isValidConnection:n}),typeof a!="string"&&a?(0,o.h)(a):(0,o.h)(o.Fragment,[a])]};Rr.props=["targetPosition","label","isValidTargetPos","connectable","data"],Rr.inheritAttrs=!1,Rr.compatConfig={MODE:3};var OB=Rr,Vr=function({sourcePosition:e=IA.Bottom,label:A,connectable:t=!0,isValidSourcePos:n,data:r}){const a=r.label??A;return[typeof a!="string"&&a?(0,o.h)(a):(0,o.h)(o.Fragment,[a]),(0,o.h)(nn,{type:"source",position:e,connectable:t,isValidConnection:n})]};Vr.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Vr.inheritAttrs=!1,Vr.compatConfig={MODE:3};var KB=Vr,RB=["transform"],VB=["width","height","x","y","rx","ry"],PB=["y"],GB=(0,o.defineComponent)({name:"EdgeText",compatConfig:{MODE:3},props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const A=(0,o.ref)({x:0,y:0,width:0,height:0}),t=(0,o.ref)(null),n=(0,o.computed)(()=>`translate(${e.x-A.value.width/2} ${e.y-A.value.height/2})`);(0,o.onMounted)(r),(0,o.watch)([()=>e.x,()=>e.y,t,()=>e.label],r);function r(){if(!t.value)return;const a=t.value.getBBox();(a.width!==A.value.width||a.height!==A.value.height)&&(A.value=a)}return(a,u)=>((0,o.openBlock)(),(0,o.createElementBlock)("g",{transform:n.value,class:"vue-flow__edge-textwrapper"},[a.labelShowBg?((0,o.openBlock)(),(0,o.createElementBlock)("rect",{key:0,class:"vue-flow__edge-textbg",width:`${A.value.width+2*a.labelBgPadding[0]}px`,height:`${A.value.height+2*a.labelBgPadding[1]}px`,x:-a.labelBgPadding[0],y:-a.labelBgPadding[1],style:(0,o.normalizeStyle)(a.labelBgStyle),rx:a.labelBgBorderRadius,ry:a.labelBgBorderRadius},null,12,VB)):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("text",(0,o.mergeProps)(a.$attrs,{ref_key:"el",ref:t,class:"vue-flow__edge-text",y:A.value.height/2,dy:"0.3em",style:a.labelStyle}),[(0,o.renderSlot)(a.$slots,"default",{},()=>[typeof a.label!="string"?((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)(a.label),{key:0})):((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:1},[(0,o.createTextVNode)((0,o.toDisplayString)(a.label),1)],64))])],16,PB)],8,RB))}}),zB=["id","d","marker-end","marker-start"],XB=["d","stroke-width"],Gn=(0,o.defineComponent)({name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3},props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:A}){const t=(0,o.ref)(null),n=(0,o.ref)(null),r=(0,o.ref)(null),a=(0,o.useAttrs)();return A({pathEl:t,interactionEl:n,labelEl:r}),(u,d)=>((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,[(0,o.createElementVNode)("path",(0,o.mergeProps)((0,o.unref)(a),{id:u.id,ref_key:"pathEl",ref:t,d:u.path,class:"vue-flow__edge-path","marker-end":u.markerEnd,"marker-start":u.markerStart}),null,16,zB),u.interactionWidth?((0,o.openBlock)(),(0,o.createElementBlock)("path",{key:0,ref_key:"interactionEl",ref:n,fill:"none",d:u.path,"stroke-width":u.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,XB)):(0,o.createCommentVNode)("",!0),u.label&&u.labelX&&u.labelY?((0,o.openBlock)(),(0,o.createBlock)(GB,{key:1,ref_key:"labelEl",ref:r,x:u.labelX,y:u.labelY,label:u.label,"label-show-bg":u.labelShowBg,"label-bg-style":u.labelBgStyle,"label-bg-padding":u.labelBgPadding,"label-bg-border-radius":u.labelBgBorderRadius,"label-style":u.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):(0,o.createCommentVNode)("",!0)],64))}});function il({sourceX:e,sourceY:A,targetX:t,targetY:n}){const r=Math.abs(t-e)/2,a=t<e?t+r:t-r,u=Math.abs(n-A)/2;return[a,n<A?n+u:n-u,r,u]}function sl({sourceX:e,sourceY:A,targetX:t,targetY:n,sourceControlX:r,sourceControlY:a,targetControlX:u,targetControlY:d}){const h=e*.125+r*.375+u*.375+t*.125,g=A*.125+a*.375+d*.375+n*.125;return[h,g,Math.abs(h-e),Math.abs(g-A)]}function Pr(e,A){return e>=0?.5*e:A*25*Math.sqrt(-e)}function al({pos:e,x1:A,y1:t,x2:n,y2:r,c:a}){let u,d;switch(e){case IA.Left:u=A-Pr(A-n,a),d=t;break;case IA.Right:u=A+Pr(n-A,a),d=t;break;case IA.Top:u=A,d=t-Pr(t-r,a);break;case IA.Bottom:u=A,d=t+Pr(r-t,a);break}return[u,d]}function Fi(e){const{sourceX:A,sourceY:t,sourcePosition:n=IA.Bottom,targetX:r,targetY:a,targetPosition:u=IA.Top,curvature:d=.25}=e,[h,g]=al({pos:n,x1:A,y1:t,x2:r,y2:a,c:d}),[B,w]=al({pos:u,x1:r,y1:a,x2:A,y2:t,c:d}),[m,v,y,I]=sl({sourceX:A,sourceY:t,targetX:r,targetY:a,sourceControlX:h,sourceControlY:g,targetControlX:B,targetControlY:w});return[`M${A},${t} C${h},${g} ${B},${w} ${r},${a}`,m,v,y,I]}function ll({pos:e,x1:A,y1:t,x2:n,y2:r}){let a,u;switch(e){case IA.Left:case IA.Right:a=.5*(A+n),u=t;break;case IA.Top:case IA.Bottom:a=A,u=.5*(t+r);break}return[a,u]}function cl(e){const{sourceX:A,sourceY:t,sourcePosition:n=IA.Bottom,targetX:r,targetY:a,targetPosition:u=IA.Top}=e,[d,h]=ll({pos:n,x1:A,y1:t,x2:r,y2:a}),[g,B]=ll({pos:u,x1:r,y1:a,x2:A,y2:t}),[w,m,v,y]=sl({sourceX:A,sourceY:t,targetX:r,targetY:a,sourceControlX:d,sourceControlY:h,targetControlX:g,targetControlY:B});return[`M${A},${t} C${d},${h} ${g},${B} ${r},${a}`,w,m,v,y]}var ul={[IA.Left]:{x:-1,y:0},[IA.Right]:{x:1,y:0},[IA.Top]:{x:0,y:-1},[IA.Bottom]:{x:0,y:1}};function $B({source:e,sourcePosition:A=IA.Bottom,target:t}){return A===IA.Left||A===IA.Right?e.x<t.x?{x:1,y:0}:{x:-1,y:0}:e.y<t.y?{x:0,y:1}:{x:0,y:-1}}function dl(e,A){return Math.sqrt((A.x-e.x)**2+(A.y-e.y)**2)}function YB({source:e,sourcePosition:A=IA.Bottom,target:t,targetPosition:n=IA.Top,center:r,offset:a}){const u=ul[A],d=ul[n],h={x:e.x+u.x*a,y:e.y+u.y*a},g={x:t.x+d.x*a,y:t.y+d.y*a},B=$B({source:h,sourcePosition:A,target:g}),w=B.x!==0?"x":"y",m=B[w];let v,y,I;const T={x:0,y:0},D={x:0,y:0},[V,b,K,sA]=il({sourceX:e.x,sourceY:e.y,targetX:t.x,targetY:t.y});if(u[w]*d[w]===-1){y=r.x??V,I=r.y??b;const W=[{x:y,y:h.y},{x:y,y:g.y}],cA=[{x:h.x,y:I},{x:g.x,y:I}];u[w]===m?v=w==="x"?W:cA:v=w==="x"?cA:W}else{const W=[{x:h.x,y:g.y}],cA=[{x:g.x,y:h.y}];if(w==="x"?v=u.x===m?cA:W:v=u.y===m?W:cA,A===n){const iA=Math.abs(e[w]-t[w]);if(iA<=a){const AA=Math.min(a-1,a-iA);u[w]===m?T[w]=(h[w]>e[w]?-1:1)*AA:D[w]=(g[w]>t[w]?-1:1)*AA}}if(A!==n){const iA=w==="x"?"y":"x",AA=u[w]===d[iA],S=h[iA]>g[iA],eA=h[iA]<g[iA];(u[w]===1&&(!AA&&S||AA&&eA)||u[w]!==1&&(!AA&&eA||AA&&S))&&(v=w==="x"?W:cA)}const lA={x:h.x+T.x,y:h.y+T.y},oA={x:g.x+D.x,y:g.y+D.y};Math.max(Math.abs(lA.x-v[0].x),Math.abs(oA.x-v[0].x))>=Math.max(Math.abs(lA.y-v[0].y),Math.abs(oA.y-v[0].y))?(y=(lA.x+oA.x)/2,I=v[0].y):(y=v[0].x,I=(lA.y+oA.y)/2)}return[[e,{x:h.x+T.x,y:h.y+T.y},...v,{x:g.x+D.x,y:g.y+D.y},t],y,I,K,sA]}function WB(e,A,t,n){const r=Math.min(dl(e,A)/2,dl(A,t)/2,n),{x:a,y:u}=A;if(e.x===a&&a===t.x||e.y===u&&u===t.y)return`L${a} ${u}`;if(e.y===u){const h=e.x<t.x?-1:1,g=e.y<t.y?1:-1;return`L ${a+r*h},${u}Q ${a},${u} ${a},${u+r*g}`}const d=e.x<t.x?1:-1;return`L ${a},${u+r*(e.y<t.y?-1:1)}Q ${a},${u} ${a+r*d},${u}`}function Ui(e){const{sourceX:A,sourceY:t,sourcePosition:n=IA.Bottom,targetX:r,targetY:a,targetPosition:u=IA.Top,borderRadius:d=5,centerX:h,centerY:g,offset:B=20}=e,[w,m,v,y,I]=YB({source:{x:A,y:t},sourcePosition:n,target:{x:r,y:a},targetPosition:u,center:{x:h,y:g},offset:B});return[w.reduce((T,D,V)=>{let b;return V>0&&V<w.length-1?b=WB(w[V-1],D,w[V+1],d):b=`${V===0?"M":"L"}${D.x} ${D.y}`,T+=b,T},""),m,v,y,I]}function JB(e){const{sourceX:A,sourceY:t,targetX:n,targetY:r}=e,[a,u,d,h]=il({sourceX:A,sourceY:t,targetX:n,targetY:r});return[`M ${A},${t}L ${n},${r}`,a,u,d,h]}var ZB=(0,o.defineComponent)({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:A}){return()=>{const[t,n,r]=JB(e);return(0,o.h)(Gn,{path:t,labelX:n,labelY:r,...A,...e})}}}),fl=(0,o.defineComponent)({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:A}){return()=>{const[t,n,r]=Ui({...e,sourcePosition:e.sourcePosition??IA.Bottom,targetPosition:e.targetPosition??IA.Top});return(0,o.h)(Gn,{path:t,labelX:n,labelY:r,...A,...e})}}}),jB=(0,o.defineComponent)({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:A}){return()=>(0,o.h)(fl,{...e,...A,borderRadius:0})}}),qB=(0,o.defineComponent)({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:A}){return()=>{const[t,n,r]=Fi({...e,sourcePosition:e.sourcePosition??IA.Bottom,targetPosition:e.targetPosition??IA.Top});return(0,o.h)(Gn,{path:t,labelX:n,labelY:r,...A,...e})}}}),Ap=(0,o.defineComponent)({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:A}){return()=>{const[t,n,r]=cl({...e,sourcePosition:e.sourcePosition??IA.Bottom,targetPosition:e.targetPosition??IA.Top});return(0,o.h)(Gn,{path:t,labelX:n,labelY:r,...A,...e})}}}),ep={input:KB,default:MB,output:OB},tp={default:qB,straight:ZB,step:jB,smoothstep:fl,simplebezier:Ap};function np(e,A,t){const n=(0,o.computed)(()=>y=>A.value.get(y)),r=(0,o.computed)(()=>y=>t.value.get(y)),a=(0,o.computed)(()=>{const y={...tp,...e.edgeTypes},I=Object.keys(y);for(const T of e.edges)T.type&&!I.includes(T.type)&&(y[T.type]=T.type);return y}),u=(0,o.computed)(()=>{const y={...ep,...e.nodeTypes},I=Object.keys(y);for(const T of e.nodes)T.type&&!I.includes(T.type)&&(y[T.type]=T.type);return y}),d=(0,o.computed)(()=>e.onlyRenderVisibleElements?Ha(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),h=(0,o.computed)(()=>{if(e.onlyRenderVisibleElements){const y=[];for(const I of e.edges){const T=A.value.get(I.source),D=A.value.get(I.target);sB({sourcePos:T.computedPosition||{x:0,y:0},targetPos:D.computedPosition||{x:0,y:0},sourceWidth:T.dimensions.width,sourceHeight:T.dimensions.height,targetWidth:D.dimensions.width,targetHeight:D.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&y.push(I)}return y}return e.edges}),g=(0,o.computed)(()=>[...d.value,...h.value]),B=(0,o.computed)(()=>{const y=[];for(const I of e.nodes)I.selected&&y.push(I);return y}),w=(0,o.computed)(()=>{const y=[];for(const I of e.edges)I.selected&&y.push(I);return y}),m=(0,o.computed)(()=>[...B.value,...w.value]),v=(0,o.computed)(()=>{const y=[];for(const I of e.nodes)I.dimensions.width&&I.dimensions.height&&I.handleBounds!==void 0&&y.push(I);return y});return{getNode:n,getEdge:r,getElements:g,getEdgeTypes:a,getNodeTypes:u,getEdges:h,getNodes:d,getSelectedElements:m,getSelectedNodes:B,getSelectedEdges:w,getNodesInitialized:v,areNodesInitialized:(0,o.computed)(()=>d.value.length>0&&v.value.length===d.value.length)}}var rp=class yn{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var A;const t=(A=(0,o.getCurrentInstance)())==null?void 0:A.appContext.app;return yn.instance=t?.config.globalProperties.$vueFlowStorage??yn.instance??new yn,t&&(t.config.globalProperties.$vueFlowStorage=yn.instance),yn.instance}set(A,t){return this.flows.set(A,t)}get(A){return this.flows.get(A)}remove(A){return this.flows.delete(A)}create(A,t){const n=(0,o.reactive)(ol()),r={};for(const[w,m]of Object.entries(n.hooks)){const v=`on${w.charAt(0).toUpperCase()+w.slice(1)}`;r[v]=m.on}const a={};for(const[w,m]of Object.entries(n.hooks))a[w]=m.trigger;const u=(0,o.computed)(()=>{const w=new Map;for(const m of n.nodes)w.set(m.id,m);return w}),d=(0,o.computed)(()=>{const w=new Map;for(const m of n.edges)w.set(m.id,m);return w}),h=np(n,u,d),g=TB(n,u,d);g.setState({...n,...t});const B={...r,...h,...g,...ed(n),nodeLookup:u,edgeLookup:d,emits:a,id:A,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(A)}};return this.set(A,B),B}getId(){return`vue-flow-${this.currentId++}`}};function XA(e){const A=rp.getInstance(),t=(0,o.getCurrentScope)(),n=typeof e=="object",r=n?e:{id:e},a=r.id,u=a??t?.vueFlowId;let d;if(t){const h=(0,o.inject)(ja,null);typeof h<"u"&&h!==null&&(!u||h.id===u)&&(d=h)}if(d||u&&(d=A.get(u)),!d||u&&d.id!==u){const h=a??A.getId(),g=A.create(h,r);d=g,(t??(0,o.effectScope)(!0)).run(()=>{(0,o.watch)(g.applyDefault,(B,w,m)=>{const v=I=>{g.applyNodeChanges(I)},y=I=>{g.applyEdgeChanges(I)};B?(g.onNodesChange(v),g.onEdgesChange(y)):(g.hooks.value.nodesChange.off(v),g.hooks.value.edgesChange.off(y)),m(()=>{g.hooks.value.nodesChange.off(v),g.hooks.value.edgesChange.off(y)})},{immediate:!0}),Fn(()=>{if(d){const B=A.get(d.id);B?B.$destroy():Pn(`No store instance found for id ${d.id} in storage.`)}})})}else n&&d.setState(r);if(t&&((0,o.provide)(ja,d),t.vueFlowId=d.id),n){const h=(0,o.getCurrentInstance)();h?.type.name!=="VueFlow"&&d.emits.error(new ce(ie.USEVUEFLOW_OPTIONS))}return d}function op(e){const{emits:A,dimensions:t}=XA();let n;(0,o.onMounted)(()=>{const r=()=>{var a,u;if(!e.value||!(((u=(a=e.value).checkVisibility)==null?void 0:u.call(a))??!0))return;const d=Dr(e.value);(d.width===0||d.height===0)&&A.error(new ce(ie.MISSING_VIEWPORT_DIMENSIONS)),t.value={width:d.width||500,height:d.height||500}};r(),window.addEventListener("resize",r),e.value&&(n=new ResizeObserver(()=>r()),n.observe(e.value)),(0,o.onBeforeUnmount)(()=>{window.removeEventListener("resize",r),n&&e.value&&n.unobserve(e.value)})})}var ip=(0,o.defineComponent)({name:"UserSelection",compatConfig:{MODE:3},props:{userSelectionRect:{}},setup(e){return(A,t)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:"vue-flow__selection vue-flow__container",style:(0,o.normalizeStyle)({width:`${A.userSelectionRect.width}px`,height:`${A.userSelectionRect.height}px`,transform:`translate(${A.userSelectionRect.x}px, ${A.userSelectionRect.y}px)`})},null,4))}}),sp=["tabIndex"],ap=(0,o.defineComponent)({name:"NodesSelection",compatConfig:{MODE:3},setup(e){const{emits:A,viewport:t,getSelectedNodes:n,noPanClassName:r,disableKeyboardA11y:a,userSelectionActive:u}=XA(),d=rl(),h=(0,o.ref)(null),g=el({el:h,onStart(y){A.selectionDragStart(y),A.nodeDragStart(y)},onDrag(y){A.selectionDrag(y),A.nodeDrag(y)},onStop(y){A.selectionDragStop(y),A.nodeDragStop(y)}});(0,o.onMounted)(()=>{var y;a.value||(y=h.value)==null||y.focus({preventScroll:!0})});const B=(0,o.computed)(()=>ba(n.value)),w=(0,o.computed)(()=>({width:`${B.value.width}px`,height:`${B.value.height}px`,top:`${B.value.y}px`,left:`${B.value.x}px`}));function m(y){A.selectionContextMenu({event:y,nodes:n.value})}function v(y){a.value||An[y.key]&&(y.preventDefault(),d({x:An[y.key].x,y:An[y.key].y},y.shiftKey))}return(y,I)=>!(0,o.unref)(u)&&B.value.width&&B.value.height?((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:0,class:(0,o.normalizeClass)(["vue-flow__nodesselection vue-flow__container",(0,o.unref)(r)]),style:(0,o.normalizeStyle)({transform:`translate(${(0,o.unref)(t).x}px,${(0,o.unref)(t).y}px) scale(${(0,o.unref)(t).zoom})`})},[(0,o.createElementVNode)("div",{ref_key:"el",ref:h,class:(0,o.normalizeClass)([{dragging:(0,o.unref)(g)},"vue-flow__nodesselection-rect"]),style:(0,o.normalizeStyle)(w.value),tabIndex:(0,o.unref)(a)?void 0:-1,onContextmenu:m,onKeydown:v},null,46,sp)],6)):(0,o.createCommentVNode)("",!0)}});function lp(e,A){return{x:e.clientX-A.left,y:e.clientY-A.top}}var cp=(0,o.defineComponent)({name:"Pane",compatConfig:{MODE:3},props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:A,nodes:t,viewport:n,emits:r,userSelectionActive:a,removeSelectedElements:u,userSelectionRect:d,elementsSelectable:h,nodesSelectionActive:g,getSelectedEdges:B,getSelectedNodes:w,removeNodes:m,removeEdges:v,selectionMode:y,deleteKeyCode:I,multiSelectionKeyCode:T,multiSelectionActive:D,edgeLookup:V,nodeLookup:b,connectionLookup:K,defaultEdgeOptions:sA,connectionStartHandle:W,panOnDrag:cA}=XA(),lA=(0,o.shallowRef)(null),oA=(0,o.shallowRef)(new Set),iA=(0,o.shallowRef)(new Set),AA=(0,o.shallowRef)(null),S=(0,o.toRef)(()=>h.value&&(e.isSelecting||a.value)),eA=(0,o.toRef)(()=>W.value!==null);let H=!1,X=!1;const U=Mn(I,{actInsideInputWithModifier:!1}),L=Mn(T);(0,o.watch)(U,nA=>{nA&&(m(w.value),v(B.value),g.value=!1)}),(0,o.watch)(L,nA=>{D.value=nA});function k(nA,Z){return $=>{$.target===Z&&nA?.($)}}function N(nA){if(H||eA.value){H=!1;return}r.paneClick(nA),u(),g.value=!1}function O(nA){var Z;if(Array.isArray(cA.value)&&((Z=cA.value)!=null&&Z.includes(2))){nA.preventDefault();return}r.paneContextMenu(nA)}function Y(nA){r.paneScroll(nA)}function tA(nA){var Z,$,uA;if(AA.value=((Z=A.value)==null?void 0:Z.getBoundingClientRect())??null,!h.value||!e.isSelecting||nA.button!==0||nA.target!==lA.value||!AA.value)return;(uA=($=nA.target)==null?void 0:$.setPointerCapture)==null||uA.call($,nA.pointerId);const{x:wA,y:QA}=lp(nA,AA.value);X=!0,H=!1,u(),d.value={width:0,height:0,startX:wA,startY:QA,x:wA,y:QA},r.selectionStart(nA)}function BA(nA){var Z;if(!AA.value||!d.value)return;H=!0;const{x:$,y:uA}=$e(nA,AA.value),{startX:wA=0,startY:QA=0}=d.value,SA={startX:wA,startY:QA,x:$<wA?$:wA,y:uA<QA?uA:QA,width:Math.abs($-wA),height:Math.abs(uA-QA)},fA=oA.value,J=iA.value;oA.value=new Set(Ha(t.value,SA,n.value,y.value===fi.Partial,!0).map(F=>F.id)),iA.value=new Set;const _=((Z=sA.value)==null?void 0:Z.selectable)??!0;for(const F of oA.value){const x=K.value.get(F);if(x)for(const{edgeId:G}of x.values()){const P=V.value.get(G);P&&(P.selectable??_)&&iA.value.add(G)}}if(!Za(fA,oA.value)){const F=pt(b.value,oA.value,!0);r.nodesChange(F)}if(!Za(J,iA.value)){const F=pt(V.value,iA.value);r.edgesChange(F)}d.value=SA,a.value=!0,g.value=!1}function HA(nA){var Z;nA.button!==0||!X||((Z=nA.target)==null||Z.releasePointerCapture(nA.pointerId),!a.value&&d.value&&nA.target===lA.value&&N(nA),a.value=!1,d.value=null,g.value=oA.value.size>0,r.selectionEnd(nA),e.selectionKeyPressed&&(H=!1),X=!1)}return(nA,Z)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"container",ref:lA,class:(0,o.normalizeClass)(["vue-flow__pane vue-flow__container",{selection:nA.isSelecting}]),onClick:Z[0]||(Z[0]=$=>S.value?void 0:k(N,lA.value)($)),onContextmenu:Z[1]||(Z[1]=$=>k(O,lA.value)($)),onWheelPassive:Z[2]||(Z[2]=$=>k(Y,lA.value)($)),onPointerenter:Z[3]||(Z[3]=$=>S.value?void 0:(0,o.unref)(r).paneMouseEnter($)),onPointerdown:Z[4]||(Z[4]=$=>S.value?tA($):(0,o.unref)(r).paneMouseMove($)),onPointermove:Z[5]||(Z[5]=$=>S.value?BA($):(0,o.unref)(r).paneMouseMove($)),onPointerup:Z[6]||(Z[6]=$=>S.value?HA($):void 0),onPointerleave:Z[7]||(Z[7]=$=>(0,o.unref)(r).paneMouseLeave($))},[(0,o.renderSlot)(nA.$slots,"default"),(0,o.unref)(a)&&(0,o.unref)(d)?((0,o.openBlock)(),(0,o.createBlock)(ip,{key:0,"user-selection-rect":(0,o.unref)(d)},null,8,["user-selection-rect"])):(0,o.createCommentVNode)("",!0),(0,o.unref)(g)&&(0,o.unref)(w).length?((0,o.openBlock)(),(0,o.createBlock)(ap,{key:1})):(0,o.createCommentVNode)("",!0)],34))}}),up=(0,o.defineComponent)({name:"Transform",compatConfig:{MODE:3},setup(e){const{viewport:A,fitViewOnInit:t,fitViewOnInitDone:n}=XA(),r=(0,o.computed)(()=>t.value?!n.value:!1),a=(0,o.computed)(()=>`translate(${A.value.x}px,${A.value.y}px) scale(${A.value.zoom})`);return(u,d)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:"vue-flow__transformationpane vue-flow__container",style:(0,o.normalizeStyle)({transform:a.value,opacity:r.value?0:void 0})},[(0,o.renderSlot)(u.$slots,"default")],4))}}),dp=(0,o.defineComponent)({name:"Viewport",compatConfig:{MODE:3},setup(e){const{minZoom:A,maxZoom:t,defaultViewport:n,translateExtent:r,zoomActivationKeyCode:a,selectionKeyCode:u,panActivationKeyCode:d,panOnScroll:h,panOnScrollMode:g,panOnScrollSpeed:B,panOnDrag:w,zoomOnDoubleClick:m,zoomOnPinch:v,zoomOnScroll:y,preventScrolling:I,noWheelClassName:T,noPanClassName:D,emits:V,connectionStartHandle:b,userSelectionActive:K,paneDragging:sA,d3Zoom:W,d3Selection:cA,d3ZoomHandler:lA,viewport:oA,viewportRef:iA,paneClickDistance:AA}=XA();op(iA);const S=(0,o.shallowRef)(!1),eA=(0,o.shallowRef)(!1);let H=null,X=!1,U=0,L={x:0,y:0,zoom:0};const k=Mn(d),N=Mn(u),O=Mn(a),Y=(0,o.toRef)(()=>(!N.value||N.value&&u.value===!0)&&(k.value||w.value)),tA=(0,o.toRef)(()=>k.value||h.value),BA=(0,o.toRef)(()=>u.value===!0&&Y.value!==!0),HA=(0,o.toRef)(()=>N.value&&u.value!==!0||K.value||BA.value),nA=(0,o.toRef)(()=>b.value!==null);(0,o.onMounted)(()=>{if(!iA.value){Pn("Viewport element is missing");return}const QA=iA.value,SA=QA.getBoundingClientRect(),fA=Kh().clickDistance(AA.value).scaleExtent([A.value,t.value]).translateExtent(r.value),J=Te(QA).call(fA),_=J.on("wheel.zoom"),F=qt.translate(n.value.x??0,n.value.y??0).scale(Tt(n.value.zoom??1,A.value,t.value)),x=[[0,0],[SA.width,SA.height]],G=fA.constrain()(F,x,r.value);fA.transform(J,G),fA.wheelDelta(xa),W.value=fA,cA.value=J,lA.value=_,oA.value={x:G.x,y:G.y,zoom:G.k},fA.on("start",P=>{var dA;if(!P.sourceEvent)return null;U=P.sourceEvent.button,S.value=!0;const gA=uA(P.transform);((dA=P.sourceEvent)==null?void 0:dA.type)==="mousedown"&&(sA.value=!0),L=gA,V.viewportChangeStart(gA),V.moveStart({event:P,flowTransform:gA})}),fA.on("end",P=>{if(!P.sourceEvent)return null;if(S.value=!1,sA.value=!1,Z(Y.value,U??0)&&!X&&V.paneContextMenu(P.sourceEvent),X=!1,$(L,P.transform)){const dA=uA(P.transform);L=dA,V.viewportChangeEnd(dA),V.moveEnd({event:P,flowTransform:dA})}}),fA.filter(P=>{var dA;const gA=O.value||y.value,EA=v.value&&P.ctrlKey,FA=P.button,NA=P.type==="wheel";if(FA===1&&P.type==="mousedown"&&(wA(P,"vue-flow__node")||wA(P,"vue-flow__edge")))return!0;if(!Y.value&&!gA&&!tA.value&&!m.value&&!v.value||K.value||nA.value&&!NA||!m.value&&P.type==="dblclick"||wA(P,T.value)&&NA||wA(P,D.value)&&(!NA||tA.value&&NA&&!O.value)||!v.value&&P.ctrlKey&&NA||!gA&&!tA.value&&!EA&&NA)return!1;if(!v&&P.type==="touchstart"&&((dA=P.touches)==null?void 0:dA.length)>1)return P.preventDefault(),!1;if(!Y.value&&(P.type==="mousedown"||P.type==="touchstart")||BA.value&&Array.isArray(w.value)&&w.value.includes(0)&&FA===0||Array.isArray(w.value)&&!w.value.includes(FA)&&(P.type==="mousedown"||P.type==="touchstart"))return!1;const OA=Array.isArray(w.value)&&w.value.includes(FA)||u.value===!0&&Array.isArray(w.value)&&!w.value.includes(0)||!FA||FA<=1;return(!P.ctrlKey||k.value||NA)&&OA}),(0,o.watch)([K,Y],()=>{K.value&&!S.value?fA.on("zoom",null):K.value||fA.on("zoom",P=>{oA.value={x:P.transform.x,y:P.transform.y,zoom:P.transform.k};const dA=uA(P.transform);X=Z(Y.value,U??0),V.viewportChange(dA),V.move({event:P,flowTransform:dA})})},{immediate:!0}),(0,o.watch)([K,tA,g,O,v,I,T],()=>{tA.value&&!O.value&&!K.value?J.on("wheel.zoom",P=>{if(wA(P,T.value))return!1;const dA=O.value||y.value,gA=v.value&&P.ctrlKey;if(!(!I.value||tA.value||dA||gA))return!1;P.preventDefault(),P.stopImmediatePropagation();const EA=J.property("__zoom").k||1,FA=Lr();if(!k.value&&P.ctrlKey&&v.value&&FA){const qA=Pe(P),it=EA*2**xa(P);fA.scaleTo(J,it,qA,P);return}const NA=P.deltaMode===1?20:1;let OA=g.value===kn.Vertical?0:P.deltaX*NA,KA=g.value===kn.Horizontal?0:P.deltaY*NA;!FA&&P.shiftKey&&g.value!==kn.Vertical&&!OA&&KA&&(OA=KA,KA=0),fA.translateBy(J,-(OA/EA)*B.value,-(KA/EA)*B.value);const ee=uA(J.property("__zoom"));H&&clearTimeout(H),eA.value?(V.move({event:P,flowTransform:ee}),V.viewportChange(ee),H=setTimeout(()=>{V.moveEnd({event:P,flowTransform:ee}),V.viewportChangeEnd(ee),eA.value=!1},150)):(eA.value=!0,V.moveStart({event:P,flowTransform:ee}),V.viewportChangeStart(ee))},{passive:!1}):typeof _<"u"&&J.on("wheel.zoom",function(P,dA){const gA=!I.value&&P.type==="wheel"&&!P.ctrlKey,EA=O.value||y.value,FA=v.value&&P.ctrlKey;if(!EA&&!h.value&&!FA&&P.type==="wheel"||gA||wA(P,T.value))return null;P.preventDefault(),_.call(this,P,dA)},{passive:!1})},{immediate:!0})});function Z(QA,SA){return SA===2&&Array.isArray(QA)&&QA.includes(2)}function $(QA,SA){return QA.x!==SA.x&&!Number.isNaN(SA.x)||QA.y!==SA.y&&!Number.isNaN(SA.y)||QA.zoom!==SA.k&&!Number.isNaN(SA.k)}function uA(QA){return{x:QA.x,y:QA.y,zoom:QA.k}}function wA(QA,SA){return QA.target.closest(`.${SA}`)}return(QA,SA)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref_key:"viewportRef",ref:iA,class:"vue-flow__viewport vue-flow__container"},[(0,o.createVNode)(cp,{"is-selecting":HA.value,"selection-key-pressed":(0,o.unref)(N),class:(0,o.normalizeClass)({connecting:nA.value,dragging:(0,o.unref)(sA),draggable:(0,o.unref)(w)===!0||Array.isArray((0,o.unref)(w))&&(0,o.unref)(w).includes(0)})},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(up,null,{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(QA.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),fp=["id"],gp=["id"],hp=["id"],Bp=(0,o.defineComponent)({name:"A11yDescriptions",compatConfig:{MODE:3},setup(e){const{id:A,disableKeyboardA11y:t,ariaLiveMessage:n}=XA();return(r,a)=>((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,[(0,o.createElementVNode)("div",{id:`${(0,o.unref)(ma)}-${(0,o.unref)(A)}`,style:{display:"none"}}," Press enter or space to select a node. "+(0,o.toDisplayString)((0,o.unref)(t)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,fp),(0,o.createElementVNode)("div",{id:`${(0,o.unref)(wa)}-${(0,o.unref)(A)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,gp),(0,o.unref)(t)?(0,o.createCommentVNode)("",!0):((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:0,id:`${(0,o.unref)(Xh)}-${(0,o.unref)(A)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},(0,o.toDisplayString)((0,o.unref)(n)),9,hp))],64))}});function pp(){const e=XA();(0,o.watch)(()=>e.viewportHelper.value.viewportInitialized,A=>{A&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function mp(e,A,t){return t===IA.Left?e-A:t===IA.Right?e+A:e}function wp(e,A,t){return t===IA.Top?e-A:t===IA.Bottom?e+A:e}var bi=function({radius:e=10,centerX:A=0,centerY:t=0,position:n=IA.Top,type:r}){return(0,o.h)("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${r}`,cx:mp(A,e,n),cy:wp(t,e,n),r:e,stroke:"transparent",fill:"transparent"})};bi.props=["radius","centerX","centerY","position","type"],bi.compatConfig={MODE:3};var gl=bi,Cp=(0,o.defineComponent)({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:A,addSelectedEdges:t,connectionMode:n,edgeUpdaterRadius:r,emits:a,nodesSelectionActive:u,noPanClassName:d,getEdgeTypes:h,removeSelectedEdges:g,findEdge:B,findNode:w,isValidConnection:m,multiSelectionActive:v,disableKeyboardA11y:y,elementsSelectable:I,edgesUpdatable:T,edgesFocusable:D,hooks:V}=XA(),b=(0,o.computed)(()=>B(e.id)),{emit:K,on:sA}=QB(b.value,a),W=(0,o.inject)(kr),cA=(0,o.getCurrentInstance)(),lA=(0,o.ref)(!1),oA=(0,o.ref)(!1),iA=(0,o.ref)(""),AA=(0,o.ref)(null),S=(0,o.ref)("source"),eA=(0,o.ref)(null),H=(0,o.toRef)(()=>typeof b.value.selectable>"u"?I.value:b.value.selectable),X=(0,o.toRef)(()=>typeof b.value.updatable>"u"?T.value:b.value.updatable),U=(0,o.toRef)(()=>typeof b.value.focusable>"u"?D.value:b.value.focusable);(0,o.provide)(CB,e.id),(0,o.provide)(vB,eA);const L=(0,o.computed)(()=>b.value.class instanceof Function?b.value.class(b.value):b.value.class),k=(0,o.computed)(()=>b.value.style instanceof Function?b.value.style(b.value):b.value.style),N=(0,o.computed)(()=>{const F=b.value.type||"default",x=W?.[`edge-${F}`];if(x)return x;let G=b.value.template??h.value[F];if(typeof G=="string"&&cA){const P=Object.keys(cA.appContext.components);P&&P.includes(F)&&(G=(0,o.resolveComponent)(F,!1))}return G&&typeof G!="string"?G:(a.error(new ce(ie.EDGE_TYPE_MISSING,G)),!1)}),{handlePointerDown:O}=tl({nodeId:iA,handleId:AA,type:S,isValidConnection:m,edgeUpdaterType:S,onEdgeUpdate:BA,onEdgeUpdateEnd:HA});return()=>{const F=w(b.value.source),x=w(b.value.target),G="pathOptions"in b.value?b.value.pathOptions:{};if(!F&&!x)return a.error(new ce(ie.EDGE_SOURCE_TARGET_MISSING,b.value.id,b.value.source,b.value.target)),null;if(!F)return a.error(new ce(ie.EDGE_SOURCE_MISSING,b.value.id,b.value.source)),null;if(!x)return a.error(new ce(ie.EDGE_TARGET_MISSING,b.value.id,b.value.target)),null;if(!b.value||b.value.hidden||F.hidden||x.hidden)return null;let P;n.value===nt.Strict?P=F.handleBounds.source:P=[...F.handleBounds.source||[],...F.handleBounds.target||[]];const dA=Va(P,b.value.sourceHandle);let gA;n.value===nt.Strict?gA=x.handleBounds.target:gA=[...x.handleBounds.target||[],...x.handleBounds.source||[]];const EA=Va(gA,b.value.targetHandle),FA=dA?.position||IA.Bottom,NA=EA?.position||IA.Top,{x:OA,y:KA}=tn(F,dA,FA),{x:ee,y:qA}=tn(x,EA,NA);return b.value.sourceX=OA,b.value.sourceY=KA,b.value.targetX=ee,b.value.targetY=qA,(0,o.h)("g",{ref:eA,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${N.value===!1?"default":b.value.type||"default"}`,d.value,L.value,{updating:lA.value,selected:b.value.selected,animated:b.value.animated,inactive:!H.value&&!V.value.edgeClick.hasListeners()}],tabIndex:U.value?0:void 0,"aria-label":b.value.ariaLabel===null?void 0:b.value.ariaLabel??`Edge from ${b.value.source} to ${b.value.target}`,"aria-describedby":U.value?`${wa}-${A}`:void 0,"aria-roledescription":"edge",role:U.value?"group":"img",...b.value.domAttributes,onClick:Z,onContextmenu:$,onDblclick:uA,onMouseenter:wA,onMousemove:QA,onMouseleave:SA,onKeyDown:U.value?_:void 0},[oA.value?null:(0,o.h)(N.value===!1?h.value.default:N.value,{id:e.id,sourceNode:F,targetNode:x,source:b.value.source,target:b.value.target,type:b.value.type,updatable:X.value,selected:b.value.selected,animated:b.value.animated,label:b.value.label,labelStyle:b.value.labelStyle,labelShowBg:b.value.labelShowBg,labelBgStyle:b.value.labelBgStyle,labelBgPadding:b.value.labelBgPadding,labelBgBorderRadius:b.value.labelBgBorderRadius,data:b.value.data,events:{...b.value.events,...sA},style:k.value,markerStart:`url('#${Vn(b.value.markerStart,A)}')`,markerEnd:`url('#${Vn(b.value.markerEnd,A)}')`,sourcePosition:FA,targetPosition:NA,sourceX:OA,sourceY:KA,targetX:ee,targetY:qA,sourceHandleId:b.value.sourceHandle,targetHandleId:b.value.targetHandle,interactionWidth:b.value.interactionWidth,...G}),[X.value==="source"||X.value===!0?[(0,o.h)("g",{onMousedown:fA,onMouseenter:Y,onMouseout:tA},(0,o.h)(gl,{position:FA,centerX:OA,centerY:KA,radius:r.value,type:"source","data-type":"source"}))]:null,X.value==="target"||X.value===!0?[(0,o.h)("g",{onMousedown:J,onMouseenter:Y,onMouseout:tA},(0,o.h)(gl,{position:NA,centerX:ee,centerY:qA,radius:r.value,type:"target","data-type":"target"}))]:null]])};function Y(){lA.value=!0}function tA(){lA.value=!1}function BA(F,x){K.update({event:F,edge:b.value,connection:x})}function HA(F){K.updateEnd({event:F,edge:b.value}),oA.value=!1}function nA(F,x){F.button===0&&(oA.value=!0,iA.value=x?b.value.target:b.value.source,AA.value=(x?b.value.targetHandle:b.value.sourceHandle)??null,S.value=x?"target":"source",K.updateStart({event:F,edge:b.value}),O(F))}function Z(F){var x;const G={event:F,edge:b.value};H.value&&(u.value=!1,b.value.selected&&v.value?(g([b.value]),(x=eA.value)==null||x.blur()):t([b.value])),K.click(G)}function $(F){K.contextMenu({event:F,edge:b.value})}function uA(F){K.doubleClick({event:F,edge:b.value})}function wA(F){K.mouseEnter({event:F,edge:b.value})}function QA(F){K.mouseMove({event:F,edge:b.value})}function SA(F){K.mouseLeave({event:F,edge:b.value})}function fA(F){nA(F,!0)}function J(F){nA(F,!1)}function _(F){var x;!y.value&&Ca.includes(F.key)&&H.value&&(F.key==="Escape"?((x=eA.value)==null||x.blur(),g([B(e.id)])):t([B(e.id)]))}}}),vp=(0,o.defineComponent)({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:A,connectionMode:t,connectionStartHandle:n,connectionEndHandle:r,connectionPosition:a,connectionLineType:u,connectionLineStyle:d,connectionLineOptions:h,connectionStatus:g,viewport:B,findNode:w}=XA(),m=(e=(0,o.inject)(kr))==null?void 0:e["connection-line"],v=(0,o.computed)(()=>{var V;return w((V=n.value)==null?void 0:V.nodeId)}),y=(0,o.computed)(()=>{var V;return w((V=r.value)==null?void 0:V.nodeId)??null}),I=(0,o.computed)(()=>({x:(a.value.x-B.value.x)/B.value.zoom,y:(a.value.y-B.value.y)/B.value.zoom})),T=(0,o.computed)(()=>h.value.markerStart?`url(#${Vn(h.value.markerStart,A)})`:""),D=(0,o.computed)(()=>h.value.markerEnd?`url(#${Vn(h.value.markerEnd,A)})`:"");return()=>{var V,b,K;if(!v.value||!n.value)return null;const sA=n.value.id,W=n.value.type,cA=v.value.handleBounds;let lA=cA?.[W]??[];if(t.value===nt.Loose){const k=cA?.[W==="source"?"target":"source"]??[];lA=[...lA,...k]}if(!lA)return null;const oA=(sA?lA.find(k=>k.id===sA):lA[0])??null,iA=oA?.position??IA.Top,{x:AA,y:S}=tn(v.value,oA,iA);let eA=null;y.value&&(t.value===nt.Strict?eA=((V=y.value.handleBounds[W==="source"?"target":"source"])==null?void 0:V.find(k=>{var N;return k.id===((N=r.value)==null?void 0:N.id)}))||null:eA=((b=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:b.find(k=>{var N;return k.id===((N=r.value)==null?void 0:N.id)}))||null);const H=((K=r.value)==null?void 0:K.position)??(iA?Ci[iA]:null);if(!iA||!H)return null;const X=u.value??h.value.type??Lt.Bezier;let U="";const L={sourceX:AA,sourceY:S,sourcePosition:iA,targetX:I.value.x,targetY:I.value.y,targetPosition:H};return X===Lt.Bezier?[U]=Fi(L):X===Lt.Step?[U]=Ui({...L,borderRadius:0}):X===Lt.SmoothStep?[U]=Ui(L):X===Lt.SimpleBezier?[U]=cl(L):U=`M${AA},${S} ${I.value.x},${I.value.y}`,(0,o.h)("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},(0,o.h)("g",{class:"vue-flow__connection"},m?(0,o.h)(m,{sourceX:AA,sourceY:S,sourcePosition:iA,targetX:I.value.x,targetY:I.value.y,targetPosition:H,sourceNode:v.value,sourceHandle:oA,targetNode:y.value,targetHandle:eA,markerEnd:D.value,markerStart:T.value,connectionStatus:g.value}):(0,o.h)("path",{d:U,class:[h.value.class,g.value,"vue-flow__connection-path"],style:{...d.value,...h.value.style},"marker-end":D.value,"marker-start":T.value})))}}}),yp=["id","markerWidth","markerHeight","markerUnits","orient"],Qp=(0,o.defineComponent)({name:"MarkerType",compatConfig:{MODE:3},props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(A,t)=>((0,o.openBlock)(),(0,o.createElementBlock)("marker",{id:A.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${A.width}`,markerHeight:`${A.height}`,markerUnits:A.markerUnits,orient:A.orient},[A.type===(0,o.unref)(rt).ArrowClosed?((0,o.openBlock)(),(0,o.createElementBlock)("polyline",{key:0,style:(0,o.normalizeStyle)({stroke:A.color,fill:A.color,strokeWidth:A.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):(0,o.createCommentVNode)("",!0),A.type===(0,o.unref)(rt).Arrow?((0,o.openBlock)(),(0,o.createElementBlock)("polyline",{key:1,style:(0,o.normalizeStyle)({stroke:A.color,strokeWidth:A.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):(0,o.createCommentVNode)("",!0)],8,yp))}}),Ep={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},Fp=(0,o.defineComponent)({name:"MarkerDefinitions",compatConfig:{MODE:3},setup(e){const{id:A,edges:t,connectionLineOptions:n,defaultMarkerColor:r}=XA(),a=(0,o.computed)(()=>{const u=new Set,d=[],h=g=>{if(g){const B=Vn(g,A);u.has(B)||(typeof g=="object"?d.push({...g,id:B,color:g.color||r.value}):d.push({id:B,color:r.value,type:g}),u.add(B))}};for(const g of[n.value.markerEnd,n.value.markerStart])h(g);for(const g of t.value)for(const B of[g.markerStart,g.markerEnd])h(B);return d.sort((g,B)=>g.id.localeCompare(B.id))});return(u,d)=>((0,o.openBlock)(),(0,o.createElementBlock)("svg",Ep,[(0,o.createElementVNode)("defs",null,[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(a.value,h=>((0,o.openBlock)(),(0,o.createBlock)(Qp,{id:h.id,key:h.id,type:h.type,color:h.color,width:h.width,height:h.height,markerUnits:h.markerUnits,"stroke-width":h.strokeWidth,orient:h.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),Up=(0,o.defineComponent)({name:"Edges",compatConfig:{MODE:3},setup(e){const{findNode:A,getEdges:t,elevateEdgesOnSelect:n}=XA();return(r,a)=>((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,[(0,o.createVNode)(Fp),((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)((0,o.unref)(t),u=>((0,o.openBlock)(),(0,o.createElementBlock)("svg",{key:u.id,class:"vue-flow__edges vue-flow__container",style:(0,o.normalizeStyle)({zIndex:(0,o.unref)(aB)(u,(0,o.unref)(A),(0,o.unref)(n))})},[(0,o.createVNode)((0,o.unref)(Cp),{id:u.id},null,8,["id"])],4))),128)),(0,o.createVNode)((0,o.unref)(vp))],64))}}),bp=(0,o.defineComponent)({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:A,noPanClassName:t,selectNodesOnDrag:n,nodesSelectionActive:r,multiSelectionActive:a,emits:u,removeSelectedNodes:d,addSelectedNodes:h,updateNodeDimensions:g,onUpdateNodeInternals:B,getNodeTypes:w,nodeExtent:m,elevateNodesOnSelect:v,disableKeyboardA11y:y,ariaLiveMessage:I,snapToGrid:T,snapGrid:D,nodeDragThreshold:V,nodesDraggable:b,elementsSelectable:K,nodesConnectable:sA,nodesFocusable:W,hooks:cA}=XA(),lA=(0,o.ref)(null);(0,o.provide)(Al,lA),(0,o.provide)(qa,e.id);const oA=(0,o.inject)(kr),iA=(0,o.getCurrentInstance)(),AA=rl(),{node:S,parentNode:eA}=nl(e.id),{emit:H,on:X}=bB(S,u),U=(0,o.toRef)(()=>typeof S.draggable>"u"?b.value:S.draggable),L=(0,o.toRef)(()=>typeof S.selectable>"u"?K.value:S.selectable),k=(0,o.toRef)(()=>typeof S.connectable>"u"?sA.value:S.connectable),N=(0,o.toRef)(()=>typeof S.focusable>"u"?W.value:S.focusable),O=(0,o.computed)(()=>L.value||U.value||cA.value.nodeClick.hasListeners()||cA.value.nodeDoubleClick.hasListeners()||cA.value.nodeMouseEnter.hasListeners()||cA.value.nodeMouseMove.hasListeners()||cA.value.nodeMouseLeave.hasListeners()),Y=(0,o.toRef)(()=>!!S.dimensions.width&&!!S.dimensions.height),tA=(0,o.computed)(()=>{const x=S.type||"default",G=oA?.[`node-${x}`];if(G)return G;let P=S.template||w.value[x];if(typeof P=="string"&&iA){const dA=Object.keys(iA.appContext.components);dA&&dA.includes(x)&&(P=(0,o.resolveComponent)(x,!1))}return P&&typeof P!="string"?P:(u.error(new ce(ie.NODE_TYPE_MISSING,P)),!1)}),BA=el({id:e.id,el:lA,disabled:()=>!U.value,selectable:L,dragHandle:()=>S.dragHandle,onStart(x){H.dragStart(x)},onDrag(x){H.drag(x)},onStop(x){H.dragStop(x)},onClick(x){_(x)}}),HA=(0,o.computed)(()=>S.class instanceof Function?S.class(S):S.class),nA=(0,o.computed)(()=>{const x=(S.style instanceof Function?S.style(S):S.style)||{},G=S.width instanceof Function?S.width(S):S.width,P=S.height instanceof Function?S.height(S):S.height;return!x.width&&G&&(x.width=typeof G=="string"?G:`${G}px`),!x.height&&P&&(x.height=typeof P=="string"?P:`${P}px`),x}),Z=(0,o.toRef)(()=>Number(S.zIndex??nA.value.zIndex??0));return B(x=>{(x.includes(e.id)||!x.length)&&uA()}),(0,o.onMounted)(()=>{(0,o.watch)(()=>S.hidden,(x=!1,G,P)=>{!x&&lA.value&&(e.resizeObserver.observe(lA.value),P(()=>{lA.value&&e.resizeObserver.unobserve(lA.value)}))},{immediate:!0,flush:"post"})}),(0,o.watch)([()=>S.type,()=>S.sourcePosition,()=>S.targetPosition],()=>{(0,o.nextTick)(()=>{g([{id:e.id,nodeElement:lA.value,forceUpdate:!0}])})}),(0,o.watch)([()=>S.position.x,()=>S.position.y,()=>{var x;return(x=eA.value)==null?void 0:x.computedPosition.x},()=>{var x;return(x=eA.value)==null?void 0:x.computedPosition.y},()=>{var x;return(x=eA.value)==null?void 0:x.computedPosition.z},Z,()=>S.selected,()=>S.dimensions.height,()=>S.dimensions.width,()=>{var x;return(x=eA.value)==null?void 0:x.dimensions.height},()=>{var x;return(x=eA.value)==null?void 0:x.dimensions.width}],([x,G,P,dA,gA,EA])=>{const FA={x,y:G,z:EA+(v.value&&S.selected?1e3:0)};typeof P<"u"&&typeof dA<"u"?S.computedPosition=tB({x:P,y:dA,z:gA},FA):S.computedPosition=FA},{flush:"post",immediate:!0}),(0,o.watch)([()=>S.extent,m],([x,G],[P,dA])=>{(x!==P||G!==dA)&&$()}),S.extent==="parent"||typeof S.extent=="object"&&"range"in S.extent&&S.extent.range==="parent"?Xo(()=>Y).toBe(!0).then($):$(),()=>S.hidden?null:(0,o.h)("div",{ref:lA,"data-id":S.id,class:["vue-flow__node",`vue-flow__node-${tA.value===!1?"default":S.type||"default"}`,{[t.value]:U.value,dragging:BA?.value,draggable:U.value,selected:S.selected,selectable:L.value,parent:S.isParent},HA.value],style:{visibility:Y.value?"visible":"hidden",zIndex:S.computedPosition.z??Z.value,transform:`translate(${S.computedPosition.x}px,${S.computedPosition.y}px)`,pointerEvents:O.value?"all":"none",...nA.value},tabIndex:N.value?0:void 0,role:N.value?"group":void 0,"aria-describedby":y.value?void 0:`${ma}-${A}`,"aria-label":S.ariaLabel,"aria-roledescription":"node",...S.domAttributes,onMouseenter:wA,onMousemove:QA,onMouseleave:SA,onContextmenu:fA,onClick:_,onDblclick:J,onKeydown:F},[(0,o.h)(tA.value===!1?w.value.default:tA.value,{id:S.id,type:S.type,data:S.data,events:{...S.events,...X},selected:S.selected,resizing:S.resizing,dragging:BA.value,connectable:k.value,position:S.computedPosition,dimensions:S.dimensions,isValidTargetPos:S.isValidTargetPos,isValidSourcePos:S.isValidSourcePos,parent:S.parentNode,parentNodeId:S.parentNode,zIndex:S.computedPosition.z??Z.value,targetPosition:S.targetPosition,sourcePosition:S.sourcePosition,label:S.label,dragHandle:S.dragHandle,onUpdateNodeInternals:uA})]);function $(){const x=S.computedPosition,{computedPosition:G,position:P}=pi(S,T.value?Tr(x,D.value):x,u.error,m.value,eA.value);(S.computedPosition.x!==G.x||S.computedPosition.y!==G.y)&&(S.computedPosition={...S.computedPosition,...G}),(S.position.x!==P.x||S.position.y!==P.y)&&(S.position=P)}function uA(){lA.value&&g([{id:e.id,nodeElement:lA.value,forceUpdate:!0}])}function wA(x){BA?.value||H.mouseEnter({event:x,node:S})}function QA(x){BA?.value||H.mouseMove({event:x,node:S})}function SA(x){BA?.value||H.mouseLeave({event:x,node:S})}function fA(x){return H.contextMenu({event:x,node:S})}function J(x){return H.doubleClick({event:x,node:S})}function _(x){L.value&&(!n.value||!U.value||V.value>0)&&vi(S,a.value,h,d,r,!1,lA.value),H.click({event:x,node:S})}function F(x){if(!(gi(x)||y.value))if(Ca.includes(x.key)&&L.value){const G=x.key==="Escape";vi(S,a.value,h,d,r,G,lA.value)}else U.value&&S.selected&&An[x.key]&&(x.preventDefault(),I.value=`Moved selected node ${x.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~S.position.x}, y: ${~~S.position.y}`,AA({x:An[x.key].x,y:An[x.key].y},x.shiftKey))}}}),Hp={height:"0",width:"0"},Ip=(0,o.defineComponent)({name:"EdgeLabelRenderer",compatConfig:{MODE:3},setup(e){const{viewportRef:A}=XA(),t=(0,o.toRef)(()=>{var n;return(n=A.value)==null?void 0:n.getElementsByClassName("vue-flow__edge-labels")[0]});return(n,r)=>((0,o.openBlock)(),(0,o.createElementBlock)("svg",null,[((0,o.openBlock)(),(0,o.createElementBlock)("foreignObject",Hp,[((0,o.openBlock)(),(0,o.createBlock)(o.Teleport,{to:t.value,disabled:!t.value},[(0,o.renderSlot)(n.$slots,"default")],8,["to","disabled"]))]))]))}});function _p(e={includeHiddenNodes:!1}){const{nodes:A}=XA();return(0,o.computed)(()=>{if(A.value.length===0)return!1;for(const t of A.value)if((e.includeHiddenNodes||!t.hidden)&&(t?.handleBounds===void 0||t.dimensions.width===0||t.dimensions.height===0))return!1;return!0})}var Sp={class:"vue-flow__nodes vue-flow__container"},xp=(0,o.defineComponent)({name:"Nodes",compatConfig:{MODE:3},setup(e){const{getNodes:A,updateNodeDimensions:t,emits:n}=XA(),r=_p(),a=(0,o.ref)();return(0,o.watch)(r,u=>{u&&(0,o.nextTick)(()=>{n.nodesInitialized(A.value)})},{immediate:!0}),(0,o.onMounted)(()=>{a.value=new ResizeObserver(u=>{const d=u.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));(0,o.nextTick)(()=>t(d))})}),(0,o.onBeforeUnmount)(()=>{var u;return(u=a.value)==null?void 0:u.disconnect()}),(u,d)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",Sp,[a.value?((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,{key:0},(0,o.renderList)((0,o.unref)(A),(h,g,B,w)=>{const m=[h.id];if(w&&w.key===h.id&&(0,o.isMemoSame)(w,m))return w;const v=((0,o.openBlock)(),(0,o.createBlock)((0,o.unref)(bp),{id:h.id,key:h.id,"resize-observer":a.value},null,8,["id","resize-observer"]));return v.memo=m,v},d,0),128)):(0,o.createCommentVNode)("",!0)]))}});function Dp(){const{emits:e}=XA();(0,o.onMounted)(()=>{if($a()){const A=document.querySelector(".vue-flow__pane");A&&window.getComputedStyle(A).zIndex!=="1"&&e.error(new ce(ie.MISSING_STYLES))}})}var Np=(0,o.createElementVNode)("div",{class:"vue-flow__edge-labels"},null,-1),Lp=(0,o.defineComponent)({name:"VueFlow",compatConfig:{MODE:3},props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:A,emit:t}){const n=e,r=(0,o.useSlots)(),a=$o(n,"modelValue",t),u=$o(n,"nodes",t),d=$o(n,"edges",t),h=XA(n),g=SB({modelValue:a,nodes:u,edges:d},n,h);return DB(t,h.hooks),pp(),Dp(),(0,o.provide)(kr,r),(0,o.onUnmounted)(g),A(h),(B,w)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{ref:(0,o.unref)(h).vueFlowRef,class:"vue-flow"},[(0,o.createVNode)(dp,null,{default:(0,o.withCtx)(()=>[(0,o.createVNode)(Up),Np,(0,o.createVNode)(xp),(0,o.renderSlot)(B.$slots,"zoom-pane")]),_:3}),(0,o.renderSlot)(B.$slots,"default"),(0,o.createVNode)(Bp)],512))}}),Tp=(0,o.defineComponent)({name:"Panel",compatConfig:{MODE:3},props:{position:{}},setup(e){const A=e,{userSelectionActive:t}=XA(),n=(0,o.computed)(()=>`${A.position}`.split("-"));return(r,a)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:(0,o.normalizeClass)(["vue-flow__panel",n.value]),style:(0,o.normalizeStyle)({pointerEvents:(0,o.unref)(t)?"none":"all"})},[(0,o.renderSlot)(r.$slots,"default")],6))}}),ot=(e=>(e.Lines="lines",e.Dots="dots",e))(ot||{}),kp=function({dimensions:e,size:A,color:t}){return(0,o.h)("path",{stroke:t,"stroke-width":A,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},Mp=function({radius:e,color:A}){return(0,o.h)("circle",{cx:e,cy:e,r:e,fill:A})};ot.Lines,ot.Dots;var Op={[ot.Dots]:"#81818a",[ot.Lines]:"#eee"},Kp=["id","x","y","width","height","patternTransform"],Rp={key:2,height:"100",width:"100"},Vp=["fill"],Pp=["x","y","fill"],Gp=(0,o.defineComponent)({name:"Background",compatConfig:{MODE:3},props:{id:{},variant:{default:()=>ot.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:A,viewport:t}=XA(),n=(0,o.computed)(()=>{const u=t.value.zoom,[d,h]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],g=[d*u||1,h*u||1],B=e.size*u,[w,m]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset];return{scaledGap:g,offset:[w*u||1+g[0]/2,m*u||1+g[1]/2],size:B}}),r=(0,o.toRef)(()=>`pattern-${A}${e.id?`-${e.id}`:""}`),a=(0,o.toRef)(()=>e.color||e.patternColor||Op[e.variant||ot.Dots]);return(u,d)=>((0,o.openBlock)(),(0,o.createElementBlock)("svg",{class:"vue-flow__background vue-flow__container",style:(0,o.normalizeStyle)({height:`${u.height>100?100:u.height}%`,width:`${u.width>100?100:u.width}%`})},[(0,o.renderSlot)(u.$slots,"pattern-container",{id:r.value},()=>[(0,o.createElementVNode)("pattern",{id:r.value,x:(0,o.unref)(t).x%n.value.scaledGap[0],y:(0,o.unref)(t).y%n.value.scaledGap[1],width:n.value.scaledGap[0],height:n.value.scaledGap[1],patternTransform:`translate(-${n.value.offset[0]},-${n.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[(0,o.renderSlot)(u.$slots,"pattern",{},()=>[u.variant===(0,o.unref)(ot).Lines?((0,o.openBlock)(),(0,o.createBlock)((0,o.unref)(kp),{key:0,size:u.lineWidth,color:a.value,dimensions:n.value.scaledGap},null,8,["size","color","dimensions"])):u.variant===(0,o.unref)(ot).Dots?((0,o.openBlock)(),(0,o.createBlock)((0,o.unref)(Mp),{key:1,color:a.value,radius:n.value.size/2},null,8,["color","radius"])):(0,o.createCommentVNode)("",!0),u.bgColor?((0,o.openBlock)(),(0,o.createElementBlock)("svg",Rp,[(0,o.createElementVNode)("rect",{width:"100%",height:"100%",fill:u.bgColor},null,8,Vp)])):(0,o.createCommentVNode)("",!0)])],8,Kp)]),(0,o.createElementVNode)("rect",{x:u.x,y:u.y,width:"100%",height:"100%",fill:`url(#${r.value})`},null,8,Pp),(0,o.renderSlot)(u.$slots,"default",{id:r.value})],4))}}),zp={name:"ControlButton",compatConfig:{MODE:3}},Xp=(e,A)=>{const t=e.__vccOpts||e;for(const[n,r]of A)t[n]=r;return t},$p={type:"button",class:"vue-flow__controls-button"};function Yp(e,A,t,n,r,a){return(0,o.openBlock)(),(0,o.createElementBlock)("button",$p,[(0,o.renderSlot)(e.$slots,"default")])}var Gr=Xp(zp,[["render",Yp]]),Wp={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Jp=[(0,o.createElementVNode)("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function Zp(e,A){return(0,o.openBlock)(),(0,o.createElementBlock)("svg",Wp,Jp)}var jp={render:Zp},qp={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},Am=[(0,o.createElementVNode)("path",{d:"M0 0h32v4.2H0z"},null,-1)];function em(e,A){return(0,o.openBlock)(),(0,o.createElementBlock)("svg",qp,Am)}var tm={render:em},nm={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},rm=[(0,o.createElementVNode)("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function om(e,A){return(0,o.openBlock)(),(0,o.createElementBlock)("svg",nm,rm)}var im={render:om},sm={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},am=[(0,o.createElementVNode)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function lm(e,A){return(0,o.openBlock)(),(0,o.createElementBlock)("svg",sm,am)}var cm={render:lm},um={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},dm=[(0,o.createElementVNode)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function fm(e,A){return(0,o.openBlock)(),(0,o.createElementBlock)("svg",um,dm)}var gm={render:fm},hm=(0,o.defineComponent)({name:"Controls",compatConfig:{MODE:3},props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>Ba.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:A}){const{nodesDraggable:t,nodesConnectable:n,elementsSelectable:r,setInteractive:a,zoomIn:u,zoomOut:d,fitView:h,viewport:g,minZoom:B,maxZoom:w}=XA(),m=(0,o.toRef)(()=>t.value||n.value||r.value),v=(0,o.toRef)(()=>g.value.zoom<=B.value),y=(0,o.toRef)(()=>g.value.zoom>=w.value);function I(){u(),A("zoomIn")}function T(){d(),A("zoomOut")}function D(){h(e.fitViewParams),A("fitView")}function V(){a(!m.value),A("interactionChange",!m.value)}return(b,K)=>((0,o.openBlock)(),(0,o.createBlock)((0,o.unref)(Tp),{class:"vue-flow__controls",position:b.position},{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(b.$slots,"top"),b.showZoom?((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:0},[(0,o.renderSlot)(b.$slots,"control-zoom-in",{},()=>[(0,o.createVNode)(Gr,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:I},{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(b.$slots,"icon-zoom-in",{},()=>[((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)((0,o.unref)(jp))))])]),_:3},8,["disabled"])]),(0,o.renderSlot)(b.$slots,"control-zoom-out",{},()=>[(0,o.createVNode)(Gr,{class:"vue-flow__controls-zoomout",disabled:v.value,onClick:T},{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(b.$slots,"icon-zoom-out",{},()=>[((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)((0,o.unref)(tm))))])]),_:3},8,["disabled"])])],64)):(0,o.createCommentVNode)("",!0),b.showFitView?(0,o.renderSlot)(b.$slots,"control-fit-view",{key:1},()=>[(0,o.createVNode)(Gr,{class:"vue-flow__controls-fitview",onClick:D},{default:(0,o.withCtx)(()=>[(0,o.renderSlot)(b.$slots,"icon-fit-view",{},()=>[((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)((0,o.unref)(im))))])]),_:3})]):(0,o.createCommentVNode)("",!0),b.showInteractive?(0,o.renderSlot)(b.$slots,"control-interactive",{key:2},()=>[b.showInteractive?((0,o.openBlock)(),(0,o.createBlock)(Gr,{key:0,class:"vue-flow__controls-interactive",onClick:V},{default:(0,o.withCtx)(()=>[m.value?(0,o.renderSlot)(b.$slots,"icon-unlock",{key:0},()=>[((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)((0,o.unref)(gm))))]):(0,o.createCommentVNode)("",!0),m.value?(0,o.createCommentVNode)("",!0):(0,o.renderSlot)(b.$slots,"icon-lock",{key:1},()=>[((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)((0,o.unref)(cm))))])]),_:3})):(0,o.createCommentVNode)("",!0)]):(0,o.createCommentVNode)("",!0),(0,o.renderSlot)(b.$slots,"default")]),_:3},8,["position"]))}}),Bm=["onClick"],pm={class:"d-flow-node-menus-item-name"},mm=(0,o.defineComponent)({name:"DNodeMenus",__name:"nodeMenus",props:{fromNodeId:{},handleId:{}},emits:["addNode"],setup(e,{emit:A}){const t=e,n=A,r=(0,o.inject)("d_flow_design_provide",{}),a=r.getFlowComponents?.()||[],u=d=>{n("addNode",d.type),(0,o.nextTick)(()=>{t.handleId==="line"?r.addNodeByLine?.(d.type,t.fromNodeId||""):r.addNode?.(d.type,t.fromNodeId||"",t.handleId||"")})};return(d,h)=>{const g=(0,o.resolveComponent)("j-icon");return(0,o.openBlock)(),(0,o.createElementBlock)("div",{class:"d-flow-node-menus",onClick:(0,o.withModifiers)(()=>{},["stop"])},[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)((0,o.unref)(a),(B,w)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:w,class:"d-flow-node-menus-item",onClick:m=>u(B)},[(0,o.createElementVNode)("div",{class:"d-flow-node-menus-item-icon",style:(0,o.normalizeStyle)({backgroundColor:B.iconColor||"var(--j-color-primary)"})},[(0,o.createVNode)(g,{icon:B.icon||"mdi:source-branch"},null,8,["icon"])],4),(0,o.createElementVNode)("div",pm,(0,o.toDisplayString)(B.name),1)],8,Bm))),128))])}}}),Hi=mm,wm={class:"d-flow-step-name"},Cm={key:0,style:{color:"var(--j-color-text-2)"}},vm={style:{color:"var(--j-color-text)"}},ym=(0,o.defineComponent)({name:"DStepNode",__name:"stepNode",props:{id:{},data:{}},setup(e){const A=e,{onNodeClick:t,onEdgeClick:n,onMoveStart:r,onConnectStart:a,onNodeDragStart:u,removeNodes:d,getEdges:h,getNodes:g,onNodesChange:B}=XA(),w=(0,o.inject)("d_flow_design_provide",{}),m=(0,o.computed)(()=>w.getFlowComponentMap?.value?.[A.data.type]||{}),v=()=>{d(A.id),w.onRemoveNode?.(A.id)},y=(0,o.ref)({});B(eA=>{if(A.data.isInit&&eA.findIndex(H=>H.type==="select"&&H.id===A.id&&H.id==="start"&&H.selected)!==-1){const H=g.value.find(X=>X.id==="start");H&&(H.data.isInit=!1),y.value.s1=!0}});const I=(0,o.ref)(!1),T=eA=>{eA.indexOf("t")!==-1&&!D.value||(I.value=!0,y.value[eA]=!0)},D=(0,o.computed)(()=>h.value.findIndex(eA=>eA.target===A.id)===-1),V=(0,o.ref)(!1),b=()=>{V.value=!0},K=(eA,H)=>{if(h.value.find(U=>U.source===H&&U.target===eA))return!0;const X=h.value.filter(U=>U.target===eA);for(let U=0;U<X.length;U++)if(K(X[U].source,H))return!0;return!1},sA=eA=>V.value?(V.value=!1,!1):K(eA.source,eA.target)?!1:eA.source!==eA.target&&eA.sourceHandle!==eA.targetHandle&&eA.sourceHandle.indexOf("s")!==-1&&eA.targetHandle.indexOf("t")!==-1,W=()=>{AA(),Object.keys(y.value).forEach(eA=>{y.value[eA]=!1})},cA=()=>{W()};t(()=>{console.log("onNodeClick"),I.value?I.value=!1:W()}),n(()=>{W()}),r(()=>{W()}),a(()=>{W()}),u(()=>{W()});const lA=(0,o.ref)(),oA=(0,o.ref)({top:0,left:0,bottom:0,right:0}),iA=(0,o.ref)({getBoundingClientRect:()=>oA.value}),AA=()=>{lA.value?.handleClose()},S=eA=>{const{clientX:H,clientY:X}=eA;oA.value=DOMRect.fromRect({x:H,y:X}),eA.preventDefault(),lA.value?.handleOpen()};return(eA,H)=>{const X=(0,o.resolveComponent)("j-icon"),U=(0,o.resolveComponent)("el-popover"),L=(0,o.resolveComponent)("el-tooltip"),k=(0,o.resolveComponent)("el-dropdown-item"),N=(0,o.resolveComponent)("el-dropdown-menu"),O=(0,o.resolveComponent)("el-dropdown");return(0,o.openBlock)(),(0,o.createElementBlock)("div",{class:"d-flow-step",onContextmenu:(0,o.withModifiers)(S,["stop"])},[(0,o.createElementVNode)("div",{class:"d-flow-step-icon",style:(0,o.normalizeStyle)({backgroundColor:m.value.iconColor||"var(--j-color-primary)"})},[(0,o.createVNode)(X,{icon:m.value.icon||"mdi:source-branch"},null,8,["icon"])],4),(0,o.createElementVNode)("div",wm,(0,o.toDisplayString)(m.value.name),1),e.data.type!=="start"?((0,o.openBlock)(),(0,o.createBlock)(L,{key:0,placement:"top","show-arrow":!1,"popper-class":"d-flow-step-tooltip"},{content:(0,o.withCtx)(()=>[D.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",Cm,[...H[4]||(H[4]=[(0,o.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"点击",-1),(0,o.createTextVNode)("添加节点 ",-1)])])):(0,o.createCommentVNode)("",!0),H[5]||(H[5]=(0,o.createElementVNode)("div",{style:{color:"var(--j-color-text-2)"}},[(0,o.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"拖拽"),(0,o.createTextVNode)("连接节点 ")],-1))]),default:(0,o.withCtx)(()=>[(0,o.createVNode)((0,o.unref)(nn),{onClick:H[1]||(H[1]=Y=>T("t1")),onMousedown:b,id:"t1",class:(0,o.normalizeClass)(["d-flow-step-target-handle",{"d-flow-step-target-handle-notadd":!D.value}]),type:"target",position:(0,o.unref)(IA).Left,"is-valid-connection":sA},{default:(0,o.withCtx)(()=>[D.value?((0,o.openBlock)(),(0,o.createBlock)(U,{key:0,visible:y.value.t1,"onUpdate:visible":H[0]||(H[0]=Y=>y.value.t1=Y),placement:"left","popper-class":"d-flow-step-popper",trigger:"click","show-arrow":!1,"popper-options":{strategy:"fixed"}},{reference:(0,o.withCtx)(()=>[(0,o.createVNode)(X,{class:"d-flow-step-handle-plus",icon:"mdi:plus-circle"})]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(Hi,{"handle-id":"t1","from-node-id":e.id,onAddNode:cA},null,8,["from-node-id"])]),_:1},8,["visible"])):(0,o.createCommentVNode)("",!0)]),_:1},8,["class","position"])]),_:1})):(0,o.createCommentVNode)("",!0),(0,o.createVNode)(L,{placement:"top","show-arrow":!1,"popper-class":"d-flow-step-tooltip"},{content:(0,o.withCtx)(()=>[...H[6]||(H[6]=[(0,o.createElementVNode)("div",{style:{color:"var(--j-color-text-2)"}},[(0,o.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"点击"),(0,o.createTextVNode)("添加节点 ")],-1),(0,o.createElementVNode)("div",{style:{color:"var(--j-color-text-2)"}},[(0,o.createElementVNode)("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"拖拽"),(0,o.createTextVNode)("连接节点 ")],-1)])]),default:(0,o.withCtx)(()=>[(0,o.createVNode)((0,o.unref)(nn),{onClick:H[3]||(H[3]=Y=>T("s1")),onMousedown:b,id:"s1",class:"d-flow-step-source-handle",type:"source",position:(0,o.unref)(IA).Right,"is-valid-connection":sA},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(U,{visible:y.value.s1,"onUpdate:visible":H[2]||(H[2]=Y=>y.value.s1=Y),placement:"right",trigger:"click","popper-class":"d-flow-step-popper","show-arrow":!1,"popper-options":{strategy:"fixed"}},{reference:(0,o.withCtx)(()=>[(0,o.createVNode)(X,{class:"d-flow-step-handle-plus",icon:"mdi:plus-circle"})]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(Hi,{"handle-id":"s1","from-node-id":e.id,onAddNode:cA},null,8,["from-node-id"])]),_:1},8,["visible"])]),_:1},8,["position"])]),_:1}),(0,o.createVNode)(O,{ref_key:"dropdownRef",ref:lA,"popper-class":"d-flow-step-dropdown","virtual-ref":iA.value,"show-arrow":!1,"popper-options":{modifiers:[{name:"offset",options:{offset:[0,0]}}]},"virtual-triggering":"",trigger:"contextmenu",placement:"bottom-start"},{dropdown:(0,o.withCtx)(()=>[(0,o.createVNode)(N,null,{default:(0,o.withCtx)(()=>[e.data.type!="start"?((0,o.openBlock)(),(0,o.createBlock)(k,{key:0,onClick:v},{default:(0,o.withCtx)(()=>[...H[7]||(H[7]=[(0,o.createTextVNode)("删除",-1)])]),_:1})):(0,o.createCommentVNode)("",!0),m.value.des?((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:1,style:(0,o.normalizeStyle)({width:"160px",padding:"4px 16px 0 16px","font-size":"12px","border-top":e.data.type!="start"?"1px solid var(--j-color-border)":void 0,"margin-top":e.data.type!="start"?"4px":void 0})},[H[8]||(H[8]=(0,o.createElementVNode)("div",{style:{"margin-bottom":"4px",color:"var(--j-color-text-2)"}},"关于",-1)),(0,o.createElementVNode)("div",vm,(0,o.toDisplayString)(m.value.des),1)],4)):(0,o.createCommentVNode)("",!0)]),_:1})]),_:1},8,["virtual-ref"])],32)}}}),Qm=ym,Em=(0,o.defineComponent)({name:"DEdgeWithButton",__name:"edgeWithButton",props:{id:{},sourceX:{},sourceY:{},targetX:{},targetY:{},sourcePosition:{},targetPosition:{},markerEnd:{},style:{}},setup(e){const A=e,{onEdgeMouseEnter:t,onEdgeMouseLeave:n,onNodeClick:r,onEdgeClick:a,onMoveStart:u,onConnectStart:d,onNodeDragStart:h}=XA(),g=(0,o.computed)(()=>Fi(A)),B=(0,o.ref)(!1),w=(0,o.ref)(!1);t(({edge:T})=>{T.id===A.id&&(B.value=!0)}),n(()=>{B.value=!1});const m=(0,o.ref)(!1),v=()=>{m.value=!1,(0,o.nextTick)(()=>{w.value=!1})},y=()=>{w.value=!0,m.value=!0},I=()=>{v()};return r(()=>{v()}),a(()=>{v()}),u(()=>{v()}),d(()=>{v()}),h(()=>{v()}),(T,D)=>{const V=(0,o.resolveComponent)("j-icon"),b=(0,o.resolveComponent)("el-popover");return(0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,null,[(0,o.createVNode)((0,o.unref)(Gn),{id:e.id,style:(0,o.normalizeStyle)(e.style),path:g.value[0],"marker-end":e.markerEnd},null,8,["id","style","path","marker-end"]),(0,o.createVNode)((0,o.unref)(Ip),null,{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",{style:(0,o.normalizeStyle)({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${g.value[1]}px,${g.value[2]}px)`}),class:"nodrag nopan"},[(0,o.createVNode)(b,{visible:m.value,"show-arrow":!1,placement:"right","popper-class":"d-flow-step-popper"},{reference:(0,o.withCtx)(()=>[(0,o.withDirectives)((0,o.createElementVNode)("div",{onClick:(0,o.withModifiers)(y,["stop"]),class:"d-flow-edge-button"},[(0,o.createVNode)(V,{icon:"mdi:plus-circle"})],512),[[o.vShow,B.value||w.value]])]),default:(0,o.withCtx)(()=>[(0,o.createVNode)(Hi,{"handle-id":"line","from-node-id":e.id,onAddNode:I},null,8,["from-node-id"])]),_:1},8,["visible"])],4)]),_:1})],64)}}}),Fm=Em,Um=(0,o.defineComponent)({name:"DFlow",__name:"flow",props:{nodes:{default:()=>[]},edges:{default:()=>[]}},setup(e){return(A,t)=>((0,o.openBlock)(),(0,o.createBlock)((0,o.unref)(Lp),{"min-zoom":.2,"max-zoom":4,"default-viewport":{zoom:1},"connection-mode":(0,o.unref)(nt).Strict,nodes:e.nodes,edges:e.edges},{"edge-button":(0,o.withCtx)(n=>[(0,o.createVNode)(Fm,{id:n.id,"source-x":n.sourceX,"source-y":n.sourceY,"target-x":n.targetX,"target-y":n.targetY,"source-position":n.sourcePosition,"target-position":n.targetPosition,"marker-end":n.markerEnd,style:(0,o.normalizeStyle)(n.style)},null,8,["id","source-x","source-y","target-x","target-y","source-position","target-position","marker-end","style"])]),"node-step":(0,o.withCtx)(n=>[(0,o.createVNode)(Qm,(0,o.normalizeProps)((0,o.guardReactiveProps)(n)),null,16)]),default:(0,o.withCtx)(()=>[(0,o.createVNode)((0,o.unref)(hm),{position:"bottom-left"}),(0,o.createVNode)((0,o.unref)(Gp))]),_:1},8,["connection-mode","nodes","edges"]))}}),bm=Um,Hm={class:"d-flow-design"},Im={class:"d-flow-design-canvas"},_m={class:"d-flow-design-right"},Sm={class:"d-flow-design-title"},xm={class:"d-flow-design-title-name"},Dm={class:"d-flow-design-panel"},Nm=(0,o.defineComponent)({name:"DFlowDesign",__name:"flowDesign",props:{components:{default:()=>[]},inputParams:{default:()=>({})},flowInit:{},flowComponentConfigInit:{},flowComponentConfigs:{default:()=>({})},flowComponentConfigChange:{}},emits:["nodeClick","edgeClick","paneClick","connect"],setup(e,{expose:A,emit:t}){const n=e,r=t,{addNodes:a,addEdges:u,removeEdges:d,addSelectedNodes:h,removeSelectedNodes:g,onConnect:B,onNodeClick:w,onPaneClick:m,onEdgeClick:v,getNodes:y,getEdges:I}=XA(),T=(0,o.computed)(()=>{const N={};return n.components.forEach(O=>{N[O.type]=O}),N.start={name:"开始",type:"start",icon:"ant-design:play-circle-outlined",des:"执行开始节点"},N}),D={id:"start",type:"step",data:{type:"start",isInit:!1},position:{x:80,y:160}},V=(0,o.ref)([D]),b=(0,o.ref)([]),K=(N,O)=>{if(O.indexOf("t")===-1){const Y=I.value.filter(tA=>tA.source===N.id);if(Y.length>0){let tA=-1e6,BA=0;return Y.forEach(HA=>{tA=Math.max(tA,HA.targetNode.position.y+HA.targetNode.dimensions.height+32),BA=HA.targetNode.position.x||0}),{x:BA,y:tA}}return{x:N.position.x+N.dimensions.width+100,y:N.position.y}}return{x:N.position.x-100-N.dimensions.width,y:N.position.y}},sA=(N,O,Y)=>{const tA=y.value.find(HA=>HA.id===O);if(!tA)return;const BA={id:gt(),type:"step",data:{type:N},position:K(tA,Y)};if(n.flowInit){const HA=n.flowInit(BA.data.type);HA&&Object.keys(HA).forEach(nA=>{BA.data[nA]=HA[nA]})}a(BA),Y.indexOf("t")===-1?u({id:`${O}-${BA.id}`,source:O,target:BA.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:rt.Arrow}):u({id:`${O}-${BA.id}`,source:BA.id,target:O,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:rt.Arrow}),S(BA.id)},W=N=>{const O=y.value.find(Y=>Y.id===N);O&&(O.position.x+=100+O.dimensions.width,I.value.filter(Y=>Y.source===N).forEach(Y=>{W(Y.target)}))},cA=(N,O)=>{const Y=I.value.find(BA=>BA.id===O);if(!Y)return;const tA={id:gt(),type:"step",data:{type:N},position:{x:Y.targetNode.position.x,y:Y.targetNode.position.y}};if(n.flowInit){const BA=n.flowInit(tA.data.type);BA&&Object.keys(BA).forEach(HA=>{tA.data[HA]=BA[HA]})}a(tA),u({id:`${Y.sourceNode.id}-${tA.id}`,source:Y.sourceNode.id,target:tA.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:rt.Arrow}),u({id:`${tA.id}-${Y.targetNode.id}`,source:tA.id,target:Y.targetNode.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:rt.Arrow}),d(O),W(Y.target),S(tA.id)};B(N=>{console.log("onConnect",N),N.type="button",N.markerEnd=rt.Arrow,u(N),r("connect",N)});const lA=()=>n.components||[],oA=(0,o.ref)(),iA=(0,o.computed)(()=>oA.value?T.value[oA.value.data.type]:void 0);w(N=>{oA.value?.id!==N.node.id&&(oA.value=N.node,X()),r("nodeClick",N.node)}),m(()=>{oA.value=void 0,r("paneClick")}),v(N=>{oA.value=void 0,r("edgeClick",N.edge)});const AA=N=>{oA.value?.id===N&&(oA.value=void 0)},S=N=>{oA.value&&g([oA.value]),oA.value=y.value.find(O=>O.id===N),oA.value&&(X(),setTimeout(()=>{oA.value&&h([oA.value])},100))},eA=(0,o.ref)(),H={};Object.keys(n.flowComponentConfigs).forEach(N=>{const O={type:"j-collapse",config:{defaultValue:[]},children:[]};n.flowComponentConfigs[N].forEach((Y,tA)=>{const BA=`_collapse${tA}`;O.config?.defaultValue.push(BA),O.children?.push(Y)}),H[N]=[O]});const X=()=>{const N=H[oA.value?.data.type||""];N&&eA.value?(eA.value.init&&eA.value.init(N,oA.value?.data),n.flowComponentConfigInit&&n.flowComponentConfigInit({configRef:eA,inputParams:n.inputParams,components:y.value,configData:oA.value?.data})):eA.value&&eA.value.init&&eA.value.init([])},U=N=>{oA.value&&n.flowComponentConfigChange&&n.flowComponentConfigChange(oA.value.data.type,{configRef:eA,configData:oA.value.data,...N,isFlowNode:!0})};return(0,o.provide)("d_flow_design_provide",{getFlowComponents:lA,addNode:sA,addNodeByLine:cA,onRemoveNode:AA,getFlowComponentMap:T}),A({getData:()=>{const N=[];return y.value.forEach(O=>{N.push({config:O.data,id:O.id,position:O.position,type:O.type})}),I.value.forEach(O=>{N.push({id:O.id,source:O.source,target:O.target,sourceHandle:O.sourceHandle,targetHandle:O.targetHandle,type:"line",config:{},position:{x:0,y:0}})}),N},setData:N=>{if(!N||N.length===0)D.data.isInit=!0,V.value=[D],S(D.id);else{D.data.isInit=!1;const O=[],Y=[];N.forEach(tA=>{if(tA.type==="line")tA.type="button",tA.markerEnd=rt.Arrow,Y.push(tA);else{const BA={id:tA.id,type:tA.type,data:tA.config,position:tA.position};O.push(BA)}}),V.value=O,b.value=Y}}}),(N,O)=>{const Y=(0,o.resolveComponent)("j-icon"),tA=(0,o.resolveComponent)("j-form");return(0,o.openBlock)(),(0,o.createElementBlock)("div",Hm,[(0,o.createElementVNode)("div",Im,[(0,o.createVNode)(bm,{nodes:V.value,edges:b.value},null,8,["nodes","edges"])]),(0,o.withDirectives)((0,o.createElementVNode)("div",_m,[(0,o.createElementVNode)("div",Sm,[(0,o.createElementVNode)("div",{class:"d-flow-design-title-icon",style:(0,o.normalizeStyle)({backgroundColor:iA.value?.iconColor||"var(--j-color-primary)"})},[(0,o.createVNode)(Y,{icon:iA.value?.icon||"mdi:source-branch"},null,8,["icon"])],4),(0,o.createElementVNode)("div",xm,(0,o.toDisplayString)(iA.value?.name||""),1)]),(0,o.createElementVNode)("div",Dm,[(0,o.createVNode)(tA,{config:{labelPosition:"top"},style:{padding:"0"},ref_key:"configRef",ref:eA,onChange:U},null,512)])],512),[[o.vShow,oA.value&&H[oA.value.data.type]]])])}}}),Lm=Nm,hl=ft(Lm),Tm={class:"d-input-flow j-block"},km=(0,o.defineComponent)({name:"DInputFlow",__name:"inputFlow",props:{modelValue:{},type:{},btnText:{default:"事件"},title:{},size:{default:"default"},width:{default:1200},height:{default:800},beforeClose:{},flowComponents:{default:()=>[]},inputParams:{default:()=>({})},flowInit:{},flowComponentConfigInit:{},flowComponentConfigs:{default:()=>({})},flowComponentConfigChange:{}},emits:["update:modelValue","change"],setup(e,{emit:A}){const t=e,n=A,r=(0,o.ref)(),a=(0,o.computed)({get(){return t.modelValue},set(w){n("update:modelValue",w)}}),u=(0,o.computed)(()=>(t.modelValue?.trim(),t.btnText)),d=w=>{const m=typeof w=="string"?w:void 0;try{r.value?.setData(JSON.parse(m||"[]"))}catch{r.value?.setData([])}},h=async()=>{const w=r.value?.getData();return w?JSON.stringify(w):void 0},g=w=>{if(t.beforeClose){const m=typeof w=="string"?w:void 0;return t.beforeClose(m)}return!0},B=w=>{const m=w.value;n("change",{value:typeof m=="string"?m:void 0})};return(w,m)=>{const v=(0,o.resolveComponent)("d-flow-design"),y=(0,o.resolveComponent)("j-input-button");return(0,o.openBlock)(),(0,o.createBlock)(y,(0,o.mergeProps)(w.$attrs,{type:e.type,"btn-text":u.value,title:e.title,size:e.size,width:e.width,height:e.height,"before-close":g,ok:h,open:d,"destroy-on-close":"",modelValue:a.value,"onUpdate:modelValue":m[0]||(m[0]=I=>a.value=I),onChange:B}),{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",Tm,[(0,o.createVNode)(v,{ref_key:"flowRef",ref:r,components:e.flowComponents,"flow-init":e.flowInit,"flow-component-config-init":e.flowComponentConfigInit,"flow-component-configs":e.flowComponentConfigs,"flow-component-config-change":e.flowComponentConfigChange,"input-params":e.inputParams},null,8,["components","flow-init","flow-component-config-init","flow-component-configs","flow-component-config-change","input-params"])])]),_:1},16,["type","btn-text","title","size","width","height","modelValue"])}}}),Mm=km,Bl=ft(Mm),q=class Le{static getElements(A,t=document){if(typeof A=="string"){const n="getElementById"in t?t:void 0;if(n&&!isNaN(+A[0])){const a=n.getElementById(A);return a?[a]:[]}let r=t.querySelectorAll(A);if(!r.length&&A[0]!=="."&&A[0]!=="#"&&(r=t.querySelectorAll("."+A),r.length||(r=t.querySelectorAll("#"+A)),!r.length)){const a=t.querySelector(`[gs-id="${A}"]`);return a?[a]:[]}return Array.from(r)}return[A]}static getElement(A,t=document){if(typeof A=="string"){const n="getElementById"in t?t:void 0;if(!A.length)return null;if(n&&A[0]==="#")return n.getElementById(A.substring(1));if(A[0]==="#"||A[0]==="."||A[0]==="[")return t.querySelector(A);if(n&&!isNaN(+A[0]))return n.getElementById(A);let r=t.querySelector(A);return n&&!r&&(r=n.getElementById(A)),r||(r=t.querySelector("."+A)),r}return A}static lazyLoad(A){return A.lazyLoad||A.grid?.opts?.lazyLoad&&A.lazyLoad!==!1}static createDiv(A,t){const n=document.createElement("div");return A.forEach(r=>{r&&n.classList.add(r)}),t?.appendChild(n),n}static shouldSizeToContent(A,t=!1){return A?.grid&&(t?A.sizeToContent===!0||A.grid.opts.sizeToContent===!0&&A.sizeToContent===void 0:!!A.sizeToContent||A.grid.opts.sizeToContent&&A.sizeToContent!==!1)}static isIntercepted(A,t){return!(A.y>=t.y+t.h||A.y+A.h<=t.y||A.x+A.w<=t.x||A.x>=t.x+t.w)}static isTouching(A,t){return Le.isIntercepted(A,{x:t.x-.5,y:t.y-.5,w:t.w+1,h:t.h+1})}static areaIntercept(A,t){const n=A.x>t.x?A.x:t.x,r=A.x+A.w<t.x+t.w?A.x+A.w:t.x+t.w;if(r<=n)return 0;const a=A.y>t.y?A.y:t.y,u=A.y+A.h<t.y+t.h?A.y+A.h:t.y+t.h;return u<=a?0:(r-n)*(u-a)}static area(A){return A.w*A.h}static sort(A,t=1){return A.sort((r,a)=>{const u=t*((r.y??1e4)-(a.y??1e4));return u===0?t*((r.x??1e4)-(a.x??1e4)):u})}static find(A,t){return t?A.find(n=>n.id===t):void 0}static toBool(A){return typeof A=="boolean"?A:typeof A=="string"?(A=A.toLowerCase(),!(A===""||A==="no"||A==="false"||A==="0")):!!A}static toNumber(A){return A===null||A.length===0?void 0:Number(A)}static parseHeight(A){let t,n="px";if(typeof A=="string")if(A==="auto"||A==="")t=0;else{const r=A.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!r)throw new Error(`Invalid height val = ${A}`);n=r[2]||"px",t=parseFloat(r[1])}else t=A;return{h:t,unit:n}}static defaults(A,...t){return t.forEach(n=>{for(const r in n){if(!n.hasOwnProperty(r))return;A[r]===null||A[r]===void 0?A[r]=n[r]:typeof n[r]=="object"&&typeof A[r]=="object"&&Le.defaults(A[r],n[r])}}),A}static same(A,t){if(typeof A!="object")return A==t;if(typeof A!=typeof t||Object.keys(A).length!==Object.keys(t).length)return!1;for(const n in A)if(A[n]!==t[n])return!1;return!0}static copyPos(A,t,n=!1){return t.x!==void 0&&(A.x=t.x),t.y!==void 0&&(A.y=t.y),t.w!==void 0&&(A.w=t.w),t.h!==void 0&&(A.h=t.h),n&&(t.minW&&(A.minW=t.minW),t.minH&&(A.minH=t.minH),t.maxW&&(A.maxW=t.maxW),t.maxH&&(A.maxH=t.maxH)),A}static samePos(A,t){return A&&t&&A.x===t.x&&A.y===t.y&&(A.w||1)===(t.w||1)&&(A.h||1)===(t.h||1)}static sanitizeMinMax(A){A.minW||delete A.minW,A.minH||delete A.minH,A.maxW||delete A.maxW,A.maxH||delete A.maxH}static removeInternalAndSame(A,t){if(!(typeof A!="object"||typeof t!="object")&&!(Array.isArray(A)||Array.isArray(t)))for(let n in A){const r=A[n],a=t[n];n[0]==="_"||r===a?delete A[n]:r&&typeof r=="object"&&a!==void 0&&(Le.removeInternalAndSame(r,a),Object.keys(r).length||delete A[n])}}static removeInternalForSave(A,t=!0){for(let n in A)(n[0]==="_"||A[n]===null||A[n]===void 0)&&delete A[n];delete A.grid,t&&delete A.el,A.autoPosition||delete A.autoPosition,A.noResize||delete A.noResize,A.noMove||delete A.noMove,A.locked||delete A.locked,(A.w===1||A.w===A.minW)&&delete A.w,(A.h===1||A.h===A.minH)&&delete A.h}static throttle(A,t){let n=!1;return(...r)=>{n||(n=!0,setTimeout(()=>{A(...r),n=!1},t))}}static removePositioningStyles(A){const t=A.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(A){if(!A)return document.scrollingElement||document.documentElement;const t=getComputedStyle(A);return/(auto|scroll)/.test(t.overflow+t.overflowY)?A:Le.getScrollElement(A.parentElement)}static updateScrollPosition(A,t,n){const r=Le.getScrollElement(A);if(!r)return;const a=A.getBoundingClientRect(),u=r.getBoundingClientRect(),d=window.innerHeight||document.documentElement.clientHeight,h=a.bottom-Math.min(u.bottom,d),g=a.top-Math.max(u.top,0),B=r.scrollTop;g<0&&n<0?A.offsetHeight>u.height?r.scrollTop+=n:r.scrollTop+=Math.abs(g)>Math.abs(n)?n:g:h>0&&n>0&&(A.offsetHeight>u.height?r.scrollTop+=n:r.scrollTop+=h>n?n:h),t.top+=r.scrollTop-B}static updateScrollResize(A,t,n){const r=Le.getScrollElement(t),a=r.clientHeight,u=r===Le.getScrollElement()?0:r.getBoundingClientRect().top,d=A.clientY-u,h=d<n,g=d>a-n;h?r.scrollBy({behavior:"smooth",top:d-n}):g&&r.scrollBy({behavior:"smooth",top:n-(a-d)})}static clone(A){return A==null||typeof A!="object"?A:A instanceof Array?[...A]:{...A}}static cloneDeep(A){const t=["parentGrid","el","grid","subGrid","engine"],n=Le.clone(A);for(const r in n)n.hasOwnProperty(r)&&typeof n[r]=="object"&&r.substring(0,2)!=="__"&&!t.find(a=>a===r)&&(n[r]=Le.cloneDeep(A[r]));return n}static cloneNode(A){const t=A.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(A,t){let n;typeof t=="string"?n=Le.getElement(t):n=t,n&&n.appendChild(A)}static addElStyles(A,t){if(t instanceof Object)for(const n in t)t.hasOwnProperty(n)&&(Array.isArray(t[n])?t[n].forEach(r=>{A.style[n]=r}):A.style[n]=t[n])}static initEvent(A,t){const n={type:t.type},r={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:A.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(a=>n[a]=A[a]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(a=>n[a]=A[a]),{...n,...r}}static simulateMouseEvent(A,t,n){const r=A,a=new MouseEvent(t,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:A.screenX,screenY:A.screenY,clientX:A.clientX,clientY:A.clientY,ctrlKey:r.ctrlKey??!1,altKey:r.altKey??!1,shiftKey:r.shiftKey??!1,metaKey:r.metaKey??!1,button:0,relatedTarget:A.target});(n||A.target).dispatchEvent(a)}static getValuesFromTransformedElement(A){const t=document.createElement("div");Le.addElStyles(t,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),A.appendChild(t);const n=t.getBoundingClientRect();return A.removeChild(t),t.remove(),{xScale:1/n.width,yScale:1/n.height,xOffset:n.left,yOffset:n.top}}static swap(A,t,n){if(!A)return;const r=A[t];A[t]=A[n],A[n]=r}static canBeRotated(A){return!(!A||A.w===A.h||A.locked||A.noResize||A.grid?.opts.disableResize||A.minW&&A.minW===A.maxW||A.minH&&A.minH===A.maxH)}},Ii=class Qn{constructor(A={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=A.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=A.maxRow,this._float=A.float,this.nodes=A.nodes||[],this.onChange=A.onChange}batchUpdate(A=!0,t=!0){return!!this.batchMode===A?this:(this.batchMode=A,A?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(A,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!A._moving||A._skipDown||t.y<=A.y)}_fixCollisions(A,t=A,n,r={}){if(this.sortNodes(-1),n=n||this.collide(A,t),!n)return!1;if(A._moving&&!r.nested&&!this.float&&this.swap(A,n))return!0;let a=t;!this._loading&&this._useEntireRowArea(A,t)&&(a={x:0,w:this.column,y:t.y,h:t.h},n=this.collide(A,a,r.skip));let u=!1;const d={nested:!0,pack:!1};let h=0;for(;n=n||this.collide(A,a,r.skip);){if(h++>this.nodes.length*2)throw new Error("Infinite collide check");let g;if(n.locked||this._loading||A._moving&&!A._skipDown&&t.y>A.y&&!this.float&&(!this.collide(n,{...n,y:A.y},A)||!this.collide(n,{...n,y:t.y-n.h},A))){A._skipDown=A._skipDown||t.y>A.y;const B={...t,y:n.y+n.h,...d};g=this._loading&&q.samePos(A,B)?!0:this.moveNode(A,B),(n.locked||this._loading)&&g?q.copyPos(t,A):!n.locked&&g&&r.pack&&(this._packNodes(),t.y=n.y+n.h,q.copyPos(A,t)),u=u||g}else g=this.moveNode(n,{...n,y:t.y+t.h,skip:A,...d});if(!g)return u;n=void 0}return u}collide(A,t=A,n){const r=A._id,a=n?._id;return this.nodes.find(u=>u._id!==r&&u._id!==a&&q.isIntercepted(u,t))}collideAll(A,t=A,n){const r=A._id,a=n?._id;return this.nodes.filter(u=>u._id!==r&&u._id!==a&&q.isIntercepted(u,t))}directionCollideCoverage(A,t,n){if(!t.rect||!A._rect)return;const r=A._rect,a={...t.rect};a.y>r.y?(a.h+=a.y-r.y,a.y=r.y):a.h+=r.y-a.y,a.x>r.x?(a.w+=a.x-r.x,a.x=r.x):a.w+=r.x-a.x;let u,d=.5;for(let h of n){if(h.locked||!h._rect)break;const g=h._rect;let B=Number.MAX_VALUE,w=Number.MAX_VALUE;r.y<g.y?B=(a.y+a.h-g.y)/g.h:r.y+r.h>g.y+g.h&&(B=(g.y+g.h-a.y)/g.h),r.x<g.x?w=(a.x+a.w-g.x)/g.w:r.x+r.w>g.x+g.w&&(w=(g.x+g.w-a.x)/g.w);const m=Math.min(w,B);m>d&&(d=m,u=h)}return t.collide=u,u}cacheRects(A,t,n,r,a,u){return this.nodes.forEach(d=>d._rect={y:d.y*t+n,x:d.x*A+u,w:d.w*A-u-r,h:d.h*t-n-a}),this}swap(A,t){if(!t||t.locked||!A||A.locked)return!1;function n(){const a=t.x,u=t.y;return t.x=A.x,t.y=A.y,A.h!=t.h?(A.x=a,A.y=t.y+t.h):A.w!=t.w?(A.x=t.x+t.w,A.y=u):(A.x=a,A.y=u),A._dirty=t._dirty=!0,!0}let r;if(A.w===t.w&&A.h===t.h&&(A.x===t.x||A.y===t.y)&&(r=q.isTouching(A,t)))return n();if(r!==!1){if(A.w===t.w&&A.x===t.x&&(r||(r=q.isTouching(A,t)))){if(t.y<A.y){const a=A;A=t,t=a}return n()}if(r!==!1){if(A.h===t.h&&A.y===t.y&&(r||(r=q.isTouching(A,t)))){if(t.x<A.x){const a=A;A=t,t=a}return n()}return!1}}}isAreaEmpty(A,t,n,r){const a={x:A||0,y:t||0,w:n||1,h:r||1};return!this.collide(a)}compact(A="compact",t=!0){if(this.nodes.length===0)return this;t&&this.sortNodes();const n=this.batchMode;n||this.batchUpdate();const r=this._inColumnResize;r||(this._inColumnResize=!0);const a=this.nodes;return this.nodes=[],a.forEach((u,d,h)=>{let g;u.locked||(u.autoPosition=!0,A==="list"&&d&&(g=h[d-1])),this.addNode(u,!1,g)}),r||delete this._inColumnResize,n||this.batchUpdate(!1),this}set float(A){this._float!==A&&(this._float=A||!1,A||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(A=1){return this.nodes=q.sort(this.nodes,A),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(A=>{if(A._updating||A._orig===void 0||A.y===A._orig.y)return;let t=A.y;for(;t>A._orig.y;)--t,this.collide(A,{x:A.x,y:t,w:A.w,h:A.h})||(A._dirty=!0,A.y=t)}):this.nodes.forEach((A,t)=>{if(!A.locked)for(;A.y>0;){const n=t===0?0:A.y-1;if(!(t===0||!this.collide(A,{x:A.x,y:n,w:A.w,h:A.h})))break;A._dirty=A.y!==n,A.y=n}}),this)}prepareNode(A,t){A._id=A._id??Qn._idSeq++;const n=A.id;if(n){let a=1;for(;this.nodes.find(u=>u.id===A.id&&u!==A);)A.id=n+"_"+a++}(A.x===void 0||A.y===void 0||A.x===null||A.y===null)&&(A.autoPosition=!0);const r={x:0,y:0,w:1,h:1};return q.defaults(A,r),A.autoPosition||delete A.autoPosition,A.noResize||delete A.noResize,A.noMove||delete A.noMove,q.sanitizeMinMax(A),typeof A.x=="string"&&(A.x=Number(A.x)),typeof A.y=="string"&&(A.y=Number(A.y)),typeof A.w=="string"&&(A.w=Number(A.w)),typeof A.h=="string"&&(A.h=Number(A.h)),isNaN(A.x)&&(A.x=r.x,A.autoPosition=!0),isNaN(A.y)&&(A.y=r.y,A.autoPosition=!0),isNaN(A.w)&&(A.w=r.w),isNaN(A.h)&&(A.h=r.h),this.nodeBoundFix(A,t),A}nodeBoundFix(A,t){const n=A._orig||q.copyPos({},A);if(A.maxW&&(A.w=Math.min(A.w||1,A.maxW)),A.maxH&&(A.h=Math.min(A.h||1,A.maxH)),A.minW&&(A.w=Math.max(A.w||1,A.minW)),A.minH&&(A.h=Math.max(A.h||1,A.minH)),(A.x||0)+(A.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&A._id!=null&&this.findCacheLayout(A,this.defaultColumn)===-1){const r={...A};r.autoPosition||r.x===void 0?(delete r.x,delete r.y):r.x=Math.min(this.defaultColumn-1,r.x),r.w=Math.min(this.defaultColumn,r.w||1),this.cacheOneLayout(r,this.defaultColumn)}return A.w>this.column?A.w=this.column:A.w<1&&(A.w=1),this.maxRow&&A.h>this.maxRow?A.h=this.maxRow:A.h<1&&(A.h=1),A.x<0&&(A.x=0),A.y<0&&(A.y=0),A.x+A.w>this.column&&(t?A.w=this.column-A.x:A.x=this.column-A.w),this.maxRow&&A.y+A.h>this.maxRow&&(t?A.h=this.maxRow-A.y:A.y=this.maxRow-A.h),q.samePos(A,n)||(A._dirty=!0),this}getDirtyNodes(A){return A?this.nodes.filter(t=>t._dirty&&!q.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(A){if(this.batchMode||!this.onChange)return this;const t=(A||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(A=>{delete A._dirty,delete A._lastTried}),this)}saveInitial(){return this.nodes.forEach(A=>{A._orig=q.copyPos({},A),delete A._dirty}),this._hasLocked=this.nodes.some(A=>A.locked),this}restoreInitial(){return this.nodes.forEach(A=>{!A._orig||q.samePos(A,A._orig)||(q.copyPos(A,A._orig),A._dirty=!0)}),this._notify(),this}findEmptyPosition(A,t=this.nodes,n=this.column,r){const a=r?r.y*n+(r.x+r.w):0;let u=!1;for(let d=a;!u;++d){const h=d%n,g=Math.floor(d/n);if(h+A.w>n)continue;const B={x:h,y:g,w:A.w,h:A.h};t.find(w=>q.isIntercepted(B,w))||((A.x!==h||A.y!==g)&&(A._dirty=!0),A.x=h,A.y=g,delete A.autoPosition,u=!0)}return u}addNode(A,t=!1,n){const r=this.nodes.find(u=>u._id===A._id);if(r)return r;this._inColumnResize?this.nodeBoundFix(A):this.prepareNode(A),delete A._temporaryRemoved,delete A._removeDOM;let a;return A.autoPosition&&this.findEmptyPosition(A,this.nodes,this.column,n)&&(delete A.autoPosition,a=!0),this.nodes.push(A),t&&this.addedNodes.push(A),a||this._fixCollisions(A),this.batchMode||this._packNodes()._notify(),A}removeNode(A,t=!0,n=!1){return this.nodes.find(r=>r._id===A._id)?(n&&this.removedNodes.push(A),t&&(A._removeDOM=!0),this.nodes=this.nodes.filter(r=>r._id!==A._id),A._isAboutToRemove||this._packNodes(),this._notify([A]),this):this}removeAll(A=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;A&&this.nodes.forEach(r=>r._removeDOM=!0);const n=this.nodes;return this.removedNodes=t?n:[],this.nodes=[],this._notify(n)}moveNodeCheck(A,t){if(!this.changedPosConstrain(A,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(A,t);let n;const r=new Qn({column:this.column,float:this.float,nodes:this.nodes.map(u=>u._id===A._id?(n={...u},n):{...u})});if(!n)return!1;const a=r.moveNode(n,t)&&r.getRow()<=Math.max(this.getRow(),this.maxRow);if(!a&&!t.resizing&&t.collide){const u=t.collide.el.gridstackNode;if(this.swap(A,u))return this._notify(),!0}return a?(r.nodes.filter(u=>u._dirty).forEach(u=>{const d=this.nodes.find(h=>h._id===u._id);d&&(q.copyPos(d,u),d._dirty=!0)}),this._notify(),!0):!1}willItFit(A){if(delete A._willFitPos,!this.maxRow)return!0;const t=new Qn({column:this.column,float:this.float,nodes:this.nodes.map(r=>({...r}))}),n={...A};return this.cleanupNode(n),delete n.el,delete n._id,delete n.content,delete n.grid,t.addNode(n),t.getRow()<=this.maxRow?(A._willFitPos=q.copyPos({},n),!0):!1}changedPosConstrain(A,t){return t.w=t.w||A.w,t.h=t.h||A.h,A.x!==t.x||A.y!==t.y?!0:(A.maxW&&(t.w=Math.min(t.w,A.maxW)),A.maxH&&(t.h=Math.min(t.h,A.maxH)),A.minW&&(t.w=Math.max(t.w,A.minW)),A.minH&&(t.h=Math.max(t.h,A.minH)),A.w!==t.w||A.h!==t.h)}moveNode(A,t){if(!A||!t)return!1;let n;t.pack===void 0&&!this.batchMode&&(n=t.pack=!0),typeof t.x!="number"&&(t.x=A.x),typeof t.y!="number"&&(t.y=A.y),typeof t.w!="number"&&(t.w=A.w),typeof t.h!="number"&&(t.h=A.h);const r=A.w!==t.w||A.h!==t.h,a=q.copyPos({},A,!0);if(q.copyPos(a,t),this.nodeBoundFix(a,r),q.copyPos(t,a),!t.forceCollide&&q.samePos(A,t))return!1;const u=q.copyPos({},A),d=this.collideAll(A,a,t.skip);let h=!0;if(d.length){const g=A._moving&&!t.nested;let B=g?this.directionCollideCoverage(A,t,d):d[0];if(g&&B&&A.grid?.opts?.subGridDynamic&&!A.grid._isTemp){const w=q.areaIntercept(t.rect,B._rect),m=q.area(t.rect),v=q.area(B._rect);w/(m<v?m:v)>.8&&(B.grid.makeSubGrid(B.el,void 0,A),B=void 0)}B?h=!this._fixCollisions(A,a,B,t):(h=!1,n&&delete t.pack)}return h&&!q.samePos(A,a)&&(A._dirty=!0,q.copyPos(A,a)),t.pack&&this._packNodes()._notify(),!q.samePos(A,u)}getRow(){return this.nodes.reduce((A,t)=>Math.max(A,t.y+t.h),0)}beginUpdate(A){return A._updating||(A._updating=!0,delete A._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const A=this.nodes.find(t=>t._updating);return A&&(delete A._updating,delete A._skipDown),this}save(A=!0,t,n){const r=this._layouts?.length||0;let a;r&&(n?n!==this.column&&(a=this._layouts[n]):this.column!==r-1&&(a=this._layouts[r-1]));const u=[];return this.sortNodes(),this.nodes.forEach(d=>{const h=a?.find(B=>B._id===d._id),g={...d,...h||{}};q.removeInternalForSave(g,!A),t&&t(d,g),u.push(g)}),u}layoutsNodesChange(A){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,n)=>{if(!t||n===this.column)return this;if(n<this.column)this._layouts[n]=void 0;else{const r=n/this.column;A.forEach(a=>{if(!a._orig)return;const u=t.find(d=>d._id===a._id);u&&(u.y>=0&&a.y!==a._orig.y&&(u.y+=a.y-a._orig.y,u.y<0&&(u.y=0)),a.x!==a._orig.x&&(u.x=Math.round(a.x*r),u.x<0&&(u.x=0)),a.w!==a._orig.w&&(u.w=Math.round(a.w*r),u.w<1&&(u.w=1)))})}}),this)}columnChanged(A,t,n="moveScale"){if(!this.nodes.length||!t||A===t)return this;const r=n==="compact"||n==="list";r&&this.sortNodes(1),t<A&&this.cacheLayout(this.nodes,A),this.batchUpdate();let a=[],u=r?this.nodes:q.sort(this.nodes,-1);if(t>A&&this._layouts){const d=this._layouts[t]||[],h=this._layouts.length-1;!d.length&&A!==h&&this._layouts[h]?.length&&(A=h,this._layouts[h].forEach(g=>{const B=u.find(w=>w._id===g._id);B&&(!r&&!g.autoPosition&&(B.x=g.x??B.x,B.y=g.y??B.y),B.w=g.w??B.w,(g.x==null||g.y===void 0)&&(B.autoPosition=!0))})),d.forEach(g=>{const B=u.findIndex(w=>w._id===g._id);if(B!==-1){const w=u[B];if(r){w.w=g.w;return}(g.autoPosition||isNaN(g.x)||isNaN(g.y))&&this.findEmptyPosition(g,a),g.autoPosition||(w.x=g.x??w.x,w.y=g.y??w.y,w.w=g.w??w.w,a.push(w)),u.splice(B,1)}})}if(r)this.compact(n,!1);else{if(u.length)if(typeof n=="function")n(t,A,a,u);else{const d=r||n==="none"?1:t/A,h=n==="move"||n==="moveScale",g=n==="scale"||n==="moveScale";u.forEach(B=>{B.x=t===1?0:h?Math.round(B.x*d):Math.min(B.x,t-1),B.w=t===1||A===1?1:g?Math.round(B.w*d)||1:Math.min(B.w,t),a.push(B)}),u=[]}a=q.sort(a,-1),this._inColumnResize=!0,this.nodes=[],a.forEach(d=>{this.addNode(d,!1),delete d._orig})}return this.nodes.forEach(d=>delete d._orig),this.batchUpdate(!1,!r),delete this._inColumnResize,this}cacheLayout(A,t,n=!1){const r=[];return A.forEach((a,u)=>{a._id===void 0&&(a._id=(a.id?this.nodes.find(d=>d.id===a.id):void 0)?._id??Qn._idSeq++),r[u]={x:a.x,y:a.y,w:a.w,_id:a._id}}),this._layouts=n?[]:this._layouts||[],this._layouts[t]=r,this}cacheOneLayout(A,t){A._id=A._id??Qn._idSeq++;const n={x:A.x,y:A.y,w:A.w,_id:A._id};(A.autoPosition||A.x===void 0)&&(delete n.x,delete n.y,A.autoPosition&&(n.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];const r=this.findCacheLayout(A,t);return r===-1?this._layouts[t].push(n):this._layouts[t][r]=n,this}findCacheLayout(A,t){return this._layouts?.[t]?.findIndex(n=>n._id===A._id)??-1}removeNodeFromLayoutCache(A){if(this._layouts)for(let t=0;t<this._layouts.length;t++){const n=this.findCacheLayout(A,t);n!==-1&&this._layouts[t].splice(n,1)}}cleanupNode(A){for(const t in A)t[0]==="_"&&t!=="_id"&&delete A[t];return this}};Ii._idSeq=0;var Ue={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"},TA=class{},Oe=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0),be=class{};function zr(e,A){e.touches.length>1||(e.cancelable&&e.preventDefault(),q.simulateMouseEvent(e.changedTouches[0],A))}function pl(e,A){e.cancelable&&e.preventDefault(),q.simulateMouseEvent(e,A)}function Xr(e){be.touchHandled||(be.touchHandled=!0,zr(e,"mousedown"))}function $r(e){be.touchHandled&&zr(e,"mousemove")}function Yr(e){if(!be.touchHandled)return;be.pointerLeaveTimeout&&(window.clearTimeout(be.pointerLeaveTimeout),delete be.pointerLeaveTimeout);const A=!!TA.dragElement;zr(e,"mouseup"),A||zr(e,"click"),be.touchHandled=!1}function Wr(e){e.pointerType!=="mouse"&&e.target.releasePointerCapture(e.pointerId)}function ml(e){TA.dragElement&&e.pointerType!=="mouse"&&pl(e,"mouseenter")}function wl(e){TA.dragElement&&e.pointerType!=="mouse"&&(be.pointerLeaveTimeout=window.setTimeout(()=>{delete be.pointerLeaveTimeout,pl(e,"mouseleave")},10))}var Cl=class Qu{constructor(A,t,n){this.host=A,this.dir=t,this.option=n,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){if(this.option.element)try{this.el=this.option.element instanceof HTMLElement?this.option.element:this.host.querySelector(this.option.element)}catch(A){this.option.element=void 0,console.error("Query for resizeable handle failed, falling back",A)}return this.el||(this.el=document.createElement("div"),this.host.appendChild(this.el)),this.el.classList.add("ui-resizable-handle"),this.el.classList.add(`${Qu.prefix}${this.dir}`),this.el.style.zIndex="100",this.el.style.userSelect="none",this.el.addEventListener("mousedown",this._mouseDown),Oe&&(this.el.addEventListener("touchstart",Xr),this.el.addEventListener("pointerdown",Wr)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Oe&&(this.el.removeEventListener("touchstart",Xr),this.el.removeEventListener("pointerdown",Wr)),this.option.element||this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(A){this.mouseDownEvent=A,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Oe&&(this.el.addEventListener("touchmove",$r),this.el.addEventListener("touchend",Yr)),A.stopPropagation(),A.preventDefault()}_mouseMove(A){const t=this.mouseDownEvent;this.moving?this._triggerEvent("move",A):Math.abs(A.x-t.x)+Math.abs(A.y-t.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",A),document.addEventListener("keydown",this._keyEvent)),A.stopPropagation()}_mouseUp(A){this.moving&&(this._triggerEvent("stop",A),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Oe&&(this.el.removeEventListener("touchmove",$r),this.el.removeEventListener("touchend",Yr)),delete this.moving,delete this.mouseDownEvent,A.stopPropagation(),A.preventDefault()}_keyEvent(A){A.key==="Escape"&&(this.host.gridstackNode?.grid?.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(A,t){return this.option[A]&&this.option[A](t),this}};Cl.prefix="ui-resizable-";var _i=class{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,A){this._eventRegister[e]=A}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,A){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](A)}},vl=class gs extends _i{constructor(A,t={}){super(),this.el=A,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{const n=this.el.parentElement.getBoundingClientRect(),r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},a=this.temporalRect||r;return{position:{left:(a.left-n.left)*this.rectScale.x,top:(a.top-n.top)*this.rectScale.y},size:{width:a.width*this.rectScale.x,height:a.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(A,t){super.on(A,t)}off(A){super.off(A)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(A){const t=A.handles&&A.handles!==this.option.handles,n=A.autoHide&&A.autoHide!==this.option.autoHide;return Object.keys(A).forEach(r=>this.option[r]=A[r]),t&&(this._removeHandlers(),this._setupHandlers()),n&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(A){return A?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),TA.overResizeElement===this&&delete TA.overResizeElement),this}_mouseOver(A){TA.overResizeElement||TA.dragElement||(TA.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(A){TA.overResizeElement===this&&(delete TA.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(A=>A.trim()).map(A=>new Cl(this.el,A,{element:this.option.element,start:t=>this._resizeStart(t),stop:t=>this._resizeStop(t),move:t=>this._resizing(t,A)})),this}_resizeStart(A){this.sizeToContent=q.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=q.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=A,this._setupHelper(),this._applyChange();const t=q.initEvent(A,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(A,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(A,t),this._applyChange();const n=q.initEvent(A,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(n,this._ui()),this.triggerEvent("resize",n),this}_resizeStop(A){const t=q.initEvent(A,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=gs._originStyleProp.map(n=>this.el.style[n]),this.parentOriginStylePosition=this.el.parentElement.style.position;const A=this.el.parentElement,t=q.getValuesFromTransformedElement(A);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return gs._originStyleProp.forEach((A,t)=>{this.el.style[A]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(A,t){const n=this.startEvent,r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},a=A.clientX-n.clientX,u=this.sizeToContent?0:A.clientY-n.clientY;let d,h;t.indexOf("e")>-1?r.width+=a:t.indexOf("w")>-1&&(r.width-=a,r.left+=a,d=!0),t.indexOf("s")>-1?r.height+=u:t.indexOf("n")>-1&&(r.height-=u,r.top+=u,h=!0);const g=this._constrainSize(r.width,r.height,d,h);return Math.round(r.width)!==Math.round(g.width)&&(t.indexOf("w")>-1&&(r.left+=r.width-g.width),r.width=g.width),Math.round(r.height)!==Math.round(g.height)&&(t.indexOf("n")>-1&&(r.top+=r.height-g.height),r.height=g.height),r}_constrainSize(A,t,n,r){const a=this.option,u=(n?a.maxWidthMoveLeft:a.maxWidth)||Number.MAX_SAFE_INTEGER,d=a.minWidth/this.rectScale.x||A,h=(r?a.maxHeightMoveUp:a.maxHeight)||Number.MAX_SAFE_INTEGER,g=a.minHeight/this.rectScale.y||t;return{width:Math.min(u,Math.max(d,A)),height:Math.min(h,Math.max(g,t))}}_applyChange(){let A={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const{left:t,top:n}=this.el.parentElement.getBoundingClientRect();A={left:t,top:n,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{const n=this.temporalRect[t],r=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(n-A[t])*r+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(A=>A.destroy()),delete this.handlers,this}};vl._originStyleProp=["width","height","position","left","top","opacity","zIndex"];var Om='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle',yl=class hs extends _i{constructor(A,t={}){super(),this.el=A,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const n=t?.handle?.substring(1),r=A.gridstackNode;this.dragEls=!n||A.classList.contains(n)?[A]:r?.subGrid?[A.querySelector(t.handle)||A]:Array.from(A.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[A]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(A,t){super.on(A,t)}off(A){super.off(A)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(A=>{A.addEventListener("mousedown",this._mouseDown),Oe&&(A.addEventListener("touchstart",Xr),A.addEventListener("pointerdown",Wr))}),this.el.classList.remove("ui-draggable-disabled"))}disable(A=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),Oe&&(t.removeEventListener("touchstart",Xr),t.removeEventListener("pointerdown",Wr))}),A||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(A){return Object.keys(A).forEach(t=>this.option[t]=A[t]),this}_mouseDown(A){if(be.touchHandled&&A.isTrusted&&(be.touchHandled=!1),!TA.mouseHandled)return A.button!==0||!this.dragEls.find(t=>t===A.target)&&A.target.closest(Om)||this.option.cancel&&A.target.closest(this.option.cancel)||(this.mouseDownEvent=A,delete this.dragging,delete TA.dragElement,delete TA.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Oe&&(A.currentTarget.addEventListener("touchmove",$r),A.currentTarget.addEventListener("touchend",Yr)),A.preventDefault(),document.activeElement&&document.activeElement.blur(),TA.mouseHandled=!0),!0}_callDrag(A){if(!this.dragging)return;const t=q.initEvent(A,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(A){const t=this.mouseDownEvent;if(this.lastDrag=A,this.dragging)if(this._dragFollow(A),TA.pauseDrag){const n=Number.isInteger(TA.pauseDrag)?TA.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(A),n)}else this._callDrag(A);else if(Math.abs(A.x-t.x)+Math.abs(A.y-t.y)>3){this.dragging=!0,TA.dragElement=this;const n=this.el.gridstackNode?.grid;n?TA.dropElement=n.el.ddElement.ddDroppable:delete TA.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=q.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(A,this.el,this.helperContainment),this._setupHelperStyle(A);const r=q.initEvent(A,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(r,this.ui()),this.triggerEvent("dragstart",r),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(A){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Oe&&A.currentTarget&&(A.currentTarget.removeEventListener("touchmove",$r,!0),A.currentTarget.removeEventListener("touchend",Yr,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),TA.dropElement?.el===this.el.parentElement&&delete TA.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const t=q.initEvent(A,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(t),this.triggerEvent("dragstop",t),TA.dropElement&&TA.dropElement.drop(A)}delete this.helper,delete this.mouseDownEvent,delete TA.dragElement,delete TA.dropElement,delete TA.mouseHandled,A.preventDefault()}_keyEvent(A){const t=this.el.gridstackNode,n=t?.grid||TA.dropElement?.el?.gridstack;if(A.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),n?.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&n&&(A.key==="r"||A.key==="R")){if(!q.canBeRotated(t))return;t._origRotate=t._origRotate||{...t._orig},delete t._moving,n.setAnimation(!1).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),t._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",q.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let A=this.el;return typeof this.option.helper=="function"?A=this.option.helper(this.el):this.option.helper==="clone"&&(A=q.cloneNode(this.el)),A.parentElement||q.appendTo(A,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=hs.originStyleProp.map(t=>this.el.style[t]),A}_setupHelperStyle(A){this.helper.classList.add("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.add("grid-stack-dragging");const t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, top",t.position="fixed",this._dragFollow(A),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null)},0),this}_removeHelperStyle(){if(this.helper.classList.remove("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.remove("grid-stack-dragging"),!this.helper?.gridstackNode?._isAboutToRemove&&this.dragElementOriginStyle){const A=this.helper,t=this.dragElementOriginStyle.transition||null;A.style.transition=this.dragElementOriginStyle.transition="none",hs.originStyleProp.forEach(n=>A.style[n]=this.dragElementOriginStyle[n]||null),setTimeout(()=>A.style.transition=t,50)}return delete this.dragElementOriginStyle,this}_dragFollow(A){const t={left:0,top:0},n=this.helper.style,r=this.dragOffset;n.left=(A.clientX+r.offsetLeft-t.left)*this.dragTransform.xScale+"px",n.top=(A.clientY+r.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(A,t,n){let r=0,a=0;n&&(r=this.dragTransform.xOffset,a=this.dragTransform.yOffset);const u=t.getBoundingClientRect();return{left:u.left,top:u.top,offsetLeft:-A.clientX+u.left-r,offsetTop:-A.clientY+u.top-a,width:u.width*this.dragTransform.xScale,height:u.height*this.dragTransform.yScale}}ui(){const A=this.el.parentElement.getBoundingClientRect(),t=this.helper.getBoundingClientRect();return{position:{top:(t.top-A.top)*this.dragTransform.yScale,left:(t.left-A.left)*this.dragTransform.xScale}}}};yl.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];var Km=class extends _i{constructor(e,A={}){super(),this.el=e,this.option=A,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,A){super.on(e,A)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),Oe&&(this.el.addEventListener("pointerenter",ml),this.el.addEventListener("pointerleave",wl)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),Oe&&(this.el.removeEventListener("pointerenter",ml),this.el.removeEventListener("pointerleave",wl)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(A=>this.option[A]=e[A]),this._setupAccept(),this}_mouseEnter(e){if(!TA.dragElement||be.touchHandled&&e.isTrusted||!this._canDrop(TA.dragElement.el))return;e.preventDefault(),e.stopPropagation(),TA.dropElement&&TA.dropElement!==this&&TA.dropElement._mouseLeave(e,!0),TA.dropElement=this;const A=q.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(A,this._ui(TA.dragElement)),this.triggerEvent("dropover",A),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,A=!1){if(!TA.dragElement||TA.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const t=q.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(t,this._ui(TA.dragElement)),this.triggerEvent("dropout",t),TA.dropElement===this&&(delete TA.dropElement,!A)){let n,r=this.el.parentElement;for(;!n&&r;)n=r.ddElement?.ddDroppable,r=r.parentElement;n&&n._mouseEnter(e)}}drop(e){e.preventDefault();const A=q.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(A,this._ui(TA.dragElement)),this.triggerEvent("drop",A)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}},Rm=class Eu{static init(A){return A.ddElement||(A.ddElement=new Eu(A)),A.ddElement}constructor(A){this.el=A}on(A,t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(A)>-1?this.ddDraggable.on(A,t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(A)>-1?this.ddDroppable.on(A,t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(A)>-1&&this.ddResizable.on(A,t),this}off(A){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(A)>-1?this.ddDraggable.off(A):this.ddDroppable&&["drop","dropover","dropout"].indexOf(A)>-1?this.ddDroppable.off(A):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(A)>-1&&this.ddResizable.off(A),this}setupDraggable(A){return this.ddDraggable?this.ddDraggable.updateOption(A):this.ddDraggable=new yl(this.el,A),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(A){return this.ddResizable?this.ddResizable.updateOption(A):this.ddResizable=new vl(this.el,A),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(A){return this.ddDroppable?this.ddDroppable.updateOption(A):this.ddDroppable=new Km(this.el,A),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}},Vm=class{resizable(e,A,t,n){return this._getDDElements(e,A).forEach(r=>{if(A==="disable"||A==="enable")r.ddResizable&&r.ddResizable[A]();else if(A==="destroy")r.ddResizable&&r.cleanResizable();else if(A==="option")r.setupResizable({[t]:n});else{const a=r.el.gridstackNode.grid;let u=r.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";u==="all"&&(u="n,e,s,w,se,sw,ne,nw");const d=!a.opts.alwaysShowResizeHandle;r.setupResizable({...a.opts.resizable,handles:u,autoHide:d,start:A.start,stop:A.stop,resize:A.resize})}}),this}draggable(e,A,t,n){return this._getDDElements(e,A).forEach(r=>{if(A==="disable"||A==="enable")r.ddDraggable&&r.ddDraggable[A]();else if(A==="destroy")r.ddDraggable&&r.cleanDraggable();else if(A==="option")r.setupDraggable({[t]:n});else{const a=r.el.gridstackNode.grid;r.setupDraggable({...a.opts.draggable,start:A.start,stop:A.stop,drag:A.drag})}}),this}dragIn(e,A){return this._getDDElements(e).forEach(t=>t.setupDraggable(A)),this}droppable(e,A,t,n){return typeof A.accept=="function"&&!A._accept&&(A._accept=A.accept,A.accept=r=>A._accept(r)),this._getDDElements(e,A).forEach(r=>{A==="disable"||A==="enable"?r.ddDroppable&&r.ddDroppable[A]():A==="destroy"?r.ddDroppable&&r.cleanDroppable():A==="option"?r.setupDroppable({[t]:n}):r.setupDroppable(A)}),this}isDroppable(e){return!!(e?.ddElement?.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){return!!(e?.ddElement?.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){return!!(e?.ddElement?.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,A,t){return this._getDDElements(e).forEach(n=>n.on(A,r=>{t(r,TA.dragElement?TA.dragElement.el:r.target,TA.dragElement?TA.dragElement.helper:null)})),this}off(e,A){return this._getDDElements(e).forEach(t=>t.off(A)),this}_getDDElements(e,A){const t=e.gridstack||A!=="destroy"&&A!=="disable",n=q.getElements(e);return n.length?n.map(r=>r.ddElement||(t?Rm.init(r):null)).filter(r=>r):[]}},me=new Vm,rn=class LA{static init(A={},t=".grid-stack"){if(typeof document>"u")return null;const n=LA.getGridElement(t);return n?(n.gridstack||(n.gridstack=new LA(n,q.cloneDeep(A))),n.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
|
|
27
27
|
Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(A={},t=".grid-stack"){const n=[];return typeof document>"u"||(LA.getGridElements(t).forEach(r=>{r.gridstack||(r.gridstack=new LA(r,q.cloneDeep(A))),n.push(r.gridstack)}),n.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
|
|
28
28
|
Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),n}static addGrid(A,t={}){if(!A)return null;let n=A;if(n.gridstack){const r=n.gridstack;return t&&(r.opts={...r.opts,...t}),t.children!==void 0&&r.load(t.children),r}return(!A.classList.contains("grid-stack")||LA.addRemoveCB)&&(LA.addRemoveCB?n=LA.addRemoveCB(A,t,!0,!0):n=q.createDiv(["grid-stack",t.class],A)),LA.init(t,n)}static registerEngine(A){LA.engineClass=A}get placeholder(){if(!this._placeholder){this._placeholder=q.createDiv([this.opts.placeholderClass,Ue.itemClass,this.opts.itemClass]);const A=q.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(A.textContent=this.opts.placeholderText)}return this._placeholder}constructor(A,t={}){this.el=A,this.opts=t,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},A.gridstack=this,this.opts=t=t||{},A.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),t.row&&(t.minRow=t.maxRow=t.row,delete t.row);const n=q.toNumber(A.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);const r=t.columnOpts;if(r){const h=r.breakpoints;!r.columnWidth&&!h?.length?delete t.columnOpts:(r.columnMax=r.columnMax||12,h?.length>1&&h.sort((g,B)=>(B.w||0)-(g.w||0)))}const a={...q.cloneDeep(Ue),column:q.toNumber(A.getAttribute("gs-column"))||Ue.column,minRow:n||q.toNumber(A.getAttribute("gs-min-row"))||Ue.minRow,maxRow:n||q.toNumber(A.getAttribute("gs-max-row"))||Ue.maxRow,staticGrid:q.toBool(A.getAttribute("gs-static"))||Ue.staticGrid,sizeToContent:q.toBool(A.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||Ue.draggable.handle},removableOptions:{accept:t.itemClass||Ue.removableOptions.accept,decline:Ue.removableOptions.decline}};A.getAttribute("gs-animate")&&(a.animate=q.toBool(A.getAttribute("gs-animate"))),t=q.defaults(t,a),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(t),t.rtl==="auto"&&(t.rtl=A.style.direction==="rtl"),t.rtl&&this.el.classList.add("grid-stack-rtl");const u=this.el.closest("."+Ue.itemClass)?.gridstackNode;if(u&&(u.subGrid=this,this.parentGridNode=u,this.el.classList.add("grid-stack-nested"),u.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=t.cellHeight==="auto",this._isAutoCellHeight||t.cellHeight==="initial")this.cellHeight(void 0);else{typeof t.cellHeight=="number"&&t.cellHeightUnit&&t.cellHeightUnit!==Ue.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit);const h=t.cellHeight;delete t.cellHeight,this.cellHeight(h)}t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=Oe),this._setStaticClass();const d=t.engineClass||LA.engineClass||Ii;if(this.engine=new d({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:h=>{h.forEach(g=>{const B=g.el;B&&(g._removeDOM?(B&&B.remove(),delete g._removeDOM):this._writePosAttr(B,g))}),this._updateContainerHeight()}}),t.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(h=>this._prepareElement(h)),delete this.engine._loading,this.batchUpdate(!1)),t.children){const h=t.children;delete t.children,h.length&&this.load(h)}this.setAnimation(),t.subGridDynamic&&!TA.pauseDrag&&(TA.pauseDrag=!0),t.draggable?.pause!==void 0&&(TA.pauseDrag=t.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(A=this.opts){this.el.classList.add("gs-"+A.column),typeof A.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/A.column}%`)}addWidget(A){if(!A)return;if(typeof A=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(A.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(A);let t,n=A;if(n.grid=this,n.el?t=n.el:LA.addRemoveCB?t=LA.addRemoveCB(this.el,A,!0,!1):t=this.createWidgetDivs(n),!t)return;if(n=t.gridstackNode,n&&t.parentElement===this.el&&this.engine.nodes.find(a=>a._id===n._id))return t;const r=this._readAttr(t);return q.defaults(A,r),this.engine.prepareNode(A),this.el.appendChild(t),this.makeWidget(t,A),t}createWidgetDivs(A){const t=q.createDiv(["grid-stack-item",this.opts.itemClass]),n=q.createDiv(["grid-stack-item-content"],t);return q.lazyLoad(A)?A.visibleObservable||(A.visibleObservable=new IntersectionObserver(([r])=>{r.isIntersecting&&(A.visibleObservable?.disconnect(),delete A.visibleObservable,LA.renderCB(n,A),A.grid?.prepareDragDrop(A.el))}),window.setTimeout(()=>A.visibleObservable?.observe(t))):LA.renderCB(n,A),t}makeSubGrid(A,t,n,r=!0){let a=A.gridstackNode;if(a||(a=this.makeWidget(A).gridstackNode),a.subGrid?.el)return a.subGrid;let u,d=this;for(;d&&!u;)u=d.opts?.subGridOpts,d=d.parentGridNode?.grid;t=q.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...u||{},...t||a.subGridOpts||{}}),a.subGridOpts=t;let h;t.column==="auto"&&(h=!0,t.column=Math.max(a.w||1,n?.w||1),delete t.columnOpts);let g=a.el.querySelector(".grid-stack-item-content"),B,w;if(r&&(this._removeDD(a.el),w={...a,x:0,y:0},q.removeInternalForSave(w),delete w.subGridOpts,a.content&&(w.content=a.content,delete a.content),LA.addRemoveCB?B=LA.addRemoveCB(this.el,w,!0,!1):(B=q.createDiv(["grid-stack-item"]),B.appendChild(g),g=q.createDiv(["grid-stack-item-content"],a.el)),this.prepareDragDrop(a.el)),n){const v=h?t.column:a.w,y=a.h+n.h,I=a.el.style;I.transition="none",this.update(a.el,{w:v,h:y}),setTimeout(()=>I.transition=null)}const m=a.subGrid=LA.addGrid(g,t);return n?._moving&&(m._isTemp=!0),h&&(m._autoColumn=!0),r&&m.makeWidget(B,w),n&&(n._moving?window.setTimeout(()=>q.simulateMouseEvent(n._event,"mouseenter",m.el),0):m.makeWidget(a.el,a)),this.resizeToContentCheck(!1,a),m}removeAsSubGrid(A){const t=this.parentGridNode?.grid;t&&(t.batchUpdate(),t.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(n=>{n.x+=this.parentGridNode.x,n.y+=this.parentGridNode.y,t.makeWidget(n.el,n)}),t.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,A&&window.setTimeout(()=>q.simulateMouseEvent(A._event,"mouseenter",t.el),0))}save(A=!0,t=!1,n=LA.saveCB,r){const a=this.engine.save(A,n,r);if(a.forEach(u=>{if(A&&u.el&&!u.subGrid&&!n)u.content=u.el.querySelector(".grid-stack-item-content")?.innerHTML,u.content||delete u.content;else if(!A&&!n&&delete u.content,u.subGrid?.el){const d=u.w||u.subGrid.getColumn(),h=u.subGrid.save(A,t,n,d);u.subGridOpts=t?h:{children:h},delete u.subGrid}delete u.el}),t){const u=q.cloneDeep(this.opts);u.marginBottom===u.marginTop&&u.marginRight===u.marginLeft&&u.marginTop===u.marginRight&&(u.margin=u.marginTop,delete u.marginTop,delete u.marginRight,delete u.marginBottom,delete u.marginLeft),u.rtl===(this.el.style.direction==="rtl")&&(u.rtl="auto"),this._isAutoCellHeight&&(u.cellHeight="auto"),this._autoColumn&&(u.column="auto");const d=u._alwaysShowResizeHandle;return delete u._alwaysShowResizeHandle,d!==void 0?u.alwaysShowResizeHandle=d:delete u.alwaysShowResizeHandle,q.removeInternalAndSame(u,Ue),u.children=a,u}return a}load(A,t=LA.addRemoveCB||!0){A=q.cloneDeep(A);const n=this.getColumn();A.forEach(B=>{B.w=B.w||B.minW||1,B.h=B.h||B.minH||1}),A=q.sort(A),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let r=0;A.forEach(B=>{r=Math.max(r,(B.x||0)+B.w)}),r>this.engine.defaultColumn&&(this.engine.defaultColumn=r),r>n&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=A,this.engine.columnChanged(r,n,this.responseLayout),A=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(A,r,!0));const a=LA.addRemoveCB;typeof t=="function"&&(LA.addRemoveCB=t);const u=[];this.batchUpdate();const d=!this.engine.nodes.length,h=d&&this.opts.animate;h&&this.setAnimation(!1),!d&&t&&[...this.engine.nodes].forEach(B=>{B.id&&(q.find(A,B.id)||(LA.addRemoveCB&&LA.addRemoveCB(this.el,B,!1,!1),u.push(B),this.removeWidget(B.el,!0,!1)))}),this.engine._loading=!0;const g=[];return this.engine.nodes=this.engine.nodes.filter(B=>q.find(A,B.id)?(g.push(B),!1):!0),A.forEach(B=>{const w=q.find(g,B.id);if(w){if(q.shouldSizeToContent(w)&&(B.h=w.h),this.engine.nodeBoundFix(B),(B.autoPosition||B.x===void 0||B.y===void 0)&&(B.w=B.w||w.w,B.h=B.h||w.h,this.engine.findEmptyPosition(B)),this.engine.nodes.push(w),q.samePos(w,B)&&this.engine.nodes.length>1&&(this.moveNode(w,{...B,forceCollide:!0}),q.copyPos(B,w)),this.update(w.el,B),B.subGridOpts?.children){const m=w.el.querySelector(".grid-stack");m&&m.gridstack&&m.gridstack.load(B.subGridOpts.children)}}else t&&this.addWidget(B)}),delete this.engine._loading,this.engine.removedNodes=u,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,a?LA.addRemoveCB=a:delete LA.addRemoveCB,h&&this.setAnimation(!0,!0),this}batchUpdate(A=!0){return this.engine.batchUpdate(A),A||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(A=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!A||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const t=this.el.querySelector("."+this.opts.itemClass);if(t){const r=q.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/r)}const n=parseInt(this.el.getAttribute("gs-current-row"));return n?Math.round(this.el.getBoundingClientRect().height/n):this.opts.cellHeight}cellHeight(A){if(A!==void 0&&this._isAutoCellHeight!==(A==="auto")&&(this._isAutoCellHeight=A==="auto",this._updateResizeEvent()),(A==="initial"||A==="auto")&&(A=void 0),A===void 0){const n=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;A=this.cellWidth()+n}const t=q.parseHeight(A);return this.opts.cellHeightUnit===t.unit&&this.opts.cellHeight===t.h?this:(this.opts.cellHeightUnit=t.unit,this.opts.cellHeight=t.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(A=!1){return A&&this.opts.columnOpts?.breakpointForWindow?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){const A=this.opts.columnOpts;if(!A||!A.columnWidth&&!A.breakpoints?.length)return!1;const t=this.getColumn();let n=t;const r=this._widthOrContainer(!0);if(A.columnWidth)n=Math.min(Math.round(r/A.columnWidth)||1,A.columnMax);else{n=A.columnMax;let a=0;for(;a<A.breakpoints.length&&r<=A.breakpoints[a].w;)n=A.breakpoints[a++].c||t}if(n!==t){const a=A.breakpoints?.find(u=>u.c===n);return this.column(n,a?.layout||A.layout),!0}return!1}compact(A="compact",t=!0){return this.engine.compact(A,t),this._triggerChangeEvent(),this}column(A,t="moveScale"){if(!A||A<1||this.opts.column===A)return this;const n=this.getColumn();return this.opts.column=A,this.engine?(this.engine.column=A,this.el.classList.remove("gs-"+n),this._updateColumnVar(),this.engine.columnChanged(n,A,t),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=t,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(A=>A.matches("."+this.opts.itemClass)&&!A.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(A=!0){if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),A?this.el.parentNode.removeChild(this.el):(this.removeAll(A),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,delete this._placeholder?.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(A){return this.opts.float!==A&&(this.opts.float=this.engine.float=A,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(A,t=!1){const n=this.el.getBoundingClientRect();let r;t?r={top:n.top+document.documentElement.scrollTop,left:n.left}:r={top:this.el.offsetTop,left:this.el.offsetLeft};const a=A.left-r.left,u=A.top-r.top,d=n.width/this.getColumn(),h=n.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(a/d),y:Math.floor(u/h)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(A,t,n,r){return this.engine.isAreaEmpty(A,t,n,r)}makeWidget(A,t){const n=LA.getElement(A);if(!n||n.gridstackNode)return n;n.parentElement||this.el.appendChild(n),this._prepareElement(n,!0,t);const r=n.gridstackNode;this._updateContainerHeight(),r.subGridOpts&&this.makeSubGrid(n,r.subGridOpts,void 0,!1);let a;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(a=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),a&&delete this._ignoreLayoutsNodeChange,n}on(A,t){return A.indexOf(" ")!==-1?(A.split(" ").forEach(n=>this.on(n,t)),this):(A==="change"||A==="added"||A==="removed"||A==="enable"||A==="disable"?(A==="enable"||A==="disable"?this._gsEventHandler[A]=n=>t(n):this._gsEventHandler[A]=n=>{n.detail&&t(n,n.detail)},this.el.addEventListener(A,this._gsEventHandler[A])):A==="drag"||A==="dragstart"||A==="dragstop"||A==="resizestart"||A==="resize"||A==="resizestop"||A==="dropped"||A==="resizecontent"?this._gsEventHandler[A]=t:console.error("GridStack.on("+A+") event not supported"),this)}off(A){return A.indexOf(" ")!==-1?(A.split(" ").forEach(t=>this.off(t)),this):((A==="change"||A==="added"||A==="removed"||A==="enable"||A==="disable")&&this._gsEventHandler[A]&&this.el.removeEventListener(A,this._gsEventHandler[A]),delete this._gsEventHandler[A],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(A=>this.off(A)),this}removeWidget(A,t=!0,n=!0){return A?(LA.getElements(A).forEach(r=>{if(r.parentElement&&r.parentElement!==this.el)return;let a=r.gridstackNode;a||(a=this.engine.nodes.find(u=>r===u.el)),a&&(t&&LA.addRemoveCB&&LA.addRemoveCB(this.el,a,!1,!1),delete r.gridstackNode,this._removeDD(r),this.engine.removeNode(a,t,n),t&&r.parentElement&&r.remove())}),n&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(A=!0,t=!0){return this.engine.nodes.forEach(n=>{A&&LA.addRemoveCB&&LA.addRemoveCB(this.el,n,!1,!1),delete n.el.gridstackNode,this.opts.staticGrid||this._removeDD(n.el)}),this.engine.removeAll(A,t),t&&this._triggerRemoveEvent(),this}setAnimation(A=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(A)}):A?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=A,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(A,t=!0,n=!0){return!!this.opts.staticGrid===A?this:(A?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(r=>{this.prepareDragDrop(r.el),r.subGrid&&n&&r.subGrid.setStatic(A,t,n)}),t&&this._setStaticClass(),this)}updateOptions(A){const t=this.opts;return A===t?this:(A.acceptWidgets!==void 0&&(t.acceptWidgets=A.acceptWidgets,this._setupAcceptWidget()),A.animate!==void 0&&this.setAnimation(A.animate),A.cellHeight&&this.cellHeight(A.cellHeight),A.class!==void 0&&A.class!==t.class&&(t.class&&this.el.classList.remove(t.class),A.class&&this.el.classList.add(A.class)),A.columnOpts?(this.opts.columnOpts=A.columnOpts,this.checkDynamicColumn()):A.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof A.column=="number"&&this.column(A.column),A.margin!==void 0&&this.margin(A.margin),A.staticGrid!==void 0&&this.setStatic(A.staticGrid),A.disableDrag!==void 0&&!A.staticGrid&&this.enableMove(!A.disableDrag),A.disableResize!==void 0&&!A.staticGrid&&this.enableResize(!A.disableResize),A.float!==void 0&&this.float(A.float),A.row!==void 0?(t.minRow=t.maxRow=t.row=A.row,this._updateContainerHeight()):(A.minRow!==void 0&&(t.minRow=A.minRow,this._updateContainerHeight()),A.maxRow!==void 0&&(t.maxRow=A.maxRow)),A.lazyLoad!==void 0&&(t.lazyLoad=A.lazyLoad),A.children?.length&&this.load(A.children),this)}update(A,t){return LA.getElements(A).forEach(n=>{const r=n?.gridstackNode;if(!r)return;const a={...q.copyPos({},r),...q.cloneDeep(t)};this.engine.nodeBoundFix(a),delete a.autoPosition;const u=["x","y","w","h"];let d;if(u.some(B=>a[B]!==void 0&&a[B]!==r[B])&&(d={},u.forEach(B=>{d[B]=a[B]!==void 0?a[B]:r[B],delete a[B]})),!d&&(a.minW||a.minH||a.maxW||a.maxH)&&(d={}),a.content!==void 0){const B=n.querySelector(".grid-stack-item-content");B&&B.textContent!==a.content&&(r.content=a.content,LA.renderCB(B,a),r.subGrid?.el&&(B.appendChild(r.subGrid.el),r.subGrid._updateContainerHeight())),delete a.content}let h=!1,g=!1;for(const B in a)B[0]!=="_"&&r[B]!==a[B]&&(r[B]=a[B],h=!0,g=g||!this.opts.staticGrid&&(B==="noResize"||B==="noMove"||B==="locked"));if(q.sanitizeMinMax(r),d){const B=d.w!==void 0&&d.w!==r.w;this.moveNode(r,d),B&&r.subGrid?r.subGrid.onResize(this.hasAnimationCSS()?r.w:void 0):this.resizeToContentCheck(B,r),delete r._orig}(d||h)&&this._writeAttr(n,r),g&&this.prepareDragDrop(r.el),LA.updateCB&&LA.updateCB(r)}),this}moveNode(A,t){const n=A._updating;n||this.engine.cleanNodes().beginUpdate(A),this.engine.moveNode(A,t),this._updateContainerHeight(),n||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(A){if(!A||(A.classList.remove("size-to-content-max"),!A.clientHeight))return;const t=A.gridstackNode;if(!t)return;const n=t.grid;if(!n||A.parentElement!==n.el)return;const r=n.getCellHeight(!0);if(!r)return;let a=t.h?t.h*r:A.clientHeight,u;if(t.resizeToContentParent&&(u=A.querySelector(t.resizeToContentParent)),u||(u=A.querySelector(LA.resizeToContentParent)),!u)return;const d=A.clientHeight-u.clientHeight,h=t.h?t.h*r-d:u.clientHeight;let g;if(t.subGrid){g=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);const m=t.subGrid.el.getBoundingClientRect(),v=A.getBoundingClientRect();g+=m.top-v.top}else{if(t.subGridOpts?.children?.length)return;{const m=u.firstElementChild;if(!m){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${LA.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}g=m.getBoundingClientRect().height||h}}if(h===g)return;a+=g-h;let B=Math.ceil(a/r);const w=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;w&&B>w&&(B=w,A.classList.add("size-to-content-max")),t.minH&&B<t.minH?B=t.minH:t.maxH&&B>t.maxH&&(B=t.maxH),B!==t.h&&(n._ignoreLayoutsNodeChange=!0,n.moveNode(t,{h:B}),delete n._ignoreLayoutsNodeChange)}resizeToContentCBCheck(A){LA.resizeToContentCB?LA.resizeToContentCB(A):this.resizeToContent(A)}rotate(A,t){return LA.getElements(A).forEach(n=>{const r=n.gridstackNode;if(!q.canBeRotated(r))return;const a={w:r.h,h:r.w,minH:r.minW,minW:r.minH,maxH:r.maxW,maxW:r.maxH};if(t){const d=t.left>0?Math.floor(t.left/this.cellWidth()):0,h=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;a.x=r.x+d-(r.h-(h+1)),a.y=r.y+h-d}Object.keys(a).forEach(d=>{a[d]===void 0&&delete a[d]});const u=r._orig;this.update(n,a),r._orig=u}),this}margin(A){if(!(typeof A=="string"&&A.split(" ").length>1)){const t=q.parseHeight(A);if(this.opts.marginUnit===t.unit&&this.opts.margin===t.h)return}return this.opts.margin=A,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(A){return this.engine.willItFit(A)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const A=this.engine.getDirtyNodes(!0);return A&&A.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(A),this._triggerEvent("change",A)),this.engine.saveInitial(),this}_triggerAddEvent(){if(this.engine.batchMode)return this;if(this.engine.addedNodes?.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(t=>{delete t._dirty});const A=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",A)}return this}_triggerRemoveEvent(){if(this.engine.batchMode)return this;if(this.engine.removedNodes?.length){const A=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",A)}return this}_triggerEvent(A,t){const n=t?new CustomEvent(A,{bubbles:!1,detail:t}):new Event(A);let r=this;for(;r.parentGridNode;)r=r.parentGridNode.grid;return r.el.dispatchEvent(n),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const A=this.parentGridNode;let t=this.getRow()+this._extraDragRow;const n=this.opts.cellHeight,r=this.opts.cellHeightUnit;if(!n)return this;if(!A&&!this.opts.minRow){const a=q.parseHeight(getComputedStyle(this.el).minHeight);if(a.h>0&&a.unit===r){const u=Math.floor(a.h/n);t<u&&(t=u)}}return this.el.setAttribute("gs-current-row",String(t)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),t&&(this.el.style[A?"minHeight":"height"]=t*n+r),A&&q.shouldSizeToContent(A)&&A.grid.resizeToContentCBCheck(A.el),this}_prepareElement(A,t=!1,n){n=n||this._readAttr(A),A.gridstackNode=n,n.el=A,n.grid=this,n=this.engine.addNode(n,t),this._writeAttr(A,n),A.classList.add(Ue.itemClass,this.opts.itemClass);const r=q.shouldSizeToContent(n);return r?A.classList.add("size-to-content"):A.classList.remove("size-to-content"),r&&this.resizeToContentCheck(!1,n),q.lazyLoad(n)||this.prepareDragDrop(n.el),this}_writePosAttr(A,t){return(!t._moving&&!t._resizing||this._placeholder===A)&&(A.style.top=t.y?t.y===1?"var(--gs-cell-height)":`calc(${t.y} * var(--gs-cell-height))`:null,A.style.left=t.x?t.x===1?"var(--gs-column-width)":`calc(${t.x} * var(--gs-column-width))`:null,A.style.width=t.w>1?`calc(${t.w} * var(--gs-column-width))`:null,A.style.height=t.h>1?`calc(${t.h} * var(--gs-cell-height))`:null),A.setAttribute("gs-x",String(t.x)),A.setAttribute("gs-y",String(t.y)),t.w>1?A.setAttribute("gs-w",String(t.w)):A.removeAttribute("gs-w"),t.h>1?A.setAttribute("gs-h",String(t.h)):A.removeAttribute("gs-h"),this}_writeAttr(A,t){if(!t)return this;this._writePosAttr(A,t);const n={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const r in n)t[r]?A.setAttribute(n[r],String(t[r])):A.removeAttribute(n[r]);return this}_readAttr(A,t=!0){const n={};n.x=q.toNumber(A.getAttribute("gs-x")),n.y=q.toNumber(A.getAttribute("gs-y")),n.w=q.toNumber(A.getAttribute("gs-w")),n.h=q.toNumber(A.getAttribute("gs-h")),n.autoPosition=q.toBool(A.getAttribute("gs-auto-position")),n.noResize=q.toBool(A.getAttribute("gs-no-resize")),n.noMove=q.toBool(A.getAttribute("gs-no-move")),n.locked=q.toBool(A.getAttribute("gs-locked"));const r=A.getAttribute("gs-size-to-content");r&&(r==="true"||r==="false"?n.sizeToContent=q.toBool(r):n.sizeToContent=parseInt(r,10)),n.id=A.getAttribute("gs-id"),n.maxW=q.toNumber(A.getAttribute("gs-max-w")),n.minW=q.toNumber(A.getAttribute("gs-min-w")),n.maxH=q.toNumber(A.getAttribute("gs-max-h")),n.minH=q.toNumber(A.getAttribute("gs-min-h")),t&&(n.w===1&&A.removeAttribute("gs-w"),n.h===1&&A.removeAttribute("gs-h"),n.maxW&&A.removeAttribute("gs-max-w"),n.minW&&A.removeAttribute("gs-min-w"),n.maxH&&A.removeAttribute("gs-max-h"),n.minH&&A.removeAttribute("gs-min-h"));for(const a in n){if(!n.hasOwnProperty(a))return;!n[a]&&n[a]!==0&&a!=="sizeToContent"&&delete n[a]}return n}_setStaticClass(){const A=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...A),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...A),this.el.removeAttribute("gs-static")),this}onResize(A=this.el?.clientWidth){if(!A||this.prevWidth===A)return;this.prevWidth=A,this.batchUpdate();let t=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),t=!0):t=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(n=>{n.subGrid&&n.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(t),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(A=!1,t=void 0){if(this.engine){if(A&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,t),this.animationDelay);if(t)q.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(n=>q.shouldSizeToContent(n))){const n=[...this.engine.nodes];this.batchUpdate(),n.forEach(r=>{q.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,t?[t]:this.engine.nodes)}}_updateResizeEvent(A=!1){const t=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(n=>n.sizeToContent));return!A&&t&&!this.resizeObserver?(this._sizeThrottle=q.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(A||!t)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(A=".grid-stack-item"){return q.getElement(A)}static getElements(A=".grid-stack-item"){return q.getElements(A)}static getGridElement(A){return LA.getElement(A)}static getGridElements(A){return q.getElements(A)}_initMargin(){let A,t=0,n=[];typeof this.opts.margin=="string"&&(n=this.opts.margin.split(" ")),n.length===2?(this.opts.marginTop=this.opts.marginBottom=n[0],this.opts.marginLeft=this.opts.marginRight=n[1]):n.length===4?(this.opts.marginTop=n[0],this.opts.marginRight=n[1],this.opts.marginBottom=n[2],this.opts.marginLeft=n[3]):(A=q.parseHeight(this.opts.margin),this.opts.marginUnit=A.unit,t=this.opts.margin=A.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(a=>{this.opts[a]===void 0?this.opts[a]=t:(A=q.parseHeight(this.opts[a]),this.opts[a]=A.h,delete this.opts.margin)}),this.opts.marginUnit=A.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const r=this.el.style;return r.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),r.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),r.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),r.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return me}static setupDragIn(A,t,n,r=document){t?.pause!==void 0&&(TA.pauseDrag=t.pause),t={appendTo:"body",helper:"clone",...t||{}},(typeof A=="string"?q.getElements(A,r):A).forEach((a,u)=>{me.isDraggable(a)||me.dragIn(a,t),n?.[u]&&(a.gridstackNode=n[u])})}movable(A,t){return this.opts.staticGrid?this:(LA.getElements(A).forEach(n=>{const r=n.gridstackNode;r&&(t?delete r.noMove:r.noMove=!0,this.prepareDragDrop(r.el))}),this)}resizable(A,t){return this.opts.staticGrid?this:(LA.getElements(A).forEach(n=>{const r=n.gridstackNode;r&&(t?delete r.noResize:r.noResize=!0,this.prepareDragDrop(r.el))}),this)}disable(A=!0){if(!this.opts.staticGrid)return this.enableMove(!1,A),this.enableResize(!1,A),this._triggerEvent("disable"),this}enable(A=!0){if(!this.opts.staticGrid)return this.enableMove(!0,A),this.enableResize(!0,A),this._triggerEvent("enable"),this}enableMove(A,t=!0){return this.opts.staticGrid?this:(A?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(n=>{this.prepareDragDrop(n.el),n.subGrid&&t&&n.subGrid.enableMove(A,t)}),this)}enableResize(A,t=!0){return this.opts.staticGrid?this:(A?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(n=>{this.prepareDragDrop(n.el),n.subGrid&&t&&n.subGrid.enableResize(A,t)}),this)}cancelDrag(){const A=this._placeholder?.gridstackNode;A&&(A._isExternal?(A._isAboutToRemove=!0,this.engine.removeNode(A)):A._isAboutToRemove&&LA._itemRemoving(A.el,!1),this.engine.restoreInitial())}_removeDD(A){return me.draggable(A,"destroy").resizable(A,"destroy"),A.gridstackNode&&delete A.gridstackNode._initDD,delete A.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return me.droppable(this.el,"destroy"),this;let A,t;const n=(r,a,u)=>{u=u||a;const d=u.gridstackNode;if(!d)return;if(!d.grid?.el){u.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const m=u.getBoundingClientRect();u.style.left=m.x+(this.dragTransform.xScale-1)*(r.clientX-m.x)/this.dragTransform.xScale+"px",u.style.top=m.y+(this.dragTransform.yScale-1)*(r.clientY-m.y)/this.dragTransform.yScale+"px",u.style.transformOrigin="0px 0px"}let{top:h,left:g}=u.getBoundingClientRect();const B=this.el.getBoundingClientRect();g-=B.left,h-=B.top;const w={position:{top:h*this.dragTransform.xScale,left:g*this.dragTransform.yScale}};if(d._temporaryRemoved){if(d.x=Math.max(0,Math.round(g/t)),d.y=Math.max(0,Math.round(h/A)),delete d.autoPosition,this.engine.nodeBoundFix(d),!this.engine.willItFit(d)){if(d.autoPosition=!0,!this.engine.willItFit(d)){me.off(a,"drag");return}d._willFitPos&&(q.copyPos(d,d._willFitPos),delete d._willFitPos)}this._onStartMoving(u,r,w,d,t,A)}else this._dragOrResize(u,r,w,d,t,A)};return me.droppable(this.el,{accept:r=>{const a=r.gridstackNode||this._readAttr(r,!1);if(a?.grid===this)return!0;if(!this.opts.acceptWidgets)return!1;let u=!0;if(typeof this.opts.acceptWidgets=="function")u=this.opts.acceptWidgets(r);else{const d=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;u=r.matches(d)}if(u&&a&&this.opts.maxRow){const d={w:a.w,h:a.h,minW:a.minW,minH:a.minH};u=this.engine.willItFit(d)}return u}}).on(this.el,"dropover",(r,a,u)=>{let d=u?.gridstackNode||a.gridstackNode;if(d?.grid===this&&!d._temporaryRemoved)return!1;if(d?._sidebarOrig&&(d.w=d._sidebarOrig.w,d.h=d._sidebarOrig.h),d?.grid&&d.grid!==this&&!d._temporaryRemoved&&d.grid._leave(a,u),u=u||a,t=this.cellWidth(),A=this.getCellHeight(!0),!d){const B=u.getAttribute("data-gs-widget")||u.getAttribute("gridstacknode");if(B){try{d=JSON.parse(B)}catch{console.error("Gridstack dropover: Bad JSON format: ",B)}u.removeAttribute("data-gs-widget"),u.removeAttribute("gridstacknode")}d||(d=this._readAttr(u)),d._sidebarOrig={w:d.w,h:d.h}}d.grid||(d.el||(d={...d}),d._isExternal=!0,u.gridstackNode=d);const h=d.w||Math.round(u.offsetWidth/t)||1,g=d.h||Math.round(u.offsetHeight/A)||1;return d.grid&&d.grid!==this?(a._gridstackNodeOrig||(a._gridstackNodeOrig=d),a.gridstackNode=d={...d,w:h,h:g,grid:this},delete d.x,delete d.y,this.engine.cleanupNode(d).nodeBoundFix(d),d._initDD=d._isExternal=d._temporaryRemoved=!0):(d.w=h,d.h=g,d._temporaryRemoved=!0),LA._itemRemoving(d.el,!1),me.on(a,"drag",n),n(r,a,u),!1}).on(this.el,"dropout",(r,a,u)=>{const d=u?.gridstackNode||a.gridstackNode;return d&&(!d.grid||d.grid===this)&&(this._leave(a,u),this._isTemp&&this.removeAsSubGrid(d)),!1}).on(this.el,"drop",(r,a,u)=>{const d=u?.gridstackNode||a.gridstackNode;if(d?.grid===this&&!d._isExternal)return!1;const h=!!this.placeholder.parentElement,g=a!==u;this.placeholder.remove(),delete this.placeholder.gridstackNode,h&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const B=a._gridstackNodeOrig;if(delete a._gridstackNodeOrig,h&&B?.grid&&B.grid!==this){const m=B.grid;m.engine.removeNodeFromLayoutCache(B),m.engine.removedNodes.push(B),m._triggerRemoveEvent()._triggerChangeEvent(),m.parentGridNode&&!m.engine.nodes.length&&m.opts.subGridDynamic&&m.removeAsSubGrid()}if(!d||(h&&(this.engine.cleanupNode(d),d.grid=this),delete d.grid?._isTemp,me.off(a,"drag"),u!==a?(u.remove(),a=u):a.remove(),this._removeDD(a),!h))return!1;const w=d.subGrid?.el?.gridstack;return q.copyPos(d,this._readAttr(this.placeholder)),q.removePositioningStyles(a),g&&(d.content||d.subGridOpts||LA.addRemoveCB)?(delete d.el,a=this.addWidget(d)):(this._prepareElement(a,!0,d),this.el.appendChild(a),this.resizeToContentCheck(!1,d),w&&(w.parentGridNode=d),this._updateContainerHeight()),this.engine.addedNodes.push(d),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...r,type:"dropped"},B&&B.grid?B:void 0,d),!1}),this}static _itemRemoving(A,t){if(!A)return;const n=A?A.gridstackNode:void 0;!n?.grid||A.classList.contains(n.grid.opts.removableOptions.decline)||(t?n._isAboutToRemove=!0:delete n._isAboutToRemove,t?A.classList.add("grid-stack-item-removing"):A.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const A=document.querySelector(this.opts.removable);return A?(!this.opts.staticGrid&&!me.isDroppable(A)&&me.droppable(A,this.opts.removableOptions).on(A,"dropover",(t,n)=>LA._itemRemoving(n,!0)).on(A,"dropout",(t,n)=>LA._itemRemoving(n,!1)),this):this}prepareDragDrop(A,t=!1){const n=A?.gridstackNode;if(!n)return;const r=n.noMove||this.opts.disableDrag,a=n.noResize||this.opts.disableResize,u=this.opts.staticGrid||r&&a;if((t||u)&&(n._initDD&&(this._removeDD(A),delete n._initDD),u&&A.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!t))return this;if(!n._initDD){let d,h;const g=(m,v)=>{this.triggerEvent(m,m.target),d=this.cellWidth(),h=this.getCellHeight(!0),this._onStartMoving(A,m,v,n,d,h)},B=(m,v)=>{this._dragOrResize(A,m,v,n,d,h)},w=m=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete n._moving,delete n._resizing,delete n._event,delete n._lastTried;const v=n.w!==n._orig.w,y=m.target;if(!(!y.gridstackNode||y.gridstackNode.grid!==this)){if(n.el=y,n._isAboutToRemove){const I=A.gridstackNode.grid;I._gsEventHandler[m.type]&&I._gsEventHandler[m.type](m,y),I.engine.nodes.push(n),I.removeWidget(A,!0,!0)}else q.removePositioningStyles(y),n._temporaryRemoved?(this._writePosAttr(y,n),this.engine.addNode(n)):this._writePosAttr(y,n),this.triggerEvent(m,y);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),m.type==="resizestop"&&(Number.isInteger(n.sizeToContent)&&(n.sizeToContent=n.h),this.resizeToContentCheck(v,n))}};me.draggable(A,{start:g,stop:w,drag:B}).resizable(A,{start:g,stop:w,resize:B}),n._initDD=!0}return me.draggable(A,r?"disable":"enable").resizable(A,a?"disable":"enable"),this}_onStartMoving(A,t,n,r,a,u){if(this.engine.cleanNodes().beginUpdate(r),this._writePosAttr(this.placeholder,r),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=r,r.grid?.el)this.dragTransform=q.getValuesFromTransformedElement(A);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const d=this.placeholder.closest(".grid-stack");this.dragTransform=q.getValuesFromTransformedElement(d)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(r.el=this.placeholder,r._lastUiPosition=n.position,r._prevYPix=n.position.top,r._moving=t.type==="dragstart",r._resizing=t.type==="resizestart",delete r._lastTried,t.type==="dropover"&&r._temporaryRemoved&&(this.engine.addNode(r),r._moving=!0),this.engine.cacheRects(a,u,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){const d=this.getColumn()-r.x,h=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-r.y;me.resizable(A,"option","minWidth",a*Math.min(r.minW||1,d)).resizable(A,"option","minHeight",u*Math.min(r.minH||1,h)).resizable(A,"option","maxWidth",a*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,d)).resizable(A,"option","maxWidthMoveLeft",a*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,r.x+r.w)).resizable(A,"option","maxHeight",u*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,h)).resizable(A,"option","maxHeightMoveUp",u*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,r.y+r.h))}}_dragOrResize(A,t,n,r,a,u){const d={...r._orig};let h,g=this.opts.marginLeft,B=this.opts.marginRight,w=this.opts.marginTop,m=this.opts.marginBottom;const v=Math.round(u*.1),y=Math.round(a*.1);if(g=Math.min(g,y),B=Math.min(B,y),w=Math.min(w,v),m=Math.min(m,v),t.type==="drag"){if(r._temporaryRemoved)return;const T=n.position.top-r._prevYPix;r._prevYPix=n.position.top,this.opts.draggable.scroll!==!1&&q.updateScrollPosition(A,n.position,T);const D=n.position.left+(n.position.left>r._lastUiPosition.left?-B:g),V=n.position.top+(n.position.top>r._lastUiPosition.top?-m:w);d.x=Math.round(D/a),d.y=Math.round(V/u);const b=this._extraDragRow;if(this.engine.collide(r,d)){const K=this.getRow();let sA=Math.max(0,d.y+r.h-K);this.opts.maxRow&&K+sA>this.opts.maxRow&&(sA=Math.max(0,this.opts.maxRow-K)),this._extraDragRow=sA}else this._extraDragRow=0;if(this._extraDragRow!==b&&this._updateContainerHeight(),r.x===d.x&&r.y===d.y)return}else if(t.type==="resize"){if(d.x<0||(q.updateScrollResize(t,A,u),d.w=Math.round((n.size.width-g)/a),d.h=Math.round((n.size.height-w)/u),r.w===d.w&&r.h===d.h)||r._lastTried&&r._lastTried.w===d.w&&r._lastTried.h===d.h)return;const T=n.position.left+g,D=n.position.top+w;d.x=Math.round(T/a),d.y=Math.round(D/u),h=!0}r._event=t,r._lastTried=d;const I={x:n.position.left+g,y:n.position.top+w,w:(n.size?n.size.width:r.w*a)-g-B,h:(n.size?n.size.height:r.h*u)-w-m};if(this.engine.moveNodeCheck(r,{...d,cellWidth:a,cellHeight:u,rect:I,resizing:h})){r._lastUiPosition=n.position,this.engine.cacheRects(a,u,w,B,m,g),delete r._skipDown,h&&r.subGrid&&r.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const T=t.target;r._sidebarOrig||this._writePosAttr(T,r),this.triggerEvent(t,T)}}triggerEvent(A,t){let n=this;for(;n.parentGridNode;)n=n.parentGridNode.grid;n._gsEventHandler[A.type]&&n._gsEventHandler[A.type](A,t)}_leave(A,t){t=t||A;const n=t.gridstackNode;if(!n||(t.style.transform=t.style.transformOrigin=null,me.off(A,"drag"),n._temporaryRemoved))return;n._temporaryRemoved=!0,this.engine.removeNode(n),n.el=n._isExternal&&t?t:A;const r=n._sidebarOrig;n._isExternal&&this.engine.cleanupNode(n),n._sidebarOrig=r,this.opts.removable===!0&&LA._itemRemoving(A,!0),A._gridstackNodeOrig?(A.gridstackNode=A._gridstackNodeOrig,delete A._gridstackNodeOrig):n._isExternal&&this.engine.restoreInitial()}};rn.renderCB=(e,A)=>{e&&A?.content&&(e.textContent=A.content)},rn.resizeToContentParent=".grid-stack-item-content",rn.Utils=q,rn.Engine=Ii,rn.GDRev="12.4.2";var Pm={class:"d-layout"},Gm=["gs-id","gs-x","gs-y","gs-w","gs-h","gs-locked","gs-no-resize","gs-no-move","gs-min-w","gs-min-h","gs-max-w","gs-max-h"],zm=(0,o.defineComponent)({name:"DLayout",__name:"layout",props:{modelValue:{default:()=>[]},column:{default:24},cellHeight:{default:60},draggable:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},disable:{type:Boolean,default:!1},animate:{type:Boolean,default:!0},float:{type:Boolean,default:!0},removable:{type:Boolean,default:!1},removableOptions:{}},emits:["update:modelValue","added","removed","changed","dragStart","dragStop","resizeStart","resizeStop"],setup(e,{expose:A,emit:t}){const n=e,r=t,a=(0,o.ref)();let u=null;const d=async()=>{a.value&&(await(0,o.nextTick)(),u&&u.destroy(!1),u=rn.init({column:n.column,cellHeight:n.cellHeight,disableDrag:!(n.draggable&&!n.disable),disableResize:!(n.resizable&&!n.disable),animate:n.animate,float:n.float,removable:n.removable,removableOptions:n.removableOptions},a.value),u.on("added",(m,v)=>{const y=v[0];y&&(r("added",h(y)),B())}),u.on("removed",(m,v)=>{const y=v[0];y&&(r("removed",h(y)),B())}),u.on("change",()=>{B(),r("changed",(u?.save()||[]).map(m=>h(m)))}),u.on("dragstart",(m,v)=>{v&&r("dragStart",m,h(v.gridstackNode||v))}),u.on("dragstop",(m,v)=>{v&&r("dragStop",m,h(v.gridstackNode||v))}),u.on("resizestart",(m,v)=>{v&&r("resizeStart",m,h(v.gridstackNode||v))}),u.on("resizestop",(m,v)=>{v&&r("resizeStop",m,h(v.gridstackNode||v))}))},h=m=>({id:m.id||m.el?.getAttribute("gs-id")||"",x:m.x||0,y:m.y||0,w:m.w||1,h:m.h||1,locked:m.locked||!1,noResize:m.noResize||!1,noMove:m.noMove||!1,minW:m.minW,minH:m.minH,maxW:m.maxW,maxH:m.maxH}),g=async()=>{if(!u||!a.value)return;await(0,o.nextTick)();const m=u.engine.nodes;new Set(m.map(y=>y.id));const v=new Set(n.modelValue.map(y=>y.id));m.forEach(y=>{if(!v.has(y.id||"")){const I=y.el;I&&u&&u.removeWidget(I,!1)}}),n.modelValue.forEach(y=>{const I=m.find(T=>T.id===y.id);if(I)I.el&&u&&u.update(I.el,{x:y.x,y:y.y,w:y.w,h:y.h,locked:y.locked,noResize:y.noResize,noMove:y.noMove,minW:y.minW,minH:y.minH,maxW:y.maxW,maxH:y.maxH});else{if(!a.value||!u)return;const T=a.value.querySelector(`[gs-id="${y.id}"]`);T&&u.makeWidget(T)}})},B=()=>{u&&r("update:modelValue",u.save().map(m=>{const v={id:m.id||"",x:m.x||0,y:m.y||0,w:m.w||1,h:m.h||1},y=n.modelValue.find(I=>I.id===v.id);return y&&Object.keys(y).forEach(I=>{["id","x","y","w","h"].includes(I)||(v[I]=y[I])}),v}))},w=(0,o.computed)(()=>n.modelValue);return(0,o.watch)(()=>n.modelValue,async()=>{u&&(await(0,o.nextTick)(),g())},{deep:!0}),(0,o.watch)(()=>[n.column,n.cellHeight,n.draggable,n.resizable,n.disable,n.animate,n.float,n.removable],()=>{d()}),(0,o.onMounted)(()=>{d()}),(0,o.onBeforeUnmount)(()=>{u&&(u.destroy(!1),u=null)}),A({addItem:async m=>{if(u&&a.value){await(0,o.nextTick)();const v=a.value.querySelector(`[gs-id="${m.id}"]`);v&&(u.makeWidget(v),u.update(v,{x:m.x,y:m.y,w:m.w,h:m.h,locked:m.locked,noResize:m.noResize,noMove:m.noMove,minW:m.minW,minH:m.minH,maxW:m.maxW,maxH:m.maxH}))}},removeItem:m=>{if(u&&a.value){const v=a.value.querySelector(`[gs-id="${m}"]`);v&&u.removeWidget(v,!1)}},clear:()=>{u&&u.removeAll(!1)},getGrid:()=>u}),(m,v)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",Pm,[(0,o.createElementVNode)("div",{ref_key:"gridContainerRef",ref:a},[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(w.value,y=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:y.id,"gs-id":y.id,"gs-x":y.x,"gs-y":y.y,"gs-w":y.w,"gs-h":y.h,"gs-locked":y.locked,"gs-no-resize":y.noResize,"gs-no-move":y.noMove,"gs-min-w":y.minW,"gs-min-h":y.minH,"gs-max-w":y.maxW,"gs-max-h":y.maxH,class:"d-layout-item"},[(0,o.renderSlot)(m.$slots,"item",{item:y})],8,Gm))),128))],512)]))}}),Xm=zm,Ql=ft(Xm),JA=(e,A="",t=!1)=>t?`${e}pt`:A?`${e}${A}`:`${e}px`,Ye=(e,A=0)=>e==null||isNaN(e)?0:Number(Number(e).toFixed(A)),$m=e=>e*3/4,Ym=e=>e*4/3,Wm=["onMousedown"],Jm={key:2,class:"d-draggable__mask"},Zm=(0,o.defineComponent)({name:"DDraggable",__name:"draggable",props:{index:{},mask:{type:Boolean,default:!0},scale:{default:1},readonly:{type:Boolean,default:!1},resize:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},step:{default:1},zIndex:{default:1},isActiveBgTransparent:{type:Boolean,default:!1},left:{default:0},top:{default:0},width:{},height:{},activeFlag:{type:Boolean,default:!1},isPt:{type:Boolean,default:!1}},emits:["focus","blur","over","out"],setup(e,{expose:A,emit:t}){let n=0;const r=e,a=t,u=[{classname:"left"},{classname:"right"},{classname:"top"},{classname:"bottom"},{classname:"top-left"},{classname:"top-right"},{classname:"bottom-left"},{classname:"bottom-right"}],d={right:{resizeX:!0},left:{resizeX:!0,moveLeft:!0,invertX:!0},top:{resizeY:!0,moveTop:!0,invertY:!0},bottom:{resizeY:!0},"bottom-right":{resizeX:!0,resizeY:!0},"bottom-left":{resizeX:!0,resizeY:!0,moveLeft:!0,invertX:!0},"top-right":{resizeX:!0,resizeY:!0,moveTop:!0,invertY:!0},"top-left":{resizeX:!0,resizeY:!0,moveLeft:!0,moveTop:!0,invertX:!0,invertY:!0}},h=(0,o.ref)(),g=(0,o.ref)(),B=()=>g.value?.firstElementChild,w=(0,o.ref)(0),m=(0,o.ref)(0),v=(0,o.ref)(0),y=(0,o.ref)(0),I=(0,o.ref)(!1),T=(0,o.ref)(!1),D=(0,o.ref)(!1);let V=null;const b=(0,o.computed)(()=>r.scale),K=(0,o.computed)(()=>!r.readonly&&!r.disabled),sA=(0,o.computed)(()=>K.value&&(D.value||T.value||I.value)),W=(0,o.computed)(()=>!r.disabled&&r.mask),cA=(0,o.computed)(()=>{const J=8*b.value;return{width:JA(J,"",r.isPt),height:JA(J,"",r.isPt)}}),lA=(0,o.computed)(()=>({fontSize:JA(14*b.value,"",r.isPt),padding:JA(4*b.value,"",r.isPt),"border-radius":JA(2*b.value,"",r.isPt)})),oA=(0,o.computed)(()=>{const J={zIndex:D.value?9999:r.zIndex,top:JA(y.value,"",r.isPt),width:JA(w.value,"",r.isPt),height:JA(m.value,"",r.isPt),left:JA(v.value,"",r.isPt)};return D.value&&r.isActiveBgTransparent&&K.value&&(J.backgroundColor="color-mix(in srgb, var(--j-color-primary-bg) 60%, transparent)"),J});(0,o.watch)(()=>r.width,J=>S(J)),(0,o.watch)(()=>r.height,J=>eA(J)),(0,o.watch)(()=>r.left,J=>H(J)),(0,o.watch)(()=>r.top,J=>X(J)),(0,o.watch)(w,J=>{h.value&&(h.value.style.width=JA(J,"",r.isPt),r.resize&&B()?.style&&(B().style.width=JA(J,"",r.isPt)))}),(0,o.watch)(m,J=>{h.value&&(h.value.style.height=JA(J,"",r.isPt),r.resize&&B()?.style&&(B().style.height=JA(J,"",r.isPt)))}),(0,o.watch)(()=>r.activeFlag,J=>{iA(J)});const iA=J=>{D.value=J},AA=J=>J===void 0?0:r.isPt?Ym(J):J,S=J=>{w.value=Ye(AA(J))||(B()?.offsetWidth??0)},eA=J=>{m.value=Ye(AA(J))||(B()?.offsetHeight??0)},H=J=>{v.value=Ye(AA(J))},X=J=>{y.value=Ye(AA(J))},U=()=>({index:r.index,width:BA(w.value),height:BA(m.value),left:BA(v.value),top:BA(y.value)}),L=J=>{const _=U();switch(J){case"focus":a("focus",_);break;case"blur":a("blur",_);break;case"over":a("over",_);break;case"out":a("out",_);break}},k=()=>{S(r.width),eA(r.height),H(r.left),X(r.top),iA(r.activeFlag)},N=J=>{v.value=J},O=J=>{y.value=J},Y=J=>{const _=8*b.value/2,F={};return J.split("-").forEach(x=>{F[x]=JA(-_,"",r.isPt)}),F},tA=J=>{T.value=J},BA=J=>r.isPt?$m(J):J,HA=(J=!0)=>{n+=1,I.value=!0,J&&L("focus")},nA=()=>{n=Math.max(0,n-1),I.value=!1,L("blur")},Z=()=>{V?.(),V=null},$=(J,_)=>{let F=J.clientX,x=J.clientY,G=0,P=0,dA=0,gA=!1;const EA=document.body.style.userSelect;document.body.style.userSelect="none";const FA=()=>{if(dA=0,G===0&&P===0)return;const KA=G,ee=P;G=0,P=0,_(KA,ee)},NA=KA=>{I.value=!0;const ee=KA.clientX-F,qA=KA.clientY-x;if(F=KA.clientX,x=KA.clientY,!gA){gA=!0,_(ee,qA);return}G+=ee,P+=qA,dA||(dA=requestAnimationFrame(FA))},OA=()=>{dA&&(cancelAnimationFrame(dA),FA()),Z(),nA()};Z(),document.addEventListener("mousemove",NA),document.addEventListener("mouseup",OA),V=()=>{dA&&(cancelAnimationFrame(dA),dA=0),document.body.style.userSelect=EA,document.removeEventListener("mousemove",NA),document.removeEventListener("mouseup",OA)}},uA=(J,_,F)=>{if(J.resizeX){let x=_*r.step;J.invertX&&(x=-x),J.moveLeft&&(v.value=Ye(v.value-x)),w.value=Ye(w.value+x)}if(J.resizeY){let x=F*r.step;J.invertY&&(x=-x),J.moveTop&&(y.value=Ye(y.value-x)),m.value=Ye(m.value+x)}},wA=(J,_)=>{if(!K.value)return;const F=d[_];HA(!1),$(J,(x,G)=>uA(F,x,G))},QA=()=>{n>0||(T.value=!1,L("out"))},SA=()=>{n>0||K.value&&(T.value=!0,L("over"))},fA=J=>{if(!K.value)return;const _=D.value;D.value=!0,HA(!_),$(J,(F,x)=>{v.value=Ye(v.value+F*r.step),y.value=Ye(y.value+x*r.step)})};return(0,o.onMounted)(()=>{k()}),(0,o.onBeforeUnmount)(()=>{Z()}),A({setActive:iA,setLeft:N,setTop:O,setOverActive:tA}),(J,_)=>((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:(0,o.normalizeClass)(["d-draggable",{"d-draggable--active":(D.value||T.value)&&K.value},{"d-draggable--pt":e.isPt&&K.value},{"d-draggable--move":I.value},{"d-draggable--click":e.disabled}]),onMousedown:(0,o.withModifiers)(fA,["stop"]),onMouseenter:(0,o.withModifiers)(SA,["stop"]),onMouseleave:(0,o.withModifiers)(QA,["stop"]),style:(0,o.normalizeStyle)(oA.value)},[(0,o.createElementVNode)("div",{class:"d-draggable__wrapper",ref_key:"wrapper",ref:h},[sA.value?((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:0},[e.isPt?(0,o.createCommentVNode)("",!0):((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:0,class:"d-draggable__line d-draggable__line--label",style:(0,o.normalizeStyle)(lA.value)}," X:"+(0,o.toDisplayString)(v.value)+", Y:"+(0,o.toDisplayString)(y.value),5))],64)):(0,o.createCommentVNode)("",!0),K.value?((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:1},(0,o.renderList)(u,F=>((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:F.classname},[D.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",{key:0,class:(0,o.normalizeClass)(["d-draggable__range",`d-draggable__range--${F.classname}`]),style:(0,o.normalizeStyle)([cA.value,Y(F.classname)]),onMousedown:(0,o.withModifiers)(x=>wA(x,F.classname),["stop"])},null,46,Wm)):(0,o.createCommentVNode)("",!0)],64))),64)):(0,o.createCommentVNode)("",!0),(0,o.createElementVNode)("div",{class:"d-draggable__item",ref_key:"item",ref:g},[(0,o.renderSlot)(J.$slots,"default")],512),W.value?((0,o.openBlock)(),(0,o.createElementBlock)("div",Jm)):(0,o.createCommentVNode)("",!0)],512)],38))}}),jm=Zm,El=ft(jm),Fl=e=>{const A=qm(e.components);return{formConfig:e.form,componentList:A}},Ul=(e,A)=>{let t={},n=[];const r={},a=e;t=a.form;const u={};return a.components.forEach(d=>{const h=A[d.type];u[d.containerId]=u[d.containerId]||[];const g={id:d.id,name:d.name,type:d.type,dragType:h?.dragType||"component",componentName:h?.componentName||"",runtimeType:h?.runtimeType,groupId:d.groupId,config:d.config,isInput:h?.isInput!==!1,containerId:d.containerId,level:d.level};h?.dragType==="container"&&(g.children=[]),r[g.id]=g,u[d.containerId].push(g)}),Object.keys(u).forEach(d=>{r[d]&&(r[d].children=u[d])}),n=u.form||[],{formConfig:t,componentList:n,componentDic:r}},Jr=(e,A)=>{const t={ver:"j1",form:{...e},components:[],db:{}};return bl(A||[],t.components),t},bl=(e,A)=>{e.forEach(t=>{if(t.type==="pkey")return;const n={id:t.id,name:t.name,type:t.type,runtimeType:t.runtimeType||t.componentName||t.type,groupId:t.groupId||"",config:t.config,containerId:t.containerId,level:t.level};t.dragType==="container"&&bl(t.children||[],A),A.push(n)})},qm=e=>{const A={},t={};return e.forEach(n=>{A[n.containerId]=A[n.containerId]||[];const r={id:n.id,type:n.runtimeType,slot:n.groupId,config:{rule:[]}};n.config&&Object.keys(n.config).forEach(a=>{if(a==="required"){n.config.required&&r.config?.rule?.push({required:!0,message:n.config.requiredMsg||"请输入"});return}if(a==="patterns"){n.config.patterns.forEach(u=>{u.reg&&u.msg&&r.config?.rule?.push({pattern:new RegExp(u.reg),message:`请输入${u.msg||""}`})});return}r.config[a]=n.config[a]}),n.type==="pkey"&&(r.config.isPkey=!0),A[n.containerId].push(r),t[n.id]=r}),Object.keys(A).forEach(n=>{const r=t[n];if(r){const a=A[n];if(["j-tabs","j-collapse"].includes(r.type||"")&&r.config?.groups){const u={};a.forEach(d=>{if(d.slot!==void 0&&d.slot!==null){const h=d.slot.toString();u[h]||(u[h]=[]),delete d.slot,u[h].push(d)}}),r.children=r.config.groups.map(d=>{const h=u[d._i]||[],g={label:d.label};d.active&&r.type==="j-collapse"&&(g.active=d.active);let B;if(r.type==="j-tabs"&&r.config?.tabKey&&r.config?.options.length>0){const m=r.config.options.find(v=>v.label===d._i);m&&(B=({formData:v})=>({display:m.value.includes(v[r.config?.tabKey||""])?m.display:!m.display}))}const w={config:g,children:h};return B&&(w.getCompConfig=B),w}),delete r.config.groups}else r.children=a}}),A.form},Hl=(e,A,t,n,r,a,u,d)=>{const h=(0,o.ref)(),g=(0,o.reactive)({}),B=(0,o.computed)(()=>{const U=[];return Object.keys(g).forEach(L=>{const k=g[L];k.dragType==="component"&&k.type!=="pkey"&&U.push(k)}),U}),w=(U=[],L)=>{const k=A?.value?.init;typeof k=="function"&&k(U,L)},m=U=>r?r(U,{componentDic:g,components:B.value,configData:h.value.config}):{},v=(U,L)=>{if(h.value?.id===U)return;const k=g[U]||L;if(k?h.value=k:U===t.id?h.value=t:h.value=null,h.value){const N=a[h.value.type];N?(w(N,h.value.config),m(h.value.type)):w([])}else w([]);L&&re("dragClick",{id:L.id})},y=()=>e.value.$el.getBoundingClientRect(),I=U=>U===t.id?t:g[U]||{},T=U=>{const L=[];if(U===t.id)L.push({id:U,name:t.name});else{const k=g[U];if(k){L.push({id:U,name:k.name});const N=T(k.containerId);L.push(...N)}}return L},D=(U,L)=>{const k=g[L];if(k===void 0)return!1;const N=k.containerId;return U===N?!0:N===t.id?!1:D(U,N)},V=U=>n?n(U)||{}:{},b=(U,L,k,N)=>{if(d){const O=I(U);return d(k.componentType,{container:O,groupId:L,configData:k},N)}return!1},K=({name:U,type:L,dragType:k,isInput:N,componentName:O,runtimeType:Y},tA,BA,HA,nA=!1)=>{const Z=V(L);if(Z.id=gt(),Z.span=24,Z.componentType=L,sA(tA,Z.componentType))return;b(tA,HA,Z,!0);const $={id:Z.id,name:U,type:L,runtimeType:Y,componentName:O||"",dragType:k||"component",containerId:tA,isInput:!!N,level:g[tA]?g[tA].level+1:1,config:Z,isNewAdd:!nA,groupId:HA};return $.dragType==="container"&&($.children=[]),g[$.id]=$,I(tA).children?.splice(BA,0,$),$},sA=(U,L)=>!!(I(U).config.componentType==="gridtable"&&["divider","label","text","textEditor","viewTable","card","collapse","tabs","qrcode","barcode","tableLayout"].includes(L)),W=(U,L,k=!1)=>{let N=null;const O=I(U).children,Y=O?.findIndex(tA=>tA.id===L)||0;if(k&&O&&O.length>1){let tA=Y+1;Y>0&&(tA=Y-1),N=O[tA]}return O?.splice(Y,1),N?.id},cA=(U,L,k,N)=>{const O=I(L).children,Y=U.containerId!==L;U.containerId=L,U.groupId=N,O?.splice(k,0,U),b(L,N,U.config,Y)&&(eA(),v(U.id))},lA=U=>{let L="";const k=I(U);return k&&(k.children&&k.children.length>0&&k.children.forEach(N=>{lA(N.id)}),L=W(k.containerId,U,!0)||"",delete g[U]),h.value&&h.value.id===U&&(h.value=null,A.value.init([])),L},oA=(U,L=[])=>{const k=I(U);if(k&&k.children&&k.children.length>0){const N=[];k.children.forEach(O=>{O.groupId&&L.includes(O.groupId)&&N.push(O.id)}),N.forEach(O=>{lA(O),delete g[O]})}},iA=(U,L)=>{const k=I(U);k&&(k.children&&k.children.length>0&&k.children.forEach(N=>{N.groupId===L&&lA(N.id)}),delete g[U])},AA=U=>{const L=En(I(U));L.id=gt(),L.config.id=L.id,g[L.id]=L;const k=I(L.containerId).children,N=k?.findIndex(O=>O.id===U)||0;k?.splice(N+1,0,L)},S=()=>{t.children=[],Du(g),h.value&&(re("dragClick",{id:""}),h.value=null,A.value.init([]))},eA=()=>{h.value&&(re("dragClick",{id:""}),h.value=null,A.value.init([]))},H=U=>{const L=h.value,k=I(L.containerId).children,N=k?.findIndex(O=>O.id===L.id)||0;lA(L.id),(0,o.nextTick)(()=>{const O=u[U],Y=V(U);Y.id=L.id,Y.span=L.config.span,Y.componentType=U,Y.table=L.config.table,Y.field=L.config.field,L.config.isSubTable&&(Y.isSubTable=L.config.isSubTable);const tA={id:Y.id,name:O.name,type:U,runtimeType:O.runtimeType,componentName:O.componentName||"",dragType:L.dragType,groupId:L.groupId,containerId:L.containerId,isInput:L.isInput,level:L.level,config:Y,isNewAdd:!0};g[tA.id]=tA,k?.splice(N,0,tA)})},X=U=>{re("dragAddByClick",U)};return(0,o.provide)("d-drag-design-provide",{activedComponent:h,getDesignLocals:y,getComponent:I,getParentComponents:T,isMyChildComponent:D,selectComponent:v,addComponent:K,deleteComponent:lA,copyComponent:AA,removeComponentFromContainer:W,addComponentToContainer:cA,top:t,deleteChildren:iA,deleteChildrens:oA}),{activedComponent:h,clearComponents:S,changeComponent:H,schemaComponentDic:g,clearSelect:eA,addComponent:K,addComponentByTable:X,designComponentList:B}},Aw=(0,o.defineComponent)({__name:"formDesignItem",props:{componentData:{type:Object,default:()=>({})},globalConfig:{type:Object,default:()=>({})}},setup(e){const A=e,{t}=(0,pe.useAppInject)(),n=(0,o.computed)(()=>A.componentData.config?.notShowLabel?"":A.componentData.config?.label||""),r=(0,o.computed)(()=>n.value===""?0:A.componentData.config?.labelWidth===void 0&&A.globalConfig.labelWidth!==void 0?`${A.globalConfig.labelWidth}px`:A.componentData.config?.labelWidth?`${A.componentData.config?.labelWidth}px`:void 0),a=(0,o.computed)(()=>{const u={...A.componentData?.config};return u.size===void 0&&(u.size=A.globalConfig.size),u.display=!0,u});return(u,d)=>{const h=(0,o.resolveComponent)("j-comp"),g=(0,o.resolveComponent)("el-form-item");return e.componentData.isInput?((0,o.openBlock)(),(0,o.createBlock)(g,{key:0,"label-width":r.value,label:(0,o.unref)(t)(n.value),"label-position":A.componentData.config?.labelPosition||e.globalConfig?.labelPosition,rules:e.componentData.config?.required?[{required:!0,message:""}]:[]},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(h,{type:e.componentData?.componentName||e.componentData?.type,config:a.value,modelValue:e.componentData?.config.defaultValue},null,8,["type","config","modelValue"])]),_:1},8,["label-width","label","label-position","rules"])):e.componentData?.children?((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)(e.componentData?.componentName),(0,o.mergeProps)({key:1},e.componentData?.config,{"global-config":e.globalConfig,"component-data":e.componentData}),null,16,["global-config","component-data"])):((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)(e.componentData?.componentName),(0,o.normalizeProps)((0,o.mergeProps)({key:2},e.componentData?.config)),null,16))}}}),Il=Aw,ew={class:"d-form-design j-block"},tw={class:"d-form-design-left"},nw={class:"d-form-design-component-list"},rw={class:"j-component-tool"},ow={class:"j-component-tool-name"},iw={class:"d-form-design-center"},sw={class:"d-form-design-container"},aw={key:0,class:"j-block d-form-design-empty"},lw={class:"d-form-design-right"},cw={class:"d-form-design-panel-title"},uw={style:{margin:"0","font-size":"14px"}},dw={class:"d-form-design-panel"},fw=(0,o.defineComponent)({name:"DFormDesign",__name:"formDesign",props:{components:{default:()=>[]},componentConfigs:{default:()=>({})},componentInit:{type:Function,default:void 0},containerAddComponent:{type:Function,default:void 0},componentConfigInit:{type:Function,default:void 0},componentConfigChange:{type:Function,default:void 0},componentConfigValidate:{type:Function,default:void 0},flowComponents:{default:()=>[]},flowInit:{type:Function,default:void 0},flowComponentConfigInit:{type:Function,default:void 0},flowComponentConfigChange:{type:Function,default:void 0},flowComponentConfigs:{default:()=>({})},actions:{}},setup(e,{expose:A}){const t=e,{t:n,error:r}=(0,pe.useAppInject)(),a=(0,o.reactive)({name:"表单",id:"form",type:"form",level:0,children:[],dragType:"container",componentName:"",containerId:"",isInput:!1,config:{}}),u=(0,o.ref)([]),d=t.components.length;for(let nA=0;nA<d;nA++)u.value.push(nA);t.componentInit&&(a.config=t.componentInit("form")||{});const h={},g=[];t.components.forEach(({children:nA})=>{nA.forEach(Z=>{h[Z.type]=Z,Z.dragType=Z.dragType||"component",Z.isInput!==!1&&(Z.isInput=!0,g.push({label:Z.name,value:Z.type}))})});const B=nA=>{nA.forEach(Z=>{Z.type==="d-input-flow"&&(Z.config=Z.config||{},Z.config.flowComponents=t.flowComponents,Z.config.flowInit=t.flowInit,Z.config.flowComponentConfigInit=$=>{t.flowComponentConfigInit&&($.designComponents=sA.value,$.component=D.value,t.flowComponentConfigInit($))},Z.config.flowComponentConfigs=t.flowComponentConfigs,Z.config.flowComponentConfigChange=t.flowComponentConfigChange),Z.children&&B(Z.children)})},w={};Object.keys(t.componentConfigs||{}).forEach(nA=>{const{hasBase:Z,isInput:$,hasTwoPlaceholder:uA,hasPlaceholder:wA,hasSpan:QA,hasLabel:SA,bindTable:fA,labelTitle:J}=h[nA]||{hasBase:!1},_=[{id:"componentType",type:"j-select",config:{label:"类型",allowClear:!1,display:$,options:g}},{id:"label",type:"j-input",config:{label:J||"标题"},getCompConfig:({formData:x})=>({display:SA!==!1&&!x.notShowLabel})},{id:"notShowLabel",type:"j-switch",config:{label:"不显示"+(J||"标题"),activeValue:!0,inactiveValue:!1},getCompConfig:({formData:x})=>({display:SA!==!1&&!x.isSubTable})},{id:"labelWidth",type:"j-number",config:{label:"标题宽度"},getCompConfig:({formData:x})=>({display:$&&!x.notShowLabel&&!x.isSubTable})},{id:"labelPosition",type:"j-radio",config:{label:"标题对齐",options:[{value:"right",label:"右"},{value:"left",label:"左"},{value:"top",label:"顶部"}]},getCompConfig:({formData:x})=>({display:$&&!x.notShowLabel&&!x.isSubTable})},{id:"placeholder",type:"j-input",config:{display:$&&!uA&&wA!==!1,label:"占位提示"}},{id:"startPlaceholder",type:"j-input",config:{display:!!uA,label:"开始占位"}},{id:"endPlaceholder",type:"j-input",config:{display:!!uA,label:"结束占位"}},{id:"span",type:"j-slider",config:{label:"表单栅栏",min:6,max:24,showTooltip:!0,step:6,showStops:!0,defautValue:24},getCompConfig:({formData:x})=>({display:QA!==!1&&!x.isSubTable})},{id:"width",type:"j-number",config:{label:"单元格宽度",min:1},getCompConfig:({formData:x})=>({display:!!x.isSubTable})}],F={type:"j-collapse",config:{defaultValue:[]},children:[]};Z!==!1&&F.children?.push({config:{label:"基础信息"},children:[..._]}),F.children?.push(...t.componentConfigs[nA]),F.children?.forEach((x,G)=>{F.config?.defaultValue.push(`_collapse${G}`)}),B(F.children||[]),w[nA]=[F]});const m=nA=>{const{value:Z}=nA||{};nA.id==="componentType"&&b(Z),D.value&&t.componentConfigChange&&t.componentConfigChange(D.value.type,{configRef:T,configData:D.value.config,...nA})},v=(nA,Z)=>{t.componentConfigInit&&t.componentConfigInit(nA,{configRef:T,...Z})},y=(nA,Z,$)=>{let uA=!1;return Z.container.type==="gridtable"?(!Z.configData.isSubTable||$)&&(Z.configData.isSubTable=!0,uA=!0):Z.configData.isSubTable&&(uA=!0,Z.configData.isSubTable=!1),t.containerAddComponent&&t.containerAddComponent(nA,Z),uA},I=(0,o.ref)(),T=(0,o.ref)(),{activedComponent:D,clearComponents:V,changeComponent:b,schemaComponentDic:K,designComponentList:sA}=Hl(I,T,a,t.componentInit,v,w,h,y),W=(0,o.computed)(()=>D.value?.id!="form"?D.value?`${D.value.name}-${D.value.id}`:"":D.value?`${D.value.name}`:"");(0,o.provide)("dui-design-provide",{designItemName:Il});const cA=()=>{V()},lA=()=>{t.componentInit&&(a.config=t.componentInit("form")||{}),V()},oA=()=>Jr(a.config,a.children||[]),iA=nA=>{const Z=Ul(nA,h);a.config=Z.formConfig,a.children?.push(...Z.componentList),Object.keys(Z.componentDic).forEach($=>{K[$]=Z.componentDic[$]})},AA=()=>S(Jr(a.config,a.children||[]).components),S=nA=>{for(const Z of nA)if(t.componentConfigValidate&&!t.componentConfigValidate(Z.type,{configData:Z.config,errorTip:r}))return!1;return!0},eA=(0,o.ref)(),H=(0,o.ref)(),X=(0,o.ref)({});let U=0;const L=nA=>{if(H.value)U=0,H.value.init(nA||[]);else{if(U>600){console.warn("表单组件加载超时");return}U++,setTimeout(()=>{L(nA)},100)}},k=()=>{},N=()=>{};return A({getSchema:()=>oA(),setSchema:nA=>iA(nA),reset:()=>lA(),validate:()=>AA(),preview:()=>{const nA=Jr(a.config,a.children||[]);eA.value.open("表单预览",nA.form.layerType);const{formConfig:Z,componentList:$}=Fl(nA);X.value=Z,(0,o.nextTick)(()=>{L($)})},clear:cA}),(nA,Z)=>{const $=(0,o.resolveComponent)("j-icon"),uA=(0,o.resolveComponent)("d-drag-tool"),wA=(0,o.resolveComponent)("el-collapse-item"),QA=(0,o.resolveComponent)("el-collapse"),SA=(0,o.resolveComponent)("el-empty"),fA=(0,o.resolveComponent)("d-drag-form-list"),J=(0,o.resolveComponent)("el-row"),_=(0,o.resolveComponent)("d-drag-container"),F=(0,o.resolveComponent)("j-form"),x=(0,o.resolveComponent)("j-layer");return(0,o.openBlock)(),(0,o.createElementBlock)("div",ew,[(0,o.createElementVNode)("div",tw,[(0,o.createElementVNode)("div",nw,[(0,o.createVNode)(QA,{modelValue:u.value,"onUpdate:modelValue":Z[0]||(Z[0]=G=>u.value=G)},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(e.components,(G,P)=>((0,o.openBlock)(),(0,o.createBlock)(wA,{key:P,title:G.name,name:P},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(G.children,(dA,gA)=>((0,o.openBlock)(),(0,o.createBlock)(uA,{key:gA,config:dA},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",rw,[(0,o.createVNode)($,{class:"j-component-tool-icon",icon:dA.icon,size:14},null,8,["icon"]),(0,o.createElementVNode)("div",ow,(0,o.toDisplayString)((0,o.unref)(n)(dA.name)),1)])]),_:2},1032,["config"]))),128))]),_:2},1032,["title","name"]))),128))]),_:1},8,["modelValue"])])]),(0,o.createElementVNode)("div",iw,[(0,o.createElementVNode)("div",sw,[(0,o.createVNode)(_,{ref_key:"dragContainer",ref:I,class:"d-form-design-drag-container","is-component-container":!1,"component-data":a},{default:(0,o.withCtx)(()=>[!a.children||a.children.length===0?((0,o.openBlock)(),(0,o.createElementBlock)("div",aw,[(0,o.createVNode)(SA,{description:(0,o.unref)(n)("请从左侧拖拽组件到此处"),"image-size":100},null,8,["description"])])):((0,o.openBlock)(),(0,o.createBlock)(J,{key:1},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(fA,{"component-list":a.children,"global-config":a.config},null,8,["component-list","global-config"])]),_:1}))]),_:1},8,["component-data"])])]),(0,o.withDirectives)((0,o.createElementVNode)("div",lw,[(0,o.createElementVNode)("div",cw,[(0,o.createElementVNode)("span",uw,(0,o.toDisplayString)(`${W.value}`),1)]),(0,o.createElementVNode)("div",dw,[(0,o.createVNode)(F,{config:{labelPosition:"top",size:"small"},collapseAnimate:!1,style:{padding:"0"},ref_key:"configRef",ref:T,onChange:m},null,512)])],512),[[o.vShow,(0,o.unref)(D)]]),(0,o.createVNode)(x,{ref_key:"previewFormLayerRef",ref:eA,width:1e3,height:800,onOk:k,onClosed:N},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(F,{config:X.value,"is-preview":!0,ref_key:"previewFormRef",ref:H,actions:e.actions},null,8,["config","actions"])]),_:1},512)])}}}),gw=fw,_l=ft(gw,[Il]),Sl=(e,A)=>{const t={ver:"V3",indexPage:{...e},components:[]};return xl(A||[],t.components),t},xl=(e,A)=>{e.forEach(t=>{const n={id:t.id,name:t.name,type:t.type,runtimeType:t.runtimeType||t.componentName||t.type,groupId:t.groupId||"",config:t.config,containerId:t.containerId,level:t.level};t.dragType==="container"&&xl(t.children||[],A),A.push(n)})},hw=e=>{const A=Bw(e.components);return{pageConfig:e.indexPage,componentList:A}},Bw=e=>{const A={},t={};return e.forEach(n=>{A[n.containerId]=A[n.containerId]||[];const r={id:n.id,type:n.runtimeType,slot:n.groupId,config:{}};n.config&&Object.keys(n.config).forEach(a=>{r.config[a]=n.config[a]}),A[n.containerId].push(r),t[n.id]=r}),Object.keys(A).forEach(n=>{const r=t[n];if(r){const a=A[n];if(["j-tabs","j-collapse"].includes(r.type||"")&&r.config?.groups){const u={};a.forEach(d=>{if(d.slot!==void 0&&d.slot!==null){const h=d.slot.toString();u[h]||(u[h]=[]),delete d.slot,u[h].push(d)}}),r.children=r.config.groups.map(d=>{const h=u[d._i]||[];return{config:{label:d.label},children:h}}),delete r.config.groups}else r.children=a}}),A.indexPage||[]},pw=(e,A)=>{let t={},n=[];const r={};if(e.ver==="V3"){const a=e;t=a.indexPage;const u={};a.components.forEach(d=>{const h=A[d.type];if(!h)return;u[d.containerId]=u[d.containerId]||[];const g={id:d.id,name:d.name,type:d.type,dragType:h.dragType||"component",componentName:h.componentName||"",runtimeType:h.runtimeType,groupId:d.groupId,config:d.config,isInput:!1,containerId:d.containerId,level:d.level};r[g.id]=g,u[d.containerId].push(g),g.dragType==="container"&&(g.children=[])}),Object.keys(u).forEach(d=>{r[d]&&(r[d].children=u[d])}),n=u.indexPage||[]}return{pageConfig:t,componentList:n,componentDic:r}},mw=(0,o.defineComponent)({name:"DIndexDesignItem",__name:"indexDesignItem",props:{componentData:{type:Object,default:()=>({})},globalConfig:{type:Object,default:()=>({})}},setup(e){return(A,t)=>((0,o.openBlock)(),(0,o.createBlock)((0,o.resolveDynamicComponent)(e.componentData?.componentName),(0,o.mergeProps)(e.componentData?.config,{"global-config":e.globalConfig,"component-data":e.componentData}),null,16,["global-config","component-data"]))}}),Dl=mw,ww={class:"d-index-design j-block"},Cw={class:"d-index-design-left"},vw={class:"j-component-list"},yw={class:"j-component-tool"},Qw={class:"j-component-tool-name"},Ew={class:"d-index-design-center"},Fw={class:"design-container"},Uw={key:0,class:"j-block design-empty"},bw={class:"d-index-design-right"},Hw={class:"d-index-design-panel-title"},Iw={style:{margin:"0","font-size":"14px"}},_w={class:"d-index-design-panel"},Sw=(0,o.defineComponent)({name:"DIndexDesign",__name:"indexDesign",props:{components:{type:Array,default:()=>[]},componentConfigs:{type:Object,default:()=>({})},componentInit:Function,containerAddComponent:Function,componentConfigInit:Function,componentConfigChange:Function,flowComponents:{type:Array,default:()=>[]},flowInit:Function,flowComponentConfigInit:Function,flowComponentConfigChange:Function,flowComponentConfigs:{type:Object,default:()=>({})},actions:{type:Object,default:()=>({})}},setup(e,{expose:A}){const{t}=(0,pe.useAppInject)(),n=e,r=U=>{U.forEach(L=>{L.type==="d-input-flow"&&(L.config=L.config||{},L.config.flowComponents=n.flowComponents,L.config.flowInit=n.flowInit,L.config.flowComponentConfigInit=k=>{n.flowComponentConfigInit&&(k.designComponents=T.value,k.component=v.value,n.flowComponentConfigInit(k))},L.config.flowComponentConfigs=n.flowComponentConfigs,L.config.flowComponentConfigChange=n.flowComponentConfigChange),L.children&&r(L.children)})},a=(0,o.reactive)({name:"页面",id:"indexPage",type:"indexPage",level:0,children:[],dragType:"container",componentName:"",containerId:"",isInput:!1,config:{}});n.componentInit&&(a.config=n.componentInit("indexPage")||{});const u={},d=[];n.components.forEach(({children:U})=>{U.forEach(L=>{u[L.type]=L,L.dragType=L.dragType||"component",d.push({label:L.name,value:L.type})})});const h={};Object.keys(n.componentConfigs).forEach(U=>{const{hasBase:L}=u[U]||{hasBase:!1},k=[{id:"label",type:"j-input",config:{label:"名称"}}],N={type:"j-collapse",config:{defaultValue:[]},children:[]};L!==!1&&(N.children?.push({config:{label:"基础信息"},children:[...k]}),N.config?.defaultValue.push("_collapse0")),N.children?.push(...n.componentConfigs[U]),r(N.children||[]),h[U]=[N]});const g=U=>{v.value&&n.componentConfigChange&&n.componentConfigChange(v.value.type,{configRef:m,configData:v.value.config,...U})},B=(U,L)=>{n.componentConfigInit&&n.componentConfigInit(U,{configRef:m,...L})},w=(0,o.ref)(),m=(0,o.ref)(),{activedComponent:v,clearComponents:y,schemaComponentDic:I,designComponentList:T}=Hl(w,m,a,n.componentInit,B,h,u,n.containerAddComponent),D=(0,o.computed)(()=>v.value?.id!="form"?v.value?`${v.value.name}-${v.value.id}`:"":v.value?`${v.value.name}`:""),V=(0,o.ref)([]),b=n.components.length;for(let U=0;U<b;U++)V.value.push(U);(0,o.provide)("dui-design-provide",{designItemName:Dl});const K=()=>{y()},sA=()=>{n.componentInit&&(a.config=n.componentInit("indexPage")||{}),y()},W=()=>(console.log("pValidate"),!0),cA=()=>Sl(a.config,a.children||[]),lA=U=>{const L=pw(U,u);a.config=L.pageConfig,a.children?.push(...L.componentList),Object.keys(L.componentDic).forEach(k=>{I[k]=L.componentDic[k]})},oA=(0,o.ref)(),iA=(0,o.ref)();(0,o.ref)(""),(0,o.reactive)({formConfig:{}});let AA=0;const S=U=>{if(iA.value)AA=0,iA.value.init(U);else{if(AA>600){console.warn("组件加载超时");return}AA++,setTimeout(()=>{S(U)},100)}},eA=()=>{},H=()=>{};return A({reset:sA,validate:W,getSchema:cA,setSchema:lA,preview:()=>{const{componentList:U}=hw(Sl(a.config,a.children||[]));oA.value.open("页面预览","full"),(0,o.nextTick)(()=>{S(U)})},clear:K}),(U,L)=>{const k=(0,o.resolveComponent)("j-icon"),N=(0,o.resolveComponent)("d-drag-tool"),O=(0,o.resolveComponent)("el-collapse-item"),Y=(0,o.resolveComponent)("el-collapse"),tA=(0,o.resolveComponent)("el-empty"),BA=(0,o.resolveComponent)("d-drag-index-list"),HA=(0,o.resolveComponent)("d-drag-container"),nA=(0,o.resolveComponent)("j-form"),Z=(0,o.resolveComponent)("j-page"),$=(0,o.resolveComponent)("j-layer");return(0,o.openBlock)(),(0,o.createElementBlock)("div",ww,[(0,o.createElementVNode)("div",Cw,[(0,o.createElementVNode)("div",vw,[(0,o.createVNode)(Y,{modelValue:V.value,"onUpdate:modelValue":L[0]||(L[0]=uA=>V.value=uA)},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(e.components,(uA,wA)=>((0,o.openBlock)(),(0,o.createBlock)(O,{key:wA,title:uA.name,name:wA},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(uA.children,(QA,SA)=>((0,o.openBlock)(),(0,o.createBlock)(N,{key:SA,config:QA},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)("div",yw,[(0,o.createVNode)(k,{class:"j-component-tool-icon",icon:QA.icon,size:14},null,8,["icon"]),(0,o.createElementVNode)("div",Qw,(0,o.toDisplayString)((0,o.unref)(t)(QA.name)),1)])]),_:2},1032,["config"]))),128))]),_:2},1032,["title","name"]))),128))]),_:1},8,["modelValue"])])]),(0,o.createElementVNode)("div",Ew,[(0,o.createElementVNode)("div",Fw,[(0,o.createVNode)(HA,{ref_key:"dragContainer",ref:w,class:"design-drag-container","is-component-container":!1,"component-data":a},{default:(0,o.withCtx)(()=>[!a.children||a.children.length===0?((0,o.openBlock)(),(0,o.createElementBlock)("div",Uw,[(0,o.createVNode)(tA,{description:(0,o.unref)(t)("请从左侧拖拽组件到此处"),"image-size":100},null,8,["description"])])):((0,o.openBlock)(),(0,o.createBlock)(BA,{key:1,"component-list":a.children,"global-config":a.config},null,8,["component-list","global-config"]))]),_:1},8,["component-data"])])]),(0,o.withDirectives)((0,o.createElementVNode)("div",bw,[(0,o.createElementVNode)("div",Hw,[(0,o.createElementVNode)("span",Iw,(0,o.toDisplayString)(`${D.value}`),1)]),(0,o.createElementVNode)("div",_w,[(0,o.createVNode)(nA,{config:{labelPosition:"top",size:"small"},collapseAnimate:!1,style:{padding:"0"},ref_key:"configRef",ref:m,onChange:g},null,512)])],512),[[o.vShow,(0,o.unref)(v)&&h[(0,o.unref)(v).type]]]),(0,o.createVNode)($,{ref_key:"previewLayerRef",ref:oA,"has-btns":!1,onOk:eA,onClosed:H},{default:(0,o.withCtx)(()=>[(0,o.createVNode)(Z,{ref_key:"previewRef",ref:iA,actions:e.actions},null,8,["actions"])]),_:1},512)])}}}),xw=Sw,Nl=ft(xw,[Dl]),jA=Su({Vue:()=>o,Vue2:()=>{},del:()=>Lw,install:()=>Dw,isVue2:()=>!1,isVue3:()=>!0,set:()=>Nw});xu(jA,require("vue"));var fE=!1,gE=!0,hE=void 0;function Dw(){}function Nw(e,A,t){return Array.isArray(e)?(e.length=Math.max(e.length,A),e.splice(A,1,t),t):(e[A]=t,t)}function Lw(e,A){if(Array.isArray(e)){e.splice(A,1);return}delete e[A]}var Zr=(e,A)=>{const t=e.__vccOpts||e;for(const[n,r]of A)t[n]=r;return t},Tw=(0,jA.defineComponent)({name:"LineRuler",props:{scale:Number,thick:Number,palette:Object,index:Number,start:Number,vertical:Boolean,value:Number,isShowReferLine:Boolean},emits:["onMouseDown","onRelease","onRemove"],setup(e,{emit:A}){const t=(0,jA.ref)(0),n=(0,jA.ref)(!0);(0,jA.onMounted)(()=>{t.value=e.value});const r=B=>{n.value=B>=0},a=(0,jA.computed)(()=>{const B=(t.value-e.start)*e.scale;r(B);const w=B+"px";return e.vertical?{top:w}:{left:w}}),u=(0,jA.computed)(()=>{var B;const w=`1px solid ${(B=e.palette)==null?void 0:B.lineColor}`,m=e.vertical?{borderTop:w}:{borderLeft:w};return{cursor:e.isShowReferLine?e.vertical?"ns-resize":"ew-resize":"none",...m}}),d=(0,jA.computed)(()=>e.vertical?{left:e.thick+"px"}:{top:e.thick+"px"});return{startValue:t,showLine:n,offset:a,borderCursor:u,actionStyle:d,handleDown:B=>{const w=e.vertical?B.clientY:B.clientX,m=t.value;A("onMouseDown");const v=I=>{const T=e.vertical?I.clientY:I.clientX;t.value=Math.round(m+(T-w)/e.scale)},y=()=>{A("onRelease",t.value,e.index),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",y)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",y)},handleRemove:()=>{A("onRemove",e.index)}}}}),kw={class:"value"};function Mw(e,A,t,n,r,a){return(0,o.withDirectives)(((0,o.openBlock)(),(0,o.createElementBlock)("div",{class:"line",style:(0,o.normalizeStyle)([e.offset,e.borderCursor]),onMousedown:A[1]||(A[1]=(...u)=>e.handleDown&&e.handleDown(...u))},[(0,o.createElementVNode)("div",{class:"action",style:(0,o.normalizeStyle)(e.actionStyle)},[(0,o.createElementVNode)("span",{class:"del",onClick:A[0]||(A[0]=(...u)=>e.handleRemove&&e.handleRemove(...u))},"×"),(0,o.createElementVNode)("span",kw,(0,o.toDisplayString)(e.startValue),1)],4)],36)),[[o.vShow,e.showLine]])}var Ow=Zr(Tw,[["render",Mw],["__scopeId","data-v-5dea28d6"]]),Kw=e=>e<=.25?40:e<=.5?20:e<=1?10:e<=2?5:e<=4?2:1,Ll=.83,Rw=(e,A,t,n,r,a)=>{const{scale:u,width:d,height:h,ratio:g,palette:B}=r,{bgColor:w,fontColor:m,shadowColor:v,longfgColor:y,shortfgColor:I}=B;if(e.scale(g,g),e.clearRect(0,0,d,h),e.fillStyle=w,e.fillRect(0,0,d,h),n){const oA=(t-A)*u,iA=n*u;e.fillStyle=v,a?e.fillRect(oA,0,iA,h*3/8):e.fillRect(0,oA,d*3/8,iA)}const T=Kw(u),D=T*u,V=T*10,b=V*u,K=Math.floor(A/T)*T,sA=Math.floor(A/V)*V,W=(K-A)/T*D,cA=(sA-A)/V*b,lA=A+Math.ceil((a?d:h)/u);e.beginPath(),e.fillStyle=m,e.strokeStyle=y;for(let oA=sA,iA=0;oA<lA;oA+=V,iA++){const AA=cA+iA*b+.5;a?e.moveTo(AA,0):e.moveTo(0,AA),e.save(),a?e.translate(AA,h*.4):e.translate(d*.4,AA),a||e.rotate(-Math.PI/2),e.scale(Ll/g,Ll/g),e.fillText(oA.toString(),4*g,7*g),e.restore(),a?e.lineTo(AA,h*9/16):e.lineTo(d*9/16,AA)}e.stroke(),e.closePath(),e.beginPath(),e.strokeStyle=I;for(let oA=K,iA=0;oA<lA;oA+=T,iA++){const AA=W+iA*D+.5;a?e.moveTo(AA,0):e.moveTo(0,AA),oA%V!==0&&(a?e.lineTo(AA,h*1/4):e.lineTo(d*1/4,AA))}e.stroke(),e.closePath(),e.setTransform(1,0,0,1,0,0)},Vw=(0,jA.defineComponent)({name:"CanvasRuler",props:{showIndicator:Boolean,valueNum:Number,scale:Number,ratio:Number,palette:Object,vertical:Boolean,start:Number,width:Number,height:Number,selectStart:Number,selectLength:Number},emits:["onAddLine","update:showIndicator","update:valueNum"],setup(e,{emit:A}){const t=(0,jA.reactive)({canvasContext:null});let n=1;const r=(0,jA.ref)(null);(0,jA.onMounted)(()=>{n=e.ratio||window.devicePixelRatio||1,a(),u(n),d(n)});const a=()=>{t.canvasContext=r.value&&r.value.getContext("2d")},u=g=>{if(r.value){r.value.width=e.width*g,r.value.height=e.height*g;const B=t.canvasContext;B&&(B.font=`${12*g}px -apple-system,
|
|
29
29
|
"Helvetica Neue", ".SFNSText-Regular",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a2simcode/dui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.55",
|
|
4
4
|
"description": "A Vue 3 DUI Component Library - 独立可发布的 DUI 组件子集",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/dui.umd.js",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@vue-flow/background": "^1.3.2",
|
|
73
73
|
"@vue-flow/controls": "^1.1.3",
|
|
74
74
|
"gridstack": "^12.4.2",
|
|
75
|
-
"@a2simcode/ui": "0.0.
|
|
75
|
+
"@a2simcode/ui": "0.0.240"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@types/codemirror": "^5.60.17",
|