@polderlabs/bizar 7.0.1 → 7.0.2
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/bizar-dash/dist/assets/EnvVarsSection-BfhAz3ax.js +114 -0
- package/bizar-dash/dist/assets/EnvVarsSection-BfhAz3ax.js.map +1 -0
- package/bizar-dash/dist/assets/MobileChat-DLWdv6tQ.js +1 -0
- package/bizar-dash/dist/assets/{MobileChat-BRFjer8p.js.map → MobileChat-DLWdv6tQ.js.map} +1 -1
- package/bizar-dash/dist/assets/MobileSettings-Bxv62uPY.js +1 -0
- package/bizar-dash/dist/assets/{MobileSettings-Dw5jyJWi.js.map → MobileSettings-Bxv62uPY.js.map} +1 -1
- package/bizar-dash/dist/assets/Toast-ATSAmbdi.js +26 -0
- package/bizar-dash/dist/assets/Toast-ATSAmbdi.js.map +1 -0
- package/bizar-dash/dist/assets/main-306CZfn6.js +430 -0
- package/bizar-dash/dist/assets/main-306CZfn6.js.map +1 -0
- package/bizar-dash/dist/assets/main-G3bNDpY3.css +1 -0
- package/bizar-dash/dist/assets/mobile-C_naUN91.js +1 -0
- package/bizar-dash/dist/assets/{mobile-DRZsK3ic.js.map → mobile-C_naUN91.js.map} +1 -1
- package/bizar-dash/dist/assets/mobile-layout-GZ3bE8L6.js +211 -0
- package/bizar-dash/dist/assets/mobile-layout-GZ3bE8L6.js.map +1 -0
- package/bizar-dash/dist/assets/useSlashCommands-BOwD7lNb.js +65 -0
- package/bizar-dash/dist/assets/useSlashCommands-BOwD7lNb.js.map +1 -0
- package/bizar-dash/dist/index.html +6 -12
- package/bizar-dash/dist/mobile.html +2 -7
- package/package.json +1 -1
- package/bizar-dash/dist/assets/EnvVarsSection-weVnLz3Z.js +0 -4
- package/bizar-dash/dist/assets/EnvVarsSection-weVnLz3Z.js.map +0 -1
- package/bizar-dash/dist/assets/MobileChat-BRFjer8p.js +0 -1
- package/bizar-dash/dist/assets/MobileSettings-Dw5jyJWi.js +0 -1
- package/bizar-dash/dist/assets/Toast-WTxc3m2g.js +0 -1
- package/bizar-dash/dist/assets/Toast-WTxc3m2g.js.map +0 -1
- package/bizar-dash/dist/assets/flow-BpU0-gK2.js +0 -1
- package/bizar-dash/dist/assets/flow-BpU0-gK2.js.map +0 -1
- package/bizar-dash/dist/assets/fuzzy-l0sNRNKZ.js +0 -1
- package/bizar-dash/dist/assets/fuzzy-l0sNRNKZ.js.map +0 -1
- package/bizar-dash/dist/assets/icons-B0AKnYI3.js +0 -731
- package/bizar-dash/dist/assets/icons-B0AKnYI3.js.map +0 -1
- package/bizar-dash/dist/assets/main-BE4Uh9im.css +0 -1
- package/bizar-dash/dist/assets/main-DqC58FEZ.js +0 -18
- package/bizar-dash/dist/assets/main-DqC58FEZ.js.map +0 -1
- package/bizar-dash/dist/assets/markdown-w2bDDkAH.js +0 -1
- package/bizar-dash/dist/assets/markdown-w2bDDkAH.js.map +0 -1
- package/bizar-dash/dist/assets/mobile-DRZsK3ic.js +0 -1
- package/bizar-dash/dist/assets/mobile-layout-Ckru3HKJ.js +0 -2
- package/bizar-dash/dist/assets/mobile-layout-Ckru3HKJ.js.map +0 -1
- package/bizar-dash/dist/assets/react-vendor-BnuhLJ6X.css +0 -1
- package/bizar-dash/dist/assets/react-vendor-D3pra6w-.js +0 -46
- package/bizar-dash/dist/assets/react-vendor-D3pra6w-.js.map +0 -1
- package/bizar-dash/dist/assets/useSlashCommands-BAxVOU_a.js +0 -2
- package/bizar-dash/dist/assets/useSlashCommands-BAxVOU_a.js.map +0 -1
- package/bizar-dash/dist/assets/vendor-Di7Cp-rw.js +0 -45
- package/bizar-dash/dist/assets/vendor-Di7Cp-rw.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{k as Mt,p as se,z as oe,l as re,m as Ce,n as $t,o as Ct,q as Ae}from"./vendor-Di7Cp-rw.js";const pt={error001:(t="react")=>`Seems like you have not used ${t==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${t}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:i,targetHandle:s})=>`Couldn't create edge for ${t} handle id: "${t==="source"?i:s}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:t=>`Edge with id "${t}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},ve=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],bn=["Enter"," ","Escape"],Ie={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:i})=>`Moved selected node ${t}. New position, x: ${e}, y: ${i}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var mt;(function(t){t.Strict="strict",t.Loose="loose"})(mt||(mt={}));var dt;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(dt||(dt={}));var Lt;(function(t){t.Partial="partial",t.Full="full"})(Lt||(Lt={}));const En={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Rt;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Rt||(Rt={}));var Ft;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Ft||(Ft={}));var z;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(z||(z={}));const Gt={[z.Left]:z.Right,[z.Right]:z.Left,[z.Top]:z.Bottom,[z.Bottom]:z.Top};function Hn(t){return t===null?null:t?"valid":"invalid"}const Ne=t=>!!t&&typeof t=="object"&&"id"in t&&"source"in t&&"target"in t,Tn=t=>!!t&&typeof t=="object"&&"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),Bt=t=>!!t&&typeof t=="object"&&"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),yt=(t,e=[0,0])=>{const{width:i,height:s}=st(t),n=t.origin??e,r=i*n[0],o=s*n[1];return{x:t.position.x-r,y:t.position.y-o}},$n=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const i=t.reduce((s,n)=>{const r=typeof n=="string";let o=!e.nodeLookup&&!r?n:void 0;e.nodeLookup&&(o=r?e.nodeLookup.get(n):Bt(n)?n:e.nodeLookup.get(n.id));const a=o?wt(o,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return bt(s,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Et(i)},ae=(t,e={})=>{let i={x:1/0,y:1/0,x2:-1/0,y2:-1/0},s=!1;return t.forEach(n=>{(e.filter===void 0||e.filter(n))&&(i=bt(i,wt(n)),s=!0)}),s?Et(i):{x:0,y:0,width:0,height:0}},Cn=(t,e,[i,s,n]=[0,0,1],r=!1,o=!1)=>{const a=(e.x-i)/n,c=(e.y-s)/n,l=e.width/n,u=e.height/n,h=[];for(const f of t.values()){const{measured:y,selectable:d=!0,hidden:p=!1}=f;if(o&&!d||p)continue;const b=y.width??f.width??f.initialWidth??0,M=y.height??f.height??f.initialHeight??0,{x:I,y:g}=f.internals.positionAbsolute,T=ue(a,c,l,u,I,g,b,M),X=b*M,C=r&&T>0;(!f.internals.handleBounds||C||T>=X||f.dragging)&&h.push(f)}return h},Pe=(t,e)=>{const i=new Set;return t.forEach(s=>{i.add(s.id)}),e.filter(s=>i.has(s.source)||i.has(s.target))};function Be(t,e){const i=new Map,s=e!=null&&e.nodes?new Set(e.nodes.map(n=>n.id)):null;return t.forEach(n=>{let r;if(e!=null&&e.includeHiddenNodes){const{width:o,height:a}=st(n);r=o>0&&a>0}else r=!!(n.measured.width&&n.measured.height&&!n.hidden);r&&(!s||s.has(n.id))&&i.set(n.id,n)}),i}async function An({nodes:t,width:e,height:i,panZoom:s,minZoom:n,maxZoom:r},o){if(t.size===0)return!0;const a=Be(t,o),c=ae(a),l=Ve(c,e,i,(o==null?void 0:o.minZoom)??n,(o==null?void 0:o.maxZoom)??r,(o==null?void 0:o.padding)??.1);return await s.setViewport(l,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),!0}function Ye({nodeId:t,nextPosition:e,nodeLookup:i,nodeOrigin:s=[0,0],nodeExtent:n,onError:r}){const o=i.get(t),a=o.parentId?i.get(o.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},u=o.origin??s;let h=o.extent||n;if(o.extent==="parent"&&!o.expandParent)if(!a)r==null||r("005",pt.error005());else{const y=a.measured.width,d=a.measured.height;y&&d&&(h=[[c,l],[c+y,l+d]])}else a&&at(o.extent)&&(h=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);const f=at(h)?rt(e,h,o.measured):e;return(o.measured.width===void 0||o.measured.height===void 0)&&(r==null||r("015",pt.error015())),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function vn({nodesToRemove:t=[],edgesToRemove:e=[],nodes:i,edges:s,onBeforeDelete:n}){const r=new Set(t.map(f=>f.id)),o=[];for(const f of i){if(f.deletable===!1)continue;const y=r.has(f.id),d=!y&&f.parentId&&o.find(p=>p.id===f.parentId);(y||d)&&o.push(f)}const a=new Set(e.map(f=>f.id)),c=s.filter(f=>f.deletable!==!1),u=Pe(o,c);for(const f of c)a.has(f.id)&&!u.find(d=>d.id===f.id)&&u.push(f);if(!n)return{edges:u,nodes:o};const h=await n({nodes:o,edges:u});return typeof h=="boolean"?h?{edges:u,nodes:o}:{edges:[],nodes:[]}:h}const ut=(t,e=0,i=1)=>Math.min(Math.max(t,e),i),rt=(t={x:0,y:0},e,i)=>({x:ut(t.x,e[0][0],e[1][0]-((i==null?void 0:i.width)??0)),y:ut(t.y,e[0][1],e[1][1]-((i==null?void 0:i.height)??0))});function ce(t,e,i){const{width:s,height:n}=st(i),{x:r,y:o}=i.internals.positionAbsolute;return rt(t,[[r,o],[r+s,o+n]],e)}const St=(t,e,i)=>t<e?ut(Math.abs(t-e),1,e)/e:t>i?-ut(Math.abs(t-i),1,e)/e:0,le=(t,e,i=15,s=40)=>{const n=St(t.x,s,e.width-s)*i,r=St(t.y,s,e.height-s)*i;return[n,r]},bt=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),Nt=({x:t,y:e,width:i,height:s})=>({x:t,y:e,x2:t+i,y2:e+s}),Et=({x:t,y:e,x2:i,y2:s})=>({x:t,y:e,width:i-t,height:s-e}),Yt=(t,e=[0,0])=>{var n,r;const{x:i,y:s}=Bt(t)?t.internals.positionAbsolute:yt(t,e);return{x:i,y:s,width:((n=t.measured)==null?void 0:n.width)??t.width??t.initialWidth??0,height:((r=t.measured)==null?void 0:r.height)??t.height??t.initialHeight??0}},wt=(t,e=[0,0])=>{var n,r;const{x:i,y:s}=Bt(t)?t.internals.positionAbsolute:yt(t,e);return{x:i,y:s,x2:i+(((n=t.measured)==null?void 0:n.width)??t.width??t.initialWidth??0),y2:s+(((r=t.measured)==null?void 0:r.height)??t.height??t.initialHeight??0)}},ze=(t,e)=>Et(bt(Nt(t),Nt(e))),ue=(t,e,i,s,n,r,o,a)=>{const c=Math.max(0,Math.min(t+i,n+o)-Math.max(t,n)),l=Math.max(0,Math.min(e+s,r+a)-Math.max(e,r));return Math.ceil(c*l)},fe=(t,e)=>ue(t.x,t.y,t.width,t.height,e.x,e.y,e.width,e.height),In=t=>ot(t.width)&&ot(t.height)&&ot(t.x)&&ot(t.y),ot=t=>!isNaN(t)&&isFinite(t),Nn=(t,e)=>(i,s)=>{},Ht=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),de=({x:t,y:e},[i,s,n],r=!1,o=[1,1])=>{const a={x:(t-i)/n,y:(e-s)/n};return r?Ht(a,o):a},Pt=({x:t,y:e},[i,s,n])=>({x:t*n+i,y:e*n+s});function ct(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const i=parseFloat(t);if(!Number.isNaN(i))return Math.floor(i)}if(typeof t=="string"&&t.endsWith("%")){const i=parseFloat(t);if(!Number.isNaN(i))return Math.floor(e*i*.01)}return console.error(`The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Xe(t,e,i){if(typeof t=="string"||typeof t=="number"){const s=ct(t,i),n=ct(t,e);return{top:s,right:n,bottom:s,left:n,x:n*2,y:s*2}}if(typeof t=="object"){const s=ct(t.top??t.y??0,i),n=ct(t.bottom??t.y??0,i),r=ct(t.left??t.x??0,e),o=ct(t.right??t.x??0,e);return{top:s,right:o,bottom:n,left:r,x:r+o,y:s+n}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function De(t,e,i,s,n,r){const{x:o,y:a}=Pt(t,[e,i,s]),{x:c,y:l}=Pt({x:t.x+t.width,y:t.y+t.height},[e,i,s]),u=n-c,h=r-l;return{left:Math.floor(o),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(h)}}const Ve=(t,e,i,s,n,r)=>{const o=Xe(r,e,i),a=(e-o.x)/t.width,c=(i-o.y)/t.height,l=Math.min(a,c),u=ut(l,s,n),h=t.x+t.width/2,f=t.y+t.height/2,y=e/2-h*u,d=i/2-f*u,p=De(t,y,d,u,e,i),b={left:Math.min(p.left-o.left,0),top:Math.min(p.top-o.top,0),right:Math.min(p.right-o.right,0),bottom:Math.min(p.bottom-o.bottom,0)};return{x:y-b.left+b.right,y:d-b.top+b.bottom,zoom:u}},zt=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function at(t){return t!=null&&t!=="parent"}function st(t){var e,i;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}}function Pn(t){var e,i;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight)!==void 0}function Bn(t,e={width:0,height:0},i,s,n){const r={...t},o=s.get(i);if(o){const a=o.origin||n;r.x+=o.internals.positionAbsolute.x-(e.width??0)*a[0],r.y+=o.internals.positionAbsolute.y-(e.height??0)*a[1]}return r}function Yn(t,e){if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0}function zn(){let t,e;return{promise:new Promise((s,n)=>{t=s,e=n}),resolve:t,reject:e}}function Xn(t){return{...Ie,...t||{}}}function ht(t,{snapGrid:e=[0,0],snapToGrid:i=!1,transform:s,containerBounds:n}){const{x:r,y:o}=tt(t),a=de({x:r-((n==null?void 0:n.left)??0),y:o-((n==null?void 0:n.top)??0)},s),{x:c,y:l}=i?Ht(a,e):a;return{xSnapped:c,ySnapped:l,...a}}const he=t=>({width:t.offsetWidth,height:t.offsetHeight}),Oe=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},We=["INPUT","SELECT","TEXTAREA"];function Dn(t){var s,n;const e=((n=(s=t.composedPath)==null?void 0:s.call(t))==null?void 0:n[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:We.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const _e=t=>"clientX"in t,tt=(t,e)=>{var r,o;const i=_e(t),s=i?t.clientX:(r=t.touches)==null?void 0:r[0].clientX,n=i?t.clientY:(o=t.touches)==null?void 0:o[0].clientY;return{x:s-((e==null?void 0:e.left)??0),y:n-((e==null?void 0:e.top)??0)}},qt=(t,e,i,s,n)=>{const r=e.querySelectorAll(`.${t}`);return!r||!r.length?null:Array.from(r).map(o=>{const a=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:t,nodeId:n,position:o.getAttribute("data-handlepos"),x:(a.left-i.left)/s,y:(a.top-i.top)/s,...he(o)}})};function Le({sourceX:t,sourceY:e,targetX:i,targetY:s,sourceControlX:n,sourceControlY:r,targetControlX:o,targetControlY:a}){const c=t*.125+n*.375+o*.375+i*.125,l=e*.125+r*.375+a*.375+s*.125,u=Math.abs(c-t),h=Math.abs(l-e);return[c,l,u,h]}function xt(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function kt({pos:t,x1:e,y1:i,x2:s,y2:n,c:r}){switch(t){case z.Left:return[e-xt(e-s,r),i];case z.Right:return[e+xt(s-e,r),i];case z.Top:return[e,i-xt(i-n,r)];case z.Bottom:return[e,i+xt(n-i,r)]}}function Vn({sourceX:t,sourceY:e,sourcePosition:i=z.Bottom,targetX:s,targetY:n,targetPosition:r=z.Top,curvature:o=.25}){const[a,c]=kt({pos:i,x1:t,y1:e,x2:s,y2:n,c:o}),[l,u]=kt({pos:r,x1:s,y1:n,x2:t,y2:e,c:o}),[h,f,y,d]=Le({sourceX:t,sourceY:e,targetX:s,targetY:n,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${t},${e} C${a},${c} ${l},${u} ${s},${n}`,h,f,y,d]}function ye({sourceX:t,sourceY:e,targetX:i,targetY:s}){const n=Math.abs(i-t)/2,r=i<t?i+n:i-n,o=Math.abs(s-e)/2,a=s<e?s+o:s-o;return[r,a,n,o]}function On({sourceNode:t,targetNode:e,selected:i=!1,zIndex:s=0,elevateOnSelect:n=!1,zIndexMode:r="basic"}){if(r==="manual")return s;const o=n&&i?s+1e3:s,a=Math.max(t.parentId||n&&t.selected?t.internals.z:0,e.parentId||n&&e.selected?e.internals.z:0);return o+a}function Wn({sourceNode:t,targetNode:e,width:i,height:s,transform:n}){const r=bt(wt(t),wt(e));r.x===r.x2&&(r.x2+=1),r.y===r.y2&&(r.y2+=1);const o={x:-n[0]/n[2],y:-n[1]/n[2],width:i/n[2],height:s/n[2]};return fe(o,Et(r))>0}const Re=({source:t,sourceHandle:e,target:i,targetHandle:s})=>`xy-edge__${t}${e||""}-${i}${s||""}`,Fe=(t,e)=>e.some(i=>i.source===t.source&&i.target===t.target&&(i.sourceHandle===t.sourceHandle||!i.sourceHandle&&!t.sourceHandle)&&(i.targetHandle===t.targetHandle||!i.targetHandle&&!t.targetHandle)),_n=(t,e,i={})=>{var r;if(!t.source||!t.target)return(r=i.onError)==null||r.call(i,"006",pt.error006()),e;const s=i.getEdgeId||Re;let n;return Ne(t)?n={...t}:n={...t,id:s(t)},Fe(n,e)?e:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,e.concat(n))};function Ln({sourceX:t,sourceY:e,targetX:i,targetY:s}){const[n,r,o,a]=ye({sourceX:t,sourceY:e,targetX:i,targetY:s});return[`M ${t},${e}L ${i},${s}`,n,r,o,a]}const Ut={[z.Left]:{x:-1,y:0},[z.Right]:{x:1,y:0},[z.Top]:{x:0,y:-1},[z.Bottom]:{x:0,y:1}},Ge=({source:t,sourcePosition:e=z.Bottom,target:i})=>e===z.Left||e===z.Right?t.x<i.x?{x:1,y:0}:{x:-1,y:0}:t.y<i.y?{x:0,y:1}:{x:0,y:-1},jt=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function Se({source:t,sourcePosition:e=z.Bottom,target:i,targetPosition:s=z.Top,center:n,offset:r,stepPosition:o}){const a=Ut[e],c=Ut[s],l={x:t.x+a.x*r,y:t.y+a.y*r},u={x:i.x+c.x*r,y:i.y+c.y*r},h=Ge({source:l,sourcePosition:e,target:u}),f=h.x!==0?"x":"y",y=h[f];let d=[],p,b;const M={x:0,y:0},I={x:0,y:0},[,,g,T]=ye({sourceX:t.x,sourceY:t.y,targetX:i.x,targetY:i.y});if(a[f]*c[f]===-1){f==="x"?(p=n.x??l.x+(u.x-l.x)*o,b=n.y??(l.y+u.y)/2):(p=n.x??(l.x+u.x)/2,b=n.y??l.y+(u.y-l.y)*o);const H=[{x:p,y:l.y},{x:p,y:u.y}],E=[{x:l.x,y:b},{x:u.x,y:b}];a[f]===y?d=f==="x"?H:E:d=f==="x"?E:H}else{const H=[{x:l.x,y:u.y}],E=[{x:u.x,y:l.y}];if(f==="x"?d=a.x===y?E:H:d=a.y===y?H:E,e===s){const x=Math.abs(t[f]-i[f]);if(x<=r){const m=Math.min(r-1,r-x);a[f]===y?M[f]=(l[f]>t[f]?-1:1)*m:I[f]=(u[f]>i[f]?-1:1)*m}}if(e!==s){const x=f==="x"?"y":"x",m=a[f]===c[x],Y=l[x]>u[x],P=l[x]<u[x];(a[f]===1&&(!m&&Y||m&&P)||a[f]!==1&&(!m&&P||m&&Y))&&(d=f==="x"?H:E)}const L={x:l.x+M.x,y:l.y+M.y},D={x:u.x+I.x,y:u.y+I.y},$=Math.max(Math.abs(L.x-d[0].x),Math.abs(D.x-d[0].x)),w=Math.max(Math.abs(L.y-d[0].y),Math.abs(D.y-d[0].y));$>=w?(p=(L.x+D.x)/2,b=d[0].y):(p=d[0].x,b=(L.y+D.y)/2)}const X={x:l.x+M.x,y:l.y+M.y},C={x:u.x+I.x,y:u.y+I.y};return[[t,...X.x!==d[0].x||X.y!==d[0].y?[X]:[],...d,...C.x!==d[d.length-1].x||C.y!==d[d.length-1].y?[C]:[],i],p,b,g,T]}function qe(t,e,i,s){const n=Math.min(jt(t,e)/2,jt(e,i)/2,s),{x:r,y:o}=e;if(t.x===r&&r===i.x||t.y===o&&o===i.y)return`L${r} ${o}`;if(t.y===o){const l=t.x<i.x?-1:1,u=t.y<i.y?1:-1;return`L ${r+n*l},${o}Q ${r},${o} ${r},${o+n*u}`}const a=t.x<i.x?1:-1,c=t.y<i.y?-1:1;return`L ${r},${o+n*c}Q ${r},${o} ${r+n*a},${o}`}function Rn({sourceX:t,sourceY:e,sourcePosition:i=z.Bottom,targetX:s,targetY:n,targetPosition:r=z.Top,borderRadius:o=5,centerX:a,centerY:c,offset:l=20,stepPosition:u=.5}){const[h,f,y,d,p]=Se({source:{x:t,y:e},sourcePosition:i,target:{x:s,y:n},targetPosition:r,center:{x:a,y:c},offset:l,stepPosition:u});let b=`M${h[0].x} ${h[0].y}`;for(let M=1;M<h.length-1;M++)b+=qe(h[M-1],h[M],h[M+1],o);return b+=`L${h[h.length-1].x} ${h[h.length-1].y}`,[b,f,y,d,p]}function Kt(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function Fn(t){var h;const{sourceNode:e,targetNode:i}=t;if(!Kt(e)||!Kt(i))return null;const s=e.internals.handleBounds||Qt(e.handles),n=i.internals.handleBounds||Qt(i.handles),r=Jt((s==null?void 0:s.source)??[],t.sourceHandle),o=Jt(t.connectionMode===mt.Strict?(n==null?void 0:n.target)??[]:((n==null?void 0:n.target)??[]).concat((n==null?void 0:n.source)??[]),t.targetHandle);if(!r||!o)return(h=t.onError)==null||h.call(t,"008",pt.error008(r?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const a=(r==null?void 0:r.position)||z.Bottom,c=(o==null?void 0:o.position)||z.Top,l=ft(e,r,a),u=ft(i,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function Qt(t){if(!t)return null;const e=[],i=[];for(const s of t)s.width=s.width??1,s.height=s.height??1,s.type==="source"?e.push(s):s.type==="target"&&i.push(s);return{source:e,target:i}}function ft(t,e,i=z.Left,s=!1){const n=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,r=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:o,height:a}=e??st(t);if(s)return{x:n+o/2,y:r+a/2};switch((e==null?void 0:e.position)??i){case z.Top:return{x:n+o/2,y:r};case z.Right:return{x:n+o,y:r+a/2};case z.Bottom:return{x:n+o/2,y:r+a};case z.Left:return{x:n,y:r+a/2}}}function Jt(t,e){return t&&(e?t.find(i=>i.id===e):t[0])||null}function ke(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(s=>`${s}=${t[s]}`).join("&")}`:""}function Gn(t,{id:e,defaultColor:i,defaultMarkerStart:s,defaultMarkerEnd:n}){const r=new Set;return t.reduce((o,a)=>([a.markerStart||s,a.markerEnd||n].forEach(c=>{if(c&&typeof c=="object"){const l=ke(c,e);r.has(l)||(o.push({id:l,color:c.color||i,...c}),r.add(l))}}),o),[]).sort((o,a)=>o.id.localeCompare(a.id))}const xe=1e3,Ue=10,Xt={nodeOrigin:[0,0],nodeExtent:ve,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},je={...Xt,checkEquality:!0};function Dt(t,e){const i={...t};for(const s in e)e[s]!==void 0&&(i[s]=e[s]);return i}function Sn(t,e,i){const s=Dt(Xt,i);for(const n of t.values())if(n.parentId)Ot(n,t,e,s);else{const r=yt(n,s.nodeOrigin),o=at(n.extent)?n.extent:s.nodeExtent,a=rt(r,o,st(n));n.internals.positionAbsolute=a}}function Ke(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const i=[],s=[];for(const n of t.handles){const r={id:n.id,width:n.width??1,height:n.height??1,nodeId:t.id,x:n.x,y:n.y,position:n.position,type:n.type};n.type==="source"?i.push(r):n.type==="target"&&s.push(r)}return{source:i,target:s}}function Vt(t){return t==="manual"}function qn(t,e,i,s={}){var u,h;const n=Dt(je,s),r={i:0},o=new Map(e),a=n!=null&&n.elevateNodesOnSelect&&!Vt(n.zIndexMode)?xe:0;let c=t.length>0,l=!1;e.clear(),i.clear();for(const f of t){let y=o.get(f.id);if(n.checkEquality&&f===(y==null?void 0:y.internals.userNode))e.set(f.id,y);else{const d=yt(f,n.nodeOrigin),p=at(f.extent)?f.extent:n.nodeExtent,b=rt(d,p,st(f));y={...n.defaults,...f,measured:{width:(u=f.measured)==null?void 0:u.width,height:(h=f.measured)==null?void 0:h.height},internals:{positionAbsolute:b,handleBounds:Ke(f,y),z:ge(f,a,n.zIndexMode),userNode:f}},e.set(f.id,y)}(y.measured===void 0||y.measured.width===void 0||y.measured.height===void 0)&&!y.hidden&&(c=!1),f.parentId&&Ot(y,e,i,s,r),l||(l=f.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:l}}function Qe(t,e){if(!t.parentId)return;const i=e.get(t.parentId);i?i.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function Ot(t,e,i,s,n){const{elevateNodesOnSelect:r,nodeOrigin:o,nodeExtent:a,zIndexMode:c}=Dt(Xt,s),l=t.parentId,u=e.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Qe(t,i),n&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++n.i,u.internals.z=u.internals.z+n.i*Ue),n&&u.internals.rootParentIndex!==void 0&&(n.i=u.internals.rootParentIndex);const h=r&&!Vt(c)?xe:0,{x:f,y,z:d}=Je(t,u,o,a,h,c),{positionAbsolute:p}=t.internals,b=f!==p.x||y!==p.y;(b||d!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:b?{x:f,y}:p,z:d}})}function ge(t,e,i){const s=ot(t.zIndex)?t.zIndex:0;return Vt(i)?s:s+(t.selected?e:0)}function Je(t,e,i,s,n,r){const{x:o,y:a}=e.internals.positionAbsolute,c=st(t),l=yt(t,i),u=at(t.extent)?rt(l,t.extent,c):l;let h=rt({x:o+u.x,y:a+u.y},s,c);t.extent==="parent"&&(h=ce(h,c,e));const f=ge(t,n,r),y=e.internals.z??0;return{x:h.x,y:h.y,z:y>=f?y+1:f}}function Ze(t,e,i,s=[0,0]){var o;const n=[],r=new Map;for(const a of t){const c=e.get(a.parentId);if(!c)continue;const l=((o=r.get(a.parentId))==null?void 0:o.expandedRect)??Yt(c),u=ze(l,a.rect);r.set(a.parentId,{expandedRect:u,parent:c})}return r.size>0&&r.forEach(({expandedRect:a,parent:c},l)=>{var g;const u=c.internals.positionAbsolute,h=st(c),f=c.origin??s,y=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,d=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,p=Math.max(h.width,Math.round(a.width)),b=Math.max(h.height,Math.round(a.height)),M=(p-h.width)*f[0],I=(b-h.height)*f[1];(y>0||d>0||M||I)&&(n.push({id:l,type:"position",position:{x:c.position.x-y+M,y:c.position.y-d+I}}),(g=i.get(l))==null||g.forEach(T=>{t.some(X=>X.id===T.id)||n.push({id:T.id,type:"position",position:{x:T.position.x+y,y:T.position.y+d}})})),(h.width<a.width||h.height<a.height||y||d)&&n.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:p+(y?f[0]*y-M:0),height:b+(d?f[1]*d-I:0)}})}),n}function kn(t,e,i,s,n,r,o){const a=s==null?void 0:s.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],u=window.getComputedStyle(a),{m22:h}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const y of t.values()){const d=e.get(y.id);if(!d)continue;if(d.hidden){e.set(d.id,{...d,internals:{...d.internals,handleBounds:void 0}}),c=!0;continue}const p=he(y.nodeElement),b=d.measured.width!==p.width||d.measured.height!==p.height;if(!!(p.width&&p.height&&(b||!d.internals.handleBounds||y.force))){const I=y.nodeElement.getBoundingClientRect(),g=at(d.extent)?d.extent:r;let{positionAbsolute:T}=d.internals;if(d.parentId&&d.extent==="parent"){const C=e.get(d.parentId);C&&(T=ce(T,p,C))}else g&&(T=rt(T,g,p));const X={...d,measured:p,internals:{...d.internals,positionAbsolute:T,handleBounds:{source:qt("source",y.nodeElement,I,h,d.id),target:qt("target",y.nodeElement,I,h,d.id)}}};e.set(d.id,X),d.parentId&&Ot(X,e,i,{nodeOrigin:n,zIndexMode:o}),c=!0,b&&(l.push({id:d.id,type:"dimensions",dimensions:p}),d.expandParent&&d.parentId&&f.push({id:d.id,parentId:d.parentId,rect:Yt(X,n)}))}}if(f.length>0){const y=Ze(f,e,i,n);l.push(...y)}return{changes:l,updatedInternals:c}}async function Un({delta:t,panZoom:e,transform:i,translateExtent:s,width:n,height:r}){if(!e||!t.x&&!t.y)return!1;const o=await e.setViewportConstrained({x:i[0]+t.x,y:i[1]+t.y,zoom:i[2]},[[0,0],[n,r]],s);return!!o&&(o.x!==i[0]||o.y!==i[1]||o.k!==i[2])}function Zt(t,e,i,s,n,r){let o=n;const a=s.get(o)||new Map;s.set(o,a.set(i,e)),o=`${n}-${t}`;const c=s.get(o)||new Map;if(s.set(o,c.set(i,e)),r){o=`${n}-${t}-${r}`;const l=s.get(o)||new Map;s.set(o,l.set(i,e))}}function jn(t,e,i){t.clear(),e.clear();for(const s of i){const{source:n,target:r,sourceHandle:o=null,targetHandle:a=null}=s,c={edgeId:s.id,source:n,target:r,sourceHandle:o,targetHandle:a},l=`${n}-${o}--${r}-${a}`,u=`${r}-${a}--${n}-${o}`;Zt("source",c,u,t,n,o),Zt("target",c,l,t,r,a),e.set(s.id,s)}}function pe(t,e){if(!t.parentId)return!1;const i=e.get(t.parentId);return i?i.selected?!0:pe(i,e):!1}function te(t,e,i){var n;let s=t;do{if((n=s==null?void 0:s.matches)!=null&&n.call(s,e))return!0;if(s===i)return!1;s=s==null?void 0:s.parentElement}while(s);return!1}function tn(t,e,i,s){const n=new Map;for(const[r,o]of t)if((o.selected||o.id===s)&&(!o.parentId||!pe(o,t))&&(o.draggable||e&&typeof o.draggable>"u")){const a=t.get(r);a&&n.set(r,{id:r,position:a.position||{x:0,y:0},distance:{x:i.x-a.internals.positionAbsolute.x,y:i.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return n}function At({nodeId:t,dragItems:e,nodeLookup:i,dragging:s=!0}){var o,a,c;const n=[];for(const[l,u]of e){const h=(o=i.get(l))==null?void 0:o.internals.userNode;h&&n.push({...h,position:u.position,dragging:s})}if(!t)return[n[0],n];const r=(a=i.get(t))==null?void 0:a.internals.userNode;return[r?{...r,position:((c=e.get(t))==null?void 0:c.position)||r.position,dragging:s}:n[0],n]}function en({dragItems:t,snapGrid:e,x:i,y:s}){const n=t.values().next().value;if(!n)return null;const r={x:i-n.distance.x,y:s-n.distance.y},o=Ht(r,e);return{x:o.x-r.x,y:o.y-r.y}}function Kn({onNodeMouseDown:t,getStoreItems:e,onDragStart:i,onDrag:s,onDragStop:n}){let r={x:null,y:null},o=0,a=new Map,c=!1,l={x:0,y:0},u=null,h=!1,f=null,y=!1,d=!1,p=null;function b({noDragClassName:I,handleSelector:g,domNode:T,isSelectable:X,nodeId:C,nodeClickDistance:A=0}){f=Mt(T);function H({x:$,y:w}){const{nodeLookup:x,nodeExtent:m,snapGrid:Y,snapToGrid:P,nodeOrigin:N,onNodeDrag:v,onSelectionDrag:O,onError:V,updateNodePositions:B}=e();r={x:$,y:w};let F=!1;const R=a.size>1,k=R&&m?Nt(ae(a)):null,j=R&&P?en({dragItems:a,snapGrid:Y,x:$,y:w}):null;for(const[S,W]of a){if(!x.has(S))continue;let q={x:$-W.distance.x,y:w-W.distance.y};P&&(q=j?{x:Math.round(q.x+j.x),y:Math.round(q.y+j.y)}:Ht(q,Y));let U=null;if(R&&m&&!W.extent&&k){const{positionAbsolute:_}=W.internals,Z=_.x-k.x+m[0][0],J=_.x+W.measured.width-k.x2+m[1][0],K=_.y-k.y+m[0][1],et=_.y+W.measured.height-k.y2+m[1][1];U=[[Z,K],[J,et]]}const{position:G,positionAbsolute:Q}=Ye({nodeId:S,nextPosition:q,nodeLookup:x,nodeExtent:U||m,nodeOrigin:N,onError:V});F=F||W.position.x!==G.x||W.position.y!==G.y,W.position=G,W.internals.positionAbsolute=Q}if(d=d||F,!!F&&(B(a,!0),p&&(s||v||!C&&O))){const[S,W]=At({nodeId:C,dragItems:a,nodeLookup:x});s==null||s(p,a,S,W),v==null||v(p,S,W),C||O==null||O(p,W)}}async function E(){if(!u)return;const{transform:$,panBy:w,autoPanSpeed:x,autoPanOnNodeDrag:m}=e();if(!m){c=!1,cancelAnimationFrame(o);return}const[Y,P]=le(l,u,x);(Y!==0||P!==0)&&(r.x=(r.x??0)-Y/$[2],r.y=(r.y??0)-P/$[2],await w({x:Y,y:P})&&H(r)),o=requestAnimationFrame(E)}function L($){var R;const{nodeLookup:w,multiSelectionActive:x,nodesDraggable:m,transform:Y,snapGrid:P,snapToGrid:N,selectNodesOnDrag:v,onNodeDragStart:O,onSelectionDragStart:V,unselectNodesAndEdges:B}=e();h=!0,(!v||!X)&&!x&&C&&((R=w.get(C))!=null&&R.selected||B()),X&&v&&C&&(t==null||t(C));const F=ht($.sourceEvent,{transform:Y,snapGrid:P,snapToGrid:N,containerBounds:u});if(r=F,a=tn(w,m,F,C),a.size>0&&(i||O||!C&&V)){const[k,j]=At({nodeId:C,dragItems:a,nodeLookup:w});i==null||i($.sourceEvent,a,k,j),O==null||O($.sourceEvent,k,j),C||V==null||V($.sourceEvent,j)}}const D=re().clickDistance(A).on("start",$=>{const{domNode:w,nodeDragThreshold:x,transform:m,snapGrid:Y,snapToGrid:P}=e();u=(w==null?void 0:w.getBoundingClientRect())||null,y=!1,d=!1,p=$.sourceEvent,x===0&&L($),r=ht($.sourceEvent,{transform:m,snapGrid:Y,snapToGrid:P,containerBounds:u}),l=tt($.sourceEvent,u)}).on("drag",$=>{const{autoPanOnNodeDrag:w,transform:x,snapGrid:m,snapToGrid:Y,nodeDragThreshold:P,nodeLookup:N}=e(),v=ht($.sourceEvent,{transform:x,snapGrid:m,snapToGrid:Y,containerBounds:u});if(p=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||C&&!N.has(C))&&(y=!0),!y){if(!c&&w&&h&&(c=!0,E()),!h){const O=tt($.sourceEvent,u),V=O.x-l.x,B=O.y-l.y;Math.sqrt(V*V+B*B)>P&&L($)}(r.x!==v.xSnapped||r.y!==v.ySnapped)&&a&&h&&(l=tt($.sourceEvent,u),H(v))}}).on("end",$=>{if(!h||y){y&&a.size>0&&e().updateNodePositions(a,!1);return}if(c=!1,h=!1,cancelAnimationFrame(o),a.size>0){const{nodeLookup:w,updateNodePositions:x,onNodeDragStop:m,onSelectionDragStop:Y}=e();if(d&&(x(a,!1),d=!1),n||m||!C&&Y){const[P,N]=At({nodeId:C,dragItems:a,nodeLookup:w,dragging:!1});n==null||n($.sourceEvent,a,P,N),m==null||m($.sourceEvent,P,N),C||Y==null||Y($.sourceEvent,N)}}}).filter($=>{const w=$.target;return!$.button&&(!I||!te(w,`.${I}`,T))&&(!g||te(w,g,T))});f.call(D)}function M(){f==null||f.on(".drag",null)}return{update:b,destroy:M}}function nn(t,e,i){const s=[],n={x:t.x-i,y:t.y-i,width:i*2,height:i*2};for(const r of e.values())fe(n,Yt(r))>0&&s.push(r);return s}const sn=250;function on(t,e,i,s){var a,c;let n=[],r=1/0;const o=nn(t,i,e+sn);for(const l of o){const u=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const h of u){if(s.nodeId===h.nodeId&&s.type===h.type&&s.id===h.id)continue;const{x:f,y}=ft(l,h,h.position,!0),d=Math.sqrt(Math.pow(f-t.x,2)+Math.pow(y-t.y,2));d>e||(d<r?(n=[{...h,x:f,y}],r=d):d===r&&n.push({...h,x:f,y}))}}if(!n.length)return null;if(n.length>1){const l=s.type==="source"?"target":"source";return n.find(u=>u.type===l)??n[0]}return n[0]}function me(t,e,i,s,n,r=!1){var l,u,h;const o=s.get(t);if(!o)return null;const a=n==="strict"?(l=o.internals.handleBounds)==null?void 0:l[e]:[...((u=o.internals.handleBounds)==null?void 0:u.source)??[],...((h=o.internals.handleBounds)==null?void 0:h.target)??[]],c=(i?a==null?void 0:a.find(f=>f.id===i):a==null?void 0:a[0])??null;return c&&r?{...c,...ft(o,c,c.position,!0)}:c}function we(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function rn(t,e){let i=null;return e?i=!0:t&&!e&&(i=!1),i}const Me=()=>!0;function an(t,{connectionMode:e,connectionRadius:i,handleId:s,nodeId:n,edgeUpdaterType:r,isTarget:o,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:h,panBy:f,cancelConnection:y,onConnectStart:d,onConnect:p,onConnectEnd:b,isValidConnection:M=Me,onReconnectEnd:I,updateConnection:g,getTransform:T,getFromHandle:X,autoPanSpeed:C,dragThreshold:A=1,handleDomNode:H}){const E=Oe(t.target);let L=0,D;const{x:$,y:w}=tt(t),x=we(r,H),m=a==null?void 0:a.getBoundingClientRect();let Y=!1;if(!m||!x)return;const P=me(n,x,s,c,e);if(!P)return;let N=tt(t,m),v=!1,O=null,V=!1,B=null;function F(){if(!u||!m)return;const[G,Q]=le(N,m,C);f({x:G,y:Q}),L=requestAnimationFrame(F)}const R={...P,nodeId:n,type:x,position:P.position},k=c.get(n);let S={inProgress:!0,isValid:null,from:ft(k,R,z.Left,!0),fromHandle:R,fromPosition:R.position,fromNode:k,to:N,toHandle:null,toPosition:Gt[R.position],toNode:null,pointer:N};function W(){Y=!0,g(S),d==null||d(t,{nodeId:n,handleId:s,handleType:x})}A===0&&W();function q(G){if(!Y){const{x:et,y:$e}=tt(G),Wt=et-$,_t=$e-w;if(!(Wt*Wt+_t*_t>A*A))return;W()}if(!X()||!R){U(G);return}const Q=T();N=tt(G,m),D=on(de(N,Q,!1,[1,1]),i,c,R),v||(F(),v=!0);const _=be(G,{handle:D,connectionMode:e,fromNodeId:n,fromHandleId:s,fromType:o?"target":"source",isValidConnection:M,doc:E,lib:l,flowId:h,nodeLookup:c});B=_.handleDomNode,O=_.connection,V=rn(!!D,_.isValid);const Z=c.get(n),J=Z?ft(Z,R,z.Left,!0):S.from,K={...S,from:J,isValid:V,to:_.toHandle&&V?Pt({x:_.toHandle.x,y:_.toHandle.y},Q):N,toHandle:_.toHandle,toPosition:V&&_.toHandle?_.toHandle.position:Gt[R.position],toNode:_.toHandle?c.get(_.toHandle.nodeId):null,pointer:N};g(K),S=K}function U(G){if(!("touches"in G&&G.touches.length>0)){if(Y){(D||B)&&O&&V&&(p==null||p(O));const{inProgress:Q,..._}=S,Z={..._,toPosition:S.toHandle?S.toPosition:null};b==null||b(G,Z),r&&(I==null||I(G,Z))}y(),cancelAnimationFrame(L),v=!1,V=!1,O=null,B=null,E.removeEventListener("mousemove",q),E.removeEventListener("mouseup",U),E.removeEventListener("touchmove",q),E.removeEventListener("touchend",U)}}E.addEventListener("mousemove",q),E.addEventListener("mouseup",U),E.addEventListener("touchmove",q),E.addEventListener("touchend",U)}function be(t,{handle:e,connectionMode:i,fromNodeId:s,fromHandleId:n,fromType:r,doc:o,lib:a,flowId:c,isValidConnection:l=Me,nodeLookup:u}){const h=r==="target",f=e?o.querySelector(`.${a}-flow__handle[data-id="${c}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:y,y:d}=tt(t),p=o.elementFromPoint(y,d),b=p!=null&&p.classList.contains(`${a}-flow__handle`)?p:f,M={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const I=we(void 0,b),g=b.getAttribute("data-nodeid"),T=b.getAttribute("data-handleid"),X=b.classList.contains("connectable"),C=b.classList.contains("connectableend");if(!g||!I)return M;const A={source:h?g:s,sourceHandle:h?T:n,target:h?s:g,targetHandle:h?n:T};M.connection=A;const E=X&&C&&(i===mt.Strict?h&&I==="source"||!h&&I==="target":g!==s||T!==n);M.isValid=E&&l(A),M.toHandle=me(g,I,T,u,i,!0)}return M}const Qn={onPointerDown:an,isValid:be};function Jn({domNode:t,panZoom:e,getTransform:i,getViewScale:s}){const n=Mt(t);function r({translateExtent:a,width:c,height:l,zoomStep:u=1,pannable:h=!0,zoomable:f=!0,inversePan:y=!1}){const d=g=>{if(g.sourceEvent.type!=="wheel"||!e)return;const T=i(),X=g.sourceEvent.ctrlKey&&zt()?10:1,C=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,A=T[2]*Math.pow(2,C*X);e.scaleTo(A)};let p=[0,0];const b=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(p=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},M=g=>{const T=i();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!e)return;const X=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],C=[X[0]-p[0],X[1]-p[1]];p=X;const A=s()*Math.max(T[2],Math.log(T[2]))*(y?-1:1),H={x:T[0]-C[0]*A,y:T[1]-C[1]*A},E=[[0,0],[c,l]];e.setViewportConstrained({x:H.x,y:H.y,zoom:T[2]},E,a)},I=oe().on("start",b).on("zoom",h?M:null).on("zoom.wheel",f?d:null);n.call(I,{})}function o(){n.on("zoom",null)}return{update:r,destroy:o,pointer:se}}const Tt=t=>({x:t.x,y:t.y,zoom:t.k}),vt=({x:t,y:e,zoom:i})=>Ce.translate(t,e).scale(i),lt=(t,e)=>t.target.closest(`.${e}`),Ee=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),cn=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,It=(t,e=0,i=cn,s=()=>{})=>{const n=typeof e=="number"&&e>0;return n||s(),n?t.transition().duration(e).ease(i).on("end",s):t},He=t=>{const e=t.ctrlKey&&zt()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function ln({zoomPanValues:t,noWheelClassName:e,d3Selection:i,d3Zoom:s,panOnScrollMode:n,panOnScrollSpeed:r,zoomOnPinch:o,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(lt(u,e))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const h=i.property("__zoom").k||1;if(u.ctrlKey&&o){const b=se(u),M=He(u),I=h*Math.pow(2,M);s.scaleTo(i,I,b,u);return}const f=u.deltaMode===1?20:1;let y=n===dt.Vertical?0:u.deltaX*f,d=n===dt.Horizontal?0:u.deltaY*f;!zt()&&u.shiftKey&&n!==dt.Vertical&&(y=u.deltaY*f,d=0),s.translateBy(i,-(y/h)*r,-(d/h)*r,{internal:!0});const p=Tt(i.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?c==null||c(u,p):(t.isPanScrolling=!0,a==null||a(u,p)),t.panScrollTimeout=setTimeout(()=>{l==null||l(u,p),t.isPanScrolling=!1},150)}}function un({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:i}){return function(s,n){const r=s.type==="wheel",o=!e&&r&&!s.ctrlKey,a=lt(s,t);if(s.ctrlKey&&r&&a&&s.preventDefault(),o||a)return null;s.preventDefault(),i.call(this,s,n)}}function fn({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:i}){return s=>{var r,o,a;if((r=s.sourceEvent)!=null&&r.internal)return;const n=Tt(s.transform);t.mouseButton=((o=s.sourceEvent)==null?void 0:o.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=n,((a=s.sourceEvent)==null?void 0:a.type)==="mousedown"&&e(!0),i&&(i==null||i(s.sourceEvent,n))}}function dn({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:i,onTransformChange:s,onPanZoom:n}){return r=>{var o,a;t.usedRightMouseButton=!!(i&&Ee(e,t.mouseButton??0)),(o=r.sourceEvent)!=null&&o.sync||s([r.transform.x,r.transform.y,r.transform.k]),n&&!((a=r.sourceEvent)!=null&&a.internal)&&(n==null||n(r.sourceEvent,Tt(r.transform)))}}function hn({zoomPanValues:t,panOnDrag:e,panOnScroll:i,onDraggingChange:s,onPanZoomEnd:n,onPaneContextMenu:r}){return o=>{var a;if(!((a=o.sourceEvent)!=null&&a.internal)&&(t.isZoomingOrPanning=!1,r&&Ee(e,t.mouseButton??0)&&!t.usedRightMouseButton&&o.sourceEvent&&r(o.sourceEvent),t.usedRightMouseButton=!1,s(!1),n)){const c=Tt(o.transform);t.prevViewport=c,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{n==null||n(o.sourceEvent,c)},i?150:0)}}}function yn({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:i,panOnDrag:s,panOnScroll:n,zoomOnDoubleClick:r,userSelectionActive:o,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:u}){return h=>{var b;const f=t||e,y=i&&h.ctrlKey,d=h.type==="wheel";if(h.button===1&&h.type==="mousedown"&&(lt(h,`${l}-flow__node`)||lt(h,`${l}-flow__edge`)))return!0;if(!s&&!f&&!n&&!r&&!i||o||u&&!d||lt(h,a)&&d||lt(h,c)&&(!d||n&&d&&!t)||!i&&h.ctrlKey&&d)return!1;if(!i&&h.type==="touchstart"&&((b=h.touches)==null?void 0:b.length)>1)return h.preventDefault(),!1;if(!f&&!n&&!y&&d||!s&&(h.type==="mousedown"||h.type==="touchstart")||Array.isArray(s)&&!s.includes(h.button)&&h.type==="mousedown")return!1;const p=Array.isArray(s)&&s.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||d)&&p}}function Zn({domNode:t,minZoom:e,maxZoom:i,translateExtent:s,viewport:n,onPanZoom:r,onPanZoomStart:o,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=t.getBoundingClientRect();let h=[[0,0],[u.width,u.height]];const f=typeof ResizeObserver<"u"?new ResizeObserver(w=>{const x=w[0];x&&(h=[[0,0],[x.contentRect.width,x.contentRect.height]])}):null;f==null||f.observe(t);const y=oe().extent(()=>h).scaleExtent([e,i]).translateExtent(s),d=Mt(t).call(y);T({x:n.x,y:n.y,zoom:ut(n.zoom,e,i)},[[0,0],[u.width,u.height]],s);const p=d.on("wheel.zoom"),b=d.on("dblclick.zoom");y.wheelDelta(He);async function M(w,x){return d?new Promise(m=>{y==null||y.interpolate((x==null?void 0:x.interpolate)==="linear"?Ct:$t).transform(It(d,x==null?void 0:x.duration,x==null?void 0:x.ease,()=>m(!0)),w)}):!1}function I({noWheelClassName:w,noPanClassName:x,onPaneContextMenu:m,userSelectionActive:Y,panOnScroll:P,panOnDrag:N,panOnScrollMode:v,panOnScrollSpeed:O,preventScrolling:V,zoomOnPinch:B,zoomOnScroll:F,zoomOnDoubleClick:R,zoomActivationKeyPressed:k,lib:j,onTransformChange:S,connectionInProgress:W,paneClickDistance:q,selectionOnDrag:U}){Y&&!l.isZoomingOrPanning&&g();const G=P&&!k&&!Y;y.clickDistance(U?1/0:!ot(q)||q<0?0:q);const Q=G?ln({zoomPanValues:l,noWheelClassName:w,d3Selection:d,d3Zoom:y,panOnScrollMode:v,panOnScrollSpeed:O,zoomOnPinch:B,onPanZoomStart:o,onPanZoom:r,onPanZoomEnd:a}):un({noWheelClassName:w,preventScrolling:V,d3ZoomHandler:p});d.on("wheel.zoom",Q,{passive:!1});const _=fn({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});y.on("start",_);const Z=dn({zoomPanValues:l,panOnDrag:N,onPaneContextMenu:!!m,onPanZoom:r,onTransformChange:S});y.on("zoom",Z);const J=hn({zoomPanValues:l,panOnDrag:N,panOnScroll:P,onPaneContextMenu:m,onPanZoomEnd:a,onDraggingChange:c});y.on("end",J);const K=yn({zoomActivationKeyPressed:k,panOnDrag:N,zoomOnScroll:F,panOnScroll:P,zoomOnDoubleClick:R,zoomOnPinch:B,userSelectionActive:Y,noPanClassName:x,noWheelClassName:w,lib:j,connectionInProgress:W});y.filter(K),R?d.on("dblclick.zoom",b):d.on("dblclick.zoom",null)}function g(){y.on("zoom",null)}async function T(w,x,m){const Y=vt(w),P=y==null?void 0:y.constrain()(Y,x,m);return P&&await M(P),P}async function X(w,x){const m=vt(w);return await M(m,x),m}function C(w){if(d){const x=vt(w),m=d.property("__zoom");(m.k!==w.zoom||m.x!==w.x||m.y!==w.y)&&(y==null||y.transform(d,x,null,{sync:!0}))}}function A(){const w=d?Ae(d.node()):{x:0,y:0,k:1};return{x:w.x,y:w.y,zoom:w.k}}async function H(w,x){return d?new Promise(m=>{y==null||y.interpolate((x==null?void 0:x.interpolate)==="linear"?Ct:$t).scaleTo(It(d,x==null?void 0:x.duration,x==null?void 0:x.ease,()=>m(!0)),w)}):!1}async function E(w,x){return d?new Promise(m=>{y==null||y.interpolate((x==null?void 0:x.interpolate)==="linear"?Ct:$t).scaleBy(It(d,x==null?void 0:x.duration,x==null?void 0:x.ease,()=>m(!0)),w)}):!1}function L(w){y==null||y.scaleExtent(w)}function D(w){y==null||y.translateExtent(w)}function $(w){const x=!ot(w)||w<0?0:w;y==null||y.clickDistance(x)}return{update:I,destroy:g,setViewport:X,setViewportConstrained:T,getViewport:A,scaleTo:H,scaleBy:E,setScaleExtent:L,setTranslateExtent:D,syncViewport:C,setClickDistance:$}}var ee;(function(t){t.Line="line",t.Handle="handle"})(ee||(ee={}));function xn({width:t,prevWidth:e,height:i,prevHeight:s,affectsX:n,affectsY:r}){const o=t-e,a=i-s,c=[o>0?1:o<0?-1:0,a>0?1:a<0?-1:0];return o&&n&&(c[0]=c[0]*-1),a&&r&&(c[1]=c[1]*-1),c}function ne(t){const e=t.includes("right")||t.includes("left"),i=t.includes("bottom")||t.includes("top"),s=t.includes("left"),n=t.includes("top");return{isHorizontal:e,isVertical:i,affectsX:s,affectsY:n}}function nt(t,e){return Math.max(0,e-t)}function it(t,e){return Math.max(0,t-e)}function gt(t,e,i){return Math.max(0,e-t,t-i)}function ie(t,e){return t?!e:e}function gn(t,e,i,s,n,r,o,a){let{affectsX:c,affectsY:l}=e;const{isHorizontal:u,isVertical:h}=e,f=u&&h,{xSnapped:y,ySnapped:d}=i,{minWidth:p,maxWidth:b,minHeight:M,maxHeight:I}=s,{x:g,y:T,width:X,height:C,aspectRatio:A}=t;let H=Math.floor(u?y-t.pointerX:0),E=Math.floor(h?d-t.pointerY:0);const L=X+(c?-H:H),D=C+(l?-E:E),$=-r[0]*X,w=-r[1]*C;let x=gt(L,p,b),m=gt(D,M,I);if(o){let N=0,v=0;c&&H<0?N=nt(g+H+$,o[0][0]):!c&&H>0&&(N=it(g+L+$,o[1][0])),l&&E<0?v=nt(T+E+w,o[0][1]):!l&&E>0&&(v=it(T+D+w,o[1][1])),x=Math.max(x,N),m=Math.max(m,v)}if(a){let N=0,v=0;c&&H>0?N=it(g+H,a[0][0]):!c&&H<0&&(N=nt(g+L,a[1][0])),l&&E>0?v=it(T+E,a[0][1]):!l&&E<0&&(v=nt(T+D,a[1][1])),x=Math.max(x,N),m=Math.max(m,v)}if(n){if(u){const N=gt(L/A,M,I)*A;if(x=Math.max(x,N),o){let v=0;!c&&!l||c&&!l&&f?v=it(T+w+L/A,o[1][1])*A:v=nt(T+w+(c?H:-H)/A,o[0][1])*A,x=Math.max(x,v)}if(a){let v=0;!c&&!l||c&&!l&&f?v=nt(T+L/A,a[1][1])*A:v=it(T+(c?H:-H)/A,a[0][1])*A,x=Math.max(x,v)}}if(h){const N=gt(D*A,p,b)/A;if(m=Math.max(m,N),o){let v=0;!c&&!l||l&&!c&&f?v=it(g+D*A+$,o[1][0])/A:v=nt(g+(l?E:-E)*A+$,o[0][0])/A,m=Math.max(m,v)}if(a){let v=0;!c&&!l||l&&!c&&f?v=nt(g+D*A,a[1][0])/A:v=it(g+(l?E:-E)*A,a[0][0])/A,m=Math.max(m,v)}}}E=E+(E<0?m:-m),H=H+(H<0?x:-x),n&&(f?L>D*A?E=(ie(c,l)?-H:H)/A:H=(ie(c,l)?-E:E)*A:u?(E=H/A,l=c):(H=E*A,c=l));const Y=c?g+H:g,P=l?T+E:T;return{width:X+(c?-H:H),height:C+(l?-E:E),x:r[0]*H*(c?-1:1)+Y,y:r[1]*E*(l?-1:1)+P}}const Te={width:0,height:0,x:0,y:0},pn={...Te,pointerX:0,pointerY:0,aspectRatio:1};function mn(t,e,i){const s=e.position.x+t.position.x,n=e.position.y+t.position.y,r=t.measured.width??0,o=t.measured.height??0,a=i[0]*r,c=i[1]*o;return[[s-a,n-c],[s+r-a,n+o-c]]}function ti({domNode:t,nodeId:e,getStoreItems:i,onChange:s,onEnd:n}){const r=Mt(t);let o={controlDirection:ne("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:u,keepAspectRatio:h,resizeDirection:f,onResizeStart:y,onResize:d,onResizeEnd:p,shouldResize:b}){let M={...Te},I={...pn};o={boundaries:u,resizeDirection:f,keepAspectRatio:h,controlDirection:ne(l)};let g,T=null,X=[],C,A,H,E=!1;const L=re().on("start",D=>{const{nodeLookup:$,transform:w,snapGrid:x,snapToGrid:m,nodeOrigin:Y,paneDomNode:P}=i();if(g=$.get(e),!g)return;T=(P==null?void 0:P.getBoundingClientRect())??null;const{xSnapped:N,ySnapped:v}=ht(D.sourceEvent,{transform:w,snapGrid:x,snapToGrid:m,containerBounds:T});M={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},I={...M,pointerX:N,pointerY:v,aspectRatio:M.width/M.height},C=void 0,A=at(g.extent)?g.extent:void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(C=$.get(g.parentId)),C&&g.extent==="parent"&&(A=[[0,0],[C.measured.width,C.measured.height]]),X=[],H=void 0;for(const[O,V]of $)if(V.parentId===e&&(X.push({id:O,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const B=mn(V,g,V.origin??Y);H?H=[[Math.min(B[0][0],H[0][0]),Math.min(B[0][1],H[0][1])],[Math.max(B[1][0],H[1][0]),Math.max(B[1][1],H[1][1])]]:H=B}y==null||y(D,{...M})}).on("drag",D=>{const{transform:$,snapGrid:w,snapToGrid:x,nodeOrigin:m}=i(),Y=ht(D.sourceEvent,{transform:$,snapGrid:w,snapToGrid:x,containerBounds:T}),P=[];if(!g)return;const{x:N,y:v,width:O,height:V}=M,B={},F=g.origin??m,{width:R,height:k,x:j,y:S}=gn(I,o.controlDirection,Y,o.boundaries,o.keepAspectRatio,F,A,H),W=R!==O,q=k!==V,U=j!==N&&W,G=S!==v&&q;if(!U&&!G&&!W&&!q)return;if((U||G||F[0]===1||F[1]===1)&&(B.x=U?j:M.x,B.y=G?S:M.y,M.x=B.x,M.y=B.y,X.length>0)){const J=j-N,K=S-v;for(const et of X)et.position={x:et.position.x-J+F[0]*(R-O),y:et.position.y-K+F[1]*(k-V)},P.push(et)}if((W||q)&&(B.width=W&&(!o.resizeDirection||o.resizeDirection==="horizontal")?R:M.width,B.height=q&&(!o.resizeDirection||o.resizeDirection==="vertical")?k:M.height,M.width=B.width,M.height=B.height),C&&g.expandParent){const J=F[0]*(B.width??0);B.x&&B.x<J&&(M.x=J,I.x=I.x-(B.x-J));const K=F[1]*(B.height??0);B.y&&B.y<K&&(M.y=K,I.y=I.y-(B.y-K))}const Q=xn({width:M.width,prevWidth:O,height:M.height,prevHeight:V,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),_={...M,direction:Q};(b==null?void 0:b(D,_))!==!1&&(E=!0,d==null||d(D,_),s(B,P))}).on("end",D=>{E&&(p==null||p(D,{...M}),n==null||n({...M}),E=!1)});r.call(L)}function c(){r.on(".drag",null)}return{update:a,destroy:c}}export{he as $,ve as A,dt as B,mt as C,Rt as D,zt as E,ze as F,ae as G,ti as H,Zn as I,Kn as J,Ht as K,Ye as L,Ft as M,Cn as N,Dn as O,z as P,bn as Q,ee as R,Lt as S,ot as T,Ln as U,Wn as V,Hn as W,Jn as X,Xn as Y,tt as Z,Le as _,fe as a,le as a0,Yn as a1,En as a2,Un as a3,qn as a4,ft as a5,Ze as a6,kn as a7,Sn as a8,jn as a9,An as aa,Ie as ab,vn as b,Oe as c,Qn as d,pt as e,_e as f,$n as g,Ve as h,In as i,Bn as j,Tn as k,Ne as l,_n as m,Yt as n,Pn as o,de as p,Nn as q,Pt as r,st as s,Gn as t,Rn as u,Vn as v,zn as w,Fn as x,On as y,ke as z};
|