@decocms/mesh 2.59.3 → 2.59.4

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-xn5rFX2T.js → AlertCircle-DcHEglIM.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-Bb6bw7wO.js → ArrowLeft-Dlm4CF9d.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-DmmjiRhr.js → ArrowUp-CC-2uYGu.js} +1 -1
  4. package/dist/client/assets/{Calendar-DjDp3sZ6.js → Calendar-PdB3o_9d.js} +1 -1
  5. package/dist/client/assets/{Check-CP3euUrF.js → Check-BzMGOxMB.js} +1 -1
  6. package/dist/client/assets/{ChevronDown-sM8LyvvZ.js → ChevronDown-BV0rwdFr.js} +1 -1
  7. package/dist/client/assets/{Code01-DR-jbECo.js → Code01-KWN4ist8.js} +1 -1
  8. package/dist/client/assets/{Copy01-Ds6kUzpe.js → Copy01-DH_iV9-n.js} +1 -1
  9. package/dist/client/assets/{DotsHorizontal-DZRRv704.js → DotsHorizontal-CFL9xkGv.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-DZEGrhum.js → DotsVertical-DOgWrY6o.js} +1 -1
  11. package/dist/client/assets/{Download01-BxIh__MC.js → Download01-npnn9kWB.js} +1 -1
  12. package/dist/client/assets/{Edit01-BVZvpfR8.js → Edit01-CH6U7DHj.js} +1 -1
  13. package/dist/client/assets/{File02-Dh_9xh7Q.js → File02-Cuc-ZPtg.js} +1 -1
  14. package/dist/client/assets/{File06-B5Dv7-Oa.js → File06-BUwGdOjl.js} +1 -1
  15. package/dist/client/assets/{FilterLines-DH_DosQX.js → FilterLines-ia0H5bBk.js} +1 -1
  16. package/dist/client/assets/{Grid01-BRgRtmbs.js → Grid01-DmaR0g3f.js} +1 -1
  17. package/dist/client/assets/{Home02-lEMcKcn1.js → Home02-Cagj2miO.js} +1 -1
  18. package/dist/client/assets/{Image01-DoUr5ERm.js → Image01-BCcbzsoK.js} +1 -1
  19. package/dist/client/assets/{Inbox01-DGDxlReT.js → Inbox01-DoVQ3gCk.js} +1 -1
  20. package/dist/client/assets/{InfoCircle-BzAYvvO0.js → InfoCircle-qTETvFXb.js} +1 -1
  21. package/dist/client/assets/{Key01-DYMhbAB1.js → Key01-CHZQ8Cf-.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-CG-vKoro.js → LinkExternal01-Cq8yx7fP.js} +1 -1
  23. package/dist/client/assets/{List-7uuZoLIU.js → List-DZ53jWcW.js} +1 -1
  24. package/dist/client/assets/{Loading01-CaAuMuYs.js → Loading01-Bo9vDQAp.js} +1 -1
  25. package/dist/client/assets/{Lock01-B3UR0GHM.js → Lock01-C1QZkjy0.js} +1 -1
  26. package/dist/client/assets/{Pin01-YRdxhSee.js → Pin01-NWg5BL2M.js} +1 -1
  27. package/dist/client/assets/{Play-CUJHUsFq.js → Play-D2yqwct8.js} +1 -1
  28. package/dist/client/assets/{Plus-BfTBbS63.js → Plus-DAW17Fqf.js} +1 -1
  29. package/dist/client/assets/{SearchMd-DVKxUKrX.js → SearchMd-D9E7kgub.js} +1 -1
  30. package/dist/client/assets/{Share07-DC87ym6H.js → Share07-CN4FUsWW.js} +1 -1
  31. package/dist/client/assets/{Terminal-Csxea4Ut.js → Terminal-1HZulC_H.js} +1 -1
  32. package/dist/client/assets/{Tool01-ChloSpuN.js → Tool01-Ir04gLyn.js} +1 -1
  33. package/dist/client/assets/{Trash01-DFo133oe.js → Trash01-BUkAP1vf.js} +1 -1
  34. package/dist/client/assets/{Upload01-D1Hk2Al6.js → Upload01-DPPzM8Sw.js} +1 -1
  35. package/dist/client/assets/{Users03-D4Z1AQ9s.js → Users03-DscKVk_U.js} +1 -1
  36. package/dist/client/assets/{X-DhTQLdE5.js → X-DyyqPnhR.js} +1 -1
  37. package/dist/client/assets/{XClose-DnQCXbLq.js → XClose-nvPI0OtD.js} +1 -1
  38. package/dist/client/assets/{agent-detail-ByBpnMWY.js → agent-detail-pV-lC3Zh.js} +1 -1
  39. package/dist/client/assets/{agents-EruM84S0.js → agents-DepniFRU.js} +1 -1
  40. package/dist/client/assets/{alert-dialog-DZDASW_Y.js → alert-dialog-QzYPe_ae.js} +1 -1
  41. package/dist/client/assets/{auth-catchall-DMglr4vj.js → auth-catchall-COlMpx6Y.js} +1 -1
  42. package/dist/client/assets/{avatar-D8fhy6Ww.js → avatar-KkS1NpLz.js} +1 -1
  43. package/dist/client/assets/{badge-DUUncEQr.js → badge-CfH2vrIM.js} +1 -1
  44. package/dist/client/assets/{binder-BPAsHHtz.js → binder-Cyeq_Zec.js} +1 -1
  45. package/dist/client/assets/{button-CrpAre8y.js → button-D_0RTXDt.js} +1 -1
  46. package/dist/client/assets/{card-DFAR9fdq.js → card-BmOa96dk.js} +1 -1
  47. package/dist/client/assets/{checkbox-C3_7sazf.js → checkbox-CUtYbeQD.js} +1 -1
  48. package/dist/client/assets/{circle-alert-CKX7xMwa.js → circle-alert-BnmazpCh.js} +1 -1
  49. package/dist/client/assets/collapsible-0N2BB6Bm.js +23 -0
  50. package/dist/client/assets/{collection-detail-P4xS7bsU.js → collection-detail-CeAvZaUS.js} +1 -1
  51. package/dist/client/assets/{collection-display-button-Bg3dpeu8.js → collection-display-button-Cm0zQnM_.js} +1 -1
  52. package/dist/client/assets/{collection-header-otDJIXED.js → collection-header-CbT_At3k.js} +1 -1
  53. package/dist/client/assets/{collection-page-CUjvCEL-.js → collection-page-CpAhF9Tg.js} +1 -1
  54. package/dist/client/assets/{collection-search-DCaFQu6x.js → collection-search-DRZ8ScZP.js} +1 -1
  55. package/dist/client/assets/{collection-tab-CzmKWGIs.js → collection-tab-CyuO9CaU.js} +1 -1
  56. package/dist/client/assets/{collection-table-wrapper-DGYtCyoO.js → collection-table-wrapper-CspbeKNx.js} +1 -1
  57. package/dist/client/assets/{connect-BdCEolcr.js → connect-Dx3Myol5.js} +1 -1
  58. package/dist/client/assets/{connection-card-rs_E5lwE.js → connection-card-C6VYrDSx.js} +1 -1
  59. package/dist/client/assets/{connection-detail-DmZtLLGV.js → connection-detail-BAO1w9SL.js} +1 -1
  60. package/dist/client/assets/{connections-cBCnIsVT.js → connections-xwpD87cp.js} +1 -1
  61. package/dist/client/assets/{constants-CAezfWK1.js → constants-D8fdcBr8.js} +1 -1
  62. package/dist/client/assets/constants-rfrR0uMr.js +1 -0
  63. package/dist/client/assets/{create-organization-dialog-BPmyxFH3.js → create-organization-dialog-D96wehG4.js} +1 -1
  64. package/dist/client/assets/{dialog-DHQqGK7g.js → dialog-B-A0vnh-.js} +1 -1
  65. package/dist/client/assets/{dropdown-menu-C8F0EsLR.js → dropdown-menu-CMmh8IDN.js} +1 -1
  66. package/dist/client/assets/{dynamic-plugin-layout-D4RjVErB.js → dynamic-plugin-layout-D5OcFZH0.js} +1 -1
  67. package/dist/client/assets/{empty-state-DrxI6i2r.js → empty-state-BS0aVQHO.js} +1 -1
  68. package/dist/client/assets/{empty-state--pBjJrWJ.js → empty-state-DKQ_J1zp.js} +1 -1
  69. package/dist/client/assets/{env-vars-editor-B2cK0oXN.js → env-vars-editor-BFfuzqB5.js} +1 -1
  70. package/dist/client/assets/{error-boundary-C4ZiBZqG.js → error-boundary-ynZ9rF8y.js} +1 -1
  71. package/dist/client/assets/{extract-connection-data-BQo5YaFM.js → extract-connection-data-5Dbbyfmc.js} +1 -1
  72. package/dist/client/assets/{file-browser-DsCPH1Ag.js → file-browser-DWYmbjoP.js} +2 -2
  73. package/dist/client/assets/{form-DQQrIzsV.js → form-DngqlMy0.js} +1 -1
  74. package/dist/client/assets/{grid-view-DW981ZW7.js → grid-view-DBdpM4tG.js} +1 -1
  75. package/dist/client/assets/{home-D-N7CfPC.js → home-Dh3O7N9x.js} +1 -1
  76. package/dist/client/assets/{index-D55GsjfR.js → index-B8BaCPuX.js} +1 -1
  77. package/dist/client/assets/{index-BVCaXPqJ.js → index-BWcrkV98.js} +1 -1
  78. package/dist/client/assets/{index-CsFpv8QQ.js → index-BtGsFE3_.js} +1 -1
  79. package/dist/client/assets/{index-CYuJPFs9.js → index-C_CYTppS.js} +1 -1
  80. package/dist/client/assets/{index-DaTQM6wc.js → index-DaiP89U7.js} +1 -1
  81. package/dist/client/assets/{index-M3wOD-T-.js → index-Dho9MRVw.js} +2 -2
  82. package/dist/client/assets/{infiniteQueryObserver-CfX1I4Ag.js → infiniteQueryObserver-DDmbfPGP.js} +1 -1
  83. package/dist/client/assets/{input-YM08EPCC.js → input-trZWilTG.js} +1 -1
  84. package/dist/client/assets/{layout-BHkRlBCz.js → layout-BZ8_9wgI.js} +1 -1
  85. package/dist/client/assets/{localstorage-keys-hwI1e15G.js → localstorage-keys-B7V7cQcH.js} +1 -1
  86. package/dist/client/assets/{login-DST3z8Qq.js → login-D61ut3BQ.js} +1 -1
  87. package/dist/client/assets/{mcp-oauth-PtJaIBSs.js → mcp-oauth-kjSe-9sd.js} +1 -1
  88. package/dist/client/assets/{mcp-server-card-BGCxJtFs.js → mcp-server-card-DkR0AaJs.js} +1 -1
  89. package/dist/client/assets/{mcp-server-detail-CLu2K73s.js → mcp-server-detail-Bq0lDMH3.js} +2 -2
  90. package/dist/client/assets/{members-DdELhmRF.js → members-DqAGtLhZ.js} +1 -1
  91. package/dist/client/assets/{monaco-editor-i9oMLTE9.js → monaco-editor-KzPiR_VS.js} +1 -1
  92. package/dist/client/assets/{monitoring-CVIH1wIi.js → monitoring-DkEahA8B.js} +1 -1
  93. package/dist/client/assets/{oauth-callback-BHMg2ciL.js → oauth-callback-C_OPSpWp.js} +1 -1
  94. package/dist/client/assets/{page-DVKYkPd1.js → page-BQkgsSw9.js} +1 -1
  95. package/dist/client/assets/{page-DAZ87OMt.js → page-DWOf0lbq.js} +1 -1
  96. package/dist/client/assets/{pin-to-sidebar-button-CnJDDpqU.js → pin-to-sidebar-button-Cdnz6iok.js} +1 -1
  97. package/dist/client/assets/{plugin-empty-state-CRXDez4A.js → plugin-empty-state-Dr-6CK5g.js} +1 -1
  98. package/dist/client/assets/{plugin-header-BW0ZqJ9r.js → plugin-header-CAC6QLaV.js} +1 -1
  99. package/dist/client/assets/{plugins-Ciz3DPby.js → plugins-57qT4Dil.js} +1 -1
  100. package/dist/client/assets/{popover-B_5ZVJni.js → popover-Bkt9Kfhi.js} +1 -1
  101. package/dist/client/assets/{registry-utils-CcsfK0rU.js → registry-utils-tiv71gSA.js} +1 -1
  102. package/dist/client/assets/{resizable-rgbJMlXu.js → resizable-BdOXbYHL.js} +1 -1
  103. package/dist/client/assets/{resource-tabs-DnsGbVCQ.js → resource-tabs-G-U5EIhm.js} +1 -1
  104. package/dist/client/assets/{select-D2wMncj-.js → select-reGYS0Ly.js} +1 -1
  105. package/dist/client/assets/{settings-CLiZONWL.js → settings-zvu2qyde.js} +1 -1
  106. package/dist/client/assets/{shell-layout-Cjy6ltJC.js → shell-layout-C-8OlUFV.js} +1 -1
  107. package/dist/client/assets/{spinner-B3atGTOQ.js → spinner-E8mBz_Z6.js} +1 -1
  108. package/dist/client/assets/{store-invite-Ckjal6E8.js → store-invite-DnYGNBjx.js} +1 -1
  109. package/dist/client/assets/{switch-DKUU5EKy.js → switch-t5mcsF2Z.js} +1 -1
  110. package/dist/client/assets/{textarea-55XlgpLZ.js → textarea-x7X_L353.js} +1 -1
  111. package/dist/client/assets/{tools-list-ENMGYPBW.js → tools-list-DQZuaE9M.js} +1 -1
  112. package/dist/client/assets/{tooltip-D1Jc2Tgr.js → tooltip-Cw2xVvTD.js} +1 -1
  113. package/dist/client/assets/{typewriter-title-1wCftG4E.js → typewriter-title-BK26jx8M.js} +1 -1
  114. package/dist/client/assets/{use-binding-DdMe4omo.js → use-binding-BVBmgj67.js} +1 -1
  115. package/dist/client/assets/{use-collections-COu7mzCX.js → use-collections-CVO4vm4G.js} +1 -1
  116. package/dist/client/assets/{use-connection-D5-dSK3A.js → use-connection-BU-nKbTz.js} +1 -1
  117. package/dist/client/assets/{use-create-virtual-mcp-BaTDfij5.js → use-create-virtual-mcp-Cr2fOp7g.js} +1 -1
  118. package/dist/client/assets/{use-deco-chat-open-BRCU7WzQ.js → use-deco-chat-open-D-b5da72.js} +1 -1
  119. package/dist/client/assets/{use-list-state-xhqAqE-A.js → use-list-state-ClsnlmlI.js} +1 -1
  120. package/dist/client/assets/{use-mcp-prompts-BLDzHD20.js → use-mcp-prompts-B5zcyY9X.js} +1 -1
  121. package/dist/client/assets/{use-members-IqhuQTuW.js → use-members-CVUMGKct.js} +1 -1
  122. package/dist/client/assets/{use-mobile-DIZjLJK7.js → use-mobile-VoJXvE1W.js} +1 -1
  123. package/dist/client/assets/{use-organization-settings-D9D-nJ5w.js → use-organization-settings-CeE0FyqT.js} +1 -1
  124. package/dist/client/assets/{use-virtual-mcp-Ciz726kq.js → use-virtual-mcp-DbjvrtSR.js} +1 -1
  125. package/dist/client/assets/useInfiniteQuery-CVAyTLiO.js +1 -0
  126. package/dist/client/assets/{useMutation-i3JyomhH.js → useMutation-Lj_Cbq0P.js} +1 -1
  127. package/dist/client/assets/useQuery-C2zqJzGD.js +1 -0
  128. package/dist/client/assets/useSuspenseInfiniteQuery-BS0TxHG_.js +1 -0
  129. package/dist/client/assets/{view-mode-toggle-DWoBF8kY.js → view-mode-toggle-BagEO4CJ.js} +1 -1
  130. package/dist/client/assets/{workflow-BQn7VIZF.js → workflow-BuhbYm_s.js} +1 -1
  131. package/dist/client/index.html +1 -1
  132. package/dist/server/cli.js +134 -134
  133. package/dist/server/server.js +121 -121
  134. package/package.json +1 -1
  135. package/dist/client/assets/collapsible-CNHksBot.js +0 -23
  136. package/dist/client/assets/constants-AccVhxEg.js +0 -1
  137. package/dist/client/assets/useInfiniteQuery-DZakeCfr.js +0 -1
  138. package/dist/client/assets/useQuery-BQUu3Rwx.js +0 -1
  139. package/dist/client/assets/useSuspenseInfiniteQuery-aRxFMhU5.js +0 -1
@@ -1 +1 @@
1
- import{c as ge,j as e,r as B,u as xe,l as je,f as fe,g as ye,m as ve,k as _e,h as Ce,o as se,n as ke,s as y,_ as Ne}from"./index-M3wOD-T-.js";import{C as Se}from"./collection-header-otDJIXED.js";import{C as we}from"./collection-page-CUjvCEL-.js";import{C as De}from"./collection-search-DCaFQu6x.js";import{C as be}from"./collection-table-wrapper-DGYtCyoO.js";import{C as Te}from"./connection-card-rs_E5lwE.js";import{n as O,E as H,I as Pe}from"./empty-state--pBjJrWJ.js";import{E as Ie}from"./error-boundary-C4ZiBZqG.js";import{u as Ve}from"./use-binding-DdMe4omo.js";import{u as $e,s as Q}from"./use-list-state-xhqAqE-A.js";import{e as Ae}from"./use-collections-COu7mzCX.js";import{a as Ee,b as Fe}from"./use-connection-D5-dSK3A.js";import{u as Oe}from"./constants-CAezfWK1.js";import{f as He,a as Me,b as Be,c as ze,d as Re,e as Ue,A as Xe,g as Le}from"./alert-dialog-DZDASW_Y.js";import{B as We}from"./badge-DUUncEQr.js";import{B as _}from"./button-CrpAre8y.js";import{D as Ke,a as Ge,b as qe,c as Ye,d as Qe,e as Je}from"./dialog-DHQqGK7g.js";import{D as J,a as Z,b as ee,c as $}from"./dropdown-menu-C8F0EsLR.js";import{a as Ze,F as h,b as g,c as x,d as j,f}from"./form-DQQrIzsV.js";import{i as te}from"./DotsVertical-DZEGrhum.js";import{f as et,e as tt,s as M}from"./registry-utils-CcsfK0rU.js";import{i as nt}from"./Loading01-CaAuMuYs.js";import{i as ot}from"./Terminal-Csxea4Ut.js";import{s as ne}from"./Trash01-DFo133oe.js";import{I as k}from"./input-YM08EPCC.js";import{S as st,a as rt,b as it,c as at,d as P}from"./select-D2wMncj-.js";import{T as ct}from"./textarea-55XlgpLZ.js";import{g as lt}from"./generate-id-Dyweu44Y.js";import{i as dt,r as ut,E as mt,e as re}from"./env-vars-editor-B2cK0oXN.js";import"./collection-display-button-Bg3dpeu8.js";import"./ArrowUp-DmmjiRhr.js";import"./Check-CP3euUrF.js";import"./Grid01-BRgRtmbs.js";import"./List-7uuZoLIU.js";import"./tooltip-D1Jc2Tgr.js";import"./view-mode-toggle-DWoBF8kY.js";import"./SearchMd-DVKxUKrX.js";import"./card-DFAR9fdq.js";import"./binder-BPAsHHtz.js";import"./use-mobile-DIZjLJK7.js";import"./useMutation-i3JyomhH.js";import"./useQuery-BQUu3Rwx.js";import"./X-DhTQLdE5.js";import"./ChevronDown-sM8LyvvZ.js";import"./Plus-BfTBbS63.js";const pt=se({key:y(),value:y()}),ht=se({title:y().min(1,"Name is required"),description:y().nullable().optional(),ui_type:Ne(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:y().optional(),connection_token:y().nullable().optional(),npx_package:y().optional(),stdio_command:y().optional(),stdio_args:y().optional(),stdio_cwd:y().optional(),env_vars:ke(pt).optional()}).refine(n=>n.ui_type==="NPX"?!!n.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(n=>n.ui_type==="STDIO"?!!n.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(n=>n.ui_type==="HTTP"||n.ui_type==="SSE"||n.ui_type==="Websocket"?!!n.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function E(n){const s=n.trim();if(!s)return"";try{const i=new URL(s),d=i.pathname.length>1?i.pathname.replace(/\/+$/,""):i.pathname;return`${i.origin}${d}`}catch{return s.replace(/\/+$/,"")}}function gt(n){const s=n.trim().split(/\s+/).filter(Boolean);if(s.length<2)return null;const i=s[0]?.toLowerCase();if(i!=="npx"&&i!=="bunx")return null;const m=s.slice(1).find(a=>!a.startsWith("-"));return m?{packageName:m}:null}function A(n){const{uiType:s}=n,i=E(n.connectionUrl??"");if((s==="HTTP"||s==="SSE"||s==="Websocket")&&i===E("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const d=(n.npxPackage??"").trim();return s==="NPX"&&d==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function oe(n){if(n.registryItems.length===0||n.uiType!=="HTTP"&&n.uiType!=="SSE"&&n.uiType!=="Websocket")return null;const s=E(n.connectionUrl??"");if(!s)return null;const i=n.registryItems.find(a=>(a.server?.remotes??[]).some(N=>E(N.url??"")===s));if(!i)return null;const d=i.title||i.name||i.server?.title||i.server?.name||"",m=i.server?.description||i.description||i.summary||null;return d?{id:"registry",title:d,description:m}:null}function xt(n,s){const i={command:"npx",args:["-y",n]},d=re(s);return Object.keys(d).length>0&&(i.envVars=d),i}function jt(n,s,i,d){const m={command:n};s.trim()&&(m.args=s.trim().split(/\s+/)),i?.trim()&&(m.cwd=i.trim());const a=re(d);return Object.keys(a).length>0&&(m.envVars=a),m}function ft(n){return n.command==="npx"}function yt(n){return n.args?.find(s=>!s.startsWith("-"))??""}function vt(n){return{command:n.command,args:n.args?.join(" ")??"",cwd:n.cwd??""}}function _t(n,s){switch(s.type){case"edit":return{mode:"editing",connection:s.connection};case"delete":return{mode:"deleting",connection:s.connection};case"close":return{mode:"idle"}}}function Ct(){const{org:n}=xe(),s=je(),i=fe({strict:!1}),{data:d}=ye.useSession(),{stdioEnabled:m}=ve(),a=$e({namespace:n.slug,resource:"connections"}),I=Ee(),N=Fe(a),[v,S]=B.useReducer(_t,{mode:"idle"}),z=Ve(N)[0],R=z?.id??"",U=et(z?.tools),ie=Oe({connectionId:R||null,orgId:n.id}),{data:ae}=Ae({client:ie,toolName:U,toolArguments:{limit:200},enabled:!!(R&&U),staleTime:3600*1e3,select:t=>t.structuredContent??t}),X=tt(ae??[]),L=i.action==="create",ce=()=>{s({to:"/$org/mcps",params:{org:n.slug},search:{action:"create"}})},W=()=>{s({to:"/$org/mcps",params:{org:n.slug},search:{}})},r=_e({resolver:Ce(ht),defaultValues:{title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),u=r.watch("ui_type"),K=r.watch("connection_url"),le=r.watch("npx_package"),b=A({uiType:u,connectionUrl:K??"",npxPackage:le??""})??oe({uiType:u,connectionUrl:K??"",registryItems:X}),l=v.mode==="editing"?v.connection:null;B.useEffect(()=>{if(l){const t=dt(l.connection_headers)?l.connection_headers:null;if(t&&l.connection_type==="STDIO"){const o=ut(t.envVars);if(ft(t)){const c=yt(t);r.reset({title:l.title,description:l.description,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:c,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:o})}else{const c=vt(t);r.reset({title:l.title,description:l.description,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:c.command,stdio_args:c.args,stdio_cwd:c.cwd,env_vars:o})}}else r.reset({title:l.title,description:l.description,ui_type:l.connection_type,connection_url:l.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else r.reset({title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[l,r]);const de=async()=>{if(v.mode!=="deleting")return;const t=v.connection.id;S({type:"close"});try{await I.delete.mutateAsync(t)}catch{}},ue=async t=>{let o,c=null,w=null,C=null;if(t.ui_type==="NPX"?(o="STDIO",c="",C=xt(t.npx_package||"",t.env_vars||[])):t.ui_type==="STDIO"?(o="STDIO",c="",C=jt(t.stdio_command||"",t.stdio_args||"",t.stdio_cwd,t.env_vars||[])):(o=t.ui_type,c=t.connection_url||"",w=t.connection_token||null),l){await I.update.mutateAsync({id:l.id,data:{title:t.title,description:t.description||null,connection_type:o,connection_url:c,...w&&{connection_token:w},...C&&{connection_headers:C}}}),S({type:"close"}),r.reset();return}const D=lt("conn");await I.create.mutateAsync({id:D,title:t.title,description:t.description||null,connection_type:o,connection_url:c,connection_token:w,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:d?.user?.id||"system",organization_id:n.id,icon:null,app_name:null,app_id:null,connection_headers:C,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),W(),r.reset(),s({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:D}})},G=t=>{t||(L?W():S({type:"close"}),r.reset())},V=t=>{const o=t.trim();if(!o)return;const c=!!r.formState.dirtyFields.title,w=!!r.formState.dirtyFields.description,C=!!r.formState.dirtyFields.env_vars,D=p=>{if(p&&(!c&&!r.getValues("title").trim()&&p.title&&r.setValue("title",p.title,{shouldDirty:!1}),!w&&!(r.getValues("description")??"").trim()&&p.description&&r.setValue("description",p.description,{shouldDirty:!1}),!C&&p.envVarKeys?.length)){const q=r.getValues("env_vars")??[],he=new Set(q.map(T=>T.key)),Y=p.envVarKeys.filter(T=>!he.has(T));Y.length>0&&r.setValue("env_vars",[...q,...Y.map(T=>({key:T,value:""}))],{shouldDirty:!0})}},F=gt(o);if(F&&m){r.setValue("ui_type","NPX",{shouldDirty:!0}),r.setValue("npx_package",F.packageName,{shouldDirty:!0}),r.setValue("connection_url","",{shouldDirty:!0}),r.setValue("connection_token",null,{shouldDirty:!0}),D(A({uiType:"NPX",npxPackage:F.packageName}));return}if(o.startsWith("http://")||o.startsWith("https://")){const p=u==="HTTP"||u==="SSE"||u==="Websocket"?u:"HTTP";r.setValue("ui_type",p,{shouldDirty:!0}),r.setValue("connection_url",o,{shouldDirty:!0}),D(A({uiType:p,connectionUrl:o})??oe({uiType:p,connectionUrl:o,registryItems:X}));return}u==="NPX"&&D(A({uiType:"NPX",npxPackage:o}))},me=[{id:"icon",header:"",render:t=>e.jsx(Pe,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:e.jsx(O,{})}),cellClassName:"w-16 shrink-0",wrap:!0},{id:"title",header:"Name",render:t=>e.jsx("span",{className:"text-sm font-medium text-foreground truncate block",title:t.title,children:t.title}),cellClassName:"w-48 max-w-48 min-w-0 shrink-0",sortable:!0},{id:"description",header:"Description",render:t=>e.jsx("span",{className:"text-sm text-foreground line-clamp-2",children:t.description||"—"}),cellClassName:"flex-1 min-w-0",wrap:!0,sortable:!0},{id:"connection_type",header:"Type",accessor:t=>e.jsx("span",{className:"text-sm font-medium",children:t.connection_type}),cellClassName:"w-24 shrink-0",sortable:!0},{id:"connection_url",header:"URL",render:t=>{const o=t.connection_url??"",c=o.length>40?`${o.slice(0,40)}...`:o;return e.jsx("span",{className:"text-sm text-muted-foreground",children:c})},cellClassName:"w-48 min-w-0 shrink-0"},{id:"status",header:"Status",render:t=>e.jsx(We,{variant:t.status==="active"?"success":"outline",children:t.status}),cellClassName:"w-24 shrink-0",sortable:!0},{id:"actions",header:"",render:t=>e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:o=>o.stopPropagation(),children:e.jsx(te,{size:20})})}),e.jsxs(ee,{align:"end",onClick:o=>o.stopPropagation(),children:[e.jsxs($,{onClick:o=>{o.stopPropagation(),s({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}})},children:[e.jsx(Q,{size:16}),"Open"]}),e.jsxs($,{variant:"destructive",onClick:o=>{o.stopPropagation(),S({type:"delete",connection:t})},children:[e.jsx(ne,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],pe=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>s({to:"/$org/store",params:{org:n.slug}}),size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Browse Store"}),e.jsx(_,{onClick:ce,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Custom Connection"})]});return e.jsxs(we,{children:[e.jsx(Ke,{open:L||v.mode==="editing",onOpenChange:G,children:e.jsxs(Ge,{className:"sm:max-w-[525px]",children:[e.jsxs(qe,{children:[e.jsx(Ye,{children:l?"Edit Connection":"Create Connection"}),e.jsx(Qe,{children:l?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below."})]}),e.jsx(Ze,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(ue),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(h,{control:r.control,name:"ui_type",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Type *"}),e.jsxs(st,{value:t.value,onValueChange:t.onChange,children:[e.jsx(j,{children:e.jsx(rt,{children:e.jsx(it,{})})}),e.jsxs(at,{children:[e.jsx(P,{value:"HTTP",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4"}),"HTTP"]})}),e.jsx(P,{value:"SSE",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4"}),"SSE"]})}),e.jsx(P,{value:"Websocket",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4"}),"Websocket"]})}),m&&e.jsxs(e.Fragment,{children:[e.jsx(P,{value:"NPX",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"w-4 h-4"}),"NPX Package"]})}),e.jsx(P,{value:"STDIO",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(ot,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),e.jsx(f,{})]})}),u==="NPX"&&e.jsx(e.Fragment,{children:e.jsx(h,{control:r.control,name:"npx_package",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"NPM Package *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"@perplexity-ai/mcp-server",...t,value:t.value??"",onPaste:o=>{const c=o.clipboardData.getData("text");c&&(o.preventDefault(),r.setValue("npx_package",c.trim(),{shouldDirty:!0}),V(c))},onBlur:o=>{V(o.target.value),t.onBlur()}})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The npm package to run with npx"}),e.jsx(f,{})]})})}),u==="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[e.jsx(h,{control:r.control,name:"stdio_command",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Command *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"node, bun, python...",...t,value:t.value??""})}),e.jsx(f,{})]})}),e.jsx(h,{control:r.control,name:"stdio_args",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Arguments"}),e.jsx(j,{children:e.jsx(k,{placeholder:"arg1 arg2 --flag value",...t,value:t.value??""})}),e.jsx(f,{})]})})]}),e.jsx(h,{control:r.control,name:"stdio_cwd",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Working Directory"}),e.jsx(j,{children:e.jsx(k,{placeholder:"/path/to/project (optional)",...t,value:t.value??""})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),e.jsx(f,{})]})})]}),(u==="NPX"||u==="STDIO")&&e.jsx(h,{control:r.control,name:"env_vars",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Environment Variables"}),e.jsx(j,{children:e.jsx(mt,{value:t.value??[],onChange:t.onChange})}),e.jsx(f,{})]})}),u!=="NPX"&&u!=="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsx(h,{control:r.control,name:"connection_url",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"URL *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"https://example.com/mcp",...t,value:t.value??"",onPaste:o=>{const c=o.clipboardData.getData("text");c&&(o.preventDefault(),r.setValue("connection_url",c.trim(),{shouldDirty:!0}),V(c))},onBlur:o=>{V(o.target.value),t.onBlur()}})}),e.jsx(f,{})]})}),e.jsx(h,{control:r.control,name:"connection_token",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:b?.token?.label??"Token (optional)"}),e.jsx(j,{children:e.jsx(k,{type:"password",placeholder:b?.token?.placeholder??"Bearer token or API key",...t,value:t.value??""})}),b?.token?.helperText&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.token.helperText,b.id==="github"&&e.jsxs(e.Fragment,{children:[" ","·"," ",e.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),e.jsx(f,{})]})})]}),e.jsx(h,{control:r.control,name:"title",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Name *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"My Connection",...t})}),e.jsx(f,{})]})}),e.jsx(h,{control:r.control,name:"description",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Description"}),e.jsx(j,{children:e.jsx(ct,{placeholder:"A brief description of this connection",rows:3,...t,value:t.value??""})}),e.jsx(f,{})]})})]}),e.jsxs(Je,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>G(!1),children:"Cancel"}),e.jsx(_,{type:"submit",disabled:r.formState.isSubmitting,className:"min-w-40",children:r.formState.isSubmitting?"Saving...":l?"Update Connection":"Create Connection"})]})]})})]})}),e.jsx(He,{open:v.mode==="deleting",onOpenChange:t=>!t&&S({type:"close"}),children:e.jsxs(Me,{children:[e.jsxs(Be,{children:[e.jsx(ze,{children:"Delete Connection?"}),e.jsxs(Re,{children:["This action cannot be undone. This will permanently delete"," ",e.jsx("span",{className:"font-medium text-foreground",children:v.mode==="deleting"&&v.connection.title}),"."]})]}),e.jsxs(Ue,{children:[e.jsx(Xe,{children:"Cancel"}),e.jsx(Le,{onClick:de,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e.jsx(Se,{title:"Connections",viewMode:a.viewMode,onViewModeChange:a.setViewMode,sortKey:a.sortKey,sortDirection:a.sortDirection,onSort:a.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"status",label:"Status"}],ctaButton:pe}),e.jsx(De,{value:a.search,onChange:a.setSearch,placeholder:"Search for a Connection...",onKeyDown:t=>{t.key==="Escape"&&(a.setSearch(""),t.target.blur())}}),a.viewMode==="cards"?e.jsx("div",{className:"flex-1 overflow-auto p-5",children:N.length===0?e.jsx(H,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:(a.search,"No Connections found"),description:a.search?`No Connections match "${a.search}"`:"Create a connection to get started.",actions:!a.search&&e.jsx(_,{variant:"outline",onClick:()=>s({to:"/$org/store",params:{org:n.slug}}),children:"Browse Store"})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:N.map(t=>e.jsx(Te,{connection:t,fallbackIcon:e.jsx(O,{}),onClick:()=>s({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}}),headerActions:e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:o=>o.stopPropagation(),children:e.jsx(te,{size:20})})}),e.jsxs(ee,{align:"end",onClick:o=>o.stopPropagation(),children:[e.jsxs($,{onClick:o=>{o.stopPropagation(),s({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}})},children:[e.jsx(Q,{size:16}),"Open"]}),e.jsxs($,{variant:"destructive",onClick:o=>{o.stopPropagation(),S({type:"delete",connection:t})},children:[e.jsx(ne,{size:16}),"Delete"]})]})]})},t.id))})}):e.jsx(be,{columns:me,data:N,isLoading:!1,sortKey:a.sortKey,sortDirection:a.sortDirection,onSort:a.handleSort,onRowClick:t=>s({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}}),emptyState:a.search?e.jsx(H,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:`No Connections match "${a.search}"`}):e.jsx(H,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:"Create a connection to get started.",actions:e.jsx(_,{variant:"outline",onClick:()=>s({to:"/$org/store",params:{org:n.slug}}),children:"Browse Store"})})})]})}function gn(){const n=ge.c(1);let s;return n[0]===Symbol.for("react.memo_cache_sentinel")?(s=e.jsx(Ie,{children:e.jsx(B.Suspense,{fallback:e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(nt,{size:32,className:"animate-spin text-muted-foreground"})}),children:e.jsx(Ct,{})})}),n[0]=s):s=n[0],s}export{gn as default};
1
+ import{c as ge,j as e,r as B,u as xe,l as je,f as fe,g as ye,m as ve,k as _e,h as Ce,o as se,n as ke,s as y,_ as Ne}from"./index-Dho9MRVw.js";import{C as Se}from"./collection-header-CbT_At3k.js";import{C as we}from"./collection-page-CpAhF9Tg.js";import{C as De}from"./collection-search-DRZ8ScZP.js";import{C as be}from"./collection-table-wrapper-CspbeKNx.js";import{C as Te}from"./connection-card-C6VYrDSx.js";import{n as O,E as H,I as Pe}from"./empty-state-DKQ_J1zp.js";import{E as Ie}from"./error-boundary-ynZ9rF8y.js";import{u as Ve}from"./use-binding-BVBmgj67.js";import{u as $e,s as Q}from"./use-list-state-ClsnlmlI.js";import{e as Ae}from"./use-collections-CVO4vm4G.js";import{a as Ee,b as Fe}from"./use-connection-BU-nKbTz.js";import{u as Oe}from"./constants-D8fdcBr8.js";import{f as He,a as Me,b as Be,c as ze,d as Re,e as Ue,A as Xe,g as Le}from"./alert-dialog-QzYPe_ae.js";import{B as We}from"./badge-CfH2vrIM.js";import{B as _}from"./button-D_0RTXDt.js";import{D as Ke,a as Ge,b as qe,c as Ye,d as Qe,e as Je}from"./dialog-B-A0vnh-.js";import{D as J,a as Z,b as ee,c as $}from"./dropdown-menu-CMmh8IDN.js";import{a as Ze,F as h,b as g,c as x,d as j,f}from"./form-DngqlMy0.js";import{i as te}from"./DotsVertical-DOgWrY6o.js";import{f as et,e as tt,s as M}from"./registry-utils-tiv71gSA.js";import{i as nt}from"./Loading01-Bo9vDQAp.js";import{i as ot}from"./Terminal-1HZulC_H.js";import{s as ne}from"./Trash01-BUkAP1vf.js";import{I as k}from"./input-trZWilTG.js";import{S as st,a as rt,b as it,c as at,d as P}from"./select-reGYS0Ly.js";import{T as ct}from"./textarea-x7X_L353.js";import{g as lt}from"./generate-id-Dyweu44Y.js";import{i as dt,r as ut,E as mt,e as re}from"./env-vars-editor-BFfuzqB5.js";import"./collection-display-button-Cm0zQnM_.js";import"./ArrowUp-CC-2uYGu.js";import"./Check-BzMGOxMB.js";import"./Grid01-DmaR0g3f.js";import"./List-DZ53jWcW.js";import"./tooltip-Cw2xVvTD.js";import"./view-mode-toggle-BagEO4CJ.js";import"./SearchMd-D9E7kgub.js";import"./card-BmOa96dk.js";import"./binder-Cyeq_Zec.js";import"./use-mobile-VoJXvE1W.js";import"./useMutation-Lj_Cbq0P.js";import"./useQuery-C2zqJzGD.js";import"./X-DyyqPnhR.js";import"./ChevronDown-BV0rwdFr.js";import"./Plus-DAW17Fqf.js";const pt=se({key:y(),value:y()}),ht=se({title:y().min(1,"Name is required"),description:y().nullable().optional(),ui_type:Ne(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:y().optional(),connection_token:y().nullable().optional(),npx_package:y().optional(),stdio_command:y().optional(),stdio_args:y().optional(),stdio_cwd:y().optional(),env_vars:ke(pt).optional()}).refine(n=>n.ui_type==="NPX"?!!n.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(n=>n.ui_type==="STDIO"?!!n.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(n=>n.ui_type==="HTTP"||n.ui_type==="SSE"||n.ui_type==="Websocket"?!!n.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function E(n){const s=n.trim();if(!s)return"";try{const i=new URL(s),d=i.pathname.length>1?i.pathname.replace(/\/+$/,""):i.pathname;return`${i.origin}${d}`}catch{return s.replace(/\/+$/,"")}}function gt(n){const s=n.trim().split(/\s+/).filter(Boolean);if(s.length<2)return null;const i=s[0]?.toLowerCase();if(i!=="npx"&&i!=="bunx")return null;const m=s.slice(1).find(a=>!a.startsWith("-"));return m?{packageName:m}:null}function A(n){const{uiType:s}=n,i=E(n.connectionUrl??"");if((s==="HTTP"||s==="SSE"||s==="Websocket")&&i===E("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const d=(n.npxPackage??"").trim();return s==="NPX"&&d==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function oe(n){if(n.registryItems.length===0||n.uiType!=="HTTP"&&n.uiType!=="SSE"&&n.uiType!=="Websocket")return null;const s=E(n.connectionUrl??"");if(!s)return null;const i=n.registryItems.find(a=>(a.server?.remotes??[]).some(N=>E(N.url??"")===s));if(!i)return null;const d=i.title||i.name||i.server?.title||i.server?.name||"",m=i.server?.description||i.description||i.summary||null;return d?{id:"registry",title:d,description:m}:null}function xt(n,s){const i={command:"npx",args:["-y",n]},d=re(s);return Object.keys(d).length>0&&(i.envVars=d),i}function jt(n,s,i,d){const m={command:n};s.trim()&&(m.args=s.trim().split(/\s+/)),i?.trim()&&(m.cwd=i.trim());const a=re(d);return Object.keys(a).length>0&&(m.envVars=a),m}function ft(n){return n.command==="npx"}function yt(n){return n.args?.find(s=>!s.startsWith("-"))??""}function vt(n){return{command:n.command,args:n.args?.join(" ")??"",cwd:n.cwd??""}}function _t(n,s){switch(s.type){case"edit":return{mode:"editing",connection:s.connection};case"delete":return{mode:"deleting",connection:s.connection};case"close":return{mode:"idle"}}}function Ct(){const{org:n}=xe(),s=je(),i=fe({strict:!1}),{data:d}=ye.useSession(),{stdioEnabled:m}=ve(),a=$e({namespace:n.slug,resource:"connections"}),I=Ee(),N=Fe(a),[v,S]=B.useReducer(_t,{mode:"idle"}),z=Ve(N)[0],R=z?.id??"",U=et(z?.tools),ie=Oe({connectionId:R||null,orgId:n.id}),{data:ae}=Ae({client:ie,toolName:U,toolArguments:{limit:200},enabled:!!(R&&U),staleTime:3600*1e3,select:t=>t.structuredContent??t}),X=tt(ae??[]),L=i.action==="create",ce=()=>{s({to:"/$org/mcps",params:{org:n.slug},search:{action:"create"}})},W=()=>{s({to:"/$org/mcps",params:{org:n.slug},search:{}})},r=_e({resolver:Ce(ht),defaultValues:{title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),u=r.watch("ui_type"),K=r.watch("connection_url"),le=r.watch("npx_package"),b=A({uiType:u,connectionUrl:K??"",npxPackage:le??""})??oe({uiType:u,connectionUrl:K??"",registryItems:X}),l=v.mode==="editing"?v.connection:null;B.useEffect(()=>{if(l){const t=dt(l.connection_headers)?l.connection_headers:null;if(t&&l.connection_type==="STDIO"){const o=ut(t.envVars);if(ft(t)){const c=yt(t);r.reset({title:l.title,description:l.description,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:c,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:o})}else{const c=vt(t);r.reset({title:l.title,description:l.description,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:c.command,stdio_args:c.args,stdio_cwd:c.cwd,env_vars:o})}}else r.reset({title:l.title,description:l.description,ui_type:l.connection_type,connection_url:l.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else r.reset({title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[l,r]);const de=async()=>{if(v.mode!=="deleting")return;const t=v.connection.id;S({type:"close"});try{await I.delete.mutateAsync(t)}catch{}},ue=async t=>{let o,c=null,w=null,C=null;if(t.ui_type==="NPX"?(o="STDIO",c="",C=xt(t.npx_package||"",t.env_vars||[])):t.ui_type==="STDIO"?(o="STDIO",c="",C=jt(t.stdio_command||"",t.stdio_args||"",t.stdio_cwd,t.env_vars||[])):(o=t.ui_type,c=t.connection_url||"",w=t.connection_token||null),l){await I.update.mutateAsync({id:l.id,data:{title:t.title,description:t.description||null,connection_type:o,connection_url:c,...w&&{connection_token:w},...C&&{connection_headers:C}}}),S({type:"close"}),r.reset();return}const D=lt("conn");await I.create.mutateAsync({id:D,title:t.title,description:t.description||null,connection_type:o,connection_url:c,connection_token:w,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:d?.user?.id||"system",organization_id:n.id,icon:null,app_name:null,app_id:null,connection_headers:C,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),W(),r.reset(),s({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:D}})},G=t=>{t||(L?W():S({type:"close"}),r.reset())},V=t=>{const o=t.trim();if(!o)return;const c=!!r.formState.dirtyFields.title,w=!!r.formState.dirtyFields.description,C=!!r.formState.dirtyFields.env_vars,D=p=>{if(p&&(!c&&!r.getValues("title").trim()&&p.title&&r.setValue("title",p.title,{shouldDirty:!1}),!w&&!(r.getValues("description")??"").trim()&&p.description&&r.setValue("description",p.description,{shouldDirty:!1}),!C&&p.envVarKeys?.length)){const q=r.getValues("env_vars")??[],he=new Set(q.map(T=>T.key)),Y=p.envVarKeys.filter(T=>!he.has(T));Y.length>0&&r.setValue("env_vars",[...q,...Y.map(T=>({key:T,value:""}))],{shouldDirty:!0})}},F=gt(o);if(F&&m){r.setValue("ui_type","NPX",{shouldDirty:!0}),r.setValue("npx_package",F.packageName,{shouldDirty:!0}),r.setValue("connection_url","",{shouldDirty:!0}),r.setValue("connection_token",null,{shouldDirty:!0}),D(A({uiType:"NPX",npxPackage:F.packageName}));return}if(o.startsWith("http://")||o.startsWith("https://")){const p=u==="HTTP"||u==="SSE"||u==="Websocket"?u:"HTTP";r.setValue("ui_type",p,{shouldDirty:!0}),r.setValue("connection_url",o,{shouldDirty:!0}),D(A({uiType:p,connectionUrl:o})??oe({uiType:p,connectionUrl:o,registryItems:X}));return}u==="NPX"&&D(A({uiType:"NPX",npxPackage:o}))},me=[{id:"icon",header:"",render:t=>e.jsx(Pe,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:e.jsx(O,{})}),cellClassName:"w-16 shrink-0",wrap:!0},{id:"title",header:"Name",render:t=>e.jsx("span",{className:"text-sm font-medium text-foreground truncate block",title:t.title,children:t.title}),cellClassName:"w-48 max-w-48 min-w-0 shrink-0",sortable:!0},{id:"description",header:"Description",render:t=>e.jsx("span",{className:"text-sm text-foreground line-clamp-2",children:t.description||"—"}),cellClassName:"flex-1 min-w-0",wrap:!0,sortable:!0},{id:"connection_type",header:"Type",accessor:t=>e.jsx("span",{className:"text-sm font-medium",children:t.connection_type}),cellClassName:"w-24 shrink-0",sortable:!0},{id:"connection_url",header:"URL",render:t=>{const o=t.connection_url??"",c=o.length>40?`${o.slice(0,40)}...`:o;return e.jsx("span",{className:"text-sm text-muted-foreground",children:c})},cellClassName:"w-48 min-w-0 shrink-0"},{id:"status",header:"Status",render:t=>e.jsx(We,{variant:t.status==="active"?"success":"outline",children:t.status}),cellClassName:"w-24 shrink-0",sortable:!0},{id:"actions",header:"",render:t=>e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:o=>o.stopPropagation(),children:e.jsx(te,{size:20})})}),e.jsxs(ee,{align:"end",onClick:o=>o.stopPropagation(),children:[e.jsxs($,{onClick:o=>{o.stopPropagation(),s({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}})},children:[e.jsx(Q,{size:16}),"Open"]}),e.jsxs($,{variant:"destructive",onClick:o=>{o.stopPropagation(),S({type:"delete",connection:t})},children:[e.jsx(ne,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],pe=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{variant:"outline",onClick:()=>s({to:"/$org/store",params:{org:n.slug}}),size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Browse Store"}),e.jsx(_,{onClick:ce,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Custom Connection"})]});return e.jsxs(we,{children:[e.jsx(Ke,{open:L||v.mode==="editing",onOpenChange:G,children:e.jsxs(Ge,{className:"sm:max-w-[525px]",children:[e.jsxs(qe,{children:[e.jsx(Ye,{children:l?"Edit Connection":"Create Connection"}),e.jsx(Qe,{children:l?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below."})]}),e.jsx(Ze,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(ue),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(h,{control:r.control,name:"ui_type",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Type *"}),e.jsxs(st,{value:t.value,onValueChange:t.onChange,children:[e.jsx(j,{children:e.jsx(rt,{children:e.jsx(it,{})})}),e.jsxs(at,{children:[e.jsx(P,{value:"HTTP",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4"}),"HTTP"]})}),e.jsx(P,{value:"SSE",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4"}),"SSE"]})}),e.jsx(P,{value:"Websocket",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4"}),"Websocket"]})}),m&&e.jsxs(e.Fragment,{children:[e.jsx(P,{value:"NPX",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"w-4 h-4"}),"NPX Package"]})}),e.jsx(P,{value:"STDIO",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(ot,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),e.jsx(f,{})]})}),u==="NPX"&&e.jsx(e.Fragment,{children:e.jsx(h,{control:r.control,name:"npx_package",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"NPM Package *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"@perplexity-ai/mcp-server",...t,value:t.value??"",onPaste:o=>{const c=o.clipboardData.getData("text");c&&(o.preventDefault(),r.setValue("npx_package",c.trim(),{shouldDirty:!0}),V(c))},onBlur:o=>{V(o.target.value),t.onBlur()}})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The npm package to run with npx"}),e.jsx(f,{})]})})}),u==="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[e.jsx(h,{control:r.control,name:"stdio_command",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Command *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"node, bun, python...",...t,value:t.value??""})}),e.jsx(f,{})]})}),e.jsx(h,{control:r.control,name:"stdio_args",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Arguments"}),e.jsx(j,{children:e.jsx(k,{placeholder:"arg1 arg2 --flag value",...t,value:t.value??""})}),e.jsx(f,{})]})})]}),e.jsx(h,{control:r.control,name:"stdio_cwd",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Working Directory"}),e.jsx(j,{children:e.jsx(k,{placeholder:"/path/to/project (optional)",...t,value:t.value??""})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),e.jsx(f,{})]})})]}),(u==="NPX"||u==="STDIO")&&e.jsx(h,{control:r.control,name:"env_vars",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Environment Variables"}),e.jsx(j,{children:e.jsx(mt,{value:t.value??[],onChange:t.onChange})}),e.jsx(f,{})]})}),u!=="NPX"&&u!=="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsx(h,{control:r.control,name:"connection_url",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"URL *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"https://example.com/mcp",...t,value:t.value??"",onPaste:o=>{const c=o.clipboardData.getData("text");c&&(o.preventDefault(),r.setValue("connection_url",c.trim(),{shouldDirty:!0}),V(c))},onBlur:o=>{V(o.target.value),t.onBlur()}})}),e.jsx(f,{})]})}),e.jsx(h,{control:r.control,name:"connection_token",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:b?.token?.label??"Token (optional)"}),e.jsx(j,{children:e.jsx(k,{type:"password",placeholder:b?.token?.placeholder??"Bearer token or API key",...t,value:t.value??""})}),b?.token?.helperText&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.token.helperText,b.id==="github"&&e.jsxs(e.Fragment,{children:[" ","·"," ",e.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),e.jsx(f,{})]})})]}),e.jsx(h,{control:r.control,name:"title",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Name *"}),e.jsx(j,{children:e.jsx(k,{placeholder:"My Connection",...t})}),e.jsx(f,{})]})}),e.jsx(h,{control:r.control,name:"description",render:({field:t})=>e.jsxs(g,{children:[e.jsx(x,{children:"Description"}),e.jsx(j,{children:e.jsx(ct,{placeholder:"A brief description of this connection",rows:3,...t,value:t.value??""})}),e.jsx(f,{})]})})]}),e.jsxs(Je,{children:[e.jsx(_,{type:"button",variant:"outline",onClick:()=>G(!1),children:"Cancel"}),e.jsx(_,{type:"submit",disabled:r.formState.isSubmitting,className:"min-w-40",children:r.formState.isSubmitting?"Saving...":l?"Update Connection":"Create Connection"})]})]})})]})}),e.jsx(He,{open:v.mode==="deleting",onOpenChange:t=>!t&&S({type:"close"}),children:e.jsxs(Me,{children:[e.jsxs(Be,{children:[e.jsx(ze,{children:"Delete Connection?"}),e.jsxs(Re,{children:["This action cannot be undone. This will permanently delete"," ",e.jsx("span",{className:"font-medium text-foreground",children:v.mode==="deleting"&&v.connection.title}),"."]})]}),e.jsxs(Ue,{children:[e.jsx(Xe,{children:"Cancel"}),e.jsx(Le,{onClick:de,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e.jsx(Se,{title:"Connections",viewMode:a.viewMode,onViewModeChange:a.setViewMode,sortKey:a.sortKey,sortDirection:a.sortDirection,onSort:a.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"status",label:"Status"}],ctaButton:pe}),e.jsx(De,{value:a.search,onChange:a.setSearch,placeholder:"Search for a Connection...",onKeyDown:t=>{t.key==="Escape"&&(a.setSearch(""),t.target.blur())}}),a.viewMode==="cards"?e.jsx("div",{className:"flex-1 overflow-auto p-5",children:N.length===0?e.jsx(H,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:(a.search,"No Connections found"),description:a.search?`No Connections match "${a.search}"`:"Create a connection to get started.",actions:!a.search&&e.jsx(_,{variant:"outline",onClick:()=>s({to:"/$org/store",params:{org:n.slug}}),children:"Browse Store"})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:N.map(t=>e.jsx(Te,{connection:t,fallbackIcon:e.jsx(O,{}),onClick:()=>s({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}}),headerActions:e.jsxs(J,{children:[e.jsx(Z,{asChild:!0,children:e.jsx(_,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:o=>o.stopPropagation(),children:e.jsx(te,{size:20})})}),e.jsxs(ee,{align:"end",onClick:o=>o.stopPropagation(),children:[e.jsxs($,{onClick:o=>{o.stopPropagation(),s({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}})},children:[e.jsx(Q,{size:16}),"Open"]}),e.jsxs($,{variant:"destructive",onClick:o=>{o.stopPropagation(),S({type:"delete",connection:t})},children:[e.jsx(ne,{size:16}),"Delete"]})]})]})},t.id))})}):e.jsx(be,{columns:me,data:N,isLoading:!1,sortKey:a.sortKey,sortDirection:a.sortDirection,onSort:a.handleSort,onRowClick:t=>s({to:"/$org/mcps/$connectionId",params:{org:n.slug,connectionId:t.id}}),emptyState:a.search?e.jsx(H,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:`No Connections match "${a.search}"`}):e.jsx(H,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:"Create a connection to get started.",actions:e.jsx(_,{variant:"outline",onClick:()=>s({to:"/$org/store",params:{org:n.slug}}),children:"Browse Store"})})})]})}function gn(){const n=ge.c(1);let s;return n[0]===Symbol.for("react.memo_cache_sentinel")?(s=e.jsx(Ie,{children:e.jsx(B.Suspense,{fallback:e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(nt,{size:32,className:"animate-spin text-muted-foreground"})}),children:e.jsx(Ct,{})})}),n[0]=s):s=n[0],s}export{gn as default};
@@ -1 +1 @@
1
- import{b7 as d,c as g,q as f,b8 as h}from"./index-M3wOD-T-.js";const u={authConfig:()=>["authConfig"],threads:t=>["threads",t],virtualMcpThreads:(t,e)=>["threads",t,"virtual-mcp",e],thread:(t,e)=>["thread",t,e],threadMessages:(t,e)=>["thread-messages",t,e],messages:t=>["messages",t],organizations:()=>["organizations"],members:t=>[t,"members"],invitations:t=>[t,"invitations"],organizationRoles:t=>[t,"organization-roles"],connections:t=>[t,"connections"],connectionsByBinding:(t,e)=>[t,"connections",`binding:${e}`],connection:(t,e)=>[t,"connection",e],isMCPAuthenticated:(t,e)=>["is-mcp-authenticated",t,e],mcpTools:(t,e)=>["mcp","tools",t,e],mcpClient:(t,e,n,o)=>["mcp","client",t,e,n,o],mcpToolsList:t=>["mcp","client",t,"tools"],mcpResourcesList:t=>["mcp","client",t,"resources"],mcpPromptsList:t=>["mcp","client",t,"prompts"],mcpReadResource:(t,e)=>["mcp","client",t,"resource",e],mcpGetPrompt:(t,e,n)=>["mcp","client",t,"prompt",e,n],mcpToolCall:(t,e,n)=>["mcp","client",t,"tool-call",e,n],organizationSettings:t=>["organization-settings",t],activeOrganization:t=>["activeOrganization",t],modelsList:t=>["models-list",t],connectionCollections:t=>[t,"collections","discovery"],toolCall:(t,e,n)=>["tool-call",t,e,n],collectionItems:(t,e)=>["collection",t,e],collection:(t,e,n)=>[t,e,"collection",n],collectionItem:(t,e,n,o,i)=>[t,e,n,"collection",o,i],collectionList:(t,e,n,o,i)=>[t,e,n,"collection",o,"list",i],collectionListInfinite:(t,e,n,o,i)=>[t,e,n,"collection",o,"list-infinite",i],githubReadme:(t,e)=>["github-readme",t,e],monitoringStats:()=>["monitoring","stats"],monitoringLogs:t=>["monitoring","logs",t],monitoringLogsInfinite:(t,e)=>["monitoring","logs-infinite",t,e],virtualMcpPrompts:t=>["virtual-mcp",t,"prompts"],connectionPrompts:t=>["connection",t,"prompts"],connectionResources:t=>["connection",t,"resources"],user:t=>["user",t]};class _ extends d{constructor(e,n){super(e,n)}send(e,n){const o=y(e);return o?.type==="emit"?(this.onmessage?.(o.message),Promise.resolve()):o?.type==="suppress"?Promise.resolve():super.send(e,n)}}function y(t){const e=t;if(!e||typeof e!="object"||!("method"in e))return null;switch(e.method){case"initialize":{const n=e?.params?.protocolVersion;return n?{type:"emit",message:{result:{protocolVersion:n,capabilities:{tools:{},resources:{},prompts:{},tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}},serverInfo:{name:"mesh-virtual-mcp",version:"1.0.0"}},jsonrpc:e.jsonrpc??"2.0",id:e.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}const b={name:"mesh-sdk",version:"1.0.0"};function C(t,e){const n=e??(typeof window<"u"?window.location.origin:void 0);if(!n)throw new Error("MCP client requires either meshUrl option or a browser environment.");const o=t?`/mcp/${t}`:"/mcp";return new URL(o,n).href}async function T({connectionId:t,orgId:e,token:n,meshUrl:o}){const i=C(t,o),c=new h(b,{capabilities:{tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}}}),s=new _(new URL(i),{requestInit:{headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream","x-org-id":e,...n?{Authorization:`Bearer ${n}`}:{}}}});await c.connect(s);const a=u.mcpClient(e,t??"self",n??"",o??"");return c.toJSON=()=>`mcp-client:${a.join(":")}`,c}function S(t){const e=g.c(13),{connectionId:n,orgId:o,token:i,meshUrl:c}=t;let s;e[0]!==n||e[1]!==c||e[2]!==o||e[3]!==i?(s=u.mcpClient(o,n??"",i??"",c??""),e[0]=n,e[1]=c,e[2]=o,e[3]=i,e[4]=s):s=e[4];const a=s;let r;e[5]!==n||e[6]!==c||e[7]!==o||e[8]!==i?(r=()=>T({connectionId:n,orgId:o,token:i,meshUrl:c}),e[5]=n,e[6]=c,e[7]=o,e[8]=i,e[9]=r):r=e[9];let l;e[10]!==a||e[11]!==r?(l={queryKey:a,queryFn:r,staleTime:1/0,gcTime:0},e[10]=a,e[11]=r,e[12]=l):l=e[12];const{data:m}=f(l);return m}const P={SELF:t=>`${t}_self`,REGISTRY:t=>`${t}_registry`,COMMUNITY_REGISTRY:t=>`${t}_community-registry`,DEV_ASSETS:t=>`${t}_dev-assets`},M="self";function R(t){return{id:P.REGISTRY(t),title:"Deco Store",description:"Official deco MCP registry with curated integrations",connection_type:"HTTP",connection_url:"https://api.decocms.com/mcp/registry",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 I(){return{id:"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 L(t={}){return{id:t.id,title:"OpenRouter",description:"Access hundreds of LLM models from a single API",icon:"https://openrouter.ai/favicon.ico",app_name:"openrouter",app_id:"openrouter",connection_type:"HTTP",connection_url:"https://sites-openrouter.decocache.com/mcp",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 E(t){return{id:v(t),organization_id:t,title:"Decopilot",description:"Default agent that aggregates all organization connections",icon:"https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",status:"active",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:"system",updated_by:void 0,connections:[]}}const p="decopilot_";function A(t){return!t||!t.startsWith(p)?null:t.slice(p.length)||null}function v(t){return`${p}${t}`}export{u as K,_ as S,P as W,M as a,I as b,T as c,E as d,D as e,L as f,v as g,R as h,A as i,S as u};
1
+ import{b7 as d,c as g,q as f,b8 as h}from"./index-Dho9MRVw.js";const u={authConfig:()=>["authConfig"],threads:t=>["threads",t],virtualMcpThreads:(t,e)=>["threads",t,"virtual-mcp",e],thread:(t,e)=>["thread",t,e],threadMessages:(t,e)=>["thread-messages",t,e],messages:t=>["messages",t],organizations:()=>["organizations"],members:t=>[t,"members"],invitations:t=>[t,"invitations"],organizationRoles:t=>[t,"organization-roles"],connections:t=>[t,"connections"],connectionsByBinding:(t,e)=>[t,"connections",`binding:${e}`],connection:(t,e)=>[t,"connection",e],isMCPAuthenticated:(t,e)=>["is-mcp-authenticated",t,e],mcpTools:(t,e)=>["mcp","tools",t,e],mcpClient:(t,e,n,o)=>["mcp","client",t,e,n,o],mcpToolsList:t=>["mcp","client",t,"tools"],mcpResourcesList:t=>["mcp","client",t,"resources"],mcpPromptsList:t=>["mcp","client",t,"prompts"],mcpReadResource:(t,e)=>["mcp","client",t,"resource",e],mcpGetPrompt:(t,e,n)=>["mcp","client",t,"prompt",e,n],mcpToolCall:(t,e,n)=>["mcp","client",t,"tool-call",e,n],organizationSettings:t=>["organization-settings",t],activeOrganization:t=>["activeOrganization",t],modelsList:t=>["models-list",t],connectionCollections:t=>[t,"collections","discovery"],toolCall:(t,e,n)=>["tool-call",t,e,n],collectionItems:(t,e)=>["collection",t,e],collection:(t,e,n)=>[t,e,"collection",n],collectionItem:(t,e,n,o,i)=>[t,e,n,"collection",o,i],collectionList:(t,e,n,o,i)=>[t,e,n,"collection",o,"list",i],collectionListInfinite:(t,e,n,o,i)=>[t,e,n,"collection",o,"list-infinite",i],githubReadme:(t,e)=>["github-readme",t,e],monitoringStats:()=>["monitoring","stats"],monitoringLogs:t=>["monitoring","logs",t],monitoringLogsInfinite:(t,e)=>["monitoring","logs-infinite",t,e],virtualMcpPrompts:t=>["virtual-mcp",t,"prompts"],connectionPrompts:t=>["connection",t,"prompts"],connectionResources:t=>["connection",t,"resources"],user:t=>["user",t]};class _ extends d{constructor(e,n){super(e,n)}send(e,n){const o=y(e);return o?.type==="emit"?(this.onmessage?.(o.message),Promise.resolve()):o?.type==="suppress"?Promise.resolve():super.send(e,n)}}function y(t){const e=t;if(!e||typeof e!="object"||!("method"in e))return null;switch(e.method){case"initialize":{const n=e?.params?.protocolVersion;return n?{type:"emit",message:{result:{protocolVersion:n,capabilities:{tools:{},resources:{},prompts:{},tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}},serverInfo:{name:"mesh-virtual-mcp",version:"1.0.0"}},jsonrpc:e.jsonrpc??"2.0",id:e.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}const b={name:"mesh-sdk",version:"1.0.0"};function C(t,e){const n=e??(typeof window<"u"?window.location.origin:void 0);if(!n)throw new Error("MCP client requires either meshUrl option or a browser environment.");const o=t?`/mcp/${t}`:"/mcp";return new URL(o,n).href}async function T({connectionId:t,orgId:e,token:n,meshUrl:o}){const i=C(t,o),c=new h(b,{capabilities:{tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}}}),s=new _(new URL(i),{requestInit:{headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream","x-org-id":e,...n?{Authorization:`Bearer ${n}`}:{}}}});await c.connect(s);const a=u.mcpClient(e,t??"self",n??"",o??"");return c.toJSON=()=>`mcp-client:${a.join(":")}`,c}function S(t){const e=g.c(13),{connectionId:n,orgId:o,token:i,meshUrl:c}=t;let s;e[0]!==n||e[1]!==c||e[2]!==o||e[3]!==i?(s=u.mcpClient(o,n??"",i??"",c??""),e[0]=n,e[1]=c,e[2]=o,e[3]=i,e[4]=s):s=e[4];const a=s;let r;e[5]!==n||e[6]!==c||e[7]!==o||e[8]!==i?(r=()=>T({connectionId:n,orgId:o,token:i,meshUrl:c}),e[5]=n,e[6]=c,e[7]=o,e[8]=i,e[9]=r):r=e[9];let l;e[10]!==a||e[11]!==r?(l={queryKey:a,queryFn:r,staleTime:1/0,gcTime:0},e[10]=a,e[11]=r,e[12]=l):l=e[12];const{data:m}=f(l);return m}const P={SELF:t=>`${t}_self`,REGISTRY:t=>`${t}_registry`,COMMUNITY_REGISTRY:t=>`${t}_community-registry`,DEV_ASSETS:t=>`${t}_dev-assets`},M="self";function R(t){return{id:P.REGISTRY(t),title:"Deco Store",description:"Official deco MCP registry with curated integrations",connection_type:"HTTP",connection_url:"https://api.decocms.com/mcp/registry",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 I(){return{id:"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 L(t={}){return{id:t.id,title:"OpenRouter",description:"Access hundreds of LLM models from a single API",icon:"https://openrouter.ai/favicon.ico",app_name:"openrouter",app_id:"openrouter",connection_type:"HTTP",connection_url:"https://sites-openrouter.decocache.com/mcp",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 E(t){return{id:v(t),organization_id:t,title:"Decopilot",description:"Default agent that aggregates all organization connections",icon:"https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",status:"active",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:"system",updated_by:void 0,connections:[]}}const p="decopilot_";function A(t){return!t||!t.startsWith(p)?null:t.slice(p.length)||null}function v(t){return`${p}${t}`}export{u as K,_ as S,P as W,M as a,I as b,T as c,E as d,D as e,L as f,v as g,R as h,A as i,S as u};
@@ -0,0 +1 @@
1
+ import{$ as a,a0 as t}from"./index-Dho9MRVw.js";const e=a(t,{target:"draft-7"});export{e as B};
@@ -1 +1 @@
1
- import{o as A,s as D,c as O,h as v,k as E,j as r,g as N}from"./index-M3wOD-T-.js";import{A as I,a as M,b as L,c as R,d as T,e as $,f as k}from"./alert-dialog-DZDASW_Y.js";import{B}from"./button-CrpAre8y.js";import{F as V,a as q,b as H,c as U,d as G,e as J,f as K}from"./form-DQQrIzsV.js";import{I as P}from"./input-YM08EPCC.js";import{S as Q}from"./spinner-B3atGTOQ.js";import{u as W}from"./useMutation-i3JyomhH.js";function _(o){return o.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const X=A({name:D().min(2,"Organization name is required")});function ne(o){const e=O.c(41),{open:a,onOpenChange:s}=o;let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j={resolver:v(X),defaultValues:{name:""}},e[0]=j):j=e[0];const t=E(j);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={mutationFn:Z,onSuccess:Y},e[1]=w):w=e[1];const i=W(w),z=i.error instanceof Error?i.error.message:i.error?"Failed to create organization.":null;let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=r.jsxs(L,{children:[r.jsx(R,{children:"Create a new organization"}),r.jsx(T,{children:"Set up a new organization to collaborate with others."})]}),e[2]=F):F=e[2];let n;if(e[3]!==i||e[4]!==t){let x;e[6]!==i?(x=b=>i.mutateAsync(b),e[6]=i,e[7]=x):x=e[7],n=t.handleSubmit(x),e[3]=i,e[4]=t,e[5]=n}else n=e[5];let l;e[8]!==t.formState.isSubmitting?(l=x=>{const{field:b}=x;return r.jsxs(H,{children:[r.jsx(U,{children:"Organization Name"}),r.jsx(G,{children:r.jsx(P,{...b,placeholder:"Acme Inc.",disabled:t.formState.isSubmitting})}),r.jsx(J,{children:"The name of your company or organization"}),b.value&&r.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",r.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",_(b.value)]})]}),r.jsx(K,{})]})},e[8]=t.formState.isSubmitting,e[9]=l):l=e[9];let m;e[10]!==t.control||e[11]!==l?(m=r.jsx(V,{control:t.control,name:"name",render:l}),e[10]=t.control,e[11]=l,e[12]=m):m=e[12];let c;e[13]!==z?(c=z&&r.jsx("div",{className:"text-destructive text-sm mt-2",children:z}),e[13]=z,e[14]=c):c=e[14];let f;e[15]!==i||e[16]!==t?(f=()=>{i.reset(),t.reset()},e[15]=i,e[16]=t,e[17]=f):f=e[17];let g;e[18]!==t.formState.isSubmitting||e[19]!==f?(g=r.jsx(I,{disabled:t.formState.isSubmitting,onClick:f,children:"Cancel"}),e[18]=t.formState.isSubmitting,e[19]=f,e[20]=g):g=e[20];const y=!t.formState.isValid||t.formState.isSubmitting;let u;e[21]!==t.formState.isSubmitting?(u=t.formState.isSubmitting?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Q,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=t.formState.isSubmitting,e[22]=u):u=e[22];let d;e[23]!==y||e[24]!==u?(d=r.jsx(B,{type:"submit",variant:"default",disabled:y,children:u}),e[23]=y,e[24]=u,e[25]=d):d=e[25];let h;e[26]!==d||e[27]!==g?(h=r.jsxs($,{children:[g,d]}),e[26]=d,e[27]=g,e[28]=h):h=e[28];let S;e[29]!==h||e[30]!==n||e[31]!==m||e[32]!==c?(S=r.jsxs("form",{className:"space-y-6",onSubmit:n,autoComplete:"off",children:[m,c,h]}),e[29]=h,e[30]=n,e[31]=m,e[32]=c,e[33]=S):S=e[33];let p;e[34]!==t||e[35]!==S?(p=r.jsxs(M,{children:[F,r.jsx(q,{...t,children:S})]}),e[34]=t,e[35]=S,e[36]=p):p=e[36];let C;return e[37]!==s||e[38]!==a||e[39]!==p?(C=r.jsx(k,{open:a,onOpenChange:s,children:p}),e[37]=s,e[38]=a,e[39]=p,e[40]=C):C=e[40],C}function Y(o){const{orgSlug:e}=o;window.location.href=`/${e}`}async function Z(o){const e=_(o.name);if(!e)throw new Error("Organization slug is invalid");const a=await N.organization.create({name:o.name,slug:e});if(a?.error)throw new Error(a.error.message||"Failed to create organization");const s=a?.data?.slug??e;if(!s)throw new Error("Failed to create organization");return{orgSlug:s}}export{ne as C};
1
+ import{o as A,s as D,c as O,h as v,k as E,j as r,g as N}from"./index-Dho9MRVw.js";import{A as I,a as M,b as L,c as R,d as T,e as $,f as k}from"./alert-dialog-QzYPe_ae.js";import{B}from"./button-D_0RTXDt.js";import{F as V,a as q,b as H,c as U,d as G,e as J,f as K}from"./form-DngqlMy0.js";import{I as P}from"./input-trZWilTG.js";import{S as Q}from"./spinner-E8mBz_Z6.js";import{u as W}from"./useMutation-Lj_Cbq0P.js";function _(o){return o.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const X=A({name:D().min(2,"Organization name is required")});function ne(o){const e=O.c(41),{open:a,onOpenChange:s}=o;let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j={resolver:v(X),defaultValues:{name:""}},e[0]=j):j=e[0];const t=E(j);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={mutationFn:Z,onSuccess:Y},e[1]=w):w=e[1];const i=W(w),z=i.error instanceof Error?i.error.message:i.error?"Failed to create organization.":null;let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=r.jsxs(L,{children:[r.jsx(R,{children:"Create a new organization"}),r.jsx(T,{children:"Set up a new organization to collaborate with others."})]}),e[2]=F):F=e[2];let n;if(e[3]!==i||e[4]!==t){let x;e[6]!==i?(x=b=>i.mutateAsync(b),e[6]=i,e[7]=x):x=e[7],n=t.handleSubmit(x),e[3]=i,e[4]=t,e[5]=n}else n=e[5];let l;e[8]!==t.formState.isSubmitting?(l=x=>{const{field:b}=x;return r.jsxs(H,{children:[r.jsx(U,{children:"Organization Name"}),r.jsx(G,{children:r.jsx(P,{...b,placeholder:"Acme Inc.",disabled:t.formState.isSubmitting})}),r.jsx(J,{children:"The name of your company or organization"}),b.value&&r.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",r.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",_(b.value)]})]}),r.jsx(K,{})]})},e[8]=t.formState.isSubmitting,e[9]=l):l=e[9];let m;e[10]!==t.control||e[11]!==l?(m=r.jsx(V,{control:t.control,name:"name",render:l}),e[10]=t.control,e[11]=l,e[12]=m):m=e[12];let c;e[13]!==z?(c=z&&r.jsx("div",{className:"text-destructive text-sm mt-2",children:z}),e[13]=z,e[14]=c):c=e[14];let f;e[15]!==i||e[16]!==t?(f=()=>{i.reset(),t.reset()},e[15]=i,e[16]=t,e[17]=f):f=e[17];let g;e[18]!==t.formState.isSubmitting||e[19]!==f?(g=r.jsx(I,{disabled:t.formState.isSubmitting,onClick:f,children:"Cancel"}),e[18]=t.formState.isSubmitting,e[19]=f,e[20]=g):g=e[20];const y=!t.formState.isValid||t.formState.isSubmitting;let u;e[21]!==t.formState.isSubmitting?(u=t.formState.isSubmitting?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Q,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=t.formState.isSubmitting,e[22]=u):u=e[22];let d;e[23]!==y||e[24]!==u?(d=r.jsx(B,{type:"submit",variant:"default",disabled:y,children:u}),e[23]=y,e[24]=u,e[25]=d):d=e[25];let h;e[26]!==d||e[27]!==g?(h=r.jsxs($,{children:[g,d]}),e[26]=d,e[27]=g,e[28]=h):h=e[28];let S;e[29]!==h||e[30]!==n||e[31]!==m||e[32]!==c?(S=r.jsxs("form",{className:"space-y-6",onSubmit:n,autoComplete:"off",children:[m,c,h]}),e[29]=h,e[30]=n,e[31]=m,e[32]=c,e[33]=S):S=e[33];let p;e[34]!==t||e[35]!==S?(p=r.jsxs(M,{children:[F,r.jsx(q,{...t,children:S})]}),e[34]=t,e[35]=S,e[36]=p):p=e[36];let C;return e[37]!==s||e[38]!==a||e[39]!==p?(C=r.jsx(k,{open:a,onOpenChange:s,children:p}),e[37]=s,e[38]=a,e[39]=p,e[40]=C):C=e[40],C}function Y(o){const{orgSlug:e}=o;window.location.href=`/${e}`}async function Z(o){const e=_(o.name);if(!e)throw new Error("Organization slug is invalid");const a=await N.organization.create({name:o.name,slug:e});if(a?.error)throw new Error(a.error.message||"Failed to create organization");const s=a?.data?.slug??e;if(!s)throw new Error("Failed to create organization");return{orgSlug:s}}export{ne as C};
@@ -1 +1 @@
1
- import{c as n,j as i,H as u,J as m,T as x,M as j,Q as N,U as b,V as D,W as g}from"./index-M3wOD-T-.js";import{i as h}from"./X-DhTQLdE5.js";import{c}from"./button-CrpAre8y.js";function k(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(u,{"data-slot":"dialog",...t}),e[2]=t,e[3]=s):s=e[3],s}function w(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(D,{"data-slot":"dialog-trigger",...t}),e[2]=t,e[3]=s):s=e[3],s}function v(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(N,{"data-slot":"dialog-portal",...t}),e[2]=t,e[3]=s):s=e[3],s}function T(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(g,{"data-slot":"dialog-close",...t}),e[2]=t,e[3]=s):s=e[3],s}function y(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("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-background/60 backdrop-blur-[0.5px]",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(b,{"data-slot":"dialog-overlay",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function $(l){const e=n.c(6),{className:t}=l;let s;e[0]!==t?(s=c("cursor-pointer ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground","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 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[0]=t,e[1]=s):s=e[1];let a,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(h,{}),o=i.jsx("span",{className:"sr-only",children:"Close"}),e[2]=a,e[3]=o):(a=e[2],o=e[3]);let r;return e[4]!==s?(r=i.jsxs(g,{className:s,children:[a,o]}),e[4]=s,e[5]=r):r=e[5],r}function R(l){const e=n.c(15);let t,s,a,o;e[0]!==l?({className:s,children:t,closeButtonClassName:a,...o}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a,e[4]=o):(t=e[1],s=e[2],a=e[3],o=e[4]);let r;e[5]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(y,{}),e[5]=r):r=e[5];let d;e[6]!==s?(d=c("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border p-6 shadow-md duration-200 sm:max-w-lg",s),e[6]=s,e[7]=d):d=e[7];let f;e[8]!==a?(f=i.jsx($,{className:a}),e[8]=a,e[9]=f):f=e[9];let p;return e[10]!==t||e[11]!==o||e[12]!==d||e[13]!==f?(p=i.jsxs(v,{"data-slot":"dialog-portal",children:[r,i.jsxs(m,{"data-slot":"dialog-content",className:d,...o,children:[t,f]})]}),e[10]=t,e[11]=o,e[12]=d,e[13]=f,e[14]=p):p=e[14],p}function B(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col gap-2 text-center sm:text-left",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-header",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function E(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-footer",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function H(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-lg leading-none font-semibold",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(x,{"data-slot":"dialog-title",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function O(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-muted-foreground text-sm",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(j,{"data-slot":"dialog-description",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}export{k as D,R as a,B as b,H as c,O as d,E as e,w as f,T as g};
1
+ import{c as n,j as i,H as u,J as m,T as x,M as j,Q as N,U as b,V as D,W as g}from"./index-Dho9MRVw.js";import{i as h}from"./X-DyyqPnhR.js";import{c}from"./button-D_0RTXDt.js";function k(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(u,{"data-slot":"dialog",...t}),e[2]=t,e[3]=s):s=e[3],s}function w(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(D,{"data-slot":"dialog-trigger",...t}),e[2]=t,e[3]=s):s=e[3],s}function v(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(N,{"data-slot":"dialog-portal",...t}),e[2]=t,e[3]=s):s=e[3],s}function T(l){const e=n.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=i.jsx(g,{"data-slot":"dialog-close",...t}),e[2]=t,e[3]=s):s=e[3],s}function y(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("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-background/60 backdrop-blur-[0.5px]",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(b,{"data-slot":"dialog-overlay",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function $(l){const e=n.c(6),{className:t}=l;let s;e[0]!==t?(s=c("cursor-pointer ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground","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 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[0]=t,e[1]=s):s=e[1];let a,o;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx(h,{}),o=i.jsx("span",{className:"sr-only",children:"Close"}),e[2]=a,e[3]=o):(a=e[2],o=e[3]);let r;return e[4]!==s?(r=i.jsxs(g,{className:s,children:[a,o]}),e[4]=s,e[5]=r):r=e[5],r}function R(l){const e=n.c(15);let t,s,a,o;e[0]!==l?({className:s,children:t,closeButtonClassName:a,...o}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a,e[4]=o):(t=e[1],s=e[2],a=e[3],o=e[4]);let r;e[5]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(y,{}),e[5]=r):r=e[5];let d;e[6]!==s?(d=c("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border p-6 shadow-md duration-200 sm:max-w-lg",s),e[6]=s,e[7]=d):d=e[7];let f;e[8]!==a?(f=i.jsx($,{className:a}),e[8]=a,e[9]=f):f=e[9];let p;return e[10]!==t||e[11]!==o||e[12]!==d||e[13]!==f?(p=i.jsxs(v,{"data-slot":"dialog-portal",children:[r,i.jsxs(m,{"data-slot":"dialog-content",className:d,...o,children:[t,f]})]}),e[10]=t,e[11]=o,e[12]=d,e[13]=f,e[14]=p):p=e[14],p}function B(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col gap-2 text-center sm:text-left",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-header",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function E(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx("div",{"data-slot":"dialog-footer",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function H(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-lg leading-none font-semibold",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(x,{"data-slot":"dialog-title",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}function O(l){const e=n.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=c("text-muted-foreground text-sm",t),e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==s||e[6]!==a?(o=i.jsx(j,{"data-slot":"dialog-description",className:a,...s}),e[5]=s,e[6]=a,e[7]=o):o=e[7],o}export{k as D,R as a,B as b,H as c,O as d,E as e,w as f,T as g};
@@ -1 +1 @@
1
- import{c,j as i,a1 as p,a2 as f,a3 as m,a4 as g,a5 as x,a6 as v,a7 as b,a8 as w,a9 as h}from"./index-M3wOD-T-.js";import{i as j}from"./Grid01-BRgRtmbs.js";import{c as u}from"./button-CrpAre8y.js";function S(s){const e=c.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let a;return e[2]!==t?(a=i.jsx(p,{"data-slot":"dropdown-menu",...t}),e[2]=t,e[3]=a):a=e[3],a}function M(s){const e=c.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let a;return e[2]!==t?(a=i.jsx(f,{"data-slot":"dropdown-menu-trigger",...t}),e[2]=t,e[3]=a):a=e[3],a}function $(s){const e=c.c(10);let t,a,o;e[0]!==s?({className:t,sideOffset:o,...a}=s,e[0]=s,e[1]=t,e[2]=a,e[3]=o):(t=e[1],a=e[2],o=e[3]);const n=o===void 0?4:o;let r;e[4]!==t?(r=u("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border p-1 shadow-md",t),e[4]=t,e[5]=r):r=e[5];let d;return e[6]!==a||e[7]!==n||e[8]!==r?(d=i.jsx(m,{children:i.jsx(g,{"data-slot":"dropdown-menu-content",sideOffset:n,className:r,...a})}),e[6]=a,e[7]=n,e[8]=r,e[9]=d):d=e[9],d}function y(s){const e=c.c(12);let t,a,o,n;e[0]!==s?({className:t,inset:a,variant:n,...o}=s,e[0]=s,e[1]=t,e[2]=a,e[3]=o,e[4]=n):(t=e[1],a=e[2],o=e[3],n=e[4]);const r=n===void 0?"default":n;let d;e[5]!==t?(d=u("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-pointer 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",t),e[5]=t,e[6]=d):d=e[6];let l;return e[7]!==a||e[8]!==o||e[9]!==d||e[10]!==r?(l=i.jsx(x,{"data-slot":"dropdown-menu-item","data-inset":a,"data-variant":r,className:d,...o}),e[7]=a,e[8]=o,e[9]=d,e[10]=r,e[11]=l):l=e[11],l}function _(s){const e=c.c(8);let t,a;e[0]!==s?({className:t,...a}=s,e[0]=s,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=u("bg-border -mx-1 my-1 h-px",t),e[3]=t,e[4]=o):o=e[4];let n;return e[5]!==a||e[6]!==o?(n=i.jsx(h,{"data-slot":"dropdown-menu-separator",className:o,...a}),e[5]=a,e[6]=o,e[7]=n):n=e[7],n}function C(s){const e=c.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let a;return e[2]!==t?(a=i.jsx(v,{"data-slot":"dropdown-menu-sub",...t}),e[2]=t,e[3]=a):a=e[3],a}function T(s){const e=c.c(13);let t,a,o,n;e[0]!==s?({className:a,inset:o,children:t,...n}=s,e[0]=s,e[1]=t,e[2]=a,e[3]=o,e[4]=n):(t=e[1],a=e[2],o=e[3],n=e[4]);let r;e[5]!==a?(r=u("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-lg px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",a),e[5]=a,e[6]=r):r=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(j,{className:"ml-auto size-4"}),e[7]=d):d=e[7];let l;return e[8]!==t||e[9]!==o||e[10]!==n||e[11]!==r?(l=i.jsxs(b,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:r,...n,children:[t,d]}),e[8]=t,e[9]=o,e[10]=n,e[11]=r,e[12]=l):l=e[12],l}function R(s){const e=c.c(8);let t,a;e[0]!==s?({className:t,...a}=s,e[0]=s,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=u("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",t),e[3]=t,e[4]=o):o=e[4];let n;return e[5]!==a||e[6]!==o?(n=i.jsx(w,{"data-slot":"dropdown-menu-sub-content",className:o,...a}),e[5]=a,e[6]=o,e[7]=n):n=e[7],n}export{S as D,M as a,$ as b,y as c,C as d,T as e,R as f,_ as g};
1
+ import{c,j as i,a1 as p,a2 as f,a3 as m,a4 as g,a5 as x,a6 as v,a7 as b,a8 as w,a9 as h}from"./index-Dho9MRVw.js";import{i as j}from"./Grid01-DmaR0g3f.js";import{c as u}from"./button-D_0RTXDt.js";function S(s){const e=c.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let a;return e[2]!==t?(a=i.jsx(p,{"data-slot":"dropdown-menu",...t}),e[2]=t,e[3]=a):a=e[3],a}function M(s){const e=c.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let a;return e[2]!==t?(a=i.jsx(f,{"data-slot":"dropdown-menu-trigger",...t}),e[2]=t,e[3]=a):a=e[3],a}function $(s){const e=c.c(10);let t,a,o;e[0]!==s?({className:t,sideOffset:o,...a}=s,e[0]=s,e[1]=t,e[2]=a,e[3]=o):(t=e[1],a=e[2],o=e[3]);const n=o===void 0?4:o;let r;e[4]!==t?(r=u("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border p-1 shadow-md",t),e[4]=t,e[5]=r):r=e[5];let d;return e[6]!==a||e[7]!==n||e[8]!==r?(d=i.jsx(m,{children:i.jsx(g,{"data-slot":"dropdown-menu-content",sideOffset:n,className:r,...a})}),e[6]=a,e[7]=n,e[8]=r,e[9]=d):d=e[9],d}function y(s){const e=c.c(12);let t,a,o,n;e[0]!==s?({className:t,inset:a,variant:n,...o}=s,e[0]=s,e[1]=t,e[2]=a,e[3]=o,e[4]=n):(t=e[1],a=e[2],o=e[3],n=e[4]);const r=n===void 0?"default":n;let d;e[5]!==t?(d=u("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-pointer 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",t),e[5]=t,e[6]=d):d=e[6];let l;return e[7]!==a||e[8]!==o||e[9]!==d||e[10]!==r?(l=i.jsx(x,{"data-slot":"dropdown-menu-item","data-inset":a,"data-variant":r,className:d,...o}),e[7]=a,e[8]=o,e[9]=d,e[10]=r,e[11]=l):l=e[11],l}function _(s){const e=c.c(8);let t,a;e[0]!==s?({className:t,...a}=s,e[0]=s,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=u("bg-border -mx-1 my-1 h-px",t),e[3]=t,e[4]=o):o=e[4];let n;return e[5]!==a||e[6]!==o?(n=i.jsx(h,{"data-slot":"dropdown-menu-separator",className:o,...a}),e[5]=a,e[6]=o,e[7]=n):n=e[7],n}function C(s){const e=c.c(4);let t;e[0]!==s?({...t}=s,e[0]=s,e[1]=t):t=e[1];let a;return e[2]!==t?(a=i.jsx(v,{"data-slot":"dropdown-menu-sub",...t}),e[2]=t,e[3]=a):a=e[3],a}function T(s){const e=c.c(13);let t,a,o,n;e[0]!==s?({className:a,inset:o,children:t,...n}=s,e[0]=s,e[1]=t,e[2]=a,e[3]=o,e[4]=n):(t=e[1],a=e[2],o=e[3],n=e[4]);let r;e[5]!==a?(r=u("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-lg px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",a),e[5]=a,e[6]=r):r=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(j,{className:"ml-auto size-4"}),e[7]=d):d=e[7];let l;return e[8]!==t||e[9]!==o||e[10]!==n||e[11]!==r?(l=i.jsxs(b,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:r,...n,children:[t,d]}),e[8]=t,e[9]=o,e[10]=n,e[11]=r,e[12]=l):l=e[12],l}function R(s){const e=c.c(8);let t,a;e[0]!==s?({className:t,...a}=s,e[0]=s,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let o;e[3]!==t?(o=u("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",t),e[3]=t,e[4]=o):o=e[4];let n;return e[5]!==a||e[6]!==o?(n=i.jsx(w,{"data-slot":"dropdown-menu-sub-content",className:o,...a}),e[5]=a,e[6]=o,e[7]=n):n=e[7],n}export{S as D,M as a,$ as b,y as c,C as d,T as e,R as f,_ as g};
@@ -1 +1 @@
1
- import{u as E,a as S,g as N,j as t,aR as j,r as f,aS as b,c as L,aT as P}from"./index-M3wOD-T-.js";import{i as x}from"./Loading01-CaAuMuYs.js";import{c as I}from"./binder-BPAsHHtz.js";import{u as H,L as w}from"./localstorage-keys-hwI1e15G.js";import{b as R}from"./use-connection-D5-dSK3A.js";import{u as k}from"./constants-CAezfWK1.js";import"./useQuery-BQUu3Rwx.js";import"./useMutation-i3JyomhH.js";import"./use-collections-COu7mzCX.js";function z(e,r){return e?e.filter(a=>I(a,r)):[]}function y(e){return{id:e.id,title:e.title,icon:e.icon,description:e.description,app_name:e.app_name,app_id:e.app_id,tools:e.tools,metadata:e.metadata}}function B({binding:e,renderHeader:r,renderEmptyState:a}){const{org:s}=E(),{pluginId:n}=S({strict:!1}),d=R(),{data:o}=N.useSession(),l=z(d,e),[i,m]=H(w.pluginConnection(s.slug,n),c=>c??""),u=l.find(c=>c.id===i)??l[0]??null,p=o?.user?{user:{id:o.user.id,name:o.user.name,email:o.user.email,image:o.user.image}}:null,g={id:s.id,slug:s.slug,name:s.name};if(l.length===0||!u){const c={connectionId:null,connection:null,toolCaller:null,org:g,session:p};return t.jsx(j,{value:c,children:t.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:a()})})}const h=k({connectionId:u.id,orgId:s.id}),v={connectionId:u.id,connection:y(u),toolCaller:((c,_)=>h?h.callTool({name:c,arguments:_}).then(C=>C.structuredContent??C):Promise.reject(new Error("MCP client is not available"))),org:g,session:p};return t.jsx(j,{value:v,children:t.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[r({connections:l.map(y),selectedConnectionId:u.id,onConnectionChange:m}),t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(f.Suspense,{fallback:t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[t.jsx(x,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]}),children:t.jsx(b,{})})})]})})}function F(){const e=L.c(12);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[0]=r):r=e[0];const{pluginId:a}=S(r);let s;e[1]!==a?(s=P.find(i=>i.id===a),e[1]=a,e[2]=s):s=e[2];const n=s;if(n?.renderHeader&&n?.renderEmptyState){let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[t.jsx(x,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading plugin..."})]}),e[3]=i):i=e[3];let m;return e[4]!==n.binding||e[5]!==n.renderEmptyState||e[6]!==n.renderHeader?(m=t.jsx(f.Suspense,{fallback:i,children:t.jsx(B,{binding:n.binding,renderHeader:n.renderHeader,renderEmptyState:n.renderEmptyState})}),e[4]=n.binding,e[5]=n.renderEmptyState,e[6]=n.renderHeader,e[7]=m):m=e[7],m}const d=n?.LayoutComponent;if(!d){let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(b,{}),e[8]=i):i=e[8],i}let o;e[9]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[t.jsx(x,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading plugin..."})]}),e[9]=o):o=e[9];let l;return e[10]!==d?(l=t.jsx(f.Suspense,{fallback:o,children:t.jsx(d,{})}),e[10]=d,e[11]=l):l=e[11],l}export{F as default};
1
+ import{u as E,a as S,g as N,j as t,aR as j,r as f,aS as b,c as L,aT as P}from"./index-Dho9MRVw.js";import{i as x}from"./Loading01-Bo9vDQAp.js";import{c as I}from"./binder-Cyeq_Zec.js";import{u as H,L as w}from"./localstorage-keys-B7V7cQcH.js";import{b as R}from"./use-connection-BU-nKbTz.js";import{u as k}from"./constants-D8fdcBr8.js";import"./useQuery-C2zqJzGD.js";import"./useMutation-Lj_Cbq0P.js";import"./use-collections-CVO4vm4G.js";function z(e,r){return e?e.filter(a=>I(a,r)):[]}function y(e){return{id:e.id,title:e.title,icon:e.icon,description:e.description,app_name:e.app_name,app_id:e.app_id,tools:e.tools,metadata:e.metadata}}function B({binding:e,renderHeader:r,renderEmptyState:a}){const{org:s}=E(),{pluginId:n}=S({strict:!1}),d=R(),{data:o}=N.useSession(),l=z(d,e),[i,m]=H(w.pluginConnection(s.slug,n),c=>c??""),u=l.find(c=>c.id===i)??l[0]??null,p=o?.user?{user:{id:o.user.id,name:o.user.name,email:o.user.email,image:o.user.image}}:null,g={id:s.id,slug:s.slug,name:s.name};if(l.length===0||!u){const c={connectionId:null,connection:null,toolCaller:null,org:g,session:p};return t.jsx(j,{value:c,children:t.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:a()})})}const h=k({connectionId:u.id,orgId:s.id}),v={connectionId:u.id,connection:y(u),toolCaller:((c,_)=>h?h.callTool({name:c,arguments:_}).then(C=>C.structuredContent??C):Promise.reject(new Error("MCP client is not available"))),org:g,session:p};return t.jsx(j,{value:v,children:t.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[r({connections:l.map(y),selectedConnectionId:u.id,onConnectionChange:m}),t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(f.Suspense,{fallback:t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[t.jsx(x,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]}),children:t.jsx(b,{})})})]})})}function F(){const e=L.c(12);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[0]=r):r=e[0];const{pluginId:a}=S(r);let s;e[1]!==a?(s=P.find(i=>i.id===a),e[1]=a,e[2]=s):s=e[2];const n=s;if(n?.renderHeader&&n?.renderEmptyState){let i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[t.jsx(x,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading plugin..."})]}),e[3]=i):i=e[3];let m;return e[4]!==n.binding||e[5]!==n.renderEmptyState||e[6]!==n.renderHeader?(m=t.jsx(f.Suspense,{fallback:i,children:t.jsx(B,{binding:n.binding,renderHeader:n.renderHeader,renderEmptyState:n.renderEmptyState})}),e[4]=n.binding,e[5]=n.renderEmptyState,e[6]=n.renderHeader,e[7]=m):m=e[7],m}const d=n?.LayoutComponent;if(!d){let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(b,{}),e[8]=i):i=e[8],i}let o;e[9]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[t.jsx(x,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading plugin..."})]}),e[9]=o):o=e[9];let l;return e[10]!==d?(l=t.jsx(f.Suspense,{fallback:o,children:t.jsx(d,{})}),e[10]=d,e[11]=l):l=e[11],l}export{F as default};
@@ -1 +1 @@
1
- import{c as p,j as t}from"./index-M3wOD-T-.js";import{B as j,c as b}from"./button-CrpAre8y.js";function v(u){const e=p.c(18),{icon:a,title:m,description:x,buttonProps:n,buttonComponent:f}=u;let s;e[0]!==a?(s=t.jsx("div",{className:"flex items-center justify-center",children:t.jsx("div",{className:"p-6 rounded-full border border-muted",children:t.jsx("div",{className:"p-4 rounded-full border border-border",children:t.jsx("div",{className:"p-3.5 rounded-full border border-border",children:t.jsx("div",{className:"p-3 rounded-full border border-border",children:t.jsx("div",{className:"w-20 h-20 rounded-full bg-muted flex items-center justify-center p-4",children:a})})})})})}),e[0]=a,e[1]=s):s=e[1];let l;e[2]!==m?(l=t.jsx("h3",{className:"text-2xl font-semibold text-foreground text-center",children:m}),e[2]=m,e[3]=l):l=e[3];let r;e[4]!==x?(r=t.jsx("div",{className:"text-sm text-muted-foreground text-center flex flex-col gap-1",children:x}),e[4]=x,e[5]=r):r=e[5];let d;e[6]!==l||e[7]!==r?(d=t.jsxs("div",{className:"flex flex-col items-center gap-2 max-w-md",children:[l,r]}),e[6]=l,e[7]=r,e[8]=d):d=e[8];let i;e[9]!==f||e[10]!==n?(i=f??(n&&t.jsx(j,{variant:"outline",size:"default",className:b("gap-2",n?.className),...n})),e[9]=f,e[10]=n,e[11]=i):i=e[11];let c;e[12]!==i?(c=t.jsx("div",{className:"mt-6",children:i}),e[12]=i,e[13]=c):c=e[13];let o;return e[14]!==s||e[15]!==d||e[16]!==c?(o=t.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[s,d,c]}),e[14]=s,e[15]=d,e[16]=c,e[17]=o):o=e[17],o}export{v as E};
1
+ import{c as p,j as t}from"./index-Dho9MRVw.js";import{B as j,c as b}from"./button-D_0RTXDt.js";function v(u){const e=p.c(18),{icon:a,title:m,description:x,buttonProps:n,buttonComponent:f}=u;let s;e[0]!==a?(s=t.jsx("div",{className:"flex items-center justify-center",children:t.jsx("div",{className:"p-6 rounded-full border border-muted",children:t.jsx("div",{className:"p-4 rounded-full border border-border",children:t.jsx("div",{className:"p-3.5 rounded-full border border-border",children:t.jsx("div",{className:"p-3 rounded-full border border-border",children:t.jsx("div",{className:"w-20 h-20 rounded-full bg-muted flex items-center justify-center p-4",children:a})})})})})}),e[0]=a,e[1]=s):s=e[1];let l;e[2]!==m?(l=t.jsx("h3",{className:"text-2xl font-semibold text-foreground text-center",children:m}),e[2]=m,e[3]=l):l=e[3];let r;e[4]!==x?(r=t.jsx("div",{className:"text-sm text-muted-foreground text-center flex flex-col gap-1",children:x}),e[4]=x,e[5]=r):r=e[5];let d;e[6]!==l||e[7]!==r?(d=t.jsxs("div",{className:"flex flex-col items-center gap-2 max-w-md",children:[l,r]}),e[6]=l,e[7]=r,e[8]=d):d=e[8];let i;e[9]!==f||e[10]!==n?(i=f??(n&&t.jsx(j,{variant:"outline",size:"default",className:b("gap-2",n?.className),...n})),e[9]=f,e[10]=n,e[11]=i):i=e[11];let c;e[12]!==i?(c=t.jsx("div",{className:"mt-6",children:i}),e[12]=i,e[13]=c):c=e[13];let o;return e[14]!==s||e[15]!==d||e[16]!==c?(o=t.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[s,d,c]}),e[14]=s,e[15]=d,e[16]=c,e[17]=o):o=e[17],o}export{v as E};
@@ -1 +1 @@
1
- import{r as y,c as C,j as l}from"./index-M3wOD-T-.js";import{c as I}from"./button-CrpAre8y.js";const _=({size:o=24,color:e="currentColor",...t})=>y.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},y.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"}));_.displayName="Container";const L={"2xs":"h-4 w-4",xs:"h-6 w-6",sm:"h-8 w-8",md:"h-12 w-12",lg:"h-16 w-16"},z={"2xs":"min-w-4",xs:"min-w-6",sm:"min-w-8",md:"min-w-12",lg:"min-w-16"},$={"2xs":8,xs:12,sm:16,md:24,lg:32};function R(o){const e=C.c(7),{icon:t,name:r,size:h,className:a,fallbackIcon:m}=o,n=h===void 0?"md":h,g=t??"no-icon";let s;return e[0]!==a||e[1]!==m||e[2]!==t||e[3]!==r||e[4]!==n||e[5]!==g?(s=l.jsx(M,{icon:t,name:r,size:n,className:a,fallbackIcon:m},g),e[0]=a,e[1]=m,e[2]=t,e[3]=r,e[4]=n,e[5]=g,e[6]=s):s=e[6],s}function M(o){const e=C.c(24),{icon:t,name:r,size:h,className:a,fallbackIcon:m}=o,n=h===void 0?"md":h,[g,s]=y.useState(!1),p=!!t&&g,d=L[n],f=z[n];let c;e[0]!==a||e[1]!==d||e[2]!==f?(c=I("rounded-lg border border-border shrink-0 overflow-hidden aspect-square",d,f,a),e[0]=a,e[1]=d,e[2]=f,e[3]=c):c=e[3];const x=t||void 0,u=!p&&"hidden";let i;e[4]!==u?(i=I("h-full w-full object-cover",u),e[4]=u,e[5]=i):i=e[5];let j,E;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=()=>s(!1),E=()=>s(!0),e[6]=j,e[7]=E):(j=e[6],E=e[7]);let N;e[8]!==r||e[9]!==x||e[10]!==i?(N=l.jsx("img",{src:x,alt:r,className:i,onError:j,onLoad:E}),e[8]=r,e[9]=x,e[10]=i,e[11]=N):N=e[11];const k=p&&"hidden";let w;e[12]!==k?(w=I("h-full w-full flex items-center justify-center bg-muted/20",k),e[12]=k,e[13]=w):w=e[13];let v;e[14]!==m||e[15]!==n?(v=m??l.jsx(_,{size:$[n],className:"text-muted-foreground"}),e[14]=m,e[15]=n,e[16]=v):v=e[16];let S;e[17]!==w||e[18]!==v?(S=l.jsx("div",{className:w,children:v}),e[17]=w,e[18]=v,e[19]=S):S=e[19];let b;return e[20]!==N||e[21]!==S||e[22]!==c?(b=l.jsxs("div",{className:c,children:[N,S]}),e[20]=N,e[21]=S,e[22]=c,e[23]=b):b=e[23],b}function Z(){const o=C.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx("img",{src:"/empty-state-cards.png",alt:"",width:336,height:320,"aria-hidden":"true"}),o[0]=e):e=o[0],e}function W(o){const e=C.c(24),{image:t,title:r,description:h,actions:a,className:m,descriptionClassName:n,actionsClassName:g}=o;let s;e[0]!==m?(s=I("flex flex-1 flex-col items-center justify-center gap-8 p-4",m),e[0]=m,e[1]=s):s=e[1];let p;e[2]!==t?(p=t!==null&&l.jsx("div",{className:"flex items-center justify-center",children:t??l.jsx(Z,{})}),e[2]=t,e[3]=p):p=e[3];let d;e[4]!==r?(d=l.jsx("h3",{className:"text-lg font-medium text-foreground",children:r}),e[4]=r,e[5]=d):d=e[5];let f;e[6]!==n?(f=I("text-sm text-muted-foreground text-center max-w-[300px]",n),e[6]=n,e[7]=f):f=e[7];let c;e[8]!==h||e[9]!==f?(c=l.jsx("div",{className:f,children:h}),e[8]=h,e[9]=f,e[10]=c):c=e[10];let x;e[11]!==d||e[12]!==c?(x=l.jsxs("div",{className:"flex flex-col items-center gap-2",children:[d,c]}),e[11]=d,e[12]=c,e[13]=x):x=e[13];let u;e[14]!==a||e[15]!==g?(u=a&&l.jsx("div",{className:I("flex items-center gap-2",g),children:a}),e[14]=a,e[15]=g,e[16]=u):u=e[16];let i;e[17]!==x||e[18]!==u?(i=l.jsxs("div",{className:"flex flex-col items-center gap-4",children:[x,u]}),e[17]=x,e[18]=u,e[19]=i):i=e[19];let j;return e[20]!==s||e[21]!==p||e[22]!==i?(j=l.jsxs("div",{className:s,children:[p,i]}),e[20]=s,e[21]=p,e[22]=i,e[23]=j):j=e[23],j}export{W as E,R as I,_ as n};
1
+ import{r as y,c as C,j as l}from"./index-Dho9MRVw.js";import{c as I}from"./button-D_0RTXDt.js";const _=({size:o=24,color:e="currentColor",...t})=>y.createElement("svg",{viewBox:"0 0 24 24",width:o,height:o,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},y.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"}));_.displayName="Container";const L={"2xs":"h-4 w-4",xs:"h-6 w-6",sm:"h-8 w-8",md:"h-12 w-12",lg:"h-16 w-16"},z={"2xs":"min-w-4",xs:"min-w-6",sm:"min-w-8",md:"min-w-12",lg:"min-w-16"},$={"2xs":8,xs:12,sm:16,md:24,lg:32};function R(o){const e=C.c(7),{icon:t,name:r,size:h,className:a,fallbackIcon:m}=o,n=h===void 0?"md":h,g=t??"no-icon";let s;return e[0]!==a||e[1]!==m||e[2]!==t||e[3]!==r||e[4]!==n||e[5]!==g?(s=l.jsx(M,{icon:t,name:r,size:n,className:a,fallbackIcon:m},g),e[0]=a,e[1]=m,e[2]=t,e[3]=r,e[4]=n,e[5]=g,e[6]=s):s=e[6],s}function M(o){const e=C.c(24),{icon:t,name:r,size:h,className:a,fallbackIcon:m}=o,n=h===void 0?"md":h,[g,s]=y.useState(!1),p=!!t&&g,d=L[n],f=z[n];let c;e[0]!==a||e[1]!==d||e[2]!==f?(c=I("rounded-lg border border-border shrink-0 overflow-hidden aspect-square",d,f,a),e[0]=a,e[1]=d,e[2]=f,e[3]=c):c=e[3];const x=t||void 0,u=!p&&"hidden";let i;e[4]!==u?(i=I("h-full w-full object-cover",u),e[4]=u,e[5]=i):i=e[5];let j,E;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=()=>s(!1),E=()=>s(!0),e[6]=j,e[7]=E):(j=e[6],E=e[7]);let N;e[8]!==r||e[9]!==x||e[10]!==i?(N=l.jsx("img",{src:x,alt:r,className:i,onError:j,onLoad:E}),e[8]=r,e[9]=x,e[10]=i,e[11]=N):N=e[11];const k=p&&"hidden";let w;e[12]!==k?(w=I("h-full w-full flex items-center justify-center bg-muted/20",k),e[12]=k,e[13]=w):w=e[13];let v;e[14]!==m||e[15]!==n?(v=m??l.jsx(_,{size:$[n],className:"text-muted-foreground"}),e[14]=m,e[15]=n,e[16]=v):v=e[16];let S;e[17]!==w||e[18]!==v?(S=l.jsx("div",{className:w,children:v}),e[17]=w,e[18]=v,e[19]=S):S=e[19];let b;return e[20]!==N||e[21]!==S||e[22]!==c?(b=l.jsxs("div",{className:c,children:[N,S]}),e[20]=N,e[21]=S,e[22]=c,e[23]=b):b=e[23],b}function Z(){const o=C.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx("img",{src:"/empty-state-cards.png",alt:"",width:336,height:320,"aria-hidden":"true"}),o[0]=e):e=o[0],e}function W(o){const e=C.c(24),{image:t,title:r,description:h,actions:a,className:m,descriptionClassName:n,actionsClassName:g}=o;let s;e[0]!==m?(s=I("flex flex-1 flex-col items-center justify-center gap-8 p-4",m),e[0]=m,e[1]=s):s=e[1];let p;e[2]!==t?(p=t!==null&&l.jsx("div",{className:"flex items-center justify-center",children:t??l.jsx(Z,{})}),e[2]=t,e[3]=p):p=e[3];let d;e[4]!==r?(d=l.jsx("h3",{className:"text-lg font-medium text-foreground",children:r}),e[4]=r,e[5]=d):d=e[5];let f;e[6]!==n?(f=I("text-sm text-muted-foreground text-center max-w-[300px]",n),e[6]=n,e[7]=f):f=e[7];let c;e[8]!==h||e[9]!==f?(c=l.jsx("div",{className:f,children:h}),e[8]=h,e[9]=f,e[10]=c):c=e[10];let x;e[11]!==d||e[12]!==c?(x=l.jsxs("div",{className:"flex flex-col items-center gap-2",children:[d,c]}),e[11]=d,e[12]=c,e[13]=x):x=e[13];let u;e[14]!==a||e[15]!==g?(u=a&&l.jsx("div",{className:I("flex items-center gap-2",g),children:a}),e[14]=a,e[15]=g,e[16]=u):u=e[16];let i;e[17]!==x||e[18]!==u?(i=l.jsxs("div",{className:"flex flex-col items-center gap-4",children:[x,u]}),e[17]=x,e[18]=u,e[19]=i):i=e[19];let j;return e[20]!==s||e[21]!==p||e[22]!==i?(j=l.jsxs("div",{className:s,children:[p,i]}),e[20]=s,e[21]=p,e[22]=i,e[23]=j):j=e[23],j}export{W as E,R as I,_ as n};
@@ -1 +1 @@
1
- import{o as f,_ as V,n as k,s as t,ap as j,aq as d,ar as x,as as R,c as W,j as c}from"./index-M3wOD-T-.js";import{B as H}from"./button-CrpAre8y.js";import{I as N}from"./input-YM08EPCC.js";import{s as O}from"./Plus-BfTBbS63.js";import{s as U}from"./Trash01-DFo133oe.js";const L=f({authorizationEndpoint:t().url(),tokenEndpoint:t().url(),introspectionEndpoint:t().url().optional(),clientId:t(),clientSecret:t().optional(),scopes:k(t()),grantType:V(["authorization_code","client_credentials"])}),q=f({title:t().optional(),readOnlyHint:j().optional(),destructiveHint:j().optional(),idempotentHint:j().optional(),openWorldHint:j().optional()}),B=f({name:t(),description:t().optional(),inputSchema:d(t(),x()),outputSchema:d(t(),x()).optional(),annotations:q.optional(),_meta:d(t(),x()).optional()}),K=f({headers:d(t(),t()).optional()}),$=f({command:t().describe("Command to run (e.g., 'npx', 'node')"),args:k(t()).optional().describe("Command arguments"),cwd:t().optional().describe("Working directory"),envVars:d(t(),t()).optional().describe("Environment variables (encrypted in storage)")}),z=f({id:t().describe("Unique identifier for the connection"),title:t().describe("Human-readable name for the connection"),created_at:t().describe("When the connection was created"),updated_at:t().describe("When the connection was last updated"),created_by:t().describe("User ID who created the connection"),updated_by:t().optional().describe("User ID who last updated the connection"),organization_id:t().describe("Organization ID this connection belongs to"),description:t().nullable().describe("Description of the connection"),icon:t().nullable().describe("Icon URL for the connection"),app_name:t().nullable().describe("Associated app name"),app_id:t().nullable().describe("Associated app ID"),connection_type:V(["HTTP","SSE","Websocket","STDIO","VIRTUAL"]).describe("Type of connection"),connection_url:t().nullable().describe("URL for HTTP/SSE/WebSocket connections. virtual://$id for VIRTUAL. Null for STDIO."),connection_token:t().nullable().describe("Authentication token (for HTTP connections)"),connection_headers:R([$,K]).nullable().describe("Connection parameters. HTTP: { headers }. STDIO: { command, args, cwd, envVars }"),oauth_config:L.nullable().describe("OAuth configuration"),configuration_state:d(t(),x()).nullable().describe("Configuration state (decrypted)"),configuration_scopes:k(t()).nullable().optional().describe("Configuration scopes"),metadata:d(t(),x()).nullable().describe("Additional metadata (includes repository info)"),tools:k(B).nullable().describe("Discovered tools from MCP"),bindings:k(t()).nullable().describe("Detected bindings"),status:V(["active","inactive","error"]).describe("Current status")});z.omit({created_at:!0,updated_at:!0,created_by:!0,updated_by:!0,organization_id:!0,tools:!0,bindings:!0,status:!0}).partial({id:!0,description:!0,icon:!0,app_name:!0,app_id:!0,connection_url:!0,connection_token:!0,connection_headers:!0,oauth_config:!0,configuration_state:!0,configuration_scopes:!0,metadata:!0});z.partial();function Y(o){return!!o&&"command"in o}function Z(o){return!o||!o.startsWith("virtual://")?null:o.replace("virtual://","")}function M(o){const e=o.toLowerCase();return!!(["secret","password","passwd","credential","private","token","bearer","jwt","refresh","session","api_key","apikey","auth_key","access_key","secret_key","private_key","service_key","encryption_key","signing_key","license_key","auth","oauth","client_secret","app_secret","webhook","signing","signature","database_url","db_url","mongo_uri","redis_url","postgres_url","mysql_url","connection_string","dsn","service_role","anon_key","supabase_key","openai","anthropic","stripe","twilio","sendgrid","resend","firebase","sentry","datadog","newrelic","new_relic","pplx","replicate","pinecone","cohere","hugging","hf_token","gh_token","npm_token","certificate","cert","ssl","tls","encryption","salt","hash","hmac","personal_access","github_pat","gitlab_pat","bitbucket_pat"].some(l=>e.includes(l))||["sk_","rk_","whsec_","pk_live","sk_live"].some(l=>e.startsWith(l))||["_key","_secret","_token","_password","_auth","_pat"].some(l=>e.endsWith(l)))}function ee(o){const e=W.c(34),{value:n,onChange:i,keyPlaceholder:A,valuePlaceholder:l,className:I}=o,_=A===void 0?"VARIABLE_NAME":A,b=l===void 0?"value...":l;let w;e[0]!==i||e[1]!==n?(w=()=>{i([...n,{key:"",value:""}])},e[0]=i,e[1]=n,e[2]=w):w=e[2];const D=w;let S;e[3]!==i||e[4]!==n?(S=r=>{i(n.filter((u,a)=>a!==r))},e[3]=i,e[4]=n,e[5]=S):S=e[5];const g=S;let C;e[6]!==i||e[7]!==n?(C=(r,u)=>{const a=[...n],s=a[r];s&&(a[r]={key:u,value:s.value},i(a))},e[6]=i,e[7]=n,e[8]=C):C=e[8];const v=C;let T;e[9]!==i||e[10]!==n?(T=(r,u)=>{const a=[...n],s=a[r];s&&(a[r]={key:s.key,value:u},i(a))},e[9]=i,e[10]=n,e[11]=T):T=e[11];const y=T;let p;if(e[12]!==v||e[13]!==g||e[14]!==y||e[15]!==_||e[16]!==n||e[17]!==b){let r;e[19]!==v||e[20]!==g||e[21]!==y||e[22]!==_||e[23]!==b?(r=(u,a)=>c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(N,{placeholder:_,value:u.key,onChange:s=>v(a,s.target.value),className:"h-10 rounded-lg flex-1 font-mono text-sm"}),c.jsx(N,{type:M(u.key)?"password":"text",placeholder:b,value:u.value,onChange:s=>y(a,s.target.value),className:"h-10 rounded-lg flex-1"}),c.jsx(H,{type:"button",variant:"ghost",size:"icon",className:"h-10 w-10 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>g(a),children:c.jsx(U,{size:16})})]},a),e[19]=v,e[20]=g,e[21]=y,e[22]=_,e[23]=b,e[24]=r):r=e[24],p=n.map(r),e[12]=v,e[13]=g,e[14]=y,e[15]=_,e[16]=n,e[17]=b,e[18]=p}else p=e[18];let E;e[25]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(O,{size:16,className:"mr-1"}),e[25]=E):E=e[25];let m;e[26]!==D?(m=c.jsxs(H,{type:"button",variant:"outline",size:"sm",className:"w-full h-9 text-muted-foreground",onClick:D,children:[E,"Add Environment Variable"]}),e[26]=D,e[27]=m):m=e[27];let h;e[28]!==p||e[29]!==m?(h=c.jsxs("div",{className:"flex flex-col gap-2",children:[p,m]}),e[28]=p,e[29]=m,e[30]=h):h=e[30];let P;return e[31]!==I||e[32]!==h?(P=c.jsx("div",{className:I,children:h}),e[31]=I,e[32]=h,e[33]=P):P=e[33],P}function te(o){const e={};for(const{key:n,value:i}of o)n.trim()&&(e[n.trim()]=i);return e}function ne(o){return o?Object.entries(o).map(([e,n])=>({key:e,value:n})):[]}export{ee as E,te as e,Y as i,Z as p,ne as r};
1
+ import{o as f,_ as V,n as k,s as t,ap as j,aq as d,ar as x,as as R,c as W,j as c}from"./index-Dho9MRVw.js";import{B as H}from"./button-D_0RTXDt.js";import{I as N}from"./input-trZWilTG.js";import{s as O}from"./Plus-DAW17Fqf.js";import{s as U}from"./Trash01-BUkAP1vf.js";const L=f({authorizationEndpoint:t().url(),tokenEndpoint:t().url(),introspectionEndpoint:t().url().optional(),clientId:t(),clientSecret:t().optional(),scopes:k(t()),grantType:V(["authorization_code","client_credentials"])}),q=f({title:t().optional(),readOnlyHint:j().optional(),destructiveHint:j().optional(),idempotentHint:j().optional(),openWorldHint:j().optional()}),B=f({name:t(),description:t().optional(),inputSchema:d(t(),x()),outputSchema:d(t(),x()).optional(),annotations:q.optional(),_meta:d(t(),x()).optional()}),K=f({headers:d(t(),t()).optional()}),$=f({command:t().describe("Command to run (e.g., 'npx', 'node')"),args:k(t()).optional().describe("Command arguments"),cwd:t().optional().describe("Working directory"),envVars:d(t(),t()).optional().describe("Environment variables (encrypted in storage)")}),z=f({id:t().describe("Unique identifier for the connection"),title:t().describe("Human-readable name for the connection"),created_at:t().describe("When the connection was created"),updated_at:t().describe("When the connection was last updated"),created_by:t().describe("User ID who created the connection"),updated_by:t().optional().describe("User ID who last updated the connection"),organization_id:t().describe("Organization ID this connection belongs to"),description:t().nullable().describe("Description of the connection"),icon:t().nullable().describe("Icon URL for the connection"),app_name:t().nullable().describe("Associated app name"),app_id:t().nullable().describe("Associated app ID"),connection_type:V(["HTTP","SSE","Websocket","STDIO","VIRTUAL"]).describe("Type of connection"),connection_url:t().nullable().describe("URL for HTTP/SSE/WebSocket connections. virtual://$id for VIRTUAL. Null for STDIO."),connection_token:t().nullable().describe("Authentication token (for HTTP connections)"),connection_headers:R([$,K]).nullable().describe("Connection parameters. HTTP: { headers }. STDIO: { command, args, cwd, envVars }"),oauth_config:L.nullable().describe("OAuth configuration"),configuration_state:d(t(),x()).nullable().describe("Configuration state (decrypted)"),configuration_scopes:k(t()).nullable().optional().describe("Configuration scopes"),metadata:d(t(),x()).nullable().describe("Additional metadata (includes repository info)"),tools:k(B).nullable().describe("Discovered tools from MCP"),bindings:k(t()).nullable().describe("Detected bindings"),status:V(["active","inactive","error"]).describe("Current status")});z.omit({created_at:!0,updated_at:!0,created_by:!0,updated_by:!0,organization_id:!0,tools:!0,bindings:!0,status:!0}).partial({id:!0,description:!0,icon:!0,app_name:!0,app_id:!0,connection_url:!0,connection_token:!0,connection_headers:!0,oauth_config:!0,configuration_state:!0,configuration_scopes:!0,metadata:!0});z.partial();function Y(o){return!!o&&"command"in o}function Z(o){return!o||!o.startsWith("virtual://")?null:o.replace("virtual://","")}function M(o){const e=o.toLowerCase();return!!(["secret","password","passwd","credential","private","token","bearer","jwt","refresh","session","api_key","apikey","auth_key","access_key","secret_key","private_key","service_key","encryption_key","signing_key","license_key","auth","oauth","client_secret","app_secret","webhook","signing","signature","database_url","db_url","mongo_uri","redis_url","postgres_url","mysql_url","connection_string","dsn","service_role","anon_key","supabase_key","openai","anthropic","stripe","twilio","sendgrid","resend","firebase","sentry","datadog","newrelic","new_relic","pplx","replicate","pinecone","cohere","hugging","hf_token","gh_token","npm_token","certificate","cert","ssl","tls","encryption","salt","hash","hmac","personal_access","github_pat","gitlab_pat","bitbucket_pat"].some(l=>e.includes(l))||["sk_","rk_","whsec_","pk_live","sk_live"].some(l=>e.startsWith(l))||["_key","_secret","_token","_password","_auth","_pat"].some(l=>e.endsWith(l)))}function ee(o){const e=W.c(34),{value:n,onChange:i,keyPlaceholder:A,valuePlaceholder:l,className:I}=o,_=A===void 0?"VARIABLE_NAME":A,b=l===void 0?"value...":l;let w;e[0]!==i||e[1]!==n?(w=()=>{i([...n,{key:"",value:""}])},e[0]=i,e[1]=n,e[2]=w):w=e[2];const D=w;let S;e[3]!==i||e[4]!==n?(S=r=>{i(n.filter((u,a)=>a!==r))},e[3]=i,e[4]=n,e[5]=S):S=e[5];const g=S;let C;e[6]!==i||e[7]!==n?(C=(r,u)=>{const a=[...n],s=a[r];s&&(a[r]={key:u,value:s.value},i(a))},e[6]=i,e[7]=n,e[8]=C):C=e[8];const v=C;let T;e[9]!==i||e[10]!==n?(T=(r,u)=>{const a=[...n],s=a[r];s&&(a[r]={key:s.key,value:u},i(a))},e[9]=i,e[10]=n,e[11]=T):T=e[11];const y=T;let p;if(e[12]!==v||e[13]!==g||e[14]!==y||e[15]!==_||e[16]!==n||e[17]!==b){let r;e[19]!==v||e[20]!==g||e[21]!==y||e[22]!==_||e[23]!==b?(r=(u,a)=>c.jsxs("div",{className:"flex gap-2 items-center",children:[c.jsx(N,{placeholder:_,value:u.key,onChange:s=>v(a,s.target.value),className:"h-10 rounded-lg flex-1 font-mono text-sm"}),c.jsx(N,{type:M(u.key)?"password":"text",placeholder:b,value:u.value,onChange:s=>y(a,s.target.value),className:"h-10 rounded-lg flex-1"}),c.jsx(H,{type:"button",variant:"ghost",size:"icon",className:"h-10 w-10 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>g(a),children:c.jsx(U,{size:16})})]},a),e[19]=v,e[20]=g,e[21]=y,e[22]=_,e[23]=b,e[24]=r):r=e[24],p=n.map(r),e[12]=v,e[13]=g,e[14]=y,e[15]=_,e[16]=n,e[17]=b,e[18]=p}else p=e[18];let E;e[25]===Symbol.for("react.memo_cache_sentinel")?(E=c.jsx(O,{size:16,className:"mr-1"}),e[25]=E):E=e[25];let m;e[26]!==D?(m=c.jsxs(H,{type:"button",variant:"outline",size:"sm",className:"w-full h-9 text-muted-foreground",onClick:D,children:[E,"Add Environment Variable"]}),e[26]=D,e[27]=m):m=e[27];let h;e[28]!==p||e[29]!==m?(h=c.jsxs("div",{className:"flex flex-col gap-2",children:[p,m]}),e[28]=p,e[29]=m,e[30]=h):h=e[30];let P;return e[31]!==I||e[32]!==h?(P=c.jsx("div",{className:I,children:h}),e[31]=I,e[32]=h,e[33]=P):P=e[33],P}function te(o){const e={};for(const{key:n,value:i}of o)n.trim()&&(e[n.trim()]=i);return e}function ne(o){return o?Object.entries(o).map(([e,n])=>({key:e,value:n})):[]}export{ee as E,te as e,Y as i,Z as p,ne as r};
@@ -1 +1 @@
1
- import{r as o,j as e}from"./index-M3wOD-T-.js";import{B as n}from"./button-CrpAre8y.js";const a=({size:t=24,color:r="currentColor",...s})=>o.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:r,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},o.createElement("path",{d:"M12 9v4m0 4h.01M10.615 3.892 2.39 18.098c-.456.788-.684 1.182-.65 1.506a1 1 0 0 0 .406.705c.263.191.718.191 1.629.191h16.45c.91 0 1.365 0 1.628-.191a1 1 0 0 0 .407-.705c.034-.324-.195-.718-.65-1.506L13.383 3.892c-.454-.785-.681-1.178-.978-1.31a1 1 0 0 0-.813 0c-.296.132-.523.525-.978 1.31Z"}));a.displayName="AlertTriangle";class l extends o.Component{state={hasError:!1,error:null};static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,s){console.error("Uncaught error:",r,s)}resetError=()=>{this.setState({hasError:!1,error:null})};render(){if(this.state.hasError){const{fallback:r}=this.props;return typeof r=="function"?r({error:this.state.error,resetError:this.resetError}):r!==void 0?r:e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[e.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:e.jsx(a,{className:"h-6 w-6 text-destructive"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-lg font-medium",children:"Something went wrong"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:this.state.error?.message||"An unexpected error occurred"})]}),e.jsx(n,{variant:"outline",onClick:this.resetError,children:"Try again"})]})}return this.props.children}}export{l as E,a as i};
1
+ import{r as o,j as e}from"./index-Dho9MRVw.js";import{B as n}from"./button-D_0RTXDt.js";const a=({size:t=24,color:r="currentColor",...s})=>o.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:r,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},o.createElement("path",{d:"M12 9v4m0 4h.01M10.615 3.892 2.39 18.098c-.456.788-.684 1.182-.65 1.506a1 1 0 0 0 .406.705c.263.191.718.191 1.629.191h16.45c.91 0 1.365 0 1.628-.191a1 1 0 0 0 .407-.705c.034-.324-.195-.718-.65-1.506L13.383 3.892c-.454-.785-.681-1.178-.978-1.31a1 1 0 0 0-.813 0c-.296.132-.523.525-.978 1.31Z"}));a.displayName="AlertTriangle";class l extends o.Component{state={hasError:!1,error:null};static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,s){console.error("Uncaught error:",r,s)}resetError=()=>{this.setState({hasError:!1,error:null})};render(){if(this.state.hasError){const{fallback:r}=this.props;return typeof r=="function"?r({error:this.state.error,resetError:this.resetError}):r!==void 0?r:e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[e.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:e.jsx(a,{className:"h-6 w-6 text-destructive"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-lg font-medium",children:"Something went wrong"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:this.state.error?.message||"An unexpected error occurred"})]}),e.jsx(n,{variant:"outline",onClick:this.resetError,children:"Try again"})]})}return this.props.children}}export{l as E,a as i};
@@ -1 +1 @@
1
- import{r as v}from"./index-M3wOD-T-.js";import"./constants-AccVhxEg.js";import{g as A}from"./github-icon-Dp3wHhYE.js";import{g as D}from"./registry-utils-CcsfK0rU.js";import{g as H}from"./generate-id-Dyweu44Y.js";const z=({size:e=24,color:r="currentColor",...c})=>v.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:r,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...c},v.createElement("path",{d:"m7.5 12 3 3 6-6m5.5 3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));z.displayName="CheckCircle";const L="mcp.mesh";function O(e){if(!e?.url)return"Unknown";try{return new URL(e.url).hostname}catch{return e.url}}function R(e){const r=e?.identifier||e?.name;return r?r.replace(/^@[^/]+\//,"").replace(/[-_]/g," ").replace(/\b\w/g,i=>i.toUpperCase()):"Unknown"}function K(e,r,c,i){const n=e.server,t=e._meta?.[L],m=new Date().toISOString(),b=t?.friendlyName||t?.friendly_name||e.title||n?.title||n?.name||"Unnamed MCP Server",x=n?.description||null,C=n?.icons?.[0]?.src||A(n?.repository)||null,o=t?.oauth_config,N=o&&typeof o.authorizationEndpoint=="string"&&typeof o.tokenEndpoint=="string"&&typeof o.clientId=="string"&&Array.isArray(o.scopes)&&(o.grantType==="authorization_code"||o.grantType==="client_credentials")?o:null,w=t?.configuration_state,I=t?.configuration_scopes,P=n?.repository?{url:n.repository.url,source:n.repository.source,subfolder:n.repository.subfolder}:null,p=n?.packages??[],f=n?.remotes??[],S=i?.packageIndex??0,T=i?.remoteIndex??0,h=p.length>0&&i?.packageIndex!==void 0,a=h?p[S]:null,s=h?null:f[T];let l,u,y=null;if(a){const _=a.identifier||a.name;l="STDIO",u="";const g={};if(a.environmentVariables)for(const k of a.environmentVariables)k.name&&(g[k.name]="");y={command:"npx",args:_?["-y",_]:[],...Object.keys(g).length>0&&{envVars:g}}}else s?(l=D(s.type)||"HTTP",u=s.url||""):(l="HTTP",u="");const E=f.length>1,M=p.length>1;let d="";a&&M?d=` (${R(a)})`:s&&E&&(d=` (${O(s)})`);const U=b+d;return{id:H("conn"),title:U,description:x,icon:C,app_name:t?.appName||n?.name||null,app_id:t?.id||e.id||null,connection_type:l,connection_url:u,connection_token:null,connection_headers:y,oauth_config:N,configuration_state:w??null,configuration_scopes:I??null,metadata:{source:"store",registry_item_id:e.id,verified:t?.verified??!1,scopeName:t?.scopeName??null,toolsCount:t?.tools?.length??0,publishedAt:t?.publishedAt??null,repository:P},created_at:m,updated_at:m,created_by:c,organization_id:r,tools:null,bindings:null,status:"inactive"}}export{L as M,K as e,z as i};
1
+ import{r as v}from"./index-Dho9MRVw.js";import"./constants-rfrR0uMr.js";import{g as A}from"./github-icon-Dp3wHhYE.js";import{g as D}from"./registry-utils-tiv71gSA.js";import{g as H}from"./generate-id-Dyweu44Y.js";const z=({size:e=24,color:r="currentColor",...c})=>v.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:r,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...c},v.createElement("path",{d:"m7.5 12 3 3 6-6m5.5 3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));z.displayName="CheckCircle";const L="mcp.mesh";function O(e){if(!e?.url)return"Unknown";try{return new URL(e.url).hostname}catch{return e.url}}function R(e){const r=e?.identifier||e?.name;return r?r.replace(/^@[^/]+\//,"").replace(/[-_]/g," ").replace(/\b\w/g,i=>i.toUpperCase()):"Unknown"}function K(e,r,c,i){const n=e.server,t=e._meta?.[L],m=new Date().toISOString(),b=t?.friendlyName||t?.friendly_name||e.title||n?.title||n?.name||"Unnamed MCP Server",x=n?.description||null,C=n?.icons?.[0]?.src||A(n?.repository)||null,o=t?.oauth_config,N=o&&typeof o.authorizationEndpoint=="string"&&typeof o.tokenEndpoint=="string"&&typeof o.clientId=="string"&&Array.isArray(o.scopes)&&(o.grantType==="authorization_code"||o.grantType==="client_credentials")?o:null,w=t?.configuration_state,I=t?.configuration_scopes,P=n?.repository?{url:n.repository.url,source:n.repository.source,subfolder:n.repository.subfolder}:null,p=n?.packages??[],f=n?.remotes??[],S=i?.packageIndex??0,T=i?.remoteIndex??0,h=p.length>0&&i?.packageIndex!==void 0,a=h?p[S]:null,s=h?null:f[T];let l,u,y=null;if(a){const _=a.identifier||a.name;l="STDIO",u="";const g={};if(a.environmentVariables)for(const k of a.environmentVariables)k.name&&(g[k.name]="");y={command:"npx",args:_?["-y",_]:[],...Object.keys(g).length>0&&{envVars:g}}}else s?(l=D(s.type)||"HTTP",u=s.url||""):(l="HTTP",u="");const E=f.length>1,M=p.length>1;let d="";a&&M?d=` (${R(a)})`:s&&E&&(d=` (${O(s)})`);const U=b+d;return{id:H("conn"),title:U,description:x,icon:C,app_name:t?.appName||n?.name||null,app_id:t?.id||e.id||null,connection_type:l,connection_url:u,connection_token:null,connection_headers:y,oauth_config:N,configuration_state:w??null,configuration_scopes:I??null,metadata:{source:"store",registry_item_id:e.id,verified:t?.verified??!1,scopeName:t?.scopeName??null,toolsCount:t?.tools?.length??0,publishedAt:t?.publishedAt??null,repository:P},created_at:m,updated_at:m,created_by:c,organization_id:r,tools:null,bindings:null,status:"inactive"}}export{L as M,K as e,z as i};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/grid-view-DW981ZW7.js","assets/index-M3wOD-T-.js","assets/index-CqeIU8-o.css","assets/button-CrpAre8y.js","assets/AlertCircle-xn5rFX2T.js","assets/Download01-BxIh__MC.js","assets/File02-Dh_9xh7Q.js","assets/File06-B5Dv7-Oa.js","assets/Image01-DoUr5ERm.js","assets/Loading01-CaAuMuYs.js","assets/Trash01-DFo133oe.js","assets/Upload01-D1Hk2Al6.js","assets/useMutation-i3JyomhH.js","assets/useQuery-BQUu3Rwx.js","assets/useInfiniteQuery-DZakeCfr.js","assets/infiniteQueryObserver-CfX1I4Ag.js","assets/checkbox-C3_7sazf.js","assets/Check-CP3euUrF.js","assets/Grid01-BRgRtmbs.js","assets/Home02-lEMcKcn1.js","assets/List-7uuZoLIU.js"])))=>i.map(i=>d[i]);
2
- import{r as M,c as K,bj as Q,bk as A,aa as Y,j as t,an as D,bl as X,ac as ee}from"./index-M3wOD-T-.js";import{u as te}from"./useInfiniteQuery-DZakeCfr.js";import{B as _,c as J}from"./button-CrpAre8y.js";import{C as U}from"./checkbox-C3_7sazf.js";import{i as se}from"./AlertCircle-xn5rFX2T.js";import{c as G,i as ae}from"./Grid01-BRgRtmbs.js";import{n as ie}from"./Download01-BxIh__MC.js";import{i as re}from"./File02-Dh_9xh7Q.js";import{a as oe}from"./Home02-lEMcKcn1.js";import{i as V}from"./List-7uuZoLIU.js";import{i as L}from"./Loading01-CaAuMuYs.js";import{s as W}from"./Trash01-DFo133oe.js";import{i as $}from"./Upload01-D1Hk2Al6.js";import{u as q}from"./useMutation-i3JyomhH.js";const Z=({size:s=24,color:e="currentColor",...i})=>M.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...i},M.createElement("path",{d:"m13 7-1.116-2.231c-.32-.642-.481-.963-.72-1.198a2 2 0 0 0-.748-.462C10.1 3 9.74 3 9.022 3H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 4.52 2 5.08 2 6.2V7m0 0h15.2c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C22 9.28 22 10.12 22 11.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C19.72 21 18.88 21 17.2 21H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 18.72 2 17.88 2 16.2V7Zm10 10v-6m-3 3h6"}));Z.displayName="FolderPlus";const R={objects:(s,e,i=!1,o=100)=>["object-storage","objects",s,e,{flat:i,pageSize:o}],metadata:(s,e)=>["object-storage","metadata",s,e],imagePreview:(s,e)=>["object-storage","image-preview",s,e]},ne=100;function le(s){const e=K.c(30);let i;e[0]!==s?(i=s===void 0?{}:s,e[0]=s,e[1]=i):i=e[1];const o=i,{prefix:n,flat:x,pageSize:d}=o,m=n===void 0?"":n,l=x===void 0?!1:x,c=d===void 0?ne:d,{connectionId:b,toolCaller:S}=Q();let f;e[2]!==b||e[3]!==l||e[4]!==c||e[5]!==m?(f=R.objects(b,m,l,c),e[2]=b,e[3]=l,e[4]=c,e[5]=m,e[6]=f):f=e[6];let u;e[7]!==l||e[8]!==c||e[9]!==m||e[10]!==S?(u=async a=>{const{pageParam:r}=a;return await S("LIST_OBJECTS",{prefix:m||void 0,maxKeys:c,continuationToken:r,delimiter:l?void 0:"/"})},e[7]=l,e[8]=c,e[9]=m,e[10]=S,e[11]=u):u=e[11];let E;e[12]!==f||e[13]!==u?(E={queryKey:f,queryFn:u,initialPageParam:void 0,getNextPageParam:ge,staleTime:3e4},e[12]=f,e[13]=u,e[14]=E):E=e[14];const{data:p,isLoading:z,isFetchingNextPage:g,hasNextPage:y,fetchNextPage:h,error:w}=te(E);let v;if(l){let a;e[15]!==p?.pages?(a=p?.pages.flatMap(he).filter(pe).map(xe)??[],e[15]=p?.pages,e[16]=a):a=e[16],v=a}else{let a;if(e[17]!==p?.pages){const r=p?.pages[0]?.commonPrefixes?.map(ue)??[],j=p?.pages.flatMap(de)??[];a=[...r.sort(ce),...j],e[17]=p?.pages,e[18]=a}else a=e[18];v=a}let N;e[19]!==h||e[20]!==y||e[21]!==g?(N=()=>{y&&!g&&h()},e[19]=h,e[20]=y,e[21]=g,e[22]=N):N=e[22];const C=N,F=y??!1,P=w;let k;return e[23]!==g||e[24]!==z||e[25]!==C||e[26]!==v||e[27]!==P||e[28]!==F?(k={objects:v,isLoading:z,isFetchingMore:g,hasMore:F,loadMore:C,error:P},e[23]=g,e[24]=z,e[25]=C,e[26]=v,e[27]=P,e[28]=F,e[29]=k):k=e[29],k}function ce(s,e){return s.key.localeCompare(e.key)}function de(s){return s.objects.filter(fe).map(me)}function me(s){return{key:s.key,size:s.size,lastModified:s.lastModified,etag:s.etag,isFolder:!1}}function fe(s){return!s.key.endsWith("/")}function ue(s){return{key:s,size:0,lastModified:"",etag:"",isFolder:!0}}function xe(s){return{key:s.key,size:s.size,lastModified:s.lastModified,etag:s.etag,isFolder:!1}}function pe(s){return!s.key.endsWith("/")}function he(s){return s.objects}function ge(s){return s.nextContinuationToken}function I(s){const e=s.split("/").filter(Boolean);return e[e.length-1]||s}function je(s){if(s===0)return"0 B";const e=["B","KB","MB","GB","TB"],i=1024,o=Math.floor(Math.log(s)/Math.log(i));return`${parseFloat((s/Math.pow(i,o)).toFixed(1))} ${e[o]}`}function ye(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function ve(s){const e=[],i=s.split("/").filter(Boolean);let o="";for(const n of i)o+=n+"/",e.push({name:n,path:o});return e}function $e(s,e){switch(s.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":case"png":case"gif":case"webp":case"svg":return"Image01";case"mp4":case"mov":case"avi":case"webm":return"VideoRecorder";case"mp3":case"wav":case"ogg":return"Music01";case"pdf":return"File06";case"zip":case"tar":case"gz":case"rar":return"File07";case"js":case"ts":case"tsx":case"jsx":case"json":case"html":case"css":return"FileCode01";case"md":case"txt":return"File04";default:return"File02"}}const Ne=M.lazy(()=>X(()=>import("./grid-view-DW981ZW7.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])));function be(s){const e=K.c(50),{item:i,selected:o,showFullPath:n,onSelect:x,onNavigate:d,onDownload:m,onDelete:l}=s,c=n===void 0?!1:n;let b;e[0]!==i.key||e[1]!==c?(b=c?i.key:I(i.key),e[0]=i.key,e[1]=c,e[2]=b):b=e[2];const S=b;let f;e[3]!==x||e[4]!==o?(f=t.jsx(U,{checked:o,onCheckedChange:x,className:"opacity-0 group-hover:opacity-100 focus:opacity-100 data-[state=checked]:opacity-100"}),e[3]=x,e[4]=o,e[5]=f):f=e[5];let u;e[6]!==i.isFolder||e[7]!==i.key||e[8]!==d?(u=()=>i.isFolder?d(i.key):void 0,e[6]=i.isFolder,e[7]=i.key,e[8]=d,e[9]=u):u=e[9];const E=i.isFolder&&"cursor-pointer hover:text-primary";let p;e[10]!==E?(p=J("flex items-center gap-2 flex-1 min-w-0 text-left",E),e[10]=E,e[11]=p):p=e[11];let z;e[12]!==i.isFolder?(z=i.isFolder?t.jsx(ee,{size:18,className:"text-amber-500 shrink-0"}):t.jsx(re,{size:18,className:"text-muted-foreground shrink-0"}),e[12]=i.isFolder,e[13]=z):z=e[13];let g;e[14]!==S?(g=t.jsx("span",{className:"truncate",children:S}),e[14]=S,e[15]=g):g=e[15];let y;e[16]!==u||e[17]!==p||e[18]!==z||e[19]!==g?(y=t.jsxs("button",{type:"button",onClick:u,className:p,children:[z,g]}),e[16]=u,e[17]=p,e[18]=z,e[19]=g,e[20]=y):y=e[20];let h;e[21]!==i.isFolder||e[22]!==i.size?(h=i.isFolder?"-":je(i.size),e[21]=i.isFolder,e[22]=i.size,e[23]=h):h=e[23];let w;e[24]!==h?(w=t.jsx("span",{className:"text-sm text-muted-foreground w-20 text-right shrink-0",children:h}),e[24]=h,e[25]=w):w=e[25];let v;e[26]!==i.isFolder||e[27]!==i.lastModified?(v=i.isFolder?"-":ye(i.lastModified),e[26]=i.isFolder,e[27]=i.lastModified,e[28]=v):v=e[28];let N;e[29]!==v?(N=t.jsx("span",{className:"text-sm text-muted-foreground w-28 text-right shrink-0",children:v}),e[29]=v,e[30]=N):N=e[30];let C;e[31]!==i.isFolder||e[32]!==i.key||e[33]!==m?(C=!i.isFolder&&t.jsx(_,{variant:"ghost",size:"sm",className:"size-7 p-0",onClick:()=>m(i.key),children:t.jsx(ie,{size:14})}),e[31]=i.isFolder,e[32]=i.key,e[33]=m,e[34]=C):C=e[34];let F;e[35]!==i.key||e[36]!==l?(F=()=>l(i.key),e[35]=i.key,e[36]=l,e[37]=F):F=e[37];let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(W,{size:14}),e[38]=P):P=e[38];let k;e[39]!==F?(k=t.jsx(_,{variant:"ghost",size:"sm",className:"size-7 p-0 text-destructive hover:text-destructive",onClick:F,children:P}),e[39]=F,e[40]=k):k=e[40];let a;e[41]!==C||e[42]!==k?(a=t.jsxs("div",{className:"flex items-center gap-1 w-16 justify-end shrink-0 opacity-0 group-hover:opacity-100",children:[C,k]}),e[41]=C,e[42]=k,e[43]=a):a=e[43];let r;return e[44]!==w||e[45]!==N||e[46]!==a||e[47]!==f||e[48]!==y?(r=t.jsxs("div",{className:"group flex items-center gap-3 px-4 py-2 hover:bg-muted/50 border-b border-border last:border-b-0",children:[f,y,w,N,a]}),e[44]=w,e[45]=N,e[46]=a,e[47]=f,e[48]=y,e[49]=r):r=e[49],r}function H(s){const e=K.c(8),{prefix:i,onNavigate:o}=s;let n;if(e[0]!==o||e[1]!==i){const x=ve(i);let d;e[3]!==o?(d=()=>o(""),e[3]=o,e[4]=d):d=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(oe,{size:16}),e[5]=m):m=e[5];let l;e[6]!==d?(l=t.jsx("button",{type:"button",onClick:d,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground",children:m}),e[6]=d,e[7]=l):l=e[7],n=t.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[l,x.map((c,b)=>t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(ae,{size:14,className:"text-muted-foreground"}),t.jsx("button",{type:"button",onClick:()=>o(c.path),className:J("hover:text-primary",b===x.length-1?"font-medium text-foreground":"text-muted-foreground"),children:c.name})]},c.path))]}),e[0]=o,e[1]=i,e[2]=n}else n=e[2];return n}function ke(){const{path:s="",flat:e=!1,view:i="table"}=A.useSearch({from:"/"}),o=A.useNavigate(),[n,x]=M.useState(new Set),d=a=>{x(new Set),o({to:"/",search:{path:a||void 0,flat:e,view:i}})},m=a=>{x(new Set),o({to:"/",search:{path:a?void 0:s||void 0,flat:a,view:i}})},l=a=>{x(new Set),o({to:"/",search:{path:s||void 0,flat:e,view:a}})},c=M.useRef(null),b=Y(),{connectionId:S,toolCaller:f}=Q(),{objects:u,isLoading:E,isFetchingMore:p,hasMore:z,loadMore:g,error:y}=le({prefix:s,flat:e}),h=q({mutationFn:async a=>{const r=s+a.name,{url:j}=await f("PUT_PRESIGNED_URL",{key:r,contentType:a.type||"application/octet-stream"}),T=await fetch(j,{method:"PUT",body:a,headers:{"Content-Type":a.type||"application/octet-stream"}});if(!T.ok)throw new Error(`Upload failed: ${T.statusText}`);return r},onSuccess:a=>{D.success(`Uploaded ${I(a)}`),b.invalidateQueries({queryKey:R.objects(S,s)})},onError:a=>{D.error(`Upload failed: ${a.message}`)}}),w=q({mutationFn:async a=>a.length===1&&a[0]?f("DELETE_OBJECT",{key:a[0]}):f("DELETE_OBJECTS",{keys:a}),onSuccess:()=>{D.success("Deleted successfully"),x(new Set),b.invalidateQueries({queryKey:R.objects(S,s)})},onError:a=>{D.error(`Delete failed: ${a.message}`)}}),v=async a=>{try{const{url:r}=await f("GET_PRESIGNED_URL",{key:a}),j=await fetch(r);if(!j.ok)throw new Error(`Failed to fetch file: ${j.statusText}`);const T=await j.blob(),O=URL.createObjectURL(T),B=document.createElement("a");B.href=O,B.download=I(a),document.body.appendChild(B),B.click(),document.body.removeChild(B),URL.revokeObjectURL(O)}catch(r){D.error(`Download failed: ${r instanceof Error?r.message:"Unknown error"}`)}},N=a=>{const r=a.target.files;if(r){for(const j of Array.from(r))h.mutate(j);a.target.value=""}},C=(a,r)=>{const j=new Set(n);r?j.add(a):j.delete(a),x(j)},F=a=>{x(a?new Set(u.map(r=>r.key)):new Set)},P=()=>{n.size!==0&&w.mutate(Array.from(n))},k=a=>{if(!z||p)return;const r=a.currentTarget;r.scrollHeight-r.scrollTop-r.clientHeight<200&&g()};return y?t.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[t.jsx(se,{size:48,className:"text-destructive mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading files"}),t.jsx("p",{className:"text-muted-foreground text-center",children:y.message})]}):i==="grid"?t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-background",children:[e?t.jsx("span",{className:"text-sm text-muted-foreground",children:"All files (flat)"}):t.jsx(H,{prefix:s,onNavigate:d}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[t.jsx(U,{checked:!e,onCheckedChange:a=>m(!a)}),t.jsx("span",{className:"text-muted-foreground",children:"Show as directories"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(_,{variant:i==="grid"?"secondary":"ghost",size:"sm",className:"size-8 p-0",onClick:()=>l("grid"),children:t.jsx(G,{size:16})}),t.jsx(_,{variant:i==="table"?"secondary":"ghost",size:"sm",className:"size-8 p-0",onClick:()=>l("table"),children:t.jsx(V,{size:16})})]}),t.jsx("input",{ref:c,type:"file",multiple:!0,className:"hidden",onChange:N}),t.jsxs(_,{variant:"outline",size:"sm",onClick:()=>c.current?.click(),disabled:h.isPending,children:[h.isPending?t.jsx(L,{size:14,className:"mr-1 animate-spin"}):t.jsx($,{size:14,className:"mr-1"}),"Upload"]})]})]}),t.jsx(M.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(L,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Ne,{prefix:s,flat:e,onNavigate:d})})]}):t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-background",children:[e?t.jsx("span",{className:"text-sm text-muted-foreground",children:"All files (flat)"}):t.jsx(H,{prefix:s,onNavigate:d}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[t.jsx(U,{checked:!e,onCheckedChange:a=>m(!a)}),t.jsx("span",{className:"text-muted-foreground",children:"Show as directories"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(_,{variant:i==="grid"?"secondary":"ghost",size:"sm",className:"size-8 p-0",onClick:()=>l("grid"),children:t.jsx(G,{size:16})}),t.jsx(_,{variant:i==="table"?"secondary":"ghost",size:"sm",className:"size-8 p-0",onClick:()=>l("table"),children:t.jsx(V,{size:16})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[n.size>0&&t.jsxs(_,{variant:"outline",size:"sm",className:"text-destructive",onClick:P,disabled:w.isPending,children:[t.jsx(W,{size:14,className:"mr-1"}),"Delete (",n.size,")"]}),t.jsx("input",{ref:c,type:"file",multiple:!0,className:"hidden",onChange:N}),t.jsxs(_,{variant:"outline",size:"sm",onClick:()=>c.current?.click(),disabled:h.isPending,children:[h.isPending?t.jsx(L,{size:14,className:"mr-1 animate-spin"}):t.jsx($,{size:14,className:"mr-1"}),"Upload"]})]})]})]}),t.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-border bg-muted/30 text-sm font-medium text-muted-foreground",children:[t.jsx(U,{checked:n.size>0&&n.size===u.length,onCheckedChange:F}),t.jsx("span",{className:"flex-1",children:"Name"}),t.jsx("span",{className:"w-20 text-right",children:"Size"}),t.jsx("span",{className:"w-28 text-right",children:"Modified"}),t.jsx("span",{className:"w-16"})]}),t.jsx("div",{className:"flex-1 overflow-y-auto",onScroll:k,children:E?t.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[t.jsx(L,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading files..."})]}):u.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[t.jsx(Z,{size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"This folder is empty"}),t.jsx("p",{className:"text-muted-foreground mb-4",children:"Upload files to get started"}),t.jsxs(_,{variant:"outline",onClick:()=>c.current?.click(),children:[t.jsx($,{size:14,className:"mr-1"}),"Upload files"]})]}):t.jsxs(t.Fragment,{children:[u.map(a=>t.jsx(be,{item:a,selected:n.has(a.key),showFullPath:e,onSelect:r=>C(a.key,r),onNavigate:d,onDownload:v,onDelete:r=>w.mutate([r])},a.key)),p&&t.jsx("div",{className:"flex justify-center py-4",children:t.jsx(L,{size:20,className:"animate-spin text-muted-foreground"})})]})})]})}const Re=Object.freeze(Object.defineProperty({__proto__:null,default:ke},Symbol.toStringTag,{value:"Module"}));export{R as K,$e as a,Re as b,je as f,I as g,Z as s,le as u};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/grid-view-DBdpM4tG.js","assets/index-Dho9MRVw.js","assets/index-CqeIU8-o.css","assets/button-D_0RTXDt.js","assets/AlertCircle-DcHEglIM.js","assets/Download01-npnn9kWB.js","assets/File02-Cuc-ZPtg.js","assets/File06-BUwGdOjl.js","assets/Image01-BCcbzsoK.js","assets/Loading01-Bo9vDQAp.js","assets/Trash01-BUkAP1vf.js","assets/Upload01-DPPzM8Sw.js","assets/useMutation-Lj_Cbq0P.js","assets/useQuery-C2zqJzGD.js","assets/useInfiniteQuery-CVAyTLiO.js","assets/infiniteQueryObserver-DDmbfPGP.js","assets/checkbox-CUtYbeQD.js","assets/Check-BzMGOxMB.js","assets/Grid01-DmaR0g3f.js","assets/Home02-Cagj2miO.js","assets/List-DZ53jWcW.js"])))=>i.map(i=>d[i]);
2
+ import{r as M,c as K,bj as Q,bk as A,aa as Y,j as t,an as D,bl as X,ac as ee}from"./index-Dho9MRVw.js";import{u as te}from"./useInfiniteQuery-CVAyTLiO.js";import{B as _,c as J}from"./button-D_0RTXDt.js";import{C as U}from"./checkbox-CUtYbeQD.js";import{i as se}from"./AlertCircle-DcHEglIM.js";import{c as G,i as ae}from"./Grid01-DmaR0g3f.js";import{n as ie}from"./Download01-npnn9kWB.js";import{i as re}from"./File02-Cuc-ZPtg.js";import{a as oe}from"./Home02-Cagj2miO.js";import{i as V}from"./List-DZ53jWcW.js";import{i as L}from"./Loading01-Bo9vDQAp.js";import{s as W}from"./Trash01-BUkAP1vf.js";import{i as $}from"./Upload01-DPPzM8Sw.js";import{u as q}from"./useMutation-Lj_Cbq0P.js";const Z=({size:s=24,color:e="currentColor",...i})=>M.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...i},M.createElement("path",{d:"m13 7-1.116-2.231c-.32-.642-.481-.963-.72-1.198a2 2 0 0 0-.748-.462C10.1 3 9.74 3 9.022 3H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 4.52 2 5.08 2 6.2V7m0 0h15.2c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C22 9.28 22 10.12 22 11.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C19.72 21 18.88 21 17.2 21H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 18.72 2 17.88 2 16.2V7Zm10 10v-6m-3 3h6"}));Z.displayName="FolderPlus";const R={objects:(s,e,i=!1,o=100)=>["object-storage","objects",s,e,{flat:i,pageSize:o}],metadata:(s,e)=>["object-storage","metadata",s,e],imagePreview:(s,e)=>["object-storage","image-preview",s,e]},ne=100;function le(s){const e=K.c(30);let i;e[0]!==s?(i=s===void 0?{}:s,e[0]=s,e[1]=i):i=e[1];const o=i,{prefix:n,flat:x,pageSize:d}=o,m=n===void 0?"":n,l=x===void 0?!1:x,c=d===void 0?ne:d,{connectionId:b,toolCaller:S}=Q();let f;e[2]!==b||e[3]!==l||e[4]!==c||e[5]!==m?(f=R.objects(b,m,l,c),e[2]=b,e[3]=l,e[4]=c,e[5]=m,e[6]=f):f=e[6];let u;e[7]!==l||e[8]!==c||e[9]!==m||e[10]!==S?(u=async a=>{const{pageParam:r}=a;return await S("LIST_OBJECTS",{prefix:m||void 0,maxKeys:c,continuationToken:r,delimiter:l?void 0:"/"})},e[7]=l,e[8]=c,e[9]=m,e[10]=S,e[11]=u):u=e[11];let E;e[12]!==f||e[13]!==u?(E={queryKey:f,queryFn:u,initialPageParam:void 0,getNextPageParam:ge,staleTime:3e4},e[12]=f,e[13]=u,e[14]=E):E=e[14];const{data:p,isLoading:z,isFetchingNextPage:g,hasNextPage:y,fetchNextPage:h,error:w}=te(E);let v;if(l){let a;e[15]!==p?.pages?(a=p?.pages.flatMap(he).filter(pe).map(xe)??[],e[15]=p?.pages,e[16]=a):a=e[16],v=a}else{let a;if(e[17]!==p?.pages){const r=p?.pages[0]?.commonPrefixes?.map(ue)??[],j=p?.pages.flatMap(de)??[];a=[...r.sort(ce),...j],e[17]=p?.pages,e[18]=a}else a=e[18];v=a}let N;e[19]!==h||e[20]!==y||e[21]!==g?(N=()=>{y&&!g&&h()},e[19]=h,e[20]=y,e[21]=g,e[22]=N):N=e[22];const C=N,F=y??!1,P=w;let k;return e[23]!==g||e[24]!==z||e[25]!==C||e[26]!==v||e[27]!==P||e[28]!==F?(k={objects:v,isLoading:z,isFetchingMore:g,hasMore:F,loadMore:C,error:P},e[23]=g,e[24]=z,e[25]=C,e[26]=v,e[27]=P,e[28]=F,e[29]=k):k=e[29],k}function ce(s,e){return s.key.localeCompare(e.key)}function de(s){return s.objects.filter(fe).map(me)}function me(s){return{key:s.key,size:s.size,lastModified:s.lastModified,etag:s.etag,isFolder:!1}}function fe(s){return!s.key.endsWith("/")}function ue(s){return{key:s,size:0,lastModified:"",etag:"",isFolder:!0}}function xe(s){return{key:s.key,size:s.size,lastModified:s.lastModified,etag:s.etag,isFolder:!1}}function pe(s){return!s.key.endsWith("/")}function he(s){return s.objects}function ge(s){return s.nextContinuationToken}function I(s){const e=s.split("/").filter(Boolean);return e[e.length-1]||s}function je(s){if(s===0)return"0 B";const e=["B","KB","MB","GB","TB"],i=1024,o=Math.floor(Math.log(s)/Math.log(i));return`${parseFloat((s/Math.pow(i,o)).toFixed(1))} ${e[o]}`}function ye(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function ve(s){const e=[],i=s.split("/").filter(Boolean);let o="";for(const n of i)o+=n+"/",e.push({name:n,path:o});return e}function $e(s,e){switch(s.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":case"png":case"gif":case"webp":case"svg":return"Image01";case"mp4":case"mov":case"avi":case"webm":return"VideoRecorder";case"mp3":case"wav":case"ogg":return"Music01";case"pdf":return"File06";case"zip":case"tar":case"gz":case"rar":return"File07";case"js":case"ts":case"tsx":case"jsx":case"json":case"html":case"css":return"FileCode01";case"md":case"txt":return"File04";default:return"File02"}}const Ne=M.lazy(()=>X(()=>import("./grid-view-DBdpM4tG.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])));function be(s){const e=K.c(50),{item:i,selected:o,showFullPath:n,onSelect:x,onNavigate:d,onDownload:m,onDelete:l}=s,c=n===void 0?!1:n;let b;e[0]!==i.key||e[1]!==c?(b=c?i.key:I(i.key),e[0]=i.key,e[1]=c,e[2]=b):b=e[2];const S=b;let f;e[3]!==x||e[4]!==o?(f=t.jsx(U,{checked:o,onCheckedChange:x,className:"opacity-0 group-hover:opacity-100 focus:opacity-100 data-[state=checked]:opacity-100"}),e[3]=x,e[4]=o,e[5]=f):f=e[5];let u;e[6]!==i.isFolder||e[7]!==i.key||e[8]!==d?(u=()=>i.isFolder?d(i.key):void 0,e[6]=i.isFolder,e[7]=i.key,e[8]=d,e[9]=u):u=e[9];const E=i.isFolder&&"cursor-pointer hover:text-primary";let p;e[10]!==E?(p=J("flex items-center gap-2 flex-1 min-w-0 text-left",E),e[10]=E,e[11]=p):p=e[11];let z;e[12]!==i.isFolder?(z=i.isFolder?t.jsx(ee,{size:18,className:"text-amber-500 shrink-0"}):t.jsx(re,{size:18,className:"text-muted-foreground shrink-0"}),e[12]=i.isFolder,e[13]=z):z=e[13];let g;e[14]!==S?(g=t.jsx("span",{className:"truncate",children:S}),e[14]=S,e[15]=g):g=e[15];let y;e[16]!==u||e[17]!==p||e[18]!==z||e[19]!==g?(y=t.jsxs("button",{type:"button",onClick:u,className:p,children:[z,g]}),e[16]=u,e[17]=p,e[18]=z,e[19]=g,e[20]=y):y=e[20];let h;e[21]!==i.isFolder||e[22]!==i.size?(h=i.isFolder?"-":je(i.size),e[21]=i.isFolder,e[22]=i.size,e[23]=h):h=e[23];let w;e[24]!==h?(w=t.jsx("span",{className:"text-sm text-muted-foreground w-20 text-right shrink-0",children:h}),e[24]=h,e[25]=w):w=e[25];let v;e[26]!==i.isFolder||e[27]!==i.lastModified?(v=i.isFolder?"-":ye(i.lastModified),e[26]=i.isFolder,e[27]=i.lastModified,e[28]=v):v=e[28];let N;e[29]!==v?(N=t.jsx("span",{className:"text-sm text-muted-foreground w-28 text-right shrink-0",children:v}),e[29]=v,e[30]=N):N=e[30];let C;e[31]!==i.isFolder||e[32]!==i.key||e[33]!==m?(C=!i.isFolder&&t.jsx(_,{variant:"ghost",size:"sm",className:"size-7 p-0",onClick:()=>m(i.key),children:t.jsx(ie,{size:14})}),e[31]=i.isFolder,e[32]=i.key,e[33]=m,e[34]=C):C=e[34];let F;e[35]!==i.key||e[36]!==l?(F=()=>l(i.key),e[35]=i.key,e[36]=l,e[37]=F):F=e[37];let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(W,{size:14}),e[38]=P):P=e[38];let k;e[39]!==F?(k=t.jsx(_,{variant:"ghost",size:"sm",className:"size-7 p-0 text-destructive hover:text-destructive",onClick:F,children:P}),e[39]=F,e[40]=k):k=e[40];let a;e[41]!==C||e[42]!==k?(a=t.jsxs("div",{className:"flex items-center gap-1 w-16 justify-end shrink-0 opacity-0 group-hover:opacity-100",children:[C,k]}),e[41]=C,e[42]=k,e[43]=a):a=e[43];let r;return e[44]!==w||e[45]!==N||e[46]!==a||e[47]!==f||e[48]!==y?(r=t.jsxs("div",{className:"group flex items-center gap-3 px-4 py-2 hover:bg-muted/50 border-b border-border last:border-b-0",children:[f,y,w,N,a]}),e[44]=w,e[45]=N,e[46]=a,e[47]=f,e[48]=y,e[49]=r):r=e[49],r}function H(s){const e=K.c(8),{prefix:i,onNavigate:o}=s;let n;if(e[0]!==o||e[1]!==i){const x=ve(i);let d;e[3]!==o?(d=()=>o(""),e[3]=o,e[4]=d):d=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(oe,{size:16}),e[5]=m):m=e[5];let l;e[6]!==d?(l=t.jsx("button",{type:"button",onClick:d,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground",children:m}),e[6]=d,e[7]=l):l=e[7],n=t.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[l,x.map((c,b)=>t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(ae,{size:14,className:"text-muted-foreground"}),t.jsx("button",{type:"button",onClick:()=>o(c.path),className:J("hover:text-primary",b===x.length-1?"font-medium text-foreground":"text-muted-foreground"),children:c.name})]},c.path))]}),e[0]=o,e[1]=i,e[2]=n}else n=e[2];return n}function ke(){const{path:s="",flat:e=!1,view:i="table"}=A.useSearch({from:"/"}),o=A.useNavigate(),[n,x]=M.useState(new Set),d=a=>{x(new Set),o({to:"/",search:{path:a||void 0,flat:e,view:i}})},m=a=>{x(new Set),o({to:"/",search:{path:a?void 0:s||void 0,flat:a,view:i}})},l=a=>{x(new Set),o({to:"/",search:{path:s||void 0,flat:e,view:a}})},c=M.useRef(null),b=Y(),{connectionId:S,toolCaller:f}=Q(),{objects:u,isLoading:E,isFetchingMore:p,hasMore:z,loadMore:g,error:y}=le({prefix:s,flat:e}),h=q({mutationFn:async a=>{const r=s+a.name,{url:j}=await f("PUT_PRESIGNED_URL",{key:r,contentType:a.type||"application/octet-stream"}),T=await fetch(j,{method:"PUT",body:a,headers:{"Content-Type":a.type||"application/octet-stream"}});if(!T.ok)throw new Error(`Upload failed: ${T.statusText}`);return r},onSuccess:a=>{D.success(`Uploaded ${I(a)}`),b.invalidateQueries({queryKey:R.objects(S,s)})},onError:a=>{D.error(`Upload failed: ${a.message}`)}}),w=q({mutationFn:async a=>a.length===1&&a[0]?f("DELETE_OBJECT",{key:a[0]}):f("DELETE_OBJECTS",{keys:a}),onSuccess:()=>{D.success("Deleted successfully"),x(new Set),b.invalidateQueries({queryKey:R.objects(S,s)})},onError:a=>{D.error(`Delete failed: ${a.message}`)}}),v=async a=>{try{const{url:r}=await f("GET_PRESIGNED_URL",{key:a}),j=await fetch(r);if(!j.ok)throw new Error(`Failed to fetch file: ${j.statusText}`);const T=await j.blob(),O=URL.createObjectURL(T),B=document.createElement("a");B.href=O,B.download=I(a),document.body.appendChild(B),B.click(),document.body.removeChild(B),URL.revokeObjectURL(O)}catch(r){D.error(`Download failed: ${r instanceof Error?r.message:"Unknown error"}`)}},N=a=>{const r=a.target.files;if(r){for(const j of Array.from(r))h.mutate(j);a.target.value=""}},C=(a,r)=>{const j=new Set(n);r?j.add(a):j.delete(a),x(j)},F=a=>{x(a?new Set(u.map(r=>r.key)):new Set)},P=()=>{n.size!==0&&w.mutate(Array.from(n))},k=a=>{if(!z||p)return;const r=a.currentTarget;r.scrollHeight-r.scrollTop-r.clientHeight<200&&g()};return y?t.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[t.jsx(se,{size:48,className:"text-destructive mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading files"}),t.jsx("p",{className:"text-muted-foreground text-center",children:y.message})]}):i==="grid"?t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-background",children:[e?t.jsx("span",{className:"text-sm text-muted-foreground",children:"All files (flat)"}):t.jsx(H,{prefix:s,onNavigate:d}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[t.jsx(U,{checked:!e,onCheckedChange:a=>m(!a)}),t.jsx("span",{className:"text-muted-foreground",children:"Show as directories"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(_,{variant:i==="grid"?"secondary":"ghost",size:"sm",className:"size-8 p-0",onClick:()=>l("grid"),children:t.jsx(G,{size:16})}),t.jsx(_,{variant:i==="table"?"secondary":"ghost",size:"sm",className:"size-8 p-0",onClick:()=>l("table"),children:t.jsx(V,{size:16})})]}),t.jsx("input",{ref:c,type:"file",multiple:!0,className:"hidden",onChange:N}),t.jsxs(_,{variant:"outline",size:"sm",onClick:()=>c.current?.click(),disabled:h.isPending,children:[h.isPending?t.jsx(L,{size:14,className:"mr-1 animate-spin"}):t.jsx($,{size:14,className:"mr-1"}),"Upload"]})]})]}),t.jsx(M.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(L,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Ne,{prefix:s,flat:e,onNavigate:d})})]}):t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-background",children:[e?t.jsx("span",{className:"text-sm text-muted-foreground",children:"All files (flat)"}):t.jsx(H,{prefix:s,onNavigate:d}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[t.jsx(U,{checked:!e,onCheckedChange:a=>m(!a)}),t.jsx("span",{className:"text-muted-foreground",children:"Show as directories"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(_,{variant:i==="grid"?"secondary":"ghost",size:"sm",className:"size-8 p-0",onClick:()=>l("grid"),children:t.jsx(G,{size:16})}),t.jsx(_,{variant:i==="table"?"secondary":"ghost",size:"sm",className:"size-8 p-0",onClick:()=>l("table"),children:t.jsx(V,{size:16})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[n.size>0&&t.jsxs(_,{variant:"outline",size:"sm",className:"text-destructive",onClick:P,disabled:w.isPending,children:[t.jsx(W,{size:14,className:"mr-1"}),"Delete (",n.size,")"]}),t.jsx("input",{ref:c,type:"file",multiple:!0,className:"hidden",onChange:N}),t.jsxs(_,{variant:"outline",size:"sm",onClick:()=>c.current?.click(),disabled:h.isPending,children:[h.isPending?t.jsx(L,{size:14,className:"mr-1 animate-spin"}):t.jsx($,{size:14,className:"mr-1"}),"Upload"]})]})]})]}),t.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-border bg-muted/30 text-sm font-medium text-muted-foreground",children:[t.jsx(U,{checked:n.size>0&&n.size===u.length,onCheckedChange:F}),t.jsx("span",{className:"flex-1",children:"Name"}),t.jsx("span",{className:"w-20 text-right",children:"Size"}),t.jsx("span",{className:"w-28 text-right",children:"Modified"}),t.jsx("span",{className:"w-16"})]}),t.jsx("div",{className:"flex-1 overflow-y-auto",onScroll:k,children:E?t.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[t.jsx(L,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading files..."})]}):u.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[t.jsx(Z,{size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"This folder is empty"}),t.jsx("p",{className:"text-muted-foreground mb-4",children:"Upload files to get started"}),t.jsxs(_,{variant:"outline",onClick:()=>c.current?.click(),children:[t.jsx($,{size:14,className:"mr-1"}),"Upload files"]})]}):t.jsxs(t.Fragment,{children:[u.map(a=>t.jsx(be,{item:a,selected:n.has(a.key),showFullPath:e,onSelect:r=>C(a.key,r),onNavigate:d,onDownload:v,onDelete:r=>w.mutate([r])},a.key)),p&&t.jsx("div",{className:"flex justify-center py-4",children:t.jsx(L,{size:20,className:"animate-spin text-muted-foreground"})})]})})]})}const Re=Object.freeze(Object.defineProperty({__proto__:null,default:ke},Symbol.toStringTag,{value:"Module"}));export{R as K,$e as a,Re as b,je as f,I as g,Z as s,le as u};
@@ -1 +1 @@
1
- import{c as d,j as m,at as b,au as j,av as v,r as f,Z as C,aw as N,ax as h}from"./index-M3wOD-T-.js";import{c as u}from"./button-CrpAre8y.js";function S(t){const e=d.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let a;e[3]!==s?(a=u("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",s),e[3]=s,e[4]=a):a=e[4];let r;return e[5]!==o||e[6]!==a?(r=m.jsx(b,{"data-slot":"label",className:a,...o}),e[5]=o,e[6]=a,e[7]=r):r=e[7],r}const D=j,I=f.createContext({}),E=t=>{const e=d.c(9);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s.name?(o={name:s.name},e[2]=s.name,e[3]=o):o=e[3];let a;e[4]!==s?(a=m.jsx(v,{...s}),e[4]=s,e[5]=a):a=e[5];let r;return e[6]!==o||e[7]!==a?(r=m.jsx(I.Provider,{value:o,children:a}),e[6]=o,e[7]=a,e[8]=r):r=e[8],r},x=()=>{const t=d.c(13),e=f.useContext(I),s=f.useContext($),{getFieldState:o}=N();let a;t[0]!==e.name?(a={name:e.name},t[0]=e.name,t[1]=a):a=t[1];const r=h(a);let n;t[2]!==e.name||t[3]!==r||t[4]!==o?(n=o(e.name,r),t[2]=e.name,t[3]=r,t[4]=o,t[5]=n):n=t[5];const l=n;if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=s,c=`${i}-form-item`,F=`${i}-form-item-description`,g=`${i}-form-item-message`;let p;return t[6]!==e.name||t[7]!==l||t[8]!==i||t[9]!==c||t[10]!==F||t[11]!==g?(p={id:i,name:e.name,formItemId:c,formDescriptionId:F,formMessageId:g,...l},t[6]=e.name,t[7]=l,t[8]=i,t[9]=c,t[10]=F,t[11]=g,t[12]=p):p=t[12],p},$=f.createContext({});function M(t){const e=d.c(13);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const a=f.useId();let r;e[3]!==a?(r={id:a},e[3]=a,e[4]=r):r=e[4];let n;e[5]!==s?(n=u("grid gap-2",s),e[5]=s,e[6]=n):n=e[6];let l;e[7]!==o||e[8]!==n?(l=m.jsx("div",{"data-slot":"form-item",className:n,...o}),e[7]=o,e[8]=n,e[9]=l):l=e[9];let i;return e[10]!==r||e[11]!==l?(i=m.jsx($.Provider,{value:r,children:l}),e[10]=r,e[11]=l,e[12]=i):i=e[12],i}function L(t){const e=d.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:a,formItemId:r}=x(),n=!!a;let l;e[3]!==s?(l=u("text-foreground data-[error=true]:text-destructive",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==r||e[6]!==o||e[7]!==n||e[8]!==l?(i=m.jsx(S,{"data-slot":"form-label","data-error":n,className:l,htmlFor:r,...o}),e[5]=r,e[6]=o,e[7]=n,e[8]=l,e[9]=i):i=e[9],i}function P(t){const e=d.c(7);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];const{error:o,formItemId:a,formDescriptionId:r,formMessageId:n}=x(),l=o?`${r} ${n}`:`${r}`,i=!!o;let c;return e[2]!==a||e[3]!==s||e[4]!==l||e[5]!==i?(c=m.jsx(C,{"data-slot":"form-control",id:a,"aria-describedby":l,"aria-invalid":i,...s}),e[2]=a,e[3]=s,e[4]=l,e[5]=i,e[6]=c):c=e[6],c}function R(t){const e=d.c(9);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{formDescriptionId:a}=x();let r;e[3]!==s?(r=u("text-muted-foreground text-sm",s),e[3]=s,e[4]=r):r=e[4];let n;return e[5]!==a||e[6]!==o||e[7]!==r?(n=m.jsx("p",{"data-slot":"form-description",id:a,className:r,...o}),e[5]=a,e[6]=o,e[7]=r,e[8]=n):n=e[8],n}function Z(t){const e=d.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:a,formMessageId:r}=x(),n=a?String(a?.message??""):o.children;if(!n)return null;let l;e[3]!==s?(l=u("text-destructive text-sm",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==n||e[6]!==r||e[7]!==o||e[8]!==l?(i=m.jsx("p",{"data-slot":"form-message",id:r,className:l,...o,children:n}),e[5]=n,e[6]=r,e[7]=o,e[8]=l,e[9]=i):i=e[9],i}export{E as F,S as L,D as a,M as b,L as c,P as d,R as e,Z as f};
1
+ import{c as d,j as m,at as b,au as j,av as v,r as f,Z as C,aw as N,ax as h}from"./index-Dho9MRVw.js";import{c as u}from"./button-D_0RTXDt.js";function S(t){const e=d.c(8);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let a;e[3]!==s?(a=u("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",s),e[3]=s,e[4]=a):a=e[4];let r;return e[5]!==o||e[6]!==a?(r=m.jsx(b,{"data-slot":"label",className:a,...o}),e[5]=o,e[6]=a,e[7]=r):r=e[7],r}const D=j,I=f.createContext({}),E=t=>{const e=d.c(9);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];let o;e[2]!==s.name?(o={name:s.name},e[2]=s.name,e[3]=o):o=e[3];let a;e[4]!==s?(a=m.jsx(v,{...s}),e[4]=s,e[5]=a):a=e[5];let r;return e[6]!==o||e[7]!==a?(r=m.jsx(I.Provider,{value:o,children:a}),e[6]=o,e[7]=a,e[8]=r):r=e[8],r},x=()=>{const t=d.c(13),e=f.useContext(I),s=f.useContext($),{getFieldState:o}=N();let a;t[0]!==e.name?(a={name:e.name},t[0]=e.name,t[1]=a):a=t[1];const r=h(a);let n;t[2]!==e.name||t[3]!==r||t[4]!==o?(n=o(e.name,r),t[2]=e.name,t[3]=r,t[4]=o,t[5]=n):n=t[5];const l=n;if(!e)throw new Error("useFormField should be used within <FormField>");const{id:i}=s,c=`${i}-form-item`,F=`${i}-form-item-description`,g=`${i}-form-item-message`;let p;return t[6]!==e.name||t[7]!==l||t[8]!==i||t[9]!==c||t[10]!==F||t[11]!==g?(p={id:i,name:e.name,formItemId:c,formDescriptionId:F,formMessageId:g,...l},t[6]=e.name,t[7]=l,t[8]=i,t[9]=c,t[10]=F,t[11]=g,t[12]=p):p=t[12],p},$=f.createContext({});function M(t){const e=d.c(13);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const a=f.useId();let r;e[3]!==a?(r={id:a},e[3]=a,e[4]=r):r=e[4];let n;e[5]!==s?(n=u("grid gap-2",s),e[5]=s,e[6]=n):n=e[6];let l;e[7]!==o||e[8]!==n?(l=m.jsx("div",{"data-slot":"form-item",className:n,...o}),e[7]=o,e[8]=n,e[9]=l):l=e[9];let i;return e[10]!==r||e[11]!==l?(i=m.jsx($.Provider,{value:r,children:l}),e[10]=r,e[11]=l,e[12]=i):i=e[12],i}function L(t){const e=d.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:a,formItemId:r}=x(),n=!!a;let l;e[3]!==s?(l=u("text-foreground data-[error=true]:text-destructive",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==r||e[6]!==o||e[7]!==n||e[8]!==l?(i=m.jsx(S,{"data-slot":"form-label","data-error":n,className:l,htmlFor:r,...o}),e[5]=r,e[6]=o,e[7]=n,e[8]=l,e[9]=i):i=e[9],i}function P(t){const e=d.c(7);let s;e[0]!==t?({...s}=t,e[0]=t,e[1]=s):s=e[1];const{error:o,formItemId:a,formDescriptionId:r,formMessageId:n}=x(),l=o?`${r} ${n}`:`${r}`,i=!!o;let c;return e[2]!==a||e[3]!==s||e[4]!==l||e[5]!==i?(c=m.jsx(C,{"data-slot":"form-control",id:a,"aria-describedby":l,"aria-invalid":i,...s}),e[2]=a,e[3]=s,e[4]=l,e[5]=i,e[6]=c):c=e[6],c}function R(t){const e=d.c(9);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{formDescriptionId:a}=x();let r;e[3]!==s?(r=u("text-muted-foreground text-sm",s),e[3]=s,e[4]=r):r=e[4];let n;return e[5]!==a||e[6]!==o||e[7]!==r?(n=m.jsx("p",{"data-slot":"form-description",id:a,className:r,...o}),e[5]=a,e[6]=o,e[7]=r,e[8]=n):n=e[8],n}function Z(t){const e=d.c(10);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{error:a,formMessageId:r}=x(),n=a?String(a?.message??""):o.children;if(!n)return null;let l;e[3]!==s?(l=u("text-destructive text-sm",s),e[3]=s,e[4]=l):l=e[4];let i;return e[5]!==n||e[6]!==r||e[7]!==o||e[8]!==l?(i=m.jsx("p",{"data-slot":"form-message",id:r,className:l,...o,children:n}),e[5]=n,e[6]=r,e[7]=o,e[8]=l,e[9]=i):i=e[9],i}export{E as F,S as L,D as a,M as b,L as c,P as d,R as e,Z as f};
@@ -1 +1 @@
1
- import{r as v,c as M,bj as D,j as s,aa as q,an as w,ac as H}from"./index-M3wOD-T-.js";import{K as L,u as Z,g as R,s as Q,a as W,f as U}from"./file-browser-DsCPH1Ag.js";import{c as I,B as E}from"./button-CrpAre8y.js";import{i as S}from"./AlertCircle-xn5rFX2T.js";import{n as A}from"./Download01-BxIh__MC.js";import{i as $}from"./File02-Dh_9xh7Q.js";import{i as J}from"./File06-B5Dv7-Oa.js";import{a as P}from"./Image01-DoUr5ERm.js";import{i as T}from"./Loading01-CaAuMuYs.js";import{s as V}from"./Trash01-DFo133oe.js";import{i as Y}from"./Upload01-D1Hk2Al6.js";import{u as _}from"./useMutation-i3JyomhH.js";import{u as X}from"./useQuery-BQUu3Rwx.js";import"./useInfiniteQuery-DZakeCfr.js";import"./infiniteQueryObserver-CfX1I4Ag.js";import"./checkbox-C3_7sazf.js";import"./Check-CP3euUrF.js";import"./Grid01-BRgRtmbs.js";import"./Home02-lEMcKcn1.js";import"./List-7uuZoLIU.js";const B=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C14.76 8 15.04 8 15.6 8h4.13M20 9.988V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));B.displayName="File04";const G=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437c.214.11.494.11 1.054.11h4.13M8 15v3m8-5v5m-4-7.5V18m8-8.012V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));G.displayName="File07";const K=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437c.214.11.494.11 1.054.11h4.13M14 17.5l2.5-2.5-2.5-2.5m-4 0L7.5 15l2.5 2.5m10-7.512V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));K.displayName="FileCode01";const O=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M22 8.931c0-.605 0-.908-.12-1.049a.5.5 0 0 0-.42-.173c-.183.014-.397.228-.826.657L17 12l3.634 3.634c.429.429.643.643.827.657a.5.5 0 0 0 .42-.173c.119-.14.119-.444.119-1.05V8.932ZM2 9.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 5 5.12 5 6.8 5h5.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C17 7.28 17 8.12 17 9.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C14.72 19 13.88 19 12.2 19H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 16.72 2 15.88 2 14.2V9.8Z"}));O.displayName="VideoRecorder";function ee(i){const e=M.c(5),[t,g]=v.useState(!1),c=v.useRef(null),d=v.useRef(!1);let n;e[0]!==i?(n=u=>{c.current&&(c.current.disconnect(),c.current=null),u&&!d.current&&(c.current=new IntersectionObserver(y=>{const[a]=y;a?.isIntersecting&&!d.current&&(d.current=!0,g(!0),c.current?.disconnect(),c.current=null)},i),c.current.observe(u))},e[0]=i,e[1]=n):n=e[1];const l=n;let h;return e[2]!==t||e[3]!==l?(h=[t,l],e[2]=t,e[3]=l,e[4]=h):h=e[4],h}function te(i){const e=M.c(24),{objectKey:t,alt:g,className:c}=i,d=c===void 0?"":c,{connectionId:n,toolCaller:l}=D();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={rootMargin:"100px",threshold:0},e[0]=h):h=e[0];const[u,y]=ee(h);let a;e[1]!==n||e[2]!==t?(a=L.imagePreview(n,t),e[1]=n,e[2]=t,e[3]=a):a=e[3];let f;e[4]!==t||e[5]!==l?(f=async()=>{const{url:m}=await l("GET_PRESIGNED_URL",{key:t});return m},e[4]=t,e[5]=l,e[6]=f):f=e[6];let k;e[7]!==u||e[8]!==a||e[9]!==f?(k={queryKey:a,queryFn:f,enabled:u,staleTime:3e5,gcTime:6e5},e[7]=u,e[8]=a,e[9]=f,e[10]=k):k=e[10];const{data:b,isLoading:x,error:j}=X(k);let p;e[11]!==d?(p=I("relative w-full h-full flex items-center justify-center overflow-hidden",d),e[11]=d,e[12]=p):p=e[12];let r;e[13]!==g||e[14]!==j||e[15]!==b||e[16]!==x||e[17]!==u||e[18]!==t?(r=!u||x?s.jsx("div",{className:"flex flex-col items-center justify-center text-muted-foreground",children:x?s.jsx(T,{size:24,className:"animate-spin"}):s.jsx(P,{size:48})}):j?s.jsx("div",{className:"flex flex-col items-center justify-center text-muted-foreground",children:s.jsx(S,{size:24})}):b?s.jsx("img",{src:b,alt:g||t,className:"w-full h-full object-cover",loading:"lazy"}):null,e[13]=g,e[14]=j,e[15]=b,e[16]=x,e[17]=u,e[18]=t,e[19]=r):r=e[19];let o;return e[20]!==y||e[21]!==p||e[22]!==r?(o=s.jsx("div",{ref:y,className:p,children:r}),e[20]=y,e[21]=p,e[22]=r,e[23]=o):o=e[23],o}const z=12,se={Image01:P,VideoRecorder:O,Music01:$,File02:$,File04:B,File06:J,File07:G,FileCode01:K,Folder:H};function re(i){const e=i.split(".").pop()?.toLowerCase();return["jpg","jpeg","png","gif","webp","svg","bmp","ico"].includes(e||"")}function oe(i){const e=M.c(41),{item:t,onNavigate:g,onDownload:c,onDelete:d}=i;let n;e[0]!==t.key?(n=R(t.key),e[0]=t.key,e[1]=n):n=e[1];const l=n,h=t.isFolder?"Folder":W(t.key),u=se[h]||$;let y;e[2]!==t.isFolder||e[3]!==t.key?(y=!t.isFolder&&re(t.key),e[2]=t.isFolder,e[3]=t.key,e[4]=y):y=e[4];const a=y;let f;e[5]!==t.isFolder||e[6]!==t.key||e[7]!==g?(f=()=>t.isFolder?g(t.key):void 0,e[5]=t.isFolder,e[6]=t.key,e[7]=g,e[8]=f):f=e[8];const k=!a&&"p-4",b=t.isFolder?"cursor-pointer":"cursor-default";let x;e[9]!==k||e[10]!==b?(x=I("flex flex-col items-center justify-center w-full h-full",k,b),e[9]=k,e[10]=b,e[11]=x):x=e[11];let j;e[12]!==u||e[13]!==a||e[14]!==t.isFolder||e[15]!==t.key||e[16]!==l?(j=a?s.jsx("div",{className:"absolute inset-0",children:s.jsx(te,{objectKey:t.key,alt:l})}):s.jsx(u,{size:48,className:I(t.isFolder?"text-amber-500":"text-muted-foreground")}),e[12]=u,e[13]=a,e[14]=t.isFolder,e[15]=t.key,e[16]=l,e[17]=j):j=e[17];let p;e[18]!==a||e[19]!==t.isFolder||e[20]!==t.size||e[21]!==l?(p=a?s.jsxs("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2 pt-6",children:[s.jsx("span",{className:"text-sm text-white text-center line-clamp-1 block",children:l}),s.jsx("span",{className:"text-xs text-white/70 text-center block",children:U(t.size)})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mt-3 text-sm text-center line-clamp-2 px-2",children:l}),!t.isFolder&&s.jsx("span",{className:"mt-1 text-xs text-muted-foreground",children:U(t.size)})]}),e[18]=a,e[19]=t.isFolder,e[20]=t.size,e[21]=l,e[22]=p):p=e[22];let r;e[23]!==f||e[24]!==x||e[25]!==j||e[26]!==p?(r=s.jsxs("button",{type:"button",onClick:f,className:x,children:[j,p]}),e[23]=f,e[24]=x,e[25]=j,e[26]=p,e[27]=r):r=e[27];let o;e[28]!==t.isFolder||e[29]!==t.key||e[30]!==d||e[31]!==c?(o=!t.isFolder&&s.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0",onClick:F=>{F.stopPropagation(),c(t.key)},children:s.jsx(A,{size:14})}),s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0 text-destructive hover:text-destructive",onClick:F=>{F.stopPropagation(),d(t.key)},children:s.jsx(V,{size:14})})]}),e[28]=t.isFolder,e[29]=t.key,e[30]=d,e[31]=c,e[32]=o):o=e[32];let m;e[33]!==t.isFolder||e[34]!==t.key||e[35]!==d?(m=t.isFolder&&s.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0 text-destructive hover:text-destructive",onClick:F=>{F.stopPropagation(),d(t.key)},children:s.jsx(V,{size:14})})}),e[33]=t.isFolder,e[34]=t.key,e[35]=d,e[36]=m):m=e[36];let N;return e[37]!==o||e[38]!==m||e[39]!==r?(N=s.jsxs("div",{className:"group relative aspect-square bg-muted/30 rounded-lg border border-border hover:border-primary/50 hover:bg-muted/50 transition-colors overflow-hidden",children:[r,o,m]}),e[37]=o,e[38]=m,e[39]=r,e[40]=N):N=e[40],N}function Ce({prefix:i,flat:e,onNavigate:t}){const g=v.useRef(null),c=q(),{connectionId:d,toolCaller:n}=D(),{objects:l,isLoading:h,isFetchingMore:u,hasMore:y,loadMore:a,error:f}=Z({prefix:i,flat:e,pageSize:z}),k=_({mutationFn:async r=>{const o=i+r.name,{url:m}=await n("PUT_PRESIGNED_URL",{key:o,contentType:r.type||"application/octet-stream"}),N=await fetch(m,{method:"PUT",body:r,headers:{"Content-Type":r.type||"application/octet-stream"}});if(!N.ok)throw new Error(`Upload failed: ${N.statusText}`);return o},onSuccess:r=>{w.success(`Uploaded ${R(r)}`),c.invalidateQueries({queryKey:L.objects(d,i,e,z)})},onError:r=>{w.error(`Upload failed: ${r.message}`)}}),b=_({mutationFn:async r=>r.length===1&&r[0]?n("DELETE_OBJECT",{key:r[0]}):n("DELETE_OBJECTS",{keys:r}),onSuccess:()=>{w.success("Deleted successfully"),c.invalidateQueries({queryKey:L.objects(d,i,e,z)})},onError:r=>{w.error(`Delete failed: ${r.message}`)}}),x=async r=>{try{const{url:o}=await n("GET_PRESIGNED_URL",{key:r}),m=await fetch(o);if(!m.ok)throw new Error(`Failed to fetch file: ${m.statusText}`);const N=await m.blob(),F=URL.createObjectURL(N),C=document.createElement("a");C.href=F,C.download=R(r),document.body.appendChild(C),C.click(),document.body.removeChild(C),URL.revokeObjectURL(F)}catch(o){w.error(`Download failed: ${o instanceof Error?o.message:"Unknown error"}`)}},j=r=>{const o=r.target.files;if(o){for(const m of Array.from(o))k.mutate(m);r.target.value=""}},p=r=>{if(!y||u)return;const o=r.currentTarget;o.scrollHeight-o.scrollTop-o.clientHeight<200&&a()};return f?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[s.jsx(S,{size:48,className:"text-destructive mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading files"}),s.jsx("p",{className:"text-muted-foreground text-center",children:f.message})]}):s.jsx("div",{className:"flex-1 overflow-y-auto p-4",onScroll:p,children:h?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[s.jsx(T,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading files..."})]}):l.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(Q,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"This folder is empty"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Upload files to get started"}),s.jsx("input",{ref:g,type:"file",multiple:!0,className:"hidden",onChange:j}),s.jsxs(E,{variant:"outline",onClick:()=>g.current?.click(),children:[s.jsx(Y,{size:14,className:"mr-1"}),"Upload files"]})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4",children:l.map(r=>s.jsx(oe,{item:r,onNavigate:t,onDownload:x,onDelete:o=>b.mutate([o])},r.key))}),u&&s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(T,{size:24,className:"animate-spin text-muted-foreground"})})]})})}export{Ce as default};
1
+ import{r as v,c as M,bj as D,j as s,aa as q,an as w,ac as H}from"./index-Dho9MRVw.js";import{K as L,u as Z,g as R,s as Q,a as W,f as U}from"./file-browser-DWYmbjoP.js";import{c as I,B as E}from"./button-D_0RTXDt.js";import{i as S}from"./AlertCircle-DcHEglIM.js";import{n as A}from"./Download01-npnn9kWB.js";import{i as $}from"./File02-Cuc-ZPtg.js";import{i as J}from"./File06-BUwGdOjl.js";import{a as P}from"./Image01-BCcbzsoK.js";import{i as T}from"./Loading01-Bo9vDQAp.js";import{s as V}from"./Trash01-BUkAP1vf.js";import{i as Y}from"./Upload01-DPPzM8Sw.js";import{u as _}from"./useMutation-Lj_Cbq0P.js";import{u as X}from"./useQuery-C2zqJzGD.js";import"./useInfiniteQuery-CVAyTLiO.js";import"./infiniteQueryObserver-DDmbfPGP.js";import"./checkbox-CUtYbeQD.js";import"./Check-BzMGOxMB.js";import"./Grid01-DmaR0g3f.js";import"./Home02-Cagj2miO.js";import"./List-DZ53jWcW.js";const B=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C14.76 8 15.04 8 15.6 8h4.13M20 9.988V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));B.displayName="File04";const G=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437c.214.11.494.11 1.054.11h4.13M8 15v3m8-5v5m-4-7.5V18m8-8.012V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));G.displayName="File07";const K=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437c.214.11.494.11 1.054.11h4.13M14 17.5l2.5-2.5-2.5-2.5m-4 0L7.5 15l2.5 2.5m10-7.512V17.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C4 19.72 4 18.88 4 17.2V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C6.28 2 7.12 2 8.8 2h3.212c.733 0 1.1 0 1.446.083.306.073.598.195.867.36.303.185.562.444 1.08.963l3.19 3.188c.518.519.777.778.963 1.081a3 3 0 0 1 .36.867c.082.346.082.712.082 1.446Z"}));K.displayName="FileCode01";const O=({size:i=24,color:e="currentColor",...t})=>v.createElement("svg",{viewBox:"0 0 24 24",width:i,height:i,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t},v.createElement("path",{d:"M22 8.931c0-.605 0-.908-.12-1.049a.5.5 0 0 0-.42-.173c-.183.014-.397.228-.826.657L17 12l3.634 3.634c.429.429.643.643.827.657a.5.5 0 0 0 .42-.173c.119-.14.119-.444.119-1.05V8.932ZM2 9.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 5 5.12 5 6.8 5h5.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C17 7.28 17 8.12 17 9.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C14.72 19 13.88 19 12.2 19H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 16.72 2 15.88 2 14.2V9.8Z"}));O.displayName="VideoRecorder";function ee(i){const e=M.c(5),[t,g]=v.useState(!1),c=v.useRef(null),d=v.useRef(!1);let n;e[0]!==i?(n=u=>{c.current&&(c.current.disconnect(),c.current=null),u&&!d.current&&(c.current=new IntersectionObserver(y=>{const[a]=y;a?.isIntersecting&&!d.current&&(d.current=!0,g(!0),c.current?.disconnect(),c.current=null)},i),c.current.observe(u))},e[0]=i,e[1]=n):n=e[1];const l=n;let h;return e[2]!==t||e[3]!==l?(h=[t,l],e[2]=t,e[3]=l,e[4]=h):h=e[4],h}function te(i){const e=M.c(24),{objectKey:t,alt:g,className:c}=i,d=c===void 0?"":c,{connectionId:n,toolCaller:l}=D();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={rootMargin:"100px",threshold:0},e[0]=h):h=e[0];const[u,y]=ee(h);let a;e[1]!==n||e[2]!==t?(a=L.imagePreview(n,t),e[1]=n,e[2]=t,e[3]=a):a=e[3];let f;e[4]!==t||e[5]!==l?(f=async()=>{const{url:m}=await l("GET_PRESIGNED_URL",{key:t});return m},e[4]=t,e[5]=l,e[6]=f):f=e[6];let k;e[7]!==u||e[8]!==a||e[9]!==f?(k={queryKey:a,queryFn:f,enabled:u,staleTime:3e5,gcTime:6e5},e[7]=u,e[8]=a,e[9]=f,e[10]=k):k=e[10];const{data:b,isLoading:x,error:j}=X(k);let p;e[11]!==d?(p=I("relative w-full h-full flex items-center justify-center overflow-hidden",d),e[11]=d,e[12]=p):p=e[12];let r;e[13]!==g||e[14]!==j||e[15]!==b||e[16]!==x||e[17]!==u||e[18]!==t?(r=!u||x?s.jsx("div",{className:"flex flex-col items-center justify-center text-muted-foreground",children:x?s.jsx(T,{size:24,className:"animate-spin"}):s.jsx(P,{size:48})}):j?s.jsx("div",{className:"flex flex-col items-center justify-center text-muted-foreground",children:s.jsx(S,{size:24})}):b?s.jsx("img",{src:b,alt:g||t,className:"w-full h-full object-cover",loading:"lazy"}):null,e[13]=g,e[14]=j,e[15]=b,e[16]=x,e[17]=u,e[18]=t,e[19]=r):r=e[19];let o;return e[20]!==y||e[21]!==p||e[22]!==r?(o=s.jsx("div",{ref:y,className:p,children:r}),e[20]=y,e[21]=p,e[22]=r,e[23]=o):o=e[23],o}const z=12,se={Image01:P,VideoRecorder:O,Music01:$,File02:$,File04:B,File06:J,File07:G,FileCode01:K,Folder:H};function re(i){const e=i.split(".").pop()?.toLowerCase();return["jpg","jpeg","png","gif","webp","svg","bmp","ico"].includes(e||"")}function oe(i){const e=M.c(41),{item:t,onNavigate:g,onDownload:c,onDelete:d}=i;let n;e[0]!==t.key?(n=R(t.key),e[0]=t.key,e[1]=n):n=e[1];const l=n,h=t.isFolder?"Folder":W(t.key),u=se[h]||$;let y;e[2]!==t.isFolder||e[3]!==t.key?(y=!t.isFolder&&re(t.key),e[2]=t.isFolder,e[3]=t.key,e[4]=y):y=e[4];const a=y;let f;e[5]!==t.isFolder||e[6]!==t.key||e[7]!==g?(f=()=>t.isFolder?g(t.key):void 0,e[5]=t.isFolder,e[6]=t.key,e[7]=g,e[8]=f):f=e[8];const k=!a&&"p-4",b=t.isFolder?"cursor-pointer":"cursor-default";let x;e[9]!==k||e[10]!==b?(x=I("flex flex-col items-center justify-center w-full h-full",k,b),e[9]=k,e[10]=b,e[11]=x):x=e[11];let j;e[12]!==u||e[13]!==a||e[14]!==t.isFolder||e[15]!==t.key||e[16]!==l?(j=a?s.jsx("div",{className:"absolute inset-0",children:s.jsx(te,{objectKey:t.key,alt:l})}):s.jsx(u,{size:48,className:I(t.isFolder?"text-amber-500":"text-muted-foreground")}),e[12]=u,e[13]=a,e[14]=t.isFolder,e[15]=t.key,e[16]=l,e[17]=j):j=e[17];let p;e[18]!==a||e[19]!==t.isFolder||e[20]!==t.size||e[21]!==l?(p=a?s.jsxs("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2 pt-6",children:[s.jsx("span",{className:"text-sm text-white text-center line-clamp-1 block",children:l}),s.jsx("span",{className:"text-xs text-white/70 text-center block",children:U(t.size)})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"mt-3 text-sm text-center line-clamp-2 px-2",children:l}),!t.isFolder&&s.jsx("span",{className:"mt-1 text-xs text-muted-foreground",children:U(t.size)})]}),e[18]=a,e[19]=t.isFolder,e[20]=t.size,e[21]=l,e[22]=p):p=e[22];let r;e[23]!==f||e[24]!==x||e[25]!==j||e[26]!==p?(r=s.jsxs("button",{type:"button",onClick:f,className:x,children:[j,p]}),e[23]=f,e[24]=x,e[25]=j,e[26]=p,e[27]=r):r=e[27];let o;e[28]!==t.isFolder||e[29]!==t.key||e[30]!==d||e[31]!==c?(o=!t.isFolder&&s.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0",onClick:F=>{F.stopPropagation(),c(t.key)},children:s.jsx(A,{size:14})}),s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0 text-destructive hover:text-destructive",onClick:F=>{F.stopPropagation(),d(t.key)},children:s.jsx(V,{size:14})})]}),e[28]=t.isFolder,e[29]=t.key,e[30]=d,e[31]=c,e[32]=o):o=e[32];let m;e[33]!==t.isFolder||e[34]!==t.key||e[35]!==d?(m=t.isFolder&&s.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:s.jsx(E,{variant:"secondary",size:"sm",className:"size-7 p-0 text-destructive hover:text-destructive",onClick:F=>{F.stopPropagation(),d(t.key)},children:s.jsx(V,{size:14})})}),e[33]=t.isFolder,e[34]=t.key,e[35]=d,e[36]=m):m=e[36];let N;return e[37]!==o||e[38]!==m||e[39]!==r?(N=s.jsxs("div",{className:"group relative aspect-square bg-muted/30 rounded-lg border border-border hover:border-primary/50 hover:bg-muted/50 transition-colors overflow-hidden",children:[r,o,m]}),e[37]=o,e[38]=m,e[39]=r,e[40]=N):N=e[40],N}function Ce({prefix:i,flat:e,onNavigate:t}){const g=v.useRef(null),c=q(),{connectionId:d,toolCaller:n}=D(),{objects:l,isLoading:h,isFetchingMore:u,hasMore:y,loadMore:a,error:f}=Z({prefix:i,flat:e,pageSize:z}),k=_({mutationFn:async r=>{const o=i+r.name,{url:m}=await n("PUT_PRESIGNED_URL",{key:o,contentType:r.type||"application/octet-stream"}),N=await fetch(m,{method:"PUT",body:r,headers:{"Content-Type":r.type||"application/octet-stream"}});if(!N.ok)throw new Error(`Upload failed: ${N.statusText}`);return o},onSuccess:r=>{w.success(`Uploaded ${R(r)}`),c.invalidateQueries({queryKey:L.objects(d,i,e,z)})},onError:r=>{w.error(`Upload failed: ${r.message}`)}}),b=_({mutationFn:async r=>r.length===1&&r[0]?n("DELETE_OBJECT",{key:r[0]}):n("DELETE_OBJECTS",{keys:r}),onSuccess:()=>{w.success("Deleted successfully"),c.invalidateQueries({queryKey:L.objects(d,i,e,z)})},onError:r=>{w.error(`Delete failed: ${r.message}`)}}),x=async r=>{try{const{url:o}=await n("GET_PRESIGNED_URL",{key:r}),m=await fetch(o);if(!m.ok)throw new Error(`Failed to fetch file: ${m.statusText}`);const N=await m.blob(),F=URL.createObjectURL(N),C=document.createElement("a");C.href=F,C.download=R(r),document.body.appendChild(C),C.click(),document.body.removeChild(C),URL.revokeObjectURL(F)}catch(o){w.error(`Download failed: ${o instanceof Error?o.message:"Unknown error"}`)}},j=r=>{const o=r.target.files;if(o){for(const m of Array.from(o))k.mutate(m);r.target.value=""}},p=r=>{if(!y||u)return;const o=r.currentTarget;o.scrollHeight-o.scrollTop-o.clientHeight<200&&a()};return f?s.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[s.jsx(S,{size:48,className:"text-destructive mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"Error loading files"}),s.jsx("p",{className:"text-muted-foreground text-center",children:f.message})]}):s.jsx("div",{className:"flex-1 overflow-y-auto p-4",onScroll:p,children:h?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[s.jsx(T,{size:32,className:"animate-spin text-muted-foreground mb-4"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading files..."})]}):l.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(Q,{size:48,className:"text-muted-foreground mb-4"}),s.jsx("h3",{className:"text-lg font-medium mb-2",children:"This folder is empty"}),s.jsx("p",{className:"text-muted-foreground mb-4",children:"Upload files to get started"}),s.jsx("input",{ref:g,type:"file",multiple:!0,className:"hidden",onChange:j}),s.jsxs(E,{variant:"outline",onClick:()=>g.current?.click(),children:[s.jsx(Y,{size:14,className:"mr-1"}),"Upload files"]})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4",children:l.map(r=>s.jsx(oe,{item:r,onNavigate:t,onDownload:x,onDelete:o=>b.mutate([o])},r.key))}),u&&s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(T,{size:24,className:"animate-spin text-muted-foreground"})})]})})}export{Ce as default};