@synnaxlabs/pluto 0.46.6 → 0.46.7

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 (61) hide show
  1. package/dist/{Toggle-SqJF7wK1.js → Toggle-BSJnQkJM.js} +1 -1
  2. package/dist/{Toggle-DRTtCc6y.cjs → Toggle-C0DIo816.cjs} +1 -1
  3. package/dist/button.cjs +1 -1
  4. package/dist/button.js +1 -1
  5. package/dist/color.cjs +1 -1
  6. package/dist/color.js +1 -1
  7. package/dist/dialog.cjs +1 -1
  8. package/dist/dialog.js +1 -1
  9. package/dist/{external-DgSrO_Q6.js → external-B0_MIms2.js} +1 -1
  10. package/dist/{external-DYHrJCQJ.js → external-B1ETpyFM.js} +1 -1
  11. package/dist/{external-Ds8xIImT.js → external-B3WxrVX0.js} +1 -1
  12. package/dist/{external-CsEJE9T4.cjs → external-BP7GC2X2.cjs} +1 -1
  13. package/dist/{external-mvUR6Kge.js → external-Bf8170BC.js} +1 -1
  14. package/dist/{external-BbuMnccB.js → external-BgNRw5Al.js} +1 -1
  15. package/dist/{external-BvPQbXGU.js → external-BgSmm_d3.js} +1 -1
  16. package/dist/{external-BvZvr2ca.cjs → external-BmxkwvZQ.cjs} +1 -1
  17. package/dist/{external-CwPMtajL.cjs → external-BoVr9B-m.cjs} +1 -1
  18. package/dist/{external-DRHDJFYP.js → external-BrDpLk_U.js} +1 -1
  19. package/dist/{external-DSYv3Pz-.js → external-CAiETio2.js} +2 -2
  20. package/dist/{external-D_mw9H5h.cjs → external-CQpqJGka.cjs} +1 -1
  21. package/dist/{external-CH77I63o.js → external-CafWN471.js} +1 -1
  22. package/dist/{external-CUXPTsZd.cjs → external-CmmZWsrB.cjs} +1 -1
  23. package/dist/{external-BiJTe5l7.js → external-CnSq_bSU.js} +1 -1
  24. package/dist/{external-DX0zVdQa.cjs → external-Cutp76YR.cjs} +1 -1
  25. package/dist/{external-BeFolwwf.js → external-Cux9mC64.js} +2 -2
  26. package/dist/external-D8EUzT1C.cjs +1 -0
  27. package/dist/{external-D824i9o6.cjs → external-DEYDSJ_G.cjs} +1 -1
  28. package/dist/{external-hOOwYfqA.js → external-DElBi-Q-.js} +1 -1
  29. package/dist/{external-SYYxDTqw.cjs → external-DP8Ao5TN.cjs} +1 -1
  30. package/dist/{external-i5v02pfP.cjs → external-DS6CmLLZ.cjs} +1 -1
  31. package/dist/{external-Ce0u9rc_.js → external-DoerTjzk.js} +1 -1
  32. package/dist/{external-Bjog722s.cjs → external-FJ3vTUtb.cjs} +1 -1
  33. package/dist/{external-1mh1IYIp.cjs → external-V3s19XkB.cjs} +1 -1
  34. package/dist/{external-DTobf-DQ.cjs → external-Zuxgy86I.cjs} +1 -1
  35. package/dist/flex.cjs +1 -1
  36. package/dist/flex.js +1 -1
  37. package/dist/header.cjs +1 -1
  38. package/dist/header.js +1 -1
  39. package/dist/index.cjs +1 -1
  40. package/dist/index.js +22 -22
  41. package/dist/input.cjs +1 -1
  42. package/dist/input.js +1 -1
  43. package/dist/list.cjs +1 -1
  44. package/dist/list.js +1 -1
  45. package/dist/{main-BnSpWlaf.cjs → main-Bg0vBNCG.cjs} +1 -1
  46. package/dist/{main-BINuQ9na.js → main-CEC8k4uE.js} +1 -1
  47. package/dist/menu.cjs +1 -1
  48. package/dist/menu.js +1 -1
  49. package/dist/pluto.css +1 -1
  50. package/dist/tabs.cjs +1 -1
  51. package/dist/tabs.js +1 -1
  52. package/dist/text.cjs +1 -1
  53. package/dist/text.js +2 -2
  54. package/dist/theming.cjs +1 -1
  55. package/dist/theming.js +2 -2
  56. package/dist/tree.cjs +1 -1
  57. package/dist/tree.js +1 -1
  58. package/dist/triggers.cjs +1 -1
  59. package/dist/triggers.js +1 -1
  60. package/package.json +1 -1
  61. package/dist/external-1IBrdKPg.cjs +0 -1
package/dist/flex.js CHANGED
@@ -1,4 +1,4 @@
1
- import { e as r } from "./external-BeFolwwf.js";
1
+ import { e as r } from "./external-Cux9mC64.js";
2
2
  export {
3
3
  r as Flex
4
4
  };
package/dist/header.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-Bjog722s.cjs");exports.Header=e.external;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-FJ3vTUtb.cjs");exports.Header=e.external;
package/dist/header.js CHANGED
@@ -1,4 +1,4 @@
1
- import { e as a } from "./external-BvPQbXGU.js";
1
+ import { e as a } from "./external-BgSmm_d3.js";
2
2
  export {
3
3
  a as Header
4
4
  };
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./main-BnSpWlaf.cjs"),a=require("./jsx-runtime-Dszzpdy0.cjs"),d=require("./css-B0VZnJIa.cjs"),B=require("./provider-CWezGpoq.cjs"),v=require("react"),rp=require("react-dom"),op=require("./Toggle-DRTtCc6y.cjs"),Se=require("./external-DX0zVdQa.cjs"),j=require("./provider-Fw6FIHoE.cjs"),Be=require("./external-i5v02pfP.cjs"),ce=require("zod"),sp=require("./external-D824i9o6.cjs"),Je=require("./external-DTobf-DQ.cjs"),ys=require("./external-SYYxDTqw.cjs"),c2=require("./external-1IBrdKPg.cjs"),ip=require("./units-gFJ6UvpU.cjs"),u2=require("./external-1mh1IYIp.cjs"),d2=require("./external-Bjog722s.cjs"),m2=require("./external-D_mw9H5h.cjs"),p2=require("./external-CwPMtajL.cjs"),Ze=require("./external-BvZvr2ca.cjs"),f2=require("./external-CsEJE9T4.cjs"),x2=require("./external-CUXPTsZd.cjs"),h2=require("./Video-DqumxMbz.cjs"),g2=e=>e.nullable().transform(t=>t===null?void 0:t).optional(),y2=e=>ce.array(e).or(e.transform(t=>[t])),ap=e=>j.g(e,(t,r,o)=>{const n=r===o.length-1,s=!isNaN(parseInt(t)),i=!isNaN(parseInt(o[r+1]));return s&&(t="element"),n||i?t:[t,"shape"]}),Nu=(e,t)=>{if(e==null)return null;const r=e[t];return r==null&&typeof e=="object"&&"sourceType"in e?e.sourceType()[t]:r},v2=((e,t,r)=>t===""?e:j.h(Nu(e,"shape"),ap(t),{...r,getter:Nu})),j2=Object.freeze(Object.defineProperty({__proto__:null,getFieldSchema:v2,getFieldSchemaPath:ap,nullToUndefined:g2,toArray:y2},Symbol.toStringTag,{value:"Module"})),lp=Symbol(),ya=Symbol(),xr="a",zo="w";let S2=(e,t)=>new Proxy(e,t);const Mi=Object.getPrototypeOf,Tu=new WeakMap,va=e=>e&&(Tu.has(e)?Tu.get(e):Mi(e)===Object.prototype||Mi(e)===Array.prototype),Ou=e=>typeof e=="object"&&e!==null,Pu=new WeakMap,cp=e=>e[ya]||e,up=(e,t,r)=>{if(!va(e))return e;const o=cp(e),n=(i=>Object.isFrozen(i)||Object.values(Object.getOwnPropertyDescriptors(i)).some(l=>!l.writable))(o);let s=r&&r.get(o);return s&&s[1].f===n||(s=((i,l)=>{const c={f:l};let u=!1;const m=(x,h)=>{if(!u){let g=c[xr].get(i);if(g||(g={},c[xr].set(i,g)),x===zo)g[zo]=!0;else{let y=g[x];y||(y=new Set,g[x]=y),y.add(h)}}},p={get:(x,h)=>h===ya?i:(m("k",h),up(Reflect.get(x,h),c[xr],c.c)),has:(x,h)=>h===lp?(u=!0,c[xr].delete(i),!0):(m("h",h),Reflect.has(x,h)),getOwnPropertyDescriptor:(x,h)=>(m("o",h),Reflect.getOwnPropertyDescriptor(x,h)),ownKeys:x=>(m(zo),Reflect.ownKeys(x))};return l&&(p.set=p.deleteProperty=()=>!1),[p,c]})(o,n),s[1].p=S2(n?(i=>{let l=Pu.get(i);if(!l){if(Array.isArray(i))l=Array.from(i);else{const c=Object.getOwnPropertyDescriptors(i);Object.values(c).forEach(u=>{u.configurable=!0}),l=Object.create(Mi(i),c)}Pu.set(i,l)}return l})(o):o,s[0]),r&&r.set(o,s)),s[1][xr]=t,s[1].c=r,s[1].p},dp=(e,t,r,o)=>{if(Object.is(e,t))return!1;if(!Ou(e)||!Ou(t))return!0;const n=r.get(cp(e));if(!n)return!0;if(o){const i=o.get(e);if(i&&i.n===t)return i.g;o.set(e,{n:t,g:!1})}let s=null;try{for(const i of n.h||[])if(s=Reflect.has(e,i)!==Reflect.has(t,i),s)return s;if(n[zo]===!0){if(s=((i,l)=>{const c=Reflect.ownKeys(i),u=Reflect.ownKeys(l);return c.length!==u.length||c.some((m,p)=>m!==u[p])})(e,t),s)return s}else for(const i of n.o||[])if(s=!!Reflect.getOwnPropertyDescriptor(e,i)!=!!Reflect.getOwnPropertyDescriptor(t,i),s)return s;for(const i of n.k||[])if(s=dp(e[i],t[i],r,o),s)return s;return s===null&&(s=!0),s}finally{o&&o.set(e,{n:t,g:s})}},E2=e=>!!va(e)&&lp in e,mp=e=>va(e)&&e[ya]||null,b2="h",R2="w",_2="o",w2="k",Di=e=>typeof e=="object"&&e!==null,pp=(e,t)=>{if(!Di(e))return e;const r=mp(e);return r!==null?(E2(e),r):(t.has(e)||(t.add(e),Object.entries(e).forEach(([o,n])=>{const s=pp(n,t);Object.is(s,n)||(e[o]=s)})),e)},Ui=(e,t,r)=>{var o,n,s;if(!Di(e)||!Di(t))return;const i=r.get(mp(t)||t);i&&((o=i[b2])==null||o.forEach(l=>{Reflect.has(e,l)}),i[R2]===!0&&Reflect.ownKeys(e),(n=i[_2])==null||n.forEach(l=>{Reflect.getOwnPropertyDescriptor(e,l)}),(s=i[w2])==null||s.forEach(l=>{Ui(e[l],t[l],r)}))},hi="o",gi="r",yi="a";function C2(e,t){var r;let o=0;const n=(r=t?.size)!=null?r:1,s=[],i=t!=null&&t.noWeakMap?null:new WeakMap;return c=>{const u=i?.get(c);if(u)return u[gi];for(let g=0;g<n;g+=1){const y=s[(o+g)%n];if(!y)break;if(!dp(y[hi],c,y[yi],new WeakMap))return Ui(c,y[hi],y[yi]),i?.set(c,y),y[gi]}const m=new WeakMap,p=up(c,m),x=pp(e(p),new Set);Ui(c,c,m);const h={[hi]:c,[gi]:x,[yi]:m};return o=(o-1+n)%n,s[o]=h,i?.set(c,h),x}}const k2=(e,t)=>d.S.RUNTIME==="browser"?C2(e,t):e,$n=(e,t)=>{v.useEffect(()=>{const r=new AbortController,o=r.signal,s=(async()=>(await d.Ur(),await e(o)))().catch(console.error);return()=>{r.abort(),s.then(i=>i?.()).catch(console.error)}},t)},$2=Object.freeze(Object.defineProperty({__proto__:null,Access:f.Access,Acquire:f.Acquire,Add:f.Add,Align:f.Align,Analyze:f.Analyze,Annotate:f.Annotate,Annotation:f.Annotation,Arc:f.Arc,Array:f.Array,Arrow:f.Arrow,Attachment:f.Attachment,Auto:f.Auto,AutoFitWidth:f.AutoFitWidth,Binary:f.Binary,Bolt:f.Bolt,Boolean:f.Boolean$1,Box:f.Box$1,Bridge:f.Bridge,CSV:f.CSV,Calculation:f.Calculation,Calendar:f.Calendar,Caret:f.Caret,Channel:f.Channel,Check:f.Check,Circle:f.Circle,Click:f.Click,Close:f.Close,Cluster:f.Cluster,Commit:f.Commit,Completed:f.Completed,Concepts:f.Concepts,Connect:f.Connect,Constant:f.Constant,Control:f.Control,Copy:f.Copy,DarkMode:f.DarkMode,Decimal:f.Decimal,Delete:f.Delete,Details:f.Details,Device:f.Device,Disable:f.Disable,Disconnect:f.Disconnect,Download:f.Download,Downsample:f.Downsample,Drag:f.Drag,Dynamic:f.Dynamic,Edit:f.Edit,EditOff:f.EditOff,Enable:f.Enable,Expand:f.Expand,Explore:f.Explore,Export:f.Export,False:f.False,Feedback:f.Feedback,FillColor:f.FillColor,Filter:f.Filter,Fitting:f.Fitting,Focus:f.Focus,Function:f.Function,Group:f.Group,Guide:f.Guide,Hardware:f.Hardware,Heart:f.Heart,Hidden:f.Hidden,Import:f.Import,InProgress:f.InProgress,Index:f.Index,Info:f.Info,JSON:f.JSON,KebabMenu:f.KebabMenu,Keyboard:f.Keyboard,Label:f.Label,LightMode:f.LightMode,LinePlot:f.LinePlot,Linear:f.Linear,Link:f.Link,LinkExternal:f.LinkExternal,Loading:f.Loading,Log:f.Log,Logo:f.Logo,Map:f.Map,Menu:f.Menu$1,MoveToMainWindow:f.MoveToMainWindow,NPM:f.NPM,Node:f.Node,None:f.None,Notification:f.Notification,OpenExternal:f.OpenExternal,OpenInNewWindow:f.OpenInNewWindow,PNPM:f.PNPM,Pan:f.Pan,Pause:f.Pause,Play:f.Play,Process:f.Process,Pump:f.Pump,Python:f.Python,QuestionMark:f.QuestionMark,Rack:f.Rack,Range:f.Range,Reference:f.Reference,Refresh:f.Refresh,Release:f.Release,Rename:f.Rename,Reset:f.Reset,Resources:f.Resources,Rotate:f.Rotate,Rule:f.Rule,Safety:f.Safety,Save:f.Save,Schematic:f.Schematic,Search:f.Search,Select:f.Select,Selection:f.Selection,Settings:f.Settings,Snapshot:f.Snapshot,Snooze:f.Snooze,Sound:f.Sound,SplitX:f.SplitX,SplitY:f.SplitY,StarFilled:f.StarFilled,StarOutlined:f.StarOutlined,Status:f.Status,String:f.String,StrokeColor:f.StrokeColor,StrokeWidth:f.StrokeWidth,Subtract:f.Subtract,Sync:f.Sync,Table:f.Table,Tank:f.Tank,Tare:f.Tare,Task:f.Task,Terminal:f.Terminal,Text:f.Text$3,TextAlign:f.TextAlign,Time:f.Time$1,ToDo:f.ToDo,Tooltip:f.Tooltip,True:f.True,Type:f.Type,TypeScript:f.TypeScript,Units:f.Units,User:f.User,Value:f.Value,Valve:f.Valve,Variable:f.Variable,Virtual:f.Virtual,Visible:f.Visible,Visualize:f.Visualize,Warning:f.Warning,Wave:f.Wave,Workspace:f.Workspace,Yarn:f.Yarn,Zoom:f.Zoom,createComposite:f.createComposite,resolve:f.resolve,wrapSVGIcon:f.wrapSVGIcon},Symbol.toStringTag,{value:"Module"})),I2=Object.freeze(Object.defineProperty({__proto__:null,Config:f.Config,Dialog:f.Dialog$1,chooseLocation:f.chooseLocation,formatTip:f.formatTip,useConfig:f.useConfig,wrap:f.wrap},Symbol.toStringTag,{value:"Module"})),ja=({ref:e,location:t,style:r,size:o,className:n,children:s,onDragStart:i,sizeUnits:l="px",showHandle:c=!0,...u})=>{const m=d.K.construct(t),p=d.K.direction(m),x=d.p.dimension(p);return a.jsxRuntimeExports.jsxs(f.Box,{className:d.CSS(d.CSS.B("resize"),d.CSS.loc(m),n),style:{[x]:`${o}${l}`,...r},ref:e,direction:p,empty:!0,...u,children:[s,c&&a.jsxRuntimeExports.jsx("div",{draggable:!0,className:d.CSS(d.CSS.BE("resize","handle"),d.CSS.bordered(d.K.swap(m))),onDragStart:i,onDrag:f.preventDefault,onDragEnd:f.preventDefault})]})},fp=({onResize:e,count:t,initialSizes:r=[],minSize:o=100,direction:n="x"})=>{const s=v.useRef(null),[i,l]=v.useState({sizeDistribution:N2(r,t),root:null}),c=v.useCallback((p,x,h)=>{if(s.current==null)return;const g=d.jt.dim(d.jt.construct(s.current),n);l(y=>ji(y,g,p,o,x,h))},[o,l,n]);v.useEffect(()=>e?.(i.sizeDistribution),[i.sizeDistribution,e]);const u=v.useCallback((p,x)=>{p.preventDefault();const h=n==="x"?"clientX":"clientY",g=E=>c(x,E[h]),y=()=>{l(E=>({...E,root:null})),document.removeEventListener("mousemove",g)};l(E=>({...E,root:p[h]})),document.addEventListener("mousemove",g),document.addEventListener("mouseup",y,{once:!0})},[l,n,ji]);return{setSize:v.useCallback((p,x)=>c(p,void 0,x),[ji]),props:{direction:n,sizeDistribution:i.sizeDistribution,onDragHandle:u,ref:s}}},xp=({ref:e,direction:t="x",children:r,sizeDistribution:o,onDragHandle:n,className:s,...i})=>{const l=d.p.construct(t),c=v.Children.toArray(r);return o=T2(o),a.jsxRuntimeExports.jsx(f.Box,{...i,ref:e,direction:l,className:d.CSS(d.CSS.B("resize-multiple"),s),empty:!0,grow:!0,children:c.map((u,m)=>a.jsxRuntimeExports.jsx(ja,{onDragStart:p=>n(p,m),location:d.p.location(l),size:o[m]*100,sizeUnits:"%",showHandle:m!==c.length-1,children:u},m))})},N2=(e,t)=>{const r=e.reduce((n,s)=>n+s,0),o=t-e.length;if(o<=0)return e.slice(0,t).map(n=>n/r);if(e.every(n=>n<=1)){const n=1-r;return[...e,...Array(o).fill(n/o)]}return e.map(()=>1/t)},vi=.001,T2=e=>e.every(t=>d.Ar.closeTo(t,1/e.length),vi)?e.map((t,r)=>r%2===0?t+vi:r===e.length-1?t:t-vi):e,ji=(e,t,r,o,n,s)=>{const i=hp(e,t,r,n,s),[l,c]=O2(e.sizeDistribution,r,i,o/t),u=c?n??null:e.root;return{...e,sizeDistribution:l,root:u}},hp=(e,t,r,o,n)=>{let s;if(n!=null)n>1&&(n/=t),s=n-e.sizeDistribution[r];else if(o!=null){if(e.root===null)throw new Error("resize root is null during handle drag");s=(o-e.root)/t}else throw new Error("must provide either a MouseEvent or a targetSize");return s},O2=(e,t,r,o)=>{let n=t;for(;n>0&&e[n]+r<=o;)n--;const s=e[n]+r,i=P2(n,e,o,r),l=e[i]-r;return s<o||l<o?[e,!1]:[e.map((c,u)=>u===n?s:u===i?l:c),!0]},P2=(e,t,r,o)=>(e===t.length-1?z2:L2)(e,t,r,o),L2=(e,t,r,o)=>{let n=e+1;for(;n<t.length-1&&t[n]-o<=r;)n++;return n},z2=(e,t,r,o)=>{let n=e-1;for(;n>0&&t[n]-o<=r;)n--;return n},Si=2,A2=100,gp=({onCollapse:e,onResize:t,location:r="left",minSize:o,maxSize:n,initialSize:s=200,collapseThreshold:i=1/0,className:l,...c})=>{const[u,m]=v.useState(d.R(s,o,n)),p=v.useRef(null),x=d.K.construct(r),h=v.useCallback(S=>{if(p.current===null)return 0;const R=d.jt.dim(S,d.K.direction(x),!0)*(1-2*Number(["bottom","right"].includes(x))),k=p.current+R,$=d.R(k,o,n);return($-k)/(o??A2)>i?Si:$},[x,o,n,i]),g=v.useRef(null),y=v.useCallback(S=>{const R=h(S);m(R),g.current!=null&&t?.(R,d.jt.construct(g.current))},[t,h]),E=v.useCallback(()=>m(S=>(p.current=S,S)),[m]),b=v.useCallback(S=>h(S)===Si&&e?.(),[e,h]);v.useEffect(()=>{o==null||n==null||m(S=>{const R=d.R(S,o,n);return p.current=R,R})},[o,n]);const _=Be.useCursorDrag({onMove:y,onStart:E,onEnd:b});return a.jsxRuntimeExports.jsx(ja,{ref:g,location:x,size:u,onDragStart:_,className:d.clsx(l,d.CSS.expanded(u!==Si)),...c})},M2=Object.freeze(Object.defineProperty({__proto__:null,Core:ja,Multiple:xp,Single:gp,calculateDiffPercentage:hp,useMultiple:fp},Symbol.toStringTag,{value:"Module"})),Sa=({aetherKey:e,enabled:t=!0})=>{const{setState:r}=f.useLifecycle({aetherKey:e,type:j.Eraser.TYPE,schema:j.eraserStateZ,initialState:{region:d.jt.ZERO,enabled:t}}),o=f.useSyncedRef(t);return{erase:v.useCallback(s=>{r({enabled:o.current,region:s})},[r,o])}},D2=({aetherKey:e,children:t})=>{const{erase:r}=Sa({aetherKey:e}),o=f.useResize(r);return a.jsxRuntimeExports.jsx("div",{ref:o,className:d.CSS(d.CSS.inheritDims()),children:t})},U2=Object.freeze(Object.defineProperty({__proto__:null,Eraser:D2,use:Sa},Symbol.toStringTag,{value:"Module"})),F2=({items:e,initialKey:t})=>{const[r,o]=v.useState(t),n=i=>o(i===r?void 0:i),s=e.find(i=>i.key===r);return{onSelect:n,activeItem:s}},B2=({activeItem:e,children:t,onSelect:r,location:o="left",collapseThreshold:n=.65,className:s,onResize:i,onCollapse:l,eraseEnabled:c,...u})=>{const m=d.K.direction(o);c??=e!=null;const p=v.useCallback(()=>{l?l():e!=null&&r?.(e.key)},[r,e?.key,l]),{erase:x}=Sa({enabled:c}),h=v.useCallback((_,S)=>{i?.(_,S),x(S)},[i,x]),{content:g,minSize:y,maxSize:E,initialSize:b=0}=e??{};return a.jsxRuntimeExports.jsx(gp,{className:d.CSS(d.CSS.B("nav-drawer"),d.CSS.dir(m),d.CSS.visible(e!=null),s),collapseThreshold:n,onCollapse:p,location:o,onResize:h,minSize:y,maxSize:E,initialSize:b,...u,children:g})},Z2=Object.freeze(Object.defineProperty({__proto__:null,Bar:f.Bar,Drawer:B2,useDrawer:F2},Symbol.toStringTag,{value:"Module"})),V2=(e,t)=>{const r=new d.m(e).makeValid();if(r.start.equals(d.r.MAX))return null;const o=r.start.isToday?"time":"dateTime";let n=new d.r(r.start).toString(o,t);if(r.start.isToday&&(n=`Today ${n}`),r.end.equals(d.r.MAX))return r.start.before(d.r.now())?`Started ${n}`:`Starts ${n}`;const s=r.end.span(r.start)<d.a$1.DAY?"time":"dateTime",i=new d.r(r.end).toString(s,t);return[n,i]},yp=({children:e,level:t="p",color:r=9,displayTZ:o="local",weight:n=450,...s})=>{const i=V2(e,o);return i==null?null:a.jsxRuntimeExports.jsx(f.Box,{x:!0,gap:"small",align:"center",...s,children:a.jsxRuntimeExports.jsx(f.Text,{level:t,color:r,weight:n,gap:"tiny",children:typeof i=="string"?i:a.jsxRuntimeExports.jsxs(a.jsxRuntimeExports.Fragment,{children:[i[0],a.jsxRuntimeExports.jsx(f.Arrow.Right,{color:9,size:"1em"}),i[1]]})})})},vp=({children:e,format:t,...r})=>a.jsxRuntimeExports.jsx(f.Text,{...r,children:new d.a$1(e).toString(t)}),jp=e=>{const[,t]=v.useState(0);return v.useEffect(()=>{const r=setInterval(()=>{t(o=>o+1)},1e3);return()=>clearInterval(r)},[]),d.r.since(e)},H2=({children:e,...t})=>{const r=jp(e);return a.jsxRuntimeExports.jsx(vp,{...t,children:r})},K2=Object.freeze(Object.defineProperty({__proto__:null,TimeRange:yp,TimeSpan:vp,TimeSpanSince:H2,TimeStamp:f.TimeStamp,useTimeSpanSince:jp},Symbol.toStringTag,{value:"Module"})),Ea={info:"var(--pluto-text-color)",error:"var(--pluto-error-z)",warning:"var(--pluto-warning-m1)",success:"var(--pluto-primary-z)",loading:"var(--pluto-text-color)",disabled:"var(--pluto-gray-l8)"},Jt=({variant:e,...t})=>e==="loading"?a.jsxRuntimeExports.jsx(f.Loading,{...t}):a.jsxRuntimeExports.jsx(f.Circle,{color:e!=null?Ea[e]:void 0,...t}),Sp=({children:e})=>{const{path:t}=f.useUnidirectional({type:j.BaseProvider.TYPE,schema:j.providerStateZ,state:{}});return a.jsxRuntimeExports.jsx(f.Composite,{path:t,children:e})},G2=Object.freeze(Object.defineProperty({__proto__:null,Provider:Sp,SelectDataType:f.SelectDataType,Text:K2},Symbol.toStringTag,{value:"Module"})),Y2=({action:e})=>v.isValidElement(e)?e:v.createElement(f.Button,{...e,key:e.key,size:"tiny"}),W2=({status:{key:e,time:t,count:r,message:o,description:n,variant:s,name:i},silence:l,actions:c,className:u,children:m,...p})=>{const x=v.useRef(null);return a.jsxRuntimeExports.jsxs(f.Box,{className:d.CSS(d.CSS.B("notification"),u),y:!0,empty:!0,ref:x,...p,children:[a.jsxRuntimeExports.jsxs(f.Box,{x:!0,justify:"between",grow:!0,style:{width:"100%"},children:[a.jsxRuntimeExports.jsxs(f.Box,{x:!0,align:"center",gap:"small",children:[a.jsxRuntimeExports.jsxs(f.Text,{level:"small",status:s,gap:"tiny",children:[a.jsxRuntimeExports.jsx(Jt,{variant:s}),d.O.isNonZero(i)&&i]}),a.jsxRuntimeExports.jsx(f.Text,{level:"small",children:`x${r}`}),a.jsxRuntimeExports.jsx(f.TimeStamp,{className:d.CSS(d.CSS.BE("notification","time")),level:"small",format:"time",children:t})]}),a.jsxRuntimeExports.jsx(f.Button,{className:d.CSS(d.CSS.BE("notification","silence")),variant:"outlined",size:"small",onClick:()=>l(e),children:a.jsxRuntimeExports.jsx(f.Close,{})})]}),a.jsxRuntimeExports.jsxs(f.Box,{y:!0,align:"start",className:d.CSS(d.CSS.BE("notification","content")),gap:"small",children:[m??a.jsxRuntimeExports.jsx(f.Text,{className:d.CSS(d.CSS.BE("notification","message")),style:{flexGrow:1},children:o}),n!=null&&a.jsxRuntimeExports.jsx(f.Text,{className:d.CSS(d.CSS.BE("notification","description")),level:"small",style:{flexGrow:1},children:n})]}),c!=null&&a.jsxRuntimeExports.jsx(f.Box,{x:!0,align:"center",justify:"end",className:d.CSS(d.CSS.BE("notification","actions")),children:d.a.toArray(c).map(h=>a.jsxRuntimeExports.jsx(Y2,{action:h},h.key))})]},t.toString())},X2=[{key:"success",name:"Success",icon:a.jsxRuntimeExports.jsx(Jt,{variant:"success"})},{key:"error",name:"Error",icon:a.jsxRuntimeExports.jsx(Jt,{variant:"error"})},{key:"warning",name:"Warning",icon:a.jsxRuntimeExports.jsx(Jt,{variant:"warning"})},{key:"info",name:"Info",icon:a.jsxRuntimeExports.jsx(Jt,{variant:"info"})}],Ep=e=>a.jsxRuntimeExports.jsx(f.Static,{...e,data:X2,resourceName:"Status"}),ba=({resourceName:e,value:t,onChange:r,data:o,getItem:n,subscribe:s,haulType:i,icon:l,disabled:c,onSearch:u,emptyContent:m,status:p,onFetchMore:x,children:h,renderTag:g,actions:y,allowNone:E,replaceOnSingle:b,triggerProps:_,virtual:S=!0,dialogProps:R,variant:k="connected",...$})=>a.jsxRuntimeExports.jsx(f.Frame,{variant:f.transformDialogVariant(k),...$,children:a.jsxRuntimeExports.jsxs(f.Frame$1,{multiple:!0,value:t,onChange:r,data:o,getItem:n,subscribe:s,onFetchMore:x,allowNone:E,replaceOnSingle:b,virtual:S,children:[a.jsxRuntimeExports.jsx(f.MultipleTrigger,{haulType:i,icon:l,placeholder:`Select ${e}s`,disabled:c,variant:f.transformTriggerVariant(k),..._,children:g}),a.jsxRuntimeExports.jsx(f.Dialog$2,{onSearch:u,emptyContent:m,status:p,actions:y,resourceName:e,...R,children:h})]})}),kt=(e,t)=>{const r={};t.forEach(n=>r[n]=void 0);const o=n=>{const{...s}={...n,...r};return a.jsxRuntimeExports.jsx(e,{...s})};return o.displayName=`RemoveProps(${e.displayName})`,o},bp=e=>a.jsxRuntimeExports.jsxs(Se.Buttons,{...e,keys:j.SIZES,children:[a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"tiny",children:"S"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"small",children:"M"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"medium",children:"L"})]}),q2=Object.freeze(Object.defineProperty({__proto__:null,SIZES:j.SIZES,SelectSize:bp,isRenderProp:f.isRenderProp,isSize:j.isSize,removeProps:kt,renderProp:f.renderProp,size:j.size},Symbol.toStringTag,{value:"Module"})),J2=Object.freeze(Object.defineProperty({__proto__:null,Tag:f.Tag,Tags:f.Tags},Symbol.toStringTag,{value:"Module"})),In=e=>a.jsxRuntimeExports.jsxs(Se.Buttons,{...e,keys:j.LEVELS,children:[a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"h2",square:!0,children:"XL"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"h3",square:!0,children:"L"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"h4",square:!0,children:"M"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"h5",square:!0,children:"S"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"small",square:!0,children:"XS"})]}),Q2=[250,400,500,600],Rp=e=>a.jsxRuntimeExports.jsxs(Se.Buttons,{...e,keys:Q2,children:[a.jsxRuntimeExports.jsx(Se.Button,{itemKey:250,children:"Light"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:400,children:"Normal"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:500,children:"Medium"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:600,children:"Bold"})]}),eR=Object.freeze(Object.defineProperty({__proto__:null,Level:In,Weight:Rp},Symbol.toStringTag,{value:"Module"})),tR=Object.freeze(Object.defineProperty({__proto__:null,Button:Se.Button,Buttons:Se.Buttons,Core:f.Core,Dialog:f.Dialog$2,Frame:f.Frame$1,ListItem:f.ListItem,Multiple:ba,MultipleTrigger:f.MultipleTrigger,Single:f.Single,SingleTrigger:f.SingleTrigger,Static:f.Static,Text:eR,staticCanDrop:f.staticCanDrop,useClear:f.useClear,useContext:f.useContext$3,useHover:f.useHover,useItemState:f.useItemState,useMultiple:f.useMultiple,useSelection:f.useSelection,useSingle:f.useSingle},Symbol.toStringTag,{value:"Module"})),nR=f.useVirtualCursorDragWebKit,vs=()=>{const e=v.useRef([]),t=v.useMemo(()=>({cleanup:()=>{e.current.forEach(r=>r()),e.current=[]},set:r=>{r!=null&&e.current.push(...d.a.toArray(r))}}),[]);return v.useEffect(()=>t.cleanup,[t.cleanup]),t};function He(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,o;r<e.length;r++)(o=He(e[r]))!==""&&(t+=(t&&" ")+o);else for(let r in e)e[r]&&(t+=(t&&" ")+r);return t}var rR={value:()=>{}};function js(){for(var e=0,t=arguments.length,r={},o;e<t;++e){if(!(o=arguments[e]+"")||o in r||/[\s.]/.test(o))throw new Error("illegal type: "+o);r[o]=[]}return new Ao(r)}function Ao(e){this._=e}function oR(e,t){return e.trim().split(/^|\s+/).map(function(r){var o="",n=r.indexOf(".");if(n>=0&&(o=r.slice(n+1),r=r.slice(0,n)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:o}})}Ao.prototype=js.prototype={constructor:Ao,on:function(e,t){var r=this._,o=oR(e+"",r),n,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((n=(e=o[s]).type)&&(n=sR(r[n],e.name)))return n;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(n=(e=o[s]).type)r[n]=Lu(r[n],e.name,t);else if(t==null)for(n in r)r[n]=Lu(r[n],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new Ao(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var r=new Array(n),o=0,n,s;o<n;++o)r[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,n=s.length;o<n;++o)s[o].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],n=0,s=o.length;n<s;++n)o[n].value.apply(t,r)}};function sR(e,t){for(var r=0,o=e.length,n;r<o;++r)if((n=e[r]).name===t)return n.value}function Lu(e,t,r){for(var o=0,n=e.length;o<n;++o)if(e[o].name===t){e[o]=rR,e=e.slice(0,o).concat(e.slice(o+1));break}return r!=null&&e.push({name:t,value:r}),e}var Fi="http://www.w3.org/1999/xhtml";const zu={svg:"http://www.w3.org/2000/svg",xhtml:Fi,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ss(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),zu.hasOwnProperty(t)?{space:zu[t],local:e}:e}function iR(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Fi&&t.documentElement.namespaceURI===Fi?t.createElement(e):t.createElementNS(r,e)}}function aR(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _p(e){var t=Ss(e);return(t.local?aR:iR)(t)}function lR(){}function Ra(e){return e==null?lR:function(){return this.querySelector(e)}}function cR(e){typeof e!="function"&&(e=Ra(e));for(var t=this._groups,r=t.length,o=new Array(r),n=0;n<r;++n)for(var s=t[n],i=s.length,l=o[n]=new Array(i),c,u,m=0;m<i;++m)(c=s[m])&&(u=e.call(c,c.__data__,m,s))&&("__data__"in c&&(u.__data__=c.__data__),l[m]=u);return new dt(o,this._parents)}function uR(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function dR(){return[]}function wp(e){return e==null?dR:function(){return this.querySelectorAll(e)}}function mR(e){return function(){return uR(e.apply(this,arguments))}}function pR(e){typeof e=="function"?e=mR(e):e=wp(e);for(var t=this._groups,r=t.length,o=[],n=[],s=0;s<r;++s)for(var i=t[s],l=i.length,c,u=0;u<l;++u)(c=i[u])&&(o.push(e.call(c,c.__data__,u,i)),n.push(c));return new dt(o,n)}function Cp(e){return function(){return this.matches(e)}}function kp(e){return function(t){return t.matches(e)}}var fR=Array.prototype.find;function xR(e){return function(){return fR.call(this.children,e)}}function hR(){return this.firstElementChild}function gR(e){return this.select(e==null?hR:xR(typeof e=="function"?e:kp(e)))}var yR=Array.prototype.filter;function vR(){return Array.from(this.children)}function jR(e){return function(){return yR.call(this.children,e)}}function SR(e){return this.selectAll(e==null?vR:jR(typeof e=="function"?e:kp(e)))}function ER(e){typeof e!="function"&&(e=Cp(e));for(var t=this._groups,r=t.length,o=new Array(r),n=0;n<r;++n)for(var s=t[n],i=s.length,l=o[n]=[],c,u=0;u<i;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new dt(o,this._parents)}function $p(e){return new Array(e.length)}function bR(){return new dt(this._enter||this._groups.map($p),this._parents)}function Vo(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Vo.prototype={constructor:Vo,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 RR(e){return function(){return e}}function _R(e,t,r,o,n,s){for(var i=0,l,c=t.length,u=s.length;i<u;++i)(l=t[i])?(l.__data__=s[i],o[i]=l):r[i]=new Vo(e,s[i]);for(;i<c;++i)(l=t[i])&&(n[i]=l)}function wR(e,t,r,o,n,s,i){var l,c,u=new Map,m=t.length,p=s.length,x=new Array(m),h;for(l=0;l<m;++l)(c=t[l])&&(x[l]=h=i.call(c,c.__data__,l,t)+"",u.has(h)?n[l]=c:u.set(h,c));for(l=0;l<p;++l)h=i.call(e,s[l],l,s)+"",(c=u.get(h))?(o[l]=c,c.__data__=s[l],u.delete(h)):r[l]=new Vo(e,s[l]);for(l=0;l<m;++l)(c=t[l])&&u.get(x[l])===c&&(n[l]=c)}function CR(e){return e.__data__}function kR(e,t){if(!arguments.length)return Array.from(this,CR);var r=t?wR:_R,o=this._parents,n=this._groups;typeof e!="function"&&(e=RR(e));for(var s=n.length,i=new Array(s),l=new Array(s),c=new Array(s),u=0;u<s;++u){var m=o[u],p=n[u],x=p.length,h=$R(e.call(m,m&&m.__data__,u,o)),g=h.length,y=l[u]=new Array(g),E=i[u]=new Array(g),b=c[u]=new Array(x);r(m,p,y,E,b,h,t);for(var _=0,S=0,R,k;_<g;++_)if(R=y[_]){for(_>=S&&(S=_+1);!(k=E[S])&&++S<g;);R._next=k||null}}return i=new dt(i,o),i._enter=l,i._exit=c,i}function $R(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function IR(){return new dt(this._exit||this._groups.map($p),this._parents)}function NR(e,t,r){var o=this.enter(),n=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(n=t(n),n&&(n=n.selection())),r==null?s.remove():r(s),o&&n?o.merge(n).order():n}function TR(e){for(var t=e.selection?e.selection():e,r=this._groups,o=t._groups,n=r.length,s=o.length,i=Math.min(n,s),l=new Array(n),c=0;c<i;++c)for(var u=r[c],m=o[c],p=u.length,x=l[c]=new Array(p),h,g=0;g<p;++g)(h=u[g]||m[g])&&(x[g]=h);for(;c<n;++c)l[c]=r[c];return new dt(l,this._parents)}function OR(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var o=e[t],n=o.length-1,s=o[n],i;--n>=0;)(i=o[n])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function PR(e){e||(e=LR);function t(p,x){return p&&x?e(p.__data__,x.__data__):!p-!x}for(var r=this._groups,o=r.length,n=new Array(o),s=0;s<o;++s){for(var i=r[s],l=i.length,c=n[s]=new Array(l),u,m=0;m<l;++m)(u=i[m])&&(c[m]=u);c.sort(t)}return new dt(n,this._parents).order()}function LR(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function zR(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function AR(){return Array.from(this)}function MR(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var o=e[t],n=0,s=o.length;n<s;++n){var i=o[n];if(i)return i}return null}function DR(){let e=0;for(const t of this)++e;return e}function UR(){return!this.node()}function FR(e){for(var t=this._groups,r=0,o=t.length;r<o;++r)for(var n=t[r],s=0,i=n.length,l;s<i;++s)(l=n[s])&&e.call(l,l.__data__,s,n);return this}function BR(e){return function(){this.removeAttribute(e)}}function ZR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function VR(e,t){return function(){this.setAttribute(e,t)}}function HR(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function KR(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function GR(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function YR(e,t){var r=Ss(e);if(arguments.length<2){var o=this.node();return r.local?o.getAttributeNS(r.space,r.local):o.getAttribute(r)}return this.each((t==null?r.local?ZR:BR:typeof t=="function"?r.local?GR:KR:r.local?HR:VR)(r,t))}function Ip(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function WR(e){return function(){this.style.removeProperty(e)}}function XR(e,t,r){return function(){this.style.setProperty(e,t,r)}}function qR(e,t,r){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,r)}}function JR(e,t,r){return arguments.length>1?this.each((t==null?WR:typeof t=="function"?qR:XR)(e,t,r??"")):Xn(this.node(),e)}function Xn(e,t){return e.style.getPropertyValue(t)||Ip(e).getComputedStyle(e,null).getPropertyValue(t)}function QR(e){return function(){delete this[e]}}function e4(e,t){return function(){this[e]=t}}function t4(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function n4(e,t){return arguments.length>1?this.each((t==null?QR:typeof t=="function"?t4:e4)(e,t)):this.node()[e]}function Np(e){return e.trim().split(/^|\s+/)}function _a(e){return e.classList||new Tp(e)}function Tp(e){this._node=e,this._names=Np(e.getAttribute("class")||"")}Tp.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 Op(e,t){for(var r=_a(e),o=-1,n=t.length;++o<n;)r.add(t[o])}function Pp(e,t){for(var r=_a(e),o=-1,n=t.length;++o<n;)r.remove(t[o])}function r4(e){return function(){Op(this,e)}}function o4(e){return function(){Pp(this,e)}}function s4(e,t){return function(){(t.apply(this,arguments)?Op:Pp)(this,e)}}function i4(e,t){var r=Np(e+"");if(arguments.length<2){for(var o=_a(this.node()),n=-1,s=r.length;++n<s;)if(!o.contains(r[n]))return!1;return!0}return this.each((typeof t=="function"?s4:t?r4:o4)(r,t))}function a4(){this.textContent=""}function l4(e){return function(){this.textContent=e}}function c4(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function u4(e){return arguments.length?this.each(e==null?a4:(typeof e=="function"?c4:l4)(e)):this.node().textContent}function d4(){this.innerHTML=""}function m4(e){return function(){this.innerHTML=e}}function p4(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function f4(e){return arguments.length?this.each(e==null?d4:(typeof e=="function"?p4:m4)(e)):this.node().innerHTML}function x4(){this.nextSibling&&this.parentNode.appendChild(this)}function h4(){return this.each(x4)}function g4(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function y4(){return this.each(g4)}function v4(e){var t=typeof e=="function"?e:_p(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function j4(){return null}function S4(e,t){var r=typeof e=="function"?e:_p(e),o=t==null?j4:typeof t=="function"?t:Ra(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),o.apply(this,arguments)||null)})}function E4(){var e=this.parentNode;e&&e.removeChild(this)}function b4(){return this.each(E4)}function R4(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _4(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function w4(e){return this.select(e?_4:R4)}function C4(e){return arguments.length?this.property("__data__",e):this.node().__data__}function k4(e){return function(t){e.call(this,t,this.__data__)}}function $4(e){return e.trim().split(/^|\s+/).map(function(t){var r="",o=t.indexOf(".");return o>=0&&(r=t.slice(o+1),t=t.slice(0,o)),{type:t,name:r}})}function I4(e){return function(){var t=this.__on;if(t){for(var r=0,o=-1,n=t.length,s;r<n;++r)s=t[r],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function N4(e,t,r){return function(){var o=this.__on,n,s=k4(t);if(o){for(var i=0,l=o.length;i<l;++i)if((n=o[i]).type===e.type&&n.name===e.name){this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=s,n.options=r),n.value=t;return}}this.addEventListener(e.type,s,r),n={type:e.type,name:e.name,value:t,listener:s,options:r},o?o.push(n):this.__on=[n]}}function T4(e,t,r){var o=$4(e+""),n,s=o.length,i;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,m;c<u;++c)for(n=0,m=l[c];n<s;++n)if((i=o[n]).type===m.type&&i.name===m.name)return m.value}return}for(l=t?N4:I4,n=0;n<s;++n)this.each(l(o[n],t,r));return this}function Lp(e,t,r){var o=Ip(e),n=o.CustomEvent;typeof n=="function"?n=new n(t,r):(n=o.document.createEvent("Event"),r?(n.initEvent(t,r.bubbles,r.cancelable),n.detail=r.detail):n.initEvent(t,!1,!1)),e.dispatchEvent(n)}function O4(e,t){return function(){return Lp(this,e,t)}}function P4(e,t){return function(){return Lp(this,e,t.apply(this,arguments))}}function L4(e,t){return this.each((typeof t=="function"?P4:O4)(e,t))}function*z4(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var o=e[t],n=0,s=o.length,i;n<s;++n)(i=o[n])&&(yield i)}var zp=[null];function dt(e,t){this._groups=e,this._parents=t}function Vr(){return new dt([[document.documentElement]],zp)}function A4(){return this}dt.prototype=Vr.prototype={constructor:dt,select:cR,selectAll:pR,selectChild:gR,selectChildren:SR,filter:ER,data:kR,enter:bR,exit:IR,join:NR,merge:TR,selection:A4,order:OR,sort:PR,call:zR,nodes:AR,node:MR,size:DR,empty:UR,each:FR,attr:YR,style:JR,property:n4,classed:i4,text:u4,html:f4,raise:h4,lower:y4,append:v4,insert:S4,remove:b4,clone:w4,datum:C4,on:T4,dispatch:L4,[Symbol.iterator]:z4};function ct(e){return typeof e=="string"?new dt([[document.querySelector(e)]],[document.documentElement]):new dt([[e]],zp)}function M4(e){let t;for(;t=e.sourceEvent;)e=t;return e}function jt(e,t){if(e=M4(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var o=r.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var n=t.getBoundingClientRect();return[e.clientX-n.left-t.clientLeft,e.clientY-n.top-t.clientTop]}}return[e.pageX,e.pageY]}const D4={passive:!1},kr={capture:!0,passive:!1};function Ei(e){e.stopImmediatePropagation()}function Gn(e){e.preventDefault(),e.stopImmediatePropagation()}function Ap(e){var t=e.document.documentElement,r=ct(e).on("dragstart.drag",Gn,kr);"onselectstart"in t?r.on("selectstart.drag",Gn,kr):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Mp(e,t){var r=e.document.documentElement,o=ct(e).on("dragstart.drag",null);t&&(o.on("click.drag",Gn,kr),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in r?o.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const So=e=>()=>e;function Bi(e,{sourceEvent:t,subject:r,target:o,identifier:n,active:s,x:i,y:l,dx:c,dy:u,dispatch:m}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:n,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:m}})}Bi.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function U4(e){return!e.ctrlKey&&!e.button}function F4(){return this.parentNode}function B4(e,t){return t??{x:e.x,y:e.y}}function Z4(){return navigator.maxTouchPoints||"ontouchstart"in this}function Dp(){var e=U4,t=F4,r=B4,o=Z4,n={},s=js("start","drag","end"),i=0,l,c,u,m,p=0;function x(R){R.on("mousedown.drag",h).filter(o).on("touchstart.drag",E).on("touchmove.drag",b,D4).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(R,k){if(!(m||!e.call(this,R,k))){var $=S(this,t.call(this,R,k),R,k,"mouse");$&&(ct(R.view).on("mousemove.drag",g,kr).on("mouseup.drag",y,kr),Ap(R.view),Ei(R),u=!1,l=R.clientX,c=R.clientY,$("start",R))}}function g(R){if(Gn(R),!u){var k=R.clientX-l,$=R.clientY-c;u=k*k+$*$>p}n.mouse("drag",R)}function y(R){ct(R.view).on("mousemove.drag mouseup.drag",null),Mp(R.view,u),Gn(R),n.mouse("end",R)}function E(R,k){if(e.call(this,R,k)){var $=R.changedTouches,T=t.call(this,R,k),M=$.length,A,V;for(A=0;A<M;++A)(V=S(this,T,R,k,$[A].identifier,$[A]))&&(Ei(R),V("start",R,$[A]))}}function b(R){var k=R.changedTouches,$=k.length,T,M;for(T=0;T<$;++T)(M=n[k[T].identifier])&&(Gn(R),M("drag",R,k[T]))}function _(R){var k=R.changedTouches,$=k.length,T,M;for(m&&clearTimeout(m),m=setTimeout(function(){m=null},500),T=0;T<$;++T)(M=n[k[T].identifier])&&(Ei(R),M("end",R,k[T]))}function S(R,k,$,T,M,A){var V=s.copy(),Z=jt(A||$,k),O,D,C;if((C=r.call(R,new Bi("beforestart",{sourceEvent:$,target:x,identifier:M,active:i,x:Z[0],y:Z[1],dx:0,dy:0,dispatch:V}),T))!=null)return O=C.x-Z[0]||0,D=C.y-Z[1]||0,function L(N,I,z){var U=Z,H;switch(N){case"start":n[M]=L,H=i++;break;case"end":delete n[M],--i;case"drag":Z=jt(z||I,k),H=i;break}V.call(N,R,new Bi(N,{sourceEvent:I,subject:C,target:x,identifier:M,active:H,x:Z[0]+O,y:Z[1]+D,dx:Z[0]-U[0],dy:Z[1]-U[1],dispatch:V}),T)}}return x.filter=function(R){return arguments.length?(e=typeof R=="function"?R:So(!!R),x):e},x.container=function(R){return arguments.length?(t=typeof R=="function"?R:So(R),x):t},x.subject=function(R){return arguments.length?(r=typeof R=="function"?R:So(R),x):r},x.touchable=function(R){return arguments.length?(o=typeof R=="function"?R:So(!!R),x):o},x.on=function(){var R=s.on.apply(s,arguments);return R===s?x:R},x.clickDistance=function(R){return arguments.length?(p=(R=+R)*R,x):Math.sqrt(p)},x}var Au=180/Math.PI,Zi={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Up(e,t,r,o,n,s){var i,l,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*r+t*o)&&(r-=e*c,o-=t*c),(l=Math.sqrt(r*r+o*o))&&(r/=l,o/=l,c/=l),e*o<t*r&&(e=-e,t=-t,c=-c,i=-i),{translateX:n,translateY:s,rotate:Math.atan2(t,e)*Au,skewX:Math.atan(c)*Au,scaleX:i,scaleY:l}}var Eo;function V4(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Zi:Up(t.a,t.b,t.c,t.d,t.e,t.f)}function H4(e){return e==null||(Eo||(Eo=document.createElementNS("http://www.w3.org/2000/svg","g")),Eo.setAttribute("transform",e),!(e=Eo.transform.baseVal.consolidate()))?Zi:(e=e.matrix,Up(e.a,e.b,e.c,e.d,e.e,e.f))}function Fp(e,t,r,o){function n(u){return u.length?u.pop()+" ":""}function s(u,m,p,x,h,g){if(u!==p||m!==x){var y=h.push("translate(",null,t,null,r);g.push({i:y-4,x:B.interpolateNumber(u,p)},{i:y-2,x:B.interpolateNumber(m,x)})}else(p||x)&&h.push("translate("+p+t+x+r)}function i(u,m,p,x){u!==m?(u-m>180?m+=360:m-u>180&&(u+=360),x.push({i:p.push(n(p)+"rotate(",null,o)-2,x:B.interpolateNumber(u,m)})):m&&p.push(n(p)+"rotate("+m+o)}function l(u,m,p,x){u!==m?x.push({i:p.push(n(p)+"skewX(",null,o)-2,x:B.interpolateNumber(u,m)}):m&&p.push(n(p)+"skewX("+m+o)}function c(u,m,p,x,h,g){if(u!==p||m!==x){var y=h.push(n(h)+"scale(",null,",",null,")");g.push({i:y-4,x:B.interpolateNumber(u,p)},{i:y-2,x:B.interpolateNumber(m,x)})}else(p!==1||x!==1)&&h.push(n(h)+"scale("+p+","+x+")")}return function(u,m){var p=[],x=[];return u=e(u),m=e(m),s(u.translateX,u.translateY,m.translateX,m.translateY,p,x),i(u.rotate,m.rotate,p,x),l(u.skewX,m.skewX,p,x),c(u.scaleX,u.scaleY,m.scaleX,m.scaleY,p,x),u=m=null,function(h){for(var g=-1,y=x.length,E;++g<y;)p[(E=x[g]).i]=E.x(h);return p.join("")}}}var K4=Fp(V4,"px, ","px)","deg)"),G4=Fp(H4,", ",")",")"),Y4=1e-12;function Mu(e){return((e=Math.exp(e))+1/e)/2}function W4(e){return((e=Math.exp(e))-1/e)/2}function X4(e){return((e=Math.exp(2*e))-1)/(e+1)}const Mo=(function e(t,r,o){function n(s,i){var l=s[0],c=s[1],u=s[2],m=i[0],p=i[1],x=i[2],h=m-l,g=p-c,y=h*h+g*g,E,b;if(y<Y4)b=Math.log(x/u)/t,E=function(T){return[l+T*h,c+T*g,u*Math.exp(t*T*b)]};else{var _=Math.sqrt(y),S=(x*x-u*u+o*y)/(2*u*r*_),R=(x*x-u*u-o*y)/(2*x*r*_),k=Math.log(Math.sqrt(S*S+1)-S),$=Math.log(Math.sqrt(R*R+1)-R);b=($-k)/t,E=function(T){var M=T*b,A=Mu(k),V=u/(r*_)*(A*X4(t*M+k)-W4(k));return[l+V*h,c+V*g,u*A/Mu(t*M+k)]}}return E.duration=b*1e3*t/Math.SQRT2,E}return n.rho=function(s){var i=Math.max(.001,+s),l=i*i,c=l*l;return e(i,l,c)},n})(Math.SQRT2,2,4);var qn=0,vr=0,hr=0,Bp=1e3,Ho,jr,Ko=0,yn=0,Es=0,$r=typeof performance=="object"&&performance.now?performance:Date,Zp=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function wa(){return yn||(Zp(q4),yn=$r.now()+Es)}function q4(){yn=0}function Go(){this._call=this._time=this._next=null}Go.prototype=Vp.prototype={constructor:Go,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?wa():+r)+(t==null?0:+t),!this._next&&jr!==this&&(jr?jr._next=this:Ho=this,jr=this),this._call=e,this._time=r,Vi()},stop:function(){this._call&&(this._call=null,this._time=1/0,Vi())}};function Vp(e,t,r){var o=new Go;return o.restart(e,t,r),o}function J4(){wa(),++qn;for(var e=Ho,t;e;)(t=yn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--qn}function Du(){yn=(Ko=$r.now())+Es,qn=vr=0;try{J4()}finally{qn=0,e3(),yn=0}}function Q4(){var e=$r.now(),t=e-Ko;t>Bp&&(Es-=t,Ko=e)}function e3(){for(var e,t=Ho,r,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:Ho=r);jr=e,Vi(o)}function Vi(e){if(!qn){vr&&(vr=clearTimeout(vr));var t=e-yn;t>24?(e<1/0&&(vr=setTimeout(Du,e-$r.now()-Es)),hr&&(hr=clearInterval(hr))):(hr||(Ko=$r.now(),hr=setInterval(Q4,Bp)),qn=1,Zp(Du))}}function Uu(e,t,r){var o=new Go;return t=t==null?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,r),o}var t3=js("start","end","cancel","interrupt"),n3=[],Hp=0,Fu=1,Hi=2,Do=3,Bu=4,Ki=5,Uo=6;function bs(e,t,r,o,n,s){var i=e.__transition;if(!i)e.__transition={};else if(r in i)return;r3(e,r,{name:t,index:o,group:n,on:t3,tween:n3,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Hp})}function Ca(e,t){var r=$t(e,t);if(r.state>Hp)throw new Error("too late; already scheduled");return r}function Pt(e,t){var r=$t(e,t);if(r.state>Do)throw new Error("too late; already running");return r}function $t(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function r3(e,t,r){var o=e.__transition,n;o[t]=r,r.timer=Vp(s,0,r.time);function s(u){r.state=Fu,r.timer.restart(i,r.delay,r.time),r.delay<=u&&i(u-r.delay)}function i(u){var m,p,x,h;if(r.state!==Fu)return c();for(m in o)if(h=o[m],h.name===r.name){if(h.state===Do)return Uu(i);h.state===Bu?(h.state=Uo,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[m]):+m<t&&(h.state=Uo,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[m])}if(Uu(function(){r.state===Do&&(r.state=Bu,r.timer.restart(l,r.delay,r.time),l(u))}),r.state=Hi,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Hi){for(r.state=Do,n=new Array(x=r.tween.length),m=0,p=-1;m<x;++m)(h=r.tween[m].value.call(e,e.__data__,r.index,r.group))&&(n[++p]=h);n.length=p+1}}function l(u){for(var m=u<r.duration?r.ease.call(null,u/r.duration):(r.timer.restart(c),r.state=Ki,1),p=-1,x=n.length;++p<x;)n[p].call(e,m);r.state===Ki&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=Uo,r.timer.stop(),delete o[t];for(var u in o)return;delete e.__transition}}function Fo(e,t){var r=e.__transition,o,n,s=!0,i;if(r){t=t==null?null:t+"";for(i in r){if((o=r[i]).name!==t){s=!1;continue}n=o.state>Hi&&o.state<Ki,o.state=Uo,o.timer.stop(),o.on.call(n?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete r[i]}s&&delete e.__transition}}function o3(e){return this.each(function(){Fo(this,e)})}function s3(e,t){var r,o;return function(){var n=Pt(this,e),s=n.tween;if(s!==r){o=r=s;for(var i=0,l=o.length;i<l;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}n.tween=o}}function i3(e,t,r){var o,n;if(typeof r!="function")throw new Error;return function(){var s=Pt(this,e),i=s.tween;if(i!==o){n=(o=i).slice();for(var l={name:t,value:r},c=0,u=n.length;c<u;++c)if(n[c].name===t){n[c]=l;break}c===u&&n.push(l)}s.tween=n}}function a3(e,t){var r=this._id;if(e+="",arguments.length<2){for(var o=$t(this.node(),r).tween,n=0,s=o.length,i;n<s;++n)if((i=o[n]).name===e)return i.value;return null}return this.each((t==null?s3:i3)(r,e,t))}function ka(e,t,r){var o=e._id;return e.each(function(){var n=Pt(this,o);(n.value||(n.value={}))[t]=r.apply(this,arguments)}),function(n){return $t(n,o).value[t]}}function Kp(e,t){var r;return(typeof t=="number"?B.interpolateNumber:t instanceof B.color?B.interpolateRgb:(r=B.color(t))?(t=r,B.interpolateRgb):B.interpolateString)(e,t)}function l3(e){return function(){this.removeAttribute(e)}}function c3(e){return function(){this.removeAttributeNS(e.space,e.local)}}function u3(e,t,r){var o,n=r+"",s;return function(){var i=this.getAttribute(e);return i===n?null:i===o?s:s=t(o=i,r)}}function d3(e,t,r){var o,n=r+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===n?null:i===o?s:s=t(o=i,r)}}function m3(e,t,r){var o,n,s;return function(){var i,l=r(this),c;return l==null?void this.removeAttribute(e):(i=this.getAttribute(e),c=l+"",i===c?null:i===o&&c===n?s:(n=c,s=t(o=i,l)))}}function p3(e,t,r){var o,n,s;return function(){var i,l=r(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),c=l+"",i===c?null:i===o&&c===n?s:(n=c,s=t(o=i,l)))}}function f3(e,t){var r=Ss(e),o=r==="transform"?G4:Kp;return this.attrTween(e,typeof t=="function"?(r.local?p3:m3)(r,o,ka(this,"attr."+e,t)):t==null?(r.local?c3:l3)(r):(r.local?d3:u3)(r,o,t))}function x3(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function h3(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function g3(e,t){var r,o;function n(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&h3(e,s)),r}return n._value=t,n}function y3(e,t){var r,o;function n(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&x3(e,s)),r}return n._value=t,n}function v3(e,t){var r="attr."+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;var o=Ss(e);return this.tween(r,(o.local?g3:y3)(o,t))}function j3(e,t){return function(){Ca(this,e).delay=+t.apply(this,arguments)}}function S3(e,t){return t=+t,function(){Ca(this,e).delay=t}}function E3(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?j3:S3)(t,e)):$t(this.node(),t).delay}function b3(e,t){return function(){Pt(this,e).duration=+t.apply(this,arguments)}}function R3(e,t){return t=+t,function(){Pt(this,e).duration=t}}function _3(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?b3:R3)(t,e)):$t(this.node(),t).duration}function w3(e,t){if(typeof t!="function")throw new Error;return function(){Pt(this,e).ease=t}}function C3(e){var t=this._id;return arguments.length?this.each(w3(t,e)):$t(this.node(),t).ease}function k3(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;Pt(this,e).ease=r}}function $3(e){if(typeof e!="function")throw new Error;return this.each(k3(this._id,e))}function I3(e){typeof e!="function"&&(e=Cp(e));for(var t=this._groups,r=t.length,o=new Array(r),n=0;n<r;++n)for(var s=t[n],i=s.length,l=o[n]=[],c,u=0;u<i;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new Zt(o,this._parents,this._name,this._id)}function N3(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,o=t.length,n=r.length,s=Math.min(o,n),i=new Array(o),l=0;l<s;++l)for(var c=t[l],u=r[l],m=c.length,p=i[l]=new Array(m),x,h=0;h<m;++h)(x=c[h]||u[h])&&(p[h]=x);for(;l<o;++l)i[l]=t[l];return new Zt(i,this._parents,this._name,this._id)}function T3(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function O3(e,t,r){var o,n,s=T3(t)?Ca:Pt;return function(){var i=s(this,e),l=i.on;l!==o&&(n=(o=l).copy()).on(t,r),i.on=n}}function P3(e,t){var r=this._id;return arguments.length<2?$t(this.node(),r).on.on(e):this.each(O3(r,e,t))}function L3(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function z3(){return this.on("end.remove",L3(this._id))}function A3(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Ra(e));for(var o=this._groups,n=o.length,s=new Array(n),i=0;i<n;++i)for(var l=o[i],c=l.length,u=s[i]=new Array(c),m,p,x=0;x<c;++x)(m=l[x])&&(p=e.call(m,m.__data__,x,l))&&("__data__"in m&&(p.__data__=m.__data__),u[x]=p,bs(u[x],t,r,x,u,$t(m,r)));return new Zt(s,this._parents,t,r)}function M3(e){var t=this._name,r=this._id;typeof e!="function"&&(e=wp(e));for(var o=this._groups,n=o.length,s=[],i=[],l=0;l<n;++l)for(var c=o[l],u=c.length,m,p=0;p<u;++p)if(m=c[p]){for(var x=e.call(m,m.__data__,p,c),h,g=$t(m,r),y=0,E=x.length;y<E;++y)(h=x[y])&&bs(h,t,r,y,x,g);s.push(x),i.push(m)}return new Zt(s,i,t,r)}var D3=Vr.prototype.constructor;function U3(){return new D3(this._groups,this._parents)}function F3(e,t){var r,o,n;return function(){var s=Xn(this,e),i=(this.style.removeProperty(e),Xn(this,e));return s===i?null:s===r&&i===o?n:n=t(r=s,o=i)}}function Gp(e){return function(){this.style.removeProperty(e)}}function B3(e,t,r){var o,n=r+"",s;return function(){var i=Xn(this,e);return i===n?null:i===o?s:s=t(o=i,r)}}function Z3(e,t,r){var o,n,s;return function(){var i=Xn(this,e),l=r(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Xn(this,e))),i===c?null:i===o&&c===n?s:(n=c,s=t(o=i,l))}}function V3(e,t){var r,o,n,s="style."+t,i="end."+s,l;return function(){var c=Pt(this,e),u=c.on,m=c.value[s]==null?l||(l=Gp(t)):void 0;(u!==r||n!==m)&&(o=(r=u).copy()).on(i,n=m),c.on=o}}function H3(e,t,r){var o=(e+="")=="transform"?K4:Kp;return t==null?this.styleTween(e,F3(e,o)).on("end.style."+e,Gp(e)):typeof t=="function"?this.styleTween(e,Z3(e,o,ka(this,"style."+e,t))).each(V3(this._id,e)):this.styleTween(e,B3(e,o,t),r).on("end.style."+e,null)}function K3(e,t,r){return function(o){this.style.setProperty(e,t.call(this,o),r)}}function G3(e,t,r){var o,n;function s(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&K3(e,i,r)),o}return s._value=t,s}function Y3(e,t,r){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,G3(e,t,r??""))}function W3(e){return function(){this.textContent=e}}function X3(e){return function(){var t=e(this);this.textContent=t??""}}function q3(e){return this.tween("text",typeof e=="function"?X3(ka(this,"text",e)):W3(e==null?"":e+""))}function J3(e){return function(t){this.textContent=e.call(this,t)}}function Q3(e){var t,r;function o(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&J3(n)),t}return o._value=e,o}function e5(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,Q3(e))}function t5(){for(var e=this._name,t=this._id,r=Yp(),o=this._groups,n=o.length,s=0;s<n;++s)for(var i=o[s],l=i.length,c,u=0;u<l;++u)if(c=i[u]){var m=$t(c,t);bs(c,e,r,u,i,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new Zt(o,this._parents,e,r)}function n5(){var e,t,r=this,o=r._id,n=r.size();return new Promise(function(s,i){var l={value:i},c={value:function(){--n===0&&s()}};r.each(function(){var u=Pt(this,o),m=u.on;m!==e&&(t=(e=m).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),n===0&&s()})}var r5=0;function Zt(e,t,r,o){this._groups=e,this._parents=t,this._name=r,this._id=o}function Yp(){return++r5}var Mt=Vr.prototype;Zt.prototype={constructor:Zt,select:A3,selectAll:M3,selectChild:Mt.selectChild,selectChildren:Mt.selectChildren,filter:I3,merge:N3,selection:U3,transition:t5,call:Mt.call,nodes:Mt.nodes,node:Mt.node,size:Mt.size,empty:Mt.empty,each:Mt.each,on:P3,attr:f3,attrTween:v3,style:H3,styleTween:Y3,text:q3,textTween:e5,remove:z3,tween:a3,delay:E3,duration:_3,ease:C3,easeVarying:$3,end:n5,[Symbol.iterator]:Mt[Symbol.iterator]};function o5(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var s5={time:null,delay:0,duration:250,ease:o5};function i5(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function a5(e){var t,r;e instanceof Zt?(t=e._id,e=e._name):(t=Yp(),(r=s5).time=wa(),e=e==null?null:e+"");for(var o=this._groups,n=o.length,s=0;s<n;++s)for(var i=o[s],l=i.length,c,u=0;u<l;++u)(c=i[u])&&bs(c,e,t,u,i,r||i5(c,t));return new Zt(o,this._parents,e,t)}Vr.prototype.interrupt=o3;Vr.prototype.transition=a5;const bo=e=>()=>e;function l5(e,{sourceEvent:t,target:r,transform:o,dispatch:n}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:n}})}function Ut(e,t,r){this.k=e,this.x=t,this.y=r}Ut.prototype={constructor:Ut,scale:function(e){return e===1?this:new Ut(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ut(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 Rs=new Ut(1,0,0);Wp.prototype=Ut.prototype;function Wp(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Rs;return e.__zoom}function bi(e){e.stopImmediatePropagation()}function gr(e){e.preventDefault(),e.stopImmediatePropagation()}function c5(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function u5(){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 Zu(){return this.__zoom||Rs}function d5(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function m5(){return navigator.maxTouchPoints||"ontouchstart"in this}function p5(e,t,r){var o=e.invertX(t[0][0])-r[0][0],n=e.invertX(t[1][0])-r[1][0],s=e.invertY(t[0][1])-r[0][1],i=e.invertY(t[1][1])-r[1][1];return e.translate(n>o?(o+n)/2:Math.min(0,o)||Math.max(0,n),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function Xp(){var e=c5,t=u5,r=p5,o=d5,n=m5,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Mo,u=js("start","zoom","end"),m,p,x,h=500,g=150,y=0,E=10;function b(C){C.property("__zoom",Zu).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",V).filter(n).on("touchstart.zoom",Z).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(C,L,N,I){var z=C.selection?C.selection():C;z.property("__zoom",Zu),C!==z?k(C,L,N,I):z.interrupt().each(function(){$(this,arguments).event(I).start().zoom(null,typeof L=="function"?L.apply(this,arguments):L).end()})},b.scaleBy=function(C,L,N,I){b.scaleTo(C,function(){var z=this.__zoom.k,U=typeof L=="function"?L.apply(this,arguments):L;return z*U},N,I)},b.scaleTo=function(C,L,N,I){b.transform(C,function(){var z=t.apply(this,arguments),U=this.__zoom,H=N==null?R(z):typeof N=="function"?N.apply(this,arguments):N,K=U.invert(H),W=typeof L=="function"?L.apply(this,arguments):L;return r(S(_(U,W),H,K),z,i)},N,I)},b.translateBy=function(C,L,N,I){b.transform(C,function(){return r(this.__zoom.translate(typeof L=="function"?L.apply(this,arguments):L,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),i)},null,I)},b.translateTo=function(C,L,N,I,z){b.transform(C,function(){var U=t.apply(this,arguments),H=this.__zoom,K=I==null?R(U):typeof I=="function"?I.apply(this,arguments):I;return r(Rs.translate(K[0],K[1]).scale(H.k).translate(typeof L=="function"?-L.apply(this,arguments):-L,typeof N=="function"?-N.apply(this,arguments):-N),U,i)},I,z)};function _(C,L){return L=Math.max(s[0],Math.min(s[1],L)),L===C.k?C:new Ut(L,C.x,C.y)}function S(C,L,N){var I=L[0]-N[0]*C.k,z=L[1]-N[1]*C.k;return I===C.x&&z===C.y?C:new Ut(C.k,I,z)}function R(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function k(C,L,N,I){C.on("start.zoom",function(){$(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(I).end()}).tween("zoom",function(){var z=this,U=arguments,H=$(z,U).event(I),K=t.apply(z,U),W=N==null?R(K):typeof N=="function"?N.apply(z,U):N,re=Math.max(K[1][0]-K[0][0],K[1][1]-K[0][1]),Q=z.__zoom,le=typeof L=="function"?L.apply(z,U):L,pe=c(Q.invert(W).concat(re/Q.k),le.invert(W).concat(re/le.k));return function(oe){if(oe===1)oe=le;else{var te=pe(oe),ae=re/te[2];oe=new Ut(ae,W[0]-te[0]*ae,W[1]-te[1]*ae)}H.zoom(null,oe)}})}function $(C,L,N){return!N&&C.__zooming||new T(C,L)}function T(C,L){this.that=C,this.args=L,this.active=0,this.sourceEvent=null,this.extent=t.apply(C,L),this.taps=0}T.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,L){return this.mouse&&C!=="mouse"&&(this.mouse[1]=L.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=L.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=L.invert(this.touch1[0])),this.that.__zoom=L,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var L=ct(this.that).datum();u.call(C,this.that,new l5(C,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:u}),L)}};function M(C,...L){if(!e.apply(this,arguments))return;var N=$(this,L).event(C),I=this.__zoom,z=Math.max(s[0],Math.min(s[1],I.k*Math.pow(2,o.apply(this,arguments)))),U=jt(C);if(N.wheel)(N.mouse[0][0]!==U[0]||N.mouse[0][1]!==U[1])&&(N.mouse[1]=I.invert(N.mouse[0]=U)),clearTimeout(N.wheel);else{if(I.k===z)return;N.mouse=[U,I.invert(U)],Fo(this),N.start()}gr(C),N.wheel=setTimeout(H,g),N.zoom("mouse",r(S(_(I,z),N.mouse[0],N.mouse[1]),N.extent,i));function H(){N.wheel=null,N.end()}}function A(C,...L){if(x||!e.apply(this,arguments))return;var N=C.currentTarget,I=$(this,L,!0).event(C),z=ct(C.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",re,!0),U=jt(C,N),H=C.clientX,K=C.clientY;Ap(C.view),bi(C),I.mouse=[U,this.__zoom.invert(U)],Fo(this),I.start();function W(Q){if(gr(Q),!I.moved){var le=Q.clientX-H,pe=Q.clientY-K;I.moved=le*le+pe*pe>y}I.event(Q).zoom("mouse",r(S(I.that.__zoom,I.mouse[0]=jt(Q,N),I.mouse[1]),I.extent,i))}function re(Q){z.on("mousemove.zoom mouseup.zoom",null),Mp(Q.view,I.moved),gr(Q),I.event(Q).end()}}function V(C,...L){if(e.apply(this,arguments)){var N=this.__zoom,I=jt(C.changedTouches?C.changedTouches[0]:C,this),z=N.invert(I),U=N.k*(C.shiftKey?.5:2),H=r(S(_(N,U),I,z),t.apply(this,L),i);gr(C),l>0?ct(this).transition().duration(l).call(k,H,I,C):ct(this).call(b.transform,H,I,C)}}function Z(C,...L){if(e.apply(this,arguments)){var N=C.touches,I=N.length,z=$(this,L,C.changedTouches.length===I).event(C),U,H,K,W;for(bi(C),H=0;H<I;++H)K=N[H],W=jt(K,this),W=[W,this.__zoom.invert(W),K.identifier],z.touch0?!z.touch1&&z.touch0[2]!==W[2]&&(z.touch1=W,z.taps=0):(z.touch0=W,U=!0,z.taps=1+!!m);m&&(m=clearTimeout(m)),U&&(z.taps<2&&(p=W[0],m=setTimeout(function(){m=null},h)),Fo(this),z.start())}}function O(C,...L){if(this.__zooming){var N=$(this,L).event(C),I=C.changedTouches,z=I.length,U,H,K,W;for(gr(C),U=0;U<z;++U)H=I[U],K=jt(H,this),N.touch0&&N.touch0[2]===H.identifier?N.touch0[0]=K:N.touch1&&N.touch1[2]===H.identifier&&(N.touch1[0]=K);if(H=N.that.__zoom,N.touch1){var re=N.touch0[0],Q=N.touch0[1],le=N.touch1[0],pe=N.touch1[1],oe=(oe=le[0]-re[0])*oe+(oe=le[1]-re[1])*oe,te=(te=pe[0]-Q[0])*te+(te=pe[1]-Q[1])*te;H=_(H,Math.sqrt(oe/te)),K=[(re[0]+le[0])/2,(re[1]+le[1])/2],W=[(Q[0]+pe[0])/2,(Q[1]+pe[1])/2]}else if(N.touch0)K=N.touch0[0],W=N.touch0[1];else return;N.zoom("touch",r(S(H,K,W),N.extent,i))}}function D(C,...L){if(this.__zooming){var N=$(this,L).event(C),I=C.changedTouches,z=I.length,U,H;for(bi(C),x&&clearTimeout(x),x=setTimeout(function(){x=null},h),U=0;U<z;++U)H=I[U],N.touch0&&N.touch0[2]===H.identifier?delete N.touch0:N.touch1&&N.touch1[2]===H.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(H=jt(H,this),Math.hypot(p[0]-H[0],p[1]-H[1])<E)){var K=ct(this).on("dblclick.zoom");K&&K.apply(this,arguments)}}}return b.wheelDelta=function(C){return arguments.length?(o=typeof C=="function"?C:bo(+C),b):o},b.filter=function(C){return arguments.length?(e=typeof C=="function"?C:bo(!!C),b):e},b.touchable=function(C){return arguments.length?(n=typeof C=="function"?C:bo(!!C),b):n},b.extent=function(C){return arguments.length?(t=typeof C=="function"?C:bo([[+C[0][0],+C[0][1]],[+C[1][0],+C[1][1]]]),b):t},b.scaleExtent=function(C){return arguments.length?(s[0]=+C[0],s[1]=+C[1],b):[s[0],s[1]]},b.translateExtent=function(C){return arguments.length?(i[0][0]=+C[0][0],i[1][0]=+C[1][0],i[0][1]=+C[0][1],i[1][1]=+C[1][1],b):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},b.constrain=function(C){return arguments.length?(r=C,b):r},b.duration=function(C){return arguments.length?(l=+C,b):l},b.interpolate=function(C){return arguments.length?(c=C,b):c},b.on=function(){var C=u.on.apply(u,arguments);return C===u?b:C},b.clickDistance=function(C){return arguments.length?(y=(C=+C)*C,b):Math.sqrt(y)},b.tapDistance=function(C){return arguments.length?(E=+C,b):E},b}const Qe={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:r,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?r:o}", 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."},Ir=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],qp=["Enter"," ","Escape"],Jp={"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:r})=>`Moved selected node ${e}. New position, x: ${t}, y: ${r}`,"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 vn;(function(e){e.Strict="strict",e.Loose="loose"})(vn||(vn={}));var fn;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(fn||(fn={}));var Jn;(function(e){e.Partial="partial",e.Full="full"})(Jn||(Jn={}));const Qp={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var qt;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(qt||(qt={}));var Nr;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Nr||(Nr={}));var ne;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ne||(ne={}));const Vu={[ne.Left]:ne.Right,[ne.Right]:ne.Left,[ne.Top]:ne.Bottom,[ne.Bottom]:ne.Top};function ef(e){return e===null?null:e?"valid":"invalid"}const tf=e=>"id"in e&&"source"in e&&"target"in e,f5=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),$a=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Hr=(e,t=[0,0])=>{const{width:r,height:o}=Ht(e),n=e.origin??t,s=r*n[0],i=o*n[1];return{x:e.position.x-s,y:e.position.y-i}},x5=(e,t={nodeOrigin:[0,0]})=>{if(process.env.NODE_ENV==="development"&&!t.nodeLookup&&console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((o,n)=>{const s=typeof n=="string";let i=!t.nodeLookup&&!s?n:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(n):$a(n)?n:t.nodeLookup.get(n.id));const l=i?Yo(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return _s(o,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ws(r)},Kr=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(o=>{if(t.filter===void 0||t.filter(o)){const n=Yo(o);r=_s(r,n)}}),ws(r)},Ia=(e,t,[r,o,n]=[0,0,1],s=!1,i=!1)=>{const l={...Yr(t,[r,o,n]),width:t.width/n,height:t.height/n},c=[];for(const u of e.values()){const{measured:m,selectable:p=!0,hidden:x=!1}=u;if(i&&!p||x)continue;const h=m.width??u.width??u.initialWidth??null,g=m.height??u.height??u.initialHeight??null,y=Tr(l,er(u)),E=(h??0)*(g??0),b=s&&y>0;(!u.internals.handleBounds||b||y>=E||u.dragging)&&c.push(u)}return c},h5=(e,t)=>{const r=new Set;return e.forEach(o=>{r.add(o.id)}),t.filter(o=>r.has(o.source)||r.has(o.target))};function g5(e,t){const r=new Map,o=t?.nodes?new Set(t.nodes.map(n=>n.id)):null;return e.forEach(n=>{n.measured.width&&n.measured.height&&(t?.includeHiddenNodes||!n.hidden)&&(!o||o.has(n.id))&&r.set(n.id,n)}),r}async function y5({nodes:e,width:t,height:r,panZoom:o,minZoom:n,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const l=g5(e,i),c=Kr(l),u=Na(c,t,r,i?.minZoom??n,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(u,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function nf({nodeId:e,nextPosition:t,nodeLookup:r,nodeOrigin:o=[0,0],nodeExtent:n,onError:s}){const i=r.get(e),l=i.parentId?r.get(i.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},m=i.origin??o;let p=i.extent||n;if(i.extent==="parent"&&!i.expandParent)if(!l)s?.("005",Qe.error005());else{const h=l.measured.width,g=l.measured.height;h&&g&&(p=[[c,u],[c+h,u+g]])}else l&&tr(i.extent)&&(p=[[i.extent[0][0]+c,i.extent[0][1]+u],[i.extent[1][0]+c,i.extent[1][1]+u]]);const x=tr(p)?jn(t,p,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",Qe.error015()),{position:{x:x.x-c+(i.measured.width??0)*m[0],y:x.y-u+(i.measured.height??0)*m[1]},positionAbsolute:x}}async function v5({nodesToRemove:e=[],edgesToRemove:t=[],nodes:r,edges:o,onBeforeDelete:n}){const s=new Set(e.map(x=>x.id)),i=[];for(const x of r){if(x.deletable===!1)continue;const h=s.has(x.id),g=!h&&x.parentId&&i.find(y=>y.id===x.parentId);(h||g)&&i.push(x)}const l=new Set(t.map(x=>x.id)),c=o.filter(x=>x.deletable!==!1),m=h5(i,c);for(const x of c)l.has(x.id)&&!m.find(g=>g.id===x.id)&&m.push(x);if(!n)return{edges:m,nodes:i};const p=await n({nodes:i,edges:m});return typeof p=="boolean"?p?{edges:m,nodes:i}:{edges:[],nodes:[]}:p}const Qn=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),jn=(e={x:0,y:0},t,r)=>({x:Qn(e.x,t[0][0],t[1][0]-(r?.width??0)),y:Qn(e.y,t[0][1],t[1][1]-(r?.height??0))});function rf(e,t,r){const{width:o,height:n}=Ht(r),{x:s,y:i}=r.internals.positionAbsolute;return jn(e,[[s,i],[s+o,i+n]],t)}const Hu=(e,t,r)=>e<t?Qn(Math.abs(e-t),1,t)/t:e>r?-Qn(Math.abs(e-r),1,t)/t:0,of=(e,t,r=15,o=40)=>{const n=Hu(e.x,o,t.width-o)*r,s=Hu(e.y,o,t.height-o)*r;return[n,s]},_s=(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)}),Gi=({x:e,y:t,width:r,height:o})=>({x:e,y:t,x2:e+r,y2:t+o}),ws=({x:e,y:t,x2:r,y2:o})=>({x:e,y:t,width:r-e,height:o-t}),er=(e,t=[0,0])=>{const{x:r,y:o}=$a(e)?e.internals.positionAbsolute:Hr(e,t);return{x:r,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Yo=(e,t=[0,0])=>{const{x:r,y:o}=$a(e)?e.internals.positionAbsolute:Hr(e,t);return{x:r,y:o,x2:r+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},sf=(e,t)=>ws(_s(Gi(e),Gi(t))),Tr=(e,t)=>{const r=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(r*o)},Ku=e=>Et(e.width)&&Et(e.height)&&Et(e.x)&&Et(e.y),Et=e=>!isNaN(e)&&isFinite(e),Wo=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},Gr=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Yr=({x:e,y:t},[r,o,n],s=!1,i=[1,1])=>{const l={x:(e-r)/n,y:(t-o)/n};return s?Gr(l,i):l},Xo=({x:e,y:t},[r,o,n])=>({x:e*n+r,y:t*n+o});function Zn(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(r)}if(typeof e=="string"&&e.endsWith("%")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(t*r*.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 j5(e,t,r){if(typeof e=="string"||typeof e=="number"){const o=Zn(e,r),n=Zn(e,t);return{top:o,right:n,bottom:o,left:n,x:n*2,y:o*2}}if(typeof e=="object"){const o=Zn(e.top??e.y??0,r),n=Zn(e.bottom??e.y??0,r),s=Zn(e.left??e.x??0,t),i=Zn(e.right??e.x??0,t);return{top:o,right:i,bottom:n,left:s,x:s+i,y:o+n}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function S5(e,t,r,o,n,s){const{x:i,y:l}=Xo(e,[t,r,o]),{x:c,y:u}=Xo({x:e.x+e.width,y:e.y+e.height},[t,r,o]),m=n-c,p=s-u;return{left:Math.floor(i),top:Math.floor(l),right:Math.floor(m),bottom:Math.floor(p)}}const Na=(e,t,r,o,n,s)=>{const i=j5(s,t,r),l=(t-i.x)/e.width,c=(r-i.y)/e.height,u=Math.min(l,c),m=Qn(u,o,n),p=e.x+e.width/2,x=e.y+e.height/2,h=t/2-p*m,g=r/2-x*m,y=S5(e,h,g,m,t,r),E={left:Math.min(y.left-i.left,0),top:Math.min(y.top-i.top,0),right:Math.min(y.right-i.right,0),bottom:Math.min(y.bottom-i.bottom,0)};return{x:h-E.left+E.right,y:g-E.top+E.bottom,zoom:m}},Or=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function tr(e){return e!=null&&e!=="parent"}function Ht(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function af(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function lf(e,t={width:0,height:0},r,o,n){const s={...e},i=o.get(r);if(i){const l=i.origin||n;s.x+=i.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}function Gu(e,t){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}function E5(){let e,t;return{promise:new Promise((o,n)=>{e=o,t=n}),resolve:e,reject:t}}function b5(e){return{...Jp,...e||{}}}function _r(e,{snapGrid:t=[0,0],snapToGrid:r=!1,transform:o,containerBounds:n}){const{x:s,y:i}=Ot(e),l=Yr({x:s-(n?.left??0),y:i-(n?.top??0)},o),{x:c,y:u}=r?Gr(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const Ta=e=>({width:e.offsetWidth,height:e.offsetHeight}),cf=e=>e?.getRootNode?.()||window?.document,R5=["INPUT","SELECT","TEXTAREA"];function uf(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:R5.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const df=e=>"clientX"in e,Ot=(e,t)=>{const r=df(e),o=r?e.clientX:e.touches?.[0].clientX,n=r?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:n-(t?.top??0)}},Yu=(e,t,r,o,n)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const l=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:n,position:i.getAttribute("data-handlepos"),x:(l.left-r.left)/o,y:(l.top-r.top)/o,...Ta(i)}})};function mf({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:n,sourceControlY:s,targetControlX:i,targetControlY:l}){const c=e*.125+n*.375+i*.375+r*.125,u=t*.125+s*.375+l*.375+o*.125,m=Math.abs(c-e),p=Math.abs(u-t);return[c,u,m,p]}function Ro(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wu({pos:e,x1:t,y1:r,x2:o,y2:n,c:s}){switch(e){case ne.Left:return[t-Ro(t-o,s),r];case ne.Right:return[t+Ro(o-t,s),r];case ne.Top:return[t,r-Ro(r-n,s)];case ne.Bottom:return[t,r+Ro(n-r,s)]}}function pf({sourceX:e,sourceY:t,sourcePosition:r=ne.Bottom,targetX:o,targetY:n,targetPosition:s=ne.Top,curvature:i=.25}){const[l,c]=Wu({pos:r,x1:e,y1:t,x2:o,y2:n,c:i}),[u,m]=Wu({pos:s,x1:o,y1:n,x2:e,y2:t,c:i}),[p,x,h,g]=mf({sourceX:e,sourceY:t,targetX:o,targetY:n,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:m});return[`M${e},${t} C${l},${c} ${u},${m} ${o},${n}`,p,x,h,g]}function ff({sourceX:e,sourceY:t,targetX:r,targetY:o}){const n=Math.abs(r-e)/2,s=r<e?r+n:r-n,i=Math.abs(o-t)/2,l=o<t?o+i:o-i;return[s,l,n,i]}function _5({sourceNode:e,targetNode:t,selected:r=!1,zIndex:o,elevateOnSelect:n=!1}){if(o!==void 0)return o;const s=n&&r?1e3:0,i=Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0);return s+i}function w5({sourceNode:e,targetNode:t,width:r,height:o,transform:n}){const s=_s(Yo(e),Yo(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-n[0]/n[2],y:-n[1]/n[2],width:r/n[2],height:o/n[2]};return Tr(i,ws(s))>0}const xf=({source:e,sourceHandle:t,target:r,targetHandle:o})=>`xy-edge__${e}${t||""}-${r}${o||""}`,C5=(e,t)=>t.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),hf=(e,t)=>{if(!e.source||!e.target)return Wo("006",Qe.error006()),t;let r;return tf(e)?r={...e}:r={...e,id:xf(e)},C5(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))},k5=(e,t,r,o={shouldReplaceId:!0})=>{const{id:n,...s}=e;if(!t.source||!t.target)return Wo("006",Qe.error006()),r;if(!r.find(c=>c.id===e.id))return Wo("007",Qe.error007(n)),r;const l={...s,id:o.shouldReplaceId?xf(t):n,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return r.filter(c=>c.id!==n).concat(l)};function gf({sourceX:e,sourceY:t,targetX:r,targetY:o}){const[n,s,i,l]=ff({sourceX:e,sourceY:t,targetX:r,targetY:o});return[`M ${e},${t}L ${r},${o}`,n,s,i,l]}const Xu={[ne.Left]:{x:-1,y:0},[ne.Right]:{x:1,y:0},[ne.Top]:{x:0,y:-1},[ne.Bottom]:{x:0,y:1}},$5=({source:e,sourcePosition:t=ne.Bottom,target:r})=>t===ne.Left||t===ne.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},qu=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function I5({source:e,sourcePosition:t=ne.Bottom,target:r,targetPosition:o=ne.Top,center:n,offset:s,stepPosition:i}){const l=Xu[t],c=Xu[o],u={x:e.x+l.x*s,y:e.y+l.y*s},m={x:r.x+c.x*s,y:r.y+c.y*s},p=$5({source:u,sourcePosition:t,target:m}),x=p.x!==0?"x":"y",h=p[x];let g=[],y,E;const b={x:0,y:0},_={x:0,y:0},[,,S,R]=ff({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(l[x]*c[x]===-1){x==="x"?(y=n.x??u.x+(m.x-u.x)*i,E=n.y??(u.y+m.y)/2):(y=n.x??(u.x+m.x)/2,E=n.y??u.y+(m.y-u.y)*i);const $=[{x:y,y:u.y},{x:y,y:m.y}],T=[{x:u.x,y:E},{x:m.x,y:E}];l[x]===h?g=x==="x"?$:T:g=x==="x"?T:$}else{const $=[{x:u.x,y:m.y}],T=[{x:m.x,y:u.y}];if(x==="x"?g=l.x===h?T:$:g=l.y===h?$:T,t===o){const O=Math.abs(e[x]-r[x]);if(O<=s){const D=Math.min(s-1,s-O);l[x]===h?b[x]=(u[x]>e[x]?-1:1)*D:_[x]=(m[x]>r[x]?-1:1)*D}}if(t!==o){const O=x==="x"?"y":"x",D=l[x]===c[O],C=u[O]>m[O],L=u[O]<m[O];(l[x]===1&&(!D&&C||D&&L)||l[x]!==1&&(!D&&L||D&&C))&&(g=x==="x"?$:T)}const M={x:u.x+b.x,y:u.y+b.y},A={x:m.x+_.x,y:m.y+_.y},V=Math.max(Math.abs(M.x-g[0].x),Math.abs(A.x-g[0].x)),Z=Math.max(Math.abs(M.y-g[0].y),Math.abs(A.y-g[0].y));V>=Z?(y=(M.x+A.x)/2,E=g[0].y):(y=g[0].x,E=(M.y+A.y)/2)}return[[e,{x:u.x+b.x,y:u.y+b.y},...g,{x:m.x+_.x,y:m.y+_.y},r],y,E,S,R]}function N5(e,t,r,o){const n=Math.min(qu(e,t)/2,qu(t,r)/2,o),{x:s,y:i}=t;if(e.x===s&&s===r.x||e.y===i&&i===r.y)return`L${s} ${i}`;if(e.y===i){const u=e.x<r.x?-1:1,m=e.y<r.y?1:-1;return`L ${s+n*u},${i}Q ${s},${i} ${s},${i+n*m}`}const l=e.x<r.x?1:-1,c=e.y<r.y?-1:1;return`L ${s},${i+n*c}Q ${s},${i} ${s+n*l},${i}`}function Yi({sourceX:e,sourceY:t,sourcePosition:r=ne.Bottom,targetX:o,targetY:n,targetPosition:s=ne.Top,borderRadius:i=5,centerX:l,centerY:c,offset:u=20,stepPosition:m=.5}){const[p,x,h,g,y]=I5({source:{x:e,y:t},sourcePosition:r,target:{x:o,y:n},targetPosition:s,center:{x:l,y:c},offset:u,stepPosition:m});return[p.reduce((b,_,S)=>{let R="";return S>0&&S<p.length-1?R=N5(p[S-1],_,p[S+1],i):R=`${S===0?"M":"L"}${_.x} ${_.y}`,b+=R,b},""),x,h,g,y]}function Ju(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function T5(e){const{sourceNode:t,targetNode:r}=e;if(!Ju(t)||!Ju(r))return null;const o=t.internals.handleBounds||Qu(t.handles),n=r.internals.handleBounds||Qu(r.handles),s=ed(o?.source??[],e.sourceHandle),i=ed(e.connectionMode===vn.Strict?n?.target??[]:(n?.target??[]).concat(n?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",Qe.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=s?.position||ne.Bottom,c=i?.position||ne.Top,u=Pr(t,s,l),m=Pr(r,i,c);return{sourceX:u.x,sourceY:u.y,targetX:m.x,targetY:m.y,sourcePosition:l,targetPosition:c}}function Qu(e){if(!e)return null;const t=[],r=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&r.push(o);return{source:t,target:r}}function Pr(e,t,r=ne.Left,o=!1){const n=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:l}=t??Ht(e);if(o)return{x:n+i/2,y:s+l/2};switch(t?.position??r){case ne.Top:return{x:n+i/2,y:s};case ne.Right:return{x:n+i,y:s+l/2};case ne.Bottom:return{x:n+i/2,y:s+l};case ne.Left:return{x:n,y:s+l/2}}}function ed(e,t){return e&&(t?e.find(r=>r.id===t):e[0])||null}function Wi(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function O5(e,{id:t,defaultColor:r,defaultMarkerStart:o,defaultMarkerEnd:n}){const s=new Set;return e.reduce((i,l)=>([l.markerStart||o,l.markerEnd||n].forEach(c=>{if(c&&typeof c=="object"){const u=Wi(c,t);s.has(u)||(i.push({id:u,color:c.color||r,...c}),s.add(u))}}),i),[]).sort((i,l)=>i.id.localeCompare(l.id))}const Oa={nodeOrigin:[0,0],nodeExtent:Ir,elevateNodesOnSelect:!0,defaults:{}},P5={...Oa,checkEquality:!0};function Pa(e,t){const r={...e};for(const o in t)t[o]!==void 0&&(r[o]=t[o]);return r}function L5(e,t,r){const o=Pa(Oa,r);for(const n of e.values())if(n.parentId)La(n,e,t,o);else{const s=Hr(n,o.nodeOrigin),i=tr(n.extent)?n.extent:o.nodeExtent,l=jn(s,i,Ht(n));n.internals.positionAbsolute=l}}function Xi(e,t,r,o){const n=Pa(P5,o);let s=e.length>0;const i=new Map(t),l=n?.elevateNodesOnSelect?1e3:0;t.clear(),r.clear();for(const c of e){let u=i.get(c.id);if(n.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const m=Hr(c,n.nodeOrigin),p=tr(c.extent)?c.extent:n.nodeExtent,x=jn(m,p,Ht(c));u={...n.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:x,handleBounds:c.measured?u?.internals.handleBounds:void 0,z:yf(c,l),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(s=!1),c.parentId&&La(u,t,r,o)}return s}function z5(e,t){if(!e.parentId)return;const r=t.get(e.parentId);r?r.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function La(e,t,r,o){const{elevateNodesOnSelect:n,nodeOrigin:s,nodeExtent:i}=Pa(Oa,o),l=e.parentId,c=t.get(l);if(!c){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}z5(e,r);const u=n?1e3:0,{x:m,y:p,z:x}=A5(e,c,s,i,u),{positionAbsolute:h}=e.internals,g=m!==h.x||p!==h.y;(g||x!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:g?{x:m,y:p}:h,z:x}})}function yf(e,t){return(Et(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function A5(e,t,r,o,n){const{x:s,y:i}=t.internals.positionAbsolute,l=Ht(e),c=Hr(e,r),u=tr(e.extent)?jn(c,e.extent,l):c;let m=jn({x:s+u.x,y:i+u.y},o,l);e.extent==="parent"&&(m=rf(m,l,t));const p=yf(e,n),x=t.internals.z??0;return{x:m.x,y:m.y,z:x>=p?x+1:p}}function za(e,t,r,o=[0,0]){const n=[],s=new Map;for(const i of e){const l=t.get(i.parentId);if(!l)continue;const c=s.get(i.parentId)?.expandedRect??er(l),u=sf(c,i.rect);s.set(i.parentId,{expandedRect:u,parent:l})}return s.size>0&&s.forEach(({expandedRect:i,parent:l},c)=>{const u=l.internals.positionAbsolute,m=Ht(l),p=l.origin??o,x=i.x<u.x?Math.round(Math.abs(u.x-i.x)):0,h=i.y<u.y?Math.round(Math.abs(u.y-i.y)):0,g=Math.max(m.width,Math.round(i.width)),y=Math.max(m.height,Math.round(i.height)),E=(g-m.width)*p[0],b=(y-m.height)*p[1];(x>0||h>0||E||b)&&(n.push({id:c,type:"position",position:{x:l.position.x-x+E,y:l.position.y-h+b}}),r.get(c)?.forEach(_=>{e.some(S=>S.id===_.id)||n.push({id:_.id,type:"position",position:{x:_.position.x+x,y:_.position.y+h}})})),(m.width<i.width||m.height<i.height||x||h)&&n.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:g+(x?p[0]*x-E:0),height:y+(h?p[1]*h-b:0)}})}),n}function M5(e,t,r,o,n,s){const i=o?.querySelector(".xyflow__viewport");let l=!1;if(!i)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(i),{m22:m}=new window.DOMMatrixReadOnly(u.transform),p=[];for(const x of e.values()){const h=t.get(x.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),l=!0;continue}const g=Ta(x.nodeElement),y=h.measured.width!==g.width||h.measured.height!==g.height;if(!!(g.width&&g.height&&(y||!h.internals.handleBounds||x.force))){const b=x.nodeElement.getBoundingClientRect(),_=tr(h.extent)?h.extent:s;let{positionAbsolute:S}=h.internals;h.parentId&&h.extent==="parent"?S=rf(S,g,t.get(h.parentId)):_&&(S=jn(S,_,g));const R={...h,measured:g,internals:{...h.internals,positionAbsolute:S,handleBounds:{source:Yu("source",x.nodeElement,b,m,h.id),target:Yu("target",x.nodeElement,b,m,h.id)}}};t.set(h.id,R),h.parentId&&La(R,t,r,{nodeOrigin:n}),l=!0,y&&(c.push({id:h.id,type:"dimensions",dimensions:g}),h.expandParent&&h.parentId&&p.push({id:h.id,parentId:h.parentId,rect:er(R,n)}))}}if(p.length>0){const x=za(p,t,r,n);c.push(...x)}return{changes:c,updatedInternals:l}}async function D5({delta:e,panZoom:t,transform:r,translateExtent:o,width:n,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[n,s]],o),l=!!i&&(i.x!==r[0]||i.y!==r[1]||i.k!==r[2]);return Promise.resolve(l)}function td(e,t,r,o,n,s){let i=n;const l=o.get(i)||new Map;o.set(i,l.set(r,t)),i=`${n}-${e}`;const c=o.get(i)||new Map;if(o.set(i,c.set(r,t)),s){i=`${n}-${e}-${s}`;const u=o.get(i)||new Map;o.set(i,u.set(r,t))}}function vf(e,t,r){e.clear(),t.clear();for(const o of r){const{source:n,target:s,sourceHandle:i=null,targetHandle:l=null}=o,c={edgeId:o.id,source:n,target:s,sourceHandle:i,targetHandle:l},u=`${n}-${i}--${s}-${l}`,m=`${s}-${l}--${n}-${i}`;td("source",c,m,e,n,i),td("target",c,u,e,s,l),t.set(o.id,o)}}function jf(e,t){if(!e.parentId)return!1;const r=t.get(e.parentId);return r?r.selected?!0:jf(r,t):!1}function nd(e,t,r){let o=e;do{if(o?.matches?.(t))return!0;if(o===r)return!1;o=o?.parentElement}while(o);return!1}function U5(e,t,r,o){const n=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!jf(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const l=e.get(s);l&&n.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:r.x-l.internals.positionAbsolute.x,y:r.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return n}function Ri({nodeId:e,dragItems:t,nodeLookup:r,dragging:o=!0}){const n=[];for(const[i,l]of t){const c=r.get(i)?.internals.userNode;c&&n.push({...c,position:l.position,dragging:o})}if(!e)return[n[0],n];const s=r.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:n[0],n]}function F5({dragItems:e,snapGrid:t,x:r,y:o}){const n=e.values().next().value;if(!n)return null;const s={x:r-n.distance.x,y:o-n.distance.y},i=Gr(s,t);return{x:i.x-s.x,y:i.y-s.y}}function B5({onNodeMouseDown:e,getStoreItems:t,onDragStart:r,onDrag:o,onDragStop:n}){let s={x:null,y:null},i=0,l=new Map,c=!1,u={x:0,y:0},m=null,p=!1,x=null,h=!1,g=!1,y=null;function E({noDragClassName:_,handleSelector:S,domNode:R,isSelectable:k,nodeId:$,nodeClickDistance:T=0}){x=ct(R);function M({x:O,y:D}){const{nodeLookup:C,nodeExtent:L,snapGrid:N,snapToGrid:I,nodeOrigin:z,onNodeDrag:U,onSelectionDrag:H,onError:K,updateNodePositions:W}=t();s={x:O,y:D};let re=!1;const Q=l.size>1,le=Q&&L?Gi(Kr(l)):null,pe=Q&&I?F5({dragItems:l,snapGrid:N,x:O,y:D}):null;for(const[oe,te]of l){if(!C.has(oe))continue;let ae={x:O-te.distance.x,y:D-te.distance.y};I&&(ae=pe?{x:Math.round(ae.x+pe.x),y:Math.round(ae.y+pe.y)}:Gr(ae,N));let we=null;if(Q&&L&&!te.extent&&le){const{positionAbsolute:je}=te.internals,he=je.x-le.x+L[0][0],Oe=je.x+te.measured.width-le.x2+L[1][0],We=je.y-le.y+L[0][1],ot=je.y+te.measured.height-le.y2+L[1][1];we=[[he,We],[Oe,ot]]}const{position:Te,positionAbsolute:me}=nf({nodeId:oe,nextPosition:ae,nodeLookup:C,nodeExtent:we||L,nodeOrigin:z,onError:K});re=re||te.position.x!==Te.x||te.position.y!==Te.y,te.position=Te,te.internals.positionAbsolute=me}if(g=g||re,!!re&&(W(l,!0),y&&(o||U||!$&&H))){const[oe,te]=Ri({nodeId:$,dragItems:l,nodeLookup:C});o?.(y,l,oe,te),U?.(y,oe,te),$||H?.(y,te)}}async function A(){if(!m)return;const{transform:O,panBy:D,autoPanSpeed:C,autoPanOnNodeDrag:L}=t();if(!L){c=!1,cancelAnimationFrame(i);return}const[N,I]=of(u,m,C);(N!==0||I!==0)&&(s.x=(s.x??0)-N/O[2],s.y=(s.y??0)-I/O[2],await D({x:N,y:I})&&M(s)),i=requestAnimationFrame(A)}function V(O){const{nodeLookup:D,multiSelectionActive:C,nodesDraggable:L,transform:N,snapGrid:I,snapToGrid:z,selectNodesOnDrag:U,onNodeDragStart:H,onSelectionDragStart:K,unselectNodesAndEdges:W}=t();p=!0,(!U||!k)&&!C&&$&&(D.get($)?.selected||W()),k&&U&&$&&e?.($);const re=_r(O.sourceEvent,{transform:N,snapGrid:I,snapToGrid:z,containerBounds:m});if(s=re,l=U5(D,L,re,$),l.size>0&&(r||H||!$&&K)){const[Q,le]=Ri({nodeId:$,dragItems:l,nodeLookup:D});r?.(O.sourceEvent,l,Q,le),H?.(O.sourceEvent,Q,le),$||K?.(O.sourceEvent,le)}}const Z=Dp().clickDistance(T).on("start",O=>{const{domNode:D,nodeDragThreshold:C,transform:L,snapGrid:N,snapToGrid:I}=t();m=D?.getBoundingClientRect()||null,h=!1,g=!1,y=O.sourceEvent,C===0&&V(O),s=_r(O.sourceEvent,{transform:L,snapGrid:N,snapToGrid:I,containerBounds:m}),u=Ot(O.sourceEvent,m)}).on("drag",O=>{const{autoPanOnNodeDrag:D,transform:C,snapGrid:L,snapToGrid:N,nodeDragThreshold:I,nodeLookup:z}=t(),U=_r(O.sourceEvent,{transform:C,snapGrid:L,snapToGrid:N,containerBounds:m});if(y=O.sourceEvent,(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1||$&&!z.has($))&&(h=!0),!h){if(!c&&D&&p&&(c=!0,A()),!p){const H=U.xSnapped-(s.x??0),K=U.ySnapped-(s.y??0);Math.sqrt(H*H+K*K)>I&&V(O)}(s.x!==U.xSnapped||s.y!==U.ySnapped)&&l&&p&&(u=Ot(O.sourceEvent,m),M(U))}}).on("end",O=>{if(!(!p||h)&&(c=!1,p=!1,cancelAnimationFrame(i),l.size>0)){const{nodeLookup:D,updateNodePositions:C,onNodeDragStop:L,onSelectionDragStop:N}=t();if(g&&(C(l,!1),g=!1),n||L||!$&&N){const[I,z]=Ri({nodeId:$,dragItems:l,nodeLookup:D,dragging:!1});n?.(O.sourceEvent,l,I,z),L?.(O.sourceEvent,I,z),$||N?.(O.sourceEvent,z)}}}).filter(O=>{const D=O.target;return!O.button&&(!_||!nd(D,`.${_}`,R))&&(!S||nd(D,S,R))});x.call(Z)}function b(){x?.on(".drag",null)}return{update:E,destroy:b}}function Z5(e,t,r){const o=[],n={x:e.x-r,y:e.y-r,width:r*2,height:r*2};for(const s of t.values())Tr(n,er(s))>0&&o.push(s);return o}const V5=250;function H5(e,t,r,o){let n=[],s=1/0;const i=Z5(e,r,t+V5);for(const l of i){const c=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(const u of c){if(o.nodeId===u.nodeId&&o.type===u.type&&o.id===u.id)continue;const{x:m,y:p}=Pr(l,u,u.position,!0),x=Math.sqrt(Math.pow(m-e.x,2)+Math.pow(p-e.y,2));x>t||(x<s?(n=[{...u,x:m,y:p}],s=x):x===s&&n.push({...u,x:m,y:p}))}}if(!n.length)return null;if(n.length>1){const l=o.type==="source"?"target":"source";return n.find(c=>c.type===l)??n[0]}return n[0]}function Sf(e,t,r,o,n,s=!1){const i=o.get(e);if(!i)return null;const l=n==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],c=(r?l?.find(u=>u.id===r):l?.[0])??null;return c&&s?{...c,...Pr(i,c,c.position,!0)}:c}function Ef(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function K5(e,t){let r=null;return t?r=!0:e&&!t&&(r=!1),r}const bf=()=>!0;function G5(e,{connectionMode:t,connectionRadius:r,handleId:o,nodeId:n,edgeUpdaterType:s,isTarget:i,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:m,flowId:p,panBy:x,cancelConnection:h,onConnectStart:g,onConnect:y,onConnectEnd:E,isValidConnection:b=bf,onReconnectEnd:_,updateConnection:S,getTransform:R,getFromHandle:k,autoPanSpeed:$,dragThreshold:T=1,handleDomNode:M}){const A=cf(e.target);let V=0,Z;const{x:O,y:D}=Ot(e),C=Ef(s,M),L=l?.getBoundingClientRect();let N=!1;if(!L||!C)return;const I=Sf(n,C,o,c,t);if(!I)return;let z=Ot(e,L),U=!1,H=null,K=!1,W=null;function re(){if(!m||!L)return;const[Te,me]=of(z,L,$);x({x:Te,y:me}),V=requestAnimationFrame(re)}const Q={...I,nodeId:n,type:C,position:I.position},le=c.get(n);let oe={inProgress:!0,isValid:null,from:Pr(le,Q,ne.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:le,to:z,toHandle:null,toPosition:Vu[Q.position],toNode:null};function te(){N=!0,S(oe),g?.(e,{nodeId:n,handleId:o,handleType:C})}T===0&&te();function ae(Te){if(!N){const{x:Oe,y:We}=Ot(Te),ot=Oe-O,At=We-D;if(!(ot*ot+At*At>T*T))return;te()}if(!k()||!Q){we(Te);return}const me=R();z=Ot(Te,L),Z=H5(Yr(z,me,!1,[1,1]),r,c,Q),U||(re(),U=!0);const je=Rf(Te,{handle:Z,connectionMode:t,fromNodeId:n,fromHandleId:o,fromType:i?"target":"source",isValidConnection:b,doc:A,lib:u,flowId:p,nodeLookup:c});W=je.handleDomNode,H=je.connection,K=K5(!!Z,je.isValid);const he={...oe,isValid:K,to:je.toHandle&&K?Xo({x:je.toHandle.x,y:je.toHandle.y},me):z,toHandle:je.toHandle,toPosition:K&&je.toHandle?je.toHandle.position:Vu[Q.position],toNode:je.toHandle?c.get(je.toHandle.nodeId):null};K&&Z&&oe.toHandle&&he.toHandle&&oe.toHandle.type===he.toHandle.type&&oe.toHandle.nodeId===he.toHandle.nodeId&&oe.toHandle.id===he.toHandle.id&&oe.to.x===he.to.x&&oe.to.y===he.to.y||(S(he),oe=he)}function we(Te){if(N){(Z||W)&&H&&K&&y?.(H);const{inProgress:me,...je}=oe,he={...je,toPosition:oe.toHandle?oe.toPosition:null};E?.(Te,he),s&&_?.(Te,he)}h(),cancelAnimationFrame(V),U=!1,K=!1,H=null,W=null,A.removeEventListener("mousemove",ae),A.removeEventListener("mouseup",we),A.removeEventListener("touchmove",ae),A.removeEventListener("touchend",we)}A.addEventListener("mousemove",ae),A.addEventListener("mouseup",we),A.addEventListener("touchmove",ae),A.addEventListener("touchend",we)}function Rf(e,{handle:t,connectionMode:r,fromNodeId:o,fromHandleId:n,fromType:s,doc:i,lib:l,flowId:c,isValidConnection:u=bf,nodeLookup:m}){const p=s==="target",x=t?i.querySelector(`.${l}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=Ot(e),y=i.elementFromPoint(h,g),E=y?.classList.contains(`${l}-flow__handle`)?y:x,b={handleDomNode:E,isValid:!1,connection:null,toHandle:null};if(E){const _=Ef(void 0,E),S=E.getAttribute("data-nodeid"),R=E.getAttribute("data-handleid"),k=E.classList.contains("connectable"),$=E.classList.contains("connectableend");if(!S||!_)return b;const T={source:p?S:o,sourceHandle:p?R:n,target:p?o:S,targetHandle:p?n:R};b.connection=T;const A=k&&$&&(r===vn.Strict?p&&_==="source"||!p&&_==="target":S!==o||R!==n);b.isValid=A&&u(T),b.toHandle=Sf(S,_,R,m,r,!0)}return b}const qi={onPointerDown:G5,isValid:Rf};function Y5({domNode:e,panZoom:t,getTransform:r,getViewScale:o}){const n=ct(e);function s({translateExtent:l,width:c,height:u,zoomStep:m=1,pannable:p=!0,zoomable:x=!0,inversePan:h=!1}){const g=S=>{if(S.sourceEvent.type!=="wheel"||!t)return;const R=r(),k=S.sourceEvent.ctrlKey&&Or()?10:1,$=-S.sourceEvent.deltaY*(S.sourceEvent.deltaMode===1?.05:S.sourceEvent.deltaMode?1:.002)*m,T=R[2]*Math.pow(2,$*k);t.scaleTo(T)};let y=[0,0];const E=S=>{(S.sourceEvent.type==="mousedown"||S.sourceEvent.type==="touchstart")&&(y=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY])},b=S=>{const R=r();if(S.sourceEvent.type!=="mousemove"&&S.sourceEvent.type!=="touchmove"||!t)return;const k=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY],$=[k[0]-y[0],k[1]-y[1]];y=k;const T=o()*Math.max(R[2],Math.log(R[2]))*(h?-1:1),M={x:R[0]-$[0]*T,y:R[1]-$[1]*T},A=[[0,0],[c,u]];t.setViewportConstrained({x:M.x,y:M.y,zoom:R[2]},A,l)},_=Xp().on("start",E).on("zoom",p?b:null).on("zoom.wheel",x?g:null);n.call(_,{})}function i(){n.on("zoom",null)}return{update:s,destroy:i,pointer:jt}}const W5=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Cs=e=>({x:e.x,y:e.y,zoom:e.k}),_i=({x:e,y:t,zoom:r})=>Rs.translate(e,t).scale(r),Hn=(e,t)=>e.target.closest(`.${t}`),_f=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),X5=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,wi=(e,t=0,r=X5,o=()=>{})=>{const n=typeof t=="number"&&t>0;return n||o(),n?e.transition().duration(t).ease(r).on("end",o):e},wf=e=>{const t=e.ctrlKey&&Or()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function q5({zoomPanValues:e,noWheelClassName:t,d3Selection:r,d3Zoom:o,panOnScrollMode:n,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return m=>{if(Hn(m,t))return!1;m.preventDefault(),m.stopImmediatePropagation();const p=r.property("__zoom").k||1;if(m.ctrlKey&&i){const E=jt(m),b=wf(m),_=p*Math.pow(2,b);o.scaleTo(r,_,E,m);return}const x=m.deltaMode===1?20:1;let h=n===fn.Vertical?0:m.deltaX*x,g=n===fn.Horizontal?0:m.deltaY*x;!Or()&&m.shiftKey&&n!==fn.Vertical&&(h=m.deltaY*x,g=0),o.translateBy(r,-(h/p)*s,-(g/p)*s,{internal:!0});const y=Cs(r.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,l?.(m,y)),e.isPanScrolling&&(c?.(m,y),e.panScrollTimeout=setTimeout(()=>{u?.(m,y),e.isPanScrolling=!1},150))}}function J5({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:r}){return function(o,n){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,l=Hn(o,e);if(o.ctrlKey&&s&&l&&o.preventDefault(),i||l)return null;o.preventDefault(),r.call(this,o,n)}}function Q5({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:r}){return o=>{if(o.sourceEvent?.internal)return;const n=Cs(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=n,o.sourceEvent?.type==="mousedown"&&t(!0),r&&r?.(o.sourceEvent,n)}}function e_({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:r,onTransformChange:o,onPanZoom:n}){return s=>{e.usedRightMouseButton=!!(r&&_f(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),n&&!s.sourceEvent?.internal&&n?.(s.sourceEvent,Cs(s.transform))}}function t_({zoomPanValues:e,panOnDrag:t,panOnScroll:r,onDraggingChange:o,onPanZoomEnd:n,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&_f(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),n&&W5(e.prevViewport,i.transform))){const l=Cs(i.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{n?.(i.sourceEvent,l)},r?150:0)}}}function n_({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:r,panOnDrag:o,panOnScroll:n,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:l,noPanClassName:c,lib:u}){return m=>{const p=e||t,x=r&&m.ctrlKey;if(m.button===1&&m.type==="mousedown"&&(Hn(m,`${u}-flow__node`)||Hn(m,`${u}-flow__edge`)))return!0;if(!o&&!p&&!n&&!s&&!r||i||Hn(m,l)&&m.type==="wheel"||Hn(m,c)&&(m.type!=="wheel"||n&&m.type==="wheel"&&!e)||!r&&m.ctrlKey&&m.type==="wheel")return!1;if(!r&&m.type==="touchstart"&&m.touches?.length>1)return m.preventDefault(),!1;if(!p&&!n&&!x&&m.type==="wheel"||!o&&(m.type==="mousedown"||m.type==="touchstart")||Array.isArray(o)&&!o.includes(m.button)&&m.type==="mousedown")return!1;const h=Array.isArray(o)&&o.includes(m.button)||!m.button||m.button<=1;return(!m.ctrlKey||m.type==="wheel")&&h}}function r_({domNode:e,minZoom:t,maxZoom:r,paneClickDistance:o,translateExtent:n,viewport:s,onPanZoom:i,onPanZoomStart:l,onPanZoomEnd:c,onDraggingChange:u}){const m={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),x=Xp().clickDistance(!Et(o)||o<0?0:o).scaleExtent([t,r]).translateExtent(n),h=ct(e).call(x);S({x:s.x,y:s.y,zoom:Qn(s.zoom,t,r)},[[0,0],[p.width,p.height]],n);const g=h.on("wheel.zoom"),y=h.on("dblclick.zoom");x.wheelDelta(wf);function E(O,D){return h?new Promise(C=>{x?.interpolate(D?.interpolate==="linear"?B.interpolate:Mo).transform(wi(h,D?.duration,D?.ease,()=>C(!0)),O)}):Promise.resolve(!1)}function b({noWheelClassName:O,noPanClassName:D,onPaneContextMenu:C,userSelectionActive:L,panOnScroll:N,panOnDrag:I,panOnScrollMode:z,panOnScrollSpeed:U,preventScrolling:H,zoomOnPinch:K,zoomOnScroll:W,zoomOnDoubleClick:re,zoomActivationKeyPressed:Q,lib:le,onTransformChange:pe}){L&&!m.isZoomingOrPanning&&_();const te=N&&!Q&&!L?q5({zoomPanValues:m,noWheelClassName:O,d3Selection:h,d3Zoom:x,panOnScrollMode:z,panOnScrollSpeed:U,zoomOnPinch:K,onPanZoomStart:l,onPanZoom:i,onPanZoomEnd:c}):J5({noWheelClassName:O,preventScrolling:H,d3ZoomHandler:g});if(h.on("wheel.zoom",te,{passive:!1}),!L){const we=Q5({zoomPanValues:m,onDraggingChange:u,onPanZoomStart:l});x.on("start",we);const Te=e_({zoomPanValues:m,panOnDrag:I,onPaneContextMenu:!!C,onPanZoom:i,onTransformChange:pe});x.on("zoom",Te);const me=t_({zoomPanValues:m,panOnDrag:I,panOnScroll:N,onPaneContextMenu:C,onPanZoomEnd:c,onDraggingChange:u});x.on("end",me)}const ae=n_({zoomActivationKeyPressed:Q,panOnDrag:I,zoomOnScroll:W,panOnScroll:N,zoomOnDoubleClick:re,zoomOnPinch:K,userSelectionActive:L,noPanClassName:D,noWheelClassName:O,lib:le});x.filter(ae),re?h.on("dblclick.zoom",y):h.on("dblclick.zoom",null)}function _(){x.on("zoom",null)}async function S(O,D,C){const L=_i(O),N=x?.constrain()(L,D,C);return N&&await E(N),new Promise(I=>I(N))}async function R(O,D){const C=_i(O);return await E(C,D),new Promise(L=>L(C))}function k(O){if(h){const D=_i(O),C=h.property("__zoom");(C.k!==O.zoom||C.x!==O.x||C.y!==O.y)&&x?.transform(h,D,null,{sync:!0})}}function $(){const O=h?Wp(h.node()):{x:0,y:0,k:1};return{x:O.x,y:O.y,zoom:O.k}}function T(O,D){return h?new Promise(C=>{x?.interpolate(D?.interpolate==="linear"?B.interpolate:Mo).scaleTo(wi(h,D?.duration,D?.ease,()=>C(!0)),O)}):Promise.resolve(!1)}function M(O,D){return h?new Promise(C=>{x?.interpolate(D?.interpolate==="linear"?B.interpolate:Mo).scaleBy(wi(h,D?.duration,D?.ease,()=>C(!0)),O)}):Promise.resolve(!1)}function A(O){x?.scaleExtent(O)}function V(O){x?.translateExtent(O)}function Z(O){const D=!Et(O)||O<0?0:O;x?.clickDistance(D)}return{update:b,destroy:_,setViewport:R,setViewportConstrained:S,getViewport:$,scaleTo:T,scaleBy:M,setScaleExtent:A,setTranslateExtent:V,syncViewport:k,setClickDistance:Z}}var nr;(function(e){e.Line="line",e.Handle="handle"})(nr||(nr={}));function o_({width:e,prevWidth:t,height:r,prevHeight:o,affectsX:n,affectsY:s}){const i=e-t,l=r-o,c=[i>0?1:i<0?-1:0,l>0?1:l<0?-1:0];return i&&n&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}function s_(e){const t=e.includes("right")||e.includes("left"),r=e.includes("bottom")||e.includes("top"),o=e.includes("left"),n=e.includes("top");return{isHorizontal:t,isVertical:r,affectsX:o,affectsY:n}}function Yt(e,t){return Math.max(0,t-e)}function Wt(e,t){return Math.max(0,e-t)}function _o(e,t,r){return Math.max(0,t-e,e-r)}function rd(e,t){return e?!t:t}function i_(e,t,r,o,n,s,i,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:m,isVertical:p}=t,x=m&&p,{xSnapped:h,ySnapped:g}=r,{minWidth:y,maxWidth:E,minHeight:b,maxHeight:_}=o,{x:S,y:R,width:k,height:$,aspectRatio:T}=e;let M=Math.floor(m?h-e.pointerX:0),A=Math.floor(p?g-e.pointerY:0);const V=k+(c?-M:M),Z=$+(u?-A:A),O=-s[0]*k,D=-s[1]*$;let C=_o(V,y,E),L=_o(Z,b,_);if(i){let z=0,U=0;c&&M<0?z=Yt(S+M+O,i[0][0]):!c&&M>0&&(z=Wt(S+V+O,i[1][0])),u&&A<0?U=Yt(R+A+D,i[0][1]):!u&&A>0&&(U=Wt(R+Z+D,i[1][1])),C=Math.max(C,z),L=Math.max(L,U)}if(l){let z=0,U=0;c&&M>0?z=Wt(S+M,l[0][0]):!c&&M<0&&(z=Yt(S+V,l[1][0])),u&&A>0?U=Wt(R+A,l[0][1]):!u&&A<0&&(U=Yt(R+Z,l[1][1])),C=Math.max(C,z),L=Math.max(L,U)}if(n){if(m){const z=_o(V/T,b,_)*T;if(C=Math.max(C,z),i){let U=0;!c&&!u||c&&!u&&x?U=Wt(R+D+V/T,i[1][1])*T:U=Yt(R+D+(c?M:-M)/T,i[0][1])*T,C=Math.max(C,U)}if(l){let U=0;!c&&!u||c&&!u&&x?U=Yt(R+V/T,l[1][1])*T:U=Wt(R+(c?M:-M)/T,l[0][1])*T,C=Math.max(C,U)}}if(p){const z=_o(Z*T,y,E)/T;if(L=Math.max(L,z),i){let U=0;!c&&!u||u&&!c&&x?U=Wt(S+Z*T+O,i[1][0])/T:U=Yt(S+(u?A:-A)*T+O,i[0][0])/T,L=Math.max(L,U)}if(l){let U=0;!c&&!u||u&&!c&&x?U=Yt(S+Z*T,l[1][0])/T:U=Wt(S+(u?A:-A)*T,l[0][0])/T,L=Math.max(L,U)}}}A=A+(A<0?L:-L),M=M+(M<0?C:-C),n&&(x?V>Z*T?A=(rd(c,u)?-M:M)/T:M=(rd(c,u)?-A:A)*T:m?(A=M/T,u=c):(M=A*T,c=u));const N=c?S+M:S,I=u?R+A:R;return{width:k+(c?-M:M),height:$+(u?-A:A),x:s[0]*M*(c?-1:1)+N,y:s[1]*A*(u?-1:1)+I}}const Cf={width:0,height:0,x:0,y:0},a_={...Cf,pointerX:0,pointerY:0,aspectRatio:1};function l_(e){return[[0,0],[e.measured.width,e.measured.height]]}function c_(e,t,r){const o=t.position.x+e.position.x,n=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,l=r[0]*s,c=r[1]*i;return[[o-l,n-c],[o+s-l,n+i-c]]}function u_({domNode:e,nodeId:t,getStoreItems:r,onChange:o,onEnd:n}){const s=ct(e);function i({controlPosition:c,boundaries:u,keepAspectRatio:m,resizeDirection:p,onResizeStart:x,onResize:h,onResizeEnd:g,shouldResize:y}){let E={...Cf},b={...a_};const _=s_(c);let S,R=null,k=[],$,T,M;const A=Dp().on("start",V=>{const{nodeLookup:Z,transform:O,snapGrid:D,snapToGrid:C,nodeOrigin:L,paneDomNode:N}=r();if(S=Z.get(t),!S)return;R=N?.getBoundingClientRect()??null;const{xSnapped:I,ySnapped:z}=_r(V.sourceEvent,{transform:O,snapGrid:D,snapToGrid:C,containerBounds:R});E={width:S.measured.width??0,height:S.measured.height??0,x:S.position.x??0,y:S.position.y??0},b={...E,pointerX:I,pointerY:z,aspectRatio:E.width/E.height},$=void 0,S.parentId&&(S.extent==="parent"||S.expandParent)&&($=Z.get(S.parentId),T=$&&S.extent==="parent"?l_($):void 0),k=[],M=void 0;for(const[U,H]of Z)if(H.parentId===t&&(k.push({id:U,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const K=c_(H,S,H.origin??L);M?M=[[Math.min(K[0][0],M[0][0]),Math.min(K[0][1],M[0][1])],[Math.max(K[1][0],M[1][0]),Math.max(K[1][1],M[1][1])]]:M=K}x?.(V,{...E})}).on("drag",V=>{const{transform:Z,snapGrid:O,snapToGrid:D,nodeOrigin:C}=r(),L=_r(V.sourceEvent,{transform:Z,snapGrid:O,snapToGrid:D,containerBounds:R}),N=[];if(!S)return;const{x:I,y:z,width:U,height:H}=E,K={},W=S.origin??C,{width:re,height:Q,x:le,y:pe}=i_(b,_,L,u,m,W,T,M),oe=re!==U,te=Q!==H,ae=le!==I&&oe,we=pe!==z&&te;if(!ae&&!we&&!oe&&!te)return;if((ae||we||W[0]===1||W[1]===1)&&(K.x=ae?le:E.x,K.y=we?pe:E.y,E.x=K.x,E.y=K.y,k.length>0)){const he=le-I,Oe=pe-z;for(const We of k)We.position={x:We.position.x-he+W[0]*(re-U),y:We.position.y-Oe+W[1]*(Q-H)},N.push(We)}if((oe||te)&&(K.width=oe&&(!p||p==="horizontal")?re:E.width,K.height=te&&(!p||p==="vertical")?Q:E.height,E.width=K.width,E.height=K.height),$&&S.expandParent){const he=W[0]*(K.width??0);K.x&&K.x<he&&(E.x=he,b.x=b.x-(K.x-he));const Oe=W[1]*(K.height??0);K.y&&K.y<Oe&&(E.y=Oe,b.y=b.y-(K.y-Oe))}const Te=o_({width:E.width,prevWidth:U,height:E.height,prevHeight:H,affectsX:_.affectsX,affectsY:_.affectsY}),me={...E,direction:Te};y?.(V,me)!==!1&&(h?.(V,me),o(K,N))}).on("end",V=>{g?.(V,{...E}),n?.({...E})});s.call(A)}function l(){s.on(".drag",null)}return{update:i,destroy:l}}var wo={exports:{}},Ci={},Co={exports:{}},ki={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./main-Bg0vBNCG.cjs"),a=require("./jsx-runtime-Dszzpdy0.cjs"),d=require("./css-B0VZnJIa.cjs"),B=require("./provider-CWezGpoq.cjs"),v=require("react"),rp=require("react-dom"),op=require("./Toggle-C0DIo816.cjs"),Se=require("./external-Cutp76YR.cjs"),j=require("./provider-Fw6FIHoE.cjs"),Be=require("./external-DS6CmLLZ.cjs"),ce=require("zod"),sp=require("./external-DEYDSJ_G.cjs"),Je=require("./external-Zuxgy86I.cjs"),ys=require("./external-DP8Ao5TN.cjs"),c2=require("./external-D8EUzT1C.cjs"),ip=require("./units-gFJ6UvpU.cjs"),u2=require("./external-V3s19XkB.cjs"),d2=require("./external-FJ3vTUtb.cjs"),m2=require("./external-CQpqJGka.cjs"),p2=require("./external-BoVr9B-m.cjs"),Ze=require("./external-BmxkwvZQ.cjs"),f2=require("./external-BP7GC2X2.cjs"),x2=require("./external-CmmZWsrB.cjs"),h2=require("./Video-DqumxMbz.cjs"),g2=e=>e.nullable().transform(t=>t===null?void 0:t).optional(),y2=e=>ce.array(e).or(e.transform(t=>[t])),ap=e=>j.g(e,(t,r,o)=>{const n=r===o.length-1,s=!isNaN(parseInt(t)),i=!isNaN(parseInt(o[r+1]));return s&&(t="element"),n||i?t:[t,"shape"]}),Nu=(e,t)=>{if(e==null)return null;const r=e[t];return r==null&&typeof e=="object"&&"sourceType"in e?e.sourceType()[t]:r},v2=((e,t,r)=>t===""?e:j.h(Nu(e,"shape"),ap(t),{...r,getter:Nu})),j2=Object.freeze(Object.defineProperty({__proto__:null,getFieldSchema:v2,getFieldSchemaPath:ap,nullToUndefined:g2,toArray:y2},Symbol.toStringTag,{value:"Module"})),lp=Symbol(),ya=Symbol(),xr="a",zo="w";let S2=(e,t)=>new Proxy(e,t);const Mi=Object.getPrototypeOf,Tu=new WeakMap,va=e=>e&&(Tu.has(e)?Tu.get(e):Mi(e)===Object.prototype||Mi(e)===Array.prototype),Ou=e=>typeof e=="object"&&e!==null,Pu=new WeakMap,cp=e=>e[ya]||e,up=(e,t,r)=>{if(!va(e))return e;const o=cp(e),n=(i=>Object.isFrozen(i)||Object.values(Object.getOwnPropertyDescriptors(i)).some(l=>!l.writable))(o);let s=r&&r.get(o);return s&&s[1].f===n||(s=((i,l)=>{const c={f:l};let u=!1;const m=(x,h)=>{if(!u){let g=c[xr].get(i);if(g||(g={},c[xr].set(i,g)),x===zo)g[zo]=!0;else{let y=g[x];y||(y=new Set,g[x]=y),y.add(h)}}},p={get:(x,h)=>h===ya?i:(m("k",h),up(Reflect.get(x,h),c[xr],c.c)),has:(x,h)=>h===lp?(u=!0,c[xr].delete(i),!0):(m("h",h),Reflect.has(x,h)),getOwnPropertyDescriptor:(x,h)=>(m("o",h),Reflect.getOwnPropertyDescriptor(x,h)),ownKeys:x=>(m(zo),Reflect.ownKeys(x))};return l&&(p.set=p.deleteProperty=()=>!1),[p,c]})(o,n),s[1].p=S2(n?(i=>{let l=Pu.get(i);if(!l){if(Array.isArray(i))l=Array.from(i);else{const c=Object.getOwnPropertyDescriptors(i);Object.values(c).forEach(u=>{u.configurable=!0}),l=Object.create(Mi(i),c)}Pu.set(i,l)}return l})(o):o,s[0]),r&&r.set(o,s)),s[1][xr]=t,s[1].c=r,s[1].p},dp=(e,t,r,o)=>{if(Object.is(e,t))return!1;if(!Ou(e)||!Ou(t))return!0;const n=r.get(cp(e));if(!n)return!0;if(o){const i=o.get(e);if(i&&i.n===t)return i.g;o.set(e,{n:t,g:!1})}let s=null;try{for(const i of n.h||[])if(s=Reflect.has(e,i)!==Reflect.has(t,i),s)return s;if(n[zo]===!0){if(s=((i,l)=>{const c=Reflect.ownKeys(i),u=Reflect.ownKeys(l);return c.length!==u.length||c.some((m,p)=>m!==u[p])})(e,t),s)return s}else for(const i of n.o||[])if(s=!!Reflect.getOwnPropertyDescriptor(e,i)!=!!Reflect.getOwnPropertyDescriptor(t,i),s)return s;for(const i of n.k||[])if(s=dp(e[i],t[i],r,o),s)return s;return s===null&&(s=!0),s}finally{o&&o.set(e,{n:t,g:s})}},E2=e=>!!va(e)&&lp in e,mp=e=>va(e)&&e[ya]||null,b2="h",R2="w",_2="o",w2="k",Di=e=>typeof e=="object"&&e!==null,pp=(e,t)=>{if(!Di(e))return e;const r=mp(e);return r!==null?(E2(e),r):(t.has(e)||(t.add(e),Object.entries(e).forEach(([o,n])=>{const s=pp(n,t);Object.is(s,n)||(e[o]=s)})),e)},Ui=(e,t,r)=>{var o,n,s;if(!Di(e)||!Di(t))return;const i=r.get(mp(t)||t);i&&((o=i[b2])==null||o.forEach(l=>{Reflect.has(e,l)}),i[R2]===!0&&Reflect.ownKeys(e),(n=i[_2])==null||n.forEach(l=>{Reflect.getOwnPropertyDescriptor(e,l)}),(s=i[w2])==null||s.forEach(l=>{Ui(e[l],t[l],r)}))},hi="o",gi="r",yi="a";function C2(e,t){var r;let o=0;const n=(r=t?.size)!=null?r:1,s=[],i=t!=null&&t.noWeakMap?null:new WeakMap;return c=>{const u=i?.get(c);if(u)return u[gi];for(let g=0;g<n;g+=1){const y=s[(o+g)%n];if(!y)break;if(!dp(y[hi],c,y[yi],new WeakMap))return Ui(c,y[hi],y[yi]),i?.set(c,y),y[gi]}const m=new WeakMap,p=up(c,m),x=pp(e(p),new Set);Ui(c,c,m);const h={[hi]:c,[gi]:x,[yi]:m};return o=(o-1+n)%n,s[o]=h,i?.set(c,h),x}}const k2=(e,t)=>d.S.RUNTIME==="browser"?C2(e,t):e,$n=(e,t)=>{v.useEffect(()=>{const r=new AbortController,o=r.signal,s=(async()=>(await d.Ur(),await e(o)))().catch(console.error);return()=>{r.abort(),s.then(i=>i?.()).catch(console.error)}},t)},$2=Object.freeze(Object.defineProperty({__proto__:null,Access:f.Access,Acquire:f.Acquire,Add:f.Add,Align:f.Align,Analyze:f.Analyze,Annotate:f.Annotate,Annotation:f.Annotation,Arc:f.Arc,Array:f.Array,Arrow:f.Arrow,Attachment:f.Attachment,Auto:f.Auto,AutoFitWidth:f.AutoFitWidth,Binary:f.Binary,Bolt:f.Bolt,Boolean:f.Boolean$1,Box:f.Box$1,Bridge:f.Bridge,CSV:f.CSV,Calculation:f.Calculation,Calendar:f.Calendar,Caret:f.Caret,Channel:f.Channel,Check:f.Check,Circle:f.Circle,Click:f.Click,Close:f.Close,Cluster:f.Cluster,Commit:f.Commit,Completed:f.Completed,Concepts:f.Concepts,Connect:f.Connect,Constant:f.Constant,Control:f.Control,Copy:f.Copy,DarkMode:f.DarkMode,Decimal:f.Decimal,Delete:f.Delete,Details:f.Details,Device:f.Device,Disable:f.Disable,Disconnect:f.Disconnect,Download:f.Download,Downsample:f.Downsample,Drag:f.Drag,Dynamic:f.Dynamic,Edit:f.Edit,EditOff:f.EditOff,Enable:f.Enable,Expand:f.Expand,Explore:f.Explore,Export:f.Export,False:f.False,Feedback:f.Feedback,FillColor:f.FillColor,Filter:f.Filter,Fitting:f.Fitting,Focus:f.Focus,Function:f.Function,Group:f.Group,Guide:f.Guide,Hardware:f.Hardware,Heart:f.Heart,Hidden:f.Hidden,Import:f.Import,InProgress:f.InProgress,Index:f.Index,Info:f.Info,JSON:f.JSON,KebabMenu:f.KebabMenu,Keyboard:f.Keyboard,Label:f.Label,LightMode:f.LightMode,LinePlot:f.LinePlot,Linear:f.Linear,Link:f.Link,LinkExternal:f.LinkExternal,Loading:f.Loading,Log:f.Log,Logo:f.Logo,Map:f.Map,Menu:f.Menu$1,MoveToMainWindow:f.MoveToMainWindow,NPM:f.NPM,Node:f.Node,None:f.None,Notification:f.Notification,OpenExternal:f.OpenExternal,OpenInNewWindow:f.OpenInNewWindow,PNPM:f.PNPM,Pan:f.Pan,Pause:f.Pause,Play:f.Play,Process:f.Process,Pump:f.Pump,Python:f.Python,QuestionMark:f.QuestionMark,Rack:f.Rack,Range:f.Range,Reference:f.Reference,Refresh:f.Refresh,Release:f.Release,Rename:f.Rename,Reset:f.Reset,Resources:f.Resources,Rotate:f.Rotate,Rule:f.Rule,Safety:f.Safety,Save:f.Save,Schematic:f.Schematic,Search:f.Search,Select:f.Select,Selection:f.Selection,Settings:f.Settings,Snapshot:f.Snapshot,Snooze:f.Snooze,Sound:f.Sound,SplitX:f.SplitX,SplitY:f.SplitY,StarFilled:f.StarFilled,StarOutlined:f.StarOutlined,Status:f.Status,String:f.String,StrokeColor:f.StrokeColor,StrokeWidth:f.StrokeWidth,Subtract:f.Subtract,Sync:f.Sync,Table:f.Table,Tank:f.Tank,Tare:f.Tare,Task:f.Task,Terminal:f.Terminal,Text:f.Text$3,TextAlign:f.TextAlign,Time:f.Time$1,ToDo:f.ToDo,Tooltip:f.Tooltip,True:f.True,Type:f.Type,TypeScript:f.TypeScript,Units:f.Units,User:f.User,Value:f.Value,Valve:f.Valve,Variable:f.Variable,Virtual:f.Virtual,Visible:f.Visible,Visualize:f.Visualize,Warning:f.Warning,Wave:f.Wave,Workspace:f.Workspace,Yarn:f.Yarn,Zoom:f.Zoom,createComposite:f.createComposite,resolve:f.resolve,wrapSVGIcon:f.wrapSVGIcon},Symbol.toStringTag,{value:"Module"})),I2=Object.freeze(Object.defineProperty({__proto__:null,Config:f.Config,Dialog:f.Dialog$1,chooseLocation:f.chooseLocation,formatTip:f.formatTip,useConfig:f.useConfig,wrap:f.wrap},Symbol.toStringTag,{value:"Module"})),ja=({ref:e,location:t,style:r,size:o,className:n,children:s,onDragStart:i,sizeUnits:l="px",showHandle:c=!0,...u})=>{const m=d.K.construct(t),p=d.K.direction(m),x=d.p.dimension(p);return a.jsxRuntimeExports.jsxs(f.Box,{className:d.CSS(d.CSS.B("resize"),d.CSS.loc(m),n),style:{[x]:`${o}${l}`,...r},ref:e,direction:p,empty:!0,...u,children:[s,c&&a.jsxRuntimeExports.jsx("div",{draggable:!0,className:d.CSS(d.CSS.BE("resize","handle"),d.CSS.bordered(d.K.swap(m))),onDragStart:i,onDrag:f.preventDefault,onDragEnd:f.preventDefault})]})},fp=({onResize:e,count:t,initialSizes:r=[],minSize:o=100,direction:n="x"})=>{const s=v.useRef(null),[i,l]=v.useState({sizeDistribution:N2(r,t),root:null}),c=v.useCallback((p,x,h)=>{if(s.current==null)return;const g=d.jt.dim(d.jt.construct(s.current),n);l(y=>ji(y,g,p,o,x,h))},[o,l,n]);v.useEffect(()=>e?.(i.sizeDistribution),[i.sizeDistribution,e]);const u=v.useCallback((p,x)=>{p.preventDefault();const h=n==="x"?"clientX":"clientY",g=E=>c(x,E[h]),y=()=>{l(E=>({...E,root:null})),document.removeEventListener("mousemove",g)};l(E=>({...E,root:p[h]})),document.addEventListener("mousemove",g),document.addEventListener("mouseup",y,{once:!0})},[l,n,ji]);return{setSize:v.useCallback((p,x)=>c(p,void 0,x),[ji]),props:{direction:n,sizeDistribution:i.sizeDistribution,onDragHandle:u,ref:s}}},xp=({ref:e,direction:t="x",children:r,sizeDistribution:o,onDragHandle:n,className:s,...i})=>{const l=d.p.construct(t),c=v.Children.toArray(r);return o=T2(o),a.jsxRuntimeExports.jsx(f.Box,{...i,ref:e,direction:l,className:d.CSS(d.CSS.B("resize-multiple"),s),empty:!0,grow:!0,children:c.map((u,m)=>a.jsxRuntimeExports.jsx(ja,{onDragStart:p=>n(p,m),location:d.p.location(l),size:o[m]*100,sizeUnits:"%",showHandle:m!==c.length-1,children:u},m))})},N2=(e,t)=>{const r=e.reduce((n,s)=>n+s,0),o=t-e.length;if(o<=0)return e.slice(0,t).map(n=>n/r);if(e.every(n=>n<=1)){const n=1-r;return[...e,...Array(o).fill(n/o)]}return e.map(()=>1/t)},vi=.001,T2=e=>e.every(t=>d.Ar.closeTo(t,1/e.length),vi)?e.map((t,r)=>r%2===0?t+vi:r===e.length-1?t:t-vi):e,ji=(e,t,r,o,n,s)=>{const i=hp(e,t,r,n,s),[l,c]=O2(e.sizeDistribution,r,i,o/t),u=c?n??null:e.root;return{...e,sizeDistribution:l,root:u}},hp=(e,t,r,o,n)=>{let s;if(n!=null)n>1&&(n/=t),s=n-e.sizeDistribution[r];else if(o!=null){if(e.root===null)throw new Error("resize root is null during handle drag");s=(o-e.root)/t}else throw new Error("must provide either a MouseEvent or a targetSize");return s},O2=(e,t,r,o)=>{let n=t;for(;n>0&&e[n]+r<=o;)n--;const s=e[n]+r,i=P2(n,e,o,r),l=e[i]-r;return s<o||l<o?[e,!1]:[e.map((c,u)=>u===n?s:u===i?l:c),!0]},P2=(e,t,r,o)=>(e===t.length-1?z2:L2)(e,t,r,o),L2=(e,t,r,o)=>{let n=e+1;for(;n<t.length-1&&t[n]-o<=r;)n++;return n},z2=(e,t,r,o)=>{let n=e-1;for(;n>0&&t[n]-o<=r;)n--;return n},Si=2,A2=100,gp=({onCollapse:e,onResize:t,location:r="left",minSize:o,maxSize:n,initialSize:s=200,collapseThreshold:i=1/0,className:l,...c})=>{const[u,m]=v.useState(d.R(s,o,n)),p=v.useRef(null),x=d.K.construct(r),h=v.useCallback(S=>{if(p.current===null)return 0;const R=d.jt.dim(S,d.K.direction(x),!0)*(1-2*Number(["bottom","right"].includes(x))),k=p.current+R,$=d.R(k,o,n);return($-k)/(o??A2)>i?Si:$},[x,o,n,i]),g=v.useRef(null),y=v.useCallback(S=>{const R=h(S);m(R),g.current!=null&&t?.(R,d.jt.construct(g.current))},[t,h]),E=v.useCallback(()=>m(S=>(p.current=S,S)),[m]),b=v.useCallback(S=>h(S)===Si&&e?.(),[e,h]);v.useEffect(()=>{o==null||n==null||m(S=>{const R=d.R(S,o,n);return p.current=R,R})},[o,n]);const _=Be.useCursorDrag({onMove:y,onStart:E,onEnd:b});return a.jsxRuntimeExports.jsx(ja,{ref:g,location:x,size:u,onDragStart:_,className:d.clsx(l,d.CSS.expanded(u!==Si)),...c})},M2=Object.freeze(Object.defineProperty({__proto__:null,Core:ja,Multiple:xp,Single:gp,calculateDiffPercentage:hp,useMultiple:fp},Symbol.toStringTag,{value:"Module"})),Sa=({aetherKey:e,enabled:t=!0})=>{const{setState:r}=f.useLifecycle({aetherKey:e,type:j.Eraser.TYPE,schema:j.eraserStateZ,initialState:{region:d.jt.ZERO,enabled:t}}),o=f.useSyncedRef(t);return{erase:v.useCallback(s=>{r({enabled:o.current,region:s})},[r,o])}},D2=({aetherKey:e,children:t})=>{const{erase:r}=Sa({aetherKey:e}),o=f.useResize(r);return a.jsxRuntimeExports.jsx("div",{ref:o,className:d.CSS(d.CSS.inheritDims()),children:t})},U2=Object.freeze(Object.defineProperty({__proto__:null,Eraser:D2,use:Sa},Symbol.toStringTag,{value:"Module"})),F2=({items:e,initialKey:t})=>{const[r,o]=v.useState(t),n=i=>o(i===r?void 0:i),s=e.find(i=>i.key===r);return{onSelect:n,activeItem:s}},B2=({activeItem:e,children:t,onSelect:r,location:o="left",collapseThreshold:n=.65,className:s,onResize:i,onCollapse:l,eraseEnabled:c,...u})=>{const m=d.K.direction(o);c??=e!=null;const p=v.useCallback(()=>{l?l():e!=null&&r?.(e.key)},[r,e?.key,l]),{erase:x}=Sa({enabled:c}),h=v.useCallback((_,S)=>{i?.(_,S),x(S)},[i,x]),{content:g,minSize:y,maxSize:E,initialSize:b=0}=e??{};return a.jsxRuntimeExports.jsx(gp,{className:d.CSS(d.CSS.B("nav-drawer"),d.CSS.dir(m),d.CSS.visible(e!=null),s),collapseThreshold:n,onCollapse:p,location:o,onResize:h,minSize:y,maxSize:E,initialSize:b,...u,children:g})},Z2=Object.freeze(Object.defineProperty({__proto__:null,Bar:f.Bar,Drawer:B2,useDrawer:F2},Symbol.toStringTag,{value:"Module"})),V2=(e,t)=>{const r=new d.m(e).makeValid();if(r.start.equals(d.r.MAX))return null;const o=r.start.isToday?"time":"dateTime";let n=new d.r(r.start).toString(o,t);if(r.start.isToday&&(n=`Today ${n}`),r.end.equals(d.r.MAX))return r.start.before(d.r.now())?`Started ${n}`:`Starts ${n}`;const s=r.end.span(r.start)<d.a$1.DAY?"time":"dateTime",i=new d.r(r.end).toString(s,t);return[n,i]},yp=({children:e,level:t="p",color:r=9,displayTZ:o="local",weight:n=450,...s})=>{const i=V2(e,o);return i==null?null:a.jsxRuntimeExports.jsx(f.Box,{x:!0,gap:"small",align:"center",...s,children:a.jsxRuntimeExports.jsx(f.Text,{level:t,color:r,weight:n,gap:"tiny",children:typeof i=="string"?i:a.jsxRuntimeExports.jsxs(a.jsxRuntimeExports.Fragment,{children:[i[0],a.jsxRuntimeExports.jsx(f.Arrow.Right,{color:9,size:"1em"}),i[1]]})})})},vp=({children:e,format:t,...r})=>a.jsxRuntimeExports.jsx(f.Text,{...r,children:new d.a$1(e).toString(t)}),jp=e=>{const[,t]=v.useState(0);return v.useEffect(()=>{const r=setInterval(()=>{t(o=>o+1)},1e3);return()=>clearInterval(r)},[]),d.r.since(e)},H2=({children:e,...t})=>{const r=jp(e);return a.jsxRuntimeExports.jsx(vp,{...t,children:r})},K2=Object.freeze(Object.defineProperty({__proto__:null,TimeRange:yp,TimeSpan:vp,TimeSpanSince:H2,TimeStamp:f.TimeStamp,useTimeSpanSince:jp},Symbol.toStringTag,{value:"Module"})),Ea={info:"var(--pluto-text-color)",error:"var(--pluto-error-z)",warning:"var(--pluto-warning-m1)",success:"var(--pluto-primary-z)",loading:"var(--pluto-text-color)",disabled:"var(--pluto-gray-l8)"},Jt=({variant:e,...t})=>e==="loading"?a.jsxRuntimeExports.jsx(f.Loading,{...t}):a.jsxRuntimeExports.jsx(f.Circle,{color:e!=null?Ea[e]:void 0,...t}),Sp=({children:e})=>{const{path:t}=f.useUnidirectional({type:j.BaseProvider.TYPE,schema:j.providerStateZ,state:{}});return a.jsxRuntimeExports.jsx(f.Composite,{path:t,children:e})},G2=Object.freeze(Object.defineProperty({__proto__:null,Provider:Sp,SelectDataType:f.SelectDataType,Text:K2},Symbol.toStringTag,{value:"Module"})),Y2=({action:e})=>v.isValidElement(e)?e:v.createElement(f.Button,{...e,key:e.key,size:"tiny"}),W2=({status:{key:e,time:t,count:r,message:o,description:n,variant:s,name:i},silence:l,actions:c,className:u,children:m,...p})=>{const x=v.useRef(null);return a.jsxRuntimeExports.jsxs(f.Box,{className:d.CSS(d.CSS.B("notification"),u),y:!0,empty:!0,ref:x,...p,children:[a.jsxRuntimeExports.jsxs(f.Box,{x:!0,justify:"between",grow:!0,style:{width:"100%"},children:[a.jsxRuntimeExports.jsxs(f.Box,{x:!0,align:"center",gap:"small",children:[a.jsxRuntimeExports.jsxs(f.Text,{level:"small",status:s,gap:"tiny",children:[a.jsxRuntimeExports.jsx(Jt,{variant:s}),d.O.isNonZero(i)&&i]}),a.jsxRuntimeExports.jsx(f.Text,{level:"small",children:`x${r}`}),a.jsxRuntimeExports.jsx(f.TimeStamp,{className:d.CSS(d.CSS.BE("notification","time")),level:"small",format:"time",children:t})]}),a.jsxRuntimeExports.jsx(f.Button,{className:d.CSS(d.CSS.BE("notification","silence")),variant:"outlined",size:"small",onClick:()=>l(e),children:a.jsxRuntimeExports.jsx(f.Close,{})})]}),a.jsxRuntimeExports.jsxs(f.Box,{y:!0,align:"start",className:d.CSS(d.CSS.BE("notification","content")),gap:"small",children:[m??a.jsxRuntimeExports.jsx(f.Text,{className:d.CSS(d.CSS.BE("notification","message")),style:{flexGrow:1},children:o}),n!=null&&a.jsxRuntimeExports.jsx(f.Text,{className:d.CSS(d.CSS.BE("notification","description")),level:"small",style:{flexGrow:1},children:n})]}),c!=null&&a.jsxRuntimeExports.jsx(f.Box,{x:!0,align:"center",justify:"end",className:d.CSS(d.CSS.BE("notification","actions")),children:d.a.toArray(c).map(h=>a.jsxRuntimeExports.jsx(Y2,{action:h},h.key))})]},t.toString())},X2=[{key:"success",name:"Success",icon:a.jsxRuntimeExports.jsx(Jt,{variant:"success"})},{key:"error",name:"Error",icon:a.jsxRuntimeExports.jsx(Jt,{variant:"error"})},{key:"warning",name:"Warning",icon:a.jsxRuntimeExports.jsx(Jt,{variant:"warning"})},{key:"info",name:"Info",icon:a.jsxRuntimeExports.jsx(Jt,{variant:"info"})}],Ep=e=>a.jsxRuntimeExports.jsx(f.Static,{...e,data:X2,resourceName:"Status"}),ba=({resourceName:e,value:t,onChange:r,data:o,getItem:n,subscribe:s,haulType:i,icon:l,disabled:c,onSearch:u,emptyContent:m,status:p,onFetchMore:x,children:h,renderTag:g,actions:y,allowNone:E,replaceOnSingle:b,triggerProps:_,virtual:S=!0,dialogProps:R,variant:k="connected",...$})=>a.jsxRuntimeExports.jsx(f.Frame,{variant:f.transformDialogVariant(k),...$,children:a.jsxRuntimeExports.jsxs(f.Frame$1,{multiple:!0,value:t,onChange:r,data:o,getItem:n,subscribe:s,onFetchMore:x,allowNone:E,replaceOnSingle:b,virtual:S,children:[a.jsxRuntimeExports.jsx(f.MultipleTrigger,{haulType:i,icon:l,placeholder:`Select ${e}s`,disabled:c,variant:f.transformTriggerVariant(k),..._,children:g}),a.jsxRuntimeExports.jsx(f.Dialog$2,{onSearch:u,emptyContent:m,status:p,actions:y,resourceName:e,...R,children:h})]})}),kt=(e,t)=>{const r={};t.forEach(n=>r[n]=void 0);const o=n=>{const{...s}={...n,...r};return a.jsxRuntimeExports.jsx(e,{...s})};return o.displayName=`RemoveProps(${e.displayName})`,o},bp=e=>a.jsxRuntimeExports.jsxs(Se.Buttons,{...e,keys:j.SIZES,children:[a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"tiny",children:"S"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"small",children:"M"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"medium",children:"L"})]}),q2=Object.freeze(Object.defineProperty({__proto__:null,SIZES:j.SIZES,SelectSize:bp,isRenderProp:f.isRenderProp,isSize:j.isSize,removeProps:kt,renderProp:f.renderProp,size:j.size},Symbol.toStringTag,{value:"Module"})),J2=Object.freeze(Object.defineProperty({__proto__:null,Tag:f.Tag,Tags:f.Tags},Symbol.toStringTag,{value:"Module"})),In=e=>a.jsxRuntimeExports.jsxs(Se.Buttons,{...e,keys:j.LEVELS,children:[a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"h2",square:!0,children:"XL"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"h3",square:!0,children:"L"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"h4",square:!0,children:"M"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"h5",square:!0,children:"S"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:"small",square:!0,children:"XS"})]}),Q2=[250,400,500,600],Rp=e=>a.jsxRuntimeExports.jsxs(Se.Buttons,{...e,keys:Q2,children:[a.jsxRuntimeExports.jsx(Se.Button,{itemKey:250,children:"Light"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:400,children:"Normal"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:500,children:"Medium"}),a.jsxRuntimeExports.jsx(Se.Button,{itemKey:600,children:"Bold"})]}),eR=Object.freeze(Object.defineProperty({__proto__:null,Level:In,Weight:Rp},Symbol.toStringTag,{value:"Module"})),tR=Object.freeze(Object.defineProperty({__proto__:null,Button:Se.Button,Buttons:Se.Buttons,Core:f.Core,Dialog:f.Dialog$2,Frame:f.Frame$1,ListItem:f.ListItem,Multiple:ba,MultipleTrigger:f.MultipleTrigger,Single:f.Single,SingleTrigger:f.SingleTrigger,Static:f.Static,Text:eR,staticCanDrop:f.staticCanDrop,useClear:f.useClear,useContext:f.useContext$3,useHover:f.useHover,useItemState:f.useItemState,useMultiple:f.useMultiple,useSelection:f.useSelection,useSingle:f.useSingle},Symbol.toStringTag,{value:"Module"})),nR=f.useVirtualCursorDragWebKit,vs=()=>{const e=v.useRef([]),t=v.useMemo(()=>({cleanup:()=>{e.current.forEach(r=>r()),e.current=[]},set:r=>{r!=null&&e.current.push(...d.a.toArray(r))}}),[]);return v.useEffect(()=>t.cleanup,[t.cleanup]),t};function He(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,o;r<e.length;r++)(o=He(e[r]))!==""&&(t+=(t&&" ")+o);else for(let r in e)e[r]&&(t+=(t&&" ")+r);return t}var rR={value:()=>{}};function js(){for(var e=0,t=arguments.length,r={},o;e<t;++e){if(!(o=arguments[e]+"")||o in r||/[\s.]/.test(o))throw new Error("illegal type: "+o);r[o]=[]}return new Ao(r)}function Ao(e){this._=e}function oR(e,t){return e.trim().split(/^|\s+/).map(function(r){var o="",n=r.indexOf(".");if(n>=0&&(o=r.slice(n+1),r=r.slice(0,n)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:o}})}Ao.prototype=js.prototype={constructor:Ao,on:function(e,t){var r=this._,o=oR(e+"",r),n,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((n=(e=o[s]).type)&&(n=sR(r[n],e.name)))return n;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(n=(e=o[s]).type)r[n]=Lu(r[n],e.name,t);else if(t==null)for(n in r)r[n]=Lu(r[n],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new Ao(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var r=new Array(n),o=0,n,s;o<n;++o)r[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,n=s.length;o<n;++o)s[o].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],n=0,s=o.length;n<s;++n)o[n].value.apply(t,r)}};function sR(e,t){for(var r=0,o=e.length,n;r<o;++r)if((n=e[r]).name===t)return n.value}function Lu(e,t,r){for(var o=0,n=e.length;o<n;++o)if(e[o].name===t){e[o]=rR,e=e.slice(0,o).concat(e.slice(o+1));break}return r!=null&&e.push({name:t,value:r}),e}var Fi="http://www.w3.org/1999/xhtml";const zu={svg:"http://www.w3.org/2000/svg",xhtml:Fi,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ss(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),zu.hasOwnProperty(t)?{space:zu[t],local:e}:e}function iR(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Fi&&t.documentElement.namespaceURI===Fi?t.createElement(e):t.createElementNS(r,e)}}function aR(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function _p(e){var t=Ss(e);return(t.local?aR:iR)(t)}function lR(){}function Ra(e){return e==null?lR:function(){return this.querySelector(e)}}function cR(e){typeof e!="function"&&(e=Ra(e));for(var t=this._groups,r=t.length,o=new Array(r),n=0;n<r;++n)for(var s=t[n],i=s.length,l=o[n]=new Array(i),c,u,m=0;m<i;++m)(c=s[m])&&(u=e.call(c,c.__data__,m,s))&&("__data__"in c&&(u.__data__=c.__data__),l[m]=u);return new dt(o,this._parents)}function uR(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function dR(){return[]}function wp(e){return e==null?dR:function(){return this.querySelectorAll(e)}}function mR(e){return function(){return uR(e.apply(this,arguments))}}function pR(e){typeof e=="function"?e=mR(e):e=wp(e);for(var t=this._groups,r=t.length,o=[],n=[],s=0;s<r;++s)for(var i=t[s],l=i.length,c,u=0;u<l;++u)(c=i[u])&&(o.push(e.call(c,c.__data__,u,i)),n.push(c));return new dt(o,n)}function Cp(e){return function(){return this.matches(e)}}function kp(e){return function(t){return t.matches(e)}}var fR=Array.prototype.find;function xR(e){return function(){return fR.call(this.children,e)}}function hR(){return this.firstElementChild}function gR(e){return this.select(e==null?hR:xR(typeof e=="function"?e:kp(e)))}var yR=Array.prototype.filter;function vR(){return Array.from(this.children)}function jR(e){return function(){return yR.call(this.children,e)}}function SR(e){return this.selectAll(e==null?vR:jR(typeof e=="function"?e:kp(e)))}function ER(e){typeof e!="function"&&(e=Cp(e));for(var t=this._groups,r=t.length,o=new Array(r),n=0;n<r;++n)for(var s=t[n],i=s.length,l=o[n]=[],c,u=0;u<i;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new dt(o,this._parents)}function $p(e){return new Array(e.length)}function bR(){return new dt(this._enter||this._groups.map($p),this._parents)}function Vo(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Vo.prototype={constructor:Vo,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 RR(e){return function(){return e}}function _R(e,t,r,o,n,s){for(var i=0,l,c=t.length,u=s.length;i<u;++i)(l=t[i])?(l.__data__=s[i],o[i]=l):r[i]=new Vo(e,s[i]);for(;i<c;++i)(l=t[i])&&(n[i]=l)}function wR(e,t,r,o,n,s,i){var l,c,u=new Map,m=t.length,p=s.length,x=new Array(m),h;for(l=0;l<m;++l)(c=t[l])&&(x[l]=h=i.call(c,c.__data__,l,t)+"",u.has(h)?n[l]=c:u.set(h,c));for(l=0;l<p;++l)h=i.call(e,s[l],l,s)+"",(c=u.get(h))?(o[l]=c,c.__data__=s[l],u.delete(h)):r[l]=new Vo(e,s[l]);for(l=0;l<m;++l)(c=t[l])&&u.get(x[l])===c&&(n[l]=c)}function CR(e){return e.__data__}function kR(e,t){if(!arguments.length)return Array.from(this,CR);var r=t?wR:_R,o=this._parents,n=this._groups;typeof e!="function"&&(e=RR(e));for(var s=n.length,i=new Array(s),l=new Array(s),c=new Array(s),u=0;u<s;++u){var m=o[u],p=n[u],x=p.length,h=$R(e.call(m,m&&m.__data__,u,o)),g=h.length,y=l[u]=new Array(g),E=i[u]=new Array(g),b=c[u]=new Array(x);r(m,p,y,E,b,h,t);for(var _=0,S=0,R,k;_<g;++_)if(R=y[_]){for(_>=S&&(S=_+1);!(k=E[S])&&++S<g;);R._next=k||null}}return i=new dt(i,o),i._enter=l,i._exit=c,i}function $R(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function IR(){return new dt(this._exit||this._groups.map($p),this._parents)}function NR(e,t,r){var o=this.enter(),n=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(n=t(n),n&&(n=n.selection())),r==null?s.remove():r(s),o&&n?o.merge(n).order():n}function TR(e){for(var t=e.selection?e.selection():e,r=this._groups,o=t._groups,n=r.length,s=o.length,i=Math.min(n,s),l=new Array(n),c=0;c<i;++c)for(var u=r[c],m=o[c],p=u.length,x=l[c]=new Array(p),h,g=0;g<p;++g)(h=u[g]||m[g])&&(x[g]=h);for(;c<n;++c)l[c]=r[c];return new dt(l,this._parents)}function OR(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var o=e[t],n=o.length-1,s=o[n],i;--n>=0;)(i=o[n])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function PR(e){e||(e=LR);function t(p,x){return p&&x?e(p.__data__,x.__data__):!p-!x}for(var r=this._groups,o=r.length,n=new Array(o),s=0;s<o;++s){for(var i=r[s],l=i.length,c=n[s]=new Array(l),u,m=0;m<l;++m)(u=i[m])&&(c[m]=u);c.sort(t)}return new dt(n,this._parents).order()}function LR(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function zR(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function AR(){return Array.from(this)}function MR(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var o=e[t],n=0,s=o.length;n<s;++n){var i=o[n];if(i)return i}return null}function DR(){let e=0;for(const t of this)++e;return e}function UR(){return!this.node()}function FR(e){for(var t=this._groups,r=0,o=t.length;r<o;++r)for(var n=t[r],s=0,i=n.length,l;s<i;++s)(l=n[s])&&e.call(l,l.__data__,s,n);return this}function BR(e){return function(){this.removeAttribute(e)}}function ZR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function VR(e,t){return function(){this.setAttribute(e,t)}}function HR(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function KR(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function GR(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function YR(e,t){var r=Ss(e);if(arguments.length<2){var o=this.node();return r.local?o.getAttributeNS(r.space,r.local):o.getAttribute(r)}return this.each((t==null?r.local?ZR:BR:typeof t=="function"?r.local?GR:KR:r.local?HR:VR)(r,t))}function Ip(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function WR(e){return function(){this.style.removeProperty(e)}}function XR(e,t,r){return function(){this.style.setProperty(e,t,r)}}function qR(e,t,r){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,r)}}function JR(e,t,r){return arguments.length>1?this.each((t==null?WR:typeof t=="function"?qR:XR)(e,t,r??"")):Xn(this.node(),e)}function Xn(e,t){return e.style.getPropertyValue(t)||Ip(e).getComputedStyle(e,null).getPropertyValue(t)}function QR(e){return function(){delete this[e]}}function e4(e,t){return function(){this[e]=t}}function t4(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function n4(e,t){return arguments.length>1?this.each((t==null?QR:typeof t=="function"?t4:e4)(e,t)):this.node()[e]}function Np(e){return e.trim().split(/^|\s+/)}function _a(e){return e.classList||new Tp(e)}function Tp(e){this._node=e,this._names=Np(e.getAttribute("class")||"")}Tp.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 Op(e,t){for(var r=_a(e),o=-1,n=t.length;++o<n;)r.add(t[o])}function Pp(e,t){for(var r=_a(e),o=-1,n=t.length;++o<n;)r.remove(t[o])}function r4(e){return function(){Op(this,e)}}function o4(e){return function(){Pp(this,e)}}function s4(e,t){return function(){(t.apply(this,arguments)?Op:Pp)(this,e)}}function i4(e,t){var r=Np(e+"");if(arguments.length<2){for(var o=_a(this.node()),n=-1,s=r.length;++n<s;)if(!o.contains(r[n]))return!1;return!0}return this.each((typeof t=="function"?s4:t?r4:o4)(r,t))}function a4(){this.textContent=""}function l4(e){return function(){this.textContent=e}}function c4(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function u4(e){return arguments.length?this.each(e==null?a4:(typeof e=="function"?c4:l4)(e)):this.node().textContent}function d4(){this.innerHTML=""}function m4(e){return function(){this.innerHTML=e}}function p4(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function f4(e){return arguments.length?this.each(e==null?d4:(typeof e=="function"?p4:m4)(e)):this.node().innerHTML}function x4(){this.nextSibling&&this.parentNode.appendChild(this)}function h4(){return this.each(x4)}function g4(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function y4(){return this.each(g4)}function v4(e){var t=typeof e=="function"?e:_p(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function j4(){return null}function S4(e,t){var r=typeof e=="function"?e:_p(e),o=t==null?j4:typeof t=="function"?t:Ra(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),o.apply(this,arguments)||null)})}function E4(){var e=this.parentNode;e&&e.removeChild(this)}function b4(){return this.each(E4)}function R4(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _4(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function w4(e){return this.select(e?_4:R4)}function C4(e){return arguments.length?this.property("__data__",e):this.node().__data__}function k4(e){return function(t){e.call(this,t,this.__data__)}}function $4(e){return e.trim().split(/^|\s+/).map(function(t){var r="",o=t.indexOf(".");return o>=0&&(r=t.slice(o+1),t=t.slice(0,o)),{type:t,name:r}})}function I4(e){return function(){var t=this.__on;if(t){for(var r=0,o=-1,n=t.length,s;r<n;++r)s=t[r],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function N4(e,t,r){return function(){var o=this.__on,n,s=k4(t);if(o){for(var i=0,l=o.length;i<l;++i)if((n=o[i]).type===e.type&&n.name===e.name){this.removeEventListener(n.type,n.listener,n.options),this.addEventListener(n.type,n.listener=s,n.options=r),n.value=t;return}}this.addEventListener(e.type,s,r),n={type:e.type,name:e.name,value:t,listener:s,options:r},o?o.push(n):this.__on=[n]}}function T4(e,t,r){var o=$4(e+""),n,s=o.length,i;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,m;c<u;++c)for(n=0,m=l[c];n<s;++n)if((i=o[n]).type===m.type&&i.name===m.name)return m.value}return}for(l=t?N4:I4,n=0;n<s;++n)this.each(l(o[n],t,r));return this}function Lp(e,t,r){var o=Ip(e),n=o.CustomEvent;typeof n=="function"?n=new n(t,r):(n=o.document.createEvent("Event"),r?(n.initEvent(t,r.bubbles,r.cancelable),n.detail=r.detail):n.initEvent(t,!1,!1)),e.dispatchEvent(n)}function O4(e,t){return function(){return Lp(this,e,t)}}function P4(e,t){return function(){return Lp(this,e,t.apply(this,arguments))}}function L4(e,t){return this.each((typeof t=="function"?P4:O4)(e,t))}function*z4(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var o=e[t],n=0,s=o.length,i;n<s;++n)(i=o[n])&&(yield i)}var zp=[null];function dt(e,t){this._groups=e,this._parents=t}function Vr(){return new dt([[document.documentElement]],zp)}function A4(){return this}dt.prototype=Vr.prototype={constructor:dt,select:cR,selectAll:pR,selectChild:gR,selectChildren:SR,filter:ER,data:kR,enter:bR,exit:IR,join:NR,merge:TR,selection:A4,order:OR,sort:PR,call:zR,nodes:AR,node:MR,size:DR,empty:UR,each:FR,attr:YR,style:JR,property:n4,classed:i4,text:u4,html:f4,raise:h4,lower:y4,append:v4,insert:S4,remove:b4,clone:w4,datum:C4,on:T4,dispatch:L4,[Symbol.iterator]:z4};function ct(e){return typeof e=="string"?new dt([[document.querySelector(e)]],[document.documentElement]):new dt([[e]],zp)}function M4(e){let t;for(;t=e.sourceEvent;)e=t;return e}function jt(e,t){if(e=M4(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var o=r.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var n=t.getBoundingClientRect();return[e.clientX-n.left-t.clientLeft,e.clientY-n.top-t.clientTop]}}return[e.pageX,e.pageY]}const D4={passive:!1},kr={capture:!0,passive:!1};function Ei(e){e.stopImmediatePropagation()}function Gn(e){e.preventDefault(),e.stopImmediatePropagation()}function Ap(e){var t=e.document.documentElement,r=ct(e).on("dragstart.drag",Gn,kr);"onselectstart"in t?r.on("selectstart.drag",Gn,kr):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Mp(e,t){var r=e.document.documentElement,o=ct(e).on("dragstart.drag",null);t&&(o.on("click.drag",Gn,kr),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in r?o.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const So=e=>()=>e;function Bi(e,{sourceEvent:t,subject:r,target:o,identifier:n,active:s,x:i,y:l,dx:c,dy:u,dispatch:m}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:n,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:m}})}Bi.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function U4(e){return!e.ctrlKey&&!e.button}function F4(){return this.parentNode}function B4(e,t){return t??{x:e.x,y:e.y}}function Z4(){return navigator.maxTouchPoints||"ontouchstart"in this}function Dp(){var e=U4,t=F4,r=B4,o=Z4,n={},s=js("start","drag","end"),i=0,l,c,u,m,p=0;function x(R){R.on("mousedown.drag",h).filter(o).on("touchstart.drag",E).on("touchmove.drag",b,D4).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(R,k){if(!(m||!e.call(this,R,k))){var $=S(this,t.call(this,R,k),R,k,"mouse");$&&(ct(R.view).on("mousemove.drag",g,kr).on("mouseup.drag",y,kr),Ap(R.view),Ei(R),u=!1,l=R.clientX,c=R.clientY,$("start",R))}}function g(R){if(Gn(R),!u){var k=R.clientX-l,$=R.clientY-c;u=k*k+$*$>p}n.mouse("drag",R)}function y(R){ct(R.view).on("mousemove.drag mouseup.drag",null),Mp(R.view,u),Gn(R),n.mouse("end",R)}function E(R,k){if(e.call(this,R,k)){var $=R.changedTouches,T=t.call(this,R,k),M=$.length,A,V;for(A=0;A<M;++A)(V=S(this,T,R,k,$[A].identifier,$[A]))&&(Ei(R),V("start",R,$[A]))}}function b(R){var k=R.changedTouches,$=k.length,T,M;for(T=0;T<$;++T)(M=n[k[T].identifier])&&(Gn(R),M("drag",R,k[T]))}function _(R){var k=R.changedTouches,$=k.length,T,M;for(m&&clearTimeout(m),m=setTimeout(function(){m=null},500),T=0;T<$;++T)(M=n[k[T].identifier])&&(Ei(R),M("end",R,k[T]))}function S(R,k,$,T,M,A){var V=s.copy(),Z=jt(A||$,k),O,D,C;if((C=r.call(R,new Bi("beforestart",{sourceEvent:$,target:x,identifier:M,active:i,x:Z[0],y:Z[1],dx:0,dy:0,dispatch:V}),T))!=null)return O=C.x-Z[0]||0,D=C.y-Z[1]||0,function L(N,I,z){var U=Z,H;switch(N){case"start":n[M]=L,H=i++;break;case"end":delete n[M],--i;case"drag":Z=jt(z||I,k),H=i;break}V.call(N,R,new Bi(N,{sourceEvent:I,subject:C,target:x,identifier:M,active:H,x:Z[0]+O,y:Z[1]+D,dx:Z[0]-U[0],dy:Z[1]-U[1],dispatch:V}),T)}}return x.filter=function(R){return arguments.length?(e=typeof R=="function"?R:So(!!R),x):e},x.container=function(R){return arguments.length?(t=typeof R=="function"?R:So(R),x):t},x.subject=function(R){return arguments.length?(r=typeof R=="function"?R:So(R),x):r},x.touchable=function(R){return arguments.length?(o=typeof R=="function"?R:So(!!R),x):o},x.on=function(){var R=s.on.apply(s,arguments);return R===s?x:R},x.clickDistance=function(R){return arguments.length?(p=(R=+R)*R,x):Math.sqrt(p)},x}var Au=180/Math.PI,Zi={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Up(e,t,r,o,n,s){var i,l,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*r+t*o)&&(r-=e*c,o-=t*c),(l=Math.sqrt(r*r+o*o))&&(r/=l,o/=l,c/=l),e*o<t*r&&(e=-e,t=-t,c=-c,i=-i),{translateX:n,translateY:s,rotate:Math.atan2(t,e)*Au,skewX:Math.atan(c)*Au,scaleX:i,scaleY:l}}var Eo;function V4(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Zi:Up(t.a,t.b,t.c,t.d,t.e,t.f)}function H4(e){return e==null||(Eo||(Eo=document.createElementNS("http://www.w3.org/2000/svg","g")),Eo.setAttribute("transform",e),!(e=Eo.transform.baseVal.consolidate()))?Zi:(e=e.matrix,Up(e.a,e.b,e.c,e.d,e.e,e.f))}function Fp(e,t,r,o){function n(u){return u.length?u.pop()+" ":""}function s(u,m,p,x,h,g){if(u!==p||m!==x){var y=h.push("translate(",null,t,null,r);g.push({i:y-4,x:B.interpolateNumber(u,p)},{i:y-2,x:B.interpolateNumber(m,x)})}else(p||x)&&h.push("translate("+p+t+x+r)}function i(u,m,p,x){u!==m?(u-m>180?m+=360:m-u>180&&(u+=360),x.push({i:p.push(n(p)+"rotate(",null,o)-2,x:B.interpolateNumber(u,m)})):m&&p.push(n(p)+"rotate("+m+o)}function l(u,m,p,x){u!==m?x.push({i:p.push(n(p)+"skewX(",null,o)-2,x:B.interpolateNumber(u,m)}):m&&p.push(n(p)+"skewX("+m+o)}function c(u,m,p,x,h,g){if(u!==p||m!==x){var y=h.push(n(h)+"scale(",null,",",null,")");g.push({i:y-4,x:B.interpolateNumber(u,p)},{i:y-2,x:B.interpolateNumber(m,x)})}else(p!==1||x!==1)&&h.push(n(h)+"scale("+p+","+x+")")}return function(u,m){var p=[],x=[];return u=e(u),m=e(m),s(u.translateX,u.translateY,m.translateX,m.translateY,p,x),i(u.rotate,m.rotate,p,x),l(u.skewX,m.skewX,p,x),c(u.scaleX,u.scaleY,m.scaleX,m.scaleY,p,x),u=m=null,function(h){for(var g=-1,y=x.length,E;++g<y;)p[(E=x[g]).i]=E.x(h);return p.join("")}}}var K4=Fp(V4,"px, ","px)","deg)"),G4=Fp(H4,", ",")",")"),Y4=1e-12;function Mu(e){return((e=Math.exp(e))+1/e)/2}function W4(e){return((e=Math.exp(e))-1/e)/2}function X4(e){return((e=Math.exp(2*e))-1)/(e+1)}const Mo=(function e(t,r,o){function n(s,i){var l=s[0],c=s[1],u=s[2],m=i[0],p=i[1],x=i[2],h=m-l,g=p-c,y=h*h+g*g,E,b;if(y<Y4)b=Math.log(x/u)/t,E=function(T){return[l+T*h,c+T*g,u*Math.exp(t*T*b)]};else{var _=Math.sqrt(y),S=(x*x-u*u+o*y)/(2*u*r*_),R=(x*x-u*u-o*y)/(2*x*r*_),k=Math.log(Math.sqrt(S*S+1)-S),$=Math.log(Math.sqrt(R*R+1)-R);b=($-k)/t,E=function(T){var M=T*b,A=Mu(k),V=u/(r*_)*(A*X4(t*M+k)-W4(k));return[l+V*h,c+V*g,u*A/Mu(t*M+k)]}}return E.duration=b*1e3*t/Math.SQRT2,E}return n.rho=function(s){var i=Math.max(.001,+s),l=i*i,c=l*l;return e(i,l,c)},n})(Math.SQRT2,2,4);var qn=0,vr=0,hr=0,Bp=1e3,Ho,jr,Ko=0,yn=0,Es=0,$r=typeof performance=="object"&&performance.now?performance:Date,Zp=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function wa(){return yn||(Zp(q4),yn=$r.now()+Es)}function q4(){yn=0}function Go(){this._call=this._time=this._next=null}Go.prototype=Vp.prototype={constructor:Go,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?wa():+r)+(t==null?0:+t),!this._next&&jr!==this&&(jr?jr._next=this:Ho=this,jr=this),this._call=e,this._time=r,Vi()},stop:function(){this._call&&(this._call=null,this._time=1/0,Vi())}};function Vp(e,t,r){var o=new Go;return o.restart(e,t,r),o}function J4(){wa(),++qn;for(var e=Ho,t;e;)(t=yn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--qn}function Du(){yn=(Ko=$r.now())+Es,qn=vr=0;try{J4()}finally{qn=0,e3(),yn=0}}function Q4(){var e=$r.now(),t=e-Ko;t>Bp&&(Es-=t,Ko=e)}function e3(){for(var e,t=Ho,r,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:Ho=r);jr=e,Vi(o)}function Vi(e){if(!qn){vr&&(vr=clearTimeout(vr));var t=e-yn;t>24?(e<1/0&&(vr=setTimeout(Du,e-$r.now()-Es)),hr&&(hr=clearInterval(hr))):(hr||(Ko=$r.now(),hr=setInterval(Q4,Bp)),qn=1,Zp(Du))}}function Uu(e,t,r){var o=new Go;return t=t==null?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,r),o}var t3=js("start","end","cancel","interrupt"),n3=[],Hp=0,Fu=1,Hi=2,Do=3,Bu=4,Ki=5,Uo=6;function bs(e,t,r,o,n,s){var i=e.__transition;if(!i)e.__transition={};else if(r in i)return;r3(e,r,{name:t,index:o,group:n,on:t3,tween:n3,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Hp})}function Ca(e,t){var r=$t(e,t);if(r.state>Hp)throw new Error("too late; already scheduled");return r}function Pt(e,t){var r=$t(e,t);if(r.state>Do)throw new Error("too late; already running");return r}function $t(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function r3(e,t,r){var o=e.__transition,n;o[t]=r,r.timer=Vp(s,0,r.time);function s(u){r.state=Fu,r.timer.restart(i,r.delay,r.time),r.delay<=u&&i(u-r.delay)}function i(u){var m,p,x,h;if(r.state!==Fu)return c();for(m in o)if(h=o[m],h.name===r.name){if(h.state===Do)return Uu(i);h.state===Bu?(h.state=Uo,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[m]):+m<t&&(h.state=Uo,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[m])}if(Uu(function(){r.state===Do&&(r.state=Bu,r.timer.restart(l,r.delay,r.time),l(u))}),r.state=Hi,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Hi){for(r.state=Do,n=new Array(x=r.tween.length),m=0,p=-1;m<x;++m)(h=r.tween[m].value.call(e,e.__data__,r.index,r.group))&&(n[++p]=h);n.length=p+1}}function l(u){for(var m=u<r.duration?r.ease.call(null,u/r.duration):(r.timer.restart(c),r.state=Ki,1),p=-1,x=n.length;++p<x;)n[p].call(e,m);r.state===Ki&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=Uo,r.timer.stop(),delete o[t];for(var u in o)return;delete e.__transition}}function Fo(e,t){var r=e.__transition,o,n,s=!0,i;if(r){t=t==null?null:t+"";for(i in r){if((o=r[i]).name!==t){s=!1;continue}n=o.state>Hi&&o.state<Ki,o.state=Uo,o.timer.stop(),o.on.call(n?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete r[i]}s&&delete e.__transition}}function o3(e){return this.each(function(){Fo(this,e)})}function s3(e,t){var r,o;return function(){var n=Pt(this,e),s=n.tween;if(s!==r){o=r=s;for(var i=0,l=o.length;i<l;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}n.tween=o}}function i3(e,t,r){var o,n;if(typeof r!="function")throw new Error;return function(){var s=Pt(this,e),i=s.tween;if(i!==o){n=(o=i).slice();for(var l={name:t,value:r},c=0,u=n.length;c<u;++c)if(n[c].name===t){n[c]=l;break}c===u&&n.push(l)}s.tween=n}}function a3(e,t){var r=this._id;if(e+="",arguments.length<2){for(var o=$t(this.node(),r).tween,n=0,s=o.length,i;n<s;++n)if((i=o[n]).name===e)return i.value;return null}return this.each((t==null?s3:i3)(r,e,t))}function ka(e,t,r){var o=e._id;return e.each(function(){var n=Pt(this,o);(n.value||(n.value={}))[t]=r.apply(this,arguments)}),function(n){return $t(n,o).value[t]}}function Kp(e,t){var r;return(typeof t=="number"?B.interpolateNumber:t instanceof B.color?B.interpolateRgb:(r=B.color(t))?(t=r,B.interpolateRgb):B.interpolateString)(e,t)}function l3(e){return function(){this.removeAttribute(e)}}function c3(e){return function(){this.removeAttributeNS(e.space,e.local)}}function u3(e,t,r){var o,n=r+"",s;return function(){var i=this.getAttribute(e);return i===n?null:i===o?s:s=t(o=i,r)}}function d3(e,t,r){var o,n=r+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===n?null:i===o?s:s=t(o=i,r)}}function m3(e,t,r){var o,n,s;return function(){var i,l=r(this),c;return l==null?void this.removeAttribute(e):(i=this.getAttribute(e),c=l+"",i===c?null:i===o&&c===n?s:(n=c,s=t(o=i,l)))}}function p3(e,t,r){var o,n,s;return function(){var i,l=r(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),c=l+"",i===c?null:i===o&&c===n?s:(n=c,s=t(o=i,l)))}}function f3(e,t){var r=Ss(e),o=r==="transform"?G4:Kp;return this.attrTween(e,typeof t=="function"?(r.local?p3:m3)(r,o,ka(this,"attr."+e,t)):t==null?(r.local?c3:l3)(r):(r.local?d3:u3)(r,o,t))}function x3(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function h3(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function g3(e,t){var r,o;function n(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&h3(e,s)),r}return n._value=t,n}function y3(e,t){var r,o;function n(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&x3(e,s)),r}return n._value=t,n}function v3(e,t){var r="attr."+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;var o=Ss(e);return this.tween(r,(o.local?g3:y3)(o,t))}function j3(e,t){return function(){Ca(this,e).delay=+t.apply(this,arguments)}}function S3(e,t){return t=+t,function(){Ca(this,e).delay=t}}function E3(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?j3:S3)(t,e)):$t(this.node(),t).delay}function b3(e,t){return function(){Pt(this,e).duration=+t.apply(this,arguments)}}function R3(e,t){return t=+t,function(){Pt(this,e).duration=t}}function _3(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?b3:R3)(t,e)):$t(this.node(),t).duration}function w3(e,t){if(typeof t!="function")throw new Error;return function(){Pt(this,e).ease=t}}function C3(e){var t=this._id;return arguments.length?this.each(w3(t,e)):$t(this.node(),t).ease}function k3(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;Pt(this,e).ease=r}}function $3(e){if(typeof e!="function")throw new Error;return this.each(k3(this._id,e))}function I3(e){typeof e!="function"&&(e=Cp(e));for(var t=this._groups,r=t.length,o=new Array(r),n=0;n<r;++n)for(var s=t[n],i=s.length,l=o[n]=[],c,u=0;u<i;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new Zt(o,this._parents,this._name,this._id)}function N3(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,o=t.length,n=r.length,s=Math.min(o,n),i=new Array(o),l=0;l<s;++l)for(var c=t[l],u=r[l],m=c.length,p=i[l]=new Array(m),x,h=0;h<m;++h)(x=c[h]||u[h])&&(p[h]=x);for(;l<o;++l)i[l]=t[l];return new Zt(i,this._parents,this._name,this._id)}function T3(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function O3(e,t,r){var o,n,s=T3(t)?Ca:Pt;return function(){var i=s(this,e),l=i.on;l!==o&&(n=(o=l).copy()).on(t,r),i.on=n}}function P3(e,t){var r=this._id;return arguments.length<2?$t(this.node(),r).on.on(e):this.each(O3(r,e,t))}function L3(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function z3(){return this.on("end.remove",L3(this._id))}function A3(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Ra(e));for(var o=this._groups,n=o.length,s=new Array(n),i=0;i<n;++i)for(var l=o[i],c=l.length,u=s[i]=new Array(c),m,p,x=0;x<c;++x)(m=l[x])&&(p=e.call(m,m.__data__,x,l))&&("__data__"in m&&(p.__data__=m.__data__),u[x]=p,bs(u[x],t,r,x,u,$t(m,r)));return new Zt(s,this._parents,t,r)}function M3(e){var t=this._name,r=this._id;typeof e!="function"&&(e=wp(e));for(var o=this._groups,n=o.length,s=[],i=[],l=0;l<n;++l)for(var c=o[l],u=c.length,m,p=0;p<u;++p)if(m=c[p]){for(var x=e.call(m,m.__data__,p,c),h,g=$t(m,r),y=0,E=x.length;y<E;++y)(h=x[y])&&bs(h,t,r,y,x,g);s.push(x),i.push(m)}return new Zt(s,i,t,r)}var D3=Vr.prototype.constructor;function U3(){return new D3(this._groups,this._parents)}function F3(e,t){var r,o,n;return function(){var s=Xn(this,e),i=(this.style.removeProperty(e),Xn(this,e));return s===i?null:s===r&&i===o?n:n=t(r=s,o=i)}}function Gp(e){return function(){this.style.removeProperty(e)}}function B3(e,t,r){var o,n=r+"",s;return function(){var i=Xn(this,e);return i===n?null:i===o?s:s=t(o=i,r)}}function Z3(e,t,r){var o,n,s;return function(){var i=Xn(this,e),l=r(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Xn(this,e))),i===c?null:i===o&&c===n?s:(n=c,s=t(o=i,l))}}function V3(e,t){var r,o,n,s="style."+t,i="end."+s,l;return function(){var c=Pt(this,e),u=c.on,m=c.value[s]==null?l||(l=Gp(t)):void 0;(u!==r||n!==m)&&(o=(r=u).copy()).on(i,n=m),c.on=o}}function H3(e,t,r){var o=(e+="")=="transform"?K4:Kp;return t==null?this.styleTween(e,F3(e,o)).on("end.style."+e,Gp(e)):typeof t=="function"?this.styleTween(e,Z3(e,o,ka(this,"style."+e,t))).each(V3(this._id,e)):this.styleTween(e,B3(e,o,t),r).on("end.style."+e,null)}function K3(e,t,r){return function(o){this.style.setProperty(e,t.call(this,o),r)}}function G3(e,t,r){var o,n;function s(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&K3(e,i,r)),o}return s._value=t,s}function Y3(e,t,r){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,G3(e,t,r??""))}function W3(e){return function(){this.textContent=e}}function X3(e){return function(){var t=e(this);this.textContent=t??""}}function q3(e){return this.tween("text",typeof e=="function"?X3(ka(this,"text",e)):W3(e==null?"":e+""))}function J3(e){return function(t){this.textContent=e.call(this,t)}}function Q3(e){var t,r;function o(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&J3(n)),t}return o._value=e,o}function e5(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,Q3(e))}function t5(){for(var e=this._name,t=this._id,r=Yp(),o=this._groups,n=o.length,s=0;s<n;++s)for(var i=o[s],l=i.length,c,u=0;u<l;++u)if(c=i[u]){var m=$t(c,t);bs(c,e,r,u,i,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new Zt(o,this._parents,e,r)}function n5(){var e,t,r=this,o=r._id,n=r.size();return new Promise(function(s,i){var l={value:i},c={value:function(){--n===0&&s()}};r.each(function(){var u=Pt(this,o),m=u.on;m!==e&&(t=(e=m).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),n===0&&s()})}var r5=0;function Zt(e,t,r,o){this._groups=e,this._parents=t,this._name=r,this._id=o}function Yp(){return++r5}var Mt=Vr.prototype;Zt.prototype={constructor:Zt,select:A3,selectAll:M3,selectChild:Mt.selectChild,selectChildren:Mt.selectChildren,filter:I3,merge:N3,selection:U3,transition:t5,call:Mt.call,nodes:Mt.nodes,node:Mt.node,size:Mt.size,empty:Mt.empty,each:Mt.each,on:P3,attr:f3,attrTween:v3,style:H3,styleTween:Y3,text:q3,textTween:e5,remove:z3,tween:a3,delay:E3,duration:_3,ease:C3,easeVarying:$3,end:n5,[Symbol.iterator]:Mt[Symbol.iterator]};function o5(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var s5={time:null,delay:0,duration:250,ease:o5};function i5(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function a5(e){var t,r;e instanceof Zt?(t=e._id,e=e._name):(t=Yp(),(r=s5).time=wa(),e=e==null?null:e+"");for(var o=this._groups,n=o.length,s=0;s<n;++s)for(var i=o[s],l=i.length,c,u=0;u<l;++u)(c=i[u])&&bs(c,e,t,u,i,r||i5(c,t));return new Zt(o,this._parents,e,t)}Vr.prototype.interrupt=o3;Vr.prototype.transition=a5;const bo=e=>()=>e;function l5(e,{sourceEvent:t,target:r,transform:o,dispatch:n}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:n}})}function Ut(e,t,r){this.k=e,this.x=t,this.y=r}Ut.prototype={constructor:Ut,scale:function(e){return e===1?this:new Ut(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ut(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 Rs=new Ut(1,0,0);Wp.prototype=Ut.prototype;function Wp(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Rs;return e.__zoom}function bi(e){e.stopImmediatePropagation()}function gr(e){e.preventDefault(),e.stopImmediatePropagation()}function c5(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function u5(){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 Zu(){return this.__zoom||Rs}function d5(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function m5(){return navigator.maxTouchPoints||"ontouchstart"in this}function p5(e,t,r){var o=e.invertX(t[0][0])-r[0][0],n=e.invertX(t[1][0])-r[1][0],s=e.invertY(t[0][1])-r[0][1],i=e.invertY(t[1][1])-r[1][1];return e.translate(n>o?(o+n)/2:Math.min(0,o)||Math.max(0,n),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function Xp(){var e=c5,t=u5,r=p5,o=d5,n=m5,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Mo,u=js("start","zoom","end"),m,p,x,h=500,g=150,y=0,E=10;function b(C){C.property("__zoom",Zu).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",V).filter(n).on("touchstart.zoom",Z).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(C,L,N,I){var z=C.selection?C.selection():C;z.property("__zoom",Zu),C!==z?k(C,L,N,I):z.interrupt().each(function(){$(this,arguments).event(I).start().zoom(null,typeof L=="function"?L.apply(this,arguments):L).end()})},b.scaleBy=function(C,L,N,I){b.scaleTo(C,function(){var z=this.__zoom.k,U=typeof L=="function"?L.apply(this,arguments):L;return z*U},N,I)},b.scaleTo=function(C,L,N,I){b.transform(C,function(){var z=t.apply(this,arguments),U=this.__zoom,H=N==null?R(z):typeof N=="function"?N.apply(this,arguments):N,K=U.invert(H),W=typeof L=="function"?L.apply(this,arguments):L;return r(S(_(U,W),H,K),z,i)},N,I)},b.translateBy=function(C,L,N,I){b.transform(C,function(){return r(this.__zoom.translate(typeof L=="function"?L.apply(this,arguments):L,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),i)},null,I)},b.translateTo=function(C,L,N,I,z){b.transform(C,function(){var U=t.apply(this,arguments),H=this.__zoom,K=I==null?R(U):typeof I=="function"?I.apply(this,arguments):I;return r(Rs.translate(K[0],K[1]).scale(H.k).translate(typeof L=="function"?-L.apply(this,arguments):-L,typeof N=="function"?-N.apply(this,arguments):-N),U,i)},I,z)};function _(C,L){return L=Math.max(s[0],Math.min(s[1],L)),L===C.k?C:new Ut(L,C.x,C.y)}function S(C,L,N){var I=L[0]-N[0]*C.k,z=L[1]-N[1]*C.k;return I===C.x&&z===C.y?C:new Ut(C.k,I,z)}function R(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function k(C,L,N,I){C.on("start.zoom",function(){$(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(I).end()}).tween("zoom",function(){var z=this,U=arguments,H=$(z,U).event(I),K=t.apply(z,U),W=N==null?R(K):typeof N=="function"?N.apply(z,U):N,re=Math.max(K[1][0]-K[0][0],K[1][1]-K[0][1]),Q=z.__zoom,le=typeof L=="function"?L.apply(z,U):L,pe=c(Q.invert(W).concat(re/Q.k),le.invert(W).concat(re/le.k));return function(oe){if(oe===1)oe=le;else{var te=pe(oe),ae=re/te[2];oe=new Ut(ae,W[0]-te[0]*ae,W[1]-te[1]*ae)}H.zoom(null,oe)}})}function $(C,L,N){return!N&&C.__zooming||new T(C,L)}function T(C,L){this.that=C,this.args=L,this.active=0,this.sourceEvent=null,this.extent=t.apply(C,L),this.taps=0}T.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,L){return this.mouse&&C!=="mouse"&&(this.mouse[1]=L.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=L.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=L.invert(this.touch1[0])),this.that.__zoom=L,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var L=ct(this.that).datum();u.call(C,this.that,new l5(C,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:u}),L)}};function M(C,...L){if(!e.apply(this,arguments))return;var N=$(this,L).event(C),I=this.__zoom,z=Math.max(s[0],Math.min(s[1],I.k*Math.pow(2,o.apply(this,arguments)))),U=jt(C);if(N.wheel)(N.mouse[0][0]!==U[0]||N.mouse[0][1]!==U[1])&&(N.mouse[1]=I.invert(N.mouse[0]=U)),clearTimeout(N.wheel);else{if(I.k===z)return;N.mouse=[U,I.invert(U)],Fo(this),N.start()}gr(C),N.wheel=setTimeout(H,g),N.zoom("mouse",r(S(_(I,z),N.mouse[0],N.mouse[1]),N.extent,i));function H(){N.wheel=null,N.end()}}function A(C,...L){if(x||!e.apply(this,arguments))return;var N=C.currentTarget,I=$(this,L,!0).event(C),z=ct(C.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",re,!0),U=jt(C,N),H=C.clientX,K=C.clientY;Ap(C.view),bi(C),I.mouse=[U,this.__zoom.invert(U)],Fo(this),I.start();function W(Q){if(gr(Q),!I.moved){var le=Q.clientX-H,pe=Q.clientY-K;I.moved=le*le+pe*pe>y}I.event(Q).zoom("mouse",r(S(I.that.__zoom,I.mouse[0]=jt(Q,N),I.mouse[1]),I.extent,i))}function re(Q){z.on("mousemove.zoom mouseup.zoom",null),Mp(Q.view,I.moved),gr(Q),I.event(Q).end()}}function V(C,...L){if(e.apply(this,arguments)){var N=this.__zoom,I=jt(C.changedTouches?C.changedTouches[0]:C,this),z=N.invert(I),U=N.k*(C.shiftKey?.5:2),H=r(S(_(N,U),I,z),t.apply(this,L),i);gr(C),l>0?ct(this).transition().duration(l).call(k,H,I,C):ct(this).call(b.transform,H,I,C)}}function Z(C,...L){if(e.apply(this,arguments)){var N=C.touches,I=N.length,z=$(this,L,C.changedTouches.length===I).event(C),U,H,K,W;for(bi(C),H=0;H<I;++H)K=N[H],W=jt(K,this),W=[W,this.__zoom.invert(W),K.identifier],z.touch0?!z.touch1&&z.touch0[2]!==W[2]&&(z.touch1=W,z.taps=0):(z.touch0=W,U=!0,z.taps=1+!!m);m&&(m=clearTimeout(m)),U&&(z.taps<2&&(p=W[0],m=setTimeout(function(){m=null},h)),Fo(this),z.start())}}function O(C,...L){if(this.__zooming){var N=$(this,L).event(C),I=C.changedTouches,z=I.length,U,H,K,W;for(gr(C),U=0;U<z;++U)H=I[U],K=jt(H,this),N.touch0&&N.touch0[2]===H.identifier?N.touch0[0]=K:N.touch1&&N.touch1[2]===H.identifier&&(N.touch1[0]=K);if(H=N.that.__zoom,N.touch1){var re=N.touch0[0],Q=N.touch0[1],le=N.touch1[0],pe=N.touch1[1],oe=(oe=le[0]-re[0])*oe+(oe=le[1]-re[1])*oe,te=(te=pe[0]-Q[0])*te+(te=pe[1]-Q[1])*te;H=_(H,Math.sqrt(oe/te)),K=[(re[0]+le[0])/2,(re[1]+le[1])/2],W=[(Q[0]+pe[0])/2,(Q[1]+pe[1])/2]}else if(N.touch0)K=N.touch0[0],W=N.touch0[1];else return;N.zoom("touch",r(S(H,K,W),N.extent,i))}}function D(C,...L){if(this.__zooming){var N=$(this,L).event(C),I=C.changedTouches,z=I.length,U,H;for(bi(C),x&&clearTimeout(x),x=setTimeout(function(){x=null},h),U=0;U<z;++U)H=I[U],N.touch0&&N.touch0[2]===H.identifier?delete N.touch0:N.touch1&&N.touch1[2]===H.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(H=jt(H,this),Math.hypot(p[0]-H[0],p[1]-H[1])<E)){var K=ct(this).on("dblclick.zoom");K&&K.apply(this,arguments)}}}return b.wheelDelta=function(C){return arguments.length?(o=typeof C=="function"?C:bo(+C),b):o},b.filter=function(C){return arguments.length?(e=typeof C=="function"?C:bo(!!C),b):e},b.touchable=function(C){return arguments.length?(n=typeof C=="function"?C:bo(!!C),b):n},b.extent=function(C){return arguments.length?(t=typeof C=="function"?C:bo([[+C[0][0],+C[0][1]],[+C[1][0],+C[1][1]]]),b):t},b.scaleExtent=function(C){return arguments.length?(s[0]=+C[0],s[1]=+C[1],b):[s[0],s[1]]},b.translateExtent=function(C){return arguments.length?(i[0][0]=+C[0][0],i[1][0]=+C[1][0],i[0][1]=+C[0][1],i[1][1]=+C[1][1],b):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},b.constrain=function(C){return arguments.length?(r=C,b):r},b.duration=function(C){return arguments.length?(l=+C,b):l},b.interpolate=function(C){return arguments.length?(c=C,b):c},b.on=function(){var C=u.on.apply(u,arguments);return C===u?b:C},b.clickDistance=function(C){return arguments.length?(y=(C=+C)*C,b):Math.sqrt(y)},b.tapDistance=function(C){return arguments.length?(E=+C,b):E},b}const Qe={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:r,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?r:o}", 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."},Ir=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],qp=["Enter"," ","Escape"],Jp={"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:r})=>`Moved selected node ${e}. New position, x: ${t}, y: ${r}`,"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 vn;(function(e){e.Strict="strict",e.Loose="loose"})(vn||(vn={}));var fn;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(fn||(fn={}));var Jn;(function(e){e.Partial="partial",e.Full="full"})(Jn||(Jn={}));const Qp={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var qt;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(qt||(qt={}));var Nr;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Nr||(Nr={}));var ne;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ne||(ne={}));const Vu={[ne.Left]:ne.Right,[ne.Right]:ne.Left,[ne.Top]:ne.Bottom,[ne.Bottom]:ne.Top};function ef(e){return e===null?null:e?"valid":"invalid"}const tf=e=>"id"in e&&"source"in e&&"target"in e,f5=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),$a=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Hr=(e,t=[0,0])=>{const{width:r,height:o}=Ht(e),n=e.origin??t,s=r*n[0],i=o*n[1];return{x:e.position.x-s,y:e.position.y-i}},x5=(e,t={nodeOrigin:[0,0]})=>{if(process.env.NODE_ENV==="development"&&!t.nodeLookup&&console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((o,n)=>{const s=typeof n=="string";let i=!t.nodeLookup&&!s?n:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(n):$a(n)?n:t.nodeLookup.get(n.id));const l=i?Yo(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return _s(o,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ws(r)},Kr=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(o=>{if(t.filter===void 0||t.filter(o)){const n=Yo(o);r=_s(r,n)}}),ws(r)},Ia=(e,t,[r,o,n]=[0,0,1],s=!1,i=!1)=>{const l={...Yr(t,[r,o,n]),width:t.width/n,height:t.height/n},c=[];for(const u of e.values()){const{measured:m,selectable:p=!0,hidden:x=!1}=u;if(i&&!p||x)continue;const h=m.width??u.width??u.initialWidth??null,g=m.height??u.height??u.initialHeight??null,y=Tr(l,er(u)),E=(h??0)*(g??0),b=s&&y>0;(!u.internals.handleBounds||b||y>=E||u.dragging)&&c.push(u)}return c},h5=(e,t)=>{const r=new Set;return e.forEach(o=>{r.add(o.id)}),t.filter(o=>r.has(o.source)||r.has(o.target))};function g5(e,t){const r=new Map,o=t?.nodes?new Set(t.nodes.map(n=>n.id)):null;return e.forEach(n=>{n.measured.width&&n.measured.height&&(t?.includeHiddenNodes||!n.hidden)&&(!o||o.has(n.id))&&r.set(n.id,n)}),r}async function y5({nodes:e,width:t,height:r,panZoom:o,minZoom:n,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const l=g5(e,i),c=Kr(l),u=Na(c,t,r,i?.minZoom??n,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(u,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function nf({nodeId:e,nextPosition:t,nodeLookup:r,nodeOrigin:o=[0,0],nodeExtent:n,onError:s}){const i=r.get(e),l=i.parentId?r.get(i.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},m=i.origin??o;let p=i.extent||n;if(i.extent==="parent"&&!i.expandParent)if(!l)s?.("005",Qe.error005());else{const h=l.measured.width,g=l.measured.height;h&&g&&(p=[[c,u],[c+h,u+g]])}else l&&tr(i.extent)&&(p=[[i.extent[0][0]+c,i.extent[0][1]+u],[i.extent[1][0]+c,i.extent[1][1]+u]]);const x=tr(p)?jn(t,p,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",Qe.error015()),{position:{x:x.x-c+(i.measured.width??0)*m[0],y:x.y-u+(i.measured.height??0)*m[1]},positionAbsolute:x}}async function v5({nodesToRemove:e=[],edgesToRemove:t=[],nodes:r,edges:o,onBeforeDelete:n}){const s=new Set(e.map(x=>x.id)),i=[];for(const x of r){if(x.deletable===!1)continue;const h=s.has(x.id),g=!h&&x.parentId&&i.find(y=>y.id===x.parentId);(h||g)&&i.push(x)}const l=new Set(t.map(x=>x.id)),c=o.filter(x=>x.deletable!==!1),m=h5(i,c);for(const x of c)l.has(x.id)&&!m.find(g=>g.id===x.id)&&m.push(x);if(!n)return{edges:m,nodes:i};const p=await n({nodes:i,edges:m});return typeof p=="boolean"?p?{edges:m,nodes:i}:{edges:[],nodes:[]}:p}const Qn=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),jn=(e={x:0,y:0},t,r)=>({x:Qn(e.x,t[0][0],t[1][0]-(r?.width??0)),y:Qn(e.y,t[0][1],t[1][1]-(r?.height??0))});function rf(e,t,r){const{width:o,height:n}=Ht(r),{x:s,y:i}=r.internals.positionAbsolute;return jn(e,[[s,i],[s+o,i+n]],t)}const Hu=(e,t,r)=>e<t?Qn(Math.abs(e-t),1,t)/t:e>r?-Qn(Math.abs(e-r),1,t)/t:0,of=(e,t,r=15,o=40)=>{const n=Hu(e.x,o,t.width-o)*r,s=Hu(e.y,o,t.height-o)*r;return[n,s]},_s=(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)}),Gi=({x:e,y:t,width:r,height:o})=>({x:e,y:t,x2:e+r,y2:t+o}),ws=({x:e,y:t,x2:r,y2:o})=>({x:e,y:t,width:r-e,height:o-t}),er=(e,t=[0,0])=>{const{x:r,y:o}=$a(e)?e.internals.positionAbsolute:Hr(e,t);return{x:r,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Yo=(e,t=[0,0])=>{const{x:r,y:o}=$a(e)?e.internals.positionAbsolute:Hr(e,t);return{x:r,y:o,x2:r+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},sf=(e,t)=>ws(_s(Gi(e),Gi(t))),Tr=(e,t)=>{const r=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(r*o)},Ku=e=>Et(e.width)&&Et(e.height)&&Et(e.x)&&Et(e.y),Et=e=>!isNaN(e)&&isFinite(e),Wo=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},Gr=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Yr=({x:e,y:t},[r,o,n],s=!1,i=[1,1])=>{const l={x:(e-r)/n,y:(t-o)/n};return s?Gr(l,i):l},Xo=({x:e,y:t},[r,o,n])=>({x:e*n+r,y:t*n+o});function Zn(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(r)}if(typeof e=="string"&&e.endsWith("%")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(t*r*.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 j5(e,t,r){if(typeof e=="string"||typeof e=="number"){const o=Zn(e,r),n=Zn(e,t);return{top:o,right:n,bottom:o,left:n,x:n*2,y:o*2}}if(typeof e=="object"){const o=Zn(e.top??e.y??0,r),n=Zn(e.bottom??e.y??0,r),s=Zn(e.left??e.x??0,t),i=Zn(e.right??e.x??0,t);return{top:o,right:i,bottom:n,left:s,x:s+i,y:o+n}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function S5(e,t,r,o,n,s){const{x:i,y:l}=Xo(e,[t,r,o]),{x:c,y:u}=Xo({x:e.x+e.width,y:e.y+e.height},[t,r,o]),m=n-c,p=s-u;return{left:Math.floor(i),top:Math.floor(l),right:Math.floor(m),bottom:Math.floor(p)}}const Na=(e,t,r,o,n,s)=>{const i=j5(s,t,r),l=(t-i.x)/e.width,c=(r-i.y)/e.height,u=Math.min(l,c),m=Qn(u,o,n),p=e.x+e.width/2,x=e.y+e.height/2,h=t/2-p*m,g=r/2-x*m,y=S5(e,h,g,m,t,r),E={left:Math.min(y.left-i.left,0),top:Math.min(y.top-i.top,0),right:Math.min(y.right-i.right,0),bottom:Math.min(y.bottom-i.bottom,0)};return{x:h-E.left+E.right,y:g-E.top+E.bottom,zoom:m}},Or=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function tr(e){return e!=null&&e!=="parent"}function Ht(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function af(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function lf(e,t={width:0,height:0},r,o,n){const s={...e},i=o.get(r);if(i){const l=i.origin||n;s.x+=i.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}function Gu(e,t){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}function E5(){let e,t;return{promise:new Promise((o,n)=>{e=o,t=n}),resolve:e,reject:t}}function b5(e){return{...Jp,...e||{}}}function _r(e,{snapGrid:t=[0,0],snapToGrid:r=!1,transform:o,containerBounds:n}){const{x:s,y:i}=Ot(e),l=Yr({x:s-(n?.left??0),y:i-(n?.top??0)},o),{x:c,y:u}=r?Gr(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const Ta=e=>({width:e.offsetWidth,height:e.offsetHeight}),cf=e=>e?.getRootNode?.()||window?.document,R5=["INPUT","SELECT","TEXTAREA"];function uf(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:R5.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const df=e=>"clientX"in e,Ot=(e,t)=>{const r=df(e),o=r?e.clientX:e.touches?.[0].clientX,n=r?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:n-(t?.top??0)}},Yu=(e,t,r,o,n)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const l=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:n,position:i.getAttribute("data-handlepos"),x:(l.left-r.left)/o,y:(l.top-r.top)/o,...Ta(i)}})};function mf({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:n,sourceControlY:s,targetControlX:i,targetControlY:l}){const c=e*.125+n*.375+i*.375+r*.125,u=t*.125+s*.375+l*.375+o*.125,m=Math.abs(c-e),p=Math.abs(u-t);return[c,u,m,p]}function Ro(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wu({pos:e,x1:t,y1:r,x2:o,y2:n,c:s}){switch(e){case ne.Left:return[t-Ro(t-o,s),r];case ne.Right:return[t+Ro(o-t,s),r];case ne.Top:return[t,r-Ro(r-n,s)];case ne.Bottom:return[t,r+Ro(n-r,s)]}}function pf({sourceX:e,sourceY:t,sourcePosition:r=ne.Bottom,targetX:o,targetY:n,targetPosition:s=ne.Top,curvature:i=.25}){const[l,c]=Wu({pos:r,x1:e,y1:t,x2:o,y2:n,c:i}),[u,m]=Wu({pos:s,x1:o,y1:n,x2:e,y2:t,c:i}),[p,x,h,g]=mf({sourceX:e,sourceY:t,targetX:o,targetY:n,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:m});return[`M${e},${t} C${l},${c} ${u},${m} ${o},${n}`,p,x,h,g]}function ff({sourceX:e,sourceY:t,targetX:r,targetY:o}){const n=Math.abs(r-e)/2,s=r<e?r+n:r-n,i=Math.abs(o-t)/2,l=o<t?o+i:o-i;return[s,l,n,i]}function _5({sourceNode:e,targetNode:t,selected:r=!1,zIndex:o,elevateOnSelect:n=!1}){if(o!==void 0)return o;const s=n&&r?1e3:0,i=Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0);return s+i}function w5({sourceNode:e,targetNode:t,width:r,height:o,transform:n}){const s=_s(Yo(e),Yo(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-n[0]/n[2],y:-n[1]/n[2],width:r/n[2],height:o/n[2]};return Tr(i,ws(s))>0}const xf=({source:e,sourceHandle:t,target:r,targetHandle:o})=>`xy-edge__${e}${t||""}-${r}${o||""}`,C5=(e,t)=>t.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),hf=(e,t)=>{if(!e.source||!e.target)return Wo("006",Qe.error006()),t;let r;return tf(e)?r={...e}:r={...e,id:xf(e)},C5(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))},k5=(e,t,r,o={shouldReplaceId:!0})=>{const{id:n,...s}=e;if(!t.source||!t.target)return Wo("006",Qe.error006()),r;if(!r.find(c=>c.id===e.id))return Wo("007",Qe.error007(n)),r;const l={...s,id:o.shouldReplaceId?xf(t):n,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return r.filter(c=>c.id!==n).concat(l)};function gf({sourceX:e,sourceY:t,targetX:r,targetY:o}){const[n,s,i,l]=ff({sourceX:e,sourceY:t,targetX:r,targetY:o});return[`M ${e},${t}L ${r},${o}`,n,s,i,l]}const Xu={[ne.Left]:{x:-1,y:0},[ne.Right]:{x:1,y:0},[ne.Top]:{x:0,y:-1},[ne.Bottom]:{x:0,y:1}},$5=({source:e,sourcePosition:t=ne.Bottom,target:r})=>t===ne.Left||t===ne.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},qu=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function I5({source:e,sourcePosition:t=ne.Bottom,target:r,targetPosition:o=ne.Top,center:n,offset:s,stepPosition:i}){const l=Xu[t],c=Xu[o],u={x:e.x+l.x*s,y:e.y+l.y*s},m={x:r.x+c.x*s,y:r.y+c.y*s},p=$5({source:u,sourcePosition:t,target:m}),x=p.x!==0?"x":"y",h=p[x];let g=[],y,E;const b={x:0,y:0},_={x:0,y:0},[,,S,R]=ff({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(l[x]*c[x]===-1){x==="x"?(y=n.x??u.x+(m.x-u.x)*i,E=n.y??(u.y+m.y)/2):(y=n.x??(u.x+m.x)/2,E=n.y??u.y+(m.y-u.y)*i);const $=[{x:y,y:u.y},{x:y,y:m.y}],T=[{x:u.x,y:E},{x:m.x,y:E}];l[x]===h?g=x==="x"?$:T:g=x==="x"?T:$}else{const $=[{x:u.x,y:m.y}],T=[{x:m.x,y:u.y}];if(x==="x"?g=l.x===h?T:$:g=l.y===h?$:T,t===o){const O=Math.abs(e[x]-r[x]);if(O<=s){const D=Math.min(s-1,s-O);l[x]===h?b[x]=(u[x]>e[x]?-1:1)*D:_[x]=(m[x]>r[x]?-1:1)*D}}if(t!==o){const O=x==="x"?"y":"x",D=l[x]===c[O],C=u[O]>m[O],L=u[O]<m[O];(l[x]===1&&(!D&&C||D&&L)||l[x]!==1&&(!D&&L||D&&C))&&(g=x==="x"?$:T)}const M={x:u.x+b.x,y:u.y+b.y},A={x:m.x+_.x,y:m.y+_.y},V=Math.max(Math.abs(M.x-g[0].x),Math.abs(A.x-g[0].x)),Z=Math.max(Math.abs(M.y-g[0].y),Math.abs(A.y-g[0].y));V>=Z?(y=(M.x+A.x)/2,E=g[0].y):(y=g[0].x,E=(M.y+A.y)/2)}return[[e,{x:u.x+b.x,y:u.y+b.y},...g,{x:m.x+_.x,y:m.y+_.y},r],y,E,S,R]}function N5(e,t,r,o){const n=Math.min(qu(e,t)/2,qu(t,r)/2,o),{x:s,y:i}=t;if(e.x===s&&s===r.x||e.y===i&&i===r.y)return`L${s} ${i}`;if(e.y===i){const u=e.x<r.x?-1:1,m=e.y<r.y?1:-1;return`L ${s+n*u},${i}Q ${s},${i} ${s},${i+n*m}`}const l=e.x<r.x?1:-1,c=e.y<r.y?-1:1;return`L ${s},${i+n*c}Q ${s},${i} ${s+n*l},${i}`}function Yi({sourceX:e,sourceY:t,sourcePosition:r=ne.Bottom,targetX:o,targetY:n,targetPosition:s=ne.Top,borderRadius:i=5,centerX:l,centerY:c,offset:u=20,stepPosition:m=.5}){const[p,x,h,g,y]=I5({source:{x:e,y:t},sourcePosition:r,target:{x:o,y:n},targetPosition:s,center:{x:l,y:c},offset:u,stepPosition:m});return[p.reduce((b,_,S)=>{let R="";return S>0&&S<p.length-1?R=N5(p[S-1],_,p[S+1],i):R=`${S===0?"M":"L"}${_.x} ${_.y}`,b+=R,b},""),x,h,g,y]}function Ju(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function T5(e){const{sourceNode:t,targetNode:r}=e;if(!Ju(t)||!Ju(r))return null;const o=t.internals.handleBounds||Qu(t.handles),n=r.internals.handleBounds||Qu(r.handles),s=ed(o?.source??[],e.sourceHandle),i=ed(e.connectionMode===vn.Strict?n?.target??[]:(n?.target??[]).concat(n?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",Qe.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=s?.position||ne.Bottom,c=i?.position||ne.Top,u=Pr(t,s,l),m=Pr(r,i,c);return{sourceX:u.x,sourceY:u.y,targetX:m.x,targetY:m.y,sourcePosition:l,targetPosition:c}}function Qu(e){if(!e)return null;const t=[],r=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&r.push(o);return{source:t,target:r}}function Pr(e,t,r=ne.Left,o=!1){const n=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:l}=t??Ht(e);if(o)return{x:n+i/2,y:s+l/2};switch(t?.position??r){case ne.Top:return{x:n+i/2,y:s};case ne.Right:return{x:n+i,y:s+l/2};case ne.Bottom:return{x:n+i/2,y:s+l};case ne.Left:return{x:n,y:s+l/2}}}function ed(e,t){return e&&(t?e.find(r=>r.id===t):e[0])||null}function Wi(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function O5(e,{id:t,defaultColor:r,defaultMarkerStart:o,defaultMarkerEnd:n}){const s=new Set;return e.reduce((i,l)=>([l.markerStart||o,l.markerEnd||n].forEach(c=>{if(c&&typeof c=="object"){const u=Wi(c,t);s.has(u)||(i.push({id:u,color:c.color||r,...c}),s.add(u))}}),i),[]).sort((i,l)=>i.id.localeCompare(l.id))}const Oa={nodeOrigin:[0,0],nodeExtent:Ir,elevateNodesOnSelect:!0,defaults:{}},P5={...Oa,checkEquality:!0};function Pa(e,t){const r={...e};for(const o in t)t[o]!==void 0&&(r[o]=t[o]);return r}function L5(e,t,r){const o=Pa(Oa,r);for(const n of e.values())if(n.parentId)La(n,e,t,o);else{const s=Hr(n,o.nodeOrigin),i=tr(n.extent)?n.extent:o.nodeExtent,l=jn(s,i,Ht(n));n.internals.positionAbsolute=l}}function Xi(e,t,r,o){const n=Pa(P5,o);let s=e.length>0;const i=new Map(t),l=n?.elevateNodesOnSelect?1e3:0;t.clear(),r.clear();for(const c of e){let u=i.get(c.id);if(n.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const m=Hr(c,n.nodeOrigin),p=tr(c.extent)?c.extent:n.nodeExtent,x=jn(m,p,Ht(c));u={...n.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:x,handleBounds:c.measured?u?.internals.handleBounds:void 0,z:yf(c,l),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(s=!1),c.parentId&&La(u,t,r,o)}return s}function z5(e,t){if(!e.parentId)return;const r=t.get(e.parentId);r?r.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function La(e,t,r,o){const{elevateNodesOnSelect:n,nodeOrigin:s,nodeExtent:i}=Pa(Oa,o),l=e.parentId,c=t.get(l);if(!c){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}z5(e,r);const u=n?1e3:0,{x:m,y:p,z:x}=A5(e,c,s,i,u),{positionAbsolute:h}=e.internals,g=m!==h.x||p!==h.y;(g||x!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:g?{x:m,y:p}:h,z:x}})}function yf(e,t){return(Et(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function A5(e,t,r,o,n){const{x:s,y:i}=t.internals.positionAbsolute,l=Ht(e),c=Hr(e,r),u=tr(e.extent)?jn(c,e.extent,l):c;let m=jn({x:s+u.x,y:i+u.y},o,l);e.extent==="parent"&&(m=rf(m,l,t));const p=yf(e,n),x=t.internals.z??0;return{x:m.x,y:m.y,z:x>=p?x+1:p}}function za(e,t,r,o=[0,0]){const n=[],s=new Map;for(const i of e){const l=t.get(i.parentId);if(!l)continue;const c=s.get(i.parentId)?.expandedRect??er(l),u=sf(c,i.rect);s.set(i.parentId,{expandedRect:u,parent:l})}return s.size>0&&s.forEach(({expandedRect:i,parent:l},c)=>{const u=l.internals.positionAbsolute,m=Ht(l),p=l.origin??o,x=i.x<u.x?Math.round(Math.abs(u.x-i.x)):0,h=i.y<u.y?Math.round(Math.abs(u.y-i.y)):0,g=Math.max(m.width,Math.round(i.width)),y=Math.max(m.height,Math.round(i.height)),E=(g-m.width)*p[0],b=(y-m.height)*p[1];(x>0||h>0||E||b)&&(n.push({id:c,type:"position",position:{x:l.position.x-x+E,y:l.position.y-h+b}}),r.get(c)?.forEach(_=>{e.some(S=>S.id===_.id)||n.push({id:_.id,type:"position",position:{x:_.position.x+x,y:_.position.y+h}})})),(m.width<i.width||m.height<i.height||x||h)&&n.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:g+(x?p[0]*x-E:0),height:y+(h?p[1]*h-b:0)}})}),n}function M5(e,t,r,o,n,s){const i=o?.querySelector(".xyflow__viewport");let l=!1;if(!i)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(i),{m22:m}=new window.DOMMatrixReadOnly(u.transform),p=[];for(const x of e.values()){const h=t.get(x.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),l=!0;continue}const g=Ta(x.nodeElement),y=h.measured.width!==g.width||h.measured.height!==g.height;if(!!(g.width&&g.height&&(y||!h.internals.handleBounds||x.force))){const b=x.nodeElement.getBoundingClientRect(),_=tr(h.extent)?h.extent:s;let{positionAbsolute:S}=h.internals;h.parentId&&h.extent==="parent"?S=rf(S,g,t.get(h.parentId)):_&&(S=jn(S,_,g));const R={...h,measured:g,internals:{...h.internals,positionAbsolute:S,handleBounds:{source:Yu("source",x.nodeElement,b,m,h.id),target:Yu("target",x.nodeElement,b,m,h.id)}}};t.set(h.id,R),h.parentId&&La(R,t,r,{nodeOrigin:n}),l=!0,y&&(c.push({id:h.id,type:"dimensions",dimensions:g}),h.expandParent&&h.parentId&&p.push({id:h.id,parentId:h.parentId,rect:er(R,n)}))}}if(p.length>0){const x=za(p,t,r,n);c.push(...x)}return{changes:c,updatedInternals:l}}async function D5({delta:e,panZoom:t,transform:r,translateExtent:o,width:n,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[n,s]],o),l=!!i&&(i.x!==r[0]||i.y!==r[1]||i.k!==r[2]);return Promise.resolve(l)}function td(e,t,r,o,n,s){let i=n;const l=o.get(i)||new Map;o.set(i,l.set(r,t)),i=`${n}-${e}`;const c=o.get(i)||new Map;if(o.set(i,c.set(r,t)),s){i=`${n}-${e}-${s}`;const u=o.get(i)||new Map;o.set(i,u.set(r,t))}}function vf(e,t,r){e.clear(),t.clear();for(const o of r){const{source:n,target:s,sourceHandle:i=null,targetHandle:l=null}=o,c={edgeId:o.id,source:n,target:s,sourceHandle:i,targetHandle:l},u=`${n}-${i}--${s}-${l}`,m=`${s}-${l}--${n}-${i}`;td("source",c,m,e,n,i),td("target",c,u,e,s,l),t.set(o.id,o)}}function jf(e,t){if(!e.parentId)return!1;const r=t.get(e.parentId);return r?r.selected?!0:jf(r,t):!1}function nd(e,t,r){let o=e;do{if(o?.matches?.(t))return!0;if(o===r)return!1;o=o?.parentElement}while(o);return!1}function U5(e,t,r,o){const n=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!jf(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const l=e.get(s);l&&n.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:r.x-l.internals.positionAbsolute.x,y:r.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return n}function Ri({nodeId:e,dragItems:t,nodeLookup:r,dragging:o=!0}){const n=[];for(const[i,l]of t){const c=r.get(i)?.internals.userNode;c&&n.push({...c,position:l.position,dragging:o})}if(!e)return[n[0],n];const s=r.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:n[0],n]}function F5({dragItems:e,snapGrid:t,x:r,y:o}){const n=e.values().next().value;if(!n)return null;const s={x:r-n.distance.x,y:o-n.distance.y},i=Gr(s,t);return{x:i.x-s.x,y:i.y-s.y}}function B5({onNodeMouseDown:e,getStoreItems:t,onDragStart:r,onDrag:o,onDragStop:n}){let s={x:null,y:null},i=0,l=new Map,c=!1,u={x:0,y:0},m=null,p=!1,x=null,h=!1,g=!1,y=null;function E({noDragClassName:_,handleSelector:S,domNode:R,isSelectable:k,nodeId:$,nodeClickDistance:T=0}){x=ct(R);function M({x:O,y:D}){const{nodeLookup:C,nodeExtent:L,snapGrid:N,snapToGrid:I,nodeOrigin:z,onNodeDrag:U,onSelectionDrag:H,onError:K,updateNodePositions:W}=t();s={x:O,y:D};let re=!1;const Q=l.size>1,le=Q&&L?Gi(Kr(l)):null,pe=Q&&I?F5({dragItems:l,snapGrid:N,x:O,y:D}):null;for(const[oe,te]of l){if(!C.has(oe))continue;let ae={x:O-te.distance.x,y:D-te.distance.y};I&&(ae=pe?{x:Math.round(ae.x+pe.x),y:Math.round(ae.y+pe.y)}:Gr(ae,N));let we=null;if(Q&&L&&!te.extent&&le){const{positionAbsolute:je}=te.internals,he=je.x-le.x+L[0][0],Oe=je.x+te.measured.width-le.x2+L[1][0],We=je.y-le.y+L[0][1],ot=je.y+te.measured.height-le.y2+L[1][1];we=[[he,We],[Oe,ot]]}const{position:Te,positionAbsolute:me}=nf({nodeId:oe,nextPosition:ae,nodeLookup:C,nodeExtent:we||L,nodeOrigin:z,onError:K});re=re||te.position.x!==Te.x||te.position.y!==Te.y,te.position=Te,te.internals.positionAbsolute=me}if(g=g||re,!!re&&(W(l,!0),y&&(o||U||!$&&H))){const[oe,te]=Ri({nodeId:$,dragItems:l,nodeLookup:C});o?.(y,l,oe,te),U?.(y,oe,te),$||H?.(y,te)}}async function A(){if(!m)return;const{transform:O,panBy:D,autoPanSpeed:C,autoPanOnNodeDrag:L}=t();if(!L){c=!1,cancelAnimationFrame(i);return}const[N,I]=of(u,m,C);(N!==0||I!==0)&&(s.x=(s.x??0)-N/O[2],s.y=(s.y??0)-I/O[2],await D({x:N,y:I})&&M(s)),i=requestAnimationFrame(A)}function V(O){const{nodeLookup:D,multiSelectionActive:C,nodesDraggable:L,transform:N,snapGrid:I,snapToGrid:z,selectNodesOnDrag:U,onNodeDragStart:H,onSelectionDragStart:K,unselectNodesAndEdges:W}=t();p=!0,(!U||!k)&&!C&&$&&(D.get($)?.selected||W()),k&&U&&$&&e?.($);const re=_r(O.sourceEvent,{transform:N,snapGrid:I,snapToGrid:z,containerBounds:m});if(s=re,l=U5(D,L,re,$),l.size>0&&(r||H||!$&&K)){const[Q,le]=Ri({nodeId:$,dragItems:l,nodeLookup:D});r?.(O.sourceEvent,l,Q,le),H?.(O.sourceEvent,Q,le),$||K?.(O.sourceEvent,le)}}const Z=Dp().clickDistance(T).on("start",O=>{const{domNode:D,nodeDragThreshold:C,transform:L,snapGrid:N,snapToGrid:I}=t();m=D?.getBoundingClientRect()||null,h=!1,g=!1,y=O.sourceEvent,C===0&&V(O),s=_r(O.sourceEvent,{transform:L,snapGrid:N,snapToGrid:I,containerBounds:m}),u=Ot(O.sourceEvent,m)}).on("drag",O=>{const{autoPanOnNodeDrag:D,transform:C,snapGrid:L,snapToGrid:N,nodeDragThreshold:I,nodeLookup:z}=t(),U=_r(O.sourceEvent,{transform:C,snapGrid:L,snapToGrid:N,containerBounds:m});if(y=O.sourceEvent,(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1||$&&!z.has($))&&(h=!0),!h){if(!c&&D&&p&&(c=!0,A()),!p){const H=U.xSnapped-(s.x??0),K=U.ySnapped-(s.y??0);Math.sqrt(H*H+K*K)>I&&V(O)}(s.x!==U.xSnapped||s.y!==U.ySnapped)&&l&&p&&(u=Ot(O.sourceEvent,m),M(U))}}).on("end",O=>{if(!(!p||h)&&(c=!1,p=!1,cancelAnimationFrame(i),l.size>0)){const{nodeLookup:D,updateNodePositions:C,onNodeDragStop:L,onSelectionDragStop:N}=t();if(g&&(C(l,!1),g=!1),n||L||!$&&N){const[I,z]=Ri({nodeId:$,dragItems:l,nodeLookup:D,dragging:!1});n?.(O.sourceEvent,l,I,z),L?.(O.sourceEvent,I,z),$||N?.(O.sourceEvent,z)}}}).filter(O=>{const D=O.target;return!O.button&&(!_||!nd(D,`.${_}`,R))&&(!S||nd(D,S,R))});x.call(Z)}function b(){x?.on(".drag",null)}return{update:E,destroy:b}}function Z5(e,t,r){const o=[],n={x:e.x-r,y:e.y-r,width:r*2,height:r*2};for(const s of t.values())Tr(n,er(s))>0&&o.push(s);return o}const V5=250;function H5(e,t,r,o){let n=[],s=1/0;const i=Z5(e,r,t+V5);for(const l of i){const c=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(const u of c){if(o.nodeId===u.nodeId&&o.type===u.type&&o.id===u.id)continue;const{x:m,y:p}=Pr(l,u,u.position,!0),x=Math.sqrt(Math.pow(m-e.x,2)+Math.pow(p-e.y,2));x>t||(x<s?(n=[{...u,x:m,y:p}],s=x):x===s&&n.push({...u,x:m,y:p}))}}if(!n.length)return null;if(n.length>1){const l=o.type==="source"?"target":"source";return n.find(c=>c.type===l)??n[0]}return n[0]}function Sf(e,t,r,o,n,s=!1){const i=o.get(e);if(!i)return null;const l=n==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],c=(r?l?.find(u=>u.id===r):l?.[0])??null;return c&&s?{...c,...Pr(i,c,c.position,!0)}:c}function Ef(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function K5(e,t){let r=null;return t?r=!0:e&&!t&&(r=!1),r}const bf=()=>!0;function G5(e,{connectionMode:t,connectionRadius:r,handleId:o,nodeId:n,edgeUpdaterType:s,isTarget:i,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:m,flowId:p,panBy:x,cancelConnection:h,onConnectStart:g,onConnect:y,onConnectEnd:E,isValidConnection:b=bf,onReconnectEnd:_,updateConnection:S,getTransform:R,getFromHandle:k,autoPanSpeed:$,dragThreshold:T=1,handleDomNode:M}){const A=cf(e.target);let V=0,Z;const{x:O,y:D}=Ot(e),C=Ef(s,M),L=l?.getBoundingClientRect();let N=!1;if(!L||!C)return;const I=Sf(n,C,o,c,t);if(!I)return;let z=Ot(e,L),U=!1,H=null,K=!1,W=null;function re(){if(!m||!L)return;const[Te,me]=of(z,L,$);x({x:Te,y:me}),V=requestAnimationFrame(re)}const Q={...I,nodeId:n,type:C,position:I.position},le=c.get(n);let oe={inProgress:!0,isValid:null,from:Pr(le,Q,ne.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:le,to:z,toHandle:null,toPosition:Vu[Q.position],toNode:null};function te(){N=!0,S(oe),g?.(e,{nodeId:n,handleId:o,handleType:C})}T===0&&te();function ae(Te){if(!N){const{x:Oe,y:We}=Ot(Te),ot=Oe-O,At=We-D;if(!(ot*ot+At*At>T*T))return;te()}if(!k()||!Q){we(Te);return}const me=R();z=Ot(Te,L),Z=H5(Yr(z,me,!1,[1,1]),r,c,Q),U||(re(),U=!0);const je=Rf(Te,{handle:Z,connectionMode:t,fromNodeId:n,fromHandleId:o,fromType:i?"target":"source",isValidConnection:b,doc:A,lib:u,flowId:p,nodeLookup:c});W=je.handleDomNode,H=je.connection,K=K5(!!Z,je.isValid);const he={...oe,isValid:K,to:je.toHandle&&K?Xo({x:je.toHandle.x,y:je.toHandle.y},me):z,toHandle:je.toHandle,toPosition:K&&je.toHandle?je.toHandle.position:Vu[Q.position],toNode:je.toHandle?c.get(je.toHandle.nodeId):null};K&&Z&&oe.toHandle&&he.toHandle&&oe.toHandle.type===he.toHandle.type&&oe.toHandle.nodeId===he.toHandle.nodeId&&oe.toHandle.id===he.toHandle.id&&oe.to.x===he.to.x&&oe.to.y===he.to.y||(S(he),oe=he)}function we(Te){if(N){(Z||W)&&H&&K&&y?.(H);const{inProgress:me,...je}=oe,he={...je,toPosition:oe.toHandle?oe.toPosition:null};E?.(Te,he),s&&_?.(Te,he)}h(),cancelAnimationFrame(V),U=!1,K=!1,H=null,W=null,A.removeEventListener("mousemove",ae),A.removeEventListener("mouseup",we),A.removeEventListener("touchmove",ae),A.removeEventListener("touchend",we)}A.addEventListener("mousemove",ae),A.addEventListener("mouseup",we),A.addEventListener("touchmove",ae),A.addEventListener("touchend",we)}function Rf(e,{handle:t,connectionMode:r,fromNodeId:o,fromHandleId:n,fromType:s,doc:i,lib:l,flowId:c,isValidConnection:u=bf,nodeLookup:m}){const p=s==="target",x=t?i.querySelector(`.${l}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=Ot(e),y=i.elementFromPoint(h,g),E=y?.classList.contains(`${l}-flow__handle`)?y:x,b={handleDomNode:E,isValid:!1,connection:null,toHandle:null};if(E){const _=Ef(void 0,E),S=E.getAttribute("data-nodeid"),R=E.getAttribute("data-handleid"),k=E.classList.contains("connectable"),$=E.classList.contains("connectableend");if(!S||!_)return b;const T={source:p?S:o,sourceHandle:p?R:n,target:p?o:S,targetHandle:p?n:R};b.connection=T;const A=k&&$&&(r===vn.Strict?p&&_==="source"||!p&&_==="target":S!==o||R!==n);b.isValid=A&&u(T),b.toHandle=Sf(S,_,R,m,r,!0)}return b}const qi={onPointerDown:G5,isValid:Rf};function Y5({domNode:e,panZoom:t,getTransform:r,getViewScale:o}){const n=ct(e);function s({translateExtent:l,width:c,height:u,zoomStep:m=1,pannable:p=!0,zoomable:x=!0,inversePan:h=!1}){const g=S=>{if(S.sourceEvent.type!=="wheel"||!t)return;const R=r(),k=S.sourceEvent.ctrlKey&&Or()?10:1,$=-S.sourceEvent.deltaY*(S.sourceEvent.deltaMode===1?.05:S.sourceEvent.deltaMode?1:.002)*m,T=R[2]*Math.pow(2,$*k);t.scaleTo(T)};let y=[0,0];const E=S=>{(S.sourceEvent.type==="mousedown"||S.sourceEvent.type==="touchstart")&&(y=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY])},b=S=>{const R=r();if(S.sourceEvent.type!=="mousemove"&&S.sourceEvent.type!=="touchmove"||!t)return;const k=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY],$=[k[0]-y[0],k[1]-y[1]];y=k;const T=o()*Math.max(R[2],Math.log(R[2]))*(h?-1:1),M={x:R[0]-$[0]*T,y:R[1]-$[1]*T},A=[[0,0],[c,u]];t.setViewportConstrained({x:M.x,y:M.y,zoom:R[2]},A,l)},_=Xp().on("start",E).on("zoom",p?b:null).on("zoom.wheel",x?g:null);n.call(_,{})}function i(){n.on("zoom",null)}return{update:s,destroy:i,pointer:jt}}const W5=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Cs=e=>({x:e.x,y:e.y,zoom:e.k}),_i=({x:e,y:t,zoom:r})=>Rs.translate(e,t).scale(r),Hn=(e,t)=>e.target.closest(`.${t}`),_f=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),X5=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,wi=(e,t=0,r=X5,o=()=>{})=>{const n=typeof t=="number"&&t>0;return n||o(),n?e.transition().duration(t).ease(r).on("end",o):e},wf=e=>{const t=e.ctrlKey&&Or()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function q5({zoomPanValues:e,noWheelClassName:t,d3Selection:r,d3Zoom:o,panOnScrollMode:n,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return m=>{if(Hn(m,t))return!1;m.preventDefault(),m.stopImmediatePropagation();const p=r.property("__zoom").k||1;if(m.ctrlKey&&i){const E=jt(m),b=wf(m),_=p*Math.pow(2,b);o.scaleTo(r,_,E,m);return}const x=m.deltaMode===1?20:1;let h=n===fn.Vertical?0:m.deltaX*x,g=n===fn.Horizontal?0:m.deltaY*x;!Or()&&m.shiftKey&&n!==fn.Vertical&&(h=m.deltaY*x,g=0),o.translateBy(r,-(h/p)*s,-(g/p)*s,{internal:!0});const y=Cs(r.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,l?.(m,y)),e.isPanScrolling&&(c?.(m,y),e.panScrollTimeout=setTimeout(()=>{u?.(m,y),e.isPanScrolling=!1},150))}}function J5({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:r}){return function(o,n){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,l=Hn(o,e);if(o.ctrlKey&&s&&l&&o.preventDefault(),i||l)return null;o.preventDefault(),r.call(this,o,n)}}function Q5({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:r}){return o=>{if(o.sourceEvent?.internal)return;const n=Cs(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=n,o.sourceEvent?.type==="mousedown"&&t(!0),r&&r?.(o.sourceEvent,n)}}function e_({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:r,onTransformChange:o,onPanZoom:n}){return s=>{e.usedRightMouseButton=!!(r&&_f(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),n&&!s.sourceEvent?.internal&&n?.(s.sourceEvent,Cs(s.transform))}}function t_({zoomPanValues:e,panOnDrag:t,panOnScroll:r,onDraggingChange:o,onPanZoomEnd:n,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&_f(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),n&&W5(e.prevViewport,i.transform))){const l=Cs(i.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{n?.(i.sourceEvent,l)},r?150:0)}}}function n_({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:r,panOnDrag:o,panOnScroll:n,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:l,noPanClassName:c,lib:u}){return m=>{const p=e||t,x=r&&m.ctrlKey;if(m.button===1&&m.type==="mousedown"&&(Hn(m,`${u}-flow__node`)||Hn(m,`${u}-flow__edge`)))return!0;if(!o&&!p&&!n&&!s&&!r||i||Hn(m,l)&&m.type==="wheel"||Hn(m,c)&&(m.type!=="wheel"||n&&m.type==="wheel"&&!e)||!r&&m.ctrlKey&&m.type==="wheel")return!1;if(!r&&m.type==="touchstart"&&m.touches?.length>1)return m.preventDefault(),!1;if(!p&&!n&&!x&&m.type==="wheel"||!o&&(m.type==="mousedown"||m.type==="touchstart")||Array.isArray(o)&&!o.includes(m.button)&&m.type==="mousedown")return!1;const h=Array.isArray(o)&&o.includes(m.button)||!m.button||m.button<=1;return(!m.ctrlKey||m.type==="wheel")&&h}}function r_({domNode:e,minZoom:t,maxZoom:r,paneClickDistance:o,translateExtent:n,viewport:s,onPanZoom:i,onPanZoomStart:l,onPanZoomEnd:c,onDraggingChange:u}){const m={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),x=Xp().clickDistance(!Et(o)||o<0?0:o).scaleExtent([t,r]).translateExtent(n),h=ct(e).call(x);S({x:s.x,y:s.y,zoom:Qn(s.zoom,t,r)},[[0,0],[p.width,p.height]],n);const g=h.on("wheel.zoom"),y=h.on("dblclick.zoom");x.wheelDelta(wf);function E(O,D){return h?new Promise(C=>{x?.interpolate(D?.interpolate==="linear"?B.interpolate:Mo).transform(wi(h,D?.duration,D?.ease,()=>C(!0)),O)}):Promise.resolve(!1)}function b({noWheelClassName:O,noPanClassName:D,onPaneContextMenu:C,userSelectionActive:L,panOnScroll:N,panOnDrag:I,panOnScrollMode:z,panOnScrollSpeed:U,preventScrolling:H,zoomOnPinch:K,zoomOnScroll:W,zoomOnDoubleClick:re,zoomActivationKeyPressed:Q,lib:le,onTransformChange:pe}){L&&!m.isZoomingOrPanning&&_();const te=N&&!Q&&!L?q5({zoomPanValues:m,noWheelClassName:O,d3Selection:h,d3Zoom:x,panOnScrollMode:z,panOnScrollSpeed:U,zoomOnPinch:K,onPanZoomStart:l,onPanZoom:i,onPanZoomEnd:c}):J5({noWheelClassName:O,preventScrolling:H,d3ZoomHandler:g});if(h.on("wheel.zoom",te,{passive:!1}),!L){const we=Q5({zoomPanValues:m,onDraggingChange:u,onPanZoomStart:l});x.on("start",we);const Te=e_({zoomPanValues:m,panOnDrag:I,onPaneContextMenu:!!C,onPanZoom:i,onTransformChange:pe});x.on("zoom",Te);const me=t_({zoomPanValues:m,panOnDrag:I,panOnScroll:N,onPaneContextMenu:C,onPanZoomEnd:c,onDraggingChange:u});x.on("end",me)}const ae=n_({zoomActivationKeyPressed:Q,panOnDrag:I,zoomOnScroll:W,panOnScroll:N,zoomOnDoubleClick:re,zoomOnPinch:K,userSelectionActive:L,noPanClassName:D,noWheelClassName:O,lib:le});x.filter(ae),re?h.on("dblclick.zoom",y):h.on("dblclick.zoom",null)}function _(){x.on("zoom",null)}async function S(O,D,C){const L=_i(O),N=x?.constrain()(L,D,C);return N&&await E(N),new Promise(I=>I(N))}async function R(O,D){const C=_i(O);return await E(C,D),new Promise(L=>L(C))}function k(O){if(h){const D=_i(O),C=h.property("__zoom");(C.k!==O.zoom||C.x!==O.x||C.y!==O.y)&&x?.transform(h,D,null,{sync:!0})}}function $(){const O=h?Wp(h.node()):{x:0,y:0,k:1};return{x:O.x,y:O.y,zoom:O.k}}function T(O,D){return h?new Promise(C=>{x?.interpolate(D?.interpolate==="linear"?B.interpolate:Mo).scaleTo(wi(h,D?.duration,D?.ease,()=>C(!0)),O)}):Promise.resolve(!1)}function M(O,D){return h?new Promise(C=>{x?.interpolate(D?.interpolate==="linear"?B.interpolate:Mo).scaleBy(wi(h,D?.duration,D?.ease,()=>C(!0)),O)}):Promise.resolve(!1)}function A(O){x?.scaleExtent(O)}function V(O){x?.translateExtent(O)}function Z(O){const D=!Et(O)||O<0?0:O;x?.clickDistance(D)}return{update:b,destroy:_,setViewport:R,setViewportConstrained:S,getViewport:$,scaleTo:T,scaleBy:M,setScaleExtent:A,setTranslateExtent:V,syncViewport:k,setClickDistance:Z}}var nr;(function(e){e.Line="line",e.Handle="handle"})(nr||(nr={}));function o_({width:e,prevWidth:t,height:r,prevHeight:o,affectsX:n,affectsY:s}){const i=e-t,l=r-o,c=[i>0?1:i<0?-1:0,l>0?1:l<0?-1:0];return i&&n&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}function s_(e){const t=e.includes("right")||e.includes("left"),r=e.includes("bottom")||e.includes("top"),o=e.includes("left"),n=e.includes("top");return{isHorizontal:t,isVertical:r,affectsX:o,affectsY:n}}function Yt(e,t){return Math.max(0,t-e)}function Wt(e,t){return Math.max(0,e-t)}function _o(e,t,r){return Math.max(0,t-e,e-r)}function rd(e,t){return e?!t:t}function i_(e,t,r,o,n,s,i,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:m,isVertical:p}=t,x=m&&p,{xSnapped:h,ySnapped:g}=r,{minWidth:y,maxWidth:E,minHeight:b,maxHeight:_}=o,{x:S,y:R,width:k,height:$,aspectRatio:T}=e;let M=Math.floor(m?h-e.pointerX:0),A=Math.floor(p?g-e.pointerY:0);const V=k+(c?-M:M),Z=$+(u?-A:A),O=-s[0]*k,D=-s[1]*$;let C=_o(V,y,E),L=_o(Z,b,_);if(i){let z=0,U=0;c&&M<0?z=Yt(S+M+O,i[0][0]):!c&&M>0&&(z=Wt(S+V+O,i[1][0])),u&&A<0?U=Yt(R+A+D,i[0][1]):!u&&A>0&&(U=Wt(R+Z+D,i[1][1])),C=Math.max(C,z),L=Math.max(L,U)}if(l){let z=0,U=0;c&&M>0?z=Wt(S+M,l[0][0]):!c&&M<0&&(z=Yt(S+V,l[1][0])),u&&A>0?U=Wt(R+A,l[0][1]):!u&&A<0&&(U=Yt(R+Z,l[1][1])),C=Math.max(C,z),L=Math.max(L,U)}if(n){if(m){const z=_o(V/T,b,_)*T;if(C=Math.max(C,z),i){let U=0;!c&&!u||c&&!u&&x?U=Wt(R+D+V/T,i[1][1])*T:U=Yt(R+D+(c?M:-M)/T,i[0][1])*T,C=Math.max(C,U)}if(l){let U=0;!c&&!u||c&&!u&&x?U=Yt(R+V/T,l[1][1])*T:U=Wt(R+(c?M:-M)/T,l[0][1])*T,C=Math.max(C,U)}}if(p){const z=_o(Z*T,y,E)/T;if(L=Math.max(L,z),i){let U=0;!c&&!u||u&&!c&&x?U=Wt(S+Z*T+O,i[1][0])/T:U=Yt(S+(u?A:-A)*T+O,i[0][0])/T,L=Math.max(L,U)}if(l){let U=0;!c&&!u||u&&!c&&x?U=Yt(S+Z*T,l[1][0])/T:U=Wt(S+(u?A:-A)*T,l[0][0])/T,L=Math.max(L,U)}}}A=A+(A<0?L:-L),M=M+(M<0?C:-C),n&&(x?V>Z*T?A=(rd(c,u)?-M:M)/T:M=(rd(c,u)?-A:A)*T:m?(A=M/T,u=c):(M=A*T,c=u));const N=c?S+M:S,I=u?R+A:R;return{width:k+(c?-M:M),height:$+(u?-A:A),x:s[0]*M*(c?-1:1)+N,y:s[1]*A*(u?-1:1)+I}}const Cf={width:0,height:0,x:0,y:0},a_={...Cf,pointerX:0,pointerY:0,aspectRatio:1};function l_(e){return[[0,0],[e.measured.width,e.measured.height]]}function c_(e,t,r){const o=t.position.x+e.position.x,n=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,l=r[0]*s,c=r[1]*i;return[[o-l,n-c],[o+s-l,n+i-c]]}function u_({domNode:e,nodeId:t,getStoreItems:r,onChange:o,onEnd:n}){const s=ct(e);function i({controlPosition:c,boundaries:u,keepAspectRatio:m,resizeDirection:p,onResizeStart:x,onResize:h,onResizeEnd:g,shouldResize:y}){let E={...Cf},b={...a_};const _=s_(c);let S,R=null,k=[],$,T,M;const A=Dp().on("start",V=>{const{nodeLookup:Z,transform:O,snapGrid:D,snapToGrid:C,nodeOrigin:L,paneDomNode:N}=r();if(S=Z.get(t),!S)return;R=N?.getBoundingClientRect()??null;const{xSnapped:I,ySnapped:z}=_r(V.sourceEvent,{transform:O,snapGrid:D,snapToGrid:C,containerBounds:R});E={width:S.measured.width??0,height:S.measured.height??0,x:S.position.x??0,y:S.position.y??0},b={...E,pointerX:I,pointerY:z,aspectRatio:E.width/E.height},$=void 0,S.parentId&&(S.extent==="parent"||S.expandParent)&&($=Z.get(S.parentId),T=$&&S.extent==="parent"?l_($):void 0),k=[],M=void 0;for(const[U,H]of Z)if(H.parentId===t&&(k.push({id:U,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const K=c_(H,S,H.origin??L);M?M=[[Math.min(K[0][0],M[0][0]),Math.min(K[0][1],M[0][1])],[Math.max(K[1][0],M[1][0]),Math.max(K[1][1],M[1][1])]]:M=K}x?.(V,{...E})}).on("drag",V=>{const{transform:Z,snapGrid:O,snapToGrid:D,nodeOrigin:C}=r(),L=_r(V.sourceEvent,{transform:Z,snapGrid:O,snapToGrid:D,containerBounds:R}),N=[];if(!S)return;const{x:I,y:z,width:U,height:H}=E,K={},W=S.origin??C,{width:re,height:Q,x:le,y:pe}=i_(b,_,L,u,m,W,T,M),oe=re!==U,te=Q!==H,ae=le!==I&&oe,we=pe!==z&&te;if(!ae&&!we&&!oe&&!te)return;if((ae||we||W[0]===1||W[1]===1)&&(K.x=ae?le:E.x,K.y=we?pe:E.y,E.x=K.x,E.y=K.y,k.length>0)){const he=le-I,Oe=pe-z;for(const We of k)We.position={x:We.position.x-he+W[0]*(re-U),y:We.position.y-Oe+W[1]*(Q-H)},N.push(We)}if((oe||te)&&(K.width=oe&&(!p||p==="horizontal")?re:E.width,K.height=te&&(!p||p==="vertical")?Q:E.height,E.width=K.width,E.height=K.height),$&&S.expandParent){const he=W[0]*(K.width??0);K.x&&K.x<he&&(E.x=he,b.x=b.x-(K.x-he));const Oe=W[1]*(K.height??0);K.y&&K.y<Oe&&(E.y=Oe,b.y=b.y-(K.y-Oe))}const Te=o_({width:E.width,prevWidth:U,height:E.height,prevHeight:H,affectsX:_.affectsX,affectsY:_.affectsY}),me={...E,direction:Te};y?.(V,me)!==!1&&(h?.(V,me),o(K,N))}).on("end",V=>{g?.(V,{...E}),n?.({...E})});s.call(A)}function l(){s.on(".drag",null)}return{update:i,destroy:l}}var wo={exports:{}},Ci={},Co={exports:{}},ki={};/**
2
2
  * @license React
3
3
  * use-sync-external-store-shim.production.js
4
4
  *