@decocms/mesh 2.14.0 → 2.15.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 (151) hide show
  1. package/dist/client/assets/{AlertCircle-DeHvJZzp.js → AlertCircle-CIFhWg2i.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-Dan_IIKP.js → ArrowLeft-D0vIuW0V.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-B2eKsIZo.js → ArrowUp-MjJJcV-O.js} +1 -1
  4. package/dist/client/assets/{Check-VfxUlV5P.js → Check-LvJ1lSFr.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-OK90XtVB.js → ChevronDown-QF_Tgl2v.js} +1 -1
  6. package/dist/client/assets/{Clock-CRgmR_1n.js → Clock-CiIkKpUg.js} +1 -1
  7. package/dist/client/assets/{Code01-B9DNMb5j.js → Code01-Du8Lx-Uw.js} +1 -1
  8. package/dist/client/assets/{Copy01-dbjgqDL6.js → Copy01-CunLN8rc.js} +1 -1
  9. package/dist/client/assets/{DotsHorizontal-BpvBcoMa.js → DotsHorizontal-WE50knOB.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-XnGZcIeo.js → DotsVertical-CuQjcY-h.js} +1 -1
  11. package/dist/client/assets/{Download01-C8jw9jFZ.js → Download01-syi4c4iH.js} +1 -1
  12. package/dist/client/assets/{Edit01-Ddbn6DsS.js → Edit01-DVUwOcf8.js} +1 -1
  13. package/dist/client/assets/{File06-DCHrHfbn.js → File06-BM3BX-NC.js} +1 -1
  14. package/dist/client/assets/{FilterLines-BzWlfPby.js → FilterLines-DS1pmySA.js} +1 -1
  15. package/dist/client/assets/{FlipBackward-Bum_Ktlp.js → FlipBackward-BKppcJN9.js} +1 -1
  16. package/dist/client/assets/{GitBranch01-CVAiK8ZD.js → GitBranch01-C3ShOPmQ.js} +1 -1
  17. package/dist/client/assets/{Grid01-AMlhaaWH.js → Grid01-DwtrqYPx.js} +1 -1
  18. package/dist/client/assets/{Home02-CnvrJTir.js → Home02-DlsAgg82.js} +1 -1
  19. package/dist/client/assets/{Image01-Bch9iOev.js → Image01-Bw2o5F05.js} +1 -1
  20. package/dist/client/assets/{Inbox01-y9RgqkXP.js → Inbox01-CSDhYGLL.js} +1 -1
  21. package/dist/client/assets/{InfoCircle-HrYndWCZ.js → InfoCircle-xFKFZGrj.js} +1 -1
  22. package/dist/client/assets/{Key01-DS2WWoiQ.js → Key01-S9eZFu7R.js} +1 -1
  23. package/dist/client/assets/{LinkExternal01-DzBB4jwo.js → LinkExternal01-Dbxh7ZV2.js} +1 -1
  24. package/dist/client/assets/{List-BDW462gC.js → List-D2PJPXod.js} +1 -1
  25. package/dist/client/assets/{Loading01-OB_JRXd5.js → Loading01-BhuF3K1g.js} +1 -1
  26. package/dist/client/assets/{Lock01-B_KYH87b.js → Lock01-jUZQmYfl.js} +1 -1
  27. package/dist/client/assets/{Play-VfPQ9yON.js → Play-BxDRmyN-.js} +1 -1
  28. package/dist/client/assets/{Plus-CgcZFggs.js → Plus-DCVckKM0.js} +1 -1
  29. package/dist/client/assets/{SearchMd-DRJ07Awx.js → SearchMd-tLR3QB8E.js} +1 -1
  30. package/dist/client/assets/{Terminal-FTJQx4pc.js → Terminal-DwE3k3eb.js} +1 -1
  31. package/dist/client/assets/{Trash01-BDWyzvD2.js → Trash01-Dg5Q9OUO.js} +1 -1
  32. package/dist/client/assets/{Upload01-CB1SFmVO.js → Upload01-BJUxi5ck.js} +1 -1
  33. package/dist/client/assets/{X-CVhiWYv-.js → X-DKF1oh5v.js} +1 -1
  34. package/dist/client/assets/{XClose-C895iFVX.js → XClose-BACMQGhN.js} +1 -1
  35. package/dist/client/assets/{alert-dialog-D9k51qgG.js → alert-dialog-BryTAX-J.js} +2 -2
  36. package/dist/client/assets/{auth-catchall-BDKZr3VK.js → auth-catchall-B3H5JOvc.js} +1 -1
  37. package/dist/client/assets/{avatar-BLmwViC3.js → avatar-BtMYdv0U.js} +1 -1
  38. package/dist/client/assets/{badge-CMZTNGZo.js → badge-Do7WFlPI.js} +1 -1
  39. package/dist/client/assets/{binder-Bcr51BHa.js → binder-B3GXUIAu.js} +1 -1
  40. package/dist/client/assets/{button-2azNqzUx.js → button-ClkQLR3o.js} +1 -1
  41. package/dist/client/assets/{card-WAuUk8Uz.js → card-CwMKn79y.js} +1 -1
  42. package/dist/client/assets/{checkbox-E6g3eWVz.js → checkbox-C6hBycBx.js} +1 -1
  43. package/dist/client/assets/{collection-detail-DiFfTEhG.js → collection-detail-C-m2H10s.js} +2 -2
  44. package/dist/client/assets/{collection-display-button-B3beugJ4.js → collection-display-button-CdHXoeVD.js} +1 -1
  45. package/dist/client/assets/{collection-header-MCgfYSgE.js → collection-header-CeBQhXWy.js} +1 -1
  46. package/dist/client/assets/{collection-page-CB_Az4GO.js → collection-page-pMUw63Yr.js} +1 -1
  47. package/dist/client/assets/{collection-search-DL-7oL5d.js → collection-search-CF1o4yO7.js} +1 -1
  48. package/dist/client/assets/{collection-tab-C_pl92IS.js → collection-tab-ChPNT80-.js} +1 -1
  49. package/dist/client/assets/{collection-table-wrapper-CAH6fKB1.js → collection-table-wrapper-jfSAC6dF.js} +1 -1
  50. package/dist/client/assets/{connection-CXC8d3Ae.js → connection-BcYehfdK.js} +2 -2
  51. package/dist/client/assets/{connection-card-BTOP5EHD.js → connection-card-DO3ahSdV.js} +1 -1
  52. package/dist/client/assets/connection-detail-i_lj-oMr.js +1 -0
  53. package/dist/client/assets/{connections-Cm-7oBJu.js → connections-CMzrwOZS.js} +1 -1
  54. package/dist/client/assets/constants-BIwbIZhE.js +1 -0
  55. package/dist/client/assets/create-organization-dialog-BydMMM5g.js +1 -0
  56. package/dist/client/assets/{dialog-DSU0GEtE.js → dialog-Y0g8yyzz.js} +1 -1
  57. package/dist/client/assets/{dropdown-menu-DRkETp4T.js → dropdown-menu-C4Ypstre.js} +1 -1
  58. package/dist/client/assets/{dynamic-plugin-layout-CXggkl7m.js → dynamic-plugin-layout-Cds2rM_Z.js} +1 -1
  59. package/dist/client/assets/{empty-state-C3NzxCFI.js → empty-state-C0gi-aAx.js} +1 -1
  60. package/dist/client/assets/{empty-state-DKa1iDdq.js → empty-state-Dx0NLAxy.js} +1 -1
  61. package/dist/client/assets/env-vars-editor-GTn7Eu5T.js +1 -0
  62. package/dist/client/assets/{error-boundary-DU6_J5et.js → error-boundary-D2ZJQHnD.js} +1 -1
  63. package/dist/client/assets/extract-connection-data-nsOyk4eb.js +1 -0
  64. package/dist/client/assets/{file-browser-B8xb3wGm.js → file-browser-s8pLbWaW.js} +2 -2
  65. package/dist/client/assets/{form-DM9msJYn.js → form-DDdl0439.js} +1 -1
  66. package/dist/client/assets/{gateway-detail-6QzPV4MT.js → gateway-detail-NHGkjgTy.js} +1 -1
  67. package/dist/client/assets/{gateways-DcbIYmOg.js → gateways-Bv1uyRdE.js} +1 -1
  68. package/dist/client/assets/{grid-view-DjeV3XAc.js → grid-view-DNPq1Y__.js} +1 -1
  69. package/dist/client/assets/{home-BkFYrMbJ.js → home-9eTtEa0h.js} +1 -1
  70. package/dist/client/assets/{index-Dk3lubBQ.js → index-C5FDJtAp.js} +2 -2
  71. package/dist/client/assets/index-Cbsnfme0.js +25 -0
  72. package/dist/client/assets/{index-BQiKVu3k.js → index-D6aVJNvm.js} +1 -1
  73. package/dist/client/assets/{index-CYR9-1-4.js → index-DqVdeyIE.js} +1 -1
  74. package/dist/client/assets/index-JAPwCHXJ.css +1 -0
  75. package/dist/client/assets/index-hEHbC4y4.js +88 -0
  76. package/dist/client/assets/{infiniteQueryObserver-CUXkVkPG.js → infiniteQueryObserver-BnxPLCEe.js} +1 -1
  77. package/dist/client/assets/{input-CBrhxHNe.js → input-BbWUShhD.js} +1 -1
  78. package/dist/client/assets/{layout-MOaKucBL.js → layout-BnqnCJOk.js} +1 -1
  79. package/dist/client/assets/{lazy-highlighter-C2ClCxhY.js → lazy-highlighter-BHJogLPz.js} +1 -1
  80. package/dist/client/assets/{localstorage-keys-BJk6gyyN.js → localstorage-keys-BZEjwsD0.js} +1 -1
  81. package/dist/client/assets/{login-RFCnTbJl.js → login-DGLLQl3L.js} +1 -1
  82. package/dist/client/assets/mcp-oauth-CkuEWYY4.js +1 -0
  83. package/dist/client/assets/{mcp-server-card-DYesFUUw.js → mcp-server-card-D4bCdTAY.js} +1 -1
  84. package/dist/client/assets/mcp-server-detail-Cy2l0hPz.js +1 -0
  85. package/dist/client/assets/{members-wdr88rOm.js → members-CXuNIHGD.js} +2 -2
  86. package/dist/client/assets/{monaco-editor-B2ZJ-0S4.js → monaco-editor-BnXEGbzY.js} +4 -4
  87. package/dist/client/assets/{monitoring-Cr82twHN.js → monitoring-vPlAvNfN.js} +2 -2
  88. package/dist/client/assets/{oauth-callback-BddKzzFQ.js → oauth-callback-I_aRwsB5.js} +1 -1
  89. package/dist/client/assets/{page-D_NhUEfH.js → page-DPsdZaOi.js} +1 -1
  90. package/dist/client/assets/page-fWJ76jbj.js +35 -0
  91. package/dist/client/assets/{pin-to-sidebar-button-CVN6Bdsp.js → pin-to-sidebar-button-DTR_Oj1s.js} +1 -1
  92. package/dist/client/assets/{plugin-empty-state-srmGKRQU.js → plugin-empty-state-RYQHQ0B6.js} +1 -1
  93. package/dist/client/assets/{plugin-header-Dg9-cQAj.js → plugin-header-BPW1tb_d.js} +1 -1
  94. package/dist/client/assets/{plugins-Dawnh_sQ.js → plugins-DN4-aMVD.js} +1 -1
  95. package/dist/client/assets/{popover-HE15ABOl.js → popover-DLFe45bO.js} +1 -1
  96. package/dist/client/assets/{project-context-provider-B1gr9e2f.js → project-context-provider-DH0iqA5D.js} +1 -1
  97. package/dist/client/assets/{registry-utils-COqteFH4.js → registry-utils-BPPApxjf.js} +1 -1
  98. package/dist/client/assets/{resizable-B8j7Xubf.js → resizable-C6uSLZAk.js} +1 -1
  99. package/dist/client/assets/{resource-tabs-B1oXSRkv.js → resource-tabs-CKatVKnl.js} +1 -1
  100. package/dist/client/assets/select-CSzUpxmC.js +1 -0
  101. package/dist/client/assets/{settings-Clme5cH0.js → settings-Dk6-Mm8r.js} +1 -1
  102. package/dist/client/assets/shell-layout-P7XxC3ZF.js +3 -0
  103. package/dist/client/assets/{spinner-Dwr2EFZD.js → spinner-CUAQv_4V.js} +1 -1
  104. package/dist/client/assets/{standalone-Cva4pL7v.js → standalone-Cutp_BhH.js} +1 -1
  105. package/dist/client/assets/{switch-C9XtHYD0.js → switch-ZAqg3LbP.js} +1 -1
  106. package/dist/client/assets/{textarea-CyM57U4B.js → textarea-BDJhX5-9.js} +1 -1
  107. package/dist/client/assets/{tool-set-selector-B9-4X5pd.js → tool-set-selector-D26m7PpE.js} +1 -1
  108. package/dist/client/assets/{tools-list-DJqzZm19.js → tools-list-pl3Bsjpf.js} +1 -1
  109. package/dist/client/assets/{tooltip-DHS6wGWv.js → tooltip-DXYcokUT.js} +1 -1
  110. package/dist/client/assets/use-binding-Cmi2FEqF.js +23 -0
  111. package/dist/client/assets/{use-collections-CbsNEj5T.js → use-collections-DxMxR_jZ.js} +1 -1
  112. package/dist/client/assets/{use-connection-BhdfednN.js → use-connection-ClVfoZWG.js} +1 -1
  113. package/dist/client/assets/{use-connection-resources-D6kK3b1i.js → use-connection-resources-nXRlJNhx.js} +1 -1
  114. package/dist/client/assets/{use-create-gateway-dtd5LmVR.js → use-create-gateway-UkmAQbcu.js} +1 -1
  115. package/dist/client/assets/{use-gateway-Ck94EUZ3.js → use-gateway-D_zdUoI4.js} +1 -1
  116. package/dist/client/assets/{use-gateway-system-prompt-C9-1moLN.js → use-gateway-system-prompt-CYi0Zo4K.js} +1 -1
  117. package/dist/client/assets/{use-list-state-CQtVDn-T.js → use-list-state-G6sniPDx.js} +1 -1
  118. package/dist/client/assets/{use-mcp-C1X3fEnH.js → use-mcp-hlkUt7pz.js} +1 -1
  119. package/dist/client/assets/{use-members-Bh37cZiw.js → use-members-3RqzErHO.js} +1 -1
  120. package/dist/client/assets/{use-mobile-CuBmA9jm.js → use-mobile-DT1cwytU.js} +1 -1
  121. package/dist/client/assets/use-model-state-Bc4MpPVu.js +20 -0
  122. package/dist/client/assets/{use-organization-settings-BNK4p5TK.js → use-organization-settings-D46q7SyU.js} +1 -1
  123. package/dist/client/assets/{use-tool-call-DzBMga46.js → use-tool-call-BH-yOcTy.js} +1 -1
  124. package/dist/client/assets/useInfiniteQuery-Dl93eV8h.js +1 -0
  125. package/dist/client/assets/{useMutation-BEX5R6ly.js → useMutation-DEocBykZ.js} +1 -1
  126. package/dist/client/assets/useQuery-Dakt0IBq.js +1 -0
  127. package/dist/client/assets/{value-UH6V0tmj.js → value-C9Bb1t7X.js} +1 -1
  128. package/dist/client/assets/{view-mode-toggle-kdDPGpPT.js → view-mode-toggle-C5hz9T3M.js} +1 -1
  129. package/dist/client/assets/{workflow-DgZwuETF.js → workflow-BJoyVBBY.js} +1 -1
  130. package/dist/client/index.html +2 -2
  131. package/dist/server/cli.js +164 -157
  132. package/dist/server/migrate.js +130 -123
  133. package/dist/server/server.js +160 -153
  134. package/package.json +1 -1
  135. package/dist/client/assets/connection-detail-BHduC6at.js +0 -1
  136. package/dist/client/assets/constants-B-ATh8ff.js +0 -1
  137. package/dist/client/assets/create-organization-dialog-MS4oQ7Sl.js +0 -1
  138. package/dist/client/assets/env-vars-editor-D54i65KN.js +0 -1
  139. package/dist/client/assets/extract-connection-data-Hjw19oaR.js +0 -1
  140. package/dist/client/assets/index-C5xxIZ3a.js +0 -88
  141. package/dist/client/assets/index-DUfEAj2z.js +0 -25
  142. package/dist/client/assets/index-fFpUC2Bx.css +0 -1
  143. package/dist/client/assets/mcp-oauth-CuMRVoyP.js +0 -1
  144. package/dist/client/assets/mcp-server-detail-CBjpnL21.js +0 -1
  145. package/dist/client/assets/page-DhI0Qooi.js +0 -35
  146. package/dist/client/assets/select-DkAjMxeq.js +0 -1
  147. package/dist/client/assets/shell-layout-BuirxVot.js +0 -3
  148. package/dist/client/assets/thread-history-popover-DlGwptvV.js +0 -20
  149. package/dist/client/assets/use-binding-Cn24Ren1.js +0 -23
  150. package/dist/client/assets/useInfiniteQuery-B7UO0aOm.js +0 -1
  151. package/dist/client/assets/useQuery-BbeI5BfO.js +0 -1
@@ -1 +1 @@
1
- import{c as o,j as n}from"./index-Dk3lubBQ.js";import{c as l}from"./button-2azNqzUx.js";function u(s){const e=o.c(8);let r,i;e[0]!==s?({className:r,...i}=s,e[0]=s,e[1]=r,e[2]=i):(r=e[1],i=e[2]);let t;e[3]!==r?(t=l("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-xl border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",r),e[3]=r,e[4]=t):t=e[4];let a;return e[5]!==i||e[6]!==t?(a=n.jsx("textarea",{"data-slot":"textarea",className:t,...i}),e[5]=i,e[6]=t,e[7]=a):a=e[7],a}export{u as T};
1
+ import{c as o,j as n}from"./index-C5FDJtAp.js";import{c as l}from"./button-ClkQLR3o.js";function u(s){const e=o.c(8);let r,i;e[0]!==s?({className:r,...i}=s,e[0]=s,e[1]=r,e[2]=i):(r=e[1],i=e[2]);let t;e[3]!==r?(t=l("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-xl border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",r),e[3]=r,e[4]=t):t=e[4];let a;return e[5]!==i||e[6]!==t?(a=n.jsx("textarea",{"data-slot":"textarea",className:t,...i}),e[5]=i,e[6]=t,e[7]=a):a=e[7],a}export{u as T};
@@ -1 +1 @@
1
- import{r as v,c as z,j as t}from"./index-Dk3lubBQ.js";import{I as F}from"./empty-state-C3NzxCFI.js";import{C as I}from"./checkbox-E6g3eWVz.js";import{c as T,B as R}from"./button-2azNqzUx.js";import{i as A}from"./ArrowLeft-Dan_IIKP.js";import{u as U}from"./use-connection-BhdfednN.js";import{C as V}from"./collection-search-DL-7oL5d.js";const q=v.memo(function(S){const e=z.c(21),{connection:o,isSelected:m,hasToolsEnabled:r,activeToolsCount:h,totalToolsCount:p,onSelect:g,onToggle:x}=S,u=m?"bg-accent/50":"hover:bg-muted/50";let i;e[0]!==u?(i=T("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",u),e[0]=u,e[1]=i):i=e[1];let c;e[2]!==o.icon||e[3]!==o.title?(c=t.jsx(F,{icon:o.icon,name:o.title,size:"xs"}),e[2]=o.icon,e[3]=o.title,e[4]=c):c=e[4];let f;e[5]!==o.title?(f=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:o.title})}),e[5]=o.title,e[6]=f):f=e[6];let n;e[7]!==g||e[8]!==c||e[9]!==f?(n=t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:g,children:[c,f]}),e[7]=g,e[8]=c,e[9]=f,e[10]=n):n=e[10];let a;e[11]!==h||e[12]!==o.tools||e[13]!==r||e[14]!==x||e[15]!==p?(a=o.tools&&o.tools.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[h,"/",p]}),t.jsx(I,{checked:r,onCheckedChange:x,onClick:H})]}),e[11]=h,e[12]=o.tools,e[13]=r,e[14]=x,e[15]=p,e[16]=a):a=e[16];let N;return e[17]!==i||e[18]!==n||e[19]!==a?(N=t.jsxs("div",{className:i,children:[n,a]}),e[17]=i,e[18]=n,e[19]=a,e[20]=N):N=e[20],N}),G=v.memo(function(S){const e=z.c(18),{connectionId:o,tool:m,isSelected:r,onToggle:h}=S,p=`tool-${o}-${m.name}`,g=r?"text-foreground":"text-muted-foreground";let x;e[0]!==g?(x=T("text-sm font-medium",g),e[0]=g,e[1]=x):x=e[1];let u;e[2]!==x||e[3]!==m.name?(u=t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("span",{className:x,children:m.name})}),e[2]=x,e[3]=m.name,e[4]=u):u=e[4];let i;e[5]!==m.description?(i=m.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:m.description}),e[5]=m.description,e[6]=i):i=e[6];let c;e[7]!==u||e[8]!==i?(c=t.jsxs("div",{className:"flex-1 min-w-0",children:[u,i]}),e[7]=u,e[8]=i,e[9]=c):c=e[9];const f=`tool-${o}-${m.name}`;let n;e[10]!==r||e[11]!==h||e[12]!==f?(n=t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(I,{id:f,checked:r,onCheckedChange:h,onClick:J})}),e[10]=r,e[11]=h,e[12]=f,e[13]=n):n=e[13];let a;return e[14]!==p||e[15]!==c||e[16]!==n?(a=t.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:p,children:[c,n]}),e[14]=p,e[15]=c,e[16]=n,e[17]=a):a=e[17],a});function ee({toolSet:d,onToolSetChange:S}){const[e,o]=v.useState(""),m=v.useDeferredValue(e),[r,h]=v.useState("all"),[p,g]=v.useState(!1),x=v.useRef(new Set(Object.keys(d))),u=U({searchTerm:m.trim()||void 0}),i=x.current,c=[...i.values()].map(s=>u.find(l=>l.id===s)).filter(s=>s!==void 0),f=u.filter(s=>!i.has(s.id)),n=[...c,...f],a=s=>{const l=d[s];return l!==void 0&&l.length>0},N=n.filter(s=>{if(r==="all")return!0;const l=a(s.id);return r==="selected"?l:r==="unselected"?!l:!0}),[M,$]=v.useState(n[0]?.id??null),b=M?n.find(s=>s.id===M)??null:null,E=b?.tools??[],B=(s,l)=>d[s]?.includes(l)??!1,D=(s,l)=>{const j=d[s]??[],k=j.includes(l),w={...d};if(k){const y=j.filter(C=>C!==l);y.length===0?delete w[s]:w[s]=y}else w[s]=[...j,l];S(w)},O=s=>{const l=n.find(C=>C.id===s);if(!l?.tools)return;const j=d[s]??[],k=l.tools.map(C=>C.name),w=j.length>0&&k.every(C=>j.includes(C)),y={...d};w?delete y[s]:(y[s]=k,$(s)),S(y)},P=s=>{$(s),g(!0)},Q=()=>{g(!1)};return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:T("w-full md:w-80 border-r border-border flex flex-col",p&&"hidden md:flex"),children:[t.jsx(V,{value:e,onChange:o,placeholder:"Search MCP Servers..."}),t.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[t.jsx("button",{onClick:()=>h("all"),className:T("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),t.jsx("button",{onClick:()=>h("selected"),className:T("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),t.jsx("button",{onClick:()=>h("unselected"),className:T("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:N.length===0?t.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:e?"No connections found":r==="selected"?"No servers selected":r==="unselected"?"No unselected servers":"No connections available"}):t.jsx("div",{className:"p-2 space-y-1",children:N.map(s=>{const l=s.tools?.length??0,j=d[s.id]?.length??0;return t.jsx(q,{connection:s,isSelected:M===s.id,hasToolsEnabled:a(s.id),activeToolsCount:j,totalToolsCount:l,onSelect:()=>P(s.id),onToggle:()=>O(s.id)},s.id)})})})]}),t.jsx("div",{className:T("flex-1 flex-col",p?"flex":"hidden md:flex"),children:b?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[t.jsx(R,{variant:"ghost",size:"sm",onClick:Q,className:"h-8 w-8 p-0 shrink-0",children:t.jsx(A,{size:20})}),t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx(F,{icon:b.icon,name:b.title,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:b.title}),b.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:b.description})]})]})]}),t.jsx("div",{className:"flex-1 overflow-auto p-4",children:E.length===0?t.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):t.jsx("div",{className:"space-y-2",children:E.map(s=>t.jsx(G,{connectionId:b.id,tool:s,isSelected:B(b.id,s.name),onToggle:()=>D(b.id,s.name)},s.name))})})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function H(d){return d.stopPropagation()}function J(d){return d.stopPropagation()}export{ee as T};
1
+ import{r as v,c as z,j as t}from"./index-C5FDJtAp.js";import{I as F}from"./empty-state-C0gi-aAx.js";import{C as I}from"./checkbox-C6hBycBx.js";import{c as T,B as R}from"./button-ClkQLR3o.js";import{i as A}from"./ArrowLeft-D0vIuW0V.js";import{u as U}from"./use-connection-ClVfoZWG.js";import{C as V}from"./collection-search-CF1o4yO7.js";const q=v.memo(function(S){const e=z.c(21),{connection:o,isSelected:m,hasToolsEnabled:r,activeToolsCount:h,totalToolsCount:p,onSelect:g,onToggle:x}=S,u=m?"bg-accent/50":"hover:bg-muted/50";let i;e[0]!==u?(i=T("flex items-center gap-3 p-2 rounded-lg transition-colors will-change-auto",u),e[0]=u,e[1]=i):i=e[1];let c;e[2]!==o.icon||e[3]!==o.title?(c=t.jsx(F,{icon:o.icon,name:o.title,size:"xs"}),e[2]=o.icon,e[3]=o.title,e[4]=c):c=e[4];let f;e[5]!==o.title?(f=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:o.title})}),e[5]=o.title,e[6]=f):f=e[6];let n;e[7]!==g||e[8]!==c||e[9]!==f?(n=t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 cursor-pointer",onClick:g,children:[c,f]}),e[7]=g,e[8]=c,e[9]=f,e[10]=n):n=e[10];let a;e[11]!==h||e[12]!==o.tools||e[13]!==r||e[14]!==x||e[15]!==p?(a=o.tools&&o.tools.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[h,"/",p]}),t.jsx(I,{checked:r,onCheckedChange:x,onClick:H})]}),e[11]=h,e[12]=o.tools,e[13]=r,e[14]=x,e[15]=p,e[16]=a):a=e[16];let N;return e[17]!==i||e[18]!==n||e[19]!==a?(N=t.jsxs("div",{className:i,children:[n,a]}),e[17]=i,e[18]=n,e[19]=a,e[20]=N):N=e[20],N}),G=v.memo(function(S){const e=z.c(18),{connectionId:o,tool:m,isSelected:r,onToggle:h}=S,p=`tool-${o}-${m.name}`,g=r?"text-foreground":"text-muted-foreground";let x;e[0]!==g?(x=T("text-sm font-medium",g),e[0]=g,e[1]=x):x=e[1];let u;e[2]!==x||e[3]!==m.name?(u=t.jsx("div",{className:"flex items-center gap-2 mb-1",children:t.jsx("span",{className:x,children:m.name})}),e[2]=x,e[3]=m.name,e[4]=u):u=e[4];let i;e[5]!==m.description?(i=m.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:m.description}),e[5]=m.description,e[6]=i):i=e[6];let c;e[7]!==u||e[8]!==i?(c=t.jsxs("div",{className:"flex-1 min-w-0",children:[u,i]}),e[7]=u,e[8]=i,e[9]=c):c=e[9];const f=`tool-${o}-${m.name}`;let n;e[10]!==r||e[11]!==h||e[12]!==f?(n=t.jsx("div",{className:"flex items-center shrink-0",children:t.jsx(I,{id:f,checked:r,onCheckedChange:h,onClick:J})}),e[10]=r,e[11]=h,e[12]=f,e[13]=n):n=e[13];let a;return e[14]!==p||e[15]!==c||e[16]!==n?(a=t.jsxs("label",{className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 cursor-pointer group will-change-auto",htmlFor:p,children:[c,n]}),e[14]=p,e[15]=c,e[16]=n,e[17]=a):a=e[17],a});function ee({toolSet:d,onToolSetChange:S}){const[e,o]=v.useState(""),m=v.useDeferredValue(e),[r,h]=v.useState("all"),[p,g]=v.useState(!1),x=v.useRef(new Set(Object.keys(d))),u=U({searchTerm:m.trim()||void 0}),i=x.current,c=[...i.values()].map(s=>u.find(l=>l.id===s)).filter(s=>s!==void 0),f=u.filter(s=>!i.has(s.id)),n=[...c,...f],a=s=>{const l=d[s];return l!==void 0&&l.length>0},N=n.filter(s=>{if(r==="all")return!0;const l=a(s.id);return r==="selected"?l:r==="unselected"?!l:!0}),[M,$]=v.useState(n[0]?.id??null),b=M?n.find(s=>s.id===M)??null:null,E=b?.tools??[],B=(s,l)=>d[s]?.includes(l)??!1,D=(s,l)=>{const j=d[s]??[],k=j.includes(l),w={...d};if(k){const y=j.filter(C=>C!==l);y.length===0?delete w[s]:w[s]=y}else w[s]=[...j,l];S(w)},O=s=>{const l=n.find(C=>C.id===s);if(!l?.tools)return;const j=d[s]??[],k=l.tools.map(C=>C.name),w=j.length>0&&k.every(C=>j.includes(C)),y={...d};w?delete y[s]:(y[s]=k,$(s)),S(y)},P=s=>{$(s),g(!0)},Q=()=>{g(!1)};return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:T("w-full md:w-80 border-r border-border flex flex-col",p&&"hidden md:flex"),children:[t.jsx(V,{value:e,onChange:o,placeholder:"Search MCP Servers..."}),t.jsxs("div",{className:"flex gap-1 p-2 border-b border-border",children:[t.jsx("button",{onClick:()=>h("all"),className:T("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="all"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"All"}),t.jsx("button",{onClick:()=>h("selected"),className:T("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="selected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Selected"}),t.jsx("button",{onClick:()=>h("unselected"),className:T("flex-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors border cursor-pointer",r==="unselected"?"bg-muted border-border":"border-border opacity-75 hover:opacity-100"),children:"Unselected"})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:N.length===0?t.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:e?"No connections found":r==="selected"?"No servers selected":r==="unselected"?"No unselected servers":"No connections available"}):t.jsx("div",{className:"p-2 space-y-1",children:N.map(s=>{const l=s.tools?.length??0,j=d[s.id]?.length??0;return t.jsx(q,{connection:s,isSelected:M===s.id,hasToolsEnabled:a(s.id),activeToolsCount:j,totalToolsCount:l,onSelect:()=>P(s.id),onToggle:()=>O(s.id)},s.id)})})})]}),t.jsx("div",{className:T("flex-1 flex-col",p?"flex":"hidden md:flex"),children:b?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"md:hidden border-b border-border p-4 flex items-center gap-3",children:[t.jsx(R,{variant:"ghost",size:"sm",onClick:Q,className:"h-8 w-8 p-0 shrink-0",children:t.jsx(A,{size:20})}),t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx(F,{icon:b.icon,name:b.title,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:b.title}),b.description&&t.jsx("p",{className:"text-sm text-muted-foreground truncate",children:b.description})]})]})]}),t.jsx("div",{className:"flex-1 overflow-auto p-4",children:E.length===0?t.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"This connection has no tools available"}):t.jsx("div",{className:"space-y-2",children:E.map(s=>t.jsx(G,{connectionId:b.id,tool:s,isSelected:B(b.id,s.name),onToggle:()=>D(b.id,s.name)},s.name))})})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx("div",{className:"text-sm text-muted-foreground text-center",children:"Select a connection to view its tools"})})})]})}function H(d){return d.stopPropagation()}function J(d){return d.stopPropagation()}export{ee as T};
@@ -1 +1 @@
1
- import{K as B,j as t,c as O,f as Q,r as k}from"./index-Dk3lubBQ.js";import{u as U}from"./useQuery-BbeI5BfO.js";import{i as W}from"./File06-DCHrHfbn.js";import{i as Y}from"./Loading01-OB_JRXd5.js";import{e as J}from"./github-icon-Dp3wHhYE.js";import{C as P}from"./collection-display-button-B3beugJ4.js";import{C as X}from"./collection-search-DL-7oL5d.js";import{C as Z}from"./collection-table-wrapper-CAH6fKB1.js";import{E as z,I as ee}from"./empty-state-C3NzxCFI.js";import{C as te}from"./card-WAuUk8Uz.js";import{V as se}from"./layout-MOaKucBL.js";function oe(s){return s.replace(/<a[^>]*class="[^"]*anchor[^"]*"[^>]*>.*?<\/a>/gi,"")}function re(s){return s.replace(/<a\s+([^>]*href="[^"]*"[^>]*)>/gi,(e,i)=>i.includes("target=")?e.replace(/target="[^"]*"/gi,'target="_blank"'):`<a ${i} target="_blank" rel="noopener noreferrer">`)}function ne(s){let e=oe(s);return e=re(e),e}function we({repository:s}){const e=s?J(s):null,{data:i,isLoading:c}=U({queryKey:B.githubReadme(e?.owner,e?.repo),queryFn:async()=>{if(!e)return null;try{const l=await fetch(`https://api.github.com/repos/${e.owner}/${e.repo}/readme`,{headers:{Accept:"application/vnd.github.v3.html"}});if(!l.ok){if(l.status===404)return null;throw new Error(`Failed to fetch README: ${l.statusText}`)}const m=await l.text();return ne(m)}catch(l){return console.error("Error fetching README:",l),null}},enabled:!!e&&!!s,staleTime:3600*1e3,gcTime:1440*60*1e3});return c?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(Y,{size:32,className:"animate-spin text-muted-foreground"})}):i?t.jsx("div",{className:"p-5 markdown-body",style:{backgroundColor:"transparent"},dangerouslySetInnerHTML:{__html:i}}):t.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-6",children:[t.jsx(W,{size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"README not found"}),t.jsx("p",{className:"text-muted-foreground max-w-md",children:"This repository doesn't have a README file, or it's not publicly accessible."})]})}function ve(s){const e=O.c(39),{tools:i,connectionId:c,org:l,onToolClick:m,showToolbar:L,emptyMessage:M}=s,D=L===void 0?!0:L,j=M===void 0?"This connection doesn't have any tools yet.":M,I=Q(),[n,$]=k.useState(""),[d,H]=k.useState("table"),[r,A]=k.useState("name"),[a,_]=k.useState("asc");let y;e[0]!==a||e[1]!==r?(y=o=>{r===o?(_(me),a==="desc"&&A(void 0)):(A(o),_("asc"))},e[0]=a,e[1]=r,e[2]=y):y=e[2];const u=y;let N;e[3]!==c||e[4]!==I||e[5]!==m||e[6]!==l?(N=o=>{m?m(o):c&&l&&I({to:"/$org/mcps/$connectionId/$collectionName/$itemId",params:{org:l,connectionId:c,collectionName:"tools",itemId:encodeURIComponent(o.name)}})},e[3]=c,e[4]=I,e[5]=m,e[6]=l,e[7]=N):N=e[7];const w=N;let v;if(e[8]!==n||e[9]!==a||e[10]!==r||e[11]!==i){const o=!i||i.length===0?[]:n.trim()?(()=>{const R=n.toLowerCase();return i.filter(b=>b.name.toLowerCase().includes(R)||b.description&&b.description.toLowerCase().includes(R))})():i;v=!r||!a?o:[...o].sort((R,b)=>{const q=R[r]||"",G=b[r]||"",K=String(q).localeCompare(String(G));return a==="asc"?K:-K}),e[8]=n,e[9]=a,e[10]=r,e[11]=i,e[12]=v}else v=e[12];const g=v;let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=[{id:"name",header:"Name",render:ce,sortable:!0},{id:"description",header:"Description",render:le,cellClassName:"flex-1",sortable:!0}],e[13]=C):C=e[13];const V=C;let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=V.filter(ie).map(ae),e[14]=S):S=e[14];const F=S;let f;e[15]!==u||e[16]!==D||e[17]!==a||e[18]!==r||e[19]!==d?(f=D&&t.jsx(se,{children:t.jsx(P,{viewMode:d,onViewModeChange:H,sortKey:r,sortDirection:a,onSort:u,sortOptions:F})}),e[15]=u,e[16]=D,e[17]=a,e[18]=r,e[19]=d,e[20]=f):f=e[20];let E;e[21]===Symbol.for("react.memo_cache_sentinel")?(E=o=>{o.key==="Escape"&&($(""),o.target.blur())},e[21]=E):E=e[21];let p;e[22]!==n?(p=t.jsx(X,{value:n,onChange:$,placeholder:"Search tools...",onKeyDown:E}),e[22]=n,e[23]=p):p=e[23];let h;e[24]!==j||e[25]!==u||e[26]!==w||e[27]!==n||e[28]!==a||e[29]!==r||e[30]!==g||e[31]!==d?(h=d==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:g.length===0?t.jsx(z,{image:null,title:n?"No tools found":"No tools available",description:n?"Try adjusting your search terms":j}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:g.map(o=>t.jsx(te,{className:"cursor-pointer transition-colors",onClick:()=>w(o),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(ee,{icon:null,name:o.name,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:o.name}),t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:o.description||"No description"})]})]})},o.name))})}):t.jsx(Z,{columns:V,data:g,isLoading:!1,sortKey:r,sortDirection:a,onSort:u,onRowClick:o=>w(o),emptyState:t.jsx(z,{image:null,title:n?"No tools found":"No tools available",description:n?"Try adjusting your search terms":j})}),e[24]=j,e[25]=u,e[26]=w,e[27]=n,e[28]=a,e[29]=r,e[30]=g,e[31]=d,e[32]=h):h=e[32];let x;e[33]!==p||e[34]!==h?(x=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[p,h]}),e[33]=p,e[34]=h,e[35]=x):x=e[35];let T;return e[36]!==x||e[37]!==f?(T=t.jsxs(t.Fragment,{children:[f,x]}),e[36]=x,e[37]=f,e[38]=T):T=e[38],T}function ae(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function ie(s){return s.sortable}function le(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function ce(s){return t.jsx("span",{className:"text-sm font-medium font-mono text-foreground",children:s.name})}function me(s){return s==="asc"?"desc":s==="desc"?null:"asc"}export{we as R,ve as T};
1
+ import{K as B,j as t,c as O,f as Q,r as k}from"./index-C5FDJtAp.js";import{u as U}from"./useQuery-Dakt0IBq.js";import{i as W}from"./File06-BM3BX-NC.js";import{i as Y}from"./Loading01-BhuF3K1g.js";import{e as J}from"./github-icon-Dp3wHhYE.js";import{C as P}from"./collection-display-button-CdHXoeVD.js";import{C as X}from"./collection-search-CF1o4yO7.js";import{C as Z}from"./collection-table-wrapper-jfSAC6dF.js";import{E as z,I as ee}from"./empty-state-C0gi-aAx.js";import{C as te}from"./card-CwMKn79y.js";import{V as se}from"./layout-BnqnCJOk.js";function oe(s){return s.replace(/<a[^>]*class="[^"]*anchor[^"]*"[^>]*>.*?<\/a>/gi,"")}function re(s){return s.replace(/<a\s+([^>]*href="[^"]*"[^>]*)>/gi,(e,i)=>i.includes("target=")?e.replace(/target="[^"]*"/gi,'target="_blank"'):`<a ${i} target="_blank" rel="noopener noreferrer">`)}function ne(s){let e=oe(s);return e=re(e),e}function we({repository:s}){const e=s?J(s):null,{data:i,isLoading:c}=U({queryKey:B.githubReadme(e?.owner,e?.repo),queryFn:async()=>{if(!e)return null;try{const l=await fetch(`https://api.github.com/repos/${e.owner}/${e.repo}/readme`,{headers:{Accept:"application/vnd.github.v3.html"}});if(!l.ok){if(l.status===404)return null;throw new Error(`Failed to fetch README: ${l.statusText}`)}const m=await l.text();return ne(m)}catch(l){return console.error("Error fetching README:",l),null}},enabled:!!e&&!!s,staleTime:3600*1e3,gcTime:1440*60*1e3});return c?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(Y,{size:32,className:"animate-spin text-muted-foreground"})}):i?t.jsx("div",{className:"p-5 markdown-body",style:{backgroundColor:"transparent"},dangerouslySetInnerHTML:{__html:i}}):t.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-6",children:[t.jsx(W,{size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"README not found"}),t.jsx("p",{className:"text-muted-foreground max-w-md",children:"This repository doesn't have a README file, or it's not publicly accessible."})]})}function ve(s){const e=O.c(39),{tools:i,connectionId:c,org:l,onToolClick:m,showToolbar:L,emptyMessage:M}=s,D=L===void 0?!0:L,j=M===void 0?"This connection doesn't have any tools yet.":M,I=Q(),[n,$]=k.useState(""),[d,H]=k.useState("table"),[r,A]=k.useState("name"),[a,_]=k.useState("asc");let y;e[0]!==a||e[1]!==r?(y=o=>{r===o?(_(me),a==="desc"&&A(void 0)):(A(o),_("asc"))},e[0]=a,e[1]=r,e[2]=y):y=e[2];const u=y;let N;e[3]!==c||e[4]!==I||e[5]!==m||e[6]!==l?(N=o=>{m?m(o):c&&l&&I({to:"/$org/mcps/$connectionId/$collectionName/$itemId",params:{org:l,connectionId:c,collectionName:"tools",itemId:encodeURIComponent(o.name)}})},e[3]=c,e[4]=I,e[5]=m,e[6]=l,e[7]=N):N=e[7];const w=N;let v;if(e[8]!==n||e[9]!==a||e[10]!==r||e[11]!==i){const o=!i||i.length===0?[]:n.trim()?(()=>{const R=n.toLowerCase();return i.filter(b=>b.name.toLowerCase().includes(R)||b.description&&b.description.toLowerCase().includes(R))})():i;v=!r||!a?o:[...o].sort((R,b)=>{const q=R[r]||"",G=b[r]||"",K=String(q).localeCompare(String(G));return a==="asc"?K:-K}),e[8]=n,e[9]=a,e[10]=r,e[11]=i,e[12]=v}else v=e[12];const g=v;let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=[{id:"name",header:"Name",render:ce,sortable:!0},{id:"description",header:"Description",render:le,cellClassName:"flex-1",sortable:!0}],e[13]=C):C=e[13];const V=C;let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=V.filter(ie).map(ae),e[14]=S):S=e[14];const F=S;let f;e[15]!==u||e[16]!==D||e[17]!==a||e[18]!==r||e[19]!==d?(f=D&&t.jsx(se,{children:t.jsx(P,{viewMode:d,onViewModeChange:H,sortKey:r,sortDirection:a,onSort:u,sortOptions:F})}),e[15]=u,e[16]=D,e[17]=a,e[18]=r,e[19]=d,e[20]=f):f=e[20];let E;e[21]===Symbol.for("react.memo_cache_sentinel")?(E=o=>{o.key==="Escape"&&($(""),o.target.blur())},e[21]=E):E=e[21];let p;e[22]!==n?(p=t.jsx(X,{value:n,onChange:$,placeholder:"Search tools...",onKeyDown:E}),e[22]=n,e[23]=p):p=e[23];let h;e[24]!==j||e[25]!==u||e[26]!==w||e[27]!==n||e[28]!==a||e[29]!==r||e[30]!==g||e[31]!==d?(h=d==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:g.length===0?t.jsx(z,{image:null,title:n?"No tools found":"No tools available",description:n?"Try adjusting your search terms":j}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:g.map(o=>t.jsx(te,{className:"cursor-pointer transition-colors",onClick:()=>w(o),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(ee,{icon:null,name:o.name,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:o.name}),t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:o.description||"No description"})]})]})},o.name))})}):t.jsx(Z,{columns:V,data:g,isLoading:!1,sortKey:r,sortDirection:a,onSort:u,onRowClick:o=>w(o),emptyState:t.jsx(z,{image:null,title:n?"No tools found":"No tools available",description:n?"Try adjusting your search terms":j})}),e[24]=j,e[25]=u,e[26]=w,e[27]=n,e[28]=a,e[29]=r,e[30]=g,e[31]=d,e[32]=h):h=e[32];let x;e[33]!==p||e[34]!==h?(x=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[p,h]}),e[33]=p,e[34]=h,e[35]=x):x=e[35];let T;return e[36]!==x||e[37]!==f?(T=t.jsxs(t.Fragment,{children:[f,x]}),e[36]=x,e[37]=f,e[38]=T):T=e[38],T}function ae(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function ie(s){return s.sortable}function le(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function ce(s){return t.jsx("span",{className:"text-sm font-medium font-mono text-foreground",children:s.name})}function me(s){return s==="asc"?"desc":s==="desc"?null:"asc"}export{we as R,ve as T};
@@ -1 +1 @@
1
- import{r as a,j as c,ah as S,ag as J,av as H,ae as $,aw as Q,aj as C,ai as G,ax as Z,az as ee,aA as te,bu as oe,aE as re,am as ne,ay as se,aB as ae,c as j}from"./index-Dk3lubBQ.js";import{c as ie}from"./button-2azNqzUx.js";var le=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),ce="VisuallyHidden",z=a.forwardRef((o,e)=>c.jsx(S.span,{...o,ref:e,style:{...le,...o.style}}));z.displayName=ce;var ue=z,[O]=J("Tooltip",[H]),D=H(),V="TooltipProvider",de=700,A="tooltip.open",[pe,k]=O(V),F=o=>{const{__scopeTooltip:e,delayDuration:t=de,skipDelayDuration:r=300,disableHoverableContent:n=!1,children:s}=o,l=a.useRef(!0),d=a.useRef(!1),i=a.useRef(0);return a.useEffect(()=>{const p=i.current;return()=>window.clearTimeout(p)},[]),c.jsx(pe,{scope:e,isOpenDelayedRef:l,delayDuration:t,onOpen:a.useCallback(()=>{window.clearTimeout(i.current),l.current=!1},[]),onClose:a.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:d,onPointerInTransitChange:a.useCallback(p=>{d.current=p},[]),disableHoverableContent:n,children:s})};F.displayName=V;var R="Tooltip",[fe,_]=O(R),B=o=>{const{__scopeTooltip:e,children:t,open:r,defaultOpen:n,onOpenChange:s,disableHoverableContent:l,delayDuration:d}=o,i=k(R,o.__scopeTooltip),p=D(e),[u,v]=a.useState(null),x=re(),f=a.useRef(0),h=l??i.disableHoverableContent,m=d??i.delayDuration,g=a.useRef(!1),[y,T]=ne({prop:r,defaultProp:n??!1,onChange:M=>{M?(i.onOpen(),document.dispatchEvent(new CustomEvent(A))):i.onClose(),s?.(M)},caller:R}),w=a.useMemo(()=>y?g.current?"delayed-open":"instant-open":"closed",[y]),E=a.useCallback(()=>{window.clearTimeout(f.current),f.current=0,g.current=!1,T(!0)},[T]),P=a.useCallback(()=>{window.clearTimeout(f.current),f.current=0,T(!1)},[T]),I=a.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{g.current=!0,T(!0),f.current=0},m)},[m,T]);return a.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),c.jsx(se,{...p,children:c.jsx(fe,{scope:e,contentId:x,open:y,stateAttribute:w,trigger:u,onTriggerChange:v,onTriggerEnter:a.useCallback(()=>{i.isOpenDelayedRef.current?I():E()},[i.isOpenDelayedRef,I,E]),onTriggerLeave:a.useCallback(()=>{h?P():(window.clearTimeout(f.current),f.current=0)},[P,h]),onOpen:E,onClose:P,disableHoverableContent:h,children:t})})};B.displayName=R;var L="TooltipTrigger",Y=a.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=_(L,t),s=k(L,t),l=D(t),d=a.useRef(null),i=$(e,d,n.onTriggerChange),p=a.useRef(!1),u=a.useRef(!1),v=a.useCallback(()=>p.current=!1,[]);return a.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),c.jsx(Q,{asChild:!0,...l,children:c.jsx(S.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...r,ref:i,onPointerMove:C(o.onPointerMove,x=>{x.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(n.onTriggerEnter(),u.current=!0)}),onPointerLeave:C(o.onPointerLeave,()=>{n.onTriggerLeave(),u.current=!1}),onPointerDown:C(o.onPointerDown,()=>{n.open&&n.onClose(),p.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:C(o.onFocus,()=>{p.current||n.onOpen()}),onBlur:C(o.onBlur,n.onClose),onClick:C(o.onClick,n.onClose)})})});Y.displayName=L;var N="TooltipPortal",[ve,xe]=O(N,{forceMount:void 0}),U=o=>{const{__scopeTooltip:e,forceMount:t,children:r,container:n}=o,s=_(N,e);return c.jsx(ve,{scope:e,forceMount:t,children:c.jsx(G,{present:t||s.open,children:c.jsx(Z,{asChild:!0,container:n,children:r})})})};U.displayName=N;var b="TooltipContent",q=a.forwardRef((o,e)=>{const t=xe(b,o.__scopeTooltip),{forceMount:r=t.forceMount,side:n="top",...s}=o,l=_(b,o.__scopeTooltip);return c.jsx(G,{present:r||l.open,children:l.disableHoverableContent?c.jsx(W,{side:n,...s,ref:e}):c.jsx(he,{side:n,...s,ref:e})})}),he=a.forwardRef((o,e)=>{const t=_(b,o.__scopeTooltip),r=k(b,o.__scopeTooltip),n=a.useRef(null),s=$(e,n),[l,d]=a.useState(null),{trigger:i,onClose:p}=t,u=n.current,{onPointerInTransitChange:v}=r,x=a.useCallback(()=>{d(null),v(!1)},[v]),f=a.useCallback((h,m)=>{const g=h.currentTarget,y={x:h.clientX,y:h.clientY},T=ye(y,g.getBoundingClientRect()),w=Ce(y,T),E=be(m.getBoundingClientRect()),P=Ee([...w,...E]);d(P),v(!0)},[v]);return a.useEffect(()=>()=>x(),[x]),a.useEffect(()=>{if(i&&u){const h=g=>f(g,u),m=g=>f(g,i);return i.addEventListener("pointerleave",h),u.addEventListener("pointerleave",m),()=>{i.removeEventListener("pointerleave",h),u.removeEventListener("pointerleave",m)}}},[i,u,f,x]),a.useEffect(()=>{if(l){const h=m=>{const g=m.target,y={x:m.clientX,y:m.clientY},T=i?.contains(g)||u?.contains(g),w=!we(y,l);T?x():w&&(x(),p())};return document.addEventListener("pointermove",h),()=>document.removeEventListener("pointermove",h)}},[i,u,l,p,x]),c.jsx(W,{...o,ref:s})}),[ge,me]=O(R,{isInside:!1}),Te=oe("TooltipContent"),W=a.forwardRef((o,e)=>{const{__scopeTooltip:t,children:r,"aria-label":n,onEscapeKeyDown:s,onPointerDownOutside:l,...d}=o,i=_(b,t),p=D(t),{onClose:u}=i;return a.useEffect(()=>(document.addEventListener(A,u),()=>document.removeEventListener(A,u)),[u]),a.useEffect(()=>{if(i.trigger){const v=x=>{x.target?.contains(i.trigger)&&u()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[i.trigger,u]),c.jsx(ee,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:v=>v.preventDefault(),onDismiss:u,children:c.jsxs(te,{"data-state":i.stateAttribute,...p,...d,ref:e,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(Te,{children:r}),c.jsx(ge,{scope:t,isInside:!0,children:c.jsx(ue,{id:i.contentId,role:"tooltip",children:n||r})})]})})});q.displayName=b;var X="TooltipArrow",K=a.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=D(t);return me(X,t).isInside?null:c.jsx(ae,{...n,...r,ref:e})});K.displayName=X;function ye(o,e){const t=Math.abs(e.top-o.y),r=Math.abs(e.bottom-o.y),n=Math.abs(e.right-o.x),s=Math.abs(e.left-o.x);switch(Math.min(t,r,n,s)){case s:return"left";case n:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Ce(o,e,t=5){const r=[];switch(e){case"top":r.push({x:o.x-t,y:o.y+t},{x:o.x+t,y:o.y+t});break;case"bottom":r.push({x:o.x-t,y:o.y-t},{x:o.x+t,y:o.y-t});break;case"left":r.push({x:o.x+t,y:o.y-t},{x:o.x+t,y:o.y+t});break;case"right":r.push({x:o.x-t,y:o.y-t},{x:o.x-t,y:o.y+t});break}return r}function be(o){const{top:e,right:t,bottom:r,left:n}=o;return[{x:n,y:e},{x:t,y:e},{x:t,y:r},{x:n,y:r}]}function we(o,e){const{x:t,y:r}=o;let n=!1;for(let s=0,l=e.length-1;s<e.length;l=s++){const d=e[s],i=e[l],p=d.x,u=d.y,v=i.x,x=i.y;u>r!=x>r&&t<(v-p)*(r-u)/(x-u)+p&&(n=!n)}return n}function Ee(o){const e=o.slice();return e.sort((t,r)=>t.x<r.x?-1:t.x>r.x?1:t.y<r.y?-1:t.y>r.y?1:0),Pe(e)}function Pe(o){if(o.length<=1)return o.slice();const e=[];for(let r=0;r<o.length;r++){const n=o[r];for(;e.length>=2;){const s=e[e.length-1],l=e[e.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))e.pop();else break}e.push(n)}e.pop();const t=[];for(let r=o.length-1;r>=0;r--){const n=o[r];for(;t.length>=2;){const s=t[t.length-1],l=t[t.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))t.pop();else break}t.push(n)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}var Re=F,_e=B,je=Y,Oe=U,De=q,Ae=K;function Le(o){const e=j.c(6);let t,r;e[0]!==o?({delayDuration:r,...t}=o,e[0]=o,e[1]=t,e[2]=r):(t=e[1],r=e[2]);const n=r===void 0?0:r;let s;return e[3]!==n||e[4]!==t?(s=c.jsx(Re,{"data-slot":"tooltip-provider",delayDuration:n,...t}),e[3]=n,e[4]=t,e[5]=s):s=e[5],s}function Ie(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=c.jsx(Le,{children:c.jsx(_e,{"data-slot":"tooltip",...t})}),e[2]=t,e[3]=r):r=e[3],r}function Me(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=c.jsx(je,{"data-slot":"tooltip-trigger",...t}),e[2]=t,e[3]=r):r=e[3],r}function Se(o){const e=j.c(13);let t,r,n,s;e[0]!==o?({className:r,sideOffset:s,children:t,...n}=o,e[0]=o,e[1]=t,e[2]=r,e[3]=n,e[4]=s):(t=e[1],r=e[2],n=e[3],s=e[4]);const l=s===void 0?0:s;let d;e[5]!==r?(d=ie("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",r),e[5]=r,e[6]=d):d=e[6];let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(Ae,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"}),e[7]=i):i=e[7];let p;return e[8]!==t||e[9]!==n||e[10]!==l||e[11]!==d?(p=c.jsx(Oe,{children:c.jsxs(De,{"data-slot":"tooltip-content",sideOffset:l,className:d,...n,children:[t,i]})}),e[8]=t,e[9]=n,e[10]=l,e[11]=d,e[12]=p):p=e[12],p}export{Se as T,le as V,Le as a,Me as b,Ie as c};
1
+ import{r as a,j as c,aj as S,ai as J,ak as H,ay as Q,aw as $,aA as Z,aB as ee,bt as te,ag as G,ax as oe,al as C,aF as re,an as ne,az as se,aC as ae,c as j}from"./index-C5FDJtAp.js";import{c as ie}from"./button-ClkQLR3o.js";var le=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),ce="VisuallyHidden",z=a.forwardRef((o,e)=>c.jsx(S.span,{...o,ref:e,style:{...le,...o.style}}));z.displayName=ce;var ue=z,[O]=J("Tooltip",[$]),D=$(),F="TooltipProvider",de=700,A="tooltip.open",[pe,k]=O(F),V=o=>{const{__scopeTooltip:e,delayDuration:t=de,skipDelayDuration:r=300,disableHoverableContent:n=!1,children:s}=o,l=a.useRef(!0),d=a.useRef(!1),i=a.useRef(0);return a.useEffect(()=>{const p=i.current;return()=>window.clearTimeout(p)},[]),c.jsx(pe,{scope:e,isOpenDelayedRef:l,delayDuration:t,onOpen:a.useCallback(()=>{window.clearTimeout(i.current),l.current=!1},[]),onClose:a.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(()=>l.current=!0,r)},[r]),isPointerInTransitRef:d,onPointerInTransitChange:a.useCallback(p=>{d.current=p},[]),disableHoverableContent:n,children:s})};V.displayName=F;var R="Tooltip",[fe,_]=O(R),B=o=>{const{__scopeTooltip:e,children:t,open:r,defaultOpen:n,onOpenChange:s,disableHoverableContent:l,delayDuration:d}=o,i=k(R,o.__scopeTooltip),p=D(e),[u,v]=a.useState(null),x=re(),f=a.useRef(0),h=l??i.disableHoverableContent,m=d??i.delayDuration,g=a.useRef(!1),[y,T]=ne({prop:r,defaultProp:n??!1,onChange:M=>{M?(i.onOpen(),document.dispatchEvent(new CustomEvent(A))):i.onClose(),s?.(M)},caller:R}),w=a.useMemo(()=>y?g.current?"delayed-open":"instant-open":"closed",[y]),E=a.useCallback(()=>{window.clearTimeout(f.current),f.current=0,g.current=!1,T(!0)},[T]),P=a.useCallback(()=>{window.clearTimeout(f.current),f.current=0,T(!1)},[T]),I=a.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{g.current=!0,T(!0),f.current=0},m)},[m,T]);return a.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),c.jsx(se,{...p,children:c.jsx(fe,{scope:e,contentId:x,open:y,stateAttribute:w,trigger:u,onTriggerChange:v,onTriggerEnter:a.useCallback(()=>{i.isOpenDelayedRef.current?I():E()},[i.isOpenDelayedRef,I,E]),onTriggerLeave:a.useCallback(()=>{h?P():(window.clearTimeout(f.current),f.current=0)},[P,h]),onOpen:E,onClose:P,disableHoverableContent:h,children:t})})};B.displayName=R;var L="TooltipTrigger",Y=a.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=_(L,t),s=k(L,t),l=D(t),d=a.useRef(null),i=G(e,d,n.onTriggerChange),p=a.useRef(!1),u=a.useRef(!1),v=a.useCallback(()=>p.current=!1,[]);return a.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),c.jsx(oe,{asChild:!0,...l,children:c.jsx(S.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...r,ref:i,onPointerMove:C(o.onPointerMove,x=>{x.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(n.onTriggerEnter(),u.current=!0)}),onPointerLeave:C(o.onPointerLeave,()=>{n.onTriggerLeave(),u.current=!1}),onPointerDown:C(o.onPointerDown,()=>{n.open&&n.onClose(),p.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:C(o.onFocus,()=>{p.current||n.onOpen()}),onBlur:C(o.onBlur,n.onClose),onClick:C(o.onClick,n.onClose)})})});Y.displayName=L;var N="TooltipPortal",[ve,xe]=O(N,{forceMount:void 0}),U=o=>{const{__scopeTooltip:e,forceMount:t,children:r,container:n}=o,s=_(N,e);return c.jsx(ve,{scope:e,forceMount:t,children:c.jsx(H,{present:t||s.open,children:c.jsx(Q,{asChild:!0,container:n,children:r})})})};U.displayName=N;var b="TooltipContent",q=a.forwardRef((o,e)=>{const t=xe(b,o.__scopeTooltip),{forceMount:r=t.forceMount,side:n="top",...s}=o,l=_(b,o.__scopeTooltip);return c.jsx(H,{present:r||l.open,children:l.disableHoverableContent?c.jsx(W,{side:n,...s,ref:e}):c.jsx(he,{side:n,...s,ref:e})})}),he=a.forwardRef((o,e)=>{const t=_(b,o.__scopeTooltip),r=k(b,o.__scopeTooltip),n=a.useRef(null),s=G(e,n),[l,d]=a.useState(null),{trigger:i,onClose:p}=t,u=n.current,{onPointerInTransitChange:v}=r,x=a.useCallback(()=>{d(null),v(!1)},[v]),f=a.useCallback((h,m)=>{const g=h.currentTarget,y={x:h.clientX,y:h.clientY},T=ye(y,g.getBoundingClientRect()),w=Ce(y,T),E=be(m.getBoundingClientRect()),P=Ee([...w,...E]);d(P),v(!0)},[v]);return a.useEffect(()=>()=>x(),[x]),a.useEffect(()=>{if(i&&u){const h=g=>f(g,u),m=g=>f(g,i);return i.addEventListener("pointerleave",h),u.addEventListener("pointerleave",m),()=>{i.removeEventListener("pointerleave",h),u.removeEventListener("pointerleave",m)}}},[i,u,f,x]),a.useEffect(()=>{if(l){const h=m=>{const g=m.target,y={x:m.clientX,y:m.clientY},T=i?.contains(g)||u?.contains(g),w=!we(y,l);T?x():w&&(x(),p())};return document.addEventListener("pointermove",h),()=>document.removeEventListener("pointermove",h)}},[i,u,l,p,x]),c.jsx(W,{...o,ref:s})}),[ge,me]=O(R,{isInside:!1}),Te=te("TooltipContent"),W=a.forwardRef((o,e)=>{const{__scopeTooltip:t,children:r,"aria-label":n,onEscapeKeyDown:s,onPointerDownOutside:l,...d}=o,i=_(b,t),p=D(t),{onClose:u}=i;return a.useEffect(()=>(document.addEventListener(A,u),()=>document.removeEventListener(A,u)),[u]),a.useEffect(()=>{if(i.trigger){const v=x=>{x.target?.contains(i.trigger)&&u()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[i.trigger,u]),c.jsx(Z,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:v=>v.preventDefault(),onDismiss:u,children:c.jsxs(ee,{"data-state":i.stateAttribute,...p,...d,ref:e,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(Te,{children:r}),c.jsx(ge,{scope:t,isInside:!0,children:c.jsx(ue,{id:i.contentId,role:"tooltip",children:n||r})})]})})});q.displayName=b;var X="TooltipArrow",K=a.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=D(t);return me(X,t).isInside?null:c.jsx(ae,{...n,...r,ref:e})});K.displayName=X;function ye(o,e){const t=Math.abs(e.top-o.y),r=Math.abs(e.bottom-o.y),n=Math.abs(e.right-o.x),s=Math.abs(e.left-o.x);switch(Math.min(t,r,n,s)){case s:return"left";case n:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Ce(o,e,t=5){const r=[];switch(e){case"top":r.push({x:o.x-t,y:o.y+t},{x:o.x+t,y:o.y+t});break;case"bottom":r.push({x:o.x-t,y:o.y-t},{x:o.x+t,y:o.y-t});break;case"left":r.push({x:o.x+t,y:o.y-t},{x:o.x+t,y:o.y+t});break;case"right":r.push({x:o.x-t,y:o.y-t},{x:o.x-t,y:o.y+t});break}return r}function be(o){const{top:e,right:t,bottom:r,left:n}=o;return[{x:n,y:e},{x:t,y:e},{x:t,y:r},{x:n,y:r}]}function we(o,e){const{x:t,y:r}=o;let n=!1;for(let s=0,l=e.length-1;s<e.length;l=s++){const d=e[s],i=e[l],p=d.x,u=d.y,v=i.x,x=i.y;u>r!=x>r&&t<(v-p)*(r-u)/(x-u)+p&&(n=!n)}return n}function Ee(o){const e=o.slice();return e.sort((t,r)=>t.x<r.x?-1:t.x>r.x?1:t.y<r.y?-1:t.y>r.y?1:0),Pe(e)}function Pe(o){if(o.length<=1)return o.slice();const e=[];for(let r=0;r<o.length;r++){const n=o[r];for(;e.length>=2;){const s=e[e.length-1],l=e[e.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))e.pop();else break}e.push(n)}e.pop();const t=[];for(let r=o.length-1;r>=0;r--){const n=o[r];for(;t.length>=2;){const s=t[t.length-1],l=t[t.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))t.pop();else break}t.push(n)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}var Re=V,_e=B,je=Y,Oe=U,De=q,Ae=K;function Le(o){const e=j.c(6);let t,r;e[0]!==o?({delayDuration:r,...t}=o,e[0]=o,e[1]=t,e[2]=r):(t=e[1],r=e[2]);const n=r===void 0?0:r;let s;return e[3]!==n||e[4]!==t?(s=c.jsx(Re,{"data-slot":"tooltip-provider",delayDuration:n,...t}),e[3]=n,e[4]=t,e[5]=s):s=e[5],s}function Ie(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=c.jsx(Le,{children:c.jsx(_e,{"data-slot":"tooltip",...t})}),e[2]=t,e[3]=r):r=e[3],r}function Me(o){const e=j.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=c.jsx(je,{"data-slot":"tooltip-trigger",...t}),e[2]=t,e[3]=r):r=e[3],r}function Se(o){const e=j.c(13);let t,r,n,s;e[0]!==o?({className:r,sideOffset:s,children:t,...n}=o,e[0]=o,e[1]=t,e[2]=r,e[3]=n,e[4]=s):(t=e[1],r=e[2],n=e[3],s=e[4]);const l=s===void 0?0:s;let d;e[5]!==r?(d=ie("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",r),e[5]=r,e[6]=d):d=e[6];let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=c.jsx(Ae,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"}),e[7]=i):i=e[7];let p;return e[8]!==t||e[9]!==n||e[10]!==l||e[11]!==d?(p=c.jsx(Oe,{children:c.jsxs(De,{"data-slot":"tooltip-content",sideOffset:l,className:d,...n,children:[t,i]})}),e[8]=t,e[9]=n,e[10]=l,e[11]=d,e[12]=p):p=e[12],p}export{Se as T,le as V,Le as a,Me as b,Ie as c};
@@ -0,0 +1,23 @@
1
+ import{c as v}from"./binder-B3GXUIAu.js";import{bm as T,bl as O,y as t,z as e,Y as p,Z as c,bn as l,bo as P,a3 as x,bp as U,W as i,M as u,X as g,$ as n,U as L,a0 as b,V as B,bq as C}from"./index-C5FDJtAp.js";const W=O.extend({avatar:e().describe("URL or data URI to the assistant's avatar image"),system_prompt:e().describe("System prompt that defines the assistant's behavior"),gateway_id:e().describe("Gateway ID to use for this assistant"),model:t({id:e().describe("Model ID"),connectionId:e().describe("Connection ID that provides the model")}).describe("Selected model reference for this assistant")}),F=T("assistant",W),G=[...F],w=L(()=>u([B(),e(),i(),g(),p(e(),w),c(w)])),f=p(e(),p(e(),w)).optional().describe("Additional provider-specific options. Outer record keyed by provider name, inner by option key"),E=t({type:n("text"),text:e().describe("The text content"),providerOptions:f}),q=t({type:n("text"),text:e().describe("The text content"),providerMetadata:l().optional().describe("Additional provider-specific metadata")}),j=e().describe("File data as URL string"),k=t({type:n("file"),filename:e().optional().describe("Optional filename of the file"),data:j,mediaType:e().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),providerOptions:f}),$=t({type:n("file"),mediaType:e().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),data:e().describe("Generated file data as base64 encoded string")}),J=t({type:n("reasoning"),text:e().describe("The reasoning text"),providerOptions:f}),K=t({type:n("reasoning"),text:e().describe("The reasoning text"),providerMetadata:l().optional().describe("Additional provider-specific metadata")}),z=t({type:n("tool-call"),toolCallId:e().describe("ID of the tool call, used to match with tool result"),toolName:e().describe("Name of the tool being called"),input:e().describe("Arguments of the tool call (JSON-serializable object matching tool input schema)"),providerExecuted:g().optional().describe("Whether the tool call will be executed by the provider"),providerOptions:f}),V=t({type:n("tool-call"),toolCallId:e().describe("ID of the tool call"),toolName:e().describe("Name of the tool being called"),input:e().describe("Stringified JSON object with the tool call arguments"),providerExecuted:g().optional().describe("Whether the tool call will be executed by the provider"),providerMetadata:l().optional().describe("Additional provider-specific metadata")}),H=u([t({type:n("text"),value:e()}),t({type:n("json"),value:w}),t({type:n("error-text"),value:e()}),t({type:n("error-json"),value:w}),t({type:n("content"),value:c(u([t({type:n("text"),text:e().describe("Text content")}),t({type:n("media"),data:e().describe("Base-64 encoded media data"),mediaType:e().describe("IANA media type")})]))})]),A=t({type:n("tool-result"),toolCallId:e().describe("ID of the tool call that this result is associated with"),toolName:e().describe("Name of the tool that generated this result"),output:H.describe("Result of the tool call"),result:b().describe("Unknown result of the tool call"),providerOptions:f}),X=t({type:n("tool-result"),toolCallId:e().describe("ID of the tool call that this result is associated with"),toolName:e().describe("Name of the tool that generated this result"),result:l().describe("Result of the tool call (JSON-serializable)"),isError:g().optional().describe("Whether the result is an error or error message"),providerExecuted:g().optional().describe("Whether the tool result was generated by the provider"),providerMetadata:l().optional().describe("Additional provider-specific metadata")}),Y=u([t({type:n("source"),sourceType:n("url"),id:e().describe("The ID of the source"),url:e().describe("The URL of the source"),title:e().optional().describe("The title of the source"),providerMetadata:l().optional().describe("Additional provider-specific metadata")}),t({type:n("source"),sourceType:n("document"),id:e().describe("The ID of the source"),mediaType:e().describe("IANA media type of the document (e.g., application/pdf)"),title:e().describe("The title of the document"),filename:e().optional().describe("Optional filename of the document"),providerMetadata:l().optional().describe("Additional provider-specific metadata")})]),Z=t({role:n("system"),content:e().describe("System message content"),providerOptions:f}),Q=t({role:n("user"),content:c(u([E,k])).describe("User message content parts (text or file)"),providerOptions:f}),ee=t({role:n("assistant"),content:c(u([E,k,J,z,A])).describe("Assistant message content parts (text, file, reasoning, tool-call, or tool-result)"),providerOptions:f}),te=t({role:n("tool"),content:c(A).describe("Tool message content (tool results)"),providerOptions:f}),oe=u([Z,Q,ee,te]),ae=c(oe).describe("A list of messages forming the prompt"),ie=t({prompt:ae.describe("A language model prompt is a standardized prompt type (array of messages with roles: system, user, assistant, tool)"),maxOutputTokens:i().optional().describe("Maximum number of tokens to generate"),temperature:i().optional().describe("Temperature setting. The range depends on the provider and model"),topP:i().optional().describe("Nucleus sampling parameter"),topK:i().optional().describe("Only sample from the top K options for each subsequent token. Used to remove long tail low probability responses"),presencePenalty:i().optional().describe("Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt"),frequencyPenalty:i().optional().describe("Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases"),seed:i().optional().describe("The seed (integer) to use for random sampling. If set and supported by the model, calls will generate deterministic results"),stopSequences:c(e()).optional().describe("Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated"),responseFormat:u([t({type:n("text")}),t({type:n("json"),schema:l().optional().describe("JSON schema that the generated output should conform to"),name:e().optional().describe("Name of output that should be generated"),description:e().optional().describe("Description of the output that should be generated")})]).optional().describe("Response format. The output can either be text or JSON. Default is text"),tools:c(l()).optional().describe("The tools that are available for the model"),toolChoice:l().optional().describe("Specifies how the tool should be selected. Defaults to 'auto'"),includeRawChunks:g().optional().describe("Include raw chunks in the stream. Only applicable for streaming calls"),abortSignal:l().optional().describe("Abort signal for cancelling the operation"),providerOptions:l().optional().describe("Additional provider-specific options")}),ne=t({content:c(u([q,$,K,V,X,Y])).describe("Ordered content that the model has generated (text, tool-calls, reasoning, files, sources)"),finishReason:x(["stop","length","content-filter","tool-calls","error","other","unknown"]).describe("Reason why generation stopped"),usage:P({inputTokens:i().optional(),outputTokens:i().optional(),totalTokens:i().optional(),reasoningTokens:i().optional()}).describe("Usage information for the language model call"),providerMetadata:l().optional().describe("Additional provider-specific metadata"),request:t({body:l().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:t({id:e().optional().describe("ID for the generated response"),timestamp:U().optional().describe("Timestamp for the start of the generated response"),modelId:e().optional().describe("The ID of the response model that was used"),headers:p(e(),e()).optional().describe("Response headers"),body:l().optional().describe("Response HTTP body")}).optional().describe("Optional response information for telemetry and debugging"),warnings:c(l()).describe("Warnings for the call, e.g. unsupported settings")});t({stream:l().describe("ReadableStream of LanguageModelV2StreamPart"),request:t({body:l().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:t({headers:p(e(),e()).optional().describe("Response headers")}).optional().describe("Optional response data")});const se=t({supportedUrls:p(e(),c(e())).describe("Supported URL patterns by media type for the provider")});t({modelId:e().describe("The ID of the model"),logo:e().nullable(),description:e().nullable(),capabilities:c(e()),limits:t({contextWindow:i(),maxOutputTokens:i()}).nullable(),costs:t({input:i(),output:i()}).nullable(),provider:x(["openai","anthropic","google","x-ai","deepseek","openai-compatible","openrouter"]).nullable()});const N=t({modelId:e().describe("The ID of the model"),callOptions:ie}),re=O.extend({logo:e().nullable(),description:e().nullable(),capabilities:c(e()),limits:t({contextWindow:i(),maxOutputTokens:i()}).nullable(),costs:t({input:i(),output:i()}).nullable(),provider:x(["openai","anthropic","google","xai","deepseek","openai-compatible","openrouter"]).nullable()}),le=T("llm",re,{readOnly:!0}),ce=[{name:"LLM_METADATA",inputSchema:t({modelId:e().describe("The ID of the model")}),outputSchema:se},{name:"LLM_DO_STREAM",inputSchema:N,streamable:!0},{name:"LLM_DO_GENERATE",inputSchema:N,outputSchema:ne},...le],de=t({scopes:c(e()).describe("List of scopes available"),stateSchema:p(e(),b()).describe("JSON Schema (draft-07) defining the state structure")}),pe=[{name:"MCP_CONFIGURATION",inputSchema:t({}),outputSchema:de}],ue=t({toolName:e().describe("Name of the tool to invoke on that connection"),transformCode:e().optional().describe("Pure TypeScript function for data transformation of the tool call result. Must be a TypeScript file that declares the Output interface and exports a default function: `interface Output { ... } export default async function(input): Output { ... }`\n The input will match with the tool call outputSchema. If transformCode is not provided, the tool call result will be used as the step output. \n Providing an transformCode is recommended because it both allows you to transform the data and validate it against a JSON Schema - tools are ephemeral and may return unexpected data.")}),me=t({code:e().describe(`Pure TypeScript function for data transformation. Useful to merge data from multiple steps and transform it. Must be a TypeScript file that declares the Output interface and exports a default function: \`interface Output { ... } export default async function(input): Output { ... }\`
2
+ The input is the resolved value of the references in the input field. Example:
3
+ {
4
+ "input": {
5
+ "name": "@Step_1.name",
6
+ "age": "@Step_2.age"
7
+ },
8
+ "code": "export default function(input): Output { return { result: \`\${input.name} is \${input.age} years old.\` } }"
9
+ }
10
+ `)});t({signalName:e().describe("Signal name to wait for (e.g., 'approval'). Execution pauses until SEND_SIGNAL is called with this name.")});const he=u([ue.describe("Call an external tool via MCP connection. "),me.describe("Run pure TypeScript code for data transformation. Useful to merge data from multiple steps and transform it.")]),fe=t({maxAttempts:i().optional().describe("Max retry attempts on failure (default: 1, no retries)"),backoffMs:i().optional().describe("Initial delay between retries in ms (doubles each attempt)"),timeoutMs:i().optional().describe("Max execution time in ms before step fails (default: 30000)")}),D=L(()=>t({type:e().optional(),properties:p(e(),b()).optional(),required:c(e()).optional(),description:e().optional(),additionalProperties:g().optional(),additionalItems:g().optional(),items:D.optional()}).passthrough()),be=t({name:e().min(1).describe("Unique identifier for this step. Other steps reference its output as @name.field"),description:e().optional().describe("What this step does"),action:he,input:p(e(),b()).optional().describe("Data passed to the action. Use @ref for dynamic values: @input.field (workflow input), @stepName.field (previous step output), @item/@index (loop context). Example: { 'userId': '@input.user_id', 'data': '@fetch.result' }"),outputSchema:D.optional().describe("Optional JSON Schema describing the expected output of the step."),config:fe.optional().describe("Retry and timeout settings")}),ge=x(["enqueued","running","success","error","failed","cancelled"]).default("enqueued"),M=O.extend({gateway_id:e().describe("ID of the gateway that will be used to execute the workflow"),status:ge.describe("Current status of the workflow execution"),input:p(e(),b()).optional().describe("Input data for the workflow execution"),output:b().optional().describe("Output data for the workflow execution"),completed_at_epoch_ms:i().nullish().describe("Timestamp of when the workflow execution completed"),start_at_epoch_ms:i().nullish().describe("Timestamp of when the workflow execution started or will start"),timeout_ms:i().nullish().describe("Timeout in milliseconds for the workflow execution"),deadline_at_epoch_ms:i().nullish().describe("Deadline for the workflow execution - when the workflow execution will be cancelled if it is not completed. This is read-only and is set by the workflow engine when an execution is created."),error:b().nullish().describe("Error that occurred during the workflow execution"),completed_steps:t({success:c(e()).describe("Names of the steps that were completed successfully"),error:c(e()).describe("Names of the steps that errored")}).optional().describe("Names of the steps that were completed and their status")}),Se=x(["signal","timer","message","output","step_started","step_completed","workflow_started","workflow_completed"]);O.extend({execution_id:e(),type:Se,name:e().nullish(),payload:b().optional(),visible_at:i().nullish(),consumed_at:i().nullish(),source_execution_id:e().nullish()});const ye=O.extend({description:e().optional().describe("Human-readable summary of what this workflow does"),steps:c(be).describe("Ordered list of steps. Execution order is auto-determined by @ref dependencies: steps with no @ref dependencies run in parallel; steps referencing @stepName wait for that step to complete.")}),Te=T("workflow",ye),Oe={maxAttempts:1,timeoutMs:3e4},Me={name:"Initial Step",action:{code:`
11
+ interface Input {
12
+ example: string;
13
+ }
14
+
15
+ interface Output {
16
+ result: unknown;
17
+ }
18
+
19
+ export default async function(input: Input): Promise<Output> {
20
+ return {
21
+ result: input.example
22
+ }
23
+ }`},config:Oe,outputSchema:{type:"object",properties:{result:{type:"string",description:"The result of the step"}},required:["result"],description:"The output of the step. This is a JSON Schema describing the expected output of the step."}},Ie=T("workflow_execution",M),we=[...Te,...Ie],xe=[...we],Ce=T("workflow_execution",M),_={LLMS:ce,WORKFLOW:xe,WORKFLOW_EXECUTION:Ce,ASSISTANTS:G,MCP:pe};function Ne(o){return o.map(a=>({name:a.name,inputSchema:a.inputSchema?(()=>{try{return C(a.inputSchema)}catch(r){return console.error(`Failed to convert input schema for ${a.name}:`,r),t({})}})():t({}),outputSchema:a.outputSchema?(()=>{try{return C(a.outputSchema)}catch(r){return console.error(`Failed to convert output schema for ${a.name}:`,r),t({})}})():t({})}))}function _e(o,a){const r=o.tools;if(!r||r.length===0)return!1;const s=r.map(m=>({name:m.name,inputSchema:m.inputSchema})),d=a.map(m=>({name:m.name,inputSchema:m.inputSchema,opt:m.opt}));return v(d).isImplementedBy(s)}function Re({connections:o,binding:a}){const r=(()=>{if(a){if(typeof a=="string"){const s=a.toUpperCase(),d=_[s];if(!d){console.warn(`[useBindingConnections] Unknown binding "${a}". Available bindings: ${Object.keys(_).join(", ")}. Returning all connections without filtering.`);return}return d}if(a.length===0){console.warn("[useBindingConnections] Empty binding array provided. Returning all connections without filtering.");return}return Ne(a)}})();return o?r?o.filter(s=>_e(s,r)):o:[]}function ve(o){return o.toLowerCase().split("_").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" ")}function R(o){if(!o||o.length===0)return[];const a=/^COLLECTION_(.+)_LIST$/,r=[];for(const s of o){const d=s.name.match(a);d?.[1]&&r.push(d[1])}return r}function Le(o,a){const s=o.find(h=>h.name===`COLLECTION_${a}_CREATE`)?.inputSchema?.properties;if(s&&typeof s=="object"&&"data"in s)return s.data;const S=o.find(h=>h.name===`COLLECTION_${a}_UPDATE`)?.inputSchema?.properties;if(S&&typeof S=="object"&&"data"in S)return S.data;const I=o.find(h=>h.name===`COLLECTION_${a}_LIST`)?.outputSchema?.properties;if(I&&typeof I=="object"&&"items"in I){const h=I.items;if(h.items)return h.items}}function Ee(o,a){const r=a.toUpperCase();return{hasCreateTool:o.some(s=>s.name===`COLLECTION_${r}_CREATE`),hasUpdateTool:o.some(s=>s.name===`COLLECTION_${r}_UPDATE`),hasDeleteTool:o.some(s=>s.name===`COLLECTION_${r}_DELETE`)}}function ke(o){if(!o||o.length===0)return[];const a=R(o);if(a.length===0)return[];const r=[];for(const s of a)try{const d=T(s.toLowerCase(),O,{readOnly:!0}),S=o.map(y=>({name:y.name,inputSchema:y.inputSchema})),m=d.map(y=>({name:y.name,inputSchema:y.inputSchema}));if(v(m).isImplementedBy(S)){const y=Ee(o,s);r.push({name:s,displayName:ve(s),schema:Le(o,s),...y})}}catch{}return r}function Pe(o){return ke(o?.tools??null)}function Ue(o){return o?o.filter(a=>R(a.tools).find(r=>r==="REGISTRY_APP")):[]}export{Me as D,Pe as a,Re as b,Ue as u};
@@ -1 +1 @@
1
- import{c as x,K as q,q as U,v as b,t as v}from"./index-Dk3lubBQ.js";import{u as w}from"./useMutation-BEX5R6ly.js";import{u as I}from"./project-context-provider-B1gr9e2f.js";function A(n,s,i){const t=[];if(n?.trim()){const e=n.trim(),r=i.map(o=>({field:[String(o)],operator:"contains",value:e}));r.length===1&&r[0]?t.push(r[0]):r.length>1&&t.push({operator:"or",conditions:r})}if(s&&s.length>0)for(const e of s)t.push({field:[e.column],operator:"eq",value:e.value});if(t.length!==0)return t.length===1?t[0]:{operator:"and",conditions:t}}function D(n,s,i){const t=n??i,e=s??"asc";return[{field:[String(t)],direction:e}]}function J(n,s,i,t){const e=x.c(14),{org:r}=I();let o;e[0]!==s?(o=s.toUpperCase(),e[0]=s,e[1]=o):o=e[1];const E=`COLLECTION_${o}_GET`;let a;e[2]!==s||e[3]!==i||e[4]!==r.slug||e[5]!==n?(a=q.collectionItem(r.slug,n,s,i??""),e[2]=s,e[3]=i,e[4]=r.slug,e[5]=n,e[6]=a):a=e[6];let c;e[7]!==E||e[8]!==i||e[9]!==t?(c=async()=>i?await t(E,{id:i}):{item:null},e[7]=E,e[8]=i,e[9]=t,e[10]=c):c=e[10];let u;e[11]!==a||e[12]!==c?(u={queryKey:a,queryFn:c,staleTime:6e4},e[11]=a,e[12]=c,e[13]=u):u=e[13];const{data:l}=U(u);return l.item}function K(n,s,i,t){const e=x.c(11),r=t===void 0?{}:t,{org:o}=I(),{searchTerm:L,filters:E,sortKey:a,sortDirection:c,searchFields:u,defaultSortKey:l,pageSize:_}=r,O=u===void 0?["title","description"]:u,S=l===void 0?"updated_at":l,p=_===void 0?100:_;let y;e[0]!==s?(y=s.toUpperCase(),e[0]=s,e[1]=y):y=e[1];const g=`COLLECTION_${y}_LIST`,f=A(L,E,O),m=D(a,c,S),$=JSON.stringify({where:f,orderBy:m,limit:p}),T=q.collectionList(o.slug,n,s,$);let d;e[2]!==g||e[3]!==m||e[4]!==p||e[5]!==i||e[6]!==f?(d=async()=>{const Q={...f&&{where:f},...m&&{orderBy:m},limit:p,offset:0};return(await i(g,Q))?.items??[]},e[2]=g,e[3]=m,e[4]=p,e[5]=i,e[6]=f,e[7]=d):d=e[7];let h;e[8]!==T||e[9]!==d?(h={queryKey:T,queryFn:d},e[8]=T,e[9]=d,e[10]=h):h=e[10];const{data:C}=U(h);return C}function M(n,s,i){const t=x.c(39),{org:e}=I(),r=b();let o;t[0]!==s?(o=s.toUpperCase(),t[0]=s,t[1]=o):o=t[1];const L=o,E=`COLLECTION_${L}_CREATE`,a=`COLLECTION_${L}_UPDATE`,c=`COLLECTION_${L}_DELETE`;let u;t[2]!==E||t[3]!==i?(u=async d=>(await i(E,{data:d})).item,t[2]=E,t[3]=i,t[4]=u):u=t[4];let l;t[5]!==s||t[6]!==e||t[7]!==r||t[8]!==n?(l=()=>{r.invalidateQueries({queryKey:q.collection(e.slug,n,s)}),v.success("Item created successfully")},t[5]=s,t[6]=e,t[7]=r,t[8]=n,t[9]=l):l=t[9];let _;t[10]!==u||t[11]!==l?(_={mutationFn:u,onSuccess:l,onError:P},t[10]=u,t[11]=l,t[12]=_):_=t[12];const O=w(_);let S;t[13]!==i||t[14]!==a?(S=async d=>{const{id:h,data:C}=d;return(await i(a,{id:h,data:C})).item},t[13]=i,t[14]=a,t[15]=S):S=t[15];let p;t[16]!==s||t[17]!==e||t[18]!==r||t[19]!==n?(p=()=>{r.invalidateQueries({queryKey:q.collection(e.slug,n,s)}),v.success("Item updated successfully")},t[16]=s,t[17]=e,t[18]=r,t[19]=n,t[20]=p):p=t[20];let y;t[21]!==S||t[22]!==p?(y={mutationFn:S,onSuccess:p,onError:B},t[21]=S,t[22]=p,t[23]=y):y=t[23];const F=w(y);let g;t[24]!==c||t[25]!==i?(g=async d=>(await i(c,{id:d})).item.id,t[24]=c,t[25]=i,t[26]=g):g=t[26];let f;t[27]!==s||t[28]!==e||t[29]!==r||t[30]!==n?(f=()=>{r.invalidateQueries({queryKey:q.collection(e.slug,n,s)}),v.success("Item deleted successfully")},t[27]=s,t[28]=e,t[29]=r,t[30]=n,t[31]=f):f=t[31];let m;t[32]!==g||t[33]!==f?(m={mutationFn:g,onSuccess:f,onError:z},t[32]=g,t[33]=f,t[34]=m):m=t[34];const $=w(m);let T;return t[35]!==O||t[36]!==$||t[37]!==F?(T={create:O,update:F,delete:$},t[35]=O,t[36]=$,t[37]=F,t[38]=T):T=t[38],T}function z(n){const s=n instanceof Error?n.message:String(n);v.error(`Failed to delete item: ${s}`)}function B(n){const s=n instanceof Error?n.message:String(n);v.error(`Failed to update item: ${s}`)}function P(n){const s=n instanceof Error?n.message:String(n);v.error(`Failed to create item: ${s}`)}export{M as a,K as b,J as u};
1
+ import{c as x,K as F,v as U,x as b,t as v}from"./index-C5FDJtAp.js";import{u as w}from"./useMutation-DEocBykZ.js";import{u as I}from"./project-context-provider-DH0iqA5D.js";function A(n,s,i){const t=[];if(n?.trim()){const e=n.trim(),r=i.map(o=>({field:[String(o)],operator:"contains",value:e}));r.length===1&&r[0]?t.push(r[0]):r.length>1&&t.push({operator:"or",conditions:r})}if(s&&s.length>0)for(const e of s)t.push({field:[e.column],operator:"eq",value:e.value});if(t.length!==0)return t.length===1?t[0]:{operator:"and",conditions:t}}function D(n,s,i){const t=n??i,e=s??"asc";return[{field:[String(t)],direction:e}]}function J(n,s,i,t){const e=x.c(14),{org:r}=I();let o;e[0]!==s?(o=s.toUpperCase(),e[0]=s,e[1]=o):o=e[1];const E=`COLLECTION_${o}_GET`;let a;e[2]!==s||e[3]!==i||e[4]!==r.slug||e[5]!==n?(a=F.collectionItem(r.slug,n,s,i??""),e[2]=s,e[3]=i,e[4]=r.slug,e[5]=n,e[6]=a):a=e[6];let c;e[7]!==E||e[8]!==i||e[9]!==t?(c=async()=>i?await t(E,{id:i}):{item:null},e[7]=E,e[8]=i,e[9]=t,e[10]=c):c=e[10];let u;e[11]!==a||e[12]!==c?(u={queryKey:a,queryFn:c,staleTime:6e4},e[11]=a,e[12]=c,e[13]=u):u=e[13];const{data:l}=U(u);return l.item}function K(n,s,i,t){const e=x.c(11),r=t===void 0?{}:t,{org:o}=I(),{searchTerm:L,filters:E,sortKey:a,sortDirection:c,searchFields:u,defaultSortKey:l,pageSize:_}=r,O=u===void 0?["title","description"]:u,S=l===void 0?"updated_at":l,p=_===void 0?100:_;let y;e[0]!==s?(y=s.toUpperCase(),e[0]=s,e[1]=y):y=e[1];const g=`COLLECTION_${y}_LIST`,f=A(L,E,O),m=D(a,c,S),$=JSON.stringify({where:f,orderBy:m,limit:p}),T=F.collectionList(o.slug,n,s,$);let d;e[2]!==g||e[3]!==m||e[4]!==p||e[5]!==i||e[6]!==f?(d=async()=>{const Q={...f&&{where:f},...m&&{orderBy:m},limit:p,offset:0};return(await i(g,Q))?.items??[]},e[2]=g,e[3]=m,e[4]=p,e[5]=i,e[6]=f,e[7]=d):d=e[7];let h;e[8]!==T||e[9]!==d?(h={queryKey:T,queryFn:d},e[8]=T,e[9]=d,e[10]=h):h=e[10];const{data:C}=U(h);return C}function M(n,s,i){const t=x.c(39),{org:e}=I(),r=b();let o;t[0]!==s?(o=s.toUpperCase(),t[0]=s,t[1]=o):o=t[1];const L=o,E=`COLLECTION_${L}_CREATE`,a=`COLLECTION_${L}_UPDATE`,c=`COLLECTION_${L}_DELETE`;let u;t[2]!==E||t[3]!==i?(u=async d=>(await i(E,{data:d})).item,t[2]=E,t[3]=i,t[4]=u):u=t[4];let l;t[5]!==s||t[6]!==e||t[7]!==r||t[8]!==n?(l=()=>{r.invalidateQueries({queryKey:F.collection(e.slug,n,s)}),v.success("Item created successfully")},t[5]=s,t[6]=e,t[7]=r,t[8]=n,t[9]=l):l=t[9];let _;t[10]!==u||t[11]!==l?(_={mutationFn:u,onSuccess:l,onError:P},t[10]=u,t[11]=l,t[12]=_):_=t[12];const O=w(_);let S;t[13]!==i||t[14]!==a?(S=async d=>{const{id:h,data:C}=d;return(await i(a,{id:h,data:C})).item},t[13]=i,t[14]=a,t[15]=S):S=t[15];let p;t[16]!==s||t[17]!==e||t[18]!==r||t[19]!==n?(p=()=>{r.invalidateQueries({queryKey:F.collection(e.slug,n,s)}),v.success("Item updated successfully")},t[16]=s,t[17]=e,t[18]=r,t[19]=n,t[20]=p):p=t[20];let y;t[21]!==S||t[22]!==p?(y={mutationFn:S,onSuccess:p,onError:B},t[21]=S,t[22]=p,t[23]=y):y=t[23];const q=w(y);let g;t[24]!==c||t[25]!==i?(g=async d=>(await i(c,{id:d})).item.id,t[24]=c,t[25]=i,t[26]=g):g=t[26];let f;t[27]!==s||t[28]!==e||t[29]!==r||t[30]!==n?(f=()=>{r.invalidateQueries({queryKey:F.collection(e.slug,n,s)}),v.success("Item deleted successfully")},t[27]=s,t[28]=e,t[29]=r,t[30]=n,t[31]=f):f=t[31];let m;t[32]!==g||t[33]!==f?(m={mutationFn:g,onSuccess:f,onError:z},t[32]=g,t[33]=f,t[34]=m):m=t[34];const $=w(m);let T;return t[35]!==O||t[36]!==$||t[37]!==q?(T={create:O,update:q,delete:$},t[35]=O,t[36]=$,t[37]=q,t[38]=T):T=t[38],T}function z(n){const s=n instanceof Error?n.message:String(n);v.error(`Failed to delete item: ${s}`)}function B(n){const s=n instanceof Error?n.message:String(n);v.error(`Failed to update item: ${s}`)}function P(n){const s=n instanceof Error?n.message:String(n);v.error(`Failed to create item: ${s}`)}export{M as a,K as b,J as u};
@@ -1 +1 @@
1
- import{c as l}from"./index-Dk3lubBQ.js";import{c as r}from"./connection-CXC8d3Ae.js";import{u as i}from"./project-context-provider-B1gr9e2f.js";import{b as m,a as u,u as C}from"./use-collections-CbsNEj5T.js";function O(t){const o=l.c(3);let e;o[0]!==t?(e=t===void 0?{}:t,o[0]=t,o[1]=e):e=o[1];const n=e,{org:c}=i();let s;o[2]===Symbol.for("react.memo_cache_sentinel")?(s=r(),o[2]=s):s=o[2];const a=s;return m(c.slug,"CONNECTIONS",a,n)}function S(t){const o=l.c(1),{org:e}=i();let n;o[0]===Symbol.for("react.memo_cache_sentinel")?(n=r(),o[0]=n):n=o[0];const c=n;return C(e.slug,"CONNECTIONS",t,c)}function _(){const t=l.c(1),{org:o}=i();let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r(),t[0]=e):e=t[0];const n=e;return u(o.slug,"CONNECTIONS",n)}export{_ as a,S as b,O as u};
1
+ import{c as l}from"./index-C5FDJtAp.js";import{c as r}from"./connection-BcYehfdK.js";import{u as i}from"./project-context-provider-DH0iqA5D.js";import{b as m,a as u,u as C}from"./use-collections-DxMxR_jZ.js";function O(t){const o=l.c(3);let e;o[0]!==t?(e=t===void 0?{}:t,o[0]=t,o[1]=e):e=o[1];const n=e,{org:c}=i();let s;o[2]===Symbol.for("react.memo_cache_sentinel")?(s=r(),o[2]=s):s=o[2];const a=s;return m(c.slug,"CONNECTIONS",a,n)}function S(t){const o=l.c(1),{org:e}=i();let n;o[0]===Symbol.for("react.memo_cache_sentinel")?(n=r(),o[0]=n):n=o[0];const c=n;return C(e.slug,"CONNECTIONS",t,c)}function _(){const t=l.c(1),{org:o}=i();let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r(),t[0]=e):e=t[0];const n=e;return u(o.slug,"CONNECTIONS",n)}export{_ as a,S as b,O as u};
@@ -1 +1 @@
1
- import{c as f,K as l}from"./index-Dk3lubBQ.js";import{u as y}from"./index-CYR9-1-4.js";async function h(t){const e=`/mcp/${t}`,s={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};try{const o=await fetch(e,{method:"POST",headers:s,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"mesh-prompts",version:"1.0.0"}}})});if(!o.ok)return[];if((await o.json()).error)return[];const i=await fetch(e,{method:"POST",headers:s,body:JSON.stringify({jsonrpc:"2.0",id:2,method:"prompts/list",params:{}})});if(!i.ok)return[];const r=await i.json();return r.error?[]:r.result?.prompts||[]}catch{return[]}}function P(t){const e=f.c(13);let s;e[0]!==t?(s=t.map(q),e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s?(o={queries:s},e[2]=s,e[3]=o):o=e[3];const n=y(o);let i,r;if(e[4]!==t||e[5]!==n){r=new Map;let p;e[8]!==n?(p=n.some(j),e[8]=n,e[9]=p):p=e[9],i=p,t.forEach((u,m)=>{const c=n[m];c?.data?r.set(u,c.data.map(d)):r.set(u,[])}),e[4]=t,e[5]=n,e[6]=i,e[7]=r}else i=e[6],r=e[7];let a;return e[10]!==i||e[11]!==r?(a={promptsMap:r,isLoading:i},e[10]=i,e[11]=r,e[12]=a):a=e[12],a}function d(t){return{name:t.name,description:t.description}}function j(t){return t.isLoading}function q(t){return{queryKey:l.connectionPrompts(t),queryFn:()=>h(t),staleTime:6e4,retry:!1}}async function w(t){const e=`/mcp/${t}`,s={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};try{const o=await fetch(e,{method:"POST",headers:s,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"mesh-resources",version:"1.0.0"}}})});if(!o.ok)return[];if((await o.json()).error)return[];const i=await fetch(e,{method:"POST",headers:s,body:JSON.stringify({jsonrpc:"2.0",id:2,method:"resources/list",params:{}})});if(!i.ok)return[];const r=await i.json();return r.error?[]:r.result?.resources||[]}catch{return[]}}function $(t){const e=f.c(13);let s;e[0]!==t?(s=t.map(O),e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s?(o={queries:s},e[2]=s,e[3]=o):o=e[3];const n=y(o);let i,r;if(e[4]!==t||e[5]!==n){r=new Map;let p;e[8]!==n?(p=n.some(g),e[8]=n,e[9]=p):p=e[9],i=p,t.forEach((u,m)=>{const c=n[m];c?.data?r.set(u,c.data.map(S)):r.set(u,[])}),e[4]=t,e[5]=n,e[6]=i,e[7]=r}else i=e[6],r=e[7];let a;return e[10]!==i||e[11]!==r?(a={resourcesMap:r,isLoading:i},e[10]=i,e[11]=r,e[12]=a):a=e[12],a}function S(t){return{uri:t.uri,name:t.name,description:t.description}}function g(t){return t.isLoading}function O(t){return{queryKey:l.connectionResources(t),queryFn:()=>w(t),staleTime:6e4,retry:!1}}export{$ as a,P as u};
1
+ import{c as f,K as l}from"./index-C5FDJtAp.js";import{u as y}from"./index-DqVdeyIE.js";async function h(t){const e=`/mcp/${t}`,s={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};try{const o=await fetch(e,{method:"POST",headers:s,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"mesh-prompts",version:"1.0.0"}}})});if(!o.ok)return[];if((await o.json()).error)return[];const i=await fetch(e,{method:"POST",headers:s,body:JSON.stringify({jsonrpc:"2.0",id:2,method:"prompts/list",params:{}})});if(!i.ok)return[];const r=await i.json();return r.error?[]:r.result?.prompts||[]}catch{return[]}}function P(t){const e=f.c(13);let s;e[0]!==t?(s=t.map(q),e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s?(o={queries:s},e[2]=s,e[3]=o):o=e[3];const n=y(o);let i,r;if(e[4]!==t||e[5]!==n){r=new Map;let p;e[8]!==n?(p=n.some(j),e[8]=n,e[9]=p):p=e[9],i=p,t.forEach((u,m)=>{const c=n[m];c?.data?r.set(u,c.data.map(d)):r.set(u,[])}),e[4]=t,e[5]=n,e[6]=i,e[7]=r}else i=e[6],r=e[7];let a;return e[10]!==i||e[11]!==r?(a={promptsMap:r,isLoading:i},e[10]=i,e[11]=r,e[12]=a):a=e[12],a}function d(t){return{name:t.name,description:t.description}}function j(t){return t.isLoading}function q(t){return{queryKey:l.connectionPrompts(t),queryFn:()=>h(t),staleTime:6e4,retry:!1}}async function w(t){const e=`/mcp/${t}`,s={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};try{const o=await fetch(e,{method:"POST",headers:s,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"mesh-resources",version:"1.0.0"}}})});if(!o.ok)return[];if((await o.json()).error)return[];const i=await fetch(e,{method:"POST",headers:s,body:JSON.stringify({jsonrpc:"2.0",id:2,method:"resources/list",params:{}})});if(!i.ok)return[];const r=await i.json();return r.error?[]:r.result?.resources||[]}catch{return[]}}function $(t){const e=f.c(13);let s;e[0]!==t?(s=t.map(O),e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s?(o={queries:s},e[2]=s,e[3]=o):o=e[3];const n=y(o);let i,r;if(e[4]!==t||e[5]!==n){r=new Map;let p;e[8]!==n?(p=n.some(g),e[8]=n,e[9]=p):p=e[9],i=p,t.forEach((u,m)=>{const c=n[m];c?.data?r.set(u,c.data.map(S)):r.set(u,[])}),e[4]=t,e[5]=n,e[6]=i,e[7]=r}else i=e[6],r=e[7];let a;return e[10]!==i||e[11]!==r?(a={resourcesMap:r,isLoading:i},e[10]=i,e[11]=r,e[12]=a):a=e[12],a}function S(t){return{uri:t.uri,name:t.name,description:t.description}}function g(t){return t.isLoading}function O(t){return{queryKey:l.connectionResources(t),queryFn:()=>w(t),staleTime:6e4,retry:!1}}export{$ as a,P as u};
@@ -1 +1 @@
1
- import{c as m,f as y}from"./index-Dk3lubBQ.js";import{a as f}from"./use-gateway-Ck94EUZ3.js";import{u as p}from"./project-context-provider-B1gr9e2f.js";function x(a){const e=m.c(10);let o;e[0]!==a?(o=a===void 0?{}:a,e[0]=a,e[1]=o):o=e[1];const d=o,{navigateOnCreate:u}=d,i=u===void 0?!1:u,{org:r}=p(),c=y(),t=f();let s;e[2]!==t.create||e[3]!==c||e[4]!==i||e[5]!==r?(s=async()=>{const l=await t.create.mutateAsync({title:"New Agent",description:"Agents let you securely expose integrated tools to the outside world.",status:"active",tool_selection_mode:"inclusion",connections:[]});return i&&c({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:l.id}}),{id:l.id,gateway:l}},e[2]=t.create,e[3]=c,e[4]=i,e[5]=r,e[6]=s):s=e[6];const g=s;let n;return e[7]!==t.create.isPending||e[8]!==g?(n={createGateway:g,isCreating:t.create.isPending},e[7]=t.create.isPending,e[8]=g,e[9]=n):n=e[9],n}export{x as u};
1
+ import{c as m,f as y}from"./index-C5FDJtAp.js";import{a as f}from"./use-gateway-D_zdUoI4.js";import{u as p}from"./project-context-provider-DH0iqA5D.js";function x(a){const e=m.c(10);let o;e[0]!==a?(o=a===void 0?{}:a,e[0]=a,e[1]=o):o=e[1];const d=o,{navigateOnCreate:u}=d,i=u===void 0?!1:u,{org:r}=p(),c=y(),t=f();let s;e[2]!==t.create||e[3]!==c||e[4]!==i||e[5]!==r?(s=async()=>{const l=await t.create.mutateAsync({title:"New Agent",description:"Agents let you securely expose integrated tools to the outside world.",status:"active",tool_selection_mode:"inclusion",connections:[]});return i&&c({to:"/$org/gateways/$gatewayId",params:{org:r.slug,gatewayId:l.id}}),{id:l.id,gateway:l}},e[2]=t.create,e[3]=c,e[4]=i,e[5]=r,e[6]=s):s=e[6];const g=s;let n;return e[7]!==t.create.isPending||e[8]!==g?(n={createGateway:g,isCreating:t.create.isPending},e[7]=t.create.isPending,e[8]=g,e[9]=n):n=e[9],n}export{x as u};
@@ -1 +1 @@
1
- import{r as i,c as a}from"./index-Dk3lubBQ.js";import{c as n}from"./connection-CXC8d3Ae.js";import{u as l}from"./project-context-provider-B1gr9e2f.js";import{b as u,a as f,u as h}from"./use-collections-CbsNEj5T.js";const C=({size:o=24,color:e="currentColor",...t})=>i.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},i.createElement("path",{d:"M9 2v3m6-3v3M9 19v3m6-3v3m4-13h3m-3 5h3M2 9h3m-3 5h3m4.8 5h4.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C19 16.72 19 15.88 19 14.2V9.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C16.72 5 15.88 5 14.2 5H9.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C5 7.28 5 8.12 5 9.8v4.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C7.28 19 8.12 19 9.8 19Z"}));C.displayName="CpuChip02";function g(o){const e=a.c(3);let t;e[0]!==o?(t=o===void 0?{}:o,e[0]=o,e[1]=t):t=e[1];const s=t,{org:c}=l();let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=n(),e[2]=r):r=e[2];const m=r;return u(c.slug,"GATEWAY",m,s)}function A(o){const e=a.c(1),{org:t}=l();let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n(),e[0]=s):s=e[0];const c=s;return h(t.slug,"GATEWAY",o??void 0,c)}function G(){const o=a.c(1),{org:e}=l();let t;o[0]===Symbol.for("react.memo_cache_sentinel")?(t=n(),o[0]=t):t=o[0];const s=t;return f(e.slug,"GATEWAY",s)}export{G as a,A as b,C as i,g as u};
1
+ import{r as i,c as a}from"./index-C5FDJtAp.js";import{c as n}from"./connection-BcYehfdK.js";import{u as l}from"./project-context-provider-DH0iqA5D.js";import{b as u,a as f,u as h}from"./use-collections-DxMxR_jZ.js";const C=({size:o=24,color:e="currentColor",...t})=>i.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},i.createElement("path",{d:"M9 2v3m6-3v3M9 19v3m6-3v3m4-13h3m-3 5h3M2 9h3m-3 5h3m4.8 5h4.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C19 16.72 19 15.88 19 14.2V9.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C16.72 5 15.88 5 14.2 5H9.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C5 7.28 5 8.12 5 9.8v4.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C7.28 19 8.12 19 9.8 19Z"}));C.displayName="CpuChip02";function g(o){const e=a.c(3);let t;e[0]!==o?(t=o===void 0?{}:o,e[0]=o,e[1]=t):t=e[1];const s=t,{org:c}=l();let r;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=n(),e[2]=r):r=e[2];const m=r;return u(c.slug,"GATEWAY",m,s)}function A(o){const e=a.c(1),{org:t}=l();let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=n(),e[0]=s):s=e[0];const c=s;return h(t.slug,"GATEWAY",o??void 0,c)}function G(){const o=a.c(1),{org:e}=l();let t;o[0]===Symbol.for("react.memo_cache_sentinel")?(t=n(),o[0]=t):t=o[0];const s=t;return f(e.slug,"GATEWAY",s)}export{G as a,A as b,C as i,g as u};
@@ -1 +1 @@
1
- import{c as a}from"./index-Dk3lubBQ.js";import{u as S}from"./project-context-provider-B1gr9e2f.js";import{u as L,L as x}from"./localstorage-keys-BJk6gyyN.js";function A(e){const t=a.c(9),{locator:c}=S();let o;t[0]!==c?(o=x.gatewaySystemPrompts(c),t[0]=c,t[1]=o):o=t[1];let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s={},t[2]=s):s=t[2];const[u,l]=L(o,s),n=e?u[e]??"":"";let r;t[3]!==e||t[4]!==l?(r=f=>{e&&l(p=>({...p,[e]:f}))},t[3]=e,t[4]=l,t[5]=r):r=t[5];const i=r;let m;return t[6]!==i||t[7]!==n?(m=[n,i],t[6]=i,t[7]=n,t[8]=m):m=t[8],m}export{A as u};
1
+ import{c as a}from"./index-C5FDJtAp.js";import{u as S}from"./project-context-provider-DH0iqA5D.js";import{u as L,L as x}from"./localstorage-keys-BZEjwsD0.js";function A(e){const t=a.c(9),{locator:c}=S();let o;t[0]!==c?(o=x.gatewaySystemPrompts(c),t[0]=c,t[1]=o):o=t[1];let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s={},t[2]=s):s=t[2];const[u,l]=L(o,s),n=e?u[e]??"":"";let r;t[3]!==e||t[4]!==l?(r=f=>{e&&l(p=>({...p,[e]:f}))},t[3]=e,t[4]=l,t[5]=r):r=t[5];const i=r;let m;return t[6]!==i||t[7]!==n?(m=[n,i],t[6]=i,t[7]=n,t[8]=m):m=t[8],m}export{A as u};
@@ -1 +1 @@
1
- import{r as a,c as T}from"./index-Dk3lubBQ.js";import{u as D}from"./use-mobile-CuBmA9jm.js";const W=({size:l=24,color:e="currentColor",...t})=>a.createElement("svg",{viewBox:"0 0 24 24",width:l,height:l,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},a.createElement("path",{d:"M2.42 12.713c-.136-.215-.204-.323-.242-.49a1.173 1.173 0 0 1 0-.446c.038-.167.106-.274.242-.49C3.546 9.505 6.895 5 12 5s8.455 4.505 9.58 6.287c.137.215.205.323.243.49.029.125.029.322 0 .446-.038.167-.106.274-.242.49C20.455 14.495 17.105 19 12 19c-5.106 0-8.455-4.505-9.58-6.287Z"}),a.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}));W.displayName="Eye";function k(l){const e=`deco-filters-${l}`,[t,c]=a.useState(()=>{try{const o=globalThis.localStorage?.getItem(e);if(o)return JSON.parse(o)}catch(o){console.error("Failed to parse stored filters:",o)}return[]});return[t,o=>{c(o);try{globalThis.localStorage?.setItem(e,JSON.stringify(o))}catch(i){console.error("Failed to save filters:",i)}}]}function C(l){const e=T.c(7),[t,c]=a.useState(l),[s,o]=a.useState(l?"desc":null);let i;e[0]!==s||e[1]!==t?(i=h=>{t!==h?(c(h),o("asc")):s==="asc"?o("desc"):s==="desc"&&(c(void 0),o(null))},e[0]=s,e[1]=t,e[2]=i):i=e[2];const u=i;let r;return e[3]!==u||e[4]!==s||e[5]!==t?(r={sortKey:t,sortDirection:s,handleSort:u},e[3]=u,e[4]=s,e[5]=t,e[6]=r):r=e[6],r}function L(l,e){const t=T.c(12),c=e===void 0?"cards":e,s=D(),o=a.useRef(s),i=l?`deco-view-mode-${l}`:"deco-view-mode";let u;t[0]!==c||t[1]!==i?(u=()=>{const d=globalThis.localStorage?.getItem(i);return d==="cards"||d==="table"?d:c},t[0]=c,t[1]=i,t[2]=u):u=t[2];const[r,h]=a.useState(u);let f;t[3]!==i?(f=d=>{h(d),globalThis.localStorage?.setItem(i,d)},t[3]=i,t[4]=f):f=t[4];const p=f;let S,g;t[5]!==s||t[6]!==r?(S=()=>{!o.current&&s&&r==="table"&&h("cards"),o.current=s},g=[s,r],t[5]=s,t[6]=r,t[7]=S,t[8]=g):(S=t[7],g=t[8]),a.useEffect(S,g);let n;return t[9]!==p||t[10]!==r?(n=[r,p],t[9]=p,t[10]=r,t[11]=n):n=t[11],n}function O(l){const e=T.c(20),{namespace:t,resource:c,defaultSortKey:s,defaultViewMode:o}=l,i=s===void 0?"title":s,u=o===void 0?"table":o,[r,h]=a.useState(""),f=a.useDeferredValue(r),p=`${t}-${c}`,[S,g]=k(p),n=`mesh-${c}-filter-visible-${t}`;let d;e[0]!==n?(d=()=>globalThis.localStorage?.getItem(n)==="true",e[0]=n,e[1]=d):d=e[1];const[m,B]=a.useState(d);let y;e[2]!==n?(y=I=>{B(I),globalThis.localStorage?.setItem(n,String(I))},e[2]=n,e[3]=y):y=e[3];const b=y;let M;e[4]!==m||e[5]!==b?(M=()=>{b(!m)},e[4]=m,e[5]=b,e[6]=M):M=e[6];const w=M,[V,$]=L(`mesh-${c}-${t}`,u),{sortKey:x,sortDirection:F,handleSort:K}=C(i),E=x;let v;return e[7]!==m||e[8]!==S||e[9]!==K||e[10]!==r||e[11]!==f||e[12]!==b||e[13]!==g||e[14]!==$||e[15]!==F||e[16]!==E||e[17]!==w||e[18]!==V?(v={search:r,searchTerm:f,setSearch:h,filters:S,setFilters:g,filterBarVisible:m,setFilterBarVisible:b,toggleFilterBar:w,viewMode:V,setViewMode:$,sortKey:E,sortDirection:F,handleSort:K},e[7]=m,e[8]=S,e[9]=K,e[10]=r,e[11]=f,e[12]=b,e[13]=g,e[14]=$,e[15]=F,e[16]=E,e[17]=w,e[18]=V,e[19]=v):v=e[19],v}export{W as s,O as u};
1
+ import{r as a,c as T}from"./index-C5FDJtAp.js";import{u as D}from"./use-mobile-DT1cwytU.js";const W=({size:l=24,color:e="currentColor",...t})=>a.createElement("svg",{viewBox:"0 0 24 24",width:l,height:l,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},a.createElement("path",{d:"M2.42 12.713c-.136-.215-.204-.323-.242-.49a1.173 1.173 0 0 1 0-.446c.038-.167.106-.274.242-.49C3.546 9.505 6.895 5 12 5s8.455 4.505 9.58 6.287c.137.215.205.323.243.49.029.125.029.322 0 .446-.038.167-.106.274-.242.49C20.455 14.495 17.105 19 12 19c-5.106 0-8.455-4.505-9.58-6.287Z"}),a.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}));W.displayName="Eye";function k(l){const e=`deco-filters-${l}`,[t,c]=a.useState(()=>{try{const o=globalThis.localStorage?.getItem(e);if(o)return JSON.parse(o)}catch(o){console.error("Failed to parse stored filters:",o)}return[]});return[t,o=>{c(o);try{globalThis.localStorage?.setItem(e,JSON.stringify(o))}catch(i){console.error("Failed to save filters:",i)}}]}function C(l){const e=T.c(7),[t,c]=a.useState(l),[s,o]=a.useState(l?"desc":null);let i;e[0]!==s||e[1]!==t?(i=h=>{t!==h?(c(h),o("asc")):s==="asc"?o("desc"):s==="desc"&&(c(void 0),o(null))},e[0]=s,e[1]=t,e[2]=i):i=e[2];const u=i;let r;return e[3]!==u||e[4]!==s||e[5]!==t?(r={sortKey:t,sortDirection:s,handleSort:u},e[3]=u,e[4]=s,e[5]=t,e[6]=r):r=e[6],r}function L(l,e){const t=T.c(12),c=e===void 0?"cards":e,s=D(),o=a.useRef(s),i=l?`deco-view-mode-${l}`:"deco-view-mode";let u;t[0]!==c||t[1]!==i?(u=()=>{const d=globalThis.localStorage?.getItem(i);return d==="cards"||d==="table"?d:c},t[0]=c,t[1]=i,t[2]=u):u=t[2];const[r,h]=a.useState(u);let f;t[3]!==i?(f=d=>{h(d),globalThis.localStorage?.setItem(i,d)},t[3]=i,t[4]=f):f=t[4];const p=f;let S,g;t[5]!==s||t[6]!==r?(S=()=>{!o.current&&s&&r==="table"&&h("cards"),o.current=s},g=[s,r],t[5]=s,t[6]=r,t[7]=S,t[8]=g):(S=t[7],g=t[8]),a.useEffect(S,g);let n;return t[9]!==p||t[10]!==r?(n=[r,p],t[9]=p,t[10]=r,t[11]=n):n=t[11],n}function O(l){const e=T.c(20),{namespace:t,resource:c,defaultSortKey:s,defaultViewMode:o}=l,i=s===void 0?"title":s,u=o===void 0?"table":o,[r,h]=a.useState(""),f=a.useDeferredValue(r),p=`${t}-${c}`,[S,g]=k(p),n=`mesh-${c}-filter-visible-${t}`;let d;e[0]!==n?(d=()=>globalThis.localStorage?.getItem(n)==="true",e[0]=n,e[1]=d):d=e[1];const[m,B]=a.useState(d);let y;e[2]!==n?(y=I=>{B(I),globalThis.localStorage?.setItem(n,String(I))},e[2]=n,e[3]=y):y=e[3];const b=y;let M;e[4]!==m||e[5]!==b?(M=()=>{b(!m)},e[4]=m,e[5]=b,e[6]=M):M=e[6];const w=M,[V,$]=L(`mesh-${c}-${t}`,u),{sortKey:x,sortDirection:F,handleSort:K}=C(i),E=x;let v;return e[7]!==m||e[8]!==S||e[9]!==K||e[10]!==r||e[11]!==f||e[12]!==b||e[13]!==g||e[14]!==$||e[15]!==F||e[16]!==E||e[17]!==w||e[18]!==V?(v={search:r,searchTerm:f,setSearch:h,filters:S,setFilters:g,filterBarVisible:m,setFilterBarVisible:b,toggleFilterBar:w,viewMode:V,setViewMode:$,sortKey:E,sortDirection:F,handleSort:K},e[7]=m,e[8]=S,e[9]=K,e[10]=r,e[11]=f,e[12]=b,e[13]=g,e[14]=$,e[15]=F,e[16]=E,e[17]=w,e[18]=V,e[19]=v):v=e[19],v}export{W as s,O as u};
@@ -1 +1 @@
1
- import{c as E,K as b}from"./index-Dk3lubBQ.js";import{u as j}from"./useQuery-BbeI5BfO.js";function T(g){const e=E.c(18),{url:o,token:r,enabled:w}=g,$=w===void 0?!0:w;let i;e[0]!==r||e[1]!==o?(i=b.mcpTools(o,r),e[0]=r,e[1]=o,e[2]=i):i=e[2];let s;e[3]!==r||e[4]!==o?(s=async()=>{if(!o)return[];const m={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};r&&(m.Authorization=`Bearer ${r}`);const u=await fetch(o,{method:"POST",headers:m,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"mesh-mcp",version:"1.0.0"}}})});if(!u.ok)throw new Error(`MCP initialization failed: ${u.status}`);const h=await u.json();if(h.error)throw new Error(`MCP initialization error: ${h.error.message} (code: ${h.error.code})`);const y=await fetch(o,{method:"POST",headers:m,body:JSON.stringify({jsonrpc:"2.0",id:2,method:"tools/list",params:{}})});if(!y.ok)throw new Error(`Failed to list tools: ${y.status}`);const l=await y.json();if(l.error)throw new Error(`Failed to list tools: ${l.error.message} (code: ${l.error.code})`);return l.result?.tools||[]},e[3]=r,e[4]=o,e[5]=s):s=e[5];const d=$&&!!o;let a;e[6]!==i||e[7]!==s||e[8]!==d?(a={queryKey:i,queryFn:s,enabled:d,staleTime:3e4,retry:!1},e[6]=i,e[7]=s,e[8]=d,e[9]=a):a=e[9];const t=j(a),f=o?t.isLoading?"connecting":t.isError?"error":"ready":"disconnected";let n;e[10]!==t.data?(n=t.data||[],e[10]=t.data,e[11]=n):n=e[11];const p=t.error;let c;return e[12]!==t.isLoading||e[13]!==t.refetch||e[14]!==f||e[15]!==n||e[16]!==p?(c={tools:n,state:f,error:p,isLoading:t.isLoading,refetch:t.refetch},e[12]=t.isLoading,e[13]=t.refetch,e[14]=f,e[15]=n,e[16]=p,e[17]=c):c=e[17],c}export{T as u};
1
+ import{c as E,K as b}from"./index-C5FDJtAp.js";import{u as j}from"./useQuery-Dakt0IBq.js";function T(g){const e=E.c(18),{url:o,token:r,enabled:w}=g,$=w===void 0?!0:w;let i;e[0]!==r||e[1]!==o?(i=b.mcpTools(o,r),e[0]=r,e[1]=o,e[2]=i):i=e[2];let s;e[3]!==r||e[4]!==o?(s=async()=>{if(!o)return[];const m={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};r&&(m.Authorization=`Bearer ${r}`);const u=await fetch(o,{method:"POST",headers:m,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"mesh-mcp",version:"1.0.0"}}})});if(!u.ok)throw new Error(`MCP initialization failed: ${u.status}`);const h=await u.json();if(h.error)throw new Error(`MCP initialization error: ${h.error.message} (code: ${h.error.code})`);const y=await fetch(o,{method:"POST",headers:m,body:JSON.stringify({jsonrpc:"2.0",id:2,method:"tools/list",params:{}})});if(!y.ok)throw new Error(`Failed to list tools: ${y.status}`);const l=await y.json();if(l.error)throw new Error(`Failed to list tools: ${l.error.message} (code: ${l.error.code})`);return l.result?.tools||[]},e[3]=r,e[4]=o,e[5]=s):s=e[5];const d=$&&!!o;let a;e[6]!==i||e[7]!==s||e[8]!==d?(a={queryKey:i,queryFn:s,enabled:d,staleTime:3e4,retry:!1},e[6]=i,e[7]=s,e[8]=d,e[9]=a):a=e[9];const t=j(a),f=o?t.isLoading?"connecting":t.isError?"error":"ready":"disconnected";let n;e[10]!==t.data?(n=t.data||[],e[10]=t.data,e[11]=n):n=e[11];const p=t.error;let c;return e[12]!==t.isLoading||e[13]!==t.refetch||e[14]!==f||e[15]!==n||e[16]!==p?(c={tools:n,state:f,error:p,isLoading:t.isLoading,refetch:t.refetch},e[12]=t.isLoading,e[13]=t.refetch,e[14]=f,e[15]=n,e[16]=p,e[17]=c):c=e[17],c}export{T as u};
@@ -1 +1 @@
1
- import{c as o,q as n,K as u,a as i}from"./index-Dk3lubBQ.js";import{u as a}from"./project-context-provider-B1gr9e2f.js";function p(){const e=o.c(4),{locator:s}=a();let t;e[0]!==s?(t=u.members(s),e[0]=s,e[1]=t):t=e[1];let r;return e[2]!==t?(r={queryKey:t,queryFn:m},e[2]=t,e[3]=r):r=e[3],n(r)}function m(){return i.organization.listMembers()}export{p as u};
1
+ import{c as o,v as n,K as u,a as i}from"./index-C5FDJtAp.js";import{u as a}from"./project-context-provider-DH0iqA5D.js";function p(){const e=o.c(4),{locator:s}=a();let t;e[0]!==s?(t=u.members(s),e[0]=s,e[1]=t):t=e[1];let r;return e[2]!==t?(r={queryKey:t,queryFn:m},e[2]=t,e[3]=r):r=e[3],n(r)}function m(){return i.organization.listMembers()}export{p as u};
@@ -1 +1 @@
1
- import{c as m,r}from"./index-Dk3lubBQ.js";const a=768,o=()=>globalThis.innerWidth<a;function u(){const e=m.c(2),[l,n]=r.useState(o);let t,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{const i=()=>n(o),c=globalThis.matchMedia(`(max-width: ${a-1}px)`);return c.addEventListener("change",i),n(o),()=>c.removeEventListener("change",i)},s=[],e[0]=t,e[1]=s):(t=e[0],s=e[1]),r.useEffect(t,s),l}export{u};
1
+ import{c as m,r}from"./index-C5FDJtAp.js";const a=768,o=()=>globalThis.innerWidth<a;function u(){const e=m.c(2),[l,n]=r.useState(o);let t,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{const i=()=>n(o),c=globalThis.matchMedia(`(max-width: ${a-1}px)`);return c.addEventListener("change",i),n(o),()=>c.removeEventListener("change",i)},s=[],e[0]=t,e[1]=s):(t=e[0],s=e[1]),r.useEffect(t,s),l}export{u};
@@ -0,0 +1,20 @@
1
+ import{r as z,c as q,j as p,x as ga,d as kt,K as Pt,t as Fe,I as va,J as ya,L as ba,M as J,z as g,_ as ke,Q as Dt,U as xa,V as _a,W as wa,X as V,Y as Ie,Z as Re,y as O,$ as _,a0 as ie,a1 as Ea,a2 as M,a3 as Ia,a4 as Sa,f as $t,v as Na}from"./index-C5FDJtAp.js";import{c as G,B as Pe}from"./button-ClkQLR3o.js";import{u as Qe}from"./project-context-provider-DH0iqA5D.js";import{g as Ta,h as Ra,j as Ca,k as Aa,c as ja,l as Oa,S as lt,m as Ma}from"./index-hEHbC4y4.js";import{u as ka}from"./use-gateway-system-prompt-CYi0Zo4K.js";import{I as Pa,E as Da}from"./empty-state-C0gi-aAx.js";import{b as Xe,a as Ke,P as et}from"./popover-DLFe45bO.js";import{t as $a}from"./ChevronDown-QF_Tgl2v.js";import{i as Za}from"./use-gateway-D_zdUoI4.js";import{i as La}from"./Edit01-DVUwOcf8.js";import{c as tt,b as at,T as st,a as Zt}from"./tooltip-DXYcokUT.js";import{a as Ua}from"./use-connection-ClVfoZWG.js";import{O as za,a as Ba,g as Fa}from"./well-known-mcp-D13f-8h2.js";import{g as Va}from"./generate-id-Dyweu44Y.js";import{s as ct}from"./Clock-CiIkKpUg.js";import{i as qa}from"./SearchMd-tLR3QB8E.js";import{s as Ja}from"./Trash01-Dg5Q9OUO.js";import{u as Wa,L as Ga}from"./localstorage-keys-BZEjwsD0.js";var Se;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function a(r){throw new Error}t.assertNever=a,t.arrayToEnum=r=>{const n={};for(const i of r)n[i]=i;return n},t.getValidEnumValues=r=>{const n=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of n)i[o]=r[o];return t.objectValues(i)},t.objectValues=r=>t.objectKeys(r).map(function(n){return r[n]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const n=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push(i);return n},t.find=(r,n)=>{for(const i of r)if(n(i))return i},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}t.joinValues=s,t.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(Se||(Se={}));var ut;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(ut||(ut={}));Se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Se.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class De extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(n){return n.message},s={_errors:[]},r=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(a(i));else{let o=s,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(a(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return r(this),s}static assert(e){if(!(e instanceof De))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Se.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a=Object.create(null),s=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];a[n]=a[n]||[],a[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:a}}get formErrors(){return this.flatten()}}De.create=t=>new De(t);var dt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(dt||(dt={}));var E;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(E||(E={}));const Lt=({size:t=24,color:e="currentColor",...a})=>z.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a},z.createElement("path",{d:"m15 9-6 6m0-6 6 6m7-3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));Lt.displayName="XCircle";function gn(){const t=q.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=p.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),t[0]=e):e=t[0];let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a=p.jsxs("div",{className:"flex items-center gap-3",children:[e,p.jsxs("div",{className:"flex flex-col gap-2",children:[p.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),p.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),t[1]=a):a=t[1];let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=p.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:p.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[a,p.jsxs("div",{className:"flex items-end gap-2",children:[p.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),p.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),t[2]=s):s=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:p.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[p.jsx(je,{align:"right",width:"w-3/4"}),p.jsx(je,{align:"left",width:"w-full",lines:3}),p.jsx(je,{align:"right",width:"w-2/3"}),p.jsx(je,{align:"left",width:"w-5/6",lines:2})]})}),t[3]=r):r=t[3];let n;t[4]===Symbol.for("react.memo_cache_sentinel")?(n=p.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:p.jsx("div",{className:"relative flex-1",children:p.jsxs("div",{className:"space-y-2 p-2",children:[p.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),p.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),t[4]=n):n=t[4];let i;t[5]===Symbol.for("react.memo_cache_sentinel")?(i=p.jsx("div",{className:"flex items-center gap-1",children:p.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),t[5]=i):i=t[5];let o;return t[6]===Symbol.for("react.memo_cache_sentinel")?(o=p.jsxs("div",{className:"flex h-full w-full flex-col bg-sidebar",children:[s,r,p.jsx("div",{className:"px-4 py-4",children:p.jsx("div",{className:"mx-auto w-full max-w-2xl",children:p.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl border border-border bg-background shadow-sm",children:[n,p.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[i,p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),p.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})})]}),t[6]=o):o=t[6],o}function je(t){const e=q.c(22),{align:a,width:s,lines:r}=t,n=s===void 0?"w-full":s,i=r===void 0?1:r,o=a==="right"?"flex-row-reverse":"flex-row";let c;e[0]!==o?(c=G("flex w-full gap-4 px-4 py-2",o),e[0]=o,e[1]=c):c=e[1];const l=a==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let d;e[2]!==l?(d=G("flex min-w-0 flex-col gap-2",l),e[2]=l,e[3]=d):d=e[3];let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=p.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=m):m=e[4];const h=a==="right"?"bg-muted":"bg-transparent border border-border/40";let f;e[5]!==h||e[6]!==n?(f=G("min-w-0 rounded-2xl p-4",h,n),e[5]=h,e[6]=n,e[7]=f):f=e[7];let v;e[8]!==i?(v=Array.from({length:i}),e[8]=i,e[9]=v):v=e[9];let y;e[10]!==i||e[11]!==v?(y=p.jsx("div",{className:"space-y-2",children:v.map((u,T)=>p.jsx("div",{className:G("h-3 rounded bg-muted-foreground/20 animate-pulse",T===i-1?"w-3/4":"w-full"),style:{animationDelay:`${T*.1}s`}},T))}),e[10]=i,e[11]=v,e[12]=y):y=e[12];let b;e[13]!==y||e[14]!==f?(b=p.jsx("div",{className:f,children:y}),e[13]=y,e[14]=f,e[15]=b):b=e[15];let x;e[16]!==b||e[17]!==d?(x=p.jsxs("div",{className:d,children:[m,b]}),e[16]=b,e[17]=d,e[18]=x):x=e[18];let S;return e[19]!==x||e[20]!==c?(S=p.jsx("div",{className:c,children:x}),e[19]=x,e[20]=c,e[21]=S):S=e[21],S}function vn(){const t=q.c(5),e=ga(),{org:a}=Qe();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},t[0]=s):s=t[0];const r=kt(s);let n;return t[1]!==a||t[2]!==r||t[3]!==e?(n=i=>{const c=i.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!c||!c[1])return;const l=c[1],d=r.connectionId;if(!d)return;e.invalidateQueries({queryKey:Pt.collection(a.slug,d,l)});const m=l.toLowerCase().replace(/_/g," ");Fe.success(`${m} updated`)},t[1]=a,t[2]=r,t[3]=e,t[4]=n):n=t[4],n}var Ut="vercel.ai.error",Ya=Symbol.for(Ut),pt,mt,oe=class zt extends(mt=Error,pt=Ya,mt){constructor({name:e,message:a,cause:s}){super(a),this[pt]=!0,this.name=e,this.cause=s}static isInstance(e){return zt.hasMarker(e,Ut)}static hasMarker(e,a){const s=Symbol.for(a);return e!=null&&typeof e=="object"&&s in e&&typeof e[s]=="boolean"&&e[s]===!0}};function Bt(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Ft="AI_InvalidArgumentError",Vt=`vercel.ai.error.${Ft}`,Ha=Symbol.for(Vt),ft,ht,Qa=class extends(ht=oe,ft=Ha,ht){constructor({message:t,cause:e,argument:a}){super({name:Ft,message:t,cause:e}),this[ft]=!0,this.argument=a}static isInstance(t){return oe.hasMarker(t,Vt)}},qt="AI_JSONParseError",Jt=`vercel.ai.error.${qt}`,Xa=Symbol.for(Jt),gt,vt,yt=class extends(vt=oe,gt=Xa,vt){constructor({text:t,cause:e}){super({name:qt,message:`JSON parsing failed: Text: ${t}.
2
+ Error message: ${Bt(e)}`,cause:e}),this[gt]=!0,this.text=t}static isInstance(t){return oe.hasMarker(t,Jt)}},Wt="AI_TypeValidationError",Gt=`vercel.ai.error.${Wt}`,Ka=Symbol.for(Gt),bt,xt,xe=class Ve extends(xt=oe,bt=Ka,xt){constructor({value:e,cause:a}){super({name:Wt,message:`Type validation failed: Value: ${JSON.stringify(e)}.
3
+ Error message: ${Bt(a)}`,cause:a}),this[bt]=!0,this.value=e}static isInstance(e){return oe.hasMarker(e,Gt)}static wrap({value:e,cause:a}){return Ve.isInstance(a)&&a.value===e?a:new Ve({value:e,cause:a})}},Ce=({prefix:t,size:e=16,alphabet:a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:s="-"}={})=>{const r=()=>{const n=a.length,i=new Array(e);for(let o=0;o<e;o++)i[o]=a[Math.random()*n|0];return i.join("")};if(t==null)return r;if(a.includes(s))throw new Qa({argument:"separator",message:`The separator "${s}" must not be part of the alphabet "${a}".`});return()=>`${t}${s}${r()}`},es=Ce();function _t(t=globalThis){var e,a,s;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(s=(a=t.process)==null?void 0:a.versions)!=null&&s.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function pe(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((a,s)=>{e[s.toLowerCase()]=a});else{Array.isArray(t)||(t=Object.entries(t));for(const[a,s]of t)s!=null&&(e[a.toLowerCase()]=s)}return e}function wt(t,...e){const a=new Headers(pe(t)),s=a.get("user-agent")||"";return a.set("user-agent",[s,...e].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var ts=/"__proto__"\s*:/,as=/"constructor"\s*:/;function Et(t){const e=JSON.parse(t);return e===null||typeof e!="object"||ts.test(t)===!1&&as.test(t)===!1?e:ss(e)}function ss(t){let e=[t];for(;e.length;){const a=e;e=[];for(const s of a){if(Object.prototype.hasOwnProperty.call(s,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(s,"constructor")&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const r in s){const n=s[r];n&&typeof n=="object"&&e.push(n)}}}return t}function rs(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return Et(t)}try{return Et(t)}finally{Error.stackTraceLimit=e}}function rt(t){if(t.type==="object"||Array.isArray(t.type)&&t.type.includes("object")){t.additionalProperties=!1;const{properties:a}=t;if(a!=null)for(const s of Object.keys(a))a[s]=de(a[s])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(de):de(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(de)),t.allOf!=null&&(t.allOf=t.allOf.map(de)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(de));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=de(e[a]);return t}function de(t){return typeof t=="boolean"?t:rt(t)}var ns=Symbol("Let zodToJsonSchema decide on which parser to use"),It={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},os=t=>typeof t=="string"?{...It,name:t}:{...It,...t};function Y(){return{}}function is(t,e){var a,s,r;const n={type:"array"};return(a=t.type)!=null&&a._def&&((r=(s=t.type)==null?void 0:s._def)==null?void 0:r.typeName)!==E.ZodAny&&(n.items=j(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(n.minItems=t.minLength.value),t.maxLength&&(n.maxItems=t.maxLength.value),t.exactLength&&(n.minItems=t.exactLength.value,n.maxItems=t.exactLength.value),n}function ls(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function cs(){return{type:"boolean"}}function Yt(t,e){return j(t.type._def,e)}var us=(t,e)=>j(t.innerType._def,e);function Ht(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>Ht(t,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return ds(t)}}var ds=t=>{const e={type:"integer",format:"unix-time"};for(const a of t.checks)switch(a.kind){case"min":e.minimum=a.value;break;case"max":e.maximum=a.value;break}return e};function ps(t,e){return{...j(t.innerType._def,e),default:t.defaultValue()}}function ms(t,e){return e.effectStrategy==="input"?j(t.schema._def,e):Y()}function fs(t){return{type:"string",enum:Array.from(t.values)}}var hs=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function gs(t,e){const a=[j(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),j(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(r=>!!r),s=[];return a.forEach(r=>{if(hs(r))s.push(...r.allOf);else{let n=r;if("additionalProperties"in r&&r.additionalProperties===!1){const{additionalProperties:i,...o}=r;n=o}s.push(n)}}),s.length?{allOf:s}:void 0}function vs(t){const e=typeof t.value;return e!=="bigint"&&e!=="number"&&e!=="boolean"&&e!=="string"?{type:Array.isArray(t.value)?"array":"object"}:{type:e==="bigint"?"integer":e,const:t.value}}var Ue=void 0,K={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Ue===void 0&&(Ue=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ue),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Qt(t,e){const a={type:"string"};if(t.checks)for(const s of t.checks)switch(s.kind){case"min":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value;break;case"max":a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value;break;case"email":switch(e.emailStrategy){case"format:email":ee(a,"email",s.message,e);break;case"format:idn-email":ee(a,"idn-email",s.message,e);break;case"pattern:zod":F(a,K.email,s.message,e);break}break;case"url":ee(a,"uri",s.message,e);break;case"uuid":ee(a,"uuid",s.message,e);break;case"regex":F(a,s.regex,s.message,e);break;case"cuid":F(a,K.cuid,s.message,e);break;case"cuid2":F(a,K.cuid2,s.message,e);break;case"startsWith":F(a,RegExp(`^${ze(s.value,e)}`),s.message,e);break;case"endsWith":F(a,RegExp(`${ze(s.value,e)}$`),s.message,e);break;case"datetime":ee(a,"date-time",s.message,e);break;case"date":ee(a,"date",s.message,e);break;case"time":ee(a,"time",s.message,e);break;case"duration":ee(a,"duration",s.message,e);break;case"length":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,s.value):s.value,a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,s.value):s.value;break;case"includes":{F(a,RegExp(ze(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&ee(a,"ipv4",s.message,e),s.version!=="v4"&&ee(a,"ipv6",s.message,e);break}case"base64url":F(a,K.base64url,s.message,e);break;case"jwt":F(a,K.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&F(a,K.ipv4Cidr,s.message,e),s.version!=="v4"&&F(a,K.ipv6Cidr,s.message,e);break}case"emoji":F(a,K.emoji(),s.message,e);break;case"ulid":{F(a,K.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{ee(a,"binary",s.message,e);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{F(a,K.base64,s.message,e);break}}break}case"nanoid":F(a,K.nanoid,s.message,e)}return a}function ze(t,e){return e.patternStrategy==="escape"?bs(t):t}var ys=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function bs(t){let e="";for(let a=0;a<t.length;a++)ys.has(t[a])||(e+="\\"),e+=t[a];return e}function ee(t,e,a,s){var r;t.format||(r=t.anyOf)!=null&&r.some(n=>n.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...a&&s.errorMessages&&{errorMessage:{format:a}}})):t.format=e}function F(t,e,a,s){var r;t.pattern||(r=t.allOf)!=null&&r.some(n=>n.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:St(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=St(e,s)}function St(t,e){var a;if(!e.applyRegexFlags||!t.flags)return t.source;const s={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},r=s.i?t.source.toLowerCase():t.source;let n="",i=!1,o=!1,c=!1;for(let l=0;l<r.length;l++){if(i){n+=r[l],i=!1;continue}if(s.i){if(o){if(r[l].match(/[a-z]/)){c?(n+=r[l],n+=`${r[l-2]}-${r[l]}`.toUpperCase(),c=!1):r[l+1]==="-"&&((a=r[l+2])!=null&&a.match(/[a-z]/))?(n+=r[l],c=!0):n+=`${r[l]}${r[l].toUpperCase()}`;continue}}else if(r[l].match(/[a-z]/)){n+=`[${r[l]}${r[l].toUpperCase()}]`;continue}}if(s.m){if(r[l]==="^"){n+=`(^|(?<=[\r
4
+ ]))`;continue}else if(r[l]==="$"){n+=`($|(?=[\r
5
+ ]))`;continue}}if(s.s&&r[l]==="."){n+=o?`${r[l]}\r
6
+ `:`[${r[l]}\r
7
+ ]`;continue}n+=r[l],r[l]==="\\"?i=!0:o&&r[l]==="]"?o=!1:!o&&r[l]==="["&&(o=!0)}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return n}function Xt(t,e){var a,s,r,n,i,o;const c={type:"object",additionalProperties:(a=j(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?a:e.allowedAdditionalProperties};if(((s=t.keyType)==null?void 0:s._def.typeName)===E.ZodString&&((r=t.keyType._def.checks)!=null&&r.length)){const{type:l,...d}=Qt(t.keyType._def,e);return{...c,propertyNames:d}}else{if(((n=t.keyType)==null?void 0:n._def.typeName)===E.ZodEnum)return{...c,propertyNames:{enum:t.keyType._def.values}};if(((i=t.keyType)==null?void 0:i._def.typeName)===E.ZodBranded&&t.keyType._def.type._def.typeName===E.ZodString&&((o=t.keyType._def.type._def.checks)!=null&&o.length)){const{type:l,...d}=Yt(t.keyType._def,e);return{...c,propertyNames:d}}}return c}function xs(t,e){if(e.mapStrategy==="record")return Xt(t,e);const a=j(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Y(),s=j(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Y();return{type:"array",maxItems:125,items:{type:"array",items:[a,s],minItems:2,maxItems:2}}}function _s(t){const e=t.values,s=Object.keys(t.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function ws(){return{not:Y()}}function Es(){return{type:"null"}}var qe={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Is(t,e){const a=t.options instanceof Map?Array.from(t.options.values()):t.options;if(a.every(s=>s._def.typeName in qe&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,n)=>{const i=qe[n._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:s.length>1?s:s[0]}}else if(a.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){const s=a.reduce((r,n)=>{const i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];default:return r}},[]);if(s.length===a.length){const r=s.filter((n,i,o)=>o.indexOf(n)===i);return{type:r.length>1?r:r[0],enum:a.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._def.value],[])}}}else if(a.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:a.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return Ss(t,e)}var Ss=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>j(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return a.length?{anyOf:a}:void 0};function Ns(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[qe[t.innerType._def.typeName],"null"]};const a=j(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function Ts(t){const e={type:"number"};if(!t.checks)return e;for(const a of t.checks)switch(a.kind){case"int":e.type="integer";break;case"min":a.inclusive?e.minimum=a.value:e.exclusiveMinimum=a.value;break;case"max":a.inclusive?e.maximum=a.value:e.exclusiveMaximum=a.value;break;case"multipleOf":e.multipleOf=a.value;break}return e}function Rs(t,e){const a={type:"object",properties:{}},s=[],r=t.shape();for(const i in r){let o=r[i];if(o===void 0||o._def===void 0)continue;const c=As(o),l=j(o._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});l!==void 0&&(a.properties[i]=l,c||s.push(i))}s.length&&(a.required=s);const n=Cs(t,e);return n!==void 0&&(a.additionalProperties=n),a}function Cs(t,e){if(t.catchall._def.typeName!=="ZodNever")return j(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function As(t){try{return t.isOptional()}catch{return!0}}var js=(t,e)=>{var a;if(e.currentPath.toString()===((a=e.propertyPath)==null?void 0:a.toString()))return j(t.innerType._def,e);const s=j(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return s?{anyOf:[{not:Y()},s]}:Y()},Os=(t,e)=>{if(e.pipeStrategy==="input")return j(t.in._def,e);if(e.pipeStrategy==="output")return j(t.out._def,e);const a=j(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=j(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function Ms(t,e){return j(t.type._def,e)}function ks(t,e){const s={type:"array",uniqueItems:!0,items:j(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(s.minItems=t.minSize.value),t.maxSize&&(s.maxItems=t.maxSize.value),s}function Ps(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>j(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:j(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>j(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function Ds(){return{not:Y()}}function $s(){return Y()}var Zs=(t,e)=>j(t.innerType._def,e),Ls=(t,e,a)=>{switch(e){case E.ZodString:return Qt(t,a);case E.ZodNumber:return Ts(t);case E.ZodObject:return Rs(t,a);case E.ZodBigInt:return ls(t);case E.ZodBoolean:return cs();case E.ZodDate:return Ht(t,a);case E.ZodUndefined:return Ds();case E.ZodNull:return Es();case E.ZodArray:return is(t,a);case E.ZodUnion:case E.ZodDiscriminatedUnion:return Is(t,a);case E.ZodIntersection:return gs(t,a);case E.ZodTuple:return Ps(t,a);case E.ZodRecord:return Xt(t,a);case E.ZodLiteral:return vs(t);case E.ZodEnum:return fs(t);case E.ZodNativeEnum:return _s(t);case E.ZodNullable:return Ns(t,a);case E.ZodOptional:return js(t,a);case E.ZodMap:return xs(t,a);case E.ZodSet:return ks(t,a);case E.ZodLazy:return()=>t.getter()._def;case E.ZodPromise:return Ms(t,a);case E.ZodNaN:case E.ZodNever:return ws();case E.ZodEffects:return ms(t,a);case E.ZodAny:return Y();case E.ZodUnknown:return $s();case E.ZodDefault:return ps(t,a);case E.ZodBranded:return Yt(t,a);case E.ZodReadonly:return Zs(t,a);case E.ZodCatch:return us(t,a);case E.ZodPipeline:return Os(t,a);case E.ZodFunction:case E.ZodVoid:case E.ZodSymbol:return;default:return(s=>{})()}},Us=(t,e)=>{let a=0;for(;a<t.length&&a<e.length&&t[a]===e[a];a++);return[(t.length-a).toString(),...e.slice(a)].join("/")};function j(t,e,a=!1){var s;const r=e.seen.get(t);if(e.override){const c=(s=e.override)==null?void 0:s.call(e,t,e,r,a);if(c!==ns)return c}if(r&&!a){const c=zs(r,e);if(c!==void 0)return c}const n={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,n);const i=Ls(t,t.typeName,e),o=typeof i=="function"?j(i(),e):i;if(o&&Bs(t,e,o),e.postProcess){const c=e.postProcess(o,t,e);return n.jsonSchema=o,c}return n.jsonSchema=o,o}var zs=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Us(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((a,s)=>e.currentPath[s]===a)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Y()):e.$refStrategy==="seen"?Y():void 0}},Bs=(t,e,a)=>(t.description&&(a.description=t.description),a),Fs=t=>{const e=os(t),a=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}},Vs=(t,e)=>{var a;const s=Fs(e);let r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[d,m])=>{var h;return{...l,[d]:(h=j(m._def,{...s,currentPath:[...s.basePath,s.definitionPath,d]},!0))!=null?h:Y()}},{}):void 0;const n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(a=j(t._def,n===void 0?s:{...s,currentPath:[...s.basePath,s.definitionPath,n]},!1))!=null?a:Y(),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(i.title=o);const c=n===void 0?r?{...i,[s.definitionPath]:r}:i:{$ref:[...s.$refStrategy==="relative"?[]:s.basePath,s.definitionPath,n].join("/"),[s.definitionPath]:{...r,[n]:i}};return c.$schema="http://json-schema.org/draft-07/schema#",c},Je=Symbol.for("vercel.ai.schema");function qs(t){let e;return()=>(e==null&&(e=t()),e)}function $e(t,{validate:e}={}){return{[Je]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function Js(t){return typeof t=="object"&&t!==null&&Je in t&&t[Je]===!0&&"jsonSchema"in t&&"validate"in t}function nt(t){return t==null?$e({properties:{},additionalProperties:!1}):Js(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?Kt(t):Ws(t):t()}function Ws(t){return $e(()=>rt(t["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async e=>{const a=await t["~standard"].validate(e);return"value"in a?{success:!0,value:a.value}:{success:!1,error:new xe({value:e,cause:a.issues})}}})}function Gs(t,e){var a;const s=(a=void 0)!=null?a:!1;return $e(()=>Vs(t,{$refStrategy:s?"root":"none"}),{validate:async r=>{const n=await t.safeParseAsync(r);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function Ys(t,e){var a;const s=(a=void 0)!=null?a:!1;return $e(()=>rt(ba(t,{target:"draft-7",io:"input",reused:s?"ref":"inline"})),{validate:async r=>{const n=await ya(t,r);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function Hs(t){return"_zod"in t}function Kt(t,e){return Hs(t)?Ys(t):Gs(t)}async function Nt({value:t,schema:e}){const a=await Ne({value:t,schema:e});if(!a.success)throw xe.wrap({value:t,cause:a.error});return a.value}async function Ne({value:t,schema:e}){const a=nt(e);try{if(a.validate==null)return{success:!0,value:t,rawValue:t};const s=await a.validate(t);return s.success?{success:!0,value:s.value,rawValue:t}:{success:!1,error:xe.wrap({value:t,cause:s.error}),rawValue:t}}catch(s){return{success:!1,error:xe.wrap({value:t,cause:s}),rawValue:t}}}async function me({text:t,schema:e}){try{const a=rs(t);return e==null?{success:!0,value:a,rawValue:a}:await Ne({value:a,schema:e})}catch(a){return{success:!1,error:yt.isInstance(a)?a:new yt({text:t,cause:a}),rawValue:void 0}}}function Qs({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new va).pipeThrough(new TransformStream({async transform({data:a},s){a!=="[DONE]"&&s.enqueue(await me({text:a,schema:e}))}}))}async function ce(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var Xs=Object.defineProperty,Ks=(t,e)=>{for(var a in e)Xs(t,a,{get:e[a],enumerable:!0})},ea="AI_NoObjectGeneratedError",ta=`vercel.ai.error.${ea}`,er=Symbol.for(ta),aa,ue=class extends oe{constructor({message:t="No object generated.",cause:e,text:a,response:s,usage:r,finishReason:n}){super({name:ea,message:t,cause:e}),this[aa]=!0,this.text=a,this.response=s,this.usage=r,this.finishReason=n}static isInstance(t){return oe.hasMarker(t,ta)}};aa=er;var sa="AI_UIMessageStreamError",ra=`vercel.ai.error.${sa}`,tr=Symbol.for(ra),na,ve=class extends oe{constructor({chunkType:t,chunkId:e,message:a}){super({name:sa,message:a}),this[na]=!0,this.chunkType=t,this.chunkId=e}static isInstance(t){return oe.hasMarker(t,ra)}};na=tr;var Tt="6.0.35",oa=J([g(),ke(Uint8Array),ke(ArrayBuffer),Dt(t=>{var e,a;return(a=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?a:!1},{message:"Must be a Buffer"})]),Te=xa(()=>J([_a(),g(),wa(),V(),Ie(g(),Te.optional()),Re(Te)])),C=Ie(g(),Ie(g(),Te.optional())),ia=O({type:_("text"),text:g(),providerOptions:C.optional()}),ar=O({type:_("image"),image:J([oa,ke(URL)]),mediaType:g().optional(),providerOptions:C.optional()}),la=O({type:_("file"),data:J([oa,ke(URL)]),filename:g().optional(),mediaType:g(),providerOptions:C.optional()}),sr=O({type:_("reasoning"),text:g(),providerOptions:C.optional()}),rr=O({type:_("tool-call"),toolCallId:g(),toolName:g(),input:ie(),providerOptions:C.optional(),providerExecuted:V().optional()}),nr=Ea("type",[O({type:_("text"),value:g(),providerOptions:C.optional()}),O({type:_("json"),value:Te,providerOptions:C.optional()}),O({type:_("execution-denied"),reason:g().optional(),providerOptions:C.optional()}),O({type:_("error-text"),value:g(),providerOptions:C.optional()}),O({type:_("error-json"),value:Te,providerOptions:C.optional()}),O({type:_("content"),value:Re(J([O({type:_("text"),text:g(),providerOptions:C.optional()}),O({type:_("media"),data:g(),mediaType:g()}),O({type:_("file-data"),data:g(),mediaType:g(),filename:g().optional(),providerOptions:C.optional()}),O({type:_("file-url"),url:g(),providerOptions:C.optional()}),O({type:_("file-id"),fileId:J([g(),Ie(g(),g())]),providerOptions:C.optional()}),O({type:_("image-data"),data:g(),mediaType:g(),providerOptions:C.optional()}),O({type:_("image-url"),url:g(),providerOptions:C.optional()}),O({type:_("image-file-id"),fileId:J([g(),Ie(g(),g())]),providerOptions:C.optional()}),O({type:_("custom"),providerOptions:C.optional()})]))})]),ca=O({type:_("tool-result"),toolCallId:g(),toolName:g(),output:nr,providerOptions:C.optional()}),or=O({type:_("tool-approval-request"),approvalId:g(),toolCallId:g()}),ir=O({type:_("tool-approval-response"),approvalId:g(),approved:V(),reason:g().optional()}),lr=O({role:_("system"),content:g(),providerOptions:C.optional()}),cr=O({role:_("user"),content:J([g(),Re(J([ia,ar,la]))]),providerOptions:C.optional()}),ur=O({role:_("assistant"),content:J([g(),Re(J([ia,la,sr,rr,ca,or]))]),providerOptions:C.optional()}),dr=O({role:_("tool"),content:Re(J([ca,ir])),providerOptions:C.optional()});J([lr,cr,ur,dr]);function ua(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const a={...t};for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)){const r=e[s];if(r===void 0)continue;const n=s in t?t[s]:void 0,i=r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp),o=n!=null&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof Date)&&!(n instanceof RegExp);i&&o?a[s]=ua(n,r):a[s]=r}return a}var pr={};Ks(pr,{array:()=>gr,choice:()=>vr,json:()=>yr,object:()=>hr,text:()=>fr});function mr(t){const e=["ROOT"];let a=-1,s=null;function r(c,l,d){switch(c){case'"':{a=l,e.pop(),e.push(d),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{a=l,s=l,e.pop(),e.push(d),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(d),e.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{a=l,e.pop(),e.push(d),e.push("INSIDE_NUMBER");break}case"{":{a=l,e.pop(),e.push(d),e.push("INSIDE_OBJECT_START");break}case"[":{a=l,e.pop(),e.push(d),e.push("INSIDE_ARRAY_START");break}}}function n(c,l){switch(c){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{a=l,e.pop();break}}}function i(c,l){switch(c){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{a=l,e.pop();break}}}for(let c=0;c<t.length;c++){const l=t[c];switch(e[e.length-1]){case"ROOT":r(l,c,"FINISH");break;case"INSIDE_OBJECT_START":{switch(l){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{a=c,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{l===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{r(l,c,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{n(l,c);break}case"INSIDE_STRING":{switch(l){case'"':{e.pop(),a=c;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:a=c}break}case"INSIDE_ARRAY_START":{l==="]"?(a=c,e.pop()):(a=c,r(l,c,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{a=c,e.pop();break}default:{a=c;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{r(l,c,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),a=c;break}case"INSIDE_NUMBER":{switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{a=c;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&n(l,c);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&n(l,c);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const m=t.substring(s,c+1);!"false".startsWith(m)&&!"true".startsWith(m)&&!"null".startsWith(m)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?n(l,c):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(l,c)):a=c;break}}}let o=t.slice(0,a+1);for(let c=e.length-1;c>=0;c--)switch(e[c]){case"INSIDE_STRING":{o+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{o+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{o+="]";break}case"INSIDE_LITERAL":{const d=t.substring(s,t.length);"true".startsWith(d)?o+="true".slice(d.length):"false".startsWith(d)?o+="false".slice(d.length):"null".startsWith(d)&&(o+="null".slice(d.length))}}return o}async function Ae(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await me({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await me({text:mr(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var fr=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),hr=({schema:t,name:e,description:a})=>{const s=nt(t);return{name:"object",responseFormat:ce(s.jsonSchema).then(r=>({type:"json",schema:r,...e!=null&&{name:e},...a!=null&&{description:a}})),async parseCompleteOutput({text:r},n){const i=await me({text:r});if(!i.success)throw new ue({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});const o=await Ne({value:i.value,schema:s});if(!o.success)throw new ue({message:"No object generated: response did not match schema.",cause:o.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});return o.value},async parsePartialOutput({text:r}){const n=await Ae(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:n.value}}},createElementStreamTransform(){}}},gr=({element:t,name:e,description:a})=>{const s=nt(t);return{name:"array",responseFormat:ce(s.jsonSchema).then(r=>{const{$schema:n,...i}=r;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...a!=null&&{description:a}}}),async parseCompleteOutput({text:r},n){const i=await me({text:r});if(!i.success)throw new ue({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});const o=i.value;if(o==null||typeof o!="object"||!("elements"in o)||!Array.isArray(o.elements))throw new ue({message:"No object generated: response did not match schema.",cause:new xe({value:o,cause:"response must be an object with an elements array"}),text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});for(const c of o.elements){const l=await Ne({value:c,schema:s});if(!l.success)throw new ue({message:"No object generated: response did not match schema.",cause:l.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason})}return o.elements},async parsePartialOutput({text:r}){const n=await Ae(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const i=n.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;const o=n.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,c=[];for(const l of o){const d=await Ne({value:l,schema:s});d.success&&c.push(d.value)}return{partial:c}}}},createElementStreamTransform(){let r=0;return new TransformStream({transform({partialOutput:n},i){if(n!=null)for(;r<n.length;r++)i.enqueue(n[r])}})}}},vr=({options:t,name:e,description:a})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:t}},required:["result"],additionalProperties:!1},...e!=null&&{name:e},...a!=null&&{description:a}}),async parseCompleteOutput({text:s},r){const n=await me({text:s});if(!n.success)throw new ue({message:"No object generated: could not parse the response.",cause:n.error,text:s,response:r.response,usage:r.usage,finishReason:r.finishReason});const i=n.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!t.includes(i.result))throw new ue({message:"No object generated: response did not match schema.",cause:new xe({value:i,cause:"response must be an object that contains a choice value."}),text:s,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.result},async parsePartialOutput({text:s}){const r=await Ae(s);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const n=r.value;if(n==null||typeof n!="object"||!("result"in n)||typeof n.result!="string")return;const i=t.filter(o=>o.startsWith(n.result));return r.state==="successful-parse"?i.includes(n.result)?{partial:n.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),yr=({name:t,description:e}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:a},s){const r=await me({text:a});if(!r.success)throw new ue({message:"No object generated: could not parse the response.",cause:r.error,text:a,response:s.response,usage:s.usage,finishReason:s.finishReason});return r.value},async parsePartialOutput({text:a}){const s=await Ae(a);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return s.value===void 0?void 0:{partial:s.value}}},createElementStreamTransform(){}});Ce({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
8
+
9
+ `)},flush(t){t.enqueue(`data: [DONE]
10
+
11
+ `)}})}});var br=qs(()=>Kt(J([M({type:_("text-start"),id:g(),providerMetadata:C.optional()}),M({type:_("text-delta"),id:g(),delta:g(),providerMetadata:C.optional()}),M({type:_("text-end"),id:g(),providerMetadata:C.optional()}),M({type:_("error"),errorText:g()}),M({type:_("tool-input-start"),toolCallId:g(),toolName:g(),providerExecuted:V().optional(),dynamic:V().optional(),title:g().optional()}),M({type:_("tool-input-delta"),toolCallId:g(),inputTextDelta:g()}),M({type:_("tool-input-available"),toolCallId:g(),toolName:g(),input:ie(),providerExecuted:V().optional(),providerMetadata:C.optional(),dynamic:V().optional(),title:g().optional()}),M({type:_("tool-input-error"),toolCallId:g(),toolName:g(),input:ie(),providerExecuted:V().optional(),providerMetadata:C.optional(),dynamic:V().optional(),errorText:g(),title:g().optional()}),M({type:_("tool-approval-request"),approvalId:g(),toolCallId:g()}),M({type:_("tool-output-available"),toolCallId:g(),output:ie(),providerExecuted:V().optional(),dynamic:V().optional(),preliminary:V().optional()}),M({type:_("tool-output-error"),toolCallId:g(),errorText:g(),providerExecuted:V().optional(),dynamic:V().optional()}),M({type:_("tool-output-denied"),toolCallId:g()}),M({type:_("reasoning-start"),id:g(),providerMetadata:C.optional()}),M({type:_("reasoning-delta"),id:g(),delta:g(),providerMetadata:C.optional()}),M({type:_("reasoning-end"),id:g(),providerMetadata:C.optional()}),M({type:_("source-url"),sourceId:g(),url:g(),title:g().optional(),providerMetadata:C.optional()}),M({type:_("source-document"),sourceId:g(),mediaType:g(),title:g(),filename:g().optional(),providerMetadata:C.optional()}),M({type:_("file"),url:g(),mediaType:g(),providerMetadata:C.optional()}),M({type:Dt(t=>typeof t=="string"&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:g().optional(),data:ie(),transient:V().optional()}),M({type:_("start-step")}),M({type:_("finish-step")}),M({type:_("start"),messageId:g().optional(),messageMetadata:ie().optional()}),M({type:_("finish"),finishReason:Ia(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:ie().optional()}),M({type:_("abort"),reason:g().optional()}),M({type:_("message-metadata"),messageMetadata:ie()})])));function xr(t){return t.type.startsWith("data-")}function We(t){return t.type.startsWith("tool-")}function _r(t){return t.type==="dynamic-tool"}function Ge(t){return We(t)||_r(t)}function Rt(t){return t.type.split("-").slice(1).join("-")}function wr({lastMessage:t,messageId:e}){return{message:t?.role==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function Er({stream:t,messageMetadataSchema:e,dataPartSchemas:a,runUpdateMessageJob:s,onError:r,onToolCall:n,onData:i}){return t.pipeThrough(new TransformStream({async transform(o,c){await s(async({state:l,write:d})=>{var m,h,f,v;function y(u){const N=l.message.parts.filter(Ge).find(w=>w.toolCallId===u);if(N==null)throw new ve({chunkType:"tool-invocation",chunkId:u,message:`No tool invocation found for tool call ID "${u}".`});return N}function b(u){var T;const N=l.message.parts.find(A=>We(A)&&A.toolCallId===u.toolCallId),w=u,I=N;N!=null?(N.state=u.state,I.input=w.input,I.output=w.output,I.errorText=w.errorText,I.rawInput=w.rawInput,I.preliminary=w.preliminary,u.title!==void 0&&(I.title=u.title),I.providerExecuted=(T=w.providerExecuted)!=null?T:N.providerExecuted,w.providerMetadata!=null&&N.state==="input-available"&&(N.callProviderMetadata=w.providerMetadata)):l.message.parts.push({type:`tool-${u.toolName}`,toolCallId:u.toolCallId,state:u.state,title:u.title,input:w.input,output:w.output,rawInput:w.rawInput,errorText:w.errorText,providerExecuted:w.providerExecuted,preliminary:w.preliminary,...w.providerMetadata!=null?{callProviderMetadata:w.providerMetadata}:{}})}function x(u){var T,N;const w=l.message.parts.find($=>$.type==="dynamic-tool"&&$.toolCallId===u.toolCallId),I=u,A=w;w!=null?(w.state=u.state,A.toolName=u.toolName,A.input=I.input,A.output=I.output,A.errorText=I.errorText,A.rawInput=(T=I.rawInput)!=null?T:A.rawInput,A.preliminary=I.preliminary,u.title!==void 0&&(A.title=u.title),A.providerExecuted=(N=I.providerExecuted)!=null?N:w.providerExecuted,I.providerMetadata!=null&&w.state==="input-available"&&(w.callProviderMetadata=I.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:u.toolName,toolCallId:u.toolCallId,state:u.state,input:I.input,output:I.output,errorText:I.errorText,preliminary:I.preliminary,providerExecuted:I.providerExecuted,title:u.title,...I.providerMetadata!=null?{callProviderMetadata:I.providerMetadata}:{}})}async function S(u){if(u!=null){const T=l.message.metadata!=null?ua(l.message.metadata,u):u;e!=null&&await Nt({value:T,schema:e}),l.message.metadata=T}}switch(o.type){case"text-start":{const u={type:"text",text:"",providerMetadata:o.providerMetadata,state:"streaming"};l.activeTextParts[o.id]=u,l.message.parts.push(u),d();break}case"text-delta":{const u=l.activeTextParts[o.id];if(u==null)throw new ve({chunkType:"text-delta",chunkId:o.id,message:`Received text-delta for missing text part with ID "${o.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});u.text+=o.delta,u.providerMetadata=(m=o.providerMetadata)!=null?m:u.providerMetadata,d();break}case"text-end":{const u=l.activeTextParts[o.id];if(u==null)throw new ve({chunkType:"text-end",chunkId:o.id,message:`Received text-end for missing text part with ID "${o.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});u.state="done",u.providerMetadata=(h=o.providerMetadata)!=null?h:u.providerMetadata,delete l.activeTextParts[o.id],d();break}case"reasoning-start":{const u={type:"reasoning",text:"",providerMetadata:o.providerMetadata,state:"streaming"};l.activeReasoningParts[o.id]=u,l.message.parts.push(u),d();break}case"reasoning-delta":{const u=l.activeReasoningParts[o.id];if(u==null)throw new ve({chunkType:"reasoning-delta",chunkId:o.id,message:`Received reasoning-delta for missing reasoning part with ID "${o.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});u.text+=o.delta,u.providerMetadata=(f=o.providerMetadata)!=null?f:u.providerMetadata,d();break}case"reasoning-end":{const u=l.activeReasoningParts[o.id];if(u==null)throw new ve({chunkType:"reasoning-end",chunkId:o.id,message:`Received reasoning-end for missing reasoning part with ID "${o.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});u.providerMetadata=(v=o.providerMetadata)!=null?v:u.providerMetadata,u.state="done",delete l.activeReasoningParts[o.id],d();break}case"file":{l.message.parts.push({type:"file",mediaType:o.mediaType,url:o.url}),d();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:o.sourceId,url:o.url,title:o.title,providerMetadata:o.providerMetadata}),d();break}case"source-document":{l.message.parts.push({type:"source-document",sourceId:o.sourceId,mediaType:o.mediaType,title:o.title,filename:o.filename,providerMetadata:o.providerMetadata}),d();break}case"tool-input-start":{const u=l.message.parts.filter(We);l.partialToolCalls[o.toolCallId]={text:"",toolName:o.toolName,index:u.length,dynamic:o.dynamic,title:o.title},o.dynamic?x({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-streaming",input:void 0,providerExecuted:o.providerExecuted,title:o.title}):b({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-streaming",input:void 0,providerExecuted:o.providerExecuted,title:o.title}),d();break}case"tool-input-delta":{const u=l.partialToolCalls[o.toolCallId];if(u==null)throw new ve({chunkType:"tool-input-delta",chunkId:o.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${o.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});u.text+=o.inputTextDelta;const{value:T}=await Ae(u.text);u.dynamic?x({toolCallId:o.toolCallId,toolName:u.toolName,state:"input-streaming",input:T,title:u.title}):b({toolCallId:o.toolCallId,toolName:u.toolName,state:"input-streaming",input:T,title:u.title}),d();break}case"tool-input-available":{o.dynamic?x({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-available",input:o.input,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata,title:o.title}):b({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-available",input:o.input,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata,title:o.title}),d(),n&&!o.providerExecuted&&await n({toolCall:o});break}case"tool-input-error":{o.dynamic?x({toolCallId:o.toolCallId,toolName:o.toolName,state:"output-error",input:o.input,errorText:o.errorText,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata}):b({toolCallId:o.toolCallId,toolName:o.toolName,state:"output-error",input:void 0,rawInput:o.input,errorText:o.errorText,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata}),d();break}case"tool-approval-request":{const u=y(o.toolCallId);u.state="approval-requested",u.approval={id:o.approvalId},d();break}case"tool-output-denied":{const u=y(o.toolCallId);u.state="output-denied",d();break}case"tool-output-available":{const u=y(o.toolCallId);u.type==="dynamic-tool"?x({toolCallId:o.toolCallId,toolName:u.toolName,state:"output-available",input:u.input,output:o.output,preliminary:o.preliminary,providerExecuted:o.providerExecuted,title:u.title}):b({toolCallId:o.toolCallId,toolName:Rt(u),state:"output-available",input:u.input,output:o.output,providerExecuted:o.providerExecuted,preliminary:o.preliminary,title:u.title}),d();break}case"tool-output-error":{const u=y(o.toolCallId);u.type==="dynamic-tool"?x({toolCallId:o.toolCallId,toolName:u.toolName,state:"output-error",input:u.input,errorText:o.errorText,providerExecuted:o.providerExecuted,title:u.title}):b({toolCallId:o.toolCallId,toolName:Rt(u),state:"output-error",input:u.input,rawInput:u.rawInput,errorText:o.errorText,providerExecuted:o.providerExecuted,title:u.title}),d();break}case"start-step":{l.message.parts.push({type:"step-start"});break}case"finish-step":{l.activeTextParts={},l.activeReasoningParts={};break}case"start":{o.messageId!=null&&(l.message.id=o.messageId),await S(o.messageMetadata),(o.messageId!=null||o.messageMetadata!=null)&&d();break}case"finish":{o.finishReason!=null&&(l.finishReason=o.finishReason),await S(o.messageMetadata),o.messageMetadata!=null&&d();break}case"message-metadata":{await S(o.messageMetadata),o.messageMetadata!=null&&d();break}case"error":{r?.(new Error(o.errorText));break}default:if(xr(o)){a?.[o.type]!=null&&await Nt({value:o.data,schema:a[o.type]});const u=o;if(u.transient){i?.(u);break}const T=u.id!=null?l.message.parts.find(N=>u.type===N.type&&u.id===N.id):void 0;T!=null?T.data=u.data:l.message.parts.push(u),i?.(u),d()}}c.enqueue(o)})}}))}async function Ir({stream:t,onError:e}){const a=t.getReader();try{for(;;){const{done:s}=await a.read();if(s)break}}catch(s){e?.(s)}finally{a.releaseLock()}}Ce({prefix:"aitxt",size:24});Ce({prefix:"aiobj",size:24});var Sr=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(t){return new Promise((e,a)=>{this.queue.push(async()=>{try{await t(),e()}catch(s){a(s)}}),this.processQueue()})}};Ce({prefix:"aiobj",size:24});async function Nr(t){if(t==null)return[];if(!globalThis.FileList||!(t instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(t).map(async e=>{const{name:a,type:s}=e,r=await new Promise((n,i)=>{const o=new FileReader;o.onload=c=>{var l;n((l=c.target)==null?void 0:l.result)},o.onerror=c=>i(c),o.readAsDataURL(e)});return{type:"file",mediaType:s,filename:a,url:r}}))}var Tr=class{constructor({api:t="/api/chat",credentials:e,headers:a,body:s,fetch:r,prepareSendMessagesRequest:n,prepareReconnectToStreamRequest:i}){this.api=t,this.credentials=e,this.headers=a,this.body=s,this.fetch=r,this.prepareSendMessagesRequest=n,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:t,...e}){var a,s,r,n,i;const o=await ce(this.body),c=await ce(this.headers),l=await ce(this.credentials),d={...pe(c),...pe(e.headers)},m=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:e.chatId,messages:e.messages,body:{...o,...e.body},headers:d,credentials:l,requestMetadata:e.metadata,trigger:e.trigger,messageId:e.messageId})),h=(s=m?.api)!=null?s:this.api,f=m?.headers!==void 0?pe(m.headers):d,v=m?.body!==void 0?m.body:{...o,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},y=(r=m?.credentials)!=null?r:l,x=await((n=this.fetch)!=null?n:globalThis.fetch)(h,{method:"POST",headers:wt({"Content-Type":"application/json",...f},`ai-sdk/${Tt}`,_t()),body:JSON.stringify(v),credentials:y,signal:t});if(!x.ok)throw new Error((i=await x.text())!=null?i:"Failed to fetch the chat response.");if(!x.body)throw new Error("The response body is empty.");return this.processResponseStream(x.body)}async reconnectToStream(t){var e,a,s,r,n;const i=await ce(this.body),o=await ce(this.headers),c=await ce(this.credentials),l={...pe(o),...pe(t.headers)},d=await((e=this.prepareReconnectToStreamRequest)==null?void 0:e.call(this,{api:this.api,id:t.chatId,body:{...i,...t.body},headers:l,credentials:c,requestMetadata:t.metadata})),m=(a=d?.api)!=null?a:`${this.api}/${t.chatId}/stream`,h=d?.headers!==void 0?pe(d.headers):l,f=(s=d?.credentials)!=null?s:c,y=await((r=this.fetch)!=null?r:globalThis.fetch)(m,{method:"GET",headers:wt(h,`ai-sdk/${Tt}`,_t()),credentials:f});if(y.status===204)return null;if(!y.ok)throw new Error((n=await y.text())!=null?n:"Failed to fetch the chat response.");if(!y.body)throw new Error("The response body is empty.");return this.processResponseStream(y.body)}},da=class extends Tr{constructor(t={}){super(t)}processResponseStream(t){return Qs({stream:t,schema:br}).pipeThrough(new TransformStream({async transform(e,a){if(!e.success)throw e.error;a.enqueue(e.value)}}))}},Rr=class{constructor({generateId:t=es,id:e=t(),transport:a=new da,messageMetadataSchema:s,dataPartSchemas:r,state:n,onError:i,onToolCall:o,onFinish:c,onData:l,sendAutomaticallyWhen:d}){this.activeResponse=void 0,this.jobExecutor=new Sr,this.sendMessage=async(m,h)=>{var f,v,y,b;if(m==null){await this.makeRequest({trigger:"submit-message",messageId:(f=this.lastMessage)==null?void 0:f.id,...h});return}let x;if("text"in m||"files"in m?x={parts:[...Array.isArray(m.files)?m.files:await Nr(m.files),..."text"in m&&m.text!=null?[{type:"text",text:m.text}]:[]]}:x=m,m.messageId!=null){const S=this.state.messages.findIndex(u=>u.id===m.messageId);if(S===-1)throw new Error(`message with id ${m.messageId} not found`);if(this.state.messages[S].role!=="user")throw new Error(`message with id ${m.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,S+1),this.state.replaceMessage(S,{...x,id:m.messageId,role:(v=x.role)!=null?v:"user",metadata:m.metadata})}else this.state.pushMessage({...x,id:(y=x.id)!=null?y:this.generateId(),role:(b=x.role)!=null?b:"user",metadata:m.metadata});await this.makeRequest({trigger:"submit-message",messageId:m.messageId,...h})},this.regenerate=async({messageId:m,...h}={})=>{const f=m==null?this.state.messages.length-1:this.state.messages.findIndex(v=>v.id===m);if(f===-1)throw new Error(`message ${m} not found`);this.state.messages=this.state.messages.slice(0,this.messages[f].role==="assistant"?f:f+1),await this.makeRequest({trigger:"regenerate-message",messageId:m,...h})},this.resumeStream=async(m={})=>{await this.makeRequest({trigger:"resume-stream",...m})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:m,approved:h,reason:f})=>this.jobExecutor.run(async()=>{var v,y;const b=this.state.messages,x=b[b.length-1],S=u=>Ge(u)&&u.state==="approval-requested"&&u.approval.id===m?{...u,state:"approval-responded",approval:{id:m,approved:h,reason:f}}:u;this.state.replaceMessage(b.length-1,{...x,parts:x.parts.map(S)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(S)),this.status!=="streaming"&&this.status!=="submitted"&&((v=this.sendAutomaticallyWhen)!=null&&v.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(y=this.lastMessage)==null?void 0:y.id})}),this.addToolOutput=async({state:m="output-available",tool:h,toolCallId:f,output:v,errorText:y})=>this.jobExecutor.run(async()=>{var b,x;const S=this.state.messages,u=S[S.length-1],T=N=>Ge(N)&&N.toolCallId===f?{...N,state:m,output:v,errorText:y}:N;this.state.replaceMessage(S.length-1,{...u,parts:u.parts.map(T)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(T)),this.status!=="streaming"&&this.status!=="submitted"&&((b=this.sendAutomaticallyWhen)!=null&&b.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(x=this.lastMessage)==null?void 0:x.id})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var m;this.status!=="streaming"&&this.status!=="submitted"||(m=this.activeResponse)!=null&&m.abortController&&this.activeResponse.abortController.abort()},this.id=e,this.transport=a,this.generateId=t,this.messageMetadataSchema=s,this.dataPartSchemas=r,this.state=n,this.onError=i,this.onToolCall=o,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=d}get status(){return this.state.status}setStatus({status:t,error:e}){this.status!==t&&(this.state.status=t,this.state.error=e)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(t){this.state.messages=t}async makeRequest({trigger:t,metadata:e,headers:a,body:s,messageId:r}){var n,i,o,c;this.setStatus({status:"submitted",error:void 0});const l=this.lastMessage;let d=!1,m=!1,h=!1;try{const f={state:wr({lastMessage:this.state.snapshot(l),messageId:this.generateId()}),abortController:new AbortController};f.abortController.signal.addEventListener("abort",()=>{d=!0}),this.activeResponse=f;let v;if(t==="resume-stream"){const b=await this.transport.reconnectToStream({chatId:this.id,metadata:e,headers:a,body:s});if(b==null){this.setStatus({status:"ready"});return}v=b}else v=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:f.abortController.signal,metadata:e,headers:a,body:s,trigger:t,messageId:r});const y=b=>this.jobExecutor.run(()=>b({state:f.state,write:()=>{var x;this.setStatus({status:"streaming"}),f.state.message.id===((x=this.lastMessage)==null?void 0:x.id)?this.state.replaceMessage(this.state.messages.length-1,f.state.message):this.state.pushMessage(f.state.message)}}));await Ir({stream:Er({stream:v,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:y,onError:b=>{throw b}}),onError:b=>{throw b}}),this.setStatus({status:"ready"})}catch(f){if(d||f.name==="AbortError")return d=!0,this.setStatus({status:"ready"}),null;h=!0,f instanceof TypeError&&(f.message.toLowerCase().includes("fetch")||f.message.toLowerCase().includes("network"))&&(m=!0),this.onError&&f instanceof Error&&this.onError(f),this.setStatus({status:"error",error:f})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:d,isDisconnect:m,isError:h,finishReason:(n=this.activeResponse)==null?void 0:n.state.finishReason})}catch(f){console.error(f)}this.activeResponse=void 0}(o=this.sendAutomaticallyWhen)!=null&&o.call(this,{messages:this.state.messages})&&!h&&await this.makeRequest({trigger:"submit-message",messageId:(c=this.lastMessage)==null?void 0:c.id,metadata:e,headers:a,body:s})}},Be,Ct;function Cr(){if(Ct)return Be;Ct=1;function t(e,a){if(typeof e!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let s,r=0;return function(...i){clearTimeout(s);const o=Date.now(),c=o-r,l=a-c;l<=0?(r=o,e.apply(this,i)):s=setTimeout(()=>{r=Date.now(),e.apply(this,i)},l)}}return Be=t,Be}var Ar=Cr();const jr=Sa(Ar);var pa=(t,e,a)=>{if(!e.has(t))throw TypeError("Cannot "+a)},k=(t,e,a)=>(pa(t,e,"read from private field"),a?a.call(t):e.get(t)),ne=(t,e,a)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,a)},le=(t,e,a,s)=>(pa(t,e,"write to private field"),e.set(t,a),a);function Or(t,e){return e!=null?jr(t,e):t}var Q,Oe,Me,_e,we,Ee,ye,Ye,He,Mr=class{constructor(t=[]){ne(this,Q,void 0),ne(this,Oe,"ready"),ne(this,Me,void 0),ne(this,_e,new Set),ne(this,we,new Set),ne(this,Ee,new Set),this.pushMessage=e=>{le(this,Q,k(this,Q).concat(e)),k(this,ye).call(this)},this.popMessage=()=>{le(this,Q,k(this,Q).slice(0,-1)),k(this,ye).call(this)},this.replaceMessage=(e,a)=>{le(this,Q,[...k(this,Q).slice(0,e),this.snapshot(a),...k(this,Q).slice(e+1)]),k(this,ye).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,a)=>{const s=a?Or(e,a):e;return k(this,_e).add(s),()=>{k(this,_e).delete(s)}},this["~registerStatusCallback"]=e=>(k(this,we).add(e),()=>{k(this,we).delete(e)}),this["~registerErrorCallback"]=e=>(k(this,Ee).add(e),()=>{k(this,Ee).delete(e)}),ne(this,ye,()=>{k(this,_e).forEach(e=>e())}),ne(this,Ye,()=>{k(this,we).forEach(e=>e())}),ne(this,He,()=>{k(this,Ee).forEach(e=>e())}),le(this,Q,t)}get status(){return k(this,Oe)}set status(t){le(this,Oe,t),k(this,Ye).call(this)}get error(){return k(this,Me)}set error(t){le(this,Me,t),k(this,He).call(this)}get messages(){return k(this,Q)}set messages(t){le(this,Q,[...t]),k(this,ye).call(this)}};Q=new WeakMap;Oe=new WeakMap;Me=new WeakMap;_e=new WeakMap;we=new WeakMap;Ee=new WeakMap;ye=new WeakMap;Ye=new WeakMap;He=new WeakMap;var be,At=class extends Rr{constructor({messages:t,...e}){const a=new Mr(t);super({...e,state:a}),ne(this,be,void 0),this["~registerMessagesCallback"]=(s,r)=>k(this,be)["~registerMessagesCallback"](s,r),this["~registerStatusCallback"]=s=>k(this,be)["~registerStatusCallback"](s),this["~registerErrorCallback"]=s=>k(this,be)["~registerErrorCallback"](s),le(this,be,a)}};be=new WeakMap;function kr({experimental_throttle:t,resume:e=!1,...a}={}){const s=z.useRef("chat"in a?{}:{onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});"chat"in a||(s.current={onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});const r={...a,onToolCall:h=>{var f,v;return(v=(f=s.current).onToolCall)==null?void 0:v.call(f,h)},onData:h=>{var f,v;return(v=(f=s.current).onData)==null?void 0:v.call(f,h)},onFinish:h=>{var f,v;return(v=(f=s.current).onFinish)==null?void 0:v.call(f,h)},onError:h=>{var f,v;return(v=(f=s.current).onError)==null?void 0:v.call(f,h)},sendAutomaticallyWhen:h=>{var f,v,y;return(y=(v=(f=s.current).sendAutomaticallyWhen)==null?void 0:v.call(f,h))!=null?y:!1}},n=z.useRef("chat"in a?a.chat:new At(r));("chat"in a&&a.chat!==n.current||"id"in a&&n.current.id!==a.id)&&(n.current="chat"in a?a.chat:new At(r));const o=z.useCallback(h=>n.current["~registerMessagesCallback"](h,t),[t,n.current.id]),c=z.useSyncExternalStore(o,()=>n.current.messages,()=>n.current.messages),l=z.useSyncExternalStore(n.current["~registerStatusCallback"],()=>n.current.status,()=>n.current.status),d=z.useSyncExternalStore(n.current["~registerErrorCallback"],()=>n.current.error,()=>n.current.error),m=z.useCallback(h=>{typeof h=="function"&&(h=h(n.current.messages)),n.current.messages=h},[n]);return z.useEffect(()=>{e&&n.current.resumeStream()},[e,n]),{id:n.current.id,messages:c,setMessages:m,sendMessage:n.current.sendMessage,regenerate:n.current.regenerate,clearError:n.current.clearError,stop:n.current.stop,error:d,resumeStream:n.current.resumeStream,status:l,addToolResult:n.current.addToolOutput,addToolOutput:n.current.addToolOutput,addToolApprovalResponse:n.current.addToolApprovalResponse}}const Pr="You are a helpful assistant.",Dr=t=>new da({api:`/api/${t}/models/stream`,credentials:"include",prepareSendMessagesRequest:({messages:e,requestMetadata:a})=>({body:{messages:e,stream:!0,...a}})});function yn(t){const e=q.c(37),{threadId:a,systemPrompt:s,gatewayId:r,onError:n,onToolCall:i}=t,{org:o,locator:c}=Qe(),{slug:l}=o,d=Ta(),m=Ra(),[h,f]=z.useState(null),v=Ca(a),y=s||Pr;let b;e[0]!==y?(b={id:"system",role:"system",parts:[{type:"text",text:y}]},e[0]=y,e[1]=b):b=e[1];const S=b;let u;e[2]!==v||e[3]!==S?(u=[S,...v],e[2]=v,e[3]=S,e[4]=u):u=e[4];const T=u,N=`${a}:${y}`;let w;e[5]!==l?(w=Dr(l),e[5]=l,e[6]=w):w=e[6];const I=w;let A;e[7]!==r||e[8]!==c||e[9]!==m||e[10]!==d||e[11]!==a?(A=async L=>{const{finishReason:H,messages:Ze,isAbort:fe,isDisconnect:he,isError:ge}=L;if(f(H??null),H!=="stop"||fe||he||ge)return;const re=Ze.slice(-2).filter(Boolean);if(re.length!==2){console.warn("[chat] Expected 2 messages, got",re.length);return}m.insertMany.mutate(re);const ot=re.find(Zr)?.parts?.find($r)?.text.slice(0,100)||"",Le=await Aa(c,a);if(!Le){const it=new Date().toISOString(),ha={id:a,title:ot,created_at:it,updated_at:it,hidden:!1,gatewayId:r};d.insert.mutate(ha);return}d.update.mutate({id:a,updates:{title:Le.title||ot,gatewayId:Le.gatewayId||r,updated_at:new Date().toISOString()}})},e[7]=r,e[8]=c,e[9]=m,e[10]=d,e[11]=a,e[12]=A):A=e[12];const $=A;let D;e[13]!==n?(D=L=>{console.error("[chat] Chat error:",L),n?.(L)},e[13]=n,e[14]=D):D=e[14];let U;e[15]!==T||e[16]!==N||e[17]!==$||e[18]!==i||e[19]!==D||e[20]!==I?(U={id:N,messages:T,transport:I,onFinish:$,onToolCall:i,onError:D},e[15]=T,e[16]=N,e[17]=$,e[18]=i,e[19]=D,e[20]=I,e[21]=U):U=e[21];const R=kr(U);let te;e[22]!==R?(te=async(L,H)=>{!L?.trim()||R.status==="submitted"||R.status==="streaming"||(f(null),await R.sendMessage({id:crypto.randomUUID(),role:"user",parts:[{type:"text",text:L}],metadata:H},{metadata:H}))},e[22]=R,e[23]=te):te=e[23];const B=te,ae=R.messages[0]?.role==="system"?R.messages.length===1:R.messages.length===0,W=R.messages,se=R.status;let P;e[24]!==R?(P=R.stop.bind(R),e[24]=R,e[25]=P):P=e[25];let X;e[26]===Symbol.for("react.memo_cache_sentinel")?(X=()=>f(null),e[26]=X):X=e[26];let Z;return e[27]!==R.clearError||e[28]!==R.error||e[29]!==R.messages||e[30]!==R.setMessages||e[31]!==R.status||e[32]!==h||e[33]!==ae||e[34]!==B||e[35]!==P?(Z={messages:W,status:se,sendMessage:B,stop:P,setMessages:R.setMessages,isEmpty:ae,error:R.error,clearError:R.clearError,finishReason:h,clearFinishReason:X},e[27]=R.clearError,e[28]=R.error,e[29]=R.messages,e[30]=R.setMessages,e[31]=R.status,e[32]=h,e[33]=ae,e[34]=B,e[35]=P,e[36]=Z):Z=e[36],Z}function $r(t){return t.type==="text"}function Zr(t){return t.parts?.find(Lr)}function Lr(t){return t.type==="text"}function bn(t){const e=q.c(11);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[0]=a):a=e[0];const s=kt(a),[r]=ka(t??void 0);let n;if(e[1]!==t||e[2]!==r||e[3]!==s.collectionName||e[4]!==s.connectionId||e[5]!==s.itemId){n=[],t&&(n.push(`### Selected Agent/Gateway
12
+ - ID: ${t}`),r?.trim()&&n.push(`### Agent Instructions
13
+ ${r}`));let i;e[7]!==s.collectionName||e[8]!==s.connectionId||e[9]!==s.itemId?(i=[],s.connectionId&&i.push(`- Connection ID: ${s.connectionId}`),s.collectionName&&i.push(`- Collection: ${s.collectionName}`),s.itemId&&i.push(`- Item ID: ${s.itemId}`),e[7]=s.collectionName,e[8]=s.connectionId,e[9]=s.itemId,e[10]=i):i=e[10],i.length>0&&n.push(`### Current Resource
14
+ The user is viewing the following resource:
15
+ ${i.join(`
16
+ `)}
17
+
18
+ Help the user understand and work with this resource.`),e[1]=t,e[2]=r,e[3]=s.collectionName,e[4]=s.connectionId,e[5]=s.itemId,e[6]=n}else n=e[6];return n.join(`
19
+
20
+ `)}const jt=[{border:"border-purple-400",bg:"bg-purple-400",text:"text-white",bgLight:"bg-purple-400/10"},{border:"border-blue-400",bg:"bg-blue-400",text:"text-white",bgLight:"bg-blue-400/10"},{border:"border-indigo-400",bg:"bg-indigo-400",text:"text-white",bgLight:"bg-indigo-400/10"},{border:"border-violet-400",bg:"bg-violet-400",text:"text-white",bgLight:"bg-violet-400/10"},{border:"border-pink-400",bg:"bg-pink-400",text:"text-white",bgLight:"bg-pink-400/10"},{border:"border-fuchsia-400",bg:"bg-fuchsia-400",text:"text-white",bgLight:"bg-fuchsia-400/10"},{border:"border-emerald-400",bg:"bg-emerald-400",text:"text-white",bgLight:"bg-emerald-400/10"},{border:"border-teal-400",bg:"bg-teal-400",text:"text-white",bgLight:"bg-teal-400/10"},{border:"border-cyan-400",bg:"bg-cyan-400",text:"text-white",bgLight:"bg-cyan-400/10"},{border:"border-sky-400",bg:"bg-sky-400",text:"text-white",bgLight:"bg-sky-400/10"},{border:"border-orange-400",bg:"bg-orange-400",text:"text-white",bgLight:"bg-orange-400/10"},{border:"border-amber-400",bg:"bg-amber-400",text:"text-white",bgLight:"bg-amber-400/10"},{border:"border-rose-400",bg:"bg-rose-400",text:"text-white",bgLight:"bg-rose-400/10"},{border:"border-lime-400",bg:"bg-lime-400",text:"text-white",bgLight:"bg-lime-400/10"}];function Ur(t){let e=0;for(let a=0;a<t.length;a++)e=t.charCodeAt(a)+((e<<5)-e);return Math.abs(e)}function ma(t){if(t==null)return null;const a=Ur(t)%jt.length;return jt[a]}function zr(t){const e=q.c(66),{gateway:a,onGatewayChange:s,onReset:r,className:n,disabled:i}=t,o=i===void 0?!1:i,[c,l]=z.useState(!1),d=z.useRef(null),m=ja(),h=$t(),{org:f}=Qe();let v,y;if(e[0]!==c?(v=()=>{c&&setTimeout(()=>{d.current?.focus()},0)},y=[c],e[0]=c,e[1]=v,e[2]=y):(v=e[1],y=e[2]),z.useEffect(v,y),!a?.id)return null;let b,x,S,u;if(e[3]!==n||e[4]!==a.id||e[5]!==h||e[6]!==s||e[7]!==r||e[8]!==f.slug){const Ze=ma(a.id);let fe;e[13]!==r?(fe=re=>{re.stopPropagation(),r()},e[13]=r,e[14]=fe):fe=e[14],S=fe;let he;e[15]!==a.id||e[16]!==h||e[17]!==f.slug?(he=re=>{re.stopPropagation(),h({to:"/$org/gateways/$gatewayId",params:{org:f.slug,gatewayId:a.id}})},e[15]=a.id,e[16]=h,e[17]=f.slug,e[18]=he):he=e[18],b=he;let ge;e[19]!==s?(ge=re=>{s(re),l(!1)},e[19]=s,e[20]=ge):ge=e[20],x=ge,u=G("flex items-center justify-between px-3 py-1.5 rounded-t-xl",Ze?.bg,n),e[3]=n,e[4]=a.id,e[5]=h,e[6]=s,e[7]=r,e[8]=f.slug,e[9]=b,e[10]=x,e[11]=S,e[12]=u}else b=e[9],x=e[10],S=e[11],u=e[12];const T=o?"cursor-not-allowed opacity-50":"cursor-pointer";let N;e[21]!==T?(N=G("flex items-center gap-1.5 hover:opacity-80 transition-opacity",T),e[21]=T,e[22]=N):N=e[22];let w;e[23]!==a.fallbackIcon?(w=a.fallbackIcon??p.jsx(Za,{size:10}),e[23]=a.fallbackIcon,e[24]=w):w=e[24];let I;e[25]!==a.icon||e[26]!==a.title||e[27]!==w?(I=p.jsx(Pa,{icon:a.icon,name:a.title,size:"2xs",fallbackIcon:w}),e[25]=a.icon,e[26]=a.title,e[27]=w,e[28]=I):I=e[28];let A;e[29]!==a.title?(A=p.jsx("span",{className:"text-xs text-white font-normal",children:a.title}),e[29]=a.title,e[30]=A):A=e[30];let $;e[31]===Symbol.for("react.memo_cache_sentinel")?($=p.jsx($a,{size:14,className:"text-white/50"}),e[31]=$):$=e[31];let D;e[32]!==o||e[33]!==N||e[34]!==I||e[35]!==A?(D=p.jsx(Ke,{asChild:!0,children:p.jsxs("button",{type:"button",disabled:o,className:N,children:[I,A,$]})}),e[32]=o,e[33]=N,e[34]=I,e[35]=A,e[36]=D):D=e[36];let U;e[37]!==a.id||e[38]!==m||e[39]!==x?(U=p.jsx(Xe,{className:"w-[550px] p-0 overflow-hidden",align:"start",side:"top",sideOffset:8,children:p.jsx(Oa,{gateways:m,selectedGatewayId:a.id,onGatewayChange:x,searchInputRef:d})}),e[37]=a.id,e[38]=m,e[39]=x,e[40]=U):U=e[40];let R;e[41]!==c||e[42]!==D||e[43]!==U?(R=p.jsxs(et,{open:c,onOpenChange:l,children:[D,U]}),e[41]=c,e[42]=D,e[43]=U,e[44]=R):R=e[44];const te=o?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-white/10";let B;e[45]!==te?(B=G("flex items-center justify-center p-1 rounded-full transition-colors",te),e[45]=te,e[46]=B):B=e[46];let ae;e[47]===Symbol.for("react.memo_cache_sentinel")?(ae=p.jsx(La,{size:14,className:"text-white"}),e[47]=ae):ae=e[47];let W;e[48]!==o||e[49]!==b||e[50]!==B?(W=p.jsx("button",{type:"button",onClick:b,disabled:o,className:B,"aria-label":"Edit gateway",children:ae}),e[48]=o,e[49]=b,e[50]=B,e[51]=W):W=e[51];const se=o?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-white/10";let P;e[52]!==se?(P=G("flex items-center justify-center p-1 rounded-full transition-colors",se),e[52]=se,e[53]=P):P=e[53];let X;e[54]===Symbol.for("react.memo_cache_sentinel")?(X=p.jsx(Lt,{size:14,className:"text-white"}),e[54]=X):X=e[54];let Z;e[55]!==o||e[56]!==S||e[57]!==P?(Z=p.jsx("button",{type:"button",onClick:S,disabled:o,className:P,"aria-label":"Reset to default",children:X}),e[55]=o,e[56]=S,e[57]=P,e[58]=Z):Z=e[58];let L;e[59]!==W||e[60]!==Z?(L=p.jsxs("div",{className:"flex items-center gap-1",children:[W,Z]}),e[59]=W,e[60]=Z,e[61]=L):L=e[61];let H;return e[62]!==R||e[63]!==L||e[64]!==u?(H=p.jsxs("div",{className:u,children:[R,L]}),e[62]=R,e[63]=L,e[64]=u,e[65]=H):H=e[65],H}function Br(t){t(null)}function xn(t){const e=q.c(18),{gateway:a,onGatewayChange:s,children:r,className:n,disabled:i}=t,o=i===void 0?!1:i;let c;if(e[0]!==n||e[1]!==a){const y=a?ma(a.id):null;c=G("relative rounded-xl w-full flex flex-col p-0.5",a&&"shadow-sm rounded-xl",y?.bg,n),e[0]=n,e[1]=a,e[2]=c}else c=e[2];let l;e[3]!==o||e[4]!==a||e[5]!==s?(l=a&&p.jsx(zr,{gateway:a,onGatewayChange:s,onReset:()=>Br(s),disabled:o}),e[3]=o,e[4]=a,e[5]=s,e[6]=l):l=e[6];let d;e[7]!==l?(d=p.jsx("div",{className:"min-h-[32px]",children:l}),e[7]=l,e[8]=d):d=e[8];const m=!a&&"shadow-sm rounded-xl";let h;e[9]!==m?(h=G("bg-background rounded-xl",m),e[9]=m,e[10]=h):h=e[10];let f;e[11]!==r||e[12]!==h?(f=p.jsx("div",{className:h,children:r}),e[11]=r,e[12]=h,e[13]=f):f=e[13];let v;return e[14]!==c||e[15]!==d||e[16]!==f?(v=p.jsxs("div",{className:c,children:[d,f]}),e[14]=c,e[15]=d,e[16]=f,e[17]=v):v=e[17],v}async function Fr(t){const e=`/mcp/gateway/${t}`,a={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};try{const s=await fetch(e,{method:"POST",headers:a,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"mesh-chat",version:"1.0.0"}}})});if(!s.ok)return[];if((await s.json()).error)return[];const n=await fetch(e,{method:"POST",headers:a,body:JSON.stringify({jsonrpc:"2.0",id:2,method:"prompts/list",params:{}})});if(!n.ok)return[];const i=await n.json();return i.error?[]:i.result?.prompts||[]}catch{return[]}}function Vr(t){const e=q.c(7);let a;e[0]!==t?(a=Pt.gatewayPrompts(t),e[0]=t,e[1]=a):a=e[1];let s;e[2]!==t?(s=()=>Fr(t),e[2]=t,e[3]=s):s=e[3];let r;return e[4]!==a||e[5]!==s?(r={queryKey:a,queryFn:s,staleTime:6e4,retry:!1},e[4]=a,e[5]=s,e[6]=r):r=e[6],Na(r)}const Ot=3;function qr(t){const e=q.c(6),{children:a,className:s}=t;let r;e[0]!==s?(r=G("flex flex-wrap items-center justify-center gap-2",s),e[0]=s,e[1]=r):r=e[1];let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n={minHeight:"32px"},e[2]=n):n=e[2];let i;return e[3]!==a||e[4]!==r?(i=p.jsx("div",{className:r,style:n,children:a}),e[3]=a,e[4]=r,e[5]=i):i=e[5],i}function Jr(t){const e=q.c(14),{prompt:a,onSelect:s}=t,r=a.description??a.name;let n;e[0]!==s||e[1]!==a?(n=()=>s(a),e[0]=s,e[1]=a,e[2]=n):n=e[2];const i=a.title??a.name;let o;if(e[3]!==i){let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=/_/g,e[5]=m):m=e[5],o=i.replace(m," "),e[3]=i,e[4]=o}else o=e[4];let c;e[6]!==n||e[7]!==o?(c=p.jsx(at,{asChild:!0,children:p.jsx("button",{type:"button",onClick:n,className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground border border-border rounded-full hover:bg-accent/50 transition-colors cursor-pointer",children:o})}),e[6]=n,e[7]=o,e[8]=c):c=e[8];let l;e[9]!==r?(l=p.jsx(st,{side:"bottom",className:"max-w-xs",children:p.jsx("p",{className:"text-xs",children:r})}),e[9]=r,e[10]=l):l=e[10];let d;return e[11]!==c||e[12]!==l?(d=p.jsxs(tt,{children:[c,l]}),e[11]=c,e[12]=l,e[13]=d):d=e[13],d}function Wr(t){const e=q.c(20),{prompts:a,onSelect:s,className:r}=t;if(a.length===0)return null;let n,i,o,c,l;if(e[0]!==r||e[1]!==s||e[2]!==a){const h=a.slice(0,Ot),f=a.slice(Ot),v=f.length>0;n=Zt,l=300,e[8]!==r?(i=G("flex flex-wrap items-center justify-center gap-2",r),e[8]=r,e[9]=i):i=e[9];let y;e[10]!==s?(y=b=>p.jsx(Jr,{prompt:b,onSelect:s},b.name),e[10]=s,e[11]=y):y=e[11],o=h.map(y),c=v&&p.jsxs(et,{children:[p.jsx(Ke,{asChild:!0,children:p.jsxs("button",{type:"button",className:"size-7 flex items-center justify-center text-xs text-muted-foreground hover:text-foreground border border-border rounded-full hover:bg-accent/50 transition-colors cursor-pointer",children:["+",f.length]})}),p.jsx(Xe,{side:"bottom",align:"center",className:"w-auto p-2",children:p.jsx("div",{className:"flex flex-col gap-1",children:f.map(b=>{const x=b.description??b.name;return p.jsxs(tt,{children:[p.jsx(at,{asChild:!0,children:p.jsx("button",{type:"button",onClick:()=>s(b),className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent/50 rounded-md transition-colors cursor-pointer text-left",children:(b.title??b.name).replace(/_/g," ")})}),p.jsx(st,{side:"right",className:"max-w-xs",children:p.jsx("p",{className:"text-xs",children:x})})]},b.name)})})})]}),e[0]=r,e[1]=s,e[2]=a,e[3]=n,e[4]=i,e[5]=o,e[6]=c,e[7]=l}else n=e[3],i=e[4],o=e[5],c=e[6],l=e[7];let d;e[12]!==i||e[13]!==o||e[14]!==c?(d=p.jsxs("div",{className:i,children:[o,c]}),e[12]=i,e[13]=o,e[14]=c,e[15]=d):d=e[15];let m;return e[16]!==n||e[17]!==l||e[18]!==d?(m=p.jsx(n,{delayDuration:l,children:d}),e[16]=n,e[17]=l,e[18]=d,e[19]=m):m=e[19],m}function Gr(t){const e=q.c(6),{className:a}=t;let s;e[0]!==a?(s=G("flex flex-wrap items-center justify-center gap-2",a),e[0]=a,e[1]=s):s=e[1];let r,n;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=p.jsx(lt,{className:"h-6 w-20 rounded-full border border-border"}),n=p.jsx(lt,{className:"h-6 w-24 rounded-full border border-border"}),e[2]=r,e[3]=n):(r=e[2],n=e[3]);let i;return e[4]!==s?(i=p.jsxs("div",{className:s,children:[r,n]}),e[4]=s,e[5]=i):i=e[5],i}function fa(t){const e=q.c(4),{gatewayId:a,onSelect:s,className:r}=t,{data:n}=Vr(a);if(n.length===0)return null;let i;return e[0]!==r||e[1]!==s||e[2]!==n?(i=p.jsx(Wr,{prompts:n,onSelect:s,className:r}),e[0]=r,e[1]=s,e[2]=n,e[3]=i):i=e[3],i}fa.Fallback=Gr;fa.Container=qr;function _n({title:t="No model provider connected",description:e="Connect to a model provider to unlock AI-powered features.",orgSlug:a,orgId:s,userId:r,allConnections:n,onInstallMcpServer:i}){const[o,c]=z.useState(!1),l=Ua(),d=$t(),m=async()=>{if(!s||!r){Fe.error("Not authenticated");return}c(!0);try{const h=n?.find(y=>y.connection_url===Ba);if(h){d({to:"/$org/mcps/$connectionId",params:{org:a,connectionId:h.id}});return}const f=Fa({id:Va("conn")}),v=await l.create.mutateAsync(f);d({to:"/$org/mcps/$connectionId",params:{org:a,connectionId:v.id}})}catch(h){Fe.error(`Failed to connect OpenRouter: ${h instanceof Error?h.message:String(h)}`)}finally{c(!1)}};return p.jsx(Da,{image:p.jsx("img",{src:"/empty-state-openrouter.svg",alt:"",width:336,height:320,"aria-hidden":"true",className:"w-xs h-auto mask-radial-[100%_100%] mask-radial-from-20% mask-radial-to-50% mask-radial-at-center"}),title:t,description:e,actions:p.jsxs(p.Fragment,{children:[p.jsxs(Pe,{variant:"outline",onClick:m,disabled:o,children:[p.jsx("img",{src:za,alt:"OpenRouter",className:"size-4"}),o?"Installing...":"Install OpenRouter"]}),p.jsx(Pe,{variant:"outline",onClick:i,children:"Install Connection"})]})})}function Yr(t){const e=new Date(t),s=new Date().getTime()-e.getTime(),r=Math.floor(s/6e4),n=Math.floor(s/36e5);return r<1?"now":r<60?`${r}m`:`${n}h`}function Hr(t){const e=new Date,a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),s=new Date(a.getTime()-864e5),r=new Date(a.getTime()-7*864e5),n=new Date(a.getTime()-30*864e5),i=[],o=[],c=[],l=[],d=[];for(const h of t){const f=new Date(h.updated_at);f>=a?i.push(h):f>=s?o.push(h):f>=r?c.push(h):f>=n?l.push(h):d.push(h)}const m=[];return i.length>0&&m.push({label:"Today",threads:i,showRelativeTime:!0}),o.length>0&&m.push({label:"Yesterday",threads:o,showRelativeTime:!1}),c.length>0&&m.push({label:"7 days ago",threads:c,showRelativeTime:!1}),l.length>0&&m.push({label:"30 days ago",threads:l,showRelativeTime:!1}),d.length>0&&m.push({label:"Older",threads:d,showRelativeTime:!1}),m}function wn(t){const e=q.c(49),{threads:a,activeThreadId:s,onSelectThread:r,onRemoveThread:n,onOpen:i,variant:o}=t,c=o===void 0?"icon":o,[l,d]=z.useState("");let m,h,f,v,y,b,x,S,u,T,N,w;if(e[0]!==s||e[1]!==i||e[2]!==n||e[3]!==r||e[4]!==l||e[5]!==a||e[6]!==c){const R=l.trim()?a.filter(P=>(P.title||"New chat").toLowerCase().includes(l.toLowerCase())):a,te=Hr(R);let B;e[19]!==i?(B=P=>{P?i?.():d("")},e[19]=i,e[20]=B):B=e[20];const ae=B;v=Zt,f=tt,h=et,T=ae,e[21]!==c?(N=p.jsx(at,{asChild:!0,children:p.jsx(Ke,{asChild:!0,children:c==="outline"?p.jsx(Pe,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input","aria-label":"Chat history",children:p.jsx(ct,{size:16})}):p.jsx(Pe,{type:"button",variant:"ghost",size:"icon",className:"size-6 p-1 hover:bg-transparent","aria-label":"Chat history",children:p.jsx(ct,{size:16,className:"text-muted-foreground hover:text-foreground transition-colors"})})})}),e[21]=c,e[22]=N):N=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(w=p.jsx(st,{children:"Chat history"}),e[23]=w):w=e[23],m=Xe,x="end",S="w-80 p-0";let W;e[24]===Symbol.for("react.memo_cache_sentinel")?(W=p.jsx(qa,{size:16,className:"text-muted-foreground shrink-0"}),e[24]=W):W=e[24];let se;e[25]===Symbol.for("react.memo_cache_sentinel")?(se=P=>d(P.target.value),e[25]=se):se=e[25],e[26]!==l?(u=p.jsx("div",{className:"border-b",children:p.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 cursor-text",children:[W,p.jsx("input",{type:"text",placeholder:"Search chats...",value:l,onChange:se,className:"flex-1 border-0 shadow-none focus:outline-none px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"})]})}),e[26]=l,e[27]=u):u=e[27],y="max-h-[300px] overflow-y-auto",b=R.length===0?p.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:l.trim()?"No chats found":"No chats yet"}):te.map((P,X)=>p.jsxs("div",{children:[X>0&&p.jsx("div",{className:"border-t mx-3"}),p.jsx("div",{className:"px-3 py-1",children:p.jsx("span",{className:"text-xs font-medium text-muted-foreground tracking-wide",children:P.label})}),P.threads.map(Z=>{const L=Z.id===s;return p.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 hover:bg-accent cursor-pointer group ${L?"bg-accent/50":""}`,onClick:()=>r(Z.id),children:[p.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[p.jsx("span",{className:"text-sm truncate",children:Z.title||"New chat"}),p.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:L?"current":P.showRelativeTime?Yr(Z.updated_at):null})]}),p.jsx("button",{type:"button",onClick:H=>{H.stopPropagation(),n(Z.id)},className:"opacity-0 cursor-pointer group/trash group-hover:opacity-100 p-1 hover:bg-destructive/10 rounded transition-opacity",title:"Remove chat",children:p.jsx(Ja,{size:14,className:"text-muted-foreground group-hover/trash:text-destructive"})})]},Z.id)})]},P.label)),e[0]=s,e[1]=i,e[2]=n,e[3]=r,e[4]=l,e[5]=a,e[6]=c,e[7]=m,e[8]=h,e[9]=f,e[10]=v,e[11]=y,e[12]=b,e[13]=x,e[14]=S,e[15]=u,e[16]=T,e[17]=N,e[18]=w}else m=e[7],h=e[8],f=e[9],v=e[10],y=e[11],b=e[12],x=e[13],S=e[14],u=e[15],T=e[16],N=e[17],w=e[18];let I;e[28]!==y||e[29]!==b?(I=p.jsx("div",{className:y,children:b}),e[28]=y,e[29]=b,e[30]=I):I=e[30];let A;e[31]!==m||e[32]!==I||e[33]!==x||e[34]!==S||e[35]!==u?(A=p.jsxs(m,{align:x,className:S,children:[u,I]}),e[31]=m,e[32]=I,e[33]=x,e[34]=S,e[35]=u,e[36]=A):A=e[36];let $;e[37]!==h||e[38]!==A||e[39]!==T||e[40]!==N||e[41]!==w?($=p.jsxs(h,{onOpenChange:T,children:[N,w,A]}),e[37]=h,e[38]=A,e[39]=T,e[40]=N,e[41]=w,e[42]=$):$=e[42];let D;e[43]!==f||e[44]!==$?(D=p.jsx(f,{children:$}),e[43]=f,e[44]=$,e[45]=D):D=e[45];let U;return e[46]!==v||e[47]!==D?(U=p.jsx(v,{children:D}),e[46]=v,e[47]=D,e[48]=U):U=e[48],U}const Mt=(t,e)=>t?.find(a=>a.id===e)??t?.[0]??null,En=(t,e)=>{const a=q.c(14);let s;a[0]!==t?(s=Ga.chatSelectedModel(t),a[0]=t,a[1]=s):s=a[1];const[r,n]=Wa(s,null),i=r?.connectionId;let o;a[2]!==e||a[3]!==i?(o=Mt(e,i),a[2]=e,a[3]=i,a[4]=o):o=a[4];const c=o,l=Ma(c?.id??null),d=r?.id;let m;a[5]!==l||a[6]!==d?(m=Mt(l,d),a[5]=l,a[6]=d,a[7]=m):m=a[7];const h=m;let f;a[8]!==c||a[9]!==h?(f=h&&c?.id?{id:h.id,provider:h.provider,limits:h.limits,connectionId:c.id}:null,a[8]=c,a[9]=h,a[10]=f):f=a[10];const v=f;let y;return a[11]!==v||a[12]!==n?(y=[v,n],a[11]=v,a[12]=n,a[13]=y):y=a[13],y};export{gn as D,fa as G,_n as N,wn as T,bn as a,vn as b,yn as c,xn as d,En as u};