decocms 3.9.0 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-dzvWxujb.js → AlertCircle-BQdZzjHT.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-CBMu0EOf.js → ArrowUpRight-CeE0rmVq.js} +1 -1
- package/dist/client/assets/{Check-BTi6aK2O.js → Check-BC0oyj5b.js} +1 -1
- package/dist/client/assets/{CheckCircle-C24wnP2Z.js → CheckCircle-DH7rdvLk.js} +1 -1
- package/dist/client/assets/{ChevronDown-BZRrL23D.js → ChevronDown-R842NQ1U.js} +1 -1
- package/dist/client/assets/{ChevronLeft-DEtz4dkO.js → ChevronLeft-4yzLonaZ.js} +1 -1
- package/dist/client/assets/{ChevronRight-Ddjtetki.js → ChevronRight-ZAMgnesO.js} +1 -1
- package/dist/client/assets/{ChevronUp-DhRFiyWk.js → ChevronUp-BF-b-Nnx.js} +1 -1
- package/dist/client/assets/{Container-DqZ7iXxp.js → Container-DYeY832q.js} +1 -1
- package/dist/client/assets/{DotsVertical-DmUaYhK2.js → DotsVertical-qBVhBkwp.js} +1 -1
- package/dist/client/assets/{Eye-D-e14RXi.js → Eye-DT8d17_D.js} +1 -1
- package/dist/client/assets/{FilterLines-Ceib5U8s.js → FilterLines-0_3CSvNU.js} +1 -1
- package/dist/client/assets/{Globe01-D0-2dr7e.js → Globe01-Dq1s-8U-.js} +1 -1
- package/dist/client/assets/{HardDrive-iB6HZdkm.js → HardDrive-BSOkGCav.js} +1 -1
- package/dist/client/assets/{Key01-DJjMsflU.js → Key01-6ihQsQH5.js} +1 -1
- package/dist/client/assets/{LayoutLeft-DC99mmKb.js → LayoutLeft-DW_oy1t7.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BpZEkrD7.js → LinkExternal01-Dr7L27C5.js} +1 -1
- package/dist/client/assets/{Monitor01-C8q7RxXu.js → Monitor01-B1nvgGLS.js} +1 -1
- package/dist/client/assets/{Palette-C1AASxx2.js → Palette-DgrVm9Lf.js} +1 -1
- package/dist/client/assets/{Play-BHXb_TUr.js → Play-Irj6Snpi.js} +1 -1
- package/dist/client/assets/{Plus-DTBFvoZ4.js → Plus-282oO62Z.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-BDUToMVd.js → RefreshCcw01-Ucb5geTM.js} +1 -1
- package/dist/client/assets/{SearchMd-CbQiai92.js → SearchMd-QjKlDFdA.js} +1 -1
- package/dist/client/assets/{Settings02-Bu96rwA_.js → Settings02-C6oxZAMK.js} +1 -1
- package/dist/client/assets/{Shield01-knE-M4LE.js → Shield01-D7qNI860.js} +1 -1
- package/dist/client/assets/{Star01-CVzgxp1x.js → Star01-3amhnFQB.js} +1 -1
- package/dist/client/assets/{Stars01-CDWeKJ6M.js → Stars01-D-S4IK6K.js} +1 -1
- package/dist/client/assets/{Stars02-XWO6H1Re.js → Stars02-BjwC_VwI.js} +1 -1
- package/dist/client/assets/{Sun-CbEJ7xkn.js → Sun-D7IGJ5Qz.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-Dc6vSFgX.js → SwitchHorizontal01-CgqCR4Yz.js} +1 -1
- package/dist/client/assets/{Tool01-B6ELFGh-.js → Tool01-N1xf4ThS.js} +1 -1
- package/dist/client/assets/{Trash01-4Ps74tkv.js → Trash01-C5lXrAXB.js} +1 -1
- package/dist/client/assets/{Upload01-CnrDySm1.js → Upload01-CRQffHbJ.js} +1 -1
- package/dist/client/assets/{User01-BA7YwKC-.js → User01-sifBP7dG.js} +1 -1
- package/dist/client/assets/{Users01-DvcVTQ1g.js → Users01-CqOg_Qlq.js} +1 -1
- package/dist/client/assets/{Users03-BkEliyJ2.js → Users03-zhbxBBX-.js} +1 -1
- package/dist/client/assets/{X-Ch1EyNal.js → X-CY5EOp8o.js} +1 -1
- package/dist/client/assets/{XCircle-BKXSa_VQ.js → XCircle-C2jaCgsw.js} +1 -1
- package/dist/client/assets/{XClose-D_AWgVIk.js → XClose-Dp1ChvR4.js} +1 -1
- package/dist/client/assets/{Zap-C_lJ1cEb.js → Zap-DQUf40SC.js} +1 -1
- package/dist/client/assets/{ZapSquare-rvBlc1j-.js → ZapSquare-dqx_OfE2.js} +1 -1
- package/dist/client/assets/{ZoomOut-Dk_N18Ki.js → ZoomOut-BRLKFRz0.js} +1 -1
- package/dist/client/assets/{access-gate-jSqFnrGs.js → access-gate-CljCKnMv.js} +1 -1
- package/dist/client/assets/{accordion-C4Pme2EY.js → accordion-BU6HxGne.js} +1 -1
- package/dist/client/assets/{add-section-modal-cOeaGNML.js → add-section-modal-Ca9uYkx3.js} +1 -1
- package/dist/client/assets/{agent-capabilities-qbK6YAO9.js → agent-capabilities-CoD6HyyN.js} +1 -1
- package/dist/client/assets/{agent-icon-B_Sssulg.js → agent-icon-Cdddea4y.js} +1 -1
- package/dist/client/assets/{agent-icons-D51AFvhI.js → agent-icons-CKU8GGl2.js} +1 -1
- package/dist/client/assets/{agents-list-C2B7x1Is.js → agents-list-BrPrwKER.js} +1 -1
- package/dist/client/assets/{ai-providers-ogKn3dAb.js → ai-providers-DObQ3JKO.js} +1 -1
- package/dist/client/assets/{alert-D5REShaT.js → alert-B4M2bFp4.js} +1 -1
- package/dist/client/assets/{alert-dialog-6ai-9HnX.js → alert-dialog-wo7djkDg.js} +1 -1
- package/dist/client/assets/app-editor-BivZp6Yr.js +1 -0
- package/dist/client/assets/{auth-catchall-BnCKrsj9.js → auth-catchall-CARxKUXE.js} +1 -1
- package/dist/client/assets/{auth-split-layout-YnzLUagi.js → auth-split-layout-CdjhFpDE.js} +1 -1
- package/dist/client/assets/{automation-list-row-BWubsYMA.js → automation-list-row-DrMmYGg2.js} +1 -1
- package/dist/client/assets/{automation-runs-BB3z--MX.js → automation-runs-BxnZN2Rp.js} +1 -1
- package/dist/client/assets/{automations-DNOJ2JTp.js → automations-C9zBfa-L.js} +1 -1
- package/dist/client/assets/{avatar-O1JcTGgG.js → avatar-DZZ4PPWC.js} +1 -1
- package/dist/client/assets/{badge-BvUmM76z.js → badge-9pGcMSo9.js} +1 -1
- package/dist/client/assets/{brand-context-BxqAXCTz.js → brand-context-AKSB4TFX.js} +1 -1
- package/dist/client/assets/{buckets-DxKR4O3e.js → buckets-C5lDKn9n.js} +1 -1
- package/dist/client/assets/{calendar-DPPkP_2t.js → calendar-VsOQOecc.js} +1 -1
- package/dist/client/assets/{capability-load-error-H04-IMSf.js → capability-load-error-CjoddyUE.js} +1 -1
- package/dist/client/assets/{card-fKzJiL4z.js → card-Dj9cg3CK.js} +1 -1
- package/dist/client/assets/{chat-context-BmIMIbdZ.js → chat-context-DaxTCgBq.js} +1 -1
- package/dist/client/assets/{checkbox-BBA-baQg.js → checkbox-zURLZ3UX.js} +1 -1
- package/dist/client/assets/{cli-auth-success-VydTLV_L.js → cli-auth-success-Boc0yBdi.js} +1 -1
- package/dist/client/assets/{collection-detail-CzKfKNSD.js → collection-detail-DybzD5Xk.js} +1 -1
- package/dist/client/assets/{collection-display-button-w5gZgVyn.js → collection-display-button-C-0uZ95I.js} +1 -1
- package/dist/client/assets/{collection-search-DZy7ZGM2.js → collection-search-DcKd-0OB.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BtKHdP44.js → collection-table-wrapper-D16K4NpS.js} +1 -1
- package/dist/client/assets/{collection-tabs-BWubNGTM.js → collection-tabs-B68kf5RK.js} +1 -1
- package/dist/client/assets/{collections-_mVHVGxv.js → collections-CjKCiyyJ.js} +1 -1
- package/dist/client/assets/{command-eY3hMYWt.js → command-SwSMex4i.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-1K3-qmT6.js → connect-desktop-dialog-BHLyUOHP.js} +1 -1
- package/dist/client/assets/{connection-card-BiKxhszY.js → connection-card-BMM5SXL2.js} +1 -1
- package/dist/client/assets/{connection-detail-DiC5wG3m.js → connection-detail-01KrAftr.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-qNlMv9lf.js → connection-form-helpers-DQIelH5O.js} +1 -1
- package/dist/client/assets/{connections-CwFwHTK-.js → connections-DXt-OZ2a.js} +1 -1
- package/dist/client/assets/{constants-DVPpd9QA.js → constants-D3TwDQx3.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-BSh6nGrY.js → decopilot-sse-pool-BegF480x.js} +1 -1
- package/dist/client/assets/{dialog-zrSzj7TD.js → dialog-ZmuU49gf.js} +1 -1
- package/dist/client/assets/{domain-settings-C0r5hJdO.js → domain-settings-MOa5o-N_.js} +1 -1
- package/dist/client/assets/{drawer-BOKSr-JQ.js → drawer-gGw1fcoY.js} +1 -1
- package/dist/client/assets/{dropdown-menu-Dp0AYb5Q.js → dropdown-menu-CxtJkFj7.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-BqbhGwCQ.js → dynamic-plugin-layout-NAmzVGzy.js} +1 -1
- package/dist/client/assets/{empty-state-C-Vzaz3T.js → empty-state-Bp53vJ5J.js} +1 -1
- package/dist/client/assets/{empty-state-CMCikW75.js → empty-state-DypMRY_b.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DqaNlLEE.js → extract-connection-data-BxLUPS35.js} +1 -1
- package/dist/client/assets/{features-DY0OBwI_.js → features-DdT_Un6T.js} +1 -1
- package/dist/client/assets/{file-explorer-c1AF4n2J.js → file-explorer-C6G0_-8u.js} +1 -1
- package/dist/client/assets/{file-type-icon-BPZ9mx_j.js → file-type-icon-C7hLWFjD.js} +1 -1
- package/dist/client/assets/{files-3Db0Ok-v.js → files-IHk2X7ln.js} +1 -1
- package/dist/client/assets/{form-DwvvaWfd.js → form-Bb30Dtd4.js} +1 -1
- package/dist/client/assets/{general-BSTtek3u.js → general-CyrOfN1n.js} +1 -1
- package/dist/client/assets/{generate-id-Lwmt2FKL.js → generate-id-DCuwKdwd.js} +1 -1
- package/dist/client/assets/{github-repo-picker-BSS2HO9c.js → github-repo-picker-ukQ8mlgx.js} +1 -1
- package/dist/client/assets/{header-tab-button-ziMK8DeX.js → header-tab-button-Ct59Qn2o.js} +1 -1
- package/dist/client/assets/{hover-card-B1oYmeeS.js → hover-card-BJCPsde9.js} +1 -1
- package/dist/client/assets/{image-field-Xt_fxRp4.js → image-field-BUiTz_KS.js} +1 -1
- package/dist/client/assets/{index-Dkg-XbjX.js → index-B2iX6hZk.js} +1 -1
- package/dist/client/assets/{index-CM4eUM9Q.js → index-BD0Vs-CA.js} +3 -3
- package/dist/client/assets/{index-CTWR9OEI.js → index-BYpuQugU.js} +1 -1
- package/dist/client/assets/{index-DZT3k4JB.js → index-C-7fxrkj.js} +1 -1
- package/dist/client/assets/{index-tJpcknvZ.js → index-C-BjtSEe.js} +1 -1
- package/dist/client/assets/{index-C34u6PSm.js → index-CPp-3T8R.js} +1 -1
- package/dist/client/assets/{index-Bn2oEJye.js → index-CQ4OU5SG.js} +1 -1
- package/dist/client/assets/{index-BgCi7oO5.js → index-Cov_Guzr.js} +1 -1
- package/dist/client/assets/{index-C6H2oubI.js → index-Czyl40Yo.js} +1 -1
- package/dist/client/assets/{index-B55sS7_E.js → index-D3Ribt5F.js} +1 -1
- package/dist/client/assets/{index-Bno4hQSS.js → index-DF_fyalX.js} +1 -1
- package/dist/client/assets/{index-CSkdTWYd.js → index-De2W4Fh6.js} +1 -1
- package/dist/client/assets/{index-Bdaabwwx.js → index-DiDlqgd4.js} +1 -1
- package/dist/client/assets/{index-CFbzjrDU.js → index-Dji_l0xa.js} +4 -4
- package/dist/client/assets/{index-BhbqsWj0.js → index-c4IWlLfS.js} +1 -1
- package/dist/client/assets/{index-redirect-Cg0BDQlK.js → index-redirect-BvLQ4iq8.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-UgK429qS.js → infiniteQueryObserver-sLZJuWs1.js} +1 -1
- package/dist/client/assets/{input-DwZNdPHy.js → input-BdjjFpfr.js} +1 -1
- package/dist/client/assets/{integration-icon-CBe2H1CK.js → integration-icon-DjqEnfq3.js} +1 -1
- package/dist/client/assets/{label-4oCFH30G.js → label-C5JCVP3P.js} +1 -1
- package/dist/client/assets/{layout-DVfJUzzq.js → layout-K01ShTmz.js} +1 -1
- package/dist/client/assets/{login-okezlysx.js → login-Cni2d7NN.js} +1 -1
- package/dist/client/assets/{members-CLERhO5A.js → members-a7ObwkxU.js} +1 -1
- package/dist/client/assets/{monaco-editor-CB_L5Q_g.js → monaco-editor-D2Cgb5CL.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-CmyF_9mp.js → monitoring-stats-row-Co_s1URu.js} +1 -1
- package/dist/client/assets/{oauth-callback-BXG4NwZh.js → oauth-callback-BT0UUcR2.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-BnPVO-sU.js → oauth-callback-ai-provider-BMcv6iWf.js} +1 -1
- package/dist/client/assets/{onboarding-BSqDKN4n.js → onboarding-BLBFk2ZA.js} +1 -1
- package/dist/client/assets/{org-install-F0Blx0ik.js → org-install-BrfD2Fv0.js} +1 -1
- package/dist/client/assets/{org-layout-BSF2eWwr.js → org-layout-Bn3L93QB.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-Cy8OWL63.js → org-plugin-layout-Nka8ivWV.js} +1 -1
- package/dist/client/assets/{page-seo-form-DsSfrFx2.js → page-seo-form-CpoxmYxQ.js} +1 -1
- package/dist/client/assets/page-seo-sheet-Cni7GVIz.js +1 -0
- package/dist/client/assets/{pair-BUKInYHO.js → pair-Bui7pRoY.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-BFoUX648.js → plugin-empty-state-5lCjYrbS.js} +1 -1
- package/dist/client/assets/{plugin-header-DQzSP9ZF.js → plugin-header-BFOQBz_i.js} +1 -1
- package/dist/client/assets/{plugin-layout-B7RnS0gK.js → plugin-layout-ONSas9Ui.js} +1 -1
- package/dist/client/assets/{popover-pbPJblFP.js → popover-cTB9T6zY.js} +1 -1
- package/dist/client/assets/{post-editor-Ct8uL9lS.js → post-editor-N9xx8HEl.js} +1 -1
- package/dist/client/assets/{primitives-D4DINGOQ.js → primitives-BY4b05zg.js} +1 -1
- package/dist/client/assets/{profile-GChqLjKK.js → profile-C-xaCM8D.js} +1 -1
- package/dist/client/assets/project-app-view-CLSVHcb8.js +1 -0
- package/dist/client/assets/record-editor-tc1QZAky.js +1 -0
- package/dist/client/assets/registry-HzF1Dkk-.js +2 -0
- package/dist/client/assets/{registry-layout-BUzClddy.js → registry-layout-oMaQFjep.js} +1 -1
- package/dist/client/assets/{require-capability-D0GS6z32.js → require-capability-CG52f6R3.js} +1 -1
- package/dist/client/assets/{required-auth-layout-DHWUJ_wT.js → required-auth-layout-RkDlrM0L.js} +1 -1
- package/dist/client/assets/{reset-password-BS1iqoj0.js → reset-password-DfZLgZJf.js} +1 -1
- package/dist/client/assets/{resizable-DhLCux-y.js → resizable-BRPR_6nf.js} +1 -1
- package/dist/client/assets/{roles-BNQvS-Ms.js → roles-iynUa3v9.js} +1 -1
- package/dist/client/assets/{save-status-D1nMYaPA.js → save-status-Cs4ql7Lz.js} +1 -1
- package/dist/client/assets/{schema-form-BHbbVGcy.js → schema-form-BQLwCXS8.js} +1 -1
- package/dist/client/assets/{scroll-area-DMpuHtIE.js → scroll-area-DMkk7C5X.js} +1 -1
- package/dist/client/assets/{search-input-Br9hH5ca.js → search-input-C-P2O70i.js} +1 -1
- package/dist/client/assets/{secrets-wDf_j2Pb.js → secrets-mBqxX3ne.js} +1 -1
- package/dist/client/assets/{sections-editor-C0HkgTTy.js → sections-editor-CkUdgmBv.js} +1 -1
- package/dist/client/assets/{select-DUB_e2wA.js → select-877_XRoe.js} +1 -1
- package/dist/client/assets/{select-model-n2hGgZkG.js → select-model-C_cur-rH.js} +1 -1
- package/dist/client/assets/{seo-editor-C9Aqp93i.js → seo-editor-D8nPTKAd.js} +1 -1
- package/dist/client/assets/settings-layout-Dbfjpv2r.js +1 -0
- package/dist/client/assets/{settings-section-c0dyQilc.js → settings-section-kr7Y9bP9.js} +1 -1
- package/dist/client/assets/{sheet-CQuYX4pr.js → sheet-Dsz02SFl.js} +1 -1
- package/dist/client/assets/{shell-controls-haAPWYdb.js → shell-controls-DTLIiy6L.js} +1 -1
- package/dist/client/assets/{shell-layout-iqX4bmcb.js → shell-layout-CH8oYCM2.js} +1 -1
- package/dist/client/assets/shell-route-loading-Cn0fA0CZ.js +1 -0
- package/dist/client/assets/{sidebar-CUicHm9C.js → sidebar-OlCqSXPX.js} +1 -1
- package/dist/client/assets/{skeleton-CaDhIMN5.js → skeleton-CoJAV87H.js} +1 -1
- package/dist/client/assets/{sortable.esm-DHLq9Pb_.js → sortable.esm-ZerYvs9l.js} +1 -1
- package/dist/client/assets/{spinner-d6yvFwOg.js → spinner-CYDSZGqh.js} +1 -1
- package/dist/client/assets/{sso-k1LlLt2L.js → sso-AzS0X9Dv.js} +1 -1
- package/dist/client/assets/{store-COFkGwT_.js → store-2U1XV2kz.js} +1 -1
- package/dist/client/assets/store-registry-DWHj3GiE.js +2 -0
- package/dist/client/assets/{switch-CEixFBdL.js → switch-Bazzokl_.js} +1 -1
- package/dist/client/assets/{tab-id-DvasrPZC.js → tab-id-DrhK90L3.js} +1 -1
- package/dist/client/assets/{table-BwGGIiJ5.js → table-Do8GxGTj.js} +1 -1
- package/dist/client/assets/{tabs-Bo7dHK4T.js → tabs-D9ntWD-6.js} +1 -1
- package/dist/client/assets/{task-status-Cu-l7Iv4.js → task-status-Sjdts0gR.js} +1 -1
- package/dist/client/assets/{textarea-DHyB0Smt.js → textarea-D91MKpZC.js} +1 -1
- package/dist/client/assets/{toggle-group-calkhzKZ.js → toggle-group-DGrm2vuO.js} +1 -1
- package/dist/client/assets/{toolbar-NS6fUdLE.js → toolbar-Dy7jx2bJ.js} +1 -1
- package/dist/client/assets/{tools-list-CHRbHPAT.js → tools-list-BmmPeFb6.js} +1 -1
- package/dist/client/assets/{tooltip-c0JCK6eh.js → tooltip-BXkAyk_s.js} +1 -1
- package/dist/client/assets/{types-BqTbtprH.js → types-j6zTjYLW.js} +1 -1
- package/dist/client/assets/{use-ai-providers-ClrNZ9KV.js → use-ai-providers-DuBmTMbG.js} +1 -1
- package/dist/client/assets/{use-automations-D_GOMI0Y.js → use-automations-ClchBd2q.js} +1 -1
- package/dist/client/assets/{use-capability-D2Lekzsm.js → use-capability-4Bqq3Ptd.js} +1 -1
- package/dist/client/assets/{use-collections-BdrLE9lf.js → use-collections-HtykhO8E.js} +1 -1
- package/dist/client/assets/{use-connection-Bna7-Lpr.js → use-connection-CFCjzYr3.js} +1 -1
- package/dist/client/assets/{use-copy-9jbZNRel.js → use-copy-D2WKzb4n.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BrzNeIRQ.js → use-create-virtual-mcp-D8DtJRBD.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-BZksQLwZ.js → use-debounced-autosave-B_zQVx0C.js} +1 -1
- package/dist/client/assets/{use-delete-connection-B9QWDFwu.js → use-delete-connection-CcHH3N6L.js} +1 -1
- package/dist/client/assets/{use-file-configs-mDsJFR6O.js → use-file-configs-BdoGIuji.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-BmCBqG2s.js → use-infinite-scroll--wh3054T.js} +1 -1
- package/dist/client/assets/{use-list-state-5PGktjrQ.js → use-list-state-Dgqvi_Qc.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-zOwt9lRN.js → use-mcp-prompts-Cs73_aGi.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CVwEyvG9.js → use-mcp-tools-C1gRGhR_.js} +1 -1
- package/dist/client/assets/{use-members-BpSAkPCJ.js → use-members-PGJbXmC6.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-CLGcl9A6.js → use-navigate-to-agent-BU3cK_V3.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-NzYQ0X0A.js → use-org-auth-client-DDgSMc-B.js} +1 -1
- package/dist/client/assets/{use-org-sso-CM2A8YLV.js → use-org-sso-BAFZBkLH.js} +1 -1
- package/dist/client/assets/{use-organization-roles-BY_DCVFa.js → use-organization-roles-Dh3C98N-.js} +1 -1
- package/dist/client/assets/{use-organization-settings-oXVZ3xqu.js → use-organization-settings-DyFbECeN.js} +1 -1
- package/dist/client/assets/{use-registry-connections-C77RjnzI.js → use-registry-connections-Bk2SQzaL.js} +1 -1
- package/dist/client/assets/{use-secrets-TPJVmW_G.js → use-secrets-7GF-cSiL.js} +1 -1
- package/dist/client/assets/{use-status-sounds-CM-eJHCl.js → use-status-sounds-CvJbKYn3.js} +1 -1
- package/dist/client/assets/{use-view-mode-CIGO_mC0.js → use-view-mode-DitlqWxa.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-BA-W1Vhc.js → use-virtual-mcp-Cvm4KLIO.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-BXWzDcVY.js +1 -0
- package/dist/client/assets/{useRouterState-wqO08_go.js → useRouterState-ComuFEbk.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-C3HFhtdp.js +1 -0
- package/dist/client/assets/{user-CctTJX2g.js → user-Bkww3yLN.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DvvzCaLm.js → view-mode-toggle-2ZW6tMJS.js} +1 -1
- package/dist/client/assets/{workflow-CijEnEyN.js → workflow-Dt_Gbo2I.js} +1 -1
- package/dist/client/assets/workflow-detail-cuV7fAVn.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +380 -380
- package/dist/server/server.js +244 -244
- package/package.json +1 -1
- package/dist/client/assets/app-editor-CNQX0fRz.js +0 -1
- package/dist/client/assets/page-seo-sheet-51vZvU9M.js +0 -1
- package/dist/client/assets/project-app-view-hOIqQC_C.js +0 -1
- package/dist/client/assets/record-editor-BrKRPPKj.js +0 -1
- package/dist/client/assets/registry-DKsLffG0.js +0 -2
- package/dist/client/assets/settings-layout-CBNchIFt.js +0 -1
- package/dist/client/assets/shell-route-loading-4HloIA9a.js +0 -1
- package/dist/client/assets/store-registry-Krrosx15.js +0 -2
- package/dist/client/assets/useInfiniteQuery-CNKhmBjK.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-ojQaNUtI.js +0 -1
- package/dist/client/assets/workflow-detail-7ioCF-1N.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-
|
|
2
|
-
import{e as H,r as R,c as ce,j as n,l as we,q as Ne,b as Ks,E as Ht,f as Qt,d as No,g as vc,p as pu,L as _u,n as Vs,K as Dt,s as gu,o as ae,B as se,v as xc,V as vu,t as Le,w as bc,x as xu,y as Ur,z as Di,C as vt,D as bu,F as qs,G as yc,H as yu,I as Su,J as Ea,M as wu,P as Kr,Q as Cu,a as Gs,R as dr,T as gi,U as jt,_ as Kt}from"./index-CM4eUM9Q.js";import{C as Oe,a as ku,u as ju,b as Ys,h as Nu,w as Eu,c as Sc,d as Eo,s as Dn,T as Tu,e as Ru,g as Pu,f as Du}from"./agent-capabilities-qbK6YAO9.js";import{g as To,u as tt,S as Cs,a as wc}from"./constants-DVPpd9QA.js";import{u as It,a as Au,b as Iu,c as Bu}from"./use-virtual-mcp-BA-W1Vhc.js";import{a as ks,b as es,c as Ro,d as Cc,u as Mu,t as Lu,e as Ou,f as $u}from"./chat-context-BmIMIbdZ.js";import{i as zi}from"./AlertCircle-dzvWxujb.js";import{i as kc}from"./CheckCircle-C24wnP2Z.js";import{n as Ta}from"./ChevronLeft-DEtz4dkO.js";import{i as zu,a as Fu}from"./XCircle-BKXSa_VQ.js";import{s as fs}from"./XClose-D_AWgVIk.js";import{c as Hu,u as Wu,a as jc,O as Uu,t as Ra,G as Ku,g as Vu,s as qu,C as Gu,b as Yu,d as Xu}from"./pair-BUKInYHO.js";import{I as Vt}from"./integration-icon-CBe2H1CK.js";import{a as Ju}from"./Users03-BkEliyJ2.js";import{t as js}from"./ChevronDown-BZRrL23D.js";import{u as Nc}from"./use-ai-providers-ClrNZ9KV.js";import{r as Zu,u as Po,i as Qu}from"./shell-layout-iqX4bmcb.js";import{b as ef,a as tf}from"./shell-route-loading-4HloIA9a.js";import{u as sf}from"./sidebar-CUicHm9C.js";import{S as rf,a as nf,b as of}from"./sheet-CQuYX4pr.js";import{u as Ec,T as Te,a as Re,b as Pe,c as Tc}from"./tooltip-c0JCK6eh.js";import{i as Ai,a as Vr,b as Rc,c as af,p as qr,g as Gr,d as Do,e as Pc,h as An,f as ln,j as Pa,A as Da,k as lf,l as cf,n as hf,m as df,o as uf,t as ff,q as mf,r as Yr,s as pf,u as Aa,v as Ia,w as _f,x as gf,y as vf,z as xf,B as Ao,C as Sr,D as Io,E as Dc,F as Ac,G as bf,H as yf,I as Sf,J as wf,K as Cf,L as Ba,M as kf,N as jf,O as Ci,P as Nf,Q as Ic,R as Bc,S as Ef}from"./agent-icon-B_Sssulg.js";import{u as Tf}from"./use-status-sounds-CM-eJHCl.js";import{E as wr}from"./empty-state-C-Vzaz3T.js";import{u as Rf,r as In,a as Pf,p as Mc,f as Ma,b as Lc,c as Oc,d as $c,e as Df,F as Af,i as If,g as Bf,h as Mf,j as Lf,k as Of}from"./tab-id-DvasrPZC.js";import{g as Xs,A as $f}from"./sortable.esm-DHLq9Pb_.js";import{T as La,a as Bn}from"./toolbar-NS6fUdLE.js";import{R as zc,a as zf,b as Ff}from"./resizable-DhLCux-y.js";import{i as Fi,n as Hf}from"./Globe01-D0-2dr7e.js";import{i as Fc}from"./Monitor01-C8q7RxXu.js";import{u as Hi,a as Bo,b as Wf}from"./use-connection-Bna7-Lpr.js";import{u as Xr,a as Uf,b as Kf}from"./use-mcp-tools-CVwEyvG9.js";import{u as Vf}from"./use-capability-D2Lekzsm.js";import{F as Mo,M as Lo}from"./file-type-icon-BPZ9mx_j.js";import{g as qf,H as Hc,F as Gf,a as Yf,f as Xf,u as Jf,b as Zf,e as Qf,c as em}from"./header-tab-button-ziMK8DeX.js";import{i as Wc,a as Oa,b as tm}from"./ZoomOut-Dk_N18Ki.js";import{P as Ns,a as Es,b as Ts}from"./popover-pbPJblFP.js";import{S as Uc}from"./spinner-d6yvFwOg.js";import{D as Js,a as Zs,b as Qs,c as et,d as ur,e as sm,f as im,g as rm}from"./dropdown-menu-Dp0AYb5Q.js";import{D as Bt,a as Mt,b as ts,c as ss,d as ei,e as Oo}from"./dialog-zrSzj7TD.js";import{I as qe}from"./input-DwZNdPHy.js";import{T as xs,a as $o,b as ki,c as zo}from"./tabs-Bo7dHK4T.js";import{T as Cr}from"./textarea-DHyB0Smt.js";import{a as ds,s as nm}from"./Eye-D-e14RXi.js";import{t as Jr}from"./Stars01-CDWeKJ6M.js";import{l as om,w as am}from"./index-C34u6PSm.js";import{i as lm}from"./ChevronRight-Ddjtetki.js";import{g as cm}from"./generate-id-Lwmt2FKL.js";import{u as hm,g as dm}from"./types-BqTbtprH.js";import{U as Kc}from"./user-CctTJX2g.js";import{T as um,u as Vc}from"./tools-list-CHRbHPAT.js";import{u as fm}from"./unwrap-tool-result-BYXdCQMg.js";import{s as qc,g as mm}from"./connection-slug-eyAPH6o3.js";import{A as kr,a as jr,b as Nr,c as Er,d as Tr,e as Rr,f as Pr,g as Dr}from"./alert-dialog-6ai-9HnX.js";import{C as Gc,a as Mn}from"./card-fKzJiL4z.js";import{L as Ct}from"./label-4oCFH30G.js";import{S as Et,a as Tt,b as Rt,c as lt,d as Pt}from"./select-DUB_e2wA.js";import{S as Ar}from"./switch-CEixFBdL.js";import{i as Fs}from"./Play-BHXb_TUr.js";import{s as At}from"./Plus-DTBFvoZ4.js";import{a as pm}from"./Settings02-Bu96rwA_.js";import{s as Ii}from"./Trash01-4Ps74tkv.js";import{u as Ir}from"./use-debounced-autosave-BZksQLwZ.js";import{S as Zr}from"./scroll-area-DMpuHtIE.js";import{i as Fo}from"./SearchMd-CbQiai92.js";import{i as _m}from"./Upload01-CnrDySm1.js";import{i as gm}from"./LayoutLeft-DC99mmKb.js";import{P as Nt}from"./index-B55sS7_E.js";import{C as Qr}from"./checkbox-BBA-baQg.js";import{S as Yc}from"./search-input-Br9hH5ca.js";import{C as Xc}from"./collection-tabs-BWubNGTM.js";import{u as vm}from"./use-mcp-prompts-zOwt9lRN.js";import{D as xm,a as bm,b as ym}from"./drawer-BOKSr-JQ.js";import{i as Wi}from"./Check-BTi6aK2O.js";import{i as Jc}from"./Key01-DJjMsflU.js";import{S as gs}from"./skeleton-CaDhIMN5.js";import{s as Sm}from"./User01-BA7YwKC-.js";import{t as Ho}from"./Users01-DvcVTQ1g.js";import{u as wm,a as Cm}from"./use-secrets-TPJVmW_G.js";import{G as km}from"./github-repo-picker-BSS2HO9c.js";import{f as jm}from"./formatDistanceToNow-Cb2QZZJn.js";import{n as ti}from"./LinkExternal01-BpZEkrD7.js";import{A as Nm,a as Em,b as Tm,c as Rm}from"./accordion-C4Pme2EY.js";import{s as Hs}from"./Star01-CVzgxp1x.js";import{i as Zc}from"./Stars02-XWO6H1Re.js";import{V as Pm}from"./view-mode-toggle-DvvzCaLm.js";import{n as Qc}from"./ZapSquare-rvBlc1j-.js";import{i as Wo,a as Dm,b as Uo}from"./Tool01-B6ELFGh-.js";import{c as eh,i as Am}from"./SwitchHorizontal01-Dc6vSFgX.js";import{B as Im}from"./badge-BvUmM76z.js";import{C as Bm,a as $a,b as Mm,c as Lm,d as Om,e as $m}from"./command-eY3hMYWt.js";import{M as zm}from"./select-model-n2hGgZkG.js";import{u as Ui,a as Fm,b as Hm,c as Wm,d as Um}from"./use-automations-D_GOMI0Y.js";import{i as th}from"./RefreshCcw01-BDUToMVd.js";import{i as Bi}from"./Zap-C_lJ1cEb.js";import{M as Km}from"./monaco-editor-CB_L5Q_g.js";import{A as Vm}from"./automation-runs-BB3z--MX.js";import{A as qm}from"./automation-list-row-BWubsYMA.js";import{i as Gm}from"./X-Ch1EyNal.js";function li(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function za(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function Ym(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Xm(t){const e=H.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Jm),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=n.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=r):r=e[3],r}function Jm(t){return n.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[n.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),n.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function Zm(t){const e=H.c(30),{userTokens:s,assistantTokens:i,otherTokens:r}=t,o=s+i+r,a=o>0?s/o*100:0,l=o>0?i/o*100:0,h=o>0?r/o*100:0;let c;e[0]!==a?(c=a>0&&n.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=c):c=e[1];let d;e[2]!==l?(d=l>0&&n.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=d):d=e[3];let u;e[4]!==h?(u=h>0&&n.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=u):u=e[5];let f;e[6]!==c||e[7]!==d||e[8]!==u?(f=n.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,d,u]}),e[6]=c,e[7]=d,e[8]=u,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=m):m=e[10];let p;e[11]!==a?(p=a.toFixed(1),e[11]=a,e[12]=p):p=e[12];let _;e[13]!==p?(_=n.jsxs("div",{className:"flex items-center gap-1.5",children:[m,n.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",p,"%"]})]}),e[13]=p,e[14]=_):_=e[14];let v;e[15]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=v):v=e[15];let x;e[16]!==l?(x=l.toFixed(1),e[16]=l,e[17]=x):x=e[17];let y;e[18]!==x?(y=n.jsxs("div",{className:"flex items-center gap-1.5",children:[v,n.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",x,"%"]})]}),e[18]=x,e[19]=y):y=e[19];let g;e[20]!==h||e[21]!==r?(g=r>0&&n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),n.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",h.toFixed(1),"%"]})]}),e[20]=h,e[21]=r,e[22]=g):g=e[22];let b;e[23]!==y||e[24]!==g||e[25]!==_?(b=n.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[_,y,g]}),e[23]=y,e[24]=g,e[25]=_,e[26]=b):b=e[26];let S;return e[27]!==b||e[28]!==f?(S=n.jsxs("div",{className:"flex flex-col gap-2",children:[f,b]}),e[27]=b,e[28]=f,e[29]=S):S=e[29],S}function Qm(t){const e=H.c(11),{agentId:s,isError:i}=t,r=It(s),o=r?.title??"Subtask",a=r?.icon??null;let l;e[0]!==a||e[1]!==o?(l=n.jsx(Vt,{icon:a,name:o,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=o,e[2]=l):l=e[2];const h=i?"text-destructive":"text-foreground";let c;e[3]!==h?(c=ce("shrink-0 font-medium",h),e[3]=h,e[4]=c):c=e[4];let d;e[5]!==o||e[6]!==c?(d=n.jsx("span",{className:c,children:o}),e[5]=o,e[6]=c,e[7]=d):d=e[7];let u;return e[8]!==l||e[9]!==d?(u=n.jsxs(n.Fragment,{children:[l,d]}),e[8]=l,e[9]=d,e[10]=u):u=e[10],u}function ep(t){const e=H.c(5),{isError:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(Vt,{icon:null,name:"Subtask",size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=i):i=e[0];const r=s?"text-destructive":"text-foreground";let o;e[1]!==r?(o=ce("shrink-0 font-medium",r),e[1]=r,e[2]=o):o=e[2];let a;return e[3]!==o?(a=n.jsxs(n.Fragment,{children:[i,n.jsx("span",{className:o,children:"Subtask"})]}),e[3]=o,e[4]=a):a=e[4],a}function tp(t){const e=H.c(18),{part:s}=t,i=s.input?.agent_id,r=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,o=s.state==="output-error",a=s.state==="approval-requested";let l;e[0]!==o?(l=n.jsx(ep,{isError:o}),e[0]=o,e[1]=l):l=e[1];let h;e[2]!==i||e[3]!==o?(h=n.jsx(Qm,{agentId:i,isError:o}),e[2]=i,e[3]=o,e[4]=h):h=e[4];let c;e[5]!==l||e[6]!==h?(c=n.jsx(R.Suspense,{fallback:l,children:h}),e[5]=l,e[6]=h,e[7]=c):c=e[7];let d;e[8]!==s.input?(d=s.input?.prompt&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted-foreground/50",children:"·"}),n.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==o||e[12]!==r?(u=n.jsx("span",{className:"ml-auto shrink-0",children:r?n.jsx(we,{size:12,className:"animate-spin text-muted-foreground"}):o?n.jsx(zu,{size:12,className:"text-destructive"}):a?n.jsx(zi,{size:12,className:"text-warning"}):n.jsx(kc,{size:12,className:"text-emerald-500"})}),e[10]=a,e[11]=o,e[12]=r,e[13]=u):u=e[13];let f;return e[14]!==c||e[15]!==d||e[16]!==u?(f=n.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[c,d,u]}),e[14]=c,e[15]=d,e[16]=u,e[17]=f):f=e[17],f}function sp(t){const e=H.c(55),{onClose:s,back:i,className:r}=t,[o,a]=R.useState(null),{messages:l}=ks(),{activeTask:h}=es(),{selectedModel:c,selectedVirtualMcp:d}=Ro();let u,f,m,p,_,v,x,y;if(e[0]!==h||e[1]!==i||e[2]!==r||e[3]!==l||e[4]!==s||e[5]!==o?.id||e[6]!==c||e[7]!==d?.title){y=Symbol.for("react.early_return_sentinel");e:{const S=Hu(l),w=[...l].reverse().find(fp),k=w?.metadata?.usage,N=w?.metadata?.modelLimits?.contextWindow??c?.limits?.contextWindow??null,D=k?.contextTokens??0,I=N&&N>0?(D/N*100).toFixed(1):null,P=l;let j;e[16]!==P?(j=P.filter(up).reduce(dp,0),e[16]=P,e[17]=j):j=e[17];const C=j,A=l;let E;e[18]!==A?(E=A.filter(hp).reduce(cp,0),e[18]=A,e[19]=E):E=e[19];const T=E,M=Math.max(0,S.totalTokens-C-T),B=l[0],O=l.at(-1),F=B?.metadata?.created_at??h?.created_at,W=O?.metadata?.created_at??h?.updated_at,$=l.filter(lp),U=l.flatMap(op),Y=c?.modelId?Ym(c.modelId):"—",V=d?.title??"Decopilot",K=[{label:"Session",value:h?.title??"New chat"},{label:"Messages",value:$.length},{label:"Agent",value:V},{label:"Model",value:Y},{label:"Context Limit",value:N?li(N):"—"},{label:"Session Tokens (billed)",value:S.totalTokens>0?li(S.totalTokens):"0"},{label:"Usage",value:I!==null?`${I}%`:"—"},{label:"Input Tokens",value:S.inputTokens>0?li(S.inputTokens):"0"},{label:"Output Tokens",value:S.outputTokens>0?li(S.outputTokens):"0"},{label:"Reasoning Tokens",value:S.reasoningTokens>0?li(S.reasoningTokens):"0"},{label:"Cost",value:S.cost>0?`$${S.cost<.001?S.cost.toFixed(6):S.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:za(F)},{label:"Last Activity",value:za(W)}];if(!h&&$.length===0){let L;e[20]!==r?(L=ce("flex flex-col h-full w-full border-l border-border bg-background",r),e[20]=r,e[21]=L):L=e[21];let ee;e[22]===Symbol.for("react.memo_cache_sentinel")?(ee=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[22]=ee):ee=e[22];let te;e[23]!==i?(te=i?n.jsx(Ta,{size:14,className:"text-muted-foreground"}):n.jsx(fs,{size:14,className:"text-muted-foreground"}),e[23]=i,e[24]=te):te=e[24];let G;e[25]!==s||e[26]!==te?(G=n.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[ee,n.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:te})]}),e[25]=s,e[26]=te,e[27]=G):G=e[27];let z;e[28]===Symbol.for("react.memo_cache_sentinel")?(z=n.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:n.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[28]=z):z=e[28];let le;e[29]!==L||e[30]!==G?(le=n.jsxs("div",{className:L,children:[G,z]}),e[29]=L,e[30]=G,e[31]=le):le=e[31],y=le;break e}e[32]!==r?(v=ce("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[32]=r,e[33]=v):v=e[33];let q;e[34]===Symbol.for("react.memo_cache_sentinel")?(q=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[34]=q):q=e[34];let Q;e[35]!==i?(Q=i?n.jsx(Ta,{size:14}):n.jsx(fs,{size:14}),e[35]=i,e[36]=Q):Q=e[36],e[37]!==s||e[38]!==Q?(x=n.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[q,n.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:Q})]}),e[37]=s,e[38]=Q,e[39]=x):x=e[39],u="flex flex-col gap-8 p-6",f=U.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),n.jsx("div",{className:"flex flex-col gap-1",children:U.map(np)})]}),m=n.jsx(Xm,{items:K});let oe;e[40]===Symbol.for("react.memo_cache_sentinel")?(oe=n.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[40]=oe):oe=e[40],e[41]!==T||e[42]!==M||e[43]!==C?(p=n.jsxs("div",{className:"flex flex-col gap-3",children:[oe,n.jsx(Zm,{userTokens:C,assistantTokens:T,otherTokens:M})]}),e[41]=T,e[42]=M,e[43]=C,e[44]=p):p=e[44],_=$.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),n.jsx("div",{className:"flex flex-col gap-1",children:$.map(L=>{const ee=L.metadata?.created_at,te=o?.id===L.id;return n.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[n.jsxs("button",{type:"button",onClick:()=>a(te?null:L),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:ce("shrink-0 font-medium",L.role==="user"?"text-chart-1":"text-chart-2"),children:L.role}),n.jsx("span",{className:"text-muted-foreground",children:"•"}),n.jsx("span",{className:"truncate text-muted-foreground font-mono",children:L.id})]}),ee&&n.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(ee).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),te&&n.jsxs(n.Fragment,{children:[L.role==="assistant"&&(()=>{const G=L.metadata?._request;if(!G)return null;const z=G.systemSections??[],le=Math.max(1,...z.map(rp)),ue=z.reduce(ip,0);return n.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"font-medium text-foreground",children:"Request"}),n.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[G.activeTools??0," / ",G.tools??0," ","tools active"]})]}),z.length>0&&n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"text-muted-foreground",children:["System prompt"," ",n.jsxs("span",{className:"tabular-nums",children:["~",Math.round(ue/4).toLocaleString()," ","tok"]})]}),z.map((me,he)=>{const ie=me.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${he}`,ve=me.chars/le*100,re=Math.round(me.chars/4);return n.jsxs("div",{className:"space-y-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"font-mono text-foreground truncate",children:ie}),n.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",re.toLocaleString()," tok"]})]}),n.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:n.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${ve}%`}})})]},he)})]})]})})(),n.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(L,null,2)})]})]},L.id)})})]})}e[0]=h,e[1]=i,e[2]=r,e[3]=l,e[4]=s,e[5]=o?.id,e[6]=c,e[7]=d?.title,e[8]=u,e[9]=f,e[10]=m,e[11]=p,e[12]=_,e[13]=v,e[14]=x,e[15]=y}else u=e[8],f=e[9],m=e[10],p=e[11],_=e[12],v=e[13],x=e[14],y=e[15];if(y!==Symbol.for("react.early_return_sentinel"))return y;let g;e[45]!==u||e[46]!==f||e[47]!==m||e[48]!==p||e[49]!==_?(g=n.jsxs("div",{className:u,children:[f,m,p,_]}),e[45]=u,e[46]=f,e[47]=m,e[48]=p,e[49]=_,e[50]=g):g=e[50];let b;return e[51]!==v||e[52]!==x||e[53]!==g?(b=n.jsxs("div",{className:v,children:[x,g]}),e[51]=v,e[52]=x,e[53]=g,e[54]=b):b=e[54],b}function ip(t,e){return t+e.chars}function rp(t){return t.chars}function np(t,e){return n.jsx(tp,{part:t},e)}function op(t){return(t.parts??[]).filter(ap)}function ap(t){return t.type==="tool-subtask"}function lp(t){return t.role!=="system"}function cp(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function hp(t){return t.role==="assistant"}function dp(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function up(t){return t.role==="user"}function fp(t){return t.role==="assistant"&&t.metadata?.usage}function mp(t){const e=H.c(13),{readOnly:s,identity:i,aboveRow:r,input:o,iceBreakers:a}=t,l=!s&&i?i:null;let h;e[0]!==r||e[1]!==s?(h=!s&&r?n.jsx("div",{"data-chat-above-row":"true",className:"@container/chat-bottom flex justify-start gap-1",children:r}):null,e[0]=r,e[1]=s,e[2]=h):h=e[2];let c;e[3]!==o||e[4]!==h?(c=n.jsxs("div",{className:"flex flex-col gap-2",children:[h,o]}),e[3]=o,e[4]=h,e[5]=c):c=e[5];let d;e[6]!==a||e[7]!==s?(d=!s&&a?n.jsx("div",{className:"w-full",children:a}):null,e[6]=a,e[7]=s,e[8]=d):d=e[8];let u;return e[9]!==l||e[10]!==c||e[11]!==d?(u=n.jsx("div",{"data-chat-centered":"true",className:"h-full w-full flex flex-col items-center justify-center px-4 gap-6",children:n.jsxs("div",{className:"w-full max-w-3xl flex flex-col gap-6",children:[l,c,d]})}),e[9]=l,e[10]=c,e[11]=d,e[12]=u):u=e[12],u}function pp(t){const e=H.c(25),{onOpenContextPanel:s}=t,{org:i}=Ne(),{selectedVirtualMcp:r}=Ro();let o;e[0]!==i.id?(o=To(i.id),e[0]=i.id,e[1]=o):o=e[1];const l=r??o,h=It(l.id),c=Cc(),{data:d}=Ks.useSession(),u=d?.user?.id,f=c?.activeTask??null,m=!!(u&&f?.created_by&&f.created_by!==u);let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Ju,{size:32}),e[2]=p):p=e[2];let _;e[3]!==l.icon||e[4]!==l.title?(_=n.jsx(Vt,{icon:l.icon,name:l.title,size:"lg",fallbackIcon:p,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),e[3]=l.icon,e[4]=l.title,e[5]=_):_=e[5];let v;e[6]!==l.title?(v=n.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:l.title}),e[6]=l.title,e[7]=v):v=e[7];const x=l.description??"Ask anything about configuring model providers or using MCP Mesh.";let y;e[8]!==x?(y=n.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:x}),e[8]=x,e[9]=y):y=e[9];let g;e[10]!==_||e[11]!==v||e[12]!==y?(g=n.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[_,v,y]}),e[10]=_,e[11]=v,e[12]=y,e[13]=g):g=e[13];const b=c?.currentBranch??null;let S;e[14]!==h||e[15]!==b?(S=n.jsx(ku,{virtualMcp:h,currentBranch:b}),e[14]=h,e[15]=b,e[16]=S):S=e[16];let w;e[17]!==s?(w=n.jsx(Oe.Input,{onOpenContextPanel:s}),e[17]=s,e[18]=w):w=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(Oe.IceBreakers,{}),e[19]=k):k=e[19];let N;return e[20]!==m||e[21]!==w||e[22]!==g||e[23]!==S?(N=n.jsx(mp,{readOnly:m,identity:g,aboveRow:S,input:w,iceBreakers:k}),e[20]=m,e[21]=w,e[22]=g,e[23]=S,e[24]=N):N=e[24],N}function Fa(t){const e=H.c(17),{outputs:s,collapsed:i,onToggle:r,variant:o}=t,a=o==="card"?"rounded-xl border border-border bg-muted/95 shadow-sm backdrop-blur-sm":"border-b border-border bg-background";let l;e[0]!==a?(l=ce(a),e[0]=a,e[1]=l):l=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Files in this task"}),e[2]=h):h=e[2];const c=i&&"-rotate-90";let d;e[3]!==c?(d=ce("size-4 text-muted-foreground transition-transform",c),e[3]=c,e[4]=d):d=e[4];let u;e[5]!==d?(u=n.jsx(js,{className:d}),e[5]=d,e[6]=u):u=e[6];let f;e[7]!==r||e[8]!==u?(f=n.jsxs("button",{type:"button",onClick:r,className:"flex w-full items-center justify-between px-3 py-2.5 text-left",children:[h,u]}),e[7]=r,e[8]=u,e[9]=f):f=e[9];let m;e[10]!==i||e[11]!==s?(m=!i&&n.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map(_p)}),e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;return e[13]!==l||e[14]!==f||e[15]!==m?(p=n.jsxs("div",{className:l,children:[f,m]}),e[13]=l,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function _p(t){return n.jsx(Uu,{file:t},t.key)}function gp(){const t=H.c(13),e=Cc()?.taskId??null,s=Wu();let i;t[0]!==s?(i={enabled:s},t[0]=s,t[1]=i):i=t[1];const{data:r}=jc(e,i),[o,a]=R.useState(!1),[l,h]=R.useState(!0);if(!e||!r||r.length===0)return null;let c;t[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(xp),t[2]=c):c=t[2];let d;t[3]!==o||t[4]!==r?(d=n.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:n.jsx(Fa,{variant:"card",outputs:r,collapsed:o,onToggle:c})}),t[3]=o,t[4]=r,t[5]=d):d=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>h(vp),t[6]=u):u=t[6];let f;t[7]!==l||t[8]!==r?(f=n.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:n.jsx(Fa,{variant:"bar",outputs:r,collapsed:l,onToggle:u})}),t[7]=l,t[8]=r,t[9]=f):f=t[9];let m;return t[10]!==d||t[11]!==f?(m=n.jsxs(n.Fragment,{children:[d,f]}),t[10]=d,t[11]=f,t[12]=m):m=t[12],m}function vp(t){return!t}function xp(t){return!t}function bp(){const t=H.c(28),{org:e}=Ne(),s=Nc(),{isChatEmpty:i}=ks(),[r,o]=R.useState("chat"),a=ju(),{selectedVirtualMcp:l}=Ro();let h;t[0]!==e.id?(h=To(e.id),t[0]=e.id,t[1]=h):h=t[1];const u=It((l??h).id),f=Mu(),m=Ys(u?.metadata);if(s.length===0&&!(m&&Nu(f))){let P;return t[2]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(Oe,{className:"animate-in fade-in-0 duration-200",children:n.jsx(Oe.Main,{className:"flex flex-col items-center",children:n.jsx(Oe.EmptyState,{children:n.jsx(Oe.NoAiProviderEmptyState,{})})})}),t[2]=P):P=t[2],P}let _;t[3]!==a.hasDecoKey||t[4]!==a.hasOnlyDecoProvider||t[5]!==a.isLoading||t[6]!==a.isZeroBalance||t[7]!==i||t[8]!==e.id?(_=a.hasDecoKey&&a.isZeroBalance&&a.hasOnlyDecoProvider&&!a.isLoading&&i&&!Eu(e.id),t[3]=a.hasDecoKey,t[4]=a.hasOnlyDecoProvider,t[5]=a.isLoading,t[6]=a.isZeroBalance,t[7]=i,t[8]=e.id,t[9]=_):_=t[9];const v=_;let x;t[10]!==v?(x=v&&n.jsx(Oe.CreditsEmptyState,{}),t[10]=v,t[11]=x):x=t[11];const y=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let g;t[12]!==y?(g=ce("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",y),t[12]=y,t[13]=g):g=t[13];let b;t[14]!==i?(b=i?n.jsx(Oe.Main,{children:n.jsx(pp,{onOpenContextPanel:()=>o("context")})}):n.jsxs(n.Fragment,{children:[n.jsxs(Oe.Main,{className:"relative flex flex-col overflow-hidden @container",children:[n.jsx(gp,{}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Oe.Messages,{})})]}),n.jsx(Oe.Footer,{children:n.jsx(Oe.Input,{onOpenContextPanel:()=>o("context")})})]}),t[14]=i,t[15]=b):b=t[15];let S;t[16]!==g||t[17]!==b?(S=n.jsx("div",{className:g,children:b}),t[16]=g,t[17]=b,t[18]=S):S=t[18];const w=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let k;t[19]!==w?(k=ce("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",w),t[19]=w,t[20]=k):k=t[20];let N;t[21]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(sp,{back:!0,onClose:()=>o("chat")}),t[21]=N):N=t[21];let D;t[22]!==k?(D=n.jsx("div",{className:k,children:N}),t[22]=k,t[23]=D):D=t[23];let I;return t[24]!==D||t[25]!==x||t[26]!==S?(I=n.jsxs(Oe,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[x,S,D]}),t[24]=D,t[25]=x,t[26]=S,t[27]=I):I=t[27],I}function sh(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Oe.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Ht,{fallback:e,children:n.jsx(R.Suspense,{fallback:n.jsx(Oe.Skeleton,{}),children:n.jsx(bp,{})})}),t[1]=s):s=t[1],s}function yp(t){const e=t.entityMetadata?.defaultMainView??null,s=e==null||e.type==="chat",i=t.mainParamPresent?t.mainParamValue!=="0":!s,r=s?!0:t.entityMetadata?.chatDefaultOpen??!1;return{mainOpen:i,chatOpen:r}}function Ha(t,e){return t&&e?{chat:45,main:55}:t&&!e?{chat:100,main:0}:!t&&e?{chat:0,main:100}:{chat:0,main:0}}function Sp(t,e){return t===1?!0:t===0?!1:e}function wp(t,e){const s=Qt(),i=No({strict:!1}),r=vc({strict:!1}),{create:o}=Rf(),{locator:a}=Ne(),{virtualMcpId:l,orgSlug:h,isAgentRoute:c}=e,d=yp({entityMetadata:t,mainParamPresent:i.main!==void 0,mainParamValue:i.main}),u=Sp(i.chat,d.chatOpen),f=d.mainOpen,m=R.useRef(crypto.randomUUID()),p=r.taskId??m.current,_="/$org/$taskId",v=D=>({org:h,taskId:D}),x=c?{virtualmcpid:l}:{},y=(D,I)=>{s({to:_,params:v(p),search:P=>({...P,...D}),replace:I?.replace??!1})},g=(D,I)=>{s({to:_,params:v(D),search:P=>{const j={};return I?j.virtualmcpid=I:c&&(j.virtualmcpid=l),j}})},b=()=>{f?y({main:"0"},{replace:!0}):y({main:In(t)},{replace:!0})},S=()=>{y({chat:u?0:1},{replace:!0})},w=()=>{u||y({chat:1},{replace:!0})},k=async()=>{const D=crypto.randomUUID(),I=Zu(h,a,p);try{await o({id:D,virtual_mcp_id:l,...I?{branch:I}:{}})}catch{}s({to:_,params:v(D),search:P=>({...x,chat:1})})},N=D=>{y({main:D},{replace:!0})};return{taskId:p,mainOpen:f,chatOpen:u,mainParam:i.main,setTaskId:g,toggleMain:b,toggleChat:S,openChat:w,createNewTask:k,openTab:N}}const Ko=45;function ih(t,e=Ko){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function Cp(t){return ih(t,Ko)}function kp(){const t=H.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=_u.decoChatPanelWidth(),t[0]=e):e=t[0];const[s,i]=pu(e,Cp);let r;t[1]!==s?(r=ih(s,Ko),t[1]=s,t[2]=r):r=t[2];const o=r;let a;return t[3]!==i||t[4]!==o?(a=[o,i],t[3]=i,t[4]=o,t[5]=a):a=t[5],a}function jp(t){try{return JSON.parse(t)}catch{return null}}function Np(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(o=>o.type==="text")?.text,i=s?jp(s):null,r=e.structuredContent;return r==null?i:typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0?i??r:r}function Rs(t){const e=Np(t);return e===null?null:e}function Vo(t){if(!t)return null;const e=t.match(/\/pull\/(\d+)\b/);if(!e)return null;const s=Number(e[1]);return Number.isFinite(s)&&s>0?s:null}function Ep(t){if(!t||typeof t!="object")return null;const e=t.content?.find(r=>r.type==="text")?.text;if(!e)return null;const s=e.match(/https:\/\/github\.com\/[^\s"]+\/pull\/\d+/)?.[0],i=Vo(s);return!i||!s?null:{number:i,htmlUrl:s}}const Wa=/[\r\n<>]/,Tp=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function Ki(t){const e=t?.userName?.trim();if(!e||Wa.test(e))return null;const s=t?.userEmail?.trim();return!s||Wa.test(s)?{userName:e}:Tp.test(s)?{userName:e,userEmail:s}:{userName:e}}function Rp(t){return t.split(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sections-editor-CkUdgmBv.js","assets/index-BD0Vs-CA.js","assets/index-D5dv4kfs.css","assets/ChevronDown-R842NQ1U.js","assets/ChevronRight-ZAMgnesO.js","assets/ChevronUp-BF-b-Nnx.js","assets/agent-icon-Cdddea4y.js","assets/AlertCircle-BQdZzjHT.js","assets/Tool01-N1xf4ThS.js","assets/SwitchHorizontal01-CgqCR4Yz.js","assets/RefreshCcw01-Ucb5geTM.js","assets/XCircle-C2jaCgsw.js","assets/ArrowUpRight-CeE0rmVq.js","assets/ZapSquare-dqx_OfE2.js","assets/Users03-zhbxBBX-.js","assets/CheckCircle-DH7rdvLk.js","assets/Check-BC0oyj5b.js","assets/ChevronLeft-4yzLonaZ.js","assets/DotsVertical-qBVhBkwp.js","assets/Container-DYeY832q.js","assets/Eye-DT8d17_D.js","assets/ZoomOut-BRLKFRz0.js","assets/Globe01-Dq1s-8U-.js","assets/FilterLines-0_3CSvNU.js","assets/Star01-3amhnFQB.js","assets/Palette-DgrVm9Lf.js","assets/HardDrive-BSOkGCav.js","assets/Stars02-BjwC_VwI.js","assets/Key01-6ihQsQH5.js","assets/LayoutLeft-DW_oy1t7.js","assets/LinkExternal01-Dr7L27C5.js","assets/Monitor01-B1nvgGLS.js","assets/Sun-D7IGJ5Qz.js","assets/Play-Irj6Snpi.js","assets/Plus-282oO62Z.js","assets/SearchMd-QjKlDFdA.js","assets/Settings02-C6oxZAMK.js","assets/Shield01-D7qNI860.js","assets/Stars01-D-S4IK6K.js","assets/Trash01-C5lXrAXB.js","assets/Upload01-CRQffHbJ.js","assets/User01-sifBP7dG.js","assets/Users01-CqOg_Qlq.js","assets/XClose-Dp1ChvR4.js","assets/X-CY5EOp8o.js","assets/Zap-DQUf40SC.js","assets/scroll-area-DMkk7C5X.js","assets/select-877_XRoe.js","assets/tooltip-BXkAyk_s.js","assets/dialog-ZmuU49gf.js","assets/input-BdjjFpfr.js","assets/dropdown-menu-CxtJkFj7.js","assets/sortable.esm-ZerYvs9l.js","assets/connection-slug-eyAPH6o3.js","assets/connection-card-BMM5SXL2.js","assets/use-registry-connections-Bk2SQzaL.js","assets/use-connection-CFCjzYr3.js","assets/use-collections-HtykhO8E.js","assets/constants-D3TwDQx3.js","assets/use-organization-settings-DyFbECeN.js","assets/useInfiniteQuery-BXWzDcVY.js","assets/infiniteQueryObserver-sLZJuWs1.js","assets/extract-connection-data-BxLUPS35.js","assets/generate-id-DCuwKdwd.js","assets/collections-CjKCiyyJ.js","assets/card-Dj9cg3CK.js","assets/integration-icon-DjqEnfq3.js","assets/collection-search-DcKd-0OB.js","assets/collection-tabs-B68kf5RK.js","assets/badge-9pGcMSo9.js","assets/drawer-gGw1fcoY.js","assets/form-Bb30Dtd4.js","assets/label-C5JCVP3P.js","assets/textarea-D91MKpZC.js","assets/connection-form-helpers-DQIelH5O.js","assets/use-infinite-scroll--wh3054T.js","assets/useSuspenseInfiniteQuery-C3HFhtdp.js","assets/schema-form-BQLwCXS8.js","assets/calendar-VsOQOecc.js","assets/popover-cTB9T6zY.js","assets/switch-Bazzokl_.js","assets/image-field-BUiTz_KS.js","assets/skeleton-CoJAV87H.js","assets/tabs-D9ntWD-6.js","assets/use-file-configs-BdoGIuji.js","assets/unwrap-tool-result-BYXdCQMg.js","assets/page-seo-form-CpoxmYxQ.js","assets/command-SwSMex4i.js","assets/index-Czyl40Yo.js","assets/add-section-modal-Ca9uYkx3.js","assets/agent-capabilities-CoD6HyyN.js","assets/pair-Bui7pRoY.js","assets/format-time-Cy7tTmZp.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/use-copy-D2WKzb4n.js","assets/file-type-icon-C7hLWFjD.js","assets/content-blocks-o63cs2vh.js","assets/types-j6zTjYLW.js","assets/chat-context-DaxTCgBq.js","assets/tab-id-DrhK90L3.js","assets/decopilot-sse-pool-BegF480x.js","assets/create-sse-subscription-BS5983N4.js","assets/use-virtual-mcp-Cvm4KLIO.js","assets/use-ai-providers-DuBmTMbG.js","assets/shell-layout-CH8oYCM2.js","assets/avatar-DZZ4PPWC.js","assets/required-auth-layout-RkDlrM0L.js","assets/useRouterState-ComuFEbk.js","assets/use-org-sso-BAFZBkLH.js","assets/use-navigate-to-agent-BU3cK_V3.js","assets/use-mcp-prompts-Cs73_aGi.js","assets/spinner-CYDSZGqh.js","assets/toggle-group-DGrm2vuO.js","assets/connect-desktop-dialog-BHLyUOHP.js","assets/agent-icons-CKU8GGl2.js","assets/checkbox-zURLZ3UX.js","assets/ai-providers-logos-DD3qZ33J.js","assets/settings-section-kr7Y9bP9.js","assets/index-C-7fxrkj.js","assets/question-004-sINsf4GQ.js","assets/shell-route-loading-Cn0fA0CZ.js","assets/sidebar-OlCqSXPX.js","assets/sheet-Dsz02SFl.js","assets/toolbar-Dy7jx2bJ.js","assets/use-create-virtual-mcp-D8DtJRBD.js","assets/github-repo-picker-ukQ8mlgx.js","assets/use-mcp-tools-C1gRGhR_.js","assets/alert-dialog-wo7djkDg.js","assets/index-Cov_Guzr.js","assets/use-org-auth-client-DDgSMc-B.js","assets/hover-card-BJCPsde9.js","assets/task-status-Sjdts0gR.js","assets/use-status-sounds-CvJbKYn3.js","assets/empty-state-Bp53vJ5J.js","assets/resizable-BRPR_6nf.js","assets/use-capability-4Bqq3Ptd.js","assets/header-tab-button-Ct59Qn2o.js","assets/index-CPp-3T8R.js","assets/user-Bkww3yLN.js","assets/tools-list-BmmPeFb6.js","assets/use-debounced-autosave-B_zQVx0C.js","assets/index-D3Ribt5F.js","assets/search-input-C-P2O70i.js","assets/use-secrets-7GF-cSiL.js","assets/formatDistanceToNow-Cb2QZZJn.js","assets/accordion-BU6HxGne.js","assets/view-mode-toggle-2ZW6tMJS.js","assets/select-model-C_cur-rH.js","assets/use-automations-ClchBd2q.js","assets/monaco-editor-D2Cgb5CL.js","assets/automation-runs-BxnZN2Rp.js","assets/table-Do8GxGTj.js","assets/use-members-PGJbXmC6.js","assets/automation-list-row-DrMmYGg2.js","assets/page-seo-sheet-Cni7GVIz.js","assets/file-explorer-C6G0_-8u.js","assets/app-editor-BivZp6Yr.js","assets/save-status-Cs4ql7Lz.js","assets/post-editor-N9xx8HEl.js","assets/primitives-BY4b05zg.js","assets/record-editor-tc1QZAky.js","assets/seo-editor-D8nPTKAd.js","assets/project-app-view-CLSVHcb8.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{e as H,r as R,c as ce,j as n,l as we,q as Ne,b as Ks,E as Ht,f as Qt,d as No,g as vc,p as pu,L as _u,n as Vs,K as Dt,s as gu,o as ae,B as se,v as xc,V as vu,t as Le,w as bc,x as xu,y as Ur,z as Di,C as vt,D as bu,F as qs,G as yc,H as yu,I as Su,J as Ea,M as wu,P as Kr,Q as Cu,a as Gs,R as dr,T as gi,U as jt,_ as Kt}from"./index-BD0Vs-CA.js";import{C as Oe,a as ku,u as ju,b as Ys,h as Nu,w as Eu,c as Sc,d as Eo,s as Dn,T as Tu,e as Ru,g as Pu,f as Du}from"./agent-capabilities-CoD6HyyN.js";import{g as To,u as tt,S as Cs,a as wc}from"./constants-D3TwDQx3.js";import{u as It,a as Au,b as Iu,c as Bu}from"./use-virtual-mcp-Cvm4KLIO.js";import{a as ks,b as es,c as Ro,d as Cc,u as Mu,t as Lu,e as Ou,f as $u}from"./chat-context-DaxTCgBq.js";import{i as zi}from"./AlertCircle-BQdZzjHT.js";import{i as kc}from"./CheckCircle-DH7rdvLk.js";import{n as Ta}from"./ChevronLeft-4yzLonaZ.js";import{i as zu,a as Fu}from"./XCircle-C2jaCgsw.js";import{s as fs}from"./XClose-Dp1ChvR4.js";import{c as Hu,u as Wu,a as jc,O as Uu,t as Ra,G as Ku,g as Vu,s as qu,C as Gu,b as Yu,d as Xu}from"./pair-Bui7pRoY.js";import{I as Vt}from"./integration-icon-DjqEnfq3.js";import{a as Ju}from"./Users03-zhbxBBX-.js";import{t as js}from"./ChevronDown-R842NQ1U.js";import{u as Nc}from"./use-ai-providers-DuBmTMbG.js";import{r as Zu,u as Po,i as Qu}from"./shell-layout-CH8oYCM2.js";import{b as ef,a as tf}from"./shell-route-loading-Cn0fA0CZ.js";import{u as sf}from"./sidebar-OlCqSXPX.js";import{S as rf,a as nf,b as of}from"./sheet-Dsz02SFl.js";import{u as Ec,T as Te,a as Re,b as Pe,c as Tc}from"./tooltip-BXkAyk_s.js";import{i as Ai,a as Vr,b as Rc,c as af,p as qr,g as Gr,d as Do,e as Pc,h as An,f as ln,j as Pa,A as Da,k as lf,l as cf,n as hf,m as df,o as uf,t as ff,q as mf,r as Yr,s as pf,u as Aa,v as Ia,w as _f,x as gf,y as vf,z as xf,B as Ao,C as Sr,D as Io,E as Dc,F as Ac,G as bf,H as yf,I as Sf,J as wf,K as Cf,L as Ba,M as kf,N as jf,O as Ci,P as Nf,Q as Ic,R as Bc,S as Ef}from"./agent-icon-Cdddea4y.js";import{u as Tf}from"./use-status-sounds-CvJbKYn3.js";import{E as wr}from"./empty-state-Bp53vJ5J.js";import{u as Rf,r as In,a as Pf,p as Mc,f as Ma,b as Lc,c as Oc,d as $c,e as Df,F as Af,i as If,g as Bf,h as Mf,j as Lf,k as Of}from"./tab-id-DrhK90L3.js";import{g as Xs,A as $f}from"./sortable.esm-ZerYvs9l.js";import{T as La,a as Bn}from"./toolbar-Dy7jx2bJ.js";import{R as zc,a as zf,b as Ff}from"./resizable-BRPR_6nf.js";import{i as Fi,n as Hf}from"./Globe01-Dq1s-8U-.js";import{i as Fc}from"./Monitor01-B1nvgGLS.js";import{u as Hi,a as Bo,b as Wf}from"./use-connection-CFCjzYr3.js";import{u as Xr,a as Uf,b as Kf}from"./use-mcp-tools-C1gRGhR_.js";import{u as Vf}from"./use-capability-4Bqq3Ptd.js";import{F as Mo,M as Lo}from"./file-type-icon-C7hLWFjD.js";import{g as qf,H as Hc,F as Gf,a as Yf,f as Xf,u as Jf,b as Zf,e as Qf,c as em}from"./header-tab-button-Ct59Qn2o.js";import{i as Wc,a as Oa,b as tm}from"./ZoomOut-BRLKFRz0.js";import{P as Ns,a as Es,b as Ts}from"./popover-cTB9T6zY.js";import{S as Uc}from"./spinner-CYDSZGqh.js";import{D as Js,a as Zs,b as Qs,c as et,d as ur,e as sm,f as im,g as rm}from"./dropdown-menu-CxtJkFj7.js";import{D as Bt,a as Mt,b as ts,c as ss,d as ei,e as Oo}from"./dialog-ZmuU49gf.js";import{I as qe}from"./input-BdjjFpfr.js";import{T as xs,a as $o,b as ki,c as zo}from"./tabs-D9ntWD-6.js";import{T as Cr}from"./textarea-D91MKpZC.js";import{a as ds,s as nm}from"./Eye-DT8d17_D.js";import{t as Jr}from"./Stars01-D-S4IK6K.js";import{l as om,w as am}from"./index-CPp-3T8R.js";import{i as lm}from"./ChevronRight-ZAMgnesO.js";import{g as cm}from"./generate-id-DCuwKdwd.js";import{u as hm,g as dm}from"./types-j6zTjYLW.js";import{U as Kc}from"./user-Bkww3yLN.js";import{T as um,u as Vc}from"./tools-list-BmmPeFb6.js";import{u as fm}from"./unwrap-tool-result-BYXdCQMg.js";import{s as qc,g as mm}from"./connection-slug-eyAPH6o3.js";import{A as kr,a as jr,b as Nr,c as Er,d as Tr,e as Rr,f as Pr,g as Dr}from"./alert-dialog-wo7djkDg.js";import{C as Gc,a as Mn}from"./card-Dj9cg3CK.js";import{L as Ct}from"./label-C5JCVP3P.js";import{S as Et,a as Tt,b as Rt,c as lt,d as Pt}from"./select-877_XRoe.js";import{S as Ar}from"./switch-Bazzokl_.js";import{i as Fs}from"./Play-Irj6Snpi.js";import{s as At}from"./Plus-282oO62Z.js";import{a as pm}from"./Settings02-C6oxZAMK.js";import{s as Ii}from"./Trash01-C5lXrAXB.js";import{u as Ir}from"./use-debounced-autosave-B_zQVx0C.js";import{S as Zr}from"./scroll-area-DMkk7C5X.js";import{i as Fo}from"./SearchMd-QjKlDFdA.js";import{i as _m}from"./Upload01-CRQffHbJ.js";import{i as gm}from"./LayoutLeft-DW_oy1t7.js";import{P as Nt}from"./index-D3Ribt5F.js";import{C as Qr}from"./checkbox-zURLZ3UX.js";import{S as Yc}from"./search-input-C-P2O70i.js";import{C as Xc}from"./collection-tabs-B68kf5RK.js";import{u as vm}from"./use-mcp-prompts-Cs73_aGi.js";import{D as xm,a as bm,b as ym}from"./drawer-gGw1fcoY.js";import{i as Wi}from"./Check-BC0oyj5b.js";import{i as Jc}from"./Key01-6ihQsQH5.js";import{S as gs}from"./skeleton-CoJAV87H.js";import{s as Sm}from"./User01-sifBP7dG.js";import{t as Ho}from"./Users01-CqOg_Qlq.js";import{u as wm,a as Cm}from"./use-secrets-7GF-cSiL.js";import{G as km}from"./github-repo-picker-ukQ8mlgx.js";import{f as jm}from"./formatDistanceToNow-Cb2QZZJn.js";import{n as ti}from"./LinkExternal01-Dr7L27C5.js";import{A as Nm,a as Em,b as Tm,c as Rm}from"./accordion-BU6HxGne.js";import{s as Hs}from"./Star01-3amhnFQB.js";import{i as Zc}from"./Stars02-BjwC_VwI.js";import{V as Pm}from"./view-mode-toggle-2ZW6tMJS.js";import{n as Qc}from"./ZapSquare-dqx_OfE2.js";import{i as Wo,a as Dm,b as Uo}from"./Tool01-N1xf4ThS.js";import{c as eh,i as Am}from"./SwitchHorizontal01-CgqCR4Yz.js";import{B as Im}from"./badge-9pGcMSo9.js";import{C as Bm,a as $a,b as Mm,c as Lm,d as Om,e as $m}from"./command-SwSMex4i.js";import{M as zm}from"./select-model-C_cur-rH.js";import{u as Ui,a as Fm,b as Hm,c as Wm,d as Um}from"./use-automations-ClchBd2q.js";import{i as th}from"./RefreshCcw01-Ucb5geTM.js";import{i as Bi}from"./Zap-DQUf40SC.js";import{M as Km}from"./monaco-editor-D2Cgb5CL.js";import{A as Vm}from"./automation-runs-BxnZN2Rp.js";import{A as qm}from"./automation-list-row-DrMmYGg2.js";import{i as Gm}from"./X-CY5EOp8o.js";function li(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function za(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function Ym(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Xm(t){const e=H.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Jm),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=n.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=r):r=e[3],r}function Jm(t){return n.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[n.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),n.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function Zm(t){const e=H.c(30),{userTokens:s,assistantTokens:i,otherTokens:r}=t,o=s+i+r,a=o>0?s/o*100:0,l=o>0?i/o*100:0,h=o>0?r/o*100:0;let c;e[0]!==a?(c=a>0&&n.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=c):c=e[1];let d;e[2]!==l?(d=l>0&&n.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=d):d=e[3];let u;e[4]!==h?(u=h>0&&n.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=u):u=e[5];let f;e[6]!==c||e[7]!==d||e[8]!==u?(f=n.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,d,u]}),e[6]=c,e[7]=d,e[8]=u,e[9]=f):f=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=m):m=e[10];let p;e[11]!==a?(p=a.toFixed(1),e[11]=a,e[12]=p):p=e[12];let _;e[13]!==p?(_=n.jsxs("div",{className:"flex items-center gap-1.5",children:[m,n.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",p,"%"]})]}),e[13]=p,e[14]=_):_=e[14];let v;e[15]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=v):v=e[15];let x;e[16]!==l?(x=l.toFixed(1),e[16]=l,e[17]=x):x=e[17];let y;e[18]!==x?(y=n.jsxs("div",{className:"flex items-center gap-1.5",children:[v,n.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",x,"%"]})]}),e[18]=x,e[19]=y):y=e[19];let g;e[20]!==h||e[21]!==r?(g=r>0&&n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),n.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",h.toFixed(1),"%"]})]}),e[20]=h,e[21]=r,e[22]=g):g=e[22];let b;e[23]!==y||e[24]!==g||e[25]!==_?(b=n.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[_,y,g]}),e[23]=y,e[24]=g,e[25]=_,e[26]=b):b=e[26];let S;return e[27]!==b||e[28]!==f?(S=n.jsxs("div",{className:"flex flex-col gap-2",children:[f,b]}),e[27]=b,e[28]=f,e[29]=S):S=e[29],S}function Qm(t){const e=H.c(11),{agentId:s,isError:i}=t,r=It(s),o=r?.title??"Subtask",a=r?.icon??null;let l;e[0]!==a||e[1]!==o?(l=n.jsx(Vt,{icon:a,name:o,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=o,e[2]=l):l=e[2];const h=i?"text-destructive":"text-foreground";let c;e[3]!==h?(c=ce("shrink-0 font-medium",h),e[3]=h,e[4]=c):c=e[4];let d;e[5]!==o||e[6]!==c?(d=n.jsx("span",{className:c,children:o}),e[5]=o,e[6]=c,e[7]=d):d=e[7];let u;return e[8]!==l||e[9]!==d?(u=n.jsxs(n.Fragment,{children:[l,d]}),e[8]=l,e[9]=d,e[10]=u):u=e[10],u}function ep(t){const e=H.c(5),{isError:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(Vt,{icon:null,name:"Subtask",size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=i):i=e[0];const r=s?"text-destructive":"text-foreground";let o;e[1]!==r?(o=ce("shrink-0 font-medium",r),e[1]=r,e[2]=o):o=e[2];let a;return e[3]!==o?(a=n.jsxs(n.Fragment,{children:[i,n.jsx("span",{className:o,children:"Subtask"})]}),e[3]=o,e[4]=a):a=e[4],a}function tp(t){const e=H.c(18),{part:s}=t,i=s.input?.agent_id,r=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,o=s.state==="output-error",a=s.state==="approval-requested";let l;e[0]!==o?(l=n.jsx(ep,{isError:o}),e[0]=o,e[1]=l):l=e[1];let h;e[2]!==i||e[3]!==o?(h=n.jsx(Qm,{agentId:i,isError:o}),e[2]=i,e[3]=o,e[4]=h):h=e[4];let c;e[5]!==l||e[6]!==h?(c=n.jsx(R.Suspense,{fallback:l,children:h}),e[5]=l,e[6]=h,e[7]=c):c=e[7];let d;e[8]!==s.input?(d=s.input?.prompt&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-muted-foreground/50",children:"·"}),n.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==o||e[12]!==r?(u=n.jsx("span",{className:"ml-auto shrink-0",children:r?n.jsx(we,{size:12,className:"animate-spin text-muted-foreground"}):o?n.jsx(zu,{size:12,className:"text-destructive"}):a?n.jsx(zi,{size:12,className:"text-warning"}):n.jsx(kc,{size:12,className:"text-emerald-500"})}),e[10]=a,e[11]=o,e[12]=r,e[13]=u):u=e[13];let f;return e[14]!==c||e[15]!==d||e[16]!==u?(f=n.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[c,d,u]}),e[14]=c,e[15]=d,e[16]=u,e[17]=f):f=e[17],f}function sp(t){const e=H.c(55),{onClose:s,back:i,className:r}=t,[o,a]=R.useState(null),{messages:l}=ks(),{activeTask:h}=es(),{selectedModel:c,selectedVirtualMcp:d}=Ro();let u,f,m,p,_,v,x,y;if(e[0]!==h||e[1]!==i||e[2]!==r||e[3]!==l||e[4]!==s||e[5]!==o?.id||e[6]!==c||e[7]!==d?.title){y=Symbol.for("react.early_return_sentinel");e:{const S=Hu(l),w=[...l].reverse().find(fp),k=w?.metadata?.usage,N=w?.metadata?.modelLimits?.contextWindow??c?.limits?.contextWindow??null,D=k?.contextTokens??0,I=N&&N>0?(D/N*100).toFixed(1):null,P=l;let j;e[16]!==P?(j=P.filter(up).reduce(dp,0),e[16]=P,e[17]=j):j=e[17];const C=j,A=l;let E;e[18]!==A?(E=A.filter(hp).reduce(cp,0),e[18]=A,e[19]=E):E=e[19];const T=E,M=Math.max(0,S.totalTokens-C-T),B=l[0],O=l.at(-1),F=B?.metadata?.created_at??h?.created_at,W=O?.metadata?.created_at??h?.updated_at,$=l.filter(lp),U=l.flatMap(op),Y=c?.modelId?Ym(c.modelId):"—",V=d?.title??"Decopilot",K=[{label:"Session",value:h?.title??"New chat"},{label:"Messages",value:$.length},{label:"Agent",value:V},{label:"Model",value:Y},{label:"Context Limit",value:N?li(N):"—"},{label:"Session Tokens (billed)",value:S.totalTokens>0?li(S.totalTokens):"0"},{label:"Usage",value:I!==null?`${I}%`:"—"},{label:"Input Tokens",value:S.inputTokens>0?li(S.inputTokens):"0"},{label:"Output Tokens",value:S.outputTokens>0?li(S.outputTokens):"0"},{label:"Reasoning Tokens",value:S.reasoningTokens>0?li(S.reasoningTokens):"0"},{label:"Cost",value:S.cost>0?`$${S.cost<.001?S.cost.toFixed(6):S.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:za(F)},{label:"Last Activity",value:za(W)}];if(!h&&$.length===0){let L;e[20]!==r?(L=ce("flex flex-col h-full w-full border-l border-border bg-background",r),e[20]=r,e[21]=L):L=e[21];let ee;e[22]===Symbol.for("react.memo_cache_sentinel")?(ee=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[22]=ee):ee=e[22];let te;e[23]!==i?(te=i?n.jsx(Ta,{size:14,className:"text-muted-foreground"}):n.jsx(fs,{size:14,className:"text-muted-foreground"}),e[23]=i,e[24]=te):te=e[24];let G;e[25]!==s||e[26]!==te?(G=n.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[ee,n.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:te})]}),e[25]=s,e[26]=te,e[27]=G):G=e[27];let z;e[28]===Symbol.for("react.memo_cache_sentinel")?(z=n.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:n.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[28]=z):z=e[28];let le;e[29]!==L||e[30]!==G?(le=n.jsxs("div",{className:L,children:[G,z]}),e[29]=L,e[30]=G,e[31]=le):le=e[31],y=le;break e}e[32]!==r?(v=ce("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[32]=r,e[33]=v):v=e[33];let q;e[34]===Symbol.for("react.memo_cache_sentinel")?(q=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[34]=q):q=e[34];let Q;e[35]!==i?(Q=i?n.jsx(Ta,{size:14}):n.jsx(fs,{size:14}),e[35]=i,e[36]=Q):Q=e[36],e[37]!==s||e[38]!==Q?(x=n.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[q,n.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:Q})]}),e[37]=s,e[38]=Q,e[39]=x):x=e[39],u="flex flex-col gap-8 p-6",f=U.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),n.jsx("div",{className:"flex flex-col gap-1",children:U.map(np)})]}),m=n.jsx(Xm,{items:K});let oe;e[40]===Symbol.for("react.memo_cache_sentinel")?(oe=n.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[40]=oe):oe=e[40],e[41]!==T||e[42]!==M||e[43]!==C?(p=n.jsxs("div",{className:"flex flex-col gap-3",children:[oe,n.jsx(Zm,{userTokens:C,assistantTokens:T,otherTokens:M})]}),e[41]=T,e[42]=M,e[43]=C,e[44]=p):p=e[44],_=$.length>0&&n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),n.jsx("div",{className:"flex flex-col gap-1",children:$.map(L=>{const ee=L.metadata?.created_at,te=o?.id===L.id;return n.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[n.jsxs("button",{type:"button",onClick:()=>a(te?null:L),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx("span",{className:ce("shrink-0 font-medium",L.role==="user"?"text-chart-1":"text-chart-2"),children:L.role}),n.jsx("span",{className:"text-muted-foreground",children:"•"}),n.jsx("span",{className:"truncate text-muted-foreground font-mono",children:L.id})]}),ee&&n.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(ee).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),te&&n.jsxs(n.Fragment,{children:[L.role==="assistant"&&(()=>{const G=L.metadata?._request;if(!G)return null;const z=G.systemSections??[],le=Math.max(1,...z.map(rp)),ue=z.reduce(ip,0);return n.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"font-medium text-foreground",children:"Request"}),n.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[G.activeTools??0," / ",G.tools??0," ","tools active"]})]}),z.length>0&&n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("div",{className:"text-muted-foreground",children:["System prompt"," ",n.jsxs("span",{className:"tabular-nums",children:["~",Math.round(ue/4).toLocaleString()," ","tok"]})]}),z.map((me,he)=>{const ie=me.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${he}`,ve=me.chars/le*100,re=Math.round(me.chars/4);return n.jsxs("div",{className:"space-y-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"font-mono text-foreground truncate",children:ie}),n.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",re.toLocaleString()," tok"]})]}),n.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:n.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${ve}%`}})})]},he)})]})]})})(),n.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(L,null,2)})]})]},L.id)})})]})}e[0]=h,e[1]=i,e[2]=r,e[3]=l,e[4]=s,e[5]=o?.id,e[6]=c,e[7]=d?.title,e[8]=u,e[9]=f,e[10]=m,e[11]=p,e[12]=_,e[13]=v,e[14]=x,e[15]=y}else u=e[8],f=e[9],m=e[10],p=e[11],_=e[12],v=e[13],x=e[14],y=e[15];if(y!==Symbol.for("react.early_return_sentinel"))return y;let g;e[45]!==u||e[46]!==f||e[47]!==m||e[48]!==p||e[49]!==_?(g=n.jsxs("div",{className:u,children:[f,m,p,_]}),e[45]=u,e[46]=f,e[47]=m,e[48]=p,e[49]=_,e[50]=g):g=e[50];let b;return e[51]!==v||e[52]!==x||e[53]!==g?(b=n.jsxs("div",{className:v,children:[x,g]}),e[51]=v,e[52]=x,e[53]=g,e[54]=b):b=e[54],b}function ip(t,e){return t+e.chars}function rp(t){return t.chars}function np(t,e){return n.jsx(tp,{part:t},e)}function op(t){return(t.parts??[]).filter(ap)}function ap(t){return t.type==="tool-subtask"}function lp(t){return t.role!=="system"}function cp(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function hp(t){return t.role==="assistant"}function dp(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function up(t){return t.role==="user"}function fp(t){return t.role==="assistant"&&t.metadata?.usage}function mp(t){const e=H.c(13),{readOnly:s,identity:i,aboveRow:r,input:o,iceBreakers:a}=t,l=!s&&i?i:null;let h;e[0]!==r||e[1]!==s?(h=!s&&r?n.jsx("div",{"data-chat-above-row":"true",className:"@container/chat-bottom flex justify-start gap-1",children:r}):null,e[0]=r,e[1]=s,e[2]=h):h=e[2];let c;e[3]!==o||e[4]!==h?(c=n.jsxs("div",{className:"flex flex-col gap-2",children:[h,o]}),e[3]=o,e[4]=h,e[5]=c):c=e[5];let d;e[6]!==a||e[7]!==s?(d=!s&&a?n.jsx("div",{className:"w-full",children:a}):null,e[6]=a,e[7]=s,e[8]=d):d=e[8];let u;return e[9]!==l||e[10]!==c||e[11]!==d?(u=n.jsx("div",{"data-chat-centered":"true",className:"h-full w-full flex flex-col items-center justify-center px-4 gap-6",children:n.jsxs("div",{className:"w-full max-w-3xl flex flex-col gap-6",children:[l,c,d]})}),e[9]=l,e[10]=c,e[11]=d,e[12]=u):u=e[12],u}function pp(t){const e=H.c(25),{onOpenContextPanel:s}=t,{org:i}=Ne(),{selectedVirtualMcp:r}=Ro();let o;e[0]!==i.id?(o=To(i.id),e[0]=i.id,e[1]=o):o=e[1];const l=r??o,h=It(l.id),c=Cc(),{data:d}=Ks.useSession(),u=d?.user?.id,f=c?.activeTask??null,m=!!(u&&f?.created_by&&f.created_by!==u);let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(Ju,{size:32}),e[2]=p):p=e[2];let _;e[3]!==l.icon||e[4]!==l.title?(_=n.jsx(Vt,{icon:l.icon,name:l.title,size:"lg",fallbackIcon:p,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),e[3]=l.icon,e[4]=l.title,e[5]=_):_=e[5];let v;e[6]!==l.title?(v=n.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:l.title}),e[6]=l.title,e[7]=v):v=e[7];const x=l.description??"Ask anything about configuring model providers or using MCP Mesh.";let y;e[8]!==x?(y=n.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:x}),e[8]=x,e[9]=y):y=e[9];let g;e[10]!==_||e[11]!==v||e[12]!==y?(g=n.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[_,v,y]}),e[10]=_,e[11]=v,e[12]=y,e[13]=g):g=e[13];const b=c?.currentBranch??null;let S;e[14]!==h||e[15]!==b?(S=n.jsx(ku,{virtualMcp:h,currentBranch:b}),e[14]=h,e[15]=b,e[16]=S):S=e[16];let w;e[17]!==s?(w=n.jsx(Oe.Input,{onOpenContextPanel:s}),e[17]=s,e[18]=w):w=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx(Oe.IceBreakers,{}),e[19]=k):k=e[19];let N;return e[20]!==m||e[21]!==w||e[22]!==g||e[23]!==S?(N=n.jsx(mp,{readOnly:m,identity:g,aboveRow:S,input:w,iceBreakers:k}),e[20]=m,e[21]=w,e[22]=g,e[23]=S,e[24]=N):N=e[24],N}function Fa(t){const e=H.c(17),{outputs:s,collapsed:i,onToggle:r,variant:o}=t,a=o==="card"?"rounded-xl border border-border bg-muted/95 shadow-sm backdrop-blur-sm":"border-b border-border bg-background";let l;e[0]!==a?(l=ce(a),e[0]=a,e[1]=l):l=e[1];let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Files in this task"}),e[2]=h):h=e[2];const c=i&&"-rotate-90";let d;e[3]!==c?(d=ce("size-4 text-muted-foreground transition-transform",c),e[3]=c,e[4]=d):d=e[4];let u;e[5]!==d?(u=n.jsx(js,{className:d}),e[5]=d,e[6]=u):u=e[6];let f;e[7]!==r||e[8]!==u?(f=n.jsxs("button",{type:"button",onClick:r,className:"flex w-full items-center justify-between px-3 py-2.5 text-left",children:[h,u]}),e[7]=r,e[8]=u,e[9]=f):f=e[9];let m;e[10]!==i||e[11]!==s?(m=!i&&n.jsx("div",{className:"flex max-h-72 flex-col gap-1.5 overflow-y-auto px-2 pb-2",children:s.map(_p)}),e[10]=i,e[11]=s,e[12]=m):m=e[12];let p;return e[13]!==l||e[14]!==f||e[15]!==m?(p=n.jsxs("div",{className:l,children:[f,m]}),e[13]=l,e[14]=f,e[15]=m,e[16]=p):p=e[16],p}function _p(t){return n.jsx(Uu,{file:t},t.key)}function gp(){const t=H.c(13),e=Cc()?.taskId??null,s=Wu();let i;t[0]!==s?(i={enabled:s},t[0]=s,t[1]=i):i=t[1];const{data:r}=jc(e,i),[o,a]=R.useState(!1),[l,h]=R.useState(!0);if(!e||!r||r.length===0)return null;let c;t[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(xp),t[2]=c):c=t[2];let d;t[3]!==o||t[4]!==r?(d=n.jsx("div",{className:"absolute top-2 right-2 z-10 hidden w-72 @[1280px]:block",children:n.jsx(Fa,{variant:"card",outputs:r,collapsed:o,onToggle:c})}),t[3]=o,t[4]=r,t[5]=d):d=t[5];let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>h(vp),t[6]=u):u=t[6];let f;t[7]!==l||t[8]!==r?(f=n.jsx("div",{className:"shrink-0 @[1280px]:hidden",children:n.jsx(Fa,{variant:"bar",outputs:r,collapsed:l,onToggle:u})}),t[7]=l,t[8]=r,t[9]=f):f=t[9];let m;return t[10]!==d||t[11]!==f?(m=n.jsxs(n.Fragment,{children:[d,f]}),t[10]=d,t[11]=f,t[12]=m):m=t[12],m}function vp(t){return!t}function xp(t){return!t}function bp(){const t=H.c(28),{org:e}=Ne(),s=Nc(),{isChatEmpty:i}=ks(),[r,o]=R.useState("chat"),a=ju(),{selectedVirtualMcp:l}=Ro();let h;t[0]!==e.id?(h=To(e.id),t[0]=e.id,t[1]=h):h=t[1];const u=It((l??h).id),f=Mu(),m=Ys(u?.metadata);if(s.length===0&&!(m&&Nu(f))){let P;return t[2]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(Oe,{className:"animate-in fade-in-0 duration-200",children:n.jsx(Oe.Main,{className:"flex flex-col items-center",children:n.jsx(Oe.EmptyState,{children:n.jsx(Oe.NoAiProviderEmptyState,{})})})}),t[2]=P):P=t[2],P}let _;t[3]!==a.hasDecoKey||t[4]!==a.hasOnlyDecoProvider||t[5]!==a.isLoading||t[6]!==a.isZeroBalance||t[7]!==i||t[8]!==e.id?(_=a.hasDecoKey&&a.isZeroBalance&&a.hasOnlyDecoProvider&&!a.isLoading&&i&&!Eu(e.id),t[3]=a.hasDecoKey,t[4]=a.hasOnlyDecoProvider,t[5]=a.isLoading,t[6]=a.isZeroBalance,t[7]=i,t[8]=e.id,t[9]=_):_=t[9];const v=_;let x;t[10]!==v?(x=v&&n.jsx(Oe.CreditsEmptyState,{}),t[10]=v,t[11]=x):x=t[11];const y=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let g;t[12]!==y?(g=ce("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",y),t[12]=y,t[13]=g):g=t[13];let b;t[14]!==i?(b=i?n.jsx(Oe.Main,{children:n.jsx(pp,{onOpenContextPanel:()=>o("context")})}):n.jsxs(n.Fragment,{children:[n.jsxs(Oe.Main,{className:"relative flex flex-col overflow-hidden @container",children:[n.jsx(gp,{}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Oe.Messages,{})})]}),n.jsx(Oe.Footer,{children:n.jsx(Oe.Input,{onOpenContextPanel:()=>o("context")})})]}),t[14]=i,t[15]=b):b=t[15];let S;t[16]!==g||t[17]!==b?(S=n.jsx("div",{className:g,children:b}),t[16]=g,t[17]=b,t[18]=S):S=t[18];const w=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let k;t[19]!==w?(k=ce("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",w),t[19]=w,t[20]=k):k=t[20];let N;t[21]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(sp,{back:!0,onClose:()=>o("chat")}),t[21]=N):N=t[21];let D;t[22]!==k?(D=n.jsx("div",{className:k,children:N}),t[22]=k,t[23]=D):D=t[23];let I;return t[24]!==D||t[25]!==x||t[26]!==S?(I=n.jsxs(Oe,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[x,S,D]}),t[24]=D,t[25]=x,t[26]=S,t[27]=I):I=t[27],I}function sh(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(Oe.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(Ht,{fallback:e,children:n.jsx(R.Suspense,{fallback:n.jsx(Oe.Skeleton,{}),children:n.jsx(bp,{})})}),t[1]=s):s=t[1],s}function yp(t){const e=t.entityMetadata?.defaultMainView??null,s=e==null||e.type==="chat",i=t.mainParamPresent?t.mainParamValue!=="0":!s,r=s?!0:t.entityMetadata?.chatDefaultOpen??!1;return{mainOpen:i,chatOpen:r}}function Ha(t,e){return t&&e?{chat:45,main:55}:t&&!e?{chat:100,main:0}:!t&&e?{chat:0,main:100}:{chat:0,main:0}}function Sp(t,e){return t===1?!0:t===0?!1:e}function wp(t,e){const s=Qt(),i=No({strict:!1}),r=vc({strict:!1}),{create:o}=Rf(),{locator:a}=Ne(),{virtualMcpId:l,orgSlug:h,isAgentRoute:c}=e,d=yp({entityMetadata:t,mainParamPresent:i.main!==void 0,mainParamValue:i.main}),u=Sp(i.chat,d.chatOpen),f=d.mainOpen,m=R.useRef(crypto.randomUUID()),p=r.taskId??m.current,_="/$org/$taskId",v=D=>({org:h,taskId:D}),x=c?{virtualmcpid:l}:{},y=(D,I)=>{s({to:_,params:v(p),search:P=>({...P,...D}),replace:I?.replace??!1})},g=(D,I)=>{s({to:_,params:v(D),search:P=>{const j={};return I?j.virtualmcpid=I:c&&(j.virtualmcpid=l),j}})},b=()=>{f?y({main:"0"},{replace:!0}):y({main:In(t)},{replace:!0})},S=()=>{y({chat:u?0:1},{replace:!0})},w=()=>{u||y({chat:1},{replace:!0})},k=async()=>{const D=crypto.randomUUID(),I=Zu(h,a,p);try{await o({id:D,virtual_mcp_id:l,...I?{branch:I}:{}})}catch{}s({to:_,params:v(D),search:P=>({...x,chat:1})})},N=D=>{y({main:D},{replace:!0})};return{taskId:p,mainOpen:f,chatOpen:u,mainParam:i.main,setTaskId:g,toggleMain:b,toggleChat:S,openChat:w,createNewTask:k,openTab:N}}const Ko=45;function ih(t,e=Ko){const s=typeof t=="number"?t:Number(t);return!Number.isFinite(s)||s<=0||s>=100?e:s}function Cp(t){return ih(t,Ko)}function kp(){const t=H.c(6);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=_u.decoChatPanelWidth(),t[0]=e):e=t[0];const[s,i]=pu(e,Cp);let r;t[1]!==s?(r=ih(s,Ko),t[1]=s,t[2]=r):r=t[2];const o=r;let a;return t[3]!==i||t[4]!==o?(a=[o,i],t[3]=i,t[4]=o,t[5]=a):a=t[5],a}function jp(t){try{return JSON.parse(t)}catch{return null}}function Np(t){if(!t||typeof t!="object")return null;const e=t,s=e.content?.find(o=>o.type==="text")?.text,i=s?jp(s):null,r=e.structuredContent;return r==null?i:typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0?i??r:r}function Rs(t){const e=Np(t);return e===null?null:e}function Vo(t){if(!t)return null;const e=t.match(/\/pull\/(\d+)\b/);if(!e)return null;const s=Number(e[1]);return Number.isFinite(s)&&s>0?s:null}function Ep(t){if(!t||typeof t!="object")return null;const e=t.content?.find(r=>r.type==="text")?.text;if(!e)return null;const s=e.match(/https:\/\/github\.com\/[^\s"]+\/pull\/\d+/)?.[0],i=Vo(s);return!i||!s?null:{number:i,htmlUrl:s}}const Wa=/[\r\n<>]/,Tp=/^[^\s@<>]+@[^\s@<>]+\.[^\s@<>]+$/;function Ki(t){const e=t?.userName?.trim();if(!e||Wa.test(e))return null;const s=t?.userEmail?.trim();return!s||Wa.test(s)?{userName:e}:Tp.test(s)?{userName:e,userEmail:s}:{userName:e}}function Rp(t){return t.split(`
|
|
3
3
|
`).filter(e=>!/^Co-authored-by:\s/i.test(e)).join(`
|
|
4
4
|
`).trimEnd()}function Pp(t){const e=t.userName.trim(),s=t.userEmail?.trim();return s?`Co-authored-by: ${e} <${s}>`:`Co-authored-by: ${e}`}function rh(t,e){const s=Ki(e);if(!s)return t;const i=Rp(t),r=Pp(s);if(i.includes(r))return i;const o=i.trimEnd();return o.length>0?`${o}
|
|
5
5
|
|
|
@@ -271,7 +271,7 @@ ${ee}`:ee;c.setValue("metadata.instructions",te,{shouldDirty:!0})},V=new Set(d.m
|
|
|
271
271
|
8% { opacity: 1; }
|
|
272
272
|
22% { opacity: 0; }
|
|
273
273
|
}
|
|
274
|
-
`}),e[26]=b):b=e[26];let S;return e[27]!==g||e[28]!==d?(S=n.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center gap-12 select-none [clip-path:inset(-24px_0_-200px_0)]",children:[d,g,b]}),e[27]=g,e[28]=d,e[29]=S):S=e[29],S}function tr(t){const e=H.c(10),{phase:s,current:i,children:r}=t,o=s-i,a=o<0,l=o===0,h=a?90:o*-22,c=a?.94:1-Math.max(o,0)*.04,d=a?0:l?1:o===1?.8:.55,u=a?10:30-o,f=!l;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=ce("absolute inset-0 overflow-hidden rounded-xl border border-foreground/10 bg-background shadow-[0_20px_60px_-20px_rgb(0_0_0_/_0.35)] transition-all ease-[cubic-bezier(0.22,1,0.36,1)]"),e[0]=m):m=e[0];const p=`translateY(${h}px) scale(${c})`,_=l?"auto":"none";let v;e[1]!==d||e[2]!==p||e[3]!==_||e[4]!==u?(v={transform:p,opacity:d,zIndex:u,transitionDuration:"1000ms",pointerEvents:_},e[1]=d,e[2]=p,e[3]=_,e[4]=u,e[5]=v):v=e[5];let x;return e[6]!==r||e[7]!==f||e[8]!==v?(x=n.jsx("div",{"aria-hidden":f,className:m,style:v,children:r}),e[6]=r,e[7]=f,e[8]=v,e[9]=x):x=e[9],x}function en(t){const e=H.c(7),{showUrl:s}=t,i=s===void 0?!1:s;let r,o,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("div",{className:ce("size-2.5 rounded-full",St)}),o=n.jsx("div",{className:ce("size-2.5 rounded-full",St)}),a=n.jsx("div",{className:ce("size-2.5 rounded-full",St)}),e[0]=r,e[1]=o,e[2]=a):(r=e[0],o=e[1],a=e[2]);let l;e[3]!==i?(l=i&&n.jsx("div",{className:ce("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",zt)}),e[3]=i,e[4]=l):l=e[4];let h;return e[5]!==l?(h=n.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 px-3",children:[r,o,a,l]}),e[5]=l,e[6]=h):h=e[6],h}function Zv(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(en,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsx("div",{className:"flex flex-1 px-8 py-5",children:n.jsx("div",{className:"grid h-full w-full grid-cols-8 grid-rows-6 gap-2",children:Vv.map(Qv)})})]}),t[1]=s):s=t[1],s}function Qv(t,e){if(e===qh)return n.jsx("div",{className:"rounded-md bg-chart-1/[0.55]",style:{animation:"vm-breathe 2.4s ease-in-out infinite"}},e);const s=t;return n.jsx("div",{className:ce("relative rounded-md",St),children:n.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${Gh}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function e1(){const t=H.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(en,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:ce("w-[18%] rounded-md",zt),style:{animation:"vm-breathe 3s ease-in-out infinite"}}),t[1]=s):s=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("div",{className:"h-[42%] shrink-0 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.4s infinite"}}),t[2]=i):i=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("div",{className:"col-span-3 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.8s infinite"}}),t[3]=r):r=t[3];let o;return t[4]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5 p-3",children:[s,n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[i,n.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-1.5",children:[r,n.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-1.5",children:[n.jsx("div",{className:ce("rounded-md",zt),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),n.jsx("div",{className:ce("rounded-md",zt),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=o):o=t[4],o}function t1(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(en,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsx("div",{className:"relative flex flex-1 items-center justify-center px-8 py-5",children:n.jsx("div",{className:"grid w-full gap-2",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:Yv.map(s1)})})]}),t[1]=s):s=t[1],s}function s1(t,e){return n.jsx("div",{className:ce("aspect-square rounded-md",Xv[e]?"bg-chart-2/70":St),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function i1(){const t=H.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(en,{showUrl:!0}),t[0]=e):e=t[0];let s,i,r,o,a;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"mb-2 h-5 rounded-md bg-chart-1/[0.10]"}),i=n.jsx("div",{className:ce("h-1.5 w-[70%] rounded-sm",St)}),r=n.jsx("div",{className:ce("h-1.5 w-[55%] rounded-sm",St)}),o=n.jsx("div",{className:ce("h-1.5 w-[80%] rounded-sm",St)}),a=n.jsx("div",{className:ce("h-1.5 w-[50%] rounded-sm",St)}),t[1]=s,t[2]=i,t[3]=r,t[4]=o,t[5]=a):(s=t[1],i=t[2],r=t[3],o=t[4],a=t[5]);let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsxs("div",{className:"flex w-[18%] shrink-0 flex-col gap-1.5 bg-chart-1/[0.05] p-2.5",children:[s,i,r,o,a,n.jsx("div",{className:"mt-auto",children:n.jsx("div",{className:ce("h-4 rounded-md",St)})})]}),t[6]=l):l=t[6];let h;t[7]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("div",{className:"relative h-[42%] shrink-0 overflow-hidden bg-chart-1/[0.10]",children:n.jsxs("div",{className:"absolute right-3 bottom-3 left-3 space-y-1.5",children:[n.jsx("div",{className:"h-3 w-[35%] rounded-sm bg-chart-1/[0.15]"}),n.jsx("div",{className:ce("h-1.5 w-[55%] rounded-sm",zt)})]})}),t[7]=h):h=t[7];let c;t[8]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsxs("div",{className:"flex shrink-0 gap-1.5",children:[n.jsx("div",{className:"h-4 w-12 rounded-full bg-chart-1/[0.12]"}),n.jsx("div",{className:ce("h-4 w-10 rounded-full",zt)}),n.jsx("div",{className:ce("h-4 w-14 rounded-full",zt)})]}),t[8]=c):c=t[8];let d;t[9]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsxs("div",{className:ce("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",zt),children:[n.jsx("div",{className:ce("h-1.5 w-[50%] rounded-sm",St)}),n.jsx("div",{className:ce("h-1 w-[75%] rounded-sm",St)})]}),t[9]=d):d=t[9];let u;return t[10]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsxs("div",{className:"flex min-h-0 flex-1",children:[l,n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[h,n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2.5 p-3",children:[c,n.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-2",children:[d,n.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[n.jsx("div",{className:ce("rounded-md",zt)}),n.jsx("div",{className:ce("rounded-md",zt)})]})]})]})]})]})]}),t[10]=u):u=t[10],u}function Br(t){const e=H.c(9);if(t.kind==="starting"){let l;return e[0]!==t.claimPhase||e[1]!==t.progress?(l=n.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:n.jsx(Jv,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=l):l=e[2],l}let s;e[3]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(pf,{className:"size-12 text-blue-500"}),e[3]=s):s=e[3];let i,r;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("h3",{className:"text-lg font-medium",children:Uv("suspended")}),r=n.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:"Resume to continue."}),e[4]=i,e[5]=r):(i=e[4],r=e[5]);let o;e[6]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(Fs,{className:"size-4"}),e[6]=o):o=e[6];let a;return e[7]!==t.onResume?(a=n.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:n.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[s,i,r,n.jsxs(se,{onClick:t.onResume,className:"mt-2",children:[o," Resume"]})]})}),e[7]=t.onResume,e[8]=a):a=e[8],a}const r1=R.lazy(()=>Kt(()=>import("./sections-editor-C0HkgTTy.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.SectionsEditor}))),n1=R.lazy(()=>Kt(()=>import("./page-seo-sheet-51vZvU9M.js"),__vite__mapDeps([154,1,2,122,44,46,47,48,16,3,5,86,72,80,77,6,7,8,9,10,11,12,13,14,15,17,4,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,45,78,50,79,73,51,81,49,82,83,84,58,85,60,61,90,91,92,93,94,95,96,97,98,99,100,101,102,57,103,59,104,105,106,107,108,66,109,56,110,71,111,70,67,112,113,114,115,116,117,65,87,88,52,53,54,55,62,63,64,68,69,74,75,76,118,119,120,121,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.SeoSheet}))),o1=R.lazy(()=>Kt(()=>import("./file-explorer-c1AF4n2J.js"),__vite__mapDeps([155,1,2,137,6,7,8,9,10,11,12,13,14,15,16,3,17,4,5,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,127,98,99,58,100,101,85,102,57,103,59,104,105,49,106,107,108,50,120,121,122,123,82,79,70,124,109,125,56,67,115,126,62,63,64,71,72,111,128,52,53,54,55,60,61,65,66,68,69,73,74,75,76,87,88,129,130,131,92,93,136,51,95,90,91,94,96,97,110,83,112,113,114,116,117,118,119,132,133,134,135,138,139,80,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.FileExplorer}))),mn=500,a1={mobile:375,tablet:768,desktop:null},pn=["desktop","mobile","tablet"],l1={mobile:"Mobile (375px)",tablet:"Tablet (768px)",desktop:"Desktop"};function c1(t,e){const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}function h1(){const t=Zi(),{currentBranch:e}=es(),[s,i]=R.useState("preview"),[r,o]=R.useState("desktop"),[a,l]=R.useState(null),h=R.useRef(null),c=s==="cms",[d,u]=R.useState(null),[f,m]=R.useState(384),p=R.useRef(!1),_=R.useRef(0),v=R.useRef(0),x=R.useRef(null),[y,g]=R.useState(!1),[b,S]=R.useState(""),w=R.useRef(null),[k,N]=R.useState(!1),[D,I]=R.useState(),[P,j]=R.useState(null),[C,A]=R.useState(null),[E,T]=R.useState("/"),[M,B]=R.useState(!1),[O,F]=R.useState(!1),[W,$]=R.useState(null),U=t?.entity?.id??null,{org:Y}=Ne(),V=qt(),K=Hh(),q=K.vmEntry,Q=K.previewUrl,oe=V.lifecycle.phase,L=oe==="running",ee=U&&e&&L?{orgSlug:Y.slug,virtualMcpId:U,branch:e}:null,{data:te}=Jo(ee,{fetchEnabled:L}),{data:G}=Zo(ee,{fetchEnabled:L}),z=U&&e?{orgSlug:Y.slug,virtualMcpId:U,branch:e}:null,le=Iv(z),ue=te?ia(te).sort((Z,ge)=>Z.name.localeCompare(ge.name)):[],me=te&&G?ra(te,G):[],he=Ni,ie=ue.filter(Z=>{if(!b)return!0;const ge=b.toLowerCase();return Z.name.toLowerCase().includes(ge)||Z.path.toLowerCase().includes(ge)}),ve=me.filter(Z=>{if(!b)return!0;const ge=b.toLowerCase();return Z.name.toLowerCase().includes(ge)||Z.key.toLowerCase().includes(ge)||Z.resolveType.toLowerCase().includes(ge)}),re=P?null:ue.find(Z=>he(Z.path)===he(E))??null,ke=P?P.name:re?.name,it=re?.key??null,De=R.useRef(null),ft=R.useRef(null);y_(()=>{const Z=h.current,ge=De.current;!Z||!ge||(Z.src=ge)});const ai=V.status.state==="paused",J=V.phase,xe=Vh({claimPhase:J,lifecycle:V.lifecycle}),fe=K.previewState,Se=K.userStopped,Ce=fe.kind==="iframe"?c1(C??new URL(E,fe.previewUrl).href,r):null,[Ye,an]=R.useState(null);if(fe.kind==="iframe"&&Ye!==fe.previewUrl){const Z=Ye!==null;an(fe.previewUrl),Z&&(ft.current=null,T("/"),A(null),j(null))}De.current=Ce;const Qi=!!U&&!!e&&!V.notFound&&!Se&&!ai&&(J?.kind==="ready"||oe!=="idle"),As=fe.kind!=="iframe"&&(s==="visual"||s==="cms")?"preview":s;R.useEffect(()=>{if(!Q)return;let Z;try{Z=new URL(Q,window.location.href).origin}catch{return}const ge=nt=>{if(nt.origin===Z){if(nt.data?.type==="visual-editor::element-clicked"){const ot=Mv.safeParse(nt.data.payload);ot.success&&l(ot.data)}else if(nt.data?.type==="cms-editor::section-clicked"){const ot=Ov.safeParse(nt.data.payload);ot.success&&u(ot.data.sectionIndex)}}};return window.addEventListener("message",ge),()=>window.removeEventListener("message",ge)},[Q]),R.useEffect(()=>{if(!y)return;const Z=ge=>{w.current?.contains(ge.target)||(g(!1),S(""))};return document.addEventListener("pointerdown",Z),()=>document.removeEventListener("pointerdown",Z)},[y]),R.useEffect(()=>{if(!c)return;const Z=nt=>{const ot=nt.target;ot&&ot!==h.current&&(x.current=ot)},ge=()=>{requestAnimationFrame(()=>{const nt=document.activeElement;(nt===document.body||nt===h.current)&&x.current&&x.current.focus()})};return document.addEventListener("focusin",Z),document.addEventListener("blur",ge,!0),()=>{document.removeEventListener("focusin",Z),document.removeEventListener("blur",ge,!0)}},[c]);const _e=()=>{const Z=h.current?.contentWindow;Z&&Z.postMessage({type:"visual-editor::activate",script:Lv},"*")},Ee=()=>{const Z=h.current?.contentWindow;Z&&Z.postMessage({type:"visual-editor::deactivate"},"*")},rt=()=>{const Z=h.current?.contentWindow;Z&&Z.postMessage({type:"visual-editor::activate",script:$v},"*")},xt=()=>{const Z=h.current?.contentWindow;Z&&Z.postMessage({type:"cms-editor::deactivate"},"*")},He=Z=>{const ge=s;i(Z),l(null),Z!=="code"&&$(null),Z!=="cms"&&u(null),ge==="visual"&&Ee(),ge==="cms"&&xt(),Z==="visual"&&_e(),Z==="cms"&&rt()},ou=()=>{if(!h.current||!Ce)return;const Z=h.current;Z.src=Ce},au=()=>{if(!h.current||!Ce)return;const Z=Ce.includes("?")?"&":"?";h.current.src=`${Ce}${Z}_r=${Date.now()}`},lu=()=>{const Z=pn.indexOf(r);o(pn[(Z+1)%pn.length])},cu=()=>{const Z=h.current?.contentWindow?.location?.href??Ce??Q;Z&&navigator.clipboard.writeText(Z)},hu=(()=>{if(!Q)return"No server running";if(P)return P.name;try{const Z=new URL(Q),ge=E==="/"?"":E;return`${Z.host}${ge}`}catch{return Q}})(),Na=Z=>{ft.current=Z,j(null),A(null),T(Z),u(null),B(!1)},du=Z=>{if(!Q||!G){ae.error("Preview metadata not ready yet");return}ft.current=null;const ge=yh(G),nt=Rv(Q,ge,Z.key);j(Z),A(nt),u(null)},uu=async({name:Z,path:ge})=>{if(!U||!e)return;const nt=la(ge);if(nt){I(nt);return}const ot=ge.trim().startsWith("/")?ge.trim():`/${ge.trim()}`;if(ue.some(Gt=>he(Gt.path)===he(ot))){I(`A page with path "${ot}" already exists.`);return}I(void 0);try{const Gt=await le.mutateAsync({name:Z,path:ot});N(!1),ae.success(`Page "${Z}" created`),await new Promise(mu=>setTimeout(mu,mn)),Na(Gt.path),He("cms")}catch(Gt){I(Gt instanceof Error?Gt.message:"Failed to create page")}},fu=[{value:"preview",icon:n.jsx(Aa,{size:14}),tooltip:"Interactive"},...fe.kind==="iframe"?[{value:"visual",icon:n.jsx(Ia,{size:14}),tooltip:"Visual editor"}]:[],...fe.kind==="iframe"&&sa(te,G)?[{value:"cms",icon:n.jsx(_f,{size:14}),tooltip:"Sections editor"}]:[],{value:"code",icon:n.jsx(gf,{size:14}),tooltip:"Code editor"}];return n.jsxs("div",{className:"flex flex-col w-full h-full",children:[Qi&&n.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-4 border-b border-border/60 px-3 md:px-4",children:[n.jsx("div",{className:"flex shrink-0 items-center gap-1",children:n.jsx(Pm,{value:As,onValueChange:He,options:fu,size:"sm",className:"shrink-0 bg-foreground/4.5"})}),fe.kind==="iframe"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:ce("flex min-w-0 flex-1 items-center gap-0.5 ml-2",s==="code"&&"hidden"),children:[n.jsxs(Pe,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",onClick:ou,children:n.jsx(Di,{size:14})})}),n.jsx(Re,{side:"bottom",children:"Refresh"})]}),n.jsxs(Pe,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",onClick:lu,children:n.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[r==="mobile"&&n.jsx(vf,{size:14}),r==="tablet"&&n.jsx(xf,{size:14}),r==="desktop"&&n.jsx(Aa,{size:14})]},r)})}),n.jsx(Re,{side:"bottom",children:l1[r]})]}),n.jsxs("div",{ref:w,className:"relative min-w-0 flex-1",children:[n.jsxs("button",{type:"button",className:"flex h-8 w-full min-w-0 items-center gap-1 rounded-md bg-background px-2 transition-colors duration-200 hover:bg-accent",onClick:()=>g(Z=>!Z),children:[P&&n.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[n.jsx(Hs,{size:11}),"Global"]}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-[12px] text-foreground/88",children:hu}),ke&&!P&&n.jsx("span",{className:"shrink-0 text-[12px] text-muted-foreground",children:ke}),n.jsx(js,{size:12,className:ce("shrink-0 text-muted-foreground transition-transform",y&&"rotate-180")})]}),y&&n.jsxs("div",{className:"absolute left-0 right-0 top-full z-50 mt-1.5 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[n.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[n.jsx(Zc,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),n.jsx("input",{type:"text",value:b,onChange:Z=>S(Z.target.value),placeholder:"Search pages and components...",className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),n.jsx("div",{className:"p-1.5 border-b",children:n.jsxs("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Z=>{Z.preventDefault(),g(!1),S(""),I(void 0),N(!0)},children:[n.jsx(At,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"flex-1 font-medium",children:"Create new page"})]})}),ie.length===0&&ve.length===0?n.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:ue.length===0&&me.length===0?"No pages found in this site.":"No results match your search."}):n.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[ie.length>0&&n.jsx("div",{className:"p-1.5",children:ie.map(Z=>n.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:ge=>{ge.preventDefault(),g(!1),S(""),Na(Z.path)},children:[n.jsx(Ao,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:Z.name}),n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Z.path})]},Z.key))}),ve.length>0&&n.jsxs("div",{className:ce("p-1.5",ie.length>0&&"border-t"),children:[n.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Global components"}),ve.map(Z=>n.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:ge=>{ge.preventDefault(),g(!1),S(""),du(Z)},children:[n.jsx(Hs,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:Z.name}),n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Z.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},Z.key))]})]})]})]})]}),n.jsxs("div",{className:ce("flex shrink-0 items-center gap-0.5",s==="code"&&"hidden"),children:[n.jsxs(Pe,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",onClick:()=>{const Z=Ce??fe.previewUrl;Z&&window.open(Z,"_blank","noopener")},children:n.jsx(ti,{size:14})})}),n.jsx(Re,{side:"bottom",children:"Open in new tab"})]}),n.jsxs(Js,{children:[n.jsx(Zs,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",children:n.jsx(Yr,{size:14})})}),n.jsxs(Qs,{align:"end",className:"w-44",children:[n.jsx(et,{onClick:au,children:"Hard Reload"}),n.jsx(et,{onClick:cu,children:"Copy Current URL"}),te&&G&&n.jsxs(n.Fragment,{children:[n.jsx(ur,{}),it&&n.jsxs(et,{onClick:()=>{B(!0),He("cms")},children:[n.jsx(Sr,{size:14}),"Edit SEO"]}),it&&n.jsxs(et,{onClick:()=>{try{$(al(it)),He("code")}catch{ae.error("Invalid page block key")}},children:[n.jsx(Io,{size:14}),"View JSON"]}),n.jsxs(et,{onClick:()=>F(!0),children:[n.jsx(Sr,{size:14}),"Site SEO"]})]})]})]})]})]})]}),n.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[c&&Q&&e&&U&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"shrink-0 border-r overflow-hidden",style:{width:f},children:n.jsx(R.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(we,{size:20,className:"animate-spin text-muted-foreground"})}),children:n.jsx(r1,{orgSlug:Y.slug,virtualMcpId:U,branch:e,previewReady:L,previewUrl:Q,currentPath:E,activeGlobalBlockKey:P?.key??null,externalSelectedIndex:P?null:d,onSaved:()=>{setTimeout(()=>{const Z=h.current;if(!Z)return;const ge=document.activeElement,nt=Z.tabIndex;Z.tabIndex=-1,Z.style.pointerEvents="none",Z.blur();try{Z.contentWindow?.location.reload()}catch{const Gt=De.current;Gt&&(Z.src=Gt)}const ot=()=>{Z.tabIndex=nt,Z.style.pointerEvents="",ge?.focus(),Z.removeEventListener("load",ot)};Z.addEventListener("load",ot),setTimeout(ot,3e3)},mn)},initialEditSeo:M,onExitSeo:()=>B(!1),onViewJsonFile:Z=>{try{$(al(Z)),He("code")}catch{ae.error("Invalid page block key")}}})})}),n.jsx("div",{className:"w-1 shrink-0 cursor-col-resize bg-transparent hover:bg-border transition-colors",onPointerDown:Z=>{p.current=!0,_.current=Z.clientX,v.current=f,Z.currentTarget.setPointerCapture(Z.pointerId)},onPointerMove:Z=>{if(!p.current)return;const ge=Z.clientX-_.current;m(Math.max(240,Math.min(640,v.current+ge)))},onPointerUp:()=>{p.current=!1}})]}),n.jsxs("div",{className:ce("flex-1 relative overflow-hidden",r!=="desktop"&&fe.kind==="iframe"&&s!=="code"&&"flex justify-center bg-muted/30"),children:[fe.kind==="starting"&&n.jsx("div",{className:"absolute inset-0 z-30",children:n.jsx(Br,{kind:"starting",progress:xe,claimPhase:J})}),fe.kind==="suspended"&&n.jsx("div",{className:"absolute inset-0 z-30",children:n.jsx(Br,{kind:"suspended",onResume:K.resume})}),As==="visual"&&!a&&n.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-violet-400/40 bg-violet-500/90 px-3 py-1 text-xs font-medium text-white shadow-md backdrop-blur-sm pointer-events-none select-none",children:[n.jsx(Ia,{size:12}),"Click any element to ask the AI"]}),As==="visual"&&a&&n.jsx(Hv,{element:a,onDismiss:()=>l(null)}),s==="code"&&Qi&&U&&e&&n.jsx("div",{className:"absolute inset-0 z-10 bg-background",children:n.jsx(R.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(we,{size:20,className:"animate-spin text-muted-foreground"})}),children:n.jsx(o1,{orgSlug:Y.slug,virtualMcpId:U,branch:e,openPath:W})})}),fe.kind==="iframe"&&Ce&&n.jsx("div",{className:ce("h-full transition-[width] duration-250 [transition-timing-function:var(--ease-in-out-cubic)]",r!=="desktop"&&s!=="code"&&"w-full max-w-full border-x border-border bg-background shadow-sm"),style:{width:r==="desktop"||s==="code"?"100%":`${a1[r]}px`},children:n.jsx("iframe",{ref:h,src:Ce,className:ce("w-full h-full border-0",s==="code"&&"invisible"),title:"Dev Server Preview",tabIndex:c?-1:void 0,onLoad:()=>{if(Le("vm_preview_loaded",{view_mode:s,vm_id:q?.sandboxHandle??null}),!P)try{const Z=h.current?.contentWindow?.location?.pathname;if(!Z)return;const ge=ft.current;if(ge!==null){ft.current=null,he(Z)===he(ge)&&T(Z);return}T(Z)}catch{}s==="visual"&&_e(),s==="cms"&&rt()}},fe.previewUrl)})]})]}),n.jsx(Bv,{open:k,onOpenChange:N,isPending:le.isPending,error:D,onSubmit:uu}),O&&te&&G&&n.jsx(R.Suspense,{fallback:null,children:n.jsx(n1,{open:O,onOpenChange:F,orgSlug:Y.slug,virtualMcpId:U??"",branch:e??"",decofile:te,meta:G,onSaved:()=>{setTimeout(()=>{const Z=h.current;if(Z)try{Z.contentWindow?.location.reload()}catch{const ge=De.current;ge&&(Z.src=ge)}},mn)},target:{kind:"site"}})})]})}function d1(t){const e=H.c(2),{virtualMcpId:s}=t,i=It(s);if(!Ys(i?.metadata)){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[n.jsx(zi,{size:24,className:"text-muted-foreground/60"}),n.jsx("div",{children:"No source to preview."}),n.jsx("div",{className:"text-xs text-muted-foreground/80",children:"Connect a GitHub repository from the Connections tab to enable Preview."})]}),e[0]=a):a=e[0],a}let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(h1,{}),e[1]=o):o=e[1],o}function u1({orgSlug:t,virtualMcpId:e,branch:s}){const i=qs();return Gs({mutationFn:async({blockKey:r})=>{const o=ca(r),a=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:o})});if(!a.ok){const l=await a.json().catch(()=>({}));throw new Error(l.error??`Delete failed (${a.status})`)}return a.json()},onMutate:async({blockKey:r})=>{const o=`${t}/${e}/${s}`,a=Dt.decofile(o);await i.cancelQueries({queryKey:a});const l=i.getQueryData(a);return i.setQueryData(a,h=>{if(!h)return h;const{[r]:c,...d}=h;return d}),{previous:l,queryKey:a}},onError:(r,o,a)=>{a?.queryKey&&i.setQueryData(a.queryKey,a.previous)},onSuccess:()=>{const r=`${t}/${e}/${s}`;i.invalidateQueries({queryKey:Dt.liveMeta(r)})}})}function tn(t,e){return`${t}-${e}`}function ua(t,e){return`site/apps/${t}/${e}.ts`}function fa(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function Yh(t,e,s){const i=new Set([tn(t,e),e].map(o=>o.toLowerCase())),r=ua(t,e);for(const[o,a]of Object.entries(s)){if(o.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=a;if(i.has(o.toLowerCase())||l.__resolveType===r)return o}return null}function f1(t,e){const s=t.vendor.alias,i=t.name,r=Yh(s,i,e);return{id:tn(s,i),app:i,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:ua(s,i),blockKey:r,installed:r!==null}}function m1(t,e,s){if(t===ji)return null;const i=fa(t);if(!i)return null;const{vendor:r,app:o}=i,a=Yh(r,o,s),l=Vi(t,e);return{id:tn(r,o),app:o,vendor:r,title:l.title??o,description:l.description??"",category:"Others",logo:l.logo??l.icon,resolveType:t,blockKey:a,installed:a!==null}}function p1(t,e,s){const i=new Map;for(const o of t){const a=f1(o,s);i.set(a.id,a)}const r=e.manifest?.blocks?.apps??{};for(const o of Object.keys(r)){const a=m1(o,e,s);!a||i.has(a.id)||i.set(a.id,a)}for(const o of v1(s,e)){const a=fa(o.resolveType);if(!a)continue;const l=tn(a.vendor,a.app);i.has(l)||i.set(l,{id:l,app:a.app,vendor:a.vendor,title:o.name,description:"",category:"Installed",resolveType:o.resolveType,blockKey:o.key,installed:!0})}return[...i.values()].sort(_1)}function _1(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}function g1(t,e,s){const i=t.manifest?.blocks?.apps??{};for(const r of[ua(e,s),`site/apps/${e}/${s}.tsx`,`${e}/apps/${s}.ts`,`${e}/apps/${s}.tsx`])if(r in i)return!0;return!1}function v1(t,e){const s=[];for(const[i,r]of Object.entries(t)){if(i.includes("/")||!r||typeof r!="object"||Array.isArray(r))continue;const o=r,a=o.__resolveType;if(typeof a!="string"||Ch(i,o))continue;const l=fa(a)??(()=>{const h=i.match(/^([^-]+)-(.+)$/);return h?{vendor:h[1],app:h[2]}:null})();!l||!g1(e,l.vendor,l.app)||s.push({key:i,name:i.replace(/[-_]/g," ").replace(/\b\w/g,h=>h.toUpperCase()),resolveType:a})}return s}async function x1(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function b1(t,e,s){const i=H.c(12),r=s?.enabled??!0;let o;i[0]===Symbol.for("react.memo_cache_sentinel")?(o=Dt.decoApps(),i[0]=o):o=i[0];let a;i[1]!==r?(a={queryKey:o,queryFn:x1,staleTime:3e5,retry:1,enabled:r},i[1]=r,i[2]=a):a=i[2];const l=Vs(a);let h;i[3]!==e||i[4]!==t||i[5]!==l.data?(h=t&&e?p1(l.data??[],t,e):[],i[3]=e,i[4]=t,i[5]=l.data,i[6]=h):h=i[6];const c=h,d=l.isLoading&&!l.isError;let u;return i[7]!==c||i[8]!==l.isError||i[9]!==l.refetch||i[10]!==d?(u={catalog:c,isLoading:d,isError:l.isError,refetch:l.refetch},i[7]=c,i[8]=l.isError,i[9]=l.refetch,i[10]=d,i[11]=u):u=i[11],u}const y1=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]);function S1(t){return t.includes("matchers")||t.includes("Match")}function w1(t,e){const s=t.__resolveType;return typeof s!="string"||!s||y1.has(s)?!1:e?Qp(e,s):S1(s)}function qi(t,e,s){if(!t)return!1;const i=t.__resolveType;if(typeof i!="string"||!ea(i)||!Object.hasOwn(e,i))return!1;const r=e[i];return!r||typeof r!="object"||Array.isArray(r)?!1:w1(r,s)}function dC(t,e,s){return qi(t,e,s)?t?.__resolveType??null:null}function Xh(t,e,s){if(!t)return null;const i=t.__resolveType??"";if(!i)return null;if(qi(t,e,s)){const a=e[i]??{},l=a.__resolveType??i,{__resolveType:h,name:c,...d}=a;return{resolveType:l,data:d,blockKey:i}}const{__resolveType:r,...o}=t;return{resolveType:i,data:o}}function C1(t,e,s){const i=Xh(t,e,s);return i?{__resolveType:i.resolveType,...i.data}:{__resolveType:""}}function uC(t,e,s){if(t)return qi(t,e,s)?C1(t,e,s):t}function k1(t,e,s,i){if(!t)return"Default";if(qi(t,e,i)){const r=t.__resolveType??"",o=e[r];return kh(r,o)}return s(t)}function fC(t,e,s){return{__resolveType:t,...e,name:s}}function mC(t){return{__resolveType:t}}function pC(t,e,s){const i=Xh(t,e,s);return i?{resolveType:i.resolveType,formValue:i.data}:{resolveType:"",formValue:{}}}function Jh(t){const e=t.__resolveType??"";return Zt(e)?t.section??t:t}function Mr(t){const r=(Zt(t.__resolveType??"")?t.section:t)?.variants?.[0];return r?.rule?.__resolveType!==gh?null:r?.value??null}function _C(t){const e=Jh(t);return{__resolveType:n_,variants:[{value:e,rule:{__resolveType:gh}}]}}function gC(t){const e=t.__resolveType??"";if(!e)return null;if(Zt(e))return t.section??null;const s=Mr(t);return s?Zt(s.__resolveType??"")?s:{__resolveType:qa,section:Jh(s)}:{__resolveType:qa,section:t}}function sr(t){const e=t.__resolveType??"";if(!e)return null;if(Zt(e)){const s=t.section,i=s?.__resolveType??"";return!i||!s?null:{resolveType:i,data:s}}return{resolveType:e,data:t}}function vC(t){const e=Mr(t);if(e)return sr(e);if(Zt(t.__resolveType??"")){const i=t.section;if(!i)return null;const r=Mr(i);return sr(r||i)}return sr(t)}function xC(t){return Mr(t)}const j1=["website/matchers/always.ts","$live/matchers/MatchAlways.ts"];function Zh(t){if(!t)return!1;const e=t.__resolveType??"";return e===""?Object.keys(t).length===0:j1.includes(e)||e.includes("always")}function N1(t){const e=t.variants??[];if(e.length===0)return-1;const s=e.findIndex(i=>Zh(i.rule));return s!==-1?s:e.length-1}function bC(t,e,s){const i=s.variants??[];if(i.length===0)return null;const r=N1(s),o=i[r]?.value;if(!o)return null;const a=structuredClone(o);return e.isLazy?{...t,section:a}:a}function yC(t,e){return e.isMultivariate?e.isLazy?t.section??null:t:null}function SC(t,e){return Array.isArray(t.variants)?t.variants.map((s,i)=>({label:e(s.rule)||`Variant ${i+1}`,value:s.value??{},rule:s.rule})):[]}function wC(t,e){const s=t.__resolveType??"";if(!s)return null;if(Zt(s)){const i=t.section??t,r=i.__resolveType??s;if(!r.includes("/")&&r in e){const o=e[r]??{};return{data:{...o},resolveType:o.__resolveType??r}}return{data:{...i},resolveType:r}}if(!s.includes("/")&&s in e){const i=e[s]??{};return{data:{...i},resolveType:i.__resolveType??s}}return{data:{...t},resolveType:s}}function E1(t,e){const s=t.__resolveType??"";return Zt(s)?{...t,section:e}:e}function CC(t,e,s){return e.isLazy?{...t,section:s}:s}function kC(t,e,s){const i=[...t.variants??[]],r=i[e];if(!r)return t;const o=r.value??{};return i[e]={...r,value:E1(o,s)},{...t,variants:i}}function jC(t,e,s){const i=[...t.variants??[]];return i[e]?(i[e]={...i[e],rule:s},{...t,variants:i}):t}function NC(t,e){const s=[...t.variants??[]],i=s[e];return i?(s.splice(e+1,0,structuredClone(i)),{...t,variants:s}):t}function EC(t,e){const s=[...t.variants??[]];return s.length<=1?null:(s.splice(e,1),{...t,variants:s})}const T1=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]);function R1(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t;return typeof e.__resolveType=="string"&&T1.has(e.__resolveType)&&typeof e.path=="string"}function Qh(t,e){const i=t[e]?.sections;if(!i||Array.isArray(i))return 1;const r=i;return Array.isArray(r.variants)?r.variants.length:1}function P1(t,e,s){const r=t[e]?.sections;if(Array.isArray(r))return s===0?r:[];if(r&&typeof r=="object"){const o=r.variants;if(Array.isArray(o)){const a=o[s];return Array.isArray(a?.value)?a.value:[]}}return[]}function TC(t,e,s){if(Array.isArray(t))return[{label:"Default",sections:t}];if(t&&typeof t=="object"){const i=t;if(Array.isArray(i.variants)){const r=i.variants,o=r.map(h=>k1(h.rule,e,s)),a=o.reduce((h,c)=>(h[c]=(h[c]??0)+1,h),{}),l={};return r.map((h,c)=>{const d=o[c]??`Variant ${c+1}`,u=a[d]??1;let f=d;return u>1&&(l[d]=(l[d]??0)+1,f=`${d} ${l[d]}`),{label:f||`Variant ${c+1}`,sections:Array.isArray(h.value)?h.value:[],rule:h.rule}})}}return[]}function D1(){return{__resolveType:i_}}function ci(t){return{rule:D1(),value:t}}function zs(t,e){return{...e,__resolveType:r_,variants:t}}function A1(t,e){const s=structuredClone(e);if(Array.isArray(t))return zs([ci(t),ci(s)]);if(t&&typeof t=="object"){const i=t;return Array.isArray(i.variants)?zs([...i.variants,ci(s)],i):null}return zs([ci([]),ci(s)])}function RC(t){const e=t.variants;return Array.isArray(e)?e.length-1:1}function PC(t,e){if(e.length===0)return zs([],t);if(e.length===1){const s=e[0],i=s?.rule;if(!Zh(i))return zs(e,t);if(Array.isArray(s?.value))return s.value}return zs(e,t)}function I1(t,e){for(const[s,i]of Object.entries(t)){if(!R1(i))continue;const r=i.sections;if(Array.isArray(r)){e(void 0,s,0);continue}if(!r||typeof r!="object")continue;const o=r.variants;if(Array.isArray(o))for(let a=0;a<o.length;a++){const l=o[a];e(l?.rule,s,a)}}}function DC(t,e,s){let i=0;return I1(t,r=>{if(!r)return;(r.__resolveType??"")===e&&qi(r,t,s)&&i++}),i}function hl(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),i=`${s} (copy)`;if(!t.has(i))return i;for(let r=2;r<1e3;r++){const o=`${s} (copy ${r})`;if(!t.has(o))return o}return`${s} (copy ${Date.now()})`}function B1(t,e){const s=Ni,i=e.replace(/-copy(?:-\d+)?$/,""),r=`${i}-copy`;if(!t.has(s(r)))return r;for(let o=2;o<1e3;o++){const a=`${i}-copy-${o}`;if(!t.has(s(a)))return a}return`${i}-copy-${Date.now()}`}function dl(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),i=`${s}_copy`;if(!Object.hasOwn(t,i))return i;for(let r=2;r<1e3;r++){const o=`${s}_copy_${r}`;if(!Object.hasOwn(t,o))return o}return`${s}_copy_${Date.now()}`}function M1(t){const e=ha(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function L1(t,e){return Uh(t,e)}const O1=1e3;function $1(t,e){for(let s=0;s<O1;s++){const i=ha(e);if(!Object.hasOwn(t,i))return i}throw new Error("Could not generate a unique page block key")}const z1={create:"Create new page",duplicate:"Duplicate page",rename:"Rename page"},F1={create:"Create",duplicate:"Duplicate",rename:"Save"},H1={create:"Creating…",duplicate:"Duplicating…",rename:"Saving…"};function W1(t){const e=H.c(54),{open:s,mode:i,initialName:r,initialPath:o,isPending:a,error:l,validate:h,onSubmit:c,onOpenChange:d}=t,u=a===void 0?!1:a,[f,m]=R.useState(r),[p,_]=R.useState(o),[v,x]=R.useState(null),[y,g]=R.useState(s);s!==y&&(g(s),s&&(m(r),_(o),x(null)));let b;e[0]!==u||e[1]!==d?(b=q=>{!q&&!u&&(x(null),d(!1))},e[0]=u,e[1]=d,e[2]=b):b=e[2];const S=b;let w;e[3]!==u||e[4]!==f||e[5]!==c||e[6]!==p||e[7]!==h?(w=async q=>{q.preventDefault();const Q=f.trim(),oe=p.trim();if(!Q||!oe||u)return;const L=la(oe);if(L){x(L);return}const ee=h?.({name:Q,path:oe});if(ee){x(ee);return}x(null),await c({name:Q,path:oe})},e[3]=u,e[4]=f,e[5]=c,e[6]=p,e[7]=h,e[8]=w):w=e[8];const k=w,N=v??l,D=z1[i];let I;e[9]!==D?(I=n.jsx(ts,{children:n.jsx(ss,{children:D})}),e[9]=D,e[10]=I):I=e[10];let P;e[11]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[11]=P):P=e[11];let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j=q=>m(q.target.value),e[12]=j):j=e[12];let C;e[13]!==u||e[14]!==f?(C=n.jsxs("div",{className:"space-y-1.5",children:[P,n.jsx(qe,{id:"page-form-name",value:f,onChange:j,placeholder:"My page",autoFocus:!0,disabled:u})]}),e[13]=u,e[14]=f,e[15]=C):C=e[15];let A;e[16]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:"Path"}),e[16]=A):A=e[16];let E;e[17]===Symbol.for("react.memo_cache_sentinel")?(E=q=>_(q.target.value),e[17]=E):E=e[17];let T;e[18]!==u||e[19]!==p?(T=n.jsxs("div",{className:"space-y-1.5",children:[A,n.jsx(qe,{id:"page-form-path",value:p,onChange:E,placeholder:"/example",disabled:u})]}),e[18]=u,e[19]=p,e[20]=T):T=e[20];let M;e[21]!==N?(M=N&&n.jsx("p",{className:"text-xs text-destructive",children:N}),e[21]=N,e[22]=M):M=e[22];let B;e[23]!==T||e[24]!==M||e[25]!==C?(B=n.jsxs("div",{className:"space-y-4 py-4",children:[C,T,M]}),e[23]=T,e[24]=M,e[25]=C,e[26]=B):B=e[26];let O;e[27]!==d?(O=()=>d(!1),e[27]=d,e[28]=O):O=e[28];let F;e[29]!==u||e[30]!==O?(F=n.jsx(se,{type:"button",variant:"outline",onClick:O,disabled:u,children:"Cancel"}),e[29]=u,e[30]=O,e[31]=F):F=e[31];let W;e[32]!==u||e[33]!==f||e[34]!==p?(W=!f.trim()||!p.trim()||u,e[32]=u,e[33]=f,e[34]=p,e[35]=W):W=e[35];let $;e[36]!==u||e[37]!==i?($=u?n.jsxs(n.Fragment,{children:[n.jsx(we,{size:14,className:"animate-spin"}),H1[i]]}):F1[i],e[36]=u,e[37]=i,e[38]=$):$=e[38];let U;e[39]!==W||e[40]!==$?(U=n.jsx(se,{type:"submit",disabled:W,children:$}),e[39]=W,e[40]=$,e[41]=U):U=e[41];let Y;e[42]!==F||e[43]!==U?(Y=n.jsxs(ei,{children:[F,U]}),e[42]=F,e[43]=U,e[44]=Y):Y=e[44];let V;e[45]!==k||e[46]!==B||e[47]!==Y||e[48]!==I?(V=n.jsx(Mt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:k,children:[I,B,Y]})}),e[45]=k,e[46]=B,e[47]=Y,e[48]=I,e[49]=V):V=e[49];let K;return e[50]!==S||e[51]!==s||e[52]!==V?(K=n.jsx(Bt,{open:s,onOpenChange:S,children:V}),e[50]=S,e[51]=s,e[52]=V,e[53]=K):K=e[53],K}function U1(t){const e=H.c(43),{open:s,blockKey:i,initialName:r,isPending:o,onSubmit:a,onOpenChange:l}=t,h=o===void 0?!1:o,[c,d]=R.useState(r),[u,f]=R.useState(s);s!==u&&(f(s),s&&d(r));let m;e[0]!==h||e[1]!==l?(m=T=>{!T&&!h&&l(!1)},e[0]=h,e[1]=l,e[2]=m):m=e[2];const p=m;let _;e[3]!==h||e[4]!==c||e[5]!==a?(_=async T=>{T.preventDefault();const M=c.trim();!M||h||await a(M)},e[3]=h,e[4]=c,e[5]=a,e[6]=_):_=e[6];const v=_;let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsxs(ts,{children:[n.jsx(ss,{children:"Rename section"}),n.jsx(Oo,{children:"Updates the display name. The internal key stays the same so pages referencing this section keep working."})]}),e[7]=x):x=e[7];let y;e[8]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[8]=y):y=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=T=>d(T.target.value),e[9]=g):g=e[9];let b;e[10]!==h||e[11]!==c?(b=n.jsxs("div",{className:"space-y-1.5",children:[y,n.jsx(qe,{id:"section-rename-name",value:c,onChange:g,autoFocus:!0,disabled:h})]}),e[10]=h,e[11]=c,e[12]=b):b=e[12];let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Key"}),e[13]=S):S=e[13];let w;e[14]!==i?(w=n.jsxs("div",{className:"space-y-1.5",children:[S,n.jsx(qe,{value:i,readOnly:!0,disabled:!0,className:"font-mono"})]}),e[14]=i,e[15]=w):w=e[15];let k;e[16]!==b||e[17]!==w?(k=n.jsxs("div",{className:"space-y-4 py-4",children:[b,w]}),e[16]=b,e[17]=w,e[18]=k):k=e[18];let N;e[19]!==l?(N=()=>l(!1),e[19]=l,e[20]=N):N=e[20];let D;e[21]!==h||e[22]!==N?(D=n.jsx(se,{type:"button",variant:"outline",onClick:N,disabled:h,children:"Cancel"}),e[21]=h,e[22]=N,e[23]=D):D=e[23];let I;e[24]!==h||e[25]!==c?(I=!c.trim()||h,e[24]=h,e[25]=c,e[26]=I):I=e[26];let P;e[27]!==h?(P=h?n.jsxs(n.Fragment,{children:[n.jsx(we,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[27]=h,e[28]=P):P=e[28];let j;e[29]!==I||e[30]!==P?(j=n.jsx(se,{type:"submit",disabled:I,children:P}),e[29]=I,e[30]=P,e[31]=j):j=e[31];let C;e[32]!==D||e[33]!==j?(C=n.jsxs(ei,{children:[D,j]}),e[32]=D,e[33]=j,e[34]=C):C=e[34];let A;e[35]!==v||e[36]!==k||e[37]!==C?(A=n.jsx(Mt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:v,children:[x,k,C]})}),e[35]=v,e[36]=k,e[37]=C,e[38]=A):A=e[38];let E;return e[39]!==p||e[40]!==s||e[41]!==A?(E=n.jsx(Bt,{open:s,onOpenChange:p,children:A}),e[39]=p,e[40]=s,e[41]=A,e[42]=E):E=e[42],E}const _n={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},K1="blog/sections/blocks/",ma=["posts","authors","categories"],Ei={posts:"post",authors:"author",categories:"category"};function Ti(t){return ma.includes(t)}const pa={posts:"post",authors:"author",categories:"category"},ed={posts:_n.post,authors:_n.author,categories:_n.category},V1=Object.fromEntries(Object.entries(ed).map(([t,e])=>[e,t]));function q1(t){return typeof t=="string"?V1[t]??null:null}function Lr(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function Bs(t){return typeof t=="string"?t:""}function G1(t,e){switch(t){case"posts":return{label:Bs(e.title)||"Untitled post",subtitle:Bs(e.slug)};case"authors":return{label:Bs(e.name)||"Unnamed author",subtitle:Bs(e.email)};case"categories":return{label:Bs(e.name)||"Unnamed category",subtitle:Bs(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function td(t){const e={posts:[],authors:[],categories:[]};for(const[s,i]of Object.entries(t)){const r=Lr(i);if(!r)continue;const o=q1(r.__resolveType);if(!o)continue;const a=Lr(r[pa[o]])??{},{label:l,subtitle:h}=G1(o,a);e[o].push({key:s,kind:o,label:l,subtitle:h})}for(const s of ma)e[s].sort((i,r)=>i.label.localeCompare(r.label));return e}function Y1(t,e){return td(t)[e]}function AC(t,e){return Y1(t,e).map(s=>({key:s.key,payload:sd(Lr(t[s.key])??void 0,e)}))}function sd(t,e){return t?Lr(t[pa[e]])??{}:{}}function ul(t,e,s){return{name:t,__resolveType:ed[e],[pa[e]]:s}}function id(t){return`.deco/blocks/${encodeURIComponent(t)}.json`}function Fn(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function fl(t,e){const s=`collections/blog/${e}/${Fn(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function X1(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${Fn(8)}`,date:new Date().toISOString().slice(0,10),image:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${Fn(8)}`};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}function IC(t){const e=new Set,s=[],i=t.manifest?.blocks??{};for(const r of Object.values(i))for(const o of Object.keys(r)){if(!o.startsWith(K1)||e.has(o))continue;e.add(o);const a=Vi(o,t);s.push({resolveType:o,title:a.title??J1(o),description:a.description,icon:a.icon})}return s.sort((r,o)=>r.title.localeCompare(o.title))}function J1(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Z1=["blog/sections/blocks/","site/sections/Blog/Post/"];function BC(t){return Z1.some(e=>t.startsWith(e))}function rd({orgSlug:t,virtualMcpId:e,branch:s}){return Dt.decofile(`${t}/${e}/${s}`)}function nd({orgSlug:t,virtualMcpId:e,branch:s},i){return`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/${i}`}function Q1(t){const e=H.c(11),s=qs();let i;e[0]!==t?(i=async l=>{const{blockKey:h,data:c}=l,d=await fetch(nd(t,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:id(h),content:JSON.stringify(c,null,2)})});if(!d.ok){const u=await d.json().catch(ex);throw new Error(u.error??`Write failed (${d.status})`)}return d.json()},e[0]=t,e[1]=i):i=e[1];let r;e[2]!==t||e[3]!==s?(r=async l=>{const{blockKey:h,data:c}=l,d=rd(t);await s.cancelQueries({queryKey:d});const u=s.getQueryData(d);return s.setQueryData(d,f=>({...f??{},[h]:c})),{previous:u,queryKey:d}},e[2]=t,e[3]=s,e[4]=r):r=e[4];let o;e[5]!==s?(o=(l,h,c)=>{c?.queryKey&&s.setQueryData(c.queryKey,c.previous)},e[5]=s,e[6]=o):o=e[6];let a;return e[7]!==i||e[8]!==r||e[9]!==o?(a={mutationFn:i,onMutate:r,onError:o},e[7]=i,e[8]=r,e[9]=o,e[10]=a):a=e[10],Gs(a)}function ex(){return{}}function tx(t){const e=qs();return Gs({mutationFn:async({blockKey:s})=>{const i=await fetch(nd(t,"unlink"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:id(s)})});if(!i.ok){const r=await i.json().catch(()=>({}));throw new Error(r.error??`Delete failed (${i.status})`)}return i.json()},onMutate:async({blockKey:s})=>{const i=rd(t);await e.cancelQueries({queryKey:i});const r=e.getQueryData(i);return e.setQueryData(i,o=>{if(!o)return o;const{[s]:a,...l}=o;return l}),{previous:r,queryKey:i}},onError:(s,i,r)=>{r?.queryKey&&e.setQueryData(r.queryKey,r.previous)}})}function sx(t){const e=H.c(20),{open:s,onOpenChange:i,pageKey:r,decofile:o}=t,[a,l]=R.useState(!1),h=o[r];let c;e[0]!==h?(c=h===void 0?"// Page not found.":JSON.stringify(h,null,2),e[0]=h,e[1]=c):c=e[1];const d=c;let u;e[2]!==d?(u=()=>{navigator.clipboard.writeText(d).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)})},e[2]=d,e[3]=u):u=e[3];const f=u;let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(ss,{className:"text-sm font-semibold",children:"Page JSON"}),e[4]=m):m=e[4];let p;e[5]!==a?(p=a?n.jsx(kc,{size:12}):n.jsx(ds,{size:12}),e[5]=a,e[6]=p):p=e[6];const _=a?"Copied":"Copy";let v;e[7]!==f||e[8]!==p||e[9]!==_?(v=n.jsxs(ts,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[m,n.jsxs(se,{variant:"ghost",size:"sm",onClick:f,className:"h-7 gap-1.5 text-xs",children:[p,_]})]}),e[7]=f,e[8]=p,e[9]=_,e[10]=v):v=e[10];let x;e[11]!==d?(x=n.jsx(Zr,{className:"max-h-[70vh]",children:n.jsx("pre",{className:"p-4 text-xs font-mono text-foreground/90 whitespace-pre overflow-auto",children:d})}),e[11]=d,e[12]=x):x=e[12];let y;e[13]!==v||e[14]!==x?(y=n.jsxs(Mt,{className:"max-w-2xl p-0 gap-0",children:[v,x]}),e[13]=v,e[14]=x,e[15]=y):y=e[15];let g;return e[16]!==i||e[17]!==s||e[18]!==y?(g=n.jsx(Bt,{open:s,onOpenChange:i,children:y}),e[16]=i,e[17]=s,e[18]=y,e[19]=g):g=e[19],g}const ml=R.lazy(()=>Kt(()=>import("./app-editor-CNQX0fRz.js"),__vite__mapDeps([156,1,2,46,47,48,16,3,5,77,6,7,8,9,10,11,12,13,14,15,17,4,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,78,50,72,79,73,80,51,81,49,82,83,84,58,85,60,61,157,90,91,92,93,94,95,96,97,98,99,100,101,102,57,103,59,104,105,106,107,108,66,109,56,110,71,111,70,67,112,113,114,115,116,117,65,87,88,52,53,54,55,62,63,64,68,69,74,75,76,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.AppEditor}))),ix=R.lazy(()=>Kt(()=>import("./post-editor-Ct8uL9lS.js"),__vite__mapDeps([158,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,4,5,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,49,70,48,71,72,50,47,73,74,75,76,91,92,93,46,94,95,96,97,98,99,100,101,85,102,103,104,105,106,107,108,109,110,111,150,122,151,133,152,129,131,148,115,87,88,79,81,51,82,83,84,77,78,80,159,157,90,112,113,114,116,117,118,119,120,121,123,124,125,126,127,128,130,132,134,135,136,137,138,139,140,141,142,143,144,145,146,147,149,153])).then(t=>({default:t.PostEditor}))),rx=R.lazy(()=>Kt(()=>import("./record-editor-BrKRPPKj.js"),__vite__mapDeps([160,1,2,50,72,73,81,8,39,40,7,16,20,18,6,9,10,11,12,13,14,15,3,17,4,5,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,41,42,43,44,45,49,51,82,83,84,58,85,60,61,159,157,90,91,92,93,46,47,48,94,95,96,97,98,99,100,101,102,57,103,59,104,105,106,107,108,66,109,56,110,71,111,70,67,112,113,114,115,116,117,65,79,87,88,52,53,54,55,62,63,64,68,69,74,75,76,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,80,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.RecordEditor}))),nx=R.lazy(()=>Kt(()=>import("./sections-editor-C0HkgTTy.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.SectionsEditor}))),ox=R.lazy(()=>Kt(()=>import("./seo-editor-C9Aqp93i.js"),__vite__mapDeps([161,1,2,4,6,7,8,9,10,11,12,13,14,15,16,3,17,5,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,86,72,80,77,78,50,79,73,51,81,49,82,83,84,58,85,60,61,90,91,92,93,94,95,96,97,98,99,100,101,102,57,103,59,104,105,106,107,108,66,109,56,110,71,111,70,67,112,113,114,115,116,117,65,87,88,52,53,54,55,62,63,64,68,69,74,75,76,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.SeoEditor}))),ax=R.lazy(()=>Kt(()=>import("./add-section-modal-cOeaGNML.js"),__vite__mapDeps([89,1,2,6,7,8,9,10,11,12,13,14,15,16,3,17,4,5,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,49,50,90,91,92,93,46,47,48,94,95,96,97,58,98,99,100,101,85,102,57,103,59,104,105,106,107,108,66,109,56,110,71,72,111,70,67,83,112,113,114,115,82,116,117,65,79,87,88,60,61,52,53,54,55,62,63,64,68,69,73,74,75,76,118,51,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,80,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.AddSectionModal}))),Hn="oklch(0.65 0.15 160)";function lx(){const t=H.c(18),e=Zi(),{data:s}=Ks.useSession(),{currentBranch:i}=es(),{org:r}=Ne(),o=e?.entity?.id??null,a=s?.user?.id,l=e?.entity?.metadata,h=a&&i?Kr(l?.sandboxMap?.[a]?.[i]):{},c=Object.values(h),u=(c.find(cx)??c[0])?.previewUrl??null,f=qt(),m=e?.entity?.organization_id??"";let p;t[0]!==r.slug||t[1]!==m?(p={connectionId:Cs,orgId:m,orgSlug:r.slug},t[0]=r.slug,t[1]=m,t[2]=p):p=t[2];const _=tt(p),v=Eo(_);let x;t[3]!==i||t[4]!==v||t[5]!==o?(x=()=>{if(!o)return;const w={virtualMcpId:o};i&&(w.branch=i),v.mutate(w)},t[3]=i,t[4]=v,t[5]=o,t[6]=x):x=t[6];const y=x,g=!!o&&!!i&&Dn.isStopped(o,i),b=$h({previewUrl:u,appPaused:f.status.state==="paused",userStopped:g});if(b.kind!=="iframe"){let w;return t[7]!==b||t[8]!==y||t[9]!==f.lifecycle||t[10]!==f.phase?(w=n.jsx(mx,{state:b,claimPhase:f.phase,lifecycle:f.lifecycle,onStart:y}),t[7]=b,t[8]=y,t[9]=f.lifecycle,t[10]=f.phase,t[11]=w):w=t[11],w}if(!o||!i){let w;return t[12]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(vi,{title:"Waiting for sandbox context…"}),t[12]=w):w=t[12],w}let S;return t[13]!==i||t[14]!==r.slug||t[15]!==u||t[16]!==o?(S=n.jsx(hx,{orgSlug:r.slug,virtualMcpId:o,branch:i,previewUrl:u}),t[13]=i,t[14]=r.slug,t[15]=u,t[16]=o,t[17]=S):S=t[17],S}function cx(t){return t.sandboxProviderKind!=="user-desktop"}function hx({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:i}){const r={orgSlug:t,virtualMcpId:e,branch:s},{data:o,isLoading:a}=Jo(r),[l,h]=R.useState("pages"),[c,d]=R.useState(null),[u,f]=R.useState(null),[m,p]=R.useState(""),[_,v]=R.useState(l);_!==l&&(v(l),p(""));const x=2e3,y=15,{data:g,isLoading:b}=Zo(r,{refetchInterval:J=>{if(l!=="apps"||!c||c.collection!=="apps")return!1;const fe=o?.[c.key]?.__resolveType;if(typeof fe!="string")return!1;const Se=J.state.data;return Se&&(On(fe,Se)||J.state.dataUpdateCount>=y)?!1:x}}),{catalog:S,isLoading:w}=b1(g??void 0,o??void 0,{enabled:l==="apps"}),k=da(r),N=u1(r),D=Q1(r),I=tx(r),[P,j]=R.useState(null),[C,A]=R.useState(),[E,T]=R.useState(!1),[M,B]=R.useState(null),[O,F]=R.useState(null),[W,$]=R.useState(null);if(a||b)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(we,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!g)return n.jsx(vi,{title:"Could not load site data."});const U=ia(o).sort((J,xe)=>J.name.localeCompare(xe.name)),Y=ra(o,g),V=jh(o,g),K=td(o),q=ma.some(J=>K[J].length>0),Q=Ti(l)?K[l]:[];if(!sa(o,g)&&!q)return n.jsx(vi,{icon:zi,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, or apps."});const oe={pages:U.length,sections:Y.length,apps:S.length,posts:K.posts.length,authors:K.authors.length,categories:K.categories.length},L=new Set(U.map(J=>Ni(J.path))),ee=new Set(U.map(J=>J.name)),te=new Set(Y.map(J=>J.name)),G=async J=>{const xe=o[J.key];if(!xe)return;const fe=Qh(o,J.key),Se=P1(o,J.key,Math.max(0,fe-1)),Ce=A1(xe.sections,Se);if(Ce)try{await k.mutateAsync({blockKey:J.key,data:{...xe,sections:Ce}}),ae.success(`Variant added to "${J.name}"`),d({collection:"pages",key:J.key,path:J.path})}catch(Ye){ae.error(Ye instanceof Error?Ye.message:"Could not add variant")}},z=()=>{A(void 0),j({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},le=J=>{A(void 0),j({mode:"duplicate",sourceKey:J.key,initialName:hl(ee,J.name),initialPath:B1(L,J.path)})},ue=J=>{A(void 0),j({mode:"rename",sourceKey:J.key,initialName:J.name,initialPath:J.path})},me=async J=>{if(!P)return;const{mode:xe,sourceKey:fe}=P;try{if(xe==="create"){const Se=L1(J.name,J.path),Ce=$1(o,J.name);await k.mutateAsync({blockKey:Ce,data:Se}),ae.success(`Created "${J.name}"`),d({collection:"pages",key:Ce,path:J.path})}else if(xe==="duplicate"&&fe){const Se=o[fe];if(!Se)throw new Error("Source page not found");const{key:Ce,data:Ye}=M1({source:Se,pages:U,newName:J.name,newPath:J.path});await k.mutateAsync({blockKey:Ce,data:Ye}),ae.success(`Duplicated as "${J.name}"`),d({collection:"pages",key:Ce,path:J.path})}else if(xe==="rename"&&fe){const Se=o[fe];if(!Se)throw new Error("Page not found");const Ce={...Se,name:J.name,path:J.path};await k.mutateAsync({blockKey:fe,data:Ce}),ae.success("Page updated"),c?.collection==="pages"&&c.key===fe&&d({collection:"pages",key:fe,path:J.path})}j(null)}catch(Se){A(Se instanceof Error?Se.message:"Save failed")}},he=({path:J})=>{if(!P)return null;const xe=Ni(J);return(P.mode==="rename"?Ni(P.initialPath):null)!==xe&&L.has(xe)?`A page with path "${J}" already exists.`:null},ie=async J=>{const xe=(J.title||J.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),fe=/^[A-Za-z]/.test(xe)&&xe.length>0?xe:"Section",Se=dl(o,fe),Ce={__resolveType:J.resolveType,name:Se};try{await k.mutateAsync({blockKey:Se,data:Ce}),ae.success(`Created section "${Se}"`),T(!1),d({collection:"sections",key:Se})}catch(Ye){ae.error(Ye instanceof Error?Ye.message:"Could not create section")}},ve=async J=>{const xe=o[J.key];if(!xe){ae.error("Section not found.");return}const fe=dl(o,J.key),Se=hl(te,J.name),Ce={...xe,name:Se};try{await k.mutateAsync({blockKey:fe,data:Ce}),ae.success(`Duplicated "${J.name}"`),d({collection:"sections",key:fe})}catch(Ye){ae.error(Ye instanceof Error?Ye.message:"Duplicate failed")}},re=async J=>{if(!M)return;const xe=o[M];if(!xe){ae.error("Section not found.");return}try{await k.mutateAsync({blockKey:M,data:{...xe,name:J}}),ae.success("Section renamed"),B(null)}catch(fe){ae.error(fe instanceof Error?fe.message:"Rename failed")}},ke=async J=>{const xe=fl(o,J),fe=ul(xe,J,X1(J));try{await D.mutateAsync({blockKey:xe,data:fe}),ae.success(`Created ${Ei[J]}`),d({collection:J,key:xe})}catch(Se){ae.error(Se instanceof Error?Se.message:"Could not create")}},it=async J=>{const xe=o[J.key];if(!xe){ae.error("Record not found.");return}const fe=fl(o,J.kind),Se=J.kind==="posts"?"title":"name",Ce={...structuredClone(sd(xe,J.kind)),[Se]:`${J.label} (copy)`};try{await D.mutateAsync({blockKey:fe,data:ul(fe,J.kind,Ce)}),ae.success(`Duplicated "${J.label}"`),d({collection:J.kind,key:fe})}catch(Ye){ae.error(Ye instanceof Error?Ye.message:"Duplicate failed")}},De=async()=>{if(!O)return;const{kind:J,key:xe,label:fe}=O;try{J==="blog"?await I.mutateAsync({blockKey:xe}):await N.mutateAsync({blockKey:xe}),ae.success(`Deleted "${fe}"`),c&&c.key===xe&&d(null),F(null)}catch(Se){ae.error(Se instanceof Error?Se.message:"Delete failed")}},ft=N.isPending||I.isPending,ai=O?.kind==="blog"?Ei[O.blogKind]:O?.kind??"item";return n.jsxs("div",{className:"flex h-full w-full",children:[n.jsx(dx,{active:l,counts:oe,showBlog:q,onSelect:J=>{h(J),d(null),f(null)}}),l!=="seo"&&l!=="site"&&n.jsx(ux,{activeCollection:l,pages:U,sections:Y,appCatalog:S,appCatalogLoading:w,blogEntries:Q,decofile:o,searchQuery:m,onSearchChange:p,selection:c,onSelect:J=>{d(J),f(null)},previewUrl:i,onCreate:()=>{l==="pages"?z():Ti(l)?ke(l):i?T(!0):ae.error("Start the preview dev server to add sections.")},onDuplicatePage:le,onRenamePage:ue,onAddPageVariant:G,onDeletePage:J=>F({kind:"page",key:J.key,label:J.name}),onEditPageSeo:J=>{d({collection:"pages",key:J.key,path:J.path}),f(J.key)},onViewPageJson:J=>$(J.key),onDuplicateSection:ve,onRenameSection:J=>B(J.key),onDeleteSection:J=>F({kind:"section",key:J.key,label:J.name}),onDuplicateBlog:it,onDeleteBlog:J=>F({kind:"blog",blogKind:J.kind,key:J.key,label:J.label})}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(R.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(we,{size:20,className:"animate-spin text-muted-foreground"})}),children:l==="site"?V?n.jsx(ml,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:V.key,block:o[V.key],meta:g,title:"Site",excludeFields:["seo"]},`site:${V.key}`):n.jsx(vi,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):l==="seo"?n.jsx(ox,{orgSlug:t,virtualMcpId:e,branch:s,decofile:o,meta:g,target:{kind:"site"},previewBaseUrl:i}):c?c.collection==="apps"?n.jsx(ml,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:c.key,block:o[c.key],meta:g,schemaPending:typeof o[c.key]?.__resolveType=="string"&&!On(String(o[c.key].__resolveType),g)},`app:${c.key}`):c.collection==="posts"?n.jsx(ix,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:c.key,block:o[c.key],decofile:o,meta:g},`post:${c.key}`):c.collection==="authors"||c.collection==="categories"?n.jsx(rx,{orgSlug:t,virtualMcpId:e,branch:s,kind:c.collection,blockKey:c.key,block:o[c.key]},`${c.collection}:${c.key}`):n.jsx(nx,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:i??void 0,currentPath:c.collection==="pages"?c.path:"/",activePageBlockKey:c.collection==="pages"?c.key:null,activeGlobalBlockKey:c.collection==="sections"?c.key:null,initialEditSeo:c.collection==="pages"&&u===c.key,onExitSeo:()=>f(null)},c.collection==="pages"?`page:${c.key}`:`section:${c.key}`):n.jsx(vi,{title:`Select ${Ti(l)?`a ${Ei[l]}`:l==="pages"?"a page":l==="apps"?"an app":"a section"} to edit`,description:l==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),P&&n.jsx(W1,{open:!!P,mode:P.mode,initialName:P.initialName,initialPath:P.initialPath,isPending:k.isPending,error:C,validate:he,onSubmit:me,onOpenChange:J=>{J||(j(null),A(void 0))}}),M&&n.jsx(U1,{open:!!M,blockKey:M,initialName:Y.find(J=>J.key===M)?.name??M,isPending:k.isPending,onSubmit:re,onOpenChange:J=>{J||B(null)}}),E&&i&&n.jsx(R.Suspense,{fallback:null,children:n.jsx(ax,{open:E,onOpenChange:T,meta:g,decofile:o,previewBaseUrl:i,onSelect:ie})}),W&&n.jsx(sx,{open:!!W,onOpenChange:J=>{J||$(null)},pageKey:W,decofile:o}),n.jsx(kr,{open:!!O,onOpenChange:J=>{!J&&!ft&&F(null)},children:n.jsxs(jr,{children:[n.jsxs(Nr,{children:[n.jsx(Er,{children:`Delete ${ai}?`}),n.jsx(Tr,{children:O?.kind==="section"?`"${O.label}" will be removed. Pages that still reference it will lose this section.`:O?`"${O.label}" will be removed permanently. This can't be undone.`:null})]}),n.jsxs(Rr,{children:[n.jsx(Pr,{disabled:ft,children:"Cancel"}),n.jsx(Dr,{onClick:J=>{J.preventDefault(),De()},disabled:ft,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ft?n.jsxs(n.Fragment,{children:[n.jsx(we,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function dx(t){const e=H.c(33),{active:s,counts:i,showBlog:r,onSelect:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:n.jsx("span",{className:"text-sm font-medium",children:"Content"})}),e[0]=a):a=e[0];const l=s==="pages";let h;e[1]!==i.pages||e[2]!==o||e[3]!==l?(h=n.jsx(ns,{id:"pages",icon:Ao,label:"Pages",count:i.pages,active:l,onSelect:o}),e[1]=i.pages,e[2]=o,e[3]=l,e[4]=h):h=e[4];const c=s==="sections";let d;e[5]!==i.sections||e[6]!==o||e[7]!==c?(d=n.jsx(ns,{id:"sections",icon:Hs,label:"Sections",count:i.sections,active:c,onSelect:o}),e[5]=i.sections,e[6]=o,e[7]=c,e[8]=d):d=e[8];const u=s==="apps";let f;e[9]!==i.apps||e[10]!==o||e[11]!==u?(f=n.jsx(ns,{id:"apps",icon:eh,label:"Apps",count:i.apps,active:u,onSelect:o}),e[9]=i.apps,e[10]=o,e[11]=u,e[12]=f):f=e[12];let m;e[13]!==s||e[14]!==i.authors||e[15]!==i.categories||e[16]!==i.posts||e[17]!==o||e[18]!==r?(m=r&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[n.jsx(Qc,{size:13,className:"shrink-0"}),"Blog"]}),n.jsx(ns,{id:"posts",icon:Dc,label:"Posts",count:i.posts,active:s==="posts",onSelect:o}),n.jsx(ns,{id:"authors",icon:Ho,label:"Authors",count:i.authors,active:s==="authors",onSelect:o}),n.jsx(ns,{id:"categories",icon:Ac,label:"Categories",count:i.categories,active:s==="categories",onSelect:o})]}),e[13]=s,e[14]=i.authors,e[15]=i.categories,e[16]=i.posts,e[17]=o,e[18]=r,e[19]=m):m=e[19];const p=s==="site";let _;e[20]!==o||e[21]!==p?(_=n.jsx(ns,{id:"site",icon:bf,label:"Site",active:p,onSelect:o}),e[20]=o,e[21]=p,e[22]=_):_=e[22];const v=s==="seo";let x;e[23]!==o||e[24]!==v?(x=n.jsx(ns,{id:"seo",icon:Sr,label:"SEO",active:v,onSelect:o}),e[23]=o,e[24]=v,e[25]=x):x=e[25];let y;return e[26]!==_||e[27]!==x||e[28]!==h||e[29]!==d||e[30]!==f||e[31]!==m?(y=n.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[a,n.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,d,f,m,_,x]})]}),e[26]=_,e[27]=x,e[28]=h,e[29]=d,e[30]=f,e[31]=m,e[32]=y):y=e[32],y}function ns(t){const e=H.c(18),{id:s,icon:i,label:r,count:o,active:a,onSelect:l}=t;let h;e[0]!==s||e[1]!==l?(h=()=>l(s),e[0]=s,e[1]=l,e[2]=h):h=e[2];const c=a?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let d;e[3]!==c?(d=ce("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",c),e[3]=c,e[4]=d):d=e[4];let u;e[5]!==i?(u=n.jsx(i,{size:16,className:"shrink-0"}),e[5]=i,e[6]=u):u=e[6];let f;e[7]!==r?(f=n.jsx("span",{className:"flex-1 truncate",children:r}),e[7]=r,e[8]=f):f=e[8];let m;e[9]!==a||e[10]!==o?(m=o!==void 0&&n.jsx("span",{className:ce("shrink-0 text-xs tabular-nums",a?"text-accent-foreground/70":"text-muted-foreground/70"),children:o}),e[9]=a,e[10]=o,e[11]=m):m=e[11];let p;return e[12]!==h||e[13]!==d||e[14]!==u||e[15]!==f||e[16]!==m?(p=n.jsxs("button",{type:"button",onClick:h,className:d,children:[u,f,m]}),e[12]=h,e[13]=d,e[14]=u,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function ux(t){const e=H.c(57),{activeCollection:s,pages:i,sections:r,appCatalog:o,appCatalogLoading:a,blogEntries:l,decofile:h,previewUrl:c,searchQuery:d,onSearchChange:u,selection:f,onSelect:m,onCreate:p,onDuplicatePage:_,onRenamePage:v,onAddPageVariant:x,onDeletePage:y,onEditPageSeo:g,onViewPageJson:b,onDuplicateSection:S,onRenameSection:w,onDeleteSection:k,onDuplicateBlog:N,onDeleteBlog:D}=t;let I,P,j,C,A,E;if(e[0]!==s||e[1]!==o||e[2]!==a||e[3]!==l||e[4]!==h||e[5]!==x||e[6]!==p||e[7]!==D||e[8]!==y||e[9]!==k||e[10]!==N||e[11]!==_||e[12]!==S||e[13]!==g||e[14]!==v||e[15]!==w||e[16]!==u||e[17]!==m||e[18]!==b||e[19]!==i||e[20]!==c||e[21]!==d||e[22]!==r||e[23]!==f){const O=d.toLowerCase(),F=i.filter(z=>!O||z.name.toLowerCase().includes(O)||z.path.toLowerCase().includes(O)),W=r.filter(z=>!O||z.name.toLowerCase().includes(O)||z.key.toLowerCase().includes(O)||z.resolveType.toLowerCase().includes(O)),$=o.filter(z=>!O||z.title.toLowerCase().includes(O)||z.app.toLowerCase().includes(O)||z.vendor.toLowerCase().includes(O)||z.category.toLowerCase().includes(O)),U=l.filter(z=>!O||z.label.toLowerCase().includes(O)||z.subtitle.toLowerCase().includes(O)),Y=`Search ${s}…`,V=Ti(s)?`Create new ${Ei[s]}`:s==="pages"?"Create new page":"Create new section",K=s==="sections"&&!c,q=s!=="apps",Q=K,oe=K?"Start the preview dev server to add sections":void 0;A="w-[300px] shrink-0 border-r flex flex-col min-h-0";let L;e[30]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx(Zc,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[30]=L):L=e[30];let ee;e[31]!==u?(ee=z=>u(z.target.value),e[31]=u,e[32]=ee):ee=e[32];let te;e[33]!==Y||e[34]!==d||e[35]!==ee?(te=n.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[L,n.jsx("input",{type:"text",value:d,onChange:ee,placeholder:Y,"aria-label":Y,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[33]=Y,e[34]=d,e[35]=ee,e[36]=te):te=e[36];let G;e[37]!==Q||e[38]!==oe||e[39]!==V||e[40]!==p||e[41]!==q?(G=q&&n.jsxs(Pe,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",onClick:p,disabled:Q,"aria-label":V,"aria-disabled":Q,children:n.jsx(At,{size:14})})}),n.jsx(Re,{side:"bottom",children:oe??V})]}),e[37]=Q,e[38]=oe,e[39]=V,e[40]=p,e[41]=q,e[42]=G):G=e[42],e[43]!==te||e[44]!==G?(E=n.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[te,G]}),e[43]=te,e[44]=G,e[45]=E):E=e[45],I=Zr,C="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",P="flex flex-col gap-1 p-1.5",j=s==="pages"?F.length===0?n.jsx(rr,{hasItems:i.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):F.map(z=>{const le=f?.collection==="pages"&&f.key===z.key,ue=Qh(h,z.key);return n.jsx(ir,{icon:Ao,title:z.name,subtitle:z.path,active:le,variantCount:ue,onClick:()=>m({collection:"pages",key:z.key,path:z.path}),menu:n.jsx(gn,{onDuplicate:()=>_(z),onRename:()=>v(z),onAddVariant:()=>x(z),onEditSeo:()=>g(z),onViewJson:()=>b(z),onDelete:()=>y(z)})},z.key)}):s==="sections"?W.length===0?n.jsx(rr,{hasItems:r.length>0,emptyLabel:"No saved sections yet.",emptyHint:'Click "+" to create one, or save a section from a page.'}):W.map(z=>{const le=f?.collection==="sections"&&f.key===z.key,ue=z.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return n.jsx(ir,{icon:Hs,title:z.name,subtitle:ue??z.resolveType,active:le,onClick:()=>m({collection:"sections",key:z.key}),menu:n.jsx(gn,{onDuplicate:()=>S(z),onRename:()=>w(z),onDelete:()=>k(z)})},z.key)}):s==="apps"?a?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx(we,{size:18,className:"animate-spin text-muted-foreground"})}):$.length===0?n.jsx(rr,{hasItems:o.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):$.map(z=>{const le=f?.collection==="apps"&&z.blockKey!==null&&f.key===z.blockKey;return n.jsx(ir,{icon:eh,logoUrl:z.logo,title:z.title,subtitle:z.category,active:le,trailing:z.installed?n.jsx("span",{className:"shrink-0 rounded-full bg-emerald-500/15 px-1.5 py-0.5 text-[10px] font-medium text-emerald-700 dark:text-emerald-400",children:"Installed"}):void 0,onClick:()=>{if(!z.installed||!z.blockKey){ae.message(`${z.title} is not installed on this site.`);return}m({collection:"apps",key:z.blockKey})}},z.id)}):U.length===0?n.jsx(rr,{hasItems:l.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${Ti(s)?Ei[s]:"item"}.`}):U.map(z=>{const le=f?.collection===z.kind&&f.key===z.key;return n.jsx(ir,{icon:z.kind==="posts"?Dc:z.kind==="authors"?Ho:Ac,title:z.label,subtitle:z.subtitle,active:le,onClick:()=>m({collection:z.kind,key:z.key}),menu:n.jsx(gn,{onDuplicate:()=>N(z),onDelete:()=>D(z)})},z.key)}),e[0]=s,e[1]=o,e[2]=a,e[3]=l,e[4]=h,e[5]=x,e[6]=p,e[7]=D,e[8]=y,e[9]=k,e[10]=N,e[11]=_,e[12]=S,e[13]=g,e[14]=v,e[15]=w,e[16]=u,e[17]=m,e[18]=b,e[19]=i,e[20]=c,e[21]=d,e[22]=r,e[23]=f,e[24]=I,e[25]=P,e[26]=j,e[27]=C,e[28]=A,e[29]=E}else I=e[24],P=e[25],j=e[26],C=e[27],A=e[28],E=e[29];let T;e[46]!==P||e[47]!==j?(T=n.jsx("div",{className:P,children:j}),e[46]=P,e[47]=j,e[48]=T):T=e[48];let M;e[49]!==I||e[50]!==C||e[51]!==T?(M=n.jsx(I,{className:C,children:T}),e[49]=I,e[50]=C,e[51]=T,e[52]=M):M=e[52];let B;return e[53]!==A||e[54]!==E||e[55]!==M?(B=n.jsxs("div",{className:A,children:[E,M]}),e[53]=A,e[54]=E,e[55]=M,e[56]=B):B=e[56],B}function ir(t){const e=H.c(29),{icon:s,logoUrl:i,title:r,subtitle:o,active:a,variantCount:l,trailing:h,onClick:c,menu:d}=t;let u;e[0]!==s||e[1]!==a||e[2]!==i||e[3]!==l?(u=l&&l>1?n.jsxs(Pe,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(s,{size:16,className:"shrink-0",style:{color:Hn}})}),n.jsxs(Re,{side:"right",children:[l," variants"]})]}):i?n.jsx("img",{src:i,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):n.jsx(s,{size:16,className:ce("shrink-0",a?"text-accent-foreground":"text-muted-foreground")}),e[0]=s,e[1]=a,e[2]=i,e[3]=l,e[4]=u):u=e[4];const f=u,m=a?"bg-accent text-accent-foreground":"hover:bg-muted";let p;e[5]!==m?(p=ce("group relative flex min-w-0 items-center rounded-md transition-colors",m),e[5]=m,e[6]=p):p=e[6];let _;e[7]!==r?(_=n.jsx("span",{className:"block truncate text-sm font-medium",children:r}),e[7]=r,e[8]=_):_=e[8];const v=a?"text-accent-foreground/70":"text-muted-foreground";let x;e[9]!==v?(x=ce("block truncate text-xs",v),e[9]=v,e[10]=x):x=e[10];let y;e[11]!==o||e[12]!==x?(y=n.jsx("span",{className:x,children:o}),e[11]=o,e[12]=x,e[13]=y):y=e[13];let g;e[14]!==_||e[15]!==y?(g=n.jsxs("span",{className:"min-w-0 flex-1",children:[_,y]}),e[14]=_,e[15]=y,e[16]=g):g=e[16];let b;e[17]!==c||e[18]!==f||e[19]!==g||e[20]!==h?(b=n.jsxs("button",{type:"button",onClick:c,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[f,g,h]}),e[17]=c,e[18]=f,e[19]=g,e[20]=h,e[21]=b):b=e[21];let S;e[22]!==a||e[23]!==d?(S=d&&n.jsx("div",{className:ce("pr-1 opacity-0 transition-opacity group-hover:opacity-100",a&&"opacity-100"),children:d}),e[22]=a,e[23]=d,e[24]=S):S=e[24];let w;return e[25]!==S||e[26]!==p||e[27]!==b?(w=n.jsxs("div",{className:p,children:[b,S]}),e[25]=S,e[26]=p,e[27]=b,e[28]=w):w=e[28],w}function gn(t){const e=H.c(21),{onDuplicate:s,onRename:i,onAddVariant:r,onEditSeo:o,onViewJson:a,onDelete:l}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Zs,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":"More actions",className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:fx,children:n.jsx(Yr,{size:14})})}),e[0]=h):h=e[0];let c;e[1]!==i?(c=i&&n.jsxs(et,{onClick:i,children:[n.jsx(Wo,{size:14}),"Rename"]}),e[1]=i,e[2]=c):c=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(ds,{size:14}),e[3]=d):d=e[3];let u;e[4]!==s?(u=n.jsxs(et,{onClick:s,children:[d,"Duplicate"]}),e[4]=s,e[5]=u):u=e[5];let f;e[6]!==r?(f=r&&n.jsxs(n.Fragment,{children:[n.jsx(ur,{}),n.jsxs(et,{onClick:r,className:"cursor-pointer",style:{color:Hn},children:[n.jsx(yf,{size:14,style:{color:Hn}}),"Add variant"]})]}),e[6]=r,e[7]=f):f=e[7];let m;e[8]!==o||e[9]!==a?(m=(o||a)&&n.jsxs(n.Fragment,{children:[n.jsx(ur,{}),o&&n.jsxs(et,{onClick:o,children:[n.jsx(Sr,{size:14}),"Edit SEO"]}),a&&n.jsxs(et,{onClick:a,children:[n.jsx(Io,{size:14}),"View JSON"]})]}),e[8]=o,e[9]=a,e[10]=m):m=e[10];let p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(ur,{}),e[11]=p):p=e[11];let _;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(Ii,{size:14}),e[12]=_):_=e[12];let v;e[13]!==l?(v=n.jsxs(et,{onClick:l,className:"text-destructive focus:text-destructive",children:[_,"Delete"]}),e[13]=l,e[14]=v):v=e[14];let x;return e[15]!==c||e[16]!==u||e[17]!==f||e[18]!==m||e[19]!==v?(x=n.jsxs(Js,{children:[h,n.jsxs(Qs,{align:"end",className:"w-44",children:[c,u,f,m,p,v]})]}),e[15]=c,e[16]=u,e[17]=f,e[18]=m,e[19]=v,e[20]=x):x=e[20],x}function fx(t){return t.stopPropagation()}function rr(t){const e=H.c(6),{hasItems:s,emptyLabel:i,emptyHint:r}=t;let o;e[0]!==r||e[1]!==i||e[2]!==s?(o=s?"No results match your search.":n.jsxs(n.Fragment,{children:[n.jsx("div",{children:i}),n.jsx("div",{className:"mt-1 text-muted-foreground/80",children:r})]}),e[0]=r,e[1]=i,e[2]=s,e[3]=o):o=e[3];let a;return e[4]!==o?(a=n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=a):a=e[5],a}function mx(t){const e=H.c(8),{state:s,claimPhase:i,lifecycle:r,onStart:o}=t;switch(s.kind){case"starting":{let a;e[0]!==i||e[1]!==r?(a=Vh({claimPhase:i,lifecycle:r}),e[0]=i,e[1]=r,e[2]=a):a=e[2];let l;return e[3]!==i||e[4]!==a?(l=n.jsx(Br,{kind:"starting",progress:a,claimPhase:i}),e[3]=i,e[4]=a,e[5]=l):l=e[5],l}case"suspended":{let a;return e[6]!==o?(a=n.jsx(Br,{kind:"suspended",onResume:o}),e[6]=o,e[7]=a):a=e[7],a}}}function vi(t){const e=H.c(10),{icon:s,title:i,description:r}=t;let o;e[0]!==s?(o=s&&n.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=o):o=e[1];let a;e[2]!==i?(a=n.jsx("div",{children:i}),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==r?(l=r&&n.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:r}),e[4]=r,e[5]=l):l=e[5];let h;return e[6]!==o||e[7]!==a||e[8]!==l?(h=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[o,a,l]}),e[6]=o,e[7]=a,e[8]=l,e[9]=h):h=e[9],h}function px(t){const e=H.c(2),{virtualMcpId:s}=t,i=It(s);if(!Ys(i?.metadata)){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[n.jsx(zi,{size:24,className:"text-muted-foreground/60"}),n.jsx("div",{children:"No content to edit."}),n.jsx("div",{className:"text-xs text-muted-foreground/80",children:"Connect a GitHub repository from the Settings tab to enable Content."})]}),e[0]=a):a=e[0],a}let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(lx,{}),e[1]=o):o=e[1],o}const vn={fast:{label:"Fast",subtitle:"Quick responses for simple tasks",icon:Rc},smart:{label:"Smart",subtitle:"Balanced quality and speed",icon:Jr},thinking:{label:"Thinking",subtitle:"Deeper reasoning for hard tasks",icon:kf}},_x=["fast","smart","thinking"];function gx(t){const e=H.c(15),{tier:s,onSelect:i}=t,[r,o]=R.useState(!1),a=vn[s].icon;let l;e[0]!==a?(l=n.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=l):l=e[1];const h=vn[s];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(js,{size:14,className:"text-muted-foreground"}),e[2]=c):c=e[2];let d;e[3]!==l||e[4]!==h.label?(d=n.jsx(Es,{asChild:!0,children:n.jsxs(se,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[l,h.label,c]})}),e[3]=l,e[4]=h.label,e[5]=d):d=e[5];let u;e[6]!==i||e[7]!==s?(u=_x.map(p=>{const _=vn[p],v=_.icon;return n.jsxs("button",{type:"button",onClick:()=>{i(p),o(!1)},className:ce("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[n.jsx(v,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"text-sm",children:_.label}),n.jsx("div",{className:"text-xs text-muted-foreground",children:_.subtitle})]}),p===s&&n.jsx(Wi,{size:14,className:"text-foreground mt-0.5"})]},p)}),e[6]=i,e[7]=s,e[8]=u):u=e[8];let f;e[9]!==u?(f=n.jsx(Ts,{align:"start",className:"p-1 w-64",children:n.jsx("div",{className:"flex flex-col",children:u})}),e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==r||e[12]!==d||e[13]!==f?(m=n.jsxs(Ns,{open:r,onOpenChange:o,children:[d,f]}),e[11]=r,e[12]=d,e[13]=f,e[14]=m):m=e[14],m}function vx(t){const e=H.c(15),{tier:s,onTierChange:i,override:r,onOverrideChange:o}=t,[a,l]=R.useState(r!==null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Model"}),e[0]=h):h=e[0];let c;e[1]!==o||e[2]!==i||e[3]!==r||e[4]!==s||e[5]!==a?(c=a?n.jsx(R.Suspense,{fallback:n.jsx(se,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:"Loading models…"}),children:n.jsx(xx,{override:r,onOverrideChange:o})}):n.jsx(gx,{tier:s,onSelect:i}),e[1]=o,e[2]=i,e[3]=r,e[4]=s,e[5]=a,e[6]=c):c=e[6];let d;e[7]!==o?(d=m=>{l(m),m||o(null)},e[7]=o,e[8]=d):d=e[8];let u;e[9]!==d||e[10]!==a?(u=n.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[n.jsx(Ar,{checked:a,onCheckedChange:d,className:"cursor-pointer"}),"Specific model"]}),e[9]=d,e[10]=a,e[11]=u):u=e[11];let f;return e[12]!==c||e[13]!==u?(f=n.jsxs("div",{className:"flex flex-col gap-2",children:[h,n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[c,u]})]}),e[12]=c,e[13]=u,e[14]=f):f=e[14],f}function xx(t){const e=H.c(10),{override:s,onOverrideChange:i}=t,r=Nc(),o=r[0]?.id??null,[a,l]=R.useState(s?.credentialId??o);let h;e[0]!==s?(h=s?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[0]=s,e[1]=h):h=e[1];const c=h;if(r.length===0){let f;return e[2]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Connect an AI provider in settings to pick a specific model."}),e[2]=f):f=e[2],f}let d;e[3]!==a||e[4]!==i?(d=f=>{const m=f.keyId??a??"";l(m),i({modelId:f.modelId,credentialId:m,title:f.title??f.modelId})},e[3]=a,e[4]=i,e[5]=d):d=e[5];let u;return e[6]!==a||e[7]!==c||e[8]!==d?(u=n.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:n.jsx(zm,{variant:"bordered",placeholder:"Pick a model",model:c,credentialId:a,onCredentialChange:l,onModelChange:d})}),e[6]=a,e[7]=c,e[8]=d,e[9]=u):u=e[9],u}const od=[{key:"capabilities",heading:"Built-in capabilities",icon:Uo,tools:[{name:"web_search",title:"Web search",description:"Look up current information on the web",icon:Fi},{name:"generate_image",title:"Generate image",description:"Create images from a text prompt",icon:Dm},{name:"subtask",title:"Subtask",description:"Spawn a focused sub-agent to handle part of the work",icon:Ai},{name:"user_ask",title:"Ask the user",description:"Pause to ask the user a clarifying question",icon:Sf}]},{key:"files",heading:"Files & code",icon:Oa,tools:[{name:"read",title:"Read File",description:"Read a file from the workspace",icon:Wc},{name:"write",title:"Write File",description:"Create or overwrite a file",icon:Wo},{name:"edit",title:"Edit File",description:"Make targeted edits to an existing file",icon:wf},{name:"grep",title:"Search Content",description:"Search file contents by pattern",icon:Fo},{name:"glob",title:"Find Files",description:"Find files by name pattern",icon:Oa},{name:"bash",title:"Run Command",description:"Run shell commands in the sandbox",icon:Cf}]},{key:"context",heading:"Context",icon:Ba,tools:[{name:"read_resource",title:"Read Resource",description:"Read an MCP resource by URI",icon:Ba},{name:"read_prompt",title:"Read Prompt",description:"Read an MCP prompt definition",icon:Qc}]},{key:"browser",heading:"Browser",icon:Hs,tools:[{name:"take_screenshot",title:"Take Screenshot",description:"Capture a screenshot of a web page",icon:Fc},{name:"scrape_url",title:"Scrape URL",description:"Fetch and extract content from a URL",icon:Hs},{name:"inspect_page",title:"Inspect Page",description:"Inspect a web page's structure",icon:Io}]}],bx=od.flatMap(t=>t.tools.map(e=>e.name));function yx(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function Sx(t){const e=H.c(5),{agentId:s,value:i,onChange:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Tools"}),e[0]=o):o=e[0];let a;return e[1]!==s||e[2]!==r||e[3]!==i?(a=n.jsxs("div",{className:"flex flex-col gap-2",children:[o,s?n.jsx(R.Suspense,{fallback:n.jsxs(se,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[n.jsx(Uo,{size:14}),"Loading tools…"]}),children:n.jsx(wx,{agentId:s,value:i,onChange:r})}):n.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Pick an agent first"})]}),e[1]=s,e[2]=r,e[3]=i,e[4]=a):a=e[4],a}function pl(t){const e=H.c(17),{value:s,checked:i,onToggle:r,title:o,description:a,leading:l}=t;let h;e[0]!==i?(h=n.jsx(Qr,{checked:i,className:"pointer-events-none mt-0.5"}),e[0]=i,e[1]=h):h=e[1];let c;e[2]!==l?(c=l&&n.jsx("span",{className:"mt-px shrink-0",children:l}),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==o?(d=n.jsx("span",{className:"truncate text-sm leading-tight",children:o}),e[4]=o,e[5]=d):d=e[5];let u;e[6]!==a?(u=a&&n.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:a}),e[6]=a,e[7]=u):u=e[7];let f;e[8]!==d||e[9]!==u?(f=n.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[d,u]}),e[8]=d,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==r||e[12]!==h||e[13]!==c||e[14]!==f||e[15]!==s?(m=n.jsxs($m,{value:s,onSelect:r,className:"items-start gap-2.5 py-2",children:[h,c,f]}),e[11]=r,e[12]=h,e[13]=c,e[14]=f,e[15]=s,e[16]=m):m=e[16],m}function _l(t){const e=H.c(20),{conn:s,label:i,icon:r,on:o,total:a,onToggle:l}=t,h=o===a;let c;e[0]!==r||e[1]!==s?(c=s?n.jsx(Vt,{icon:s.icon,name:s.title,size:"2xs"}):r?n.jsx(r,{size:14,className:"text-muted-foreground"}):n.jsx(jf,{size:14,className:"text-muted-foreground"}),e[0]=r,e[1]=s,e[2]=c):c=e[2];const d=s?.title??i??"Other tools";let u;e[3]!==d?(u=n.jsx("span",{className:"truncate",children:d}),e[3]=d,e[4]=u):u=e[4];let f;e[5]!==o||e[6]!==a?(f=n.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[o,"/",a]}),e[5]=o,e[6]=a,e[7]=f):f=e[7];let m;e[8]!==l?(m=y=>{y.stopPropagation(),l()},e[8]=l,e[9]=m):m=e[9];const p=h?"None":"All";let _;e[10]!==m||e[11]!==p?(_=n.jsx("button",{type:"button",onClick:m,className:"text-[11px] font-medium text-primary hover:underline",children:p}),e[10]=m,e[11]=p,e[12]=_):_=e[12];let v;e[13]!==f||e[14]!==_?(v=n.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[f,_]}),e[13]=f,e[14]=_,e[15]=v):v=e[15];let x;return e[16]!==c||e[17]!==u||e[18]!==v?(x=n.jsxs("div",{className:"flex items-center gap-2",children:[c,u,v]}),e[16]=c,e[17]=u,e[18]=v,e[19]=x):x=e[19],x}function wx(t){const e=H.c(70),{agentId:s,value:i,onChange:r}=t,{org:o}=Ne(),[a,l]=R.useState(!1);let h;e[0]!==s||e[1]!==o.id||e[2]!==o.slug?(h={connectionId:s,orgId:o.id,orgSlug:o.slug},e[0]=s,e[1]=o.id,e[2]=o.slug,e[3]=h):h=e[3];const c=tt(h);let d;e[4]!==c?(d={client:c},e[4]=c,e[5]=d):d=e[5];const{data:u,isLoading:f}=Kf(d),m=Hi();let p,_,v,x,y,g,b,S,w,k,N,D,I;if(e[6]!==m||e[7]!==u?.tools||e[8]!==f||e[9]!==r||e[10]!==a||e[11]!==i){const E=new Map(m.map(Ex)),T=new Map;for(const he of u?.tools??[]){const ie=Vu(he._meta)??"__other__",ve=qu(he.name,ie==="__other__"?void 0:ie),re=he.title,ke=re&&re!==he.name?re:yx(ve);T.has(ie)||T.set(ie,{clientId:ie,conn:E.get(ie),tools:[]}),T.get(ie).tools.push({name:he.name,display:ke,description:he.description})}const M=[...T.values()].sort(Nx),B=(u?.tools??[]).map(jx),O=[...bx,...B],F=i===null?new Set(O):new Set(i),W=O.every(he=>F.has(he)),$=he=>r(O.every(ie=>he.has(ie))?null:[...he]),U=he=>{const ie=new Set(F);ie.has(he)?ie.delete(he):ie.add(he),$(ie)},Y=(he,ie)=>{const ve=new Set(F);for(const re of he)ie?ve.add(re):ve.delete(re);$(ve)};x=Ns,I=a,y=l;let V;e[25]===Symbol.for("react.memo_cache_sentinel")?(V=n.jsx(Uo,{size:14,className:"text-muted-foreground"}),e[25]=V):V=e[25];const K=W?"All tools":"Tools",q=!W&&n.jsxs(Im,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[F.size,"/",O.length]});let Q;e[26]===Symbol.for("react.memo_cache_sentinel")?(Q=n.jsx(js,{size:14,className:"text-muted-foreground"}),e[26]=Q):Q=e[26],e[27]!==K||e[28]!==q?(g=n.jsx(Es,{asChild:!0,children:n.jsxs(se,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[V,K,q,Q]})}),e[27]=K,e[28]=q,e[29]=g):g=e[29],v=Ts,N="p-0 w-80",D="start",_=Mm,e[30]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(Lm,{placeholder:"Search tools..."}),e[30]=w):w=e[30];const oe=W?`All ${O.length} tools enabled`:`${F.size} of ${O.length} enabled`;let L;e[31]!==oe?(L=n.jsx("span",{className:"text-xs text-muted-foreground",children:oe}),e[31]=oe,e[32]=L):L=e[32];let ee;e[33]!==r?(ee=()=>r(null),e[33]=r,e[34]=ee):ee=e[34];let te;e[35]!==W||e[36]!==ee?(te=n.jsx("button",{type:"button",onClick:ee,disabled:W,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:"Select all"}),e[35]=W,e[36]=ee,e[37]=te):te=e[37];let G;e[38]===Symbol.for("react.memo_cache_sentinel")?(G=n.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[38]=G):G=e[38];let z;e[39]!==r?(z=()=>r([]),e[39]=r,e[40]=z):z=e[40];const le=F.size===0;let ue;e[41]!==z||e[42]!==le?(ue=n.jsx("button",{type:"button",onClick:z,disabled:le,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:"Clear"}),e[41]=z,e[42]=le,e[43]=ue):ue=e[43];let me;e[44]!==te||e[45]!==ue?(me=n.jsxs("div",{className:"flex items-center gap-2",children:[te,G,ue]}),e[44]=te,e[45]=ue,e[46]=me):me=e[46],e[47]!==L||e[48]!==me?(k=n.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[L,me]}),e[47]=L,e[48]=me,e[49]=k):k=e[49],p=Om,b="max-h-80",S=f?n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"Loading tools…"}):n.jsxs(n.Fragment,{children:[n.jsx(Bm,{children:"No tools found"}),od.map(he=>{const ie=he.tools.map(kx),ve=ie.filter(re=>F.has(re)).length;return n.jsx($a,{heading:n.jsx(_l,{label:he.heading,icon:he.icon,on:ve,total:ie.length,onToggle:()=>Y(ie,ve!==ie.length)}),children:he.tools.map(re=>n.jsx(pl,{value:`${re.title} ${re.name}`,checked:F.has(re.name),onToggle:()=>U(re.name),title:re.title,description:re.description,leading:n.jsx(re.icon,{size:16,className:"text-muted-foreground"})},re.name))},he.key)}),M.map(he=>{const ie=he.tools.map(Cx),ve=ie.filter(re=>F.has(re)).length;return n.jsx($a,{heading:n.jsx(_l,{conn:he.conn,on:ve,total:ie.length,onToggle:()=>Y(ie,ve!==ie.length)}),children:he.tools.map(re=>n.jsx(pl,{value:`${re.display} ${re.name} ${he.conn?.title??""}`,checked:F.has(re.name),onToggle:()=>U(re.name),title:re.display,description:re.description},re.name))},he.clientId)})]}),e[6]=m,e[7]=u?.tools,e[8]=f,e[9]=r,e[10]=a,e[11]=i,e[12]=p,e[13]=_,e[14]=v,e[15]=x,e[16]=y,e[17]=g,e[18]=b,e[19]=S,e[20]=w,e[21]=k,e[22]=N,e[23]=D,e[24]=I}else p=e[12],_=e[13],v=e[14],x=e[15],y=e[16],g=e[17],b=e[18],S=e[19],w=e[20],k=e[21],N=e[22],D=e[23],I=e[24];let P;e[50]!==p||e[51]!==b||e[52]!==S?(P=n.jsx(p,{className:b,children:S}),e[50]=p,e[51]=b,e[52]=S,e[53]=P):P=e[53];let j;e[54]!==_||e[55]!==P||e[56]!==w||e[57]!==k?(j=n.jsxs(_,{children:[w,k,P]}),e[54]=_,e[55]=P,e[56]=w,e[57]=k,e[58]=j):j=e[58];let C;e[59]!==v||e[60]!==j||e[61]!==N||e[62]!==D?(C=n.jsx(v,{className:N,align:D,children:j}),e[59]=v,e[60]=j,e[61]=N,e[62]=D,e[63]=C):C=e[63];let A;return e[64]!==x||e[65]!==y||e[66]!==g||e[67]!==C||e[68]!==I?(A=n.jsxs(x,{open:I,onOpenChange:y,children:[g,C]}),e[64]=x,e[65]=y,e[66]=g,e[67]=C,e[68]=I,e[69]=A):A=e[69],A}function Cx(t){return t.name}function kx(t){return t.name}function jx(t){return t.name}function Nx(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function Ex(t){return[t.id,t]}function Ri(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function Tx(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return`Every ${i[1]} hours`;const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const l=parseInt(r[1]??"1");return l%7===0?`Every ${l/7} weeks`:`Every ${l} days`}const o=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(o){const l=(o[2]??"0").padStart(2,"0"),h=(o[1]??"0").padStart(2,"0");return`Every day at ${l}:${h} UTC`}const a=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(a){const h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(a[3]??"0")]??"day",c=(a[2]??"0").padStart(2,"0"),d=(a[1]??"0").padStart(2,"0");return`Every ${h} at ${c}:${d} UTC`}return t}function Rx(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function Px(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return{count:parseInt(i[1]),unit:"hours"};const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const o=parseInt(r[1]);return o%7===0?{count:o/7,unit:"weeks"}:{count:o,unit:"days"}}return null}function Dx(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Ax=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function Ix({automationId:t,open:e,onOpenChange:s,onCustomSelect:i,onEventSelect:r,onWebhookCreated:o}){const{triggerAdd:a}=Ui(),[l,h]=R.useState(!1),c=e??l,d=m=>{s?s(m):h(m)},u=async m=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:m}),ae.success("Starter added"),d(!1)}catch(p){const _=p instanceof Error?p.message:"Failed to add starter";ae.error(_)}},f=async()=>{try{const m=await a.mutateAsync({automation_id:t,type:"webhook"});d(!1),m.webhook?o?.(m.webhook):ae.success("Webhook starter added")}catch(m){const p=m instanceof Error?m.message:"Failed to add webhook starter";ae.error(p)}};return n.jsxs(Js,{open:c,onOpenChange:d,children:[n.jsx(Zs,{asChild:!0,children:n.jsxs(se,{variant:"outline",size:"sm",children:[n.jsx(At,{size:14}),"Add Starter"]})}),n.jsxs(Qs,{align:"end",className:"w-[200px]",children:[n.jsxs(sm,{children:[n.jsxs(im,{className:"gap-2.5",children:[n.jsx(Ci,{size:14,className:"text-muted-foreground shrink-0"}),"Every..."]}),n.jsx(rm,{className:"w-[160px]",children:Ax.map(m=>n.jsxs(et,{className:"gap-2.5",onSelect:()=>u(m.cron),disabled:a.isPending,children:[n.jsx(Ci,{size:14,className:"text-muted-foreground shrink-0"}),"Every ",m.label]},m.cron))})]}),n.jsxs(et,{className:"gap-2.5",onSelect:()=>{d(!1),i?.()},children:[n.jsx(Ci,{size:14,className:"text-muted-foreground shrink-0"}),"Custom (cron)"]}),n.jsxs(et,{className:"gap-2.5",onSelect:()=>{d(!1),r?.()},children:[n.jsx(Bi,{size:14,className:"text-muted-foreground shrink-0"}),"Event"]}),n.jsxs(et,{className:"gap-2.5",onSelect:()=>{f()},disabled:a.isPending,children:[n.jsx(Fi,{size:14,className:"text-muted-foreground shrink-0"}),"Webhook"]})]})]})}function ad(t){const e=H.c(31),{open:s,onOpenChange:i,url:r,token:o,title:a,description:l}=t,h=a===void 0?"Webhook ready":a,c=l===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":l,[d,u]=R.useState(null),[f,m]=R.useState("curl"),[p,_]=R.useState("header"),v=R.useId();let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=async(E,T)=>{try{await navigator.clipboard.writeText(E),u(T),ae.success("Copied"),setTimeout(()=>u(null),1500)}catch{ae.error("Failed to copy")}},e[0]=x):x=e[0];const y=x;let g;e[1]!==p||e[2]!==o||e[3]!==r?(g=r&&o&&p==="url"?`${r.replace(/\/$/,"")}/${o}`:r??"",e[1]=p,e[2]=o,e[3]=r,e[4]=g):g=e[4];const b=g,S=r&&o?p==="header"?`curl -X POST "${b}" \\
|
|
274
|
+
`}),e[26]=b):b=e[26];let S;return e[27]!==g||e[28]!==d?(S=n.jsxs("div",{className:"relative flex w-full flex-col items-center justify-center gap-12 select-none [clip-path:inset(-24px_0_-200px_0)]",children:[d,g,b]}),e[27]=g,e[28]=d,e[29]=S):S=e[29],S}function tr(t){const e=H.c(10),{phase:s,current:i,children:r}=t,o=s-i,a=o<0,l=o===0,h=a?90:o*-22,c=a?.94:1-Math.max(o,0)*.04,d=a?0:l?1:o===1?.8:.55,u=a?10:30-o,f=!l;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=ce("absolute inset-0 overflow-hidden rounded-xl border border-foreground/10 bg-background shadow-[0_20px_60px_-20px_rgb(0_0_0_/_0.35)] transition-all ease-[cubic-bezier(0.22,1,0.36,1)]"),e[0]=m):m=e[0];const p=`translateY(${h}px) scale(${c})`,_=l?"auto":"none";let v;e[1]!==d||e[2]!==p||e[3]!==_||e[4]!==u?(v={transform:p,opacity:d,zIndex:u,transitionDuration:"1000ms",pointerEvents:_},e[1]=d,e[2]=p,e[3]=_,e[4]=u,e[5]=v):v=e[5];let x;return e[6]!==r||e[7]!==f||e[8]!==v?(x=n.jsx("div",{"aria-hidden":f,className:m,style:v,children:r}),e[6]=r,e[7]=f,e[8]=v,e[9]=x):x=e[9],x}function en(t){const e=H.c(7),{showUrl:s}=t,i=s===void 0?!1:s;let r,o,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("div",{className:ce("size-2.5 rounded-full",St)}),o=n.jsx("div",{className:ce("size-2.5 rounded-full",St)}),a=n.jsx("div",{className:ce("size-2.5 rounded-full",St)}),e[0]=r,e[1]=o,e[2]=a):(r=e[0],o=e[1],a=e[2]);let l;e[3]!==i?(l=i&&n.jsx("div",{className:ce("ml-3 h-3.5 max-w-[220px] flex-1 rounded-sm",zt)}),e[3]=i,e[4]=l):l=e[4];let h;return e[5]!==l?(h=n.jsxs("div",{className:"flex h-7 shrink-0 items-center gap-1.5 px-3",children:[r,o,a,l]}),e[5]=l,e[6]=h):h=e[6],h}function Zv(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(en,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsx("div",{className:"flex flex-1 px-8 py-5",children:n.jsx("div",{className:"grid h-full w-full grid-cols-8 grid-rows-6 gap-2",children:Vv.map(Qv)})})]}),t[1]=s):s=t[1],s}function Qv(t,e){if(e===qh)return n.jsx("div",{className:"rounded-md bg-chart-1/[0.55]",style:{animation:"vm-breathe 2.4s ease-in-out infinite"}},e);const s=t;return n.jsx("div",{className:ce("relative rounded-md",St),children:n.jsx("div",{className:"absolute inset-0 rounded-md bg-chart-1/40 opacity-0",style:{animation:`vm-rack-scan ${Gh}s ease-in-out infinite`,animationDelay:`${s}s`}})},e)}function e1(){const t=H.c(5);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(en,{}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:ce("w-[18%] rounded-md",zt),style:{animation:"vm-breathe 3s ease-in-out infinite"}}),t[1]=s):s=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("div",{className:"h-[42%] shrink-0 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.4s infinite"}}),t[2]=i):i=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx("div",{className:"col-span-3 rounded-md bg-chart-3/[0.12]",style:{animation:"vm-breathe 3s ease-in-out 0.8s infinite"}}),t[3]=r):r=t[3];let o;return t[4]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsxs("div",{className:"flex min-h-0 flex-1 gap-1.5 p-3",children:[s,n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[i,n.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-1.5",children:[r,n.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-1.5",children:[n.jsx("div",{className:ce("rounded-md",zt),style:{animation:"vm-breathe 3s ease-in-out 1.2s infinite"}}),n.jsx("div",{className:ce("rounded-md",zt),style:{animation:"vm-breathe 3s ease-in-out 1.6s infinite"}})]})]})]})]})]}),t[4]=o):o=t[4],o}function t1(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(en,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsx("div",{className:"relative flex flex-1 items-center justify-center px-8 py-5",children:n.jsx("div",{className:"grid w-full gap-2",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:Yv.map(s1)})})]}),t[1]=s):s=t[1],s}function s1(t,e){return n.jsx("div",{className:ce("aspect-square rounded-md",Xv[e]?"bg-chart-2/70":St),style:{animation:`vm-pulse-soft 2.2s ease-in-out ${t}s infinite`}},e)}function i1(){const t=H.c(11);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(en,{showUrl:!0}),t[0]=e):e=t[0];let s,i,r,o,a;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"mb-2 h-5 rounded-md bg-chart-1/[0.10]"}),i=n.jsx("div",{className:ce("h-1.5 w-[70%] rounded-sm",St)}),r=n.jsx("div",{className:ce("h-1.5 w-[55%] rounded-sm",St)}),o=n.jsx("div",{className:ce("h-1.5 w-[80%] rounded-sm",St)}),a=n.jsx("div",{className:ce("h-1.5 w-[50%] rounded-sm",St)}),t[1]=s,t[2]=i,t[3]=r,t[4]=o,t[5]=a):(s=t[1],i=t[2],r=t[3],o=t[4],a=t[5]);let l;t[6]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsxs("div",{className:"flex w-[18%] shrink-0 flex-col gap-1.5 bg-chart-1/[0.05] p-2.5",children:[s,i,r,o,a,n.jsx("div",{className:"mt-auto",children:n.jsx("div",{className:ce("h-4 rounded-md",St)})})]}),t[6]=l):l=t[6];let h;t[7]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("div",{className:"relative h-[42%] shrink-0 overflow-hidden bg-chart-1/[0.10]",children:n.jsxs("div",{className:"absolute right-3 bottom-3 left-3 space-y-1.5",children:[n.jsx("div",{className:"h-3 w-[35%] rounded-sm bg-chart-1/[0.15]"}),n.jsx("div",{className:ce("h-1.5 w-[55%] rounded-sm",zt)})]})}),t[7]=h):h=t[7];let c;t[8]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsxs("div",{className:"flex shrink-0 gap-1.5",children:[n.jsx("div",{className:"h-4 w-12 rounded-full bg-chart-1/[0.12]"}),n.jsx("div",{className:ce("h-4 w-10 rounded-full",zt)}),n.jsx("div",{className:ce("h-4 w-14 rounded-full",zt)})]}),t[8]=c):c=t[8];let d;t[9]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsxs("div",{className:ce("col-span-3 flex flex-col justify-end gap-1 rounded-md p-2",zt),children:[n.jsx("div",{className:ce("h-1.5 w-[50%] rounded-sm",St)}),n.jsx("div",{className:ce("h-1 w-[75%] rounded-sm",St)})]}),t[9]=d):d=t[9];let u;return t[10]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsxs("div",{className:"flex h-full flex-col",children:[e,n.jsxs("div",{className:"flex min-h-0 flex-1",children:[l,n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[h,n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2.5 p-3",children:[c,n.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-5 gap-2",children:[d,n.jsxs("div",{className:"col-span-2 grid grid-rows-2 gap-2",children:[n.jsx("div",{className:ce("rounded-md",zt)}),n.jsx("div",{className:ce("rounded-md",zt)})]})]})]})]})]})]}),t[10]=u):u=t[10],u}function Br(t){const e=H.c(9);if(t.kind==="starting"){let l;return e[0]!==t.claimPhase||e[1]!==t.progress?(l=n.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:n.jsx(Jv,{progress:t.progress,claimPhase:t.claimPhase})}),e[0]=t.claimPhase,e[1]=t.progress,e[2]=l):l=e[2],l}let s;e[3]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx(pf,{className:"size-12 text-blue-500"}),e[3]=s):s=e[3];let i,r;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("h3",{className:"text-lg font-medium",children:Uv("suspended")}),r=n.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:"Resume to continue."}),e[4]=i,e[5]=r):(i=e[4],r=e[5]);let o;e[6]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(Fs,{className:"size-4"}),e[6]=o):o=e[6];let a;return e[7]!==t.onResume?(a=n.jsx("div",{className:"flex h-full w-full items-center justify-center bg-background p-6",children:n.jsxs("div",{className:"flex w-full max-w-md flex-col items-center gap-4 text-center",children:[s,i,r,n.jsxs(se,{onClick:t.onResume,className:"mt-2",children:[o," Resume"]})]})}),e[7]=t.onResume,e[8]=a):a=e[8],a}const r1=R.lazy(()=>Kt(()=>import("./sections-editor-CkUdgmBv.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.SectionsEditor}))),n1=R.lazy(()=>Kt(()=>import("./page-seo-sheet-Cni7GVIz.js"),__vite__mapDeps([154,1,2,122,44,46,47,48,16,3,5,86,72,80,77,6,7,8,9,10,11,12,13,14,15,17,4,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,45,78,50,79,73,51,81,49,82,83,84,58,85,60,61,90,91,92,93,94,95,96,97,98,99,100,101,102,57,103,59,104,105,106,107,108,66,109,56,110,71,111,70,67,112,113,114,115,116,117,65,87,88,52,53,54,55,62,63,64,68,69,74,75,76,118,119,120,121,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.SeoSheet}))),o1=R.lazy(()=>Kt(()=>import("./file-explorer-C6G0_-8u.js"),__vite__mapDeps([155,1,2,137,6,7,8,9,10,11,12,13,14,15,16,3,17,4,5,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,127,98,99,58,100,101,85,102,57,103,59,104,105,49,106,107,108,50,120,121,122,123,82,79,70,124,109,125,56,67,115,126,62,63,64,71,72,111,128,52,53,54,55,60,61,65,66,68,69,73,74,75,76,87,88,129,130,131,92,93,136,51,95,90,91,94,96,97,110,83,112,113,114,116,117,118,119,132,133,134,135,138,139,80,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.FileExplorer}))),mn=500,a1={mobile:375,tablet:768,desktop:null},pn=["desktop","mobile","tablet"],l1={mobile:"Mobile (375px)",tablet:"Tablet (768px)",desktop:"Desktop"};function c1(t,e){const s=new URL(t,window.location.href);return s.searchParams.set("deviceHint",e),s.href}function h1(){const t=Zi(),{currentBranch:e}=es(),[s,i]=R.useState("preview"),[r,o]=R.useState("desktop"),[a,l]=R.useState(null),h=R.useRef(null),c=s==="cms",[d,u]=R.useState(null),[f,m]=R.useState(384),p=R.useRef(!1),_=R.useRef(0),v=R.useRef(0),x=R.useRef(null),[y,g]=R.useState(!1),[b,S]=R.useState(""),w=R.useRef(null),[k,N]=R.useState(!1),[D,I]=R.useState(),[P,j]=R.useState(null),[C,A]=R.useState(null),[E,T]=R.useState("/"),[M,B]=R.useState(!1),[O,F]=R.useState(!1),[W,$]=R.useState(null),U=t?.entity?.id??null,{org:Y}=Ne(),V=qt(),K=Hh(),q=K.vmEntry,Q=K.previewUrl,oe=V.lifecycle.phase,L=oe==="running",ee=U&&e&&L?{orgSlug:Y.slug,virtualMcpId:U,branch:e}:null,{data:te}=Jo(ee,{fetchEnabled:L}),{data:G}=Zo(ee,{fetchEnabled:L}),z=U&&e?{orgSlug:Y.slug,virtualMcpId:U,branch:e}:null,le=Iv(z),ue=te?ia(te).sort((Z,ge)=>Z.name.localeCompare(ge.name)):[],me=te&&G?ra(te,G):[],he=Ni,ie=ue.filter(Z=>{if(!b)return!0;const ge=b.toLowerCase();return Z.name.toLowerCase().includes(ge)||Z.path.toLowerCase().includes(ge)}),ve=me.filter(Z=>{if(!b)return!0;const ge=b.toLowerCase();return Z.name.toLowerCase().includes(ge)||Z.key.toLowerCase().includes(ge)||Z.resolveType.toLowerCase().includes(ge)}),re=P?null:ue.find(Z=>he(Z.path)===he(E))??null,ke=P?P.name:re?.name,it=re?.key??null,De=R.useRef(null),ft=R.useRef(null);y_(()=>{const Z=h.current,ge=De.current;!Z||!ge||(Z.src=ge)});const ai=V.status.state==="paused",J=V.phase,xe=Vh({claimPhase:J,lifecycle:V.lifecycle}),fe=K.previewState,Se=K.userStopped,Ce=fe.kind==="iframe"?c1(C??new URL(E,fe.previewUrl).href,r):null,[Ye,an]=R.useState(null);if(fe.kind==="iframe"&&Ye!==fe.previewUrl){const Z=Ye!==null;an(fe.previewUrl),Z&&(ft.current=null,T("/"),A(null),j(null))}De.current=Ce;const Qi=!!U&&!!e&&!V.notFound&&!Se&&!ai&&(J?.kind==="ready"||oe!=="idle"),As=fe.kind!=="iframe"&&(s==="visual"||s==="cms")?"preview":s;R.useEffect(()=>{if(!Q)return;let Z;try{Z=new URL(Q,window.location.href).origin}catch{return}const ge=nt=>{if(nt.origin===Z){if(nt.data?.type==="visual-editor::element-clicked"){const ot=Mv.safeParse(nt.data.payload);ot.success&&l(ot.data)}else if(nt.data?.type==="cms-editor::section-clicked"){const ot=Ov.safeParse(nt.data.payload);ot.success&&u(ot.data.sectionIndex)}}};return window.addEventListener("message",ge),()=>window.removeEventListener("message",ge)},[Q]),R.useEffect(()=>{if(!y)return;const Z=ge=>{w.current?.contains(ge.target)||(g(!1),S(""))};return document.addEventListener("pointerdown",Z),()=>document.removeEventListener("pointerdown",Z)},[y]),R.useEffect(()=>{if(!c)return;const Z=nt=>{const ot=nt.target;ot&&ot!==h.current&&(x.current=ot)},ge=()=>{requestAnimationFrame(()=>{const nt=document.activeElement;(nt===document.body||nt===h.current)&&x.current&&x.current.focus()})};return document.addEventListener("focusin",Z),document.addEventListener("blur",ge,!0),()=>{document.removeEventListener("focusin",Z),document.removeEventListener("blur",ge,!0)}},[c]);const _e=()=>{const Z=h.current?.contentWindow;Z&&Z.postMessage({type:"visual-editor::activate",script:Lv},"*")},Ee=()=>{const Z=h.current?.contentWindow;Z&&Z.postMessage({type:"visual-editor::deactivate"},"*")},rt=()=>{const Z=h.current?.contentWindow;Z&&Z.postMessage({type:"visual-editor::activate",script:$v},"*")},xt=()=>{const Z=h.current?.contentWindow;Z&&Z.postMessage({type:"cms-editor::deactivate"},"*")},He=Z=>{const ge=s;i(Z),l(null),Z!=="code"&&$(null),Z!=="cms"&&u(null),ge==="visual"&&Ee(),ge==="cms"&&xt(),Z==="visual"&&_e(),Z==="cms"&&rt()},ou=()=>{if(!h.current||!Ce)return;const Z=h.current;Z.src=Ce},au=()=>{if(!h.current||!Ce)return;const Z=Ce.includes("?")?"&":"?";h.current.src=`${Ce}${Z}_r=${Date.now()}`},lu=()=>{const Z=pn.indexOf(r);o(pn[(Z+1)%pn.length])},cu=()=>{const Z=h.current?.contentWindow?.location?.href??Ce??Q;Z&&navigator.clipboard.writeText(Z)},hu=(()=>{if(!Q)return"No server running";if(P)return P.name;try{const Z=new URL(Q),ge=E==="/"?"":E;return`${Z.host}${ge}`}catch{return Q}})(),Na=Z=>{ft.current=Z,j(null),A(null),T(Z),u(null),B(!1)},du=Z=>{if(!Q||!G){ae.error("Preview metadata not ready yet");return}ft.current=null;const ge=yh(G),nt=Rv(Q,ge,Z.key);j(Z),A(nt),u(null)},uu=async({name:Z,path:ge})=>{if(!U||!e)return;const nt=la(ge);if(nt){I(nt);return}const ot=ge.trim().startsWith("/")?ge.trim():`/${ge.trim()}`;if(ue.some(Gt=>he(Gt.path)===he(ot))){I(`A page with path "${ot}" already exists.`);return}I(void 0);try{const Gt=await le.mutateAsync({name:Z,path:ot});N(!1),ae.success(`Page "${Z}" created`),await new Promise(mu=>setTimeout(mu,mn)),Na(Gt.path),He("cms")}catch(Gt){I(Gt instanceof Error?Gt.message:"Failed to create page")}},fu=[{value:"preview",icon:n.jsx(Aa,{size:14}),tooltip:"Interactive"},...fe.kind==="iframe"?[{value:"visual",icon:n.jsx(Ia,{size:14}),tooltip:"Visual editor"}]:[],...fe.kind==="iframe"&&sa(te,G)?[{value:"cms",icon:n.jsx(_f,{size:14}),tooltip:"Sections editor"}]:[],{value:"code",icon:n.jsx(gf,{size:14}),tooltip:"Code editor"}];return n.jsxs("div",{className:"flex flex-col w-full h-full",children:[Qi&&n.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-4 border-b border-border/60 px-3 md:px-4",children:[n.jsx("div",{className:"flex shrink-0 items-center gap-1",children:n.jsx(Pm,{value:As,onValueChange:He,options:fu,size:"sm",className:"shrink-0 bg-foreground/4.5"})}),fe.kind==="iframe"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:ce("flex min-w-0 flex-1 items-center gap-0.5 ml-2",s==="code"&&"hidden"),children:[n.jsxs(Pe,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",onClick:ou,children:n.jsx(Di,{size:14})})}),n.jsx(Re,{side:"bottom",children:"Refresh"})]}),n.jsxs(Pe,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",onClick:lu,children:n.jsxs("span",{className:"flex items-center justify-center animate-device-icon-pop",children:[r==="mobile"&&n.jsx(vf,{size:14}),r==="tablet"&&n.jsx(xf,{size:14}),r==="desktop"&&n.jsx(Aa,{size:14})]},r)})}),n.jsx(Re,{side:"bottom",children:l1[r]})]}),n.jsxs("div",{ref:w,className:"relative min-w-0 flex-1",children:[n.jsxs("button",{type:"button",className:"flex h-8 w-full min-w-0 items-center gap-1 rounded-md bg-background px-2 transition-colors duration-200 hover:bg-accent",onClick:()=>g(Z=>!Z),children:[P&&n.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[n.jsx(Hs,{size:11}),"Global"]}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-left text-[12px] text-foreground/88",children:hu}),ke&&!P&&n.jsx("span",{className:"shrink-0 text-[12px] text-muted-foreground",children:ke}),n.jsx(js,{size:12,className:ce("shrink-0 text-muted-foreground transition-transform",y&&"rotate-180")})]}),y&&n.jsxs("div",{className:"absolute left-0 right-0 top-full z-50 mt-1.5 overflow-hidden rounded-lg border bg-popover shadow-lg",children:[n.jsxs("div",{className:"px-2 h-10 flex items-center gap-2 border-b",children:[n.jsx(Zc,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),n.jsx("input",{type:"text",value:b,onChange:Z=>S(Z.target.value),placeholder:"Search pages and components...",className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),n.jsx("div",{className:"p-1.5 border-b",children:n.jsxs("button",{type:"button",className:"flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:Z=>{Z.preventDefault(),g(!1),S(""),I(void 0),N(!0)},children:[n.jsx(At,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"flex-1 font-medium",children:"Create new page"})]})}),ie.length===0&&ve.length===0?n.jsx("div",{className:"px-4 py-5 text-center text-xs text-muted-foreground",children:ue.length===0&&me.length===0?"No pages found in this site.":"No results match your search."}):n.jsxs("div",{className:"max-h-80 overflow-y-auto overscroll-contain",children:[ie.length>0&&n.jsx("div",{className:"p-1.5",children:ie.map(Z=>n.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:ge=>{ge.preventDefault(),g(!1),S(""),Na(Z.path)},children:[n.jsx(Ao,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:Z.name}),n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Z.path})]},Z.key))}),ve.length>0&&n.jsxs("div",{className:ce("p-1.5",ie.length>0&&"border-t"),children:[n.jsx("div",{className:"px-3 py-2 text-xs font-medium text-muted-foreground",children:"Global components"}),ve.map(Z=>n.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",onMouseDown:ge=>{ge.preventDefault(),g(!1),S(""),du(Z)},children:[n.jsx(Hs,{size:16,className:"shrink-0 text-muted-foreground"}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:Z.name}),n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Z.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")})]},Z.key))]})]})]})]})]}),n.jsxs("div",{className:ce("flex shrink-0 items-center gap-0.5",s==="code"&&"hidden"),children:[n.jsxs(Pe,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",onClick:()=>{const Z=Ce??fe.previewUrl;Z&&window.open(Z,"_blank","noopener")},children:n.jsx(ti,{size:14})})}),n.jsx(Re,{side:"bottom",children:"Open in new tab"})]}),n.jsxs(Js,{children:[n.jsx(Zs,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",children:n.jsx(Yr,{size:14})})}),n.jsxs(Qs,{align:"end",className:"w-44",children:[n.jsx(et,{onClick:au,children:"Hard Reload"}),n.jsx(et,{onClick:cu,children:"Copy Current URL"}),te&&G&&n.jsxs(n.Fragment,{children:[n.jsx(ur,{}),it&&n.jsxs(et,{onClick:()=>{B(!0),He("cms")},children:[n.jsx(Sr,{size:14}),"Edit SEO"]}),it&&n.jsxs(et,{onClick:()=>{try{$(al(it)),He("code")}catch{ae.error("Invalid page block key")}},children:[n.jsx(Io,{size:14}),"View JSON"]}),n.jsxs(et,{onClick:()=>F(!0),children:[n.jsx(Sr,{size:14}),"Site SEO"]})]})]})]})]})]})]}),n.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[c&&Q&&e&&U&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"shrink-0 border-r overflow-hidden",style:{width:f},children:n.jsx(R.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(we,{size:20,className:"animate-spin text-muted-foreground"})}),children:n.jsx(r1,{orgSlug:Y.slug,virtualMcpId:U,branch:e,previewReady:L,previewUrl:Q,currentPath:E,activeGlobalBlockKey:P?.key??null,externalSelectedIndex:P?null:d,onSaved:()=>{setTimeout(()=>{const Z=h.current;if(!Z)return;const ge=document.activeElement,nt=Z.tabIndex;Z.tabIndex=-1,Z.style.pointerEvents="none",Z.blur();try{Z.contentWindow?.location.reload()}catch{const Gt=De.current;Gt&&(Z.src=Gt)}const ot=()=>{Z.tabIndex=nt,Z.style.pointerEvents="",ge?.focus(),Z.removeEventListener("load",ot)};Z.addEventListener("load",ot),setTimeout(ot,3e3)},mn)},initialEditSeo:M,onExitSeo:()=>B(!1),onViewJsonFile:Z=>{try{$(al(Z)),He("code")}catch{ae.error("Invalid page block key")}}})})}),n.jsx("div",{className:"w-1 shrink-0 cursor-col-resize bg-transparent hover:bg-border transition-colors",onPointerDown:Z=>{p.current=!0,_.current=Z.clientX,v.current=f,Z.currentTarget.setPointerCapture(Z.pointerId)},onPointerMove:Z=>{if(!p.current)return;const ge=Z.clientX-_.current;m(Math.max(240,Math.min(640,v.current+ge)))},onPointerUp:()=>{p.current=!1}})]}),n.jsxs("div",{className:ce("flex-1 relative overflow-hidden",r!=="desktop"&&fe.kind==="iframe"&&s!=="code"&&"flex justify-center bg-muted/30"),children:[fe.kind==="starting"&&n.jsx("div",{className:"absolute inset-0 z-30",children:n.jsx(Br,{kind:"starting",progress:xe,claimPhase:J})}),fe.kind==="suspended"&&n.jsx("div",{className:"absolute inset-0 z-30",children:n.jsx(Br,{kind:"suspended",onResume:K.resume})}),As==="visual"&&!a&&n.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-20 flex items-center gap-1.5 rounded-full border border-violet-400/40 bg-violet-500/90 px-3 py-1 text-xs font-medium text-white shadow-md backdrop-blur-sm pointer-events-none select-none",children:[n.jsx(Ia,{size:12}),"Click any element to ask the AI"]}),As==="visual"&&a&&n.jsx(Hv,{element:a,onDismiss:()=>l(null)}),s==="code"&&Qi&&U&&e&&n.jsx("div",{className:"absolute inset-0 z-10 bg-background",children:n.jsx(R.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(we,{size:20,className:"animate-spin text-muted-foreground"})}),children:n.jsx(o1,{orgSlug:Y.slug,virtualMcpId:U,branch:e,openPath:W})})}),fe.kind==="iframe"&&Ce&&n.jsx("div",{className:ce("h-full transition-[width] duration-250 [transition-timing-function:var(--ease-in-out-cubic)]",r!=="desktop"&&s!=="code"&&"w-full max-w-full border-x border-border bg-background shadow-sm"),style:{width:r==="desktop"||s==="code"?"100%":`${a1[r]}px`},children:n.jsx("iframe",{ref:h,src:Ce,className:ce("w-full h-full border-0",s==="code"&&"invisible"),title:"Dev Server Preview",tabIndex:c?-1:void 0,onLoad:()=>{if(Le("vm_preview_loaded",{view_mode:s,vm_id:q?.sandboxHandle??null}),!P)try{const Z=h.current?.contentWindow?.location?.pathname;if(!Z)return;const ge=ft.current;if(ge!==null){ft.current=null,he(Z)===he(ge)&&T(Z);return}T(Z)}catch{}s==="visual"&&_e(),s==="cms"&&rt()}},fe.previewUrl)})]})]}),n.jsx(Bv,{open:k,onOpenChange:N,isPending:le.isPending,error:D,onSubmit:uu}),O&&te&&G&&n.jsx(R.Suspense,{fallback:null,children:n.jsx(n1,{open:O,onOpenChange:F,orgSlug:Y.slug,virtualMcpId:U??"",branch:e??"",decofile:te,meta:G,onSaved:()=>{setTimeout(()=>{const Z=h.current;if(Z)try{Z.contentWindow?.location.reload()}catch{const ge=De.current;ge&&(Z.src=ge)}},mn)},target:{kind:"site"}})})]})}function d1(t){const e=H.c(2),{virtualMcpId:s}=t,i=It(s);if(!Ys(i?.metadata)){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[n.jsx(zi,{size:24,className:"text-muted-foreground/60"}),n.jsx("div",{children:"No source to preview."}),n.jsx("div",{className:"text-xs text-muted-foreground/80",children:"Connect a GitHub repository from the Connections tab to enable Preview."})]}),e[0]=a):a=e[0],a}let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(h1,{}),e[1]=o):o=e[1],o}function u1({orgSlug:t,virtualMcpId:e,branch:s}){const i=qs();return Gs({mutationFn:async({blockKey:r})=>{const o=ca(r),a=await fetch(`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:o})});if(!a.ok){const l=await a.json().catch(()=>({}));throw new Error(l.error??`Delete failed (${a.status})`)}return a.json()},onMutate:async({blockKey:r})=>{const o=`${t}/${e}/${s}`,a=Dt.decofile(o);await i.cancelQueries({queryKey:a});const l=i.getQueryData(a);return i.setQueryData(a,h=>{if(!h)return h;const{[r]:c,...d}=h;return d}),{previous:l,queryKey:a}},onError:(r,o,a)=>{a?.queryKey&&i.setQueryData(a.queryKey,a.previous)},onSuccess:()=>{const r=`${t}/${e}/${s}`;i.invalidateQueries({queryKey:Dt.liveMeta(r)})}})}function tn(t,e){return`${t}-${e}`}function ua(t,e){return`site/apps/${t}/${e}.ts`}function fa(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function Yh(t,e,s){const i=new Set([tn(t,e),e].map(o=>o.toLowerCase())),r=ua(t,e);for(const[o,a]of Object.entries(s)){if(o.includes("/")||!a||typeof a!="object"||Array.isArray(a))continue;const l=a;if(i.has(o.toLowerCase())||l.__resolveType===r)return o}return null}function f1(t,e){const s=t.vendor.alias,i=t.name,r=Yh(s,i,e);return{id:tn(s,i),app:i,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:ua(s,i),blockKey:r,installed:r!==null}}function m1(t,e,s){if(t===ji)return null;const i=fa(t);if(!i)return null;const{vendor:r,app:o}=i,a=Yh(r,o,s),l=Vi(t,e);return{id:tn(r,o),app:o,vendor:r,title:l.title??o,description:l.description??"",category:"Others",logo:l.logo??l.icon,resolveType:t,blockKey:a,installed:a!==null}}function p1(t,e,s){const i=new Map;for(const o of t){const a=f1(o,s);i.set(a.id,a)}const r=e.manifest?.blocks?.apps??{};for(const o of Object.keys(r)){const a=m1(o,e,s);!a||i.has(a.id)||i.set(a.id,a)}for(const o of v1(s,e)){const a=fa(o.resolveType);if(!a)continue;const l=tn(a.vendor,a.app);i.has(l)||i.set(l,{id:l,app:a.app,vendor:a.vendor,title:o.name,description:"",category:"Installed",resolveType:o.resolveType,blockKey:o.key,installed:!0})}return[...i.values()].sort(_1)}function _1(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}function g1(t,e,s){const i=t.manifest?.blocks?.apps??{};for(const r of[ua(e,s),`site/apps/${e}/${s}.tsx`,`${e}/apps/${s}.ts`,`${e}/apps/${s}.tsx`])if(r in i)return!0;return!1}function v1(t,e){const s=[];for(const[i,r]of Object.entries(t)){if(i.includes("/")||!r||typeof r!="object"||Array.isArray(r))continue;const o=r,a=o.__resolveType;if(typeof a!="string"||Ch(i,o))continue;const l=fa(a)??(()=>{const h=i.match(/^([^-]+)-(.+)$/);return h?{vendor:h[1],app:h[2]}:null})();!l||!g1(e,l.vendor,l.app)||s.push({key:i,name:i.replace(/[-_]/g," ").replace(/\b\w/g,h=>h.toUpperCase()),resolveType:a})}return s}async function x1(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function b1(t,e,s){const i=H.c(12),r=s?.enabled??!0;let o;i[0]===Symbol.for("react.memo_cache_sentinel")?(o=Dt.decoApps(),i[0]=o):o=i[0];let a;i[1]!==r?(a={queryKey:o,queryFn:x1,staleTime:3e5,retry:1,enabled:r},i[1]=r,i[2]=a):a=i[2];const l=Vs(a);let h;i[3]!==e||i[4]!==t||i[5]!==l.data?(h=t&&e?p1(l.data??[],t,e):[],i[3]=e,i[4]=t,i[5]=l.data,i[6]=h):h=i[6];const c=h,d=l.isLoading&&!l.isError;let u;return i[7]!==c||i[8]!==l.isError||i[9]!==l.refetch||i[10]!==d?(u={catalog:c,isLoading:d,isError:l.isError,refetch:l.refetch},i[7]=c,i[8]=l.isError,i[9]=l.refetch,i[10]=d,i[11]=u):u=i[11],u}const y1=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]);function S1(t){return t.includes("matchers")||t.includes("Match")}function w1(t,e){const s=t.__resolveType;return typeof s!="string"||!s||y1.has(s)?!1:e?Qp(e,s):S1(s)}function qi(t,e,s){if(!t)return!1;const i=t.__resolveType;if(typeof i!="string"||!ea(i)||!Object.hasOwn(e,i))return!1;const r=e[i];return!r||typeof r!="object"||Array.isArray(r)?!1:w1(r,s)}function dC(t,e,s){return qi(t,e,s)?t?.__resolveType??null:null}function Xh(t,e,s){if(!t)return null;const i=t.__resolveType??"";if(!i)return null;if(qi(t,e,s)){const a=e[i]??{},l=a.__resolveType??i,{__resolveType:h,name:c,...d}=a;return{resolveType:l,data:d,blockKey:i}}const{__resolveType:r,...o}=t;return{resolveType:i,data:o}}function C1(t,e,s){const i=Xh(t,e,s);return i?{__resolveType:i.resolveType,...i.data}:{__resolveType:""}}function uC(t,e,s){if(t)return qi(t,e,s)?C1(t,e,s):t}function k1(t,e,s,i){if(!t)return"Default";if(qi(t,e,i)){const r=t.__resolveType??"",o=e[r];return kh(r,o)}return s(t)}function fC(t,e,s){return{__resolveType:t,...e,name:s}}function mC(t){return{__resolveType:t}}function pC(t,e,s){const i=Xh(t,e,s);return i?{resolveType:i.resolveType,formValue:i.data}:{resolveType:"",formValue:{}}}function Jh(t){const e=t.__resolveType??"";return Zt(e)?t.section??t:t}function Mr(t){const r=(Zt(t.__resolveType??"")?t.section:t)?.variants?.[0];return r?.rule?.__resolveType!==gh?null:r?.value??null}function _C(t){const e=Jh(t);return{__resolveType:n_,variants:[{value:e,rule:{__resolveType:gh}}]}}function gC(t){const e=t.__resolveType??"";if(!e)return null;if(Zt(e))return t.section??null;const s=Mr(t);return s?Zt(s.__resolveType??"")?s:{__resolveType:qa,section:Jh(s)}:{__resolveType:qa,section:t}}function sr(t){const e=t.__resolveType??"";if(!e)return null;if(Zt(e)){const s=t.section,i=s?.__resolveType??"";return!i||!s?null:{resolveType:i,data:s}}return{resolveType:e,data:t}}function vC(t){const e=Mr(t);if(e)return sr(e);if(Zt(t.__resolveType??"")){const i=t.section;if(!i)return null;const r=Mr(i);return sr(r||i)}return sr(t)}function xC(t){return Mr(t)}const j1=["website/matchers/always.ts","$live/matchers/MatchAlways.ts"];function Zh(t){if(!t)return!1;const e=t.__resolveType??"";return e===""?Object.keys(t).length===0:j1.includes(e)||e.includes("always")}function N1(t){const e=t.variants??[];if(e.length===0)return-1;const s=e.findIndex(i=>Zh(i.rule));return s!==-1?s:e.length-1}function bC(t,e,s){const i=s.variants??[];if(i.length===0)return null;const r=N1(s),o=i[r]?.value;if(!o)return null;const a=structuredClone(o);return e.isLazy?{...t,section:a}:a}function yC(t,e){return e.isMultivariate?e.isLazy?t.section??null:t:null}function SC(t,e){return Array.isArray(t.variants)?t.variants.map((s,i)=>({label:e(s.rule)||`Variant ${i+1}`,value:s.value??{},rule:s.rule})):[]}function wC(t,e){const s=t.__resolveType??"";if(!s)return null;if(Zt(s)){const i=t.section??t,r=i.__resolveType??s;if(!r.includes("/")&&r in e){const o=e[r]??{};return{data:{...o},resolveType:o.__resolveType??r}}return{data:{...i},resolveType:r}}if(!s.includes("/")&&s in e){const i=e[s]??{};return{data:{...i},resolveType:i.__resolveType??s}}return{data:{...t},resolveType:s}}function E1(t,e){const s=t.__resolveType??"";return Zt(s)?{...t,section:e}:e}function CC(t,e,s){return e.isLazy?{...t,section:s}:s}function kC(t,e,s){const i=[...t.variants??[]],r=i[e];if(!r)return t;const o=r.value??{};return i[e]={...r,value:E1(o,s)},{...t,variants:i}}function jC(t,e,s){const i=[...t.variants??[]];return i[e]?(i[e]={...i[e],rule:s},{...t,variants:i}):t}function NC(t,e){const s=[...t.variants??[]],i=s[e];return i?(s.splice(e+1,0,structuredClone(i)),{...t,variants:s}):t}function EC(t,e){const s=[...t.variants??[]];return s.length<=1?null:(s.splice(e,1),{...t,variants:s})}const T1=new Set(["website/pages/Page.tsx","$live/pages/LivePage.tsx"]);function R1(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t;return typeof e.__resolveType=="string"&&T1.has(e.__resolveType)&&typeof e.path=="string"}function Qh(t,e){const i=t[e]?.sections;if(!i||Array.isArray(i))return 1;const r=i;return Array.isArray(r.variants)?r.variants.length:1}function P1(t,e,s){const r=t[e]?.sections;if(Array.isArray(r))return s===0?r:[];if(r&&typeof r=="object"){const o=r.variants;if(Array.isArray(o)){const a=o[s];return Array.isArray(a?.value)?a.value:[]}}return[]}function TC(t,e,s){if(Array.isArray(t))return[{label:"Default",sections:t}];if(t&&typeof t=="object"){const i=t;if(Array.isArray(i.variants)){const r=i.variants,o=r.map(h=>k1(h.rule,e,s)),a=o.reduce((h,c)=>(h[c]=(h[c]??0)+1,h),{}),l={};return r.map((h,c)=>{const d=o[c]??`Variant ${c+1}`,u=a[d]??1;let f=d;return u>1&&(l[d]=(l[d]??0)+1,f=`${d} ${l[d]}`),{label:f||`Variant ${c+1}`,sections:Array.isArray(h.value)?h.value:[],rule:h.rule}})}}return[]}function D1(){return{__resolveType:i_}}function ci(t){return{rule:D1(),value:t}}function zs(t,e){return{...e,__resolveType:r_,variants:t}}function A1(t,e){const s=structuredClone(e);if(Array.isArray(t))return zs([ci(t),ci(s)]);if(t&&typeof t=="object"){const i=t;return Array.isArray(i.variants)?zs([...i.variants,ci(s)],i):null}return zs([ci([]),ci(s)])}function RC(t){const e=t.variants;return Array.isArray(e)?e.length-1:1}function PC(t,e){if(e.length===0)return zs([],t);if(e.length===1){const s=e[0],i=s?.rule;if(!Zh(i))return zs(e,t);if(Array.isArray(s?.value))return s.value}return zs(e,t)}function I1(t,e){for(const[s,i]of Object.entries(t)){if(!R1(i))continue;const r=i.sections;if(Array.isArray(r)){e(void 0,s,0);continue}if(!r||typeof r!="object")continue;const o=r.variants;if(Array.isArray(o))for(let a=0;a<o.length;a++){const l=o[a];e(l?.rule,s,a)}}}function DC(t,e,s){let i=0;return I1(t,r=>{if(!r)return;(r.__resolveType??"")===e&&qi(r,t,s)&&i++}),i}function hl(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),i=`${s} (copy)`;if(!t.has(i))return i;for(let r=2;r<1e3;r++){const o=`${s} (copy ${r})`;if(!t.has(o))return o}return`${s} (copy ${Date.now()})`}function B1(t,e){const s=Ni,i=e.replace(/-copy(?:-\d+)?$/,""),r=`${i}-copy`;if(!t.has(s(r)))return r;for(let o=2;o<1e3;o++){const a=`${i}-copy-${o}`;if(!t.has(s(a)))return a}return`${i}-copy-${Date.now()}`}function dl(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),i=`${s}_copy`;if(!Object.hasOwn(t,i))return i;for(let r=2;r<1e3;r++){const o=`${s}_copy_${r}`;if(!Object.hasOwn(t,o))return o}return`${s}_copy_${Date.now()}`}function M1(t){const e=ha(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function L1(t,e){return Uh(t,e)}const O1=1e3;function $1(t,e){for(let s=0;s<O1;s++){const i=ha(e);if(!Object.hasOwn(t,i))return i}throw new Error("Could not generate a unique page block key")}const z1={create:"Create new page",duplicate:"Duplicate page",rename:"Rename page"},F1={create:"Create",duplicate:"Duplicate",rename:"Save"},H1={create:"Creating…",duplicate:"Duplicating…",rename:"Saving…"};function W1(t){const e=H.c(54),{open:s,mode:i,initialName:r,initialPath:o,isPending:a,error:l,validate:h,onSubmit:c,onOpenChange:d}=t,u=a===void 0?!1:a,[f,m]=R.useState(r),[p,_]=R.useState(o),[v,x]=R.useState(null),[y,g]=R.useState(s);s!==y&&(g(s),s&&(m(r),_(o),x(null)));let b;e[0]!==u||e[1]!==d?(b=q=>{!q&&!u&&(x(null),d(!1))},e[0]=u,e[1]=d,e[2]=b):b=e[2];const S=b;let w;e[3]!==u||e[4]!==f||e[5]!==c||e[6]!==p||e[7]!==h?(w=async q=>{q.preventDefault();const Q=f.trim(),oe=p.trim();if(!Q||!oe||u)return;const L=la(oe);if(L){x(L);return}const ee=h?.({name:Q,path:oe});if(ee){x(ee);return}x(null),await c({name:Q,path:oe})},e[3]=u,e[4]=f,e[5]=c,e[6]=p,e[7]=h,e[8]=w):w=e[8];const k=w,N=v??l,D=z1[i];let I;e[9]!==D?(I=n.jsx(ts,{children:n.jsx(ss,{children:D})}),e[9]=D,e[10]=I):I=e[10];let P;e[11]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[11]=P):P=e[11];let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j=q=>m(q.target.value),e[12]=j):j=e[12];let C;e[13]!==u||e[14]!==f?(C=n.jsxs("div",{className:"space-y-1.5",children:[P,n.jsx(qe,{id:"page-form-name",value:f,onChange:j,placeholder:"My page",autoFocus:!0,disabled:u})]}),e[13]=u,e[14]=f,e[15]=C):C=e[15];let A;e[16]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:"Path"}),e[16]=A):A=e[16];let E;e[17]===Symbol.for("react.memo_cache_sentinel")?(E=q=>_(q.target.value),e[17]=E):E=e[17];let T;e[18]!==u||e[19]!==p?(T=n.jsxs("div",{className:"space-y-1.5",children:[A,n.jsx(qe,{id:"page-form-path",value:p,onChange:E,placeholder:"/example",disabled:u})]}),e[18]=u,e[19]=p,e[20]=T):T=e[20];let M;e[21]!==N?(M=N&&n.jsx("p",{className:"text-xs text-destructive",children:N}),e[21]=N,e[22]=M):M=e[22];let B;e[23]!==T||e[24]!==M||e[25]!==C?(B=n.jsxs("div",{className:"space-y-4 py-4",children:[C,T,M]}),e[23]=T,e[24]=M,e[25]=C,e[26]=B):B=e[26];let O;e[27]!==d?(O=()=>d(!1),e[27]=d,e[28]=O):O=e[28];let F;e[29]!==u||e[30]!==O?(F=n.jsx(se,{type:"button",variant:"outline",onClick:O,disabled:u,children:"Cancel"}),e[29]=u,e[30]=O,e[31]=F):F=e[31];let W;e[32]!==u||e[33]!==f||e[34]!==p?(W=!f.trim()||!p.trim()||u,e[32]=u,e[33]=f,e[34]=p,e[35]=W):W=e[35];let $;e[36]!==u||e[37]!==i?($=u?n.jsxs(n.Fragment,{children:[n.jsx(we,{size:14,className:"animate-spin"}),H1[i]]}):F1[i],e[36]=u,e[37]=i,e[38]=$):$=e[38];let U;e[39]!==W||e[40]!==$?(U=n.jsx(se,{type:"submit",disabled:W,children:$}),e[39]=W,e[40]=$,e[41]=U):U=e[41];let Y;e[42]!==F||e[43]!==U?(Y=n.jsxs(ei,{children:[F,U]}),e[42]=F,e[43]=U,e[44]=Y):Y=e[44];let V;e[45]!==k||e[46]!==B||e[47]!==Y||e[48]!==I?(V=n.jsx(Mt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:k,children:[I,B,Y]})}),e[45]=k,e[46]=B,e[47]=Y,e[48]=I,e[49]=V):V=e[49];let K;return e[50]!==S||e[51]!==s||e[52]!==V?(K=n.jsx(Bt,{open:s,onOpenChange:S,children:V}),e[50]=S,e[51]=s,e[52]=V,e[53]=K):K=e[53],K}function U1(t){const e=H.c(43),{open:s,blockKey:i,initialName:r,isPending:o,onSubmit:a,onOpenChange:l}=t,h=o===void 0?!1:o,[c,d]=R.useState(r),[u,f]=R.useState(s);s!==u&&(f(s),s&&d(r));let m;e[0]!==h||e[1]!==l?(m=T=>{!T&&!h&&l(!1)},e[0]=h,e[1]=l,e[2]=m):m=e[2];const p=m;let _;e[3]!==h||e[4]!==c||e[5]!==a?(_=async T=>{T.preventDefault();const M=c.trim();!M||h||await a(M)},e[3]=h,e[4]=c,e[5]=a,e[6]=_):_=e[6];const v=_;let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsxs(ts,{children:[n.jsx(ss,{children:"Rename section"}),n.jsx(Oo,{children:"Updates the display name. The internal key stays the same so pages referencing this section keep working."})]}),e[7]=x):x=e[7];let y;e[8]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[8]=y):y=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=T=>d(T.target.value),e[9]=g):g=e[9];let b;e[10]!==h||e[11]!==c?(b=n.jsxs("div",{className:"space-y-1.5",children:[y,n.jsx(qe,{id:"section-rename-name",value:c,onChange:g,autoFocus:!0,disabled:h})]}),e[10]=h,e[11]=c,e[12]=b):b=e[12];let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Key"}),e[13]=S):S=e[13];let w;e[14]!==i?(w=n.jsxs("div",{className:"space-y-1.5",children:[S,n.jsx(qe,{value:i,readOnly:!0,disabled:!0,className:"font-mono"})]}),e[14]=i,e[15]=w):w=e[15];let k;e[16]!==b||e[17]!==w?(k=n.jsxs("div",{className:"space-y-4 py-4",children:[b,w]}),e[16]=b,e[17]=w,e[18]=k):k=e[18];let N;e[19]!==l?(N=()=>l(!1),e[19]=l,e[20]=N):N=e[20];let D;e[21]!==h||e[22]!==N?(D=n.jsx(se,{type:"button",variant:"outline",onClick:N,disabled:h,children:"Cancel"}),e[21]=h,e[22]=N,e[23]=D):D=e[23];let I;e[24]!==h||e[25]!==c?(I=!c.trim()||h,e[24]=h,e[25]=c,e[26]=I):I=e[26];let P;e[27]!==h?(P=h?n.jsxs(n.Fragment,{children:[n.jsx(we,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[27]=h,e[28]=P):P=e[28];let j;e[29]!==I||e[30]!==P?(j=n.jsx(se,{type:"submit",disabled:I,children:P}),e[29]=I,e[30]=P,e[31]=j):j=e[31];let C;e[32]!==D||e[33]!==j?(C=n.jsxs(ei,{children:[D,j]}),e[32]=D,e[33]=j,e[34]=C):C=e[34];let A;e[35]!==v||e[36]!==k||e[37]!==C?(A=n.jsx(Mt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:v,children:[x,k,C]})}),e[35]=v,e[36]=k,e[37]=C,e[38]=A):A=e[38];let E;return e[39]!==p||e[40]!==s||e[41]!==A?(E=n.jsx(Bt,{open:s,onOpenChange:p,children:A}),e[39]=p,e[40]=s,e[41]=A,e[42]=E):E=e[42],E}const _n={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},K1="blog/sections/blocks/",ma=["posts","authors","categories"],Ei={posts:"post",authors:"author",categories:"category"};function Ti(t){return ma.includes(t)}const pa={posts:"post",authors:"author",categories:"category"},ed={posts:_n.post,authors:_n.author,categories:_n.category},V1=Object.fromEntries(Object.entries(ed).map(([t,e])=>[e,t]));function q1(t){return typeof t=="string"?V1[t]??null:null}function Lr(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function Bs(t){return typeof t=="string"?t:""}function G1(t,e){switch(t){case"posts":return{label:Bs(e.title)||"Untitled post",subtitle:Bs(e.slug)};case"authors":return{label:Bs(e.name)||"Unnamed author",subtitle:Bs(e.email)};case"categories":return{label:Bs(e.name)||"Unnamed category",subtitle:Bs(e.slug)};default:{const s=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function td(t){const e={posts:[],authors:[],categories:[]};for(const[s,i]of Object.entries(t)){const r=Lr(i);if(!r)continue;const o=q1(r.__resolveType);if(!o)continue;const a=Lr(r[pa[o]])??{},{label:l,subtitle:h}=G1(o,a);e[o].push({key:s,kind:o,label:l,subtitle:h})}for(const s of ma)e[s].sort((i,r)=>i.label.localeCompare(r.label));return e}function Y1(t,e){return td(t)[e]}function AC(t,e){return Y1(t,e).map(s=>({key:s.key,payload:sd(Lr(t[s.key])??void 0,e)}))}function sd(t,e){return t?Lr(t[pa[e]])??{}:{}}function ul(t,e,s){return{name:t,__resolveType:ed[e],[pa[e]]:s}}function id(t){return`.deco/blocks/${encodeURIComponent(t)}.json`}function Fn(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function fl(t,e){const s=`collections/blog/${e}/${Fn(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function X1(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${Fn(8)}`,date:new Date().toISOString().slice(0,10),image:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${Fn(8)}`};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}function IC(t){const e=new Set,s=[],i=t.manifest?.blocks??{};for(const r of Object.values(i))for(const o of Object.keys(r)){if(!o.startsWith(K1)||e.has(o))continue;e.add(o);const a=Vi(o,t);s.push({resolveType:o,title:a.title??J1(o),description:a.description,icon:a.icon})}return s.sort((r,o)=>r.title.localeCompare(o.title))}function J1(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const Z1=["blog/sections/blocks/","site/sections/Blog/Post/"];function BC(t){return Z1.some(e=>t.startsWith(e))}function rd({orgSlug:t,virtualMcpId:e,branch:s}){return Dt.decofile(`${t}/${e}/${s}`)}function nd({orgSlug:t,virtualMcpId:e,branch:s},i){return`/api/${t}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(s)}/${i}`}function Q1(t){const e=H.c(11),s=qs();let i;e[0]!==t?(i=async l=>{const{blockKey:h,data:c}=l,d=await fetch(nd(t,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:id(h),content:JSON.stringify(c,null,2)})});if(!d.ok){const u=await d.json().catch(ex);throw new Error(u.error??`Write failed (${d.status})`)}return d.json()},e[0]=t,e[1]=i):i=e[1];let r;e[2]!==t||e[3]!==s?(r=async l=>{const{blockKey:h,data:c}=l,d=rd(t);await s.cancelQueries({queryKey:d});const u=s.getQueryData(d);return s.setQueryData(d,f=>({...f??{},[h]:c})),{previous:u,queryKey:d}},e[2]=t,e[3]=s,e[4]=r):r=e[4];let o;e[5]!==s?(o=(l,h,c)=>{c?.queryKey&&s.setQueryData(c.queryKey,c.previous)},e[5]=s,e[6]=o):o=e[6];let a;return e[7]!==i||e[8]!==r||e[9]!==o?(a={mutationFn:i,onMutate:r,onError:o},e[7]=i,e[8]=r,e[9]=o,e[10]=a):a=e[10],Gs(a)}function ex(){return{}}function tx(t){const e=qs();return Gs({mutationFn:async({blockKey:s})=>{const i=await fetch(nd(t,"unlink"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:id(s)})});if(!i.ok){const r=await i.json().catch(()=>({}));throw new Error(r.error??`Delete failed (${i.status})`)}return i.json()},onMutate:async({blockKey:s})=>{const i=rd(t);await e.cancelQueries({queryKey:i});const r=e.getQueryData(i);return e.setQueryData(i,o=>{if(!o)return o;const{[s]:a,...l}=o;return l}),{previous:r,queryKey:i}},onError:(s,i,r)=>{r?.queryKey&&e.setQueryData(r.queryKey,r.previous)}})}function sx(t){const e=H.c(20),{open:s,onOpenChange:i,pageKey:r,decofile:o}=t,[a,l]=R.useState(!1),h=o[r];let c;e[0]!==h?(c=h===void 0?"// Page not found.":JSON.stringify(h,null,2),e[0]=h,e[1]=c):c=e[1];const d=c;let u;e[2]!==d?(u=()=>{navigator.clipboard.writeText(d).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)})},e[2]=d,e[3]=u):u=e[3];const f=u;let m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(ss,{className:"text-sm font-semibold",children:"Page JSON"}),e[4]=m):m=e[4];let p;e[5]!==a?(p=a?n.jsx(kc,{size:12}):n.jsx(ds,{size:12}),e[5]=a,e[6]=p):p=e[6];const _=a?"Copied":"Copy";let v;e[7]!==f||e[8]!==p||e[9]!==_?(v=n.jsxs(ts,{className:"px-4 py-3 border-b flex-row items-center justify-between space-y-0",children:[m,n.jsxs(se,{variant:"ghost",size:"sm",onClick:f,className:"h-7 gap-1.5 text-xs",children:[p,_]})]}),e[7]=f,e[8]=p,e[9]=_,e[10]=v):v=e[10];let x;e[11]!==d?(x=n.jsx(Zr,{className:"max-h-[70vh]",children:n.jsx("pre",{className:"p-4 text-xs font-mono text-foreground/90 whitespace-pre overflow-auto",children:d})}),e[11]=d,e[12]=x):x=e[12];let y;e[13]!==v||e[14]!==x?(y=n.jsxs(Mt,{className:"max-w-2xl p-0 gap-0",children:[v,x]}),e[13]=v,e[14]=x,e[15]=y):y=e[15];let g;return e[16]!==i||e[17]!==s||e[18]!==y?(g=n.jsx(Bt,{open:s,onOpenChange:i,children:y}),e[16]=i,e[17]=s,e[18]=y,e[19]=g):g=e[19],g}const ml=R.lazy(()=>Kt(()=>import("./app-editor-BivZp6Yr.js"),__vite__mapDeps([156,1,2,46,47,48,16,3,5,77,6,7,8,9,10,11,12,13,14,15,17,4,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,78,50,72,79,73,80,51,81,49,82,83,84,58,85,60,61,157,90,91,92,93,94,95,96,97,98,99,100,101,102,57,103,59,104,105,106,107,108,66,109,56,110,71,111,70,67,112,113,114,115,116,117,65,87,88,52,53,54,55,62,63,64,68,69,74,75,76,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.AppEditor}))),ix=R.lazy(()=>Kt(()=>import("./post-editor-N9xx8HEl.js"),__vite__mapDeps([158,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,4,5,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,49,70,48,71,72,50,47,73,74,75,76,91,92,93,46,94,95,96,97,98,99,100,101,85,102,103,104,105,106,107,108,109,110,111,150,122,151,133,152,129,131,148,115,87,88,79,81,51,82,83,84,77,78,80,159,157,90,112,113,114,116,117,118,119,120,121,123,124,125,126,127,128,130,132,134,135,136,137,138,139,140,141,142,143,144,145,146,147,149,153])).then(t=>({default:t.PostEditor}))),rx=R.lazy(()=>Kt(()=>import("./record-editor-tc1QZAky.js"),__vite__mapDeps([160,1,2,50,72,73,81,8,39,40,7,16,20,18,6,9,10,11,12,13,14,15,3,17,4,5,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,41,42,43,44,45,49,51,82,83,84,58,85,60,61,159,157,90,91,92,93,46,47,48,94,95,96,97,98,99,100,101,102,57,103,59,104,105,106,107,108,66,109,56,110,71,111,70,67,112,113,114,115,116,117,65,79,87,88,52,53,54,55,62,63,64,68,69,74,75,76,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,80,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.RecordEditor}))),nx=R.lazy(()=>Kt(()=>import("./sections-editor-CkUdgmBv.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.SectionsEditor}))),ox=R.lazy(()=>Kt(()=>import("./seo-editor-D8nPTKAd.js"),__vite__mapDeps([161,1,2,4,6,7,8,9,10,11,12,13,14,15,16,3,17,5,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,86,72,80,77,78,50,79,73,51,81,49,82,83,84,58,85,60,61,90,91,92,93,94,95,96,97,98,99,100,101,102,57,103,59,104,105,106,107,108,66,109,56,110,71,111,70,67,112,113,114,115,116,117,65,87,88,52,53,54,55,62,63,64,68,69,74,75,76,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.SeoEditor}))),ax=R.lazy(()=>Kt(()=>import("./add-section-modal-Ca9uYkx3.js"),__vite__mapDeps([89,1,2,6,7,8,9,10,11,12,13,14,15,16,3,17,4,5,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,49,50,90,91,92,93,46,47,48,94,95,96,97,58,98,99,100,101,85,102,57,103,59,104,105,106,107,108,66,109,56,110,71,72,111,70,67,83,112,113,114,115,82,116,117,65,79,87,88,60,61,52,53,54,55,62,63,64,68,69,73,74,75,76,118,51,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,80,140,141,142,143,144,145,146,147,148,149,150,151,152,153])).then(t=>({default:t.AddSectionModal}))),Hn="oklch(0.65 0.15 160)";function lx(){const t=H.c(18),e=Zi(),{data:s}=Ks.useSession(),{currentBranch:i}=es(),{org:r}=Ne(),o=e?.entity?.id??null,a=s?.user?.id,l=e?.entity?.metadata,h=a&&i?Kr(l?.sandboxMap?.[a]?.[i]):{},c=Object.values(h),u=(c.find(cx)??c[0])?.previewUrl??null,f=qt(),m=e?.entity?.organization_id??"";let p;t[0]!==r.slug||t[1]!==m?(p={connectionId:Cs,orgId:m,orgSlug:r.slug},t[0]=r.slug,t[1]=m,t[2]=p):p=t[2];const _=tt(p),v=Eo(_);let x;t[3]!==i||t[4]!==v||t[5]!==o?(x=()=>{if(!o)return;const w={virtualMcpId:o};i&&(w.branch=i),v.mutate(w)},t[3]=i,t[4]=v,t[5]=o,t[6]=x):x=t[6];const y=x,g=!!o&&!!i&&Dn.isStopped(o,i),b=$h({previewUrl:u,appPaused:f.status.state==="paused",userStopped:g});if(b.kind!=="iframe"){let w;return t[7]!==b||t[8]!==y||t[9]!==f.lifecycle||t[10]!==f.phase?(w=n.jsx(mx,{state:b,claimPhase:f.phase,lifecycle:f.lifecycle,onStart:y}),t[7]=b,t[8]=y,t[9]=f.lifecycle,t[10]=f.phase,t[11]=w):w=t[11],w}if(!o||!i){let w;return t[12]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(vi,{title:"Waiting for sandbox context…"}),t[12]=w):w=t[12],w}let S;return t[13]!==i||t[14]!==r.slug||t[15]!==u||t[16]!==o?(S=n.jsx(hx,{orgSlug:r.slug,virtualMcpId:o,branch:i,previewUrl:u}),t[13]=i,t[14]=r.slug,t[15]=u,t[16]=o,t[17]=S):S=t[17],S}function cx(t){return t.sandboxProviderKind!=="user-desktop"}function hx({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:i}){const r={orgSlug:t,virtualMcpId:e,branch:s},{data:o,isLoading:a}=Jo(r),[l,h]=R.useState("pages"),[c,d]=R.useState(null),[u,f]=R.useState(null),[m,p]=R.useState(""),[_,v]=R.useState(l);_!==l&&(v(l),p(""));const x=2e3,y=15,{data:g,isLoading:b}=Zo(r,{refetchInterval:J=>{if(l!=="apps"||!c||c.collection!=="apps")return!1;const fe=o?.[c.key]?.__resolveType;if(typeof fe!="string")return!1;const Se=J.state.data;return Se&&(On(fe,Se)||J.state.dataUpdateCount>=y)?!1:x}}),{catalog:S,isLoading:w}=b1(g??void 0,o??void 0,{enabled:l==="apps"}),k=da(r),N=u1(r),D=Q1(r),I=tx(r),[P,j]=R.useState(null),[C,A]=R.useState(),[E,T]=R.useState(!1),[M,B]=R.useState(null),[O,F]=R.useState(null),[W,$]=R.useState(null);if(a||b)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(we,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!g)return n.jsx(vi,{title:"Could not load site data."});const U=ia(o).sort((J,xe)=>J.name.localeCompare(xe.name)),Y=ra(o,g),V=jh(o,g),K=td(o),q=ma.some(J=>K[J].length>0),Q=Ti(l)?K[l]:[];if(!sa(o,g)&&!q)return n.jsx(vi,{icon:zi,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, or apps."});const oe={pages:U.length,sections:Y.length,apps:S.length,posts:K.posts.length,authors:K.authors.length,categories:K.categories.length},L=new Set(U.map(J=>Ni(J.path))),ee=new Set(U.map(J=>J.name)),te=new Set(Y.map(J=>J.name)),G=async J=>{const xe=o[J.key];if(!xe)return;const fe=Qh(o,J.key),Se=P1(o,J.key,Math.max(0,fe-1)),Ce=A1(xe.sections,Se);if(Ce)try{await k.mutateAsync({blockKey:J.key,data:{...xe,sections:Ce}}),ae.success(`Variant added to "${J.name}"`),d({collection:"pages",key:J.key,path:J.path})}catch(Ye){ae.error(Ye instanceof Error?Ye.message:"Could not add variant")}},z=()=>{A(void 0),j({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},le=J=>{A(void 0),j({mode:"duplicate",sourceKey:J.key,initialName:hl(ee,J.name),initialPath:B1(L,J.path)})},ue=J=>{A(void 0),j({mode:"rename",sourceKey:J.key,initialName:J.name,initialPath:J.path})},me=async J=>{if(!P)return;const{mode:xe,sourceKey:fe}=P;try{if(xe==="create"){const Se=L1(J.name,J.path),Ce=$1(o,J.name);await k.mutateAsync({blockKey:Ce,data:Se}),ae.success(`Created "${J.name}"`),d({collection:"pages",key:Ce,path:J.path})}else if(xe==="duplicate"&&fe){const Se=o[fe];if(!Se)throw new Error("Source page not found");const{key:Ce,data:Ye}=M1({source:Se,pages:U,newName:J.name,newPath:J.path});await k.mutateAsync({blockKey:Ce,data:Ye}),ae.success(`Duplicated as "${J.name}"`),d({collection:"pages",key:Ce,path:J.path})}else if(xe==="rename"&&fe){const Se=o[fe];if(!Se)throw new Error("Page not found");const Ce={...Se,name:J.name,path:J.path};await k.mutateAsync({blockKey:fe,data:Ce}),ae.success("Page updated"),c?.collection==="pages"&&c.key===fe&&d({collection:"pages",key:fe,path:J.path})}j(null)}catch(Se){A(Se instanceof Error?Se.message:"Save failed")}},he=({path:J})=>{if(!P)return null;const xe=Ni(J);return(P.mode==="rename"?Ni(P.initialPath):null)!==xe&&L.has(xe)?`A page with path "${J}" already exists.`:null},ie=async J=>{const xe=(J.title||J.resolveType.split("/").pop()||"").replace(/\.(tsx?|jsx?)$/,"").replace(/[^A-Za-z0-9_-]/g,""),fe=/^[A-Za-z]/.test(xe)&&xe.length>0?xe:"Section",Se=dl(o,fe),Ce={__resolveType:J.resolveType,name:Se};try{await k.mutateAsync({blockKey:Se,data:Ce}),ae.success(`Created section "${Se}"`),T(!1),d({collection:"sections",key:Se})}catch(Ye){ae.error(Ye instanceof Error?Ye.message:"Could not create section")}},ve=async J=>{const xe=o[J.key];if(!xe){ae.error("Section not found.");return}const fe=dl(o,J.key),Se=hl(te,J.name),Ce={...xe,name:Se};try{await k.mutateAsync({blockKey:fe,data:Ce}),ae.success(`Duplicated "${J.name}"`),d({collection:"sections",key:fe})}catch(Ye){ae.error(Ye instanceof Error?Ye.message:"Duplicate failed")}},re=async J=>{if(!M)return;const xe=o[M];if(!xe){ae.error("Section not found.");return}try{await k.mutateAsync({blockKey:M,data:{...xe,name:J}}),ae.success("Section renamed"),B(null)}catch(fe){ae.error(fe instanceof Error?fe.message:"Rename failed")}},ke=async J=>{const xe=fl(o,J),fe=ul(xe,J,X1(J));try{await D.mutateAsync({blockKey:xe,data:fe}),ae.success(`Created ${Ei[J]}`),d({collection:J,key:xe})}catch(Se){ae.error(Se instanceof Error?Se.message:"Could not create")}},it=async J=>{const xe=o[J.key];if(!xe){ae.error("Record not found.");return}const fe=fl(o,J.kind),Se=J.kind==="posts"?"title":"name",Ce={...structuredClone(sd(xe,J.kind)),[Se]:`${J.label} (copy)`};try{await D.mutateAsync({blockKey:fe,data:ul(fe,J.kind,Ce)}),ae.success(`Duplicated "${J.label}"`),d({collection:J.kind,key:fe})}catch(Ye){ae.error(Ye instanceof Error?Ye.message:"Duplicate failed")}},De=async()=>{if(!O)return;const{kind:J,key:xe,label:fe}=O;try{J==="blog"?await I.mutateAsync({blockKey:xe}):await N.mutateAsync({blockKey:xe}),ae.success(`Deleted "${fe}"`),c&&c.key===xe&&d(null),F(null)}catch(Se){ae.error(Se instanceof Error?Se.message:"Delete failed")}},ft=N.isPending||I.isPending,ai=O?.kind==="blog"?Ei[O.blogKind]:O?.kind??"item";return n.jsxs("div",{className:"flex h-full w-full",children:[n.jsx(dx,{active:l,counts:oe,showBlog:q,onSelect:J=>{h(J),d(null),f(null)}}),l!=="seo"&&l!=="site"&&n.jsx(ux,{activeCollection:l,pages:U,sections:Y,appCatalog:S,appCatalogLoading:w,blogEntries:Q,decofile:o,searchQuery:m,onSearchChange:p,selection:c,onSelect:J=>{d(J),f(null)},previewUrl:i,onCreate:()=>{l==="pages"?z():Ti(l)?ke(l):i?T(!0):ae.error("Start the preview dev server to add sections.")},onDuplicatePage:le,onRenamePage:ue,onAddPageVariant:G,onDeletePage:J=>F({kind:"page",key:J.key,label:J.name}),onEditPageSeo:J=>{d({collection:"pages",key:J.key,path:J.path}),f(J.key)},onViewPageJson:J=>$(J.key),onDuplicateSection:ve,onRenameSection:J=>B(J.key),onDeleteSection:J=>F({kind:"section",key:J.key,label:J.name}),onDuplicateBlog:it,onDeleteBlog:J=>F({kind:"blog",blogKind:J.kind,key:J.key,label:J.label})}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(R.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(we,{size:20,className:"animate-spin text-muted-foreground"})}),children:l==="site"?V?n.jsx(ml,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:V.key,block:o[V.key],meta:g,title:"Site",excludeFields:["seo"]},`site:${V.key}`):n.jsx(vi,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):l==="seo"?n.jsx(ox,{orgSlug:t,virtualMcpId:e,branch:s,decofile:o,meta:g,target:{kind:"site"},previewBaseUrl:i}):c?c.collection==="apps"?n.jsx(ml,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:c.key,block:o[c.key],meta:g,schemaPending:typeof o[c.key]?.__resolveType=="string"&&!On(String(o[c.key].__resolveType),g)},`app:${c.key}`):c.collection==="posts"?n.jsx(ix,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:c.key,block:o[c.key],decofile:o,meta:g},`post:${c.key}`):c.collection==="authors"||c.collection==="categories"?n.jsx(rx,{orgSlug:t,virtualMcpId:e,branch:s,kind:c.collection,blockKey:c.key,block:o[c.key]},`${c.collection}:${c.key}`):n.jsx(nx,{orgSlug:t,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:i??void 0,currentPath:c.collection==="pages"?c.path:"/",activePageBlockKey:c.collection==="pages"?c.key:null,activeGlobalBlockKey:c.collection==="sections"?c.key:null,initialEditSeo:c.collection==="pages"&&u===c.key,onExitSeo:()=>f(null)},c.collection==="pages"?`page:${c.key}`:`section:${c.key}`):n.jsx(vi,{title:`Select ${Ti(l)?`a ${Ei[l]}`:l==="pages"?"a page":l==="apps"?"an app":"a section"} to edit`,description:l==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),P&&n.jsx(W1,{open:!!P,mode:P.mode,initialName:P.initialName,initialPath:P.initialPath,isPending:k.isPending,error:C,validate:he,onSubmit:me,onOpenChange:J=>{J||(j(null),A(void 0))}}),M&&n.jsx(U1,{open:!!M,blockKey:M,initialName:Y.find(J=>J.key===M)?.name??M,isPending:k.isPending,onSubmit:re,onOpenChange:J=>{J||B(null)}}),E&&i&&n.jsx(R.Suspense,{fallback:null,children:n.jsx(ax,{open:E,onOpenChange:T,meta:g,decofile:o,previewBaseUrl:i,onSelect:ie})}),W&&n.jsx(sx,{open:!!W,onOpenChange:J=>{J||$(null)},pageKey:W,decofile:o}),n.jsx(kr,{open:!!O,onOpenChange:J=>{!J&&!ft&&F(null)},children:n.jsxs(jr,{children:[n.jsxs(Nr,{children:[n.jsx(Er,{children:`Delete ${ai}?`}),n.jsx(Tr,{children:O?.kind==="section"?`"${O.label}" will be removed. Pages that still reference it will lose this section.`:O?`"${O.label}" will be removed permanently. This can't be undone.`:null})]}),n.jsxs(Rr,{children:[n.jsx(Pr,{disabled:ft,children:"Cancel"}),n.jsx(Dr,{onClick:J=>{J.preventDefault(),De()},disabled:ft,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:ft?n.jsxs(n.Fragment,{children:[n.jsx(we,{size:14,className:"animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})}function dx(t){const e=H.c(33),{active:s,counts:i,showBlog:r,onSelect:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:n.jsx("span",{className:"text-sm font-medium",children:"Content"})}),e[0]=a):a=e[0];const l=s==="pages";let h;e[1]!==i.pages||e[2]!==o||e[3]!==l?(h=n.jsx(ns,{id:"pages",icon:Ao,label:"Pages",count:i.pages,active:l,onSelect:o}),e[1]=i.pages,e[2]=o,e[3]=l,e[4]=h):h=e[4];const c=s==="sections";let d;e[5]!==i.sections||e[6]!==o||e[7]!==c?(d=n.jsx(ns,{id:"sections",icon:Hs,label:"Sections",count:i.sections,active:c,onSelect:o}),e[5]=i.sections,e[6]=o,e[7]=c,e[8]=d):d=e[8];const u=s==="apps";let f;e[9]!==i.apps||e[10]!==o||e[11]!==u?(f=n.jsx(ns,{id:"apps",icon:eh,label:"Apps",count:i.apps,active:u,onSelect:o}),e[9]=i.apps,e[10]=o,e[11]=u,e[12]=f):f=e[12];let m;e[13]!==s||e[14]!==i.authors||e[15]!==i.categories||e[16]!==i.posts||e[17]!==o||e[18]!==r?(m=r&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[n.jsx(Qc,{size:13,className:"shrink-0"}),"Blog"]}),n.jsx(ns,{id:"posts",icon:Dc,label:"Posts",count:i.posts,active:s==="posts",onSelect:o}),n.jsx(ns,{id:"authors",icon:Ho,label:"Authors",count:i.authors,active:s==="authors",onSelect:o}),n.jsx(ns,{id:"categories",icon:Ac,label:"Categories",count:i.categories,active:s==="categories",onSelect:o})]}),e[13]=s,e[14]=i.authors,e[15]=i.categories,e[16]=i.posts,e[17]=o,e[18]=r,e[19]=m):m=e[19];const p=s==="site";let _;e[20]!==o||e[21]!==p?(_=n.jsx(ns,{id:"site",icon:bf,label:"Site",active:p,onSelect:o}),e[20]=o,e[21]=p,e[22]=_):_=e[22];const v=s==="seo";let x;e[23]!==o||e[24]!==v?(x=n.jsx(ns,{id:"seo",icon:Sr,label:"SEO",active:v,onSelect:o}),e[23]=o,e[24]=v,e[25]=x):x=e[25];let y;return e[26]!==_||e[27]!==x||e[28]!==h||e[29]!==d||e[30]!==f||e[31]!==m?(y=n.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[a,n.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[h,d,f,m,_,x]})]}),e[26]=_,e[27]=x,e[28]=h,e[29]=d,e[30]=f,e[31]=m,e[32]=y):y=e[32],y}function ns(t){const e=H.c(18),{id:s,icon:i,label:r,count:o,active:a,onSelect:l}=t;let h;e[0]!==s||e[1]!==l?(h=()=>l(s),e[0]=s,e[1]=l,e[2]=h):h=e[2];const c=a?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let d;e[3]!==c?(d=ce("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",c),e[3]=c,e[4]=d):d=e[4];let u;e[5]!==i?(u=n.jsx(i,{size:16,className:"shrink-0"}),e[5]=i,e[6]=u):u=e[6];let f;e[7]!==r?(f=n.jsx("span",{className:"flex-1 truncate",children:r}),e[7]=r,e[8]=f):f=e[8];let m;e[9]!==a||e[10]!==o?(m=o!==void 0&&n.jsx("span",{className:ce("shrink-0 text-xs tabular-nums",a?"text-accent-foreground/70":"text-muted-foreground/70"),children:o}),e[9]=a,e[10]=o,e[11]=m):m=e[11];let p;return e[12]!==h||e[13]!==d||e[14]!==u||e[15]!==f||e[16]!==m?(p=n.jsxs("button",{type:"button",onClick:h,className:d,children:[u,f,m]}),e[12]=h,e[13]=d,e[14]=u,e[15]=f,e[16]=m,e[17]=p):p=e[17],p}function ux(t){const e=H.c(57),{activeCollection:s,pages:i,sections:r,appCatalog:o,appCatalogLoading:a,blogEntries:l,decofile:h,previewUrl:c,searchQuery:d,onSearchChange:u,selection:f,onSelect:m,onCreate:p,onDuplicatePage:_,onRenamePage:v,onAddPageVariant:x,onDeletePage:y,onEditPageSeo:g,onViewPageJson:b,onDuplicateSection:S,onRenameSection:w,onDeleteSection:k,onDuplicateBlog:N,onDeleteBlog:D}=t;let I,P,j,C,A,E;if(e[0]!==s||e[1]!==o||e[2]!==a||e[3]!==l||e[4]!==h||e[5]!==x||e[6]!==p||e[7]!==D||e[8]!==y||e[9]!==k||e[10]!==N||e[11]!==_||e[12]!==S||e[13]!==g||e[14]!==v||e[15]!==w||e[16]!==u||e[17]!==m||e[18]!==b||e[19]!==i||e[20]!==c||e[21]!==d||e[22]!==r||e[23]!==f){const O=d.toLowerCase(),F=i.filter(z=>!O||z.name.toLowerCase().includes(O)||z.path.toLowerCase().includes(O)),W=r.filter(z=>!O||z.name.toLowerCase().includes(O)||z.key.toLowerCase().includes(O)||z.resolveType.toLowerCase().includes(O)),$=o.filter(z=>!O||z.title.toLowerCase().includes(O)||z.app.toLowerCase().includes(O)||z.vendor.toLowerCase().includes(O)||z.category.toLowerCase().includes(O)),U=l.filter(z=>!O||z.label.toLowerCase().includes(O)||z.subtitle.toLowerCase().includes(O)),Y=`Search ${s}…`,V=Ti(s)?`Create new ${Ei[s]}`:s==="pages"?"Create new page":"Create new section",K=s==="sections"&&!c,q=s!=="apps",Q=K,oe=K?"Start the preview dev server to add sections":void 0;A="w-[300px] shrink-0 border-r flex flex-col min-h-0";let L;e[30]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx(Zc,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[30]=L):L=e[30];let ee;e[31]!==u?(ee=z=>u(z.target.value),e[31]=u,e[32]=ee):ee=e[32];let te;e[33]!==Y||e[34]!==d||e[35]!==ee?(te=n.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[L,n.jsx("input",{type:"text",value:d,onChange:ee,placeholder:Y,"aria-label":Y,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[33]=Y,e[34]=d,e[35]=ee,e[36]=te):te=e[36];let G;e[37]!==Q||e[38]!==oe||e[39]!==V||e[40]!==p||e[41]!==q?(G=q&&n.jsxs(Pe,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",onClick:p,disabled:Q,"aria-label":V,"aria-disabled":Q,children:n.jsx(At,{size:14})})}),n.jsx(Re,{side:"bottom",children:oe??V})]}),e[37]=Q,e[38]=oe,e[39]=V,e[40]=p,e[41]=q,e[42]=G):G=e[42],e[43]!==te||e[44]!==G?(E=n.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[te,G]}),e[43]=te,e[44]=G,e[45]=E):E=e[45],I=Zr,C="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",P="flex flex-col gap-1 p-1.5",j=s==="pages"?F.length===0?n.jsx(rr,{hasItems:i.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):F.map(z=>{const le=f?.collection==="pages"&&f.key===z.key,ue=Qh(h,z.key);return n.jsx(ir,{icon:Ao,title:z.name,subtitle:z.path,active:le,variantCount:ue,onClick:()=>m({collection:"pages",key:z.key,path:z.path}),menu:n.jsx(gn,{onDuplicate:()=>_(z),onRename:()=>v(z),onAddVariant:()=>x(z),onEditSeo:()=>g(z),onViewJson:()=>b(z),onDelete:()=>y(z)})},z.key)}):s==="sections"?W.length===0?n.jsx(rr,{hasItems:r.length>0,emptyLabel:"No saved sections yet.",emptyHint:'Click "+" to create one, or save a section from a page.'}):W.map(z=>{const le=f?.collection==="sections"&&f.key===z.key,ue=z.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return n.jsx(ir,{icon:Hs,title:z.name,subtitle:ue??z.resolveType,active:le,onClick:()=>m({collection:"sections",key:z.key}),menu:n.jsx(gn,{onDuplicate:()=>S(z),onRename:()=>w(z),onDelete:()=>k(z)})},z.key)}):s==="apps"?a?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx(we,{size:18,className:"animate-spin text-muted-foreground"})}):$.length===0?n.jsx(rr,{hasItems:o.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):$.map(z=>{const le=f?.collection==="apps"&&z.blockKey!==null&&f.key===z.blockKey;return n.jsx(ir,{icon:eh,logoUrl:z.logo,title:z.title,subtitle:z.category,active:le,trailing:z.installed?n.jsx("span",{className:"shrink-0 rounded-full bg-emerald-500/15 px-1.5 py-0.5 text-[10px] font-medium text-emerald-700 dark:text-emerald-400",children:"Installed"}):void 0,onClick:()=>{if(!z.installed||!z.blockKey){ae.message(`${z.title} is not installed on this site.`);return}m({collection:"apps",key:z.blockKey})}},z.id)}):U.length===0?n.jsx(rr,{hasItems:l.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${Ti(s)?Ei[s]:"item"}.`}):U.map(z=>{const le=f?.collection===z.kind&&f.key===z.key;return n.jsx(ir,{icon:z.kind==="posts"?Dc:z.kind==="authors"?Ho:Ac,title:z.label,subtitle:z.subtitle,active:le,onClick:()=>m({collection:z.kind,key:z.key}),menu:n.jsx(gn,{onDuplicate:()=>N(z),onDelete:()=>D(z)})},z.key)}),e[0]=s,e[1]=o,e[2]=a,e[3]=l,e[4]=h,e[5]=x,e[6]=p,e[7]=D,e[8]=y,e[9]=k,e[10]=N,e[11]=_,e[12]=S,e[13]=g,e[14]=v,e[15]=w,e[16]=u,e[17]=m,e[18]=b,e[19]=i,e[20]=c,e[21]=d,e[22]=r,e[23]=f,e[24]=I,e[25]=P,e[26]=j,e[27]=C,e[28]=A,e[29]=E}else I=e[24],P=e[25],j=e[26],C=e[27],A=e[28],E=e[29];let T;e[46]!==P||e[47]!==j?(T=n.jsx("div",{className:P,children:j}),e[46]=P,e[47]=j,e[48]=T):T=e[48];let M;e[49]!==I||e[50]!==C||e[51]!==T?(M=n.jsx(I,{className:C,children:T}),e[49]=I,e[50]=C,e[51]=T,e[52]=M):M=e[52];let B;return e[53]!==A||e[54]!==E||e[55]!==M?(B=n.jsxs("div",{className:A,children:[E,M]}),e[53]=A,e[54]=E,e[55]=M,e[56]=B):B=e[56],B}function ir(t){const e=H.c(29),{icon:s,logoUrl:i,title:r,subtitle:o,active:a,variantCount:l,trailing:h,onClick:c,menu:d}=t;let u;e[0]!==s||e[1]!==a||e[2]!==i||e[3]!==l?(u=l&&l>1?n.jsxs(Pe,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(s,{size:16,className:"shrink-0",style:{color:Hn}})}),n.jsxs(Re,{side:"right",children:[l," variants"]})]}):i?n.jsx("img",{src:i,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):n.jsx(s,{size:16,className:ce("shrink-0",a?"text-accent-foreground":"text-muted-foreground")}),e[0]=s,e[1]=a,e[2]=i,e[3]=l,e[4]=u):u=e[4];const f=u,m=a?"bg-accent text-accent-foreground":"hover:bg-muted";let p;e[5]!==m?(p=ce("group relative flex min-w-0 items-center rounded-md transition-colors",m),e[5]=m,e[6]=p):p=e[6];let _;e[7]!==r?(_=n.jsx("span",{className:"block truncate text-sm font-medium",children:r}),e[7]=r,e[8]=_):_=e[8];const v=a?"text-accent-foreground/70":"text-muted-foreground";let x;e[9]!==v?(x=ce("block truncate text-xs",v),e[9]=v,e[10]=x):x=e[10];let y;e[11]!==o||e[12]!==x?(y=n.jsx("span",{className:x,children:o}),e[11]=o,e[12]=x,e[13]=y):y=e[13];let g;e[14]!==_||e[15]!==y?(g=n.jsxs("span",{className:"min-w-0 flex-1",children:[_,y]}),e[14]=_,e[15]=y,e[16]=g):g=e[16];let b;e[17]!==c||e[18]!==f||e[19]!==g||e[20]!==h?(b=n.jsxs("button",{type:"button",onClick:c,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-2.5 py-2 text-left cursor-pointer",children:[f,g,h]}),e[17]=c,e[18]=f,e[19]=g,e[20]=h,e[21]=b):b=e[21];let S;e[22]!==a||e[23]!==d?(S=d&&n.jsx("div",{className:ce("pr-1 opacity-0 transition-opacity group-hover:opacity-100",a&&"opacity-100"),children:d}),e[22]=a,e[23]=d,e[24]=S):S=e[24];let w;return e[25]!==S||e[26]!==p||e[27]!==b?(w=n.jsxs("div",{className:p,children:[b,S]}),e[25]=S,e[26]=p,e[27]=b,e[28]=w):w=e[28],w}function gn(t){const e=H.c(21),{onDuplicate:s,onRename:i,onAddVariant:r,onEditSeo:o,onViewJson:a,onDelete:l}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Zs,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":"More actions",className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:fx,children:n.jsx(Yr,{size:14})})}),e[0]=h):h=e[0];let c;e[1]!==i?(c=i&&n.jsxs(et,{onClick:i,children:[n.jsx(Wo,{size:14}),"Rename"]}),e[1]=i,e[2]=c):c=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(ds,{size:14}),e[3]=d):d=e[3];let u;e[4]!==s?(u=n.jsxs(et,{onClick:s,children:[d,"Duplicate"]}),e[4]=s,e[5]=u):u=e[5];let f;e[6]!==r?(f=r&&n.jsxs(n.Fragment,{children:[n.jsx(ur,{}),n.jsxs(et,{onClick:r,className:"cursor-pointer",style:{color:Hn},children:[n.jsx(yf,{size:14,style:{color:Hn}}),"Add variant"]})]}),e[6]=r,e[7]=f):f=e[7];let m;e[8]!==o||e[9]!==a?(m=(o||a)&&n.jsxs(n.Fragment,{children:[n.jsx(ur,{}),o&&n.jsxs(et,{onClick:o,children:[n.jsx(Sr,{size:14}),"Edit SEO"]}),a&&n.jsxs(et,{onClick:a,children:[n.jsx(Io,{size:14}),"View JSON"]})]}),e[8]=o,e[9]=a,e[10]=m):m=e[10];let p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(ur,{}),e[11]=p):p=e[11];let _;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=n.jsx(Ii,{size:14}),e[12]=_):_=e[12];let v;e[13]!==l?(v=n.jsxs(et,{onClick:l,className:"text-destructive focus:text-destructive",children:[_,"Delete"]}),e[13]=l,e[14]=v):v=e[14];let x;return e[15]!==c||e[16]!==u||e[17]!==f||e[18]!==m||e[19]!==v?(x=n.jsxs(Js,{children:[h,n.jsxs(Qs,{align:"end",className:"w-44",children:[c,u,f,m,p,v]})]}),e[15]=c,e[16]=u,e[17]=f,e[18]=m,e[19]=v,e[20]=x):x=e[20],x}function fx(t){return t.stopPropagation()}function rr(t){const e=H.c(6),{hasItems:s,emptyLabel:i,emptyHint:r}=t;let o;e[0]!==r||e[1]!==i||e[2]!==s?(o=s?"No results match your search.":n.jsxs(n.Fragment,{children:[n.jsx("div",{children:i}),n.jsx("div",{className:"mt-1 text-muted-foreground/80",children:r})]}),e[0]=r,e[1]=i,e[2]=s,e[3]=o):o=e[3];let a;return e[4]!==o?(a=n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=a):a=e[5],a}function mx(t){const e=H.c(8),{state:s,claimPhase:i,lifecycle:r,onStart:o}=t;switch(s.kind){case"starting":{let a;e[0]!==i||e[1]!==r?(a=Vh({claimPhase:i,lifecycle:r}),e[0]=i,e[1]=r,e[2]=a):a=e[2];let l;return e[3]!==i||e[4]!==a?(l=n.jsx(Br,{kind:"starting",progress:a,claimPhase:i}),e[3]=i,e[4]=a,e[5]=l):l=e[5],l}case"suspended":{let a;return e[6]!==o?(a=n.jsx(Br,{kind:"suspended",onResume:o}),e[6]=o,e[7]=a):a=e[7],a}}}function vi(t){const e=H.c(10),{icon:s,title:i,description:r}=t;let o;e[0]!==s?(o=s&&n.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=o):o=e[1];let a;e[2]!==i?(a=n.jsx("div",{children:i}),e[2]=i,e[3]=a):a=e[3];let l;e[4]!==r?(l=r&&n.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:r}),e[4]=r,e[5]=l):l=e[5];let h;return e[6]!==o||e[7]!==a||e[8]!==l?(h=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[o,a,l]}),e[6]=o,e[7]=a,e[8]=l,e[9]=h):h=e[9],h}function px(t){const e=H.c(2),{virtualMcpId:s}=t,i=It(s);if(!Ys(i?.metadata)){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[n.jsx(zi,{size:24,className:"text-muted-foreground/60"}),n.jsx("div",{children:"No content to edit."}),n.jsx("div",{className:"text-xs text-muted-foreground/80",children:"Connect a GitHub repository from the Settings tab to enable Content."})]}),e[0]=a):a=e[0],a}let o;return e[1]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(lx,{}),e[1]=o):o=e[1],o}const vn={fast:{label:"Fast",subtitle:"Quick responses for simple tasks",icon:Rc},smart:{label:"Smart",subtitle:"Balanced quality and speed",icon:Jr},thinking:{label:"Thinking",subtitle:"Deeper reasoning for hard tasks",icon:kf}},_x=["fast","smart","thinking"];function gx(t){const e=H.c(15),{tier:s,onSelect:i}=t,[r,o]=R.useState(!1),a=vn[s].icon;let l;e[0]!==a?(l=n.jsx(a,{size:14,className:"text-muted-foreground"}),e[0]=a,e[1]=l):l=e[1];const h=vn[s];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(js,{size:14,className:"text-muted-foreground"}),e[2]=c):c=e[2];let d;e[3]!==l||e[4]!==h.label?(d=n.jsx(Es,{asChild:!0,children:n.jsxs(se,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[l,h.label,c]})}),e[3]=l,e[4]=h.label,e[5]=d):d=e[5];let u;e[6]!==i||e[7]!==s?(u=_x.map(p=>{const _=vn[p],v=_.icon;return n.jsxs("button",{type:"button",onClick:()=>{i(p),o(!1)},className:ce("flex items-start gap-2 px-2 py-1.5 rounded-md text-left hover:bg-muted"),children:[n.jsx(v,{size:16,className:"shrink-0 text-muted-foreground mt-0.5"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"text-sm",children:_.label}),n.jsx("div",{className:"text-xs text-muted-foreground",children:_.subtitle})]}),p===s&&n.jsx(Wi,{size:14,className:"text-foreground mt-0.5"})]},p)}),e[6]=i,e[7]=s,e[8]=u):u=e[8];let f;e[9]!==u?(f=n.jsx(Ts,{align:"start",className:"p-1 w-64",children:n.jsx("div",{className:"flex flex-col",children:u})}),e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==r||e[12]!==d||e[13]!==f?(m=n.jsxs(Ns,{open:r,onOpenChange:o,children:[d,f]}),e[11]=r,e[12]=d,e[13]=f,e[14]=m):m=e[14],m}function vx(t){const e=H.c(15),{tier:s,onTierChange:i,override:r,onOverrideChange:o}=t,[a,l]=R.useState(r!==null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Model"}),e[0]=h):h=e[0];let c;e[1]!==o||e[2]!==i||e[3]!==r||e[4]!==s||e[5]!==a?(c=a?n.jsx(R.Suspense,{fallback:n.jsx(se,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:"Loading models…"}),children:n.jsx(xx,{override:r,onOverrideChange:o})}):n.jsx(gx,{tier:s,onSelect:i}),e[1]=o,e[2]=i,e[3]=r,e[4]=s,e[5]=a,e[6]=c):c=e[6];let d;e[7]!==o?(d=m=>{l(m),m||o(null)},e[7]=o,e[8]=d):d=e[8];let u;e[9]!==d||e[10]!==a?(u=n.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[n.jsx(Ar,{checked:a,onCheckedChange:d,className:"cursor-pointer"}),"Specific model"]}),e[9]=d,e[10]=a,e[11]=u):u=e[11];let f;return e[12]!==c||e[13]!==u?(f=n.jsxs("div",{className:"flex flex-col gap-2",children:[h,n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[c,u]})]}),e[12]=c,e[13]=u,e[14]=f):f=e[14],f}function xx(t){const e=H.c(10),{override:s,onOverrideChange:i}=t,r=Nc(),o=r[0]?.id??null,[a,l]=R.useState(s?.credentialId??o);let h;e[0]!==s?(h=s?{modelId:s.modelId,title:s.title||s.modelId,keyId:s.credentialId,providerId:"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,e[0]=s,e[1]=h):h=e[1];const c=h;if(r.length===0){let f;return e[2]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Connect an AI provider in settings to pick a specific model."}),e[2]=f):f=e[2],f}let d;e[3]!==a||e[4]!==i?(d=f=>{const m=f.keyId??a??"";l(m),i({modelId:f.modelId,credentialId:m,title:f.title??f.modelId})},e[3]=a,e[4]=i,e[5]=d):d=e[5];let u;return e[6]!==a||e[7]!==c||e[8]!==d?(u=n.jsx("div",{className:"w-fit max-w-full [&_button]:rounded-md",children:n.jsx(zm,{variant:"bordered",placeholder:"Pick a model",model:c,credentialId:a,onCredentialChange:l,onModelChange:d})}),e[6]=a,e[7]=c,e[8]=d,e[9]=u):u=e[9],u}const od=[{key:"capabilities",heading:"Built-in capabilities",icon:Uo,tools:[{name:"web_search",title:"Web search",description:"Look up current information on the web",icon:Fi},{name:"generate_image",title:"Generate image",description:"Create images from a text prompt",icon:Dm},{name:"subtask",title:"Subtask",description:"Spawn a focused sub-agent to handle part of the work",icon:Ai},{name:"user_ask",title:"Ask the user",description:"Pause to ask the user a clarifying question",icon:Sf}]},{key:"files",heading:"Files & code",icon:Oa,tools:[{name:"read",title:"Read File",description:"Read a file from the workspace",icon:Wc},{name:"write",title:"Write File",description:"Create or overwrite a file",icon:Wo},{name:"edit",title:"Edit File",description:"Make targeted edits to an existing file",icon:wf},{name:"grep",title:"Search Content",description:"Search file contents by pattern",icon:Fo},{name:"glob",title:"Find Files",description:"Find files by name pattern",icon:Oa},{name:"bash",title:"Run Command",description:"Run shell commands in the sandbox",icon:Cf}]},{key:"context",heading:"Context",icon:Ba,tools:[{name:"read_resource",title:"Read Resource",description:"Read an MCP resource by URI",icon:Ba},{name:"read_prompt",title:"Read Prompt",description:"Read an MCP prompt definition",icon:Qc}]},{key:"browser",heading:"Browser",icon:Hs,tools:[{name:"take_screenshot",title:"Take Screenshot",description:"Capture a screenshot of a web page",icon:Fc},{name:"scrape_url",title:"Scrape URL",description:"Fetch and extract content from a URL",icon:Hs},{name:"inspect_page",title:"Inspect Page",description:"Inspect a web page's structure",icon:Io}]}],bx=od.flatMap(t=>t.tools.map(e=>e.name));function yx(t){const e=t.replace(/[_-]+/g," ").trim();return e?e.toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()):t}function Sx(t){const e=H.c(5),{agentId:s,value:i,onChange:r}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Tools"}),e[0]=o):o=e[0];let a;return e[1]!==s||e[2]!==r||e[3]!==i?(a=n.jsxs("div",{className:"flex flex-col gap-2",children:[o,s?n.jsx(R.Suspense,{fallback:n.jsxs(se,{variant:"outline",size:"sm",disabled:!0,className:"w-fit",children:[n.jsx(Uo,{size:14}),"Loading tools…"]}),children:n.jsx(wx,{agentId:s,value:i,onChange:r})}):n.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Pick an agent first"})]}),e[1]=s,e[2]=r,e[3]=i,e[4]=a):a=e[4],a}function pl(t){const e=H.c(17),{value:s,checked:i,onToggle:r,title:o,description:a,leading:l}=t;let h;e[0]!==i?(h=n.jsx(Qr,{checked:i,className:"pointer-events-none mt-0.5"}),e[0]=i,e[1]=h):h=e[1];let c;e[2]!==l?(c=l&&n.jsx("span",{className:"mt-px shrink-0",children:l}),e[2]=l,e[3]=c):c=e[3];let d;e[4]!==o?(d=n.jsx("span",{className:"truncate text-sm leading-tight",children:o}),e[4]=o,e[5]=d):d=e[5];let u;e[6]!==a?(u=a&&n.jsx("span",{className:"line-clamp-2 text-xs leading-snug text-muted-foreground",children:a}),e[6]=a,e[7]=u):u=e[7];let f;e[8]!==d||e[9]!==u?(f=n.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[d,u]}),e[8]=d,e[9]=u,e[10]=f):f=e[10];let m;return e[11]!==r||e[12]!==h||e[13]!==c||e[14]!==f||e[15]!==s?(m=n.jsxs($m,{value:s,onSelect:r,className:"items-start gap-2.5 py-2",children:[h,c,f]}),e[11]=r,e[12]=h,e[13]=c,e[14]=f,e[15]=s,e[16]=m):m=e[16],m}function _l(t){const e=H.c(20),{conn:s,label:i,icon:r,on:o,total:a,onToggle:l}=t,h=o===a;let c;e[0]!==r||e[1]!==s?(c=s?n.jsx(Vt,{icon:s.icon,name:s.title,size:"2xs"}):r?n.jsx(r,{size:14,className:"text-muted-foreground"}):n.jsx(jf,{size:14,className:"text-muted-foreground"}),e[0]=r,e[1]=s,e[2]=c):c=e[2];const d=s?.title??i??"Other tools";let u;e[3]!==d?(u=n.jsx("span",{className:"truncate",children:d}),e[3]=d,e[4]=u):u=e[4];let f;e[5]!==o||e[6]!==a?(f=n.jsxs("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/70",children:[o,"/",a]}),e[5]=o,e[6]=a,e[7]=f):f=e[7];let m;e[8]!==l?(m=y=>{y.stopPropagation(),l()},e[8]=l,e[9]=m):m=e[9];const p=h?"None":"All";let _;e[10]!==m||e[11]!==p?(_=n.jsx("button",{type:"button",onClick:m,className:"text-[11px] font-medium text-primary hover:underline",children:p}),e[10]=m,e[11]=p,e[12]=_):_=e[12];let v;e[13]!==f||e[14]!==_?(v=n.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[f,_]}),e[13]=f,e[14]=_,e[15]=v):v=e[15];let x;return e[16]!==c||e[17]!==u||e[18]!==v?(x=n.jsxs("div",{className:"flex items-center gap-2",children:[c,u,v]}),e[16]=c,e[17]=u,e[18]=v,e[19]=x):x=e[19],x}function wx(t){const e=H.c(70),{agentId:s,value:i,onChange:r}=t,{org:o}=Ne(),[a,l]=R.useState(!1);let h;e[0]!==s||e[1]!==o.id||e[2]!==o.slug?(h={connectionId:s,orgId:o.id,orgSlug:o.slug},e[0]=s,e[1]=o.id,e[2]=o.slug,e[3]=h):h=e[3];const c=tt(h);let d;e[4]!==c?(d={client:c},e[4]=c,e[5]=d):d=e[5];const{data:u,isLoading:f}=Kf(d),m=Hi();let p,_,v,x,y,g,b,S,w,k,N,D,I;if(e[6]!==m||e[7]!==u?.tools||e[8]!==f||e[9]!==r||e[10]!==a||e[11]!==i){const E=new Map(m.map(Ex)),T=new Map;for(const he of u?.tools??[]){const ie=Vu(he._meta)??"__other__",ve=qu(he.name,ie==="__other__"?void 0:ie),re=he.title,ke=re&&re!==he.name?re:yx(ve);T.has(ie)||T.set(ie,{clientId:ie,conn:E.get(ie),tools:[]}),T.get(ie).tools.push({name:he.name,display:ke,description:he.description})}const M=[...T.values()].sort(Nx),B=(u?.tools??[]).map(jx),O=[...bx,...B],F=i===null?new Set(O):new Set(i),W=O.every(he=>F.has(he)),$=he=>r(O.every(ie=>he.has(ie))?null:[...he]),U=he=>{const ie=new Set(F);ie.has(he)?ie.delete(he):ie.add(he),$(ie)},Y=(he,ie)=>{const ve=new Set(F);for(const re of he)ie?ve.add(re):ve.delete(re);$(ve)};x=Ns,I=a,y=l;let V;e[25]===Symbol.for("react.memo_cache_sentinel")?(V=n.jsx(Uo,{size:14,className:"text-muted-foreground"}),e[25]=V):V=e[25];const K=W?"All tools":"Tools",q=!W&&n.jsxs(Im,{variant:"secondary",className:"ml-0.5 h-5 px-1.5 text-[11px] tabular-nums",children:[F.size,"/",O.length]});let Q;e[26]===Symbol.for("react.memo_cache_sentinel")?(Q=n.jsx(js,{size:14,className:"text-muted-foreground"}),e[26]=Q):Q=e[26],e[27]!==K||e[28]!==q?(g=n.jsx(Es,{asChild:!0,children:n.jsxs(se,{variant:"outline",size:"sm",className:"w-fit gap-1.5",children:[V,K,q,Q]})}),e[27]=K,e[28]=q,e[29]=g):g=e[29],v=Ts,N="p-0 w-80",D="start",_=Mm,e[30]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(Lm,{placeholder:"Search tools..."}),e[30]=w):w=e[30];const oe=W?`All ${O.length} tools enabled`:`${F.size} of ${O.length} enabled`;let L;e[31]!==oe?(L=n.jsx("span",{className:"text-xs text-muted-foreground",children:oe}),e[31]=oe,e[32]=L):L=e[32];let ee;e[33]!==r?(ee=()=>r(null),e[33]=r,e[34]=ee):ee=e[34];let te;e[35]!==W||e[36]!==ee?(te=n.jsx("button",{type:"button",onClick:ee,disabled:W,className:"text-xs font-medium text-primary hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:"Select all"}),e[35]=W,e[36]=ee,e[37]=te):te=e[37];let G;e[38]===Symbol.for("react.memo_cache_sentinel")?(G=n.jsx("span",{className:"text-muted-foreground/30",children:"·"}),e[38]=G):G=e[38];let z;e[39]!==r?(z=()=>r([]),e[39]=r,e[40]=z):z=e[40];const le=F.size===0;let ue;e[41]!==z||e[42]!==le?(ue=n.jsx("button",{type:"button",onClick:z,disabled:le,className:"text-xs font-medium text-muted-foreground hover:underline disabled:cursor-default disabled:opacity-40 disabled:no-underline",children:"Clear"}),e[41]=z,e[42]=le,e[43]=ue):ue=e[43];let me;e[44]!==te||e[45]!==ue?(me=n.jsxs("div",{className:"flex items-center gap-2",children:[te,G,ue]}),e[44]=te,e[45]=ue,e[46]=me):me=e[46],e[47]!==L||e[48]!==me?(k=n.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[L,me]}),e[47]=L,e[48]=me,e[49]=k):k=e[49],p=Om,b="max-h-80",S=f?n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"Loading tools…"}):n.jsxs(n.Fragment,{children:[n.jsx(Bm,{children:"No tools found"}),od.map(he=>{const ie=he.tools.map(kx),ve=ie.filter(re=>F.has(re)).length;return n.jsx($a,{heading:n.jsx(_l,{label:he.heading,icon:he.icon,on:ve,total:ie.length,onToggle:()=>Y(ie,ve!==ie.length)}),children:he.tools.map(re=>n.jsx(pl,{value:`${re.title} ${re.name}`,checked:F.has(re.name),onToggle:()=>U(re.name),title:re.title,description:re.description,leading:n.jsx(re.icon,{size:16,className:"text-muted-foreground"})},re.name))},he.key)}),M.map(he=>{const ie=he.tools.map(Cx),ve=ie.filter(re=>F.has(re)).length;return n.jsx($a,{heading:n.jsx(_l,{conn:he.conn,on:ve,total:ie.length,onToggle:()=>Y(ie,ve!==ie.length)}),children:he.tools.map(re=>n.jsx(pl,{value:`${re.display} ${re.name} ${he.conn?.title??""}`,checked:F.has(re.name),onToggle:()=>U(re.name),title:re.display,description:re.description},re.name))},he.clientId)})]}),e[6]=m,e[7]=u?.tools,e[8]=f,e[9]=r,e[10]=a,e[11]=i,e[12]=p,e[13]=_,e[14]=v,e[15]=x,e[16]=y,e[17]=g,e[18]=b,e[19]=S,e[20]=w,e[21]=k,e[22]=N,e[23]=D,e[24]=I}else p=e[12],_=e[13],v=e[14],x=e[15],y=e[16],g=e[17],b=e[18],S=e[19],w=e[20],k=e[21],N=e[22],D=e[23],I=e[24];let P;e[50]!==p||e[51]!==b||e[52]!==S?(P=n.jsx(p,{className:b,children:S}),e[50]=p,e[51]=b,e[52]=S,e[53]=P):P=e[53];let j;e[54]!==_||e[55]!==P||e[56]!==w||e[57]!==k?(j=n.jsxs(_,{children:[w,k,P]}),e[54]=_,e[55]=P,e[56]=w,e[57]=k,e[58]=j):j=e[58];let C;e[59]!==v||e[60]!==j||e[61]!==N||e[62]!==D?(C=n.jsx(v,{className:N,align:D,children:j}),e[59]=v,e[60]=j,e[61]=N,e[62]=D,e[63]=C):C=e[63];let A;return e[64]!==x||e[65]!==y||e[66]!==g||e[67]!==C||e[68]!==I?(A=n.jsxs(x,{open:I,onOpenChange:y,children:[g,C]}),e[64]=x,e[65]=y,e[66]=g,e[67]=C,e[68]=I,e[69]=A):A=e[69],A}function Cx(t){return t.name}function kx(t){return t.name}function jx(t){return t.name}function Nx(t,e){return(t.conn?.title??t.clientId).localeCompare(e.conn?.title??e.clientId)}function Ex(t){return[t.id,t]}function Ri(t){const e=t.trim().split(/\s+/);return e.length!==5?!1:e.every(s=>/^[\d*/,-]+$/.test(s))}function Tx(t){if(!t)return"Unknown schedule";const e=t.trim();if(e==="* * * * *")return"Every minute";if(e==="0 * * * *")return"Every hour";if(e==="0 0 * * *")return"Every day";if(e==="0 0 * * 1")return"Every week";const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return`Every ${s[1]} minutes`;const i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return`Every ${i[1]} hours`;const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const l=parseInt(r[1]??"1");return l%7===0?`Every ${l/7} weeks`:`Every ${l} days`}const o=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);if(o){const l=(o[2]??"0").padStart(2,"0"),h=(o[1]??"0").padStart(2,"0");return`Every day at ${l}:${h} UTC`}const a=e.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+(\d)$/);if(a){const h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][parseInt(a[3]??"0")]??"day",c=(a[2]??"0").padStart(2,"0"),d=(a[1]??"0").padStart(2,"0");return`Every ${h} at ${c}:${d} UTC`}return t}function Rx(t,e){const s=Math.max(1,t);switch(e){case"minutes":return s===1?"* * * * *":`*/${s} * * * *`;case"hours":return s===1?"0 * * * *":`0 */${s} * * *`;case"days":return s===1?"0 0 * * *":`0 0 */${s} * *`;case"weeks":return s===1?"0 0 * * 1":`0 0 */${s*7} * *`}}function Px(t){const e=t.trim();if(e==="* * * * *")return{count:1,unit:"minutes"};if(e==="0 * * * *")return{count:1,unit:"hours"};if(e==="0 0 * * *")return{count:1,unit:"days"};if(e==="0 0 * * 1")return{count:1,unit:"weeks"};const s=e.match(/^\*\/(\d+)\s+\*\s+\*\s+\*\s+\*$/);if(s)return{count:parseInt(s[1]),unit:"minutes"};const i=e.match(/^0\s+\*\/(\d+)\s+\*\s+\*\s+\*$/);if(i)return{count:parseInt(i[1]),unit:"hours"};const r=e.match(/^0\s+0\s+\*\/(\d+)\s+\*\s+\*$/);if(r){const o=parseInt(r[1]);return o%7===0?{count:o/7,unit:"weeks"}:{count:o,unit:"days"}}return null}function Dx(t,e){return e===1?{minutes:"minute",hours:"hour",days:"day",weeks:"week"}[t]??t:t}const Ax=[{label:"5 minutes",cron:"*/5 * * * *"},{label:"Hour",cron:"0 * * * *"},{label:"Day",cron:"0 0 * * *"},{label:"Week",cron:"0 0 * * 1"}];function Ix({automationId:t,open:e,onOpenChange:s,onCustomSelect:i,onEventSelect:r,onWebhookCreated:o}){const{triggerAdd:a}=Ui(),[l,h]=R.useState(!1),c=e??l,d=m=>{s?s(m):h(m)},u=async m=>{try{await a.mutateAsync({automation_id:t,type:"cron",cron_expression:m}),ae.success("Starter added"),d(!1)}catch(p){const _=p instanceof Error?p.message:"Failed to add starter";ae.error(_)}},f=async()=>{try{const m=await a.mutateAsync({automation_id:t,type:"webhook"});d(!1),m.webhook?o?.(m.webhook):ae.success("Webhook starter added")}catch(m){const p=m instanceof Error?m.message:"Failed to add webhook starter";ae.error(p)}};return n.jsxs(Js,{open:c,onOpenChange:d,children:[n.jsx(Zs,{asChild:!0,children:n.jsxs(se,{variant:"outline",size:"sm",children:[n.jsx(At,{size:14}),"Add Starter"]})}),n.jsxs(Qs,{align:"end",className:"w-[200px]",children:[n.jsxs(sm,{children:[n.jsxs(im,{className:"gap-2.5",children:[n.jsx(Ci,{size:14,className:"text-muted-foreground shrink-0"}),"Every..."]}),n.jsx(rm,{className:"w-[160px]",children:Ax.map(m=>n.jsxs(et,{className:"gap-2.5",onSelect:()=>u(m.cron),disabled:a.isPending,children:[n.jsx(Ci,{size:14,className:"text-muted-foreground shrink-0"}),"Every ",m.label]},m.cron))})]}),n.jsxs(et,{className:"gap-2.5",onSelect:()=>{d(!1),i?.()},children:[n.jsx(Ci,{size:14,className:"text-muted-foreground shrink-0"}),"Custom (cron)"]}),n.jsxs(et,{className:"gap-2.5",onSelect:()=>{d(!1),r?.()},children:[n.jsx(Bi,{size:14,className:"text-muted-foreground shrink-0"}),"Event"]}),n.jsxs(et,{className:"gap-2.5",onSelect:()=>{f()},disabled:a.isPending,children:[n.jsx(Fi,{size:14,className:"text-muted-foreground shrink-0"}),"Webhook"]})]})]})}function ad(t){const e=H.c(31),{open:s,onOpenChange:i,url:r,token:o,title:a,description:l}=t,h=a===void 0?"Webhook ready":a,c=l===void 0?"Send a POST to this URL with the bearer token to fire the automation. The token is shown once — copy it now.":l,[d,u]=R.useState(null),[f,m]=R.useState("curl"),[p,_]=R.useState("header"),v=R.useId();let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=async(E,T)=>{try{await navigator.clipboard.writeText(E),u(T),ae.success("Copied"),setTimeout(()=>u(null),1500)}catch{ae.error("Failed to copy")}},e[0]=x):x=e[0];const y=x;let g;e[1]!==p||e[2]!==o||e[3]!==r?(g=r&&o&&p==="url"?`${r.replace(/\/$/,"")}/${o}`:r??"",e[1]=p,e[2]=o,e[3]=r,e[4]=g):g=e[4];const b=g,S=r&&o?p==="header"?`curl -X POST "${b}" \\
|
|
275
275
|
-H "Authorization: Bearer ${o}" \\
|
|
276
276
|
-H "Content-Type: application/json" \\
|
|
277
277
|
-d '{"hello":"world"}'`:`curl -X POST "${b}" \\
|
|
@@ -290,7 +290,7 @@ ${ee}`:ee;c.setValue("metadata.instructions",te,{shouldDirty:!0})},V=new Set(d.m
|
|
|
290
290
|
},
|
|
291
291
|
body: JSON.stringify({ hello: "world" }),
|
|
292
292
|
});`:"",k=f==="curl"?S:w;let N;e[5]!==h?(N=n.jsx(ss,{children:h}),e[5]=h,e[6]=N):N=e[6];let D;e[7]!==c?(D=n.jsx(Oo,{children:c}),e[7]=c,e[8]=D):D=e[8];let I;e[9]!==N||e[10]!==D?(I=n.jsxs(ts,{children:[N,D]}),e[9]=N,e[10]=D,e[11]=I):I=e[11];let P;e[12]!==p||e[13]!==d||e[14]!==b||e[15]!==f||e[16]!==k||e[17]!==o||e[18]!==v||e[19]!==r?(P=r&&o?n.jsxs("div",{className:"flex flex-col gap-3 min-w-0",children:[n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"URL"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:b}),n.jsxs(se,{size:"sm",variant:"outline",onClick:()=>y(b,"url"),children:[n.jsx(ds,{size:13}),d==="url"?"Copied":"Copy"]})]})]}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"Token (shown once)"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"flex-1 min-w-0 text-xs font-mono bg-muted rounded-md px-2 py-1.5 truncate",children:o}),n.jsxs(se,{size:"sm",variant:"outline",onClick:()=>y(o,"token"),children:[n.jsx(ds,{size:13}),d==="token"?"Copied":"Copy"]})]})]}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"Snippet"}),n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(zo,{value:f,onValueChange:E=>m(E),children:n.jsxs($o,{className:"h-8 p-[2px]",children:[n.jsx(xs,{value:"curl",className:"h-7 px-2.5 text-xs",children:"curl"}),n.jsx(xs,{value:"fetch",className:"h-7 px-2.5 text-xs",children:"fetch"})]})}),n.jsxs("label",{htmlFor:v,className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer select-none",children:[n.jsx(Qr,{id:v,checked:p==="url",onCheckedChange:E=>_(E?"url":"header")}),"Token in URL"]})]}),n.jsxs(se,{size:"sm",variant:"outline",onClick:()=>y(k,"example"),children:[n.jsx(ds,{size:13}),d==="example"?"Copied":"Copy"]})]}),n.jsx("div",{className:"rounded-md border overflow-hidden min-w-0",children:n.jsx(Km,{code:k,language:f==="curl"?"shell":"typescript",readOnly:!0,disableDiagnostics:!0,height:180})})]})]}):null,e[12]=p,e[13]=d,e[14]=b,e[15]=f,e[16]=k,e[17]=o,e[18]=v,e[19]=r,e[20]=P):P=e[20];let j;e[21]!==i?(j=n.jsx(ei,{children:n.jsx(se,{onClick:()=>i(!1),children:"Done"})}),e[21]=i,e[22]=j):j=e[22];let C;e[23]!==I||e[24]!==P||e[25]!==j?(C=n.jsxs(Mt,{className:"max-w-lg",children:[I,P,j]}),e[23]=I,e[24]=P,e[25]=j,e[26]=C):C=e[26];let A;return e[27]!==i||e[28]!==s||e[29]!==C?(A=n.jsx(Bt,{open:s,onOpenChange:i,children:C}),e[27]=i,e[28]=s,e[29]=C,e[30]=A):A=e[30],A}function Bx(t){const e=H.c(83),{trigger:s,automationId:i,connectionName:r}=t,{triggerAdd:o,triggerRemove:a,triggerRotateToken:l}=Ui(),[h,c]=R.useState(!1),[d,u]=R.useState(!1),[f,m]=R.useState(null);let p;e[0]!==s.cron_expression?(p=s.cron_expression?Px(s.cron_expression):null,e[0]=s.cron_expression,e[1]=p):p=e[1];const _=p,[v,x]=R.useState(_?.count??1),[y,g]=R.useState(!1),[b,S]=R.useState(s.cron_expression??""),w=a.isPending||o.isPending||l.isPending,k=s.type==="cron",N=s.type==="webhook";let D;e[2]!==i||e[3]!==a||e[4]!==s.id?(D=async()=>{try{await a.mutateAsync({trigger_id:s.id,automation_id:i}),ae.success("Starter removed")}catch{ae.error("Failed to remove starter")}c(!1)},e[2]=i,e[3]=a,e[4]=s.id,e[5]=D):D=e[5];const I=D;let P;e[6]!==o||e[7]!==i||e[8]!==b||e[9]!==a||e[10]!==s.cron_expression||e[11]!==s.id?(P=async()=>{const ie=b.trim();if(!ie||!Ri(ie)||ie===s.cron_expression){g(!1),S(s.cron_expression??"");return}try{await o.mutateAsync({automation_id:i,type:"cron",cron_expression:ie}),await a.mutateAsync({trigger_id:s.id,automation_id:i}),g(!1)}catch{ae.error("Failed to update starter"),S(s.cron_expression??""),g(!1)}},e[6]=o,e[7]=i,e[8]=b,e[9]=a,e[10]=s.cron_expression,e[11]=s.id,e[12]=P):P=e[12];const j=P;let C;e[13]!==i||e[14]!==l||e[15]!==s.id?(C=async()=>{u(!1);try{const ie=await l.mutateAsync({trigger_id:s.id,automation_id:i});m({url:ie.url,token:ie.token})}catch(ie){const ve=ie,re=ve instanceof Error?ve.message:"Failed to rotate token";ae.error(re)}},e[13]=i,e[14]=l,e[15]=s.id,e[16]=C):C=e[16];const A=C;let E;e[17]!==o||e[18]!==i||e[19]!==_||e[20]!==a||e[21]!==s.cron_expression||e[22]!==s.id?(E=async ie=>{if(!_)return;const ve=_.unit==="minutes"?5:1,re=Math.max(ve,ie);re!==ie&&x(re);const ke=Rx(re,_.unit);if(ke!==s.cron_expression)try{await o.mutateAsync({automation_id:i,type:"cron",cron_expression:ke}),await a.mutateAsync({trigger_id:s.id,automation_id:i})}catch{ae.error("Failed to update starter"),x(_.count)}},e[17]=o,e[18]=i,e[19]=_,e[20]=a,e[21]=s.cron_expression,e[22]=s.id,e[23]=E):E=e[23];const T=E;let M;e[24]!==k||e[25]!==N?(M=k?n.jsx(Ci,{size:14,className:"text-muted-foreground shrink-0"}):N?n.jsx(Fi,{size:14,className:"text-muted-foreground shrink-0"}):n.jsx(Bi,{size:14,className:"text-muted-foreground shrink-0"}),e[24]=k,e[25]=N,e[26]=M):M=e[26];let B;e[27]!==r||e[28]!==v||e[29]!==b||e[30]!==T||e[31]!==j||e[32]!==_||e[33]!==k||e[34]!==y||e[35]!==w||e[36]!==N||e[37]!==s.cron_expression||e[38]!==s.event_type||e[39]!==s.params?(B=_&&k?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-sm text-muted-foreground",children:"Every"}),n.jsx("input",{type:"number",min:_.unit==="minutes"?5:1,value:v,onChange:ie=>x(parseInt(ie.target.value)||1),onBlur:()=>T(v),onKeyDown:ie=>{ie.key==="Enter"&&ie.target.blur(),ie.key==="Escape"&&x(_.count)},disabled:w,className:"w-12 text-center text-sm h-7 border border-border rounded-md bg-background px-1 focus:outline-none focus:ring-1 focus:ring-ring"}),n.jsx("span",{className:"text-sm",children:Dx(_.unit,v)})]}):k&&y?n.jsxs(n.Fragment,{children:[n.jsx("input",{type:"text",value:b,onChange:ie=>S(ie.target.value),onBlur:j,onKeyDown:ie=>{ie.key==="Enter"&&ie.target.blur(),ie.key==="Escape"&&(g(!1),S(s.cron_expression??""))},className:"flex-1 text-sm font-mono bg-transparent outline-none",autoFocus:!0}),b&&!Ri(b)&&n.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"})]}):n.jsxs("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[n.jsx("span",{className:"text-sm font-mono text-xs text-muted-foreground truncate",children:k?Tx(s.cron_expression??""):N?"Webhook · POST to fire":`${s.event_type}${r?` · ${r}`:""}`}),!k&&!N&&s.params&&Object.keys(s.params).length>0&&n.jsx("span",{className:"text-xs text-muted-foreground/60 truncate",children:Object.entries(s.params).map(Mx).join(", ")})]}),e[27]=r,e[28]=v,e[29]=b,e[30]=T,e[31]=j,e[32]=_,e[33]=k,e[34]=y,e[35]=w,e[36]=N,e[37]=s.cron_expression,e[38]=s.event_type,e[39]=s.params,e[40]=B):B=e[40];let O;e[41]!==w?(O=w&&n.jsx(we,{size:13,className:"animate-spin text-muted-foreground"}),e[41]=w,e[42]=O):O=e[42];let F;e[43]!==_||e[44]!==k||e[45]!==y||e[46]!==s.cron_expression?(F=k&&!_&&!y&&n.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{S(s.cron_expression??""),g(!0)},children:n.jsx(Wo,{size:13,className:"text-muted-foreground"})}),e[43]=_,e[44]=k,e[45]=y,e[46]=s.cron_expression,e[47]=F):F=e[47];let W;e[48]!==N?(W=N&&n.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",title:"Rotate token",onClick:()=>u(!0),children:n.jsx(Di,{size:13,className:"text-muted-foreground"})}),e[48]=N,e[49]=W):W=e[49];let $;e[50]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>c(!0),children:n.jsx(fs,{size:13,className:"text-muted-foreground"})}),e[50]=$):$=e[50];let U;e[51]!==W||e[52]!==O||e[53]!==F?(U=n.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[O,F,W,$]}),e[51]=W,e[52]=O,e[53]=F,e[54]=U):U=e[54];let Y;e[55]!==U||e[56]!==M||e[57]!==B?(Y=n.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[M,B,U]}),e[55]=U,e[56]=M,e[57]=B,e[58]=Y):Y=e[58];let V;e[59]===Symbol.for("react.memo_cache_sentinel")?(V=n.jsxs(Nr,{children:[n.jsx(Er,{children:"Remove Starter"}),n.jsx(Tr,{children:"Are you sure you want to remove this starter?"})]}),e[59]=V):V=e[59];let K;e[60]===Symbol.for("react.memo_cache_sentinel")?(K=n.jsx(Pr,{children:"Cancel"}),e[60]=K):K=e[60];let q;e[61]!==I?(q=n.jsxs(jr,{children:[V,n.jsxs(Rr,{children:[K,n.jsx(Dr,{onClick:I,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]}),e[61]=I,e[62]=q):q=e[62];let Q;e[63]!==h||e[64]!==q?(Q=n.jsx(kr,{open:h,onOpenChange:c,children:q}),e[63]=h,e[64]=q,e[65]=Q):Q=e[65];let oe;e[66]===Symbol.for("react.memo_cache_sentinel")?(oe=n.jsxs(Nr,{children:[n.jsx(Er,{children:"Rotate webhook token"}),n.jsx(Tr,{children:"A new token will be generated and the current token will stop working. Any senders using the old token must be updated."})]}),e[66]=oe):oe=e[66];let L;e[67]===Symbol.for("react.memo_cache_sentinel")?(L=n.jsx(Pr,{children:"Cancel"}),e[67]=L):L=e[67];let ee;e[68]!==A?(ee=n.jsxs(jr,{children:[oe,n.jsxs(Rr,{children:[L,n.jsx(Dr,{onClick:A,children:"Rotate"})]})]}),e[68]=A,e[69]=ee):ee=e[69];let te;e[70]!==d||e[71]!==ee?(te=n.jsx(kr,{open:d,onOpenChange:u,children:ee}),e[70]=d,e[71]=ee,e[72]=te):te=e[72];const G=f!==null;let z;e[73]===Symbol.for("react.memo_cache_sentinel")?(z=ie=>{ie||m(null)},e[73]=z):z=e[73];const le=f?.url??null,ue=f?.token??null;let me;e[74]!==G||e[75]!==le||e[76]!==ue?(me=n.jsx(ad,{open:G,onOpenChange:z,url:le,token:ue,title:"New webhook token",description:"The previous token has been revoked. Copy the new token now — it will not be shown again."}),e[74]=G,e[75]=le,e[76]=ue,e[77]=me):me=e[77];let he;return e[78]!==Y||e[79]!==Q||e[80]!==te||e[81]!==me?(he=n.jsxs(n.Fragment,{children:[Y,Q,te,me]}),e[78]=Y,e[79]=Q,e[80]=te,e[81]=me,e[82]=he):he=e[82],he}function Mx(t){const[e,s]=t;return`${e}: ${s}`}const Lx=30;function Ox(t,e){switch(e.type){case"accumulate":{const s=t??{start:e.now,fields:new Set,saveCount:0},i=new Set(s.fields);for(const r of e.fields)i.add(r);return{...s,fields:i,saveCount:s.saveCount+1}}case"reset":return null}}function $x(t){const e=H.c(55),{automationId:s,onDone:i}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={binding:"TRIGGER"},e[0]=r):r=e[0];const o=Hi(r),[a,l]=R.useState(),[h,c]=R.useState();let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d={},e[1]=d):d=e[1];const[u,f]=R.useState(d),{triggerAdd:m}=Ui(),{data:p,isLoading:_}=Fm(a);let v,x,y,g,b,S;if(e[2]!==m||e[3]!==s||e[4]!==a||e[5]!==h||e[6]!==_||e[7]!==i||e[8]!==u||e[9]!==o||e[10]!==p){const N=p?.find(B=>B.type===h);let D;e[17]!==m||e[18]!==s||e[19]!==a||e[20]!==h||e[21]!==i||e[22]!==u?(D=async()=>{if(!(!a||!h))try{await m.mutateAsync({automation_id:s,type:"event",event_type:h,connection_id:a,params:u}),Le("automation_trigger_added",{automation_id:s,trigger_type:"event",connection_id:a,event_type:h}),ae.success("Event trigger added"),i()}catch{ae.error("Failed to add event trigger")}},e[17]=m,e[18]=s,e[19]=a,e[20]=h,e[21]=i,e[22]=u,e[23]=D):D=e[23],v=D,x="flex flex-col gap-3 px-3 py-3 rounded-lg border border-border bg-background";let I,P;e[24]===Symbol.for("react.memo_cache_sentinel")?(P=n.jsx(Bi,{size:14,className:"text-muted-foreground shrink-0"}),I=n.jsx("span",{className:"text-sm font-medium",children:"Event trigger"}),e[24]=I,e[25]=P):(I=e[24],P=e[25]);let j;e[26]===Symbol.for("react.memo_cache_sentinel")?(j=n.jsx(fs,{size:13}),e[26]=j):j=e[26],e[27]!==i?(y=n.jsxs("div",{className:"flex items-center gap-2",children:[P,I,n.jsx("button",{type:"button",className:"ml-auto shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground",onClick:i,children:j})]}),e[27]=i,e[28]=y):y=e[28];const C=a??"";let A;e[29]===Symbol.for("react.memo_cache_sentinel")?(A=B=>{l(B),c(void 0),f({})},e[29]=A):A=e[29];let E;e[30]===Symbol.for("react.memo_cache_sentinel")?(E=n.jsx(Et,{className:"w-full",children:n.jsx(Tt,{placeholder:"Select connection..."})}),e[30]=E):E=e[30];let T;e[31]!==o?(T=o.length===0?n.jsx("div",{className:"px-2 py-3 text-center text-xs text-muted-foreground",children:"No connections with trigger support"}):o.map(Hx),e[31]=o,e[32]=T):T=e[32];let M;e[33]!==T?(M=n.jsx(Rt,{children:T}),e[33]=T,e[34]=M):M=e[34],e[35]!==C||e[36]!==M?(g=n.jsxs(Pt,{value:C,onValueChange:A,children:[E,M]}),e[35]=C,e[36]=M,e[37]=g):g=e[37],e[38]!==a||e[39]!==h||e[40]!==_||e[41]!==p?(b=a&&n.jsxs(Pt,{value:h??"",onValueChange:B=>{c(B),f({})},children:[n.jsx(Et,{className:"w-full",children:_?n.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[n.jsx(we,{size:13,className:"animate-spin"}),"Loading events..."]}):n.jsx(Tt,{placeholder:"Select event type...",children:h??"Select event type..."})}),n.jsx(Rt,{children:p?.map(Fx)})]}),e[38]=a,e[39]=h,e[40]=_,e[41]=p,e[42]=b):b=e[42],S=N?.paramsSchema&&Object.keys(N.paramsSchema).length>0&&n.jsx("div",{className:"flex flex-col gap-2",children:Object.entries(N.paramsSchema).map(B=>{const[O,F]=B;return n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsxs("label",{className:"text-xs text-muted-foreground",children:[O,F.description&&n.jsxs("span",{className:"text-muted-foreground/60",children:[" ","— ",F.description]})]}),F.enum?n.jsxs(Pt,{value:u[O]??"",onValueChange:W=>f($=>({...$,[O]:W})),children:[n.jsx(Et,{className:"w-full",children:n.jsx(Tt,{placeholder:`Select ${O}...`})}),n.jsx(Rt,{children:F.enum.map(zx)})]}):n.jsx("input",{type:"text",value:u[O]??"",onChange:W=>f($=>({...$,[O]:W.target.value})),placeholder:F.description??O,className:"text-sm border border-border rounded-md bg-background px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-ring"})]},O)})}),e[2]=m,e[3]=s,e[4]=a,e[5]=h,e[6]=_,e[7]=i,e[8]=u,e[9]=o,e[10]=p,e[11]=v,e[12]=x,e[13]=y,e[14]=g,e[15]=b,e[16]=S}else v=e[11],x=e[12],y=e[13],g=e[14],b=e[15],S=e[16];let w;e[43]!==m||e[44]!==a||e[45]!==h||e[46]!==v?(w=a&&h&&n.jsx(se,{size:"sm",onClick:v,disabled:m.isPending,children:m.isPending?n.jsx(we,{size:13,className:"animate-spin"}):"Add trigger"}),e[43]=m,e[44]=a,e[45]=h,e[46]=v,e[47]=w):w=e[47];let k;return e[48]!==x||e[49]!==y||e[50]!==g||e[51]!==b||e[52]!==S||e[53]!==w?(k=n.jsxs("div",{className:x,children:[y,g,b,S,w]}),e[48]=x,e[49]=y,e[50]=g,e[51]=b,e[52]=S,e[53]=w,e[54]=k):k=e[54],k}function zx(t){return n.jsx(lt,{value:t,children:t},t)}function Fx(t){return n.jsx(lt,{value:t.type,children:n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:t.type}),n.jsx("span",{className:"text-xs text-muted-foreground",children:t.description})]})},t.type)}function Hx(t){return n.jsx(lt,{value:t.id,children:t.title},t.id)}function Wx({automationId:t,automation:e,onBack:s,onDelete:i}){const r=e.virtual_mcp_id,{org:o}=Ne(),{update:a,triggerAdd:l,run:h}=Ui(),c=Hi(),d=new Map(c.map(z=>[z.id,z.title])),{openTask:u}=es(),{setChatOpen:f}=Po(),{sendMessage:m}=ks(),p=e.messages?.[0]?.metadata?.tiptapDoc??void 0,[_,v]=R.useState(p),[x,y]=R.useState(!1),[g,b]=R.useState(!1),[S,w]=R.useState(!1),[k,N]=R.useState(""),[D,I]=R.useState(!1),[P,j]=R.useState(null),[C,A]=R.useState(!1),[E,T]=R.useState(!1),[M,B]=R.useState(!1),O=async()=>{if(C)return;const le=Ou(_).filter(ue=>ue.type==="text").map(ue=>ue.text).join(`
|
|
293
|
-
`);if(le.trim()){A(!0);try{ee(),Le("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:le.length}),f(!0),await m({tiptapDoc:Th({managerAgentId:wc.AUTOMATION_MANAGER(o.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:le})})}finally{A(!1)}}},F=e.models?.tier??"smart",W=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,$=yc({defaultValues:{name:e.name,active:e.active,tier:F,modelOverride:W,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),U=$.watch("active"),[Y,V]=R.useReducer(Ox,null),K=()=>{Y!==null&&(Le("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(Y.fields),save_count:Y.saveCount,edit_duration_ms:Date.now()-Y.start}),V({type:"reset"}))},q=async()=>{const z=$.control._formState.dirtyFields,le=Object.keys(z);if(le.length===0&&!M)return!0;const ue=$.getValues(),me=$.control._defaultValues;$.reset(ue,{keepValues:!0});const he=M;B(!1);const ie={tier:ue.tier,...ue.modelOverride?{modelId:ue.modelOverride.modelId,credentialId:ue.modelOverride.credentialId,modelTitle:ue.modelOverride.title}:{}},ve={id:t,name:ue.name,active:ue.active,models:ie,tools:ue.tools,maxAgentSteps:ue.maxAgentSteps,messages:Lu(_),temperature:0};try{await a.mutateAsync(ve)}catch{return $.reset(me,{keepValues:!0}),he&&B(!0),!1}const re=[...le];return he&&re.push("messages"),V({type:"accumulate",now:Date.now(),fields:re}),L(),!0},{schedule:Q,flush:oe}=Ir({save:q}),{schedule:L,flush:ee}=Ir({delayMs:3e4,save:async()=>K()});R.useEffect(()=>{const z=$.watch(()=>Q());return()=>z.unsubscribe()},[]);const te=z=>{if(v(z),!E){T(!0);return}B(!0),Q()},G=async()=>{Le("automation_test_clicked",{automation_id:t,agent_id:r});const z=await oe();if(ee(),!!z){if(!_){ae.error("No instructions configured for this automation");return}try{const le=await h.mutateAsync(t);le.threadId&&(f(!0),u(le.threadId))}catch{}}};return n.jsxs(n.Fragment,{children:[s&&n.jsx("div",{className:"flex items-center pb-4 shrink-0",children:n.jsxs(se,{variant:"ghost",size:"sm",onClick:s,children:[n.jsx(th,{size:14}),"Back to list"]})}),n.jsxs("div",{className:"flex flex-col gap-8",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsx(vt,{control:$.control,name:"name",render:({field:z})=>n.jsx(qe,{...z,placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),i&&n.jsx(se,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:i,children:n.jsx(Ii,{size:14})})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(vt,{control:$.control,name:"active",render:({field:z})=>n.jsx(Ar,{checked:z.value,onCheckedChange:le=>{z.onChange(le),oe()},className:"cursor-pointer"})}),n.jsx("span",{className:"text-sm text-muted-foreground",children:U?"Active":"Inactive"}),n.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),n.jsx(Kc,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),n.jsxs("div",{className:"flex flex-col gap-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),n.jsx(Ix,{automationId:t,open:x,onOpenChange:y,onCustomSelect:()=>{w(!0),I(!1),N("")},onEventSelect:()=>{I(!0),w(!1)},onWebhookCreated:z=>{Le("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),j(z)}})]}),e.triggers.length===0&&!S?n.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:n.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",n.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>y(!0),children:"Add a starter"})," ","to get going."]})}):n.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(z=>n.jsx(Bx,{trigger:z,automationId:t,connectionName:z.connection_id?d.get(z.connection_id):void 0},z.id))}),S&&n.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[n.jsx(Ci,{size:14,className:"text-muted-foreground shrink-0"}),n.jsx("input",{type:"text",value:k,onChange:z=>N(z.target.value),onBlur:async()=>{const z=k.trim();if(!(!z||!Ri(z)))try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:z}),Le("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),ae.success("Starter added"),w(!1),N("")}catch{ae.error("Failed to add starter")}},onKeyDown:async z=>{const le=k.trim();z.key==="Enter"&&le&&Ri(le)&&z.target.blur(),z.key==="Escape"&&(w(!1),N(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),k&&!Ri(k)&&n.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),l.isPending&&n.jsx(we,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),n.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{w(!1),N("")},children:n.jsx(fs,{size:13})})]}),D&&n.jsx(R.Suspense,{fallback:n.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[n.jsx(we,{size:13,className:"animate-spin text-muted-foreground"}),n.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:n.jsx($x,{automationId:t,onDone:()=>I(!1)})}),n.jsx(ad,{open:P!==null,onOpenChange:z=>{z||j(null)},url:P?.url??null,token:P?.token??null})]}),n.jsxs("div",{className:"flex flex-col gap-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),n.jsxs(se,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:C||!_,onClick:O,children:[n.jsx(Jr,{size:13}),"Improve"]})]}),n.jsx(Tu,{tiptapDoc:_,setTiptapDoc:te,placeholder:"What should this automation do?",children:n.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[n.jsx(Ru,{virtualMcpId:r||null,className:"max-h-[45vh]"}),n.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:n.jsxs(Pe,{children:[n.jsx(Te,{asChild:!0,children:n.jsxs(se,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:G,disabled:!r,children:[n.jsx(Am,{size:16}),"Test"]})}),n.jsx(Re,{children:"Test Automation"})]})})]})})]}),n.jsxs(Gu,{open:g,onOpenChange:b,className:"flex flex-col gap-2.5",children:[n.jsxs(Yu,{className:"group flex w-fit cursor-pointer items-center gap-1.5",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Advanced"}),n.jsx(js,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),n.jsxs(Xu,{className:"flex flex-col gap-5 pt-0.5",children:[n.jsx(vx,{tier:$.watch("tier"),onTierChange:z=>$.setValue("tier",z,{shouldDirty:!0}),override:$.watch("modelOverride"),onOverrideChange:z=>$.setValue("modelOverride",z,{shouldDirty:!0})}),n.jsx(Sx,{agentId:r||null,value:$.watch("tools"),onChange:z=>$.setValue("tools",z,{shouldDirty:!0})}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Max steps"}),n.jsx(qe,{type:"number",min:1,max:100,className:"w-40",placeholder:`${Lx} (default)`,value:$.watch("maxAgentSteps")??"",onChange:z=>{const le=z.target.value.trim(),ue=le===""?null:Number(le);$.setValue("maxAgentSteps",ue===null||Number.isNaN(ue)?null:ue,{shouldDirty:!0})}})]})]})]})]})]})}function Ws(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:n.jsx(we,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const ld=[{key:"24h",label:"Last 24 hours",ms:1440*60*1e3},{key:"7d",label:"Last 7 days",ms:10080*60*1e3},{key:"30d",label:"Last 30 days",ms:720*60*60*1e3}];function cd(t){const e=ld.find(i=>i.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function Ux(t){const e=H.c(12),{automationId:s,triggerIds:i}=t,[r,o]=R.useState("30d"),[a,l]=R.useState(Vx);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=p=>{const _=p;o(_),l(cd(_))},e[0]=h):h=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Et,{className:"w-44",children:n.jsx(Tt,{})}),e[1]=c):c=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Rt,{children:ld.map(Kx)}),e[2]=d):d=e[2];let u;e[3]!==r?(u=n.jsx("div",{className:"flex items-center justify-end",children:n.jsxs(Pt,{value:r,onValueChange:h,children:[c,d]})}),e[3]=r,e[4]=u):u=e[4];let f;e[5]!==s||e[6]!==a||e[7]!==i?(f=n.jsx(Vm,{automationId:s,triggerIds:i,range:a}),e[5]=s,e[6]=a,e[7]=i,e[8]=f):f=e[8];let m;return e[9]!==u||e[10]!==f?(m=n.jsxs("div",{className:"flex flex-col gap-5",children:[u,f]}),e[9]=u,e[10]=f,e[11]=m):m=e[11],m}function Kx(t){return n.jsx(lt,{value:t.key,children:t.label},t.key)}function Vx(){return cd("30d")}function qx(t){const e=H.c(5),{tabId:s}=t;let i;e[0]!==s?(i=Mc(s),e[0]=s,e[1]=i):i=e[1];const r=i;if(!r)return null;let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(Ws,{}),e[2]=o):o=e[2];let a;return e[3]!==r.id?(a=n.jsx(R.Suspense,{fallback:o,children:n.jsx(Gx,{id:r.id})}),e[3]=r.id,e[4]=a):a=e[4],a}function Gx(t){const e=H.c(24),{id:s}=t,i=Qt(),{data:r,isLoading:o}=Hm(s),[a,l]=R.useState("settings");let h;e[0]!==i?(h=()=>{i({to:".",search:Xx,replace:!0})},e[0]=i,e[1]=h):h=e[1];const c=h;if(o){let b;return e[2]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(Ws,{}),e[2]=b):b=e[2],b}if(!r){let b;return e[3]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=b):b=e[3],b}let d;e[4]!==r.triggers?(d=r.triggers.map(Yx),e[4]=r.triggers,e[5]=d):d=e[5];const u=d;let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(th,{size:14}),e[6]=f):f=e[6];let m;e[7]!==c?(m=n.jsxs(se,{variant:"ghost",size:"sm",onClick:c,children:[f,"Back to list"]}),e[7]=c,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=[{id:"settings",label:"Settings"},{id:"runs",label:"Runs"}],e[9]=p):p=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=b=>l(b),e[10]=_):_=e[10];let v;e[11]!==a?(v=n.jsx(Xc,{tabs:p,activeTab:a,onTabChange:_}),e[11]=a,e[12]=v):v=e[12];let x;e[13]!==m||e[14]!==v?(x=n.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[m,v]}),e[13]=m,e[14]=v,e[15]=x):x=e[15];let y;e[16]!==r||e[17]!==s||e[18]!==a||e[19]!==u?(y=a==="settings"?n.jsx(Wx,{automationId:s,automation:r}):n.jsx(Ux,{automationId:s,triggerIds:u}),e[16]=r,e[17]=s,e[18]=a,e[19]=u,e[20]=y):y=e[20];let g;return e[21]!==x||e[22]!==y?(g=n.jsx(Nt,{children:n.jsx(Nt.Content,{children:n.jsxs(Nt.Body,{children:[x,y]})})}),e[21]=x,e[22]=y,e[23]=g):g=e[23],g}function Yx(t){return t.id}function Xx(t){return{...t,main:"automations"}}function Jx(t){const e=H.c(20),{virtualMcpId:s}=t,i=Qt(),{data:r}=Wm(s),o=r===void 0?[]:r,{create:a}=Ui(),[l,h]=R.useState(""),c=l.toLowerCase(),d=o.filter(P=>P.name.toLowerCase().includes(c));let u;e[0]!==i?(u=P=>i({to:".",search:j=>({...j,main:"automation:"+P}),replace:!0}),e[0]=i,e[1]=u):u=e[1];const f=u,m=async()=>{if(a.isPending)return;Le("automation_new_clicked",{virtual_mcp_id:s,existing_count:o.length});const P=await a.mutateAsync(Um(s));f(P.id)};let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(At,{size:14}),e[2]=p):p=e[2];let _;e[3]!==a.isPending||e[4]!==m?(_=n.jsxs(se,{size:"sm",onClick:m,disabled:a.isPending,children:[p,"New automation"]}),e[3]=a.isPending,e[4]=m,e[5]=_):_=e[5];const v=_,x=Nt,y=Nt,g=Nt;let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(Nt.Title,{children:"Automations"}),e[6]=b):b=e[6];const S=o.length>0&&n.jsx(Yc,{value:l,onChange:h,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let w;e[7]!==v||e[8]!==S?(w=n.jsxs("div",{className:"flex flex-col gap-6",children:[b,n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[S,v]})]}),e[7]=v,e[8]=S,e[9]=w):w=e[9];const k=o.length===0?n.jsx("div",{className:"flex items-center justify-center py-20",children:n.jsx(wr,{image:n.jsx(Bi,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:v})}):d.length===0?n.jsx("div",{className:"flex items-center justify-center py-20",children:n.jsx(wr,{image:n.jsx(Bi,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${l}"`})}):n.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:d.map(P=>n.jsx(qm,{automation:P,onClick:()=>f(P.id)},P.id))});let N;e[10]!==k||e[11]!==g.Body||e[12]!==w?(N=n.jsxs(g.Body,{children:[w,k]}),e[10]=k,e[11]=g.Body,e[12]=w,e[13]=N):N=e[13];let D;e[14]!==N||e[15]!==y.Content?(D=n.jsx(y.Content,{children:N}),e[14]=N,e[15]=y.Content,e[16]=D):D=e[16];let I;return e[17]!==x||e[18]!==D?(I=n.jsx(x,{children:D}),e[17]=x,e[18]=D,e[19]=I):I=e[19],I}function Zx(t){const e=H.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(Ws,{}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=n.jsx(R.Suspense,{fallback:i,children:n.jsx(Jx,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}function Qx(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(gs,{className:"h-6 w-2/3"}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"flex h-full w-full items-center justify-center bg-white",children:n.jsxs("div",{className:"flex w-3/4 max-w-md flex-col gap-3 p-6",children:[e,n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx(gs,{className:"h-3 w-full"}),n.jsx(gs,{className:"h-3 w-5/6"}),n.jsx(gs,{className:"h-3 w-2/3"})]}),n.jsx(gs,{className:"mt-2 h-8 w-24"})]})}),t[1]=s):s=t[1],s}function eb(t,e){for(let s=t.length-1;s>=0;s--){const i=t[s]?.parts;if(i)for(let r=i.length-1;r>=0;r--){const o=i[r];if(!o||o.type!=="data-html-page-published")continue;const a=o.data;if(a&&a.slug===e)return a}}return null}function tb(t){const e=H.c(11),{slug:s}=t,i=$u();let r;e[0]!==i?.messages?(r=i?.messages??[],e[0]=i?.messages,e[1]=r):r=e[1];const o=r;let a;e[2]!==o||e[3]!==s?(a=eb(o,s),e[2]=o,e[3]=s,e[4]=a):a=e[4];const l=a;if(!l){let f;return e[5]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("div",{className:"h-full w-full bg-background",children:n.jsx(Qx,{})}),e[5]=f):f=e[5],f}const h=l.url,c=String(l.bytes),d=`${s}.html`;let u;return e[6]!==l.url||e[7]!==s||e[8]!==c||e[9]!==d?(u=n.jsx(Hc,{readUrl:h,marker:c,title:d},s),e[6]=l.url,e[7]=s,e[8]=c,e[9]=d,e[10]=u):u=e[10],u}function sb(t){const e=H.c(37),{file:s,onClose:i}=t;let r,o;e[0]!==s.filename?(r=n.jsx(Mo,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),o=n.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=r,e[2]=o):(r=e[1],o=e[2]);let a;e[3]!==s.size?(a=Xf(s.size),e[3]=s.size,e[4]=a):a=e[4];let l;e[5]!==a?(l=n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:a}),e[5]=a,e[6]=l):l=e[6];let h;e[7]!==r||e[8]!==o||e[9]!==l?(h=n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r,o,l]}),e[7]=r,e[8]=o,e[9]=l,e[10]=h):h=e[10];let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Hf,{size:14}),e[11]=c):c=e[11];let d;e[12]!==s.downloadUrl||e[13]!==s.filename?(d=n.jsx(Te,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",asChild:!0,children:n.jsx("a",{href:s.downloadUrl,download:s.filename,children:c})})}),e[12]=s.downloadUrl,e[13]=s.filename,e[14]=d):d=e[14];let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Re,{side:"bottom",children:"Download"}),e[15]=u):u=e[15];let f;e[16]!==d?(f=n.jsxs(Pe,{children:[d,u]}),e[16]=d,e[17]=f):f=e[17];let m;e[18]!==s.downloadUrl?(m=()=>window.open(s.downloadUrl,"_blank","noopener"),e[18]=s.downloadUrl,e[19]=m):m=e[19];let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(ti,{size:14}),e[20]=p):p=e[20];let _;e[21]!==m?(_=n.jsx(Te,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",onClick:m,children:p})}),e[21]=m,e[22]=_):_=e[22];let v;e[23]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(Re,{side:"bottom",children:"Open in new tab"}),e[23]=v):v=e[23];let x;e[24]!==_?(x=n.jsxs(Pe,{children:[_,v]}),e[24]=_,e[25]=x):x=e[25];let y;e[26]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(fs,{size:14}),e[26]=y):y=e[26];let g;e[27]!==i?(g=n.jsx(Te,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",onClick:i,children:y})}),e[27]=i,e[28]=g):g=e[28];let b;e[29]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(Re,{side:"bottom",children:"Close"}),e[29]=b):b=e[29];let S;e[30]!==g?(S=n.jsxs(Pe,{children:[g,b]}),e[30]=g,e[31]=S):S=e[31];let w;return e[32]!==x||e[33]!==S||e[34]!==h||e[35]!==f?(w=n.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[h,f,x,S]}),e[32]=x,e[33]=S,e[34]=h,e[35]=f,e[36]=w):w=e[36],w}function ib(t){const e=H.c(24),{fileKey:s,taskId:i}=t,r=Qt(),{data:o,isPending:a}=jc(i);let l;e[0]!==s||e[1]!==o?(l=o?.find(p=>p.key===s)??null,e[0]=s,e[1]=o,e[2]=l):l=e[2];const h=l;let c;e[3]!==r?(c=()=>r({to:".",search:rb,replace:!0}),e[3]=r,e[4]=c):c=e[4];const d=c;if(!h){if(a){let g;return e[5]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx("div",{className:"h-full w-full bg-background",children:n.jsx(Gf,{})}),e[5]=g):g=e[5],g}let p;e[6]!==s?(p=s.split("/").pop()??s,e[6]=s,e[7]=p):p=e[7];let _;e[8]!==p?(_=n.jsx(Mo,{filename:p,className:"h-7.5 w-6"}),e[8]=p,e[9]=_):_=e[9];let v;e[10]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("span",{className:"text-sm text-muted-foreground",children:"This file is no longer available."}),e[10]=v):v=e[10];let x;e[11]!==d?(x=n.jsx(se,{variant:"ghost",size:"sm",onClick:d,children:"Close"}),e[11]=d,e[12]=x):x=e[12];let y;return e[13]!==_||e[14]!==x?(y=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[_,v,x]}),e[13]=_,e[14]=x,e[15]=y):y=e[15],y}let u;e[16]!==h||e[17]!==d?(u=n.jsx(sb,{file:h,onClose:d}),e[16]=h,e[17]=d,e[18]=u):u=e[18];let f;e[19]!==h?(f=n.jsx("div",{className:"relative min-h-0 flex-1",children:n.jsx(Yf,{file:h})}),e[19]=h,e[20]=f):f=e[20];let m;return e[21]!==u||e[22]!==f?(m=n.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[u,f]}),e[21]=u,e[22]=f,e[23]=m):m=e[23],m}function rb(t){return{...t,main:"0"}}const gl="home";function nb(t){const e=H.c(5),{label:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(gs,{className:"aspect-video w-2/3 max-w-xl"}),e[0]=i):i=e[0];let r;e[1]!==s?(r=s&&n.jsx("p",{className:"text-xs text-muted-foreground",children:s}),e[1]=s,e[2]=r):r=e[2];let o;return e[3]!==r?(o=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-background",children:[i,r]}),e[3]=r,e[4]=o):o=e[4],o}function ob(t){const e=H.c(12),{path:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={refetchIntervalWhenAbsent:2e3},e[0]=i):i=e[0];const r=Jf(gl,s,i),o=Zf(gl);let a;e[1]!==s||e[2]!==o?(a=o(s),e[1]=s,e[2]=o,e[3]=a):a=e[3];const l=a;if(r.isPending||!r.data){const d=!r.isPending&&!r.data?"Waiting for the deck to sync…":void 0;let u;return e[4]!==d?(u=n.jsx(nb,{label:d}),e[4]=d,e[5]=u):u=e[5],u}let h;e[6]!==r.data?(h=Qf(r.data),e[6]=r.data,e[7]=h):h=e[7];let c;return e[8]!==s||e[9]!==l||e[10]!==h?(c=n.jsx(Hc,{readUrl:l,marker:h,title:s,savePath:s}),e[8]=s,e[9]=l,e[10]=h,e[11]=c):c=e[11],c}const vl=R.lazy(()=>Kt(()=>import("./project-app-view-hOIqQC_C.js"),__vite__mapDeps([162,1,2,91,6,7,8,9,10,11,12,13,14,15,16,3,17,4,5,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,92,93,46,47,48,94,95,49,96,97,58,98,99,100,101,85,102,57,103,59,104,105,106,107,108,66,109,56,110,71,72,50,111,126])).then(t=>({default:t.AppViewContent})));function ab(t){const e=H.c(53),{activeTab:s,virtualMcpId:i,taskId:r,layoutTabs:o,expandedTools:a,automationTabParsed:l}=t;if(If(s)){let g;return e[0]!==i?(g=n.jsx(sl,{virtualMcpId:i}),e[0]=i,e[1]=g):g=e[1],g}if(s==="git"){let g;return e[2]!==i?(g=n.jsx(vv,{virtualMcpId:i}),e[2]=i,e[3]=g):g=e[3],g}if(s==="automations"){let g;return e[4]!==i?(g=n.jsx(Zx,{virtualMcpId:i}),e[4]=i,e[5]=g):g=e[5],g}if(s==="preview"){let g;return e[6]!==i?(g=n.jsx(d1,{virtualMcpId:i}),e[6]=i,e[7]=g):g=e[7],g}if(s==="content"){let g;return e[8]!==i?(g=n.jsx(px,{virtualMcpId:i}),e[8]=i,e[9]=g):g=e[9],g}if(l){let g;return e[10]!==s?(g=n.jsx(qx,{tabId:s}),e[10]=s,e[11]=g):g=e[11],g}let h;e[12]!==s?(h=Bf(s),e[12]=s,e[13]=h):h=e[13];const c=h;if(c){let g;return e[14]!==c.slug?(g=n.jsx(tb,{slug:c.slug}),e[14]=c.slug,e[15]=g):g=e[15],g}let d;e[16]!==s?(d=Oc(s),e[16]=s,e[17]=d):d=e[17];const u=d;if(u){let g;return e[18]!==u.path?(g=n.jsx(ob,{path:u.path},u.path),e[18]=u.path,e[19]=g):g=e[19],g}let f;e[20]!==s?(f=Lc(s),e[20]=s,e[21]=f):f=e[21];const m=f;if(m){let g;return e[22]!==m.key||e[23]!==r?(g=n.jsx(ib,{fileKey:m.key,taskId:r}),e[22]=m.key,e[23]=r,e[24]=g):g=e[24],g}let p;e[25]!==s?(p=Mf(s),e[25]=s,e[26]=p):p=e[26];const _=p;if(_){let g;if(e[27]!==a||e[28]!==_.connectionId||e[29]!==_.toolName){let N;e[31]!==_.connectionId||e[32]!==_.toolName?(N=D=>D.appId===_.connectionId&&D.toolName===_.toolName,e[31]=_.connectionId,e[32]=_.toolName,e[33]=N):N=e[33],g=a.find(N),e[27]=a,e[28]=_.connectionId,e[29]=_.toolName,e[30]=g}else g=e[30];const b=g;let S;e[34]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(Ws,{}),e[34]=S):S=e[34];const w=b?.args;let k;return e[35]!==s||e[36]!==_.connectionId||e[37]!==_.toolName||e[38]!==w?(k=n.jsx(R.Suspense,{fallback:S,children:n.jsx(vl,{connectionId:_.connectionId,toolName:_.toolName,args:w},s)}),e[35]=s,e[36]=_.connectionId,e[37]=_.toolName,e[38]=w,e[39]=k):k=e[39],k}let v;if(e[40]!==s||e[41]!==o){let g;e[43]!==s?(g=b=>b.id===s,e[43]=s,e[44]=g):g=e[44],v=o.find(g),e[40]=s,e[41]=o,e[42]=v}else v=e[42];const x=v;if(x){let g;e[45]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(Ws,{}),e[45]=g):g=e[45];let b;return e[46]!==s||e[47]!==x.id||e[48]!==x.view.appId||e[49]!==x.view.args?(b=n.jsx(R.Suspense,{fallback:g,children:n.jsx(vl,{connectionId:x.view.appId,toolName:x.id,args:x.view.args},s)}),e[46]=s,e[47]=x.id,e[48]=x.view.appId,e[49]=x.view.args,e[50]=b):b=e[50],b}let y;return e[51]!==i?(y=n.jsx(sl,{virtualMcpId:i}),e[51]=i,e[52]=y):y=e[52],y}function lb(t){const e=H.c(14),{taskId:s,virtualMcpId:i}=t;let r;e[0]!==s||e[1]!==i?(r={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=r):r=e[2];const{activeTab:o,layoutTabs:a,expandedTools:l,automationTabParsed:h}=Eh(r);let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Ws,{}),e[3]=c):c=e[3];let d;e[4]!==o||e[5]!==h||e[6]!==l||e[7]!==a||e[8]!==s||e[9]!==i?(d=n.jsx(R.Suspense,{fallback:c,children:n.jsx(ab,{activeTab:o,virtualMcpId:i,taskId:s,layoutTabs:a,expandedTools:l,automationTabParsed:h})}),e[4]=o,e[5]=h,e[6]=l,e[7]=a,e[8]=s,e[9]=i,e[10]=d):d=e[10];let u;return e[11]!==o||e[12]!==d?(u=n.jsx(Ht,{children:d},o),e[11]=o,e[12]=d,e[13]=u):u=e[13],u}const bs="setup";function cb(t){const e=H.c(35);let s;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let m;e[3]!==t.scriptTabs?(m=p=>!t.scriptTabs.includes(p),e[3]=t.scriptTabs,e[4]=m):m=e[4],s=t.scripts.filter(m),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=s}else s=e[2];const i=s;let r;e[5]!==t?(r=()=>{t.active===bs?t.onToggle():t.onSelectTab(bs)},e[5]=t,e[6]=r):r=e[6];const o=r,a=t.active===bs;let l;e[7]!==o||e[8]!==t.open||e[9]!==a?(l=n.jsx(hb,{active:a,open:t.open,onClick:o}),e[7]=o,e[8]=t.open,e[9]=a,e[10]=l):l=e[10];let h;e[11]!==t?(h=t.scriptTabs.map(m=>n.jsx(ub,{active:t.active===m,onClick:()=>t.onSelectTab(m),onClose:()=>t.onCloseScript(m),children:m},m)),e[11]=t,e[12]=h):h=e[12];let c;e[13]!==i||e[14]!==t.onAddScript?(c=n.jsx(fb,{scripts:i,onRun:t.onAddScript}),e[13]=i,e[14]=t.onAddScript,e[15]=c):c=e[15];let d;e[16]!==l||e[17]!==h||e[18]!==c?(d=n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[l,h,c]}),e[16]=l,e[17]=h,e[18]=c,e[19]=d):d=e[19];let u;e[20]!==t.onRestart||e[21]!==t.onResume||e[22]!==t.onRetry||e[23]!==t.onRunActiveScript||e[24]!==t.onStart||e[25]!==t.onStop||e[26]!==t.onStopActiveScript||e[27]!==t.scriptIsKilling||e[28]!==t.scriptIsRunning||e[29]!==t.showScriptControls||e[30]!==t.status?(u=t.showScriptControls?n.jsx(mb,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript}):n.jsx(db,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry}),e[20]=t.onRestart,e[21]=t.onResume,e[22]=t.onRetry,e[23]=t.onRunActiveScript,e[24]=t.onStart,e[25]=t.onStop,e[26]=t.onStopActiveScript,e[27]=t.scriptIsKilling,e[28]=t.scriptIsRunning,e[29]=t.showScriptControls,e[30]=t.status,e[31]=u):u=e[31];let f;return e[32]!==d||e[33]!==u?(f=n.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-3",children:[d,u]}),e[32]=d,e[33]=u,e[34]=f):f=e[34],f}function hb(t){const e=H.c(8),{active:s,open:i,onClick:r}=t,o=s&&i,a=s&&i,l=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let h;e[0]!==l?(h=ce("flex h-7 items-center gap-1.5 rounded-md border px-2.5 text-xs",l),e[0]=l,e[1]=h):h=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Nf,{className:"size-3.5"}),e[2]=c):c=e[2];let d;return e[3]!==r||e[4]!==o||e[5]!==a||e[6]!==h?(d=n.jsxs("button",{type:"button","aria-pressed":o,"aria-expanded":a,onClick:r,className:h,children:[c,"sandbox"]}),e[3]=r,e[4]=o,e[5]=a,e[6]=h,e[7]=d):d=e[7],d}function db(t){const e=H.c(24),{status:s,onStart:i,onStop:r,onRestart:o,onResume:a,onRetry:l}=t;if(s==="idle"&&i){let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Fs,{className:"size-3.5"}),e[0]=h):h=e[0];let c;return e[1]!==i?(c=n.jsxs(se,{variant:"outline",size:"sm",onClick:i,children:[h," Start"]}),e[1]=i,e[2]=c):c=e[2],c}if(s==="suspended"&&a){let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Fs,{className:"size-3.5"}),e[3]=h):h=e[3];let c;return e[4]!==a?(c=n.jsxs(se,{variant:"outline",size:"sm",onClick:a,children:[h," Resume"]}),e[4]=a,e[5]=c):c=e[5],c}if(s==="errored"&&l){let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Di,{className:"size-3.5"}),e[6]=h):h=e[6];let c;return e[7]!==l?(c=n.jsxs(se,{variant:"outline",size:"sm",onClick:l,children:[h," Retry"]}),e[7]=l,e[8]=c):c=e[8],c}if(s==="starting"||s==="running"){const h=s==="running"&&!!o,c=h?"rounded-r-none border-r-0":void 0;let d;e[9]!==c?(d=ce(c),e[9]=c,e[10]=d):d=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Ic,{className:"size-3.5"}),e[11]=u):u=e[11];let f;e[12]!==r||e[13]!==d?(f=n.jsx(Te,{asChild:!0,children:n.jsxs(se,{variant:"outline",size:"sm",onClick:r,className:d,children:[u," Stop"]})}),e[12]=r,e[13]=d,e[14]=f):f=e[14];let m;e[15]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Re,{children:"Stop sandbox"}),e[15]=m):m=e[15];let p;e[16]!==f?(p=n.jsxs(Pe,{children:[f,m]}),e[16]=f,e[17]=p):p=e[17];let _;e[18]!==o||e[19]!==h?(_=h&&n.jsxs(Js,{children:[n.jsx(Zs,{asChild:!0,children:n.jsx(se,{variant:"outline",size:"sm",className:"rounded-l-none px-1",children:n.jsx(js,{className:"size-3"})})}),n.jsx(Qs,{align:"end",children:n.jsxs(et,{onClick:o,children:[n.jsx(Di,{className:"size-3.5"})," Restart"]})})]}),e[18]=o,e[19]=h,e[20]=_):_=e[20];let v;return e[21]!==p||e[22]!==_?(v=n.jsxs("div",{className:"flex items-center",children:[p,_]}),e[21]=p,e[22]=_,e[23]=v):v=e[23],v}return null}function ub(t){const e=H.c(16),{active:s,onClick:i,onClose:r,children:o}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let l;e[0]!==a?(l=ce("flex h-7 items-center rounded-md border text-xs",a),e[0]=a,e[1]=l):l=e[1];const h=r?"pl-2.5 pr-1":"px-2.5",c=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let d;e[2]!==h||e[3]!==c?(d=ce("flex h-full items-center",h,c),e[2]=h,e[3]=c,e[4]=d):d=e[4];let u;e[5]!==o||e[6]!==i||e[7]!==d?(u=n.jsx("button",{type:"button",onClick:i,className:d,children:o}),e[5]=o,e[6]=i,e[7]=d,e[8]=u):u=e[8];let f;e[9]!==o||e[10]!==r?(f=r&&n.jsx("button",{type:"button","aria-label":`Close ${o}`,onClick:r,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:n.jsx(Gm,{className:"size-3"})}),e[9]=o,e[10]=r,e[11]=f):f=e[11];let m;return e[12]!==l||e[13]!==u||e[14]!==f?(m=n.jsxs("div",{className:l,children:[u,f]}),e[12]=l,e[13]=u,e[14]=f,e[15]=m):m=e[15],m}function fb(t){const e=H.c(10),{scripts:s,onRun:i}=t,[r,o]=R.useState(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs(Pe,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(Es,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"sm","aria-label":"Run script",children:n.jsx(At,{className:"size-3.5"})})})}),n.jsx(Re,{children:"Run script"})]}),e[0]=a):a=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:"run a script"}),e[1]=l):l=e[1];let h;e[2]!==i||e[3]!==s?(h=s.length===0?n.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:"No scripts found"}):s.map(u=>n.jsxs("button",{type:"button",onClick:()=>{o(!1),i(u)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",u]},u)),e[2]=i,e[3]=s,e[4]=h):h=e[4];let c;e[5]!==h?(c=n.jsxs(Ts,{align:"start",className:"p-1 w-56",children:[l,h]}),e[5]=h,e[6]=c):c=e[6];let d;return e[7]!==r||e[8]!==c?(d=n.jsxs(Ns,{open:r,onOpenChange:o,children:[a,c]}),e[7]=r,e[8]=c,e[9]=d):d=e[9],d}function mb(t){const e=H.c(13),{isRunning:s,isKilling:i,onRun:r,onStop:o}=t;if(i){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsxs(se,{variant:"outline",size:"sm",disabled:!0,children:[n.jsx(we,{className:"size-3.5 animate-spin"})," Stopping…"]}),e[0]=d):d=e[0],d}if(!s){let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Fs,{className:"size-3.5"}),e[1]=d):d=e[1];let u;e[2]!==r?(u=n.jsx(Te,{asChild:!0,children:n.jsxs(se,{variant:"outline",size:"sm",onClick:r,children:[d," Run"]})}),e[2]=r,e[3]=u):u=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(Re,{children:"Start process"}),e[4]=f):f=e[4];let m;return e[5]!==u?(m=n.jsxs(Pe,{children:[u,f]}),e[5]=u,e[6]=m):m=e[6],m}let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Ic,{className:"size-3.5"}),e[7]=a):a=e[7];let l;e[8]!==o?(l=n.jsx(Te,{asChild:!0,children:n.jsxs(se,{variant:"outline",size:"sm",onClick:o,children:[a," Stop"]})}),e[8]=o,e[9]=l):l=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Re,{children:"Stop process"}),e[10]=h):h=e[10];let c;return e[11]!==l?(c=n.jsxs(Pe,{children:[l,h]}),e[11]=l,e[12]=c):c=e[12],c}var hd=Object.defineProperty,pb=Object.getOwnPropertyDescriptor,_b=(t,e)=>{for(var s in e)hd(t,s,{get:e[s],enumerable:!0})},ze=(t,e,s,i)=>{for(var r=i>1?void 0:i?pb(e,s):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,s,r):a(r))||r);return i&&r&&hd(e,s,r),r},de=(t,e)=>(s,i)=>e(s,i,t),xl="Terminal input",Wn={get:()=>xl,set:t=>xl=t},bl="Too much output to announce, navigate to rows manually to read",Un={get:()=>bl,set:t=>bl=t};function gb(t){return t.replace(/\r?\n/g,"\r")}function vb(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function xb(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function bb(t,e,s,i){if(t.stopPropagation(),t.clipboardData){let r=t.clipboardData.getData("text/plain");dd(r,e,s,i)}}function dd(t,e,s,i){t=gb(t),t=vb(t,s.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function ud(t,e,s){let i=s.getBoundingClientRect(),r=t.clientX-i.left-10,o=t.clientY-i.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${r}px`,e.style.top=`${o}px`,e.style.zIndex="1000",e.focus()}function yl(t,e,s,i,r){ud(t,e,s),r&&i.rightClickSelect(t),e.value=i.selectionText,e.select()}function cs(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function sn(t,e=0,s=t.length){let i="";for(let r=e;r<s;++r){let o=t[r];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var yb=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let i=0,r=0;if(this._interim){let o=t.charCodeAt(r++);56320<=o&&o<=57343?e[i++]=(this._interim-55296)*1024+o-56320+65536:(e[i++]=this._interim,e[i++]=o),this._interim=0}for(let o=r;o<s;++o){let a=t.charCodeAt(o);if(55296<=a&&a<=56319){if(++o>=s)return this._interim=a,i;let l=t.charCodeAt(o);56320<=l&&l<=57343?e[i++]=(a-55296)*1024+l-56320+65536:(e[i++]=a,e[i++]=l);continue}a!==65279&&(e[i++]=a)}return i}},Sb=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let i=0,r,o,a,l,h=0,c=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,_;for(;(_=this.interim[++p]&63)&&p<4;)m<<=6,m|=_;let v=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,x=v-p;for(;c<x;){if(c>=s)return 0;if(_=t[c++],(_&192)!==128){c--,f=!0;break}else this.interim[p++]=_,m<<=6,m|=_&63}f||(v===2?m<128?c--:e[i++]=m:v===3?m<2048||m>=55296&&m<=57343||m===65279||(e[i++]=m):m<65536||m>1114111||(e[i++]=m)),this.interim.fill(0)}let d=s-4,u=c;for(;u<s;){for(;u<d&&!((r=t[u])&128)&&!((o=t[u+1])&128)&&!((a=t[u+2])&128)&&!((l=t[u+3])&128);)e[i++]=r,e[i++]=o,e[i++]=a,e[i++]=l,u+=4;if(r=t[u++],r<128)e[i++]=r;else if((r&224)===192){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(h=(r&31)<<6|o&63,h<128){u--;continue}e[i++]=h}else if((r&240)===224){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,i;if(a=t[u++],(a&192)!==128){u--;continue}if(h=(r&15)<<12|(o&63)<<6|a&63,h<2048||h>=55296&&h<=57343||h===65279)continue;e[i++]=h}else if((r&248)===240){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,i;if(a=t[u++],(a&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=a,i;if(l=t[u++],(l&192)!==128){u--;continue}if(h=(r&7)<<18|(o&63)<<12|(a&63)<<6|l&63,h<65536||h>1114111)continue;e[i++]=h}}return i}},fd="",hs=" ",Gi=class md{constructor(){this.fg=0,this.bg=0,this.extended=new Or}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new md;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Or=class pd{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new pd(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},kt=class _d extends Gi{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Or,this.combinedData=""}static fromCharData(e){let s=new _d;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?cs(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Sl="di$target",Kn="di$dependencies",xn=new Map;function wb(t){return t[Kn]||[]}function st(t){if(xn.has(t))return xn.get(t);let e=function(s,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Cb(e,s,r)};return e._id=t,xn.set(t,e),e}function Cb(t,e,s){e[Sl]===e?e[Kn].push({id:t,index:s}):(e[Kn]=[{id:t,index:s}],e[Sl]=e)}var dt=st("BufferService"),gd=st("CoreMouseService"),Ds=st("CoreService"),kb=st("CharsetService"),_a=st("InstantiationService"),vd=st("LogService"),ut=st("OptionsService"),xd=st("OscLinkService"),jb=st("UnicodeService"),Yi=st("DecorationService"),Vn=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let i=[],r=this._optionsService.rawOptions.linkHandler,o=new kt,a=s.getTrimmedLength(),l=-1,h=-1,c=!1;for(let d=0;d<a;d++)if(!(h===-1&&!s.hasContent(d))){if(s.loadCell(d,o),o.hasExtendedAttrs()&&o.extended.urlId)if(h===-1){h=d,l=o.extended.urlId;continue}else c=o.extended.urlId!==l;else h!==-1&&(c=!0);if(c||h!==-1&&d===a-1){let u=this._oscLinkService.getLinkData(l)?.uri;if(u){let f={start:{x:h+1,y:t},end:{x:d+(!c&&d===a-1?1:0),y:t}},m=!1;if(!r?.allowNonHttpProtocols)try{let p=new URL(u);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||i.push({text:u,range:f,activate:(p,_)=>r?r.activate(p,_,f):Nb(p,_),hover:(p,_)=>r?.hover?.(p,_,f),leave:(p,_)=>r?.leave?.(p,_,f)})}c=!1,o.hasExtendedAttrs()&&o.extended.urlId?(h=d,l=o.extended.urlId):(h=-1,l=-1)}}e(i)}};Vn=ze([de(0,dt),de(1,ut),de(2,xd)],Vn);function Nb(t,e){if(confirm(`Do you want to navigate to ${e}?
|
|
293
|
+
`);if(le.trim()){A(!0);try{ee(),Le("automation_improve_clicked",{automation_id:t,agent_id:r,instructions_length:le.length}),f(!0),await m({tiptapDoc:Th({managerAgentId:wc.AUTOMATION_MANAGER(o.id),managerName:"Automation Manager",kind:"automation",id:t,instructions:le})})}finally{A(!1)}}},F=e.models?.tier??"smart",W=e.models?.modelId&&e.models?.credentialId?{modelId:e.models.modelId,credentialId:e.models.credentialId,title:e.models.modelTitle??e.models.modelId}:null,$=yc({defaultValues:{name:e.name,active:e.active,tier:F,modelOverride:W,tools:e.tools??null,maxAgentSteps:e.maxAgentSteps??null}}),U=$.watch("active"),[Y,V]=R.useReducer(Ox,null),K=()=>{Y!==null&&(Le("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(Y.fields),save_count:Y.saveCount,edit_duration_ms:Date.now()-Y.start}),V({type:"reset"}))},q=async()=>{const z=$.control._formState.dirtyFields,le=Object.keys(z);if(le.length===0&&!M)return!0;const ue=$.getValues(),me=$.control._defaultValues;$.reset(ue,{keepValues:!0});const he=M;B(!1);const ie={tier:ue.tier,...ue.modelOverride?{modelId:ue.modelOverride.modelId,credentialId:ue.modelOverride.credentialId,modelTitle:ue.modelOverride.title}:{}},ve={id:t,name:ue.name,active:ue.active,models:ie,tools:ue.tools,maxAgentSteps:ue.maxAgentSteps,messages:Lu(_),temperature:0};try{await a.mutateAsync(ve)}catch{return $.reset(me,{keepValues:!0}),he&&B(!0),!1}const re=[...le];return he&&re.push("messages"),V({type:"accumulate",now:Date.now(),fields:re}),L(),!0},{schedule:Q,flush:oe}=Ir({save:q}),{schedule:L,flush:ee}=Ir({delayMs:3e4,save:async()=>K()});R.useEffect(()=>{const z=$.watch(()=>Q());return()=>z.unsubscribe()},[]);const te=z=>{if(v(z),!E){T(!0);return}B(!0),Q()},G=async()=>{Le("automation_test_clicked",{automation_id:t,agent_id:r});const z=await oe();if(ee(),!!z){if(!_){ae.error("No instructions configured for this automation");return}try{const le=await h.mutateAsync(t);le.threadId&&(f(!0),u(le.threadId))}catch{}}};return n.jsxs(n.Fragment,{children:[s&&n.jsx("div",{className:"flex items-center pb-4 shrink-0",children:n.jsxs(se,{variant:"ghost",size:"sm",onClick:s,children:[n.jsx(th,{size:14}),"Back to list"]})}),n.jsxs("div",{className:"flex flex-col gap-8",children:[n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsx(vt,{control:$.control,name:"name",render:({field:z})=>n.jsx(qe,{...z,placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}})}),i&&n.jsx(se,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:i,children:n.jsx(Ii,{size:14})})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(vt,{control:$.control,name:"active",render:({field:z})=>n.jsx(Ar,{checked:z.value,onCheckedChange:le=>{z.onChange(le),oe()},className:"cursor-pointer"})}),n.jsx("span",{className:"text-sm text-muted-foreground",children:U?"Active":"Inactive"}),n.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),n.jsx(Kc,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),n.jsxs("div",{className:"flex flex-col gap-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),n.jsx(Ix,{automationId:t,open:x,onOpenChange:y,onCustomSelect:()=>{w(!0),I(!1),N("")},onEventSelect:()=>{I(!0),w(!1)},onWebhookCreated:z=>{Le("automation_trigger_added",{automation_id:t,trigger_type:"webhook"}),j(z)}})]}),e.triggers.length===0&&!S?n.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:n.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",n.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>y(!0),children:"Add a starter"})," ","to get going."]})}):n.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(z=>n.jsx(Bx,{trigger:z,automationId:t,connectionName:z.connection_id?d.get(z.connection_id):void 0},z.id))}),S&&n.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[n.jsx(Ci,{size:14,className:"text-muted-foreground shrink-0"}),n.jsx("input",{type:"text",value:k,onChange:z=>N(z.target.value),onBlur:async()=>{const z=k.trim();if(!(!z||!Ri(z)))try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:z}),Le("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),ae.success("Starter added"),w(!1),N("")}catch{ae.error("Failed to add starter")}},onKeyDown:async z=>{const le=k.trim();z.key==="Enter"&&le&&Ri(le)&&z.target.blur(),z.key==="Escape"&&(w(!1),N(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),k&&!Ri(k)&&n.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),l.isPending&&n.jsx(we,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),n.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{w(!1),N("")},children:n.jsx(fs,{size:13})})]}),D&&n.jsx(R.Suspense,{fallback:n.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[n.jsx(we,{size:13,className:"animate-spin text-muted-foreground"}),n.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:n.jsx($x,{automationId:t,onDone:()=>I(!1)})}),n.jsx(ad,{open:P!==null,onOpenChange:z=>{z||j(null)},url:P?.url??null,token:P?.token??null})]}),n.jsxs("div",{className:"flex flex-col gap-2.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),n.jsxs(se,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:C||!_,onClick:O,children:[n.jsx(Jr,{size:13}),"Improve"]})]}),n.jsx(Tu,{tiptapDoc:_,setTiptapDoc:te,placeholder:"What should this automation do?",children:n.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[n.jsx(Ru,{virtualMcpId:r||null,className:"max-h-[45vh]"}),n.jsx("div",{className:"@container/chat-bottom flex items-center justify-end gap-1.5 p-2.5",children:n.jsxs(Pe,{children:[n.jsx(Te,{asChild:!0,children:n.jsxs(se,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:G,disabled:!r,children:[n.jsx(Am,{size:16}),"Test"]})}),n.jsx(Re,{children:"Test Automation"})]})})]})})]}),n.jsxs(Gu,{open:g,onOpenChange:b,className:"flex flex-col gap-2.5",children:[n.jsxs(Yu,{className:"group flex w-fit cursor-pointer items-center gap-1.5",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Advanced"}),n.jsx(js,{size:14,className:"text-muted-foreground/60 transition-transform group-data-[state=open]:rotate-180"})]}),n.jsxs(Xu,{className:"flex flex-col gap-5 pt-0.5",children:[n.jsx(vx,{tier:$.watch("tier"),onTierChange:z=>$.setValue("tier",z,{shouldDirty:!0}),override:$.watch("modelOverride"),onOverrideChange:z=>$.setValue("modelOverride",z,{shouldDirty:!0})}),n.jsx(Sx,{agentId:r||null,value:$.watch("tools"),onChange:z=>$.setValue("tools",z,{shouldDirty:!0})}),n.jsxs("div",{className:"flex flex-col gap-2",children:[n.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Max steps"}),n.jsx(qe,{type:"number",min:1,max:100,className:"w-40",placeholder:`${Lx} (default)`,value:$.watch("maxAgentSteps")??"",onChange:z=>{const le=z.target.value.trim(),ue=le===""?null:Number(le);$.setValue("maxAgentSteps",ue===null||Number.isNaN(ue)?null:ue,{shouldDirty:!0})}})]})]})]})]})]})}function Ws(){const t=H.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{"data-testid":"main-panel-loading",className:"flex h-full w-full items-center justify-center",children:n.jsx(we,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}const ld=[{key:"24h",label:"Last 24 hours",ms:1440*60*1e3},{key:"7d",label:"Last 7 days",ms:10080*60*1e3},{key:"30d",label:"Last 30 days",ms:720*60*60*1e3}];function cd(t){const e=ld.find(i=>i.key===t).ms,s=Date.now();return{startDate:new Date(s-e).toISOString(),endDate:new Date(s).toISOString()}}function Ux(t){const e=H.c(12),{automationId:s,triggerIds:i}=t,[r,o]=R.useState("30d"),[a,l]=R.useState(Vx);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=p=>{const _=p;o(_),l(cd(_))},e[0]=h):h=e[0];let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Et,{className:"w-44",children:n.jsx(Tt,{})}),e[1]=c):c=e[1];let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Rt,{children:ld.map(Kx)}),e[2]=d):d=e[2];let u;e[3]!==r?(u=n.jsx("div",{className:"flex items-center justify-end",children:n.jsxs(Pt,{value:r,onValueChange:h,children:[c,d]})}),e[3]=r,e[4]=u):u=e[4];let f;e[5]!==s||e[6]!==a||e[7]!==i?(f=n.jsx(Vm,{automationId:s,triggerIds:i,range:a}),e[5]=s,e[6]=a,e[7]=i,e[8]=f):f=e[8];let m;return e[9]!==u||e[10]!==f?(m=n.jsxs("div",{className:"flex flex-col gap-5",children:[u,f]}),e[9]=u,e[10]=f,e[11]=m):m=e[11],m}function Kx(t){return n.jsx(lt,{value:t.key,children:t.label},t.key)}function Vx(){return cd("30d")}function qx(t){const e=H.c(5),{tabId:s}=t;let i;e[0]!==s?(i=Mc(s),e[0]=s,e[1]=i):i=e[1];const r=i;if(!r)return null;let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(Ws,{}),e[2]=o):o=e[2];let a;return e[3]!==r.id?(a=n.jsx(R.Suspense,{fallback:o,children:n.jsx(Gx,{id:r.id})}),e[3]=r.id,e[4]=a):a=e[4],a}function Gx(t){const e=H.c(24),{id:s}=t,i=Qt(),{data:r,isLoading:o}=Hm(s),[a,l]=R.useState("settings");let h;e[0]!==i?(h=()=>{i({to:".",search:Xx,replace:!0})},e[0]=i,e[1]=h):h=e[1];const c=h;if(o){let b;return e[2]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(Ws,{}),e[2]=b):b=e[2],b}if(!r){let b;return e[3]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=b):b=e[3],b}let d;e[4]!==r.triggers?(d=r.triggers.map(Yx),e[4]=r.triggers,e[5]=d):d=e[5];const u=d;let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(th,{size:14}),e[6]=f):f=e[6];let m;e[7]!==c?(m=n.jsxs(se,{variant:"ghost",size:"sm",onClick:c,children:[f,"Back to list"]}),e[7]=c,e[8]=m):m=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=[{id:"settings",label:"Settings"},{id:"runs",label:"Runs"}],e[9]=p):p=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=b=>l(b),e[10]=_):_=e[10];let v;e[11]!==a?(v=n.jsx(Xc,{tabs:p,activeTab:a,onTabChange:_}),e[11]=a,e[12]=v):v=e[12];let x;e[13]!==m||e[14]!==v?(x=n.jsxs("div",{className:"flex items-center justify-between pb-4 shrink-0",children:[m,v]}),e[13]=m,e[14]=v,e[15]=x):x=e[15];let y;e[16]!==r||e[17]!==s||e[18]!==a||e[19]!==u?(y=a==="settings"?n.jsx(Wx,{automationId:s,automation:r}):n.jsx(Ux,{automationId:s,triggerIds:u}),e[16]=r,e[17]=s,e[18]=a,e[19]=u,e[20]=y):y=e[20];let g;return e[21]!==x||e[22]!==y?(g=n.jsx(Nt,{children:n.jsx(Nt.Content,{children:n.jsxs(Nt.Body,{children:[x,y]})})}),e[21]=x,e[22]=y,e[23]=g):g=e[23],g}function Yx(t){return t.id}function Xx(t){return{...t,main:"automations"}}function Jx(t){const e=H.c(20),{virtualMcpId:s}=t,i=Qt(),{data:r}=Wm(s),o=r===void 0?[]:r,{create:a}=Ui(),[l,h]=R.useState(""),c=l.toLowerCase(),d=o.filter(P=>P.name.toLowerCase().includes(c));let u;e[0]!==i?(u=P=>i({to:".",search:j=>({...j,main:"automation:"+P}),replace:!0}),e[0]=i,e[1]=u):u=e[1];const f=u,m=async()=>{if(a.isPending)return;Le("automation_new_clicked",{virtual_mcp_id:s,existing_count:o.length});const P=await a.mutateAsync(Um(s));f(P.id)};let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(At,{size:14}),e[2]=p):p=e[2];let _;e[3]!==a.isPending||e[4]!==m?(_=n.jsxs(se,{size:"sm",onClick:m,disabled:a.isPending,children:[p,"New automation"]}),e[3]=a.isPending,e[4]=m,e[5]=_):_=e[5];const v=_,x=Nt,y=Nt,g=Nt;let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(Nt.Title,{children:"Automations"}),e[6]=b):b=e[6];const S=o.length>0&&n.jsx(Yc,{value:l,onChange:h,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let w;e[7]!==v||e[8]!==S?(w=n.jsxs("div",{className:"flex flex-col gap-6",children:[b,n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[S,v]})]}),e[7]=v,e[8]=S,e[9]=w):w=e[9];const k=o.length===0?n.jsx("div",{className:"flex items-center justify-center py-20",children:n.jsx(wr,{image:n.jsx(Bi,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:v})}):d.length===0?n.jsx("div",{className:"flex items-center justify-center py-20",children:n.jsx(wr,{image:n.jsx(Bi,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${l}"`})}):n.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:d.map(P=>n.jsx(qm,{automation:P,onClick:()=>f(P.id)},P.id))});let N;e[10]!==k||e[11]!==g.Body||e[12]!==w?(N=n.jsxs(g.Body,{children:[w,k]}),e[10]=k,e[11]=g.Body,e[12]=w,e[13]=N):N=e[13];let D;e[14]!==N||e[15]!==y.Content?(D=n.jsx(y.Content,{children:N}),e[14]=N,e[15]=y.Content,e[16]=D):D=e[16];let I;return e[17]!==x||e[18]!==D?(I=n.jsx(x,{children:D}),e[17]=x,e[18]=D,e[19]=I):I=e[19],I}function Zx(t){const e=H.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(Ws,{}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=n.jsx(R.Suspense,{fallback:i,children:n.jsx(Jx,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}function Qx(){const t=H.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(gs,{className:"h-6 w-2/3"}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"flex h-full w-full items-center justify-center bg-white",children:n.jsxs("div",{className:"flex w-3/4 max-w-md flex-col gap-3 p-6",children:[e,n.jsxs("div",{className:"flex flex-col gap-1.5",children:[n.jsx(gs,{className:"h-3 w-full"}),n.jsx(gs,{className:"h-3 w-5/6"}),n.jsx(gs,{className:"h-3 w-2/3"})]}),n.jsx(gs,{className:"mt-2 h-8 w-24"})]})}),t[1]=s):s=t[1],s}function eb(t,e){for(let s=t.length-1;s>=0;s--){const i=t[s]?.parts;if(i)for(let r=i.length-1;r>=0;r--){const o=i[r];if(!o||o.type!=="data-html-page-published")continue;const a=o.data;if(a&&a.slug===e)return a}}return null}function tb(t){const e=H.c(11),{slug:s}=t,i=$u();let r;e[0]!==i?.messages?(r=i?.messages??[],e[0]=i?.messages,e[1]=r):r=e[1];const o=r;let a;e[2]!==o||e[3]!==s?(a=eb(o,s),e[2]=o,e[3]=s,e[4]=a):a=e[4];const l=a;if(!l){let f;return e[5]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("div",{className:"h-full w-full bg-background",children:n.jsx(Qx,{})}),e[5]=f):f=e[5],f}const h=l.url,c=String(l.bytes),d=`${s}.html`;let u;return e[6]!==l.url||e[7]!==s||e[8]!==c||e[9]!==d?(u=n.jsx(Hc,{readUrl:h,marker:c,title:d},s),e[6]=l.url,e[7]=s,e[8]=c,e[9]=d,e[10]=u):u=e[10],u}function sb(t){const e=H.c(37),{file:s,onClose:i}=t;let r,o;e[0]!==s.filename?(r=n.jsx(Mo,{filename:s.filename,className:"h-4.5 w-3.5 shrink-0"}),o=n.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:s.filename}),e[0]=s.filename,e[1]=r,e[2]=o):(r=e[1],o=e[2]);let a;e[3]!==s.size?(a=Xf(s.size),e[3]=s.size,e[4]=a):a=e[4];let l;e[5]!==a?(l=n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:a}),e[5]=a,e[6]=l):l=e[6];let h;e[7]!==r||e[8]!==o||e[9]!==l?(h=n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2",children:[r,o,l]}),e[7]=r,e[8]=o,e[9]=l,e[10]=h):h=e[10];let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Hf,{size:14}),e[11]=c):c=e[11];let d;e[12]!==s.downloadUrl||e[13]!==s.filename?(d=n.jsx(Te,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",asChild:!0,children:n.jsx("a",{href:s.downloadUrl,download:s.filename,children:c})})}),e[12]=s.downloadUrl,e[13]=s.filename,e[14]=d):d=e[14];let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Re,{side:"bottom",children:"Download"}),e[15]=u):u=e[15];let f;e[16]!==d?(f=n.jsxs(Pe,{children:[d,u]}),e[16]=d,e[17]=f):f=e[17];let m;e[18]!==s.downloadUrl?(m=()=>window.open(s.downloadUrl,"_blank","noopener"),e[18]=s.downloadUrl,e[19]=m):m=e[19];let p;e[20]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx(ti,{size:14}),e[20]=p):p=e[20];let _;e[21]!==m?(_=n.jsx(Te,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",onClick:m,children:p})}),e[21]=m,e[22]=_):_=e[22];let v;e[23]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx(Re,{side:"bottom",children:"Open in new tab"}),e[23]=v):v=e[23];let x;e[24]!==_?(x=n.jsxs(Pe,{children:[_,v]}),e[24]=_,e[25]=x):x=e[25];let y;e[26]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(fs,{size:14}),e[26]=y):y=e[26];let g;e[27]!==i?(g=n.jsx(Te,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"icon",onClick:i,children:y})}),e[27]=i,e[28]=g):g=e[28];let b;e[29]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(Re,{side:"bottom",children:"Close"}),e[29]=b):b=e[29];let S;e[30]!==g?(S=n.jsxs(Pe,{children:[g,b]}),e[30]=g,e[31]=S):S=e[31];let w;return e[32]!==x||e[33]!==S||e[34]!==h||e[35]!==f?(w=n.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[h,f,x,S]}),e[32]=x,e[33]=S,e[34]=h,e[35]=f,e[36]=w):w=e[36],w}function ib(t){const e=H.c(24),{fileKey:s,taskId:i}=t,r=Qt(),{data:o,isPending:a}=jc(i);let l;e[0]!==s||e[1]!==o?(l=o?.find(p=>p.key===s)??null,e[0]=s,e[1]=o,e[2]=l):l=e[2];const h=l;let c;e[3]!==r?(c=()=>r({to:".",search:rb,replace:!0}),e[3]=r,e[4]=c):c=e[4];const d=c;if(!h){if(a){let g;return e[5]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx("div",{className:"h-full w-full bg-background",children:n.jsx(Gf,{})}),e[5]=g):g=e[5],g}let p;e[6]!==s?(p=s.split("/").pop()??s,e[6]=s,e[7]=p):p=e[7];let _;e[8]!==p?(_=n.jsx(Mo,{filename:p,className:"h-7.5 w-6"}),e[8]=p,e[9]=_):_=e[9];let v;e[10]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("span",{className:"text-sm text-muted-foreground",children:"This file is no longer available."}),e[10]=v):v=e[10];let x;e[11]!==d?(x=n.jsx(se,{variant:"ghost",size:"sm",onClick:d,children:"Close"}),e[11]=d,e[12]=x):x=e[12];let y;return e[13]!==_||e[14]!==x?(y=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 bg-background",children:[_,v,x]}),e[13]=_,e[14]=x,e[15]=y):y=e[15],y}let u;e[16]!==h||e[17]!==d?(u=n.jsx(sb,{file:h,onClose:d}),e[16]=h,e[17]=d,e[18]=u):u=e[18];let f;e[19]!==h?(f=n.jsx("div",{className:"relative min-h-0 flex-1",children:n.jsx(Yf,{file:h})}),e[19]=h,e[20]=f):f=e[20];let m;return e[21]!==u||e[22]!==f?(m=n.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[u,f]}),e[21]=u,e[22]=f,e[23]=m):m=e[23],m}function rb(t){return{...t,main:"0"}}const gl="home";function nb(t){const e=H.c(5),{label:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(gs,{className:"aspect-video w-2/3 max-w-xl"}),e[0]=i):i=e[0];let r;e[1]!==s?(r=s&&n.jsx("p",{className:"text-xs text-muted-foreground",children:s}),e[1]=s,e[2]=r):r=e[2];let o;return e[3]!==r?(o=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-background",children:[i,r]}),e[3]=r,e[4]=o):o=e[4],o}function ob(t){const e=H.c(12),{path:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={refetchIntervalWhenAbsent:2e3},e[0]=i):i=e[0];const r=Jf(gl,s,i),o=Zf(gl);let a;e[1]!==s||e[2]!==o?(a=o(s),e[1]=s,e[2]=o,e[3]=a):a=e[3];const l=a;if(r.isPending||!r.data){const d=!r.isPending&&!r.data?"Waiting for the deck to sync…":void 0;let u;return e[4]!==d?(u=n.jsx(nb,{label:d}),e[4]=d,e[5]=u):u=e[5],u}let h;e[6]!==r.data?(h=Qf(r.data),e[6]=r.data,e[7]=h):h=e[7];let c;return e[8]!==s||e[9]!==l||e[10]!==h?(c=n.jsx(Hc,{readUrl:l,marker:h,title:s,savePath:s}),e[8]=s,e[9]=l,e[10]=h,e[11]=c):c=e[11],c}const vl=R.lazy(()=>Kt(()=>import("./project-app-view-CLSVHcb8.js"),__vite__mapDeps([162,1,2,91,6,7,8,9,10,11,12,13,14,15,16,3,17,4,5,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,92,93,46,47,48,94,95,49,96,97,58,98,99,100,101,85,102,57,103,59,104,105,106,107,108,66,109,56,110,71,72,50,111,126])).then(t=>({default:t.AppViewContent})));function ab(t){const e=H.c(53),{activeTab:s,virtualMcpId:i,taskId:r,layoutTabs:o,expandedTools:a,automationTabParsed:l}=t;if(If(s)){let g;return e[0]!==i?(g=n.jsx(sl,{virtualMcpId:i}),e[0]=i,e[1]=g):g=e[1],g}if(s==="git"){let g;return e[2]!==i?(g=n.jsx(vv,{virtualMcpId:i}),e[2]=i,e[3]=g):g=e[3],g}if(s==="automations"){let g;return e[4]!==i?(g=n.jsx(Zx,{virtualMcpId:i}),e[4]=i,e[5]=g):g=e[5],g}if(s==="preview"){let g;return e[6]!==i?(g=n.jsx(d1,{virtualMcpId:i}),e[6]=i,e[7]=g):g=e[7],g}if(s==="content"){let g;return e[8]!==i?(g=n.jsx(px,{virtualMcpId:i}),e[8]=i,e[9]=g):g=e[9],g}if(l){let g;return e[10]!==s?(g=n.jsx(qx,{tabId:s}),e[10]=s,e[11]=g):g=e[11],g}let h;e[12]!==s?(h=Bf(s),e[12]=s,e[13]=h):h=e[13];const c=h;if(c){let g;return e[14]!==c.slug?(g=n.jsx(tb,{slug:c.slug}),e[14]=c.slug,e[15]=g):g=e[15],g}let d;e[16]!==s?(d=Oc(s),e[16]=s,e[17]=d):d=e[17];const u=d;if(u){let g;return e[18]!==u.path?(g=n.jsx(ob,{path:u.path},u.path),e[18]=u.path,e[19]=g):g=e[19],g}let f;e[20]!==s?(f=Lc(s),e[20]=s,e[21]=f):f=e[21];const m=f;if(m){let g;return e[22]!==m.key||e[23]!==r?(g=n.jsx(ib,{fileKey:m.key,taskId:r}),e[22]=m.key,e[23]=r,e[24]=g):g=e[24],g}let p;e[25]!==s?(p=Mf(s),e[25]=s,e[26]=p):p=e[26];const _=p;if(_){let g;if(e[27]!==a||e[28]!==_.connectionId||e[29]!==_.toolName){let N;e[31]!==_.connectionId||e[32]!==_.toolName?(N=D=>D.appId===_.connectionId&&D.toolName===_.toolName,e[31]=_.connectionId,e[32]=_.toolName,e[33]=N):N=e[33],g=a.find(N),e[27]=a,e[28]=_.connectionId,e[29]=_.toolName,e[30]=g}else g=e[30];const b=g;let S;e[34]===Symbol.for("react.memo_cache_sentinel")?(S=n.jsx(Ws,{}),e[34]=S):S=e[34];const w=b?.args;let k;return e[35]!==s||e[36]!==_.connectionId||e[37]!==_.toolName||e[38]!==w?(k=n.jsx(R.Suspense,{fallback:S,children:n.jsx(vl,{connectionId:_.connectionId,toolName:_.toolName,args:w},s)}),e[35]=s,e[36]=_.connectionId,e[37]=_.toolName,e[38]=w,e[39]=k):k=e[39],k}let v;if(e[40]!==s||e[41]!==o){let g;e[43]!==s?(g=b=>b.id===s,e[43]=s,e[44]=g):g=e[44],v=o.find(g),e[40]=s,e[41]=o,e[42]=v}else v=e[42];const x=v;if(x){let g;e[45]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(Ws,{}),e[45]=g):g=e[45];let b;return e[46]!==s||e[47]!==x.id||e[48]!==x.view.appId||e[49]!==x.view.args?(b=n.jsx(R.Suspense,{fallback:g,children:n.jsx(vl,{connectionId:x.view.appId,toolName:x.id,args:x.view.args},s)}),e[46]=s,e[47]=x.id,e[48]=x.view.appId,e[49]=x.view.args,e[50]=b):b=e[50],b}let y;return e[51]!==i?(y=n.jsx(sl,{virtualMcpId:i}),e[51]=i,e[52]=y):y=e[52],y}function lb(t){const e=H.c(14),{taskId:s,virtualMcpId:i}=t;let r;e[0]!==s||e[1]!==i?(r={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=r):r=e[2];const{activeTab:o,layoutTabs:a,expandedTools:l,automationTabParsed:h}=Eh(r);let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Ws,{}),e[3]=c):c=e[3];let d;e[4]!==o||e[5]!==h||e[6]!==l||e[7]!==a||e[8]!==s||e[9]!==i?(d=n.jsx(R.Suspense,{fallback:c,children:n.jsx(ab,{activeTab:o,virtualMcpId:i,taskId:s,layoutTabs:a,expandedTools:l,automationTabParsed:h})}),e[4]=o,e[5]=h,e[6]=l,e[7]=a,e[8]=s,e[9]=i,e[10]=d):d=e[10];let u;return e[11]!==o||e[12]!==d?(u=n.jsx(Ht,{children:d},o),e[11]=o,e[12]=d,e[13]=u):u=e[13],u}const bs="setup";function cb(t){const e=H.c(35);let s;if(e[0]!==t.scriptTabs||e[1]!==t.scripts){let m;e[3]!==t.scriptTabs?(m=p=>!t.scriptTabs.includes(p),e[3]=t.scriptTabs,e[4]=m):m=e[4],s=t.scripts.filter(m),e[0]=t.scriptTabs,e[1]=t.scripts,e[2]=s}else s=e[2];const i=s;let r;e[5]!==t?(r=()=>{t.active===bs?t.onToggle():t.onSelectTab(bs)},e[5]=t,e[6]=r):r=e[6];const o=r,a=t.active===bs;let l;e[7]!==o||e[8]!==t.open||e[9]!==a?(l=n.jsx(hb,{active:a,open:t.open,onClick:o}),e[7]=o,e[8]=t.open,e[9]=a,e[10]=l):l=e[10];let h;e[11]!==t?(h=t.scriptTabs.map(m=>n.jsx(ub,{active:t.active===m,onClick:()=>t.onSelectTab(m),onClose:()=>t.onCloseScript(m),children:m},m)),e[11]=t,e[12]=h):h=e[12];let c;e[13]!==i||e[14]!==t.onAddScript?(c=n.jsx(fb,{scripts:i,onRun:t.onAddScript}),e[13]=i,e[14]=t.onAddScript,e[15]=c):c=e[15];let d;e[16]!==l||e[17]!==h||e[18]!==c?(d=n.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[l,h,c]}),e[16]=l,e[17]=h,e[18]=c,e[19]=d):d=e[19];let u;e[20]!==t.onRestart||e[21]!==t.onResume||e[22]!==t.onRetry||e[23]!==t.onRunActiveScript||e[24]!==t.onStart||e[25]!==t.onStop||e[26]!==t.onStopActiveScript||e[27]!==t.scriptIsKilling||e[28]!==t.scriptIsRunning||e[29]!==t.showScriptControls||e[30]!==t.status?(u=t.showScriptControls?n.jsx(mb,{isRunning:t.scriptIsRunning,isKilling:t.scriptIsKilling,onRun:t.onRunActiveScript,onStop:t.onStopActiveScript}):n.jsx(db,{status:t.status,onStart:t.onStart,onStop:t.onStop,onRestart:t.onRestart,onResume:t.onResume,onRetry:t.onRetry}),e[20]=t.onRestart,e[21]=t.onResume,e[22]=t.onRetry,e[23]=t.onRunActiveScript,e[24]=t.onStart,e[25]=t.onStop,e[26]=t.onStopActiveScript,e[27]=t.scriptIsKilling,e[28]=t.scriptIsRunning,e[29]=t.showScriptControls,e[30]=t.status,e[31]=u):u=e[31];let f;return e[32]!==d||e[33]!==u?(f=n.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-t border-b border-border bg-muted/60 px-3",children:[d,u]}),e[32]=d,e[33]=u,e[34]=f):f=e[34],f}function hb(t){const e=H.c(8),{active:s,open:i,onClick:r}=t,o=s&&i,a=s&&i,l=s?"border-border bg-background font-medium text-foreground shadow-sm":"border-transparent text-muted-foreground hover:bg-background/50 hover:text-foreground";let h;e[0]!==l?(h=ce("flex h-7 items-center gap-1.5 rounded-md border px-2.5 text-xs",l),e[0]=l,e[1]=h):h=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(Nf,{className:"size-3.5"}),e[2]=c):c=e[2];let d;return e[3]!==r||e[4]!==o||e[5]!==a||e[6]!==h?(d=n.jsxs("button",{type:"button","aria-pressed":o,"aria-expanded":a,onClick:r,className:h,children:[c,"sandbox"]}),e[3]=r,e[4]=o,e[5]=a,e[6]=h,e[7]=d):d=e[7],d}function db(t){const e=H.c(24),{status:s,onStart:i,onStop:r,onRestart:o,onResume:a,onRetry:l}=t;if(s==="idle"&&i){let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Fs,{className:"size-3.5"}),e[0]=h):h=e[0];let c;return e[1]!==i?(c=n.jsxs(se,{variant:"outline",size:"sm",onClick:i,children:[h," Start"]}),e[1]=i,e[2]=c):c=e[2],c}if(s==="suspended"&&a){let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Fs,{className:"size-3.5"}),e[3]=h):h=e[3];let c;return e[4]!==a?(c=n.jsxs(se,{variant:"outline",size:"sm",onClick:a,children:[h," Resume"]}),e[4]=a,e[5]=c):c=e[5],c}if(s==="errored"&&l){let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Di,{className:"size-3.5"}),e[6]=h):h=e[6];let c;return e[7]!==l?(c=n.jsxs(se,{variant:"outline",size:"sm",onClick:l,children:[h," Retry"]}),e[7]=l,e[8]=c):c=e[8],c}if(s==="starting"||s==="running"){const h=s==="running"&&!!o,c=h?"rounded-r-none border-r-0":void 0;let d;e[9]!==c?(d=ce(c),e[9]=c,e[10]=d):d=e[10];let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Ic,{className:"size-3.5"}),e[11]=u):u=e[11];let f;e[12]!==r||e[13]!==d?(f=n.jsx(Te,{asChild:!0,children:n.jsxs(se,{variant:"outline",size:"sm",onClick:r,className:d,children:[u," Stop"]})}),e[12]=r,e[13]=d,e[14]=f):f=e[14];let m;e[15]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Re,{children:"Stop sandbox"}),e[15]=m):m=e[15];let p;e[16]!==f?(p=n.jsxs(Pe,{children:[f,m]}),e[16]=f,e[17]=p):p=e[17];let _;e[18]!==o||e[19]!==h?(_=h&&n.jsxs(Js,{children:[n.jsx(Zs,{asChild:!0,children:n.jsx(se,{variant:"outline",size:"sm",className:"rounded-l-none px-1",children:n.jsx(js,{className:"size-3"})})}),n.jsx(Qs,{align:"end",children:n.jsxs(et,{onClick:o,children:[n.jsx(Di,{className:"size-3.5"})," Restart"]})})]}),e[18]=o,e[19]=h,e[20]=_):_=e[20];let v;return e[21]!==p||e[22]!==_?(v=n.jsxs("div",{className:"flex items-center",children:[p,_]}),e[21]=p,e[22]=_,e[23]=v):v=e[23],v}return null}function ub(t){const e=H.c(16),{active:s,onClick:i,onClose:r,children:o}=t,a=s?"border-border bg-background shadow-sm":"border-transparent hover:bg-background/50";let l;e[0]!==a?(l=ce("flex h-7 items-center rounded-md border text-xs",a),e[0]=a,e[1]=l):l=e[1];const h=r?"pl-2.5 pr-1":"px-2.5",c=s?"font-medium text-foreground":"text-muted-foreground hover:text-foreground";let d;e[2]!==h||e[3]!==c?(d=ce("flex h-full items-center",h,c),e[2]=h,e[3]=c,e[4]=d):d=e[4];let u;e[5]!==o||e[6]!==i||e[7]!==d?(u=n.jsx("button",{type:"button",onClick:i,className:d,children:o}),e[5]=o,e[6]=i,e[7]=d,e[8]=u):u=e[8];let f;e[9]!==o||e[10]!==r?(f=r&&n.jsx("button",{type:"button","aria-label":`Close ${o}`,onClick:r,className:"pr-1.5 text-muted-foreground hover:text-foreground",children:n.jsx(Gm,{className:"size-3"})}),e[9]=o,e[10]=r,e[11]=f):f=e[11];let m;return e[12]!==l||e[13]!==u||e[14]!==f?(m=n.jsxs("div",{className:l,children:[u,f]}),e[12]=l,e[13]=u,e[14]=f,e[15]=m):m=e[15],m}function fb(t){const e=H.c(10),{scripts:s,onRun:i}=t,[r,o]=R.useState(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsxs(Pe,{children:[n.jsx(Te,{asChild:!0,children:n.jsx(Es,{asChild:!0,children:n.jsx(se,{variant:"ghost",size:"sm","aria-label":"Run script",children:n.jsx(At,{className:"size-3.5"})})})}),n.jsx(Re,{children:"Run script"})]}),e[0]=a):a=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:"run a script"}),e[1]=l):l=e[1];let h;e[2]!==i||e[3]!==s?(h=s.length===0?n.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:"No scripts found"}):s.map(u=>n.jsxs("button",{type:"button",onClick:()=>{o(!1),i(u)},className:"w-full rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:["▸ ",u]},u)),e[2]=i,e[3]=s,e[4]=h):h=e[4];let c;e[5]!==h?(c=n.jsxs(Ts,{align:"start",className:"p-1 w-56",children:[l,h]}),e[5]=h,e[6]=c):c=e[6];let d;return e[7]!==r||e[8]!==c?(d=n.jsxs(Ns,{open:r,onOpenChange:o,children:[a,c]}),e[7]=r,e[8]=c,e[9]=d):d=e[9],d}function mb(t){const e=H.c(13),{isRunning:s,isKilling:i,onRun:r,onStop:o}=t;if(i){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsxs(se,{variant:"outline",size:"sm",disabled:!0,children:[n.jsx(we,{className:"size-3.5 animate-spin"})," Stopping…"]}),e[0]=d):d=e[0],d}if(!s){let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(Fs,{className:"size-3.5"}),e[1]=d):d=e[1];let u;e[2]!==r?(u=n.jsx(Te,{asChild:!0,children:n.jsxs(se,{variant:"outline",size:"sm",onClick:r,children:[d," Run"]})}),e[2]=r,e[3]=u):u=e[3];let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(Re,{children:"Start process"}),e[4]=f):f=e[4];let m;return e[5]!==u?(m=n.jsxs(Pe,{children:[u,f]}),e[5]=u,e[6]=m):m=e[6],m}let a;e[7]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Ic,{className:"size-3.5"}),e[7]=a):a=e[7];let l;e[8]!==o?(l=n.jsx(Te,{asChild:!0,children:n.jsxs(se,{variant:"outline",size:"sm",onClick:o,children:[a," Stop"]})}),e[8]=o,e[9]=l):l=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(Re,{children:"Stop process"}),e[10]=h):h=e[10];let c;return e[11]!==l?(c=n.jsxs(Pe,{children:[l,h]}),e[11]=l,e[12]=c):c=e[12],c}var hd=Object.defineProperty,pb=Object.getOwnPropertyDescriptor,_b=(t,e)=>{for(var s in e)hd(t,s,{get:e[s],enumerable:!0})},ze=(t,e,s,i)=>{for(var r=i>1?void 0:i?pb(e,s):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(i?a(e,s,r):a(r))||r);return i&&r&&hd(e,s,r),r},de=(t,e)=>(s,i)=>e(s,i,t),xl="Terminal input",Wn={get:()=>xl,set:t=>xl=t},bl="Too much output to announce, navigate to rows manually to read",Un={get:()=>bl,set:t=>bl=t};function gb(t){return t.replace(/\r?\n/g,"\r")}function vb(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function xb(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function bb(t,e,s,i){if(t.stopPropagation(),t.clipboardData){let r=t.clipboardData.getData("text/plain");dd(r,e,s,i)}}function dd(t,e,s,i){t=gb(t),t=vb(t,s.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),s.triggerDataEvent(t,!0),e.value=""}function ud(t,e,s){let i=s.getBoundingClientRect(),r=t.clientX-i.left-10,o=t.clientY-i.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${r}px`,e.style.top=`${o}px`,e.style.zIndex="1000",e.focus()}function yl(t,e,s,i,r){ud(t,e,s),r&&i.rightClickSelect(t),e.value=i.selectionText,e.select()}function cs(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function sn(t,e=0,s=t.length){let i="";for(let r=e;r<s;++r){let o=t[r];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var yb=class{constructor(){this._interim=0}clear(){this._interim=0}decode(t,e){let s=t.length;if(!s)return 0;let i=0,r=0;if(this._interim){let o=t.charCodeAt(r++);56320<=o&&o<=57343?e[i++]=(this._interim-55296)*1024+o-56320+65536:(e[i++]=this._interim,e[i++]=o),this._interim=0}for(let o=r;o<s;++o){let a=t.charCodeAt(o);if(55296<=a&&a<=56319){if(++o>=s)return this._interim=a,i;let l=t.charCodeAt(o);56320<=l&&l<=57343?e[i++]=(a-55296)*1024+l-56320+65536:(e[i++]=a,e[i++]=l);continue}a!==65279&&(e[i++]=a)}return i}},Sb=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(t,e){let s=t.length;if(!s)return 0;let i=0,r,o,a,l,h=0,c=0;if(this.interim[0]){let f=!1,m=this.interim[0];m&=(m&224)===192?31:(m&240)===224?15:7;let p=0,_;for(;(_=this.interim[++p]&63)&&p<4;)m<<=6,m|=_;let v=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,x=v-p;for(;c<x;){if(c>=s)return 0;if(_=t[c++],(_&192)!==128){c--,f=!0;break}else this.interim[p++]=_,m<<=6,m|=_&63}f||(v===2?m<128?c--:e[i++]=m:v===3?m<2048||m>=55296&&m<=57343||m===65279||(e[i++]=m):m<65536||m>1114111||(e[i++]=m)),this.interim.fill(0)}let d=s-4,u=c;for(;u<s;){for(;u<d&&!((r=t[u])&128)&&!((o=t[u+1])&128)&&!((a=t[u+2])&128)&&!((l=t[u+3])&128);)e[i++]=r,e[i++]=o,e[i++]=a,e[i++]=l,u+=4;if(r=t[u++],r<128)e[i++]=r;else if((r&224)===192){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(h=(r&31)<<6|o&63,h<128){u--;continue}e[i++]=h}else if((r&240)===224){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,i;if(a=t[u++],(a&192)!==128){u--;continue}if(h=(r&15)<<12|(o&63)<<6|a&63,h<2048||h>=55296&&h<=57343||h===65279)continue;e[i++]=h}else if((r&248)===240){if(u>=s)return this.interim[0]=r,i;if(o=t[u++],(o&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,i;if(a=t[u++],(a&192)!==128){u--;continue}if(u>=s)return this.interim[0]=r,this.interim[1]=o,this.interim[2]=a,i;if(l=t[u++],(l&192)!==128){u--;continue}if(h=(r&7)<<18|(o&63)<<12|(a&63)<<6|l&63,h<65536||h>1114111)continue;e[i++]=h}}return i}},fd="",hs=" ",Gi=class md{constructor(){this.fg=0,this.bg=0,this.extended=new Or}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new md;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Or=class pd{constructor(e=0,s=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=s}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new pd(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},kt=class _d extends Gi{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Or,this.combinedData=""}static fromCharData(e){let s=new _d;return s.setFromCharData(e),s}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?cs(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let s=!1;if(e[1].length>2)s=!0;else if(e[1].length===2){let i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(i-55296)*1024+r-56320+65536|e[2]<<22:s=!0}else s=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;s&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Sl="di$target",Kn="di$dependencies",xn=new Map;function wb(t){return t[Kn]||[]}function st(t){if(xn.has(t))return xn.get(t);let e=function(s,i,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Cb(e,s,r)};return e._id=t,xn.set(t,e),e}function Cb(t,e,s){e[Sl]===e?e[Kn].push({id:t,index:s}):(e[Kn]=[{id:t,index:s}],e[Sl]=e)}var dt=st("BufferService"),gd=st("CoreMouseService"),Ds=st("CoreService"),kb=st("CharsetService"),_a=st("InstantiationService"),vd=st("LogService"),ut=st("OptionsService"),xd=st("OscLinkService"),jb=st("UnicodeService"),Yi=st("DecorationService"),Vn=class{constructor(t,e,s){this._bufferService=t,this._optionsService=e,this._oscLinkService=s}provideLinks(t,e){let s=this._bufferService.buffer.lines.get(t-1);if(!s){e(void 0);return}let i=[],r=this._optionsService.rawOptions.linkHandler,o=new kt,a=s.getTrimmedLength(),l=-1,h=-1,c=!1;for(let d=0;d<a;d++)if(!(h===-1&&!s.hasContent(d))){if(s.loadCell(d,o),o.hasExtendedAttrs()&&o.extended.urlId)if(h===-1){h=d,l=o.extended.urlId;continue}else c=o.extended.urlId!==l;else h!==-1&&(c=!0);if(c||h!==-1&&d===a-1){let u=this._oscLinkService.getLinkData(l)?.uri;if(u){let f={start:{x:h+1,y:t},end:{x:d+(!c&&d===a-1?1:0),y:t}},m=!1;if(!r?.allowNonHttpProtocols)try{let p=new URL(u);["http:","https:"].includes(p.protocol)||(m=!0)}catch{m=!0}m||i.push({text:u,range:f,activate:(p,_)=>r?r.activate(p,_,f):Nb(p,_),hover:(p,_)=>r?.hover?.(p,_,f),leave:(p,_)=>r?.leave?.(p,_,f)})}c=!1,o.hasExtendedAttrs()&&o.extended.urlId?(h=d,l=o.extended.urlId):(h=-1,l=-1)}}e(i)}};Vn=ze([de(0,dt),de(1,ut),de(2,xd)],Vn);function Nb(t,e){if(confirm(`Do you want to navigate to ${e}?
|
|
294
294
|
|
|
295
295
|
WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var rn=st("CharSizeService"),is=st("CoreBrowserService"),ga=st("MouseService"),rs=st("RenderService"),Eb=st("SelectionService"),bd=st("CharacterJoinerService"),ni=st("ThemeService"),yd=st("LinkProviderService"),Tb=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?wl.isErrorNoTelemetry(t)?new wl(t.message+`
|
|
296
296
|
|