decocms 3.17.1 → 3.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-DtsIkyhv.js → AlertCircle-kk9FGUJy.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-CC6Cv2i7.js → ArrowUpRight-XiN-bNvq.js} +1 -1
- package/dist/client/assets/{Check-vtGHgjfG.js → Check-BCfJiZjb.js} +1 -1
- package/dist/client/assets/{CheckCircle-BVxEOwgz.js → CheckCircle-DUtE0DmA.js} +1 -1
- package/dist/client/assets/{ChevronDown--sdzrX52.js → ChevronDown-BEW-c3gB.js} +1 -1
- package/dist/client/assets/{ChevronLeft-HhUtQNOL.js → ChevronLeft-CMqbWQ59.js} +1 -1
- package/dist/client/assets/{ChevronRight-I6954Qlw.js → ChevronRight-zMBQRLRl.js} +1 -1
- package/dist/client/assets/{ChevronUp-B7_FaTuI.js → ChevronUp-GpCP941Q.js} +1 -1
- package/dist/client/assets/{Container-UwZa4Sjq.js → Container-C-qyCnTQ.js} +1 -1
- package/dist/client/assets/{DotsVertical-CRhU-CQp.js → DotsVertical-CToOc1lA.js} +1 -1
- package/dist/client/assets/{Eye-CrIialez.js → Eye-DJA4t4LG.js} +1 -1
- package/dist/client/assets/{FilterLines-CcSUEwfK.js → FilterLines-CWGo6iBt.js} +1 -1
- package/dist/client/assets/{Globe01-CWUyneqk.js → Globe01-BIDyppIG.js} +1 -1
- package/dist/client/assets/{HardDrive-B4ApPRkU.js → HardDrive-zH516u4z.js} +1 -1
- package/dist/client/assets/{Key01-D8nYbfp6.js → Key01-CzVuKrFC.js} +1 -1
- package/dist/client/assets/{LayoutLeft-CYBI43zr.js → LayoutLeft-BdJGuKDp.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BBQVGsHV.js → LinkExternal01-BjJ3q250.js} +1 -1
- package/dist/client/assets/{Monitor01-BqyNv3z7.js → Monitor01-BZbk9qOn.js} +1 -1
- package/dist/client/assets/{Palette-Dc7v0Lbc.js → Palette-BRbkJewR.js} +1 -1
- package/dist/client/assets/{Play-Bfu6rzoI.js → Play-C4g6iAp0.js} +1 -1
- package/dist/client/assets/{Plus-CAk921Ey.js → Plus-p_eZ4_sI.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-CJHsMXtu.js → RefreshCcw01-qZip7VuS.js} +1 -1
- package/dist/client/assets/{SearchMd-BGGjtsz7.js → SearchMd-CeenWY4R.js} +1 -1
- package/dist/client/assets/{Settings02-B3pc9FAS.js → Settings02-CaiJb4hz.js} +1 -1
- package/dist/client/assets/{Shield01-CevvPkir.js → Shield01-BqdSTZVE.js} +1 -1
- package/dist/client/assets/{Star01-B2sYJOUY.js → Star01-CfjDLIEN.js} +1 -1
- package/dist/client/assets/{Stars01-ChUleI_g.js → Stars01-BBw3zOME.js} +1 -1
- package/dist/client/assets/{Stars02-DR0TfdJs.js → Stars02-CkrNg1qh.js} +1 -1
- package/dist/client/assets/{Sun-D0Tw1Afb.js → Sun-dLAn0e4t.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-UKGE6L3t.js → SwitchHorizontal01-BEpb72lq.js} +1 -1
- package/dist/client/assets/{Tool01-NFK8H_gw.js → Tool01-DkOxZLha.js} +1 -1
- package/dist/client/assets/{Trash01-BV0g0LQO.js → Trash01-xXJmX-sD.js} +1 -1
- package/dist/client/assets/{Upload01-VAW7QmhA.js → Upload01-DxZby23M.js} +1 -1
- package/dist/client/assets/{User01-DaoMnnxf.js → User01-CzXXeh_v.js} +1 -1
- package/dist/client/assets/{Users01-BlMLYKx0.js → Users01-94UCCjNj.js} +1 -1
- package/dist/client/assets/{Users03-B7HqdPkm.js → Users03-CwkYSEUE.js} +1 -1
- package/dist/client/assets/{X-Tdfyixv6.js → X-DwTKQTxe.js} +1 -1
- package/dist/client/assets/{XCircle-B14veD9i.js → XCircle-BapiRyFg.js} +1 -1
- package/dist/client/assets/{XClose-Blplvetp.js → XClose-KPa7x8br.js} +1 -1
- package/dist/client/assets/{Zap-DXci2BUM.js → Zap-BcSt62LH.js} +1 -1
- package/dist/client/assets/{ZapSquare-DzpMrwRR.js → ZapSquare-b4NUHEFQ.js} +1 -1
- package/dist/client/assets/{ZoomOut-CT9E4Qhq.js → ZoomOut-C5miuqST.js} +1 -1
- package/dist/client/assets/{access-gate-DiknBkEw.js → access-gate-8HW9OuOb.js} +1 -1
- package/dist/client/assets/{accordion-CtA-xauN.js → accordion-BIaDH-L5.js} +1 -1
- package/dist/client/assets/{add-section-modal-DlaN-qAI.js → add-section-modal-CmX0FN0o.js} +1 -1
- package/dist/client/assets/{agent-capabilities-CmInpctC.js → agent-capabilities-Vf98w6Vs.js} +1 -1
- package/dist/client/assets/{agent-icon-zELPPL2m.js → agent-icon-gyWkxLBk.js} +1 -1
- package/dist/client/assets/{agent-icons-x_5O6PzC.js → agent-icons-dnfBtPac.js} +1 -1
- package/dist/client/assets/{agents-list-Bszw9lN6.js → agents-list-C3f_Royz.js} +1 -1
- package/dist/client/assets/{ai-providers-BEo_1p1S.js → ai-providers-BLKqKorT.js} +1 -1
- package/dist/client/assets/{alert-CfEuO2dR.js → alert-CsiirETr.js} +1 -1
- package/dist/client/assets/{alert-dialog-CU8ZYA21.js → alert-dialog-BuTseZND.js} +1 -1
- package/dist/client/assets/app-editor-2_JzmjTF.js +1 -0
- package/dist/client/assets/{auth-catchall-CKY6yLJq.js → auth-catchall-ZFdl3UC_.js} +1 -1
- package/dist/client/assets/{auth-split-layout-CUDE_iDP.js → auth-split-layout-BE5JLVch.js} +1 -1
- package/dist/client/assets/{automation-list-row-CH--ZnEF.js → automation-list-row-CKNK1BAe.js} +1 -1
- package/dist/client/assets/{automation-runs-yWXMKQTD.js → automation-runs-BUXJQuB4.js} +1 -1
- package/dist/client/assets/{automations-qMMzEqRX.js → automations-BA25-sZf.js} +1 -1
- package/dist/client/assets/{avatar-DXzeiiiO.js → avatar--94y31lg.js} +1 -1
- package/dist/client/assets/{badge-zsFX23zy.js → badge-UXeMkv1N.js} +1 -1
- package/dist/client/assets/{brand-context-4BmiQwTN.js → brand-context-CqaG6QTo.js} +1 -1
- package/dist/client/assets/{buckets-CCG_qbCS.js → buckets-Dg1MrAKJ.js} +1 -1
- package/dist/client/assets/{calendar-Crmr906f.js → calendar-CJCfeKbq.js} +1 -1
- package/dist/client/assets/{capability-load-error-BravgH0a.js → capability-load-error-D9xVNApx.js} +1 -1
- package/dist/client/assets/{card-D5IvObwB.js → card-CgXj3w0j.js} +1 -1
- package/dist/client/assets/{chat-context-LqGwxYAF.js → chat-context-CWAb0_7m.js} +1 -1
- package/dist/client/assets/{checkbox-OOQKZtC_.js → checkbox-D0ucHXyU.js} +1 -1
- package/dist/client/assets/{cli-auth-success-DhicbQB5.js → cli-auth-success-D7tyPLCS.js} +1 -1
- package/dist/client/assets/{collection-detail-BbVWcOS7.js → collection-detail-LRaP_NyB.js} +1 -1
- package/dist/client/assets/{collection-display-button-D5hrgHkh.js → collection-display-button-zpu5JdsR.js} +1 -1
- package/dist/client/assets/{collection-search-DGClB-Gb.js → collection-search-DetB6uj9.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-VWPtHFYE.js → collection-table-wrapper-DsC9xhMF.js} +1 -1
- package/dist/client/assets/{collection-tabs-BQEO65ib.js → collection-tabs-BJeLyyG1.js} +1 -1
- package/dist/client/assets/{collections-C_m5uhEc.js → collections-D6clkX5p.js} +1 -1
- package/dist/client/assets/{command-DzVv4p4m.js → command-CzRkAUH-.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-CZAbswkh.js → connect-desktop-dialog-DkxlyLoV.js} +1 -1
- package/dist/client/assets/{connection-card-CDttZAWV.js → connection-card-CeEDgo5u.js} +1 -1
- package/dist/client/assets/{connection-detail-CWgx3CGW.js → connection-detail-KvDZ2-Wm.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-BgC55lri.js → connection-form-helpers-D1KznvTK.js} +1 -1
- package/dist/client/assets/{connections-BTE9TZOq.js → connections-1SUnkdnY.js} +1 -1
- package/dist/client/assets/{constants-BCfpLdj8.js → constants-Cyw8HlyN.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-nEWZU_3q.js → decopilot-sse-pool-0KCpBXCU.js} +1 -1
- package/dist/client/assets/{dialog-CLtwKT7T.js → dialog-CvHDSOMQ.js} +1 -1
- package/dist/client/assets/{domain-settings-DnOdm4Gh.js → domain-settings-CPNKHgv3.js} +1 -1
- package/dist/client/assets/{drawer-BewkeO2E.js → drawer-BCVb0_Ol.js} +1 -1
- package/dist/client/assets/{dropdown-menu-COlaUXPy.js → dropdown-menu-D39dKUR6.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-CboUuftB.js → dynamic-plugin-layout-C-ivPtv7.js} +1 -1
- package/dist/client/assets/{empty-state-Cm-JBk7p.js → empty-state-B9ubyBEL.js} +1 -1
- package/dist/client/assets/{empty-state-CZdqlaa-.js → empty-state-BUXcxrjO.js} +1 -1
- package/dist/client/assets/{extract-connection-data-F1Fp1AMr.js → extract-connection-data-F7Hf5agN.js} +1 -1
- package/dist/client/assets/{features-BPybOqVM.js → features-ik9fVjiY.js} +1 -1
- package/dist/client/assets/{file-explorer-Dfpjlouj.js → file-explorer-0jyhjp97.js} +1 -1
- package/dist/client/assets/{file-type-icon-DfjHHTyz.js → file-type-icon-CWTUMGMk.js} +1 -1
- package/dist/client/assets/{files-Jq4xd8Mr.js → files-6hTuIWXI.js} +1 -1
- package/dist/client/assets/{form-hhL2WFgR.js → form-Bm14S2fw.js} +1 -1
- package/dist/client/assets/{general-Bs5LdWae.js → general-DUMngie3.js} +1 -1
- package/dist/client/assets/{generate-id-D01ICZCx.js → generate-id-DRkpi1K_.js} +1 -1
- package/dist/client/assets/{github-repo-picker-CvAVXvxg.js → github-repo-picker-BRIiungm.js} +1 -1
- package/dist/client/assets/{header-tab-button-D5FYUotU.js → header-tab-button-CtyhaUoh.js} +1 -1
- package/dist/client/assets/{hover-card-CeQv0SdX.js → hover-card-CoPuK3sz.js} +1 -1
- package/dist/client/assets/{image-field-DlsH5ki1.js → image-field-Bc96qNtk.js} +1 -1
- package/dist/client/assets/{index-MDvkqSr6.js → index-46rIaXY5.js} +1 -1
- package/dist/client/assets/{index-BZAd5qB-.js → index-B7NrgKCO.js} +1 -1
- package/dist/client/assets/{index-CW2GDOZp.js → index-BPW95yv1.js} +3 -3
- package/dist/client/assets/{index-C2ou5Sih.js → index-BXMoMgIx.js} +1 -1
- package/dist/client/assets/{index-Cu5tt_hf.js → index-BwNRRrEM.js} +1 -1
- package/dist/client/assets/{index-DVjiRpca.js → index-C3xtZZkB.js} +1 -1
- package/dist/client/assets/{index-CtKv8aMq.js → index-CU8sRbSt.js} +1 -1
- package/dist/client/assets/{index-DljQCipR.js → index-CUopo4gE.js} +1 -1
- package/dist/client/assets/{index-BsTDIiyh.js → index-CZxxRf5L.js} +1 -1
- package/dist/client/assets/{index-C3xxqIK9.js → index-CaHoJer0.js} +1 -1
- package/dist/client/assets/{index-BTfRGSGJ.js → index-DO2HEAud.js} +1 -1
- package/dist/client/assets/{index-CZHEDR-7.js → index-DVTNQZZw.js} +1 -1
- package/dist/client/assets/{index-Dtlw9Wg_.js → index-DzkseZbE.js} +1 -1
- package/dist/client/assets/{index-IBdkM0WT.js → index-Lo8_OOo7.js} +4 -4
- package/dist/client/assets/{index-8WMbGW3I.js → index-NXk-KEYm.js} +1 -1
- package/dist/client/assets/{index-redirect-BQ64Fw6U.js → index-redirect-DZfBU3ca.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-CNU9jr7j.js → infiniteQueryObserver-BwWnRM4l.js} +1 -1
- package/dist/client/assets/{input-C6I0qBHa.js → input-Di4NLV7k.js} +1 -1
- package/dist/client/assets/{integration-icon-CRQNKwzw.js → integration-icon-BltEmUHe.js} +1 -1
- package/dist/client/assets/{label-CBS86XNa.js → label-BiUZV55U.js} +1 -1
- package/dist/client/assets/{layout-f-vBvuP7.js → layout-WwJpht6M.js} +1 -1
- package/dist/client/assets/{login-mW1jrlie.js → login-D6T8yD13.js} +1 -1
- package/dist/client/assets/{members-C0DJ4-OC.js → members-BaP_UV0b.js} +1 -1
- package/dist/client/assets/{monaco-editor--4Yuy9-K.js → monaco-editor-Bqkz-12r.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-B05aJEZ3.js → monitoring-stats-row-BMi5DzAN.js} +1 -1
- package/dist/client/assets/{oauth-callback-BAaF4Jac.js → oauth-callback-C0p3We4S.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-CXA6h4bA.js → oauth-callback-ai-provider-b3zuaQJ5.js} +1 -1
- package/dist/client/assets/{onboarding-DwclTGQV.js → onboarding-CuXC9Ufz.js} +1 -1
- package/dist/client/assets/{org-install-ClS1U1Is.js → org-install-BGGt6TSx.js} +1 -1
- package/dist/client/assets/{org-layout-D2q337za.js → org-layout-BtG5PY_T.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-BU42ml-u.js → org-plugin-layout-DfPAfLHM.js} +1 -1
- package/dist/client/assets/{page-seo-form-BSUK8MM8.js → page-seo-form-BJyw-bVr.js} +1 -1
- package/dist/client/assets/page-seo-sheet-CppVgk_x.js +1 -0
- package/dist/client/assets/{pair-CZ7RQwEQ.js → pair-BoH0kSdH.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-DUHVGpp4.js → plugin-empty-state-DtPrUQKq.js} +1 -1
- package/dist/client/assets/{plugin-header-Ce72Z8AJ.js → plugin-header-BQxiKz1o.js} +1 -1
- package/dist/client/assets/{plugin-layout-quK7uCnU.js → plugin-layout-B8BjC_OI.js} +1 -1
- package/dist/client/assets/{popover-Cb-Bmegp.js → popover-CH09SbYZ.js} +1 -1
- package/dist/client/assets/{post-editor-BAaD8Gds.js → post-editor-08-P4Wpe.js} +1 -1
- package/dist/client/assets/{primitives-D8jiHpwv.js → primitives-R43NPEda.js} +1 -1
- package/dist/client/assets/{profile-B_6YhXTS.js → profile-Dn87XUJN.js} +1 -1
- package/dist/client/assets/project-app-view-4o9PlJDq.js +1 -0
- package/dist/client/assets/record-editor-BD7d8_-n.js +1 -0
- package/dist/client/assets/registry-DgXY6Nz_.js +2 -0
- package/dist/client/assets/{registry-layout-CCF3dO1N.js → registry-layout-BLuSgnGn.js} +1 -1
- package/dist/client/assets/{require-capability-9UoybC--.js → require-capability-CObBU8yr.js} +1 -1
- package/dist/client/assets/{required-auth-layout-chyvqjm-.js → required-auth-layout-DhSSTgwg.js} +1 -1
- package/dist/client/assets/{reset-password-bYeIRZhU.js → reset-password-Cw-Mv-5i.js} +1 -1
- package/dist/client/assets/{resizable-C3e36PAj.js → resizable-B7uSgqAA.js} +1 -1
- package/dist/client/assets/{roles-DUk2EDKN.js → roles-CcnWfj9G.js} +1 -1
- package/dist/client/assets/{save-status-SrY_Xvn_.js → save-status-Dp40V924.js} +1 -1
- package/dist/client/assets/{schema-form-q1GGwsV5.js → schema-form-BNdSdk8W.js} +1 -1
- package/dist/client/assets/{scroll-area-DqzfAJq4.js → scroll-area-DYAwC7xi.js} +1 -1
- package/dist/client/assets/{search-input-dUUxotu4.js → search-input-BtfHd_PV.js} +1 -1
- package/dist/client/assets/{secrets--HC37_lL.js → secrets-BDg0g7CD.js} +1 -1
- package/dist/client/assets/{sections-editor-9HzWjIQN.js → sections-editor-CuwHqnaB.js} +1 -1
- package/dist/client/assets/{select-CuTEW-jA.js → select-hcACDMsW.js} +1 -1
- package/dist/client/assets/{select-model-DeVtvLgk.js → select-model-C26R1tgl.js} +1 -1
- package/dist/client/assets/{seo-editor-CxXb6Pa5.js → seo-editor-zTGMVBFq.js} +1 -1
- package/dist/client/assets/{settings-layout-DsImRu68.js → settings-layout-CTPG2oCB.js} +1 -1
- package/dist/client/assets/{settings-section-Dqo82vZl.js → settings-section-DaO8RKe8.js} +1 -1
- package/dist/client/assets/{sheet-XNQn2l1w.js → sheet-SJlzhsz6.js} +1 -1
- package/dist/client/assets/{shell-controls-DOdJ_gGX.js → shell-controls-HljoHbdq.js} +1 -1
- package/dist/client/assets/{shell-layout-BU6DfdCA.js → shell-layout-Bx0_HWew.js} +1 -1
- package/dist/client/assets/{shell-route-loading-D_OJep1W.js → shell-route-loading-DgxSF9Gz.js} +1 -1
- package/dist/client/assets/{sidebar-BVvI-fKb.js → sidebar-BlFrlbv4.js} +1 -1
- package/dist/client/assets/{skeleton-BsmA3SJi.js → skeleton-80rKQxzP.js} +1 -1
- package/dist/client/assets/{sortable.esm-BLbNDEWA.js → sortable.esm-BaSbMOPy.js} +1 -1
- package/dist/client/assets/{spinner-CA6Z7ply.js → spinner-cv9nof4V.js} +1 -1
- package/dist/client/assets/{sso-CaRqQ4Z-.js → sso-CNDry1vR.js} +1 -1
- package/dist/client/assets/{store-D79L8ARY.js → store-lbTr2IAY.js} +1 -1
- package/dist/client/assets/store-registry-Cl954hdf.js +2 -0
- package/dist/client/assets/{switch-kiGGiVP7.js → switch-C1S18UCI.js} +1 -1
- package/dist/client/assets/{tab-id-AROsVU94.js → tab-id-CjVVlM3-.js} +1 -1
- package/dist/client/assets/{table-D-3eWTFI.js → table-dExp9p1h.js} +1 -1
- package/dist/client/assets/{tabs-_BMD3gqc.js → tabs-Bq9Z53Au.js} +1 -1
- package/dist/client/assets/{task-status-DDOPfPO7.js → task-status-BFm8_crC.js} +1 -1
- package/dist/client/assets/{textarea-CvogFpDT.js → textarea-DZUFH_8Z.js} +1 -1
- package/dist/client/assets/{toggle-group-BAx4pQQl.js → toggle-group-DLVyaUSb.js} +1 -1
- package/dist/client/assets/{toolbar-CcJJYCIE.js → toolbar-DXw8ox-I.js} +1 -1
- package/dist/client/assets/{tools-list-C2KBBz4b.js → tools-list-BYjG31fh.js} +1 -1
- package/dist/client/assets/{tooltip-6V7elEEX.js → tooltip-Dx-dkmdA.js} +1 -1
- package/dist/client/assets/{types-fKs_ggmz.js → types-9t7kxiEp.js} +1 -1
- package/dist/client/assets/{use-ai-providers-BSAUX_gL.js → use-ai-providers-DNKllTrr.js} +1 -1
- package/dist/client/assets/{use-automations-ByU0cONY.js → use-automations-BzEG8Xwk.js} +1 -1
- package/dist/client/assets/{use-capability-DLwHss1A.js → use-capability-DltTWnuY.js} +1 -1
- package/dist/client/assets/{use-collections-BauLzZZO.js → use-collections-Br1yV-tu.js} +1 -1
- package/dist/client/assets/{use-connection-C4GFr9nL.js → use-connection-Ccv-Xgx3.js} +1 -1
- package/dist/client/assets/{use-copy-B4x7tAnY.js → use-copy-DGQz-cTK.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-CP1TTRIQ.js → use-create-virtual-mcp-BOjPY_wj.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-tQOo4KW5.js → use-debounced-autosave-BFZuou80.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CvS5aoFM.js → use-delete-connection-CFNX2gL_.js} +1 -1
- package/dist/client/assets/{use-file-configs-DXuMASqs.js → use-file-configs-DRfNjR38.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CUCni0HP.js → use-infinite-scroll-CrpZ3N3L.js} +1 -1
- package/dist/client/assets/{use-list-state-Cy-nbUe7.js → use-list-state-CBkbv-v0.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-r6vl6hj5.js → use-mcp-prompts-BT401n3U.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-BH6fBXOQ.js → use-mcp-tools-tUtdLLx8.js} +1 -1
- package/dist/client/assets/{use-members-CN7LSdK8.js → use-members-xRWwaUef.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-B17xxfnF.js → use-navigate-to-agent-Db_2WXW0.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-Ct06vKxv.js → use-org-auth-client-CMqB1f1E.js} +1 -1
- package/dist/client/assets/{use-org-sso-VGIrGw_f.js → use-org-sso-Djv2CS89.js} +1 -1
- package/dist/client/assets/{use-organization-roles-CTeY8LZY.js → use-organization-roles-DXMaPXzD.js} +1 -1
- package/dist/client/assets/{use-organization-settings--FTRiCSw.js → use-organization-settings-ra7pFykJ.js} +1 -1
- package/dist/client/assets/{use-registry-connections-D9b3sQhT.js → use-registry-connections-CDLIXx4R.js} +1 -1
- package/dist/client/assets/{use-secrets-YYVI-1hB.js → use-secrets-CY-T9J2S.js} +1 -1
- package/dist/client/assets/{use-status-sounds-BDpAOn6X.js → use-status-sounds-BwDHROCY.js} +1 -1
- package/dist/client/assets/{use-view-mode-4iMRc-bf.js → use-view-mode-D6qHHEdi.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-BzRoDsnX.js → use-virtual-mcp-CmpTXBlT.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-Dx_1Wo2M.js +1 -0
- package/dist/client/assets/{useRouterState-DwQFoqEO.js → useRouterState-icfF47GL.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CUKR0Y-5.js +1 -0
- package/dist/client/assets/{user-CEZjs4lV.js → user-DZGegFV7.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-BwZQDE89.js → view-mode-toggle-DUj5Q_6q.js} +1 -1
- package/dist/client/assets/workflow-detail-DTAgTfGE.js +1 -0
- package/dist/client/assets/{workflow-2WDykuxZ.js → workflow-onVtDDMA.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +142 -133
- package/dist/server/server.js +3 -3
- package/package.json +1 -1
- package/dist/client/assets/app-editor-Qvrv5Jlv.js +0 -1
- package/dist/client/assets/page-seo-sheet-rUbxuV0U.js +0 -1
- package/dist/client/assets/project-app-view-DLZKJqsT.js +0 -1
- package/dist/client/assets/record-editor-DV-uP4sg.js +0 -1
- package/dist/client/assets/registry-BdCcAkG7.js +0 -2
- package/dist/client/assets/store-registry-RjLPX_BT.js +0 -2
- package/dist/client/assets/useInfiniteQuery-DKdeEHtH.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BgTbRsAD.js +0 -1
- package/dist/client/assets/workflow-detail-B48uxbIE.js +0 -1
package/dist/client/assets/{agent-capabilities-CmInpctC.js → agent-capabilities-Vf98w6Vs.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{G as Be,r as S,au as $s,as as zs,e as L,q as ie,c as U,j as s,E as Bs,o as ae,T as he,aH as Us,W as Ie,aI as Dt,L as Ks,B as re,H as qs,I as Qs,aJ as Ys,aK as Hs,a0 as Re,D as Gs,aL as De,aM as Wt,n as Rn,K as Ee,t as G,f as rt,a as Mt,aN as Ws,v as Tn,R as Js,aO as Zs,b as Pn,aP as Xs,aQ as Dn,aR as er,aS as ce,aT as bt,aU as tr,aV as nr,aW as vt,aX as sr,aY as rr,aZ as or,a_ as ar,s as lr,a$ as ir,b0 as cr,b1 as dr,b2 as ur,b3 as Mn,b4 as Oe,l as Vr,F as Fn}from"./index-CW2GDOZp.js";import{e as On,s as ot,g as ue,P as Je,f as Ft,t as fr,h as mr,M as pr,i as hr,j as Le,k as xr,l as gr,F as br,c as vr,S as yr,m as Ar,n as wr,o as Jt}from"./pair-CZ7RQwEQ.js";import{c as fe,a as Ue,d as at,u as jr,b as Sr,g as Cr,f as Ln,A as Nr,h as kr}from"./chat-context-LqGwxYAF.js";import{S as Ct}from"./spinner-CA6Z7ply.js";import{c as Nt,u as _r,T as xe,a as ge,b as be}from"./tooltip-6V7elEEX.js";import{b as lt,c as it,a as ct,D as dt,e as Ot}from"./dialog-CLtwKT7T.js";import{c as Ir,D as Er,a as Rr,b as Tr}from"./drawer-BewkeO2E.js";import{C as Pr}from"./collection-search-DGClB-Gb.js";import{g as ut,u as de,S as Vt,i as Zt}from"./constants-BCfpLdj8.js";import{u as Dr,g as ft,l as kt}from"./use-mcp-prompts-r6vl6hj5.js";import{t as mt}from"./ChevronDown--sdzrX52.js";import{i as Me}from"./X-Tdfyixv6.js";import{t as Mr,z as Fr,u as Or,w as Lr,A as $r}from"./tab-id-AROsVU94.js";import{K as zr,i as Br}from"./shell-layout-BU6DfdCA.js";import{a as Ur,u as Kr}from"./use-virtual-mcp-BzRoDsnX.js";import{i as qr}from"./SwitchHorizontal01-UKGE6L3t.js";import{n as $n}from"./ZapSquare-DzpMrwRR.js";import{i as Ke}from"./Check-vtGHgjfG.js";import{s as zn}from"./Star01-B2sYJOUY.js";import{a as Bn}from"./Tool01-NFK8H_gw.js";import{a0 as pt,m as Qr,L as Un,A as Kn,i as He,b as Yr,O as Hr,a1 as Gr,r as Wr,a2 as Jr,a3 as Zr,X as qn}from"./agent-icon-zELPPL2m.js";import{i as Xr}from"./Upload01-VAW7QmhA.js";import{i as Qn}from"./AlertCircle-DtsIkyhv.js";import{a as eo}from"./Eye-CrIialez.js";import{a as _t,b as Lt,d as $t,f as zt,F as Yn}from"./form-hhL2WFgR.js";import{b as to,d as no,c as so,S as ro,a as oo}from"./select-CuTEW-jA.js";import{i as ao}from"./RefreshCcw01-CJHsMXtu.js";import{a as Hn,t as It,b as lo}from"./XCircle-B14veD9i.js";import{b as io,c as co}from"./tabs-_BMD3gqc.js";import{T as Gn,a as Ze}from"./toggle-group-BAx4pQQl.js";import{I as Wn}from"./input-C6I0qBHa.js";import{u as uo}from"./use-ai-providers-BSAUX_gL.js";import{i as Jn}from"./Monitor01-BqyNv3z7.js";import{C as Zn}from"./connect-desktop-dialog-CZAbswkh.js";import{C as Xn,a as es,m as ht,i as Vo,g as ts,b as fo,N as mo}from"./agent-icons-x_5O6PzC.js";import{P as Bt,a as Ut,b as Kt}from"./popover-Cb-Bmegp.js";import{a as Xt,e as en,f as po,c as ho,C as xo,d as go,b as bo}from"./command-DzVv4p4m.js";import{u as vo}from"./useInfiniteQuery-DKdeEHtH.js";import{g as ns,A as yo}from"./sortable.esm-BLbNDEWA.js";import{t as Ao}from"./Stars01-ChUleI_g.js";import{P as Et,a as wo,b as jo,u as So,E as Co,c as qt,i as No,d as ko}from"./scroll-area-DqzfAJq4.js";import{S as _o}from"./index-BTfRGSGJ.js";import{D as Io,a as Eo,b as Ro,c as me,e as tn,f as nn,g as sn,i as To,j as Po}from"./dropdown-menu-COlaUXPy.js";import{s as rn}from"./Plus-CAk921Ey.js";import{p as Do,q as Mo}from"./question-004-sINsf4GQ.js";import{i as Fo}from"./ChevronRight-I6954Qlw.js";function Oo(t,e){const n=Be(e);return Lo({filters:{...t,status:"pending"}},n).length}function on(t,e){return t.findAll(e.filters).map(n=>e.select?e.select(n):n.state)}function Lo(t={},e){const n=Be(e).getMutationCache(),r=S.useRef(t),o=S.useRef(null);return o.current===null&&(o.current=on(n,t)),S.useEffect(()=>{r.current=t}),S.useSyncExternalStore(S.useCallback(a=>n.subscribe(()=>{const l=$s(o.current,on(n,r.current));o.current!==l&&(o.current=l,zs.schedule(a))}),[n]),()=>o.current,()=>o.current)}const an=3,ss="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",$o="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function rs(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=ue(i._meta);u=i.title??Ft(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=U($o,"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(Ct,{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 F;return e[19]!==_||e[20]!==R||e[21]!==k||e[22]!==j||e[23]!==N?(F=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]=F):F=e[24],F}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=U(ss,"hover:bg-muted/70 hover:text-foreground",x,h),e[28]=x,e[29]=h,e[30]=p):p=e[30];let g;e[31]!==V?(g=s.jsx("span",{className:"capitalize",children:V}),e[31]=V,e[32]=g):g=e[32];let b;e[33]!==o?(b=o&&s.jsx(Ct,{size:"xs"}),e[33]=o,e[34]=b):b=e[34];let y;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==g||e[39]!==b?(y=s.jsx(xe,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:m,disabled:f,className:p,children:[g,b]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=g,e[39]=b,e[40]=y):y=e[40];const v=d??V;let w;e[41]!==v?(w=s.jsx(ge,{side:"top",className:"max-w-xs",children:s.jsx("p",{className:"text-xs",children:v})}),e[41]=v,e[42]=w):w=e[42];let A;return e[43]!==y||e[44]!==w?(A=s.jsxs(be,{delayDuration:400,children:[y,w]}),e[43]=y,e[44]=w,e[45]=A):A=e[45],A}function zo(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=_r();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(rs,{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 g;e[20]===Symbol.for("react.memo_cache_sentinel")?(g=j=>{j.key==="Escape"&&i("")},e[20]=g):g=e[20];let b;e[21]!==c?(b=s.jsx(Pr,{value:c,onChange:i,placeholder:"Search prompts...",onKeyDown:g}),e[21]=c,e[22]=b):b=e[22];const y=b;if(m){let j;e[23]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Ir,{className:"sr-only",children:s.jsx(Er,{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]!==y?(P=s.jsxs(Rr,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[j,C,y,p]}),e[25]=p,e[26]=y,e[27]=P):P=e[27];let N;return e[28]!==o||e[29]!==r||e[30]!==P?(N=s.jsx(Nt,{delayDuration:400,children:s.jsx(Tr,{open:r,onOpenChange:o,children:P})}),e[28]=o,e[29]=r,e[30]=P,e[31]=N):N=e[31],N}let v;e[32]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(lt,{className:"sr-only",children:s.jsx(it,{children:"All prompts"})}),e[32]=v):v=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]!==y?(A=s.jsxs(ct,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[v,w,y,p]}),e[34]=p,e[35]=y,e[36]=A):A=e[36];let k;return e[37]!==o||e[38]!==r||e[39]!==A?(k=s.jsx(Nt,{delayDuration:400,children:s.jsx(dt,{open:r,onOpenChange:o,children:A})}),e[37]=o,e[38]=r,e[39]=A,e[40]=k):k=e[40],k}function Bo(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 g=n.slice(0,an);let b;e[6]!==n?(b=n.slice(an),e[6]=n,e[7]=b):b=e[7],i=b,u=!!o;let y;e[8]!==u||e[9]!==o?.name||e[10]!==r?(y=v=>s.jsx(rs,{item:v,onSelect:r,isLoading:o?.name===v.prompt.name,isDisabled:u&&o?.name!==v.prompt.name},v.prompt.name),e[8]=u,e[9]=o?.name,e[10]=r,e[11]=y):y=e[11],V=g.map(y),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=U("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:U(ss,"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(zo,{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(Nt,{delayDuration:400,children:[x,h]}),e[26]=x,e[27]=h,e[28]=p):p=e[28],p}function Uo(){return null}function Ko(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 qo(t){const e=L.c(30),{connectionId:n}=t,{sendMessage:r}=Ue(),{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}=Dr(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(Qo),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(Ko,f),[p,g]=S.useState(null);let b;e[11]!==l||e[12]!==r?(b=async(E,_)=>{if(!l){ae.error("MCP client not available"),h({type:"RESET"});return}try{const R=await ft(l,E.name,_);h({type:"RESET"});const F={type:"doc",content:[{type:"paragraph",content:[On({id:E.name,name:ot(E.name,ue(E._meta)),metadata:R.messages,char:"/",kind:"prompt",args:_}),{type:"text",text:" "}]}]};await r(F)}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]=b):b=e[13];const y=b;let v;e[14]!==y?(v=async E=>{if(E.arguments&&E.arguments.length>0){h({type:"SELECT_PROMPT",prompt:E}),g(E);return}h({type:"START_LOADING",prompt:E}),await y(E)},e[14]=y,e[15]=v):v=e[15];const w=v;let A;e[16]!==p||e[17]!==y?(A=async E=>{p&&(h({type:"START_LOADING",prompt:p,arguments:E}),g(null),await y(p,E))},e[16]=p,e[17]=y,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(Bo,{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=()=>{g(null),h({type:"RESET"})},e[23]=P):P=e[23];let N;e[24]!==p||e[25]!==k?(N=s.jsx(Je,{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 Qo(t){return{prompt:t}}function Yo(t){const e=L.c(13),{className:n}=t,{selectedVirtualMcp:r}=fe(),{org:o}=ie();let a;e[0]!==o.id?(a=ut(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=U("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(Uo,{}),e[4]=V):V=e[4];let d;e[5]!==c?(d=s.jsx(qo,{connectionId:c}),e[5]=c,e[6]=d):d=e[6];let m;e[7]!==u||e[8]!==d?(m=s.jsx(Bs,{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 yt="cubic-bezier(0.645, 0.045, 0.355, 1)",Ho=44,Go={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"},Wo={default:"border-border",error:"border-destructive/30",warning:"border-amber-500/30"},Jo={default:"text-muted-foreground",error:"text-destructive",warning:"text-amber-600 dark:text-amber-500"};function Ve(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 g;e[0]!==d?(g=()=>{p(!0),d?.()},e[0]=d,e[1]=g):g=e[1];const b=g;if(h)return null;const y=Wo[m],v=Go[m];let w;e[2]!==y||e[3]!==v?(w=U("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",y,v),e[2]=y,e[3]=v,e[4]=w):w=e[4];let A;e[5]===Symbol.for("react.memo_cache_sentinel")?(A=()=>x(Zo),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=U("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=Jo[m];let N;e[9]!==P?(N=U("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 F;e[18]!==R?(F=s.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:s.jsx(mt,{size:16,style:{transform:R,transition:`transform 180ms ${yt}`}})}),e[18]=R,e[19]=F):F=e[19];let D,I;e[20]!==b?(D=J=>{J.stopPropagation(),b()},I=J=>{(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),J.stopPropagation(),b())},e[20]=b,e[21]=D,e[22]=I):(D=e[21],I=e[22]);let O;e[23]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(Me,{size:16}),e[23]=O):O=e[23];let z;e[24]!==D||e[25]!==I?(z=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:O}),e[24]=D,e[25]=I,e[26]=z):z=e[26];let $;e[27]!==f||e[28]!==T||e[29]!==E||e[30]!==_||e[31]!==F||e[32]!==z||e[33]!==C?($=s.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":f,onClick:A,className:C,children:[T,E,_,F,z]}),e[27]=f,e[28]=T,e[29]=E,e[30]=_,e[31]=F,e[32]=z,e[33]=C,e[34]=$):$=e[34];const K=f?"1fr":"0fr";let M;e[35]!==K?(M={display:"grid",gridTemplateRows:K,transition:`grid-template-rows 180ms ${yt}`},e[35]=K,e[36]=M):M=e[36];let B;e[37]===Symbol.for("react.memo_cache_sentinel")?(B={overflow:"hidden",minHeight:0},e[37]=B):B=e[37];const Q=f?1:0;let q;e[38]!==Q?(q={opacity:Q,transition:`opacity 120ms ${yt}`},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 se;e[42]!==i||e[43]!==a?(se=i?s.jsx("div",{className:U("overflow-clip pb-4",!a&&"pt-4"),children:i}):null,e[42]=i,e[43]=a,e[44]=se):se=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]!==se||e[51]!==Z?(X=s.jsx("div",{style:B,children:s.jsxs("div",{style:q,children:[Y,se,Z]})}),e[48]=q,e[49]=Y,e[50]=se,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 W;return e[56]!==$||e[57]!==te||e[58]!==w||e[59]!==m?(W=s.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":m,className:w,children:[$,te]}),e[56]=$,e[57]=te,e[58]=w,e[59]=m,e[60]=W):W=e[60],W}function Zo(t){return!t}const Xo=he({content:Ie().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Dt(["pending","in_progress","completed"]),activeForm:Ie().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),os=he({todos:Us(Xo)}),ea="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.";Mr({description:ea,inputSchema:Fr(os),execute:async({todos:t})=>({ok:!0,count:t.length})});const ta="tool-todo_write",na=new Set(["input-available","output-available"]);function as(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!==ta||typeof a.state!="string"||!na.has(a.state))continue;const l=os.safeParse(a.input);if(l.success)return l.data.todos}}return[]}function ls(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:fr(mr(r)),input:n.input})}return e}function is(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 sa(t){return t?t.message.startsWith("[CREDITS]"):!1}const ra={isCreditExhausted:!1,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1};function oa(t){const{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=t;if(!o&&n&&sa(n))return{...ra,isCreditExhausted:!0};const l=e.at(-1),c=l?.role==="assistant"?l.parts:[],i=c,V=!!i.filter(y=>y.type==="tool-user_ask").filter(y=>y.state!=="output-available").length,d=is(c),m=ls(i),f=as(e),x=!o&&!!n,h=m.length>0||o&&a,p=d.length>0,b=!o&&!!r&&r!=="stop"&&!(r==="tool-calls"&&(V||h||p))&&!x;return{isCreditExhausted:!1,hasTodos:f.length>0,showError:x,showWarning:b,hasApprovals:h,hasPlans:p,isWaitingForUserInput:V}}function cs(){const t=L.c(6),{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=Ue(),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=oa({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 aa(){const t=cs();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function ds(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 la="__home__";function Qt(t,e){return Ks.chatDraft(t,e)}function ia(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 ca(t,e,n,r,o){const a=Qt(e,n);if(ds(r)){t.removeItem(a);return}const l={tiptapDoc:r,updatedAt:Date.now()},c=JSON.stringify(l);try{t.setItem(a,c)}catch(i){if(ua(i)){const u=new TextEncoder().encode(c).byteLength;o?.onQuotaExceeded?.({docSizeBytes:u});return}throw i}}function ln(t,e,n){const r=Qt(e,n),o=t.getItem(r),a=ia(o);return o!==null&&a===null&&t.removeItem(r),a}function da(t,e,n){t.removeItem(Qt(e,n))}function ua(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function Va(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=U("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(ao,{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=U("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(Hn,{size:14}),e[12]=p):p=e[12];let g;e[13]!==a||e[14]!==h||e[15]!==f?(g=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]=g):g=e[16];let b;return e[17]!==g||e[18]!==V||e[19]!==m?(b=s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[V,m,g]}),e[17]=g,e[18]=V,e[19]=m,e[20]=b):b=e[20],b}function us(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(Va,{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 fa(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=U("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(re,{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 g=p;if(!m)return g;let b;e[10]!==g?(b=s.jsx(xe,{asChild:!0,children:g}),e[10]=g,e[11]=b):b=e[11];let y;e[12]!==m?(y=s.jsx(ge,{children:m}),e[12]=m,e[13]=y):y=e[13];let v;return e[14]!==b||e[15]!==y?(v=s.jsxs(be,{children:[b,y]}),e[14]=b,e[15]=y,e[16]=v):v=e[16],v}function Vs(t,e,n){return t.findIndex(r=>e(r)===n)}function cn(t,e,n,r){return t.length===0?!1:t.every(o=>r(n[e(o)]))}function dn(t,e,n,r,o){if(t.length===0)return null;const a=Vs(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 ma(t){return!t.isStreaming&&t.allAnswered}function fs(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=qs({resolver:Qs(r),defaultValues:o}),x=f.watch(),h=Vs(e,n,u),p=h>=0?e[h]:void 0,g=l(x[u]),b=cn(e,n,x,l),y=ma({isStreaming:a,allAnswered:b}),v=()=>{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=dn(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=()=>{y&&(m(!1),j.current())},P=()=>{const N=f.getValues();if(cn(e,n,N,l)){if(a){m(!0);return}m(!1),j.current()}else{const T=dn(e,n,N,l,u);T&&V(T)}};return S.useEffect(()=>{if(d&&!a){if(!b){m(!1);return}m(!1),j.current()}},[d,a,b]),{form:f,activeKey:u,setActiveKey:V,currentIndex:h,currentPart:p,isCurrentAnswered:g,isAllAnswered:b,canSubmit:y,goPrev:v,goNext:w,advanceToNextUnanswered:A,submit:C,submitOrAdvance:P}}const ms="User denied this tool call, give other alternatives.";function ps(t){const e=L.c(9),{onYolo:n}=t,[r,o]=Re();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(ro,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:ha,children:s.jsx(oo,{})}),e[4]=c):c=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(to,{children:De.map(pa)}),e[5]=i):i=e[5];let u;return e[6]!==l||e[7]!==r.toolApprovalLevel?(u=s.jsxs(no,{value:r.toolApprovalLevel,onValueChange:l,children:[c,i]}),e[6]=l,e[7]=r.toolApprovalLevel,e[8]=u):u=e[8],u}function pa(t){return s.jsx(so,{value:t.value,children:t.label},t.value)}function ha(t){return t.stopPropagation()}function hs(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 xa(t){const e=L.c(28),{approval:n,onRespond:r}=t,[o]=Re(),a=o.toolApprovalLevel??"readonly";let l;e[0]!==n.approvalId||e[1]!==a||e[2]!==r?(l=()=>r(n.approvalId,!1,ms,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(ps,{onYolo:d})}),e[11]=d,e[12]=m):m=e[12];const f=m;let x;e[13]!==c?(x=s.jsx(re,{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(re,{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 g=p;let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(pt,{size:14}),e[20]=b):b=e[20];let y;e[21]!==n.input?(y=s.jsx(hs,{input:n.input}),e[21]=n.input,e[22]=y):y=e[22];let v;return e[23]!==n.friendlyName||e[24]!==f||e[25]!==g||e[26]!==y?(v=s.jsx(Ve,{icon:b,label:"Approval needed",title:n.friendlyName,defaultExpanded:!0,footerLeft:f,footerRight:g,children:y}),e[23]=n.friendlyName,e[24]=f,e[25]=g,e[26]=y,e[27]=v):v=e[27],v}const ga=Ys(Ie(),he({approved:Hs().optional(),levelOverride:Dt(["auto","readonly"]).optional()}));function ba(t){const e=L.c(42),{approvals:n,isStreaming:r,onRespond:o}=t,[a]=Re(),l=a.toolApprovalLevel??"readonly";let c;e[0]!==n?(c=Object.fromEntries(n.map(Aa)),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?ms: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:ya,schema:ga,defaultValues:i,isStreaming:r,hasAnswer:va,onSubmit:u},e[5]=n,e[6]=i,e[7]=r,e[8]=u,e[9]=V):V=e[9];const d=fs(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(pt,{size:14}),e[15]=p):p=e[15];const g=`${n.length} approvals pending`,b=x?.friendlyName??"";let y;e[16]!==f?(y=s.jsx(ps,{onYolo:f}),e[16]=f,e[17]=y):y=e[17];let v;e[18]!==n.length||e[19]!==d.currentIndex||e[20]!==d.goNext||e[21]!==d.goPrev||e[22]!==y?(v=s.jsx(us,{currentIndex:d.currentIndex,total:n.length,onPrev:d.goPrev,onNext:d.goNext,extraLeft:y}),e[18]=n.length,e[19]=d.currentIndex,e[20]=d.goNext,e[21]=d.goPrev,e[22]=y,e[23]=v):v=e[23];let w;e[24]!==x||e[25]!==d.form.control||e[26]!==d.submitOrAdvance?(w=x?s.jsx(wa,{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(hs,{input:x.input}):null,e[28]=x,e[29]=A):A=e[29];let k;e[30]!==v||e[31]!==w||e[32]!==A||e[33]!==g||e[34]!==b?(k=s.jsx(Ve,{icon:p,label:g,title:b,defaultExpanded:!0,footerLeft:v,footerRight:w,children:A}),e[30]=v,e[31]=w,e[32]=A,e[33]=g,e[34]=b,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(_t,{...d.form,children:j}),e[39]=d.form,e[40]=j,e[41]=C):C=e[41],C}function va(t){return typeof t?.approved=="boolean"}function ya(t){return t.approvalId}function Aa(t){return[t.approvalId,{approved:void 0}]}function wa(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(re,{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(re,{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(Gs,{control:r,name:a,render:l}),e[2]=r,e[3]=a,e[4]=l,e[5]=c):c=e[5],c}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 rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(pt,{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 Sa(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(ja,{}),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(xa,{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(ba,{approvals:n,isStreaming:r,onRespond:o}),e[4]=n,e[5]=r,e[6]=o,e[7]=a):a=e[7],a}function Ca(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(re,{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(re,{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(Qr,{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(pr,{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(Ve,{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 Na(){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(Ke,{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 ka(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(Na,{}),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(Ca,{plan:c,onApprove:o,onDismiss:a}),e[3]=c,e[4]=o,e[5]=a,e[6]=i):i=e[6],i}function xs(t){return t?"response"in t?t.response:t.option??t.draft:""}const un=he({response:Ie().min(1,"Response is required")}),_a=he({option:Ie().nullable(),draft:Ie()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),Ia=he({response:Dt(["yes","no"])});function Ea(t){switch(t.type){case"text":return un;case"choice":return _a;case"confirm":return Ia;default:return un}}function Ra(t){const e={};for(const n of t)e[n.toolCallId]=Ea(n.input);return he(e)}function Ta(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(Lt,{children:[s.jsx($t,{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(Un,{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(zt,{})]})},e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==n||e[3]!==r||e[4]!==a?(l=s.jsx(Yn,{control:n,name:r,render:a}),e[2]=n,e[3]=r,e[4]=a,e[5]=l):l=e[5],l}function gs(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 Pa(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}=Wt(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}=Wt(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],gs(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:U("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:U("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",g=!x&&"hover:bg-accent/30";let b;e[16]!==p||e[17]!==g?(b=U("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",p,g),e[16]=p,e[17]=g,e[18]=b):b=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Un,{size:16,className:"text-muted-foreground"})}),e[19]=y):y=e[19];const v=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]!==v||e[28]!==w||e[29]!==A?(k=s.jsx("input",{type:"text",value:v,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]=v,e[28]=w,e[29]=A,e[30]=k):k=e[30];let j;e[31]!==k||e[32]!==b?(j=s.jsxs("label",{className:b,children:[y,k]}),e[31]=k,e[32]=b,e[33]=j):j=e[33];let C;e[34]!==j||e[35]!==h?(C=s.jsx($t,{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(zt,{}),e[37]=P):P=e[37];let N;return e[38]!==C?(N=s.jsxs(Lt,{children:[C,P]}),e[38]=C,e[39]=N):N=e[39],N}function Da(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],gs(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(Lt,{children:[s.jsx($t,{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:U("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:U("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(zt,{})]})},e[2]=i):i=e[2];let u;return e[3]!==n||e[4]!==r?(u=s.jsx(Yn,{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(Ta,{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(Pa,{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(Da,{control:r,name:a}),e[10]=r,e[11]=a,e[12]=l):l=e[12],l}default:return null}}function Ma(t){const e=L.c(71),{parts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=Ra(n.map($a)),e[0]=n,e[1]=a):a=e[1];const l=a;let c;e[2]!==n?(c=Object.fromEntries(n.map(La)),e[2]=n,e[3]=c):c=e[3];const i=c;let u;e[4]!==o?(u=(D,I)=>{const O=xs(I);O&&o(D,O)},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:Oa,schema:l,defaultValues:i,isStreaming:r,hasAnswer:Fa,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=fs(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(us,{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 g;e[20]!==x?(g=s.jsx(re,{type:"button",variant:"outline",size:"sm",onClick:x,className:"h-7",children:"Skip"}),e[20]=x,e[21]=g):g=e[21];let b;e[22]!==d.isAllAnswered||e[23]!==d.isCurrentAnswered||e[24]!==d.submitOrAdvance||e[25]!==r?(b=s.jsx(fa,{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]=b):b=e[26];let y;e[27]!==g||e[28]!==b?(y=s.jsxs(s.Fragment,{children:[g,b]}),e[27]=g,e[28]=b,e[29]=y):y=e[29];const v=y;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 O;e[32]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(It,{size:14}),e[32]=O):O=e[32];const z=D.input?.prompt??"Question",$=D.input;let K;e[33]!==d.form.control||e[34]!==D.toolCallId||e[35]!==$?(K=s.jsx(Vn,{input:$,control:d.form.control,toolCallId:D.toolCallId}),e[33]=d.form.control,e[34]=D.toolCallId,e[35]=$,e[36]=K):K=e[36];let M;e[37]!==v||e[38]!==z||e[39]!==K?(M=s.jsx(Ve,{icon:O,label:"Question pending",title:z,defaultExpanded:!0,footerRight:v,children:K}),e[37]=v,e[38]=z,e[39]=K,e[40]=M):M=e[40];let B;e[41]!==I||e[42]!==M?(B=s.jsx("form",{onSubmit:I,autoComplete:"off",children:M}),e[41]=I,e[42]=M,e[43]=B):B=e[43];let Q;return e[44]!==d.form||e[45]!==B?(Q=s.jsx(_t,{...d.form,children:B}),e[44]=d.form,e[45]=B,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(It,{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(io,{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(co,{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]!==v||e[61]!==j||e[62]!==C||e[63]!==E?(_=s.jsx(Ve,{icon:k,label:"Question pending",count:j,title:C,defaultExpanded:!0,footerLeft:p,footerRight:v,children:E}),e[59]=p,e[60]=v,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 F;return e[68]!==d.form||e[69]!==R?(F=s.jsx(_t,{...w,children:R}),e[68]=d.form,e[69]=R,e[70]=F):F=e[70],F}function Fa(t){return!!xs(t)}function Oa(t){return t.toolCallId}function La(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function $a(t){return{toolCallId:t.toolCallId,input:t.input}}function za(){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(It,{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 bs(t){const e=L.c(7),{userAskParts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=n.filter(Ba),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(za,{}),e[2]=i):i=e[2],i}return null}let c;return e[3]!==r||e[4]!==o||e[5]!==l?(c=s.jsx(Ma,{parts:l,isStreaming:r,onSubmit:o}),e[3]=r,e[4]=o,e[5]=l,e[6]=c):c=e[6],c}function Ba(t){return t.state==="input-available"}function Ua(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 Ka(){const t=L.c(21),{messages:e}=Ue();let n,r,o,a,l,c,i,u,V;if(t[0]!==e){V=Symbol.for("react.early_return_sentinel");e:{const f=as(e);if(f.length===0){V=null;break e}const x=Ua(f);n=Ve,l=s.jsx(Ha,{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(qa)}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 qa(t,e){return s.jsx(Qa,{todo:t},e)}function Qa(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(Ya,{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=U("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 Ya(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 Ha(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 fn=new Map;function vs(){const{org:t}=ie(),e=de({connectionId:Vt,orgId:t.id,orgSlug:t.slug}),n=uo(),r=n.find(p=>p.providerId==="deco"),{data:o,isLoading:a,refetch:l,isFetching:c}=Rn({queryKey:Ee.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=fn.get(t.id);V.current.get(t.id)&&p!=null&&i>p&&G("credits_topped_up_detected",{organization_id:t.id,delta_cents:i-p,previous_balance_cents:p,new_balance_cents:i}),fn.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 Ga={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"}]},Wa=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function ys(t){const e=L.c(44),{onDismiss:n}=t,{org:r}=ie(),o=rt(),{decoKeyId:a}=vs();let l;e[0]!==r.id||e[1]!==r.slug?(l={connectionId:Vt,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=()=>{G("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 g;e[6]!==c||e[7]!==m?(g=async I=>{const O=await c.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:I,currency:m}});if(O?.isError)throw new Error(O.content?.[0]?.text??"Failed to get top-up URL");return O.structuredContent?.url},e[6]=c,e[7]=m,e[8]=g):g=e[8];let b;e[9]!==n?(b=I=>{I&&window.open(I,"_blank","noopener,noreferrer"),n?.()},e[9]=n,e[10]=b):b=e[10];let y;e[11]!==g||e[12]!==b?(y={mutationFn:g,onSuccess:b,onError:Xa},e[11]=g,e[12]=b,e[13]=y):y=e[13];const{mutate:v,isPending:w}=Mt(y),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(lt,{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(it,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),s.jsx(Ot,{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]!==v?(T=a&&s.jsxs("div",{className:"px-8 pt-5 pb-6",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Gn,{type:"single",variant:"outline",size:"sm",value:m,onValueChange:I=>{I&&f(I)},children:[s.jsx(Ze,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(Ze,{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:Ga[m].map(I=>{const{dollars:O,label:z}=I;return s.jsxs("button",{type:"button",disabled:w,onClick:()=>{G("credits_topup_clicked",{amount_cents:O*100,currency:m,tier_label:z,source:"exhausted_banner"}),v(O*100)},className:U("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,O]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:z})]},O)})}),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(Wn,{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(re,{className:"h-10",disabled:!k||w,onClick:()=>{G("credits_topup_clicked",{amount_cents:Math.round(A*100),currency:m,tier_label:"custom",source:"exhausted_banner"}),v(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:Wa.map(Ja)})]}),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]=v,e[28]=T):T=e[28];let E;e[29]!==n?(E=s.jsx(re,{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 F;e[38]!==T||e[39]!==R?(F=s.jsxs(ct,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Za,children:[N,T,R]}),e[38]=T,e[39]=R,e[40]=F):F=e[40];let D;return e[41]!==F||e[42]!==j?(D=s.jsx(dt,{open:!0,onOpenChange:j,children:F}),e[41]=F,e[42]=j,e[43]=D):D=e[43],D}function Ja(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(Ke,{size:12,className:"text-[hsl(var(--chart-1))]"})}),s.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function Za(t){return t.preventDefault()}function Xa(t){ae.error(`Top-up failed: ${t.message}`)}function el(){const t=L.c(5),e=at(),n=jr(),[r,o]=S.useState(!1);if(!(e?.lockedSandbox==="user-desktop")||!n.ready||n.online)return null;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Jn,{size:14}),t[0]=l):l=t[0];let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(re,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>o(!0),children:"Reconnect desktop"}),t[1]=c):c=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Ve,{icon:l,label:"Your desktop is offline",title:"This chat runs on your desktop, which isn't connected right now.",defaultExpanded:!0,variant:"warning",footerRight:c,children:s.jsxs("p",{className:"mx-4 text-xs text-muted-foreground",children:["Run ",s.jsx("code",{className:"font-mono",children:"bunx decocms link"})," in a terminal on that machine to bring it back. Messages you send while it's offline will fail."]})}),t[2]=i):i=t[2];let u;return t[3]!==r?(u=s.jsxs(s.Fragment,{children:[i,s.jsx(Zn,{open:r,onOpenChange:o})]}),t[3]=r,t[4]=u):u=t[4],u}function tl(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/link_unavailable|user_desktop_link_/i.test(e)?/user_desktop_link_capability_missing/i.test(e)?{summary:"Your desktop is connected, but the CLI this chat uses wasn't detected there. Install it and sign in on your desktop, then try again.",rawDetails:t}:{summary:"Your desktop is offline. Run `bunx decocms link` in a terminal on it, then try again.",rawDetails:t}: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 nl={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 Xe(t){const e=L.c(19),{variant:n,onDismiss:r}=t,o=n==="error",a=o?"Error occurred":"Response incomplete",l=o?Qn:Tn,c=o?t.error.message:nl[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`;let i;e[0]!==o||e[1]!==c?(i=o?tl(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(re,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}):s.jsx(re,{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(rl).catch(sl)},"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(eo,{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(Ve,{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 sl(){return ae.error("Could not copy")}function rl(){return ae.success("Copied to clipboard")}function xt(){const t=L.c(62),{error:e,clearError:n,finishReason:r,clearFinishReason:o,messages:a,isStreaming:l,submit:c,sendMessage:i}=Ue(),[u,V]=Re(),{virtualMcpId:d,createTaskWithMessage:m}=Sr(),{chatMode:f,simpleModeTier:x}=fe();let h;t[0]!==f||t[1]!==x||t[2]!==d?(h=ee=>({tier:x,mode:f,toolApprovalLevel:ee,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 g;t[4]!==u.toolApprovalLevel?(g=u.toolApprovalLevel??Ws(),t[4]=u.toolApprovalLevel,t[5]=g):g=t[5];const b=g,y=a.at(-1),v=y?.role==="assistant"?y.parts:[],w=v.filter(il),A=is(v),k=ls(v);let j;t[6]!==e||t[7]!==i?(j=()=>{if(e){const ne={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};i(ne)}},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]!==b||t[13]!==c?(T=(ee,ne)=>{c({kind:"toolOutput",toolCallId:ee.toolCallId,output:{response:ne}},p(b))},t[11]=p,t[12]=b,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?(_=ee=>{V({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:d,message:{parts:[{type:"text",text:`Implement this plan:
|
|
1
|
+
import{G as Be,r as S,au as $s,as as zs,e as L,q as ie,c as U,j as s,E as Bs,o as ae,T as he,aH as Us,W as Ie,aI as Dt,L as Ks,B as re,H as qs,I as Qs,aJ as Ys,aK as Hs,a0 as Re,D as Gs,aL as De,aM as Wt,n as Rn,K as Ee,t as G,f as rt,a as Mt,aN as Ws,v as Tn,R as Js,aO as Zs,b as Pn,aP as Xs,aQ as Dn,aR as er,aS as ce,aT as bt,aU as tr,aV as nr,aW as vt,aX as sr,aY as rr,aZ as or,a_ as ar,s as lr,a$ as ir,b0 as cr,b1 as dr,b2 as ur,b3 as Mn,b4 as Oe,l as Vr,F as Fn}from"./index-BPW95yv1.js";import{e as On,s as ot,g as ue,P as Je,f as Ft,t as fr,h as mr,M as pr,i as hr,j as Le,k as xr,l as gr,F as br,c as vr,S as yr,m as Ar,n as wr,o as Jt}from"./pair-BoH0kSdH.js";import{c as fe,a as Ue,d as at,u as jr,b as Sr,g as Cr,f as Ln,A as Nr,h as kr}from"./chat-context-CWAb0_7m.js";import{S as Ct}from"./spinner-cv9nof4V.js";import{c as Nt,u as _r,T as xe,a as ge,b as be}from"./tooltip-Dx-dkmdA.js";import{b as lt,c as it,a as ct,D as dt,e as Ot}from"./dialog-CvHDSOMQ.js";import{c as Ir,D as Er,a as Rr,b as Tr}from"./drawer-BCVb0_Ol.js";import{C as Pr}from"./collection-search-DetB6uj9.js";import{g as ut,u as de,S as Vt,i as Zt}from"./constants-Cyw8HlyN.js";import{u as Dr,g as ft,l as kt}from"./use-mcp-prompts-BT401n3U.js";import{t as mt}from"./ChevronDown-BEW-c3gB.js";import{i as Me}from"./X-DwTKQTxe.js";import{t as Mr,z as Fr,u as Or,w as Lr,A as $r}from"./tab-id-CjVVlM3-.js";import{K as zr,i as Br}from"./shell-layout-Bx0_HWew.js";import{a as Ur,u as Kr}from"./use-virtual-mcp-CmpTXBlT.js";import{i as qr}from"./SwitchHorizontal01-BEpb72lq.js";import{n as $n}from"./ZapSquare-b4NUHEFQ.js";import{i as Ke}from"./Check-BCfJiZjb.js";import{s as zn}from"./Star01-CfjDLIEN.js";import{a as Bn}from"./Tool01-DkOxZLha.js";import{a0 as pt,m as Qr,L as Un,A as Kn,i as He,b as Yr,O as Hr,a1 as Gr,r as Wr,a2 as Jr,a3 as Zr,X as qn}from"./agent-icon-gyWkxLBk.js";import{i as Xr}from"./Upload01-DxZby23M.js";import{i as Qn}from"./AlertCircle-kk9FGUJy.js";import{a as eo}from"./Eye-DJA4t4LG.js";import{a as _t,b as Lt,d as $t,f as zt,F as Yn}from"./form-Bm14S2fw.js";import{b as to,d as no,c as so,S as ro,a as oo}from"./select-hcACDMsW.js";import{i as ao}from"./RefreshCcw01-qZip7VuS.js";import{a as Hn,t as It,b as lo}from"./XCircle-BapiRyFg.js";import{b as io,c as co}from"./tabs-Bq9Z53Au.js";import{T as Gn,a as Ze}from"./toggle-group-DLVyaUSb.js";import{I as Wn}from"./input-Di4NLV7k.js";import{u as uo}from"./use-ai-providers-DNKllTrr.js";import{i as Jn}from"./Monitor01-BZbk9qOn.js";import{C as Zn}from"./connect-desktop-dialog-DkxlyLoV.js";import{C as Xn,a as es,m as ht,i as Vo,g as ts,b as fo,N as mo}from"./agent-icons-dnfBtPac.js";import{P as Bt,a as Ut,b as Kt}from"./popover-CH09SbYZ.js";import{a as Xt,e as en,f as po,c as ho,C as xo,d as go,b as bo}from"./command-CzRkAUH-.js";import{u as vo}from"./useInfiniteQuery-Dx_1Wo2M.js";import{g as ns,A as yo}from"./sortable.esm-BaSbMOPy.js";import{t as Ao}from"./Stars01-BBw3zOME.js";import{P as Et,a as wo,b as jo,u as So,E as Co,c as qt,i as No,d as ko}from"./scroll-area-DYAwC7xi.js";import{S as _o}from"./index-DO2HEAud.js";import{D as Io,a as Eo,b as Ro,c as me,e as tn,f as nn,g as sn,i as To,j as Po}from"./dropdown-menu-D39dKUR6.js";import{s as rn}from"./Plus-p_eZ4_sI.js";import{p as Do,q as Mo}from"./question-004-sINsf4GQ.js";import{i as Fo}from"./ChevronRight-zMBQRLRl.js";function Oo(t,e){const n=Be(e);return Lo({filters:{...t,status:"pending"}},n).length}function on(t,e){return t.findAll(e.filters).map(n=>e.select?e.select(n):n.state)}function Lo(t={},e){const n=Be(e).getMutationCache(),r=S.useRef(t),o=S.useRef(null);return o.current===null&&(o.current=on(n,t)),S.useEffect(()=>{r.current=t}),S.useSyncExternalStore(S.useCallback(a=>n.subscribe(()=>{const l=$s(o.current,on(n,r.current));o.current!==l&&(o.current=l,zs.schedule(a))}),[n]),()=>o.current,()=>o.current)}const an=3,ss="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",$o="flex flex-col gap-1.5 p-4 rounded-xl bg-accent/40 text-sm leading-snug transition-colors cursor-pointer text-left";function rs(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=ue(i._meta);u=i.title??Ft(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=U($o,"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(Ct,{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 F;return e[19]!==_||e[20]!==R||e[21]!==k||e[22]!==j||e[23]!==N?(F=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]=F):F=e[24],F}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=U(ss,"hover:bg-muted/70 hover:text-foreground",x,h),e[28]=x,e[29]=h,e[30]=p):p=e[30];let g;e[31]!==V?(g=s.jsx("span",{className:"capitalize",children:V}),e[31]=V,e[32]=g):g=e[32];let b;e[33]!==o?(b=o&&s.jsx(Ct,{size:"xs"}),e[33]=o,e[34]=b):b=e[34];let y;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==g||e[39]!==b?(y=s.jsx(xe,{asChild:!0,children:s.jsxs("button",{type:"button",onClick:m,disabled:f,className:p,children:[g,b]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=g,e[39]=b,e[40]=y):y=e[40];const v=d??V;let w;e[41]!==v?(w=s.jsx(ge,{side:"top",className:"max-w-xs",children:s.jsx("p",{className:"text-xs",children:v})}),e[41]=v,e[42]=w):w=e[42];let A;return e[43]!==y||e[44]!==w?(A=s.jsxs(be,{delayDuration:400,children:[y,w]}),e[43]=y,e[44]=w,e[45]=A):A=e[45],A}function zo(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=_r();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(rs,{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 g;e[20]===Symbol.for("react.memo_cache_sentinel")?(g=j=>{j.key==="Escape"&&i("")},e[20]=g):g=e[20];let b;e[21]!==c?(b=s.jsx(Pr,{value:c,onChange:i,placeholder:"Search prompts...",onKeyDown:g}),e[21]=c,e[22]=b):b=e[22];const y=b;if(m){let j;e[23]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Ir,{className:"sr-only",children:s.jsx(Er,{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]!==y?(P=s.jsxs(Rr,{className:"h-[85vh] flex flex-col p-0 gap-0",children:[j,C,y,p]}),e[25]=p,e[26]=y,e[27]=P):P=e[27];let N;return e[28]!==o||e[29]!==r||e[30]!==P?(N=s.jsx(Nt,{delayDuration:400,children:s.jsx(Tr,{open:r,onOpenChange:o,children:P})}),e[28]=o,e[29]=r,e[30]=P,e[31]=N):N=e[31],N}let v;e[32]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(lt,{className:"sr-only",children:s.jsx(it,{children:"All prompts"})}),e[32]=v):v=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]!==y?(A=s.jsxs(ct,{className:"sm:max-w-[1100px] h-[680px] p-0 gap-0 overflow-hidden flex flex-col",children:[v,w,y,p]}),e[34]=p,e[35]=y,e[36]=A):A=e[36];let k;return e[37]!==o||e[38]!==r||e[39]!==A?(k=s.jsx(Nt,{delayDuration:400,children:s.jsx(dt,{open:r,onOpenChange:o,children:A})}),e[37]=o,e[38]=r,e[39]=A,e[40]=k):k=e[40],k}function Bo(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 g=n.slice(0,an);let b;e[6]!==n?(b=n.slice(an),e[6]=n,e[7]=b):b=e[7],i=b,u=!!o;let y;e[8]!==u||e[9]!==o?.name||e[10]!==r?(y=v=>s.jsx(rs,{item:v,onSelect:r,isLoading:o?.name===v.prompt.name,isDisabled:u&&o?.name!==v.prompt.name},v.prompt.name),e[8]=u,e[9]=o?.name,e[10]=r,e[11]=y):y=e[11],V=g.map(y),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=U("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:U(ss,"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(zo,{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(Nt,{delayDuration:400,children:[x,h]}),e[26]=x,e[27]=h,e[28]=p):p=e[28],p}function Uo(){return null}function Ko(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 qo(t){const e=L.c(30),{connectionId:n}=t,{sendMessage:r}=Ue(),{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}=Dr(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(Qo),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(Ko,f),[p,g]=S.useState(null);let b;e[11]!==l||e[12]!==r?(b=async(E,_)=>{if(!l){ae.error("MCP client not available"),h({type:"RESET"});return}try{const R=await ft(l,E.name,_);h({type:"RESET"});const F={type:"doc",content:[{type:"paragraph",content:[On({id:E.name,name:ot(E.name,ue(E._meta)),metadata:R.messages,char:"/",kind:"prompt",args:_}),{type:"text",text:" "}]}]};await r(F)}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]=b):b=e[13];const y=b;let v;e[14]!==y?(v=async E=>{if(E.arguments&&E.arguments.length>0){h({type:"SELECT_PROMPT",prompt:E}),g(E);return}h({type:"START_LOADING",prompt:E}),await y(E)},e[14]=y,e[15]=v):v=e[15];const w=v;let A;e[16]!==p||e[17]!==y?(A=async E=>{p&&(h({type:"START_LOADING",prompt:p,arguments:E}),g(null),await y(p,E))},e[16]=p,e[17]=y,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(Bo,{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=()=>{g(null),h({type:"RESET"})},e[23]=P):P=e[23];let N;e[24]!==p||e[25]!==k?(N=s.jsx(Je,{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 Qo(t){return{prompt:t}}function Yo(t){const e=L.c(13),{className:n}=t,{selectedVirtualMcp:r}=fe(),{org:o}=ie();let a;e[0]!==o.id?(a=ut(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=U("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(Uo,{}),e[4]=V):V=e[4];let d;e[5]!==c?(d=s.jsx(qo,{connectionId:c}),e[5]=c,e[6]=d):d=e[6];let m;e[7]!==u||e[8]!==d?(m=s.jsx(Bs,{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 yt="cubic-bezier(0.645, 0.045, 0.355, 1)",Ho=44,Go={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"},Wo={default:"border-border",error:"border-destructive/30",warning:"border-amber-500/30"},Jo={default:"text-muted-foreground",error:"text-destructive",warning:"text-amber-600 dark:text-amber-500"};function Ve(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 g;e[0]!==d?(g=()=>{p(!0),d?.()},e[0]=d,e[1]=g):g=e[1];const b=g;if(h)return null;const y=Wo[m],v=Go[m];let w;e[2]!==y||e[3]!==v?(w=U("relative flex flex-col rounded-xl bg-background border shadow-md","w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",y,v),e[2]=y,e[3]=v,e[4]=w):w=e[4];let A;e[5]===Symbol.for("react.memo_cache_sentinel")?(A=()=>x(Zo),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=U("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=Jo[m];let N;e[9]!==P?(N=U("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 F;e[18]!==R?(F=s.jsx("span",{"aria-hidden":"true",className:"text-muted-foreground shrink-0 flex items-center justify-center",children:s.jsx(mt,{size:16,style:{transform:R,transition:`transform 180ms ${yt}`}})}),e[18]=R,e[19]=F):F=e[19];let D,I;e[20]!==b?(D=J=>{J.stopPropagation(),b()},I=J=>{(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),J.stopPropagation(),b())},e[20]=b,e[21]=D,e[22]=I):(D=e[21],I=e[22]);let O;e[23]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(Me,{size:16}),e[23]=O):O=e[23];let z;e[24]!==D||e[25]!==I?(z=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:O}),e[24]=D,e[25]=I,e[26]=z):z=e[26];let $;e[27]!==f||e[28]!==T||e[29]!==E||e[30]!==_||e[31]!==F||e[32]!==z||e[33]!==C?($=s.jsxs("button",{type:"button","data-testid":"collapsible-highlight-chip","aria-expanded":f,onClick:A,className:C,children:[T,E,_,F,z]}),e[27]=f,e[28]=T,e[29]=E,e[30]=_,e[31]=F,e[32]=z,e[33]=C,e[34]=$):$=e[34];const K=f?"1fr":"0fr";let M;e[35]!==K?(M={display:"grid",gridTemplateRows:K,transition:`grid-template-rows 180ms ${yt}`},e[35]=K,e[36]=M):M=e[36];let B;e[37]===Symbol.for("react.memo_cache_sentinel")?(B={overflow:"hidden",minHeight:0},e[37]=B):B=e[37];const Q=f?1:0;let q;e[38]!==Q?(q={opacity:Q,transition:`opacity 120ms ${yt}`},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 se;e[42]!==i||e[43]!==a?(se=i?s.jsx("div",{className:U("overflow-clip pb-4",!a&&"pt-4"),children:i}):null,e[42]=i,e[43]=a,e[44]=se):se=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]!==se||e[51]!==Z?(X=s.jsx("div",{style:B,children:s.jsxs("div",{style:q,children:[Y,se,Z]})}),e[48]=q,e[49]=Y,e[50]=se,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 W;return e[56]!==$||e[57]!==te||e[58]!==w||e[59]!==m?(W=s.jsxs("div",{"data-testid":"collapsible-highlight","data-variant":m,className:w,children:[$,te]}),e[56]=$,e[57]=te,e[58]=w,e[59]=m,e[60]=W):W=e[60],W}function Zo(t){return!t}const Xo=he({content:Ie().min(1).describe("Imperative form, e.g. 'Implement the login flow'"),status:Dt(["pending","in_progress","completed"]),activeForm:Ie().min(1).describe("Present-continuous form shown in the UI while the todo is in progress, e.g. 'Implementing the login flow'")}),os=he({todos:Us(Xo)}),ea="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.";Mr({description:ea,inputSchema:Fr(os),execute:async({todos:t})=>({ok:!0,count:t.length})});const ta="tool-todo_write",na=new Set(["input-available","output-available"]);function as(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!==ta||typeof a.state!="string"||!na.has(a.state))continue;const l=os.safeParse(a.input);if(l.success)return l.data.todos}}return[]}function ls(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:fr(mr(r)),input:n.input})}return e}function is(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 sa(t){return t?t.message.startsWith("[CREDITS]"):!1}const ra={isCreditExhausted:!1,hasTodos:!1,showError:!1,showWarning:!1,hasApprovals:!1,hasPlans:!1,isWaitingForUserInput:!1};function oa(t){const{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=t;if(!o&&n&&sa(n))return{...ra,isCreditExhausted:!0};const l=e.at(-1),c=l?.role==="assistant"?l.parts:[],i=c,V=!!i.filter(y=>y.type==="tool-user_ask").filter(y=>y.state!=="output-available").length,d=is(c),m=ls(i),f=as(e),x=!o&&!!n,h=m.length>0||o&&a,p=d.length>0,b=!o&&!!r&&r!=="stop"&&!(r==="tool-calls"&&(V||h||p))&&!x;return{isCreditExhausted:!1,hasTodos:f.length>0,showError:x,showWarning:b,hasApprovals:h,hasPlans:p,isWaitingForUserInput:V}}function cs(){const t=L.c(6),{messages:e,error:n,finishReason:r,isStreaming:o,isWaitingForApprovals:a}=Ue(),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=oa({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 aa(){const t=cs();return t.isCreditExhausted?0:Number(t.hasTodos)+Number(t.showError)+Number(t.showWarning)+Number(t.hasApprovals)+Number(t.hasPlans)+Number(t.isWaitingForUserInput)}function ds(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 la="__home__";function Qt(t,e){return Ks.chatDraft(t,e)}function ia(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 ca(t,e,n,r,o){const a=Qt(e,n);if(ds(r)){t.removeItem(a);return}const l={tiptapDoc:r,updatedAt:Date.now()},c=JSON.stringify(l);try{t.setItem(a,c)}catch(i){if(ua(i)){const u=new TextEncoder().encode(c).byteLength;o?.onQuotaExceeded?.({docSizeBytes:u});return}throw i}}function ln(t,e,n){const r=Qt(e,n),o=t.getItem(r),a=ia(o);return o!==null&&a===null&&t.removeItem(r),a}function da(t,e,n){t.removeItem(Qt(e,n))}function ua(t){if(!t||typeof t!="object")return!1;const e=t.name;return e==="QuotaExceededError"||e==="NS_ERROR_DOM_QUOTA_REACHED"}function Va(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=U("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(ao,{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=U("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(Hn,{size:14}),e[12]=p):p=e[12];let g;e[13]!==a||e[14]!==h||e[15]!==f?(g=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]=g):g=e[16];let b;return e[17]!==g||e[18]!==V||e[19]!==m?(b=s.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground",children:[V,m,g]}),e[17]=g,e[18]=V,e[19]=m,e[20]=b):b=e[20],b}function us(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(Va,{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 fa(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=U("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(re,{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 g=p;if(!m)return g;let b;e[10]!==g?(b=s.jsx(xe,{asChild:!0,children:g}),e[10]=g,e[11]=b):b=e[11];let y;e[12]!==m?(y=s.jsx(ge,{children:m}),e[12]=m,e[13]=y):y=e[13];let v;return e[14]!==b||e[15]!==y?(v=s.jsxs(be,{children:[b,y]}),e[14]=b,e[15]=y,e[16]=v):v=e[16],v}function Vs(t,e,n){return t.findIndex(r=>e(r)===n)}function cn(t,e,n,r){return t.length===0?!1:t.every(o=>r(n[e(o)]))}function dn(t,e,n,r,o){if(t.length===0)return null;const a=Vs(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 ma(t){return!t.isStreaming&&t.allAnswered}function fs(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=qs({resolver:Qs(r),defaultValues:o}),x=f.watch(),h=Vs(e,n,u),p=h>=0?e[h]:void 0,g=l(x[u]),b=cn(e,n,x,l),y=ma({isStreaming:a,allAnswered:b}),v=()=>{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=dn(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=()=>{y&&(m(!1),j.current())},P=()=>{const N=f.getValues();if(cn(e,n,N,l)){if(a){m(!0);return}m(!1),j.current()}else{const T=dn(e,n,N,l,u);T&&V(T)}};return S.useEffect(()=>{if(d&&!a){if(!b){m(!1);return}m(!1),j.current()}},[d,a,b]),{form:f,activeKey:u,setActiveKey:V,currentIndex:h,currentPart:p,isCurrentAnswered:g,isAllAnswered:b,canSubmit:y,goPrev:v,goNext:w,advanceToNextUnanswered:A,submit:C,submitOrAdvance:P}}const ms="User denied this tool call, give other alternatives.";function ps(t){const e=L.c(9),{onYolo:n}=t,[r,o]=Re();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(ro,{size:"xs",className:"text-xs text-muted-foreground border-border/60 bg-transparent hover:bg-accent/60 h-7 gap-1",onClick:ha,children:s.jsx(oo,{})}),e[4]=c):c=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(to,{children:De.map(pa)}),e[5]=i):i=e[5];let u;return e[6]!==l||e[7]!==r.toolApprovalLevel?(u=s.jsxs(no,{value:r.toolApprovalLevel,onValueChange:l,children:[c,i]}),e[6]=l,e[7]=r.toolApprovalLevel,e[8]=u):u=e[8],u}function pa(t){return s.jsx(so,{value:t.value,children:t.label},t.value)}function ha(t){return t.stopPropagation()}function hs(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 xa(t){const e=L.c(28),{approval:n,onRespond:r}=t,[o]=Re(),a=o.toolApprovalLevel??"readonly";let l;e[0]!==n.approvalId||e[1]!==a||e[2]!==r?(l=()=>r(n.approvalId,!1,ms,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(ps,{onYolo:d})}),e[11]=d,e[12]=m):m=e[12];const f=m;let x;e[13]!==c?(x=s.jsx(re,{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(re,{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 g=p;let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(pt,{size:14}),e[20]=b):b=e[20];let y;e[21]!==n.input?(y=s.jsx(hs,{input:n.input}),e[21]=n.input,e[22]=y):y=e[22];let v;return e[23]!==n.friendlyName||e[24]!==f||e[25]!==g||e[26]!==y?(v=s.jsx(Ve,{icon:b,label:"Approval needed",title:n.friendlyName,defaultExpanded:!0,footerLeft:f,footerRight:g,children:y}),e[23]=n.friendlyName,e[24]=f,e[25]=g,e[26]=y,e[27]=v):v=e[27],v}const ga=Ys(Ie(),he({approved:Hs().optional(),levelOverride:Dt(["auto","readonly"]).optional()}));function ba(t){const e=L.c(42),{approvals:n,isStreaming:r,onRespond:o}=t,[a]=Re(),l=a.toolApprovalLevel??"readonly";let c;e[0]!==n?(c=Object.fromEntries(n.map(Aa)),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?ms: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:ya,schema:ga,defaultValues:i,isStreaming:r,hasAnswer:va,onSubmit:u},e[5]=n,e[6]=i,e[7]=r,e[8]=u,e[9]=V):V=e[9];const d=fs(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(pt,{size:14}),e[15]=p):p=e[15];const g=`${n.length} approvals pending`,b=x?.friendlyName??"";let y;e[16]!==f?(y=s.jsx(ps,{onYolo:f}),e[16]=f,e[17]=y):y=e[17];let v;e[18]!==n.length||e[19]!==d.currentIndex||e[20]!==d.goNext||e[21]!==d.goPrev||e[22]!==y?(v=s.jsx(us,{currentIndex:d.currentIndex,total:n.length,onPrev:d.goPrev,onNext:d.goNext,extraLeft:y}),e[18]=n.length,e[19]=d.currentIndex,e[20]=d.goNext,e[21]=d.goPrev,e[22]=y,e[23]=v):v=e[23];let w;e[24]!==x||e[25]!==d.form.control||e[26]!==d.submitOrAdvance?(w=x?s.jsx(wa,{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(hs,{input:x.input}):null,e[28]=x,e[29]=A):A=e[29];let k;e[30]!==v||e[31]!==w||e[32]!==A||e[33]!==g||e[34]!==b?(k=s.jsx(Ve,{icon:p,label:g,title:b,defaultExpanded:!0,footerLeft:v,footerRight:w,children:A}),e[30]=v,e[31]=w,e[32]=A,e[33]=g,e[34]=b,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(_t,{...d.form,children:j}),e[39]=d.form,e[40]=j,e[41]=C):C=e[41],C}function va(t){return typeof t?.approved=="boolean"}function ya(t){return t.approvalId}function Aa(t){return[t.approvalId,{approved:void 0}]}function wa(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(re,{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(re,{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(Gs,{control:r,name:a,render:l}),e[2]=r,e[3]=a,e[4]=l,e[5]=c):c=e[5],c}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 rounded-lg bg-accent/50 w-[calc(100%-16px)] max-w-[640px] mx-auto mb-2",children:[s.jsx(pt,{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 Sa(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(ja,{}),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(xa,{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(ba,{approvals:n,isStreaming:r,onRespond:o}),e[4]=n,e[5]=r,e[6]=o,e[7]=a):a=e[7],a}function Ca(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(re,{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(re,{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(Qr,{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(pr,{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(Ve,{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 Na(){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(Ke,{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 ka(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(Na,{}),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(Ca,{plan:c,onApprove:o,onDismiss:a}),e[3]=c,e[4]=o,e[5]=a,e[6]=i):i=e[6],i}function xs(t){return t?"response"in t?t.response:t.option??t.draft:""}const un=he({response:Ie().min(1,"Response is required")}),_a=he({option:Ie().nullable(),draft:Ie()}).refine(t=>(t.option??t.draft).length>0,{message:"Please select or enter an option"}),Ia=he({response:Dt(["yes","no"])});function Ea(t){switch(t.type){case"text":return un;case"choice":return _a;case"confirm":return Ia;default:return un}}function Ra(t){const e={};for(const n of t)e[n.toolCallId]=Ea(n.input);return he(e)}function Ta(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(Lt,{children:[s.jsx($t,{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(Un,{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(zt,{})]})},e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==n||e[3]!==r||e[4]!==a?(l=s.jsx(Yn,{control:n,name:r,render:a}),e[2]=n,e[3]=r,e[4]=a,e[5]=l):l=e[5],l}function gs(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 Pa(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}=Wt(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}=Wt(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],gs(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:U("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:U("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",g=!x&&"hover:bg-accent/30";let b;e[16]!==p||e[17]!==g?(b=U("flex items-center gap-3 px-2 py-3 rounded-lg transition-colors w-full cursor-text",p,g),e[16]=p,e[17]=g,e[18]=b):b=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("span",{className:"flex items-center justify-center size-6 rounded-md bg-muted shrink-0",children:s.jsx(Un,{size:16,className:"text-muted-foreground"})}),e[19]=y):y=e[19];const v=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]!==v||e[28]!==w||e[29]!==A?(k=s.jsx("input",{type:"text",value:v,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]=v,e[28]=w,e[29]=A,e[30]=k):k=e[30];let j;e[31]!==k||e[32]!==b?(j=s.jsxs("label",{className:b,children:[y,k]}),e[31]=k,e[32]=b,e[33]=j):j=e[33];let C;e[34]!==j||e[35]!==h?(C=s.jsx($t,{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(zt,{}),e[37]=P):P=e[37];let N;return e[38]!==C?(N=s.jsxs(Lt,{children:[C,P]}),e[38]=C,e[39]=N):N=e[39],N}function Da(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],gs(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(Lt,{children:[s.jsx($t,{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:U("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:U("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(zt,{})]})},e[2]=i):i=e[2];let u;return e[3]!==n||e[4]!==r?(u=s.jsx(Yn,{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(Ta,{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(Pa,{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(Da,{control:r,name:a}),e[10]=r,e[11]=a,e[12]=l):l=e[12],l}default:return null}}function Ma(t){const e=L.c(71),{parts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=Ra(n.map($a)),e[0]=n,e[1]=a):a=e[1];const l=a;let c;e[2]!==n?(c=Object.fromEntries(n.map(La)),e[2]=n,e[3]=c):c=e[3];const i=c;let u;e[4]!==o?(u=(D,I)=>{const O=xs(I);O&&o(D,O)},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:Oa,schema:l,defaultValues:i,isStreaming:r,hasAnswer:Fa,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=fs(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(us,{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 g;e[20]!==x?(g=s.jsx(re,{type:"button",variant:"outline",size:"sm",onClick:x,className:"h-7",children:"Skip"}),e[20]=x,e[21]=g):g=e[21];let b;e[22]!==d.isAllAnswered||e[23]!==d.isCurrentAnswered||e[24]!==d.submitOrAdvance||e[25]!==r?(b=s.jsx(fa,{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]=b):b=e[26];let y;e[27]!==g||e[28]!==b?(y=s.jsxs(s.Fragment,{children:[g,b]}),e[27]=g,e[28]=b,e[29]=y):y=e[29];const v=y;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 O;e[32]===Symbol.for("react.memo_cache_sentinel")?(O=s.jsx(It,{size:14}),e[32]=O):O=e[32];const z=D.input?.prompt??"Question",$=D.input;let K;e[33]!==d.form.control||e[34]!==D.toolCallId||e[35]!==$?(K=s.jsx(Vn,{input:$,control:d.form.control,toolCallId:D.toolCallId}),e[33]=d.form.control,e[34]=D.toolCallId,e[35]=$,e[36]=K):K=e[36];let M;e[37]!==v||e[38]!==z||e[39]!==K?(M=s.jsx(Ve,{icon:O,label:"Question pending",title:z,defaultExpanded:!0,footerRight:v,children:K}),e[37]=v,e[38]=z,e[39]=K,e[40]=M):M=e[40];let B;e[41]!==I||e[42]!==M?(B=s.jsx("form",{onSubmit:I,autoComplete:"off",children:M}),e[41]=I,e[42]=M,e[43]=B):B=e[43];let Q;return e[44]!==d.form||e[45]!==B?(Q=s.jsx(_t,{...d.form,children:B}),e[44]=d.form,e[45]=B,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(It,{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(io,{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(co,{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]!==v||e[61]!==j||e[62]!==C||e[63]!==E?(_=s.jsx(Ve,{icon:k,label:"Question pending",count:j,title:C,defaultExpanded:!0,footerLeft:p,footerRight:v,children:E}),e[59]=p,e[60]=v,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 F;return e[68]!==d.form||e[69]!==R?(F=s.jsx(_t,{...w,children:R}),e[68]=d.form,e[69]=R,e[70]=F):F=e[70],F}function Fa(t){return!!xs(t)}function Oa(t){return t.toolCallId}function La(t){return t.input?.type==="choice"?[t.toolCallId,{option:null,draft:""}]:[t.toolCallId,{response:""}]}function $a(t){return{toolCallId:t.toolCallId,input:t.input}}function za(){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(It,{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 bs(t){const e=L.c(7),{userAskParts:n,isStreaming:r,onSubmit:o}=t;let a;e[0]!==n?(a=n.filter(Ba),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(za,{}),e[2]=i):i=e[2],i}return null}let c;return e[3]!==r||e[4]!==o||e[5]!==l?(c=s.jsx(Ma,{parts:l,isStreaming:r,onSubmit:o}),e[3]=r,e[4]=o,e[5]=l,e[6]=c):c=e[6],c}function Ba(t){return t.state==="input-available"}function Ua(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 Ka(){const t=L.c(21),{messages:e}=Ue();let n,r,o,a,l,c,i,u,V;if(t[0]!==e){V=Symbol.for("react.early_return_sentinel");e:{const f=as(e);if(f.length===0){V=null;break e}const x=Ua(f);n=Ve,l=s.jsx(Ha,{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(qa)}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 qa(t,e){return s.jsx(Qa,{todo:t},e)}function Qa(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(Ya,{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=U("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 Ya(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 Ha(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 fn=new Map;function vs(){const{org:t}=ie(),e=de({connectionId:Vt,orgId:t.id,orgSlug:t.slug}),n=uo(),r=n.find(p=>p.providerId==="deco"),{data:o,isLoading:a,refetch:l,isFetching:c}=Rn({queryKey:Ee.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=fn.get(t.id);V.current.get(t.id)&&p!=null&&i>p&&G("credits_topped_up_detected",{organization_id:t.id,delta_cents:i-p,previous_balance_cents:p,new_balance_cents:i}),fn.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 Ga={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"}]},Wa=["Access to 100+ AI models","Unified API, no separate keys needed","Pay only for what you use"];function ys(t){const e=L.c(44),{onDismiss:n}=t,{org:r}=ie(),o=rt(),{decoKeyId:a}=vs();let l;e[0]!==r.id||e[1]!==r.slug?(l={connectionId:Vt,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=()=>{G("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 g;e[6]!==c||e[7]!==m?(g=async I=>{const O=await c.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:I,currency:m}});if(O?.isError)throw new Error(O.content?.[0]?.text??"Failed to get top-up URL");return O.structuredContent?.url},e[6]=c,e[7]=m,e[8]=g):g=e[8];let b;e[9]!==n?(b=I=>{I&&window.open(I,"_blank","noopener,noreferrer"),n?.()},e[9]=n,e[10]=b):b=e[10];let y;e[11]!==g||e[12]!==b?(y={mutationFn:g,onSuccess:b,onError:Xa},e[11]=g,e[12]=b,e[13]=y):y=e[13];const{mutate:v,isPending:w}=Mt(y),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(lt,{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(it,{className:"text-xl font-semibold tracking-tight",children:"Top up to keep building"}),s.jsx(Ot,{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]!==v?(T=a&&s.jsxs("div",{className:"px-8 pt-5 pb-6",children:[s.jsx("div",{className:"mb-4",children:s.jsxs(Gn,{type:"single",variant:"outline",size:"sm",value:m,onValueChange:I=>{I&&f(I)},children:[s.jsx(Ze,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(Ze,{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:Ga[m].map(I=>{const{dollars:O,label:z}=I;return s.jsxs("button",{type:"button",disabled:w,onClick:()=>{G("credits_topup_clicked",{amount_cents:O*100,currency:m,tier_label:z,source:"exhausted_banner"}),v(O*100)},className:U("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,O]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:z})]},O)})}),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(Wn,{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(re,{className:"h-10",disabled:!k||w,onClick:()=>{G("credits_topup_clicked",{amount_cents:Math.round(A*100),currency:m,tier_label:"custom",source:"exhausted_banner"}),v(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:Wa.map(Ja)})]}),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]=v,e[28]=T):T=e[28];let E;e[29]!==n?(E=s.jsx(re,{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 F;e[38]!==T||e[39]!==R?(F=s.jsxs(ct,{className:"sm:max-w-[520px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Za,children:[N,T,R]}),e[38]=T,e[39]=R,e[40]=F):F=e[40];let D;return e[41]!==F||e[42]!==j?(D=s.jsx(dt,{open:!0,onOpenChange:j,children:F}),e[41]=F,e[42]=j,e[43]=D):D=e[43],D}function Ja(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(Ke,{size:12,className:"text-[hsl(var(--chart-1))]"})}),s.jsx("span",{className:"text-sm text-foreground/80",children:t})]},t)}function Za(t){return t.preventDefault()}function Xa(t){ae.error(`Top-up failed: ${t.message}`)}function el(){const t=L.c(5),e=at(),n=jr(),[r,o]=S.useState(!1);if(!(e?.lockedSandbox==="user-desktop")||!n.ready||n.online)return null;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Jn,{size:14}),t[0]=l):l=t[0];let c;t[1]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(re,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>o(!0),children:"Reconnect desktop"}),t[1]=c):c=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Ve,{icon:l,label:"Your desktop is offline",title:"This chat runs on your desktop, which isn't connected right now.",defaultExpanded:!0,variant:"warning",footerRight:c,children:s.jsxs("p",{className:"mx-4 text-xs text-muted-foreground",children:["Run ",s.jsx("code",{className:"font-mono",children:"bunx decocms link"})," in a terminal on that machine to bring it back. Messages you send while it's offline will fail."]})}),t[2]=i):i=t[2];let u;return t[3]!==r?(u=s.jsxs(s.Fragment,{children:[i,s.jsx(Zn,{open:r,onOpenChange:o})]}),t[3]=r,t[4]=u):u=t[4],u}function tl(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/link_unavailable|user_desktop_link_/i.test(e)?/user_desktop_link_capability_missing/i.test(e)?{summary:"Your desktop is connected, but the CLI this chat uses wasn't detected there. Install it and sign in on your desktop, then try again.",rawDetails:t}:{summary:"Your desktop is offline. Run `bunx decocms link` in a terminal on it, then try again.",rawDetails:t}: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 nl={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 Xe(t){const e=L.c(19),{variant:n,onDismiss:r}=t,o=n==="error",a=o?"Error occurred":"Response incomplete",l=o?Qn:Tn,c=o?t.error.message:nl[t.finishReason]??`Response stopped unexpectedly: ${t.finishReason}`;let i;e[0]!==o||e[1]!==c?(i=o?tl(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(re,{size:"sm",variant:"outline",onClick:t.onFixInChat,className:"h-7 text-xs",children:"Fix in chat"}):s.jsx(re,{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(rl).catch(sl)},"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(eo,{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(Ve,{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 sl(){return ae.error("Could not copy")}function rl(){return ae.success("Copied to clipboard")}function xt(){const t=L.c(62),{error:e,clearError:n,finishReason:r,clearFinishReason:o,messages:a,isStreaming:l,submit:c,sendMessage:i}=Ue(),[u,V]=Re(),{virtualMcpId:d,createTaskWithMessage:m}=Sr(),{chatMode:f,simpleModeTier:x}=fe();let h;t[0]!==f||t[1]!==x||t[2]!==d?(h=ee=>({tier:x,mode:f,toolApprovalLevel:ee,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 g;t[4]!==u.toolApprovalLevel?(g=u.toolApprovalLevel??Ws(),t[4]=u.toolApprovalLevel,t[5]=g):g=t[5];const b=g,y=a.at(-1),v=y?.role==="assistant"?y.parts:[],w=v.filter(il),A=is(v),k=ls(v);let j;t[6]!==e||t[7]!==i?(j=()=>{if(e){const ne={type:"doc",content:[{type:"paragraph",content:[{type:"text",text:`I encountered this error: ${e.message}. Can you help me fix it?`}]}]};i(ne)}},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]!==b||t[13]!==c?(T=(ee,ne)=>{c({kind:"toolOutput",toolCallId:ee.toolCallId,output:{response:ne}},p(b))},t[11]=p,t[12]=b,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?(_=ee=>{V({...u,toolApprovalLevel:"auto"}),m({virtualMcpId:d,message:{parts:[{type:"text",text:`Implement this plan:
|
|
2
2
|
|
|
3
3
|
${ee}`}]}})},t[15]=m,t[16]=u,t[17]=V,t[18]=d,t[19]=_):_=t[19];const R=_,F=ll;let D;t[20]!==p||t[21]!==c?(D=(ee,ne,H,le)=>{c({kind:"approval",approvalId:ee,approved:ne,...H?{reason:H}:{}},p(le))},t[20]=p,t[21]=c,t[22]=D):D=t[22];const I=D,O=cs();if(O.isCreditExhausted){let ee;return t[23]!==n?(ee=s.jsx(ys,{onDismiss:n}),t[23]=n,t[24]=ee):ee=t[24],ee}const{showError:z,showWarning:$,hasApprovals:K}=O,M=w.map(al).join("|"),B=A[0]?.toolCallId??"",Q=k.map(ol).join("|");let q,Y;t[25]===Symbol.for("react.memo_cache_sentinel")?(q=s.jsx(Ka,{}),Y=s.jsx(el,{}),t[25]=q,t[26]=Y):(q=t[25],Y=t[26]);let se;t[27]!==n||t[28]!==e||t[29]!==C||t[30]!==z?(se=z&&s.jsx(Xe,{variant:"error",error:e,onDismiss:n,onFixInChat:C}),t[27]=n,t[28]=e,t[29]=C,t[30]=z,t[31]=se):se=t[31];let Z;t[32]!==o||t[33]!==r||t[34]!==N||t[35]!==$?(Z=$&&s.jsx(Xe,{variant:"warning",finishReason:r,onDismiss:o,onContinue:N}),t[32]=o,t[33]=r,t[34]=N,t[35]=$,t[36]=Z):Z=t[36];let X;t[37]!==Q||t[38]!==I||t[39]!==K||t[40]!==l||t[41]!==k?(X=K&&s.jsx(Sa,{approvals:k,isStreaming:l,onRespond:I},Q),t[37]=Q,t[38]=I,t[39]=K,t[40]=l,t[41]=k,t[42]=X):X=t[42];let te;t[43]!==O.hasPlans||t[44]!==R||t[45]!==F||t[46]!==l||t[47]!==A||t[48]!==B?(te=O.hasPlans&&s.jsx(ka,{plans:A,isStreaming:l,onApprove:R,onDismiss:F},B),t[43]=O.hasPlans,t[44]=R,t[45]=F,t[46]=l,t[47]=A,t[48]=B,t[49]=te):te=t[49];let W;t[50]!==O.isWaitingForUserInput||t[51]!==E||t[52]!==l||t[53]!==M||t[54]!==w?(W=O.isWaitingForUserInput&&s.jsx(bs,{userAskParts:w,isStreaming:l,onSubmit:E},M),t[50]=O.isWaitingForUserInput,t[51]=E,t[52]=l,t[53]=M,t[54]=w,t[55]=W):W=t[55];let J;return t[56]!==Z||t[57]!==X||t[58]!==te||t[59]!==W||t[60]!==se?(J=s.jsxs("div",{className:"absolute bottom-full left-0 right-0",children:[q,Y,se,Z,X,te,W]}),t[56]=Z,t[57]=X,t[58]=te,t[59]=W,t[60]=se,t[61]=J):J=t[61],J}function ol(t){return t.approvalId}function al(t){return t.toolCallId}function ll(){document.querySelector("[data-chat-input]")?.focus()}function il(t){return t.type==="tool-user_ask"}xt.Error=function(e){return s.jsx(Xe,{variant:"error",error:e.error,onDismiss:e.onDismiss,onFixInChat:e.onFixInChat})};xt.Warning=function(e){return s.jsx(Xe,{variant:"warning",finishReason:e.finishReason,onDismiss:e.onDismiss,onContinue:e.onContinue})};xt.UserAskQuestion=bs;async function cl(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 As=["SANDBOX_START"],Qe=new Map,dl=t=>`${t.virtualMcpId}::${t.branch??""}`,At=new Set,ul={mark:(t,e)=>At.add(`${t}::${e}`),clear:(t,e)=>At.delete(`${t}::${e}`),isStopped:(t,e)=>At.has(`${t}::${e}`)};function Vl(t){const e=Be();return Mt({mutationKey:As,mutationFn:async n=>{n.branch&&ul.clear(n.virtualMcpId,n.branch);const r=dl(n),o=Qe.get(r);if(o)return o;const a=(async()=>(await cl(t,"SANDBOX_START",n)).structuredContent)();Qe.set(r,a);try{return await a}finally{Qe.get(r)===a&&Qe.delete(r)}},onSuccess:()=>{Js(e)}})}function Zd(t,e){const n=L.c(3);let r;return n[0]!==e||n[1]!==t?(r={mutationKey:As,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],Oo(r)>0}const fl={fast:{modelId:"claude-code:haiku",label:"Haiku 4.5"},smart:{modelId:"claude-code:sonnet",label:"Sonnet 4.6"},thinking:{modelId:"claude-code:opus-1m",label:"Opus 4.8 1M"}},ml={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 pl(t){return t==="claude-code"?fl:t==="codex"?ml:null}function mn(t,e){return pl(t)?.[e]??null}const hl={"cloud-decopilot":"decopilot","local-decopilot":"decopilot-desktop","local-claude-code":"claude-code-desktop","local-codex":"codex-desktop"},xl={decopilot:"cloud-decopilot","decopilot-desktop":"local-decopilot","claude-code-desktop":"local-claude-code","codex-desktop":"local-codex"};function gl(t){return hl[t]}function bl(t){return t===null?"cloud-decopilot":xl[t]}function ws(){const t=L.c(2),{pendingAgentOption:e}=fe();let n;return t[0]!==e?(n=bl(e),t[0]=e,t[1]=n):n=t[1],n}function vl(){const t=L.c(2),{setPendingAgentOption:e}=fe();let n;return t[0]!==e?(n=r=>e(gl(r)),t[0]=e,t[1]=n):n=t[1],n}function yl(){return fe().simpleModeTier}function Al(){return fe().setSimpleModeTier}const wl={fast:"Quicker responses",smart:"Balanced quality",thinking:"Deeper reasoning"};function jl(t,e){return t==="local-claude-code"?mn("claude-code",e)?.label??null:t==="local-codex"?mn("codex",e)?.label??null:wl[e]}const Sl={decopilot:"Decopilot","claude-code":"Claude Code",codex:"Codex"},Cl=ut("").icon;function et(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=U(o),e[0]=o,e[1]=a):a=e[1];let l;return e[2]!==a?(l=s.jsx(Kn,{icon:Cl,name:"Decopilot",size:"2xs",className:a}),e[2]=a,e[3]=l):l=e[3],l}const Nl={mode:"cloud-decopilot",label:"Decopilot",description:"Runs in an agent sandbox",group:"cloud",icon:s.jsx(et,{}),isAvailable:t=>t.agentSandbox},kl={mode:"local-decopilot",label:"Decopilot",description:"Runs on your desktop",group:"local",icon:s.jsx(et,{}),isAvailable:t=>t.userDesktop},_l={mode:"local-claude-code",label:"Claude Code",description:"Runs via Claude Code CLI",group:"local",icon:s.jsx(Xn,{size:16}),isAvailable:t=>t.userDesktop&&t.claudeCode},Il={mode:"local-codex",label:"Codex",description:"Runs via Codex CLI",group:"local",icon:s.jsx(es,{size:16}),isAvailable:t=>t.userDesktop&&t.codex},tt=[Nl,kl,_l,Il];function El(t,e){return tt.some(n=>n.mode===t&&n.isAvailable(e))}function Rl(t,e){return El(t,e)?t:tt.find(n=>n.isAvailable(e))?.mode??t}function Tl(t){return t==="local-decopilot"?{icon:s.jsx(et,{compact:!0}),text:"Decopilot"}:t==="local-claude-code"?{icon:s.jsx(Xn,{size:14}),text:"Claude Code"}:t==="local-codex"?{icon:s.jsx(es,{size:14}),text:"Codex"}:{icon:s.jsx(et,{compact:!0}),text:"Cloud"}}const Pl="text-muted-foreground hover:text-foreground text-xs transition-[gap] duration-200",Dl="text-success hover:text-success";function Ml(t){const e=L.c(78),{mode:n,availability:r,locked:o,lockedHarness:a,onSelect:l,onConnectDesktop:c}=t,[i,u]=S.useState(!1);let V;e[0]!==n?(V=Tl(n),e[0]=n,e[1]=V):V=e[1];const{icon:d,text:m}=V,f=n!=="cloud-decopilot",x=a!=null,h=a?Sl[a]:null;let p,g,b,y,v,w,A,k,j,C,P,N,T;if(e[2]!==r||e[3]!==h||e[4]!==d||e[5]!==f||e[6]!==o||e[7]!==n||e[8]!==c||e[9]!==l||e[10]!==i||e[11]!==x||e[12]!==m){let F;e[26]!==r?(F=ne=>ne.group==="cloud"&&ne.isAvailable(r),e[26]=r,e[27]=F):F=e[27];const D=tt.filter(F),I=tt.filter(Fl);let O;e[28]!==l?(O=ne=>{l(ne),u(!1)},e[28]=l,e[29]=O):O=e[29];const z=O;let $;e[30]!==c?($=()=>{u(!1),c?.()},e[30]=c,e[31]=$):$=e[31];const K=$;g=Bt,b=i,y=o?void 0:u;const M=x&&h?`This chat is using ${h}. Start a new chat to use a different runtime.`:m,B=o?"mode-picker-locked":"mode-picker",Q=f&&Dl,q=o?"gap-0":"gap-0 @[320px]/chat-bottom:gap-1.5";let Y;e[32]!==Q||e[33]!==q?(Y=U(Pl,Q,"shrink min-w-0",q),e[32]=Q,e[33]=q,e[34]=Y):Y=e[34];let se;e[35]!==m?(se=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:m}),e[35]=m,e[36]=se):se=e[36];let Z;e[37]!==o?(Z=!o&&s.jsx(mt,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[37]=o,e[38]=Z):Z=e[38];let X;e[39]!==d||e[40]!==o||e[41]!==M||e[42]!==B||e[43]!==Y||e[44]!==se||e[45]!==Z?(X=s.jsx(xe,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(Ut,{asChild:!0,children:s.jsxs(re,{type:"button",variant:"ghost",size:"default","aria-label":M,disabled:o,"data-testid":B,className:Y,children:[d,se,Z]})})})}),e[39]=d,e[40]=o,e[41]=M,e[42]=B,e[43]=Y,e[44]=se,e[45]=Z,e[46]=X):X=e[46];const te=x&&h?`This chat is using ${h}. Start a new chat to use a different runtime.`:m;let W;e[47]!==te?(W=s.jsx(ge,{children:te}),e[47]=te,e[48]=W):W=e[48],e[49]!==X||e[50]!==W?(v=s.jsxs(be,{children:[X,W]}),e[49]=X,e[50]=W,e[51]=v):v=e[51],p=Kt,N="start",T="p-1 w-64",w="menu",A="flex flex-col",k=D.length>0&&s.jsx(pn,{title:"Cloud"});let J;e[52]!==z||e[53]!==n?(J=ne=>s.jsx(hn,{row:ne,active:n===ne.mode,onSelect:z},ne.mode),e[52]=z,e[53]=n,e[54]=J):J=e[54],j=D.map(J),C=I.length>0&&s.jsx(pn,{title:"Local",variant:"success",icon:s.jsx(Jn,{size:12,"data-testid":"local-section-desktop-icon"}),testId:"local-section-header"});let ee;e[55]!==r||e[56]!==K||e[57]!==z||e[58]!==n?(ee=ne=>{const H=ne.isAvailable(r);return s.jsx(hn,{row:ne,active:H&&n===ne.mode,onSelect:z,unavailableHint:H?void 0:r.userDesktop?"Not detected on your desktop":"Connect your desktop to enable",onUnavailableClick:K},ne.mode)},e[55]=r,e[56]=K,e[57]=z,e[58]=n,e[59]=ee):ee=e[59],P=I.map(ee),e[2]=r,e[3]=h,e[4]=d,e[5]=f,e[6]=o,e[7]=n,e[8]=c,e[9]=l,e[10]=i,e[11]=x,e[12]=m,e[13]=p,e[14]=g,e[15]=b,e[16]=y,e[17]=v,e[18]=w,e[19]=A,e[20]=k,e[21]=j,e[22]=C,e[23]=P,e[24]=N,e[25]=T}else p=e[13],g=e[14],b=e[15],y=e[16],v=e[17],w=e[18],A=e[19],k=e[20],j=e[21],C=e[22],P=e[23],N=e[24],T=e[25];let E;e[60]!==w||e[61]!==A||e[62]!==k||e[63]!==j||e[64]!==C||e[65]!==P?(E=s.jsxs("div",{role:w,className:A,children:[k,j,C,P]}),e[60]=w,e[61]=A,e[62]=k,e[63]=j,e[64]=C,e[65]=P,e[66]=E):E=e[66];let _;e[67]!==p||e[68]!==E||e[69]!==N||e[70]!==T?(_=s.jsx(p,{align:N,className:T,children:E}),e[67]=p,e[68]=E,e[69]=N,e[70]=T,e[71]=_):_=e[71];let R;return e[72]!==g||e[73]!==b||e[74]!==y||e[75]!==v||e[76]!==_?(R=s.jsxs(g,{open:b,onOpenChange:y,children:[v,_]}),e[72]=g,e[73]=b,e[74]=y,e[75]=v,e[76]=_,e[77]=R):R=e[77],R}function Fl(t){return t.group==="local"}function pn(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=U("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 hn(t){const e=L.c(25),{row:n,active:r,onSelect:o,unavailableHint:a,onUnavailableClick:l}=t,c=a!=null,i=c||void 0;let u;e[0]!==o||e[1]!==l||e[2]!==n.mode||e[3]!==c?(u=()=>c?l?.():o(n.mode),e[0]=o,e[1]=l,e[2]=n.mode,e[3]=c,e[4]=u):u=e[4];const V=c&&"opacity-60";let d;e[5]!==V?(d=U("flex items-start gap-2 px-2 py-1.5 rounded-md text-left","hover:bg-muted",V),e[5]=V,e[6]=d):d=e[6];let m;e[7]!==n.icon?(m=s.jsx("span",{className:"shrink-0 text-muted-foreground mt-0.5",children:n.icon}),e[7]=n.icon,e[8]=m):m=e[8];let f;e[9]!==n.label?(f=s.jsx("div",{className:"text-sm",children:n.label}),e[9]=n.label,e[10]=f):f=e[10];const x=a??n.description;let h;e[11]!==x?(h=s.jsx("div",{className:"text-xs text-muted-foreground",children:x}),e[11]=x,e[12]=h):h=e[12];let p;e[13]!==f||e[14]!==h?(p=s.jsxs("div",{className:"flex-1",children:[f,h]}),e[13]=f,e[14]=h,e[15]=p):p=e[15];let g;e[16]!==r?(g=r&&s.jsx(Ke,{size:14,className:"text-foreground mt-0.5"}),e[16]=r,e[17]=g):g=e[17];let b;return e[18]!==i||e[19]!==g||e[20]!==u||e[21]!==d||e[22]!==m||e[23]!==p?(b=s.jsxs("button",{type:"button",role:"menuitem","aria-disabled":i,onClick:u,className:d,children:[m,p,g]}),e[18]=i,e[19]=g,e[20]=u,e[21]=d,e[22]=m,e[23]=p,e[24]=b):b=e[24],b}function Ol(t){const e=L.c(23),{locked:n,currentBranch:r,virtualMcpId:o}=t,a=ws(),l=vl(),{org:c}=ie();let i;e[0]!==c.id||e[1]!==c.slug?(i={connectionId:Vt,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=Vl(u),m=at()?.lockedHarness??null,f=Cr();let x;e[3]!==f||e[4]!==a?(x=Rl(a,f),e[3]=f,e[4]=a,e[5]=x):x=e[5];const h=x,[p,g]=S.useState(!1);let b;e[6]!==r||e[7]!==l||e[8]!==V||e[9]!==o?(b=j=>{l(j),G("agent_mode_selected",{mode:j}),r&&V.mutate({virtualMcpId:o,branch:r,sandboxProviderKind:j==="cloud-decopilot"?"agent-sandbox":"user-desktop"})},e[6]=r,e[7]=l,e[8]=V,e[9]=o,e[10]=b):b=e[10];const y=b;let v;e[11]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{G("agent_mode_connect_desktop_opened"),g(!0)},e[11]=v):v=e[11];let w;e[12]!==f||e[13]!==y||e[14]!==n||e[15]!==m||e[16]!==h?(w=s.jsx(Ml,{mode:h,availability:f,locked:n,lockedHarness:m,onSelect:y,onConnectDesktop:v}),e[12]=f,e[13]=y,e[14]=n,e[15]=m,e[16]=h,e[17]=w):w=e[17];let A;e[18]!==p?(A=s.jsx(Zn,{open:p,onOpenChange:g}),e[18]=p,e[19]=A):A=e[19];let k;return e[20]!==w||e[21]!==A?(k=s.jsxs(s.Fragment,{children:[w,A]}),e[20]=w,e[21]=A,e[22]=k):k=e[22],k}const xn=["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"],gn=["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 Ll(){const t=xn[Math.floor(Math.random()*xn.length)],e=gn[Math.floor(Math.random()*gn.length)];return`deco/${t}-${e}`}const Ge=100;function $l(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 zl(t,e){const n=e.trim().toLowerCase();return n?[...t].some(r=>r.toLowerCase().includes(n)):!0}function Bl(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 Ul(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=Zs.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 $=>{const{pageParam:K,signal:M}=$,B=Number(K),Q=await f.callTool({name:"list_branches",arguments:{owner:c,repo:i,page:B,perPage:Ge}},void 0,{signal:M}),q=Bl(Q);return{branches:Array.isArray(q)?q:q.branches??[],default_branch:Array.isArray(q)?null:q.default_branch??null,page:B}},e[10]=f,e[11]=c,e[12]=i,e[13]=p):p=e[13];let g;e[14]!==x||e[15]!==h||e[16]!==p?(g={queryKey:x,enabled:h,staleTime:3e4,retry:!1,initialPageParam:1,queryFn:p,getNextPageParam:Gl},e[14]=x,e[15]=h,e[16]=p,e[17]=g):g=e[17];const{data:b,isLoading:y,isError:v,hasNextPage:w,isFetchingNextPage:A,fetchNextPage:k}=vo(g);let j,C;e[18]!==l||e[19]!==o?(C=new Set(Object.keys(l?.[o]??{})),j=[...C].sort().map(Hl),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]!==b?.pages){const $=new Map;for(const M of b?.pages??[])for(const B of M.branches)typeof B.name=="string"&&$.set(B.name,B);N=[...$.values()].filter(Yl),e[22]=b?.pages,e[23]=N}else N=e[23];let T;e[24]!==N||e[25]!==C?(T=N.filter($=>!C.has($.name)).map(Ql),e[24]=N,e[25]=C,e[26]=T):T=e[26];const E=T;let _;e[27]!==b?.pages?(_=b?.pages.find(ql)?.default_branch??null,e[27]=b?.pages,e[28]=_):_=e[28];const R=_;let F;e[29]!==b?.pages||e[30]!==k||e[31]!==A||e[32]!==C?(F=async($,K)=>{const M=K===void 0?Kl:K;if(!M()||zl(C,$)||A)return;let B=b?.pages??[];for(;M()&&!$l(B,$,C)&&(B.at(-1)?.branches.length??Ge)>=Ge;){const Q=await k();if(!M())break;const q=Q.data?.pages??B;if(q.length===B.length)break;B=q}},e[29]=b?.pages,e[30]=k,e[31]=A,e[32]=C,e[33]=F):F=e[33];const D=F,I=w??!1;let O;e[34]!==k||e[35]!==w||e[36]!==A?(O=()=>{w&&!A&&k()},e[34]=k,e[35]=w,e[36]=A,e[37]=O):O=e[37];let z;return e[38]!==R||e[39]!==D||e[40]!==v||e[41]!==A||e[42]!==y||e[43]!==E||e[44]!==I||e[45]!==O||e[46]!==P?(z={yours:P,others:E,defaultBase:R,isLoading:y,isError:v,hasMore:I,isFetchingMore:A,fetchMore:O,fetchUntilMatch:D},e[38]=R,e[39]=D,e[40]=v,e[41]=A,e[42]=y,e[43]=E,e[44]=I,e[45]=O,e[46]=P,e[47]=z):z=e[47],z}function Kl(){return!0}function ql(t){return t.default_branch}function Ql(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function Yl(t){return typeof t.name=="string"}function Hl(t){return{name:t,source:"yours"}}function Gl(t){if(!(t.branches.length<Ge))return t.page+1}function Wl(t){const e=L.c(84),{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,g]=S.useState(!1),[b,y]=S.useState(""),[v,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}=Ul(k);let F;e[9]!==V?(F=oe=>{V(oe),g(!1)},e[9]=V,e[10]=F):F=e[10];const D=F,I=u??"Select branch…";let O;e[11]!==R?(O=oe=>{y(oe),A.current=A.current+1;const ke=A.current,gt=oe.trim();if(!gt){w(!1);return}w(!0),R(gt,()=>ke===A.current).finally(()=>{ke===A.current&&w(!1)})},e[11]=R,e[12]=O):O=e[12];const z=O;let $;e[13]!==_?($=oe=>{const ke=oe.currentTarget;ke.scrollHeight-ke.scrollTop-ke.clientHeight<48&&_()},e[13]=_,e[14]=$):$=e[14];const K=$,M=f?void 0:g,B=h?"outline":"ghost",Q=h?"sm":"default";let q;e[15]!==f||e[16]!==h?(q=U("font-mono shrink min-w-0 max-w-[200px]",h?"gap-1.5 text-xs":U("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(He,{className:"h-3.5 w-3.5 shrink-0"}),e[18]=Y):Y=e[18];const se=h?"":"transition-[max-width,opacity] duration-200 ease-out max-w-0 opacity-0 @[320px]/chat-bottom:max-w-[200px] @[320px]/chat-bottom:opacity-100";let Z;e[19]!==se?(Z=U("min-w-0 truncate",se),e[19]=se,e[20]=Z):Z=e[20];let X;e[21]!==I||e[22]!==Z?(X=s.jsx("span",{className:Z,children:I}),e[21]=I,e[22]=Z,e[23]=X):X=e[23];let te;e[24]!==f||e[25]!==h?(te=!f&&s.jsx(mt,{size:12,className:U("opacity-60 shrink-0",h?"":"hidden @[320px]/chat-bottom:inline-block")}),e[24]=f,e[25]=h,e[26]=te):te=e[26];let W;e[27]!==f||e[28]!==I||e[29]!==q||e[30]!==X||e[31]!==te||e[32]!==B||e[33]!==Q?(W=s.jsx(xe,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(Ut,{asChild:!0,children:s.jsxs(re,{variant:B,size:Q,"aria-label":I,disabled:f,className:q,children:[Y,X,te]})})})}),e[27]=f,e[28]=I,e[29]=q,e[30]=X,e[31]=te,e[32]=B,e[33]=Q,e[34]=W):W=e[34];let J;e[35]!==I?(J=s.jsx(ge,{children:I}),e[35]=I,e[36]=J):J=e[36];let ee;e[37]!==W||e[38]!==J?(ee=s.jsxs(be,{children:[W,J]}),e[37]=W,e[38]=J,e[39]=ee):ee=e[39];let ne;e[40]!==z||e[41]!==b?(ne=s.jsx(ho,{placeholder:"Search loaded branches…",value:b,onValueChange:z}),e[40]=z,e[41]=b,e[42]=ne):ne=e[42];let H;e[43]!==D?(H=s.jsx(re,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>D(Ll()),children:"New"}),e[43]=D,e[44]=H):H=e[44];let le;e[45]!==ne||e[46]!==H?(le=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:[ne,H]}),e[45]=ne,e[46]=H,e[47]=le):le=e[47];let ve;e[48]!==N?(ve=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[48]=N,e[49]=ve):ve=e[49];let ye;e[50]!==T||e[51]!==N||e[52]!==P?(ye=!N&&!P&&s.jsx(xo,{children:T?"Looking through more branches...":"No branches found."}),e[50]=T,e[51]=N,e[52]=P,e[53]=ye):ye=e[53];let Ae;e[54]!==D||e[55]!==j?(Ae=j.length>0&&s.jsx(Xt,{heading:"Your branches",children:j.map(oe=>s.jsxs(en,{value:oe.name,onSelect:()=>D(oe.name),children:[s.jsx(He,{className:"mr-2 h-4 w-4"}),s.jsx("span",{className:"flex-1 truncate",children:oe.name})]},oe.name))}),e[54]=D,e[55]=j,e[56]=Ae):Ae=e[56];let we;e[57]!==C||e[58]!==D?(we=C.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(po,{}),s.jsx(Xt,{heading:"Other branches in repo",children:C.map(oe=>s.jsxs(en,{value:oe.name,onSelect:()=>D(oe.name),children:[s.jsx(He,{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[57]=C,e[58]=D,e[59]=we):we=e[59];let je;e[60]!==_||e[61]!==T||e[62]!==E||e[63]!==v?(je=T&&s.jsx("div",{className:"border-t p-2",children:s.jsx(re,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",disabled:E,onClick:_,children:E||v?"Loading more…":"Load more branches"})}),e[60]=_,e[61]=T,e[62]=E,e[63]=v,e[64]=je):je=e[64];let Se;e[65]!==T||e[66]!==C.length?(Se=!T&&C.length>0&&s.jsx("div",{className:"border-t p-2 text-center text-xs text-muted-foreground",children:"All loaded"}),e[65]=T,e[66]=C.length,e[67]=Se):Se=e[67];let Ce;e[68]!==K||e[69]!==ve||e[70]!==ye||e[71]!==Ae||e[72]!==we||e[73]!==je||e[74]!==Se?(Ce=s.jsxs(go,{onScroll:K,children:[ve,ye,Ae,we,je,Se]}),e[68]=K,e[69]=ve,e[70]=ye,e[71]=Ae,e[72]=we,e[73]=je,e[74]=Se,e[75]=Ce):Ce=e[75];let Ne;e[76]!==le||e[77]!==Ce?(Ne=s.jsx(Kt,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:s.jsxs(bo,{children:[le,Ce]})}),e[76]=le,e[77]=Ce,e[78]=Ne):Ne=e[78];let qe;return e[79]!==p||e[80]!==ee||e[81]!==Ne||e[82]!==M?(qe=s.jsxs(Bt,{open:p,onOpenChange:M,children:[ee,Ne]}),e[79]=p,e[80]=ee,e[81]=Ne,e[82]=M,e[83]=qe):qe=e[83],qe}function Jl(t){const e=L.c(26);let n,r,o,a;e[0]!==t?({locked:n,placement:r,value:a,...o}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=o,e[4]=a):(n=e[1],r=e[2],o=e[3],a=e[4]);const l=r==="header";if(n){const i=a??"(no branch)",u=l?"h-8 border border-input bg-background px-2.5":"h-9 px-2";let V;e[5]!==u?(V=U("inline-flex items-center gap-1.5 rounded-md font-mono text-xs","text-muted-foreground cursor-default min-w-0 max-w-[200px]",u),e[5]=u,e[6]=V):V=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(He,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),e[7]=d):d=e[7];const m=l?"":"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 f;e[8]!==m?(f=U("min-w-0 truncate",m),e[8]=m,e[9]=f):f=e[9];let x;e[10]!==i||e[11]!==f?(x=s.jsx("span",{className:f,children:i}),e[10]=i,e[11]=f,e[12]=x):x=e[12];let h;e[13]!==V||e[14]!==x?(h=s.jsx(xe,{asChild:!0,children:s.jsxs("span",{"data-testid":"branch-picker-locked","aria-disabled":"true",className:V,children:[d,x]})}),e[13]=V,e[14]=x,e[15]=h):h=e[15];let p;e[16]!==i?(p=s.jsxs(ge,{children:["This chat is using branch ",i,". Start a new chat to use a different branch."]}),e[16]=i,e[17]=p):p=e[17];let g;return e[18]!==h||e[19]!==p?(g=s.jsxs(be,{children:[h,p]}),e[18]=h,e[19]=p,e[20]=g):g=e[20],g}let c;return e[21]!==n||e[22]!==r||e[23]!==o||e[24]!==a?(c=s.jsx(Wl,{...o,value:a,disabled:n,placement:r}),e[21]=n,e[22]=r,e[23]=o,e[24]=a,e[25]=c):c=e[25],c}function Zl(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 Xl(t){const e=L.c(22),{virtualMcp:n,currentBranch:r}=t,o=Ln(),a=at();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=ns(n),e[3]=n,e[4]=u):u=e[4];const V=u,d=V?.connectionId,{data:m}=Pn.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(Jl,{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,g=n?.id??"";let b;e[15]!==r||e[16]!==c||e[17]!==g?(b=s.jsx(Ol,{locked:c,currentBranch:r,virtualMcpId:g}),e[15]=r,e[16]=c,e[17]=g,e[18]=b):b=e[18];const y=b;let v;return e[19]!==p||e[20]!==y?(v=s.jsx(Zl,{branchPill:p,modePicker:y}),e[19]=p,e[20]=y,e[21]=v):v=e[21],v}const ei=["fast","smart","thinking"],Te={fast:"Fast",smart:"Smart",thinking:"Thinking"};function ti(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=Te[n];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=U("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=U("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=Te[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(mt,{size:12,className:"opacity-60 hidden @[320px]/chat-bottom:inline-block"}),e[9]=p):p=e[9];let g;e[10]!==V||e[11]!==m||e[12]!==h?(g=s.jsx(xe,{asChild:!0,children:s.jsx("span",{className:"inline-flex min-w-0 shrink",children:s.jsx(Ut,{asChild:!0,children:s.jsxs(re,{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]=g):g=e[13];const b=Te[n];let y;e[14]!==b?(y=s.jsx(ge,{children:b}),e[14]=b,e[15]=y):y=e[15];let v;e[16]!==y||e[17]!==g?(v=s.jsxs(be,{children:[g,y]}),e[16]=y,e[17]=g,e[18]=v):v=e[18];let w;e[19]!==u||e[20]!==o||e[21]!==r||e[22]!==n?(w=ei.map(j=>{const C=r(j),P=o?.(j),N=j===n;return s.jsxs("button",{type:"button",role:"menuitem","aria-label":Te[j],onClick:()=>u(j),className:U("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:Te[j]}),C&&s.jsx("div",{className:"text-xs text-muted-foreground",children:C})]}),N&&s.jsx(Ke,{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(Kt,{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]!==v||e[28]!==A?(k=s.jsxs(Bt,{open:l,onOpenChange:c,children:[v,A]}),e[26]=l,e[27]=v,e[28]=A,e[29]=k):k=e[29],k}function ni(t){return t==="fast"?s.jsx(Yr,{size:16}):t==="thinking"?s.jsx(Hr,{size:16}):s.jsx(Ao,{size:16})}function si(){const t=L.c(6),e=yl(),n=Al(),r=ws();let o;t[0]!==r?(o=c=>jl(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(ti,{tier:e,subtitleFor:a,iconFor:ni,onSelect:n}),t[2]=n,t[3]=a,t[4]=e,t[5]=l):l=t[5],l}async function Yt(t,e,n,r,o){if(!ht(e)){ae.error("Selected model does not support file uploads");return}const a=n.type||"application/octet-stream";if(!Vo(a,e)){const c=ts(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};hr(t,{from:r,to:r},V)}catch(c){console.error("Failed to process file:",c),ae.error(`Failed to load file "${n.name}"`)}}function ri(t){const e=L.c(8),{editor:n,selectedModel:r,onUnsupportedFile:o}=t,a=S.useRef(ai);let l,c;e[0]!==n||e[1]!==o||e[2]!==r?(l=()=>{a.current=async(V,d)=>{await Yt(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 Et("fileDropHandler");n.state.plugins.find(f=>f.spec.key===V)&&n.unregisterPlugin(V);const m=new wo({key:V,props:{handleDrop:(f,x,h,p)=>{if(p)return!1;const g=x.dataTransfer?.files;if(!g||g.length===0)return!1;x.preventDefault();const b=f.posAtCoords({left:x.clientX,top:x.clientY});if(!b)return!1;const y=Array.from(g),v=b.pos;for(const w of y)a.current?.(w,v);return!0},handlePaste:(f,x)=>{const h=x.clipboardData?.items;if(!h)return!1;const p=Array.from(h).filter(oi);if(p.length===0)return!1;x.preventDefault();const{from:g}=f.state.selection;for(const b of p){const y=b.getAsFile();y&&a.current?.(y,g)}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 oi(t){return t.kind==="file"}function ai(){return Promise.resolve()}function li(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(Tn,{size:18})}),u=s.jsx(it,{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(lt,{className:"relative gap-4",children:[i,s.jsxs("div",{children:[u,s.jsxs(Ot,{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(Gr,{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 g;e[13]!==f||e[14]!==p?(g=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]=g):g=e[15];let b;e[16]!==r?(b=s.jsx("div",{className:"px-8 py-4 border-t border-border bg-muted/30 flex items-center justify-end",children:s.jsx(re,{onClick:r,children:"Got it"})}),e[16]=r,e[17]=b):b=e[17];let y;e[18]!==g||e[19]!==b||e[20]!==d?(y=s.jsxs(ct,{className:"sm:max-w-[480px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:ii,children:[d,g,b]}),e[18]=g,e[19]=b,e[20]=d,e[21]=y):y=e[21];let v;return e[22]!==o||e[23]!==y||e[24]!==a?(v=s.jsx(dt,{open:o,onOpenChange:a,children:y}),e[22]=o,e[23]=y,e[24]=a,e[25]=v):v=e[25],v}function ii(t){return t.preventDefault()}function ci(){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 di=jo;var ui=["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] *)"],Rt=ui.join(","),js=typeof Element>"u",$e=js?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,nt=!js&&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},st=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]"):st(e.parentNode));return l},Vi=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},fi=function(e,n,r){if(st(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Rt));return n&&$e.call(e,Rt)&&o.unshift(e),o=o.filter(r),o},Tt=function(e,n,r){for(var o=[],a=Array.from(e);a.length;){var l=a.shift();if(!st(l,!1))if(l.tagName==="SLOT"){var c=l.assignedElements(),i=c.length?c:l.children,u=Tt(i,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:l,candidates:u})}else{var V=$e.call(l,Rt);V&&r.filter(l)&&(n||!e.includes(l))&&o.push(l);var d=l.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(l),m=!st(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(d&&m){var f=Tt(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},Ss=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Cs=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Vi(e))&&!Ss(e)?0:e.tabIndex},mi=function(e,n){var r=Cs(e);return r<0&&n&&!Ss(e)?0:r},pi=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},Ns=function(e){return e.tagName==="INPUT"},hi=function(e){return Ns(e)&&e.type==="hidden"},xi=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},gi=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},bi=function(e){if(!e.name)return!0;var n=e.form||nt(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=gi(o,e.form);return!a||a===e},vi=function(e){return Ns(e)&&e.type==="radio"},yi=function(e){return vi(e)&&!bi(e)},Ai=function(e){var n,r=e&&nt(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=nt(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},bn=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},wi=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=$e.call(e,"details>summary:first-of-type"),c=l?e.parentElement:e;if($e.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=nt(e);if(u&&!u.shadowRoot&&o(u)===!0)return bn(e);e.assignedSlot?e=e.assignedSlot:!u&&V!==e.ownerDocument?e=V.host:e=u}e=i}if(Ai(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return bn(e);return!1},ji=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 $e.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},Si=function(e,n){return!(n.disabled||hi(n)||wi(n,e)||xi(n)||ji(n))},vn=function(e,n){return!(yi(n)||Cs(n)<0||!Si(e,n))},Ci=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},ks=function(e){var n=[],r=[];return e.forEach(function(o,a){var l=!!o.scopeParent,c=l?o.scopeParent:o,i=mi(c,l),u=l?ks(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(pi).reduce(function(o,a){return a.isScope?o.push.apply(o,a.content):o.push(a.content),o},[]).concat(n)},_s=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Tt([e],n.includeContainer,{filter:vn.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Ci}):r=fi(e,n.includeContainer,vn.bind(null,n)),ks(r)};function Ni(){return/apple/i.test(navigator.vendor)}const yn="data-floating-ui-focusable";function ki(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 Pt(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Xs(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Pe(t){return"composedPath"in t?t.composedPath()[0]:t.target}function wt(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 _i(t){return t.matches("html,body")}function ze(t){return t?.ownerDocument||document}function Ii(t){return t?t.hasAttribute(yn)?t:t.querySelector("["+yn+"]")||t:null}function We(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,...We(t,o.id,n)])}function Ei(t){return"nativeEvent"in t}var Ri=typeof document<"u",Ti=function(){},pe=Ri?S.useLayoutEffect:Ti;const Pi={...Dn},Di=Pi.useInsertionEffect,Mi=Di||(t=>t());function _e(t){const e=S.useRef(()=>{});return Mi(()=>{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 Is=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Es(t,e){const n=_s(t,Is()),r=n.length;if(r===0)return;const o=ki(ze(t)),a=n.indexOf(o),l=a===-1?e===1?0:r-1:a+e;return n[l]}function Fi(t){return Es(ze(t).body,1)||t}function Oi(t){return Es(ze(t).body,-1)||t}function jt(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!Pt(n,r)}function Li(t){_s(t,Is()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function An(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 $i="data-floating-ui-focusable",wn="active",jn="selected",zi={...Dn};let Sn=!1,Bi=0;const Cn=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Bi++;function Ui(){const[t,e]=S.useState(()=>Sn?Cn():void 0);return pe(()=>{t==null&&e(Cn())},[]),S.useEffect(()=>{Sn=!0},[]),t}const Ki=zi.useId,Ht=Ki||Ui;function qi(){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 Qi=S.createContext(null),Yi=S.createContext(null),Rs=()=>{var t;return((t=S.useContext(Qi))==null?void 0:t.id)||null},Ts=()=>S.useContext(Yi);function Gt(t){return"data-floating-ui-"+t}const Hi={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},Nn=S.forwardRef(function(e,n){const[r,o]=S.useState();pe(()=>{Ni()&&o("button")},[]);const a={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Gt("focus-guard")]:"",style:Hi};return s.jsx("span",{...e,...a})}),Gi={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Ps=S.createContext(null),kn=Gt("portal");function Wi(t){t===void 0&&(t={});const{id:e,root:n}=t,r=Ht(),o=Zi(),[a,l]=S.useState(null),c=S.useRef(null);return pe(()=>()=>{a?.remove(),queueMicrotask(()=>{c.current=null})},[a]),pe(()=>{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(kn,""),i.appendChild(u),c.current=u,l(u)},[e,r]),pe(()=>{if(n===null||!r||c.current)return;let i=n||o?.portalNode;i&&!ar(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(kn,""),i=u||i,i.appendChild(V),c.current=V,l(V)},[e,n,r,o]),a}function Ji(t){const{children:e,id:n,root:r,preserveTabOrder:o=!0}=t,a=Wi({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&&jt(p)&&(p.type==="focusin"?An:Li)(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||An(a))},[f,a]),s.jsxs(Ps.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(Nn,{"data-type":"outside",ref:i,onFocus:h=>{if(jt(h,a)){var p;(p=V.current)==null||p.focus()}else{const g=l?l.domReference:null,b=Oi(g);b?.focus()}}}),x&&a&&s.jsx("span",{"aria-owns":a.id,style:Gi}),a&&tr.createPortal(e,a),x&&a&&s.jsx(Nn,{"data-type":"outside",ref:u,onFocus:h=>{if(jt(h,a)){var p;(p=d.current)==null||p.focus()}else{const g=l?l.domReference:null,b=Fi(g);b?.focus(),l?.closeOnFocusOut&&l?.onOpenChange(!1,h.nativeEvent,"focus-out")}}})]})}const Zi=()=>S.useContext(Ps),Xi={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},ec={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},_n=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 tc(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=Ts(),p=_e(typeof i=="function"?i:()=>!1),g=typeof i=="function"?p:i,b=S.useRef(!1),{escapeKey:y,outsidePress:v}=_n(f),{escapeKey:w,outsidePress:A}=_n(x),k=S.useRef(!1),j=_e(_=>{var R;if(!n||!l||!c||_.key!=="Escape"||k.current)return;const F=(R=a.current.floatingContext)==null?void 0:R.nodeId,D=h?We(h.nodesRef.current,F):[];if(!y&&(_.stopPropagation(),D.length>0)){let I=!0;if(D.forEach(O=>{var z;if((z=O.context)!=null&&z.open&&!O.context.dataRef.current.__escapeKeyBubbles){I=!1;return}}),!I)return}r(!1,Ei(_)?_.nativeEvent:_,"escape-key")}),C=_e(_=>{var R;const F=()=>{var D;j(_),(D=Pe(_))==null||D.removeEventListener("keydown",F)};(R=Pe(_))==null||R.addEventListener("keydown",F)}),P=_e(_=>{var R;const F=a.current.insideReactTree;a.current.insideReactTree=!1;const D=b.current;if(b.current=!1,u==="click"&&D||F||typeof g=="function"&&!g(_))return;const I=Pe(_),O="["+Gt("inert")+"]",z=ze(o.floating).querySelectorAll(O);let $=ce(I)?I:null;for(;$&&!vt($);){const Q=sr($);if(vt(Q)||!ce(Q))break;$=Q}if(z.length&&ce(I)&&!_i(I)&&!Pt(I,o.floating)&&Array.from(z).every(Q=>!Pt($,Q)))return;if(rr(I)&&E){const Q=vt(I),q=or(I),Y=/auto|scroll/,se=Q||Y.test(q.overflowX),Z=Q||Y.test(q.overflowY),X=se&&I.clientWidth>0&&I.scrollWidth>I.clientWidth,te=Z&&I.clientHeight>0&&I.scrollHeight>I.clientHeight,W=q.direction==="rtl",J=te&&(W?_.offsetX<=I.offsetWidth-I.clientWidth:_.offsetX>I.clientWidth),ee=X&&_.offsetY>I.clientHeight;if(J||ee)return}const K=(R=a.current.floatingContext)==null?void 0:R.nodeId,M=h&&We(h.nodesRef.current,K).some(Q=>{var q;return wt(_,(q=Q.context)==null?void 0:q.elements.floating)});if(wt(_,o.floating)||wt(_,o.domReference)||M)return;const B=h?We(h.nodesRef.current,K):[];if(B.length>0){let Q=!0;if(B.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=_e(_=>{var R;const F=()=>{var D;P(_),(D=Pe(_))==null||D.removeEventListener(u,F)};(R=Pe(_))==null||R.addEventListener(u,F)});S.useEffect(()=>{if(!n||!l)return;a.current.__escapeKeyBubbles=y,a.current.__outsidePressBubbles=v;let _=-1;function R(z){r(!1,z,"ancestor-scroll")}function F(){window.clearTimeout(_),k.current=!0}function D(){_=window.setTimeout(()=>{k.current=!1},nr()?5:0)}const I=ze(o.floating);c&&(I.addEventListener("keydown",w?C:j,w),I.addEventListener("compositionstart",F),I.addEventListener("compositionend",D)),g&&I.addEventListener(u,A?N:P,A);let O=[];return m&&(ce(o.domReference)&&(O=bt(o.domReference)),ce(o.floating)&&(O=O.concat(bt(o.floating))),!ce(o.reference)&&o.reference&&o.reference.contextElement&&(O=O.concat(bt(o.reference.contextElement)))),O=O.filter(z=>{var $;return z!==(($=I.defaultView)==null?void 0:$.visualViewport)}),O.forEach(z=>{z.addEventListener("scroll",R,{passive:!0})}),()=>{c&&(I.removeEventListener("keydown",w?C:j,w),I.removeEventListener("compositionstart",F),I.removeEventListener("compositionend",D)),g&&I.removeEventListener(u,A?N:P,A),O.forEach(z=>{z.removeEventListener("scroll",R)}),window.clearTimeout(_)}},[a,o,c,g,u,n,r,m,l,y,v,j,w,C,P,A,N]),S.useEffect(()=>{a.current.insideReactTree=!1},[a,g,u]);const T=S.useMemo(()=>({onKeyDown:j,...V&&{[Xi[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&&(b.current=!0)}return{onKeyDown:j,onMouseDown:_,onMouseUp:_,[ec[u]]:()=>{a.current.insideReactTree=!0}}},[j,u,a]);return S.useMemo(()=>l?{reference:T,floating:E}:{},[l,T,E])}function nc(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=Ht(),a=S.useRef({}),[l]=S.useState(()=>qi()),c=Rs()!=null,[i,u]=S.useState(r.reference),V=_e((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 sc(t){t===void 0&&(t={});const{nodeId:e}=t,n=nc({...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=Ts();pe(()=>{V&&(d.current=V)},[V]);const f=er({...t,elements:{...o,...c&&{reference:c}}}),x=S.useCallback(y=>{const v=ce(y)?{getBoundingClientRect:()=>y.getBoundingClientRect(),getClientRects:()=>y.getClientRects(),contextElement:y}:y;i(v),f.refs.setReference(v)},[f.refs]),h=S.useCallback(y=>{(ce(y)||y===null)&&(d.current=y,l(y)),(ce(f.refs.reference.current)||f.refs.reference.current===null||y!==null&&!ce(y))&&f.refs.setReference(y)},[f.refs]),p=S.useMemo(()=>({...f.refs,setReference:h,setPositionReference:x,domReference:d}),[f.refs,h,x]),g=S.useMemo(()=>({...f.elements,domReference:V}),[f.elements,V]),b=S.useMemo(()=>({...f,...r,refs:p,elements:g,nodeId:e}),[f,p,g,e,r]);return pe(()=>{r.dataRef.current.floatingContext=b;const y=m?.nodesRef.current.find(v=>v.id===e);y&&(y.context=b)}),S.useMemo(()=>({...f,context:b,refs:p,elements:g}),[f,p,g,b])}function St(t,e,n){const r=new Map,o=n==="item";let a=t;if(o&&t){const{[wn]:l,[jn]:c,...i}=t;a=i}return{...n==="floating"&&{tabIndex:-1,[$i]:""},...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&&[wn,jn].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 rc(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=>St(c,t,"reference"),e),a=S.useCallback(c=>St(c,t,"floating"),n),l=S.useCallback(c=>St(c,t,"item"),r);return S.useMemo(()=>({getReferenceProps:o,getFloatingProps:a,getItemProps:l}),[o,a,l])}const oc=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function ac(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=Ht(),V=((n=a.domReference)==null?void 0:n.id)||u,d=S.useMemo(()=>{var b;return((b=Ii(a.floating))==null?void 0:b.id)||l},[a.floating,l]),m=(r=oc.get(i))!=null?r:i,x=Rs()!=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 b={id:d,...m&&{role:m}};return m==="tooltip"||i==="label"?b:{...b,...m==="menu"&&{"aria-labelledby":V}}},[m,d,V,i]),g=S.useCallback(b=>{let{active:y,selected:v}=b;const w={role:"option",...y&&{id:d+"-fui-option"}};switch(i){case"select":case"combobox":return{...w,"aria-selected":v}}return{}},[d,i]);return S.useMemo(()=>c?{reference:h,floating:p,item:g}:{},[c,h,p,g])}function lc(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,g;e[3]!==o.length||e[4]!==c?(p=()=>{c>=o.length&&o.length>0&&i(0)},g=[o.length,c],e[3]=o.length,e[4]=c,e[5]=p,e[6]=g):(p=e[5],g=e[6]),S.useEffect(p,g);let b,y;e[7]!==o?(b=()=>{u.current=o},y=[o],e[7]=o,e[8]=b,e[9]=y):(b=e[8],y=e[9]),S.useEffect(b,y);let v,w;e[10]!==c?(v=()=>{V.current=c},w=[c],e[10]=c,e[11]=v,e[12]=w):(v=e[11],w=e[12]),S.useEffect(v,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 O=()=>i($=>($+1)%I.length),z=()=>i($=>($-1+I.length)%I.length);switch(D.key){case"ArrowUp":return D.preventDefault(),z(),!0;case"ArrowDown":return D.preventDefault(),O(),!0;case"Tab":return D.preventDefault(),D.shiftKey?z():O(),!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 $=V.current;return $!==-1&&I[$]&&d.current?.(I[$],$),!0}case"Escape":return D.preventDefault(),m.current?.(),!0;default:return!1}},F=D=>{R(D)};return _.addEventListener("keydown",F,!0),()=>{_?.removeEventListener("keydown",F,!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 ic(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 Ds=S.createContext(void 0);function Ms(){const t=S.useContext(Ds);if(!t)throw new Error("useSuggestionContext must be used within a SuggestionContext.Provider");return t}function cc({editor:t,char:e,pluginKey:n,allow:r,onOpenChange:o}){const[a,l]=S.useReducer(ic,{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 Et?n:new Et(n);t.state.plugins.find(d=>d.spec.key===i)&&t.unregisterPlugin(i);const V=_o({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 dc({editor:t,queryKey:e,queryFn:n,onSelect:r}){const{state:o,dispatch:a}=Ms(),l=S.useDeferredValue(o.query),{data:c}=lr({queryKey:Ee.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}=lc({editor:t,query:l,items:c,onSelect:u,onClose:i});return{selectedItem:o.selectedItem,items:c,selectedIndex:V,close:i,onSelect:u}}function uc({children:t}){const{state:e,dispatch:n}=Ms(),{open:r,element:o}=e,a=()=>{n({type:"ON_EXIT"})},{refs:l,floatingStyles:c,context:i}=sc({placement:"bottom-start",open:r,onOpenChange:m=>{m||a()},elements:{reference:o},middleware:[ir(10),cr(),dr()],whileElementsMounted:ur}),u=tc(i,{outsidePress:m=>!(m.target instanceof Element&&m.target.closest(".ProseMirror"))}),V=ac(i,{role:"listbox"}),{getFloatingProps:d}=rc([u,V]);return r?s.jsx(Ji,{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 Vc=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=ue(n._meta);c=n.title||Ft(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=U("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(Kn,{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(Ct,{size:"xs"}),e[10]=a,e[11]=p):p=e[11];let g;e[12]!==h||e[13]!==p?(g=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h,p]}),e[12]=h,e[13]=p,e[14]=g):g=e[14];let b;e[15]!==u?(b=u&&s.jsx("div",{className:"text-xs text-muted-foreground line-clamp-1",children:u}),e[15]=u,e[16]=b):b=e[16];let y;e[17]!==g||e[18]!==b?(y=s.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[g,b]}),e[17]=g,e[18]=b,e[19]=y):y=e[19];let v;e[20]!==n.drillable?(v=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]=v):v=e[21];let w;return e[22]!==o||e[23]!==l||e[24]!==y||e[25]!==v||e[26]!==f||e[27]!==x?(w=s.jsxs("div",{ref:l,onClick:o,className:f,children:[x,y,v]}),e[22]=o,e[23]=l,e[24]=y,e[25]=v,e[26]=f,e[27]=x,e[28]=w):w=e[28],w},fc=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}=dc(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(Vc,{item:h,isSelected:p===i,ref:p===i?hc: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 mc(){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(pc)}),t[0]=e):e=t[0],e}function pc(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 Fs(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}=cc(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(mc,{}),e[9]=x):x=e[9];let h;e[10]!==n||e[11]!==c||e[12]!==l||e[13]!==a?(h=s.jsx(uc,{children:s.jsx(S.Suspense,{fallback:x,children:s.jsx(fc,{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(Ds.Provider,{value:f,children:h}),e[15]=f,e[16]=h,e[17]=p):p=e[17],p}function hc(t){t&&t.scrollIntoView({block:"center",behavior:"smooth"})}const xc=[{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}],gc=({editor:t,virtualMcpId:e})=>{const n=Be(),{org:r}=ie(),o=Ur(),a=de({connectionId:e,orgId:r.id,orgSlug:r.slug}),l=Ee.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:g})=>{if(G("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){Le(t,g,{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 b=await Mn(a,p.uri);Le(t,g,{id:p.uri,name:p.uri,metadata:b.contents,char:"@"})}catch(b){console.error("[at-mention] Failed to fetch resource:",b),ae.error("Failed to load resource. Please try again.")}i("categories");return}},x=async p=>{const{query:g}=p,b=u.current;if(b==="categories"){if(!g.trim())return xc;const w=g.toLowerCase(),A=o.filter(j=>j.status==="active"&&(!j.id||!Zt(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:()=>Oe(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(b==="agents"){let w=o.filter(A=>A.status==="active"&&(!A.id||!Zt(A.id))&&A.id!==e);if(g.trim()){const A=g.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 y=n.getQueryData(l);y?n.fetchQuery({queryKey:l,queryFn:()=>Oe(a),staleTime:6e4}).catch(()=>{}):y=await n.fetchQuery({queryKey:l,queryFn:()=>Oe(a),staleTime:6e4});let v=y?.resources??[];if(g.trim()){const w=g.toLowerCase();v=v.filter(A=>A.uri.toLowerCase().includes(w)||A.name?.toLowerCase().includes(w)||A.description?.toLowerCase().includes(w))}return v.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,G("chat_picker_opened",{picker:"@"});else{const g=V.current;G("chat_picker_closed",{picker:"@",outcome:d.current?"selected":"dismissed",duration_ms:g?Date.now()-g:null}),V.current=null,i("categories")}};return s.jsx(Fs,{editor:t,char:"@",pluginKey:"atDropdownMenu",queryKey:m,queryFn:x,onSelect:f,onOpenChange:h})};async function In(t,e,n,r,o,a){try{const l=await ft(n,r,a);Le(t,e,{id:r,name:ot(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 bc(t,e,n,r){try{const o=await Mn(n,r);Le(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 vc=({editor:t,virtualMcpId:e})=>{const n=Be(),{org:r}=ie(),o=de({connectionId:e,orgId:r.id,orgSlug:r.slug}),a=Ee.virtualMcpPrompts(e,r.id),l=Ee.virtualMcpResources(e,r.id),c=["slash-mention",r.id,e??"default"],[i,u]=S.useState(null),[V,d]=S.useState(null),m=xr(t);m&&(m.onEditChip=async v=>{if(o)try{const A=(await En(n,a,o)).find(k=>k.name===v.promptId);if(!A?.arguments||A.arguments.length===0)return;d({...v,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:v,range:w})=>{if(G("chat_picker_item_selected",{picker:"/",item_kind:v.kind,item_name:v.name}),x.current=!0,!!o)if(v.kind==="prompt"){if(v.arguments&&v.arguments.length>0){u({range:w,item:v});return}const A=ue(v._meta);await In(t,w,o,v.name,A)}else v.uri&&await bc(t,w,o,v.uri)},p=async v=>{if(!i||!o)return;const{range:w,item:A}=i,k=ue(A._meta);await In(t,w,o,A.name,k,v),u(null)},g=async v=>{if(!(!V||!o)){try{const w=await ft(o,V.promptId,v),A=ue(V.prompt._meta);t.chain().focus().setNodeSelection(V.pos).deleteSelection().insertContentAt(V.pos,On({id:V.promptId,name:ot(V.promptId,A),metadata:w.messages,char:"/",kind:"prompt",args:v})).run(),G("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)}},b=async v=>{const{query:w}=v;if(!o)return[];const[A,k]=await Promise.all([En(n,a,o),yc(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]},y=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(Fs,{editor:t,char:"/",pluginKey:"slashDropdownMenu",queryKey:c,queryFn:b,onSelect:h,onOpenChange:v=>{if(v)f.current=Date.now(),x.current=!1,G("chat_picker_opened",{picker:"/"});else{const w=f.current;G("chat_picker_closed",{picker:"/",outcome:x.current?"selected":"dismissed",duration_ms:w?Date.now()-w:null}),f.current=null}}}),s.jsx(Je,{prompt:y,setPrompt:()=>u(null),onSubmit:p}),s.jsx(Je,{prompt:V?.prompt??null,setPrompt:()=>d(null),onSubmit:g,defaultValues:V?.args},V?`edit-${V.promptId}-${V.pos}`:"edit-idle")]})};async function En(t,e,n){let r=t.getQueryData(e);return r?t.fetchQuery({queryKey:e,queryFn:()=>kt(n),staleTime:6e4}).catch(()=>{}):r=await t.fetchQuery({queryKey:e,queryFn:()=>kt(n),staleTime:6e4}),r?.prompts??[]}async function yc(t,e,n){let r=t.getQueryData(e);return r?t.fetchQuery({queryKey:e,queryFn:()=>Oe(n),staleTime:6e4}).catch(()=>{}):r=await t.fetchQuery({queryKey:e,queryFn:()=>Oe(n),staleTime:6e4}),r?.resources??[]}function Ac(t){return[No.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,dropcursor:!1}),di.configure({placeholder:()=>t.current??"Ask anything, / for prompts, @ for agents & resources...",showOnlyWhenEditable:!1}),gr,br]}function wc({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=So({extensions:Ac(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(Co.Provider,{value:{editor:d},children:l})}function jc(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}=qt();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=U("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 g;e[7]!==d||e[8]!==p?(g=s.jsx(ko,{editor:d,className:p}),e[7]=d,e[8]=p,e[9]=g):g=e[9];const b=r??null;let y;e[10]!==d||e[11]!==b?(y=s.jsx(S.Suspense,{fallback:null,children:s.jsx(vc,{editor:d,virtualMcpId:b})}),e[10]=d,e[11]=b,e[12]=y):y=e[12];const v=r??null;let w;e[13]!==d||e[14]!==v?(w=s.jsx(S.Suspense,{fallback:null,children:s.jsx(gc,{editor:d,virtualMcpId:v})}),e[13]=d,e[14]=v,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(ri,{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]!==y||e[22]!==w||e[23]!==A||e[24]!==g?(k=s.jsxs(s.Fragment,{children:[g,y,w,A]}),e[21]=y,e[22]=w,e[23]=A,e[24]=g,e[25]=k):k=e[25],k}function Os(t){const e=L.c(3),[n]=Re();let r;return e[0]!==n.enableSounds||e[1]!==t?(r=()=>{n.enableSounds&&Do(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 Sc={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"},Cc=zr.togglePlanMode.keys.map(t=>t==="Shift"?"⇧":t).join(""),Nc=[{src:"/connections/gmail.png",name:"Gmail"},{src:"/connections/perplexity.png",name:"Perplexity"},{src:"/connections/github.png",name:"GitHub"}];function kc(){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:Nc.map(_c)}),t[0]=e):e=t[0],e}function _c(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 Ic({disabled:t,onOpenConnections:e,virtualMcpId:n,selectedModel:r,isStreaming:o,onUnsupportedFile:a}){const[l,c]=S.useState(!1),i=Os(Sc),{org:u}=ie(),{editor:V}=qt(),d=S.useRef(null),m=ht(r),f=()=>{!m||o||(c(!1),d.current?.click())},x=async M=>{const B=M.target.files;if(!B||B.length===0||!V)return;const Q=Array.from(B),{from:q}=V.state.selection;try{for(const Y of Q)await Yt(V,r??null,Y,q,a)}finally{d.current&&(d.current.value="")}},h=de({connectionId:n,orgId:u.id,orgSlug:u.slug}),p=Ee.virtualMcpPrompts(n,u.id),{data:g,isLoading:b}=Rn({queryKey:p,queryFn:()=>kt(h),staleTime:6e4,enabled:l&&!!h}),y=g?.prompts??[],[v,w]=S.useState(null),{chatMode:A,setChatMode:k}=fe(),[j,C]=Re(),N=(De.find(M=>M.value===j.toolApprovalLevel)??De[0]).short,T=M=>{const B=De.find(Q=>Q.value===M);if(B){if(B.value===j.toolApprovalLevel){c(!1);return}i(),G("chat_approval_level_changed",{from_level:j.toolApprovalLevel,to_level:B.value,source:"tools_popover"}),C({...j,toolApprovalLevel:B.value}),c(!1)}},E=A==="plan",_=()=>{i();const M=E?"default":"plan";G("chat_mode_changed",{from_mode:A,to_mode:M,source:"tools_popover"}),k(M),c(!1)},R=()=>{e(),c(!1)},F=async(M,B)=>{if(!V||!h)return;const Q=ue(M._meta),q={from:V.state.selection.from,to:V.state.selection.to};try{const Y=await ft(h,M.name,B);Le(V,q,{id:M.name,name:ot(M.name,Q),metadata:Y.messages,char:"/",kind:"prompt",args:B})}catch{ae.error("Failed to load prompt. Please try again.")}},D=async M=>{c(!1);const B=!!(M.arguments&&M.arguments.length>0);if(G("chat_prompt_inserted",{prompt_name:M.name,with_arguments:B}),B){w(M);return}await F(M)},I=async M=>{v&&(await F(v,M),w(null))},O=()=>{i();const M=A==="gen-image"?"default":"gen-image";G("chat_mode_changed",{from_mode:A,to_mode:M,source:"tools_popover"}),k(M),c(!1)},z=()=>{i();const M=A==="web-search"?"default":"web-search";G("chat_mode_changed",{from_mode:A,to_mode:M,source:"tools_popover"}),k(M),c(!1)},$=A==="gen-image",K=A==="web-search";return s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:d,type:"file",multiple:!0,accept:fo(r??null),className:"hidden",onChange:x,disabled:o}),s.jsxs(Io,{open:l,onOpenChange:M=>{M&&!l&&G("chat_tools_popover_opened",{chat_mode:A}),c(M)},children:[s.jsx(Eo,{asChild:!0,children:s.jsxs(re,{type:"button",variant:"ghost",size:"default",disabled:t,title:"Tools","aria-label":"Tools",className:U("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(Wr,{size:14}),s.jsx("span",{className:U("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(Ro,{align:"start",className:"w-52 p-1.5 space-y-1",children:[m?s.jsxs(me,{onClick:f,disabled:o,children:[s.jsx(rn,{size:16}),s.jsx("span",{className:"flex-1",children:"Add file"})]}):s.jsxs(be,{children:[s.jsx(xe,{asChild:!0,children:s.jsxs(me,{"aria-disabled":"true",className:"opacity-50 cursor-not-allowed",onSelect:M=>M.preventDefault(),children:[s.jsx(rn,{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(me,{onClick:_,className:U(E&&"text-violet-600 dark:text-violet-400"),children:[s.jsx($n,{size:16,className:U(E&&"text-violet-500")}),s.jsx("span",{className:"flex-1",children:"Plan mode"}),s.jsx("span",{className:U("text-xs text-muted-foreground",E&&"text-violet-500 font-medium"),children:Cc})]}),s.jsxs(me,{onClick:O,className:U($&&"text-pink-600 dark:text-pink-400"),children:[s.jsx(Bn,{size:16,className:U($&&"text-pink-500")}),s.jsx("span",{className:"flex-1",children:"Create image"}),$&&s.jsx("span",{className:"text-xs text-pink-500 font-medium",children:"On"})]}),s.jsxs(me,{onClick:z,className:U(K&&"text-blue-600 dark:text-blue-400"),children:[s.jsx(zn,{size:16,className:U(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(tn,{children:[s.jsxs(nn,{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(sn,{className:"w-80 max-h-72 overflow-y-auto p-1.5",children:b?s.jsxs("div",{className:"flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground",children:[s.jsx(Vr,{size:14,className:"animate-spin"}),"Loading prompts…"]}):y.length===0?s.jsx("div",{className:"px-2 py-3 text-sm text-muted-foreground",children:"No prompts available"}):y.map(M=>s.jsxs(me,{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||Ft(M.name,ue(M._meta))}),M.description&&s.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:M.description})]},M.name))})]}),s.jsxs(tn,{children:[s.jsxs(nn,{className:"gap-2",children:[s.jsx(pt,{size:16}),s.jsx("span",{className:"flex-1",children:"Approval"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:N})]}),s.jsx(sn,{className:"w-48 p-1.5",children:s.jsx(To,{value:j.toolApprovalLevel,onValueChange:T,children:De.map(M=>s.jsx(Po,{value:M.value,children:M.label},M.value))})})]}),s.jsxs(me,{onClick:R,children:[s.jsx(lo,{size:16}),s.jsx("span",{className:"flex-1",children:"Connections"}),s.jsx(S.Suspense,{children:s.jsx(kc,{})})]})]})]}),s.jsx(Je,{prompt:v,setPrompt:w,onSubmit:I})]})}const Ec=[{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 Rc(){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:Ec.map(Tc)}),t[0]=e):e=t[0],e}function Tc(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 Pc(t){const e=L.c(6),{onClick:n}=t;let r,o,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=U("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(Rc,{}),l=s.jsx(Fo,{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 Fe=48;function Dc(){const t=L.c(9),[e,n]=S.useState("idle"),[r,o]=S.useState(""),[a,l]=S.useState(""),[c,i]=S.useState(Oc),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(""),g=typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition);let b;t[0]===Symbol.for("react.memo_cache_sentinel")?(b=()=>{f.current&&(cancelAnimationFrame(f.current),f.current=0),V.current?.close().catch(Fc),m.current?.getTracks().forEach(Mc),d.current=null,V.current=null,m.current=null},t[0]=b):b=t[0];const y=b;let v;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 F=new Uint8Array(R.frequencyBinCount),D=()=>{if(!d.current)return;d.current.getByteFrequencyData(F);const I=[];for(let O=0;O<Fe;O++){const z=Math.floor(O/Fe*F.length);I.push(Math.max(.04,(F[z]??0)/255))}i(I),f.current=requestAnimationFrame(D)};D()};v=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 F="",D="";for(let I=R.resultIndex;I<R.results.length;I++){const O=R.results[I],z=O?.[0]?.transcript??"";O?.isFinal?D=D+z:F=F+z}D&&(h.current=h.current+D,o(h.current)),p.current=F,l(F)},_.onend=()=>{if(x.current)try{_.start()}catch{}};try{_.start()}catch{n("idle")}},t[1]=v}else v=t[1];const w=v;let A;t[2]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{x.current=!1,u.current?.stop(),y(),n("idle"),i(Array(Fe).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(),y(),n("idle"),o(""),l(""),i(Array(Fe).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:g,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 Mc(t){return t.stop()}function Fc(){}function Oc(){return Array(Fe).fill(.05)}function Lc(t){const e=L.c(4),{data:n}=t;let r;e[0]!==n?(r=n.map($c),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 $c(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 zc({messageCount:t,showConnectionsBanner:e}){return t>0||e}function Bc(t,e){const n=L.c(5),{editor:r}=qt(),[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=Uc,m=f=>{if(f.preventDefault(),l.current=0,a(!1),!r||!t||!ht(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))Yt(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 Uc(t){t.dataTransfer?.types.includes("Files")&&t.preventDefault()}function Kc(t){const e=L.c(11),{selectedModel:n,onUnsupportedFile:r}=t,o=Bc(n,r);let a;e[0]!==n?(a=ht(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=U("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(Xr,{size:24}),s.jsxs("span",{className:"text-sm font-medium",children:["Drop ",ts(n)," here"]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Fn,{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 qc(){const t=L.c(6),e=rt(),{org:n,locator:r}=ie(),{create:o}=Or();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??ut(n.id).id;Lr(sessionStorage,r,u,{tiptapDoc:c});try{await o({id:u,virtual_mcp_id:V})}catch{}const d={virtualmcpid:V,autosend:$r};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 Qc({onOpenContextPanel:t,showConnectionsBanner:e=!1}){const n=Ln(),r=at(),o=n?.messages??[],a=n?.isStreaming??!1,l=n?.isRunInProgress??!1,c=n?.stop??(()=>{}),i=r?.taskId??"",u=i||la,V=qc(),{selectedModel:d,selectedVirtualMcp:m,isModelsLoading:f,tiptapDocRef:x,imageModel:h,deepResearchModel:p,chatMode:g,setChatMode:b}=fe(),{data:y}=Pn.useSession(),v=y?.user?.id,{org:w,locator:A}=ie(),k=ut(w.id).id,j=Kr(m?.id??k),C=Os(Mo),[P,N]=S.useState(!1),{unsupportedFile:T,onUnsupportedFile:E,clearUnsupportedFile:_}=ci(),R=Dc(),F=S.useRef(void 0),D=async()=>{F.current=$,await R.startRecording();const H=R.status==="recording"?"started":R.status==="unsupported"?"unsupported":R.status==="permission-denied"?"permission_denied":"unknown";G("chat_voice_started",{thread_id:i,outcome:H})},I=()=>{G("chat_voice_confirmed",{thread_id:i});const H=R.stopRecording();Y.current?.syncVoiceText(F.current,H),Y.current?.focus()},O=()=>{G("chat_voice_cancelled",{thread_id:i}),R.cancelRecording(),Y.current?.restoreContent(F.current)};S.useEffect(()=>{if(R.status!=="recording")return;const H=(R.transcript+(R.interimTranscript?" "+R.interimTranscript:"")).trim();Y.current?.syncVoiceText(F.current,H)},[R.transcript,R.interimTranscript,R.status]);const z=r?.activeTask??null,[$,K]=S.useState(()=>ln(sessionStorage,A,u)??void 0),M=H=>{K(H),x.current=H,ca(sessionStorage,A,u,H,{onQuotaExceeded:({docSizeBytes:le})=>{G("chat_draft_quota_exceeded",{thread_id:i||null,doc_size_bytes:le}),console.warn("[chat-draft] sessionStorage quota exceeded; draft not saved")}})},B=S.useRef(i);if(B.current!==i){B.current=i;const H=ln(sessionStorage,A,u)??void 0;K(H),x.current=H}const q=[...o].reverse().find(H=>H.role==="assistant")?.metadata?.modelLimits?.contextWindow??d?.limits?.contextWindow,Y=S.useRef(null),se=g==="plan";S.useEffect(()=>{const H=le=>{Br(le)&&le.code==="KeyL"&&(le.preventDefault(),le.shiftKey&&b(g==="plan"?"default":"plan"),Y.current?.focus())};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[g,b]);const Z=vr(o),te=[...o].reverse().find(H=>H.role==="assistant"&&H.metadata?.usage)?.metadata?.usage?.contextTokens??0,W=!a&&!f&&!ds($),J=a||l,ee=zc({messageCount:o.length,showConnectionsBanner:e}),ne=H=>{H?.preventDefault(),a?(G("chat_message_stopped",{thread_id:i}),c()):l?(G("chat_message_stopped",{thread_id:i}),c()):W&&$&&(G("chat_message_sent",{thread_id:i||null,mode:g,model_id:d?.modelId??null,model_provider:d?.providerId??null,virtual_mcp_id:m?.id??null,submission:H?"button_or_enter":"programmatic"}),n?n.sendMessage($):V({tiptapDoc:$,virtualMcp:m}),da(sessionStorage,A,u),M(void 0))};return v&&z?.created_by&&z.created_by!==v?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(Fn,{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(xt,{}),s.jsx(wc,{tiptapDoc:$,setTiptapDoc:M,disabled:a,enterToSubmit:!0,onSubmit:ne,children:s.jsxs("form",{onSubmit:ne,className:U("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(Kc,{selectedModel:d,onUnsupportedFile:E}),s.jsx("div",{className:"group/input relative flex flex-col gap-2 flex-1",children:s.jsx(jc,{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(Lc,{data:R.waveformData.slice(0,28)}),s.jsx("button",{type:"button",onClick:O,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(Me,{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(Ke,{size:16})})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(Ic,{disabled:a,onOpenConnections:()=>{G("connections_dialog_opened",{source:"tools_popover",mode:"add"}),N(!0)},virtualMcpId:m?.id??k,selectedModel:d,isStreaming:a,onUnsupportedFile:E}),se&&s.jsxs("button",{type:"button",onClick:()=>{C(),G("chat_mode_changed",{from_mode:"plan",to_mode:"default",source:"pill_dismiss"}),b("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($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-32 @[320px]/chat-bottom:opacity-100",children:"Plan mode"}),s.jsx(Me,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),g==="gen-image"&&h&&s.jsxs("button",{type:"button",disabled:a,onClick:()=>{C(),G("chat_mode_changed",{from_mode:"gen-image",to_mode:"default",source:"pill_dismiss"}),b("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(Bn,{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(Me,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),g==="web-search"&&p&&s.jsxs("button",{type:"button",disabled:a,onClick:()=>{C(),G("chat_mode_changed",{from_mode:"web-search",to_mode:"default",source:"pill_dismiss"}),b("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(zn,{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(Me,{size:14,className:"shrink-0 hidden group-hover:block group-disabled:hidden"})]}),q&&te>0&&s.jsx(yr,{usage:Z,totalTokens:te,contextWindow:q,onOpenContextPanel:t})]}),s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[ee&&s.jsx(Xl,{virtualMcp:j,currentBranch:r?.currentBranch??null}),s.jsx(si,{}),R.isSupported&&s.jsx(re,{type:"button",onClick:D,disabled:a||l,variant:"ghost",size:"icon",className:U("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(Jr,{size:18})}),s.jsx(re,{type:J?"button":"submit",onClick:H=>{J&&(H.preventDefault(),H.stopPropagation(),c())},variant:W||J?"default":"ghost",size:"icon",disabled:!W&&!J,className:U("size-8 rounded-lg transition-all",!W&&!J&&"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:J?s.jsx(Zr,{size:20}):s.jsx(qr,{size:20})})]})]})})]})},i),e&&s.jsx(Pc,{onClick:()=>{G("connections_banner_clicked",{source:"home_chat_input"}),G("connections_dialog_opened",{source:"home_banner",mode:"add"}),N(!0)}})]})}),s.jsx(yo,{mode:"browse",open:P,onOpenChange:N,defaultTab:"all"}),s.jsx(li,{info:T,onClose:_})]})}const Yc={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 Ls(t){return`deco-credits-empty-dismissed:${t}`}function Xd(t){try{return localStorage.getItem(Ls(t))==="1"}catch{return!1}}function Hc(){const t=L.c(50),{org:e}=ie(),n=rt(),{decoKeyId:r}=vs();let o;t[0]!==e.id||t[1]!==e.slug?(o={connectionId:Vt,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=()=>{G("credits_empty_state_dismissed",{organization_id:e.id}),c(!1);try{localStorage.setItem(Ls(e.id),"1")}catch{}},t[3]=e.id,t[4]=h):h=t[4];const p=h;let g,b;t[5]!==l||t[6]!==e.id?(g=()=>{l&&G("credits_empty_state_shown",{organization_id:e.id})},b=[l,e.id],t[5]=l,t[6]=e.id,t[7]=g,t[8]=b):(g=t[7],b=t[8]),S.useEffect(g,b);let y;t[9]!==a||t[10]!==m?(y=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]=y):y=t[11];let v;t[12]!==p?(v=K=>{K&&window.open(K,"_blank","noopener,noreferrer"),p()},t[12]=p,t[13]=v):v=t[13];let w;t[14]!==y||t[15]!==v?(w={mutationFn:y,onSuccess:v,onError:Wc},t[14]=y,t[15]=v,t[16]=w):w=t[16];const{mutate:A,isPending:k}=Mt(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(qn,{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(lt,{className:"relative gap-3",children:[T,s.jsxs("div",{className:"text-center",children:[s.jsx(it,{className:"text-lg font-semibold",children:"This workspace has no credits"}),s.jsx(Ot,{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(Gn,{type:"single",variant:"outline",size:"sm",value:m,onValueChange:K=>{K&&f(K)},children:[s.jsx(Ze,{value:"usd",className:"h-8 px-3 text-xs",children:"USD"}),s.jsx(Ze,{value:"brl",className:"h-8 px-3 text-xs",children:"BRL"})]})}),s.jsx("div",{className:"grid grid-cols-3 gap-2.5",children:Yc[m].map(K=>{const{dollars:M,label:B}=K;return s.jsxs("button",{type:"button",disabled:k,onClick:()=>{G("credits_topup_clicked",{amount_cents:M*100,currency:m,tier_label:B,source:"empty_state"}),A(M*100)},className:U("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:B})]},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(Wn,{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(re,{className:"h-10",disabled:!C||k,onClick:()=>{G("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 F;t[36]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(Hn,{size:12,className:"transition-transform duration-150 group-hover:translate-x-0.5"}),t[36]=F):F=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",F]}),t[37]=R,t[38]=D):D=t[38];let I;t[39]!==p?(I=s.jsx(re,{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 O;t[41]!==D||t[42]!==I?(O=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]=O):O=t[43];let z;t[44]!==_||t[45]!==O?(z=s.jsxs(ct,{className:"sm:max-w-[500px] gap-0 p-0 overflow-hidden",onOpenAutoFocus:Gc,children:[E,_,O]}),t[44]=_,t[45]=O,t[46]=z):z=t[46];let $;return t[47]!==z||t[48]!==P?($=s.jsx(dt,{open:!0,onOpenChange:P,children:z}),t[47]=z,t[48]=P,t[49]=$):$=t[49],$}function Gc(t){return t.preventDefault()}function Wc(t){ae.error(`Top-up failed: ${t.message}`)}function Jc(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=U("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(qn,{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 Zc(){const t=L.c(8),{org:e}=ie(),n=rt();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=U("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(Qn,{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 Xc(t){const e=L.c(11),{className:n}=t;let r;e[0]!==n?(r=U("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(Ye,{align:"right",width:"w-3/4"}),s.jsx(Ye,{align:"left",width:"w-full",lines:3}),s.jsx(Ye,{align:"right",width:"w-2/3"}),s.jsx(Ye,{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 Ye(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=U("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=U("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=U("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((y,v)=>s.jsx("div",{className:U("h-3 rounded bg-muted-foreground/20 animate-pulse",v===l-1?"w-3/4":"w-full"),style:{animationDelay:`${v*.1}s`}},v))}),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 g;e[16]!==p||e[17]!==V?(g=s.jsxs("div",{className:V,children:[d,p]}),e[16]=p,e[17]=V,e[18]=g):g=e[18];let b;return e[19]!==g||e[20]!==i?(b=s.jsx("div",{className:i,children:g}),e[19]=g,e[20]=i,e[21]=b):b=e[21],b}function ed(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 td(t){const e=L.c(5),{className:n,children:r}=t;let o;e[0]!==n?(o=U("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 nd(t){const e=L.c(5),{children:n,className:r}=t;let o;e[0]!==r?(o=U("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 sd(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 rd(){const t=L.c(36),{messages:e,status:n,hasMoreOlder:r,isFetchingOlder:o,fetchOlderMessages:a,isStreaming:l}=Ue(),c=Ar(e),i=c.at(-1),V=aa()*Ho+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],ed(f);const x=i?.assistant?.parts,h=x?.length,p=x?.at(-1);let g;t[4]!==h||t[5]!==p?(g=[h,p],t[4]=h,t[5]=p,t[6]=g):g=t[6];let b;t[7]!==l||t[8]!==g?(b={containerRef:d,enabled:l,contentDeps:g},t[7]=l,t[8]=g,t[9]=b):b=t[9];const{sentinelRef:y}=wr(b);let v;t[10]!==V?(v={paddingBottom:V},t[10]=V,t[11]=v):v=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(Jt,{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(Jt,{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]!==v||t[29]!==j?(P=s.jsxs("div",{style:v,children:[j,C]}),t[27]=C,t[28]=v,t[29]=j,t[30]=P):P=t[30];let N;t[31]!==y?(N=s.jsx("div",{ref:y,"aria-hidden":!0,className:"h-0"}),t[31]=y,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 od(t){const e=L.c(5),{children:n,className:r}=t;let o;e[0]!==r?(o=U("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 eu=Object.assign(td,{Main:nd,Messages:rd,EmptyState:sd,Footer:od,Input:Qc,Provider:kr,ActiveTaskProvider:Nr,Skeleton:Xc,IceBreakers:Yo,NoAiProviderEmptyState:mo,CreditsEmptyState:Hc,CreditsEyebrow:Jc,NoCreditsEyebrow:Zc,CreditsExhaustedBanner:ys});function tu(t){if(typeof t!="object"||t===null)return!1;const n=t.githubRepo?.url;return typeof n=="string"&&n.length>0}function nu(t){return!!ns(t??null)?.connectionId}function su(t){return t.online?t.capabilities.includes("claude-code")||t.capabilities.includes("codex"):!1}export{eu as C,wc as T,Xl as a,tu as b,nu as c,Vl as d,jc as e,Zd as f,Ll as g,su as h,di as i,ul as s,vs as u,Xd as w};
|