decocms 3.2.3 → 3.3.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-C8E06jfW.js → AlertCircle-CQVrG_vJ.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-CkF0i1No.js → ArrowUpRight-RSgKJAKz.js} +1 -1
- package/dist/client/assets/{Check-DwRXhDYN.js → Check-_9fGuqcU.js} +1 -1
- package/dist/client/assets/{CheckCircle-2iMrjx7D.js → CheckCircle-BrIielg3.js} +1 -1
- package/dist/client/assets/{ChevronDown-k1VC2srD.js → ChevronDown-D8ki1YTV.js} +1 -1
- package/dist/client/assets/{ChevronLeft-7V2_qQ3E.js → ChevronLeft-Bn25DZii.js} +1 -1
- package/dist/client/assets/{ChevronRight-bA2PmkN9.js → ChevronRight-sANym5JO.js} +1 -1
- package/dist/client/assets/{ChevronUp-gzUJvPqk.js → ChevronUp-DWIsv9KU.js} +1 -1
- package/dist/client/assets/{Container-DrffveDY.js → Container-I8CLKgQT.js} +1 -1
- package/dist/client/assets/{DotsVertical-BZEdPJTY.js → DotsVertical-UEiFsiMu.js} +1 -1
- package/dist/client/assets/{Eye-CbDINxSR.js → Eye-MExi_r3W.js} +1 -1
- package/dist/client/assets/{FilterLines-DGIJAfna.js → FilterLines-4rC1xrIb.js} +1 -1
- package/dist/client/assets/{Globe01-CXHtWC8F.js → Globe01-Dv5kpprP.js} +1 -1
- package/dist/client/assets/{HardDrive-HIDpzn4I.js → HardDrive-D9IQyxX5.js} +1 -1
- package/dist/client/assets/{Key01-BTeVSARy.js → Key01-CjH_GA8o.js} +1 -1
- package/dist/client/assets/{LinkExternal01-D7lnMhd-.js → LinkExternal01-Bh2jIX62.js} +1 -1
- package/dist/client/assets/{Monitor01-F6bKl6tK.js → Monitor01-A1_9QQaN.js} +1 -1
- package/dist/client/assets/{Palette-szvJEqXU.js → Palette-BKIsz_ok.js} +1 -1
- package/dist/client/assets/{Play-sw2az4p0.js → Play-m26DvF8I.js} +1 -1
- package/dist/client/assets/{Plus-dxS60FPA.js → Plus-zYQzJd1M.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-B2-HH-To.js → RefreshCcw01-D0f_Eh8k.js} +1 -1
- package/dist/client/assets/{SearchMd-88iVjfqP.js → SearchMd-DeMPnpHH.js} +1 -1
- package/dist/client/assets/{Settings02-CdYsqAUT.js → Settings02-TwTRrSvQ.js} +1 -1
- package/dist/client/assets/{Shield01-D6lV8m1d.js → Shield01-CohVSmIO.js} +1 -1
- package/dist/client/assets/{Star01-K2L8_aik.js → Star01-DxtsQeOL.js} +1 -1
- package/dist/client/assets/{Stars01-Bmg9xGSu.js → Stars01-oKRH_HZK.js} +1 -1
- package/dist/client/assets/{Stars02-nn8T1-WQ.js → Stars02-CFg4uA06.js} +1 -1
- package/dist/client/assets/{Sun-Bk5MW5gf.js → Sun-prsTZZ-c.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-Caie0gIK.js → SwitchHorizontal01-DtrvJRJv.js} +1 -1
- package/dist/client/assets/{Tool01-CBtpfChg.js → Tool01-Blh-dWzw.js} +1 -1
- package/dist/client/assets/{Trash01-DDKaJVRQ.js → Trash01-BtO3xPfa.js} +1 -1
- package/dist/client/assets/{Upload01-B5AbRmag.js → Upload01-DuGEhzNC.js} +1 -1
- package/dist/client/assets/{User01-C5NUNAi1.js → User01-Cbs3uEng.js} +1 -1
- package/dist/client/assets/{Users01-BCOOK-yw.js → Users01-D1iLhJqh.js} +1 -1
- package/dist/client/assets/{Users03-CS9FNDsP.js → Users03-BpVRJS2k.js} +1 -1
- package/dist/client/assets/{X-D96et_XK.js → X-C7X3rsvo.js} +1 -1
- package/dist/client/assets/{XCircle-toDSs4J6.js → XCircle-28kRMNtc.js} +1 -1
- package/dist/client/assets/{XClose-C8XjR0Oj.js → XClose-C-93XSA0.js} +1 -1
- package/dist/client/assets/{Zap-DPY_aC88.js → Zap-Dv5TVml0.js} +1 -1
- package/dist/client/assets/{ZapSquare-D_bnCoLi.js → ZapSquare-C0D82h8r.js} +1 -1
- package/dist/client/assets/{ZoomOut-CFJklA2J.js → ZoomOut-DsFvQG0e.js} +1 -1
- package/dist/client/assets/{access-gate-Bxa3dGfK.js → access-gate-baJeia1A.js} +1 -1
- package/dist/client/assets/{accordion-7Hq31-jA.js → accordion-CBzWT5bz.js} +1 -1
- package/dist/client/assets/{add-section-modal-ctMF5sBw.js → add-section-modal-BWU52XJT.js} +1 -1
- package/dist/client/assets/agent-capabilities-DcmXZCtP.js +3 -0
- package/dist/client/assets/{agent-icon-CEtrmBbc.js → agent-icon-DqIYS1ir.js} +1 -1
- package/dist/client/assets/{agent-icons-CasiUZSA.js → agent-icons-DZENi63W.js} +1 -1
- package/dist/client/assets/{agents-list-CSKXo2_8.js → agents-list-DafoPLUH.js} +1 -1
- package/dist/client/assets/{ai-providers-DFSkJ7HL.js → ai-providers-BdnACxNs.js} +1 -1
- package/dist/client/assets/{alert-C0wwDo4J.js → alert-DQ3f-8ft.js} +1 -1
- package/dist/client/assets/{alert-dialog-jD0HIb4F.js → alert-dialog-DFtcSlfd.js} +1 -1
- package/dist/client/assets/app-editor-BD2ZoSqj.js +1 -0
- package/dist/client/assets/{auth-catchall-CQy9rKP1.js → auth-catchall-CDPdAyEO.js} +1 -1
- package/dist/client/assets/{auth-split-layout-D2GxEaTP.js → auth-split-layout-RuDPAksj.js} +1 -1
- package/dist/client/assets/{automation-list-row-XWf2Pzvs.js → automation-list-row-CCCDTeX2.js} +1 -1
- package/dist/client/assets/{automation-runs-d4uENwdC.js → automation-runs-CWg3SAkQ.js} +1 -1
- package/dist/client/assets/{automations-Cn-4c3Au.js → automations-CUUdoVDT.js} +1 -1
- package/dist/client/assets/{avatar-DXqnRYfU.js → avatar-Ht4phHyw.js} +1 -1
- package/dist/client/assets/{badge-CnPW-GqK.js → badge-793iqcSm.js} +1 -1
- package/dist/client/assets/{brand-context-C1cfILrc.js → brand-context-CKrOzy_j.js} +1 -1
- package/dist/client/assets/{buckets-ByaOx_bc.js → buckets-Cuou8oZr.js} +1 -1
- package/dist/client/assets/{calendar-DeW_DdNU.js → calendar-BcwgSBqk.js} +1 -1
- package/dist/client/assets/{capability-load-error-BGVv1fL5.js → capability-load-error-C5U_XP-e.js} +1 -1
- package/dist/client/assets/{card-DJApDAXW.js → card-Bp1tvcjx.js} +1 -1
- package/dist/client/assets/chat-context-2VONJLj0.js +20 -0
- package/dist/client/assets/{checkbox-BIvxdAqx.js → checkbox-DjyXVlr3.js} +1 -1
- package/dist/client/assets/{cli-auth-success-BHBjLjeF.js → cli-auth-success-WSYP5g8Z.js} +1 -1
- package/dist/client/assets/{collection-detail-C_EFjExv.js → collection-detail-d9ogG-zy.js} +1 -1
- package/dist/client/assets/{collection-display-button-Bj56qTcS.js → collection-display-button-DnHMSi9n.js} +1 -1
- package/dist/client/assets/{collection-search-BJxAlGyH.js → collection-search-7VpMRm-O.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-D6peytAO.js → collection-table-wrapper-Dupw7cC8.js} +1 -1
- package/dist/client/assets/{collection-tabs-CbsCH9v8.js → collection-tabs-FGkin6ZU.js} +1 -1
- package/dist/client/assets/{collections-Btisq60d.js → collections-q49v565i.js} +1 -1
- package/dist/client/assets/{command-BFgPrNtf.js → command-HR08HRGs.js} +1 -1
- package/dist/client/assets/connect-desktop-dialog-DlfiZAax.js +1 -0
- package/dist/client/assets/{connection-card-DHoKYS6O.js → connection-card-BcO2lPF3.js} +1 -1
- package/dist/client/assets/{connection-detail-Bp6uv95F.js → connection-detail-B5bRn-XD.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-q_5sAECo.js → connection-form-helpers-Bh0i7TML.js} +1 -1
- package/dist/client/assets/{connections-BH-sbBlr.js → connections-m2A2Bnzk.js} +1 -1
- package/dist/client/assets/{constants-C-D4Pmy6.js → constants-DcPOVd9N.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-BrQw0UAm.js → decopilot-sse-pool-C7otyoNt.js} +1 -1
- package/dist/client/assets/{dialog-m1msdckr.js → dialog-BTuyAnJD.js} +1 -1
- package/dist/client/assets/{domain-settings-De5BKpSF.js → domain-settings-44sFM9Gz.js} +1 -1
- package/dist/client/assets/{drawer-KxvT14L5.js → drawer-NfOOjKiq.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BXhpM-R_.js → dropdown-menu-Ci4-mVLy.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-DLRUs164.js → dynamic-plugin-layout-CyE7k6GQ.js} +1 -1
- package/dist/client/assets/{empty-state-BXMuvewe.js → empty-state-CeClTvy4.js} +1 -1
- package/dist/client/assets/{empty-state-D3juNsZ6.js → empty-state-DtzOtYNQ.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CvUd4tJL.js → extract-connection-data-CnlTupOc.js} +1 -1
- package/dist/client/assets/{features--cEA_34N.js → features-CK9ndiq8.js} +1 -1
- package/dist/client/assets/{file-explorer-CwfYBal8.js → file-explorer-BJRVDBLN.js} +1 -1
- package/dist/client/assets/{file-type-icon-aSS_wfKX.js → file-type-icon-Dj99fHuB.js} +1 -1
- package/dist/client/assets/{files-CKP66dnf.js → files-CMweUrQp.js} +1 -1
- package/dist/client/assets/{form-DIz1lXzt.js → form-BBZRauXH.js} +1 -1
- package/dist/client/assets/{general-CSQvrtS8.js → general-BmyzjAV8.js} +1 -1
- package/dist/client/assets/{generate-id-MICojNT7.js → generate-id-D_UH3sxI.js} +1 -1
- package/dist/client/assets/{github-repo-picker-CUBnWzWO.js → github-repo-picker-CWWi7O1C.js} +1 -1
- package/dist/client/assets/{header-tab-button-BCxnrLni.js → header-tab-button-jijhwXxy.js} +1 -1
- package/dist/client/assets/{hover-card-BagBBHwl.js → hover-card-CV9VXkH7.js} +1 -1
- package/dist/client/assets/{image-field-DInBNYXf.js → image-field-Crbqbizw.js} +1 -1
- package/dist/client/assets/{index-eeLoYk5O.js → index-B-uccEBH.js} +1 -1
- package/dist/client/assets/{index-ZsTpfnpi.js → index-BQLIK8jZ.js} +1 -1
- package/dist/client/assets/{index-DLIj-Jcg.js → index-BRntdJGH.js} +1 -1
- package/dist/client/assets/{index-42kOoh0P.js → index-Bp1M4ln7.js} +1 -1
- package/dist/client/assets/{index-ChQwZqpG.js → index-C5ZyXQHr.js} +1 -1
- package/dist/client/assets/{index-C3NmhGwz.js → index-CpOkTB99.js} +1 -1
- package/dist/client/assets/{index-DfrAcw3c.js → index-DHRRSUmw.js} +1 -1
- package/dist/client/assets/{index-CN3cwfwy.js → index-DJ3cGaJ6.js} +4 -4
- package/dist/client/assets/{index-BWtmYkwi.js → index-DVzdQ0e0.js} +1 -1
- package/dist/client/assets/{index-CWjORjiD.js → index-DjxxQl8A.js} +1 -1
- package/dist/client/assets/{index-BCwnQG_j.js → index-DlJh9T8T.js} +1 -1
- package/dist/client/assets/{index-DHt9Mf9G.js → index-Dpo5EC2L.js} +3 -3
- package/dist/client/assets/{index-Csz3ibNb.js → index-Dwsjb3YT.js} +1 -1
- package/dist/client/assets/{index-Dla-fDpI.js → index-c6-XkL5H.js} +1 -1
- package/dist/client/assets/{index-redirect-BTEQzwYi.js → index-redirect-Ey8lx3Da.js} +1 -1
- package/dist/client/assets/{index-Dg2RoULU.js → index-sKMKGB16.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-C0HsJFoc.js → infiniteQueryObserver-Ykg8iLnd.js} +1 -1
- package/dist/client/assets/{input-D2dMhViX.js → input-DdFNzbfV.js} +1 -1
- package/dist/client/assets/{integration-icon-D5ZAVm0g.js → integration-icon-DZLuTxs6.js} +1 -1
- package/dist/client/assets/{label-W8QKQ71a.js → label-e4yRWBjb.js} +1 -1
- package/dist/client/assets/{layout-C3II9QQW.js → layout-D67abH6w.js} +1 -1
- package/dist/client/assets/{login-CN2Q_xpv.js → login-By3dhxoa.js} +1 -1
- package/dist/client/assets/{members-Dx-3G2q9.js → members-D2YkNBZt.js} +1 -1
- package/dist/client/assets/{monaco-editor-637MBJHf.js → monaco-editor-0uL_TQZd.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-vcZ8M2dk.js → monitoring-stats-row-GIY4z6nm.js} +1 -1
- package/dist/client/assets/{oauth-callback-MkSvb6XB.js → oauth-callback-DfXh9mNP.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-BRN5UHIt.js → oauth-callback-ai-provider-D4kRRNKX.js} +1 -1
- package/dist/client/assets/{onboarding-Ci3GX3X7.js → onboarding-DQobqsv0.js} +1 -1
- package/dist/client/assets/{org-install-DvKUkehf.js → org-install-CiC9K4Ph.js} +1 -1
- package/dist/client/assets/{org-layout-CDF7rmnv.js → org-layout-jmM6ngno.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-C7dImV9m.js → org-plugin-layout-CHHdNNaK.js} +1 -1
- package/dist/client/assets/{page-seo-form-_pRbcmAC.js → page-seo-form-C-Kp4kFq.js} +1 -1
- package/dist/client/assets/page-seo-sheet-voFjiS6Q.js +1 -0
- package/dist/client/assets/{pair-BzvzVihx.js → pair-DywksGK8.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-RFNgD2Hl.js → plugin-empty-state-CyOhDphY.js} +1 -1
- package/dist/client/assets/{plugin-header-Cjy2H9Lt.js → plugin-header-hE0fGQHf.js} +1 -1
- package/dist/client/assets/{plugin-layout-CMzjQ3je.js → plugin-layout-DavzLUS9.js} +1 -1
- package/dist/client/assets/{popover-CBH5jqt8.js → popover-C68whzsY.js} +1 -1
- package/dist/client/assets/{post-editor-DgGiGnFb.js → post-editor-BPISWxsB.js} +1 -1
- package/dist/client/assets/{primitives-DIzZ8vtF.js → primitives-BqT_BizM.js} +1 -1
- package/dist/client/assets/{profile-CzlZVbcz.js → profile-BN88mKeH.js} +1 -1
- package/dist/client/assets/project-app-view-BcSwLB1G.js +1 -0
- package/dist/client/assets/record-editor-ts0XVKWT.js +1 -0
- package/dist/client/assets/registry-DNnKhVDs.js +2 -0
- package/dist/client/assets/{registry-layout-CK2u5-1Q.js → registry-layout-DnclO53f.js} +1 -1
- package/dist/client/assets/{require-capability-DvXpu1NE.js → require-capability-BSwqUQcE.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CceJrchr.js → required-auth-layout-2LAJNWxM.js} +1 -1
- package/dist/client/assets/{reset-password-MOrCv-Jk.js → reset-password-DivAvSnW.js} +1 -1
- package/dist/client/assets/{resizable-B9nPHbdY.js → resizable-0Wn5JpiT.js} +1 -1
- package/dist/client/assets/roles-C16A7h0o.js +1 -0
- package/dist/client/assets/{save-status-XRuEx_--.js → save-status-Ba2w8UKP.js} +1 -1
- package/dist/client/assets/{schema-form-CB484siM.js → schema-form-Ca7i7qHP.js} +1 -1
- package/dist/client/assets/{scroll-area-DVU-pYpl.js → scroll-area-JdApnymr.js} +1 -1
- package/dist/client/assets/{search-input-BMiEmNCi.js → search-input-BAlo7hPY.js} +1 -1
- package/dist/client/assets/{secrets-Cnbscr4a.js → secrets-QyqqDJ7A.js} +1 -1
- package/dist/client/assets/{sections-editor-CFNE6H-Z.js → sections-editor-BkVG_0Sr.js} +1 -1
- package/dist/client/assets/{select-BISzCSVs.js → select-BcoiasFF.js} +1 -1
- package/dist/client/assets/{select-model-DYDHHLGi.js → select-model-bFQD_87Y.js} +1 -1
- package/dist/client/assets/{seo-editor-0nVP1sQh.js → seo-editor-D1uGcych.js} +1 -1
- package/dist/client/assets/{settings-layout-BVrDhJki.js → settings-layout-YokPajU7.js} +1 -1
- package/dist/client/assets/{settings-section-BZG2d-sE.js → settings-section-C-qvClXS.js} +1 -1
- package/dist/client/assets/{sheet-C-msc_1A.js → sheet-BtJYdh0l.js} +1 -1
- package/dist/client/assets/{shell-controls-BvFNuvl3.js → shell-controls-D7CASrif.js} +1 -1
- package/dist/client/assets/{shell-layout-xcJQ-oXv.js → shell-layout-0P_-b-nq.js} +1 -1
- package/dist/client/assets/{shell-route-loading-BToLUOm_.js → shell-route-loading-DHB1qvk5.js} +1 -1
- package/dist/client/assets/{sidebar-C1EbFBeG.js → sidebar-DA2nzz_x.js} +1 -1
- package/dist/client/assets/{skeleton-HacfcGLU.js → skeleton-CpdmEGkq.js} +1 -1
- package/dist/client/assets/{sortable.esm-Dlj8q3TW.js → sortable.esm-X7KYMyOP.js} +1 -1
- package/dist/client/assets/{spinner-CXR5LEFP.js → spinner-D1gJYDcd.js} +1 -1
- package/dist/client/assets/{sso-DlZR7eJk.js → sso-BbX9axOk.js} +1 -1
- package/dist/client/assets/{store-C2kJGW5G.js → store-BcoC_jAQ.js} +1 -1
- package/dist/client/assets/store-registry-CVC0Fzo_.js +2 -0
- package/dist/client/assets/{switch-CWfvQ3qI.js → switch-NrMSEE-I.js} +1 -1
- package/dist/client/assets/{tab-id-CuSxDIM1.js → tab-id-Bd9aEZGd.js} +1 -1
- package/dist/client/assets/{table--UQXxBBH.js → table-HsedM5wi.js} +1 -1
- package/dist/client/assets/{tabs-33vYy1bT.js → tabs-CF-_gZ_h.js} +1 -1
- package/dist/client/assets/{task-status-DdX5GyQu.js → task-status-DwULjc9j.js} +1 -1
- package/dist/client/assets/{textarea-C-zVkKAJ.js → textarea-Dlde-1OC.js} +1 -1
- package/dist/client/assets/{toggle-group-CoUQzFHk.js → toggle-group-CaJEsTJW.js} +1 -1
- package/dist/client/assets/{toolbar-BmXelHzT.js → toolbar-1jwB3OBh.js} +1 -1
- package/dist/client/assets/{tools-list-CV_q_f0Z.js → tools-list-bR0GQjtD.js} +1 -1
- package/dist/client/assets/{tooltip-DY1LX4fr.js → tooltip-CnTONKZv.js} +1 -1
- package/dist/client/assets/{types-Dl5kxJ-o.js → types-Cy_Ngnr7.js} +1 -1
- package/dist/client/assets/{use-ai-providers-BcOqTKKC.js → use-ai-providers-Dc4GEqMk.js} +1 -1
- package/dist/client/assets/{use-automations-BPP1PerV.js → use-automations-wbB32tlZ.js} +1 -1
- package/dist/client/assets/{use-capability-BsGHGYLW.js → use-capability-BgKTO1vN.js} +1 -1
- package/dist/client/assets/{use-collections-ZGWkQryR.js → use-collections-C6vSjty8.js} +1 -1
- package/dist/client/assets/{use-connection-BAOUEhf6.js → use-connection-DHFQC4eq.js} +1 -1
- package/dist/client/assets/{use-copy-eq8o4JlH.js → use-copy-zJQ-7Mci.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-KZ5vkVjY.js → use-create-virtual-mcp-DXgKXXwR.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-CVMWB9VT.js → use-debounced-autosave-CegS5org.js} +1 -1
- package/dist/client/assets/{use-delete-connection-BddckOeq.js → use-delete-connection-Crgi2dup.js} +1 -1
- package/dist/client/assets/{use-file-configs-BDCkFZ7E.js → use-file-configs-BGEpvSvj.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CAJkZLHC.js → use-infinite-scroll-rNa7__7x.js} +1 -1
- package/dist/client/assets/{use-list-state-ufhhKZZh.js → use-list-state-DTqrRKHV.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-BJKxU2Na.js → use-mcp-prompts-B_UVPJoG.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-ftOL48Fr.js → use-mcp-tools-DO4I7PYX.js} +1 -1
- package/dist/client/assets/{use-members-D0MeIqsF.js → use-members-WKgQqTSP.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-BYyEy_zS.js → use-navigate-to-agent-k6jWIqgZ.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-YKBoNqBy.js → use-org-auth-client-DY5JwLAM.js} +1 -1
- package/dist/client/assets/{use-org-sso-Lxt3NvQV.js → use-org-sso-C5ckgDRh.js} +1 -1
- package/dist/client/assets/{use-organization-roles-DE5F_seS.js → use-organization-roles-KNrmN_Ah.js} +1 -1
- package/dist/client/assets/{use-organization-settings-C-jLCwb5.js → use-organization-settings-pl01D-rl.js} +1 -1
- package/dist/client/assets/{use-registry-connections-DWZHQxm0.js → use-registry-connections-Drhpxg0Z.js} +1 -1
- package/dist/client/assets/{use-secrets-BT7pvkDh.js → use-secrets-NYjq8Fmy.js} +1 -1
- package/dist/client/assets/{use-status-sounds-DLyX7i_J.js → use-status-sounds-lg6Y6CRj.js} +1 -1
- package/dist/client/assets/{use-view-mode-ljpeZqvp.js → use-view-mode-DzNy4Hyk.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-Rn9fsUNN.js → use-virtual-mcp-CJt6reVB.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BQyXdojd.js +1 -0
- package/dist/client/assets/{useRouterState-CXGDCAP4.js → useRouterState-D3ymnfxm.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DZbKMeAX.js +1 -0
- package/dist/client/assets/{user-Dh7nE-E-.js → user-Cg4afsI8.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-7zw5kq-m.js → view-mode-toggle-COafKFpZ.js} +1 -1
- package/dist/client/assets/{workflow-BAq_lzuZ.js → workflow-B4FJSGuD.js} +1 -1
- package/dist/client/assets/workflow-detail-DhzF6uRf.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +416 -416
- package/dist/server/server.js +262 -262
- package/package.json +1 -1
- package/dist/client/assets/agent-capabilities-BLrQsLZt.js +0 -3
- package/dist/client/assets/app-editor-DJDkUDig.js +0 -1
- package/dist/client/assets/chat-context-CQlAaKi3.js +0 -20
- package/dist/client/assets/connect-desktop-dialog-Dh1zqCgF.js +0 -1
- package/dist/client/assets/page-seo-sheet-CKWQNz11.js +0 -1
- package/dist/client/assets/project-app-view-CpvI7p3P.js +0 -1
- package/dist/client/assets/record-editor-CVyJ-HfI.js +0 -1
- package/dist/client/assets/registry-vLK01UDd.js +0 -2
- package/dist/client/assets/roles-C0nb3z6u.js +0 -1
- package/dist/client/assets/store-registry-DESNxNEj.js +0 -2
- package/dist/client/assets/useInfiniteQuery-CWJ6mtkH.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DDVcuWif.js +0 -1
- package/dist/client/assets/workflow-detail-DpURA77E.js +0 -1
package/package.json
CHANGED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{F as ze,r as S,at as Fs,ar as Os,e as L,q as ie,c as B,j as s,E as Ls,o as ae,R as he,aG as $s,U as _e,aH as Tt,L as zs,B as se,G as Bs,H as Us,aI as Ks,aJ as qs,a0 as Ee,C as Qs,aK as Pe,aL as Gt,n as En,K as Ie,t as W,f as nt,a as Pt,aM as Ys,v as Rn,Q as Hs,b as Tn,aN as Gs,aO as Pn,aP as Ws,aQ as ce,aR as xt,aS as Js,aT as Zs,aU as gt,aV as Xs,aW as er,aX as tr,aY as nr,s as sr,aZ as rr,a_ as or,a$ as ar,b0 as lr,l as ir,D as Dn}from"./index-DHt9Mf9G.js";import{e as Mn,s as st,g as Ve,P as We,f as Dt,t as cr,h as dr,M as Vr,i as ur,j as Oe,k as fr,l as mr,F as pr,c as hr,S as xr,m as gr,n as br,o as Wt}from"./pair-BzvzVihx.js";import{c as ue,a as Be,b as vr,d as rt,g as yr,f as Fn,A as Ar,h as wr}from"./chat-context-CQlAaKi3.js";import{S as jt}from"./spinner-CXR5LEFP.js";import{c as St,u as jr,T as xe,a as ge,b as be}from"./tooltip-DY1LX4fr.js";import{b as ot,c as at,a as lt,D as it,e as Mt}from"./dialog-m1msdckr.js";import{c as Sr,D as Cr,a as Nr,b as kr}from"./drawer-KxvT14L5.js";import{C as _r}from"./collection-search-BJxAlGyH.js";import{g as ct,u as de,S as dt,K as Ir,i as Jt}from"./constants-C-D4Pmy6.js";import{u as Er,g as Vt,l as Ct}from"./use-mcp-prompts-BJKxU2Na.js";import{t as ut}from"./ChevronDown-k1VC2srD.js";import{i as De}from"./X-D96et_XK.js";import{t as Rr,z as Tr,u as Pr,w as Dr,A as Mr}from"./tab-id-CuSxDIM1.js";import{K as Fr,i as Or}from"./shell-layout-xcJQ-oXv.js";import{a as Lr,u as $r}from"./use-virtual-mcp-Rn9fsUNN.js";import{i as zr}from"./SwitchHorizontal01-Caie0gIK.js";import{n as On}from"./ZapSquare-D_bnCoLi.js";import{i as Ue}from"./Check-DwRXhDYN.js";import{s as Ln}from"./Star01-K2L8_aik.js";import{a as $n}from"./Tool01-CBtpfChg.js";import{$ as ft,m as Br,K as zn,A as Bn,i as Ye,b as Ur,N as Kr,a0 as qr,q as Qr,a1 as Yr,a2 as Hr,W as Un}from"./agent-icon-CEtrmBbc.js";import{i as Gr}from"./Upload01-B5AbRmag.js";import{i as Kn}from"./AlertCircle-C8E06jfW.js";import{a as Wr}from"./Eye-CbDINxSR.js";import{a as Nt,b as Ft,d as Ot,f as Lt,F as qn}from"./form-DIz1lXzt.js";import{b as Jr,d as Zr,c as Xr,S as eo,a as to}from"./select-BISzCSVs.js";import{i as no}from"./RefreshCcw01-B2-HH-To.js";import{a as Qn,t as kt,b as so}from"./XCircle-toDSs4J6.js";import{b as ro,c as oo}from"./tabs-33vYy1bT.js";import{T as Yn,a as Je}from"./toggle-group-CoUQzFHk.js";import{I as Hn}from"./input-D2dMhViX.js";import{u as ao}from"./use-ai-providers-BcOqTKKC.js";import{C as Gn,a as Wn,m as mt,i as lo,g as Jn,b as io,N as co}from"./agent-icons-CasiUZSA.js";import{P as $t,a as zt,b as Bt}from"./popover-CBH5jqt8.js";import{i as Vo}from"./Monitor01-F6bKl6tK.js";import{a as Zt,e as Xt,f as uo,c as fo,C as mo,d as po,b as ho}from"./command-BFgPrNtf.js";import{u as xo}from"./useInfiniteQuery-CWJ6mtkH.js";import{g as Zn,A as go}from"./sortable.esm-Dlj8q3TW.js";import{t as bo}from"./Stars01-Bmg9xGSu.js";import{P as _t,a as vo,b as yo,u as Ao,E as wo,c as Ut,i as jo,d as So}from"./scroll-area-DVU-pYpl.js";import{S as Co}from"./index-ChQwZqpG.js";import{r as Xn,l as Fe}from"./types-Dl5kxJ-o.js";import{D as No,a as ko,b as _o,c as fe,e as en,f as tn,g as nn,i as Io,j as Eo}from"./dropdown-menu-BXhpM-R_.js";import{s as sn}from"./Plus-dxS60FPA.js";import{p as Ro,q as To}from"./question-004-sINsf4GQ.js";import{i as Po}from"./ChevronRight-bA2PmkN9.js";function Do(t,e){const n=ze(e);return Mo({filters:{...t,status:"pending"}},n).length}function rn(t,e){return t.findAll(e.filters).map(n=>e.select?e.select(n):n.state)}function Mo(t={},e){const n=ze(e).getMutationCache(),r=S.useRef(t),o=S.useRef(null);return o.current===null&&(o.current=rn(n,t)),S.useEffect(()=>{r.current=t}),S.useSyncExternalStore(S.useCallback(a=>n.subscribe(()=>{const l=Fs(o.current,rn(n,r.current));o.current!==l&&(o.current=l,Os.schedule(a))}),[n]),()=>o.current,()=>o.current)}const on=3,es="inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-muted text-muted-foreground text-sm font-medium transition-colors cursor-pointer",Fo="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function ts(t){const e=L.c(46),{item:n,onSelect:r,isLoading:o,isDisabled:a,variant:l}=t,c=l===void 0?"pill":l,{prompt:i}=n;let u;if(e[0]!==i._meta||e[1]!==i.name||e[2]!==i.title){const k=Ve(i._meta);u=i.title??Dt(i.name,k),e[0]=i._meta,e[1]=i.name,e[2]=i.title,e[3]=u}else u=e[3];const V=u,d=i.description||null;if(c==="card"){let k;e[4]!==r||e[5]!==i?(k=()=>r(i),e[4]=r,e[5]=i,e[6]=k):k=e[6];const j=a||o,C=o&&"bg-accent/40",P=(a||o)&&"cursor-not-allowed opacity-50";let N;e[7]!==C||e[8]!==P?(N=B(Fo,"hover:bg-accent/60 text-foreground",C,P),e[7]=C,e[8]=P,e[9]=N):N=e[9];let T;e[10]!==V?(T=s.jsx("span",{className:"font-medium truncate capitalize",children:V}),e[10]=V,e[11]=T):T=e[11];let E;e[12]!==o?(E=o&&s.jsx(jt,{size:"xs"}),e[12]=o,e[13]=E):E=e[13];let _;e[14]!==T||e[15]!==E?(_=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[T,E]}),e[14]=T,e[15]=E,e[16]=_):_=e[16];let R;e[17]!==d?(R=d&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:d}),e[17]=d,e[18]=R):R=e[18];let O;return e[19]!==_||e[20]!==R||e[21]!==k||e[22]!==j||e[23]!==N?(O=s.jsxs("button",{type:"button",onClick:k,disabled:j,className:N,children:[_,R]}),e[19]=_,e[20]=R,e[21]=k,e[22]=j,e[23]=N,e[24]=O):O=e[24],O}let m;e[25]!==r||e[26]!==i?(m=()=>r(i),e[25]=r,e[26]=i,e[27]=m):m=e[27];const f=a||o,x=o&&"bg-muted/50",h=(a||o)&&"cursor-not-allowed opacity-50";let p;e[28]!==x||e[29]!==h?(p=B(es,"hover:bg-muted/70 hover:text-foreground",x,h),e[28]=x,e[29]=h,e[30]=p):p=e[30];let b;e[31]!==V?(b=s.jsx("span",{className:"capitalize",children:V}),e[31]=V,e[32]=b):b=e[32];let g;e[33]!==o?(g=o&&s.jsx(jt,{size:"xs"}),e[33]=o,e[34]=g):g=e[34];let v;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==b||e[39]!==g?(v=s.jsx(xe,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:m,disabled:f,className:p,children:[b,g]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=b,e[39]=g,e[40]=v):v=e[40];const y=d??V;let w;e[41]!==y?(w=s.jsx(ge,{side:"top",className:"max-w-xs",children:s.jsx("p",{className:"text-xs",children:y})}),e[41]=y,e[42]=w):w=e[42];let A;return e[43]!==v||e[44]!==w?(A=s.jsxs(be,{delayDuration:400,children:[v,w]}),e[43]=v,e[44]=w,e[45]=A):A=e[45],A}function Oo(t){const e=L.c(41),{items:n,open:r,onOpenChange:o,onSelect:a,loadingPrompt:l}=t,[c,i]=S.useState(""),u=!!l;let V;e[0]!==n||e[1]!==c?(V=c.trim()?n.filter(j=>{const C=c.toLowerCase();return j.prompt.name.toLowerCase().includes(C)||(j.prompt.title??"").toLowerCase().includes(C)||(j.prompt.description??"").toLowerCase().includes(C)}):n,e[0]=n,e[1]=c,e[2]=V):V=e[2];const d=V,m=jr();let f;e[3]!==d.length||e[4]!==c?(f=d.length===0&&s.jsxs("p",{className:"col-span-4 text-sm text-muted-foreground text-center py-8",children:["No prompts match “",c,"”"]}),e[3]=d.length,e[4]=c,e[5]=f):f=e[5];let x;if(e[6]!==d||e[7]!==u||e[8]!==l?.name||e[9]!==o||e[10]!==a){let j;e[12]!==u||e[13]!==l?.name||e[14]!==o||e[15]!==a?(j=C=>s.jsx(ts,{item:C,variant:"card",onSelect:P=>{o(!1),a(P)},isLoading:l?.name===C.prompt.name,isDisabled:u&&l?.name!==C.prompt.name},C.prompt.name),e[12]=u,e[13]=l?.name,e[14]=o,e[15]=a,e[16]=j):j=e[16],x=d.map(j),e[6]=d,e[7]=u,e[8]=l?.name,e[9]=o,e[10]=a,e[11]=x}else x=e[11];let h;e[17]!==f||e[18]!==x?(h=s.jsx("div",{className:"flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 p-5",children:[f,x]})}),e[17]=f,e[18]=x,e[19]=h):h=e[19];const p=h;let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=j=>{j.key==="Escape"&&i("")},e[20]=b):b=e[20];let g;e[21]!==c?(g=s.jsx(_r,{value:c,onChange:i,placeholder:"Search prompts...",onKeyDown:b}),e[21]=c,e[22]=g):g=e[22];const v=g;if(m){let j;e[23]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Sr,{className:"sr-only",children:s.jsx(Cr,{children:"All prompts"})}),e[23]=j):j=e[23];let C;e[24]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[24]=C):C=e[24];let P;e[25]!==p||e[26]!==v?(P=s.jsxs(Nr,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[j,C,v,p]}),e[25]=p,e[26]=v,e[27]=P):P=e[27];let N;return e[28]!==o||e[29]!==r||e[30]!==P?(N=s.jsx(St,{delayDuration:400,children:s.jsx(kr,{open:r,onOpenChange:o,children:P})}),e[28]=o,e[29]=r,e[30]=P,e[31]=N):N=e[31],N}let y;e[32]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx(ot,{className:"sr-only",children:s.jsx(at,{children:"All prompts"})}),e[32]=y):y=e[32];let w;e[33]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx("div",{className:"flex items-center h-12 border-b border-border px-4 shrink-0",children:s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Prompts"})}),e[33]=w):w=e[33];let A;e[34]!==p||e[35]!==v?(A=s.jsxs(lt,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[y,w,v,p]}),e[34]=p,e[35]=v,e[36]=A):A=e[36];let k;return e[37]!==o||e[38]!==r||e[39]!==A?(k=s.jsx(St,{delayDuration:400,children:s.jsx(it,{open:r,onOpenChange:o,children:A})}),e[37]=o,e[38]=r,e[39]=A,e[40]=k):k=e[40],k}function Lo(t){const e=L.c(29),{items:n,onSelect:r,loadingPrompt:o,className:a}=t,[l,c]=S.useState(!1);if(n.length===0)return null;let i,u,V;if(e[0]!==n||e[1]!==o||e[2]!==r){const b=n.slice(0,on);let g;e[6]!==n?(g=n.slice(on),e[6]=n,e[7]=g):g=e[7],i=g,u=!!o;let v;e[8]!==u||e[9]!==o?.name||e[10]!==r?(v=y=>s.jsx(ts,{item:y,onSelect:r,isLoading:o?.name===y.prompt.name,isDisabled:u&&o?.name!==y.prompt.name},y.prompt.name),e[8]=u,e[9]=o?.name,e[10]=r,e[11]=v):v=e[11],V=b.map(v),e[0]=n,e[1]=o,e[2]=r,e[3]=i,e[4]=u,e[5]=V}else i=e[3],u=e[4],V=e[5];const d=V;let m;e[12]!==a?(m=B("w-full flex flex-wrap gap-2 justify-center",a),e[12]=a,e[13]=m):m=e[13];let f;e[14]!==i.length||e[15]!==u?(f=i.length>0&&s.jsxs("button",{type:"button",disabled:u,onClick:()=>c(!0),className:B(es,"hover:bg-muted/70 hover:text-foreground",u&&"opacity-50 cursor-not-allowed"),children:["+",i.length," more"]}),e[14]=i.length,e[15]=u,e[16]=f):f=e[16];let x;e[17]!==d||e[18]!==m||e[19]!==f?(x=s.jsxs("div",{className:m,children:[d,f]}),e[17]=d,e[18]=m,e[19]=f,e[20]=x):x=e[20];let h;e[21]!==n||e[22]!==o||e[23]!==l||e[24]!==r?(h=s.jsx(Oo,{items:n,open:l,onOpenChange:c,onSelect:r,loadingPrompt:o}),e[21]=n,e[22]=o,e[23]=l,e[24]=r,e[25]=h):h=e[25];let p;return e[26]!==x||e[27]!==h?(p=s.jsxs(St,{delayDuration:400,children:[x,h]}),e[26]=x,e[27]=h,e[28]=p):p=e[28],p}function $o(){return null}function zo(t,e){switch(e.type){case"SELECT_PROMPT":return!e.prompt.arguments||e.prompt.arguments.length===0?{stage:"loading",prompt:e.prompt}:{stage:"idle"};case"START_LOADING":return{stage:"loading",prompt:e.prompt,arguments:e.arguments};case"RESET":return{stage:"idle"};default:return t}}function Bo(t){const e=L.c(30),{connectionId:n}=t,{sendMessage:r}=Be(),{org:o}=ie();let a;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(a={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=a):a=e[3];const l=de(a);let c;e[4]!==l?(c={client:l,staleTime:6e4},e[4]=l,e[5]=c):c=e[5];const{data:i}=Er(c);let u;e[6]!==i?.prompts?(u=i?.prompts??[],e[6]=i?.prompts,e[7]=u):u=e[7];const V=u;let d;e[8]!==V?(d=V.map(Uo),e[8]=V,e[9]=d):d=e[9];const m=d;let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f={stage:"idle"},e[10]=f):f=e[10];const[x,h]=S.useReducer(zo,f),[p,b]=S.useState(null);let g;e[11]!==l||e[12]!==r?(g=async(E,_)=>{if(!l){ae.error("MCP client not available"),h({type:"RESET"});return}try{const R=await Vt(l,E.name,_);h({type:"RESET"});const O={type:"doc",content:[{type:"paragraph",content:[Mn({id:E.name,name:st(E.name,Ve(E._meta)),metadata:R.messages,char:"/",kind:"prompt",args:_}),{type:"text",text:" "}]}]};await r(O)}catch(R){console.error("[ice-breakers] Failed to fetch prompt:",R),ae.error("Failed to load prompt. Please try again."),h({type:"RESET"})}},e[11]=l,e[12]=r,e[13]=g):g=e[13];const v=g;let y;e[14]!==v?(y=async E=>{if(E.arguments&&E.arguments.length>0){h({type:"SELECT_PROMPT",prompt:E}),b(E);return}h({type:"START_LOADING",prompt:E}),await v(E)},e[14]=v,e[15]=y):y=e[15];const w=y;let A;e[16]!==p||e[17]!==v?(A=async E=>{p&&(h({type:"START_LOADING",prompt:p,arguments:E}),b(null),await v(p,E))},e[16]=p,e[17]=v,e[18]=A):A=e[18];const k=A;if(m.length===0)return null;const j=x.stage==="loading"?x.prompt:null;let C;e[19]!==w||e[20]!==m||e[21]!==j?(C=s.jsx(Lo,{items:m,onSelect:w,loadingPrompt:j}),e[19]=w,e[20]=m,e[21]=j,e[22]=C):C=e[22];let P;e[23]===Symbol.for("react.memo_cache_sentinel")?(P=()=>{b(null),h({type:"RESET"})},e[23]=P):P=e[23];let N;e[24]!==p||e[25]!==k?(N=s.jsx(We,{prompt:p,setPrompt:P,onSubmit:k}),e[24]=p,e[25]=k,e[26]=N):N=e[26];let T;return e[27]!==C||e[28]!==N?(T=s.jsxs(s.Fragment,{children:[C,N]}),e[27]=C,e[28]=N,e[29]=T):T=e[29],T}function Uo(t){return{prompt:t}}function Ko(t){const e=L.c(13),{className:n}=t,{selectedVirtualMcp:r}=ue(),{org:o}=ie();let a;e[0]!==o.id?(a=ct(o.id),e[0]=o.id,e[1]=a):a=e[1];const l=a.id,c=r?.id??l;let i;e[2]!==n?(i=B("w-full @container",n),e[2]=n,e[3]=i):i=e[3];const u=c??"default";let V;e[4]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx($o,{}),e[4]=V):V=e[4];let d;e[5]!==c?(d=s.jsx(Bo,{connectionId:c}),e[5]=c,e[6]=d):d=e[6];let m;e[7]!==u||e[8]!==d?(m=s.jsx(Ls,{fallback:null,children:s.jsx(S.Suspense,{fallback:V,children:d},u)}),e[7]=u,e[8]=d,e[9]=m):m=e[9];let f;return e[10]!==i||e[11]!==m?(f=s.jsx("div",{className:i,children:m}),e[10]=i,e[11]=m,e[12]=f):f=e[12],f}const bt="cubic-bezier(0.645, 0.045, 0.355, 1)",qo=44,Qo={default:"",error:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-destructive/5 after:pointer-events-none after:-z-10",warning:"isolate after:content-[''] after:absolute after:inset-0 after:rounded-xl after:bg-amber-500/5 after:pointer-events-none after:-z-10"},Yo={default:"border-border",error:"border-destructive/30",warning:"border-amber-500/30"},Ho={default:"text-muted-foreground",error:"text-destructive",warning:"text-amber-600 dark:text-amber-500"};function pe(t){const e=L.c(61),{icon:n,label:r,count:o,title:a,footerLeft:l,footerRight:c,children:i,defaultExpanded:u,variant:V,onClose:d}=t,m=V===void 0?"default":V,[f,x]=S.useState(u),[h,p]=S.useState(!1);let b;e[0]!==d?(b=()=>{p(!0),d?.()},e[0]=d,e[1]=b):b=e[1];const g=b;if(h)return null;const v=Yo[m],y=Qo[m];let w;e[2]!==v||e[3]!==y?(w=B("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",v,y),e[2]=v,e[3]=y,e[4]=w):w=e[4];let A;e[5]===Symbol.for("react.memo_cache_sentinel")?(A=()=>x(Go),e[5]=A):A=e[5];const k=f&&"rounded-b-none",j=!f&&"rounded-b-xl";let C;e[6]!==k||e[7]!==j?(C=B("flex items-center gap-2 w-full px-3 py-2 text-sm text-left","hover:bg-accent/50 transition-colors rounded-t-xl",k,j),e[6]=k,e[7]=j,e[8]=C):C=e[8];const P=Ho[m];let N;e[9]!==P?(N=B("shrink-0",P),e[9]=P,e[10]=N):N=e[10];let T;e[11]!==n||e[12]!==N?(T=s.jsx("span",{className:N,children:n}),e[11]=n,e[12]=N,e[13]=T):T=e[13];let E;e[14]!==r?(E=s.jsx("span",{className:"flex-1 min-w-0 truncate",children:r}),e[14]=r,e[15]=E):E=e[15];let _;e[16]!==o?(_=o?s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:o}):null,e[16]=o,e[17]=_):_=e[17];const R=f?"rotate(180deg)":"rotate(0deg)";let O;e[18]!==R?(O=s.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:s.jsx(ut,{size:16,style:{transform:R,transition:`transform 180ms ${bt}`}})}),e[18]=R,e[19]=O):O=e[19];let D,I;e[20]!==g?(D=H=>{H.stopPropagation(),g()},I=H=>{(H.key==="Enter"||H.key===" ")&&(H.preventDefault(),H.stopPropagation(),g())},e[20]=g,e[21]=D,e[22]=I):(D=e[21],I=e[22]);let F;e[23]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(De,{size:16}),e[23]=F):F=e[23];let $;e[24]!==D||e[25]!==I?($=s.jsx("span",{role:"button",tabIndex:0,"data-testid":"collapsible-highlight-close","aria-label":"Close",title:"Close",onClick:D,onKeyDown:I,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 flex items-center justify-center -mr-1 ml-1 p-1 rounded-md hover:bg-accent",children:F}),e[24]=D,e[25]=I,e[26]=$):$=e[26];let z;e[27]!==f||e[28]!==T||e[29]!==E||e[30]!==_||e[31]!==O||e[32]!==$||e[33]!==C?(z=s.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":f,onClick:A,className:C,children:[T,E,_,O,$]}),e[27]=f,e[28]=T,e[29]=E,e[30]=_,e[31]=O,e[32]=$,e[33]=C,e[34]=z):z=e[34];const K=f?"1fr":"0fr";let M;e[35]!==K?(M={display:"grid",gridTemplateRows:K,transition:`grid-template-rows 180ms ${bt}`},e[35]=K,e[36]=M):M=e[36];let U;e[37]===Symbol.for("react.memo_cache_sentinel")?(U={overflow:"hidden",minHeight:0},e[37]=U):U=e[37];const Q=f?1:0;let q;e[38]!==Q?(q={opacity:Q,transition:`opacity 120ms ${bt}`},e[38]=Q,e[39]=q):q=e[39];let Y;e[40]!==a?(Y=a?s.jsx("div",{className:"flex items-start gap-2 px-4 pt-4 pb-5 border-t border-dashed border-border/60",children:s.jsx("p",{className:"flex-1 text-base font-medium text-foreground min-w-0",children:a})}):s.jsx("div",{className:"border-t border-dashed border-border/60"}),e[40]=a,e[41]=Y):Y=e[41];let J;e[42]!==i||e[43]!==a?(J=i?s.jsx("div",{className:B("overflow-clip pb-4",!a&&"pt-4"),children:i}):null,e[42]=i,e[43]=a,e[44]=J):J=e[44];let Z;e[45]!==l||e[46]!==c?(Z=l||c?s.jsx("div",{className:"border-t border-border px-3 py-3 pb-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:l}),s.jsx("div",{className:"flex items-center gap-2",children:c})]})}):null,e[45]=l,e[46]=c,e[47]=Z):Z=e[47];let X;e[48]!==q||e[49]!==Y||e[50]!==J||e[51]!==Z?(X=s.jsx("div",{style:U,children:s.jsxs("div",{style:q,children:[Y,J,Z]})}),e[48]=q,e[49]=Y,e[50]=J,e[51]=Z,e[52]=X):X=e[52];let te;e[53]!==M||e[54]!==X?(te=s.jsx("div",{"data-testid":"collapsible-highlight-body",style:M,children:X}),e[53]=M,e[54]=X,e[55]=te):te=e[55];let ee;return e[56]!==z||e[57]!==te||e[58]!==w||e[59]!==m?(ee=s.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":m,className:w,children:[z,te]}),e[56]=z,e[57]=te,e[58]=w,e[59]=m,e[60]=ee):ee=e[60],ee}function Go(t){return!t}const Wo=he({content:_e().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Tt(["pending","in_progress","completed"]),activeForm:_e().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),ns=he({todos:$s(Wo)}),Jo="Plan and track multi-step work. Call with the FULL todo list every time — this replaces the prior list. Call at the start of every multi-step request. Skip only for true one-shots (a single tool call or a direct answer). Mark exactly one todo `in_progress` at a time. Flip a todo to `in_progress` before starting it and to `completed` the moment it finishes — do not batch completions. Your prior tool-call inputs are your current state — read your last call to see where you are.";Rr({description:Jo,inputSchema:Tr(ns),execute:async({todos:t})=>({ok:!0,count:t.length})});const Zo="tool-todo_write",Xo=new Set(["input-available","output-available"]);function ss(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.role!=="assistant")continue;const r=n.parts;if(Array.isArray(r))for(let o=r.length-1;o>=0;o--){const a=r[o];if(a.type!==Zo||typeof a.state!="string"||!Xo.has(a.state))continue;const l=ns.safeParse(a.input);if(l.success)return l.data.todos}}return[]}function rs(t){const e=[];for(const n of t)if("state"in n&&n.state==="approval-requested"&&"approval"in n&&n.approval?.id&&"toolCallId"in n&&n.toolCallId){const r="toolName"in n&&typeof n.toolName=="string"?n.toolName:n.type.startsWith("tool-")?n.type.replace("tool-",""):"Tool";e.push({approvalId:n.approval.id,toolCallId:n.toolCallId,toolName:r,friendlyName:cr(dr(r)),input:n.input})}return e}function os(t){const e=[];for(const n of t)if("type"in n&&n.type==="tool-propose_plan"&&"state"in n&&n.state==="input-available"&&"toolCallId"in n&&"input"in n){const r=n.input;e.push({toolCallId:n.toolCallId,plan:r.plan,state:n.state})}return e}function ea(t){return t?t.message.startsWith("[CREDITS]"):!1}const ta={isCreditExhausted:!1,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1};function na(t){const{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=t;if(!o&&n&&ea(n))return{...ta,isCreditExhausted:!0};const l=e.at(-1),c=l?.role==="assistant"?l.parts:[],i=c,V=!!i.filter(v=>v.type==="tool-user_ask").filter(v=>v.state!=="output-available").length,d=os(c),m=rs(i),f=ss(e),x=!o&&!!n,h=m.length>0||o&&a,p=d.length>0,g=!o&&!!r&&r!=="stop"&&!(r==="tool-calls"&&(V||h||p))&&!x;return{isCreditExhausted:!1,hasTodos:f.length>0,showError:x,showWarning:g,hasApprovals:h,hasPlans:p,isWaitingForUserInput:V}}function as(){const t=L.c(6),{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=Be(),l=n??null,c=r??null;let i;return t[0]!==o||t[1]!==a||t[2]!==e||t[3]!==l||t[4]!==c?(i=na({messages:e,error:l,finishReason:c,isStreaming:o,isWaitingForApprovals:a}),t[0]=o,t[1]=a,t[2]=e,t[3]=l,t[4]=c,t[5]=i):i=t[5],i}function sa(){const t=as();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function ls(t){return!t||!t.content||t.content.length===0?!0:t.content.every(e=>e.type==="paragraph"?!e.content||e.content.length===0?!0:e.content.every(n=>n.type==="hardBreak"||n.type==="text"&&(!n.text||n.text.trim()==="")):!1)}const ra="__home__";function Kt(t,e){return zs.chatDraft(t,e)}function oa(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object"||typeof e.updatedAt!="number")return null;const n=e.tiptapDoc;return!n||typeof n!="object"||n.type!=="doc"||!Array.isArray(n.content)?null:n}function aa(t,e,n,r,o){const a=Kt(e,n);if(ls(r)){t.removeItem(a);return}const l={tiptapDoc:r,updatedAt:Date.now()},c=JSON.stringify(l);try{t.setItem(a,c)}catch(i){if(ia(i)){const u=new TextEncoder().encode(c).byteLength;o?.onQuotaExceeded?.({docSizeBytes:u});return}throw i}}function an(t,e,n){const r=Kt(e,n),o=t.getItem(r),a=oa(o);return o!==null&&a===null&&t.removeItem(r),a}function la(t,e,n){t.removeItem(Kt(e,n))}function ia(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function ca(t){const e=L.c(21),{current:n,total:r,onPrev:o,onNext:a}=t;if(r<=1)return null;const l=n===0,c=n===0?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let i;e[0]!==c?(i=B("p-0.5 rounded transition-colors",c),e[0]=c,e[1]=i):i=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(no,{size:14}),e[2]=u):u=e[2];let V;e[3]!==o||e[4]!==l||e[5]!==i?(V=s.jsx("button",{type:"button",onClick:o,disabled:l,className:i,"aria-label":"Previous question",children:u}),e[3]=o,e[4]=l,e[5]=i,e[6]=V):V=e[6];const d=n+1;let m;e[7]!==d||e[8]!==r?(m=s.jsxs("span",{className:"tabular-nums text-xs",children:[d," of ",r]}),e[7]=d,e[8]=r,e[9]=m):m=e[9];const f=n===r-1,x=n===r-1?"opacity-30 cursor-not-allowed":"hover:text-foreground cursor-pointer";let h;e[10]!==x?(h=B("p-0.5 rounded transition-colors",x),e[10]=x,e[11]=h):h=e[11];let p;e[12]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(Qn,{size:14}),e[12]=p):p=e[12];let b;e[13]!==a||e[14]!==h||e[15]!==f?(b=s.jsx("button",{type:"button",onClick:a,disabled:f,className:h,"aria-label":"Next question",children:p}),e[13]=a,e[14]=h,e[15]=f,e[16]=b):b=e[16];let g;return e[17]!==b||e[18]!==V||e[19]!==m?(g=s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[V,m,b]}),e[17]=b,e[18]=V,e[19]=m,e[20]=g):g=e[20],g}function is(t){const e=L.c(8),{currentIndex:n,total:r,onPrev:o,onNext:a,extraLeft:l}=t;let c;e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r?(c=s.jsx(ca,{current:n,total:r,onPrev:o,onNext:a}),e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=c):c=e[4];let i;return e[5]!==l||e[6]!==c?(i=s.jsxs("div",{className:"flex items-center gap-2",children:[c,l]}),e[5]=l,e[6]=c,e[7]=i):i=e[7],i}function da(t){const e=L.c(17),{isStreaming:n,isAllAnswered:r,isCurrentAnswered:o,onAdvanceOrSubmit:a,submitLabel:l,nextLabel:c}=t,V=r?l===void 0?"Submit":l:c===void 0?"Next":c,d=r?n:!o,m=d?r?"Waiting for the assistant to finish…":"Answer this item to continue":null;let f;e[0]!==d||e[1]!==a?(f=()=>{d||a()},e[0]=d,e[1]=a,e[2]=f):f=e[2];const x=d&&"opacity-50 cursor-not-allowed";let h;e[3]!==x?(h=B("h-7 px-2.5 text-xs",x),e[3]=x,e[4]=h):h=e[4];let p;e[5]!==d||e[6]!==V||e[7]!==f||e[8]!==h?(p=s.jsx(se,{type:"button",size:"sm","aria-disabled":d,onClick:f,className:h,children:V}),e[5]=d,e[6]=V,e[7]=f,e[8]=h,e[9]=p):p=e[9];const b=p;if(!m)return b;let g;e[10]!==b?(g=s.jsx(xe,{asChild:!0,children:b}),e[10]=b,e[11]=g):g=e[11];let v;e[12]!==m?(v=s.jsx(ge,{children:m}),e[12]=m,e[13]=v):v=e[13];let y;return e[14]!==g||e[15]!==v?(y=s.jsxs(be,{children:[g,v]}),e[14]=g,e[15]=v,e[16]=y):y=e[16],y}function cs(t,e,n){return t.findIndex(r=>e(r)===n)}function ln(t,e,n,r){return t.length===0?!1:t.every(o=>r(n[e(o)]))}function cn(t,e,n,r,o){if(t.length===0)return null;const a=cs(t,e,o);for(let l=1;l<=t.length;l++){const c=t[(a+l)%t.length];if(!c)continue;const i=e(c);if(i!==o&&!r(n[i]))return i}return null}function Va(t){return!t.isStreaming&&t.allAnswered}function ds(t){const{parts:e,partKey:n,schema:r,defaultValues:o,isStreaming:a,hasAnswer:l,onSubmit:c}=t,i=e[0]?n(e[0]):"",[u,V]=S.useState(i),[d,m]=S.useState(!1),f=Bs({resolver:Us(r),defaultValues:o}),x=f.watch(),h=cs(e,n,u),p=h>=0?e[h]:void 0,b=l(x[u]),g=ln(e,n,x,l),v=Va({isStreaming:a,allAnswered:g}),y=()=>{if(h>0){const N=e[h-1];N&&V(n(N))}},w=()=>{if(h>=0&&h<e.length-1){const N=e[h+1];N&&V(n(N))}},A=()=>{const N=f.getValues(),T=cn(e,n,N,l,u);T&&V(T)},k=()=>{f.handleSubmit(N=>{const T=N;for(const E of e)c(E,T[n(E)])})()},j=S.useRef(k);j.current=k;const C=()=>{v&&(m(!1),j.current())},P=()=>{const N=f.getValues();if(ln(e,n,N,l)){if(a){m(!0);return}m(!1),j.current()}else{const T=cn(e,n,N,l,u);T&&V(T)}};return S.useEffect(()=>{if(d&&!a){if(!g){m(!1);return}m(!1),j.current()}},[d,a,g]),{form:f,activeKey:u,setActiveKey:V,currentIndex:h,currentPart:p,isCurrentAnswered:b,isAllAnswered:g,canSubmit:v,goPrev:y,goNext:w,advanceToNextUnanswered:A,submit:C,submitOrAdvance:P}}const Vs="User denied this tool call, give other alternatives.";function us(t){const e=L.c(9),{onYolo:n}=t,[r,o]=Ee();let a;e[0]!==n||e[1]!==r||e[2]!==o?(a=V=>{const d=V;o({...r,toolApprovalLevel:d}),d==="auto"&&n(d)},e[0]=n,e[1]=r,e[2]=o,e[3]=a):a=e[3];const l=a;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(eo,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:fa,children:s.jsx(to,{})}),e[4]=c):c=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Jr,{children:Pe.map(ua)}),e[5]=i):i=e[5];let u;return e[6]!==l||e[7]!==r.toolApprovalLevel?(u=s.jsxs(Zr,{value:r.toolApprovalLevel,onValueChange:l,children:[c,i]}),e[6]=l,e[7]=r.toolApprovalLevel,e[8]=u):u=e[8],u}function ua(t){return s.jsx(Xr,{value:t.value,children:t.label},t.value)}function fa(t){return t.stopPropagation()}function fs(t){const e=L.c(5),{input:n}=t;if(n==null){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("div",{className:"px-4 text-xs text-muted-foreground",children:"No input"}),e[0]=a):a=e[0],a}let r;try{let a;e[1]!==n?(a=JSON.stringify(n,null,2),e[1]=n,e[2]=a):a=e[2],r=a}catch{r=String(n)}let o;return e[3]!==r?(o=s.jsx("div",{className:"px-4",children:s.jsx("pre",{className:"text-xs font-mono text-muted-foreground/70 whitespace-pre-wrap wrap-break-word max-h-32 overflow-y-auto rounded-md bg-muted/30 px-3 py-2",children:r})}),e[3]=r,e[4]=o):o=e[4],o}function ma(t){const e=L.c(28),{approval:n,onRespond:r}=t,[o]=Ee(),a=o.toolApprovalLevel??"readonly";let l;e[0]!==n.approvalId||e[1]!==a||e[2]!==r?(l=()=>r(n.approvalId,!1,Vs,a),e[0]=n.approvalId,e[1]=a,e[2]=r,e[3]=l):l=e[3];const c=l;let i;e[4]!==n.approvalId||e[5]!==a||e[6]!==r?(i=()=>r(n.approvalId,!0,void 0,a),e[4]=n.approvalId,e[5]=a,e[6]=r,e[7]=i):i=e[7];const u=i;let V;e[8]!==n.approvalId||e[9]!==r?(V=w=>r(n.approvalId,!0,void 0,w),e[8]=n.approvalId,e[9]=r,e[10]=V):V=e[10];const d=V;let m;e[11]!==d?(m=s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(us,{onYolo:d})}),e[11]=d,e[12]=m):m=e[12];const f=m;let x;e[13]!==c?(x=s.jsx(se,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:c,children:"Deny"}),e[13]=c,e[14]=x):x=e[14];let h;e[15]!==u?(h=s.jsx(se,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs active:scale-[0.97] transition-transform",onClick:u,children:"Accept"}),e[15]=u,e[16]=h):h=e[16];let p;e[17]!==x||e[18]!==h?(p=s.jsxs(s.Fragment,{children:[x,h]}),e[17]=x,e[18]=h,e[19]=p):p=e[19];const b=p;let g;e[20]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(ft,{size:14}),e[20]=g):g=e[20];let v;e[21]!==n.input?(v=s.jsx(fs,{input:n.input}),e[21]=n.input,e[22]=v):v=e[22];let y;return e[23]!==n.friendlyName||e[24]!==f||e[25]!==b||e[26]!==v?(y=s.jsx(pe,{icon:g,label:"Approval needed",title:n.friendlyName,defaultExpanded:!0,footerLeft:f,footerRight:b,children:v}),e[23]=n.friendlyName,e[24]=f,e[25]=b,e[26]=v,e[27]=y):y=e[27],y}const pa=Ks(_e(),he({approved:qs().optional(),levelOverride:Tt(["auto","readonly"]).optional()}));function ha(t){const e=L.c(42),{approvals:n,isStreaming:r,onRespond:o}=t,[a]=Ee(),l=a.toolApprovalLevel??"readonly";let c;e[0]!==n?(c=Object.fromEntries(n.map(ba)),e[0]=n,e[1]=c):c=e[1];const i=c;let u;e[2]!==l||e[3]!==o?(u=(P,N)=>{const T=N;typeof T?.approved=="boolean"&&o(P.approvalId,T.approved,T.approved===!1?Vs:void 0,T.levelOverride??l)},e[2]=l,e[3]=o,e[4]=u):u=e[4];let V;e[5]!==n||e[6]!==i||e[7]!==r||e[8]!==u?(V={parts:n,partKey:ga,schema:pa,defaultValues:i,isStreaming:r,hasAnswer:xa,onSubmit:u},e[5]=n,e[6]=i,e[7]=r,e[8]=u,e[9]=V):V=e[9];const d=ds(V);let m;e[10]!==n||e[11]!==d?(m=P=>{d.form.reset(Object.fromEntries(n.map(N=>[N.approvalId,{approved:!0,levelOverride:P}]))),d.submitOrAdvance()},e[10]=n,e[11]=d,e[12]=m):m=e[12];const f=m,x=d.currentPart;let h;e[13]!==d?(h=P=>{P.preventDefault(),d.submit()},e[13]=d,e[14]=h):h=e[14];let p;e[15]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(ft,{size:14}),e[15]=p):p=e[15];const b=`${n.length} approvals pending`,g=x?.friendlyName??"";let v;e[16]!==f?(v=s.jsx(us,{onYolo:f}),e[16]=f,e[17]=v):v=e[17];let y;e[18]!==n.length||e[19]!==d.currentIndex||e[20]!==d.goNext||e[21]!==d.goPrev||e[22]!==v?(y=s.jsx(is,{currentIndex:d.currentIndex,total:n.length,onPrev:d.goPrev,onNext:d.goNext,extraLeft:v}),e[18]=n.length,e[19]=d.currentIndex,e[20]=d.goNext,e[21]=d.goPrev,e[22]=v,e[23]=y):y=e[23];let w;e[24]!==x||e[25]!==d.form.control||e[26]!==d.submitOrAdvance?(w=x?s.jsx(va,{approvalId:x.approvalId,control:d.form.control,onChange:d.submitOrAdvance}):null,e[24]=x,e[25]=d.form.control,e[26]=d.submitOrAdvance,e[27]=w):w=e[27];let A;e[28]!==x?(A=x?s.jsx(fs,{input:x.input}):null,e[28]=x,e[29]=A):A=e[29];let k;e[30]!==y||e[31]!==w||e[32]!==A||e[33]!==b||e[34]!==g?(k=s.jsx(pe,{icon:p,label:b,title:g,defaultExpanded:!0,footerLeft:y,footerRight:w,children:A}),e[30]=y,e[31]=w,e[32]=A,e[33]=b,e[34]=g,e[35]=k):k=e[35];let j;e[36]!==k||e[37]!==h?(j=s.jsx("form",{onSubmit:h,children:k}),e[36]=k,e[37]=h,e[38]=j):j=e[38];let C;return e[39]!==d.form||e[40]!==j?(C=s.jsx(Nt,{...d.form,children:j}),e[39]=d.form,e[40]=j,e[41]=C):C=e[41],C}function xa(t){return typeof t?.approved=="boolean"}function ga(t){return t.approvalId}function ba(t){return[t.approvalId,{approved:void 0}]}function va(t){const e=L.c(6),{approvalId:n,control:r,onChange:o}=t,a=`${n}.approved`;let l;e[0]!==o?(l=i=>{const{field:u}=i,V=u.value===!0,d=u.value===!1;return s.jsxs(s.Fragment,{children:[s.jsx(se,{type:"button",variant:d?"secondary":"ghost",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!1),o()},"aria-pressed":d,children:"Deny"}),s.jsx(se,{type:"button",variant:V?"default":"outline",size:"sm",className:"h-7 px-2.5 text-xs",onClick:()=>{u.onChange(!0),o()},"aria-pressed":V,children:"Accept"})]})},e[0]=o,e[1]=l):l=e[1];let c;return e[2]!==r||e[3]!==a||e[4]!==l?(c=s.jsx(Qs,{control:r,name:a,render:l}),e[2]=r,e[3]=a,e[4]=l,e[5]=c):c=e[5],c}function ya(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(ft,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing approval request..."})]}),t[0]=e):e=t[0],e}function Aa(t){const e=L.c(8),{approvals:n,isStreaming:r,onRespond:o}=t;if(r&&n.length===0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(ya,{}),e[0]=l):l=e[0],l}if(n.length===0)return null;if(n.length===1){const l=n[0];if(!l)return null;let c;return e[1]!==o||e[2]!==l?(c=s.jsx(ma,{approval:l,onRespond:o}),e[1]=o,e[2]=l,e[3]=c):c=e[3],c}let a;return e[4]!==n||e[5]!==r||e[6]!==o?(a=s.jsx(ha,{approvals:n,isStreaming:r,onRespond:o}),e[4]=n,e[5]=r,e[6]=o,e[7]=a):a=e[7],a}function wa(t){const e=L.c(16),{plan:n,onApprove:r,onDismiss:o}=t;let a;e[0]!==r||e[1]!==n.plan?(a=()=>{r(n.plan)},e[0]=r,e[1]=n.plan,e[2]=a):a=e[2];const l=a;let c;e[3]!==o?(c=s.jsx(se,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs text-muted-foreground [@media(hover:hover)]:hover:text-foreground active:scale-[0.97] transition-transform",onClick:o,children:"Keep iterating"}),e[3]=o,e[4]=c):c=e[4];let i;e[5]!==l?(i=s.jsx(se,{type:"button",size:"sm",className:"h-7 px-2.5 text-xs bg-purple-600 hover:bg-purple-700 text-white active:scale-[0.97] transition-transform",onClick:l,children:"Let's go"}),e[5]=l,e[6]=i):i=e[6];let u;e[7]!==c||e[8]!==i?(u=s.jsxs(s.Fragment,{children:[c,i]}),e[7]=c,e[8]=i,e[9]=u):u=e[9];const V=u;let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Br,{size:14}),e[10]=d):d=e[10];let m;e[11]!==n.plan?(m=s.jsx("div",{className:"px-4 max-h-64 overflow-y-auto",children:s.jsx("div",{className:"prose prose-sm max-w-none text-sm",children:s.jsx(Vr,{id:"plan-preview",part:{type:"text",text:n.plan}})})}),e[11]=n.plan,e[12]=m):m=e[12];let f;return e[13]!==V||e[14]!==m?(f=s.jsx(pe,{icon:d,label:"Plan ready",title:"Implementation Plan",defaultExpanded:!0,footerRight:V,children:m}),e[13]=V,e[14]=m,e[15]=f):f=e[15],f}function ja(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed border-purple-500/30 rounded-lg bg-purple-500/5 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(Ue,{className:"size-5 text-purple-500 shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing plan..."})]}),t[0]=e):e=t[0],e}function Sa(t){const e=L.c(7),{plans:n,isStreaming:r,onApprove:o,onDismiss:a}=t;if(r&&n.length===0){let u;return e[0]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(ja,{}),e[0]=u):u=e[0],u}let l;e[1]!==n?(l=n.at(-1),e[1]=n,e[2]=l):l=e[2];const c=l;if(!c)return null;let i;return e[3]!==c||e[4]!==o||e[5]!==a?(i=s.jsx(wa,{plan:c,onApprove:o,onDismiss:a}),e[3]=c,e[4]=o,e[5]=a,e[6]=i):i=e[6],i}function ms(t){return t?"response"in t?t.response:t.option??t.draft:""}const dn=he({response:_e().min(1,"Response is required")}),Ca=he({option:_e().nullable(),draft:_e()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),Na=he({response:Tt(["yes","no"])});function ka(t){switch(t.type){case"text":return dn;case"choice":return Ca;case"confirm":return Na;default:return dn}}function _a(t){const e={};for(const n of t)e[n.toolCallId]=ka(n.input);return he(e)}function Ia(t){const e=L.c(6),{control:n,name:r,placeholder:o}=t;let a;e[0]!==o?(a=c=>{const{field:i}=c,u=i.value??"";return s.jsxs(Ft,{children:[s.jsx(Ot,{children:s.jsx("div",{className:"px-2",children:s.jsxs("div",{className:"flex items-center gap-3 px-2 py-3 rounded-lg bg-accent/50",children:[s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(zn,{size:16,className:"text-muted-foreground"})}),s.jsx("input",{...i,value:u,type:"text",placeholder:o||"Type your response...",autoFocus:!0,"aria-label":"Text response input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"})]})})}),s.jsx(Lt,{})]})},e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==n||e[3]!==r||e[4]!==a?(l=s.jsx(qn,{control:n,name:r,render:a}),e[2]=n,e[3]=r,e[4]=a,e[5]=l):l=e[5],l}function ps(t,e){const n=L.c(4);let r,o;n[0]!==t||n[1]!==e?(r=()=>{const a=l=>{const c=l.target.tagName;if(c==="INPUT"||c==="TEXTAREA"||l.metaKey||l.ctrlKey||l.altKey)return;const i=Number.parseInt(l.key,10);i>=1&&i<=t&&(l.preventDefault(),e(i-1))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},o=[t,e],n[0]=t,n[1]=e,n[2]=r,n[3]=o):(r=n[2],o=n[3]),S.useEffect(r,o)}function Ea(t){const e=L.c(40),{control:n,name:r,options:o}=t,a=`${r}.option`;let l;e[0]!==n||e[1]!==a?(l={control:n,name:a,defaultValue:null},e[0]=n,e[1]=a,e[2]=l):l=e[2];const{field:c}=Gt(l),i=`${r}.draft`;let u;e[3]!==n||e[4]!==i?(u={control:n,name:i,defaultValue:""},e[3]=n,e[4]=i,e[5]=u):u=e[5];const{field:V}=Gt(u),d=c.value,m=V.value??"";let f;if(e[6]!==c||e[7]!==o?(f=T=>{const E=o[T];E!=null&&c.onChange(E)},e[6]=c,e[7]=o,e[8]=f):f=e[8],ps(o.length,f),o.length===0)return null;const x=d===null;let h;if(e[9]!==c||e[10]!==d||e[11]!==o){let T;e[13]!==c||e[14]!==d?(T=(E,_)=>{const R=d===E;return s.jsxs("button",{type:"button",onClick:()=>c.onChange(E),className:B("flex items-center gap-3 px-2 py-3 rounded-lg text-left transition-colors w-full",R&&"bg-accent/50",!R&&"hover:bg-accent/30"),"aria-label":`Select ${E}`,children:[s.jsx("span",{className:B("flex items-center justify-center size-6 rounded-md text-sm shrink-0",R?"bg-chart-1 text-white":"bg-muted text-foreground"),children:_+1}),s.jsx("span",{className:"text-sm text-foreground truncate",children:E})]},`${_}-${E}`)},e[13]=c,e[14]=d,e[15]=T):T=e[15],h=o.map(T),e[9]=c,e[10]=d,e[11]=o,e[12]=h}else h=e[12];const p=x&&"bg-accent/50",b=!x&&"hover:bg-accent/30";let g;e[16]!==p||e[17]!==b?(g=B("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",p,b),e[16]=p,e[17]=b,e[18]=g):g=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(zn,{size:16,className:"text-muted-foreground"})}),e[19]=v):v=e[19];const y=x?m:"";let w;e[20]!==V||e[21]!==c||e[22]!==d?(w=T=>{V.onChange(T.target.value),d!==null&&c.onChange(null)},e[20]=V,e[21]=c,e[22]=d,e[23]=w):w=e[23];let A;e[24]!==c||e[25]!==d?(A=()=>{d!==null&&c.onChange(null)},e[24]=c,e[25]=d,e[26]=A):A=e[26];let k;e[27]!==y||e[28]!==w||e[29]!==A?(k=s.jsx("input",{type:"text",value:y,onChange:w,onFocus:A,placeholder:"Something else...","aria-label":"Custom choice input",className:"flex-1 text-sm bg-transparent outline-none placeholder:text-foreground/25 text-foreground min-w-0"}),e[27]=y,e[28]=w,e[29]=A,e[30]=k):k=e[30];let j;e[31]!==k||e[32]!==g?(j=s.jsxs("label",{className:g,children:[v,k]}),e[31]=k,e[32]=g,e[33]=j):j=e[33];let C;e[34]!==j||e[35]!==h?(C=s.jsx(Ot,{children:s.jsxs("div",{className:"flex flex-col px-2",role:"group","aria-label":"Choice options",children:[h,j]})}),e[34]=j,e[35]=h,e[36]=C):C=e[36];let P;e[37]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx(Lt,{}),e[37]=P):P=e[37];let N;return e[38]!==C?(N=s.jsxs(Ft,{children:[C,P]}),e[38]=C,e[39]=N):N=e[39],N}function Ra(t){const e=L.c(6),{control:n,name:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["yes","no"],e[0]=o):o=e[0];const a=o,l=S.useRef(null);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=V=>{l.current?.onChange(a[V]??"")},e[1]=c):c=e[1],ps(a.length,c);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=V=>{const{field:d}=V;return l.current=d,s.jsxs(Ft,{children:[s.jsx(Ot,{children:s.jsx("div",{className:"flex gap-2 px-2",role:"group","aria-label":"Confirmation options",children:a.map(m=>{const f=d.value===m;return s.jsxs("button",{type:"button",onClick:()=>d.onChange(m),className:B("flex items-center gap-3 px-4 py-3 rounded-lg text-left transition-colors flex-1",f&&"bg-accent/50",!f&&"hover:bg-accent/30"),"aria-label":`Confirm ${m}`,children:[s.jsx("span",{className:B("flex items-center justify-center size-6 rounded-md text-sm shrink-0",f?"bg-chart-1 text-white":"bg-muted text-foreground"),children:m==="yes"?1:2}),s.jsx("span",{className:"text-sm text-foreground capitalize",children:m})]},m)})})}),s.jsx(Lt,{})]})},e[2]=i):i=e[2];let u;return e[3]!==n||e[4]!==r?(u=s.jsx(qn,{control:n,name:r,render:i}),e[3]=n,e[4]=r,e[5]=u):u=e[5],u}function Vn(t){const e=L.c(13),{input:n,control:r,toolCallId:o}=t;switch(n.type){case"text":{const a=`${o}.response`;let l;return e[0]!==r||e[1]!==n.default||e[2]!==a?(l=s.jsx(Ia,{control:r,name:a,placeholder:n.default}),e[0]=r,e[1]=n.default,e[2]=a,e[3]=l):l=e[3],l}case"choice":{let a;e[4]!==n.options?(a=n.options?.filter(Boolean)??[],e[4]=n.options,e[5]=a):a=e[5];const l=a;let c;return e[6]!==r||e[7]!==l||e[8]!==o?(c=s.jsx(Ea,{control:r,name:o,options:l}),e[6]=r,e[7]=l,e[8]=o,e[9]=c):c=e[9],c}case"confirm":{const a=`${o}.response`;let l;return e[10]!==r||e[11]!==a?(l=s.jsx(Ra,{control:r,name:a}),e[10]=r,e[11]=a,e[12]=l):l=e[12],l}default:return null}}function Ta(t){const e=L.c(71),{parts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=_a(n.map(Fa)),e[0]=n,e[1]=a):a=e[1];const l=a;let c;e[2]!==n?(c=Object.fromEntries(n.map(Ma)),e[2]=n,e[3]=c):c=e[3];const i=c;let u;e[4]!==o?(u=(D,I)=>{const F=ms(I);F&&o(D,F)},e[4]=o,e[5]=u):u=e[5];let V;e[6]!==i||e[7]!==r||e[8]!==n||e[9]!==l||e[10]!==u?(V={parts:n,partKey:Da,schema:l,defaultValues:i,isStreaming:r,hasAnswer:Pa,onSubmit:u},e[6]=i,e[7]=r,e[8]=n,e[9]=l,e[10]=u,e[11]=V):V=e[11];const d=ds(V),m=d.currentPart;let f;e[12]!==m||e[13]!==d?(f=()=>{const D=m;if(!D)return;const I=D.toolCallId;D.input?.type==="choice"?(d.form.setValue(`${I}.option`,null),d.form.setValue(`${I}.draft`,"user has skip this question")):d.form.setValue(`${I}.response`,"user has skip this question"),d.advanceToNextUnanswered()},e[12]=m,e[13]=d,e[14]=f):f=e[14];const x=f;let h;e[15]!==d.currentIndex||e[16]!==d.goNext||e[17]!==d.goPrev||e[18]!==n.length?(h=s.jsx(is,{currentIndex:d.currentIndex,total:n.length,onPrev:d.goPrev,onNext:d.goNext}),e[15]=d.currentIndex,e[16]=d.goNext,e[17]=d.goPrev,e[18]=n.length,e[19]=h):h=e[19];const p=h;let b;e[20]!==x?(b=s.jsx(se,{type:"button",variant:"outline",size:"sm",onClick:x,className:"h-7",children:"Skip"}),e[20]=x,e[21]=b):b=e[21];let g;e[22]!==d.isAllAnswered||e[23]!==d.isCurrentAnswered||e[24]!==d.submitOrAdvance||e[25]!==r?(g=s.jsx(da,{isStreaming:r,isAllAnswered:d.isAllAnswered,isCurrentAnswered:d.isCurrentAnswered,onAdvanceOrSubmit:d.submitOrAdvance}),e[22]=d.isAllAnswered,e[23]=d.isCurrentAnswered,e[24]=d.submitOrAdvance,e[25]=r,e[26]=g):g=e[26];let v;e[27]!==b||e[28]!==g?(v=s.jsxs(s.Fragment,{children:[b,g]}),e[27]=b,e[28]=g,e[29]=v):v=e[29];const y=v;if(n.length===1){const D=n[0];if(!D?.input)return null;let I;e[30]!==d?(I=q=>{q.preventDefault(),d.submit()},e[30]=d,e[31]=I):I=e[31];let F;e[32]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(kt,{size:14}),e[32]=F):F=e[32];const $=D.input?.prompt??"Question",z=D.input;let K;e[33]!==d.form.control||e[34]!==D.toolCallId||e[35]!==z?(K=s.jsx(Vn,{input:z,control:d.form.control,toolCallId:D.toolCallId}),e[33]=d.form.control,e[34]=D.toolCallId,e[35]=z,e[36]=K):K=e[36];let M;e[37]!==y||e[38]!==$||e[39]!==K?(M=s.jsx(pe,{icon:F,label:"Question pending",title:$,defaultExpanded:!0,footerRight:y,children:K}),e[37]=y,e[38]=$,e[39]=K,e[40]=M):M=e[40];let U;e[41]!==I||e[42]!==M?(U=s.jsx("form",{onSubmit:I,autoComplete:"off",children:M}),e[41]=I,e[42]=M,e[43]=U):U=e[43];let Q;return e[44]!==d.form||e[45]!==U?(Q=s.jsx(Nt,{...d.form,children:U}),e[44]=d.form,e[45]=U,e[46]=Q):Q=e[46],Q}const w=d.form;let A;e[47]!==d?(A=D=>{D.preventDefault(),d.submit()},e[47]=d,e[48]=A):A=e[48];let k;e[49]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(kt,{size:14}),e[49]=k):k=e[49];const j=`${d.currentIndex+1} of ${n.length}`,C=m?.input?.prompt??"Question",P=d.activeKey,N=d.setActiveKey;let T;if(e[50]!==d.form||e[51]!==n){let D;e[53]!==d.form?(D=I=>s.jsx(ro,{value:I.toolCallId,className:"mt-0",children:s.jsx(Vn,{input:I.input,control:d.form.control,toolCallId:I.toolCallId})},I.toolCallId),e[53]=d.form,e[54]=D):D=e[54],T=n.map(D),e[50]=d.form,e[51]=n,e[52]=T}else T=e[52];let E;e[55]!==d.activeKey||e[56]!==d.setActiveKey||e[57]!==T?(E=s.jsx(oo,{value:P,onValueChange:N,children:T}),e[55]=d.activeKey,e[56]=d.setActiveKey,e[57]=T,e[58]=E):E=e[58];let _;e[59]!==p||e[60]!==y||e[61]!==j||e[62]!==C||e[63]!==E?(_=s.jsx(pe,{icon:k,label:"Question pending",count:j,title:C,defaultExpanded:!0,footerLeft:p,footerRight:y,children:E}),e[59]=p,e[60]=y,e[61]=j,e[62]=C,e[63]=E,e[64]=_):_=e[64];let R;e[65]!==A||e[66]!==_?(R=s.jsx("form",{onSubmit:A,autoComplete:"off",children:_}),e[65]=A,e[66]=_,e[67]=R):R=e[67];let O;return e[68]!==d.form||e[69]!==R?(O=s.jsx(Nt,{...w,children:R}),e[68]=d.form,e[69]=R,e[70]=O):O=e[70],O}function Pa(t){return!!ms(t)}function Da(t){return t.toolCallId}function Ma(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function Fa(t){return{toolCallId:t.toolCallId,input:t.input}}function Oa(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"flex items-center gap-2 p-4 border border-dashed rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(kt,{className:"size-5 text-muted-foreground shimmer"}),s.jsx("span",{className:"text-sm text-muted-foreground shimmer",children:"Preparing question..."})]}),t[0]=e):e=t[0],e}function hs(t){const e=L.c(7),{userAskParts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=n.filter(La),e[0]=n,e[1]=a):a=e[1];const l=a;if(l.length===0){if(r){let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Oa,{}),e[2]=i):i=e[2],i}return null}let c;return e[3]!==r||e[4]!==o||e[5]!==l?(c=s.jsx(Ta,{parts:l,isStreaming:r,onSubmit:o}),e[3]=r,e[4]=o,e[5]=l,e[6]=c):c=e[6],c}function La(t){return t.state==="input-available"}function $a(t){const e=t.filter(a=>a.status==="in_progress"),n=t.filter(a=>a.status==="completed").length,r=t.length;if(r>0&&n===r)return{icon:"completed",activity:"All done",progress:`${r}/${r}`};const[o]=e;return o&&e.length===1?{icon:"in_progress",activity:o.activeForm,progress:`${n}/${r} done`}:e.length>1?{icon:"in_progress",activity:`${e.length} in progress`,progress:`${n}/${r} done`}:n>0?{icon:"pending",activity:`${r-n} pending`,progress:`${n}/${r} done`}:{icon:"pending",activity:`${r} todos`,progress:"not started"}}function za(){const t=L.c(21),{messages:e}=Be();let n,r,o,a,l,c,i,u,V;if(t[0]!==e){V=Symbol.for("react.early_return_sentinel");e:{const f=ss(e);if(f.length===0){V=null;break e}const x=$a(f);n=pe,l=s.jsx(qa,{status:x.icon}),c=x.activity,i=x.progress,u=!1,r="todos-list",o="flex flex-col px-2 max-h-[40vh] overflow-y-auto",a=f.map(Ba)}t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=a,t[5]=l,t[6]=c,t[7]=i,t[8]=u,t[9]=V}else n=t[1],r=t[2],o=t[3],a=t[4],l=t[5],c=t[6],i=t[7],u=t[8],V=t[9];if(V!==Symbol.for("react.early_return_sentinel"))return V;let d;t[10]!==r||t[11]!==o||t[12]!==a?(d=s.jsx("ul",{"data-testid":r,className:o,children:a}),t[10]=r,t[11]=o,t[12]=a,t[13]=d):d=t[13];let m;return t[14]!==n||t[15]!==l||t[16]!==c||t[17]!==i||t[18]!==u||t[19]!==d?(m=s.jsx(n,{icon:l,label:c,count:i,defaultExpanded:u,children:d}),t[14]=n,t[15]=l,t[16]=c,t[17]=i,t[18]=u,t[19]=d,t[20]=m):m=t[20],m}function Ba(t,e){return s.jsx(Ua,{todo:t},e)}function Ua(t){const e=L.c(14),{todo:n}=t,r=n.status==="completed",a=n.status==="in_progress"?n.activeForm:n.content;let l;e[0]!==n.status?(l=s.jsx(Ka,{status:n.status}),e[0]=n.status,e[1]=l):l=e[1];const c=r&&"text-muted-foreground";let i;e[2]!==c?(i=B("relative text-sm leading-snug pt-px select-none",c),e[2]=c,e[3]=i):i=e[3];const u=r?"100%":"0%",V=r?"width 300ms ease 200ms":"width 150ms ease";let d;e[4]!==u||e[5]!==V?(d=s.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",height:"1px",background:"currentColor",width:u,transition:V}}),e[4]=u,e[5]=V,e[6]=d):d=e[6];let m;e[7]!==a||e[8]!==i||e[9]!==d?(m=s.jsxs("span",{className:i,children:[a,d]}),e[7]=a,e[8]=i,e[9]=d,e[10]=m):m=e[10];let f;return e[11]!==l||e[12]!==m?(f=s.jsxs("li",{className:"flex items-start gap-2.5 px-2 py-1.5 rounded-lg hover:bg-accent/50 transition-colors",children:[l,m]}),e[11]=l,e[12]=m,e[13]=f):f=e[13],f}function Ka(t){const e=L.c(4),{status:n}=t,r=n==="completed"?"true":void 0,o=n==="in_progress"?"true":void 0;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("svg",{viewBox:"0 0 21 21",children:s.jsx("path",{d:"M5,10.75 L8.5,14.25 L19.4,2.3 C18.8333333,1.43333333 18.0333333,1 17,1 L4,1 C2.35,1 1,2.35 1,4 L1,17 C1,18.65 2.35,20 4,20 L17,20 C18.65,20 20,18.65 20,17 L20,7.99769186"})}),e[0]=a):a=e[0];let l;return e[1]!==r||e[2]!==o?(l=s.jsx("div",{className:"todo-cb mt-0.5","data-checked":r,"data-progress":o,"aria-hidden":"true",children:a}),e[1]=r,e[2]=o,e[3]=l):l=e[3],l}function qa(t){const e=L.c(3),{status:n}=t;if(n==="completed"){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"completed",className:"inline-flex items-center justify-center w-3.5 h-3.5 rounded-sm bg-primary",children:s.jsx("svg",{viewBox:"0 0 10 8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",className:"w-2 h-2 text-primary-foreground",style:{strokeWidth:2},children:s.jsx("path",{d:"M1 4l2.5 2.5L9 1"})})}),e[0]=o):o=e[0],o}if(n==="in_progress"){let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("span",{"aria-label":"in progress",className:"inline-block w-2 h-2 rounded-full bg-primary animate-pulse shrink-0"}),e[1]=o):o=e[1],o}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("span",{"aria-label":"pending",className:"inline-block w-3.5 h-3.5 rounded-sm border-[1.5px] border-muted-foreground/50 shrink-0"}),e[2]=r):r=e[2],r}const un=new Map;function xs(){const{org:t}=ie(),e=de({connectionId:dt,orgId:t.id,orgSlug:t.slug}),n=ao(),r=n.find(p=>p.providerId==="deco"),{data:o,isLoading:a,refetch:l,isFetching:c}=En({queryKey:Ie.aiProviderCredits(t.id,"deco"),enabled:!!r,staleTime:6e4,queryFn:async()=>{const p=await e.callTool({name:"AI_PROVIDER_CREDITS",arguments:{providerId:"deco"}});return p?.isError?null:p.structuredContent??null}}),i=o?.balanceCents??null,u=i!=null?i/100:null,V=S.useRef(new Map);if(i!=null){const p=un.get(t.id);V.current.get(t.id)&&p!=null&&i>p&&W("credits_topped_up_detected",{organization_id:t.id,delta_cents:i-p,previous_balance_cents:p,new_balance_cents:i}),un.set(t.id,i),V.current.set(t.id,!0)}const d=!!r,m=i!=null&&i>0,f=i!=null&&i===0,x=i!=null&&i===200,h=n.length>0&&n.every(p=>p.providerId==="deco");return{hasDecoKey:d,decoKeyId:r?.id??null,balanceCents:i,balanceDollars:u,hasCredits:m,isZeroBalance:f,isInitialFreeCredit:x,hasOnlyDecoProvider:h,isLoading:a,isFetching:c,refetch:l}}const Qa={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]},Ya=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function gs(t){const e=L.c(44),{onDismiss:n}=t,{org:r}=ie(),o=nt(),{decoKeyId:a}=xs();let l;e[0]!==r.id||e[1]!==r.slug?(l={connectionId:dt,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=l):l=e[2];const c=de(l),[i,u]=S.useState(""),[V,d]=S.useState(!1),[m,f]=S.useState("usd"),x=m==="brl"?"R$":"$";let h,p;e[3]!==r.id?(h=()=>{W("credits_exhausted_shown",{organization_id:r.id})},p=[r.id],e[3]=r.id,e[4]=h,e[5]=p):(h=e[4],p=e[5]),S.useEffect(h,p);let b;e[6]!==c||e[7]!==m?(b=async I=>{const F=await c.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:I,currency:m}});if(F?.isError)throw new Error(F.content?.[0]?.text??"Failed to get top-up URL");return F.structuredContent?.url},e[6]=c,e[7]=m,e[8]=b):b=e[8];let g;e[9]!==n?(g=I=>{I&&window.open(I,"_blank","noopener,noreferrer"),n?.()},e[9]=n,e[10]=g):g=e[10];let v;e[11]!==b||e[12]!==g?(v={mutationFn:b,onSuccess:g,onError:Wa},e[11]=b,e[12]=g,e[13]=v):v=e[13];const{mutate:y,isPending:w}=Pt(v),A=parseFloat(i),k=!isNaN(A)&&A>=1;let j;e[14]!==n?(j=I=>!I&&n?.(),e[14]=n,e[15]=j):j=e[15];let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(165,149,255,0.5) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(208,236,26,0.45) 0%, transparent 100%)"],e[16]=C):C=e[16];let P;e[17]===Symbol.for("react.memo_cache_sentinel")?(P=s.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:C.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[17]=P):P=e[17];let N;e[18]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[P,s.jsxs(ot,{className:"relative gap-4",children:[s.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"}),s.jsxs("div",{children:[s.jsx(at,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),s.jsx(Mt,{className:"mt-1.5 text-sm leading-relaxed",children:"Your credits are used up. Add more to continue using AI across all your agents."})]})]})]}),e[18]=N):N=e[18];let T;e[19]!==m||e[20]!==x||e[21]!==i||e[22]!==A||e[23]!==a||e[24]!==k||e[25]!==w||e[26]!==V||e[27]!==y?(T=a&&s.jsxs("div",{className:"px-8 pt-5 pb-6",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Yn,{type:"single",variant:"outline",size:"sm",value:m,onValueChange:I=>{I&&f(I)},children:[s.jsx(Je,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(Je,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsxs("div",{className:"rounded-xl border border-border p-5",children:[s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:Qa[m].map(I=>{const{dollars:F,label:$}=I;return s.jsxs("button",{type:"button",disabled:w,onClick:()=>{W("credits_topup_clicked",{amount_cents:F*100,currency:m,tier_label:$,source:"exhausted_banner"}),y(F*100)},className:B("relative flex flex-col items-center gap-1 py-5 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[s.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[x,F]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:$})]},F)})}),V?s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:x}),s.jsx(Hn,{type:"number",min:"1",step:"1",placeholder:"50",value:i,onChange:I=>u(I.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(se,{className:"h-10",disabled:!k||w,onClick:()=>{W("credits_topup_clicked",{amount_cents:Math.round(A*100),currency:m,tier_label:"custom",source:"exhausted_banner"}),y(Math.round(A*100))},children:w?"Opening...":"Add"})]}):s.jsx("button",{type:"button",className:"w-full mt-3 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>d(!0),children:"Enter custom amount"})]}),s.jsx("div",{className:"mt-5 rounded-xl bg-muted/25 border border-border/50 p-4 space-y-3",children:Ya.map(Ha)})]}),e[19]=m,e[20]=x,e[21]=i,e[22]=A,e[23]=a,e[24]=k,e[25]=w,e[26]=V,e[27]=y,e[28]=T):T=e[28];let E;e[29]!==n?(E=s.jsx(se,{variant:"ghost",size:"sm",onClick:n,children:"Dismiss"}),e[29]=n,e[30]=E):E=e[30];let _;e[31]!==o||e[32]!==n||e[33]!==r.slug?(_=s.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{o({to:"/$org/settings/ai-providers",params:{org:r.slug}}),n?.()},children:"Manage providers"}),e[31]=o,e[32]=n,e[33]=r.slug,e[34]=_):_=e[34];let R;e[35]!==E||e[36]!==_?(R=s.jsxs("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-between",children:[E,_]}),e[35]=E,e[36]=_,e[37]=R):R=e[37];let O;e[38]!==T||e[39]!==R?(O=s.jsxs(lt,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Ga,children:[N,T,R]}),e[38]=T,e[39]=R,e[40]=O):O=e[40];let D;return e[41]!==O||e[42]!==j?(D=s.jsx(it,{open:!0,onOpenChange:j,children:O}),e[41]=O,e[42]=j,e[43]=D):D=e[43],D}function Ha(t){return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex items-center justify-center size-5 rounded-full bg-[hsl(var(--chart-1))]/15 shrink-0",children:s.jsx(Ue,{size:12,className:"text-[hsl(var(--chart-1))]"})}),s.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function Ga(t){return t.preventDefault()}function Wa(t){ae.error(`Top-up failed: ${t.message}`)}function Ja(t){const e=t.trim(),n=e.startsWith("<")&&/<[a-z][\s\S]*>/i.test(e),r=/cloudflare|cf-[a-z-]+|error[\s_-]?code[\s_-]?5\d\d/i.test(e),o=/failed to fetch|networkerror|load failed|offline/i.test(e),a=/timeout|timed out|aborted|deadline/i.test(e),l=e.length>240,c=/sandbox failed to start(?::\s*(.+))?/is.exec(e);if(c){const i=c[1]?.trim().replace(/\.$/,"");return{summary:i?`Your sandbox didn't finish starting up (${i}). Try again.`:"Your sandbox didn't finish starting up. Try again.",rawDetails:t}}return r||n&&l?{summary:"Our servers are having a moment. Try sending again in a few seconds.",rawDetails:t}:o?{summary:"Lost connection. Check your network and try again.",rawDetails:t}:a?{summary:"That took longer than expected. Try again.",rawDetails:t}:n||l?{summary:"Something unexpected came back from the server. Try again.",rawDetails:t}:{summary:t,rawDetails:null}}const Za={length:"Response reached the model's output limit. Different models have different limits. Try switching models or asking it to continue.","content-filter":"Response was filtered due to content policy.","tool-calls":"Response paused after tool execution to prevent infinite loops and save costs. Click continue to keep working."};function Ze(t){const e=L.c(19),{variant:n,onDismiss:r}=t,o=n==="error",a=o?"Error occurred":"Response incomplete",l=o?Kn:Rn,c=o?t.error.message:Za[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`;let i;e[0]!==o||e[1]!==c?(i=o?Ja(c):{summary:c,rawDetails:null},e[0]=o,e[1]=c,e[2]=i):i=e[2];const{summary:u,rawDetails:V}=i;let d;e[3]!==l?(d=s.jsx(l,{size:14}),e[3]=l,e[4]=d):d=e[4];let m;e[5]!==o||e[6]!==t.onContinue||e[7]!==t.onFixInChat?(m=o?s.jsx(se,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}):s.jsx(se,{size:"sm",variant:"outline",onClick:t.onContinue,className:"h-7 text-xs",children:"Continue"}),e[5]=o,e[6]=t.onContinue,e[7]=t.onFixInChat,e[8]=m):m=e[8];let f;e[9]!==V?(f=V?s.jsxs("details",{className:"group mx-4",children:[s.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-xs text-muted-foreground transition-colors hover:text-foreground [&::-webkit-details-marker]:hidden",children:[s.jsx("svg",{"aria-hidden":"true",className:"size-3 transition-transform group-open:rotate-90",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"m4.5 3 3 3-3 3"})}),s.jsx("span",{className:"group-open:hidden",children:"Show technical details"}),s.jsx("span",{className:"hidden group-open:inline",children:"Hide technical details"})]}),s.jsxs("div",{className:"relative mt-2",children:[s.jsx("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(V).then(el).catch(Xa)},"aria-label":"Copy error details",title:"Copy",className:"absolute right-1.5 top-1.5 z-10 flex h-6 w-6 items-center justify-center rounded-md bg-background/80 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-background hover:text-foreground",children:s.jsx(Wr,{className:"size-3.5"})}),s.jsx("pre",{className:"max-h-40 overflow-auto rounded-md border border-border/60 bg-background px-3 py-2 pr-8 font-mono text-xs text-foreground/80 whitespace-pre-wrap break-all",children:V})]})]}):null,e[9]=V,e[10]=f):f=e[10];let x;return e[11]!==a||e[12]!==r||e[13]!==u||e[14]!==d||e[15]!==m||e[16]!==f||e[17]!==n?(x=s.jsx(pe,{icon:d,label:a,title:u,defaultExpanded:!0,variant:n,onClose:r,footerRight:m,children:f}),e[11]=a,e[12]=r,e[13]=u,e[14]=d,e[15]=m,e[16]=f,e[17]=n,e[18]=x):x=e[18],x}function Xa(){return ae.error("Could not copy")}function el(){return ae.success("Copied to clipboard")}function pt(){const t=L.c(61),{error:e,clearError:n,finishReason:r,clearFinishReason:o,messages:a,isStreaming:l,submit:c,sendMessage:i}=Be(),[u,V]=Ee(),{virtualMcpId:d,createTaskWithMessage:m}=vr(),{chatMode:f,simpleModeTier:x}=ue();let h;t[0]!==f||t[1]!==x||t[2]!==d?(h=H=>({tier:x,mode:f,toolApprovalLevel:H,agent:d?{id:d}:void 0}),t[0]=f,t[1]=x,t[2]=d,t[3]=h):h=t[3];const p=h;let b;t[4]!==u.toolApprovalLevel?(b=u.toolApprovalLevel??Ys(),t[4]=u.toolApprovalLevel,t[5]=b):b=t[5];const g=b,v=a.at(-1),y=v?.role==="assistant"?v.parts:[],w=y.filter(rl),A=os(y),k=rs(y);let j;t[6]!==e||t[7]!==i?(j=()=>{if(e){const re={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};i(re)}},t[6]=e,t[7]=i,t[8]=j):j=t[8];const C=j;let P;t[9]!==i?(P=()=>{i({type:"doc",content:[{type:"paragraph",content:[{type:"text",text:"Please continue."}]}]})},t[9]=i,t[10]=P):P=t[10];const N=P;let T;t[11]!==p||t[12]!==g||t[13]!==c?(T=(H,re)=>{c({kind:"toolOutput",toolCallId:H.toolCallId,output:{response:re}},p(g))},t[11]=p,t[12]=g,t[13]=c,t[14]=T):T=t[14];const E=T;let _;t[15]!==m||t[16]!==u||t[17]!==V||t[18]!==d?(_=H=>{V({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:d,message:{parts:[{type:"text",text:`Implement this plan:
|
|
2
|
-
|
|
3
|
-
${H}`}]}})},t[15]=m,t[16]=u,t[17]=V,t[18]=d,t[19]=_):_=t[19];const R=_,O=sl;let D;t[20]!==p||t[21]!==c?(D=(H,re,ne,G)=>{c({kind:"approval",approvalId:H,approved:re,...ne?{reason:ne}:{}},p(G))},t[20]=p,t[21]=c,t[22]=D):D=t[22];const I=D,F=as();if(F.isCreditExhausted){let H;return t[23]!==n?(H=s.jsx(gs,{onDismiss:n}),t[23]=n,t[24]=H):H=t[24],H}const{showError:$,showWarning:z,hasApprovals:K}=F,M=w.map(nl).join("|"),U=A[0]?.toolCallId??"",Q=k.map(tl).join("|");let q;t[25]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(za,{}),t[25]=q):q=t[25];let Y;t[26]!==n||t[27]!==e||t[28]!==C||t[29]!==$?(Y=$&&s.jsx(Ze,{variant:"error",error:e,onDismiss:n,onFixInChat:C}),t[26]=n,t[27]=e,t[28]=C,t[29]=$,t[30]=Y):Y=t[30];let J;t[31]!==o||t[32]!==r||t[33]!==N||t[34]!==z?(J=z&&s.jsx(Ze,{variant:"warning",finishReason:r,onDismiss:o,onContinue:N}),t[31]=o,t[32]=r,t[33]=N,t[34]=z,t[35]=J):J=t[35];let Z;t[36]!==Q||t[37]!==I||t[38]!==K||t[39]!==l||t[40]!==k?(Z=K&&s.jsx(Aa,{approvals:k,isStreaming:l,onRespond:I},Q),t[36]=Q,t[37]=I,t[38]=K,t[39]=l,t[40]=k,t[41]=Z):Z=t[41];let X;t[42]!==F.hasPlans||t[43]!==R||t[44]!==O||t[45]!==l||t[46]!==A||t[47]!==U?(X=F.hasPlans&&s.jsx(Sa,{plans:A,isStreaming:l,onApprove:R,onDismiss:O},U),t[42]=F.hasPlans,t[43]=R,t[44]=O,t[45]=l,t[46]=A,t[47]=U,t[48]=X):X=t[48];let te;t[49]!==F.isWaitingForUserInput||t[50]!==E||t[51]!==l||t[52]!==M||t[53]!==w?(te=F.isWaitingForUserInput&&s.jsx(hs,{userAskParts:w,isStreaming:l,onSubmit:E},M),t[49]=F.isWaitingForUserInput,t[50]=E,t[51]=l,t[52]=M,t[53]=w,t[54]=te):te=t[54];let ee;return t[55]!==Z||t[56]!==X||t[57]!==te||t[58]!==Y||t[59]!==J?(ee=s.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[q,Y,J,Z,X,te]}),t[55]=Z,t[56]=X,t[57]=te,t[58]=Y,t[59]=J,t[60]=ee):ee=t[60],ee}function tl(t){return t.approvalId}function nl(t){return t.toolCallId}function sl(){document.querySelector("[data-chat-input]")?.focus()}function rl(t){return t.type==="tool-user_ask"}pt.Error=function(e){return s.jsx(Ze,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};pt.Warning=function(e){return s.jsx(Ze,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};pt.UserAskQuestion=hs;async function ol(t,e,n){const r=await t.callTool({name:e,arguments:n});if(r.isError){const o=r.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(o)}return r}const bs=["SANDBOX_START"],qe=new Map,al=t=>`${t.virtualMcpId}::${t.branch??""}`,vt=new Set,ll={mark:(t,e)=>vt.add(`${t}::${e}`),clear:(t,e)=>vt.delete(`${t}::${e}`),isStopped:(t,e)=>vt.has(`${t}::${e}`)};function il(t){const e=ze();return Pt({mutationKey:bs,mutationFn:async n=>{n.branch&&ll.clear(n.virtualMcpId,n.branch);const r=al(n),o=qe.get(r);if(o)return o;const a=(async()=>(await ol(t,"SANDBOX_START",n)).structuredContent)();qe.set(r,a);try{return await a}finally{qe.get(r)===a&&qe.delete(r)}},onSuccess:()=>{Hs(e)}})}function Gd(t,e){const n=L.c(3);let r;return n[0]!==e||n[1]!==t?(r={mutationKey:bs,predicate:a=>{if(!t)return!1;const l=a.state.variables;return!l||l.virtualMcpId!==t?!1:(l.branch??"")===(e??"")}},n[0]=e,n[1]=t,n[2]=r):r=n[2],Do(r)>0}const cl={fast:{modelId:"claude-code:haiku",label:"Haiku 4.5"},smart:{modelId:"claude-code:sonnet",label:"Sonnet 4.6"},thinking:{modelId:"claude-code:fable",label:"Fable 5"}},dl={fast:{modelId:"codex:gpt-5.4-mini",label:"GPT-5.4 Mini"},smart:{modelId:"codex:gpt-5.4",label:"GPT-5.4"},thinking:{modelId:"codex:gpt-5.5",label:"GPT-5.5"}};function Vl(t){return t==="claude-code"?cl:t==="codex"?dl:null}function fn(t,e){return Vl(t)?.[e]??null}const ul={"cloud-decopilot":"decopilot","local-decopilot":"decopilot-desktop","local-claude-code":"claude-code-desktop","local-codex":"codex-desktop"},fl={decopilot:"cloud-decopilot","decopilot-desktop":"local-decopilot","claude-code-desktop":"local-claude-code","codex-desktop":"local-codex"};function ml(t){return ul[t]}function pl(t){return t===null?"cloud-decopilot":fl[t]}function vs(){const t=L.c(2),{pendingAgentOption:e}=ue();let n;return t[0]!==e?(n=pl(e),t[0]=e,t[1]=n):n=t[1],n}function hl(){const t=L.c(2),{setPendingAgentOption:e}=ue();let n;return t[0]!==e?(n=r=>e(ml(r)),t[0]=e,t[1]=n):n=t[1],n}function xl(){return ue().simpleModeTier}function gl(){return ue().setSimpleModeTier}const bl={fast:"Quicker responses",smart:"Balanced quality",thinking:"Deeper reasoning"};function vl(t,e){return t==="local-claude-code"?fn("claude-code",e)?.label??null:t==="local-codex"?fn("codex",e)?.label??null:bl[e]}const yl={decopilot:"Decopilot","claude-code":"Claude Code",codex:"Codex"},Al=ct("").icon;function Xe(t){const e=L.c(4),{compact:n}=t,o=(n===void 0?!1:n)?"size-3.5 rounded-sm":"size-4 rounded-sm";let a;e[0]!==o?(a=B(o),e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==a?(l=s.jsx(Bn,{icon:Al,name:"Decopilot",size:"2xs",className:a}),e[2]=a,e[3]=l):l=e[3],l}const wl={mode:"cloud-decopilot",label:"Decopilot",description:"Runs in an agent sandbox",group:"cloud",icon:s.jsx(Xe,{}),isAvailable:t=>t.agentSandbox},jl={mode:"local-decopilot",label:"Decopilot",description:"Runs on your desktop",group:"local",icon:s.jsx(Xe,{}),isAvailable:t=>t.userDesktop},Sl={mode:"local-claude-code",label:"Claude Code",description:"Runs via Claude Code CLI",group:"local",icon:s.jsx(Gn,{size:16}),isAvailable:t=>t.userDesktop&&t.claudeCode},Cl={mode:"local-codex",label:"Codex",description:"Runs via Codex CLI",group:"local",icon:s.jsx(Wn,{size:16}),isAvailable:t=>t.userDesktop&&t.codex},qt=[wl,jl,Sl,Cl];function Nl(t,e){return qt.some(n=>n.mode===t&&n.isAvailable(e))}function kl(t,e){return Nl(t,e)?t:qt.find(n=>n.isAvailable(e))?.mode??t}function _l(t){return t==="local-decopilot"?{icon:s.jsx(Xe,{compact:!0}),text:"Decopilot"}:t==="local-claude-code"?{icon:s.jsx(Gn,{size:14}),text:"Claude Code"}:t==="local-codex"?{icon:s.jsx(Wn,{size:14}),text:"Codex"}:{icon:s.jsx(Xe,{compact:!0}),text:"Cloud"}}const Il="text-muted-foreground hover:text-foreground text-xs transition-[gap] duration-200",El="text-success hover:text-success";function Rl(t){const e=L.c(76),{mode:n,availability:r,locked:o,lockedHarness:a,onSelect:l}=t,[c,i]=S.useState(!1);let u;e[0]!==n?(u=_l(n),e[0]=n,e[1]=u):u=e[1];const{icon:V,text:d}=u,m=n!=="cloud-decopilot",f=o&&a!=null,x=a?yl[a]:null;let h,p,b,g,v,y,w,A,k,j,C,P,N;if(e[2]!==r||e[3]!==x||e[4]!==V||e[5]!==m||e[6]!==f||e[7]!==o||e[8]!==n||e[9]!==l||e[10]!==c||e[11]!==d){let R;e[25]!==r?(R=ne=>ne.isAvailable(r),e[25]=r,e[26]=R):R=e[26];const O=qt.filter(R),D=O.filter(Pl),I=O.filter(Tl);let F;e[27]!==l?(F=ne=>{l(ne),i(!1)},e[27]=l,e[28]=F):F=e[28];const $=F;p=$t,b=c,g=o?void 0:i;const z=f&&x?`This chat is using ${x}. Start a new chat to use a different runtime.`:d,K=f?"harness-picker-locked":"harness-picker",M=m&&El,U=o?"gap-0":"gap-0 @[320px]/chat-bottom:gap-1.5";let Q;e[29]!==M||e[30]!==U?(Q=B(Il,M,"shrink min-w-0",U),e[29]=M,e[30]=U,e[31]=Q):Q=e[31];const q=!o&&"@[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100";let Y;e[32]!==q?(Y=B("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0",q),e[32]=q,e[33]=Y):Y=e[33];let J;e[34]!==Y||e[35]!==d?(J=s.jsx("span",{className:Y,children:d}),e[34]=Y,e[35]=d,e[36]=J):J=e[36];let Z;e[37]!==o?(Z=!o&&s.jsx(ut,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[37]=o,e[38]=Z):Z=e[38];let X;e[39]!==V||e[40]!==o||e[41]!==z||e[42]!==K||e[43]!==Q||e[44]!==J||e[45]!==Z?(X=s.jsx(xe,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(zt,{asChild:!0,children:s.jsxs(se,{type:"button",variant:"ghost",size:"default","aria-label":z,disabled:o,"data-testid":K,className:Q,children:[V,J,Z]})})})}),e[39]=V,e[40]=o,e[41]=z,e[42]=K,e[43]=Q,e[44]=J,e[45]=Z,e[46]=X):X=e[46];const te=f&&x?`This chat is using ${x}. Start a new chat to use a different runtime.`:d;let ee;e[47]!==te?(ee=s.jsx(ge,{children:te}),e[47]=te,e[48]=ee):ee=e[48],e[49]!==X||e[50]!==ee?(v=s.jsxs(be,{children:[X,ee]}),e[49]=X,e[50]=ee,e[51]=v):v=e[51],h=Bt,P="start",N="p-1 w-64",y="menu",w="flex flex-col",A=D.length>0&&s.jsx(mn,{title:"Cloud"});let H;e[52]!==$||e[53]!==n?(H=ne=>s.jsx(pn,{row:ne,active:n===ne.mode,onSelect:$},ne.mode),e[52]=$,e[53]=n,e[54]=H):H=e[54],k=D.map(H),j=I.length>0&&s.jsx(mn,{title:"Local",variant:"success",icon:s.jsx(Vo,{size:12,"data-testid":"local-section-desktop-icon"}),testId:"local-section-header"});let re;e[55]!==$||e[56]!==n?(re=ne=>s.jsx(pn,{row:ne,active:n===ne.mode,onSelect:$},ne.mode),e[55]=$,e[56]=n,e[57]=re):re=e[57],C=I.map(re),e[2]=r,e[3]=x,e[4]=V,e[5]=m,e[6]=f,e[7]=o,e[8]=n,e[9]=l,e[10]=c,e[11]=d,e[12]=h,e[13]=p,e[14]=b,e[15]=g,e[16]=v,e[17]=y,e[18]=w,e[19]=A,e[20]=k,e[21]=j,e[22]=C,e[23]=P,e[24]=N}else h=e[12],p=e[13],b=e[14],g=e[15],v=e[16],y=e[17],w=e[18],A=e[19],k=e[20],j=e[21],C=e[22],P=e[23],N=e[24];let T;e[58]!==y||e[59]!==w||e[60]!==A||e[61]!==k||e[62]!==j||e[63]!==C?(T=s.jsxs("div",{role:y,className:w,children:[A,k,j,C]}),e[58]=y,e[59]=w,e[60]=A,e[61]=k,e[62]=j,e[63]=C,e[64]=T):T=e[64];let E;e[65]!==h||e[66]!==T||e[67]!==P||e[68]!==N?(E=s.jsx(h,{align:P,className:N,children:T}),e[65]=h,e[66]=T,e[67]=P,e[68]=N,e[69]=E):E=e[69];let _;return e[70]!==p||e[71]!==b||e[72]!==g||e[73]!==v||e[74]!==E?(_=s.jsxs(p,{open:b,onOpenChange:g,children:[v,E]}),e[70]=p,e[71]=b,e[72]=g,e[73]=v,e[74]=E,e[75]=_):_=e[75],_}function Tl(t){return t.group==="local"}function Pl(t){return t.group==="cloud"}function mn(t){const e=L.c(9),{title:n,variant:r,icon:o,testId:a}=t,c=(r===void 0?"muted":r)==="success"?"bg-success/10 text-success":"text-muted-foreground";let i;e[0]!==c?(i=B("inline-flex w-fit items-center gap-2 mx-1 mt-2 mb-1 px-1.5 py-0.5 rounded text-[10px] font-medium uppercase tracking-wide",c),e[0]=c,e[1]=i):i=e[1];let u;e[2]!==n?(u=s.jsx("span",{children:n}),e[2]=n,e[3]=u):u=e[3];let V;return e[4]!==o||e[5]!==i||e[6]!==u||e[7]!==a?(V=s.jsxs("div",{"data-testid":a,className:i,children:[o,u]}),e[4]=o,e[5]=i,e[6]=u,e[7]=a,e[8]=V):V=e[8],V}function pn(t){const e=L.c(20),{row:n,active:r,onSelect:o}=t;let a;e[0]!==o||e[1]!==n.mode?(a=()=>o(n.mode),e[0]=o,e[1]=n.mode,e[2]=a):a=e[2];let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=B("flex items-start gap-2 px-2 py-1.5 rounded-md text-left","hover:bg-muted"),e[3]=l):l=e[3];let c;e[4]!==n.icon?(c=s.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:n.icon}),e[4]=n.icon,e[5]=c):c=e[5];let i;e[6]!==n.label?(i=s.jsx("div",{className:"text-sm",children:n.label}),e[6]=n.label,e[7]=i):i=e[7];let u;e[8]!==n.description?(u=s.jsx("div",{className:"text-xs text-muted-foreground",children:n.description}),e[8]=n.description,e[9]=u):u=e[9];let V;e[10]!==i||e[11]!==u?(V=s.jsxs("div",{className:"flex-1",children:[i,u]}),e[10]=i,e[11]=u,e[12]=V):V=e[12];let d;e[13]!==r?(d=r&&s.jsx(Ue,{size:14,className:"text-foreground mt-0.5"}),e[13]=r,e[14]=d):d=e[14];let m;return e[15]!==a||e[16]!==c||e[17]!==V||e[18]!==d?(m=s.jsxs("button",{type:"button",role:"menuitem",onClick:a,className:l,children:[c,V,d]}),e[15]=a,e[16]=c,e[17]=V,e[18]=d,e[19]=m):m=e[19],m}function Dl(t){const e=L.c(17),{locked:n,currentBranch:r,virtualMcpId:o}=t,a=vs(),l=hl(),{org:c}=ie();let i;e[0]!==c.id||e[1]!==c.slug?(i={connectionId:dt,orgId:c.id,orgSlug:c.slug},e[0]=c.id,e[1]=c.slug,e[2]=i):i=e[2];const u=de(i),V=il(u),m=rt()?.lockedHarness??null,f=yr();let x;e[3]!==f||e[4]!==a?(x=kl(a,f),e[3]=f,e[4]=a,e[5]=x):x=e[5];const h=x;let p;e[6]!==r||e[7]!==l||e[8]!==V||e[9]!==o?(p=v=>{l(v),W("agent_mode_selected",{mode:v}),r&&V.mutate({virtualMcpId:o,branch:r,sandboxProviderKind:v==="cloud-decopilot"?"agent-sandbox":"user-desktop"})},e[6]=r,e[7]=l,e[8]=V,e[9]=o,e[10]=p):p=e[10];const b=p;let g;return e[11]!==f||e[12]!==b||e[13]!==n||e[14]!==m||e[15]!==h?(g=s.jsx(Rl,{mode:h,availability:f,locked:n,lockedHarness:m,onSelect:b}),e[11]=f,e[12]=b,e[13]=n,e[14]=m,e[15]=h,e[16]=g):g=e[16],g}const hn=["amber","bold","bright","calm","crimson","coral","daring","deep","dusty","eager","faint","fierce","frozen","gentle","golden","grand","green","hollow","iron","ivory","keen","lasting","lunar","mellow","misty","noble","olive","pale","prime","quiet","rapid","rustic","serene","sharp","silver","sleek","solar","stark","still","swift","tawny","tender","thin","true","vast","velvet","warm","wild","young","zen"],xn=["anchor","birch","brook","cedar","cliff","cove","crane","dune","echo","ember","falcon","fern","flint","forge","frost","glade","grove","harbor","hawk","iris","jade","lark","maple","marsh","mesa","opal","orbit","peak","pine","plume","quartz","rapids","reef","ridge","river","sage","shore","slate","spruce","stone","summit","thorn","tide","trail","vale","wren","aspen","delta","crest","spark"];function Ml(){const t=hn[Math.floor(Math.random()*hn.length)],e=xn[Math.floor(Math.random()*xn.length)];return`deco/${t}-${e}`}const He=100;function Fl(t,e,n){const r=e.trim().toLowerCase();return r?(t??[]).some(o=>o.branches.some(a=>typeof a.name=="string"&&!n.has(a.name)&&a.name.toLowerCase().includes(r))):!0}function Ol(t,e){const n=e.trim().toLowerCase();return n?[...t].some(r=>r.toLowerCase().includes(n)):!0}function Ll(t){const e=t;if(e.structuredContent)return e.structuredContent;const n=e.content?.find(r=>r.type==="text")?.text;if(n)try{return JSON.parse(n)}catch{return[]}return[]}function $l(t){const e=L.c(48),{orgId:n,orgSlug:r,userId:o,connectionId:a,sandboxMap:l,owner:c,repo:i,enabled:u}=t,V=u===void 0?!0:u,d=a??null;let m;e[0]!==n||e[1]!==r||e[2]!==d?(m={connectionId:d,orgId:n,orgSlug:r},e[0]=n,e[1]=r,e[2]=d,e[3]=m):m=e[3];const f=de(m);let x;e[4]!==a||e[5]!==n||e[6]!==r||e[7]!==c||e[8]!==i?(x=Ir.githubBranches(n,r,a,c,i),e[4]=a,e[5]=n,e[6]=r,e[7]=c,e[8]=i,e[9]=x):x=e[9];const h=V&&!!a&&!!c&&!!i;let p;e[10]!==f||e[11]!==c||e[12]!==i?(p=async z=>{const{pageParam:K,signal:M}=z,U=Number(K),Q=await f.callTool({name:"list_branches",arguments:{owner:c,repo:i,page:U,perPage:He}},void 0,{signal:M}),q=Ll(Q);return{branches:Array.isArray(q)?q:q.branches??[],default_branch:Array.isArray(q)?null:q.default_branch??null,page:U}},e[10]=f,e[11]=c,e[12]=i,e[13]=p):p=e[13];let b;e[14]!==x||e[15]!==h||e[16]!==p?(b={queryKey:x,enabled:h,staleTime:3e4,retry:!1,initialPageParam:1,queryFn:p,getNextPageParam:Ql},e[14]=x,e[15]=h,e[16]=p,e[17]=b):b=e[17];const{data:g,isLoading:v,isError:y,hasNextPage:w,isFetchingNextPage:A,fetchNextPage:k}=xo(b);let j,C;e[18]!==l||e[19]!==o?(C=new Set(Object.keys(l?.[o]??{})),j=[...C].sort().map(ql),e[18]=l,e[19]=o,e[20]=j,e[21]=C):(j=e[20],C=e[21]);const P=j;let N;if(e[22]!==g?.pages){const z=new Map;for(const M of g?.pages??[])for(const U of M.branches)typeof U.name=="string"&&z.set(U.name,U);N=[...z.values()].filter(Kl),e[22]=g?.pages,e[23]=N}else N=e[23];let T;e[24]!==N||e[25]!==C?(T=N.filter(z=>!C.has(z.name)).map(Ul),e[24]=N,e[25]=C,e[26]=T):T=e[26];const E=T;let _;e[27]!==g?.pages?(_=g?.pages.find(Bl)?.default_branch??null,e[27]=g?.pages,e[28]=_):_=e[28];const R=_;let O;e[29]!==g?.pages||e[30]!==k||e[31]!==A||e[32]!==C?(O=async(z,K)=>{const M=K===void 0?zl:K;if(!M()||Ol(C,z)||A)return;let U=g?.pages??[];for(;M()&&!Fl(U,z,C)&&(U.at(-1)?.branches.length??He)>=He;){const Q=await k();if(!M())break;const q=Q.data?.pages??U;if(q.length===U.length)break;U=q}},e[29]=g?.pages,e[30]=k,e[31]=A,e[32]=C,e[33]=O):O=e[33];const D=O,I=w??!1;let F;e[34]!==k||e[35]!==w||e[36]!==A?(F=()=>{w&&!A&&k()},e[34]=k,e[35]=w,e[36]=A,e[37]=F):F=e[37];let $;return e[38]!==R||e[39]!==D||e[40]!==y||e[41]!==A||e[42]!==v||e[43]!==E||e[44]!==I||e[45]!==F||e[46]!==P?($={yours:P,others:E,defaultBase:R,isLoading:v,isError:y,hasMore:I,isFetchingMore:A,fetchMore:F,fetchUntilMatch:D},e[38]=R,e[39]=D,e[40]=y,e[41]=A,e[42]=v,e[43]=E,e[44]=I,e[45]=F,e[46]=P,e[47]=$):$=e[47],$}function zl(){return!0}function Bl(t){return t.default_branch}function Ul(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function Kl(t){return typeof t.name=="string"}function ql(t){return{name:t,source:"yours"}}function Ql(t){if(!(t.branches.length<He))return t.page+1}function Yl(t){const e=L.c(85),{orgId:n,orgSlug:r,userId:o,connectionId:a,owner:l,repo:c,sandboxMap:i,value:u,onChange:V,disabled:d,placement:m}=t,f=d===void 0?!1:d,h=(m===void 0?"chat":m)==="header",[p,b]=S.useState(!1),[g,v]=S.useState(""),[y,w]=S.useState(!1),A=S.useRef(0);let k;e[0]!==a||e[1]!==p||e[2]!==n||e[3]!==r||e[4]!==l||e[5]!==c||e[6]!==i||e[7]!==o?(k={orgId:n,orgSlug:r,userId:o,connectionId:a,sandboxMap:i,owner:l,repo:c,enabled:p},e[0]=a,e[1]=p,e[2]=n,e[3]=r,e[4]=l,e[5]=c,e[6]=i,e[7]=o,e[8]=k):k=e[8];const{yours:j,others:C,isLoading:P,isError:N,hasMore:T,isFetchingMore:E,fetchMore:_,fetchUntilMatch:R}=$l(k);let O;e[9]!==V?(O=oe=>{V(oe),b(!1)},e[9]=V,e[10]=O):O=e[10];const D=O,I=u??"Select branch…";let F;e[11]!==R?(F=oe=>{v(oe),A.current=A.current+1;const Ne=A.current,ht=oe.trim();if(!ht){w(!1);return}w(!0),R(ht,()=>Ne===A.current).finally(()=>{Ne===A.current&&w(!1)})},e[11]=R,e[12]=F):F=e[12];const $=F;let z;e[13]!==_?(z=oe=>{const Ne=oe.currentTarget;Ne.scrollHeight-Ne.scrollTop-Ne.clientHeight<48&&_()},e[13]=_,e[14]=z):z=e[14];const K=z,M=f?void 0:b,U=h?"outline":"ghost",Q=h?"sm":"default";let q;e[15]!==f||e[16]!==h?(q=B("font-mono shrink min-w-0 max-w-[200px]",h?"gap-1.5 text-xs":B("text-xs text-muted-foreground hover:text-foreground transition-[gap] duration-200",f?"gap-0":"gap-0 @[320px]/chat-bottom:gap-1.5")),e[15]=f,e[16]=h,e[17]=q):q=e[17];let Y;e[18]===Symbol.for("react.memo_cache_sentinel")?(Y=s.jsx(Ye,{className:"h-3.5 w-3.5 shrink-0"}),e[18]=Y):Y=e[18];let J;e[19]!==f||e[20]!==h?(J=B("min-w-0 truncate",h?"":B("transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0",!f&&"@[320px]/chat-bottom:max-w-[200px] @[320px]/chat-bottom:opacity-100")),e[19]=f,e[20]=h,e[21]=J):J=e[21];let Z;e[22]!==I||e[23]!==J?(Z=s.jsx("span",{className:J,children:I}),e[22]=I,e[23]=J,e[24]=Z):Z=e[24];let X;e[25]!==f||e[26]!==h?(X=!f&&s.jsx(ut,{size:12,className:B("opacity-60 shrink-0",h?"":"hidden @[320px]/chat-bottom:inline-block")}),e[25]=f,e[26]=h,e[27]=X):X=e[27];let te;e[28]!==f||e[29]!==I||e[30]!==q||e[31]!==Z||e[32]!==X||e[33]!==U||e[34]!==Q?(te=s.jsx(xe,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(zt,{asChild:!0,children:s.jsxs(se,{variant:U,size:Q,"aria-label":I,disabled:f,className:q,children:[Y,Z,X]})})})}),e[28]=f,e[29]=I,e[30]=q,e[31]=Z,e[32]=X,e[33]=U,e[34]=Q,e[35]=te):te=e[35];let ee;e[36]!==I?(ee=s.jsx(ge,{children:I}),e[36]=I,e[37]=ee):ee=e[37];let H;e[38]!==te||e[39]!==ee?(H=s.jsxs(be,{children:[te,ee]}),e[38]=te,e[39]=ee,e[40]=H):H=e[40];let re;e[41]!==$||e[42]!==g?(re=s.jsx(fo,{placeholder:"Search loaded branches…",value:g,onValueChange:$}),e[41]=$,e[42]=g,e[43]=re):re=e[43];let ne;e[44]!==D?(ne=s.jsx(se,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>D(Ml()),children:"New"}),e[44]=D,e[45]=ne):ne=e[45];let G;e[46]!==re||e[47]!==ne?(G=s.jsxs("div",{className:"*:data-[slot=command-input-wrapper]:flex-1 *:data-[slot=command-input-wrapper]:border-b-0 flex items-center border-b pr-2",children:[re,ne]}),e[46]=re,e[47]=ne,e[48]=G):G=e[48];let le;e[49]!==N?(le=N&&s.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"Couldn't load branches from GitHub. You can still pick from your branches."}),e[49]=N,e[50]=le):le=e[50];let ve;e[51]!==T||e[52]!==N||e[53]!==P?(ve=!N&&!P&&s.jsx(mo,{children:T?"Looking through more branches...":"No branches found."}),e[51]=T,e[52]=N,e[53]=P,e[54]=ve):ve=e[54];let ye;e[55]!==D||e[56]!==j?(ye=j.length>0&&s.jsx(Zt,{heading:"Your branches",children:j.map(oe=>s.jsxs(Xt,{value:oe.name,onSelect:()=>D(oe.name),children:[s.jsx(Ye,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"flex-1 truncate",children:oe.name})]},oe.name))}),e[55]=D,e[56]=j,e[57]=ye):ye=e[57];let Ae;e[58]!==C||e[59]!==D?(Ae=C.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(uo,{}),s.jsx(Zt,{heading:"Other branches in repo",children:C.map(oe=>s.jsxs(Xt,{value:oe.name,onSelect:()=>D(oe.name),children:[s.jsx(Ye,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"flex-1 truncate",children:oe.name}),oe.author&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",oe.author]})]},oe.name))})]}),e[58]=C,e[59]=D,e[60]=Ae):Ae=e[60];let we;e[61]!==_||e[62]!==T||e[63]!==E||e[64]!==y?(we=T&&s.jsx("div",{className:"border-t p-2",children:s.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:E,onClick:_,children:E||y?"Loading more…":"Load more branches"})}),e[61]=_,e[62]=T,e[63]=E,e[64]=y,e[65]=we):we=e[65];let je;e[66]!==T||e[67]!==C.length?(je=!T&&C.length>0&&s.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:"All loaded"}),e[66]=T,e[67]=C.length,e[68]=je):je=e[68];let Se;e[69]!==K||e[70]!==le||e[71]!==ve||e[72]!==ye||e[73]!==Ae||e[74]!==we||e[75]!==je?(Se=s.jsxs(po,{onScroll:K,children:[le,ve,ye,Ae,we,je]}),e[69]=K,e[70]=le,e[71]=ve,e[72]=ye,e[73]=Ae,e[74]=we,e[75]=je,e[76]=Se):Se=e[76];let Ce;e[77]!==G||e[78]!==Se?(Ce=s.jsx(Bt,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:s.jsxs(ho,{children:[G,Se]})}),e[77]=G,e[78]=Se,e[79]=Ce):Ce=e[79];let Ke;return e[80]!==p||e[81]!==H||e[82]!==Ce||e[83]!==M?(Ke=s.jsxs($t,{open:p,onOpenChange:M,children:[H,Ce]}),e[80]=p,e[81]=H,e[82]=Ce,e[83]=M,e[84]=Ke):Ke=e[84],Ke}function Hl(t){const e=L.c(24);let n,r,o;e[0]!==t?({locked:n,placement:r,...o}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o):(n=e[1],r=e[2],o=e[3]);const a=rt(),l=a?.isThreadLocked??!1,c=a?.lockedBranch??null,i=r==="header";if(l){const V=c??"(no branch)",d=i?"h-8 border border-input bg-background px-2.5":"h-9 px-2";let m;e[4]!==d?(m=B("inline-flex items-center gap-1.5 rounded-md font-mono text-xs","text-muted-foreground cursor-default min-w-0 max-w-[200px]",d),e[4]=d,e[5]=m):m=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Ye,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),e[6]=f):f=e[6];const x=i?"":"transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[160px] @[320px]/chat-bottom:opacity-100";let h;e[7]!==x?(h=B("min-w-0 truncate",x),e[7]=x,e[8]=h):h=e[8];let p;e[9]!==V||e[10]!==h?(p=s.jsx("span",{className:h,children:V}),e[9]=V,e[10]=h,e[11]=p):p=e[11];let b;e[12]!==m||e[13]!==p?(b=s.jsx(xe,{asChild:!0,children:s.jsxs("span",{"data-testid":"branch-picker-locked","aria-disabled":"true",className:m,children:[f,p]})}),e[12]=m,e[13]=p,e[14]=b):b=e[14];let g;e[15]!==V?(g=s.jsxs(ge,{children:["This chat is using branch ",V,". Start a new chat to use a different branch."]}),e[15]=V,e[16]=g):g=e[16];let v;return e[17]!==b||e[18]!==g?(v=s.jsxs(be,{children:[b,g]}),e[17]=b,e[18]=g,e[19]=v):v=e[19],v}let u;return e[20]!==n||e[21]!==r||e[22]!==o?(u=s.jsx(Yl,{...o,disabled:n,placement:r}),e[20]=n,e[21]=r,e[22]=o,e[23]=u):u=e[23],u}function Gl(t){const e=L.c(3),{branchPill:n,modePicker:r}=t;if(!n&&!r)return null;let o;return e[0]!==n||e[1]!==r?(o=s.jsxs(s.Fragment,{children:[r,n]}),e[0]=n,e[1]=r,e[2]=o):o=e[2],o}function Wl(t){const e=L.c(22),{virtualMcp:n,currentBranch:r}=t,o=Fn(),a=rt();let l;e[0]!==o?.messages||e[1]!==a?.isThreadLocked?(l=(o?.messages??[]).length>0||(a?.isThreadLocked??!1),e[0]=o?.messages,e[1]=a?.isThreadLocked,e[2]=l):l=e[2];const c=l,i=a?.setCurrentTaskBranch;let u;e[3]!==n?(u=Zn(n),e[3]=n,e[4]=u):u=e[4];const V=u,d=V?.connectionId,{data:m}=Tn.useSession(),f=m?.user?.id??"",{org:x}=ie();let h;e[5]!==d||e[6]!==r||e[7]!==V||e[8]!==c||e[9]!==x||e[10]!==i||e[11]!==f||e[12]!==n?.id||e[13]!==n?.metadata?.sandboxMap?(h=V&&d?s.jsx(Hl,{orgId:x.id,orgSlug:x.slug,userId:f,virtualMcpId:n?.id??"",connectionId:d,owner:V.owner,repo:V.name,sandboxMap:n?.metadata?.sandboxMap,value:r,onChange:w=>{i&&i(w)},locked:c,placement:"chat"}):null,e[5]=d,e[6]=r,e[7]=V,e[8]=c,e[9]=x,e[10]=i,e[11]=f,e[12]=n?.id,e[13]=n?.metadata?.sandboxMap,e[14]=h):h=e[14];const p=h,b=n?.id??"";let g;e[15]!==r||e[16]!==c||e[17]!==b?(g=s.jsx(Dl,{locked:c,currentBranch:r,virtualMcpId:b}),e[15]=r,e[16]=c,e[17]=b,e[18]=g):g=e[18];const v=g;let y;return e[19]!==p||e[20]!==v?(y=s.jsx(Gl,{branchPill:p,modePicker:v}),e[19]=p,e[20]=v,e[21]=y):y=e[21],y}const Jl=["fast","smart","thinking"],Re={fast:"Fast",smart:"Smart",thinking:"Thinking"};function Zl(t){const e=L.c(30),{tier:n,subtitleFor:r,iconFor:o,onSelect:a}=t,[l,c]=S.useState(!1);let i;e[0]!==a?(i=j=>{a(j),c(!1)},e[0]=a,e[1]=i):i=e[1];const u=i,V=Re[n];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=B("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),e[2]=d):d=e[2];let m;e[3]!==o||e[4]!==n?(m=o?.(n),e[3]=o,e[4]=n,e[5]=m):m=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=B("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),e[6]=f):f=e[6];const x=Re[n];let h;e[7]!==x?(h=s.jsx("span",{className:f,children:x}),e[7]=x,e[8]=h):h=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(ut,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[9]=p):p=e[9];let b;e[10]!==V||e[11]!==m||e[12]!==h?(b=s.jsx(xe,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(zt,{asChild:!0,children:s.jsxs(se,{type:"button",variant:"ghost",size:"default","aria-label":V,className:d,children:[m,h,p]})})})}),e[10]=V,e[11]=m,e[12]=h,e[13]=b):b=e[13];const g=Re[n];let v;e[14]!==g?(v=s.jsx(ge,{children:g}),e[14]=g,e[15]=v):v=e[15];let y;e[16]!==v||e[17]!==b?(y=s.jsxs(be,{children:[b,v]}),e[16]=v,e[17]=b,e[18]=y):y=e[18];let w;e[19]!==u||e[20]!==o||e[21]!==r||e[22]!==n?(w=Jl.map(j=>{const C=r(j),P=o?.(j),N=j===n;return s.jsxs("button",{type:"button",role:"menuitem","aria-label":Re[j],onClick:()=>u(j),className:B("flex items-start gap-2 px-2 py-1.5 rounded-md text-left","hover:bg-muted"),children:[P&&s.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:P}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"text-sm",children:Re[j]}),C&&s.jsx("div",{className:"text-xs text-muted-foreground",children:C})]}),N&&s.jsx(Ue,{size:14,className:"text-foreground mt-0.5"})]},j)}),e[19]=u,e[20]=o,e[21]=r,e[22]=n,e[23]=w):w=e[23];let A;e[24]!==w?(A=s.jsx(Bt,{align:"end",className:"p-1 w-56",children:s.jsx("div",{role:"menu",className:"flex flex-col",children:w})}),e[24]=w,e[25]=A):A=e[25];let k;return e[26]!==l||e[27]!==y||e[28]!==A?(k=s.jsxs($t,{open:l,onOpenChange:c,children:[y,A]}),e[26]=l,e[27]=y,e[28]=A,e[29]=k):k=e[29],k}function Xl(t){return t==="fast"?s.jsx(Ur,{size:16}):t==="thinking"?s.jsx(Kr,{size:16}):s.jsx(bo,{size:16})}function ei(){const t=L.c(6),e=xl(),n=gl(),r=vs();let o;t[0]!==r?(o=c=>vl(r,c),t[0]=r,t[1]=o):o=t[1];const a=o;let l;return t[2]!==n||t[3]!==a||t[4]!==e?(l=s.jsx(Zl,{tier:e,subtitleFor:a,iconFor:Xl,onSelect:n}),t[2]=n,t[3]=a,t[4]=e,t[5]=l):l=t[5],l}async function Qt(t,e,n,r,o){if(!mt(e)){ae.error("Selected model does not support file uploads");return}const a=n.type||"application/octet-stream";if(!lo(a,e)){const c=Jn(e),i=e?.title??"This model";o?o({fileName:n.name,modelName:i,accepted:c}):ae.error(`"${n.name}" can't be attached`,{description:`${i} accepts ${c}.`});return}const l=10*1024*1024;if(n.size>l){ae.error(`File "${n.name}" exceeds 10MB limit`);return}try{const c=new FileReader,i=new Promise((d,m)=>{c.onload=()=>{const f=c.result;if(typeof f!="string"){m(new Error("Failed to read file as data URL"));return}const x=f.includes(",")?f.split(",")[1]??f:f;d(x)},c.onerror=m});c.readAsDataURL(n);const u=await i,V={id:crypto.randomUUID(),name:n.name,mimeType:n.type||"application/octet-stream",size:n.size,data:u};ur(t,{from:r,to:r},V)}catch(c){console.error("Failed to process file:",c),ae.error(`Failed to load file "${n.name}"`)}}function ti(t){const e=L.c(8),{editor:n,selectedModel:r,onUnsupportedFile:o}=t,a=S.useRef(si);let l,c;e[0]!==n||e[1]!==o||e[2]!==r?(l=()=>{a.current=async(V,d)=>{await Qt(n,r,V,d,o)}},c=[n,r,o],e[0]=n,e[1]=o,e[2]=r,e[3]=l,e[4]=c):(l=e[3],c=e[4]),S.useEffect(l,c);let i,u;return e[5]!==n?(i=()=>{if(n?.isDestroyed)return;const V=new _t("fileDropHandler");n.state.plugins.find(f=>f.spec.key===V)&&n.unregisterPlugin(V);const m=new vo({key:V,props:{handleDrop:(f,x,h,p)=>{if(p)return!1;const b=x.dataTransfer?.files;if(!b||b.length===0)return!1;x.preventDefault();const g=f.posAtCoords({left:x.clientX,top:x.clientY});if(!g)return!1;const v=Array.from(b),y=g.pos;for(const w of v)a.current?.(w,y);return!0},handlePaste:(f,x)=>{const h=x.clipboardData?.items;if(!h)return!1;const p=Array.from(h).filter(ni);if(p.length===0)return!1;x.preventDefault();const{from:b}=f.state.selection;for(const g of p){const v=g.getAsFile();v&&a.current?.(v,b)}return!0}}});return n.registerPlugin(m),()=>{n?.isDestroyed||n.unregisterPlugin(V)}},u=[n],e[5]=n,e[6]=i,e[7]=u):(i=e[6],u=e[7]),S.useEffect(i,u),null}function ni(t){return t.kind==="file"}function si(){return Promise.resolve()}function ri(t){const e=L.c(26),{info:n,onClose:r}=t,o=n!==null;let a;e[0]!==r?(a=w=>!w&&r(),e[0]=r,e[1]=a):a=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=["radial-gradient(ellipse 40% 200% at -5% 100%, rgba(251,191,36,0.35) 0%, transparent 100%)","radial-gradient(ellipse 40% 200% at 105% -10%, rgba(244,114,182,0.25) 0%, transparent 100%)"],e[2]=l):l=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"absolute inset-x-0 top-0 h-36 pointer-events-none",style:{backgroundImage:l.join(", "),maskImage:"linear-gradient(to bottom, black 0%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 0%, transparent 100%)"}}),e[3]=c):c=e[3];let i,u;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"flex items-center justify-center size-9 rounded-lg bg-amber-500/15 text-amber-600 dark:text-amber-400",children:s.jsx(Rn,{size:18})}),u=s.jsx(at,{className:"text-xl font-semibold tracking-tight",children:"File type not supported"}),e[4]=i,e[5]=u):(i=e[4],u=e[5]);const V=n?.fileName;let d;e[6]!==V?(d=s.jsxs("div",{className:"relative px-8 pt-8 pb-2 overflow-hidden",children:[c,s.jsxs(ot,{className:"relative gap-4",children:[i,s.jsxs("div",{children:[u,s.jsxs(Mt,{className:"mt-1.5 text-sm leading-relaxed",children:[s.jsxs("span",{className:"font-medium text-foreground",children:["“",V,"”"]})," ","can't be attached to this chat."]})]})]})]}),e[6]=V,e[7]=d):d=e[7];const m=n?.modelName;let f;e[8]!==m?(f=s.jsxs("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground mb-2",children:[m," accepts"]}),e[8]=m,e[9]=f):f=e[9];let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(qr,{size:14,className:"text-muted-foreground"}),e[10]=x):x=e[10];const h=n?.accepted;let p;e[11]!==h?(p=s.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[x,s.jsx("span",{className:"capitalize",children:h})]}),e[11]=h,e[12]=p):p=e[12];let b;e[13]!==f||e[14]!==p?(b=s.jsx("div",{className:"px-8 pt-3 pb-6 space-y-3",children:s.jsxs("div",{className:"rounded-xl border border-border p-4",children:[f,p]})}),e[13]=f,e[14]=p,e[15]=b):b=e[15];let g;e[16]!==r?(g=s.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:s.jsx(se,{onClick:r,children:"Got it"})}),e[16]=r,e[17]=g):g=e[17];let v;e[18]!==b||e[19]!==g||e[20]!==d?(v=s.jsxs(lt,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:oi,children:[d,b,g]}),e[18]=b,e[19]=g,e[20]=d,e[21]=v):v=e[21];let y;return e[22]!==o||e[23]!==v||e[24]!==a?(y=s.jsx(it,{open:o,onOpenChange:a,children:v}),e[22]=o,e[23]=v,e[24]=a,e[25]=y):y=e[25],y}function oi(t){return t.preventDefault()}function ai(){const t=L.c(3),[e,n]=S.useState(null);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>n(null),t[0]=r):r=t[0];let o;return t[1]!==e?(o={unsupportedFile:e,onUnsupportedFile:n,clearUnsupportedFile:r},t[1]=e,t[2]=o):o=t[2],o}var li=yo;var ii=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],It=ii.join(","),ys=typeof Element>"u",Le=ys?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,et=!ys&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},tt=function(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),a=o===""||o==="true",l=a||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):tt(e.parentNode));return l},ci=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},di=function(e,n,r){if(tt(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(It));return n&&Le.call(e,It)&&o.unshift(e),o=o.filter(r),o},Et=function(e,n,r){for(var o=[],a=Array.from(e);a.length;){var l=a.shift();if(!tt(l,!1))if(l.tagName==="SLOT"){var c=l.assignedElements(),i=c.length?c:l.children,u=Et(i,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:l,candidates:u})}else{var V=Le.call(l,It);V&&r.filter(l)&&(n||!e.includes(l))&&o.push(l);var d=l.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(l),m=!tt(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(d&&m){var f=Et(d===!0?l.children:d.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:l,candidates:f})}else a.unshift.apply(a,l.children)}}return o},As=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},ws=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||ci(e))&&!As(e)?0:e.tabIndex},Vi=function(e,n){var r=ws(e);return r<0&&n&&!As(e)?0:r},ui=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},js=function(e){return e.tagName==="INPUT"},fi=function(e){return js(e)&&e.type==="hidden"},mi=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},pi=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},hi=function(e){if(!e.name)return!0;var n=e.form||et(e),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(l){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",l.message),!1}var a=pi(o,e.form);return!a||a===e},xi=function(e){return js(e)&&e.type==="radio"},gi=function(e){return xi(e)&&!hi(e)},bi=function(e){var n,r=e&&et(e),o=(n=r)===null||n===void 0?void 0:n.host,a=!1;if(r&&r!==e){var l,c,i;for(a=!!((l=o)!==null&&l!==void 0&&(c=l.ownerDocument)!==null&&c!==void 0&&c.contains(o)||e!=null&&(i=e.ownerDocument)!==null&&i!==void 0&&i.contains(e));!a&&o;){var u,V,d;r=et(o),o=(u=r)===null||u===void 0?void 0:u.host,a=!!((V=o)!==null&&V!==void 0&&(d=V.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return a},gn=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},vi=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var a=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!a}if(getComputedStyle(e).visibility==="hidden")return!0;var l=Le.call(e,"details>summary:first-of-type"),c=l?e.parentElement:e;if(Le.call(c,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var i=e;e;){var u=e.parentElement,V=et(e);if(u&&!u.shadowRoot&&o(u)===!0)return gn(e);e.assignedSlot?e=e.assignedSlot:!u&&V!==e.ownerDocument?e=V.host:e=u}e=i}if(bi(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return gn(e);return!1},yi=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Le.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},Ai=function(e,n){return!(n.disabled||fi(n)||vi(n,e)||mi(n)||yi(n))},bn=function(e,n){return!(gi(n)||ws(n)<0||!Ai(e,n))},wi=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Ss=function(e){var n=[],r=[];return e.forEach(function(o,a){var l=!!o.scopeParent,c=l?o.scopeParent:o,i=Vi(c,l),u=l?Ss(o.candidates):c;i===0?l?n.push.apply(n,u):n.push(c):r.push({documentOrder:a,tabIndex:i,item:o,isScope:l,content:u})}),r.sort(ui).reduce(function(o,a){return a.isScope?o.push.apply(o,a.content):o.push(a.content),o},[]).concat(n)},Cs=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Et([e],n.includeContainer,{filter:bn.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:wi}):r=di(e,n.includeContainer,bn.bind(null,n)),Ss(r)};function ji(){return/apple/i.test(navigator.vendor)}const vn="data-floating-ui-focusable";function Si(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function Rt(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Gs(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Te(t){return"composedPath"in t?t.composedPath()[0]:t.target}function yt(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function Ci(t){return t.matches("html,body")}function $e(t){return t?.ownerDocument||document}function Ni(t){return t?t.hasAttribute(vn)?t:t.querySelector("["+vn+"]")||t:null}function Ge(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var a;return o.parentId===e&&(!n||((a=o.context)==null?void 0:a.open))}).flatMap(o=>[o,...Ge(t,o.id,n)])}function ki(t){return"nativeEvent"in t}var _i=typeof document<"u",Ii=function(){},me=_i?S.useLayoutEffect:Ii;const Ei={...Pn},Ri=Ei.useInsertionEffect,Ti=Ri||(t=>t());function ke(t){const e=S.useRef(()=>{});return Ti(()=>{e.current=t}),S.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const Ns=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ks(t,e){const n=Cs(t,Ns()),r=n.length;if(r===0)return;const o=Si($e(t)),a=n.indexOf(o),l=a===-1?e===1?0:r-1:a+e;return n[l]}function Pi(t){return ks($e(t).body,1)||t}function Di(t){return ks($e(t).body,-1)||t}function At(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!Rt(n,r)}function Mi(t){Cs(t,Ns()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function yn(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const Fi="data-floating-ui-focusable",An="active",wn="selected",Oi={...Pn};let jn=!1,Li=0;const Sn=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Li++;function $i(){const[t,e]=S.useState(()=>jn?Sn():void 0);return me(()=>{t==null&&e(Sn())},[]),S.useEffect(()=>{jn=!0},[]),t}const zi=Oi.useId,Yt=zi||$i;function Bi(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const Ui=S.createContext(null),Ki=S.createContext(null),_s=()=>{var t;return((t=S.useContext(Ui))==null?void 0:t.id)||null},Is=()=>S.useContext(Ki);function Ht(t){return"data-floating-ui-"+t}const qi={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},Cn=S.forwardRef(function(e,n){const[r,o]=S.useState();me(()=>{ji()&&o("button")},[]);const a={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Ht("focus-guard")]:"",style:qi};return s.jsx("span",{...e,...a})}),Qi={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Es=S.createContext(null),Nn=Ht("portal");function Yi(t){t===void 0&&(t={});const{id:e,root:n}=t,r=Yt(),o=Gi(),[a,l]=S.useState(null),c=S.useRef(null);return me(()=>()=>{a?.remove(),queueMicrotask(()=>{c.current=null})},[a]),me(()=>{if(!r||c.current)return;const i=e?document.getElementById(e):null;if(!i)return;const u=document.createElement("div");u.id=r,u.setAttribute(Nn,""),i.appendChild(u),c.current=u,l(u)},[e,r]),me(()=>{if(n===null||!r||c.current)return;let i=n||o?.portalNode;i&&!nr(i)&&(i=i.current),i=i||document.body;let u=null;e&&(u=document.createElement("div"),u.id=e,i.appendChild(u));const V=document.createElement("div");V.id=r,V.setAttribute(Nn,""),i=u||i,i.appendChild(V),c.current=V,l(V)},[e,n,r,o]),a}function Hi(t){const{children:e,id:n,root:r,preserveTabOrder:o=!0}=t,a=Yi({id:n,root:r}),[l,c]=S.useState(null),i=S.useRef(null),u=S.useRef(null),V=S.useRef(null),d=S.useRef(null),m=l?.modal,f=l?.open,x=!!l&&!l.modal&&l.open&&o&&!!(r||a);return S.useEffect(()=>{if(!a||!o||m)return;function h(p){a&&At(p)&&(p.type==="focusin"?yn:Mi)(a)}return a.addEventListener("focusin",h,!0),a.addEventListener("focusout",h,!0),()=>{a.removeEventListener("focusin",h,!0),a.removeEventListener("focusout",h,!0)}},[a,o,m]),S.useEffect(()=>{a&&(f||yn(a))},[f,a]),s.jsxs(Es.Provider,{value:S.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:i,afterOutsideRef:u,beforeInsideRef:V,afterInsideRef:d,portalNode:a,setFocusManagerState:c}),[o,a]),children:[x&&a&&s.jsx(Cn,{"data-type":"outside",ref:i,onFocus:h=>{if(At(h,a)){var p;(p=V.current)==null||p.focus()}else{const b=l?l.domReference:null,g=Di(b);g?.focus()}}}),x&&a&&s.jsx("span",{"aria-owns":a.id,style:Qi}),a&&Js.createPortal(e,a),x&&a&&s.jsx(Cn,{"data-type":"outside",ref:u,onFocus:h=>{if(At(h,a)){var p;(p=d.current)==null||p.focus()}else{const b=l?l.domReference:null,g=Pi(b);g?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,h.nativeEvent,"focus-out")}}})]})}const Gi=()=>S.useContext(Es),Wi={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Ji={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},kn=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function Zi(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:a}=t,{enabled:l=!0,escapeKey:c=!0,outsidePress:i=!0,outsidePressEvent:u="pointerdown",referencePress:V=!1,referencePressEvent:d="pointerdown",ancestorScroll:m=!1,bubbles:f,capture:x}=e,h=Is(),p=ke(typeof i=="function"?i:()=>!1),b=typeof i=="function"?p:i,g=S.useRef(!1),{escapeKey:v,outsidePress:y}=kn(f),{escapeKey:w,outsidePress:A}=kn(x),k=S.useRef(!1),j=ke(_=>{var R;if(!n||!l||!c||_.key!=="Escape"||k.current)return;const O=(R=a.current.floatingContext)==null?void 0:R.nodeId,D=h?Ge(h.nodesRef.current,O):[];if(!v&&(_.stopPropagation(),D.length>0)){let I=!0;if(D.forEach(F=>{var $;if(($=F.context)!=null&&$.open&&!F.context.dataRef.current.__escapeKeyBubbles){I=!1;return}}),!I)return}r(!1,ki(_)?_.nativeEvent:_,"escape-key")}),C=ke(_=>{var R;const O=()=>{var D;j(_),(D=Te(_))==null||D.removeEventListener("keydown",O)};(R=Te(_))==null||R.addEventListener("keydown",O)}),P=ke(_=>{var R;const O=a.current.insideReactTree;a.current.insideReactTree=!1;const D=g.current;if(g.current=!1,u==="click"&&D||O||typeof b=="function"&&!b(_))return;const I=Te(_),F="["+Ht("inert")+"]",$=$e(o.floating).querySelectorAll(F);let z=ce(I)?I:null;for(;z&&!gt(z);){const Q=Xs(z);if(gt(Q)||!ce(Q))break;z=Q}if($.length&&ce(I)&&!Ci(I)&&!Rt(I,o.floating)&&Array.from($).every(Q=>!Rt(z,Q)))return;if(er(I)&&E){const Q=gt(I),q=tr(I),Y=/auto|scroll/,J=Q||Y.test(q.overflowX),Z=Q||Y.test(q.overflowY),X=J&&I.clientWidth>0&&I.scrollWidth>I.clientWidth,te=Z&&I.clientHeight>0&&I.scrollHeight>I.clientHeight,ee=q.direction==="rtl",H=te&&(ee?_.offsetX<=I.offsetWidth-I.clientWidth:_.offsetX>I.clientWidth),re=X&&_.offsetY>I.clientHeight;if(H||re)return}const K=(R=a.current.floatingContext)==null?void 0:R.nodeId,M=h&&Ge(h.nodesRef.current,K).some(Q=>{var q;return yt(_,(q=Q.context)==null?void 0:q.elements.floating)});if(yt(_,o.floating)||yt(_,o.domReference)||M)return;const U=h?Ge(h.nodesRef.current,K):[];if(U.length>0){let Q=!0;if(U.forEach(q=>{var Y;if((Y=q.context)!=null&&Y.open&&!q.context.dataRef.current.__outsidePressBubbles){Q=!1;return}}),!Q)return}r(!1,_,"outside-press")}),N=ke(_=>{var R;const O=()=>{var D;P(_),(D=Te(_))==null||D.removeEventListener(u,O)};(R=Te(_))==null||R.addEventListener(u,O)});S.useEffect(()=>{if(!n||!l)return;a.current.__escapeKeyBubbles=v,a.current.__outsidePressBubbles=y;let _=-1;function R($){r(!1,$,"ancestor-scroll")}function O(){window.clearTimeout(_),k.current=!0}function D(){_=window.setTimeout(()=>{k.current=!1},Zs()?5:0)}const I=$e(o.floating);c&&(I.addEventListener("keydown",w?C:j,w),I.addEventListener("compositionstart",O),I.addEventListener("compositionend",D)),b&&I.addEventListener(u,A?N:P,A);let F=[];return m&&(ce(o.domReference)&&(F=xt(o.domReference)),ce(o.floating)&&(F=F.concat(xt(o.floating))),!ce(o.reference)&&o.reference&&o.reference.contextElement&&(F=F.concat(xt(o.reference.contextElement)))),F=F.filter($=>{var z;return $!==((z=I.defaultView)==null?void 0:z.visualViewport)}),F.forEach($=>{$.addEventListener("scroll",R,{passive:!0})}),()=>{c&&(I.removeEventListener("keydown",w?C:j,w),I.removeEventListener("compositionstart",O),I.removeEventListener("compositionend",D)),b&&I.removeEventListener(u,A?N:P,A),F.forEach($=>{$.removeEventListener("scroll",R)}),window.clearTimeout(_)}},[a,o,c,b,u,n,r,m,l,v,y,j,w,C,P,A,N]),S.useEffect(()=>{a.current.insideReactTree=!1},[a,b,u]);const T=S.useMemo(()=>({onKeyDown:j,...V&&{[Wi[d]]:_=>{r(!1,_.nativeEvent,"reference-press")},...d!=="click"&&{onClick(_){r(!1,_.nativeEvent,"reference-press")}}}}),[j,r,V,d]),E=S.useMemo(()=>{function _(R){R.button===0&&(g.current=!0)}return{onKeyDown:j,onMouseDown:_,onMouseUp:_,[Ji[u]]:()=>{a.current.insideReactTree=!0}}},[j,u,a]);return S.useMemo(()=>l?{reference:T,floating:E}:{},[l,T,E])}function Xi(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=Yt(),a=S.useRef({}),[l]=S.useState(()=>Bi()),c=_s()!=null,[i,u]=S.useState(r.reference),V=ke((f,x,h)=>{a.current.openEvent=f?x:void 0,l.emit("openchange",{open:f,event:x,reason:h,nested:c}),n?.(f,x,h)}),d=S.useMemo(()=>({setPositionReference:u}),[]),m=S.useMemo(()=>({reference:i||r.reference||null,floating:r.floating||null,domReference:r.reference}),[i,r.reference,r.floating]);return S.useMemo(()=>({dataRef:a,open:e,onOpenChange:V,elements:m,events:l,floatingId:o,refs:d}),[e,V,m,l,o,d])}function ec(t){t===void 0&&(t={});const{nodeId:e}=t,n=Xi({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[a,l]=S.useState(null),[c,i]=S.useState(null),V=o?.domReference||a,d=S.useRef(null),m=Is();me(()=>{V&&(d.current=V)},[V]);const f=Ws({...t,elements:{...o,...c&&{reference:c}}}),x=S.useCallback(v=>{const y=ce(v)?{getBoundingClientRect:()=>v.getBoundingClientRect(),getClientRects:()=>v.getClientRects(),contextElement:v}:v;i(y),f.refs.setReference(y)},[f.refs]),h=S.useCallback(v=>{(ce(v)||v===null)&&(d.current=v,l(v)),(ce(f.refs.reference.current)||f.refs.reference.current===null||v!==null&&!ce(v))&&f.refs.setReference(v)},[f.refs]),p=S.useMemo(()=>({...f.refs,setReference:h,setPositionReference:x,domReference:d}),[f.refs,h,x]),b=S.useMemo(()=>({...f.elements,domReference:V}),[f.elements,V]),g=S.useMemo(()=>({...f,...r,refs:p,elements:b,nodeId:e}),[f,p,b,e,r]);return me(()=>{r.dataRef.current.floatingContext=g;const v=m?.nodesRef.current.find(y=>y.id===e);v&&(v.context=g)}),S.useMemo(()=>({...f,context:g,refs:p,elements:b}),[f,p,b,g])}function wt(t,e,n){const r=new Map,o=n==="item";let a=t;if(o&&t){const{[An]:l,[wn]:c,...i}=t;a=i}return{...n==="floating"&&{tabIndex:-1,[Fi]:""},...a,...e.map(l=>{const c=l?l[n]:null;return typeof c=="function"?t?c(t):null:c}).concat(t).reduce((l,c)=>(c&&Object.entries(c).forEach(i=>{let[u,V]=i;if(!(o&&[An,wn].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof V=="function"){var d;(d=r.get(u))==null||d.push(V),l[u]=function(){for(var m,f=arguments.length,x=new Array(f),h=0;h<f;h++)x[h]=arguments[h];return(m=r.get(u))==null?void 0:m.map(p=>p(...x)).find(p=>p!==void 0)}}}else l[u]=V}),l),{})}}function tc(t){t===void 0&&(t=[]);const e=t.map(c=>c?.reference),n=t.map(c=>c?.floating),r=t.map(c=>c?.item),o=S.useCallback(c=>wt(c,t,"reference"),e),a=S.useCallback(c=>wt(c,t,"floating"),n),l=S.useCallback(c=>wt(c,t,"item"),r);return S.useMemo(()=>({getReferenceProps:o,getFloatingProps:a,getItemProps:l}),[o,a,l])}const nc=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function sc(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:a,floatingId:l}=t,{enabled:c=!0,role:i="dialog"}=e,u=Yt(),V=((n=a.domReference)==null?void 0:n.id)||u,d=S.useMemo(()=>{var g;return((g=Ni(a.floating))==null?void 0:g.id)||l},[a.floating,l]),m=(r=nc.get(i))!=null?r:i,x=_s()!=null,h=S.useMemo(()=>m==="tooltip"||i==="label"?{["aria-"+(i==="label"?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":m==="alertdialog"?"dialog":m,"aria-controls":o?d:void 0,...m==="listbox"&&{role:"combobox"},...m==="menu"&&{id:V},...m==="menu"&&x&&{role:"menuitem"},...i==="select"&&{"aria-autocomplete":"none"},...i==="combobox"&&{"aria-autocomplete":"list"}},[m,d,x,o,V,i]),p=S.useMemo(()=>{const g={id:d,...m&&{role:m}};return m==="tooltip"||i==="label"?g:{...g,...m==="menu"&&{"aria-labelledby":V}}},[m,d,V,i]),b=S.useCallback(g=>{let{active:v,selected:y}=g;const w={role:"option",...v&&{id:d+"-fui-option"}};switch(i){case"select":case"combobox":return{...w,"aria-selected":y}}return{}},[d,i]);return S.useMemo(()=>c?{reference:h,floating:p,item:b}:{},[c,h,p,b])}function rc(t){const e=L.c(24),{editor:n,query:r,items:o,onSelect:a,onClose:l}=t,[c,i]=S.useState(0),u=S.useRef(o),V=S.useRef(c),d=S.useRef(a),m=S.useRef(l),f=S.useDeferredValue(r);let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{i(0)},e[0]=x):x=e[0];let h;e[1]!==f?(h=[f],e[1]=f,e[2]=h):h=e[2],S.useEffect(x,h);let p,b;e[3]!==o.length||e[4]!==c?(p=()=>{c>=o.length&&o.length>0&&i(0)},b=[o.length,c],e[3]=o.length,e[4]=c,e[5]=p,e[6]=b):(p=e[5],b=e[6]),S.useEffect(p,b);let g,v;e[7]!==o?(g=()=>{u.current=o},v=[o],e[7]=o,e[8]=g,e[9]=v):(g=e[8],v=e[9]),S.useEffect(g,v);let y,w;e[10]!==c?(y=()=>{V.current=c},w=[c],e[10]=c,e[11]=y,e[12]=w):(y=e[11],w=e[12]),S.useEffect(y,w);let A,k;e[13]!==a?(k=()=>{d.current=a},A=[a],e[13]=a,e[14]=A,e[15]=k):(A=e[14],k=e[15]),S.useEffect(k,A);let j,C;e[16]!==l?(j=()=>{m.current=l},C=[l],e[16]=l,e[17]=j,e[18]=C):(j=e[17],C=e[18]),S.useEffect(j,C);let P,N;e[19]!==n?(P=()=>{if(n?.isDestroyed)return;let _;try{_=n.view.dom}catch{return}if(!_)return;const R=D=>{const I=u.current;if(!I.length)return!1;const F=()=>i(z=>(z+1)%I.length),$=()=>i(z=>(z-1+I.length)%I.length);switch(D.key){case"ArrowUp":return D.preventDefault(),$(),!0;case"ArrowDown":return D.preventDefault(),F(),!0;case"Tab":return D.preventDefault(),D.shiftKey?$():F(),!0;case"Home":return D.preventDefault(),i(0),!0;case"End":return D.preventDefault(),i(I.length-1),!0;case"Enter":{if(D.isComposing)return!1;D.preventDefault();const z=V.current;return z!==-1&&I[z]&&d.current?.(I[z],z),!0}case"Escape":return D.preventDefault(),m.current?.(),!0;default:return!1}},O=D=>{R(D)};return _.addEventListener("keydown",O,!0),()=>{_?.removeEventListener("keydown",O,!0)}},N=[n],e[19]=n,e[20]=P,e[21]=N):(P=e[20],N=e[21]),S.useEffect(P,N);const T=o.length?c:void 0;let E;return e[22]!==T?(E={selectedIndex:T,setSelectedIndex:i},e[22]=T,e[23]=E):E=e[23],E}function oc(t,e){switch(e.type){case"SET_SELECTED_ITEM":return{...t,selectedItem:e.payload};case"ON_START":return{...t,open:!0,selectedItem:null,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_UPDATE":return{...t,element:e.payload.element,query:e.payload.query,range:e.payload.range};case"ON_EXIT":return{open:!1,element:null,query:"",range:null,selectedItem:null};default:return t}}const Rs=S.createContext(void 0);function Ts(){const t=S.useContext(Rs);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function ac({editor:t,char:e,pluginKey:n,allow:r,onOpenChange:o}){const[a,l]=S.useReducer(oc,{open:!1,element:null,query:"",range:null,selectedItem:null}),c=S.useRef(o);return c.current=o,S.useEffect(()=>{if(t?.isDestroyed)return;const i=n instanceof _t?n:new _t(n);t.state.plugins.find(d=>d.spec.key===i)&&t.unregisterPlugin(i);const V=Co({pluginKey:i,editor:t,char:e,allow(d){const m=t.state.doc.resolve(d.range.from);for(let f=m.depth;f>0;f--)if(m.node(f).type.name==="image")return!1;return!(r&&!r(d))},command(){},render:()=>({onStart:d=>{l({type:"ON_START",payload:{element:d.decorationNode??null,query:d.query,range:d.range}}),c.current?.(!0)},onUpdate:d=>{l({type:"ON_UPDATE",payload:{element:d.decorationNode??null,query:d.query,range:d.range}})},onKeyDown:d=>d.event.key==="Escape"?(l({type:"ON_EXIT"}),!0):!1,onExit:()=>{l({type:"ON_EXIT"}),c.current?.(!1)}}),items:()=>[]});return t.registerPlugin(V),()=>{t?.isDestroyed||t.unregisterPlugin(i)}},[t,n,e,l,r]),{state:a,dispatch:l}}function lc({editor:t,queryKey:e,queryFn:n,onSelect:r}){const{state:o,dispatch:a}=Ts(),l=S.useDeferredValue(o.query),{data:c}=sr({queryKey:Ie.suggestionItems(e,o.open,l),queryFn:()=>o.open?n({query:l}):[]}),i=()=>{a({type:"ON_EXIT"})},u=async(d,m)=>{if(!(o.selectedItem!==null||!o.range)){a({type:"SET_SELECTED_ITEM",payload:d});try{const{view:f}=t,h=f.state.selection.$to.nodeAfter?.text?.startsWith(" "),p=o.range?{...o.range}:{from:0,to:0};h&&o.range&&(p.to+=1),await r({range:p,item:d})===!1?a({type:"SET_SELECTED_ITEM",payload:null}):i()}catch{i()}}},{selectedIndex:V}=rc({editor:t,query:l,items:c,onSelect:u,onClose:i});return{selectedItem:o.selectedItem,items:c,selectedIndex:V,close:i,onSelect:u}}function ic({children:t}){const{state:e,dispatch:n}=Ts(),{open:r,element:o}=e,a=()=>{n({type:"ON_EXIT"})},{refs:l,floatingStyles:c,context:i}=ec({placement:"bottom-start",open:r,onOpenChange:m=>{m||a()},elements:{reference:o},middleware:[rr(10),or(),ar()],whileElementsMounted:lr}),u=Zi(i,{outsidePress:m=>!(m.target instanceof Element&&m.target.closest(".ProseMirror"))}),V=sc(i,{role:"listbox"}),{getFloatingProps:d}=tc([u,V]);return r?s.jsx(Hi,{children:s.jsx("div",{ref:l.setFloating,style:c,...d(),className:"z-50 w-auto min-w-[360px] max-w-[520px] rounded-lg border bg-popover p-0 text-popover-foreground shadow-md outline-hidden overflow-hidden",children:t})}):null}const cc=t=>{const e=L.c(29),{item:n,isSelected:r,onSelect:o,isLoading:a,ref:l}=t;let c;if(e[0]!==n){const A=Ve(n._meta);c=n.title||Dt(n.name,A),e[0]=n,e[1]=c}else c=e[1];const i=c,u=n.description||null,V=n.icon,d=r&&"bg-accent text-accent-foreground",m=a&&"pointer-events-none opacity-50";let f;e[2]!==d||e[3]!==m?(f=B("relative flex w-full cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground","focus:bg-accent focus:text-accent-foreground",d,m),e[2]=d,e[3]=m,e[4]=f):f=e[4];let x;e[5]!==V||e[6]!==i?(x=V!==void 0&&s.jsx(Bn,{icon:V,name:i,size:"xs",className:"mr-2"}),e[5]=V,e[6]=i,e[7]=x):x=e[7];let h;e[8]!==i?(h=s.jsx("span",{className:"font-medium flex items-center truncate capitalize",children:i}),e[8]=i,e[9]=h):h=e[9];let p;e[10]!==a?(p=a&&s.jsx(jt,{size:"xs"}),e[10]=a,e[11]=p):p=e[11];let b;e[12]!==h||e[13]!==p?(b=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h,p]}),e[12]=h,e[13]=p,e[14]=b):b=e[14];let g;e[15]!==u?(g=u&&s.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:u}),e[15]=u,e[16]=g):g=e[16];let v;e[17]!==b||e[18]!==g?(v=s.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[b,g]}),e[17]=b,e[18]=g,e[19]=v):v=e[19];let y;e[20]!==n.drillable?(y=n.drillable&&s.jsx("kbd",{className:"shrink-0 ml-2 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground bg-muted border border-border rounded",children:"↵"}),e[20]=n.drillable,e[21]=y):y=e[21];let w;return e[22]!==o||e[23]!==l||e[24]!==v||e[25]!==y||e[26]!==f||e[27]!==x?(w=s.jsxs("div",{ref:l,onClick:o,className:f,children:[x,v,y]}),e[22]=o,e[23]=l,e[24]=v,e[25]=y,e[26]=f,e[27]=x,e[28]=w):w=e[28],w},dc=t=>{const e=L.c(18),{editor:n,queryKey:r,queryFn:o,onSelect:a}=t;let l;e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==r?(l={editor:n,queryKey:r,queryFn:o,onSelect:a},e[0]=n,e[1]=a,e[2]=o,e[3]=r,e[4]=l):l=e[4];const{items:c,selectedIndex:i,onSelect:u,selectedItem:V}=lc(l);if(!c.length){let x;return e[5]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md border shadow-md p-3 text-sm",children:"No items found"}),e[5]=x):x=e[5],x}let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d={maxHeight:"min(320px, var(--radix-popover-content-available-height, 320px))"},e[6]=d):d=e[6];let m;if(e[7]!==u||e[8]!==c||e[9]!==i||e[10]!==V?.name){let x;e[12]!==u||e[13]!==i||e[14]!==V?.name?(x=(h,p)=>s.jsx(cc,{item:h,isSelected:p===i,ref:p===i?fc:void 0,onSelect:()=>u(h,p),isLoading:V?.name===h.name},h.name),e[12]=u,e[13]=i,e[14]=V?.name,e[15]=x):x=e[15],m=c.map(x),e[7]=u,e[8]=c,e[9]=i,e[10]=V?.name,e[11]=m}else m=e[11];let f;return e[16]!==m?(f=s.jsx("div",{className:"min-w-[360px] max-w-[520px] bg-popover text-popover-foreground rounded-md overflow-y-auto",style:d,children:s.jsx("div",{className:"p-1",children:m})}),e[16]=m,e[17]=f):f=e[17],f};function Vc(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"p-1",children:[...Array(3)].map(uc)}),t[0]=e):e=t[0],e}function uc(t,e){return s.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 animate-pulse",children:[s.jsx("div",{className:"h-4 w-24 bg-muted rounded"}),s.jsx("div",{className:"h-3 w-32 bg-muted rounded"})]},e)}function Ps(t){const e=L.c(18),{editor:n,char:r,pluginKey:o,queryKey:a,queryFn:l,onSelect:c,allow:i,onOpenChange:u}=t;let V;e[0]!==i||e[1]!==r||e[2]!==n||e[3]!==u||e[4]!==o?(V={editor:n,char:r,pluginKey:o,allow:i,onOpenChange:u},e[0]=i,e[1]=r,e[2]=n,e[3]=u,e[4]=o,e[5]=V):V=e[5];const{state:d,dispatch:m}=ac(V);let f;e[6]!==m||e[7]!==d?(f={state:d,dispatch:m},e[6]=m,e[7]=d,e[8]=f):f=e[8];let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Vc,{}),e[9]=x):x=e[9];let h;e[10]!==n||e[11]!==c||e[12]!==l||e[13]!==a?(h=s.jsx(ic,{children:s.jsx(S.Suspense,{fallback:x,children:s.jsx(dc,{editor:n,queryKey:a,queryFn:l,onSelect:c})})}),e[10]=n,e[11]=c,e[12]=l,e[13]=a,e[14]=h):h=e[14];let p;return e[15]!==f||e[16]!==h?(p=s.jsx(Rs.Provider,{value:f,children:h}),e[15]=f,e[16]=h,e[17]=p):p=e[17],p}function fc(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const mc=[{name:"agents",title:"Agents",description:"Mention an agent to hand off work",kind:"category",drillable:!0},{name:"resources",title:"Resources",description:"Attach a resource as context",kind:"category",drillable:!0}],pc=({editor:t,virtualMcpId:e})=>{const n=ze(),{org:r}=ie(),o=Lr(),a=de({connectionId:e,orgId:r.id,orgSlug:r.slug}),l=Ie.virtualMcpResources(e,r.id),[c,i]=S.useState("categories"),u=S.useRef(c);u.current=c;const V=S.useRef(null),d=S.useRef(!1),m=["at-mention",r.id,e??"default",c],f=async({item:p,range:b})=>{if(W("chat_picker_item_selected",{picker:"@",item_kind:p.kind,item_name:p.name}),p.kind!=="category"&&(d.current=!0),p.kind==="category")return i(p.name==="agents"?"agents":"resources"),!1;if(p.kind==="agent"&&p.agentId){Oe(t,b,{id:p.agentId,name:p.name,metadata:{agentId:p.agentId,title:p.name},char:"@"}),i("categories");return}if(p.kind==="resource"&&p.uri&&a){try{const g=await Xn(a,p.uri);Oe(t,b,{id:p.uri,name:p.uri,metadata:g.contents,char:"@"})}catch(g){console.error("[at-mention] Failed to fetch resource:",g),ae.error("Failed to load resource. Please try again.")}i("categories");return}},x=async p=>{const{query:b}=p,g=u.current;if(g==="categories"){if(!b.trim())return mc;const w=b.toLowerCase(),A=o.filter(j=>j.status==="active"&&(!j.id||!Jt(j.id))&&j.id!==e&&(j.title.toLowerCase().includes(w)||j.description?.toLowerCase().includes(w))).map(j=>({name:j.title,title:j.title,description:j.description??void 0,icon:j.icon??null,kind:"agent",agentId:j.id})),k=await(async()=>{if(!a)return[];let j=n.getQueryData(l);return j||(j=await n.fetchQuery({queryKey:l,queryFn:()=>Fe(a),staleTime:6e4})),(j?.resources??[]).filter(C=>C.uri.toLowerCase().includes(w)||C.name?.toLowerCase().includes(w)||C.description?.toLowerCase().includes(w)).map(C=>({name:C.name??C.uri,title:C.name,description:C.description,kind:"resource",uri:C.uri}))})();return[...A,...k]}if(g==="agents"){let w=o.filter(A=>A.status==="active"&&(!A.id||!Jt(A.id))&&A.id!==e);if(b.trim()){const A=b.toLowerCase();w=w.filter(k=>k.title.toLowerCase().includes(A)||k.description?.toLowerCase().includes(A))}return w.map(A=>({name:A.title,title:A.title,description:A.description??void 0,icon:A.icon??null,kind:"agent",agentId:A.id}))}if(!a)return[];let v=n.getQueryData(l);v?n.fetchQuery({queryKey:l,queryFn:()=>Fe(a),staleTime:6e4}).catch(()=>{}):v=await n.fetchQuery({queryKey:l,queryFn:()=>Fe(a),staleTime:6e4});let y=v?.resources??[];if(b.trim()){const w=b.toLowerCase();y=y.filter(A=>A.uri.toLowerCase().includes(w)||A.name?.toLowerCase().includes(w)||A.description?.toLowerCase().includes(w))}return y.map(w=>({name:w.name??w.uri,title:w.name,description:w.description,kind:"resource",uri:w.uri}))},h=p=>{if(p)V.current=Date.now(),d.current=!1,W("chat_picker_opened",{picker:"@"});else{const b=V.current;W("chat_picker_closed",{picker:"@",outcome:d.current?"selected":"dismissed",duration_ms:b?Date.now()-b:null}),V.current=null,i("categories")}};return s.jsx(Ps,{editor:t,char:"@",pluginKey:"atDropdownMenu",queryKey:m,queryFn:x,onSelect:f,onOpenChange:h})};async function _n(t,e,n,r,o,a){try{const l=await Vt(n,r,a);Oe(t,e,{id:r,name:st(r,o),metadata:l.messages,char:"/",kind:"prompt",args:a})}catch(l){console.error("[slash] Failed to fetch prompt:",l),ae.error("Failed to load prompt. Please try again.")}}async function hc(t,e,n,r){try{const o=await Xn(n,r);Oe(t,e,{id:r,name:r,metadata:o.contents,char:"/",kind:"resource"})}catch(o){console.error("[slash] Failed to fetch resource:",o),ae.error("Failed to load resource. Please try again.")}}const xc=({editor:t,virtualMcpId:e})=>{const n=ze(),{org:r}=ie(),o=de({connectionId:e,orgId:r.id,orgSlug:r.slug}),a=Ie.virtualMcpPrompts(e,r.id),l=Ie.virtualMcpResources(e,r.id),c=["slash-mention",r.id,e??"default"],[i,u]=S.useState(null),[V,d]=S.useState(null),m=fr(t);m&&(m.onEditChip=async y=>{if(o)try{const A=(await In(n,a,o)).find(k=>k.name===y.promptId);if(!A?.arguments||A.arguments.length===0)return;d({...y,prompt:A})}catch(w){console.error("[slash] Failed to load prompt for editing:",w),ae.error("Failed to load prompt. Please try again.")}});const f=S.useRef(null),x=S.useRef(!1),h=async({item:y,range:w})=>{if(W("chat_picker_item_selected",{picker:"/",item_kind:y.kind,item_name:y.name}),x.current=!0,!!o)if(y.kind==="prompt"){if(y.arguments&&y.arguments.length>0){u({range:w,item:y});return}const A=Ve(y._meta);await _n(t,w,o,y.name,A)}else y.uri&&await hc(t,w,o,y.uri)},p=async y=>{if(!i||!o)return;const{range:w,item:A}=i,k=Ve(A._meta);await _n(t,w,o,A.name,k,y),u(null)},b=async y=>{if(!(!V||!o)){try{const w=await Vt(o,V.promptId,y),A=Ve(V.prompt._meta);t.chain().focus().setNodeSelection(V.pos).deleteSelection().insertContentAt(V.pos,Mn({id:V.promptId,name:st(V.promptId,A),metadata:w.messages,char:"/",kind:"prompt",args:y})).run(),W("chat_picker_item_selected",{picker:"/edit",item_kind:"prompt",item_name:V.promptId})}catch(w){console.error("[slash] Failed to update prompt:",w),ae.error("Failed to update prompt. Please try again.")}d(null)}},g=async y=>{const{query:w}=y;if(!o)return[];const[A,k]=await Promise.all([In(n,a,o),gc(n,l,o)]),j=w.trim().toLowerCase(),C=(A??[]).filter(N=>!j||N.name.toLowerCase().includes(j)||N.title?.toLowerCase().includes(j)||N.description?.toLowerCase().includes(j)).map(N=>({name:N.name,title:N.title,description:N.description,kind:"prompt",arguments:N.arguments,_meta:N._meta})),P=(k??[]).filter(N=>!j||N.uri.toLowerCase().includes(j)||N.name?.toLowerCase().includes(j)||N.description?.toLowerCase().includes(j)).map(N=>({name:N.name??N.uri,title:N.name,description:N.description,kind:"resource",uri:N.uri}));return[...C,...P]},v=i?.item.kind==="prompt"?{name:i.item.name,title:i.item.title,arguments:i.item.arguments,description:i.item.description,_meta:i.item._meta}:null;return s.jsxs(s.Fragment,{children:[s.jsx(Ps,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:c,queryFn:g,onSelect:h,onOpenChange:y=>{if(y)f.current=Date.now(),x.current=!1,W("chat_picker_opened",{picker:"/"});else{const w=f.current;W("chat_picker_closed",{picker:"/",outcome:x.current?"selected":"dismissed",duration_ms:w?Date.now()-w:null}),f.current=null}}}),s.jsx(We,{prompt:v,setPrompt:()=>u(null),onSubmit:p}),s.jsx(We,{prompt:V?.prompt??null,setPrompt:()=>d(null),onSubmit:b,defaultValues:V?.args},V?`edit-${V.promptId}-${V.pos}`:"edit-idle")]})};async function In(t,e,n){let r=t.getQueryData(e);return r?t.fetchQuery({queryKey:e,queryFn:()=>Ct(n),staleTime:6e4}).catch(()=>{}):r=await t.fetchQuery({queryKey:e,queryFn:()=>Ct(n),staleTime:6e4}),r?.prompts??[]}async function gc(t,e,n){let r=t.getQueryData(e);return r?t.fetchQuery({queryKey:e,queryFn:()=>Fe(n),staleTime:6e4}).catch(()=>{}):r=await t.fetchQuery({queryKey:e,queryFn:()=>Fe(n),staleTime:6e4}),r?.resources??[]}function bc(t){return[jo.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),li.configure({placeholder:()=>t.current??"Ask anything, / for prompts, @ for agents & resources...",showOnlyWhenEditable:!1}),mr,pr]}function vc({tiptapDoc:t,setTiptapDoc:e,disabled:n=!1,enterToSubmit:r=!1,placeholder:o,onSubmit:a,children:l}){const c=S.useRef(a),i=S.useRef(e),u=S.useRef(r),V=S.useRef(o),d=Ao({extensions:bc(V),content:t||"",editorProps:{attributes:{"data-chat-input":"true",class:"prose prose-sm max-w-none focus:outline-none w-full h-full text-[15px] p-[18px]"},handleKeyDown:(m,f)=>f.key==="Enter"&&!f.shiftKey&&u.current?(f.preventDefault(),c.current?.(),!0):!1},onUpdate:({editor:m})=>{i.current(m?.getJSON())}});return S.useEffect(()=>{d?.setEditable(!n)},[d,n]),S.useEffect(()=>{c.current=a},[a]),S.useEffect(()=>{i.current=e},[e]),S.useEffect(()=>{u.current=r},[r]),S.useEffect(()=>{V.current=o},[o]),S.useEffect(()=>{if(d?.isDestroyed)return;const m=JSON.stringify(d?.getJSON()),f=JSON.stringify(t||{type:"doc",content:[]});m!==f&&d.commands.setContent(t||{type:"doc",content:[]})},[d,t]),s.jsx(wo.Provider,{value:{editor:d},children:l})}function yc(t){const e=L.c(26),{disabled:n,virtualMcpId:r,showFileUploader:o,selectedModel:a,onUnsupportedFile:l,ref:c,className:i}=t,u=n===void 0?!1:n,V=o===void 0?!1:o,{editor:d}=Ut();let m,f;if(e[0]!==d?(m=()=>({focus:()=>{d?.commands.focus()},clear:()=>{d?.commands.clearContent(!0)},appendText:j=>{if(!d)return;const C=d.state.doc.textContent.trim()==="";d.commands.focus("end"),C||d.commands.insertContent(" "),d.commands.insertContent(j)},syncVoiceText:(j,C)=>{if(d&&(d.commands.setContent(j||{type:"doc",content:[]}),C)){d.commands.focus("end");const P=d.state.doc.textContent.trim().length>0;d.commands.insertContent(P?" "+C:C)}},restoreContent:j=>{d&&d.commands.setContent(j||{type:"doc",content:[]})}}),f=[d],e[0]=d,e[1]=m,e[2]=f):(m=e[1],f=e[2]),S.useImperativeHandle(c??null,m,f),!d)return null;const x=u&&"cursor-not-allowed opacity-70",h=u&&"[&_.ProseMirror]:cursor-not-allowed";let p;e[3]!==i||e[4]!==x||e[5]!==h?(p=B("overflow-y-auto relative flex-1 max-h-[164px] min-h-[20px] w-full flex flex-col",i,"[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[20px] [&_.ProseMirror]:flex-1","[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]","[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground","[&_.ProseMirror_p.is-editor-empty:first-child::before]:opacity-50","[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left","[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none","[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0",x,h),e[3]=i,e[4]=x,e[5]=h,e[6]=p):p=e[6];let b;e[7]!==d||e[8]!==p?(b=s.jsx(So,{editor:d,className:p}),e[7]=d,e[8]=p,e[9]=b):b=e[9];const g=r??null;let v;e[10]!==d||e[11]!==g?(v=s.jsx(S.Suspense,{fallback:null,children:s.jsx(xc,{editor:d,virtualMcpId:g})}),e[10]=d,e[11]=g,e[12]=v):v=e[12];const y=r??null;let w;e[13]!==d||e[14]!==y?(w=s.jsx(S.Suspense,{fallback:null,children:s.jsx(pc,{editor:d,virtualMcpId:y})}),e[13]=d,e[14]=y,e[15]=w):w=e[15];let A;e[16]!==d||e[17]!==l||e[18]!==a||e[19]!==V?(A=V&&a?s.jsx(ti,{editor:d,selectedModel:a,onUnsupportedFile:l}):null,e[16]=d,e[17]=l,e[18]=a,e[19]=V,e[20]=A):A=e[20];let k;return e[21]!==v||e[22]!==w||e[23]!==A||e[24]!==b?(k=s.jsxs(s.Fragment,{children:[b,v,w,A]}),e[21]=v,e[22]=w,e[23]=A,e[24]=b,e[25]=k):k=e[25],k}function Ds(t){const e=L.c(3),[n]=Ee();let r;return e[0]!==n.enableSounds||e[1]!==t?(r=()=>{n.enableSounds&&Ro(t.dataUri).catch(a=>{console.warn(`[sound] ${t.name} playback failed:`,a)})},e[0]=n.enableSounds,e[1]=t,e[2]=r):r=e[2],r}const Ac={name:"switch-005",dataUri:"data:audio/mpeg;base64,SUQzBAAAAAAAIlRTU0VAAAAOAAADTGF2ZjYyLjMuMTAwAAAAAAAAAAAAAAD/+1DAAAAAAAAAAAAAAAAAAAAAAABJbmZvAAAADwAAABkAABU4ABMTEx0dHR0nJycnMTExMTs7OztERERETk5OTlhYWFhiYmJibGxsbHZ2dnZ/f39/iYmJiZOTk5OdnZ2dp6enp7GxsbG7u7u7xMTExM7Ozs7Y2NjY4uLi4uzs7Oz29vb2/////wAAAABMYXZjNjIuMTEAAAAAAAAAAAAAAAAkBVYAAAAAAAAVOPCP8KUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//tQxAAACEwDXvQRAAG8Ii93HtACUCAABAKCJwfaCEHwfeoEAQdEAYygIHBOCAIAgCAJh9QIOg+D5/ygPh/wfB8DuKAgCHyn9QPh/5SCDv+CEHAQdxOD4B27c39tbckkqYbBAYAN9bNJLB+aXAf5wQAKdzxfbmrVIRQ4xNx3HwnoDmLhfMhgJiiw/HREXNCHqjvHEPEG8QjBYlxQNepJAT0kC8ip6JzSWj1TasoG+iyycbf2Uil1ovf1f/oUtR1qP+s1WSBFKoAAU02BDjMhuP/7UsQEgws8bRpd8YABJYPeBf9wCGXTGxBYcw5AJFMFMAmQQAhGAxgLBgHIAMYAAALhgAchipbe/91aU1VV4zcZj1Vf1XgYCIMBNrsBAIGs9/Ue4i/xFPeqCqwViI9/UeLf///rOngdA3OPHFjmOBv+EQnGahgaZxVplmkAH5JadDTQlNCEuGNiWYbCCONWdUJg6HXNazFdu1T+VgaEpOP70exv7f2/4b/yH//2/4cqCX/zWRUrIw+IPNMNlDnjAXQas/I4AzmYifA0tMSCgQDF//tSxBCDSzzi3k/sQwEyCtjJ/rBZAk+Uqj1YhA5YMCAAMwgOUchTkK7OR7LbMl0W1H6SvzG0Q2ZzfKUhnmTobv9DNhS1v7P8h//8Gv8gTRt1jReZ7YEjmMQg9hhwwMycHooasFmZyjcZGBKJD+IwbMCQQLoi+IQXCcIoydKoilI2MWFS5uJdDEu2taRrYI2ZSqKY50pJLv2NfjUAAuQAMfqVQ/T3PDQgMJMeEZ45hJzY6MNoFMxqTj1zNGQKJjAxEsSCBgQJBSIL0mcKYQJfVAn/+1LEGwLKlEKrD3MiYcuMkVa/wABB8Vh6M1q1epbvXwWBURhkyEhWZ/////////////9gjZ/Wt4w+4MNMCpE4TBYQl4w1IHvMDdA2zBngBMwc8COMDhCpDAfgOAAgrBgNYU+YC0FBGAkAMpgWoSCYAGESGBGAKBgXgJOdiOJmMCmNwCYNDJhYRPykRCJhTBnEUzlsjv4UNLj/z97n3Mv/7z1nZqyitYAZIqErIwMwJAqEw0GAAMFptJMaqFwB8CQIWlhuhuDAwNjfuwrQFAYXCf/7UsQVAA+9PTP42gYRdiIu9zBwAPbFUCi0DAhgNcS+7cDwVgM05A9bUDeuQMyE/u3CygVISgZhpIau/9PhdQG2C9DpxZZJmn/dn/Psmt0EFm////l84ThUTopE4VD/9JkubOGasTvN30C20G21qgUCkVCoUCgPMywrPCGly27V5q5t24vl/8jSlSAPCxzNseNCw3oh3NGBu4BZJ5hv7DRSfR/+eWG7nA8IKh2Olv5iz3q5m3//Joxo3JqNyYkSuGt/k6D4DeoBOHmHdl0dkZYA//tSxAUAC4B1Z/2DADEcA17Z/uhI4Yoik/TrZo+ww7UtmpW4LDWu2IacoJKJJeTSM+ZmAYBEiU+ZnnAwCn1VVVV6JUJQVnioKhrgqdKgqGpUFeCp0sDR3ztQNREDRUFioKuxKCpYGQBlRIBk+aLwb8KblGQVDdphPYTUdBOGbVpAaTF6ZdjEV0iRUZRCYkA4oUQDx5zqDugtXvza/7fuNNvfZ+j9v+T/2f//J/4cAAOTpE5K4zksR9MfIB+TDcQTI4gNs1XKAzEFUrGkxABYEBb/+1LEEYNKrEjgT/TCwYYVmUX+mHoKgWhKU5Eiw9SFIRmppw+3fYo4siPhUFeexM8KgIO6wVuPDDy01qeRaVbw357//y3+o8M0pBNlNLCGBzGKwyYw2IIFOE1WNTjRM6x8MlA1AxDhUHTAkEiyKpnbWrLcaOBotBUKbk1pypcWDAIK00AhKLGkUco6q9VWvM53mcaq3tVa8zjTM/tX//EDP//////////XAAmrwAAPoKwcw0ShDCZD/BQlhzinxQdorsOuXTEIC01ZkJyu4k/qPP/7UsQUAEjkrrkvZaPBIRXUoe5QObfMhYKX9RVgTPqCSCaSCaSC0XVdV1f/////6IAlguuAJSiDRNloNBsZg+0+Ts8MMCn81WUTRAlIi+GHECD0y8AWDIqswYsxGOSKVV7MqOni8tkVOip0fZX/////9HrMCbAz2EHGS4GKAAiRAAAYAcDdKd4G6Z/nwYgJ0ZAIgZyC8aPAs/iPBhwMpWDQNARltNS5Y61v//9i8Yl4SkFkIGTkAc0UBrIYLPA4MYBEy+YLMRuY4nhTC3hZA68H//tSxCoAyQC6mY6CkWDJBIsBz/QUrgNmahSzcrYw0/HhfnMAZBojDsgTFkDR5MDkG/DZEbk2FCmowqdqv2TYABiJwqqYjaQRGZ1URZ1DhSsdiHX/GBu0QpzIBNSaLqZ0ARkwFARxMrpt/Eh47mbQAhhU6sisFUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LESoHHJCRaj/dmYAIAQAAQAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsSLg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVf/7UsShg8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTEFNRTMuMTAwVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVX/+1LEoYPAAAGkAAAAIAAANIAAAARVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV//tSxKGDwAABpAAAACAAADSAAAAEVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVMQU1FMy4xMDBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",duration:.609,format:"mp3",license:"CC0",author:"Kenney"},wc=Fr.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),jc=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function Sc(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex items-center -space-x-1.5",children:jc.map(Cc)}),t[0]=e):e=t[0],e}function Cc(t){return s.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-1 ring-border object-cover bg-white"},t.name)}function Nc({disabled:t,onOpenConnections:e,virtualMcpId:n,selectedModel:r,isStreaming:o,onUnsupportedFile:a}){const[l,c]=S.useState(!1),i=Ds(Ac),{org:u}=ie(),{editor:V}=Ut(),d=S.useRef(null),m=mt(r),f=()=>{!m||o||(c(!1),d.current?.click())},x=async M=>{const U=M.target.files;if(!U||U.length===0||!V)return;const Q=Array.from(U),{from:q}=V.state.selection;try{for(const Y of Q)await Qt(V,r??null,Y,q,a)}finally{d.current&&(d.current.value="")}},h=de({connectionId:n,orgId:u.id,orgSlug:u.slug}),p=Ie.virtualMcpPrompts(n,u.id),{data:b,isLoading:g}=En({queryKey:p,queryFn:()=>Ct(h),staleTime:6e4,enabled:l&&!!h}),v=b?.prompts??[],[y,w]=S.useState(null),{chatMode:A,setChatMode:k}=ue(),[j,C]=Ee(),N=(Pe.find(M=>M.value===j.toolApprovalLevel)??Pe[0]).short,T=M=>{const U=Pe.find(Q=>Q.value===M);if(U){if(U.value===j.toolApprovalLevel){c(!1);return}i(),W("chat_approval_level_changed",{from_level:j.toolApprovalLevel,to_level:U.value,source:"tools_popover"}),C({...j,toolApprovalLevel:U.value}),c(!1)}},E=A==="plan",_=()=>{i();const M=E?"default":"plan";W("chat_mode_changed",{from_mode:A,to_mode:M,source:"tools_popover"}),k(M),c(!1)},R=()=>{e(),c(!1)},O=async(M,U)=>{if(!V||!h)return;const Q=Ve(M._meta),q={from:V.state.selection.from,to:V.state.selection.to};try{const Y=await Vt(h,M.name,U);Oe(V,q,{id:M.name,name:st(M.name,Q),metadata:Y.messages,char:"/",kind:"prompt",args:U})}catch{ae.error("Failed to load prompt. Please try again.")}},D=async M=>{c(!1);const U=!!(M.arguments&&M.arguments.length>0);if(W("chat_prompt_inserted",{prompt_name:M.name,with_arguments:U}),U){w(M);return}await O(M)},I=async M=>{y&&(await O(y,M),w(null))},F=()=>{i();const M=A==="gen-image"?"default":"gen-image";W("chat_mode_changed",{from_mode:A,to_mode:M,source:"tools_popover"}),k(M),c(!1)},$=()=>{i();const M=A==="web-search"?"default":"web-search";W("chat_mode_changed",{from_mode:A,to_mode:M,source:"tools_popover"}),k(M),c(!1)},z=A==="gen-image",K=A==="web-search";return s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:d,type:"file",multiple:!0,accept:io(r??null),className:"hidden",onChange:x,disabled:o}),s.jsxs(No,{open:l,onOpenChange:M=>{M&&!l&&W("chat_tools_popover_opened",{chat_mode:A}),c(M)},children:[s.jsx(ko,{asChild:!0,children:s.jsxs(se,{type:"button",variant:"ghost",size:"default",disabled:t,title:"Tools","aria-label":"Tools",className:B("text-muted-foreground hover:text-foreground transition-[gap] duration-200 shrink min-w-0","gap-0 @[320px]/chat-bottom:gap-1.5"),children:[s.jsx(Qr,{size:14}),s.jsx("span",{className:B("min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0","@[320px]/chat-bottom:max-w-24 @[320px]/chat-bottom:opacity-100"),children:"Tools"})]})}),s.jsxs(_o,{align:"start",className:"w-52 p-1.5 space-y-1",children:[m?s.jsxs(fe,{onClick:f,disabled:o,children:[s.jsx(sn,{size:16}),s.jsx("span",{className:"flex-1",children:"Add file"})]}):s.jsxs(be,{children:[s.jsx(xe,{asChild:!0,children:s.jsxs(fe,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:M=>M.preventDefault(),children:[s.jsx(sn,{size:16}),s.jsx("span",{className:"flex-1",children:"Add file"})]})}),s.jsx(ge,{side:"right",children:"The selected model does not support reading files or images."})]}),s.jsxs(fe,{onClick:_,className:B(E&&"text-violet-600 dark:text-violet-400"),children:[s.jsx(On,{size:16,className:B(E&&"text-violet-500")}),s.jsx("span",{className:"flex-1",children:"Plan mode"}),s.jsx("span",{className:B("text-xs text-muted-foreground",E&&"text-violet-500 font-medium"),children:wc})]}),s.jsxs(fe,{onClick:F,className:B(z&&"text-pink-600 dark:text-pink-400"),children:[s.jsx($n,{size:16,className:B(z&&"text-pink-500")}),s.jsx("span",{className:"flex-1",children:"Create image"}),z&&s.jsx("span",{className:"text-xs text-pink-500 font-medium",children:"On"})]}),s.jsxs(fe,{onClick:$,className:B(K&&"text-blue-600 dark:text-blue-400"),children:[s.jsx(Ln,{size:16,className:B(K&&"text-blue-500")}),s.jsx("span",{className:"flex-1",children:"Web search"}),K&&s.jsx("span",{className:"text-xs text-blue-500 font-medium",children:"On"})]}),s.jsxs(en,{children:[s.jsxs(tn,{className:"gap-2",children:[s.jsx("span",{className:"flex size-4 items-center justify-center text-base font-medium text-muted-foreground",children:"/"}),s.jsx("span",{className:"flex-1",children:"Prompts"})]}),s.jsx(nn,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:g?s.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[s.jsx(ir,{size:14,className:"animate-spin"}),"Loading prompts…"]}):v.length===0?s.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:"No prompts available"}):v.map(M=>s.jsxs(fe,{onClick:()=>D(M),className:"flex flex-col items-start gap-0.5",children:[s.jsx("span",{className:"font-medium text-sm capitalize",children:M.title||Dt(M.name,Ve(M._meta))}),M.description&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:M.description})]},M.name))})]}),s.jsxs(en,{children:[s.jsxs(tn,{className:"gap-2",children:[s.jsx(ft,{size:16}),s.jsx("span",{className:"flex-1",children:"Approval"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:N})]}),s.jsx(nn,{className:"w-48 p-1.5",children:s.jsx(Io,{value:j.toolApprovalLevel,onValueChange:T,children:Pe.map(M=>s.jsx(Eo,{value:M.value,children:M.label},M.value))})})]}),s.jsxs(fe,{onClick:R,children:[s.jsx(so,{size:16}),s.jsx("span",{className:"flex-1",children:"Connections"}),s.jsx(S.Suspense,{children:s.jsx(Sc,{})})]})]})]}),s.jsx(We,{prompt:y,setPrompt:w,onSubmit:I})]})}const kc=[{src:"/connections/github.png",name:"GitHub"},{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/linear.png",name:"Linear"},{src:"/connections/shopify.png",name:"Shopify"},{src:"/connections/firecrawl.png",name:"Firecrawl"},{src:"/connections/perplexity.png",name:"Perplexity"}];function _c(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex items-center -space-x-1",children:kc.map(Ic)}),t[0]=e):e=t[0],e}function Ic(t){return s.jsx("img",{src:t.src,alt:t.name,className:"size-5 rounded-sm ring-2 ring-muted object-cover bg-white"},t.name)}function Ec(t){const e=L.c(6),{onClick:n}=t;let r,o,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=B("group relative z-10 flex items-center gap-3 w-full px-4 py-3","rounded-b-2xl","cursor-pointer"),o=s.jsx("p",{className:"flex-1 text-xs text-muted-foreground truncate text-left",children:"Connect tools and get more done"}),a=s.jsx(_c,{}),l=s.jsx(Po,{size:14,className:"shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground transition-colors"}),e[0]=r,e[1]=o,e[2]=a,e[3]=l):(r=e[0],o=e[1],a=e[2],l=e[3]);let c;return e[4]!==n?(c=s.jsxs("button",{type:"button",onClick:n,className:r,children:[o,a,l]}),e[4]=n,e[5]=c):c=e[5],c}const Me=48;function Rc(){const t=L.c(9),[e,n]=S.useState("idle"),[r,o]=S.useState(""),[a,l]=S.useState(""),[c,i]=S.useState(Dc),u=S.useRef(null),V=S.useRef(null),d=S.useRef(null),m=S.useRef(null),f=S.useRef(0),x=S.useRef(!1),h=S.useRef(""),p=S.useRef(""),b=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let g;t[0]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{f.current&&(cancelAnimationFrame(f.current),f.current=0),V.current?.close().catch(Pc),m.current?.getTracks().forEach(Tc),d.current=null,V.current=null,m.current=null},t[0]=g):g=t[0];const v=g;let y;if(t[1]===Symbol.for("react.memo_cache_sentinel")){const N=T=>{m.current=T;const E=new AudioContext;V.current=E;const _=E.createMediaStreamSource(T),R=E.createAnalyser();R.fftSize=128,R.smoothingTimeConstant=.8,_.connect(R),d.current=R;const O=new Uint8Array(R.frequencyBinCount),D=()=>{if(!d.current)return;d.current.getByteFrequencyData(O);const I=[];for(let F=0;F<Me;F++){const $=Math.floor(F/Me*O.length);I.push(Math.max(.04,(O[$]??0)/255))}i(I),f.current=requestAnimationFrame(D)};D()};y=async()=>{const T=window.SpeechRecognition||window.webkitSpeechRecognition;if(!T){n("unsupported");return}let E;try{E=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{n("permission-denied");return}o(""),l(""),p.current="",h.current="",x.current=!0,n("recording"),N(E);const _=new T;u.current=_,_.interimResults=!0,_.continuous=!0,_.lang=navigator.language||"en-US",_.onresult=R=>{let O="",D="";for(let I=R.resultIndex;I<R.results.length;I++){const F=R.results[I],$=F?.[0]?.transcript??"";F?.isFinal?D=D+$:O=O+$}D&&(h.current=h.current+D,o(h.current)),p.current=O,l(O)},_.onend=()=>{if(x.current)try{_.start()}catch{}};try{_.start()}catch{n("idle")}},t[1]=y}else y=t[1];const w=y;let A;t[2]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{x.current=!1,u.current?.stop(),v(),n("idle"),i(Array(Me).fill(.05)),l("");const N=(h.current+(p.current?" "+p.current:"")).trim();return o(""),h.current="",p.current="",N},t[2]=A):A=t[2];const k=A;let j;t[3]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{x.current=!1,u.current?.abort(),v(),n("idle"),o(""),l(""),i(Array(Me).fill(.05)),h.current="",p.current=""},t[3]=j):j=t[3];const C=j;let P;return t[4]!==a||t[5]!==e||t[6]!==r||t[7]!==c?(P={status:e,transcript:r,interimTranscript:a,waveformData:c,isSupported:b,startRecording:w,stopRecording:k,cancelRecording:C},t[4]=a,t[5]=e,t[6]=r,t[7]=c,t[8]=P):P=t[8],P}function Tc(t){return t.stop()}function Pc(){}function Dc(){return Array(Me).fill(.05)}function Mc(t){const e=L.c(4),{data:n}=t;let r;e[0]!==n?(r=n.map(Fc),e[0]=n,e[1]=r):r=e[1];let o;return e[2]!==r?(o=s.jsx("div",{className:"flex items-center justify-center gap-[2px] h-10 overflow-hidden","aria-hidden":"true",children:r}),e[2]=r,e[3]=o):o=e[3],o}function Fc(t,e){return s.jsx("div",{className:"w-[2px] shrink-0 rounded-full bg-chart-2 transition-[height] duration-75 ease-out",style:{height:`${Math.max(4,Math.round(t*40))}px`}},e)}function Oc({messageCount:t,showConnectionsBanner:e}){return t>0||e}function Lc(t,e){const n=L.c(5),{editor:r}=Ut(),[o,a]=S.useState(!1),l=S.useRef(0);let c,i;return n[0]!==r||n[1]!==e||n[2]!==t?(c=()=>{const u=f=>{f.dataTransfer?.types.includes("Files")&&(f.preventDefault(),l.current=l.current+1,a(!0))},V=f=>{f.preventDefault(),l.current=Math.max(0,l.current-1),l.current===0&&a(!1)},d=$c,m=f=>{if(f.preventDefault(),l.current=0,a(!1),!r||!t||!mt(t))return;const x=f.dataTransfer?.files;if(!x||x.length===0)return;const{from:h}=r.state.selection;for(const p of Array.from(x))Qt(r,t,p,h,e)};return window.addEventListener("dragenter",u),window.addEventListener("dragleave",V),window.addEventListener("dragover",d),window.addEventListener("drop",m),()=>{window.removeEventListener("dragenter",u),window.removeEventListener("dragleave",V),window.removeEventListener("dragover",d),window.removeEventListener("drop",m)}},i=[r,t,e],n[0]=r,n[1]=e,n[2]=t,n[3]=c,n[4]=i):(c=n[3],i=n[4]),S.useEffect(c,i),o}function $c(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function zc(t){const e=L.c(11),{selectedModel:n,onUnsupportedFile:r}=t,o=Lc(n,r);let a;e[0]!==n?(a=mt(n),e[0]=n,e[1]=a):a=e[1];const l=a,c=o?"opacity-100":"opacity-0 pointer-events-none",i=l?"border-primary/40 text-primary/70":"border-destructive/30 text-destructive/70";let u;e[2]!==c||e[3]!==i?(u=B("absolute inset-0 z-20 rounded-xl flex flex-col items-center justify-center gap-2 bg-muted border-2 border-dashed transition-opacity",c,i),e[2]=c,e[3]=i,e[4]=u):u=e[4];let V;e[5]!==n||e[6]!==l?(V=l?s.jsxs(s.Fragment,{children:[s.jsx(Gr,{size:24}),s.jsxs("span",{className:"text-sm font-medium",children:["Drop ",Jn(n)," here"]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Dn,{size:24}),s.jsx("span",{className:"text-sm font-medium",children:"This model can't read attachments — switch to one with vision or file support"})]}),e[5]=n,e[6]=l,e[7]=V):V=e[7];let d;return e[8]!==u||e[9]!==V?(d=s.jsx("div",{className:u,children:V}),e[8]=u,e[9]=V,e[10]=d):d=e[10],d}function Bc(){const t=L.c(6),e=nt(),{org:n,locator:r}=ie(),{create:o}=Pr();let a;return t[0]!==o||t[1]!==r||t[2]!==e||t[3]!==n.id||t[4]!==n.slug?(a=async l=>{const{tiptapDoc:c,virtualMcp:i}=l,u=crypto.randomUUID(),V=i?.id??ct(n.id).id;Dr(sessionStorage,r,u,{tiptapDoc:c});try{await o({id:u,virtual_mcp_id:V})}catch{}const d={virtualmcpid:V,autosend:Mr};e({to:"/$org/$taskId",params:{org:n.slug,taskId:u},search:d})},t[0]=o,t[1]=r,t[2]=e,t[3]=n.id,t[4]=n.slug,t[5]=a):a=t[5],a}function Uc({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const n=Fn(),r=rt(),o=n?.messages??[],a=n?.isStreaming??!1,l=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),i=r?.taskId??"",u=i||ra,V=Bc(),{selectedModel:d,selectedVirtualMcp:m,isModelsLoading:f,tiptapDocRef:x,imageModel:h,deepResearchModel:p,chatMode:b,setChatMode:g}=ue(),{data:v}=Tn.useSession(),y=v?.user?.id,{org:w,locator:A}=ie(),k=ct(w.id).id,j=$r(m?.id??k),C=Ds(To),[P,N]=S.useState(!1),{unsupportedFile:T,onUnsupportedFile:E,clearUnsupportedFile:_}=ai(),R=Rc(),O=S.useRef(void 0),D=async()=>{O.current=z,await R.startRecording();const G=R.status==="recording"?"started":R.status==="unsupported"?"unsupported":R.status==="permission-denied"?"permission_denied":"unknown";W("chat_voice_started",{thread_id:i,outcome:G})},I=()=>{W("chat_voice_confirmed",{thread_id:i});const G=R.stopRecording();Y.current?.syncVoiceText(O.current,G),Y.current?.focus()},F=()=>{W("chat_voice_cancelled",{thread_id:i}),R.cancelRecording(),Y.current?.restoreContent(O.current)};S.useEffect(()=>{if(R.status!=="recording")return;const G=(R.transcript+(R.interimTranscript?" "+R.interimTranscript:"")).trim();Y.current?.syncVoiceText(O.current,G)},[R.transcript,R.interimTranscript,R.status]);const $=r?.activeTask??null,[z,K]=S.useState(()=>an(sessionStorage,A,u)??void 0),M=G=>{K(G),x.current=G,aa(sessionStorage,A,u,G,{onQuotaExceeded:({docSizeBytes:le})=>{W("chat_draft_quota_exceeded",{thread_id:i||null,doc_size_bytes:le}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},U=S.useRef(i);if(U.current!==i){U.current=i;const G=an(sessionStorage,A,u)??void 0;K(G),x.current=G}const q=[...o].reverse().find(G=>G.role==="assistant")?.metadata?.modelLimits?.contextWindow??d?.limits?.contextWindow,Y=S.useRef(null),J=b==="plan";S.useEffect(()=>{const G=le=>{Or(le)&&le.code==="KeyL"&&(le.preventDefault(),le.shiftKey&&g(b==="plan"?"default":"plan"),Y.current?.focus())};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[b,g]);const Z=hr(o),te=[...o].reverse().find(G=>G.role==="assistant"&&G.metadata?.usage)?.metadata?.usage?.contextTokens??0,ee=!a&&!f&&!ls(z),H=a||l,re=Oc({messageCount:o.length,showConnectionsBanner:e}),ne=G=>{G?.preventDefault(),a?(W("chat_message_stopped",{thread_id:i}),c()):l?(W("chat_message_stopped",{thread_id:i}),c()):ee&&z&&(W("chat_message_sent",{thread_id:i||null,mode:b,model_id:d?.modelId??null,model_provider:d?.providerId??null,virtual_mcp_id:m?.id??null,submission:G?"button_or_enter":"programmatic"}),n?n.sendMessage(z):V({tiptapDoc:z,virtualMcp:m}),la(sessionStorage,A,u),M(void 0))};return y&&$?.created_by&&$.created_by!==y?s.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-muted/40 text-muted-foreground",children:[s.jsx(Dn,{size:14,className:"shrink-0"}),s.jsx("span",{className:"text-sm",children:"Read only — you're viewing someone else's thread"})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-col w-full justify-end",children:s.jsxs("div",{className:"relative rounded-2xl w-full flex flex-col",children:[e&&s.jsx("div",{className:"absolute inset-0 rounded-2xl pointer-events-none bg-muted/50"}),n&&r&&s.jsx(pt,{}),s.jsx(vc,{tiptapDoc:z,setTiptapDoc:M,disabled:a,enterToSubmit:!0,onSubmit:ne,children:s.jsxs("form",{onSubmit:ne,className:B("w-full relative rounded-2xl min-h-[110px] md:min-h-[130px] flex flex-col bg-card dark:bg-muted card-shadow overflow-hidden"),children:[s.jsx(zc,{selectedModel:d,onUnsupportedFile:E}),s.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:s.jsx(yc,{ref:Y,disabled:a||R.status==="recording",virtualMcpId:m?.id??k,showFileUploader:!0,selectedModel:d,onUnsupportedFile:E})}),s.jsx("div",{className:"@container/chat-bottom flex items-center justify-between p-2.5 gap-1",children:R.status==="recording"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex-1"}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsx(Mc,{data:R.waveformData.slice(0,28)}),s.jsx("button",{type:"button",onClick:F,className:"flex items-center justify-center size-8 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Cancel recording",children:s.jsx(De,{size:16})}),s.jsx("button",{type:"button",onClick:I,className:"flex items-center justify-center size-8 rounded-lg bg-foreground text-background hover:opacity-80 transition-opacity","aria-label":"Use transcription",children:s.jsx(Ue,{size:16})})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(Nc,{disabled:a,onOpenConnections:()=>{W("connections_dialog_opened",{source:"tools_popover",mode:"add"}),N(!0)},virtualMcpId:m?.id??k,selectedModel:d,isStreaming:a,onUnsupportedFile:E}),J&&s.jsxs("button",{type:"button",onClick:()=>{C(),W("chat_mode_changed",{from_mode:"plan",to_mode:"default",source:"pill_dismiss"}),g("default")},title:"Plan mode","aria-label":"Plan mode",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-violet-600 dark:text-violet-400 hover:bg-violet-500/10 group min-w-0 shrink animate-in fade-in duration-200",children:[s.jsx(On,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-32 @[320px]/chat-bottom:opacity-100",children:"Plan mode"}),s.jsx(De,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),b==="gen-image"&&h&&s.jsxs("button",{type:"button",disabled:a,onClick:()=>{C(),W("chat_mode_changed",{from_mode:"gen-image",to_mode:"default",source:"pill_dismiss"}),g("default")},title:"Create image","aria-label":"Create image",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-pink-600 dark:text-pink-400 hover:bg-pink-500/10 group min-w-0 shrink animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[s.jsx($n,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[120px] @[320px]/chat-bottom:opacity-100",children:"Create image"}),s.jsx(De,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),b==="web-search"&&p&&s.jsxs("button",{type:"button",disabled:a,onClick:()=>{C(),W("chat_mode_changed",{from_mode:"web-search",to_mode:"default",source:"pill_dismiss"}),g("default")},title:"Web search","aria-label":"Web search",className:"flex items-center gap-1.5 h-8 rounded-lg px-2.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:bg-blue-500/10 group min-w-0 shrink animate-in fade-in duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",children:[s.jsx(Ln,{size:14,className:"shrink-0"}),s.jsx("span",{className:"min-w-0 truncate transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[120px] @[320px]/chat-bottom:opacity-100",children:"Web search"}),s.jsx(De,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),q&&te>0&&s.jsx(xr,{usage:Z,totalTokens:te,contextWindow:q,onOpenContextPanel:t})]}),s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[re&&s.jsx(Wl,{virtualMcp:j,currentBranch:r?.currentBranch??null}),s.jsx(ei,{}),R.isSupported&&s.jsx(se,{type:"button",onClick:D,disabled:a||l,variant:"ghost",size:"icon",className:B("size-8 rounded-lg transition-colors",R.status==="permission-denied"?"text-destructive hover:text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground"),title:R.status==="permission-denied"?"Microphone access denied — click to try again":"Voice input",children:s.jsx(Yr,{size:18})}),s.jsx(se,{type:H?"button":"submit",onClick:G=>{H&&(G.preventDefault(),G.stopPropagation(),c())},variant:ee||H?"default":"ghost",size:"icon",disabled:!ee&&!H,className:B("size-8 rounded-lg transition-all",!ee&&!H&&"bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"),title:a?"Stop generating":l?"Cancel run":"Send message (Enter)",children:H?s.jsx(Hr,{size:20}):s.jsx(zr,{size:20})})]})]})})]})},i),e&&s.jsx(Ec,{onClick:()=>{W("connections_banner_clicked",{source:"home_chat_input"}),W("connections_dialog_opened",{source:"home_banner",mode:"add"}),N(!0)}})]})}),s.jsx(go,{mode:"browse",open:P,onOpenChange:N,defaultTab:"all"}),s.jsx(ri,{info:T,onClose:_})]})}const Kc={usd:[{dollars:10,label:"Starter"},{dollars:20,label:"Popular"},{dollars:100,label:"Best value"}],brl:[{dollars:50,label:"Starter"},{dollars:100,label:"Popular"},{dollars:500,label:"Best value"}]};function Ms(t){return`deco-credits-empty-dismissed:${t}`}function Wd(t){try{return localStorage.getItem(Ms(t))==="1"}catch{return!1}}function qc(){const t=L.c(50),{org:e}=ie(),n=nt(),{decoKeyId:r}=xs();let o;t[0]!==e.id||t[1]!==e.slug?(o={connectionId:dt,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=o):o=t[2];const a=de(o),[l,c]=S.useState(!0),[i,u]=S.useState(""),[V,d]=S.useState(!1),[m,f]=S.useState("usd"),x=m==="brl"?"R$":"$";let h;t[3]!==e.id?(h=()=>{W("credits_empty_state_dismissed",{organization_id:e.id}),c(!1);try{localStorage.setItem(Ms(e.id),"1")}catch{}},t[3]=e.id,t[4]=h):h=t[4];const p=h;let b,g;t[5]!==l||t[6]!==e.id?(b=()=>{l&&W("credits_empty_state_shown",{organization_id:e.id})},g=[l,e.id],t[5]=l,t[6]=e.id,t[7]=b,t[8]=g):(b=t[7],g=t[8]),S.useEffect(b,g);let v;t[9]!==a||t[10]!==m?(v=async K=>{const M=await a.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:K,currency:m}});if(M?.isError)throw new Error(M.content?.[0]?.text??"Failed to get top-up URL");return M.structuredContent?.url},t[9]=a,t[10]=m,t[11]=v):v=t[11];let y;t[12]!==p?(y=K=>{K&&window.open(K,"_blank","noopener,noreferrer"),p()},t[12]=p,t[13]=y):y=t[13];let w;t[14]!==v||t[15]!==y?(w={mutationFn:v,onSuccess:y,onError:Yc},t[14]=v,t[15]=y,t[16]=w):w=t[16];const{mutate:A,isPending:k}=Pt(w),j=parseFloat(i),C=!isNaN(j)&&j>=1;if(!l)return null;let P;t[17]!==p?(P=K=>!K&&p(),t[17]=p,t[18]=P):P=t[18];let N;t[19]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("div",{className:"absolute inset-x-0 top-0 h-24 bg-gradient-to-b from-amber-500/8 to-transparent pointer-events-none rounded-t-lg"}),t[19]=N):N=t[19];let T;t[20]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-100 dark:bg-amber-900/40 border border-amber-200/60 dark:border-amber-800/40 mx-auto",children:s.jsx(Un,{size:20,className:"text-amber-600 dark:text-amber-400"})}),t[20]=T):T=t[20];let E;t[21]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsxs("div",{className:"relative px-6 pt-7 pb-5",children:[N,s.jsxs(ot,{className:"relative gap-3",children:[T,s.jsxs("div",{className:"text-center",children:[s.jsx(at,{className:"text-lg font-semibold",children:"This workspace has no credits"}),s.jsx(Mt,{className:"mt-2 text-[13px] leading-relaxed max-w-[320px] mx-auto",children:"Your free credits were used in another workspace. Add credits to use AI here."})]})]})]}),t[21]=E):E=t[21];let _;t[22]!==m||t[23]!==x||t[24]!==i||t[25]!==j||t[26]!==r||t[27]!==C||t[28]!==k||t[29]!==V||t[30]!==A?(_=r&&s.jsxs("div",{className:"px-6 pb-5",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Yn,{type:"single",variant:"outline",size:"sm",value:m,onValueChange:K=>{K&&f(K)},children:[s.jsx(Je,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(Je,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:Kc[m].map(K=>{const{dollars:M,label:U}=K;return s.jsxs("button",{type:"button",disabled:k,onClick:()=>{W("credits_topup_clicked",{amount_cents:M*100,currency:m,tier_label:U,source:"empty_state"}),A(M*100)},className:B("relative flex flex-col items-center gap-1 py-6 rounded-xl border transition-all duration-150 cursor-pointer","disabled:opacity-50 disabled:cursor-wait","border-border hover:border-foreground/20 hover:bg-muted/30"),children:[s.jsxs("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:[x,M]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:U})]},M)})}),V?s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:x}),s.jsx(Hn,{type:"number",min:"1",step:"1",placeholder:"50",value:i,onChange:K=>u(K.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(se,{className:"h-10",disabled:!C||k,onClick:()=>{W("credits_topup_clicked",{amount_cents:Math.round(j*100),currency:m,tier_label:"custom",source:"empty_state"}),A(Math.round(j*100))},children:k?"Opening...":"Add"})]}):s.jsx("button",{type:"button",className:"w-full mt-2.5 text-xs text-muted-foreground hover:text-foreground transition-colors py-1",onClick:()=>d(!0),children:"Enter custom amount"})]}),t[22]=m,t[23]=x,t[24]=i,t[25]=j,t[26]=r,t[27]=C,t[28]=k,t[29]=V,t[30]=A,t[31]=_):_=t[31];let R;t[32]!==p||t[33]!==n||t[34]!==e.slug?(R=()=>{n({to:"/$org/settings/ai-providers",params:{org:e.slug}}),p()},t[32]=p,t[33]=n,t[34]=e.slug,t[35]=R):R=t[35];let O;t[36]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(Qn,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[36]=O):O=t[36];let D;t[37]!==R?(D=s.jsxs("button",{type:"button",className:"group flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:R,children:["Use your own provider",O]}),t[37]=R,t[38]=D):D=t[38];let I;t[39]!==p?(I=s.jsx(se,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:p,children:"Skip for now"}),t[39]=p,t[40]=I):I=t[40];let F;t[41]!==D||t[42]!==I?(F=s.jsxs("div",{className:"px-6 py-3.5 border-t border-border bg-muted/30 flex items-center justify-between",children:[D,I]}),t[41]=D,t[42]=I,t[43]=F):F=t[43];let $;t[44]!==_||t[45]!==F?($=s.jsxs(lt,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Qc,children:[E,_,F]}),t[44]=_,t[45]=F,t[46]=$):$=t[46];let z;return t[47]!==$||t[48]!==P?(z=s.jsx(it,{open:!0,onOpenChange:P,children:$}),t[47]=$,t[48]=P,t[49]=z):z=t[49],z}function Qc(t){return t.preventDefault()}function Yc(t){ae.error(`Top-up failed: ${t.message}`)}function Hc(t){const e=L.c(6),{balanceDollars:n}=t;let r;e[0]!==n?(r=n.toFixed(2),e[0]=n,e[1]=r):r=e[1];const o=r;let a,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=B("inline-flex items-center gap-1.5 px-3 py-1 rounded-full","bg-emerald-50 dark:bg-emerald-950/30","border border-emerald-200/60 dark:border-emerald-800/40","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),l=s.jsx(Un,{size:13,className:"text-emerald-600 dark:text-emerald-400"}),e[2]=a,e[3]=l):(a=e[2],l=e[3]);let c;return e[4]!==o?(c=s.jsxs("div",{className:a,children:[l,s.jsxs("span",{className:"text-xs font-medium text-emerald-700 dark:text-emerald-300 tabular-nums",children:["$",o," in credits to get started"]})]}),e[4]=o,e[5]=c):c=e[5],c}function Gc(){const t=L.c(8),{org:e}=ie(),n=nt();let r;t[0]!==n||t[1]!==e.slug?(r=()=>n({to:"/$org/settings/ai-providers",params:{org:e.slug}}),t[0]=n,t[1]=e.slug,t[2]=r):r=t[2];let o,a,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(o=B("inline-flex items-center gap-1.5 px-3 py-1 rounded-full cursor-pointer","bg-amber-50 dark:bg-amber-950/30","border border-amber-200/60 dark:border-amber-800/40","hover:bg-amber-100/60 dark:hover:bg-amber-900/30","transition-colors duration-150","animate-in fade-in-0 slide-in-from-bottom-2 duration-300"),a=s.jsx(Kn,{size:13,className:"text-amber-600 dark:text-amber-400"}),l=s.jsx("span",{className:"text-xs font-medium text-amber-700 dark:text-amber-300",children:"No credits remaining · Add more"}),t[3]=o,t[4]=a,t[5]=l):(o=t[3],a=t[4],l=t[5]);let c;return t[6]!==r?(c=s.jsxs("button",{type:"button",onClick:r,className:o,children:[a,l]}),t[6]=r,t[7]=c):c=t[7],c}function Wc(t){const e=L.c(11),{className:n}=t;let r;e[0]!==n?(r=B("flex h-full w-full flex-col bg-background",n),e[0]=n,e[1]=r):r=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),e[2]=o):o=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs("div",{className:"flex items-center gap-3",children:[o,s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),s.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),e[3]=a):a=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:s.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[a,s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),s.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),e[4]=l):l=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:s.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[s.jsx(Qe,{align:"right",width:"w-3/4"}),s.jsx(Qe,{align:"left",width:"w-full",lines:3}),s.jsx(Qe,{align:"right",width:"w-2/3"}),s.jsx(Qe,{align:"left",width:"w-5/6",lines:2})]})}),e[5]=c):c=e[5];let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:s.jsx("div",{className:"relative flex-1",children:s.jsxs("div",{className:"space-y-2 p-2",children:[s.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),s.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),e[6]=i):i=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("div",{className:"flex items-center gap-1",children:s.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),e[7]=u):u=e[7];let V;e[8]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx("div",{className:"px-4 py-4",children:s.jsx("div",{className:"mx-auto w-full max-w-2xl",children:s.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl bg-background card-shadow",children:[i,s.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[u,s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),s.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})}),e[8]=V):V=e[8];let d;return e[9]!==r?(d=s.jsxs("div",{className:r,children:[l,c,V]}),e[9]=r,e[10]=d):d=e[10],d}function Qe(t){const e=L.c(22),{align:n,width:r,lines:o}=t,a=r===void 0?"w-full":r,l=o===void 0?1:o,c=n==="right"?"flex-row-reverse":"flex-row";let i;e[0]!==c?(i=B("flex w-full gap-4 px-4 py-2",c),e[0]=c,e[1]=i):i=e[1];const u=n==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let V;e[2]!==u?(V=B("flex min-w-0 flex-col gap-2",u),e[2]=u,e[3]=V):V=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=d):d=e[4];const m=n==="right"?"bg-muted":"bg-transparent border border-border/40";let f;e[5]!==m||e[6]!==a?(f=B("min-w-0 rounded-2xl p-4",m,a),e[5]=m,e[6]=a,e[7]=f):f=e[7];let x;e[8]!==l?(x=Array.from({length:l}),e[8]=l,e[9]=x):x=e[9];let h;e[10]!==l||e[11]!==x?(h=s.jsx("div",{className:"space-y-2",children:x.map((v,y)=>s.jsx("div",{className:B("h-3 rounded bg-muted-foreground/20 animate-pulse",y===l-1?"w-3/4":"w-full"),style:{animationDelay:`${y*.1}s`}},y))}),e[10]=l,e[11]=x,e[12]=h):h=e[12];let p;e[13]!==h||e[14]!==f?(p=s.jsx("div",{className:f,children:h}),e[13]=h,e[14]=f,e[15]=p):p=e[15];let b;e[16]!==p||e[17]!==V?(b=s.jsxs("div",{className:V,children:[d,p]}),e[16]=p,e[17]=V,e[18]=b):b=e[18];let g;return e[19]!==b||e[20]!==i?(g=s.jsx("div",{className:i,children:b}),e[19]=b,e[20]=i,e[21]=g):g=e[21],g}function Jc(t){const e=L.c(7),{scrollRef:n,sentinelRef:r,hasMoreOlder:o,isFetchingOlder:a,fetchOlderMessages:l}=t;let c,i;e[0]!==l||e[1]!==o||e[2]!==a||e[3]!==n||e[4]!==r?(c=()=>{const u=r.current,V=n.current;if(!u||!V||!o)return;const d=new IntersectionObserver(async m=>{if(!m[0]?.isIntersecting||a||!o)return;const x=V.scrollHeight,h=V.scrollTop;await l(),requestAnimationFrame(()=>{const p=V.scrollHeight;V.scrollTop=h+(p-x)})},{root:V,rootMargin:"200px 0px 0px 0px"});return d.observe(u),()=>d.disconnect()},i=[n,r,o,a,l],e[0]=l,e[1]=o,e[2]=a,e[3]=n,e[4]=r,e[5]=c,e[6]=i):(c=e[5],i=e[6]),S.useEffect(c,i)}function Zc(t){const e=L.c(5),{className:n,children:r}=t;let o;e[0]!==n?(o=B("flex flex-col h-full w-full bg-background transform-[translateZ(0)]",n),e[0]=n,e[1]=o):o=e[1];let a;return e[2]!==r||e[3]!==o?(a=s.jsx("div",{className:o,children:r}),e[2]=r,e[3]=o,e[4]=a):a=e[4],a}function Xc(t){const e=L.c(5),{children:n,className:r}=t;let o;e[0]!==r?(o=B("flex-1 min-h-0 overflow-y-auto isolate",r),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==n||e[3]!==o?(a=s.jsx("div",{className:o,children:n}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a}function ed(t){const e=L.c(2),{children:n}=t;let r;return e[0]!==n?(r=s.jsx("div",{className:"min-h-full shrink-0 w-full flex items-center justify-center max-w-2xl mx-auto py-10",children:n}),e[0]=n,e[1]=r):r=e[1],r}function td(){const t=L.c(36),{messages:e,status:n,hasMoreOlder:r,isFetchingOlder:o,fetchOlderMessages:a,isStreaming:l}=Be(),c=gr(e),i=c.at(-1),V=sa()*qo+16,d=S.useRef(null),m=S.useRef(null);let f;t[0]!==a||t[1]!==r||t[2]!==o?(f={scrollRef:d,sentinelRef:m,hasMoreOlder:r,isFetchingOlder:o,fetchOlderMessages:a},t[0]=a,t[1]=r,t[2]=o,t[3]=f):f=t[3],Jc(f);const x=i?.assistant?.parts,h=x?.length,p=x?.at(-1);let b;t[4]!==h||t[5]!==p?(b=[h,p],t[4]=h,t[5]=p,t[6]=b):b=t[6];let g;t[7]!==l||t[8]!==b?(g={containerRef:d,enabled:l,contentDeps:b},t[7]=l,t[8]=b,t[9]=g):g=t[9];const{sentinelRef:v}=br(g);let y;t[10]!==V?(y={paddingBottom:V},t[10]=V,t[11]=y):y=t[11];let w;t[12]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx("div",{ref:m,"aria-hidden":!0,className:"h-px"}),t[12]=w):w=t[12];let A;t[13]!==o?(A=o&&s.jsx("div",{className:"flex items-center justify-center py-3 text-xs text-muted-foreground",children:"Loading older messages…"}),t[13]=o,t[14]=A):A=t[14];let k;if(t[15]!==c||t[16]!==n){let E;t[18]!==c.length||t[19]!==n?(E=(_,R)=>s.jsx(Wt,{pair:_,isLastPair:!1,status:R===c.length-1?n:void 0},`pair-${_.user?.id??_.assistant?.id}`),t[18]=c.length,t[19]=n,t[20]=E):E=t[20],k=c.slice(0,-1).map(E),t[15]=c,t[16]=n,t[17]=k}else k=t[17];let j;t[21]!==A||t[22]!==k?(j=s.jsxs("div",{className:"flex flex-col min-w-0 max-w-2xl mx-auto w-full",children:[w,A,k]}),t[21]=A,t[22]=k,t[23]=j):j=t[23];let C;t[24]!==i||t[25]!==n?(C=i&&s.jsx("div",{className:"min-h-full min-w-0 max-w-2xl mx-auto w-full",children:s.jsx(Wt,{pair:i,isLastPair:!0,status:n},`pair-${i.user?.id??i.assistant?.id}`)}),t[24]=i,t[25]=n,t[26]=C):C=t[26];let P;t[27]!==C||t[28]!==y||t[29]!==j?(P=s.jsxs("div",{style:y,children:[j,C]}),t[27]=C,t[28]=y,t[29]=j,t[30]=P):P=t[30];let N;t[31]!==v?(N=s.jsx("div",{ref:v,"aria-hidden":!0,className:"h-0"}),t[31]=v,t[32]=N):N=t[32];let T;return t[33]!==P||t[34]!==N?(T=s.jsxs("div",{ref:d,"data-chat-scroller":!0,className:"w-full min-w-0 max-w-full overflow-y-auto h-full overflow-x-hidden",children:[P,N]}),t[33]=P,t[34]=N,t[35]=T):T=t[35],T}function nd(t){const e=L.c(5),{children:n,className:r}=t;let o;e[0]!==r?(o=B("flex-none w-full mx-auto p-2 pt-0","max-w-2xl min-w-0",r),e[0]=r,e[1]=o):o=e[1];let a;return e[2]!==n||e[3]!==o?(a=s.jsx("div",{className:o,children:n}),e[2]=n,e[3]=o,e[4]=a):a=e[4],a}const Jd=Object.assign(Zc,{Main:Xc,Messages:td,EmptyState:ed,Footer:nd,Input:Uc,Provider:wr,ActiveTaskProvider:Ar,Skeleton:Wc,IceBreakers:Ko,NoAiProviderEmptyState:co,CreditsEmptyState:qc,CreditsEyebrow:Hc,NoCreditsEyebrow:Gc,CreditsExhaustedBanner:gs});function Zd(t){if(typeof t!="object"||t===null)return!1;const n=t.githubRepo?.url;return typeof n=="string"&&n.length>0}function Xd(t){return!!Zn(t??null)?.connectionId}function eV(t){return t.online?t.capabilities.includes("claude-code")||t.capabilities.includes("codex"):!1}export{Jd as C,vc as T,Wl as a,Zd as b,Xd as c,il as d,yc as e,Gd as f,Ml as g,eV as h,li as i,ll as s,xs as u,Wd as w};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as M,r as S,j as o,l as q}from"./index-DHt9Mf9G.js";import{S as G}from"./scroll-area-DVU-pYpl.js";import{j as H,a4 as J,d as Q}from"./index-CN3cwfwy.js";import{S as U}from"./schema-form-CB484siM.js";import{S as W}from"./save-status-XRuEx_--.js";import"./select-BISzCSVs.js";import"./tooltip-DY1LX4fr.js";import"./Check-DwRXhDYN.js";import"./ChevronDown-k1VC2srD.js";import"./ChevronUp-gzUJvPqk.js";import"./agent-capabilities-BLrQsLZt.js";import"./pair-BzvzVihx.js";import"./agent-icon-CEtrmBbc.js";import"./AlertCircle-C8E06jfW.js";import"./Tool01-CBtpfChg.js";import"./SwitchHorizontal01-Caie0gIK.js";import"./RefreshCcw01-B2-HH-To.js";import"./XCircle-toDSs4J6.js";import"./ArrowUpRight-CkF0i1No.js";import"./ZapSquare-D_bnCoLi.js";import"./Users03-CS9FNDsP.js";import"./CheckCircle-2iMrjx7D.js";import"./ChevronLeft-7V2_qQ3E.js";import"./ChevronRight-bA2PmkN9.js";import"./DotsVertical-BZEdPJTY.js";import"./Container-DrffveDY.js";import"./Eye-CbDINxSR.js";import"./ZoomOut-CFJklA2J.js";import"./Globe01-CXHtWC8F.js";import"./FilterLines-DGIJAfna.js";import"./Star01-K2L8_aik.js";import"./Palette-szvJEqXU.js";import"./HardDrive-HIDpzn4I.js";import"./Stars02-nn8T1-WQ.js";import"./Key01-BTeVSARy.js";import"./sheet-C-msc_1A.js";import"./X-D96et_XK.js";import"./LinkExternal01-D7lnMhd-.js";import"./Monitor01-F6bKl6tK.js";import"./Sun-Bk5MW5gf.js";import"./Play-sw2az4p0.js";import"./Plus-dxS60FPA.js";import"./SearchMd-88iVjfqP.js";import"./Settings02-CdYsqAUT.js";import"./Shield01-D6lV8m1d.js";import"./Stars01-Bmg9xGSu.js";import"./Trash01-DDKaJVRQ.js";import"./Upload01-B5AbRmag.js";import"./User01-C5NUNAi1.js";import"./Users01-BCOOK-yw.js";import"./XClose-C8XjR0Oj.js";import"./Zap-DPY_aC88.js";import"./format-time-Cy7tTmZp.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-eq8o4JlH.js";import"./file-type-icon-aSS_wfKX.js";import"./dialog-m1msdckr.js";import"./content-blocks-o63cs2vh.js";import"./types-Dl5kxJ-o.js";import"./constants-C-D4Pmy6.js";import"./chat-context-CQlAaKi3.js";import"./tab-id-CuSxDIM1.js";import"./decopilot-sse-pool-BrQw0UAm.js";import"./create-sse-subscription-BS5983N4.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./use-virtual-mcp-Rn9fsUNN.js";import"./use-collections-ZGWkQryR.js";import"./use-ai-providers-BcOqTKKC.js";import"./use-organization-settings-C-jLCwb5.js";import"./shell-layout-xcJQ-oXv.js";import"./avatar-DXqnRYfU.js";import"./required-auth-layout-CceJrchr.js";import"./useRouterState-CXGDCAP4.js";import"./use-org-sso-Lxt3NvQV.js";import"./integration-icon-D5ZAVm0g.js";import"./use-navigate-to-agent-BYyEy_zS.js";import"./use-connection-BAOUEhf6.js";import"./use-mcp-prompts-BJKxU2Na.js";import"./form-DIz1lXzt.js";import"./label-W8QKQ71a.js";import"./input-D2dMhViX.js";import"./spinner-CXR5LEFP.js";import"./drawer-KxvT14L5.js";import"./collection-search-BJxAlGyH.js";import"./tabs-33vYy1bT.js";import"./toggle-group-CoUQzFHk.js";import"./agent-icons-CasiUZSA.js";import"./checkbox-BIvxdAqx.js";import"./skeleton-HacfcGLU.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-BZG2d-sE.js";import"./card-DJApDAXW.js";import"./connect-desktop-dialog-Dh1zqCgF.js";import"./popover-CBH5jqt8.js";import"./command-BFgPrNtf.js";import"./index-CWjORjiD.js";import"./useInfiniteQuery-CWJ6mtkH.js";import"./infiniteQueryObserver-C0HsJFoc.js";import"./sortable.esm-Dlj8q3TW.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-DHoKYS6O.js";import"./use-registry-connections-DWZHQxm0.js";import"./extract-connection-data-CvUd4tJL.js";import"./generate-id-MICojNT7.js";import"./collections-Btisq60d.js";import"./collection-tabs-CbsCH9v8.js";import"./badge-CnPW-GqK.js";import"./textarea-C-zVkKAJ.js";import"./connection-form-helpers-q_5sAECo.js";import"./use-infinite-scroll-CAJkZLHC.js";import"./useSuspenseInfiniteQuery-DDVcuWif.js";import"./index-ChQwZqpG.js";import"./dropdown-menu-BXhpM-R_.js";import"./question-004-sINsf4GQ.js";import"./shell-route-loading-BToLUOm_.js";import"./sidebar-C1EbFBeG.js";import"./toolbar-BmXelHzT.js";import"./use-create-virtual-mcp-KZ5vkVjY.js";import"./github-repo-picker-CUBnWzWO.js";import"./use-mcp-tools-ftOL48Fr.js";import"./alert-dialog-jD0HIb4F.js";import"./index-Dla-fDpI.js";import"./use-org-auth-client-YKBoNqBy.js";import"./hover-card-BagBBHwl.js";import"./task-status-DdX5GyQu.js";import"./use-status-sounds-DLyX7i_J.js";import"./empty-state-D3juNsZ6.js";import"./resizable-B9nPHbdY.js";import"./use-capability-BsGHGYLW.js";import"./header-tab-button-BCxnrLni.js";import"./index-Dg2RoULU.js";import"./user-Dh7nE-E-.js";import"./tools-list-CV_q_f0Z.js";import"./switch-CWfvQ3qI.js";import"./use-debounced-autosave-CVMWB9VT.js";import"./index-BWtmYkwi.js";import"./search-input-BMiEmNCi.js";import"./use-secrets-BT7pvkDh.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./accordion-7Hq31-jA.js";import"./view-mode-toggle-7zw5kq-m.js";import"./select-model-DYDHHLGi.js";import"./use-automations-BPP1PerV.js";import"./monaco-editor-637MBJHf.js";import"./automation-runs-d4uENwdC.js";import"./table--UQXxBBH.js";import"./use-members-D0MeIqsF.js";import"./automation-list-row-XWf2Pzvs.js";import"./calendar-DeW_DdNU.js";import"./image-field-DInBNYXf.js";import"./use-file-configs-BDCkFZ7E.js";function Mo(g){const t=M.c(38),{orgSlug:N,virtualMcpId:_,branch:k,blockKey:r,block:i,meta:m,title:E,excludeFields:n,schemaPending:C}=g,P=C===void 0?!1:C,e=typeof i?.__resolveType=="string"?i.__resolveType:"";let d;if(t[0]!==n||t[1]!==m||t[2]!==e){const c=e?H(e,m):null;d=c&&n?.length?{...c,properties:Object.fromEntries(Object.entries(c.properties??{}).filter(y=>{const[I]=y;return!n.includes(I)}))}:c,t[0]=n,t[1]=m,t[2]=e,t[3]=d}else d=t[3];const f=d;let u;t[4]!==i||t[5]!==r||t[6]!==m||t[7]!==E?(u=E??(i?J(r,i,m):r),t[4]=i,t[5]=r,t[6]=m,t[7]=E,t[8]=u):u=t[8];const B=u;let x;t[9]!==k||t[10]!==N||t[11]!==_?(x={orgSlug:N,virtualMcpId:_,branch:k},t[9]=k,t[10]=N,t[11]=_,t[12]=x):x=t[12];const{save:K,isPending:R}=Q(x),[A,L]=S.useState(r),[z,O]=S.useState(null),[V,D]=S.useState(0);let h;t[13]===Symbol.for("react.memo_cache_sentinel")?(h=[],t[13]=h):h=t[13];const[w,$]=S.useState(h);A!==r&&(L(r),O(null),D(X),$([]));let v;t[14]!==i?(v=i??{},t[14]=i,t[15]=v):v=t[15];const F=z??v;let b;t[16]!==r||t[17]!==e||t[18]!==K?(b=c=>{const y=c;O(y),K(r,{...y,__resolveType:e})},t[16]=r,t[17]=e,t[18]=K,t[19]=b):b=t[19];const T=b;let p;t[20]!==B?(p=o.jsx("span",{className:"text-sm font-medium",children:B}),t[20]=B,t[21]=p):p=t[21];let s;t[22]!==R?(s=o.jsx(W,{isPending:R,isError:!1}),t[22]=R,t[23]=s):s=t[23];let l;t[24]!==p||t[25]!==s?(l=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[p,s]}),t[24]=p,t[25]=s,t[26]=l):l=t[26];let a;t[27]!==r||t[28]!==w||t[29]!==F||t[30]!==V||t[31]!==T||t[32]!==f||t[33]!==P?(a=o.jsx(G,{className:"min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"px-6 py-6",children:o.jsx("div",{className:"mx-auto max-w-xl",children:f?o.jsx(U,{schema:f,value:F,onChange:T,basePath:"",breadcrumbPath:w,onBreadcrumbChange:$},`${r}:${V}`):P?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(q,{size:16,className:"animate-spin"}),"Loading app schema…"]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:"No editable schema found for this app."})})})}),t[27]=r,t[28]=w,t[29]=F,t[30]=V,t[31]=T,t[32]=f,t[33]=P,t[34]=a):a=t[34];let j;return t[35]!==l||t[36]!==a?(j=o.jsxs("div",{className:"flex h-full flex-col",children:[l,a]}),t[35]=l,t[36]=a,t[37]=j):j=t[37],j}function X(g){return g+1}export{Mo as AppEditor};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import{ce as De,e as J,q as X,K as de,n as Ne,W as Le,$ as ke,F as Ce,o as ve,p as ae,L as re,f as Se,d as Me,g as Fe,r as p,j as ie,t as je,b as Ue,a0 as Ke,aM as qe}from"./index-DHt9Mf9G.js";import{q as Ve,A as Ee,c as Be,s as Ge,v as He,x as We,u as Qe,w as ze}from"./tab-id-CuSxDIM1.js";import{S as Ae,u as _e,g as Xe}from"./constants-C-D4Pmy6.js";import{u as Ye}from"./unwrap-tool-result-BYXdCQMg.js";import{u as Ze}from"./use-virtual-mcp-Rn9fsUNN.js";import{u as Je,b as le}from"./use-ai-providers-BcOqTKKC.js";import{e as et}from"./use-organization-settings-C-jLCwb5.js";const tt={anthropic:["claude-haiku-4-5","claude-haiku"],openrouter:["qwen/qwen3.5-flash","anthropic/claude-haiku-4.5","anthropic/claude-haiku","google/gemini-3-flash"],deco:["qwen/qwen3.5-flash","anthropic/claude-haiku"],google:["gemini-2.5-flash","gemini-3-flash"],"claude-code":["claude-code:haiku","claude-code:sonnet"],codex:["codex:gpt-5.4-mini"]},nt={anthropic:["claude-sonnet-4-6","claude-sonnet"],openrouter:["anthropic/claude-sonnet-4.6","anthropic/claude-sonnet","anthropic/claude-opus-4.8","google/gemini-3-pro"],deco:["anthropic/claude-sonnet-4.6","anthropic/claude-sonnet","anthropic/claude"],google:["gemini-3-pro","gemini-3-flash"],"claude-code":["claude-code:sonnet"],codex:["codex:gpt-5.4"]},ot={anthropic:["claude-fable-5","claude-opus-4-8","claude-sonnet-4-6","claude-sonnet"],openrouter:["anthropic/claude-fable-5","anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6:extended","anthropic/claude-sonnet-4.6","google/gemini-3-pro"],deco:["anthropic/claude-fable","anthropic/claude-opus","anthropic/claude-sonnet-4.6","anthropic/claude-sonnet"],google:["gemini-3-pro"],"claude-code":["claude-code:fable","claude-code:sonnet"],codex:["codex:gpt-5.5"]},st={openrouter:["openai/gpt-image-1","google/gemini-2.0-flash-image"],deco:["openai/gpt-image-1","google/gemini-2.0-flash-image"],google:["gemini-2.0-flash-image"]},at={openrouter:["perplexity/sonar","perplexity/sonar-pro","perplexity/deep-research"],deco:["perplexity/sonar","perplexity/sonar-pro","perplexity/deep-research"]};function ne(t,e,s,n){for(const o of s){const a=t.find(r=>r.modelId===o);if(a)return{keyId:e,modelId:a.modelId,title:a.title}}for(const o of s){const a=t.find(r=>r.modelId.includes(o));if(a)return{keyId:e,modelId:a.modelId,title:a.title}}if(n){const o=t.find(n);if(o)return{keyId:e,modelId:o.modelId,title:o.title}}return null}function rt(t,e){const s={chat:{fast:null,smart:null,thinking:null},image:null,webResearch:null};for(const n of t){const o=e[n.id]??[],a=n.providerId;s.chat.fast||(s.chat.fast=ne(o,n.id,tt[a]??[])),s.chat.smart||(s.chat.smart=ne(o,n.id,nt[a]??[])),s.chat.thinking||(s.chat.thinking=ne(o,n.id,ot[a]??[])),s.image||(s.image=ne(o,n.id,st[a]??[],r=>r.capabilities?.includes("image")===!0)),s.webResearch||(s.webResearch=ne(o,n.id,at[a]??[],r=>{const i=r.modelId.toLowerCase().replace(/[^a-z0-9]/g,"");return i.includes("sonar")||i.includes("deepresearch")}))}return s}const he={decopilot:{harness:"decopilot",sandbox:"agent-sandbox"},"decopilot-desktop":{harness:"decopilot",sandbox:"user-desktop"},"claude-code-desktop":{harness:"claude-code",sandbox:"user-desktop"},"codex-desktop":{harness:"codex",sandbox:"user-desktop"}};function it(t,e){if(!t)return null;const s=e?De(e):null;if(t==="decopilot"&&s===null)return"decopilot";for(const[n,o]of Object.entries(he))if(o.harness===t&&o.sandbox===s)return n;return null}function Ie(t,e){switch(t){case"decopilot":return e.agentSandbox;case"decopilot-desktop":return e.userDesktop;case"claude-code-desktop":return e.userDesktop&&e.claudeCode;case"codex-desktop":return e.userDesktop&&e.codex}}const ct=["decopilot","decopilot-desktop","claude-code-desktop","codex-desktop"];function lt(t,e){return t==null?null:Ie(t,e)?t:ct.find(s=>Ie(s,e))??null}const be={online:!1,capabilities:[]};function dt(){const t=J.c(10),{org:e}=X();let s;t[0]!==e.id||t[1]!==e.slug?(s={connectionId:Ae,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=s):s=t[2];const n=_e(s);let o;t[3]!==e.id?(o=de.currentLink(e.id),t[3]=e.id,t[4]=o):o=t[4];let a;t[5]!==n?(a=async()=>{const h=await n.callTool({name:"LINK_CURRENT_GET",arguments:{}});return Ye(h)??be},t[5]=n,t[6]=a):a=t[6];let r;t[7]!==o||t[8]!==a?(r={queryKey:o,queryFn:a,staleTime:1e4,refetchInterval:15e3,refetchOnWindowFocus:!0},t[7]=o,t[8]=a,t[9]=r):r=t[9];const{data:i}=Ne(r);return i??be}function ut(){const t=J.c(11),e=dt(),s=Le();let n;t[0]!==e.capabilities||t[1]!==e.online?(n=e.online&&e.capabilities.includes("claude-code"),t[0]=e.capabilities,t[1]=e.online,t[2]=n):n=t[2];let o;t[3]!==e.capabilities||t[4]!==e.online?(o=e.online&&e.capabilities.includes("codex"),t[3]=e.capabilities,t[4]=e.online,t[5]=o):o=t[5];let a;return t[6]!==e.online||t[7]!==s.runtime.agentSandbox||t[8]!==n||t[9]!==o?(a={agentSandbox:s.runtime.agentSandbox,userDesktop:e.online,claudeCode:n,codex:o},t[6]=e.online,t[7]=s.runtime.agentSandbox,t[8]=n,t[9]=o,t[10]=a):a=t[10],a}function pt(t){return t.thread?.harness_id!=null?{}:{harnessId:t.globals.harnessId,sandboxProviderKind:t.globals.sandboxProviderKind,branch:t.globals.branch??null}}function ft(t){const e=J.c(10);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},e[0]=s):s=e[0];const n=ke(s);let o;if(e[1]!==n?.params.appSlug||e[2]!==n?.params.collectionName||e[3]!==n?.params.itemId||e[4]!==t){o=[],t&&o.push(`### Selected Agent
|
|
2
|
-
- ID: ${t}`);let a;e[6]!==n?.params.appSlug||e[7]!==n?.params.collectionName||e[8]!==n?.params.itemId?(a=[],n?.params.appSlug&&a.push(`- Connection ID: ${n?.params.appSlug}`),n?.params.collectionName&&a.push(`- Collection: ${n?.params.collectionName}`),n?.params.itemId&&a.push(`- Item ID: ${n?.params.itemId}`),e[6]=n?.params.appSlug,e[7]=n?.params.collectionName,e[8]=n?.params.itemId,e[9]=a):a=e[9],a.length>0&&o.push(`### Current Resource
|
|
3
|
-
The user is viewing the following resource:
|
|
4
|
-
${a.join(`
|
|
5
|
-
`)}
|
|
6
|
-
|
|
7
|
-
Help the user understand and work with this resource.`),e[1]=n?.params.appSlug,e[2]=n?.params.collectionName,e[3]=n?.params.itemId,e[4]=t,e[5]=o}else o=e[5];return o.join(`
|
|
8
|
-
|
|
9
|
-
`)}function ht(){const t=J.c(5),e=Ce(),{org:s}=X();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},t[0]=n):n=t[0];const o=ke(n);let a;return t[1]!==o?.params||t[2]!==s||t[3]!==e?(a=r=>{const h=r.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!h||!h[1])return;const E=h[1],m=o?.params.appSlug;if(!m)return;e.invalidateQueries({queryKey:de.collection(s.slug,m,E)});const f=E.toLowerCase().replace(/_/g," ");ve.success(`${f} updated`)},t[1]=o?.params,t[2]=s,t[3]=e,t[4]=a):a=t[4],a}function mt(){const t=J.c(4),{org:e,project:s}=X(),n=`${e.id}/${s.id}`;let o;t[0]!==n?(o=re.taskLastViewed(n),t[0]=n,t[1]=o):o=t[1];const[,a]=ae(o,gt);let r;return t[2]!==a?(r={markTaskRead:h=>{a(E=>({...E,[h]:new Date().toISOString()}))}},t[2]=a,t[3]=r):r=t[3],r}function gt(t){return t??{}}function we(){const t=Se(),{org:e}=X(),s=Me({strict:!1}),n=Fe({strict:!1}),o=s.virtualmcpid??Xe(e.id).id,a=(h,E)=>{t({to:"/$org/$taskId",params:{org:e.slug,taskId:h},search:m=>{const f={},R=E?.virtualMcpId??m.virtualmcpid;R&&(f.virtualmcpid=R);const g=m.main;return g&&typeof g=="string"&&!Ve(g)&&(f.main=g),m.chat&&(f.chat=m.chat),E?.autosend&&(f.autosend=Ee),f}})},r=p.useRef(crypto.randomUUID()),i=n.taskId??r.current;return{virtualMcpId:o,taskId:i,navigateToTask:a}}function xt(t,e){const{mimeType:s,data:n}=t;if(s.startsWith("text/"))try{const o=new TextDecoder().decode(Uint8Array.from(atob(n),a=>a.charCodeAt(0)));return[{type:"text",text:`${e}
|
|
10
|
-
${o}`}]}catch(o){console.error("Failed to decode text file:",o)}return[{type:"file",url:`data:${s};base64,${n}`,filename:e,mediaType:s}]}function ye(t,e){const s=[];for(const n of t)"text"in n&&n.text?s.push({type:"text",text:`[${e}]
|
|
11
|
-
${n.text}`}):"blob"in n&&n.blob&&n.mimeType&&s.push({type:"file",url:`data:${n.mimeType};base64,${n.blob}`,filename:String(n.uri),mediaType:String(n.mimeType)});return s}function It(t,e){const s=[];for(const n of t){if(n.role!=="user"||!n.content)continue;const o=Array.isArray(n.content)?n.content:[n.content];for(const a of o)switch(a.type){case"text":{const r=a.text?.trim();if(!r)continue;s.push({type:"text",text:`[${e}]
|
|
12
|
-
${r}`});break}case"image":case"audio":{if(!a.data||!a.mimeType)continue;s.push({type:"file",url:`data:${a.mimeType};base64,${a.data}`,mediaType:a.mimeType});break}case"resource":{const r=a.resource;if(!r||!r.mimeType)continue;r&&("text"in r&&r.text?s.push({type:"text",text:`[${e}]
|
|
13
|
-
${r.text}`}):"blob"in r&&r.blob&&r.mimeType&&s.push({type:"file",url:`data:${r.mimeType};base64,${r.blob}`,filename:String(r.uri),mediaType:String(r.mimeType)}));break}}}return s}function Pe(t){if(!t)return[];const e=[];let s="";const n=o=>{if(o){if(o.type==="text"&&"text"in o&&typeof o.text=="string")s+=o.text;else if(o.type==="mention"&&o.attrs){const a=o.attrs.char??"/",r=`${a}${o.attrs.name}`;if(s+=r,a==="@"){const i=o.attrs.metadata;i&&!Array.isArray(i)&&"agentId"in i?e.push({type:"text",text:`[DELEGATE TO AGENT: ${i.title??o.attrs.name} (agent_id: ${i.agentId})]
|
|
14
|
-
Use the subtask tool to delegate this task to the agent above. Include the full relevant context from this conversation in the prompt field — the subagent has no conversation history.`}):Array.isArray(i)&&e.push(...ye(i,r))}else{const i=o.attrs.metadata||o.attrs.prompts||[];Array.isArray(i)&&i.length>0&&"role"in i[0]?e.push(...It(i,r)):Array.isArray(i)&&e.push(...ye(i,r))}}else if(o.type==="file"&&o.attrs){const a=o.attrs,r=`[file:://${encodeURIComponent(a.name)}]`;s+=r,e.push(...xt(a,r))}if("content"in o&&Array.isArray(o.content))for(const a of o.content)n(a)}};return n(t),s.trim()&&e.unshift({type:"text",text:s.trim()}),e}function Dt(t){const e=Pe(t);return e.length===0?[]:[{id:crypto.randomUUID(),role:"user",parts:e,metadata:{tiptapDoc:t}}]}const Te=new Set;function oe(t){return p.useSyncExternalStore(t.subscribe,t.get,t.get)}function bt(t){return t.kind==="loading"?"ready":t.kind}function se(t,e,s,n){if(!t)return null;const o=e.find(r=>r.id===t.keyId);if(!o)return null;const a=s.find(r=>r.modelId===t.modelId);return a?{...a,keyId:t.keyId}:{modelId:t.modelId,title:n??t.modelId,keyId:t.keyId,providerId:o.providerId,description:null,logo:null,capabilities:[],limits:null,costs:null}}function yt(t){return t==="fast"||t==="smart"||t==="thinking"?t:"smart"}function Tt(t,e,s,n){if(!s||n.length===0)return null;const o=e.find(h=>h.id===s);if(!o)return null;const a=rt([o],{[s]:n}),r=t==="fast"?a.chat.fast:t==="thinking"?a.chat.thinking:a.chat.smart;if(!r)return null;const i=n.find(h=>h.modelId===r.modelId);return i?{...i,keyId:s}:null}const kt=1e4,Ct=10,me=p.createContext(null),ge=p.createContext(null),xe=p.createContext(null),Re=p.createContext(null);function vt({children:t}){const{locator:e}=X(),{virtualMcpId:s}=we(),[n,o]=ae(re.chatSelectedImageModel(e),null),[a,r]=ae(re.chatSelectedDeepResearchModel(e),null),[i,h]=p.useState(null),[E,m]=p.useState("default"),f=et(),[R,g]=ae(re.chatSimpleModeTier(e),null),T=yt(R),b=Je(),$=f.tiers[T],O=i&&b.some(c=>c.id===i)?i:$?.keyId??b[0]?.id??null,{models:x,isLoading:k}=le(O??void 0),{models:D}=le($?.keyId),{models:B}=le(f.tiers.image?.keyId),{models:N}=le(f.tiers.web_research?.keyId),K=se($,b,D,$?.title)??Tt(T,b,O,x),C=k,L=x.filter(c=>c.capabilities?.includes("image")),q=se(n,b,L),V=se(f.tiers.image,b,B,f.tiers.image?.title)??q??L[0]??null,u=x.filter(c=>{const S=c.modelId.toLowerCase().replace(/[^a-z0-9]/g,"");return S.includes("sonar")||S.includes("deepresearch")}),v=se(a,b,u),P=u.find(c=>c.modelId==="perplexity/sonar")??u[0]??null,G=se(f.tiers.web_research,b,N,f.tiers.web_research?.title)??v??P,W=Ze(s)??{id:s,title:"",description:null,icon:null},[M,F]=p.useState({}),I=(c,S)=>{const te=[];for(const j of S.content??[])j.type==="text"&&j.text?.trim()&&te.push(j.text.trim());const w=te.join(`
|
|
15
|
-
`);if(!w){A(c);return}new TextEncoder().encode(w).length>kt||F(j=>Object.keys(j).length>=Ct&&!(c in j)?j:{...j,[c]:w})},A=c=>{F(S=>{const{[c]:te,...w}=S;return w})},[Y,Q]=ae(re.chatLastAgentOption(e),c=>c&&c in he?c:null),z=Et(),Z=z?.isThreadLocked&&z.lockedHarness!=null?it(z.lockedHarness,z.lockedSandbox):null,ue=ut(),pe=lt(Y,ue),ce=z?.isThreadLocked?Z:pe,ee=ce?he[ce]:null,fe=ee?.harness??null,l=ee?.sandbox??null,[d,y]=p.useState(void 0),_=p.useRef(d);_.current=d;const U={selectedModel:K,setModel:()=>{},credentialId:O,setCredentialId:h,allModelsConnections:b,isModelsLoading:C,selectedVirtualMcp:W,imageModel:V,setImageModel:c=>{o(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},deepResearchModel:G,setDeepResearchModel:c=>{r(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},chatMode:E,setChatMode:m,appContexts:M,setAppContext:I,clearAppContext:A,tiptapDoc:d,setTiptapDoc:y,tiptapDocRef:_,resetInteraction:()=>{},simpleModeTier:T,setSimpleModeTier:c=>g(c),pendingAgentOption:ce,setPendingAgentOption:Q,pendingHarnessId:fe,pendingSandboxProviderKind:l};return ie.jsx(xe.Provider,{value:U,children:t})}function Nt(t){const e=J.c(41),{virtualMcpId:s,task:n,children:o}=t,{locator:a}=X(),{data:r}=Ue.useSession(),i=r?.user??null,{taskId:h,virtualMcpId:E,navigateToTask:m}=we(),[f]=Ke(),{markTaskRead:R}=mt(),g=Qe(),T=h,b=E,$=ft(b);let O;e[0]!==R||e[1]!==m?(O=(I,A)=>{R(I),m(I,{virtualMcpId:A?.virtualMcpId,autosend:A?.autosend})},e[0]=R,e[1]=m,e[2]=O):O=e[2];const x=O,k=T&&n?.id===T?n:null,D=k?.harness_id??null,B=k?.sandbox_provider_kind??null,N=k?.branch??null,K=D!=null,C=N;let L;e[3]!==C||e[4]!==x||e[5]!==g||e[6]!==s?(L=()=>{const I=crypto.randomUUID();return g.create({id:I,virtual_mcp_id:s,...C?{branch:C}:{}}).then(()=>x(I)).catch(()=>{x(I)}),I},e[3]=C,e[4]=x,e[5]=g,e[6]=s,e[7]=L):L=e[7];const q=L;let V;e[8]!==C||e[9]!==a||e[10]!==x||e[11]!==g||e[12]!==s?(V=I=>{const A=crypto.randomUUID(),Y=I.virtualMcpId??s,Q=Y===s?C:null;ze(sessionStorage,a,A,I.message),g.create({id:A,virtual_mcp_id:Y,...Q?{branch:Q}:{}}).then(()=>x(A,{virtualMcpId:I.virtualMcpId,autosend:!0})).catch(()=>{x(A,{virtualMcpId:I.virtualMcpId,autosend:!0})})},e[8]=C,e[9]=a,e[10]=x,e[11]=g,e[12]=s,e[13]=V):V=e[13];const u=V;let v;e[14]!==T||e[15]!==g?(v=I=>{T&&g.setBranch(T,I)},e[14]=T,e[15]=g,e[16]=v):v=e[16];let P;e[17]!==k||e[18]!==q||e[19]!==u||e[20]!==C||e[21]!==T||e[22]!==b||e[23]!==K||e[24]!==N||e[25]!==D||e[26]!==B||e[27]!==x||e[28]!==v?(P={virtualMcpId:b,taskId:T,openTask:x,createTask:q,createTaskWithMessage:u,activeTask:k,isThreadLocked:K,lockedHarness:D,lockedSandbox:B,lockedBranch:N,currentBranch:C,setCurrentTaskBranch:v},e[17]=k,e[18]=q,e[19]=u,e[20]=C,e[21]=T,e[22]=b,e[23]=K,e[24]=N,e[25]=D,e[26]=B,e[27]=x,e[28]=v,e[29]=P):P=e[29];const G=P;let H;e[30]!==$||e[31]!==f||e[32]!==m||e[33]!==i?(H={user:i,contextPrompt:$,preferences:f,rawNavigateToTask:m},e[30]=$,e[31]=f,e[32]=m,e[33]=i,e[34]=H):H=e[34];const W=H;let M;e[35]!==o||e[36]!==W?(M=ie.jsx(vt,{children:ie.jsx(Re.Provider,{value:W,children:o})}),e[35]=o,e[36]=W,e[37]=M):M=e[37];let F;return e[38]!==M||e[39]!==G?(F=ie.jsx(ge.Provider,{value:G,children:M}),e[38]=M,e[39]=G,e[40]=F):F=e[40],F}function Lt({taskId:t,children:e}){const{virtualMcpId:s,activeTask:n,currentBranch:o}=St();t&&!Te.has(t)&&(Te.add(t),je("chat_opened",{thread_id:t}));const{imageModel:a,deepResearchModel:r,chatMode:i,setChatMode:h,appContexts:E,setTiptapDoc:m,simpleModeTier:f,pendingSandboxProviderKind:R,pendingHarnessId:g}=Mt(),T=p.useContext(Re);if(!T)throw new Error("ActiveTaskProvider must be used within ChatContextProvider");const{user:b,contextPrompt:$,preferences:O,rawNavigateToTask:x}=T,{org:k,locator:D}=X(),[B,N]=p.useState(null),K=ht(),C=Ce(),L=Be(),q=Se(),V=_e({connectionId:Ae,orgId:k.id,orgSlug:k.slug}),u=Ge(k.slug,t,{client:V});p.use(u.ready);const v=oe(u.messages),P=oe(u.status),G=oe(u.finishReason),H=oe(u.hasMoreOlder),W=oe(u.isFetchingOlder),M=p.useRef({onToolCall:K,queryClient:C,rawNavigateToTask:x,taskId:t,manager:L,navigate:q,orgSlug:k.slug});M.current={onToolCall:K,queryClient:C,rawNavigateToTask:x,taskId:t,manager:L,navigate:q,orgSlug:k.slug},p.useEffect(()=>{const l={onData:d=>{if(d.type==="data-thread-title"){const y=d.data;if(!y?.title)return;const _=M.current;if(!_.taskId)return;_.manager.patchThread({id:_.taskId,title:y.title,updated_at:new Date().toISOString()});return}if(d.type==="data-html-page-published"){const y=d.data;if(!y?.slug)return;const _=y.slug;M.current.navigate({to:".",search:U=>({...U,main:`web-page:${_}`}),replace:!0});return}},onFinish:d=>{const y=M.current,_=d.parts?.some(c=>{const S=c;return(S.type==="tool-share_with_user"||S.type==="tool-bash"||S.type==="tool-write")&&S.state==="output-available"});if(y.taskId&&_){const c=de.threadOutputs(y.taskId);for(const S of[0,1500,3e3,6e3,12e3,25e3])setTimeout(()=>{y.queryClient.invalidateQueries({queryKey:c})},S)}y.queryClient.invalidateQueries({queryKey:de.homeNextActions(y.orgSlug)});const U=d.metadata?.thread_id;U&&U!==y.taskId&&y.rawNavigateToTask(U)},onError:d=>{N(d),console.error("[chat] Error",d)},onToolCall:d=>M.current.onToolCall(d)};return u.observer=l,()=>{u.observer===l&&(u.observer=null)}},[u]);const F=P.kind==="submitted"||P.kind==="streaming",I=v.length===0,A=v.at(-1),Y=!F&&A?.role==="assistant"&&A.parts.some(l=>"state"in l&&l.state==="approval-requested"),Q=n,z=(Q?.status==="in_progress"||Q?.status==="expired")&&P.kind==="ready"&&v.length>0;async function Z(l){const d=l.parts??Pe(l.tiptapDoc);if(d.length===0)return;const y=t,_=s;N(null),m(void 0);const U={tiptapDoc:l.tiptapDoc,created_at:new Date().toISOString(),user:{avatar:b?.image??void 0,name:b?.name??"you"}},c=Object.entries(E),S=c.length>0?c.map(([$e,Oe])=>`### App Context: ${$e}
|
|
16
|
-
${Oe}`).join(`
|
|
17
|
-
|
|
18
|
-
`):"",te=[$,S].filter(Boolean).join(`
|
|
19
|
-
|
|
20
|
-
`);let w=i;w==="gen-image"&&!a&&(w="default"),w==="web-search"&&!r&&(w="default"),w==="web-search"&&h("default");const j={id:crypto.randomUUID(),role:"user",parts:d,metadata:U};await u.submit({kind:"message",message:j},{tier:f,mode:w,toolApprovalLevel:O.toolApprovalLevel??qe(),system:te||void 0,agent:{id:_},thread_id:y,...pt({thread:n?{harness_id:n.harness_id??null,sandbox_provider_kind:n.sandbox_provider_kind??null,branch:n.branch??null}:null,globals:{harnessId:g??void 0,sandboxProviderKind:R??void 0,branch:o}})})}const ue=async()=>{u.stop();try{const l=await fetch(`/api/${k.slug}/decopilot/cancel/${t}`,{method:"POST",credentials:"include"});if(l.status===404)return;if(!l.ok){const d=await l.json().catch(()=>({}));throw new Error(d.message??`Cancel failed: ${l.status}`)}}catch(l){const d=l instanceof Error?l.message:"Failed to cancel";ve.error(d),console.error("[chat] cancelRun",l)}},pe=l=>l&&typeof l=="object"&&"type"in l?Z({tiptapDoc:l}):Z(l),ee=Me({strict:!1}).autosend===Ee;p.useEffect(()=>{if(!ee||v.length>0)return;const l=He(sessionStorage,D,t);l&&Z(l.message).then(()=>{We(sessionStorage,D,t)})},[ee,v.length,D,t,Z]);const fe={messages:v,status:bt(P),sendMessage:pe,stop:()=>{ue()},submit:(l,d)=>u.submit(l,d),error:B,clearError:()=>N(null),finishReason:G,clearFinishReason:()=>u.finishReason.set(null),isStreaming:F,isChatEmpty:I,isWaitingForApprovals:Y??!1,isRunInProgress:z,hasMoreOlder:H,isFetchingOlder:W,fetchOlderMessages:u.fetchOlderMessages.bind(u)};return ie.jsx(me.Provider,{value:fe,children:e})}function Ft(){const t=p.useContext(me);if(!t)throw new Error("useChatStream must be used within ActiveTaskProvider");return t}function jt(){return p.useContext(me)}function St(){const t=p.useContext(ge);if(!t)throw new Error("useChatTask must be used within ChatContextProvider");return t}function Mt(){const t=p.useContext(xe);if(!t)throw new Error("useChatPrefs must be used within ChatContextProvider");return t}function Ut(){return p.useContext(xe)}function Et(){return p.useContext(ge)}export{Lt as A,vt as C,Ft as a,St as b,Mt as c,Et as d,Pe as e,jt as f,ut as g,Nt as h,Ut as i,rt as p,Dt as t,dt as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as k,r as C,j as t,B as b}from"./index-DHt9Mf9G.js";import{c as D,e as N,b as v,a as I,D as T}from"./dialog-m1msdckr.js";import{S as L}from"./spinner-CXR5LEFP.js";import{i as S}from"./Check-DwRXhDYN.js";import{a as y}from"./Eye-CbDINxSR.js";import{u as A}from"./chat-context-CQlAaKi3.js";const g="bunx decocms link",B={"claude-code":"Claude Code",codex:"Codex"};function j(d){return d.map(e=>B[e]).filter(e=>!!e)}function _(d){const e=k.c(23),{open:m,onOpenChange:p}=d,s=A(),[x,h]=C.useState(!1),u=s.online?"Desktop connected":"Connect your desktop";let i;e[0]!==u?(i=t.jsx(D,{children:u}),e[0]=u,e[1]=i):i=e[1];const f=s.online?"Your desktop is online. Pick a desktop agent in the chat to use it.":"Run this command in your desktop terminal. The dialog will close once your desktop is online.";let o;e[2]!==f?(o=t.jsx(N,{children:f}),e[2]=f,e[3]=o):o=e[3];let n;e[4]!==i||e[5]!==o?(n=t.jsxs(v,{children:[i,o]}),e[4]=i,e[5]=o,e[6]=n):n=e[6];let l;e[7]!==x||e[8]!==s.online?(l=!s.online&&t.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-sm",children:[t.jsx("span",{className:"flex-1",children:g}),t.jsx(b,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard.writeText(g),h(!0),setTimeout(()=>h(!1),1500)},children:x?t.jsx(S,{size:14}):t.jsx(y,{size:14})})]}),e[7]=x,e[8]=s.online,e[9]=l):l=e[9];let a;e[10]!==s.capabilities||e[11]!==s.hostname||e[12]!==s.machineId||e[13]!==s.online?(a=s.online?t.jsxs("div",{className:"flex flex-col gap-1 text-sm",children:[t.jsxs("p",{className:"text-foreground",children:[s.hostname??s.machineId??"Your desktop"," is linked."]}),j(s.capabilities).length>0&&t.jsxs("p",{className:"text-muted-foreground",children:["Available: ",j(s.capabilities).join(", ")]})]}):t.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t.jsx(L,{size:"sm"}),"Waiting for desktop…"]}),e[10]=s.capabilities,e[11]=s.hostname,e[12]=s.machineId,e[13]=s.online,e[14]=a):a=e[14];let c;e[15]!==n||e[16]!==l||e[17]!==a?(c=t.jsxs(I,{className:"sm:max-w-md",children:[n,l,a]}),e[15]=n,e[16]=l,e[17]=a,e[18]=c):c=e[18];let r;return e[19]!==p||e[20]!==m||e[21]!==c?(r=t.jsx(T,{open:m,onOpenChange:p,children:c}),e[19]=p,e[20]=m,e[21]=c,e[22]=r):r=e[22],r}export{_ as C,j as v};
|