@decocms/mesh 2.130.1 → 2.131.1
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.
- package/dist/client/assets/{AlertCircle-Y6iSJK0t.js → AlertCircle-0hiOc8CZ.js} +1 -1
- package/dist/client/assets/{AlertOctagon-r7aH80QB.js → AlertOctagon-GN8B-INI.js} +1 -1
- package/dist/client/assets/AlignLeft-BgC5LMd0.js +1 -0
- package/dist/client/assets/{ArrowDown-DPy5cnDQ.js → ArrowDown-PNhqRNxD.js} +1 -1
- package/dist/client/assets/{ArrowLeft-p4dfchJF.js → ArrowLeft-wS11NpwF.js} +1 -1
- package/dist/client/assets/{ArrowUp-Dx6U6WtF.js → ArrowUp-CH0M2x4i.js} +1 -1
- package/dist/client/assets/{Check-BIaai9j0.js → Check-xLOyX88L.js} +1 -1
- package/dist/client/assets/{CheckCircle-DvhMgeYT.js → CheckCircle-D15lJ7XR.js} +1 -1
- package/dist/client/assets/{CheckDone01-kUo2KMa3.js → CheckDone01-C40blUb5.js} +1 -1
- package/dist/client/assets/{CheckVerified02-DfOayhlO.js → CheckVerified02-Dicrho5O.js} +1 -1
- package/dist/client/assets/{ChevronDown-Dyskz-ZD.js → ChevronDown-p63TAVBS.js} +1 -1
- package/dist/client/assets/{ChevronRight-D6p6jiry.js → ChevronRight-D_Ht_JRW.js} +1 -1
- package/dist/client/assets/{Clock-Dymou738.js → Clock-DrIhUE6G.js} +1 -1
- package/dist/client/assets/{Code01-BYnTXqsh.js → Code01-CvvU9TcF.js} +1 -1
- package/dist/client/assets/{Container-DBGOFJUc.js → Container-ufACj1Zy.js} +1 -1
- package/dist/client/assets/{Copy01-CPaHCgqg.js → Copy01-HMjceblh.js} +1 -1
- package/dist/client/assets/{Dataflow03-D8kdCLb1.js → Dataflow03-y0rpKbi9.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-Ra63dU8X.js → DotsHorizontal-2R4cCOu7.js} +1 -1
- package/dist/client/assets/{DotsVertical-DcLEsGDj.js → DotsVertical-Bda0yV1s.js} +1 -1
- package/dist/client/assets/{Download01-BP0Ze81Q.js → Download01-DfNl1ci5.js} +1 -1
- package/dist/client/assets/{Edit01-BEBZ-Ht5.js → Edit01-BF7NKi37.js} +1 -1
- package/dist/client/assets/{Eye-VtlrDhJf.js → Eye-jbWvzlxk.js} +1 -1
- package/dist/client/assets/{File02-Dcc2k6VI.js → File02-CbYedhXN.js} +1 -1
- package/dist/client/assets/{File06-DCHaBaad.js → File06-BM5aCl-O.js} +1 -1
- package/dist/client/assets/{FilterLines-D64nKG0E.js → FilterLines-CJpyRJ7t.js} +1 -1
- package/dist/client/assets/{Globe01-Rd2g694_.js → Globe01-BfTcTY8o.js} +1 -1
- package/dist/client/assets/{Globe02-nOidPs01.js → Globe02-CGDduE0L.js} +1 -1
- package/dist/client/assets/{Grid01-C8gF-dWK.js → Grid01-Z7sWikL1.js} +1 -1
- package/dist/client/assets/{Hash02-fd4i0k8G.js → Hash02-K4dRD2dR.js} +1 -1
- package/dist/client/assets/{Home02-ABQZ6xOx.js → Home02-hJdk8eNH.js} +1 -1
- package/dist/client/assets/{Image01-BrzUQQ9K.js → Image01-CuKvPASB.js} +1 -1
- package/dist/client/assets/{Inbox01-DK0JkUYE.js → Inbox01-CglLjipa.js} +1 -1
- package/dist/client/assets/{InfoCircle-DO1owwAA.js → InfoCircle-Bb6fqYc8.js} +1 -1
- package/dist/client/assets/{Key01-bHmq-6W2.js → Key01-LKATn8lY.js} +1 -1
- package/dist/client/assets/{LinkExternal01-DyOgk9O3.js → LinkExternal01-D_U0OEXZ.js} +1 -1
- package/dist/client/assets/{List-mX8yEKmx.js → List-QV8E4GNR.js} +1 -1
- package/dist/client/assets/{Loading01-Jv8Mbea8.js → Loading01-CWvnRL6a.js} +1 -1
- package/dist/client/assets/{Lock01-DPx3YF5B.js → Lock01-Bwx9HnGh.js} +1 -1
- package/dist/client/assets/{Play-DciA3rqD.js → Play-Icpx1cq_.js} +1 -1
- package/dist/client/assets/{Plus-Cecv4wEo.js → Plus-C-k6EyqD.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-Busgf2jQ.js → RefreshCcw01-DCPzxJqp.js} +1 -1
- package/dist/client/assets/{Rows03-CBXDKtLW.js → Rows03-BxHdq4li.js} +1 -1
- package/dist/client/assets/{Save01-P2clZJAi.js → Save01-SegoBYVF.js} +1 -1
- package/dist/client/assets/{SearchMd-CS2uMIPl.js → SearchMd-TuCoj3FU.js} +1 -1
- package/dist/client/assets/{Settings01-BAgxhvm4.js → Settings01-DovilCf0.js} +1 -1
- package/dist/client/assets/{Shield01-Dw8oloiN.js → Shield01-EZO761pG.js} +1 -1
- package/dist/client/assets/{Terminal-d72o721Q.js → Terminal-D1kaOGFC.js} +1 -1
- package/dist/client/assets/{Trash01-CKATI1mI.js → Trash01-CPjIZLEP.js} +1 -1
- package/dist/client/assets/{Upload01-jmiBld-4.js → Upload01-DAh3LDGl.js} +1 -1
- package/dist/client/assets/{Users03-CLx_Qxdb.js → Users03-C6jjP916.js} +1 -1
- package/dist/client/assets/{X-RC7YVNJU.js → X-tkzrbQVp.js} +1 -1
- package/dist/client/assets/{XCircle-BgJPZWR5.js → XCircle-Cs5fpSB3.js} +1 -1
- package/dist/client/assets/{XClose-D-4ELBrc.js → XClose-BvPNH9hN.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-Dac4pEFh.js → agent-connections-preview-Dpe_MFjy.js} +1 -1
- package/dist/client/assets/agent-detail-DZUg4-s5.js +2 -0
- package/dist/client/assets/{agents-vcyOPs3U.js → agents-BWNX2LSR.js} +1 -1
- package/dist/client/assets/{alert-dialog-CdqWA8wc.js → alert-dialog-COYgvBCq.js} +1 -1
- package/dist/client/assets/{auth-catchall-B-_Zqliv.js → auth-catchall-COXncBeo.js} +1 -1
- package/dist/client/assets/{avatar-tLGNC2ok.js → avatar-B9DZwrpo.js} +1 -1
- package/dist/client/assets/{badge-0EzsH3AB.js → badge-qrWA_kLG.js} +1 -1
- package/dist/client/assets/{binder-w9dF9fSa.js → binder-13i_lQ0c.js} +1 -1
- package/dist/client/assets/{breadcrumb-BcJj21EL.js → breadcrumb-Zdkq43pK.js} +1 -1
- package/dist/client/assets/{card-c-CJHmFC.js → card-DD-UCxfi.js} +1 -1
- package/dist/client/assets/{chart-PoFYShLf.js → chart-Dtw6L5md.js} +1 -1
- package/dist/client/assets/{checkbox-kw1ENx9l.js → checkbox-C_Pgnv4n.js} +1 -1
- package/dist/client/assets/{circle-alert-orNW2INv.js → circle-alert-DdDFLH9P.js} +1 -1
- package/dist/client/assets/{collection-detail-DcWT7KrG.js → collection-detail-Cg75ipNi.js} +3 -3
- package/dist/client/assets/{collection-search-DeB-znan.js → collection-search-CxUg-xAQ.js} +1 -1
- package/dist/client/assets/{collection-tab-DnFTZr-h.js → collection-tab-C62wXALQ.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BkrnGVuo.js → collection-table-wrapper-Bz8WElPd.js} +1 -1
- package/dist/client/assets/{collection-tabs-CI_dPETO.js → collection-tabs-BjWYcsD2.js} +1 -1
- package/dist/client/assets/{command-CtwsQYlg.js → command-wm5iG4Qy.js} +1 -1
- package/dist/client/assets/{connect-Cjj5OaBk.js → connect-nlKsY2am.js} +1 -1
- package/dist/client/assets/{connection-card-DmcuYZ2d.js → connection-card-CqQpoqHp.js} +1 -1
- package/dist/client/assets/connection-detail-0Jk736m3.js +1 -0
- package/dist/client/assets/{connections-CQQbEDkG.js → connections-Cg2j2p3f.js} +1 -1
- package/dist/client/assets/constants-CbHMb0-K.js +1 -0
- package/dist/client/assets/{constants-DyBxaLKI.js → constants-CilfzTas.js} +1 -1
- package/dist/client/assets/context-CkGm0UTl.js +23 -0
- package/dist/client/assets/{create-organization-dialog-BolmWoUA.js → create-organization-dialog-DCEdnDTn.js} +1 -1
- package/dist/client/assets/{create-project-dialog-MbK1spLU.js → create-project-dialog-BWnYbbO8.js} +1 -1
- package/dist/client/assets/{dialog-L8ZakXii.js → dialog-iHT0i0tz.js} +1 -1
- package/dist/client/assets/{dropdown-menu-VTiqKHN9.js → dropdown-menu-BpyVIc2a.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-CMgyIw65.js → dynamic-plugin-layout-BG3KkqG4.js} +1 -1
- package/dist/client/assets/{editable-thread-title-CPogfRoD.js → editable-thread-title-BxqvtSds.js} +1 -1
- package/dist/client/assets/{empty-state-CevFdaoX.js → empty-state-ozmf3847.js} +1 -1
- package/dist/client/assets/{env-vars-editor-CZ9xwqbP.js → env-vars-editor-Nr3mWxuy.js} +1 -1
- package/dist/client/assets/{extract-connection-data-bPHhUn8L.js → extract-connection-data-DFqYDb10.js} +1 -1
- package/dist/client/assets/{file-browser-BBOKW0fZ.js → file-browser-D_9g9ebY.js} +2 -2
- package/dist/client/assets/{form-p8UY3zWX.js → form-BP7dMbdn.js} +1 -1
- package/dist/client/assets/{grid-view-CBiwYQ_M.js → grid-view-CPznGSAH.js} +1 -1
- package/dist/client/assets/{home-gtPjmaoD.js → home-DGwiBCGX.js} +1 -1
- package/dist/client/assets/{index-G8oxxr2G.js → index-0ocXQ777.js} +1 -1
- package/dist/client/assets/{index-BymQJSqf.js → index-BHlJRTz3.js} +1 -1
- package/dist/client/assets/{index-CmPWq7Ch.js → index-CCY7DImO.js} +1 -1
- package/dist/client/assets/{index-BPWcS_Kf.js → index-CDOpTYgU.js} +41 -41
- package/dist/client/assets/{index-CWyCvGNo.js → index-CEU_Ae_m.js} +1 -1
- package/dist/client/assets/{index-BRPNbM-s.js → index-CG50wTGS.js} +1 -1
- package/dist/client/assets/{index-CqCzS9v2.js → index-CGrDr99B.js} +1 -1
- package/dist/client/assets/index-DGca9RW1.css +1 -0
- package/dist/client/assets/{index-Cz17zD6m.js → index-DWQkOhqZ.js} +1 -1
- package/dist/client/assets/{index-0HoOnen3.js → index-plkk4e_J.js} +3 -3
- package/dist/client/assets/{infiniteQueryObserver-Be7iTEXe.js → infiniteQueryObserver-DaMN_U7y.js} +1 -1
- package/dist/client/assets/{input-BtUicd3Q.js → input-CmqvOeLB.js} +1 -1
- package/dist/client/assets/{integration-icon-5VjL1GgL.js → integration-icon-KIbgHijj.js} +1 -1
- package/dist/client/assets/{label-D6atofYo.js → label-bnFjyLyV.js} +1 -1
- package/dist/client/assets/{layout-Cgu_nW-7.js → layout-eozNid8i.js} +1 -1
- package/dist/client/assets/{localstorage-keys-BoChS3hJ.js → localstorage-keys-v0BD3Bnj.js} +1 -1
- package/dist/client/assets/{login-BJHT5HcO.js → login-CBgrYal6.js} +1 -1
- package/dist/client/assets/{markdown-C4hTkq3E.js → markdown-CPbw-_yp.js} +1 -1
- package/dist/client/assets/{mcp-oauth-D5R57Lko.js → mcp-oauth-B013QyX1.js} +1 -1
- package/dist/client/assets/{mcp-server-card-BiIhdNix.js → mcp-server-card-ncXA5Jvx.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-BhlbPBsp.js → mcp-server-detail-3iu4l0w5.js} +2 -2
- package/dist/client/assets/{members-OikP95XQ.js → members-CImSfQo3.js} +1 -1
- package/dist/client/assets/{monitoring-DapgIfZL.js → monitoring-ChNXdpYB.js} +1 -1
- package/dist/client/assets/monitoring-dashboard-edit-Cu-THApH.js +1 -0
- package/dist/client/assets/{monitoring-dashboard-view-DRykeaHO.js → monitoring-dashboard-view-BzUwVgh9.js} +1 -1
- package/dist/client/assets/{oauth-callback-DZIR2PjB.js → oauth-callback-DZs-RHtN.js} +1 -1
- package/dist/client/assets/page-B6FWTLb-.js +1 -0
- package/dist/client/assets/{page-PH6ZVWlA.js → page-D9R69UOA.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-kz2uan6n.js → plugin-empty-state-C2xpGFC3.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-y1tYhlY3.js → plugin-empty-state-CHtrUf1n.js} +1 -1
- package/dist/client/assets/{plugin-header-BJbVVCoY.js → plugin-header-CUHoCr6W.js} +1 -1
- package/dist/client/assets/{plugin-header-nmFTSFoR.js → plugin-header-CoAFaSME.js} +1 -1
- package/dist/client/assets/{popover-P8B4MdX3.js → popover-BIhQBNxG.js} +1 -1
- package/dist/client/assets/project-layout-GwHfcyse.js +1 -0
- package/dist/client/assets/{projects-list-3Z4u-J4l.js → projects-list-xLnE8dj1.js} +1 -1
- package/dist/client/assets/{ranking-layout-DDk0F0da.js → ranking-layout-g51-toAX.js} +1 -1
- package/dist/client/assets/{readme-viewer-BFDmw5ln.js → readme-viewer-ClGynTaO.js} +1 -1
- package/dist/client/assets/{registry-layout-tBKkcjtf.js → registry-layout-Dm3suQ96.js} +1 -1
- package/dist/client/assets/{registry-utils-BPK3KAEQ.js → registry-utils-CT2cHZWq.js} +1 -1
- package/dist/client/assets/{reports-layout-C1Rj5mWL.js → reports-layout-CJCUfohD.js} +1 -1
- package/dist/client/assets/{reset-password-CoNNt1yx.js → reset-password-Cv5Uxbmm.js} +1 -1
- package/dist/client/assets/{resizable-CpFkObl0.js → resizable-Cwh2gJdN.js} +1 -1
- package/dist/client/assets/{save-actions-CNp28sAN.js → save-actions-D1fibul5.js} +1 -1
- package/dist/client/assets/{scroll-area-Bhoi0n_B.js → scroll-area-CqN1XcNu.js} +4 -4
- package/dist/client/assets/{select-DOO2sOs0.js → select-DzSheW-c.js} +1 -1
- package/dist/client/assets/shell-layout-B0efKbYl.js +3 -0
- package/dist/client/assets/{skeleton-CR236scd.js → skeleton-Ddk21_zG.js} +1 -1
- package/dist/client/assets/{spinner-DzG2AImj.js → spinner-DThNWGT1.js} +1 -1
- package/dist/client/assets/{store-invite-CeIOMnWs.js → store-invite-DoNiJ_2C.js} +1 -1
- package/dist/client/assets/{switch-UjGh-56-.js → switch-BHoytSWv.js} +1 -1
- package/dist/client/assets/{table-CK5AQN01.js → table-C75ROyVe.js} +1 -1
- package/dist/client/assets/{tabs-ZEd61iZd.js → tabs-CgeHjw7d.js} +1 -1
- package/dist/client/assets/tasks-J3R0xo09.js +1 -0
- package/dist/client/assets/{textarea-Ca7XZUqN.js → textarea-D0tgU2KU.js} +1 -1
- package/dist/client/assets/{time-range-picker-GPYqbq-o.js → time-range-picker-upAU-oKs.js} +1 -1
- package/dist/client/assets/{toggle-group-BgEBi3gu.js → toggle-group-BkgC_GPy.js} +1 -1
- package/dist/client/assets/{tools-list-DJeaOzT_.js → tools-list-DcUxVw8u.js} +1 -1
- package/dist/client/assets/{tooltip-BWlQ9UL9.js → tooltip-Bnw97WFs.js} +1 -1
- package/dist/client/assets/{topbar-portal-CMlW5IwY.js → topbar-portal-C7BEToqh.js} +1 -1
- package/dist/client/assets/{types-BPCR06YW.js → types-C3qz9fLX.js} +1 -1
- package/dist/client/assets/{use-binding-CcrgjIcJ.js → use-binding-BnDQaQ8a.js} +1 -1
- package/dist/client/assets/{use-connection-B6TFiTxb.js → use-connection-CQasYzzj.js} +1 -1
- package/dist/client/assets/{use-copy-DfInz4oY.js → use-copy-Co7gHvim.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-pELq4UZ_.js → use-create-virtual-mcp-D-bJGh_Q.js} +1 -1
- package/dist/client/assets/{use-deco-chat-open-BmqwFIXp.js → use-deco-chat-open-DzCwN_oU.js} +1 -1
- package/dist/client/assets/{use-install-from-registry-BCXPqkOi.js → use-install-from-registry-GXYG5L7Y.js} +1 -1
- package/dist/client/assets/{use-list-state-Bpa4-xTU.js → use-list-state-BDwJVbli.js} +1 -1
- package/dist/client/assets/{use-llm-7gZpMpM0.js → use-llm-BwSqXALL.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-BIRErCHu.js → use-mcp-prompts-CN7UYKcE.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-BjSYCbSh.js → use-mcp-tools-CvszUz7q.js} +1 -1
- package/dist/client/assets/{use-members-BUeDkAPW.js → use-members-DBSMoNj3.js} +1 -1
- package/dist/client/assets/{use-mobile-B9jSIPRg.js → use-mobile-DLdIzb3b.js} +1 -1
- package/dist/client/assets/{use-project-B6kYJzwY.js → use-project-DoeOF1FB.js} +1 -1
- package/dist/client/assets/{use-settings-modal-Bi52YF5w.js → use-settings-modal-D_BbrW8Q.js} +1 -1
- package/dist/client/assets/{use-view-mode-CHcflreW.js → use-view-mode-v-cu8Xdx.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-C4mcpRPm.js → use-virtual-mcp-CcREhkTd.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CS1K3ARI.js +1 -0
- package/dist/client/assets/{useMutation-C13VGcqo.js → useMutation-D4nH_fUX.js} +1 -1
- package/dist/client/assets/useQuery-D64ihcYY.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-D2GBejOt.js +1 -0
- package/dist/client/assets/{workflow-N0cDVEpp.js → workflow-De0pszJC.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +168 -168
- package/dist/server/migrate.js +2 -2
- package/dist/server/server.js +2 -2
- package/package.json +1 -1
- package/dist/client/assets/Tool01-DkfecWlX.js +0 -1
- package/dist/client/assets/agent-detail-D5a7TiOz.js +0 -2
- package/dist/client/assets/connection-detail-DOePEdlc.js +0 -1
- package/dist/client/assets/constants-DK6m0rOQ.js +0 -1
- package/dist/client/assets/context-GOV4Tst1.js +0 -23
- package/dist/client/assets/deco-constants-BmtTfZbQ.js +0 -1
- package/dist/client/assets/index-BcDQ75Aq.css +0 -1
- package/dist/client/assets/monitoring-dashboard-edit-Yzekapph.js +0 -1
- package/dist/client/assets/page-iyMzbA2I.js +0 -1
- package/dist/client/assets/project-layout-BqSVP5TE.js +0 -1
- package/dist/client/assets/shell-layout-CSB6jzfL.js +0 -3
- package/dist/client/assets/tasks-C15WiR9-.js +0 -1
- package/dist/client/assets/useInfiniteQuery-78QQc26G.js +0 -1
- package/dist/client/assets/useQuery-CI6Jq2Tz.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BfZMgfKc.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as j,c as z,d as ut,j as s,v as ue,u as oe,O as pe,t as fe,a3 as zs,o as Rt,s as De,b as Ye,m as Fe,l as Ft,k as Wt,K as xe,B as te,aJ as Ze,c6 as $s,c4 as Bs,c8 as Ut,P as Vt,S as it,e as Ms,aI as Gs}from"./index-plkk4e_J.js";import{u as Rs,a as Kt}from"./use-project-DoeOF1FB.js";import{c as Fs,d as Ws,b as Us,a as qt,D as Yt}from"./dialog-iHT0i0tz.js";import{i as Ht}from"./X-tkzrbQVp.js";import{u as mt,S as ae}from"./skeleton-Ddk21_zG.js";import{p as Qt,a as jt,t as Vs,i as ft,u as Ks}from"./use-settings-modal-D_BbrW8Q.js";import{A as Jt}from"./avatar-B9DZwrpo.js";import{t as Xt}from"./Settings01-DovilCf0.js";import{a as qs,b as Ys,c as Hs,T as Qs}from"./tooltip-Bnw97WFs.js";import{i as Js}from"./Check-xLOyX88L.js";import{a as Xs}from"./Copy01-HMjceblh.js";import{S as Re}from"./switch-BHoytSWv.js";import{S as Zt,a as es,d as Me,c as ts,b as Zs}from"./select-DzSheW-c.js";import{i as en}from"./Code01-CvvU9TcF.js";import{i as tn}from"./Shield01-EZO761pG.js";import{n as sn}from"./CheckDone01-C40blUb5.js";import{u as He}from"./useMutation-D4nH_fUX.js";import{a as ss,F as Te,b as ye,c as be,d as je,f as Le,e as at}from"./form-BP7dMbdn.js";import{I as ve}from"./input-CmqvOeLB.js";import{i as nn}from"./Upload01-DAh3LDGl.js";import{a as Be,u as he,K as ln}from"./constants-CilfzTas.js";import{T as rn}from"./textarea-D0tgU2KU.js";import{c as an,h as on,d as cn,b as dn,A as un,e as mn,g as fn,a as xn,f as pn}from"./alert-dialog-COYgvBCq.js";import{u as hn}from"./useQuery-D64ihcYY.js";import{L as Se}from"./label-bnFjyLyV.js";import{n as gn}from"./Container-ufACj1Zy.js";import{h as ns}from"./use-connection-CQasYzzj.js";import{a as vn,c as ls,A as yn}from"./use-binding-BnDQaQ8a.js";import{u as bn}from"./use-install-from-registry-GXYG5L7Y.js";import{i as jn}from"./Loading01-CWvnRL6a.js";import{s as xt}from"./Plus-C-k6EyqD.js";import{u as Nn,a as Sn,b as Cn,i as ce,r as Qe,D as rs,c as Je,d as ge,s as Nt,e as St,Z as is,g as as,f as os,h as cs,j as Ge,k as pt,l as Xe,m as ht,n as wn,o as _n,p as ds,q as gt,t as vt,v as us,w as Pn,x as ms,y as Ct,z as kn,A as An,B as In,R as En,S as On,C as Dn,E as Tn,F as fs,G as Ln,H as zn,I as $n,J as Bn,K as Mn,L as Gn,M as Rn,N as Fn,O as Ue,P as Wn,Q as wt,T as _t,U as Pt,V as Un,W as xs,X as Vn,Y as Ee,_ as Kn,$ as qn,a0 as Yn,a1 as Hn,a2 as Qn,a3 as et,a4 as Jn,a5 as Ve,a6 as Xn,a7 as Zn,a8 as Z,a9 as ps,aa as el,ab as tl,ac as sl,ad as nl,ae as ll,af as rl,ag as il,ah as al,ai as ol,aj as cl,ak as dl,al as ul,am as ml,an as fl,ao as xl,ap as pl,aq as hl,ar as gl}from"./chart-Dtw6L5md.js";import{B as vl}from"./badge-qrWA_kLG.js";import{a as yl,T as tt,b as st,c as bl}from"./tabs-CgeHjw7d.js";import{i as jl}from"./AlertCircle-0hiOc8CZ.js";import{s as Nl}from"./RefreshCcw01-DCPzxJqp.js";import{b as de,a as hs}from"./use-mcp-tools-CvszUz7q.js";import{u as Sl}from"./use-members-DBSMoNj3.js";import"./localstorage-keys-v0BD3Bnj.js";import"./index-BHlJRTz3.js";import"./ChevronDown-p63TAVBS.js";import"./binder-13i_lQ0c.js";import"./extract-connection-data-DFqYDb10.js";import"./constants-CbHMb0-K.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-CT2cHZWq.js";import"./generate-id-Dyweu44Y.js";import"./index-CG50wTGS.js";const gs=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M10 2v4.66c0 .218 0 .326-.033.413a.47.47 0 0 1-.138.198c-.07.06-.183.102-.409.185a7.5 7.5 0 1 0 5.16 0c-.226-.083-.339-.125-.409-.185a.469.469 0 0 1-.138-.198C14 6.986 14 6.878 14 6.66V2M8.5 2h7"}));gs.displayName="Beaker01";const vs=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M9.354 21c.705.622 1.632 1 2.646 1s1.94-.378 2.646-1M18 8A6 6 0 1 0 6 8c0 3.09-.78 5.206-1.65 6.605-.735 1.18-1.102 1.771-1.089 1.936.015.182.054.252.2.36.133.099.732.099 1.928.099H18.61c1.196 0 1.795 0 1.927-.098.147-.11.186-.179.2-.361.014-.165-.353-.755-1.088-1.936C18.78 13.206 18 11.09 18 8Z"}));vs.displayName="Bell01";const yt=({size:t=24,color:e="currentColor",...n})=>j.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},j.createElement("path",{d:"M13 2 4.093 12.688c-.348.418-.523.628-.525.804a.5.5 0 0 0 .185.397c.138.111.41.111.955.111H12l-1 8 8.907-10.688c.348-.418.523-.628.525-.804a.5.5 0 0 0-.185-.397c-.138-.111-.41-.111-.955-.111H12l1-8Z"}));yt.displayName="Zap";const Cl=[{key:"general",label:"General",icon:s.jsx(Xt,{size:14})},{key:"plugins",label:"Plugins",icon:s.jsx(yt,{size:14})}];function wl(t){const e=z.c(14),{activeSection:n,onNavigate:l}=t,{org:i}=oe();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={suspense:!0},e[0]=r):r=e[0];const{data:a}=Rs(i.id,r);let o;e[1]!==n?(o=Qt(n),e[1]=n,e[2]=o):o=e[2];const d=o;let m;if(e[3]!==d?.slug||e[4]!==n||e[5]!==l||e[6]!==a){let f;e[8]!==d?.slug||e[9]!==n||e[10]!==l?(f=u=>{const x=d?.slug===u.slug;return s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("button",{type:"button",onClick:()=>l(jt(u.slug,"general")),className:ue("flex items-center gap-2.5 px-2 py-1.5 rounded-md text-sm text-left w-full transition-colors",x?"text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[s.jsx("div",{className:"size-4 shrink-0 rounded-[3px] flex items-center justify-center overflow-hidden border border-border/50",style:{backgroundColor:u.ui?.themeColor??"#60a5fa"},children:u.ui?.icon?s.jsx("img",{src:u.ui.icon,alt:"",className:"size-full object-cover"}):s.jsx("span",{className:"text-[8px] font-semibold text-white leading-none",children:(u.name??u.slug).charAt(0).toUpperCase()})}),s.jsx("span",{className:"truncate",children:u.name??u.slug})]}),x&&s.jsx("div",{className:"ml-3 flex flex-col gap-0.5 border-l border-border pl-2.5",children:Cl.map(p=>{const h=jt(u.slug,p.key);return s.jsxs("button",{type:"button",onClick:()=>l(h),className:ue("flex items-center gap-2.5 px-2 py-1.5 rounded-md text-sm text-left w-full transition-colors",n===h?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[s.jsx("span",{className:"shrink-0",children:p.icon}),s.jsx("span",{className:"truncate",children:p.label})]},p.key)})})]},u.slug)},e[8]=d?.slug,e[9]=n,e[10]=l,e[11]=f):f=e[11],m=(a??[]).filter(_l).map(f),e[3]=d?.slug,e[4]=n,e[5]=l,e[6]=a,e[7]=m}else m=e[7];let c;return e[12]!==m?(c=s.jsx(s.Fragment,{children:m}),e[12]=m,e[13]=c):c=e[13],c}function _l(t){return t.slug!==pe}function Pl(t){const e=z.c(31),{activeSection:n,onNavigate:l}=t,{data:i}=ut.useSession(),[r]=mt(),a=i?.user,o=a?.image,d=a?.name??"Profile",m=a?.name??"U";let c;e[0]!==m||e[1]!==o?(c=s.jsx(Jt,{url:o,fallback:m,shape:"circle",size:"2xs",className:"size-4 shrink-0"}),e[0]=m,e[1]=o,e[2]=c):c=e[2];let f;e[3]!==d||e[4]!==c?(f={key:"account.profile",label:d,icon:c},e[3]=d,e[4]=c,e[5]=f):f=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={key:"account.preferences",label:"Preferences",icon:s.jsx(Xt,{size:14})},e[6]=u):u=e[6];let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x={key:"account.experimental",label:"Experimental",icon:s.jsx(gs,{size:14})},e[7]=x):x=e[7];let p;e[8]!==f?(p=[f,u,x],e[8]=f,e[9]=p):p=e[9];const h=p;let g;e[10]===Symbol.for("react.memo_cache_sentinel")?(g={key:"org.general",label:"General",icon:s.jsx(Vs,{size:14})},e[10]=g):g=e[10];let N;e[11]===Symbol.for("react.memo_cache_sentinel")?(N={key:"org.plugins",label:"Plugins",icon:s.jsx(yt,{size:14})},e[11]=N):N=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=[g,N,{key:"org.billing",label:"Billing",icon:s.jsx(ft,{size:14})}],e[12]=w):w=e[12];const _=w;let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx("p",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground/60",children:"Account"}),e[13]=b):b=e[13];let v;e[14]!==h||e[15]!==n||e[16]!==l?(v=s.jsxs("div",{className:"flex flex-col gap-0.5 px-2",children:[b,h.map(A=>s.jsxs("button",{type:"button",onClick:()=>l(A.key),className:ue("flex items-center gap-2.5 px-2 py-1.5 rounded-md text-sm text-left w-full transition-colors",n===A.key?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[s.jsx("span",{className:"shrink-0",children:A.icon}),s.jsx("span",{className:"truncate",children:A.label})]},A.key))]}),e[14]=h,e[15]=n,e[16]=l,e[17]=v):v=e[17];let S;e[18]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("p",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground/60",children:"Organization"}),e[18]=S):S=e[18];let P;e[19]!==n||e[20]!==l?(P=s.jsxs("div",{className:"flex flex-col gap-0.5 px-2",children:[S,_.map(A=>s.jsxs("button",{type:"button",onClick:()=>l(A.key),className:ue("flex items-center gap-2.5 px-2 py-1.5 rounded-md text-sm text-left w-full transition-colors",n===A.key?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[s.jsx("span",{className:"shrink-0",children:A.icon}),s.jsx("span",{className:"truncate",children:A.label})]},A.key))]}),e[19]=n,e[20]=l,e[21]=P):P=e[21];let y;e[22]!==n||e[23]!==l||e[24]!==r.experimental_projects?(y=r.experimental_projects&&s.jsxs("div",{className:"flex flex-col gap-0.5 px-2",children:[s.jsx("p",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground/60",children:"Projects"}),s.jsx(j.Suspense,{fallback:s.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground/50",children:"Loading…"}),children:s.jsx(wl,{activeSection:n,onNavigate:l})})]}),e[22]=n,e[23]=l,e[24]=r.experimental_projects,e[25]=y):y=e[25];let C;e[26]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("div",{className:"mt-auto px-4 pb-1",children:s.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v","2.131.1"]})}),e[26]=C):C=e[26];let k;return e[27]!==v||e[28]!==P||e[29]!==y?(k=s.jsxs("div",{className:"w-52 shrink-0 border-r border-border bg-sidebar/50 overflow-y-auto py-3 flex flex-col gap-4",children:[v,P,y,C]}),e[27]=v,e[28]=P,e[29]=y,e[30]=k):k=e[30],k}function kl(){const t=z.c(32),{data:e}=ut.useSession(),[n,l]=j.useState(!1),i=e?.user,r=i?.image;let a;t[0]!==i?(a=()=>{i?.id&&navigator.clipboard.writeText(i.id).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)})},t[0]=i,t[1]=a):a=t[1];const o=a;let d;t[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{children:s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Profile"})}),t[2]=d):d=t[2];const m=i?.name??"U";let c;t[3]!==m||t[4]!==r?(c=s.jsx(Jt,{url:r,fallback:m,shape:"circle",size:"xl",className:"size-16 shrink-0"}),t[3]=m,t[4]=r,t[5]=c):c=t[5];const f=i?.name??"User";let u;t[6]!==f?(u=s.jsx("span",{className:"text-sm font-semibold text-foreground truncate",children:f}),t[6]=f,t[7]=u):u=t[7];const x=i?.email;let p;t[8]!==x?(p=s.jsx("span",{className:"text-sm text-muted-foreground truncate",children:x}),t[8]=x,t[9]=p):p=t[9];let h;t[10]!==u||t[11]!==p?(h=s.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[u,p]}),t[10]=u,t[11]=p,t[12]=h):h=t[12];let g;t[13]!==c||t[14]!==h?(g=s.jsxs("div",{className:"flex items-center gap-4",children:[c,h]}),t[13]=c,t[14]=h,t[15]=g):g=t[15];let N;t[16]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("p",{className:"py-4 text-base font-semibold text-foreground border-b border-border",children:"User ID"}),t[16]=N):N=t[16];let w;t[17]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx("p",{className:"text-sm text-muted-foreground",children:"User ID"}),t[17]=w):w=t[17];const _=i?.id;let b;t[18]!==_?(b=s.jsx("span",{className:"font-mono text-sm",children:_}),t[18]=_,t[19]=b):b=t[19];let v;t[20]!==n?(v=n?s.jsx(Js,{size:14,className:"text-green-600 shrink-0"}):s.jsx(Xs,{size:14,className:"shrink-0 opacity-70 group-hover:opacity-100 transition-opacity"}),t[20]=n,t[21]=v):v=t[21];let S;t[22]!==o||t[23]!==b||t[24]!==v?(S=s.jsx(qs,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:o,className:"group flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",children:[b,v]})}),t[22]=o,t[23]=b,t[24]=v,t[25]=S):S=t[25];let P;t[26]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(Ys,{side:"left",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),t[26]=P):P=t[26];let y;t[27]!==S?(y=s.jsxs("div",{className:"flex flex-col",children:[N,s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4",children:[w,s.jsx(Hs,{children:s.jsxs(Qs,{children:[S,P]})})]})]}),t[27]=S,t[28]=y):y=t[28];let C;return t[29]!==y||t[30]!==g?(C=s.jsxs("div",{className:"flex flex-col gap-8",children:[d,g,y]}),t[29]=y,t[30]=g,t[31]=C):C=t[31],C}function nt(t){const e=z.c(27),{icon:n,label:l,description:i,control:r,onClick:a,disabled:o}=t,d=o?void 0:a,m=a?"button":void 0,c=a&&!o?0:void 0;let f;e[0]!==o||e[1]!==a?(f=a&&!o?v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),a())}:void 0,e[0]=o,e[1]=a,e[2]=f):f=e[2];const u=a&&!o?"pointer":void 0;let x;e[3]!==u?(x={cursor:u},e[3]=u,e[4]=x):x=e[4];let p;e[5]!==n?(p=s.jsx("span",{className:"text-muted-foreground mt-0.5 shrink-0",children:n}),e[5]=n,e[6]=p):p=e[6];let h;e[7]!==l?(h=s.jsx("p",{className:"text-sm font-medium text-foreground",children:l}),e[7]=l,e[8]=h):h=e[8];let g;e[9]!==i?(g=s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:i}),e[9]=i,e[10]=g):g=e[10];let N;e[11]!==h||e[12]!==g?(N=s.jsxs("div",{className:"min-w-0",children:[h,g]}),e[11]=h,e[12]=g,e[13]=N):N=e[13];let w;e[14]!==N||e[15]!==p?(w=s.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[p,N]}),e[14]=N,e[15]=p,e[16]=w):w=e[16];let _;e[17]!==r?(_=s.jsx("div",{onClick:Al,className:"shrink-0",children:r}),e[17]=r,e[18]=_):_=e[18];let b;return e[19]!==d||e[20]!==w||e[21]!==_||e[22]!==m||e[23]!==c||e[24]!==f||e[25]!==x?(b=s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4 border-b border-border last:border-0",onClick:d,role:m,tabIndex:c,onKeyDown:f,style:x,children:[w,_]}),e[19]=d,e[20]=w,e[21]=_,e[22]=m,e[23]=c,e[24]=f,e[25]=x,e[26]=b):b=e[26],b}function Al(t){return t.stopPropagation()}function kt(){const t=z.c(35),[e,n]=mt();let l;t[0]!==n?(l=async P=>{if(P&&await Notification.requestPermission()!=="granted"){fe.error("Notifications denied. Please enable them in your browser settings."),n(El);return}n(y=>({...y,enableNotifications:P}))},t[0]=n,t[1]=l):l=t[1];const i=l;let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{children:s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Preferences"})}),t[2]=r):r=t[2];let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(en,{size:16}),t[3]=a):a=t[3];let o;t[4]!==n?(o=()=>n(Il),t[4]=n,t[5]=o):o=t[5];let d;t[6]!==n?(d=P=>n(y=>({...y,devMode:P})),t[6]=n,t[7]=d):d=t[7];let m;t[8]!==e.devMode||t[9]!==d?(m=s.jsx(Re,{checked:e.devMode,onCheckedChange:d}),t[8]=e.devMode,t[9]=d,t[10]=m):m=t[10];let c;t[11]!==o||t[12]!==m?(c=s.jsx(nt,{icon:a,label:"Developer Mode",description:"Show technical details like JSON input/output for tool calls.",onClick:o,control:m}),t[11]=o,t[12]=m,t[13]=c):c=t[13];let f;t[14]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(vs,{size:16}),t[14]=f):f=t[14];let u;t[15]!==i||t[16]!==e.enableNotifications?(u=s.jsx(nt,{icon:f,label:"Notifications",description:"Play a sound and show a notification when chat messages complete while the app is unfocused.",disabled:typeof Notification>"u",onClick:()=>i(!e.enableNotifications),control:s.jsx(Re,{disabled:typeof Notification>"u",checked:e.enableNotifications,onCheckedChange:i})}),t[15]=i,t[16]=e.enableNotifications,t[17]=u):u=t[17];let x;t[18]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(tn,{size:16}),t[18]=x):x=t[18];let p;t[19]!==n?(p=P=>n(y=>({...y,toolApprovalLevel:P})),t[19]=n,t[20]=p):p=t[20];let h;t[21]===Symbol.for("react.memo_cache_sentinel")?(h={none:"Always ask",readonly:"Skip read-only",yolo:"Auto-approve all"},t[21]=h):h=t[21];const g=h[e.toolApprovalLevel];let N;t[22]!==g?(N=s.jsx(es,{className:"w-36",children:s.jsx("span",{children:g})}),t[22]=g,t[23]=N):N=t[23];let w;t[24]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(Me,{value:"none",textValue:"Always ask",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:"Always ask"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Require approval for all tool calls"})]})}),t[24]=w):w=t[24];let _;t[25]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(Me,{value:"readonly",textValue:"Skip read-only",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:"Skip read-only"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Auto-approve read-only tools"})]})}),t[25]=_):_=t[25];let b;t[26]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsxs(ts,{children:[w,_,s.jsx(Me,{value:"yolo",textValue:"Auto-approve all",children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("span",{className:"font-medium",children:"Auto-approve all"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Execute all tools without approval"})]})})]}),t[26]=b):b=t[26];let v;t[27]!==e.toolApprovalLevel||t[28]!==p||t[29]!==N?(v=s.jsx(nt,{icon:x,label:"Tool Approval",description:"Choose when to require approval before tools execute.",control:s.jsxs(Zt,{value:e.toolApprovalLevel,onValueChange:p,children:[N,b]})}),t[27]=e.toolApprovalLevel,t[28]=p,t[29]=N,t[30]=v):v=t[30];let S;return t[31]!==v||t[32]!==c||t[33]!==u?(S=s.jsxs("div",{className:"flex flex-col gap-6",children:[r,s.jsxs("div",{className:"flex flex-col",children:[c,u,v]})]}),t[31]=v,t[32]=c,t[33]=u,t[34]=S):S=t[34],S}function Il(t){return{...t,devMode:!t.devMode}}function El(t){return{...t,enableNotifications:!1}}function At(t){const e=z.c(22),{icon:n,label:l,description:i,checked:r,onCheckedChange:a}=t;let o;e[0]!==r||e[1]!==a?(o=()=>a(!r),e[0]=r,e[1]=a,e[2]=o):o=e[2];let d;e[3]!==n?(d=s.jsx("span",{className:"text-muted-foreground mt-0.5 shrink-0",children:n}),e[3]=n,e[4]=d):d=e[4];let m;e[5]!==l?(m=s.jsx("p",{className:"text-sm font-medium text-foreground",children:l}),e[5]=l,e[6]=m):m=e[6];let c;e[7]!==i?(c=s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:i}),e[7]=i,e[8]=c):c=e[8];let f;e[9]!==m||e[10]!==c?(f=s.jsxs("div",{className:"min-w-0",children:[m,c]}),e[9]=m,e[10]=c,e[11]=f):f=e[11];let u;e[12]!==d||e[13]!==f?(u=s.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[d,f]}),e[12]=d,e[13]=f,e[14]=u):u=e[14];let x;e[15]!==r||e[16]!==a?(x=s.jsx("div",{onClick:Ol,className:"shrink-0",children:s.jsx(Re,{checked:r,onCheckedChange:a})}),e[15]=r,e[16]=a,e[17]=x):x=e[17];let p;return e[18]!==o||e[19]!==u||e[20]!==x?(p=s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4 border-b border-border last:border-0 cursor-pointer",onClick:o,children:[u,x]}),e[18]=o,e[19]=u,e[20]=x,e[21]=p):p=e[21],p}function Ol(t){return t.stopPropagation()}function Dl(){const t=z.c(16),[e,n]=mt();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{children:[s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Experimental"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"These features are unstable and may change or stop working at any time."})]}),t[0]=l):l=t[0];let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(zs,{size:16}),t[1]=i):i=t[1];let r;t[2]!==n?(r=f=>n(u=>({...u,experimental_projects:f})),t[2]=n,t[3]=r):r=t[3];let a;t[4]!==e.experimental_projects||t[5]!==r?(a=s.jsx(At,{icon:i,label:"Projects",description:"Enable the projects feature in the sidebar.",checked:e.experimental_projects,onCheckedChange:r}),t[4]=e.experimental_projects,t[5]=r,t[6]=a):a=t[6];let o;t[7]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(sn,{size:16}),t[7]=o):o=t[7];let d;t[8]!==n?(d=f=>n(u=>({...u,experimental_tasks:f})),t[8]=n,t[9]=d):d=t[9];let m;t[10]!==e.experimental_tasks||t[11]!==d?(m=s.jsx(At,{icon:o,label:"Tasks",description:"Enable the tasks feature in the sidebar.",checked:e.experimental_tasks,onCheckedChange:d}),t[10]=e.experimental_tasks,t[11]=d,t[12]=m):m=t[12];let c;return t[13]!==a||t[14]!==m?(c=s.jsxs("div",{className:"flex flex-col gap-6",children:[l,s.jsxs("div",{className:"flex flex-col rounded-lg border border-border bg-muted/25 px-4",children:[a,m]})]}),t[13]=a,t[14]=m,t[15]=c):c=t[15],c}const Tl=Rt({name:De().min(1,"Name is required").max(255,"Name is too long"),slug:De().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:De().optional()});function Ll(t){const e=z.c(24),{value:n,onChange:l,name:i}=t,r=j.useRef(null);let a;e[0]!==l?(a=b=>{const v=b.target.files?.[0];if(v){if(v.size>2097152){fe.error("Image must be smaller than 2MB");return}const S=new FileReader;S.onerror=()=>{const P=S.error;console.error("FileReader error:",P),fe.error(P?.message||"Failed to read image file. Please try again."),r.current&&(r.current.value="")},S.onloadend=()=>{if(S.readyState===FileReader.DONE&&S.result){const P=S.result;l(P)}},S.readAsDataURL(v)}},e[0]=l,e[1]=a):a=e[1];const o=a;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{r.current?.click()},e[2]=d):d=e[2];const m=d;let c;e[3]!==l?(c=b=>{b.stopPropagation(),l("")},e[3]=l,e[4]=c):c=e[4];const f=c;let u;e[5]!==o?(u=s.jsx("input",{type:"file",ref:r,className:"hidden",accept:"image/*",onChange:o}),e[5]=o,e[6]=u):u=e[6];let x;e[7]!==f||e[8]!==i||e[9]!==n?(x=n?s.jsxs("div",{className:"relative group",children:[s.jsx("div",{className:"h-20 w-20 rounded-lg border border-border bg-muted/20 overflow-hidden",children:s.jsx("img",{src:n,alt:i||"Organization logo",className:"w-full h-full object-cover"})}),s.jsx("button",{type:"button",onClick:f,className:"absolute -top-2 -right-2 h-6 w-6 rounded-full bg-destructive text-destructive-foreground opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:s.jsx(Ht,{className:"h-3 w-3"})})]}):s.jsxs("button",{type:"button",onClick:m,className:"h-20 w-20 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-1 text-muted-foreground hover:text-foreground",children:[s.jsx(nn,{className:"h-5 w-5"}),s.jsx("span",{className:"text-xs",children:"Upload"})]}),e[7]=f,e[8]=i,e[9]=n,e[10]=x):x=e[10];const p=n?"Change Logo":"Upload Logo";let h;e[11]!==p?(h=s.jsx(te,{type:"button",variant:"outline",size:"sm",onClick:m,className:"mb-2",children:p}),e[11]=p,e[12]=h):h=e[12];let g;e[13]!==f||e[14]!==n?(g=n&&s.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:f,className:"ml-2",children:"Remove"}),e[13]=f,e[14]=n,e[15]=g):g=e[15];let N;e[16]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Recommended: Square image, at least 200x200px. Max 2MB."}),e[16]=N):N=e[16];let w;e[17]!==h||e[18]!==g?(w=s.jsxs("div",{className:"flex-1",children:[h,g,N]}),e[17]=h,e[18]=g,e[19]=w):w=e[19];let _;return e[20]!==w||e[21]!==u||e[22]!==x?(_=s.jsxs("div",{className:"flex items-start gap-4",children:[u,x,w]}),e[20]=w,e[21]=u,e[22]=x,e[23]=_):_=e[23],_}function zl(){const t=Ye(),{org:e,project:n}=oe(),l=Fe(),[i,r]=j.useState(!1),a=Ft({resolver:Wt(Tl),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),o=He({mutationFn:async c=>{const f={name:c.name,slug:c.slug};c.logo&&(f.logo=c.logo);const u=await ut.organization.update({organizationId:e.id,data:f});if(u?.error)throw new Error(u.error.message||"Failed to update organization");return u},onSuccess:c=>{l.invalidateQueries({queryKey:xe.organizations()}),l.invalidateQueries({queryKey:xe.activeOrganization(e.slug)}),fe.success("Organization settings updated successfully"),c?.data?.slug&&c.data.slug!==e.slug&&t({to:"/$org/$project/settings",params:{org:c.data.slug,project:n.slug}})},onError:c=>{fe.error(c instanceof Error?c.message:"Failed to update organization")},onSettled:()=>{r(!1)}}),d=c=>{r(!0),o.mutate(c)},m=a.formState.isDirty;return s.jsx(ss,{...a,children:s.jsxs("form",{onSubmit:a.handleSubmit(d),className:"space-y-6",children:[s.jsx(Te,{control:a.control,name:"name",render:({field:c})=>s.jsxs(ye,{children:[s.jsx(be,{children:"Organization Name"}),s.jsx(je,{children:s.jsx(ve,{placeholder:"My Organization",...c,disabled:i})}),s.jsx(Le,{})]})}),s.jsx(Te,{control:a.control,name:"slug",render:({field:c})=>s.jsxs(ye,{children:[s.jsx(be,{children:"Organization Slug"}),s.jsx(je,{children:s.jsx(ve,{placeholder:"my-organization",...c,disabled:i,onChange:f=>{const u=f.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");c.onChange(u)}})}),s.jsx(at,{children:"Used in URLs. Only lowercase letters, numbers, and hyphens are allowed."}),s.jsx(Le,{})]})}),s.jsx(Te,{control:a.control,name:"logo",render:({field:c})=>s.jsxs(ye,{children:[s.jsx(be,{children:"Logo"}),s.jsx(je,{children:s.jsx(Ll,{value:c.value,onChange:c.onChange,name:a.watch("name")})}),s.jsx(Le,{})]})}),s.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[s.jsx(te,{type:"submit",disabled:!m||i,className:"min-w-24",children:i?"Saving...":"Save Changes"}),m&&s.jsx(te,{type:"button",variant:"outline",onClick:()=>a.reset(),disabled:i,children:"Cancel"})]})]})})}function $l(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsx("div",{children:s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Organization"})}),s.jsx(zl,{})]}),t[0]=e):e=t[0],e}const Bl=Rt({name:De().min(1,"Name is required").max(200,"Name is too long"),description:De().max(1e3,"Description is too long").nullable(),themeColor:De().nullable()});function Ml(){const t=z.c(63),{org:e,project:n}=oe(),l=Fe(),i=n.slug===pe;let r;t[0]!==e.id?(r={connectionId:Be,orgId:e.id},t[0]=e.id,t[1]=r):r=t[1];const a=he(r);let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=Wt(Bl),t[2]=o):o=t[2];const d=n.name??"",m=n.description??"",c=n.ui?.themeColor??"#60a5fa";let f;t[3]!==d||t[4]!==m||t[5]!==c?(f={resolver:o,values:{name:d,description:m,themeColor:c}},t[3]=d,t[4]=m,t[5]=c,t[6]=f):f=t[6];const u=Ft(f);let x;t[7]!==a||t[8]!==n.id||t[9]!==n.ui?.banner||t[10]!==n.ui?.bannerColor||t[11]!==n.ui?.icon?(x=async T=>{const O=await a.callTool({name:"PROJECT_UPDATE",arguments:{projectId:n.id,name:T.name,description:T.description||null,ui:{themeColor:T.themeColor||null,banner:n.ui?.banner??null,bannerColor:n.ui?.bannerColor??null,icon:n.ui?.icon??null}}});return O.structuredContent??O},t[7]=a,t[8]=n.id,t[9]=n.ui?.banner,t[10]=n.ui?.bannerColor,t[11]=n.ui?.icon,t[12]=x):x=t[12];let p;t[13]!==u||t[14]!==e.id||t[15]!==n.slug||t[16]!==l?(p=()=>{l.invalidateQueries({queryKey:xe.project(e.id,n.slug)}),l.invalidateQueries({queryKey:xe.projects(e.id)}),u.reset(u.getValues())},t[13]=u,t[14]=e.id,t[15]=n.slug,t[16]=l,t[17]=p):p=t[17];let h;t[18]!==x||t[19]!==p?(h={mutationFn:x,onSuccess:p,onError:Gl},t[18]=x,t[19]=p,t[20]=h):h=t[20];const g=He(h);let N;t[21]!==g?(N=async T=>{await g.mutateAsync(T)},t[21]=g,t[22]=N):N=t[22];const w=N;let _;t[23]!==u||t[24]!==w?(_=T=>{T(),u.handleSubmit(w)()},t[23]=u,t[24]=w,t[25]=_):_=t[25];const b=_;let v;t[26]!==u||t[27]!==w?(v=u.handleSubmit(w),t[26]=u,t[27]=w,t[28]=v):v=t[28];let S;t[29]!==i||t[30]!==g.isPending||t[31]!==b?(S=T=>{const{field:O}=T;return s.jsxs(ye,{children:[s.jsx(be,{children:"Project Name"}),s.jsx(je,{children:s.jsx(ve,{placeholder:"My Project",...O,onBlur:()=>b(O.onBlur),disabled:i||g.isPending})}),i&&s.jsx(at,{children:"The organization admin project name cannot be changed."}),s.jsx(Le,{})]})},t[29]=i,t[30]=g.isPending,t[31]=b,t[32]=S):S=t[32];let P;t[33]!==u.control||t[34]!==S?(P=s.jsx(Te,{control:u.control,name:"name",render:S}),t[33]=u.control,t[34]=S,t[35]=P):P=t[35];let y;t[36]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(be,{children:"Slug"}),t[36]=y):y=t[36];let C;t[37]!==n.slug?(C=s.jsx(je,{children:s.jsx(ve,{value:n.slug,disabled:!0,className:"bg-muted"})}),t[37]=n.slug,t[38]=C):C=t[38];let k;t[39]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(at,{children:"The project slug cannot be changed after creation."}),t[39]=k):k=t[39];let A;t[40]!==C?(A=s.jsxs(ye,{children:[y,C,k]}),t[40]=C,t[41]=A):A=t[41];let I;t[42]!==g.isPending||t[43]!==b?(I=T=>{const{field:O}=T;return s.jsxs(ye,{children:[s.jsx(be,{children:"Description"}),s.jsx(je,{children:s.jsx(rn,{placeholder:"Optional project description...",rows:3,...O,value:O.value??"",onBlur:()=>b(O.onBlur),disabled:g.isPending})}),s.jsx(Le,{})]})},t[42]=g.isPending,t[43]=b,t[44]=I):I=t[44];let E;t[45]!==u.control||t[46]!==I?(E=s.jsx(Te,{control:u.control,name:"description",render:I}),t[45]=u.control,t[46]=I,t[47]=E):E=t[47];let D;t[48]!==g.isPending||t[49]!==b?(D=T=>{const{field:O}=T;return s.jsxs(ye,{children:[s.jsx(be,{children:"Color"}),s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"size-9 rounded-md border border-input overflow-hidden cursor-pointer shrink-0",style:{backgroundColor:O.value??"#60a5fa"},children:s.jsx("input",{type:"color",value:O.value??"#60a5fa",onChange:M=>O.onChange(M.target.value),onBlur:()=>b(O.onBlur),disabled:g.isPending,className:"opacity-0 w-full h-full cursor-pointer"})}),s.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:O.value??"#60a5fa"})]})}),s.jsx(Le,{})]})},t[48]=g.isPending,t[49]=b,t[50]=D):D=t[50];let L;t[51]!==u.control||t[52]!==D?(L=s.jsx(Te,{control:u.control,name:"themeColor",render:D}),t[51]=u.control,t[52]=D,t[53]=L):L=t[53];let $;t[54]!==v||t[55]!==P||t[56]!==A||t[57]!==E||t[58]!==L?($=s.jsxs("form",{onSubmit:v,className:"space-y-6",children:[P,A,E,L]}),t[54]=v,t[55]=P,t[56]=A,t[57]=E,t[58]=L,t[59]=$):$=t[59];let R;return t[60]!==u||t[61]!==$?(R=s.jsx("div",{className:"flex flex-col",children:s.jsx(ss,{...u,children:$})}),t[60]=u,t[61]=$,t[62]=R):R=t[62],R}function Gl(t){fe.error("Failed to update project: "+(t instanceof Error?t.message:"Unknown error"))}function ys(){const t=z.c(45),{org:e,project:n}=oe(),l=Ye(),i=Fe(),[r,a]=j.useState(""),[o,d]=j.useState(!1),m=n.slug===pe;let c;t[0]!==e.id?(c={connectionId:Be,orgId:e.id},t[0]=e.id,t[1]=c):c=t[1];const f=he(c);let u;t[2]!==f||t[3]!==n.id?(u=async()=>{const G=await f.callTool({name:"PROJECT_DELETE",arguments:{projectId:n.id}});return G.structuredContent??G},t[2]=f,t[3]=n.id,t[4]=u):u=t[4];let x;t[5]!==l||t[6]!==e.id||t[7]!==e.slug||t[8]!==i?(x=G=>{G.success?(i.invalidateQueries({queryKey:xe.projects(e.id)}),fe.success("Project deleted"),l({to:"/$org/$project",params:{org:e.slug,project:pe}})):fe.error(G.message??"Failed to delete project")},t[5]=l,t[6]=e.id,t[7]=e.slug,t[8]=i,t[9]=x):x=t[9];let p;t[10]!==u||t[11]!==x?(p={mutationFn:u,onSuccess:x,onError:Rl},t[10]=u,t[11]=x,t[12]=p):p=t[12];const h=He(p);if(m)return null;const g=r===n.name;let N;t[13]!==h?(N=()=>{h.mutate()},t[13]=h,t[14]=N):N=t[14];const w=N;let _;t[15]===Symbol.for("react.memo_cache_sentinel")?(_=G=>{d(G),G||a("")},t[15]=_):_=t[15];const b=_;let v;t[16]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("p",{className:"py-4 text-base font-semibold text-foreground border-b border-border",children:"Danger Zone"}),t[16]=v):v=t[16];let S;t[17]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Delete Project"}),s.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Permanently delete this project and all its data. This action cannot be undone."})]}),t[17]=S):S=t[17];let P;t[18]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(on,{asChild:!0,children:s.jsx(te,{variant:"outline",className:"shrink-0 bg-destructive/10 text-destructive border-0 hover:bg-destructive/15 hover:text-destructive",children:"Delete Project"})}),t[18]=P):P=t[18];let y;t[19]!==n.name?(y=s.jsxs(an,{children:['Delete "',n.name,'"?']}),t[19]=n.name,t[20]=y):y=t[20];let C;t[21]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(cn,{children:"This action cannot be undone. All project data will be permanently deleted."}),t[21]=C):C=t[21];let k;t[22]!==y?(k=s.jsxs(dn,{children:[y,C]}),t[22]=y,t[23]=k):k=t[23];let A;t[24]!==n.name?(A=s.jsxs("p",{className:"text-sm mb-2",children:["Type ",s.jsx("strong",{children:n.name})," to confirm:"]}),t[24]=n.name,t[25]=A):A=t[25];let I;t[26]===Symbol.for("react.memo_cache_sentinel")?(I=G=>a(G.target.value),t[26]=I):I=t[26];let E;t[27]!==r||t[28]!==n.name?(E=s.jsx(ve,{value:r,onChange:I,placeholder:n.name}),t[27]=r,t[28]=n.name,t[29]=E):E=t[29];let D;t[30]!==A||t[31]!==E?(D=s.jsxs("div",{className:"py-4",children:[A,E]}),t[30]=A,t[31]=E,t[32]=D):D=t[32];let L;t[33]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx(un,{children:"Cancel"}),t[33]=L):L=t[33];const $=!g||h.isPending,R=h.isPending?"Deleting...":"Delete Project";let T;t[34]!==w||t[35]!==$||t[36]!==R?(T=s.jsxs(mn,{children:[L,s.jsx(fn,{onClick:w,disabled:$,className:"bg-destructive/10 text-destructive hover:bg-destructive/15 hover:text-destructive border-0",children:R})]}),t[34]=w,t[35]=$,t[36]=R,t[37]=T):T=t[37];let O;t[38]!==k||t[39]!==D||t[40]!==T?(O=s.jsxs(xn,{children:[k,D,T]}),t[38]=k,t[39]=D,t[40]=T,t[41]=O):O=t[41];let M;return t[42]!==o||t[43]!==O?(M=s.jsxs("div",{className:"flex flex-col",children:[v,s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4",children:[S,s.jsxs(pn,{open:o,onOpenChange:b,children:[P,O]})]})]}),t[42]=o,t[43]=O,t[44]=M):M=t[44],M}function Rl(t){fe.error("Failed to delete project: "+(t instanceof Error?t.message:"Unknown error"))}function Fl(){const t=z.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("p",{className:"py-4 text-base font-semibold text-foreground border-b border-border",children:"General"}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"flex flex-col",children:[e,s.jsxs("div",{className:"pt-6 flex flex-col gap-6",children:[s.jsx(Ml,{}),s.jsx(ys,{})]})]}),t[1]=n):n=t[1],n}function It({value:t,onValueChange:e,placeholder:n="Select a connection...",binding:l,bindingType:i,onAddNew:r,className:a,disabled:o=!1}){const[d,m]=j.useState(!1),{installByBinding:c,isInstalling:f}=bn(),u=d||f,x=ns(),p=vn({connections:x,binding:typeof l=="string"?l:void 0}),h=!l||!x?x??[]:typeof l=="string"?p:Array.isArray(l)&&l.length>0?x.filter(v=>ls(v,l)):x,g=(()=>{if(!i?.startsWith("@"))return null;const[v,S]=i.replace("@","").split("/");return v&&S?{scope:v,appName:S}:null})(),N=(()=>{let v=h;const S=Array.isArray(l)&&l.length>0;if(g&&!S&&(v=v.filter(P=>{const y=P.app_name,C=P.metadata?.scopeName;return y===g.appName&&C===g.scope})),t&&!v.some(P=>P.id===t)){const P=x?.find(y=>y.id===t);if(P)return[P,...v]}return v})(),w=i?.startsWith("@"),_=async()=>{if(w&&i){m(!0);try{const v=await c(i);v&&e(v.id)}finally{m(!1)}return}r?.()},b=N.find(v=>v.id===t);return s.jsxs(Zt,{value:t??"none",onValueChange:v=>e(v==="none"?null:v),disabled:o,children:[s.jsx(es,{size:"sm",className:ue("w-[200px]",a),children:s.jsx(Zs,{placeholder:n,children:b?s.jsxs("div",{className:"flex items-center gap-2",children:[b.icon?s.jsx("img",{src:b.icon,alt:b.title,className:"w-4 h-4 rounded shrink-0"}):s.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:b.title.slice(0,1).toUpperCase()}),s.jsx("span",{className:"truncate",children:b.title})]}):n})}),s.jsxs(ts,{children:[s.jsx(Me,{value:"none",children:"No connection"}),N.length===0?s.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No compatible connections found"}):N.map(v=>s.jsx(Me,{value:v.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[v.icon?s.jsx("img",{src:v.icon,alt:v.title,className:"w-4 h-4 rounded"}):s.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-primary/20 to-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:v.title.slice(0,1).toUpperCase()}),s.jsx("span",{children:v.title})]})},v.id)),(r||w)&&s.jsx("div",{className:"border-t border-border",children:s.jsx(te,{onPointerDown:v=>v.stopPropagation(),onClick:v=>{v.preventDefault(),v.stopPropagation(),_()},disabled:u||o,variant:"ghost",className:"w-full justify-start gap-2 px-2 py-2 h-auto hover:bg-muted rounded-md text-sm disabled:opacity-50 disabled:cursor-not-allowed",type:"button",children:u?s.jsxs(s.Fragment,{children:[s.jsx(jn,{size:16,className:"animate-spin"}),s.jsx("span",{children:"Connecting..."})]}):s.jsxs(s.Fragment,{children:[s.jsx(xt,{size:16}),s.jsx("span",{children:"Add Connection"})]})})})]})]})}const Wl=t=>{if(!t||typeof t!="object")return!1;const e=t;return e.type==="text"&&typeof e.text=="string"&&e.text.trim().toLowerCase().startsWith("error")},ot=t=>{const e=t.structuredContent??t,n=e&&typeof e=="object"?e:null,l=n?.content?.[0]?.text&&typeof n.content[0].text=="string"?n.content[0].text:null;if(n?.isError)throw new Error(l??"Tool call failed");if(Wl(e))throw new Error(e.text);return e};function Ul(t){return t.requiresMcpBinding===!0?!0:t.binding!==void 0}function Vl(t){const e=z.c(62),{plugin:n,isEnabled:l,isSaving:i,pendingBinding:r,pendingVtexBinding:a,description:o,label:d,icon:m,projectId:c,client:f,onBindingChange:u,onVtexBindingChange:x,onToggle:p}=t;let h;e[0]!==n?(h=Ul(n),e[0]=n,e[1]=h):h=e[1];const g=h;let N;e[2]!==n.id||e[3]!==c?(N=xe.projectPluginConfig(c??"",n.id),e[2]=n.id,e[3]=c,e[4]=N):N=e[4];let w;e[5]!==f||e[6]!==n.id||e[7]!==c?(w=async()=>{if(!c)throw new Error("Project ID is required to load plugin config.");const V=await f.callTool({name:"PROJECT_PLUGIN_CONFIG_GET",arguments:{projectId:c,pluginId:n.id}});return ot(V)},e[5]=f,e[6]=n.id,e[7]=c,e[8]=w):w=e[8];const _=!!c&&g;let b;e[9]!==N||e[10]!==w||e[11]!==_?(b={queryKey:N,queryFn:w,enabled:_},e[9]=N,e[10]=w,e[11]=_,e[12]=b):b=e[12];const{data:v,isLoading:S}=hn(b),P=v?.config?.connectionId??null,y=r!==void 0?r:P,C=v?.config?.settings&&typeof v.config.settings=="object"?v.config.settings:null,k=typeof C?.vtexConnectionId=="string"?C.vtexConnectionId:null,A=a!==void 0?a.value:k,I=n.id==="collection-reorder-ranking";let E;e[13]!==l||e[14]!==i||e[15]!==p||e[16]!==n.id?(E=()=>!i&&p(n.id,!l),e[13]=l,e[14]=i,e[15]=p,e[16]=n.id,e[17]=E):E=e[17];const D=i?void 0:"pointer";let L;e[18]!==D?(L={cursor:D},e[18]=D,e[19]=L):L=e[19];let $;e[20]!==m?($=m&&s.jsx("span",{className:"text-muted-foreground mt-0.5 shrink-0 [&>svg]:size-4",children:m}),e[20]=m,e[21]=$):$=e[21];let R;e[22]!==d?(R=s.jsx("p",{className:"text-sm font-medium text-foreground",children:d}),e[22]=d,e[23]=R):R=e[23];let T;e[24]!==o?(T=o&&s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:o}),e[24]=o,e[25]=T):T=e[25];let O;e[26]!==R||e[27]!==T?(O=s.jsxs("div",{className:"min-w-0",children:[R,T]}),e[26]=R,e[27]=T,e[28]=O):O=e[28];let M;e[29]!==O||e[30]!==$?(M=s.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[$,O]}),e[29]=O,e[30]=$,e[31]=M):M=e[31];let G;e[32]!==p||e[33]!==n.id?(G=V=>p(n.id,V),e[32]=p,e[33]=n.id,e[34]=G):G=e[34];let U;e[35]!==l||e[36]!==i||e[37]!==G?(U=s.jsx("div",{onClick:ql,className:"shrink-0",children:s.jsx(Re,{checked:l,onCheckedChange:G,disabled:i})}),e[35]=l,e[36]=i,e[37]=G,e[38]=U):U=e[38];let F;e[39]!==M||e[40]!==U?(F=s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4",children:[M,U]}),e[39]=M,e[40]=U,e[41]=F):F=e[41];let W;e[42]!==I||e[43]!==S||e[44]!==l||e[45]!==i||e[46]!==g||e[47]!==u||e[48]!==x||e[49]!==n.binding||e[50]!==n.id||e[51]!==y||e[52]!==P||e[53]!==C||e[54]!==k||e[55]!==A?(W=l&&g&&s.jsxs("div",{className:"pb-4 pl-7 space-y-2",onClick:Kl,children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Se,{className:"text-xs text-muted-foreground w-24",children:"Connection"}),s.jsx(It,{value:y??null,onValueChange:V=>u(n.id,V,P),binding:n.binding,placeholder:"Select connection...",className:"w-56",disabled:i||S})]}),I&&s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Se,{className:"text-xs text-muted-foreground w-24",children:"VTEX"}),s.jsx(It,{value:A??null,onValueChange:V=>x(n.id,V,k,C),binding:Bs,placeholder:"Select VTEX connection...",className:"w-56",disabled:i||S})]})]}),e[42]=I,e[43]=S,e[44]=l,e[45]=i,e[46]=g,e[47]=u,e[48]=x,e[49]=n.binding,e[50]=n.id,e[51]=y,e[52]=P,e[53]=C,e[54]=k,e[55]=A,e[56]=W):W=e[56];let K;return e[57]!==F||e[58]!==W||e[59]!==E||e[60]!==L?(K=s.jsxs("div",{className:"flex flex-col border-b border-border last:border-0",onClick:E,style:L,children:[F,W]}),e[57]=F,e[58]=W,e[59]=E,e[60]=L,e[61]=K):K=e[61],K}function Kl(t){return t.stopPropagation()}function ql(t){return t.stopPropagation()}function Yl(){const{org:t,project:e}=oe(),n=Fe(),l=he({connectionId:Be,orgId:t.id}),[i,r]=j.useState({}),[a,o]=j.useState({}),[d,m]=j.useState({}),[c,f]=j.useState(!1),u=e.enabledPlugins??[],x=y=>{const C=i[y];return C!==void 0?C:u.includes(y)},p=()=>{const y=new Set(u);for(const[C,k]of Object.entries(i))k?y.add(C):y.delete(C);return Array.from(y)},h=Object.keys(i).length>0||Object.keys(a).length>0||Object.keys(d).length>0,g=(y,C)=>{const k=u.includes(y);r(C===k?A=>{const{[y]:I,...E}=A;return E}:A=>({...A,[y]:C}))},N=(y,C,k)=>{if(C===k){o(A=>{const{[y]:I,...E}=A;return E});return}o(A=>({...A,[y]:C}))},w=(y,C,k,A)=>{if(C===k){m(I=>{const{[y]:E,...D}=I;return D});return}m(I=>({...I,[y]:{value:C,baseSettings:A}}))},_=He({mutationFn:async y=>{const C=[];if(y.updatePlugins){const k=await l.callTool({name:"PROJECT_UPDATE",arguments:{projectId:e.id,enabledPlugins:y.enabledPlugins}});C.push(ot(k))}if(y.bindingUpdates.length>0){const k=await Promise.all(y.bindingUpdates.map(async({pluginId:A,connectionId:I,settings:E})=>{const D=await l.callTool({name:"PROJECT_PLUGIN_CONFIG_UPDATE",arguments:{projectId:e.id,pluginId:A,connectionId:I,settings:E}});return ot(D)}));C.push(...k)}return C},onSuccess:(y,C)=>{C.updatePlugins&&(n.invalidateQueries({queryKey:xe.project(t.id,e.slug)}),n.invalidateQueries({queryKey:xe.projects(t.id)})),C.bindingUpdates.forEach(({pluginId:k})=>{n.invalidateQueries({queryKey:xe.projectPluginConfig(e.id??"",k)})}),r({}),o({}),m({}),fe.success("Plugins updated successfully")},onError:y=>{fe.error("Failed to update plugins: "+(y instanceof Error?y.message:"Unknown error"))},onSettled:()=>{f(!1)}}),b=()=>{f(!0);const y=new Set([...Object.keys(a),...Object.keys(d)]),C=Array.from(y).map(k=>{const A=a[k],I=d[k],E=I?{...I.baseSettings??{},vtexConnectionId:I.value}:void 0;return{pluginId:k,connectionId:A!==void 0?A:void 0,settings:E}});_.mutate({enabledPlugins:p(),updatePlugins:Object.keys(i).length>0,bindingUpdates:C})},v=()=>{r({}),o({}),m({})},S=y=>{const C=$s.find(k=>k.pluginId===y);return C?{label:C.label,icon:C.items[0]?.icon}:null},P=y=>Ze.find(k=>k.id===y)?.description??null;return Ze.length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins available."}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex flex-col",children:Ze.map(y=>{const C=S(y.id),k=P(y.id),A=x(y.id);return s.jsx(Vl,{plugin:y,isEnabled:A,isSaving:c,pendingBinding:a[y.id],pendingVtexBinding:d[y.id],description:k,label:C?.label??y.id,icon:C?.icon??s.jsx(gn,{size:14}),projectId:e.id,client:l,onBindingChange:N,onVtexBindingChange:w,onToggle:g},y.id)})}),s.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[s.jsx(te,{variant:"outline",onClick:v,disabled:!h||c,children:"Cancel"}),s.jsx(te,{onClick:b,disabled:!h||c,className:"min-w-24",children:c?"Saving...":"Save Changes"})]})]})}function Et(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsx("div",{children:s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Plugins"})}),s.jsx(Yl,{})]}),t[0]=e):e=t[0],e}function Hl(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Danger Zone"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Irreversible and destructive actions."})]}),s.jsx(ys,{})]}),t[0]=e):e=t[0],e}var Ot=function(e,n){for(var l=arguments.length,i=new Array(l>2?l-2:0),r=2;r<l;r++)i[r-2]=arguments[r];if(typeof console<"u"&&console.warn&&(n===void 0&&console.warn("LogUtils requires an error message argument"),!e))if(n===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;console.warn(n.replace(/%s/g,()=>i[a++]))}},Ql=["x1","y1","x2","y2","key"],Jl=["offset"],Xl=["xAxisId","yAxisId"],Zl=["xAxisId","yAxisId"];function Dt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);e&&(l=l.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,l)}return n}function ee(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Dt(Object(n),!0).forEach(function(l){er(t,l,n[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Dt(Object(n)).forEach(function(l){Object.defineProperty(t,l,Object.getOwnPropertyDescriptor(n,l))})}return t}function er(t,e,n){return(e=tr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tr(t){var e=sr(t,"string");return typeof e=="symbol"?e:e+""}function sr(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var l=n.call(t,e);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ne(){return Ne=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var l in n)({}).hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},Ne.apply(null,arguments)}function Ke(t,e){if(t==null)return{};var n,l,i=nr(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(l=0;l<r.length;l++)n=r[l],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function nr(t,e){if(t==null)return{};var n={};for(var l in t)if({}.hasOwnProperty.call(t,l)){if(e.indexOf(l)!==-1)continue;n[l]=t[l]}return n}var lr=t=>{var{fill:e}=t;if(!e||e==="none")return null;var{fillOpacity:n,x:l,y:i,width:r,height:a,ry:o}=t;return j.createElement("rect",{x:l,y:i,ry:o,width:r,height:a,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function bs(t){var{option:e,lineItemProps:n}=t,l;if(j.isValidElement(e))l=j.cloneElement(e,n);else if(typeof e=="function")l=e(n);else{var i,{x1:r,y1:a,x2:o,y2:d,key:m}=n,c=Ke(n,Ql),f=(i=pt(c))!==null&&i!==void 0?i:{},{offset:u}=f,x=Ke(f,Jl);l=j.createElement("line",Ne({},x,{x1:r,y1:a,x2:o,y2:d,fill:"none",key:m}))}return l}function rr(t){var{x:e,width:n,horizontal:l=!0,horizontalPoints:i}=t;if(!l||!i||!i.length)return null;var{xAxisId:r,yAxisId:a}=t,o=Ke(t,Xl),d=i.map((m,c)=>{var f=ee(ee({},o),{},{x1:e,y1:m,x2:e+n,y2:m,key:"line-".concat(c),index:c});return j.createElement(bs,{key:"line-".concat(c),option:l,lineItemProps:f})});return j.createElement("g",{className:"recharts-cartesian-grid-horizontal"},d)}function ir(t){var{y:e,height:n,vertical:l=!0,verticalPoints:i}=t;if(!l||!i||!i.length)return null;var{xAxisId:r,yAxisId:a}=t,o=Ke(t,Zl),d=i.map((m,c)=>{var f=ee(ee({},o),{},{x1:m,y1:e,x2:m,y2:e+n,key:"line-".concat(c),index:c});return j.createElement(bs,{option:l,lineItemProps:f,key:"line-".concat(c)})});return j.createElement("g",{className:"recharts-cartesian-grid-vertical"},d)}function ar(t){var{horizontalFill:e,fillOpacity:n,x:l,y:i,width:r,height:a,horizontalPoints:o,horizontal:d=!0}=t;if(!d||!e||!e.length||o==null)return null;var m=o.map(f=>Math.round(f+i-i)).sort((f,u)=>f-u);i!==m[0]&&m.unshift(0);var c=m.map((f,u)=>{var x=m[u+1],p=x==null,h=p?i+a-f:x-f;if(h<=0)return null;var g=u%e.length;return j.createElement("rect",{key:"react-".concat(u),y:f,x:l,height:h,width:r,stroke:"none",fill:e[g],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return j.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},c)}function or(t){var{vertical:e=!0,verticalFill:n,fillOpacity:l,x:i,y:r,width:a,height:o,verticalPoints:d}=t;if(!e||!n||!n.length)return null;var m=d.map(f=>Math.round(f+i-i)).sort((f,u)=>f-u);i!==m[0]&&m.unshift(0);var c=m.map((f,u)=>{var x=m[u+1],p=x==null,h=p?i+a-f:x-f;if(h<=0)return null;var g=u%n.length;return j.createElement("rect",{key:"react-".concat(u),x:f,y:r,width:h,height:o,stroke:"none",fill:n[g],fillOpacity:l,className:"recharts-cartesian-grid-bg"})});return j.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},c)}var cr=(t,e)=>{var{xAxis:n,width:l,height:i,offset:r}=t;return as(os(ee(ee(ee({},Ge),n),{},{ticks:cs(n),viewBox:{x:0,y:0,width:l,height:i}})),r.left,r.left+r.width,e)},dr=(t,e)=>{var{yAxis:n,width:l,height:i,offset:r}=t;return as(os(ee(ee(ee({},Ge),n),{},{ticks:cs(n),viewBox:{x:0,y:0,width:l,height:i}})),r.top,r.top+r.height,e)},ur={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:rs.grid};function js(t){var e=Nn(),n=Sn(),l=Cn(),i=ee(ee({},Qe(t,ur)),{},{x:ce(t.x)?t.x:l.left,y:ce(t.y)?t.y:l.top,width:ce(t.width)?t.width:l.width,height:ce(t.height)?t.height:l.height}),{xAxisId:r,yAxisId:a,x:o,y:d,width:m,height:c,syncWithTicks:f,horizontalValues:u,verticalValues:x}=i,p=Je(),h=ge(C=>Nt(C,"xAxis",r,p)),g=ge(C=>Nt(C,"yAxis",a,p));if(!St(m)||!St(c)||!ce(o)||!ce(d))return null;var N=i.verticalCoordinatesGenerator||cr,w=i.horizontalCoordinatesGenerator||dr,{horizontalPoints:_,verticalPoints:b}=i;if((!_||!_.length)&&typeof w=="function"){var v=u&&u.length,S=w({yAxis:g?ee(ee({},g),{},{ticks:v?u:g.ticks}):void 0,width:e??m,height:n??c,offset:l},v?!0:f);Ot(Array.isArray(S),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof S,"]")),Array.isArray(S)&&(_=S)}if((!b||!b.length)&&typeof N=="function"){var P=x&&x.length,y=N({xAxis:h?ee(ee({},h),{},{ticks:P?x:h.ticks}):void 0,width:e??m,height:n??c,offset:l},P?!0:f);Ot(Array.isArray(y),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof y,"]")),Array.isArray(y)&&(b=y)}return j.createElement(is,{zIndex:i.zIndex},j.createElement("g",{className:"recharts-cartesian-grid"},j.createElement(lr,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),j.createElement(ar,Ne({},i,{horizontalPoints:_})),j.createElement(or,Ne({},i,{verticalPoints:b})),j.createElement(rr,Ne({},i,{offset:l,horizontalPoints:_,xAxis:h,yAxis:g})),j.createElement(ir,Ne({},i,{offset:l,verticalPoints:b,xAxis:h,yAxis:g}))))}js.displayName="CartesianGrid";var Ns=(t,e,n)=>ds(t,"xAxis",gt(t,e),n),Ss=(t,e,n)=>us(t,"xAxis",gt(t,e),n),Cs=(t,e,n)=>ds(t,"yAxis",vt(t,e),n),ws=(t,e,n)=>us(t,"yAxis",vt(t,e),n),mr=Xe([ht,Ns,Cs,Ss,ws],(t,e,n,l,i)=>ms(t,"xAxis")?Ct(e,l,!1):Ct(n,i,!1)),fr=(t,e)=>e,_s=Xe([kn,fr],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),Ps=t=>{var e=ht(t),n=ms(e,"xAxis");return n?"yAxis":"xAxis"},xr=(t,e)=>{var n=Ps(t);return n==="yAxis"?vt(t,e):gt(t,e)},pr=(t,e,n)=>An(t,Ps(t),xr(t,e),n),hr=Xe([_s,pr],(t,e)=>{var n;if(!(t==null||e==null)){var{stackId:l}=t,i=Pn(t);if(!(l==null||i==null)){var r=(n=e[l])===null||n===void 0?void 0:n.stackedData,a=r?.find(o=>o.key===i);if(a!=null)return a.map(o=>[o[0],o[1]])}}}),gr=Xe([ht,Ns,Cs,Ss,ws,hr,wn,mr,_s,_n],(t,e,n,l,i,r,a,o,d,m)=>{var{chartData:c,dataStartIndex:f,dataEndIndex:u}=a;if(!(d==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||l==null||i==null||l.length===0||i.length===0||o==null)){var{data:x}=d,p;if(x&&x.length>0?p=x:p=c?.slice(f,u+1),p!=null)return zr({layout:t,xAxis:e,yAxis:n,xAxisTicks:l,yAxisTicks:i,dataStartIndex:f,areaSettings:d,stackedData:r,displayedData:p,chartBaseValue:m,bandSize:o})}}),vr=["id"],yr=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Ce(){return Ce=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var l in n)({}).hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},Ce.apply(null,arguments)}function ks(t,e){if(t==null)return{};var n,l,i=br(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(l=0;l<r.length;l++)n=r[l],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function br(t,e){if(t==null)return{};var n={};for(var l in t)if({}.hasOwnProperty.call(t,l)){if(e.indexOf(l)!==-1)continue;n[l]=t[l]}return n}function Tt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);e&&(l=l.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,l)}return n}function Oe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tt(Object(n),!0).forEach(function(l){jr(t,l,n[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tt(Object(n)).forEach(function(l){Object.defineProperty(t,l,Object.getOwnPropertyDescriptor(n,l))})}return t}function jr(t,e,n){return(e=Nr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Nr(t){var e=Sr(t,"string");return typeof e=="symbol"?e:e+""}function Sr(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var l=n.call(t,e);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function qe(t,e){return t&&t!=="none"?t:e}var Cr=t=>{var{dataKey:e,name:n,stroke:l,fill:i,legendType:r,hide:a}=t;return[{inactive:a,dataKey:e,type:r,color:qe(l,i),value:fs(n,e),payload:t}]},wr=j.memo(t=>{var{dataKey:e,data:n,stroke:l,strokeWidth:i,fill:r,name:a,hide:o,unit:d,tooltipType:m,id:c}=t,f={dataDefinedOnItem:n,getPosition:zn,settings:{stroke:l,strokeWidth:i,fill:r,dataKey:e,nameKey:void 0,name:fs(a,e),hide:o,type:m,color:qe(l,r),unit:d,graphicalItemId:c}};return j.createElement(Ln,{tooltipEntrySettings:f})});function _r(t){var{clipPathId:e,points:n,props:l}=t,{needClip:i,dot:r,dataKey:a}=l,o=pt(l);return j.createElement(Jn,{points:n,dot:r,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:a,baseProps:o,needClip:i,clipPathId:e})}function Pr(t){var{showLabels:e,children:n,points:l}=t,i=l.map(r=>{var a,o,d={x:(a=r.x)!==null&&a!==void 0?a:0,y:(o=r.y)!==null&&o!==void 0?o:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Oe(Oe({},d),{},{value:r.value,payload:r.payload,parentViewBox:void 0,viewBox:d,fill:void 0})});return j.createElement(Hn,{value:e?i:void 0},n)}function Lt(t){var{points:e,baseLine:n,needClip:l,clipPathId:i,props:r}=t,{layout:a,type:o,stroke:d,connectNulls:m,isRange:c}=r,{id:f}=r,u=ks(r,vr),x=pt(u),p=Qn(u);return j.createElement(j.Fragment,null,e?.length>1&&j.createElement(Ue,{clipPath:l?"url(#clipPath-".concat(i,")"):void 0},j.createElement(et,Ce({},p,{id:f,points:e,connectNulls:m,type:o,baseLine:n,layout:a,stroke:"none",className:"recharts-area-area"})),d!=="none"&&j.createElement(et,Ce({},x,{className:"recharts-area-curve",layout:a,type:o,connectNulls:m,fill:"none",points:e})),d!=="none"&&c&&j.createElement(et,Ce({},x,{className:"recharts-area-curve",layout:a,type:o,connectNulls:m,fill:"none",points:n}))),j.createElement(_r,{points:e,props:u,clipPathId:i}))}function kr(t){var e,n,{alpha:l,baseLine:i,points:r,strokeWidth:a}=t,o=(e=r[0])===null||e===void 0?void 0:e.y,d=(n=r[r.length-1])===null||n===void 0?void 0:n.y;if(!Ve(o)||!Ve(d))return null;var m=l*Math.abs(o-d),c=Math.max(...r.map(f=>f.x||0));return ce(i)?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(...i.map(f=>f.x||0),c)),ce(c)?j.createElement("rect",{x:0,y:o<d?o:o-m,width:c+(a?parseInt("".concat(a),10):1),height:Math.floor(m)}):null}function Ar(t){var e,n,{alpha:l,baseLine:i,points:r,strokeWidth:a}=t,o=(e=r[0])===null||e===void 0?void 0:e.x,d=(n=r[r.length-1])===null||n===void 0?void 0:n.x;if(!Ve(o)||!Ve(d))return null;var m=l*Math.abs(o-d),c=Math.max(...r.map(f=>f.y||0));return ce(i)?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(...i.map(f=>f.y||0),c)),ce(c)?j.createElement("rect",{x:o<d?o:o-m,y:0,width:m,height:Math.floor(c+(a?parseInt("".concat(a),10):1))}):null}function Ir(t){var{alpha:e,layout:n,points:l,baseLine:i,strokeWidth:r}=t;return n==="vertical"?j.createElement(kr,{alpha:e,points:l,baseLine:i,strokeWidth:r}):j.createElement(Ar,{alpha:e,points:l,baseLine:i,strokeWidth:r})}function Er(t){var{needClip:e,clipPathId:n,props:l,previousPointsRef:i,previousBaselineRef:r}=t,{points:a,baseLine:o,isAnimationActive:d,animationBegin:m,animationDuration:c,animationEasing:f,onAnimationStart:u,onAnimationEnd:x}=l,p=j.useMemo(()=>({points:a,baseLine:o}),[a,o]),h=Un(p,"recharts-area-"),g=xs(),[N,w]=j.useState(!1),_=!N,b=j.useCallback(()=>{typeof x=="function"&&x(),w(!1)},[x]),v=j.useCallback(()=>{typeof u=="function"&&u(),w(!0)},[u]);if(g==null)return null;var S=i.current,P=r.current;return j.createElement(Pr,{showLabels:_,points:a},l.children,j.createElement(Vn,{animationId:h,begin:m,duration:c,isActive:d,easing:f,onAnimationEnd:b,onAnimationStart:v,key:h},y=>{if(S){var C=S.length/a.length,k=y===1?a:a.map((I,E)=>{var D=Math.floor(E*C);if(S[D]){var L=S[D];return Oe(Oe({},I),{},{x:Ee(L.x,I.x,y),y:Ee(L.y,I.y,y)})}return I}),A;return ce(o)?A=Ee(P,o,y):Kn(o)||qn(o)?A=Ee(P,0,y):A=o.map((I,E)=>{var D=Math.floor(E*C);if(Array.isArray(P)&&P[D]){var L=P[D];return Oe(Oe({},I),{},{x:Ee(L.x,I.x,y),y:Ee(L.y,I.y,y)})}return I}),y>0&&(i.current=k,r.current=A),j.createElement(Lt,{points:k,baseLine:A,needClip:e,clipPathId:n,props:l})}return y>0&&(i.current=a,r.current=o),j.createElement(Ue,null,d&&j.createElement("defs",null,j.createElement("clipPath",{id:"animationClipPath-".concat(n)},j.createElement(Ir,{alpha:y,points:a,baseLine:o,layout:g,strokeWidth:l.strokeWidth}))),j.createElement(Ue,{clipPath:"url(#animationClipPath-".concat(n,")")},j.createElement(Lt,{points:a,baseLine:o,needClip:e,clipPathId:n,props:l})))}),j.createElement(Yn,{label:l.label}))}function Or(t){var{needClip:e,clipPathId:n,props:l}=t,i=j.useRef(null),r=j.useRef();return j.createElement(Er,{needClip:e,clipPathId:n,props:l,previousPointsRef:i,previousBaselineRef:r})}class Dr extends j.PureComponent{render(){var{hide:e,dot:n,points:l,className:i,top:r,left:a,needClip:o,xAxisId:d,yAxisId:m,width:c,height:f,id:u,baseLine:x,zIndex:p}=this.props;if(e)return null;var h=Ut("recharts-area",i),g=u,{r:N,strokeWidth:w}=Rn(n),_=Fn(n),b=N*2+w,v=o?"url(#clipPath-".concat(_?"":"dots-").concat(g,")"):void 0;return j.createElement(is,{zIndex:p},j.createElement(Ue,{className:h},o&&j.createElement("defs",null,j.createElement(Wn,{clipPathId:g,xAxisId:d,yAxisId:m}),!_&&j.createElement("clipPath",{id:"clipPath-dots-".concat(g)},j.createElement("rect",{x:a-b/2,y:r-b/2,width:c+b,height:f+b}))),j.createElement(Or,{needClip:o,clipPathId:g,props:this.props})),j.createElement(wt,{points:l,mainColor:qe(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:v}),this.props.isRange&&Array.isArray(x)&&j.createElement(wt,{points:x,mainColor:qe(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:v}))}}var As={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:rs.area};function Tr(t){var e,n=Qe(t,As),{activeDot:l,animationBegin:i,animationDuration:r,animationEasing:a,connectNulls:o,dot:d,fill:m,fillOpacity:c,hide:f,isAnimationActive:u,legendType:x,stroke:p,xAxisId:h,yAxisId:g}=n,N=ks(n,yr),w=$n(),_=Bn(),{needClip:b}=Mn(h,g),v=Je(),{points:S,isRange:P,baseLine:y}=(e=ge(D=>gr(D,t.id,v)))!==null&&e!==void 0?e:{},C=Gn();if(w!=="horizontal"&&w!=="vertical"||C==null||_!=="AreaChart"&&_!=="ComposedChart")return null;var{height:k,width:A,x:I,y:E}=C;return!S||!S.length?null:j.createElement(Dr,Ce({},N,{activeDot:l,animationBegin:i,animationDuration:r,animationEasing:a,baseLine:y,connectNulls:o,dot:d,fill:m,fillOpacity:c,height:k,hide:f,layout:w,isAnimationActive:u==="auto"?!Xn.isSsr:u,isRange:P,legendType:x,needClip:b,points:S,stroke:p,width:A,left:I,top:E,xAxisId:h,yAxisId:g}))}var Lr=(t,e,n,l,i)=>{var r=n??e;if(ce(r))return r;var a=t==="horizontal"?i:l,o=a.scale.domain();if(a.type==="number"){var d=Math.max(o[0],o[1]),m=Math.min(o[0],o[1]);return r==="dataMin"?m:r==="dataMax"||d<0?d:Math.max(Math.min(o[0],o[1]),0)}return r==="dataMin"?o[0]:r==="dataMax"?o[1]:o[0]};function zr(t){var{areaSettings:{connectNulls:e,baseValue:n,dataKey:l},stackedData:i,layout:r,chartBaseValue:a,xAxis:o,yAxis:d,displayedData:m,dataStartIndex:c,xAxisTicks:f,yAxisTicks:u,bandSize:x}=t,p=i&&i.length,h=Lr(r,a,n,o,d),g=r==="horizontal",N=!1,w=m.map((b,v)=>{var S,P,y,C;if(p)C=i[c+v];else{var k=_t(b,l);Array.isArray(k)?(C=k,N=!0):C=[h,k]}var A=(S=(P=C)===null||P===void 0?void 0:P[1])!==null&&S!==void 0?S:null,I=A==null||p&&!e&&_t(b,l)==null;if(g){var E;return{x:Pt({axis:o,ticks:f,bandSize:x,entry:b,index:v}),y:I?null:(E=d.scale.map(A))!==null&&E!==void 0?E:null,value:C,payload:b}}return{x:I?null:(y=o.scale.map(A))!==null&&y!==void 0?y:null,y:Pt({axis:d,ticks:u,bandSize:x,entry:b,index:v}),value:C,payload:b}}),_;return p||N?_=w.map(b=>{var v,S=Array.isArray(b.value)?b.value[0]:null;if(g){var P;return{x:b.x,y:S!=null&&b.y!=null&&(P=d.scale.map(S))!==null&&P!==void 0?P:null,payload:b.payload}}return{x:S!=null&&(v=o.scale.map(S))!==null&&v!==void 0?v:null,y:b.y,payload:b.payload}}):_=g?d.scale.map(h):o.scale.map(h),{points:w,baseLine:_??0,isRange:N}}function $r(t){var e=Qe(t,As),n=Je();return j.createElement(En,{id:e.id,type:"area"},l=>j.createElement(j.Fragment,null,j.createElement(On,{legendPayload:Cr(e)}),j.createElement(wr,{dataKey:e.dataKey,data:e.data,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType,id:l}),j.createElement(Dn,{type:"area",id:l,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:Tn(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),j.createElement(Tr,Ce({},e,{id:l}))))}var Is=j.memo($r,In);Is.displayName="Area";var Br=["type"],Mr=["dangerouslySetInnerHTML","ticks","scale"],Gr=["id","scale"];function ct(){return ct=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var l in n)({}).hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},ct.apply(null,arguments)}function zt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);e&&(l=l.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,l)}return n}function $t(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?zt(Object(n),!0).forEach(function(l){Rr(t,l,n[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zt(Object(n)).forEach(function(l){Object.defineProperty(t,l,Object.getOwnPropertyDescriptor(n,l))})}return t}function Rr(t,e,n){return(e=Fr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Fr(t){var e=Wr(t,"string");return typeof e=="symbol"?e:e+""}function Wr(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var l=n.call(t,e);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dt(t,e){if(t==null)return{};var n,l,i=Ur(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(l=0;l<r.length;l++)n=r[l],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Ur(t,e){if(t==null)return{};var n={};for(var l in t)if({}.hasOwnProperty.call(t,l)){if(e.indexOf(l)!==-1)continue;n[l]=t[l]}return n}function Vr(t){var e=ps(),n=j.useRef(null),l=xs(),{type:i}=t,r=dt(t,Br),a=ul(l,"yAxis",i),o=j.useMemo(()=>{if(a!=null)return $t($t({},r),{},{type:a})},[a,r]);return j.useLayoutEffect(()=>{o!=null&&(n.current===null?e(el(o)):n.current!==o&&e(tl({prev:n.current,next:o})),n.current=o)},[o,e]),j.useLayoutEffect(()=>()=>{n.current&&(e(sl(n.current)),n.current=null)},[e]),null}function Kr(t){var{yAxisId:e,className:n,width:l,label:i}=t,r=j.useRef(null),a=j.useRef(null),o=ge(nl),d=Je(),m=ps(),c="yAxis",f=ge(S=>ll(S,e)),u=ge(S=>rl(S,e)),x=ge(S=>il(S,c,e,d)),p=ge(S=>al(S,e));if(j.useLayoutEffect(()=>{if(!(l!=="auto"||!f||ol(i)||j.isValidElement(i)||p==null)){var S=r.current;if(S){var P=S.getCalculatedWidth();Math.round(f.width)!==Math.round(P)&&m(cl({id:e,width:P}))}}},[x,f,m,i,e,l,p]),f==null||u==null||p==null)return null;var{dangerouslySetInnerHTML:h,ticks:g,scale:N}=t,w=dt(t,Mr),{id:_,scale:b}=p,v=dt(p,Gr);return j.createElement(dl,ct({},w,v,{ref:r,labelRef:a,x:u.x,y:u.y,tickTextProps:l==="auto"?{width:void 0}:{width:l},width:f.width,height:f.height,className:Ut("recharts-".concat(c," ").concat(c),n),viewBox:o,ticks:x,axisType:c}))}var qr={allowDataOverflow:Z.allowDataOverflow,allowDecimals:Z.allowDecimals,allowDuplicatedCategory:Z.allowDuplicatedCategory,angle:Z.angle,axisLine:Ge.axisLine,hide:!1,includeHidden:Z.includeHidden,interval:Z.interval,label:!1,minTickGap:Z.minTickGap,mirror:Z.mirror,orientation:Z.orientation,padding:Z.padding,reversed:Z.reversed,scale:Z.scale,tick:Z.tick,tickCount:Z.tickCount,tickLine:Ge.tickLine,tickSize:Ge.tickSize,type:Z.type,width:Z.width,yAxisId:0},Yr=t=>{var e=Qe(t,qr);return j.createElement(j.Fragment,null,j.createElement(Vr,{interval:e.interval,id:e.yAxisId,scale:e.scale,type:e.type,domain:e.domain,allowDataOverflow:e.allowDataOverflow,dataKey:e.dataKey,allowDuplicatedCategory:e.allowDuplicatedCategory,allowDecimals:e.allowDecimals,tickCount:e.tickCount,padding:e.padding,includeHidden:e.includeHidden,reversed:e.reversed,ticks:e.ticks,width:e.width,orientation:e.orientation,mirror:e.mirror,hide:e.hide,unit:e.unit,name:e.name,angle:e.angle,minTickGap:e.minTickGap,tick:e.tick,tickFormatter:e.tickFormatter}),j.createElement(Kr,e))},Es=j.memo(Yr,Zn);Es.displayName="YAxis";var Hr=["axis"],Qr=j.forwardRef((t,e)=>j.createElement(ml,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Hr,tooltipPayloadSearcher:fl,categoricalChartProps:t,ref:e}));const ze="$.providerMetadata.openrouter.usage.cost";function bt(t){const e=new Date,n=new Date(e.getFullYear(),e.getMonth(),e.getDate()),l=new Date(n);l.setDate(l.getDate()+1);const i=new Date(n),r=t==="7d"?7:t==="30d"?30:90;return i.setDate(i.getDate()-r),{startDate:i.toISOString(),endDate:l.toISOString()}}function $e(t){return t.structuredContent}function Q(t){return`$${t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}const Os="gateway-chip-period";function Jr(){try{const t=localStorage.getItem(Os);if(t==="daily"||t==="weekly"||t==="monthly")return t}catch{}return"daily"}function Xr(t){try{localStorage.setItem(Os,t)}catch{}}const Zr={low:"Low confidence",medium:"Medium confidence",high:"High confidence"},ei={daily:"daily",weekly:"weekly",monthly:"monthly"},ti=[5,10,25,50,100],si=[{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"},{value:"monthly",label:"Monthly"},{value:"none",label:"No reset"}];function ni(t){const e=z.c(51),{open:n,onOpenChange:l,connectionId:i,currentLimitUsd:r,billingMode:a,currentLimitPeriod:o}=t,{org:d}=oe(),[m,c]=j.useState(null),[f,u]=j.useState(""),[x,p]=j.useState(null),[h,g]=j.useState(null),[N,w]=j.useState(o??"none");let _;e[0]!==i||e[1]!==d.id?(_={connectionId:i,orgId:d.id},e[0]=i,e[1]=d.id,e[2]=_):_=e[2];const b=he(_);let v;e[3]!==b?(v={client:b},e[3]=b,e[4]=v):v=e[4];const{mutate:S,isPending:P}=hs(v),y=Fe(),C=a==="postpaid";let k;e[5]!==f?(k=f?Number.parseFloat(f):null,e[5]=f,e[6]=k):k=e[6];const I=m??k,E=N==="none"?null:N,D=C&&I!=null&&I===r&&E===o;let L;e[7]!==b?(L=ln.mcpToolCall(b,"GATEWAY_USAGE",JSON.stringify({})),e[7]=b,e[8]=L):L=e[8];const $=L;let R;e[9]!==$||e[10]!==y?(R=async()=>{await y.invalidateQueries({queryKey:$,exact:!0}),await y.refetchQueries({queryKey:$,exact:!0,type:"active"})},e[9]=$,e[10]=y,e[11]=R):R=e[11];const T=R;let O,M;e[12]!==a||e[13]!==o||e[14]!==r||e[15]!==I||e[16]!==C||e[17]!==N||e[18]!==S||e[19]!==l||e[20]!==T?(M=()=>{if(!I||I<=0)return;const q=C?I:r+I;g(null);const le={limit_usd:q,billing_mode:a,return_url:window.location.href};C&&(le.limit_period=N),S({name:"GATEWAY_SET_LIMIT",arguments:le},{onSuccess:async re=>{const se=re.structuredContent;se?.checkout_url||await T(),se?.checkout_url?p(se.checkout_url):O()},onError:re=>{g(re.message??"Failed to update limit.")}})},O=()=>{c(null),u(""),p(null),g(null),w(o??"none"),l(!1)},e[12]=a,e[13]=o,e[14]=r,e[15]=I,e[16]=C,e[17]=N,e[18]=S,e[19]=l,e[20]=T,e[21]=O,e[22]=M):(O=e[21],M=e[22]);const G=C?"Configure Spending Limit":"Add Credit",U=C?"Set a spending limit for your AI Gateway. The limit resets automatically based on the selected period.":"Choose how much credit to add to your AI Gateway.",F=C?"New limit":"Select amount",W=C?"Set Limit":"Continue";let K;e[23]!==G?(K=s.jsx(Fs,{children:G}),e[23]=G,e[24]=K):K=e[24];let V;e[25]!==U?(V=s.jsx(Ws,{children:U}),e[25]=U,e[26]=V):V=e[26];let Y;e[27]!==K||e[28]!==V?(Y=s.jsxs(Us,{children:[K,V]}),e[27]=K,e[28]=V,e[29]=Y):Y=e[29];let H;e[30]!==F||e[31]!==x||e[32]!==W||e[33]!==r||e[34]!==f||e[35]!==I||e[36]!==h||e[37]!==M||e[38]!==P||e[39]!==C||e[40]!==D||e[41]!==N||e[42]!==m?(H=x?s.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Your payment link is ready. Click below to complete the purchase. You'll be redirected back here after payment."}),s.jsx(te,{asChild:!0,className:"gap-2",children:s.jsxs("a",{href:x,children:[s.jsx(ft,{size:15}),"Complete Payment"]})})]}):s.jsxs("div",{className:"flex flex-col gap-5 pt-2",children:[s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx(Se,{className:"text-xs text-muted-foreground",children:F}),s.jsx("div",{className:"grid grid-cols-5 gap-2",children:ti.map(q=>s.jsxs("button",{type:"button",onClick:()=>{c(q),u("")},className:ue("rounded-md border px-3 py-2 text-sm font-medium transition-colors",m===q?"border-primary bg-primary/10 text-primary":"border-border hover:bg-muted"),children:["$",q]},q))})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Se,{htmlFor:"custom-amount",className:"text-xs text-muted-foreground",children:C?"Or enter the exact new limit":"Or enter a custom amount"}),s.jsxs("div",{className:"relative",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"$"}),s.jsx(ve,{id:"custom-amount",type:"number",min:"0.01",step:"0.01",placeholder:"0.00",className:"pl-7",value:f,onChange:q=>{u(q.target.value),c(null)}})]})]}),C&&s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx(Se,{className:"text-xs text-muted-foreground",children:"Reset period"}),s.jsx("div",{className:"grid grid-cols-4 gap-2",children:si.map(q=>{const{value:le,label:re}=q;return s.jsx("button",{type:"button",onClick:()=>w(le),className:ue("rounded-md border px-2 py-2 text-xs font-medium transition-colors",N===le?"border-primary bg-primary/10 text-primary":"border-border hover:bg-muted"),children:re},le)})})]}),h&&s.jsx("p",{className:"text-xs text-destructive",children:h}),s.jsxs("div",{className:"flex items-center justify-between pt-1",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:C?s.jsxs(s.Fragment,{children:["Current limit:"," ",s.jsx("span",{className:"font-medium text-foreground",children:r>0?Q(r):"none"})]}):s.jsxs(s.Fragment,{children:["Current limit:"," ",s.jsx("span",{className:"font-medium text-foreground",children:Q(r)})]})}),s.jsx(te,{onClick:M,disabled:P||!I||I<=0||D,className:"gap-2",children:P?"Updating...":W})]})]}),e[30]=F,e[31]=x,e[32]=W,e[33]=r,e[34]=f,e[35]=I,e[36]=h,e[37]=M,e[38]=P,e[39]=C,e[40]=D,e[41]=N,e[42]=m,e[43]=H):H=e[43];let J;e[44]!==Y||e[45]!==H?(J=s.jsxs(qt,{className:"sm:max-w-md",children:[Y,H]}),e[44]=Y,e[45]=H,e[46]=J):J=e[46];let ne;return e[47]!==O||e[48]!==n||e[49]!==J?(ne=s.jsx(Yt,{open:n,onOpenChange:O,children:J}),e[47]=O,e[48]=n,e[49]=J,e[50]=ne):ne=e[50],ne}function li(t){const e=z.c(22),{estimation:n}=t;if(!n)return null;const{estimatedDaysRemaining:l,estimatedDepletionDate:i,avgDailySpend:r}=n;if(l==null)return null;let a;e[0]!==i?(a=i?new Date(i).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null,e[0]=i,e[1]=a):a=e[1];const o=a,d=l!==1?"s":"";let m;e[2]!==l||e[3]!==d?(m=s.jsxs("span",{className:"tabular-nums font-medium text-foreground",children:["~",l," day",d," ","remaining"]}),e[2]=l,e[3]=d,e[4]=m):m=e[4];let c;e[5]!==o?(c=o&&s.jsxs("span",{children:["(until ",o,")"]}),e[5]=o,e[6]=c):c=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx("span",{className:"text-muted-foreground/60",children:"|"}),e[7]=f):f=e[7];let u;e[8]!==r?(u=Q(r),e[8]=r,e[9]=u):u=e[9];let x;e[10]!==u?(x=s.jsxs("span",{className:"tabular-nums",children:["avg ",u,"/day"]}),e[10]=u,e[11]=x):x=e[11];let p;e[12]!==n.resetsBeforeDepletion?(p=n.resetsBeforeDepletion&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-muted-foreground/60",children:"|"}),s.jsx("span",{className:"text-green-600 dark:text-green-400",children:"Resets before depletion"})]}),e[12]=n.resetsBeforeDepletion,e[13]=p):p=e[13];const h=Zr[n.confidence];let g;e[14]!==h?(g=s.jsx(vl,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-4 font-normal",children:h}),e[14]=h,e[15]=g):g=e[15];let N;return e[16]!==g||e[17]!==m||e[18]!==c||e[19]!==x||e[20]!==p?(N=s.jsxs("div",{className:"mt-3 flex items-center gap-2 flex-wrap text-xs text-muted-foreground",children:[m,c,f,x,p,g]}),e[16]=g,e[17]=m,e[18]=c,e[19]=x,e[20]=p,e[21]=N):N=e[21],N}function ri(t){const e=z.c(37),{usage:n,limit:l,limitPeriod:i,onConfigureLimit:r,connectionId:a,alert:o}=t,d=l.total!=null&&l.total>0;let m;e[0]!==d||e[1]!==l.remaining||e[2]!==l.total?(m=d?Math.min(100,Math.round((l.total-(l.remaining??0))/l.total*100)):null,e[0]=d,e[1]=l.remaining,e[2]=l.total,e[3]=m):m=e[3];const c=m;let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Spending"}),s.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"· Deco AI Gateway"})]}),e[4]=f):f=e[4];let u;e[5]!==n.total?(u=Q(n.total),e[5]=n.total,e[6]=u):u=e[6];let x;e[7]!==u?(x=s.jsx("p",{className:"text-3xl font-bold tabular-nums text-foreground tracking-tight",children:u}),e[7]=u,e[8]=x):x=e[8];let p;e[9]!==d||e[10]!==l.total||e[11]!==i?(p=d&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["of ",Q(l.total)," limit",i&&s.jsxs("span",{className:"ml-1.5 inline-flex items-center gap-1",children:[s.jsx(Nl,{size:10}),ei[i]]})]}),e[9]=d,e[10]=l.total,e[11]=i,e[12]=p):p=e[12];let h;e[13]!==d?(h=!d&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"No limit configured"}),e[13]=d,e[14]=h):h=e[14];let g;e[15]!==x||e[16]!==p||e[17]!==h?(g=s.jsxs("div",{className:"flex flex-col gap-1",children:[f,x,p,h]}),e[15]=x,e[16]=p,e[17]=h,e[18]=g):g=e[18];let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(xt,{size:16}),e[19]=N):N=e[19];const w=d?"Configure Limit":"Set Limit";let _;e[20]!==r||e[21]!==w?(_=s.jsxs(te,{onClick:r,variant:"outline",className:"gap-2",children:[N,w]}),e[20]=r,e[21]=w,e[22]=_):_=e[22];let b;e[23]!==_||e[24]!==g?(b=s.jsxs("div",{className:"flex items-center justify-between",children:[g,_]}),e[23]=_,e[24]=g,e[25]=b):b=e[25];let v;e[26]!==d||e[27]!==l.reset||e[28]!==c?(v=d&&c!=null&&s.jsxs("div",{className:"mt-4",children:[s.jsx("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:s.jsx("div",{className:ue("h-full rounded-full transition-all",c>=90?"bg-destructive":c>=70?"bg-amber-500":"bg-primary"),style:{width:`${c}%`}})}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[c,"% used",l.reset&&s.jsxs("span",{className:"ml-2",children:["· resets ",l.reset]})]})]}),e[26]=d,e[27]=l.reset,e[28]=c,e[29]=v):v=e[29];let S;e[30]!==o||e[31]!==a?(S=s.jsx(Ds,{connectionId:a,alert:o,billingMode:"postpaid"}),e[30]=o,e[31]=a,e[32]=S):S=e[32];let P;return e[33]!==b||e[34]!==v||e[35]!==S?(P=s.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-border bg-gradient-to-br from-card via-card to-muted/30 p-6",children:[b,v,S]}),e[33]=b,e[34]=v,e[35]=S,e[36]=P):P=e[36],P}function ii(t){const e=z.c(30),{available:n,total:l,estimation:i,onAddCredit:r,connectionId:a,alert:o}=t,d=l>0?Math.max(0,Math.min(100,(l-n)/l*100)):0;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Available Credit"}),s.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"· Deco AI Gateway"})]}),e[0]=m):m=e[0];let c;e[1]!==n?(c=Q(n),e[1]=n,e[2]=c):c=e[2];let f;e[3]!==c?(f=s.jsx("p",{className:"text-3xl font-bold tabular-nums text-foreground tracking-tight",children:c}),e[3]=c,e[4]=f):f=e[4];let u;e[5]!==l?(u=l>0&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["of ",Q(l)," total"]}),e[5]=l,e[6]=u):u=e[6];let x;e[7]!==f||e[8]!==u?(x=s.jsxs("div",{className:"flex flex-col gap-1",children:[m,f,u]}),e[7]=f,e[8]=u,e[9]=x):x=e[9];let p;e[10]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(xt,{size:16}),e[10]=p):p=e[10];let h;e[11]!==r?(h=s.jsxs(te,{onClick:r,className:"gap-2 px-5",children:[p,"Add Credit"]}),e[11]=r,e[12]=h):h=e[12];let g;e[13]!==x||e[14]!==h?(g=s.jsxs("div",{className:"flex items-center justify-between",children:[x,h]}),e[13]=x,e[14]=h,e[15]=g):g=e[15];let N;e[16]!==n||e[17]!==l||e[18]!==d?(N=l>0&&s.jsxs("div",{className:"mt-4",children:[s.jsx("div",{className:"h-1.5 w-full rounded-full bg-muted overflow-hidden",children:s.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${d}%`}})}),s.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[Q(Math.max(0,l-n))," used"]})]}),e[16]=n,e[17]=l,e[18]=d,e[19]=N):N=e[19];let w;e[20]!==i?(w=s.jsx(li,{estimation:i}),e[20]=i,e[21]=w):w=e[21];let _;e[22]!==o||e[23]!==a?(_=s.jsx(Ds,{connectionId:a,alert:o,billingMode:"prepaid"}),e[22]=o,e[23]=a,e[24]=_):_=e[24];let b;return e[25]!==w||e[26]!==_||e[27]!==g||e[28]!==N?(b=s.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-border bg-gradient-to-br from-card via-card to-muted/30 p-6",children:[g,N,w,_]}),e[25]=w,e[26]=_,e[27]=g,e[28]=N,e[29]=b):b=e[29],b}function Ds(t){const e=z.c(78),{connectionId:n,alert:l,billingMode:i}=t,{org:r}=oe(),[a,o]=j.useState(!1),[d,m]=j.useState(l.enabled),[c,f]=j.useState(String(l.threshold_usd)),[u,x]=j.useState(l.email??""),[p,h]=j.useState(!1),[g,N]=j.useState(null);let w;e[0]!==n||e[1]!==r.id?(w={connectionId:n,orgId:r.id},e[0]=n,e[1]=r.id,e[2]=w):w=e[2];const _=he(w);let b;e[3]!==_?(b={client:_},e[3]=_,e[4]=b):b=e[4];const{mutate:v,isPending:S}=hs(b),P=d!==l.enabled||c!==String(l.threshold_usd)||u!==(l.email??"");let y;e[5]!==u||e[6]!==d||e[7]!==v||e[8]!==c?(y=()=>{N(null),h(!1);const X=parseFloat(c);if(d&&(!u||!u.includes("@"))){N("A valid email is required to enable alerts.");return}if(Number.isNaN(X)||X<=0){N("Threshold must be a positive number.");return}v({name:"GATEWAY_SET_ALERT",arguments:{enabled:d,threshold_usd:X,...u?{email:u}:{}}},{onSuccess:()=>{h(!0),setTimeout(()=>h(!1),3e3)},onError:we=>{N(we.message??"Failed to save alert config.")}})},e[5]=u,e[6]=d,e[7]=v,e[8]=c,e[9]=y):y=e[9];const C=y,k=i==="postpaid"?"Usage Alert":"Low-Balance Alert",A=i==="postpaid"?"Get notified when spending reaches a threshold":"Get notified when credit drops below a threshold";if(!a){let X;e[10]===Symbol.for("react.memo_cache_sentinel")?(X=()=>o(!0),e[10]=X):X=e[10];let we;e[11]===Symbol.for("react.memo_cache_sentinel")?(we=s.jsx("div",{className:"flex items-center justify-center size-7 rounded-md bg-muted shrink-0",children:s.jsx(jl,{size:14,className:"text-muted-foreground"})}),e[11]=we):we=e[11];let _e;e[12]!==k?(_e=s.jsx("p",{className:"text-xs font-medium text-foreground",children:k}),e[12]=k,e[13]=_e):_e=e[13];let Pe;e[14]!==l.enabled||e[15]!==l.threshold_usd||e[16]!==i?(Pe=l.enabled?i==="postpaid"?`Enabled · Alert at ${Q(l.threshold_usd)}`:`Enabled · Alert below ${Q(l.threshold_usd)}`:i==="postpaid"?"Get notified before your spending limit runs out":"Get notified before your credit balance runs out",e[14]=l.enabled,e[15]=l.threshold_usd,e[16]=i,e[17]=Pe):Pe=e[17];let ke;e[18]!==Pe?(ke=s.jsx("p",{className:"text-[11px] text-muted-foreground",children:Pe}),e[18]=Pe,e[19]=ke):ke=e[19];let Ae;e[20]!==_e||e[21]!==ke?(Ae=s.jsxs("div",{className:"flex-1 min-w-0",children:[_e,ke]}),e[20]=_e,e[21]=ke,e[22]=Ae):Ae=e[22];let Ie;e[23]!==l.enabled?(Ie=l.enabled&&s.jsx("span",{className:"shrink-0 rounded-full bg-green-500/15 px-2 py-0.5 text-[10px] font-medium text-green-600 dark:text-green-400",children:"On"}),e[23]=l.enabled,e[24]=Ie):Ie=e[24];let We;return e[25]!==Ie||e[26]!==Ae?(We=s.jsxs("button",{type:"button",onClick:X,className:"mt-4 flex items-center gap-3 rounded-lg border border-dashed border-border/60 px-4 py-3 w-full text-left transition-colors hover:bg-muted/50 hover:border-border",children:[we,Ae,Ie]}),e[25]=Ie,e[26]=Ae,e[27]=We):We=e[27],We}let I;e[28]!==k?(I=s.jsx("p",{className:"text-xs font-medium text-foreground",children:k}),e[28]=k,e[29]=I):I=e[29];let E;e[30]!==A?(E=s.jsx("p",{className:"text-[11px] text-muted-foreground",children:A}),e[30]=A,e[31]=E):E=e[31];let D;e[32]!==I||e[33]!==E?(D=s.jsxs("div",{children:[I,E]}),e[32]=I,e[33]=E,e[34]=D):D=e[34];let L;e[35]!==d?(L=s.jsx(Re,{checked:d,onCheckedChange:m}),e[35]=d,e[36]=L):L=e[36];let $;e[37]!==D||e[38]!==L?($=s.jsxs("div",{className:"flex items-center justify-between",children:[D,L]}),e[37]=D,e[38]=L,e[39]=$):$=e[39];const R=!d&&"opacity-50 pointer-events-none";let T;e[40]!==R?(T=ue("flex flex-col gap-3 transition-opacity",R),e[40]=R,e[41]=T):T=e[41];const O=i==="postpaid"?"Notify at":"Notify below";let M;e[42]!==O?(M=s.jsx(Se,{htmlFor:"alert-threshold",className:"text-[11px] text-muted-foreground",children:O}),e[42]=O,e[43]=M):M=e[43];let G;e[44]===Symbol.for("react.memo_cache_sentinel")?(G=s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"$"}),e[44]=G):G=e[44];let U;e[45]===Symbol.for("react.memo_cache_sentinel")?(U=X=>f(X.target.value),e[45]=U):U=e[45];let F;e[46]!==c?(F=s.jsxs("div",{className:"relative",children:[G,s.jsx(ve,{id:"alert-threshold",type:"number",min:"1",step:"1",className:"h-8 pl-7 text-xs",value:c,onChange:U})]}),e[46]=c,e[47]=F):F=e[47];let W;e[48]!==M||e[49]!==F?(W=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[M,F]}),e[48]=M,e[49]=F,e[50]=W):W=e[50];let K;e[51]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Se,{htmlFor:"alert-email",className:"text-[11px] text-muted-foreground",children:"Notification email"}),e[51]=K):K=e[51];let V;e[52]===Symbol.for("react.memo_cache_sentinel")?(V=X=>x(X.target.value),e[52]=V):V=e[52];let Y;e[53]!==u?(Y=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[K,s.jsx(ve,{id:"alert-email",type:"email",placeholder:"you@example.com",className:"h-8 text-xs",value:u,onChange:V})]}),e[53]=u,e[54]=Y):Y=e[54];let H;e[55]!==W||e[56]!==Y?(H=s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[W,Y]}),e[55]=W,e[56]=Y,e[57]=H):H=e[57];let J;e[58]!==g?(J=g&&s.jsx("p",{className:"text-[11px] text-destructive",children:g}),e[58]=g,e[59]=J):J=e[59];let ne;e[60]!==T||e[61]!==H||e[62]!==J?(ne=s.jsxs("div",{className:T,children:[H,J]}),e[60]=T,e[61]=H,e[62]=J,e[63]=ne):ne=e[63];let q;e[64]!==p?(q=p&&s.jsx("span",{className:"text-[11px] text-green-600 dark:text-green-400",children:"Saved"}),e[64]=p,e[65]=q):q=e[65];let le;e[66]===Symbol.for("react.memo_cache_sentinel")?(le=s.jsx(te,{size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:()=>o(!1),children:"Cancel"}),e[66]=le):le=e[66];const re=S||!P,se=S?"Saving...":"Save Alert";let ie;e[67]!==C||e[68]!==re||e[69]!==se?(ie=s.jsx(te,{size:"sm",className:"h-7 text-xs",onClick:C,disabled:re,children:se}),e[67]=C,e[68]=re,e[69]=se,e[70]=ie):ie=e[70];let me;e[71]!==q||e[72]!==ie?(me=s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[q,le,ie]}),e[71]=q,e[72]=ie,e[73]=me):me=e[73];let B;return e[74]!==ne||e[75]!==me||e[76]!==$?(B=s.jsxs("div",{className:"mt-4 flex flex-col gap-3 rounded-lg border border-border bg-muted/20 p-4",children:[$,ne,me]}),e[74]=ne,e[75]=me,e[76]=$,e[77]=B):B=e[77],B}const ai={cost:{label:"Cost",color:"var(--chart-1)"}};function oi(){const t=z.c(54),{org:e}=oe(),[n,l]=j.useState("30d");let i;t[0]!==n?(i=bt(n),t[0]=n,t[1]=i):i=t[1];const r=i;let a;t[2]!==e.id?(a={connectionId:Be,orgId:e.id},t[2]=e.id,t[3]=a):a=t[3];const o=he(a);let d;t[4]===Symbol.for("react.memo_cache_sentinel")?(d={type:"timeseries",source:{path:ze,from:"output"},aggregation:{fn:"sum",interval:"1d"}},t[4]=d):d=t[4];let m;t[5]!==r?(m={widget:d,timeRange:r},t[5]=r,t[6]=m):m=t[6];let c;t[7]!==o||t[8]!==m?(c={client:o,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:m,staleTime:6e4,select:$e},t[7]=o,t[8]=m,t[9]=c):c=t[9];const{data:f}=de(c);let u;t[10]===Symbol.for("react.memo_cache_sentinel")?(u={type:"metric",source:{path:ze,from:"output"},aggregation:{fn:"count_all"}},t[10]=u):u=t[10];let x;t[11]!==r?(x={widget:u,timeRange:r},t[11]=r,t[12]=x):x=t[12];let p;t[13]!==o||t[14]!==x?(p={client:o,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:x,staleTime:6e4,select:$e},t[13]=o,t[14]=x,t[15]=p):p=t[15];const{data:h}=de(p);let g;t[16]===Symbol.for("react.memo_cache_sentinel")?(g={type:"metric",source:{path:ze,from:"output"},aggregation:{fn:"sum",groupByColumn:"connection_title"}},t[16]=g):g=t[16];let N;t[17]!==r?(N={widget:g,timeRange:r},t[17]=r,t[18]=N):N=t[18];let w;t[19]!==o||t[20]!==N?(w={client:o,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:N,staleTime:6e4,select:$e},t[19]=o,t[20]=N,t[21]=w):w=t[21];const{data:_}=de(w);let b;t[22]!==f?.timeseries?(b=f?.timeseries??[],t[22]=f?.timeseries,t[23]=b):b=t[23];let v;t[24]!==b?(v=b.map(xi),t[24]=b,t[25]=v):v=t[25];const S=v;let P;if(t[26]!==h?.value||t[27]!==S||t[28]!==_?.groups||t[29]!==f?.timeseries||t[30]!==n){const y=(f?.timeseries??[]).reduce(fi,0),C=h?.value??0,k=(_?.groups??[]).filter(mi).sort(ui).slice(0,5),A=n==="7d"?"last 7 days":n==="30d"?"last 30 days":"last 90 days";let I;t[32]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Usage"}),t[32]=I):I=t[32];const E=Q(y);let D;t[33]!==E?(D=s.jsx("p",{className:"text-2xl font-bold tabular-nums text-foreground tracking-tight",children:E}),t[33]=E,t[34]=D):D=t[34];let L;t[35]!==A?(L=s.jsx("p",{className:"text-xs text-muted-foreground",children:A}),t[35]=A,t[36]=L):L=t[36];let $;t[37]!==D||t[38]!==L?($=s.jsxs("div",{className:"flex items-baseline gap-2",children:[D,L]}),t[37]=D,t[38]=L,t[39]=$):$=t[39];let R;t[40]!==C?(R=C.toLocaleString(),t[40]=C,t[41]=R):R=t[41];let T;t[42]!==R?(T=s.jsxs("p",{className:"text-xs text-muted-foreground tabular-nums",children:[R," tool calls"]}),t[42]=R,t[43]=T):T=t[43];let O;t[44]!==$||t[45]!==T?(O=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[I,$,T]}),t[44]=$,t[45]=T,t[46]=O):O=t[46];let M;t[47]!==n?(M=s.jsx(Ts,{period:n,onPeriodChange:l}),t[47]=n,t[48]=M):M=t[48];let G;t[49]!==O||t[50]!==M?(G=s.jsxs("div",{className:"flex items-center justify-between",children:[O,M]}),t[49]=O,t[50]=M,t[51]=G):G=t[51];let U;t[52]!==S?(U=S.length>0?s.jsx(xl,{config:ai,className:"h-[200px] w-full",children:s.jsxs(Qr,{data:S,margin:{top:4,right:4,bottom:0,left:0},children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:"fillCost",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"5%",stopColor:"var(--color-cost)",stopOpacity:.3}),s.jsx("stop",{offset:"95%",stopColor:"var(--color-cost)",stopOpacity:0})]})}),s.jsx(js,{vertical:!1,strokeDasharray:"3 3"}),s.jsx(pl,{dataKey:"date",tickLine:!1,axisLine:!1,tickMargin:8,fontSize:11,interval:"preserveStartEnd"}),s.jsx(Es,{tickLine:!1,axisLine:!1,tickMargin:4,fontSize:11,tickFormatter:di}),s.jsx(hl,{content:s.jsx(gl,{formatter:ci})}),s.jsx(Is,{type:"monotone",dataKey:"cost",stroke:"var(--color-cost)",fill:"url(#fillCost)",strokeWidth:2})]})}):s.jsx("div",{className:"h-[200px] flex items-center justify-center text-xs text-muted-foreground",children:"No usage data available for this period"}),t[52]=S,t[53]=U):U=t[53],P=s.jsxs("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-5",children:[G,U,k.length>0&&s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Cost by Connection"}),s.jsx("div",{className:"flex flex-col gap-1.5",children:k.map((F,W)=>{const K=y>0?Math.min(F.value/y*100,100):0;return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs text-foreground truncate min-w-0 w-36 shrink-0",children:F.key}),s.jsx("div",{className:"relative h-1.5 bg-muted/50 overflow-hidden flex-1 rounded-sm",children:s.jsx("div",{className:"h-full transition-all duration-500 ease-out rounded-sm",style:{width:`${K}%`,backgroundColor:`var(--chart-${W%5+1})`}})}),s.jsx("span",{className:"text-xs tabular-nums shrink-0 text-foreground font-medium",children:Q(F.value)})]},F.key)})})]})]}),t[26]=h?.value,t[27]=S,t[28]=_?.groups,t[29]=f?.timeseries,t[30]=n,t[31]=P}else P=t[31];return P}function ci(t){return Q(t)}function di(t){return`$${t}`}function ui(t,e){return e.value-t.value}function mi(t){return t.value>0}function fi(t,e){return t+e.value}function xi(t){return{date:new Date(t.timestamp).toLocaleDateString("en-US",{month:"short",day:"numeric"}),cost:t.value}}function pi(){const t=z.c(6),[e,n]=j.useState(Jr);let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=m=>{n(m),Xr(m)},t[0]=l):l=t[0];const i=l;let r,a;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Sidebar Display Period"}),a=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose which usage period is shown in the sidebar when no limit is set."}),t[1]=r,t[2]=a):(r=t[1],a=t[2]);let o;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=["daily","weekly","monthly"],t[3]=o):o=t[3];let d;return t[4]!==e?(d=s.jsxs("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-5",children:[r,a,s.jsx("div",{className:"flex gap-2 mt-1",children:o.map(m=>s.jsx("button",{type:"button",onClick:()=>i(m),className:ue("rounded-md border px-3 py-1.5 text-xs font-medium capitalize transition-colors",e===m?"border-primary bg-primary/10 text-primary":"border-border hover:bg-muted text-muted-foreground"),children:m},m))})]}),t[4]=e,t[5]=d):d=t[5],d}function lt(t){const e=z.c(20),{label:n,value:l,subValue:i,maxValue:r,color:a}=t,o=a===void 0?"bg-chart-1":a;let d;e[0]!==l?(d=parseFloat(l.replace(/[^0-9.]/g,""))||0,e[0]=l,e[1]=d):d=e[1];const m=d,c=r>0?Math.min(m/r*100,100):0;let f;e[2]!==n?(f=s.jsx("span",{className:"text-xs text-foreground truncate min-w-0 w-36 shrink-0",children:n}),e[2]=n,e[3]=f):f=e[3];let u;e[4]!==o?(u=ue("h-full transition-all duration-500 ease-out",o),e[4]=o,e[5]=u):u=e[5];const x=`${c}%`;let p;e[6]!==x?(p={width:x},e[6]=x,e[7]=p):p=e[7];let h;e[8]!==u||e[9]!==p?(h=s.jsx("div",{className:"relative h-2 bg-muted/50 overflow-hidden flex-1 rounded-sm",children:s.jsx("div",{className:u,style:p})}),e[8]=u,e[9]=p,e[10]=h):h=e[10];let g;e[11]!==l?(g=s.jsx("span",{className:"text-xs tabular-nums shrink-0 text-foreground font-medium",children:l}),e[11]=l,e[12]=g):g=e[12];let N;e[13]!==i?(N=i&&s.jsx("span",{className:"text-xs tabular-nums shrink-0 text-muted-foreground",children:i}),e[13]=i,e[14]=N):N=e[14];let w;return e[15]!==f||e[16]!==h||e[17]!==g||e[18]!==N?(w=s.jsxs("div",{className:"flex items-center gap-2",children:[f,h,g,N]}),e[15]=f,e[16]=h,e[17]=g,e[18]=N,e[19]=w):w=e[19],w}function rt(t){const e=z.c(8),{title:n,children:l,empty:i}=t;let r;e[0]!==n?(r=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:n}),e[0]=n,e[1]=r):r=e[1];let a;e[2]!==l||e[3]!==i?(a=i?s.jsx("p",{className:"text-xs text-muted-foreground py-4 text-center",children:"No data available for this period"}):l,e[2]=l,e[3]=i,e[4]=a):a=e[4];let o;return e[5]!==r||e[6]!==a?(o=s.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-5",children:[r,a]}),e[5]=r,e[6]=a,e[7]=o):o=e[7],o}const Bt={"7d":"7 days","30d":"30 days","90d":"90 days"};function Ts(t){const e=z.c(4),{period:n,onPeriodChange:l}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Object.keys(Bt),e[0]=i):i=e[0];let r;return e[1]!==l||e[2]!==n?(r=s.jsx("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5 self-start",children:i.map(a=>s.jsx("button",{type:"button",onClick:()=>l(a),className:ue("px-2.5 py-1 text-xs font-medium rounded-sm transition-colors",n===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:Bt[a]},a))}),e[1]=l,e[2]=n,e[3]=r):r=e[3],r}function Mt(t,e){const n=new Map(e.map(l=>[l.key,l.value]));return t.map(l=>({key:l.key,cost:l.value,calls:n.get(l.key)??0})).sort((l,i)=>i.cost-l.cost)}function hi(){const t=z.c(27),{org:e}=oe(),[n,l]=j.useState("30d"),i=bt(n),{data:r}=Sl(),a=r?.data?.members??[],o=new Map(a.map(Ni));let d;t[0]!==e.id?(d={connectionId:Be,orgId:e.id},t[0]=e.id,t[1]=d):d=t[1];const m=he(d),c=B=>({client:m,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:{widget:{type:"table",source:{path:ze,from:"output"},aggregation:{fn:B.fn,...B.groupByColumn&&{groupByColumn:B.groupByColumn}}},timeRange:i},staleTime:6e4,select:$e}),{data:f,isLoading:u}=de(c({fn:"sum",groupByColumn:"connection_title"})),{data:x,isLoading:p}=de(c({fn:"count_all",groupByColumn:"connection_title"})),{data:h,isLoading:g}=de(c({fn:"sum",groupByColumn:"user_id"})),{data:N,isLoading:w}=de(c({fn:"count_all",groupByColumn:"user_id"})),{data:_,isLoading:b}=de(c({fn:"sum",groupByColumn:"tool_name"}));let v;t[2]===Symbol.for("react.memo_cache_sentinel")?(v={fn:"count_all",groupByColumn:"tool_name"},t[2]=v):v=t[2];const{data:S,isLoading:P}=de(c(v));if(u||p||g||w||b||P){let B;t[3]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx(ae,{className:"h-8 w-48"}),t[3]=B):B=t[3];let X;return t[4]===Symbol.for("react.memo_cache_sentinel")?(X=s.jsxs("div",{className:"flex flex-col gap-4",children:[B,s.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:Array.from({length:3}).map(ji)})]}),t[4]=X):X=t[4],X}const C=Mt(f?.groups??[],x?.groups??[]),k=Mt(h?.groups??[],N?.groups??[]).map(B=>({...B,key:o.get(B.key)??B.key})),A=S?.groups??[],I=new Map((_?.groups??[]).map(bi)),E=A.map(B=>({name:B.key,calls:B.value,cost:I.get(B.key)??0})).sort(yi).slice(0,20),D=C.reduce(vi,0),L=C.reduce(gi,0),$=C[0]?.cost??1,R=k[0]?.cost??1,T=E[0]?.calls??1;let O;t[5]!==n?(O=s.jsx(Ts,{period:n,onPeriodChange:l}),t[5]=n,t[6]=O):O=t[6];const M="grid grid-cols-1 gap-4 sm:grid-cols-2",G=C.length===0,U=C.slice(0,8).map(B=>s.jsx(lt,{label:B.key,value:Q(B.cost),subValue:`${B.calls.toLocaleString()} calls`,maxValue:$,color:"bg-chart-1"},B.key));let F;t[7]!==U?(F=s.jsx("div",{className:"space-y-2.5",children:U}),t[7]=U,t[8]=F):F=t[8];let W;t[9]!==G||t[10]!==F?(W=s.jsx(rt,{title:"Cost by Connection",empty:G,children:F}),t[9]=G,t[10]=F,t[11]=W):W=t[11];const K=k.length===0,V=k.slice(0,8).map(B=>s.jsx(lt,{label:B.key,value:Q(B.cost),subValue:`${B.calls.toLocaleString()} calls`,maxValue:R,color:"bg-chart-4"},B.key));let Y;t[12]!==V?(Y=s.jsx("div",{className:"space-y-2.5",children:V}),t[12]=V,t[13]=Y):Y=t[13];let H;t[14]!==Y||t[15]!==K?(H=s.jsx(rt,{title:"Cost by User",empty:K,children:Y}),t[14]=Y,t[15]=K,t[16]=H):H=t[16];const J=rt,ne="Top Tools",q=E.length===0,le="space-y-2.5",re=E.slice(0,8).map(B=>s.jsx(lt,{label:B.name,value:B.calls.toLocaleString(),subValue:B.cost>0?Q(B.cost):void 0,maxValue:T,color:"bg-chart-3"},B.name));let se;t[17]!==re?(se=s.jsx("div",{className:le,children:re}),t[17]=re,t[18]=se):se=t[18];let ie;t[19]!==J||t[20]!==q||t[21]!==se?(ie=s.jsx(J,{title:ne,empty:q,children:se}),t[19]=J,t[20]=q,t[21]=se,t[22]=ie):ie=t[22];let me;return t[23]!==H||t[24]!==ie||t[25]!==W?(me=s.jsxs("div",{className:M,children:[W,H,ie]}),t[23]=H,t[24]=ie,t[25]=W,t[26]=me):me=t[26],s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex gap-4 text-sm",children:[s.jsxs("span",{className:"text-muted-foreground",children:["Total:"," ",s.jsx("span",{className:"font-semibold text-foreground",children:Q(D)})]}),s.jsxs("span",{className:"text-muted-foreground",children:["Calls:"," ",s.jsx("span",{className:"font-semibold text-foreground",children:L.toLocaleString()})]})]}),O]}),me]})}function gi(t,e){return t+e.calls}function vi(t,e){return t+e.cost}function yi(t,e){return e.calls-t.calls}function bi(t){return[t.key,t.value]}function ji(t,e){return s.jsx(ae,{className:"h-40 rounded-xl"},e)}function Ni(t){return[t.userId,t.user.name??t.user.email]}function Si(t,e){const n=new Map;for(const l of t){const r=new Date(l.timestamp).toLocaleDateString("en-US",{month:"short",year:"2-digit"}),a=n.get(r)??{cost:0,calls:0};n.set(r,{cost:a.cost+l.value,calls:a.calls})}for(const l of e){const r=new Date(l.timestamp).toLocaleDateString("en-US",{month:"short",year:"2-digit"}),a=n.get(r)??{cost:0,calls:0};n.set(r,{cost:a.cost,calls:a.calls+l.value})}return Array.from(n.entries()).map(([l,i])=>({month:l,...i})).reverse()}function Ci(){const t=z.c(27),{org:e}=oe();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=bt("90d"),t[0]=n):n=t[0];const l=n;let i;t[1]!==e.id?(i={connectionId:Be,orgId:e.id},t[1]=e.id,t[2]=i):i=t[2];const r=he(i);let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a={widget:{type:"timeseries",source:{path:ze,from:"output"},aggregation:{fn:"sum",interval:"1d"}},timeRange:l},t[3]=a):a=t[3];let o;t[4]!==r?(o={client:r,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:a,staleTime:6e4,select:$e},t[4]=r,t[5]=o):o=t[5];const{data:d,isLoading:m}=de(o);let c;t[6]===Symbol.for("react.memo_cache_sentinel")?(c={widget:{type:"timeseries",source:{path:ze,from:"output"},aggregation:{fn:"count_all",interval:"1d"}},timeRange:l},t[6]=c):c=t[6];let f;t[7]!==r?(f={client:r,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:c,staleTime:6e4,select:$e},t[7]=r,t[8]=f):f=t[8];const{data:u,isLoading:x}=de(f);if(m||x){let v;return t[9]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsx(ae,{className:"h-8 w-48"}),s.jsx(ae,{className:"h-48 rounded-xl"})]}),t[9]=v):v=t[9],v}let p,h,g,N,w;if(t[10]!==u?.timeseries||t[11]!==d?.timeseries){const v=Si(d?.timeseries??[],u?.timeseries??[]);w="flex flex-col gap-4",t[17]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Usage history from monitoring logs (last 90 days)"}),t[17]=p):p=t[17],h="flex flex-col gap-3 rounded-xl border border-border bg-card p-5",t[18]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Monthly Usage"}),t[18]=g):g=t[18],N=v.length===0?s.jsx("p",{className:"text-xs text-muted-foreground py-4 text-center",children:"No usage data available for this period"}):s.jsxs("div",{className:"w-full",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-x-4 pb-1.5 border-b border-border text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:[s.jsx("span",{children:"Month"}),s.jsx("span",{className:"text-right",children:"Cost"}),s.jsx("span",{className:"text-right",children:"Calls"})]}),s.jsx("div",{className:"divide-y divide-border",children:v.map(wi)})]}),t[10]=u?.timeseries,t[11]=d?.timeseries,t[12]=p,t[13]=h,t[14]=g,t[15]=N,t[16]=w}else p=t[12],h=t[13],g=t[14],N=t[15],w=t[16];let _;t[19]!==h||t[20]!==g||t[21]!==N?(_=s.jsxs("div",{className:h,children:[g,N]}),t[19]=h,t[20]=g,t[21]=N,t[22]=_):_=t[22];let b;return t[23]!==p||t[24]!==_||t[25]!==w?(b=s.jsxs("div",{className:w,children:[p,_]}),t[23]=p,t[24]=_,t[25]=w,t[26]=b):b=t[26],b}function wi(t){return s.jsxs("div",{className:"grid grid-cols-3 gap-x-4 py-2 text-xs",children:[s.jsx("span",{className:"text-foreground font-medium",children:t.month}),s.jsx("span",{className:"text-right tabular-nums text-foreground",children:Q(t.cost)}),s.jsx("span",{className:"text-right tabular-nums text-muted-foreground",children:t.calls.toLocaleString()})]},t.month)}function _i(t){const e=z.c(31),{connectionId:n}=t,{org:l}=oe(),[i,r]=j.useState(!1);let a;e[0]!==n||e[1]!==l.id?(a={connectionId:n,orgId:l.id},e[0]=n,e[1]=l.id,e[2]=a):a=e[2];const o=he(a);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d={},e[3]=d):d=e[3];let m;e[4]!==o?(m={client:o,toolName:"GATEWAY_USAGE",toolArguments:d,staleTime:3e4,select:Pi},e[4]=o,e[5]=m):m=e[5];const{data:c,isLoading:f}=de(m);if(f){let k;return e[6]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(ae,{className:"h-36 rounded-xl"}),e[6]=k):k=e[6],k}if(!c)return null;const u=c.limit.remaining??0,x=c.limit.total??0,p=c.usage,h=c.billing.mode,g=c.billing.limitPeriod??null,N=c.estimation??null;let w;e[7]!==c.alert?(w=c.alert??{enabled:!1,threshold_usd:10,email:null},e[7]=c.alert,e[8]=w):w=e[8];const _=w,b=c.limit,v=h==="postpaid"&&(x==null||x===0);let S;e[9]!==_||e[10]!==u||e[11]!==h||e[12]!==n||e[13]!==N||e[14]!==b||e[15]!==g||e[16]!==x||e[17]!==p?(S=h==="postpaid"?s.jsx(ri,{usage:p,limit:b,limitPeriod:g,onConfigureLimit:()=>r(!0),connectionId:n,alert:_}):s.jsx(ii,{available:u,total:x,estimation:N,onAddCredit:()=>r(!0),connectionId:n,alert:_}),e[9]=_,e[10]=u,e[11]=h,e[12]=n,e[13]=N,e[14]=b,e[15]=g,e[16]=x,e[17]=p,e[18]=S):S=e[18];let P;e[19]!==v?(P=v&&s.jsx(pi,{}),e[19]=v,e[20]=P):P=e[20];let y;e[21]!==h||e[22]!==n||e[23]!==i||e[24]!==g||e[25]!==x?(y=s.jsx(ni,{open:i,onOpenChange:r,connectionId:n,currentLimitUsd:x,billingMode:h,currentLimitPeriod:g}),e[21]=h,e[22]=n,e[23]=i,e[24]=g,e[25]=x,e[26]=y):y=e[26];let C;return e[27]!==S||e[28]!==P||e[29]!==y?(C=s.jsxs(s.Fragment,{children:[S,P,y]}),e[27]=S,e[28]=P,e[29]=y,e[30]=C):C=e[30],C}function Pi(t){return t.structuredContent}function ki(t){const e=z.c(11),{gatewayConnectionId:n}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Billing"}),e[0]=l):l=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsxs(yl,{variant:"underline",children:[s.jsx(tt,{value:"summary",variant:"underline",children:"Summary"}),s.jsx(tt,{value:"breakdown",variant:"underline",children:"Breakdown"}),s.jsx(tt,{value:"history",variant:"underline",children:"History"})]}),e[1]=i):i=e[1];let r;e[2]!==n?(r=n&&s.jsx(_i,{connectionId:n}),e[2]=n,e[3]=r):r=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(oi,{}),e[4]=a):a=e[4];let o;e[5]!==r?(o=s.jsxs(st,{value:"summary",className:"flex flex-col gap-4 pt-2",children:[r,a]}),e[5]=r,e[6]=o):o=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(st,{value:"breakdown",className:"pt-2",children:s.jsx(hi,{})}),e[7]=d):d=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(st,{value:"history",className:"pt-2",children:s.jsx(Ci,{})}),e[8]=m):m=e[8];let c;return e[9]!==o?(c=s.jsxs(s.Fragment,{children:[l,s.jsxs(bl,{defaultValue:"summary",variant:"underline",children:[i,o,d,m]})]}),e[9]=o,e[10]=c):c=e[10],c}function Ai(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsxs("div",{children:[s.jsx(ae,{className:"h-5 w-32"}),s.jsx(ae,{className:"h-4 w-64 mt-1.5"})]}),s.jsx(ae,{className:"h-28 rounded-xl"}),s.jsx(ae,{className:"h-[260px] rounded-lg"})]}),t[0]=e):e=t[0],e}function Ii(){const t=z.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Billing"}),t[0]=e):e=t[0];let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex items-center justify-center size-10 rounded-full bg-muted",children:s.jsx(ft,{size:20,className:"text-muted-foreground"})}),t[1]=n):n=t[1];let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"flex flex-col gap-6",children:[e,s.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 rounded-lg border border-dashed border-border",children:[n,s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Something went wrong"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-[300px]",children:"Unable to load billing data. Please try again later."})]})]})]}),t[2]=l):l=t[2],l}class Ei extends j.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,n){}render(){return this.state.hasError?s.jsx(Ii,{}):this.props.children}}function Oi(){const t=z.c(4),e=ns();let n;t[0]!==e?(n=e.find(Di),t[0]=e,t[1]=n):n=t[1];const i=n?.id??null;let r;return t[2]!==i?(r=s.jsx(ki,{gatewayConnectionId:i}),t[2]=i,t[3]=r):r=t[3],r}function Di(t){return ls(t,yn)}function Ti(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex flex-col gap-6",children:s.jsx(Ei,{children:s.jsx(j.Suspense,{fallback:s.jsx(Ai,{}),children:s.jsx(Oi,{})})})}),t[0]=e):e=t[0],e}function Ls(){const t=z.c(3);let e,n;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(ae,{className:"h-6 w-48"}),n=s.jsx(ae,{className:"h-4 w-80"}),t[0]=e,t[1]=n):(e=t[0],n=t[1]);let l;return t[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsxs("div",{className:"flex flex-col gap-4 pt-2",children:[e,n,s.jsxs("div",{className:"mt-4 flex flex-col gap-3",children:[s.jsx(ae,{className:"h-12 w-full"}),s.jsx(ae,{className:"h-12 w-full"})]})]}),t[2]=l):l=t[2],l}function Gt(t){const e=z.c(14),{projectSlug:n,children:l}=t,{org:i}=oe(),{data:r,isLoading:a}=Kt(i.id,n);if(a||!r){let f;return e[0]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Ls,{}),e[0]=f):f=e[0],f}const o=n===pe;let d;e[1]!==r.description||e[2]!==r.enabledPlugins||e[3]!==r.id||e[4]!==r.name||e[5]!==r.organizationId||e[6]!==r.slug||e[7]!==r.ui||e[8]!==o?(d={id:r.id,organizationId:r.organizationId,slug:r.slug,name:r.name,description:r.description,enabledPlugins:r.enabledPlugins,ui:r.ui,isOrgAdmin:o},e[1]=r.description,e[2]=r.enabledPlugins,e[3]=r.id,e[4]=r.name,e[5]=r.organizationId,e[6]=r.slug,e[7]=r.ui,e[8]=o,e[9]=d):d=e[9];const m=d;let c;return e[10]!==l||e[11]!==m||e[12]!==i?(c=s.jsx(Vt,{org:i,project:m,children:l}),e[10]=l,e[11]=m,e[12]=i,e[13]=c):c=e[13],c}function Li(t){const e=z.c(20),{section:n}=t;let l;e[0]!==n?(l=Qt(n),e[0]=n,e[1]=l):l=e[1];const i=l;if(i){let r;e[2]!==i.sub?(r=i.sub==="general"&&s.jsx(Fl,{}),e[2]=i.sub,e[3]=r):r=e[3];let a;e[4]!==i.sub?(a=i.sub==="plugins"&&s.jsx(Et,{}),e[4]=i.sub,e[5]=a):a=e[5];let o;e[6]!==i.sub?(o=i.sub==="danger"&&s.jsx(Hl,{}),e[6]=i.sub,e[7]=o):o=e[7];let d;return e[8]!==i.slug||e[9]!==r||e[10]!==a||e[11]!==o?(d=s.jsxs(Gt,{projectSlug:i.slug,children:[r,a,o]}),e[8]=i.slug,e[9]=r,e[10]=a,e[11]=o,e[12]=d):d=e[12],d}switch(n){case"account.profile":{let r;return e[13]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(kl,{}),e[13]=r):r=e[13],r}case"account.preferences":{let r;return e[14]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(kt,{}),e[14]=r):r=e[14],r}case"account.experimental":{let r;return e[15]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Dl,{}),e[15]=r):r=e[15],r}case"org.general":{let r;return e[16]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx($l,{}),e[16]=r):r=e[16],r}case"org.plugins":{let r;return e[17]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Gt,{projectSlug:pe,children:s.jsx(Et,{})}),e[17]=r):r=e[17],r}case"org.billing":{let r;return e[18]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Ti,{}),e[18]=r):r=e[18],r}default:{let r;return e[19]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(kt,{}),e[19]=r):r=e[19],r}}}function zi(){const t=z.c(23),{isOpen:e,activeSection:n,open:l,close:i}=Ks();let r;t[0]!==i?(r=g=>!g&&i(),t[0]=i,t[1]=r):r=t[1];let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"w-52 shrink-0 border-r border-border"}),t[2]=a):a=t[2];let o;t[3]!==n||t[4]!==l?(o=s.jsx(j.Suspense,{fallback:a,children:s.jsx(Pl,{activeSection:n,onNavigate:l})}),t[3]=n,t[4]=l,t[5]=o):o=t[5];let d,m;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ht,{size:16}),m=s.jsx("span",{className:"sr-only",children:"Close"}),t[6]=d,t[7]=m):(d=t[6],m=t[7]);let c;t[8]!==i?(c=s.jsxs("button",{type:"button",onClick:i,className:"sticky top-4 float-right mr-4 mt-4 z-10 rounded-md p-1 opacity-70 hover:opacity-100 transition-opacity focus:outline-none focus:ring-2 focus:ring-ring",children:[d,m]}),t[8]=i,t[9]=c):c=t[9];let f;t[10]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Ls,{}),t[10]=f):f=t[10];let u;t[11]!==n?(u=s.jsx("div",{className:"p-8 pt-0",children:s.jsx(j.Suspense,{fallback:f,children:s.jsx(Li,{section:n})})}),t[11]=n,t[12]=u):u=t[12];let x;t[13]!==c||t[14]!==u?(x=s.jsxs("div",{className:"flex-1 overflow-y-auto min-w-0 relative",children:[c,u]}),t[13]=c,t[14]=u,t[15]=x):x=t[15];let p;t[16]!==o||t[17]!==x?(p=s.jsx(qt,{className:"sm:max-w-[1100px] h-[85vh] p-0 overflow-hidden flex flex-col gap-0",closeButtonClassName:"hidden",children:s.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[o,x]})}),t[16]=o,t[17]=x,t[18]=p):p=t[18];let h;return t[19]!==e||t[20]!==r||t[21]!==p?(h=s.jsx(Yt,{open:e,onOpenChange:r,children:p}),t[19]=e,t[20]=r,t[21]=p,t[22]=h):h=t[22],h}function $i(t){const e=z.c(12),{projectSlug:n,orgSlug:l,error:i}=t,r=Ye();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("h1",{className:"text-xl font-semibold",children:"Failed to load project"}),e[0]=a):a=e[0];let o;e[1]!==n?(o=s.jsxs("p",{className:"text-muted-foreground text-center",children:['There was an error loading the project "',n,'".']}),e[1]=n,e[2]=o):o=e[2];let d;e[3]!==i.message?(d=s.jsx("p",{className:"text-sm text-muted-foreground",children:i.message}),e[3]=i.message,e[4]=d):d=e[4];let m;e[5]!==r||e[6]!==l?(m=s.jsx(te,{variant:"link",onClick:()=>r({to:"/$org/$project",params:{org:l,project:pe}}),children:"Go to organization home"}),e[5]=r,e[6]=l,e[7]=m):m=e[7];let c;return e[8]!==o||e[9]!==d||e[10]!==m?(c=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 p-8",children:[a,o,d,m]}),e[8]=o,e[9]=d,e[10]=m,e[11]=c):c=e[11],c}function Bi(t){const e=z.c(9),{projectSlug:n,orgSlug:l}=t,i=Ye();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("h1",{className:"text-xl font-semibold",children:"Project not found"}),e[0]=r):r=e[0];let a;e[1]!==n?(a=s.jsxs("p",{className:"text-muted-foreground text-center",children:['The project "',n,'" does not exist in this organization.']}),e[1]=n,e[2]=a):a=e[2];let o;e[3]!==i||e[4]!==l?(o=s.jsx(te,{variant:"link",onClick:()=>i({to:"/$org/$project",params:{org:l,project:pe}}),children:"Go to organization home"}),e[3]=i,e[4]=l,e[5]=o):o=e[5];let d;return e[6]!==a||e[7]!==o?(d=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 p-8",children:[r,a,o]}),e[6]=a,e[7]=o,e[8]=d):d=e[8],d}function Mi(){const t=z.c(23);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={strict:!1},t[0]=e):e=t[0];const n=Ms(e),{org:l}=oe(),i=n.org,r=n.project,{data:a,isLoading:o,error:d}=Kt(l.id,r);if(o){let h;return t[1]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(it,{}),t[1]=h):h=t[1],h}if(d){let h;return t[2]!==d||t[3]!==i||t[4]!==r?(h=s.jsx($i,{projectSlug:r,orgSlug:i,error:d}),t[2]=d,t[3]=i,t[4]=r,t[5]=h):h=t[5],h}if(!a){let h;return t[6]!==i||t[7]!==r?(h=s.jsx(Bi,{projectSlug:r,orgSlug:i}),t[6]=i,t[7]=r,t[8]=h):h=t[8],h}const m=a.slug===pe;let c;t[9]!==a.description||t[10]!==a.enabledPlugins||t[11]!==a.id||t[12]!==a.name||t[13]!==a.organizationId||t[14]!==a.slug||t[15]!==a.ui||t[16]!==m?(c={id:a.id,organizationId:a.organizationId,slug:a.slug,name:a.name,description:a.description,enabledPlugins:a.enabledPlugins,ui:a.ui,isOrgAdmin:m},t[9]=a.description,t[10]=a.enabledPlugins,t[11]=a.id,t[12]=a.name,t[13]=a.organizationId,t[14]=a.slug,t[15]=a.ui,t[16]=m,t[17]=c):c=t[17];const f=c;let u,x;t[18]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(j.Suspense,{fallback:s.jsx(it,{}),children:s.jsx(Gs,{})}),x=s.jsx(zi,{}),t[18]=u,t[19]=x):(u=t[18],x=t[19]);let p;return t[20]!==f||t[21]!==l?(p=s.jsxs(Vt,{org:l,project:f,children:[u,x]}),t[20]=f,t[21]=l,t[22]=p):p=t[22],p}function Ta(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(j.Suspense,{fallback:s.jsx(it,{}),children:s.jsx(Mi,{})}),t[0]=e):e=t[0],e}export{Ta as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b7 as U,c as
|
|
1
|
+
import{b7 as U,c as O,u as H,v as G,j as s,aE as M,r as I,b as V,B as R,O as q}from"./index-plkk4e_J.js";import{u as F}from"./use-project-DoeOF1FB.js";import{P as E}from"./index-0ocXQ777.js";import{E as T,C as J}from"./collection-search-CxUg-xAQ.js";import{A as K}from"./avatar-B9DZwrpo.js";import{f as Q}from"./formatDistanceToNow-Cb2QZZJn.js";import{C as W}from"./create-project-dialog-BWnYbbO8.js";import{B as X,a as Y,b as Z,c as ee}from"./breadcrumb-Zdkq43pK.js";import"./useQuery-D64ihcYY.js";import"./constants-CilfzTas.js";import"./use-mobile-DLdIzb3b.js";import"./X-tkzrbQVp.js";import"./tooltip-Bnw97WFs.js";import"./index-BHlJRTz3.js";import"./Loading01-CWvnRL6a.js";import"./SearchMd-TuCoj3FU.js";import"./input-CmqvOeLB.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./useMutation-D4nH_fUX.js";import"./dialog-iHT0i0tz.js";import"./form-BP7dMbdn.js";import"./label-bnFjyLyV.js";import"./textarea-D0tgU2KU.js";import"./Check-xLOyX88L.js";import"./ChevronRight-D_Ht_JRW.js";const te=U("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);function se(t){const e=O.c(58),{project:l,onSettingsClick:c}=t,{org:r}=H(),d=l.ui?.themeColor??"#60a5fa",b=l.ui?.bannerColor??d,m=l.ui?.banner?`url(${l.ui.banner})`:void 0;let i;e[0]!==b||e[1]!==m?(i={backgroundColor:b,backgroundImage:m,backgroundSize:"cover",backgroundPosition:"center"},e[0]=b,e[1]=m,e[2]=i):i=e[2];const _=i;let u;e[3]!==r.slug||e[4]!==l.slug?(u={org:r.slug,project:l.slug},e[3]=r.slug,e[4]=l.slug,e[5]=u):u=e[5];let f;e[6]!==c?(f=B=>{B.preventDefault(),B.stopPropagation(),c?.(B)},e[6]=c,e[7]=f):f=e[7];let x,v;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=G("absolute top-3 right-3 size-6 rounded-md flex items-center justify-center","bg-black/20 hover:bg-black/40 transition-colors","opacity-0 group-hover:opacity-100"),v=s.jsx(te,{className:"size-3.5 text-white"}),e[8]=x,e[9]=v):(x=e[8],v=e[9]);let g;e[10]!==f?(g=s.jsx("button",{type:"button",onClick:f,className:x,children:v}),e[10]=f,e[11]=g):g=e[11];let p;e[12]!==_||e[13]!==g?(p=s.jsx("div",{className:"h-20 relative",style:_,children:g}),e[12]=_,e[13]=g,e[14]=p):p=e[14];let n;e[15]!==l.name||e[16]!==l.ui||e[17]!==d?(n=l.ui?.icon?s.jsx("img",{src:l.ui.icon,alt:"",className:"size-8 rounded-md object-cover"}):s.jsx("div",{className:"size-8 rounded-md flex items-center justify-center",style:{backgroundColor:d},children:s.jsx("span",{className:"text-sm font-medium text-white",children:l.name.charAt(0).toUpperCase()})}),e[15]=l.name,e[16]=l.ui,e[17]=d,e[18]=n):n=e[18];let a;e[19]!==l.name?(a=s.jsx("h3",{className:"font-medium text-base text-foreground truncate",children:l.name}),e[19]=l.name,e[20]=a):a=e[20];let h;e[21]!==l.updatedAt?(h=Q(new Date(l.updatedAt),{addSuffix:!0}),e[21]=l.updatedAt,e[22]=h):h=e[22];let j;e[23]!==h?(j=s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Edited"," ",h]}),e[23]=h,e[24]=j):j=e[24];let C;e[25]!==a||e[26]!==j?(C=s.jsxs("div",{className:"flex flex-col",children:[a,j]}),e[25]=a,e[26]=j,e[27]=C):C=e[27];let N;e[28]!==n||e[29]!==C?(N=s.jsxs("div",{className:"flex flex-col gap-4",children:[n,C]}),e[28]=n,e[29]=C,e[30]=N):N=e[30];let k;e[31]!==l.boundConnections?(k=l.boundConnections.slice(0,4).map(le),e[31]=l.boundConnections,e[32]=k):k=e[32];let P;e[33]!==l.boundConnections.length?(P=l.boundConnections.length>4&&s.jsx("div",{className:"-mr-2 rounded-md border border-background",children:s.jsxs("div",{className:"size-6 rounded-md bg-background border border-black/10 shadow-sm flex items-center justify-center text-xs text-muted-foreground",children:["+",l.boundConnections.length-4]})}),e[33]=l.boundConnections.length,e[34]=P):P=e[34];let y;e[35]!==k||e[36]!==P?(y=s.jsxs("div",{className:"flex pr-2",children:[k,P]}),e[35]=k,e[36]=P,e[37]=y):y=e[37];const z=r.logo??void 0;let w;e[38]!==r.name||e[39]!==z?(w=s.jsx(K,{url:z,fallback:r.name,size:"2xs",className:"shrink-0 rounded",objectFit:"cover"}),e[38]=r.name,e[39]=z,e[40]=w):w=e[40];let S;e[41]!==r.name?(S=s.jsx("span",{className:"truncate max-w-20",children:r.name}),e[41]=r.name,e[42]=S):S=e[42];let o;e[43]!==w||e[44]!==S?(o=s.jsxs("div",{className:"flex items-center gap-2 text-xs text-foreground",children:[w,S]}),e[43]=w,e[44]=S,e[45]=o):o=e[45];let L;e[46]!==y||e[47]!==o?(L=s.jsxs("div",{className:"flex items-center justify-between mt-4",children:[y,o]}),e[46]=y,e[47]=o,e[48]=L):L=e[48];let $;e[49]!==N||e[50]!==L?($=s.jsxs("div",{className:"flex flex-col flex-1 justify-between p-4",children:[N,L]}),e[49]=N,e[50]=L,e[51]=$):$=e[51];let A;e[52]!==$||e[53]!==p?(A=s.jsxs("div",{className:"border border-border rounded-xl overflow-hidden bg-card",children:[p,$]}),e[52]=$,e[53]=p,e[54]=A):A=e[54];let D;return e[55]!==A||e[56]!==u?(D=s.jsx(M,{to:"/$org/$project",params:u,className:"block group",children:A}),e[55]=A,e[56]=u,e[57]=D):D=e[57],D}function le(t){return s.jsx("div",{className:"-mr-2 rounded-md border border-background",children:s.jsx(re,{connection:t})},t.id)}function re(t){const e=O.c(13),{connection:l}=t;if(l.icon){let m;e[0]!==l.icon||e[1]!==l.title?(m=s.jsx("img",{src:l.icon,alt:l.title,className:"size-4 object-cover"}),e[0]=l.icon,e[1]=l.title,e[2]=m):m=e[2];let i;return e[3]!==l.title||e[4]!==m?(i=s.jsx("div",{className:"size-6 rounded-md bg-background border border-black/10 shadow-sm flex items-center justify-center overflow-hidden",title:l.title,children:m}),e[3]=l.title,e[4]=m,e[5]=i):i=e[5],i}const c=l.title;let r;e[6]!==l.title?(r=l.title.charAt(0).toUpperCase(),e[6]=l.title,e[7]=r):r=e[7];let d;e[8]!==r?(d=s.jsx("span",{className:"text-[10px] text-muted-foreground font-medium",children:r}),e[8]=r,e[9]=d):d=e[9];let b;return e[10]!==l.title||e[11]!==d?(b=s.jsx("div",{className:"size-6 rounded-md bg-background border border-black/10 shadow-sm flex items-center justify-center overflow-hidden",title:c,children:d}),e[10]=l.title,e[11]=d,e[12]=b):b=e[12],b}function Ae(){const t=O.c(40),{org:e}=H(),{data:l,isLoading:c}=F(e.id),[r,d]=I.useState(""),[b,m]=I.useState(!1),i=V();let _,u,f,x,v,g,p,n,a;if(t[0]!==c||t[1]!==i||t[2]!==e.slug||t[3]!==l||t[4]!==r){const N=l?.filter(ie)?.filter(o=>o.name.toLowerCase().includes(r.toLowerCase())||o.description?.toLowerCase().includes(r.toLowerCase()))??[];let k;t[14]!==i||t[15]!==e.slug?(k=o=>{i({to:"/$org/$project/settings",params:{org:e.slug,project:o}})},t[14]=i,t[15]=e.slug,t[16]=k):k=t[16];const P=k;let y;t[17]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{m(!0)},t[17]=y):y=t[17];const z=y;u=E;let w;t[18]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(E.Header.Left,{children:s.jsx(X,{children:s.jsx(Y,{children:s.jsx(Z,{children:s.jsx(ee,{children:"Projects"})})})})}),t[18]=w):w=t[18],t[19]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs(E.Header,{children:[w,s.jsx(E.Header.Right,{children:s.jsx(R,{onClick:z,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Create new project"})})]}),t[19]=n):n=t[19];let S;t[20]===Symbol.for("react.memo_cache_sentinel")?(S=o=>{o.key==="Escape"&&(d(""),o.target.blur())},t[20]=S):S=t[20],t[21]!==r?(a=s.jsx(J,{value:r,onChange:d,placeholder:"Search for a project...",onKeyDown:S}),t[21]=r,t[22]=a):a=t[22],_=E.Content,f="@container",t[23]!==c?(x=c&&s.jsx("div",{className:"p-5",children:s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:[...Array(4)].map(oe)})}),t[23]=c,t[24]=x):x=t[24],v=!c&&N.length===0&&r&&s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(T,{title:"No projects found",description:`No projects match "${r}"`})}),g=!c&&N.length===0&&!r&&s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx(T,{title:"No projects yet",description:"Create a project to get started.",actions:s.jsx(R,{onClick:z,children:"Create new project"})})}),p=!c&&N.length>0&&s.jsx("div",{className:"p-5",children:s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:N.map(o=>s.jsx(se,{project:o,onSettingsClick:()=>P(o.slug)},o.id))})}),t[0]=c,t[1]=i,t[2]=e.slug,t[3]=l,t[4]=r,t[5]=_,t[6]=u,t[7]=f,t[8]=x,t[9]=v,t[10]=g,t[11]=p,t[12]=n,t[13]=a}else _=t[5],u=t[6],f=t[7],x=t[8],v=t[9],g=t[10],p=t[11],n=t[12],a=t[13];let h;t[25]!==_||t[26]!==f||t[27]!==x||t[28]!==v||t[29]!==g||t[30]!==p?(h=s.jsxs(_,{className:f,children:[x,v,g,p]}),t[25]=_,t[26]=f,t[27]=x,t[28]=v,t[29]=g,t[30]=p,t[31]=h):h=t[31];let j;t[32]!==b?(j=s.jsx(W,{open:b,onOpenChange:m}),t[32]=b,t[33]=j):j=t[33];let C;return t[34]!==u||t[35]!==n||t[36]!==a||t[37]!==h||t[38]!==j?(C=s.jsxs(u,{children:[n,a,h,j]}),t[34]=u,t[35]=n,t[36]=a,t[37]=h,t[38]=j,t[39]=C):C=t[39],C}function oe(t,e){return s.jsx("div",{className:"h-[240px] rounded-xl bg-muted animate-pulse"},e)}function ie(t){return t.slug!==q}export{Ae as default};
|