@decocms/mesh 2.128.0 → 2.128.2
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-Bi6qVvrN.js → AlertCircle-Ci70K_EZ.js} +1 -1
- package/dist/client/assets/{AlertOctagon-Fcp3y8nF.js → AlertOctagon-CqLqdISi.js} +1 -1
- package/dist/client/assets/{AlertTriangle-DFZ90wgN.js → AlertTriangle-D2guHjVq.js} +1 -1
- package/dist/client/assets/{ArrowDown-DADN3olT.js → ArrowDown-BB4lqZfQ.js} +1 -1
- package/dist/client/assets/{ArrowLeft-AtFbPu15.js → ArrowLeft-DOvB9XQA.js} +1 -1
- package/dist/client/assets/{ArrowUp-Cfyg5juo.js → ArrowUp-ByjI1wop.js} +1 -1
- package/dist/client/assets/{Check-Cm2iUQXG.js → Check-Dnxirgog.js} +1 -1
- package/dist/client/assets/{CheckCircle-DbniBHxr.js → CheckCircle-DNKireMY.js} +1 -1
- package/dist/client/assets/{CheckDone01-875P-Irn.js → CheckDone01-BQB-AnYZ.js} +1 -1
- package/dist/client/assets/{CheckVerified02-D6HcNS_s.js → CheckVerified02-I-XS300S.js} +1 -1
- package/dist/client/assets/{ChevronDown-BufhPURG.js → ChevronDown-DlCNAUXg.js} +1 -1
- package/dist/client/assets/{ChevronRight-Ddi-3F9S.js → ChevronRight-BjXZnVl8.js} +1 -1
- package/dist/client/assets/{Clock-Bvm7X8ou.js → Clock-CuTVdxgk.js} +1 -1
- package/dist/client/assets/{Code01-B6JRytqX.js → Code01-D62OImsE.js} +1 -1
- package/dist/client/assets/{Container-B3EmXRhZ.js → Container-NYiiZyd6.js} +1 -1
- package/dist/client/assets/{Copy01-B3XYrA0z.js → Copy01--WUANgtG.js} +1 -1
- package/dist/client/assets/{Dataflow03-Ca2mwTsX.js → Dataflow03-r1iydeQd.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-C7JLP9tS.js → DotsHorizontal-CIJOriRT.js} +1 -1
- package/dist/client/assets/{DotsVertical-CSadjG67.js → DotsVertical-CdVqSSOc.js} +1 -1
- package/dist/client/assets/{Download01--BNFvyry.js → Download01-CB8jg-CL.js} +1 -1
- package/dist/client/assets/{Edit01-DKSRjmBx.js → Edit01-DK-8NMEI.js} +1 -1
- package/dist/client/assets/{Eye-DOWXmHLb.js → Eye-broatAu7.js} +1 -1
- package/dist/client/assets/{File02-CbipvW6f.js → File02-D0NaH0bX.js} +1 -1
- package/dist/client/assets/{File06-Bcrb96z7.js → File06-WXzmRYLt.js} +1 -1
- package/dist/client/assets/{FilterLines-BY0QAs50.js → FilterLines-frJ-GsBz.js} +1 -1
- package/dist/client/assets/{Globe01-DL4AD3PJ.js → Globe01-VgVHGjyC.js} +1 -1
- package/dist/client/assets/{Globe02-YF4Iol6V.js → Globe02-C0qeWKnK.js} +1 -1
- package/dist/client/assets/{Grid01-DWFyhMlk.js → Grid01-Dyv_Ip5i.js} +1 -1
- package/dist/client/assets/{Hash02-lVbQabr3.js → Hash02-oBjA0qJC.js} +1 -1
- package/dist/client/assets/{Home02-CBgwN5B0.js → Home02-DX25irYw.js} +1 -1
- package/dist/client/assets/{Image01-BWp0soXg.js → Image01-Dv4Xx4Vn.js} +1 -1
- package/dist/client/assets/{Inbox01-DjPYutLV.js → Inbox01-Bh1zeW2m.js} +1 -1
- package/dist/client/assets/{InfoCircle-Ba_35fj3.js → InfoCircle-C7uLV_XX.js} +1 -1
- package/dist/client/assets/{Key01-DkL0Aa6F.js → Key01-DVkykkuH.js} +1 -1
- package/dist/client/assets/{LinkExternal01-B0dtroaL.js → LinkExternal01-D9NBeY0S.js} +1 -1
- package/dist/client/assets/{List-DvkRrNFX.js → List-C9ntvlpP.js} +1 -1
- package/dist/client/assets/{Loading01-Du7SSOFL.js → Loading01-D2eBBNoh.js} +1 -1
- package/dist/client/assets/{Lock01-B_Ca_7Fy.js → Lock01-ep_v0VnB.js} +1 -1
- package/dist/client/assets/{Play-DsN2Vu-9.js → Play-DfNy_KGK.js} +1 -1
- package/dist/client/assets/{Plus-GyEYmH7H.js → Plus-CoFNXdPs.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-CSeua2ip.js → RefreshCcw01-J5wqqeG_.js} +1 -1
- package/dist/client/assets/{RefreshCw01-BSAySLXB.js → RefreshCw01-CyeiQkso.js} +1 -1
- package/dist/client/assets/{Rows03-kYzPV04j.js → Rows03-D7jJRDVm.js} +1 -1
- package/dist/client/assets/{Save01-CoeneoQw.js → Save01-DCBihulA.js} +1 -1
- package/dist/client/assets/{SearchMd-CST_zdt_.js → SearchMd-WqvhRztL.js} +1 -1
- package/dist/client/assets/{Settings01-DAlQl5Hv.js → Settings01-CF0yl6Tz.js} +1 -1
- package/dist/client/assets/{Shield01-D18Lmcuo.js → Shield01-BVTU_rBf.js} +1 -1
- package/dist/client/assets/{Terminal-BoJXcgsb.js → Terminal-BWI5ji_M.js} +1 -1
- package/dist/client/assets/{Tool01-BqSsATCJ.js → Tool01-uNfJ4BgB.js} +1 -1
- package/dist/client/assets/{Trash01-DTBe8XH-.js → Trash01-Bilx6R4T.js} +1 -1
- package/dist/client/assets/{Upload01-TqbNCyR0.js → Upload01-yL5uy1IO.js} +1 -1
- package/dist/client/assets/{Users03-C58KX3if.js → Users03-ELQ8CczK.js} +1 -1
- package/dist/client/assets/{X-CiUv7JeK.js → X-DlPknjOM.js} +1 -1
- package/dist/client/assets/{XCircle-c-fGPkxr.js → XCircle-aBox2-uz.js} +1 -1
- package/dist/client/assets/{XClose-BOJUsKo6.js → XClose-Baiitjul.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-0VaJpHmY.js → agent-connections-preview-Dn72V1xG.js} +1 -1
- package/dist/client/assets/agent-detail-Dy29kukR.js +2 -0
- package/dist/client/assets/{agents-LlXNozr1.js → agents-KAvJ30x5.js} +1 -1
- package/dist/client/assets/{alert-dialog-W67uPDui.js → alert-dialog-DrmsJmsN.js} +3 -3
- package/dist/client/assets/{auth-catchall-B8ChPBfo.js → auth-catchall-DmQOOeQy.js} +1 -1
- package/dist/client/assets/{avatar-C22lLmXV.js → avatar-DjSt5kfT.js} +1 -1
- package/dist/client/assets/{badge-wZkXx6tq.js → badge-Dj7JdmaJ.js} +1 -1
- package/dist/client/assets/{binder-CO5VHJsz.js → binder--zY5y66H.js} +1 -1
- package/dist/client/assets/{breadcrumb-BlLFCMoF.js → breadcrumb-DmYstfbP.js} +1 -1
- package/dist/client/assets/{button-BShrPPQB.js → button-D10odSSz.js} +1 -1
- package/dist/client/assets/{card-BO4jLXoP.js → card-9y5GtFsZ.js} +1 -1
- package/dist/client/assets/{chart-DoLzE0dq.js → chart-Bp3LQrS9.js} +5 -5
- package/dist/client/assets/{checkbox-CJOukTQl.js → checkbox-D2YWMWVu.js} +1 -1
- package/dist/client/assets/{circle-alert-xgiobPeL.js → circle-alert-B7z6aEqV.js} +1 -1
- package/dist/client/assets/{collection-detail-BrigopIz.js → collection-detail-Nf6HLmBW.js} +1 -1
- package/dist/client/assets/{collection-search-epuaoKsC.js → collection-search-BAmI-gVt.js} +1 -1
- package/dist/client/assets/{collection-tab-BDHVvxwA.js → collection-tab-CQQXE46p.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BHfH8h7S.js → collection-table-wrapper-fcFg8ybt.js} +1 -1
- package/dist/client/assets/{collection-tabs-D_RAhYU-.js → collection-tabs-D2IJ4sD1.js} +1 -1
- package/dist/client/assets/{command-SkTjLnr0.js → command-BMl6YeZX.js} +1 -1
- package/dist/client/assets/{connect-CLzKNZX3.js → connect-ezzuoZk1.js} +1 -1
- package/dist/client/assets/{connection-card-Cs2JqhzD.js → connection-card-BPNLF3Zq.js} +1 -1
- package/dist/client/assets/{connection-detail-DXegMwIj.js → connection-detail-B931e97h.js} +1 -1
- package/dist/client/assets/{connections-UdkE9Odl.js → connections-Du--7tHh.js} +1 -1
- package/dist/client/assets/{constants-t4cYcaOj.js → constants-V7-3C38y.js} +1 -1
- package/dist/client/assets/constants-wwWYqq9s.js +1 -0
- package/dist/client/assets/context-BBfuJWes.js +23 -0
- package/dist/client/assets/{create-organization-dialog-C6fo5Hef.js → create-organization-dialog-3HZ9Fapi.js} +1 -1
- package/dist/client/assets/{create-project-dialog-DeWiYUJP.js → create-project-dialog-D87AirfP.js} +1 -1
- package/dist/client/assets/deco-constants-BmtTfZbQ.js +1 -0
- package/dist/client/assets/{dialog-DZ73hYD2.js → dialog-bLBl7se3.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BlYEF8_O.js → dropdown-menu-D6LMimH3.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-Cj_NN8Sa.js → dynamic-plugin-layout-Dl6SpfCc.js} +1 -1
- package/dist/client/assets/{editable-thread-title-CZzMY2v8.js → editable-thread-title-C5iprBiE.js} +1 -1
- package/dist/client/assets/{empty-state-Fw_Jw9KM.js → empty-state-CPu-zZBv.js} +1 -1
- package/dist/client/assets/{env-vars-editor-BfORkosV.js → env-vars-editor-DflzxmJb.js} +1 -1
- package/dist/client/assets/{error-boundary-B8Qhob-A.js → error-boundary-apRp8Xmr.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DsHfycl1.js → extract-connection-data-DyTSTIQR.js} +1 -1
- package/dist/client/assets/{file-browser-DdVjHr4m.js → file-browser-D4rvNQn-.js} +2 -2
- package/dist/client/assets/{form-C6Ox6-3I.js → form-CSWi3me2.js} +1 -1
- package/dist/client/assets/{grid-view-BHRg_Pme.js → grid-view-CIKn_gai.js} +1 -1
- package/dist/client/assets/{home-Du3a56yX.js → home-urEawFOR.js} +1 -1
- package/dist/client/assets/{index-ayuCOtc0.js → index-BpUpHsNU.js} +1 -1
- package/dist/client/assets/{index-bJmmgjqx.js → index-BsrQAmtK.js} +1 -1
- package/dist/client/assets/{index-BJmUOuV4.js → index-CI36RmtE.js} +1 -1
- package/dist/client/assets/index-CJXotA7N.css +1 -0
- package/dist/client/assets/{index-CV_imPUN.js → index-CW4zTmBX.js} +1 -1
- package/dist/client/assets/{index--aNT0bd8.js → index-CX1TvU3T.js} +1 -1
- package/dist/client/assets/{index-4ixjLWXM.js → index-DTB_8xm9.js} +56 -56
- package/dist/client/assets/index-h05RWZry.js +1 -0
- package/dist/client/assets/{index-BfJ-GPYf.js → index-kTXXfvC-.js} +1 -1
- package/dist/client/assets/{index-DGcrprcR.js → index-uOrjFt6t.js} +3 -3
- package/dist/client/assets/{infiniteQueryObserver-BxKDZ2ST.js → infiniteQueryObserver-DS9VDnBa.js} +1 -1
- package/dist/client/assets/{input-DvTN1BP6.js → input-C8Cn3OQt.js} +1 -1
- package/dist/client/assets/{integration-icon-CgBX_ks3.js → integration-icon-CHvqhFEd.js} +1 -1
- package/dist/client/assets/{label-qeOE7dIh.js → label-D84F6EwM.js} +1 -1
- package/dist/client/assets/{layout-odhQDxBs.js → layout-14xmCS52.js} +1 -1
- package/dist/client/assets/{localstorage-keys-BQX8_0BZ.js → localstorage-keys-r_mW6Lq0.js} +1 -1
- package/dist/client/assets/{login-GKelMg3g.js → login-D-_vmeEI.js} +1 -1
- package/dist/client/assets/{markdown-BhF_-YvH.js → markdown-BD6zDSJc.js} +1 -1
- package/dist/client/assets/{mcp-oauth-D01_ndal.js → mcp-oauth-CDj0bpnF.js} +1 -1
- package/dist/client/assets/{mcp-server-card-BHBeZkJo.js → mcp-server-card-B4JV-Q1h.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-BatwHSxN.js → mcp-server-detail-CsXpfhbo.js} +2 -2
- package/dist/client/assets/{members-rpOiHXHk.js → members-B0_Xg_uw.js} +1 -1
- package/dist/client/assets/{monitoring-CvC6-eq5.js → monitoring-FEHIw1jG.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-edit-DADoyJ7_.js → monitoring-dashboard-edit-D9Ku98yT.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-view-BWj6ZaV3.js → monitoring-dashboard-view-eE4UAi9y.js} +1 -1
- package/dist/client/assets/{oauth-callback-B5gL7lCI.js → oauth-callback-AmREHdz2.js} +1 -1
- package/dist/client/assets/page-383FaDV2.js +1 -0
- package/dist/client/assets/{page-C58nJ-Li.js → page-thqQ0ll8.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-X7uea6VR.js → plugin-empty-state-Bi8TKl0X.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-q2whEGVP.js → plugin-empty-state-OjZLLHuW.js} +1 -1
- package/dist/client/assets/{plugin-header-Ch-I_bTw.js → plugin-header-DqYSY5WD.js} +1 -1
- package/dist/client/assets/{plugin-header-C7DE0ct4.js → plugin-header-NOGbkpim.js} +1 -1
- package/dist/client/assets/{popover-Nu95EjX8.js → popover-B_SzRtKR.js} +1 -1
- package/dist/client/assets/{project-layout-DcWSPHT9.js → project-layout-DxcVceRu.js} +1 -1
- package/dist/client/assets/{projects-list-NJsuEVXb.js → projects-list-FULLceFc.js} +1 -1
- package/dist/client/assets/{ranking-layout-B5Zz2w8q.js → ranking-layout-B_B3SLxi.js} +1 -1
- package/dist/client/assets/{readme-viewer-Z343YQu7.js → readme-viewer-DAvIfvua.js} +1 -1
- package/dist/client/assets/{registry-layout-e-LPyvS8.js → registry-layout-BcVc2nNS.js} +1 -1
- package/dist/client/assets/{registry-utils-COvjQkiO.js → registry-utils-CwZm8daW.js} +1 -1
- package/dist/client/assets/{reports-layout-BCFMfUZH.js → reports-layout-Cb_9di8U.js} +1 -1
- package/dist/client/assets/{reset-password-BcvesDFp.js → reset-password-tNDIWT24.js} +1 -1
- package/dist/client/assets/{resizable-kfZDbkMy.js → resizable-BvPyhOvU.js} +1 -1
- package/dist/client/assets/{save-actions-Df_NW4BN.js → save-actions-DTbCJcwB.js} +1 -1
- package/dist/client/assets/{scroll-area-BJuQHCIp.js → scroll-area-BbTrJsHn.js} +4 -4
- package/dist/client/assets/{select-DQBmlhEf.js → select-BZB4uvGm.js} +1 -1
- package/dist/client/assets/{shell-layout-CH02Na8I.js → shell-layout-BHmLkMzR.js} +2 -2
- package/dist/client/assets/{skeleton-DQ8ccdHg.js → skeleton-B9aXeb5e.js} +1 -1
- package/dist/client/assets/{spinner-BX-oePRV.js → spinner-BeYA_hqO.js} +1 -1
- package/dist/client/assets/{store-invite-hqcnYITt.js → store-invite-CBtJIAbW.js} +1 -1
- package/dist/client/assets/{switch-DPh6dtI2.js → switch-CkEMQ9Z5.js} +1 -1
- package/dist/client/assets/{table-Dr59BlIZ.js → table-D_a-Z4Fv.js} +1 -1
- package/dist/client/assets/{tabs-Cai1peX-.js → tabs-Cqye-vZ-.js} +1 -1
- package/dist/client/assets/{tasks-CamivDB8.js → tasks-DbmObaDD.js} +1 -1
- package/dist/client/assets/{textarea-CMZ8dKCK.js → textarea-CLWsfk4l.js} +1 -1
- package/dist/client/assets/{time-range-picker-DI74vKx1.js → time-range-picker-jCfxVj6J.js} +1 -1
- package/dist/client/assets/{toggle-group-CwM-3IQt.js → toggle-group-BUoI214e.js} +1 -1
- package/dist/client/assets/{tools-list-B9j_bdvI.js → tools-list-jE6c8Z18.js} +1 -1
- package/dist/client/assets/{tooltip-B4YNhEm3.js → tooltip-CooOHv4u.js} +1 -1
- package/dist/client/assets/{topbar-portal-D-2YmoLb.js → topbar-portal-CjBmYjs5.js} +1 -1
- package/dist/client/assets/{types-B4eKYkCD.js → types-jYkZj_oN.js} +1 -1
- package/dist/client/assets/{use-binding-B4TEVgwJ.js → use-binding-9lQePXv2.js} +1 -1
- package/dist/client/assets/{use-connection-xUIwVn2H.js → use-connection-DqGqpr6W.js} +1 -1
- package/dist/client/assets/{use-copy-BUl6Sk74.js → use-copy-CvA2en_g.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-Cor7Xu1g.js → use-create-virtual-mcp-DJv6y6EJ.js} +1 -1
- package/dist/client/assets/{use-deco-chat-open-B8cuCwuQ.js → use-deco-chat-open-DeWcxP9f.js} +1 -1
- package/dist/client/assets/{use-install-from-registry-DlSusZM8.js → use-install-from-registry-iT6pKCDG.js} +1 -1
- package/dist/client/assets/{use-list-state-EBDuQbGr.js → use-list-state-0IvPs7yX.js} +1 -1
- package/dist/client/assets/{use-llm-CuiygiQa.js → use-llm-CDYsARAu.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-DaJitUnA.js → use-mcp-prompts-B9LoAxha.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CQfFVFT8.js → use-mcp-tools-DuTyW4Xm.js} +1 -1
- package/dist/client/assets/{use-members-CmtCKeEg.js → use-members-ByAHJbqb.js} +1 -1
- package/dist/client/assets/{use-mobile-D-DrP5e0.js → use-mobile-DA9mzCuy.js} +1 -1
- package/dist/client/assets/{use-project-kKLsM3W2.js → use-project-Cr1TKfdV.js} +1 -1
- package/dist/client/assets/use-settings-modal-DVxljFTz.js +1 -0
- package/dist/client/assets/{use-view-mode-DptZS1vf.js → use-view-mode-DJ9lvNoA.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-BpLVEDAn.js → use-virtual-mcp-B7YffSTv.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-D4-rTdBB.js +1 -0
- package/dist/client/assets/{useMutation-DDPkMzlm.js → useMutation-BYvhr9Wj.js} +1 -1
- package/dist/client/assets/useQuery-Vrc6Li_H.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-D3F1c8oY.js +1 -0
- package/dist/client/assets/{workflow-LLeHyMBS.js → workflow-CsBV4dNN.js} +1 -1
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/dist/client/assets/agent-detail-DfofQqg_.js +0 -2
- package/dist/client/assets/constants-BMvsKHXz.js +0 -1
- package/dist/client/assets/context-CADU4rSF.js +0 -23
- package/dist/client/assets/deco-constants-DwNVBkXd.js +0 -1
- package/dist/client/assets/index-CFFAW6El.js +0 -1
- package/dist/client/assets/index-Tb7qPLHt.css +0 -1
- package/dist/client/assets/page-DkE_PS55.js +0 -1
- package/dist/client/assets/use-settings-modal-Clf9xo0e.js +0 -1
- package/dist/client/assets/useInfiniteQuery-DLMQEeqg.js +0 -1
- package/dist/client/assets/useQuery-AhBFUcM2.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CuoTdKGU.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as j,c as z,d as ut,j as s,u as oe,O as pe,t as fe,_ as Ls,o as Rt,s as De,b as Ye,m as Re,l as Wt,k as Ut,K as xe,aF as Ze,c3 as zs,c1 as $s,b1 as Vt,P as Kt,S as it,e as Bs,aD as Ms}from"./index-DGcrprcR.js";import{u as Gs,a as qt}from"./use-project-kKLsM3W2.js";import{c as ue,B as te}from"./button-BShrPPQB.js";import{c as Fs,d as Rs,b as Ws,a as Yt,D as Ht}from"./dialog-DZ73hYD2.js";import{i as Qt}from"./X-CiUv7JeK.js";import{u as mt,S as ae}from"./skeleton-DQ8ccdHg.js";import{p as Xt,a as Nt,t as Us,u as Vs}from"./use-settings-modal-Clf9xo0e.js";import{A as Jt}from"./avatar-C22lLmXV.js";import{a as ft,i as Ks}from"./deco-constants-DwNVBkXd.js";import{t as Zt}from"./Settings01-DAlQl5Hv.js";import{a as qs,b as Ys,c as Hs,T as Qs}from"./tooltip-B4YNhEm3.js";import{i as Xs}from"./Check-Cm2iUQXG.js";import{a as Js}from"./Copy01-B3XYrA0z.js";import{S as Fe}from"./switch-DPh6dtI2.js";import{S as es,a as ts,d as Me,c as ss,b as Zs}from"./select-DQBmlhEf.js";import{i as en}from"./Code01-B6JRytqX.js";import{i as tn}from"./Shield01-D18Lmcuo.js";import{n as sn}from"./CheckDone01-875P-Irn.js";import{u as He}from"./useMutation-DDPkMzlm.js";import{a as ns,F as Te,b as ye,c as be,d as je,f as Le,e as at}from"./form-C6Ox6-3I.js";import{I as ve}from"./input-DvTN1BP6.js";import{i as nn}from"./Upload01-TqbNCyR0.js";import{a as Be,u as he,K as ln}from"./constants-t4cYcaOj.js";import{T as rn}from"./textarea-CMZ8dKCK.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-W67uPDui.js";import{u as hn}from"./useQuery-AhBFUcM2.js";import{L as Se}from"./label-qeOE7dIh.js";import{n as gn}from"./Container-B3EmXRhZ.js";import{h as ls}from"./use-connection-xUIwVn2H.js";import{a as vn,c as yn}from"./use-binding-B4TEVgwJ.js";import{u as bn}from"./use-install-from-registry-DlSusZM8.js";import{i as jn}from"./Loading01-Du7SSOFL.js";import{s as xt}from"./Plus-GyEYmH7H.js";import{u as Nn,a as Sn,b as Cn,i as ce,r as Qe,D as rs,c as Xe,d as ge,s as St,e as Ct,Z as is,g as as,f as os,h as cs,j as Ge,k as pt,l as Je,m as ht,n as wn,o as Pn,p as ds,q as gt,t as vt,v as us,w as _n,x as ms,y as wt,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 Fn,N as Rn,O as Ue,P as Wn,Q as Pt,T as _t,U as kt,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 Xn,a5 as Ve,a6 as Jn,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-DoLzE0dq.js";import{B as vl}from"./badge-wZkXx6tq.js";import{a as yl,T as tt,b as st,c as bl}from"./tabs-Cai1peX-.js";import{i as jl}from"./AlertCircle-Bi6qVvrN.js";import{s as Nl}from"./RefreshCcw01-CSeua2ip.js";import{b as de,a as hs}from"./use-mcp-tools-CQfFVFT8.js";import{u as Sl}from"./use-members-CmtCKeEg.js";import"./localstorage-keys-BQX8_0BZ.js";import"./index-BfJ-GPYf.js";import"./ChevronDown-BufhPURG.js";import"./binder-CO5VHJsz.js";import"./extract-connection-data-DsHfycl1.js";import"./constants-BMvsKHXz.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-COvjQkiO.js";import"./generate-id-Dyweu44Y.js";import"./index-CV_imPUN.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(Zt,{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:o}=Gs(i.id,r);let a;e[1]!==n?(a=Xt(n),e[1]=n,e[2]=a):a=e[2];const d=a;let m;if(e[3]!==d?.slug||e[4]!==n||e[5]!==l||e[6]!==o){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(Nt(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=Nt(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=(o??[]).filter(Pl).map(f),e[3]=d?.slug,e[4]=n,e[5]=l,e[6]=o,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 Pl(t){return t.slug!==pe}function _l(t){const e=z.c(31),{activeSection:n,onNavigate:l}=t,{data:i}=ut.useSession(),[r]=mt(),o=i?.user,a=o?.image,d=o?.name??"Profile",m=o?.name??"U";let c;e[0]!==m||e[1]!==a?(c=s.jsx(Jt,{url:a,fallback:m,shape:"circle",size:"2xs",className:"size-4 shrink-0"}),e[0]=m,e[1]=a,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(Zt,{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(Us,{size:14})},e[10]=g):g=e[10];let C;e[11]===Symbol.for("react.memo_cache_sentinel")?(C={key:"org.plugins",label:"Plugins",icon:s.jsx(yt,{size:14})},e[11]=C):C=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=[g,C,{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 N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("p",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground/60",children:"Organization"}),e[18]=N):N=e[18];let P;e[19]!==n||e[20]!==l?(P=s.jsxs("div",{className:"flex flex-col gap-0.5 px-2",children:[N,_.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 S;e[26]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("div",{className:"mt-auto px-4 pb-1",children:s.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v","2.128.0"]})}),e[26]=S):S=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,S]}),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 o;t[0]!==i?(o=()=>{i?.id&&navigator.clipboard.writeText(i.id).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)})},t[0]=i,t[1]=o):o=t[1];const a=o;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 C;t[16]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("p",{className:"py-4 text-base font-semibold text-foreground border-b border-border",children:"User ID"}),t[16]=C):C=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(Xs,{size:14,className:"text-green-600 shrink-0"}):s.jsx(Js,{size:14,className:"shrink-0 opacity-70 group-hover:opacity-100 transition-opacity"}),t[20]=n,t[21]=v):v=t[21];let N;t[22]!==a||t[23]!==b||t[24]!==v?(N=s.jsx(qs,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:a,className:"group flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",children:[b,v]})}),t[22]=a,t[23]=b,t[24]=v,t[25]=N):N=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]!==N?(y=s.jsxs("div",{className:"flex flex-col",children:[C,s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4",children:[w,s.jsx(Hs,{children:s.jsxs(Qs,{children:[N,P]})})]})]}),t[27]=N,t[28]=y):y=t[28];let S;return t[29]!==y||t[30]!==g?(S=s.jsxs("div",{className:"flex flex-col gap-8",children:[d,g,y]}),t[29]=y,t[30]=g,t[31]=S):S=t[31],S}function nt(t){const e=z.c(27),{icon:n,label:l,description:i,control:r,onClick:o,disabled:a}=t,d=a?void 0:o,m=o?"button":void 0,c=o&&!a?0:void 0;let f;e[0]!==a||e[1]!==o?(f=o&&!a?v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),o())}:void 0,e[0]=a,e[1]=o,e[2]=f):f=e[2];const u=o&&!a?"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 C;e[11]!==h||e[12]!==g?(C=s.jsxs("div",{className:"min-w-0",children:[h,g]}),e[11]=h,e[12]=g,e[13]=C):C=e[13];let w;e[14]!==C||e[15]!==p?(w=s.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[p,C]}),e[14]=C,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 At(){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 o;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(en,{size:16}),t[3]=o):o=t[3];let a;t[4]!==n?(a=()=>n(Il),t[4]=n,t[5]=a):a=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(Fe,{checked:e.devMode,onCheckedChange:d}),t[8]=e.devMode,t[9]=d,t[10]=m):m=t[10];let c;t[11]!==a||t[12]!==m?(c=s.jsx(nt,{icon:o,label:"Developer Mode",description:"Show technical details like JSON input/output for tool calls.",onClick:a,control:m}),t[11]=a,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(Fe,{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 C;t[22]!==g?(C=s.jsx(ts,{className:"w-36",children:s.jsx("span",{children:g})}),t[22]=g,t[23]=C):C=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(ss,{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]!==C?(v=s.jsx(nt,{icon:x,label:"Tool Approval",description:"Choose when to require approval before tools execute.",control:s.jsxs(es,{value:e.toolApprovalLevel,onValueChange:p,children:[C,b]})}),t[27]=e.toolApprovalLevel,t[28]=p,t[29]=C,t[30]=v):v=t[30];let N;return t[31]!==v||t[32]!==c||t[33]!==u?(N=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]=N):N=t[34],N}function Il(t){return{...t,devMode:!t.devMode}}function El(t){return{...t,enableNotifications:!1}}function It(t){const e=z.c(22),{icon:n,label:l,description:i,checked:r,onCheckedChange:o}=t;let a;e[0]!==r||e[1]!==o?(a=()=>o(!r),e[0]=r,e[1]=o,e[2]=a):a=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]!==o?(x=s.jsx("div",{onClick:Ol,className:"shrink-0",children:s.jsx(Fe,{checked:r,onCheckedChange:o})}),e[15]=r,e[16]=o,e[17]=x):x=e[17];let p;return e[18]!==a||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:a,children:[u,x]}),e[18]=a,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(Ls,{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 o;t[4]!==e.experimental_projects||t[5]!==r?(o=s.jsx(It,{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]=o):o=t[6];let a;t[7]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(sn,{size:16}),t[7]=a):a=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(It,{icon:a,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]!==o||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:[o,m]})]}),t[13]=o,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 o;e[0]!==l?(o=b=>{const v=b.target.files?.[0];if(v){if(v.size>2097152){fe.error("Image must be smaller than 2MB");return}const N=new FileReader;N.onerror=()=>{const P=N.error;console.error("FileReader error:",P),fe.error(P?.message||"Failed to read image file. Please try again."),r.current&&(r.current.value="")},N.onloadend=()=>{if(N.readyState===FileReader.DONE&&N.result){const P=N.result;l(P)}},N.readAsDataURL(v)}},e[0]=l,e[1]=o):o=e[1];const a=o;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]!==a?(u=s.jsx("input",{type:"file",ref:r,className:"hidden",accept:"image/*",onChange:a}),e[5]=a,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(Qt,{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 C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Recommended: Square image, at least 200x200px. Max 2MB."}),e[16]=C):C=e[16];let w;e[17]!==h||e[18]!==g?(w=s.jsxs("div",{className:"flex-1",children:[h,g,C]}),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=Re(),[i,r]=j.useState(!1),o=Wt({resolver:Ut(Tl),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),a=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),a.mutate(c)},m=o.formState.isDirty;return s.jsx(ns,{...o,children:s.jsxs("form",{onSubmit:o.handleSubmit(d),className:"space-y-6",children:[s.jsx(Te,{control:o.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:o.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:o.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:o.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:()=>o.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=Re(),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 o=he(r);let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=Ut(Bl),t[2]=a):a=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:a,values:{name:d,description:m,themeColor:c}},t[3]=d,t[4]=m,t[5]=c,t[6]=f):f=t[6];const u=Wt(f);let x;t[7]!==o||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 o.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]=o,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 C;t[21]!==g?(C=async T=>{await g.mutateAsync(T)},t[21]=g,t[22]=C):C=t[22];const w=C;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 N;t[29]!==i||t[30]!==g.isPending||t[31]!==b?(N=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]=N):N=t[32];let P;t[33]!==u.control||t[34]!==N?(P=s.jsx(Te,{control:u.control,name:"name",render:N}),t[33]=u.control,t[34]=N,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 S;t[37]!==n.slug?(S=s.jsx(je,{children:s.jsx(ve,{value:n.slug,disabled:!0,className:"bg-muted"})}),t[37]=n.slug,t[38]=S):S=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]!==S?(A=s.jsxs(ye,{children:[y,S,k]}),t[40]=S,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 F;return t[60]!==u||t[61]!==$?(F=s.jsx("div",{className:"flex flex-col",children:s.jsx(ns,{...u,children:$})}),t[60]=u,t[61]=$,t[62]=F):F=t[62],F}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=Re(),[r,o]=j.useState(""),[a,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:Fl},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 C;t[13]!==h?(C=()=>{h.mutate()},t[13]=h,t[14]=C):C=t[14];const w=C;let _;t[15]===Symbol.for("react.memo_cache_sentinel")?(_=G=>{d(G),G||o("")},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 N;t[17]===Symbol.for("react.memo_cache_sentinel")?(N=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]=N):N=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 S;t[21]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(cn,{children:"This action cannot be undone. All project data will be permanently deleted."}),t[21]=S):S=t[21];let k;t[22]!==y?(k=s.jsxs(dn,{children:[y,S]}),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=>o(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,F=h.isPending?"Deleting...":"Delete Project";let T;t[34]!==w||t[35]!==$||t[36]!==F?(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:F})]}),t[34]=w,t[35]=$,t[36]=F,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]!==a||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:[N,s.jsxs(pn,{open:a,onOpenChange:b,children:[P,O]})]})]}),t[42]=a,t[43]=O,t[44]=M):M=t[44],M}function Fl(t){fe.error("Failed to delete project: "+(t instanceof Error?t.message:"Unknown error"))}function Rl(){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 Et({value:t,onValueChange:e,placeholder:n="Select a connection...",binding:l,bindingType:i,onAddNew:r,className:o,disabled:a=!1}){const[d,m]=j.useState(!1),{installByBinding:c,isInstalling:f}=bn(),u=d||f,x=ls(),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=>yn(v,l)):x,g=(()=>{if(!i?.startsWith("@"))return null;const[v,N]=i.replace("@","").split("/");return v&&N?{scope:v,appName:N}:null})(),C=(()=>{let v=h;const N=Array.isArray(l)&&l.length>0;if(g&&!N&&(v=v.filter(P=>{const y=P.app_name,S=P.metadata?.scopeName;return y===g.appName&&S===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=C.find(v=>v.id===t);return s.jsxs(es,{value:t??"none",onValueChange:v=>e(v==="none"?null:v),disabled:a,children:[s.jsx(ts,{size:"sm",className:ue("w-[200px]",o),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(ss,{children:[s.jsx(Me,{value:"none",children:"No connection"}),C.length===0?s.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No compatible connections found"}):C.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||a,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:o,description:a,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 C;e[2]!==n.id||e[3]!==c?(C=xe.projectPluginConfig(c??"",n.id),e[2]=n.id,e[3]=c,e[4]=C):C=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]!==C||e[10]!==w||e[11]!==_?(b={queryKey:C,queryFn:w,enabled:_},e[9]=C,e[10]=w,e[11]=_,e[12]=b):b=e[12];const{data:v,isLoading:N}=hn(b),P=v?.config?.connectionId??null,y=r!==void 0?r:P,S=v?.config?.settings&&typeof v.config.settings=="object"?v.config.settings:null,k=typeof S?.vtexConnectionId=="string"?S.vtexConnectionId:null,A=o!==void 0?o.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 F;e[22]!==d?(F=s.jsx("p",{className:"text-sm font-medium text-foreground",children:d}),e[22]=d,e[23]=F):F=e[23];let T;e[24]!==a?(T=a&&s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:a}),e[24]=a,e[25]=T):T=e[25];let O;e[26]!==F||e[27]!==T?(O=s.jsxs("div",{className:"min-w-0",children:[F,T]}),e[26]=F,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(Fe,{checked:l,onCheckedChange:G,disabled:i})}),e[35]=l,e[36]=i,e[37]=G,e[38]=U):U=e[38];let R;e[39]!==M||e[40]!==U?(R=s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4",children:[M,U]}),e[39]=M,e[40]=U,e[41]=R):R=e[41];let W;e[42]!==I||e[43]!==N||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]!==S||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(Et,{value:y??null,onValueChange:V=>u(n.id,V,P),binding:n.binding,placeholder:"Select connection...",className:"w-56",disabled:i||N})]}),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(Et,{value:A??null,onValueChange:V=>x(n.id,V,k,S),binding:$s,placeholder:"Select VTEX connection...",className:"w-56",disabled:i||N})]})]}),e[42]=I,e[43]=N,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]=S,e[54]=k,e[55]=A,e[56]=W):W=e[56];let K;return e[57]!==R||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:[R,W]}),e[57]=R,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=Re(),l=he({connectionId:Be,orgId:t.id}),[i,r]=j.useState({}),[o,a]=j.useState({}),[d,m]=j.useState({}),[c,f]=j.useState(!1),u=e.enabledPlugins??[],x=y=>{const S=i[y];return S!==void 0?S:u.includes(y)},p=()=>{const y=new Set(u);for(const[S,k]of Object.entries(i))k?y.add(S):y.delete(S);return Array.from(y)},h=Object.keys(i).length>0||Object.keys(o).length>0||Object.keys(d).length>0,g=(y,S)=>{const k=u.includes(y);r(S===k?A=>{const{[y]:I,...E}=A;return E}:A=>({...A,[y]:S}))},C=(y,S,k)=>{if(S===k){a(A=>{const{[y]:I,...E}=A;return E});return}a(A=>({...A,[y]:S}))},w=(y,S,k,A)=>{if(S===k){m(I=>{const{[y]:E,...D}=I;return D});return}m(I=>({...I,[y]:{value:S,baseSettings:A}}))},_=He({mutationFn:async y=>{const S=[];if(y.updatePlugins){const k=await l.callTool({name:"PROJECT_UPDATE",arguments:{projectId:e.id,enabledPlugins:y.enabledPlugins}});S.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)}));S.push(...k)}return S},onSuccess:(y,S)=>{S.updatePlugins&&(n.invalidateQueries({queryKey:xe.project(t.id,e.slug)}),n.invalidateQueries({queryKey:xe.projects(t.id)})),S.bindingUpdates.forEach(({pluginId:k})=>{n.invalidateQueries({queryKey:xe.projectPluginConfig(e.id??"",k)})}),r({}),a({}),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(o),...Object.keys(d)]),S=Array.from(y).map(k=>{const A=o[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:S})},v=()=>{r({}),a({}),m({})},N=y=>{const S=zs.find(k=>k.pluginId===y);return S?{label:S.label,icon:S.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 S=N(y.id),k=P(y.id),A=x(y.id);return s.jsx(Vl,{plugin:y,isEnabled:A,isSaving:c,pendingBinding:o[y.id],pendingVtexBinding:d[y.id],description:k,label:S?.label??y.id,icon:S?.icon??s.jsx(gn,{size:14}),projectId:e.id,client:l,onBindingChange:C,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 Ot(){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 Dt=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 o=0;console.warn(n.replace(/%s/g,()=>i[o++]))}},Ql=["x1","y1","x2","y2","key"],Xl=["offset"],Jl=["xAxisId","yAxisId"],Zl=["xAxisId","yAxisId"];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 ee(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){er(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 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:o,ry:a}=t;return j.createElement("rect",{x:l,y:i,ry:a,width:r,height:o,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:o,x2:a,y2:d,key:m}=n,c=Ke(n,Ql),f=(i=pt(c))!==null&&i!==void 0?i:{},{offset:u}=f,x=Ke(f,Xl);l=j.createElement("line",Ne({},x,{x1:r,y1:o,x2:a,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:o}=t,a=Ke(t,Jl),d=i.map((m,c)=>{var f=ee(ee({},a),{},{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:o}=t,a=Ke(t,Zl),d=i.map((m,c)=>{var f=ee(ee({},a),{},{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:o,horizontalPoints:a,horizontal:d=!0}=t;if(!d||!e||!e.length||a==null)return null;var m=a.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+o-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:o,height:a,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+o-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:a,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:o,x:a,y:d,width:m,height:c,syncWithTicks:f,horizontalValues:u,verticalValues:x}=i,p=Xe(),h=ge(S=>St(S,"xAxis",r,p)),g=ge(S=>St(S,"yAxis",o,p));if(!Ct(m)||!Ct(c)||!ce(a)||!ce(d))return null;var C=i.verticalCoordinatesGenerator||cr,w=i.horizontalCoordinatesGenerator||dr,{horizontalPoints:_,verticalPoints:b}=i;if((!_||!_.length)&&typeof w=="function"){var v=u&&u.length,N=w({yAxis:g?ee(ee({},g),{},{ticks:v?u:g.ticks}):void 0,width:e??m,height:n??c,offset:l},v?!0:f);Dt(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(_=N)}if((!b||!b.length)&&typeof C=="function"){var P=x&&x.length,y=C({xAxis:h?ee(ee({},h),{},{ticks:P?x:h.ticks}):void 0,width:e??m,height:n??c,offset:l},P?!0:f);Dt(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=Je([ht,Ns,Cs,Ss,ws],(t,e,n,l,i)=>ms(t,"xAxis")?wt(e,l,!1):wt(n,i,!1)),fr=(t,e)=>e,Ps=Je([kn,fr],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),_s=t=>{var e=ht(t),n=ms(e,"xAxis");return n?"yAxis":"xAxis"},xr=(t,e)=>{var n=_s(t);return n==="yAxis"?vt(t,e):gt(t,e)},pr=(t,e,n)=>An(t,_s(t),xr(t,e),n),hr=Je([Ps,pr],(t,e)=>{var n;if(!(t==null||e==null)){var{stackId:l}=t,i=_n(t);if(!(l==null||i==null)){var r=(n=e[l])===null||n===void 0?void 0:n.stackedData,o=r?.find(a=>a.key===i);if(o!=null)return o.map(a=>[a[0],a[1]])}}}),gr=Je([ht,Ns,Cs,Ss,ws,hr,wn,mr,Ps,Pn],(t,e,n,l,i,r,o,a,d,m)=>{var{chartData:c,dataStartIndex:f,dataEndIndex:u}=o;if(!(d==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||l==null||i==null||l.length===0||i.length===0||a==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:a})}}),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 Lt(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?Lt(Object(n),!0).forEach(function(l){jr(t,l,n[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Lt(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:o}=t;return[{inactive:o,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:o,hide:a,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(o,e),hide:a,type:m,color:qe(l,r),unit:d,graphicalItemId:c}};return j.createElement(Ln,{tooltipEntrySettings:f})});function Pr(t){var{clipPathId:e,points:n,props:l}=t,{needClip:i,dot:r,dataKey:o}=l,a=pt(l);return j.createElement(Xn,{points:n,dot:r,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:a,needClip:i,clipPathId:e})}function _r(t){var{showLabels:e,children:n,points:l}=t,i=l.map(r=>{var o,a,d={x:(o=r.x)!==null&&o!==void 0?o:0,y:(a=r.y)!==null&&a!==void 0?a: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 zt(t){var{points:e,baseLine:n,needClip:l,clipPathId:i,props:r}=t,{layout:o,type:a,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:a,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),d!=="none"&&j.createElement(et,Ce({},x,{className:"recharts-area-curve",layout:o,type:a,connectNulls:m,fill:"none",points:e})),d!=="none"&&c&&j.createElement(et,Ce({},x,{className:"recharts-area-curve",layout:o,type:a,connectNulls:m,fill:"none",points:n}))),j.createElement(Pr,{points:e,props:u,clipPathId:i}))}function kr(t){var e,n,{alpha:l,baseLine:i,points:r,strokeWidth:o}=t,a=(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(a)||!Ve(d))return null;var m=l*Math.abs(a-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:a<d?a:a-m,width:c+(o?parseInt("".concat(o),10):1),height:Math.floor(m)}):null}function Ar(t){var e,n,{alpha:l,baseLine:i,points:r,strokeWidth:o}=t,a=(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(a)||!Ve(d))return null;var m=l*Math.abs(a-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:a<d?a:a-m,y:0,width:m,height:Math.floor(c+(o?parseInt("".concat(o),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:o,baseLine:a,isAnimationActive:d,animationBegin:m,animationDuration:c,animationEasing:f,onAnimationStart:u,onAnimationEnd:x}=l,p=j.useMemo(()=>({points:o,baseLine:a}),[o,a]),h=Un(p,"recharts-area-"),g=xs(),[C,w]=j.useState(!1),_=!C,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 N=i.current,P=r.current;return j.createElement(_r,{showLabels:_,points:o},l.children,j.createElement(Vn,{animationId:h,begin:m,duration:c,isActive:d,easing:f,onAnimationEnd:b,onAnimationStart:v,key:h},y=>{if(N){var S=N.length/o.length,k=y===1?o:o.map((I,E)=>{var D=Math.floor(E*S);if(N[D]){var L=N[D];return Oe(Oe({},I),{},{x:Ee(L.x,I.x,y),y:Ee(L.y,I.y,y)})}return I}),A;return ce(a)?A=Ee(P,a,y):Kn(a)||qn(a)?A=Ee(P,0,y):A=a.map((I,E)=>{var D=Math.floor(E*S);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(zt,{points:k,baseLine:A,needClip:e,clipPathId:n,props:l})}return y>0&&(i.current=o,r.current=a),j.createElement(Ue,null,d&&j.createElement("defs",null,j.createElement("clipPath",{id:"animationClipPath-".concat(n)},j.createElement(Ir,{alpha:y,points:o,baseLine:a,layout:g,strokeWidth:l.strokeWidth}))),j.createElement(Ue,{clipPath:"url(#animationClipPath-".concat(n,")")},j.createElement(zt,{points:o,baseLine:a,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:o,needClip:a,xAxisId:d,yAxisId:m,width:c,height:f,id:u,baseLine:x,zIndex:p}=this.props;if(e)return null;var h=Vt("recharts-area",i),g=u,{r:C,strokeWidth:w}=Fn(n),_=Rn(n),b=C*2+w,v=a?"url(#clipPath-".concat(_?"":"dots-").concat(g,")"):void 0;return j.createElement(is,{zIndex:p},j.createElement(Ue,{className:h},a&&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:o-b/2,y:r-b/2,width:c+b,height:f+b}))),j.createElement(Or,{needClip:a,clipPathId:g,props:this.props})),j.createElement(Pt,{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(Pt,{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:o,connectNulls:a,dot:d,fill:m,fillOpacity:c,hide:f,isAnimationActive:u,legendType:x,stroke:p,xAxisId:h,yAxisId:g}=n,C=ks(n,yr),w=$n(),_=Bn(),{needClip:b}=Mn(h,g),v=Xe(),{points:N,isRange:P,baseLine:y}=(e=ge(D=>gr(D,t.id,v)))!==null&&e!==void 0?e:{},S=Gn();if(w!=="horizontal"&&w!=="vertical"||S==null||_!=="AreaChart"&&_!=="ComposedChart")return null;var{height:k,width:A,x:I,y:E}=S;return!N||!N.length?null:j.createElement(Dr,Ce({},C,{activeDot:l,animationBegin:i,animationDuration:r,animationEasing:o,baseLine:y,connectNulls:a,dot:d,fill:m,fillOpacity:c,height:k,hide:f,layout:w,isAnimationActive:u==="auto"?!Jn.isSsr:u,isRange:P,legendType:x,needClip:b,points:N,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 o=t==="horizontal"?i:l,a=o.scale.domain();if(o.type==="number"){var d=Math.max(a[0],a[1]),m=Math.min(a[0],a[1]);return r==="dataMin"?m:r==="dataMax"||d<0?d:Math.max(Math.min(a[0],a[1]),0)}return r==="dataMin"?a[0]:r==="dataMax"?a[1]:a[0]};function zr(t){var{areaSettings:{connectNulls:e,baseValue:n,dataKey:l},stackedData:i,layout:r,chartBaseValue:o,xAxis:a,yAxis:d,displayedData:m,dataStartIndex:c,xAxisTicks:f,yAxisTicks:u,bandSize:x}=t,p=i&&i.length,h=Lr(r,o,n,a,d),g=r==="horizontal",C=!1,w=m.map((b,v)=>{var N,P,y,S;if(p)S=i[c+v];else{var k=_t(b,l);Array.isArray(k)?(S=k,C=!0):S=[h,k]}var A=(N=(P=S)===null||P===void 0?void 0:P[1])!==null&&N!==void 0?N:null,I=A==null||p&&!e&&_t(b,l)==null;if(g){var E;return{x:kt({axis:a,ticks:f,bandSize:x,entry:b,index:v}),y:I?null:(E=d.scale.map(A))!==null&&E!==void 0?E:null,value:S,payload:b}}return{x:I?null:(y=a.scale.map(A))!==null&&y!==void 0?y:null,y:kt({axis:d,ticks:u,bandSize:x,entry:b,index:v}),value:S,payload:b}}),_;return p||C?_=w.map(b=>{var v,N=Array.isArray(b.value)?b.value[0]:null;if(g){var P;return{x:b.x,y:N!=null&&b.y!=null&&(P=d.scale.map(N))!==null&&P!==void 0?P:null,payload:b.payload}}return{x:N!=null&&(v=a.scale.map(N))!==null&&v!==void 0?v:null,y:b.y,payload:b.payload}}):_=g?d.scale.map(h):a.scale.map(h),{points:w,baseLine:_??0,isRange:C}}function $r(t){var e=Qe(t,As),n=Xe();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 $t(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 Bt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$t(Object(n),!0).forEach(function(l){Fr(t,l,n[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$t(Object(n)).forEach(function(l){Object.defineProperty(t,l,Object.getOwnPropertyDescriptor(n,l))})}return t}function Fr(t,e,n){return(e=Rr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Rr(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),o=ul(l,"yAxis",i),a=j.useMemo(()=>{if(o!=null)return Bt(Bt({},r),{},{type:o})},[o,r]);return j.useLayoutEffect(()=>{a!=null&&(n.current===null?e(el(a)):n.current!==a&&e(tl({prev:n.current,next:a})),n.current=a)},[a,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),o=j.useRef(null),a=ge(nl),d=Xe(),m=ps(),c="yAxis",f=ge(N=>ll(N,e)),u=ge(N=>rl(N,e)),x=ge(N=>il(N,c,e,d)),p=ge(N=>al(N,e));if(j.useLayoutEffect(()=>{if(!(l!=="auto"||!f||ol(i)||j.isValidElement(i)||p==null)){var N=r.current;if(N){var P=N.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:C}=t,w=dt(t,Mr),{id:_,scale:b}=p,v=dt(p,Gr);return j.createElement(dl,ct({},w,v,{ref:r,labelRef:o,x:u.x,y:u.y,tickTextProps:l==="auto"?{width:void 0}:{width:l},width:f.width,height:f.height,className:Vt("recharts-".concat(c," ").concat(c),n),viewBox:a,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 Xr(){try{const t=localStorage.getItem(Os);if(t==="daily"||t==="weekly"||t==="monthly")return t}catch{}return"daily"}function Jr(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:o,currentLimitPeriod:a}=t,{org:d}=oe(),[m,c]=j.useState(null),[f,u]=j.useState(""),[x,p]=j.useState(null),[h,g]=j.useState(null),[C,w]=j.useState(a??"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:N,isPending:P}=hs(v),y=Re(),S=o==="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=C==="none"?null:C,D=S&&I!=null&&I===r&&E===a;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 F;e[9]!==$||e[10]!==y?(F=async()=>{await y.invalidateQueries({queryKey:$,exact:!0}),await y.refetchQueries({queryKey:$,exact:!0,type:"active"})},e[9]=$,e[10]=y,e[11]=F):F=e[11];const T=F;let O,M;e[12]!==o||e[13]!==a||e[14]!==r||e[15]!==I||e[16]!==S||e[17]!==C||e[18]!==N||e[19]!==l||e[20]!==T?(M=()=>{if(!I||I<=0)return;const q=S?I:r+I;g(null);const le={limit_usd:q,billing_mode:o,return_url:window.location.href};S&&(le.limit_period=C),N({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(a??"none"),l(!1)},e[12]=o,e[13]=a,e[14]=r,e[15]=I,e[16]=S,e[17]=C,e[18]=N,e[19]=l,e[20]=T,e[21]=O,e[22]=M):(O=e[21],M=e[22]);const G=S?"Configure Spending Limit":"Add Credit",U=S?"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.",R=S?"New limit":"Select amount",W=S?"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(Rs,{children:U}),e[25]=U,e[26]=V):V=e[26];let Y;e[27]!==K||e[28]!==V?(Y=s.jsxs(Ws,{children:[K,V]}),e[27]=K,e[28]=V,e[29]=Y):Y=e[29];let H;e[30]!==R||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]!==S||e[40]!==D||e[41]!==C||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:R}),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:S?"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)}})]})]}),S&&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",C===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:S?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]=R,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]=S,e[40]=D,e[41]=C,e[42]=m,e[43]=H):H=e[43];let X;e[44]!==Y||e[45]!==H?(X=s.jsxs(Yt,{className:"sm:max-w-md",children:[Y,H]}),e[44]=Y,e[45]=H,e[46]=X):X=e[46];let ne;return e[47]!==O||e[48]!==n||e[49]!==X?(ne=s.jsx(Ht,{open:n,onOpenChange:O,children:X}),e[47]=O,e[48]=n,e[49]=X,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 o;e[0]!==i?(o=i?new Date(i).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null,e[0]=i,e[1]=o):o=e[1];const a=o,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]!==a?(c=a&&s.jsxs("span",{children:["(until ",a,")"]}),e[5]=a,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 C;return e[16]!==g||e[17]!==m||e[18]!==c||e[19]!==x||e[20]!==p?(C=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]=C):C=e[21],C}function ri(t){const e=z.c(37),{usage:n,limit:l,limitPeriod:i,onConfigureLimit:r,connectionId:o,alert:a}=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 C;e[19]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(xt,{size:16}),e[19]=C):C=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:[C,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 N;e[30]!==a||e[31]!==o?(N=s.jsx(Ds,{connectionId:o,alert:a,billingMode:"postpaid"}),e[30]=a,e[31]=o,e[32]=N):N=e[32];let P;return e[33]!==b||e[34]!==v||e[35]!==N?(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,N]}),e[33]=b,e[34]=v,e[35]=N,e[36]=P):P=e[36],P}function ii(t){const e=z.c(30),{available:n,total:l,estimation:i,onAddCredit:r,connectionId:o,alert:a}=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 C;e[16]!==n||e[17]!==l||e[18]!==d?(C=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]=C):C=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]!==a||e[23]!==o?(_=s.jsx(Ds,{connectionId:o,alert:a,billingMode:"prepaid"}),e[22]=a,e[23]=o,e[24]=_):_=e[24];let b;return e[25]!==w||e[26]!==_||e[27]!==g||e[28]!==C?(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,C,w,_]}),e[25]=w,e[26]=_,e[27]=g,e[28]=C,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(),[o,a]=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,C]=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:N}=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=()=>{C(null),h(!1);const J=parseFloat(c);if(d&&(!u||!u.includes("@"))){C("A valid email is required to enable alerts.");return}if(Number.isNaN(J)||J<=0){C("Threshold must be a positive number.");return}v({name:"GATEWAY_SET_ALERT",arguments:{enabled:d,threshold_usd:J,...u?{email:u}:{}}},{onSuccess:()=>{h(!0),setTimeout(()=>h(!1),3e3)},onError:we=>{C(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 S=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(!o){let J;e[10]===Symbol.for("react.memo_cache_sentinel")?(J=()=>a(!0),e[10]=J):J=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 Pe;e[12]!==k?(Pe=s.jsx("p",{className:"text-xs font-medium text-foreground",children:k}),e[12]=k,e[13]=Pe):Pe=e[13];let _e;e[14]!==l.enabled||e[15]!==l.threshold_usd||e[16]!==i?(_e=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]=_e):_e=e[17];let ke;e[18]!==_e?(ke=s.jsx("p",{className:"text-[11px] text-muted-foreground",children:_e}),e[18]=_e,e[19]=ke):ke=e[19];let Ae;e[20]!==Pe||e[21]!==ke?(Ae=s.jsxs("div",{className:"flex-1 min-w-0",children:[Pe,ke]}),e[20]=Pe,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:J,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(Fe,{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 F=!d&&"opacity-50 pointer-events-none";let T;e[40]!==F?(T=ue("flex flex-col gap-3 transition-opacity",F),e[40]=F,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=J=>f(J.target.value),e[45]=U):U=e[45];let R;e[46]!==c?(R=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]=R):R=e[47];let W;e[48]!==M||e[49]!==R?(W=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[M,R]}),e[48]=M,e[49]=R,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=J=>x(J.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 X;e[58]!==g?(X=g&&s.jsx("p",{className:"text-[11px] text-destructive",children:g}),e[58]=g,e[59]=X):X=e[59];let ne;e[60]!==T||e[61]!==H||e[62]!==X?(ne=s.jsxs("div",{className:T,children:[H,X]}),e[60]=T,e[61]=H,e[62]=X,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:()=>a(!1),children:"Cancel"}),e[66]=le):le=e[66];const re=N||!P,se=N?"Saving...":"Save Alert";let ie;e[67]!==S||e[68]!==re||e[69]!==se?(ie=s.jsx(te,{size:"sm",className:"h-7 text-xs",onClick:S,disabled:re,children:se}),e[67]=S,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 o;t[2]!==e.id?(o={connectionId:Be,orgId:e.id},t[2]=e.id,t[3]=o):o=t[3];const a=he(o);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]!==a||t[8]!==m?(c={client:a,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:m,staleTime:6e4,select:$e},t[7]=a,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]!==a||t[14]!==x?(p={client:a,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:x,staleTime:6e4,select:$e},t[13]=a,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 C;t[17]!==r?(C={widget:g,timeRange:r},t[17]=r,t[18]=C):C=t[18];let w;t[19]!==a||t[20]!==C?(w={client:a,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:C,staleTime:6e4,select:$e},t[19]=a,t[20]=C,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 N=v;let P;if(t[26]!==h?.value||t[27]!==N||t[28]!==_?.groups||t[29]!==f?.timeseries||t[30]!==n){const y=(f?.timeseries??[]).reduce(fi,0),S=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 F;t[40]!==S?(F=S.toLocaleString(),t[40]=S,t[41]=F):F=t[41];let T;t[42]!==F?(T=s.jsxs("p",{className:"text-xs text-muted-foreground tabular-nums",children:[F," tool calls"]}),t[42]=F,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(jt,{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]!==N?(U=N.length>0?s.jsx(xl,{config:ai,className:"h-[200px] w-full",children:s.jsxs(Qr,{data:N,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]=N,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((R,W)=>{const K=y>0?Math.min(R.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:R.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(R.value)})]},R.key)})})]})]}),t[26]=h?.value,t[27]=N,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(Xr);let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=m=>{n(m),Jr(m)},t[0]=l):l=t[0];const i=l;let r,o;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"}),o=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]=o):(r=t[1],o=t[2]);let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=["daily","weekly","monthly"],t[3]=a):a=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,o,s.jsx("div",{className:"flex gap-2 mt-1",children:a.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:o}=t,a=o===void 0?"bg-chart-1":o;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]!==a?(u=ue("h-full transition-all duration-500 ease-out",a),e[4]=a,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 C;e[13]!==i?(C=i&&s.jsx("span",{className:"text-xs tabular-nums shrink-0 text-muted-foreground",children:i}),e[13]=i,e[14]=C):C=e[14];let w;return e[15]!==f||e[16]!==h||e[17]!==g||e[18]!==C?(w=s.jsxs("div",{className:"flex items-center gap-2",children:[f,h,g,C]}),e[15]=f,e[16]=h,e[17]=g,e[18]=C,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 o;e[2]!==l||e[3]!==i?(o=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]=o):o=e[4];let a;return e[5]!==r||e[6]!==o?(a=s.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-5",children:[r,o]}),e[5]=r,e[6]=o,e[7]=a):a=e[7],a}const Mt={"7d":"7 days","30d":"30 days","90d":"90 days"};function jt(t){const e=z.c(4),{period:n,onPeriodChange:l}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Object.keys(Mt),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(o=>s.jsx("button",{type:"button",onClick:()=>l(o),className:ue("px-2.5 py-1 text-xs font-medium rounded-sm transition-colors",n===o?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:Mt[o]},o))}),e[1]=l,e[2]=n,e[3]=r):r=e[3],r}function Gt(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(),o=r?.data?.members??[],a=new Map(o.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",groupByColumn:"connection_title"})),{data:h,isLoading:g}=de(c({fn:"sum",groupByColumn:"user_id"})),{data:C,isLoading:w}=de(c({fn:"count",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:N,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 J;return t[4]===Symbol.for("react.memo_cache_sentinel")?(J=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]=J):J=t[4],J}const S=Gt(f?.groups??[],x?.groups??[]),k=Gt(h?.groups??[],C?.groups??[]).map(B=>({...B,key:a.get(B.key)??B.key})),A=N?.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=S.reduce(vi,0),L=S.reduce(gi,0),$=S[0]?.cost??1,F=k[0]?.cost??1,T=E[0]?.calls??1;let O;t[5]!==n?(O=s.jsx(jt,{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=S.length===0,U=S.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 R;t[7]!==U?(R=s.jsx("div",{className:"space-y-2.5",children:U}),t[7]=U,t[8]=R):R=t[8];let W;t[9]!==G||t[10]!==R?(W=s.jsx(rt,{title:"Cost by Connection",empty:G,children:R}),t[9]=G,t[10]=R,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:F,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 X=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]!==X||t[20]!==q||t[21]!==se?(ie=s.jsx(X,{title:ne,empty:q,children:se}),t[19]=X,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"}),o=n.get(r)??{cost:0,calls:0};n.set(r,{cost:o.cost+l.value,calls:o.calls})}for(const l of e){const r=new Date(l.timestamp).toLocaleDateString("en-US",{month:"short",year:"2-digit"}),o=n.get(r)??{cost:0,calls:0};n.set(r,{cost:o.cost,calls:o.calls+l.value})}return Array.from(n.entries()).map(([l,i])=>({month:l,...i})).reverse()}function Ci(){const t=z.c(37),{org:e}=oe(),[n,l]=j.useState("90d");let i;t[0]!==n?(i=bt(n),t[0]=n,t[1]=i):i=t[1];const r=i;let o;t[2]!==e.id?(o={connectionId:Be,orgId:e.id},t[2]=e.id,t[3]=o):o=t[3];const a=he(o);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]!==a||t[8]!==m?(c={client:a,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:m,staleTime:6e4,select:$e},t[7]=a,t[8]=m,t[9]=c):c=t[9];const{data:f,isLoading:u}=de(c);let x;t[10]===Symbol.for("react.memo_cache_sentinel")?(x={type:"timeseries",source:{path:ze,from:"output"},aggregation:{fn:"count",interval:"1d"}},t[10]=x):x=t[10];let p;t[11]!==r?(p={widget:x,timeRange:r},t[11]=r,t[12]=p):p=t[12];let h;t[13]!==a||t[14]!==p?(h={client:a,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:p,staleTime:6e4,select:$e},t[13]=a,t[14]=p,t[15]=h):h=t[15];const{data:g,isLoading:C}=de(h);if(u||C){let S;return t[16]===Symbol.for("react.memo_cache_sentinel")?(S=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[16]=S):S=t[16],S}let w,_,b,v,N;if(t[17]!==g?.timeseries||t[18]!==f?.timeseries||t[19]!==n){const S=Si(f?.timeseries??[],g?.timeseries??[]);_="flex flex-col gap-4";let k;t[25]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Usage history from monitoring logs"}),t[25]=k):k=t[25],t[26]!==n?(b=s.jsxs("div",{className:"flex items-center justify-between",children:[k,s.jsx(jt,{period:n,onPeriodChange:l})]}),t[26]=n,t[27]=b):b=t[27],v="flex flex-col gap-3 rounded-xl border border-border bg-card p-5",t[28]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Monthly Usage"}),t[28]=N):N=t[28],w=S.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:S.map(wi)})]}),t[17]=g?.timeseries,t[18]=f?.timeseries,t[19]=n,t[20]=w,t[21]=_,t[22]=b,t[23]=v,t[24]=N}else w=t[20],_=t[21],b=t[22],v=t[23],N=t[24];let P;t[29]!==w||t[30]!==v||t[31]!==N?(P=s.jsxs("div",{className:v,children:[N,w]}),t[29]=w,t[30]=v,t[31]=N,t[32]=P):P=t[32];let y;return t[33]!==_||t[34]!==b||t[35]!==P?(y=s.jsxs("div",{className:_,children:[b,P]}),t[33]=_,t[34]=b,t[35]=P,t[36]=y):y=t[36],y}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 Pi(t){const e=z.c(31),{connectionId:n}=t,{org:l}=oe(),[i,r]=j.useState(!1);let o;e[0]!==n||e[1]!==l.id?(o={connectionId:n,orgId:l.id},e[0]=n,e[1]=l.id,e[2]=o):o=e[2];const a=he(o);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d={},e[3]=d):d=e[3];let m;e[4]!==a?(m={client:a,toolName:"GATEWAY_USAGE",toolArguments:d,staleTime:3e4,select:_i},e[4]=a,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,C=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 N;e[9]!==_||e[10]!==u||e[11]!==h||e[12]!==n||e[13]!==C||e[14]!==b||e[15]!==g||e[16]!==x||e[17]!==p?(N=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:C,onAddCredit:()=>r(!0),connectionId:n,alert:_}),e[9]=_,e[10]=u,e[11]=h,e[12]=n,e[13]=C,e[14]=b,e[15]=g,e[16]=x,e[17]=p,e[18]=N):N=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 S;return e[27]!==N||e[28]!==P||e[29]!==y?(S=s.jsxs(s.Fragment,{children:[N,P,y]}),e[27]=N,e[28]=P,e[29]=y,e[30]=S):S=e[30],S}function _i(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(Pi,{connectionId:n}),e[2]=n,e[3]=r):r=e[3];let o;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(oi,{}),e[4]=o):o=e[4];let a;e[5]!==r?(a=s.jsxs(st,{value:"summary",className:"flex flex-col gap-4 pt-2",children:[r,o]}),e[5]=r,e[6]=a):a=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]!==a?(c=s.jsxs(s.Fragment,{children:[l,s.jsxs(bl,{defaultValue:"summary",variant:"underline",children:[i,a,d,m]})]}),e[9]=a,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=ls();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 Ks(t.connection_url)}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 Ts(){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 Ft(t){const e=z.c(14),{projectSlug:n,children:l}=t,{org:i}=oe(),{data:r,isLoading:o}=qt(i.id,n);if(o||!r){let f;return e[0]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Ts,{}),e[0]=f):f=e[0],f}const a=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]!==a?(d={id:r.id,organizationId:r.organizationId,slug:r.slug,name:r.name,description:r.description,enabledPlugins:r.enabledPlugins,ui:r.ui,isOrgAdmin:a},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]=a,e[9]=d):d=e[9];const m=d;let c;return e[10]!==l||e[11]!==m||e[12]!==i?(c=s.jsx(Kt,{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=Xt(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(Rl,{}),e[2]=i.sub,e[3]=r):r=e[3];let o;e[4]!==i.sub?(o=i.sub==="plugins"&&s.jsx(Ot,{}),e[4]=i.sub,e[5]=o):o=e[5];let a;e[6]!==i.sub?(a=i.sub==="danger"&&s.jsx(Hl,{}),e[6]=i.sub,e[7]=a):a=e[7];let d;return e[8]!==i.slug||e[9]!==r||e[10]!==o||e[11]!==a?(d=s.jsxs(Ft,{projectSlug:i.slug,children:[r,o,a]}),e[8]=i.slug,e[9]=r,e[10]=o,e[11]=a,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(At,{}),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(Ft,{projectSlug:pe,children:s.jsx(Ot,{})}),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(At,{}),e[19]=r):r=e[19],r}}}function zi(){const t=z.c(23),{isOpen:e,activeSection:n,open:l,close:i}=Vs();let r;t[0]!==i?(r=g=>!g&&i(),t[0]=i,t[1]=r):r=t[1];let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"w-52 shrink-0 border-r border-border"}),t[2]=o):o=t[2];let a;t[3]!==n||t[4]!==l?(a=s.jsx(j.Suspense,{fallback:o,children:s.jsx(_l,{activeSection:n,onNavigate:l})}),t[3]=n,t[4]=l,t[5]=a):a=t[5];let d,m;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Qt,{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:"absolute top-4 right-4 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(Ts,{}),t[10]=f):f=t[10];let u;t[11]!==n?(u=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 p-8 min-w-0 relative",children:[c,u]}),t[13]=c,t[14]=u,t[15]=x):x=t[15];let p;t[16]!==a||t[17]!==x?(p=s.jsx(Yt,{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:[a,x]})}),t[16]=a,t[17]=x,t[18]=p):p=t[18];let h;return t[19]!==e||t[20]!==r||t[21]!==p?(h=s.jsx(Ht,{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 o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("h1",{className:"text-xl font-semibold",children:"Failed to load project"}),e[0]=o):o=e[0];let a;e[1]!==n?(a=s.jsxs("p",{className:"text-muted-foreground text-center",children:['There was an error loading the project "',n,'".']}),e[1]=n,e[2]=a):a=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]!==a||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:[o,a,d,m]}),e[8]=a,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 o;e[1]!==n?(o=s.jsxs("p",{className:"text-muted-foreground text-center",children:['The project "',n,'" does not exist in this organization.']}),e[1]=n,e[2]=o):o=e[2];let a;e[3]!==i||e[4]!==l?(a=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]=a):a=e[5];let d;return e[6]!==o||e[7]!==a?(d=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 p-8",children:[r,o,a]}),e[6]=o,e[7]=a,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=Bs(e),{org:l}=oe(),i=n.org,r=n.project,{data:o,isLoading:a,error:d}=qt(l.id,r);if(a){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(!o){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=o.slug===pe;let c;t[9]!==o.description||t[10]!==o.enabledPlugins||t[11]!==o.id||t[12]!==o.name||t[13]!==o.organizationId||t[14]!==o.slug||t[15]!==o.ui||t[16]!==m?(c={id:o.id,organizationId:o.organizationId,slug:o.slug,name:o.name,description:o.description,enabledPlugins:o.enabledPlugins,ui:o.ui,isOrgAdmin:m},t[9]=o.description,t[10]=o.enabledPlugins,t[11]=o.id,t[12]=o.name,t[13]=o.organizationId,t[14]=o.slug,t[15]=o.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(Ms,{})}),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(Kt,{org:l,project:f,children:[u,x]}),t[20]=f,t[21]=l,t[22]=p):p=t[22],p}function za(){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{za as default};
|
|
1
|
+
import{r as j,c as z,d as ut,j as s,u as oe,O as pe,t as fe,_ as Ls,o as Ft,s as De,b as Ye,m as Fe,l as Wt,k as Ut,K as xe,aE as Ze,c2 as zs,c0 as $s,b0 as Vt,P as Kt,S as it,e as Bs,aC as Ms}from"./index-uOrjFt6t.js";import{u as Gs,a as qt}from"./use-project-Cr1TKfdV.js";import{c as ue,B as te}from"./button-D10odSSz.js";import{c as Rs,d as Fs,b as Ws,a as Yt,D as Ht}from"./dialog-bLBl7se3.js";import{i as Qt}from"./X-DlPknjOM.js";import{u as mt,S as ae}from"./skeleton-B9aXeb5e.js";import{p as Xt,a as Nt,t as Us,i as ft,u as Vs}from"./use-settings-modal-DVxljFTz.js";import{A as Jt}from"./avatar-DjSt5kfT.js";import{t as Zt}from"./Settings01-CF0yl6Tz.js";import{a as Ks,b as qs,c as Ys,T as Hs}from"./tooltip-CooOHv4u.js";import{i as Qs}from"./Check-Dnxirgog.js";import{a as Xs}from"./Copy01--WUANgtG.js";import{S as Re}from"./switch-CkEMQ9Z5.js";import{S as es,a as ts,d as Me,c as ss,b as Js}from"./select-BZB4uvGm.js";import{i as Zs}from"./Code01-D62OImsE.js";import{i as en}from"./Shield01-BVTU_rBf.js";import{n as tn}from"./CheckDone01-BQB-AnYZ.js";import{u as He}from"./useMutation-BYvhr9Wj.js";import{a as ns,F as Te,b as ye,c as be,d as je,f as Le,e as at}from"./form-CSWi3me2.js";import{I as ve}from"./input-C8Cn3OQt.js";import{i as sn}from"./Upload01-yL5uy1IO.js";import{a as Be,u as he,K as nn}from"./constants-V7-3C38y.js";import{T as ln}from"./textarea-CLWsfk4l.js";import{c as rn,h as an,d as on,b as cn,A as dn,e as un,g as mn,a as fn,f as xn}from"./alert-dialog-DrmsJmsN.js";import{u as pn}from"./useQuery-Vrc6Li_H.js";import{L as Ce}from"./label-D84F6EwM.js";import{n as hn}from"./Container-NYiiZyd6.js";import{h as ls}from"./use-connection-DqGqpr6W.js";import{a as gn,c as vn}from"./use-binding-9lQePXv2.js";import{u as yn}from"./use-install-from-registry-iT6pKCDG.js";import{i as bn}from"./Loading01-D2eBBNoh.js";import{s as xt}from"./Plus-CoFNXdPs.js";import{u as jn,a as Nn,b as Cn,i as ce,r as Qe,D as rs,c as Xe,d as ge,s as Ct,e as St,Z as is,g as as,f as os,h as cs,j as Ge,k as pt,l as Je,m as ht,n as Sn,o as wn,p as ds,q as gt,t as vt,v as us,w as Pn,x as ms,y as wt,z as _n,A as kn,B as An,R as In,S as En,C as On,E as Dn,F as fs,G as Tn,H as Ln,I as zn,J as $n,K as Bn,L as Mn,M as Gn,N as Rn,O as Ue,P as Fn,Q as Pt,T as _t,U as kt,V as Wn,W as xs,X as Un,Y as Ee,_ as Vn,$ as Kn,a0 as qn,a1 as Yn,a2 as Hn,a3 as et,a4 as Qn,a5 as Ve,a6 as Xn,a7 as Jn,a8 as Z,a9 as ps,aa as Zn,ab as el,ac as tl,ad as sl,ae as nl,af as ll,ag as rl,ah as il,ai as al,aj as ol,ak as cl,al as dl,am as ul,an as ml,ao as fl,ap as xl,aq as pl,ar as hl}from"./chart-Bp3LQrS9.js";import{B as gl}from"./badge-Dj7JdmaJ.js";import{a as vl,T as tt,b as st,c as yl}from"./tabs-Cqye-vZ-.js";import{i as bl}from"./AlertCircle-Ci70K_EZ.js";import{s as jl}from"./RefreshCcw01-J5wqqeG_.js";import{b as de,a as hs}from"./use-mcp-tools-DuTyW4Xm.js";import{i as Nl}from"./deco-constants-BmtTfZbQ.js";import{u as Cl}from"./use-members-ByAHJbqb.js";import"./localstorage-keys-r_mW6Lq0.js";import"./index-kTXXfvC-.js";import"./ChevronDown-DlCNAUXg.js";import"./binder--zY5y66H.js";import"./extract-connection-data-DyTSTIQR.js";import"./constants-wwWYqq9s.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-CwZm8daW.js";import"./generate-id-Dyweu44Y.js";import"./index-CW4zTmBX.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 Sl=[{key:"general",label:"General",icon:s.jsx(Zt,{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:o}=Gs(i.id,r);let a;e[1]!==n?(a=Xt(n),e[1]=n,e[2]=a):a=e[2];const d=a;let m;if(e[3]!==d?.slug||e[4]!==n||e[5]!==l||e[6]!==o){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(Nt(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:Sl.map(p=>{const h=Nt(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=(o??[]).filter(Pl).map(f),e[3]=d?.slug,e[4]=n,e[5]=l,e[6]=o,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 Pl(t){return t.slug!==pe}function _l(t){const e=z.c(31),{activeSection:n,onNavigate:l}=t,{data:i}=ut.useSession(),[r]=mt(),o=i?.user,a=o?.image,d=o?.name??"Profile",m=o?.name??"U";let c;e[0]!==m||e[1]!==a?(c=s.jsx(Jt,{url:a,fallback:m,shape:"circle",size:"2xs",className:"size-4 shrink-0"}),e[0]=m,e[1]=a,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(Zt,{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(Us,{size:14})},e[10]=g):g=e[10];let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S={key:"org.plugins",label:"Plugins",icon:s.jsx(yt,{size:14})},e[11]=S):S=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=[g,S,{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 N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("p",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground/60",children:"Organization"}),e[18]=N):N=e[18];let P;e[19]!==n||e[20]!==l?(P=s.jsxs("div",{className:"flex flex-col gap-0.5 px-2",children:[N,_.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.128.2"]})}),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 o;t[0]!==i?(o=()=>{i?.id&&navigator.clipboard.writeText(i.id).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)})},t[0]=i,t[1]=o):o=t[1];const a=o;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 S;t[16]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("p",{className:"py-4 text-base font-semibold text-foreground border-b border-border",children:"User ID"}),t[16]=S):S=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(Qs,{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 N;t[22]!==a||t[23]!==b||t[24]!==v?(N=s.jsx(Ks,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:a,className:"group flex items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",children:[b,v]})}),t[22]=a,t[23]=b,t[24]=v,t[25]=N):N=t[25];let P;t[26]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(qs,{side:"left",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),t[26]=P):P=t[26];let y;t[27]!==N?(y=s.jsxs("div",{className:"flex flex-col",children:[S,s.jsxs("div",{className:"flex items-center justify-between gap-6 py-4",children:[w,s.jsx(Ys,{children:s.jsxs(Hs,{children:[N,P]})})]})]}),t[27]=N,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:o,disabled:a}=t,d=a?void 0:o,m=o?"button":void 0,c=o&&!a?0:void 0;let f;e[0]!==a||e[1]!==o?(f=o&&!a?v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),o())}:void 0,e[0]=a,e[1]=o,e[2]=f):f=e[2];const u=o&&!a?"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 S;e[11]!==h||e[12]!==g?(S=s.jsxs("div",{className:"min-w-0",children:[h,g]}),e[11]=h,e[12]=g,e[13]=S):S=e[13];let w;e[14]!==S||e[15]!==p?(w=s.jsxs("div",{className:"flex items-start gap-3 min-w-0 flex-1",children:[p,S]}),e[14]=S,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 At(){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 o;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(Zs,{size:16}),t[3]=o):o=t[3];let a;t[4]!==n?(a=()=>n(Il),t[4]=n,t[5]=a):a=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]!==a||t[12]!==m?(c=s.jsx(nt,{icon:o,label:"Developer Mode",description:"Show technical details like JSON input/output for tool calls.",onClick:a,control:m}),t[11]=a,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(en,{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 S;t[22]!==g?(S=s.jsx(ts,{className:"w-36",children:s.jsx("span",{children:g})}),t[22]=g,t[23]=S):S=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(ss,{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]!==S?(v=s.jsx(nt,{icon:x,label:"Tool Approval",description:"Choose when to require approval before tools execute.",control:s.jsxs(es,{value:e.toolApprovalLevel,onValueChange:p,children:[S,b]})}),t[27]=e.toolApprovalLevel,t[28]=p,t[29]=S,t[30]=v):v=t[30];let N;return t[31]!==v||t[32]!==c||t[33]!==u?(N=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]=N):N=t[34],N}function Il(t){return{...t,devMode:!t.devMode}}function El(t){return{...t,enableNotifications:!1}}function It(t){const e=z.c(22),{icon:n,label:l,description:i,checked:r,onCheckedChange:o}=t;let a;e[0]!==r||e[1]!==o?(a=()=>o(!r),e[0]=r,e[1]=o,e[2]=a):a=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]!==o?(x=s.jsx("div",{onClick:Ol,className:"shrink-0",children:s.jsx(Re,{checked:r,onCheckedChange:o})}),e[15]=r,e[16]=o,e[17]=x):x=e[17];let p;return e[18]!==a||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:a,children:[u,x]}),e[18]=a,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(Ls,{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 o;t[4]!==e.experimental_projects||t[5]!==r?(o=s.jsx(It,{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]=o):o=t[6];let a;t[7]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(tn,{size:16}),t[7]=a):a=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(It,{icon:a,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]!==o||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:[o,m]})]}),t[13]=o,t[14]=m,t[15]=c):c=t[15],c}const Tl=Ft({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 o;e[0]!==l?(o=b=>{const v=b.target.files?.[0];if(v){if(v.size>2097152){fe.error("Image must be smaller than 2MB");return}const N=new FileReader;N.onerror=()=>{const P=N.error;console.error("FileReader error:",P),fe.error(P?.message||"Failed to read image file. Please try again."),r.current&&(r.current.value="")},N.onloadend=()=>{if(N.readyState===FileReader.DONE&&N.result){const P=N.result;l(P)}},N.readAsDataURL(v)}},e[0]=l,e[1]=o):o=e[1];const a=o;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]!==a?(u=s.jsx("input",{type:"file",ref:r,className:"hidden",accept:"image/*",onChange:a}),e[5]=a,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(Qt,{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(sn,{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 S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Recommended: Square image, at least 200x200px. Max 2MB."}),e[16]=S):S=e[16];let w;e[17]!==h||e[18]!==g?(w=s.jsxs("div",{className:"flex-1",children:[h,g,S]}),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),o=Wt({resolver:Ut(Tl),values:{name:e.name??"",slug:e.slug??"",logo:e.logo??""}}),a=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),a.mutate(c)},m=o.formState.isDirty;return s.jsx(ns,{...o,children:s.jsxs("form",{onSubmit:o.handleSubmit(d),className:"space-y-6",children:[s.jsx(Te,{control:o.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:o.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:o.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:o.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:()=>o.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=Ft({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 o=he(r);let a;t[2]===Symbol.for("react.memo_cache_sentinel")?(a=Ut(Bl),t[2]=a):a=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:a,values:{name:d,description:m,themeColor:c}},t[3]=d,t[4]=m,t[5]=c,t[6]=f):f=t[6];const u=Wt(f);let x;t[7]!==o||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 o.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]=o,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 S;t[21]!==g?(S=async T=>{await g.mutateAsync(T)},t[21]=g,t[22]=S):S=t[22];const w=S;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 N;t[29]!==i||t[30]!==g.isPending||t[31]!==b?(N=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]=N):N=t[32];let P;t[33]!==u.control||t[34]!==N?(P=s.jsx(Te,{control:u.control,name:"name",render:N}),t[33]=u.control,t[34]=N,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(ln,{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(ns,{...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,o]=j.useState(""),[a,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 S;t[13]!==h?(S=()=>{h.mutate()},t[13]=h,t[14]=S):S=t[14];const w=S;let _;t[15]===Symbol.for("react.memo_cache_sentinel")?(_=G=>{d(G),G||o("")},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 N;t[17]===Symbol.for("react.memo_cache_sentinel")?(N=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]=N):N=t[17];let P;t[18]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(an,{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(rn,{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(on,{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(cn,{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=>o(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(dn,{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(un,{children:[L,s.jsx(mn,{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(fn,{children:[k,D,T]}),t[38]=k,t[39]=D,t[40]=T,t[41]=O):O=t[41];let M;return t[42]!==a||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:[N,s.jsxs(xn,{open:a,onOpenChange:b,children:[P,O]})]})]}),t[42]=a,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 Et({value:t,onValueChange:e,placeholder:n="Select a connection...",binding:l,bindingType:i,onAddNew:r,className:o,disabled:a=!1}){const[d,m]=j.useState(!1),{installByBinding:c,isInstalling:f}=yn(),u=d||f,x=ls(),p=gn({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=>vn(v,l)):x,g=(()=>{if(!i?.startsWith("@"))return null;const[v,N]=i.replace("@","").split("/");return v&&N?{scope:v,appName:N}:null})(),S=(()=>{let v=h;const N=Array.isArray(l)&&l.length>0;if(g&&!N&&(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=S.find(v=>v.id===t);return s.jsxs(es,{value:t??"none",onValueChange:v=>e(v==="none"?null:v),disabled:a,children:[s.jsx(ts,{size:"sm",className:ue("w-[200px]",o),children:s.jsx(Js,{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(ss,{children:[s.jsx(Me,{value:"none",children:"No connection"}),S.length===0?s.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No compatible connections found"}):S.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||a,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(bn,{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:o,description:a,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 S;e[2]!==n.id||e[3]!==c?(S=xe.projectPluginConfig(c??"",n.id),e[2]=n.id,e[3]=c,e[4]=S):S=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]!==S||e[10]!==w||e[11]!==_?(b={queryKey:S,queryFn:w,enabled:_},e[9]=S,e[10]=w,e[11]=_,e[12]=b):b=e[12];const{data:v,isLoading:N}=pn(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=o!==void 0?o.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]!==a?(T=a&&s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:a}),e[24]=a,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]!==N||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(Ce,{className:"text-xs text-muted-foreground w-24",children:"Connection"}),s.jsx(Et,{value:y??null,onValueChange:V=>u(n.id,V,P),binding:n.binding,placeholder:"Select connection...",className:"w-56",disabled:i||N})]}),I&&s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ce,{className:"text-xs text-muted-foreground w-24",children:"VTEX"}),s.jsx(Et,{value:A??null,onValueChange:V=>x(n.id,V,k,C),binding:$s,placeholder:"Select VTEX connection...",className:"w-56",disabled:i||N})]})]}),e[42]=I,e[43]=N,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({}),[o,a]=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(o).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}))},S=(y,C,k)=>{if(C===k){a(A=>{const{[y]:I,...E}=A;return E});return}a(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({}),a({}),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(o),...Object.keys(d)]),C=Array.from(y).map(k=>{const A=o[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({}),a({}),m({})},N=y=>{const C=zs.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=N(y.id),k=P(y.id),A=x(y.id);return s.jsx(Vl,{plugin:y,isEnabled:A,isSaving:c,pendingBinding:o[y.id],pendingVtexBinding:d[y.id],description:k,label:C?.label??y.id,icon:C?.icon??s.jsx(hn,{size:14}),projectId:e.id,client:l,onBindingChange:S,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 Ot(){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 Dt=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 o=0;console.warn(n.replace(/%s/g,()=>i[o++]))}},Ql=["x1","y1","x2","y2","key"],Xl=["offset"],Jl=["xAxisId","yAxisId"],Zl=["xAxisId","yAxisId"];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 ee(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){er(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 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:o,ry:a}=t;return j.createElement("rect",{x:l,y:i,ry:a,width:r,height:o,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:o,x2:a,y2:d,key:m}=n,c=Ke(n,Ql),f=(i=pt(c))!==null&&i!==void 0?i:{},{offset:u}=f,x=Ke(f,Xl);l=j.createElement("line",Ne({},x,{x1:r,y1:o,x2:a,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:o}=t,a=Ke(t,Jl),d=i.map((m,c)=>{var f=ee(ee({},a),{},{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:o}=t,a=Ke(t,Zl),d=i.map((m,c)=>{var f=ee(ee({},a),{},{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:o,horizontalPoints:a,horizontal:d=!0}=t;if(!d||!e||!e.length||a==null)return null;var m=a.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+o-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:o,height:a,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+o-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:a,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=jn(),n=Nn(),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:o,x:a,y:d,width:m,height:c,syncWithTicks:f,horizontalValues:u,verticalValues:x}=i,p=Xe(),h=ge(C=>Ct(C,"xAxis",r,p)),g=ge(C=>Ct(C,"yAxis",o,p));if(!St(m)||!St(c)||!ce(a)||!ce(d))return null;var S=i.verticalCoordinatesGenerator||cr,w=i.horizontalCoordinatesGenerator||dr,{horizontalPoints:_,verticalPoints:b}=i;if((!_||!_.length)&&typeof w=="function"){var v=u&&u.length,N=w({yAxis:g?ee(ee({},g),{},{ticks:v?u:g.ticks}):void 0,width:e??m,height:n??c,offset:l},v?!0:f);Dt(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(_=N)}if((!b||!b.length)&&typeof S=="function"){var P=x&&x.length,y=S({xAxis:h?ee(ee({},h),{},{ticks:P?x:h.ticks}):void 0,width:e??m,height:n??c,offset:l},P?!0:f);Dt(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),Cs=(t,e,n)=>us(t,"xAxis",gt(t,e),n),Ss=(t,e,n)=>ds(t,"yAxis",vt(t,e),n),ws=(t,e,n)=>us(t,"yAxis",vt(t,e),n),mr=Je([ht,Ns,Ss,Cs,ws],(t,e,n,l,i)=>ms(t,"xAxis")?wt(e,l,!1):wt(n,i,!1)),fr=(t,e)=>e,Ps=Je([_n,fr],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),_s=t=>{var e=ht(t),n=ms(e,"xAxis");return n?"yAxis":"xAxis"},xr=(t,e)=>{var n=_s(t);return n==="yAxis"?vt(t,e):gt(t,e)},pr=(t,e,n)=>kn(t,_s(t),xr(t,e),n),hr=Je([Ps,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,o=r?.find(a=>a.key===i);if(o!=null)return o.map(a=>[a[0],a[1]])}}}),gr=Je([ht,Ns,Ss,Cs,ws,hr,Sn,mr,Ps,wn],(t,e,n,l,i,r,o,a,d,m)=>{var{chartData:c,dataStartIndex:f,dataEndIndex:u}=o;if(!(d==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||l==null||i==null||l.length===0||i.length===0||a==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:a})}}),vr=["id"],yr=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function Se(){return Se=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},Se.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 Lt(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?Lt(Object(n),!0).forEach(function(l){jr(t,l,n[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Lt(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=Cr(t,"string");return typeof e=="symbol"?e:e+""}function Cr(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 Sr=t=>{var{dataKey:e,name:n,stroke:l,fill:i,legendType:r,hide:o}=t;return[{inactive:o,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:o,hide:a,unit:d,tooltipType:m,id:c}=t,f={dataDefinedOnItem:n,getPosition:Ln,settings:{stroke:l,strokeWidth:i,fill:r,dataKey:e,nameKey:void 0,name:fs(o,e),hide:a,type:m,color:qe(l,r),unit:d,graphicalItemId:c}};return j.createElement(Tn,{tooltipEntrySettings:f})});function Pr(t){var{clipPathId:e,points:n,props:l}=t,{needClip:i,dot:r,dataKey:o}=l,a=pt(l);return j.createElement(Qn,{points:n,dot:r,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:a,needClip:i,clipPathId:e})}function _r(t){var{showLabels:e,children:n,points:l}=t,i=l.map(r=>{var o,a,d={x:(o=r.x)!==null&&o!==void 0?o:0,y:(a=r.y)!==null&&a!==void 0?a: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(Yn,{value:e?i:void 0},n)}function zt(t){var{points:e,baseLine:n,needClip:l,clipPathId:i,props:r}=t,{layout:o,type:a,stroke:d,connectNulls:m,isRange:c}=r,{id:f}=r,u=ks(r,vr),x=pt(u),p=Hn(u);return j.createElement(j.Fragment,null,e?.length>1&&j.createElement(Ue,{clipPath:l?"url(#clipPath-".concat(i,")"):void 0},j.createElement(et,Se({},p,{id:f,points:e,connectNulls:m,type:a,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),d!=="none"&&j.createElement(et,Se({},x,{className:"recharts-area-curve",layout:o,type:a,connectNulls:m,fill:"none",points:e})),d!=="none"&&c&&j.createElement(et,Se({},x,{className:"recharts-area-curve",layout:o,type:a,connectNulls:m,fill:"none",points:n}))),j.createElement(Pr,{points:e,props:u,clipPathId:i}))}function kr(t){var e,n,{alpha:l,baseLine:i,points:r,strokeWidth:o}=t,a=(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(a)||!Ve(d))return null;var m=l*Math.abs(a-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:a<d?a:a-m,width:c+(o?parseInt("".concat(o),10):1),height:Math.floor(m)}):null}function Ar(t){var e,n,{alpha:l,baseLine:i,points:r,strokeWidth:o}=t,a=(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(a)||!Ve(d))return null;var m=l*Math.abs(a-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:a<d?a:a-m,y:0,width:m,height:Math.floor(c+(o?parseInt("".concat(o),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:o,baseLine:a,isAnimationActive:d,animationBegin:m,animationDuration:c,animationEasing:f,onAnimationStart:u,onAnimationEnd:x}=l,p=j.useMemo(()=>({points:o,baseLine:a}),[o,a]),h=Wn(p,"recharts-area-"),g=xs(),[S,w]=j.useState(!1),_=!S,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 N=i.current,P=r.current;return j.createElement(_r,{showLabels:_,points:o},l.children,j.createElement(Un,{animationId:h,begin:m,duration:c,isActive:d,easing:f,onAnimationEnd:b,onAnimationStart:v,key:h},y=>{if(N){var C=N.length/o.length,k=y===1?o:o.map((I,E)=>{var D=Math.floor(E*C);if(N[D]){var L=N[D];return Oe(Oe({},I),{},{x:Ee(L.x,I.x,y),y:Ee(L.y,I.y,y)})}return I}),A;return ce(a)?A=Ee(P,a,y):Vn(a)||Kn(a)?A=Ee(P,0,y):A=a.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(zt,{points:k,baseLine:A,needClip:e,clipPathId:n,props:l})}return y>0&&(i.current=o,r.current=a),j.createElement(Ue,null,d&&j.createElement("defs",null,j.createElement("clipPath",{id:"animationClipPath-".concat(n)},j.createElement(Ir,{alpha:y,points:o,baseLine:a,layout:g,strokeWidth:l.strokeWidth}))),j.createElement(Ue,{clipPath:"url(#animationClipPath-".concat(n,")")},j.createElement(zt,{points:o,baseLine:a,needClip:e,clipPathId:n,props:l})))}),j.createElement(qn,{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:o,needClip:a,xAxisId:d,yAxisId:m,width:c,height:f,id:u,baseLine:x,zIndex:p}=this.props;if(e)return null;var h=Vt("recharts-area",i),g=u,{r:S,strokeWidth:w}=Gn(n),_=Rn(n),b=S*2+w,v=a?"url(#clipPath-".concat(_?"":"dots-").concat(g,")"):void 0;return j.createElement(is,{zIndex:p},j.createElement(Ue,{className:h},a&&j.createElement("defs",null,j.createElement(Fn,{clipPathId:g,xAxisId:d,yAxisId:m}),!_&&j.createElement("clipPath",{id:"clipPath-dots-".concat(g)},j.createElement("rect",{x:o-b/2,y:r-b/2,width:c+b,height:f+b}))),j.createElement(Or,{needClip:a,clipPathId:g,props:this.props})),j.createElement(Pt,{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(Pt,{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:o,connectNulls:a,dot:d,fill:m,fillOpacity:c,hide:f,isAnimationActive:u,legendType:x,stroke:p,xAxisId:h,yAxisId:g}=n,S=ks(n,yr),w=zn(),_=$n(),{needClip:b}=Bn(h,g),v=Xe(),{points:N,isRange:P,baseLine:y}=(e=ge(D=>gr(D,t.id,v)))!==null&&e!==void 0?e:{},C=Mn();if(w!=="horizontal"&&w!=="vertical"||C==null||_!=="AreaChart"&&_!=="ComposedChart")return null;var{height:k,width:A,x:I,y:E}=C;return!N||!N.length?null:j.createElement(Dr,Se({},S,{activeDot:l,animationBegin:i,animationDuration:r,animationEasing:o,baseLine:y,connectNulls:a,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:N,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 o=t==="horizontal"?i:l,a=o.scale.domain();if(o.type==="number"){var d=Math.max(a[0],a[1]),m=Math.min(a[0],a[1]);return r==="dataMin"?m:r==="dataMax"||d<0?d:Math.max(Math.min(a[0],a[1]),0)}return r==="dataMin"?a[0]:r==="dataMax"?a[1]:a[0]};function zr(t){var{areaSettings:{connectNulls:e,baseValue:n,dataKey:l},stackedData:i,layout:r,chartBaseValue:o,xAxis:a,yAxis:d,displayedData:m,dataStartIndex:c,xAxisTicks:f,yAxisTicks:u,bandSize:x}=t,p=i&&i.length,h=Lr(r,o,n,a,d),g=r==="horizontal",S=!1,w=m.map((b,v)=>{var N,P,y,C;if(p)C=i[c+v];else{var k=_t(b,l);Array.isArray(k)?(C=k,S=!0):C=[h,k]}var A=(N=(P=C)===null||P===void 0?void 0:P[1])!==null&&N!==void 0?N:null,I=A==null||p&&!e&&_t(b,l)==null;if(g){var E;return{x:kt({axis:a,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=a.scale.map(A))!==null&&y!==void 0?y:null,y:kt({axis:d,ticks:u,bandSize:x,entry:b,index:v}),value:C,payload:b}}),_;return p||S?_=w.map(b=>{var v,N=Array.isArray(b.value)?b.value[0]:null;if(g){var P;return{x:b.x,y:N!=null&&b.y!=null&&(P=d.scale.map(N))!==null&&P!==void 0?P:null,payload:b.payload}}return{x:N!=null&&(v=a.scale.map(N))!==null&&v!==void 0?v:null,y:b.y,payload:b.payload}}):_=g?d.scale.map(h):a.scale.map(h),{points:w,baseLine:_??0,isRange:S}}function $r(t){var e=Qe(t,As),n=Xe();return j.createElement(In,{id:e.id,type:"area"},l=>j.createElement(j.Fragment,null,j.createElement(En,{legendPayload:Sr(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(On,{type:"area",id:l,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:Dn(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),j.createElement(Tr,Se({},e,{id:l}))))}var Is=j.memo($r,An);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 $t(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 Bt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$t(Object(n),!0).forEach(function(l){Rr(t,l,n[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$t(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),o=dl(l,"yAxis",i),a=j.useMemo(()=>{if(o!=null)return Bt(Bt({},r),{},{type:o})},[o,r]);return j.useLayoutEffect(()=>{a!=null&&(n.current===null?e(Zn(a)):n.current!==a&&e(el({prev:n.current,next:a})),n.current=a)},[a,e]),j.useLayoutEffect(()=>()=>{n.current&&(e(tl(n.current)),n.current=null)},[e]),null}function Kr(t){var{yAxisId:e,className:n,width:l,label:i}=t,r=j.useRef(null),o=j.useRef(null),a=ge(sl),d=Xe(),m=ps(),c="yAxis",f=ge(N=>nl(N,e)),u=ge(N=>ll(N,e)),x=ge(N=>rl(N,c,e,d)),p=ge(N=>il(N,e));if(j.useLayoutEffect(()=>{if(!(l!=="auto"||!f||al(i)||j.isValidElement(i)||p==null)){var N=r.current;if(N){var P=N.getCalculatedWidth();Math.round(f.width)!==Math.round(P)&&m(ol({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:S}=t,w=dt(t,Mr),{id:_,scale:b}=p,v=dt(p,Gr);return j.createElement(cl,ct({},w,v,{ref:r,labelRef:o,x:u.x,y:u.y,tickTextProps:l==="auto"?{width:void 0}:{width:l},width:f.width,height:f.height,className:Vt("recharts-".concat(c," ").concat(c),n),viewBox:a,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,Jn);Es.displayName="YAxis";var Hr=["axis"],Qr=j.forwardRef((t,e)=>j.createElement(ul,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Hr,tooltipPayloadSearcher:ml,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 Xr(){try{const t=localStorage.getItem(Os);if(t==="daily"||t==="weekly"||t==="monthly")return t}catch{}return"daily"}function Jr(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:o,currentLimitPeriod:a}=t,{org:d}=oe(),[m,c]=j.useState(null),[f,u]=j.useState(""),[x,p]=j.useState(null),[h,g]=j.useState(null),[S,w]=j.useState(a??"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:N,isPending:P}=hs(v),y=Fe(),C=o==="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=S==="none"?null:S,D=C&&I!=null&&I===r&&E===a;let L;e[7]!==b?(L=nn.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]!==o||e[13]!==a||e[14]!==r||e[15]!==I||e[16]!==C||e[17]!==S||e[18]!==N||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:o,return_url:window.location.href};C&&(le.limit_period=S),N({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(a??"none"),l(!1)},e[12]=o,e[13]=a,e[14]=r,e[15]=I,e[16]=C,e[17]=S,e[18]=N,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(Rs,{children:G}),e[23]=G,e[24]=K):K=e[24];let V;e[25]!==U?(V=s.jsx(Fs,{children:U}),e[25]=U,e[26]=V):V=e[26];let Y;e[27]!==K||e[28]!==V?(Y=s.jsxs(Ws,{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]!==S||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(Ce,{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(Ce,{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(Ce,{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",S===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]=S,e[42]=m,e[43]=H):H=e[43];let X;e[44]!==Y||e[45]!==H?(X=s.jsxs(Yt,{className:"sm:max-w-md",children:[Y,H]}),e[44]=Y,e[45]=H,e[46]=X):X=e[46];let ne;return e[47]!==O||e[48]!==n||e[49]!==X?(ne=s.jsx(Ht,{open:n,onOpenChange:O,children:X}),e[47]=O,e[48]=n,e[49]=X,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 o;e[0]!==i?(o=i?new Date(i).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null,e[0]=i,e[1]=o):o=e[1];const a=o,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]!==a?(c=a&&s.jsxs("span",{children:["(until ",a,")"]}),e[5]=a,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(gl,{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 S;return e[16]!==g||e[17]!==m||e[18]!==c||e[19]!==x||e[20]!==p?(S=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]=S):S=e[21],S}function ri(t){const e=z.c(37),{usage:n,limit:l,limitPeriod:i,onConfigureLimit:r,connectionId:o,alert:a}=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(jl,{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 S;e[19]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(xt,{size:16}),e[19]=S):S=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:[S,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 N;e[30]!==a||e[31]!==o?(N=s.jsx(Ds,{connectionId:o,alert:a,billingMode:"postpaid"}),e[30]=a,e[31]=o,e[32]=N):N=e[32];let P;return e[33]!==b||e[34]!==v||e[35]!==N?(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,N]}),e[33]=b,e[34]=v,e[35]=N,e[36]=P):P=e[36],P}function ii(t){const e=z.c(30),{available:n,total:l,estimation:i,onAddCredit:r,connectionId:o,alert:a}=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 S;e[16]!==n||e[17]!==l||e[18]!==d?(S=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]=S):S=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]!==a||e[23]!==o?(_=s.jsx(Ds,{connectionId:o,alert:a,billingMode:"prepaid"}),e[22]=a,e[23]=o,e[24]=_):_=e[24];let b;return e[25]!==w||e[26]!==_||e[27]!==g||e[28]!==S?(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,S,w,_]}),e[25]=w,e[26]=_,e[27]=g,e[28]=S,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(),[o,a]=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,S]=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:N}=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=()=>{S(null),h(!1);const J=parseFloat(c);if(d&&(!u||!u.includes("@"))){S("A valid email is required to enable alerts.");return}if(Number.isNaN(J)||J<=0){S("Threshold must be a positive number.");return}v({name:"GATEWAY_SET_ALERT",arguments:{enabled:d,threshold_usd:J,...u?{email:u}:{}}},{onSuccess:()=>{h(!0),setTimeout(()=>h(!1),3e3)},onError:we=>{S(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(!o){let J;e[10]===Symbol.for("react.memo_cache_sentinel")?(J=()=>a(!0),e[10]=J):J=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(bl,{size:14,className:"text-muted-foreground"})}),e[11]=we):we=e[11];let Pe;e[12]!==k?(Pe=s.jsx("p",{className:"text-xs font-medium text-foreground",children:k}),e[12]=k,e[13]=Pe):Pe=e[13];let _e;e[14]!==l.enabled||e[15]!==l.threshold_usd||e[16]!==i?(_e=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]=_e):_e=e[17];let ke;e[18]!==_e?(ke=s.jsx("p",{className:"text-[11px] text-muted-foreground",children:_e}),e[18]=_e,e[19]=ke):ke=e[19];let Ae;e[20]!==Pe||e[21]!==ke?(Ae=s.jsxs("div",{className:"flex-1 min-w-0",children:[Pe,ke]}),e[20]=Pe,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:J,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(Ce,{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=J=>f(J.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(Ce,{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=J=>x(J.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 X;e[58]!==g?(X=g&&s.jsx("p",{className:"text-[11px] text-destructive",children:g}),e[58]=g,e[59]=X):X=e[59];let ne;e[60]!==T||e[61]!==H||e[62]!==X?(ne=s.jsxs("div",{className:T,children:[H,X]}),e[60]=T,e[61]=H,e[62]=X,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:()=>a(!1),children:"Cancel"}),e[66]=le):le=e[66];const re=N||!P,se=N?"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 o;t[2]!==e.id?(o={connectionId:Be,orgId:e.id},t[2]=e.id,t[3]=o):o=t[3];const a=he(o);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]!==a||t[8]!==m?(c={client:a,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:m,staleTime:6e4,select:$e},t[7]=a,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]!==a||t[14]!==x?(p={client:a,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:x,staleTime:6e4,select:$e},t[13]=a,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 S;t[17]!==r?(S={widget:g,timeRange:r},t[17]=r,t[18]=S):S=t[18];let w;t[19]!==a||t[20]!==S?(w={client:a,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:S,staleTime:6e4,select:$e},t[19]=a,t[20]=S,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 N=v;let P;if(t[26]!==h?.value||t[27]!==N||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(jt,{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]!==N?(U=N.length>0?s.jsx(fl,{config:ai,className:"h-[200px] w-full",children:s.jsxs(Qr,{data:N,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(xl,{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(pl,{content:s.jsx(hl,{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]=N,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]=N,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(Xr);let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=m=>{n(m),Jr(m)},t[0]=l):l=t[0];const i=l;let r,o;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"}),o=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]=o):(r=t[1],o=t[2]);let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=["daily","weekly","monthly"],t[3]=a):a=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,o,s.jsx("div",{className:"flex gap-2 mt-1",children:a.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:o}=t,a=o===void 0?"bg-chart-1":o;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]!==a?(u=ue("h-full transition-all duration-500 ease-out",a),e[4]=a,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 S;e[13]!==i?(S=i&&s.jsx("span",{className:"text-xs tabular-nums shrink-0 text-muted-foreground",children:i}),e[13]=i,e[14]=S):S=e[14];let w;return e[15]!==f||e[16]!==h||e[17]!==g||e[18]!==S?(w=s.jsxs("div",{className:"flex items-center gap-2",children:[f,h,g,S]}),e[15]=f,e[16]=h,e[17]=g,e[18]=S,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 o;e[2]!==l||e[3]!==i?(o=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]=o):o=e[4];let a;return e[5]!==r||e[6]!==o?(a=s.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-5",children:[r,o]}),e[5]=r,e[6]=o,e[7]=a):a=e[7],a}const Mt={"7d":"7 days","30d":"30 days","90d":"90 days"};function jt(t){const e=z.c(4),{period:n,onPeriodChange:l}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Object.keys(Mt),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(o=>s.jsx("button",{type:"button",onClick:()=>l(o),className:ue("px-2.5 py-1 text-xs font-medium rounded-sm transition-colors",n===o?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:Mt[o]},o))}),e[1]=l,e[2]=n,e[3]=r):r=e[3],r}function Gt(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}=Cl(),o=r?.data?.members??[],a=new Map(o.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",groupByColumn:"connection_title"})),{data:h,isLoading:g}=de(c({fn:"sum",groupByColumn:"user_id"})),{data:S,isLoading:w}=de(c({fn:"count",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:N,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 J;return t[4]===Symbol.for("react.memo_cache_sentinel")?(J=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]=J):J=t[4],J}const C=Gt(f?.groups??[],x?.groups??[]),k=Gt(h?.groups??[],S?.groups??[]).map(B=>({...B,key:a.get(B.key)??B.key})),A=N?.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(jt,{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 X=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]!==X||t[20]!==q||t[21]!==se?(ie=s.jsx(X,{title:ne,empty:q,children:se}),t[19]=X,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 Ci(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"}),o=n.get(r)??{cost:0,calls:0};n.set(r,{cost:o.cost+l.value,calls:o.calls})}for(const l of e){const r=new Date(l.timestamp).toLocaleDateString("en-US",{month:"short",year:"2-digit"}),o=n.get(r)??{cost:0,calls:0};n.set(r,{cost:o.cost,calls:o.calls+l.value})}return Array.from(n.entries()).map(([l,i])=>({month:l,...i})).reverse()}function Si(){const t=z.c(37),{org:e}=oe(),[n,l]=j.useState("90d");let i;t[0]!==n?(i=bt(n),t[0]=n,t[1]=i):i=t[1];const r=i;let o;t[2]!==e.id?(o={connectionId:Be,orgId:e.id},t[2]=e.id,t[3]=o):o=t[3];const a=he(o);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]!==a||t[8]!==m?(c={client:a,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:m,staleTime:6e4,select:$e},t[7]=a,t[8]=m,t[9]=c):c=t[9];const{data:f,isLoading:u}=de(c);let x;t[10]===Symbol.for("react.memo_cache_sentinel")?(x={type:"timeseries",source:{path:ze,from:"output"},aggregation:{fn:"count",interval:"1d"}},t[10]=x):x=t[10];let p;t[11]!==r?(p={widget:x,timeRange:r},t[11]=r,t[12]=p):p=t[12];let h;t[13]!==a||t[14]!==p?(h={client:a,toolName:"MONITORING_WIDGET_PREVIEW",toolArguments:p,staleTime:6e4,select:$e},t[13]=a,t[14]=p,t[15]=h):h=t[15];const{data:g,isLoading:S}=de(h);if(u||S){let C;return t[16]===Symbol.for("react.memo_cache_sentinel")?(C=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[16]=C):C=t[16],C}let w,_,b,v,N;if(t[17]!==g?.timeseries||t[18]!==f?.timeseries||t[19]!==n){const C=Ci(f?.timeseries??[],g?.timeseries??[]);_="flex flex-col gap-4";let k;t[25]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Usage history from monitoring logs"}),t[25]=k):k=t[25],t[26]!==n?(b=s.jsxs("div",{className:"flex items-center justify-between",children:[k,s.jsx(jt,{period:n,onPeriodChange:l})]}),t[26]=n,t[27]=b):b=t[27],v="flex flex-col gap-3 rounded-xl border border-border bg-card p-5",t[28]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("p",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase",children:"Monthly Usage"}),t[28]=N):N=t[28],w=C.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:C.map(wi)})]}),t[17]=g?.timeseries,t[18]=f?.timeseries,t[19]=n,t[20]=w,t[21]=_,t[22]=b,t[23]=v,t[24]=N}else w=t[20],_=t[21],b=t[22],v=t[23],N=t[24];let P;t[29]!==w||t[30]!==v||t[31]!==N?(P=s.jsxs("div",{className:v,children:[N,w]}),t[29]=w,t[30]=v,t[31]=N,t[32]=P):P=t[32];let y;return t[33]!==_||t[34]!==b||t[35]!==P?(y=s.jsxs("div",{className:_,children:[b,P]}),t[33]=_,t[34]=b,t[35]=P,t[36]=y):y=t[36],y}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 Pi(t){const e=z.c(31),{connectionId:n}=t,{org:l}=oe(),[i,r]=j.useState(!1);let o;e[0]!==n||e[1]!==l.id?(o={connectionId:n,orgId:l.id},e[0]=n,e[1]=l.id,e[2]=o):o=e[2];const a=he(o);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d={},e[3]=d):d=e[3];let m;e[4]!==a?(m={client:a,toolName:"GATEWAY_USAGE",toolArguments:d,staleTime:3e4,select:_i},e[4]=a,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,S=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 N;e[9]!==_||e[10]!==u||e[11]!==h||e[12]!==n||e[13]!==S||e[14]!==b||e[15]!==g||e[16]!==x||e[17]!==p?(N=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:S,onAddCredit:()=>r(!0),connectionId:n,alert:_}),e[9]=_,e[10]=u,e[11]=h,e[12]=n,e[13]=S,e[14]=b,e[15]=g,e[16]=x,e[17]=p,e[18]=N):N=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]!==N||e[28]!==P||e[29]!==y?(C=s.jsxs(s.Fragment,{children:[N,P,y]}),e[27]=N,e[28]=P,e[29]=y,e[30]=C):C=e[30],C}function _i(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(vl,{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(Pi,{connectionId:n}),e[2]=n,e[3]=r):r=e[3];let o;e[4]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(oi,{}),e[4]=o):o=e[4];let a;e[5]!==r?(a=s.jsxs(st,{value:"summary",className:"flex flex-col gap-4 pt-2",children:[r,o]}),e[5]=r,e[6]=a):a=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(Si,{})}),e[8]=m):m=e[8];let c;return e[9]!==a?(c=s.jsxs(s.Fragment,{children:[l,s.jsxs(yl,{defaultValue:"summary",variant:"underline",children:[i,a,d,m]})]}),e[9]=a,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=ls();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 Nl(t.connection_url)}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 Ts(){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 Rt(t){const e=z.c(14),{projectSlug:n,children:l}=t,{org:i}=oe(),{data:r,isLoading:o}=qt(i.id,n);if(o||!r){let f;return e[0]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Ts,{}),e[0]=f):f=e[0],f}const a=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]!==a?(d={id:r.id,organizationId:r.organizationId,slug:r.slug,name:r.name,description:r.description,enabledPlugins:r.enabledPlugins,ui:r.ui,isOrgAdmin:a},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]=a,e[9]=d):d=e[9];const m=d;let c;return e[10]!==l||e[11]!==m||e[12]!==i?(c=s.jsx(Kt,{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=Xt(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 o;e[4]!==i.sub?(o=i.sub==="plugins"&&s.jsx(Ot,{}),e[4]=i.sub,e[5]=o):o=e[5];let a;e[6]!==i.sub?(a=i.sub==="danger"&&s.jsx(Hl,{}),e[6]=i.sub,e[7]=a):a=e[7];let d;return e[8]!==i.slug||e[9]!==r||e[10]!==o||e[11]!==a?(d=s.jsxs(Rt,{projectSlug:i.slug,children:[r,o,a]}),e[8]=i.slug,e[9]=r,e[10]=o,e[11]=a,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(At,{}),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(Rt,{projectSlug:pe,children:s.jsx(Ot,{})}),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(At,{}),e[19]=r):r=e[19],r}}}function zi(){const t=z.c(23),{isOpen:e,activeSection:n,open:l,close:i}=Vs();let r;t[0]!==i?(r=g=>!g&&i(),t[0]=i,t[1]=r):r=t[1];let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"w-52 shrink-0 border-r border-border"}),t[2]=o):o=t[2];let a;t[3]!==n||t[4]!==l?(a=s.jsx(j.Suspense,{fallback:o,children:s.jsx(_l,{activeSection:n,onNavigate:l})}),t[3]=n,t[4]=l,t[5]=a):a=t[5];let d,m;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Qt,{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:"absolute top-4 right-4 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(Ts,{}),t[10]=f):f=t[10];let u;t[11]!==n?(u=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 p-8 min-w-0 relative",children:[c,u]}),t[13]=c,t[14]=u,t[15]=x):x=t[15];let p;t[16]!==a||t[17]!==x?(p=s.jsx(Yt,{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:[a,x]})}),t[16]=a,t[17]=x,t[18]=p):p=t[18];let h;return t[19]!==e||t[20]!==r||t[21]!==p?(h=s.jsx(Ht,{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 o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("h1",{className:"text-xl font-semibold",children:"Failed to load project"}),e[0]=o):o=e[0];let a;e[1]!==n?(a=s.jsxs("p",{className:"text-muted-foreground text-center",children:['There was an error loading the project "',n,'".']}),e[1]=n,e[2]=a):a=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]!==a||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:[o,a,d,m]}),e[8]=a,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 o;e[1]!==n?(o=s.jsxs("p",{className:"text-muted-foreground text-center",children:['The project "',n,'" does not exist in this organization.']}),e[1]=n,e[2]=o):o=e[2];let a;e[3]!==i||e[4]!==l?(a=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]=a):a=e[5];let d;return e[6]!==o||e[7]!==a?(d=s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 p-8",children:[r,o,a]}),e[6]=o,e[7]=a,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=Bs(e),{org:l}=oe(),i=n.org,r=n.project,{data:o,isLoading:a,error:d}=qt(l.id,r);if(a){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(!o){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=o.slug===pe;let c;t[9]!==o.description||t[10]!==o.enabledPlugins||t[11]!==o.id||t[12]!==o.name||t[13]!==o.organizationId||t[14]!==o.slug||t[15]!==o.ui||t[16]!==m?(c={id:o.id,organizationId:o.organizationId,slug:o.slug,name:o.name,description:o.description,enabledPlugins:o.enabledPlugins,ui:o.ui,isOrgAdmin:m},t[9]=o.description,t[10]=o.enabledPlugins,t[11]=o.id,t[12]=o.name,t[13]=o.organizationId,t[14]=o.slug,t[15]=o.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(Ms,{})}),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(Kt,{org:l,project:f,children:[u,x]}),t[20]=f,t[21]=l,t[22]=p):p=t[22],p}function za(){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{za as default};
|