@workflow/web 4.1.0-beta.43 → 4.1.0-beta.44

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.
Files changed (20) hide show
  1. package/build/client/assets/{highlighted-body-B3W2YXNL-BdpKyd6t.js → highlighted-body-B3W2YXNL-BAmp2St7.js} +1 -1
  2. package/build/client/assets/{home-C884R8Ik.js → home-CFxVErsy.js} +1 -1
  3. package/build/client/assets/{manifest-14123a0c.js → manifest-beaac576.js} +1 -1
  4. package/build/client/assets/{mermaid-3ZIDBTTL-D6v4WgFl.js → mermaid-3ZIDBTTL-CrmlsXj3.js} +63 -63
  5. package/build/client/assets/{root-CxkGJJO9.js → root-DXnpwJxc.js} +1 -1
  6. package/build/client/assets/{root-DUJPWGN3.css → root-DtrAdcW8.css} +1 -1
  7. package/build/client/assets/run-detail-C6LG6p9l.js +37 -0
  8. package/build/client/assets/{server-build-BFalDDpv.css → server-build-8B6V768r.css} +1 -1
  9. package/build/client/assets/use-workflow-graph-DGcT3V07.js +166 -0
  10. package/build/server/assets/{app-KW-1KXCl.js → app-DiZXH6x4.js} +1 -1
  11. package/build/server/assets/{highlighted-body-B3W2YXNL-DapKdL2n.js → highlighted-body-B3W2YXNL-CmDnR6fu.js} +2 -2
  12. package/build/server/assets/{index-93Io7SSr.js → index-cxStGfMq.js} +2 -2
  13. package/build/server/assets/{mermaid-3ZIDBTTL-BdsOvyTU.js → mermaid-3ZIDBTTL-CxsJnUQo.js} +2 -2
  14. package/build/server/assets/{server-build-D9d_jMLb.js → server-build-CZMYXF52.js} +842 -277
  15. package/build/server/assets/{token-Bf2BqxEG.js → token-C7BfiMAN.js} +2 -2
  16. package/build/server/assets/{token-util-C8FlMBAQ.js → token-util-CxDoe-ao.js} +2 -2
  17. package/build/server/index.js +1 -1
  18. package/package.json +6 -6
  19. package/build/client/assets/run-detail-D_eXHYm3.js +0 -36
  20. package/build/client/assets/use-workflow-graph-WEp5s5k_.js +0 -166
@@ -1,166 +0,0 @@
1
- var Wd=Object.defineProperty;var Bd=(e,t,n)=>t in e?Wd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Sr=(e,t,n)=>Bd(e,typeof t!="symbol"?t+"":t,n);import{c as ue,az as is,d as ae,aA as zi,aB as yo,E as me,aC as Vd,aD as Yd,aE as Gd,aF as Xd,aG as Ud,aH as qd,aI as Kd,aJ as Zd,aK as Qd,T as Se,a as _e,b as Ce,aL as Jd,aM as ef,aN as tf,aO as nf,aP as rf,p as xo,n as Xr,v as as,M as of,B as On,t as Re,s as Hi,P as At,q as ze,x as Wi,m as sf,G as af,aQ as cf}from"./mermaid-3ZIDBTTL-D6v4WgFl.js";import{r as x,j as p,f as Bi,R as de,D as uf,A as lf,a as Vi,G as df}from"./index-DklpUtP3.js";function Yi(e,t){if(typeof t!="string")return null;const[n,r,...o]=t.split("//");if(n!==e||!r||o.length===0)return null;const s=o.join("//");let i=s.split("/").at(-1)??"",a="";if(r.startsWith("./"))a=r.split("/").at(-1)??"";else{const c=r.split("@").slice(0,-1).join("@")||r.split("@")[0];a=(c==null?void 0:c.split("/").at(-1))??""}return["default","__default"].includes(i)&&a&&(i=a),{shortName:i,moduleSpecifier:r,functionName:s}}function iS(e){return Yi("workflow",e)}function aS(e){return Yi("step",e)}/**
2
- * @license lucide-react v0.575.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const ff=[["path",{d:"M6.87 6.87a8 8 0 1 0 11.26 11.26",key:"3on8tj"}],["path",{d:"M19.9 14.25a8 8 0 0 0-9.15-9.15",key:"15ghsc"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.26 18.67 4 21",key:"yzmioq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M4 4 2 6",key:"1ycko6"}]],Gi=ue("alarm-clock-off",ff);/**
7
- * @license lucide-react v0.575.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const hf=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Vn=ue("check",hf);/**
12
- * @license lucide-react v0.575.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const pf=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],gf=ue("chevron-down",pf);/**
17
- * @license lucide-react v0.575.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const mf=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],yf=ue("chevron-right",mf);/**
22
- * @license lucide-react v0.575.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const xf=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],cS=ue("chevron-up",xf);/**
27
- * @license lucide-react v0.575.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const wf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],vf=ue("circle-alert",wf);/**
32
- * @license lucide-react v0.575.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */const bf=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ef=ue("circle-play",bf);/**
37
- * @license lucide-react v0.575.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */const Sf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],_f=ue("circle-stop",Sf);/**
42
- * @license lucide-react v0.575.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */const Cf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Xi=ue("circle-x",Cf);/**
47
- * @license lucide-react v0.575.0 - ISC
48
- *
49
- * This source code is licensed under the ISC license.
50
- * See the LICENSE file in the root directory of this source tree.
51
- */const Nf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Mf=ue("circle",Nf);/**
52
- * @license lucide-react v0.575.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */const kf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],cs=ue("clock",kf);/**
57
- * @license lucide-react v0.575.0 - ISC
58
- *
59
- * This source code is licensed under the ISC license.
60
- * See the LICENSE file in the root directory of this source tree.
61
- */const Pf=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Ur=ue("copy",Pf);/**
62
- * @license lucide-react v0.575.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */const If=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Af=ue("ellipsis",If);/**
67
- * @license lucide-react v0.575.0 - ISC
68
- *
69
- * This source code is licensed under the ISC license.
70
- * See the LICENSE file in the root directory of this source tree.
71
- */const Rf=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],uS=ue("git-branch",Rf);/**
72
- * @license lucide-react v0.575.0 - ISC
73
- *
74
- * This source code is licensed under the ISC license.
75
- * See the LICENSE file in the root directory of this source tree.
76
- */const Tf=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Df=ue("link-2",Tf);/**
77
- * @license lucide-react v0.575.0 - ISC
78
- *
79
- * This source code is licensed under the ISC license.
80
- * See the LICENSE file in the root directory of this source tree.
81
- */const jf=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Ui=ue("rotate-cw",jf);/**
82
- * @license lucide-react v0.575.0 - ISC
83
- *
84
- * This source code is licensed under the ISC license.
85
- * See the LICENSE file in the root directory of this source tree.
86
- */const Of=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],$f=ue("send",Of);/**
87
- * @license lucide-react v0.575.0 - ISC
88
- *
89
- * This source code is licensed under the ISC license.
90
- * See the LICENSE file in the root directory of this source tree.
91
- */const Lf=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ff=ue("x",Lf);/**
92
- * @license lucide-react v0.575.0 - ISC
93
- *
94
- * This source code is licensed under the ISC license.
95
- * See the LICENSE file in the root directory of this source tree.
96
- */const zf=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],wo=ue("zap",zf);function Hf({title:e,className:t,details:n="Unknown error"}){const[r,o]=x.useState(!1);return p.jsx("div",{className:"flex justify-center w-full",children:p.jsxs("div",{className:is("rounded-lg border border-red-400 w-full max-w-[800px]",t),style:{background:"var(--ds-red-100)"},children:[p.jsxs("button",{type:"button",onClick:()=>o(!r),className:"w-full px-4 py-3 flex items-center justify-between gap-2 text-left transition-colors",style:{color:"var(--ds-red-900)"},children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(vf,{className:"h-4 w-4 shrink-0"}),p.jsx("span",{className:"font-medium text-sm",children:e})]}),p.jsxs("div",{className:"flex items-center gap-1.5 opacity-70",children:[p.jsx("span",{className:"text-xs",children:"Click to show details"}),p.jsx(gf,{className:is("h-4 w-4 transition-transform duration-200",r&&"rotate-180")})]})]}),r&&n&&p.jsx("div",{className:"px-4 pb-3",style:{borderTop:"1px solid var(--ds-red-400)"},children:p.jsx("pre",{className:"mt-3 p-3 rounded-md text-xs font-mono whitespace-pre-wrap break-words overflow-auto",style:{background:"var(--ds-red-200)",color:"var(--ds-red-900)"},children:n})})]})})}class lS extends x.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}retry(){this.setState({hasError:!1,error:null})}componentDidCatch(t,n){var r,o;(o=(r=this.props).onCatch)==null||o.call(r,t,()=>this.retry())}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const t=this.state.error instanceof Error?this.state.error:null,n=t!=null&&t.stack?`${t.message}
97
-
98
- ${t.stack}`:(t==null?void 0:t.message)??"Unknown error";return p.jsx(Hf,{title:this.props.title||"An error occurred",details:n})}return this.props.children}}function dS({isOpen:e,onClose:t,onSubmit:n,isSubmitting:r=!1}){var g;const[o,s]=x.useState(""),[i,a]=x.useState(null),c=x.useRef(null);x.useEffect(()=>{e&&c.current&&c.current.focus()},[e]),x.useEffect(()=>{e||(s(""),a(null))},[e]),x.useEffect(()=>{const h=m=>{m.key==="Escape"&&e&&!r&&t()};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,r,t]);const l=x.useCallback(async()=>{a(null);let h;try{o.trim()===""?h=null:h=JSON.parse(o)}catch{a("Invalid JSON. Please check your input.");return}await n(h)},[o,n]),d=x.useCallback(h=>{h.preventDefault(),l()},[l]),u=typeof navigator<"u"&&(((g=navigator.userAgentData)==null?void 0:g.platform)??navigator.userAgent).toLowerCase().includes("mac"),f=x.useCallback(h=>{(h.metaKey||h.ctrlKey)&&h.key==="Enter"&&!r&&(h.preventDefault(),d(h))},[d,r]);return e?p.jsxs("div",{style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center"},role:"dialog","aria-modal":"true","aria-labelledby":"resolve-hook-modal-title",children:[p.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(0, 0, 0, 0.7)"},onClick:r?void 0:t}),p.jsxs("div",{style:{position:"relative",zIndex:10,width:480,maxWidth:"calc(100% - 32px)",borderRadius:12,border:"none",boxShadow:"var(--ds-shadow-menu)",background:"var(--ds-background-100)",color:"var(--ds-gray-1000)",overflow:"hidden"},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 24px"},children:[p.jsx("h2",{id:"resolve-hook-modal-title",style:{margin:0,fontSize:16,fontWeight:600,color:"var(--ds-gray-1000)"},children:"Resolve Hook"}),p.jsx("button",{type:"button",onClick:t,disabled:r,"aria-label":"Close modal",style:{display:"flex",alignItems:"center",justifyContent:"center",padding:4,borderRadius:6,border:"none",background:"transparent",color:"var(--ds-gray-900)",cursor:r?"not-allowed":"pointer",opacity:r?.5:1,transition:"background 0.15s"},onMouseEnter:h=>{h.currentTarget.style.background="var(--ds-gray-alpha-200)"},onMouseLeave:h=>{h.currentTarget.style.background="transparent"},children:p.jsx(Ff,{style:{width:16,height:16}})})]}),p.jsxs("form",{onSubmit:d,children:[p.jsxs("div",{style:{padding:"0 24px 16px"},children:[p.jsx("label",{htmlFor:"json-payload",style:{display:"block",fontSize:14,fontWeight:500,marginBottom:6,color:"var(--ds-gray-1000)"},children:"JSON Payload"}),p.jsxs("p",{style:{fontSize:13,marginBottom:12,marginTop:0,color:"var(--ds-gray-900)",lineHeight:1.5},children:["Enter a JSON value to send to the hook. Leave empty to send"," ",p.jsx("code",{style:{padding:"2px 6px",borderRadius:4,fontSize:12,fontFamily:'var(--font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace)',background:"var(--ds-gray-alpha-200)",color:"var(--ds-gray-1000)"},children:"null"}),"."]}),p.jsx("textarea",{ref:c,id:"json-payload",value:o,onChange:h=>{s(h.target.value),a(null)},onKeyDown:f,disabled:r,placeholder:'{"key": "value"}',style:{width:"100%",height:160,padding:"8px 12px",fontFamily:'var(--font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace)',fontSize:13,lineHeight:1.5,borderRadius:8,border:`1px solid ${i?"var(--ds-red-700)":"var(--ds-gray-alpha-400)"}`,color:"var(--ds-gray-1000)",background:"var(--ds-background-100)",outline:"none",resize:"none",opacity:r?.5:1,cursor:r?"not-allowed":"text",boxSizing:"border-box"}}),i&&p.jsx("p",{style:{marginTop:8,fontSize:13,color:"var(--ds-red-900)",margin:"8px 0 0"},children:i}),p.jsxs("p",{style:{marginTop:8,fontSize:12,color:"var(--ds-gray-800)",margin:"8px 0 0"},children:["Press"," ",p.jsxs("kbd",{style:{padding:"2px 5px",borderRadius:4,fontSize:11,fontFamily:'var(--font-mono, ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace)',background:"var(--ds-gray-alpha-200)",border:"1px solid var(--ds-gray-alpha-400)"},children:[u?"⌘":"Ctrl","+Enter"]})," ","to submit"]})]}),p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"12px 24px",borderTop:"1px solid var(--ds-gray-alpha-400)"},children:[p.jsx("button",{type:"button",onClick:t,disabled:r,style:{padding:"8px 16px",fontSize:14,fontWeight:500,borderRadius:8,border:"1px solid var(--ds-gray-alpha-400)",background:"var(--ds-background-100)",color:"var(--ds-gray-1000)",cursor:r?"not-allowed":"pointer",opacity:r?.5:1,transition:"background 0.15s"},onMouseEnter:h=>{h.currentTarget.style.background="var(--ds-gray-alpha-100)"},onMouseLeave:h=>{h.currentTarget.style.background="var(--ds-background-100)"},children:"Cancel"}),p.jsxs("button",{type:"button",onClick:()=>void l(),disabled:r,style:{display:"flex",alignItems:"center",gap:6,padding:"8px 16px",fontSize:14,fontWeight:500,borderRadius:8,border:"none",background:"var(--ds-gray-1000)",color:"var(--ds-background-100)",cursor:r?"not-allowed":"pointer",opacity:r?.5:1,transition:"opacity 0.15s"},onMouseEnter:h=>{r||(h.currentTarget.style.opacity="0.9")},onMouseLeave:h=>{r||(h.currentTarget.style.opacity="1")},children:[p.jsx($f,{style:{width:14,height:14}}),r?"Sending...":"Send Payload"]})]})]})]})]}):null}function Wf(e){if(!e||e.length===0)return{hasPendingSleeps:!1,hasPendingSteps:!1,hasPendingHooks:!1,pendingSleepIds:[],pendingStepIds:[],pendingHookIds:[],lastStepActivityAt:null,lastStepCompletionAt:null};const t=new Map,n=new Set,r=new Map,o=new Set,s=new Map,i=new Set;let a=null,c=null;for(const f of e){const g=f.correlationId;if(g)switch(f.eventType){case"wait_created":t.set(g,f);break;case"wait_completed":n.add(g);break;case"step_started":r.set(g,f),(!a||new Date(f.createdAt)>a)&&(a=new Date(f.createdAt));break;case"step_retrying":(!a||new Date(f.createdAt)>a)&&(a=new Date(f.createdAt));break;case"step_completed":case"step_failed":o.add(g),(!c||new Date(f.createdAt)>c)&&(c=new Date(f.createdAt));break;case"hook_created":s.set(g,f);break;case"hook_disposed":i.add(g);break}}const l=Array.from(t.keys()).filter(f=>!n.has(f)),d=Array.from(r.keys()).filter(f=>!o.has(f)),u=Array.from(s.keys()).filter(f=>!i.has(f));return{hasPendingSleeps:l.length>0,hasPendingSteps:d.length>0,hasPendingHooks:u.length>0,pendingSleepIds:l,pendingStepIds:d,pendingHookIds:u,lastStepActivityAt:a,lastStepCompletionAt:c}}const Bf=zi("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Vf=x.forwardRef(({className:e,variant:t,...n},r)=>p.jsx("div",{ref:r,role:"alert",className:ae(Bf({variant:t}),e),...n}));Vf.displayName="Alert";const Yf=x.forwardRef(({className:e,...t},n)=>p.jsx("h5",{ref:n,className:ae("mb-1 font-medium leading-none tracking-tight",e),...t}));Yf.displayName="AlertTitle";const Gf=x.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:ae("text-sm [&_p]:leading-relaxed",e),...t}));Gf.displayName="AlertDescription";function ne(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function fS(e,t){const n=x.createContext(t),r=s=>{const{children:i,...a}=s,c=x.useMemo(()=>a,Object.values(a));return p.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=x.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function sn(e,t=[]){let n=[];function r(s,i){const a=x.createContext(i),c=n.length;n=[...n,i];const l=u=>{var v;const{scope:f,children:g,...h}=u,m=((v=f==null?void 0:f[e])==null?void 0:v[c])||a,w=x.useMemo(()=>h,Object.values(h));return p.jsx(m.Provider,{value:w,children:g})};l.displayName=s+"Provider";function d(u,f){var m;const g=((m=f==null?void 0:f[e])==null?void 0:m[c])||a,h=x.useContext(g);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${u}\` must be used within \`${s}\``)}return[l,d]}const o=()=>{const s=n.map(i=>x.createContext(i));return function(a){const c=(a==null?void 0:a[e])||s;return x.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,Xf(o,...t)]}function Xf(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:c,scopeName:l})=>{const u=c(s)[`__scope${l}`];return{...a,...u}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Pe(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function qi({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=Uf({defaultProp:t,onChange:n}),s=e!==void 0,i=s?e:r,a=Pe(n),c=x.useCallback(l=>{if(s){const u=typeof l=="function"?l(e):l;u!==e&&a(u)}else o(l)},[s,e,o,a]);return[i,c]}function Uf({defaultProp:e,onChange:t}){const n=x.useState(e),[r]=n,o=x.useRef(r),s=Pe(t);return x.useEffect(()=>{o.current!==r&&(s(r),o.current=r)},[r,o,s]),n}var Gt=x.forwardRef((e,t)=>{const{children:n,...r}=e,o=x.Children.toArray(n),s=o.find(Kf);if(s){const i=s.props.children,a=o.map(c=>c===s?x.Children.count(i)>1?x.Children.only(null):x.isValidElement(i)?i.props.children:null:c);return p.jsx(qr,{...r,ref:t,children:x.isValidElement(i)?x.cloneElement(i,void 0,a):null})}return p.jsx(qr,{...r,ref:t,children:n})});Gt.displayName="Slot";var qr=x.forwardRef((e,t)=>{const{children:n,...r}=e;if(x.isValidElement(n)){const o=Qf(n),s=Zf(r,n.props);return n.type!==x.Fragment&&(s.ref=t?yo(t,o):o),x.cloneElement(n,s)}return x.Children.count(n)>1?x.Children.only(null):null});qr.displayName="SlotClone";var qf=({children:e})=>p.jsx(p.Fragment,{children:e});function Kf(e){return x.isValidElement(e)&&e.type===qf}function Zf(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Qf(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Jf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],fe=Jf.reduce((e,t)=>{const n=x.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?Gt:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Ki(e,t){e&&Bi.flushSync(()=>e.dispatchEvent(t))}function Zi(e){const t=e+"CollectionProvider",[n,r]=sn(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:h,children:m}=g,w=de.useRef(null),v=de.useRef(new Map).current;return p.jsx(o,{scope:h,itemMap:v,collectionRef:w,children:m})};i.displayName=t;const a=e+"CollectionSlot",c=de.forwardRef((g,h)=>{const{scope:m,children:w}=g,v=s(a,m),E=me(h,v.collectionRef);return p.jsx(Gt,{ref:E,children:w})});c.displayName=a;const l=e+"CollectionItemSlot",d="data-radix-collection-item",u=de.forwardRef((g,h)=>{const{scope:m,children:w,...v}=g,E=de.useRef(null),y=me(h,E),b=s(l,m);return de.useEffect(()=>(b.itemMap.set(E,{ref:E,...v}),()=>void b.itemMap.delete(E))),p.jsx(Gt,{[d]:"",ref:y,children:w})});u.displayName=l;function f(g){const h=s(e+"CollectionConsumer",g);return de.useCallback(()=>{const w=h.collectionRef.current;if(!w)return[];const v=Array.from(w.querySelectorAll(`[${d}]`));return Array.from(h.itemMap.values()).sort((b,S)=>v.indexOf(b.ref.current)-v.indexOf(S.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:i,Slot:c,ItemSlot:u},f,r]}var eh=x.createContext(void 0);function Qi(e){const t=x.useContext(eh);return e||t||"ltr"}function th(e,t=globalThis==null?void 0:globalThis.document){const n=Pe(e);x.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var nh="DismissableLayer",Kr="dismissableLayer.update",rh="dismissableLayer.pointerDownOutside",oh="dismissableLayer.focusOutside",us,Ji=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ea=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...c}=e,l=x.useContext(Ji),[d,u]=x.useState(null),f=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=x.useState({}),h=me(t,M=>u(M)),m=Array.from(l.layers),[w]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),v=m.indexOf(w),E=d?m.indexOf(d):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=E>=v,S=ah(M=>{const P=M.target,T=[...l.branches].some(z=>z.contains(P));!b||T||(o==null||o(M),i==null||i(M),M.defaultPrevented||a==null||a())},f),C=ch(M=>{const P=M.target;[...l.branches].some(z=>z.contains(P))||(s==null||s(M),i==null||i(M),M.defaultPrevented||a==null||a())},f);return th(M=>{E===l.layers.size-1&&(r==null||r(M),!M.defaultPrevented&&a&&(M.preventDefault(),a()))},f),x.useEffect(()=>{if(d)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(us=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(d)),l.layers.add(d),ls(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=us)}},[d,f,n,l]),x.useEffect(()=>()=>{d&&(l.layers.delete(d),l.layersWithOutsidePointerEventsDisabled.delete(d),ls())},[d,l]),x.useEffect(()=>{const M=()=>g({});return document.addEventListener(Kr,M),()=>document.removeEventListener(Kr,M)},[]),p.jsx(fe.div,{...c,ref:h,style:{pointerEvents:y?b?"auto":"none":void 0,...e.style},onFocusCapture:ne(e.onFocusCapture,C.onFocusCapture),onBlurCapture:ne(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:ne(e.onPointerDownCapture,S.onPointerDownCapture)})});ea.displayName=nh;var sh="DismissableLayerBranch",ih=x.forwardRef((e,t)=>{const n=x.useContext(Ji),r=x.useRef(null),o=me(t,r);return x.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),p.jsx(fe.div,{...e,ref:o})});ih.displayName=sh;function ah(e,t=globalThis==null?void 0:globalThis.document){const n=Pe(e),r=x.useRef(!1),o=x.useRef(()=>{});return x.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let c=function(){ta(rh,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function ch(e,t=globalThis==null?void 0:globalThis.document){const n=Pe(e),r=x.useRef(!1);return x.useEffect(()=>{const o=s=>{s.target&&!r.current&&ta(oh,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ls(){const e=new CustomEvent(Kr);document.dispatchEvent(e)}function ta(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Ki(o,s):o.dispatchEvent(s)}var _r=0;function uh(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ds()),document.body.insertAdjacentElement("beforeend",e[1]??ds()),_r++,()=>{_r===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),_r--}},[])}function ds(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Cr="focusScope.autoFocusOnMount",Nr="focusScope.autoFocusOnUnmount",fs={bubbles:!1,cancelable:!0},lh="FocusScope",na=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,c]=x.useState(null),l=Pe(o),d=Pe(s),u=x.useRef(null),f=me(t,m=>c(m)),g=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(r){let m=function(y){if(g.paused||!a)return;const b=y.target;a.contains(b)?u.current=b:Ue(u.current,{select:!0})},w=function(y){if(g.paused||!a)return;const b=y.relatedTarget;b!==null&&(a.contains(b)||Ue(u.current,{select:!0}))},v=function(y){if(document.activeElement===document.body)for(const S of y)S.removedNodes.length>0&&Ue(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",w);const E=new MutationObserver(v);return a&&E.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",w),E.disconnect()}}},[r,a,g.paused]),x.useEffect(()=>{if(a){ps.add(g);const m=document.activeElement;if(!a.contains(m)){const v=new CustomEvent(Cr,fs);a.addEventListener(Cr,l),a.dispatchEvent(v),v.defaultPrevented||(dh(mh(ra(a)),{select:!0}),document.activeElement===m&&Ue(a))}return()=>{a.removeEventListener(Cr,l),setTimeout(()=>{const v=new CustomEvent(Nr,fs);a.addEventListener(Nr,d),a.dispatchEvent(v),v.defaultPrevented||Ue(m??document.body,{select:!0}),a.removeEventListener(Nr,d),ps.remove(g)},0)}}},[a,l,d,g]);const h=x.useCallback(m=>{if(!n&&!r||g.paused)return;const w=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,v=document.activeElement;if(w&&v){const E=m.currentTarget,[y,b]=fh(E);y&&b?!m.shiftKey&&v===b?(m.preventDefault(),n&&Ue(y,{select:!0})):m.shiftKey&&v===y&&(m.preventDefault(),n&&Ue(b,{select:!0})):v===E&&m.preventDefault()}},[n,r,g.paused]);return p.jsx(fe.div,{tabIndex:-1,...i,ref:f,onKeyDown:h})});na.displayName=lh;function dh(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ue(r,{select:t}),document.activeElement!==n)return}function fh(e){const t=ra(e),n=hs(t,e),r=hs(t.reverse(),e);return[n,r]}function ra(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function hs(e,t){for(const n of e)if(!hh(n,{upTo:t}))return n}function hh(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function ph(e){return e instanceof HTMLInputElement&&"select"in e}function Ue(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ph(e)&&t&&e.select()}}var ps=gh();function gh(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=gs(e,t),e.unshift(t)},remove(t){var n;e=gs(e,t),(n=e[0])==null||n.resume()}}}function gs(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function mh(e){return e.filter(t=>t.tagName!=="A")}var ot=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},yh=uf.useId||(()=>{}),xh=0;function Zr(e){const[t,n]=x.useState(yh());return ot(()=>{n(r=>r??String(xh++))},[e]),t?`radix-${t}`:""}var wh="Arrow",oa=x.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return p.jsx(fe.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});oa.displayName=wh;var vh=oa;function bh(e){const[t,n]=x.useState(void 0);return ot(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const c=s.borderBoxSize,l=Array.isArray(c)?c[0]:c;i=l.inlineSize,a=l.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var vo="Popper",[sa,ia]=sn(vo),[Eh,aa]=sa(vo),ca=e=>{const{__scopePopper:t,children:n}=e,[r,o]=x.useState(null);return p.jsx(Eh,{scope:t,anchor:r,onAnchorChange:o,children:n})};ca.displayName=vo;var ua="PopperAnchor",la=x.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=aa(ua,n),i=x.useRef(null),a=me(t,i);return x.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||i.current)}),r?null:p.jsx(fe.div,{...o,ref:a})});la.displayName=ua;var bo="PopperContent",[Sh,_h]=sa(bo),da=x.forwardRef((e,t)=>{var G,H,V,Q,Z,K;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:d=0,sticky:u="partial",hideWhenDetached:f=!1,updatePositionStrategy:g="optimized",onPlaced:h,...m}=e,w=aa(bo,n),[v,E]=x.useState(null),y=me(t,q=>E(q)),[b,S]=x.useState(null),C=bh(b),M=(C==null?void 0:C.width)??0,P=(C==null?void 0:C.height)??0,T=r+(s!=="center"?"-"+s:""),z=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},A=Array.isArray(l)?l:[l],D=A.length>0,F={padding:z,boundary:A.filter(Nh),altBoundary:D},{refs:_,floatingStyles:R,placement:k,isPositioned:j,middlewareData:I}=Vd({strategy:"fixed",placement:T,whileElementsMounted:(...q)=>Qd(...q,{animationFrame:g==="always"}),elements:{reference:w.anchor},middleware:[Yd({mainAxis:o+P,alignmentAxis:i}),c&&Gd({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?Zd():void 0,...F}),c&&Xd({...F}),Ud({...F,apply:({elements:q,rects:ee,availableWidth:oe,availableHeight:te})=>{const{width:le,height:Ae}=ee.reference,pe=q.floating.style;pe.setProperty("--radix-popper-available-width",`${oe}px`),pe.setProperty("--radix-popper-available-height",`${te}px`),pe.setProperty("--radix-popper-anchor-width",`${le}px`),pe.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),b&&qd({element:b,padding:a}),Mh({arrowWidth:M,arrowHeight:P}),f&&Kd({strategy:"referenceHidden",...F})]}),[N,O]=pa(k),$=Pe(h);ot(()=>{j&&($==null||$())},[j,$]);const L=(G=I.arrow)==null?void 0:G.x,W=(H=I.arrow)==null?void 0:H.y,B=((V=I.arrow)==null?void 0:V.centerOffset)!==0,[X,U]=x.useState();return ot(()=>{v&&U(window.getComputedStyle(v).zIndex)},[v]),p.jsx("div",{ref:_.setFloating,"data-radix-popper-content-wrapper":"",style:{...R,transform:j?R.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[(Q=I.transformOrigin)==null?void 0:Q.x,(Z=I.transformOrigin)==null?void 0:Z.y].join(" "),...((K=I.hide)==null?void 0:K.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(Sh,{scope:n,placedSide:N,onArrowChange:S,arrowX:L,arrowY:W,shouldHideArrow:B,children:p.jsx(fe.div,{"data-side":N,"data-align":O,...m,ref:y,style:{...m.style,animation:j?void 0:"none"}})})})});da.displayName=bo;var fa="PopperArrow",Ch={top:"bottom",right:"left",bottom:"top",left:"right"},ha=x.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=_h(fa,r),i=Ch[s.placedSide];return p.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:p.jsx(vh,{...o,ref:n,style:{...o.style,display:"block"}})})});ha.displayName=fa;function Nh(e){return e!==null}var Mh=e=>({name:"transformOrigin",options:e,fn(t){var w,v,E;const{placement:n,rects:r,middlewareData:o}=t,i=((w=o.arrow)==null?void 0:w.centerOffset)!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[l,d]=pa(n),u={start:"0%",center:"50%",end:"100%"}[d],f=(((v=o.arrow)==null?void 0:v.x)??0)+a/2,g=(((E=o.arrow)==null?void 0:E.y)??0)+c/2;let h="",m="";return l==="bottom"?(h=i?u:`${f}px`,m=`${-c}px`):l==="top"?(h=i?u:`${f}px`,m=`${r.floating.height+c}px`):l==="right"?(h=`${-c}px`,m=i?u:`${g}px`):l==="left"&&(h=`${r.floating.width+c}px`,m=i?u:`${g}px`),{data:{x:h,y:m}}}});function pa(e){const[t,n="center"]=e.split("-");return[t,n]}var kh=ca,Ph=la,Ih=da,Ah=ha,Rh="Portal",ga=x.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=x.useState(!1);ot(()=>s(!0),[]);const i=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?lf.createPortal(p.jsx(fe.div,{...r,ref:t}),i):null});ga.displayName=Rh;function Th(e,t){return x.useReducer((n,r)=>t[n][r]??n,e)}var an=e=>{const{present:t,children:n}=e,r=Dh(t),o=typeof n=="function"?n({present:r.isPresent}):x.Children.only(n),s=me(r.ref,jh(o));return typeof n=="function"||r.isPresent?x.cloneElement(o,{ref:s}):null};an.displayName="Presence";function Dh(e){const[t,n]=x.useState(),r=x.useRef({}),o=x.useRef(e),s=x.useRef("none"),i=e?"mounted":"unmounted",[a,c]=Th(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const l=En(r.current);s.current=a==="mounted"?l:"none"},[a]),ot(()=>{const l=r.current,d=o.current;if(d!==e){const f=s.current,g=En(l);e?c("MOUNT"):g==="none"||(l==null?void 0:l.display)==="none"?c("UNMOUNT"):c(d&&f!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),ot(()=>{if(t){let l;const d=t.ownerDocument.defaultView??window,u=g=>{const m=En(r.current).includes(g.animationName);if(g.target===t&&m&&(c("ANIMATION_END"),!o.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",l=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},f=g=>{g.target===t&&(s.current=En(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{d.clearTimeout(l),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:x.useCallback(l=>{l&&(r.current=getComputedStyle(l)),n(l)},[])}}function En(e){return(e==null?void 0:e.animationName)||"none"}function jh(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Mr="rovingFocusGroup.onEntryFocus",Oh={bubbles:!1,cancelable:!0},sr="RovingFocusGroup",[Qr,ma,$h]=Zi(sr),[Lh,ya]=sn(sr,[$h]),[Fh,zh]=Lh(sr),xa=x.forwardRef((e,t)=>p.jsx(Qr.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(Qr.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(Hh,{...e,ref:t})})}));xa.displayName=sr;var Hh=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:d=!1,...u}=e,f=x.useRef(null),g=me(t,f),h=Qi(s),[m=null,w]=qi({prop:i,defaultProp:a,onChange:c}),[v,E]=x.useState(!1),y=Pe(l),b=ma(n),S=x.useRef(!1),[C,M]=x.useState(0);return x.useEffect(()=>{const P=f.current;if(P)return P.addEventListener(Mr,y),()=>P.removeEventListener(Mr,y)},[y]),p.jsx(Fh,{scope:n,orientation:r,dir:h,loop:o,currentTabStopId:m,onItemFocus:x.useCallback(P=>w(P),[w]),onItemShiftTab:x.useCallback(()=>E(!0),[]),onFocusableItemAdd:x.useCallback(()=>M(P=>P+1),[]),onFocusableItemRemove:x.useCallback(()=>M(P=>P-1),[]),children:p.jsx(fe.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...u,ref:g,style:{outline:"none",...e.style},onMouseDown:ne(e.onMouseDown,()=>{S.current=!0}),onFocus:ne(e.onFocus,P=>{const T=!S.current;if(P.target===P.currentTarget&&T&&!v){const z=new CustomEvent(Mr,Oh);if(P.currentTarget.dispatchEvent(z),!z.defaultPrevented){const A=b().filter(k=>k.focusable),D=A.find(k=>k.active),F=A.find(k=>k.id===m),R=[D,F,...A].filter(Boolean).map(k=>k.ref.current);ba(R,d)}}S.current=!1}),onBlur:ne(e.onBlur,()=>E(!1))})})}),wa="RovingFocusGroupItem",va=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,...i}=e,a=Zr(),c=s||a,l=zh(wa,n),d=l.currentTabStopId===c,u=ma(n),{onFocusableItemAdd:f,onFocusableItemRemove:g}=l;return x.useEffect(()=>{if(r)return f(),()=>g()},[r,f,g]),p.jsx(Qr.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:p.jsx(fe.span,{tabIndex:d?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:ne(e.onMouseDown,h=>{r?l.onItemFocus(c):h.preventDefault()}),onFocus:ne(e.onFocus,()=>l.onItemFocus(c)),onKeyDown:ne(e.onKeyDown,h=>{if(h.key==="Tab"&&h.shiftKey){l.onItemShiftTab();return}if(h.target!==h.currentTarget)return;const m=Vh(h,l.orientation,l.dir);if(m!==void 0){if(h.metaKey||h.ctrlKey||h.altKey||h.shiftKey)return;h.preventDefault();let v=u().filter(E=>E.focusable).map(E=>E.ref.current);if(m==="last")v.reverse();else if(m==="prev"||m==="next"){m==="prev"&&v.reverse();const E=v.indexOf(h.currentTarget);v=l.loop?Yh(v,E+1):v.slice(E+1)}setTimeout(()=>ba(v))}})})})});va.displayName=wa;var Wh={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Bh(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Vh(e,t,n){const r=Bh(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Wh[r]}function ba(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Yh(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Gh=xa,Xh=va,Uh=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ft=new WeakMap,Sn=new WeakMap,_n={},kr=0,Ea=function(e){return e&&(e.host||Ea(e.parentNode))},qh=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Ea(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Kh=function(e,t,n,r){var o=qh(t,Array.isArray(e)?e:[e]);_n[n]||(_n[n]=new WeakMap);var s=_n[n],i=[],a=new Set,c=new Set(o),l=function(u){!u||a.has(u)||(a.add(u),l(u.parentNode))};o.forEach(l);var d=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(f){if(a.has(f))d(f);else try{var g=f.getAttribute(r),h=g!==null&&g!=="false",m=(ft.get(f)||0)+1,w=(s.get(f)||0)+1;ft.set(f,m),s.set(f,w),i.push(f),m===1&&h&&Sn.set(f,!0),w===1&&f.setAttribute(n,"true"),h||f.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",f,v)}})};return d(t),a.clear(),kr++,function(){i.forEach(function(u){var f=ft.get(u)-1,g=s.get(u)-1;ft.set(u,f),s.set(u,g),f||(Sn.has(u)||u.removeAttribute(r),Sn.delete(u)),g||u.removeAttribute(n)}),kr--,kr||(ft=new WeakMap,ft=new WeakMap,Sn=new WeakMap,_n={})}},Zh=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Uh(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Kh(r,o,n,"aria-hidden")):function(){return null}},De=function(){return De=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},De.apply(this,arguments)};function Sa(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Qh(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var $n="right-scroll-bar-position",Ln="width-before-scroll-bar",Jh="with-scroll-bars-hidden",ep="--removed-body-scroll-bar-size";function Pr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function tp(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var np=typeof window<"u"?x.useLayoutEffect:x.useEffect,ms=new WeakMap;function rp(e,t){var n=tp(null,function(r){return e.forEach(function(o){return Pr(o,r)})});return np(function(){var r=ms.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(a){s.has(a)||Pr(a,null)}),s.forEach(function(a){o.has(a)||Pr(a,i)})}ms.set(n,e)},[e]),n}function op(e){return e}function sp(e,t){t===void 0&&(t=op);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(s),i=n}var c=function(){var d=i;i=[],d.forEach(s)},l=function(){return Promise.resolve().then(c)};l(),n={push:function(d){i.push(d),l()},filter:function(d){return i=i.filter(d),n}}}};return o}function ip(e){e===void 0&&(e={});var t=sp(null);return t.options=De({async:!0,ssr:!1},e),t}var _a=function(e){var t=e.sideCar,n=Sa(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return x.createElement(r,De({},n))};_a.isSideCarExport=!0;function ap(e,t){return e.useMedium(t),_a}var Ca=ip(),Ir=function(){},ir=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:Ir,onWheelCapture:Ir,onTouchMoveCapture:Ir}),o=r[0],s=r[1],i=e.forwardProps,a=e.children,c=e.className,l=e.removeScrollBar,d=e.enabled,u=e.shards,f=e.sideCar,g=e.noRelative,h=e.noIsolation,m=e.inert,w=e.allowPinchZoom,v=e.as,E=v===void 0?"div":v,y=e.gapMode,b=Sa(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,C=rp([n,t]),M=De(De({},b),o);return x.createElement(x.Fragment,null,d&&x.createElement(S,{sideCar:Ca,removeScrollBar:l,shards:u,noRelative:g,noIsolation:h,inert:m,setCallbacks:s,allowPinchZoom:!!w,lockRef:n,gapMode:y}),i?x.cloneElement(x.Children.only(a),De(De({},M),{ref:C})):x.createElement(E,De({},M,{className:c,ref:C}),a))});ir.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ir.classNames={fullWidth:Ln,zeroRight:$n};var cp=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function up(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=cp();return t&&e.setAttribute("nonce",t),e}function lp(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function dp(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var fp=function(){var e=0,t=null;return{add:function(n){e==0&&(t=up())&&(lp(t,n),dp(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},hp=function(){var e=fp();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Na=function(){var e=hp(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},pp={left:0,top:0,right:0,gap:0},Ar=function(e){return parseInt(e||"",10)||0},gp=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Ar(n),Ar(r),Ar(o)]},mp=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return pp;var t=gp(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},yp=Na(),wt="data-scroll-locked",xp=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
99
- .`.concat(Jh,` {
100
- overflow: hidden `).concat(r,`;
101
- padding-right: `).concat(a,"px ").concat(r,`;
102
- }
103
- body[`).concat(wt,`] {
104
- overflow: hidden `).concat(r,`;
105
- overscroll-behavior: contain;
106
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
107
- padding-left: `.concat(o,`px;
108
- padding-top: `).concat(s,`px;
109
- padding-right: `).concat(i,`px;
110
- margin-left:0;
111
- margin-top:0;
112
- margin-right: `).concat(a,"px ").concat(r,`;
113
- `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
114
- }
115
-
116
- .`).concat($n,` {
117
- right: `).concat(a,"px ").concat(r,`;
118
- }
119
-
120
- .`).concat(Ln,` {
121
- margin-right: `).concat(a,"px ").concat(r,`;
122
- }
123
-
124
- .`).concat($n," .").concat($n,` {
125
- right: 0 `).concat(r,`;
126
- }
127
-
128
- .`).concat(Ln," .").concat(Ln,` {
129
- margin-right: 0 `).concat(r,`;
130
- }
131
-
132
- body[`).concat(wt,`] {
133
- `).concat(ep,": ").concat(a,`px;
134
- }
135
- `)},ys=function(){var e=parseInt(document.body.getAttribute(wt)||"0",10);return isFinite(e)?e:0},wp=function(){x.useEffect(function(){return document.body.setAttribute(wt,(ys()+1).toString()),function(){var e=ys()-1;e<=0?document.body.removeAttribute(wt):document.body.setAttribute(wt,e.toString())}},[])},vp=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;wp();var s=x.useMemo(function(){return mp(o)},[o]);return x.createElement(yp,{styles:xp(s,!t,o,n?"":"!important")})},Jr=!1;if(typeof window<"u")try{var Cn=Object.defineProperty({},"passive",{get:function(){return Jr=!0,!0}});window.addEventListener("test",Cn,Cn),window.removeEventListener("test",Cn,Cn)}catch{Jr=!1}var ht=Jr?{passive:!1}:!1,bp=function(e){return e.tagName==="TEXTAREA"},Ma=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!bp(e)&&n[t]==="visible")},Ep=function(e){return Ma(e,"overflowY")},Sp=function(e){return Ma(e,"overflowX")},xs=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=ka(e,r);if(o){var s=Pa(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},_p=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Cp=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},ka=function(e,t){return e==="v"?Ep(t):Sp(t)},Pa=function(e,t){return e==="v"?_p(t):Cp(t)},Np=function(e,t){return e==="h"&&t==="rtl"?-1:1},Mp=function(e,t,n,r,o){var s=Np(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,c=t.contains(a),l=!1,d=i>0,u=0,f=0;do{if(!a)break;var g=Pa(e,a),h=g[0],m=g[1],w=g[2],v=m-w-s*h;(h||v)&&ka(e,a)&&(u+=v,f+=h);var E=a.parentNode;a=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(u)<1||!d&&Math.abs(f)<1)&&(l=!0),l},Nn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ws=function(e){return[e.deltaX,e.deltaY]},vs=function(e){return e&&"current"in e?e.current:e},kp=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Pp=function(e){return`
136
- .block-interactivity-`.concat(e,` {pointer-events: none;}
137
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
138
- `)},Ip=0,pt=[];function Ap(e){var t=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),o=x.useState(Ip++)[0],s=x.useState(Na)[0],i=x.useRef(e);x.useEffect(function(){i.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=Qh([e.lockRef.current],(e.shards||[]).map(vs),!0).filter(Boolean);return m.forEach(function(w){return w.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=x.useCallback(function(m,w){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var v=Nn(m),E=n.current,y="deltaX"in m?m.deltaX:E[0]-v[0],b="deltaY"in m?m.deltaY:E[1]-v[1],S,C=m.target,M=Math.abs(y)>Math.abs(b)?"h":"v";if("touches"in m&&M==="h"&&C.type==="range")return!1;var P=xs(M,C);if(!P)return!0;if(P?S=M:(S=M==="v"?"h":"v",P=xs(M,C)),!P)return!1;if(!r.current&&"changedTouches"in m&&(y||b)&&(r.current=S),!S)return!0;var T=r.current||S;return Mp(T,w,m,T==="h"?y:b)},[]),c=x.useCallback(function(m){var w=m;if(!(!pt.length||pt[pt.length-1]!==s)){var v="deltaY"in w?ws(w):Nn(w),E=t.current.filter(function(S){return S.name===w.type&&(S.target===w.target||w.target===S.shadowParent)&&kp(S.delta,v)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var y=(i.current.shards||[]).map(vs).filter(Boolean).filter(function(S){return S.contains(w.target)}),b=y.length>0?a(w,y[0]):!i.current.noIsolation;b&&w.cancelable&&w.preventDefault()}}},[]),l=x.useCallback(function(m,w,v,E){var y={name:m,delta:w,target:v,should:E,shadowParent:Rp(v)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(b){return b!==y})},1)},[]),d=x.useCallback(function(m){n.current=Nn(m),r.current=void 0},[]),u=x.useCallback(function(m){l(m.type,ws(m),m.target,a(m,e.lockRef.current))},[]),f=x.useCallback(function(m){l(m.type,Nn(m),m.target,a(m,e.lockRef.current))},[]);x.useEffect(function(){return pt.push(s),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:f}),document.addEventListener("wheel",c,ht),document.addEventListener("touchmove",c,ht),document.addEventListener("touchstart",d,ht),function(){pt=pt.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,ht),document.removeEventListener("touchmove",c,ht),document.removeEventListener("touchstart",d,ht)}},[]);var g=e.removeScrollBar,h=e.inert;return x.createElement(x.Fragment,null,h?x.createElement(s,{styles:Pp(o)}):null,g?x.createElement(vp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Rp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Tp=ap(Ca,Ap);var Ia=x.forwardRef(function(e,t){return x.createElement(ir,De({},e,{ref:t,sideCar:Tp}))});Ia.classNames=ir.classNames;var eo=["Enter"," "],Dp=["ArrowDown","PageUp","Home"],Aa=["ArrowUp","PageDown","End"],jp=[...Dp,...Aa],Op={ltr:[...eo,"ArrowRight"],rtl:[...eo,"ArrowLeft"]},$p={ltr:["ArrowLeft"],rtl:["ArrowRight"]},cn="Menu",[Xt,Lp,Fp]=Zi(cn),[ut,Ra]=sn(cn,[Fp,ia,ya]),ar=ia(),Ta=ya(),[zp,lt]=ut(cn),[Hp,un]=ut(cn),Da=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:i=!0}=e,a=ar(t),[c,l]=x.useState(null),d=x.useRef(!1),u=Pe(s),f=Qi(o);return x.useEffect(()=>{const g=()=>{d.current=!0,document.addEventListener("pointerdown",h,{capture:!0,once:!0}),document.addEventListener("pointermove",h,{capture:!0,once:!0})},h=()=>d.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",h,{capture:!0}),document.removeEventListener("pointermove",h,{capture:!0})}},[]),p.jsx(kh,{...a,children:p.jsx(zp,{scope:t,open:n,onOpenChange:u,content:c,onContentChange:l,children:p.jsx(Hp,{scope:t,onClose:x.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:d,dir:f,modal:i,children:r})})})};Da.displayName=cn;var Wp="MenuAnchor",Eo=x.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=ar(n);return p.jsx(Ph,{...o,...r,ref:t})});Eo.displayName=Wp;var So="MenuPortal",[Bp,ja]=ut(So,{forceMount:void 0}),Oa=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=lt(So,t);return p.jsx(Bp,{scope:t,forceMount:n,children:p.jsx(an,{present:n||s.open,children:p.jsx(ga,{asChild:!0,container:o,children:r})})})};Oa.displayName=So;var be="MenuContent",[Vp,_o]=ut(be),$a=x.forwardRef((e,t)=>{const n=ja(be,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=lt(be,e.__scopeMenu),i=un(be,e.__scopeMenu);return p.jsx(Xt.Provider,{scope:e.__scopeMenu,children:p.jsx(an,{present:r||s.open,children:p.jsx(Xt.Slot,{scope:e.__scopeMenu,children:i.modal?p.jsx(Yp,{...o,ref:t}):p.jsx(Gp,{...o,ref:t})})})})}),Yp=x.forwardRef((e,t)=>{const n=lt(be,e.__scopeMenu),r=x.useRef(null),o=me(t,r);return x.useEffect(()=>{const s=r.current;if(s)return Zh(s)},[]),p.jsx(Co,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ne(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Gp=x.forwardRef((e,t)=>{const n=lt(be,e.__scopeMenu);return p.jsx(Co,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Co=x.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:f,onDismiss:g,disableOutsideScroll:h,...m}=e,w=lt(be,n),v=un(be,n),E=ar(n),y=Ta(n),b=Lp(n),[S,C]=x.useState(null),M=x.useRef(null),P=me(t,M,w.onContentChange),T=x.useRef(0),z=x.useRef(""),A=x.useRef(0),D=x.useRef(null),F=x.useRef("right"),_=x.useRef(0),R=h?Ia:x.Fragment,k=h?{as:Gt,allowPinchZoom:!0}:void 0,j=N=>{var G,H;const O=z.current+N,$=b().filter(V=>!V.disabled),L=document.activeElement,W=(G=$.find(V=>V.ref.current===L))==null?void 0:G.textValue,B=$.map(V=>V.textValue),X=og(B,O,W),U=(H=$.find(V=>V.textValue===X))==null?void 0:H.ref.current;(function V(Q){z.current=Q,window.clearTimeout(T.current),Q!==""&&(T.current=window.setTimeout(()=>V(""),1e3))})(O),U&&setTimeout(()=>U.focus())};x.useEffect(()=>()=>window.clearTimeout(T.current),[]),uh();const I=x.useCallback(N=>{var $,L;return F.current===(($=D.current)==null?void 0:$.side)&&ig(N,(L=D.current)==null?void 0:L.area)},[]);return p.jsx(Vp,{scope:n,searchRef:z,onItemEnter:x.useCallback(N=>{I(N)&&N.preventDefault()},[I]),onItemLeave:x.useCallback(N=>{var O;I(N)||((O=M.current)==null||O.focus(),C(null))},[I]),onTriggerLeave:x.useCallback(N=>{I(N)&&N.preventDefault()},[I]),pointerGraceTimerRef:A,onPointerGraceIntentChange:x.useCallback(N=>{D.current=N},[]),children:p.jsx(R,{...k,children:p.jsx(na,{asChild:!0,trapped:o,onMountAutoFocus:ne(s,N=>{var O;N.preventDefault(),(O=M.current)==null||O.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:p.jsx(ea,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:u,onInteractOutside:f,onDismiss:g,children:p.jsx(Gh,{asChild:!0,...y,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:ne(c,N=>{v.isUsingKeyboardRef.current||N.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(Ih,{role:"menu","aria-orientation":"vertical","data-state":Ja(w.open),"data-radix-menu-content":"",dir:v.dir,...E,...m,ref:P,style:{outline:"none",...m.style},onKeyDown:ne(m.onKeyDown,N=>{const $=N.target.closest("[data-radix-menu-content]")===N.currentTarget,L=N.ctrlKey||N.altKey||N.metaKey,W=N.key.length===1;$&&(N.key==="Tab"&&N.preventDefault(),!L&&W&&j(N.key));const B=M.current;if(N.target!==B||!jp.includes(N.key))return;N.preventDefault();const U=b().filter(G=>!G.disabled).map(G=>G.ref.current);Aa.includes(N.key)&&U.reverse(),ng(U)}),onBlur:ne(e.onBlur,N=>{N.currentTarget.contains(N.target)||(window.clearTimeout(T.current),z.current="")}),onPointerMove:ne(e.onPointerMove,Ut(N=>{const O=N.target,$=_.current!==N.clientX;if(N.currentTarget.contains(O)&&$){const L=N.clientX>_.current?"right":"left";F.current=L,_.current=N.clientX}}))})})})})})})});$a.displayName=be;var Xp="MenuGroup",No=x.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(fe.div,{role:"group",...r,ref:t})});No.displayName=Xp;var Up="MenuLabel",La=x.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(fe.div,{...r,ref:t})});La.displayName=Up;var Yn="MenuItem",bs="menu.itemSelect",cr=x.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=x.useRef(null),i=un(Yn,e.__scopeMenu),a=_o(Yn,e.__scopeMenu),c=me(t,s),l=x.useRef(!1),d=()=>{const u=s.current;if(!n&&u){const f=new CustomEvent(bs,{bubbles:!0,cancelable:!0});u.addEventListener(bs,g=>r==null?void 0:r(g),{once:!0}),Ki(u,f),f.defaultPrevented?l.current=!1:i.onClose()}};return p.jsx(Fa,{...o,ref:c,disabled:n,onClick:ne(e.onClick,d),onPointerDown:u=>{var f;(f=e.onPointerDown)==null||f.call(e,u),l.current=!0},onPointerUp:ne(e.onPointerUp,u=>{var f;l.current||(f=u.currentTarget)==null||f.click()}),onKeyDown:ne(e.onKeyDown,u=>{const f=a.searchRef.current!=="";n||f&&u.key===" "||eo.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})})});cr.displayName=Yn;var Fa=x.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,i=_o(Yn,n),a=Ta(n),c=x.useRef(null),l=me(t,c),[d,u]=x.useState(!1),[f,g]=x.useState("");return x.useEffect(()=>{const h=c.current;h&&g((h.textContent??"").trim())},[s.children]),p.jsx(Xt.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:p.jsx(Xh,{asChild:!0,...a,focusable:!r,children:p.jsx(fe.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:l,onPointerMove:ne(e.onPointerMove,Ut(h=>{r?i.onItemLeave(h):(i.onItemEnter(h),h.defaultPrevented||h.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ne(e.onPointerLeave,Ut(h=>i.onItemLeave(h))),onFocus:ne(e.onFocus,()=>u(!0)),onBlur:ne(e.onBlur,()=>u(!1))})})})}),qp="MenuCheckboxItem",za=x.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return p.jsx(Ya,{scope:e.__scopeMenu,checked:n,children:p.jsx(cr,{role:"menuitemcheckbox","aria-checked":Gn(n)?"mixed":n,...o,ref:t,"data-state":ko(n),onSelect:ne(o.onSelect,()=>r==null?void 0:r(Gn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});za.displayName=qp;var Ha="MenuRadioGroup",[Kp,Zp]=ut(Ha,{value:void 0,onValueChange:()=>{}}),Wa=x.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=Pe(r);return p.jsx(Kp,{scope:e.__scopeMenu,value:n,onValueChange:s,children:p.jsx(No,{...o,ref:t})})});Wa.displayName=Ha;var Ba="MenuRadioItem",Va=x.forwardRef((e,t)=>{const{value:n,...r}=e,o=Zp(Ba,e.__scopeMenu),s=n===o.value;return p.jsx(Ya,{scope:e.__scopeMenu,checked:s,children:p.jsx(cr,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":ko(s),onSelect:ne(r.onSelect,()=>{var i;return(i=o.onValueChange)==null?void 0:i.call(o,n)},{checkForDefaultPrevented:!1})})})});Va.displayName=Ba;var Mo="MenuItemIndicator",[Ya,Qp]=ut(Mo,{checked:!1}),Ga=x.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=Qp(Mo,n);return p.jsx(an,{present:r||Gn(s.checked)||s.checked===!0,children:p.jsx(fe.span,{...o,ref:t,"data-state":ko(s.checked)})})});Ga.displayName=Mo;var Jp="MenuSeparator",Xa=x.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(fe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Xa.displayName=Jp;var eg="MenuArrow",Ua=x.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=ar(n);return p.jsx(Ah,{...o,...r,ref:t})});Ua.displayName=eg;var tg="MenuSub",[hS,qa]=ut(tg),Ht="MenuSubTrigger",Ka=x.forwardRef((e,t)=>{const n=lt(Ht,e.__scopeMenu),r=un(Ht,e.__scopeMenu),o=qa(Ht,e.__scopeMenu),s=_o(Ht,e.__scopeMenu),i=x.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,l={__scopeMenu:e.__scopeMenu},d=x.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return x.useEffect(()=>d,[d]),x.useEffect(()=>{const u=a.current;return()=>{window.clearTimeout(u),c(null)}},[a,c]),p.jsx(Eo,{asChild:!0,...l,children:p.jsx(Fa,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":Ja(n.open),...e,ref:yo(t,o.onTriggerChange),onClick:u=>{var f;(f=e.onClick)==null||f.call(e,u),!(e.disabled||u.defaultPrevented)&&(u.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ne(e.onPointerMove,Ut(u=>{s.onItemEnter(u),!u.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(s.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:ne(e.onPointerLeave,Ut(u=>{var g,h;d();const f=(g=n.content)==null?void 0:g.getBoundingClientRect();if(f){const m=(h=n.content)==null?void 0:h.dataset.side,w=m==="right",v=w?-5:5,E=f[w?"left":"right"],y=f[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:u.clientX+v,y:u.clientY},{x:E,y:f.top},{x:y,y:f.top},{x:y,y:f.bottom},{x:E,y:f.bottom}],side:m}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(u),u.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:ne(e.onKeyDown,u=>{var g;const f=s.searchRef.current!=="";e.disabled||f&&u.key===" "||Op[r.dir].includes(u.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),u.preventDefault())})})})});Ka.displayName=Ht;var Za="MenuSubContent",Qa=x.forwardRef((e,t)=>{const n=ja(be,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=lt(be,e.__scopeMenu),i=un(be,e.__scopeMenu),a=qa(Za,e.__scopeMenu),c=x.useRef(null),l=me(t,c);return p.jsx(Xt.Provider,{scope:e.__scopeMenu,children:p.jsx(an,{present:r||s.open,children:p.jsx(Xt.Slot,{scope:e.__scopeMenu,children:p.jsx(Co,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:l,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var u;i.isUsingKeyboardRef.current&&((u=c.current)==null||u.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:ne(e.onFocusOutside,d=>{d.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:ne(e.onEscapeKeyDown,d=>{i.onClose(),d.preventDefault()}),onKeyDown:ne(e.onKeyDown,d=>{var g;const u=d.currentTarget.contains(d.target),f=$p[i.dir].includes(d.key);u&&f&&(s.onOpenChange(!1),(g=a.trigger)==null||g.focus(),d.preventDefault())})})})})})});Qa.displayName=Za;function Ja(e){return e?"open":"closed"}function Gn(e){return e==="indeterminate"}function ko(e){return Gn(e)?"indeterminate":e?"checked":"unchecked"}function ng(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function rg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function og(e,t,n){const o=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=rg(e,Math.max(s,0));o.length===1&&(i=i.filter(l=>l!==n));const c=i.find(l=>l.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function sg(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s].x,c=t[s].y,l=t[i].x,d=t[i].y;c>r!=d>r&&n<(l-a)*(r-c)/(d-c)+a&&(o=!o)}return o}function ig(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return sg(n,t)}function Ut(e){return t=>t.pointerType==="mouse"?e(t):void 0}var ag=Da,cg=Eo,ug=Oa,lg=$a,dg=No,fg=La,hg=cr,pg=za,gg=Wa,mg=Va,yg=Ga,xg=Xa,wg=Ua,vg=Ka,bg=Qa,Po="DropdownMenu",[Eg]=sn(Po,[Ra]),he=Ra(),[Sg,ec]=Eg(Po),tc=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:i,modal:a=!0}=e,c=he(t),l=x.useRef(null),[d=!1,u]=qi({prop:o,defaultProp:s,onChange:i});return p.jsx(Sg,{scope:t,triggerId:Zr(),triggerRef:l,contentId:Zr(),open:d,onOpenChange:u,onOpenToggle:x.useCallback(()=>u(f=>!f),[u]),modal:a,children:p.jsx(ag,{...c,open:d,onOpenChange:u,dir:r,modal:a,children:n})})};tc.displayName=Po;var nc="DropdownMenuTrigger",rc=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=ec(nc,n),i=he(n);return p.jsx(cg,{asChild:!0,...i,children:p.jsx(fe.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:yo(t,s.triggerRef),onPointerDown:ne(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:ne(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});rc.displayName=nc;var _g="DropdownMenuPortal",oc=e=>{const{__scopeDropdownMenu:t,...n}=e,r=he(t);return p.jsx(ug,{...r,...n})};oc.displayName=_g;var sc="DropdownMenuContent",ic=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ec(sc,n),s=he(n),i=x.useRef(!1);return p.jsx(lg,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:ne(e.onCloseAutoFocus,a=>{var c;i.current||(c=o.triggerRef.current)==null||c.focus(),i.current=!1,a.preventDefault()}),onInteractOutside:ne(e.onInteractOutside,a=>{const c=a.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,d=c.button===2||l;(!o.modal||d)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ic.displayName=sc;var Cg="DropdownMenuGroup",Ng=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return p.jsx(dg,{...o,...r,ref:t})});Ng.displayName=Cg;var Mg="DropdownMenuLabel",ac=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return p.jsx(fg,{...o,...r,ref:t})});ac.displayName=Mg;var kg="DropdownMenuItem",cc=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return p.jsx(hg,{...o,...r,ref:t})});cc.displayName=kg;var Pg="DropdownMenuCheckboxItem",uc=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return p.jsx(pg,{...o,...r,ref:t})});uc.displayName=Pg;var Ig="DropdownMenuRadioGroup",Ag=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return p.jsx(gg,{...o,...r,ref:t})});Ag.displayName=Ig;var Rg="DropdownMenuRadioItem",lc=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return p.jsx(mg,{...o,...r,ref:t})});lc.displayName=Rg;var Tg="DropdownMenuItemIndicator",dc=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return p.jsx(yg,{...o,...r,ref:t})});dc.displayName=Tg;var Dg="DropdownMenuSeparator",fc=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return p.jsx(xg,{...o,...r,ref:t})});fc.displayName=Dg;var jg="DropdownMenuArrow",Og=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return p.jsx(wg,{...o,...r,ref:t})});Og.displayName=jg;var $g="DropdownMenuSubTrigger",hc=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return p.jsx(vg,{...o,...r,ref:t})});hc.displayName=$g;var Lg="DropdownMenuSubContent",pc=x.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=he(n);return p.jsx(bg,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});pc.displayName=Lg;var Fg=tc,zg=rc,Hg=oc,gc=ic,mc=ac,yc=cc,xc=uc,wc=lc,vc=dc,bc=fc,Ec=hc,Sc=pc;const Wg=Fg,Bg=zg,Vg=x.forwardRef(({className:e,inset:t,children:n,...r},o)=>p.jsxs(Ec,{ref:o,className:ae("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,p.jsx(yf,{className:"ml-auto h-4 w-4"})]}));Vg.displayName=Ec.displayName;const Yg=x.forwardRef(({className:e,...t},n)=>p.jsx(Sc,{ref:n,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Yg.displayName=Sc.displayName;const _c=x.forwardRef(({className:e,sideOffset:t=4,...n},r)=>p.jsx(Hg,{children:p.jsx(gc,{ref:r,sideOffset:t,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));_c.displayName=gc.displayName;const et=x.forwardRef(({className:e,inset:t,...n},r)=>p.jsx(yc,{ref:r,className:ae("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));et.displayName=yc.displayName;const Gg=x.forwardRef(({className:e,children:t,checked:n,...r},o)=>p.jsxs(xc,{ref:o,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(vc,{children:p.jsx(Vn,{className:"h-4 w-4"})})}),t]}));Gg.displayName=xc.displayName;const Xg=x.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(wc,{ref:r,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(vc,{children:p.jsx(Mf,{className:"h-2 w-2 fill-current"})})}),t]}));Xg.displayName=wc.displayName;const Ug=x.forwardRef(({className:e,inset:t,...n},r)=>p.jsx(mc,{ref:r,className:ae("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Ug.displayName=mc.displayName;const qg=x.forwardRef(({className:e,...t},n)=>p.jsx(bc,{ref:n,className:ae("-mx-1 my-1 h-px bg-muted",e),...t}));qg.displayName=bc.displayName;function pS({text:e,children:t,className:n,overlay:r}){const[o,s]=x.useState(!1),i=async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),2e3)}catch(c){console.error("Failed to copy text:",c)}};return r?p.jsxs("span",{className:ae("relative group/copy inline-block",n),children:[t,p.jsxs(Se,{children:[p.jsx(_e,{asChild:!0,children:p.jsx("button",{type:"button",onClick:i,className:"absolute right-0 top-1/2 -translate-y-1/2 opacity-0 group-hover/copy:opacity-100 transition-opacity bg-background/80 backdrop-blur-sm p-1 rounded","aria-label":"Copy to clipboard",children:o?p.jsx(Vn,{className:"h-3 w-3 text-muted-foreground"}):p.jsx(Ur,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})}),p.jsx(Ce,{children:p.jsx("p",{children:o?"Copied!":"Copy to clipboard"})})]})]}):p.jsxs("div",{className:ae("flex items-center gap-2 group",n),children:[t,p.jsxs(Se,{children:[p.jsx(_e,{asChild:!0,children:p.jsx("button",{type:"button",onClick:i,className:"opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Copy to clipboard",children:o?p.jsx(Vn,{className:"h-3 w-3 text-green-600"}):p.jsx(Ur,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})}),p.jsx(Ce,{children:p.jsx("p",{children:o?"Copied!":"Copy to clipboard"})})]})]})}const Cc=6048e5,Kg=864e5,Es=6e4,Ss=525600,_s=43200,Cs=1440,Ns=Symbol.for("constructDateFrom");function He(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Ns in e?e[Ns](t):e instanceof Date?new e.constructor(t):new Date(t)}function xe(e,t){return He(t||e,e)}let Zg={};function Rt(){return Zg}function qt(e,t){var a,c,l,d;const n=Rt(),r=(t==null?void 0:t.weekStartsOn)??((c=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((d=(l=n.locale)==null?void 0:l.options)==null?void 0:d.weekStartsOn)??0,o=xe(e,t==null?void 0:t.in),s=o.getDay(),i=(s<r?7:0)+s-r;return o.setDate(o.getDate()-i),o.setHours(0,0,0,0),o}function Xn(e,t){return qt(e,{...t,weekStartsOn:1})}function Nc(e,t){const n=xe(e,t==null?void 0:t.in),r=n.getFullYear(),o=He(n,0);o.setFullYear(r+1,0,4),o.setHours(0,0,0,0);const s=Xn(o),i=He(n,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const a=Xn(i);return n.getTime()>=s.getTime()?r+1:n.getTime()>=a.getTime()?r:r-1}function Un(e){const t=xe(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function Io(e,...t){const n=He.bind(null,e||t.find(r=>typeof r=="object"));return t.map(n)}function Ms(e,t){const n=xe(e,t==null?void 0:t.in);return n.setHours(0,0,0,0),n}function Mc(e,t,n){const[r,o]=Io(n==null?void 0:n.in,e,t),s=Ms(r),i=Ms(o),a=+s-Un(s),c=+i-Un(i);return Math.round((a-c)/Kg)}function Qg(e,t){const n=Nc(e,t),r=He(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Xn(r)}function Jg(e,t){const n=+xe(e)-+xe(t);return n<0?-1:n>0?1:n}function em(e){return He(e,Date.now())}function tm(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function nm(e){return!(!tm(e)&&typeof e!="number"||isNaN(+xe(e)))}function rm(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function om(e,t){const n=xe(e,t==null?void 0:t.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const sm={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},im=(e,t,n)=>{let r;const o=sm[e];return typeof o=="string"?r=o:t===1?r=o.one:r=o.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Rr(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const am={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},cm={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},um={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},lm={date:Rr({formats:am,defaultWidth:"full"}),time:Rr({formats:cm,defaultWidth:"full"}),dateTime:Rr({formats:um,defaultWidth:"full"})},dm={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},fm=(e,t,n,r)=>dm[e];function $t(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let o;if(r==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,a=n!=null&&n.width?String(n.width):i;o=e.formattingValues[a]||e.formattingValues[i]}else{const i=e.defaultWidth,a=n!=null&&n.width?String(n.width):e.defaultWidth;o=e.values[a]||e.values[i]}const s=e.argumentCallback?e.argumentCallback(t):t;return o[s]}}const hm={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},pm={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},gm={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},mm={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},ym={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},xm={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},wm=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},vm={ordinalNumber:wm,era:$t({values:hm,defaultWidth:"wide"}),quarter:$t({values:pm,defaultWidth:"wide",argumentCallback:e=>e-1}),month:$t({values:gm,defaultWidth:"wide"}),day:$t({values:mm,defaultWidth:"wide"}),dayPeriod:$t({values:ym,defaultWidth:"wide",formattingValues:xm,defaultFormattingWidth:"wide"})};function Lt(e){return(t,n={})=>{const r=n.width,o=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(o);if(!s)return null;const i=s[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(a)?Em(a,u=>u.test(i)):bm(a,u=>u.test(i));let l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;const d=t.slice(i.length);return{value:l,rest:d}}}function bm(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Em(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Sm(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const o=r[0],s=t.match(e.parsePattern);if(!s)return null;let i=e.valueCallback?e.valueCallback(s[0]):s[0];i=n.valueCallback?n.valueCallback(i):i;const a=t.slice(o.length);return{value:i,rest:a}}}const _m=/^(\d+)(th|st|nd|rd)?/i,Cm=/\d+/i,Nm={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Mm={any:[/^b/i,/^(a|c)/i]},km={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Pm={any:[/1/i,/2/i,/3/i,/4/i]},Im={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Am={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Rm={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Tm={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Dm={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},jm={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Om={ordinalNumber:Sm({matchPattern:_m,parsePattern:Cm,valueCallback:e=>parseInt(e,10)}),era:Lt({matchPatterns:Nm,defaultMatchWidth:"wide",parsePatterns:Mm,defaultParseWidth:"any"}),quarter:Lt({matchPatterns:km,defaultMatchWidth:"wide",parsePatterns:Pm,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Lt({matchPatterns:Im,defaultMatchWidth:"wide",parsePatterns:Am,defaultParseWidth:"any"}),day:Lt({matchPatterns:Rm,defaultMatchWidth:"wide",parsePatterns:Tm,defaultParseWidth:"any"}),dayPeriod:Lt({matchPatterns:Dm,defaultMatchWidth:"any",parsePatterns:jm,defaultParseWidth:"any"})},Ao={code:"en-US",formatDistance:im,formatLong:lm,formatRelative:fm,localize:vm,match:Om,options:{weekStartsOn:0,firstWeekContainsDate:1}};function $m(e,t){const n=xe(e,t==null?void 0:t.in);return Mc(n,om(n))+1}function Lm(e,t){const n=xe(e,t==null?void 0:t.in),r=+Xn(n)-+Qg(n);return Math.round(r/Cc)+1}function kc(e,t){var d,u,f,g;const n=xe(e,t==null?void 0:t.in),r=n.getFullYear(),o=Rt(),s=(t==null?void 0:t.firstWeekContainsDate)??((u=(d=t==null?void 0:t.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??o.firstWeekContainsDate??((g=(f=o.locale)==null?void 0:f.options)==null?void 0:g.firstWeekContainsDate)??1,i=He((t==null?void 0:t.in)||e,0);i.setFullYear(r+1,0,s),i.setHours(0,0,0,0);const a=qt(i,t),c=He((t==null?void 0:t.in)||e,0);c.setFullYear(r,0,s),c.setHours(0,0,0,0);const l=qt(c,t);return+n>=+a?r+1:+n>=+l?r:r-1}function Fm(e,t){var a,c,l,d;const n=Rt(),r=(t==null?void 0:t.firstWeekContainsDate)??((c=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((d=(l=n.locale)==null?void 0:l.options)==null?void 0:d.firstWeekContainsDate)??1,o=kc(e,t),s=He((t==null?void 0:t.in)||e,0);return s.setFullYear(o,0,r),s.setHours(0,0,0,0),qt(s,t)}function zm(e,t){const n=xe(e,t==null?void 0:t.in),r=+qt(n,t)-+Fm(n,t);return Math.round(r/Cc)+1}function re(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const Ve={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return re(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):re(n+1,2)},d(e,t){return re(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return re(e.getHours()%12||12,t.length)},H(e,t){return re(e.getHours(),t.length)},m(e,t){return re(e.getMinutes(),t.length)},s(e,t){return re(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),o=Math.trunc(r*Math.pow(10,n-3));return re(o,t.length)}},gt={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ks={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),o=r>0?r:1-r;return n.ordinalNumber(o,{unit:"year"})}return Ve.y(e,t)},Y:function(e,t,n,r){const o=kc(e,r),s=o>0?o:1-o;if(t==="YY"){const i=s%100;return re(i,2)}return t==="Yo"?n.ordinalNumber(s,{unit:"year"}):re(s,t.length)},R:function(e,t){const n=Nc(e);return re(n,t.length)},u:function(e,t){const n=e.getFullYear();return re(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return re(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return re(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return Ve.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return re(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const o=zm(e,r);return t==="wo"?n.ordinalNumber(o,{unit:"week"}):re(o,t.length)},I:function(e,t,n){const r=Lm(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):re(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Ve.d(e,t)},D:function(e,t,n){const r=$m(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):re(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const o=e.getDay(),s=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return re(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});case"eeee":default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const o=e.getDay(),s=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return re(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});case"cccc":default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),o=r===0?7:r;switch(t){case"i":return String(o);case"ii":return re(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const o=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let o;switch(r===12?o=gt.noon:r===0?o=gt.midnight:o=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let o;switch(r>=17?o=gt.evening:r>=12?o=gt.afternoon:r>=4?o=gt.morning:o=gt.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Ve.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Ve.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):re(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):re(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Ve.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Ve.s(e,t)},S:function(e,t){return Ve.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return Is(r);case"XXXX":case"XX":return Qe(r);case"XXXXX":case"XXX":default:return Qe(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return Is(r);case"xxxx":case"xx":return Qe(r);case"xxxxx":case"xxx":default:return Qe(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Ps(r,":");case"OOOO":default:return"GMT"+Qe(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Ps(r,":");case"zzzz":default:return"GMT"+Qe(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return re(r,t.length)},T:function(e,t,n){return re(+e,t.length)}};function Ps(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=Math.trunc(r/60),s=r%60;return s===0?n+String(o):n+String(o)+t+re(s,2)}function Is(e,t){return e%60===0?(e>0?"-":"+")+re(Math.abs(e)/60,2):Qe(e,t)}function Qe(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=re(Math.trunc(r/60),2),s=re(r%60,2);return n+o+t+s}const As=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Pc=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Hm=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],o=n[2];if(!o)return As(e,t);let s;switch(r){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",As(r,t)).replace("{{time}}",Pc(o,t))},Wm={p:Pc,P:Hm},Bm=/^D+$/,Vm=/^Y+$/,Ym=["D","DD","YY","YYYY"];function Gm(e){return Bm.test(e)}function Xm(e){return Vm.test(e)}function Um(e,t,n){const r=qm(e,t,n);if(console.warn(r),Ym.includes(e))throw new RangeError(r)}function qm(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Km=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Zm=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Qm=/^'([^]*?)'?$/,Jm=/''/g,e0=/[a-zA-Z]/;function t0(e,t,n){var d,u,f,g,h,m,w,v;const r=Rt(),o=(n==null?void 0:n.locale)??r.locale??Ao,s=(n==null?void 0:n.firstWeekContainsDate)??((u=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??r.firstWeekContainsDate??((g=(f=r.locale)==null?void 0:f.options)==null?void 0:g.firstWeekContainsDate)??1,i=(n==null?void 0:n.weekStartsOn)??((m=(h=n==null?void 0:n.locale)==null?void 0:h.options)==null?void 0:m.weekStartsOn)??r.weekStartsOn??((v=(w=r.locale)==null?void 0:w.options)==null?void 0:v.weekStartsOn)??0,a=xe(e,n==null?void 0:n.in);if(!nm(a))throw new RangeError("Invalid time value");let c=t.match(Zm).map(E=>{const y=E[0];if(y==="p"||y==="P"){const b=Wm[y];return b(E,o.formatLong)}return E}).join("").match(Km).map(E=>{if(E==="''")return{isToken:!1,value:"'"};const y=E[0];if(y==="'")return{isToken:!1,value:n0(E)};if(ks[y])return{isToken:!0,value:E};if(y.match(e0))throw new RangeError("Format string contains an unescaped latin alphabet character `"+y+"`");return{isToken:!1,value:E}});o.localize.preprocessor&&(c=o.localize.preprocessor(a,c));const l={firstWeekContainsDate:s,weekStartsOn:i,locale:o};return c.map(E=>{if(!E.isToken)return E.value;const y=E.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&Xm(y)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&Gm(y))&&Um(y,t,String(e));const b=ks[y[0]];return b(a,y,o.localize,l)}).join("")}function n0(e){const t=e.match(Qm);return t?t[1].replace(Jm,"'"):e}function r0(e,t,n){const r=Rt(),o=(n==null?void 0:n.locale)??r.locale??Ao,s=Jg(e,t);if(isNaN(s))throw new RangeError("Invalid time value");const i=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:s}),[a,c]=Io(n==null?void 0:n.in,...s>0?[t,e]:[e,t]),l=rm((n==null?void 0:n.roundingMethod)??"round"),d=c.getTime()-a.getTime(),u=d/Es,f=Un(c)-Un(a),g=(d-f)/Es,h=n==null?void 0:n.unit;let m;if(h?m=h:u<1?m="second":u<60?m="minute":u<Cs?m="hour":g<_s?m="day":g<Ss?m="month":m="year",m==="second"){const w=l(d/1e3);return o.formatDistance("xSeconds",w,i)}else if(m==="minute"){const w=l(u);return o.formatDistance("xMinutes",w,i)}else if(m==="hour"){const w=l(u/60);return o.formatDistance("xHours",w,i)}else if(m==="day"){const w=l(g/Cs);return o.formatDistance("xDays",w,i)}else if(m==="month"){const w=l(g/_s);return w===12&&h!=="month"?o.formatDistance("xYears",1,i):o.formatDistance("xMonths",w,i)}else{const w=l(g/Ss);return o.formatDistance("xYears",w,i)}}function o0(e,t){return r0(e,em(e),t)}function s0(e,t,n){var u,f;const[r,o]=Io(n==null?void 0:n.in,e,t),s=Rt(),i=s.locale??Ao,a=s.weekStartsOn??((f=(u=s.locale)==null?void 0:u.options)==null?void 0:f.weekStartsOn)??0,c=Mc(r,o);if(isNaN(c))throw new RangeError("Invalid time value");let l;c<-6?l="other":c<-1?l="lastWeek":c<0?l="yesterday":c<1?l="today":c<2?l="tomorrow":c<7?l="nextWeek":l="other";const d=i.formatRelative(l,r,o,{locale:i,weekStartsOn:a});return t0(r,d,{locale:i,weekStartsOn:a})}function gS({date:e,className:t="",type:n="relative"}){const[,r]=x.useState(Date.now());typeof e=="string"&&(e=new Date(e));const o=n==="relative"?s0(new Date(e),new Date):o0(new Date(e),{addSuffix:!0}),s=new Date(e).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:"short"});return x.useEffect(()=>{const i=setInterval(()=>{r(Date.now())},1e3);return()=>clearInterval(i)},[]),p.jsxs(Se,{children:[p.jsx(_e,{asChild:!0,children:p.jsx("span",{className:`${t} cursor-help border-b border-dotted`,children:o})}),p.jsx(Ce,{children:p.jsx("p",{children:s})})]})}function mS({className:e,...t}){return p.jsx("div",{className:ae("animate-pulse rounded-md bg-muted",e),...t})}const i0="Your current vercel account does not have access to this resource. Use `vercel login` or `vercel switch` to ensure you are linked to the right account.";class vt extends Error{constructor(n,r){super(n,{cause:r==null?void 0:r.cause});Sr(this,"request");Sr(this,"layer");this.name="WorkflowWebAPIError",this.request=r==null?void 0:r.request,this.layer=r==null?void 0:r.layer,(r==null?void 0:r.cause)instanceof Error&&(this.stack=`${this.stack}
139
- Caused by: ${r.cause.stack}`)}}function a0(e){return new vt(e.message,{cause:e.cause,request:e.request,layer:e.layer})}const yS=e=>{var t;return"layer"in e&&e.layer?e instanceof vt&&((t=e.request)==null?void 0:t.status)===403?i0:e.message:e instanceof Error?e.message:"An error occurred"};async function Ic(e){let t;try{t=await e}catch(n){t={success:!1,error:n}}return t.success?{error:null,result:t.data}:t.error?{error:a0(t.error),result:null}:{error:new vt("Unknown error occurred",{layer:"client"}),result:null}}async function ln(e){const{error:t,result:n}=await Ic(e);if(t)throw t;return n}async function c0(e,t){await ln(Jd(e,t))}async function u0(e,t){return ln(rf(e,t))}async function l0(e,t){await ln(ef(e,t))}async function d0(e,t,n){return ln(tf(e,t,n))}async function xS(e,t,n){return ln(nf(e,t,n))}function f0(e){const t=e+"CollectionProvider",[n,r]=xo(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:w,children:v}=m,E=de.useRef(null),y=de.useRef(new Map).current;return p.jsx(o,{scope:w,itemMap:y,collectionRef:E,children:v})};i.displayName=t;const a=e+"CollectionSlot",c=as(a),l=de.forwardRef((m,w)=>{const{scope:v,children:E}=m,y=s(a,v),b=Xr(w,y.collectionRef);return p.jsx(c,{ref:b,children:E})});l.displayName=a;const d=e+"CollectionItemSlot",u="data-radix-collection-item",f=as(d),g=de.forwardRef((m,w)=>{const{scope:v,children:E,...y}=m,b=de.useRef(null),S=Xr(w,b),C=s(d,v);return de.useEffect(()=>(C.itemMap.set(b,{ref:b,...y}),()=>void C.itemMap.delete(b))),p.jsx(f,{[u]:"",ref:S,children:E})});g.displayName=d;function h(m){const w=s(e+"CollectionConsumer",m);return de.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const y=Array.from(E.querySelectorAll(`[${u}]`));return Array.from(w.itemMap.values()).sort((C,M)=>y.indexOf(C.ref.current)-y.indexOf(M.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:i,Slot:l,ItemSlot:g},h,r]}var h0=x.createContext(void 0);function Ac(e){const t=x.useContext(h0);return e||t||"ltr"}function wS({status:e,context:t,className:n,durationMs:r}){const o=()=>{switch(e){case"running":return"bg-blue-500";case"completed":return"bg-emerald-500";case"failed":return"bg-red-500";case"cancelled":return"bg-yellow-500";case"pending":return"bg-gray-400";default:return"bg-gray-400"}},s=p.jsxs("span",{className:ae("flex flex-row gap-2",n),children:[p.jsxs("span",{className:"flex items-center gap-1.5",children:[p.jsx("span",{className:ae("size-2 rounded-full shrink-0",o())}),p.jsx("span",{className:"text-muted-foreground text-xs font-medium capitalize",children:e})]}),r!==void 0&&p.jsxs("span",{className:"text-muted-foreground/70 text-xs",children:["(",of(r),")"]})]});return e==="failed"&&(t!=null&&t.error)?p.jsx(p0,{content:s,error:t.error}):s}function p0({content:e,error:t}){const[n,r]=x.useState(!1),o=typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t),s=async i=>{i.stopPropagation(),await navigator.clipboard.writeText(o),r(!0),setTimeout(()=>r(!1),2e3)};return p.jsxs(Se,{children:[p.jsx(_e,{asChild:!0,children:p.jsx("span",{className:"cursor-help",children:e})}),p.jsxs(Ce,{className:"max-w-md p-0",children:[p.jsxs("div",{className:"flex items-start justify-between gap-2 p-1 border-b",children:[p.jsx("span",{className:"text-xs font-medium pl-1 pt-1",children:"Error Details"}),p.jsx(On,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:s,children:n?p.jsx(Vn,{className:"h-2.5 w-2.5 text-muted-foreground"}):p.jsx(Ur,{className:"h-2.5 w-2.5 text-muted-foreground"})})]}),p.jsx("div",{className:"max-h-48 overflow-auto p-2",children:p.jsx("p",{className:"text-xs whitespace-pre-wrap break-words font-mono",children:o})})]})]})}function Rc({env:e,runId:t,runStatus:n,events:r,callbacks:o}){const[s,i]=x.useState(!1),[a,c]=x.useState(!1),[l,d]=x.useState(!1),[u,f]=x.useState(!1),h=x.useMemo(()=>Wf(r),[r]).hasPendingSleeps,m=x.useCallback(async()=>{var y,b;if(s)return null;try{i(!0);const S=await u0(e,t);return Re.success("New run started",{description:`Run ID: ${S}`}),(y=o==null?void 0:o.onSuccess)==null||y.call(o),(b=o==null?void 0:o.onNavigateToRun)==null||b.call(o,S),S}catch(S){return Re.error("Failed to re-run",{description:S instanceof Error?S.message:"Unknown error"}),null}finally{i(!1)}},[e,t,s,o]),w=x.useCallback(async()=>{var y;if(!a)try{c(!0),await l0(e,t),Re.success("Run re-enqueued",{description:"The workflow orchestration layer has been re-enqueued."}),(y=o==null?void 0:o.onSuccess)==null||y.call(o)}catch(b){Re.error("Failed to re-enqueue",{description:b instanceof Error?b.message:"Unknown error"})}finally{c(!1)}},[e,t,a,o]),v=x.useCallback(async()=>{var y;if(!l)try{d(!0);const b=await d0(e,t);b.stoppedCount>0?Re.success("Active sleeps cancelled",{description:`Cancelled ${b.stoppedCount} active sleep${b.stoppedCount>1?"s":""} and resumed the run.`}):Re.info("No active sleeps",{description:"There were no active sleep calls to cancel."}),(y=o==null?void 0:o.onSuccess)==null||y.call(o)}catch(b){Re.error("Failed to cancel sleeps",{description:b instanceof Error?b.message:"Unknown error"})}finally{d(!1)}},[e,t,l,o]),E=x.useCallback(async()=>{var b;if(u)return;if(!(n==="pending"||n==="running")){Re.error("Cannot cancel",{description:"Only active runs can be cancelled"});return}try{f(!0),await c0(e,t),Re.success("Run cancelled"),(b=o==null?void 0:o.onSuccess)==null||b.call(o)}catch(S){Re.error("Failed to cancel",{description:S instanceof Error?S.message:"Unknown error"})}finally{f(!1)}},[e,t,n,u,o]);return{rerunning:s,reenqueuing:a,wakingUp:l,cancelling:u,hasPendingSleeps:h,handleReplay:m,handleReenqueue:w,handleWakeUp:v,handleCancel:E}}function Tc({hasPendingSleeps:e}){return e?p.jsxs(p.Fragment,{children:["Cancel any active ",p.jsx("code",{children:"sleep"})," calls and resume the run immediately."]}):p.jsx(p.Fragment,{children:"No active sleep calls to cancel."})}function Dc(){return p.jsx(p.Fragment,{children:"Re-enqueue the workflow orchestration layer. Use this if the workflow appears stuck with no active steps. This is a no-op for healthy workflows."})}function vS({env:e,runId:t,runStatus:n,events:r,eventsLoading:o,callbacks:s,stopPropagation:i=!1}){const{rerunning:a,reenqueuing:c,wakingUp:l,cancelling:d,hasPendingSleeps:u,handleReplay:f,handleReenqueue:g,handleWakeUp:h,handleCancel:m}=Rc({env:e,runId:t,runStatus:n,events:r,callbacks:s}),w=S=>{i&&S.stopPropagation(),f()},v=S=>{i&&S.stopPropagation(),g()},E=S=>{i&&S.stopPropagation(),h()},y=S=>{i&&S.stopPropagation(),m()},b=n==="pending"||n==="running";return p.jsxs(p.Fragment,{children:[p.jsxs(et,{onClick:w,disabled:a,children:[p.jsx(Ui,{className:"h-4 w-4 mr-2"}),a?"Replaying...":"Replay Run"]}),p.jsxs(Se,{children:[p.jsx(_e,{asChild:!0,children:p.jsxs(et,{onClick:v,disabled:o||c,children:[p.jsx(wo,{className:"h-4 w-4 mr-2"}),c?"Re-enqueuing...":"Re-enqueue"]})}),p.jsx(Ce,{side:"left",className:"max-w-xs",children:p.jsx(Dc,{})})]}),p.jsxs(Se,{children:[p.jsx(_e,{asChild:!0,children:p.jsxs(et,{onClick:E,disabled:o||!u||l,children:[p.jsx(Gi,{className:"h-4 w-4 mr-2"}),l?"Cancelling sleeps...":"Cancel Active Sleeps"]})}),p.jsx(Ce,{side:"left",className:"max-w-xs",children:p.jsx(Tc,{hasPendingSleeps:u})})]}),p.jsxs(et,{onClick:y,disabled:!b||d,children:[p.jsx(Xi,{className:"h-4 w-4 mr-2"}),d?"Cancelling...":"Cancel"]})]})}function bS({env:e,runId:t,runStatus:n,events:r,eventsLoading:o,loading:s,callbacks:i,onCancelClick:a,onRerunClick:c}){const{reenqueuing:l,wakingUp:d,hasPendingSleeps:u,handleReenqueue:f,handleWakeUp:g}=Rc({env:e,runId:t,runStatus:n,events:r,callbacks:i}),h=n==="pending"||n==="running",m=h,w=!s&&!h,v=s?"Loading run data...":h?"Cannot re-run while workflow is still running":"",E=n==="completed"?"Run has already completed":n==="failed"?"Run has already failed":n==="cancelled"?"Run has already been cancelled":"";return p.jsxs(p.Fragment,{children:[p.jsxs(Se,{children:[p.jsx(_e,{asChild:!0,children:p.jsx("span",{children:p.jsxs(On,{variant:"outline",size:"sm",onClick:c,disabled:!w,children:[p.jsx(Ui,{className:"h-4 w-4"}),"Replay"]})})}),p.jsx(Ce,{children:v?p.jsx("p",{children:v}):p.jsx("p",{children:"This will start a new copy of the current run using the same deployment, environment, and inputs. It will not affect the current run."})})]}),p.jsxs(Se,{children:[p.jsx(_e,{asChild:!0,children:p.jsx("span",{children:p.jsxs(On,{variant:"outline",size:"sm",onClick:a,disabled:!m,children:[p.jsx(Xi,{className:"h-4 w-4"}),"Cancel"]})})}),p.jsx(Ce,{children:E?p.jsx("p",{children:E}):p.jsx("p",{children:"Cancel the workflow run"})})]}),p.jsxs(Wg,{children:[p.jsxs(Se,{children:[p.jsx(_e,{asChild:!0,children:p.jsx(Bg,{asChild:!0,children:p.jsx(On,{variant:"outline",size:"sm",children:p.jsx(Af,{className:"h-4 w-4"})})})}),p.jsx(Ce,{children:"More actions"})]}),p.jsxs(_c,{align:"end",children:[p.jsxs(Se,{children:[p.jsx(_e,{asChild:!0,children:p.jsxs(et,{onClick:f,disabled:s||o||l,children:[p.jsx(wo,{className:"h-4 w-4 mr-2"}),l?"Re-enqueuing...":"Re-enqueue"]})}),p.jsx(Ce,{side:"left",className:"max-w-xs",children:p.jsx(Dc,{})})]}),p.jsxs(Se,{children:[p.jsx(_e,{asChild:!0,children:p.jsxs(et,{onClick:g,disabled:s||o||!u||d,children:[p.jsx(Gi,{className:"h-4 w-4 mr-2"}),d?"Cancelling sleeps...":"Cancel Active Sleeps"]})}),p.jsx(Ce,{side:"left",className:"max-w-xs",children:p.jsx(Tc,{hasPendingSleeps:u})})]})]})]})]})}var Tr="rovingFocusGroup.onEntryFocus",g0={bubbles:!1,cancelable:!0},dn="RovingFocusGroup",[to,jc,m0]=f0(dn),[y0,Oc]=xo(dn,[m0]),[x0,w0]=y0(dn),$c=x.forwardRef((e,t)=>p.jsx(to.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(to.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(v0,{...e,ref:t})})}));$c.displayName=dn;var v0=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:d=!1,...u}=e,f=x.useRef(null),g=Xr(t,f),h=Ac(s),[m,w]=Wi({prop:i,defaultProp:a??null,onChange:c,caller:dn}),[v,E]=x.useState(!1),y=sf(l),b=jc(n),S=x.useRef(!1),[C,M]=x.useState(0);return x.useEffect(()=>{const P=f.current;if(P)return P.addEventListener(Tr,y),()=>P.removeEventListener(Tr,y)},[y]),p.jsx(x0,{scope:n,orientation:r,dir:h,loop:o,currentTabStopId:m,onItemFocus:x.useCallback(P=>w(P),[w]),onItemShiftTab:x.useCallback(()=>E(!0),[]),onFocusableItemAdd:x.useCallback(()=>M(P=>P+1),[]),onFocusableItemRemove:x.useCallback(()=>M(P=>P-1),[]),children:p.jsx(At.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...u,ref:g,style:{outline:"none",...e.style},onMouseDown:ze(e.onMouseDown,()=>{S.current=!0}),onFocus:ze(e.onFocus,P=>{const T=!S.current;if(P.target===P.currentTarget&&T&&!v){const z=new CustomEvent(Tr,g0);if(P.currentTarget.dispatchEvent(z),!z.defaultPrevented){const A=b().filter(k=>k.focusable),D=A.find(k=>k.active),F=A.find(k=>k.id===m),R=[D,F,...A].filter(Boolean).map(k=>k.ref.current);zc(R,d)}}S.current=!1}),onBlur:ze(e.onBlur,()=>E(!1))})})}),Lc="RovingFocusGroupItem",Fc=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,c=Hi(),l=s||c,d=w0(Lc,n),u=d.currentTabStopId===l,f=jc(n),{onFocusableItemAdd:g,onFocusableItemRemove:h,currentTabStopId:m}=d;return x.useEffect(()=>{if(r)return g(),()=>h()},[r,g,h]),p.jsx(to.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:p.jsx(At.span,{tabIndex:u?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:ze(e.onMouseDown,w=>{r?d.onItemFocus(l):w.preventDefault()}),onFocus:ze(e.onFocus,()=>d.onItemFocus(l)),onKeyDown:ze(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){d.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const v=S0(w,d.orientation,d.dir);if(v!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let y=f().filter(b=>b.focusable).map(b=>b.ref.current);if(v==="last")y.reverse();else if(v==="prev"||v==="next"){v==="prev"&&y.reverse();const b=y.indexOf(w.currentTarget);y=d.loop?_0(y,b+1):y.slice(b+1)}setTimeout(()=>zc(y))}}),children:typeof i=="function"?i({isCurrentTabStop:u,hasTabStop:m!=null}):i})})});Fc.displayName=Lc;var b0={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function E0(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function S0(e,t,n){const r=E0(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return b0[r]}function zc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function _0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var C0=$c,N0=Fc,ur="Tabs",[M0]=xo(ur,[Oc]),Hc=Oc(),[k0,Ro]=M0(ur),Wc=x.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:c="automatic",...l}=e,d=Ac(a),[u,f]=Wi({prop:r,onChange:o,defaultProp:s??"",caller:ur});return p.jsx(k0,{scope:n,baseId:Hi(),value:u,onValueChange:f,orientation:i,dir:d,activationMode:c,children:p.jsx(At.div,{dir:d,"data-orientation":i,...l,ref:t})})});Wc.displayName=ur;var Bc="TabsList",Vc=x.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=Ro(Bc,n),i=Hc(n);return p.jsx(C0,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:p.jsx(At.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});Vc.displayName=Bc;var Yc="TabsTrigger",Gc=x.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=Ro(Yc,n),a=Hc(n),c=qc(i.baseId,r),l=Kc(i.baseId,r),d=r===i.value;return p.jsx(N0,{asChild:!0,...a,focusable:!o,active:d,children:p.jsx(At.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":l,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:ze(e.onMouseDown,u=>{!o&&u.button===0&&u.ctrlKey===!1?i.onValueChange(r):u.preventDefault()}),onKeyDown:ze(e.onKeyDown,u=>{[" ","Enter"].includes(u.key)&&i.onValueChange(r)}),onFocus:ze(e.onFocus,()=>{const u=i.activationMode!=="manual";!d&&!o&&u&&i.onValueChange(r)})})})});Gc.displayName=Yc;var Xc="TabsContent",Uc=x.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=Ro(Xc,n),c=qc(a.baseId,r),l=Kc(a.baseId,r),d=r===a.value,u=x.useRef(d);return x.useEffect(()=>{const f=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(f)},[]),p.jsx(af,{present:o||d,children:({present:f})=>p.jsx(At.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!f,id:l,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0},children:f&&s})})});Uc.displayName=Xc;function qc(e,t){return`${e}-trigger-${t}`}function Kc(e,t){return`${e}-content-${t}`}var P0=Wc,I0=Vc,A0=Gc,R0=Uc;function ES({className:e,...t}){return p.jsx(P0,{"data-slot":"tabs",className:ae("flex flex-col gap-2",e),...t})}function SS({className:e,...t}){return p.jsx(I0,{"data-slot":"tabs-list",className:ae("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg border border-input p-[3px]",e),...t})}function _S({className:e,...t}){return p.jsx(A0,{"data-slot":"tabs-trigger",className:ae("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t})}function CS({className:e,...t}){return p.jsx(R0,{"data-slot":"tabs-content",className:ae("flex-1 outline-none",e),...t})}function ce(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=ce(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var T0={value:()=>{}};function lr(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Fn(n)}function Fn(e){this._=e}function D0(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Fn.prototype=lr.prototype={constructor:Fn,on:function(e,t){var n=this._,r=D0(e+"",n),o,s=-1,i=r.length;if(arguments.length<2){for(;++s<i;)if((o=(e=r[s]).type)&&(o=j0(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(o=(e=r[s]).type)n[o]=Rs(n[o],e.name,t);else if(t==null)for(o in n)n[o]=Rs(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Fn(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,s;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,o=s.length;r<o;++r)s[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,s=r.length;o<s;++o)r[o].value.apply(t,n)}};function j0(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function Rs(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=T0,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var no="http://www.w3.org/1999/xhtml";const Ts={svg:"http://www.w3.org/2000/svg",xhtml:no,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function dr(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Ts.hasOwnProperty(t)?{space:Ts[t],local:e}:e}function O0(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===no&&t.documentElement.namespaceURI===no?t.createElement(e):t.createElementNS(n,e)}}function $0(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Zc(e){var t=dr(e);return(t.local?$0:O0)(t)}function L0(){}function To(e){return e==null?L0:function(){return this.querySelector(e)}}function F0(e){typeof e!="function"&&(e=To(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var s=t[o],i=s.length,a=r[o]=new Array(i),c,l,d=0;d<i;++d)(c=s[d])&&(l=e.call(c,c.__data__,d,s))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new we(r,this._parents)}function z0(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function H0(){return[]}function Qc(e){return e==null?H0:function(){return this.querySelectorAll(e)}}function W0(e){return function(){return z0(e.apply(this,arguments))}}function B0(e){typeof e=="function"?e=W0(e):e=Qc(e);for(var t=this._groups,n=t.length,r=[],o=[],s=0;s<n;++s)for(var i=t[s],a=i.length,c,l=0;l<a;++l)(c=i[l])&&(r.push(e.call(c,c.__data__,l,i)),o.push(c));return new we(r,o)}function Jc(e){return function(){return this.matches(e)}}function eu(e){return function(t){return t.matches(e)}}var V0=Array.prototype.find;function Y0(e){return function(){return V0.call(this.children,e)}}function G0(){return this.firstElementChild}function X0(e){return this.select(e==null?G0:Y0(typeof e=="function"?e:eu(e)))}var U0=Array.prototype.filter;function q0(){return Array.from(this.children)}function K0(e){return function(){return U0.call(this.children,e)}}function Z0(e){return this.selectAll(e==null?q0:K0(typeof e=="function"?e:eu(e)))}function Q0(e){typeof e!="function"&&(e=Jc(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var s=t[o],i=s.length,a=r[o]=[],c,l=0;l<i;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&a.push(c);return new we(r,this._parents)}function tu(e){return new Array(e.length)}function J0(){return new we(this._enter||this._groups.map(tu),this._parents)}function qn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}qn.prototype={constructor:qn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function ey(e){return function(){return e}}function ty(e,t,n,r,o,s){for(var i=0,a,c=t.length,l=s.length;i<l;++i)(a=t[i])?(a.__data__=s[i],r[i]=a):n[i]=new qn(e,s[i]);for(;i<c;++i)(a=t[i])&&(o[i]=a)}function ny(e,t,n,r,o,s,i){var a,c,l=new Map,d=t.length,u=s.length,f=new Array(d),g;for(a=0;a<d;++a)(c=t[a])&&(f[a]=g=i.call(c,c.__data__,a,t)+"",l.has(g)?o[a]=c:l.set(g,c));for(a=0;a<u;++a)g=i.call(e,s[a],a,s)+"",(c=l.get(g))?(r[a]=c,c.__data__=s[a],l.delete(g)):n[a]=new qn(e,s[a]);for(a=0;a<d;++a)(c=t[a])&&l.get(f[a])===c&&(o[a]=c)}function ry(e){return e.__data__}function oy(e,t){if(!arguments.length)return Array.from(this,ry);var n=t?ny:ty,r=this._parents,o=this._groups;typeof e!="function"&&(e=ey(e));for(var s=o.length,i=new Array(s),a=new Array(s),c=new Array(s),l=0;l<s;++l){var d=r[l],u=o[l],f=u.length,g=sy(e.call(d,d&&d.__data__,l,r)),h=g.length,m=a[l]=new Array(h),w=i[l]=new Array(h),v=c[l]=new Array(f);n(d,u,m,w,v,g,t);for(var E=0,y=0,b,S;E<h;++E)if(b=m[E]){for(E>=y&&(y=E+1);!(S=w[y])&&++y<h;);b._next=S||null}}return i=new we(i,r),i._enter=a,i._exit=c,i}function sy(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function iy(){return new we(this._exit||this._groups.map(tu),this._parents)}function ay(e,t,n){var r=this.enter(),o=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?s.remove():n(s),r&&o?r.merge(o).order():o}function cy(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,s=r.length,i=Math.min(o,s),a=new Array(o),c=0;c<i;++c)for(var l=n[c],d=r[c],u=l.length,f=a[c]=new Array(u),g,h=0;h<u;++h)(g=l[h]||d[h])&&(f[h]=g);for(;c<o;++c)a[c]=n[c];return new we(a,this._parents)}function uy(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,s=r[o],i;--o>=0;)(i=r[o])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function ly(e){e||(e=dy);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,r=n.length,o=new Array(r),s=0;s<r;++s){for(var i=n[s],a=i.length,c=o[s]=new Array(a),l,d=0;d<a;++d)(l=i[d])&&(c[d]=l);c.sort(t)}return new we(o,this._parents).order()}function dy(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function fy(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function hy(){return Array.from(this)}function py(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,s=r.length;o<s;++o){var i=r[o];if(i)return i}return null}function gy(){let e=0;for(const t of this)++e;return e}function my(){return!this.node()}function yy(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],s=0,i=o.length,a;s<i;++s)(a=o[s])&&e.call(a,a.__data__,s,o);return this}function xy(e){return function(){this.removeAttribute(e)}}function wy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function vy(e,t){return function(){this.setAttribute(e,t)}}function by(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ey(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Sy(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function _y(e,t){var n=dr(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?wy:xy:typeof t=="function"?n.local?Sy:Ey:n.local?by:vy)(n,t))}function nu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Cy(e){return function(){this.style.removeProperty(e)}}function Ny(e,t,n){return function(){this.style.setProperty(e,t,n)}}function My(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function ky(e,t,n){return arguments.length>1?this.each((t==null?Cy:typeof t=="function"?My:Ny)(e,t,n??"")):St(this.node(),e)}function St(e,t){return e.style.getPropertyValue(t)||nu(e).getComputedStyle(e,null).getPropertyValue(t)}function Py(e){return function(){delete this[e]}}function Iy(e,t){return function(){this[e]=t}}function Ay(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ry(e,t){return arguments.length>1?this.each((t==null?Py:typeof t=="function"?Ay:Iy)(e,t)):this.node()[e]}function ru(e){return e.trim().split(/^|\s+/)}function Do(e){return e.classList||new ou(e)}function ou(e){this._node=e,this._names=ru(e.getAttribute("class")||"")}ou.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function su(e,t){for(var n=Do(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function iu(e,t){for(var n=Do(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function Ty(e){return function(){su(this,e)}}function Dy(e){return function(){iu(this,e)}}function jy(e,t){return function(){(t.apply(this,arguments)?su:iu)(this,e)}}function Oy(e,t){var n=ru(e+"");if(arguments.length<2){for(var r=Do(this.node()),o=-1,s=n.length;++o<s;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?jy:t?Ty:Dy)(n,t))}function $y(){this.textContent=""}function Ly(e){return function(){this.textContent=e}}function Fy(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function zy(e){return arguments.length?this.each(e==null?$y:(typeof e=="function"?Fy:Ly)(e)):this.node().textContent}function Hy(){this.innerHTML=""}function Wy(e){return function(){this.innerHTML=e}}function By(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Vy(e){return arguments.length?this.each(e==null?Hy:(typeof e=="function"?By:Wy)(e)):this.node().innerHTML}function Yy(){this.nextSibling&&this.parentNode.appendChild(this)}function Gy(){return this.each(Yy)}function Xy(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Uy(){return this.each(Xy)}function qy(e){var t=typeof e=="function"?e:Zc(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ky(){return null}function Zy(e,t){var n=typeof e=="function"?e:Zc(e),r=t==null?Ky:typeof t=="function"?t:To(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Qy(){var e=this.parentNode;e&&e.removeChild(this)}function Jy(){return this.each(Qy)}function ex(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function tx(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function nx(e){return this.select(e?tx:ex)}function rx(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ox(e){return function(t){e.call(this,t,this.__data__)}}function sx(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function ix(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,s;n<o;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}function ax(e,t,n){return function(){var r=this.__on,o,s=ox(t);if(r){for(var i=0,a=r.length;i<a;++i)if((o=r[i]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=s,o.options=n),o.value=t;return}}this.addEventListener(e.type,s,n),o={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(o):this.__on=[o]}}function cx(e,t,n){var r=sx(e+""),o,s=r.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(o=0,d=a[c];o<s;++o)if((i=r[o]).type===d.type&&i.name===d.name)return d.value}return}for(a=t?ax:ix,o=0;o<s;++o)this.each(a(r[o],t,n));return this}function au(e,t,n){var r=nu(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function ux(e,t){return function(){return au(this,e,t)}}function lx(e,t){return function(){return au(this,e,t.apply(this,arguments))}}function dx(e,t){return this.each((typeof t=="function"?lx:ux)(e,t))}function*fx(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,s=r.length,i;o<s;++o)(i=r[o])&&(yield i)}var cu=[null];function we(e,t){this._groups=e,this._parents=t}function fn(){return new we([[document.documentElement]],cu)}function hx(){return this}we.prototype=fn.prototype={constructor:we,select:F0,selectAll:B0,selectChild:X0,selectChildren:Z0,filter:Q0,data:oy,enter:J0,exit:iy,join:ay,merge:cy,selection:hx,order:uy,sort:ly,call:fy,nodes:hy,node:py,size:gy,empty:my,each:yy,attr:_y,style:ky,property:Ry,classed:Oy,text:zy,html:Vy,raise:Gy,lower:Uy,append:qy,insert:Zy,remove:Jy,clone:nx,datum:rx,on:cx,dispatch:dx,[Symbol.iterator]:fx};function ye(e){return typeof e=="string"?new we([[document.querySelector(e)]],[document.documentElement]):new we([[e]],cu)}function px(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ee(e,t){if(e=px(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const gx={passive:!1},Kt={capture:!0,passive:!1};function Dr(e){e.stopImmediatePropagation()}function bt(e){e.preventDefault(),e.stopImmediatePropagation()}function uu(e){var t=e.document.documentElement,n=ye(e).on("dragstart.drag",bt,Kt);"onselectstart"in t?n.on("selectstart.drag",bt,Kt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function lu(e,t){var n=e.document.documentElement,r=ye(e).on("dragstart.drag",null);t&&(r.on("click.drag",bt,Kt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Mn=e=>()=>e;function ro(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:s,x:i,y:a,dx:c,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}ro.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function mx(e){return!e.ctrlKey&&!e.button}function yx(){return this.parentNode}function xx(e,t){return t??{x:e.x,y:e.y}}function wx(){return navigator.maxTouchPoints||"ontouchstart"in this}function du(){var e=mx,t=yx,n=xx,r=wx,o={},s=lr("start","drag","end"),i=0,a,c,l,d,u=0;function f(b){b.on("mousedown.drag",g).filter(r).on("touchstart.drag",w).on("touchmove.drag",v,gx).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(b,S){if(!(d||!e.call(this,b,S))){var C=y(this,t.call(this,b,S),b,S,"mouse");C&&(ye(b.view).on("mousemove.drag",h,Kt).on("mouseup.drag",m,Kt),uu(b.view),Dr(b),l=!1,a=b.clientX,c=b.clientY,C("start",b))}}function h(b){if(bt(b),!l){var S=b.clientX-a,C=b.clientY-c;l=S*S+C*C>u}o.mouse("drag",b)}function m(b){ye(b.view).on("mousemove.drag mouseup.drag",null),lu(b.view,l),bt(b),o.mouse("end",b)}function w(b,S){if(e.call(this,b,S)){var C=b.changedTouches,M=t.call(this,b,S),P=C.length,T,z;for(T=0;T<P;++T)(z=y(this,M,b,S,C[T].identifier,C[T]))&&(Dr(b),z("start",b,C[T]))}}function v(b){var S=b.changedTouches,C=S.length,M,P;for(M=0;M<C;++M)(P=o[S[M].identifier])&&(bt(b),P("drag",b,S[M]))}function E(b){var S=b.changedTouches,C=S.length,M,P;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),M=0;M<C;++M)(P=o[S[M].identifier])&&(Dr(b),P("end",b,S[M]))}function y(b,S,C,M,P,T){var z=s.copy(),A=Ee(T||C,S),D,F,_;if((_=n.call(b,new ro("beforestart",{sourceEvent:C,target:f,identifier:P,active:i,x:A[0],y:A[1],dx:0,dy:0,dispatch:z}),M))!=null)return D=_.x-A[0]||0,F=_.y-A[1]||0,function R(k,j,I){var N=A,O;switch(k){case"start":o[P]=R,O=i++;break;case"end":delete o[P],--i;case"drag":A=Ee(I||j,S),O=i;break}z.call(k,b,new ro(k,{sourceEvent:j,subject:_,target:f,identifier:P,active:O,x:A[0]+D,y:A[1]+F,dx:A[0]-N[0],dy:A[1]-N[1],dispatch:z}),M)}}return f.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Mn(!!b),f):e},f.container=function(b){return arguments.length?(t=typeof b=="function"?b:Mn(b),f):t},f.subject=function(b){return arguments.length?(n=typeof b=="function"?b:Mn(b),f):n},f.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:Mn(!!b),f):r},f.on=function(){var b=s.on.apply(s,arguments);return b===s?f:b},f.clickDistance=function(b){return arguments.length?(u=(b=+b)*b,f):Math.sqrt(u)},f}function jo(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function fu(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function hn(){}var Zt=.7,Kn=1/Zt,Et="\\s*([+-]?\\d+)\\s*",Qt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",je="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vx=/^#([0-9a-f]{3,8})$/,bx=new RegExp(`^rgb\\(${Et},${Et},${Et}\\)$`),Ex=new RegExp(`^rgb\\(${je},${je},${je}\\)$`),Sx=new RegExp(`^rgba\\(${Et},${Et},${Et},${Qt}\\)$`),_x=new RegExp(`^rgba\\(${je},${je},${je},${Qt}\\)$`),Cx=new RegExp(`^hsl\\(${Qt},${je},${je}\\)$`),Nx=new RegExp(`^hsla\\(${Qt},${je},${je},${Qt}\\)$`),Ds={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};jo(hn,st,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:js,formatHex:js,formatHex8:Mx,formatHsl:kx,formatRgb:Os,toString:Os});function js(){return this.rgb().formatHex()}function Mx(){return this.rgb().formatHex8()}function kx(){return hu(this).formatHsl()}function Os(){return this.rgb().formatRgb()}function st(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=vx.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?$s(t):n===3?new ge(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?kn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?kn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=bx.exec(e))?new ge(t[1],t[2],t[3],1):(t=Ex.exec(e))?new ge(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Sx.exec(e))?kn(t[1],t[2],t[3],t[4]):(t=_x.exec(e))?kn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Cx.exec(e))?zs(t[1],t[2]/100,t[3]/100,1):(t=Nx.exec(e))?zs(t[1],t[2]/100,t[3]/100,t[4]):Ds.hasOwnProperty(e)?$s(Ds[e]):e==="transparent"?new ge(NaN,NaN,NaN,0):null}function $s(e){return new ge(e>>16&255,e>>8&255,e&255,1)}function kn(e,t,n,r){return r<=0&&(e=t=n=NaN),new ge(e,t,n,r)}function Px(e){return e instanceof hn||(e=st(e)),e?(e=e.rgb(),new ge(e.r,e.g,e.b,e.opacity)):new ge}function oo(e,t,n,r){return arguments.length===1?Px(e):new ge(e,t,n,r??1)}function ge(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}jo(ge,oo,fu(hn,{brighter(e){return e=e==null?Kn:Math.pow(Kn,e),new ge(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Zt:Math.pow(Zt,e),new ge(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ge(nt(this.r),nt(this.g),nt(this.b),Zn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ls,formatHex:Ls,formatHex8:Ix,formatRgb:Fs,toString:Fs}));function Ls(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}`}function Ix(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}${tt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Fs(){const e=Zn(this.opacity);return`${e===1?"rgb(":"rgba("}${nt(this.r)}, ${nt(this.g)}, ${nt(this.b)}${e===1?")":`, ${e})`}`}function Zn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function nt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function tt(e){return e=nt(e),(e<16?"0":"")+e.toString(16)}function zs(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ne(e,t,n,r)}function hu(e){if(e instanceof Ne)return new Ne(e.h,e.s,e.l,e.opacity);if(e instanceof hn||(e=st(e)),!e)return new Ne;if(e instanceof Ne)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),s=Math.max(t,n,r),i=NaN,a=s-o,c=(s+o)/2;return a?(t===s?i=(n-r)/a+(n<r)*6:n===s?i=(r-t)/a+2:i=(t-n)/a+4,a/=c<.5?s+o:2-s-o,i*=60):a=c>0&&c<1?0:i,new Ne(i,a,c,e.opacity)}function Ax(e,t,n,r){return arguments.length===1?hu(e):new Ne(e,t,n,r??1)}function Ne(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}jo(Ne,Ax,fu(hn,{brighter(e){return e=e==null?Kn:Math.pow(Kn,e),new Ne(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Zt:Math.pow(Zt,e),new Ne(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new ge(jr(e>=240?e-240:e+120,o,r),jr(e,o,r),jr(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Ne(Hs(this.h),Pn(this.s),Pn(this.l),Zn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Zn(this.opacity);return`${e===1?"hsl(":"hsla("}${Hs(this.h)}, ${Pn(this.s)*100}%, ${Pn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Hs(e){return e=(e||0)%360,e<0?e+360:e}function Pn(e){return Math.max(0,Math.min(1,e||0))}function jr(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Oo=e=>()=>e;function Rx(e,t){return function(n){return e+n*t}}function Tx(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Dx(e){return(e=+e)==1?pu:function(t,n){return n-t?Tx(t,n,e):Oo(isNaN(t)?n:t)}}function pu(e,t){var n=t-e;return n?Rx(e,n):Oo(isNaN(e)?t:e)}const Qn=(function e(t){var n=Dx(t);function r(o,s){var i=n((o=oo(o)).r,(s=oo(s)).r),a=n(o.g,s.g),c=n(o.b,s.b),l=pu(o.opacity,s.opacity);return function(d){return o.r=i(d),o.g=a(d),o.b=c(d),o.opacity=l(d),o+""}}return r.gamma=e,r})(1);function jx(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(s){for(o=0;o<n;++o)r[o]=e[o]*(1-s)+t[o]*s;return r}}function Ox(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function $x(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),s=new Array(n),i;for(i=0;i<r;++i)o[i]=Vt(e[i],t[i]);for(;i<n;++i)s[i]=t[i];return function(a){for(i=0;i<r;++i)s[i]=o[i](a);return s}}function Lx(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Te(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Fx(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=Vt(e[o],t[o]):r[o]=t[o];return function(s){for(o in n)r[o]=n[o](s);return r}}var so=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Or=new RegExp(so.source,"g");function zx(e){return function(){return e}}function Hx(e){return function(t){return e(t)+""}}function gu(e,t){var n=so.lastIndex=Or.lastIndex=0,r,o,s,i=-1,a=[],c=[];for(e=e+"",t=t+"";(r=so.exec(e))&&(o=Or.exec(t));)(s=o.index)>n&&(s=t.slice(n,s),a[i]?a[i]+=s:a[++i]=s),(r=r[0])===(o=o[0])?a[i]?a[i]+=o:a[++i]=o:(a[++i]=null,c.push({i,x:Te(r,o)})),n=Or.lastIndex;return n<t.length&&(s=t.slice(n),a[i]?a[i]+=s:a[++i]=s),a.length<2?c[0]?Hx(c[0].x):zx(t):(t=c.length,function(l){for(var d=0,u;d<t;++d)a[(u=c[d]).i]=u.x(l);return a.join("")})}function Vt(e,t){var n=typeof t,r;return t==null||n==="boolean"?Oo(t):(n==="number"?Te:n==="string"?(r=st(t))?(t=r,Qn):gu:t instanceof st?Qn:t instanceof Date?Lx:Ox(t)?jx:Array.isArray(t)?$x:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Fx:Te)(e,t)}var Ws=180/Math.PI,io={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function mu(e,t,n,r,o,s){var i,a,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,i=-i),{translateX:o,translateY:s,rotate:Math.atan2(t,e)*Ws,skewX:Math.atan(c)*Ws,scaleX:i,scaleY:a}}var In;function Wx(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?io:mu(t.a,t.b,t.c,t.d,t.e,t.f)}function Bx(e){return e==null||(In||(In=document.createElementNS("http://www.w3.org/2000/svg","g")),In.setAttribute("transform",e),!(e=In.transform.baseVal.consolidate()))?io:(e=e.matrix,mu(e.a,e.b,e.c,e.d,e.e,e.f))}function yu(e,t,n,r){function o(l){return l.length?l.pop()+" ":""}function s(l,d,u,f,g,h){if(l!==u||d!==f){var m=g.push("translate(",null,t,null,n);h.push({i:m-4,x:Te(l,u)},{i:m-2,x:Te(d,f)})}else(u||f)&&g.push("translate("+u+t+f+n)}function i(l,d,u,f){l!==d?(l-d>180?d+=360:d-l>180&&(l+=360),f.push({i:u.push(o(u)+"rotate(",null,r)-2,x:Te(l,d)})):d&&u.push(o(u)+"rotate("+d+r)}function a(l,d,u,f){l!==d?f.push({i:u.push(o(u)+"skewX(",null,r)-2,x:Te(l,d)}):d&&u.push(o(u)+"skewX("+d+r)}function c(l,d,u,f,g,h){if(l!==u||d!==f){var m=g.push(o(g)+"scale(",null,",",null,")");h.push({i:m-4,x:Te(l,u)},{i:m-2,x:Te(d,f)})}else(u!==1||f!==1)&&g.push(o(g)+"scale("+u+","+f+")")}return function(l,d){var u=[],f=[];return l=e(l),d=e(d),s(l.translateX,l.translateY,d.translateX,d.translateY,u,f),i(l.rotate,d.rotate,u,f),a(l.skewX,d.skewX,u,f),c(l.scaleX,l.scaleY,d.scaleX,d.scaleY,u,f),l=d=null,function(g){for(var h=-1,m=f.length,w;++h<m;)u[(w=f[h]).i]=w.x(g);return u.join("")}}}var Vx=yu(Wx,"px, ","px)","deg)"),Yx=yu(Bx,", ",")",")"),Gx=1e-12;function Bs(e){return((e=Math.exp(e))+1/e)/2}function Xx(e){return((e=Math.exp(e))-1/e)/2}function Ux(e){return((e=Math.exp(2*e))-1)/(e+1)}const zn=(function e(t,n,r){function o(s,i){var a=s[0],c=s[1],l=s[2],d=i[0],u=i[1],f=i[2],g=d-a,h=u-c,m=g*g+h*h,w,v;if(m<Gx)v=Math.log(f/l)/t,w=function(M){return[a+M*g,c+M*h,l*Math.exp(t*M*v)]};else{var E=Math.sqrt(m),y=(f*f-l*l+r*m)/(2*l*n*E),b=(f*f-l*l-r*m)/(2*f*n*E),S=Math.log(Math.sqrt(y*y+1)-y),C=Math.log(Math.sqrt(b*b+1)-b);v=(C-S)/t,w=function(M){var P=M*v,T=Bs(S),z=l/(n*E)*(T*Ux(t*P+S)-Xx(S));return[a+z*g,c+z*h,l*T/Bs(t*P+S)]}}return w.duration=v*1e3*t/Math.SQRT2,w}return o.rho=function(s){var i=Math.max(.001,+s),a=i*i,c=a*a;return e(i,a,c)},o})(Math.SQRT2,2,4);var _t=0,Wt=0,Ft=0,xu=1e3,Jn,Bt,er=0,it=0,fr=0,Jt=typeof performance=="object"&&performance.now?performance:Date,wu=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function $o(){return it||(wu(qx),it=Jt.now()+fr)}function qx(){it=0}function tr(){this._call=this._time=this._next=null}tr.prototype=vu.prototype={constructor:tr,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?$o():+n)+(t==null?0:+t),!this._next&&Bt!==this&&(Bt?Bt._next=this:Jn=this,Bt=this),this._call=e,this._time=n,ao()},stop:function(){this._call&&(this._call=null,this._time=1/0,ao())}};function vu(e,t,n){var r=new tr;return r.restart(e,t,n),r}function Kx(){$o(),++_t;for(var e=Jn,t;e;)(t=it-e._time)>=0&&e._call.call(void 0,t),e=e._next;--_t}function Vs(){it=(er=Jt.now())+fr,_t=Wt=0;try{Kx()}finally{_t=0,Qx(),it=0}}function Zx(){var e=Jt.now(),t=e-er;t>xu&&(fr-=t,er=e)}function Qx(){for(var e,t=Jn,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Jn=n);Bt=e,ao(r)}function ao(e){if(!_t){Wt&&(Wt=clearTimeout(Wt));var t=e-it;t>24?(e<1/0&&(Wt=setTimeout(Vs,e-Jt.now()-fr)),Ft&&(Ft=clearInterval(Ft))):(Ft||(er=Jt.now(),Ft=setInterval(Zx,xu)),_t=1,wu(Vs))}}function Ys(e,t,n){var r=new tr;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Jx=lr("start","end","cancel","interrupt"),ew=[],bu=0,Gs=1,co=2,Hn=3,Xs=4,uo=5,Wn=6;function hr(e,t,n,r,o,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;tw(e,n,{name:t,index:r,group:o,on:Jx,tween:ew,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:bu})}function Lo(e,t){var n=Ie(e,t);if(n.state>bu)throw new Error("too late; already scheduled");return n}function $e(e,t){var n=Ie(e,t);if(n.state>Hn)throw new Error("too late; already running");return n}function Ie(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function tw(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=vu(s,0,n.time);function s(l){n.state=Gs,n.timer.restart(i,n.delay,n.time),n.delay<=l&&i(l-n.delay)}function i(l){var d,u,f,g;if(n.state!==Gs)return c();for(d in r)if(g=r[d],g.name===n.name){if(g.state===Hn)return Ys(i);g.state===Xs?(g.state=Wn,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete r[d]):+d<t&&(g.state=Wn,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete r[d])}if(Ys(function(){n.state===Hn&&(n.state=Xs,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=co,n.on.call("start",e,e.__data__,n.index,n.group),n.state===co){for(n.state=Hn,o=new Array(f=n.tween.length),d=0,u=-1;d<f;++d)(g=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(o[++u]=g);o.length=u+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=uo,1),u=-1,f=o.length;++u<f;)o[u].call(e,d);n.state===uo&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Wn,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function Bn(e,t){var n=e.__transition,r,o,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((r=n[i]).name!==t){s=!1;continue}o=r.state>co&&r.state<uo,r.state=Wn,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[i]}s&&delete e.__transition}}function nw(e){return this.each(function(){Bn(this,e)})}function rw(e,t){var n,r;return function(){var o=$e(this,e),s=o.tween;if(s!==n){r=n=s;for(var i=0,a=r.length;i<a;++i)if(r[i].name===t){r=r.slice(),r.splice(i,1);break}}o.tween=r}}function ow(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var s=$e(this,e),i=s.tween;if(i!==r){o=(r=i).slice();for(var a={name:t,value:n},c=0,l=o.length;c<l;++c)if(o[c].name===t){o[c]=a;break}c===l&&o.push(a)}s.tween=o}}function sw(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Ie(this.node(),n).tween,o=0,s=r.length,i;o<s;++o)if((i=r[o]).name===e)return i.value;return null}return this.each((t==null?rw:ow)(n,e,t))}function Fo(e,t,n){var r=e._id;return e.each(function(){var o=$e(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return Ie(o,r).value[t]}}function Eu(e,t){var n;return(typeof t=="number"?Te:t instanceof st?Qn:(n=st(t))?(t=n,Qn):gu)(e,t)}function iw(e){return function(){this.removeAttribute(e)}}function aw(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cw(e,t,n){var r,o=n+"",s;return function(){var i=this.getAttribute(e);return i===o?null:i===r?s:s=t(r=i,n)}}function uw(e,t,n){var r,o=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===o?null:i===r?s:s=t(r=i,n)}}function lw(e,t,n){var r,o,s;return function(){var i,a=n(this),c;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),c=a+"",i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a)))}}function dw(e,t,n){var r,o,s;return function(){var i,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),c=a+"",i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a)))}}function fw(e,t){var n=dr(e),r=n==="transform"?Yx:Eu;return this.attrTween(e,typeof t=="function"?(n.local?dw:lw)(n,r,Fo(this,"attr."+e,t)):t==null?(n.local?aw:iw)(n):(n.local?uw:cw)(n,r,t))}function hw(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function pw(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function gw(e,t){var n,r;function o(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&pw(e,s)),n}return o._value=t,o}function mw(e,t){var n,r;function o(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&hw(e,s)),n}return o._value=t,o}function yw(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=dr(e);return this.tween(n,(r.local?gw:mw)(r,t))}function xw(e,t){return function(){Lo(this,e).delay=+t.apply(this,arguments)}}function ww(e,t){return t=+t,function(){Lo(this,e).delay=t}}function vw(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?xw:ww)(t,e)):Ie(this.node(),t).delay}function bw(e,t){return function(){$e(this,e).duration=+t.apply(this,arguments)}}function Ew(e,t){return t=+t,function(){$e(this,e).duration=t}}function Sw(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?bw:Ew)(t,e)):Ie(this.node(),t).duration}function _w(e,t){if(typeof t!="function")throw new Error;return function(){$e(this,e).ease=t}}function Cw(e){var t=this._id;return arguments.length?this.each(_w(t,e)):Ie(this.node(),t).ease}function Nw(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;$e(this,e).ease=n}}function Mw(e){if(typeof e!="function")throw new Error;return this.each(Nw(this._id,e))}function kw(e){typeof e!="function"&&(e=Jc(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var s=t[o],i=s.length,a=r[o]=[],c,l=0;l<i;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&a.push(c);return new We(r,this._parents,this._name,this._id)}function Pw(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,s=Math.min(r,o),i=new Array(r),a=0;a<s;++a)for(var c=t[a],l=n[a],d=c.length,u=i[a]=new Array(d),f,g=0;g<d;++g)(f=c[g]||l[g])&&(u[g]=f);for(;a<r;++a)i[a]=t[a];return new We(i,this._parents,this._name,this._id)}function Iw(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Aw(e,t,n){var r,o,s=Iw(t)?Lo:$e;return function(){var i=s(this,e),a=i.on;a!==r&&(o=(r=a).copy()).on(t,n),i.on=o}}function Rw(e,t){var n=this._id;return arguments.length<2?Ie(this.node(),n).on.on(e):this.each(Aw(n,e,t))}function Tw(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Dw(){return this.on("end.remove",Tw(this._id))}function jw(e){var t=this._name,n=this._id;typeof e!="function"&&(e=To(e));for(var r=this._groups,o=r.length,s=new Array(o),i=0;i<o;++i)for(var a=r[i],c=a.length,l=s[i]=new Array(c),d,u,f=0;f<c;++f)(d=a[f])&&(u=e.call(d,d.__data__,f,a))&&("__data__"in d&&(u.__data__=d.__data__),l[f]=u,hr(l[f],t,n,f,l,Ie(d,n)));return new We(s,this._parents,t,n)}function Ow(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Qc(e));for(var r=this._groups,o=r.length,s=[],i=[],a=0;a<o;++a)for(var c=r[a],l=c.length,d,u=0;u<l;++u)if(d=c[u]){for(var f=e.call(d,d.__data__,u,c),g,h=Ie(d,n),m=0,w=f.length;m<w;++m)(g=f[m])&&hr(g,t,n,m,f,h);s.push(f),i.push(d)}return new We(s,i,t,n)}var $w=fn.prototype.constructor;function Lw(){return new $w(this._groups,this._parents)}function Fw(e,t){var n,r,o;return function(){var s=St(this,e),i=(this.style.removeProperty(e),St(this,e));return s===i?null:s===n&&i===r?o:o=t(n=s,r=i)}}function Su(e){return function(){this.style.removeProperty(e)}}function zw(e,t,n){var r,o=n+"",s;return function(){var i=St(this,e);return i===o?null:i===r?s:s=t(r=i,n)}}function Hw(e,t,n){var r,o,s;return function(){var i=St(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),St(this,e))),i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a))}}function Ww(e,t){var n,r,o,s="style."+t,i="end."+s,a;return function(){var c=$e(this,e),l=c.on,d=c.value[s]==null?a||(a=Su(t)):void 0;(l!==n||o!==d)&&(r=(n=l).copy()).on(i,o=d),c.on=r}}function Bw(e,t,n){var r=(e+="")=="transform"?Vx:Eu;return t==null?this.styleTween(e,Fw(e,r)).on("end.style."+e,Su(e)):typeof t=="function"?this.styleTween(e,Hw(e,r,Fo(this,"style."+e,t))).each(Ww(this._id,e)):this.styleTween(e,zw(e,r,t),n).on("end.style."+e,null)}function Vw(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Yw(e,t,n){var r,o;function s(){var i=t.apply(this,arguments);return i!==o&&(r=(o=i)&&Vw(e,i,n)),r}return s._value=t,s}function Gw(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Yw(e,t,n??""))}function Xw(e){return function(){this.textContent=e}}function Uw(e){return function(){var t=e(this);this.textContent=t??""}}function qw(e){return this.tween("text",typeof e=="function"?Uw(Fo(this,"text",e)):Xw(e==null?"":e+""))}function Kw(e){return function(t){this.textContent=e.call(this,t)}}function Zw(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&Kw(o)),t}return r._value=e,r}function Qw(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Zw(e))}function Jw(){for(var e=this._name,t=this._id,n=_u(),r=this._groups,o=r.length,s=0;s<o;++s)for(var i=r[s],a=i.length,c,l=0;l<a;++l)if(c=i[l]){var d=Ie(c,t);hr(c,e,n,l,i,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new We(r,this._parents,e,n)}function ev(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(s,i){var a={value:i},c={value:function(){--o===0&&s()}};n.each(function(){var l=$e(this,r),d=l.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),o===0&&s()})}var tv=0;function We(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function _u(){return++tv}var Le=fn.prototype;We.prototype={constructor:We,select:jw,selectAll:Ow,selectChild:Le.selectChild,selectChildren:Le.selectChildren,filter:kw,merge:Pw,selection:Lw,transition:Jw,call:Le.call,nodes:Le.nodes,node:Le.node,size:Le.size,empty:Le.empty,each:Le.each,on:Rw,attr:fw,attrTween:yw,style:Bw,styleTween:Gw,text:qw,textTween:Qw,remove:Dw,tween:sw,delay:vw,duration:Sw,ease:Cw,easeVarying:Mw,end:ev,[Symbol.iterator]:Le[Symbol.iterator]};function nv(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var rv={time:null,delay:0,duration:250,ease:nv};function ov(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function sv(e){var t,n;e instanceof We?(t=e._id,e=e._name):(t=_u(),(n=rv).time=$o(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,s=0;s<o;++s)for(var i=r[s],a=i.length,c,l=0;l<a;++l)(c=i[l])&&hr(c,e,t,l,i,n||ov(c,t));return new We(r,this._parents,e,t)}fn.prototype.interrupt=nw;fn.prototype.transition=sv;const An=e=>()=>e;function iv(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Fe(e,t,n){this.k=e,this.x=t,this.y=n}Fe.prototype={constructor:Fe,scale:function(e){return e===1?this:new Fe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Fe(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var pr=new Fe(1,0,0);Cu.prototype=Fe.prototype;function Cu(e){for(;!e.__zoom;)if(!(e=e.parentNode))return pr;return e.__zoom}function $r(e){e.stopImmediatePropagation()}function zt(e){e.preventDefault(),e.stopImmediatePropagation()}function av(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function cv(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Us(){return this.__zoom||pr}function uv(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function lv(){return navigator.maxTouchPoints||"ontouchstart"in this}function dv(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function Nu(){var e=av,t=cv,n=dv,r=uv,o=lv,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,c=zn,l=lr("start","zoom","end"),d,u,f,g=500,h=150,m=0,w=10;function v(_){_.property("__zoom",Us).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",z).filter(o).on("touchstart.zoom",A).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(_,R,k,j){var I=_.selection?_.selection():_;I.property("__zoom",Us),_!==I?S(_,R,k,j):I.interrupt().each(function(){C(this,arguments).event(j).start().zoom(null,typeof R=="function"?R.apply(this,arguments):R).end()})},v.scaleBy=function(_,R,k,j){v.scaleTo(_,function(){var I=this.__zoom.k,N=typeof R=="function"?R.apply(this,arguments):R;return I*N},k,j)},v.scaleTo=function(_,R,k,j){v.transform(_,function(){var I=t.apply(this,arguments),N=this.__zoom,O=k==null?b(I):typeof k=="function"?k.apply(this,arguments):k,$=N.invert(O),L=typeof R=="function"?R.apply(this,arguments):R;return n(y(E(N,L),O,$),I,i)},k,j)},v.translateBy=function(_,R,k,j){v.transform(_,function(){return n(this.__zoom.translate(typeof R=="function"?R.apply(this,arguments):R,typeof k=="function"?k.apply(this,arguments):k),t.apply(this,arguments),i)},null,j)},v.translateTo=function(_,R,k,j,I){v.transform(_,function(){var N=t.apply(this,arguments),O=this.__zoom,$=j==null?b(N):typeof j=="function"?j.apply(this,arguments):j;return n(pr.translate($[0],$[1]).scale(O.k).translate(typeof R=="function"?-R.apply(this,arguments):-R,typeof k=="function"?-k.apply(this,arguments):-k),N,i)},j,I)};function E(_,R){return R=Math.max(s[0],Math.min(s[1],R)),R===_.k?_:new Fe(R,_.x,_.y)}function y(_,R,k){var j=R[0]-k[0]*_.k,I=R[1]-k[1]*_.k;return j===_.x&&I===_.y?_:new Fe(_.k,j,I)}function b(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function S(_,R,k,j){_.on("start.zoom",function(){C(this,arguments).event(j).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(j).end()}).tween("zoom",function(){var I=this,N=arguments,O=C(I,N).event(j),$=t.apply(I,N),L=k==null?b($):typeof k=="function"?k.apply(I,N):k,W=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),B=I.__zoom,X=typeof R=="function"?R.apply(I,N):R,U=c(B.invert(L).concat(W/B.k),X.invert(L).concat(W/X.k));return function(G){if(G===1)G=X;else{var H=U(G),V=W/H[2];G=new Fe(V,L[0]-H[0]*V,L[1]-H[1]*V)}O.zoom(null,G)}})}function C(_,R,k){return!k&&_.__zooming||new M(_,R)}function M(_,R){this.that=_,this.args=R,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,R),this.taps=0}M.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,R){return this.mouse&&_!=="mouse"&&(this.mouse[1]=R.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=R.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=R.invert(this.touch1[0])),this.that.__zoom=R,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var R=ye(this.that).datum();l.call(_,this.that,new iv(_,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:l}),R)}};function P(_,...R){if(!e.apply(this,arguments))return;var k=C(this,R).event(_),j=this.__zoom,I=Math.max(s[0],Math.min(s[1],j.k*Math.pow(2,r.apply(this,arguments)))),N=Ee(_);if(k.wheel)(k.mouse[0][0]!==N[0]||k.mouse[0][1]!==N[1])&&(k.mouse[1]=j.invert(k.mouse[0]=N)),clearTimeout(k.wheel);else{if(j.k===I)return;k.mouse=[N,j.invert(N)],Bn(this),k.start()}zt(_),k.wheel=setTimeout(O,h),k.zoom("mouse",n(y(E(j,I),k.mouse[0],k.mouse[1]),k.extent,i));function O(){k.wheel=null,k.end()}}function T(_,...R){if(f||!e.apply(this,arguments))return;var k=_.currentTarget,j=C(this,R,!0).event(_),I=ye(_.view).on("mousemove.zoom",L,!0).on("mouseup.zoom",W,!0),N=Ee(_,k),O=_.clientX,$=_.clientY;uu(_.view),$r(_),j.mouse=[N,this.__zoom.invert(N)],Bn(this),j.start();function L(B){if(zt(B),!j.moved){var X=B.clientX-O,U=B.clientY-$;j.moved=X*X+U*U>m}j.event(B).zoom("mouse",n(y(j.that.__zoom,j.mouse[0]=Ee(B,k),j.mouse[1]),j.extent,i))}function W(B){I.on("mousemove.zoom mouseup.zoom",null),lu(B.view,j.moved),zt(B),j.event(B).end()}}function z(_,...R){if(e.apply(this,arguments)){var k=this.__zoom,j=Ee(_.changedTouches?_.changedTouches[0]:_,this),I=k.invert(j),N=k.k*(_.shiftKey?.5:2),O=n(y(E(k,N),j,I),t.apply(this,R),i);zt(_),a>0?ye(this).transition().duration(a).call(S,O,j,_):ye(this).call(v.transform,O,j,_)}}function A(_,...R){if(e.apply(this,arguments)){var k=_.touches,j=k.length,I=C(this,R,_.changedTouches.length===j).event(_),N,O,$,L;for($r(_),O=0;O<j;++O)$=k[O],L=Ee($,this),L=[L,this.__zoom.invert(L),$.identifier],I.touch0?!I.touch1&&I.touch0[2]!==L[2]&&(I.touch1=L,I.taps=0):(I.touch0=L,N=!0,I.taps=1+!!d);d&&(d=clearTimeout(d)),N&&(I.taps<2&&(u=L[0],d=setTimeout(function(){d=null},g)),Bn(this),I.start())}}function D(_,...R){if(this.__zooming){var k=C(this,R).event(_),j=_.changedTouches,I=j.length,N,O,$,L;for(zt(_),N=0;N<I;++N)O=j[N],$=Ee(O,this),k.touch0&&k.touch0[2]===O.identifier?k.touch0[0]=$:k.touch1&&k.touch1[2]===O.identifier&&(k.touch1[0]=$);if(O=k.that.__zoom,k.touch1){var W=k.touch0[0],B=k.touch0[1],X=k.touch1[0],U=k.touch1[1],G=(G=X[0]-W[0])*G+(G=X[1]-W[1])*G,H=(H=U[0]-B[0])*H+(H=U[1]-B[1])*H;O=E(O,Math.sqrt(G/H)),$=[(W[0]+X[0])/2,(W[1]+X[1])/2],L=[(B[0]+U[0])/2,(B[1]+U[1])/2]}else if(k.touch0)$=k.touch0[0],L=k.touch0[1];else return;k.zoom("touch",n(y(O,$,L),k.extent,i))}}function F(_,...R){if(this.__zooming){var k=C(this,R).event(_),j=_.changedTouches,I=j.length,N,O;for($r(_),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),N=0;N<I;++N)O=j[N],k.touch0&&k.touch0[2]===O.identifier?delete k.touch0:k.touch1&&k.touch1[2]===O.identifier&&delete k.touch1;if(k.touch1&&!k.touch0&&(k.touch0=k.touch1,delete k.touch1),k.touch0)k.touch0[1]=this.__zoom.invert(k.touch0[0]);else if(k.end(),k.taps===2&&(O=Ee(O,this),Math.hypot(u[0]-O[0],u[1]-O[1])<w)){var $=ye(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return v.wheelDelta=function(_){return arguments.length?(r=typeof _=="function"?_:An(+_),v):r},v.filter=function(_){return arguments.length?(e=typeof _=="function"?_:An(!!_),v):e},v.touchable=function(_){return arguments.length?(o=typeof _=="function"?_:An(!!_),v):o},v.extent=function(_){return arguments.length?(t=typeof _=="function"?_:An([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),v):t},v.scaleExtent=function(_){return arguments.length?(s[0]=+_[0],s[1]=+_[1],v):[s[0],s[1]]},v.translateExtent=function(_){return arguments.length?(i[0][0]=+_[0][0],i[1][0]=+_[1][0],i[0][1]=+_[0][1],i[1][1]=+_[1][1],v):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},v.constrain=function(_){return arguments.length?(n=_,v):n},v.duration=function(_){return arguments.length?(a=+_,v):a},v.interpolate=function(_){return arguments.length?(c=_,v):c},v.on=function(){var _=l.on.apply(l,arguments);return _===l?v:_},v.clickDistance=function(_){return arguments.length?(m=(_=+_)*_,v):Math.sqrt(m)},v.tapDistance=function(_){return arguments.length?(w=+_,v):w},v}const Oe={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.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:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow 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:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/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."},en=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Mu=["Enter"," ","Escape"],ku={"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:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"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 Ct;(function(e){e.Strict="strict",e.Loose="loose"})(Ct||(Ct={}));var rt;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(rt||(rt={}));var tn;(function(e){e.Partial="partial",e.Full="full"})(tn||(tn={}));const Pu={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var qe;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(qe||(qe={}));var Nt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Nt||(Nt={}));var Y;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Y||(Y={}));const qs={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function Iu(e){return e===null?null:e?"valid":"invalid"}const Au=e=>"id"in e&&"source"in e&&"target"in e,fv=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),zo=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),pn=(e,t=[0,0])=>{const{width:n,height:r}=Be(e),o=e.origin??t,s=n*o[0],i=r*o[1];return{x:e.position.x-s,y:e.position.y-i}},hv=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const s=typeof o=="string";let i=!t.nodeLookup&&!s?o:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(o):zo(o)?o:t.nodeLookup.get(o.id));const a=i?nr(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return gr(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return mr(n)},gn=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=gr(n,nr(o)),r=!0)}),r?mr(n):{x:0,y:0,width:0,height:0}},Ho=(e,t,[n,r,o]=[0,0,1],s=!1,i=!1)=>{const a={...yn(t,[n,r,o]),width:t.width/o,height:t.height/o},c=[];for(const l of e.values()){const{measured:d,selectable:u=!0,hidden:f=!1}=l;if(i&&!u||f)continue;const g=d.width??l.width??l.initialWidth??null,h=d.height??l.height??l.initialHeight??null,m=nn(a,kt(l)),w=(g??0)*(h??0),v=s&&m>0;(!l.internals.handleBounds||v||m>=w||l.dragging)&&c.push(l)}return c},pv=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function gv(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function mv({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=gv(e,i),c=gn(a),l=Wo(c,t,n,(i==null?void 0:i.minZoom)??o,(i==null?void 0:i.maxZoom)??s,(i==null?void 0:i.padding)??.1);return await r.setViewport(l,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)}function Ru({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=i.origin??r;let u=i.extent||o;if(i.extent==="parent"&&!i.expandParent)if(!a)s==null||s("005",Oe.error005());else{const g=a.measured.width,h=a.measured.height;g&&h&&(u=[[c,l],[c+g,l+h]])}else a&&Pt(i.extent)&&(u=[[i.extent[0][0]+c,i.extent[0][1]+l],[i.extent[1][0]+c,i.extent[1][1]+l]]);const f=Pt(u)?at(t,u,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&(s==null||s("015",Oe.error015())),{position:{x:f.x-c+(i.measured.width??0)*d[0],y:f.y-l+(i.measured.height??0)*d[1]},positionAbsolute:f}}async function yv({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const s=new Set(e.map(f=>f.id)),i=[];for(const f of n){if(f.deletable===!1)continue;const g=s.has(f.id),h=!g&&f.parentId&&i.find(m=>m.id===f.parentId);(g||h)&&i.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),d=pv(i,c);for(const f of c)a.has(f.id)&&!d.find(h=>h.id===f.id)&&d.push(f);if(!o)return{edges:d,nodes:i};const u=await o({nodes:i,edges:d});return typeof u=="boolean"?u?{edges:d,nodes:i}:{edges:[],nodes:[]}:u}const Mt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),at=(e={x:0,y:0},t,n)=>({x:Mt(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Mt(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Tu(e,t,n){const{width:r,height:o}=Be(n),{x:s,y:i}=n.internals.positionAbsolute;return at(e,[[s,i],[s+r,i+o]],t)}const Ks=(e,t,n)=>e<t?Mt(Math.abs(e-t),1,t)/t:e>n?-Mt(Math.abs(e-n),1,t)/t:0,Du=(e,t,n=15,r=40)=>{const o=Ks(e.x,r,t.width-r)*n,s=Ks(e.y,r,t.height-r)*n;return[o,s]},gr=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),lo=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),mr=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),kt=(e,t=[0,0])=>{var o,s;const{x:n,y:r}=zo(e)?e.internals.positionAbsolute:pn(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},nr=(e,t=[0,0])=>{var o,s;const{x:n,y:r}=zo(e)?e.internals.positionAbsolute:pn(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},ju=(e,t)=>mr(gr(lo(e),lo(t))),nn=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Zs=e=>Me(e.width)&&Me(e.height)&&Me(e.x)&&Me(e.y),Me=e=>!isNaN(e)&&isFinite(e),xv=(e,t)=>{},mn=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),yn=({x:e,y:t},[n,r,o],s=!1,i=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return s?mn(a,i):a},rr=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function mt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function wv(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=mt(e,n),o=mt(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=mt(e.top??e.y??0,n),o=mt(e.bottom??e.y??0,n),s=mt(e.left??e.x??0,t),i=mt(e.right??e.x??0,t);return{top:r,right:i,bottom:o,left:s,x:s+i,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vv(e,t,n,r,o,s){const{x:i,y:a}=rr(e,[t,n,r]),{x:c,y:l}=rr({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=o-c,u=s-l;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}const Wo=(e,t,n,r,o,s)=>{const i=wv(s,t,n),a=(t-i.x)/e.width,c=(n-i.y)/e.height,l=Math.min(a,c),d=Mt(l,r,o),u=e.x+e.width/2,f=e.y+e.height/2,g=t/2-u*d,h=n/2-f*d,m=vv(e,g,h,d,t,n),w={left:Math.min(m.left-i.left,0),top:Math.min(m.top-i.top,0),right:Math.min(m.right-i.right,0),bottom:Math.min(m.bottom-i.bottom,0)};return{x:g-w.left+w.right,y:h-w.top+w.bottom,zoom:d}},rn=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Pt(e){return e!=null&&e!=="parent"}function Be(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function Ou(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function $u(e,t={width:0,height:0},n,r,o){const s={...e},i=r.get(n);if(i){const a=i.origin||o;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function Qs(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function bv(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function Ev(e){return{...ku,...e||{}}}function Yt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:s,y:i}=ke(e),a=yn({x:s-((o==null?void 0:o.left)??0),y:i-((o==null?void 0:o.top)??0)},r),{x:c,y:l}=n?mn(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Bo=e=>({width:e.offsetWidth,height:e.offsetHeight}),Lu=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Sv=["INPUT","SELECT","TEXTAREA"];function Fu(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Sv.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const zu=e=>"clientX"in e,ke=(e,t)=>{var s,i;const n=zu(e),r=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,o=n?e.clientY:(i=e.touches)==null?void 0:i[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},Js=(e,t,n,r,o)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:o,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Bo(i)}})};function Hu({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:s,targetControlX:i,targetControlY:a}){const c=e*.125+o*.375+i*.375+n*.125,l=t*.125+s*.375+a*.375+r*.125,d=Math.abs(c-e),u=Math.abs(l-t);return[c,l,d,u]}function Rn(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ei({pos:e,x1:t,y1:n,x2:r,y2:o,c:s}){switch(e){case Y.Left:return[t-Rn(t-r,s),n];case Y.Right:return[t+Rn(r-t,s),n];case Y.Top:return[t,n-Rn(n-o,s)];case Y.Bottom:return[t,n+Rn(o-n,s)]}}function Wu({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:r,targetY:o,targetPosition:s=Y.Top,curvature:i=.25}){const[a,c]=ei({pos:n,x1:e,y1:t,x2:r,y2:o,c:i}),[l,d]=ei({pos:s,x1:r,y1:o,x2:e,y2:t,c:i}),[u,f,g,h]=Hu({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${e},${t} C${a},${c} ${l},${d} ${r},${o}`,u,f,g,h]}function Bu({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,s=n<e?n+o:n-o,i=Math.abs(r-t)/2,a=r<t?r+i:r-i;return[s,a,o,i]}function _v({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:s="basic"}){if(s==="manual")return r;const i=o&&n?r+1e3:r,a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return i+a}function Cv({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const s=gr(nr(e),nr(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return nn(i,mr(s))>0}const Nv=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Mv=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),kv=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||Nv;let o;return Au(e)?o={...e}:o={...e,id:r(e)},Mv(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function Vu({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,s,i,a]=Bu({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,s,i,a]}const ti={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},Pv=({source:e,sourcePosition:t=Y.Bottom,target:n})=>t===Y.Left||t===Y.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},ni=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Iv({source:e,sourcePosition:t=Y.Bottom,target:n,targetPosition:r=Y.Top,center:o,offset:s,stepPosition:i}){const a=ti[t],c=ti[r],l={x:e.x+a.x*s,y:e.y+a.y*s},d={x:n.x+c.x*s,y:n.y+c.y*s},u=Pv({source:l,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",g=u[f];let h=[],m,w;const v={x:0,y:0},E={x:0,y:0},[,,y,b]=Bu({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(m=o.x??l.x+(d.x-l.x)*i,w=o.y??(l.y+d.y)/2):(m=o.x??(l.x+d.x)/2,w=o.y??l.y+(d.y-l.y)*i);const C=[{x:m,y:l.y},{x:m,y:d.y}],M=[{x:l.x,y:w},{x:d.x,y:w}];a[f]===g?h=f==="x"?C:M:h=f==="x"?M:C}else{const C=[{x:l.x,y:d.y}],M=[{x:d.x,y:l.y}];if(f==="x"?h=a.x===g?M:C:h=a.y===g?C:M,t===r){const D=Math.abs(e[f]-n[f]);if(D<=s){const F=Math.min(s-1,s-D);a[f]===g?v[f]=(l[f]>e[f]?-1:1)*F:E[f]=(d[f]>n[f]?-1:1)*F}}if(t!==r){const D=f==="x"?"y":"x",F=a[f]===c[D],_=l[D]>d[D],R=l[D]<d[D];(a[f]===1&&(!F&&_||F&&R)||a[f]!==1&&(!F&&R||F&&_))&&(h=f==="x"?C:M)}const P={x:l.x+v.x,y:l.y+v.y},T={x:d.x+E.x,y:d.y+E.y},z=Math.max(Math.abs(P.x-h[0].x),Math.abs(T.x-h[0].x)),A=Math.max(Math.abs(P.y-h[0].y),Math.abs(T.y-h[0].y));z>=A?(m=(P.x+T.x)/2,w=h[0].y):(m=h[0].x,w=(P.y+T.y)/2)}return[[e,{x:l.x+v.x,y:l.y+v.y},...h,{x:d.x+E.x,y:d.y+E.y},n],m,w,y,b]}function Av(e,t,n,r){const o=Math.min(ni(e,t)/2,ni(t,n)/2,r),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const l=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${s+o*l},${i}Q ${s},${i} ${s},${i+o*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${i+o*c}Q ${s},${i} ${s+o*a},${i}`}function fo({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:r,targetY:o,targetPosition:s=Y.Top,borderRadius:i=5,centerX:a,centerY:c,offset:l=20,stepPosition:d=.5}){const[u,f,g,h,m]=Iv({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:s,center:{x:a,y:c},offset:l,stepPosition:d});return[u.reduce((v,E,y)=>{let b="";return y>0&&y<u.length-1?b=Av(u[y-1],E,u[y+1],i):b=`${y===0?"M":"L"}${E.x} ${E.y}`,v+=b,v},""),f,g,h,m]}function ri(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Rv(e){var u;const{sourceNode:t,targetNode:n}=e;if(!ri(t)||!ri(n))return null;const r=t.internals.handleBounds||oi(t.handles),o=n.internals.handleBounds||oi(n.handles),s=si((r==null?void 0:r.source)??[],e.sourceHandle),i=si(e.connectionMode===Ct.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!s||!i)return(u=e.onError)==null||u.call(e,"008",Oe.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(s==null?void 0:s.position)||Y.Bottom,c=(i==null?void 0:i.position)||Y.Top,l=ct(t,s,a),d=ct(n,i,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function oi(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function ct(e,t,n=Y.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,s=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??Be(e);if(r)return{x:o+i/2,y:s+a/2};switch((t==null?void 0:t.position)??n){case Y.Top:return{x:o+i/2,y:s};case Y.Right:return{x:o+i,y:s+a/2};case Y.Bottom:return{x:o+i/2,y:s+a};case Y.Left:return{x:o,y:s+a/2}}}function si(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function ho(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Tv(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const l=ho(c,t);s.has(l)||(i.push({id:l,color:c.color||n,...c}),s.add(l))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const Yu=1e3,Dv=10,Vo={nodeOrigin:[0,0],nodeExtent:en,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},jv={...Vo,checkEquality:!0};function Yo(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Ov(e,t,n){const r=Yo(Vo,n);for(const o of e.values())if(o.parentId)Xo(o,e,t,r);else{const s=pn(o,r.nodeOrigin),i=Pt(o.extent)?o.extent:r.nodeExtent,a=at(s,i,Be(o));o.internals.positionAbsolute=a}}function $v(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const s={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(s):o.type==="target"&&r.push(s)}return{source:n,target:r}}function Go(e){return e==="manual"}function po(e,t,n,r={}){var l,d;const o=Yo(jv,r),s={i:0},i=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!Go(o.zIndexMode)?Yu:0;let c=e.length>0;t.clear(),n.clear();for(const u of e){let f=i.get(u.id);if(o.checkEquality&&u===(f==null?void 0:f.internals.userNode))t.set(u.id,f);else{const g=pn(u,o.nodeOrigin),h=Pt(u.extent)?u.extent:o.nodeExtent,m=at(g,h,Be(u));f={...o.defaults,...u,measured:{width:(l=u.measured)==null?void 0:l.width,height:(d=u.measured)==null?void 0:d.height},internals:{positionAbsolute:m,handleBounds:$v(u,f),z:Gu(u,a,o.zIndexMode),userNode:u}},t.set(u.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),u.parentId&&Xo(f,t,n,r,s)}return c}function Lv(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Xo(e,t,n,r,o){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:c}=Yo(Vo,r),l=e.parentId,d=t.get(l);if(!d){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}Lv(e,n),o&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++o.i,d.internals.z=d.internals.z+o.i*Dv),o&&d.internals.rootParentIndex!==void 0&&(o.i=d.internals.rootParentIndex);const u=s&&!Go(c)?Yu:0,{x:f,y:g,z:h}=Fv(e,d,i,a,u,c),{positionAbsolute:m}=e.internals,w=f!==m.x||g!==m.y;(w||h!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:f,y:g}:m,z:h}})}function Gu(e,t,n){const r=Me(e.zIndex)?e.zIndex:0;return Go(n)?r:r+(e.selected?t:0)}function Fv(e,t,n,r,o,s){const{x:i,y:a}=t.internals.positionAbsolute,c=Be(e),l=pn(e,n),d=Pt(e.extent)?at(l,e.extent,c):l;let u=at({x:i+d.x,y:a+d.y},r,c);e.extent==="parent"&&(u=Tu(u,c,t));const f=Gu(e,o,s),g=t.internals.z??0;return{x:u.x,y:u.y,z:g>=f?g+1:f}}function Uo(e,t,n,r=[0,0]){var i;const o=[],s=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const l=((i=s.get(a.parentId))==null?void 0:i.expandedRect)??kt(c),d=ju(l,a.rect);s.set(a.parentId,{expandedRect:d,parent:c})}return s.size>0&&s.forEach(({expandedRect:a,parent:c},l)=>{var y;const d=c.internals.positionAbsolute,u=Be(c),f=c.origin??r,g=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,h=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,m=Math.max(u.width,Math.round(a.width)),w=Math.max(u.height,Math.round(a.height)),v=(m-u.width)*f[0],E=(w-u.height)*f[1];(g>0||h>0||v||E)&&(o.push({id:l,type:"position",position:{x:c.position.x-g+v,y:c.position.y-h+E}}),(y=n.get(l))==null||y.forEach(b=>{e.some(S=>S.id===b.id)||o.push({id:b.id,type:"position",position:{x:b.position.x+g,y:b.position.y+h}})})),(u.width<a.width||u.height<a.height||g||h)&&o.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:m+(g?f[0]*g-v:0),height:w+(h?f[1]*h-E:0)}})}),o}function zv(e,t,n,r,o,s,i){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const g of e.values()){const h=t.get(g.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),c=!0;continue}const m=Bo(g.nodeElement),w=h.measured.width!==m.width||h.measured.height!==m.height;if(!!(m.width&&m.height&&(w||!h.internals.handleBounds||g.force))){const E=g.nodeElement.getBoundingClientRect(),y=Pt(h.extent)?h.extent:s;let{positionAbsolute:b}=h.internals;h.parentId&&h.extent==="parent"?b=Tu(b,m,t.get(h.parentId)):y&&(b=at(b,y,m));const S={...h,measured:m,internals:{...h.internals,positionAbsolute:b,handleBounds:{source:Js("source",g.nodeElement,E,u,h.id),target:Js("target",g.nodeElement,E,u,h.id)}}};t.set(h.id,S),h.parentId&&Xo(S,t,n,{nodeOrigin:o,zIndexMode:i}),c=!0,w&&(l.push({id:h.id,type:"dimensions",dimensions:m}),h.expandParent&&h.parentId&&f.push({id:h.id,parentId:h.parentId,rect:kt(S,o)}))}}if(f.length>0){const g=Uo(f,t,n,o);l.push(...g)}return{changes:l,updatedInternals:c}}async function Hv({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,s]],r),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function ii(e,t,n,r,o,s){let i=o;const a=r.get(i)||new Map;r.set(i,a.set(n,t)),i=`${o}-${e}`;const c=r.get(i)||new Map;if(r.set(i,c.set(n,t)),s){i=`${o}-${e}-${s}`;const l=r.get(i)||new Map;r.set(i,l.set(n,t))}}function Xu(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:s,sourceHandle:i=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:s,sourceHandle:i,targetHandle:a},l=`${o}-${i}--${s}-${a}`,d=`${s}-${a}--${o}-${i}`;ii("source",c,d,e,o,i),ii("target",c,l,e,s,a),t.set(r.id,r)}}function Uu(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Uu(n,t):!1}function ai(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Wv(e,t,n,r){const o=new Map;for(const[s,i]of e)if((i.selected||i.id===r)&&(!i.parentId||!Uu(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&o.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.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 o}function Lr({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var i,a,c;const o=[];for(const[l,d]of t){const u=(i=n.get(l))==null?void 0:i.internals.userNode;u&&o.push({...u,position:d.position,dragging:r})}if(!e)return[o[0],o];const s=(a=n.get(e))==null?void 0:a.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:r}:o[0],o]}function Bv({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const s={x:n-o.distance.x,y:r-o.distance.y},i=mn(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Vv({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let s={x:null,y:null},i=0,a=new Map,c=!1,l={x:0,y:0},d=null,u=!1,f=null,g=!1,h=!1,m=null;function w({noDragClassName:E,handleSelector:y,domNode:b,isSelectable:S,nodeId:C,nodeClickDistance:M=0}){f=ye(b);function P({x:D,y:F}){const{nodeLookup:_,nodeExtent:R,snapGrid:k,snapToGrid:j,nodeOrigin:I,onNodeDrag:N,onSelectionDrag:O,onError:$,updateNodePositions:L}=t();s={x:D,y:F};let W=!1;const B=a.size>1,X=B&&R?lo(gn(a)):null,U=B&&j?Bv({dragItems:a,snapGrid:k,x:D,y:F}):null;for(const[G,H]of a){if(!_.has(G))continue;let V={x:D-H.distance.x,y:F-H.distance.y};j&&(V=U?{x:Math.round(V.x+U.x),y:Math.round(V.y+U.y)}:mn(V,k));let Q=null;if(B&&R&&!H.extent&&X){const{positionAbsolute:q}=H.internals,ee=q.x-X.x+R[0][0],oe=q.x+H.measured.width-X.x2+R[1][0],te=q.y-X.y+R[0][1],le=q.y+H.measured.height-X.y2+R[1][1];Q=[[ee,te],[oe,le]]}const{position:Z,positionAbsolute:K}=Ru({nodeId:G,nextPosition:V,nodeLookup:_,nodeExtent:Q||R,nodeOrigin:I,onError:$});W=W||H.position.x!==Z.x||H.position.y!==Z.y,H.position=Z,H.internals.positionAbsolute=K}if(h=h||W,!!W&&(L(a,!0),m&&(r||N||!C&&O))){const[G,H]=Lr({nodeId:C,dragItems:a,nodeLookup:_});r==null||r(m,a,G,H),N==null||N(m,G,H),C||O==null||O(m,H)}}async function T(){if(!d)return;const{transform:D,panBy:F,autoPanSpeed:_,autoPanOnNodeDrag:R}=t();if(!R){c=!1,cancelAnimationFrame(i);return}const[k,j]=Du(l,d,_);(k!==0||j!==0)&&(s.x=(s.x??0)-k/D[2],s.y=(s.y??0)-j/D[2],await F({x:k,y:j})&&P(s)),i=requestAnimationFrame(T)}function z(D){var B;const{nodeLookup:F,multiSelectionActive:_,nodesDraggable:R,transform:k,snapGrid:j,snapToGrid:I,selectNodesOnDrag:N,onNodeDragStart:O,onSelectionDragStart:$,unselectNodesAndEdges:L}=t();u=!0,(!N||!S)&&!_&&C&&((B=F.get(C))!=null&&B.selected||L()),S&&N&&C&&(e==null||e(C));const W=Yt(D.sourceEvent,{transform:k,snapGrid:j,snapToGrid:I,containerBounds:d});if(s=W,a=Wv(F,R,W,C),a.size>0&&(n||O||!C&&$)){const[X,U]=Lr({nodeId:C,dragItems:a,nodeLookup:F});n==null||n(D.sourceEvent,a,X,U),O==null||O(D.sourceEvent,X,U),C||$==null||$(D.sourceEvent,U)}}const A=du().clickDistance(M).on("start",D=>{const{domNode:F,nodeDragThreshold:_,transform:R,snapGrid:k,snapToGrid:j}=t();d=(F==null?void 0:F.getBoundingClientRect())||null,g=!1,h=!1,m=D.sourceEvent,_===0&&z(D),s=Yt(D.sourceEvent,{transform:R,snapGrid:k,snapToGrid:j,containerBounds:d}),l=ke(D.sourceEvent,d)}).on("drag",D=>{const{autoPanOnNodeDrag:F,transform:_,snapGrid:R,snapToGrid:k,nodeDragThreshold:j,nodeLookup:I}=t(),N=Yt(D.sourceEvent,{transform:_,snapGrid:R,snapToGrid:k,containerBounds:d});if(m=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||C&&!I.has(C))&&(g=!0),!g){if(!c&&F&&u&&(c=!0,T()),!u){const O=ke(D.sourceEvent,d),$=O.x-l.x,L=O.y-l.y;Math.sqrt($*$+L*L)>j&&z(D)}(s.x!==N.xSnapped||s.y!==N.ySnapped)&&a&&u&&(l=ke(D.sourceEvent,d),P(N))}}).on("end",D=>{if(!(!u||g)&&(c=!1,u=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:F,updateNodePositions:_,onNodeDragStop:R,onSelectionDragStop:k}=t();if(h&&(_(a,!1),h=!1),o||R||!C&&k){const[j,I]=Lr({nodeId:C,dragItems:a,nodeLookup:F,dragging:!1});o==null||o(D.sourceEvent,a,j,I),R==null||R(D.sourceEvent,j,I),C||k==null||k(D.sourceEvent,I)}}}).filter(D=>{const F=D.target;return!D.button&&(!E||!ai(F,`.${E}`,b))&&(!y||ai(F,y,b))});f.call(A)}function v(){f==null||f.on(".drag",null)}return{update:w,destroy:v}}function Yv(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())nn(o,kt(s))>0&&r.push(s);return r}const Gv=250;function Xv(e,t,n,r){var a,c;let o=[],s=1/0;const i=Yv(e,n,t+Gv);for(const l of i){const d=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of d){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:f,y:g}=ct(l,u,u.position,!0),h=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(g-e.y,2));h>t||(h<s?(o=[{...u,x:f,y:g}],s=h):h===s&&o.push({...u,x:f,y:g}))}}if(!o.length)return null;if(o.length>1){const l=r.type==="source"?"target":"source";return o.find(d=>d.type===l)??o[0]}return o[0]}function qu(e,t,n,r,o,s=!1){var l,d,u;const i=r.get(e);if(!i)return null;const a=o==="strict"?(l=i.internals.handleBounds)==null?void 0:l[t]:[...((d=i.internals.handleBounds)==null?void 0:d.source)??[],...((u=i.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&s?{...c,...ct(i,c,c.position,!0)}:c}function Ku(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Uv(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Zu=()=>!0;function qv(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:g,onConnectStart:h,onConnect:m,onConnectEnd:w,isValidConnection:v=Zu,onReconnectEnd:E,updateConnection:y,getTransform:b,getFromHandle:S,autoPanSpeed:C,dragThreshold:M=1,handleDomNode:P}){const T=Lu(e.target);let z=0,A;const{x:D,y:F}=ke(e),_=Ku(s,P),R=a==null?void 0:a.getBoundingClientRect();let k=!1;if(!R||!_)return;const j=qu(o,_,r,c,t);if(!j)return;let I=ke(e,R),N=!1,O=null,$=!1,L=null;function W(){if(!d||!R)return;const[Z,K]=Du(I,R,C);f({x:Z,y:K}),z=requestAnimationFrame(W)}const B={...j,nodeId:o,type:_,position:j.position},X=c.get(o);let G={inProgress:!0,isValid:null,from:ct(X,B,Y.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:X,to:I,toHandle:null,toPosition:qs[B.position],toNode:null,pointer:I};function H(){k=!0,y(G),h==null||h(e,{nodeId:o,handleId:r,handleType:_})}M===0&&H();function V(Z){if(!k){const{x:le,y:Ae}=ke(Z),pe=le-D,Ze=Ae-F;if(!(pe*pe+Ze*Ze>M*M))return;H()}if(!S()||!B){Q(Z);return}const K=b();I=ke(Z,R),A=Xv(yn(I,K,!1,[1,1]),n,c,B),N||(W(),N=!0);const q=Qu(Z,{handle:A,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:i?"target":"source",isValidConnection:v,doc:T,lib:l,flowId:u,nodeLookup:c});L=q.handleDomNode,O=q.connection,$=Uv(!!A,q.isValid);const ee=c.get(o),oe=ee?ct(ee,B,Y.Left,!0):G.from,te={...G,from:oe,isValid:$,to:q.toHandle&&$?rr({x:q.toHandle.x,y:q.toHandle.y},K):I,toHandle:q.toHandle,toPosition:$&&q.toHandle?q.toHandle.position:qs[B.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null,pointer:I};y(te),G=te}function Q(Z){if(!("touches"in Z&&Z.touches.length>0)){if(k){(A||L)&&O&&$&&(m==null||m(O));const{inProgress:K,...q}=G,ee={...q,toPosition:G.toHandle?G.toPosition:null};w==null||w(Z,ee),s&&(E==null||E(Z,ee))}g(),cancelAnimationFrame(z),N=!1,$=!1,O=null,L=null,T.removeEventListener("mousemove",V),T.removeEventListener("mouseup",Q),T.removeEventListener("touchmove",V),T.removeEventListener("touchend",Q)}}T.addEventListener("mousemove",V),T.addEventListener("mouseup",Q),T.addEventListener("touchmove",V),T.addEventListener("touchend",Q)}function Qu(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:s,doc:i,lib:a,flowId:c,isValidConnection:l=Zu,nodeLookup:d}){const u=s==="target",f=t?i.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:g,y:h}=ke(e),m=i.elementFromPoint(g,h),w=m!=null&&m.classList.contains(`${a}-flow__handle`)?m:f,v={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const E=Ku(void 0,w),y=w.getAttribute("data-nodeid"),b=w.getAttribute("data-handleid"),S=w.classList.contains("connectable"),C=w.classList.contains("connectableend");if(!y||!E)return v;const M={source:u?y:r,sourceHandle:u?b:o,target:u?r:y,targetHandle:u?o:b};v.connection=M;const T=S&&C&&(n===Ct.Strict?u&&E==="source"||!u&&E==="target":y!==r||b!==o);v.isValid=T&&l(M),v.toHandle=qu(y,E,b,d,n,!0)}return v}const go={onPointerDown:qv,isValid:Qu};function Kv({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=ye(e);function s({translateExtent:a,width:c,height:l,zoomStep:d=1,pannable:u=!0,zoomable:f=!0,inversePan:g=!1}){const h=y=>{if(y.sourceEvent.type!=="wheel"||!t)return;const b=n(),S=y.sourceEvent.ctrlKey&&rn()?10:1,C=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*d,M=b[2]*Math.pow(2,C*S);t.scaleTo(M)};let m=[0,0];const w=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(m=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},v=y=>{const b=n();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!t)return;const S=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],C=[S[0]-m[0],S[1]-m[1]];m=S;const M=r()*Math.max(b[2],Math.log(b[2]))*(g?-1:1),P={x:b[0]-C[0]*M,y:b[1]-C[1]*M},T=[[0,0],[c,l]];t.setViewportConstrained({x:P.x,y:P.y,zoom:b[2]},T,a)},E=Nu().on("start",w).on("zoom",u?v:null).on("zoom.wheel",f?h:null);o.call(E,{})}function i(){o.on("zoom",null)}return{update:s,destroy:i,pointer:Ee}}const yr=e=>({x:e.x,y:e.y,zoom:e.k}),Fr=({x:e,y:t,zoom:n})=>pr.translate(e,t).scale(n),yt=(e,t)=>e.target.closest(`.${t}`),Ju=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Zv=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,zr=(e,t=0,n=Zv,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},el=e=>{const t=e.ctrlKey&&rn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Qv({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(yt(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&i){const w=Ee(d),v=el(d),E=u*Math.pow(2,v);r.scaleTo(n,E,w,d);return}const f=d.deltaMode===1?20:1;let g=o===rt.Vertical?0:d.deltaX*f,h=o===rt.Horizontal?0:d.deltaY*f;!rn()&&d.shiftKey&&o!==rt.Vertical&&(g=d.deltaY*f,h=0),r.translateBy(n,-(g/u)*s,-(h/u)*s,{internal:!0});const m=yr(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,m),e.panScrollTimeout=setTimeout(()=>{l==null||l(d,m),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(d,m))}}function Jv({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const s=r.type==="wheel",i=!t&&s&&!r.ctrlKey,a=yt(r,e);if(r.ctrlKey&&s&&a&&r.preventDefault(),i||a)return null;r.preventDefault(),n.call(this,r,o)}}function eb({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,i,a;if((s=r.sourceEvent)!=null&&s.internal)return;const o=yr(r.transform);e.mouseButton=((i=r.sourceEvent)==null?void 0:i.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function tb({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return s=>{var i,a;e.usedRightMouseButton=!!(n&&Ju(t,e.mouseButton??0)),(i=s.sourceEvent)!=null&&i.sync||r([s.transform.x,s.transform.y,s.transform.k]),o&&!((a=s.sourceEvent)!=null&&a.internal)&&(o==null||o(s.sourceEvent,yr(s.transform)))}}function nb({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:s}){return i=>{var a;if(!((a=i.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,s&&Ju(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=yr(i.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(i.sourceEvent,c)},n?150:0)}}}function rb({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:d}){return u=>{var w;const f=e||t,g=n&&u.ctrlKey,h=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(yt(u,`${l}-flow__node`)||yt(u,`${l}-flow__edge`)))return!0;if(!r&&!f&&!o&&!s&&!n||i||d&&!h||yt(u,a)&&h||yt(u,c)&&(!h||o&&h&&!e)||!n&&u.ctrlKey&&h)return!1;if(!n&&u.type==="touchstart"&&((w=u.touches)==null?void 0:w.length)>1)return u.preventDefault(),!1;if(!f&&!o&&!g&&h||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const m=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||h)&&m}}function ob({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),u=Nu().scaleExtent([t,n]).translateExtent(r),f=ye(e).call(u);E({x:o.x,y:o.y,zoom:Mt(o.zoom,t,n)},[[0,0],[d.width,d.height]],r);const g=f.on("wheel.zoom"),h=f.on("dblclick.zoom");u.wheelDelta(el);function m(A,D){return f?new Promise(F=>{u==null||u.interpolate((D==null?void 0:D.interpolate)==="linear"?Vt:zn).transform(zr(f,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>F(!0)),A)}):Promise.resolve(!1)}function w({noWheelClassName:A,noPanClassName:D,onPaneContextMenu:F,userSelectionActive:_,panOnScroll:R,panOnDrag:k,panOnScrollMode:j,panOnScrollSpeed:I,preventScrolling:N,zoomOnPinch:O,zoomOnScroll:$,zoomOnDoubleClick:L,zoomActivationKeyPressed:W,lib:B,onTransformChange:X,connectionInProgress:U,paneClickDistance:G,selectionOnDrag:H}){_&&!l.isZoomingOrPanning&&v();const V=R&&!W&&!_;u.clickDistance(H?1/0:!Me(G)||G<0?0:G);const Q=V?Qv({zoomPanValues:l,noWheelClassName:A,d3Selection:f,d3Zoom:u,panOnScrollMode:j,panOnScrollSpeed:I,zoomOnPinch:O,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):Jv({noWheelClassName:A,preventScrolling:N,d3ZoomHandler:g});if(f.on("wheel.zoom",Q,{passive:!1}),!_){const K=eb({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:i});u.on("start",K);const q=tb({zoomPanValues:l,panOnDrag:k,onPaneContextMenu:!!F,onPanZoom:s,onTransformChange:X});u.on("zoom",q);const ee=nb({zoomPanValues:l,panOnDrag:k,panOnScroll:R,onPaneContextMenu:F,onPanZoomEnd:a,onDraggingChange:c});u.on("end",ee)}const Z=rb({zoomActivationKeyPressed:W,panOnDrag:k,zoomOnScroll:$,panOnScroll:R,zoomOnDoubleClick:L,zoomOnPinch:O,userSelectionActive:_,noPanClassName:D,noWheelClassName:A,lib:B,connectionInProgress:U});u.filter(Z),L?f.on("dblclick.zoom",h):f.on("dblclick.zoom",null)}function v(){u.on("zoom",null)}async function E(A,D,F){const _=Fr(A),R=u==null?void 0:u.constrain()(_,D,F);return R&&await m(R),new Promise(k=>k(R))}async function y(A,D){const F=Fr(A);return await m(F,D),new Promise(_=>_(F))}function b(A){if(f){const D=Fr(A),F=f.property("__zoom");(F.k!==A.zoom||F.x!==A.x||F.y!==A.y)&&(u==null||u.transform(f,D,null,{sync:!0}))}}function S(){const A=f?Cu(f.node()):{x:0,y:0,k:1};return{x:A.x,y:A.y,zoom:A.k}}function C(A,D){return f?new Promise(F=>{u==null||u.interpolate((D==null?void 0:D.interpolate)==="linear"?Vt:zn).scaleTo(zr(f,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>F(!0)),A)}):Promise.resolve(!1)}function M(A,D){return f?new Promise(F=>{u==null||u.interpolate((D==null?void 0:D.interpolate)==="linear"?Vt:zn).scaleBy(zr(f,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>F(!0)),A)}):Promise.resolve(!1)}function P(A){u==null||u.scaleExtent(A)}function T(A){u==null||u.translateExtent(A)}function z(A){const D=!Me(A)||A<0?0:A;u==null||u.clickDistance(D)}return{update:w,destroy:v,setViewport:y,setViewportConstrained:E,getViewport:S,scaleTo:C,scaleBy:M,setScaleExtent:P,setTranslateExtent:T,syncViewport:b,setClickDistance:z}}var It;(function(e){e.Line="line",e.Handle="handle"})(It||(It={}));function sb({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:s}){const i=e-t,a=n-r,c=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&o&&(c[0]=c[0]*-1),a&&s&&(c[1]=c[1]*-1),c}function ci(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Ye(e,t){return Math.max(0,t-e)}function Ge(e,t){return Math.max(0,e-t)}function Tn(e,t,n){return Math.max(0,t-e,e-n)}function ui(e,t){return e?!t:t}function ib(e,t,n,r,o,s,i,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:g,ySnapped:h}=n,{minWidth:m,maxWidth:w,minHeight:v,maxHeight:E}=r,{x:y,y:b,width:S,height:C,aspectRatio:M}=e;let P=Math.floor(d?g-e.pointerX:0),T=Math.floor(u?h-e.pointerY:0);const z=S+(c?-P:P),A=C+(l?-T:T),D=-s[0]*S,F=-s[1]*C;let _=Tn(z,m,w),R=Tn(A,v,E);if(i){let I=0,N=0;c&&P<0?I=Ye(y+P+D,i[0][0]):!c&&P>0&&(I=Ge(y+z+D,i[1][0])),l&&T<0?N=Ye(b+T+F,i[0][1]):!l&&T>0&&(N=Ge(b+A+F,i[1][1])),_=Math.max(_,I),R=Math.max(R,N)}if(a){let I=0,N=0;c&&P>0?I=Ge(y+P,a[0][0]):!c&&P<0&&(I=Ye(y+z,a[1][0])),l&&T>0?N=Ge(b+T,a[0][1]):!l&&T<0&&(N=Ye(b+A,a[1][1])),_=Math.max(_,I),R=Math.max(R,N)}if(o){if(d){const I=Tn(z/M,v,E)*M;if(_=Math.max(_,I),i){let N=0;!c&&!l||c&&!l&&f?N=Ge(b+F+z/M,i[1][1])*M:N=Ye(b+F+(c?P:-P)/M,i[0][1])*M,_=Math.max(_,N)}if(a){let N=0;!c&&!l||c&&!l&&f?N=Ye(b+z/M,a[1][1])*M:N=Ge(b+(c?P:-P)/M,a[0][1])*M,_=Math.max(_,N)}}if(u){const I=Tn(A*M,m,w)/M;if(R=Math.max(R,I),i){let N=0;!c&&!l||l&&!c&&f?N=Ge(y+A*M+D,i[1][0])/M:N=Ye(y+(l?T:-T)*M+D,i[0][0])/M,R=Math.max(R,N)}if(a){let N=0;!c&&!l||l&&!c&&f?N=Ye(y+A*M,a[1][0])/M:N=Ge(y+(l?T:-T)*M,a[0][0])/M,R=Math.max(R,N)}}}T=T+(T<0?R:-R),P=P+(P<0?_:-_),o&&(f?z>A*M?T=(ui(c,l)?-P:P)/M:P=(ui(c,l)?-T:T)*M:d?(T=P/M,l=c):(P=T*M,c=l));const k=c?y+P:y,j=l?b+T:b;return{width:S+(c?-P:P),height:C+(l?-T:T),x:s[0]*P*(c?-1:1)+k,y:s[1]*T*(l?-1:1)+j}}const tl={width:0,height:0,x:0,y:0},ab={...tl,pointerX:0,pointerY:0,aspectRatio:1};function cb(e){return[[0,0],[e.measured.width,e.measured.height]]}function ub(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,c=n[1]*i;return[[r-a,o-c],[r+s-a,o+i-c]]}function lb({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const s=ye(e);let i={controlDirection:ci("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:d,keepAspectRatio:u,resizeDirection:f,onResizeStart:g,onResize:h,onResizeEnd:m,shouldResize:w}){let v={...tl},E={...ab};i={boundaries:d,resizeDirection:f,keepAspectRatio:u,controlDirection:ci(l)};let y,b=null,S=[],C,M,P,T=!1;const z=du().on("start",A=>{const{nodeLookup:D,transform:F,snapGrid:_,snapToGrid:R,nodeOrigin:k,paneDomNode:j}=n();if(y=D.get(t),!y)return;b=(j==null?void 0:j.getBoundingClientRect())??null;const{xSnapped:I,ySnapped:N}=Yt(A.sourceEvent,{transform:F,snapGrid:_,snapToGrid:R,containerBounds:b});v={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},E={...v,pointerX:I,pointerY:N,aspectRatio:v.width/v.height},C=void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(C=D.get(y.parentId),M=C&&y.extent==="parent"?cb(C):void 0),S=[],P=void 0;for(const[O,$]of D)if($.parentId===t&&(S.push({id:O,position:{...$.position},extent:$.extent}),$.extent==="parent"||$.expandParent)){const L=ub($,y,$.origin??k);P?P=[[Math.min(L[0][0],P[0][0]),Math.min(L[0][1],P[0][1])],[Math.max(L[1][0],P[1][0]),Math.max(L[1][1],P[1][1])]]:P=L}g==null||g(A,{...v})}).on("drag",A=>{const{transform:D,snapGrid:F,snapToGrid:_,nodeOrigin:R}=n(),k=Yt(A.sourceEvent,{transform:D,snapGrid:F,snapToGrid:_,containerBounds:b}),j=[];if(!y)return;const{x:I,y:N,width:O,height:$}=v,L={},W=y.origin??R,{width:B,height:X,x:U,y:G}=ib(E,i.controlDirection,k,i.boundaries,i.keepAspectRatio,W,M,P),H=B!==O,V=X!==$,Q=U!==I&&H,Z=G!==N&&V;if(!Q&&!Z&&!H&&!V)return;if((Q||Z||W[0]===1||W[1]===1)&&(L.x=Q?U:v.x,L.y=Z?G:v.y,v.x=L.x,v.y=L.y,S.length>0)){const oe=U-I,te=G-N;for(const le of S)le.position={x:le.position.x-oe+W[0]*(B-O),y:le.position.y-te+W[1]*(X-$)},j.push(le)}if((H||V)&&(L.width=H&&(!i.resizeDirection||i.resizeDirection==="horizontal")?B:v.width,L.height=V&&(!i.resizeDirection||i.resizeDirection==="vertical")?X:v.height,v.width=L.width,v.height=L.height),C&&y.expandParent){const oe=W[0]*(L.width??0);L.x&&L.x<oe&&(v.x=oe,E.x=E.x-(L.x-oe));const te=W[1]*(L.height??0);L.y&&L.y<te&&(v.y=te,E.y=E.y-(L.y-te))}const K=sb({width:v.width,prevWidth:O,height:v.height,prevHeight:$,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),q={...v,direction:K};(w==null?void 0:w(A,q))!==!1&&(T=!0,h==null||h(A,q),r(L,j))}).on("end",A=>{T&&(m==null||m(A,{...v}),o==null||o({...v}),T=!1)});s.call(z)}function c(){s.on(".drag",null)}return{update:a,destroy:c}}var Hr={exports:{}},Wr={},Br={exports:{}},Vr={};/**
140
- * @license React
141
- * use-sync-external-store-shim.production.js
142
- *
143
- * Copyright (c) Meta Platforms, Inc. and affiliates.
144
- *
145
- * This source code is licensed under the MIT license found in the
146
- * LICENSE file in the root directory of this source tree.
147
- */var li;function db(){if(li)return Vr;li=1;var e=Vi();function t(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(u,f){var g=f(),h=r({inst:{value:g,getSnapshot:f}}),m=h[0].inst,w=h[1];return s(function(){m.value=g,m.getSnapshot=f,c(m)&&w({inst:m})},[u,g,f]),o(function(){return c(m)&&w({inst:m}),u(function(){c(m)&&w({inst:m})})},[u]),i(g),g}function c(u){var f=u.getSnapshot;u=u.value;try{var g=f();return!n(u,g)}catch{return!0}}function l(u,f){return f()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return Vr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Vr}var di;function fb(){return di||(di=1,Br.exports=db()),Br.exports}/**
148
- * @license React
149
- * use-sync-external-store-shim/with-selector.production.js
150
- *
151
- * Copyright (c) Meta Platforms, Inc. and affiliates.
152
- *
153
- * This source code is licensed under the MIT license found in the
154
- * LICENSE file in the root directory of this source tree.
155
- */var fi;function hb(){if(fi)return Wr;fi=1;var e=Vi(),t=fb();function n(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Wr.useSyncExternalStoreWithSelector=function(l,d,u,f,g){var h=s(null);if(h.current===null){var m={hasValue:!1,value:null};h.current=m}else m=h.current;h=a(function(){function v(C){if(!E){if(E=!0,y=C,C=f(C),g!==void 0&&m.hasValue){var M=m.value;if(g(M,C))return b=M}return b=C}if(M=b,r(y,C))return M;var P=f(C);return g!==void 0&&g(M,P)?(y=C,M):(y=C,b=P)}var E=!1,y,b,S=u===void 0?null:u;return[function(){return v(d())},S===null?void 0:function(){return v(S())}]},[d,u,f,g]);var w=o(l,h[0],h[1]);return i(function(){m.hasValue=!0,m.value=w},[w]),c(w),w},Wr}var hi;function pb(){return hi||(hi=1,Hr.exports=hb()),Hr.exports}var gb=pb();const mb=df(gb),yb={},pi=e=>{let t;const n=new Set,r=(d,u)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const g=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(h=>h(t,g))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(yb?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(r,o,c);return c},xb=e=>e?pi(e):pi,{useDebugValue:wb}=de,{useSyncExternalStoreWithSelector:vb}=mb,bb=e=>e;function nl(e,t=bb,n){const r=vb(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return wb(r),r}const gi=(e,t)=>{const n=xb(e),r=(o,s=t)=>nl(n,o,s);return Object.assign(r,n),r},Eb=(e,t)=>e?gi(e,t):gi;function se(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const xr=x.createContext(null),Sb=xr.Provider,rl=Oe.error001();function J(e,t){const n=x.useContext(xr);if(n===null)throw new Error(rl);return nl(n,e,t)}function ie(){const e=x.useContext(xr);if(e===null)throw new Error(rl);return x.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const mi={display:"none"},_b={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ol="react-flow__node-desc",sl="react-flow__edge-desc",Cb="react-flow__aria-live",Nb=e=>e.ariaLiveMessage,Mb=e=>e.ariaLabelConfig;function kb({rfId:e}){const t=J(Nb);return p.jsx("div",{id:`${Cb}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:_b,children:t})}function Pb({rfId:e,disableKeyboardA11y:t}){const n=J(Mb);return p.jsxs(p.Fragment,{children:[p.jsx("div",{id:`${ol}-${e}`,style:mi,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),p.jsx("div",{id:`${sl}-${e}`,style:mi,children:n["edge.a11yDescription.default"]}),!t&&p.jsx(kb,{rfId:e})]})}const xn=x.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},s)=>{const i=`${e}`.split("-");return p.jsx("div",{className:ce(["react-flow__panel",n,...i]),style:r,ref:s,...o,children:t})});xn.displayName="Panel";function Ib({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:p.jsx(xn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:p.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Ab=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Dn=e=>e.id;function Rb(e,t){return se(e.selectedNodes.map(Dn),t.selectedNodes.map(Dn))&&se(e.selectedEdges.map(Dn),t.selectedEdges.map(Dn))}function Tb({onSelectionChange:e}){const t=ie(),{selectedNodes:n,selectedEdges:r}=J(Ab,Rb);return x.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(s=>s(o))},[n,r,e]),null}const Db=e=>!!e.onSelectionChangeHandlers;function jb({onSelectionChange:e}){const t=J(Db);return e||t?p.jsx(Tb,{onSelectionChange:e}):null}const il=[0,0],Ob={x:0,y:0,zoom:1},$b=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],yi=[...$b,"rfId"],Lb=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),xi={translateExtent:en,nodeOrigin:il,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Fb(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:c}=J(Lb,se),l=ie();x.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=xi,a()}),[]);const d=x.useRef(xi);return x.useEffect(()=>{for(const u of yi){const f=e[u],g=d.current[u];f!==g&&(typeof e[u]>"u"||(u==="nodes"?t(f):u==="edges"?n(f):u==="minZoom"?r(f):u==="maxZoom"?o(f):u==="translateExtent"?s(f):u==="nodeExtent"?i(f):u==="ariaLabelConfig"?l.setState({ariaLabelConfig:Ev(f)}):u==="fitView"?l.setState({fitViewQueued:f}):u==="fitViewOptions"?l.setState({fitViewOptions:f}):l.setState({[u]:f})))}d.current=e},yi.map(u=>e[u])),null}function wi(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function zb(e){var r;const[t,n]=x.useState(e==="system"?null:e);return x.useEffect(()=>{if(e!=="system"){n(e);return}const o=wi(),s=()=>n(o!=null&&o.matches?"dark":"light");return s(),o==null||o.addEventListener("change",s),()=>{o==null||o.removeEventListener("change",s)}},[e]),t!==null?t:(r=wi())!=null&&r.matches?"dark":"light"}const vi=typeof document<"u"?document:null;function on(e=null,t={target:vi,actInsideInputWithModifier:!0}){const[n,r]=x.useState(!1),o=x.useRef(!1),s=x.useRef(new Set([])),[i,a]=x.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
156
- `).replace(`
157
-
158
- `,`
159
- +`).split(`
160
- `)),d=l.reduce((u,f)=>u.concat(...f),[]);return[l,d]}return[[],[]]},[e]);return x.useEffect(()=>{const c=(t==null?void 0:t.target)??vi,l=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=g=>{var w,v;if(o.current=g.ctrlKey||g.metaKey||g.shiftKey||g.altKey,(!o.current||o.current&&!l)&&Fu(g))return!1;const m=Ei(g.code,a);if(s.current.add(g[m]),bi(i,s.current,!1)){const E=((v=(w=g.composedPath)==null?void 0:w.call(g))==null?void 0:v[0])||g.target,y=(E==null?void 0:E.nodeName)==="BUTTON"||(E==null?void 0:E.nodeName)==="A";t.preventDefault!==!1&&(o.current||!y)&&g.preventDefault(),r(!0)}},u=g=>{const h=Ei(g.code,a);bi(i,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(g[h]),g.key==="Meta"&&s.current.clear(),o.current=!1},f=()=>{s.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",u),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",u),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function bi(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function Ei(e,t){return t.includes(e)?"code":"key"}const Hb=()=>{const e=ie();return x.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,s],panZoom:i}=e.getState();return i?(await i.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??s},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:s,maxZoom:i,panZoom:a}=e.getState(),c=Wo(t,r,o,s,i,(n==null?void 0:n.padding)??.1);return a?(await a.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:s,domNode:i}=e.getState();if(!i)return t;const{x:a,y:c}=i.getBoundingClientRect(),l={x:t.x-a,y:t.y-c},d=n.snapGrid??o,u=n.snapToGrid??s;return yn(l,r,u,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:s}=r.getBoundingClientRect(),i=rr(t,n);return{x:i.x+o,y:i.y+s}}}),[])};function al(e,t){const n=[],r=new Map,o=[];for(const s of e)if(s.type==="add"){o.push(s);continue}else if(s.type==="remove"||s.type==="replace")r.set(s.id,[s]);else{const i=r.get(s.id);i?i.push(s):r.set(s.id,[s])}for(const s of t){const i=r.get(s.id);if(!i){n.push(s);continue}if(i[0].type==="remove")continue;if(i[0].type==="replace"){n.push({...i[0].item});continue}const a={...s};for(const c of i)Wb(c,a);n.push(a)}return o.length&&o.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function Wb(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function cl(e,t){return al(e,t)}function ul(e,t){return al(e,t)}function Je(e,t){return{id:e,type:"select",selected:t}}function xt(e,t=new Set,n=!1){const r=[];for(const[o,s]of e){const i=t.has(o);!(s.selected===void 0&&!i)&&s.selected!==i&&(n&&(s.selected=i),r.push(Je(s.id,i)))}return r}function Si({items:e=[],lookup:t}){var o;const n=[],r=new Map(e.map(s=>[s.id,s]));for(const[s,i]of e.entries()){const a=t.get(i.id),c=((o=a==null?void 0:a.internals)==null?void 0:o.userNode)??a;c!==void 0&&c!==i&&n.push({id:i.id,item:i,type:"replace"}),c===void 0&&n.push({item:i,type:"add",index:s})}for(const[s]of t)r.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function _i(e){return{id:e.id,type:"remove"}}const Ci=e=>fv(e),Bb=e=>Au(e);function ll(e){return x.forwardRef(e)}const Vb=typeof window<"u"?x.useLayoutEffect:x.useEffect;function Ni(e){const[t,n]=x.useState(BigInt(0)),[r]=x.useState(()=>Yb(()=>n(o=>o+BigInt(1))));return Vb(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function Yb(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const dl=x.createContext(null);function Gb({children:e}){const t=ie(),n=x.useCallback(a=>{const{nodes:c=[],setNodes:l,hasDefaultNodes:d,onNodesChange:u,nodeLookup:f,fitViewQueued:g,onNodesChangeMiddlewareMap:h}=t.getState();let m=c;for(const v of a)m=typeof v=="function"?v(m):v;let w=Si({items:m,lookup:f});for(const v of h.values())w=v(w);d&&l(m),w.length>0?u==null||u(w):g&&window.requestAnimationFrame(()=>{const{fitViewQueued:v,nodes:E,setNodes:y}=t.getState();v&&y(E)})},[]),r=Ni(n),o=x.useCallback(a=>{const{edges:c=[],setEdges:l,hasDefaultEdges:d,onEdgesChange:u,edgeLookup:f}=t.getState();let g=c;for(const h of a)g=typeof h=="function"?h(g):h;d?l(g):u&&u(Si({items:g,lookup:f}))},[]),s=Ni(o),i=x.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return p.jsx(dl.Provider,{value:i,children:e})}function Xb(){const e=x.useContext(dl);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Ub=e=>!!e.panZoom;function qo(){const e=Hb(),t=ie(),n=Xb(),r=J(Ub),o=x.useMemo(()=>{const s=u=>t.getState().nodeLookup.get(u),i=u=>{n.nodeQueue.push(u)},a=u=>{n.edgeQueue.push(u)},c=u=>{var v,E;const{nodeLookup:f,nodeOrigin:g}=t.getState(),h=Ci(u)?u:f.get(u.id),m=h.parentId?$u(h.position,h.measured,h.parentId,f,g):h.position,w={...h,position:m,width:((v=h.measured)==null?void 0:v.width)??h.width,height:((E=h.measured)==null?void 0:E.height)??h.height};return kt(w)},l=(u,f,g={replace:!1})=>{i(h=>h.map(m=>{if(m.id===u){const w=typeof f=="function"?f(m):f;return g.replace&&Ci(w)?w:{...m,...w}}return m}))},d=(u,f,g={replace:!1})=>{a(h=>h.map(m=>{if(m.id===u){const w=typeof f=="function"?f(m):f;return g.replace&&Bb(w)?w:{...m,...w}}return m}))};return{getNodes:()=>t.getState().nodes.map(u=>({...u})),getNode:u=>{var f;return(f=s(u))==null?void 0:f.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:u=[]}=t.getState();return u.map(f=>({...f}))},getEdge:u=>t.getState().edgeLookup.get(u),setNodes:i,setEdges:a,addNodes:u=>{const f=Array.isArray(u)?u:[u];n.nodeQueue.push(g=>[...g,...f])},addEdges:u=>{const f=Array.isArray(u)?u:[u];n.edgeQueue.push(g=>[...g,...f])},toObject:()=>{const{nodes:u=[],edges:f=[],transform:g}=t.getState(),[h,m,w]=g;return{nodes:u.map(v=>({...v})),edges:f.map(v=>({...v})),viewport:{x:h,y:m,zoom:w}}},deleteElements:async({nodes:u=[],edges:f=[]})=>{const{nodes:g,edges:h,onNodesDelete:m,onEdgesDelete:w,triggerNodeChanges:v,triggerEdgeChanges:E,onDelete:y,onBeforeDelete:b}=t.getState(),{nodes:S,edges:C}=await yv({nodesToRemove:u,edgesToRemove:f,nodes:g,edges:h,onBeforeDelete:b}),M=C.length>0,P=S.length>0;if(M){const T=C.map(_i);w==null||w(C),E(T)}if(P){const T=S.map(_i);m==null||m(S),v(T)}return(P||M)&&(y==null||y({nodes:S,edges:C})),{deletedNodes:S,deletedEdges:C}},getIntersectingNodes:(u,f=!0,g)=>{const h=Zs(u),m=h?u:c(u),w=g!==void 0;return m?(g||t.getState().nodes).filter(v=>{const E=t.getState().nodeLookup.get(v.id);if(E&&!h&&(v.id===u.id||!E.internals.positionAbsolute))return!1;const y=kt(w?v:E),b=nn(y,m);return f&&b>0||b>=y.width*y.height||b>=m.width*m.height}):[]},isNodeIntersecting:(u,f,g=!0)=>{const m=Zs(u)?u:c(u);if(!m)return!1;const w=nn(m,f);return g&&w>0||w>=f.width*f.height||w>=m.width*m.height},updateNode:l,updateNodeData:(u,f,g={replace:!1})=>{l(u,h=>{const m=typeof f=="function"?f(h):f;return g.replace?{...h,data:m}:{...h,data:{...h.data,...m}}},g)},updateEdge:d,updateEdgeData:(u,f,g={replace:!1})=>{d(u,h=>{const m=typeof f=="function"?f(h):f;return g.replace?{...h,data:m}:{...h,data:{...h.data,...m}}},g)},getNodesBounds:u=>{const{nodeLookup:f,nodeOrigin:g}=t.getState();return hv(u,{nodeLookup:f,nodeOrigin:g})},getHandleConnections:({type:u,id:f,nodeId:g})=>{var h;return Array.from(((h=t.getState().connectionLookup.get(`${g}-${u}${f?`-${f}`:""}`))==null?void 0:h.values())??[])},getNodeConnections:({type:u,handleId:f,nodeId:g})=>{var h;return Array.from(((h=t.getState().connectionLookup.get(`${g}${u?f?`-${u}-${f}`:`-${u}`:""}`))==null?void 0:h.values())??[])},fitView:async u=>{const f=t.getState().fitViewResolver??bv();return t.setState({fitViewQueued:!0,fitViewOptions:u,fitViewResolver:f}),n.nodeQueue.push(g=>[...g]),f.promise}}},[]);return x.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const Mi=e=>e.selected,qb=typeof window<"u"?window:void 0;function Kb({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ie(),{deleteElements:r}=qo(),o=on(e,{actInsideInputWithModifier:!1}),s=on(t,{target:qb});x.useEffect(()=>{if(o){const{edges:i,nodes:a}=n.getState();r({nodes:a.filter(Mi),edges:i.filter(Mi)}),n.setState({nodesSelectionActive:!1})}},[o]),x.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function Zb(e){const t=ie();x.useEffect(()=>{const n=()=>{var o,s,i,a;if(!e.current||!(((s=(o=e.current).checkVisibility)==null?void 0:s.call(o))??!0))return!1;const r=Bo(e.current);(r.height===0||r.width===0)&&((a=(i=t.getState()).onError)==null||a.call(i,"004",Oe.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const wr={position:"absolute",width:"100%",height:"100%",top:0,left:0},Qb=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Jb({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:s=rt.Free,zoomOnDoubleClick:i=!0,panOnDrag:a=!0,defaultViewport:c,translateExtent:l,minZoom:d,maxZoom:u,zoomActivationKeyCode:f,preventScrolling:g=!0,children:h,noWheelClassName:m,noPanClassName:w,onViewportChange:v,isControlledViewport:E,paneClickDistance:y,selectionOnDrag:b}){const S=ie(),C=x.useRef(null),{userSelectionActive:M,lib:P,connectionInProgress:T}=J(Qb,se),z=on(f),A=x.useRef();Zb(C);const D=x.useCallback(F=>{v==null||v({x:F[0],y:F[1],zoom:F[2]}),E||S.setState({transform:F})},[v,E]);return x.useEffect(()=>{if(C.current){A.current=ob({domNode:C.current,minZoom:d,maxZoom:u,translateExtent:l,viewport:c,onDraggingChange:k=>S.setState(j=>j.paneDragging===k?j:{paneDragging:k}),onPanZoomStart:(k,j)=>{const{onViewportChangeStart:I,onMoveStart:N}=S.getState();N==null||N(k,j),I==null||I(j)},onPanZoom:(k,j)=>{const{onViewportChange:I,onMove:N}=S.getState();N==null||N(k,j),I==null||I(j)},onPanZoomEnd:(k,j)=>{const{onViewportChangeEnd:I,onMoveEnd:N}=S.getState();N==null||N(k,j),I==null||I(j)}});const{x:F,y:_,zoom:R}=A.current.getViewport();return S.setState({panZoom:A.current,transform:[F,_,R],domNode:C.current.closest(".react-flow")}),()=>{var k;(k=A.current)==null||k.destroy()}}},[]),x.useEffect(()=>{var F;(F=A.current)==null||F.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:s,zoomOnDoubleClick:i,panOnDrag:a,zoomActivationKeyPressed:z,preventScrolling:g,noPanClassName:w,userSelectionActive:M,noWheelClassName:m,lib:P,onTransformChange:D,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,o,s,i,a,z,g,w,M,m,P,D,T,b,y]),p.jsx("div",{className:"react-flow__renderer",ref:C,style:wr,children:h})}const e1=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function t1(){const{userSelectionActive:e,userSelectionRect:t}=J(e1,se);return e&&t?p.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Yr=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},n1=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function r1({isSelecting:e,selectionKeyPressed:t,selectionMode:n=tn.Full,panOnDrag:r,paneClickDistance:o,selectionOnDrag:s,onSelectionStart:i,onSelectionEnd:a,onPaneClick:c,onPaneContextMenu:l,onPaneScroll:d,onPaneMouseEnter:u,onPaneMouseMove:f,onPaneMouseLeave:g,children:h}){const m=ie(),{userSelectionActive:w,elementsSelectable:v,dragging:E,connectionInProgress:y}=J(n1,se),b=v&&(e||w),S=x.useRef(null),C=x.useRef(),M=x.useRef(new Set),P=x.useRef(new Set),T=x.useRef(!1),z=I=>{if(T.current||y){T.current=!1;return}c==null||c(I),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},A=I=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){I.preventDefault();return}l==null||l(I)},D=d?I=>d(I):void 0,F=I=>{T.current&&(I.stopPropagation(),T.current=!1)},_=I=>{var X,U;const{domNode:N}=m.getState();if(C.current=N==null?void 0:N.getBoundingClientRect(),!C.current)return;const O=I.target===S.current;if(!O&&!!I.target.closest(".nokey")||!e||!(s&&O||t)||I.button!==0||!I.isPrimary)return;(U=(X=I.target)==null?void 0:X.setPointerCapture)==null||U.call(X,I.pointerId),T.current=!1;const{x:W,y:B}=ke(I.nativeEvent,C.current);m.setState({userSelectionRect:{width:0,height:0,startX:W,startY:B,x:W,y:B}}),O||(I.stopPropagation(),I.preventDefault())},R=I=>{const{userSelectionRect:N,transform:O,nodeLookup:$,edgeLookup:L,connectionLookup:W,triggerNodeChanges:B,triggerEdgeChanges:X,defaultEdgeOptions:U,resetSelectedElements:G}=m.getState();if(!C.current||!N)return;const{x:H,y:V}=ke(I.nativeEvent,C.current),{startX:Q,startY:Z}=N;if(!T.current){const te=t?0:o;if(Math.hypot(H-Q,V-Z)<=te)return;G(),i==null||i(I)}T.current=!0;const K={startX:Q,startY:Z,x:H<Q?H:Q,y:V<Z?V:Z,width:Math.abs(H-Q),height:Math.abs(V-Z)},q=M.current,ee=P.current;M.current=new Set(Ho($,K,O,n===tn.Partial,!0).map(te=>te.id)),P.current=new Set;const oe=(U==null?void 0:U.selectable)??!0;for(const te of M.current){const le=W.get(te);if(le)for(const{edgeId:Ae}of le.values()){const pe=L.get(Ae);pe&&(pe.selectable??oe)&&P.current.add(Ae)}}if(!Qs(q,M.current)){const te=xt($,M.current,!0);B(te)}if(!Qs(ee,P.current)){const te=xt(L,P.current);X(te)}m.setState({userSelectionRect:K,userSelectionActive:!0,nodesSelectionActive:!1})},k=I=>{var N,O;I.button===0&&((O=(N=I.target)==null?void 0:N.releasePointerCapture)==null||O.call(N,I.pointerId),!w&&I.target===S.current&&m.getState().userSelectionRect&&(z==null||z(I)),m.setState({userSelectionActive:!1,userSelectionRect:null}),T.current&&(a==null||a(I),m.setState({nodesSelectionActive:M.current.size>0})))},j=r===!0||Array.isArray(r)&&r.includes(0);return p.jsxs("div",{className:ce(["react-flow__pane",{draggable:j,dragging:E,selection:e}]),onClick:b?void 0:Yr(z,S),onContextMenu:Yr(A,S),onWheel:Yr(D,S),onPointerEnter:b?void 0:u,onPointerMove:b?R:f,onPointerUp:b?k:void 0,onPointerDownCapture:b?_:void 0,onClickCapture:b?F:void 0,onPointerLeave:g,ref:S,style:wr,children:[h,p.jsx(t1,{})]})}function mo({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:s,multiSelectionActive:i,nodeLookup:a,onError:c}=t.getState(),l=a.get(e);if(!l){c==null||c("012",Oe.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&i)&&(s({nodes:[l],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):o([e])}function fl({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:s,nodeClickDistance:i}){const a=ie(),[c,l]=x.useState(!1),d=x.useRef();return x.useEffect(()=>{d.current=Vv({getStoreItems:()=>a.getState(),onNodeMouseDown:u=>{mo({id:u,store:a,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),x.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:s,nodeId:o,nodeClickDistance:i}),()=>{var u;(u=d.current)==null||u.destroy()}},[n,r,t,s,e,o,i]),c}const o1=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function hl(){const e=ie();return x.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:s,nodesDraggable:i,onError:a,updateNodePositions:c,nodeLookup:l,nodeOrigin:d}=e.getState(),u=new Map,f=o1(i),g=o?s[0]:5,h=o?s[1]:5,m=n.direction.x*g*n.factor,w=n.direction.y*h*n.factor;for(const[,v]of l){if(!f(v))continue;let E={x:v.internals.positionAbsolute.x+m,y:v.internals.positionAbsolute.y+w};o&&(E=mn(E,s));const{position:y,positionAbsolute:b}=Ru({nodeId:v.id,nextPosition:E,nodeLookup:l,nodeExtent:r,nodeOrigin:d,onError:a});v.position=y,v.internals.positionAbsolute=b,u.set(v.id,v)}c(u)},[])}const Ko=x.createContext(null),s1=Ko.Provider;Ko.Consumer;const pl=()=>x.useContext(Ko),i1=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),a1=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:s,connection:i}=r,{fromHandle:a,toHandle:c,isValid:l}=i,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,connectingTo:d,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:s===Ct.Strict?(a==null?void 0:a.type)!==n:e!==(a==null?void 0:a.nodeId)||t!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!o,valid:d&&l}};function c1({type:e="source",position:t=Y.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:c,className:l,onMouseDown:d,onTouchStart:u,...f},g){var R,k;const h=i||null,m=e==="target",w=ie(),v=pl(),{connectOnClick:E,noPanClassName:y,rfId:b}=J(i1,se),{connectingFrom:S,connectingTo:C,clickConnecting:M,isPossibleEndHandle:P,connectionInProcess:T,clickConnectionInProcess:z,valid:A}=J(a1(v,h,e),se);v||(k=(R=w.getState()).onError)==null||k.call(R,"010",Oe.error010());const D=j=>{const{defaultEdgeOptions:I,onConnect:N,hasDefaultEdges:O}=w.getState(),$={...I,...j};if(O){const{edges:L,setEdges:W}=w.getState();W(kv($,L))}N==null||N($),a==null||a($)},F=j=>{if(!v)return;const I=zu(j.nativeEvent);if(o&&(I&&j.button===0||!I)){const N=w.getState();go.onPointerDown(j.nativeEvent,{handleDomNode:j.currentTarget,autoPanOnConnect:N.autoPanOnConnect,connectionMode:N.connectionMode,connectionRadius:N.connectionRadius,domNode:N.domNode,nodeLookup:N.nodeLookup,lib:N.lib,isTarget:m,handleId:h,nodeId:v,flowId:N.rfId,panBy:N.panBy,cancelConnection:N.cancelConnection,onConnectStart:N.onConnectStart,onConnectEnd:(...O)=>{var $,L;return(L=($=w.getState()).onConnectEnd)==null?void 0:L.call($,...O)},updateConnection:N.updateConnection,onConnect:D,isValidConnection:n||((...O)=>{var $,L;return((L=($=w.getState()).isValidConnection)==null?void 0:L.call($,...O))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:N.autoPanSpeed,dragThreshold:N.connectionDragThreshold})}I?d==null||d(j):u==null||u(j)},_=j=>{const{onClickConnectStart:I,onClickConnectEnd:N,connectionClickStartHandle:O,connectionMode:$,isValidConnection:L,lib:W,rfId:B,nodeLookup:X,connection:U}=w.getState();if(!v||!O&&!o)return;if(!O){I==null||I(j.nativeEvent,{nodeId:v,handleId:h,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:v,type:e,id:h}});return}const G=Lu(j.target),H=n||L,{connection:V,isValid:Q}=go.isValid(j.nativeEvent,{handle:{nodeId:v,id:h,type:e},connectionMode:$,fromNodeId:O.nodeId,fromHandleId:O.id||null,fromType:O.type,isValidConnection:H,flowId:B,doc:G,lib:W,nodeLookup:X});Q&&V&&D(V);const Z=structuredClone(U);delete Z.inProgress,Z.toPosition=Z.toHandle?Z.toHandle.position:null,N==null||N(j,Z),w.setState({connectionClickStartHandle:null})};return p.jsx("div",{"data-handleid":h,"data-nodeid":v,"data-handlepos":t,"data-id":`${b}-${v}-${h}-${e}`,className:ce(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",y,l,{source:!m,target:m,connectable:r,connectablestart:o,connectableend:s,clickconnecting:M,connectingfrom:S,connectingto:C,valid:A,connectionindicator:r&&(!T||P)&&(T||z?s:o)}]),onMouseDown:F,onTouchStart:F,onClick:E?_:void 0,ref:g,...f,children:c})}const ve=x.memo(ll(c1));function u1({data:e,isConnectable:t,sourcePosition:n=Y.Bottom}){return p.jsxs(p.Fragment,{children:[e==null?void 0:e.label,p.jsx(ve,{type:"source",position:n,isConnectable:t})]})}function l1({data:e,isConnectable:t,targetPosition:n=Y.Top,sourcePosition:r=Y.Bottom}){return p.jsxs(p.Fragment,{children:[p.jsx(ve,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,p.jsx(ve,{type:"source",position:r,isConnectable:t})]})}function d1(){return null}function f1({data:e,isConnectable:t,targetPosition:n=Y.Top}){return p.jsxs(p.Fragment,{children:[p.jsx(ve,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const or={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},ki={input:u1,default:l1,output:f1,group:d1};function h1(e){var t,n,r,o;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((o=e.style)==null?void 0:o.height)}}const p1=e=>{const{width:t,height:n,x:r,y:o}=gn(e.nodeLookup,{filter:s=>!!s.selected});return{width:Me(t)?t:null,height:Me(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function g1({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=ie(),{width:o,height:s,transformString:i,userSelectionActive:a}=J(p1,se),c=hl(),l=x.useRef(null);x.useEffect(()=>{var g;n||(g=l.current)==null||g.focus({preventScroll:!0})},[n]);const d=!a&&o!==null&&s!==null;if(fl({nodeRef:l,disabled:!d}),!d)return null;const u=e?g=>{const h=r.getState().nodes.filter(m=>m.selected);e(g,h)}:void 0,f=g=>{Object.prototype.hasOwnProperty.call(or,g.key)&&(g.preventDefault(),c({direction:or[g.key],factor:g.shiftKey?4:1}))};return p.jsx("div",{className:ce(["react-flow__nodesselection","react-flow__container",t]),style:{transform:i},children:p.jsx("div",{ref:l,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:o,height:s}})})}const Pi=typeof window<"u"?window:void 0,m1=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function gl({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:i,paneClickDistance:a,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:d,selectionMode:u,onSelectionStart:f,onSelectionEnd:g,multiSelectionKeyCode:h,panActivationKeyCode:m,zoomActivationKeyCode:w,elementsSelectable:v,zoomOnScroll:E,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:M,panOnDrag:P,defaultViewport:T,translateExtent:z,minZoom:A,maxZoom:D,preventScrolling:F,onSelectionContextMenu:_,noWheelClassName:R,noPanClassName:k,disableKeyboardA11y:j,onViewportChange:I,isControlledViewport:N}){const{nodesSelectionActive:O,userSelectionActive:$}=J(m1,se),L=on(l,{target:Pi}),W=on(m,{target:Pi}),B=W||P,X=W||b,U=d&&B!==!0,G=L||$||U;return Kb({deleteKeyCode:c,multiSelectionKeyCode:h}),p.jsx(Jb,{onPaneContextMenu:s,elementsSelectable:v,zoomOnScroll:E,zoomOnPinch:y,panOnScroll:X,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:M,panOnDrag:!L&&B,defaultViewport:T,translateExtent:z,minZoom:A,maxZoom:D,zoomActivationKeyCode:w,preventScrolling:F,noWheelClassName:R,noPanClassName:k,onViewportChange:I,isControlledViewport:N,paneClickDistance:a,selectionOnDrag:U,children:p.jsxs(r1,{onSelectionStart:f,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:B,isSelecting:!!G,selectionMode:u,selectionKeyPressed:L,paneClickDistance:a,selectionOnDrag:U,children:[e,O&&p.jsx(g1,{onSelectionContextMenu:_,noPanClassName:k,disableKeyboardA11y:j})]})})}gl.displayName="FlowRenderer";const y1=x.memo(gl),x1=e=>t=>e?Ho(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function w1(e){return J(x.useCallback(x1(e),[e]),se)}const v1=e=>e.updateNodeInternals;function b1(){const e=J(v1),[t]=x.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const s=o.target.getAttribute("data-id");r.set(s,{id:s,nodeElement:o.target,force:!0})}),e(r)}));return x.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function E1({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=ie(),s=x.useRef(null),i=x.useRef(null),a=x.useRef(e.sourcePosition),c=x.useRef(e.targetPosition),l=x.useRef(t),d=n&&!!e.internals.handleBounds;return x.useEffect(()=>{s.current&&!e.hidden&&(!d||i.current!==s.current)&&(i.current&&(r==null||r.unobserve(i.current)),r==null||r.observe(s.current),i.current=s.current)},[d,e.hidden]),x.useEffect(()=>()=>{i.current&&(r==null||r.unobserve(i.current),i.current=null)},[]),x.useEffect(()=>{if(s.current){const u=l.current!==t,f=a.current!==e.sourcePosition,g=c.current!==e.targetPosition;(u||f||g)&&(l.current=t,a.current=e.sourcePosition,c.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function S1({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:s,onDoubleClick:i,nodesDraggable:a,elementsSelectable:c,nodesConnectable:l,nodesFocusable:d,resizeObserver:u,noDragClassName:f,noPanClassName:g,disableKeyboardA11y:h,rfId:m,nodeTypes:w,nodeClickDistance:v,onError:E}){const{node:y,internals:b,isParent:S}=J(H=>{const V=H.nodeLookup.get(e),Q=H.parentLookup.has(e);return{node:V,internals:V.internals,isParent:Q}},se);let C=y.type||"default",M=(w==null?void 0:w[C])||ki[C];M===void 0&&(E==null||E("003",Oe.error003(C)),C="default",M=(w==null?void 0:w.default)||ki.default);const P=!!(y.draggable||a&&typeof y.draggable>"u"),T=!!(y.selectable||c&&typeof y.selectable>"u"),z=!!(y.connectable||l&&typeof y.connectable>"u"),A=!!(y.focusable||d&&typeof y.focusable>"u"),D=ie(),F=Ou(y),_=E1({node:y,nodeType:C,hasDimensions:F,resizeObserver:u}),R=fl({nodeRef:_,disabled:y.hidden||!P,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:v}),k=hl();if(y.hidden)return null;const j=Be(y),I=h1(y),N=T||P||t||n||r||o,O=n?H=>n(H,{...b.userNode}):void 0,$=r?H=>r(H,{...b.userNode}):void 0,L=o?H=>o(H,{...b.userNode}):void 0,W=s?H=>s(H,{...b.userNode}):void 0,B=i?H=>i(H,{...b.userNode}):void 0,X=H=>{const{selectNodesOnDrag:V,nodeDragThreshold:Q}=D.getState();T&&(!V||!P||Q>0)&&mo({id:e,store:D,nodeRef:_}),t&&t(H,{...b.userNode})},U=H=>{if(!(Fu(H.nativeEvent)||h)){if(Mu.includes(H.key)&&T){const V=H.key==="Escape";mo({id:e,store:D,unselect:V,nodeRef:_})}else if(P&&y.selected&&Object.prototype.hasOwnProperty.call(or,H.key)){H.preventDefault();const{ariaLabelConfig:V}=D.getState();D.setState({ariaLiveMessage:V["node.a11yDescription.ariaLiveMessage"]({direction:H.key.replace("Arrow","").toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),k({direction:or[H.key],factor:H.shiftKey?4:1})}}},G=()=>{var ee;if(h||!((ee=_.current)!=null&&ee.matches(":focus-visible")))return;const{transform:H,width:V,height:Q,autoPanOnNodeFocus:Z,setCenter:K}=D.getState();if(!Z)return;Ho(new Map([[e,y]]),{x:0,y:0,width:V,height:Q},H,!0).length>0||K(y.position.x+j.width/2,y.position.y+j.height/2,{zoom:H[2]})};return p.jsx("div",{className:ce(["react-flow__node",`react-flow__node-${C}`,{[g]:P},y.className,{selected:y.selected,selectable:T,parent:S,draggable:P,dragging:R}]),ref:_,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:N?"all":"none",visibility:F?"visible":"hidden",...y.style,...I},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:O,onMouseMove:$,onMouseLeave:L,onContextMenu:W,onClick:X,onDoubleClick:B,onKeyDown:A?U:void 0,tabIndex:A?0:void 0,onFocus:A?G:void 0,role:y.ariaRole??(A?"group":void 0),"aria-roledescription":"node","aria-describedby":h?void 0:`${ol}-${m}`,"aria-label":y.ariaLabel,...y.domAttributes,children:p.jsx(s1,{value:e,children:p.jsx(M,{id:e,data:y.data,type:C,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:P,deletable:y.deletable??!0,isConnectable:z,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:R,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...j})})})}var _1=x.memo(S1);const C1=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function ml(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:s}=J(C1,se),i=w1(e.onlyRenderVisibleElements),a=b1();return p.jsx("div",{className:"react-flow__nodes",style:wr,children:i.map(c=>p.jsx(_1,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}ml.displayName="NodeRenderer";const N1=x.memo(ml);function M1(e){return J(x.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const s=n.nodeLookup.get(o.source),i=n.nodeLookup.get(o.target);s&&i&&Cv({sourceNode:s,targetNode:i,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),se)}const k1=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return p.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},P1=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return p.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Ii={[Nt.Arrow]:k1,[Nt.ArrowClosed]:P1};function I1(e){const t=ie();return x.useMemo(()=>{var o,s;return Object.prototype.hasOwnProperty.call(Ii,e)?Ii[e]:((s=(o=t.getState()).onError)==null||s.call(o,"009",Oe.error009(e)),null)},[e])}const A1=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const c=I1(t);return c?p.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0",children:p.jsx(c,{color:n,strokeWidth:i})}):null},yl=({defaultColor:e,rfId:t})=>{const n=J(s=>s.edges),r=J(s=>s.defaultEdgeOptions),o=x.useMemo(()=>Tv(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return o.length?p.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:p.jsx("defs",{children:o.map(s=>p.jsx(A1,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};yl.displayName="MarkerDefinitions";var R1=x.memo(yl);function xl({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:s,labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:c,className:l,...d}){const[u,f]=x.useState({x:1,y:0,width:0,height:0}),g=ce(["react-flow__edge-textwrapper",l]),h=x.useRef(null);return x.useEffect(()=>{if(h.current){const m=h.current.getBBox();f({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),n?p.jsxs("g",{transform:`translate(${e-u.width/2} ${t-u.height/2})`,className:g,visibility:u.width?"visible":"hidden",...d,children:[o&&p.jsx("rect",{width:u.width+2*i[0],x:-i[0],y:-i[1],height:u.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),p.jsx("text",{className:"react-flow__edge-text",y:u.height/2,dy:"0.3em",ref:h,style:r,children:n}),c]}):null}xl.displayName="EdgeText";const T1=x.memo(xl);function wn({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:c,interactionWidth:l=20,...d}){return p.jsxs(p.Fragment,{children:[p.jsx("path",{...d,d:e,fill:"none",className:ce(["react-flow__edge-path",d.className])}),l?p.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:l,className:"react-flow__edge-interaction"}):null,r&&Me(t)&&Me(n)?p.jsx(T1,{x:t,y:n,label:r,labelStyle:o,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:c}):null]})}function Ai({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===Y.Left||e===Y.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function wl({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:r,targetY:o,targetPosition:s=Y.Top}){const[i,a]=Ai({pos:n,x1:e,y1:t,x2:r,y2:o}),[c,l]=Ai({pos:s,x1:r,y1:o,x2:e,y2:t}),[d,u,f,g]=Hu({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:i,sourceControlY:a,targetControlX:c,targetControlY:l});return[`M${e},${t} C${i},${a} ${c},${l} ${r},${o}`,d,u,f,g]}function vl(e){return x.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,sourcePosition:i,targetPosition:a,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:g,style:h,markerEnd:m,markerStart:w,interactionWidth:v})=>{const[E,y,b]=wl({sourceX:n,sourceY:r,sourcePosition:i,targetX:o,targetY:s,targetPosition:a}),S=e.isInternal?void 0:t;return p.jsx(wn,{id:S,path:E,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:g,style:h,markerEnd:m,markerStart:w,interactionWidth:v})})}const D1=vl({isInternal:!1}),bl=vl({isInternal:!0});D1.displayName="SimpleBezierEdge";bl.displayName="SimpleBezierEdgeInternal";function El(e){return x.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,sourcePosition:g=Y.Bottom,targetPosition:h=Y.Top,markerEnd:m,markerStart:w,pathOptions:v,interactionWidth:E})=>{const[y,b,S]=fo({sourceX:n,sourceY:r,sourcePosition:g,targetX:o,targetY:s,targetPosition:h,borderRadius:v==null?void 0:v.borderRadius,offset:v==null?void 0:v.offset,stepPosition:v==null?void 0:v.stepPosition}),C=e.isInternal?void 0:t;return p.jsx(wn,{id:C,path:y,labelX:b,labelY:S,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:m,markerStart:w,interactionWidth:E})})}const Sl=El({isInternal:!1}),_l=El({isInternal:!0});Sl.displayName="SmoothStepEdge";_l.displayName="SmoothStepEdgeInternal";function Cl(e){return x.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return p.jsx(Sl,{...n,id:r,pathOptions:x.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const j1=Cl({isInternal:!1}),Nl=Cl({isInternal:!0});j1.displayName="StepEdge";Nl.displayName="StepEdgeInternal";function Ml(e){return x.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:g,markerStart:h,interactionWidth:m})=>{const[w,v,E]=Vu({sourceX:n,sourceY:r,targetX:o,targetY:s}),y=e.isInternal?void 0:t;return p.jsx(wn,{id:y,path:w,labelX:v,labelY:E,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:g,markerStart:h,interactionWidth:m})})}const O1=Ml({isInternal:!1}),kl=Ml({isInternal:!0});O1.displayName="StraightEdge";kl.displayName="StraightEdgeInternal";function Pl(e){return x.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,sourcePosition:i=Y.Bottom,targetPosition:a=Y.Top,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:g,style:h,markerEnd:m,markerStart:w,pathOptions:v,interactionWidth:E})=>{const[y,b,S]=Wu({sourceX:n,sourceY:r,sourcePosition:i,targetX:o,targetY:s,targetPosition:a,curvature:v==null?void 0:v.curvature}),C=e.isInternal?void 0:t;return p.jsx(wn,{id:C,path:y,labelX:b,labelY:S,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:g,style:h,markerEnd:m,markerStart:w,interactionWidth:E})})}const $1=Pl({isInternal:!1}),Il=Pl({isInternal:!0});$1.displayName="BezierEdge";Il.displayName="BezierEdgeInternal";const Ri={default:Il,straight:kl,step:Nl,smoothstep:_l,simplebezier:bl},Ti={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},L1=(e,t,n)=>n===Y.Left?e-t:n===Y.Right?e+t:e,F1=(e,t,n)=>n===Y.Top?e-t:n===Y.Bottom?e+t:e,Di="react-flow__edgeupdater";function ji({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:s,onMouseOut:i,type:a}){return p.jsx("circle",{onMouseDown:o,onMouseEnter:s,onMouseOut:i,className:ce([Di,`${Di}-${a}`]),cx:L1(t,r,e),cy:F1(n,r,e),r,stroke:"transparent",fill:"transparent"})}function z1({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:s,targetY:i,sourcePosition:a,targetPosition:c,onReconnect:l,onReconnectStart:d,onReconnectEnd:u,setReconnecting:f,setUpdateHover:g}){const h=ie(),m=(b,S)=>{if(b.button!==0)return;const{autoPanOnConnect:C,domNode:M,connectionMode:P,connectionRadius:T,lib:z,onConnectStart:A,cancelConnection:D,nodeLookup:F,rfId:_,panBy:R,updateConnection:k}=h.getState(),j=S.type==="target",I=($,L)=>{f(!1),u==null||u($,n,S.type,L)},N=$=>l==null?void 0:l(n,$),O=($,L)=>{f(!0),d==null||d(b,n,S.type),A==null||A($,L)};go.onPointerDown(b.nativeEvent,{autoPanOnConnect:C,connectionMode:P,connectionRadius:T,domNode:M,handleId:S.id,nodeId:S.nodeId,nodeLookup:F,isTarget:j,edgeUpdaterType:S.type,lib:z,flowId:_,cancelConnection:D,panBy:R,isValidConnection:(...$)=>{var L,W;return((W=(L=h.getState()).isValidConnection)==null?void 0:W.call(L,...$))??!0},onConnect:N,onConnectStart:O,onConnectEnd:(...$)=>{var L,W;return(W=(L=h.getState()).onConnectEnd)==null?void 0:W.call(L,...$)},onReconnectEnd:I,updateConnection:k,getTransform:()=>h.getState().transform,getFromHandle:()=>h.getState().connection.fromHandle,dragThreshold:h.getState().connectionDragThreshold,handleDomNode:b.currentTarget})},w=b=>m(b,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),v=b=>m(b,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),E=()=>g(!0),y=()=>g(!1);return p.jsxs(p.Fragment,{children:[(e===!0||e==="source")&&p.jsx(ji,{position:a,centerX:r,centerY:o,radius:t,onMouseDown:w,onMouseEnter:E,onMouseOut:y,type:"source"}),(e===!0||e==="target")&&p.jsx(ji,{position:c,centerX:s,centerY:i,radius:t,onMouseDown:v,onMouseEnter:E,onMouseOut:y,type:"target"})]})}function H1({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:s,onContextMenu:i,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,reconnectRadius:d,onReconnect:u,onReconnectStart:f,onReconnectEnd:g,rfId:h,edgeTypes:m,noPanClassName:w,onError:v,disableKeyboardA11y:E}){let y=J(K=>K.edgeLookup.get(e));const b=J(K=>K.defaultEdgeOptions);y=b?{...b,...y}:y;let S=y.type||"default",C=(m==null?void 0:m[S])||Ri[S];C===void 0&&(v==null||v("011",Oe.error011(S)),S="default",C=(m==null?void 0:m.default)||Ri.default);const M=!!(y.focusable||t&&typeof y.focusable>"u"),P=typeof u<"u"&&(y.reconnectable||n&&typeof y.reconnectable>"u"),T=!!(y.selectable||r&&typeof y.selectable>"u"),z=x.useRef(null),[A,D]=x.useState(!1),[F,_]=x.useState(!1),R=ie(),{zIndex:k,sourceX:j,sourceY:I,targetX:N,targetY:O,sourcePosition:$,targetPosition:L}=J(x.useCallback(K=>{const q=K.nodeLookup.get(y.source),ee=K.nodeLookup.get(y.target);if(!q||!ee)return{zIndex:y.zIndex,...Ti};const oe=Rv({id:e,sourceNode:q,targetNode:ee,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:K.connectionMode,onError:v});return{zIndex:_v({selected:y.selected,zIndex:y.zIndex,sourceNode:q,targetNode:ee,elevateOnSelect:K.elevateEdgesOnSelect,zIndexMode:K.zIndexMode}),...oe||Ti}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),se),W=x.useMemo(()=>y.markerStart?`url('#${ho(y.markerStart,h)}')`:void 0,[y.markerStart,h]),B=x.useMemo(()=>y.markerEnd?`url('#${ho(y.markerEnd,h)}')`:void 0,[y.markerEnd,h]);if(y.hidden||j===null||I===null||N===null||O===null)return null;const X=K=>{var te;const{addSelectedEdges:q,unselectNodesAndEdges:ee,multiSelectionActive:oe}=R.getState();T&&(R.setState({nodesSelectionActive:!1}),y.selected&&oe?(ee({nodes:[],edges:[y]}),(te=z.current)==null||te.blur()):q([e])),o&&o(K,y)},U=s?K=>{s(K,{...y})}:void 0,G=i?K=>{i(K,{...y})}:void 0,H=a?K=>{a(K,{...y})}:void 0,V=c?K=>{c(K,{...y})}:void 0,Q=l?K=>{l(K,{...y})}:void 0,Z=K=>{var q;if(!E&&Mu.includes(K.key)&&T){const{unselectNodesAndEdges:ee,addSelectedEdges:oe}=R.getState();K.key==="Escape"?((q=z.current)==null||q.blur(),ee({edges:[y]})):oe([e])}};return p.jsx("svg",{style:{zIndex:k},children:p.jsxs("g",{className:ce(["react-flow__edge",`react-flow__edge-${S}`,y.className,w,{selected:y.selected,animated:y.animated,inactive:!T&&!o,updating:A,selectable:T}]),onClick:X,onDoubleClick:U,onContextMenu:G,onMouseEnter:H,onMouseMove:V,onMouseLeave:Q,onKeyDown:M?Z:void 0,tabIndex:M?0:void 0,role:y.ariaRole??(M?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":M?`${sl}-${h}`:void 0,ref:z,...y.domAttributes,children:[!F&&p.jsx(C,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:j,sourceY:I,targetX:N,targetY:O,sourcePosition:$,targetPosition:L,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:W,markerEnd:B,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),P&&p.jsx(z1,{edge:y,isReconnectable:P,reconnectRadius:d,onReconnect:u,onReconnectStart:f,onReconnectEnd:g,sourceX:j,sourceY:I,targetX:N,targetY:O,sourcePosition:$,targetPosition:L,setUpdateHover:D,setReconnecting:_})]})})}var W1=x.memo(H1);const B1=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Al({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:d,reconnectRadius:u,onEdgeDoubleClick:f,onReconnectStart:g,onReconnectEnd:h,disableKeyboardA11y:m}){const{edgesFocusable:w,edgesReconnectable:v,elementsSelectable:E,onError:y}=J(B1,se),b=M1(t);return p.jsxs("div",{className:"react-flow__edges",children:[p.jsx(R1,{defaultColor:e,rfId:n}),b.map(S=>p.jsx(W1,{id:S,edgesFocusable:w,edgesReconnectable:v,elementsSelectable:E,noPanClassName:o,onReconnect:s,onContextMenu:i,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,onClick:d,reconnectRadius:u,onDoubleClick:f,onReconnectStart:g,onReconnectEnd:h,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:m},S))]})}Al.displayName="EdgeRenderer";const V1=x.memo(Al),Y1=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function G1({children:e}){const t=J(Y1);return p.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function X1(e){const t=qo(),n=x.useRef(!1);x.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const U1=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function q1(e){const t=J(U1),n=ie();return x.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function K1(e){return e.connection.inProgress?{...e.connection,to:yn(e.connection.to,e.transform)}:{...e.connection}}function Z1(e){return K1}function Q1(e){const t=Z1();return J(t,se)}const J1=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function eE({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:s,height:i,isValid:a,inProgress:c}=J(J1,se);return!(s&&o&&c)?null:p.jsx("svg",{style:e,width:s,height:i,className:"react-flow__connectionline react-flow__container",children:p.jsx("g",{className:ce(["react-flow__connection",Iu(a)]),children:p.jsx(Rl,{style:t,type:n,CustomComponent:r,isValid:a})})})}const Rl=({style:e,type:t=qe.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:s,fromNode:i,fromHandle:a,fromPosition:c,to:l,toNode:d,toHandle:u,toPosition:f,pointer:g}=Q1();if(!o)return;if(n)return p.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:i,fromHandle:a,fromX:s.x,fromY:s.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Iu(r),toNode:d,toHandle:u,pointer:g});let h="";const m={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case qe.Bezier:[h]=Wu(m);break;case qe.SimpleBezier:[h]=wl(m);break;case qe.Step:[h]=fo({...m,borderRadius:0});break;case qe.SmoothStep:[h]=fo(m);break;default:[h]=Vu(m)}return p.jsx("path",{d:h,fill:"none",className:"react-flow__connection-path",style:e})};Rl.displayName="ConnectionLine";const tE={};function Oi(e=tE){x.useRef(e),ie(),x.useEffect(()=>{},[e])}function nE(){ie(),x.useRef(!1),x.useEffect(()=>{},[])}function Tl({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:s,onEdgeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:d,onSelectionContextMenu:u,onSelectionStart:f,onSelectionEnd:g,connectionLineType:h,connectionLineStyle:m,connectionLineComponent:w,connectionLineContainerStyle:v,selectionKeyCode:E,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:M,deleteKeyCode:P,onlyRenderVisibleElements:T,elementsSelectable:z,defaultViewport:A,translateExtent:D,minZoom:F,maxZoom:_,preventScrolling:R,defaultMarkerColor:k,zoomOnScroll:j,zoomOnPinch:I,panOnScroll:N,panOnScrollSpeed:O,panOnScrollMode:$,zoomOnDoubleClick:L,panOnDrag:W,onPaneClick:B,onPaneMouseEnter:X,onPaneMouseMove:U,onPaneMouseLeave:G,onPaneScroll:H,onPaneContextMenu:V,paneClickDistance:Q,nodeClickDistance:Z,onEdgeContextMenu:K,onEdgeMouseEnter:q,onEdgeMouseMove:ee,onEdgeMouseLeave:oe,reconnectRadius:te,onReconnect:le,onReconnectStart:Ae,onReconnectEnd:pe,noDragClassName:Ze,noWheelClassName:Tt,noPanClassName:Dt,disableKeyboardA11y:jt,nodeExtent:vr,rfId:vn,viewport:dt,onViewportChange:Ot}){return Oi(e),Oi(t),nE(),X1(n),q1(dt),p.jsx(y1,{onPaneClick:B,onPaneMouseEnter:X,onPaneMouseMove:U,onPaneMouseLeave:G,onPaneContextMenu:V,onPaneScroll:H,paneClickDistance:Q,deleteKeyCode:P,selectionKeyCode:E,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:g,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:M,elementsSelectable:z,zoomOnScroll:j,zoomOnPinch:I,zoomOnDoubleClick:L,panOnScroll:N,panOnScrollSpeed:O,panOnScrollMode:$,panOnDrag:W,defaultViewport:A,translateExtent:D,minZoom:F,maxZoom:_,onSelectionContextMenu:u,preventScrolling:R,noDragClassName:Ze,noWheelClassName:Tt,noPanClassName:Dt,disableKeyboardA11y:jt,onViewportChange:Ot,isControlledViewport:!!dt,children:p.jsxs(G1,{children:[p.jsx(V1,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:i,onReconnect:le,onReconnectStart:Ae,onReconnectEnd:pe,onlyRenderVisibleElements:T,onEdgeContextMenu:K,onEdgeMouseEnter:q,onEdgeMouseMove:ee,onEdgeMouseLeave:oe,reconnectRadius:te,defaultMarkerColor:k,noPanClassName:Dt,disableKeyboardA11y:jt,rfId:vn}),p.jsx(eE,{style:m,type:h,component:w,containerStyle:v}),p.jsx("div",{className:"react-flow__edgelabel-renderer"}),p.jsx(N1,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:d,nodeClickDistance:Z,onlyRenderVisibleElements:T,noPanClassName:Dt,noDragClassName:Ze,disableKeyboardA11y:jt,nodeExtent:vr,rfId:vn}),p.jsx("div",{className:"react-flow__viewport-portal"})]})})}Tl.displayName="GraphView";const rE=x.memo(Tl),$i=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:s,fitView:i,fitViewOptions:a,minZoom:c=.5,maxZoom:l=2,nodeOrigin:d,nodeExtent:u,zIndexMode:f="basic"}={})=>{const g=new Map,h=new Map,m=new Map,w=new Map,v=r??t??[],E=n??e??[],y=d??[0,0],b=u??en;Xu(m,w,v);const S=po(E,g,h,{nodeOrigin:y,nodeExtent:b,zIndexMode:f});let C=[0,0,1];if(i&&o&&s){const M=gn(g,{filter:A=>!!((A.width||A.initialWidth)&&(A.height||A.initialHeight))}),{x:P,y:T,zoom:z}=Wo(M,o,s,c,l,(a==null?void 0:a.padding)??.1);C=[P,T,z]}return{rfId:"1",width:o??0,height:s??0,transform:C,nodes:E,nodesInitialized:S,nodeLookup:g,parentLookup:h,edges:v,edgeLookup:w,connectionLookup:m,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:en,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ct.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:i??!1,fitViewOptions:a,fitViewResolver:null,connection:{...Pu},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:xv,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:ku,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},oE=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:s,fitView:i,fitViewOptions:a,minZoom:c,maxZoom:l,nodeOrigin:d,nodeExtent:u,zIndexMode:f})=>Eb((g,h)=>{async function m(){const{nodeLookup:w,panZoom:v,fitViewOptions:E,fitViewResolver:y,width:b,height:S,minZoom:C,maxZoom:M}=h();v&&(await mv({nodes:w,width:b,height:S,panZoom:v,minZoom:C,maxZoom:M},E),y==null||y.resolve(!0),g({fitViewResolver:null}))}return{...$i({nodes:e,edges:t,width:o,height:s,fitView:i,fitViewOptions:a,minZoom:c,maxZoom:l,nodeOrigin:d,nodeExtent:u,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:w=>{const{nodeLookup:v,parentLookup:E,nodeOrigin:y,elevateNodesOnSelect:b,fitViewQueued:S,zIndexMode:C}=h(),M=po(w,v,E,{nodeOrigin:y,nodeExtent:u,elevateNodesOnSelect:b,checkEquality:!0,zIndexMode:C});S&&M?(m(),g({nodes:w,nodesInitialized:M,fitViewQueued:!1,fitViewOptions:void 0})):g({nodes:w,nodesInitialized:M})},setEdges:w=>{const{connectionLookup:v,edgeLookup:E}=h();Xu(v,E,w),g({edges:w})},setDefaultNodesAndEdges:(w,v)=>{if(w){const{setNodes:E}=h();E(w),g({hasDefaultNodes:!0})}if(v){const{setEdges:E}=h();E(v),g({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:v,nodeLookup:E,parentLookup:y,domNode:b,nodeOrigin:S,nodeExtent:C,debug:M,fitViewQueued:P,zIndexMode:T}=h(),{changes:z,updatedInternals:A}=zv(w,E,y,b,S,C,T);A&&(Ov(E,y,{nodeOrigin:S,nodeExtent:C,zIndexMode:T}),P?(m(),g({fitViewQueued:!1,fitViewOptions:void 0})):g({}),(z==null?void 0:z.length)>0&&(M&&console.log("React Flow: trigger node changes",z),v==null||v(z)))},updateNodePositions:(w,v=!1)=>{const E=[];let y=[];const{nodeLookup:b,triggerNodeChanges:S,connection:C,updateConnection:M,onNodesChangeMiddlewareMap:P}=h();for(const[T,z]of w){const A=b.get(T),D=!!(A!=null&&A.expandParent&&(A!=null&&A.parentId)&&(z!=null&&z.position)),F={id:T,type:"position",position:D?{x:Math.max(0,z.position.x),y:Math.max(0,z.position.y)}:z.position,dragging:v};if(A&&C.inProgress&&C.fromNode.id===A.id){const _=ct(A,C.fromHandle,Y.Left,!0);M({...C,from:_})}D&&A.parentId&&E.push({id:T,parentId:A.parentId,rect:{...z.internals.positionAbsolute,width:z.measured.width??0,height:z.measured.height??0}}),y.push(F)}if(E.length>0){const{parentLookup:T,nodeOrigin:z}=h(),A=Uo(E,b,T,z);y.push(...A)}for(const T of P.values())y=T(y);S(y)},triggerNodeChanges:w=>{const{onNodesChange:v,setNodes:E,nodes:y,hasDefaultNodes:b,debug:S}=h();if(w!=null&&w.length){if(b){const C=cl(w,y);E(C)}S&&console.log("React Flow: trigger node changes",w),v==null||v(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:v,setEdges:E,edges:y,hasDefaultEdges:b,debug:S}=h();if(w!=null&&w.length){if(b){const C=ul(w,y);E(C)}S&&console.log("React Flow: trigger edge changes",w),v==null||v(w)}},addSelectedNodes:w=>{const{multiSelectionActive:v,edgeLookup:E,nodeLookup:y,triggerNodeChanges:b,triggerEdgeChanges:S}=h();if(v){const C=w.map(M=>Je(M,!0));b(C);return}b(xt(y,new Set([...w]),!0)),S(xt(E))},addSelectedEdges:w=>{const{multiSelectionActive:v,edgeLookup:E,nodeLookup:y,triggerNodeChanges:b,triggerEdgeChanges:S}=h();if(v){const C=w.map(M=>Je(M,!0));S(C);return}S(xt(E,new Set([...w]))),b(xt(y,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:v}={})=>{const{edges:E,nodes:y,nodeLookup:b,triggerNodeChanges:S,triggerEdgeChanges:C}=h(),M=w||y,P=v||E,T=[];for(const A of M){if(!A.selected)continue;const D=b.get(A.id);D&&(D.selected=!1),T.push(Je(A.id,!1))}const z=[];for(const A of P)A.selected&&z.push(Je(A.id,!1));S(T),C(z)},setMinZoom:w=>{const{panZoom:v,maxZoom:E}=h();v==null||v.setScaleExtent([w,E]),g({minZoom:w})},setMaxZoom:w=>{const{panZoom:v,minZoom:E}=h();v==null||v.setScaleExtent([E,w]),g({maxZoom:w})},setTranslateExtent:w=>{var v;(v=h().panZoom)==null||v.setTranslateExtent(w),g({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:v,triggerNodeChanges:E,triggerEdgeChanges:y,elementsSelectable:b}=h();if(!b)return;const S=v.reduce((M,P)=>P.selected?[...M,Je(P.id,!1)]:M,[]),C=w.reduce((M,P)=>P.selected?[...M,Je(P.id,!1)]:M,[]);E(S),y(C)},setNodeExtent:w=>{const{nodes:v,nodeLookup:E,parentLookup:y,nodeOrigin:b,elevateNodesOnSelect:S,nodeExtent:C,zIndexMode:M}=h();w[0][0]===C[0][0]&&w[0][1]===C[0][1]&&w[1][0]===C[1][0]&&w[1][1]===C[1][1]||(po(v,E,y,{nodeOrigin:b,nodeExtent:w,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:M}),g({nodeExtent:w}))},panBy:w=>{const{transform:v,width:E,height:y,panZoom:b,translateExtent:S}=h();return Hv({delta:w,panZoom:b,transform:v,translateExtent:S,width:E,height:y})},setCenter:async(w,v,E)=>{const{width:y,height:b,maxZoom:S,panZoom:C}=h();if(!C)return Promise.resolve(!1);const M=typeof(E==null?void 0:E.zoom)<"u"?E.zoom:S;return await C.setViewport({x:y/2-w*M,y:b/2-v*M,zoom:M},{duration:E==null?void 0:E.duration,ease:E==null?void 0:E.ease,interpolate:E==null?void 0:E.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{g({connection:{...Pu}})},updateConnection:w=>{g({connection:w})},reset:()=>g({...$i()})}},Object.is);function sE({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:s,initialMinZoom:i,initialMaxZoom:a,initialFitViewOptions:c,fitView:l,nodeOrigin:d,nodeExtent:u,zIndexMode:f,children:g}){const[h]=x.useState(()=>oE({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:s,fitView:l,minZoom:i,maxZoom:a,fitViewOptions:c,nodeOrigin:d,nodeExtent:u,zIndexMode:f}));return p.jsx(Sb,{value:h,children:p.jsx(Gb,{children:g})})}function iE({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:s,height:i,fitView:a,fitViewOptions:c,minZoom:l,maxZoom:d,nodeOrigin:u,nodeExtent:f,zIndexMode:g}){return x.useContext(xr)?p.jsx(p.Fragment,{children:e}):p.jsx(sE,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:s,initialHeight:i,fitView:a,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:d,nodeOrigin:u,nodeExtent:f,zIndexMode:g,children:e})}const aE={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function cE({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:s,edgeTypes:i,onNodeClick:a,onEdgeClick:c,onInit:l,onMove:d,onMoveStart:u,onMoveEnd:f,onConnect:g,onConnectStart:h,onConnectEnd:m,onClickConnectStart:w,onClickConnectEnd:v,onNodeMouseEnter:E,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:S,onNodeDoubleClick:C,onNodeDragStart:M,onNodeDrag:P,onNodeDragStop:T,onNodesDelete:z,onEdgesDelete:A,onDelete:D,onSelectionChange:F,onSelectionDragStart:_,onSelectionDrag:R,onSelectionDragStop:k,onSelectionContextMenu:j,onSelectionStart:I,onSelectionEnd:N,onBeforeDelete:O,connectionMode:$,connectionLineType:L=qe.Bezier,connectionLineStyle:W,connectionLineComponent:B,connectionLineContainerStyle:X,deleteKeyCode:U="Backspace",selectionKeyCode:G="Shift",selectionOnDrag:H=!1,selectionMode:V=tn.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:Z=rn()?"Meta":"Control",zoomActivationKeyCode:K=rn()?"Meta":"Control",snapToGrid:q,snapGrid:ee,onlyRenderVisibleElements:oe=!1,selectNodesOnDrag:te,nodesDraggable:le,autoPanOnNodeFocus:Ae,nodesConnectable:pe,nodesFocusable:Ze,nodeOrigin:Tt=il,edgesFocusable:Dt,edgesReconnectable:jt,elementsSelectable:vr=!0,defaultViewport:vn=Ob,minZoom:dt=.5,maxZoom:Ot=2,translateExtent:Qo=en,preventScrolling:Fl=!0,nodeExtent:br,defaultMarkerColor:zl="#b1b1b7",zoomOnScroll:Hl=!0,zoomOnPinch:Wl=!0,panOnScroll:Bl=!1,panOnScrollSpeed:Vl=.5,panOnScrollMode:Yl=rt.Free,zoomOnDoubleClick:Gl=!0,panOnDrag:Xl=!0,onPaneClick:Ul,onPaneMouseEnter:ql,onPaneMouseMove:Kl,onPaneMouseLeave:Zl,onPaneScroll:Ql,onPaneContextMenu:Jl,paneClickDistance:ed=1,nodeClickDistance:td=0,children:nd,onReconnect:rd,onReconnectStart:od,onReconnectEnd:sd,onEdgeContextMenu:id,onEdgeDoubleClick:ad,onEdgeMouseEnter:cd,onEdgeMouseMove:ud,onEdgeMouseLeave:ld,reconnectRadius:dd=10,onNodesChange:fd,onEdgesChange:hd,noDragClassName:pd="nodrag",noWheelClassName:gd="nowheel",noPanClassName:Jo="nopan",fitView:es,fitViewOptions:ts,connectOnClick:md,attributionPosition:yd,proOptions:xd,defaultEdgeOptions:wd,elevateNodesOnSelect:vd=!0,elevateEdgesOnSelect:bd=!1,disableKeyboardA11y:ns=!1,autoPanOnConnect:Ed,autoPanOnNodeDrag:Sd,autoPanSpeed:_d,connectionRadius:Cd,isValidConnection:Nd,onError:Md,style:kd,id:rs,nodeDragThreshold:Pd,connectionDragThreshold:Id,viewport:Ad,onViewportChange:Rd,width:Td,height:Dd,colorMode:jd="light",debug:Od,onScroll:bn,ariaLabelConfig:$d,zIndexMode:os="basic",...Ld},Fd){const Er=rs||"1",zd=zb(jd),Hd=x.useCallback(ss=>{ss.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),bn==null||bn(ss)},[bn]);return p.jsx("div",{"data-testid":"rf__wrapper",...Ld,onScroll:Hd,style:{...kd,...aE},ref:Fd,className:ce(["react-flow",o,zd]),id:rs,role:"application",children:p.jsxs(iE,{nodes:e,edges:t,width:Td,height:Dd,fitView:es,fitViewOptions:ts,minZoom:dt,maxZoom:Ot,nodeOrigin:Tt,nodeExtent:br,zIndexMode:os,children:[p.jsx(rE,{onInit:l,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:E,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:S,onNodeDoubleClick:C,nodeTypes:s,edgeTypes:i,connectionLineType:L,connectionLineStyle:W,connectionLineComponent:B,connectionLineContainerStyle:X,selectionKeyCode:G,selectionOnDrag:H,selectionMode:V,deleteKeyCode:U,multiSelectionKeyCode:Z,panActivationKeyCode:Q,zoomActivationKeyCode:K,onlyRenderVisibleElements:oe,defaultViewport:vn,translateExtent:Qo,minZoom:dt,maxZoom:Ot,preventScrolling:Fl,zoomOnScroll:Hl,zoomOnPinch:Wl,zoomOnDoubleClick:Gl,panOnScroll:Bl,panOnScrollSpeed:Vl,panOnScrollMode:Yl,panOnDrag:Xl,onPaneClick:Ul,onPaneMouseEnter:ql,onPaneMouseMove:Kl,onPaneMouseLeave:Zl,onPaneScroll:Ql,onPaneContextMenu:Jl,paneClickDistance:ed,nodeClickDistance:td,onSelectionContextMenu:j,onSelectionStart:I,onSelectionEnd:N,onReconnect:rd,onReconnectStart:od,onReconnectEnd:sd,onEdgeContextMenu:id,onEdgeDoubleClick:ad,onEdgeMouseEnter:cd,onEdgeMouseMove:ud,onEdgeMouseLeave:ld,reconnectRadius:dd,defaultMarkerColor:zl,noDragClassName:pd,noWheelClassName:gd,noPanClassName:Jo,rfId:Er,disableKeyboardA11y:ns,nodeExtent:br,viewport:Ad,onViewportChange:Rd}),p.jsx(Fb,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:g,onConnectStart:h,onConnectEnd:m,onClickConnectStart:w,onClickConnectEnd:v,nodesDraggable:le,autoPanOnNodeFocus:Ae,nodesConnectable:pe,nodesFocusable:Ze,edgesFocusable:Dt,edgesReconnectable:jt,elementsSelectable:vr,elevateNodesOnSelect:vd,elevateEdgesOnSelect:bd,minZoom:dt,maxZoom:Ot,nodeExtent:br,onNodesChange:fd,onEdgesChange:hd,snapToGrid:q,snapGrid:ee,connectionMode:$,translateExtent:Qo,connectOnClick:md,defaultEdgeOptions:wd,fitView:es,fitViewOptions:ts,onNodesDelete:z,onEdgesDelete:A,onDelete:D,onNodeDragStart:M,onNodeDrag:P,onNodeDragStop:T,onSelectionDrag:R,onSelectionDragStart:_,onSelectionDragStop:k,onMove:d,onMoveStart:u,onMoveEnd:f,noPanClassName:Jo,nodeOrigin:Tt,rfId:Er,autoPanOnConnect:Ed,autoPanOnNodeDrag:Sd,autoPanSpeed:_d,onError:Md,connectionRadius:Cd,isValidConnection:Nd,selectNodesOnDrag:te,nodeDragThreshold:Pd,connectionDragThreshold:Id,onBeforeDelete:O,debug:Od,ariaLabelConfig:$d,zIndexMode:os}),p.jsx(jb,{onSelectionChange:F}),nd,p.jsx(Ib,{proOptions:xd,position:yd}),p.jsx(Pb,{rfId:Er,disableKeyboardA11y:ns})]})})}var uE=ll(cE);const lE=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function dE({children:e}){const t=J(lE);return t?Bi.createPortal(e,t):null}function fE(e){const[t,n]=x.useState(e),r=x.useCallback(o=>n(s=>cl(o,s)),[]);return[t,n,r]}function hE(e){const[t,n]=x.useState(e),r=x.useCallback(o=>n(s=>ul(o,s)),[]);return[t,n,r]}function pE({dimensions:e,lineWidth:t,variant:n,className:r}){return p.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ce(["react-flow__background-pattern",n,r])})}function gE({radius:e,className:t}){return p.jsx("circle",{cx:e,cy:e,r:e,className:ce(["react-flow__background-pattern","dots",t])})}var Ke;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ke||(Ke={}));const mE={[Ke.Dots]:1,[Ke.Lines]:1,[Ke.Cross]:6},yE=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Dl({id:e,variant:t=Ke.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=0,color:i,bgColor:a,style:c,className:l,patternClassName:d}){const u=x.useRef(null),{transform:f,patternId:g}=J(yE,se),h=r||mE[t],m=t===Ke.Dots,w=t===Ke.Cross,v=Array.isArray(n)?n:[n,n],E=[v[0]*f[2]||1,v[1]*f[2]||1],y=h*f[2],b=Array.isArray(s)?s:[s,s],S=w?[y,y]:E,C=[b[0]*f[2]||1+S[0]/2,b[1]*f[2]||1+S[1]/2],M=`${g}${e||""}`;return p.jsxs("svg",{className:ce(["react-flow__background",l]),style:{...c,...wr,"--xy-background-color-props":a,"--xy-background-pattern-color-props":i},ref:u,"data-testid":"rf__background",children:[p.jsx("pattern",{id:M,x:f[0]%E[0],y:f[1]%E[1],width:E[0],height:E[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:m?p.jsx(gE,{radius:y/2,className:d}):p.jsx(pE,{dimensions:S,lineWidth:o,variant:t,className:d})}),p.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}Dl.displayName="Background";const xE=x.memo(Dl);function wE(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:p.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function vE(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:p.jsx("path",{d:"M0 0h32v4.2H0z"})})}function bE(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:p.jsx("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 0027.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.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function EE(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:p.jsx("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 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-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"})})}function SE(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:p.jsx("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 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function jn({children:e,className:t,...n}){return p.jsx("button",{type:"button",className:ce(["react-flow__controls-button",t]),...n,children:e})}const _E=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function jl({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:c,className:l,children:d,position:u="bottom-left",orientation:f="vertical","aria-label":g}){const h=ie(),{isInteractive:m,minZoomReached:w,maxZoomReached:v,ariaLabelConfig:E}=J(_E,se),{zoomIn:y,zoomOut:b,fitView:S}=qo(),C=()=>{y(),s==null||s()},M=()=>{b(),i==null||i()},P=()=>{S(o),a==null||a()},T=()=>{h.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),c==null||c(!m)},z=f==="horizontal"?"horizontal":"vertical";return p.jsxs(xn,{className:ce(["react-flow__controls",z,l]),position:u,style:e,"data-testid":"rf__controls","aria-label":g??E["controls.ariaLabel"],children:[t&&p.jsxs(p.Fragment,{children:[p.jsx(jn,{onClick:C,className:"react-flow__controls-zoomin",title:E["controls.zoomIn.ariaLabel"],"aria-label":E["controls.zoomIn.ariaLabel"],disabled:v,children:p.jsx(wE,{})}),p.jsx(jn,{onClick:M,className:"react-flow__controls-zoomout",title:E["controls.zoomOut.ariaLabel"],"aria-label":E["controls.zoomOut.ariaLabel"],disabled:w,children:p.jsx(vE,{})})]}),n&&p.jsx(jn,{className:"react-flow__controls-fitview",onClick:P,title:E["controls.fitView.ariaLabel"],"aria-label":E["controls.fitView.ariaLabel"],children:p.jsx(bE,{})}),r&&p.jsx(jn,{className:"react-flow__controls-interactive",onClick:T,title:E["controls.interactive.ariaLabel"],"aria-label":E["controls.interactive.ariaLabel"],children:m?p.jsx(SE,{}):p.jsx(EE,{})}),d]})}jl.displayName="Controls";const CE=x.memo(jl);function NE({id:e,x:t,y:n,width:r,height:o,style:s,color:i,strokeColor:a,strokeWidth:c,className:l,borderRadius:d,shapeRendering:u,selected:f,onClick:g}){const{background:h,backgroundColor:m}=s||{},w=i||h||m;return p.jsx("rect",{className:ce(["react-flow__minimap-node",{selected:f},l]),x:t,y:n,rx:d,ry:d,width:r,height:o,style:{fill:w,stroke:a,strokeWidth:c},shapeRendering:u,onClick:g?v=>g(v,e):void 0})}const ME=x.memo(NE),kE=e=>e.nodes.map(t=>t.id),Gr=e=>e instanceof Function?e:()=>e;function PE({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:s=ME,onClick:i}){const a=J(kE,se),c=Gr(t),l=Gr(e),d=Gr(n),u=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return p.jsx(p.Fragment,{children:a.map(f=>p.jsx(AE,{id:f,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:s,onClick:i,shapeRendering:u},f))})}function IE({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:s,shapeRendering:i,NodeComponent:a,onClick:c}){const{node:l,x:d,y:u,width:f,height:g}=J(h=>{const m=h.nodeLookup.get(e);if(!m)return{node:void 0,x:0,y:0,width:0,height:0};const w=m.internals.userNode,{x:v,y:E}=m.internals.positionAbsolute,{width:y,height:b}=Be(w);return{node:w,x:v,y:E,width:y,height:b}},se);return!l||l.hidden||!Ou(l)?null:p.jsx(a,{x:d,y:u,width:f,height:g,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:o,strokeColor:n(l),strokeWidth:s,shapeRendering:i,onClick:c,id:l.id})}const AE=x.memo(IE);var RE=x.memo(PE);const TE=200,DE=150,jE=e=>!e.hidden,OE=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?ju(gn(e.nodeLookup,{filter:jE}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},$E="react-flow__minimap-desc";function Ol({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:i,nodeComponent:a,bgColor:c,maskColor:l,maskStrokeColor:d,maskStrokeWidth:u,position:f="bottom-right",onClick:g,onNodeClick:h,pannable:m=!1,zoomable:w=!1,ariaLabel:v,inversePan:E,zoomStep:y=1,offsetScale:b=5}){const S=ie(),C=x.useRef(null),{boundingRect:M,viewBB:P,rfId:T,panZoom:z,translateExtent:A,flowWidth:D,flowHeight:F,ariaLabelConfig:_}=J(OE,se),R=(e==null?void 0:e.width)??TE,k=(e==null?void 0:e.height)??DE,j=M.width/R,I=M.height/k,N=Math.max(j,I),O=N*R,$=N*k,L=b*N,W=M.x-(O-M.width)/2-L,B=M.y-($-M.height)/2-L,X=O+L*2,U=$+L*2,G=`${$E}-${T}`,H=x.useRef(0),V=x.useRef();H.current=N,x.useEffect(()=>{if(C.current&&z)return V.current=Kv({domNode:C.current,panZoom:z,getTransform:()=>S.getState().transform,getViewScale:()=>H.current}),()=>{var q;(q=V.current)==null||q.destroy()}},[z]),x.useEffect(()=>{var q;(q=V.current)==null||q.update({translateExtent:A,width:D,height:F,inversePan:E,pannable:m,zoomStep:y,zoomable:w})},[m,w,E,y,A,D,F]);const Q=g?q=>{var te;const[ee,oe]=((te=V.current)==null?void 0:te.pointer(q))||[0,0];g(q,{x:ee,y:oe})}:void 0,Z=h?x.useCallback((q,ee)=>{const oe=S.getState().nodeLookup.get(ee).internals.userNode;h(q,oe)},[]):void 0,K=v??_["minimap.ariaLabel"];return p.jsx(xn,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof u=="number"?u*N:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof i=="number"?i:void 0},className:ce(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:p.jsxs("svg",{width:R,height:k,viewBox:`${W} ${B} ${X} ${U}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":G,ref:C,onClick:Q,children:[K&&p.jsx("title",{id:G,children:K}),p.jsx(RE,{onClick:Z,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:i,nodeComponent:a}),p.jsx("path",{className:"react-flow__minimap-mask",d:`M${W-L},${B-L}h${X+L*2}v${U+L*2}h${-X-L*2}z
161
- M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Ol.displayName="MiniMap";x.memo(Ol);const LE=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,FE={[It.Line]:"right",[It.Handle]:"bottom-right"};function zE({nodeId:e,position:t,variant:n=It.Handle,className:r,style:o=void 0,children:s,color:i,minWidth:a=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:f,autoScale:g=!0,shouldResize:h,onResizeStart:m,onResize:w,onResizeEnd:v}){const E=pl(),y=typeof e=="string"?e:E,b=ie(),S=x.useRef(null),C=n===It.Handle,M=J(x.useCallback(LE(C&&g),[C,g]),se),P=x.useRef(null),T=t??FE[n];x.useEffect(()=>{if(!(!S.current||!y))return P.current||(P.current=lb({domNode:S.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:A,transform:D,snapGrid:F,snapToGrid:_,nodeOrigin:R,domNode:k}=b.getState();return{nodeLookup:A,transform:D,snapGrid:F,snapToGrid:_,nodeOrigin:R,paneDomNode:k}},onChange:(A,D)=>{const{triggerNodeChanges:F,nodeLookup:_,parentLookup:R,nodeOrigin:k}=b.getState(),j=[],I={x:A.x,y:A.y},N=_.get(y);if(N&&N.expandParent&&N.parentId){const O=N.origin??k,$=A.width??N.measured.width??0,L=A.height??N.measured.height??0,W={id:N.id,parentId:N.parentId,rect:{width:$,height:L,...$u({x:A.x??N.position.x,y:A.y??N.position.y},{width:$,height:L},N.parentId,_,O)}},B=Uo([W],_,R,k);j.push(...B),I.x=A.x?Math.max(O[0]*$,A.x):void 0,I.y=A.y?Math.max(O[1]*L,A.y):void 0}if(I.x!==void 0&&I.y!==void 0){const O={id:y,type:"position",position:{...I}};j.push(O)}if(A.width!==void 0&&A.height!==void 0){const $={id:y,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:A.width,height:A.height}};j.push($)}for(const O of D){const $={...O,type:"position"};j.push($)}F(j)},onEnd:({width:A,height:D})=>{const F={id:y,type:"dimensions",resizing:!1,dimensions:{width:A,height:D}};b.getState().triggerNodeChanges([F])}})),P.current.update({controlPosition:T,boundaries:{minWidth:a,minHeight:c,maxWidth:l,maxHeight:d},keepAspectRatio:u,resizeDirection:f,onResizeStart:m,onResize:w,onResizeEnd:v,shouldResize:h}),()=>{var A;(A=P.current)==null||A.destroy()}},[T,a,c,l,d,u,m,w,v,h]);const z=T.split("-");return p.jsx("div",{className:ce(["react-flow__resize-control","nodrag",...z,n,r]),ref:S,style:{...o,scale:M,...i&&{[C?"backgroundColor":"borderColor"]:i}},children:s})}x.memo(zE);const HE={NODE_WIDTH:220,NODE_HEIGHT:120,HORIZONTAL_SPACING:280,VERTICAL_SPACING:220,START_X:250,PARALLEL_GROUP_PADDING:25};function WE({data:e,selected:t}){var r,o,s,i;const n=e;return p.jsxs("div",{className:`relative ${n.className||""}`,style:{borderWidth:((r=n.nodeStyle)==null?void 0:r.borderWidth)??1,borderRadius:8,padding:12,width:220,borderStyle:"solid",backgroundColor:(o=n.nodeStyle)==null?void 0:o.backgroundColor,borderColor:((s=n.nodeStyle)==null?void 0:s.borderColor)??"#9ca3af",opacity:(i=n.nodeStyle)==null?void 0:i.opacity,boxShadow:t?"0 0 0 2px rgba(168, 85, 247, 0.5)":void 0},children:[n.label,p.jsx(ve,{type:"target",position:Y.Top,className:"!bg-purple-500"}),p.jsx(ve,{type:"source",position:Y.Bottom,className:"!bg-purple-500"}),p.jsx(ve,{type:"source",position:Y.Left,id:"loop-out",className:"!bg-purple-500 !-left-1 !w-[6px] !h-[6px] !min-w-0 !min-h-0",style:{top:"30%"}}),p.jsx(ve,{type:"target",position:Y.Left,id:"loop-in",className:"!bg-purple-500 !-left-1 !w-[6px] !h-[6px] !min-w-0 !min-h-0",style:{top:"70%"}})]})}function BE({data:e}){return p.jsx("div",{style:{width:e.groupWidth||200,height:e.groupHeight||100,position:"relative"},children:p.jsx("span",{style:{position:"absolute",top:8,left:12,fontSize:11,fontWeight:600,color:"rgba(59, 130, 246, 0.8)",textTransform:"uppercase",letterSpacing:"0.5px",pointerEvents:"none"},children:e.label})})}function VE({data:e,selected:t}){var o,s,i;const n=e,r=160;return p.jsxs("div",{className:`relative flex items-center justify-center ${n.className||""}`,style:{width:r,height:r},children:[p.jsx("div",{style:{width:r*.7,height:r*.7,transform:"rotate(45deg)",borderWidth:2,borderStyle:"solid",borderRadius:4,backgroundColor:(o=n.nodeStyle)==null?void 0:o.backgroundColor,borderColor:((s=n.nodeStyle)==null?void 0:s.borderColor)??"#ef4444",opacity:(i=n.nodeStyle)==null?void 0:i.opacity,boxShadow:t?"0 0 0 2px rgba(239, 68, 68, 0.5)":void 0}}),p.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-auto",style:{fontSize:11,fontWeight:600,padding:r*.25},title:typeof n.label=="string"?n.label:void 0,children:p.jsx("span",{className:"text-center line-clamp-3 overflow-hidden",children:n.label})}),p.jsx(ve,{type:"target",position:Y.Top,className:"!bg-red-500"}),p.jsx(ve,{type:"source",position:Y.Bottom,id:"bottom",className:"!bg-red-500"}),p.jsx(ve,{type:"source",position:Y.Left,id:"left",className:"!bg-red-500"}),p.jsx(ve,{type:"source",position:Y.Right,id:"right",className:"!bg-red-500"})]})}const YE={loopNode:WE,parallelGroup:BE,diamondNode:VE},GE=YE,Zo={strokeColor:"#6b7280",labelBgClass:"bg-gray-200 dark:bg-gray-700 text-black dark:text-gray-200 border-gray-400 dark:border-gray-500"},NS={strokeColor:"#a855f7",labelBgClass:"bg-purple-200 dark:bg-purple-900/50 text-black dark:text-purple-200 border-purple-400 dark:border-purple-600"};function $l(e=Zo){return function({id:n,sourceX:r,sourceY:o,targetX:s,targetY:i,label:a,markerEnd:c}){const d=i-o,u=`
162
- M ${r} ${o}
163
- C ${r-50} ${o},
164
- ${r-50} ${i},
165
- ${s} ${i}
166
- `,f=r-50+5,g=o+d/2-12;return p.jsxs(p.Fragment,{children:[p.jsx(wn,{id:n,path:u,markerEnd:c,style:{stroke:e.strokeColor,strokeWidth:2}}),a&&p.jsx(dE,{children:p.jsx("div",{style:{position:"absolute",transform:`translate(-100%, -50%) translate(${f}px, ${g}px)`,pointerEvents:"all"},className:"nodrag nopan",children:p.jsx("span",{className:`px-1.5 py-0.5 text-[9px] font-bold rounded border whitespace-nowrap ${e.labelBgClass}`,children:a})})})]})}}const XE=$l(Zo),UE={selfLoop:XE};function MS(e=Zo){return{selfLoop:$l(e)}}function qE(e){return e==="workflow_start"||e==="workflow_end"?"var(--node-bg-start)":e==="primitive"?"var(--node-bg-primitive)":e==="agent"?"var(--node-bg-agent)":e==="tool"?"var(--node-bg-tool)":e==="conditional"?"var(--node-bg-conditional)":"var(--node-bg-step)"}function KE(e){return e==="workflow_start"||e==="workflow_end"?"#60a5fa":e==="primitive"?"#f97316":e==="agent"?"#ec4899":e==="tool"?"#a855f7":e==="conditional"?"#ef4444":"#22c55e"}function ZE(e){return{color:"hsl(var(--card-foreground))",backgroundColor:qE(e),borderColor:KE(e)}}function QE(e,t){return e==="workflow_start"?p.jsx(Ef,{className:"h-3.5 w-3.5 text-blue-600 dark:text-blue-400"}):e==="workflow_end"?p.jsx(_f,{className:"h-3.5 w-3.5 text-blue-600 dark:text-blue-400"}):e==="primitive"?t==="sleep"?p.jsx(cs,{className:"h-3.5 w-3.5 text-orange-600 dark:text-orange-400"}):t==="createHook"||t==="createWebhook"?p.jsx(Df,{className:"h-3.5 w-3.5 text-orange-600 dark:text-orange-400"}):p.jsx(cs,{className:"h-3.5 w-3.5 text-orange-600 dark:text-orange-400"}):e==="agent"?p.jsx("span",{className:"h-3.5 w-3.5 text-pink-600 dark:text-pink-400 text-xs",children:"🤖"}):e==="tool"?p.jsx("span",{className:"h-3.5 w-3.5 text-purple-600 dark:text-purple-400 text-xs",children:"🔧"}):e==="conditional"?p.jsx("span",{className:"h-3.5 w-3.5 text-red-600 dark:text-red-400 text-xs",children:"◇"}):p.jsx(wo,{className:"h-3.5 w-3.5 text-green-600 dark:text-green-400"})}function Ll(e,t=HE){var c,l,d,u,f;const n=e.nodes.map(g=>({...g})),r=[],o=[],s=new Map,i=new Map,a=new Map;for(const g of n){if((c=g.metadata)!=null&&c.parallelGroupId){const h=s.get(g.metadata.parallelGroupId)||{nodes:[],method:g.metadata.parallelMethod};h.nodes.push(g),s.set(g.metadata.parallelGroupId,h)}if((l=g.metadata)!=null&&l.loopId){const h=i.get(g.metadata.loopId)||[];h.push(g),i.set(g.metadata.loopId,h)}if((d=g.metadata)!=null&&d.conditionalId){const h=a.get(g.metadata.conditionalId)||{thenBranch:[],elseBranch:[]};g.metadata.conditionalBranch==="Then"?h.thenBranch.push(g):h.elseBranch.push(g),a.set(g.metadata.conditionalId,h)}}for(const[g,h]of s){const m=h.nodes;if(m.length===0)continue;const w=m[0].position.y;if(m.length>1){const C=t.HORIZONTAL_SPACING,M=(m.length-1)*C,P=t.START_X-M/2;m.forEach((T,z)=>{T.position={x:P+z*C,y:w}})}const v=Math.min(...m.map(C=>C.position.x)),E=Math.max(...m.map(C=>C.position.x)),y=h.method==="all"?"Promise.all":h.method==="race"?"Promise.race":h.method==="allSettled"?"Promise.allSettled":h.method==="any"?"Promise.any":"Parallel",b=E-v+t.NODE_WIDTH+t.PARALLEL_GROUP_PADDING*2,S=t.NODE_HEIGHT+t.PARALLEL_GROUP_PADDING*2;r.push({id:`group_${g}`,type:"group",position:{x:v-t.PARALLEL_GROUP_PADDING,y:w-t.PARALLEL_GROUP_PADDING},style:{width:b,height:S,backgroundColor:"rgba(59, 130, 246, 0.05)",border:"2px dashed rgba(59, 130, 246, 0.3)",borderRadius:12},data:{label:y,groupWidth:b,groupHeight:S}})}for(const[,g]of a){if([...g.thenBranch,...g.elseBranch].length<=1)continue;const m=g.thenBranch,w=g.elseBranch;if(m.length>0&&w.length>0){const v=Math.min(((u=m[0])==null?void 0:u.position.y)||0,((f=w[0])==null?void 0:f.position.y)||0);m.forEach((E,y)=>{E.position={x:100,y:v+y*120}}),w.forEach((E,y)=>{E.position={x:400,y:v+y*120}})}}for(const[,g]of i)if(g.length>0){const h=g.some(m=>{var w;return(w=m.metadata)==null?void 0:w.loopIsAwait});for(const m of g)o.push({id:`self_loop_${m.id}`,source:m.id,target:m.id,sourceHandle:"loop-out",targetHandle:"loop-in",type:"selfLoop",label:h?"await":"loop"})}return{nodes:n,groupNodes:r,additionalEdges:o}}function JE(e,t){var i;const n=new Map;for(const a of t)(i=a.metadata)!=null&&i.parallelGroupId&&n.set(a.id,a.metadata.parallelGroupId);const r=new Map,o=[];for(const a of e){const c=n.get(a.source),l=n.get(a.target);if(c&&l&&c!==l){const d=`${c}->${l}`,u=r.get(d)||[];u.push(a),r.set(d,u)}else o.push(a)}const s=[...o];for(const[,a]of r)if(a.length>1){const c=[...new Set(a.map(d=>d.target))],l=a[0].source;for(const d of c){const u=a.find(g=>g.target===d),f=a.filter(g=>g.target===d).map(g=>g.id);s.push({...u,id:`consolidated_${l}_${d}`,source:l,target:d,isConsolidated:!0,originalEdgeIds:f})}}else s.push(...a);return s}function Li(e){var a;const{nodes:t,groupNodes:n}=Ll(e),r=new Map,o=new Map;for(const c of n)c.id.startsWith("group_")&&o.set(c.id,c.position);for(const c of t){const l=(a=c.metadata)!=null&&a.parallelGroupId?`group_${c.metadata.parallelGroupId}`:null;l&&o.has(l)&&r.set(c.id,l)}const s=[],i=n.filter(c=>c.id.startsWith("group_"));for(const c of i)s.push({id:c.id,type:"parallelGroup",position:c.position,style:{...c.style,cursor:"grab",zIndex:-1},data:c.data,draggable:!0,selectable:!0});return t.forEach(c=>{const l=ZE(c.data.nodeKind),d=c.metadata,u=!!(d!=null&&d.loopId),f=!!(d!=null&&d.loopIsAwait),g=c.data.nodeKind==="conditional";let h=g?"diamondNode":u?"loopNode":"default";c.type==="workflowStart"?h="input":c.type==="workflowEnd"&&(h="output");const m=[],w=r.get(c.id);let v=c.position;if(w){const y=o.get(w);y&&(v={x:c.position.x-y.x,y:c.position.y-y.y})}const E=p.jsxs("div",{className:"flex flex-col gap-1.5 w-full overflow-hidden",children:[p.jsxs("div",{className:"flex items-start gap-2 w-full overflow-hidden",children:[p.jsx("div",{className:"flex-shrink-0",children:QE(c.data.nodeKind,c.data.label)}),p.jsx("span",{className:"text-sm font-medium break-words whitespace-normal leading-tight flex-1 min-w-0",children:c.data.label})]}),m.length>0&&p.jsx("div",{className:"flex flex-wrap gap-1",children:m})]},`label-${c.id}`);u?s.push({id:c.id,type:h,position:v,parentId:w,extent:w?"parent":void 0,expandParent:!0,data:{...c.data,label:E,isLoopNode:!0,isAwaitLoop:f,nodeStyle:l}}):g?s.push({id:c.id,type:h,position:v,parentId:w,extent:w?"parent":void 0,expandParent:!0,data:{...c.data,label:c.data.label,nodeStyle:l}}):s.push({id:c.id,type:h,position:v,parentId:w,extent:w?"parent":void 0,expandParent:!0,data:{...c.data,label:E},style:{borderWidth:1,borderRadius:8,padding:12,width:220,...l}})}),s}function Fi(e){const{additionalEdges:t}=Ll(e),r=[...e.edges.map(s=>s.type==="loop"?{...s,id:`loop_back_${s.source}_${s.target}`,isOriginal:!0}:{...s,isOriginal:!0}),...t.map(s=>({...s,isOriginal:!1}))];return JE(r,e.nodes).map(s=>{if(s.type==="selfLoop")return{id:s.id,source:s.source,target:s.target,sourceHandle:s.sourceHandle,targetHandle:s.targetHandle,type:"selfLoop",label:s.label,markerEnd:{type:Nt.ArrowClosed,width:12,height:12,color:"#6b7280"}};const i="#6b7280";let a=1,c;const l=!1;let d=s.label,u="bezier",f=!1;switch(s.type){case"parallel":a=1.5,c="4,4",u="smoothstep",d=void 0;break;case"loop":a=2,c="8,4",u="step";break;case"conditional":c="8,4",u="smoothstep",f=!0;break;default:u="bezier";break}const g=f?"#ffffff":"#6b7280",h=f?"#374151":"#f3f4f6",m=f?"#4b5563":"#d1d5db";return{id:s.id,source:s.source,target:s.target,type:u,animated:l,label:d,labelStyle:{fill:g,fontWeight:500,fontSize:"11px"},labelBgPadding:[4,6],labelBgBorderRadius:4,labelBgStyle:{fill:h,fillOpacity:.95,stroke:m,strokeWidth:1},markerEnd:{type:Nt.ArrowClosed,width:12,height:12,color:i},style:{strokeWidth:a,stroke:i,strokeDasharray:c}}})}function kS({workflow:e}){const t=x.useMemo(()=>Li(e),[e]),n=x.useMemo(()=>Fi(e),[e]),[r,o,s]=fE(t),[i,a,c]=hE(n);return x.useEffect(()=>{o(Li(e)),a(Fi(e))},[e,o,a]),p.jsx("div",{className:"h-full w-full border rounded-lg bg-background relative overflow-hidden",children:p.jsxs(uE,{nodes:r,edges:i,onNodesChange:s,onEdgesChange:c,nodeTypes:GE,edgeTypes:UE,fitView:!0,minZoom:.1,maxZoom:2,defaultViewport:{x:0,y:0,zoom:1},proOptions:{hideAttribution:!0},children:[p.jsx(xE,{}),p.jsx(CE,{}),p.jsx(xn,{position:"top-left",className:"bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 border rounded-lg p-3 text-xs",children:p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("div",{className:"font-semibold text-[10px] text-muted-foreground mb-1.5",children:"Node Types"}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),p.jsx("span",{children:"Start / End"})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"w-3 h-3 rounded-full bg-green-500"}),p.jsx("span",{children:"Step"})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),p.jsx("span",{children:"Primitive (sleep, hook)"})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),p.jsx("span",{children:"Conditional"})]})]}),p.jsxs("div",{className:"space-y-1 pt-2 border-t",children:[p.jsx("div",{className:"font-semibold text-[10px] text-muted-foreground mb-1.5",children:"Edge Types"}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"w-8 h-0.5 bg-gray-500"}),p.jsx("span",{children:"Sequential"})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"w-8 h-0.5",style:{backgroundImage:"repeating-linear-gradient(90deg, #6b7280, #6b7280 4px, transparent 4px, transparent 8px)"}}),p.jsx("span",{children:"Parallel / Loop / Conditional"})]})]})]})})]})})}const eS=zi("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function PS({className:e,variant:t,...n}){return p.jsx("div",{className:ae(eS({variant:t}),e),...n})}const Xe={HORIZONTAL_SPACING:280,VERTICAL_SPACING:320,START_X:250,START_Y:50};function tS(e,t){if(e.length===0)return[];const n=new Map,r=new Map;for(const u of t){const f=n.get(u.source)||[];f.push(u.target),n.set(u.source,f);const g=r.get(u.target)||[];g.push(u.source),r.set(u.target,g)}const o=e.find(u=>u.data.nodeKind==="workflow_start");if(!o)return e.map((u,f)=>({id:u.id,type:u.type,data:{label:u.data.label,nodeKind:u.data.nodeKind,stepId:u.data.stepId},metadata:u.metadata,position:{x:Xe.START_X,y:Xe.START_Y+f*Xe.VERTICAL_SPACING}}));const s=new Map,i=new Set,a=[o.id];for(s.set(o.id,0);a.length>0;){const u=a.shift();if(i.has(u))continue;i.add(u);const f=s.get(u),g=n.get(u)||[];for(const h of g)if(!(h===u||i.has(h)))if(!s.has(h))s.set(h,f+1),a.push(h);else{const m=s.get(h);f+1>m&&(s.set(h,f+1),a.includes(h)||a.push(h))}}let c=Math.max(...Array.from(s.values()),0);for(const u of e)s.has(u.id)||(c++,s.set(u.id,c));const l=new Map;for(const u of e){const f=s.get(u.id)??0,g=l.get(f)||[];g.push(u),l.set(f,g)}const d=[];for(const u of e){const f=s.get(u.id)??0,g=l.get(f)||[u],h=g.findIndex(E=>E.id===u.id),w=(g.length-1)*Xe.HORIZONTAL_SPACING,v=Xe.START_X-w/2;d.push({id:u.id,type:u.type,data:{label:u.data.label,nodeKind:u.data.nodeKind,stepId:u.data.stepId},metadata:u.metadata,position:{x:v+h*Xe.HORIZONTAL_SPACING,y:Xe.START_Y+f*Xe.VERTICAL_SPACING}})}return d}function nS(e){const t={};if(console.log("[adaptManifest] Raw manifest version:",e==null?void 0:e.version),console.log("[adaptManifest] Raw workflows keys:",Object.keys((e==null?void 0:e.workflows)||{})),!(e!=null&&e.workflows))return console.log("[adaptManifest] No workflows in manifest, returning empty"),{version:(e==null?void 0:e.version)||"1.0.0",workflows:{}};for(const[n,r]of Object.entries(e.workflows))for(const[o,s]of Object.entries(r)){const i=tS(s.graph.nodes,s.graph.edges),a={workflowId:s.workflowId,workflowName:o,filePath:n,nodes:i,edges:s.graph.edges};t[s.workflowId]=a}return console.log("[adaptManifest] Adapted workflows count:",Object.keys(t).length),{version:e.version,workflows:t}}function IS(){const[e,t]=x.useState(null),[n,r]=x.useState(!0),[o,s]=x.useState(null),i=x.useRef(!1),a=x.useMemo(()=>({}),[]),c=x.useCallback(async()=>{if(!i.current){i.current=!0,r(!0),s(null);try{console.log("[useWorkflowGraphManifest] Fetching with env:",a);const{result:l,error:d}=await Ic(cf(a));if(d){s(d);return}console.log("[useWorkflowGraphManifest] Raw manifest after unwrap:",l),console.log("[useWorkflowGraphManifest] Workflows in raw:",Object.keys((l==null?void 0:l.workflows)||{}));const u=nS(l);console.log("[useWorkflowGraphManifest] Adapted manifest workflows:",Object.keys(u.workflows)),t(u)}catch(l){const d=l instanceof vt?l:l instanceof Error?new vt(l.message,{cause:l,layer:"client"}):new vt(String(l),{layer:"client"});s(d),t(null)}finally{r(!1),i.current=!1}}},[a]);return x.useEffect(()=>{c()},[c]),{manifest:e,loading:n,error:o,refetch:c}}export{Ic as $,Vf as A,iS as B,vf as C,Wg as D,Af as E,wS as F,Xi as G,vS as H,IS as I,PS as J,uS as K,kS as L,SS as M,_S as N,CS as O,fe as P,lS as Q,dS as R,$f as S,ES as T,Ur as U,aS as V,vt as W,Ff as X,Hf as Y,wo as Z,cs as _,mS as a,th as a0,Pe as a1,ot as a2,fS as a3,Zr as a4,uh as a5,fE as a6,hE as a7,uE as a8,MS as a9,BE as aa,xE as ab,CE as ac,xn as ad,Ll as ae,HE as af,JE as ag,Nt as ah,ve as ai,Y as aj,qE as ak,QE as al,NS as am,d0 as an,bS as ao,u0 as ap,gS as b,Yf as c,Gf as d,pS as e,Bg as f,yS as g,_c as h,et as i,yf as j,f0 as k,Zh as l,Ia as m,Ac as n,gf as o,cS as p,Vn as q,xS as r,qi as s,sn as t,ln as u,ne as v,an as w,bh as x,c0 as y,l0 as z};