@decocms/mesh 1.8.0 → 1.9.0

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 (117) hide show
  1. package/dist/client/assets/{AlertCircle-CoA9j9_b.js → AlertCircle-BrGqb-qb.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-Bu1JR7vY.js → ArrowLeft-B6h573ak.js} +1 -1
  3. package/dist/client/assets/{ChevronDown-BmUd-Gap.js → ChevronDown-BuogCeI0.js} +1 -1
  4. package/dist/client/assets/{Clock-BGOqsAv_.js → Clock-LzAlJ-1R.js} +1 -1
  5. package/dist/client/assets/{Code01-C4I9q0rm.js → Code01-Wll8WS4F.js} +1 -1
  6. package/dist/client/assets/{Copy01-D_YhbDiF.js → Copy01-_s71W2Ph.js} +1 -1
  7. package/dist/client/assets/{CpuChip02-BkDt7iNK.js → CpuChip02-BwTl0fBj.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-CxdZClGh.js → DotsVertical-BQk5hPxb.js} +1 -1
  9. package/dist/client/assets/{File06-BdMasDPT.js → File06-CpSSTggW.js} +1 -1
  10. package/dist/client/assets/{FlipBackward-B34yEzR2.js → FlipBackward-C0O2fx27.js} +1 -1
  11. package/dist/client/assets/{GitBranch01-D2Rua42v.js → GitBranch01-DjmPf135.js} +1 -1
  12. package/dist/client/assets/{Grid01-Bom2qqwm.js → Grid01-CmB5R6oU.js} +1 -1
  13. package/dist/client/assets/{Inbox01-Arx8J2Oq.js → Inbox01-Ct-8Lwpv.js} +1 -1
  14. package/dist/client/assets/{InfoCircle-BYXT4R1l.js → InfoCircle-D6JXYJn_.js} +1 -1
  15. package/dist/client/assets/{Key01-D0WGLaST.js → Key01-ZVAVplBN.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-LVkx-wZF.js → LinkExternal01-DfHTXuZ9.js} +1 -1
  17. package/dist/client/assets/{Loading01-Dw6V1r3u.js → Loading01-0wYmSKV6.js} +1 -1
  18. package/dist/client/assets/{Lock01-Dw2P1WZh.js → Lock01-D5nrmOSx.js} +1 -1
  19. package/dist/client/assets/{Play-BRRssd_q.js → Play-BedrzKsi.js} +1 -1
  20. package/dist/client/assets/{Plus-CQSfshmp.js → Plus-DofiSAMU.js} +1 -1
  21. package/dist/client/assets/{SearchMd-CGUWNVUr.js → SearchMd-D70t5LVP.js} +1 -1
  22. package/dist/client/assets/{Terminal-CIo_ltVk.js → Terminal-CStBCUAd.js} +1 -1
  23. package/dist/client/assets/{Trash01-BgGiU9JZ.js → Trash01-DnTS63e5.js} +1 -1
  24. package/dist/client/assets/{X-CsW5kmRT.js → X-DeVUfdHG.js} +1 -1
  25. package/dist/client/assets/{XClose-D2IdV8gs.js → XClose-5A0s2w1d.js} +1 -1
  26. package/dist/client/assets/{alert-dialog-rSIOP2OM.js → alert-dialog-BU8uTWb8.js} +1 -1
  27. package/dist/client/assets/{auth-D6vm_lfk.js → auth-DpA5_jth.js} +1 -1
  28. package/dist/client/assets/{auth-catchall-lDj0BXu4.js → auth-catchall-2WBu6I6H.js} +1 -1
  29. package/dist/client/assets/{avatar-C45Lgbwv.js → avatar-KDpJ2jsd.js} +1 -1
  30. package/dist/client/assets/{badge-Z-ujar-h.js → badge-CStgouQf.js} +1 -1
  31. package/dist/client/assets/{button-DMnSM5FV.js → button-IijH0wdI.js} +1 -1
  32. package/dist/client/assets/{card-DL_e-uTF.js → card-BnWpolEI.js} +1 -1
  33. package/dist/client/assets/{checkbox-SCLb_n1h.js → checkbox-BYeNlYdH.js} +1 -1
  34. package/dist/client/assets/collection-detail-DnxFiEu9.js +165 -0
  35. package/dist/client/assets/{collection-display-button-BbSV76WH.js → collection-display-button-2ZQ5sQTW.js} +1 -1
  36. package/dist/client/assets/{collection-header-CqO1LmKH.js → collection-header-DBUE7n6H.js} +1 -1
  37. package/dist/client/assets/{collection-page-DDVR6yeu.js → collection-page-BHk1uJKe.js} +1 -1
  38. package/dist/client/assets/{collection-search-BOBOP2ro.js → collection-search-CM9rltH6.js} +1 -1
  39. package/dist/client/assets/{collection-tab-CNlP707v.js → collection-tab-ClOnLgHC.js} +1 -1
  40. package/dist/client/assets/{collection-table-wrapper-ByX0J-nn.js → collection-table-wrapper-BRI7T6RJ.js} +1 -1
  41. package/dist/client/assets/{connection-card-CZFyOgeO.js → connection-card-DMv3uM_n.js} +1 -1
  42. package/dist/client/assets/{connection-detail-oL5IGO2h.js → connection-detail-Cs5NpuH7.js} +1 -1
  43. package/dist/client/assets/{connections-BKlzJU2y.js → connections-DSbytdP0.js} +1 -1
  44. package/dist/client/assets/constants-TKUQnnwA.js +1 -0
  45. package/dist/client/assets/{create-organization-dialog-lmQ3mepV.js → create-organization-dialog-DbNHSUuq.js} +1 -1
  46. package/dist/client/assets/{dialog-B1fXXmBI.js → dialog-CJsBFVDy.js} +1 -1
  47. package/dist/client/assets/{dropdown-menu-gRHakuHp.js → dropdown-menu-BvLCKekW.js} +1 -1
  48. package/dist/client/assets/{empty-state-BiqF__Lu.js → empty-state-Bg-FRZa4.js} +1 -1
  49. package/dist/client/assets/{env-vars-editor-Br0Q2jee.js → env-vars-editor-Z7SwcUr8.js} +1 -1
  50. package/dist/client/assets/{error-boundary-CUq8HVcH.js → error-boundary-CsEoagci.js} +1 -1
  51. package/dist/client/assets/{extract-connection-data-DsJuSGHU.js → extract-connection-data-BgA1QcA6.js} +1 -1
  52. package/dist/client/assets/{form-BbwJs-Od.js → form-BjarY-Jq.js} +1 -1
  53. package/dist/client/assets/{formatDistanceToNow-jHI_IOun.js → formatDistanceToNow-fhdySMxO.js} +1 -1
  54. package/dist/client/assets/gateway-detail-DeFxNps5.js +1 -0
  55. package/dist/client/assets/{gateways-BfCNNBIO.js → gateways-CXlSFkKr.js} +1 -1
  56. package/dist/client/assets/{home-oGaB9rtf.js → home-BXCs6vTQ.js} +1 -1
  57. package/dist/client/assets/index-9pHY4m3c.css +1 -0
  58. package/dist/client/assets/{index-B1eBXzBF.js → index-BGEzzv-W.js} +1 -1
  59. package/dist/client/assets/{index-BVHhSH8M.js → index-BLgTJ8o3.js} +2 -2
  60. package/dist/client/assets/{index-BbK2Byrj.js → index-B_OB0BCO.js} +1 -1
  61. package/dist/client/assets/{index-BMIizA12.js → index-CRGUNI2v.js} +1 -1
  62. package/dist/client/assets/{input-C6vwKKeq.js → input-BxywPo2X.js} +1 -1
  63. package/dist/client/assets/{layout-m8iq6RWE.js → layout-Dfp1nH3g.js} +1 -1
  64. package/dist/client/assets/lazy-highlighter-DYlTa9LA.js +9 -0
  65. package/dist/client/assets/{localstorage-keys-BB9xpX5T.js → localstorage-keys-Bj9V9Nbd.js} +1 -1
  66. package/dist/client/assets/{login-CevUioqo.js → login-BfaeBzql.js} +1 -1
  67. package/dist/client/assets/{mcp-oauth-CE6Gg3ul.js → mcp-oauth-Vd_yzV5S.js} +1 -1
  68. package/dist/client/assets/{members-CAJLI1Ui.js → members-fIe1QSNh.js} +1 -1
  69. package/dist/client/assets/monaco-editor-mQfzbJMr.js +19 -0
  70. package/dist/client/assets/monitoring-I1RqzeAN.js +4 -0
  71. package/dist/client/assets/{oauth-callback-DnSysdpG.js → oauth-callback-Cwog6Jzh.js} +1 -1
  72. package/dist/client/assets/{page-jzi_ERcf.js → page-BVptnX4j.js} +2 -2
  73. package/dist/client/assets/{pin-to-sidebar-button-DonhySMf.js → pin-to-sidebar-button-C8t5xznu.js} +1 -1
  74. package/dist/client/assets/{popover-BO5GT9tA.js → popover-CwHNob2q.js} +1 -1
  75. package/dist/client/assets/{resizable-DpISfhV6.js → resizable-DybyPt6-.js} +1 -1
  76. package/dist/client/assets/{resource-tabs-JMDBPJhv.js → resource-tabs-s0IiCCzU.js} +1 -1
  77. package/dist/client/assets/{responsive-select-BZGantuu.js → responsive-select-INSf3elv.js} +1 -1
  78. package/dist/client/assets/{select-mD7lFwRj.js → select-C0rvNlZx.js} +1 -1
  79. package/dist/client/assets/{settings-iXHGs-4V.js → settings-3Or8ShnF.js} +1 -1
  80. package/dist/client/assets/{shell-layout-C1VOF_px.js → shell-layout-4x0MHQQc.js} +1 -1
  81. package/dist/client/assets/{spinner-D7to-RHc.js → spinner-D7ZAVJCR.js} +1 -1
  82. package/dist/client/assets/{store-C7bepdKu.js → store-Bl_0XUq8.js} +1 -1
  83. package/dist/client/assets/{store-app-detail-dqrfmC2K.js → store-app-detail--3qLKygc.js} +1 -1
  84. package/dist/client/assets/{switch-CpJO-7Kf.js → switch-D37mVt_9.js} +1 -1
  85. package/dist/client/assets/{textarea-Dma5FaAA.js → textarea-DNeEC-Sl.js} +1 -1
  86. package/dist/client/assets/{thread-history-popover-DTmh-wTW.js → thread-history-popover-CykPOF9f.js} +14 -14
  87. package/dist/client/assets/{tools-list-DJTZFgWM.js → tools-list-CFmwpEf4.js} +1 -1
  88. package/dist/client/assets/{tooltip-DiQ9SlNX.js → tooltip-CSuczTFq.js} +1 -1
  89. package/dist/client/assets/{types-Bq0bBlbx.js → types-CJK7iTsI.js} +2 -2
  90. package/dist/client/assets/{use-binding-DQTEUjPl.js → use-binding-C5e_Y70M.js} +1 -1
  91. package/dist/client/assets/{use-connection-DUMeVexv.js → use-connection-CsPrFY0x.js} +1 -1
  92. package/dist/client/assets/{use-connection-resources-GqC2zg91.js → use-connection-resources-CjjFKWSM.js} +1 -1
  93. package/dist/client/assets/{use-gateway-pQG4iSzq.js → use-gateway-Bz_y7oh7.js} +1 -1
  94. package/dist/client/assets/{use-list-state-DKjekACN.js → use-list-state-B13SO1z3.js} +1 -1
  95. package/dist/client/assets/{use-mcp-CaAgRxkf.js → use-mcp-CPBDJGOj.js} +1 -1
  96. package/dist/client/assets/{use-members-Cxbw-nUt.js → use-members-b3tDRslY.js} +1 -1
  97. package/dist/client/assets/{use-mobile-C2teUdDI.js → use-mobile-VYFif8jU.js} +1 -1
  98. package/dist/client/assets/{use-organization-settings-B-bw0Nsb.js → use-organization-settings-i4aS_Egu.js} +1 -1
  99. package/dist/client/assets/{use-tool-call-BwHyofVZ.js → use-tool-call-BdbJ3oy8.js} +1 -1
  100. package/dist/client/assets/useQuery-DXchCtgN.js +1 -0
  101. package/dist/client/assets/{useSuspenseInfiniteQuery-WWHYgeeq.js → useSuspenseInfiniteQuery-BLpBJxLd.js} +1 -1
  102. package/dist/client/assets/{view-mode-toggle-DCDdw_zu.js → view-mode-toggle-BXo-WMnB.js} +1 -1
  103. package/dist/client/assets/{workflow-nViVDMOR.js → workflow-wGJTSVc-.js} +1 -1
  104. package/dist/client/index.html +2 -2
  105. package/package.json +1 -3
  106. package/dist/client/assets/collection-detail-DZRR92ph.js +0 -183
  107. package/dist/client/assets/constants-C4MXZrmv.js +0 -1
  108. package/dist/client/assets/core-D9xILP6l.js +0 -6
  109. package/dist/client/assets/gateway-detail-CvVf3uBW.js +0 -1
  110. package/dist/client/assets/index-B3GsxHkT.css +0 -1
  111. package/dist/client/assets/json-BESjz4hO.js +0 -1
  112. package/dist/client/assets/json-GXJs871j.js +0 -1
  113. package/dist/client/assets/json-syntax-highlighter-C3W2DACo.js +0 -2
  114. package/dist/client/assets/lazy-highlighter-C7qLCeM-.js +0 -4
  115. package/dist/client/assets/monitoring-_9gwma-O.js +0 -4
  116. package/dist/client/assets/prism-light-WCI-7yyK.js +0 -1
  117. package/dist/client/assets/useQuery-C3iXPPho.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as C,z as Wn,j as h,B as Tn,E as rc,F as ue,H as sc,I as Or,J as ic,L as ac,M as cc,i as lc,c as se,Q as uc,f as ye,V as Zn}from"./index-BVHhSH8M.js";import{u as nn,c as je,I as He,n as Gt}from"./use-connection-DUMeVexv.js";import{C as dc}from"./collection-header-CqO1LmKH.js";import{C as fc}from"./collection-page-DDVR6yeu.js";import{E as Ye}from"./error-boundary-CUq8HVcH.js";import{u as Te}from"./use-tool-call-BwHyofVZ.js";import{u as Se}from"./tooltip-DiQ9SlNX.js";import{c as on,B as An}from"./button-DMnSM5FV.js";import{V as hc}from"./view-mode-toggle-DCDdw_zu.js";import{i as mc}from"./GitBranch01-D2Rua42v.js";import{s as Rr}from"./Plus-CQSfshmp.js";import{i as Hr}from"./CpuChip02-BkDt7iNK.js";import{u as Vr}from"./use-gateway-pQG4iSzq.js";import{i as ze,a as ko,b as gc,c as Po,d as bn,e as _n,f as Br,s as Fr,D as Kn,g as Gr,h as pc,Z as Un,L as Qn,u as Xr,j as yc,k as xc,l as Dn,m as Yr,n as Jn,o as qr,p as Wr,q as Zr,r as vc,t as wc,v as bc,w as jo,x as _c,y as Kr,z as Ur,R as Sc,S as Nc,A as Ec,B as Qr,C as Cc,E as Mc,F as Ic,G as kc,H as Pc,I as jc,J as Jr,K as To,M as Tc,N as Ac,O as ct,P as Dc,Q as Lc,T as $c,U as zc,V as Oc,W as Rc,X as Hc,Y as Vc,_ as Bc,$ as Ae,a0 as Fc,a1 as Gc,a2 as rn}from"./types-Bq0bBlbx.js";import{B as Xc}from"./badge-Z-ujar-h.js";import"./collection-display-button-BbSV76WH.js";import"./dropdown-menu-gRHakuHp.js";import"./Grid01-Bom2qqwm.js";import"./useQuery-C3iXPPho.js";import"./index-B1eBXzBF.js";import"./popover-BO5GT9tA.js";import"./Copy01-D_YhbDiF.js";import"./Key01-D0WGLaST.js";import"./Play-BRRssd_q.js";import"./json-syntax-highlighter-C3W2DACo.js";const es=({size:e=24,color:t="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M18 20V10m-6 10V4M6 20v-6"}));es.displayName="BarChart01";const ts=({size:e=24,color:t="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M5.52 2.64 3.96 4.72c-.309.412-.463.618-.46.79a.5.5 0 0 0 .192.384C3.828 6 4.085 6 4.6 6h14.8c.515 0 .773 0 .908-.106a.5.5 0 0 0 .192-.384c.003-.172-.151-.378-.46-.79l-1.56-2.08m-12.96 0c.176-.235.264-.352.376-.437a1 1 0 0 1 .33-.165C6.36 2 6.505 2 6.8 2h10.4c.293 0 .44 0 .575.038a1 1 0 0 1 .33.165c.111.085.199.202.375.437m-12.96 0L3.64 5.147c-.237.316-.356.475-.44.649a2 2 0 0 0-.163.487C3 6.473 3 6.671 3 7.067V18.8c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 22 5.08 22 6.2 22h11.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 20.48 21 19.92 21 18.8V7.067c0-.396 0-.594-.037-.784a1.998 1.998 0 0 0-.163-.487c-.084-.174-.203-.333-.44-.65L18.48 2.64M16 10a4 4 0 1 1-8 0"}));ts.displayName="ShoppingBag01";function De(){const e=new Date,t=new Date;t.setHours(e.getHours()-24),t.setSeconds(0,0);const n=new Date(e);return n.setHours(n.getHours()+1),n.setSeconds(0,0),{startDate:t.toISOString(),endDate:n.toISOString()}}var ns="Toggle",os=C.forwardRef((e,t)=>{const{pressed:n,defaultPressed:o,onPressedChange:r,...s}=e,[i,a]=Wn({prop:n,onChange:r,defaultProp:o??!1,caller:ns});return h.jsx(Tn.button,{type:"button","aria-pressed":i,"data-state":i?"on":"off","data-disabled":e.disabled?"":void 0,...s,ref:t,onClick:rc(e.onClick,()=>{e.disabled||a(!i)})})});os.displayName=ns;var Le="ToggleGroup",[rs]=sc(Le,[Or]),ss=Or(),eo=ue.forwardRef((e,t)=>{const{type:n,...o}=e;if(n==="single"){const r=o;return h.jsx(Yc,{...r,ref:t})}if(n==="multiple"){const r=o;return h.jsx(qc,{...r,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${Le}\``)});eo.displayName=Le;var[is,as]=rs(Le),Yc=ue.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=()=>{},...s}=e,[i,a]=Wn({prop:n,defaultProp:o??"",onChange:r,caller:Le});return h.jsx(is,{scope:e.__scopeToggleGroup,type:"single",value:ue.useMemo(()=>i?[i]:[],[i]),onItemActivate:a,onItemDeactivate:ue.useCallback(()=>a(""),[a]),children:h.jsx(cs,{...s,ref:t})})}),qc=ue.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=()=>{},...s}=e,[i,a]=Wn({prop:n,defaultProp:o??[],onChange:r,caller:Le}),l=ue.useCallback(u=>a((d=[])=>[...d,u]),[a]),c=ue.useCallback(u=>a((d=[])=>d.filter(f=>f!==u)),[a]);return h.jsx(is,{scope:e.__scopeToggleGroup,type:"multiple",value:i,onItemActivate:l,onItemDeactivate:c,children:h.jsx(cs,{...s,ref:t})})});eo.displayName=Le;var[Wc,Zc]=rs(Le),cs=ue.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:o=!1,rovingFocus:r=!0,orientation:s,dir:i,loop:a=!0,...l}=e,c=ss(n),u=ac(i),d={role:"group",dir:u,...l};return h.jsx(Wc,{scope:n,rovingFocus:r,disabled:o,children:r?h.jsx(cc,{asChild:!0,...c,orientation:s,dir:u,loop:a,children:h.jsx(Tn.div,{...d,ref:t})}):h.jsx(Tn.div,{...d,ref:t})})}),Xt="ToggleGroupItem",ls=ue.forwardRef((e,t)=>{const n=as(Xt,e.__scopeToggleGroup),o=Zc(Xt,e.__scopeToggleGroup),r=ss(e.__scopeToggleGroup),s=n.value.includes(e.value),i=o.disabled||e.disabled,a={...e,pressed:s,disabled:i},l=ue.useRef(null);return o.rovingFocus?h.jsx(ic,{asChild:!0,...r,focusable:!i,active:s,ref:l,children:h.jsx(Ao,{...a,ref:t})}):h.jsx(Ao,{...a,ref:t})});ls.displayName=Xt;var Ao=ue.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:o,...r}=e,s=as(Xt,n),i={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},a=s.type==="single"?i:void 0;return h.jsx(os,{...a,...r,ref:t,onPressedChange:l=>{l?s.onItemActivate(o):s.onItemDeactivate(o)}})}),Kc=eo,Uc=ls;const Qc=lc("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-2 min-w-9",sm:"h-7 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),us=C.createContext({size:"default",variant:"default"});function ds(e){const t=se.c(20);let n,o,r,s,i;t[0]!==e?({className:o,variant:i,size:s,children:n,...r}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=s,t[5]=i):(n=t[1],o=t[2],r=t[3],s=t[4],i=t[5]);let a;t[6]!==o?(a=on("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",o),t[6]=o,t[7]=a):a=t[7];let l;t[8]!==s||t[9]!==i?(l={variant:i,size:s},t[8]=s,t[9]=i,t[10]=l):l=t[10];let c;t[11]!==n||t[12]!==l?(c=h.jsx(us.Provider,{value:l,children:n}),t[11]=n,t[12]=l,t[13]=c):c=t[13];let u;return t[14]!==r||t[15]!==s||t[16]!==a||t[17]!==c||t[18]!==i?(u=h.jsx(Kc,{"data-slot":"toggle-group","data-variant":i,"data-size":s,className:a,...r,children:c}),t[14]=r,t[15]=s,t[16]=a,t[17]=c,t[18]=i,t[19]=u):u=t[19],u}function Ze(e){const t=se.c(18);let n,o,r,s,i;t[0]!==e?({className:o,children:n,variant:i,size:s,...r}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=s,t[5]=i):(n=t[1],o=t[2],r=t[3],s=t[4],i=t[5]);const a=C.useContext(us),l=a.variant||i,c=a.size||s;let u;t[6]!==o||t[7]!==a.size||t[8]!==a.variant||t[9]!==s||t[10]!==i?(u=on(Qc({variant:a.variant||i,size:a.size||s}),"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",o),t[6]=o,t[7]=a.size,t[8]=a.variant,t[9]=s,t[10]=i,t[11]=u):u=t[11];let d;return t[12]!==n||t[13]!==r||t[14]!==l||t[15]!==c||t[16]!==u?(d=h.jsx(Uc,{"data-slot":"toggle-group-item","data-variant":l,"data-size":c,className:u,...r,children:n}),t[12]=n,t[13]=r,t[14]=l,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Jc={value:()=>{}};function sn(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new zt(n)}function zt(e){this._=e}function el(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}zt.prototype=sn.prototype={constructor:zt,on:function(e,t){var n=this._,o=el(e+"",n),r,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((r=(e=o[s]).type)&&(r=tl(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(r=(e=o[s]).type)n[r]=Do(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Do(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new zt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,s;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,r=s.length;o<r;++o)s[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)}};function tl(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Do(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Jc,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ln="http://www.w3.org/1999/xhtml";const Lo={svg:"http://www.w3.org/2000/svg",xhtml:Ln,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function an(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Lo.hasOwnProperty(t)?{space:Lo[t],local:e}:e}function nl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ln&&t.documentElement.namespaceURI===Ln?t.createElement(e):t.createElementNS(n,e)}}function ol(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function fs(e){var t=an(e);return(t.local?ol:nl)(t)}function rl(){}function to(e){return e==null?rl:function(){return this.querySelector(e)}}function sl(e){typeof e!="function"&&(e=to(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=new Array(i),l,c,u=0;u<i;++u)(l=s[u])&&(c=e.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new le(o,this._parents)}function il(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function al(){return[]}function hs(e){return e==null?al:function(){return this.querySelectorAll(e)}}function cl(e){return function(){return il(e.apply(this,arguments))}}function ll(e){typeof e=="function"?e=cl(e):e=hs(e);for(var t=this._groups,n=t.length,o=[],r=[],s=0;s<n;++s)for(var i=t[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&(o.push(e.call(l,l.__data__,c,i)),r.push(l));return new le(o,r)}function ms(e){return function(){return this.matches(e)}}function gs(e){return function(t){return t.matches(e)}}var ul=Array.prototype.find;function dl(e){return function(){return ul.call(this.children,e)}}function fl(){return this.firstElementChild}function hl(e){return this.select(e==null?fl:dl(typeof e=="function"?e:gs(e)))}var ml=Array.prototype.filter;function gl(){return Array.from(this.children)}function pl(e){return function(){return ml.call(this.children,e)}}function yl(e){return this.selectAll(e==null?gl:pl(typeof e=="function"?e:gs(e)))}function xl(e){typeof e!="function"&&(e=ms(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new le(o,this._parents)}function ps(e){return new Array(e.length)}function vl(){return new le(this._enter||this._groups.map(ps),this._parents)}function Yt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Yt.prototype={constructor:Yt,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 wl(e){return function(){return e}}function bl(e,t,n,o,r,s){for(var i=0,a,l=t.length,c=s.length;i<c;++i)(a=t[i])?(a.__data__=s[i],o[i]=a):n[i]=new Yt(e,s[i]);for(;i<l;++i)(a=t[i])&&(r[i]=a)}function _l(e,t,n,o,r,s,i){var a,l,c=new Map,u=t.length,d=s.length,f=new Array(u),g;for(a=0;a<u;++a)(l=t[a])&&(f[a]=g=i.call(l,l.__data__,a,t)+"",c.has(g)?r[a]=l:c.set(g,l));for(a=0;a<d;++a)g=i.call(e,s[a],a,s)+"",(l=c.get(g))?(o[a]=l,l.__data__=s[a],c.delete(g)):n[a]=new Yt(e,s[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function Sl(e){return e.__data__}function Nl(e,t){if(!arguments.length)return Array.from(this,Sl);var n=t?_l:bl,o=this._parents,r=this._groups;typeof e!="function"&&(e=wl(e));for(var s=r.length,i=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=o[c],d=r[c],f=d.length,g=El(e.call(u,u&&u.__data__,c,o)),m=g.length,y=a[c]=new Array(m),v=i[c]=new Array(m),x=l[c]=new Array(f);n(u,d,y,v,x,g,t);for(var _=0,p=0,w,M;_<m;++_)if(w=y[_]){for(_>=p&&(p=_+1);!(M=v[p])&&++p<m;);w._next=M||null}}return i=new le(i,o),i._enter=a,i._exit=l,i}function El(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Cl(){return new le(this._exit||this._groups.map(ps),this._parents)}function Ml(e,t,n){var o=this.enter(),r=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?s.remove():n(s),o&&r?o.merge(r).order():r}function Il(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,s=o.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=n[l],u=o[l],d=c.length,f=a[l]=new Array(d),g,m=0;m<d;++m)(g=c[m]||u[m])&&(f[m]=g);for(;l<r;++l)a[l]=n[l];return new le(a,this._parents)}function kl(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,s=o[r],i;--r>=0;)(i=o[r])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function Pl(e){e||(e=jl);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s){for(var i=n[s],a=i.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=i[u])&&(l[u]=c);l.sort(t)}return new le(r,this._parents).order()}function jl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Tl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Al(){return Array.from(this)}function Dl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length;r<s;++r){var i=o[r];if(i)return i}return null}function Ll(){let e=0;for(const t of this)++e;return e}function $l(){return!this.node()}function zl(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],s=0,i=r.length,a;s<i;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function Ol(e){return function(){this.removeAttribute(e)}}function Rl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hl(e,t){return function(){this.setAttribute(e,t)}}function Vl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Bl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Fl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Gl(e,t){var n=an(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Rl:Ol:typeof t=="function"?n.local?Fl:Bl:n.local?Vl:Hl)(n,t))}function ys(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Xl(e){return function(){this.style.removeProperty(e)}}function Yl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ql(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Wl(e,t,n){return arguments.length>1?this.each((t==null?Xl:typeof t=="function"?ql:Yl)(e,t,n??"")):Ue(this.node(),e)}function Ue(e,t){return e.style.getPropertyValue(t)||ys(e).getComputedStyle(e,null).getPropertyValue(t)}function Zl(e){return function(){delete this[e]}}function Kl(e,t){return function(){this[e]=t}}function Ul(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ql(e,t){return arguments.length>1?this.each((t==null?Zl:typeof t=="function"?Ul:Kl)(e,t)):this.node()[e]}function xs(e){return e.trim().split(/^|\s+/)}function no(e){return e.classList||new vs(e)}function vs(e){this._node=e,this._names=xs(e.getAttribute("class")||"")}vs.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 ws(e,t){for(var n=no(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function bs(e,t){for(var n=no(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Jl(e){return function(){ws(this,e)}}function eu(e){return function(){bs(this,e)}}function tu(e,t){return function(){(t.apply(this,arguments)?ws:bs)(this,e)}}function nu(e,t){var n=xs(e+"");if(arguments.length<2){for(var o=no(this.node()),r=-1,s=n.length;++r<s;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?tu:t?Jl:eu)(n,t))}function ou(){this.textContent=""}function ru(e){return function(){this.textContent=e}}function su(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function iu(e){return arguments.length?this.each(e==null?ou:(typeof e=="function"?su:ru)(e)):this.node().textContent}function au(){this.innerHTML=""}function cu(e){return function(){this.innerHTML=e}}function lu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function uu(e){return arguments.length?this.each(e==null?au:(typeof e=="function"?lu:cu)(e)):this.node().innerHTML}function du(){this.nextSibling&&this.parentNode.appendChild(this)}function fu(){return this.each(du)}function hu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mu(){return this.each(hu)}function gu(e){var t=typeof e=="function"?e:fs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function pu(){return null}function yu(e,t){var n=typeof e=="function"?e:fs(e),o=t==null?pu:typeof t=="function"?t:to(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function xu(){var e=this.parentNode;e&&e.removeChild(this)}function vu(){return this.each(xu)}function wu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function bu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _u(e){return this.select(e?bu:wu)}function Su(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Nu(e){return function(t){e.call(this,t,this.__data__)}}function Eu(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Cu(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,s;n<r;++n)s=t[n],(!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 Mu(e,t,n){return function(){var o=this.__on,r,s=Nu(t);if(o){for(var i=0,a=o.length;i<a;++i)if((r=o[i]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},o?o.push(r):this.__on=[r]}}function Iu(e,t,n){var o=Eu(e+""),r,s=o.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?Mu:Cu,r=0;r<s;++r)this.each(a(o[r],t,n));return this}function _s(e,t,n){var o=ys(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function ku(e,t){return function(){return _s(this,e,t)}}function Pu(e,t){return function(){return _s(this,e,t.apply(this,arguments))}}function ju(e,t){return this.each((typeof t=="function"?Pu:ku)(e,t))}function*Tu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length,i;r<s;++r)(i=o[r])&&(yield i)}var Ss=[null];function le(e,t){this._groups=e,this._parents=t}function St(){return new le([[document.documentElement]],Ss)}function Au(){return this}le.prototype=St.prototype={constructor:le,select:sl,selectAll:ll,selectChild:hl,selectChildren:yl,filter:xl,data:Nl,enter:vl,exit:Cl,join:Ml,merge:Il,selection:Au,order:kl,sort:Pl,call:Tl,nodes:Al,node:Dl,size:Ll,empty:$l,each:zl,attr:Gl,style:Wl,property:Ql,classed:nu,text:iu,html:uu,raise:fu,lower:mu,append:gu,insert:yu,remove:vu,clone:_u,datum:Su,on:Iu,dispatch:ju,[Symbol.iterator]:Tu};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Ss)}function Du(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Du(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Lu={passive:!1},gt={capture:!0,passive:!1};function Sn(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function Ns(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Ke,gt);"onselectstart"in t?n.on("selectstart.drag",Ke,gt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Es(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ke,gt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const kt=e=>()=>e;function $n(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}$n.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function $u(e){return!e.ctrlKey&&!e.button}function zu(){return this.parentNode}function Ou(e,t){return t??{x:e.x,y:e.y}}function Ru(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cs(){var e=$u,t=zu,n=Ou,o=Ru,r={},s=sn("start","drag","end"),i=0,a,l,c,u,d=0;function f(w){w.on("mousedown.drag",g).filter(o).on("touchstart.drag",v).on("touchmove.drag",x,Lu).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(w,M){if(!(u||!e.call(this,w,M))){var S=p(this,t.call(this,w,M),w,M,"mouse");S&&(ce(w.view).on("mousemove.drag",m,gt).on("mouseup.drag",y,gt),Ns(w.view),Sn(w),c=!1,a=w.clientX,l=w.clientY,S("start",w))}}function m(w){if(Ke(w),!c){var M=w.clientX-a,S=w.clientY-l;c=M*M+S*S>d}r.mouse("drag",w)}function y(w){ce(w.view).on("mousemove.drag mouseup.drag",null),Es(w.view,c),Ke(w),r.mouse("end",w)}function v(w,M){if(e.call(this,w,M)){var S=w.changedTouches,N=t.call(this,w,M),D=S.length,T,z;for(T=0;T<D;++T)(z=p(this,N,w,M,S[T].identifier,S[T]))&&(Sn(w),z("start",w,S[T]))}}function x(w){var M=w.changedTouches,S=M.length,N,D;for(N=0;N<S;++N)(D=r[M[N].identifier])&&(Ke(w),D("drag",w,M[N]))}function _(w){var M=w.changedTouches,S=M.length,N,D;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<S;++N)(D=r[M[N].identifier])&&(Sn(w),D("end",w,M[N]))}function p(w,M,S,N,D,T){var z=s.copy(),E=de(T||S,M),L,$,b;if((b=n.call(w,new $n("beforestart",{sourceEvent:S,target:f,identifier:D,active:i,x:E[0],y:E[1],dx:0,dy:0,dispatch:z}),N))!=null)return L=b.x-E[0]||0,$=b.y-E[1]||0,function k(I,A,P){var j=E,O;switch(I){case"start":r[D]=k,O=i++;break;case"end":delete r[D],--i;case"drag":E=de(P||A,M),O=i;break}z.call(I,w,new $n(I,{sourceEvent:A,subject:b,target:f,identifier:D,active:O,x:E[0]+L,y:E[1]+$,dx:E[0]-j[0],dy:E[1]-j[1],dispatch:z}),N)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:kt(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:kt(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:kt(w),f):n},f.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:kt(!!w),f):o},f.on=function(){var w=s.on.apply(s,arguments);return w===s?f:w},f.clickDistance=function(w){return arguments.length?(d=(w=+w)*w,f):Math.sqrt(d)},f}var $o=180/Math.PI,zn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ms(e,t,n,o,r,s){var i,a,l;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*$o,skewX:Math.atan(l)*$o,scaleX:i,scaleY:a}}var Pt;function Hu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?zn:Ms(t.a,t.b,t.c,t.d,t.e,t.f)}function Vu(e){return e==null||(Pt||(Pt=document.createElementNS("http://www.w3.org/2000/svg","g")),Pt.setAttribute("transform",e),!(e=Pt.transform.baseVal.consolidate()))?zn:(e=e.matrix,Ms(e.a,e.b,e.c,e.d,e.e,e.f))}function Is(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function s(c,u,d,f,g,m){if(c!==d||u!==f){var y=g.push("translate(",null,t,null,n);m.push({i:y-4,x:ze(c,d)},{i:y-2,x:ze(u,f)})}else(d||f)&&g.push("translate("+d+t+f+n)}function i(c,u,d,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:ze(c,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(c,u,d,f){c!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:ze(c,u)}):u&&d.push(r(d)+"skewX("+u+o)}function l(c,u,d,f,g,m){if(c!==d||u!==f){var y=g.push(r(g)+"scale(",null,",",null,")");m.push({i:y-4,x:ze(c,d)},{i:y-2,x:ze(u,f)})}else(d!==1||f!==1)&&g.push(r(g)+"scale("+d+","+f+")")}return function(c,u){var d=[],f=[];return c=e(c),u=e(u),s(c.translateX,c.translateY,u.translateX,u.translateY,d,f),i(c.rotate,u.rotate,d,f),a(c.skewX,u.skewX,d,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(g){for(var m=-1,y=f.length,v;++m<y;)d[(v=f[m]).i]=v.x(g);return d.join("")}}}var Bu=Is(Hu,"px, ","px)","deg)"),Fu=Is(Vu,", ",")",")"),Gu=1e-12;function zo(e){return((e=Math.exp(e))+1/e)/2}function Xu(e){return((e=Math.exp(e))-1/e)/2}function Yu(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ot=(function e(t,n,o){function r(s,i){var a=s[0],l=s[1],c=s[2],u=i[0],d=i[1],f=i[2],g=u-a,m=d-l,y=g*g+m*m,v,x;if(y<Gu)x=Math.log(f/c)/t,v=function(N){return[a+N*g,l+N*m,c*Math.exp(t*N*x)]};else{var _=Math.sqrt(y),p=(f*f-c*c+o*y)/(2*c*n*_),w=(f*f-c*c-o*y)/(2*f*n*_),M=Math.log(Math.sqrt(p*p+1)-p),S=Math.log(Math.sqrt(w*w+1)-w);x=(S-M)/t,v=function(N){var D=N*x,T=zo(M),z=c/(n*_)*(T*Yu(t*D+M)-Xu(M));return[a+z*g,l+z*m,c*T/zo(t*D+M)]}}return v.duration=x*1e3*t/Math.SQRT2,v}return r.rho=function(s){var i=Math.max(.001,+s),a=i*i,l=a*a;return e(i,a,l)},r})(Math.SQRT2,2,4);var Qe=0,dt=0,lt=0,ks=1e3,qt,ft,Wt=0,Ve=0,cn=0,pt=typeof performance=="object"&&performance.now?performance:Date,Ps=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oo(){return Ve||(Ps(qu),Ve=pt.now()+cn)}function qu(){Ve=0}function Zt(){this._call=this._time=this._next=null}Zt.prototype=js.prototype={constructor:Zt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?oo():+n)+(t==null?0:+t),!this._next&&ft!==this&&(ft?ft._next=this:qt=this,ft=this),this._call=e,this._time=n,On()},stop:function(){this._call&&(this._call=null,this._time=1/0,On())}};function js(e,t,n){var o=new Zt;return o.restart(e,t,n),o}function Wu(){oo(),++Qe;for(var e=qt,t;e;)(t=Ve-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function Oo(){Ve=(Wt=pt.now())+cn,Qe=dt=0;try{Wu()}finally{Qe=0,Ku(),Ve=0}}function Zu(){var e=pt.now(),t=e-Wt;t>ks&&(cn-=t,Wt=e)}function Ku(){for(var e,t=qt,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:qt=n);ft=e,On(o)}function On(e){if(!Qe){dt&&(dt=clearTimeout(dt));var t=e-Ve;t>24?(e<1/0&&(dt=setTimeout(Oo,e-pt.now()-cn)),lt&&(lt=clearInterval(lt))):(lt||(Wt=pt.now(),lt=setInterval(Zu,ks)),Qe=1,Ps(Oo))}}function Ro(e,t,n){var o=new Zt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Uu=sn("start","end","cancel","interrupt"),Qu=[],Ts=0,Ho=1,Rn=2,Rt=3,Vo=4,Hn=5,Ht=6;function ln(e,t,n,o,r,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;Ju(e,n,{name:t,index:o,group:r,on:Uu,tween:Qu,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Ts})}function ro(e,t){var n=me(e,t);if(n.state>Ts)throw new Error("too late; already scheduled");return n}function xe(e,t){var n=me(e,t);if(n.state>Rt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ju(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=js(s,0,n.time);function s(c){n.state=Ho,n.timer.restart(i,n.delay,n.time),n.delay<=c&&i(c-n.delay)}function i(c){var u,d,f,g;if(n.state!==Ho)return l();for(u in o)if(g=o[u],g.name===n.name){if(g.state===Rt)return Ro(i);g.state===Vo?(g.state=Ht,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[u]):+u<t&&(g.state=Ht,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[u])}if(Ro(function(){n.state===Rt&&(n.state=Vo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Rn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Rn){for(n.state=Rt,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(g=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=g);r.length=d+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Hn,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Hn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Ht,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Vt(e,t){var n=e.__transition,o,r,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((o=n[i]).name!==t){s=!1;continue}r=o.state>Rn&&o.state<Hn,o.state=Ht,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}s&&delete e.__transition}}function ed(e){return this.each(function(){Vt(this,e)})}function td(e,t){var n,o;return function(){var r=xe(this,e),s=r.tween;if(s!==n){o=n=s;for(var i=0,a=o.length;i<a;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}r.tween=o}}function nd(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var s=xe(this,e),i=s.tween;if(i!==o){r=(o=i).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}s.tween=r}}function od(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=me(this.node(),n).tween,r=0,s=o.length,i;r<s;++r)if((i=o[r]).name===e)return i.value;return null}return this.each((t==null?td:nd)(n,e,t))}function so(e,t,n){var o=e._id;return e.each(function(){var r=xe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return me(r,o).value[t]}}function As(e,t){var n;return(typeof t=="number"?ze:t instanceof Po?ko:(n=Po(t))?(t=n,ko):gc)(e,t)}function rd(e){return function(){this.removeAttribute(e)}}function sd(e){return function(){this.removeAttributeNS(e.space,e.local)}}function id(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttribute(e);return i===r?null:i===o?s:s=t(o=i,n)}}function ad(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===r?null:i===o?s:s=t(o=i,n)}}function cd(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function ld(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function ud(e,t){var n=an(e),o=n==="transform"?Fu:As;return this.attrTween(e,typeof t=="function"?(n.local?ld:cd)(n,o,so(this,"attr."+e,t)):t==null?(n.local?sd:rd)(n):(n.local?ad:id)(n,o,t))}function dd(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function fd(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function hd(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&fd(e,s)),n}return r._value=t,r}function md(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&dd(e,s)),n}return r._value=t,r}function gd(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=an(e);return this.tween(n,(o.local?hd:md)(o,t))}function pd(e,t){return function(){ro(this,e).delay=+t.apply(this,arguments)}}function yd(e,t){return t=+t,function(){ro(this,e).delay=t}}function xd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?pd:yd)(t,e)):me(this.node(),t).delay}function vd(e,t){return function(){xe(this,e).duration=+t.apply(this,arguments)}}function wd(e,t){return t=+t,function(){xe(this,e).duration=t}}function bd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vd:wd)(t,e)):me(this.node(),t).duration}function _d(e,t){if(typeof t!="function")throw new Error;return function(){xe(this,e).ease=t}}function Sd(e){var t=this._id;return arguments.length?this.each(_d(t,e)):me(this.node(),t).ease}function Nd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;xe(this,e).ease=n}}function Ed(e){if(typeof e!="function")throw new Error;return this.each(Nd(this._id,e))}function Cd(e){typeof e!="function"&&(e=ms(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new _e(o,this._parents,this._name,this._id)}function Md(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,s=Math.min(o,r),i=new Array(o),a=0;a<s;++a)for(var l=t[a],c=n[a],u=l.length,d=i[a]=new Array(u),f,g=0;g<u;++g)(f=l[g]||c[g])&&(d[g]=f);for(;a<o;++a)i[a]=t[a];return new _e(i,this._parents,this._name,this._id)}function Id(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function kd(e,t,n){var o,r,s=Id(t)?ro:xe;return function(){var i=s(this,e),a=i.on;a!==o&&(r=(o=a).copy()).on(t,n),i.on=r}}function Pd(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(kd(n,e,t))}function jd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Td(){return this.on("end.remove",jd(this._id))}function Ad(e){var t=this._name,n=this._id;typeof e!="function"&&(e=to(e));for(var o=this._groups,r=o.length,s=new Array(r),i=0;i<r;++i)for(var a=o[i],l=a.length,c=s[i]=new Array(l),u,d,f=0;f<l;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),c[f]=d,ln(c[f],t,n,f,c,me(u,n)));return new _e(s,this._parents,t,n)}function Dd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=hs(e));for(var o=this._groups,r=o.length,s=[],i=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),g,m=me(u,n),y=0,v=f.length;y<v;++y)(g=f[y])&&ln(g,t,n,y,f,m);s.push(f),i.push(u)}return new _e(s,i,t,n)}var Ld=St.prototype.constructor;function $d(){return new Ld(this._groups,this._parents)}function zd(e,t){var n,o,r;return function(){var s=Ue(this,e),i=(this.style.removeProperty(e),Ue(this,e));return s===i?null:s===n&&i===o?r:r=t(n=s,o=i)}}function Ds(e){return function(){this.style.removeProperty(e)}}function Od(e,t,n){var o,r=n+"",s;return function(){var i=Ue(this,e);return i===r?null:i===o?s:s=t(o=i,n)}}function Rd(e,t,n){var o,r,s;return function(){var i=Ue(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Ue(this,e))),i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a))}}function Hd(e,t){var n,o,r,s="style."+t,i="end."+s,a;return function(){var l=xe(this,e),c=l.on,u=l.value[s]==null?a||(a=Ds(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(i,r=u),l.on=o}}function Vd(e,t,n){var o=(e+="")=="transform"?Bu:As;return t==null?this.styleTween(e,zd(e,o)).on("end.style."+e,Ds(e)):typeof t=="function"?this.styleTween(e,Rd(e,o,so(this,"style."+e,t))).each(Hd(this._id,e)):this.styleTween(e,Od(e,o,t),n).on("end.style."+e,null)}function Bd(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Fd(e,t,n){var o,r;function s(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&Bd(e,i,n)),o}return s._value=t,s}function Gd(e,t,n){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,Fd(e,t,n??""))}function Xd(e){return function(){this.textContent=e}}function Yd(e){return function(){var t=e(this);this.textContent=t??""}}function qd(e){return this.tween("text",typeof e=="function"?Yd(so(this,"text",e)):Xd(e==null?"":e+""))}function Wd(e){return function(t){this.textContent=e.call(this,t)}}function Zd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Wd(r)),t}return o._value=e,o}function Kd(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,Zd(e))}function Ud(){for(var e=this._name,t=this._id,n=Ls(),o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)if(l=i[c]){var u=me(l,t);ln(l,e,n,c,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new _e(o,this._parents,e,n)}function Qd(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(s,i){var a={value:i},l={value:function(){--r===0&&s()}};n.each(function(){var c=xe(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&s()})}var Jd=0;function _e(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ls(){return++Jd}var we=St.prototype;_e.prototype={constructor:_e,select:Ad,selectAll:Dd,selectChild:we.selectChild,selectChildren:we.selectChildren,filter:Cd,merge:Md,selection:$d,transition:Ud,call:we.call,nodes:we.nodes,node:we.node,size:we.size,empty:we.empty,each:we.each,on:Pd,attr:ud,attrTween:gd,style:Vd,styleTween:Gd,text:qd,textTween:Kd,remove:Td,tween:od,delay:xd,duration:bd,ease:Sd,easeVarying:Ed,end:Qd,[Symbol.iterator]:we[Symbol.iterator]};function ef(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var tf={time:null,delay:0,duration:250,ease:ef};function nf(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function of(e){var t,n;e instanceof _e?(t=e._id,e=e._name):(t=Ls(),(n=tf).time=oo(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&ln(l,e,t,c,i,n||nf(l,t));return new _e(o,this._parents,e,t)}St.prototype.interrupt=ed;St.prototype.transition=of;const jt=e=>()=>e;function rf(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function be(e,t,n){this.k=e,this.x=t,this.y=n}be.prototype={constructor:be,scale:function(e){return e===1?this:new be(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new be(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 un=new be(1,0,0);$s.prototype=be.prototype;function $s(e){for(;!e.__zoom;)if(!(e=e.parentNode))return un;return e.__zoom}function Nn(e){e.stopImmediatePropagation()}function ut(e){e.preventDefault(),e.stopImmediatePropagation()}function sf(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function af(){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 Bo(){return this.__zoom||un}function cf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function lf(){return navigator.maxTouchPoints||"ontouchstart"in this}function uf(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function zs(){var e=sf,t=af,n=uf,o=cf,r=lf,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ot,c=sn("start","zoom","end"),u,d,f,g=500,m=150,y=0,v=10;function x(b){b.property("__zoom",Bo).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",z).filter(r).on("touchstart.zoom",E).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(b,k,I,A){var P=b.selection?b.selection():b;P.property("__zoom",Bo),b!==P?M(b,k,I,A):P.interrupt().each(function(){S(this,arguments).event(A).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},x.scaleBy=function(b,k,I,A){x.scaleTo(b,function(){var P=this.__zoom.k,j=typeof k=="function"?k.apply(this,arguments):k;return P*j},I,A)},x.scaleTo=function(b,k,I,A){x.transform(b,function(){var P=t.apply(this,arguments),j=this.__zoom,O=I==null?w(P):typeof I=="function"?I.apply(this,arguments):I,H=j.invert(O),R=typeof k=="function"?k.apply(this,arguments):k;return n(p(_(j,R),O,H),P,i)},I,A)},x.translateBy=function(b,k,I,A){x.transform(b,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),i)},null,A)},x.translateTo=function(b,k,I,A,P){x.transform(b,function(){var j=t.apply(this,arguments),O=this.__zoom,H=A==null?w(j):typeof A=="function"?A.apply(this,arguments):A;return n(un.translate(H[0],H[1]).scale(O.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof I=="function"?-I.apply(this,arguments):-I),j,i)},A,P)};function _(b,k){return k=Math.max(s[0],Math.min(s[1],k)),k===b.k?b:new be(k,b.x,b.y)}function p(b,k,I){var A=k[0]-I[0]*b.k,P=k[1]-I[1]*b.k;return A===b.x&&P===b.y?b:new be(b.k,A,P)}function w(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function M(b,k,I,A){b.on("start.zoom",function(){S(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(A).end()}).tween("zoom",function(){var P=this,j=arguments,O=S(P,j).event(A),H=t.apply(P,j),R=I==null?w(H):typeof I=="function"?I.apply(P,j):I,F=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),B=P.__zoom,q=typeof k=="function"?k.apply(P,j):k,K=l(B.invert(R).concat(F/B.k),q.invert(R).concat(F/q.k));return function(Y){if(Y===1)Y=q;else{var V=K(Y),X=F/V[2];Y=new be(X,R[0]-V[0]*X,R[1]-V[1]*X)}O.zoom(null,Y)}})}function S(b,k,I){return!I&&b.__zooming||new N(b,k)}function N(b,k){this.that=b,this.args=k,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,k),this.taps=0}N.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,k){return this.mouse&&b!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var k=ce(this.that).datum();c.call(b,this.that,new rf(b,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:c}),k)}};function D(b,...k){if(!e.apply(this,arguments))return;var I=S(this,k).event(b),A=this.__zoom,P=Math.max(s[0],Math.min(s[1],A.k*Math.pow(2,o.apply(this,arguments)))),j=de(b);if(I.wheel)(I.mouse[0][0]!==j[0]||I.mouse[0][1]!==j[1])&&(I.mouse[1]=A.invert(I.mouse[0]=j)),clearTimeout(I.wheel);else{if(A.k===P)return;I.mouse=[j,A.invert(j)],Vt(this),I.start()}ut(b),I.wheel=setTimeout(O,m),I.zoom("mouse",n(p(_(A,P),I.mouse[0],I.mouse[1]),I.extent,i));function O(){I.wheel=null,I.end()}}function T(b,...k){if(f||!e.apply(this,arguments))return;var I=b.currentTarget,A=S(this,k,!0).event(b),P=ce(b.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),j=de(b,I),O=b.clientX,H=b.clientY;Ns(b.view),Nn(b),A.mouse=[j,this.__zoom.invert(j)],Vt(this),A.start();function R(B){if(ut(B),!A.moved){var q=B.clientX-O,K=B.clientY-H;A.moved=q*q+K*K>y}A.event(B).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=de(B,I),A.mouse[1]),A.extent,i))}function F(B){P.on("mousemove.zoom mouseup.zoom",null),Es(B.view,A.moved),ut(B),A.event(B).end()}}function z(b,...k){if(e.apply(this,arguments)){var I=this.__zoom,A=de(b.changedTouches?b.changedTouches[0]:b,this),P=I.invert(A),j=I.k*(b.shiftKey?.5:2),O=n(p(_(I,j),A,P),t.apply(this,k),i);ut(b),a>0?ce(this).transition().duration(a).call(M,O,A,b):ce(this).call(x.transform,O,A,b)}}function E(b,...k){if(e.apply(this,arguments)){var I=b.touches,A=I.length,P=S(this,k,b.changedTouches.length===A).event(b),j,O,H,R;for(Nn(b),O=0;O<A;++O)H=I[O],R=de(H,this),R=[R,this.__zoom.invert(R),H.identifier],P.touch0?!P.touch1&&P.touch0[2]!==R[2]&&(P.touch1=R,P.taps=0):(P.touch0=R,j=!0,P.taps=1+!!u);u&&(u=clearTimeout(u)),j&&(P.taps<2&&(d=R[0],u=setTimeout(function(){u=null},g)),Vt(this),P.start())}}function L(b,...k){if(this.__zooming){var I=S(this,k).event(b),A=b.changedTouches,P=A.length,j,O,H,R;for(ut(b),j=0;j<P;++j)O=A[j],H=de(O,this),I.touch0&&I.touch0[2]===O.identifier?I.touch0[0]=H:I.touch1&&I.touch1[2]===O.identifier&&(I.touch1[0]=H);if(O=I.that.__zoom,I.touch1){var F=I.touch0[0],B=I.touch0[1],q=I.touch1[0],K=I.touch1[1],Y=(Y=q[0]-F[0])*Y+(Y=q[1]-F[1])*Y,V=(V=K[0]-B[0])*V+(V=K[1]-B[1])*V;O=_(O,Math.sqrt(Y/V)),H=[(F[0]+q[0])/2,(F[1]+q[1])/2],R=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(I.touch0)H=I.touch0[0],R=I.touch0[1];else return;I.zoom("touch",n(p(O,H,R),I.extent,i))}}function $(b,...k){if(this.__zooming){var I=S(this,k).event(b),A=b.changedTouches,P=A.length,j,O;for(Nn(b),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),j=0;j<P;++j)O=A[j],I.touch0&&I.touch0[2]===O.identifier?delete I.touch0:I.touch1&&I.touch1[2]===O.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(O=de(O,this),Math.hypot(d[0]-O[0],d[1]-O[1])<v)){var H=ce(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return x.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:jt(+b),x):o},x.filter=function(b){return arguments.length?(e=typeof b=="function"?b:jt(!!b),x):e},x.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:jt(!!b),x):r},x.extent=function(b){return arguments.length?(t=typeof b=="function"?b:jt([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),x):t},x.scaleExtent=function(b){return arguments.length?(s[0]=+b[0],s[1]=+b[1],x):[s[0],s[1]]},x.translateExtent=function(b){return arguments.length?(i[0][0]=+b[0][0],i[1][0]=+b[1][0],i[0][1]=+b[0][1],i[1][1]=+b[1][1],x):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},x.constrain=function(b){return arguments.length?(n=b,x):n},x.duration=function(b){return arguments.length?(a=+b,x):a},x.interpolate=function(b){return arguments.length?(l=b,x):l},x.on=function(){var b=c.on.apply(c,arguments);return b===c?x:b},x.clickDistance=function(b){return arguments.length?(y=(b=+b)*b,x):Math.sqrt(y)},x.tapDistance=function(b){return arguments.length?(v=+b,x):v},x}const pe={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n: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."},yt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Os=["Enter"," ","Escape"],Rs={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var Re;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Re||(Re={}));var xt;(function(e){e.Partial="partial",e.Full="full"})(xt||(xt={}));const Hs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ie;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ie||(Ie={}));var Kt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Kt||(Kt={}));var G;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(G||(G={}));const Fo={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top};function Vs(e){return e===null?null:e?"valid":"invalid"}const Bs=e=>"id"in e&&"source"in e&&"target"in e,df=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),io=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Nt=(e,t=[0,0])=>{const{width:n,height:o}=Ne(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},ff=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const s=typeof r=="string";let i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):io(r)?r:t.nodeLookup.get(r.id));const a=i?Ut(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return dn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fn(n)},Et=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=dn(n,Ut(r)),o=!0)}),o?fn(n):{x:0,y:0,width:0,height:0}},ao=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{const a={...Mt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=c;if(i&&!d||f)continue;const g=u.width??c.width??c.initialWidth??null,m=u.height??c.height??c.initialHeight??null,y=vt(a,tt(c)),v=(g??0)*(m??0),x=s&&y>0;(!c.internals.handleBounds||x||y>=v||c.dragging)&&l.push(c)}return l},hf=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function mf(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function gf({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=mf(e,i),l=Et(a),c=co(l,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(c,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Fs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??o;let d=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",pe.error005());else{const g=a.measured.width,m=a.measured.height;g&&m&&(d=[[l,c],[l+g,c+m]])}else a&&nt(i.extent)&&(d=[[i.extent[0][0]+l,i.extent[0][1]+c],[i.extent[1][0]+l,i.extent[1][1]+c]]);const f=nt(d)?Be(t,d,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",pe.error015()),{position:{x:f.x-l+(i.measured.width??0)*u[0],y:f.y-c+(i.measured.height??0)*u[1]},positionAbsolute:f}}async function pf({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const s=new Set(e.map(f=>f.id)),i=[];for(const f of n){if(f.deletable===!1)continue;const g=s.has(f.id),m=!g&&f.parentId&&i.find(y=>y.id===f.parentId);(g||m)&&i.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),u=hf(i,l);for(const f of l)a.has(f.id)&&!u.find(m=>m.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:i};const d=await r({nodes:i,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:i}:{edges:[],nodes:[]}:d}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Be=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-(n?.width??0)),y:et(e.y,t[0][1],t[1][1]-(n?.height??0))});function Gs(e,t,n){const{width:o,height:r}=Ne(n),{x:s,y:i}=n.internals.positionAbsolute;return Be(e,[[s,i],[s+o,i+r]],t)}const Go=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,Xs=(e,t,n=15,o=40)=>{const r=Go(e.x,o,t.width-o)*n,s=Go(e.y,o,t.height-o)*n;return[r,s]},dn=(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)}),Vn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),fn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),tt=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Ut=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Ys=(e,t)=>fn(dn(Vn(e),Vn(t))),vt=(e,t)=>{const n=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(n*o)},Xo=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),yf=(e,t)=>{},Ct=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Mt=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return s?Ct(a,i):a},Qt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Xe(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function xf(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Xe(e,n),r=Xe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Xe(e.top??e.y??0,n),r=Xe(e.bottom??e.y??0,n),s=Xe(e.left??e.x??0,t),i=Xe(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vf(e,t,n,o,r,s){const{x:i,y:a}=Qt(e,[t,n,o]),{x:l,y:c}=Qt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=s-c;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const co=(e,t,n,o,r,s)=>{const i=xf(s,t,n),a=(t-i.x)/e.width,l=(n-i.y)/e.height,c=Math.min(a,l),u=et(c,o,r),d=e.x+e.width/2,f=e.y+e.height/2,g=t/2-d*u,m=n/2-f*u,y=vf(e,g,m,u,t,n),v={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:g-v.left+v.right,y:m-v.top+v.bottom,zoom:u}},wt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function nt(e){return e!=null&&e!=="parent"}function Ne(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function qs(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Ws(e,t={width:0,height:0},n,o,r){const s={...e},i=o.get(n);if(i){const a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function Yo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function wf(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function bf(e){return{...Rs,...e||{}}}function ht(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:s,y:i}=he(e),a=Mt({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:l,y:c}=n?Ct(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const lo=e=>({width:e.offsetWidth,height:e.offsetHeight}),Zs=e=>e?.getRootNode?.()||window?.document,_f=["INPUT","SELECT","TEXTAREA"];function Ks(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:_f.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Us=e=>"clientX"in e,he=(e,t)=>{const n=Us(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},qo=(e,t,n,o,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...lo(i)}})};function Qs({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=e*.125+r*.375+i*.375+n*.125,c=t*.125+s*.375+a*.375+o*.125,u=Math.abs(l-e),d=Math.abs(c-t);return[l,c,u,d]}function Tt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wo({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case G.Left:return[t-Tt(t-o,s),n];case G.Right:return[t+Tt(o-t,s),n];case G.Top:return[t,n-Tt(n-r,s)];case G.Bottom:return[t,n+Tt(r-n,s)]}}function Js({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:s=G.Top,curvature:i=.25}){const[a,l]=Wo({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[c,u]=Wo({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[d,f,g,m]=Qs({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,d,f,g,m]}function ei({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Sf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const i=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+a}function Nf({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const s=dn(Ut(e),Ut(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return vt(i,fn(s))>0}const Ef=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Cf=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Mf=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Ef;let r;return Bs(e)?r={...e}:r={...e,id:o(e)},Cf(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function ti({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,s,i,a]=ei({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}const Zo={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},If=({source:e,sourcePosition:t=G.Bottom,target:n})=>t===G.Left||t===G.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Ko=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function kf({source:e,sourcePosition:t=G.Bottom,target:n,targetPosition:o=G.Top,center:r,offset:s,stepPosition:i}){const a=Zo[t],l=Zo[o],c={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+l.x*s,y:n.y+l.y*s},d=If({source:c,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",g=d[f];let m=[],y,v;const x={x:0,y:0},_={x:0,y:0},[,,p,w]=ei({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(y=r.x??c.x+(u.x-c.x)*i,v=r.y??(c.y+u.y)/2):(y=r.x??(c.x+u.x)/2,v=r.y??c.y+(u.y-c.y)*i);const S=[{x:y,y:c.y},{x:y,y:u.y}],N=[{x:c.x,y:v},{x:u.x,y:v}];a[f]===g?m=f==="x"?S:N:m=f==="x"?N:S}else{const S=[{x:c.x,y:u.y}],N=[{x:u.x,y:c.y}];if(f==="x"?m=a.x===g?N:S:m=a.y===g?S:N,t===o){const L=Math.abs(e[f]-n[f]);if(L<=s){const $=Math.min(s-1,s-L);a[f]===g?x[f]=(c[f]>e[f]?-1:1)*$:_[f]=(u[f]>n[f]?-1:1)*$}}if(t!==o){const L=f==="x"?"y":"x",$=a[f]===l[L],b=c[L]>u[L],k=c[L]<u[L];(a[f]===1&&(!$&&b||$&&k)||a[f]!==1&&(!$&&k||$&&b))&&(m=f==="x"?S:N)}const D={x:c.x+x.x,y:c.y+x.y},T={x:u.x+_.x,y:u.y+_.y},z=Math.max(Math.abs(D.x-m[0].x),Math.abs(T.x-m[0].x)),E=Math.max(Math.abs(D.y-m[0].y),Math.abs(T.y-m[0].y));z>=E?(y=(D.x+T.x)/2,v=m[0].y):(y=m[0].x,v=(D.y+T.y)/2)}return[[e,{x:c.x+x.x,y:c.y+x.y},...m,{x:u.x+_.x,y:u.y+_.y},n],y,v,p,w]}function Pf(e,t,n,o){const r=Math.min(Ko(e,t)/2,Ko(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+r*c},${i}Q ${s},${i} ${s},${i+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${s},${i+r*l}Q ${s},${i} ${s+r*a},${i}`}function Bn({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:s=G.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,g,m,y]=kf({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c,stepPosition:u});return[d.reduce((x,_,p)=>{let w="";return p>0&&p<d.length-1?w=Pf(d[p-1],_,d[p+1],i):w=`${p===0?"M":"L"}${_.x} ${_.y}`,x+=w,x},""),f,g,m,y]}function Uo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function jf(e){const{sourceNode:t,targetNode:n}=e;if(!Uo(t)||!Uo(n))return null;const o=t.internals.handleBounds||Qo(t.handles),r=n.internals.handleBounds||Qo(n.handles),s=Jo(o?.source??[],e.sourceHandle),i=Jo(e.connectionMode===Je.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",pe.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=s?.position||G.Bottom,l=i?.position||G.Top,c=Fe(t,s,a),u=Fe(n,i,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function Qo(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Fe(e,t,n=G.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??Ne(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case G.Top:return{x:r+i/2,y:s};case G.Right:return{x:r+i,y:s+a/2};case G.Bottom:return{x:r+i/2,y:s+a};case G.Left:return{x:r,y:s+a/2}}}function Jo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Fn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Tf(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=Fn(l,t);s.has(c)||(i.push({id:c,color:l.color||n,...l}),s.add(c))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const ni=1e3,Af=10,uo={nodeOrigin:[0,0],nodeExtent:yt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Df={...uo,checkEquality:!0};function fo(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Lf(e,t,n){const o=fo(uo,n);for(const r of e.values())if(r.parentId)mo(r,e,t,o);else{const s=Nt(r,o.nodeOrigin),i=nt(r.extent)?r.extent:o.nodeExtent,a=Be(s,i,Ne(r));r.internals.positionAbsolute=a}}function $f(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function ho(e){return e==="manual"}function Gn(e,t,n,o={}){const r=fo(Df,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!ho(r.zIndexMode)?ni:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=i.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const d=Nt(c,r.nodeOrigin),f=nt(c.extent)?c.extent:r.nodeExtent,g=Be(d,f,Ne(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:g,handleBounds:$f(c,u),z:oi(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&mo(u,t,n,o,s)}return l}function zf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function mo(e,t,n,o,r){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:l}=fo(uo,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}zf(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Af),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=s&&!ho(l)?ni:0,{x:f,y:g,z:m}=Of(e,u,i,a,d,l),{positionAbsolute:y}=e.internals,v=f!==y.x||g!==y.y;(v||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:f,y:g}:y,z:m}})}function oi(e,t,n){const o=fe(e.zIndex)?e.zIndex:0;return ho(n)?o:o+(e.selected?t:0)}function Of(e,t,n,o,r,s){const{x:i,y:a}=t.internals.positionAbsolute,l=Ne(e),c=Nt(e,n),u=nt(e.extent)?Be(c,e.extent,l):c;let d=Be({x:i+u.x,y:a+u.y},o,l);e.extent==="parent"&&(d=Gs(d,l,t));const f=oi(e,r,s),g=t.internals.z??0;return{x:d.x,y:d.y,z:g>=f?g+1:f}}function go(e,t,n,o=[0,0]){const r=[],s=new Map;for(const i of e){const a=t.get(i.parentId);if(!a)continue;const l=s.get(i.parentId)?.expandedRect??tt(a),c=Ys(l,i.rect);s.set(i.parentId,{expandedRect:c,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ne(a),d=a.origin??o,f=i.x<c.x?Math.round(Math.abs(c.x-i.x)):0,g=i.y<c.y?Math.round(Math.abs(c.y-i.y)):0,m=Math.max(u.width,Math.round(i.width)),y=Math.max(u.height,Math.round(i.height)),v=(m-u.width)*d[0],x=(y-u.height)*d[1];(f>0||g>0||v||x)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+v,y:a.position.y-g+x}}),n.get(l)?.forEach(_=>{e.some(p=>p.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+f,y:_.position.y+g}})})),(u.width<i.width||u.height<i.height||f||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:m+(f?d[0]*f-v:0),height:y+(g?d[1]*g-x:0)}})}),r}function Rf(e,t,n,o,r,s,i){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const g of e.values()){const m=t.get(g.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),l=!0;continue}const y=lo(g.nodeElement),v=m.measured.width!==y.width||m.measured.height!==y.height;if(!!(y.width&&y.height&&(v||!m.internals.handleBounds||g.force))){const _=g.nodeElement.getBoundingClientRect(),p=nt(m.extent)?m.extent:s;let{positionAbsolute:w}=m.internals;m.parentId&&m.extent==="parent"?w=Gs(w,y,t.get(m.parentId)):p&&(w=Be(w,p,y));const M={...m,measured:y,internals:{...m.internals,positionAbsolute:w,handleBounds:{source:qo("source",g.nodeElement,_,d,m.id),target:qo("target",g.nodeElement,_,d,m.id)}}};t.set(m.id,M),m.parentId&&mo(M,t,n,{nodeOrigin:r,zIndexMode:i}),l=!0,v&&(c.push({id:m.id,type:"dimensions",dimensions:y}),m.expandParent&&m.parentId&&f.push({id:m.id,parentId:m.parentId,rect:tt(M,r)}))}}if(f.length>0){const g=go(f,t,n,r);c.push(...g)}return{changes:c,updatedInternals:l}}async function Hf({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function er(e,t,n,o,r,s){let i=r;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;const l=o.get(i)||new Map;if(o.set(i,l.set(n,t)),s){i=`${r}-${e}-${s}`;const c=o.get(i)||new Map;o.set(i,c.set(n,t))}}function ri(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},c=`${r}-${i}--${s}-${a}`,u=`${s}-${a}--${r}-${i}`;er("source",l,u,e,r,i),er("target",l,c,e,s,a),t.set(o.id,o)}}function si(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:si(n,t):!1}function tr(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Vf(e,t,n,o){const r=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!si(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&r.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function En({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[i,a]of t){const l=n.get(i)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function Bf({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:o-r.distance.y},i=Ct(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Ff({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,g=!1,m=!1,y=null;function v({noDragClassName:_,handleSelector:p,domNode:w,isSelectable:M,nodeId:S,nodeClickDistance:N=0}){f=ce(w);function D({x:L,y:$}){const{nodeLookup:b,nodeExtent:k,snapGrid:I,snapToGrid:A,nodeOrigin:P,onNodeDrag:j,onSelectionDrag:O,onError:H,updateNodePositions:R}=t();s={x:L,y:$};let F=!1;const B=a.size>1,q=B&&k?Vn(Et(a)):null,K=B&&A?Bf({dragItems:a,snapGrid:I,x:L,y:$}):null;for(const[Y,V]of a){if(!b.has(Y))continue;let X={x:L-V.distance.x,y:$-V.distance.y};A&&(X=K?{x:Math.round(X.x+K.x),y:Math.round(X.y+K.y)}:Ct(X,I));let Q=null;if(B&&k&&!V.extent&&q){const{positionAbsolute:Z}=V.internals,ee=Z.x-q.x+k[0][0],ne=Z.x+V.measured.width-q.x2+k[1][0],te=Z.y-q.y+k[0][1],ae=Z.y+V.measured.height-q.y2+k[1][1];Q=[[ee,te],[ne,ae]]}const{position:U,positionAbsolute:W}=Fs({nodeId:Y,nextPosition:X,nodeLookup:b,nodeExtent:Q||k,nodeOrigin:P,onError:H});F=F||V.position.x!==U.x||V.position.y!==U.y,V.position=U,V.internals.positionAbsolute=W}if(m=m||F,!!F&&(R(a,!0),y&&(o||j||!S&&O))){const[Y,V]=En({nodeId:S,dragItems:a,nodeLookup:b});o?.(y,a,Y,V),j?.(y,Y,V),S||O?.(y,V)}}async function T(){if(!u)return;const{transform:L,panBy:$,autoPanSpeed:b,autoPanOnNodeDrag:k}=t();if(!k){l=!1,cancelAnimationFrame(i);return}const[I,A]=Xs(c,u,b);(I!==0||A!==0)&&(s.x=(s.x??0)-I/L[2],s.y=(s.y??0)-A/L[2],await $({x:I,y:A})&&D(s)),i=requestAnimationFrame(T)}function z(L){const{nodeLookup:$,multiSelectionActive:b,nodesDraggable:k,transform:I,snapGrid:A,snapToGrid:P,selectNodesOnDrag:j,onNodeDragStart:O,onSelectionDragStart:H,unselectNodesAndEdges:R}=t();d=!0,(!j||!M)&&!b&&S&&($.get(S)?.selected||R()),M&&j&&S&&e?.(S);const F=ht(L.sourceEvent,{transform:I,snapGrid:A,snapToGrid:P,containerBounds:u});if(s=F,a=Vf($,k,F,S),a.size>0&&(n||O||!S&&H)){const[B,q]=En({nodeId:S,dragItems:a,nodeLookup:$});n?.(L.sourceEvent,a,B,q),O?.(L.sourceEvent,B,q),S||H?.(L.sourceEvent,q)}}const E=Cs().clickDistance(N).on("start",L=>{const{domNode:$,nodeDragThreshold:b,transform:k,snapGrid:I,snapToGrid:A}=t();u=$?.getBoundingClientRect()||null,g=!1,m=!1,y=L.sourceEvent,b===0&&z(L),s=ht(L.sourceEvent,{transform:k,snapGrid:I,snapToGrid:A,containerBounds:u}),c=he(L.sourceEvent,u)}).on("drag",L=>{const{autoPanOnNodeDrag:$,transform:b,snapGrid:k,snapToGrid:I,nodeDragThreshold:A,nodeLookup:P}=t(),j=ht(L.sourceEvent,{transform:b,snapGrid:k,snapToGrid:I,containerBounds:u});if(y=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||S&&!P.has(S))&&(g=!0),!g){if(!l&&$&&d&&(l=!0,T()),!d){const O=he(L.sourceEvent,u),H=O.x-c.x,R=O.y-c.y;Math.sqrt(H*H+R*R)>A&&z(L)}(s.x!==j.xSnapped||s.y!==j.ySnapped)&&a&&d&&(c=he(L.sourceEvent,u),D(j))}}).on("end",L=>{if(!(!d||g)&&(l=!1,d=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:$,updateNodePositions:b,onNodeDragStop:k,onSelectionDragStop:I}=t();if(m&&(b(a,!1),m=!1),r||k||!S&&I){const[A,P]=En({nodeId:S,dragItems:a,nodeLookup:$,dragging:!1});r?.(L.sourceEvent,a,A,P),k?.(L.sourceEvent,A,P),S||I?.(L.sourceEvent,P)}}}).filter(L=>{const $=L.target;return!L.button&&(!_||!tr($,`.${_}`,w))&&(!p||tr($,p,w))});f.call(E)}function x(){f?.on(".drag",null)}return{update:v,destroy:x}}function Gf(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())vt(r,tt(s))>0&&o.push(s);return o}const Xf=250;function Yf(e,t,n,o){let r=[],s=1/0;const i=Gf(e,n,t+Xf);for(const a of i){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:d}=Fe(a,c,c.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<s?(r=[{...c,x:u,y:d}],s=f):f===s&&r.push({...c,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function ii(e,t,n,o,r,s=!1){const i=o.get(e);if(!i)return null;const a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&s?{...l,...Fe(i,l,l.position,!0)}:l}function ai(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function qf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const ci=()=>!0;function Wf(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:g,onConnectStart:m,onConnect:y,onConnectEnd:v,isValidConnection:x=ci,onReconnectEnd:_,updateConnection:p,getTransform:w,getFromHandle:M,autoPanSpeed:S,dragThreshold:N=1,handleDomNode:D}){const T=Zs(e.target);let z=0,E;const{x:L,y:$}=he(e),b=ai(s,D),k=a?.getBoundingClientRect();let I=!1;if(!k||!b)return;const A=ii(r,b,o,l,t);if(!A)return;let P=he(e,k),j=!1,O=null,H=!1,R=null;function F(){if(!u||!k)return;const[U,W]=Xs(P,k,S);f({x:U,y:W}),z=requestAnimationFrame(F)}const B={...A,nodeId:r,type:b,position:A.position},q=l.get(r);let Y={inProgress:!0,isValid:null,from:Fe(q,B,G.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:q,to:P,toHandle:null,toPosition:Fo[B.position],toNode:null,pointer:P};function V(){I=!0,p(Y),m?.(e,{nodeId:r,handleId:o,handleType:b})}N===0&&V();function X(U){if(!I){const{x:ae,y:Ee}=he(U),ve=ae-L,$e=Ee-$;if(!(ve*ve+$e*$e>N*N))return;V()}if(!M()||!B){Q(U);return}const W=w();P=he(U,k),E=Yf(Mt(P,W,!1,[1,1]),n,l,B),j||(F(),j=!0);const Z=li(U,{handle:E,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:x,doc:T,lib:c,flowId:d,nodeLookup:l});R=Z.handleDomNode,O=Z.connection,H=qf(!!E,Z.isValid);const ee=l.get(r),ne=ee?Fe(ee,B,G.Left,!0):Y.from,te={...Y,from:ne,isValid:H,to:Z.toHandle&&H?Qt({x:Z.toHandle.x,y:Z.toHandle.y},W):P,toHandle:Z.toHandle,toPosition:H&&Z.toHandle?Z.toHandle.position:Fo[B.position],toNode:Z.toHandle?l.get(Z.toHandle.nodeId):null,pointer:P};p(te),Y=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(I){(E||R)&&O&&H&&y?.(O);const{inProgress:W,...Z}=Y,ee={...Z,toPosition:Y.toHandle?Y.toPosition:null};v?.(U,ee),s&&_?.(U,ee)}g(),cancelAnimationFrame(z),j=!1,H=!1,O=null,R=null,T.removeEventListener("mousemove",X),T.removeEventListener("mouseup",Q),T.removeEventListener("touchmove",X),T.removeEventListener("touchend",Q)}}T.addEventListener("mousemove",X),T.addEventListener("mouseup",Q),T.addEventListener("touchmove",X),T.addEventListener("touchend",Q)}function li(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:l,isValidConnection:c=ci,nodeLookup:u}){const d=s==="target",f=t?i.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:m}=he(e),y=i.elementFromPoint(g,m),v=y?.classList.contains(`${a}-flow__handle`)?y:f,x={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const _=ai(void 0,v),p=v.getAttribute("data-nodeid"),w=v.getAttribute("data-handleid"),M=v.classList.contains("connectable"),S=v.classList.contains("connectableend");if(!p||!_)return x;const N={source:d?p:o,sourceHandle:d?w:r,target:d?o:p,targetHandle:d?r:w};x.connection=N;const T=M&&S&&(n===Je.Strict?d&&_==="source"||!d&&_==="target":p!==o||w!==r);x.isValid=T&&c(N),x.toHandle=ii(p,_,w,u,n,!0)}return x}const Xn={onPointerDown:Wf,isValid:li};function Zf({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function s({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:g=!1}){const m=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),M=p.sourceEvent.ctrlKey&&wt()?10:1,S=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*u,N=w[2]*Math.pow(2,S*M);t.scaleTo(N)};let y=[0,0];const v=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(y=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},x=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const M=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],S=[M[0]-y[0],M[1]-y[1]];y=M;const N=o()*Math.max(w[2],Math.log(w[2]))*(g?-1:1),D={x:w[0]-S[0]*N,y:w[1]-S[1]*N},T=[[0,0],[l,c]];t.setViewportConstrained({x:D.x,y:D.y,zoom:w[2]},T,a)},_=zs().on("start",v).on("zoom",d?x:null).on("zoom.wheel",f?m:null);r.call(_,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:de}}const hn=e=>({x:e.x,y:e.y,zoom:e.k}),Cn=({x:e,y:t,zoom:n})=>un.translate(e,t).scale(n),qe=(e,t)=>e.target.closest(`.${t}`),ui=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Kf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Mn=(e,t=0,n=Kf,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},di=e=>{const t=e.ctrlKey&&wt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Uf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(qe(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&i){const v=de(u),x=di(u),_=d*Math.pow(2,x);o.scaleTo(n,_,v,u);return}const f=u.deltaMode===1?20:1;let g=r===Re.Vertical?0:u.deltaX*f,m=r===Re.Horizontal?0:u.deltaY*f;!wt()&&u.shiftKey&&r!==Re.Vertical&&(g=u.deltaY*f,m=0),o.translateBy(n,-(g/d)*s,-(m/d)*s,{internal:!0});const y=hn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,y),e.panScrollTimeout=setTimeout(()=>{c?.(u,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,y))}}function Qf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=qe(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function Jf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=hn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function eh({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&ui(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,hn(s.transform))}}function th({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&ui(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=hn(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function nh({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return d=>{const f=e||t,g=n&&d.ctrlKey,m=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(qe(d,`${c}-flow__node`)||qe(d,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!s&&!n||i||u&&!m||qe(d,a)&&m||qe(d,l)&&(!m||r&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!g&&m||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const y=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&y}}function oh({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=zs().scaleExtent([t,n]).translateExtent(o),f=ce(e).call(d);_({x:r.x,y:r.y,zoom:et(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const g=f.on("wheel.zoom"),m=f.on("dblclick.zoom");d.wheelDelta(di);function y(E,L){return f?new Promise($=>{d?.interpolate(L?.interpolate==="linear"?bn:Ot).transform(Mn(f,L?.duration,L?.ease,()=>$(!0)),E)}):Promise.resolve(!1)}function v({noWheelClassName:E,noPanClassName:L,onPaneContextMenu:$,userSelectionActive:b,panOnScroll:k,panOnDrag:I,panOnScrollMode:A,panOnScrollSpeed:P,preventScrolling:j,zoomOnPinch:O,zoomOnScroll:H,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:q,connectionInProgress:K,paneClickDistance:Y,selectionOnDrag:V}){b&&!c.isZoomingOrPanning&&x();const X=k&&!F&&!b;d.clickDistance(V?1/0:!fe(Y)||Y<0?0:Y);const Q=X?Uf({zoomPanValues:c,noWheelClassName:E,d3Selection:f,d3Zoom:d,panOnScrollMode:A,panOnScrollSpeed:P,zoomOnPinch:O,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):Qf({noWheelClassName:E,preventScrolling:j,d3ZoomHandler:g});if(f.on("wheel.zoom",Q,{passive:!1}),!b){const W=Jf({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:i});d.on("start",W);const Z=eh({zoomPanValues:c,panOnDrag:I,onPaneContextMenu:!!$,onPanZoom:s,onTransformChange:q});d.on("zoom",Z);const ee=th({zoomPanValues:c,panOnDrag:I,panOnScroll:k,onPaneContextMenu:$,onPanZoomEnd:a,onDraggingChange:l});d.on("end",ee)}const U=nh({zoomActivationKeyPressed:F,panOnDrag:I,zoomOnScroll:H,panOnScroll:k,zoomOnDoubleClick:R,zoomOnPinch:O,userSelectionActive:b,noPanClassName:L,noWheelClassName:E,lib:B,connectionInProgress:K});d.filter(U),R?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)}function x(){d.on("zoom",null)}async function _(E,L,$){const b=Cn(E),k=d?.constrain()(b,L,$);return k&&await y(k),new Promise(I=>I(k))}async function p(E,L){const $=Cn(E);return await y($,L),new Promise(b=>b($))}function w(E){if(f){const L=Cn(E),$=f.property("__zoom");($.k!==E.zoom||$.x!==E.x||$.y!==E.y)&&d?.transform(f,L,null,{sync:!0})}}function M(){const E=f?$s(f.node()):{x:0,y:0,k:1};return{x:E.x,y:E.y,zoom:E.k}}function S(E,L){return f?new Promise($=>{d?.interpolate(L?.interpolate==="linear"?bn:Ot).scaleTo(Mn(f,L?.duration,L?.ease,()=>$(!0)),E)}):Promise.resolve(!1)}function N(E,L){return f?new Promise($=>{d?.interpolate(L?.interpolate==="linear"?bn:Ot).scaleBy(Mn(f,L?.duration,L?.ease,()=>$(!0)),E)}):Promise.resolve(!1)}function D(E){d?.scaleExtent(E)}function T(E){d?.translateExtent(E)}function z(E){const L=!fe(E)||E<0?0:E;d?.clickDistance(L)}return{update:v,destroy:x,setViewport:p,setViewportConstrained:_,getViewport:M,scaleTo:S,scaleBy:N,setScaleExtent:D,setTranslateExtent:T,syncViewport:w,setClickDistance:z}}var ot;(function(e){e.Line="line",e.Handle="handle"})(ot||(ot={}));function rh({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){const i=e-t,a=n-o,l=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(l[0]=l[0]*-1),a&&s&&(l[1]=l[1]*-1),l}function nr(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ce(e,t){return Math.max(0,t-e)}function Me(e,t){return Math.max(0,e-t)}function At(e,t,n){return Math.max(0,t-e,e-n)}function or(e,t){return e?!t:t}function sh(e,t,n,o,r,s,i,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:g,ySnapped:m}=n,{minWidth:y,maxWidth:v,minHeight:x,maxHeight:_}=o,{x:p,y:w,width:M,height:S,aspectRatio:N}=e;let D=Math.floor(u?g-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0);const z=M+(l?-D:D),E=S+(c?-T:T),L=-s[0]*M,$=-s[1]*S;let b=At(z,y,v),k=At(E,x,_);if(i){let P=0,j=0;l&&D<0?P=Ce(p+D+L,i[0][0]):!l&&D>0&&(P=Me(p+z+L,i[1][0])),c&&T<0?j=Ce(w+T+$,i[0][1]):!c&&T>0&&(j=Me(w+E+$,i[1][1])),b=Math.max(b,P),k=Math.max(k,j)}if(a){let P=0,j=0;l&&D>0?P=Me(p+D,a[0][0]):!l&&D<0&&(P=Ce(p+z,a[1][0])),c&&T>0?j=Me(w+T,a[0][1]):!c&&T<0&&(j=Ce(w+E,a[1][1])),b=Math.max(b,P),k=Math.max(k,j)}if(r){if(u){const P=At(z/N,x,_)*N;if(b=Math.max(b,P),i){let j=0;!l&&!c||l&&!c&&f?j=Me(w+$+z/N,i[1][1])*N:j=Ce(w+$+(l?D:-D)/N,i[0][1])*N,b=Math.max(b,j)}if(a){let j=0;!l&&!c||l&&!c&&f?j=Ce(w+z/N,a[1][1])*N:j=Me(w+(l?D:-D)/N,a[0][1])*N,b=Math.max(b,j)}}if(d){const P=At(E*N,y,v)/N;if(k=Math.max(k,P),i){let j=0;!l&&!c||c&&!l&&f?j=Me(p+E*N+L,i[1][0])/N:j=Ce(p+(c?T:-T)*N+L,i[0][0])/N,k=Math.max(k,j)}if(a){let j=0;!l&&!c||c&&!l&&f?j=Ce(p+E*N,a[1][0])/N:j=Me(p+(c?T:-T)*N,a[0][0])/N,k=Math.max(k,j)}}}T=T+(T<0?k:-k),D=D+(D<0?b:-b),r&&(f?z>E*N?T=(or(l,c)?-D:D)/N:D=(or(l,c)?-T:T)*N:u?(T=D/N,c=l):(D=T*N,l=c));const I=l?p+D:p,A=c?w+T:w;return{width:M+(l?-D:D),height:S+(c?-T:T),x:s[0]*D*(l?-1:1)+I,y:s[1]*T*(c?-1:1)+A}}const fi={width:0,height:0,x:0,y:0},ih={...fi,pointerX:0,pointerY:0,aspectRatio:1};function ah(e){return[[0,0],[e.measured.width,e.measured.height]]}function ch(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,l=n[1]*i;return[[o-a,r-l],[o+s-a,r+i-l]]}function lh({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const s=ce(e);let i={controlDirection:nr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:g,onResize:m,onResizeEnd:y,shouldResize:v}){let x={...fi},_={...ih};i={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:nr(c)};let p,w=null,M=[],S,N,D,T=!1;const z=Cs().on("start",E=>{const{nodeLookup:L,transform:$,snapGrid:b,snapToGrid:k,nodeOrigin:I,paneDomNode:A}=n();if(p=L.get(t),!p)return;w=A?.getBoundingClientRect()??null;const{xSnapped:P,ySnapped:j}=ht(E.sourceEvent,{transform:$,snapGrid:b,snapToGrid:k,containerBounds:w});x={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},_={...x,pointerX:P,pointerY:j,aspectRatio:x.width/x.height},S=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(S=L.get(p.parentId),N=S&&p.extent==="parent"?ah(S):void 0),M=[],D=void 0;for(const[O,H]of L)if(H.parentId===t&&(M.push({id:O,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const R=ch(H,p,H.origin??I);D?D=[[Math.min(R[0][0],D[0][0]),Math.min(R[0][1],D[0][1])],[Math.max(R[1][0],D[1][0]),Math.max(R[1][1],D[1][1])]]:D=R}g?.(E,{...x})}).on("drag",E=>{const{transform:L,snapGrid:$,snapToGrid:b,nodeOrigin:k}=n(),I=ht(E.sourceEvent,{transform:L,snapGrid:$,snapToGrid:b,containerBounds:w}),A=[];if(!p)return;const{x:P,y:j,width:O,height:H}=x,R={},F=p.origin??k,{width:B,height:q,x:K,y:Y}=sh(_,i.controlDirection,I,i.boundaries,i.keepAspectRatio,F,N,D),V=B!==O,X=q!==H,Q=K!==P&&V,U=Y!==j&&X;if(!Q&&!U&&!V&&!X)return;if((Q||U||F[0]===1||F[1]===1)&&(R.x=Q?K:x.x,R.y=U?Y:x.y,x.x=R.x,x.y=R.y,M.length>0)){const ne=K-P,te=Y-j;for(const ae of M)ae.position={x:ae.position.x-ne+F[0]*(B-O),y:ae.position.y-te+F[1]*(q-H)},A.push(ae)}if((V||X)&&(R.width=V&&(!i.resizeDirection||i.resizeDirection==="horizontal")?B:x.width,R.height=X&&(!i.resizeDirection||i.resizeDirection==="vertical")?q:x.height,x.width=R.width,x.height=R.height),S&&p.expandParent){const ne=F[0]*(R.width??0);R.x&&R.x<ne&&(x.x=ne,_.x=_.x-(R.x-ne));const te=F[1]*(R.height??0);R.y&&R.y<te&&(x.y=te,_.y=_.y-(R.y-te))}const W=rh({width:x.width,prevWidth:O,height:x.height,prevHeight:H,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),Z={...x,direction:W};v?.(E,Z)!==!1&&(T=!0,m?.(E,Z),o(R,A))}).on("end",E=>{T&&(y?.(E,{...x}),r?.({...x}),T=!1)});s.call(z)}function l(){s.on(".drag",null)}return{update:a,destroy:l}}const uh={},rr=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const g=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,g))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(uh?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(o,r,l);return l},dh=e=>e?rr(e):rr,{useDebugValue:fh}=ue,{useSyncExternalStoreWithSelector:hh}=uc,mh=e=>e;function hi(e,t=mh,n){const o=hh(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return fh(o),o}const sr=(e,t)=>{const n=dh(e),o=(r,s=t)=>hi(n,r,s);return Object.assign(o,n),o},gh=(e,t)=>e?sr(e,t):sr;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const mn=C.createContext(null),ph=mn.Provider,mi=pe.error001();function J(e,t){const n=C.useContext(mn);if(n===null)throw new Error(mi);return hi(n,e,t)}function re(){const e=C.useContext(mn);if(e===null)throw new Error(mi);return C.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ir={display:"none"},yh={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},gi="react-flow__node-desc",pi="react-flow__edge-desc",xh="react-flow__aria-live",vh=e=>e.ariaLiveMessage,wh=e=>e.ariaLabelConfig;function bh({rfId:e}){const t=J(vh);return h.jsx("div",{id:`${xh}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:yh,children:t})}function _h({rfId:e,disableKeyboardA11y:t}){const n=J(wh);return h.jsxs(h.Fragment,{children:[h.jsx("div",{id:`${gi}-${e}`,style:ir,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),h.jsx("div",{id:`${pi}-${e}`,style:ir,children:n["edge.a11yDescription.default"]}),!t&&h.jsx(bh,{rfId:e})]})}const gn=C.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{const i=`${e}`.split("-");return h.jsx("div",{className:ie(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});gn.displayName="Panel";function Sh({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:h.jsx(gn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:h.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Nh=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Dt=e=>e.id;function Eh(e,t){return oe(e.selectedNodes.map(Dt),t.selectedNodes.map(Dt))&&oe(e.selectedEdges.map(Dt),t.selectedEdges.map(Dt))}function Ch({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(Nh,Eh);return C.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}const Mh=e=>!!e.onSelectionChangeHandlers;function Ih({onSelectionChange:e}){const t=J(Mh);return e||t?h.jsx(Ch,{onSelectionChange:e}):null}const yi=[0,0],kh={x:0,y:0,zoom:1},Ph=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],ar=[...Ph,"rfId"],jh=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),cr={translateExtent:yt,nodeOrigin:yi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Th(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:l}=J(jh,oe),c=re();C.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=cr,a()}),[]);const u=C.useRef(cr);return C.useEffect(()=>{for(const d of ar){const f=e[d],g=u.current[d];f!==g&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?s(f):d==="nodeExtent"?i(f):d==="ariaLabelConfig"?c.setState({ariaLabelConfig:bf(f)}):d==="fitView"?c.setState({fitViewQueued:f}):d==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[d]:f})))}u.current=e},ar.map(d=>e[d])),null}function lr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Ah(e){const[t,n]=C.useState(e==="system"?null:e);return C.useEffect(()=>{if(e!=="system"){n(e);return}const o=lr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:lr()?.matches?"dark":"light"}const ur=typeof document<"u"?document:null;function bt(e=null,t={target:ur,actInsideInputWithModifier:!0}){const[n,o]=C.useState(!1),r=C.useRef(!1),s=C.useRef(new Set([])),[i,a]=C.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
1
+ import{r as C,z as Wn,j as h,B as Tn,E as rc,F as ue,H as sc,I as Or,J as ic,L as ac,M as cc,i as lc,c as se,Q as uc,f as ye,V as Zn}from"./index-BLgTJ8o3.js";import{u as nn,c as je,I as He,n as Gt}from"./use-connection-CsPrFY0x.js";import{C as dc}from"./collection-header-DBUE7n6H.js";import{C as fc}from"./collection-page-BHk1uJKe.js";import{E as Ye}from"./error-boundary-CsEoagci.js";import{u as Te}from"./use-tool-call-BdbJ3oy8.js";import{u as Se}from"./tooltip-CSuczTFq.js";import{c as on,B as An}from"./button-IijH0wdI.js";import{V as hc}from"./view-mode-toggle-BXo-WMnB.js";import{i as mc}from"./GitBranch01-DjmPf135.js";import{s as Rr}from"./Plus-DofiSAMU.js";import{i as Hr}from"./CpuChip02-BwTl0fBj.js";import{u as Vr}from"./use-gateway-Bz_y7oh7.js";import{i as ze,a as ko,b as gc,c as Po,d as bn,e as _n,f as Br,s as Fr,D as Kn,g as Gr,h as pc,Z as Un,L as Qn,u as Xr,j as yc,k as xc,l as Dn,m as Yr,n as Jn,o as qr,p as Wr,q as Zr,r as vc,t as wc,v as bc,w as jo,x as _c,y as Kr,z as Ur,R as Sc,S as Nc,A as Ec,B as Qr,C as Cc,E as Mc,F as Ic,G as kc,H as Pc,I as jc,J as Jr,K as To,M as Tc,N as Ac,O as ct,P as Dc,Q as Lc,T as $c,U as zc,V as Oc,W as Rc,X as Hc,Y as Vc,_ as Bc,$ as Ae,a0 as Fc,a1 as Gc,a2 as rn}from"./types-CJK7iTsI.js";import{B as Xc}from"./badge-CStgouQf.js";import"./collection-display-button-2ZQ5sQTW.js";import"./dropdown-menu-BvLCKekW.js";import"./Grid01-CmB5R6oU.js";import"./useQuery-DXchCtgN.js";import"./index-BGEzzv-W.js";import"./popover-CwHNob2q.js";import"./Copy01-_s71W2Ph.js";import"./Key01-ZVAVplBN.js";import"./Play-BedrzKsi.js";import"./monaco-editor-mQfzbJMr.js";import"./spinner-D7ZAVJCR.js";const es=({size:e=24,color:t="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M18 20V10m-6 10V4M6 20v-6"}));es.displayName="BarChart01";const ts=({size:e=24,color:t="currentColor",...n})=>C.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},C.createElement("path",{d:"M5.52 2.64 3.96 4.72c-.309.412-.463.618-.46.79a.5.5 0 0 0 .192.384C3.828 6 4.085 6 4.6 6h14.8c.515 0 .773 0 .908-.106a.5.5 0 0 0 .192-.384c.003-.172-.151-.378-.46-.79l-1.56-2.08m-12.96 0c.176-.235.264-.352.376-.437a1 1 0 0 1 .33-.165C6.36 2 6.505 2 6.8 2h10.4c.293 0 .44 0 .575.038a1 1 0 0 1 .33.165c.111.085.199.202.375.437m-12.96 0L3.64 5.147c-.237.316-.356.475-.44.649a2 2 0 0 0-.163.487C3 6.473 3 6.671 3 7.067V18.8c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 22 5.08 22 6.2 22h11.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 20.48 21 19.92 21 18.8V7.067c0-.396 0-.594-.037-.784a1.998 1.998 0 0 0-.163-.487c-.084-.174-.203-.333-.44-.65L18.48 2.64M16 10a4 4 0 1 1-8 0"}));ts.displayName="ShoppingBag01";function De(){const e=new Date,t=new Date;t.setHours(e.getHours()-24),t.setSeconds(0,0);const n=new Date(e);return n.setHours(n.getHours()+1),n.setSeconds(0,0),{startDate:t.toISOString(),endDate:n.toISOString()}}var ns="Toggle",os=C.forwardRef((e,t)=>{const{pressed:n,defaultPressed:o,onPressedChange:r,...s}=e,[i,a]=Wn({prop:n,onChange:r,defaultProp:o??!1,caller:ns});return h.jsx(Tn.button,{type:"button","aria-pressed":i,"data-state":i?"on":"off","data-disabled":e.disabled?"":void 0,...s,ref:t,onClick:rc(e.onClick,()=>{e.disabled||a(!i)})})});os.displayName=ns;var Le="ToggleGroup",[rs]=sc(Le,[Or]),ss=Or(),eo=ue.forwardRef((e,t)=>{const{type:n,...o}=e;if(n==="single"){const r=o;return h.jsx(Yc,{...r,ref:t})}if(n==="multiple"){const r=o;return h.jsx(qc,{...r,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${Le}\``)});eo.displayName=Le;var[is,as]=rs(Le),Yc=ue.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=()=>{},...s}=e,[i,a]=Wn({prop:n,defaultProp:o??"",onChange:r,caller:Le});return h.jsx(is,{scope:e.__scopeToggleGroup,type:"single",value:ue.useMemo(()=>i?[i]:[],[i]),onItemActivate:a,onItemDeactivate:ue.useCallback(()=>a(""),[a]),children:h.jsx(cs,{...s,ref:t})})}),qc=ue.forwardRef((e,t)=>{const{value:n,defaultValue:o,onValueChange:r=()=>{},...s}=e,[i,a]=Wn({prop:n,defaultProp:o??[],onChange:r,caller:Le}),l=ue.useCallback(u=>a((d=[])=>[...d,u]),[a]),c=ue.useCallback(u=>a((d=[])=>d.filter(f=>f!==u)),[a]);return h.jsx(is,{scope:e.__scopeToggleGroup,type:"multiple",value:i,onItemActivate:l,onItemDeactivate:c,children:h.jsx(cs,{...s,ref:t})})});eo.displayName=Le;var[Wc,Zc]=rs(Le),cs=ue.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:o=!1,rovingFocus:r=!0,orientation:s,dir:i,loop:a=!0,...l}=e,c=ss(n),u=ac(i),d={role:"group",dir:u,...l};return h.jsx(Wc,{scope:n,rovingFocus:r,disabled:o,children:r?h.jsx(cc,{asChild:!0,...c,orientation:s,dir:u,loop:a,children:h.jsx(Tn.div,{...d,ref:t})}):h.jsx(Tn.div,{...d,ref:t})})}),Xt="ToggleGroupItem",ls=ue.forwardRef((e,t)=>{const n=as(Xt,e.__scopeToggleGroup),o=Zc(Xt,e.__scopeToggleGroup),r=ss(e.__scopeToggleGroup),s=n.value.includes(e.value),i=o.disabled||e.disabled,a={...e,pressed:s,disabled:i},l=ue.useRef(null);return o.rovingFocus?h.jsx(ic,{asChild:!0,...r,focusable:!i,active:s,ref:l,children:h.jsx(Ao,{...a,ref:t})}):h.jsx(Ao,{...a,ref:t})});ls.displayName=Xt;var Ao=ue.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:o,...r}=e,s=as(Xt,n),i={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},a=s.type==="single"?i:void 0;return h.jsx(os,{...a,...r,ref:t,onPressedChange:l=>{l?s.onItemActivate(o):s.onItemDeactivate(o)}})}),Kc=eo,Uc=ls;const Qc=lc("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-2 min-w-9",sm:"h-7 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),us=C.createContext({size:"default",variant:"default"});function ds(e){const t=se.c(20);let n,o,r,s,i;t[0]!==e?({className:o,variant:i,size:s,children:n,...r}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=s,t[5]=i):(n=t[1],o=t[2],r=t[3],s=t[4],i=t[5]);let a;t[6]!==o?(a=on("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",o),t[6]=o,t[7]=a):a=t[7];let l;t[8]!==s||t[9]!==i?(l={variant:i,size:s},t[8]=s,t[9]=i,t[10]=l):l=t[10];let c;t[11]!==n||t[12]!==l?(c=h.jsx(us.Provider,{value:l,children:n}),t[11]=n,t[12]=l,t[13]=c):c=t[13];let u;return t[14]!==r||t[15]!==s||t[16]!==a||t[17]!==c||t[18]!==i?(u=h.jsx(Kc,{"data-slot":"toggle-group","data-variant":i,"data-size":s,className:a,...r,children:c}),t[14]=r,t[15]=s,t[16]=a,t[17]=c,t[18]=i,t[19]=u):u=t[19],u}function Ze(e){const t=se.c(18);let n,o,r,s,i;t[0]!==e?({className:o,children:n,variant:i,size:s,...r}=e,t[0]=e,t[1]=n,t[2]=o,t[3]=r,t[4]=s,t[5]=i):(n=t[1],o=t[2],r=t[3],s=t[4],i=t[5]);const a=C.useContext(us),l=a.variant||i,c=a.size||s;let u;t[6]!==o||t[7]!==a.size||t[8]!==a.variant||t[9]!==s||t[10]!==i?(u=on(Qc({variant:a.variant||i,size:a.size||s}),"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",o),t[6]=o,t[7]=a.size,t[8]=a.variant,t[9]=s,t[10]=i,t[11]=u):u=t[11];let d;return t[12]!==n||t[13]!==r||t[14]!==l||t[15]!==c||t[16]!==u?(d=h.jsx(Uc,{"data-slot":"toggle-group-item","data-variant":l,"data-size":c,className:u,...r,children:n}),t[12]=n,t[13]=r,t[14]=l,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Jc={value:()=>{}};function sn(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new zt(n)}function zt(e){this._=e}function el(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}zt.prototype=sn.prototype={constructor:zt,on:function(e,t){var n=this._,o=el(e+"",n),r,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((r=(e=o[s]).type)&&(r=tl(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(r=(e=o[s]).type)n[r]=Do(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Do(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new zt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,s;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,r=s.length;o<r;++o)s[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)}};function tl(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Do(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Jc,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ln="http://www.w3.org/1999/xhtml";const Lo={svg:"http://www.w3.org/2000/svg",xhtml:Ln,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function an(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Lo.hasOwnProperty(t)?{space:Lo[t],local:e}:e}function nl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ln&&t.documentElement.namespaceURI===Ln?t.createElement(e):t.createElementNS(n,e)}}function ol(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function fs(e){var t=an(e);return(t.local?ol:nl)(t)}function rl(){}function to(e){return e==null?rl:function(){return this.querySelector(e)}}function sl(e){typeof e!="function"&&(e=to(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=new Array(i),l,c,u=0;u<i;++u)(l=s[u])&&(c=e.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new le(o,this._parents)}function il(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function al(){return[]}function hs(e){return e==null?al:function(){return this.querySelectorAll(e)}}function cl(e){return function(){return il(e.apply(this,arguments))}}function ll(e){typeof e=="function"?e=cl(e):e=hs(e);for(var t=this._groups,n=t.length,o=[],r=[],s=0;s<n;++s)for(var i=t[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&(o.push(e.call(l,l.__data__,c,i)),r.push(l));return new le(o,r)}function ms(e){return function(){return this.matches(e)}}function gs(e){return function(t){return t.matches(e)}}var ul=Array.prototype.find;function dl(e){return function(){return ul.call(this.children,e)}}function fl(){return this.firstElementChild}function hl(e){return this.select(e==null?fl:dl(typeof e=="function"?e:gs(e)))}var ml=Array.prototype.filter;function gl(){return Array.from(this.children)}function pl(e){return function(){return ml.call(this.children,e)}}function yl(e){return this.selectAll(e==null?gl:pl(typeof e=="function"?e:gs(e)))}function xl(e){typeof e!="function"&&(e=ms(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new le(o,this._parents)}function ps(e){return new Array(e.length)}function vl(){return new le(this._enter||this._groups.map(ps),this._parents)}function Yt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Yt.prototype={constructor:Yt,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 wl(e){return function(){return e}}function bl(e,t,n,o,r,s){for(var i=0,a,l=t.length,c=s.length;i<c;++i)(a=t[i])?(a.__data__=s[i],o[i]=a):n[i]=new Yt(e,s[i]);for(;i<l;++i)(a=t[i])&&(r[i]=a)}function _l(e,t,n,o,r,s,i){var a,l,c=new Map,u=t.length,d=s.length,f=new Array(u),g;for(a=0;a<u;++a)(l=t[a])&&(f[a]=g=i.call(l,l.__data__,a,t)+"",c.has(g)?r[a]=l:c.set(g,l));for(a=0;a<d;++a)g=i.call(e,s[a],a,s)+"",(l=c.get(g))?(o[a]=l,l.__data__=s[a],c.delete(g)):n[a]=new Yt(e,s[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function Sl(e){return e.__data__}function Nl(e,t){if(!arguments.length)return Array.from(this,Sl);var n=t?_l:bl,o=this._parents,r=this._groups;typeof e!="function"&&(e=wl(e));for(var s=r.length,i=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=o[c],d=r[c],f=d.length,g=El(e.call(u,u&&u.__data__,c,o)),m=g.length,y=a[c]=new Array(m),v=i[c]=new Array(m),x=l[c]=new Array(f);n(u,d,y,v,x,g,t);for(var _=0,p=0,w,M;_<m;++_)if(w=y[_]){for(_>=p&&(p=_+1);!(M=v[p])&&++p<m;);w._next=M||null}}return i=new le(i,o),i._enter=a,i._exit=l,i}function El(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Cl(){return new le(this._exit||this._groups.map(ps),this._parents)}function Ml(e,t,n){var o=this.enter(),r=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?s.remove():n(s),o&&r?o.merge(r).order():r}function Il(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,s=o.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=n[l],u=o[l],d=c.length,f=a[l]=new Array(d),g,m=0;m<d;++m)(g=c[m]||u[m])&&(f[m]=g);for(;l<r;++l)a[l]=n[l];return new le(a,this._parents)}function kl(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,s=o[r],i;--r>=0;)(i=o[r])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function Pl(e){e||(e=jl);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s){for(var i=n[s],a=i.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=i[u])&&(l[u]=c);l.sort(t)}return new le(r,this._parents).order()}function jl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Tl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Al(){return Array.from(this)}function Dl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length;r<s;++r){var i=o[r];if(i)return i}return null}function Ll(){let e=0;for(const t of this)++e;return e}function $l(){return!this.node()}function zl(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],s=0,i=r.length,a;s<i;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function Ol(e){return function(){this.removeAttribute(e)}}function Rl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hl(e,t){return function(){this.setAttribute(e,t)}}function Vl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Bl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Fl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Gl(e,t){var n=an(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Rl:Ol:typeof t=="function"?n.local?Fl:Bl:n.local?Vl:Hl)(n,t))}function ys(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Xl(e){return function(){this.style.removeProperty(e)}}function Yl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ql(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Wl(e,t,n){return arguments.length>1?this.each((t==null?Xl:typeof t=="function"?ql:Yl)(e,t,n??"")):Ue(this.node(),e)}function Ue(e,t){return e.style.getPropertyValue(t)||ys(e).getComputedStyle(e,null).getPropertyValue(t)}function Zl(e){return function(){delete this[e]}}function Kl(e,t){return function(){this[e]=t}}function Ul(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ql(e,t){return arguments.length>1?this.each((t==null?Zl:typeof t=="function"?Ul:Kl)(e,t)):this.node()[e]}function xs(e){return e.trim().split(/^|\s+/)}function no(e){return e.classList||new vs(e)}function vs(e){this._node=e,this._names=xs(e.getAttribute("class")||"")}vs.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 ws(e,t){for(var n=no(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function bs(e,t){for(var n=no(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Jl(e){return function(){ws(this,e)}}function eu(e){return function(){bs(this,e)}}function tu(e,t){return function(){(t.apply(this,arguments)?ws:bs)(this,e)}}function nu(e,t){var n=xs(e+"");if(arguments.length<2){for(var o=no(this.node()),r=-1,s=n.length;++r<s;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?tu:t?Jl:eu)(n,t))}function ou(){this.textContent=""}function ru(e){return function(){this.textContent=e}}function su(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function iu(e){return arguments.length?this.each(e==null?ou:(typeof e=="function"?su:ru)(e)):this.node().textContent}function au(){this.innerHTML=""}function cu(e){return function(){this.innerHTML=e}}function lu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function uu(e){return arguments.length?this.each(e==null?au:(typeof e=="function"?lu:cu)(e)):this.node().innerHTML}function du(){this.nextSibling&&this.parentNode.appendChild(this)}function fu(){return this.each(du)}function hu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mu(){return this.each(hu)}function gu(e){var t=typeof e=="function"?e:fs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function pu(){return null}function yu(e,t){var n=typeof e=="function"?e:fs(e),o=t==null?pu:typeof t=="function"?t:to(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function xu(){var e=this.parentNode;e&&e.removeChild(this)}function vu(){return this.each(xu)}function wu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function bu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _u(e){return this.select(e?bu:wu)}function Su(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Nu(e){return function(t){e.call(this,t,this.__data__)}}function Eu(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Cu(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,s;n<r;++n)s=t[n],(!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 Mu(e,t,n){return function(){var o=this.__on,r,s=Nu(t);if(o){for(var i=0,a=o.length;i<a;++i)if((r=o[i]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},o?o.push(r):this.__on=[r]}}function Iu(e,t,n){var o=Eu(e+""),r,s=o.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?Mu:Cu,r=0;r<s;++r)this.each(a(o[r],t,n));return this}function _s(e,t,n){var o=ys(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function ku(e,t){return function(){return _s(this,e,t)}}function Pu(e,t){return function(){return _s(this,e,t.apply(this,arguments))}}function ju(e,t){return this.each((typeof t=="function"?Pu:ku)(e,t))}function*Tu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length,i;r<s;++r)(i=o[r])&&(yield i)}var Ss=[null];function le(e,t){this._groups=e,this._parents=t}function St(){return new le([[document.documentElement]],Ss)}function Au(){return this}le.prototype=St.prototype={constructor:le,select:sl,selectAll:ll,selectChild:hl,selectChildren:yl,filter:xl,data:Nl,enter:vl,exit:Cl,join:Ml,merge:Il,selection:Au,order:kl,sort:Pl,call:Tl,nodes:Al,node:Dl,size:Ll,empty:$l,each:zl,attr:Gl,style:Wl,property:Ql,classed:nu,text:iu,html:uu,raise:fu,lower:mu,append:gu,insert:yu,remove:vu,clone:_u,datum:Su,on:Iu,dispatch:ju,[Symbol.iterator]:Tu};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Ss)}function Du(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Du(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Lu={passive:!1},gt={capture:!0,passive:!1};function Sn(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function Ns(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Ke,gt);"onselectstart"in t?n.on("selectstart.drag",Ke,gt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Es(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ke,gt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const kt=e=>()=>e;function $n(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}$n.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function $u(e){return!e.ctrlKey&&!e.button}function zu(){return this.parentNode}function Ou(e,t){return t??{x:e.x,y:e.y}}function Ru(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cs(){var e=$u,t=zu,n=Ou,o=Ru,r={},s=sn("start","drag","end"),i=0,a,l,c,u,d=0;function f(w){w.on("mousedown.drag",g).filter(o).on("touchstart.drag",v).on("touchmove.drag",x,Lu).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(w,M){if(!(u||!e.call(this,w,M))){var S=p(this,t.call(this,w,M),w,M,"mouse");S&&(ce(w.view).on("mousemove.drag",m,gt).on("mouseup.drag",y,gt),Ns(w.view),Sn(w),c=!1,a=w.clientX,l=w.clientY,S("start",w))}}function m(w){if(Ke(w),!c){var M=w.clientX-a,S=w.clientY-l;c=M*M+S*S>d}r.mouse("drag",w)}function y(w){ce(w.view).on("mousemove.drag mouseup.drag",null),Es(w.view,c),Ke(w),r.mouse("end",w)}function v(w,M){if(e.call(this,w,M)){var S=w.changedTouches,N=t.call(this,w,M),D=S.length,T,z;for(T=0;T<D;++T)(z=p(this,N,w,M,S[T].identifier,S[T]))&&(Sn(w),z("start",w,S[T]))}}function x(w){var M=w.changedTouches,S=M.length,N,D;for(N=0;N<S;++N)(D=r[M[N].identifier])&&(Ke(w),D("drag",w,M[N]))}function _(w){var M=w.changedTouches,S=M.length,N,D;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<S;++N)(D=r[M[N].identifier])&&(Sn(w),D("end",w,M[N]))}function p(w,M,S,N,D,T){var z=s.copy(),E=de(T||S,M),L,$,b;if((b=n.call(w,new $n("beforestart",{sourceEvent:S,target:f,identifier:D,active:i,x:E[0],y:E[1],dx:0,dy:0,dispatch:z}),N))!=null)return L=b.x-E[0]||0,$=b.y-E[1]||0,function k(I,A,P){var j=E,O;switch(I){case"start":r[D]=k,O=i++;break;case"end":delete r[D],--i;case"drag":E=de(P||A,M),O=i;break}z.call(I,w,new $n(I,{sourceEvent:A,subject:b,target:f,identifier:D,active:O,x:E[0]+L,y:E[1]+$,dx:E[0]-j[0],dy:E[1]-j[1],dispatch:z}),N)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:kt(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:kt(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:kt(w),f):n},f.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:kt(!!w),f):o},f.on=function(){var w=s.on.apply(s,arguments);return w===s?f:w},f.clickDistance=function(w){return arguments.length?(d=(w=+w)*w,f):Math.sqrt(d)},f}var $o=180/Math.PI,zn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ms(e,t,n,o,r,s){var i,a,l;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*$o,skewX:Math.atan(l)*$o,scaleX:i,scaleY:a}}var Pt;function Hu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?zn:Ms(t.a,t.b,t.c,t.d,t.e,t.f)}function Vu(e){return e==null||(Pt||(Pt=document.createElementNS("http://www.w3.org/2000/svg","g")),Pt.setAttribute("transform",e),!(e=Pt.transform.baseVal.consolidate()))?zn:(e=e.matrix,Ms(e.a,e.b,e.c,e.d,e.e,e.f))}function Is(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function s(c,u,d,f,g,m){if(c!==d||u!==f){var y=g.push("translate(",null,t,null,n);m.push({i:y-4,x:ze(c,d)},{i:y-2,x:ze(u,f)})}else(d||f)&&g.push("translate("+d+t+f+n)}function i(c,u,d,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:ze(c,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(c,u,d,f){c!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:ze(c,u)}):u&&d.push(r(d)+"skewX("+u+o)}function l(c,u,d,f,g,m){if(c!==d||u!==f){var y=g.push(r(g)+"scale(",null,",",null,")");m.push({i:y-4,x:ze(c,d)},{i:y-2,x:ze(u,f)})}else(d!==1||f!==1)&&g.push(r(g)+"scale("+d+","+f+")")}return function(c,u){var d=[],f=[];return c=e(c),u=e(u),s(c.translateX,c.translateY,u.translateX,u.translateY,d,f),i(c.rotate,u.rotate,d,f),a(c.skewX,u.skewX,d,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(g){for(var m=-1,y=f.length,v;++m<y;)d[(v=f[m]).i]=v.x(g);return d.join("")}}}var Bu=Is(Hu,"px, ","px)","deg)"),Fu=Is(Vu,", ",")",")"),Gu=1e-12;function zo(e){return((e=Math.exp(e))+1/e)/2}function Xu(e){return((e=Math.exp(e))-1/e)/2}function Yu(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ot=(function e(t,n,o){function r(s,i){var a=s[0],l=s[1],c=s[2],u=i[0],d=i[1],f=i[2],g=u-a,m=d-l,y=g*g+m*m,v,x;if(y<Gu)x=Math.log(f/c)/t,v=function(N){return[a+N*g,l+N*m,c*Math.exp(t*N*x)]};else{var _=Math.sqrt(y),p=(f*f-c*c+o*y)/(2*c*n*_),w=(f*f-c*c-o*y)/(2*f*n*_),M=Math.log(Math.sqrt(p*p+1)-p),S=Math.log(Math.sqrt(w*w+1)-w);x=(S-M)/t,v=function(N){var D=N*x,T=zo(M),z=c/(n*_)*(T*Yu(t*D+M)-Xu(M));return[a+z*g,l+z*m,c*T/zo(t*D+M)]}}return v.duration=x*1e3*t/Math.SQRT2,v}return r.rho=function(s){var i=Math.max(.001,+s),a=i*i,l=a*a;return e(i,a,l)},r})(Math.SQRT2,2,4);var Qe=0,dt=0,lt=0,ks=1e3,qt,ft,Wt=0,Ve=0,cn=0,pt=typeof performance=="object"&&performance.now?performance:Date,Ps=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oo(){return Ve||(Ps(qu),Ve=pt.now()+cn)}function qu(){Ve=0}function Zt(){this._call=this._time=this._next=null}Zt.prototype=js.prototype={constructor:Zt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?oo():+n)+(t==null?0:+t),!this._next&&ft!==this&&(ft?ft._next=this:qt=this,ft=this),this._call=e,this._time=n,On()},stop:function(){this._call&&(this._call=null,this._time=1/0,On())}};function js(e,t,n){var o=new Zt;return o.restart(e,t,n),o}function Wu(){oo(),++Qe;for(var e=qt,t;e;)(t=Ve-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function Oo(){Ve=(Wt=pt.now())+cn,Qe=dt=0;try{Wu()}finally{Qe=0,Ku(),Ve=0}}function Zu(){var e=pt.now(),t=e-Wt;t>ks&&(cn-=t,Wt=e)}function Ku(){for(var e,t=qt,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:qt=n);ft=e,On(o)}function On(e){if(!Qe){dt&&(dt=clearTimeout(dt));var t=e-Ve;t>24?(e<1/0&&(dt=setTimeout(Oo,e-pt.now()-cn)),lt&&(lt=clearInterval(lt))):(lt||(Wt=pt.now(),lt=setInterval(Zu,ks)),Qe=1,Ps(Oo))}}function Ro(e,t,n){var o=new Zt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Uu=sn("start","end","cancel","interrupt"),Qu=[],Ts=0,Ho=1,Rn=2,Rt=3,Vo=4,Hn=5,Ht=6;function ln(e,t,n,o,r,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;Ju(e,n,{name:t,index:o,group:r,on:Uu,tween:Qu,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Ts})}function ro(e,t){var n=me(e,t);if(n.state>Ts)throw new Error("too late; already scheduled");return n}function xe(e,t){var n=me(e,t);if(n.state>Rt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ju(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=js(s,0,n.time);function s(c){n.state=Ho,n.timer.restart(i,n.delay,n.time),n.delay<=c&&i(c-n.delay)}function i(c){var u,d,f,g;if(n.state!==Ho)return l();for(u in o)if(g=o[u],g.name===n.name){if(g.state===Rt)return Ro(i);g.state===Vo?(g.state=Ht,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[u]):+u<t&&(g.state=Ht,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[u])}if(Ro(function(){n.state===Rt&&(n.state=Vo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Rn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Rn){for(n.state=Rt,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(g=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=g);r.length=d+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Hn,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Hn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Ht,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Vt(e,t){var n=e.__transition,o,r,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((o=n[i]).name!==t){s=!1;continue}r=o.state>Rn&&o.state<Hn,o.state=Ht,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}s&&delete e.__transition}}function ed(e){return this.each(function(){Vt(this,e)})}function td(e,t){var n,o;return function(){var r=xe(this,e),s=r.tween;if(s!==n){o=n=s;for(var i=0,a=o.length;i<a;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}r.tween=o}}function nd(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var s=xe(this,e),i=s.tween;if(i!==o){r=(o=i).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}s.tween=r}}function od(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=me(this.node(),n).tween,r=0,s=o.length,i;r<s;++r)if((i=o[r]).name===e)return i.value;return null}return this.each((t==null?td:nd)(n,e,t))}function so(e,t,n){var o=e._id;return e.each(function(){var r=xe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return me(r,o).value[t]}}function As(e,t){var n;return(typeof t=="number"?ze:t instanceof Po?ko:(n=Po(t))?(t=n,ko):gc)(e,t)}function rd(e){return function(){this.removeAttribute(e)}}function sd(e){return function(){this.removeAttributeNS(e.space,e.local)}}function id(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttribute(e);return i===r?null:i===o?s:s=t(o=i,n)}}function ad(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===r?null:i===o?s:s=t(o=i,n)}}function cd(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function ld(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function ud(e,t){var n=an(e),o=n==="transform"?Fu:As;return this.attrTween(e,typeof t=="function"?(n.local?ld:cd)(n,o,so(this,"attr."+e,t)):t==null?(n.local?sd:rd)(n):(n.local?ad:id)(n,o,t))}function dd(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function fd(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function hd(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&fd(e,s)),n}return r._value=t,r}function md(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&dd(e,s)),n}return r._value=t,r}function gd(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=an(e);return this.tween(n,(o.local?hd:md)(o,t))}function pd(e,t){return function(){ro(this,e).delay=+t.apply(this,arguments)}}function yd(e,t){return t=+t,function(){ro(this,e).delay=t}}function xd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?pd:yd)(t,e)):me(this.node(),t).delay}function vd(e,t){return function(){xe(this,e).duration=+t.apply(this,arguments)}}function wd(e,t){return t=+t,function(){xe(this,e).duration=t}}function bd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vd:wd)(t,e)):me(this.node(),t).duration}function _d(e,t){if(typeof t!="function")throw new Error;return function(){xe(this,e).ease=t}}function Sd(e){var t=this._id;return arguments.length?this.each(_d(t,e)):me(this.node(),t).ease}function Nd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;xe(this,e).ease=n}}function Ed(e){if(typeof e!="function")throw new Error;return this.each(Nd(this._id,e))}function Cd(e){typeof e!="function"&&(e=ms(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new _e(o,this._parents,this._name,this._id)}function Md(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,s=Math.min(o,r),i=new Array(o),a=0;a<s;++a)for(var l=t[a],c=n[a],u=l.length,d=i[a]=new Array(u),f,g=0;g<u;++g)(f=l[g]||c[g])&&(d[g]=f);for(;a<o;++a)i[a]=t[a];return new _e(i,this._parents,this._name,this._id)}function Id(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function kd(e,t,n){var o,r,s=Id(t)?ro:xe;return function(){var i=s(this,e),a=i.on;a!==o&&(r=(o=a).copy()).on(t,n),i.on=r}}function Pd(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(kd(n,e,t))}function jd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Td(){return this.on("end.remove",jd(this._id))}function Ad(e){var t=this._name,n=this._id;typeof e!="function"&&(e=to(e));for(var o=this._groups,r=o.length,s=new Array(r),i=0;i<r;++i)for(var a=o[i],l=a.length,c=s[i]=new Array(l),u,d,f=0;f<l;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),c[f]=d,ln(c[f],t,n,f,c,me(u,n)));return new _e(s,this._parents,t,n)}function Dd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=hs(e));for(var o=this._groups,r=o.length,s=[],i=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),g,m=me(u,n),y=0,v=f.length;y<v;++y)(g=f[y])&&ln(g,t,n,y,f,m);s.push(f),i.push(u)}return new _e(s,i,t,n)}var Ld=St.prototype.constructor;function $d(){return new Ld(this._groups,this._parents)}function zd(e,t){var n,o,r;return function(){var s=Ue(this,e),i=(this.style.removeProperty(e),Ue(this,e));return s===i?null:s===n&&i===o?r:r=t(n=s,o=i)}}function Ds(e){return function(){this.style.removeProperty(e)}}function Od(e,t,n){var o,r=n+"",s;return function(){var i=Ue(this,e);return i===r?null:i===o?s:s=t(o=i,n)}}function Rd(e,t,n){var o,r,s;return function(){var i=Ue(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Ue(this,e))),i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a))}}function Hd(e,t){var n,o,r,s="style."+t,i="end."+s,a;return function(){var l=xe(this,e),c=l.on,u=l.value[s]==null?a||(a=Ds(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(i,r=u),l.on=o}}function Vd(e,t,n){var o=(e+="")=="transform"?Bu:As;return t==null?this.styleTween(e,zd(e,o)).on("end.style."+e,Ds(e)):typeof t=="function"?this.styleTween(e,Rd(e,o,so(this,"style."+e,t))).each(Hd(this._id,e)):this.styleTween(e,Od(e,o,t),n).on("end.style."+e,null)}function Bd(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Fd(e,t,n){var o,r;function s(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&Bd(e,i,n)),o}return s._value=t,s}function Gd(e,t,n){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,Fd(e,t,n??""))}function Xd(e){return function(){this.textContent=e}}function Yd(e){return function(){var t=e(this);this.textContent=t??""}}function qd(e){return this.tween("text",typeof e=="function"?Yd(so(this,"text",e)):Xd(e==null?"":e+""))}function Wd(e){return function(t){this.textContent=e.call(this,t)}}function Zd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Wd(r)),t}return o._value=e,o}function Kd(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,Zd(e))}function Ud(){for(var e=this._name,t=this._id,n=Ls(),o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)if(l=i[c]){var u=me(l,t);ln(l,e,n,c,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new _e(o,this._parents,e,n)}function Qd(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(s,i){var a={value:i},l={value:function(){--r===0&&s()}};n.each(function(){var c=xe(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&s()})}var Jd=0;function _e(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ls(){return++Jd}var we=St.prototype;_e.prototype={constructor:_e,select:Ad,selectAll:Dd,selectChild:we.selectChild,selectChildren:we.selectChildren,filter:Cd,merge:Md,selection:$d,transition:Ud,call:we.call,nodes:we.nodes,node:we.node,size:we.size,empty:we.empty,each:we.each,on:Pd,attr:ud,attrTween:gd,style:Vd,styleTween:Gd,text:qd,textTween:Kd,remove:Td,tween:od,delay:xd,duration:bd,ease:Sd,easeVarying:Ed,end:Qd,[Symbol.iterator]:we[Symbol.iterator]};function ef(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var tf={time:null,delay:0,duration:250,ease:ef};function nf(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function of(e){var t,n;e instanceof _e?(t=e._id,e=e._name):(t=Ls(),(n=tf).time=oo(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&ln(l,e,t,c,i,n||nf(l,t));return new _e(o,this._parents,e,t)}St.prototype.interrupt=ed;St.prototype.transition=of;const jt=e=>()=>e;function rf(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function be(e,t,n){this.k=e,this.x=t,this.y=n}be.prototype={constructor:be,scale:function(e){return e===1?this:new be(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new be(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 un=new be(1,0,0);$s.prototype=be.prototype;function $s(e){for(;!e.__zoom;)if(!(e=e.parentNode))return un;return e.__zoom}function Nn(e){e.stopImmediatePropagation()}function ut(e){e.preventDefault(),e.stopImmediatePropagation()}function sf(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function af(){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 Bo(){return this.__zoom||un}function cf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function lf(){return navigator.maxTouchPoints||"ontouchstart"in this}function uf(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function zs(){var e=sf,t=af,n=uf,o=cf,r=lf,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ot,c=sn("start","zoom","end"),u,d,f,g=500,m=150,y=0,v=10;function x(b){b.property("__zoom",Bo).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",z).filter(r).on("touchstart.zoom",E).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(b,k,I,A){var P=b.selection?b.selection():b;P.property("__zoom",Bo),b!==P?M(b,k,I,A):P.interrupt().each(function(){S(this,arguments).event(A).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},x.scaleBy=function(b,k,I,A){x.scaleTo(b,function(){var P=this.__zoom.k,j=typeof k=="function"?k.apply(this,arguments):k;return P*j},I,A)},x.scaleTo=function(b,k,I,A){x.transform(b,function(){var P=t.apply(this,arguments),j=this.__zoom,O=I==null?w(P):typeof I=="function"?I.apply(this,arguments):I,H=j.invert(O),R=typeof k=="function"?k.apply(this,arguments):k;return n(p(_(j,R),O,H),P,i)},I,A)},x.translateBy=function(b,k,I,A){x.transform(b,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof I=="function"?I.apply(this,arguments):I),t.apply(this,arguments),i)},null,A)},x.translateTo=function(b,k,I,A,P){x.transform(b,function(){var j=t.apply(this,arguments),O=this.__zoom,H=A==null?w(j):typeof A=="function"?A.apply(this,arguments):A;return n(un.translate(H[0],H[1]).scale(O.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof I=="function"?-I.apply(this,arguments):-I),j,i)},A,P)};function _(b,k){return k=Math.max(s[0],Math.min(s[1],k)),k===b.k?b:new be(k,b.x,b.y)}function p(b,k,I){var A=k[0]-I[0]*b.k,P=k[1]-I[1]*b.k;return A===b.x&&P===b.y?b:new be(b.k,A,P)}function w(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function M(b,k,I,A){b.on("start.zoom",function(){S(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(A).end()}).tween("zoom",function(){var P=this,j=arguments,O=S(P,j).event(A),H=t.apply(P,j),R=I==null?w(H):typeof I=="function"?I.apply(P,j):I,F=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),B=P.__zoom,q=typeof k=="function"?k.apply(P,j):k,K=l(B.invert(R).concat(F/B.k),q.invert(R).concat(F/q.k));return function(Y){if(Y===1)Y=q;else{var V=K(Y),X=F/V[2];Y=new be(X,R[0]-V[0]*X,R[1]-V[1]*X)}O.zoom(null,Y)}})}function S(b,k,I){return!I&&b.__zooming||new N(b,k)}function N(b,k){this.that=b,this.args=k,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,k),this.taps=0}N.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,k){return this.mouse&&b!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var k=ce(this.that).datum();c.call(b,this.that,new rf(b,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:c}),k)}};function D(b,...k){if(!e.apply(this,arguments))return;var I=S(this,k).event(b),A=this.__zoom,P=Math.max(s[0],Math.min(s[1],A.k*Math.pow(2,o.apply(this,arguments)))),j=de(b);if(I.wheel)(I.mouse[0][0]!==j[0]||I.mouse[0][1]!==j[1])&&(I.mouse[1]=A.invert(I.mouse[0]=j)),clearTimeout(I.wheel);else{if(A.k===P)return;I.mouse=[j,A.invert(j)],Vt(this),I.start()}ut(b),I.wheel=setTimeout(O,m),I.zoom("mouse",n(p(_(A,P),I.mouse[0],I.mouse[1]),I.extent,i));function O(){I.wheel=null,I.end()}}function T(b,...k){if(f||!e.apply(this,arguments))return;var I=b.currentTarget,A=S(this,k,!0).event(b),P=ce(b.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),j=de(b,I),O=b.clientX,H=b.clientY;Ns(b.view),Nn(b),A.mouse=[j,this.__zoom.invert(j)],Vt(this),A.start();function R(B){if(ut(B),!A.moved){var q=B.clientX-O,K=B.clientY-H;A.moved=q*q+K*K>y}A.event(B).zoom("mouse",n(p(A.that.__zoom,A.mouse[0]=de(B,I),A.mouse[1]),A.extent,i))}function F(B){P.on("mousemove.zoom mouseup.zoom",null),Es(B.view,A.moved),ut(B),A.event(B).end()}}function z(b,...k){if(e.apply(this,arguments)){var I=this.__zoom,A=de(b.changedTouches?b.changedTouches[0]:b,this),P=I.invert(A),j=I.k*(b.shiftKey?.5:2),O=n(p(_(I,j),A,P),t.apply(this,k),i);ut(b),a>0?ce(this).transition().duration(a).call(M,O,A,b):ce(this).call(x.transform,O,A,b)}}function E(b,...k){if(e.apply(this,arguments)){var I=b.touches,A=I.length,P=S(this,k,b.changedTouches.length===A).event(b),j,O,H,R;for(Nn(b),O=0;O<A;++O)H=I[O],R=de(H,this),R=[R,this.__zoom.invert(R),H.identifier],P.touch0?!P.touch1&&P.touch0[2]!==R[2]&&(P.touch1=R,P.taps=0):(P.touch0=R,j=!0,P.taps=1+!!u);u&&(u=clearTimeout(u)),j&&(P.taps<2&&(d=R[0],u=setTimeout(function(){u=null},g)),Vt(this),P.start())}}function L(b,...k){if(this.__zooming){var I=S(this,k).event(b),A=b.changedTouches,P=A.length,j,O,H,R;for(ut(b),j=0;j<P;++j)O=A[j],H=de(O,this),I.touch0&&I.touch0[2]===O.identifier?I.touch0[0]=H:I.touch1&&I.touch1[2]===O.identifier&&(I.touch1[0]=H);if(O=I.that.__zoom,I.touch1){var F=I.touch0[0],B=I.touch0[1],q=I.touch1[0],K=I.touch1[1],Y=(Y=q[0]-F[0])*Y+(Y=q[1]-F[1])*Y,V=(V=K[0]-B[0])*V+(V=K[1]-B[1])*V;O=_(O,Math.sqrt(Y/V)),H=[(F[0]+q[0])/2,(F[1]+q[1])/2],R=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(I.touch0)H=I.touch0[0],R=I.touch0[1];else return;I.zoom("touch",n(p(O,H,R),I.extent,i))}}function $(b,...k){if(this.__zooming){var I=S(this,k).event(b),A=b.changedTouches,P=A.length,j,O;for(Nn(b),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),j=0;j<P;++j)O=A[j],I.touch0&&I.touch0[2]===O.identifier?delete I.touch0:I.touch1&&I.touch1[2]===O.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(O=de(O,this),Math.hypot(d[0]-O[0],d[1]-O[1])<v)){var H=ce(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return x.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:jt(+b),x):o},x.filter=function(b){return arguments.length?(e=typeof b=="function"?b:jt(!!b),x):e},x.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:jt(!!b),x):r},x.extent=function(b){return arguments.length?(t=typeof b=="function"?b:jt([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),x):t},x.scaleExtent=function(b){return arguments.length?(s[0]=+b[0],s[1]=+b[1],x):[s[0],s[1]]},x.translateExtent=function(b){return arguments.length?(i[0][0]=+b[0][0],i[1][0]=+b[1][0],i[0][1]=+b[0][1],i[1][1]=+b[1][1],x):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},x.constrain=function(b){return arguments.length?(n=b,x):n},x.duration=function(b){return arguments.length?(a=+b,x):a},x.interpolate=function(b){return arguments.length?(l=b,x):l},x.on=function(){var b=c.on.apply(c,arguments);return b===c?x:b},x.clickDistance=function(b){return arguments.length?(y=(b=+b)*b,x):Math.sqrt(y)},x.tapDistance=function(b){return arguments.length?(v=+b,x):v},x}const pe={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n: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."},yt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Os=["Enter"," ","Escape"],Rs={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var Re;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Re||(Re={}));var xt;(function(e){e.Partial="partial",e.Full="full"})(xt||(xt={}));const Hs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ie;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ie||(Ie={}));var Kt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Kt||(Kt={}));var G;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(G||(G={}));const Fo={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top};function Vs(e){return e===null?null:e?"valid":"invalid"}const Bs=e=>"id"in e&&"source"in e&&"target"in e,df=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),io=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Nt=(e,t=[0,0])=>{const{width:n,height:o}=Ne(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},ff=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const s=typeof r=="string";let i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):io(r)?r:t.nodeLookup.get(r.id));const a=i?Ut(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return dn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fn(n)},Et=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=dn(n,Ut(r)),o=!0)}),o?fn(n):{x:0,y:0,width:0,height:0}},ao=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{const a={...Mt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=c;if(i&&!d||f)continue;const g=u.width??c.width??c.initialWidth??null,m=u.height??c.height??c.initialHeight??null,y=vt(a,tt(c)),v=(g??0)*(m??0),x=s&&y>0;(!c.internals.handleBounds||x||y>=v||c.dragging)&&l.push(c)}return l},hf=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function mf(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function gf({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=mf(e,i),l=Et(a),c=co(l,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(c,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Fs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??o;let d=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",pe.error005());else{const g=a.measured.width,m=a.measured.height;g&&m&&(d=[[l,c],[l+g,c+m]])}else a&&nt(i.extent)&&(d=[[i.extent[0][0]+l,i.extent[0][1]+c],[i.extent[1][0]+l,i.extent[1][1]+c]]);const f=nt(d)?Be(t,d,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",pe.error015()),{position:{x:f.x-l+(i.measured.width??0)*u[0],y:f.y-c+(i.measured.height??0)*u[1]},positionAbsolute:f}}async function pf({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const s=new Set(e.map(f=>f.id)),i=[];for(const f of n){if(f.deletable===!1)continue;const g=s.has(f.id),m=!g&&f.parentId&&i.find(y=>y.id===f.parentId);(g||m)&&i.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),u=hf(i,l);for(const f of l)a.has(f.id)&&!u.find(m=>m.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:i};const d=await r({nodes:i,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:i}:{edges:[],nodes:[]}:d}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Be=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-(n?.width??0)),y:et(e.y,t[0][1],t[1][1]-(n?.height??0))});function Gs(e,t,n){const{width:o,height:r}=Ne(n),{x:s,y:i}=n.internals.positionAbsolute;return Be(e,[[s,i],[s+o,i+r]],t)}const Go=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,Xs=(e,t,n=15,o=40)=>{const r=Go(e.x,o,t.width-o)*n,s=Go(e.y,o,t.height-o)*n;return[r,s]},dn=(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)}),Vn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),fn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),tt=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Ut=(e,t=[0,0])=>{const{x:n,y:o}=io(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Ys=(e,t)=>fn(dn(Vn(e),Vn(t))),vt=(e,t)=>{const n=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(n*o)},Xo=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),yf=(e,t)=>{},Ct=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Mt=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return s?Ct(a,i):a},Qt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Xe(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function xf(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Xe(e,n),r=Xe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Xe(e.top??e.y??0,n),r=Xe(e.bottom??e.y??0,n),s=Xe(e.left??e.x??0,t),i=Xe(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vf(e,t,n,o,r,s){const{x:i,y:a}=Qt(e,[t,n,o]),{x:l,y:c}=Qt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=s-c;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const co=(e,t,n,o,r,s)=>{const i=xf(s,t,n),a=(t-i.x)/e.width,l=(n-i.y)/e.height,c=Math.min(a,l),u=et(c,o,r),d=e.x+e.width/2,f=e.y+e.height/2,g=t/2-d*u,m=n/2-f*u,y=vf(e,g,m,u,t,n),v={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:g-v.left+v.right,y:m-v.top+v.bottom,zoom:u}},wt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function nt(e){return e!=null&&e!=="parent"}function Ne(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function qs(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Ws(e,t={width:0,height:0},n,o,r){const s={...e},i=o.get(n);if(i){const a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function Yo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function wf(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function bf(e){return{...Rs,...e||{}}}function ht(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:s,y:i}=he(e),a=Mt({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:l,y:c}=n?Ct(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const lo=e=>({width:e.offsetWidth,height:e.offsetHeight}),Zs=e=>e?.getRootNode?.()||window?.document,_f=["INPUT","SELECT","TEXTAREA"];function Ks(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:_f.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Us=e=>"clientX"in e,he=(e,t)=>{const n=Us(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},qo=(e,t,n,o,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...lo(i)}})};function Qs({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=e*.125+r*.375+i*.375+n*.125,c=t*.125+s*.375+a*.375+o*.125,u=Math.abs(l-e),d=Math.abs(c-t);return[l,c,u,d]}function Tt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Wo({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case G.Left:return[t-Tt(t-o,s),n];case G.Right:return[t+Tt(o-t,s),n];case G.Top:return[t,n-Tt(n-r,s)];case G.Bottom:return[t,n+Tt(r-n,s)]}}function Js({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:s=G.Top,curvature:i=.25}){const[a,l]=Wo({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[c,u]=Wo({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[d,f,g,m]=Qs({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,d,f,g,m]}function ei({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Sf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const i=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+a}function Nf({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const s=dn(Ut(e),Ut(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return vt(i,fn(s))>0}const Ef=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Cf=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Mf=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Ef;let r;return Bs(e)?r={...e}:r={...e,id:o(e)},Cf(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function ti({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,s,i,a]=ei({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}const Zo={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},If=({source:e,sourcePosition:t=G.Bottom,target:n})=>t===G.Left||t===G.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Ko=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function kf({source:e,sourcePosition:t=G.Bottom,target:n,targetPosition:o=G.Top,center:r,offset:s,stepPosition:i}){const a=Zo[t],l=Zo[o],c={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+l.x*s,y:n.y+l.y*s},d=If({source:c,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",g=d[f];let m=[],y,v;const x={x:0,y:0},_={x:0,y:0},[,,p,w]=ei({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(y=r.x??c.x+(u.x-c.x)*i,v=r.y??(c.y+u.y)/2):(y=r.x??(c.x+u.x)/2,v=r.y??c.y+(u.y-c.y)*i);const S=[{x:y,y:c.y},{x:y,y:u.y}],N=[{x:c.x,y:v},{x:u.x,y:v}];a[f]===g?m=f==="x"?S:N:m=f==="x"?N:S}else{const S=[{x:c.x,y:u.y}],N=[{x:u.x,y:c.y}];if(f==="x"?m=a.x===g?N:S:m=a.y===g?S:N,t===o){const L=Math.abs(e[f]-n[f]);if(L<=s){const $=Math.min(s-1,s-L);a[f]===g?x[f]=(c[f]>e[f]?-1:1)*$:_[f]=(u[f]>n[f]?-1:1)*$}}if(t!==o){const L=f==="x"?"y":"x",$=a[f]===l[L],b=c[L]>u[L],k=c[L]<u[L];(a[f]===1&&(!$&&b||$&&k)||a[f]!==1&&(!$&&k||$&&b))&&(m=f==="x"?S:N)}const D={x:c.x+x.x,y:c.y+x.y},T={x:u.x+_.x,y:u.y+_.y},z=Math.max(Math.abs(D.x-m[0].x),Math.abs(T.x-m[0].x)),E=Math.max(Math.abs(D.y-m[0].y),Math.abs(T.y-m[0].y));z>=E?(y=(D.x+T.x)/2,v=m[0].y):(y=m[0].x,v=(D.y+T.y)/2)}return[[e,{x:c.x+x.x,y:c.y+x.y},...m,{x:u.x+_.x,y:u.y+_.y},n],y,v,p,w]}function Pf(e,t,n,o){const r=Math.min(Ko(e,t)/2,Ko(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+r*c},${i}Q ${s},${i} ${s},${i+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${s},${i+r*l}Q ${s},${i} ${s+r*a},${i}`}function Bn({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:s=G.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,g,m,y]=kf({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c,stepPosition:u});return[d.reduce((x,_,p)=>{let w="";return p>0&&p<d.length-1?w=Pf(d[p-1],_,d[p+1],i):w=`${p===0?"M":"L"}${_.x} ${_.y}`,x+=w,x},""),f,g,m,y]}function Uo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function jf(e){const{sourceNode:t,targetNode:n}=e;if(!Uo(t)||!Uo(n))return null;const o=t.internals.handleBounds||Qo(t.handles),r=n.internals.handleBounds||Qo(n.handles),s=Jo(o?.source??[],e.sourceHandle),i=Jo(e.connectionMode===Je.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",pe.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=s?.position||G.Bottom,l=i?.position||G.Top,c=Fe(t,s,a),u=Fe(n,i,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function Qo(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Fe(e,t,n=G.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??Ne(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case G.Top:return{x:r+i/2,y:s};case G.Right:return{x:r+i,y:s+a/2};case G.Bottom:return{x:r+i/2,y:s+a};case G.Left:return{x:r,y:s+a/2}}}function Jo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Fn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Tf(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=Fn(l,t);s.has(c)||(i.push({id:c,color:l.color||n,...l}),s.add(c))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const ni=1e3,Af=10,uo={nodeOrigin:[0,0],nodeExtent:yt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Df={...uo,checkEquality:!0};function fo(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Lf(e,t,n){const o=fo(uo,n);for(const r of e.values())if(r.parentId)mo(r,e,t,o);else{const s=Nt(r,o.nodeOrigin),i=nt(r.extent)?r.extent:o.nodeExtent,a=Be(s,i,Ne(r));r.internals.positionAbsolute=a}}function $f(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function ho(e){return e==="manual"}function Gn(e,t,n,o={}){const r=fo(Df,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!ho(r.zIndexMode)?ni:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=i.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const d=Nt(c,r.nodeOrigin),f=nt(c.extent)?c.extent:r.nodeExtent,g=Be(d,f,Ne(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:g,handleBounds:$f(c,u),z:oi(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&mo(u,t,n,o,s)}return l}function zf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function mo(e,t,n,o,r){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:l}=fo(uo,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}zf(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Af),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=s&&!ho(l)?ni:0,{x:f,y:g,z:m}=Of(e,u,i,a,d,l),{positionAbsolute:y}=e.internals,v=f!==y.x||g!==y.y;(v||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:f,y:g}:y,z:m}})}function oi(e,t,n){const o=fe(e.zIndex)?e.zIndex:0;return ho(n)?o:o+(e.selected?t:0)}function Of(e,t,n,o,r,s){const{x:i,y:a}=t.internals.positionAbsolute,l=Ne(e),c=Nt(e,n),u=nt(e.extent)?Be(c,e.extent,l):c;let d=Be({x:i+u.x,y:a+u.y},o,l);e.extent==="parent"&&(d=Gs(d,l,t));const f=oi(e,r,s),g=t.internals.z??0;return{x:d.x,y:d.y,z:g>=f?g+1:f}}function go(e,t,n,o=[0,0]){const r=[],s=new Map;for(const i of e){const a=t.get(i.parentId);if(!a)continue;const l=s.get(i.parentId)?.expandedRect??tt(a),c=Ys(l,i.rect);s.set(i.parentId,{expandedRect:c,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ne(a),d=a.origin??o,f=i.x<c.x?Math.round(Math.abs(c.x-i.x)):0,g=i.y<c.y?Math.round(Math.abs(c.y-i.y)):0,m=Math.max(u.width,Math.round(i.width)),y=Math.max(u.height,Math.round(i.height)),v=(m-u.width)*d[0],x=(y-u.height)*d[1];(f>0||g>0||v||x)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+v,y:a.position.y-g+x}}),n.get(l)?.forEach(_=>{e.some(p=>p.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+f,y:_.position.y+g}})})),(u.width<i.width||u.height<i.height||f||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:m+(f?d[0]*f-v:0),height:y+(g?d[1]*g-x:0)}})}),r}function Rf(e,t,n,o,r,s,i){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const g of e.values()){const m=t.get(g.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),l=!0;continue}const y=lo(g.nodeElement),v=m.measured.width!==y.width||m.measured.height!==y.height;if(!!(y.width&&y.height&&(v||!m.internals.handleBounds||g.force))){const _=g.nodeElement.getBoundingClientRect(),p=nt(m.extent)?m.extent:s;let{positionAbsolute:w}=m.internals;m.parentId&&m.extent==="parent"?w=Gs(w,y,t.get(m.parentId)):p&&(w=Be(w,p,y));const M={...m,measured:y,internals:{...m.internals,positionAbsolute:w,handleBounds:{source:qo("source",g.nodeElement,_,d,m.id),target:qo("target",g.nodeElement,_,d,m.id)}}};t.set(m.id,M),m.parentId&&mo(M,t,n,{nodeOrigin:r,zIndexMode:i}),l=!0,v&&(c.push({id:m.id,type:"dimensions",dimensions:y}),m.expandParent&&m.parentId&&f.push({id:m.id,parentId:m.parentId,rect:tt(M,r)}))}}if(f.length>0){const g=go(f,t,n,r);c.push(...g)}return{changes:c,updatedInternals:l}}async function Hf({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function er(e,t,n,o,r,s){let i=r;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;const l=o.get(i)||new Map;if(o.set(i,l.set(n,t)),s){i=`${r}-${e}-${s}`;const c=o.get(i)||new Map;o.set(i,c.set(n,t))}}function ri(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},c=`${r}-${i}--${s}-${a}`,u=`${s}-${a}--${r}-${i}`;er("source",l,u,e,r,i),er("target",l,c,e,s,a),t.set(o.id,o)}}function si(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:si(n,t):!1}function tr(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Vf(e,t,n,o){const r=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!si(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&r.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function En({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[i,a]of t){const l=n.get(i)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function Bf({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:o-r.distance.y},i=Ct(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Ff({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,g=!1,m=!1,y=null;function v({noDragClassName:_,handleSelector:p,domNode:w,isSelectable:M,nodeId:S,nodeClickDistance:N=0}){f=ce(w);function D({x:L,y:$}){const{nodeLookup:b,nodeExtent:k,snapGrid:I,snapToGrid:A,nodeOrigin:P,onNodeDrag:j,onSelectionDrag:O,onError:H,updateNodePositions:R}=t();s={x:L,y:$};let F=!1;const B=a.size>1,q=B&&k?Vn(Et(a)):null,K=B&&A?Bf({dragItems:a,snapGrid:I,x:L,y:$}):null;for(const[Y,V]of a){if(!b.has(Y))continue;let X={x:L-V.distance.x,y:$-V.distance.y};A&&(X=K?{x:Math.round(X.x+K.x),y:Math.round(X.y+K.y)}:Ct(X,I));let Q=null;if(B&&k&&!V.extent&&q){const{positionAbsolute:Z}=V.internals,ee=Z.x-q.x+k[0][0],ne=Z.x+V.measured.width-q.x2+k[1][0],te=Z.y-q.y+k[0][1],ae=Z.y+V.measured.height-q.y2+k[1][1];Q=[[ee,te],[ne,ae]]}const{position:U,positionAbsolute:W}=Fs({nodeId:Y,nextPosition:X,nodeLookup:b,nodeExtent:Q||k,nodeOrigin:P,onError:H});F=F||V.position.x!==U.x||V.position.y!==U.y,V.position=U,V.internals.positionAbsolute=W}if(m=m||F,!!F&&(R(a,!0),y&&(o||j||!S&&O))){const[Y,V]=En({nodeId:S,dragItems:a,nodeLookup:b});o?.(y,a,Y,V),j?.(y,Y,V),S||O?.(y,V)}}async function T(){if(!u)return;const{transform:L,panBy:$,autoPanSpeed:b,autoPanOnNodeDrag:k}=t();if(!k){l=!1,cancelAnimationFrame(i);return}const[I,A]=Xs(c,u,b);(I!==0||A!==0)&&(s.x=(s.x??0)-I/L[2],s.y=(s.y??0)-A/L[2],await $({x:I,y:A})&&D(s)),i=requestAnimationFrame(T)}function z(L){const{nodeLookup:$,multiSelectionActive:b,nodesDraggable:k,transform:I,snapGrid:A,snapToGrid:P,selectNodesOnDrag:j,onNodeDragStart:O,onSelectionDragStart:H,unselectNodesAndEdges:R}=t();d=!0,(!j||!M)&&!b&&S&&($.get(S)?.selected||R()),M&&j&&S&&e?.(S);const F=ht(L.sourceEvent,{transform:I,snapGrid:A,snapToGrid:P,containerBounds:u});if(s=F,a=Vf($,k,F,S),a.size>0&&(n||O||!S&&H)){const[B,q]=En({nodeId:S,dragItems:a,nodeLookup:$});n?.(L.sourceEvent,a,B,q),O?.(L.sourceEvent,B,q),S||H?.(L.sourceEvent,q)}}const E=Cs().clickDistance(N).on("start",L=>{const{domNode:$,nodeDragThreshold:b,transform:k,snapGrid:I,snapToGrid:A}=t();u=$?.getBoundingClientRect()||null,g=!1,m=!1,y=L.sourceEvent,b===0&&z(L),s=ht(L.sourceEvent,{transform:k,snapGrid:I,snapToGrid:A,containerBounds:u}),c=he(L.sourceEvent,u)}).on("drag",L=>{const{autoPanOnNodeDrag:$,transform:b,snapGrid:k,snapToGrid:I,nodeDragThreshold:A,nodeLookup:P}=t(),j=ht(L.sourceEvent,{transform:b,snapGrid:k,snapToGrid:I,containerBounds:u});if(y=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||S&&!P.has(S))&&(g=!0),!g){if(!l&&$&&d&&(l=!0,T()),!d){const O=he(L.sourceEvent,u),H=O.x-c.x,R=O.y-c.y;Math.sqrt(H*H+R*R)>A&&z(L)}(s.x!==j.xSnapped||s.y!==j.ySnapped)&&a&&d&&(c=he(L.sourceEvent,u),D(j))}}).on("end",L=>{if(!(!d||g)&&(l=!1,d=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:$,updateNodePositions:b,onNodeDragStop:k,onSelectionDragStop:I}=t();if(m&&(b(a,!1),m=!1),r||k||!S&&I){const[A,P]=En({nodeId:S,dragItems:a,nodeLookup:$,dragging:!1});r?.(L.sourceEvent,a,A,P),k?.(L.sourceEvent,A,P),S||I?.(L.sourceEvent,P)}}}).filter(L=>{const $=L.target;return!L.button&&(!_||!tr($,`.${_}`,w))&&(!p||tr($,p,w))});f.call(E)}function x(){f?.on(".drag",null)}return{update:v,destroy:x}}function Gf(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())vt(r,tt(s))>0&&o.push(s);return o}const Xf=250;function Yf(e,t,n,o){let r=[],s=1/0;const i=Gf(e,n,t+Xf);for(const a of i){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:d}=Fe(a,c,c.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<s?(r=[{...c,x:u,y:d}],s=f):f===s&&r.push({...c,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function ii(e,t,n,o,r,s=!1){const i=o.get(e);if(!i)return null;const a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&s?{...l,...Fe(i,l,l.position,!0)}:l}function ai(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function qf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const ci=()=>!0;function Wf(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:g,onConnectStart:m,onConnect:y,onConnectEnd:v,isValidConnection:x=ci,onReconnectEnd:_,updateConnection:p,getTransform:w,getFromHandle:M,autoPanSpeed:S,dragThreshold:N=1,handleDomNode:D}){const T=Zs(e.target);let z=0,E;const{x:L,y:$}=he(e),b=ai(s,D),k=a?.getBoundingClientRect();let I=!1;if(!k||!b)return;const A=ii(r,b,o,l,t);if(!A)return;let P=he(e,k),j=!1,O=null,H=!1,R=null;function F(){if(!u||!k)return;const[U,W]=Xs(P,k,S);f({x:U,y:W}),z=requestAnimationFrame(F)}const B={...A,nodeId:r,type:b,position:A.position},q=l.get(r);let Y={inProgress:!0,isValid:null,from:Fe(q,B,G.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:q,to:P,toHandle:null,toPosition:Fo[B.position],toNode:null,pointer:P};function V(){I=!0,p(Y),m?.(e,{nodeId:r,handleId:o,handleType:b})}N===0&&V();function X(U){if(!I){const{x:ae,y:Ee}=he(U),ve=ae-L,$e=Ee-$;if(!(ve*ve+$e*$e>N*N))return;V()}if(!M()||!B){Q(U);return}const W=w();P=he(U,k),E=Yf(Mt(P,W,!1,[1,1]),n,l,B),j||(F(),j=!0);const Z=li(U,{handle:E,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:x,doc:T,lib:c,flowId:d,nodeLookup:l});R=Z.handleDomNode,O=Z.connection,H=qf(!!E,Z.isValid);const ee=l.get(r),ne=ee?Fe(ee,B,G.Left,!0):Y.from,te={...Y,from:ne,isValid:H,to:Z.toHandle&&H?Qt({x:Z.toHandle.x,y:Z.toHandle.y},W):P,toHandle:Z.toHandle,toPosition:H&&Z.toHandle?Z.toHandle.position:Fo[B.position],toNode:Z.toHandle?l.get(Z.toHandle.nodeId):null,pointer:P};p(te),Y=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(I){(E||R)&&O&&H&&y?.(O);const{inProgress:W,...Z}=Y,ee={...Z,toPosition:Y.toHandle?Y.toPosition:null};v?.(U,ee),s&&_?.(U,ee)}g(),cancelAnimationFrame(z),j=!1,H=!1,O=null,R=null,T.removeEventListener("mousemove",X),T.removeEventListener("mouseup",Q),T.removeEventListener("touchmove",X),T.removeEventListener("touchend",Q)}}T.addEventListener("mousemove",X),T.addEventListener("mouseup",Q),T.addEventListener("touchmove",X),T.addEventListener("touchend",Q)}function li(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:l,isValidConnection:c=ci,nodeLookup:u}){const d=s==="target",f=t?i.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:m}=he(e),y=i.elementFromPoint(g,m),v=y?.classList.contains(`${a}-flow__handle`)?y:f,x={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const _=ai(void 0,v),p=v.getAttribute("data-nodeid"),w=v.getAttribute("data-handleid"),M=v.classList.contains("connectable"),S=v.classList.contains("connectableend");if(!p||!_)return x;const N={source:d?p:o,sourceHandle:d?w:r,target:d?o:p,targetHandle:d?r:w};x.connection=N;const T=M&&S&&(n===Je.Strict?d&&_==="source"||!d&&_==="target":p!==o||w!==r);x.isValid=T&&c(N),x.toHandle=ii(p,_,w,u,n,!0)}return x}const Xn={onPointerDown:Wf,isValid:li};function Zf({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function s({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:g=!1}){const m=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),M=p.sourceEvent.ctrlKey&&wt()?10:1,S=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*u,N=w[2]*Math.pow(2,S*M);t.scaleTo(N)};let y=[0,0];const v=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(y=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},x=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const M=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],S=[M[0]-y[0],M[1]-y[1]];y=M;const N=o()*Math.max(w[2],Math.log(w[2]))*(g?-1:1),D={x:w[0]-S[0]*N,y:w[1]-S[1]*N},T=[[0,0],[l,c]];t.setViewportConstrained({x:D.x,y:D.y,zoom:w[2]},T,a)},_=zs().on("start",v).on("zoom",d?x:null).on("zoom.wheel",f?m:null);r.call(_,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:de}}const hn=e=>({x:e.x,y:e.y,zoom:e.k}),Cn=({x:e,y:t,zoom:n})=>un.translate(e,t).scale(n),qe=(e,t)=>e.target.closest(`.${t}`),ui=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Kf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Mn=(e,t=0,n=Kf,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},di=e=>{const t=e.ctrlKey&&wt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Uf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(qe(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&i){const v=de(u),x=di(u),_=d*Math.pow(2,x);o.scaleTo(n,_,v,u);return}const f=u.deltaMode===1?20:1;let g=r===Re.Vertical?0:u.deltaX*f,m=r===Re.Horizontal?0:u.deltaY*f;!wt()&&u.shiftKey&&r!==Re.Vertical&&(g=u.deltaY*f,m=0),o.translateBy(n,-(g/d)*s,-(m/d)*s,{internal:!0});const y=hn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,y),e.panScrollTimeout=setTimeout(()=>{c?.(u,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,y))}}function Qf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=qe(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function Jf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=hn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function eh({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&ui(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,hn(s.transform))}}function th({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&ui(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=hn(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function nh({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return d=>{const f=e||t,g=n&&d.ctrlKey,m=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(qe(d,`${c}-flow__node`)||qe(d,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!s&&!n||i||u&&!m||qe(d,a)&&m||qe(d,l)&&(!m||r&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!g&&m||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const y=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&y}}function oh({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=zs().scaleExtent([t,n]).translateExtent(o),f=ce(e).call(d);_({x:r.x,y:r.y,zoom:et(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const g=f.on("wheel.zoom"),m=f.on("dblclick.zoom");d.wheelDelta(di);function y(E,L){return f?new Promise($=>{d?.interpolate(L?.interpolate==="linear"?bn:Ot).transform(Mn(f,L?.duration,L?.ease,()=>$(!0)),E)}):Promise.resolve(!1)}function v({noWheelClassName:E,noPanClassName:L,onPaneContextMenu:$,userSelectionActive:b,panOnScroll:k,panOnDrag:I,panOnScrollMode:A,panOnScrollSpeed:P,preventScrolling:j,zoomOnPinch:O,zoomOnScroll:H,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:q,connectionInProgress:K,paneClickDistance:Y,selectionOnDrag:V}){b&&!c.isZoomingOrPanning&&x();const X=k&&!F&&!b;d.clickDistance(V?1/0:!fe(Y)||Y<0?0:Y);const Q=X?Uf({zoomPanValues:c,noWheelClassName:E,d3Selection:f,d3Zoom:d,panOnScrollMode:A,panOnScrollSpeed:P,zoomOnPinch:O,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):Qf({noWheelClassName:E,preventScrolling:j,d3ZoomHandler:g});if(f.on("wheel.zoom",Q,{passive:!1}),!b){const W=Jf({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:i});d.on("start",W);const Z=eh({zoomPanValues:c,panOnDrag:I,onPaneContextMenu:!!$,onPanZoom:s,onTransformChange:q});d.on("zoom",Z);const ee=th({zoomPanValues:c,panOnDrag:I,panOnScroll:k,onPaneContextMenu:$,onPanZoomEnd:a,onDraggingChange:l});d.on("end",ee)}const U=nh({zoomActivationKeyPressed:F,panOnDrag:I,zoomOnScroll:H,panOnScroll:k,zoomOnDoubleClick:R,zoomOnPinch:O,userSelectionActive:b,noPanClassName:L,noWheelClassName:E,lib:B,connectionInProgress:K});d.filter(U),R?f.on("dblclick.zoom",m):f.on("dblclick.zoom",null)}function x(){d.on("zoom",null)}async function _(E,L,$){const b=Cn(E),k=d?.constrain()(b,L,$);return k&&await y(k),new Promise(I=>I(k))}async function p(E,L){const $=Cn(E);return await y($,L),new Promise(b=>b($))}function w(E){if(f){const L=Cn(E),$=f.property("__zoom");($.k!==E.zoom||$.x!==E.x||$.y!==E.y)&&d?.transform(f,L,null,{sync:!0})}}function M(){const E=f?$s(f.node()):{x:0,y:0,k:1};return{x:E.x,y:E.y,zoom:E.k}}function S(E,L){return f?new Promise($=>{d?.interpolate(L?.interpolate==="linear"?bn:Ot).scaleTo(Mn(f,L?.duration,L?.ease,()=>$(!0)),E)}):Promise.resolve(!1)}function N(E,L){return f?new Promise($=>{d?.interpolate(L?.interpolate==="linear"?bn:Ot).scaleBy(Mn(f,L?.duration,L?.ease,()=>$(!0)),E)}):Promise.resolve(!1)}function D(E){d?.scaleExtent(E)}function T(E){d?.translateExtent(E)}function z(E){const L=!fe(E)||E<0?0:E;d?.clickDistance(L)}return{update:v,destroy:x,setViewport:p,setViewportConstrained:_,getViewport:M,scaleTo:S,scaleBy:N,setScaleExtent:D,setTranslateExtent:T,syncViewport:w,setClickDistance:z}}var ot;(function(e){e.Line="line",e.Handle="handle"})(ot||(ot={}));function rh({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){const i=e-t,a=n-o,l=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(l[0]=l[0]*-1),a&&s&&(l[1]=l[1]*-1),l}function nr(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ce(e,t){return Math.max(0,t-e)}function Me(e,t){return Math.max(0,e-t)}function At(e,t,n){return Math.max(0,t-e,e-n)}function or(e,t){return e?!t:t}function sh(e,t,n,o,r,s,i,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:g,ySnapped:m}=n,{minWidth:y,maxWidth:v,minHeight:x,maxHeight:_}=o,{x:p,y:w,width:M,height:S,aspectRatio:N}=e;let D=Math.floor(u?g-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0);const z=M+(l?-D:D),E=S+(c?-T:T),L=-s[0]*M,$=-s[1]*S;let b=At(z,y,v),k=At(E,x,_);if(i){let P=0,j=0;l&&D<0?P=Ce(p+D+L,i[0][0]):!l&&D>0&&(P=Me(p+z+L,i[1][0])),c&&T<0?j=Ce(w+T+$,i[0][1]):!c&&T>0&&(j=Me(w+E+$,i[1][1])),b=Math.max(b,P),k=Math.max(k,j)}if(a){let P=0,j=0;l&&D>0?P=Me(p+D,a[0][0]):!l&&D<0&&(P=Ce(p+z,a[1][0])),c&&T>0?j=Me(w+T,a[0][1]):!c&&T<0&&(j=Ce(w+E,a[1][1])),b=Math.max(b,P),k=Math.max(k,j)}if(r){if(u){const P=At(z/N,x,_)*N;if(b=Math.max(b,P),i){let j=0;!l&&!c||l&&!c&&f?j=Me(w+$+z/N,i[1][1])*N:j=Ce(w+$+(l?D:-D)/N,i[0][1])*N,b=Math.max(b,j)}if(a){let j=0;!l&&!c||l&&!c&&f?j=Ce(w+z/N,a[1][1])*N:j=Me(w+(l?D:-D)/N,a[0][1])*N,b=Math.max(b,j)}}if(d){const P=At(E*N,y,v)/N;if(k=Math.max(k,P),i){let j=0;!l&&!c||c&&!l&&f?j=Me(p+E*N+L,i[1][0])/N:j=Ce(p+(c?T:-T)*N+L,i[0][0])/N,k=Math.max(k,j)}if(a){let j=0;!l&&!c||c&&!l&&f?j=Ce(p+E*N,a[1][0])/N:j=Me(p+(c?T:-T)*N,a[0][0])/N,k=Math.max(k,j)}}}T=T+(T<0?k:-k),D=D+(D<0?b:-b),r&&(f?z>E*N?T=(or(l,c)?-D:D)/N:D=(or(l,c)?-T:T)*N:u?(T=D/N,c=l):(D=T*N,l=c));const I=l?p+D:p,A=c?w+T:w;return{width:M+(l?-D:D),height:S+(c?-T:T),x:s[0]*D*(l?-1:1)+I,y:s[1]*T*(c?-1:1)+A}}const fi={width:0,height:0,x:0,y:0},ih={...fi,pointerX:0,pointerY:0,aspectRatio:1};function ah(e){return[[0,0],[e.measured.width,e.measured.height]]}function ch(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,l=n[1]*i;return[[o-a,r-l],[o+s-a,r+i-l]]}function lh({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const s=ce(e);let i={controlDirection:nr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:g,onResize:m,onResizeEnd:y,shouldResize:v}){let x={...fi},_={...ih};i={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:nr(c)};let p,w=null,M=[],S,N,D,T=!1;const z=Cs().on("start",E=>{const{nodeLookup:L,transform:$,snapGrid:b,snapToGrid:k,nodeOrigin:I,paneDomNode:A}=n();if(p=L.get(t),!p)return;w=A?.getBoundingClientRect()??null;const{xSnapped:P,ySnapped:j}=ht(E.sourceEvent,{transform:$,snapGrid:b,snapToGrid:k,containerBounds:w});x={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},_={...x,pointerX:P,pointerY:j,aspectRatio:x.width/x.height},S=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(S=L.get(p.parentId),N=S&&p.extent==="parent"?ah(S):void 0),M=[],D=void 0;for(const[O,H]of L)if(H.parentId===t&&(M.push({id:O,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const R=ch(H,p,H.origin??I);D?D=[[Math.min(R[0][0],D[0][0]),Math.min(R[0][1],D[0][1])],[Math.max(R[1][0],D[1][0]),Math.max(R[1][1],D[1][1])]]:D=R}g?.(E,{...x})}).on("drag",E=>{const{transform:L,snapGrid:$,snapToGrid:b,nodeOrigin:k}=n(),I=ht(E.sourceEvent,{transform:L,snapGrid:$,snapToGrid:b,containerBounds:w}),A=[];if(!p)return;const{x:P,y:j,width:O,height:H}=x,R={},F=p.origin??k,{width:B,height:q,x:K,y:Y}=sh(_,i.controlDirection,I,i.boundaries,i.keepAspectRatio,F,N,D),V=B!==O,X=q!==H,Q=K!==P&&V,U=Y!==j&&X;if(!Q&&!U&&!V&&!X)return;if((Q||U||F[0]===1||F[1]===1)&&(R.x=Q?K:x.x,R.y=U?Y:x.y,x.x=R.x,x.y=R.y,M.length>0)){const ne=K-P,te=Y-j;for(const ae of M)ae.position={x:ae.position.x-ne+F[0]*(B-O),y:ae.position.y-te+F[1]*(q-H)},A.push(ae)}if((V||X)&&(R.width=V&&(!i.resizeDirection||i.resizeDirection==="horizontal")?B:x.width,R.height=X&&(!i.resizeDirection||i.resizeDirection==="vertical")?q:x.height,x.width=R.width,x.height=R.height),S&&p.expandParent){const ne=F[0]*(R.width??0);R.x&&R.x<ne&&(x.x=ne,_.x=_.x-(R.x-ne));const te=F[1]*(R.height??0);R.y&&R.y<te&&(x.y=te,_.y=_.y-(R.y-te))}const W=rh({width:x.width,prevWidth:O,height:x.height,prevHeight:H,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),Z={...x,direction:W};v?.(E,Z)!==!1&&(T=!0,m?.(E,Z),o(R,A))}).on("end",E=>{T&&(y?.(E,{...x}),r?.({...x}),T=!1)});s.call(z)}function l(){s.on(".drag",null)}return{update:a,destroy:l}}const uh={},rr=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const g=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,g))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(uh?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(o,r,l);return l},dh=e=>e?rr(e):rr,{useDebugValue:fh}=ue,{useSyncExternalStoreWithSelector:hh}=uc,mh=e=>e;function hi(e,t=mh,n){const o=hh(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return fh(o),o}const sr=(e,t)=>{const n=dh(e),o=(r,s=t)=>hi(n,r,s);return Object.assign(o,n),o},gh=(e,t)=>e?sr(e,t):sr;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const mn=C.createContext(null),ph=mn.Provider,mi=pe.error001();function J(e,t){const n=C.useContext(mn);if(n===null)throw new Error(mi);return hi(n,e,t)}function re(){const e=C.useContext(mn);if(e===null)throw new Error(mi);return C.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ir={display:"none"},yh={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},gi="react-flow__node-desc",pi="react-flow__edge-desc",xh="react-flow__aria-live",vh=e=>e.ariaLiveMessage,wh=e=>e.ariaLabelConfig;function bh({rfId:e}){const t=J(vh);return h.jsx("div",{id:`${xh}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:yh,children:t})}function _h({rfId:e,disableKeyboardA11y:t}){const n=J(wh);return h.jsxs(h.Fragment,{children:[h.jsx("div",{id:`${gi}-${e}`,style:ir,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),h.jsx("div",{id:`${pi}-${e}`,style:ir,children:n["edge.a11yDescription.default"]}),!t&&h.jsx(bh,{rfId:e})]})}const gn=C.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{const i=`${e}`.split("-");return h.jsx("div",{className:ie(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});gn.displayName="Panel";function Sh({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:h.jsx(gn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:h.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Nh=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Dt=e=>e.id;function Eh(e,t){return oe(e.selectedNodes.map(Dt),t.selectedNodes.map(Dt))&&oe(e.selectedEdges.map(Dt),t.selectedEdges.map(Dt))}function Ch({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(Nh,Eh);return C.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}const Mh=e=>!!e.onSelectionChangeHandlers;function Ih({onSelectionChange:e}){const t=J(Mh);return e||t?h.jsx(Ch,{onSelectionChange:e}):null}const yi=[0,0],kh={x:0,y:0,zoom:1},Ph=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],ar=[...Ph,"rfId"],jh=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),cr={translateExtent:yt,nodeOrigin:yi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Th(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:l}=J(jh,oe),c=re();C.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=cr,a()}),[]);const u=C.useRef(cr);return C.useEffect(()=>{for(const d of ar){const f=e[d],g=u.current[d];f!==g&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?s(f):d==="nodeExtent"?i(f):d==="ariaLabelConfig"?c.setState({ariaLabelConfig:bf(f)}):d==="fitView"?c.setState({fitViewQueued:f}):d==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[d]:f})))}u.current=e},ar.map(d=>e[d])),null}function lr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Ah(e){const[t,n]=C.useState(e==="system"?null:e);return C.useEffect(()=>{if(e!=="system"){n(e);return}const o=lr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:lr()?.matches?"dark":"light"}const ur=typeof document<"u"?document:null;function bt(e=null,t={target:ur,actInsideInputWithModifier:!0}){const[n,o]=C.useState(!1),r=C.useRef(!1),s=C.useRef(new Set([])),[i,a]=C.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`
@@ -18,4 +18,4 @@ import{r as C,z as Wn,j as h,B as Tn,E as rc,F as ue,H as sc,I as Or,J as ic,L a
18
18
  stroke-dashoffset: -14;
19
19
  }
20
20
  }
21
- `}),t[30]=z):z=t[30];let E;t[31]!==o||t[32]!==n?(E=n&&h.jsx("div",{className:"absolute top-4 right-4 z-10",children:h.jsx(zg,{value:o,onChange:r})}),t[31]=o,t[32]=n,t[33]=E):E=t[33];let L;t[34]===Symbol.for("react.memo_cache_sentinel")?(L={padding:.3},t[34]=L):L=t[34];let $;t[35]===Symbol.for("react.memo_cache_sentinel")?($={hideAttribution:!0},t[35]=$):$=t[35];let b;t[36]!==S||t[37]!==N?(b=h.jsx(rg,{nodes:N,edges:S,nodeTypes:$g,fitView:!0,fitViewOptions:L,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnDrag:!0,preventScrolling:!0,proOptions:$,className:"bg-transparent"}),t[36]=S,t[37]=N,t[38]=b):b=t[38];let k;return t[39]!==E||t[40]!==b?(k=h.jsxs("div",{className:"w-full h-full min-h-[420px] relative mesh-minimap bg-background",style:T,children:[z,E,b]}),t[39]=E,t[40]=b,t[41]=k):k=t[41],k}function Rg(e,t){return e.id.localeCompare(t.id)}function Hg(e,t){return e.id.localeCompare(t.id)}function Vg(){const e=se.c(3);let t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=h.jsx("div",{className:"flex flex-col gap-3",children:[1,2,3,4,5].map(Fg)}),n=h.jsx("div",{className:"h-14 w-28 bg-muted animate-pulse rounded-xl"}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx("div",{className:"bg-background p-5 h-full min-h-[420px] flex items-center justify-center",children:h.jsxs("div",{className:"flex items-center gap-16",children:[t,n,h.jsx("div",{className:"flex flex-col gap-3",children:[1,2,3,4,5].map(Bg)})]})}),e[2]=o):o=e[2],o}function Bg(e){return h.jsx("div",{className:"h-14 w-[220px] bg-muted animate-pulse rounded-lg"},e)}function Fg(e){return h.jsx("div",{className:"h-14 w-[220px] bg-muted animate-pulse rounded-lg"},e)}function qn(){return qn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},qn.apply(null,arguments)}var qi=e=>{var{cx:t,cy:n,r:o,className:r}=e,s=Zn("recharts-dot",r);return _n(t)&&_n(n)&&_n(o)?C.createElement("circle",qn({},Fr(e),Br(e),{className:s,cx:t,cy:n,r:o})):null},Gg=["points"];function kr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,o)}return n}function Pn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kr(Object(n),!0).forEach(function(o){Xg(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kr(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Xg(e,t,n){return(t=Yg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yg(e){var t=qg(e,"string");return typeof t=="symbol"?t:t+""}function qg(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tn(){return tn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},tn.apply(null,arguments)}function Wg(e,t){if(e==null)return{};var n,o,r=Zg(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)n=s[o],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Zg(e,t){if(e==null)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.indexOf(o)!==-1)continue;n[o]=e[o]}return n}function Kg(e){var{option:t,dotProps:n,className:o}=e;if(C.isValidElement(t))return C.cloneElement(t,n);if(typeof t=="function")return t(n);var r=Zn(o,typeof t!="boolean"?t.className:""),s=n??{},{points:i}=s,a=Wg(s,Gg);return C.createElement(qi,tn({},a,{className:r}))}function Ug(e,t){return e==null?!1:t?!0:e.length===1}function Qg(e){var{points:t,dot:n,className:o,dotClassName:r,dataKey:s,baseProps:i,needClip:a,clipPathId:l,zIndex:c=Kn.scatter}=e;if(!Ug(t,n))return null;var u=Gr(n),d=pc(n),f=t.map((m,y)=>{var v,x,_=Pn(Pn(Pn({r:3},i),d),{},{index:y,cx:(v=m.x)!==null&&v!==void 0?v:void 0,cy:(x=m.y)!==null&&x!==void 0?x:void 0,dataKey:s,value:m.value,payload:m.payload,points:t});return C.createElement(Kg,{key:"dot-".concat(y),option:n,dotProps:_,className:r})}),g={};return a&&l!=null&&(g.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(l,")")),C.createElement(Un,{zIndex:c},C.createElement(Qn,tn({className:o},g),f))}function Pr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,o)}return n}function jn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pr(Object(n),!0).forEach(function(o){Jg(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pr(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Jg(e,t,n){return(t=ep(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ep(e){var t=tp(e,"string");return typeof t=="symbol"?t:t+""}function tp(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var np=e=>{var{point:t,childIndex:n,mainColor:o,activeDot:r,dataKey:s,clipPath:i}=e;if(r===!1||t.x==null||t.y==null)return null;var a={index:n,dataKey:s,cx:t.x,cy:t.y,r:4,fill:o??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},l=jn(jn(jn({},a),Yr(r)),Br(r)),c;return C.isValidElement(r)?c=C.cloneElement(r,l):typeof r=="function"?c=r(l):c=C.createElement(qi,l),C.createElement(Qn,{className:"recharts-active-dot",clipPath:i},c)};function op(e){var{points:t,mainColor:n,activeDot:o,itemDataKey:r,clipPath:s,zIndex:i=Kn.activeDot}=e,a=Xr(yc),l=xc();if(t==null||l==null)return null;var c=t.find(u=>l.includes(u.payload));return Dn(c)?null:C.createElement(Un,{zIndex:i},C.createElement(np,{point:c,childIndex:Number(a),mainColor:n,dataKey:r,activeDot:o,clipPath:s}))}var Wi=(e,t,n,o)=>Wr(e,"xAxis",t,o),Zi=(e,t,n,o)=>Zr(e,"xAxis",t,o),Ki=(e,t,n,o)=>Wr(e,"yAxis",n,o),Ui=(e,t,n,o)=>Zr(e,"yAxis",n,o),rp=Jn([qr,Wi,Ki,Zi,Ui],(e,t,n,o,r)=>bc(e,"xAxis")?jo(t,o,!1):jo(n,r,!1)),sp=(e,t,n,o,r)=>r;function ip(e){return e.type==="line"}var ap=Jn([wc,sp],(e,t)=>e.filter(ip).find(n=>n.id===t)),cp=Jn([qr,Wi,Ki,Zi,Ui,ap,rp,vc],(e,t,n,o,r,s,i,a)=>{var{chartData:l,dataStartIndex:c,dataEndIndex:u}=a;if(!(s==null||t==null||n==null||o==null||r==null||o.length===0||r.length===0||i==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:d,data:f}=s,g;if(f!=null&&f.length>0?g=f:g=l?.slice(c,u+1),g!=null)return kp({layout:e,xAxis:t,yAxis:n,xAxisTicks:o,yAxisTicks:r,dataKey:d,bandSize:i,displayedData:g})}});function lp(e){var t=Yr(e),n=3,o=2;if(t!=null){var{r,strokeWidth:s}=t,i=Number(r),a=Number(s);return(Number.isNaN(i)||i<0)&&(i=n),(Number.isNaN(a)||a<0)&&(a=o),{r:i,strokeWidth:a}}return{r:n,strokeWidth:o}}var up=["id"],dp=["type","layout","connectNulls","needClip","shape"],fp=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function _t(){return _t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},_t.apply(null,arguments)}function jr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,o)}return n}function ge(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jr(Object(n),!0).forEach(function(o){hp(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jr(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function hp(e,t,n){return(t=mp(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mp(e){var t=gp(e,"string");return typeof t=="symbol"?t:t+""}function gp(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vo(e,t){if(e==null)return{};var n,o,r=pp(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)n=s[o],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function pp(e,t){if(e==null)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.indexOf(o)!==-1)continue;n[o]=e[o]}return n}var yp=e=>{var{dataKey:t,name:n,stroke:o,legendType:r,hide:s}=e;return[{inactive:s,dataKey:t,type:r,color:o,value:Qr(n,t),payload:e}]},xp=C.memo(e=>{var{dataKey:t,data:n,stroke:o,strokeWidth:r,fill:s,name:i,hide:a,unit:l,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:o,strokeWidth:r,fill:s,dataKey:t,nameKey:void 0,name:Qr(i,t),hide:a,type:c,color:o,unit:l,graphicalItemId:u}};return C.createElement(Cc,{tooltipEntrySettings:d})}),Qi=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function vp(e,t){for(var n=e.length%2!==0?[...e,0]:e,o=[],r=0;r<t;++r)o=[...o,...n];return o}var wp=(e,t,n)=>{var o=n.reduce((d,f)=>d+f);if(!o)return Qi(t,e);for(var r=Math.floor(e/o),s=e%o,i=t-e,a=[],l=0,c=0;l<n.length;c+=n[l],++l)if(c+n[l]>s){a=[...n.slice(0,l),s-c];break}var u=a.length%2===0?[0,i]:[i];return[...vp(n,r),...a,...u].map(d=>"".concat(d,"px")).join(", ")};function bp(e){var{clipPathId:t,points:n,props:o}=e,{dot:r,dataKey:s,needClip:i}=o,{id:a}=o,l=vo(o,up),c=Fr(l);return C.createElement(Qg,{points:n,dot:r,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:s,baseProps:c,needClip:i,clipPathId:t})}function _p(e){var{showLabels:t,children:n,points:o}=e,r=C.useMemo(()=>o?.map(s=>{var i,a,l={x:(i=s.x)!==null&&i!==void 0?i:0,y:(a=s.y)!==null&&a!==void 0?a:0,width:0,lowerWidth:0,upperWidth:0,height:0};return ge(ge({},l),{},{value:s.value,payload:s.payload,viewBox:l,parentViewBox:void 0,fill:void 0})}),[o]);return C.createElement(Lc,{value:t?r:void 0},n)}function Tr(e){var{clipPathId:t,pathRef:n,points:o,strokeDasharray:r,props:s}=e,{type:i,layout:a,connectNulls:l,needClip:c,shape:u}=s,d=vo(s,dp),f=ge(ge({},$c(d)),{},{fill:"none",className:"recharts-line-curve",clipPath:c?"url(#clipPath-".concat(t,")"):void 0,points:o,type:i,layout:a,connectNulls:l,strokeDasharray:r??s.strokeDasharray});return C.createElement(C.Fragment,null,o?.length>1&&C.createElement(zc,_t({shapeType:"curve",option:u},f,{pathRef:n})),C.createElement(bp,{points:o,clipPathId:t,props:s}))}function Sp(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function Np(e){var{clipPathId:t,props:n,pathRef:o,previousPointsRef:r,longestAnimatedLengthRef:s}=e,{points:i,strokeDasharray:a,isAnimationActive:l,animationBegin:c,animationDuration:u,animationEasing:d,animateNewValues:f,width:g,height:m,onAnimationEnd:y,onAnimationStart:v}=n,x=r.current,_=Tc(i,"recharts-line-"),p=C.useRef(_),[w,M]=C.useState(!1),S=!w,N=C.useCallback(()=>{typeof y=="function"&&y(),M(!1)},[y]),D=C.useCallback(()=>{typeof v=="function"&&v(),M(!0)},[v]),T=Sp(o.current),z=C.useRef(0);p.current!==_&&(z.current=s.current,p.current=_);var E=z.current;return C.createElement(_p,{points:i,showLabels:S},n.children,C.createElement(Ac,{animationId:_,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:N,onAnimationStart:D,key:_},L=>{var $=ct(E,T+E,L),b=Math.min($,T),k;if(l)if(a){var I="".concat(a).split(/[,\s]+/gim).map(j=>parseFloat(j));k=wp(b,T,I)}else k=Qi(T,b);else k=a==null?void 0:String(a);if(L>0&&T>0&&(r.current=i,s.current=Math.max(s.current,b)),x){var A=x.length/i.length,P=L===1?i:i.map((j,O)=>{var H=Math.floor(O*A);if(x[H]){var R=x[H];return ge(ge({},j),{},{x:ct(R.x,j.x,L),y:ct(R.y,j.y,L)})}return f?ge(ge({},j),{},{x:ct(g*2,j.x,L),y:ct(m/2,j.y,L)}):ge(ge({},j),{},{x:j.x,y:j.y})});return r.current=P,C.createElement(Tr,{props:n,points:P,clipPathId:t,pathRef:o,strokeDasharray:k})}return C.createElement(Tr,{props:n,points:i,clipPathId:t,pathRef:o,strokeDasharray:k})}),C.createElement(Dc,{label:n.label}))}function Ep(e){var{clipPathId:t,props:n}=e,o=C.useRef(null),r=C.useRef(0),s=C.useRef(null);return C.createElement(Np,{props:n,clipPathId:t,previousPointsRef:o,longestAnimatedLengthRef:r,pathRef:s})}var Cp=(e,t)=>{var n,o;return{x:(n=e.x)!==null&&n!==void 0?n:void 0,y:(o=e.y)!==null&&o!==void 0?o:void 0,value:e.value,errorVal:Jr(e.payload,t)}};class Mp extends C.Component{render(){var{hide:t,dot:n,points:o,className:r,xAxisId:s,yAxisId:i,top:a,left:l,width:c,height:u,id:d,needClip:f,zIndex:g}=this.props;if(t)return null;var m=Zn("recharts-line",r),y=d,{r:v,strokeWidth:x}=lp(n),_=Gr(n),p=v*2+x,w=f?"url(#clipPath-".concat(_?"":"dots-").concat(y,")"):void 0;return C.createElement(Un,{zIndex:g},C.createElement(Qn,{className:m},f&&C.createElement("defs",null,C.createElement(Pc,{clipPathId:y,xAxisId:s,yAxisId:i}),!_&&C.createElement("clipPath",{id:"clipPath-dots-".concat(y)},C.createElement("rect",{x:l-p/2,y:a-p/2,width:c+p,height:u+p}))),C.createElement(jc,{xAxisId:s,yAxisId:i,data:o,dataPointFormatter:Cp,errorBarOffset:0},C.createElement(Ep,{props:this.props,clipPathId:y}))),C.createElement(op,{activeDot:this.props.activeDot,points:o,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:w}))}}var Ji={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Kn.line,type:"linear"};function Ip(e){var t=Kr(e,Ji),{activeDot:n,animateNewValues:o,animationBegin:r,animationDuration:s,animationEasing:i,connectNulls:a,dot:l,hide:c,isAnimationActive:u,label:d,legendType:f,xAxisId:g,yAxisId:m,id:y}=t,v=vo(t,fp),{needClip:x}=Mc(g,m),_=Ic(),p=kc(),w=Ur(),M=Xr(z=>cp(z,g,m,w,y));if(p!=="horizontal"&&p!=="vertical"||M==null||_==null)return null;var{height:S,width:N,x:D,y:T}=_;return C.createElement(Mp,_t({},v,{id:y,connectNulls:a,dot:l,activeDot:n,animateNewValues:o,animationBegin:r,animationDuration:s,animationEasing:i,isAnimationActive:u,hide:c,label:d,legendType:f,xAxisId:g,yAxisId:m,points:M,layout:p,height:S,width:N,left:D,top:T,needClip:x}))}function kp(e){var{layout:t,xAxis:n,yAxis:o,xAxisTicks:r,yAxisTicks:s,dataKey:i,bandSize:a,displayedData:l}=e;return l.map((c,u)=>{var d=Jr(c,i);if(t==="horizontal"){var f=To({axis:n,ticks:r,bandSize:a,entry:c,index:u}),g=Dn(d)?null:o.scale(d);return{x:f,y:g,value:d,payload:c}}var m=Dn(d)?null:n.scale(d),y=To({axis:o,ticks:s,bandSize:a,entry:c,index:u});return m==null||y==null?null:{x:m,y,value:d,payload:c}}).filter(Boolean)}function Pp(e){var t=Kr(e,Ji),n=Ur();return C.createElement(Sc,{id:t.id,type:"line"},o=>C.createElement(C.Fragment,null,C.createElement(Nc,{legendPayload:yp(t)}),C.createElement(xp,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:o}),C.createElement(Ec,{type:"line",id:o,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),C.createElement(Ip,_t({},t,{id:o}))))}var ea=C.memo(Pp,_c);ea.displayName="Line";var jp=["axis"],Tp=C.forwardRef((e,t)=>C.createElement(Oc,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:jp,tooltipPayloadSearcher:Rc,categoricalChartProps:e,ref:t}));function Ap(e,t){const o=(t.getTime()-e.getTime())/24,r=Array.from({length:24},(l,c)=>{const u=new Date(e.getTime()+c*o),d=Math.floor(Math.random()*15)+5,f=c<20?d:d+Math.floor(Math.random()*20),g=Math.random()>.85?Math.floor(Math.random()*3):0,m=f>0?g/f*100:0,y=Math.floor(Math.random()*300)+100;return{t:u.toISOString(),ts:u.getTime(),label:u.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),calls:f,errors:g,errorRate:m,p95:y}}),s=r.reduce((l,c)=>l+c.calls,0),i=r.reduce((l,c)=>l+c.errors,0),a=Math.floor(r.reduce((l,c)=>l+c.p95,0)/r.length);return{totalCalls:s,totalErrors:i,avgDurationMs:a,data:r}}function Dp(){const e=se.c(3),{locator:t,org:n}=Se(),o=ye(),r=je(),s=De(),{data:i}=Te({toolCaller:r,toolName:"MONITORING_LOGS_LIST",toolInputParams:{...s,limit:750,offset:0},scope:t,staleTime:3e4}),a=i?.logs??[],l=new Date(s.startDate),c=new Date(s.endDate),u=a.length===0?Ap(l,c):Vc(a,{startDate:l,endDate:c},24,i?.total);let d;e[0]!==o||e[1]!==n.slug?(d=g=>{o(g==="errors"?{to:"/$org/monitoring",params:{org:n.slug},search:{status:"errors"}}:{to:"/$org/monitoring",params:{org:n.slug}})},e[0]=o,e[1]=n.slug,e[2]=d):d=e[2];const f=d;return h.jsx(Bc,{stats:u,chartHeight:"h-[103px]",showDateLabels:!0,dateRange:{startDate:l,endDate:c},onKPIClick:f})}const Ar={Content:Dp,Skeleton:Hc};function Lp(){const e=se.c(24),{org:t,locator:n}=Se(),o=ye();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=je(),e[0]=r):r=e[0];const s=r,i=nn()??[];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a={...De(),limit:10,offset:0},e[1]=a):a=e[1];const l=a;let c;e[2]!==n?(c={toolCaller:s,toolName:"MONITORING_LOGS_LIST",toolInputParams:l,scope:n,staleTime:3e4},e[2]=n,e[3]=c):c=e[3];const{data:u}=Te(c);let d;e[4]!==u?.logs?(d=u?.logs??[],e[4]=u?.logs,e[5]=d):d=e[5];const f=d,g=new Map(i.map($p));let m;e[6]!==o||e[7]!==t.slug?(m=E=>{o({to:"/$org/monitoring",params:{org:t.slug},search:{connectionId:[E.connectionId],tool:E.toolName}})},e[6]=o,e[7]=t.slug,e[8]=m):m=e[8];const y=m;let v;e[9]!==o||e[10]!==t.slug?(v=()=>{o({to:"/$org/monitoring",params:{org:t.slug}})},e[9]=o,e[10]=t.slug,e[11]=v):v=e[11];const x=v;let _;if(e[12]===Symbol.for("react.memo_cache_sentinel")){const E=["Google Drive","Google Sheets","Google Slides","Gmail","Google Calendar","Discord","VTEX","Google Docs","Slack","Notion","GitHub","Linear"];_=Array.from({length:10},(L,$)=>{const b=new Date(Date.now()-$*6e4),k=E[$%E.length]??"Unknown";return{id:`mock-${$}`,toolName:k,connectionId:`mock${$}`,connectionTitle:k,timestamp:b.toISOString(),durationMs:Math.floor(Math.random()*500)+100,isError:Math.random()>.9}}),e[12]=_}else _=e[12];const p=_,w=f.length===0?p:f,M=f.length===0,S=E=>{const L=g.get(E.connectionId),b=new Date(E.timestamp).toLocaleString("en-US",{month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"});return h.jsxs("div",{className:"flex items-center h-16 border-t border-border/60 hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>!M&&y(E),children:[h.jsx("div",{className:"flex items-center justify-center w-16 px-4",children:h.jsx(He,{icon:L?.icon||null,name:E.connectionTitle,size:"xs",className:"shadow-sm"})}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsx("span",{className:"text-xs font-medium text-foreground truncate block",children:E.toolName})}),h.jsxs("div",{className:"flex items-center gap-2 px-5 text-xs whitespace-nowrap",children:[h.jsxs("span",{className:"text-muted-foreground",children:[E.durationMs,"ms"]}),h.jsx("span",{className:"text-foreground",children:b})]}),h.jsx("div",{className:"flex items-center pr-5",children:h.jsx(Xc,{variant:E.isError?"destructive":"success",className:"text-xs px-2 py-1",children:E.isError?"Error":"OK"})})]},E.id)};let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Recent Activity"}),e[13]=N):N=e[13];let D;if(e[14]!==w||e[15]!==S){let E;e[17]!==S?(E=L=>S(L),e[17]=S,e[18]=E):E=e[18],D=w.map(E),e[14]=w,e[15]=S,e[16]=D}else D=e[16];let T;e[19]!==D?(T=h.jsx("div",{className:"overflow-auto",children:D}),e[19]=D,e[20]=T):T=e[20];let z;return e[21]!==x||e[22]!==T?(z=h.jsx(Ae,{title:N,onTitleClick:x,noPadding:!0,className:"min-h-0 overflow-hidden",children:T}),e[21]=x,e[22]=T,e[23]=z):z=e[23],z}function $p(e){return[e.id,e]}function zp(){const e=se.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Recent Activity"}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx(Ae,{title:t,noPadding:!0,className:"min-h-0 overflow-hidden",children:h.jsx("div",{className:"overflow-auto",children:[...Array(10)].map(Op)})}),e[1]=n):n=e[1],n}function Op(e,t){return h.jsxs("div",{className:"flex items-center h-16 border-t border-border/60",children:[h.jsx("div",{className:"flex items-center justify-center w-16 px-4",children:h.jsx("div",{className:"h-6 w-6 bg-muted animate-pulse rounded-md"})}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsx("div",{className:"h-3 w-32 bg-muted animate-pulse rounded"})}),h.jsxs("div",{className:"flex items-center gap-2 px-5",children:[h.jsx("div",{className:"h-3 w-12 bg-muted animate-pulse rounded"}),h.jsx("div",{className:"h-3 w-40 bg-muted animate-pulse rounded"})]}),h.jsx("div",{className:"flex items-center pr-5",children:h.jsx("div",{className:"h-6 w-12 bg-muted animate-pulse rounded-full"})})]},t)}const Dr={Content:Lp,Skeleton:zp};function Rp(e){const t=new Map;for(const o of e){if(!o.gatewayId)continue;const r=t.get(o.gatewayId)??{requests:0,errors:0,totalLatency:0};t.set(o.gatewayId,{requests:r.requests+1,errors:r.errors+(o.isError?1:0),totalLatency:r.totalLatency+o.durationMs})}const n=new Map;for(const[o,r]of t)n.set(o,{gatewayId:o,requests:r.requests,errors:r.errors,errorRate:r.requests>0?r.errors/r.requests*100:0,avgLatencyMs:r.requests>0?r.totalLatency/r.requests:0});return n}function Hp(e,t){switch(t){case"requests":return e.requests.toLocaleString();case"errors":return`${e.errorRate.toFixed(1)}%`;case"latency":return`${Math.round(e.avgLatencyMs)}ms`}}function Bt(e,t){switch(t){case"requests":return e.requests;case"errors":return e.errorRate;case"latency":return e.avgLatencyMs}}function Vp(e,t,n){if(t===0)return 0;const o=Bt(e,n);return Math.min(o/t*100,100)}function Bp(e){const t=se.c(24),{metricsMode:n}=e,{org:o,locator:r}=Se(),s=ye();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=je(),t[0]=i):i=t[0];const a=i;let l;t[1]===Symbol.for("react.memo_cache_sentinel")?(l=De(),t[1]=l):l=t[1];const c=l,u=Vr({pageSize:100})??[];let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d={...c,limit:1e3,offset:0},t[2]=d):d=t[2];let f;t[3]!==r?(f={toolCaller:a,toolName:"MONITORING_LOGS_LIST",toolInputParams:d,scope:r,staleTime:3e4},t[3]=r,t[4]=f):f=t[4];const{data:g}=Te(f),m=g?.logs??[],y=m.length===0?Array.from({length:50},Gp):[],v=m.length===0?y:m,x=Rp(v);let _;t[5]!==n?(_=(A,P)=>Bt(P.metric,n)-Bt(A.metric,n),t[5]=n,t[6]=_):_=t[6];const p=u.map(A=>({gateway:A,metric:x.get(A.id)})).filter(Fp).sort(_).slice(0,6),w=p[0]?.metric,M=w?Bt(w,n):1;let S;t[7]!==n||t[8]!==s||t[9]!==o.slug?(S=A=>{s({to:"/$org/monitoring",params:{org:o.slug},search:{from:"now-24h",to:"now",gatewayId:[A],...n==="errors"&&{status:"errors"}}})},t[7]=n,t[8]=s,t[9]=o.slug,t[10]=S):S=t[10];const N=S;let D;t[11]!==s||t[12]!==o.slug?(D=()=>{s({to:"/$org/gateways",params:{org:o.slug}})},t[11]=s,t[12]=o.slug,t[13]=D):D=t[13];const T=D,z=n==="requests"?"bg-chart-1":n==="errors"?"bg-chart-3":"bg-chart-4";let E;t[14]===Symbol.for("react.memo_cache_sentinel")?(E=h.jsx("div",{className:"border-t border-border/60"}),t[14]=E):E=t[14];const L=Ae;let $;t[15]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Hubs"}),t[15]=$):$=t[15];const b=p.length===0?h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"No gateway activity in the last 24 hours"}):h.jsx("div",{className:"space-y-3 w-full",children:p.map(A=>{const{gateway:P,metric:j}=A,O=Vp(j,M,n);return h.jsxs("div",{className:"group cursor-pointer flex items-center gap-2",onClick:()=>N(P.id),children:[h.jsx(He,{icon:P.icon,name:P.title,size:"xs",fallbackIcon:h.jsx(Hr,{}),className:"shrink-0"}),h.jsx("span",{className:"text-xs font-medium text-foreground truncate min-w-0 w-32",children:P.title}),h.jsx("div",{className:"relative h-2 bg-muted/50 overflow-hidden flex-1",children:h.jsx("div",{className:`h-full transition-all duration-500 ease-out group-hover:opacity-80 ${z}`,style:{width:`${O}%`}})}),h.jsx("span",{className:"text-xs tabular-nums shrink-0 text-foreground font-normal",children:Hp(j,n)})]},P.id)})});let k;t[16]!==L||t[17]!==T||t[18]!==b||t[19]!==$?(k=h.jsx(L,{title:$,onTitleClick:T,children:b}),t[16]=L,t[17]=T,t[18]=b,t[19]=$,t[20]=k):k=t[20];let I;return t[21]!==k||t[22]!==E?(I=h.jsxs(h.Fragment,{children:[E,k]}),t[21]=k,t[22]=E,t[23]=I):I=t[23],I}function Fp(e){return e.metric}function Gp(e,t){return{id:`mock-${t}`,gatewayId:"mock-gateway-1",connectionId:"",connectionTitle:"",toolName:"COLLECTION_LLM_LIST",isError:Math.random()>.95,errorMessage:null,durationMs:Math.floor(Math.random()*400)+100,timestamp:new Date().toISOString()}}function Xp(){const e=se.c(3);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=h.jsx("div",{className:"border-t border-border/60"}),e[0]=t):t=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Hubs"}),e[1]=n):n=e[1];let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsxs(h.Fragment,{children:[t,h.jsx(Ae,{title:n,children:h.jsx("div",{className:"space-y-3 w-full",children:Array.from({length:5}).map(Yp)})})]}),e[2]=o):o=e[2],o}function Yp(e,t){return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"h-6 w-6 bg-muted animate-pulse rounded-md shrink-0"}),h.jsx("div",{className:"h-3 w-32 bg-muted animate-pulse rounded shrink-0"}),h.jsx("div",{className:"h-2 bg-muted animate-pulse flex-1"}),h.jsx("div",{className:"h-3 w-12 bg-muted animate-pulse rounded shrink-0"})]},t)}const Lr={Content:Bp,Skeleton:Xp};function qp(e){const t=new Map;for(const o of e){if(!o.connectionId)continue;const r=t.get(o.connectionId)??{requests:0,errors:0,totalLatency:0};t.set(o.connectionId,{requests:r.requests+1,errors:r.errors+(o.isError?1:0),totalLatency:r.totalLatency+o.durationMs})}const n=new Map;for(const[o,r]of t)n.set(o,{connectionId:o,requests:r.requests,errors:r.errors,errorRate:r.requests>0?r.errors/r.requests*100:0,avgLatencyMs:r.requests>0?r.totalLatency/r.requests:0});return n}function Wp(e,t){switch(t){case"requests":return e.requests.toLocaleString();case"errors":return`${e.errorRate.toFixed(1)}%`;case"latency":return`${Math.round(e.avgLatencyMs)}ms`}}function Ft(e,t){switch(t){case"requests":return e.requests;case"errors":return e.errorRate;case"latency":return e.avgLatencyMs}}function Zp(e,t,n){if(t===0)return 0;const o=Ft(e,n);return Math.min(o/t*100,100)}function Kp(e){const t=se.c(24),{metricsMode:n,onMetricsModeChange:o}=e,{org:r,locator:s}=Se(),i=ye();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=je(),t[0]=a):a=t[0];const l=a;let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=De(),t[1]=c):c=t[1];const u=c,d=nn({pageSize:100})??[];let f;t[2]===Symbol.for("react.memo_cache_sentinel")?(f={...u,limit:1e3,offset:0},t[2]=f):f=t[2];let g;t[3]!==s?(g={toolCaller:l,toolName:"MONITORING_LOGS_LIST",toolInputParams:f,scope:s,staleTime:3e4},t[3]=s,t[4]=g):g=t[4];const{data:m}=Te(g),y=m?.logs??[],v=y.length===0?Array.from({length:100},Qp):[],x=y.length===0?v:y,_=qp(x);let p;t[5]!==n?(p=(A,P)=>Ft(P.metric,n)-Ft(A.metric,n),t[5]=n,t[6]=p):p=t[6];const w=d.map(A=>({connection:A,metric:_.get(A.id)})).filter(Up).sort(p).slice(0,6),M=w[0]?.metric,S=M?Ft(M,n):1;let N;t[7]!==n||t[8]!==i||t[9]!==r.slug?(N=A=>{i({to:"/$org/monitoring",params:{org:r.slug},search:{from:"now-24h",to:"now",connectionId:[A],...n==="errors"&&{status:"errors"}}})},t[7]=n,t[8]=i,t[9]=r.slug,t[10]=N):N=t[10];const D=N;let T;t[11]!==i||t[12]!==r.slug?(T=()=>{i({to:"/$org/mcps",params:{org:r.slug}})},t[11]=i,t[12]=r.slug,t[13]=T):T=t[13];const z=T,E=n==="requests"?"bg-chart-1":n==="errors"?"bg-chart-3":"bg-chart-4",L=Ae;let $;t[14]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Connections"}),t[14]=$):$=t[14];let b;t[15]!==n||t[16]!==o?(b=o?h.jsxs(ds,{type:"single",value:n,onValueChange:A=>A&&o(A),variant:"outline",size:"sm",children:[h.jsx(Ze,{value:"requests",className:"text-xs px-2 cursor-pointer",children:"Calls"}),h.jsx(Ze,{value:"errors",className:"text-xs px-2 cursor-pointer",children:"Errors"}),h.jsx(Ze,{value:"latency",className:"text-xs px-2 cursor-pointer",children:"Latency"})]}):null,t[15]=n,t[16]=o,t[17]=b):b=t[17];const k=w.length===0?h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"No server activity in the last 24 hours"}):h.jsx("div",{className:"space-y-3 w-full",children:w.map(A=>{const{connection:P,metric:j}=A,O=Zp(j,S,n);return h.jsxs("div",{className:"group cursor-pointer flex items-center gap-2",onClick:()=>D(P.id),children:[h.jsx(He,{icon:P.icon,name:P.title,size:"xs",fallbackIcon:h.jsx(Gt,{}),className:"shrink-0"}),h.jsx("span",{className:"text-xs font-medium text-foreground truncate min-w-0 w-32",children:P.title}),h.jsx("div",{className:"relative h-2 bg-muted/50 overflow-hidden flex-1",children:h.jsx("div",{className:`h-full transition-all duration-500 ease-out group-hover:opacity-80 ${E}`,style:{width:`${O}%`}})}),h.jsx("span",{className:"text-xs tabular-nums shrink-0 text-foreground font-normal",children:Wp(j,n)})]},P.id)})});let I;return t[18]!==L||t[19]!==z||t[20]!==k||t[21]!==$||t[22]!==b?(I=h.jsx(L,{title:$,onTitleClick:z,action:b,children:k}),t[18]=L,t[19]=z,t[20]=k,t[21]=$,t[22]=b,t[23]=I):I=t[23],I}function Up(e){return e.metric}function Qp(e,t){return{id:`mock-${t}`,connectionId:["mock-1","mock-2","mock-3","mock-4"][t%4]||"mock-1",connectionTitle:"",toolName:"COLLECTION_LLM_LIST",isError:Math.random()>.9,errorMessage:null,durationMs:Math.floor(Math.random()*500)+100,timestamp:new Date().toISOString()}}function Jp(){const e=se.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Connections"}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx(Ae,{title:t,children:h.jsx("div",{className:"space-y-3 w-full",children:Array.from({length:5}).map(e0)})}),e[1]=n):n=e[1],n}function e0(e,t){return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"h-6 w-6 bg-muted animate-pulse rounded-md shrink-0"}),h.jsx("div",{className:"h-3 w-32 bg-muted animate-pulse rounded shrink-0"}),h.jsx("div",{className:"h-2 bg-muted animate-pulse flex-1"}),h.jsx("div",{className:"h-3 w-12 bg-muted animate-pulse rounded shrink-0"})]},t)}const $r={Content:Kp,Skeleton:Jp};function t0(e,t,n,o=10){const s=t.getTime(),a=(n.getTime()-s)/24,l=new Map;for(const m of e){const y=m.toolName||"Unknown",v=l.get(y);l.set(y,{count:(v?.count??0)+1,connectionId:v?.connectionId||m.connectionId})}const c=[...l.entries()].sort((m,y)=>y[1].count-m[1].count).slice(0,o).map(([m,y])=>({name:m,connectionId:y.connectionId})),u=[],d=c.map(m=>m.name);for(let m=0;m<24;m++){const y=new Date(s+m*a),v={t:y.toISOString(),ts:y.getTime(),label:y.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})};for(const x of d)v[x]=0;u.push(v)}for(const m of e){const y=new Date(m.timestamp).getTime(),v=Math.floor((y-s)/a),x=Math.max(0,Math.min(23,v)),_=u[x];if(!_)continue;const p=m.toolName||"Unknown";d.includes(p)&&(_[p]=_[p]+1)}const f={},g=new Map;return c.forEach((m,y)=>{const x=`var(--chart-${y%5+1})`;g.set(m.name,x),f[m.name]={label:m.name,color:x}}),{buckets:u,topTools:c,chartConfig:f,toolColors:g}}function n0(e){const t=se.c(4),{org:n,locator:o}=Se(),r=ye(),s=je(),i=De(),a=nn()??[],{data:l}=Te({toolCaller:s,toolName:"MONITORING_LOGS_LIST",toolInputParams:{...i,limit:2e3,offset:0},scope:o,staleTime:3e4}),c=l?.logs??[],u=new Date(i.startDate),d=new Date(i.endDate),f=c.length===0?Array.from({length:150},(N,D)=>({id:`mock-${D}`,toolName:["COLLECTION_LLM_LIST","COLLECTION_REGISTRY_APP_LIST","microsoft_docs_search","MCP_CONFIGURATION"][D%4]||"COLLECTION_LLM_LIST",connectionId:`mock-conn-${D%4}`,connectionTitle:"Mock Connection",isError:!1,errorMessage:null,durationMs:Math.floor(Math.random()*300)+100,timestamp:new Date(u.getTime()+Math.random()*(d.getTime()-u.getTime())).toISOString()})):[],g=c.length===0?f:c,{buckets:m,topTools:y,chartConfig:v,toolColors:x}=t0(g,u,d,10),_=new Map(a.map(r0));let p;t[0]!==r||t[1]!==n.slug?(p=()=>{r({to:"/$org/monitoring",params:{org:n.slug}})},t[0]=r,t[1]=n.slug,t[2]=p):p=t[2];const w=p,M=o0;let S;return t[3]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Top Tools"}),t[3]=S):S=t[3],h.jsx(Ae,{title:h.jsxs("div",{className:"flex flex-col gap-1.5",children:[S,h.jsx("div",{className:"flex items-center gap-3",children:y.slice(0,3).map(N=>{const D=_.get(N.connectionId||"");return h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx(He,{icon:D?.icon||null,name:N.name,size:"xs",fallbackIcon:h.jsx(Gt,{}),className:"shrink-0 !size-4 !min-w-4 aspect-square rounded-sm"}),h.jsx("span",{className:"text-[10px] text-foreground truncate max-w-32",children:N.name})]},N.name)})})]}),onTitleClick:w,children:y.length===0?h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"No tool activity in the last 24 hours"}):h.jsxs("div",{className:"flex flex-col gap-2 w-full h-full cursor-pointer hover:opacity-80 transition-opacity",children:[h.jsx(Fc,{className:"flex-1 min-h-0 max-h-[120px] w-full",config:v,children:h.jsxs(Tp,{data:m,margin:{left:0,right:0,top:5,bottom:5},children:[h.jsx(Gc,{content:N=>{const{active:D,payload:T}=N;if(!D||!T||T.length===0)return null;const z=T[0]&&typeof T[0]=="object"&&"payload"in T[0]?T[0].payload?.label??"":"";return h.jsxs("div",{className:"rounded-lg border bg-background p-2 shadow-sm",children:[h.jsx("div",{className:"mb-1.5 text-xs text-muted-foreground",children:z}),h.jsx("div",{className:"flex flex-col gap-1",children:T.map(E=>{if(!E.value||E.value===0)return null;const L=y.find(b=>b.name===E.dataKey),$=_.get(L?.connectionId||"");return h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("div",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:E.color}}),h.jsx(He,{icon:$?.icon||null,name:E.dataKey,size:"xs",fallbackIcon:h.jsx(Gt,{}),className:"shrink-0"}),h.jsxs("span",{className:"text-xs font-medium",children:[E.dataKey,":"]}),h.jsx("span",{className:"text-xs font-bold",children:E.value})]},E.dataKey)})})]})}}),y.map(N=>h.jsx(ea,{type:"monotone",dataKey:N.name,stroke:x.get(N.name),strokeWidth:2,dot:!1,activeDot:{r:4}},N.name))]})}),h.jsxs("div",{className:"flex items-start justify-between text-xs text-muted-foreground w-full",children:[h.jsx("p",{children:M(u)}),h.jsx("p",{children:M(d)})]})]})})}function o0(e){return e.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function r0(e){return[e.id,e]}function s0(){const e=se.c(4);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=h.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"}),e[0]=t):t=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsxs("div",{className:"flex flex-col gap-1.5",children:[t,h.jsx("div",{className:"flex items-center gap-2",children:Array.from({length:3}).map(i0)})]}),e[1]=n):n=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx("div",{className:"flex-1 min-h-0 max-h-[120px] w-full rounded bg-muted animate-pulse"}),e[2]=o):o=e[2];let r;return e[3]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(Ae,{title:n,children:h.jsxs("div",{className:"flex flex-col gap-2 w-full h-full",children:[o,h.jsxs("div",{className:"flex items-start justify-between w-full",children:[h.jsx("div",{className:"h-4 w-16 rounded bg-muted animate-pulse"}),h.jsx("div",{className:"h-4 w-16 rounded bg-muted animate-pulse"})]})]})}),e[3]=r):r=e[3],r}function i0(e,t){return h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("div",{className:"size-4 aspect-square rounded-md bg-muted animate-pulse"}),h.jsx("div",{className:"h-2.5 w-16 rounded bg-muted animate-pulse"})]},t)}const zr={Content:n0,Skeleton:s0};function a0(){const e=se.c(21),{org:t,locator:n}=Se(),o=ye();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=je(),e[0]=r):r=e[0];const s=r;let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=De(),e[1]=i):i=e[1];const a=i;let l;e[2]!==n?(l={toolCaller:s,toolName:"MONITORING_STATS",toolInputParams:a,scope:n,staleTime:6e4,refetchInterval:c0},e[2]=n,e[3]=l):l=e[3];const{data:c}=Te(l);if(rn(c))return null;let u;e[4]!==o||e[5]!==t.slug?(u=()=>{o({to:"/$org/mcps",params:{org:t.slug},search:{action:"create"}})},e[4]=o,e[5]=t.slug,e[6]=u):u=e[6];const d=u;let f;e[7]!==o||e[8]!==t.slug?(f=()=>{o({to:"/$org/store",params:{org:t.slug}})},e[7]=o,e[8]=t.slug,e[9]=f):f=e[9];const g=f;let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx("div",{className:"p-2",children:h.jsx("div",{className:"bg-muted border border-border rounded-lg h-[250px] overflow-hidden flex items-center justify-center",children:h.jsx("img",{src:"/empty-state-home.png",alt:"MCP Mesh illustration",className:"w-full h-full object-cover"})})}),e[10]=m):m=e[10];let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsxs("div",{className:"px-6 py-6 space-y-2",children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Welcome to your MCP Mesh"}),h.jsx("p",{className:"text-sm text-muted-foreground leading-normal",children:"Connect your first Connection to unlock real-time metrics, activity logs, and analytics right here on your home."})]}),e[11]=y):y=e[11];let v;e[12]===Symbol.for("react.memo_cache_sentinel")?(v=h.jsx(ts,{size:16}),e[12]=v):v=e[12];let x;e[13]!==g?(x=h.jsxs(An,{onClick:g,size:"default",children:[v,"Browse Store"]}),e[13]=g,e[14]=x):x=e[14];let _;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Rr,{size:16}),e[15]=_):_=e[15];let p;e[16]!==d?(p=h.jsxs(An,{variant:"outline",onClick:d,size:"default",children:[_,"Custom Connection"]}),e[16]=d,e[17]=p):p=e[17];let w;return e[18]!==p||e[19]!==x?(w=h.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4 bg-background/80 backdrop-blur-[3px] z-10",children:h.jsxs("div",{className:"max-w-md w-full bg-background rounded-xl border border-border shadow-lg pointer-events-auto overflow-hidden",children:[m,y,h.jsxs("div",{className:"border-t border-border px-4 py-4 flex items-center justify-center gap-2",children:[x,p]})]})}),e[18]=p,e[19]=x,e[20]=w):w=e[20],w}function c0(e){return rn(e.state.data)?!1:1e3}function l0(e){const t=se.c(21),{metricsMode:n,onMetricsModeChange:o}=e;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground",children:"Failed to load monitoring stats"}),t[0]=r):r=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx("div",{className:"lg:col-span-2",children:h.jsx(Ye,{fallback:r,children:h.jsx(C.Suspense,{fallback:h.jsx(Ar.Skeleton,{}),children:h.jsx(Ar.Content,{})})})}),t[1]=s):s=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground",children:"Failed to load recent activity"}),t[2]=i):i=t[2];let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx("div",{className:"lg:col-span-1 lg:row-span-3 bg-background grid",children:h.jsx(Ye,{fallback:i,children:h.jsx(C.Suspense,{fallback:h.jsx(Dr.Skeleton,{}),children:h.jsx(Dr.Content,{})})})}),t[3]=a):a=t[3];let l;t[4]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground",children:"Failed to load top tools"}),t[4]=l):l=t[4];let c;t[5]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(zr.Skeleton,{}),t[5]=c):c=t[5];let u;t[6]!==n?(u=h.jsx("div",{className:"lg:col-span-1 lg:row-span-1 bg-background",children:h.jsx(Ye,{fallback:l,children:h.jsx(C.Suspense,{fallback:c,children:h.jsx(zr.Content,{metricsMode:n})})})}),t[6]=n,t[7]=u):u=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground",children:"Failed to load top servers"}),t[8]=d):d=t[8];let f;t[9]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx($r.Skeleton,{}),t[9]=f):f=t[9];let g;t[10]!==n||t[11]!==o?(g=h.jsx("div",{className:"lg:col-span-1 lg:row-span-1 bg-background",children:h.jsx(Ye,{fallback:d,children:h.jsx(C.Suspense,{fallback:f,children:h.jsx($r.Content,{metricsMode:n,onMetricsModeChange:o})})})}),t[10]=n,t[11]=o,t[12]=g):g=t[12];let m;t[13]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground",children:"Failed to load top gateways"}),t[13]=m):m=t[13];let y;t[14]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(Lr.Skeleton,{}),t[14]=y):y=t[14];let v;t[15]!==n?(v=h.jsx("div",{className:"lg:col-span-1 lg:row-span-1 bg-background",children:h.jsx(Ye,{fallback:m,children:h.jsx(C.Suspense,{fallback:y,children:h.jsx(Lr.Content,{metricsMode:n})})})}),t[15]=n,t[16]=v):v=t[16];let x;return t[17]!==g||t[18]!==v||t[19]!==u?(x=h.jsx("div",{className:"w-full",children:h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-[0.5px] bg-border",children:[s,a,u,g,v]})}),t[17]=g,t[18]=v,t[19]=u,t[20]=x):x=t[20],x}function z0(){const e=se.c(30),{org:t,locator:n}=Se(),o=ye();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=je(),e[0]=r):r=e[0];const s=r;let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=De(),e[1]=i):i=e[1];const a=i,[l,c]=C.useState(d0),[u,d]=C.useState("requests");let f;e[2]!==n?(f={toolCaller:s,toolName:"MONITORING_STATS",toolInputParams:a,scope:n,staleTime:6e4,refetchInterval:u0},e[2]=n,e[3]=f):f=e[3];const{data:g}=Te(f);let m;e[4]!==g?(m=rn(g),e[4]=g,e[5]=m):m=e[5];const y=m;let v;e[6]===Symbol.for("react.memo_cache_sentinel")?(v=L=>{c(L),localStorage.setItem("org-home-view-mode",L)},e[6]=v):v=e[6];const x=v;let _;e[7]!==o||e[8]!==t.slug?(_=()=>{o({to:"/$org/mcps",params:{org:t.slug},search:{action:"create"}})},e[7]=o,e[8]=t.slug,e[9]=_):_=e[9];const p=_;let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=h.jsx(a0,{}),e[10]=w):w=e[10];let M;e[11]!==y||e[12]!==l?(M=y&&h.jsx(hc,{value:l,onValueChange:x,size:"sm",options:[{value:"dashboard",icon:h.jsx(es,{})},{value:"graph",icon:h.jsx(mc,{})}]}),e[11]=y,e[12]=l,e[13]=M):M=e[13];let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx(Rr,{size:16}),e[14]=S):S=e[14];let N;e[15]!==p?(N=h.jsxs(An,{variant:"outline",size:"sm",onClick:p,children:[S,"Connect MCP Server"]}),e[15]=p,e[16]=N):N=e[16];let D;e[17]!==M||e[18]!==N?(D=h.jsxs("div",{className:"flex items-center gap-2",children:[M,N]}),e[17]=M,e[18]=N,e[19]=D):D=e[19];let T;e[20]!==t.name||e[21]!==D?(T=h.jsx(dc,{title:t.name,ctaButton:D}),e[20]=t.name,e[21]=D,e[22]=T):T=e[22];let z;e[23]!==u||e[24]!==y||e[25]!==l?(z=h.jsx("div",{className:"flex-1 overflow-auto relative",children:l==="graph"?h.jsx(Ye,{fallback:h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground h-full flex items-center justify-center",children:"Failed to load mesh visualization"}),children:h.jsx(C.Suspense,{fallback:h.jsx(Vg,{}),children:h.jsx(Og,{showControls:y})})}):h.jsx(l0,{metricsMode:u,onMetricsModeChange:d})}),e[23]=u,e[24]=y,e[25]=l,e[26]=z):z=e[26];let E;return e[27]!==T||e[28]!==z?(E=h.jsxs(fc,{children:[w,T,z]}),e[27]=T,e[28]=z,e[29]=E):E=e[29],E}function u0(e){return rn(e.state.data)?!1:1e3}function d0(){const e=localStorage.getItem("org-home-view-mode");return e==="dashboard"||e==="graph"?e:"dashboard"}export{z0 as default};
21
+ `}),t[30]=z):z=t[30];let E;t[31]!==o||t[32]!==n?(E=n&&h.jsx("div",{className:"absolute top-4 right-4 z-10",children:h.jsx(zg,{value:o,onChange:r})}),t[31]=o,t[32]=n,t[33]=E):E=t[33];let L;t[34]===Symbol.for("react.memo_cache_sentinel")?(L={padding:.3},t[34]=L):L=t[34];let $;t[35]===Symbol.for("react.memo_cache_sentinel")?($={hideAttribution:!0},t[35]=$):$=t[35];let b;t[36]!==S||t[37]!==N?(b=h.jsx(rg,{nodes:N,edges:S,nodeTypes:$g,fitView:!0,fitViewOptions:L,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnDrag:!0,preventScrolling:!0,proOptions:$,className:"bg-transparent"}),t[36]=S,t[37]=N,t[38]=b):b=t[38];let k;return t[39]!==E||t[40]!==b?(k=h.jsxs("div",{className:"w-full h-full min-h-[420px] relative mesh-minimap bg-background",style:T,children:[z,E,b]}),t[39]=E,t[40]=b,t[41]=k):k=t[41],k}function Rg(e,t){return e.id.localeCompare(t.id)}function Hg(e,t){return e.id.localeCompare(t.id)}function Vg(){const e=se.c(3);let t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=h.jsx("div",{className:"flex flex-col gap-3",children:[1,2,3,4,5].map(Fg)}),n=h.jsx("div",{className:"h-14 w-28 bg-muted animate-pulse rounded-xl"}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx("div",{className:"bg-background p-5 h-full min-h-[420px] flex items-center justify-center",children:h.jsxs("div",{className:"flex items-center gap-16",children:[t,n,h.jsx("div",{className:"flex flex-col gap-3",children:[1,2,3,4,5].map(Bg)})]})}),e[2]=o):o=e[2],o}function Bg(e){return h.jsx("div",{className:"h-14 w-[220px] bg-muted animate-pulse rounded-lg"},e)}function Fg(e){return h.jsx("div",{className:"h-14 w-[220px] bg-muted animate-pulse rounded-lg"},e)}function qn(){return qn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},qn.apply(null,arguments)}var qi=e=>{var{cx:t,cy:n,r:o,className:r}=e,s=Zn("recharts-dot",r);return _n(t)&&_n(n)&&_n(o)?C.createElement("circle",qn({},Fr(e),Br(e),{className:s,cx:t,cy:n,r:o})):null},Gg=["points"];function kr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,o)}return n}function Pn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kr(Object(n),!0).forEach(function(o){Xg(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kr(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Xg(e,t,n){return(t=Yg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yg(e){var t=qg(e,"string");return typeof t=="symbol"?t:t+""}function qg(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tn(){return tn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},tn.apply(null,arguments)}function Wg(e,t){if(e==null)return{};var n,o,r=Zg(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)n=s[o],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Zg(e,t){if(e==null)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.indexOf(o)!==-1)continue;n[o]=e[o]}return n}function Kg(e){var{option:t,dotProps:n,className:o}=e;if(C.isValidElement(t))return C.cloneElement(t,n);if(typeof t=="function")return t(n);var r=Zn(o,typeof t!="boolean"?t.className:""),s=n??{},{points:i}=s,a=Wg(s,Gg);return C.createElement(qi,tn({},a,{className:r}))}function Ug(e,t){return e==null?!1:t?!0:e.length===1}function Qg(e){var{points:t,dot:n,className:o,dotClassName:r,dataKey:s,baseProps:i,needClip:a,clipPathId:l,zIndex:c=Kn.scatter}=e;if(!Ug(t,n))return null;var u=Gr(n),d=pc(n),f=t.map((m,y)=>{var v,x,_=Pn(Pn(Pn({r:3},i),d),{},{index:y,cx:(v=m.x)!==null&&v!==void 0?v:void 0,cy:(x=m.y)!==null&&x!==void 0?x:void 0,dataKey:s,value:m.value,payload:m.payload,points:t});return C.createElement(Kg,{key:"dot-".concat(y),option:n,dotProps:_,className:r})}),g={};return a&&l!=null&&(g.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(l,")")),C.createElement(Un,{zIndex:c},C.createElement(Qn,tn({className:o},g),f))}function Pr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,o)}return n}function jn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pr(Object(n),!0).forEach(function(o){Jg(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pr(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Jg(e,t,n){return(t=ep(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ep(e){var t=tp(e,"string");return typeof t=="symbol"?t:t+""}function tp(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var np=e=>{var{point:t,childIndex:n,mainColor:o,activeDot:r,dataKey:s,clipPath:i}=e;if(r===!1||t.x==null||t.y==null)return null;var a={index:n,dataKey:s,cx:t.x,cy:t.y,r:4,fill:o??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},l=jn(jn(jn({},a),Yr(r)),Br(r)),c;return C.isValidElement(r)?c=C.cloneElement(r,l):typeof r=="function"?c=r(l):c=C.createElement(qi,l),C.createElement(Qn,{className:"recharts-active-dot",clipPath:i},c)};function op(e){var{points:t,mainColor:n,activeDot:o,itemDataKey:r,clipPath:s,zIndex:i=Kn.activeDot}=e,a=Xr(yc),l=xc();if(t==null||l==null)return null;var c=t.find(u=>l.includes(u.payload));return Dn(c)?null:C.createElement(Un,{zIndex:i},C.createElement(np,{point:c,childIndex:Number(a),mainColor:n,dataKey:r,activeDot:o,clipPath:s}))}var Wi=(e,t,n,o)=>Wr(e,"xAxis",t,o),Zi=(e,t,n,o)=>Zr(e,"xAxis",t,o),Ki=(e,t,n,o)=>Wr(e,"yAxis",n,o),Ui=(e,t,n,o)=>Zr(e,"yAxis",n,o),rp=Jn([qr,Wi,Ki,Zi,Ui],(e,t,n,o,r)=>bc(e,"xAxis")?jo(t,o,!1):jo(n,r,!1)),sp=(e,t,n,o,r)=>r;function ip(e){return e.type==="line"}var ap=Jn([wc,sp],(e,t)=>e.filter(ip).find(n=>n.id===t)),cp=Jn([qr,Wi,Ki,Zi,Ui,ap,rp,vc],(e,t,n,o,r,s,i,a)=>{var{chartData:l,dataStartIndex:c,dataEndIndex:u}=a;if(!(s==null||t==null||n==null||o==null||r==null||o.length===0||r.length===0||i==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:d,data:f}=s,g;if(f!=null&&f.length>0?g=f:g=l?.slice(c,u+1),g!=null)return kp({layout:e,xAxis:t,yAxis:n,xAxisTicks:o,yAxisTicks:r,dataKey:d,bandSize:i,displayedData:g})}});function lp(e){var t=Yr(e),n=3,o=2;if(t!=null){var{r,strokeWidth:s}=t,i=Number(r),a=Number(s);return(Number.isNaN(i)||i<0)&&(i=n),(Number.isNaN(a)||a<0)&&(a=o),{r:i,strokeWidth:a}}return{r:n,strokeWidth:o}}var up=["id"],dp=["type","layout","connectNulls","needClip","shape"],fp=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function _t(){return _t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},_t.apply(null,arguments)}function jr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,o)}return n}function ge(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jr(Object(n),!0).forEach(function(o){hp(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jr(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function hp(e,t,n){return(t=mp(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mp(e){var t=gp(e,"string");return typeof t=="symbol"?t:t+""}function gp(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vo(e,t){if(e==null)return{};var n,o,r=pp(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)n=s[o],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function pp(e,t){if(e==null)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.indexOf(o)!==-1)continue;n[o]=e[o]}return n}var yp=e=>{var{dataKey:t,name:n,stroke:o,legendType:r,hide:s}=e;return[{inactive:s,dataKey:t,type:r,color:o,value:Qr(n,t),payload:e}]},xp=C.memo(e=>{var{dataKey:t,data:n,stroke:o,strokeWidth:r,fill:s,name:i,hide:a,unit:l,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,positions:void 0,settings:{stroke:o,strokeWidth:r,fill:s,dataKey:t,nameKey:void 0,name:Qr(i,t),hide:a,type:c,color:o,unit:l,graphicalItemId:u}};return C.createElement(Cc,{tooltipEntrySettings:d})}),Qi=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function vp(e,t){for(var n=e.length%2!==0?[...e,0]:e,o=[],r=0;r<t;++r)o=[...o,...n];return o}var wp=(e,t,n)=>{var o=n.reduce((d,f)=>d+f);if(!o)return Qi(t,e);for(var r=Math.floor(e/o),s=e%o,i=t-e,a=[],l=0,c=0;l<n.length;c+=n[l],++l)if(c+n[l]>s){a=[...n.slice(0,l),s-c];break}var u=a.length%2===0?[0,i]:[i];return[...vp(n,r),...a,...u].map(d=>"".concat(d,"px")).join(", ")};function bp(e){var{clipPathId:t,points:n,props:o}=e,{dot:r,dataKey:s,needClip:i}=o,{id:a}=o,l=vo(o,up),c=Fr(l);return C.createElement(Qg,{points:n,dot:r,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:s,baseProps:c,needClip:i,clipPathId:t})}function _p(e){var{showLabels:t,children:n,points:o}=e,r=C.useMemo(()=>o?.map(s=>{var i,a,l={x:(i=s.x)!==null&&i!==void 0?i:0,y:(a=s.y)!==null&&a!==void 0?a:0,width:0,lowerWidth:0,upperWidth:0,height:0};return ge(ge({},l),{},{value:s.value,payload:s.payload,viewBox:l,parentViewBox:void 0,fill:void 0})}),[o]);return C.createElement(Lc,{value:t?r:void 0},n)}function Tr(e){var{clipPathId:t,pathRef:n,points:o,strokeDasharray:r,props:s}=e,{type:i,layout:a,connectNulls:l,needClip:c,shape:u}=s,d=vo(s,dp),f=ge(ge({},$c(d)),{},{fill:"none",className:"recharts-line-curve",clipPath:c?"url(#clipPath-".concat(t,")"):void 0,points:o,type:i,layout:a,connectNulls:l,strokeDasharray:r??s.strokeDasharray});return C.createElement(C.Fragment,null,o?.length>1&&C.createElement(zc,_t({shapeType:"curve",option:u},f,{pathRef:n})),C.createElement(bp,{points:o,clipPathId:t,props:s}))}function Sp(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function Np(e){var{clipPathId:t,props:n,pathRef:o,previousPointsRef:r,longestAnimatedLengthRef:s}=e,{points:i,strokeDasharray:a,isAnimationActive:l,animationBegin:c,animationDuration:u,animationEasing:d,animateNewValues:f,width:g,height:m,onAnimationEnd:y,onAnimationStart:v}=n,x=r.current,_=Tc(i,"recharts-line-"),p=C.useRef(_),[w,M]=C.useState(!1),S=!w,N=C.useCallback(()=>{typeof y=="function"&&y(),M(!1)},[y]),D=C.useCallback(()=>{typeof v=="function"&&v(),M(!0)},[v]),T=Sp(o.current),z=C.useRef(0);p.current!==_&&(z.current=s.current,p.current=_);var E=z.current;return C.createElement(_p,{points:i,showLabels:S},n.children,C.createElement(Ac,{animationId:_,begin:c,duration:u,isActive:l,easing:d,onAnimationEnd:N,onAnimationStart:D,key:_},L=>{var $=ct(E,T+E,L),b=Math.min($,T),k;if(l)if(a){var I="".concat(a).split(/[,\s]+/gim).map(j=>parseFloat(j));k=wp(b,T,I)}else k=Qi(T,b);else k=a==null?void 0:String(a);if(L>0&&T>0&&(r.current=i,s.current=Math.max(s.current,b)),x){var A=x.length/i.length,P=L===1?i:i.map((j,O)=>{var H=Math.floor(O*A);if(x[H]){var R=x[H];return ge(ge({},j),{},{x:ct(R.x,j.x,L),y:ct(R.y,j.y,L)})}return f?ge(ge({},j),{},{x:ct(g*2,j.x,L),y:ct(m/2,j.y,L)}):ge(ge({},j),{},{x:j.x,y:j.y})});return r.current=P,C.createElement(Tr,{props:n,points:P,clipPathId:t,pathRef:o,strokeDasharray:k})}return C.createElement(Tr,{props:n,points:i,clipPathId:t,pathRef:o,strokeDasharray:k})}),C.createElement(Dc,{label:n.label}))}function Ep(e){var{clipPathId:t,props:n}=e,o=C.useRef(null),r=C.useRef(0),s=C.useRef(null);return C.createElement(Np,{props:n,clipPathId:t,previousPointsRef:o,longestAnimatedLengthRef:r,pathRef:s})}var Cp=(e,t)=>{var n,o;return{x:(n=e.x)!==null&&n!==void 0?n:void 0,y:(o=e.y)!==null&&o!==void 0?o:void 0,value:e.value,errorVal:Jr(e.payload,t)}};class Mp extends C.Component{render(){var{hide:t,dot:n,points:o,className:r,xAxisId:s,yAxisId:i,top:a,left:l,width:c,height:u,id:d,needClip:f,zIndex:g}=this.props;if(t)return null;var m=Zn("recharts-line",r),y=d,{r:v,strokeWidth:x}=lp(n),_=Gr(n),p=v*2+x,w=f?"url(#clipPath-".concat(_?"":"dots-").concat(y,")"):void 0;return C.createElement(Un,{zIndex:g},C.createElement(Qn,{className:m},f&&C.createElement("defs",null,C.createElement(Pc,{clipPathId:y,xAxisId:s,yAxisId:i}),!_&&C.createElement("clipPath",{id:"clipPath-dots-".concat(y)},C.createElement("rect",{x:l-p/2,y:a-p/2,width:c+p,height:u+p}))),C.createElement(jc,{xAxisId:s,yAxisId:i,data:o,dataPointFormatter:Cp,errorBarOffset:0},C.createElement(Ep,{props:this.props,clipPathId:y}))),C.createElement(op,{activeDot:this.props.activeDot,points:o,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:w}))}}var Ji={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Kn.line,type:"linear"};function Ip(e){var t=Kr(e,Ji),{activeDot:n,animateNewValues:o,animationBegin:r,animationDuration:s,animationEasing:i,connectNulls:a,dot:l,hide:c,isAnimationActive:u,label:d,legendType:f,xAxisId:g,yAxisId:m,id:y}=t,v=vo(t,fp),{needClip:x}=Mc(g,m),_=Ic(),p=kc(),w=Ur(),M=Xr(z=>cp(z,g,m,w,y));if(p!=="horizontal"&&p!=="vertical"||M==null||_==null)return null;var{height:S,width:N,x:D,y:T}=_;return C.createElement(Mp,_t({},v,{id:y,connectNulls:a,dot:l,activeDot:n,animateNewValues:o,animationBegin:r,animationDuration:s,animationEasing:i,isAnimationActive:u,hide:c,label:d,legendType:f,xAxisId:g,yAxisId:m,points:M,layout:p,height:S,width:N,left:D,top:T,needClip:x}))}function kp(e){var{layout:t,xAxis:n,yAxis:o,xAxisTicks:r,yAxisTicks:s,dataKey:i,bandSize:a,displayedData:l}=e;return l.map((c,u)=>{var d=Jr(c,i);if(t==="horizontal"){var f=To({axis:n,ticks:r,bandSize:a,entry:c,index:u}),g=Dn(d)?null:o.scale(d);return{x:f,y:g,value:d,payload:c}}var m=Dn(d)?null:n.scale(d),y=To({axis:o,ticks:s,bandSize:a,entry:c,index:u});return m==null||y==null?null:{x:m,y,value:d,payload:c}}).filter(Boolean)}function Pp(e){var t=Kr(e,Ji),n=Ur();return C.createElement(Sc,{id:t.id,type:"line"},o=>C.createElement(C.Fragment,null,C.createElement(Nc,{legendPayload:yp(t)}),C.createElement(xp,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:o}),C.createElement(Ec,{type:"line",id:o,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),C.createElement(Ip,_t({},t,{id:o}))))}var ea=C.memo(Pp,_c);ea.displayName="Line";var jp=["axis"],Tp=C.forwardRef((e,t)=>C.createElement(Oc,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:jp,tooltipPayloadSearcher:Rc,categoricalChartProps:e,ref:t}));function Ap(e,t){const o=(t.getTime()-e.getTime())/24,r=Array.from({length:24},(l,c)=>{const u=new Date(e.getTime()+c*o),d=Math.floor(Math.random()*15)+5,f=c<20?d:d+Math.floor(Math.random()*20),g=Math.random()>.85?Math.floor(Math.random()*3):0,m=f>0?g/f*100:0,y=Math.floor(Math.random()*300)+100;return{t:u.toISOString(),ts:u.getTime(),label:u.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),calls:f,errors:g,errorRate:m,p95:y}}),s=r.reduce((l,c)=>l+c.calls,0),i=r.reduce((l,c)=>l+c.errors,0),a=Math.floor(r.reduce((l,c)=>l+c.p95,0)/r.length);return{totalCalls:s,totalErrors:i,avgDurationMs:a,data:r}}function Dp(){const e=se.c(3),{locator:t,org:n}=Se(),o=ye(),r=je(),s=De(),{data:i}=Te({toolCaller:r,toolName:"MONITORING_LOGS_LIST",toolInputParams:{...s,limit:750,offset:0},scope:t,staleTime:3e4}),a=i?.logs??[],l=new Date(s.startDate),c=new Date(s.endDate),u=a.length===0?Ap(l,c):Vc(a,{startDate:l,endDate:c},24,i?.total);let d;e[0]!==o||e[1]!==n.slug?(d=g=>{o(g==="errors"?{to:"/$org/monitoring",params:{org:n.slug},search:{status:"errors"}}:{to:"/$org/monitoring",params:{org:n.slug}})},e[0]=o,e[1]=n.slug,e[2]=d):d=e[2];const f=d;return h.jsx(Bc,{stats:u,chartHeight:"h-[103px]",showDateLabels:!0,dateRange:{startDate:l,endDate:c},onKPIClick:f})}const Ar={Content:Dp,Skeleton:Hc};function Lp(){const e=se.c(24),{org:t,locator:n}=Se(),o=ye();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=je(),e[0]=r):r=e[0];const s=r,i=nn()??[];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a={...De(),limit:10,offset:0},e[1]=a):a=e[1];const l=a;let c;e[2]!==n?(c={toolCaller:s,toolName:"MONITORING_LOGS_LIST",toolInputParams:l,scope:n,staleTime:3e4},e[2]=n,e[3]=c):c=e[3];const{data:u}=Te(c);let d;e[4]!==u?.logs?(d=u?.logs??[],e[4]=u?.logs,e[5]=d):d=e[5];const f=d,g=new Map(i.map($p));let m;e[6]!==o||e[7]!==t.slug?(m=E=>{o({to:"/$org/monitoring",params:{org:t.slug},search:{connectionId:[E.connectionId],tool:E.toolName}})},e[6]=o,e[7]=t.slug,e[8]=m):m=e[8];const y=m;let v;e[9]!==o||e[10]!==t.slug?(v=()=>{o({to:"/$org/monitoring",params:{org:t.slug}})},e[9]=o,e[10]=t.slug,e[11]=v):v=e[11];const x=v;let _;if(e[12]===Symbol.for("react.memo_cache_sentinel")){const E=["Google Drive","Google Sheets","Google Slides","Gmail","Google Calendar","Discord","VTEX","Google Docs","Slack","Notion","GitHub","Linear"];_=Array.from({length:10},(L,$)=>{const b=new Date(Date.now()-$*6e4),k=E[$%E.length]??"Unknown";return{id:`mock-${$}`,toolName:k,connectionId:`mock${$}`,connectionTitle:k,timestamp:b.toISOString(),durationMs:Math.floor(Math.random()*500)+100,isError:Math.random()>.9}}),e[12]=_}else _=e[12];const p=_,w=f.length===0?p:f,M=f.length===0,S=E=>{const L=g.get(E.connectionId),b=new Date(E.timestamp).toLocaleString("en-US",{month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"});return h.jsxs("div",{className:"flex items-center h-16 border-t border-border/60 hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>!M&&y(E),children:[h.jsx("div",{className:"flex items-center justify-center w-16 px-4",children:h.jsx(He,{icon:L?.icon||null,name:E.connectionTitle,size:"xs",className:"shadow-sm"})}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsx("span",{className:"text-xs font-medium text-foreground truncate block",children:E.toolName})}),h.jsxs("div",{className:"flex items-center gap-2 px-5 text-xs whitespace-nowrap",children:[h.jsxs("span",{className:"text-muted-foreground",children:[E.durationMs,"ms"]}),h.jsx("span",{className:"text-foreground",children:b})]}),h.jsx("div",{className:"flex items-center pr-5",children:h.jsx(Xc,{variant:E.isError?"destructive":"success",className:"text-xs px-2 py-1",children:E.isError?"Error":"OK"})})]},E.id)};let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Recent Activity"}),e[13]=N):N=e[13];let D;if(e[14]!==w||e[15]!==S){let E;e[17]!==S?(E=L=>S(L),e[17]=S,e[18]=E):E=e[18],D=w.map(E),e[14]=w,e[15]=S,e[16]=D}else D=e[16];let T;e[19]!==D?(T=h.jsx("div",{className:"overflow-auto",children:D}),e[19]=D,e[20]=T):T=e[20];let z;return e[21]!==x||e[22]!==T?(z=h.jsx(Ae,{title:N,onTitleClick:x,noPadding:!0,className:"min-h-0 overflow-hidden",children:T}),e[21]=x,e[22]=T,e[23]=z):z=e[23],z}function $p(e){return[e.id,e]}function zp(){const e=se.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Recent Activity"}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx(Ae,{title:t,noPadding:!0,className:"min-h-0 overflow-hidden",children:h.jsx("div",{className:"overflow-auto",children:[...Array(10)].map(Op)})}),e[1]=n):n=e[1],n}function Op(e,t){return h.jsxs("div",{className:"flex items-center h-16 border-t border-border/60",children:[h.jsx("div",{className:"flex items-center justify-center w-16 px-4",children:h.jsx("div",{className:"h-6 w-6 bg-muted animate-pulse rounded-md"})}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsx("div",{className:"h-3 w-32 bg-muted animate-pulse rounded"})}),h.jsxs("div",{className:"flex items-center gap-2 px-5",children:[h.jsx("div",{className:"h-3 w-12 bg-muted animate-pulse rounded"}),h.jsx("div",{className:"h-3 w-40 bg-muted animate-pulse rounded"})]}),h.jsx("div",{className:"flex items-center pr-5",children:h.jsx("div",{className:"h-6 w-12 bg-muted animate-pulse rounded-full"})})]},t)}const Dr={Content:Lp,Skeleton:zp};function Rp(e){const t=new Map;for(const o of e){if(!o.gatewayId)continue;const r=t.get(o.gatewayId)??{requests:0,errors:0,totalLatency:0};t.set(o.gatewayId,{requests:r.requests+1,errors:r.errors+(o.isError?1:0),totalLatency:r.totalLatency+o.durationMs})}const n=new Map;for(const[o,r]of t)n.set(o,{gatewayId:o,requests:r.requests,errors:r.errors,errorRate:r.requests>0?r.errors/r.requests*100:0,avgLatencyMs:r.requests>0?r.totalLatency/r.requests:0});return n}function Hp(e,t){switch(t){case"requests":return e.requests.toLocaleString();case"errors":return`${e.errorRate.toFixed(1)}%`;case"latency":return`${Math.round(e.avgLatencyMs)}ms`}}function Bt(e,t){switch(t){case"requests":return e.requests;case"errors":return e.errorRate;case"latency":return e.avgLatencyMs}}function Vp(e,t,n){if(t===0)return 0;const o=Bt(e,n);return Math.min(o/t*100,100)}function Bp(e){const t=se.c(24),{metricsMode:n}=e,{org:o,locator:r}=Se(),s=ye();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=je(),t[0]=i):i=t[0];const a=i;let l;t[1]===Symbol.for("react.memo_cache_sentinel")?(l=De(),t[1]=l):l=t[1];const c=l,u=Vr({pageSize:100})??[];let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d={...c,limit:1e3,offset:0},t[2]=d):d=t[2];let f;t[3]!==r?(f={toolCaller:a,toolName:"MONITORING_LOGS_LIST",toolInputParams:d,scope:r,staleTime:3e4},t[3]=r,t[4]=f):f=t[4];const{data:g}=Te(f),m=g?.logs??[],y=m.length===0?Array.from({length:50},Gp):[],v=m.length===0?y:m,x=Rp(v);let _;t[5]!==n?(_=(A,P)=>Bt(P.metric,n)-Bt(A.metric,n),t[5]=n,t[6]=_):_=t[6];const p=u.map(A=>({gateway:A,metric:x.get(A.id)})).filter(Fp).sort(_).slice(0,6),w=p[0]?.metric,M=w?Bt(w,n):1;let S;t[7]!==n||t[8]!==s||t[9]!==o.slug?(S=A=>{s({to:"/$org/monitoring",params:{org:o.slug},search:{from:"now-24h",to:"now",gatewayId:[A],...n==="errors"&&{status:"errors"}}})},t[7]=n,t[8]=s,t[9]=o.slug,t[10]=S):S=t[10];const N=S;let D;t[11]!==s||t[12]!==o.slug?(D=()=>{s({to:"/$org/gateways",params:{org:o.slug}})},t[11]=s,t[12]=o.slug,t[13]=D):D=t[13];const T=D,z=n==="requests"?"bg-chart-1":n==="errors"?"bg-chart-3":"bg-chart-4";let E;t[14]===Symbol.for("react.memo_cache_sentinel")?(E=h.jsx("div",{className:"border-t border-border/60"}),t[14]=E):E=t[14];const L=Ae;let $;t[15]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Hubs"}),t[15]=$):$=t[15];const b=p.length===0?h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"No gateway activity in the last 24 hours"}):h.jsx("div",{className:"space-y-3 w-full",children:p.map(A=>{const{gateway:P,metric:j}=A,O=Vp(j,M,n);return h.jsxs("div",{className:"group cursor-pointer flex items-center gap-2",onClick:()=>N(P.id),children:[h.jsx(He,{icon:P.icon,name:P.title,size:"xs",fallbackIcon:h.jsx(Hr,{}),className:"shrink-0"}),h.jsx("span",{className:"text-xs font-medium text-foreground truncate min-w-0 w-32",children:P.title}),h.jsx("div",{className:"relative h-2 bg-muted/50 overflow-hidden flex-1",children:h.jsx("div",{className:`h-full transition-all duration-500 ease-out group-hover:opacity-80 ${z}`,style:{width:`${O}%`}})}),h.jsx("span",{className:"text-xs tabular-nums shrink-0 text-foreground font-normal",children:Hp(j,n)})]},P.id)})});let k;t[16]!==L||t[17]!==T||t[18]!==b||t[19]!==$?(k=h.jsx(L,{title:$,onTitleClick:T,children:b}),t[16]=L,t[17]=T,t[18]=b,t[19]=$,t[20]=k):k=t[20];let I;return t[21]!==k||t[22]!==E?(I=h.jsxs(h.Fragment,{children:[E,k]}),t[21]=k,t[22]=E,t[23]=I):I=t[23],I}function Fp(e){return e.metric}function Gp(e,t){return{id:`mock-${t}`,gatewayId:"mock-gateway-1",connectionId:"",connectionTitle:"",toolName:"COLLECTION_LLM_LIST",isError:Math.random()>.95,errorMessage:null,durationMs:Math.floor(Math.random()*400)+100,timestamp:new Date().toISOString()}}function Xp(){const e=se.c(3);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=h.jsx("div",{className:"border-t border-border/60"}),e[0]=t):t=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Hubs"}),e[1]=n):n=e[1];let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsxs(h.Fragment,{children:[t,h.jsx(Ae,{title:n,children:h.jsx("div",{className:"space-y-3 w-full",children:Array.from({length:5}).map(Yp)})})]}),e[2]=o):o=e[2],o}function Yp(e,t){return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"h-6 w-6 bg-muted animate-pulse rounded-md shrink-0"}),h.jsx("div",{className:"h-3 w-32 bg-muted animate-pulse rounded shrink-0"}),h.jsx("div",{className:"h-2 bg-muted animate-pulse flex-1"}),h.jsx("div",{className:"h-3 w-12 bg-muted animate-pulse rounded shrink-0"})]},t)}const Lr={Content:Bp,Skeleton:Xp};function qp(e){const t=new Map;for(const o of e){if(!o.connectionId)continue;const r=t.get(o.connectionId)??{requests:0,errors:0,totalLatency:0};t.set(o.connectionId,{requests:r.requests+1,errors:r.errors+(o.isError?1:0),totalLatency:r.totalLatency+o.durationMs})}const n=new Map;for(const[o,r]of t)n.set(o,{connectionId:o,requests:r.requests,errors:r.errors,errorRate:r.requests>0?r.errors/r.requests*100:0,avgLatencyMs:r.requests>0?r.totalLatency/r.requests:0});return n}function Wp(e,t){switch(t){case"requests":return e.requests.toLocaleString();case"errors":return`${e.errorRate.toFixed(1)}%`;case"latency":return`${Math.round(e.avgLatencyMs)}ms`}}function Ft(e,t){switch(t){case"requests":return e.requests;case"errors":return e.errorRate;case"latency":return e.avgLatencyMs}}function Zp(e,t,n){if(t===0)return 0;const o=Ft(e,n);return Math.min(o/t*100,100)}function Kp(e){const t=se.c(24),{metricsMode:n,onMetricsModeChange:o}=e,{org:r,locator:s}=Se(),i=ye();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=je(),t[0]=a):a=t[0];const l=a;let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=De(),t[1]=c):c=t[1];const u=c,d=nn({pageSize:100})??[];let f;t[2]===Symbol.for("react.memo_cache_sentinel")?(f={...u,limit:1e3,offset:0},t[2]=f):f=t[2];let g;t[3]!==s?(g={toolCaller:l,toolName:"MONITORING_LOGS_LIST",toolInputParams:f,scope:s,staleTime:3e4},t[3]=s,t[4]=g):g=t[4];const{data:m}=Te(g),y=m?.logs??[],v=y.length===0?Array.from({length:100},Qp):[],x=y.length===0?v:y,_=qp(x);let p;t[5]!==n?(p=(A,P)=>Ft(P.metric,n)-Ft(A.metric,n),t[5]=n,t[6]=p):p=t[6];const w=d.map(A=>({connection:A,metric:_.get(A.id)})).filter(Up).sort(p).slice(0,6),M=w[0]?.metric,S=M?Ft(M,n):1;let N;t[7]!==n||t[8]!==i||t[9]!==r.slug?(N=A=>{i({to:"/$org/monitoring",params:{org:r.slug},search:{from:"now-24h",to:"now",connectionId:[A],...n==="errors"&&{status:"errors"}}})},t[7]=n,t[8]=i,t[9]=r.slug,t[10]=N):N=t[10];const D=N;let T;t[11]!==i||t[12]!==r.slug?(T=()=>{i({to:"/$org/mcps",params:{org:r.slug}})},t[11]=i,t[12]=r.slug,t[13]=T):T=t[13];const z=T,E=n==="requests"?"bg-chart-1":n==="errors"?"bg-chart-3":"bg-chart-4",L=Ae;let $;t[14]===Symbol.for("react.memo_cache_sentinel")?($=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Connections"}),t[14]=$):$=t[14];let b;t[15]!==n||t[16]!==o?(b=o?h.jsxs(ds,{type:"single",value:n,onValueChange:A=>A&&o(A),variant:"outline",size:"sm",children:[h.jsx(Ze,{value:"requests",className:"text-xs px-2 cursor-pointer",children:"Calls"}),h.jsx(Ze,{value:"errors",className:"text-xs px-2 cursor-pointer",children:"Errors"}),h.jsx(Ze,{value:"latency",className:"text-xs px-2 cursor-pointer",children:"Latency"})]}):null,t[15]=n,t[16]=o,t[17]=b):b=t[17];const k=w.length===0?h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"No server activity in the last 24 hours"}):h.jsx("div",{className:"space-y-3 w-full",children:w.map(A=>{const{connection:P,metric:j}=A,O=Zp(j,S,n);return h.jsxs("div",{className:"group cursor-pointer flex items-center gap-2",onClick:()=>D(P.id),children:[h.jsx(He,{icon:P.icon,name:P.title,size:"xs",fallbackIcon:h.jsx(Gt,{}),className:"shrink-0"}),h.jsx("span",{className:"text-xs font-medium text-foreground truncate min-w-0 w-32",children:P.title}),h.jsx("div",{className:"relative h-2 bg-muted/50 overflow-hidden flex-1",children:h.jsx("div",{className:`h-full transition-all duration-500 ease-out group-hover:opacity-80 ${E}`,style:{width:`${O}%`}})}),h.jsx("span",{className:"text-xs tabular-nums shrink-0 text-foreground font-normal",children:Wp(j,n)})]},P.id)})});let I;return t[18]!==L||t[19]!==z||t[20]!==k||t[21]!==$||t[22]!==b?(I=h.jsx(L,{title:$,onTitleClick:z,action:b,children:k}),t[18]=L,t[19]=z,t[20]=k,t[21]=$,t[22]=b,t[23]=I):I=t[23],I}function Up(e){return e.metric}function Qp(e,t){return{id:`mock-${t}`,connectionId:["mock-1","mock-2","mock-3","mock-4"][t%4]||"mock-1",connectionTitle:"",toolName:"COLLECTION_LLM_LIST",isError:Math.random()>.9,errorMessage:null,durationMs:Math.floor(Math.random()*500)+100,timestamp:new Date().toISOString()}}function Jp(){const e=se.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Connections"}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsx(Ae,{title:t,children:h.jsx("div",{className:"space-y-3 w-full",children:Array.from({length:5}).map(e0)})}),e[1]=n):n=e[1],n}function e0(e,t){return h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"h-6 w-6 bg-muted animate-pulse rounded-md shrink-0"}),h.jsx("div",{className:"h-3 w-32 bg-muted animate-pulse rounded shrink-0"}),h.jsx("div",{className:"h-2 bg-muted animate-pulse flex-1"}),h.jsx("div",{className:"h-3 w-12 bg-muted animate-pulse rounded shrink-0"})]},t)}const $r={Content:Kp,Skeleton:Jp};function t0(e,t,n,o=10){const s=t.getTime(),a=(n.getTime()-s)/24,l=new Map;for(const m of e){const y=m.toolName||"Unknown",v=l.get(y);l.set(y,{count:(v?.count??0)+1,connectionId:v?.connectionId||m.connectionId})}const c=[...l.entries()].sort((m,y)=>y[1].count-m[1].count).slice(0,o).map(([m,y])=>({name:m,connectionId:y.connectionId})),u=[],d=c.map(m=>m.name);for(let m=0;m<24;m++){const y=new Date(s+m*a),v={t:y.toISOString(),ts:y.getTime(),label:y.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})};for(const x of d)v[x]=0;u.push(v)}for(const m of e){const y=new Date(m.timestamp).getTime(),v=Math.floor((y-s)/a),x=Math.max(0,Math.min(23,v)),_=u[x];if(!_)continue;const p=m.toolName||"Unknown";d.includes(p)&&(_[p]=_[p]+1)}const f={},g=new Map;return c.forEach((m,y)=>{const x=`var(--chart-${y%5+1})`;g.set(m.name,x),f[m.name]={label:m.name,color:x}}),{buckets:u,topTools:c,chartConfig:f,toolColors:g}}function n0(e){const t=se.c(4),{org:n,locator:o}=Se(),r=ye(),s=je(),i=De(),a=nn()??[],{data:l}=Te({toolCaller:s,toolName:"MONITORING_LOGS_LIST",toolInputParams:{...i,limit:2e3,offset:0},scope:o,staleTime:3e4}),c=l?.logs??[],u=new Date(i.startDate),d=new Date(i.endDate),f=c.length===0?Array.from({length:150},(N,D)=>({id:`mock-${D}`,toolName:["COLLECTION_LLM_LIST","COLLECTION_REGISTRY_APP_LIST","microsoft_docs_search","MCP_CONFIGURATION"][D%4]||"COLLECTION_LLM_LIST",connectionId:`mock-conn-${D%4}`,connectionTitle:"Mock Connection",isError:!1,errorMessage:null,durationMs:Math.floor(Math.random()*300)+100,timestamp:new Date(u.getTime()+Math.random()*(d.getTime()-u.getTime())).toISOString()})):[],g=c.length===0?f:c,{buckets:m,topTools:y,chartConfig:v,toolColors:x}=t0(g,u,d,10),_=new Map(a.map(r0));let p;t[0]!==r||t[1]!==n.slug?(p=()=>{r({to:"/$org/monitoring",params:{org:n.slug}})},t[0]=r,t[1]=n.slug,t[2]=p):p=t[2];const w=p,M=o0;let S;return t[3]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx("p",{className:"text-sm text-muted-foreground",children:"Top Tools"}),t[3]=S):S=t[3],h.jsx(Ae,{title:h.jsxs("div",{className:"flex flex-col gap-1.5",children:[S,h.jsx("div",{className:"flex items-center gap-3",children:y.slice(0,3).map(N=>{const D=_.get(N.connectionId||"");return h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx(He,{icon:D?.icon||null,name:N.name,size:"xs",fallbackIcon:h.jsx(Gt,{}),className:"shrink-0 !size-4 !min-w-4 aspect-square rounded-sm"}),h.jsx("span",{className:"text-[10px] text-foreground truncate max-w-32",children:N.name})]},N.name)})})]}),onTitleClick:w,children:y.length===0?h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"No tool activity in the last 24 hours"}):h.jsxs("div",{className:"flex flex-col gap-2 w-full h-full cursor-pointer hover:opacity-80 transition-opacity",children:[h.jsx(Fc,{className:"flex-1 min-h-0 max-h-[120px] w-full",config:v,children:h.jsxs(Tp,{data:m,margin:{left:0,right:0,top:5,bottom:5},children:[h.jsx(Gc,{content:N=>{const{active:D,payload:T}=N;if(!D||!T||T.length===0)return null;const z=T[0]&&typeof T[0]=="object"&&"payload"in T[0]?T[0].payload?.label??"":"";return h.jsxs("div",{className:"rounded-lg border bg-background p-2 shadow-sm",children:[h.jsx("div",{className:"mb-1.5 text-xs text-muted-foreground",children:z}),h.jsx("div",{className:"flex flex-col gap-1",children:T.map(E=>{if(!E.value||E.value===0)return null;const L=y.find(b=>b.name===E.dataKey),$=_.get(L?.connectionId||"");return h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("div",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:E.color}}),h.jsx(He,{icon:$?.icon||null,name:E.dataKey,size:"xs",fallbackIcon:h.jsx(Gt,{}),className:"shrink-0"}),h.jsxs("span",{className:"text-xs font-medium",children:[E.dataKey,":"]}),h.jsx("span",{className:"text-xs font-bold",children:E.value})]},E.dataKey)})})]})}}),y.map(N=>h.jsx(ea,{type:"monotone",dataKey:N.name,stroke:x.get(N.name),strokeWidth:2,dot:!1,activeDot:{r:4}},N.name))]})}),h.jsxs("div",{className:"flex items-start justify-between text-xs text-muted-foreground w-full",children:[h.jsx("p",{children:M(u)}),h.jsx("p",{children:M(d)})]})]})})}function o0(e){return e.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function r0(e){return[e.id,e]}function s0(){const e=se.c(4);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=h.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"}),e[0]=t):t=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=h.jsxs("div",{className:"flex flex-col gap-1.5",children:[t,h.jsx("div",{className:"flex items-center gap-2",children:Array.from({length:3}).map(i0)})]}),e[1]=n):n=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=h.jsx("div",{className:"flex-1 min-h-0 max-h-[120px] w-full rounded bg-muted animate-pulse"}),e[2]=o):o=e[2];let r;return e[3]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx(Ae,{title:n,children:h.jsxs("div",{className:"flex flex-col gap-2 w-full h-full",children:[o,h.jsxs("div",{className:"flex items-start justify-between w-full",children:[h.jsx("div",{className:"h-4 w-16 rounded bg-muted animate-pulse"}),h.jsx("div",{className:"h-4 w-16 rounded bg-muted animate-pulse"})]})]})}),e[3]=r):r=e[3],r}function i0(e,t){return h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("div",{className:"size-4 aspect-square rounded-md bg-muted animate-pulse"}),h.jsx("div",{className:"h-2.5 w-16 rounded bg-muted animate-pulse"})]},t)}const zr={Content:n0,Skeleton:s0};function a0(){const e=se.c(21),{org:t,locator:n}=Se(),o=ye();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=je(),e[0]=r):r=e[0];const s=r;let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=De(),e[1]=i):i=e[1];const a=i;let l;e[2]!==n?(l={toolCaller:s,toolName:"MONITORING_STATS",toolInputParams:a,scope:n,staleTime:6e4,refetchInterval:c0},e[2]=n,e[3]=l):l=e[3];const{data:c}=Te(l);if(rn(c))return null;let u;e[4]!==o||e[5]!==t.slug?(u=()=>{o({to:"/$org/mcps",params:{org:t.slug},search:{action:"create"}})},e[4]=o,e[5]=t.slug,e[6]=u):u=e[6];const d=u;let f;e[7]!==o||e[8]!==t.slug?(f=()=>{o({to:"/$org/store",params:{org:t.slug}})},e[7]=o,e[8]=t.slug,e[9]=f):f=e[9];const g=f;let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx("div",{className:"p-2",children:h.jsx("div",{className:"bg-muted border border-border rounded-lg h-[250px] overflow-hidden flex items-center justify-center",children:h.jsx("img",{src:"/empty-state-home.png",alt:"MCP Mesh illustration",className:"w-full h-full object-cover"})})}),e[10]=m):m=e[10];let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsxs("div",{className:"px-6 py-6 space-y-2",children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Welcome to your MCP Mesh"}),h.jsx("p",{className:"text-sm text-muted-foreground leading-normal",children:"Connect your first Connection to unlock real-time metrics, activity logs, and analytics right here on your home."})]}),e[11]=y):y=e[11];let v;e[12]===Symbol.for("react.memo_cache_sentinel")?(v=h.jsx(ts,{size:16}),e[12]=v):v=e[12];let x;e[13]!==g?(x=h.jsxs(An,{onClick:g,size:"default",children:[v,"Browse Store"]}),e[13]=g,e[14]=x):x=e[14];let _;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=h.jsx(Rr,{size:16}),e[15]=_):_=e[15];let p;e[16]!==d?(p=h.jsxs(An,{variant:"outline",onClick:d,size:"default",children:[_,"Custom Connection"]}),e[16]=d,e[17]=p):p=e[17];let w;return e[18]!==p||e[19]!==x?(w=h.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-4 bg-background/80 backdrop-blur-[3px] z-10",children:h.jsxs("div",{className:"max-w-md w-full bg-background rounded-xl border border-border shadow-lg pointer-events-auto overflow-hidden",children:[m,y,h.jsxs("div",{className:"border-t border-border px-4 py-4 flex items-center justify-center gap-2",children:[x,p]})]})}),e[18]=p,e[19]=x,e[20]=w):w=e[20],w}function c0(e){return rn(e.state.data)?!1:1e3}function l0(e){const t=se.c(21),{metricsMode:n,onMetricsModeChange:o}=e;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground",children:"Failed to load monitoring stats"}),t[0]=r):r=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=h.jsx("div",{className:"lg:col-span-2",children:h.jsx(Ye,{fallback:r,children:h.jsx(C.Suspense,{fallback:h.jsx(Ar.Skeleton,{}),children:h.jsx(Ar.Content,{})})})}),t[1]=s):s=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground",children:"Failed to load recent activity"}),t[2]=i):i=t[2];let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=h.jsx("div",{className:"lg:col-span-1 lg:row-span-3 bg-background grid",children:h.jsx(Ye,{fallback:i,children:h.jsx(C.Suspense,{fallback:h.jsx(Dr.Skeleton,{}),children:h.jsx(Dr.Content,{})})})}),t[3]=a):a=t[3];let l;t[4]===Symbol.for("react.memo_cache_sentinel")?(l=h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground",children:"Failed to load top tools"}),t[4]=l):l=t[4];let c;t[5]===Symbol.for("react.memo_cache_sentinel")?(c=h.jsx(zr.Skeleton,{}),t[5]=c):c=t[5];let u;t[6]!==n?(u=h.jsx("div",{className:"lg:col-span-1 lg:row-span-1 bg-background",children:h.jsx(Ye,{fallback:l,children:h.jsx(C.Suspense,{fallback:c,children:h.jsx(zr.Content,{metricsMode:n})})})}),t[6]=n,t[7]=u):u=t[7];let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground",children:"Failed to load top servers"}),t[8]=d):d=t[8];let f;t[9]===Symbol.for("react.memo_cache_sentinel")?(f=h.jsx($r.Skeleton,{}),t[9]=f):f=t[9];let g;t[10]!==n||t[11]!==o?(g=h.jsx("div",{className:"lg:col-span-1 lg:row-span-1 bg-background",children:h.jsx(Ye,{fallback:d,children:h.jsx(C.Suspense,{fallback:f,children:h.jsx($r.Content,{metricsMode:n,onMetricsModeChange:o})})})}),t[10]=n,t[11]=o,t[12]=g):g=t[12];let m;t[13]===Symbol.for("react.memo_cache_sentinel")?(m=h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground",children:"Failed to load top gateways"}),t[13]=m):m=t[13];let y;t[14]===Symbol.for("react.memo_cache_sentinel")?(y=h.jsx(Lr.Skeleton,{}),t[14]=y):y=t[14];let v;t[15]!==n?(v=h.jsx("div",{className:"lg:col-span-1 lg:row-span-1 bg-background",children:h.jsx(Ye,{fallback:m,children:h.jsx(C.Suspense,{fallback:y,children:h.jsx(Lr.Content,{metricsMode:n})})})}),t[15]=n,t[16]=v):v=t[16];let x;return t[17]!==g||t[18]!==v||t[19]!==u?(x=h.jsx("div",{className:"w-full",children:h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-[0.5px] bg-border",children:[s,a,u,g,v]})}),t[17]=g,t[18]=v,t[19]=u,t[20]=x):x=t[20],x}function O0(){const e=se.c(30),{org:t,locator:n}=Se(),o=ye();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=je(),e[0]=r):r=e[0];const s=r;let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=De(),e[1]=i):i=e[1];const a=i,[l,c]=C.useState(d0),[u,d]=C.useState("requests");let f;e[2]!==n?(f={toolCaller:s,toolName:"MONITORING_STATS",toolInputParams:a,scope:n,staleTime:6e4,refetchInterval:u0},e[2]=n,e[3]=f):f=e[3];const{data:g}=Te(f);let m;e[4]!==g?(m=rn(g),e[4]=g,e[5]=m):m=e[5];const y=m;let v;e[6]===Symbol.for("react.memo_cache_sentinel")?(v=L=>{c(L),localStorage.setItem("org-home-view-mode",L)},e[6]=v):v=e[6];const x=v;let _;e[7]!==o||e[8]!==t.slug?(_=()=>{o({to:"/$org/mcps",params:{org:t.slug},search:{action:"create"}})},e[7]=o,e[8]=t.slug,e[9]=_):_=e[9];const p=_;let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=h.jsx(a0,{}),e[10]=w):w=e[10];let M;e[11]!==y||e[12]!==l?(M=y&&h.jsx(hc,{value:l,onValueChange:x,size:"sm",options:[{value:"dashboard",icon:h.jsx(es,{})},{value:"graph",icon:h.jsx(mc,{})}]}),e[11]=y,e[12]=l,e[13]=M):M=e[13];let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=h.jsx(Rr,{size:16}),e[14]=S):S=e[14];let N;e[15]!==p?(N=h.jsxs(An,{variant:"outline",size:"sm",onClick:p,children:[S,"Connect MCP Server"]}),e[15]=p,e[16]=N):N=e[16];let D;e[17]!==M||e[18]!==N?(D=h.jsxs("div",{className:"flex items-center gap-2",children:[M,N]}),e[17]=M,e[18]=N,e[19]=D):D=e[19];let T;e[20]!==t.name||e[21]!==D?(T=h.jsx(dc,{title:t.name,ctaButton:D}),e[20]=t.name,e[21]=D,e[22]=T):T=e[22];let z;e[23]!==u||e[24]!==y||e[25]!==l?(z=h.jsx("div",{className:"flex-1 overflow-auto relative",children:l==="graph"?h.jsx(Ye,{fallback:h.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground h-full flex items-center justify-center",children:"Failed to load mesh visualization"}),children:h.jsx(C.Suspense,{fallback:h.jsx(Vg,{}),children:h.jsx(Og,{showControls:y})})}):h.jsx(l0,{metricsMode:u,onMetricsModeChange:d})}),e[23]=u,e[24]=y,e[25]=l,e[26]=z):z=e[26];let E;return e[27]!==T||e[28]!==z?(E=h.jsxs(fc,{children:[w,T,z]}),e[27]=T,e[28]=z,e[29]=E):E=e[29],E}function u0(e){return rn(e.state.data)?!1:1e3}function d0(){const e=localStorage.getItem("org-home-view-mode");return e==="dashboard"||e==="graph"?e:"dashboard"}export{O0 as default};