decocms 2.285.0 → 2.286.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-0nxz1rX8.js → AlertCircle-DTmaHldD.js} +1 -1
- package/dist/client/assets/{ArrowNarrowLeft-C2eNhBDd.js → ArrowNarrowLeft-DlPeFc4v.js} +1 -1
- package/dist/client/assets/{CheckCircle-CkYTxj_S.js → CheckCircle-DJ3lme5R.js} +1 -1
- package/dist/client/assets/{ChevronDown-CYzIAmcr.js → ChevronDown-DGnjAtqs.js} +1 -1
- package/dist/client/assets/{ChevronRight-DeEIl6Ga.js → ChevronRight-DV9No7GF.js} +1 -1
- package/dist/client/assets/{ChevronUp-MMJijhLH.js → ChevronUp-BkSgkwhO.js} +1 -1
- package/dist/client/assets/{Container-Co8nThxH.js → Container-B1nHZdmn.js} +1 -1
- package/dist/client/assets/DotsVertical-Bp2tW8JI.js +1 -0
- package/dist/client/assets/{LinkExternal01-B1CK34My.js → LinkExternal01-BBbCPDtX.js} +1 -1
- package/dist/client/assets/{Lock01-D0hjzmk2.js → Lock01-DpPIS3K7.js} +1 -1
- package/dist/client/assets/{Palette-Dk9Jb8jx.js → Palette-CI8n49a8.js} +1 -1
- package/dist/client/assets/{Play-BxeG5fNv.js → Play-DKFUTU3G.js} +1 -1
- package/dist/client/assets/{Plus-gZScqBbn.js → Plus-oXFwCrYz.js} +1 -1
- package/dist/client/assets/RefreshCcw01-B10mKiE2.js +1 -0
- package/dist/client/assets/SearchMd-BRJBvWf4.js +1 -0
- package/dist/client/assets/{Settings02-BF97-Fnm.js → Settings02-Dm9dFDqk.js} +1 -1
- package/dist/client/assets/Shield01-BZJVBd5S.js +1 -0
- package/dist/client/assets/{Star01-yc5vq0ru.js → Star01-_IJK5Yjt.js} +1 -1
- package/dist/client/assets/{Sun-B0IvK7nO.js → Sun-QqE1VnS_.js} +1 -1
- package/dist/client/assets/{Tool01-BtxOSAs7.js → Tool01-CKowkGsd.js} +1 -1
- package/dist/client/assets/{Trash01-Cv5TKLdc.js → Trash01-C6bAXG6g.js} +1 -1
- package/dist/client/assets/{User01-Bm0y4lC0.js → User01-C2-anwoO.js} +1 -1
- package/dist/client/assets/{Users03-BjqYs6sm.js → Users03-DqYvPeZM.js} +1 -1
- package/dist/client/assets/{X-D_cmo_DI.js → X-i9zBn6Hn.js} +1 -1
- package/dist/client/assets/XCircle-C1sJYG9R.js +1 -0
- package/dist/client/assets/XClose-BbIo6xHe.js +1 -0
- package/dist/client/assets/{Zap-MBVwanCx.js → Zap-KmbRMccM.js} +1 -1
- package/dist/client/assets/{ZapSquare-Acx_yvzd.js → ZapSquare-DT93lGV4.js} +1 -1
- package/dist/client/assets/{accordion-Bs6iOXfP.js → accordion-BV3tm7bj.js} +1 -1
- package/dist/client/assets/agent-icon-CyE6nkC1.js +1 -0
- package/dist/client/assets/agents-list-7o6gZt-q.js +1 -0
- package/dist/client/assets/ai-providers-DI3UF9nU.js +1 -0
- package/dist/client/assets/{alert-dialog-CGn0S0CC.js → alert-dialog-CicrCOay.js} +2 -2
- package/dist/client/assets/{auth-catchall-LYMGDHGY.js → auth-catchall-Cyd7fWQv.js} +1 -1
- package/dist/client/assets/automation-list-row-B4Vfg4UC.js +1 -0
- package/dist/client/assets/automations-DRM_lJom.js +1 -0
- package/dist/client/assets/{avatar-B4iYr4Pn.js → avatar-CF1bgUpD.js} +1 -1
- package/dist/client/assets/{badge-BKbfqB0P.js → badge-s_TAXGUN.js} +1 -1
- package/dist/client/assets/{brand-context-eZ6U4eZs.js → brand-context-iopLFZ2k.js} +1 -1
- package/dist/client/assets/{card-C6TLc-pg.js → card-CaekC2K0.js} +1 -1
- package/dist/client/assets/{chat-context-bxvplF3Z.js → chat-context-DP5UfIrn.js} +1 -1
- package/dist/client/assets/{checkbox-BafUZKEr.js → checkbox-DznLgPgR.js} +1 -1
- package/dist/client/assets/collection-detail-CTQuhG7N.js +1 -0
- package/dist/client/assets/collection-display-button-BgYKhoGQ.js +1 -0
- package/dist/client/assets/{collection-search-BSwS6tWM.js → collection-search-Bo2bOvRn.js} +1 -1
- package/dist/client/assets/{collection-search-_WhBw8st.js → collection-search-DMqppne6.js} +1 -1
- package/dist/client/assets/collection-table-wrapper-KnWZIddd.js +1 -0
- package/dist/client/assets/{collection-tabs-Cegi88gO.js → collection-tabs-CU6MCzSn.js} +1 -1
- package/dist/client/assets/{collections-CJcBtWs5.js → collections-DHmXATua.js} +1 -1
- package/dist/client/assets/command-D4w2xkZT.js +1 -0
- package/dist/client/assets/{connection-card-pbt5_GMK.js → connection-card-DBz-rrLk.js} +1 -1
- package/dist/client/assets/connection-detail-zHqb5ZSw.js +1 -0
- package/dist/client/assets/{connection-form-helpers-B-iFdAbF.js → connection-form-helpers-CBEV0IXi.js} +1 -1
- package/dist/client/assets/connections-CHiGbl1F.js +1 -0
- package/dist/client/assets/{constants-BgpFj97_.js → constants-DDHDU3PV.js} +1 -1
- package/dist/client/assets/{constants-Dp_2h6cY.js → constants-v4RUVkEN.js} +1 -1
- package/dist/client/assets/{dialog-BlDJEasr.js → dialog-C4lREl-t.js} +1 -1
- package/dist/client/assets/{drawer-n2769KGk.js → drawer-BTCEaGGQ.js} +1 -1
- package/dist/client/assets/dropdown-menu-v2GifVOh.js +1 -0
- package/dist/client/assets/{dynamic-plugin-layout-D7LPOea8.js → dynamic-plugin-layout-CVBBnlEt.js} +1 -1
- package/dist/client/assets/{empty-state-Di9idjlO.js → empty-state-BdQTFnZA.js} +1 -1
- package/dist/client/assets/{empty-state-CCV3q11p.js → empty-state-DdKZ_is7.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BkZ-2zmr.js → extract-connection-data-CfXvFcGA.js} +1 -1
- package/dist/client/assets/{features-BnFC3Zii.js → features-fsR9zLkr.js} +1 -1
- package/dist/client/assets/{form-2LsJQI5E.js → form-D7DN8UcB.js} +1 -1
- package/dist/client/assets/general-WQbdllPl.js +1 -0
- package/dist/client/assets/{github-repo-picker-DnkATBdp.js → github-repo-picker-DZqLC6FL.js} +2 -2
- package/dist/client/assets/index-BCwsJqWc.css +1 -0
- package/dist/client/assets/{index-DRvZCWzg.js → index-C5AR7k1c.js} +1 -1
- package/dist/client/assets/{index-BqgOT0Li.js → index-CHKi_s_a.js} +1 -1
- package/dist/client/assets/{index-DAwDZKfR.js → index-D-RCnwJQ.js} +1 -1
- package/dist/client/assets/{index-DHvfV22T.js → index-D34n6J5J.js} +22 -22
- package/dist/client/assets/{index-BZMU1-Zz.js → index-DBclwIf_.js} +3 -3
- package/dist/client/assets/{index-CYT7K8Th.js → index-DnJZfbsP.js} +3 -3
- package/dist/client/assets/{index-D748RB59.js → index-FnxI6OGR.js} +1 -1
- package/dist/client/assets/{index-CWVXiaiz.js → index-e3AFJ_dX.js} +1 -1
- package/dist/client/assets/{index-DGbBxceU.js → index-qXZ0t4XR.js} +25 -25
- package/dist/client/assets/{index-BXweTbWN.js → index-zDq2Zqio.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-BgQN01Hf.js → infiniteQueryObserver-1_M-sq16.js} +1 -1
- package/dist/client/assets/{input-CDeKOB27.js → input-urtyHxks.js} +1 -1
- package/dist/client/assets/{integration-icon-CI13mmaS.js → integration-icon-Cdkk9YPE.js} +1 -1
- package/dist/client/assets/{label-CnjZ_mJO.js → label-Bt4h_QUk.js} +1 -1
- package/dist/client/assets/{layout-BiEb87aZ.js → layout-B5SDe6IW.js} +1 -1
- package/dist/client/assets/{login-BfsLvipz.js → login-7zFMf3C1.js} +1 -1
- package/dist/client/assets/members-Dy7hWkQ8.js +3 -0
- package/dist/client/assets/{monaco-editor-CtX0YP6U.js → monaco-editor-lveN-AoO.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-BQ4J0Yec.js → monitoring-stats-row-D3x0_phM.js} +1 -1
- package/dist/client/assets/{oauth-callback-BN4EOUXR.js → oauth-callback-BJALVgfT.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-BaqShyIl.js → oauth-callback-ai-provider-o8Hfz-wL.js} +1 -1
- package/dist/client/assets/{onboarding-DsfytkRm.js → onboarding-DlI3PsIA.js} +1 -1
- package/dist/client/assets/{org-layout-BfWUJisr.js → org-layout-DPzm8vzJ.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-BBYslPfT.js → org-plugin-layout-DB72TzxO.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-B5LlIWxc.js → plugin-empty-state-BzyxU1IF.js} +1 -1
- package/dist/client/assets/{plugin-header-Bk48Ukf6.js → plugin-header-hJH6-4Nr.js} +1 -1
- package/dist/client/assets/{plugin-layout-BKF_beSo.js → plugin-layout-l_MDXBYc.js} +1 -1
- package/dist/client/assets/{popover-xVRU-oRu.js → popover-j_PzMtdY.js} +1 -1
- package/dist/client/assets/{profile-D-jM1gw3.js → profile-lf_QL3Ye.js} +1 -1
- package/dist/client/assets/project-app-view-DuFzKNXE.js +1 -0
- package/dist/client/assets/registry-D3m_WKwq.js +2 -0
- package/dist/client/assets/{registry-layout-DnwI9vdC.js → registry-layout-DRb_iR_v.js} +3 -3
- package/dist/client/assets/{required-auth-layout-B1r3oQ4H.js → required-auth-layout-C2o7AZ4K.js} +1 -1
- package/dist/client/assets/{reset-password-DSTvsN7x.js → reset-password-DTEY3I_i.js} +1 -1
- package/dist/client/assets/roles-DW1_Kn6r.js +1 -0
- package/dist/client/assets/{scroll-area-D5mZ0hRE.js → scroll-area-BebfgLv6.js} +1 -1
- package/dist/client/assets/{search-input-Dq6mcRO6.js → search-input-dmuYGYsk.js} +1 -1
- package/dist/client/assets/{select-DVBzN73v.js → select-CePxsPeP.js} +1 -1
- package/dist/client/assets/{select-model-CT_wRRZk.js → select-model-QQ7yjZl9.js} +2 -2
- package/dist/client/assets/settings-layout-Cd1tdTnr.js +1 -0
- package/dist/client/assets/{shell-layout-DaX2wZ77.js → shell-layout-BE22YA40.js} +1 -1
- package/dist/client/assets/{skeleton-BZGew3qV.js → skeleton-C9NsUzIb.js} +1 -1
- package/dist/client/assets/{sso-CSm1qVA0.js → sso-QSGlyP2n.js} +1 -1
- package/dist/client/assets/{store-BLxzwqyY.js → store-BB9yi6PD.js} +1 -1
- package/dist/client/assets/store-registry-BSp-W72J.js +2 -0
- package/dist/client/assets/{switch-DhZAgC2R.js → switch-VBeL01bM.js} +1 -1
- package/dist/client/assets/{table-PpA3iGsP.js → table-CQMW-Toa.js} +1 -1
- package/dist/client/assets/{tabs-CqvMN_xV.js → tabs-DOoLL5wa.js} +1 -1
- package/dist/client/assets/{task-status-fLMf5O9c.js → task-status-vvRP86lz.js} +7 -7
- package/dist/client/assets/{textarea-8UV3LDMX.js → textarea-Ie4QUdo5.js} +1 -1
- package/dist/client/assets/{toggle-group-Brc7WatS.js → toggle-group-C077Smww.js} +1 -1
- package/dist/client/assets/tools-list-UnPsMGhr.js +1 -0
- package/dist/client/assets/{types-C318llZ2.js → types-D4PfKOFF.js} +1 -1
- package/dist/client/assets/{use-ai-providers-Do6DYo3A.js → use-ai-providers-DHuVj1kn.js} +1 -1
- package/dist/client/assets/{use-collections-B6b08eGL.js → use-collections-DRlHpXQL.js} +1 -1
- package/dist/client/assets/{use-connection-B4n7P5ZX.js → use-connection-Cif-LY0f.js} +1 -1
- package/dist/client/assets/{use-copy-D_fZmQan.js → use-copy-uiSuMvtc.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-jrLS8Jsa.js → use-create-virtual-mcp-CBpw3zXA.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-BaTABZmJ.js → use-decopilot-events-Dpt6CcIN.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CRBBtM2M.js → use-delete-connection-BZmW9ZAz.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-E-ClEQ_w.js → use-infinite-scroll-CWlV3gJA.js} +1 -1
- package/dist/client/assets/{use-list-state-DueB6o1G.js → use-list-state-BJZWeXjY.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-BGEi8TMH.js → use-mcp-tools-BYVtg7WH.js} +1 -1
- package/dist/client/assets/{use-members-C-n0fYdD.js → use-members-M_p47epa.js} +1 -1
- package/dist/client/assets/{use-mobile-DHF6z3l-.js → use-mobile-CxvYCzu9.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-CVVCVmb_.js → use-navigate-to-agent-CFIKBq0L.js} +1 -1
- package/dist/client/assets/{use-org-sso-CVSlB5eM.js → use-org-sso-CACnH9GQ.js} +1 -1
- package/dist/client/assets/use-organization-roles-o4lVU0iD.js +1 -0
- package/dist/client/assets/{use-organization-settings-hZWDePgg.js → use-organization-settings-BD9CIHH5.js} +1 -1
- package/dist/client/assets/{use-registry-connections-DE87auCx.js → use-registry-connections-DR_etJ2H.js} +1 -1
- package/dist/client/assets/{use-status-sounds-DmiUFixH.js → use-status-sounds-Ce7WandB.js} +1 -1
- package/dist/client/assets/{use-tasks-BtKmvszc.js → use-tasks-Dpp1DK1f.js} +1 -1
- package/dist/client/assets/{use-view-mode-C4RBFxYO.js → use-view-mode-CZPzVaxj.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-ByUoWLLO.js → use-virtual-mcp-0vHwLInn.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-B4w-6TrV.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-WURyRq6p.js +1 -0
- package/dist/client/assets/{user-xlREBAPA.js → user-xj80BAo3.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DhKikjfW.js → view-mode-toggle-D5CGwPOj.js} +1 -1
- package/dist/client/assets/workflow-CD_DiE5j.js +1 -0
- package/dist/client/assets/workflow-detail-CxWEb-ID.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +2 -2
- package/dist/server/node_modules/{postgres-bytea/license → pg/LICENSE} +6 -6
- package/dist/server/node_modules/pg/README.md +95 -0
- package/dist/server/node_modules/pg/esm/index.mjs +20 -0
- package/dist/server/node_modules/pg/lib/client.js +743 -0
- package/dist/server/node_modules/pg/lib/connection-parameters.js +171 -0
- package/dist/server/node_modules/pg/lib/connection.js +221 -0
- package/dist/server/node_modules/pg/lib/crypto/cert-signatures.js +122 -0
- package/dist/server/node_modules/pg/lib/crypto/sasl.js +212 -0
- package/dist/server/node_modules/pg/lib/crypto/utils-legacy.js +43 -0
- package/dist/server/node_modules/pg/lib/crypto/utils-webcrypto.js +89 -0
- package/dist/server/node_modules/pg/lib/crypto/utils.js +9 -0
- package/dist/server/node_modules/pg/lib/defaults.js +91 -0
- package/dist/server/node_modules/pg/lib/index.js +73 -0
- package/dist/server/node_modules/pg/lib/native/client.js +323 -0
- package/dist/server/node_modules/pg/lib/native/index.js +2 -0
- package/dist/server/node_modules/pg/lib/native/query.js +165 -0
- package/dist/server/node_modules/pg/lib/query.js +252 -0
- package/dist/server/node_modules/pg/lib/result.js +109 -0
- package/dist/server/node_modules/pg/lib/stream.js +83 -0
- package/dist/server/node_modules/pg/lib/type-overrides.js +35 -0
- package/dist/server/node_modules/pg/lib/utils.js +217 -0
- package/dist/server/node_modules/pg/package.json +76 -0
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/SearchMd-DmmmzJIi.js +0 -1
- package/dist/client/assets/XCircle-DofWfDB_.js +0 -1
- package/dist/client/assets/agent-icon-B4FOoeEp.js +0 -1
- package/dist/client/assets/agents-list-CCDumukV.js +0 -1
- package/dist/client/assets/ai-providers-DmtetLwH.js +0 -1
- package/dist/client/assets/automation-list-row-CKWNl7Xx.js +0 -1
- package/dist/client/assets/automations-t-caERGV.js +0 -1
- package/dist/client/assets/collection-detail-I5bQPS94.js +0 -1
- package/dist/client/assets/collection-display-button-D58wr6x3.js +0 -1
- package/dist/client/assets/collection-table-wrapper-DoehWRok.js +0 -1
- package/dist/client/assets/command-BDTuhAyF.js +0 -1
- package/dist/client/assets/connection-detail-CpUnSGYQ.js +0 -1
- package/dist/client/assets/connections-COVM3fme.js +0 -1
- package/dist/client/assets/dropdown-menu-DwLxT3z1.js +0 -1
- package/dist/client/assets/general-gsvbF_Za.js +0 -1
- package/dist/client/assets/index-DeSgX7LP.css +0 -1
- package/dist/client/assets/members-COWr_hPe.js +0 -3
- package/dist/client/assets/project-app-view-CjbRHagh.js +0 -1
- package/dist/client/assets/registry-iJ2QFmg-.js +0 -2
- package/dist/client/assets/settings-layout-D70kmFKJ.js +0 -1
- package/dist/client/assets/store-registry-BdrjcFsM.js +0 -2
- package/dist/client/assets/tools-list-BbeD_D_r.js +0 -1
- package/dist/client/assets/useInfiniteQuery-m9L0mxCO.js +0 -1
- package/dist/client/assets/workflow-Z523A-0v.js +0 -1
- package/dist/client/assets/workflow-detail-CLjOJ-4m.js +0 -1
- package/dist/server/node_modules/mimic-fn/index.d.ts +0 -54
- package/dist/server/node_modules/mimic-fn/index.js +0 -13
- package/dist/server/node_modules/mimic-fn/license +0 -9
- package/dist/server/node_modules/mimic-fn/package.json +0 -42
- package/dist/server/node_modules/mimic-fn/readme.md +0 -69
- package/dist/server/node_modules/pg-int8/LICENSE +0 -13
- package/dist/server/node_modules/pg-int8/README.md +0 -16
- package/dist/server/node_modules/pg-int8/index.js +0 -100
- package/dist/server/node_modules/pg-int8/package.json +0 -24
- package/dist/server/node_modules/postgres-array/index.d.ts +0 -4
- package/dist/server/node_modules/postgres-array/index.js +0 -97
- package/dist/server/node_modules/postgres-array/license +0 -21
- package/dist/server/node_modules/postgres-array/package.json +0 -35
- package/dist/server/node_modules/postgres-array/readme.md +0 -43
- package/dist/server/node_modules/postgres-bytea/index.js +0 -33
- package/dist/server/node_modules/postgres-bytea/package.json +0 -34
- package/dist/server/node_modules/postgres-bytea/readme.md +0 -34
- package/dist/server/node_modules/postgres-date/index.js +0 -116
- package/dist/server/node_modules/postgres-date/license +0 -21
- package/dist/server/node_modules/postgres-date/package.json +0 -33
- package/dist/server/node_modules/postgres-date/readme.md +0 -49
- package/dist/server/node_modules/postgres-interval/index.d.ts +0 -20
- package/dist/server/node_modules/postgres-interval/index.js +0 -125
- package/dist/server/node_modules/postgres-interval/license +0 -21
- package/dist/server/node_modules/postgres-interval/package.json +0 -36
- package/dist/server/node_modules/postgres-interval/readme.md +0 -48
- package/dist/server/node_modules/split2/LICENSE +0 -13
- package/dist/server/node_modules/split2/README.md +0 -85
- package/dist/server/node_modules/split2/bench.js +0 -27
- package/dist/server/node_modules/split2/index.js +0 -141
- package/dist/server/node_modules/split2/package.json +0 -39
- package/dist/server/node_modules/split2/test.js +0 -409
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as O,J as xt,v as se,y as P,aK as ve,aI as be,a_ as je,aJ as _e,e as $,j as l,E as Le,s as ne,o as fe,a as le,K as X,n as Ke,c as ie,x as ye,w as Se,z as Y,aB as pe,t as Z,B as te,aD as $e,u as pt,f as gt,D as bt}from"./index-
|
|
1
|
+
import{r as O,J as xt,v as se,y as P,aK as ve,aI as be,a_ as je,aJ as _e,e as $,j as l,E as Le,s as ne,o as fe,a as le,K as X,n as Ke,c as ie,x as ye,w as Se,z as Y,aB as pe,t as Z,B as te,aD as $e,u as pt,f as gt,D as bt}from"./index-D34n6J5J.js";import{C as vt}from"./checkbox-DznLgPgR.js";import{I as oe}from"./input-urtyHxks.js";import{d as Be,c as Ue,a as jt,D as Ve,e as yt,b as We,h as St}from"./dialog-C4lREl-t.js";import{g as Nt,a as wt,b as _t,c as Ct}from"./drawer-BTCEaGGQ.js";import{u as It}from"./use-mobile-CxvYCzu9.js";import{a as kt,c as Et,d as Mt,S as At,b as Ot}from"./select-CePxsPeP.js";import{S as W}from"./skeleton-C9NsUzIb.js";import{i as Tt,t as Rt,b as Pt,a as zt,c as Ft}from"./Tool01-CKowkGsd.js";import{b as qe,s as He,c as Dt,a as Lt,i as Kt}from"./RefreshCcw01-B10mKiE2.js";import{t as Ce}from"./ChevronDown-DGnjAtqs.js";import{a as Qe,i as Ge}from"./SearchMd-BRJBvWf4.js";import{a as $t}from"./Settings02-Dm9dFDqk.js";import{u as ae,b as Ye,a as ue}from"./use-ai-providers-DHuVj1kn.js";import{p as Ie,u as Xe}from"./chat-context-DP5UfIrn.js";import{g as Ne}from"./ai-providers-logos-CS4PCiqI.js";import{i as Bt}from"./Zap-KmbRMccM.js";import{i as Ut}from"./AlertCircle-DTmaHldD.js";import{i as Vt}from"./CheckCircle-DJ3lme5R.js";import{s as Wt}from"./Trash01-C6bAXG6g.js";import{P as he}from"./index-zDq2Zqio.js";import{C as Je,b as qt,c as Ht,a as Qt}from"./card-CaekC2K0.js";import{S as Gt}from"./switch-VBeL01bM.js";import{a as ke,T as Yt}from"./toggle-group-C077Smww.js";import{A as Xt}from"./avatar-CF1bgUpD.js";import{c as Ze,b as et,d as tt,A as st,e as lt,g as it,a as nt,f as ot}from"./alert-dialog-CicrCOay.js";import{S as ce,u as de}from"./constants-DDHDU3PV.js";import{e as Jt,f as Zt}from"./use-organization-settings-BD9CIHH5.js";import{f as es}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as ts}from"./unwrap-tool-result-BYXdCQMg.js";function re(t,e,s){let n=s.initialDeps??[],i,o=!0;function r(){var a,d,m;let c;s.key&&((a=s.debug)!=null&&a.call(s))&&(c=Date.now());const u=t();if(!(u.length!==n.length||u.some((v,b)=>n[b]!==v)))return i;n=u;let f;if(s.key&&((d=s.debug)!=null&&d.call(s))&&(f=Date.now()),i=e(...u),s.key&&((m=s.debug)!=null&&m.call(s))){const v=Math.round((Date.now()-c)*100)/100,b=Math.round((Date.now()-f)*100)/100,w=b/16,j=(x,y)=>{for(x=String(x);x.length<y;)x=" "+x;return x};console.info(`%c⏱ ${j(b,5)} /${j(v,5)} ms`,`
|
|
2
2
|
font-size: .6rem;
|
|
3
3
|
font-weight: bold;
|
|
4
|
-
color: hsl(${Math.max(0,Math.min(120-120*w,120))}deg 100% 31%);`,s?.key)}return s?.onChange&&!(o&&s.skipInitialOnChange)&&s.onChange(i),o=!1,i}return r.updateDeps=a=>{n=a},r}function Ee(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const ss=(t,e)=>Math.abs(t-e)<1.01,ls=(t,e,s)=>{let n;return function(...i){t.clearTimeout(n),n=t.setTimeout(()=>e.apply(this,i),s)}},Me=t=>{const{offsetWidth:e,offsetHeight:s}=t;return{width:e,height:s}},is=t=>t,ns=t=>{const e=Math.max(t.startIndex-t.overscan,0),s=Math.min(t.endIndex+t.overscan,t.count-1),n=[];for(let i=e;i<=s;i++)n.push(i);return n},os=(t,e)=>{const s=t.scrollElement;if(!s)return;const n=t.targetWindow;if(!n)return;const i=r=>{const{width:a,height:d}=r;e({width:Math.round(a),height:Math.round(d)})};if(i(Me(s)),!n.ResizeObserver)return()=>{};const o=new n.ResizeObserver(r=>{const a=()=>{const d=r[0];if(d?.borderBoxSize){const m=d.borderBoxSize[0];if(m){i({width:m.inlineSize,height:m.blockSize});return}}i(Me(s))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(s,{box:"border-box"}),()=>{o.unobserve(s)}},Ae={passive:!0},Oe=typeof window>"u"?!0:"onscrollend"in window,rs=(t,e)=>{const s=t.scrollElement;if(!s)return;const n=t.targetWindow;if(!n)return;let i=0;const o=t.options.useScrollendEvent&&Oe?()=>{}:ls(n,()=>{e(i,!1)},t.options.isScrollingResetDelay),r=c=>()=>{const{horizontal:u,isRtl:h}=t.options;i=u?s.scrollLeft*(h&&-1||1):s.scrollTop,o(),e(i,c)},a=r(!0),d=r(!1);s.addEventListener("scroll",a,Ae);const m=t.options.useScrollendEvent&&Oe;return m&&s.addEventListener("scrollend",d,Ae),()=>{s.removeEventListener("scroll",a),m&&s.removeEventListener("scrollend",d)}},as=(t,e,s)=>{if(e?.borderBoxSize){const n=e.borderBoxSize[0];if(n)return Math.round(n[s.options.horizontal?"inlineSize":"blockSize"])}return t[s.options.horizontal?"offsetWidth":"offsetHeight"]},cs=(t,{adjustments:e=0,behavior:s},n)=>{var i,o;const r=t+e;(o=(i=n.scrollElement)==null?void 0:i.scrollTo)==null||o.call(i,{[n.options.horizontal?"left":"top"]:r,behavior:s})};class ds{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var s,n,i;return((i=(n=(s=this.targetWindow)==null?void 0:s.performance)==null?void 0:n.now)==null?void 0:i.call(n))??Date.now()},this.observer=(()=>{let s=null;const n=()=>s||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:s=new this.targetWindow.ResizeObserver(i=>{i.forEach(o=>{const r=()=>{const a=o.target,d=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(a,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var i;(i=n())==null||i.disconnect(),s=null},observe:i=>{var o;return(o=n())==null?void 0:o.observe(i,{box:"border-box"})},unobserve:i=>{var o;return(o=n())==null?void 0:o.unobserve(i)}}})(),this.range=null,this.setOptions=s=>{Object.entries(s).forEach(([n,i])=>{typeof i>"u"&&delete s[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:is,rangeExtractor:ns,onChange:()=>{},measureElement:as,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...s}},this.notify=s=>{var n,i;(i=(n=this.options).onChange)==null||i.call(n,this,s)},this.maybeNotify=re(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),s=>{this.notify(s)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(s=>s()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var s;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((s=this.scrollElement)==null?void 0:s.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=o,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(s,n)=>{const i=new Map,o=new Map;for(let r=n-1;r>=0;r--){const a=s[r];if(i.has(a.lane))continue;const d=o.get(a.lane);if(d==null||a.end>d.end?o.set(a.lane,a):a.end<d.end&&i.set(a.lane,!0),i.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((r,a)=>r.end===a.end?r.index-a.index:r.end-a.end)[0]:void 0},this.getMeasurementOptions=re(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(s,n,i,o,r,a,d)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:s,paddingStart:n,scrollMargin:i,getItemKey:o,enabled:r,lanes:a,laneAssignmentMode:d}),{key:!1}),this.getMeasurements=re(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:s,paddingStart:n,scrollMargin:i,getItemKey:o,enabled:r,lanes:a,laneAssignmentMode:d},m)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>s)for(const f of this.laneAssignments.keys())f>=s&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===s&&(this.lanesSettling=!1);const u=this.measurementsCache.slice(0,c),h=new Array(a).fill(void 0);for(let f=0;f<c;f++){const v=u[f];v&&(h[v.lane]=f)}for(let f=c;f<s;f++){const v=o(f),b=this.laneAssignments.get(f);let w,j;const x=d==="estimate"||m.has(v);if(b!==void 0&&this.options.lanes>1){w=b;const g=h[w],N=g!==void 0?u[g]:void 0;j=N?N.end+this.options.gap:n+i}else{const g=this.options.lanes===1?u[f-1]:this.getFurthestMeasurement(u,f);j=g?g.end+this.options.gap:n+i,w=g?g.lane:f%this.options.lanes,this.options.lanes>1&&x&&this.laneAssignments.set(f,w)}const y=m.get(v),S=typeof y=="number"?y:this.options.estimateSize(f),_=j+S;u[f]={index:f,start:j,size:S,end:_,key:v,lane:w},h[w]=f}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=re(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(s,n,i,o)=>this.range=s.length>0&&n>0?ms({measurements:s,outerSize:n,scrollOffset:i,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=re(()=>{let s=null,n=null;const i=this.calculateRange();return i&&(s=i.startIndex,n=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,s,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,s,n]},(s,n,i,o,r)=>o===null||r===null?[]:s({startIndex:o,endIndex:r,overscan:n,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=s=>{const n=this.options.indexAttribute,i=s.getAttribute(n);return i?parseInt(i,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=s=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(i!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,i-o),a=Math.min(this.options.count-1,i+o);return s>=r&&s<=a}return!0},this.measureElement=s=>{if(!s){this.elementsCache.forEach((r,a)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(a))});return}const n=this.indexFromElement(s),i=this.options.getItemKey(n),o=this.elementsCache.get(i);o!==s&&(o&&this.observer.unobserve(o),this.observer.observe(s),this.elementsCache.set(i,s)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(s,void 0,this))},this.resizeItem=(s,n)=>{var i;const o=this.measurementsCache[s];if(!o)return;const r=this.itemSizeCache.get(o.key)??o.size,a=n-r;a!==0&&(((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,a,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,n)),this.notify(!1))},this.getVirtualItems=re(()=>[this.getVirtualIndexes(),this.getMeasurements()],(s,n)=>{const i=[];for(let o=0,r=s.length;o<r;o++){const a=s[o],d=n[a];i.push(d)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=s=>{const n=this.getMeasurements();if(n.length!==0)return Ee(n[rt(0,n.length-1,i=>Ee(n[i]).start,s)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const s=this.scrollElement.document.documentElement;return this.options.horizontal?s.scrollWidth-this.scrollElement.innerWidth:s.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(s,n,i=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),r=this.getScrollOffset();n==="auto"&&(n=s>=r+o?"end":"start"),n==="center"?s+=(i-o)/2:n==="end"&&(s-=o);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,s),0)},this.getOffsetForIndex=(s,n="auto")=>{s=Math.max(0,Math.min(s,this.options.count-1));const i=this.getSize(),o=this.getScrollOffset(),r=this.measurementsCache[s];if(!r)return;if(n==="auto")if(r.end>=o+i-this.options.scrollPaddingEnd)n="end";else if(r.start<=o+this.options.scrollPaddingStart)n="start";else return[o,n];if(n==="end"&&s===this.options.count-1)return[this.getMaxScrollOffset(),n];const a=n==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,n,r.size),n]},this.scrollToOffset=(s,{align:n="start",behavior:i="auto"}={})=>{const o=this.getOffsetForAlignment(s,n),r=this.now();this.scrollState={index:null,align:n,behavior:i,startedAt:r,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(s,{align:n="auto",behavior:i="auto"}={})=>{s=Math.max(0,Math.min(s,this.options.count-1));const o=this.getOffsetForIndex(s,n);if(!o)return;const[r,a]=o,d=this.now();this.scrollState={index:s,align:a,behavior:i,startedAt:d,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(s,{behavior:n="auto"}={})=>{const i=this.getScrollOffset()+s,o=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var s;const n=this.getMeasurements();let i;if(n.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((s=n[n.length-1])==null?void 0:s.end)??0;else{const o=Array(this.options.lanes).fill(null);let r=n.length-1;for(;r>=0&&o.some(a=>a===null);){const a=n[r];o[a.lane]===null&&(o[a.lane]=a.end),r--}i=Math.max(...o.filter(a=>a!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(s,{adjustments:n,behavior:i})=>{this.options.scrollToFn(s,{behavior:i,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=n?n[0]:this.scrollState.lastTargetOffset,o=1,r=i!==this.scrollState.lastTargetOffset;if(!r&&ss(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=i,this.scrollState.behavior="auto",this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const rt=(t,e,s,n)=>{for(;t<=e;){const i=(t+e)/2|0,o=s(i);if(o<n)t=i+1;else if(o>n)e=i-1;else return i}return t>0?t-1:0};function ms({measurements:t,outerSize:e,scrollOffset:s,lanes:n}){const i=t.length-1,o=d=>t[d].start;if(t.length<=n)return{startIndex:0,endIndex:i};let r=rt(0,i,o,s),a=r;if(n===1)for(;a<i&&t[a].end<s+e;)a++;else if(n>1){const d=Array(n).fill(0);for(;a<i&&d.some(c=>c<s+e);){const c=t[a];d[c.lane]=c.end,a++}const m=Array(n).fill(s+e);for(;r>=0&&m.some(c=>c>=s);){const c=t[r];m[c.lane]=c.start,r--}r=Math.max(0,r-r%n),a=Math.min(i,a+(n-1-a%n))}return{startIndex:r,endIndex:a}}const Te=typeof document<"u"?O.useLayoutEffect:O.useEffect;function us({useFlushSync:t=!0,...e}){const s=O.useReducer(()=>({}),{})[1],n={...e,onChange:(o,r)=>{var a;t&&r?xt.flushSync(s):s(),(a=e.onChange)==null||a.call(e,o,r)}},[i]=O.useState(()=>new ds(n));return i.setOptions(n),Te(()=>i._didMount(),[]),Te(()=>i._willUpdate()),i}function hs(t){return us({observeElementRect:os,observeElementOffset:rs,scrollToFn:cs,...t})}se({title:P(),url:P(),icon:P()});se({registries:be(P(),se({enabled:je()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:ve(P()).describe("List of MCP app_name or app_id values to hide from the store.")});const me=se({keyId:P(),modelId:P(),title:P().optional()}).nullable(),fs=se({enabled:je(),chat:se({fast:me,smart:me,thinking:me}),image:me,webResearch:me});se({ids:ve(P()).describe("Ordered list of agent ids to show on the home view. Mix of well-known template ids and custom virtual MCP ids.")});se({id:P().describe("Brand context ID"),name:P().describe("Company name"),domain:P().describe("Company domain (e.g. example.com)"),overview:P().describe("Company overview / description"),logo:P().nullable().optional().describe("Logo URL"),favicon:P().nullable().optional().describe("Favicon URL"),ogImage:P().nullable().optional().describe("OG image URL"),fonts:se({heading:P().optional().describe("Font family for headings"),body:P().optional().describe("Font family for body text"),code:P().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:se({primary:P().optional().describe("Primary brand color (hex)"),secondary:P().optional().describe("Secondary brand color (hex)"),accent:P().optional().describe("Accent / highlight color (hex)"),background:P().optional().describe("Background color (hex)"),foreground:P().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:ve(be(P(),_e())).nullable().optional().describe("Brand images"),metadata:be(P(),_e()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:P().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:je().optional().describe("Whether this is the default brand for the organization")});function xs(t){const e=$.c(3),{error:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsx(Ut,{size:16}),e[0]=n):n=e[0];let i;return e[1]!==s.message?(i=l.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,l.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",s.message]})]}),e[1]=s.message,e[2]=i):i=e[2],i}function Re(t){const e=$.c(27),{keys:s,onDelete:n,isDeleting:i}=t,[o,r]=O.useState(null);let a;if(e[0]!==o||e[1]!==s){let S;e[3]!==o?(S=_=>_.id===o,e[3]=o,e[4]=S):S=e[4],a=s.find(S),e[0]=o,e[1]=s,e[2]=a}else a=e[2];const d=a;let m;if(e[5]!==i||e[6]!==s){let S;e[8]!==i?(S=_=>l.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md bg-muted/50 text-sm",children:[l.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[l.jsx(qe,{size:14,className:"text-muted-foreground shrink-0"}),l.jsx("span",{className:"font-medium truncate",children:_.label}),l.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:["added ",es(new Date(_.createdAt))," ago"]})]}),l.jsx("div",{onClick:gs,children:l.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-destructive",disabled:i,onClick:()=>r(_.id),children:l.jsx(Wt,{size:14})})})]},_.id),e[8]=i,e[9]=S):S=e[9],m=s.map(S),e[5]=i,e[6]=s,e[7]=m}else m=e[7];const c=!!o;let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=S=>!S&&r(null),e[10]=u):u=e[10];let h;e[11]===Symbol.for("react.memo_cache_sentinel")?(h=l.jsx(Ze,{children:"Delete API Key"}),e[11]=h):h=e[11];const f=d?.label;let v;e[12]!==f?(v=l.jsxs(et,{children:[h,l.jsxs(tt,{children:["This action cannot be undone. This will permanently delete"," ",l.jsx("span",{className:"font-medium text-foreground",children:f}),"."]})]}),e[12]=f,e[13]=v):v=e[13];let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=l.jsx(st,{children:"Cancel"}),e[14]=b):b=e[14];let w;e[15]!==o||e[16]!==n?(w=l.jsxs(lt,{children:[b,l.jsx(it,{onClick:()=>{o&&(n(o),r(null))},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[15]=o,e[16]=n,e[17]=w):w=e[17];let j;e[18]!==v||e[19]!==w?(j=l.jsxs(nt,{onClick:ps,children:[v,w]}),e[18]=v,e[19]=w,e[20]=j):j=e[20];let x;e[21]!==j||e[22]!==c?(x=l.jsx(ot,{open:c,onOpenChange:u,children:j}),e[21]=j,e[22]=c,e[23]=x):x=e[23];let y;return e[24]!==x||e[25]!==m?(y=l.jsxs("div",{className:"flex flex-col gap-2 mt-4",children:[m,x]}),e[24]=x,e[25]=m,e[26]=y):y=e[26],y}function ps(t){return t.stopPropagation()}function gs(t){return t.stopPropagation()}const bs=se({label:P().optional(),apiKey:P().min(1,"API key is required")});function vs(t){const e=$.c(61),{providerId:s,onCancel:n,onSuccess:i}=t,{org:o}=ne();let r;e[0]!==o.id?(r={connectionId:ce,orgId:o.id},e[0]=o.id,e[1]=r):r=e[1];const a=de(r),d=fe(),[m,c]=O.useState(!1);let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u={resolver:Se(bs),defaultValues:{label:"",apiKey:""}},e[2]=u):u=e[2];const{register:h,handleSubmit:f,formState:v}=ye(u),{errors:b}=v;let w;e[3]!==a||e[4]!==s?(w=async q=>{await a.callTool({name:"AI_PROVIDER_KEY_CREATE",arguments:{providerId:s,label:q.label||"Personal key",apiKey:q.apiKey}})},e[3]=a,e[4]=s,e[5]=w):w=e[5];let j;e[6]!==i||e[7]!==o.id||e[8]!==d?(j=()=>{d.invalidateQueries({queryKey:X.aiProviderKeys(o.id)}),d.invalidateQueries({queryKey:X.aiProviders(o.id)}),Y.success("Key saved successfully"),i()},e[6]=i,e[7]=o.id,e[8]=d,e[9]=j):j=e[9];let x;e[10]!==w||e[11]!==j?(x={mutationFn:w,onSuccess:j,onError:js},e[10]=w,e[11]=j,e[12]=x):x=e[12];const{mutate:y,isPending:S,error:_}=le(x);let g;e[13]!==y?(g=q=>y(q),e[13]=y,e[14]=g):g=e[14];let N;e[15]!==f||e[16]!==g?(N=f(g),e[15]=f,e[16]=g,e[17]=N):N=e[17];let I;e[18]===Symbol.for("react.memo_cache_sentinel")?(I=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),e[18]=I):I=e[18];let p;e[19]!==h?(p=h("label"),e[19]=h,e[20]=p):p=e[20];let C;e[21]!==p?(C=l.jsxs("div",{className:"space-y-1",children:[I,l.jsx(oe,{placeholder:"e.g. Personal key",...p,className:"h-8 text-sm"})]}),e[21]=p,e[22]=C):C=e[22];let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"API Key"}),e[23]=E):E=e[23];const k=m?"text":"password";let A;e[24]!==h?(A=h("apiKey"),e[24]=h,e[25]=A):A=e[25];let M;e[26]!==k||e[27]!==A?(M=l.jsx(oe,{type:k,placeholder:"sk-...",...A,className:"ph-no-capture h-8 text-sm pr-8"}),e[26]=k,e[27]=A,e[28]=M):M=e[28];let T;e[29]!==m?(T=()=>c(!m),e[29]=m,e[30]=T):T=e[30];let F;e[31]!==m?(F=m?l.jsx(He,{size:14}):l.jsx(Qe,{size:14}),e[31]=m,e[32]=F):F=e[32];let R;e[33]!==T||e[34]!==F?(R=l.jsx("button",{type:"button",onClick:T,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:F}),e[33]=T,e[34]=F,e[35]=R):R=e[35];let D;e[36]!==M||e[37]!==R?(D=l.jsxs("div",{className:"relative",children:[M,R]}),e[36]=M,e[37]=R,e[38]=D):D=e[38];let B;e[39]!==b.apiKey?(B=b.apiKey&&l.jsx("p",{className:"text-xs text-destructive",children:b.apiKey.message}),e[39]=b.apiKey,e[40]=B):B=e[40];let Q;e[41]!==D||e[42]!==B?(Q=l.jsxs("div",{className:"space-y-1",children:[E,D,B]}),e[41]=D,e[42]=B,e[43]=Q):Q=e[43];let U;e[44]!==_?(U=_&&l.jsx("p",{className:"text-xs text-destructive",children:_.message}),e[44]=_,e[45]=U):U=e[45];let L;e[46]!==S||e[47]!==n?(L=l.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:S,children:"Cancel"}),e[46]=S,e[47]=n,e[48]=L):L=e[48];const V=S?"Saving...":"Save Key";let K;e[49]!==S||e[50]!==V?(K=l.jsx(te,{type:"submit",size:"sm",disabled:S,children:V}),e[49]=S,e[50]=V,e[51]=K):K=e[51];let H;e[52]!==L||e[53]!==K?(H=l.jsxs(We,{children:[L,K]}),e[52]=L,e[53]=K,e[54]=H):H=e[54];let G;return e[55]!==C||e[56]!==Q||e[57]!==U||e[58]!==H||e[59]!==N?(G=l.jsxs("form",{onSubmit:N,className:"space-y-3",children:[C,Q,U,H]}),e[55]=C,e[56]=Q,e[57]=U,e[58]=H,e[59]=N,e[60]=G):G=e[60],G}function js(t){Y.error(`Failed to save key: ${t.message}`)}const ys=se({label:P().optional(),baseUrl:P().min(1,"Base URL is required"),apiKey:P().optional()});function Ss(t){const e=$.c(66),{onCancel:s,onSuccess:n}=t,{org:i}=ne();let o;e[0]!==i.id?(o={connectionId:ce,orgId:i.id},e[0]=i.id,e[1]=o):o=e[1];const r=de(o),a=fe(),[d,m]=O.useState(!1);let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c={resolver:Se(ys),defaultValues:{label:"",baseUrl:"",apiKey:""}},e[2]=c):c=e[2];const{register:u,handleSubmit:h,formState:f}=ye(c),{errors:v}=f;let b;e[3]!==r?(b=async z=>{const J=JSON.stringify({baseUrl:z.baseUrl,apiKey:z.apiKey||""});await r.callTool({name:"AI_PROVIDER_KEY_CREATE",arguments:{providerId:"openai-compatible",label:z.label||z.baseUrl,apiKey:J}})},e[3]=r,e[4]=b):b=e[4];let w;e[5]!==n||e[6]!==i.id||e[7]!==a?(w=()=>{a.invalidateQueries({queryKey:X.aiProviderKeys(i.id)}),a.invalidateQueries({queryKey:X.aiProviders(i.id)}),Y.success("Connection saved successfully"),n()},e[5]=n,e[6]=i.id,e[7]=a,e[8]=w):w=e[8];let j;e[9]!==b||e[10]!==w?(j={mutationFn:b,onSuccess:w,onError:Ns},e[9]=b,e[10]=w,e[11]=j):j=e[11];const{mutate:x,isPending:y,error:S}=le(j);let _;e[12]!==x?(_=z=>x(z),e[12]=x,e[13]=_):_=e[13];let g;e[14]!==h||e[15]!==_?(g=h(_),e[14]=h,e[15]=_,e[16]=g):g=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),e[17]=N):N=e[17];let I;e[18]!==u?(I=u("label"),e[18]=u,e[19]=I):I=e[19];let p;e[20]!==I?(p=l.jsxs("div",{className:"space-y-1",children:[N,l.jsx(oe,{placeholder:"e.g. LiteLLM, Ollama",...I,className:"h-8 text-sm"})]}),e[20]=I,e[21]=p):p=e[21];let C;e[22]===Symbol.for("react.memo_cache_sentinel")?(C=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),e[22]=C):C=e[22];let E;e[23]!==u?(E=u("baseUrl"),e[23]=u,e[24]=E):E=e[24];let k;e[25]!==E?(k=l.jsx(oe,{type:"url",placeholder:"http://localhost:4000/v1",...E,className:"h-8 text-sm"}),e[25]=E,e[26]=k):k=e[26];let A;e[27]!==v.baseUrl?(A=v.baseUrl&&l.jsx("p",{className:"text-xs text-destructive",children:v.baseUrl.message}),e[27]=v.baseUrl,e[28]=A):A=e[28];let M;e[29]!==k||e[30]!==A?(M=l.jsxs("div",{className:"space-y-1",children:[C,k,A]}),e[29]=k,e[30]=A,e[31]=M):M=e[31];let T;e[32]===Symbol.for("react.memo_cache_sentinel")?(T=l.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API Key ",l.jsx("span",{className:"text-muted-foreground/60",children:"(optional)"})]}),e[32]=T):T=e[32];const F=d?"text":"password";let R;e[33]!==u?(R=u("apiKey"),e[33]=u,e[34]=R):R=e[34];let D;e[35]!==F||e[36]!==R?(D=l.jsx(oe,{type:F,placeholder:"sk-...",...R,className:"ph-no-capture h-8 text-sm pr-8"}),e[35]=F,e[36]=R,e[37]=D):D=e[37];let B;e[38]!==d?(B=()=>m(!d),e[38]=d,e[39]=B):B=e[39];let Q;e[40]!==d?(Q=d?l.jsx(He,{size:14}):l.jsx(Qe,{size:14}),e[40]=d,e[41]=Q):Q=e[41];let U;e[42]!==B||e[43]!==Q?(U=l.jsx("button",{type:"button",onClick:B,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:Q}),e[42]=B,e[43]=Q,e[44]=U):U=e[44];let L;e[45]!==D||e[46]!==U?(L=l.jsxs("div",{className:"space-y-1",children:[T,l.jsxs("div",{className:"relative",children:[D,U]})]}),e[45]=D,e[46]=U,e[47]=L):L=e[47];let V;e[48]!==S?(V=S&&l.jsx("p",{className:"text-xs text-destructive",children:S.message}),e[48]=S,e[49]=V):V=e[49];let K;e[50]!==y||e[51]!==s?(K=l.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:s,disabled:y,children:"Cancel"}),e[50]=y,e[51]=s,e[52]=K):K=e[52];const H=y?"Saving...":"Save Connection";let G;e[53]!==y||e[54]!==H?(G=l.jsx(te,{type:"submit",size:"sm",disabled:y,children:H}),e[53]=y,e[54]=H,e[55]=G):G=e[55];let q;e[56]!==K||e[57]!==G?(q=l.jsxs(We,{children:[K,G]}),e[56]=K,e[57]=G,e[58]=q):q=e[58];let ee;return e[59]!==p||e[60]!==M||e[61]!==L||e[62]!==V||e[63]!==q||e[64]!==g?(ee=l.jsxs("form",{onSubmit:g,className:"space-y-3",children:[p,M,L,V,q]}),e[59]=p,e[60]=M,e[61]=L,e[62]=V,e[63]=q,e[64]=g,e[65]=ee):ee=e[65],ee}function Ns(t){Y.error(`Failed to save connection: ${t.message}`)}function Pe({provider:t,keys:e}){const{org:s}=ne(),n=de({connectionId:ce,orgId:s.id}),i=fe(),[o,r]=O.useState(!1),[a,d]=O.useState(!1),[m,c]=O.useState(null),u=t.supportedMethods.includes("cli-activate"),h=e.length>0,{mutate:f,isPending:v}=le({mutationFn:async p=>(await n.callTool({name:"AI_PROVIDER_KEY_DELETE",arguments:{keyId:p}}),p),onSuccess:p=>{i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),i.invalidateQueries({queryKey:X.aiProviderModels(s.id,p)}),Y.success("Key deleted")},onError:p=>{Y.error(`Failed to delete key: ${p.message}`)}}),{mutate:b}=le({mutationFn:async({code:p,stateToken:C})=>{const E=await n.callTool({name:"AI_PROVIDER_OAUTH_EXCHANGE",arguments:{providerId:t.id,code:p,stateToken:C,label:"Connected via OAuth"}});if(E?.isError){const k=E.content?.[0]?.text??"OAuth exchange failed";throw new Error(k)}},onSuccess:()=>{Z("ai_provider_oauth_succeeded",{provider_id:t.id}),i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),Y.success(`${t.name} connected successfully`),d(!1),c(null)},onError:p=>{Z("ai_provider_oauth_failed",{provider_id:t.id,error:p.message}),Y.error(`OAuth connection failed: ${p.message}`),d(!1),c(null)}}),{mutate:w,isPending:j}=le({mutationFn:async()=>{const p=await n.callTool({name:"AI_PROVIDER_CLI_ACTIVATE",arguments:{providerId:t.id}});if(p?.isError)throw new Error(p.content?.[0]?.text??"CLI activation failed");return p.structuredContent},onSuccess:p=>{if(!p?.activated){Z("ai_provider_cli_activate_failed",{provider_id:t.id,error:p?.error??"unknown"}),Y.error(p?.error??"CLI activation failed");return}Z("ai_provider_cli_activated",{provider_id:t.id}),i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),Y.success(`${t.name} activated`)},onError:p=>{Z("ai_provider_cli_activate_failed",{provider_id:t.id,error:p.message}),Y.error(p.message)}}),{mutate:x,isPending:y}=le({mutationFn:async()=>{const p=await n.callTool({name:"AI_PROVIDER_PROVISION_KEY",arguments:{providerId:t.id}});if(p?.isError){const C=p.content?.[0]?.text??"Key provisioning failed";throw new Error(C)}},onSuccess:()=>{Z("ai_provider_provision_succeeded",{provider_id:t.id}),i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),Y.success(`${t.name} connected successfully`)},onError:p=>{Z("ai_provider_provision_failed",{provider_id:t.id,error:p.message}),Y.error(`Failed to connect ${t.name}: ${p.message}`)}});O.useEffect(()=>{if(!a||!m)return;let p=!1;const C=k=>{if(k.origin===window.location.origin&&k.data?.type==="AI_PROVIDER_OAUTH_CALLBACK"){const{code:A,stateToken:M}=k.data;M===m?(p=!0,b({code:A,stateToken:M})):(console.error("State token mismatch"),Y.error("Security check failed: State token mismatch"),d(!1),c(null))}};window.addEventListener("message",C);const E=setTimeout(()=>{p||(Z("ai_provider_oauth_timeout",{provider_id:t.id}),d(!1),c(null),Y.error("Connection timed out"))},12e4);return()=>{window.removeEventListener("message",C),clearTimeout(E)}},[a,m,b,t.id]);const S=!!t.supportsProvision,_=t.supportedMethods.includes("oauth-pkce"),g=t.supportedMethods.includes("api-key"),N=()=>{if(!(o||a||j||y)){if(u){h||(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"cli-activate"}),w());return}S?(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"provision"}),x()):_?(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"oauth-pkce"}),I()):g&&(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"api-key"}),r(!0))}},I=async()=>{try{d(!0);const p=await n.callTool({name:"AI_PROVIDER_OAUTH_URL",arguments:{providerId:t.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`}});if(p.structuredContent)c(p.structuredContent.stateToken),window.open(p.structuredContent.url,"AiProviderOAuth","width=600,height=700");else throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL")}catch(p){d(!1),Y.error(`Failed to start OAuth: ${p instanceof Error?p.message:String(p)}`)}};return l.jsxs(l.Fragment,{children:[l.jsxs(Je,{className:ie("p-4 flex flex-col gap-3 transition-colors relative",h&&"border-primary/20",!a&&!j&&!y&&"cursor-pointer hover:bg-muted/30",(a||j||y)&&"cursor-wait"),onClick:N,children:[h&&l.jsx("div",{className:"absolute top-4 right-4 w-2 h-2 rounded-full bg-green-500"}),l.jsx("div",{className:"flex items-start justify-between",children:l.jsxs("div",{className:"flex items-center gap-3",children:[t.logo?l.jsx("img",{src:t.logo,alt:t.name,className:"size-8 rounded-md object-contain dark:bg-white dark:rounded-md dark:p-0.5"}):l.jsx(Xt,{fallback:t.name.charAt(0),className:"size-8 bg-primary/10 text-primary"}),l.jsxs("div",{children:[l.jsx("h3",{className:"font-medium text-base",children:t.name}),l.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:j?"Checking CLI...":y?"Connecting...":a?"Authorizing...":t.description})]})]})}),h&&l.jsx("div",{className:"mt-1",children:u?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-xs text-muted-foreground",children:["Authenticated via ",t.name," CLI"]}),l.jsx(Re,{keys:e,onDelete:f,isDeleting:v})]}):l.jsxs(l.Fragment,{children:[!t.supportsCredits&&l.jsx("div",{className:"flex items-center justify-between",children:l.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:[e.length," key",e.length!==1?"s":""," configured"]})}),t.supportsCredits&&l.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.length," key",e.length!==1?"s":""," configured · Managed above"]}),l.jsx(Re,{keys:e,onDelete:f,isDeleting:v})]})})]}),l.jsx(Be,{open:o,onOpenChange:p=>{p||r(!1)},children:l.jsxs(Ue,{children:[l.jsxs(jt,{children:[l.jsxs(Ve,{children:["Connect ",t.name]}),l.jsx(yt,{children:t.id==="openai-compatible"?"Enter the base URL and optional API key for your OpenAI-compatible endpoint.":`Add an API key to connect your ${t.name} account.`})]}),t.id==="openai-compatible"?l.jsx(Ss,{onCancel:()=>r(!1),onSuccess:()=>r(!1)}):l.jsx(vs,{providerId:t.id,onCancel:()=>r(!1),onSuccess:()=>r(!1)})]})})]})}function at(t){const e=$.c(20);let s;e[0]!==t?(s=t===void 0?{}:t,e[0]=t,e[1]=s):s=e[1];const{hideProviderId:n}=s,i=Ye(),o=ae();let r,a,d,m;if(e[2]!==i?.providers||e[3]!==o||e[4]!==n){let h;e[9]!==n?(h=j=>j.id!==n,e[9]=n,e[10]=h):h=e[10];const f=(i?.providers??[]).filter(h),v=f.filter(_s),b=f.filter(ws);d="flex flex-col gap-5 w-full",m=v.length>0&&l.jsxs("div",{className:"relative rounded-xl border border-lime-400/30 bg-gradient-to-br from-lime-50/50 via-transparent to-yellow-50/30 dark:from-lime-950/20 dark:to-yellow-950/10 p-4",children:[l.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-lime-400/5 to-yellow-400/5 pointer-events-none"}),l.jsx("p",{className:"text-xs font-medium text-lime-700 dark:text-lime-400 mb-3 relative",children:"Local models — use your existing AI provider"}),l.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3 relative",children:v.map(j=>l.jsx(Pe,{provider:j,keys:o.filter(x=>x.providerId===j.id)},j.id))})]}),r="grid grid-cols-1 lg:grid-cols-2 gap-4";let w;e[11]!==o?(w=j=>l.jsx(Pe,{provider:j,keys:o.filter(x=>x.providerId===j.id)},j.id),e[11]=o,e[12]=w):w=e[12],a=b.map(w),e[2]=i?.providers,e[3]=o,e[4]=n,e[5]=r,e[6]=a,e[7]=d,e[8]=m}else r=e[5],a=e[6],d=e[7],m=e[8];let c;e[13]!==r||e[14]!==a?(c=l.jsx("div",{className:r,children:a}),e[13]=r,e[14]=a,e[15]=c):c=e[15];let u;return e[16]!==d||e[17]!==m||e[18]!==c?(u=l.jsxs("div",{className:d,children:[m,c]}),e[16]=d,e[17]=m,e[18]=c,e[19]=u):u=e[19],u}function ws(t){return!t.supportedMethods.includes("cli-activate")}function _s(t){return t.supportedMethods.includes("cli-activate")}const Cs={usd:[10,20,100],brl:[50,100,500]};function Is(){const t=$.c(28),{org:e}=ne();let s;t[0]!==e.id?(s={connectionId:ce,orgId:e.id},t[0]=e.id,t[1]=s):s=t[1];const n=de(s),[i,o]=O.useState(!1),{mutate:r,isPending:a}=le({mutationFn:async N=>{const I=await n.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:N,currency:h}});if(I?.isError)throw new Error(I.content?.[0]?.text??"Failed to get top-up URL");return I.structuredContent?.url},onSuccess:Es,onError:ks}),[d,m]=O.useState(""),[c,u]=O.useState("usd"),h=c,f=parseFloat(d),v=!isNaN(f)&&f>=1,b=h==="brl"?"R$":"$";let w;t[2]!==u?(w=N=>{N&&u(N)},t[2]=u,t[3]=w):w=t[3];let j,x;t[4]===Symbol.for("react.memo_cache_sentinel")?(j=l.jsx(ke,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),x=l.jsx(ke,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),t[4]=j,t[5]=x):(j=t[4],x=t[5]);let y;t[6]!==h||t[7]!==w?(y=l.jsxs(Yt,{type:"single",variant:"outline",size:"default",value:h,onValueChange:w,children:[j,x]}),t[6]=h,t[7]=w,t[8]=y):y=t[8];let S;t[9]!==h||t[10]!==b||t[11]!==i||t[12]!==a||t[13]!==r?(S=!i&&l.jsxs(l.Fragment,{children:[Cs[h].map(N=>l.jsxs(te,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:a,onClick:()=>r(N*100),children:[b,N]},N)),l.jsx(te,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>o(!0),disabled:a,children:"Custom"})]}),t[9]=h,t[10]=b,t[11]=i,t[12]=a,t[13]=r,t[14]=S):S=t[14];let _;t[15]!==b||t[16]!==d||t[17]!==f||t[18]!==i||t[19]!==v||t[20]!==a||t[21]!==m||t[22]!==r?(_=i&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative max-w-[140px]",children:[l.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:b}),l.jsx(oe,{type:"number",min:"1",step:"1",placeholder:"50",value:d,onChange:N=>m(N.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),l.jsx(te,{className:"h-10",disabled:!v||a,onClick:()=>r(Math.round(f*100)),children:a?"...":"Add"}),l.jsx(te,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{o(!1),m("")},children:"Cancel"})]}),t[15]=b,t[16]=d,t[17]=f,t[18]=i,t[19]=v,t[20]=a,t[21]=m,t[22]=r,t[23]=_):_=t[23];let g;return t[24]!==y||t[25]!==S||t[26]!==_?(g=l.jsx("div",{className:"flex flex-col gap-2.5",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[y,S,_]})}),t[24]=y,t[25]=S,t[26]=_,t[27]=g):g=t[27],g}function ks(t){Y.error(`Top-up failed: ${t.message}`)}function Es(t){t&&window.open(t,"_blank","noopener,noreferrer")}function Ms(t){return t<=0?"text-destructive":t<=1?"text-amber-500 dark:text-amber-400":"text-foreground"}function As(){const t=$.c(59),{org:e}=ne();let s;t[0]!==e.id?(s={connectionId:ce,orgId:e.id},t[0]=e.id,t[1]=s):s=t[1];const n=de(s),i=fe(),o=ae();let r;t[2]!==o?(r=o.find(Ts),t[2]=o,t[3]=r):r=t[3];const a=r,[d,m]=O.useState(!1);let c;t[4]!==n||t[5]!==a?(c=async()=>{a&&await n.callTool({name:"AI_PROVIDER_KEY_DELETE",arguments:{keyId:a.id}})},t[4]=n,t[5]=a,t[6]=c):c=t[6];let u;t[7]!==e.id||t[8]!==i?(u=()=>{i.invalidateQueries({queryKey:X.aiProviderKeys(e.id)}),i.invalidateQueries({queryKey:X.aiProviders(e.id)}),Y.success("Deco AI Gateway disconnected"),m(!1)},t[7]=e.id,t[8]=i,t[9]=u):u=t[9];let h;t[10]!==c||t[11]!==u?(h={mutationFn:c,onSuccess:u,onError:Os},t[10]=c,t[11]=u,t[12]=h):h=t[12];const{mutate:f,isPending:v}=le(h);let b;t[13]!==e.id?(b=X.aiProviderCredits(e.id,"deco"),t[13]=e.id,t[14]=b):b=t[14];const w=!!a;let j;t[15]!==n?(j=async()=>{const ee=await n.callTool({name:"AI_PROVIDER_CREDITS",arguments:{providerId:"deco"}});return ee?.isError?null:ee.structuredContent??null},t[15]=n,t[16]=j):j=t[16];let x;t[17]!==b||t[18]!==w||t[19]!==j?(x={queryKey:b,enabled:w,staleTime:6e4,queryFn:j},t[17]=b,t[18]=w,t[19]=j,t[20]=x):x=t[20];const{data:y,isLoading:S,refetch:_,isFetching:g}=Ke(x);if(!a)return null;const N=y?.balanceCents!=null?y.balanceCents/100:null;let I;t[21]!==N?(I=N!=null?`$${N.toFixed(2)}`:"—",t[21]=N,t[22]=I):I=t[22];const p=I;let C;t[23]===Symbol.for("react.memo_cache_sentinel")?(C=ie("relative rounded-xl overflow-hidden","border border-border","bg-gradient-to-br from-background via-muted/30 to-background"),t[23]=C):C=t[23];let E;t[24]===Symbol.for("react.memo_cache_sentinel")?(E=l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Deco AI Gateway"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Access to 100+ models"})]})]}),t[24]=E):E=t[24];let k;t[25]===Symbol.for("react.memo_cache_sentinel")?(k=()=>m(!0),t[25]=k):k=t[25];let A;t[26]!==v?(A=l.jsxs("div",{className:"flex items-center justify-between mb-5",children:[E,l.jsx(te,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:k,disabled:v,children:"Disconnect"})]}),t[26]=v,t[27]=A):A=t[27];let M;t[28]===Symbol.for("react.memo_cache_sentinel")?(M=l.jsxs(et,{children:[l.jsx(Ze,{children:"Disconnect Deco AI Gateway"}),l.jsx(tt,{children:"This will remove the Deco AI Gateway from this workspace. Your credit balance is preserved and will be available if you reconnect."})]}),t[28]=M):M=t[28];let T;t[29]===Symbol.for("react.memo_cache_sentinel")?(T=l.jsx(st,{children:"Cancel"}),t[29]=T):T=t[29];let F;t[30]!==f?(F=l.jsxs(nt,{children:[M,l.jsxs(lt,{children:[T,l.jsx(it,{onClick:()=>f(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]}),t[30]=f,t[31]=F):F=t[31];let R;t[32]!==d||t[33]!==F?(R=l.jsx(ot,{open:d,onOpenChange:m,children:F}),t[32]=d,t[33]=F,t[34]=R):R=t[34];let D;t[35]!==N||t[36]!==p||t[37]!==g||t[38]!==S?(D=S||g?l.jsx(W,{className:"h-9 w-24"}):l.jsx("span",{className:ie("text-3xl font-semibold tabular-nums tracking-tight",N!=null&&Ms(N)),children:p}),t[35]=N,t[36]=p,t[37]=g,t[38]=S,t[39]=D):D=t[39];let B;t[40]!==_?(B=()=>_(),t[40]=_,t[41]=B):B=t[41];const Q=g&&"animate-spin";let U;t[42]!==Q?(U=ie(Q),t[42]=Q,t[43]=U):U=t[43];let L;t[44]!==U?(L=l.jsx($e,{size:14,className:U}),t[44]=U,t[45]=L):L=t[45];let V;t[46]!==g||t[47]!==B||t[48]!==L?(V=l.jsx("button",{type:"button",onClick:B,disabled:g,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":"Refresh balance",children:L}),t[46]=g,t[47]=B,t[48]=L,t[49]=V):V=t[49];let K;t[50]!==D||t[51]!==V?(K=l.jsxs("div",{className:"flex items-baseline gap-2",children:[D,V]}),t[50]=D,t[51]=V,t[52]=K):K=t[52];let H;t[53]===Symbol.for("react.memo_cache_sentinel")?(H=l.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Available credit balance"}),t[53]=H):H=t[53];let G;t[54]===Symbol.for("react.memo_cache_sentinel")?(G=l.jsxs("div",{className:"mt-5 pt-4 border-t border-border/60",children:[l.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:"Add credits"}),l.jsx(Is,{})]}),t[54]=G):G=t[54];let q;return t[55]!==A||t[56]!==R||t[57]!==K?(q=l.jsx("div",{className:C,children:l.jsxs("div",{className:"relative p-6",children:[A,R,K,H,G]})}),t[55]=A,t[56]=R,t[57]=K,t[58]=q):q=t[58],q}function Os(t){Y.error(`Failed to disconnect: ${t.message}`)}function Ts(t){return t.providerId==="deco"}const Rs=t=>t.capabilities?.includes("image")===!0,Ps=t=>{const e=t.modelId.toLowerCase().replace(/[^a-z0-9]/g,"");return e.includes("sonar")||e.includes("deepresearch")},zs={fast:"Fast",smart:"Smart",thinking:"Thinking"},Fs={fast:"Fastest responses, best for quick tasks",smart:"Balanced speed and capability",thinking:"Most capable, best for complex tasks"};function ge(t){const e=$.c(30),{label:s,description:n,slot:i,onSlotChange:o,filterModels:r,defaultKeyId:a}=t,d=ae(),[m,c]=O.useState(i?.keyId??a);let u;e[0]!==i?(u=()=>{i?.keyId&&c(i.keyId)},e[0]=i,e[1]=u):u=e[1];const h=i?.keyId;let f;e[2]!==h?(f=[h],e[2]=h,e[3]=f):f=e[3],O.useEffect(u,f);const v=m??a;let b;e[4]!==v||e[5]!==d?(b=v?d.find(k=>k.id===v):null,e[4]=v,e[5]=d,e[6]=b):b=e[6];const w=b,{models:j,isLoading:x}=ue(r?v??void 0:void 0);let y;e[7]!==j||e[8]!==r||e[9]!==x?(y=r?x||j.some(r):!0,e[7]=j,e[8]=r,e[9]=x,e[10]=y):y=e[10];const S=y;let _;e[11]!==i||e[12]!==w?.providerId?(_=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:w?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[11]=i,e[12]=w?.providerId,e[13]=_):_=e[13];const g=_;let N;e[14]!==s?(N=l.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[14]=s,e[15]=N):N=e[15];let I;e[16]!==n?(I=n&&l.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:n}),e[16]=n,e[17]=I):I=e[17];let p;e[18]!==N||e[19]!==I?(p=l.jsxs("div",{className:"min-w-0 flex-1",children:[N,I]}),e[18]=N,e[19]=I,e[20]=p):p=e[20];let C;e[21]!==v||e[22]!==r||e[23]!==S||e[24]!==o||e[25]!==g?(C=l.jsx("div",{className:"shrink-0",children:r&&!S?l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Not available with current provider"}):l.jsx(_l,{variant:"bordered",placeholder:"Pick model",model:g,credentialId:v,filterModels:r,onCredentialChange:k=>c(k),onModelChange:k=>{const A=k.keyId??v??"";c(A),o({keyId:A,modelId:k.modelId,title:k.title})}})}),e[21]=v,e[22]=r,e[23]=S,e[24]=o,e[25]=g,e[26]=C):C=e[26];let E;return e[27]!==C||e[28]!==p?(E=l.jsxs("div",{className:"flex items-center justify-between gap-4 py-2",children:[p,C]}),e[27]=C,e[28]=p,e[29]=E):E=e[29],E}function Ds(t){const e=$.c(2),{isPending:s,showSaved:n}=t;if(s){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[l.jsx($e,{size:12,className:"animate-spin"}),"Saving…"]}),e[0]=i):i=e[0],i}if(n){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[l.jsx(Vt,{size:12}),"Saved"]}),e[1]=i):i=e[1],i}return null}function Ls(){const t=ae(),e=Jt(),s=t.length>0,n=ye({resolver:Se(fs),values:e,mode:"onChange"}),{mutate:i,isPending:o,isSuccess:r}=Zt(),a=n.watch(),d=n.formState.isDirty;O.useEffect(()=>{if(!d)return;const x=setTimeout(()=>{i(a,{onSuccess:()=>n.reset(a,{keepValues:!0}),onError:y=>{n.reset(e),Y.error(`Failed to save: ${y.message}`)}})},250);return()=>clearTimeout(x)},[a,d,i,n,e]);const m=t[0],c=t[1],u=t[2],{models:h}=ue(m?.id),{models:f}=ue(c?.id),{models:v}=ue(u?.id),b=x=>{const y=n.getValues("chat");if(x&&!y.fast&&!y.smart&&!y.thinking){const S={};m?.id&&(S[m.id]=h),c?.id&&(S[c.id]=f),u?.id&&(S[u.id]=v);const _=Ie(t,S);n.reset({enabled:!0,chat:_.chat,image:_.image,webResearch:_.webResearch},{keepDirty:!0})}else n.setValue("enabled",x,{shouldDirty:!0})};O.useEffect(()=>{s||n.reset({enabled:!1,chat:{fast:null,smart:null,thinking:null},image:null,webResearch:null})},[s,n]),O.useEffect(()=>{const x=n.getValues();if(!x.enabled)return;const y=new Set(t.map(k=>k.id)),S={};m?.id&&(S[m.id]=h),c?.id&&(S[c.id]=f),u?.id&&(S[u.id]=v);const _=k=>k!=null&&!y.has(k.keyId),g={fast:_(x.chat.fast)?null:x.chat.fast,smart:_(x.chat.smart)?null:x.chat.smart,thinking:_(x.chat.thinking)?null:x.chat.thinking},N=_(x.image)?null:x.image,I=_(x.webResearch)?null:x.webResearch,p=!g.fast||!g.smart||!g.thinking||!N||!I,C=g.fast===x.chat.fast&&g.smart===x.chat.smart&&g.thinking===x.chat.thinking;if(!p&&C)return;const E=Ie(t,S);n.reset({...x,chat:{fast:g.fast??E.chat.fast,smart:g.smart??E.chat.smart,thinking:g.thinking??E.chat.thinking},image:N??E.image,webResearch:I??E.webResearch},{keepDirty:!0})},[n,t,h,f,v,m?.id,c?.id,u?.id]);const j=n.watch("enabled")&&s;return l.jsxs(Je,{className:"p-6",children:[l.jsx(qt,{className:"p-0",children:l.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ht,{className:"text-sm",children:"Simple model mode"}),l.jsx(Ds,{isPending:o,showSaved:r&&!d})]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:s?"Replace the model picker with a Fast / Smart / Thinking toggle for all members of this org.":"Connect an AI provider above to enable this feature."})]}),l.jsx(Gt,{checked:j,onCheckedChange:b,disabled:o||!s})]})}),j&&l.jsxs(Qt,{className:"flex flex-col p-0 mt-6",children:[l.jsxs("div",{className:"flex flex-col gap-1 pb-6",children:[l.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Chat models"}),["fast","smart","thinking"].map(x=>l.jsx(pe,{control:n.control,name:`chat.${x}`,render:({field:y})=>l.jsx(ge,{label:zs[x],description:Fs[x],slot:y.value,defaultKeyId:t[0]?.id??null,onSlotChange:S=>y.onChange(S)})},x))]}),l.jsxs("div",{className:"flex flex-col gap-1 pt-6 border-t border-border/50",children:[l.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Other models"}),l.jsx(pe,{control:n.control,name:"image",render:({field:x})=>l.jsx(ge,{label:"Image",slot:x.value,defaultKeyId:t[0]?.id??null,filterModels:Rs,onSlotChange:y=>x.onChange(y)})}),l.jsx(pe,{control:n.control,name:"webResearch",render:({field:x})=>l.jsx(ge,{label:"Web research",slot:x.value,defaultKeyId:t[0]?.id??null,filterModels:Ps,onSlotChange:y=>x.onChange(y)})})]})]})]})}function Ks(){const t=$.c(6),s=ae().some($s);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsx(As,{}),t[0]=n):n=t[0];const i=s?"deco":void 0;let o;t[1]!==i?(o=l.jsx(at,{hideProviderId:i}),t[1]=i,t[2]=o):o=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=l.jsx(O.Suspense,{fallback:l.jsx(W,{className:"h-16 w-full"}),children:l.jsx(Ls,{})}),t[3]=r):r=t[3];let a;return t[4]!==o?(a=l.jsxs("div",{className:"flex flex-col gap-6",children:[n,o,r]}),t[4]=o,t[5]=a):a=t[5],a}function $s(t){return t.providerId==="deco"}function li(){const t=$.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx(he.Title,{children:"AI Providers"}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=l.jsx(he,{children:l.jsx(he.Content,{children:l.jsx(he.Body,{children:l.jsxs("div",{className:"flex flex-col gap-6",children:[e,l.jsx(Le,{fallback:Bs,children:l.jsx(O.Suspense,{fallback:l.jsx(W,{className:"h-64 w-full"}),children:l.jsx(Ks,{})})})]})})})}),t[1]=s):s=t[1],s}function Bs(t){const{error:e}=t;return l.jsx(xs,{error:e??new Error("Failed to load AI providers")})}function Us(){const t=$.c(9),{org:e}=ne();let s;t[0]!==e.id?(s={connectionId:ce,orgId:e.id},t[0]=e.id,t[1]=s):s=t[1];const n=de(s);let i;t[2]!==e.id?(i=X.defaultBrand(e.id),t[2]=e.id,t[3]=i):i=t[3];let o;t[4]!==n?(o=async()=>{const d=await n.callTool({name:"BRAND_CONTEXT_LIST",arguments:{}}),m=ts(d);return(Array.isArray(m?.items)?m.items:[]).find(Vs)??null},t[4]=n,t[5]=o):o=t[5];let r;t[6]!==i||t[7]!==o?(r={queryKey:i,queryFn:o},t[6]=i,t[7]=o,t[8]=r):r=t[8];const{data:a}=Ke(r);return a??null}function Vs(t){return t.isDefault&&!t.archivedAt}function Ws(t){const e=t.colors;if(!e)return null;if(Array.isArray(e)){const s=e.find(i=>typeof i=="object"&&i!==null&&"label"in i&&/primary|brand|main/i.test(i.label)),n=s?s.value:e[0]?.value;return typeof n=="string"?n:null}if(typeof e=="object"){const s=e;return s.primary??Object.values(s)[0]??null}return null}function qs(t){const e=$.c(31);let s;e[0]!==t?(s=t===void 0?{}:t,e[0]=t,e[1]=s):s=e[1];const{title:n,description:i}=s,{org:o}=ne(),{localMode:r}=pt(),a=Us(),d=o.name;let m;e[2]!==a?(m=a?Ws(a):null,e[2]=a,e[3]=m):m=e[3];const c=m,u=a?.favicon??a?.logo??null,h=n??(d?`${d} is ready for agents`:"Your agents are almost ready"),f=i??"Choose how to power your AI team.",v=!!(u||c);let b;e[4]!==c?(b=c?{backgroundColor:`${c}18`,borderColor:`${c}30`}:void 0,e[4]=c,e[5]=b):b=e[5];const w=b,j=v?"flex items-center justify-center size-14 rounded-2xl border":"flex items-center justify-center size-14 rounded-2xl bg-gradient-to-br from-lime-100 to-yellow-50 dark:from-lime-900/30 dark:to-yellow-900/20 border border-lime-300/40 dark:border-lime-700/30";let x;e[6]!==u||e[7]!==c?(x=u?l.jsx("img",{src:u,alt:"",className:"size-7 rounded object-contain"}):l.jsx(Bt,{size:24,style:c?{color:c}:void 0,className:ie(!c&&"text-lime-600 dark:text-lime-400")}),e[6]=u,e[7]=c,e[8]=x):x=e[8];let y;e[9]!==j||e[10]!==w||e[11]!==x?(y=l.jsx("div",{className:j,style:w,children:x}),e[9]=j,e[10]=w,e[11]=x,e[12]=y):y=e[12];let S;e[13]!==h?(S=l.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:h}),e[13]=h,e[14]=S):S=e[14];let _;e[15]!==f?(_=l.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:f}),e[15]=f,e[16]=_):_=e[16];let g;e[17]!==S||e[18]!==_?(g=l.jsxs("div",{className:"space-y-2",children:[S,_]}),e[17]=S,e[18]=_,e[19]=g):g=e[19];let N;e[20]!==y||e[21]!==g?(N=l.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[y,g]}),e[20]=y,e[21]=g,e[22]=N):N=e[22];let I;e[23]!==r?(I=r&&l.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Local models + use your existing AI provider"}),e[23]=r,e[24]=I):I=e[24];let p;e[25]===Symbol.for("react.memo_cache_sentinel")?(p=l.jsx(O.Suspense,{fallback:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 w-full",children:[l.jsx(W,{className:"h-32 w-full rounded-lg"}),l.jsx(W,{className:"h-32 w-full rounded-lg"})]}),children:l.jsx(at,{})}),e[25]=p):p=e[25];let C;e[26]!==I?(C=l.jsxs("div",{className:"w-full space-y-3",children:[I,p]}),e[26]=I,e[27]=C):C=e[27];let E;return e[28]!==C||e[29]!==N?(E=l.jsxs("div",{className:"flex flex-col items-center gap-8 w-full max-w-2xl px-4",children:[N,C]}),e[28]=C,e[29]=N,e[30]=E):E=e[30],E}function we(t){const e=t.title.includes(": ");return{provider:e?t.title.split(": ")[0]??"":t.modelId.split("/")[0]??"",displayName:e?t.title.split(": ").slice(1).join(": "):t.title}}const ct=["smarter","faster","cheaper"],dt={smarter:"Smarter",faster:"Faster",cheaper:"Cheaper"},Hs=[{tier:"smarter",prefixes:["claude-code:opus","anthropic/claude-opus-4.7","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","codex:gpt-5.4","codex:gpt-5.4-mini","codex:gpt-5.3-codex","codex:gpt-5.2-codex","codex:gpt-5.1-codex-max","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["claude-code:sonnet","anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","codex:gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["claude-code:haiku","google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","cohere/command-r"]}],Qs=Hs.flatMap(({tier:t,prefixes:e})=>e.map(s=>({tier:t,prefix:s}))).sort((t,e)=>e.prefix.length-t.prefix.length),Gs=new Set(["google/gemini-2.5-pro"]),ze=new Map;function Ys(t){const e=ze.get(t);if(e!==void 0)return e;let s=null;if(t.endsWith(":free"))s="cheaper";else e:for(const{tier:n,prefix:i}of Qs)if(t.startsWith(i)){if(Gs.has(i)&&t.length>i.length&&t[i.length]==="-"){const r=t[i.length+1];if(!r||!/\d/.test(r))continue e}s=n;break}return ze.set(t,s),s}function Fe(t){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const s of t){const n=Ys(s.modelId);e[n??"other"].push(s)}for(const s of Object.keys(e))e[s].sort((n,i)=>n.title.localeCompare(i.title));return e}const mt="mesh:model-shortlist:",Xs=new Set(["anthropic/claude-opus-4.7","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"]);function Js(t){try{const e=localStorage.getItem(mt+t);return e?new Set(JSON.parse(e)):null}catch{return null}}function Zs(t,e){localStorage.setItem(mt+t,JSON.stringify([...e]))}function el(t){return t<32e3?{level:1,label:"Small",description:"Short conversations"}:t<2e5?{level:2,label:"Medium",description:"Good for most tasks"}:t<5e5?{level:3,label:"Large",description:"Long projects & research"}:{level:4,label:"Very large",description:"Massive files & data"}}const tl=["bg-destructive","bg-warning","bg-success","bg-success"],sl=["text-success","text-warning","text-warning","text-destructive"];function ll(t){const e=Math.round(t*.75/1e3);return e>=1?`~${e}K words`:`~${Math.round(t*.75)} words`}function il(t){return t<1?{level:1,label:"Cheap"}:t<5?{level:2,label:"Moderate"}:t<15?{level:3,label:"High"}:{level:4,label:"Expensive"}}const nl={text:{icon:l.jsx(Ft,{className:"size-3.5"}),label:"Text"},vision:{icon:l.jsx(zt,{className:"size-3.5"}),label:"Vision"},image:{icon:l.jsx(Dt,{className:"size-3.5"}),label:"Image"},tools:{icon:l.jsx(Pt,{className:"size-3.5"}),label:"Tools"},reasoning:{icon:l.jsx(Rt,{className:"size-3.5"}),label:"Reasoning"},"web-search":{icon:l.jsx(Ge,{className:"size-3.5"}),label:"Web search"}};function ol(t){const e=$.c(5),{capability:s}=t;let n;e[0]!==s?(n=nl[s]??{icon:null,label:s.charAt(0).toUpperCase()+s.slice(1)},e[0]=s,e[1]=n):n=e[1];const i=n;let o;return e[2]!==i.icon||e[3]!==i.label?(o=l.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[i.icon,i.label]}),e[2]=i.icon,e[3]=i.label,e[4]=o):o=e[4],o}function rl(t){const e=$.c(49),{model:s,compact:n}=t,i=n===void 0?!1:n;if(!s){let g;return e[0]===Symbol.for("react.memo_cache_sentinel")?(g=l.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=g):g=e[0],g}const o=s.costs?.input!=null?s.costs.input*1e6:null,r=s.costs?.output!=null?s.costs.output*1e6:null;let a;e[1]!==s?(a=we(s),e[1]=s,e[2]=a):a=e[2];const{provider:d,displayName:m}=a;if(i){let g;e[3]!==s.limits?(g=s.limits?.contextWindow&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Context"}),l.jsxs("span",{className:"text-foreground font-medium",children:[s.limits.contextWindow.toLocaleString()," tokens"]})]}),e[3]=s.limits,e[4]=g):g=e[4];let N;e[5]!==o?(N=o!=null&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Input"}),l.jsxs("span",{className:"text-foreground font-medium",children:["$",o.toFixed(2)," / 1M"]})]}),e[5]=o,e[6]=N):N=e[6];let I;e[7]!==r?(I=r!=null&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Output"}),l.jsxs("span",{className:"text-foreground font-medium",children:["$",r.toFixed(2)," / 1M"]})]}),e[7]=r,e[8]=I):I=e[8];let p;e[9]!==s.limits?(p=s.limits?.maxOutputTokens&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),l.jsxs("span",{className:"text-foreground font-medium",children:[s.limits.maxOutputTokens.toLocaleString()," tokens"]})]}),e[9]=s.limits,e[10]=p):p=e[10];let C;return e[11]!==g||e[12]!==N||e[13]!==I||e[14]!==p?(C=l.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[g,N,I,p]}),e[11]=g,e[12]=N,e[13]=I,e[14]=p,e[15]=C):C=e[15],C}let c;e[16]!==d?(c=l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:d}),e[16]=d,e[17]=c):c=e[17];let u;e[18]!==s.logo||e[19]!==s.title?(u=s.logo&&l.jsx("img",{src:s.logo,className:"size-6 shrink-0 rounded-md dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[18]=s.logo,e[19]=s.title,e[20]=u):u=e[20];let h;e[21]!==m?(h=l.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:m}),e[21]=m,e[22]=h):h=e[22];let f;e[23]!==u||e[24]!==h?(f=l.jsxs("div",{className:"flex items-center gap-2.5",children:[u,h]}),e[23]=u,e[24]=h,e[25]=f):f=e[25];let v;e[26]!==s.modelId?(v=l.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:s.modelId}),e[26]=s.modelId,e[27]=v):v=e[27];let b;e[28]!==c||e[29]!==f||e[30]!==v?(b=l.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[c,f,v]}),e[28]=c,e[29]=f,e[30]=v,e[31]=b):b=e[31];let w;e[32]!==s.capabilities?(w=s.capabilities&&s.capabilities.length>0&&l.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:[...new Set(s.capabilities)].map(al)}),e[32]=s.capabilities,e[33]=w):w=e[33];let j;e[34]!==s.limits?(j=s.limits?.contextWindow&&(()=>{const{level:g,label:N,description:I}=el(s.limits.contextWindow);return l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Context window"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(p=>l.jsx("div",{className:ie("w-2 h-2 rounded-full",p<=g?tl[g-1]:"bg-muted")},p))}),l.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:N}),l.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",I]})]}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.limits.contextWindow.toLocaleString()," tokens"]})]})})(),e[34]=s.limits,e[35]=j):j=e[35];let x;e[36]!==s.limits?(x=s.limits?.maxOutputTokens&&l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Output limit"}),l.jsxs("div",{className:"flex items-baseline gap-2",children:[l.jsxs("span",{className:"text-sm text-foreground",children:[s.limits.maxOutputTokens.toLocaleString()," tokens"]}),l.jsx("span",{className:"text-sm text-muted-foreground",children:ll(s.limits.maxOutputTokens)})]})]}),e[36]=s.limits,e[37]=x):x=e[37];let y;e[38]!==o||e[39]!==r?(y=(o!=null||r!=null)&&(()=>{const{level:g,label:N}=o!=null?il(o):{level:0,label:""};return l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Pricing"}),o!=null&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(I=>l.jsx("span",{className:ie("text-sm font-bold leading-none",I<=g?sl[g-1]:"text-muted-foreground/20"),children:"$"},I))}),l.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:N})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[o!=null&&l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-xs text-muted-foreground",children:"Input"}),l.jsxs("span",{className:"text-xs text-foreground",children:["$",o.toFixed(2)," / 1M tokens"]})]}),r!=null&&l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-xs text-muted-foreground",children:"Output"}),l.jsxs("span",{className:"text-xs text-foreground",children:["$",r.toFixed(2)," / 1M tokens"]})]})]})]})})(),e[38]=o,e[39]=r,e[40]=y):y=e[40];let S;e[41]!==j||e[42]!==x||e[43]!==y?(S=l.jsxs("div",{className:"flex flex-col gap-6",children:[j,x,y]}),e[41]=j,e[42]=x,e[43]=y,e[44]=S):S=e[44];let _;return e[45]!==S||e[46]!==b||e[47]!==w?(_=l.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[b,w,S]}),e[45]=S,e[46]=b,e[47]=w,e[48]=_):_=e[48],_}function al(t){return l.jsx(ol,{capability:t},t)}function cl(t){const e=$.c(21),{model:s,onHover:n}=t;let i;e[0]!==s?(i=we(s),e[0]=s,e[1]=i):i=e[1];const{displayName:o,provider:r}=i;let a;e[2]!==s?(a=Ne(s),e[2]=s,e[3]=a):a=e[3];const d=a;let m;e[4]!==s||e[5]!==n?(m=()=>n(s),e[4]=s,e[5]=n,e[6]=m):m=e[6];let c;e[7]!==s.title||e[8]!==d?(c=l.jsx("img",{src:d,className:"w-4 h-4 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[7]=s.title,e[8]=d,e[9]=c):c=e[9];let u;e[10]!==o?(u=l.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:o}),e[10]=o,e[11]=u):u=e[11];let h;e[12]!==r?(h=l.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:r}),e[12]=r,e[13]=h):h=e[13];let f;e[14]!==u||e[15]!==h?(f=l.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[u,h]}),e[14]=u,e[15]=h,e[16]=f):f=e[16];let v;return e[17]!==m||e[18]!==c||e[19]!==f?(v=l.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:m,children:[c,f]}),e[17]=m,e[18]=c,e[19]=f,e[20]=v):v=e[20],v}function dl(t){const e=$.c(10),{error:s,onRetry:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:l.jsx(bt,{className:"size-5 text-destructive"})}),e[0]=i):i=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=l.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load models"}),e[1]=o):o=e[1];const r=s?.message||"Could not fetch models from this provider.";let a;e[2]!==r?(a=l.jsxs("div",{className:"flex flex-col gap-1",children:[o,l.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[r," Try another provider or retry."]})]}),e[2]=r,e[3]=a):a=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=l.jsx(Lt,{className:"size-3.5"}),e[4]=d):d=e[4];let m;e[5]!==n?(m=l.jsx("div",{className:"flex items-center gap-2",children:l.jsxs(te,{variant:"outline",size:"sm",onClick:n,className:"gap-1.5",children:[d,"Retry"]})}),e[5]=n,e[6]=m):m=e[6];let c;return e[7]!==a||e[8]!==m?(c=l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[i,a,m]}),e[7]=a,e[8]=m,e[9]=c):c=e[9],c}function ml(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(ul)}),t[0]=e):e=t[0],e}function ul(t,e){return l.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[l.jsx(W,{className:"size-5 shrink-0 rounded-sm"}),l.jsx(W,{className:"flex-1 h-4"}),l.jsx(W,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function De(t){const e=$.c(12),{label:s,models:n,onSelect:i,onHover:o}=t;if(n.length===0)return null;let r;e[0]!==s?(r=l.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:s}),e[0]=s,e[1]=r):r=e[1];let a;if(e[2]!==n||e[3]!==o||e[4]!==i){let m;e[6]!==o||e[7]!==i?(m=c=>l.jsx("div",{onClick:()=>i(c),className:"cursor-pointer",children:l.jsx(cl,{model:c,onHover:o})},c.modelId),e[6]=o,e[7]=i,e[8]=m):m=e[8],a=n.map(m),e[2]=n,e[3]=o,e[4]=i,e[5]=a}else a=e[5];let d;return e[9]!==r||e[10]!==a?(d=l.jsxs("div",{children:[r,a]}),e[9]=r,e[10]=a,e[11]=d):d=e[11],d}function hl(t){const e=$.c(21),{model:s,isChecked:n,onToggle:i,onHover:o}=t,[r,a]=O.useState(n);r!==n&&a(n);let d;e[0]!==s?(d=Ne(s),e[0]=s,e[1]=d):d=e[1];const m=d;let c;e[2]!==s||e[3]!==o?(c=()=>o(s),e[2]=s,e[3]=o,e[4]=c):c=e[4];let u;e[5]!==s.modelId||e[6]!==i?(u=()=>{a(fl),i(s.modelId)},e[5]=s.modelId,e[6]=i,e[7]=u):u=e[7];let h;e[8]!==r||e[9]!==u?(h=l.jsx(vt,{checked:r,onCheckedChange:u}),e[8]=r,e[9]=u,e[10]=h):h=e[10];let f;e[11]!==m||e[12]!==s.title?(f=l.jsx("img",{src:m,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[11]=m,e[12]=s.title,e[13]=f):f=e[13];let v;e[14]!==s.title?(v=l.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:s.title}),e[14]=s.title,e[15]=v):v=e[15];let b;return e[16]!==c||e[17]!==h||e[18]!==f||e[19]!==v?(b=l.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:c,children:[h,f,v]}),e[16]=c,e[17]=h,e[18]=f,e[19]=v,e[20]=b):b=e[20],b}function fl(t){return!t}function xl(t){const e=[];for(const s of ct)if(t[s].length>0){e.push({type:"header",label:dt[s]});for(const n of t[s])e.push({type:"model",model:n})}if(t.other.length>0){e.push({type:"header",label:"Other"});for(const s of t.other)e.push({type:"model",model:s})}return e}function pl({items:t,shortlistSet:e,onToggle:s,onHover:n}){const i=O.useRef(null),o=hs({count:t.length,getScrollElement:()=>i.current,estimateSize:r=>t[r]?.type==="header"?36:44,overscan:6});return l.jsx("div",{ref:i,className:"flex-1 overflow-y-auto",children:l.jsx("div",{className:"relative",style:{height:o.getTotalSize()},children:o.getVirtualItems().map(r=>{const a=t[r.index];return a?l.jsx("div",{"data-index":r.index,ref:o.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${r.start}px)`},children:a.type==="header"?l.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:a.label}):l.jsx(hl,{model:a.model,isChecked:e.has(a.model.modelId),onToggle:s,onHover:n})},r.key):null})})})}function gl(t){const e=$.c(23),{keyId:s,searchTerm:n,onHover:i,onModelSelect:o,managing:r,onToggleManage:a,filterModels:d}=t,{models:m}=ue(s),c=d?m.filter(d):m;let u;e[0]!==s?(u=()=>(s?Js(s):null)??Xs,e[0]=s,e[1]=u):u=e[1];const[h,f]=O.useState(u),[,v]=O.useTransition();let b;e[2]!==s||e[3]!==v?(b=C=>{s&&v(()=>{f(E=>{const k=new Set(E);return k.has(C)?k.delete(C):k.add(C),Zs(s,k),k})})},e[2]=s,e[3]=v,e[4]=b):b=e[4];const w=b,j=n.toLowerCase().trim(),x=C=>j?C.filter(E=>E.title.toLowerCase().includes(j)||E.modelId.toLowerCase().includes(j)):C;if(r){const C=Fe(x(c)),E=xl(C);let k;e[5]!==h?(k=F=>h.has(F.modelId),e[5]=h,e[6]=k):k=e[6];const A=c.filter(k).length;let M;e[7]===Symbol.for("react.memo_cache_sentinel")?(M=l.jsx(Kt,{size:14}),e[7]=M):M=e[7];let T;return e[8]!==a?(T=l.jsxs("button",{type:"button",onClick:a,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[M,"Back"]}),e[8]=a,e[9]=T):T=e[9],l.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[T,l.jsxs("span",{className:"text-xs text-muted-foreground",children:[A," selected"]})]}),l.jsx(pl,{items:E,shortlistSet:h,onToggle:w,onHover:i})]})}let y;e[10]!==h?(y=C=>h.has(C.modelId),e[10]=h,e[11]=y):y=e[11];const S=c.filter(y),_=S.length>0?S:c,g=Fe(x(_));let N;e[12]!==g||e[13]!==i||e[14]!==o?(N=ct.map(C=>l.jsx(De,{label:dt[C],models:g[C],onSelect:o,onHover:i},C)),e[12]=g,e[13]=i,e[14]=o,e[15]=N):N=e[15];let I;e[16]!==g.other||e[17]!==i||e[18]!==o?(I=l.jsx(De,{label:"Other",models:g.other,onSelect:o,onHover:i}),e[16]=g.other,e[17]=i,e[18]=o,e[19]=I):I=e[19];let p;return e[20]!==N||e[21]!==I?(p=l.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[N,I]}),e[20]=N,e[21]=I,e[22]=p):p=e[22],p}function ut(t){const e=$.c(19),{model:s,placeholder:n,isLoading:i}=t,o=n===void 0?"Select model":n;if(i===void 0?!1:i){let b;return e[0]===Symbol.for("react.memo_cache_sentinel")?(b=l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(W,{className:"w-5 h-5 rounded-sm shrink-0"}),l.jsx(W,{className:"w-16 h-3 hidden md:block"})]}),e[0]=b):b=e[0],b}if(!s){let b;e[1]!==o?(b=l.jsx("span",{className:"text-sm text-muted-foreground",children:o}),e[1]=o,e[2]=b):b=e[2];let w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w=l.jsx(Ce,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[3]=w):w=e[3];let j;return e[4]!==b?(j=l.jsxs("div",{className:"flex items-center gap-1.5",children:[b,w]}),e[4]=b,e[5]=j):j=e[5],j}let a;e[6]!==s?(a=we(s),e[6]=s,e[7]=a):a=e[7];const{displayName:d}=a;let m;e[8]!==s?(m=Ne(s),e[8]=s,e[9]=m):m=e[9];const c=m;let u;e[10]!==s.title||e[11]!==c?(u=l.jsx("img",{src:c,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[10]=s.title,e[11]=c,e[12]=u):u=e[12];let h;e[13]!==d?(h=l.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:d}),e[13]=d,e[14]=h):h=e[14];let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=l.jsx(Ce,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[15]=f):f=e[15];let v;return e[16]!==u||e[17]!==h?(v=l.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[u,h,f]}),e[16]=u,e[17]=h,e[18]=v):v=e[18],v}const bl=["vision","image","file","audio","video"],ht=["image/png","image/jpeg","image/gif","image/webp"];function ii(t){const e=t?.capabilities;return e?bl.some(s=>e.includes(s)):!1}function ni(t,e){if(!t)return!1;if(t.startsWith("text/"))return!0;const s=e?.capabilities??[],n=s.includes("vision")||s.includes("image"),i=s.includes("file"),o=s.includes("audio"),r=s.includes("video");return!!(n&&ht.includes(t)||i&&t==="application/pdf"||o&&t.startsWith("audio/")||r&&t.startsWith("video/"))}function oi(t){const e=t?.capabilities??[],s=["text/*"];return(e.includes("vision")||e.includes("image"))&&s.push(...ht),e.includes("file")&&s.push("application/pdf"),e.includes("audio")&&s.push("audio/*"),e.includes("video")&&s.push("video/*"),s.join(",")}function ri(t){const e=t?.capabilities??[],s=[];return(e.includes("vision")||e.includes("image"))&&s.push("images"),e.includes("file")&&s.push("PDFs"),e.includes("audio")&&s.push("audio"),e.includes("video")&&s.push("video"),s.length===0?"text only":s.length===1?s[0]:s.length===2?`${s[0]} and ${s[1]}`:`${s.slice(0,-1).join(", ")}, and ${s.at(-1)}`}function vl(){const t=$.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:l.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[l.jsx(W,{className:"size-4 shrink-0"}),l.jsx(W,{className:"flex-1 h-6"}),l.jsx(W,{className:"w-[140px] h-8 shrink-0"})]})}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=l.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[e,l.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(jl)})]}),t[1]=s):s=t[1];let n;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[l.jsx(W,{className:"size-6 shrink-0"}),l.jsx(W,{className:"h-6 w-32"})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[n,l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(W,{className:"h-6 w-20 rounded-md"}),l.jsx(W,{className:"h-6 w-24 rounded-md"})]})]}),t[3]=i):i=t[3];let o;t[4]===Symbol.for("react.memo_cache_sentinel")?(o=l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsx(W,{className:"h-4 w-24"}),l.jsx(W,{className:"h-4 w-32"})]}),t[4]=o):o=t[4];let r;return t[5]===Symbol.for("react.memo_cache_sentinel")?(r=l.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[s,l.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:l.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[i,l.jsxs("div",{className:"flex flex-col gap-4",children:[o,l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsx(W,{className:"h-4 w-16"}),l.jsx(W,{className:"h-4 w-40"})]})]})]})})]}),t[5]=r):r=t[5],r}function jl(t,e){return l.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[l.jsx(W,{className:"size-5 shrink-0 rounded-sm"}),l.jsx(W,{className:"flex-1 h-4"}),l.jsx(W,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function ft(t){const e=$.c(43),{onClose:s,credentialId:n,onCredentialChange:i,selectedModel:o,onModelChange:r,filterModels:a}=t,[d,m]=O.useState(null),[c,u]=O.useState(""),[h,f]=O.useState(!1),v=O.useRef(null),b=Ye(),w=ae(),j=Object.fromEntries((b?.providers??[]).map(Nl)),x=gt(),{org:y}=ne();let S;e[0]!==i?(S=z=>{i(z),m(null)},e[0]=i,e[1]=S):S=e[1];const _=S;let g;e[2]!==n||e[3]!==s||e[4]!==r?(g=z=>{n&&(r(z),u(""),s())},e[2]=n,e[3]=s,e[4]=r,e[5]=g):g=e[5];const N=g;if(w.length===0){let z;return e[6]===Symbol.for("react.memo_cache_sentinel")?(z=l.jsx("div",{className:"flex items-center justify-center p-8 w-full sm:w-[740px]",children:l.jsx(qs,{})}),e[6]=z):z=e[6],z}const I="flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",p="flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",C="border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",E="flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text";let k;e[7]===Symbol.for("react.memo_cache_sentinel")?(k=l.jsx(Ge,{size:16,className:"text-muted-foreground shrink-0"}),e[7]=k):k=e[7];const A=h?"Search all models...":"Search for a model...";let M;e[8]===Symbol.for("react.memo_cache_sentinel")?(M=z=>u(z.target.value),e[8]=M):M=e[8];let T;e[9]!==c||e[10]!==A?(T=l.jsx(oe,{ref:v,type:"text",placeholder:A,value:c,onChange:M,className:"flex-1 min-w-0 border-0 !shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[9]=c,e[10]=A,e[11]=T):T=e[11];const F=w.length>0&&l.jsxs(kt,{value:n??"",onValueChange:_,children:[l.jsxs(Et,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:Sl,children:[l.jsx(Mt,{placeholder:"Key",children:(()=>{const z=w.find(xe=>xe.id===n),J=z?j[z.providerId]:void 0;return l.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[J?.logo?l.jsx("img",{src:J.logo,alt:J.name,className:"w-4 h-4 rounded shrink-0 dark:bg-white dark:rounded-sm dark:p-px"}):l.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:(J?.name??z?.providerId??"?").slice(0,1).toUpperCase()}),l.jsx("span",{className:"text-xs truncate",children:J?.name??z?.providerId??"Key"})]})})()}),l.jsx(Tt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),l.jsx(At,{children:w.map(z=>{const J=j[z.providerId];return l.jsx(Ot,{value:z.id,children:l.jsxs("div",{className:"flex items-center gap-2",children:[J?.logo?l.jsx("img",{src:J.logo,alt:J.name,className:"w-4 h-4 rounded dark:bg-white dark:rounded-sm dark:p-px"}):l.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:(J?.name??z.providerId).slice(0,1).toUpperCase()}),l.jsxs("span",{children:[J?.name??z.providerId," — ",z.label]})]})},z.id)})})]});let R;e[12]!==T||e[13]!==F||e[14]!==k?(R=l.jsx("div",{className:C,children:l.jsxs("label",{className:E,children:[k,T,F]})}),e[12]=T,e[13]=F,e[14]=k,e[15]=R):R=e[15];let D;e[16]!==n?(D=z=>{const{error:J,resetError:xe}=z;return l.jsx(dl,{error:J,onRetry:xe,credentialId:n??void 0})},e[16]=n,e[17]=D):D=e[17];let B;e[18]===Symbol.for("react.memo_cache_sentinel")?(B=l.jsx(ml,{}),e[18]=B):B=e[18];const Q=n??void 0;let U;e[19]===Symbol.for("react.memo_cache_sentinel")?(U=()=>f(yl),e[19]=U):U=e[19];let L;e[20]!==a||e[21]!==N||e[22]!==h||e[23]!==c||e[24]!==Q?(L=l.jsx(O.Suspense,{fallback:B,children:l.jsx(gl,{keyId:Q,searchTerm:c,onHover:m,onModelSelect:N,managing:h,onToggleManage:U,filterModels:a})}),e[20]=a,e[21]=N,e[22]=h,e[23]=c,e[24]=Q,e[25]=L):L=e[25];let V;e[26]!==n||e[27]!==D||e[28]!==L?(V=l.jsx(Le,{fallback:D,children:L},n),e[26]=n,e[27]=D,e[28]=L,e[29]=V):V=e[29];let K;e[30]!==h||e[31]!==x||e[32]!==y?(K=!h&&l.jsxs("div",{className:"border-t border-border flex",children:[l.jsxs("button",{type:"button",onClick:()=>O.startTransition(()=>f(!0)),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[l.jsx($t,{className:"size-3.5 shrink-0"}),"Manage models"]}),l.jsx("div",{className:"w-px bg-border shrink-0"}),l.jsxs("button",{type:"button",onClick:()=>x({to:"/$org/settings/ai-providers",params:{org:y.slug}}),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[l.jsx(qe,{className:"size-3.5 shrink-0"}),"Manage API keys"]})]}),e[30]=h,e[31]=x,e[32]=y,e[33]=K):K=e[33];let H;e[34]!==R||e[35]!==V||e[36]!==K?(H=l.jsxs("div",{className:p,children:[R,V,K]}),e[34]=R,e[35]=V,e[36]=K,e[37]=H):H=e[37];const G=d??o??null;let q;e[38]!==G?(q=l.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:l.jsx(rl,{model:G})}),e[38]=G,e[39]=q):q=e[39];let ee;return e[40]!==H||e[41]!==q?(ee=l.jsxs("div",{className:I,children:[H,q]}),e[40]=H,e[41]=q,e[42]=ee):ee=e[42],ee}function yl(t){return!t}function Sl(t){return t.stopPropagation()}function Nl(t){return[t.id,t]}function wl(t){const e=$.c(12),{onClose:s}=t,{credentialId:n,setCredentialId:i,selectedModel:o,setModel:r}=Xe();let a;e[0]!==i?(a=c=>{Z("chat_credential_changed",{credential_id:c}),i(c)},e[0]=i,e[1]=a):a=e[1];let d;e[2]!==n||e[3]!==o?.modelId||e[4]!==r?(d=c=>{n&&(Z("chat_model_changed",{from_model_id:o?.modelId??null,to_model_id:c.modelId,to_model_provider:c.providerId??null,credential_id:n}),r({...c,keyId:n}))},e[2]=n,e[3]=o?.modelId,e[4]=r,e[5]=d):d=e[5];let m;return e[6]!==n||e[7]!==s||e[8]!==o||e[9]!==a||e[10]!==d?(m=l.jsx(ft,{onClose:s,credentialId:n,onCredentialChange:a,selectedModel:o,onModelChange:d}),e[6]=n,e[7]=s,e[8]=o,e[9]=a,e[10]=d,e[11]=m):m=e[11],m}function _l(t){const e=$.c(38),{variant:s,className:n,placeholder:i,model:o,isLoading:r,credentialId:a,onCredentialChange:d,onModelChange:m,filterModels:c}=t,u=s===void 0?"borderless":s,h=i===void 0?"Select model":i,[f,v]=O.useState(!1),b=m!==void 0,w=It(),j=u==="borderless"?"ghost":"outline",x=u==="borderless"&&"md:border-none";let y;e[0]!==n||e[1]!==x?(y=ie("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",x,n),e[0]=n,e[1]=x,e[2]=y):y=e[2];let S;e[3]!==r||e[4]!==o||e[5]!==h||e[6]!==b?(S=b?l.jsx(ut,{model:o??null,placeholder:h,isLoading:r}):l.jsx(Il,{placeholder:h}),e[3]=r,e[4]=o,e[5]=h,e[6]=b,e[7]=S):S=e[7];let _;e[8]!==j||e[9]!==y||e[10]!==S?(_=l.jsx(te,{variant:j,size:"sm",className:y,children:S}),e[8]=j,e[9]=y,e[10]=S,e[11]=_):_=e[11];const g=_;let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=l.jsx(vl,{}),e[12]=N):N=e[12];let I;e[13]!==a||e[14]!==c||e[15]!==o||e[16]!==d||e[17]!==m||e[18]!==b?(I=l.jsx(O.Suspense,{fallback:N,children:b?l.jsx(ft,{onClose:()=>v(!1),credentialId:a??null,onCredentialChange:d??Cl,selectedModel:o??null,onModelChange:m,filterModels:c}):l.jsx(wl,{onClose:()=>v(!1)})}),e[13]=a,e[14]=c,e[15]=o,e[16]=d,e[17]=m,e[18]=b,e[19]=I):I=e[19];const p=I;if(w){let M;e[20]!==g?(M=l.jsx(Nt,{asChild:!0,children:g}),e[20]=g,e[21]=M):M=e[21];let T;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=l.jsx(wt,{className:"sr-only",children:"Select model"}),e[22]=T):T=e[22];let F;e[23]!==p?(F=l.jsxs(_t,{className:"p-0 flex flex-col max-h-[95vh]",children:[T,l.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:p})]}),e[23]=p,e[24]=F):F=e[24];let R;return e[25]!==f||e[26]!==M||e[27]!==F?(R=l.jsxs(Ct,{open:f,onOpenChange:v,children:[M,F]}),e[25]=f,e[26]=M,e[27]=F,e[28]=R):R=e[28],R}let C;e[29]!==g?(C=l.jsx(St,{asChild:!0,children:g}),e[29]=g,e[30]=C):C=e[30];let E;e[31]===Symbol.for("react.memo_cache_sentinel")?(E=l.jsx(Ve,{className:"sr-only",children:"Select model"}),e[31]=E):E=e[31];let k;e[32]!==p?(k=l.jsxs(Ue,{className:"p-0 gap-0 sm:max-w-fit overflow-hidden h-[100dvh] sm:h-auto max-h-[100dvh] sm:max-h-[85vh] w-full max-w-full sm:max-w-fit rounded-none sm:rounded-xl border-0 sm:border",closeButtonClassName:"top-3.5 right-3.5 z-20",children:[E,p]}),e[32]=p,e[33]=k):k=e[33];let A;return e[34]!==f||e[35]!==C||e[36]!==k?(A=l.jsxs(Be,{open:f,onOpenChange:v,children:[C,k]}),e[34]=f,e[35]=C,e[36]=k,e[37]=A):A=e[37],A}function Cl(){}function Il(t){const e=$.c(4),{placeholder:s}=t,{selectedModel:n,isModelsLoading:i}=Xe();let o;return e[0]!==i||e[1]!==n||e[2]!==s?(o=l.jsx(ut,{model:n,placeholder:s,isLoading:i}),e[0]=i,e[1]=n,e[2]=s,e[3]=o):o=e[3],o}export{_l as M,qs as N,li as O,ri as a,oi as g,ni as i,ii as m};
|
|
4
|
+
color: hsl(${Math.max(0,Math.min(120-120*w,120))}deg 100% 31%);`,s?.key)}return s?.onChange&&!(o&&s.skipInitialOnChange)&&s.onChange(i),o=!1,i}return r.updateDeps=a=>{n=a},r}function Ee(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const ss=(t,e)=>Math.abs(t-e)<1.01,ls=(t,e,s)=>{let n;return function(...i){t.clearTimeout(n),n=t.setTimeout(()=>e.apply(this,i),s)}},Me=t=>{const{offsetWidth:e,offsetHeight:s}=t;return{width:e,height:s}},is=t=>t,ns=t=>{const e=Math.max(t.startIndex-t.overscan,0),s=Math.min(t.endIndex+t.overscan,t.count-1),n=[];for(let i=e;i<=s;i++)n.push(i);return n},os=(t,e)=>{const s=t.scrollElement;if(!s)return;const n=t.targetWindow;if(!n)return;const i=r=>{const{width:a,height:d}=r;e({width:Math.round(a),height:Math.round(d)})};if(i(Me(s)),!n.ResizeObserver)return()=>{};const o=new n.ResizeObserver(r=>{const a=()=>{const d=r[0];if(d?.borderBoxSize){const m=d.borderBoxSize[0];if(m){i({width:m.inlineSize,height:m.blockSize});return}}i(Me(s))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(s,{box:"border-box"}),()=>{o.unobserve(s)}},Ae={passive:!0},Oe=typeof window>"u"?!0:"onscrollend"in window,rs=(t,e)=>{const s=t.scrollElement;if(!s)return;const n=t.targetWindow;if(!n)return;let i=0;const o=t.options.useScrollendEvent&&Oe?()=>{}:ls(n,()=>{e(i,!1)},t.options.isScrollingResetDelay),r=c=>()=>{const{horizontal:u,isRtl:h}=t.options;i=u?s.scrollLeft*(h&&-1||1):s.scrollTop,o(),e(i,c)},a=r(!0),d=r(!1);s.addEventListener("scroll",a,Ae);const m=t.options.useScrollendEvent&&Oe;return m&&s.addEventListener("scrollend",d,Ae),()=>{s.removeEventListener("scroll",a),m&&s.removeEventListener("scrollend",d)}},as=(t,e,s)=>{if(e?.borderBoxSize){const n=e.borderBoxSize[0];if(n)return Math.round(n[s.options.horizontal?"inlineSize":"blockSize"])}return t[s.options.horizontal?"offsetWidth":"offsetHeight"]},cs=(t,{adjustments:e=0,behavior:s},n)=>{var i,o;const r=t+e;(o=(i=n.scrollElement)==null?void 0:i.scrollTo)==null||o.call(i,{[n.options.horizontal?"left":"top"]:r,behavior:s})};class ds{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var s,n,i;return((i=(n=(s=this.targetWindow)==null?void 0:s.performance)==null?void 0:n.now)==null?void 0:i.call(n))??Date.now()},this.observer=(()=>{let s=null;const n=()=>s||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:s=new this.targetWindow.ResizeObserver(i=>{i.forEach(o=>{const r=()=>{const a=o.target,d=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(a,o,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));return{disconnect:()=>{var i;(i=n())==null||i.disconnect(),s=null},observe:i=>{var o;return(o=n())==null?void 0:o.observe(i,{box:"border-box"})},unobserve:i=>{var o;return(o=n())==null?void 0:o.unobserve(i)}}})(),this.range=null,this.setOptions=s=>{Object.entries(s).forEach(([n,i])=>{typeof i>"u"&&delete s[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:is,rangeExtractor:ns,onChange:()=>{},measureElement:as,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...s}},this.notify=s=>{var n,i;(i=(n=this.options).onChange)==null||i.call(n,this,s)},this.maybeNotify=re(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),s=>{this.notify(s)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(s=>s()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var s;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((s=this.scrollElement)==null?void 0:s.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=o,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(s,n)=>{const i=new Map,o=new Map;for(let r=n-1;r>=0;r--){const a=s[r];if(i.has(a.lane))continue;const d=o.get(a.lane);if(d==null||a.end>d.end?o.set(a.lane,a):a.end<d.end&&i.set(a.lane,!0),i.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((r,a)=>r.end===a.end?r.index-a.index:r.end-a.end)[0]:void 0},this.getMeasurementOptions=re(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(s,n,i,o,r,a,d)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:s,paddingStart:n,scrollMargin:i,getItemKey:o,enabled:r,lanes:a,laneAssignmentMode:d}),{key:!1}),this.getMeasurements=re(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:s,paddingStart:n,scrollMargin:i,getItemKey:o,enabled:r,lanes:a,laneAssignmentMode:d},m)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>s)for(const f of this.laneAssignments.keys())f>=s&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===s&&(this.lanesSettling=!1);const u=this.measurementsCache.slice(0,c),h=new Array(a).fill(void 0);for(let f=0;f<c;f++){const v=u[f];v&&(h[v.lane]=f)}for(let f=c;f<s;f++){const v=o(f),b=this.laneAssignments.get(f);let w,j;const x=d==="estimate"||m.has(v);if(b!==void 0&&this.options.lanes>1){w=b;const g=h[w],N=g!==void 0?u[g]:void 0;j=N?N.end+this.options.gap:n+i}else{const g=this.options.lanes===1?u[f-1]:this.getFurthestMeasurement(u,f);j=g?g.end+this.options.gap:n+i,w=g?g.lane:f%this.options.lanes,this.options.lanes>1&&x&&this.laneAssignments.set(f,w)}const y=m.get(v),S=typeof y=="number"?y:this.options.estimateSize(f),_=j+S;u[f]={index:f,start:j,size:S,end:_,key:v,lane:w},h[w]=f}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=re(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(s,n,i,o)=>this.range=s.length>0&&n>0?ms({measurements:s,outerSize:n,scrollOffset:i,lanes:o}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=re(()=>{let s=null,n=null;const i=this.calculateRange();return i&&(s=i.startIndex,n=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,s,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,s,n]},(s,n,i,o,r)=>o===null||r===null?[]:s({startIndex:o,endIndex:r,overscan:n,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=s=>{const n=this.options.indexAttribute,i=s.getAttribute(n);return i?parseInt(i,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=s=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(i!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,i-o),a=Math.min(this.options.count-1,i+o);return s>=r&&s<=a}return!0},this.measureElement=s=>{if(!s){this.elementsCache.forEach((r,a)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(a))});return}const n=this.indexFromElement(s),i=this.options.getItemKey(n),o=this.elementsCache.get(i);o!==s&&(o&&this.observer.unobserve(o),this.observer.observe(s),this.elementsCache.set(i,s)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(s,void 0,this))},this.resizeItem=(s,n)=>{var i;const o=this.measurementsCache[s];if(!o)return;const r=this.itemSizeCache.get(o.key)??o.size,a=n-r;a!==0&&(((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,a,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,n)),this.notify(!1))},this.getVirtualItems=re(()=>[this.getVirtualIndexes(),this.getMeasurements()],(s,n)=>{const i=[];for(let o=0,r=s.length;o<r;o++){const a=s[o],d=n[a];i.push(d)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=s=>{const n=this.getMeasurements();if(n.length!==0)return Ee(n[rt(0,n.length-1,i=>Ee(n[i]).start,s)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const s=this.scrollElement.document.documentElement;return this.options.horizontal?s.scrollWidth-this.scrollElement.innerWidth:s.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(s,n,i=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),r=this.getScrollOffset();n==="auto"&&(n=s>=r+o?"end":"start"),n==="center"?s+=(i-o)/2:n==="end"&&(s-=o);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,s),0)},this.getOffsetForIndex=(s,n="auto")=>{s=Math.max(0,Math.min(s,this.options.count-1));const i=this.getSize(),o=this.getScrollOffset(),r=this.measurementsCache[s];if(!r)return;if(n==="auto")if(r.end>=o+i-this.options.scrollPaddingEnd)n="end";else if(r.start<=o+this.options.scrollPaddingStart)n="start";else return[o,n];if(n==="end"&&s===this.options.count-1)return[this.getMaxScrollOffset(),n];const a=n==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,n,r.size),n]},this.scrollToOffset=(s,{align:n="start",behavior:i="auto"}={})=>{const o=this.getOffsetForAlignment(s,n),r=this.now();this.scrollState={index:null,align:n,behavior:i,startedAt:r,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(s,{align:n="auto",behavior:i="auto"}={})=>{s=Math.max(0,Math.min(s,this.options.count-1));const o=this.getOffsetForIndex(s,n);if(!o)return;const[r,a]=o,d=this.now();this.scrollState={index:s,align:a,behavior:i,startedAt:d,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(s,{behavior:n="auto"}={})=>{const i=this.getScrollOffset()+s,o=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var s;const n=this.getMeasurements();let i;if(n.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((s=n[n.length-1])==null?void 0:s.end)??0;else{const o=Array(this.options.lanes).fill(null);let r=n.length-1;for(;r>=0&&o.some(a=>a===null);){const a=n[r];o[a.lane]===null&&(o[a.lane]=a.end),r--}i=Math.max(...o.filter(a=>a!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(s,{adjustments:n,behavior:i})=>{this.options.scrollToFn(s,{behavior:i,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=n?n[0]:this.scrollState.lastTargetOffset,o=1,r=i!==this.scrollState.lastTargetOffset;if(!r&&ss(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=i,this.scrollState.behavior="auto",this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const rt=(t,e,s,n)=>{for(;t<=e;){const i=(t+e)/2|0,o=s(i);if(o<n)t=i+1;else if(o>n)e=i-1;else return i}return t>0?t-1:0};function ms({measurements:t,outerSize:e,scrollOffset:s,lanes:n}){const i=t.length-1,o=d=>t[d].start;if(t.length<=n)return{startIndex:0,endIndex:i};let r=rt(0,i,o,s),a=r;if(n===1)for(;a<i&&t[a].end<s+e;)a++;else if(n>1){const d=Array(n).fill(0);for(;a<i&&d.some(c=>c<s+e);){const c=t[a];d[c.lane]=c.end,a++}const m=Array(n).fill(s+e);for(;r>=0&&m.some(c=>c>=s);){const c=t[r];m[c.lane]=c.start,r--}r=Math.max(0,r-r%n),a=Math.min(i,a+(n-1-a%n))}return{startIndex:r,endIndex:a}}const Te=typeof document<"u"?O.useLayoutEffect:O.useEffect;function us({useFlushSync:t=!0,...e}){const s=O.useReducer(()=>({}),{})[1],n={...e,onChange:(o,r)=>{var a;t&&r?xt.flushSync(s):s(),(a=e.onChange)==null||a.call(e,o,r)}},[i]=O.useState(()=>new ds(n));return i.setOptions(n),Te(()=>i._didMount(),[]),Te(()=>i._willUpdate()),i}function hs(t){return us({observeElementRect:os,observeElementOffset:rs,scrollToFn:cs,...t})}se({title:P(),url:P(),icon:P()});se({registries:be(P(),se({enabled:je()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:ve(P()).describe("List of MCP app_name or app_id values to hide from the store.")});const me=se({keyId:P(),modelId:P(),title:P().optional()}).nullable(),fs=se({enabled:je(),chat:se({fast:me,smart:me,thinking:me}),image:me,webResearch:me});se({ids:ve(P()).describe("Ordered list of agent ids to show on the home view. Mix of well-known template ids and custom virtual MCP ids.")});se({id:P().describe("Brand context ID"),name:P().describe("Company name"),domain:P().describe("Company domain (e.g. example.com)"),overview:P().describe("Company overview / description"),logo:P().nullable().optional().describe("Logo URL"),favicon:P().nullable().optional().describe("Favicon URL"),ogImage:P().nullable().optional().describe("OG image URL"),fonts:se({heading:P().optional().describe("Font family for headings"),body:P().optional().describe("Font family for body text"),code:P().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:se({primary:P().optional().describe("Primary brand color (hex)"),secondary:P().optional().describe("Secondary brand color (hex)"),accent:P().optional().describe("Accent / highlight color (hex)"),background:P().optional().describe("Background color (hex)"),foreground:P().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:ve(be(P(),_e())).nullable().optional().describe("Brand images"),metadata:be(P(),_e()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:P().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:je().optional().describe("Whether this is the default brand for the organization")});function xs(t){const e=$.c(3),{error:s}=t;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsx(Ut,{size:16}),e[0]=n):n=e[0];let i;return e[1]!==s.message?(i=l.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,l.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",s.message]})]}),e[1]=s.message,e[2]=i):i=e[2],i}function Re(t){const e=$.c(27),{keys:s,onDelete:n,isDeleting:i}=t,[o,r]=O.useState(null);let a;if(e[0]!==o||e[1]!==s){let S;e[3]!==o?(S=_=>_.id===o,e[3]=o,e[4]=S):S=e[4],a=s.find(S),e[0]=o,e[1]=s,e[2]=a}else a=e[2];const d=a;let m;if(e[5]!==i||e[6]!==s){let S;e[8]!==i?(S=_=>l.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md bg-muted/50 text-sm",children:[l.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[l.jsx(Qe,{size:14,className:"text-muted-foreground shrink-0"}),l.jsx("span",{className:"font-medium truncate",children:_.label}),l.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:["added ",es(new Date(_.createdAt))," ago"]})]}),l.jsx("div",{onClick:gs,children:l.jsx(te,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-destructive",disabled:i,onClick:()=>r(_.id),children:l.jsx(Wt,{size:14})})})]},_.id),e[8]=i,e[9]=S):S=e[9],m=s.map(S),e[5]=i,e[6]=s,e[7]=m}else m=e[7];const c=!!o;let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=S=>!S&&r(null),e[10]=u):u=e[10];let h;e[11]===Symbol.for("react.memo_cache_sentinel")?(h=l.jsx(Ze,{children:"Delete API Key"}),e[11]=h):h=e[11];const f=d?.label;let v;e[12]!==f?(v=l.jsxs(et,{children:[h,l.jsxs(tt,{children:["This action cannot be undone. This will permanently delete"," ",l.jsx("span",{className:"font-medium text-foreground",children:f}),"."]})]}),e[12]=f,e[13]=v):v=e[13];let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=l.jsx(st,{children:"Cancel"}),e[14]=b):b=e[14];let w;e[15]!==o||e[16]!==n?(w=l.jsxs(lt,{children:[b,l.jsx(it,{onClick:()=>{o&&(n(o),r(null))},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),e[15]=o,e[16]=n,e[17]=w):w=e[17];let j;e[18]!==v||e[19]!==w?(j=l.jsxs(nt,{onClick:ps,children:[v,w]}),e[18]=v,e[19]=w,e[20]=j):j=e[20];let x;e[21]!==j||e[22]!==c?(x=l.jsx(ot,{open:c,onOpenChange:u,children:j}),e[21]=j,e[22]=c,e[23]=x):x=e[23];let y;return e[24]!==x||e[25]!==m?(y=l.jsxs("div",{className:"flex flex-col gap-2 mt-4",children:[m,x]}),e[24]=x,e[25]=m,e[26]=y):y=e[26],y}function ps(t){return t.stopPropagation()}function gs(t){return t.stopPropagation()}const bs=se({label:P().optional(),apiKey:P().min(1,"API key is required")});function vs(t){const e=$.c(61),{providerId:s,onCancel:n,onSuccess:i}=t,{org:o}=ne();let r;e[0]!==o.id?(r={connectionId:ce,orgId:o.id},e[0]=o.id,e[1]=r):r=e[1];const a=de(r),d=fe(),[m,c]=O.useState(!1);let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u={resolver:Se(bs),defaultValues:{label:"",apiKey:""}},e[2]=u):u=e[2];const{register:h,handleSubmit:f,formState:v}=ye(u),{errors:b}=v;let w;e[3]!==a||e[4]!==s?(w=async q=>{await a.callTool({name:"AI_PROVIDER_KEY_CREATE",arguments:{providerId:s,label:q.label||"Personal key",apiKey:q.apiKey}})},e[3]=a,e[4]=s,e[5]=w):w=e[5];let j;e[6]!==i||e[7]!==o.id||e[8]!==d?(j=()=>{d.invalidateQueries({queryKey:X.aiProviderKeys(o.id)}),d.invalidateQueries({queryKey:X.aiProviders(o.id)}),Y.success("Key saved successfully"),i()},e[6]=i,e[7]=o.id,e[8]=d,e[9]=j):j=e[9];let x;e[10]!==w||e[11]!==j?(x={mutationFn:w,onSuccess:j,onError:js},e[10]=w,e[11]=j,e[12]=x):x=e[12];const{mutate:y,isPending:S,error:_}=le(x);let g;e[13]!==y?(g=q=>y(q),e[13]=y,e[14]=g):g=e[14];let N;e[15]!==f||e[16]!==g?(N=f(g),e[15]=f,e[16]=g,e[17]=N):N=e[17];let I;e[18]===Symbol.for("react.memo_cache_sentinel")?(I=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),e[18]=I):I=e[18];let p;e[19]!==h?(p=h("label"),e[19]=h,e[20]=p):p=e[20];let C;e[21]!==p?(C=l.jsxs("div",{className:"space-y-1",children:[I,l.jsx(oe,{placeholder:"e.g. Personal key",...p,className:"h-8 text-sm"})]}),e[21]=p,e[22]=C):C=e[22];let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"API Key"}),e[23]=E):E=e[23];const k=m?"text":"password";let A;e[24]!==h?(A=h("apiKey"),e[24]=h,e[25]=A):A=e[25];let M;e[26]!==k||e[27]!==A?(M=l.jsx(oe,{type:k,placeholder:"sk-...",...A,className:"ph-no-capture h-8 text-sm pr-8"}),e[26]=k,e[27]=A,e[28]=M):M=e[28];let T;e[29]!==m?(T=()=>c(!m),e[29]=m,e[30]=T):T=e[30];let F;e[31]!==m?(F=m?l.jsx(qe,{size:14}):l.jsx(He,{size:14}),e[31]=m,e[32]=F):F=e[32];let R;e[33]!==T||e[34]!==F?(R=l.jsx("button",{type:"button",onClick:T,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:F}),e[33]=T,e[34]=F,e[35]=R):R=e[35];let D;e[36]!==M||e[37]!==R?(D=l.jsxs("div",{className:"relative",children:[M,R]}),e[36]=M,e[37]=R,e[38]=D):D=e[38];let B;e[39]!==b.apiKey?(B=b.apiKey&&l.jsx("p",{className:"text-xs text-destructive",children:b.apiKey.message}),e[39]=b.apiKey,e[40]=B):B=e[40];let Q;e[41]!==D||e[42]!==B?(Q=l.jsxs("div",{className:"space-y-1",children:[E,D,B]}),e[41]=D,e[42]=B,e[43]=Q):Q=e[43];let U;e[44]!==_?(U=_&&l.jsx("p",{className:"text-xs text-destructive",children:_.message}),e[44]=_,e[45]=U):U=e[45];let L;e[46]!==S||e[47]!==n?(L=l.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:S,children:"Cancel"}),e[46]=S,e[47]=n,e[48]=L):L=e[48];const V=S?"Saving...":"Save Key";let K;e[49]!==S||e[50]!==V?(K=l.jsx(te,{type:"submit",size:"sm",disabled:S,children:V}),e[49]=S,e[50]=V,e[51]=K):K=e[51];let H;e[52]!==L||e[53]!==K?(H=l.jsxs(We,{children:[L,K]}),e[52]=L,e[53]=K,e[54]=H):H=e[54];let G;return e[55]!==C||e[56]!==Q||e[57]!==U||e[58]!==H||e[59]!==N?(G=l.jsxs("form",{onSubmit:N,className:"space-y-3",children:[C,Q,U,H]}),e[55]=C,e[56]=Q,e[57]=U,e[58]=H,e[59]=N,e[60]=G):G=e[60],G}function js(t){Y.error(`Failed to save key: ${t.message}`)}const ys=se({label:P().optional(),baseUrl:P().min(1,"Base URL is required"),apiKey:P().optional()});function Ss(t){const e=$.c(66),{onCancel:s,onSuccess:n}=t,{org:i}=ne();let o;e[0]!==i.id?(o={connectionId:ce,orgId:i.id},e[0]=i.id,e[1]=o):o=e[1];const r=de(o),a=fe(),[d,m]=O.useState(!1);let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c={resolver:Se(ys),defaultValues:{label:"",baseUrl:"",apiKey:""}},e[2]=c):c=e[2];const{register:u,handleSubmit:h,formState:f}=ye(c),{errors:v}=f;let b;e[3]!==r?(b=async z=>{const J=JSON.stringify({baseUrl:z.baseUrl,apiKey:z.apiKey||""});await r.callTool({name:"AI_PROVIDER_KEY_CREATE",arguments:{providerId:"openai-compatible",label:z.label||z.baseUrl,apiKey:J}})},e[3]=r,e[4]=b):b=e[4];let w;e[5]!==n||e[6]!==i.id||e[7]!==a?(w=()=>{a.invalidateQueries({queryKey:X.aiProviderKeys(i.id)}),a.invalidateQueries({queryKey:X.aiProviders(i.id)}),Y.success("Connection saved successfully"),n()},e[5]=n,e[6]=i.id,e[7]=a,e[8]=w):w=e[8];let j;e[9]!==b||e[10]!==w?(j={mutationFn:b,onSuccess:w,onError:Ns},e[9]=b,e[10]=w,e[11]=j):j=e[11];const{mutate:x,isPending:y,error:S}=le(j);let _;e[12]!==x?(_=z=>x(z),e[12]=x,e[13]=_):_=e[13];let g;e[14]!==h||e[15]!==_?(g=h(_),e[14]=h,e[15]=_,e[16]=g):g=e[16];let N;e[17]===Symbol.for("react.memo_cache_sentinel")?(N=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),e[17]=N):N=e[17];let I;e[18]!==u?(I=u("label"),e[18]=u,e[19]=I):I=e[19];let p;e[20]!==I?(p=l.jsxs("div",{className:"space-y-1",children:[N,l.jsx(oe,{placeholder:"e.g. LiteLLM, Ollama",...I,className:"h-8 text-sm"})]}),e[20]=I,e[21]=p):p=e[21];let C;e[22]===Symbol.for("react.memo_cache_sentinel")?(C=l.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),e[22]=C):C=e[22];let E;e[23]!==u?(E=u("baseUrl"),e[23]=u,e[24]=E):E=e[24];let k;e[25]!==E?(k=l.jsx(oe,{type:"url",placeholder:"http://localhost:4000/v1",...E,className:"h-8 text-sm"}),e[25]=E,e[26]=k):k=e[26];let A;e[27]!==v.baseUrl?(A=v.baseUrl&&l.jsx("p",{className:"text-xs text-destructive",children:v.baseUrl.message}),e[27]=v.baseUrl,e[28]=A):A=e[28];let M;e[29]!==k||e[30]!==A?(M=l.jsxs("div",{className:"space-y-1",children:[C,k,A]}),e[29]=k,e[30]=A,e[31]=M):M=e[31];let T;e[32]===Symbol.for("react.memo_cache_sentinel")?(T=l.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API Key ",l.jsx("span",{className:"text-muted-foreground/60",children:"(optional)"})]}),e[32]=T):T=e[32];const F=d?"text":"password";let R;e[33]!==u?(R=u("apiKey"),e[33]=u,e[34]=R):R=e[34];let D;e[35]!==F||e[36]!==R?(D=l.jsx(oe,{type:F,placeholder:"sk-...",...R,className:"ph-no-capture h-8 text-sm pr-8"}),e[35]=F,e[36]=R,e[37]=D):D=e[37];let B;e[38]!==d?(B=()=>m(!d),e[38]=d,e[39]=B):B=e[39];let Q;e[40]!==d?(Q=d?l.jsx(qe,{size:14}):l.jsx(He,{size:14}),e[40]=d,e[41]=Q):Q=e[41];let U;e[42]!==B||e[43]!==Q?(U=l.jsx("button",{type:"button",onClick:B,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:Q}),e[42]=B,e[43]=Q,e[44]=U):U=e[44];let L;e[45]!==D||e[46]!==U?(L=l.jsxs("div",{className:"space-y-1",children:[T,l.jsxs("div",{className:"relative",children:[D,U]})]}),e[45]=D,e[46]=U,e[47]=L):L=e[47];let V;e[48]!==S?(V=S&&l.jsx("p",{className:"text-xs text-destructive",children:S.message}),e[48]=S,e[49]=V):V=e[49];let K;e[50]!==y||e[51]!==s?(K=l.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:s,disabled:y,children:"Cancel"}),e[50]=y,e[51]=s,e[52]=K):K=e[52];const H=y?"Saving...":"Save Connection";let G;e[53]!==y||e[54]!==H?(G=l.jsx(te,{type:"submit",size:"sm",disabled:y,children:H}),e[53]=y,e[54]=H,e[55]=G):G=e[55];let q;e[56]!==K||e[57]!==G?(q=l.jsxs(We,{children:[K,G]}),e[56]=K,e[57]=G,e[58]=q):q=e[58];let ee;return e[59]!==p||e[60]!==M||e[61]!==L||e[62]!==V||e[63]!==q||e[64]!==g?(ee=l.jsxs("form",{onSubmit:g,className:"space-y-3",children:[p,M,L,V,q]}),e[59]=p,e[60]=M,e[61]=L,e[62]=V,e[63]=q,e[64]=g,e[65]=ee):ee=e[65],ee}function Ns(t){Y.error(`Failed to save connection: ${t.message}`)}function Pe({provider:t,keys:e}){const{org:s}=ne(),n=de({connectionId:ce,orgId:s.id}),i=fe(),[o,r]=O.useState(!1),[a,d]=O.useState(!1),[m,c]=O.useState(null),u=t.supportedMethods.includes("cli-activate"),h=e.length>0,{mutate:f,isPending:v}=le({mutationFn:async p=>(await n.callTool({name:"AI_PROVIDER_KEY_DELETE",arguments:{keyId:p}}),p),onSuccess:p=>{i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),i.invalidateQueries({queryKey:X.aiProviderModels(s.id,p)}),Y.success("Key deleted")},onError:p=>{Y.error(`Failed to delete key: ${p.message}`)}}),{mutate:b}=le({mutationFn:async({code:p,stateToken:C})=>{const E=await n.callTool({name:"AI_PROVIDER_OAUTH_EXCHANGE",arguments:{providerId:t.id,code:p,stateToken:C,label:"Connected via OAuth"}});if(E?.isError){const k=E.content?.[0]?.text??"OAuth exchange failed";throw new Error(k)}},onSuccess:()=>{Z("ai_provider_oauth_succeeded",{provider_id:t.id}),i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),Y.success(`${t.name} connected successfully`),d(!1),c(null)},onError:p=>{Z("ai_provider_oauth_failed",{provider_id:t.id,error:p.message}),Y.error(`OAuth connection failed: ${p.message}`),d(!1),c(null)}}),{mutate:w,isPending:j}=le({mutationFn:async()=>{const p=await n.callTool({name:"AI_PROVIDER_CLI_ACTIVATE",arguments:{providerId:t.id}});if(p?.isError)throw new Error(p.content?.[0]?.text??"CLI activation failed");return p.structuredContent},onSuccess:p=>{if(!p?.activated){Z("ai_provider_cli_activate_failed",{provider_id:t.id,error:p?.error??"unknown"}),Y.error(p?.error??"CLI activation failed");return}Z("ai_provider_cli_activated",{provider_id:t.id}),i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),Y.success(`${t.name} activated`)},onError:p=>{Z("ai_provider_cli_activate_failed",{provider_id:t.id,error:p.message}),Y.error(p.message)}}),{mutate:x,isPending:y}=le({mutationFn:async()=>{const p=await n.callTool({name:"AI_PROVIDER_PROVISION_KEY",arguments:{providerId:t.id}});if(p?.isError){const C=p.content?.[0]?.text??"Key provisioning failed";throw new Error(C)}},onSuccess:()=>{Z("ai_provider_provision_succeeded",{provider_id:t.id}),i.invalidateQueries({queryKey:X.aiProviderKeys(s.id)}),i.invalidateQueries({queryKey:X.aiProviders(s.id)}),Y.success(`${t.name} connected successfully`)},onError:p=>{Z("ai_provider_provision_failed",{provider_id:t.id,error:p.message}),Y.error(`Failed to connect ${t.name}: ${p.message}`)}});O.useEffect(()=>{if(!a||!m)return;let p=!1;const C=k=>{if(k.origin===window.location.origin&&k.data?.type==="AI_PROVIDER_OAUTH_CALLBACK"){const{code:A,stateToken:M}=k.data;M===m?(p=!0,b({code:A,stateToken:M})):(console.error("State token mismatch"),Y.error("Security check failed: State token mismatch"),d(!1),c(null))}};window.addEventListener("message",C);const E=setTimeout(()=>{p||(Z("ai_provider_oauth_timeout",{provider_id:t.id}),d(!1),c(null),Y.error("Connection timed out"))},12e4);return()=>{window.removeEventListener("message",C),clearTimeout(E)}},[a,m,b,t.id]);const S=!!t.supportsProvision,_=t.supportedMethods.includes("oauth-pkce"),g=t.supportedMethods.includes("api-key"),N=()=>{if(!(o||a||j||y)){if(u){h||(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"cli-activate"}),w());return}S?(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"provision"}),x()):_?(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"oauth-pkce"}),I()):g&&(Z("ai_provider_connect_clicked",{provider_id:t.id,method:"api-key"}),r(!0))}},I=async()=>{try{d(!0);const p=await n.callTool({name:"AI_PROVIDER_OAUTH_URL",arguments:{providerId:t.id,callbackUrl:`${window.location.origin}/oauth/callback/ai-provider`}});if(p.structuredContent)c(p.structuredContent.stateToken),window.open(p.structuredContent.url,"AiProviderOAuth","width=600,height=700");else throw new Error("Invalid response from AI_PROVIDER_OAUTH_URL")}catch(p){d(!1),Y.error(`Failed to start OAuth: ${p instanceof Error?p.message:String(p)}`)}};return l.jsxs(l.Fragment,{children:[l.jsxs(Je,{className:ie("p-4 flex flex-col gap-3 transition-colors relative",h&&"border-primary/20",!a&&!j&&!y&&"cursor-pointer hover:bg-muted/30",(a||j||y)&&"cursor-wait"),onClick:N,children:[h&&l.jsx("div",{className:"absolute top-4 right-4 w-2 h-2 rounded-full bg-green-500"}),l.jsx("div",{className:"flex items-start justify-between",children:l.jsxs("div",{className:"flex items-center gap-3",children:[t.logo?l.jsx("img",{src:t.logo,alt:t.name,className:"size-8 rounded-md object-contain dark:bg-white dark:rounded-md dark:p-0.5"}):l.jsx(Xt,{fallback:t.name.charAt(0),className:"size-8 bg-primary/10 text-primary"}),l.jsxs("div",{children:[l.jsx("h3",{className:"font-medium text-base",children:t.name}),l.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:j?"Checking CLI...":y?"Connecting...":a?"Authorizing...":t.description})]})]})}),h&&l.jsx("div",{className:"mt-1",children:u?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-xs text-muted-foreground",children:["Authenticated via ",t.name," CLI"]}),l.jsx(Re,{keys:e,onDelete:f,isDeleting:v})]}):l.jsxs(l.Fragment,{children:[!t.supportsCredits&&l.jsx("div",{className:"flex items-center justify-between",children:l.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:[e.length," key",e.length!==1?"s":""," configured"]})}),t.supportsCredits&&l.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.length," key",e.length!==1?"s":""," configured · Managed above"]}),l.jsx(Re,{keys:e,onDelete:f,isDeleting:v})]})})]}),l.jsx(Be,{open:o,onOpenChange:p=>{p||r(!1)},children:l.jsxs(Ue,{children:[l.jsxs(jt,{children:[l.jsxs(Ve,{children:["Connect ",t.name]}),l.jsx(yt,{children:t.id==="openai-compatible"?"Enter the base URL and optional API key for your OpenAI-compatible endpoint.":`Add an API key to connect your ${t.name} account.`})]}),t.id==="openai-compatible"?l.jsx(Ss,{onCancel:()=>r(!1),onSuccess:()=>r(!1)}):l.jsx(vs,{providerId:t.id,onCancel:()=>r(!1),onSuccess:()=>r(!1)})]})})]})}function at(t){const e=$.c(20);let s;e[0]!==t?(s=t===void 0?{}:t,e[0]=t,e[1]=s):s=e[1];const{hideProviderId:n}=s,i=Ye(),o=ae();let r,a,d,m;if(e[2]!==i?.providers||e[3]!==o||e[4]!==n){let h;e[9]!==n?(h=j=>j.id!==n,e[9]=n,e[10]=h):h=e[10];const f=(i?.providers??[]).filter(h),v=f.filter(_s),b=f.filter(ws);d="flex flex-col gap-5 w-full",m=v.length>0&&l.jsxs("div",{className:"relative rounded-xl border border-lime-400/30 bg-gradient-to-br from-lime-50/50 via-transparent to-yellow-50/30 dark:from-lime-950/20 dark:to-yellow-950/10 p-4",children:[l.jsx("div",{className:"absolute inset-0 rounded-xl bg-gradient-to-br from-lime-400/5 to-yellow-400/5 pointer-events-none"}),l.jsx("p",{className:"text-xs font-medium text-lime-700 dark:text-lime-400 mb-3 relative",children:"Local models — use your existing AI provider"}),l.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-3 relative",children:v.map(j=>l.jsx(Pe,{provider:j,keys:o.filter(x=>x.providerId===j.id)},j.id))})]}),r="grid grid-cols-1 lg:grid-cols-2 gap-4";let w;e[11]!==o?(w=j=>l.jsx(Pe,{provider:j,keys:o.filter(x=>x.providerId===j.id)},j.id),e[11]=o,e[12]=w):w=e[12],a=b.map(w),e[2]=i?.providers,e[3]=o,e[4]=n,e[5]=r,e[6]=a,e[7]=d,e[8]=m}else r=e[5],a=e[6],d=e[7],m=e[8];let c;e[13]!==r||e[14]!==a?(c=l.jsx("div",{className:r,children:a}),e[13]=r,e[14]=a,e[15]=c):c=e[15];let u;return e[16]!==d||e[17]!==m||e[18]!==c?(u=l.jsxs("div",{className:d,children:[m,c]}),e[16]=d,e[17]=m,e[18]=c,e[19]=u):u=e[19],u}function ws(t){return!t.supportedMethods.includes("cli-activate")}function _s(t){return t.supportedMethods.includes("cli-activate")}const Cs={usd:[10,20,100],brl:[50,100,500]};function Is(){const t=$.c(28),{org:e}=ne();let s;t[0]!==e.id?(s={connectionId:ce,orgId:e.id},t[0]=e.id,t[1]=s):s=t[1];const n=de(s),[i,o]=O.useState(!1),{mutate:r,isPending:a}=le({mutationFn:async N=>{const I=await n.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:N,currency:h}});if(I?.isError)throw new Error(I.content?.[0]?.text??"Failed to get top-up URL");return I.structuredContent?.url},onSuccess:Es,onError:ks}),[d,m]=O.useState(""),[c,u]=O.useState("usd"),h=c,f=parseFloat(d),v=!isNaN(f)&&f>=1,b=h==="brl"?"R$":"$";let w;t[2]!==u?(w=N=>{N&&u(N)},t[2]=u,t[3]=w):w=t[3];let j,x;t[4]===Symbol.for("react.memo_cache_sentinel")?(j=l.jsx(ke,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),x=l.jsx(ke,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),t[4]=j,t[5]=x):(j=t[4],x=t[5]);let y;t[6]!==h||t[7]!==w?(y=l.jsxs(Yt,{type:"single",variant:"outline",size:"default",value:h,onValueChange:w,children:[j,x]}),t[6]=h,t[7]=w,t[8]=y):y=t[8];let S;t[9]!==h||t[10]!==b||t[11]!==i||t[12]!==a||t[13]!==r?(S=!i&&l.jsxs(l.Fragment,{children:[Cs[h].map(N=>l.jsxs(te,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:a,onClick:()=>r(N*100),children:[b,N]},N)),l.jsx(te,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>o(!0),disabled:a,children:"Custom"})]}),t[9]=h,t[10]=b,t[11]=i,t[12]=a,t[13]=r,t[14]=S):S=t[14];let _;t[15]!==b||t[16]!==d||t[17]!==f||t[18]!==i||t[19]!==v||t[20]!==a||t[21]!==m||t[22]!==r?(_=i&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative max-w-[140px]",children:[l.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:b}),l.jsx(oe,{type:"number",min:"1",step:"1",placeholder:"50",value:d,onChange:N=>m(N.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),l.jsx(te,{className:"h-10",disabled:!v||a,onClick:()=>r(Math.round(f*100)),children:a?"...":"Add"}),l.jsx(te,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{o(!1),m("")},children:"Cancel"})]}),t[15]=b,t[16]=d,t[17]=f,t[18]=i,t[19]=v,t[20]=a,t[21]=m,t[22]=r,t[23]=_):_=t[23];let g;return t[24]!==y||t[25]!==S||t[26]!==_?(g=l.jsx("div",{className:"flex flex-col gap-2.5",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[y,S,_]})}),t[24]=y,t[25]=S,t[26]=_,t[27]=g):g=t[27],g}function ks(t){Y.error(`Top-up failed: ${t.message}`)}function Es(t){t&&window.open(t,"_blank","noopener,noreferrer")}function Ms(t){return t<=0?"text-destructive":t<=1?"text-amber-500 dark:text-amber-400":"text-foreground"}function As(){const t=$.c(59),{org:e}=ne();let s;t[0]!==e.id?(s={connectionId:ce,orgId:e.id},t[0]=e.id,t[1]=s):s=t[1];const n=de(s),i=fe(),o=ae();let r;t[2]!==o?(r=o.find(Ts),t[2]=o,t[3]=r):r=t[3];const a=r,[d,m]=O.useState(!1);let c;t[4]!==n||t[5]!==a?(c=async()=>{a&&await n.callTool({name:"AI_PROVIDER_KEY_DELETE",arguments:{keyId:a.id}})},t[4]=n,t[5]=a,t[6]=c):c=t[6];let u;t[7]!==e.id||t[8]!==i?(u=()=>{i.invalidateQueries({queryKey:X.aiProviderKeys(e.id)}),i.invalidateQueries({queryKey:X.aiProviders(e.id)}),Y.success("Deco AI Gateway disconnected"),m(!1)},t[7]=e.id,t[8]=i,t[9]=u):u=t[9];let h;t[10]!==c||t[11]!==u?(h={mutationFn:c,onSuccess:u,onError:Os},t[10]=c,t[11]=u,t[12]=h):h=t[12];const{mutate:f,isPending:v}=le(h);let b;t[13]!==e.id?(b=X.aiProviderCredits(e.id,"deco"),t[13]=e.id,t[14]=b):b=t[14];const w=!!a;let j;t[15]!==n?(j=async()=>{const ee=await n.callTool({name:"AI_PROVIDER_CREDITS",arguments:{providerId:"deco"}});return ee?.isError?null:ee.structuredContent??null},t[15]=n,t[16]=j):j=t[16];let x;t[17]!==b||t[18]!==w||t[19]!==j?(x={queryKey:b,enabled:w,staleTime:6e4,queryFn:j},t[17]=b,t[18]=w,t[19]=j,t[20]=x):x=t[20];const{data:y,isLoading:S,refetch:_,isFetching:g}=Ke(x);if(!a)return null;const N=y?.balanceCents!=null?y.balanceCents/100:null;let I;t[21]!==N?(I=N!=null?`$${N.toFixed(2)}`:"—",t[21]=N,t[22]=I):I=t[22];const p=I;let C;t[23]===Symbol.for("react.memo_cache_sentinel")?(C=ie("relative rounded-xl overflow-hidden","border border-border","bg-gradient-to-br from-background via-muted/30 to-background"),t[23]=C):C=t[23];let E;t[24]===Symbol.for("react.memo_cache_sentinel")?(E=l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Deco AI Gateway"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Access to 100+ models"})]})]}),t[24]=E):E=t[24];let k;t[25]===Symbol.for("react.memo_cache_sentinel")?(k=()=>m(!0),t[25]=k):k=t[25];let A;t[26]!==v?(A=l.jsxs("div",{className:"flex items-center justify-between mb-5",children:[E,l.jsx(te,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:k,disabled:v,children:"Disconnect"})]}),t[26]=v,t[27]=A):A=t[27];let M;t[28]===Symbol.for("react.memo_cache_sentinel")?(M=l.jsxs(et,{children:[l.jsx(Ze,{children:"Disconnect Deco AI Gateway"}),l.jsx(tt,{children:"This will remove the Deco AI Gateway from this workspace. Your credit balance is preserved and will be available if you reconnect."})]}),t[28]=M):M=t[28];let T;t[29]===Symbol.for("react.memo_cache_sentinel")?(T=l.jsx(st,{children:"Cancel"}),t[29]=T):T=t[29];let F;t[30]!==f?(F=l.jsxs(nt,{children:[M,l.jsxs(lt,{children:[T,l.jsx(it,{onClick:()=>f(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]}),t[30]=f,t[31]=F):F=t[31];let R;t[32]!==d||t[33]!==F?(R=l.jsx(ot,{open:d,onOpenChange:m,children:F}),t[32]=d,t[33]=F,t[34]=R):R=t[34];let D;t[35]!==N||t[36]!==p||t[37]!==g||t[38]!==S?(D=S||g?l.jsx(W,{className:"h-9 w-24"}):l.jsx("span",{className:ie("text-3xl font-semibold tabular-nums tracking-tight",N!=null&&Ms(N)),children:p}),t[35]=N,t[36]=p,t[37]=g,t[38]=S,t[39]=D):D=t[39];let B;t[40]!==_?(B=()=>_(),t[40]=_,t[41]=B):B=t[41];const Q=g&&"animate-spin";let U;t[42]!==Q?(U=ie(Q),t[42]=Q,t[43]=U):U=t[43];let L;t[44]!==U?(L=l.jsx($e,{size:14,className:U}),t[44]=U,t[45]=L):L=t[45];let V;t[46]!==g||t[47]!==B||t[48]!==L?(V=l.jsx("button",{type:"button",onClick:B,disabled:g,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":"Refresh balance",children:L}),t[46]=g,t[47]=B,t[48]=L,t[49]=V):V=t[49];let K;t[50]!==D||t[51]!==V?(K=l.jsxs("div",{className:"flex items-baseline gap-2",children:[D,V]}),t[50]=D,t[51]=V,t[52]=K):K=t[52];let H;t[53]===Symbol.for("react.memo_cache_sentinel")?(H=l.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Available credit balance"}),t[53]=H):H=t[53];let G;t[54]===Symbol.for("react.memo_cache_sentinel")?(G=l.jsxs("div",{className:"mt-5 pt-4 border-t border-border/60",children:[l.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:"Add credits"}),l.jsx(Is,{})]}),t[54]=G):G=t[54];let q;return t[55]!==A||t[56]!==R||t[57]!==K?(q=l.jsx("div",{className:C,children:l.jsxs("div",{className:"relative p-6",children:[A,R,K,H,G]})}),t[55]=A,t[56]=R,t[57]=K,t[58]=q):q=t[58],q}function Os(t){Y.error(`Failed to disconnect: ${t.message}`)}function Ts(t){return t.providerId==="deco"}const Rs=t=>t.capabilities?.includes("image")===!0,Ps=t=>{const e=t.modelId.toLowerCase().replace(/[^a-z0-9]/g,"");return e.includes("sonar")||e.includes("deepresearch")},zs={fast:"Fast",smart:"Smart",thinking:"Thinking"},Fs={fast:"Fastest responses, best for quick tasks",smart:"Balanced speed and capability",thinking:"Most capable, best for complex tasks"};function ge(t){const e=$.c(30),{label:s,description:n,slot:i,onSlotChange:o,filterModels:r,defaultKeyId:a}=t,d=ae(),[m,c]=O.useState(i?.keyId??a);let u;e[0]!==i?(u=()=>{i?.keyId&&c(i.keyId)},e[0]=i,e[1]=u):u=e[1];const h=i?.keyId;let f;e[2]!==h?(f=[h],e[2]=h,e[3]=f):f=e[3],O.useEffect(u,f);const v=m??a;let b;e[4]!==v||e[5]!==d?(b=v?d.find(k=>k.id===v):null,e[4]=v,e[5]=d,e[6]=b):b=e[6];const w=b,{models:j,isLoading:x}=ue(r?v??void 0:void 0);let y;e[7]!==j||e[8]!==r||e[9]!==x?(y=r?x||j.some(r):!0,e[7]=j,e[8]=r,e[9]=x,e[10]=y):y=e[10];const S=y;let _;e[11]!==i||e[12]!==w?.providerId?(_=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:w?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[11]=i,e[12]=w?.providerId,e[13]=_):_=e[13];const g=_;let N;e[14]!==s?(N=l.jsx("p",{className:"text-sm font-medium text-foreground",children:s}),e[14]=s,e[15]=N):N=e[15];let I;e[16]!==n?(I=n&&l.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:n}),e[16]=n,e[17]=I):I=e[17];let p;e[18]!==N||e[19]!==I?(p=l.jsxs("div",{className:"min-w-0 flex-1",children:[N,I]}),e[18]=N,e[19]=I,e[20]=p):p=e[20];let C;e[21]!==v||e[22]!==r||e[23]!==S||e[24]!==o||e[25]!==g?(C=l.jsx("div",{className:"shrink-0",children:r&&!S?l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Not available with current provider"}):l.jsx(_l,{variant:"bordered",placeholder:"Pick model",model:g,credentialId:v,filterModels:r,onCredentialChange:k=>c(k),onModelChange:k=>{const A=k.keyId??v??"";c(A),o({keyId:A,modelId:k.modelId,title:k.title})}})}),e[21]=v,e[22]=r,e[23]=S,e[24]=o,e[25]=g,e[26]=C):C=e[26];let E;return e[27]!==C||e[28]!==p?(E=l.jsxs("div",{className:"flex items-center justify-between gap-4 py-2",children:[p,C]}),e[27]=C,e[28]=p,e[29]=E):E=e[29],E}function Ds(t){const e=$.c(2),{isPending:s,showSaved:n}=t;if(s){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[l.jsx($e,{size:12,className:"animate-spin"}),"Saving…"]}),e[0]=i):i=e[0],i}if(n){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[l.jsx(Vt,{size:12}),"Saved"]}),e[1]=i):i=e[1],i}return null}function Ls(){const t=ae(),e=Jt(),s=t.length>0,n=ye({resolver:Se(fs),values:e,mode:"onChange"}),{mutate:i,isPending:o,isSuccess:r}=Zt(),a=n.watch(),d=n.formState.isDirty;O.useEffect(()=>{if(!d)return;const x=setTimeout(()=>{i(a,{onSuccess:()=>n.reset(a,{keepValues:!0}),onError:y=>{n.reset(e),Y.error(`Failed to save: ${y.message}`)}})},250);return()=>clearTimeout(x)},[a,d,i,n,e]);const m=t[0],c=t[1],u=t[2],{models:h}=ue(m?.id),{models:f}=ue(c?.id),{models:v}=ue(u?.id),b=x=>{const y=n.getValues("chat");if(x&&!y.fast&&!y.smart&&!y.thinking){const S={};m?.id&&(S[m.id]=h),c?.id&&(S[c.id]=f),u?.id&&(S[u.id]=v);const _=Ie(t,S);n.reset({enabled:!0,chat:_.chat,image:_.image,webResearch:_.webResearch},{keepDirty:!0})}else n.setValue("enabled",x,{shouldDirty:!0})};O.useEffect(()=>{s||n.reset({enabled:!1,chat:{fast:null,smart:null,thinking:null},image:null,webResearch:null})},[s,n]),O.useEffect(()=>{const x=n.getValues();if(!x.enabled)return;const y=new Set(t.map(k=>k.id)),S={};m?.id&&(S[m.id]=h),c?.id&&(S[c.id]=f),u?.id&&(S[u.id]=v);const _=k=>k!=null&&!y.has(k.keyId),g={fast:_(x.chat.fast)?null:x.chat.fast,smart:_(x.chat.smart)?null:x.chat.smart,thinking:_(x.chat.thinking)?null:x.chat.thinking},N=_(x.image)?null:x.image,I=_(x.webResearch)?null:x.webResearch,p=!g.fast||!g.smart||!g.thinking||!N||!I,C=g.fast===x.chat.fast&&g.smart===x.chat.smart&&g.thinking===x.chat.thinking;if(!p&&C)return;const E=Ie(t,S);n.reset({...x,chat:{fast:g.fast??E.chat.fast,smart:g.smart??E.chat.smart,thinking:g.thinking??E.chat.thinking},image:N??E.image,webResearch:I??E.webResearch},{keepDirty:!0})},[n,t,h,f,v,m?.id,c?.id,u?.id]);const j=n.watch("enabled")&&s;return l.jsxs(Je,{className:"p-6",children:[l.jsx(qt,{className:"p-0",children:l.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ht,{className:"text-sm",children:"Simple model mode"}),l.jsx(Ds,{isPending:o,showSaved:r&&!d})]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:s?"Replace the model picker with a Fast / Smart / Thinking toggle for all members of this org.":"Connect an AI provider above to enable this feature."})]}),l.jsx(Gt,{checked:j,onCheckedChange:b,disabled:o||!s})]})}),j&&l.jsxs(Qt,{className:"flex flex-col p-0 mt-6",children:[l.jsxs("div",{className:"flex flex-col gap-1 pb-6",children:[l.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Chat models"}),["fast","smart","thinking"].map(x=>l.jsx(pe,{control:n.control,name:`chat.${x}`,render:({field:y})=>l.jsx(ge,{label:zs[x],description:Fs[x],slot:y.value,defaultKeyId:t[0]?.id??null,onSlotChange:S=>y.onChange(S)})},x))]}),l.jsxs("div",{className:"flex flex-col gap-1 pt-6 border-t border-border/50",children:[l.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Other models"}),l.jsx(pe,{control:n.control,name:"image",render:({field:x})=>l.jsx(ge,{label:"Image",slot:x.value,defaultKeyId:t[0]?.id??null,filterModels:Rs,onSlotChange:y=>x.onChange(y)})}),l.jsx(pe,{control:n.control,name:"webResearch",render:({field:x})=>l.jsx(ge,{label:"Web research",slot:x.value,defaultKeyId:t[0]?.id??null,filterModels:Ps,onSlotChange:y=>x.onChange(y)})})]})]})]})}function Ks(){const t=$.c(6),s=ae().some($s);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsx(As,{}),t[0]=n):n=t[0];const i=s?"deco":void 0;let o;t[1]!==i?(o=l.jsx(at,{hideProviderId:i}),t[1]=i,t[2]=o):o=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=l.jsx(O.Suspense,{fallback:l.jsx(W,{className:"h-16 w-full"}),children:l.jsx(Ls,{})}),t[3]=r):r=t[3];let a;return t[4]!==o?(a=l.jsxs("div",{className:"flex flex-col gap-6",children:[n,o,r]}),t[4]=o,t[5]=a):a=t[5],a}function $s(t){return t.providerId==="deco"}function ii(){const t=$.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx(he.Title,{children:"AI Providers"}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=l.jsx(he,{children:l.jsx(he.Content,{children:l.jsx(he.Body,{children:l.jsxs("div",{className:"flex flex-col gap-6",children:[e,l.jsx(Le,{fallback:Bs,children:l.jsx(O.Suspense,{fallback:l.jsx(W,{className:"h-64 w-full"}),children:l.jsx(Ks,{})})})]})})})}),t[1]=s):s=t[1],s}function Bs(t){const{error:e}=t;return l.jsx(xs,{error:e??new Error("Failed to load AI providers")})}function Us(){const t=$.c(9),{org:e}=ne();let s;t[0]!==e.id?(s={connectionId:ce,orgId:e.id},t[0]=e.id,t[1]=s):s=t[1];const n=de(s);let i;t[2]!==e.id?(i=X.defaultBrand(e.id),t[2]=e.id,t[3]=i):i=t[3];let o;t[4]!==n?(o=async()=>{const d=await n.callTool({name:"BRAND_CONTEXT_LIST",arguments:{}}),m=ts(d);return(Array.isArray(m?.items)?m.items:[]).find(Vs)??null},t[4]=n,t[5]=o):o=t[5];let r;t[6]!==i||t[7]!==o?(r={queryKey:i,queryFn:o},t[6]=i,t[7]=o,t[8]=r):r=t[8];const{data:a}=Ke(r);return a??null}function Vs(t){return t.isDefault&&!t.archivedAt}function Ws(t){const e=t.colors;if(!e)return null;if(Array.isArray(e)){const s=e.find(i=>typeof i=="object"&&i!==null&&"label"in i&&/primary|brand|main/i.test(i.label)),n=s?s.value:e[0]?.value;return typeof n=="string"?n:null}if(typeof e=="object"){const s=e;return s.primary??Object.values(s)[0]??null}return null}function qs(t){const e=$.c(31);let s;e[0]!==t?(s=t===void 0?{}:t,e[0]=t,e[1]=s):s=e[1];const{title:n,description:i}=s,{org:o}=ne(),{localMode:r}=pt(),a=Us(),d=o.name;let m;e[2]!==a?(m=a?Ws(a):null,e[2]=a,e[3]=m):m=e[3];const c=m,u=a?.favicon??a?.logo??null,h=n??(d?`${d} is ready for agents`:"Your agents are almost ready"),f=i??"Choose how to power your AI team.",v=!!(u||c);let b;e[4]!==c?(b=c?{backgroundColor:`${c}18`,borderColor:`${c}30`}:void 0,e[4]=c,e[5]=b):b=e[5];const w=b,j=v?"flex items-center justify-center size-14 rounded-2xl border":"flex items-center justify-center size-14 rounded-2xl bg-gradient-to-br from-lime-100 to-yellow-50 dark:from-lime-900/30 dark:to-yellow-900/20 border border-lime-300/40 dark:border-lime-700/30";let x;e[6]!==u||e[7]!==c?(x=u?l.jsx("img",{src:u,alt:"",className:"size-7 rounded object-contain"}):l.jsx(Bt,{size:24,style:c?{color:c}:void 0,className:ie(!c&&"text-lime-600 dark:text-lime-400")}),e[6]=u,e[7]=c,e[8]=x):x=e[8];let y;e[9]!==j||e[10]!==w||e[11]!==x?(y=l.jsx("div",{className:j,style:w,children:x}),e[9]=j,e[10]=w,e[11]=x,e[12]=y):y=e[12];let S;e[13]!==h?(S=l.jsx("p",{className:"text-xl font-semibold text-foreground tracking-tight",children:h}),e[13]=h,e[14]=S):S=e[14];let _;e[15]!==f?(_=l.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:f}),e[15]=f,e[16]=_):_=e[16];let g;e[17]!==S||e[18]!==_?(g=l.jsxs("div",{className:"space-y-2",children:[S,_]}),e[17]=S,e[18]=_,e[19]=g):g=e[19];let N;e[20]!==y||e[21]!==g?(N=l.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[y,g]}),e[20]=y,e[21]=g,e[22]=N):N=e[22];let I;e[23]!==r?(I=r&&l.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Local models + use your existing AI provider"}),e[23]=r,e[24]=I):I=e[24];let p;e[25]===Symbol.for("react.memo_cache_sentinel")?(p=l.jsx(O.Suspense,{fallback:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 w-full",children:[l.jsx(W,{className:"h-32 w-full rounded-lg"}),l.jsx(W,{className:"h-32 w-full rounded-lg"})]}),children:l.jsx(at,{})}),e[25]=p):p=e[25];let C;e[26]!==I?(C=l.jsxs("div",{className:"w-full space-y-3",children:[I,p]}),e[26]=I,e[27]=C):C=e[27];let E;return e[28]!==C||e[29]!==N?(E=l.jsxs("div",{className:"flex flex-col items-center gap-8 w-full max-w-2xl px-4",children:[N,C]}),e[28]=C,e[29]=N,e[30]=E):E=e[30],E}function we(t){const e=t.title.includes(": ");return{provider:e?t.title.split(": ")[0]??"":t.modelId.split("/")[0]??"",displayName:e?t.title.split(": ").slice(1).join(": "):t.title}}const ct=["smarter","faster","cheaper"],dt={smarter:"Smarter",faster:"Faster",cheaper:"Cheaper"},Hs=[{tier:"smarter",prefixes:["claude-code:opus","anthropic/claude-opus-4.7","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","openai/gpt-5.3-codex","codex:gpt-5.4","codex:gpt-5.4-mini","codex:gpt-5.3-codex","codex:gpt-5.2-codex","codex:gpt-5.1-codex-max","google/gemini-3-pro","google/gemini-2.5-pro","cohere/command-r-plus","cohere/command-a"]},{tier:"faster",prefixes:["claude-code:sonnet","anthropic/claude-haiku-4.5","anthropic/claude-4.5-haiku","google/gemini-3-flash","openai/gpt-5.1-codex-mini","codex:gpt-5.1-codex-mini","x-ai/grok-code-fast","x-ai/grok-3","mistralai/mistral-large","mistralai/codestral","mistralai/mistral-medium","minimax/minimax-m1"]},{tier:"cheaper",prefixes:["claude-code:haiku","google/gemini-2.5-flash-lite","google/gemini-2.5-flash","google/gemini-2.0-flash","deepseek/deepseek-v3","openai/gpt-oss-120b","mistralai/mistral-small","mistralai/pixtral","cohere/command-r"]}],Qs=Hs.flatMap(({tier:t,prefixes:e})=>e.map(s=>({tier:t,prefix:s}))).sort((t,e)=>e.prefix.length-t.prefix.length),Gs=new Set(["google/gemini-2.5-pro"]),ze=new Map;function Ys(t){const e=ze.get(t);if(e!==void 0)return e;let s=null;if(t.endsWith(":free"))s="cheaper";else e:for(const{tier:n,prefix:i}of Qs)if(t.startsWith(i)){if(Gs.has(i)&&t.length>i.length&&t[i.length]==="-"){const r=t[i.length+1];if(!r||!/\d/.test(r))continue e}s=n;break}return ze.set(t,s),s}function Fe(t){const e={smarter:[],faster:[],cheaper:[],other:[]};for(const s of t){const n=Ys(s.modelId);e[n??"other"].push(s)}for(const s of Object.keys(e))e[s].sort((n,i)=>n.title.localeCompare(i.title));return e}const mt="mesh:model-shortlist:",Xs=new Set(["anthropic/claude-opus-4.7","anthropic/claude-sonnet-4.6","anthropic/claude-4.6-sonnet","anthropic/claude-sonnet-4.6:extended","openai/gpt-5.3-codex","google/gemini-3-pro-preview","google/gemini-2.5-pro","anthropic/claude-haiku-4.5","anthropic/claude-haiku-4.5-20251001","anthropic/claude-4.5-haiku","google/gemini-3-flash-preview","openai/gpt-5.1-codex-mini","x-ai/grok-code-fast-1","google/gemini-2.5-flash","deepseek/deepseek-v3.2","google/gemini-2.5-flash-lite","openai/gpt-oss-120b:free"]);function Js(t){try{const e=localStorage.getItem(mt+t);return e?new Set(JSON.parse(e)):null}catch{return null}}function Zs(t,e){localStorage.setItem(mt+t,JSON.stringify([...e]))}function el(t){return t<32e3?{level:1,label:"Small",description:"Short conversations"}:t<2e5?{level:2,label:"Medium",description:"Good for most tasks"}:t<5e5?{level:3,label:"Large",description:"Long projects & research"}:{level:4,label:"Very large",description:"Massive files & data"}}const tl=["bg-destructive","bg-warning","bg-success","bg-success"],sl=["text-success","text-warning","text-warning","text-destructive"];function ll(t){const e=Math.round(t*.75/1e3);return e>=1?`~${e}K words`:`~${Math.round(t*.75)} words`}function il(t){return t<1?{level:1,label:"Cheap"}:t<5?{level:2,label:"Moderate"}:t<15?{level:3,label:"High"}:{level:4,label:"Expensive"}}const nl={text:{icon:l.jsx(Ft,{className:"size-3.5"}),label:"Text"},vision:{icon:l.jsx(zt,{className:"size-3.5"}),label:"Vision"},image:{icon:l.jsx(Dt,{className:"size-3.5"}),label:"Image"},tools:{icon:l.jsx(Pt,{className:"size-3.5"}),label:"Tools"},reasoning:{icon:l.jsx(Rt,{className:"size-3.5"}),label:"Reasoning"},"web-search":{icon:l.jsx(Ge,{className:"size-3.5"}),label:"Web search"}};function ol(t){const e=$.c(5),{capability:s}=t;let n;e[0]!==s?(n=nl[s]??{icon:null,label:s.charAt(0).toUpperCase()+s.slice(1)},e[0]=s,e[1]=n):n=e[1];const i=n;let o;return e[2]!==i.icon||e[3]!==i.label?(o=l.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground border border-border rounded px-2 py-0.5",children:[i.icon,i.label]}),e[2]=i.icon,e[3]=i.label,e[4]=o):o=e[4],o}function rl(t){const e=$.c(49),{model:s,compact:n}=t,i=n===void 0?!1:n;if(!s){let g;return e[0]===Symbol.for("react.memo_cache_sentinel")?(g=l.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),e[0]=g):g=e[0],g}const o=s.costs?.input!=null?s.costs.input*1e6:null,r=s.costs?.output!=null?s.costs.output*1e6:null;let a;e[1]!==s?(a=we(s),e[1]=s,e[2]=a):a=e[2];const{provider:d,displayName:m}=a;if(i){let g;e[3]!==s.limits?(g=s.limits?.contextWindow&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Context"}),l.jsxs("span",{className:"text-foreground font-medium",children:[s.limits.contextWindow.toLocaleString()," tokens"]})]}),e[3]=s.limits,e[4]=g):g=e[4];let N;e[5]!==o?(N=o!=null&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Input"}),l.jsxs("span",{className:"text-foreground font-medium",children:["$",o.toFixed(2)," / 1M"]})]}),e[5]=o,e[6]=N):N=e[6];let I;e[7]!==r?(I=r!=null&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Output"}),l.jsxs("span",{className:"text-foreground font-medium",children:["$",r.toFixed(2)," / 1M"]})]}),e[7]=r,e[8]=I):I=e[8];let p;e[9]!==s.limits?(p=s.limits?.maxOutputTokens&&l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),l.jsxs("span",{className:"text-foreground font-medium",children:[s.limits.maxOutputTokens.toLocaleString()," tokens"]})]}),e[9]=s.limits,e[10]=p):p=e[10];let C;return e[11]!==g||e[12]!==N||e[13]!==I||e[14]!==p?(C=l.jsxs("div",{className:"flex flex-col gap-2 pt-3 pb-3 px-3 text-xs",children:[g,N,I,p]}),e[11]=g,e[12]=N,e[13]=I,e[14]=p,e[15]=C):C=e[15],C}let c;e[16]!==d?(c=l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:d}),e[16]=d,e[17]=c):c=e[17];let u;e[18]!==s.logo||e[19]!==s.title?(u=s.logo&&l.jsx("img",{src:s.logo,className:"size-6 shrink-0 rounded-md dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[18]=s.logo,e[19]=s.title,e[20]=u):u=e[20];let h;e[21]!==m?(h=l.jsx("p",{className:"text-lg font-semibold leading-snug tracking-tight",children:m}),e[21]=m,e[22]=h):h=e[22];let f;e[23]!==u||e[24]!==h?(f=l.jsxs("div",{className:"flex items-center gap-2.5",children:[u,h]}),e[23]=u,e[24]=h,e[25]=f):f=e[25];let v;e[26]!==s.modelId?(v=l.jsx("p",{className:"text-xs text-muted-foreground/50 font-mono",children:s.modelId}),e[26]=s.modelId,e[27]=v):v=e[27];let b;e[28]!==c||e[29]!==f||e[30]!==v?(b=l.jsxs("div",{className:"flex flex-col gap-1 pt-1 pr-6",children:[c,f,v]}),e[28]=c,e[29]=f,e[30]=v,e[31]=b):b=e[31];let w;e[32]!==s.capabilities?(w=s.capabilities&&s.capabilities.length>0&&l.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pb-4 border-b border-border",children:[...new Set(s.capabilities)].map(al)}),e[32]=s.capabilities,e[33]=w):w=e[33];let j;e[34]!==s.limits?(j=s.limits?.contextWindow&&(()=>{const{level:g,label:N,description:I}=el(s.limits.contextWindow);return l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Context window"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"flex items-center gap-0.5",children:[1,2,3,4].map(p=>l.jsx("div",{className:ie("w-2 h-2 rounded-full",p<=g?tl[g-1]:"bg-muted")},p))}),l.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:N}),l.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",I]})]}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.limits.contextWindow.toLocaleString()," tokens"]})]})})(),e[34]=s.limits,e[35]=j):j=e[35];let x;e[36]!==s.limits?(x=s.limits?.maxOutputTokens&&l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Output limit"}),l.jsxs("div",{className:"flex items-baseline gap-2",children:[l.jsxs("span",{className:"text-sm text-foreground",children:[s.limits.maxOutputTokens.toLocaleString()," tokens"]}),l.jsx("span",{className:"text-sm text-muted-foreground",children:ll(s.limits.maxOutputTokens)})]})]}),e[36]=s.limits,e[37]=x):x=e[37];let y;e[38]!==o||e[39]!==r?(y=(o!=null||r!=null)&&(()=>{const{level:g,label:N}=o!=null?il(o):{level:0,label:""};return l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Pricing"}),o!=null&&l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"flex items-center",children:[1,2,3,4].map(I=>l.jsx("span",{className:ie("text-sm font-bold leading-none",I<=g?sl[g-1]:"text-muted-foreground/20"),children:"$"},I))}),l.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:N})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[o!=null&&l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-xs text-muted-foreground",children:"Input"}),l.jsxs("span",{className:"text-xs text-foreground",children:["$",o.toFixed(2)," / 1M tokens"]})]}),r!=null&&l.jsxs("div",{className:"flex justify-between items-center",children:[l.jsx("span",{className:"text-xs text-muted-foreground",children:"Output"}),l.jsxs("span",{className:"text-xs text-foreground",children:["$",r.toFixed(2)," / 1M tokens"]})]})]})]})})(),e[38]=o,e[39]=r,e[40]=y):y=e[40];let S;e[41]!==j||e[42]!==x||e[43]!==y?(S=l.jsxs("div",{className:"flex flex-col gap-6",children:[j,x,y]}),e[41]=j,e[42]=x,e[43]=y,e[44]=S):S=e[44];let _;return e[45]!==S||e[46]!==b||e[47]!==w?(_=l.jsxs("div",{className:"flex flex-col gap-5 py-1 px-1.5",children:[b,w,S]}),e[45]=S,e[46]=b,e[47]=w,e[48]=_):_=e[48],_}function al(t){return l.jsx(ol,{capability:t},t)}function cl(t){const e=$.c(21),{model:s,onHover:n}=t;let i;e[0]!==s?(i=we(s),e[0]=s,e[1]=i):i=e[1];const{displayName:o,provider:r}=i;let a;e[2]!==s?(a=Ne(s),e[2]=s,e[3]=a):a=e[3];const d=a;let m;e[4]!==s||e[5]!==n?(m=()=>n(s),e[4]=s,e[5]=n,e[6]=m):m=e[6];let c;e[7]!==s.title||e[8]!==d?(c=l.jsx("img",{src:d,className:"w-4 h-4 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[7]=s.title,e[8]=d,e[9]=c):c=e[9];let u;e[10]!==o?(u=l.jsx("span",{className:"text-sm text-foreground leading-tight truncate",children:o}),e[10]=o,e[11]=u):u=e[11];let h;e[12]!==r?(h=l.jsx("span",{className:"text-xs text-muted-foreground/60 leading-tight",children:r}),e[12]=r,e[13]=h):h=e[13];let f;e[14]!==u||e[15]!==h?(f=l.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[u,h]}),e[14]=u,e[15]=h,e[16]=f):f=e[16];let v;return e[17]!==m||e[18]!==c||e[19]!==f?(v=l.jsxs("div",{className:"flex items-center gap-2.5 py-2 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:m,children:[c,f]}),e[17]=m,e[18]=c,e[19]=f,e[20]=v):v=e[20],v}function dl(t){const e=$.c(10),{error:s,onRetry:n}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsx("div",{className:"bg-destructive/10 p-2 rounded-full",children:l.jsx(bt,{className:"size-5 text-destructive"})}),e[0]=i):i=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=l.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load models"}),e[1]=o):o=e[1];const r=s?.message||"Could not fetch models from this provider.";let a;e[2]!==r?(a=l.jsxs("div",{className:"flex flex-col gap-1",children:[o,l.jsxs("p",{className:"text-xs text-muted-foreground max-w-[260px]",children:[r," Try another provider or retry."]})]}),e[2]=r,e[3]=a):a=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=l.jsx(Lt,{className:"size-3.5"}),e[4]=d):d=e[4];let m;e[5]!==n?(m=l.jsx("div",{className:"flex items-center gap-2",children:l.jsxs(te,{variant:"outline",size:"sm",onClick:n,className:"gap-1.5",children:[d,"Retry"]})}),e[5]=n,e[6]=m):m=e[6];let c;return e[7]!==a||e[8]!==m?(c=l.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-4 py-8 text-center",children:[i,a,m]}),e[7]=a,e[8]=m,e[9]=c):c=e[9],c}function ml(){const t=$.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:6}).map(ul)}),t[0]=e):e=t[0],e}function ul(t,e){return l.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[l.jsx(W,{className:"size-5 shrink-0 rounded-sm"}),l.jsx(W,{className:"flex-1 h-4"}),l.jsx(W,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function De(t){const e=$.c(12),{label:s,models:n,onSelect:i,onHover:o}=t;if(n.length===0)return null;let r;e[0]!==s?(r=l.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:s}),e[0]=s,e[1]=r):r=e[1];let a;if(e[2]!==n||e[3]!==o||e[4]!==i){let m;e[6]!==o||e[7]!==i?(m=c=>l.jsx("div",{onClick:()=>i(c),className:"cursor-pointer",children:l.jsx(cl,{model:c,onHover:o})},c.modelId),e[6]=o,e[7]=i,e[8]=m):m=e[8],a=n.map(m),e[2]=n,e[3]=o,e[4]=i,e[5]=a}else a=e[5];let d;return e[9]!==r||e[10]!==a?(d=l.jsxs("div",{children:[r,a]}),e[9]=r,e[10]=a,e[11]=d):d=e[11],d}function hl(t){const e=$.c(21),{model:s,isChecked:n,onToggle:i,onHover:o}=t,[r,a]=O.useState(n);r!==n&&a(n);let d;e[0]!==s?(d=Ne(s),e[0]=s,e[1]=d):d=e[1];const m=d;let c;e[2]!==s||e[3]!==o?(c=()=>o(s),e[2]=s,e[3]=o,e[4]=c):c=e[4];let u;e[5]!==s.modelId||e[6]!==i?(u=()=>{a(fl),i(s.modelId)},e[5]=s.modelId,e[6]=i,e[7]=u):u=e[7];let h;e[8]!==r||e[9]!==u?(h=l.jsx(vt,{checked:r,onCheckedChange:u}),e[8]=r,e[9]=u,e[10]=h):h=e[10];let f;e[11]!==m||e[12]!==s.title?(f=l.jsx("img",{src:m,className:"w-5 h-5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[11]=m,e[12]=s.title,e[13]=f):f=e[13];let v;e[14]!==s.title?(v=l.jsx("span",{className:"text-sm text-foreground flex-1 min-w-0 line-clamp-1",children:s.title}),e[14]=s.title,e[15]=v):v=e[15];let b;return e[16]!==c||e[17]!==h||e[18]!==f||e[19]!==v?(b=l.jsxs("label",{className:"flex items-center gap-3 min-h-8 py-2.5 px-3 hover:bg-accent cursor-pointer rounded-lg",onMouseEnter:c,children:[h,f,v]}),e[16]=c,e[17]=h,e[18]=f,e[19]=v,e[20]=b):b=e[20],b}function fl(t){return!t}function xl(t){const e=[];for(const s of ct)if(t[s].length>0){e.push({type:"header",label:dt[s]});for(const n of t[s])e.push({type:"model",model:n})}if(t.other.length>0){e.push({type:"header",label:"Other"});for(const s of t.other)e.push({type:"model",model:s})}return e}function pl({items:t,shortlistSet:e,onToggle:s,onHover:n}){const i=O.useRef(null),o=hs({count:t.length,getScrollElement:()=>i.current,estimateSize:r=>t[r]?.type==="header"?36:44,overscan:6});return l.jsx("div",{ref:i,className:"flex-1 overflow-y-auto",children:l.jsx("div",{className:"relative",style:{height:o.getTotalSize()},children:o.getVirtualItems().map(r=>{const a=t[r.index];return a?l.jsx("div",{"data-index":r.index,ref:o.measureElement,className:"absolute left-0 right-0 top-0 px-0.5",style:{transform:`translateY(${r.start}px)`},children:a.type==="header"?l.jsx("div",{className:"text-xs font-medium text-muted-foreground px-3 pt-3 pb-1",children:a.label}):l.jsx(hl,{model:a.model,isChecked:e.has(a.model.modelId),onToggle:s,onHover:n})},r.key):null})})})}function gl(t){const e=$.c(23),{keyId:s,searchTerm:n,onHover:i,onModelSelect:o,managing:r,onToggleManage:a,filterModels:d}=t,{models:m}=ue(s),c=d?m.filter(d):m;let u;e[0]!==s?(u=()=>(s?Js(s):null)??Xs,e[0]=s,e[1]=u):u=e[1];const[h,f]=O.useState(u),[,v]=O.useTransition();let b;e[2]!==s||e[3]!==v?(b=C=>{s&&v(()=>{f(E=>{const k=new Set(E);return k.has(C)?k.delete(C):k.add(C),Zs(s,k),k})})},e[2]=s,e[3]=v,e[4]=b):b=e[4];const w=b,j=n.toLowerCase().trim(),x=C=>j?C.filter(E=>E.title.toLowerCase().includes(j)||E.modelId.toLowerCase().includes(j)):C;if(r){const C=Fe(x(c)),E=xl(C);let k;e[5]!==h?(k=F=>h.has(F.modelId),e[5]=h,e[6]=k):k=e[6];const A=c.filter(k).length;let M;e[7]===Symbol.for("react.memo_cache_sentinel")?(M=l.jsx(Kt,{size:14}),e[7]=M):M=e[7];let T;return e[8]!==a?(T=l.jsxs("button",{type:"button",onClick:a,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground cursor-pointer",children:[M,"Back"]}),e[8]=a,e[9]=T):T=e[9],l.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[T,l.jsxs("span",{className:"text-xs text-muted-foreground",children:[A," selected"]})]}),l.jsx(pl,{items:E,shortlistSet:h,onToggle:w,onHover:i})]})}let y;e[10]!==h?(y=C=>h.has(C.modelId),e[10]=h,e[11]=y):y=e[11];const S=c.filter(y),_=S.length>0?S:c,g=Fe(x(_));let N;e[12]!==g||e[13]!==i||e[14]!==o?(N=ct.map(C=>l.jsx(De,{label:dt[C],models:g[C],onSelect:o,onHover:i},C)),e[12]=g,e[13]=i,e[14]=o,e[15]=N):N=e[15];let I;e[16]!==g.other||e[17]!==i||e[18]!==o?(I=l.jsx(De,{label:"Other",models:g.other,onSelect:o,onHover:i}),e[16]=g.other,e[17]=i,e[18]=o,e[19]=I):I=e[19];let p;return e[20]!==N||e[21]!==I?(p=l.jsxs("div",{className:"flex-1 overflow-y-auto px-0.5 pt-1 [touch-action:pan-y]",children:[N,I]}),e[20]=N,e[21]=I,e[22]=p):p=e[22],p}function ut(t){const e=$.c(19),{model:s,placeholder:n,isLoading:i}=t,o=n===void 0?"Select model":n;if(i===void 0?!1:i){let b;return e[0]===Symbol.for("react.memo_cache_sentinel")?(b=l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(W,{className:"w-5 h-5 rounded-sm shrink-0"}),l.jsx(W,{className:"w-16 h-3 hidden md:block"})]}),e[0]=b):b=e[0],b}if(!s){let b;e[1]!==o?(b=l.jsx("span",{className:"text-sm text-muted-foreground",children:o}),e[1]=o,e[2]=b):b=e[2];let w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w=l.jsx(Ce,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[3]=w):w=e[3];let j;return e[4]!==b?(j=l.jsxs("div",{className:"flex items-center gap-1.5",children:[b,w]}),e[4]=b,e[5]=j):j=e[5],j}let a;e[6]!==s?(a=we(s),e[6]=s,e[7]=a):a=e[7];const{displayName:d}=a;let m;e[8]!==s?(m=Ne(s),e[8]=s,e[9]=m):m=e[9];const c=m;let u;e[10]!==s.title||e[11]!==c?(u=l.jsx("img",{src:c,className:"w-3.5 h-3.5 shrink-0 rounded-sm dark:bg-white dark:rounded-sm dark:p-px",alt:s.title}),e[10]=s.title,e[11]=c,e[12]=u):u=e[12];let h;e[13]!==d?(h=l.jsx("span",{className:"text-sm truncate whitespace-nowrap text-muted-foreground max-w-[100px] sm:max-w-none",children:d}),e[13]=d,e[14]=h):h=e[14];let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=l.jsx(Ce,{size:14,className:"text-muted-foreground opacity-50 shrink-0"}),e[15]=f):f=e[15];let v;return e[16]!==u||e[17]!==h?(v=l.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:[u,h,f]}),e[16]=u,e[17]=h,e[18]=v):v=e[18],v}const bl=["vision","image","file","audio","video"],ht=["image/png","image/jpeg","image/gif","image/webp"];function ni(t){const e=t?.capabilities;return e?bl.some(s=>e.includes(s)):!1}function oi(t,e){if(!t)return!1;if(t.startsWith("text/"))return!0;const s=e?.capabilities??[],n=s.includes("vision")||s.includes("image"),i=s.includes("file"),o=s.includes("audio"),r=s.includes("video");return!!(n&&ht.includes(t)||i&&t==="application/pdf"||o&&t.startsWith("audio/")||r&&t.startsWith("video/"))}function ri(t){const e=t?.capabilities??[],s=["text/*"];return(e.includes("vision")||e.includes("image"))&&s.push(...ht),e.includes("file")&&s.push("application/pdf"),e.includes("audio")&&s.push("audio/*"),e.includes("video")&&s.push("video/*"),s.join(",")}function ai(t){const e=t?.capabilities??[],s=[];return(e.includes("vision")||e.includes("image"))&&s.push("images"),e.includes("file")&&s.push("PDFs"),e.includes("audio")&&s.push("audio"),e.includes("video")&&s.push("video"),s.length===0?"text only":s.length===1?s[0]:s.length===2?`${s[0]} and ${s[1]}`:`${s.slice(0,-1).join(", ")}, and ${s.at(-1)}`}function vl(){const t=$.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l.jsx("div",{className:"border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",children:l.jsxs("div",{className:"flex items-center gap-2.5 h-12 px-4",children:[l.jsx(W,{className:"size-4 shrink-0"}),l.jsx(W,{className:"flex-1 h-6"}),l.jsx(W,{className:"w-[140px] h-8 shrink-0"})]})}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=l.jsxs("div",{className:"flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",children:[e,l.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:Array.from({length:8}).map(jl)})]}),t[1]=s):s=t[1];let n;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=l.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[l.jsx(W,{className:"size-6 shrink-0"}),l.jsx(W,{className:"h-6 w-32"})]}),t[2]=n):n=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=l.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[n,l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(W,{className:"h-6 w-20 rounded-md"}),l.jsx(W,{className:"h-6 w-24 rounded-md"})]})]}),t[3]=i):i=t[3];let o;t[4]===Symbol.for("react.memo_cache_sentinel")?(o=l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsx(W,{className:"h-4 w-24"}),l.jsx(W,{className:"h-4 w-32"})]}),t[4]=o):o=t[4];let r;return t[5]===Symbol.for("react.memo_cache_sentinel")?(r=l.jsxs("div",{className:"flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",children:[s,l.jsx("div",{className:"hidden md:block md:w-[320px] md:shrink-0 p-3",children:l.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[i,l.jsxs("div",{className:"flex flex-col gap-4",children:[o,l.jsxs("div",{className:"flex flex-col gap-1.5",children:[l.jsx(W,{className:"h-4 w-16"}),l.jsx(W,{className:"h-4 w-40"})]})]})]})})]}),t[5]=r):r=t[5],r}function jl(t,e){return l.jsxs("div",{className:"flex items-center gap-2 min-h-8 py-3 px-3 rounded-lg",children:[l.jsx(W,{className:"size-5 shrink-0 rounded-sm"}),l.jsx(W,{className:"flex-1 h-4"}),l.jsx(W,{className:"w-16 h-5 shrink-0 rounded-md"})]},e)}function ft(t){const e=$.c(43),{onClose:s,credentialId:n,onCredentialChange:i,selectedModel:o,onModelChange:r,filterModels:a}=t,[d,m]=O.useState(null),[c,u]=O.useState(""),[h,f]=O.useState(!1),v=O.useRef(null),b=Ye(),w=ae(),j=Object.fromEntries((b?.providers??[]).map(Nl)),x=gt(),{org:y}=ne();let S;e[0]!==i?(S=z=>{i(z),m(null)},e[0]=i,e[1]=S):S=e[1];const _=S;let g;e[2]!==n||e[3]!==s||e[4]!==r?(g=z=>{n&&(r(z),u(""),s())},e[2]=n,e[3]=s,e[4]=r,e[5]=g):g=e[5];const N=g;if(w.length===0){let z;return e[6]===Symbol.for("react.memo_cache_sentinel")?(z=l.jsx("div",{className:"flex items-center justify-center p-8 w-full sm:w-[740px]",children:l.jsx(qs,{})}),e[6]=z):z=e[6],z}const I="flex flex-col md:flex-row h-full sm:h-[460px] min-h-0",p="flex-1 flex flex-col md:border-r md:w-[420px] md:min-w-[420px] min-h-0 overflow-hidden",C="border-b border-border h-12 bg-background/95 backdrop-blur sticky top-0 z-10",E="flex items-center gap-2.5 h-12 px-4 pr-12 md:pr-4 cursor-text";let k;e[7]===Symbol.for("react.memo_cache_sentinel")?(k=l.jsx(Ge,{size:16,className:"text-muted-foreground shrink-0"}),e[7]=k):k=e[7];const A=h?"Search all models...":"Search for a model...";let M;e[8]===Symbol.for("react.memo_cache_sentinel")?(M=z=>u(z.target.value),e[8]=M):M=e[8];let T;e[9]!==c||e[10]!==A?(T=l.jsx(oe,{ref:v,type:"text",placeholder:A,value:c,onChange:M,className:"flex-1 min-w-0 border-0 !shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[9]=c,e[10]=A,e[11]=T):T=e[11];const F=w.length>0&&l.jsxs(kt,{value:n??"",onValueChange:_,children:[l.jsxs(Et,{size:"sm",className:"w-auto max-w-[140px] h-8 shrink-0 gap-1.5 px-2 [&>svg:last-child]:hidden",onClick:Sl,children:[l.jsx(Mt,{placeholder:"Key",children:(()=>{const z=w.find(xe=>xe.id===n),J=z?j[z.providerId]:void 0;return l.jsxs("span",{className:"flex items-center gap-1.5 min-w-0",children:[J?.logo?l.jsx("img",{src:J.logo,alt:J.name,className:"w-4 h-4 rounded shrink-0 dark:bg-white dark:rounded-sm dark:p-px"}):l.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:(J?.name??z?.providerId??"?").slice(0,1).toUpperCase()}),l.jsx("span",{className:"text-xs truncate",children:J?.name??z?.providerId??"Key"})]})})()}),l.jsx(Tt,{className:"size-4 opacity-50 shrink-0 pointer-events-none"})]}),l.jsx(At,{children:w.map(z=>{const J=j[z.providerId];return l.jsx(Ot,{value:z.id,children:l.jsxs("div",{className:"flex items-center gap-2",children:[J?.logo?l.jsx("img",{src:J.logo,alt:J.name,className:"w-4 h-4 rounded dark:bg-white dark:rounded-sm dark:p-px"}):l.jsx("div",{className:"w-4 h-4 rounded bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",children:(J?.name??z.providerId).slice(0,1).toUpperCase()}),l.jsxs("span",{children:[J?.name??z.providerId," — ",z.label]})]})},z.id)})})]});let R;e[12]!==T||e[13]!==F||e[14]!==k?(R=l.jsx("div",{className:C,children:l.jsxs("label",{className:E,children:[k,T,F]})}),e[12]=T,e[13]=F,e[14]=k,e[15]=R):R=e[15];let D;e[16]!==n?(D=z=>{const{error:J,resetError:xe}=z;return l.jsx(dl,{error:J,onRetry:xe,credentialId:n??void 0})},e[16]=n,e[17]=D):D=e[17];let B;e[18]===Symbol.for("react.memo_cache_sentinel")?(B=l.jsx(ml,{}),e[18]=B):B=e[18];const Q=n??void 0;let U;e[19]===Symbol.for("react.memo_cache_sentinel")?(U=()=>f(yl),e[19]=U):U=e[19];let L;e[20]!==a||e[21]!==N||e[22]!==h||e[23]!==c||e[24]!==Q?(L=l.jsx(O.Suspense,{fallback:B,children:l.jsx(gl,{keyId:Q,searchTerm:c,onHover:m,onModelSelect:N,managing:h,onToggleManage:U,filterModels:a})}),e[20]=a,e[21]=N,e[22]=h,e[23]=c,e[24]=Q,e[25]=L):L=e[25];let V;e[26]!==n||e[27]!==D||e[28]!==L?(V=l.jsx(Le,{fallback:D,children:L},n),e[26]=n,e[27]=D,e[28]=L,e[29]=V):V=e[29];let K;e[30]!==h||e[31]!==x||e[32]!==y?(K=!h&&l.jsxs("div",{className:"border-t border-border flex",children:[l.jsxs("button",{type:"button",onClick:()=>O.startTransition(()=>f(!0)),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[l.jsx($t,{className:"size-3.5 shrink-0"}),"Manage models"]}),l.jsx("div",{className:"w-px bg-border shrink-0"}),l.jsxs("button",{type:"button",onClick:()=>x({to:"/$org/settings/ai-providers",params:{org:y.slug}}),className:"flex items-center gap-2 flex-1 px-4 py-2.5 text-xs text-muted-foreground hover:text-foreground hover:bg-accent cursor-pointer",children:[l.jsx(Qe,{className:"size-3.5 shrink-0"}),"Manage API keys"]})]}),e[30]=h,e[31]=x,e[32]=y,e[33]=K):K=e[33];let H;e[34]!==R||e[35]!==V||e[36]!==K?(H=l.jsxs("div",{className:p,children:[R,V,K]}),e[34]=R,e[35]=V,e[36]=K,e[37]=H):H=e[37];const G=d??o??null;let q;e[38]!==G?(q=l.jsx("div",{className:"hidden md:flex md:flex-col md:w-[320px] md:shrink-0 p-3",children:l.jsx(rl,{model:G})}),e[38]=G,e[39]=q):q=e[39];let ee;return e[40]!==H||e[41]!==q?(ee=l.jsxs("div",{className:I,children:[H,q]}),e[40]=H,e[41]=q,e[42]=ee):ee=e[42],ee}function yl(t){return!t}function Sl(t){return t.stopPropagation()}function Nl(t){return[t.id,t]}function wl(t){const e=$.c(12),{onClose:s}=t,{credentialId:n,setCredentialId:i,selectedModel:o,setModel:r}=Xe();let a;e[0]!==i?(a=c=>{Z("chat_credential_changed",{credential_id:c}),i(c)},e[0]=i,e[1]=a):a=e[1];let d;e[2]!==n||e[3]!==o?.modelId||e[4]!==r?(d=c=>{n&&(Z("chat_model_changed",{from_model_id:o?.modelId??null,to_model_id:c.modelId,to_model_provider:c.providerId??null,credential_id:n}),r({...c,keyId:n}))},e[2]=n,e[3]=o?.modelId,e[4]=r,e[5]=d):d=e[5];let m;return e[6]!==n||e[7]!==s||e[8]!==o||e[9]!==a||e[10]!==d?(m=l.jsx(ft,{onClose:s,credentialId:n,onCredentialChange:a,selectedModel:o,onModelChange:d}),e[6]=n,e[7]=s,e[8]=o,e[9]=a,e[10]=d,e[11]=m):m=e[11],m}function _l(t){const e=$.c(38),{variant:s,className:n,placeholder:i,model:o,isLoading:r,credentialId:a,onCredentialChange:d,onModelChange:m,filterModels:c}=t,u=s===void 0?"borderless":s,h=i===void 0?"Select model":i,[f,v]=O.useState(!1),b=m!==void 0,w=It(),j=u==="borderless"?"ghost":"outline",x=u==="borderless"&&"md:border-none";let y;e[0]!==n||e[1]!==x?(y=ie("text-sm hover:bg-accent rounded-lg py-0.5 px-1 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0 min-w-0 shrink justify-start overflow-hidden",x,n),e[0]=n,e[1]=x,e[2]=y):y=e[2];let S;e[3]!==r||e[4]!==o||e[5]!==h||e[6]!==b?(S=b?l.jsx(ut,{model:o??null,placeholder:h,isLoading:r}):l.jsx(Il,{placeholder:h}),e[3]=r,e[4]=o,e[5]=h,e[6]=b,e[7]=S):S=e[7];let _;e[8]!==j||e[9]!==y||e[10]!==S?(_=l.jsx(te,{variant:j,size:"sm",className:y,children:S}),e[8]=j,e[9]=y,e[10]=S,e[11]=_):_=e[11];const g=_;let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=l.jsx(vl,{}),e[12]=N):N=e[12];let I;e[13]!==a||e[14]!==c||e[15]!==o||e[16]!==d||e[17]!==m||e[18]!==b?(I=l.jsx(O.Suspense,{fallback:N,children:b?l.jsx(ft,{onClose:()=>v(!1),credentialId:a??null,onCredentialChange:d??Cl,selectedModel:o??null,onModelChange:m,filterModels:c}):l.jsx(wl,{onClose:()=>v(!1)})}),e[13]=a,e[14]=c,e[15]=o,e[16]=d,e[17]=m,e[18]=b,e[19]=I):I=e[19];const p=I;if(w){let M;e[20]!==g?(M=l.jsx(Nt,{asChild:!0,children:g}),e[20]=g,e[21]=M):M=e[21];let T;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=l.jsx(wt,{className:"sr-only",children:"Select model"}),e[22]=T):T=e[22];let F;e[23]!==p?(F=l.jsxs(_t,{className:"p-0 flex flex-col max-h-[95vh]",children:[T,l.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:p})]}),e[23]=p,e[24]=F):F=e[24];let R;return e[25]!==f||e[26]!==M||e[27]!==F?(R=l.jsxs(Ct,{open:f,onOpenChange:v,children:[M,F]}),e[25]=f,e[26]=M,e[27]=F,e[28]=R):R=e[28],R}let C;e[29]!==g?(C=l.jsx(St,{asChild:!0,children:g}),e[29]=g,e[30]=C):C=e[30];let E;e[31]===Symbol.for("react.memo_cache_sentinel")?(E=l.jsx(Ve,{className:"sr-only",children:"Select model"}),e[31]=E):E=e[31];let k;e[32]!==p?(k=l.jsxs(Ue,{className:"p-0 gap-0 sm:max-w-fit overflow-hidden h-[100dvh] sm:h-auto max-h-[100dvh] sm:max-h-[85vh] w-full max-w-full sm:max-w-fit rounded-none sm:rounded-xl border-0 sm:border",closeButtonClassName:"top-3.5 right-3.5 z-20",children:[E,p]}),e[32]=p,e[33]=k):k=e[33];let A;return e[34]!==f||e[35]!==C||e[36]!==k?(A=l.jsxs(Be,{open:f,onOpenChange:v,children:[C,k]}),e[34]=f,e[35]=C,e[36]=k,e[37]=A):A=e[37],A}function Cl(){}function Il(t){const e=$.c(4),{placeholder:s}=t,{selectedModel:n,isModelsLoading:i}=Xe();let o;return e[0]!==i||e[1]!==n||e[2]!==s?(o=l.jsx(ut,{model:n,placeholder:s,isLoading:i}),e[0]=i,e[1]=n,e[2]=s,e[3]=o):o=e[3],o}export{_l as M,qs as N,ii as O,ai as a,ri as g,oi as i,ni as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as k,g as E,a4 as R,j as s,s as T,aG as H,c as $,ay as z,t as L,b as W,O as I,l as J,r as K}from"./index-D34n6J5J.js";import{k as Q,l as U,m as V,u as X,S as w,a as C,b as O,d as P,c as M,f as Y,g as Z,q as A,n as ee,o as se,p as te}from"./index-zDq2Zqio.js";import{i as q}from"./ArrowNarrowLeft-DlPeFc4v.js";import{n as le,d as ne,b as re,e as ie,f as oe,i as F,a as ae,c as ce}from"./ZapSquare-DT93lGV4.js";import{t as me,a as G}from"./Users03-DqYvPeZM.js";import{i as de}from"./ChevronRight-DV9No7GF.js";import{i as fe}from"./Lock01-DpPIS3K7.js";import{i as xe}from"./Shield01-BZJVBd5S.js";import{s as be}from"./User01-C2-anwoO.js";import{i as B}from"./Zap-KmbRMccM.js";import{u as he}from"./use-mobile-CxvYCzu9.js";import{u as ue}from"./use-status-sounds-Ce7WandB.js";import"./X-i9zBn6Hn.js";import"./question-004-sINsf4GQ.js";import"./use-decopilot-events-Dpt6CcIN.js";import"./create-sse-subscription-CxkOgzKf.js";function D(){const e=k.c(29),t=T().project;let n;e[0]!==t.enabledPlugins?(n=t.enabledPlugins??[],e[0]=t.enabledPlugins,e[1]=n):n=e[1];const l=n;let r,i,c,m,o;if(e[2]!==l){const b=H.filter(N=>l.includes(N.pluginId)).map(pe);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={key:"general",label:"General",icon:s.jsx(me,{size:14}),to:"/$org/settings/general"},e[8]=x):x=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g={key:"brand-context",label:"Brand Context",icon:s.jsx(le,{size:14}),to:"/$org/settings/brand-context"},e[9]=g):g=e[9],e[10]===Symbol.for("react.memo_cache_sentinel")?(c={label:"Organization",items:[x,g,{key:"ai-providers",label:"AI Providers",icon:s.jsx(ne,{size:14}),to:"/$org/settings/ai-providers"}]},e[10]=c):c=e[10];let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y={key:"connections",label:"Connections",icon:s.jsx(re,{size:14}),to:"/$org/settings/connections"},e[11]=y):y=e[11];let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j={key:"agents",label:"Agents",icon:s.jsx(G,{size:14}),to:"/$org/settings/agents"},e[12]=j):j=e[12];let _;e[13]===Symbol.for("react.memo_cache_sentinel")?(_={key:"automations",label:"Automations",icon:s.jsx(B,{size:14}),to:"/$org/settings/automations"},e[13]=_):_=e[13],e[14]===Symbol.for("react.memo_cache_sentinel")?(m={label:"Build",items:[y,j,_,{key:"store",label:"Store",icon:s.jsx(ie,{size:14}),to:"/$org/settings/store"}]},e[14]=m):m=e[14];let p;e[15]===Symbol.for("react.memo_cache_sentinel")?(p={key:"monitor",label:"Monitor",icon:s.jsx(oe,{size:14}),to:"/$org/settings/monitor"},e[15]=p):p=e[15];let S;e[16]===Symbol.for("react.memo_cache_sentinel")?(S={key:"members",label:"Members",icon:s.jsx(G,{size:14}),to:"/$org/settings/members"},e[16]=S):S=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u={key:"roles",label:"Roles",icon:s.jsx(xe,{size:14}),to:"/$org/settings/roles"},e[17]=u):u=e[17],e[18]===Symbol.for("react.memo_cache_sentinel")?(o={label:"Manage",items:[p,S,u,{key:"sso",label:"SSO",icon:s.jsx(fe,{size:14}),to:"/$org/settings/sso"}]},e[18]=o):o=e[18],r="Extensions";let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v={key:"features",label:"Plugins",icon:s.jsx(B,{size:14}),to:"/$org/settings/features"},e[19]=v):v=e[19],i=[v,...b],e[2]=l,e[3]=r,e[4]=i,e[5]=c,e[6]=m,e[7]=o}else r=e[3],i=e[4],c=e[5],m=e[6],o=e[7];let a;e[20]!==r||e[21]!==i?(a={label:r,items:i},e[20]=r,e[21]=i,e[22]=a):a=e[22];let d;e[23]===Symbol.for("react.memo_cache_sentinel")?(d={label:"Account",items:[{key:"profile",label:"Profile & Preferences",icon:s.jsx(be,{size:14}),to:"/$org/settings/profile"}]},e[23]=d):d=e[23];let f;return e[24]!==c||e[25]!==m||e[26]!==o||e[27]!==a?(f=[c,m,o,a,d],e[24]=c,e[25]=m,e[26]=o,e[27]=a,e[28]=f):f=e[28],f}function pe(e){const{key:t,label:n,icon:l,to:r}=e;return{key:t,label:n,icon:l,to:r}}function ge(){const e=k.c(26),t=D();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org"},e[0]=n):n=e[0];const{org:l}=E(n);let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={select:_e},e[1]=r):r=e[1];const i=R(r);let c;e[2]!==l||e[3]!==i?(c=_=>{const p=_.replace("$org",l);return i.startsWith(p)},e[2]=l,e[3]=i,e[4]=c):c=e[4];const m=c;let o;e[5]!==l?(o={org:l},e[5]=l,e[6]=o):o=e[6];let a,d;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(q,{size:14}),d=s.jsx("span",{children:"Settings"}),e[7]=a,e[8]=d):(a=e[7],d=e[8]);let f;e[9]!==o?(f=s.jsx(w,{className:"pt-0 pr-0 pb-3 md:pb-3 pl-0",children:s.jsx(C,{children:s.jsx(O,{className:"gap-1.5",children:s.jsx(P,{children:s.jsx(M,{asChild:!0,children:s.jsxs(z,{to:"/$org",params:o,className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a,d]})})})})})}),e[9]=o,e[10]=f):f=e[10];let h;if(e[11]!==t||e[12]!==m||e[13]!==l){let _;e[15]!==m||e[16]!==l?(_=(p,S)=>s.jsxs(w,{className:"pt-0 pr-0 pb-0 pl-0",children:[p.label&&s.jsx("p",{className:$("px-2 pt-1.5 pb-0.5 text-xs font-medium text-muted-foreground/60",S>0&&"mt-3"),children:p.label}),s.jsx(C,{children:s.jsx(O,{className:"gap-0.5",children:p.items.map(u=>s.jsx(P,{children:s.jsx(M,{asChild:!0,isActive:m(u.to),children:s.jsxs(z,{to:u.to,params:{org:l},onClick:()=>L("settings_nav_clicked",{section_key:u.key,section_label:u.label,group_label:p.label||"main"}),className:"flex items-center gap-2.5 text-sm",children:[s.jsx("span",{className:"shrink-0",children:u.icon}),s.jsx("span",{className:"truncate",children:u.label})]})})},u.key))})})]},`${p.label}-${S}`),e[15]=m,e[16]=l,e[17]=_):_=e[17],h=t.map(_),e[11]=t,e[12]=m,e[13]=l,e[14]=h}else h=e[14];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx("div",{className:"mx-2 my-2 border-t border-border/50"}),e[18]=b):b=e[18];let x;e[19]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsxs(w,{className:"pt-0 pr-0 pb-0 pl-0",children:[b,s.jsx(C,{children:s.jsx(O,{className:"gap-0.5",children:s.jsx(P,{children:s.jsxs(M,{onClick:je,className:"flex items-center gap-2.5 text-sm",children:[s.jsx("span",{className:"shrink-0",children:s.jsx(F,{size:14})}),s.jsx("span",{className:"truncate",children:"Sign Out"})]})})})})]}),e[19]=x):x=e[19];let g;e[20]!==f||e[21]!==h?(g=s.jsxs(Y,{className:"flex flex-col flex-1 mt-2 px-2 pb-2 gap-0",children:[f,h,x]}),e[20]=f,e[21]=h,e[22]=g):g=e[22];let y;e[23]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("div",{className:"mt-auto px-4 pb-1",children:s.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v","2.286.0"]})}),e[23]=y):y=e[23];let j;return e[24]!==g?(j=s.jsxs(Z,{variant:"sidebar",children:[g,y]}),e[24]=g,e[25]=j):j=e[25],j}function je(){L("signed_out",{source:"settings_sidebar"}),W.signOut()}function _e(e){return e.location.pathname}function ye(e){const t=k.c(29),{onClose:n}=e,l=D();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org"},t[0]=r):r=t[0];const{org:i}=E(r);let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c={select:ve},t[1]=c):c=t[1];const m=R(c);let o;t[2]!==i||t[3]!==m?(o=S=>{const u=S.replace("$org",i);return m.startsWith(u)},t[2]=i,t[3]=m,t[4]=o):o=t[4];const a=o;let d;t[5]!==i?(d={org:i},t[5]=i,t[6]=d):d=t[6];let f,h;t[7]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(q,{size:16,className:"shrink-0"}),h=s.jsx("span",{children:"Settings"}),t[7]=f,t[8]=h):(f=t[7],h=t[8]);let b;t[9]!==n||t[10]!==d?(b=s.jsx("div",{className:"flex items-center h-14 px-4 shrink-0 border-b border-border/50",children:s.jsxs(z,{to:"/$org",params:d,onClick:n,className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[f,h]})}),t[9]=n,t[10]=d,t[11]=b):b=t[11];let x;if(t[12]!==l||t[13]!==a||t[14]!==n||t[15]!==i){let S;t[17]!==a||t[18]!==n||t[19]!==i?(S=(u,v)=>s.jsxs("div",{className:"flex flex-col gap-0.5",children:[u.label&&s.jsx("p",{className:$("px-3 pt-1.5 pb-0.5 text-xs font-medium text-muted-foreground/60",v>0&&"mt-3"),children:u.label}),u.items.map(N=>s.jsxs(z,{to:N.to,params:{org:i},onClick:n,className:$("flex items-center gap-3 w-full px-3 py-2.5 rounded-lg transition-colors text-sm",a(N.to)?"bg-sidebar-accent text-sidebar-accent-foreground font-medium":"text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground"),children:[s.jsx("span",{className:"shrink-0",children:N.icon}),s.jsx("span",{className:"truncate",children:N.label})]},N.key))]},`${u.label}-${v}`),t[17]=a,t[18]=n,t[19]=i,t[20]=S):S=t[20],x=l.map(S),t[12]=l,t[13]=a,t[14]=n,t[15]=i,t[16]=x}else x=t[16];let g;t[21]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx("div",{className:"h-px bg-border/50 my-2"}),t[21]=g):g=t[21];let y;t[22]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[g,s.jsxs("button",{type:"button",onClick:Se,className:"flex items-center gap-3 w-full px-3 py-2.5 rounded-lg transition-colors text-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground",children:[s.jsx("span",{className:"shrink-0",children:s.jsx(F,{size:14})}),s.jsx("span",{className:"truncate",children:"Sign Out"})]})]}),t[22]=y):y=t[22];let j;t[23]!==x?(j=s.jsxs("div",{className:"flex flex-col flex-1 overflow-y-auto px-2 py-2 gap-0.5",children:[x,y]}),t[23]=x,t[24]=j):j=t[24];let _;t[25]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx("div",{className:"px-4 pb-3 pt-1 border-t border-border/50",children:s.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v","2.286.0"]})}),t[25]=_):_=t[25];let p;return t[26]!==j||t[27]!==b?(p=s.jsxs("div",{className:"flex flex-col h-full bg-sidebar",children:[b,j,_]}),t[26]=j,t[27]=b,t[28]=p):p=t[28],p}function Se(){return W.signOut()}function ve(e){return e.location.pathname}function Ne(){const e=k.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx("button",{type:"button",onClick:$e,className:"flex size-7 shrink-0 items-center justify-center rounded-md text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Go back",children:s.jsx(ae,{size:16})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"shrink-0 flex items-center justify-between pl-1 pr-2 h-10",children:s.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[t,s.jsx("button",{type:"button",onClick:ke,className:"flex size-7 shrink-0 items-center justify-center rounded-md text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Go forward",children:s.jsx(de,{size:16})})]})}),e[1]=n):n=e[1],n}function ke(){return window.history.forward()}function $e(){return window.history.back()}function ze(e){const t=k.c(3),{onOpenSidebar:n}=e;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(ce,{size:20}),t[0]=l):l=t[0];let r;return t[1]!==n?(r=s.jsx("div",{className:"shrink-0 flex items-center justify-between px-3 h-12 bg-background border-b border-border",children:s.jsx("button",{type:"button",onClick:n,className:"flex size-8 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors","aria-label":"Open menu",children:l})}),t[1]=n,t[2]=r):r=t[2],r}function we(){const e=k.c(17),t=he(),{org:n}=T();ue(n.id);const{setOpenMobile:l,openMobile:r}=X();if(t){let a;e[0]!==l?(a=s.jsx(ze,{onOpenSidebar:()=>l(!0)}),e[0]=l,e[1]=a):a=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{className:"flex-1 overflow-hidden",children:s.jsx(A,{value:"p-0",children:s.jsx("div",{className:"flex-1 min-w-0 overflow-hidden h-full",children:s.jsx(I,{})})})}),e[2]=d):d=e[2];let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(ee,{className:"sr-only",children:"Navigation"}),e[3]=f):f=e[3];let h;e[4]!==l?(h=s.jsxs(se,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[f,s.jsx(ye,{onClose:()=>l(!1)})]}),e[4]=l,e[5]=h):h=e[5];let b;e[6]!==r||e[7]!==l||e[8]!==h?(b=s.jsx(te,{open:r,onOpenChange:l,children:h}),e[6]=r,e[7]=l,e[8]=h,e[9]=b):b=e[9];let x;return e[10]!==a||e[11]!==b?(x=s.jsxs("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:[a,d,b]}),e[10]=a,e[11]=b,e[12]=x):x=e[12],x}let i;e[13]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Ne,{}),e[13]=i):i=e[13];let c;e[14]===Symbol.for("react.memo_cache_sentinel")?(c=$("flex flex-col h-full min-h-0 bg-background overflow-hidden","card-shadow","rounded-[0.75rem]"),e[14]=c):c=e[14];let m;e[15]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx(J,{size:20,className:"animate-spin text-muted-foreground"})}),e[15]=m):m=e[15];let o;return e[16]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs(s.Fragment,{children:[i,s.jsx("div",{className:"flex-1 min-h-0 p-1",children:s.jsx("div",{className:c,children:s.jsx(K.Suspense,{fallback:m,children:s.jsx("div",{className:"flex flex-1 items-center overflow-hidden rounded-[inherit]",children:s.jsx(A,{value:"p-0",children:s.jsx("div",{className:"flex-1 min-w-0 overflow-hidden h-full",children:s.jsx(I,{})})})})})})})]}),e[16]=o):o=e[16],o}function He(){const e=k.c(3);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={"--sidebar-width-icon":"3.5rem"},e[0]=t):t=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(ge,{}),e[1]=n):n=e[1];let l;return e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Q,{defaultOpen:!0,children:s.jsx("div",{className:"flex flex-col h-dvh overflow-hidden",children:s.jsxs(U,{className:"flex-1 bg-sidebar",style:t,children:[n,s.jsx(V,{className:"flex flex-col",style:{background:"transparent",containerType:"inline-size"},children:s.jsx(we,{})})]})})}),e[2]=l):l=e[2],l}export{ge as SettingsSidebar,ye as SettingsSidebarMobile,He as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as O,j as s,K as N,B as _,f as C,o as D,s as I,g as K,d as P,ab as E,r as w,V as M,b as A,a3 as L,S as R,O as q,bj as $}from"./index-
|
|
1
|
+
import{e as O,j as s,K as N,B as _,f as C,o as D,s as I,g as K,d as P,ab as E,r as w,V as M,b as A,a3 as L,S as R,O as q,bj as $}from"./index-D34n6J5J.js";import{c as z,a as F,D as U,d as B}from"./dialog-C4lREl-t.js";import{R as G}from"./required-auth-layout-C2o7AZ4K.js";import{u as Q}from"./use-tasks-Dpp1DK1f.js";import{b as H}from"./use-organization-settings-BD9CIHH5.js";import{u as Y}from"./use-org-sso-CACnH9GQ.js";import{i as V}from"./Lock01-DpPIS3K7.js";const T=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),k=T?"⌘":"Ctrl",j={keyboardShortcuts:{keys:[k,"K"],description:"Keyboard shortcuts"},focusChatInput:{keys:[k,"L"],description:"Focus chat input"},saveAndFormat:{keys:[k,"S"],description:"Save & format"},sendMessage:{keys:["Enter"],description:"Send message"},newLine:{keys:["Shift","Enter"],description:"New line"},selectOption:{keys:["1-9"],description:"Select option"},applyFilter:{keys:[k,"Enter"],description:"Apply filter"},togglePlanMode:{keys:[k,"Shift","L"],description:"Toggle plan mode"},newTask:{keys:["Shift",k,"S"],description:"New task"},toggleDaemon:{keys:[k,"D"],description:"Toggle daemon logs"}},W=[{label:"General",shortcuts:[j.keyboardShortcuts,j.newTask,j.toggleDaemon]},{label:"Editor",shortcuts:[j.saveAndFormat]},{label:"Chat",shortcuts:[j.focusChatInput,j.togglePlanMode,j.sendMessage,j.newLine]},{label:"Questions",shortcuts:[j.selectOption]},{label:"Monitoring",shortcuts:[j.applyFilter]}];function J(t){return T?t.metaKey:t.ctrlKey}function X(t){const e=O.c(5),{open:n,onOpenChange:o}=t;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(F,{children:s.jsx(U,{children:"Keyboard Shortcuts"})}),e[0]=u):u=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(z,{className:"sm:max-w-md",children:[u,s.jsx("div",{className:"flex flex-col gap-4",children:W.map(Z)})]}),e[1]=c):c=e[1];let r;return e[2]!==o||e[3]!==n?(r=s.jsx(B,{open:n,onOpenChange:o,children:c}),e[2]=o,e[3]=n,e[4]=r):r=e[4],r}function Z(t){return s.jsxs("div",{children:[s.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2",children:t.label}),s.jsx("div",{className:"flex flex-col gap-1.5",children:t.shortcuts.map(ee)})]},t.label)}function ee(t){return s.jsxs("div",{className:"flex items-center justify-between py-1",children:[s.jsx("span",{className:"text-sm",children:t.description}),s.jsx("div",{className:"flex items-center gap-1",children:t.keys.map(te)})]},t.description)}function te(t){return s.jsx("kbd",{className:"inline-flex items-center justify-center min-w-6 h-6 px-1.5 rounded-sm border border-border bg-muted text-muted-foreground text-xs font-mono",children:t},t)}function se(t,e,n){if(!n)return null;const o=t.getQueriesData({queryKey:N.tasksPrefix(e)});for(const[,u]of o){const c=u?.items?.find(r=>r.id===n);if(c?.branch)return c.branch}return null}function ne(t){const e=O.c(17),{orgId:n,orgName:o,domain:u}=t;let c;e[0]!==n?(c=()=>{window.location.href=`/api/org-sso/authorize?orgId=${encodeURIComponent(n)}`},e[0]=n,e[1]=c):c=e[1];const r=c,g=oe;let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("div",{className:"bg-primary/10 p-3 rounded-full",children:s.jsx(V,{className:"h-6 w-6 text-primary"})}),e[2]=m):m=e[2];let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx("h3",{className:"text-lg font-medium",children:"SSO Authentication Required"}),e[3]=h):h=e[3];let p;e[4]!==u||e[5]!==o?(p=o?s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:o})," requires SSO authentication",u?` via ${u}`:"","."]}):"This organization requires SSO authentication to access.",e[4]=u,e[5]=o,e[6]=p):p=e[6];let l;e[7]!==p?(l=s.jsxs("div",{className:"space-y-2",children:[h,s.jsx("p",{className:"text-sm text-muted-foreground",children:p})]}),e[7]=p,e[8]=l):l=e[8];let y;e[9]!==r?(y=s.jsx(_,{onClick:r,children:"Sign in with SSO"}),e[9]=r,e[10]=y):y=e[10];let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(_,{variant:"ghost",onClick:g,children:"Go back"}),e[11]=S):S=e[11];let b;e[12]!==y?(b=s.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[y,S]}),e[12]=y,e[13]=b):b=e[13];let x;return e[14]!==l||e[15]!==b?(x=s.jsx("div",{className:"flex items-center justify-center min-h-screen bg-background",children:s.jsxs("div",{className:"flex flex-col items-center text-center space-y-4 max-w-sm px-6",children:[m,l,b]})}),e[14]=l,e[15]=b,e[16]=x):x=e[16],x}function oe(){window.location.href="/"}function ae(t){const e=O.c(8),{org:n,children:o}=t,c=H(n.id)?.enabled_plugins??null;let r;e[0]!==n.id||e[1]!==n.name||e[2]!==c?(r={id:n.id,organizationId:n.id,slug:"_org",name:n.name,enabledPlugins:c,ui:null},e[0]=n.id,e[1]=n.name,e[2]=c,e[3]=r):r=e[3];const g=r;let m;return e[4]!==o||e[5]!==n||e[6]!==g?(m=s.jsx($,{org:n,project:g,children:o}),e[4]=o,e[5]=n,e[6]=g,e[7]=m):m=e[7],m}function ie(){const t=C(),e=D(),n=Q(),{locator:o}=I(),u=K({strict:!1}),c=P({strict:!1}),r=u.org??"",g=u.taskId??"",m=(a,i,f=!0)=>t({to:"/$org/$taskId",params:{org:r,taskId:a},search:i,replace:f}),h=(a,i=!0)=>m(g,a,i),p=a=>h(i=>({...i,chat:a?1:0})),l=a=>h(i=>({...i,tasks:a?1:0})),y=(a,i)=>m(a,f=>{const d={chat:1};return i?d.virtualmcpid=i:f.virtualmcpid&&(d.virtualmcpid=f.virtualmcpid),f.tasks&&(d.tasks=f.tasks),f.main&&(d.main=f.main),d},!1);return{setChatOpen:p,setTasksOpen:l,setTaskId:y,createNewTask:async()=>{const a=crypto.randomUUID(),i=se(e,o,g),f=c.virtualmcpid;try{await n.create.mutateAsync({id:a,...f?{virtual_mcp_id:f}:{},...i?{branch:i}:{}})}catch{}y(a)},openTab:a=>m(g||crypto.randomUUID(),i=>({...i,main:a})),toggleMain:()=>h(a=>{if(a.main!==void 0&&a.main!=="0")return{...a,main:"0"};const f={...a};return delete f.main,f})}}function re(){const t=O.c(24);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org",shouldThrow:!1},t[0]=e):e=t[0];const o=E(e)?.params.org,[u,c]=w.useState(!1);let r,g;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const d=v=>{J(v)&&v.code==="KeyK"&&(v.preventDefault(),c(!0))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},g=[],t[1]=r,t[2]=g):(r=t[1],g=t[2]),w.useEffect(r,g);let m;t[3]!==o?(m=N.activeOrganization(o),t[3]=o,t[4]=m):m=t[4];let h;t[5]!==o?(h=async()=>{if(!o)return null;const{data:d}=await A.organization.setActive({organizationSlug:o});return d&&localStorage.setItem(L.lastOrgSlug(),o),d},t[5]=o,t[6]=h):h=t[6];let p;t[7]!==m||t[8]!==h?(p={queryKey:m,queryFn:h,gcTime:1/0,refetchOnWindowFocus:!1},t[7]=m,t[8]=h,t[9]=p):p=t[9];const{data:l}=M(p),y=l?.id,{data:S}=Y(y);if(!l){let d;return t[10]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(R,{}),t[10]=d):d=t[10],d}if(S?.ssoRequired&&!S.authenticated){let d;return t[11]!==l.id||t[12]!==l.name||t[13]!==S.domain?(d=s.jsx(ne,{orgId:l.id,orgName:l.name,domain:S.domain}),t[11]=l.id,t[12]=l.name,t[13]=S.domain,t[14]=d):d=t[14],d}const b=l.logo??null;let x;t[15]!==l||t[16]!==b?(x={...l,logo:b},t[15]=l,t[16]=b,t[17]=x):x=t[17];let a;t[18]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(q,{}),t[18]=a):a=t[18];let i;t[19]!==u?(i=s.jsx(X,{open:u,onOpenChange:c}),t[19]=u,t[20]=i):i=t[20];let f;return t[21]!==x||t[22]!==i?(f=s.jsxs(ae,{org:x,children:[a,i]}),t[21]=x,t[22]=i,t[23]=f):f=t[23],f}function ce(){const t=O.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(G,{children:s.jsx(re,{})}),t[0]=e):e=t[0],e}const pe=Object.freeze(Object.defineProperty({__proto__:null,default:ce,usePanelActions:ie},Symbol.toStringTag,{value:"Module"}));export{J as i,se as r,pe as s,ie as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as n,c,j as i}from"./index-
|
|
1
|
+
import{e as n,c,j as i}from"./index-D34n6J5J.js";function m(o){const e=n.c(8);let s,t;e[0]!==o?({className:s,...t}=o,e[0]=o,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let l;e[3]!==s?(l=c("bg-accent animate-pulse rounded-md",s),e[3]=s,e[4]=l):l=e[4];let a;return e[5]!==t||e[6]!==l?(a=i.jsx("div",{"data-slot":"skeleton",className:l,...t}),e[5]=t,e[6]=l,e[7]=a):a=e[7],a}export{m as S};
|