@decocms/mesh 2.10.0 → 2.12.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 (139) hide show
  1. package/dist/client/assets/{AlertCircle-BI-lv-P2.js → AlertCircle-Cso_Xxvk.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-WX776rGw.js → ArrowLeft-BrsZ2N_5.js} +1 -1
  3. package/dist/client/assets/{Check-Dh23dmDM.js → Check-JFkjTCfG.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-CQl6wdMq.js → ChevronDown-HtFMO0lw.js} +1 -1
  5. package/dist/client/assets/{Clock-C2L66fjj.js → Clock-CW5u1cfj.js} +1 -1
  6. package/dist/client/assets/{Code01-BvYrq72o.js → Code01-CgNchnl3.js} +1 -1
  7. package/dist/client/assets/{Copy01-BX4_oHqx.js → Copy01-Dadp_RDG.js} +1 -1
  8. package/dist/client/assets/{DotsHorizontal-9lU8MC-X.js → DotsHorizontal-B0A7sUYv.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-BBtotCm7.js → DotsVertical-BHUUUCDx.js} +1 -1
  10. package/dist/client/assets/Edit01-CxRkZTQ1.js +1 -0
  11. package/dist/client/assets/{File06-lv7rH_v1.js → File06-D0TXCuMx.js} +1 -1
  12. package/dist/client/assets/{FilterLines-WZSp93Oe.js → FilterLines-_uykt7r4.js} +1 -1
  13. package/dist/client/assets/{FlipBackward-CqqvNJYu.js → FlipBackward-GGMv99yc.js} +1 -1
  14. package/dist/client/assets/{GitBranch01-DN-LFsG4.js → GitBranch01-BUTuezlq.js} +1 -1
  15. package/dist/client/assets/{Grid01-bigl9l-5.js → Grid01-BbdtRdR8.js} +1 -1
  16. package/dist/client/assets/{Inbox01-BIZdM9VF.js → Inbox01-CgwXLK3n.js} +1 -1
  17. package/dist/client/assets/{InfoCircle-FggQ2WMl.js → InfoCircle-D6qJG9Nl.js} +1 -1
  18. package/dist/client/assets/{Key01-BHIpjeh2.js → Key01-8ewaPBuD.js} +1 -1
  19. package/dist/client/assets/{LinkExternal01-YcVnQhq1.js → LinkExternal01-D0Wjfr3t.js} +1 -1
  20. package/dist/client/assets/{Loading01-nz4zkIiQ.js → Loading01-NW_f44Lz.js} +1 -1
  21. package/dist/client/assets/{Lock01-DJbaRRVq.js → Lock01-BTPtPjN4.js} +1 -1
  22. package/dist/client/assets/{Play-Dy3YBriV.js → Play-CIMfsFF1.js} +1 -1
  23. package/dist/client/assets/{Plus-DRzcJPy4.js → Plus-DaP4KLuJ.js} +1 -1
  24. package/dist/client/assets/{SearchMd-CGgWiIHk.js → SearchMd-tOSOFUes.js} +1 -1
  25. package/dist/client/assets/{Terminal-DDxodu0O.js → Terminal-ANRX3jJ8.js} +1 -1
  26. package/dist/client/assets/{Trash01-Nn4emH5w.js → Trash01-CjDzx3jP.js} +1 -1
  27. package/dist/client/assets/{X-CSDtf13Z.js → X-D3ljCSd1.js} +1 -1
  28. package/dist/client/assets/{XClose-Da4Q_9Br.js → XClose-Ba3zyI0J.js} +1 -1
  29. package/dist/client/assets/{alert-dialog-BrdP9Xiy.js → alert-dialog-_Gzpv9vf.js} +1 -1
  30. package/dist/client/assets/{auth-BkX07Kdp.js → auth-C9dSkS_x.js} +1 -1
  31. package/dist/client/assets/{auth-catchall-CgZMKj4U.js → auth-catchall-DRL5ZGJM.js} +1 -1
  32. package/dist/client/assets/{avatar-DVkpHhcq.js → avatar-D1o5pnzU.js} +1 -1
  33. package/dist/client/assets/{badge-DZOpuutl.js → badge-0b6sJe4S.js} +1 -1
  34. package/dist/client/assets/{card-VaGCmdRN.js → card-B3fsloDi.js} +1 -1
  35. package/dist/client/assets/{checkbox-B6_pb64c.js → checkbox-2xIaHvS4.js} +1 -1
  36. package/dist/client/assets/{collection-detail-BZTq36Jq.js → collection-detail-Bu5gtjud.js} +31 -31
  37. package/dist/client/assets/{collection-display-button-0kCgwjcX.js → collection-display-button-BGIcja12.js} +1 -1
  38. package/dist/client/assets/{collection-header-C5jLEW4T.js → collection-header-DhWbmVkk.js} +1 -1
  39. package/dist/client/assets/{collection-page-BxN-pfZ4.js → collection-page-B4ZjGX9V.js} +1 -1
  40. package/dist/client/assets/{collection-search-DCk3URyd.js → collection-search-CYZk6T6Z.js} +1 -1
  41. package/dist/client/assets/collection-tab-IeT0mJ-2.js +1 -0
  42. package/dist/client/assets/{collection-table-wrapper-DbtYisXO.js → collection-table-wrapper-D2niE2Ci.js} +1 -1
  43. package/dist/client/assets/connection-card-D0c_wvmz.js +1 -0
  44. package/dist/client/assets/connection-detail-BmNPUV8x.js +1 -0
  45. package/dist/client/assets/connections-U2y3agtD.js +1 -0
  46. package/dist/client/assets/constants-Cy709IUA.js +1 -0
  47. package/dist/client/assets/{create-organization-dialog-BcohdvN6.js → create-organization-dialog-D0WQQsLG.js} +1 -1
  48. package/dist/client/assets/{dialog-rGW8NOdv.js → dialog-BXeLl5mO.js} +1 -1
  49. package/dist/client/assets/{dropdown-menu-DEdU2p2E.js → dropdown-menu-CnL8UM0z.js} +1 -1
  50. package/dist/client/assets/{empty-state-C6fFQCSt.js → empty-state-BmkZOMzL.js} +1 -1
  51. package/dist/client/assets/empty-state-DzS1Zp7m.js +2 -0
  52. package/dist/client/assets/{env-vars-editor-DtIOMaFz.js → env-vars-editor-B_mIaT86.js} +1 -1
  53. package/dist/client/assets/{error-boundary-B28JvE1I.js → error-boundary-BQnJ9S9E.js} +1 -1
  54. package/dist/client/assets/{extract-connection-data-fJTZE6Hc.js → extract-connection-data-DPoJQhk8.js} +1 -1
  55. package/dist/client/assets/{form-CE1tfcze.js → form-DrOt6d2d.js} +1 -1
  56. package/dist/client/assets/gateway-detail-CniDbJPb.js +1 -0
  57. package/dist/client/assets/gateways-DmEpJOpx.js +1 -0
  58. package/dist/client/assets/{home-lONkAboE.js → home-HrkEcREJ.js} +1 -1
  59. package/dist/client/assets/{index-CJEYCkTv.js → index-Bb8rHnPb.js} +1 -1
  60. package/dist/client/assets/index-CBIrwxtj.js +88 -0
  61. package/dist/client/assets/index-ChrSnaFS.css +1 -0
  62. package/dist/client/assets/{index-Dc4mPG7D.js → index-DMNk-OUX.js} +3 -3
  63. package/dist/client/assets/index-GoXtajA4.js +25 -0
  64. package/dist/client/assets/{index-CGbuv4sL.js → index-XOpbMEap.js} +1 -1
  65. package/dist/client/assets/{input-CLQFaB_P.js → input-68J17rBp.js} +1 -1
  66. package/dist/client/assets/{layout-D-qTqL0P.js → layout-Olb4shdE.js} +1 -1
  67. package/dist/client/assets/{lazy-highlighter-CM_r6Qg6.js → lazy-highlighter-Ccgc_fxj.js} +1 -1
  68. package/dist/client/assets/localstorage-keys-C62ZbWuB.js +1 -0
  69. package/dist/client/assets/{login-CY0fBMtA.js → login-UTKAAaeX.js} +1 -1
  70. package/dist/client/assets/{mcp-oauth-DwoWo555.js → mcp-oauth-Db8WtQ8u.js} +1 -1
  71. package/dist/client/assets/mcp-server-detail-BvVQovUz.js +1 -0
  72. package/dist/client/assets/members-V-vtwMYY.js +3 -0
  73. package/dist/client/assets/{monaco-editor-CGmVJ7Sz.js → monaco-editor-B_MycISs.js} +1 -1
  74. package/dist/client/assets/{monitoring-8m7n1ABH.js → monitoring-CBmCnQ7i.js} +20 -20
  75. package/dist/client/assets/{oauth-callback-C3UTt1IM.js → oauth-callback-BYBqbF1w.js} +1 -1
  76. package/dist/client/assets/page-DYF0Qz3l.js +1 -0
  77. package/dist/client/assets/page-DrIZd1pO.js +35 -0
  78. package/dist/client/assets/{pin-to-sidebar-button-DmlmCu_p.js → pin-to-sidebar-button-B1xHHS9n.js} +1 -1
  79. package/dist/client/assets/{popover-Bt6Irkfs.js → popover-DC9U4d6e.js} +1 -1
  80. package/dist/client/assets/{project-context-provider-jIErvTKU.js → project-context-provider-BJIP5a-U.js} +1 -1
  81. package/dist/client/assets/{resizable-BDACILOB.js → resizable-CW5_SPIS.js} +1 -1
  82. package/dist/client/assets/{resource-tabs-B9UXtdu9.js → resource-tabs-BKSlcL1W.js} +1 -1
  83. package/dist/client/assets/{select-CXOQrDyU.js → select-B9KJyTZZ.js} +1 -1
  84. package/dist/client/assets/{settings-Cml1v0xs.js → settings-CYg4YPRI.js} +1 -1
  85. package/dist/client/assets/shell-layout-KIN6fL5j.js +3 -0
  86. package/dist/client/assets/{spinner-C-rDsJGC.js → spinner-B0sczm1j.js} +1 -1
  87. package/dist/client/assets/{switch-C2oVrx7C.js → switch-BuVvmF04.js} +1 -1
  88. package/dist/client/assets/{textarea-DxDFaLzd.js → textarea-BAUX8Qgd.js} +1 -1
  89. package/dist/client/assets/thread-history-popover-Dv63nk6L.js +20 -0
  90. package/dist/client/assets/tool-set-selector-DMsE0yRo.js +1 -0
  91. package/dist/client/assets/tools-list-Dgf0oqyC.js +1 -0
  92. package/dist/client/assets/{use-binding-C_WCv3Kw.js → use-binding-Dj4lal1A.js} +1 -1
  93. package/dist/client/assets/use-connection-DoWszS3j.js +1 -0
  94. package/dist/client/assets/{use-connection-resources-DAy5w-Ms.js → use-connection-resources-BywYCfzc.js} +1 -1
  95. package/dist/client/assets/use-create-gateway-Ca5SEa8I.js +1 -0
  96. package/dist/client/assets/use-gateway-CRpsitbG.js +1 -0
  97. package/dist/client/assets/{use-gateway-system-prompt-B0FWJC8i.js → use-gateway-system-prompt-B4ia2QxW.js} +1 -1
  98. package/dist/client/assets/{use-list-state-D9IMsf4Z.js → use-list-state-CPUcOhR_.js} +1 -1
  99. package/dist/client/assets/use-mcp-L2lisTXg.js +1 -0
  100. package/dist/client/assets/{use-members-BrVgN1Nv.js → use-members-7eRdYOTr.js} +1 -1
  101. package/dist/client/assets/{use-mobile-BmTi-FB3.js → use-mobile--ytA5LT5.js} +1 -1
  102. package/dist/client/assets/use-organization-settings-D6rXW2c_.js +1 -0
  103. package/dist/client/assets/use-tool-call-BBonHr6l.js +1 -0
  104. package/dist/client/assets/{value-Duay7dd7.js → value-Bd2XBV_y.js} +1 -1
  105. package/dist/client/assets/{view-mode-toggle-Q_4Hio7O.js → view-mode-toggle-BpjQ6V4P.js} +1 -1
  106. package/dist/client/assets/well-known-mcp-D13f-8h2.js +1 -0
  107. package/dist/client/assets/workflow-CjynHD6b.js +1 -0
  108. package/dist/client/index.html +2 -2
  109. package/dist/server/cli.js +161 -133
  110. package/dist/server/migrate.js +2 -2
  111. package/dist/server/server.js +162 -134
  112. package/package.json +1 -1
  113. package/dist/client/assets/collection-tab-BK4lXf-5.js +0 -1
  114. package/dist/client/assets/connection-card-CtcQXchE.js +0 -1
  115. package/dist/client/assets/connection-detail-Dtnc6jAX.js +0 -1
  116. package/dist/client/assets/connections-BkTTX2-6.js +0 -1
  117. package/dist/client/assets/constants-D7HtiX2k.js +0 -1
  118. package/dist/client/assets/gateway-detail-DpvUxeca.js +0 -1
  119. package/dist/client/assets/gateways-DPTsKKk2.js +0 -1
  120. package/dist/client/assets/index-B-_GLG4a.js +0 -25
  121. package/dist/client/assets/index-DjBifmxL.js +0 -88
  122. package/dist/client/assets/index-KJvlasGf.css +0 -1
  123. package/dist/client/assets/localstorage-keys-Csxol0-8.js +0 -1
  124. package/dist/client/assets/mcp-server-detail-BfkMNCXA.js +0 -1
  125. package/dist/client/assets/members-DlfrW4qm.js +0 -3
  126. package/dist/client/assets/page-CjTfwiJs.js +0 -1
  127. package/dist/client/assets/page-Cm8i9onu.js +0 -35
  128. package/dist/client/assets/shell-layout-BC-hIRVP.js +0 -3
  129. package/dist/client/assets/thread-history-popover-D_x2TXEl.js +0 -72
  130. package/dist/client/assets/tool-set-selector-B03cDU_f.js +0 -1
  131. package/dist/client/assets/tools-list-CCvCpz3e.js +0 -1
  132. package/dist/client/assets/use-connection-D1oWmd80.js +0 -2
  133. package/dist/client/assets/use-gateway-DEBoqh3W.js +0 -1
  134. package/dist/client/assets/use-mcp-BSK2ddKq.js +0 -1
  135. package/dist/client/assets/use-organization-settings-DPGpmRIO.js +0 -1
  136. package/dist/client/assets/use-tool-call-B5UsmKnA.js +0 -1
  137. package/dist/client/assets/useQuery-CjN7yze9.js +0 -1
  138. package/dist/client/assets/well-known-mcp-7PcWXInp.js +0 -1
  139. package/dist/client/assets/workflow-C6xPZGlX.js +0 -1
@@ -1,3 +0,0 @@
1
- import{r as N,e as Qt,a as X,j as n,f as ke,t as K,c as p,R as es,T as ts,D as ss,C as ns,P as as,g as os,O as is,h as ls,i as rs,k as jt,l as cs,d as vt,G as ds,m as ms,S as St,n as fs,o as us,N as hs,p as ps,K as xs,q as Nt}from"./index-Dc4mPG7D.js";import{E as nt}from"./error-boundary-B28JvE1I.js";import{B as Z,c as O,I as gs}from"./input-CLQFaB_P.js";import{P as wt,a as yt,b as Ct}from"./popover-Bt6Irkfs.js";import{B as rt}from"./badge-DZOpuutl.js";import{i as Be}from"./Check-Dh23dmDM.js";import{n as ct}from"./Inbox01-BIZdM9VF.js";import{s as dt}from"./XClose-Da4Q_9Br.js";import{i as bs}from"./File06-lv7rH_v1.js";import{i as _e}from"./X-CSDtf13Z.js";import{u as Ie}from"./use-mobile-BmTi-FB3.js";import{T as _t,a as kt,b as It,c as $t,u as He,L as mt,P as js,O as vs}from"./project-context-provider-jIErvTKU.js";import{u as zt,a as Ss}from"./use-organization-settings-DPGpmRIO.js";import{n as Ns,u as ws,E as ys,I as ft}from"./use-connection-D1oWmd80.js";import{i as tt}from"./use-gateway-DEBoqh3W.js";import{C as Cs}from"./create-organization-dialog-BcohdvN6.js";import{A as Q}from"./avatar-DVkpHhcq.js";import{c as _s}from"./Grid01-bigl9l-5.js";import{D as ks,a as Is,b as $s,c as zs,u as Ms,d as Os,e as Ts,C as D,f as ut,g as As,h as Es,i as Rs,U as Ls,G as Ps,M as Ds}from"./index-DjBifmxL.js";import{D as Bs,a as Hs,b as Us,c as Gs,d as ht}from"./dropdown-menu-DEdU2p2E.js";import{a as Mt}from"./Copy01-BX4_oHqx.js";import{n as pt}from"./LinkExternal01-YcVnQhq1.js";import{D as Ws,a as Fs,b as Vs,c as Ks,d as Zs}from"./dialog-rGW8NOdv.js";import{L as qs}from"./form-CE1tfcze.js";import{S as Ys}from"./switch-C2oVrx7C.js";import{i as Js}from"./Code01-BvYrq72o.js";import{u as at,L as Ue}from"./localstorage-keys-Csxol0-8.js";import{u as xt,a as Xs,b as Qs,c as en,N as tn,G as sn,T as nn,D as an}from"./thread-history-popover-D_x2TXEl.js";import{R as Ot,a as on,b as ln}from"./resizable-BDACILOB.js";import{i as rn}from"./Loading01-nz4zkIiQ.js";import{s as cn}from"./Plus-DRzcJPy4.js";import{u as dn}from"./use-binding-C_WCv3Kw.js";import{W as mn}from"./well-known-mcp-7PcWXInp.js";import"./alert-dialog-BrdP9Xiy.js";import"./spinner-C-rDsJGC.js";import"./SearchMd-CGgWiIHk.js";import"./AlertCircle-BI-lv-P2.js";import"./textarea-DxDFaLzd.js";import"./Terminal-DDxodu0O.js";import"./monaco-editor-CGmVJ7Sz.js";import"./select-CXOQrDyU.js";import"./ChevronDown-CQl6wdMq.js";import"./InfoCircle-FggQ2WMl.js";import"./useQuery-CjN7yze9.js";import"./use-gateway-system-prompt-B0FWJC8i.js";import"./generate-id-Dyweu44Y.js";import"./Clock-C2L66fjj.js";import"./Trash01-Nn4emH5w.js";import"./auth-BkX07Kdp.js";const Tt=({size:t=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"M9 7H4.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C3 7.76 3 8.04 3 8.6v10.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C3.76 21 4.04 21 4.6 21H9m0 0h6m-6 0V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C9.76 3 10.04 3 10.6 3h2.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C15 3.76 15 4.04 15 4.6V21m0-10h4.4c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C21 11.76 21 12.04 21 12.6v6.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C20.24 21 19.96 21 19.4 21H15"}));Tt.displayName="BarChart10";const At=({size:t=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"M15 21v-5.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C14.24 14 13.96 14 13.4 14h-2.8c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C9 14.76 9 15.04 9 15.6V21M3 7a3 3 0 0 0 6 0 3 3 0 1 0 6 0 3 3 0 1 0 6 0M6.2 21h11.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C19.48 3 18.92 3 17.8 3H6.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C3 4.52 3 5.08 3 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21Z"}));At.displayName="Building02";const Et=({size:t=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"m7 15 5 5 5-5M7 9l5-5 5 5"}));Et.displayName="ChevronSelectorVertical";const Rt=({size:t=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"M2 12h20M2 12c0 5.523 4.477 10 10 10M2 12C2 6.477 6.477 2 12 2m10 10c0 5.523-4.477 10-10 10m10-10c0-5.523-4.477-10-10-10m0 0a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10m0-20a15.3 15.3 0 0 0-4 10 15.3 15.3 0 0 0 4 10"}));Rt.displayName="Globe01";const Lt=({size:t=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"M9 21v-7.4c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C9.76 12 10.04 12 10.6 12h2.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C15 12.76 15 13.04 15 13.6V21M11.018 2.764 4.235 8.039c-.453.353-.68.53-.843.75a2 2 0 0 0-.318.65C3 9.704 3 9.991 3 10.565V17.8c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21h11.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8v-7.235c0-.574 0-.861-.074-1.126a2.002 2.002 0 0 0-.318-.65c-.163-.22-.39-.397-.843-.75l-6.783-5.275c-.351-.273-.527-.41-.72-.462a1 1 0 0 0-.523 0c-.194.052-.37.189-.721.462Z"}));Lt.displayName="Home02";const Pt=({size:t=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"M15 3v18M7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3Z"}));Pt.displayName="LayoutRight";const Dt=({size:t=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"m16 17 5-5m0 0-5-5m5 5H9m0-9H7.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C3 5.28 3 6.12 3 7.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 21 6.12 21 7.8 21H9"}));Dt.displayName="LogOut01";const Bt=({size:t=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"m2 7 8.165 5.715c.661.463.992.695 1.351.784a2 2 0 0 0 .968 0c.36-.09.69-.32 1.351-.784L22 7M6.8 20h10.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C22 17.72 22 16.88 22 15.2V8.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C19.72 4 18.88 4 17.2 4H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2 6.28 2 7.12 2 8.8v6.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C4.28 20 5.12 20 6.8 20Z"}));Bt.displayName="Mail01";const ot=({size:t=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),N.createElement("path",{d:"M18.727 14.727a1.5 1.5 0 0 0 .3 1.655l.055.054a1.816 1.816 0 0 1 0 2.573 1.818 1.818 0 0 1-2.573 0l-.055-.055a1.5 1.5 0 0 0-1.654-.3 1.5 1.5 0 0 0-.91 1.373v.155a1.818 1.818 0 1 1-3.636 0V20.1a1.5 1.5 0 0 0-.981-1.373 1.5 1.5 0 0 0-1.655.3l-.054.055a1.818 1.818 0 0 1-3.106-1.287 1.818 1.818 0 0 1 .533-1.286l.054-.055a1.5 1.5 0 0 0 .3-1.654 1.5 1.5 0 0 0-1.372-.91h-.155a1.818 1.818 0 1 1 0-3.636H3.9a1.5 1.5 0 0 0 1.373-.981 1.5 1.5 0 0 0-.3-1.655l-.055-.054A1.818 1.818 0 1 1 7.491 4.99l.054.054a1.5 1.5 0 0 0 1.655.3h.073a1.5 1.5 0 0 0 .909-1.372v-.155a1.818 1.818 0 0 1 3.636 0V3.9a1.499 1.499 0 0 0 .91 1.373 1.5 1.5 0 0 0 1.654-.3l.054-.055a1.817 1.817 0 0 1 2.573 0 1.819 1.819 0 0 1 0 2.573l-.055.054a1.5 1.5 0 0 0-.3 1.655v.073a1.5 1.5 0 0 0 1.373.909h.155a1.818 1.818 0 0 1 0 3.636H20.1a1.499 1.499 0 0 0-1.373.91Z"}));ot.displayName="Settings01";const Ht=({size:t=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"M22 21v-2a4.002 4.002 0 0 0-3-3.874M15.5 3.291a4.001 4.001 0 0 1 0 7.418M17 21c0-1.864 0-2.796-.305-3.53a4 4 0 0 0-2.164-2.165C13.796 15 12.864 15 11 15H8c-1.864 0-2.796 0-3.53.305a4 4 0 0 0-2.166 2.164C2 18.204 2 19.136 2 21M13.5 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"}));Ht.displayName="Users01";const Ut=({size:t=24,color:e="currentColor",...s})=>N.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},N.createElement("path",{d:"M13 2 4.093 12.688c-.348.418-.523.628-.525.804a.5.5 0 0 0 .185.397c.138.111.41.111.955.111H12l-1 8 8.907-10.688c.348-.418.523-.628.525-.804a.5.5 0 0 0-.185-.397c-.138-.111-.41-.111-.955-.111H12l1-8Z"}));Ut.displayName="Zap";function fn({invitation:t,onStatusChange:e}){const[s,a]=N.useState(!1),[o,i]=N.useState(!1),l=ke(),r=async()=>{a(!0);try{const f=await X.organization.acceptInvitation({invitationId:t.id});if(f.error)K.error(f.error.message),a(!1);else{e(t.id,"accepted");const g=await X.organization.setActive({organizationId:t.organizationId});g?.data?.slug?(K.success("Invitation accepted!"),l({to:"/$org",params:{org:g.data.slug}})):(K.success("Invitation accepted! Redirecting..."),l({to:"/"}))}}catch{K.error("Failed to accept invitation"),a(!1)}},c=async()=>{i(!0);try{const f=await X.organization.rejectInvitation({invitationId:t.id});f.error?(K.error(f.error.message),i(!1)):(K.success("Invitation rejected"),e(t.id,"rejected"),i(!1))}catch{K.error("Failed to reject invitation"),i(!1)}},d=t.organizationName||t.organizationId,m=t.inviter?.name||t.inviter?.email||t.email||"Someone",u=t.status==="pending",h=t.status==="accepted",b=t.status==="rejected";return n.jsxs("div",{className:`flex items-center gap-3 px-3 py-2 h-12 border-b border-border/50 last:border-b-0 ${u?"":"opacity-50"}`,children:[n.jsx("div",{className:"shrink-0 size-5 flex items-center justify-center",children:n.jsx(Bt,{size:16,className:"text-muted-foreground"})}),n.jsxs("p",{className:"flex-1 text-sm text-foreground min-w-0 whitespace-nowrap overflow-hidden",children:[n.jsx("span",{className:"font-semibold inline-block max-w-[120px] truncate align-bottom",children:m})," invited you to join ",n.jsx("span",{className:"font-semibold inline-block max-w-[200px] truncate align-bottom",children:d})]}),n.jsx("div",{className:"flex items-center gap-1 shrink-0",children:u?n.jsxs(n.Fragment,{children:[n.jsx(Z,{variant:"ghost",size:"icon",onClick:c,disabled:s||o,className:"h-8 w-8",children:n.jsx(dt,{size:14})}),n.jsx(Z,{variant:"outline",size:"icon",onClick:r,disabled:s||o,className:"h-8 w-8",children:n.jsx(Be,{size:14})})]}):h?n.jsxs(rt,{variant:"outline",className:"h-6 px-2 text-xs",children:[n.jsx(Be,{size:12}),"Accepted"]}):b?n.jsxs(rt,{variant:"outline",className:"h-6 px-2 text-xs",children:[n.jsx(dt,{size:12}),"Declined"]}):null})]})}function un(){const[t,e]=N.useState(!1),s=N.useContext(Qt),{data:a}=s.hooks.useListUserInvitations(),{data:o}=X.useListOrganizations(),[i,l]=N.useState({}),d=(a??[]).map(f=>{const g=(o??[]).find(x=>x.id===f.organizationId);return{...f,organizationSlug:g?.slug||f.organizationSlug,organizationName:g?.name||f.organizationName}}).map(f=>({...f,status:i[f.id]||f.status})),m=[...d].sort((f,g)=>{const x={pending:0,accepted:1,rejected:2};return(x[f.status]??999)-(x[g.status]??999)}),h=d.filter(f=>f.status==="pending").length>0,b=(f,g)=>{l(x=>({...x,[f]:g}))};return n.jsxs(wt,{open:t,onOpenChange:e,children:[n.jsx(yt,{asChild:!0,children:n.jsxs(Z,{variant:"ghost",size:"sm",className:"relative h-7 w-7 p-0","aria-label":"Inbox",children:[n.jsx(ct,{size:18,className:"text-muted-foreground"}),h&&n.jsx("span",{className:"absolute bottom-1 right-0.5 h-2 w-2 rounded-full bg-destructive ring-2 ring-background"})]})}),n.jsxs(Ct,{align:"end",className:"w-[480px] p-0 overflow-hidden",children:[n.jsx("div",{className:"px-4 py-3 border-b border-border",children:n.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Inbox"})}),n.jsx("div",{className:"max-h-96 overflow-auto",children:m.length>0?m.map(f=>n.jsx(fn,{invitation:f,onStatusChange:b},f.id)):n.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[n.jsx(ct,{size:32,className:"text-muted-foreground/40 mb-2"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"No invitations at the moment"})]})})]})]})}function hn(t){const e=p.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=n.jsx(es,{"data-slot":"sheet",...s}),e[2]=s,e[3]=a):a=e[3],a}function pn(t){const e=p.c(4);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let a;return e[2]!==s?(a=n.jsx(as,{"data-slot":"sheet-portal",...s}),e[2]=s,e[3]=a):a=e[3],a}function xn(t){const e=p.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=O("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx(is,{"data-slot":"sheet-overlay",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function gn(t){const e=p.c(17);let s,a,o,i;e[0]!==t?({className:a,children:s,side:i,...o}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=o,e[4]=i):(s=e[1],a=e[2],o=e[3],i=e[4]);const l=i===void 0?"right":i;let r;e[5]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(xn,{}),e[5]=r):r=e[5];const c=l==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",d=l==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",m=l==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",u=l==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t";let h;e[6]!==a||e[7]!==c||e[8]!==d||e[9]!==m||e[10]!==u?(h=O("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",c,d,m,u,a),e[6]=a,e[7]=c,e[8]=d,e[9]=m,e[10]=u,e[11]=h):h=e[11];let b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsxs(os,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[n.jsx(_e,{className:"size-4"}),n.jsx("span",{className:"sr-only",children:"Close"})]}),e[12]=b):b=e[12];let f;return e[13]!==s||e[14]!==o||e[15]!==h?(f=n.jsxs(pn,{children:[r,n.jsxs(ns,{"data-slot":"sheet-content",className:h,...o,children:[s,b]})]}),e[13]=s,e[14]=o,e[15]=h,e[16]=f):f=e[16],f}function bn(t){const e=p.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=O("flex flex-col gap-1.5 p-4",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("div",{"data-slot":"sheet-header",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function jn(t){const e=p.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=O("text-foreground font-semibold",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx(ts,{"data-slot":"sheet-title",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function vn(t){const e=p.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=O("text-muted-foreground text-sm",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx(ss,{"data-slot":"sheet-description",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function Gt(t){const e=p.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=O("bg-accent animate-pulse rounded-md",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("div",{"data-slot":"skeleton",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}const Sn="sidebar_state",Nn=3600*24*7,wn="16rem",yn="18rem",Cn="3rem",_n="b",Wt=N.createContext(null);function it(){const t=N.useContext(Wt);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function kn(t){const e=p.c(21),{defaultOpen:s,open:a,onOpenChange:o,children:i}=t,l=s===void 0?!0:s,r=Ie(),[c,d]=N.useState(!1),[m,u]=N.useState(l),h=a??m;let b;e[0]!==h||e[1]!==o?(b=y=>{const w=typeof y=="function"?y(h):y;o?o(w):u(w),document.cookie=`${Sn}=${w}; path=/; max-age=${Nn}`},e[0]=h,e[1]=o,e[2]=b):b=e[2];const f=b;let g;e[3]!==r||e[4]!==f?(g=()=>r?d($n):f(In),e[3]=r,e[4]=f,e[5]=g):g=e[5];const x=g;let j,v;e[6]!==x?(j=()=>{const y=w=>{if(w.key===_n&&(w.metaKey||w.ctrlKey)){const z=w.target;if(z.tagName==="INPUT"||z.tagName==="TEXTAREA"||z.isContentEditable)return;w.preventDefault(),x()}};return globalThis.addEventListener("keydown",y),()=>globalThis.removeEventListener("keydown",y)},v=[x],e[6]=x,e[7]=j,e[8]=v):(j=e[7],v=e[8]),N.useEffect(j,v);const C=h?"expanded":"collapsed";let _;e[9]!==r||e[10]!==h||e[11]!==c||e[12]!==f||e[13]!==C||e[14]!==x?(_={state:C,open:h,setOpen:f,isMobile:r,openMobile:c,setOpenMobile:d,toggleSidebar:x},e[9]=r,e[10]=h,e[11]=c,e[12]=f,e[13]=C,e[14]=x,e[15]=_):_=e[15];const k=_;let I;e[16]!==i?(I=n.jsx(kt,{delayDuration:0,children:i}),e[16]=i,e[17]=I):I=e[17];let $;return e[18]!==k||e[19]!==I?($=n.jsx(Wt.Provider,{value:k,children:I}),e[18]=k,e[19]=I,e[20]=$):$=e[20],$}function In(t){return!t}function $n(t){return!t}function zn(t){const e=p.c(14);let s,a,o,i;e[0]!==t?({className:a,style:i,children:s,...o}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=o,e[4]=i):(s=e[1],a=e[2],o=e[3],i=e[4]);let l;e[5]!==i?(l={"--sidebar-width":wn,"--sidebar-width-icon":Cn,...i},e[5]=i,e[6]=l):l=e[6];const r=l;let c;e[7]!==a?(c=O("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex h-full w-full",a),e[7]=a,e[8]=c):c=e[8];let d;return e[9]!==s||e[10]!==o||e[11]!==r||e[12]!==c?(d=n.jsx("div",{"data-slot":"sidebar-wrapper",style:r,className:c,...o,children:s}),e[9]=s,e[10]=o,e[11]=r,e[12]=c,e[13]=d):d=e[13],d}function Mn(t){const e=p.c(46);let s,a,o,i,l,r;e[0]!==t?({side:i,variant:l,collapsible:r,className:a,children:s,...o}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=o,e[4]=i,e[5]=l,e[6]=r):(s=e[1],a=e[2],o=e[3],i=e[4],l=e[5],r=e[6]);const c=i===void 0?"left":i,d=l===void 0?"sidebar":l,m=r===void 0?"offcanvas":r,{isMobile:u,state:h,openMobile:b,setOpenMobile:f}=it();if(m==="none"){let w;e[7]!==a?(w=O("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",a),e[7]=a,e[8]=w):w=e[8];let z;return e[9]!==s||e[10]!==o||e[11]!==w?(z=n.jsx("div",{"data-slot":"sidebar",className:w,...o,children:s}),e[9]=s,e[10]=o,e[11]=w,e[12]=z):z=e[12],z}if(u){let w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w={"--sidebar-width":yn},e[13]=w):w=e[13];let z;e[14]===Symbol.for("react.memo_cache_sentinel")?(z=n.jsxs(bn,{className:"sr-only",children:[n.jsx(jn,{children:"Sidebar"}),n.jsx(vn,{children:"Displays the mobile sidebar."})]}),e[14]=z):z=e[14];let S;e[15]!==s?(S=n.jsx("div",{className:"flex h-full w-full flex-col",children:s}),e[15]=s,e[16]=S):S=e[16];let T;e[17]!==c||e[18]!==S?(T=n.jsxs(gn,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:w,side:c,children:[z,S]}),e[17]=c,e[18]=S,e[19]=T):T=e[19];let A;return e[20]!==b||e[21]!==o||e[22]!==f||e[23]!==T?(A=n.jsx(hn,{open:b,onOpenChange:f,...o,children:T}),e[20]=b,e[21]=o,e[22]=f,e[23]=T,e[24]=A):A=e[24],A}const g=h==="collapsed"?m:"",x=d==="floating"||d==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)";let j;e[25]!==x?(j=O("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",x),e[25]=x,e[26]=j):j=e[26];let v;e[27]!==j?(v=n.jsx("div",{"data-slot":"sidebar-gap",className:j}),e[27]=j,e[28]=v):v=e[28];const C=c==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",_=d==="floating"||d==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)";let k;e[29]!==a||e[30]!==C||e[31]!==_?(k=O("fixed top-12 bottom-0 z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",C,_,a),e[29]=a,e[30]=C,e[31]=_,e[32]=k):k=e[32];let I;e[33]!==s?(I=n.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border py-2 flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:s}),e[33]=s,e[34]=I):I=e[34];let $;e[35]!==o||e[36]!==k||e[37]!==I?($=n.jsx("div",{"data-slot":"sidebar-container",className:k,...o,children:I}),e[35]=o,e[36]=k,e[37]=I,e[38]=$):$=e[38];let y;return e[39]!==c||e[40]!==h||e[41]!==$||e[42]!==g||e[43]!==v||e[44]!==d?(y=n.jsxs("div",{className:"group peer text-foreground hidden md:block border-r","data-state":h,"data-collapsible":g,"data-variant":d,"data-side":c,"data-slot":"sidebar",children:[v,$]}),e[39]=c,e[40]=h,e[41]=$,e[42]=g,e[43]=v,e[44]=d,e[45]=y):y=e[45],y}function On(t){const e=p.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=O("bg-background relative flex w-full flex-1 flex-col min-w-0","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("main",{"data-slot":"sidebar-inset",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function Tn(t){const e=p.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=O("h-4 m-0! w-full",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("div",{"data-sidebar":"separator",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function An(t){const e=p.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=O("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function En(t){const e=p.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=O("relative flex w-full min-w-0 flex-col px-2 py-2 md:py-0",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function Rn(t){const e=p.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=O("w-full text-sm",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function Ln(t){const e=p.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=O("flex w-full min-w-0 flex-col gap-1",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}function Ge(t){const e=p.c(8);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);let o;e[3]!==s?(o=O("group/menu-item relative",s),e[3]=s,e[4]=o):o=e[4];let i;return e[5]!==a||e[6]!==o?(i=n.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:o,...a}),e[5]=a,e[6]=o,e[7]=i):i=e[7],i}const Pn=ls("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-lg px-2 py-1.5 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding,colors] transition-colors duration-150 ease-out hover:transition-none focus-visible:ring-2 active:bg-sidebar-accent/75 disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent/75 [&>span:last-child]:truncate [&>svg]:size-[18px] [&>svg]:shrink-0 [&>svg]:text-muted-foreground",{variants:{variant:{default:"hover:bg-sidebar-accent text-sidebar-foreground/80 active:text-sidebar-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-7 text-sm font-[450]",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Ft(t){const e=p.c(28);let s,a,o,i,l,r,c;e[0]!==t?({asChild:o,isActive:i,variant:l,size:r,tooltip:c,className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=o,e[4]=i,e[5]=l,e[6]=r,e[7]=c):(s=e[1],a=e[2],o=e[3],i=e[4],l=e[5],r=e[6],c=e[7]);const d=o===void 0?!1:o,m=i===void 0?!1:i,u=l===void 0?"default":l,h=r===void 0?"default":r,b=d?rs:"button",{isMobile:f,state:g}=it();let x;e[8]!==s||e[9]!==h||e[10]!==u?(x=O(Pn({variant:u,size:h}),s),e[8]=s,e[9]=h,e[10]=u,e[11]=x):x=e[11];let j;e[12]!==b||e[13]!==m||e[14]!==a||e[15]!==h||e[16]!==x?(j=n.jsx(b,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":h,"data-active":m,className:x,...a}),e[12]=b,e[13]=m,e[14]=a,e[15]=h,e[16]=x,e[17]=j):j=e[17];const v=j;if(!c)return v;if(typeof c=="string"){let $;e[18]!==c?($={children:c},e[18]=c,e[19]=$):$=e[19],c=$}let C;e[20]!==v?(C=n.jsx(It,{asChild:!0,children:v}),e[20]=v,e[21]=C):C=e[21];const _=g!=="collapsed"||f;let k;e[22]!==_||e[23]!==c?(k=n.jsx(_t,{side:"right",align:"center",hidden:_,...c}),e[22]=_,e[23]=c,e[24]=k):k=e[24];let I;return e[25]!==C||e[26]!==k?(I=n.jsxs($t,{children:[C,k]}),e[25]=C,e[26]=k,e[27]=I):I=e[27],I}function Dn(t){const e=p.c(26),{item:s}=t,a=ke(),{org:o}=He(),i=zt(o.id),l=Ss(o.id);let r;e[0]!==l.update||e[1]!==s.url||e[2]!==i?.sidebar_items?(r=async()=>{const _=(i?.sidebar_items||[]).filter(k=>k.url!==s.url);await l.update.mutateAsync({sidebar_items:_})},e[0]=l.update,e[1]=s.url,e[2]=i?.sidebar_items,e[3]=r):r=e[3];const c=r;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=/^https?:\/\/.+/,e[4]=d):d=e[4];let m;e[5]!==s.icon?(m=d.test(s.icon),e[5]=s.icon,e[6]=m):m=e[6];const u=m;let h;e[7]!==s.url||e[8]!==a?(h=()=>{a({to:s.url})},e[7]=s.url,e[8]=a,e[9]=h):h=e[9];const b=s.title;let f;e[10]!==u||e[11]!==s.icon||e[12]!==s.title?(f=n.jsx("div",{className:"flex items-center justify-center shrink-0",children:u?n.jsx("img",{src:s.icon,alt:s.title,className:"h-4 w-4 rounded object-cover"}):n.jsx(bs,{size:16,className:"text-muted-foreground group-hover/item:text-foreground transition-colors"})}),e[10]=u,e[11]=s.icon,e[12]=s.title,e[13]=f):f=e[13];let g;e[14]!==s.title?(g=s.title.toLocaleLowerCase(),e[14]=s.title,e[15]=g):g=e[15];let x;e[16]!==g?(x=n.jsx("div",{className:"flex-1 min-w-0 flex flex-col items-start",children:n.jsx("span",{className:"truncate text-sm w-full capitalize",children:g})}),e[16]=g,e[17]=x):x=e[17];let j;e[18]!==c?(j=n.jsx(_e,{size:16,className:"text-muted-foreground opacity-0 group-hover/item:opacity-50 hover:opacity-100 cursor-pointer",onClick:C=>{C.preventDefault(),C.stopPropagation(),c()}}),e[18]=c,e[19]=j):j=e[19];let v;return e[20]!==s.title||e[21]!==h||e[22]!==f||e[23]!==x||e[24]!==j?(v=n.jsx(Ge,{children:n.jsxs(Ft,{className:"w-full pr-2 group/item relative cursor-pointer text-foreground/90 hover:text-foreground",onClick:h,tooltip:b,children:[f,x,j]})}),e[20]=s.title,e[21]=h,e[22]=f,e[23]=x,e[24]=j,e[25]=v):v=e[25],v}function Bn(){const t=p.c(4),{org:e}=He(),a=zt(e.id)?.sidebar_items;if(!a?.length)return null;let o;t[0]!==a?(o=a.map(Hn),t[0]=a,t[1]=o):o=t[1];let i;return t[2]!==o?(i=n.jsx(Vt,{children:o}),t[2]=o,t[3]=i):i=t[3],i}function Hn(t){return n.jsx(Dn,{item:t},t.url)}function gt(){const t=p.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Ge,{children:n.jsx("div",{className:"flex items-center gap-2 px-4 py-2",children:n.jsx(Gt,{className:"h-4 flex-1"})})}),t[0]=e):e=t[0],e}function Vt(t){const e=p.c(4),{children:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Tn,{className:"my-2 -ml-1"}),e[0]=a):a=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(Ge,{children:n.jsx("div",{className:"group-data-[collapsible=icon]:hidden px-2 py-0 text-xs font-medium h-6 text-muted-foreground flex items-center justify-between",children:n.jsx("span",{className:"whitespace-nowrap",children:"Pinned Views"})})}),e[1]=o):o=e[1];let i;return e[2]!==s?(i=n.jsxs(n.Fragment,{children:[a,o,s]}),e[2]=s,e[3]=i):i=e[3],i}function Un(){const t=p.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(N.Suspense,{fallback:n.jsxs(Vt,{children:[n.jsx(gt,{}),n.jsx(gt,{})]}),children:n.jsx(Bn,{})}),t[0]=e):e=t[0],e}function Gn(){const t=p.c(49),{locator:e}=He(),s=ke(),a=jt();let o;t[0]!==e?(o=mt.parse(e),t[0]=e,t[1]=o):o=t[1];const{org:i}=o;let l;t[2]!==e?(l=mt.isOrgAdminProject(e),t[2]=e,t[3]=l):l=t[3];const r=l,c=a.location.pathname===`/${i}`||a.location.pathname===`/${i}/`;let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Lt,{}),t[4]=d):d=t[4];let m;t[5]!==c||t[6]!==s||t[7]!==i?(m={key:"home",label:"Home",icon:d,onClick:()=>{c?window.dispatchEvent(new CustomEvent("reset-home-view")):s({to:"/$org",params:{org:i}})}},t[5]=c,t[6]=s,t[7]=i,t[8]=m):m=t[8];let u;t[9]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(At,{}),t[9]=u):u=t[9];let h;t[10]!==s||t[11]!==i?(h={key:"store",label:"Store",icon:u,onClick:()=>s({to:"/$org/store",params:{org:i}})},t[10]=s,t[11]=i,t[12]=h):h=t[12];let b;t[13]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(Ns,{}),t[13]=b):b=t[13];let f;t[14]!==s||t[15]!==i?(f={key:"mcps",label:"Connections",icon:b,onClick:()=>s({to:"/$org/mcps",params:{org:i}})},t[14]=s,t[15]=i,t[16]=f):f=t[16];let g;t[17]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(tt,{}),t[17]=g):g=t[17];let x;t[18]!==s||t[19]!==i?(x={key:"gateways",label:"Agents",icon:g,onClick:()=>s({to:"/$org/gateways",params:{org:i}})},t[18]=s,t[19]=i,t[20]=x):x=t[20];let j;t[21]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(Ut,{}),t[21]=j):j=t[21];let v;t[22]!==s||t[23]!==i?(v={key:"workflow",label:"Workflows",icon:j,onClick:()=>s({to:"/$org/workflows",params:{org:i}})},t[22]=s,t[23]=i,t[24]=v):v=t[24];let C;t[25]===Symbol.for("react.memo_cache_sentinel")?(C=n.jsx(Tt,{}),t[25]=C):C=t[25];let _;t[26]!==s||t[27]!==i?(_={key:"monitoring",label:"Monitoring",icon:C,onClick:()=>s({to:"/$org/monitoring",params:{org:i}})},t[26]=s,t[27]=i,t[28]=_):_=t[28];let k;t[29]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(Ht,{}),t[29]=k):k=t[29];let I;t[30]!==s||t[31]!==i?(I={key:"members",label:"Members",icon:k,onClick:()=>s({to:"/$org/members",params:{org:i}})},t[30]=s,t[31]=i,t[32]=I):I=t[32];let $;t[33]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx(ot,{}),t[33]=$):$=t[33];let y;t[34]!==s||t[35]!==i?(y={key:"settings",label:"Settings",icon:$,onClick:()=>s({to:"/$org/settings",params:{org:i}})},t[34]=s,t[35]=i,t[36]=y):y=t[36];let w;t[37]!==v||t[38]!==_||t[39]!==I||t[40]!==y||t[41]!==m||t[42]!==h||t[43]!==f||t[44]!==x?(w=[m,h,f,x,v,_,I,y],t[37]=v,t[38]=_,t[39]=I,t[40]=y,t[41]=m,t[42]=h,t[43]=f,t[44]=x,t[45]=w):w=t[45];const z=w;let S;return t[46]!==z||t[47]!==r?(S=r?z:[],t[46]=z,t[47]=r,t[48]=S):S=t[48],S}function Kt(t){const e=p.c(10),{navigationItems:s,footer:a,additionalContent:o,variant:i,collapsible:l}=t,r=i===void 0?"sidebar":i,c=l===void 0?"icon":l;let d;e[0]!==s?(d=s.map(Wn),e[0]=s,e[1]=d):d=e[1];let m;e[2]!==o||e[3]!==d?(m=n.jsx(An,{className:"flex-1 overflow-x-hidden",children:n.jsx(En,{className:"font-medium",children:n.jsx(Rn,{children:n.jsxs(Ln,{className:"gap-0.5",children:[d,o]})})})}),e[2]=o,e[3]=d,e[4]=m):m=e[4];let u;return e[5]!==c||e[6]!==a||e[7]!==m||e[8]!==r?(u=n.jsxs(Mn,{variant:r,collapsible:c,children:[m,a]}),e[5]=c,e[6]=a,e[7]=m,e[8]=r,e[9]=u):u=e[9],u}function Wn(t){return n.jsx(Ge,{children:n.jsxs(Ft,{className:"group/nav-item cursor-pointer text-foreground/90 hover:text-foreground",onClick:t.onClick,isActive:t.isActive,tooltip:t.label,children:[n.jsx("span",{className:"text-muted-foreground group-hover/nav-item:text-foreground transition-colors [&>svg]:size-4",children:t.icon}),n.jsx("span",{className:"truncate",children:t.label})]})},t.key)}Kt.Skeleton=function(){return n.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,s)=>n.jsx("div",{className:"w-full h-8",children:n.jsx(Gt,{className:"h-full bg-sidebar-accent rounded-md"})},s))})};function Fn(){const t=p.c(3),e=Gn();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(n.Fragment,{children:n.jsx(nt,{children:n.jsx(N.Suspense,{fallback:null,children:n.jsx(Un,{})})})}),t[0]=s):s=t[0];let a;return t[1]!==e?(a=n.jsx(Kt,{navigationItems:e,additionalContent:s}),t[1]=e,t[2]=a):a=t[2],a}function Vn(t){const e=p.c(12);let s,a,o,i;e[0]!==t?({className:s,orientation:o,decorative:i,...a}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=o,e[4]=i):(s=e[1],a=e[2],o=e[3],i=e[4]);const l=o===void 0?"horizontal":o,r=i===void 0?!0:i;let c;e[5]!==s?(c=O("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",s),e[5]=s,e[6]=c):c=e[6];let d;return e[7]!==r||e[8]!==l||e[9]!==a||e[10]!==c?(d=n.jsx(cs,{"data-slot":"separator-root",decorative:r,orientation:l,className:c,...a}),e[7]=r,e[8]=l,e[9]=a,e[10]=c,e[11]=d):d=e[11],d}const Zt=N.createContext(null);function Kn(){const t=N.useContext(Zt);if(!t)throw new Error("TopbarSwitcher compound components must be used within TopbarSwitcher.Root");return t}function Zn(t){const e=p.c(10),{children:s,onItemHover:a}=t,[o,i]=N.useState(null);let l;e[0]!==a?(l=u=>{i(u),a?.(u)},e[0]=a,e[1]=l):l=e[1];const r=l;let c;e[2]!==o||e[3]!==r?(c={hoveredItem:o,setHoveredItem:r},e[2]=o,e[3]=r,e[4]=c):c=e[4];let d;e[5]!==s?(d=n.jsx(wt,{children:s}),e[5]=s,e[6]=d):d=e[6];let m;return e[7]!==c||e[8]!==d?(m=n.jsx(Zt.Provider,{value:c,children:d}),e[7]=c,e[8]=d,e[9]=m):m=e[9],m}function qn(t){const e=p.c(6),{children:s,onClick:a}=t;let o;e[0]!==s||e[1]!==a?(o=n.jsx(Z,{variant:"link",className:"p-0.5 h-auto",onClick:a,type:"button",children:s}),e[0]=s,e[1]=a,e[2]=o):o=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(yt,{asChild:!0,children:n.jsx(Z,{size:"icon",variant:"ghost",className:"w-6 h-6 p-0",children:n.jsx(Et,{size:16,className:"opacity-50"})})}),e[3]=i):i=e[3];let l;return e[4]!==o?(l=n.jsxs("div",{className:"flex items-center gap-1",children:[o,i]}),e[4]=o,e[5]=l):l=e[5],l}function Yn(t){const e=p.c(8),{item:s,fallback:a}=t,o=a===void 0?"":a,i=s?.avatarUrl??"",l=s?.name??o;let r;e[0]!==i||e[1]!==l?(r=n.jsx(Q,{url:i,fallback:l,size:"xs",objectFit:"contain"}),e[0]=i,e[1]=l,e[2]=r):r=e[2];const c=s?.name??o;let d;e[3]!==c?(d=n.jsx("span",{children:c}),e[3]=c,e[4]=d):d=e[4];let m;return e[5]!==r||e[6]!==d?(m=n.jsxs("div",{className:"flex items-center gap-2",children:[r,d]}),e[5]=r,e[6]=d,e[7]=m):m=e[7],m}function Jn(t){const e=p.c(6),{children:s,align:a}=t,o=a===void 0?"start":a,l=N.Children.toArray(s).filter(Xn).length===1?"280px":"480px";let r;e[0]!==l?(r={width:l},e[0]=l,e[1]=r):r=e[1];let c;return e[2]!==o||e[3]!==s||e[4]!==r?(c=n.jsx(Ct,{align:o,className:"p-0 flex items-start",style:r,children:s}),e[2]=o,e[3]=s,e[4]=r,e[5]=c):c=e[5],c}function Xn(t){return N.isValidElement(t)&&(t.type===Yt||t.type===qt)}function qt(t){const e=p.c(5),{children:s,className:a}=t;let o;e[0]!==a?(o=O("flex flex-col border-border w-[240px] border-r last:border-r-0 last:w-full",a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==s||e[3]!==o?(i=n.jsx("div",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=i):i=e[4],i}const Yt=qt;function Qn(t){const e=p.c(6),{placeholder:s,value:a,onChange:o}=t,i=s===void 0?"Search...":s;let l;e[0]!==o?(l=c=>o(c.target.value),e[0]=o,e[1]=l):l=e[1];let r;return e[2]!==i||e[3]!==l||e[4]!==a?(r=n.jsx(gs,{placeholder:i,value:a,onChange:l,className:"rounded-none border-t-0 border-x-0 focus-visible:border-border focus-visible:ring-0"}),e[2]=i,e[3]=l,e[4]=a,e[5]=r):r=e[5],r}function ea(t){const e=p.c(6),{children:s,emptyMessage:a}=t,o=a===void 0?"No items found.":a,i=N.Children.count(s)>0;let l;e[0]!==o||e[1]!==i?(l=!i&&n.jsx("div",{className:"text-muted-foreground text-sm px-1 py-8 text-center",children:o}),e[0]=o,e[1]=i,e[2]=l):l=e[2];let r;return e[3]!==s||e[4]!==l?(r=n.jsxs("div",{className:"flex flex-col gap-0.5 p-1 max-h-44 overflow-y-auto",children:[l,s]}),e[3]=s,e[4]=l,e[5]=r):r=e[5],r}function ta(t){const e=p.c(15),{item:s,onClick:a,onHover:o,children:i}=t,l=Kn();let r;e[0]!==l||e[1]!==s||e[2]!==o?(r=()=>{l.setHoveredItem(s.slug),o?.(s)},e[0]=l,e[1]=s,e[2]=o,e[3]=r):r=e[3];const c=r;let d;e[4]!==s||e[5]!==a?(d=()=>a(s),e[4]=s,e[5]=a,e[6]=d):d=e[6];let m;e[7]!==i||e[8]!==s.avatarUrl||e[9]!==s.name?(m=i||n.jsxs(n.Fragment,{children:[n.jsx(Q,{url:s.avatarUrl??"",fallback:s.name,size:"xs",className:"w-[22px]! h-[22px]!",objectFit:"contain"}),n.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap",children:s.name})]}),e[7]=i,e[8]=s.avatarUrl,e[9]=s.name,e[10]=m):m=e[10];let u;return e[11]!==c||e[12]!==d||e[13]!==m?(u=n.jsx(Z,{onClick:d,onMouseEnter:c,variant:"ghost",size:"sm",className:"w-full justify-start font-normal",children:m}),e[11]=c,e[12]=d,e[13]=m,e[14]=u):u=e[14],u}function sa(t){const e=p.c(2),{children:s}=t;let a;return e[0]!==s?(a=n.jsx("div",{className:"px-1 pb-1 pt-0.5",children:s}),e[0]=s,e[1]=a):a=e[1],a}function na(t){const e=p.c(11),{onClick:s,icon:a,children:o,variant:i}=t,r=(i===void 0?"default":i)==="muted"&&"text-muted-foreground";let c;e[0]!==r?(c=O("w-full justify-start font-normal",r),e[0]=r,e[1]=c):c=e[1];let d;e[2]!==a?(d=a&&n.jsx("span",{className:"[&>svg]:size-4",children:a}),e[2]=a,e[3]=d):d=e[3];let m;e[4]!==o?(m=n.jsx("span",{children:o}),e[4]=o,e[5]=m):m=e[5];let u;return e[6]!==s||e[7]!==c||e[8]!==d||e[9]!==m?(u=n.jsxs(Z,{variant:"ghost",size:"sm",className:c,onClick:s,children:[d,m]}),e[6]=s,e[7]=c,e[8]=d,e[9]=m,e[10]=u):u=e[10],u}function aa(){const t=p.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Vn,{}),t[0]=e):e=t[0],e}function oa(){const t=p.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"h-4 w-16 bg-accent rounded-full animate-pulse"}),t[0]=e):e=t[0],e}const G=Object.assign(Zn,{Trigger:qn,CurrentItem:Yn,Content:Jn,Panel:Yt,Search:Qn,Items:ea,Item:ta,Actions:sa,Action:na,Separator:aa,Skeleton:oa});function st(){const t=p.c(59);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const{org:s}=vt(e),{data:a}=X.useListOrganizations(),o=ke();let i;t[1]!==s||t[2]!==a?(i=a?.find(E=>E.slug===s),t[1]=s,t[2]=a,t[3]=i):i=t[3];const l=i,[r,c]=N.useState(""),[d,m]=N.useState(!1);let u,h,b,f,g,x,j,v;if(t[4]!==l||t[5]!==o||t[6]!==s||t[7]!==r||t[8]!==a){const R=(a?(()=>{const B=a.filter(V=>V.name.toLowerCase().includes(r.toLowerCase()));if(s){const V=B.findIndex(q=>q.slug===s);if(V>0){const q=B[V];q&&(B.splice(V,1),B.unshift(q))}}return B})():[]).map(ia);let H;t[17]!==l?(H=l?{slug:l.slug,name:l.name,avatarUrl:l.logo}:void 0,t[17]=l,t[18]=H):H=t[18];const M=H;f=G;let U;t[19]!==o||t[20]!==s?(U=()=>o({to:"/$org",params:{org:s??""}}),t[19]=o,t[20]=s,t[21]=U):U=t[21];let L;t[22]!==M?(L=n.jsx(G.CurrentItem,{item:M}),t[22]=M,t[23]=L):L=t[23],t[24]!==U||t[25]!==L?(v=n.jsx(G.Trigger,{onClick:U,children:L}),t[24]=U,t[25]=L,t[26]=v):v=t[26],b=G.Content,h=G.Panel,t[27]!==r?(j=n.jsx(G.Search,{placeholder:"Search organizations...",value:r,onChange:c}),t[27]=r,t[28]=j):j=t[28],u=G.Items,g="No organizations found.";let W;t[29]!==o?(W=B=>n.jsx(G.Item,{item:B,onClick:V=>o({to:"/$org",params:{org:V.slug}})},B.slug),t[29]=o,t[30]=W):W=t[30],x=R.map(W),t[4]=l,t[5]=o,t[6]=s,t[7]=r,t[8]=a,t[9]=u,t[10]=h,t[11]=b,t[12]=f,t[13]=g,t[14]=x,t[15]=j,t[16]=v}else u=t[9],h=t[10],b=t[11],f=t[12],g=t[13],x=t[14],j=t[15],v=t[16];let C;t[31]!==u||t[32]!==g||t[33]!==x?(C=n.jsx(u,{emptyMessage:g,children:x}),t[31]=u,t[32]=g,t[33]=x,t[34]=C):C=t[34];let _,k;t[35]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(G.Actions,{children:n.jsx(G.Action,{onClick:()=>m(!0),variant:"muted",children:"+ Create organization"})}),k=n.jsx(G.Separator,{}),t[35]=_,t[36]=k):(_=t[35],k=t[36]);let I;t[37]!==o?(I=()=>o({to:"/"}),t[37]=o,t[38]=I):I=t[38];let $;t[39]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx(_s,{}),t[39]=$):$=t[39];let y;t[40]!==I?(y=n.jsx(G.Actions,{children:n.jsx(G.Action,{onClick:I,icon:$,children:"See all organizations"})}),t[40]=I,t[41]=y):y=t[41];let w;t[42]!==h||t[43]!==y||t[44]!==j||t[45]!==C?(w=n.jsxs(h,{children:[j,C,_,k,y]}),t[42]=h,t[43]=y,t[44]=j,t[45]=C,t[46]=w):w=t[46];let z;t[47]!==b||t[48]!==w?(z=n.jsx(b,{children:w}),t[47]=b,t[48]=w,t[49]=z):z=t[49];let S;t[50]!==f||t[51]!==z||t[52]!==v?(S=n.jsxs(f,{children:[v,z]}),t[50]=f,t[51]=z,t[52]=v,t[53]=S):S=t[53];let T;t[54]!==d?(T=n.jsx(Cs,{open:d,onOpenChange:m}),t[54]=d,t[55]=T):T=t[55];let A;return t[56]!==S||t[57]!==T?(A=n.jsxs(n.Fragment,{children:[S,T]}),t[56]=S,t[57]=T,t[58]=A):A=t[58],A}function ia(t){return{slug:t.slug,name:t.name,avatarUrl:t.logo}}st.Skeleton=G.Skeleton;const Jt=N.createContext({setOpen:()=>{}}),la=()=>N.useContext(Jt),ra=t=>{const e=p.c(25);let s,a,o,i,l;e[0]!==t?({children:s,defaultOpen:a,open:i,onOpenChange:o,...l}=t,e[0]=t,e[1]=s,e[2]=a,e[3]=o,e[4]=i,e[5]=l):(s=e[1],a=e[2],o=e[3],i=e[4],l=e[5]);const r=a??!1;let c;e[6]!==o||e[7]!==i||e[8]!==r?(c={prop:i,defaultProp:r,onChange:o},e[6]=o,e[7]=i,e[8]=r,e[9]=c):c=e[9];const[d,m]=Ms(c);let u;e[10]!==m?(u={setOpen:m},e[10]=m,e[11]=u):u=e[11];let h;e[12]!==s||e[13]!==d||e[14]!==l||e[15]!==m?(h=n.jsx(Os,{open:d,onOpenChange:m,...l,children:s}),e[12]=s,e[13]=d,e[14]=l,e[15]=m,e[16]=h):h=e[16];let b;e[17]!==d||e[18]!==l||e[19]!==m||e[20]!==h?(b=n.jsx(Us,{open:d,onOpenChange:m,...l,children:h}),e[17]=d,e[18]=l,e[19]=m,e[20]=h,e[21]=b):b=e[21];let f;return e[22]!==u||e[23]!==b?(f=n.jsx(Jt.Provider,{value:u,children:b}),e[22]=u,e[23]=b,e[24]=f):f=e[24],f},ca=t=>{const{children:e,title:s,...a}=t,o=Ie(),{className:i,...l}=a;return o?n.jsxs(Is,{...l,children:[n.jsx($s,{className:"hidden",children:n.jsx(zs,{children:s})}),n.jsx("div",{className:O("flex flex-col gap-2 p-2 py-4",i),children:e})]}):n.jsx(Hs,{...a,children:e})},da=t=>{const{children:e,...s}=t,{setOpen:a}=la(),o=Ie(),{className:i,...l}=s;return o?n.jsx("div",{...l,onClick:r=>{a(!1);const{onClick:c}=l;c?.(r)},className:O("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-lg px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",i),children:e}):n.jsx(Gs,{...s,children:e})},ma=t=>{const e=p.c(7);let s,a;e[0]!==t?({children:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);const o=Ie();let i;return e[3]!==s||e[4]!==o||e[5]!==a?(i=o?n.jsx(ks,{asChild:!0,children:s}):n.jsx(Bs,{...a,children:s}),e[3]=s,e[4]=o,e[5]=a,e[6]=i):i=e[6],i},fa=t=>{const e=p.c(7);let s,a;e[0]!==t?({className:s,...a}=t,e[0]=t,e[1]=s,e[2]=a):(s=e[1],a=e[2]);const o=Ie();let i;return e[3]!==s||e[4]!==o||e[5]!==a?(i=o?n.jsx(ht,{className:O(s),...a}):n.jsx(ht,{className:O(s),...a}),e[3]=s,e[4]=o,e[5]=a,e[6]=i):i=e[6],i};function ua(t){const e=p.c(11),{user:s,trigger:a,align:o,children:i}=t,l=o===void 0?"start":o;let r;e[0]!==a||e[1]!==s?(r=a(s),e[0]=a,e[1]=s,e[2]=r):r=e[2];let c;e[3]!==r?(c=n.jsx(ma,{asChild:!0,children:n.jsx("div",{children:r})}),e[3]=r,e[4]=c):c=e[4];let d;e[5]!==l||e[6]!==i?(d=n.jsx(ca,{side:"top",align:l,className:"md:w-[240px]",children:i}),e[5]=l,e[6]=i,e[7]=d):d=e[7];let m;return e[8]!==c||e[9]!==d?(m=n.jsxs(ra,{children:[c,d]}),e[8]=c,e[9]=d,e[10]=m):m=e[10],m}function ha(t){const e=p.c(8),{children:s,onClick:a,className:o,asChild:i}=t;let l;e[0]!==i||e[1]!==s||e[2]!==a?(l=i?s:n.jsx("button",{type:"button",className:"flex items-center gap-2 text-sm w-full cursor-pointer",onClick:a,children:s}),e[0]=i,e[1]=s,e[2]=a,e[3]=l):l=e[3];let r;return e[4]!==i||e[5]!==o||e[6]!==l?(r=n.jsx(da,{asChild:i,className:o,children:l}),e[4]=i,e[5]=o,e[6]=l,e[7]=r):r=e[7],r}function pa(t){const e=p.c(2),{className:s}=t;let a;return e[0]!==s?(a=n.jsx(fa,{className:s}),e[0]=s,e[1]=a):a=e[1],a}function xa(){const t=p.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"w-8 h-8 bg-muted rounded-full animate-pulse"}),t[0]=e):e=t[0],e}const J=Object.assign(ua,{Item:ha,Separator:pa,Skeleton:xa});function ga(t){const e=p.c(48),{open:s,onOpenChange:a,user:o,userImage:i}=t,[l,r]=Ts(),[c,d]=N.useState(!1);let m;e[0]!==o.id?(m=()=>{navigator.clipboard.writeText(o.id),d(!0),setTimeout(()=>d(!1),2e3)},e[0]=o.id,e[1]=m):m=e[1];const u=m;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Ws,{className:"text-base",children:"Profile Settings"}),e[2]=h):h=e[2];let b;e[3]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsxs(Fs,{className:"px-6 pt-6 pb-4 border-b border-border shrink-0 relative",children:[h,n.jsxs(Vs,{className:"absolute top-1/2 right-4 -translate-y-1/2 cursor-pointer rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[n.jsx(_e,{size:16}),n.jsx("span",{className:"sr-only",children:"Close"})]})]}),e[3]=b):b=e[3];const f=o.name||"U";let g;e[4]!==f||e[5]!==i?(g=n.jsx(Q,{url:i,fallback:f,shape:"circle",size:"xl",className:"h-16 w-16"}),e[4]=f,e[5]=i,e[6]=g):g=e[6];const x=o.name||"User";let j;e[7]!==x?(j=n.jsx("span",{className:"text-base font-medium text-foreground",children:x}),e[7]=x,e[8]=j):j=e[8];let v;e[9]!==o.email?(v=n.jsx("span",{className:"text-sm text-muted-foreground",children:o.email}),e[9]=o.email,e[10]=v):v=e[10];let C;e[11]!==j||e[12]!==v?(C=n.jsxs("div",{className:"flex flex-col gap-1",children:[j,v]}),e[11]=j,e[12]=v,e[13]=C):C=e[13];let _;e[14]!==g||e[15]!==C?(_=n.jsxs("div",{className:"flex items-center gap-4",children:[g,C]}),e[14]=g,e[15]=C,e[16]=_):_=e[16];let k;e[17]!==l||e[18]!==r?(k=()=>r(!l),e[17]=l,e[18]=r,e[19]=k):k=e[19];let I;e[20]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",children:[n.jsxs(qs,{className:"text-sm font-medium text-foreground flex items-center gap-2 pointer-events-none",children:[n.jsx(Js,{size:16,className:"text-muted-foreground"}),"Developer Mode"]}),n.jsx("p",{className:"text-xs text-muted-foreground pointer-events-none",children:"Show technical details like JSON input/output for tool calls"})]}),e[20]=I):I=e[20];let $;e[21]!==l||e[22]!==r?($=n.jsx("div",{onClick:ba,children:n.jsx(Ys,{checked:l,onCheckedChange:r})}),e[21]=l,e[22]=r,e[23]=$):$=e[23];let y;e[24]!==k||e[25]!==$?(y=n.jsxs("button",{type:"button",onClick:k,className:"flex items-center justify-between gap-4 p-4 rounded-lg border border-border hover:bg-accent/50 transition-colors text-left w-full cursor-pointer",children:[I,$]}),e[24]=k,e[25]=$,e[26]=y):y=e[26];let w;e[27]!==_||e[28]!==y?(w=n.jsxs("div",{className:"p-5 space-y-6 min-h-[225px]",children:[_,y]}),e[27]=_,e[28]=y,e[29]=w):w=e[29];let z;e[30]!==o.id?(z=n.jsx("span",{className:"font-mono text-xs",children:o.id}),e[30]=o.id,e[31]=z):z=e[31];let S;e[32]!==c?(S=c?n.jsx(Be,{size:14,className:"text-green-600"}):n.jsx(Mt,{size:14,className:"opacity-0 group-hover:opacity-100 transition-opacity"}),e[32]=c,e[33]=S):S=e[33];let T;e[34]!==u||e[35]!==z||e[36]!==S?(T=n.jsx(It,{asChild:!0,children:n.jsxs("button",{type:"button",onClick:u,className:"group flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[z,S]})}),e[34]=u,e[35]=z,e[36]=S,e[37]=T):T=e[37];let A;e[38]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx(_t,{side:"top",children:n.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[38]=A):A=e[38];let E;e[39]!==T?(E=n.jsx("div",{className:"border-t border-border px-5 py-4 flex items-center shrink-0",children:n.jsx(kt,{children:n.jsxs($t,{children:[T,A]})})}),e[39]=T,e[40]=E):E=e[40];let R;e[41]!==w||e[42]!==E?(R=n.jsxs(Ks,{className:"sm:max-w-lg sm:max-h-[85vh] p-0 flex flex-col",closeButtonClassName:"hidden",children:[b,n.jsxs("div",{className:"flex flex-col",children:[w,E]})]}),e[41]=w,e[42]=E,e[43]=R):R=e[43];let H;return e[44]!==a||e[45]!==s||e[46]!==R?(H=n.jsx(Zs,{open:s,onOpenChange:a,children:R}),e[44]=a,e[45]=s,e[46]=R,e[47]=H):H=e[47],H}function ba(t){return t.stopPropagation()}function ja(t){const e=p.c(47),{user:s,userImage:a}=t,[o,i]=N.useState(!1),[l,r]=N.useState(!1);let c;e[0]!==s.email||e[1]!==s.id||e[2]!==s.name?(c=()=>{const H=`ID: ${s.id}
2
- Name: ${s.name||"N/A"}
3
- Email: ${s.email}`;navigator.clipboard.writeText(H),r(!0),K.success("User info copied to clipboard"),setTimeout(()=>r(!1),2e3)},e[0]=s.email,e[1]=s.id,e[2]=s.name,e[3]=c):c=e[3];const d=c;let m;e[4]!==s.email||e[5]!==s.name||e[6]!==a?(m=()=>n.jsx(Q,{url:a,fallback:s.name||s.email||"U",shape:"circle",size:"sm",className:"cursor-pointer hover:ring-2 ring-muted-foreground transition-all h-7 w-7"}),e[4]=s.email,e[5]=s.name,e[6]=a,e[7]=m):m=e[7];const u=s.name||s.email||"U";let h;e[8]!==u||e[9]!==a?(h=n.jsx(Q,{url:a,fallback:u,shape:"circle",size:"sm"}),e[8]=u,e[9]=a,e[10]=h):h=e[10];const b=s.name||"User";let f;e[11]!==b?(f=n.jsx("div",{className:"text-sm font-medium truncate",children:b}),e[11]=b,e[12]=f):f=e[12];let g;e[13]!==s.email?(g=n.jsx("div",{className:"text-xs text-muted-foreground truncate",children:s.email}),e[13]=s.email,e[14]=g):g=e[14];let x;e[15]!==f||e[16]!==g?(x=n.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[f,g]}),e[15]=f,e[16]=g,e[17]=x):x=e[17];let j;e[18]!==l?(j=n.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:l?n.jsx(Be,{size:16,className:"text-green-600"}):n.jsx(Mt,{size:16,className:"text-muted-foreground"})}),e[18]=l,e[19]=j):j=e[19];let v;e[20]!==h||e[21]!==x||e[22]!==j?(v=n.jsxs("div",{className:"group flex items-center gap-3 w-full py-1",children:[h,x,j]}),e[20]=h,e[21]=x,e[22]=j,e[23]=v):v=e[23];let C;e[24]!==d||e[25]!==v?(C=n.jsx(J.Item,{onClick:d,children:v}),e[24]=d,e[25]=v,e[26]=C):C=e[26];let _;e[27]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(J.Separator,{}),e[27]=_):_=e[27];let k,I;e[28]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsxs(J.Item,{onClick:()=>i(!0),children:[n.jsx(ot,{className:"text-muted-foreground",size:18}),"Profile Settings"]}),I=n.jsx(J.Separator,{}),e[28]=k,e[29]=I):(k=e[28],I=e[29]);let $;e[30]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx(ds,{className:"w-4 h-4 text-muted-foreground"}),e[30]=$):$=e[30];let y;e[31]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(J.Item,{asChild:!0,children:n.jsxs("a",{href:"https://github.com/decocms/admin",target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 text-sm cursor-pointer",children:[$,"decocms/admin",n.jsx(pt,{size:18,className:"text-muted-foreground ml-auto"})]})}),e[31]=y):y=e[31];let w;e[32]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(Rt,{className:"text-muted-foreground",size:18}),e[32]=w):w=e[32];let z,S;e[33]===Symbol.for("react.memo_cache_sentinel")?(z=n.jsx(J.Item,{asChild:!0,children:n.jsxs("a",{href:"https://decocms.com",target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 text-sm cursor-pointer",children:[w,"Homepage",n.jsx(pt,{size:18,className:"ml-auto text-muted-foreground"})]})}),S=n.jsx(J.Separator,{}),e[33]=z,e[34]=S):(z=e[33],S=e[34]);let T;e[35]===Symbol.for("react.memo_cache_sentinel")?(T=n.jsxs(J.Item,{onClick:va,children:[n.jsx(Dt,{size:18,className:"text-muted-foreground"}),"Log out"]}),e[35]=T):T=e[35];let A;e[36]!==C||e[37]!==m||e[38]!==s?(A=n.jsxs(J,{user:s,trigger:m,align:"end",children:[C,_,k,I,y,z,S,T]}),e[36]=C,e[37]=m,e[38]=s,e[39]=A):A=e[39];let E;e[40]!==o||e[41]!==s||e[42]!==a?(E=o&&n.jsx(ga,{open:o,onOpenChange:i,user:s,userImage:a}),e[40]=o,e[41]=s,e[42]=a,e[43]=E):E=e[43];let R;return e[44]!==A||e[45]!==E?(R=n.jsxs(n.Fragment,{children:[A,E]}),e[44]=A,e[45]=E,e[46]=R):R=e[46],R}function va(){return X.signOut()}function Sa(){const t=p.c(7),{data:e}=X.useSession();if(!e?.user){let c;return t[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Q,{url:void 0,fallback:"U",shape:"circle",size:"sm",className:"cursor-pointer h-7 w-7",muted:!0}),t[0]=c):c=t[0],c}const s=e.user,a=s.name??void 0;let o;t[1]!==a||t[2]!==s?(o={...s,name:a},t[1]=a,t[2]=s,t[3]=o):o=t[3];const i=o,l=s.image;let r;return t[4]!==l||t[5]!==i?(r=n.jsx(ja,{user:i,userImage:l}),t[4]=l,t[5]=i,t[6]=r):r=t[6],r}function lt(){const t=p.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=Ue.decoChatOpen(),t[0]=e):e=t[0];const[s,a]=at(e,Na);let o;return t[1]!==s||t[2]!==a?(o=[s,a],t[1]=s,t[2]=a,t[3]=o):o=t[3],o}function Na(t){return!!(t??!1)}function wa(t){const e=p.c(6),{children:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(ms,{children:n.jsx(St,{})}),e[0]=a):a=e[0];let o;e[1]!==s?(o=n.jsx(fs,{children:s}),e[1]=s,e[2]=o):o=e[2];let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(us,{children:n.jsx(hs,{to:"/login",replace:!0})}),e[3]=i):i=e[3];let l;return e[4]!==o?(l=n.jsxs(n.Fragment,{children:[a,o,i]}),e[4]=o,e[5]=l):l=e[5],l}function ya(t){const e=p.c(5),{children:s,className:a}=t;let o;e[0]!==a?(o=O("fixed top-0 left-0 right-0 z-20 bg-sidebar flex items-center w-full h-12 border-b border-border",a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==s||e[3]!==o?(i=n.jsx("div",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=i):i=e[4],i}function Ca(t){const e=p.c(5),{children:s,className:a}=t;let o;e[0]!==a?(o=O("flex items-center justify-center px-2.5 h-full border-r border-border",a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==s||e[3]!==o?(i=n.jsx("div",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=i):i=e[4],i}function _a(t){const e=p.c(5),{children:s,className:a}=t;let o;e[0]!==a?(o=O("flex items-center gap-2 px-2 h-full",a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==s||e[3]!==o?(i=n.jsx("div",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=i):i=e[4],i}function ka(t){const e=p.c(5),{children:s,className:a}=t;let o;e[0]!==a?(o=O("flex items-center gap-2 px-2 h-full flex-1",a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==s||e[3]!==o?(i=n.jsx("div",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=i):i=e[4],i}function Ia(t){const e=p.c(5),{children:s,className:a}=t;let o;e[0]!==a?(o=O("flex items-center gap-2 px-2 h-full ml-auto",a),e[0]=a,e[1]=o):o=e[1];let i;return e[2]!==s||e[3]!==o?(i=n.jsx("div",{className:o,children:s}),e[2]=s,e[3]=o,e[4]=i):i=e[4],i}function $a(){const t=p.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex items-center justify-center px-2 h-full border-r border-border",children:n.jsx("div",{className:"w-8 h-8 bg-muted rounded-md animate-pulse"})}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"flex items-center gap-2 px-2 h-full",children:n.jsx("div",{className:"w-32 h-6 bg-muted rounded-md animate-pulse"})}),t[1]=s):s=t[1];let a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"fixed top-0 left-0 right-0 z-20 bg-sidebar flex items-center w-full h-12 border-b border-border",children:[e,s,n.jsx("div",{className:"flex items-center gap-2 px-2 h-full ml-auto",children:n.jsx("div",{className:"w-8 h-8 bg-muted rounded-full animate-pulse"})})]}),t[2]=a):a=t[2],a}const De=Object.assign(ya,{Sidebar:Ca,Left:_a,Center:ka,Right:Ia,Skeleton:$a});function Xt(){const t=p.c(3),{toggleSidebar:e}=it();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Pt,{className:"text-muted-foreground/85 group-hover:text-foreground transition-colors",size:18}),t[0]=s):s=t[0];let a;return t[1]!==e?(a=n.jsx(n.Fragment,{children:n.jsx(Z,{onClick:e,size:"icon",variant:"ghost",className:"w-7 h-7 rounded-md",children:s})}),t[1]=e,t[2]=a):a=t[2],a}Xt.Skeleton=function(){return n.jsx("div",{className:"w-7 h-7 bg-muted rounded-md animate-pulse"})};const za="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png";function Ma(){const t=p.c(138),{org:e,locator:s}=He(),{slug:a,id:o}=e,[,i]=lt(),l=ke(),{data:r}=X.useSession(),c=r?.user,{createThread:d,activeThreadId:m,setActiveThreadId:u,hideThread:h}=ut(),{threads:b,refetch:f}=As(),g=Es(),x=Rs(),j=ws();let v;t[0]!==j?(v={connections:j,binding:"LLMS"},t[0]=j,t[1]=v):v=t[1];const[C]=dn(v),_=!!C,k=g.length>0,I=_&&k;let $;t[2]!==s?($=Ue.chatSelectedModel(s),t[2]=s,t[3]=$):$=t[3];const[y,w]=xt($,x,Ta);let z;t[4]===Symbol.for("react.memo_cache_sentinel")?(z={gatewayId:mn.DECOPILOT},t[4]=z):z=t[4];const[S,T]=xt(`${s}:selected-gateway`,g,Oa,z),A=Xs(S?.id),E=Qs();let R;t[5]!==d||t[6]!==S?.id?(R=P=>d({id:P.id,title:P.title,gatewayId:S?.id}),t[5]=d,t[6]=S?.id,t[7]=R):R=t[7];let H;t[8]!==m||t[9]!==E||t[10]!==A||t[11]!==R?(H={threadId:m,systemPrompt:A,onToolCall:E,onCreateThread:R},t[8]=m,t[9]=E,t[10]=A,t[11]=R,t[12]=H):H=t[12];const M=en(H),{inputValue:U,setInputValue:L,branchContext:W,clearBranch:B}=ut(),{isEmpty:V}=M;let q;t[13]!==W||t[14]!==B||t[15]!==u||t[16]!==L?(q=()=>{W&&(u(W.originalThreadId),B(),L(""))},t[13]=W,t[14]=B,t[15]=u,t[16]=L,t[17]=q):q=t[17];const We=q;let $e;t[18]!==m||t[19]!==M||t[20]!==B||t[21]!==S||t[22]!==y||t[23]!==L||t[24]!==c?.image||t[25]!==c?.name?($e=async P=>{if(!y){K.error("No model configured");return}if(!S?.id){K.error("No Agent configured");return}L(""),B();const Y={created_at:new Date().toISOString(),thread_id:m,model:{id:y.id,connectionId:y.connectionId,provider:y.provider??void 0,limits:y.limits??void 0},gateway:{id:S.id},user:{avatar:c?.image??void 0,name:c?.name??"you"}};await M.sendMessage(P,Y)},t[18]=m,t[19]=M,t[20]=B,t[21]=S,t[22]=y,t[23]=L,t[24]=c?.image,t[25]=c?.name,t[26]=$e):$e=t[26];const F=$e;let ze;t[27]!==w?(ze=P=>{w(P)},t[27]=w,t[28]=ze):ze=t[28];const Fe=ze;let Me;t[29]!==T?(Me=P=>{T({gatewayId:P})},t[29]=T,t[30]=Me):Me=t[30];const Ve=Me;if(!I){let P,Y;!_&&!k?(P="Connect your providers",Y="Connect an LLM provider and create an Agent to unlock AI-powered features."):_?(P="No Agents configured",Y="Create an Agent to expose your MCP tools to the chat."):(P="No model provider connected",Y="Connect to a model provider to unlock AI-powered features.");let Re;t[31]===Symbol.for("react.memo_cache_sentinel")?(Re=n.jsxs(D.Header.Left,{children:[n.jsx("img",{src:za,alt:"deco chat",className:"size-5 rounded"}),n.jsx("span",{className:"text-sm font-medium",children:"deco chat"})]}),t[31]=Re):Re=t[31];let we;t[32]!==i?(we=()=>i(!1),t[32]=i,t[33]=we):we=t[33];let Le;t[34]===Symbol.for("react.memo_cache_sentinel")?(Le=n.jsx(_e,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"}),t[34]=Le):Le=t[34];let ye;t[35]!==we?(ye=n.jsxs(D.Header,{children:[Re,n.jsx(D.Header.Right,{children:n.jsx("button",{type:"button",onClick:we,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent transition-colors group cursor-pointer",title:"Close chat",children:Le})})]}),t[35]=we,t[36]=ye):ye=t[36];let Ce;t[37]!==j||t[38]!==Y||t[39]!==_||t[40]!==l||t[41]!==o||t[42]!==a||t[43]!==P||t[44]!==c?.id?(Ce=n.jsx(D.Main,{className:"flex flex-col items-center",children:n.jsx(D.EmptyState,{children:_?n.jsx(ys,{title:P,description:Y,actions:n.jsx(Z,{variant:"outline",onClick:()=>l({to:"/$org/mcps",params:{org:a},search:{action:"create"}}),children:"Custom Connection"})}):n.jsx(tn,{title:P,description:Y,orgSlug:a,orgId:o,userId:c?.id??"",allConnections:j,onInstallMcpServer:()=>l({to:"/$org/mcps",params:{org:a},search:{action:"create"}})})})}),t[37]=j,t[38]=Y,t[39]=_,t[40]=l,t[41]=o,t[42]=a,t[43]=P,t[44]=c?.id,t[45]=Ce):Ce=t[45];let Pe;return t[46]!==ye||t[47]!==Ce?(Pe=n.jsxs(D,{children:[ye,Ce]}),t[46]=ye,t[47]=Ce,t[48]=Pe):Pe=t[48],Pe}const Ke=S?.icon,Ze=S?.title||"deco chat";let Oe;t[49]===Symbol.for("react.memo_cache_sentinel")?(Oe=n.jsx(tt,{size:12}),t[49]=Oe):Oe=t[49];let ee;t[50]!==Ke||t[51]!==Ze?(ee=n.jsx(ft,{icon:Ke,name:Ze,size:"xs",fallbackIcon:Oe}),t[50]=Ke,t[51]=Ze,t[52]=ee):ee=t[52];const qe=S?.title||"deco chat";let te;t[53]!==qe?(te=n.jsx("span",{className:"text-sm font-medium",children:qe}),t[53]=qe,t[54]=te):te=t[54];let se;t[55]!==ee||t[56]!==te?(se=n.jsxs(D.Header.Left,{children:[ee,te]}),t[55]=ee,t[56]=te,t[57]=se):se=t[57];let ne;t[58]!==d?(ne=()=>d(),t[58]=d,t[59]=ne):ne=t[59];let Te;t[60]===Symbol.for("react.memo_cache_sentinel")?(Te=n.jsx(cn,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"}),t[60]=Te):Te=t[60];let ae;t[61]!==ne?(ae=n.jsx("button",{type:"button",onClick:ne,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent group cursor-pointer",title:"New chat",children:Te}),t[61]=ne,t[62]=ae):ae=t[62];let oe;t[63]!==f?(oe=()=>f(),t[63]=f,t[64]=oe):oe=t[64];let ie;t[65]!==m||t[66]!==h||t[67]!==u||t[68]!==oe||t[69]!==b?(ie=n.jsx(nn,{threads:b,activeThreadId:m,onSelectThread:u,onRemoveThread:h,onOpen:oe}),t[65]=m,t[66]=h,t[67]=u,t[68]=oe,t[69]=b,t[70]=ie):ie=t[70];let le;t[71]!==i?(le=()=>i(!1),t[71]=i,t[72]=le):le=t[72];let Ae;t[73]===Symbol.for("react.memo_cache_sentinel")?(Ae=n.jsx(_e,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"}),t[73]=Ae):Ae=t[73];let re;t[74]!==le?(re=n.jsx("button",{type:"button",onClick:le,className:"flex size-6 items-center justify-center rounded-full p-1 hover:bg-transparent transition-colors group cursor-pointer",title:"Close chat",children:Ae}),t[74]=le,t[75]=re):re=t[75];let ce;t[76]!==ae||t[77]!==ie||t[78]!==re?(ce=n.jsxs(D.Header.Right,{children:[ae,ie,re]}),t[76]=ae,t[77]=ie,t[78]=re,t[79]=ce):ce=t[79];let de;t[80]!==se||t[81]!==ce?(de=n.jsxs(D.Header,{children:[se,ce]}),t[80]=se,t[81]=ce,t[82]=de):de=t[82];let me;t[83]!==M.messages||t[84]!==M.status||t[85]!==F||t[86]!==V||t[87]!==S?(me=n.jsx(D.Main,{children:V?n.jsx(D.EmptyState,{children:n.jsxs("div",{className:"flex flex-col items-center gap-6 w-full px-4",children:[n.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 p-0 text-center",children:[n.jsx(ft,{icon:S?.icon,name:S?.title||"deco chat",size:"lg",fallbackIcon:n.jsx(tt,{size:32}),className:"size-[60px]! rounded-[18px]!"}),n.jsx("h3",{className:"text-xl font-medium text-foreground",children:S?.title||"Ask deco chat"}),n.jsx("div",{className:"text-muted-foreground text-center text-sm max-w-md",children:S?.description??"Ask anything about configuring model providers or using MCP Mesh."})]}),S?.id&&n.jsx(nt,{fallback:null,children:n.jsx(N.Suspense,{fallback:n.jsx("div",{className:"flex justify-center",children:n.jsx(rn,{size:20,className:"animate-spin text-muted-foreground"})}),children:n.jsx(sn,{gatewayId:S.id,onSelect:P=>{F(P.description??P.name)}})})},S.id)]})}):n.jsx(D.Messages,{messages:M.messages,status:M.status,minHeightOffset:240})}),t[83]=M.messages,t[84]=M.status,t[85]=F,t[86]=V,t[87]=S,t[88]=me):me=t[88];let fe;t[89]!==M.error||t[90]!==F?(fe=()=>{M.error&&F(`I encountered this error: ${M.error.message}. Can you help me fix it?`)},t[89]=M.error,t[90]=F,t[91]=fe):fe=t[91];let ue;t[92]!==M.clearError||t[93]!==M.error||t[94]!==fe?(ue=n.jsx(D.ErrorBanner,{error:M.error,onFixInChat:fe,onDismiss:M.clearError}),t[92]=M.clearError,t[93]=M.error,t[94]=fe,t[95]=ue):ue=t[95];let he;t[96]!==F?(he=()=>{F("Please continue.")},t[96]=F,t[97]=he):he=t[97];let pe;t[98]!==M.clearFinishReason||t[99]!==M.finishReason||t[100]!==he?(pe=n.jsx(D.FinishReasonWarning,{finishReason:M.finishReason,onContinue:he,onDismiss:M.clearFinishReason}),t[98]=M.clearFinishReason,t[99]=M.finishReason,t[100]=he,t[101]=pe):pe=t[101];let xe;t[102]!==W||t[103]!==B||t[104]!==We||t[105]!==L?(xe=n.jsx(D.BranchPreview,{branchContext:W,clearBranchContext:B,onGoToOriginalMessage:We,setInputValue:L}),t[102]=W,t[103]=B,t[104]=We,t[105]=L,t[106]=xe):xe=t[106];let ge;t[107]!==F||t[108]!==U?(ge=async()=>{U.trim()&&await F(U.trim())},t[107]=F,t[108]=U,t[109]=ge):ge=t[109];const Ye=!y||!S?.id,Je=M.status==="submitted"||M.status==="streaming",Xe=y?"Ask anything or @ for context":"Select a model to start chatting",Qe=S?.id;let be;t[110]!==Ve||t[111]!==Qe?(be=n.jsx(Ps,{selectedGatewayId:Qe,onGatewayChange:Ve,placeholder:"Agent",variant:"borderless"}),t[110]=Ve,t[111]=Qe,t[112]=be):be=t[112];const et=y??void 0;let je;t[113]!==Fe||t[114]!==et?(je=n.jsx(Ds,{selectedModel:et,onModelChange:Fe,placeholder:"Model",variant:"borderless"}),t[113]=Fe,t[114]=et,t[115]=je):je=t[115];let ve;t[116]!==M.messages?(ve=n.jsx(Ls,{messages:M.messages}),t[116]=M.messages,t[117]=ve):ve=t[117];let Se;t[118]!==M.stop||t[119]!==U||t[120]!==L||t[121]!==ge||t[122]!==Ye||t[123]!==Je||t[124]!==Xe||t[125]!==be||t[126]!==je||t[127]!==ve?(Se=n.jsxs(D.Input,{value:U,onChange:L,onSubmit:ge,onStop:M.stop,disabled:Ye,isStreaming:Je,placeholder:Xe,children:[be,je,ve]}),t[118]=M.stop,t[119]=U,t[120]=L,t[121]=ge,t[122]=Ye,t[123]=Je,t[124]=Xe,t[125]=be,t[126]=je,t[127]=ve,t[128]=Se):Se=t[128];let Ne;t[129]!==ue||t[130]!==pe||t[131]!==xe||t[132]!==Se?(Ne=n.jsx(D.Footer,{children:n.jsxs("div",{className:"flex flex-col gap-2",children:[ue,pe,xe,Se]})}),t[129]=ue,t[130]=pe,t[131]=xe,t[132]=Se,t[133]=Ne):Ne=t[133];let Ee;return t[134]!==de||t[135]!==me||t[136]!==Ne?(Ee=n.jsxs(D,{children:[de,me,Ne]}),t[134]=de,t[135]=me,t[136]=Ne,t[137]=Ee):Ee=t[137],Ee}function Oa(t,e){return t.id===e.gatewayId}function Ta(t,e){return t.id===e.id&&t.connectionId===e.connectionId}function Aa(){const t=p.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(D.Provider,{children:n.jsx(Ma,{})}),t[0]=e):e=t[0],e}const Ea="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png";function bt({showSidebarToggle:t=!1,showOrgSwitcher:e=!1,showDecoChat:s=!1,disableDecoChat:a=!1}){const[o,i]=lt(),l=N.useRef(a);a&&o&&l.current!==a&&i(!1),l.current=a;const r=()=>{a||i(c=>!c)};return n.jsxs(De,{children:[t&&n.jsx(De.Sidebar,{children:n.jsx(Xt,{})}),n.jsx(De.Left,{children:e&&n.jsx(N.Suspense,{fallback:n.jsx(st.Skeleton,{}),children:n.jsx(st,{})})}),n.jsxs(De.Right,{className:"gap-2",children:[n.jsx(un,{}),s&&!a&&n.jsxs(Z,{size:"sm",variant:"default",onClick:r,className:"h-7",children:[n.jsx(Q,{url:Ea,fallback:"DC",size:"2xs",className:"rounded-sm"}),"deco chat"]}),n.jsx(Sa,{})]})]})}function Ra(t){const e=p.c(10),{children:s,className:a}=t,[,o]=N.useTransition();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Ue.decoChatPanelWidth(),e[0]=i):i=e[0];const[l,r]=at(i,30);let c;e[1]!==r?(c=h=>o(()=>r(h)),e[1]=r,e[2]=c):c=e[2];const d=c;let m;e[3]!==a?(m=O("min-w-0",a),e[3]=a,e[4]=m):m=e[4];let u;return e[5]!==l||e[6]!==s||e[7]!==d||e[8]!==m?(u=n.jsx(Ot,{defaultSize:l,minSize:20,className:m,onResize:d,children:s}),e[5]=l,e[6]=s,e[7]=d,e[8]=m,e[9]=u):u=e[9],u}function La(t){const e=p.c(5),{children:s}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=Ue.sidebarOpen(),e[0]=a):a=e[0];const[o,i]=at(a,!0);let l;return e[1]!==s||e[2]!==i||e[3]!==o?(l=n.jsx(kn,{open:o,onOpenChange:i,children:s}),e[1]=s,e[2]=i,e[3]=o,e[4]=l):l=e[4],l}function Pa(t){const e=p.c(10),{disableChat:s}=t,a=s===void 0?!1:s,[o]=lt(),i=o&&!a;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(Ot,{className:"bg-background",children:n.jsx(Nt,{})}),e[0]=l):l=e[0];let r;e[1]!==a||e[2]!==i?(r=!a&&n.jsx(on,{withHandle:i}),e[1]=a,e[2]=i,e[3]=r):r=e[3];const c=i?"max-w-none":"max-w-0";let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(nt,{children:n.jsx(N.Suspense,{fallback:n.jsx(an,{}),children:n.jsx(Aa,{})})}),e[4]=d):d=e[4];let m;e[5]!==c?(m=n.jsx(Ra,{className:c,children:d}),e[5]=c,e[6]=m):m=e[6];let u;return e[7]!==r||e[8]!==m?(u=n.jsxs(ln,{direction:"horizontal",children:[l,r,m]}),e[7]=r,e[8]=m,e[9]=u):u=e[9],u}function Da(){const t=p.c(22);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const{org:s}=vt(e),a=jt(),o=a.location.pathname===`/${s}`||a.location.pathname===`/${s}/`;let i;t[1]!==s?(i=xs.activeOrganization(s),t[1]=s,t[2]=i):i=t[2];let l;t[3]!==s?(l=async()=>{if(!s)return null;const{data:g}=await X.organization.setActive({organizationSlug:s});return{org:g,project:{slug:vs}}},t[3]=s,t[4]=l):l=t[4];let r;t[5]!==i||t[6]!==l?(r={queryKey:i,queryFn:l,gcTime:1/0,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1},t[5]=i,t[6]=l,t[7]=r):r=t[7];const{data:c}=ps(r);if(!c){let g;t[8]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(bt,{}),t[8]=g):g=t[8];let x;return t[9]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsxs("div",{className:"min-h-screen bg-background",children:[g,n.jsx("div",{className:"pt-12",children:n.jsx(Nt,{})})]}),t[9]=x):x=t[9],x}let d;t[10]!==o?(d=n.jsx(bt,{showSidebarToggle:!0,showOrgSwitcher:!0,showDecoChat:!0,disableDecoChat:o}),t[10]=o,t[11]=d):d=t[11];let m;t[12]===Symbol.for("react.memo_cache_sentinel")?(m={"--sidebar-width":"13rem","--sidebar-width-mobile":"11rem"},t[12]=m):m=t[12];let u;t[13]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Fn,{}),t[13]=u):u=t[13];let h;t[14]!==o?(h=n.jsxs(zn,{className:"flex-1 bg-sidebar",style:m,children:[u,n.jsx(On,{className:"pt-12",children:n.jsx(Pa,{disableChat:o})})]}),t[14]=o,t[15]=h):h=t[15];let b;t[16]!==d||t[17]!==h?(b=n.jsx(La,{children:n.jsxs("div",{className:"flex flex-col h-screen",children:[d,h]})}),t[16]=d,t[17]=h,t[18]=b):b=t[18];let f;return t[19]!==c||t[20]!==b?(f=n.jsx(js,{...c,children:b}),t[19]=c,t[20]=b,t[21]=f):f=t[21],f}function Ro(){const t=p.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(wa,{children:n.jsx(N.Suspense,{fallback:n.jsx(St,{}),children:n.jsx(Da,{})})}),t[0]=e):e=t[0],e}export{Ro as default};
@@ -1,72 +0,0 @@
1
- import{c as W,j as m,s as sa,d as ra,K as _t,t as Ze,E as na,F as oa,H as $,w as h,_ as Re,I as wt,J as ia,L as la,M as ca,Q as Z,U as be,V as Ee,v as M,W as x,X,Y as ua,Z as O,$ as da,a0 as pa,r as J,k as ma,p as fa,f as ha}from"./index-Dc4mPG7D.js";import{c as he,B as Me}from"./input-CLQFaB_P.js";import{u as Et,c as qe,b as Je,T as We,a as It}from"./project-context-provider-jIErvTKU.js";import{E as ga}from"./use-binding-C_WCv3Kw.js";import{l as va,m as ya,n as ba,o as xa}from"./index-DjBifmxL.js";import{u as _a}from"./localstorage-keys-Csxol0-8.js";import{u as wa}from"./use-gateway-DEBoqh3W.js";import{u as Ea}from"./use-gateway-system-prompt-B0FWJC8i.js";import{P as St,a as Nt,b as Tt}from"./popover-Bt6Irkfs.js";import{a as Ia,E as Sa}from"./use-connection-D1oWmd80.js";import{O as Na,a as Ta,g as Aa}from"./well-known-mcp-7PcWXInp.js";import{g as Ca}from"./generate-id-Dyweu44Y.js";import{s as Xe}from"./Clock-C2L66fjj.js";import{i as Ra}from"./SearchMd-CGgWiIHk.js";import{s as Ma}from"./Trash01-Nn4emH5w.js";function Jr(){const t=W.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=m.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=m.jsxs("div",{className:"flex items-center gap-3",children:[e,m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),m.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=m.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:m.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[a,m.jsxs("div",{className:"flex items-end gap-2",children:[m.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),m.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=m.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:m.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[m.jsx(Te,{align:"right",width:"w-3/4"}),m.jsx(Te,{align:"left",width:"w-full",lines:3}),m.jsx(Te,{align:"right",width:"w-2/3"}),m.jsx(Te,{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=m.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:m.jsx("div",{className:"relative flex-1",children:m.jsxs("div",{className:"space-y-2 p-2",children:[m.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),m.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=m.jsx("div",{className:"flex items-center gap-1",children:m.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=m.jsxs("div",{className:"flex h-full w-full flex-col bg-sidebar",children:[s,r,m.jsx("div",{className:"px-4 py-4",children:m.jsx("div",{className:"mx-auto w-full max-w-2xl",children:m.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl border border-border bg-background shadow-sm",children:[n,m.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[i,m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),m.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})})]}),t[6]=o):o=t[6],o}function Te(t){const e=W.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=he("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 p;e[2]!==l?(p=he("flex min-w-0 flex-col gap-2",l),e[2]=l,e[3]=p):p=e[3];let u;e[4]===Symbol.for("react.memo_cache_sentinel")?(u=m.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=u):u=e[4];const g=a==="right"?"bg-muted":"bg-transparent border border-border/40";let f;e[5]!==g||e[6]!==n?(f=he("min-w-0 rounded-2xl p-4",g,n),e[5]=g,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 b;e[10]!==i||e[11]!==v?(b=m.jsx("div",{className:"space-y-2",children:v.map((d,T)=>m.jsx("div",{className:he("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]=b):b=e[12];let y;e[13]!==b||e[14]!==f?(y=m.jsx("div",{className:f,children:b}),e[13]=b,e[14]=f,e[15]=y):y=e[15];let _;e[16]!==y||e[17]!==p?(_=m.jsxs("div",{className:p,children:[u,y]}),e[16]=y,e[17]=p,e[18]=_):_=e[18];let N;return e[19]!==_||e[20]!==c?(N=m.jsx("div",{className:c,children:_}),e[19]=_,e[20]=c,e[21]=N):N=e[21],N}var xe;(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})(xe||(xe={}));var Ke;(function(t){t.mergeShapes=(e,a)=>({...e,...a})})(Ke||(Ke={}));xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);xe.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 Oe 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 Oe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,xe.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()}}Oe.create=t=>new Oe(t);var et;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(et||(et={}));var w;(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"})(w||(w={}));function Wr(){const t=W.c(5),e=sa(),{org:a}=Et();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},t[0]=s):s=t[0];const r=ra(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],p=r.connectionId;if(!p)return;e.invalidateQueries({queryKey:_t.collection(a.slug,p,l)});const u=l.toLowerCase().replace(/_/g," ");Ze.success(`${u} updated`)},t[1]=a,t[2]=r,t[3]=e,t[4]=n):n=t[4],n}var At="vercel.ai.error",Oa=Symbol.for(At),tt,at,ae=class Ct extends(at=Error,tt=Oa,at){constructor({name:e,message:a,cause:s}){super(a),this[tt]=!0,this.name=e,this.cause=s}static isInstance(e){return Ct.hasMarker(e,At)}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 Rt(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Mt="AI_InvalidArgumentError",Ot=`vercel.ai.error.${Mt}`,ja=Symbol.for(Ot),st,rt,Pa=class extends(rt=ae,st=ja,rt){constructor({message:t,cause:e,argument:a}){super({name:Mt,message:t,cause:e}),this[st]=!0,this.argument=a}static isInstance(t){return ae.hasMarker(t,Ot)}},jt="AI_JSONParseError",Pt=`vercel.ai.error.${jt}`,Da=Symbol.for(Pt),nt,ot,it=class extends(ot=ae,nt=Da,ot){constructor({text:t,cause:e}){super({name:jt,message:`JSON parsing failed: Text: ${t}.
2
- Error message: ${Rt(e)}`,cause:e}),this[nt]=!0,this.text=t}static isInstance(t){return ae.hasMarker(t,Pt)}},Dt="AI_TypeValidationError",kt=`vercel.ai.error.${Dt}`,ka=Symbol.for(kt),lt,ct,me=class $e extends(ct=ae,lt=ka,ct){constructor({value:e,cause:a}){super({name:Dt,message:`Type validation failed: Value: ${JSON.stringify(e)}.
3
- Error message: ${Rt(a)}`,cause:a}),this[lt]=!0,this.value=e}static isInstance(e){return ae.hasMarker(e,kt)}static wrap({value:e,cause:a}){return $e.isInstance(a)&&a.value===e?a:new $e({value:e,cause:a})}},Ie=({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 Pa({argument:"separator",message:`The separator "${s}" must not be part of the alphabet "${a}".`});return()=>`${t}${s}${r()}`},Za=Ie();function ut(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 ne(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 dt(t,...e){const a=new Headers(ne(t)),s=a.get("user-agent")||"";return a.set("user-agent",[s,...e].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var $a=/"__proto__"\s*:/,La=/"constructor"\s*:/;function pt(t){const e=JSON.parse(t);return e===null||typeof e!="object"||$a.test(t)===!1&&La.test(t)===!1?e:Ua(e)}function Ua(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 Fa(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return pt(t)}try{return pt(t)}finally{Error.stackTraceLimit=e}}function Ye(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]=re(a[s])}t.items!=null&&(t.items=Array.isArray(t.items)?t.items.map(re):re(t.items)),t.anyOf!=null&&(t.anyOf=t.anyOf.map(re)),t.allOf!=null&&(t.allOf=t.allOf.map(re)),t.oneOf!=null&&(t.oneOf=t.oneOf.map(re));const{definitions:e}=t;if(e!=null)for(const a of Object.keys(e))e[a]=re(e[a]);return t}function re(t){return typeof t=="boolean"?t:Ye(t)}var Ba=Symbol("Let zodToJsonSchema decide on which parser to use"),mt={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"},za=t=>typeof t=="string"?{...mt,name:t}:{...mt,...t};function F(){return{}}function Va(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)!==w.ZodAny&&(n.items=R(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 qa(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 Ja(){return{type:"boolean"}}function Zt(t,e){return R(t.type._def,e)}var Wa=(t,e)=>R(t.innerType._def,e);function $t(t,e,a){const s=a??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>$t(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 Ya(t)}}var Ya=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 Ga(t,e){return{...R(t.innerType._def,e),default:t.defaultValue()}}function Ha(t,e){return e.effectStrategy==="input"?R(t.schema._def,e):F()}function Qa(t){return{type:"string",enum:Array.from(t.values)}}var Xa=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Ka(t,e){const a=[R(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),R(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(r=>!!r),s=[];return a.forEach(r=>{if(Xa(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 es(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 Pe=void 0,V={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:()=>(Pe===void 0&&(Pe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Pe),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 Lt(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":q(a,"email",s.message,e);break;case"format:idn-email":q(a,"idn-email",s.message,e);break;case"pattern:zod":k(a,V.email,s.message,e);break}break;case"url":q(a,"uri",s.message,e);break;case"uuid":q(a,"uuid",s.message,e);break;case"regex":k(a,s.regex,s.message,e);break;case"cuid":k(a,V.cuid,s.message,e);break;case"cuid2":k(a,V.cuid2,s.message,e);break;case"startsWith":k(a,RegExp(`^${De(s.value,e)}`),s.message,e);break;case"endsWith":k(a,RegExp(`${De(s.value,e)}$`),s.message,e);break;case"datetime":q(a,"date-time",s.message,e);break;case"date":q(a,"date",s.message,e);break;case"time":q(a,"time",s.message,e);break;case"duration":q(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":{k(a,RegExp(De(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&q(a,"ipv4",s.message,e),s.version!=="v4"&&q(a,"ipv6",s.message,e);break}case"base64url":k(a,V.base64url,s.message,e);break;case"jwt":k(a,V.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&k(a,V.ipv4Cidr,s.message,e),s.version!=="v4"&&k(a,V.ipv6Cidr,s.message,e);break}case"emoji":k(a,V.emoji(),s.message,e);break;case"ulid":{k(a,V.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{q(a,"binary",s.message,e);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{k(a,V.base64,s.message,e);break}}break}case"nanoid":k(a,V.nanoid,s.message,e)}return a}function De(t,e){return e.patternStrategy==="escape"?as(t):t}var ts=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function as(t){let e="";for(let a=0;a<t.length;a++)ts.has(t[a])||(e+="\\"),e+=t[a];return e}function q(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 k(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:ft(e,s),...a&&s.errorMessages&&{errorMessage:{pattern:a}}})):t.pattern=ft(e,s)}function ft(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 Ut(t,e){var a,s,r,n,i,o;const c={type:"object",additionalProperties:(a=R(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?a:e.allowedAdditionalProperties};if(((s=t.keyType)==null?void 0:s._def.typeName)===w.ZodString&&((r=t.keyType._def.checks)!=null&&r.length)){const{type:l,...p}=Lt(t.keyType._def,e);return{...c,propertyNames:p}}else{if(((n=t.keyType)==null?void 0:n._def.typeName)===w.ZodEnum)return{...c,propertyNames:{enum:t.keyType._def.values}};if(((i=t.keyType)==null?void 0:i._def.typeName)===w.ZodBranded&&t.keyType._def.type._def.typeName===w.ZodString&&((o=t.keyType._def.type._def.checks)!=null&&o.length)){const{type:l,...p}=Zt(t.keyType._def,e);return{...c,propertyNames:p}}}return c}function ss(t,e){if(e.mapStrategy==="record")return Ut(t,e);const a=R(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||F(),s=R(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||F();return{type:"array",maxItems:125,items:{type:"array",items:[a,s],minItems:2,maxItems:2}}}function rs(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 ns(){return{not:F()}}function os(){return{type:"null"}}var Le={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 Le&&(!s._def.checks||!s._def.checks.length))){const s=a.reduce((r,n)=>{const i=Le[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 ls(t,e)}var ls=(t,e)=>{const a=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((s,r)=>R(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 cs(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[Le[t.innerType._def.typeName],"null"]};const a=R(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function us(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 ds(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=ms(o),l=R(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=ps(t,e);return n!==void 0&&(a.additionalProperties=n),a}function ps(t,e){if(t.catchall._def.typeName!=="ZodNever")return R(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 ms(t){try{return t.isOptional()}catch{return!0}}var fs=(t,e)=>{var a;if(e.currentPath.toString()===((a=e.propertyPath)==null?void 0:a.toString()))return R(t.innerType._def,e);const s=R(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return s?{anyOf:[{not:F()},s]}:F()},hs=(t,e)=>{if(e.pipeStrategy==="input")return R(t.in._def,e);if(e.pipeStrategy==="output")return R(t.out._def,e);const a=R(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=R(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,s].filter(r=>r!==void 0)}};function gs(t,e){return R(t.type._def,e)}function vs(t,e){const s={type:"array",uniqueItems:!0,items:R(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 ys(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((a,s)=>R(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[]),additionalItems:R(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((a,s)=>R(a._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((a,s)=>s===void 0?a:[...a,s],[])}}function bs(){return{not:F()}}function xs(){return F()}var _s=(t,e)=>R(t.innerType._def,e),ws=(t,e,a)=>{switch(e){case w.ZodString:return Lt(t,a);case w.ZodNumber:return us(t);case w.ZodObject:return ds(t,a);case w.ZodBigInt:return qa(t);case w.ZodBoolean:return Ja();case w.ZodDate:return $t(t,a);case w.ZodUndefined:return bs();case w.ZodNull:return os();case w.ZodArray:return Va(t,a);case w.ZodUnion:case w.ZodDiscriminatedUnion:return is(t,a);case w.ZodIntersection:return Ka(t,a);case w.ZodTuple:return ys(t,a);case w.ZodRecord:return Ut(t,a);case w.ZodLiteral:return es(t);case w.ZodEnum:return Qa(t);case w.ZodNativeEnum:return rs(t);case w.ZodNullable:return cs(t,a);case w.ZodOptional:return fs(t,a);case w.ZodMap:return ss(t,a);case w.ZodSet:return vs(t,a);case w.ZodLazy:return()=>t.getter()._def;case w.ZodPromise:return gs(t,a);case w.ZodNaN:case w.ZodNever:return ns();case w.ZodEffects:return Ha(t,a);case w.ZodAny:return F();case w.ZodUnknown:return xs();case w.ZodDefault:return Ga(t,a);case w.ZodBranded:return Zt(t,a);case w.ZodReadonly:return _s(t,a);case w.ZodCatch:return Wa(t,a);case w.ZodPipeline:return hs(t,a);case w.ZodFunction:case w.ZodVoid:case w.ZodSymbol:return;default:return(s=>{})()}},Es=(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 R(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!==Ba)return c}if(r&&!a){const c=Is(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=ws(t,t.typeName,e),o=typeof i=="function"?R(i(),e):i;if(o&&Ss(t,e,o),e.postProcess){const c=e.postProcess(o,t,e);return n.jsonSchema=o,c}return n.jsonSchema=o,o}var Is=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Es(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`),F()):e.$refStrategy==="seen"?F():void 0}},Ss=(t,e,a)=>(t.description&&(a.description=t.description),a),Ns=t=>{const e=za(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}]))}},Ts=(t,e)=>{var a;const s=Ns(e);let r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[p,u])=>{var g;return{...l,[p]:(g=R(u._def,{...s,currentPath:[...s.basePath,s.definitionPath,p]},!0))!=null?g:F()}},{}):void 0;const n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=(a=R(t._def,n===void 0?s:{...s,currentPath:[...s.basePath,s.definitionPath,n]},!1))!=null?a:F(),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},Ue=Symbol.for("vercel.ai.schema");function As(t){let e;return()=>(e==null&&(e=t()),e)}function je(t,{validate:e}={}){return{[Ue]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function Cs(t){return typeof t=="object"&&t!==null&&Ue in t&&t[Ue]===!0&&"jsonSchema"in t&&"validate"in t}function Ge(t){return t==null?je({properties:{},additionalProperties:!1}):Cs(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?Ft(t):Rs(t):t()}function Rs(t){return je(()=>Ye(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 me({value:e,cause:a.issues})}}})}function Ms(t,e){var a;const s=(a=void 0)!=null?a:!1;return je(()=>Ts(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 Os(t,e){var a;const s=(a=void 0)!=null?a:!1;return je(()=>Ye(oa(t,{target:"draft-7",io:"input",reused:s?"ref":"inline"})),{validate:async r=>{const n=await na(t,r);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function js(t){return"_zod"in t}function Ft(t,e){return js(t)?Os(t):Ms(t)}async function ht({value:t,schema:e}){const a=await _e({value:t,schema:e});if(!a.success)throw me.wrap({value:t,cause:a.error});return a.value}async function _e({value:t,schema:e}){const a=Ge(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:me.wrap({value:t,cause:s.error}),rawValue:t}}catch(s){return{success:!1,error:me.wrap({value:t,cause:s}),rawValue:t}}}async function oe({text:t,schema:e}){try{const a=Fa(t);return e==null?{success:!0,value:a,rawValue:a}:await _e({value:a,schema:e})}catch(a){return{success:!1,error:it.isInstance(a)?a:new it({text:t,cause:a}),rawValue:void 0}}}function Ps({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new ga).pipeThrough(new TransformStream({async transform({data:a},s){a!=="[DONE]"&&s.enqueue(await oe({text:a,schema:e}))}}))}async function ee(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var Ds=Object.defineProperty,ks=(t,e)=>{for(var a in e)Ds(t,a,{get:e[a],enumerable:!0})},Bt="AI_NoObjectGeneratedError",zt=`vercel.ai.error.${Bt}`,Zs=Symbol.for(zt),Vt,te=class extends ae{constructor({message:t="No object generated.",cause:e,text:a,response:s,usage:r,finishReason:n}){super({name:Bt,message:t,cause:e}),this[Vt]=!0,this.text=a,this.response=s,this.usage=r,this.finishReason=n}static isInstance(t){return ae.hasMarker(t,zt)}};Vt=Zs;var gt="6.0.33",qt=$([h(),Re(Uint8Array),Re(ArrayBuffer),wt(t=>{var e,a;return(a=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?a:!1},{message:"Must be a Buffer"})]),we=ia(()=>$([la(),h(),ca(),Z(),be(h(),we.optional()),Ee(we)])),S=be(h(),be(h(),we.optional())),Jt=M({type:x("text"),text:h(),providerOptions:S.optional()}),$s=M({type:x("image"),image:$([qt,Re(URL)]),mediaType:h().optional(),providerOptions:S.optional()}),Wt=M({type:x("file"),data:$([qt,Re(URL)]),filename:h().optional(),mediaType:h(),providerOptions:S.optional()}),Ls=M({type:x("reasoning"),text:h(),providerOptions:S.optional()}),Us=M({type:x("tool-call"),toolCallId:h(),toolName:h(),input:X(),providerOptions:S.optional(),providerExecuted:Z().optional()}),Fs=ua("type",[M({type:x("text"),value:h(),providerOptions:S.optional()}),M({type:x("json"),value:we,providerOptions:S.optional()}),M({type:x("execution-denied"),reason:h().optional(),providerOptions:S.optional()}),M({type:x("error-text"),value:h(),providerOptions:S.optional()}),M({type:x("error-json"),value:we,providerOptions:S.optional()}),M({type:x("content"),value:Ee($([M({type:x("text"),text:h(),providerOptions:S.optional()}),M({type:x("media"),data:h(),mediaType:h()}),M({type:x("file-data"),data:h(),mediaType:h(),filename:h().optional(),providerOptions:S.optional()}),M({type:x("file-url"),url:h(),providerOptions:S.optional()}),M({type:x("file-id"),fileId:$([h(),be(h(),h())]),providerOptions:S.optional()}),M({type:x("image-data"),data:h(),mediaType:h(),providerOptions:S.optional()}),M({type:x("image-url"),url:h(),providerOptions:S.optional()}),M({type:x("image-file-id"),fileId:$([h(),be(h(),h())]),providerOptions:S.optional()}),M({type:x("custom"),providerOptions:S.optional()})]))})]),Yt=M({type:x("tool-result"),toolCallId:h(),toolName:h(),output:Fs,providerOptions:S.optional()}),Bs=M({type:x("tool-approval-request"),approvalId:h(),toolCallId:h()}),zs=M({type:x("tool-approval-response"),approvalId:h(),approved:Z(),reason:h().optional()}),Vs=M({role:x("system"),content:h(),providerOptions:S.optional()}),qs=M({role:x("user"),content:$([h(),Ee($([Jt,$s,Wt]))]),providerOptions:S.optional()}),Js=M({role:x("assistant"),content:$([h(),Ee($([Jt,Wt,Ls,Us,Yt,Bs]))]),providerOptions:S.optional()}),Ws=M({role:x("tool"),content:Ee($([Yt,zs])),providerOptions:S.optional()});$([Vs,qs,Js,Ws]);function Gt(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]=Gt(n,r):a[s]=r}return a}var Ys={};ks(Ys,{array:()=>Xs,choice:()=>Ks,json:()=>er,object:()=>Qs,text:()=>Hs});function Gs(t){const e=["ROOT"];let a=-1,s=null;function r(c,l,p){switch(c){case'"':{a=l,e.pop(),e.push(p),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{a=l,s=l,e.pop(),e.push(p),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(p),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(p),e.push("INSIDE_NUMBER");break}case"{":{a=l,e.pop(),e.push(p),e.push("INSIDE_OBJECT_START");break}case"[":{a=l,e.pop(),e.push(p),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 u=t.substring(s,c+1);!"false".startsWith(u)&&!"true".startsWith(u)&&!"null".startsWith(u)?(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 p=t.substring(s,t.length);"true".startsWith(p)?o+="true".slice(p.length):"false".startsWith(p)?o+="false".slice(p.length):"null".startsWith(p)&&(o+="null".slice(p.length))}}return o}async function Se(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await oe({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await oe({text:Gs(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var Hs=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}},createElementStreamTransform(){}}),Qs=({schema:t,name:e,description:a})=>{const s=Ge(t);return{name:"object",responseFormat:ee(s.jsonSchema).then(r=>({type:"json",schema:r,...e!=null&&{name:e},...a!=null&&{description:a}})),async parseCompleteOutput({text:r},n){const i=await oe({text:r});if(!i.success)throw new te({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 _e({value:i.value,schema:s});if(!o.success)throw new te({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 Se(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:n.value}}},createElementStreamTransform(){}}},Xs=({element:t,name:e,description:a})=>{const s=Ge(t);return{name:"array",responseFormat:ee(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 oe({text:r});if(!i.success)throw new te({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 te({message:"No object generated: response did not match schema.",cause:new me({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 _e({value:c,schema:s});if(!l.success)throw new te({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 Se(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 p=await _e({value:l,schema:s});p.success&&c.push(p.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])}})}}},Ks=({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 oe({text:s});if(!n.success)throw new te({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 te({message:"No object generated: response did not match schema.",cause:new me({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 Se(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(){}}),er=({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 oe({text:a});if(!r.success)throw new te({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 Se(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(){}});Ie({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 tr=As(()=>Ft($([O({type:x("text-start"),id:h(),providerMetadata:S.optional()}),O({type:x("text-delta"),id:h(),delta:h(),providerMetadata:S.optional()}),O({type:x("text-end"),id:h(),providerMetadata:S.optional()}),O({type:x("error"),errorText:h()}),O({type:x("tool-input-start"),toolCallId:h(),toolName:h(),providerExecuted:Z().optional(),dynamic:Z().optional(),title:h().optional()}),O({type:x("tool-input-delta"),toolCallId:h(),inputTextDelta:h()}),O({type:x("tool-input-available"),toolCallId:h(),toolName:h(),input:X(),providerExecuted:Z().optional(),providerMetadata:S.optional(),dynamic:Z().optional(),title:h().optional()}),O({type:x("tool-input-error"),toolCallId:h(),toolName:h(),input:X(),providerExecuted:Z().optional(),providerMetadata:S.optional(),dynamic:Z().optional(),errorText:h(),title:h().optional()}),O({type:x("tool-approval-request"),approvalId:h(),toolCallId:h()}),O({type:x("tool-output-available"),toolCallId:h(),output:X(),providerExecuted:Z().optional(),dynamic:Z().optional(),preliminary:Z().optional()}),O({type:x("tool-output-error"),toolCallId:h(),errorText:h(),providerExecuted:Z().optional(),dynamic:Z().optional()}),O({type:x("tool-output-denied"),toolCallId:h()}),O({type:x("reasoning-start"),id:h(),providerMetadata:S.optional()}),O({type:x("reasoning-delta"),id:h(),delta:h(),providerMetadata:S.optional()}),O({type:x("reasoning-end"),id:h(),providerMetadata:S.optional()}),O({type:x("source-url"),sourceId:h(),url:h(),title:h().optional(),providerMetadata:S.optional()}),O({type:x("source-document"),sourceId:h(),mediaType:h(),title:h(),filename:h().optional(),providerMetadata:S.optional()}),O({type:x("file"),url:h(),mediaType:h(),providerMetadata:S.optional()}),O({type:wt(t=>typeof t=="string"&&t.startsWith("data-"),{message:'Type must start with "data-"'}),id:h().optional(),data:X(),transient:Z().optional()}),O({type:x("start-step")}),O({type:x("finish-step")}),O({type:x("start"),messageId:h().optional(),messageMetadata:X().optional()}),O({type:x("finish"),finishReason:da(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:X().optional()}),O({type:x("abort"),reason:h().optional()}),O({type:x("message-metadata"),messageMetadata:X()})])));function ar(t){return t.type.startsWith("data-")}function Fe(t){return t.type.startsWith("tool-")}function sr(t){return t.type==="dynamic-tool"}function Be(t){return Fe(t)||sr(t)}function vt(t){return t.type.split("-").slice(1).join("-")}function rr({lastMessage:t,messageId:e}){return{message:t?.role==="assistant"?t:{id:e,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function nr({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:p})=>{var u,g,f,v;function b(d){const A=l.message.parts.filter(Be).find(E=>E.toolCallId===d);if(A==null)throw new Error(`no tool invocation found for tool call ${d}`);return A}function y(d){var T;const A=l.message.parts.find(P=>Fe(P)&&P.toolCallId===d.toolCallId),E=d,I=A;A!=null?(A.state=d.state,I.input=E.input,I.output=E.output,I.errorText=E.errorText,I.rawInput=E.rawInput,I.preliminary=E.preliminary,d.title!==void 0&&(I.title=d.title),I.providerExecuted=(T=E.providerExecuted)!=null?T:A.providerExecuted,E.providerMetadata!=null&&A.state==="input-available"&&(A.callProviderMetadata=E.providerMetadata)):l.message.parts.push({type:`tool-${d.toolName}`,toolCallId:d.toolCallId,state:d.state,title:d.title,input:E.input,output:E.output,rawInput:E.rawInput,errorText:E.errorText,providerExecuted:E.providerExecuted,preliminary:E.preliminary,...E.providerMetadata!=null?{callProviderMetadata:E.providerMetadata}:{}})}function _(d){var T,A;const E=l.message.parts.find(L=>L.type==="dynamic-tool"&&L.toolCallId===d.toolCallId),I=d,P=E;E!=null?(E.state=d.state,P.toolName=d.toolName,P.input=I.input,P.output=I.output,P.errorText=I.errorText,P.rawInput=(T=I.rawInput)!=null?T:P.rawInput,P.preliminary=I.preliminary,d.title!==void 0&&(P.title=d.title),P.providerExecuted=(A=I.providerExecuted)!=null?A:E.providerExecuted,I.providerMetadata!=null&&E.state==="input-available"&&(E.callProviderMetadata=I.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:d.toolName,toolCallId:d.toolCallId,state:d.state,input:I.input,output:I.output,errorText:I.errorText,preliminary:I.preliminary,providerExecuted:I.providerExecuted,title:d.title,...I.providerMetadata!=null?{callProviderMetadata:I.providerMetadata}:{}})}async function N(d){if(d!=null){const T=l.message.metadata!=null?Gt(l.message.metadata,d):d;e!=null&&await ht({value:T,schema:e}),l.message.metadata=T}}switch(o.type){case"text-start":{const d={type:"text",text:"",providerMetadata:o.providerMetadata,state:"streaming"};l.activeTextParts[o.id]=d,l.message.parts.push(d),p();break}case"text-delta":{const d=l.activeTextParts[o.id];d.text+=o.delta,d.providerMetadata=(u=o.providerMetadata)!=null?u:d.providerMetadata,p();break}case"text-end":{const d=l.activeTextParts[o.id];d.state="done",d.providerMetadata=(g=o.providerMetadata)!=null?g:d.providerMetadata,delete l.activeTextParts[o.id],p();break}case"reasoning-start":{const d={type:"reasoning",text:"",providerMetadata:o.providerMetadata,state:"streaming"};l.activeReasoningParts[o.id]=d,l.message.parts.push(d),p();break}case"reasoning-delta":{const d=l.activeReasoningParts[o.id];d.text+=o.delta,d.providerMetadata=(f=o.providerMetadata)!=null?f:d.providerMetadata,p();break}case"reasoning-end":{const d=l.activeReasoningParts[o.id];d.providerMetadata=(v=o.providerMetadata)!=null?v:d.providerMetadata,d.state="done",delete l.activeReasoningParts[o.id],p();break}case"file":{l.message.parts.push({type:"file",mediaType:o.mediaType,url:o.url}),p();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:o.sourceId,url:o.url,title:o.title,providerMetadata:o.providerMetadata}),p();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}),p();break}case"tool-input-start":{const d=l.message.parts.filter(Fe);l.partialToolCalls[o.toolCallId]={text:"",toolName:o.toolName,index:d.length,dynamic:o.dynamic,title:o.title},o.dynamic?_({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-streaming",input:void 0,providerExecuted:o.providerExecuted,title:o.title}):y({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-streaming",input:void 0,providerExecuted:o.providerExecuted,title:o.title}),p();break}case"tool-input-delta":{const d=l.partialToolCalls[o.toolCallId];d.text+=o.inputTextDelta;const{value:T}=await Se(d.text);d.dynamic?_({toolCallId:o.toolCallId,toolName:d.toolName,state:"input-streaming",input:T,title:d.title}):y({toolCallId:o.toolCallId,toolName:d.toolName,state:"input-streaming",input:T,title:d.title}),p();break}case"tool-input-available":{o.dynamic?_({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-available",input:o.input,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata,title:o.title}):y({toolCallId:o.toolCallId,toolName:o.toolName,state:"input-available",input:o.input,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata,title:o.title}),p(),n&&!o.providerExecuted&&await n({toolCall:o});break}case"tool-input-error":{o.dynamic?_({toolCallId:o.toolCallId,toolName:o.toolName,state:"output-error",input:o.input,errorText:o.errorText,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata}):y({toolCallId:o.toolCallId,toolName:o.toolName,state:"output-error",input:void 0,rawInput:o.input,errorText:o.errorText,providerExecuted:o.providerExecuted,providerMetadata:o.providerMetadata}),p();break}case"tool-approval-request":{const d=b(o.toolCallId);d.state="approval-requested",d.approval={id:o.approvalId},p();break}case"tool-output-denied":{const d=b(o.toolCallId);d.state="output-denied",p();break}case"tool-output-available":{const d=b(o.toolCallId);d.type==="dynamic-tool"?_({toolCallId:o.toolCallId,toolName:d.toolName,state:"output-available",input:d.input,output:o.output,preliminary:o.preliminary,providerExecuted:o.providerExecuted,title:d.title}):y({toolCallId:o.toolCallId,toolName:vt(d),state:"output-available",input:d.input,output:o.output,providerExecuted:o.providerExecuted,preliminary:o.preliminary,title:d.title}),p();break}case"tool-output-error":{const d=b(o.toolCallId);d.type==="dynamic-tool"?_({toolCallId:o.toolCallId,toolName:d.toolName,state:"output-error",input:d.input,errorText:o.errorText,providerExecuted:o.providerExecuted,title:d.title}):y({toolCallId:o.toolCallId,toolName:vt(d),state:"output-error",input:d.input,rawInput:d.rawInput,errorText:o.errorText,providerExecuted:o.providerExecuted,title:d.title}),p();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 N(o.messageMetadata),(o.messageId!=null||o.messageMetadata!=null)&&p();break}case"finish":{o.finishReason!=null&&(l.finishReason=o.finishReason),await N(o.messageMetadata),o.messageMetadata!=null&&p();break}case"message-metadata":{await N(o.messageMetadata),o.messageMetadata!=null&&p();break}case"error":{r?.(new Error(o.errorText));break}default:if(ar(o)){a?.[o.type]!=null&&await ht({value:o.data,schema:a[o.type]});const d=o;if(d.transient){i?.(d);break}const T=d.id!=null?l.message.parts.find(A=>d.type===A.type&&d.id===A.id):void 0;T!=null?T.data=d.data:l.message.parts.push(d),i?.(d),p()}}c.enqueue(o)})}}))}async function or({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()}}Ie({prefix:"aitxt",size:24});Ie({prefix:"aiobj",size:24});var ir=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()})}};Ie({prefix:"aiobj",size:24});async function lr(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 cr=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 ee(this.body),c=await ee(this.headers),l=await ee(this.credentials),p={...ne(c),...ne(e.headers)},u=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:e.chatId,messages:e.messages,body:{...o,...e.body},headers:p,credentials:l,requestMetadata:e.metadata,trigger:e.trigger,messageId:e.messageId})),g=(s=u?.api)!=null?s:this.api,f=u?.headers!==void 0?ne(u.headers):p,v=u?.body!==void 0?u.body:{...o,...e.body,id:e.chatId,messages:e.messages,trigger:e.trigger,messageId:e.messageId},b=(r=u?.credentials)!=null?r:l,_=await((n=this.fetch)!=null?n:globalThis.fetch)(g,{method:"POST",headers:dt({"Content-Type":"application/json",...f},`ai-sdk/${gt}`,ut()),body:JSON.stringify(v),credentials:b,signal:t});if(!_.ok)throw new Error((i=await _.text())!=null?i:"Failed to fetch the chat response.");if(!_.body)throw new Error("The response body is empty.");return this.processResponseStream(_.body)}async reconnectToStream(t){var e,a,s,r,n;const i=await ee(this.body),o=await ee(this.headers),c=await ee(this.credentials),l={...ne(o),...ne(t.headers)},p=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})),u=(a=p?.api)!=null?a:`${this.api}/${t.chatId}/stream`,g=p?.headers!==void 0?ne(p.headers):l,f=(s=p?.credentials)!=null?s:c,b=await((r=this.fetch)!=null?r:globalThis.fetch)(u,{method:"GET",headers:dt(g,`ai-sdk/${gt}`,ut()),credentials:f});if(b.status===204)return null;if(!b.ok)throw new Error((n=await b.text())!=null?n:"Failed to fetch the chat response.");if(!b.body)throw new Error("The response body is empty.");return this.processResponseStream(b.body)}},Ht=class extends cr{constructor(t={}){super(t)}processResponseStream(t){return Ps({stream:t,schema:tr}).pipeThrough(new TransformStream({async transform(e,a){if(!e.success)throw e.error;a.enqueue(e.value)}}))}},ur=class{constructor({generateId:t=Za,id:e=t(),transport:a=new Ht,messageMetadataSchema:s,dataPartSchemas:r,state:n,onError:i,onToolCall:o,onFinish:c,onData:l,sendAutomaticallyWhen:p}){this.activeResponse=void 0,this.jobExecutor=new ir,this.sendMessage=async(u,g)=>{var f,v,b,y;if(u==null){await this.makeRequest({trigger:"submit-message",messageId:(f=this.lastMessage)==null?void 0:f.id,...g});return}let _;if("text"in u||"files"in u?_={parts:[...Array.isArray(u.files)?u.files:await lr(u.files),..."text"in u&&u.text!=null?[{type:"text",text:u.text}]:[]]}:_=u,u.messageId!=null){const N=this.state.messages.findIndex(d=>d.id===u.messageId);if(N===-1)throw new Error(`message with id ${u.messageId} not found`);if(this.state.messages[N].role!=="user")throw new Error(`message with id ${u.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,N+1),this.state.replaceMessage(N,{..._,id:u.messageId,role:(v=_.role)!=null?v:"user",metadata:u.metadata})}else this.state.pushMessage({..._,id:(b=_.id)!=null?b:this.generateId(),role:(y=_.role)!=null?y:"user",metadata:u.metadata});await this.makeRequest({trigger:"submit-message",messageId:u.messageId,...g})},this.regenerate=async({messageId:u,...g}={})=>{const f=u==null?this.state.messages.length-1:this.state.messages.findIndex(v=>v.id===u);if(f===-1)throw new Error(`message ${u} 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:u,...g})},this.resumeStream=async(u={})=>{await this.makeRequest({trigger:"resume-stream",...u})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:u,approved:g,reason:f})=>this.jobExecutor.run(async()=>{var v,b;const y=this.state.messages,_=y[y.length-1],N=d=>Be(d)&&d.state==="approval-requested"&&d.approval.id===u?{...d,state:"approval-responded",approval:{id:u,approved:g,reason:f}}:d;this.state.replaceMessage(y.length-1,{..._,parts:_.parts.map(N)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(N)),this.status!=="streaming"&&this.status!=="submitted"&&((v=this.sendAutomaticallyWhen)!=null&&v.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(b=this.lastMessage)==null?void 0:b.id})}),this.addToolOutput=async({state:u="output-available",tool:g,toolCallId:f,output:v,errorText:b})=>this.jobExecutor.run(async()=>{var y,_;const N=this.state.messages,d=N[N.length-1],T=A=>Be(A)&&A.toolCallId===f?{...A,state:u,output:v,errorText:b}:A;this.state.replaceMessage(N.length-1,{...d,parts:d.parts.map(T)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(T)),this.status!=="streaming"&&this.status!=="submitted"&&((y=this.sendAutomaticallyWhen)!=null&&y.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(_=this.lastMessage)==null?void 0:_.id})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var u;this.status!=="streaming"&&this.status!=="submitted"||(u=this.activeResponse)!=null&&u.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=p}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 p=!1,u=!1,g=!1;try{const f={state:rr({lastMessage:this.state.snapshot(l),messageId:this.generateId()}),abortController:new AbortController};f.abortController.signal.addEventListener("abort",()=>{p=!0}),this.activeResponse=f;let v;if(t==="resume-stream"){const y=await this.transport.reconnectToStream({chatId:this.id,metadata:e,headers:a,body:s});if(y==null){this.setStatus({status:"ready"});return}v=y}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 b=y=>this.jobExecutor.run(()=>y({state:f.state,write:()=>{var _;this.setStatus({status:"streaming"}),f.state.message.id===((_=this.lastMessage)==null?void 0:_.id)?this.state.replaceMessage(this.state.messages.length-1,f.state.message):this.state.pushMessage(f.state.message)}}));await or({stream:nr({stream:v,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:b,onError:y=>{throw y}}),onError:y=>{throw y}}),this.setStatus({status:"ready"})}catch(f){if(p||f.name==="AbortError")return p=!0,this.setStatus({status:"ready"}),null;g=!0,f instanceof TypeError&&(f.message.toLowerCase().includes("fetch")||f.message.toLowerCase().includes("network"))&&(u=!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:p,isDisconnect:u,isError:g,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})&&!g&&await this.makeRequest({trigger:"submit-message",messageId:(c=this.lastMessage)==null?void 0:c.id,metadata:e,headers:a,body:s})}},ke,yt;function dr(){if(yt)return ke;yt=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 ke=t,ke}var pr=dr();const mr=pa(pr);var Qt=(t,e,a)=>{if(!e.has(t))throw TypeError("Cannot "+a)},j=(t,e,a)=>(Qt(t,e,"read from private field"),a?a.call(t):e.get(t)),G=(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)},K=(t,e,a,s)=>(Qt(t,e,"write to private field"),e.set(t,a),a);function fr(t,e){return e!=null?mr(t,e):t}var B,Ae,Ce,ge,ve,ye,de,ze,Ve,hr=class{constructor(t=[]){G(this,B,void 0),G(this,Ae,"ready"),G(this,Ce,void 0),G(this,ge,new Set),G(this,ve,new Set),G(this,ye,new Set),this.pushMessage=e=>{K(this,B,j(this,B).concat(e)),j(this,de).call(this)},this.popMessage=()=>{K(this,B,j(this,B).slice(0,-1)),j(this,de).call(this)},this.replaceMessage=(e,a)=>{K(this,B,[...j(this,B).slice(0,e),this.snapshot(a),...j(this,B).slice(e+1)]),j(this,de).call(this)},this.snapshot=e=>structuredClone(e),this["~registerMessagesCallback"]=(e,a)=>{const s=a?fr(e,a):e;return j(this,ge).add(s),()=>{j(this,ge).delete(s)}},this["~registerStatusCallback"]=e=>(j(this,ve).add(e),()=>{j(this,ve).delete(e)}),this["~registerErrorCallback"]=e=>(j(this,ye).add(e),()=>{j(this,ye).delete(e)}),G(this,de,()=>{j(this,ge).forEach(e=>e())}),G(this,ze,()=>{j(this,ve).forEach(e=>e())}),G(this,Ve,()=>{j(this,ye).forEach(e=>e())}),K(this,B,t)}get status(){return j(this,Ae)}set status(t){K(this,Ae,t),j(this,ze).call(this)}get error(){return j(this,Ce)}set error(t){K(this,Ce,t),j(this,Ve).call(this)}get messages(){return j(this,B)}set messages(t){K(this,B,[...t]),j(this,de).call(this)}};B=new WeakMap;Ae=new WeakMap;Ce=new WeakMap;ge=new WeakMap;ve=new WeakMap;ye=new WeakMap;de=new WeakMap;ze=new WeakMap;Ve=new WeakMap;var pe,bt=class extends ur{constructor({messages:t,...e}){const a=new hr(t);super({...e,state:a}),G(this,pe,void 0),this["~registerMessagesCallback"]=(s,r)=>j(this,pe)["~registerMessagesCallback"](s,r),this["~registerStatusCallback"]=s=>j(this,pe)["~registerStatusCallback"](s),this["~registerErrorCallback"]=s=>j(this,pe)["~registerErrorCallback"](s),K(this,pe,a)}};pe=new WeakMap;function gr({experimental_throttle:t,resume:e=!1,...a}={}){const s=J.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:g=>{var f,v;return(v=(f=s.current).onToolCall)==null?void 0:v.call(f,g)},onData:g=>{var f,v;return(v=(f=s.current).onData)==null?void 0:v.call(f,g)},onFinish:g=>{var f,v;return(v=(f=s.current).onFinish)==null?void 0:v.call(f,g)},onError:g=>{var f,v;return(v=(f=s.current).onError)==null?void 0:v.call(f,g)},sendAutomaticallyWhen:g=>{var f,v,b;return(b=(v=(f=s.current).sendAutomaticallyWhen)==null?void 0:v.call(f,g))!=null?b:!1}},n=J.useRef("chat"in a?a.chat:new bt(r));("chat"in a&&a.chat!==n.current||"id"in a&&n.current.id!==a.id)&&(n.current="chat"in a?a.chat:new bt(r));const o=J.useCallback(g=>n.current["~registerMessagesCallback"](g,t),[t,n.current.id]),c=J.useSyncExternalStore(o,()=>n.current.messages,()=>n.current.messages),l=J.useSyncExternalStore(n.current["~registerStatusCallback"],()=>n.current.status,()=>n.current.status),p=J.useSyncExternalStore(n.current["~registerErrorCallback"],()=>n.current.error,()=>n.current.error),u=J.useCallback(g=>{typeof g=="function"&&(g=g(n.current.messages)),n.current.messages=g},[n]);return J.useEffect(()=>{e&&n.current.resumeStream()},[e,n]),{id:n.current.id,messages:c,setMessages:u,sendMessage:n.current.sendMessage,regenerate:n.current.regenerate,clearError:n.current.clearError,stop:n.current.stop,error:p,resumeStream:n.current.resumeStream,status:l,addToolResult:n.current.addToolOutput,addToolOutput:n.current.addToolOutput,addToolApprovalResponse:n.current.addToolApprovalResponse}}const vr="You are a helpful assistant.",yr=t=>new Ht({api:`/api/${t}/models/stream`,credentials:"include",prepareSendMessagesRequest:({messages:e,requestMetadata:a})=>({body:{messages:e,stream:!0,...a}})});function Yr(t){const e=W.c(37),{threadId:a,systemPrompt:s,onCreateThread:r,onError:n,onToolCall:i}=t,{org:o,locator:c}=Et(),{slug:l}=o,p=va(),u=ya(),[g,f]=J.useState(null),v=ba(a),b=s||vr;let y;e[0]!==b?(y={id:"system",role:"system",parts:[{type:"text",text:b}]},e[0]=b,e[1]=y):y=e[1];const N=y;let d;e[2]!==v||e[3]!==N?(d=[N,...v],e[2]=v,e[3]=N,e[4]=d):d=e[4];const T=d,A=`${a}:${b}`;let E;e[5]!==l?(E=yr(l),e[5]=l,e[6]=E):E=e[6];const I=E;let P;e[7]!==c||e[8]!==u||e[9]!==r||e[10]!==p||e[11]!==a?(P=async Y=>{const{finishReason:se,messages:Xt,isAbort:Kt,isDisconnect:ea,isError:ta}=Y;if(f(se??null),se!=="stop"||Kt||ea||ta)return;const Ne=Xt.slice(-2).filter(Boolean);if(Ne.length!==2){console.warn("[chat] Expected 2 messages, got",Ne.length);return}u.insertMany.mutate(Ne);const He=Ne.find(xr)?.parts?.find(br)?.text.slice(0,100)||"";if(!await xa(c,a)){if(r)r({id:a,title:He});else{const Qe=new Date().toISOString(),aa={id:a,title:He,created_at:Qe,updated_at:Qe,hidden:!1};p.insert.mutate(aa)}return}p.update.mutate({id:a,updates:{updated_at:new Date().toISOString()}})},e[7]=c,e[8]=u,e[9]=r,e[10]=p,e[11]=a,e[12]=P):P=e[12];const L=P;let U;e[13]!==n?(U=Y=>{console.error("[chat] Chat error:",Y),n?.(Y)},e[13]=n,e[14]=U):U=e[14];let H;e[15]!==T||e[16]!==A||e[17]!==L||e[18]!==i||e[19]!==U||e[20]!==I?(H={id:A,messages:T,transport:I,onFinish:L,onToolCall:i,onError:U},e[15]=T,e[16]=A,e[17]=L,e[18]=i,e[19]=U,e[20]=I,e[21]=H):H=e[21];const C=gr(H);let ie;e[22]!==C?(ie=async(Y,se)=>{!Y?.trim()||C.status==="submitted"||C.status==="streaming"||(f(null),await C.sendMessage({id:crypto.randomUUID(),role:"user",parts:[{type:"text",text:Y}],metadata:se},{metadata:se}))},e[22]=C,e[23]=ie):ie=e[23];const Q=ie,fe=C.messages[0]?.role==="system"?C.messages.length===1:C.messages.length===0,le=C.messages,ce=C.status;let D;e[24]!==C?(D=C.stop.bind(C),e[24]=C,e[25]=D):D=e[25];let ue;e[26]===Symbol.for("react.memo_cache_sentinel")?(ue=()=>f(null),e[26]=ue):ue=e[26];let z;return e[27]!==C.clearError||e[28]!==C.error||e[29]!==C.messages||e[30]!==C.setMessages||e[31]!==C.status||e[32]!==g||e[33]!==fe||e[34]!==Q||e[35]!==D?(z={messages:le,status:ce,sendMessage:Q,stop:D,setMessages:C.setMessages,isEmpty:fe,error:C.error,clearError:C.clearError,finishReason:g,clearFinishReason:ue},e[27]=C.clearError,e[28]=C.error,e[29]=C.messages,e[30]=C.setMessages,e[31]=C.status,e[32]=g,e[33]=fe,e[34]=Q,e[35]=D,e[36]=z):z=e[36],z}function br(t){return t.type==="text"}function xr(t){return t.parts?.find(_r)}function _r(t){return t.type==="text"}function wr(t,e){return t.find(e)??t[0]}function Gr(t,e,a,s){const r=W.c(9),n=s===void 0?null:s,[i,o]=_a(t,n);let c;r[0]!==a||r[1]!==i?(c=g=>i!==null?a(g,i):!1,r[0]=a,r[1]=i,r[2]=c):c=r[2];let l;r[3]!==e||r[4]!==c?(l=wr(e,c),r[3]=e,r[4]=c,r[5]=l):l=r[5];const p=l;let u;return r[6]!==p||r[7]!==o?(u=[p,o],r[6]=p,r[7]=o,r[8]=u):u=r[8],u}function Er(t){const e=/\/[^/]+\/mcps\/([^/]+)\/([^/]+)\/([^/]+)/,a=t.match(e);return a&&a[1]&&a[2]&&a[3]?{connectionId:decodeURIComponent(a[1]),collectionName:decodeURIComponent(a[2]),itemId:decodeURIComponent(a[3])}:{connectionId:null,collectionName:null,itemId:null}}function Hr(t){const e=W.c(5),a=ma();let s;e[0]!==a.location.pathname?(s=Er(a.location.pathname),e[0]=a.location.pathname,e[1]=s):s=e[1];const{connectionId:r,collectionName:n,itemId:i}=s,o=wa();let c;e[2]!==t||e[3]!==o?(c=t?o.find(g=>g.id===t):null,e[2]=t,e[3]=o,e[4]=c):c=e[4];const l=c,[p]=Ea(t);let u=`You are an AI assistant running in an MCP Mesh environment.
12
-
13
- ## About MCP Mesh
14
- The Model Context Protocol (MCP) Mesh allows users to connect external Connections and expose their capabilities through Agents (also called Gateways). Each Agent provides access to a curated set of tools from connected Connections.
15
-
16
- ## Important Notes
17
- - All tool calls are logged and audited for security and compliance
18
- - You have access to the tools exposed through the selected agent
19
- - MCPs may expose resources that users can browse and edit
20
- - You have context to the current agent and its tools, resources, and prompts
21
- - When users mention "agents", they are referring to gateways and the tools available through them
22
-
23
- ## Instructional Guidelines
24
- Follow these guidelines when interacting with users:
25
-
26
- 1. **Simple Greetings**: If the user only greets you and does nothing else, respond with a friendly greeting and finish the conversation. Do not search for tools or perform any actions.
27
-
28
- 2. **Planning and Tool Discovery**: If the user plans something or asks for help that requires action, you should:
29
- - First, search and explore the available tools to understand what capabilities are at your disposal
30
- - Describe the chosen tools to the user, explaining what they do and how they can help
31
- - Run code with the chosen tools to better answer the user's request
32
-
33
- 3. **Tool Execution**: When using tools, execute them thoughtfully and explain the results to provide a complete answer to the user's request.`;return t&&(u=`You are an AI assistant running in an MCP Mesh environment.
34
-
35
- ## About MCP Mesh
36
- The Model Context Protocol (MCP) Mesh allows users to connect external Connections and expose their capabilities through Agents (also called Gateways). Each Agent provides access to a curated set of tools from connected Connections.
37
-
38
- ## Important Notes
39
- - All tool calls are logged and audited for security and compliance
40
- - You have access to the tools exposed through the selected agent
41
- - MCPs may expose resources that users can browse and edit
42
- - You have context to the current agent and its tools, resources, and prompts
43
- - When users mention "agents", they are referring to gateways and the tools available through them
44
-
45
- ## Instructional Guidelines
46
- Follow these guidelines when interacting with users:
47
-
48
- 1. **Simple Greetings**: If the user only greets you and does nothing else, respond with a friendly greeting and finish the conversation. Do not search for tools or perform any actions.
49
-
50
- 2. **Planning and Tool Discovery**: If the user plans something or asks for help that requires action, you should:
51
- - First, search and explore the available tools to understand what capabilities are at your disposal
52
- - Describe the chosen tools to the user, explaining what they do and how they can help
53
- - Run code with the chosen tools to better answer the user's request
54
-
55
- 3. **Tool Execution**: When using tools, execute them thoughtfully and explain the results to provide a complete answer to the user's request.
56
-
57
- ## Current Agent/Gateway
58
- You are talking to the user through the following Agent/Gateway:
59
- - Name: ${l?.title||"Unknown Agent"}
60
- - ID: ${t}`,p?.trim()&&(u=u+`
61
-
62
- ## Agent Instructions
63
- The following are specific instructions for this agent:
64
-
65
- ${p}`)),(r||n||i)&&(u=u+`
66
-
67
- ## Current Editing Context`,r&&(u=u+`
68
- - Connection ID: ${r}`),n&&(u=u+`
69
- - Collection Name: ${n}`),i&&(u=u+`
70
- - Item ID: ${i}`),u=u+`
71
-
72
- Help the user understand and work with this resource.`),u}const xt=3;function Ir(t){const e=W.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 u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=/_/g,e[5]=u):u=e[5],o=i.replace(u," "),e[3]=i,e[4]=o}else o=e[4];let c;e[6]!==n||e[7]!==o?(c=m.jsx(Je,{asChild:!0,children:m.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=m.jsx(We,{side:"bottom",className:"max-w-xs",children:m.jsx("p",{className:"text-xs",children:r})}),e[9]=r,e[10]=l):l=e[10];let p;return e[11]!==c||e[12]!==l?(p=m.jsxs(qe,{children:[c,l]}),e[11]=c,e[12]=l,e[13]=p):p=e[13],p}function Sr(t){const e=W.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 g=a.slice(0,xt),f=a.slice(xt),v=f.length>0;n=It,l=300,e[8]!==r?(i=he("flex flex-wrap items-center justify-center gap-2",r),e[8]=r,e[9]=i):i=e[9];let b;e[10]!==s?(b=y=>m.jsx(Ir,{prompt:y,onSelect:s},y.name),e[10]=s,e[11]=b):b=e[11],o=g.map(b),c=v&&m.jsxs(St,{children:[m.jsx(Nt,{asChild:!0,children:m.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]})}),m.jsx(Tt,{side:"bottom",align:"center",className:"w-auto p-2",children:m.jsx("div",{className:"flex flex-col gap-1",children:f.map(y=>{const _=y.description??y.name;return m.jsxs(qe,{children:[m.jsx(Je,{asChild:!0,children:m.jsx("button",{type:"button",onClick:()=>s(y),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:(y.title??y.name).replace(/_/g," ")})}),m.jsx(We,{side:"right",className:"max-w-xs",children:m.jsx("p",{className:"text-xs",children:_})})]},y.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 p;e[12]!==i||e[13]!==o||e[14]!==c?(p=m.jsxs("div",{className:i,children:[o,c]}),e[12]=i,e[13]=o,e[14]=c,e[15]=p):p=e[15];let u;return e[16]!==n||e[17]!==l||e[18]!==p?(u=m.jsx(n,{delayDuration:l,children:p}),e[16]=n,e[17]=l,e[18]=p,e[19]=u):u=e[19],u}async function Nr(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 Tr(t){const e=W.c(7);let a;e[0]!==t?(a=_t.gatewayPrompts(t),e[0]=t,e[1]=a):a=e[1];let s;e[2]!==t?(s=()=>Nr(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],fa(r)}function Qr(t){const e=W.c(4),{gatewayId:a,onSelect:s,className:r}=t,n=r===void 0?"mt-6":r,{data:i}=Tr(a);if(i.length===0)return null;let o;return e[0]!==n||e[1]!==s||e[2]!==i?(o=m.jsx(Sr,{prompts:i,onSelect:s,className:n}),e[0]=n,e[1]=s,e[2]=i,e[3]=o):o=e[3],o}function Xr({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]=J.useState(!1),l=Ia(),p=ha(),u=async()=>{if(!s||!r){Ze.error("Not authenticated");return}c(!0);try{const g=n?.find(b=>b.connection_url===Ta);if(g){p({to:"/$org/mcps/$connectionId",params:{org:a,connectionId:g.id}});return}const f=Aa({id:Ca("conn")}),v=await l.create.mutateAsync(f);p({to:"/$org/mcps/$connectionId",params:{org:a,connectionId:v.id}})}catch(g){Ze.error(`Failed to connect OpenRouter: ${g instanceof Error?g.message:String(g)}`)}finally{c(!1)}};return m.jsx(Sa,{image:m.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:m.jsxs(m.Fragment,{children:[m.jsxs(Me,{variant:"outline",onClick:u,disabled:o,children:[m.jsx("img",{src:Na,alt:"OpenRouter",className:"size-4"}),o?"Installing...":"Install OpenRouter"]}),m.jsx(Me,{variant:"outline",onClick:i,children:"Install Connection"})]})})}function Ar(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 Cr(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=[],p=[];for(const g of t){const f=new Date(g.updated_at);f>=a?i.push(g):f>=s?o.push(g):f>=r?c.push(g):f>=n?l.push(g):p.push(g)}const u=[];return i.length>0&&u.push({label:"Today",threads:i,showRelativeTime:!0}),o.length>0&&u.push({label:"Yesterday",threads:o,showRelativeTime:!1}),c.length>0&&u.push({label:"7 days ago",threads:c,showRelativeTime:!1}),l.length>0&&u.push({label:"30 days ago",threads:l,showRelativeTime:!1}),p.length>0&&u.push({label:"Older",threads:p,showRelativeTime:!1}),u}function Kr(t){const e=W.c(49),{threads:a,activeThreadId:s,onSelectThread:r,onRemoveThread:n,onOpen:i,variant:o}=t,c=o===void 0?"icon":o,[l,p]=J.useState("");let u,g,f,v,b,y,_,N,d,T,A,E;if(e[0]!==s||e[1]!==i||e[2]!==n||e[3]!==r||e[4]!==l||e[5]!==a||e[6]!==c){const C=l.trim()?a.filter(D=>(D.title||"New chat").toLowerCase().includes(l.toLowerCase())):a,ie=Cr(C);let Q;e[19]!==i?(Q=D=>{D?i?.():p("")},e[19]=i,e[20]=Q):Q=e[20];const fe=Q;v=It,f=qe,g=St,T=fe,e[21]!==c?(A=m.jsx(Je,{asChild:!0,children:m.jsx(Nt,{asChild:!0,children:c==="outline"?m.jsx(Me,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input","aria-label":"Chat history",children:m.jsx(Xe,{size:16})}):m.jsx(Me,{type:"button",variant:"ghost",size:"icon",className:"size-6 p-1 hover:bg-transparent","aria-label":"Chat history",children:m.jsx(Xe,{size:16,className:"text-muted-foreground hover:text-foreground transition-colors"})})})}),e[21]=c,e[22]=A):A=e[22],e[23]===Symbol.for("react.memo_cache_sentinel")?(E=m.jsx(We,{children:"Chat history"}),e[23]=E):E=e[23],u=Tt,_="end",N="w-80 p-0";let le;e[24]===Symbol.for("react.memo_cache_sentinel")?(le=m.jsx(Ra,{size:16,className:"text-muted-foreground shrink-0"}),e[24]=le):le=e[24];let ce;e[25]===Symbol.for("react.memo_cache_sentinel")?(ce=D=>p(D.target.value),e[25]=ce):ce=e[25],e[26]!==l?(d=m.jsx("div",{className:"border-b",children:m.jsxs("label",{className:"flex items-center gap-2.5 h-12 px-4 cursor-text",children:[le,m.jsx("input",{type:"text",placeholder:"Search chats...",value:l,onChange:ce,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]=d):d=e[27],b="max-h-[300px] overflow-y-auto",y=C.length===0?m.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:l.trim()?"No chats found":"No chats yet"}):ie.map((D,ue)=>m.jsxs("div",{children:[ue>0&&m.jsx("div",{className:"border-t mx-3"}),m.jsx("div",{className:"px-3 py-1",children:m.jsx("span",{className:"text-xs font-medium text-muted-foreground tracking-wide",children:D.label})}),D.threads.map(z=>{const Y=z.id===s;return m.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 hover:bg-accent cursor-pointer group ${Y?"bg-accent/50":""}`,onClick:()=>r(z.id),children:[m.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[m.jsx("span",{className:"text-sm truncate",children:z.title||"New chat"}),m.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:Y?"current":D.showRelativeTime?Ar(z.updated_at):null})]}),m.jsx("button",{type:"button",onClick:se=>{se.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:m.jsx(Ma,{size:14,className:"text-muted-foreground group-hover/trash:text-destructive"})})]},z.id)})]},D.label)),e[0]=s,e[1]=i,e[2]=n,e[3]=r,e[4]=l,e[5]=a,e[6]=c,e[7]=u,e[8]=g,e[9]=f,e[10]=v,e[11]=b,e[12]=y,e[13]=_,e[14]=N,e[15]=d,e[16]=T,e[17]=A,e[18]=E}else u=e[7],g=e[8],f=e[9],v=e[10],b=e[11],y=e[12],_=e[13],N=e[14],d=e[15],T=e[16],A=e[17],E=e[18];let I;e[28]!==b||e[29]!==y?(I=m.jsx("div",{className:b,children:y}),e[28]=b,e[29]=y,e[30]=I):I=e[30];let P;e[31]!==u||e[32]!==I||e[33]!==_||e[34]!==N||e[35]!==d?(P=m.jsxs(u,{align:_,className:N,children:[d,I]}),e[31]=u,e[32]=I,e[33]=_,e[34]=N,e[35]=d,e[36]=P):P=e[36];let L;e[37]!==g||e[38]!==P||e[39]!==T||e[40]!==A||e[41]!==E?(L=m.jsxs(g,{onOpenChange:T,children:[A,E,P]}),e[37]=g,e[38]=P,e[39]=T,e[40]=A,e[41]=E,e[42]=L):L=e[42];let U;e[43]!==f||e[44]!==L?(U=m.jsx(f,{children:L}),e[43]=f,e[44]=L,e[45]=U):U=e[45];let H;return e[46]!==v||e[47]!==U?(H=m.jsx(v,{children:U}),e[46]=v,e[47]=U,e[48]=H):H=e[48],H}export{Jr as D,Qr as G,Xr as N,Kr as T,Hr as a,Wr as b,Yr as c,Gr as u};
@@ -1 +0,0 @@
1
- import{r as v,c as z,j as t}from"./index-Dc4mPG7D.js";import{I as F,u as R}from"./use-connection-D1oWmd80.js";import{C as I}from"./checkbox-B6_pb64c.js";import{c as T,B as A}from"./input-CLQFaB_P.js";import{i as U}from"./ArrowLeft-WX776rGw.js";import{C as V}from"./collection-search-DCk3URyd.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 _({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=R({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(A,{variant:"ghost",size:"sm",onClick:Q,className:"h-8 w-8 p-0 shrink-0",children:t.jsx(U,{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{_ as T};
@@ -1 +0,0 @@
1
- import{K as B,j as t,c as O,f as Q,r as k}from"./index-Dc4mPG7D.js";import{u as U}from"./useQuery-CjN7yze9.js";import{i as W}from"./File06-lv7rH_v1.js";import{i as Y}from"./Loading01-nz4zkIiQ.js";import{e as J}from"./github-icon-Dp3wHhYE.js";import{C as P}from"./collection-display-button-0kCgwjcX.js";import{C as X}from"./collection-search-DCk3URyd.js";import{C as Z}from"./collection-table-wrapper-DbtYisXO.js";import{E as z,I as ee}from"./use-connection-D1oWmd80.js";import{C as te}from"./card-VaGCmdRN.js";import{V as se}from"./layout-D-qTqL0P.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,2 +0,0 @@
1
- import{r as F,c as v,j as _,K as $,p as A,s as D,t as O}from"./index-Dc4mPG7D.js";import{c as I,u as k}from"./input-CLQFaB_P.js";import{u as L}from"./project-context-provider-jIErvTKU.js";const U=({size:n=24,color:e="currentColor",...r})=>F.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},F.createElement("path",{d:"M20.5 7.278 12 12m0 0L3.5 7.278M12 12v9.5m9-5.441V7.942c0-.343 0-.514-.05-.667a1 1 0 0 0-.215-.364c-.109-.119-.258-.202-.558-.368l-7.4-4.111c-.284-.158-.425-.237-.575-.267a1 1 0 0 0-.403 0c-.15.03-.292.11-.576.267l-7.4 4.11c-.3.167-.45.25-.558.369a1 1 0 0 0-.215.364C3 7.428 3 7.599 3 7.942v8.117c0 .342 0 .514.05.666a1 1 0 0 0 .215.364c.109.119.258.202.558.368l7.4 4.111c.284.158.425.237.576.268.133.027.27.027.402 0 .15-.031.292-.11.576-.268l7.4-4.11c.3-.167.45-.25.558-.369a.999.999 0 0 0 .215-.364c.05-.152.05-.324.05-.666Z"}));U.displayName="Container";const W="UNKNOWN_CONNECTION_ID",Q=async n=>{const r=(await n.text()).split(`
2
- `).find(s=>s.startsWith("data: "));if(!r)throw new Error("No data received from the server");return JSON.parse(r.replace("data: ",""))};function q(n){if(n===W)return(async()=>{});const e=n?`/mcp/${n}`:"/mcp";return async(r,t)=>{const s=await fetch(e,{method:"POST",body:JSON.stringify({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:r,arguments:t}}),headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream"},credentials:"include"});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const o=s.headers.get("Content-Type")==="application/json"?await s.json():await Q(s);if(o.result?.isError)throw new Error(o.result.content?.[0]?.text||"Tool call failed");return o.result?.structuredContent||o.result}}function B(){const n=v.c(1);let e;return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=_.jsx("img",{src:"/empty-state-cards.png",alt:"",width:336,height:320,"aria-hidden":"true"}),n[0]=e):e=n[0],e}function oe(n){const e=v.c(24),{image:r,title:t,description:s,actions:o,className:i,descriptionClassName:m,actionsClassName:p}=n;let c;e[0]!==i?(c=I("flex flex-1 flex-col items-center justify-center gap-8 p-4",i),e[0]=i,e[1]=c):c=e[1];let u;e[2]!==r?(u=r!==null&&_.jsx("div",{className:"flex items-center justify-center",children:r??_.jsx(B,{})}),e[2]=r,e[3]=u):u=e[3];let a;e[4]!==t?(a=_.jsx("h3",{className:"text-lg font-medium text-foreground",children:t}),e[4]=t,e[5]=a):a=e[5];let d;e[6]!==m?(d=I("text-sm text-muted-foreground text-center max-w-[300px]",m),e[6]=m,e[7]=d):d=e[7];let f;e[8]!==s||e[9]!==d?(f=_.jsx("div",{className:d,children:s}),e[8]=s,e[9]=d,e[10]=f):f=e[10];let N;e[11]!==a||e[12]!==f?(N=_.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a,f]}),e[11]=a,e[12]=f,e[13]=N):N=e[13];let g;e[14]!==o||e[15]!==p?(g=o&&_.jsx("div",{className:I("flex items-center gap-2",p),children:o}),e[14]=o,e[15]=p,e[16]=g):g=e[16];let l;e[17]!==N||e[18]!==g?(l=_.jsxs("div",{className:"flex flex-col items-center gap-4",children:[N,g]}),e[17]=N,e[18]=g,e[19]=l):l=e[19];let h;return e[20]!==c||e[21]!==u||e[22]!==l?(h=_.jsxs("div",{className:c,children:[u,l]}),e[20]=c,e[21]=u,e[22]=l,e[23]=h):h=e[23],h}const J={xs:"h-6 w-6",sm:"h-8 w-8",md:"h-12 w-12",lg:"h-16 w-16"},M={xs:"min-w-6",sm:"min-w-8",md:"min-w-12",lg:"min-w-16"},P={xs:12,sm:16,md:24,lg:32};function ie(n){const e=v.c(7),{icon:r,name:t,size:s,className:o,fallbackIcon:i}=n,m=s===void 0?"md":s,p=r??"no-icon";let c;return e[0]!==o||e[1]!==i||e[2]!==r||e[3]!==t||e[4]!==m||e[5]!==p?(c=_.jsx(R,{icon:r,name:t,size:m,className:o,fallbackIcon:i},p),e[0]=o,e[1]=i,e[2]=r,e[3]=t,e[4]=m,e[5]=p,e[6]=c):c=e[6],c}function R(n){const e=v.c(24),{icon:r,name:t,size:s,className:o,fallbackIcon:i}=n,m=s===void 0?"md":s,[p,c]=F.useState(!1),u=!!r&&p,a=J[m],d=M[m];let f;e[0]!==o||e[1]!==a||e[2]!==d?(f=I("rounded-lg border border-border shrink-0 overflow-hidden",a,d,o),e[0]=o,e[1]=a,e[2]=d,e[3]=f):f=e[3];const N=r||void 0,g=!u&&"hidden";let l;e[4]!==g?(l=I("h-full w-full object-cover",g),e[4]=g,e[5]=l):l=e[5];let h,j;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(!1),j=()=>c(!0),e[6]=h,e[7]=j):(h=e[6],j=e[7]);let x;e[8]!==t||e[9]!==N||e[10]!==l?(x=_.jsx("img",{src:N,alt:t,className:l,onError:h,onLoad:j}),e[8]=t,e[9]=N,e[10]=l,e[11]=x):x=e[11];const y=u&&"hidden";let E;e[12]!==y?(E=I("h-full w-full flex items-center justify-center bg-muted/20",y),e[12]=y,e[13]=E):E=e[13];let w;e[14]!==i||e[15]!==m?(w=i??_.jsx(U,{size:P[m],className:"text-muted-foreground"}),e[14]=i,e[15]=m,e[16]=w):w=e[16];let C;e[17]!==E||e[18]!==w?(C=_.jsx("div",{className:E,children:w}),e[17]=E,e[18]=w,e[19]=C):C=e[19];let S;return e[20]!==x||e[21]!==C||e[22]!==f?(S=_.jsxs("div",{className:f,children:[x,C]}),e[20]=x,e[21]=C,e[22]=f,e[23]=S):S=e[23],S}function K(n,e,r){const t=[];if(n?.trim()){const s=n.trim(),o=r.map(i=>({field:[String(i)],operator:"contains",value:s}));o.length===1&&o[0]?t.push(o[0]):o.length>1&&t.push({operator:"or",conditions:o})}if(e&&e.length>0)for(const s of e)t.push({field:[s.column],operator:"eq",value:s.value});if(t.length!==0)return t.length===1?t[0]:{operator:"and",conditions:t}}function Z(n,e,r){const t=n??r,s=e??"asc";return[{field:[String(t)],direction:s}]}function H(n,e,r,t){const s=v.c(14),{org:o}=L();let i;s[0]!==e?(i=e.toUpperCase(),s[0]=e,s[1]=i):i=s[1];const p=`COLLECTION_${i}_GET`;let c;s[2]!==e||s[3]!==r||s[4]!==o.slug||s[5]!==n?(c=$.collectionItem(o.slug,n,e,r??""),s[2]=e,s[3]=r,s[4]=o.slug,s[5]=n,s[6]=c):c=s[6];let u;s[7]!==p||s[8]!==r||s[9]!==t?(u=async()=>r?await t(p,{id:r}):{item:null},s[7]=p,s[8]=r,s[9]=t,s[10]=u):u=s[10];let a;s[11]!==c||s[12]!==u?(a={queryKey:c,queryFn:u,staleTime:6e4},s[11]=c,s[12]=u,s[13]=a):a=s[13];const{data:d}=A(a);return d.item}function G(n,e,r,t){const s=v.c(11),o=t===void 0?{}:t,{org:i}=L(),{searchTerm:m,filters:p,sortKey:c,sortDirection:u,searchFields:a,defaultSortKey:d,pageSize:f}=o,N=a===void 0?["title","description"]:a,g=d===void 0?"updated_at":d,l=f===void 0?100:f;let h;s[0]!==e?(h=e.toUpperCase(),s[0]=e,s[1]=h):h=s[1];const x=`COLLECTION_${h}_LIST`,y=K(m,p,N),E=Z(c,u,g),w=JSON.stringify({where:y,orderBy:E,limit:l}),C=$.collectionList(i.slug,n,e,w);let S;s[2]!==x||s[3]!==E||s[4]!==l||s[5]!==r||s[6]!==y?(S=async()=>{const z={...y&&{where:y},...E&&{orderBy:E},limit:l,offset:0};return(await r(x,z))?.items??[]},s[2]=x,s[3]=E,s[4]=l,s[5]=r,s[6]=y,s[7]=S):S=s[7];let T;s[8]!==C||s[9]!==S?(T={queryKey:C,queryFn:S},s[8]=C,s[9]=S,s[10]=T):T=s[10];const{data:b}=A(T);return b}function V(n,e,r){const t=v.c(39),{org:s}=L(),o=D();let i;t[0]!==e?(i=e.toUpperCase(),t[0]=e,t[1]=i):i=t[1];const m=i,p=`COLLECTION_${m}_CREATE`,c=`COLLECTION_${m}_UPDATE`,u=`COLLECTION_${m}_DELETE`;let a;t[2]!==p||t[3]!==r?(a=async S=>(await r(p,{data:S})).item,t[2]=p,t[3]=r,t[4]=a):a=t[4];let d;t[5]!==e||t[6]!==s||t[7]!==o||t[8]!==n?(d=()=>{o.invalidateQueries({queryKey:$.collection(s.slug,n,e)}),O.success("Item created successfully")},t[5]=e,t[6]=s,t[7]=o,t[8]=n,t[9]=d):d=t[9];let f;t[10]!==a||t[11]!==d?(f={mutationFn:a,onSuccess:d,onError:ee},t[10]=a,t[11]=d,t[12]=f):f=t[12];const N=k(f);let g;t[13]!==r||t[14]!==c?(g=async S=>{const{id:T,data:b}=S;return(await r(c,{id:T,data:b})).item},t[13]=r,t[14]=c,t[15]=g):g=t[15];let l;t[16]!==e||t[17]!==s||t[18]!==o||t[19]!==n?(l=()=>{o.invalidateQueries({queryKey:$.collection(s.slug,n,e)}),O.success("Item updated successfully")},t[16]=e,t[17]=s,t[18]=o,t[19]=n,t[20]=l):l=t[20];let h;t[21]!==g||t[22]!==l?(h={mutationFn:g,onSuccess:l,onError:X},t[21]=g,t[22]=l,t[23]=h):h=t[23];const j=k(h);let x;t[24]!==u||t[25]!==r?(x=async S=>(await r(u,{id:S})).item.id,t[24]=u,t[25]=r,t[26]=x):x=t[26];let y;t[27]!==e||t[28]!==s||t[29]!==o||t[30]!==n?(y=()=>{o.invalidateQueries({queryKey:$.collection(s.slug,n,e)}),O.success("Item deleted successfully")},t[27]=e,t[28]=s,t[29]=o,t[30]=n,t[31]=y):y=t[31];let E;t[32]!==x||t[33]!==y?(E={mutationFn:x,onSuccess:y,onError:Y},t[32]=x,t[33]=y,t[34]=E):E=t[34];const w=k(E);let C;return t[35]!==N||t[36]!==w||t[37]!==j?(C={create:N,update:j,delete:w},t[35]=N,t[36]=w,t[37]=j,t[38]=C):C=t[38],C}function Y(n){const e=n instanceof Error?n.message:String(n);O.error(`Failed to delete item: ${e}`)}function X(n){const e=n instanceof Error?n.message:String(n);O.error(`Failed to update item: ${e}`)}function ee(n){const e=n instanceof Error?n.message:String(n);O.error(`Failed to create item: ${e}`)}function ce(n){const e=v.c(3);let r;e[0]!==n?(r=n===void 0?{}:n,e[0]=n,e[1]=r):r=e[1];const t=r,{org:s}=L();let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=q(),e[2]=o):o=e[2];const i=o;return G(s.slug,"CONNECTIONS",i,t)}function ae(n){const e=v.c(1),{org:r}=L();let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=q(),e[0]=t):t=e[0];const s=t;return H(r.slug,"CONNECTIONS",n,s)}function le(){const n=v.c(1),{org:e}=L();let r;n[0]===Symbol.for("react.memo_cache_sentinel")?(r=q(),n[0]=r):r=n[0];const t=r;return V(e.slug,"CONNECTIONS",t)}export{oe as E,ie as I,W as U,le as a,ae as b,q as c,H as d,V as e,G as f,U as n,ce as u};
@@ -1 +0,0 @@
1
- import{r as u,c as i}from"./index-Dc4mPG7D.js";import{f as p,e as d,d as h,c as a}from"./use-connection-D1oWmd80.js";import{u as m}from"./project-context-provider-jIErvTKU.js";import{W as f,e as A}from"./well-known-mcp-7PcWXInp.js";const g=({size:t=24,color:e="currentColor",...o})=>u.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},u.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"}));g.displayName="CpuChip02";function y(t){const e=i.c(3);let o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];const s=o,{org:c}=m();let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=a(),e[2]=l):l=e[2];const r=l;return p(c.slug,"GATEWAY",r,s)}function W(t){const e=i.c(3),{org:o}=m();let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=a(),e[0]=s):s=e[0];const c=s;let l;e:{if(t===f.DECOPILOT){let n;e[1]!==o.id?(n=A(o.id),e[1]=o.id,e[2]=n):n=e[2],l=n;break e}l=null}const r=l,C=h(o.slug,"GATEWAY",t===f.DECOPILOT?void 0:t,c);return r??C}function b(){const t=i.c(1),{org:e}=m();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=a(),t[0]=o):o=t[0];const s=o;return d(e.slug,"GATEWAY",s)}export{b as a,W as b,g as i,y as u};
@@ -1 +0,0 @@
1
- import{c as E,K as b}from"./index-Dc4mPG7D.js";import{u as j}from"./useQuery-CjN7yze9.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 +0,0 @@
1
- import{c as o,p as y,s as p,K as f}from"./index-Dc4mPG7D.js";import{u as T}from"./input-CLQFaB_P.js";import{c as m}from"./use-connection-D1oWmd80.js";function N(t){const e=o.c(8);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=m(),e[0]=n):n=e[0];const c=n;let r;e[1]!==t?(r=f.organizationSettings(t),e[1]=t,e[2]=r):r=e[2];let s;e[3]!==t?(s=async()=>{const u=await c("ORGANIZATION_SETTINGS_GET",{});return u||{organizationId:t,sidebar_items:null,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}},e[3]=t,e[4]=s):s=e[4];let l;e[5]!==r||e[6]!==s?(l={queryKey:r,queryFn:s,staleTime:6e4},e[5]=r,e[6]=s,e[7]=l):l=e[7];const{data:i}=y(l);return i}function C(t){const e=o.c(11),n=p();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=m(),e[0]=c):c=e[0];const r=c;let s;e[1]!==t?(s=async S=>await r("ORGANIZATION_SETTINGS_UPDATE",{organizationId:t,...S}),e[1]=t,e[2]=s):s=e[2];let l;e[3]!==t||e[4]!==n?(l=()=>{n.invalidateQueries({queryKey:f.organizationSettings(t)})},e[3]=t,e[4]=n,e[5]=l):l=e[5];let i;e[6]!==s||e[7]!==l?(i={mutationFn:s,onSuccess:l},e[6]=s,e[7]=l,e[8]=i):i=e[8];const u=T(i);let a;return e[9]!==u?(a={update:u},e[9]=u,e[10]=a):a=e[10],a}export{C as a,N as u};
@@ -1 +0,0 @@
1
- import{c as y,K as C,p as T}from"./index-Dc4mPG7D.js";import{u as q}from"./useQuery-CjN7yze9.js";import{u as K}from"./input-CLQFaB_P.js";function F(a){const e=y.c(23);let o,l,t,s,r;e[0]!==a?({toolCaller:t,toolName:r,toolInputParams:s,scope:l,...o}=a,e[0]=a,e[1]=o,e[2]=l,e[3]=t,e[4]=s,e[5]=r):(o=e[1],l=e[2],t=e[3],s=e[4],r=e[5]);let i,c,m,u;if(e[6]!==o||e[7]!==l||e[8]!==s||e[9]!==r){const p=JSON.stringify(s);u=T,i=o,c=o.staleTime??6e4,m=C.toolCall(l,r,p),e[6]=o,e[7]=l,e[8]=s,e[9]=r,e[10]=i,e[11]=c,e[12]=m,e[13]=u}else i=e[10],c=e[11],m=e[12],u=e[13];let n;e[14]!==t||e[15]!==s||e[16]!==r?(n=async()=>await t(r,s),e[14]=t,e[15]=s,e[16]=r,e[17]=n):n=e[17];let f;return e[18]!==i||e[19]!==c||e[20]!==m||e[21]!==n?(f={...i,staleTime:c,queryKey:m,queryFn:n},e[18]=i,e[19]=c,e[20]=m,e[21]=n,e[22]=f):f=e[22],u(f)}function I(a){const e=y.c(3),{toolCaller:o,toolName:l}=a;let t;return e[0]!==o||e[1]!==l?(t={mutationFn:async s=>await o(l,s),onSuccess:S,onError:N},e[0]=o,e[1]=l,e[2]=t):t=e[2],K(t)}function N(a){console.error("tool call mutation error",a)}function S(a){console.log("tool call mutation success",a)}function O(a){const e=y.c(14),{toolCaller:o,toolName:l,toolInputParams:t,scope:s,staleTime:r,refetchInterval:i,enabled:c}=a,m=r===void 0?6e4:r;let u;e[0]!==s||e[1]!==t||e[2]!==l?(u=C.toolCall(s,l,JSON.stringify(t??{})),e[0]=s,e[1]=t,e[2]=l,e[3]=u):u=e[3];let n;e[4]!==o||e[5]!==t||e[6]!==l?(n=async()=>await o(l,t??{}),e[4]=o,e[5]=t,e[6]=l,e[7]=n):n=e[7];let f;return e[8]!==c||e[9]!==i||e[10]!==m||e[11]!==u||e[12]!==n?(f={queryKey:u,queryFn:n,enabled:c,staleTime:m,refetchInterval:i},e[8]=c,e[9]=i,e[10]=m,e[11]=u,e[12]=n,e[13]=f):f=e[13],q(f)}export{O as a,I as b,F as u};
@@ -1 +0,0 @@
1
- import{a1 as u,an as s}from"./index-Dc4mPG7D.js";function n(e,r){return u(e,s,r)}export{n as u};
@@ -1 +0,0 @@
1
- const o="https://api.decocms.com/mcp/registry",c="https://sites-openrouter.decocache.com/mcp",i="https://openrouter.ai/favicon.ico",a="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",e={SELF:"self",REGISTRY:"registry",COMMUNITY_REGISTRY:"community-registry"},s={SELF:n=>`${n}_${e.SELF}`,REGISTRY:n=>`${n}_${e.REGISTRY}`,COMMUNITY_REGISTRY:n=>`${n}_${e.COMMUNITY_REGISTRY}`},l={DECOPILOT:"decopilot"};function r(n){return{id:s.REGISTRY(n),title:"Deco Store",description:"Official deco MCP registry with curated integrations",connection_type:"HTTP",connection_url:o,icon:"https://assets.decocache.com/decocms/00ccf6c3-9e13-4517-83b0-75ab84554bb9/596364c63320075ca58483660156b6d9de9b526e.png",app_name:"deco-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function u(){return{id:e.COMMUNITY_REGISTRY,title:"MCP Registry",description:"Community MCP registry with thousands of handy MCPs",connection_type:"HTTP",connection_url:"https://sites-registry.decocache.com/mcp",icon:"https://assets.decocache.com/decocms/cd7ca472-0f72-463a-b0de-6e44bdd0f9b4/mcp.png",app_name:"mcp-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function p(n={}){return{id:n.id,title:"OpenRouter",description:"Access hundreds of LLM models from a single API",icon:i,app_name:"openrouter",app_id:"openrouter",connection_type:"HTTP",connection_url:c,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{source:"chat",verified:!1,scopeName:"deco",toolsCount:0,publishedAt:null,repository:null}}}function d(){return{title:"MCP Studio",description:"An app that allows you to create and manage MCPs",icon:"https://assets.decocache.com/mcp/09e44283-f47d-4046-955f-816d227c626f/app.png",app_name:"mcp-studio",app_id:"65a1b407-b6af-41e2-a89f-ce9450c05bbc",connection_type:"HTTP",connection_url:"https://sites-vibemcp.decocache.com/mcp",connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!1,type:"mcp-studio"}}}function _(n){const t=new Date().toISOString();return{id:l.DECOPILOT,organization_id:n,title:"Decopilot",description:"Use all organization connections into a single agent",tool_selection_mode:"exclusion",icon:a,status:"active",created_at:t,updated_at:t,created_by:"",updated_by:void 0,connections:[]}}export{i as O,l as W,c as a,e as b,r as c,u as d,_ as e,d as f,p as g};
@@ -1 +0,0 @@
1
- import{a as L,f as P,r as v,j as e,c as k}from"./index-Dc4mPG7D.js";import{f as _}from"./well-known-mcp-7PcWXInp.js";import{C as R}from"./collection-tab-BK4lXf-5.js";import{a as z,E as A,u as F}from"./use-connection-D1oWmd80.js";import{u as B}from"./project-context-provider-jIErvTKU.js";import{B as y}from"./input-CLQFaB_P.js";import{C as M}from"./collection-header-C5jLEW4T.js";import{u as O,b as H}from"./use-binding-C_WCv3Kw.js";import{i as T}from"./Loading01-nz4zkIiQ.js";import"./generate-id-Dyweu44Y.js";import"./collection-display-button-0kCgwjcX.js";import"./dropdown-menu-DEdU2p2E.js";import"./Grid01-bigl9l-5.js";import"./Check-Dh23dmDM.js";import"./view-mode-toggle-Q_4Hio7O.js";import"./collection-search-DCk3URyd.js";import"./SearchMd-CGgWiIHk.js";import"./card-VaGCmdRN.js";import"./Copy01-BX4_oHqx.js";import"./DotsVertical-BBtotCm7.js";import"./use-list-state-D9IMsf4Z.js";import"./use-mobile-BmTi-FB3.js";import"./Trash01-Nn4emH5w.js";import"./collection-table-wrapper-DbtYisXO.js";import"./empty-state-C6fFQCSt.js";import"./Inbox01-BIZdM9VF.js";import"./avatar-DVkpHhcq.js";import"./useQuery-CjN7yze9.js";import"./pin-to-sidebar-button-DmlmCu_p.js";import"./use-organization-settings-DPGpmRIO.js";import"./constants-D7HtiX2k.js";import"./alert-dialog-BrdP9Xiy.js";import"./Plus-DRzcJPy4.js";import"./layout-D-qTqL0P.js";import"./ArrowLeft-WX776rGw.js";import"./auth-BkX07Kdp.js";function V({title:i,description:t,wellKnownMcp:o,imageSrc:n,onConnected:s}){const r=z(),{org:{slug:m}}=B(),{data:h}=L.useSession(),d=P(),[a,N]=v.useState(!1),l=async()=>{if(!(!o||!h?.user?.id)){N(!0);try{const c=await r.create.mutateAsync(o);s?.(c.id),d({to:"/$org/mcps/$connectionId",params:{org:m,connectionId:c.id}})}finally{N(!1)}}},j=()=>{d({to:"/$org/mcps",params:{org:m},search:{action:"create"}})};return e.jsx(A,{image:n?e.jsx("img",{src:n,alt:i,width:336,height:320,className:"max-w-full h-auto"}):null,title:i,description:t,actions:e.jsxs(e.Fragment,{children:[e.jsxs(y,{variant:"outline",onClick:l,disabled:a||!o,children:[o?.icon&&e.jsx("img",{src:o.icon,alt:"",className:"size-4"}),a?"Installing...":`Install ${o?.title||"MCP"}`]}),e.jsx(y,{variant:"outline",onClick:j,children:"Custom Connection"})]})})}function q(i){const t=k.c(28),{bindingName:o,collectionName:n,title:s,emptyState:r,wellKnownMcp:m}=i,{org:h}=B(),d=F();let a;t[0]!==d||t[1]!==o?(a={connections:d,binding:o},t[0]=d,t[1]=o,t[2]=a):a=t[2];const l=O(a)[0],j=H(l);let c;if(t[3]!==n||t[4]!==j){let C;t[6]!==n?(C=$=>$.name.toLowerCase()===n.toLowerCase(),t[6]=n,t[7]=C):C=t[7],c=j.find(C),t[3]=n,t[4]=j,t[5]=c}else c=t[5];const S=c,[E,W]=v.useState(null),b=l&&S&&(l.id||E);let f;t[8]!==s?(f=e.jsx(M,{title:s}),t[8]=s,t[9]=f):f=t[9];let I;t[10]===Symbol.for("react.memo_cache_sentinel")?(I=e.jsx(T,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t[10]=I):I=t[10];let p;t[11]!==s?(p=s.toLowerCase(),t[11]=s,t[12]=p):p=t[12];let u;t[13]!==p?(u=e.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[I,e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Loading ",p,"..."]})]}),t[13]=p,t[14]=u):u=t[14];let g;t[15]!==S||t[16]!==l||t[17]!==r||t[18]!==h||t[19]!==b||t[20]!==m?(g=b?e.jsx(R,{connectionId:l.id,org:h.slug,activeCollection:S}):e.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:e.jsx(V,{title:r.title,description:r.description,wellKnownMcp:m,imageSrc:r.imageSrc,onConnected:C=>{W(C)}})}),t[15]=S,t[16]=l,t[17]=r,t[18]=h,t[19]=b,t[20]=m,t[21]=g):g=t[21];let x;t[22]!==u||t[23]!==g?(x=e.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:e.jsx(v.Suspense,{fallback:u,children:g})}),t[22]=u,t[23]=g,t[24]=x):x=t[24];let w;return t[25]!==f||t[26]!==x?(w=e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[f,x]}),t[25]=f,t[26]=x,t[27]=w):w=t[27],w}function kt(){const i=k.c(1);let t;return i[0]===Symbol.for("react.memo_cache_sentinel")?(t=e.jsx(q,{bindingName:"WORKFLOW",collectionName:"workflow",title:"Workflows",emptyState:{title:"Create Workflows",description:"Install MCP Studio to create and manage automated workflows with multiple steps and integrations."},wellKnownMcp:_()}),i[0]=t):t=i[0],t}export{kt as default};