decocms 4.393.2 → 4.394.1
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-Bw5IjQll.js → AlertCircle-CXM-5Rz7.js} +1 -1
- package/dist/client/assets/{AreaChart-CoImiSZ8.js → AreaChart-DxwI5xUB.js} +1 -1
- package/dist/client/assets/{ArrowLeft-o7Y-fEOP.js → ArrowLeft-B3YAbOH6.js} +1 -1
- package/dist/client/assets/{ArrowRight-B9KOH6Mp.js → ArrowRight-BrNtBqRw.js} +1 -1
- package/dist/client/assets/{ArrowUp-siSqnojJ.js → ArrowUp-CCVu0dtU.js} +1 -1
- package/dist/client/assets/{CartesianChart-B_oczkwR.js → CartesianChart-uKRBU0va.js} +1 -1
- package/dist/client/assets/{Check-UJc6KAi4.js → Check-CnIdd_9P.js} +1 -1
- package/dist/client/assets/{CheckCircle-BMHJHOxj.js → CheckCircle-BildJHaa.js} +1 -1
- package/dist/client/assets/{ChevronUp-BfOf-CcT.js → ChevronUp-DParwzId.js} +1 -1
- package/dist/client/assets/{Copy01-jqAaecgQ.js → Copy01-Djbho_fP.js} +1 -1
- package/dist/client/assets/{CreditCard01-CTgYXlxC.js → CreditCard01-CQ0elRRK.js} +1 -1
- package/dist/client/assets/{DotsVertical-DtamlI3j.js → DotsVertical-BPj4OyP1.js} +1 -1
- package/dist/client/assets/{Download01-BncQoTgS.js → Download01-p7BaVRQl.js} +1 -1
- package/dist/client/assets/{ErrorBarContext-BO0Qz3lQ.js → ErrorBarContext-DrC_5_kc.js} +1 -1
- package/dist/client/assets/{Eye-B7WWrfVK.js → Eye-DFpsD3-a.js} +1 -1
- package/dist/client/assets/{Globe04-CvitSAdn.js → Globe04-BW7hjNq6.js} +1 -1
- package/dist/client/assets/{Image01-BcdinLnP.js → Image01-BkfcTYAd.js} +1 -1
- package/dist/client/assets/{Key01-DfBLIcDO.js → Key01-BEz5EbJj.js} +1 -1
- package/dist/client/assets/{LayoutLeft-fyXbrdze.js → LayoutLeft-KwKOo1M6.js} +1 -1
- package/dist/client/assets/{Line-Bve7YiyC.js → Line-Bh9Zwp5B.js} +1 -1
- package/dist/client/assets/{Link01-CUNNOfMo.js → Link01-D1OUtQsA.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CjlXJ8JK.js → LinkExternal01-Cd_eqSn4.js} +1 -1
- package/dist/client/assets/{Monitor01-Bgx96mK1.js → Monitor01-DHNiG9tA.js} +1 -1
- package/dist/client/assets/{Package-CCyqVpLL.js → Package-f83ypigE.js} +1 -1
- package/dist/client/assets/{Palette-uwPl9fbG.js → Palette-C6fwO9Ej.js} +1 -1
- package/dist/client/assets/{Plus-DVO5ynNJ.js → Plus-CDhl5xCv.js} +1 -1
- package/dist/client/assets/{SearchLg-BuXTAvmm.js → SearchLg-iC2PilRK.js} +1 -1
- package/dist/client/assets/{SearchMd-4YJlY5kp.js → SearchMd-DijM-rna.js} +1 -1
- package/dist/client/assets/{Sector-C0TyewPL.js → Sector-CwW8V-rW.js} +1 -1
- package/dist/client/assets/{Share07-slK9gs7d.js → Share07-9Pv8XJDP.js} +1 -1
- package/dist/client/assets/{Stars01-BHCqXxdF.js → Stars01-CICjpCeQ.js} +1 -1
- package/dist/client/assets/{Sun-CD9h4ghg.js → Sun-Bohup6gv.js} +1 -1
- package/dist/client/assets/{Tool01-BGKWFxqT.js → Tool01-9nUhyzqC.js} +1 -1
- package/dist/client/assets/{Trash01-elTVICGJ.js → Trash01-Cvwi9LBq.js} +1 -1
- package/dist/client/assets/{Upload01-C_pNo17d.js → Upload01-TIXouDH6.js} +1 -1
- package/dist/client/assets/{User01-A5ycKGmZ.js → User01-f_f_k-NW.js} +1 -1
- package/dist/client/assets/{UserSquare-CjWcARYJ.js → UserSquare-BPlvNEAJ.js} +1 -1
- package/dist/client/assets/{Users01-CYLXmuWv.js → Users01-C4iYsLmv.js} +1 -1
- package/dist/client/assets/{X-DfL64JB-.js → X-DhnelvIk.js} +1 -1
- package/dist/client/assets/{XCircle-Cn_6vXwx.js → XCircle-CtqXhxVA.js} +1 -1
- package/dist/client/assets/{XClose-B001-Pfs.js → XClose-DGXZ4fg-.js} +1 -1
- package/dist/client/assets/{Zap-vgIAjKVr.js → Zap-C3pVyYpl.js} +1 -1
- package/dist/client/assets/{ZoomOut-DckCENcg.js → ZoomOut-osLhZov2.js} +1 -1
- package/dist/client/assets/{access-gate-0Jk-hZos.js → access-gate-CtOmG54o.js} +1 -1
- package/dist/client/assets/{add-connection-dialog-CXhnysPD.js → add-connection-dialog-CkaqLQ_B.js} +1 -1
- package/dist/client/assets/{agent-analytics-BhYprSIO.js → agent-analytics-BVgXQTTS.js} +1 -1
- package/dist/client/assets/agent-app-we7QvT97.js +1 -0
- package/dist/client/assets/{agent-assets-CS42OR4f.js → agent-assets-BmnS8S5c.js} +1 -1
- package/dist/client/assets/{agent-automation-D1d7OJUi.js → agent-automation-DO4kYqen.js} +1 -1
- package/dist/client/assets/{agent-automations-CbaldEol.js → agent-automations-B6sekKfJ.js} +1 -1
- package/dist/client/assets/{agent-connect-sources-zJfGAKvI.js → agent-connect-sources-DTgt7Gwx.js} +1 -1
- package/dist/client/assets/agent-deck-CSguZN_R.js +1 -0
- package/dist/client/assets/{agent-e2e-BqhXL_2D.js → agent-e2e-Dp76_9ww.js} +1 -1
- package/dist/client/assets/{agent-experiments-D0OMBW0K.js → agent-experiments-ZwJjNy9a.js} +1 -1
- package/dist/client/assets/agent-file-D-FpfNVX.js +1 -0
- package/dist/client/assets/{agent-git-oYCjVN4D.js → agent-git-D3yWrT9Z.js} +1 -1
- package/dist/client/assets/{agent-hosting-DYUWky5K.js → agent-hosting-be4gqSAe.js} +1 -1
- package/dist/client/assets/{agent-icon-zd22KZWY.js → agent-icon-C40LDe51.js} +1 -1
- package/dist/client/assets/agent-library-file-DzcnTuNQ.js +1 -0
- package/dist/client/assets/{agent-monitor-ByQaXaRH.js → agent-monitor-C-s6d8Y9.js} +1 -1
- package/dist/client/assets/{agent-overview-DIOaHJov.js → agent-overview-Cm2DEncJ.js} +1 -1
- package/dist/client/assets/agent-settings-Cf3Dlc90.js +1 -0
- package/dist/client/assets/{agent-site-editor-ZmxLibT8.js → agent-site-editor-BCJIZmcI.js} +1 -1
- package/dist/client/assets/agent-site-editor-code-Z1d-UrAj.js +2 -0
- package/dist/client/assets/{agent-site-editor-content-DRt9vlIp.js → agent-site-editor-content-BQ81zNBR.js} +3 -3
- package/dist/client/assets/{agent-site-editor-preview-7Z9SMUI4.js → agent-site-editor-preview-B7VAJYTF.js} +3 -3
- package/dist/client/assets/agent-view-gBbUE21h.js +1 -0
- package/dist/client/assets/{agent-view-guard-B9HgiZ1B.js → agent-view-guard-bt0DdpVa.js} +1 -1
- package/dist/client/assets/{agents-list-DG9VPQx9.js → agents-list-B_lrtveA.js} +1 -1
- package/dist/client/assets/{ai-providers-0H-9yOOS.js → ai-providers-GYSe9z4X.js} +1 -1
- package/dist/client/assets/{alert-Buf9oiWa.js → alert-DC_XH-eC.js} +1 -1
- package/dist/client/assets/{alert-dialog-DG5_wKgz.js → alert-dialog-BPoVDBJC.js} +1 -1
- package/dist/client/assets/{api-keys-DcivUdvJ.js → api-keys-B5AqA74f.js} +1 -1
- package/dist/client/assets/api-keys-B_Re8wZf.js +1 -0
- package/dist/client/assets/app-editor-QZzUFuF6.js +1 -0
- package/dist/client/assets/{asset-utils-C3onDFgi.js → asset-utils-QwStCl5v.js} +1 -1
- package/dist/client/assets/{auth-53fyYgiO.js → auth-BgakXKPk.js} +1 -1
- package/dist/client/assets/{auth-catchall-DMZWFewT.js → auth-catchall-BSvctTRl.js} +1 -1
- package/dist/client/assets/{auth-entry-CFGe0IMr.js → auth-entry-B7cy63Y3.js} +1 -1
- package/dist/client/assets/{auth-split-layout-wTIwUQun.js → auth-split-layout-iqZdreL0.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-l6FFkSS7.js → authenticate-and-persist-oauth-F7mu2TFH.js} +1 -1
- package/dist/client/assets/{automation-list-row-DhjFlSDJ.js → automation-list-row-BGChUKLk.js} +1 -1
- package/dist/client/assets/{automation-runs-mbixKpuo.js → automation-runs-CfOBIaRM.js} +1 -1
- package/dist/client/assets/{automations-CTADvQov.js → automations-R040IPvj.js} +1 -1
- package/dist/client/assets/{autosend-DAAxKqft.js → autosend-DY4nuzcJ.js} +1 -1
- package/dist/client/assets/{avatar-DfT409hq.js → avatar-BO6f7Nen.js} +1 -1
- package/dist/client/assets/{badge-CbxyjOGk.js → badge-D58LQVmM.js} +1 -1
- package/dist/client/assets/{block-document-DbC1itU8.js → block-document-DXUpHWMb.js} +1 -1
- package/dist/client/assets/{blocks-preview-workspace-context-B1GaYQuE.js → blocks-preview-workspace-context-CuAv2d69.js} +1 -1
- package/dist/client/assets/{breadcrumb-DHQJNhJR.js → breadcrumb-7g2D2eCC.js} +1 -1
- package/dist/client/assets/{buckets-4eM8JDqA.js → buckets-DyGYQOLI.js} +1 -1
- package/dist/client/assets/{build-improve-prompt-doc-B9GRKFtg.js → build-improve-prompt-doc-X873NwXi.js} +1 -1
- package/dist/client/assets/{calendar-BARhOOLs.js → calendar-KWF_SVkQ.js} +1 -1
- package/dist/client/assets/{capability-load-error-ULojqFhh.js → capability-load-error-DeRvdD2N.js} +1 -1
- package/dist/client/assets/{category-editor-Ci_lv1Kn.js → category-editor-p_MZjxaR.js} +1 -1
- package/dist/client/assets/{chart-B51bLH2f.js → chart-DOTjfLyB.js} +1 -1
- package/dist/client/assets/{chat-context-Biuolo5l.js → chat-context-CjFWcjj8.js} +1 -1
- package/dist/client/assets/{chat-draft-DVuLPy-j.js → chat-draft-D6ZtIQOo.js} +1 -1
- package/dist/client/assets/{checkbox-wlUWF7hx.js → checkbox-jPE8EKcD.js} +1 -1
- package/dist/client/assets/{choose-editor-CfaxqMkO.js → choose-editor-lSjicikt.js} +1 -1
- package/dist/client/assets/{claim-phase-copy-CCRVAHif.js → claim-phase-copy-DKro4CLJ.js} +1 -1
- package/dist/client/assets/{cli-auth-success-CP3p1uvq.js → cli-auth-success-Cpf3da1b.js} +1 -1
- package/dist/client/assets/{client-icons-BR1lKQvc.js → client-icons-BVjv8GX_.js} +1 -1
- package/dist/client/assets/{collapsible-CNrrD80N.js → collapsible-BJhhf5cl.js} +1 -1
- package/dist/client/assets/{collection-detail-DlQAEEKO.js → collection-detail-DZBhG8Cc.js} +1 -1
- package/dist/client/assets/{collection-display-button-CYn3y4wE.js → collection-display-button-DPG0Jqej.js} +1 -1
- package/dist/client/assets/{collection-search-eq8Jx08C.js → collection-search-BPxzI8So.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-UUqdFF6D.js → collection-table-wrapper-thQp3riX.js} +1 -1
- package/dist/client/assets/{collection-tabs-DOg1wSrf.js → collection-tabs-CbAt3PeF.js} +1 -1
- package/dist/client/assets/{combobox-DjacBfQl.js → combobox-CZs2qxm5.js} +1 -1
- package/dist/client/assets/{command-fcrvAs5N.js → command-CHrqGr18.js} +1 -1
- package/dist/client/assets/{companion-mcps-section-BUgcQwu4.js → companion-mcps-section-4VaMb8W2.js} +1 -1
- package/dist/client/assets/{connect-layout-we_wWtwn.js → connect-layout-CC5nFb3h.js} +1 -1
- package/dist/client/assets/{connect-CXE8VD1-.js → connect-uejxxmJ7.js} +1 -1
- package/dist/client/assets/{connection-N1n0cOU1.js → connection-BU15Ak08.js} +1 -1
- package/dist/client/assets/{connection-card-CimJ0_Nn.js → connection-card-tGUmmCol.js} +1 -1
- package/dist/client/assets/{connection-detail-DvIWvhqF.js → connection-detail-D2NXQ0kX.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-B3f1xsmc.js → connection-form-helpers-Dk8X8hjm.js} +1 -1
- package/dist/client/assets/{connections-3TDgqTMn.js → connections-BPhzZGsw.js} +1 -1
- package/dist/client/assets/{context-CebZ2Cct.js → context-BZ4dlasJ.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-BdCFwYq9.js → create-organization-dialog-C6pH6kpU.js} +1 -1
- package/dist/client/assets/{decofile-api-CPs_PsP6.js → decofile-api-CXdlJ97I.js} +1 -1
- package/dist/client/assets/{decopilot-4O7tybPz.js → decopilot-anarTI9Z.js} +1 -1
- package/dist/client/assets/{dialog-Fq0nM2c3.js → dialog-Bk6Kebro.js} +1 -1
- package/dist/client/assets/{discover-BU5y4Bvv.js → discover-BnQSJS-Y.js} +1 -1
- package/dist/client/assets/{domain-settings-BDx0Eb04.js → domain-settings-CnAnvCn1.js} +1 -1
- package/dist/client/assets/{download-app-dialog-B3AxYOeQ.js → download-app-dialog-M-OyFRiD.js} +1 -1
- package/dist/client/assets/{drawer-BUmwqcdF.js → drawer-D7efinO8.js} +1 -1
- package/dist/client/assets/{editor-DWYOPm_Z.js → editor-Byu9zxpQ.js} +1 -1
- package/dist/client/assets/{empty-state-yvdmqB8T.js → empty-state-CdYt7xiu.js} +1 -1
- package/dist/client/assets/{empty-state-gX-Wv4YC.js → empty-state-DoF0BaTp.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BOVjMhIV.js → extract-connection-data-DE98Pr_f.js} +1 -1
- package/dist/client/assets/{feature-gate-CRsogGiy.js → feature-gate-D2XOux_E.js} +1 -1
- package/dist/client/assets/{feature-paywall-CEyVPyUB.js → feature-paywall-WqX4N2SW.js} +1 -1
- package/dist/client/assets/{file-explorer-Bspsi2W2.js → file-explorer-CLaU0QHe.js} +1 -1
- package/dist/client/assets/{file-preview-AD_9B9zi.js → file-preview-D8ksk_w5.js} +1 -1
- package/dist/client/assets/{file-share-button-DkWghzVW.js → file-share-button-DTZrD03G.js} +1 -1
- package/dist/client/assets/{file-type-icon-Ba6U7kMI.js → file-type-icon-CcAkuhGz.js} +1 -1
- package/dist/client/assets/{folder-icon-DaSOqQDi.js → folder-icon-CIG_0-aE.js} +1 -1
- package/dist/client/assets/{form-DwboDCoC.js → form-yADqZdIk.js} +1 -1
- package/dist/client/assets/{gateway-client-U-aebFOp.js → gateway-client-CFQJjrMC.js} +1 -1
- package/dist/client/assets/{general-Bu1PxERY.js → general-Cxeff6xu.js} +1 -1
- package/dist/client/assets/{github-icon-Bczff7w9.js → github-icon-Cj-t_NbO.js} +1 -1
- package/dist/client/assets/{home-CCdzOU8E.js → home-Cdus7b2q.js} +1 -1
- package/dist/client/assets/{hooks-AXSBDhcZ.js → hooks-kbqC4sX2.js} +1 -1
- package/dist/client/assets/{icon-button-DN7NI2o6.js → icon-button-nhtw255Q.js} +1 -1
- package/dist/client/assets/{index-D8J5Sxky.js → index-4JYZTET6.js} +1 -1
- package/dist/client/assets/{index-C-DpAA_l.js → index-5VocAeHe.js} +1 -1
- package/dist/client/assets/{index-BDb83FE4.js → index-BL96eh6k.js} +1 -1
- package/dist/client/assets/{index-BQxAqOiP.js → index-BVycWIXw.js} +1 -1
- package/dist/client/assets/{index-BMy4NaZ7.js → index-BXBYdF58.js} +1 -1
- package/dist/client/assets/{index-CDlZjUqm.js → index-ByDx_xDD.js} +1 -1
- package/dist/client/assets/{index-C9q3x3zt.js → index-C2vMrEI2.js} +1 -1
- package/dist/client/assets/{index-CCj1WqkC.js → index-CI15jWLi.js} +1 -1
- package/dist/client/assets/{index-8CYOhgaG.js → index-CrI8ki7b.js} +1 -1
- package/dist/client/assets/{index-jpNIlPuy.js → index-Ctvi-936.js} +2 -2
- package/dist/client/assets/{index-Bry0pxcS.js → index-D-twJqnH.js} +1 -1
- package/dist/client/assets/{index-B0qklDzl.js → index-D91_sB2D.js} +1 -1
- package/dist/client/assets/{index-ClatepTO.js → index-DWshJHD1.js} +1 -1
- package/dist/client/assets/{index-CBBWa_aS.js → index-DfHYnQwP.js} +1 -1
- package/dist/client/assets/{index-redirect-C6u8gj-W.js → index-redirect-Bxuauhr8.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-Bh_fjXey.js → infiniteQueryObserver-CRTWhkev.js} +1 -1
- package/dist/client/assets/{infra-billing-CSgHD_R2.js → infra-billing-DV50mXoV.js} +1 -1
- package/dist/client/assets/{input-CxmpW7Ek.js → input-4KygrXS3.js} +1 -1
- package/dist/client/assets/{input-B1-dAf6o.js → input-B4Ywlnxu.js} +1 -1
- package/dist/client/assets/{input-AEl9FaSr.js → input-CZ4uOfP7.js} +1 -1
- package/dist/client/assets/{integration-icon-D86q1Lsj.js → integration-icon-D6hgdg1a.js} +1 -1
- package/dist/client/assets/{label-oK9z5afE.js → label-Dc4_9UuZ.js} +1 -1
- package/dist/client/assets/{last-preview-page-BZ6mQEgl.js → last-preview-page-Ci9WVFU1.js} +1 -1
- package/dist/client/assets/{layout-rWWMXjrM.js → layout-D5wNgDqD.js} +1 -1
- package/dist/client/assets/{legacy-agents-deep-D75KaBzt.js → legacy-agents-deep-BuFPR5Dr.js} +1 -1
- package/dist/client/assets/{legacy-main-redirect-BYmbBZTf.js → legacy-main-redirect-DxtE2lpL.js} +1 -1
- package/dist/client/assets/{library-LbSkWNn5.js → library-7RQ0OH0a.js} +1 -1
- package/dist/client/assets/{login-C5K6zPK9.js → login-BrkYVdsF.js} +1 -1
- package/dist/client/assets/{markdown-DewRRxkR.js → markdown-CtwwBnw-.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-B8WWFBjV.js → mcp-app-renderer-Dq1cvi8J.js} +1 -1
- package/dist/client/assets/{mcp-oauth-DF-3wjVL.js → mcp-oauth-BRXSxyQ5.js} +1 -1
- package/dist/client/assets/{members-gpZjw-0e.js → members-C7q6WTYo.js} +1 -1
- package/dist/client/assets/{message-templates-CGvvfznj.js → message-templates-CNlZffMe.js} +1 -1
- package/dist/client/assets/{mini-report-page-B18w4HJM.js → mini-report-page-B7riMwpu.js} +1 -1
- package/dist/client/assets/{mock-board-PHDWZ5Rj.js → mock-board-DFyLglyW.js} +3 -3
- package/dist/client/assets/{monaco-editor-1VDRMi5Z.js → monaco-editor-BweBeJgW.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-BTHr4fZ5.js → monitoring-stats-row-LXyxpppZ.js} +1 -1
- package/dist/client/assets/{multi-select-_hBjuZhJ.js → multi-select-DKiX05Od.js} +1 -1
- package/dist/client/assets/{mustache-qkuFcNLb.js → mustache-Dlj2nDy_.js} +1 -1
- package/dist/client/assets/{oauth-callback-B1Uai9y4.js → oauth-callback-CUQaKNOj.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-glRwYBh0.js → oauth-callback-ai-provider-6jhyo-1Y.js} +1 -1
- package/dist/client/assets/{onboarding-DDANr9IQ.js → onboarding-esH6tacq.js} +1 -1
- package/dist/client/assets/{optimistic-project-sidebar-views-DMA4YBZs.js → optimistic-project-sidebar-views-CV84-v_q.js} +1 -1
- package/dist/client/assets/{org-file-open-context-CcPURBkR.js → org-file-open-context-D6JnFB7u.js} +1 -1
- package/dist/client/assets/{organization-choice-q4iDzxaT.js → organization-choice-DGvP5PSP.js} +1 -1
- package/dist/client/assets/{orgs-B2MwX22p.js → orgs-PAwK_d7y.js} +1 -1
- package/dist/client/assets/{page-seo-form-DPxJXv8-.js → page-seo-form-Waol77Ye.js} +1 -1
- package/dist/client/assets/{pair-C60j_huQ.js → pair-YOxT8Y4Z.js} +1 -1
- package/dist/client/assets/{plan-ladder-DiEGIMNA.js → plan-ladder-BdATUMxp.js} +1 -1
- package/dist/client/assets/{popover-Ddu4iAPr.js → popover-D2pg0djS.js} +1 -1
- package/dist/client/assets/{post-calendar-DmX3brDp.js → post-calendar-90hRn09B.js} +1 -1
- package/dist/client/assets/{post-editor-DDpQa9aK.js → post-editor-toOl1XPu.js} +1 -1
- package/dist/client/assets/{preview-content-nP7rYoVp.js → preview-content-DGYApj6G.js} +1 -1
- package/dist/client/assets/{preview-dialog-DVTbqSrZ.js → preview-dialog-DstuX_q3.js} +1 -1
- package/dist/client/assets/{profile-DH86JppE.js → profile-D9VmgzdF.js} +1 -1
- package/dist/client/assets/{project-app-view-D1ahOteG.js → project-app-view-Bj4B5ujj.js} +1 -1
- package/dist/client/assets/{project-feed-DcdY9b8p.js → project-feed-BejPNAee.js} +1 -1
- package/dist/client/assets/{project-icon-CE-voYeF.js → project-icon-DlAGbT7n.js} +1 -1
- package/dist/client/assets/project-reports-CHaVa96y.js +1 -0
- package/dist/client/assets/project-tasks-Dz5HNBUY.js +1 -0
- package/dist/client/assets/{prompts-B0m81b-P.js → prompts-DS4syWKk.js} +1 -1
- package/dist/client/assets/record-editor-BsPd7bUQ.js +1 -0
- package/dist/client/assets/{redirect-editor-BxGeAe1m.js → redirect-editor-Q-scXYpH.js} +1 -1
- package/dist/client/assets/reports-BC5H34Yq.js +1 -0
- package/dist/client/assets/{reports-BGuoAK-j.js → reports-C238E7mI.js} +1 -1
- package/dist/client/assets/{reports-onboarding-BSr5xqLY.js → reports-onboarding-BOrjJHjc.js} +1 -1
- package/dist/client/assets/{reports-tab-Dv1b1trN.js → reports-tab-Ci7cenVz.js} +2 -2
- package/dist/client/assets/{repositories-DhDdUI7t.js → repositories-C38auUOb.js} +1 -1
- package/dist/client/assets/{repository-import-picker-DQ2X5vYR.js → repository-import-picker-Dj8KeUA4.js} +1 -1
- package/dist/client/assets/{repository-picker-DuUqRm8X.js → repository-picker-D0Lk5dyv.js} +1 -1
- package/dist/client/assets/{require-capability-DbxXicMT.js → require-capability-BivR5O9c.js} +1 -1
- package/dist/client/assets/{required-auth-layout-nM5VBqDv.js → required-auth-layout-nLQEQh4T.js} +1 -1
- package/dist/client/assets/{reset-password-B9WOYVDd.js → reset-password-DbNFxHZa.js} +1 -1
- package/dist/client/assets/{resizable-BAWWm2nK.js → resizable-jVHV7q6j.js} +1 -1
- package/dist/client/assets/{review-settings-BGS7uQ6I.js → review-settings-pQBCKPKH.js} +1 -1
- package/dist/client/assets/{rich-text-link-control-Bdhpb3Zg.js → rich-text-link-control-LHzHCvLT.js} +1 -1
- package/dist/client/assets/{roles-V5JoTuaT.js → roles-D2P1Oos9.js} +1 -1
- package/dist/client/assets/{route-BqHCYCsv.js → route-DdJHAvGX.js} +1 -1
- package/dist/client/assets/{route-ZOU_9LwH.js → route-H7ZUhhKg.js} +1 -1
- package/dist/client/assets/{route-DjwL1Fx5.js → route-PgUwDOXq.js} +1 -1
- package/dist/client/assets/{route-page-header-BpBVey10.js → route-page-header-CdURZjw4.js} +1 -1
- package/dist/client/assets/{runnable-block-editor-BhysVT_d.js → runnable-block-editor-D6afTfM-.js} +1 -1
- package/dist/client/assets/{sandbox-lifecycle-context-MYXX62o9.js → sandbox-lifecycle-context-B3BRP_zT.js} +1 -1
- package/dist/client/assets/{schema-CbxRw8u0.js → schema-D6awfAhL.js} +1 -1
- package/dist/client/assets/{scroll-area-cGn3a7WI.js → scroll-area-BcwVFmtC.js} +1 -1
- package/dist/client/assets/{search-input-BDrnENeI.js → search-input-CQj35-JN.js} +1 -1
- package/dist/client/assets/{search-toggle-D3OE1eNA.js → search-toggle-DJBipiC-.js} +1 -1
- package/dist/client/assets/{secret-picker-7NmqTvJr.js → secret-picker-CUYzUYt-.js} +1 -1
- package/dist/client/assets/{secrets-C8RnJX_t.js → secrets-CSzh5gpV.js} +1 -1
- package/dist/client/assets/{sections-editor-B7HawNxT.js → sections-editor-Ci2hLb6p.js} +1 -1
- package/dist/client/assets/{select-DxhjEfyz.js → select-DbdcyMHj.js} +1 -1
- package/dist/client/assets/{select-model-BANyElMS.js → select-model-CC-xfk5q.js} +1 -1
- package/dist/client/assets/{seo-editor-DfUSXMZj.js → seo-editor-CDb27yK8.js} +1 -1
- package/dist/client/assets/{separator-ByET-GLC.js → separator-C7EK7QlF.js} +1 -1
- package/dist/client/assets/{settings-tab-XTpgZ69I.js → settings-tab-CW4gZPUS.js} +1 -1
- package/dist/client/assets/{sheet-n9kcgSxF.js → sheet-DAQYbpWo.js} +1 -1
- package/dist/client/assets/{shell-layout-3Y13kkhL.js → shell-layout-BVMg_QHb.js} +1 -1
- package/dist/client/assets/{sidebar-CJTXGZDA.js → sidebar-IeazXizk.js} +1 -1
- package/dist/client/assets/{skill-preview-By3pB2y3.js → skill-preview-DCfaj24e.js} +1 -1
- package/dist/client/assets/{skills-D4_sFwwl.js → skills-BYSXIiGl.js} +1 -1
- package/dist/client/assets/{sso-BYhFmBwz.js → sso-BUOfF_f8.js} +1 -1
- package/dist/client/assets/{suggestion-C4rd6y9a.js → suggestion-C9QDk1bI.js} +1 -1
- package/dist/client/assets/{switch-DKrCkEm_.js → switch--k34C8Kk.js} +1 -1
- package/dist/client/assets/{synced-repos-2MrHm3BW.js → synced-repos-DpTCdwdK.js} +1 -1
- package/dist/client/assets/{table-CVXiShGi.js → table-Cdg_m5Fi.js} +1 -1
- package/dist/client/assets/{tabs-DZsSgDfP.js → tabs-Bvg84254.js} +1 -1
- package/dist/client/assets/{task-board-Ny1PbjMW.js → task-board-DOaNpGN6.js} +1 -1
- package/dist/client/assets/{task-route-9MeQLYQ9.js → task-route-YOSOFe21.js} +1 -1
- package/dist/client/assets/{task-status-DbQ_mzm6.js → task-status-Cu0BeiKh.js} +1 -1
- package/dist/client/assets/{taskboard-analytics-DywDB_Qc.js → taskboard-analytics-D80VYF2B.js} +1 -1
- package/dist/client/assets/{tasks-DEcROjS5.js → tasks-DNns-1KO.js} +1 -1
- package/dist/client/assets/tasks-DkM1lpuf.js +1 -0
- package/dist/client/assets/{textarea-DGsUkzqN.js → textarea-HozRfHqo.js} +1 -1
- package/dist/client/assets/{thread-button-PKgxAUks.js → thread-button-CbrVhzC1.js} +1 -1
- package/dist/client/assets/{thread-intent-CDjInTZL.js → thread-intent-3bbLxGdx.js} +1 -1
- package/dist/client/assets/{thread-route-D30inKGP.js → thread-route-DYTO8t6Q.js} +1 -1
- package/dist/client/assets/{thread-route-CC_31SLX.js → thread-route-GQJCQbIv.js} +1 -1
- package/dist/client/assets/{thread-sheet-body-hFIE9VHn.js → thread-sheet-body-DIhPmdA2.js} +1 -1
- package/dist/client/assets/{toggle-group-DPI9Gz2N.js → toggle-group-D-lFG-8Y.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-BkDKNKtL.js → toolbar-icon-button-Bc3SJWnQ.js} +1 -1
- package/dist/client/assets/{tooltip-CSEjy-r8.js → tooltip-BUfDy8oN.js} +1 -1
- package/dist/client/assets/{track-K6tQy-wy.js → track-Dj--PRTn.js} +1 -1
- package/dist/client/assets/{types-k3vJw7wx.js → types-BiT3dwSI.js} +1 -1
- package/dist/client/assets/{usage-stats-HcbmSz7a.js → usage-stats-CxaimUYo.js} +1 -1
- package/dist/client/assets/{use-ai-providers-CcGxl3Gi.js → use-ai-providers-DlcYODkQ.js} +1 -1
- package/dist/client/assets/{use-automations-CDFazwkf.js → use-automations-DpB55L_I.js} +1 -1
- package/dist/client/assets/{use-autosave-DsxiIWxA.js → use-autosave-CDpQJaxL.js} +1 -1
- package/dist/client/assets/{use-connect-companion-D6711Opr.js → use-connect-companion-B6URu4gm.js} +1 -1
- package/dist/client/assets/{use-connection-CMx-XZiq.js → use-connection-uWDo4P17.js} +1 -1
- package/dist/client/assets/{use-copy-BpzZQl2g.js → use-copy-DvWcMldo.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp--ht4Rkm7.js → use-create-virtual-mcp-B3gq2zpj.js} +1 -1
- package/dist/client/assets/{use-date-fns-locale-BjV4TzBE.js → use-date-fns-locale-CpNd2LeL.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-CEylLohK.js → use-debounced-autosave-DlWudjF0.js} +1 -1
- package/dist/client/assets/{use-debounced-value-C6okEGbV.js → use-debounced-value-CCcVGBPY.js} +1 -1
- package/dist/client/assets/{use-deco-credits-CpqHEICB.js → use-deco-credits-CowAAtdj.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-Dppj3YU9.js → use-decopilot-events-B_V8T5_L.js} +1 -1
- package/dist/client/assets/{use-delete-connection-DUW9f2u1.js → use-delete-connection-C2C5FqOF.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-DshXpxI2.js → use-deployment-admin-DdoWQpY9.js} +1 -1
- package/dist/client/assets/{use-entitlements-Ba17FhRN.js → use-entitlements-D7k8yH5N.js} +1 -1
- package/dist/client/assets/{use-fast-preview-draft-url-kMKxC_Pw.js → use-fast-preview-draft-url-6fNwrBW8.js} +1 -1
- package/dist/client/assets/{use-file-configs-BmEDH0VE.js → use-file-configs-Bl0EV8VH.js} +1 -1
- package/dist/client/assets/{use-in-settings-YUhZQzYy.js → use-in-settings-VwEonhlL.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CSRrFY6h.js → use-infinite-scroll-c_IfPmUc.js} +1 -1
- package/dist/client/assets/{use-join-requests-BoS4qMQi.js → use-join-requests-v9BQdwnO.js} +1 -1
- package/dist/client/assets/{use-main-panel-tabs-By5S27Gp.js → use-main-panel-tabs-_-TQPuVC.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-CWdlR5O6.js → use-mcp-auth-status-Bf6tMvja.js} +1 -1
- package/dist/client/assets/{use-mcp-client-C8DXVUZj.js → use-mcp-client-m_Sz4iZf.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-JOWAmkEq.js → use-mcp-prompts-BcJMAt9K.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-D-S9SAOh.js → use-mcp-tools-qMuXZieG.js} +1 -1
- package/dist/client/assets/{use-members-CAwVsdC4.js → use-members-CLMVzGW2.js} +1 -1
- package/dist/client/assets/{use-mobile-BYW51CpD.js → use-mobile-BfKgXbcz.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-ebIYYmYW.js → use-navigate-to-agent-DwfriOih.js} +1 -1
- package/dist/client/assets/{use-open-billing-url-i3U-Ki4a.js → use-open-billing-url-BP3cegA0.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-D-B1M9Fj.js → use-org-auth-client-CIQjTSRb.js} +1 -1
- package/dist/client/assets/{use-org-fs-D3EWDZUC.js → use-org-fs-yvYanrBl.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-DmuKbSlB.js → use-org-repo-syncs-BDI7PP9u.js} +1 -1
- package/dist/client/assets/{use-org-sso-CzqSMhda.js → use-org-sso-DCuUIxZ0.js} +1 -1
- package/dist/client/assets/{use-organization-roles-_GFhEaSJ.js → use-organization-roles-vU8nNfJA.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BG_WfOIn.js → use-organization-settings-BiUMVoFc.js} +1 -1
- package/dist/client/assets/{use-panel-navigate-DI4UQ_n7.js → use-panel-navigate-DF1552Ek.js} +1 -1
- package/dist/client/assets/{use-project-native-view-presence-CcjNty9d.js → use-project-native-view-presence-wT-6b5Vq.js} +1 -1
- package/dist/client/assets/{use-project-scope-CdVgPS_9.js → use-project-scope-B3vLbvZA.js} +1 -1
- package/dist/client/assets/{use-releases-D_nd9qj6.js → use-releases-DChy5eec.js} +1 -1
- package/dist/client/assets/{use-reports-diagnostic-C-GusDUW.js → use-reports-diagnostic-DGq2bS2T.js} +1 -1
- package/dist/client/assets/{use-route-default-main-CVXNK-Ds.js → use-route-default-main-DEmXQw5m.js} +1 -1
- package/dist/client/assets/{use-secrets-CKbHXdHu.js → use-secrets-CeJ1G70I.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-BHfKu4Be.js → use-section-preview-base-BXTnNZ17.js} +1 -1
- package/dist/client/assets/{use-session-runtime-a9Y20Jh0.js → use-session-runtime-CppnHAA5.js} +1 -1
- package/dist/client/assets/{use-tags-BQDPMaYa.js → use-tags-DXcDfhmD.js} +1 -1
- package/dist/client/assets/{use-task-board-analytics-dyWG2Jj9.js → use-task-board-analytics-BFLdE_Mj.js} +1 -1
- package/dist/client/assets/{use-task-metadata-De4dYawr.js → use-task-metadata-CqVA5WzF.js} +1 -1
- package/dist/client/assets/{use-thread-outputs-CHuFDG4c.js → use-thread-outputs-tkDfjQG8.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-BnIp2YQj.js → use-virtual-mcp-Dqxt40fM.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CPlLA5ul.js +1 -0
- package/dist/client/assets/{useQueries-DX5YqUyF.js → useQueries-DlFKxB3t.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BcjInpP_.js +1 -0
- package/dist/client/assets/{users-C1JPEsq0.js → users-6r9gIFq1.js} +1 -1
- package/dist/client/assets/{utils-Dnu7Z_7W.js → utils-CAvIkpI3.js} +1 -1
- package/dist/client/assets/{variant-calendar-52QBX61v.js → variant-calendar-BVfa1Hpt.js} +1 -1
- package/dist/client/assets/{variant-matcher-override-G4ZIBzQZ.js → variant-matcher-override-64gFzypd.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-BHHm82Wa.js → view-mode-toggle-BLeLxqU-.js} +1 -1
- package/dist/client/assets/{virtual-mcp-VENiZcwc.js → virtual-mcp-HGt23NdH.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +3 -3
- package/dist/server/server.js +3 -3
- package/package.json +1 -1
- package/dist/client/assets/agent-app-DVQdsoCP.js +0 -1
- package/dist/client/assets/agent-deck-DwkEMcun.js +0 -1
- package/dist/client/assets/agent-file-kb3kZGOR.js +0 -1
- package/dist/client/assets/agent-library-file-B26RhOf0.js +0 -1
- package/dist/client/assets/agent-settings-BQ_MplXY.js +0 -1
- package/dist/client/assets/agent-site-editor-code-DY_zO3AJ.js +0 -2
- package/dist/client/assets/agent-view-BpAqFgTh.js +0 -1
- package/dist/client/assets/api-keys-DbPrfCxe.js +0 -1
- package/dist/client/assets/app-editor-DuO1pc7m.js +0 -1
- package/dist/client/assets/project-reports-BORRGsRz.js +0 -1
- package/dist/client/assets/project-tasks-CRStWfOr.js +0 -1
- package/dist/client/assets/record-editor-DB5V4dOD.js +0 -1
- package/dist/client/assets/reports-bnYiC_GO.js +0 -1
- package/dist/client/assets/tasks-Dok3BfRQ.js +0 -1
- package/dist/client/assets/useInfiniteQuery-HKtw1Zwv.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CIYuI7yd.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-editor-
|
|
2
|
-
import{c as ae,b as we,j as t,m as xn,K as It,l as ge,r as $,h as rt,B as Be,o as No,e as wo,t as me,a6 as ys,aB as wt,aK as vt,F as Ft,aC as Os,H as Kt,I as zt,av as Co,_ as Po,$ as To,G as Je,am as Bt,aL as cs,aM as Bo,a0 as Eo,u as gn,aI as qe}from"./index-jpNIlPuy.js";import{A as _o}from"./agent-view-guard-B9HgiZ1B.js";import{F as Do}from"./feature-gate-CRsogGiy.js";import{u as Et,b as bn}from"./chat-context-Biuolo5l.js";import{i as Yt}from"./AlertCircle-Bw5IjQll.js";import{K as Ao,z as yn,L as vn,M as jn,N as tt,O as kn,P as vs,Q as $o,R as Sn,S as Lo,F as Nn,T as Oo,U as Ro,V as Ct,W as Io,X as Fo,n as Ko,Y as zo,Z as wn,_ as Mo,$ as Vo,x as Cn}from"./agent-icon-zd22KZWY.js";import{c as Rs}from"./UserSquare-CjWcARYJ.js";import{i as Pn}from"./ZoomOut-DckCENcg.js";import{i as Mt,a as Is}from"./Share07-slK9gs7d.js";import{c as Tn,i as Uo}from"./XClose-B001-Pfs.js";import{s as js}from"./Plus-DVO5ynNJ.js";import{i as Bn}from"./SearchLg-BuXTAvmm.js";import{t as En}from"./Users01-CYLXmuWv.js";import{f as Go,e as Ho,b as qo,A as Wo,a as Jo,d as Yo,c as Qo,g as Xo}from"./alert-dialog-DG5_wKgz.js";import{S as Qt}from"./scroll-area-cGn3a7WI.js";import{T as Ye,a as Qe,c as Xe}from"./tooltip-CSEjy-r8.js";import{B as ot}from"./badge-CbxyjOGk.js";import{S as ds,n as Zo,c as ea,g as _n,B as us,P as ta,h as Dn,o as sa,i as hs,u as Xt,l as na,q as oa,R as aa,s as An,r as la,t as ia,d as $n,v as ra,w as ca,x as Ln,y as da,M as ua,j as ma,z as fa,p as pa,A as ha,C as xa,e as ga,f as ba,D as Fs,E as On,k as ya,F as va}from"./runnable-block-editor-BhysVT_d.js";import{r as ks,S as ja,l as Ss,i as ka,m as Sa,o as Na,n as Ot,v as wa,R as Rn,G as Ns,g as Ca,q as Pa,e as Ks,t as Ta,d as Ba,w as Ea,x as zs,h as _a,y as Da,z as Aa}from"./claim-phase-copy-CCRVAHif.js";import{u as In,P as $a}from"./mustache-qkuFcNLb.js";import{t as ht}from"./ChevronUp-BfOf-CcT.js";import{i as Fn}from"./Zap-vgIAjKVr.js";import{C as La,a as Oa,b as Ra}from"./collapsible-CNrrD80N.js";import{c as Ia,d as Fa}from"./sandbox-lifecycle-context-MYXX62o9.js";import{u as Kn}from"./use-session-runtime-a9Y20Jh0.js";import{c as xt,d as ct,e as gt,b as dt,D as ut,h as Vt,a as Ka}from"./dialog-Fq0nM2c3.js";import{I as Ze}from"./input-AEl9FaSr.js";import{C as Zt}from"./checkbox-wlUWF7hx.js";import{L as ze}from"./label-oK9z5afE.js";import{c as za,b as Ma,a as Va,d as Ua,S as Ga}from"./select-DxhjEfyz.js";import{a as zn,d as Mn}from"./use-virtual-mcp-BnIp2YQj.js";import{b as Ha,a as qa,p as Wa,s as Ja,t as Ms}from"./decofile-api-CPs_PsP6.js";import{o as Ya}from"./sandbox-git-api-B1R0585s.js";import{a as Vs}from"./utils-Dnu7Z_7W.js";import{i as Qa}from"./CheckCircle-BMHJHOxj.js";import{s as ws}from"./Trash01-elTVICGJ.js";import{i as ms}from"./Upload01-C_pNo17d.js";import{E as Xa}from"./empty-state-yvdmqB8T.js";import{T as Rt}from"./textarea-DGsUkzqN.js";import{u as Za}from"./use-ai-providers-CcGxl3Gi.js";import{M as Vn}from"./monaco-editor-1VDRMi5Z.js";import{i as Cs}from"./X-DfL64JB-.js";import{c as el,b as tl}from"./XCircle-Cn_6vXwx.js";import"./rich-text-link-control-Bdhpb3Zg.js";import{a as sl}from"./Copy01-jqAaecgQ.js";import{b as nl}from"./Tool01-BGKWFxqT.js";import{b as Us}from"./use-project-scope-CdVgPS_9.js";import{E as ol}from"./empty-state-gX-Wv4YC.js";import{G as Gs}from"./github-icon-Bczff7w9.js";import{R as al}from"./repository-import-picker-DQ2X5vYR.js";import{b as ll}from"./thread-route-CC_31SLX.js";function il(n){const e=ae.c(18),{title:s,description:o,children:a}=n,l=we();let i;e[0]!==a?(i=t.jsx("div",{"aria-hidden":"true",inert:!0,className:"pointer-events-none h-full select-none overflow-hidden",children:a}),e[0]=a,e[1]=i):i=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ao,{}),e[2]=c):c=e[2];let r;e[3]!==l?(r=l("common.soon"),e[3]=l,e[4]=r):r=e[4];let d;e[5]!==r?(d=t.jsxs(ot,{variant:"secondary",children:[c,r]}),e[5]=r,e[6]=d):d=e[6];let p;e[7]!==s?(p=t.jsx("p",{className:"text-base font-semibold text-foreground",children:s}),e[7]=s,e[8]=p):p=e[8];let m;e[9]!==o?(m=o&&t.jsx("p",{className:"text-sm text-muted-foreground",children:o}),e[9]=o,e[10]=m):m=e[10];let h;e[11]!==d||e[12]!==p||e[13]!==m?(h=t.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/60 p-6 backdrop-blur-sm",children:t.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-3 rounded-2xl border bg-card px-8 py-6 text-center shadow-lg",children:[d,p,m]})}),e[11]=d,e[12]=p,e[13]=m,e[14]=h):h=e[14];let u;return e[15]!==i||e[16]!==h?(u=t.jsxs("div",{className:"relative h-full min-h-0",children:[i,h]}),e[15]=i,e[16]=h,e[17]=u):u=e[17],u}function rl(n,e){if(!n||!e?.length)return n;const s=Object.fromEntries(Object.entries(n.properties??{}).filter(([o])=>!e.includes(o)));return Object.keys(s).length>0?{...n,properties:s}:n}function cl(n,e,s){return typeof n!="string"?null:rl(ks(n,e),s)}function Un(n,e,s){if(!e||typeof n!="string")return!1;const o=cl(n,e,s);return!!o&&Object.keys(o.properties??{}).length>0}function jt(n){const e=ae.c(6),{hasItems:s,emptyLabel:o,emptyHint:a}=n;let l;e[0]!==a||e[1]!==o||e[2]!==s?(l=s?"No results match your search.":t.jsxs(t.Fragment,{children:[t.jsx("div",{children:o}),t.jsx("div",{className:"mt-1 text-muted-foreground/80",children:a})]}),e[0]=a,e[1]=o,e[2]=s,e[3]=l):l=e[3];let i;return e[4]!==l?(i=t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:l}),e[4]=l,e[5]=i):i=e[5],i}function es(n,e){return`${n}-${e}`}function Gn(n,e){return`site/apps/${n}/${e}.ts`}function Hn(n){const e=n.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=n.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function dl(n){const e=n.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function ul(n){return n==="local"?"Custom":"Installed"}function qn(n,e,s){const o=new Set([es(n,e),e].map(l=>l.toLowerCase())),a=Gn(n,e);for(const[l,i]of Object.entries(s)){if(l.includes("/")||!i||typeof i!="object"||Array.isArray(i))continue;const c=i;if(o.has(l.toLowerCase())||c.__resolveType===a)return l}return null}function ml(n,e){const s=n.vendor.alias,o=n.name,a=qn(s,o,e);return{id:es(s,o),app:o,vendor:s,title:n.title||n.name,description:n.description,category:n.category??"Other",logo:n.logo||void 0,resolveType:Gn(s,o),blockKey:a,installed:a!==null}}function fl(n,e,s){if(n===ja)return null;const o=Hn(n);if(!o)return null;const{vendor:a,app:l}=o,i=qn(a,l,s),c=Ss(n,e);return{id:es(a,l),app:l,vendor:a,title:c.title??l,description:c.description??"",category:"Others",logo:c.logo??c.icon,resolveType:n,blockKey:i,installed:i!==null}}function pl(n,e,s){const o=e.__resolveType;if(typeof o!="string"||ka(n,e)||!Sa(o))return null;const a=Hn(o)??dl(n);if(!a)return null;const l=Ss(o,s),{vendor:i,app:c}=a;return{id:es(i,c),app:c,vendor:i,title:l.title??Na(n,e,s),description:l.description??"",category:ul(i),logo:l.logo??l.icon,resolveType:o,blockKey:n,installed:!0}}function hl(n,e,s){const o=new Map;for(const l of n){const i=ml(l,s);o.set(i.id,i)}const a=e.manifest?.blocks?.apps??{};for(const l of Object.keys(a)){const i=fl(l,e,s);!i||o.has(i.id)||o.set(i.id,i)}for(const[l,i]of Object.entries(s)){if(l.includes("/")||!i||typeof i!="object"||Array.isArray(i))continue;const c=pl(l,i,e);!c||o.has(c.id)||o.set(c.id,c)}return[...o.values()].sort(xl)}function xl(n,e){return n.installed!==e.installed?n.installed?-1:1:n.title.localeCompare(e.title)}async function gl(){const n=await fetch("/api/deco-apps");if(!n.ok)throw new Error(`Failed to fetch deco apps: ${n.status}`);return(await n.json()).apps??[]}function bl(n,e,s){const o=ae.c(12),a=s?.enabled??!0;let l;o[0]===Symbol.for("react.memo_cache_sentinel")?(l=It.decoApps(),o[0]=l):l=o[0];let i;o[1]!==a?(i={queryKey:l,queryFn:gl,staleTime:3e5,retry:1,enabled:a},o[1]=a,o[2]=i):i=o[2];const c=xn(i);let r;o[3]!==e||o[4]!==n||o[5]!==c.data?(r=n&&e?hl(c.data??[],n,e):[],o[3]=e,o[4]=n,o[5]=c.data,o[6]=r):r=o[6];const d=r,p=c.isLoading&&!c.isError;let m;return o[7]!==d||o[8]!==c.isError||o[9]!==c.refetch||o[10]!==p?(m={catalog:d,isLoading:p,isError:c.isError,refetch:c.refetch},o[7]=d,o[8]=c.isError,o[9]=c.refetch,o[10]=p,o[11]=m):m=o[11],m}const yl=["sections","apps","loaders","actions"];function vl(n){const e=ae.c(59),{active:s,counts:o,showBlog:a,onSelect:l}=n,i=we();let c;e[0]!==i?(c=i("sandbox.collectionsSidebar.content"),e[0]=i,e[1]=c):c=e[1];let r;e[2]!==c?(r=t.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:t.jsx("span",{className:"text-sm font-medium",children:c})}),e[2]=c,e[3]=r):r=e[3];let d;e[4]!==i?(d=i("sandbox.collectionsSidebar.pages"),e[4]=i,e[5]=d):d=e[5];const p=s==="pages";let m;e[6]!==o.pages||e[7]!==l||e[8]!==d||e[9]!==p?(m=t.jsx(Fe,{id:"pages",icon:yn,label:d,count:o.pages,active:p,onSelect:l}),e[6]=o.pages,e[7]=l,e[8]=d,e[9]=p,e[10]=m):m=e[10];let h;e[11]!==i?(h=i("sandbox.collectionsSidebar.redirects"),e[11]=i,e[12]=h):h=e[12];const u=s==="redirects";let f;e[13]!==o.redirects||e[14]!==l||e[15]!==h||e[16]!==u?(f=t.jsx(Fe,{id:"redirects",icon:vn,label:h,count:o.redirects,active:u,onSelect:l}),e[13]=o.redirects,e[14]=l,e[15]=h,e[16]=u,e[17]=f):f=e[17];let g;e[18]!==i?(g=i("sandbox.collectionsSidebar.site"),e[18]=i,e[19]=g):g=e[19];const x=s==="site";let y;e[20]!==l||e[21]!==x||e[22]!==g?(y=t.jsx(Fe,{id:"site",icon:$o,label:g,active:x,onSelect:l}),e[20]=l,e[21]=x,e[22]=g,e[23]=y):y=e[23];let v;e[24]!==i?(v=i("sandbox.collectionsSidebar.seo"),e[24]=i,e[25]=v):v=e[25];const j=s==="seo";let N;e[26]!==l||e[27]!==v||e[28]!==j?(N=t.jsx(Fe,{id:"seo",icon:Sn,label:v,active:j,onSelect:l}),e[26]=l,e[27]=v,e[28]=j,e[29]=N):N=e[29];let w;e[30]!==i?(w=i("sandbox.collectionsSidebar.calendar"),e[30]=i,e[31]=w):w=e[31];const E=s==="calendar";let B;e[32]!==l||e[33]!==w||e[34]!==E?(B=t.jsx(Fe,{id:"calendar",icon:Lo,label:w,active:E,onSelect:l}),e[32]=l,e[33]=w,e[34]=E,e[35]=B):B=e[35];let k;e[36]!==s||e[37]!==o||e[38]!==l?(k=t.jsx(jl,{active:s,counts:o,onSelect:l}),e[36]=s,e[37]=o,e[38]=l,e[39]=k):k=e[39];let D;e[40]!==s||e[41]!==o.authors||e[42]!==o.categories||e[43]!==o.posts||e[44]!==l||e[45]!==a||e[46]!==i?(D=a&&t.jsxs(t.Fragment,{children:[t.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:[t.jsx(jn,{size:13,className:"shrink-0"}),i("sandbox.collectionsSidebar.blog")]}),t.jsx(Fe,{id:"context",icon:tt,label:i("sandbox.collectionsSidebar.context"),active:s==="context",onSelect:l}),t.jsx(Fe,{id:"posts",icon:Pn,label:i("sandbox.collectionsSidebar.posts"),count:o.posts,active:s==="posts",onSelect:l}),t.jsx(Fe,{id:"authors",icon:En,label:i("sandbox.collectionsSidebar.authors"),count:o.authors,active:s==="authors",onSelect:l}),t.jsx(Fe,{id:"categories",icon:kn,label:i("sandbox.collectionsSidebar.categories"),count:o.categories,active:s==="categories",onSelect:l}),t.jsx(Fe,{id:"post-schedule",icon:vs,label:i("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:l})]}),e[40]=s,e[41]=o.authors,e[42]=o.categories,e[43]=o.posts,e[44]=l,e[45]=a,e[46]=i,e[47]=D):D=e[47];let O;e[48]!==y||e[49]!==N||e[50]!==B||e[51]!==k||e[52]!==D||e[53]!==m||e[54]!==f?(O=t.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[m,f,y,N,B,k,D]}),e[48]=y,e[49]=N,e[50]=B,e[51]=k,e[52]=D,e[53]=m,e[54]=f,e[55]=O):O=e[55];let L;return e[56]!==r||e[57]!==O?(L=t.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[r,O]}),e[56]=r,e[57]=O,e[58]=L):L=e[58],L}function jl(n){const e=ae.c(52),{active:s,counts:o,onSelect:a}=n,l=we();let i;e[0]!==s?(i=yl.includes(s),e[0]=s,e[1]=i):i=e[1];const c=i,[r,d]=$.useState(!1),p=r||c;let m,h;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=ge("flex w-full items-center gap-2 classic:rounded-md compact:rounded-lg px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer","text-muted-foreground hover:bg-muted hover:text-foreground"),h=t.jsx(Oo,{size:16,className:"shrink-0"}),e[2]=m,e[3]=h):(m=e[2],h=e[3]);let u;e[4]!==l?(u=l("sandbox.collectionsSidebar.advanced"),e[4]=l,e[5]=u):u=e[5];let f;e[6]!==u?(f=t.jsx("span",{className:"flex-1 truncate",children:u}),e[6]=u,e[7]=f):f=e[7];const g=p&&"rotate-180";let x;e[8]!==g?(x=ge("shrink-0 text-muted-foreground/70 transition-transform",g),e[8]=g,e[9]=x):x=e[9];let y;e[10]!==x?(y=t.jsx(ht,{size:16,className:x}),e[10]=x,e[11]=y):y=e[11];let v;e[12]!==f||e[13]!==y?(v=t.jsxs(La,{className:m,children:[h,f,y]}),e[12]=f,e[13]=y,e[14]=v):v=e[14];let j;e[15]!==l?(j=l("sandbox.collectionsSidebar.sections"),e[15]=l,e[16]=j):j=e[16];const N=s==="sections";let w;e[17]!==o.sections||e[18]!==a||e[19]!==j||e[20]!==N?(w=t.jsx(Fe,{id:"sections",icon:Mt,label:j,count:o.sections,active:N,onSelect:a,indent:!0}),e[17]=o.sections,e[18]=a,e[19]=j,e[20]=N,e[21]=w):w=e[21];let E;e[22]!==l?(E=l("sandbox.collectionsSidebar.apps"),e[22]=l,e[23]=E):E=e[23];const B=s==="apps";let k;e[24]!==o.apps||e[25]!==a||e[26]!==E||e[27]!==B?(k=t.jsx(Fe,{id:"apps",icon:Tn,label:E,count:o.apps,active:B,onSelect:a,indent:!0}),e[24]=o.apps,e[25]=a,e[26]=E,e[27]=B,e[28]=k):k=e[28];let D;e[29]!==l?(D=l("sandbox.collectionsSidebar.loaders"),e[29]=l,e[30]=D):D=e[30];const O=s==="loaders";let L;e[31]!==o.loaders||e[32]!==a||e[33]!==D||e[34]!==O?(L=t.jsx(Fe,{id:"loaders",icon:Nn,label:D,count:o.loaders,active:O,onSelect:a,indent:!0}),e[31]=o.loaders,e[32]=a,e[33]=D,e[34]=O,e[35]=L):L=e[35];let K;e[36]!==l?(K=l("sandbox.collectionsSidebar.actions"),e[36]=l,e[37]=K):K=e[37];const F=s==="actions";let _;e[38]!==o.actions||e[39]!==a||e[40]!==K||e[41]!==F?(_=t.jsx(Fe,{id:"actions",icon:Fn,label:K,count:o.actions,active:F,onSelect:a,indent:!0}),e[38]=o.actions,e[39]=a,e[40]=K,e[41]=F,e[42]=_):_=e[42];let A;e[43]!==w||e[44]!==k||e[45]!==L||e[46]!==_?(A=t.jsxs(Oa,{className:"flex flex-col gap-0.5 pt-0.5",children:[w,k,L,_]}),e[43]=w,e[44]=k,e[45]=L,e[46]=_,e[47]=A):A=e[47];let R;return e[48]!==p||e[49]!==A||e[50]!==v?(R=t.jsxs(Ra,{open:p,onOpenChange:d,children:[v,A]}),e[48]=p,e[49]=A,e[50]=v,e[51]=R):R=e[51],R}function Fe(n){const e=ae.c(19),{id:s,icon:o,label:a,count:l,active:i,onSelect:c,indent:r}=n;let d;e[0]!==s||e[1]!==c?(d=()=>c(s),e[0]=s,e[1]=c,e[2]=d):d=e[2];const p=r&&"pl-6",m=i?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let h;e[3]!==p||e[4]!==m?(h=ge("flex w-full items-center gap-2 classic:rounded-md compact:rounded-lg px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",p,m),e[3]=p,e[4]=m,e[5]=h):h=e[5];let u;e[6]!==o?(u=t.jsx(o,{size:16,className:"shrink-0"}),e[6]=o,e[7]=u):u=e[7];let f;e[8]!==a?(f=t.jsx("span",{className:"flex-1 truncate",children:a}),e[8]=a,e[9]=f):f=e[9];let g;e[10]!==i||e[11]!==l?(g=l!==void 0&&t.jsx("span",{className:ge("shrink-0 text-xs tabular-nums",i?"text-accent-foreground/70":"text-muted-foreground/70"),children:l}),e[10]=i,e[11]=l,e[12]=g):g=e[12];let x;return e[13]!==d||e[14]!==h||e[15]!==u||e[16]!==f||e[17]!==g?(x=t.jsxs("button",{type:"button",onClick:d,className:h,children:[u,f,g]}),e[13]=d,e[14]=h,e[15]=u,e[16]=f,e[17]=g,e[18]=x):x=e[18],x}function kl(n){const e=ae.c(12),{state:s,claimPhase:o,lifecycle:a,onStart:l,connectionsHref:i}=n;switch(s.kind){case"starting":{let c;e[0]!==o||e[1]!==a?(c=Zo({claimPhase:o,lifecycle:a}),e[0]=o,e[1]=a,e[2]=c):c=e[2];let r;return e[3]!==o||e[4]!==c?(r=t.jsx(ds,{kind:"starting",progress:c,claimPhase:o}),e[3]=o,e[4]=c,e[5]=r):r=e[5],r}case"suspended":{let c;return e[6]!==l?(c=t.jsx(ds,{kind:"suspended",onResume:l}),e[6]=l,e[7]=c):c=e[7],c}case"errored":{let c;return e[8]!==i||e[9]!==l||e[10]!==s.error?(c=t.jsx(ds,{kind:"errored",error:s.error,onRetry:l,connectionsHref:i}),e[8]=i,e[9]=l,e[10]=s.error,e[11]=c):c=e[11],c}}}const Sl=new Set(["clone-failed","install-failed","start-failed","crashed"]);function Nl(n){if(n.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(n.previewState.kind!=="iframe")return{kind:"sandbox-card",state:n.previewState};const e=n.lifecyclePhase==="running",s=!e&&!Sl.has(n.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function Hs(n,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),o=`${s} (copy)`;if(!n.has(o))return o;for(let a=2;a<1e3;a++){const l=`${s} (copy ${a})`;if(!n.has(l))return l}return`${s} (copy ${Date.now()})`}function wl(n,e){const s=Ot,o=e.replace(/-copy(?:-\d+)?$/,""),a=`${o}-copy`;if(!n.has(s(a)))return a;for(let l=2;l<1e3;l++){const i=`${o}-copy-${l}`;if(!n.has(s(i)))return i}return`${o}-copy-${Date.now()}`}function Cl(n,e){const s=e.replace(/_copy(?:_\d+)?$/,""),o=`${s}_copy`;if(!Object.hasOwn(n,o))return o;for(let a=2;a<1e3;a++){const l=`${s}_copy_${a}`;if(!Object.hasOwn(n,l))return l}return`${s}_copy_${Date.now()}`}function Pl(n){const e=_n(n.newName),s={...n.source,name:n.newName,path:n.newPath};return{key:e,data:s}}function Tl(n,e){return ea(n,e)}const Bl=1e3;function El(n,e){for(let s=0;s<Bl;s++){const o=_n(e);if(!Object.hasOwn(n,o))return o}throw new Error("Could not generate a unique page block key")}const _l={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},Dl={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},Al={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function $l(n){const e=ae.c(88),{open:s,mode:o,initialName:a,initialPath:l,isPending:i,error:c,templates:r,validate:d,onSubmit:p,onOpenChange:m}=n,h=i===void 0?!1:i,u=we(),[f,g]=$.useState(a),[x,y]=$.useState(l),[v,j]=$.useState(us),[N,w]=$.useState(null),[E,B]=$.useState(s);s!==E&&(B(s),s&&(g(a),y(l),j(us),w(null)));const k=o==="create"&&!!r?.length;let D;e[0]!==h||e[1]!==m?(D=pe=>{!pe&&!h&&(w(null),m(!1))},e[0]=h,e[1]=m,e[2]=D):D=e[2];const O=D;let L;e[3]!==h||e[4]!==f||e[5]!==p||e[6]!==x||e[7]!==k||e[8]!==v||e[9]!==d?(L=async pe=>{pe.preventDefault();const ke=f.trim(),he=x.trim();if(!ke||!he||h)return;const je=wa(he);if(je){w(je);return}const Se=d?.({name:ke,path:he});if(Se){w(Se);return}w(null),await p({name:ke,path:he,templateKey:k&&v!==us?v:null})},e[3]=h,e[4]=f,e[5]=p,e[6]=x,e[7]=k,e[8]=v,e[9]=d,e[10]=L):L=e[10];const K=L,F=N??c,_=_l[o];let A;e[11]!==u||e[12]!==_?(A=u(_),e[11]=u,e[12]=_,e[13]=A):A=e[13];let R;e[14]!==A?(R=t.jsx(xt,{children:t.jsx(ct,{children:A})}),e[14]=A,e[15]=R):R=e[15];let I;e[16]!==h||e[17]!==k||e[18]!==u||e[19]!==v||e[20]!==r?(I=k&&t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:u("sandbox.pageFormDialog.labelTemplate")}),t.jsx(ta,{id:"page-form-template",value:v,onChange:j,templates:r??[],disabled:h})]}),e[16]=h,e[17]=k,e[18]=u,e[19]=v,e[20]=r,e[21]=I):I=e[21];let V;e[22]!==u?(V=u("sandbox.pageFormDialog.labelName"),e[22]=u,e[23]=V):V=e[23];let z;e[24]!==V?(z=t.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:V}),e[24]=V,e[25]=z):z=e[25];let J;e[26]===Symbol.for("react.memo_cache_sentinel")?(J=pe=>g(pe.target.value),e[26]=J):J=e[26];let P;e[27]!==u?(P=u("sandbox.pageFormDialog.placeholderName"),e[27]=u,e[28]=P):P=e[28];let G;e[29]!==h||e[30]!==f||e[31]!==P?(G=t.jsx(Ze,{id:"page-form-name",value:f,onChange:J,placeholder:P,autoFocus:!0,disabled:h}),e[29]=h,e[30]=f,e[31]=P,e[32]=G):G=e[32];let Y;e[33]!==G||e[34]!==z?(Y=t.jsxs("div",{className:"space-y-1.5",children:[z,G]}),e[33]=G,e[34]=z,e[35]=Y):Y=e[35];let q;e[36]!==u?(q=u("sandbox.pageFormDialog.labelPath"),e[36]=u,e[37]=q):q=e[37];let X;e[38]!==q?(X=t.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:q}),e[38]=q,e[39]=X):X=e[39];let ce;e[40]===Symbol.for("react.memo_cache_sentinel")?(ce=pe=>y(pe.target.value),e[40]=ce):ce=e[40];let ne;e[41]!==u?(ne=u("sandbox.pageFormDialog.placeholderPath"),e[41]=u,e[42]=ne):ne=e[42];let de;e[43]!==h||e[44]!==x||e[45]!==ne?(de=t.jsx(Ze,{id:"page-form-path",value:x,onChange:ce,placeholder:ne,disabled:h}),e[43]=h,e[44]=x,e[45]=ne,e[46]=de):de=e[46];let te;e[47]!==X||e[48]!==de?(te=t.jsxs("div",{className:"space-y-1.5",children:[X,de]}),e[47]=X,e[48]=de,e[49]=te):te=e[49];let re;e[50]!==F?(re=F&&t.jsx("p",{className:"text-xs text-destructive",children:F}),e[50]=F,e[51]=re):re=e[51];let le;e[52]!==Y||e[53]!==te||e[54]!==re||e[55]!==I?(le=t.jsxs("div",{className:"space-y-4 py-4",children:[I,Y,te,re]}),e[52]=Y,e[53]=te,e[54]=re,e[55]=I,e[56]=le):le=e[56];let C;e[57]!==m?(C=()=>m(!1),e[57]=m,e[58]=C):C=e[58];let W;e[59]!==u?(W=u("sandbox.pageFormDialog.buttonCancel"),e[59]=u,e[60]=W):W=e[60];let Z;e[61]!==h||e[62]!==C||e[63]!==W?(Z=t.jsx(Be,{type:"button",variant:"outline",onClick:C,disabled:h,children:W}),e[61]=h,e[62]=C,e[63]=W,e[64]=Z):Z=e[64];let oe;e[65]!==h||e[66]!==f||e[67]!==x?(oe=!f.trim()||!x.trim()||h,e[65]=h,e[66]=f,e[67]=x,e[68]=oe):oe=e[68];let S;e[69]!==h||e[70]!==o||e[71]!==u?(S=h?t.jsxs(t.Fragment,{children:[t.jsx(rt,{className:"size-3.5"}),u(Al[o])]}):u(Dl[o]),e[69]=h,e[70]=o,e[71]=u,e[72]=S):S=e[72];let se;e[73]!==oe||e[74]!==S?(se=t.jsx(Be,{type:"submit",disabled:oe,children:S}),e[73]=oe,e[74]=S,e[75]=se):se=e[75];let H;e[76]!==Z||e[77]!==se?(H=t.jsxs(gt,{children:[Z,se]}),e[76]=Z,e[77]=se,e[78]=H):H=e[78];let ie;e[79]!==K||e[80]!==le||e[81]!==H||e[82]!==R?(ie=t.jsx(dt,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:K,children:[R,le,H]})}),e[79]=K,e[80]=le,e[81]=H,e[82]=R,e[83]=ie):ie=e[83];let ye;return e[84]!==O||e[85]!==s||e[86]!==ie?(ye=t.jsx(ut,{open:s,onOpenChange:O,children:ie}),e[84]=O,e[85]=s,e[86]=ie,e[87]=ye):ye=e[87],ye}const Ll=[{value:"temporary",labelKey:"sandbox.redirectEditor.typeTemporary"},{value:"permanent",labelKey:"sandbox.redirectEditor.typePermanent"}],qs={from:"",to:"",type:"temporary",discardQueryParameters:!1};function Ol(n){const e=ae.c(111),{open:s,isPending:o,error:a,onSubmit:l,onOpenChange:i}=n,c=o===void 0?!1:o,r=we(),[d,p]=$.useState(qs),[m,h]=$.useState(null),[u,f]=$.useState(s);s!==u&&(f(s),s&&(p(qs),h(null)));let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=xe=>p($e=>({...$e,...xe})),e[0]=g):g=e[0];const x=g;let y;e[1]!==c||e[2]!==i?(y=xe=>{!xe&&!c&&(h(null),i(!1))},e[1]=c,e[2]=i,e[3]=y):y=e[3];const v=y;let j;e[4]!==c||e[5]!==l||e[6]!==d||e[7]!==r?(j=async xe=>{xe.preventDefault();const $e=d.from.trim(),Le=d.to.trim();if(!$e||!Le||c){h(r("sandbox.redirectFormDialog.errorRequired"));return}h(null),await l({...d,from:$e,to:Le})},e[4]=c,e[5]=l,e[6]=d,e[7]=r,e[8]=j):j=e[8];const N=j,w=m??a;let E;e[9]!==c||e[10]!==d.from||e[11]!==d.to?(E=!!d.from.trim()&&!!d.to.trim()&&!c,e[9]=c,e[10]=d.from,e[11]=d.to,e[12]=E):E=e[12];const B=E;let k;e[13]!==r?(k=r("sandbox.redirectFormDialog.title"),e[13]=r,e[14]=k):k=e[14];let D;e[15]!==k?(D=t.jsx(xt,{children:t.jsx(ct,{children:k})}),e[15]=k,e[16]=D):D=e[16];let O;e[17]!==r?(O=r("sandbox.redirectEditor.fromLabel"),e[17]=r,e[18]=O):O=e[18];let L;e[19]!==O?(L=t.jsx(ze,{htmlFor:"redirect-form-from",children:O}),e[19]=O,e[20]=L):L=e[20];const K=d.from;let F;e[21]===Symbol.for("react.memo_cache_sentinel")?(F=xe=>x({from:xe.target.value}),e[21]=F):F=e[21];let _;e[22]!==r?(_=r("sandbox.redirectEditor.fromPlaceholder"),e[22]=r,e[23]=_):_=e[23];let A;e[24]!==c||e[25]!==d.from||e[26]!==_?(A=t.jsx(Ze,{id:"redirect-form-from",value:K,onChange:F,placeholder:_,autoFocus:!0,disabled:c}),e[24]=c,e[25]=d.from,e[26]=_,e[27]=A):A=e[27];let R;e[28]!==A||e[29]!==L?(R=t.jsxs("div",{className:"space-y-1.5",children:[L,A]}),e[28]=A,e[29]=L,e[30]=R):R=e[30];let I;e[31]!==r?(I=r("sandbox.redirectEditor.toLabel"),e[31]=r,e[32]=I):I=e[32];let V;e[33]!==I?(V=t.jsx(ze,{htmlFor:"redirect-form-to",children:I}),e[33]=I,e[34]=V):V=e[34];const z=d.to;let J;e[35]===Symbol.for("react.memo_cache_sentinel")?(J=xe=>x({to:xe.target.value}),e[35]=J):J=e[35];let P;e[36]!==r?(P=r("sandbox.redirectEditor.toPlaceholder"),e[36]=r,e[37]=P):P=e[37];let G;e[38]!==c||e[39]!==d.to||e[40]!==P?(G=t.jsx(Ze,{id:"redirect-form-to",value:z,onChange:J,placeholder:P,disabled:c}),e[38]=c,e[39]=d.to,e[40]=P,e[41]=G):G=e[41];let Y;e[42]!==V||e[43]!==G?(Y=t.jsxs("div",{className:"space-y-1.5",children:[V,G]}),e[42]=V,e[43]=G,e[44]=Y):Y=e[44];let q;e[45]!==r?(q=r("sandbox.redirectEditor.typeLabel"),e[45]=r,e[46]=q):q=e[46];let X;e[47]!==q?(X=t.jsx(ze,{htmlFor:"redirect-form-type",children:q}),e[47]=q,e[48]=X):X=e[48];const ce=d.type;let ne;e[49]===Symbol.for("react.memo_cache_sentinel")?(ne=xe=>x({type:xe}),e[49]=ne):ne=e[49];let de;e[50]!==r?(de=r("sandbox.redirectEditor.typePlaceholder"),e[50]=r,e[51]=de):de=e[51];let te;e[52]!==de?(te=t.jsx(Ma,{id:"redirect-form-type",className:"w-full",children:t.jsx(Va,{placeholder:de})}),e[52]=de,e[53]=te):te=e[53];let re;e[54]!==r?(re=Ll.map(xe=>t.jsx(za,{value:xe.value,children:r(xe.labelKey,{status:Rn[xe.value]})},xe.value)),e[54]=r,e[55]=re):re=e[55];let le;e[56]!==re?(le=t.jsx(Ua,{children:re}),e[56]=re,e[57]=le):le=e[57];let C;e[58]!==c||e[59]!==d.type||e[60]!==te||e[61]!==le?(C=t.jsxs(Ga,{value:ce,onValueChange:ne,disabled:c,children:[te,le]}),e[58]=c,e[59]=d.type,e[60]=te,e[61]=le,e[62]=C):C=e[62];let W;e[63]!==X||e[64]!==C?(W=t.jsxs("div",{className:"space-y-1.5",children:[X,C]}),e[63]=X,e[64]=C,e[65]=W):W=e[65];let Z;e[66]===Symbol.for("react.memo_cache_sentinel")?(Z=xe=>x({discardQueryParameters:xe===!0}),e[66]=Z):Z=e[66];let oe;e[67]!==c||e[68]!==d.discardQueryParameters?(oe=t.jsx(Zt,{checked:d.discardQueryParameters,disabled:c,onCheckedChange:Z}),e[67]=c,e[68]=d.discardQueryParameters,e[69]=oe):oe=e[69];let S;e[70]!==r?(S=r("sandbox.redirectEditor.discardQueryParameters"),e[70]=r,e[71]=S):S=e[71];let se;e[72]!==S?(se=t.jsx("span",{className:"text-sm",children:S}),e[72]=S,e[73]=se):se=e[73];let H;e[74]!==oe||e[75]!==se?(H=t.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5",children:[oe,se]}),e[74]=oe,e[75]=se,e[76]=H):H=e[76];let ie;e[77]!==w?(ie=w&&t.jsx("p",{className:"text-xs text-destructive",children:w}),e[77]=w,e[78]=ie):ie=e[78];let ye;e[79]!==R||e[80]!==Y||e[81]!==W||e[82]!==H||e[83]!==ie?(ye=t.jsxs("div",{className:"space-y-4 py-4",children:[R,Y,W,H,ie]}),e[79]=R,e[80]=Y,e[81]=W,e[82]=H,e[83]=ie,e[84]=ye):ye=e[84];let pe;e[85]!==i?(pe=()=>i(!1),e[85]=i,e[86]=pe):pe=e[86];let ke;e[87]!==r?(ke=r("sandbox.redirectFormDialog.cancel"),e[87]=r,e[88]=ke):ke=e[88];let he;e[89]!==c||e[90]!==pe||e[91]!==ke?(he=t.jsx(Be,{type:"button",variant:"outline",onClick:pe,disabled:c,children:ke}),e[89]=c,e[90]=pe,e[91]=ke,e[92]=he):he=e[92];const je=!B;let Se;e[93]!==c||e[94]!==r?(Se=c?t.jsxs(t.Fragment,{children:[t.jsx(rt,{className:"size-3.5"}),r("sandbox.redirectFormDialog.pending")]}):r("sandbox.redirectFormDialog.submit"),e[93]=c,e[94]=r,e[95]=Se):Se=e[95];let Ae;e[96]!==je||e[97]!==Se?(Ae=t.jsx(Be,{type:"submit",disabled:je,children:Se}),e[96]=je,e[97]=Se,e[98]=Ae):Ae=e[98];let Ce;e[99]!==he||e[100]!==Ae?(Ce=t.jsxs(gt,{children:[he,Ae]}),e[99]=he,e[100]=Ae,e[101]=Ce):Ce=e[101];let Pe;e[102]!==N||e[103]!==ye||e[104]!==Ce||e[105]!==D?(Pe=t.jsx(dt,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:N,children:[D,ye,Ce]})}),e[102]=N,e[103]=ye,e[104]=Ce,e[105]=D,e[106]=Pe):Pe=e[106];let De;return e[107]!==v||e[108]!==s||e[109]!==Pe?(De=t.jsx(ut,{open:s,onOpenChange:v,children:Pe}),e[107]=v,e[108]=s,e[109]=Pe,e[110]=De):De=e[110],De}function Rl(n){const e=ae.c(70),{open:s,blockKey:o,initialName:a,isPending:l,onSubmit:i,onOpenChange:c}=n,r=l===void 0?!1:l,d=we(),[p,m]=$.useState(a),[h,u]=$.useState(s);s!==h&&(u(s),s&&m(a));let f;e[0]!==r||e[1]!==c?(f=ce=>{!ce&&!r&&c(!1)},e[0]=r,e[1]=c,e[2]=f):f=e[2];const g=f;let x;e[3]!==r||e[4]!==p||e[5]!==i?(x=async ce=>{ce.preventDefault();const ne=p.trim();!ne||r||await i(ne)},e[3]=r,e[4]=p,e[5]=i,e[6]=x):x=e[6];const y=x;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let j;e[9]!==v?(j=t.jsx(ct,{children:v}),e[9]=v,e[10]=j):j=e[10];let N;e[11]!==d?(N=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=N):N=e[12];let w;e[13]!==N?(w=t.jsx(Vt,{children:N}),e[13]=N,e[14]=w):w=e[14];let E;e[15]!==j||e[16]!==w?(E=t.jsxs(xt,{children:[j,w]}),e[15]=j,e[16]=w,e[17]=E):E=e[17];let B;e[18]!==d?(B=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=B):B=e[19];let k;e[20]!==B?(k=t.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:B}),e[20]=B,e[21]=k):k=e[21];let D;e[22]===Symbol.for("react.memo_cache_sentinel")?(D=ce=>m(ce.target.value),e[22]=D):D=e[22];let O;e[23]!==r||e[24]!==p?(O=t.jsx(Ze,{id:"section-rename-name",value:p,onChange:D,autoFocus:!0,disabled:r}),e[23]=r,e[24]=p,e[25]=O):O=e[25];let L;e[26]!==k||e[27]!==O?(L=t.jsxs("div",{className:"space-y-1.5",children:[k,O]}),e[26]=k,e[27]=O,e[28]=L):L=e[28];let K;e[29]!==d?(K=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=K):K=e[30];let F;e[31]!==K?(F=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:K}),e[31]=K,e[32]=F):F=e[32];let _;e[33]!==o?(_=t.jsx(Ze,{value:o,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=o,e[34]=_):_=e[34];let A;e[35]!==F||e[36]!==_?(A=t.jsxs("div",{className:"space-y-1.5",children:[F,_]}),e[35]=F,e[36]=_,e[37]=A):A=e[37];let R;e[38]!==L||e[39]!==A?(R=t.jsxs("div",{className:"space-y-4 py-4",children:[L,A]}),e[38]=L,e[39]=A,e[40]=R):R=e[40];let I;e[41]!==c?(I=()=>c(!1),e[41]=c,e[42]=I):I=e[42];let V;e[43]!==d?(V=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=V):V=e[44];let z;e[45]!==r||e[46]!==I||e[47]!==V?(z=t.jsx(Be,{type:"button",variant:"outline",onClick:I,disabled:r,children:V}),e[45]=r,e[46]=I,e[47]=V,e[48]=z):z=e[48];let J;e[49]!==r||e[50]!==p?(J=!p.trim()||r,e[49]=r,e[50]=p,e[51]=J):J=e[51];let P;e[52]!==r||e[53]!==d?(P=r?t.jsxs(t.Fragment,{children:[t.jsx(rt,{className:"size-3.5"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=r,e[53]=d,e[54]=P):P=e[54];let G;e[55]!==J||e[56]!==P?(G=t.jsx(Be,{type:"submit",disabled:J,children:P}),e[55]=J,e[56]=P,e[57]=G):G=e[57];let Y;e[58]!==z||e[59]!==G?(Y=t.jsxs(gt,{children:[z,G]}),e[58]=z,e[59]=G,e[60]=Y):Y=e[60];let q;e[61]!==y||e[62]!==R||e[63]!==Y||e[64]!==E?(q=t.jsx(dt,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:y,children:[E,R,Y]})}),e[61]=y,e[62]=R,e[63]=Y,e[64]=E,e[65]=q):q=e[65];let X;return e[66]!==g||e[67]!==s||e[68]!==q?(X=t.jsx(ut,{open:s,onOpenChange:g,children:q}),e[66]=g,e[67]=s,e[68]=q,e[69]=X):X=e[69],X}function Il(n){const e=ae.c(7),{type:s}=n,o=Rn[s];let a;e[0]!==o?(a=t.jsx(Ye,{asChild:!0,children:t.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:o})}),e[0]=o,e[1]=a):a=e[1];const l=s==="permanent"?"Permanent":"Temporary";let i;e[2]!==l?(i=t.jsx(Qe,{side:"left",children:l}),e[2]=l,e[3]=i):i=e[3];let c;return e[4]!==a||e[5]!==i?(c=t.jsxs(Xe,{children:[a,i]}),e[4]=a,e[5]=i,e[6]=c):c=e[6],c}const Fl=60,fs={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Ps=["posts","authors","categories"],Pt={posts:"post",authors:"author",categories:"category"};function lt(n){return Ps.includes(n)}const ts={posts:"post",authors:"author",categories:"category"},Wn={posts:fs.post,authors:fs.author,categories:fs.category},Kl=Object.fromEntries(Object.entries(Wn).map(([n,e])=>[e,n]));function zl(n){return typeof n=="string"?Kl[n]??null:null}function Ie(n){return n&&typeof n=="object"&&!Array.isArray(n)?n:null}function ee(n){return typeof n=="string"?n:""}function Ml(n,e){switch(n){case"posts":return{label:ee(e.title)||"Untitled post",subtitle:ee(e.slug)};case"authors":return{label:ee(e.name)||"Unnamed author",subtitle:ee(e.email)};case"categories":return{label:ee(e.name)||"Unnamed category",subtitle:ee(e.slug)};default:{const s=n;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Jn(n){const e={posts:[],authors:[],categories:[]};for(const[s,o]of Object.entries(n)){const a=Ie(o);if(!a)continue;const l=zl(a.__resolveType);if(!l)continue;const i=Ie(a[ts[l]])??{},{label:c,subtitle:r}=Ml(l,i);e[l].push({key:s,kind:l,label:c,subtitle:r})}for(const s of Ps)e[s].sort((o,a)=>o.label.localeCompare(a.label));return e}function Vl(n,e){return Jn(n)[e]}function Ue(n,e){return Vl(n,e).map(s=>({key:s.key,payload:mt(Ie(n[s.key])??void 0,e)}))}const Ws=Object.freeze({});function mt(n,e){return n?Ie(n[ts[e]])??Ws:Ws}function it(n,e,s){return{name:n,__resolveType:Wn[e],[ts[e]]:s}}function td({records:n,selected:e,valueField:s,toRef:o}){const a=Array.isArray(e)?e:[],l=h=>typeof h=="string"?h:ee(Ie(h)?.[s]),i=h=>typeof h=="string"?h:ee(Ie(h)?.name),c=h=>{const u=l(h),f=u?n.find(({payload:x})=>ee(x[s])===u):void 0;if(f)return f;const g=i(h);return g?n.find(({payload:x})=>ee(x.name)===g):void 0},r=n.map(({key:h,payload:u})=>({value:h,label:ee(u.name)||ee(u[s])||h})),d=new Map,p=[];return a.forEach((h,u)=>{const f=c(h);if(f){p.includes(f.key)||p.push(f.key);return}const g=`unresolved:${u}`;d.set(g,h),p.push(g),r.push({value:g,label:i(h)||l(h)||"Unknown"})}),{options:r,selectedValues:p,refsForValues:h=>h.map(u=>{const f=n.find(g=>g.key===u);return f?o(f.payload):d.get(u)}).filter(u=>u!==void 0)}}function et(n){return Array.isArray(n)?n:[]}function nt(n){if(typeof n=="string")return n;const e=Ie(n);return e?ee(e.slug):""}function Yn(n){if(typeof n=="string")return n;const e=Ie(n);return e?ee(e.email):""}function Ts(n){const e=[];return ee(n.title).trim()||e.push("Title"),ee(n.slug).trim()||e.push("Slug"),et(n.categories).map(nt).filter(Boolean).length===0&&e.push("Category"),ee(n.excerpt).trim()||e.push("Excerpt"),ee(n.image).trim()||e.push("Cover image"),e}const Bs=["draft","generating","awaiting_review","scheduled","published","archived"],Qn=8;function _t(n){switch(ee(n.status)){case"draft":case"idea":return"draft";case"generating":return"generating";case"awaiting_review":case"in_review":return"awaiting_review";case"scheduled":return"scheduled";case"published":return"published";case"archived":return"archived";case"":return"published";default:return"awaiting_review"}}function Ul(n,e){return e!=="published"&&e!=="scheduled"||_t(n)===e?!1:Ts(n).length>0}function Gl(n){return new Date(n.getFullYear(),n.getMonth(),n.getDate()+1,Qn).toISOString()}function Ut(n,e,s){if(e!=="scheduled")return{...n,status:e,scheduledDatetime:""};const o=ee(n.scheduledDatetime);return{...n,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(o).getTime())?Gl(s):o}}function Xn(n){return Ue(n,"posts").map(({key:e,payload:s})=>({key:e,title:ee(s.title)||"Untitled post",slug:ee(s.slug),date:ee(s.date),scheduledDatetime:ee(s.scheduledDatetime),categorySlugs:et(s.categories).map(nt).filter(Boolean),authorEmails:et(s.authors).map(Yn).filter(Boolean),missing:Ts(s),status:_t(s),form:"live"}))}const Zn="blog-manager/posts/";function eo(n){return n.startsWith(Zn)}function Tt(n){return n.split("/").pop()??n}function Gt(n){return`${Zn}${n}`}function Hl(n){return`collections/blog/posts/${n}`}function xs(){return bt(12)}function ql(n){const e=Ie(n.planning)??{},s=Ie(e.format);return{ideaKey:ee(e.ideaKey)||void 0,pillarKey:ee(e.pillarKey)||void 0,pillarTitle:ee(e.pillarTitle)||void 0,format:s?{name:ee(s.name),value:ee(s.value)}:void 0,brief:ee(e.brief)||void 0}}function to(n){return{title:n.title,slug:"",excerpt:"",date:n.now.toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[],status:"draft",planning:n.planning??{}}}function ft(n,e){return{name:n,[ts.posts]:e}}function sd(n,e){return eo(n)?ft(n,e):it(n,"posts",e)}function Wl(n){const e=[];for(const[s,o]of Object.entries(n)){if(!eo(s))continue;const a=Ie(o);a&&e.push({key:s,payload:mt(a,"posts")})}return e}function Jl(n){return[...Wl(n).map(({key:s,payload:o})=>({key:s,title:ee(o.title)||"Untitled post",slug:ee(o.slug),date:ee(o.date),scheduledDatetime:ee(o.scheduledDatetime),categorySlugs:et(o.categories).map(nt).filter(Boolean),authorEmails:et(o.authors).map(Yn).filter(Boolean),missing:Ts(o),status:_t(o),form:"planning"})),...Xn(n)]}function Yl(n,e,s){const o=Ut(n.payload,e,s),a=Tt(n.key),l=e==="scheduled"||e==="published"?"live":"planning",i=l==="live"?Hl(a):Gt(a),c=l==="live"?it(i,"posts",o):ft(i,o);return{writes:{[i]:c},deletes:i===n.key?[]:[n.key]}}function nd(n,e,s){const o=et(n.categories);if(!o.some(c=>nt(c)===e))return n;const a=o.map(c=>{const r=nt(c);return r===e||r===s.slug?{name:s.name,slug:s.slug}:c}),l=new Set,i=a.filter(c=>{const r=nt(c);return r?l.has(r)?!1:(l.add(r),!0):!0});return{...n,categories:i}}function Ql(n,e){const s=et(n.categories);return s.some(o=>nt(o)===e)?{...n,categories:s.filter(o=>nt(o)!==e)}:n}function Xl(n){const e=ee(n.status),s=e==="idea"||e==="in_review"?{status:_t(n)}:{};return{...n,...s,dateModified:new Date().toISOString()}}function bt(n){const e=new Uint8Array(Math.ceil(n/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,n)}function ps(n,e){const s=`collections/blog/${e}/${bt(12)}`;if(!Object.hasOwn(n,s))return s;throw new Error("Could not generate a unique blog block key")}function so(n){switch(n){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${bt(8)}`,date:new Date().toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${bt(8)}`,description:"",sections:[]};default:{const e=n;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Zl={Paragraph:{title:"Paragraph",description:"Rich text content",iconName:"Pilcrow01"},Heading:{title:"Heading",description:"Section title (H1–H6)",iconName:"HeadingSquare"},Quote:{title:"Quote",description:"Pull quote",iconName:"MessageTextSquare02"},Code:{title:"Code",description:"Code block with syntax highlighting",iconName:"Code02"},List:{title:"List",description:"Bulleted or numbered list",iconName:"List"},BlockImage:{title:"Image",description:"Image with optional caption",iconName:"Image01"},Video:{title:"Video",description:"Embedded video",iconName:"PlayCircle"},Divider:{title:"Divider",description:"Horizontal divider",iconName:"Divider"},Cta:{title:"Call to action",description:"Button linking to a URL",iconName:"CursorClick01"},Callout:{title:"Callout",description:"Highlighted note, tip or warning",iconName:"Lightbulb02"},Stat:{title:"Stat",description:"Single key metric",iconName:"BarChartSquareUp"},StatGroup:{title:"Stat group",description:"Row of metrics",iconName:"BarChartSquare02"},CardGroup:{title:"Card group",description:"Grid of cards",iconName:"LayoutGrid01"},Checklist:{title:"Checklist",description:"List of check items",iconName:"CheckSquare"},Steps:{title:"Steps",description:"Step-by-step guide",iconName:"LayersThree01"},Comparison:{title:"Comparison",description:"Side-by-side comparison",iconName:"Columns03"},Table:{title:"Table",description:"Rows and columns of structured data",iconName:"Table"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},Js="Box";function ei(n){return n.startsWith("site/")?"site":"app"}function ti(n){return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")||n.startsWith("/")}function kt(...n){for(const e of n)if(e!==void 0)return e}function Ys(n){if(n&&!(n.includes("/")||/\.(tsx?|jsx?)$/.test(n)))return n}function si(n){const e=n.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").trim();return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():n}function no(n){const e=new Set,s=[],o=n.manifest?.blocks??{};for(const a of Object.values(o))for(const l of Object.keys(a)){if(!oi(l)||e.has(l))continue;e.add(l);const i=Ss(l,n),c=ss(l),r=Zl[c],d=ei(l),p=Ys(i.title),m=Ys(i.description),h=(d==="site"?kt(p,r?.title):kt(r?.title,p))??si(c),u=d==="site"?kt(m,r?.description):kt(r?.description,m),f=d==="site"?i.icon:void 0,g=f&&ti(f)?f:void 0,x=g!==void 0?r?.iconName??Js:kt(f,r?.iconName)??Js;s.push({resolveType:l,title:h,description:u,iconName:x,iconUrl:g,source:d})}return s.sort((a,l)=>a.title.localeCompare(l.title))}function ss(n){return(n.split("/").pop()??n).replace(/\.(tsx?|jsx?)$/,"")}const ni=["blog/sections/blocks/","site/sections/Blog/Post/"];function oi(n){return ni.some(e=>n.startsWith(e))}const Es="blog-manager-brand";function Ke(n){if(!Array.isArray(n))return[];const e=[];for(const s of n){if(typeof s=="string"){s.trim()&&e.push({name:s,value:""});continue}const o=Ie(s);o&&e.push({name:ee(o.name),value:ee(o.value)})}return e}function Me(n){return n.filter(e=>e.name.trim()||e.value.trim())}const ai=6e4,li=4e3;function ii(n){const e=[],s=new Set,o=(a,l)=>{if(typeof a=="string"){if(!a.includes(" ")||a.length<4||/^(https?:)?\/\//.test(a)||/^data:/.test(a))return;const i=`${l}: ${a.trim()}`;if(s.has(i))return;s.add(i),e.push(i);return}if(Array.isArray(a)){for(const i of a)o(i,l);return}if(a&&typeof a=="object")for(const[i,c]of Object.entries(a))i!=="__resolveType"&&o(c,i)};return o(n,"block"),e.join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-editor-QZzUFuF6.js","assets/index-Ctvi-936.js","assets/index-Bu1JYblV.css","assets/chat-context-CjFWcjj8.js","assets/use-panel-navigate-DF1552Ek.js","assets/thread-route-GQJCQbIv.js","assets/use-project-scope-B3vLbvZA.js","assets/use-virtual-mcp-Dqxt40fM.js","assets/use-mcp-client-m_Sz4iZf.js","assets/auth-BgakXKPk.js","assets/github-repo-BknN0SVI.js","assets/autosend-DY4nuzcJ.js","assets/thread-intent-3bbLxGdx.js","assets/slugify-CEUa2lfQ.js","assets/hooks-kbqC4sX2.js","assets/backoff-8mStPHYB.js","assets/task-board-DOaNpGN6.js","assets/schema-D6awfAhL.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-entitlements-D7k8yH5N.js","assets/use-ai-providers-DlcYODkQ.js","assets/location-oTTXFrSF.js","assets/use-decopilot-events-B_V8T5_L.js","assets/use-organization-settings-BiUMVoFc.js","assets/scroll-area-BcwVFmtC.js","assets/select-DbdcyMHj.js","assets/index-BXBYdF58.js","assets/Check-CnIdd_9P.js","assets/ChevronUp-DParwzId.js","assets/use-section-preview-base-BXTnNZ17.js","assets/UserSquare-BPlvNEAJ.js","assets/Share07-9Pv8XJDP.js","assets/agent-icon-C40LDe51.js","assets/AlertCircle-CXM-5Rz7.js","assets/Tool01-9nUhyzqC.js","assets/ArrowUp-CCVu0dtU.js","assets/ArrowLeft-B3YAbOH6.js","assets/ArrowRight-BrNtBqRw.js","assets/XCircle-CtqXhxVA.js","assets/ZoomOut-osLhZov2.js","assets/Globe04-BW7hjNq6.js","assets/CheckCircle-BildJHaa.js","assets/Copy01-Djbho_fP.js","assets/CreditCard01-CQ0elRRK.js","assets/DotsVertical-BPj4OyP1.js","assets/Download01-p7BaVRQl.js","assets/Eye-DFpsD3-a.js","assets/XClose-DGXZ4fg-.js","assets/Image01-BkfcTYAd.js","assets/Key01-BEz5EbJj.js","assets/LayoutLeft-KwKOo1M6.js","assets/Link01-D1OUtQsA.js","assets/LinkExternal01-Cd_eqSn4.js","assets/Monitor01-DHNiG9tA.js","assets/Sun-Bohup6gv.js","assets/Package-f83ypigE.js","assets/Palette-C6fwO9Ej.js","assets/Plus-CDhl5xCv.js","assets/SearchLg-iC2PilRK.js","assets/SearchMd-DijM-rna.js","assets/Stars01-CICjpCeQ.js","assets/Trash01-Cvwi9LBq.js","assets/Upload01-TIXouDH6.js","assets/User01-f_f_k-NW.js","assets/Users01-C4iYsLmv.js","assets/X-DhnelvIk.js","assets/Zap-C3pVyYpl.js","assets/dialog-Bk6Kebro.js","assets/input-CZ4uOfP7.js","assets/claim-phase-copy-DKro4CLJ.js","assets/section-preview-url-Csj0_ZDg.js","assets/use-session-runtime-CppnHAA5.js","assets/runnable-block-editor-D6afTfM-.js","assets/sandbox-start-errors-BK_aDCyt.js","assets/pair-YOxT8Y4Z.js","assets/format-time-BtXRrtv4.js","assets/differenceInSeconds-C3x8sHUj.js","assets/collapsible-BJhhf5cl.js","assets/use-copy-DvWcMldo.js","assets/usage-stats-CxaimUYo.js","assets/markdown-CtwwBnw-.js","assets/org-file-open-context-D6JnFB7u.js","assets/use-mobile-BfKgXbcz.js","assets/tooltip-BUfDy8oN.js","assets/shell-layout-BVMg_QHb.js","assets/avatar-BO6f7Nen.js","assets/download-app-dialog-M-OyFRiD.js","assets/command-CHrqGr18.js","assets/index-BVycWIXw.js","assets/integration-icon-D6hgdg1a.js","assets/project-icon-DlAGbT7n.js","assets/required-auth-layout-nLQEQh4T.js","assets/use-org-sso-DCuUIxZ0.js","assets/shell-layout-CE2Eihra.css","assets/content-blocks-o63cs2vh.js","assets/mcp-app-renderer-Dq1cvi8J.js","assets/types-BiT3dwSI.js","assets/omit-sandbox-map-jj4lCB2U.js","assets/gateway-client-CFQJjrMC.js","assets/tool-namespace-DmnQIdtF.js","assets/utils-CVEq3hMx.js","assets/sheet-DAQYbpWo.js","assets/use-connection-uWDo4P17.js","assets/use-navigate-to-agent-DwfriOih.js","assets/use-mcp-prompts-BcJMAt9K.js","assets/index-CI15jWLi.js","assets/form-yADqZdIk.js","assets/label-Dc4_9UuZ.js","assets/use-thread-outputs-tkDfjQG8.js","assets/file-type-icon-CcAkuhGz.js","assets/popover-D2pg0djS.js","assets/utils-CAvIkpI3.js","assets/monaco-editor-BweBeJgW.js","assets/editor-Byu9zxpQ.js","assets/calendar-KWF_SVkQ.js","assets/textarea-HozRfHqo.js","assets/rich-text-link-control-LHzHCvLT.js","assets/switch--k34C8Kk.js","assets/combobox-CZs2qxm5.js","assets/alert-dialog-BPoVDBJC.js","assets/sandbox-url-D3mC8qhT.js","assets/search-input-CQj35-JN.js","assets/tabs-Bvg84254.js","assets/use-debounced-value-CCcVGBPY.js","assets/use-file-configs-Bl0EV8VH.js","assets/asset-utils-QwStCl5v.js","assets/useInfiniteQuery-CPlLA5ul.js","assets/infiniteQueryObserver-CRTWhkev.js","assets/match-site-slug-config-D3fUJ6vX.js","assets/toggle-group-D-lFG-8Y.js","assets/decofile-api-CXdlJ97I.js","assets/sandbox-git-api-B1R0585s.js","assets/agent-view-guard-bt0DdpVa.js","assets/use-main-panel-tabs-_-TQPuVC.js","assets/use-route-default-main-DEmXQw5m.js","assets/use-mcp-tools-qMuXZieG.js","assets/index-C2vMrEI2.js","assets/drawer-D7efinO8.js","assets/collection-search-BPxzI8So.js","assets/input-B4Ywlnxu.js","assets/chat-draft-D6ZtIQOo.js","assets/use-deco-credits-CowAAtdj.js","assets/use-open-billing-url-BP3cegA0.js","assets/decopilot-anarTI9Z.js","assets/checkbox-jPE8EKcD.js","assets/ai-providers-logos-DD3qZ33J.js","assets/index-DWshJHD1.js","assets/input-4KygrXS3.js","assets/suggestion-C9QDk1bI.js","assets/use-org-fs-yvYanrBl.js","assets/question-004-sINsf4GQ.js","assets/use-members-CLMVzGW2.js","assets/use-org-auth-client-CIQjTSRb.js","assets/feature-paywall-WqX4N2SW.js","assets/plan-ladder-BdATUMxp.js","assets/add-connection-dialog-CkaqLQ_B.js","assets/extract-connection-data-DE98Pr_f.js","assets/metadata-D72DunRR.js","assets/connection-BU15Ak08.js","assets/connection-card-tGUmmCol.js","assets/connection-slug-CITJ0kGN.js","assets/connection-form-helpers-Dk8X8hjm.js","assets/authenticate-and-persist-oauth-F7mu2TFH.js","assets/mcp-oauth-BRXSxyQ5.js","assets/collection-tabs-CbAt3PeF.js","assets/badge-D58LQVmM.js","assets/use-infinite-scroll-c_IfPmUc.js","assets/useSuspenseInfiniteQuery-BcjInpP_.js","assets/sandbox-lifecycle-context-B3BRP_zT.js","assets/use-task-metadata-CqVA5WzF.js","assets/use-project-native-view-presence-wT-6b5Vq.js","assets/site-slug-uya6Wp4-.js","assets/virtual-mcp-HGt23NdH.js","assets/feature-gate-D2XOux_E.js","assets/mustache-Dlj2nDy_.js","assets/empty-state-CdYt7xiu.js","assets/empty-state-DoF0BaTp.js","assets/github-icon-Cj-t_NbO.js","assets/repository-import-picker-Dj8KeUA4.js","assets/repository-picker-D0Lk5dyv.js","assets/post-editor-toOl1XPu.js","assets/multi-select-DKiX05Od.js","assets/block-document-DXUpHWMb.js","assets/index-CrI8ki7b.js","assets/use-fast-preview-draft-url-6fNwrBW8.js","assets/use-autosave-CDpQJaxL.js","assets/record-editor-BsPd7bUQ.js","assets/context-BZ4dlasJ.js","assets/index-5VocAeHe.js","assets/get-initials-D-f_fDFw.js","assets/category-editor-p_MZjxaR.js","assets/sections-editor-Ci2hLb6p.js","assets/page-seo-form-Waol77Ye.js","assets/variant-matcher-override-64gFzypd.js","assets/seo-editor-CDb27yK8.js","assets/variant-calendar-BVfa1Hpt.js","assets/view-mode-toggle-BLeLxqU-.js","assets/post-calendar-90hRn09B.js","assets/alert-DC_XH-eC.js","assets/redirect-editor-Q-scXYpH.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as ae,b as we,j as t,m as xn,K as It,l as ge,r as $,h as rt,B as Be,o as No,e as wo,t as me,a6 as ys,aB as wt,aK as vt,F as Ft,aC as Os,H as Kt,I as zt,av as Co,_ as Po,$ as To,G as Je,am as Bt,aL as cs,aM as Bo,a0 as Eo,u as gn,aI as qe}from"./index-Ctvi-936.js";import{A as _o}from"./agent-view-guard-bt0DdpVa.js";import{F as Do}from"./feature-gate-D2XOux_E.js";import{u as Et,b as bn}from"./chat-context-CjFWcjj8.js";import{i as Yt}from"./AlertCircle-CXM-5Rz7.js";import{K as Ao,z as yn,L as vn,M as jn,N as tt,O as kn,P as vs,Q as $o,R as Sn,S as Lo,F as Nn,T as Oo,U as Ro,V as Ct,W as Io,X as Fo,n as Ko,Y as zo,Z as wn,_ as Mo,$ as Vo,x as Cn}from"./agent-icon-C40LDe51.js";import{c as Rs}from"./UserSquare-BPlvNEAJ.js";import{i as Pn}from"./ZoomOut-osLhZov2.js";import{i as Mt,a as Is}from"./Share07-9Pv8XJDP.js";import{c as Tn,i as Uo}from"./XClose-DGXZ4fg-.js";import{s as js}from"./Plus-CDhl5xCv.js";import{i as Bn}from"./SearchLg-iC2PilRK.js";import{t as En}from"./Users01-C4iYsLmv.js";import{f as Go,e as Ho,b as qo,A as Wo,a as Jo,d as Yo,c as Qo,g as Xo}from"./alert-dialog-BPoVDBJC.js";import{S as Qt}from"./scroll-area-BcwVFmtC.js";import{T as Ye,a as Qe,c as Xe}from"./tooltip-BUfDy8oN.js";import{B as ot}from"./badge-D58LQVmM.js";import{S as ds,n as Zo,c as ea,g as _n,B as us,P as ta,h as Dn,o as sa,i as hs,u as Xt,l as na,q as oa,R as aa,s as An,r as la,t as ia,d as $n,v as ra,w as ca,x as Ln,y as da,M as ua,j as ma,z as fa,p as pa,A as ha,C as xa,e as ga,f as ba,D as Fs,E as On,k as ya,F as va}from"./runnable-block-editor-D6afTfM-.js";import{r as ks,S as ja,l as Ss,i as ka,m as Sa,o as Na,n as Ot,v as wa,R as Rn,G as Ns,g as Ca,q as Pa,e as Ks,t as Ta,d as Ba,w as Ea,x as zs,h as _a,y as Da,z as Aa}from"./claim-phase-copy-DKro4CLJ.js";import{u as In,P as $a}from"./mustache-Dlj2nDy_.js";import{t as ht}from"./ChevronUp-DParwzId.js";import{i as Fn}from"./Zap-C3pVyYpl.js";import{C as La,a as Oa,b as Ra}from"./collapsible-BJhhf5cl.js";import{c as Ia,d as Fa}from"./sandbox-lifecycle-context-B3BRP_zT.js";import{u as Kn}from"./use-session-runtime-CppnHAA5.js";import{c as xt,d as ct,e as gt,b as dt,D as ut,h as Vt,a as Ka}from"./dialog-Bk6Kebro.js";import{I as Ze}from"./input-CZ4uOfP7.js";import{C as Zt}from"./checkbox-jPE8EKcD.js";import{L as ze}from"./label-Dc4_9UuZ.js";import{c as za,b as Ma,a as Va,d as Ua,S as Ga}from"./select-DbdcyMHj.js";import{a as zn,d as Mn}from"./use-virtual-mcp-Dqxt40fM.js";import{b as Ha,a as qa,p as Wa,s as Ja,t as Ms}from"./decofile-api-CXdlJ97I.js";import{o as Ya}from"./sandbox-git-api-B1R0585s.js";import{a as Vs}from"./utils-CAvIkpI3.js";import{i as Qa}from"./CheckCircle-BildJHaa.js";import{s as ws}from"./Trash01-Cvwi9LBq.js";import{i as ms}from"./Upload01-TIXouDH6.js";import{E as Xa}from"./empty-state-CdYt7xiu.js";import{T as Rt}from"./textarea-HozRfHqo.js";import{u as Za}from"./use-ai-providers-DlcYODkQ.js";import{M as Vn}from"./monaco-editor-BweBeJgW.js";import{i as Cs}from"./X-DhnelvIk.js";import{c as el,b as tl}from"./XCircle-CtqXhxVA.js";import"./rich-text-link-control-LHzHCvLT.js";import{a as sl}from"./Copy01-Djbho_fP.js";import{b as nl}from"./Tool01-9nUhyzqC.js";import{b as Us}from"./use-project-scope-B3vLbvZA.js";import{E as ol}from"./empty-state-DoF0BaTp.js";import{G as Gs}from"./github-icon-Cj-t_NbO.js";import{R as al}from"./repository-import-picker-Dj8KeUA4.js";import{b as ll}from"./thread-route-GQJCQbIv.js";function il(n){const e=ae.c(18),{title:s,description:o,children:a}=n,l=we();let i;e[0]!==a?(i=t.jsx("div",{"aria-hidden":"true",inert:!0,className:"pointer-events-none h-full select-none overflow-hidden",children:a}),e[0]=a,e[1]=i):i=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ao,{}),e[2]=c):c=e[2];let r;e[3]!==l?(r=l("common.soon"),e[3]=l,e[4]=r):r=e[4];let d;e[5]!==r?(d=t.jsxs(ot,{variant:"secondary",children:[c,r]}),e[5]=r,e[6]=d):d=e[6];let p;e[7]!==s?(p=t.jsx("p",{className:"text-base font-semibold text-foreground",children:s}),e[7]=s,e[8]=p):p=e[8];let m;e[9]!==o?(m=o&&t.jsx("p",{className:"text-sm text-muted-foreground",children:o}),e[9]=o,e[10]=m):m=e[10];let h;e[11]!==d||e[12]!==p||e[13]!==m?(h=t.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/60 p-6 backdrop-blur-sm",children:t.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-3 rounded-2xl border bg-card px-8 py-6 text-center shadow-lg",children:[d,p,m]})}),e[11]=d,e[12]=p,e[13]=m,e[14]=h):h=e[14];let u;return e[15]!==i||e[16]!==h?(u=t.jsxs("div",{className:"relative h-full min-h-0",children:[i,h]}),e[15]=i,e[16]=h,e[17]=u):u=e[17],u}function rl(n,e){if(!n||!e?.length)return n;const s=Object.fromEntries(Object.entries(n.properties??{}).filter(([o])=>!e.includes(o)));return Object.keys(s).length>0?{...n,properties:s}:n}function cl(n,e,s){return typeof n!="string"?null:rl(ks(n,e),s)}function Un(n,e,s){if(!e||typeof n!="string")return!1;const o=cl(n,e,s);return!!o&&Object.keys(o.properties??{}).length>0}function jt(n){const e=ae.c(6),{hasItems:s,emptyLabel:o,emptyHint:a}=n;let l;e[0]!==a||e[1]!==o||e[2]!==s?(l=s?"No results match your search.":t.jsxs(t.Fragment,{children:[t.jsx("div",{children:o}),t.jsx("div",{className:"mt-1 text-muted-foreground/80",children:a})]}),e[0]=a,e[1]=o,e[2]=s,e[3]=l):l=e[3];let i;return e[4]!==l?(i=t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:l}),e[4]=l,e[5]=i):i=e[5],i}function es(n,e){return`${n}-${e}`}function Gn(n,e){return`site/apps/${n}/${e}.ts`}function Hn(n){const e=n.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=n.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function dl(n){const e=n.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function ul(n){return n==="local"?"Custom":"Installed"}function qn(n,e,s){const o=new Set([es(n,e),e].map(l=>l.toLowerCase())),a=Gn(n,e);for(const[l,i]of Object.entries(s)){if(l.includes("/")||!i||typeof i!="object"||Array.isArray(i))continue;const c=i;if(o.has(l.toLowerCase())||c.__resolveType===a)return l}return null}function ml(n,e){const s=n.vendor.alias,o=n.name,a=qn(s,o,e);return{id:es(s,o),app:o,vendor:s,title:n.title||n.name,description:n.description,category:n.category??"Other",logo:n.logo||void 0,resolveType:Gn(s,o),blockKey:a,installed:a!==null}}function fl(n,e,s){if(n===ja)return null;const o=Hn(n);if(!o)return null;const{vendor:a,app:l}=o,i=qn(a,l,s),c=Ss(n,e);return{id:es(a,l),app:l,vendor:a,title:c.title??l,description:c.description??"",category:"Others",logo:c.logo??c.icon,resolveType:n,blockKey:i,installed:i!==null}}function pl(n,e,s){const o=e.__resolveType;if(typeof o!="string"||ka(n,e)||!Sa(o))return null;const a=Hn(o)??dl(n);if(!a)return null;const l=Ss(o,s),{vendor:i,app:c}=a;return{id:es(i,c),app:c,vendor:i,title:l.title??Na(n,e,s),description:l.description??"",category:ul(i),logo:l.logo??l.icon,resolveType:o,blockKey:n,installed:!0}}function hl(n,e,s){const o=new Map;for(const l of n){const i=ml(l,s);o.set(i.id,i)}const a=e.manifest?.blocks?.apps??{};for(const l of Object.keys(a)){const i=fl(l,e,s);!i||o.has(i.id)||o.set(i.id,i)}for(const[l,i]of Object.entries(s)){if(l.includes("/")||!i||typeof i!="object"||Array.isArray(i))continue;const c=pl(l,i,e);!c||o.has(c.id)||o.set(c.id,c)}return[...o.values()].sort(xl)}function xl(n,e){return n.installed!==e.installed?n.installed?-1:1:n.title.localeCompare(e.title)}async function gl(){const n=await fetch("/api/deco-apps");if(!n.ok)throw new Error(`Failed to fetch deco apps: ${n.status}`);return(await n.json()).apps??[]}function bl(n,e,s){const o=ae.c(12),a=s?.enabled??!0;let l;o[0]===Symbol.for("react.memo_cache_sentinel")?(l=It.decoApps(),o[0]=l):l=o[0];let i;o[1]!==a?(i={queryKey:l,queryFn:gl,staleTime:3e5,retry:1,enabled:a},o[1]=a,o[2]=i):i=o[2];const c=xn(i);let r;o[3]!==e||o[4]!==n||o[5]!==c.data?(r=n&&e?hl(c.data??[],n,e):[],o[3]=e,o[4]=n,o[5]=c.data,o[6]=r):r=o[6];const d=r,p=c.isLoading&&!c.isError;let m;return o[7]!==d||o[8]!==c.isError||o[9]!==c.refetch||o[10]!==p?(m={catalog:d,isLoading:p,isError:c.isError,refetch:c.refetch},o[7]=d,o[8]=c.isError,o[9]=c.refetch,o[10]=p,o[11]=m):m=o[11],m}const yl=["sections","apps","loaders","actions"];function vl(n){const e=ae.c(59),{active:s,counts:o,showBlog:a,onSelect:l}=n,i=we();let c;e[0]!==i?(c=i("sandbox.collectionsSidebar.content"),e[0]=i,e[1]=c):c=e[1];let r;e[2]!==c?(r=t.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:t.jsx("span",{className:"text-sm font-medium",children:c})}),e[2]=c,e[3]=r):r=e[3];let d;e[4]!==i?(d=i("sandbox.collectionsSidebar.pages"),e[4]=i,e[5]=d):d=e[5];const p=s==="pages";let m;e[6]!==o.pages||e[7]!==l||e[8]!==d||e[9]!==p?(m=t.jsx(Fe,{id:"pages",icon:yn,label:d,count:o.pages,active:p,onSelect:l}),e[6]=o.pages,e[7]=l,e[8]=d,e[9]=p,e[10]=m):m=e[10];let h;e[11]!==i?(h=i("sandbox.collectionsSidebar.redirects"),e[11]=i,e[12]=h):h=e[12];const u=s==="redirects";let f;e[13]!==o.redirects||e[14]!==l||e[15]!==h||e[16]!==u?(f=t.jsx(Fe,{id:"redirects",icon:vn,label:h,count:o.redirects,active:u,onSelect:l}),e[13]=o.redirects,e[14]=l,e[15]=h,e[16]=u,e[17]=f):f=e[17];let g;e[18]!==i?(g=i("sandbox.collectionsSidebar.site"),e[18]=i,e[19]=g):g=e[19];const x=s==="site";let y;e[20]!==l||e[21]!==x||e[22]!==g?(y=t.jsx(Fe,{id:"site",icon:$o,label:g,active:x,onSelect:l}),e[20]=l,e[21]=x,e[22]=g,e[23]=y):y=e[23];let v;e[24]!==i?(v=i("sandbox.collectionsSidebar.seo"),e[24]=i,e[25]=v):v=e[25];const j=s==="seo";let N;e[26]!==l||e[27]!==v||e[28]!==j?(N=t.jsx(Fe,{id:"seo",icon:Sn,label:v,active:j,onSelect:l}),e[26]=l,e[27]=v,e[28]=j,e[29]=N):N=e[29];let w;e[30]!==i?(w=i("sandbox.collectionsSidebar.calendar"),e[30]=i,e[31]=w):w=e[31];const E=s==="calendar";let B;e[32]!==l||e[33]!==w||e[34]!==E?(B=t.jsx(Fe,{id:"calendar",icon:Lo,label:w,active:E,onSelect:l}),e[32]=l,e[33]=w,e[34]=E,e[35]=B):B=e[35];let k;e[36]!==s||e[37]!==o||e[38]!==l?(k=t.jsx(jl,{active:s,counts:o,onSelect:l}),e[36]=s,e[37]=o,e[38]=l,e[39]=k):k=e[39];let D;e[40]!==s||e[41]!==o.authors||e[42]!==o.categories||e[43]!==o.posts||e[44]!==l||e[45]!==a||e[46]!==i?(D=a&&t.jsxs(t.Fragment,{children:[t.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:[t.jsx(jn,{size:13,className:"shrink-0"}),i("sandbox.collectionsSidebar.blog")]}),t.jsx(Fe,{id:"context",icon:tt,label:i("sandbox.collectionsSidebar.context"),active:s==="context",onSelect:l}),t.jsx(Fe,{id:"posts",icon:Pn,label:i("sandbox.collectionsSidebar.posts"),count:o.posts,active:s==="posts",onSelect:l}),t.jsx(Fe,{id:"authors",icon:En,label:i("sandbox.collectionsSidebar.authors"),count:o.authors,active:s==="authors",onSelect:l}),t.jsx(Fe,{id:"categories",icon:kn,label:i("sandbox.collectionsSidebar.categories"),count:o.categories,active:s==="categories",onSelect:l}),t.jsx(Fe,{id:"post-schedule",icon:vs,label:i("sandbox.collectionsSidebar.postSchedule"),active:s==="post-schedule",onSelect:l})]}),e[40]=s,e[41]=o.authors,e[42]=o.categories,e[43]=o.posts,e[44]=l,e[45]=a,e[46]=i,e[47]=D):D=e[47];let O;e[48]!==y||e[49]!==N||e[50]!==B||e[51]!==k||e[52]!==D||e[53]!==m||e[54]!==f?(O=t.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[m,f,y,N,B,k,D]}),e[48]=y,e[49]=N,e[50]=B,e[51]=k,e[52]=D,e[53]=m,e[54]=f,e[55]=O):O=e[55];let L;return e[56]!==r||e[57]!==O?(L=t.jsxs("div",{className:"w-[208px] shrink-0 border-r flex flex-col",children:[r,O]}),e[56]=r,e[57]=O,e[58]=L):L=e[58],L}function jl(n){const e=ae.c(52),{active:s,counts:o,onSelect:a}=n,l=we();let i;e[0]!==s?(i=yl.includes(s),e[0]=s,e[1]=i):i=e[1];const c=i,[r,d]=$.useState(!1),p=r||c;let m,h;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=ge("flex w-full items-center gap-2 classic:rounded-md compact:rounded-lg px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer","text-muted-foreground hover:bg-muted hover:text-foreground"),h=t.jsx(Oo,{size:16,className:"shrink-0"}),e[2]=m,e[3]=h):(m=e[2],h=e[3]);let u;e[4]!==l?(u=l("sandbox.collectionsSidebar.advanced"),e[4]=l,e[5]=u):u=e[5];let f;e[6]!==u?(f=t.jsx("span",{className:"flex-1 truncate",children:u}),e[6]=u,e[7]=f):f=e[7];const g=p&&"rotate-180";let x;e[8]!==g?(x=ge("shrink-0 text-muted-foreground/70 transition-transform",g),e[8]=g,e[9]=x):x=e[9];let y;e[10]!==x?(y=t.jsx(ht,{size:16,className:x}),e[10]=x,e[11]=y):y=e[11];let v;e[12]!==f||e[13]!==y?(v=t.jsxs(La,{className:m,children:[h,f,y]}),e[12]=f,e[13]=y,e[14]=v):v=e[14];let j;e[15]!==l?(j=l("sandbox.collectionsSidebar.sections"),e[15]=l,e[16]=j):j=e[16];const N=s==="sections";let w;e[17]!==o.sections||e[18]!==a||e[19]!==j||e[20]!==N?(w=t.jsx(Fe,{id:"sections",icon:Mt,label:j,count:o.sections,active:N,onSelect:a,indent:!0}),e[17]=o.sections,e[18]=a,e[19]=j,e[20]=N,e[21]=w):w=e[21];let E;e[22]!==l?(E=l("sandbox.collectionsSidebar.apps"),e[22]=l,e[23]=E):E=e[23];const B=s==="apps";let k;e[24]!==o.apps||e[25]!==a||e[26]!==E||e[27]!==B?(k=t.jsx(Fe,{id:"apps",icon:Tn,label:E,count:o.apps,active:B,onSelect:a,indent:!0}),e[24]=o.apps,e[25]=a,e[26]=E,e[27]=B,e[28]=k):k=e[28];let D;e[29]!==l?(D=l("sandbox.collectionsSidebar.loaders"),e[29]=l,e[30]=D):D=e[30];const O=s==="loaders";let L;e[31]!==o.loaders||e[32]!==a||e[33]!==D||e[34]!==O?(L=t.jsx(Fe,{id:"loaders",icon:Nn,label:D,count:o.loaders,active:O,onSelect:a,indent:!0}),e[31]=o.loaders,e[32]=a,e[33]=D,e[34]=O,e[35]=L):L=e[35];let K;e[36]!==l?(K=l("sandbox.collectionsSidebar.actions"),e[36]=l,e[37]=K):K=e[37];const F=s==="actions";let _;e[38]!==o.actions||e[39]!==a||e[40]!==K||e[41]!==F?(_=t.jsx(Fe,{id:"actions",icon:Fn,label:K,count:o.actions,active:F,onSelect:a,indent:!0}),e[38]=o.actions,e[39]=a,e[40]=K,e[41]=F,e[42]=_):_=e[42];let A;e[43]!==w||e[44]!==k||e[45]!==L||e[46]!==_?(A=t.jsxs(Oa,{className:"flex flex-col gap-0.5 pt-0.5",children:[w,k,L,_]}),e[43]=w,e[44]=k,e[45]=L,e[46]=_,e[47]=A):A=e[47];let R;return e[48]!==p||e[49]!==A||e[50]!==v?(R=t.jsxs(Ra,{open:p,onOpenChange:d,children:[v,A]}),e[48]=p,e[49]=A,e[50]=v,e[51]=R):R=e[51],R}function Fe(n){const e=ae.c(19),{id:s,icon:o,label:a,count:l,active:i,onSelect:c,indent:r}=n;let d;e[0]!==s||e[1]!==c?(d=()=>c(s),e[0]=s,e[1]=c,e[2]=d):d=e[2];const p=r&&"pl-6",m=i?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let h;e[3]!==p||e[4]!==m?(h=ge("flex w-full items-center gap-2 classic:rounded-md compact:rounded-lg px-2.5 py-1.5 text-left text-sm transition-colors cursor-pointer",p,m),e[3]=p,e[4]=m,e[5]=h):h=e[5];let u;e[6]!==o?(u=t.jsx(o,{size:16,className:"shrink-0"}),e[6]=o,e[7]=u):u=e[7];let f;e[8]!==a?(f=t.jsx("span",{className:"flex-1 truncate",children:a}),e[8]=a,e[9]=f):f=e[9];let g;e[10]!==i||e[11]!==l?(g=l!==void 0&&t.jsx("span",{className:ge("shrink-0 text-xs tabular-nums",i?"text-accent-foreground/70":"text-muted-foreground/70"),children:l}),e[10]=i,e[11]=l,e[12]=g):g=e[12];let x;return e[13]!==d||e[14]!==h||e[15]!==u||e[16]!==f||e[17]!==g?(x=t.jsxs("button",{type:"button",onClick:d,className:h,children:[u,f,g]}),e[13]=d,e[14]=h,e[15]=u,e[16]=f,e[17]=g,e[18]=x):x=e[18],x}function kl(n){const e=ae.c(12),{state:s,claimPhase:o,lifecycle:a,onStart:l,connectionsHref:i}=n;switch(s.kind){case"starting":{let c;e[0]!==o||e[1]!==a?(c=Zo({claimPhase:o,lifecycle:a}),e[0]=o,e[1]=a,e[2]=c):c=e[2];let r;return e[3]!==o||e[4]!==c?(r=t.jsx(ds,{kind:"starting",progress:c,claimPhase:o}),e[3]=o,e[4]=c,e[5]=r):r=e[5],r}case"suspended":{let c;return e[6]!==l?(c=t.jsx(ds,{kind:"suspended",onResume:l}),e[6]=l,e[7]=c):c=e[7],c}case"errored":{let c;return e[8]!==i||e[9]!==l||e[10]!==s.error?(c=t.jsx(ds,{kind:"errored",error:s.error,onRetry:l,connectionsHref:i}),e[8]=i,e[9]=l,e[10]=s.error,e[11]=c):c=e[11],c}}}const Sl=new Set(["clone-failed","install-failed","start-failed","crashed"]);function Nl(n){if(n.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(n.previewState.kind!=="iframe")return{kind:"sandbox-card",state:n.previewState};const e=n.lifecyclePhase==="running",s=!e&&!Sl.has(n.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function Hs(n,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),o=`${s} (copy)`;if(!n.has(o))return o;for(let a=2;a<1e3;a++){const l=`${s} (copy ${a})`;if(!n.has(l))return l}return`${s} (copy ${Date.now()})`}function wl(n,e){const s=Ot,o=e.replace(/-copy(?:-\d+)?$/,""),a=`${o}-copy`;if(!n.has(s(a)))return a;for(let l=2;l<1e3;l++){const i=`${o}-copy-${l}`;if(!n.has(s(i)))return i}return`${o}-copy-${Date.now()}`}function Cl(n,e){const s=e.replace(/_copy(?:_\d+)?$/,""),o=`${s}_copy`;if(!Object.hasOwn(n,o))return o;for(let a=2;a<1e3;a++){const l=`${s}_copy_${a}`;if(!Object.hasOwn(n,l))return l}return`${s}_copy_${Date.now()}`}function Pl(n){const e=_n(n.newName),s={...n.source,name:n.newName,path:n.newPath};return{key:e,data:s}}function Tl(n,e){return ea(n,e)}const Bl=1e3;function El(n,e){for(let s=0;s<Bl;s++){const o=_n(e);if(!Object.hasOwn(n,o))return o}throw new Error("Could not generate a unique page block key")}const _l={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},Dl={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},Al={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function $l(n){const e=ae.c(88),{open:s,mode:o,initialName:a,initialPath:l,isPending:i,error:c,templates:r,validate:d,onSubmit:p,onOpenChange:m}=n,h=i===void 0?!1:i,u=we(),[f,g]=$.useState(a),[x,y]=$.useState(l),[v,j]=$.useState(us),[N,w]=$.useState(null),[E,B]=$.useState(s);s!==E&&(B(s),s&&(g(a),y(l),j(us),w(null)));const k=o==="create"&&!!r?.length;let D;e[0]!==h||e[1]!==m?(D=pe=>{!pe&&!h&&(w(null),m(!1))},e[0]=h,e[1]=m,e[2]=D):D=e[2];const O=D;let L;e[3]!==h||e[4]!==f||e[5]!==p||e[6]!==x||e[7]!==k||e[8]!==v||e[9]!==d?(L=async pe=>{pe.preventDefault();const ke=f.trim(),he=x.trim();if(!ke||!he||h)return;const je=wa(he);if(je){w(je);return}const Se=d?.({name:ke,path:he});if(Se){w(Se);return}w(null),await p({name:ke,path:he,templateKey:k&&v!==us?v:null})},e[3]=h,e[4]=f,e[5]=p,e[6]=x,e[7]=k,e[8]=v,e[9]=d,e[10]=L):L=e[10];const K=L,F=N??c,_=_l[o];let A;e[11]!==u||e[12]!==_?(A=u(_),e[11]=u,e[12]=_,e[13]=A):A=e[13];let R;e[14]!==A?(R=t.jsx(xt,{children:t.jsx(ct,{children:A})}),e[14]=A,e[15]=R):R=e[15];let I;e[16]!==h||e[17]!==k||e[18]!==u||e[19]!==v||e[20]!==r?(I=k&&t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:u("sandbox.pageFormDialog.labelTemplate")}),t.jsx(ta,{id:"page-form-template",value:v,onChange:j,templates:r??[],disabled:h})]}),e[16]=h,e[17]=k,e[18]=u,e[19]=v,e[20]=r,e[21]=I):I=e[21];let V;e[22]!==u?(V=u("sandbox.pageFormDialog.labelName"),e[22]=u,e[23]=V):V=e[23];let z;e[24]!==V?(z=t.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:V}),e[24]=V,e[25]=z):z=e[25];let J;e[26]===Symbol.for("react.memo_cache_sentinel")?(J=pe=>g(pe.target.value),e[26]=J):J=e[26];let P;e[27]!==u?(P=u("sandbox.pageFormDialog.placeholderName"),e[27]=u,e[28]=P):P=e[28];let G;e[29]!==h||e[30]!==f||e[31]!==P?(G=t.jsx(Ze,{id:"page-form-name",value:f,onChange:J,placeholder:P,autoFocus:!0,disabled:h}),e[29]=h,e[30]=f,e[31]=P,e[32]=G):G=e[32];let Y;e[33]!==G||e[34]!==z?(Y=t.jsxs("div",{className:"space-y-1.5",children:[z,G]}),e[33]=G,e[34]=z,e[35]=Y):Y=e[35];let q;e[36]!==u?(q=u("sandbox.pageFormDialog.labelPath"),e[36]=u,e[37]=q):q=e[37];let X;e[38]!==q?(X=t.jsx("label",{htmlFor:"page-form-path",className:"text-xs font-medium text-muted-foreground",children:q}),e[38]=q,e[39]=X):X=e[39];let ce;e[40]===Symbol.for("react.memo_cache_sentinel")?(ce=pe=>y(pe.target.value),e[40]=ce):ce=e[40];let ne;e[41]!==u?(ne=u("sandbox.pageFormDialog.placeholderPath"),e[41]=u,e[42]=ne):ne=e[42];let de;e[43]!==h||e[44]!==x||e[45]!==ne?(de=t.jsx(Ze,{id:"page-form-path",value:x,onChange:ce,placeholder:ne,disabled:h}),e[43]=h,e[44]=x,e[45]=ne,e[46]=de):de=e[46];let te;e[47]!==X||e[48]!==de?(te=t.jsxs("div",{className:"space-y-1.5",children:[X,de]}),e[47]=X,e[48]=de,e[49]=te):te=e[49];let re;e[50]!==F?(re=F&&t.jsx("p",{className:"text-xs text-destructive",children:F}),e[50]=F,e[51]=re):re=e[51];let le;e[52]!==Y||e[53]!==te||e[54]!==re||e[55]!==I?(le=t.jsxs("div",{className:"space-y-4 py-4",children:[I,Y,te,re]}),e[52]=Y,e[53]=te,e[54]=re,e[55]=I,e[56]=le):le=e[56];let C;e[57]!==m?(C=()=>m(!1),e[57]=m,e[58]=C):C=e[58];let W;e[59]!==u?(W=u("sandbox.pageFormDialog.buttonCancel"),e[59]=u,e[60]=W):W=e[60];let Z;e[61]!==h||e[62]!==C||e[63]!==W?(Z=t.jsx(Be,{type:"button",variant:"outline",onClick:C,disabled:h,children:W}),e[61]=h,e[62]=C,e[63]=W,e[64]=Z):Z=e[64];let oe;e[65]!==h||e[66]!==f||e[67]!==x?(oe=!f.trim()||!x.trim()||h,e[65]=h,e[66]=f,e[67]=x,e[68]=oe):oe=e[68];let S;e[69]!==h||e[70]!==o||e[71]!==u?(S=h?t.jsxs(t.Fragment,{children:[t.jsx(rt,{className:"size-3.5"}),u(Al[o])]}):u(Dl[o]),e[69]=h,e[70]=o,e[71]=u,e[72]=S):S=e[72];let se;e[73]!==oe||e[74]!==S?(se=t.jsx(Be,{type:"submit",disabled:oe,children:S}),e[73]=oe,e[74]=S,e[75]=se):se=e[75];let H;e[76]!==Z||e[77]!==se?(H=t.jsxs(gt,{children:[Z,se]}),e[76]=Z,e[77]=se,e[78]=H):H=e[78];let ie;e[79]!==K||e[80]!==le||e[81]!==H||e[82]!==R?(ie=t.jsx(dt,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:K,children:[R,le,H]})}),e[79]=K,e[80]=le,e[81]=H,e[82]=R,e[83]=ie):ie=e[83];let ye;return e[84]!==O||e[85]!==s||e[86]!==ie?(ye=t.jsx(ut,{open:s,onOpenChange:O,children:ie}),e[84]=O,e[85]=s,e[86]=ie,e[87]=ye):ye=e[87],ye}const Ll=[{value:"temporary",labelKey:"sandbox.redirectEditor.typeTemporary"},{value:"permanent",labelKey:"sandbox.redirectEditor.typePermanent"}],qs={from:"",to:"",type:"temporary",discardQueryParameters:!1};function Ol(n){const e=ae.c(111),{open:s,isPending:o,error:a,onSubmit:l,onOpenChange:i}=n,c=o===void 0?!1:o,r=we(),[d,p]=$.useState(qs),[m,h]=$.useState(null),[u,f]=$.useState(s);s!==u&&(f(s),s&&(p(qs),h(null)));let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=xe=>p($e=>({...$e,...xe})),e[0]=g):g=e[0];const x=g;let y;e[1]!==c||e[2]!==i?(y=xe=>{!xe&&!c&&(h(null),i(!1))},e[1]=c,e[2]=i,e[3]=y):y=e[3];const v=y;let j;e[4]!==c||e[5]!==l||e[6]!==d||e[7]!==r?(j=async xe=>{xe.preventDefault();const $e=d.from.trim(),Le=d.to.trim();if(!$e||!Le||c){h(r("sandbox.redirectFormDialog.errorRequired"));return}h(null),await l({...d,from:$e,to:Le})},e[4]=c,e[5]=l,e[6]=d,e[7]=r,e[8]=j):j=e[8];const N=j,w=m??a;let E;e[9]!==c||e[10]!==d.from||e[11]!==d.to?(E=!!d.from.trim()&&!!d.to.trim()&&!c,e[9]=c,e[10]=d.from,e[11]=d.to,e[12]=E):E=e[12];const B=E;let k;e[13]!==r?(k=r("sandbox.redirectFormDialog.title"),e[13]=r,e[14]=k):k=e[14];let D;e[15]!==k?(D=t.jsx(xt,{children:t.jsx(ct,{children:k})}),e[15]=k,e[16]=D):D=e[16];let O;e[17]!==r?(O=r("sandbox.redirectEditor.fromLabel"),e[17]=r,e[18]=O):O=e[18];let L;e[19]!==O?(L=t.jsx(ze,{htmlFor:"redirect-form-from",children:O}),e[19]=O,e[20]=L):L=e[20];const K=d.from;let F;e[21]===Symbol.for("react.memo_cache_sentinel")?(F=xe=>x({from:xe.target.value}),e[21]=F):F=e[21];let _;e[22]!==r?(_=r("sandbox.redirectEditor.fromPlaceholder"),e[22]=r,e[23]=_):_=e[23];let A;e[24]!==c||e[25]!==d.from||e[26]!==_?(A=t.jsx(Ze,{id:"redirect-form-from",value:K,onChange:F,placeholder:_,autoFocus:!0,disabled:c}),e[24]=c,e[25]=d.from,e[26]=_,e[27]=A):A=e[27];let R;e[28]!==A||e[29]!==L?(R=t.jsxs("div",{className:"space-y-1.5",children:[L,A]}),e[28]=A,e[29]=L,e[30]=R):R=e[30];let I;e[31]!==r?(I=r("sandbox.redirectEditor.toLabel"),e[31]=r,e[32]=I):I=e[32];let V;e[33]!==I?(V=t.jsx(ze,{htmlFor:"redirect-form-to",children:I}),e[33]=I,e[34]=V):V=e[34];const z=d.to;let J;e[35]===Symbol.for("react.memo_cache_sentinel")?(J=xe=>x({to:xe.target.value}),e[35]=J):J=e[35];let P;e[36]!==r?(P=r("sandbox.redirectEditor.toPlaceholder"),e[36]=r,e[37]=P):P=e[37];let G;e[38]!==c||e[39]!==d.to||e[40]!==P?(G=t.jsx(Ze,{id:"redirect-form-to",value:z,onChange:J,placeholder:P,disabled:c}),e[38]=c,e[39]=d.to,e[40]=P,e[41]=G):G=e[41];let Y;e[42]!==V||e[43]!==G?(Y=t.jsxs("div",{className:"space-y-1.5",children:[V,G]}),e[42]=V,e[43]=G,e[44]=Y):Y=e[44];let q;e[45]!==r?(q=r("sandbox.redirectEditor.typeLabel"),e[45]=r,e[46]=q):q=e[46];let X;e[47]!==q?(X=t.jsx(ze,{htmlFor:"redirect-form-type",children:q}),e[47]=q,e[48]=X):X=e[48];const ce=d.type;let ne;e[49]===Symbol.for("react.memo_cache_sentinel")?(ne=xe=>x({type:xe}),e[49]=ne):ne=e[49];let de;e[50]!==r?(de=r("sandbox.redirectEditor.typePlaceholder"),e[50]=r,e[51]=de):de=e[51];let te;e[52]!==de?(te=t.jsx(Ma,{id:"redirect-form-type",className:"w-full",children:t.jsx(Va,{placeholder:de})}),e[52]=de,e[53]=te):te=e[53];let re;e[54]!==r?(re=Ll.map(xe=>t.jsx(za,{value:xe.value,children:r(xe.labelKey,{status:Rn[xe.value]})},xe.value)),e[54]=r,e[55]=re):re=e[55];let le;e[56]!==re?(le=t.jsx(Ua,{children:re}),e[56]=re,e[57]=le):le=e[57];let C;e[58]!==c||e[59]!==d.type||e[60]!==te||e[61]!==le?(C=t.jsxs(Ga,{value:ce,onValueChange:ne,disabled:c,children:[te,le]}),e[58]=c,e[59]=d.type,e[60]=te,e[61]=le,e[62]=C):C=e[62];let W;e[63]!==X||e[64]!==C?(W=t.jsxs("div",{className:"space-y-1.5",children:[X,C]}),e[63]=X,e[64]=C,e[65]=W):W=e[65];let Z;e[66]===Symbol.for("react.memo_cache_sentinel")?(Z=xe=>x({discardQueryParameters:xe===!0}),e[66]=Z):Z=e[66];let oe;e[67]!==c||e[68]!==d.discardQueryParameters?(oe=t.jsx(Zt,{checked:d.discardQueryParameters,disabled:c,onCheckedChange:Z}),e[67]=c,e[68]=d.discardQueryParameters,e[69]=oe):oe=e[69];let S;e[70]!==r?(S=r("sandbox.redirectEditor.discardQueryParameters"),e[70]=r,e[71]=S):S=e[71];let se;e[72]!==S?(se=t.jsx("span",{className:"text-sm",children:S}),e[72]=S,e[73]=se):se=e[73];let H;e[74]!==oe||e[75]!==se?(H=t.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5",children:[oe,se]}),e[74]=oe,e[75]=se,e[76]=H):H=e[76];let ie;e[77]!==w?(ie=w&&t.jsx("p",{className:"text-xs text-destructive",children:w}),e[77]=w,e[78]=ie):ie=e[78];let ye;e[79]!==R||e[80]!==Y||e[81]!==W||e[82]!==H||e[83]!==ie?(ye=t.jsxs("div",{className:"space-y-4 py-4",children:[R,Y,W,H,ie]}),e[79]=R,e[80]=Y,e[81]=W,e[82]=H,e[83]=ie,e[84]=ye):ye=e[84];let pe;e[85]!==i?(pe=()=>i(!1),e[85]=i,e[86]=pe):pe=e[86];let ke;e[87]!==r?(ke=r("sandbox.redirectFormDialog.cancel"),e[87]=r,e[88]=ke):ke=e[88];let he;e[89]!==c||e[90]!==pe||e[91]!==ke?(he=t.jsx(Be,{type:"button",variant:"outline",onClick:pe,disabled:c,children:ke}),e[89]=c,e[90]=pe,e[91]=ke,e[92]=he):he=e[92];const je=!B;let Se;e[93]!==c||e[94]!==r?(Se=c?t.jsxs(t.Fragment,{children:[t.jsx(rt,{className:"size-3.5"}),r("sandbox.redirectFormDialog.pending")]}):r("sandbox.redirectFormDialog.submit"),e[93]=c,e[94]=r,e[95]=Se):Se=e[95];let Ae;e[96]!==je||e[97]!==Se?(Ae=t.jsx(Be,{type:"submit",disabled:je,children:Se}),e[96]=je,e[97]=Se,e[98]=Ae):Ae=e[98];let Ce;e[99]!==he||e[100]!==Ae?(Ce=t.jsxs(gt,{children:[he,Ae]}),e[99]=he,e[100]=Ae,e[101]=Ce):Ce=e[101];let Pe;e[102]!==N||e[103]!==ye||e[104]!==Ce||e[105]!==D?(Pe=t.jsx(dt,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:N,children:[D,ye,Ce]})}),e[102]=N,e[103]=ye,e[104]=Ce,e[105]=D,e[106]=Pe):Pe=e[106];let De;return e[107]!==v||e[108]!==s||e[109]!==Pe?(De=t.jsx(ut,{open:s,onOpenChange:v,children:Pe}),e[107]=v,e[108]=s,e[109]=Pe,e[110]=De):De=e[110],De}function Rl(n){const e=ae.c(70),{open:s,blockKey:o,initialName:a,isPending:l,onSubmit:i,onOpenChange:c}=n,r=l===void 0?!1:l,d=we(),[p,m]=$.useState(a),[h,u]=$.useState(s);s!==h&&(u(s),s&&m(a));let f;e[0]!==r||e[1]!==c?(f=ce=>{!ce&&!r&&c(!1)},e[0]=r,e[1]=c,e[2]=f):f=e[2];const g=f;let x;e[3]!==r||e[4]!==p||e[5]!==i?(x=async ce=>{ce.preventDefault();const ne=p.trim();!ne||r||await i(ne)},e[3]=r,e[4]=p,e[5]=i,e[6]=x):x=e[6];const y=x;let v;e[7]!==d?(v=d("sandbox.sectionRenameDialog.title"),e[7]=d,e[8]=v):v=e[8];let j;e[9]!==v?(j=t.jsx(ct,{children:v}),e[9]=v,e[10]=j):j=e[10];let N;e[11]!==d?(N=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=N):N=e[12];let w;e[13]!==N?(w=t.jsx(Vt,{children:N}),e[13]=N,e[14]=w):w=e[14];let E;e[15]!==j||e[16]!==w?(E=t.jsxs(xt,{children:[j,w]}),e[15]=j,e[16]=w,e[17]=E):E=e[17];let B;e[18]!==d?(B=d("sandbox.sectionRenameDialog.nameLabel"),e[18]=d,e[19]=B):B=e[19];let k;e[20]!==B?(k=t.jsx("label",{htmlFor:"section-rename-name",className:"text-xs font-medium text-muted-foreground",children:B}),e[20]=B,e[21]=k):k=e[21];let D;e[22]===Symbol.for("react.memo_cache_sentinel")?(D=ce=>m(ce.target.value),e[22]=D):D=e[22];let O;e[23]!==r||e[24]!==p?(O=t.jsx(Ze,{id:"section-rename-name",value:p,onChange:D,autoFocus:!0,disabled:r}),e[23]=r,e[24]=p,e[25]=O):O=e[25];let L;e[26]!==k||e[27]!==O?(L=t.jsxs("div",{className:"space-y-1.5",children:[k,O]}),e[26]=k,e[27]=O,e[28]=L):L=e[28];let K;e[29]!==d?(K=d("sandbox.sectionRenameDialog.keyLabel"),e[29]=d,e[30]=K):K=e[30];let F;e[31]!==K?(F=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:K}),e[31]=K,e[32]=F):F=e[32];let _;e[33]!==o?(_=t.jsx(Ze,{value:o,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=o,e[34]=_):_=e[34];let A;e[35]!==F||e[36]!==_?(A=t.jsxs("div",{className:"space-y-1.5",children:[F,_]}),e[35]=F,e[36]=_,e[37]=A):A=e[37];let R;e[38]!==L||e[39]!==A?(R=t.jsxs("div",{className:"space-y-4 py-4",children:[L,A]}),e[38]=L,e[39]=A,e[40]=R):R=e[40];let I;e[41]!==c?(I=()=>c(!1),e[41]=c,e[42]=I):I=e[42];let V;e[43]!==d?(V=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=V):V=e[44];let z;e[45]!==r||e[46]!==I||e[47]!==V?(z=t.jsx(Be,{type:"button",variant:"outline",onClick:I,disabled:r,children:V}),e[45]=r,e[46]=I,e[47]=V,e[48]=z):z=e[48];let J;e[49]!==r||e[50]!==p?(J=!p.trim()||r,e[49]=r,e[50]=p,e[51]=J):J=e[51];let P;e[52]!==r||e[53]!==d?(P=r?t.jsxs(t.Fragment,{children:[t.jsx(rt,{className:"size-3.5"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=r,e[53]=d,e[54]=P):P=e[54];let G;e[55]!==J||e[56]!==P?(G=t.jsx(Be,{type:"submit",disabled:J,children:P}),e[55]=J,e[56]=P,e[57]=G):G=e[57];let Y;e[58]!==z||e[59]!==G?(Y=t.jsxs(gt,{children:[z,G]}),e[58]=z,e[59]=G,e[60]=Y):Y=e[60];let q;e[61]!==y||e[62]!==R||e[63]!==Y||e[64]!==E?(q=t.jsx(dt,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:y,children:[E,R,Y]})}),e[61]=y,e[62]=R,e[63]=Y,e[64]=E,e[65]=q):q=e[65];let X;return e[66]!==g||e[67]!==s||e[68]!==q?(X=t.jsx(ut,{open:s,onOpenChange:g,children:q}),e[66]=g,e[67]=s,e[68]=q,e[69]=X):X=e[69],X}function Il(n){const e=ae.c(7),{type:s}=n,o=Rn[s];let a;e[0]!==o?(a=t.jsx(Ye,{asChild:!0,children:t.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:o})}),e[0]=o,e[1]=a):a=e[1];const l=s==="permanent"?"Permanent":"Temporary";let i;e[2]!==l?(i=t.jsx(Qe,{side:"left",children:l}),e[2]=l,e[3]=i):i=e[3];let c;return e[4]!==a||e[5]!==i?(c=t.jsxs(Xe,{children:[a,i]}),e[4]=a,e[5]=i,e[6]=c):c=e[6],c}const Fl=60,fs={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Ps=["posts","authors","categories"],Pt={posts:"post",authors:"author",categories:"category"};function lt(n){return Ps.includes(n)}const ts={posts:"post",authors:"author",categories:"category"},Wn={posts:fs.post,authors:fs.author,categories:fs.category},Kl=Object.fromEntries(Object.entries(Wn).map(([n,e])=>[e,n]));function zl(n){return typeof n=="string"?Kl[n]??null:null}function Ie(n){return n&&typeof n=="object"&&!Array.isArray(n)?n:null}function ee(n){return typeof n=="string"?n:""}function Ml(n,e){switch(n){case"posts":return{label:ee(e.title)||"Untitled post",subtitle:ee(e.slug)};case"authors":return{label:ee(e.name)||"Unnamed author",subtitle:ee(e.email)};case"categories":return{label:ee(e.name)||"Unnamed category",subtitle:ee(e.slug)};default:{const s=n;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Jn(n){const e={posts:[],authors:[],categories:[]};for(const[s,o]of Object.entries(n)){const a=Ie(o);if(!a)continue;const l=zl(a.__resolveType);if(!l)continue;const i=Ie(a[ts[l]])??{},{label:c,subtitle:r}=Ml(l,i);e[l].push({key:s,kind:l,label:c,subtitle:r})}for(const s of Ps)e[s].sort((o,a)=>o.label.localeCompare(a.label));return e}function Vl(n,e){return Jn(n)[e]}function Ue(n,e){return Vl(n,e).map(s=>({key:s.key,payload:mt(Ie(n[s.key])??void 0,e)}))}const Ws=Object.freeze({});function mt(n,e){return n?Ie(n[ts[e]])??Ws:Ws}function it(n,e,s){return{name:n,__resolveType:Wn[e],[ts[e]]:s}}function td({records:n,selected:e,valueField:s,toRef:o}){const a=Array.isArray(e)?e:[],l=h=>typeof h=="string"?h:ee(Ie(h)?.[s]),i=h=>typeof h=="string"?h:ee(Ie(h)?.name),c=h=>{const u=l(h),f=u?n.find(({payload:x})=>ee(x[s])===u):void 0;if(f)return f;const g=i(h);return g?n.find(({payload:x})=>ee(x.name)===g):void 0},r=n.map(({key:h,payload:u})=>({value:h,label:ee(u.name)||ee(u[s])||h})),d=new Map,p=[];return a.forEach((h,u)=>{const f=c(h);if(f){p.includes(f.key)||p.push(f.key);return}const g=`unresolved:${u}`;d.set(g,h),p.push(g),r.push({value:g,label:i(h)||l(h)||"Unknown"})}),{options:r,selectedValues:p,refsForValues:h=>h.map(u=>{const f=n.find(g=>g.key===u);return f?o(f.payload):d.get(u)}).filter(u=>u!==void 0)}}function et(n){return Array.isArray(n)?n:[]}function nt(n){if(typeof n=="string")return n;const e=Ie(n);return e?ee(e.slug):""}function Yn(n){if(typeof n=="string")return n;const e=Ie(n);return e?ee(e.email):""}function Ts(n){const e=[];return ee(n.title).trim()||e.push("Title"),ee(n.slug).trim()||e.push("Slug"),et(n.categories).map(nt).filter(Boolean).length===0&&e.push("Category"),ee(n.excerpt).trim()||e.push("Excerpt"),ee(n.image).trim()||e.push("Cover image"),e}const Bs=["draft","generating","awaiting_review","scheduled","published","archived"],Qn=8;function _t(n){switch(ee(n.status)){case"draft":case"idea":return"draft";case"generating":return"generating";case"awaiting_review":case"in_review":return"awaiting_review";case"scheduled":return"scheduled";case"published":return"published";case"archived":return"archived";case"":return"published";default:return"awaiting_review"}}function Ul(n,e){return e!=="published"&&e!=="scheduled"||_t(n)===e?!1:Ts(n).length>0}function Gl(n){return new Date(n.getFullYear(),n.getMonth(),n.getDate()+1,Qn).toISOString()}function Ut(n,e,s){if(e!=="scheduled")return{...n,status:e,scheduledDatetime:""};const o=ee(n.scheduledDatetime);return{...n,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(o).getTime())?Gl(s):o}}function Xn(n){return Ue(n,"posts").map(({key:e,payload:s})=>({key:e,title:ee(s.title)||"Untitled post",slug:ee(s.slug),date:ee(s.date),scheduledDatetime:ee(s.scheduledDatetime),categorySlugs:et(s.categories).map(nt).filter(Boolean),authorEmails:et(s.authors).map(Yn).filter(Boolean),missing:Ts(s),status:_t(s),form:"live"}))}const Zn="blog-manager/posts/";function eo(n){return n.startsWith(Zn)}function Tt(n){return n.split("/").pop()??n}function Gt(n){return`${Zn}${n}`}function Hl(n){return`collections/blog/posts/${n}`}function xs(){return bt(12)}function ql(n){const e=Ie(n.planning)??{},s=Ie(e.format);return{ideaKey:ee(e.ideaKey)||void 0,pillarKey:ee(e.pillarKey)||void 0,pillarTitle:ee(e.pillarTitle)||void 0,format:s?{name:ee(s.name),value:ee(s.value)}:void 0,brief:ee(e.brief)||void 0}}function to(n){return{title:n.title,slug:"",excerpt:"",date:n.now.toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[],status:"draft",planning:n.planning??{}}}function ft(n,e){return{name:n,[ts.posts]:e}}function sd(n,e){return eo(n)?ft(n,e):it(n,"posts",e)}function Wl(n){const e=[];for(const[s,o]of Object.entries(n)){if(!eo(s))continue;const a=Ie(o);a&&e.push({key:s,payload:mt(a,"posts")})}return e}function Jl(n){return[...Wl(n).map(({key:s,payload:o})=>({key:s,title:ee(o.title)||"Untitled post",slug:ee(o.slug),date:ee(o.date),scheduledDatetime:ee(o.scheduledDatetime),categorySlugs:et(o.categories).map(nt).filter(Boolean),authorEmails:et(o.authors).map(Yn).filter(Boolean),missing:Ts(o),status:_t(o),form:"planning"})),...Xn(n)]}function Yl(n,e,s){const o=Ut(n.payload,e,s),a=Tt(n.key),l=e==="scheduled"||e==="published"?"live":"planning",i=l==="live"?Hl(a):Gt(a),c=l==="live"?it(i,"posts",o):ft(i,o);return{writes:{[i]:c},deletes:i===n.key?[]:[n.key]}}function nd(n,e,s){const o=et(n.categories);if(!o.some(c=>nt(c)===e))return n;const a=o.map(c=>{const r=nt(c);return r===e||r===s.slug?{name:s.name,slug:s.slug}:c}),l=new Set,i=a.filter(c=>{const r=nt(c);return r?l.has(r)?!1:(l.add(r),!0):!0});return{...n,categories:i}}function Ql(n,e){const s=et(n.categories);return s.some(o=>nt(o)===e)?{...n,categories:s.filter(o=>nt(o)!==e)}:n}function Xl(n){const e=ee(n.status),s=e==="idea"||e==="in_review"?{status:_t(n)}:{};return{...n,...s,dateModified:new Date().toISOString()}}function bt(n){const e=new Uint8Array(Math.ceil(n/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,n)}function ps(n,e){const s=`collections/blog/${e}/${bt(12)}`;if(!Object.hasOwn(n,s))return s;throw new Error("Could not generate a unique blog block key")}function so(n){switch(n){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${bt(8)}`,date:new Date().toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[]};case"authors":return{name:"New author",type:"Person",email:"",jobTitle:"",company:"",avatar:""};case"categories":return{name:"New category",slug:`category-${bt(8)}`,description:"",sections:[]};default:{const e=n;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const Zl={Paragraph:{title:"Paragraph",description:"Rich text content",iconName:"Pilcrow01"},Heading:{title:"Heading",description:"Section title (H1–H6)",iconName:"HeadingSquare"},Quote:{title:"Quote",description:"Pull quote",iconName:"MessageTextSquare02"},Code:{title:"Code",description:"Code block with syntax highlighting",iconName:"Code02"},List:{title:"List",description:"Bulleted or numbered list",iconName:"List"},BlockImage:{title:"Image",description:"Image with optional caption",iconName:"Image01"},Video:{title:"Video",description:"Embedded video",iconName:"PlayCircle"},Divider:{title:"Divider",description:"Horizontal divider",iconName:"Divider"},Cta:{title:"Call to action",description:"Button linking to a URL",iconName:"CursorClick01"},Callout:{title:"Callout",description:"Highlighted note, tip or warning",iconName:"Lightbulb02"},Stat:{title:"Stat",description:"Single key metric",iconName:"BarChartSquareUp"},StatGroup:{title:"Stat group",description:"Row of metrics",iconName:"BarChartSquare02"},CardGroup:{title:"Card group",description:"Grid of cards",iconName:"LayoutGrid01"},Checklist:{title:"Checklist",description:"List of check items",iconName:"CheckSquare"},Steps:{title:"Steps",description:"Step-by-step guide",iconName:"LayersThree01"},Comparison:{title:"Comparison",description:"Side-by-side comparison",iconName:"Columns03"},Table:{title:"Table",description:"Rows and columns of structured data",iconName:"Table"},ProductCard:{title:"Product card",description:"Single product",iconName:"Tag01"},ProductShelf:{title:"Product shelf",description:"Row of products",iconName:"ShoppingBag01"}},Js="Box";function ei(n){return n.startsWith("site/")?"site":"app"}function ti(n){return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")||n.startsWith("/")}function kt(...n){for(const e of n)if(e!==void 0)return e}function Ys(n){if(n&&!(n.includes("/")||/\.(tsx?|jsx?)$/.test(n)))return n}function si(n){const e=n.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").trim();return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():n}function no(n){const e=new Set,s=[],o=n.manifest?.blocks??{};for(const a of Object.values(o))for(const l of Object.keys(a)){if(!oi(l)||e.has(l))continue;e.add(l);const i=Ss(l,n),c=ss(l),r=Zl[c],d=ei(l),p=Ys(i.title),m=Ys(i.description),h=(d==="site"?kt(p,r?.title):kt(r?.title,p))??si(c),u=d==="site"?kt(m,r?.description):kt(r?.description,m),f=d==="site"?i.icon:void 0,g=f&&ti(f)?f:void 0,x=g!==void 0?r?.iconName??Js:kt(f,r?.iconName)??Js;s.push({resolveType:l,title:h,description:u,iconName:x,iconUrl:g,source:d})}return s.sort((a,l)=>a.title.localeCompare(l.title))}function ss(n){return(n.split("/").pop()??n).replace(/\.(tsx?|jsx?)$/,"")}const ni=["blog/sections/blocks/","site/sections/Blog/Post/"];function oi(n){return ni.some(e=>n.startsWith(e))}const Es="blog-manager-brand";function Ke(n){if(!Array.isArray(n))return[];const e=[];for(const s of n){if(typeof s=="string"){s.trim()&&e.push({name:s,value:""});continue}const o=Ie(s);o&&e.push({name:ee(o.name),value:ee(o.value)})}return e}function Me(n){return n.filter(e=>e.name.trim()||e.value.trim())}const ai=6e4,li=4e3;function ii(n){const e=[],s=new Set,o=(a,l)=>{if(typeof a=="string"){if(!a.includes(" ")||a.length<4||/^(https?:)?\/\//.test(a)||/^data:/.test(a))return;const i=`${l}: ${a.trim()}`;if(s.has(i))return;s.add(i),e.push(i);return}if(Array.isArray(a)){for(const i of a)o(i,l);return}if(a&&typeof a=="object")for(const[i,c]of Object.entries(a))i!=="__resolveType"&&o(c,i)};return o(n,"block"),e.join(`
|
|
3
3
|
`)}function od(n,e){const s=new Map,o=d=>{const p=s.get(d);if(p!==void 0)return p;const m=ii(n[d]).slice(0,li);return s.set(d,m),m},a=(d,p)=>o(p).length-o(d).length,l=[...Ue(n,"posts").map(d=>d.key).sort(a),...Ue(n,"categories").map(d=>d.key),...[...e].sort(a)],i=[],c=new Set;let r=ai;for(const d of l){if(i.length>=Fl)break;if(c.has(d)||!n[d])continue;c.add(d);const p=o(d);if(p.length>r)break;i.push({key:d,content:p}),r-=p.length}return i}const oo="blog-manager/themes/";function ri(){return`${oo}${crypto.randomUUID()}`}function ci(n,e){return{name:n,title:e.title,body:e.body,pillarKey:e.pillarKey??"",createdAt:e.createdAt}}function ao(n){const e=[];for(const[s,o]of Object.entries(n)){if(!s.startsWith(oo))continue;const a=Ie(o);a&&e.push({key:s,title:ee(a.title),body:ee(a.body),pillarKey:ee(a.pillarKey)||void 0,createdAt:ee(a.createdAt)})}return e.sort((s,o)=>o.createdAt.localeCompare(s.createdAt)||s.title.localeCompare(o.title))}const lo="blog-manager/pillars/";function ad(){return`${lo}${crypto.randomUUID()}`}function io(n){const e=[];for(const[s,o]of Object.entries(n)){if(!s.startsWith(lo))continue;const a=Ie(o);a&&e.push({key:s,title:ee(a.title),body:ee(a.body),createdAt:ee(a.createdAt),formats:et(a.formats).map(l=>ee(l)).filter(Boolean)})}return e.sort((s,o)=>o.createdAt.localeCompare(s.createdAt)||s.title.localeCompare(o.title))}const ro="blog-manager-formats",di=40;function ld(n){return Ue(n,"posts").slice(0,di).map(({key:e,payload:s})=>({key:e,title:ee(s.title),sections:et(s.sections).map(o=>ee(Ie(o)?.__resolveType)).filter(Boolean).map(ss)}))}function ui(n){const e=new Map;for(const s of no(n)){const o=ss(s.resolveType);e.has(o)||e.set(o,{name:o,title:s.title,description:s.description})}return[...e.values()]}function mi(n){const e=new Set;for(const s of n.matchAll(/(?:^|[\s([{>])@([A-Za-z][\w-]*)/g))s[1]&&e.add(s[1]);return[...e]}function id(n,e){const s=new Set(e);return mi(n).filter(o=>!s.has(o))}const fi=["Heading","Paragraph","BlockImage","List","Cta"];function rd(n){const e=new Set(n);return fi.filter(s=>e.has(s))}function Qs(n){return n.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().replace(/\s+/g," ").trim()}function pi(n,e){const s=new Set(n.map(Qs)),o=[];for(const a of e){const l=Qs(a.title);!l||s.has(l)||(s.add(l),o.push(a))}return o}const hi=["companyName","language","description","tone","targetAudience"];function xi(n){const e=Ie(n)??{},s=[];for(const o of hi)ee(e[o]).trim()||s.push(o);return Me(Ke(e.dos)).length===0&&s.push("dos"),Me(Ke(e.avoid)).length===0&&s.push("avoid"),s}function co(n){const e={};for(const s of no(n)){const o=ss(s.resolveType);o in e||(e[o]=s.resolveType)}return e}function gi(n,e){const s=[];for(const o of n){const a=e[o.type];if(a)switch(o.type){case"Heading":s.push({__resolveType:a,text:ee(o.text),level:o.level??"2"});break;case"Paragraph":s.push({__resolveType:a,html:ee(o.html)});break;case"List":s.push({__resolveType:a,items:(o.items??[]).join(`
|
|
4
4
|
`),style:o.style??"unordered"});break;case"Quote":s.push({__resolveType:a,quote:ee(o.quote)});break;case"Callout":s.push({__resolveType:a,title:ee(o.title),body:ee(o.body),variant:o.variant??"info"});break;case"Cta":s.push({__resolveType:a,text:ee(o.text),href:ee(o.href)});break;case"Divider":s.push({__resolveType:a});break}}return s}function uo(n){return n.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function mo(n,e){const s=uo(n)||`post-${bt(6)}`,o=new Set(e);if(!o.has(s))return s;for(let a=2;a<100;a++){const l=`${s}-${a}`;if(!o.has(l))return l}return`${s}-${bt(4)}`}function bi({draft:n,resolveTypes:e,categories:s,authors:o,planning:a,takenSlugs:l,now:i}){const c=new Set(n.categorySlugs),r=new Set(n.authorEmails),d={title:n.title,slug:mo(n.title,l),date:i.toISOString().slice(0,10),excerpt:n.excerpt,image:"",alt:"",authors:o.filter(p=>r.has(p.email)),categories:s.filter(p=>c.has(p.slug)),seo:{title:n.seo.title,description:n.seo.description,image:""},sections:gi(n.sections,e),planning:a??{}};return Ut(d,"awaiting_review",i)}const cd=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dd=["January","February","March","April","May","June","July","August","September","October","November","December"],fo=1440*60*1e3;function pt(n){const e=new Date(n);return e.setHours(0,0,0,0),e}function ud(n){return new Date(n.getFullYear(),n.getMonth(),1)}function md(n,e){return new Date(n.getFullYear(),n.getMonth()+e,1)}function Ht(n,e){const s=new Date(n);return s.setDate(s.getDate()+e),s}function gs(n,e){return Math.round((pt(n).getTime()-pt(e).getTime())/fo)}function yi(n){const e=(n.getTime()-pt(n).getTime())/fo;return Math.min(Math.max(e,0),1)}function Xs(n,e){return gs(n,e)+yi(n)}function fd(n){const e=Ht(n,-n.getDay()),s=[];for(let o=0;o<6;o++){const a=[];for(let l=0;l<7;l++)a.push(Ht(e,o*7+l));s.push(a)}for(;s.length>0&&s[s.length-1].every(o=>o.getMonth()!==n.getMonth());)s.pop();return s}function pd(n,e){const s=pt(n[0]),o=Ht(s,7),a=s.getTime(),l=o.getTime(),i=[];for(const d of e){const p=pt(d.start),m=pt(d.end);if(m.getTime()<s.getTime()||p.getTime()>=o.getTime())continue;const h=p.getTime()<s.getTime()?s:p,u=m.getTime()>=o.getTime()?Ht(o,-1):m,f=gs(h,s),g=gs(u,h)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),a),y=Math.min(d.end.getTime(),l),v=Xs(new Date(x),s),j=Math.max(Xs(new Date(y),s)-v,0);j<=0||i.push({variant:d,startCol:f,span:g,leftUnits:v,widthUnits:j})}i.sort((d,p)=>d.startCol-p.startCol||p.span-d.span||d.variant.blockKey.localeCompare(p.variant.blockKey));const c=[],r=[];for(const d of i){let p=c.findIndex(m=>m<=d.startCol);p===-1&&(p=c.length,c.push(0)),c[p]=d.startCol+d.span,r.push({...d,lane:p})}return r}function qt(n){const e=String(n.getMonth()+1).padStart(2,"0"),s=String(n.getDate()).padStart(2,"0");return`${n.getFullYear()}-${e}-${s}`}const po=/^(\d{4})-(\d{2})-(\d{2})$/;function Wt(n){const e=n.trim();if(!e)return null;const s=po.exec(e);if(s){const a=Number(s[1]),l=Number(s[2])-1,i=Number(s[3]),c=new Date(a,l,i);return c.getMonth()===l&&c.getDate()===i?c:null}const o=new Date(e);return Number.isNaN(o.getTime())?null:pt(o)}function vi(n){const e=new Date(n.getFullYear(),n.getMonth(),n.getDate(),Qn);return{...so("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:qt(n)}}function ji(n){if(typeof n!="string")return null;const e=n.trim();if(!e)return null;if(po.test(e))return Wt(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function ki(n,e){const s=ji(n.scheduledDatetime);if(!s)return null;const o=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),a={...n,scheduledDatetime:o.toISOString()};return(typeof n.date=="string"?n.date:"")===qt(s)&&(a.date=qt(o)),a}function Si(n){return Wt(n.scheduledDatetime)??Wt(n.date)}function hd(n){const e=new Map,s=[];for(const a of n){const l={post:a,scheduled:Wt(a.scheduledDatetime)!==null},i=Si(a);if(!i){s.push(l);continue}const c=qt(i),r=e.get(c);r?r.push(l):e.set(c,[l])}const o=(a,l)=>Number(l.scheduled)-Number(a.scheduled)||a.post.title.localeCompare(l.post.title);for(const a of e.values())a.sort(o);return s.sort(o),{byDay:e,undated:s}}const ho="0.161.0",xo="0.162.0",go="deno task update";function Zs(n){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(n.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function en(n,e){const s=Zs(n),o=Zs(e);if(!s||!o)return 0;for(let a=0;a<3;a++){const l=s[a]-o[a];if(l!==0)return l}return 0}const bo=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function Ni(n){const e=n?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const o=bo.exec(s)?.[1];if(o)return o}return null}function wi(n){const e=n?.schema?.definitions;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){const o=s?.title;if(typeof o!="string")continue;const a=bo.exec(o)?.[1];if(a)return a}return null}function Ci(n){if(n.packageManager!=="deno")return{kind:"unsupported-runtime"};const e=Ni(n.denoJson)??wi(n.meta);return!e||en(e,ho)<0?{kind:"outdated",version:e}:en(e,xo)<0?{kind:"publish-only",version:e}:{kind:"full",version:e}}function Pi(n){return n.kind==="publish-only"||n.kind==="full"}function Ti(n){return n.kind==="full"}function yo(n,e){const s=n.kind==="unsupported-runtime"?null:n.version;return e==="scheduled"&&!Ti(n)?{required:xo,version:s}:e==="published"&&!Pi(n)?{required:ho,version:s}:null}function Bi(n){const e=ae.c(16),s=zn(n.virtualMcpId)?.metadata?.runtime?.selected??null,o=Dn(n.virtualMcpId),a=Et()?.taskId??null;let l;e[0]!==n.branch||e[1]!==n.orgSlug||e[2]!==n.virtualMcpId?(l=It.denoJson(n.orgSlug,n.virtualMcpId,n.branch),e[0]=n.branch,e[1]=n.orgSlug,e[2]=n.virtualMcpId,e[3]=l):l=e[3];let i;e[4]!==o||e[5]!==n||e[6]!==a?(i=async()=>{const h=await sa({...n,threadId:a},hs(o,"deno.json"));return h.kind==="data"?h.data:null},e[4]=o,e[5]=n,e[6]=a,e[7]=i):i=e[7];const c=s==="deno";let r;e[8]!==l||e[9]!==i||e[10]!==c?(r={queryKey:l,queryFn:i,enabled:c,staleTime:3e5},e[8]=l,e[9]=i,e[10]=c,e[11]=r):r=e[11];const{data:d}=xn(r),p=d??null;let m;return e[12]!==s||e[13]!==n.meta||e[14]!==p?(m=Ci({packageManager:s,denoJson:p,meta:n.meta}),e[12]=s,e[13]=n.meta,e[14]=p,e[15]=m):m=e[15],m}function Ei(n){const e=ae.c(37),{orgSlug:s,virtualMcpId:o,branch:a}=n,l=No(),i=Et()?.taskId??null,c=Dn(o),r=Kn(o).runtime==="cms";let d;e[0]!==a||e[1]!==s||e[2]!==o?(d=It.decofile(`${s}/${o}/${a}`),e[0]=a,e[1]=s,e[2]=o,e[3]=d):d=e[3];const p=d;let m;e[4]!==a||e[5]!==s||e[6]!==o?(m=qa(s,o,a),e[4]=a,e[5]=s,e[6]=o,e[7]=m):m=e[7];let h;e[8]!==a||e[9]!==s||e[10]!==o?(h=Ha(s,o,a),e[8]=a,e[9]=s,e[10]=o,e[11]=h):h=e[11];let u;e[12]!==a||e[13]!==r||e[14]!==s||e[15]!==c||e[16]!==l||e[17]!==i||e[18]!==o?(u=async N=>{const{writes:w,deletes:E}=N;if(r){const k=await Wa({orgSlug:s,virtualMcpId:o,branch:a},{set:w,delete:E});return Ja(l,{orgSlug:s,virtualMcpId:o,branch:a},k),await l.invalidateQueries({queryKey:Ya({orgSlug:s,virtualMcpId:o,branch:a,threadId:i})}),k}const B=`/api/${s}/sandbox/${encodeURIComponent(o)}/${encodeURIComponent(a)}`;for(const[k,D]of Object.entries(w)){const O=await fetch(`${B}/write`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:hs(c,Vs(k)),content:JSON.stringify(D,null,2)})});if(!O.ok)return Ms(O,"Write")}for(const k of E){const D=await fetch(`${B}/unlink`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:hs(c,Vs(k))})});if(!D.ok)return Ms(D,"Delete")}return{ok:!0}},e[12]=a,e[13]=r,e[14]=s,e[15]=c,e[16]=l,e[17]=i,e[18]=o,e[19]=u):u=e[19];let f;e[20]!==a||e[21]!==s||e[22]!==l||e[23]!==o?(f=()=>{l.invalidateQueries({queryKey:It.liveMeta(s,o,a)})},e[20]=a,e[21]=s,e[22]=l,e[23]=o,e[24]=f):f=e[24];let g;e[25]!==m||e[26]!==h||e[27]!==u||e[28]!==f?(g={mutationKey:m,scope:h,mutationFn:u,onSuccess:f},e[25]=m,e[26]=h,e[27]=u,e[28]=f,e[29]=g):g=e[29];const x=wo(g);let y;e[30]!==x||e[31]!==l||e[32]!==p?(y=async N=>{const w=[...Object.keys(N.writes),...N.deletes],E=l.getQueryData(p),B=new Map;for(const k of w)E&&k in E&&B.set(k,E[k]);l.setQueryData(p,k=>_i(k,N)),l.cancelQueries({queryKey:p});try{return await x.mutateAsync(N)}catch(k){const D=k;throw l.setQueryData(p,O=>{if(!O)return O;const L={...O};for(const K of w)B.has(K)?L[K]=B.get(K):delete L[K];return L}),D}},e[30]=x,e[31]=l,e[32]=p,e[33]=y):y=e[33];const v=y;let j;return e[34]!==v||e[35]!==x.isPending?(j={move:v,isPending:x.isPending},e[34]=v,e[35]=x.isPending,e[36]=j):j=e[36],j}function _i(n,{writes:e,deletes:s}){const o={...n??{},...e};for(const a of s)a in e||delete o[a];return o}const Jt={draft:"sandbox.postBoard.laneDraft",generating:"sandbox.postBoard.laneGenerating",awaiting_review:"sandbox.postBoard.laneAwaitingReview",scheduled:"sandbox.postBoard.laneScheduled",published:"sandbox.postBoard.lanePublished",archived:"sandbox.postBoard.laneArchived"};function Di({orgSlug:n,virtualMcpId:e,branch:s,decofile:o,support:a,onMoved:l}){const i=we(),c=Ei({orgSlug:n,virtualMcpId:e,branch:s}),[r,d]=$.useState(new Set),p=f=>mt(o[f],"posts"),m=(f,g,x=p(f))=>{if(g==="generating")return{kind:"not-a-target"};if(r.has(Tt(f)))return{kind:"in-flight"};const y=yo(a,g);return y?{kind:"unsupported",...y}:Ul(x,g)?{kind:"incomplete"}:null},h=f=>{switch(f.kind){case"unsupported":return i("sandbox.postBoard.moveUnsupported",{required:f.required,command:go});case"incomplete":return i("sandbox.postBoard.moveBlocked");case"in-flight":return i("sandbox.postBoard.moveInFlight");case"not-a-target":return i("sandbox.postBoard.moveNotATarget");default:return String(f)}};return{apply:async(f,g,x)=>{const y=x??p(f);if(_t(y)===g)return null;const v=m(f,g,y);if(v)return v.kind!=="in-flight"&&me.error(h(v)),null;const j=Tt(f);d(E=>new Set(E).add(j));const N=Yl({key:f,payload:y},g,new Date),w=Object.keys(N.writes)[0]??f;w!==f&&l?.(f,w);try{return await c.move(N),w}catch(E){return w!==f&&l?.(w,f),me.error(E instanceof Error?E.message:i("sandbox.postBoard.moveFailed")),null}finally{d(E=>{const B=new Set(E);return B.delete(j),B})}},refuse:m,reasonText:h,isMoving:f=>r.has(Tt(f))}}function Ai(n){const e=ae.c(14),{value:s,onChange:o,placeholder:a,className:l,onFocus:i,onBlur:c,onKeyDown:r,spellCheck:d,inputRef:p}=n,m=d===void 0?!0:d;let h;e[0]!==o?(h=g=>o(g.target.value),e[0]=o,e[1]=h):h=e[1];let u;e[2]!==l?(u=ge("w-full resize-none border-0 bg-transparent p-0 outline-none [field-sizing:content] placeholder:text-muted-foreground/50 focus:ring-0",l),e[2]=l,e[3]=u):u=e[3];let f;return e[4]!==p||e[5]!==c||e[6]!==i||e[7]!==r||e[8]!==a||e[9]!==m||e[10]!==h||e[11]!==u||e[12]!==s?(f=t.jsx("textarea",{ref:p,value:s,onChange:h,onInput:$i,onFocus:i,onBlur:c,onKeyDown:r,placeholder:a,spellCheck:m,rows:1,className:u}),e[4]=p,e[5]=c,e[6]=i,e[7]=r,e[8]=a,e[9]=m,e[10]=h,e[11]=u,e[12]=s,e[13]=f):f=e[13],f}function $i(n){const e=n.currentTarget;e.style.height="auto",e.style.height=`${e.scrollHeight}px`}function be(n){return typeof n=="string"?n:""}function xd(n){const e=ae.c(11);let s,o;e[0]!==n?({className:s,...o}=n,e[0]=n,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let a;e[3]!==s?(a=ge(s,"pr-9"),e[3]=s,e[4]=a):a=e[4];let l;e[5]!==o||e[6]!==a?(l=t.jsx(Ai,{...o,className:a}),e[5]=o,e[6]=a,e[7]=l):l=e[7];let i;e[8]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ro,{size:18,"aria-hidden":!0,className:"pointer-events-none absolute right-2 top-3 text-muted-foreground/40 transition-opacity group-hover/editable:text-muted-foreground group-focus-within/editable:text-muted-foreground"}),e[8]=i):i=e[8];let c;return e[9]!==l?(c=t.jsxs("div",{className:"group/editable relative -mx-2 rounded-md px-2 transition-colors hover:bg-muted/50 focus-within:bg-muted/50",children:[l,i]}),e[9]=l,e[10]=c):c=e[10],c}function gd(n){const e=ae.c(5),{label:s,onClick:o,disabled:a}=n;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(js,{size:13}),e[0]=l):l=e[0];let i;return e[1]!==a||e[2]!==s||e[3]!==o?(i=t.jsxs("button",{type:"button",onClick:o,disabled:a,className:"flex items-center gap-1.5 classic:rounded-md compact:rounded-lg border border-dashed px-2.5 py-1.5 text-xs text-muted-foreground transition-colors hover:border-foreground/30 hover:text-foreground disabled:opacity-40 disabled:hover:border-dashed disabled:hover:text-muted-foreground cursor-pointer",children:[l,s]}),e[1]=a,e[2]=s,e[3]=o,e[4]=i):i=e[4],i}function bd(n){const e=ae.c(4),{label:s,onClick:o}=n;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(ws,{size:13}),e[0]=a):a=e[0];let l;return e[1]!==s||e[2]!==o?(l=t.jsx("button",{type:"button","aria-label":s,onClick:o,className:"flex h-6 w-6 shrink-0 items-center justify-center classic:rounded text-muted-foreground/60 opacity-0 transition-opacity hover:text-destructive group-hover/item:opacity-100 cursor-pointer compact:rounded-lg",children:a}),e[1]=s,e[2]=o,e[3]=l):l=e[3],l}function yd(n){const e=ae.c(2),{children:s}=n;let o;return e[0]!==s?(o=t.jsx("div",{className:"absolute -top-9 left-0 z-10 flex items-center gap-0.5 rounded-md border bg-popover p-0.5 shadow-md",children:s}),e[0]=s,e[1]=o):o=e[1],o}function vd(n){const e=ae.c(8),{active:s,label:o,onClick:a,children:l}=n,i=s?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let c;e[0]!==i?(c=ge("flex h-7 min-w-7 items-center justify-center classic:rounded px-1.5 text-sm transition-colors cursor-pointer compact:rounded-lg",i),e[0]=i,e[1]=c):c=e[1];let r;return e[2]!==s||e[3]!==l||e[4]!==o||e[5]!==a||e[6]!==c?(r=t.jsx("button",{type:"button","aria-label":o,"aria-pressed":s,onMouseDown:Li,onClick:a,className:c,children:l}),e[2]=s,e[3]=l,e[4]=o,e[5]=a,e[6]=c,e[7]=r):r=e[7],r}function Li(n){return n.preventDefault()}function jd(n){if(Array.isArray(n))return n;if(typeof n!="string"||n.trim()==="")return[];try{const e=JSON.parse(n);return Array.isArray(e)?e:[]}catch{return[]}}function Nt(n){const e=ae.c(14),{options:s,value:o,emptyLabel:a,onChange:l}=n;let i;e[0]!==a||e[1]!==l||e[2]!==o?(i=a&&t.jsx(tn,{active:!o,onClick:()=>l(""),children:a}),e[0]=a,e[1]=l,e[2]=o,e[3]=i):i=e[3];let c;if(e[4]!==l||e[5]!==s||e[6]!==o){let d;e[8]!==l||e[9]!==o?(d=p=>t.jsx(tn,{active:p===o,onClick:()=>l(p),children:p},p),e[8]=l,e[9]=o,e[10]=d):d=e[10],c=s.filter(Boolean).map(d),e[4]=l,e[5]=s,e[6]=o,e[7]=c}else c=e[7];let r;return e[11]!==i||e[12]!==c?(r=t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i,c]}),e[11]=i,e[12]=c,e[13]=r):r=e[13],r}function tn(n){const e=ae.c(7),{active:s,onClick:o,children:a}=n,l=s?"border-primary bg-primary text-primary-foreground":"bg-card hover:bg-muted";let i;e[0]!==l?(i=ge("cursor-pointer rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",l),e[0]=l,e[1]=i):i=e[1];let c;return e[2]!==s||e[3]!==a||e[4]!==o||e[5]!==i?(c=t.jsx("button",{type:"button","aria-pressed":s,onClick:o,className:i,children:a}),e[2]=s,e[3]=a,e[4]=o,e[5]=i,e[6]=c):c=e[6],c}function kd(n,e=[]){return typeof n=="string"?n:JSON.stringify(n??e)}const sn=[{id:"idea",label:"sandbox.generatePost.stepIdea"},{id:"format",label:"sandbox.generatePost.stepFormat"},{id:"extra",label:"sandbox.generatePost.stepExtra"}],Oi={companyName:"sandbox.blogBrand.companyNameLabel",language:"sandbox.blogBrand.languageLabel",description:"sandbox.blogBrand.descriptionLabel",tone:"sandbox.blogBrand.toneLabel",targetAudience:"sandbox.blogBrand.audienceLabel",dos:"sandbox.blogBrand.tabDos",avoid:"sandbox.blogBrand.tabGuardrails"};function Ri({open:n,onOpenChange:e,decofile:s,hasAi:o,seed:a,onGenerate:l}){const i=we(),c=ys(),[r,d]=$.useState(a?"format":"idea"),[p,m]=$.useState(a?.key??""),[h,u]=$.useState(a?.title??""),[f,g]=$.useState(a?.body??""),[x,y]=$.useState([]),[v,j]=$.useState(""),[N,w]=$.useState(""),[E,B]=$.useState(""),[k,D]=$.useState(""),[O,L]=$.useState(""),[K,F]=$.useState(!1),_=s[Es],A=xi(_),R={companyName:be(_?.companyName),description:be(_?.description),language:be(_?.language),tone:be(_?.tone),targetAudience:be(_?.targetAudience),values:Me(Ke(_?.values)),dos:Me(Ke(_?.dos)),avoid:Me(Ke(_?.avoid))},I=ao(s),V=I.find(C=>C.key===p),z=io(s).find(C=>C.key===V?.pillarKey),J=s[ro],P=Me(Ke(J?.formats)),G=Ue(s,"categories").map(({payload:C})=>({name:be(C.name),slug:be(C.slug)})).filter(C=>C.slug),Y=Ue(s,"authors").map(({payload:C})=>({name:be(C.name),email:be(C.email)})).filter(C=>C.email),q=()=>{d(a?"format":"idea"),m(a?.key??""),u(a?.title??""),g(a?.body??""),y([]),j(""),w(""),B(""),D(""),L("")},X=C=>{e(C),C||q()},ce=async()=>{F(!0);try{const C=await c.call("BLOG_THEME_SUGGEST",{brand:R,existingTitles:[],formats:P.map(W=>W.name).filter(Boolean),guidance:z?`Every idea must be one angle inside the pillar "${z.title}": ${z.body}`:void 0,count:4});y(C.themes)}catch(C){me.error(C instanceof Error?C.message:i("sandbox.generatePost.suggestFailed"))}finally{F(!1)}},ne=a?sn.filter(C=>C.id!=="idea"):sn,de=ne.findIndex(C=>C.id===r),te=r==="idea"?h.trim().length>0:r==="format"?v.trim().length>0&&N.trim().length>0:!0,re=r==="extra",le=()=>{l({idea:{key:p||void 0,title:h.trim(),body:f.trim()},pillar:z?{key:z.key,title:z.title,body:z.body}:void 0,format:{name:v.trim(),value:N.trim()},category:G.find(C=>C.slug===E),author:Y.find(C=>C.email===k),extraInstructions:O.trim()||void 0}),X(!1)};return t.jsx(ut,{open:n,onOpenChange:X,children:t.jsxs(dt,{className:"flex max-h-[85vh] flex-col sm:max-w-2xl",children:[t.jsxs(xt,{children:[t.jsx(ct,{children:i("sandbox.generatePost.title")}),t.jsx(Vt,{children:i("sandbox.generatePost.subtitle")})]}),A.length>0?t.jsx("p",{className:"text-sm text-muted-foreground",children:i("sandbox.generatePost.blockedBrand",{fields:A.map(C=>i(Oi[C])).join(", ")})}):t.jsxs(t.Fragment,{children:[t.jsx("ol",{className:"flex shrink-0 items-center gap-1.5 text-xs",children:ne.map((C,W)=>t.jsx("li",{className:ge("rounded-md px-2 py-1",W===de?"bg-primary text-primary-foreground":W<de?"text-foreground":"text-muted-foreground"),children:i(C.label)},C.id))}),t.jsxs("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto py-1",children:[r==="idea"&&t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:z?i("sandbox.generatePost.ideaHintInPillar",{pillar:z.title}):i("sandbox.generatePost.ideaHint")}),I.length>0&&t.jsx(Nt,{options:I.map(C=>C.title).filter(Boolean),value:V?.title??"",emptyLabel:i("sandbox.generatePost.writeAnIdea"),onChange:C=>{const W=I.find(Z=>Z.title===C);m(W?.key??""),u(W?.title??""),g(W?.body??"")}}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ze,{htmlFor:"generate-idea-title",children:i("sandbox.generatePost.ideaTitleLabel")}),t.jsx(Ze,{id:"generate-idea-title",value:h,onChange:C=>{m(""),u(C.target.value)},placeholder:i("sandbox.generatePost.ideaTitlePlaceholder")})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ze,{htmlFor:"generate-idea-body",children:i("sandbox.generatePost.ideaBodyLabel")}),t.jsx(Rt,{id:"generate-idea-body",value:f,onChange:C=>g(C.target.value),placeholder:i("sandbox.generatePost.ideaBodyPlaceholder"),rows:3})]}),t.jsx(Ii,{label:i("sandbox.generatePost.suggestIdeas"),hint:i("sandbox.generatePost.suggestIdeasHint"),disabled:!o||K,busy:K,onSuggest:ce}),t.jsx(Fi,{suggestions:x,onPick:C=>{u(C.title),g(C.body)}})]}),r==="format"&&t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.generatePost.formatHint")}),t.jsx(Nt,{options:P.map(C=>C.name),value:v,onChange:C=>{j(C),w(P.find(W=>W.name===C)?.value??"")}}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ze,{htmlFor:"generate-format-name",children:i("sandbox.generatePost.formatNameLabel")}),t.jsx(Ze,{id:"generate-format-name",value:v,onChange:C=>j(C.target.value),placeholder:i("sandbox.generatePost.formatNamePlaceholder")})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ze,{htmlFor:"generate-format-value",children:i("sandbox.generatePost.formatValueLabel")}),t.jsx(Rt,{id:"generate-format-value",value:N,onChange:C=>w(C.target.value),placeholder:i("sandbox.generatePost.formatValuePlaceholder"),rows:4})]})]}),r==="extra"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(ze,{htmlFor:"generate-category",children:i("sandbox.generatePost.categoryLabel")}),t.jsx(Nt,{options:G.map(C=>C.name),value:G.find(C=>C.slug===E)?.name??"",emptyLabel:i("sandbox.generatePost.inferIt"),onChange:C=>B(G.find(W=>W.name===C)?.slug??"")})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ze,{htmlFor:"generate-author",children:i("sandbox.generatePost.authorLabel")}),t.jsx(Nt,{options:Y.map(C=>C.name),value:Y.find(C=>C.email===k)?.name??"",emptyLabel:i("sandbox.generatePost.inferIt"),onChange:C=>D(Y.find(W=>W.name===C)?.email??"")})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(ze,{htmlFor:"generate-extra",children:i("sandbox.generatePost.extraLabel")}),t.jsx(Rt,{id:"generate-extra",value:O,onChange:C=>L(C.target.value),placeholder:i("sandbox.generatePost.extraPlaceholder"),rows:3})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.generatePost.inferHint")})]})]}),t.jsxs(gt,{className:"shrink-0 sm:justify-between",children:[t.jsx(Be,{type:"button",variant:"outline",disabled:de===0,onClick:()=>d(ne[de-1].id),children:i("sandbox.generatePost.back")}),re?t.jsxs(Be,{type:"button",disabled:!o,onClick:le,children:[t.jsx(tt,{size:14}),i("sandbox.generatePost.generate")]}):t.jsx(Be,{type:"button",disabled:!te,onClick:()=>d(ne[de+1].id),children:i("sandbox.generatePost.next")})]})]})]})})}function Ii(n){const e=ae.c(12),{label:s,hint:o,disabled:a,busy:l,onSuggest:i}=n;let c;e[0]!==o?(c=t.jsx("p",{className:"text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=c):c=e[1];let r;e[2]!==l?(r=l?t.jsx(Ct,{size:14,className:"animate-spin"}):t.jsx(tt,{size:14}),e[2]=l,e[3]=r):r=e[3];let d;e[4]!==a||e[5]!==s||e[6]!==i||e[7]!==r?(d=t.jsxs(Be,{type:"button",variant:"outline",size:"sm",disabled:a,onClick:i,children:[r,s]}),e[4]=a,e[5]=s,e[6]=i,e[7]=r,e[8]=d):d=e[8];let p;return e[9]!==c||e[10]!==d?(p=t.jsxs("div",{className:"flex items-center justify-between gap-3 border-t pt-3",children:[c,d]}),e[9]=c,e[10]=d,e[11]=p):p=e[11],p}function Fi(n){const e=ae.c(7),{suggestions:s,onPick:o}=n;if(s.length===0)return null;let a;if(e[0]!==o||e[1]!==s){let i;e[3]!==o?(i=c=>t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>o(c),className:"w-full cursor-pointer rounded-lg border bg-card p-2.5 text-left transition-colors hover:border-primary/40",children:[t.jsx("p",{className:"text-sm font-medium",children:c.title}),t.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:c.body})]})},c.title),e[3]=o,e[4]=i):i=e[4],a=s.map(i),e[0]=o,e[1]=s,e[2]=a}else a=e[2];let l;return e[5]!==a?(l=t.jsx("ul",{className:"space-y-1.5",children:a}),e[5]=a,e[6]=l):l=e[6],l}const Ki=["Heading","Paragraph","List","Quote","Callout","Cta","Divider"];function zi(n){return Ki.includes(n)}function Mi({orgSlug:n,virtualMcpId:e,branch:s,decofile:o,meta:a,onStarted:l}){const i=we(),c=ys(),r=Xt({orgSlug:n,virtualMcpId:e,branch:s});return async d=>{const p=Gt(xs()),m={ideaKey:d.idea.key,pillarKey:d.pillar?.key,pillarTitle:d.pillar?.title,format:d.format,brief:d.idea.body},h=Ut(to({title:d.idea.title,planning:m,now:new Date}),"generating",new Date);await r.mutateAsync({blockKey:p,data:ft(p,h)}),l?.(p);const u=o[Es],f=d.category?[d.category]:Ue(o,"categories").map(({payload:x})=>({name:be(x.name),slug:be(x.slug)})).filter(x=>x.slug),g=d.author?[d.author]:Ue(o,"authors").map(({payload:x})=>({name:be(x.name),email:be(x.email)})).filter(x=>x.email);try{const x=await c.call("BLOG_POST_DRAFT",{brand:{companyName:be(u?.companyName),description:be(u?.description),language:be(u?.language),tone:be(u?.tone),targetAudience:be(u?.targetAudience),values:Me(Ke(u?.values)),dos:Me(Ke(u?.dos)),avoid:Me(Ke(u?.avoid))},pillar:d.pillar?{title:d.pillar.title,body:d.pillar.body}:void 0,theme:{title:d.idea.title,body:d.idea.body},format:d.format,sections:ui(a).filter(v=>zi(v.name)).map(v=>({type:v.name,purpose:v.description})),categories:f,authors:g,extraInstructions:d.extraInstructions?.trim()||void 0}),y=bi({draft:x,resolveTypes:co(a),categories:f,authors:g,planning:m,takenSlugs:Xn(o).map(v=>v.slug),now:new Date});await r.mutateAsync({blockKey:p,data:ft(p,y)}),me.success(i("sandbox.generatePost.done",{title:x.title}))}catch(x){await r.mutateAsync({blockKey:p,data:ft(p,Ut(h,"draft",new Date))}),me.error(x instanceof Error?x.message:i("sandbox.generatePost.failed"))}}}const Vi=/<(h[1-6]|p|ul|ol|div|img|br|blockquote|section|article|figure)\b|<\/[a-z]/i;function vo(n){return Vi.test(n)}function Ui(n){const e=n.trim();return e?vo(e)?Xi(e):er(e):{title:"",sections:[]}}function _s(n){return n.replace(/ /gi," ").replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/�?39;|'/gi,"'").replace(/&/gi,"&")}function St(n){let e=n,s;do s=e,e=e.replace(/<[^>]+>/g,"");while(e!==s);return _s(e).replace(/\s+/g," ").trim()}function Gi(n){let e=n,s;do s=e,e=e.replace(/<!--[\s\S]*?-->/g,"");while(e!==s);return e}function Hi(n){let e=n,s;do s=e,e=e.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/gi,"");while(e!==s);return e}function jo(n){let e=n,s;do s=e,e=Hi(Gi(e));while(e!==s);return e}const qi=/^(a|b|strong|i|em|u|s|code|br|span|sub|sup)$/;function bs(n){let e="";for(const s of n)s.charCodeAt(0)>31&&(e+=s);return e=e.trim(),!/^[a-z][a-z0-9+.-]*:/i.test(e)||/^(https?|mailto|tel):/i.test(e)}function Wi(n){return n.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}const Ji=/^<\/?([a-z][a-z0-9]*)\b([^>]*)>/i;function Yi(n,e,s){const o=e.toLowerCase();if(!qi.test(o))return"";if(n.startsWith("</"))return`</${o}>`;if(o!=="a")return`<${o}>`;const a=_s(s.match(/href\s*=\s*"([^"]*)"/i)?.[1]??"");return bs(a)&&a?`<a href="${Wi(a)}">`:"<a>"}function ko(n){const e=jo(n);let s="",o=0;for(;o<e.length;){const a=e.indexOf("<",o);if(a===-1){s+=e.slice(o);break}s+=e.slice(o,a);const l=Ji.exec(e.slice(a));if(!l){s+="<",o=a+1;continue}s+=Yi(l[0],l[1]??"",l[2]??""),o=a+l[0].length}return s}function At(n,e){const s=n.match(new RegExp(`${e}\\s*=\\s*"([^"]*)"`,"i"));return s?.[1]?_s(s[1]):""}const Qi=/<(h[1-6]|p|ul|ol|blockquote|figure)\b[^>]*>([\s\S]*?)<\/\1\s*>|<hr\b[^>]*\/?>|<img\b[^>]*>/gi;function Xi(n){const e=jo(n);let s="";const o=[];for(const a of e.matchAll(Qi)){const l=a[1]?.toLowerCase(),i=a[2]??"",c=a[0];if(!l){if(/^<img/i.test(c)){const r=At(c,"src");r&&bs(r)&&o.push({kind:"image",url:r,alt:At(c,"alt"),caption:""})}else o.push({kind:"divider"});continue}if(/^h[1-6]$/.test(l)){const r=St(i);if(!r)continue;if(l==="h1"&&!s){s=r;continue}o.push({kind:"heading",text:r,level:l.slice(1)})}else if(l==="p"){const r=ko(i.trim());St(r)&&o.push({kind:"paragraph",html:r})}else if(l==="ul"||l==="ol"){const r=[...i.matchAll(/<li\b[^>]*>([\s\S]*?)<\/li\s*>/gi)].map(d=>St(d[1]??"")).filter(Boolean);r.length&&o.push({kind:"list",items:r,ordered:l==="ol"})}else if(l==="blockquote"){const r=St(i);r&&o.push({kind:"quote",text:r})}else if(l==="figure"){const r=i.match(/<img\b[^>]*>/i)?.[0],d=r?At(r,"src"):"",p=St(i.match(/<figcaption\b[^>]*>([\s\S]*?)<\/figcaption\s*>/i)?.[1]??"");d&&bs(d)&&o.push({kind:"image",url:d,alt:r?At(r,"alt"):"",caption:p})}}return{title:s,sections:o}}function Zi(n){return n.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,'<a href="$2">$1</a>').replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/(^|[^*])\*([^*]+)\*/g,"$1<em>$2</em>").replace(/`([^`]+)`/g,"<code>$1</code>")}function er(n){const e=n.replace(/\r\n?/g,`
|
|
5
5
|
`).split(`
|
|
6
6
|
`);let s="";const o=[];let a=[],l=null,i=[];const c=()=>{a.length&&(o.push({kind:"paragraph",html:ko(Zi(a.join(" ")))}),a=[])},r=()=>{l&&(o.push({kind:"list",items:l.items,ordered:l.ordered}),l=null)},d=()=>{i.length&&(o.push({kind:"quote",text:i.join(" ")}),i=[])},p=()=>{c(),r(),d()};for(const m of e){const h=m.trimEnd(),u=h.match(/^(#{1,6})\s+(.*)$/),f=h.match(/^!\[([^\]]*)\]\(([^)\s]+)\)\s*$/),g=h.match(/^\s*(?:[-*+]|\d+\.)\s+(.*)$/),x=/^\s*\d+\./.test(h),y=h.match(/^>\s?(.*)$/);if(!h.trim())p();else if(u){p();const v=u[2]?.trim()??"",j=String(u[1]?.length??1);j==="1"&&!s?s=v:v&&o.push({kind:"heading",text:v,level:j})}else/^(-{3,}|\*{3,}|_{3,})$/.test(h.trim())?(p(),o.push({kind:"divider"})):f?(p(),o.push({kind:"image",url:f[2]??"",alt:f[1]??"",caption:""})):g?(c(),d(),l||(l={items:[],ordered:x}),l.items.push(g[1]?.trim()??"")):y?(c(),r(),i.push(y[1]?.trim()??"")):(r(),d(),a.push(h.trim()))}return p(),{title:s,sections:o}}const tr={heading:"Heading",paragraph:"Paragraph",list:"List",quote:"Quote",divider:"Divider",image:"BlockImage"};function sr(n,e){const s=[];for(const o of n){const a=e[tr[o.kind]];if(a)switch(o.kind){case"heading":s.push({__resolveType:a,text:o.text,level:o.level});break;case"paragraph":s.push({__resolveType:a,html:o.html});break;case"list":s.push({__resolveType:a,items:o.items.join(`
|
|
7
7
|
`),style:o.ordered?"ordered":"unordered"});break;case"quote":s.push({__resolveType:a,quote:o.text});break;case"divider":s.push({__resolveType:a});break;case"image":s.push({__resolveType:a,url:o.url,alt:o.alt,caption:o.caption,size:"normal"});break}}return s}function nr({title:n,blocks:e,takenSlugs:s,now:o}){const a=n.trim();return{title:a,slug:a?mo(a,s):uo(""),date:o.toISOString().slice(0,10),excerpt:"",image:"",alt:"",authors:[],categories:[],sections:e,status:"in_review"}}const nn="__all__",on={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},or={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},an="status:";function ln(n){if(!n.startsWith(an))return null;const e=n.slice(an.length);return Bs.includes(e)?e:null}const rn=$.forwardRef(function(e,s){const o=ae.c(20);let a,l,i,c,r;o[0]!==e?({icon:a,active:l,value:r,className:i,...c}=e,o[0]=e,o[1]=a,o[2]=l,o[3]=i,o[4]=c,o[5]=r):(a=o[1],l=o[2],i=o[3],c=o[4],r=o[5]);const d=l?"text-foreground":"text-muted-foreground";let p;o[6]!==i||o[7]!==d?(p=ge("h-7 gap-1 px-1.5 text-xs",d,i),o[6]=i,o[7]=d,o[8]=p):p=o[8];let m;o[9]!==a?(m=t.jsx(a,{size:14,className:"shrink-0"}),o[9]=a,o[10]=m):m=o[10];let h;o[11]!==r?(h=r&&t.jsx("span",{className:"min-w-0 flex-1 truncate",children:r}),o[11]=r,o[12]=h):h=o[12];let u;o[13]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(ht,{size:12,className:"shrink-0 opacity-60"}),o[13]=u):u=o[13];let f;return o[14]!==c||o[15]!==s||o[16]!==p||o[17]!==m||o[18]!==h?(f=t.jsxs(Be,{ref:s,type:"button",variant:"ghost",size:"sm",className:p,...c,children:[m,h,u]}),o[14]=c,o[15]=s,o[16]=p,o[17]=m,o[18]=h,o[19]=f):f=o[19],f});function Ds(n){const e=ae.c(2),{count:s}=n;let o;return e[0]!==s?(o=t.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground tabular-nums",children:s}),e[0]=s,e[1]=o):o=e[1],o}function ar(n){const e=ae.c(100),{categories:s,authors:o,statusCounts:a,categoryFilter:l,authorFilter:i,statusFilter:c,sort:r,onCategoryFilterChange:d,onAuthorFilterChange:p,onStatusFilterChange:m,onSortChange:h}=n,u=we();let f;if(e[0]!==s||e[1]!==l){let H;e[3]!==l?(H=ie=>ie.slug===l,e[3]=l,e[4]=H):H=e[4],f=s.find(H),e[0]=s,e[1]=l,e[2]=f}else f=e[2];const g=f;let x;if(e[5]!==i||e[6]!==o){let H;e[8]!==i?(H=ie=>ie.email===i,e[8]=i,e[9]=H):H=e[9],x=o.find(H),e[5]=i,e[6]=o,e[7]=x}else x=e[7];const y=x,v=!!(l||i||c);let j;e[10]!==y?.name||e[11]!==g?.name||e[12]!==c||e[13]!==u?(j=g?.name??y?.name??u(c?Jt[c]:"sandbox.postToolbar.filterLabel"),e[10]=y?.name,e[11]=g?.name,e[12]=c,e[13]=u,e[14]=j):j=e[14];const N=j,w=l?`cat:${l}`:i?`author:${i}`:c?`status:${c}`:nn;let E;e[15]!==p||e[16]!==d||e[17]!==m?(E=()=>{d(null),p(null),m(null)},e[15]=p,e[16]=d,e[17]=m,e[18]=E):E=e[18];const B=E;let k;e[19]!==B||e[20]!==p||e[21]!==d||e[22]!==m?(k=H=>{H.startsWith("cat:")?(p(null),m(null),d(H.slice(4))):H.startsWith("author:")?(d(null),m(null),p(H.slice(7))):ln(H)?(d(null),p(null),m(ln(H))):B()},e[19]=B,e[20]=p,e[21]=d,e[22]=m,e[23]=k):k=e[23];const D=k;let O;e[24]!==N||e[25]!==v?(O=t.jsx(Ft,{asChild:!0,children:t.jsx(rn,{icon:Io,active:v,value:N,className:"min-w-0 shrink"})}),e[24]=N,e[25]=v,e[26]=O):O=e[26];let L;e[27]!==u?(L=u("sandbox.postToolbar.filterBy"),e[27]=u,e[28]=L):L=e[28];let K;e[29]!==L?(K=t.jsx(vt,{children:L}),e[29]=L,e[30]=K):K=e[30];let F;e[31]!==u?(F=u("sandbox.postToolbar.allPosts"),e[31]=u,e[32]=F):F=e[32];let _;e[33]!==F?(_=t.jsx(wt,{value:nn,children:F}),e[33]=F,e[34]=_):_=e[34];let A;e[35]!==u?(A=u("sandbox.postToolbar.statusLabel"),e[35]=u,e[36]=A):A=e[36];let R;e[37]!==A?(R=t.jsx(vt,{className:"text-muted-foreground/70",children:A}),e[37]=A,e[38]=R):R=e[38];let I;e[39]!==a||e[40]!==u?(I=Bs.map(H=>t.jsxs(wt,{value:`status:${H}`,children:[t.jsx("span",{className:"min-w-0 flex-1 truncate",children:u(Jt[H])}),t.jsx(Ds,{count:a[H]??0})]},`status:${H}`)),e[39]=a,e[40]=u,e[41]=I):I=e[41];let V;e[42]!==s.length||e[43]!==u?(V=s.length>0&&t.jsx(vt,{className:"text-muted-foreground/70",children:u("sandbox.postToolbar.categoryLabel")}),e[42]=s.length,e[43]=u,e[44]=V):V=e[44];let z;e[45]!==s?(z=s.map(ir),e[45]=s,e[46]=z):z=e[46];let J;e[47]!==o.length||e[48]!==u?(J=o.length>0&&t.jsx(vt,{className:"text-muted-foreground/70",children:u("sandbox.postToolbar.authorLabel")}),e[47]=o.length,e[48]=u,e[49]=J):J=e[49];let P;e[50]!==o?(P=o.map(lr),e[50]=o,e[51]=P):P=e[51];let G;e[52]!==w||e[53]!==D||e[54]!==_||e[55]!==R||e[56]!==I||e[57]!==V||e[58]!==z||e[59]!==J||e[60]!==P?(G=t.jsxs(Os,{value:w,onValueChange:D,children:[_,R,I,V,z,J,P]}),e[52]=w,e[53]=D,e[54]=_,e[55]=R,e[56]=I,e[57]=V,e[58]=z,e[59]=J,e[60]=P,e[61]=G):G=e[61];let Y;e[62]!==G||e[63]!==K?(Y=t.jsxs(Kt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[K,G]}),e[62]=G,e[63]=K,e[64]=Y):Y=e[64];let q;e[65]!==Y||e[66]!==O?(q=t.jsxs(zt,{children:[O,Y]}),e[65]=Y,e[66]=O,e[67]=q):q=e[67];let X;e[68]!==B||e[69]!==v||e[70]!==u?(X=v&&t.jsx(rr,{label:u("sandbox.postToolbar.clearFilter"),onClick:B}),e[68]=B,e[69]=v,e[70]=u,e[71]=X):X=e[71];const ce=or[r];let ne;e[72]!==u||e[73]!==ce?(ne=u(ce),e[72]=u,e[73]=ce,e[74]=ne):ne=e[74];let de;e[75]!==ne?(de=t.jsx(Ft,{asChild:!0,children:t.jsx(rn,{icon:Fo,active:!0,value:ne})}),e[75]=ne,e[76]=de):de=e[76];let te;e[77]!==u?(te=u("sandbox.postToolbar.sortBy"),e[77]=u,e[78]=te):te=e[78];let re;e[79]!==te?(re=t.jsx(vt,{children:te}),e[79]=te,e[80]=re):re=e[80];let le;e[81]!==h?(le=H=>h(H),e[81]=h,e[82]=le):le=e[82];let C;e[83]===Symbol.for("react.memo_cache_sentinel")?(C=Object.keys(on),e[83]=C):C=e[83];let W;e[84]!==u?(W=C.map(H=>t.jsx(wt,{value:H,children:u(on[H])},H)),e[84]=u,e[85]=W):W=e[85];let Z;e[86]!==r||e[87]!==le||e[88]!==W?(Z=t.jsx(Os,{value:r,onValueChange:le,children:W}),e[86]=r,e[87]=le,e[88]=W,e[89]=Z):Z=e[89];let oe;e[90]!==re||e[91]!==Z?(oe=t.jsxs(Kt,{align:"end",className:"w-44",children:[re,Z]}),e[90]=re,e[91]=Z,e[92]=oe):oe=e[92];let S;e[93]!==de||e[94]!==oe?(S=t.jsx("div",{className:"ml-auto shrink-0",children:t.jsxs(zt,{children:[de,oe]})}),e[93]=de,e[94]=oe,e[95]=S):S=e[95];let se;return e[96]!==q||e[97]!==X||e[98]!==S?(se=t.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden border-b px-2 py-1.5",children:[q,X,S]}),e[96]=q,e[97]=X,e[98]=S,e[99]=se):se=e[99],se}function lr(n){return t.jsxs(wt,{value:`author:${n.email}`,children:[t.jsx("span",{className:"min-w-0 flex-1 truncate",children:n.name}),t.jsx(Ds,{count:n.count})]},`author:${n.email}`)}function ir(n){return t.jsxs(wt,{value:`cat:${n.slug}`,children:[t.jsx("span",{className:"min-w-0 flex-1 truncate",children:n.name}),t.jsx(Ds,{count:n.count})]},`cat:${n.slug}`)}function rr(n){const e=ae.c(4),{label:s,onClick:o}=n;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Cs,{size:12}),e[0]=a):a=e[0];let l;return e[1]!==s||e[2]!==o?(l=t.jsx("button",{type:"button","aria-label":s,onClick:o,className:"flex h-6 w-6 shrink-0 items-center justify-center classic:rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer compact:rounded-lg",children:a}),e[1]=s,e[2]=o,e[3]=l):l=e[3],l}function cr(n){const e=ae.c(18),{checked:s,disabled:o,onToggle:a}=n,l=we();let i;e[0]!==a?(i=()=>a(),e[0]=a,e[1]=i):i=e[1];let c;e[2]!==s||e[3]!==l?(c=l(s?"sandbox.postToolbar.deselectAllPosts":"sandbox.postToolbar.selectAllPosts"),e[2]=s,e[3]=l,e[4]=c):c=e[4];let r;e[5]!==s||e[6]!==o||e[7]!==i||e[8]!==c?(r=t.jsx(Ye,{asChild:!0,children:t.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:dr,children:t.jsx(Zt,{checked:s,disabled:o,onCheckedChange:i,"aria-label":c})})}),e[5]=s,e[6]=o,e[7]=i,e[8]=c,e[9]=r):r=e[9];let d;e[10]!==s||e[11]!==l?(d=l(s?"sandbox.postToolbar.deselectAll":"sandbox.postToolbar.selectAll"),e[10]=s,e[11]=l,e[12]=d):d=e[12];let p;e[13]!==d?(p=t.jsx(Qe,{side:"bottom",children:d}),e[13]=d,e[14]=p):p=e[14];let m;return e[15]!==r||e[16]!==p?(m=t.jsxs(Xe,{children:[r,p]}),e[15]=r,e[16]=p,e[17]=m):m=e[17],m}function dr(n){return n.stopPropagation()}function ur(n){const e=ae.c(42),{count:s,allSelected:o,onToggleSelectAll:a,onArchive:l,onExit:i}=n,c=we();let r;e[0]!==o||e[1]!==a?(r=t.jsx(cr,{checked:o,onToggle:a}),e[0]=o,e[1]=a,e[2]=r):r=e[2];let d;e[3]!==s||e[4]!==c?(d=c("sandbox.postToolbar.itemsSelected",{count:s}),e[3]=s,e[4]=c,e[5]=d):d=e[5];let p;e[6]!==d?(p=t.jsx("span",{className:"text-xs font-medium tabular-nums",children:d}),e[6]=d,e[7]=p):p=e[7];const m=s===0;let h;e[8]!==c?(h=c("sandbox.postToolbar.archiveSelectedPosts"),e[8]=c,e[9]=h):h=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Co,{size:14}),e[10]=u):u=e[10];let f;e[11]!==l||e[12]!==m||e[13]!==h?(f=t.jsx(Ye,{asChild:!0,children:t.jsx(Be,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",disabled:m,onClick:l,"aria-label":h,children:u})}),e[11]=l,e[12]=m,e[13]=h,e[14]=f):f=e[14];let g;e[15]!==c?(g=c("sandbox.postToolbar.archiveSelected"),e[15]=c,e[16]=g):g=e[16];let x;e[17]!==g?(x=t.jsx(Qe,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let y;e[19]!==f||e[20]!==x?(y=t.jsxs(Xe,{children:[f,x]}),e[19]=f,e[20]=x,e[21]=y):y=e[21];let v;e[22]!==c?(v=c("sandbox.postToolbar.exitSelection"),e[22]=c,e[23]=v):v=e[23];let j;e[24]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(Cs,{size:14}),e[24]=j):j=e[24];let N;e[25]!==i||e[26]!==v?(N=t.jsx(Ye,{asChild:!0,children:t.jsx(Be,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:i,"aria-label":v,children:j})}),e[25]=i,e[26]=v,e[27]=N):N=e[27];let w;e[28]!==c?(w=c("sandbox.postToolbar.exitSelection"),e[28]=c,e[29]=w):w=e[29];let E;e[30]!==w?(E=t.jsx(Qe,{side:"bottom",children:w}),e[30]=w,e[31]=E):E=e[31];let B;e[32]!==N||e[33]!==E?(B=t.jsxs(Xe,{children:[N,E]}),e[32]=N,e[33]=E,e[34]=B):B=e[34];let k;e[35]!==y||e[36]!==B?(k=t.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[y,B]}),e[35]=y,e[36]=B,e[37]=k):k=e[37];let D;return e[38]!==r||e[39]!==k||e[40]!==p?(D=t.jsxs("div",{className:"flex items-center gap-0.5 border-b bg-accent/40 px-2 py-1.5",children:[r,p,k]}),e[38]=r,e[39]=k,e[40]=p,e[41]=D):D=e[41],D}const mr={draft:"outline",generating:"secondary",awaiting_review:"warning",scheduled:"secondary",published:"success",archived:"outline"},cn="ideas",dn=n=>n.scheduledDatetime||n.date||"",fr=(n,e)=>dn(e).localeCompare(dn(n)),pr=n=>n==="scheduled"||n==="published",So="application/x-post-key";function hr({orgSlug:n,virtualMcpId:e,branch:s,decofile:o,view:a,selectedKey:l,onViewChange:i,onOpen:c,onClose:r,move:d,support:p,meta:m,renderDetail:h}){const u=we(),f=ys(),g=Xt({orgSlug:n,virtualMcpId:e,branch:s}),x=In({orgSlug:n,virtualMcpId:e,branch:s}),y=Za().length>0,[v,j]=$.useState(null),[N,w]=$.useState(!1),[E,B]=$.useState(!1),[k,D]=$.useState(""),[O,L]=$.useState(3),[K,F]=$.useState(""),[_,A]=$.useState(!1),[R,I]=$.useState(!1),[V,z]=$.useState(),[J,P]=$.useState(!1),[G,Y]=$.useState(""),q=$.useRef(null),[X,ce]=Po(To.blogBoardCollapsedLanes(),[]),ne=T=>ce(Q=>Q.includes(T)?Q.filter(Te=>Te!==T):[...Q,T]),de=Mi({orgSlug:n,virtualMcpId:e,branch:s,decofile:o,meta:m,onStarted:c}),te=Jl(o),re=ao(o),le=io(o),C=T=>le.find(Q=>Q.key===T)?.title,W=T=>mt(o[T],"posts"),Z=l&&te.some(T=>T.key===l)?l:te[0]?.key??null,oe=async T=>{await d.apply(T.key,"archived")&&me.success(u("sandbox.postBoard.archived"))},[S,se]=$.useState(null),[H,ie]=$.useState(null),[ye,pe]=$.useState(null),[ke,he]=$.useState("date-desc"),[je,Se]=$.useState(new Set),Ae=te.reduce((T,Q)=>(T[Q.status]=(T[Q.status]??0)+1,T),{}),Ce=T=>{const Q=new Map;for(const Te of te)for(const Ve of T(Te))Q.set(Ve,(Q.get(Ve)??0)+1);return Q},Pe=Ce(T=>T.categorySlugs),De=Ce(T=>T.authorEmails),xe=Ue(o,"categories").map(({payload:T})=>({slug:be(T.slug),name:be(T.name)||be(T.slug),count:Pe.get(be(T.slug))??0})),$e=Ue(o,"authors").map(({payload:T})=>({email:be(T.email),name:be(T.name)||be(T.email),count:De.get(be(T.email))??0})),Le=te.filter(T=>!S||T.categorySlugs.includes(S)).filter(T=>!H||T.authorEmails.includes(H)).filter(T=>!ye||T.status===ye).sort((T,Q)=>{if(ke==="az")return T.title.localeCompare(Q.title);if(ke==="za")return Q.title.localeCompare(T.title);const Te=(T.scheduledDatetime||T.date).localeCompare(Q.scheduledDatetime||Q.date);return ke==="date-asc"?Te:-Te}),M=je.size>0,ve=T=>Se(Q=>{const Te=new Set(Q);return Te.delete(T)||Te.add(T),Te}),Ne=()=>Se(T=>Le.every(Q=>T.has(Q.key))?new Set:new Set(Le.map(Q=>Q.key))),Oe=async()=>{let T=0;for(const Q of je)await d.apply(Q,"archived")&&(T+=1);Se(new Set),T>0&&me.success(u("sandbox.postBoard.archived"))},ns=T=>{z({key:T.key,title:T.title,body:T.body}),I(!0)},os=T=>{x.mutate({blockKey:T.key})},as=(T,Q)=>{j(null),d.apply(Q,T)},Dt=()=>{const T=Gt(xs()),Q=to({title:"",now:new Date});g.mutate({blockKey:T,data:ft(T,Q)}),c(T)},ls=()=>{const T=Ui(G),Q=sr(T.sections,co(m));if(Q.length===0&&!T.title.trim()){me.error(u("sandbox.postBoard.importEmpty"));return}const Te=Gt(xs()),Ve=nr({title:T.title,blocks:Q,takenSlugs:te.map(We=>We.slug).filter(Boolean),now:new Date});g.mutate({blockKey:Te,data:ft(Te,Ve)}),P(!1),Y(""),me.success(u("sandbox.postBoard.imported")),c(Te)},is=async()=>{w(!0);const T=le.find(Q=>Q.key===K);try{const Q=o[Es]??{},Te=o[ro],Ve=Ke(Te?.formats).map(Ge=>Ge.name).filter(Boolean),We=await f.call("BLOG_THEME_SUGGEST",{brand:{companyName:be(Q.companyName),description:be(Q.description),language:be(Q.language),tone:be(Q.tone),targetAudience:be(Q.targetAudience),values:Me(Ke(Q.values)),dos:Me(Ke(Q.dos)),avoid:Me(Ke(Q.avoid))},existingTitles:re.map(Ge=>Ge.title).filter(Boolean),formats:Ve,guidance:[T&&`Every idea must be one angle inside the pillar "${T.title}": ${T.body}`,k.trim()].filter(Boolean).join(`
|
|
8
8
|
|
|
9
|
-
`)||void 0,count:O}),Ee=pi(re.map(Ge=>Ge.title),We.themes);if(Ee.length===0){me.info(u("sandbox.postBoard.ideasFailed"));return}let yt=0;for(const Ge of Ee){const at=ri();try{await g.mutateAsync({blockKey:at,data:ci(at,{title:Ge.title,body:Ge.body,pillarKey:T?.key,createdAt:new Date().toISOString()})}),yt++}catch(rs){console.warn("[posts] could not save a generated idea",rs)}}if(yt===0){me.error(u("sandbox.postBoard.ideasFailed"));return}me.success(u("sandbox.postBoard.ideasAdded",{count:String(yt)}))}catch(Q){me.error(Q instanceof Error?Q.message:u("sandbox.postBoard.ideasFailed"))}finally{w(!1)}};return t.jsxs("div",{className:"relative flex h-full min-w-0 flex-col",children:[t.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-between gap-3 border-b px-6 py-3",children:[t.jsx("div",{className:"flex items-center gap-3",children:t.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border p-0.5",children:[t.jsx(un,{active:a==="board",onClick:()=>i("board"),icon:t.jsx(Ko,{size:14}),label:u("sandbox.postBoard.viewBoard")}),t.jsx(un,{active:a==="list",onClick:()=>i("list"),icon:t.jsx(Uo,{size:14}),label:u("sandbox.postBoard.viewList")})]})}),t.jsxs("div",{className:"flex items-center gap-2",children:[N&&t.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","aria-live":"polite",role:"status",children:[t.jsx(Ct,{size:12,className:"animate-spin"}),u("sandbox.postBoard.generatingLabel")]}),t.jsxs(ut,{open:E,onOpenChange:B,children:[t.jsx(Ka,{asChild:!0,children:t.jsxs(Be,{type:"button",variant:"outline",size:"sm",disabled:!0,children:[t.jsx(tt,{size:14}),u("sandbox.postBoard.generateIdeas"),t.jsx(ot,{variant:"secondary",children:u("common.soon")})]})}),t.jsxs(dt,{className:"sm:max-w-lg",children:[t.jsxs(xt,{children:[t.jsx(ct,{children:u("sandbox.postBoard.generateIdeas")}),t.jsx(Vt,{children:u("sandbox.postBoard.ideaGuidanceLabel")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(Rt,{id:"idea-guidance",value:k,rows:6,autoFocus:!0,onChange:T=>D(T.target.value),placeholder:u("sandbox.postBoard.ideaGuidancePlaceholder"),className:"resize-none text-sm"}),le.length>0&&t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(ze,{className:"text-xs",children:u("sandbox.postBoard.ideaPillarLabel")}),t.jsx(Nt,{options:le.map(T=>T.title),value:le.find(T=>T.key===K)?.title??"",emptyLabel:u("sandbox.postBoard.ideaNoPillar"),onChange:T=>F(le.find(Q=>Q.title===T)?.key??"")})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ze,{htmlFor:"idea-count",className:"text-xs",children:u("sandbox.postBoard.ideaCount")}),t.jsx(Ze,{id:"idea-count",type:"number",min:1,max:8,value:O,onChange:T=>L(Math.max(1,Math.min(8,Number(T.target.value)||1))),className:"h-9 w-16"}),t.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:u("sandbox.postBoard.usesCredits")})]})]}),t.jsx(gt,{children:t.jsxs(Be,{type:"button",onClick:()=>{B(!1),is()},children:[t.jsx(tt,{size:14}),u("sandbox.postBoard.generateIdeas")]})})]})]}),t.jsxs(zt,{children:[t.jsx(Ft,{asChild:!0,children:t.jsxs(Be,{type:"button",size:"sm",children:[t.jsx(js,{size:14}),u("sandbox.postBoard.newPost"),t.jsx(ht,{size:14})]})}),t.jsxs(Kt,{align:"end",className:"w-56",children:[t.jsxs(Je,{disabled:!0,onClick:()=>{z(void 0),I(!0)},children:[t.jsx(tt,{size:14}),t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("span",{className:"flex items-center gap-1.5",children:[u("sandbox.postBoard.newPostGenerate"),t.jsx(ot,{variant:"secondary",children:u("common.soon")})]}),t.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.newPostGenerateHint")})]})]}),t.jsxs(Je,{onClick:Dt,children:[t.jsx(zo,{size:14}),t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:u("sandbox.postBoard.newPostWrite")}),t.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.newPostWriteHint")})]})]}),t.jsxs(Je,{onClick:()=>P(!0),children:[t.jsx(ms,{size:14}),t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:u("sandbox.postBoard.importContent")}),t.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.importContentHint")})]})]})]})]}),t.jsx(Ri,{open:R,onOpenChange:I,decofile:o,hasAi:y,seed:V,onGenerate:T=>{de(T)}},V?.title??"scratch"),t.jsx(ut,{open:J,onOpenChange:P,children:t.jsxs(dt,{className:"max-h-[85vh] sm:max-w-2xl",children:[t.jsxs(xt,{children:[t.jsx(ct,{children:u("sandbox.postBoard.importTitle")}),t.jsx(Vt,{children:u("sandbox.postBoard.importDescription")})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"h-72 overflow-hidden rounded-[var(--studio-control-radius,var(--radius-xl))] border bg-[var(--studio-input-background)]",children:t.jsx(Vn,{code:G,language:vo(G)?"html":"markdown",height:"100%",autoFocus:!0,onChange:T=>Y(T??"")})}),t.jsx("input",{ref:q,type:"file",accept:".html,.htm,.md,.markdown,.txt",className:"hidden",onChange:async T=>{const Q=T.target.files?.[0];Q&&Y(await Q.text()),T.target.value=""}}),t.jsxs(Be,{type:"button",variant:"outline",size:"sm",onClick:()=>q.current?.click(),children:[t.jsx(ms,{size:14}),u("sandbox.postBoard.importUpload")]})]}),t.jsx(gt,{children:t.jsxs(Be,{type:"button",disabled:!G.trim(),onClick:ls,children:[t.jsx(ms,{size:14}),u("sandbox.postBoard.importRun")]})})]})})]})]}),te.length===0&&re.length===0?t.jsx(Xa,{className:"flex-1",icon:t.jsx(tt,{size:22}),title:u("sandbox.postBoard.emptyTitle"),description:u("sandbox.postBoard.emptyDescription"),buttonProps:{children:u("sandbox.postBoard.newPost"),onClick:Dt}}):a==="board"?t.jsxs("div",{className:"flex min-h-0 flex-1 gap-3 overflow-x-auto p-4",children:[t.jsx(yr,{ideas:re,collapsed:X.includes(cn),pillarTitleOf:C,onToggleCollapsed:()=>ne(cn),onGenerate:ns,onDelete:os}),t.jsx("div",{"aria-hidden":!0,className:"my-1 w-px shrink-0 self-stretch bg-border"}),Bs.map(T=>{const Q=te.filter(Ee=>Ee.status===T);pr(T)&&Q.sort(fr);const Te=u(Jt[T]),Ve=X.includes(T),We=yo(p,T);return t.jsx("div",{onDragOver:Ee=>{Ee.preventDefault(),j(T)},onDragLeave:()=>j(Ee=>Ee===T?null:Ee),onDrop:Ee=>{Ee.preventDefault(),as(T,Ee.dataTransfer.getData(So))},title:We?u("sandbox.postBoard.moveUnsupported",{required:We.required,command:go}):void 0,className:ge("flex shrink-0 flex-col rounded-xl border bg-muted/30 transition-colors",Ve?"w-11":"w-72",We&&"opacity-50",v===T&&"border-primary bg-primary/5"),children:Ve?t.jsxs("button",{type:"button",onClick:()=>ne(T),"aria-label":u("sandbox.postBoard.expandLane",{lane:Te}),"aria-expanded":!1,className:"flex min-h-0 flex-1 cursor-pointer flex-col items-center gap-2 py-2.5 text-muted-foreground hover:text-foreground",children:[t.jsx(Bt,{size:14,className:"shrink-0"}),t.jsx("span",{className:"text-xs tabular-nums",children:Q.length}),t.jsx("span",{className:"[writing-mode:vertical-rl] text-sm font-medium",children:Te})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2.5 text-sm font-medium",children:[t.jsxs("button",{type:"button",onClick:()=>ne(T),"aria-label":u("sandbox.postBoard.collapseLane",{lane:Te}),"aria-expanded":!0,className:"flex min-w-0 cursor-pointer items-center gap-1.5 text-left hover:text-muted-foreground",children:[t.jsx(ht,{size:14,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:Te})]}),t.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:Q.length})]}),t.jsx("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto px-2 pb-2",children:Q.length===0?t.jsx("p",{className:"px-1 py-6 text-center text-xs text-muted-foreground",children:u("sandbox.postBoard.laneEmpty")}):Q.map(Ee=>t.jsx(br,{post:Ee,payload:W(Ee.key),moving:d.isMoving(Ee.key),onOpen:()=>c(Ee.key),onArchive:Ee.status==="archived"?void 0:()=>{oe(Ee)}},Ee.key))})]})},T)})]}):t.jsxs("div",{className:"flex min-h-0 flex-1",children:[t.jsxs("div",{className:"flex w-80 shrink-0 flex-col border-r",children:[M?t.jsx(ur,{count:je.size,allSelected:Le.length>0&&Le.every(T=>je.has(T.key)),onToggleSelectAll:Ne,onArchive:()=>{Oe()},onExit:()=>Se(new Set)}):t.jsx(ar,{categories:xe,authors:$e,statusCounts:Ae,categoryFilter:S,authorFilter:H,statusFilter:ye,sort:ke,onCategoryFilterChange:se,onAuthorFilterChange:ie,onStatusFilterChange:pe,onSortChange:he}),t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:t.jsx(xr,{posts:Le,selectedKey:Z,selectionActive:M,selectedKeys:je,onToggleSelect:ve,onOpen:c,isMoving:d.isMoving,onArchive:T=>{oe(T)}})})]}),t.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:Z&&h?t.jsx($.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Ct,{size:20,className:"animate-spin text-muted-foreground"})}),children:h(Z)}):t.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:u("sandbox.postBoard.selectPrompt")})})]}),a==="board"&&l&&_&&h&&t.jsx("div",{className:"absolute inset-0 z-30 flex flex-col bg-background",children:h(l,{expanded:!0,onToggleExpand:()=>A(!1),onClose:()=>{A(!1),r?.()}})}),t.jsx(ut,{open:a==="board"&&!!l&&!_,onOpenChange:T=>{T||(A(!1),r?.())},children:t.jsxs(dt,{closeButtonClassName:"hidden",className:"left-auto right-4 top-4 bottom-4 flex h-auto translate-x-0 translate-y-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-3xl",children:[t.jsx(ct,{className:"sr-only",children:u("sandbox.collectionsSidebar.posts")}),l&&h?t.jsx($.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Ct,{size:20,className:"animate-spin text-muted-foreground"})}),children:h(l,{expanded:!1,onToggleExpand:()=>A(!0),onClose:()=>r?.()})}):null]})})]})}function un(n){const e=ae.c(7),{active:s,onClick:o,icon:a,label:l}=n,i=s?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground";let c;e[0]!==i?(c=ge("inline-flex cursor-pointer items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors",i),e[0]=i,e[1]=c):c=e[1];let r;return e[2]!==a||e[3]!==l||e[4]!==o||e[5]!==c?(r=t.jsxs("button",{type:"button",onClick:o,className:c,children:[a,l]}),e[2]=a,e[3]=l,e[4]=o,e[5]=c,e[6]=r):r=e[6],r}function xr(n){const e=ae.c(19),{posts:s,selectedKey:o,selectionActive:a,selectedKeys:l,onToggleSelect:i,onOpen:c,isMoving:r,onArchive:d}=n;let p;if(e[0]!==r||e[1]!==d||e[2]!==c||e[3]!==i||e[4]!==s||e[5]!==o||e[6]!==l||e[7]!==a){let h;e[9]!==r||e[10]!==d||e[11]!==c||e[12]!==i||e[13]!==o||e[14]!==l||e[15]!==a?(h=u=>t.jsx(gr,{post:u,selected:u.key===o,selectionActive:a,checked:l.has(u.key),onToggleSelect:()=>i(u.key),moving:r(u.key),onOpen:()=>c(u.key),onArchive:u.status==="archived"?void 0:()=>d(u)},u.key),e[9]=r,e[10]=d,e[11]=c,e[12]=i,e[13]=o,e[14]=l,e[15]=a,e[16]=h):h=e[16],p=s.map(h),e[0]=r,e[1]=d,e[2]=c,e[3]=i,e[4]=s,e[5]=o,e[6]=l,e[7]=a,e[8]=p}else p=e[8];let m;return e[17]!==p?(m=t.jsx("ul",{className:"divide-y",children:p}),e[17]=p,e[18]=m):m=e[18],m}function gr(n){const e=ae.c(56),{post:s,selected:o,selectionActive:a,checked:l,onToggleSelect:i,moving:c,onOpen:r,onArchive:d}=n,p=we(),m=s.status==="awaiting_review"&&s.missing.length>0,h=s.status==="scheduled"||s.status==="published",u=a||l?"opacity-100":"opacity-0 focus-within:opacity-100 group-hover/row:opacity-100";let f;e[0]!==u?(f=ge("absolute left-3 top-3 z-10 transition-opacity",u),e[0]=u,e[1]=f):f=e[1];let g;e[2]!==i?(g=()=>i(),e[2]=i,e[3]=g):g=e[3];let x;e[4]!==s.title||e[5]!==p?(x=s.title||p("sandbox.postBoard.untitled"),e[4]=s.title,e[5]=p,e[6]=x):x=e[6];let y;e[7]!==l||e[8]!==g||e[9]!==x?(y=t.jsx(Zt,{checked:l,onCheckedChange:g,"aria-label":x}),e[7]=l,e[8]=g,e[9]=x,e[10]=y):y=e[10];let v;e[11]!==f||e[12]!==y?(v=t.jsx("span",{className:f,children:y}),e[11]=f,e[12]=y,e[13]=v):v=e[13];let j;e[14]!==c||e[15]!==d||e[16]!==a?(j=d&&!a&&t.jsx(As,{onArchive:d,disabled:c,className:"top-2.5"}),e[14]=c,e[15]=d,e[16]=a,e[17]=j):j=e[17];let N;e[18]!==r||e[19]!==i||e[20]!==a?(N=()=>a?i():r(),e[18]=r,e[19]=i,e[20]=a,e[21]=N):N=e[21];const w=o?"bg-accent text-accent-foreground":"bg-card hover:bg-muted/50";let E;e[22]!==w?(E=ge("flex w-full cursor-pointer flex-col gap-1.5 py-2.5 pl-10 pr-3 text-left text-sm transition-colors",w),e[22]=w,e[23]=E):E=e[23];let B;e[24]!==s.title||e[25]!==p?(B=s.title||p("sandbox.postBoard.untitled"),e[24]=s.title,e[25]=p,e[26]=B):B=e[26];let k;e[27]!==B?(k=t.jsx("span",{className:"min-w-0 truncate pr-6 font-medium",children:B}),e[27]=B,e[28]=k):k=e[28];const D=mr[s.status],O=Jt[s.status];let L;e[29]!==p||e[30]!==O?(L=p(O),e[29]=p,e[30]=O,e[31]=L):L=e[31];let K;e[32]!==D||e[33]!==L?(K=t.jsx(ot,{variant:D,className:"shrink-0",children:L}),e[32]=D,e[33]=L,e[34]=K):K=e[34];let F;e[35]!==m||e[36]!==s.missing?(F=m&&t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-warning",children:[t.jsx(Yt,{size:12}),s.missing.length]}),e[35]=m,e[36]=s.missing,e[37]=F):F=e[37];let _;e[38]!==h||e[39]!==s.date||e[40]!==s.scheduledDatetime?(_=h&&t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs tabular-nums text-muted-foreground",children:[t.jsx(vs,{size:12}),(s.scheduledDatetime||s.date||"").slice(0,10)]}),e[38]=h,e[39]=s.date,e[40]=s.scheduledDatetime,e[41]=_):_=e[41];let A;e[42]!==K||e[43]!==F||e[44]!==_?(A=t.jsxs("div",{className:"flex items-center gap-2",children:[K,F,_]}),e[42]=K,e[43]=F,e[44]=_,e[45]=A):A=e[45];let R;e[46]!==o||e[47]!==E||e[48]!==k||e[49]!==A||e[50]!==N?(R=t.jsxs("button",{type:"button",onClick:N,"aria-current":o,className:E,children:[k,A]}),e[46]=o,e[47]=E,e[48]=k,e[49]=A,e[50]=N,e[51]=R):R=e[51];let I;return e[52]!==R||e[53]!==v||e[54]!==j?(I=t.jsxs("li",{className:"group/row relative",children:[v,j,R]}),e[52]=R,e[53]=v,e[54]=j,e[55]=I):I=e[55],I}function br(n){const e=ae.c(46),{post:s,payload:o,moving:a,onOpen:l,onArchive:i}=n,c=we(),r=s.status!=="generating"&&!a;let d;e[0]!==o?(d=ql(o),e[0]=o,e[1]=d):d=e[1];const p=d,m=!r&&"opacity-80";let h;e[2]!==m?(h=ge("group/card relative rounded-lg border bg-card shadow-sm transition-colors hover:border-primary/40",m),e[2]=m,e[3]=h):h=e[3];let u;e[4]!==a||e[5]!==i?(u=i&&t.jsx(As,{onArchive:i,disabled:a,className:"top-2"}),e[4]=a,e[5]=i,e[6]=u):u=e[6];let f;e[7]!==s.key?(f=O=>O.dataTransfer.setData(So,s.key),e[7]=s.key,e[8]=f):f=e[8];const g=r?"cursor-grab active:cursor-grabbing":"cursor-pointer";let x;e[9]!==g?(x=ge("block w-full p-3 text-left",g),e[9]=g,e[10]=x):x=e[10];let y;e[11]!==s.title||e[12]!==c?(y=s.title||c("sandbox.postBoard.untitled"),e[11]=s.title,e[12]=c,e[13]=y):y=e[13];let v;e[14]!==y?(v=t.jsx("p",{className:"line-clamp-2 pr-6 text-sm font-medium",children:y}),e[14]=y,e[15]=v):v=e[15];let j;e[16]!==p||e[17]!==s.status?(j=s.status==="draft"&&t.jsxs(t.Fragment,{children:[p.pillarTitle&&t.jsx(ot,{variant:"secondary",className:"max-w-full truncate",children:p.pillarTitle}),p.format?.name&&t.jsx(ot,{variant:"outline",className:"max-w-full truncate",children:p.format.name})]}),e[16]=p,e[17]=s.status,e[18]=j):j=e[18];let N;e[19]!==s.status||e[20]!==c?(N=s.status==="generating"&&t.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[t.jsx(Ct,{size:12,className:"animate-spin"}),c("sandbox.postBoard.generatingLabel")]}),e[19]=s.status,e[20]=c,e[21]=N):N=e[21];let w;e[22]!==s.missing||e[23]!==s.status||e[24]!==c?(w=s.status==="awaiting_review"&&(s.missing.length>0?t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-warning",children:[t.jsx(Yt,{size:12}),c("sandbox.postBoard.nIssues",{count:String(s.missing.length)})]}):t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-success",children:[t.jsx(Qa,{size:12}),c("sandbox.postBoard.readyToSchedule")]})),e[22]=s.missing,e[23]=s.status,e[24]=c,e[25]=w):w=e[25];let E;e[26]!==s.date||e[27]!==s.scheduledDatetime||e[28]!==s.status?(E=(s.status==="scheduled"||s.status==="published")&&t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[t.jsx(vs,{size:12}),(s.scheduledDatetime||s.date||"").slice(0,10)]}),e[26]=s.date,e[27]=s.scheduledDatetime,e[28]=s.status,e[29]=E):E=e[29];let B;e[30]!==j||e[31]!==N||e[32]!==w||e[33]!==E?(B=t.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[j,N,w,E]}),e[30]=j,e[31]=N,e[32]=w,e[33]=E,e[34]=B):B=e[34];let k;e[35]!==r||e[36]!==l||e[37]!==B||e[38]!==f||e[39]!==x||e[40]!==v?(k=t.jsxs("button",{type:"button",draggable:r,onDragStart:f,onClick:l,className:x,children:[v,B]}),e[35]=r,e[36]=l,e[37]=B,e[38]=f,e[39]=x,e[40]=v,e[41]=k):k=e[41];let D;return e[42]!==k||e[43]!==h||e[44]!==u?(D=t.jsxs("div",{className:h,children:[u,k]}),e[42]=k,e[43]=h,e[44]=u,e[45]=D):D=e[45],D}function yr(n){const e=ae.c(40),{ideas:s,collapsed:o,pillarTitleOf:a,onToggleCollapsed:l,onGenerate:i,onDelete:c}=n,r=we();let d,p,m,h,u,f,g;if(e[0]!==o||e[1]!==s.length||e[2]!==l||e[3]!==r){g=Symbol.for("react.early_return_sentinel");e:{if(d=r("sandbox.postBoard.ideasTray"),o){let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Bt,{size:14,className:"shrink-0"}),e[11]=k):k=e[11];let D;e[12]!==s.length?(D=t.jsx("span",{className:"text-xs tabular-nums",children:s.length}),e[12]=s.length,e[13]=D):D=e[13],g=t.jsxs("button",{type:"button",onClick:l,"aria-label":r("sandbox.postBoard.expandLane",{lane:d}),"aria-expanded":!1,className:"flex w-11 shrink-0 cursor-pointer flex-col items-center gap-2 py-2.5 text-muted-foreground hover:text-foreground",children:[k,D,t.jsx("span",{className:"[writing-mode:vertical-rl] text-sm font-medium",children:d})]});break e}f="flex w-72 shrink-0 flex-col",u="flex items-center justify-between gap-2 px-3 py-2.5 text-sm font-medium",p="button",m=l,h=r("sandbox.postBoard.collapseLane",{lane:d})}e[0]=o,e[1]=s.length,e[2]=l,e[3]=r,e[4]=d,e[5]=p,e[6]=m,e[7]=h,e[8]=u,e[9]=f,e[10]=g}else d=e[4],p=e[5],m=e[6],h=e[7],u=e[8],f=e[9],g=e[10];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[14]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(ht,{size:14,className:"shrink-0"}),e[14]=x):x=e[14];let y;e[15]!==d?(y=t.jsx("span",{className:"truncate",children:d}),e[15]=d,e[16]=y):y=e[16];let v;e[17]!==p||e[18]!==m||e[19]!==h||e[20]!==y?(v=t.jsxs("button",{type:p,onClick:m,"aria-label":h,"aria-expanded":!0,className:"flex min-w-0 cursor-pointer items-center gap-1.5 text-left hover:text-muted-foreground",children:[x,y]}),e[17]=p,e[18]=m,e[19]=h,e[20]=y,e[21]=v):v=e[21];let j;e[22]!==s.length?(j=t.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:s.length}),e[22]=s.length,e[23]=j):j=e[23];let N;e[24]!==j||e[25]!==u||e[26]!==v?(N=t.jsxs("div",{className:u,children:[v,j]}),e[24]=j,e[25]=u,e[26]=v,e[27]=N):N=e[27];let w;e[28]!==s||e[29]!==c||e[30]!==i||e[31]!==a||e[32]!==r?(w=s.length===0?t.jsx("p",{className:"px-1 py-6 text-center text-xs text-muted-foreground",children:r("sandbox.postBoard.ideasEmpty")}):s.map(k=>{const D=a(k.pillarKey);return t.jsxs("div",{className:"group/card relative rounded-lg border border-dashed bg-card shadow-sm transition-colors hover:border-primary/40",children:[t.jsx(As,{label:r("sandbox.postBoard.deleteIdea"),onArchive:()=>c(k),className:"top-2"}),t.jsxs("div",{className:"p-3",children:[t.jsx("p",{className:"line-clamp-2 pr-6 text-sm font-medium",children:k.title||r("sandbox.postBoard.untitledIdea")}),k.body&&t.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:k.body}),D&&t.jsx(ot,{variant:"secondary",className:"mt-2 max-w-full truncate",children:D})]}),t.jsx("div",{className:"border-t px-3 py-2",children:t.jsxs(Be,{type:"button",variant:"ghost",size:"sm",disabled:!0,className:"h-7 w-full justify-start px-1.5 text-xs",onClick:()=>i(k),children:[t.jsx(tt,{size:13}),r("sandbox.postBoard.writeFromIdea"),t.jsx(ot,{variant:"secondary",className:"ml-auto",children:r("common.soon")})]})})]},k.key)}),e[28]=s,e[29]=c,e[30]=i,e[31]=a,e[32]=r,e[33]=w):w=e[33];let E;e[34]!==w?(E=t.jsx("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto pb-2 pr-1",children:w}),e[34]=w,e[35]=E):E=e[35];let B;return e[36]!==N||e[37]!==E||e[38]!==f?(B=t.jsxs("div",{className:f,children:[N,E]}),e[36]=N,e[37]=E,e[38]=f,e[39]=B):B=e[39],B}function As(n){const e=ae.c(13),{label:s,onArchive:o,disabled:a,className:l}=n,i=we();let c;e[0]!==s||e[1]!==i?(c=s??i("sandbox.postBoard.delete"),e[0]=s,e[1]=i,e[2]=c):c=e[2];const r=c;let d;e[3]!==o?(d=u=>{u.stopPropagation(),o()},e[3]=o,e[4]=d):d=e[4];let p;e[5]!==l?(p=ge("absolute right-2 z-10 flex size-6 cursor-pointer items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-muted hover:text-destructive focus-visible:opacity-100 group-hover/card:opacity-100 group-hover/row:opacity-100",l),e[5]=l,e[6]=p):p=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(ws,{size:13}),e[7]=m):m=e[7];let h;return e[8]!==a||e[9]!==d||e[10]!==p||e[11]!==r?(h=t.jsx("button",{type:"button",disabled:a,"aria-label":r,title:r,onClick:d,className:p,children:m}),e[8]=a,e[9]=d,e[10]=p,e[11]=r,e[12]=h):h=e[12],h}function He(n){const e=ae.c(50),{icon:s,logoUrl:o,title:a,subtitle:l,active:i,accent:c,variantCount:r,trailing:d,selectable:p,selectionActive:m,selected:h,invalid:u,invalidReason:f,onToggleSelect:g,onClick:x,menu:y}=n,v=we(),j=c==="global";let N;e[0]!==s||e[1]!==i||e[2]!==j||e[3]!==o?(N=o?t.jsx("img",{src:o,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):t.jsx("span",{className:ge("flex size-8 shrink-0 items-center justify-center rounded-lg",j?"bg-global-section/15":"bg-muted"),children:t.jsx(s,{size:16,className:ge("shrink-0",!j&&(i?"text-accent-foreground":"text-muted-foreground")),style:j?{color:Ns}:void 0})}),e[0]=s,e[1]=i,e[2]=j,e[3]=o,e[4]=N):N=e[4];const w=N,E=i?j?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":j?"hover:bg-global-section/10":"hover:bg-muted";let B;e[5]!==E?(B=ge("group relative flex min-w-0 items-center rounded-md transition-colors",E),e[5]=E,e[6]=B):B=e[6];let k;e[7]!==g||e[8]!==p||e[9]!==h||e[10]!==m||e[11]!==v||e[12]!==a?(k=p&&t.jsx("span",{className:ge("flex shrink-0 items-center pl-2.5 transition-opacity",h||m?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:vr,children:t.jsx(Zt,{checked:h,onCheckedChange:()=>g?.(),"aria-label":v("sandbox.itemRow.selectItem",{title:a})})}),e[7]=g,e[8]=p,e[9]=h,e[10]=m,e[11]=v,e[12]=a,e[13]=k):k=e[13];const D=u&&!i&&"text-destructive";let O;e[14]!==D?(O=ge("block truncate text-sm font-medium",D),e[14]=D,e[15]=O):O=e[15];let L;e[16]!==O||e[17]!==a?(L=t.jsx("span",{className:O,children:a}),e[16]=O,e[17]=a,e[18]=L):L=e[18];const K=i?"text-accent-foreground/70":"text-muted-foreground";let F;e[19]!==K?(F=ge("block truncate text-xs",K),e[19]=K,e[20]=F):F=e[20];let _;e[21]!==l||e[22]!==F?(_=t.jsx("span",{className:F,children:l}),e[21]=l,e[22]=F,e[23]=_):_=e[23];let A;e[24]!==_||e[25]!==L?(A=t.jsxs("span",{className:"min-w-0 flex-1",children:[L,_]}),e[24]=_,e[25]=L,e[26]=A):A=e[26];let R;e[27]!==i||e[28]!==v||e[29]!==r?(R=r!==void 0&&r>1&&t.jsxs(Xe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsxs("span",{className:ge("flex shrink-0 items-center gap-1 text-xs font-medium",i?"text-accent-foreground/70":"text-muted-foreground"),children:[t.jsx(wn,{size:14}),r]})}),t.jsx(Qe,{side:"bottom",children:v("sandbox.itemRow.variantCount",{count:r})})]}),e[27]=i,e[28]=v,e[29]=r,e[30]=R):R=e[30];let I;e[31]!==i||e[32]!==u||e[33]!==f?(I=u&&t.jsxs(Xe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsx("span",{className:ge("flex shrink-0 items-center",i?"text-accent-foreground":"text-destructive"),children:t.jsx(Yt,{size:14})})}),f&&t.jsx(Qe,{side:"bottom",children:f})]}),e[31]=i,e[32]=u,e[33]=f,e[34]=I):I=e[34];let V;e[35]!==x||e[36]!==w||e[37]!==A||e[38]!==R||e[39]!==I||e[40]!==d?(V=t.jsxs("button",{type:"button",onClick:x,className:"flex min-w-0 flex-1 items-center gap-2.5 classic:rounded-md compact:rounded-lg px-2.5 py-2 text-left cursor-pointer",children:[w,A,R,I,d]}),e[35]=x,e[36]=w,e[37]=A,e[38]=R,e[39]=I,e[40]=d,e[41]=V):V=e[41];let z;e[42]!==i||e[43]!==y?(z=y&&t.jsx("div",{className:ge("pr-1 opacity-0 transition-opacity group-hover:opacity-100",i&&"opacity-100"),children:y}),e[42]=i,e[43]=y,e[44]=z):z=e[44];let J;return e[45]!==V||e[46]!==z||e[47]!==B||e[48]!==k?(J=t.jsxs("div",{className:B,children:[k,V,z]}),e[45]=V,e[46]=z,e[47]=B,e[48]=k,e[49]=J):J=e[49],J}function vr(n){return n.stopPropagation()}function st(n){const e=ae.c(10),{icon:s,title:o,description:a}=n;let l;e[0]!==s?(l=s&&t.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=l):l=e[1];let i;e[2]!==o?(i=t.jsx("div",{children:o}),e[2]=o,e[3]=i):i=e[3];let c;e[4]!==a?(c=a&&t.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:a}),e[4]=a,e[5]=c):c=e[5];let r;return e[6]!==l||e[7]!==i||e[8]!==c?(r=t.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:[l,i,c]}),e[6]=l,e[7]=i,e[8]=c,e[9]=r):r=e[9],r}const jr={loaders:Nn,actions:Fn},kr={loaders:"Loaders",actions:"Actions"},Sr={analytics:tl,blog:jn,commerce:el,site:Mo,website:Mt};function Nr(n,e){return e===0?Sr[n.toLowerCase()]??Is:Is}function $t(n,e){return e===0?ia(n):n}function wr(n){const e=ae.c(98),{orgSlug:s,virtualMcpId:o,branch:a,previewUrl:l,meta:i,decofile:c,kind:r}=n,d=we();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[0]=p):p=e[0];const[m,h]=$.useState(p),[u,f]=$.useState(null),[g,x]=$.useState(""),[y,v]=$.useState(Ar),[j,N]=$.useState(r);j!==r&&(N(r),h([]),f(null),x(""),v(new Set));let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w=q=>{v(X=>{const ce=new Set(X);return ce.has(q)?ce.delete(q):ce.add(q),ce})},e[1]=w):w=e[1];const E=w;let B;e[2]!==a||e[3]!==s||e[4]!==o?(B={orgSlug:s,virtualMcpId:o,branch:a},e[2]=a,e[3]=s,e[4]=o,e[5]=B):B=e[5];const k=Xt(B);let D;e[6]!==k?(D=$n((q,X)=>k.mutate({blockKey:q,data:X})),e[6]=k,e[7]=D):D=e[7];const O=D;let L;e[8]!==r?(L=ra(r),e[8]=r,e[9]=L):L=e[9];const K=L,F=jr[r];let _,A,R,I,V,z,J;if(e[10]!==F||e[11]!==a||e[12]!==c||e[13]!==r||e[14]!==i||e[15]!==y||e[16]!==s||e[17]!==m||e[18]!==l||e[19]!==k||e[20]!==O||e[21]!==g||e[22]!==u||e[23]!==K||e[24]!==d||e[25]!==o){R=Symbol.for("react.early_return_sentinel");e:{const q=[...na(i,c,r).map(Dr),...oa(i,r).map(_r)],X=g.trim().toLowerCase(),ce=X.length>0,ne=ce?q.filter(M=>M.title.toLowerCase().includes(X)||M.resolveType.toLowerCase().includes(X)):[],de=new Map,te=[],re=new Map;if(!ce){for(const M of q){const ve=M.folderPath;if(!(ve.length<m.length)&&m.every((Ne,Oe)=>ve[Oe]===Ne))if(ve.length===m.length)if(M.savedKey!==void 0){const Ne=re.get(M.resolveType);Ne?Ne.push(M):re.set(M.resolveType,[M])}else te.push(M);else{const Ne=ve[m.length],Oe=de.get(Ne)??{count:0,savedCount:0};M.savedKey!==void 0?Oe.savedCount=Oe.savedCount+1:Oe.count=Oe.count+1,de.set(Ne,Oe)}}te.sort(Er);for(const M of re.values())M.sort(Br)}const le=[...re.entries()].filter(M=>{const[ve]=M;return!te.some(Ne=>Ne.resolveType===ve)}).flatMap(Tr).sort(Pr);let C;e[33]!==m?(C=(M,ve)=>$t(M.name,m.length).localeCompare($t(ve.name,m.length)),e[33]=m,e[34]=C):C=e[34];const W=[...de.entries()].map(Cr).sort(C);let Z;e[35]===Symbol.for("react.memo_cache_sentinel")?(Z=M=>{f(M.savedKey!==void 0?{mode:"saved",key:M.savedKey}:{mode:"available",resolveType:M.resolveType,title:M.title})},e[35]=Z):Z=e[35];const oe=Z;let S;e[36]!==k||e[37]!==K||e[38]!==d?(S=async(M,ve)=>{await k.mutateAsync({blockKey:M,data:ve}),me.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:K,blockId:M})),f({mode:"saved",key:M})},e[36]=k,e[37]=K,e[38]=d,e[39]=S):S=e[39];const se=S;let H;e[40]!==c||e[41]!==u?(H=$r(u,c),e[40]=c,e[41]=u,e[42]=H):H=e[42];const ie=H;if(ie){const M=`${ie.mode}:${ie.mode==="saved"?ie.blockKey:ie.resolveType}`;let ve;e[43]===Symbol.for("react.memo_cache_sentinel")?(ve=()=>f(null),e[43]=ve):ve=e[43];let Ne;e[44]!==a||e[45]!==c||e[46]!==se||e[47]!==r||e[48]!==i||e[49]!==s||e[50]!==l||e[51]!==k.isPending||e[52]!==O||e[53]!==M||e[54]!==ie.editorTarget||e[55]!==ie.initialValue||e[56]!==o?(Ne=t.jsx(aa,{orgSlug:s,virtualMcpId:o,branch:a,previewUrl:l,meta:i,decofile:c,kind:r,target:ie.editorTarget,initialValue:ie.initialValue,isCreating:k.isPending,onCreate:se,onSaveReferencedBlock:O,onBack:ve},M),e[44]=a,e[45]=c,e[46]=se,e[47]=r,e[48]=i,e[49]=s,e[50]=l,e[51]=k.isPending,e[52]=O,e[53]=M,e[54]=ie.editorTarget,e[55]=ie.initialValue,e[56]=o,e[57]=Ne):Ne=e[57],R=Ne;break e}J="flex h-full w-full min-w-0 flex-col";let ye;e[58]!==d?(ye=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=ye):ye=e[59];let pe;e[60]===Symbol.for("react.memo_cache_sentinel")?(pe=()=>h([]),e[60]=pe):pe=e[60];const ke=m.length===0?"font-medium text-foreground":"text-muted-foreground";let he;e[61]!==ke?(he=ge("min-w-0 truncate classic:rounded-md compact:rounded-lg px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",ke),e[61]=ke,e[62]=he):he=e[62];const je=kr[r];let Se;e[63]!==he||e[64]!==je?(Se=t.jsx("button",{type:"button",onClick:pe,className:he,children:je}),e[63]=he,e[64]=je,e[65]=Se):Se=e[65];let Ae;e[66]!==m?(Ae=m.map((M,ve)=>{const Ne=ve===m.length-1;return t.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[t.jsx(Bt,{className:"size-3 shrink-0 text-muted-foreground/60"}),t.jsx("button",{type:"button",onClick:()=>h(m.slice(0,ve+1)),className:ge("min-w-0 truncate classic:rounded-md compact:rounded-lg px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",Ne?"font-medium text-foreground":"text-muted-foreground"),children:$t(M,ve)})]},`${M}-${ve}`)}),e[66]=m,e[67]=Ae):Ae=e[67];let Ce;e[68]!==ye||e[69]!==Se||e[70]!==Ae?(Ce=t.jsxs("nav",{"aria-label":ye,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[Se,Ae]}),e[68]=ye,e[69]=Se,e[70]=Ae,e[71]=Ce):Ce=e[71];let Pe;e[72]===Symbol.for("react.memo_cache_sentinel")?(Pe=t.jsx(Bn,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=Pe):Pe=e[72];let De;e[73]===Symbol.for("react.memo_cache_sentinel")?(De=M=>x(M.target.value),e[73]=De):De=e[73];let xe;e[74]!==r||e[75]!==d?(xe=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:r}),e[74]=r,e[75]=d,e[76]=xe):xe=e[76];let $e;e[77]!==r||e[78]!==d?($e=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:r}),e[77]=r,e[78]=d,e[79]=$e):$e=e[79];let Le;e[80]!==g||e[81]!==xe||e[82]!==$e?(Le=t.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[Pe,t.jsx("input",{type:"text",value:g,onChange:De,placeholder:xe,"aria-label":$e,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=xe,e[82]=$e,e[83]=Le):Le=e[83],e[84]!==Ce||e[85]!==Le?(A=t.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[Ce,Le]}),e[84]=Ce,e[85]=Le,e[86]=A):A=e[86],_=Qt,z="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",I="mx-auto w-full max-w-4xl px-6 py-5",V=ce?ne.length===0?t.jsx(st,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:r,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):t.jsx("div",{className:"flex flex-col gap-1",children:ne.map(M=>t.jsx(He,{icon:F,accent:M.savedKey!==void 0?"global":void 0,title:M.title,subtitle:M.resolveType,active:!1,onClick:()=>oe(M)},M.savedKey??M.resolveType))}):W.length===0&&te.length===0&&le.length===0?t.jsx(st,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:r}),description:m.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):t.jsxs(t.Fragment,{children:[W.length>0&&t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:W.map(M=>{const ve=Nr(M.name,m.length);return t.jsxs("button",{type:"button",onClick:()=>h([...m,M.name]),className:"flex items-center gap-2.5 rounded-lg border px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[t.jsx(ve,{size:18,className:"shrink-0 text-muted-foreground"}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-sm font-medium",children:$t(M.name,m.length)}),t.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[M.count," ",M.count===1?K:r,M.savedCount>0&&t.jsxs(t.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:M.savedCount})]})]})]})]},M.name)})}),(te.length>0||le.length>0)&&t.jsxs("div",{className:ge("flex flex-col gap-1",W.length>0&&"mt-4"),children:[te.map(M=>{const ve=re.get(M.resolveType)??[],Ne=y.has(M.resolveType);return t.jsxs("div",{className:"flex flex-col",children:[t.jsx(He,{icon:F,title:M.title,subtitle:M.resolveType,active:!1,onClick:()=>oe(M)}),ve.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",onClick:()=>E(M.resolveType),"aria-expanded":Ne,className:"flex items-center gap-1 self-start classic:rounded-md compact:rounded-lg px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:Ns},children:[Ne?t.jsx(ht,{size:12,className:"shrink-0"}):t.jsx(Bt,{size:12,className:"shrink-0"}),d(Ne?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",ve.length,")"]}),Ne&&t.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:ve.map(Oe=>t.jsx(He,{icon:F,accent:"global",title:Oe.title,subtitle:Oe.resolveType,active:!1,onClick:()=>oe(Oe)},Oe.savedKey))})]})]},M.resolveType)}),le.map(M=>t.jsx(He,{icon:F,accent:"global",title:M.title,subtitle:M.resolveType,active:!1,onClick:()=>oe(M)},M.savedKey))]})]})}e[10]=F,e[11]=a,e[12]=c,e[13]=r,e[14]=i,e[15]=y,e[16]=s,e[17]=m,e[18]=l,e[19]=k,e[20]=O,e[21]=g,e[22]=u,e[23]=K,e[24]=d,e[25]=o,e[26]=_,e[27]=A,e[28]=R,e[29]=I,e[30]=V,e[31]=z,e[32]=J}else _=e[26],A=e[27],R=e[28],I=e[29],V=e[30],z=e[31],J=e[32];if(R!==Symbol.for("react.early_return_sentinel"))return R;let P;e[87]!==I||e[88]!==V?(P=t.jsx("div",{className:I,children:V}),e[87]=I,e[88]=V,e[89]=P):P=e[89];let G;e[90]!==_||e[91]!==P||e[92]!==z?(G=t.jsx(_,{className:z,children:P}),e[90]=_,e[91]=P,e[92]=z,e[93]=G):G=e[93];let Y;return e[94]!==A||e[95]!==G||e[96]!==J?(Y=t.jsxs("div",{className:J,children:[A,G]}),e[94]=A,e[95]=G,e[96]=J,e[97]=Y):Y=e[97],Y}function Cr(n){const[e,s]=n;return{name:e,...s}}function Pr(n,e){return n.title.localeCompare(e.title)}function Tr(n){const[,e]=n;return e}function Br(n,e){return n.title.localeCompare(e.title)}function Er(n,e){return n.title.localeCompare(e.title)}function _r(n){return{resolveType:n.resolveType,title:n.title,folderPath:An(n.resolveType)}}function Dr(n){return{resolveType:n.resolveType,title:n.title,folderPath:An(n.resolveType),savedKey:n.key}}function Ar(){return new Set}function $r(n,e){if(!n)return null;if(n.mode==="available")return{mode:"available",resolveType:n.resolveType,editorTarget:{mode:"available",resolveType:n.resolveType,title:n.title},initialValue:{}};const{resolveType:s,props:o,title:a}=la(e,n.key);return{mode:"saved",blockKey:n.key,resolveType:s,editorTarget:{mode:"saved",blockKey:n.key,resolveType:s,title:a},initialValue:o}}function Lr(n){const e=ae.c(106),{orgSlug:s,virtualMcpId:o,branch:a,previewUrl:l,meta:i,decofile:c,resolveType:r,title:d,defaultBlockId:p,isCreating:m,onCreate:h,onSaveReferencedBlock:u}=n,f=we(),g=Et(),x=g?.virtualMcpId,v=Mn(x===o?o:null)?.metadata?.siteSlug??null;let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j={},e[0]=j):j=e[0];const[N,w]=$.useState(j);let E;e[1]===Symbol.for("react.memo_cache_sentinel")?(E=[],e[1]=E):E=e[1];const[B,k]=$.useState(E),[D,O]=$.useState(0),[L,K]=$.useState(!1);let F;e[2]!==i||e[3]!==r?(F=ks(r,i),e[2]=i,e[3]=r,e[4]=F):F=e[4];const _=F;let A,R,I,V,z,J,P,G;if(e[5]!==v||e[6]!==a||e[7]!==c||e[8]!==B||e[9]!==N||e[10]!==m||e[11]!==h||e[12]!==s||e[13]!==l||e[14]!==r||e[15]!==f||e[16]!==g?.taskId||e[17]!==d||e[18]!==o){const te=r.split("/").pop()?.replace(/\.tsx?$/,"")??r,re=g?.taskId??null,le=l??void 0;let C;e[27]!==v||e[28]!==a||e[29]!==s||e[30]!==le||e[31]!==re||e[32]!==o?(C={orgSlug:s,virtualMcpId:o,branch:a,threadId:re,previewUrl:le,siteSlug:v},e[27]=v,e[28]=a,e[29]=s,e[30]=le,e[31]=re,e[32]=o,e[33]=C):C=e[33],R=C;let W,Z,oe,S;if(e[34]!==c||e[35]!==B||e[36]!==N||e[37]!==h||e[38]!==f||e[39]!==d){const Se=[d,...B],Ae=Pe=>{k(B.slice(0,Pe)),O(Or)};let Ce;e[48]!==c||e[49]!==N||e[50]!==h?(Ce=async Pe=>{const De=da(Pe,c);if(De){me.error(De);return}await h(Pe,N),K(!1)},e[48]=c,e[49]=N,e[50]=h,e[51]=Ce):Ce=e[51],A=Ce,G="flex h-full w-full min-w-0",P="flex min-w-0 flex-1 flex-col",z="shrink-0 border-b px-3 py-2.5",S="flex min-w-0 items-center gap-2 overflow-hidden",e[52]!==f?(W=f("sandbox.availableSectionEditor.editingBreadcrumb"),e[52]=f,e[53]=W):W=e[53],Z="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",oe=Se.map((Pe,De)=>{const xe=De===Se.length-1,$e=ca(Pe);return t.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[De>0&&t.jsx(Bt,{className:"size-3 shrink-0 text-muted-foreground/60"}),t.jsx("button",{type:"button",onClick:()=>Ae(De),title:$e,className:ge("min-w-0 truncate classic:rounded-md compact:rounded-lg px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",xe?"font-medium text-foreground":"text-muted-foreground"),children:$e})]},`${$e}-${De}`)}),e[34]=c,e[35]=B,e[36]=N,e[37]=h,e[38]=f,e[39]=d,e[40]=A,e[41]=W,e[42]=Z,e[43]=oe,e[44]=S,e[45]=z,e[46]=P,e[47]=G}else A=e[40],W=e[41],Z=e[42],oe=e[43],S=e[44],z=e[45],P=e[46],G=e[47];let se;e[54]!==W||e[55]!==Z||e[56]!==oe?(se=t.jsx("nav",{"aria-label":W,className:Z,children:oe}),e[54]=W,e[55]=Z,e[56]=oe,e[57]=se):se=e[57];let H;e[58]===Symbol.for("react.memo_cache_sentinel")?(H=()=>K(!0),e[58]=H):H=e[58];let ie;e[59]!==f?(ie=f("sandbox.availableSectionEditor.saveAsGlobalSection"),e[59]=f,e[60]=ie):ie=e[60];let ye;e[61]===Symbol.for("react.memo_cache_sentinel")?(ye=t.jsx(Vo,{size:14}),e[61]=ye):ye=e[61];let pe;e[62]!==m||e[63]!==ie?(pe=t.jsx(Ye,{asChild:!0,children:t.jsx(Be,{size:"icon",className:"size-8 shrink-0",disabled:m,onClick:H,"aria-label":ie,children:ye})}),e[62]=m,e[63]=ie,e[64]=pe):pe=e[64];let ke;e[65]!==f?(ke=f("sandbox.availableSectionEditor.saveAsGlobalSection"),e[65]=f,e[66]=ke):ke=e[66];let he;e[67]!==ke?(he=t.jsx(Qe,{side:"bottom",children:ke}),e[67]=ke,e[68]=he):he=e[68];let je;e[69]!==pe||e[70]!==he?(je=t.jsxs(Xe,{children:[pe,he]}),e[69]=pe,e[70]=he,e[71]=je):je=e[71],e[72]!==S||e[73]!==se||e[74]!==je?(J=t.jsxs("div",{className:S,children:[se,je]}),e[72]=S,e[73]=se,e[74]=je,e[75]=J):J=e[75],I="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",V=f("sandbox.availableSectionEditor.localEditsHint",{typeLabel:te}),e[5]=v,e[6]=a,e[7]=c,e[8]=B,e[9]=N,e[10]=m,e[11]=h,e[12]=s,e[13]=l,e[14]=r,e[15]=f,e[16]=g?.taskId,e[17]=d,e[18]=o,e[19]=A,e[20]=R,e[21]=I,e[22]=V,e[23]=z,e[24]=J,e[25]=P,e[26]=G}else A=e[19],R=e[20],I=e[21],V=e[22],z=e[23],J=e[24],P=e[25],G=e[26];let Y;e[76]!==I||e[77]!==V?(Y=t.jsx("p",{className:I,children:V}),e[76]=I,e[77]=V,e[78]=Y):Y=e[78];let q;e[79]!==Y||e[80]!==z||e[81]!==J?(q=t.jsxs("div",{className:z,children:[J,Y]}),e[79]=Y,e[80]=z,e[81]=J,e[82]=q):q=e[82];let X;e[83]!==c||e[84]!==B||e[85]!==D||e[86]!==N||e[87]!==i||e[88]!==u||e[89]!==R||e[90]!==_||e[91]!==f?(X=t.jsx(Qt,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:t.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:t.jsx("div",{className:"mx-auto max-w-2xl",children:_?t.jsx(Ln,{schema:_,value:N,onChange:te=>w(te),basePath:"",breadcrumbPath:B,onBreadcrumbChange:k,meta:i,decofile:c,onSaveReferencedBlock:u,sandbox:R},D):t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sandbox.availableSectionEditor.noEditableFields")})})})}),e[83]=c,e[84]=B,e[85]=D,e[86]=N,e[87]=i,e[88]=u,e[89]=R,e[90]=_,e[91]=f,e[92]=X):X=e[92];let ce;e[93]!==q||e[94]!==X||e[95]!==P?(ce=t.jsxs("div",{className:P,children:[q,X]}),e[93]=q,e[94]=X,e[95]=P,e[96]=ce):ce=e[96];let ne;e[97]!==p||e[98]!==A||e[99]!==m||e[100]!==L?(ne=t.jsx(ua,{open:L,onOpenChange:K,defaultBlockId:p,isPending:m,onSubmit:A}),e[97]=p,e[98]=A,e[99]=m,e[100]=L,e[101]=ne):ne=e[101];let de;return e[102]!==ce||e[103]!==ne||e[104]!==G?(de=t.jsxs("div",{className:G,children:[ce,ne]}),e[102]=ce,e[103]=ne,e[104]=G,e[105]=de):de=e[105],de}function Or(n){return n+1}function Rr(n,e){const s={__resolveType:n},o=pa([s],e)[0];return o?ha(s,o,e):null}function Ir({orgSlug:n,virtualMcpId:e,branch:s,previewUrl:o,meta:a,decofile:l,blockKey:i,onSaveReferencedBlock:c}){const r=we(),d=Et(),p=d?.virtualMcpId,h=Mn(p===e?e:null)?.metadata?.siteSlug??null,[u]=$.useState(()=>Rr(i,l)),[f,g]=$.useState(u?.data??{}),[x,y]=$.useState([]),[v,j]=$.useState(0),[N,w]=$.useState(!1),[E,B]=$.useState(null),k=E!==null,{save:D,flush:O}=ma({orgSlug:n,virtualMcpId:e,branch:s}),L=u?.resolveType?ks(u.resolveType,a):null,K=l[i],F=K?Ca(i,K):i,_=d?.taskId??null,A={orgSlug:n,virtualMcpId:e,branch:s,threadId:_,previewUrl:o??void 0,siteSlug:h},R=P=>{g(P),D(i,P)},I=()=>{k?(B(null),w(!1),j(P=>P+1)):B(JSON.stringify(f,null,2))},V=P=>{const G=P??"";try{const Y=JSON.parse(G);if(Y&&typeof Y=="object"&&!Array.isArray(Y)){w(!1),R(Y);return}w(!0)}catch{w(!0)}},z=[F,...x],J=P=>{y(x.slice(0,P)),j(G=>G+1)};return t.jsx("div",{className:"flex h-full w-full min-w-0",children:t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsx(fa,{crumbs:z,onSelect:J}),t.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[t.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:Ns},"aria-hidden":!0}),t.jsx("div",{className:"flex-1"}),t.jsxs(Xe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsx(Be,{variant:k?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:I,"aria-label":r(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":k,children:k?t.jsx(Cs,{size:14}):t.jsx(Cn,{size:14})})}),t.jsx(Qe,{side:"bottom",children:r(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),t.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:r("sandbox.savedSectionEditor.globalSectionDescription")})]}),t.jsxs("div",{className:"relative min-h-0 flex-1",children:[t.jsx(Qt,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:t.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:t.jsx("div",{className:"mx-auto max-w-2xl",children:L?t.jsx(Ln,{schema:L,value:f,onChange:P=>R(P),basePath:"",breadcrumbPath:x,onBreadcrumbChange:y,meta:a,decofile:l,onSaveReferencedBlock:c,sandbox:A},v):t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("sandbox.savedSectionEditor.noEditableFields")})})})}),E!==null&&t.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[N&&t.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:r("sandbox.savedSectionEditor.invalidJsonError")}),t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(Vn,{language:"json",height:"100%",code:E,onChange:V,onSave:P=>{V(P),O()}})})]})]})]})})}function Fr(n){const e=ae.c(36),{selection:s,orgSlug:o,virtualMcpId:a,branch:l,previewUrl:i,meta:c,decofile:r,isCreating:d,onCreateAvailable:p,onSaveReferencedBlock:m}=n,h=we();if(!s){let g;e[0]!==h?(g=h("sandbox.sectionsRightPane.selectSectionTitle"),e[0]=h,e[1]=g):g=e[1];let x;e[2]!==h?(x=h("sandbox.sectionsRightPane.selectSectionDescription"),e[2]=h,e[3]=x):x=e[3];let y;return e[4]!==g||e[5]!==x?(y=t.jsx(st,{title:g,description:x}),e[4]=g,e[5]=x,e[6]=y):y=e[6],y}if(s.collection==="available-section"){const g=`available:${s.resolveType}`,x=s.resolveType,y=s.title;let v;e[7]!==s.title?(v=xa(s.title),e[7]=s.title,e[8]=v):v=e[8];let j;e[9]!==p||e[10]!==s.resolveType?(j=(w,E)=>p(s.resolveType,w,E),e[9]=p,e[10]=s.resolveType,e[11]=j):j=e[11];let N;return e[12]!==l||e[13]!==r||e[14]!==d||e[15]!==c||e[16]!==m||e[17]!==o||e[18]!==i||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==v||e[23]!==j||e[24]!==a?(N=t.jsx(Lr,{orgSlug:o,virtualMcpId:a,branch:l,previewUrl:i,meta:c,decofile:r,resolveType:x,title:y,defaultBlockId:v,isCreating:d,onCreate:j,onSaveReferencedBlock:m},g),e[12]=l,e[13]=r,e[14]=d,e[15]=c,e[16]=m,e[17]=o,e[18]=i,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=v,e[23]=j,e[24]=a,e[25]=N):N=e[25],N}const u=`saved:${s.key}`;let f;return e[26]!==l||e[27]!==r||e[28]!==c||e[29]!==m||e[30]!==o||e[31]!==i||e[32]!==s.key||e[33]!==u||e[34]!==a?(f=t.jsx(Ir,{orgSlug:o,virtualMcpId:a,branch:l,previewUrl:i,meta:c,decofile:r,blockKey:s.key,onSaveReferencedBlock:m},u),e[26]=l,e[27]=r,e[28]=c,e[29]=m,e[30]=o,e[31]=i,e[32]=s.key,e[33]=u,e[34]=a,e[35]=f):f=e[35],f}function Lt(n){const e=ae.c(34),{onDuplicate:s,onRename:o,onAddVariant:a,onEditSeo:l,onViewJson:i,onDelete:c}=n,r=we();let d;e[0]!==r?(d=r("sandbox.itemActions.moreActions"),e[0]=r,e[1]=d):d=e[1];let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Bo,{size:14}),e[2]=p):p=e[2];let m;e[3]!==d?(m=t.jsx(Ft,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center classic:rounded-md compact:rounded-lg text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:Kr,children:p})}),e[3]=d,e[4]=m):m=e[4];let h;e[5]!==o||e[6]!==r?(h=o&&t.jsxs(Je,{onClick:o,children:[t.jsx(nl,{size:14}),r("sandbox.itemActions.rename")]}),e[5]=o,e[6]=r,e[7]=h):h=e[7];let u;e[8]!==s||e[9]!==r?(u=s&&t.jsxs(Je,{onClick:s,children:[t.jsx(sl,{size:14}),r("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=r,e[10]=u):u=e[10];let f;e[11]!==a||e[12]!==r?(f=a&&t.jsxs(t.Fragment,{children:[t.jsx(cs,{}),t.jsxs(Je,{onClick:a,className:"cursor-pointer text-success focus:text-success",children:[t.jsx(wn,{size:14}),r("sandbox.itemActions.addVariant")]})]}),e[11]=a,e[12]=r,e[13]=f):f=e[13];let g;e[14]!==l||e[15]!==i||e[16]!==r?(g=(l||i)&&t.jsxs(t.Fragment,{children:[t.jsx(cs,{}),l&&t.jsxs(Je,{onClick:l,children:[t.jsx(Sn,{size:14}),r("sandbox.itemActions.editSeo")]}),i&&t.jsxs(Je,{onClick:i,children:[t.jsx(Cn,{size:14}),r("sandbox.itemActions.viewJson")]})]}),e[14]=l,e[15]=i,e[16]=r,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(cs,{}),e[18]=x):x=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(ws,{size:14}),e[19]=y):y=e[19];let v;e[20]!==r?(v=r("sandbox.itemActions.delete"),e[20]=r,e[21]=v):v=e[21];let j;e[22]!==c||e[23]!==v?(j=t.jsxs(Je,{onClick:c,className:"text-destructive focus:text-destructive",children:[y,v]}),e[22]=c,e[23]=v,e[24]=j):j=e[24];let N;e[25]!==j||e[26]!==h||e[27]!==u||e[28]!==f||e[29]!==g?(N=t.jsxs(Kt,{align:"end",className:"w-44",children:[h,u,f,g,x,j]}),e[25]=j,e[26]=h,e[27]=u,e[28]=f,e[29]=g,e[30]=N):N=e[30];let w;return e[31]!==N||e[32]!==m?(w=t.jsxs(zt,{children:[m,N]}),e[31]=N,e[32]=m,e[33]=w):w=e[33],w}function Kr(n){return n.stopPropagation()}function zr(n){return n.split("/").pop()?.replace(/\.tsx?$/,"")||n||"Section"}function Mr(n){const e=new Map;for(const s of n){const o=zr(s.resolveType),a=e.get(o);a?a.push(s):e.set(o,[s])}return[...e.entries()].map(([s,o])=>({label:s,sections:o})).sort((s,o)=>s.label.localeCompare(o.label))}function mn(n){const e=ae.c(8),{icon:s,label:o,className:a}=n;let l;e[0]!==a?(l=ge("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",a),e[0]=a,e[1]=l):l=e[1];let i;e[2]!==s?(i=t.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=i):i=e[3];let c;return e[4]!==o||e[5]!==l||e[6]!==i?(c=t.jsxs("div",{className:l,children:[i,o]}),e[4]=o,e[5]=l,e[6]=i,e[7]=c):c=e[7],c}const fn=$.lazy(()=>qe(()=>import("./app-editor-DuO1pc7m.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,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179])).then(n=>({default:n.AppEditor}))),Vr=$.lazy(()=>qe(()=>import("./post-editor-DDpQa9aK.js"),__vite__mapDeps([180,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,33,32,34,35,36,37,38,39,40,41,27,28,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,68,107,181,165,144,87,88,67,110,122,117,115,72,71,69,73,74,75,76,77,78,79,80,81,82,83,26,84,85,86,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,108,109,111,24,25,112,113,114,116,118,119,120,121,123,124,125,126,127,128,129,130,131,182,148,70,183,184,185,132,133,134,135,136,137,138,139,140,141,142,143,145,146,147,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,166,167,168,169,170,171,172,173,174,175,176,177,178,179])).then(n=>({default:n.PostEditor}))),Ur=$.lazy(()=>qe(()=>import("./record-editor-DB5V4dOD.js"),__vite__mapDeps([186,1,2,68,107,25,26,27,28,115,72,71,12,13,3,4,5,6,7,8,9,10,11,14,15,16,17,18,19,20,21,22,23,69,32,33,34,35,36,37,38,39,40,41,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,73,74,75,76,77,78,79,80,67,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,108,109,110,111,24,112,113,114,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,185,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179])).then(n=>({default:n.RecordEditor}))),Gr=$.lazy(()=>qe(()=>import("./context-CebZ2Cct.js"),__vite__mapDeps([187,1,2,28,32,33,34,35,36,37,38,39,40,41,27,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,68,107,115,110,20,188,105,98,67,106,100,81,82,4,5,6,7,8,9,10,83,26,148,183,116,80,85,87,88,189,152,149,72,71,12,13,3,11,14,15,16,17,18,19,21,22,23,69,73,74,75,76,77,78,79,84,86,89,90,91,92,93,94,95,96,97,99,101,102,103,104,108,109,111,24,25,112,113,114,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,174,185,186,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,150,151,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,175,176,177,178,179,190,182,70,184])).then(n=>({default:n.BlogContext}))),Hr=$.lazy(()=>qe(()=>import("./category-editor-Ci_lv1Kn.js"),__vite__mapDeps([190,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,37,39,52,32,33,34,35,36,38,40,41,27,28,30,42,43,44,45,46,31,47,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,66,119,68,107,182,116,87,88,67,110,72,71,69,73,74,75,76,77,78,79,80,81,82,83,26,84,85,86,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,108,109,111,24,25,112,113,114,115,117,118,120,121,122,123,124,125,126,127,128,129,130,131,148,70,183,184,185,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179])).then(n=>({default:n.CategoryEditor}))),qr=$.lazy(()=>qe(()=>import("./sections-editor-B7HawNxT.js"),__vite__mapDeps([191,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,72,71,69,32,33,34,35,36,37,38,39,40,41,27,28,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,73,74,75,76,77,78,79,80,67,81,82,83,26,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,68,108,109,110,111,24,25,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,174,192,29,70,193])).then(n=>({default:n.SectionsEditor}))),Wr=$.lazy(()=>qe(()=>import("./seo-editor-DfUSXMZj.js"),__vite__mapDeps([194,1,2,32,33,34,35,36,37,38,39,40,41,27,28,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,24,25,26,72,71,12,13,3,4,5,6,7,8,9,10,11,14,15,16,17,18,19,20,21,22,23,69,73,74,75,76,77,78,79,80,67,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,68,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,192])).then(n=>({default:n.SeoEditor}))),Jr=$.lazy(()=>qe(()=>import("./variant-calendar-52QBX61v.js"),__vite__mapDeps([195,1,2,32,33,34,35,36,37,38,39,40,41,27,28,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,107,24,25,26,117,83,196,132,133,134,102,8,9,135,7,96,100,6,10,136,3,4,5,11,12,13,14,15,16,17,18,19,20,21,22,23,98,67,137,138,82,104,105,106,68,81,139,84,85,86,87,88,89,90,91,92,93,140,71,79,78,80,75,76,122,141,129,99,142,143,144,145,110,146,147,148,149,150,151,152,153,154,155,156,157,158,159,126,127,160,115,161,162,163,164,165,166,167,74,77,94,95,97,101,103,108,109,168,120,73,169,170,128,124,171,172,173,119,72,69,111,112,113,114,116,118,121,123,125,130,131,174,175,176,177,178,179])).then(n=>({default:n.VariantCalendar}))),Yr=$.lazy(()=>qe(()=>import("./post-calendar-DmX3brDp.js"),__vite__mapDeps([197,1,2,33,32,34,35,36,37,38,39,40,41,27,28,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,198,24,25,26,132,133,134,102,8,9,135,7,96,100,6,10,136,3,4,5,11,12,13,14,15,16,17,18,19,20,21,22,23,98,83,67,137,138,82,104,105,106,107,68,81,139,84,85,86,87,88,89,90,91,92,93,140,71,79,78,80,75,76,122,141,129,99,142,143,144,145,110,146,147,148,149,150,151,152,153,154,155,156,157,158,159,126,127,160,115,161,162,163,164,165,166,167,74,77,94,95,97,101,103,108,109,168,120,73,169,170,128,124,171,172,173,119,72,69,111,112,113,114,116,117,118,121,123,125,130,131,174,175,176,177,178,179])).then(n=>({default:n.PostCalendar}))),Qr=$.lazy(()=>qe(()=>import("./redirect-editor-BxGeAe1m.js"),__vite__mapDeps([199,1,2,144,27,68,107,25,26,28,72,71,12,13,3,4,5,6,7,8,9,10,11,14,15,16,17,18,19,20,21,22,23,69,32,33,34,35,36,37,38,39,40,41,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,73,74,75,76,77,78,79,80,67,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,108,109,110,111,24,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,185])).then(n=>({default:n.RedirectEditor})));function Xr(n){const e=ae.c(20),{deepLinkPage:s}=n,{currentBranch:o,virtualMcpId:a}=bn(),{org:l}=Eo(),i=Ia(),c=Fa(),{runtime:r,previewServerUrl:d}=Kn(a),p=r==="cms";let m;e[0]!==p||e[1]!==c.previewState||e[2]!==i.lifecycle.phase?(m=Nl({fastPreviewActive:p,previewState:c.previewState,lifecyclePhase:i.lifecycle.phase}),e[0]=p,e[1]=c.previewState,e[2]=i.lifecycle.phase,e[3]=m):m=e[3];const h=m;if(h.kind==="sandbox-card"){const g=`/${l.slug}/settings/connections`;let x;return e[4]!==h.state||e[5]!==c.start||e[6]!==g||e[7]!==i.lifecycle||e[8]!==i.phase?(x=t.jsx(kl,{state:h.state,claimPhase:i.phase,lifecycle:i.lifecycle,onStart:c.start,connectionsHref:g}),e[4]=h.state,e[5]=c.start,e[6]=g,e[7]=i.lifecycle,e[8]=i.phase,e[9]=x):x=e[9],x}if(!a||!o){let g;return e[10]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(st,{title:"Waiting for sandbox context…"}),e[10]=g):g=e[10],g}const u=p?d:c.previewUrl;let f;return e[11]!==o||e[12]!==s||e[13]!==h.devServerReady||e[14]!==h.sandboxWarming||e[15]!==c.previewUrl||e[16]!==l.slug||e[17]!==u||e[18]!==a?(f=t.jsx(ec,{orgSlug:l.slug,virtualMcpId:a,branch:o,previewUrl:c.previewUrl,sitePreviewUrl:u,deepLinkPage:s,devServerReady:h.devServerReady,sandboxWarming:h.sandboxWarming}),e[11]=o,e[12]=s,e[13]=h.devServerReady,e[14]=h.sandboxWarming,e[15]=c.previewUrl,e[16]=l.slug,e[17]=u,e[18]=a,e[19]=f):f=e[19],f}const pn=2e3,Zr=15;function hn(n,e,s,o){return typeof e!="string"||s&&(Un(e,s,o)||n.state.dataUpdateCount>=Zr)?!1:pn}function ec({orgSlug:n,virtualMcpId:e,branch:s,previewUrl:o,sitePreviewUrl:a,deepLinkPage:l,devServerReady:i,sandboxWarming:c}){const r=we(),d=Et()?.taskId??null,p={orgSlug:n,virtualMcpId:e,branch:s,threadId:d,previewUrl:o},{data:m,isLoading:h}=ga(p,{fetchEnabled:i}),u=gn({strict:!1}),[f,g]=$.useState(()=>u.contentCollection&<(u.contentCollection)&&u.contentCollection||"pages"),[x,y]=$.useState(()=>u.contentItem&<(f)?{collection:f,key:u.contentItem}:null),[v,j]=$.useState(null),N=!!(l?.pageId||l?.path||l?.pathTemplate),[w,E]=$.useState(!1);if(N&&!w&&x===null&&m){E(!0);const b=Pa(Ks(m),l??{});b&&(g("pages"),y({collection:"pages",key:b.key,path:b.path}))}const[B,k]=$.useState(""),[D,O]=$.useState("board"),L=b=>{y(b),j(null)},[K,F]=$.useState(f);K!==f&&(F(f),k(""));const{data:_,isLoading:A,isFetching:R}=ba(p,{fetchEnabled:i,refetchInterval:b=>{const U=b.state.data;if(f==="apps"&&x&&x.collection==="apps"){const ue=m?.[x.key];return hn(b,typeof ue?.__resolveType=="string"?ue.__resolveType:void 0,U)}if(f==="site"&&m){const ue=U?zs(m,U):null,fe=m.site,_e=ue?.resolveType??(typeof fe?.__resolveType=="string"?fe.__resolveType:void 0);return hn(b,_e,U,["seo"])}return!1}}),I=(b,U)=>!Un(b,_,U)&&(A||R),{catalog:V,isLoading:z}=bl(_??void 0,m??void 0,{enabled:f==="apps"}),J=Bi({orgSlug:n,virtualMcpId:e,branch:s,meta:_}),P=Xt(p),G=In(p),Y=Di({orgSlug:n,virtualMcpId:e,branch:s,decofile:m??{},support:J,onMoved:(b,U)=>y(ue=>ue?.collection==="posts"&&ue.key===b?{collection:"posts",key:U}:ue)}),[q,X]=$.useState(null),[ce,ne]=$.useState(),[de,te]=$.useState(!1),[re,le]=$.useState(),[C,W]=$.useState(null),[Z,oe]=$.useState(null),[S,se]=$.useState(null),H=!m||!_;if(h||A||H&&c)return t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:t.jsx(rt,{className:"size-5 text-muted-foreground"})});if(H)return t.jsx(st,{title:"Could not load site data."});const ie=Ks(m).sort((b,U)=>b.name.localeCompare(U.name)),ye=Ta(m).sort((b,U)=>b.from.localeCompare(U.from)),pe=Ba(m,_),ke=f==="sections"?Ea(_):[],he=zs(m,_),je=Jn(m),Se=Ps.some(b=>je[b].length>0),Ae=lt(f)?je[f]:[],Ce=Fs(_,"loaders"),Pe=Fs(_,"actions");if(!_a(m,_)&&!Se&&Ce===0&&Pe===0)return t.jsx(st,{icon:Yt,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const De={pages:ie.length,sections:pe.length,apps:V.length,loaders:Ce,actions:Pe,redirects:ye.length,posts:je.posts.length,authors:je.authors.length,categories:je.categories.length},xe=new Set(ie.map(b=>Ot(b.path))),$e=new Set(ie.map(b=>b.name)),Le=new Set(pe.map(b=>b.name)),M=async b=>{const U=m[b.key];if(!U)return;const ue=On(m,b.key),fe=ya(m,b.key,Math.max(0,ue-1)),_e=va(U.sections,fe);if(_e)try{await P.mutateAsync({blockKey:b.key,data:{...U,sections:_e}}),me.success(`Variant added to "${b.name}"`),y({collection:"pages",key:b.key,path:b.path})}catch(Re){me.error(Re instanceof Error?Re.message:"Could not add variant")}},ve=()=>{ne(void 0),X({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},Ne=b=>{ne(void 0),X({mode:"duplicate",sourceKey:b.key,initialName:Hs($e,b.name),initialPath:wl(xe,b.path)})},Oe=b=>{ne(void 0),X({mode:"rename",sourceKey:b.key,initialName:b.name,initialPath:b.path})},ns=async b=>{if(!q)return;const{mode:U,sourceKey:ue}=q;try{if(U==="create"){let fe;if(b.templateKey){const Re=m[b.templateKey];if(!Re)throw new Error("Selected template no longer exists.");fe={...Re,name:b.name,path:b.path}}else fe=Tl(b.name,b.path);const _e=El(m,b.name);await P.mutateAsync({blockKey:_e,data:fe}),me.success(`Created "${b.name}"`),y({collection:"pages",key:_e,path:b.path})}else if(U==="duplicate"&&ue){const fe=m[ue];if(!fe)throw new Error("Source page not found");const{key:_e,data:Re}=Pl({source:fe,pages:ie,newName:b.name,newPath:b.path});await P.mutateAsync({blockKey:_e,data:Re}),me.success(`Duplicated as "${b.name}"`),y({collection:"pages",key:_e,path:b.path})}else if(U==="rename"&&ue){const fe=m[ue];if(!fe)throw new Error("Page not found");const _e={...fe,name:b.name,path:b.path};await P.mutateAsync({blockKey:ue,data:_e}),me.success("Page updated"),x?.collection==="pages"&&x.key===ue&&y({collection:"pages",key:ue,path:b.path})}X(null)}catch(fe){ne(fe instanceof Error?fe.message:"Save failed")}},os=({path:b})=>{if(!q)return null;const U=Ot(b);return(q.mode==="rename"?Ot(q.initialPath):null)!==U&&xe.has(U)?`A page with path "${b}" already exists.`:null},as=async(b,U,ue)=>{await P.mutateAsync({blockKey:U,data:{...ue,name:U,__resolveType:b}}),me.success(r("sandbox.contentBrowser.createdSection",{name:U})),y({collection:"sections",key:U})},Dt=$n((b,U)=>P.mutate({blockKey:b,data:U})),ls=async b=>{const U=m[b.key];if(!U){me.error(r("sandbox.contentBrowser.sectionNotFound"));return}const ue=Cl(m,b.key),fe=Hs(Le,b.name),_e={...U,name:fe};try{await P.mutateAsync({blockKey:ue,data:_e}),me.success(r("sandbox.contentBrowser.duplicatedSection",{name:b.name})),y({collection:"sections",key:ue})}catch(Re){me.error(Re instanceof Error?Re.message:r("sandbox.contentBrowser.duplicateFailed"))}},is=async b=>{if(!C)return;const U=m[C];if(!U){me.error(r("sandbox.contentBrowser.sectionNotFound"));return}try{await P.mutateAsync({blockKey:C,data:{...U,name:b}}),me.success(r("sandbox.contentBrowser.sectionRenamed")),W(null)}catch(ue){me.error(ue instanceof Error?ue.message:r("sandbox.contentBrowser.renameFailed"))}},T=()=>{le(void 0),te(!0)},Q=async b=>{const U=Da(m,b.from),ue=Aa(b);try{await P.mutateAsync({blockKey:U,data:ue}),me.success("Created redirect"),te(!1),y({collection:"redirects",key:U})}catch(fe){le(fe instanceof Error?fe.message:"Could not create redirect")}},Te=async b=>{const U=ps(m,b),ue=it(U,b,so(b));try{await P.mutateAsync({blockKey:U,data:ue}),me.success(`Created ${Pt[b]}`),y({collection:b,key:U})}catch(fe){me.error(fe instanceof Error?fe.message:"Could not create")}},Ve=async b=>{const U=ps(m,"posts"),ue=it(U,"posts",vi(b));try{await P.mutateAsync({blockKey:U,data:ue}),me.success(r("sandbox.postCalendar.createdScheduledPost")),g("posts"),F("posts"),y({collection:"posts",key:U}),j(null)}catch(fe){me.error(fe instanceof Error?fe.message:r("sandbox.postCalendar.couldNotCreate"))}},We=async(b,U)=>{const ue=m[b],fe=ue?ki(mt(ue,"posts"),U):null;if(!fe){me.error(r("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await P.mutateAsync({blockKey:b,data:it(b,"posts",fe)})}catch(_e){me.error(_e instanceof Error?_e.message:r("sandbox.postCalendar.couldNotReschedule"))}},Ee=async b=>{const U=m[b.key];if(!U){me.error("Record not found.");return}const ue=ps(m,b.kind),fe=b.kind==="posts"?"title":"name",_e={...structuredClone(mt(U,b.kind)),[fe]:`${b.label} (copy)`};try{await P.mutateAsync({blockKey:ue,data:it(ue,b.kind,_e)}),me.success(`Duplicated "${b.label}"`),y({collection:b.kind,key:ue})}catch(Re){me.error(Re instanceof Error?Re.message:"Duplicate failed")}},yt=()=>{g("posts"),F("posts"),y(null),j(null),k("")},Ge=async()=>{if(Z)try{const{kind:b,key:U,label:ue}=Z;if(b==="blog"){if(Z.blogKind==="categories"){const fe=mt(m[U],"categories").slug,_e=typeof fe=="string"?fe:"";if(_e)for(const{key:Re,payload:$s}of Ue(m,"posts")){const Ls=Ql($s,_e);Ls!==$s&&await P.mutateAsync({blockKey:Re,data:it(Re,"posts",Xl(Ls))})}}await G.mutateAsync({blockKey:U})}else await G.mutateAsync({blockKey:U});me.success(`Deleted "${ue}"`),x&&x.collection!=="available-section"&&x.key===U&&y(null),oe(null)}catch(b){me.error(b instanceof Error?b.message:"Delete failed")}},at=G.isPending||P.isPending,rs=Z?.kind==="blog"?Pt[Z.blogKind]:Z?.kind??"item";return t.jsxs("div",{className:"flex h-full w-full",children:[t.jsx(vl,{active:f,counts:De,showBlog:Se,onSelect:b=>{g(b),y(null),j(null)}}),f!=="seo"&&f!=="site"&&f!=="context"&&f!=="calendar"&&f!=="post-schedule"&&f!=="posts"&&f!=="loaders"&&f!=="actions"&&t.jsx(tc,{activeCollection:f,pages:ie,redirects:ye,sections:pe,availableSections:ke,appCatalog:V,appCatalogLoading:z,blogEntries:Ae,decofile:m,searchQuery:B,onSearchChange:k,selection:x,onSelect:L,onCreate:()=>{f==="pages"?ve():f==="redirects"?T():lt(f)&&Te(f)},onDuplicatePage:Ne,onRenamePage:Oe,onAddPageVariant:M,onDeletePage:b=>oe({kind:"page",key:b.key,label:b.name}),onEditPageSeo:b=>{const U={collection:"pages",key:b.key,path:b.path};y(U),j(b.key)},onViewPageJson:b=>se(b.key),onDuplicateSection:ls,onRenameSection:b=>W(b.key),onDeleteSection:b=>oe({kind:"section",key:b.key,label:b.name}),onDeleteRedirect:b=>oe({kind:"redirect",key:b.key,label:b.from||b.key}),onDuplicateBlog:Ee,onDeleteBlog:b=>oe({kind:"blog",blogKind:b.kind,key:b.key,label:b.label})}),t.jsx("div",{className:"flex-1 min-w-0",children:f==="loaders"||f==="actions"?t.jsx(wr,{orgSlug:n,virtualMcpId:e,branch:s,previewUrl:o,meta:_,decofile:m,kind:f}):t.jsx($.Suspense,{fallback:t.jsx("div",{className:"h-full flex items-center justify-center",children:t.jsx(rt,{className:"size-5 text-muted-foreground"})}),children:f==="calendar"?t.jsx(Jr,{decofile:m}):f==="post-schedule"?t.jsx(Yr,{decofile:m,support:J,isCreating:P.isPending,onCreate:b=>{Ve(b)},onReschedule:(b,U)=>{We(b,U)},onSelect:b=>{g("posts"),F("posts"),y({collection:"posts",key:b}),j(null)}}):f==="site"?he?t.jsx(fn,{orgSlug:n,virtualMcpId:e,branch:s,blockKey:he.key,block:m[he.key],decofile:m,meta:_,title:"Site",excludeFields:["seo"],schemaPending:I(he.resolveType,["seo"]),previewBaseUrl:o},`site:${he.key}`):t.jsx(st,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):f==="context"?t.jsx(il,{title:r("sandbox.blogContext.soonTitle"),description:r("sandbox.blogContext.soonDescription"),children:t.jsx(Gr,{orgSlug:n,virtualMcpId:e,branch:s,decofile:m,meta:_,onOpenPost:b=>{g("posts"),F("posts"),y({collection:"posts",key:b}),j(null)},onManageCategoryPosts:()=>{g("posts"),F("posts"),y(null),j(null)}})}):f==="seo"?t.jsx(Wr,{orgSlug:n,virtualMcpId:e,branch:s,decofile:m,meta:_,target:{kind:"site"},previewBaseUrl:a}):f==="sections"?t.jsx(Fr,{selection:x?.collection==="sections"||x?.collection==="available-section"?x:null,orgSlug:n,virtualMcpId:e,branch:s,previewUrl:o,meta:_,decofile:m,isCreating:P.isPending,onCreateAvailable:as,onSaveReferencedBlock:Dt}):f==="posts"?t.jsx(hr,{orgSlug:n,virtualMcpId:e,branch:s,decofile:m,view:D,selectedKey:x?.collection==="posts"?x.key:null,onViewChange:b=>{O(b),y(null)},onClose:()=>y(null),onOpen:b=>{y({collection:"posts",key:b}),j(null)},move:Y,support:J,meta:_,renderDetail:(b,U)=>t.jsx(Vr,{orgSlug:n,virtualMcpId:e,branch:s,blockKey:b,block:m[b],decofile:m,meta:_,previewBaseUrl:a,move:Y,onClose:U?.onClose,expanded:U?.expanded,onToggleExpand:U?.onToggleExpand},`post:${Tt(b)}`)}):x&&x.collection!=="available-section"?x.collection==="apps"?t.jsx(fn,{orgSlug:n,virtualMcpId:e,branch:s,blockKey:x.key,block:m[x.key],decofile:m,meta:_,previewBaseUrl:o,schemaPending:I(typeof m[x.key]?.__resolveType=="string"?String(m[x.key].__resolveType):void 0)},`app:${x.key}`):x.collection==="categories"?t.jsx(Hr,{orgSlug:n,virtualMcpId:e,branch:s,blockKey:x.key,block:m[x.key],decofile:m,meta:_,onManagePosts:()=>yt(),onOpenPost:b=>{g("posts"),F("posts"),y({collection:"posts",key:b}),j(null)},previewBaseUrl:a},`category:${x.key}`):x.collection==="authors"?t.jsx(Ur,{orgSlug:n,virtualMcpId:e,branch:s,kind:"authors",blockKey:x.key,block:m[x.key]},`authors:${x.key}`):x.collection==="redirects"?t.jsx(Qr,{orgSlug:n,virtualMcpId:e,branch:s,blockKey:x.key,block:m[x.key]},`redirect:${x.key}`):t.jsx(qr,{orgSlug:n,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:o??void 0,currentPath:x.collection==="pages"?x.path:"/",activePageBlockKey:x.collection==="pages"?x.key:null,activeGlobalBlockKey:x.collection==="sections"?x.key:null,initialEditSeo:x.collection==="pages"&&v===x.key,onExitSeo:()=>j(null),onSelectRoot:()=>{y(null),j(null)}},x.collection==="pages"?`page:${x.key}`:`section:${x.key}`):t.jsx(st,{title:`Select ${lt(f)?`a ${Pt[f]}`:f==="pages"?"a page":f==="apps"?"an app":f==="redirects"?"a redirect":"a section"} to edit`,description:f==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),q&&t.jsx($l,{open:!!q,mode:q.mode,initialName:q.initialName,initialPath:q.initialPath,isPending:P.isPending,error:ce,templates:ie,validate:os,onSubmit:ns,onOpenChange:b=>{b||(X(null),ne(void 0))}}),t.jsx(Ol,{open:de,isPending:P.isPending,error:re,onSubmit:Q,onOpenChange:b=>{b||(te(!1),le(void 0))}}),C&&t.jsx(Rl,{open:!!C,blockKey:C,initialName:pe.find(b=>b.key===C)?.name??C,isPending:P.isPending,onSubmit:is,onOpenChange:b=>{b||W(null)}}),S&&t.jsx($a,{open:!!S,onOpenChange:b=>{b||se(null)},pageKey:S,decofile:m,onSave:b=>P.mutateAsync({blockKey:S,data:b})}),t.jsx(Go,{open:!!Z,onOpenChange:b=>{!b&&!at&&oe(null)},children:t.jsxs(Ho,{children:[t.jsxs(qo,{children:[t.jsx(Wo,{children:`Delete ${rs}?`}),t.jsx(Jo,{children:Z?.kind==="section"?`"${Z.label}" will be removed. Pages that still reference it will lose this section.`:Z?`"${Z.label}" will be removed permanently. This can't be undone.`:null})]}),t.jsxs(Yo,{children:[t.jsx(Qo,{disabled:at,children:"Cancel"}),t.jsx(Xo,{onClick:b=>{b.preventDefault(),Ge()},disabled:at,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:at?t.jsxs(t.Fragment,{children:[t.jsx(rt,{className:"size-3.5"}),"Deleting…"]}):"Delete"})]})]})})]})}function tc(n){const e=ae.c(57),{activeCollection:s,pages:o,redirects:a,sections:l,availableSections:i,appCatalog:c,appCatalogLoading:r,blogEntries:d,decofile:p,searchQuery:m,onSearchChange:h,selection:u,onSelect:f,onCreate:g,onDuplicatePage:x,onRenamePage:y,onAddPageVariant:v,onDeletePage:j,onEditPageSeo:N,onViewPageJson:w,onDuplicateSection:E,onRenameSection:B,onDeleteSection:k,onDeleteRedirect:D,onDuplicateBlog:O,onDeleteBlog:L}=n;let K,F,_,A,R,I;if(e[0]!==s||e[1]!==c||e[2]!==r||e[3]!==i||e[4]!==d||e[5]!==p||e[6]!==v||e[7]!==g||e[8]!==L||e[9]!==j||e[10]!==D||e[11]!==k||e[12]!==O||e[13]!==x||e[14]!==E||e[15]!==N||e[16]!==y||e[17]!==B||e[18]!==h||e[19]!==f||e[20]!==w||e[21]!==o||e[22]!==a||e[23]!==m||e[24]!==l||e[25]!==u){const P=m.toLowerCase(),G=o.filter(S=>!P||S.name.toLowerCase().includes(P)||S.path.toLowerCase().includes(P)),Y=a.filter(S=>!P||S.from.toLowerCase().includes(P)||S.to.toLowerCase().includes(P)),q=l.filter(S=>!P||S.name.toLowerCase().includes(P)||S.key.toLowerCase().includes(P)||S.resolveType.toLowerCase().includes(P)),X=i.filter(S=>!P||S.title.toLowerCase().includes(P)||S.resolveType.toLowerCase().includes(P)||(S.description?.toLowerCase().includes(P)??!1)),ce=Mr(q),ne=c.filter(S=>!P||S.title.toLowerCase().includes(P)||S.app.toLowerCase().includes(P)||S.vendor.toLowerCase().includes(P)||S.category.toLowerCase().includes(P)),de=d.filter(S=>!P||S.label.toLowerCase().includes(P)||S.subtitle.toLowerCase().includes(P)),te=`Search ${s}…`,re=lt(s)?`Create new ${Pt[s]}`:s==="redirects"?"Create new redirect":"Create new page",le=s!=="apps"&&s!=="sections";R="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let C;e[32]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Bn,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[32]=C):C=e[32];let W;e[33]!==h?(W=S=>h(S.target.value),e[33]=h,e[34]=W):W=e[34];let Z;e[35]!==te||e[36]!==m||e[37]!==W?(Z=t.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[C,t.jsx("input",{type:"text",value:m,onChange:W,placeholder:te,"aria-label":te,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[35]=te,e[36]=m,e[37]=W,e[38]=Z):Z=e[38];let oe;e[39]!==re||e[40]!==g||e[41]!==le?(oe=le&&t.jsxs(Xe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsx(Be,{variant:"ghost",size:"icon",onClick:g,"aria-label":re,children:t.jsx(js,{size:14})})}),t.jsx(Qe,{side:"bottom",children:re})]}),e[39]=re,e[40]=g,e[41]=le,e[42]=oe):oe=e[42],e[43]!==Z||e[44]!==oe?(I=t.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[Z,oe]}),e[43]=Z,e[44]=oe,e[45]=I):I=e[45],K=Qt,A="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",F="flex flex-col gap-1 p-1.5",_=s==="pages"?G.length===0?t.jsx(jt,{hasItems:o.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):G.map(S=>{const se=u?.collection==="pages"&&u.key===S.key,H=On(p,S.key);return t.jsx(He,{icon:yn,title:S.name,subtitle:S.path,active:se,variantCount:H,onClick:()=>f({collection:"pages",key:S.key,path:S.path}),menu:t.jsx(Lt,{onDuplicate:()=>x(S),onRename:()=>y(S),onAddVariant:()=>v(S),onEditSeo:()=>N(S),onViewJson:()=>w(S),onDelete:()=>j(S)})},S.key)}):s==="sections"?q.length===0&&X.length===0?t.jsx(jt,{hasItems:l.length>0||i.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):t.jsxs(t.Fragment,{children:[ce.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(mn,{icon:Mt,label:"Saved sections"}),ce.map(S=>t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:S.label}),S.sections.map(se=>{const H=u?.collection==="sections"&&u.key===se.key;return t.jsx(He,{icon:Mt,accent:"global",title:se.name,subtitle:S.label,active:H,onClick:()=>f({collection:"sections",key:se.key}),menu:t.jsx(Lt,{onDuplicate:()=>E(se),onRename:()=>B(se),onDelete:()=>k(se)})},se.key)})]},S.label))]}),X.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(mn,{icon:Rs,label:"Available sections",className:ge(ce.length>0&&"mt-3")}),X.map(S=>{const se=u?.collection==="available-section"&&u.resolveType===S.resolveType,H=S.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return t.jsx(He,{icon:Rs,title:S.title,subtitle:H??S.resolveType,active:se,onClick:()=>f({collection:"available-section",resolveType:S.resolveType,title:S.title})},S.resolveType)})]})]}):s==="apps"?r?t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(rt,{className:"size-4.5 text-muted-foreground"})}):ne.length===0?t.jsx(jt,{hasItems:c.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ne.map(S=>{const se=u?.collection==="apps"&&S.blockKey!==null&&u.key===S.blockKey;return t.jsx(He,{icon:Tn,logoUrl:S.logo,title:S.title,subtitle:S.category,active:se,trailing:S.installed?t.jsx("span",{className:"shrink-0 rounded-full bg-success/15 px-1.5 py-0.5 text-[10px] font-medium text-success",children:"Installed"}):void 0,onClick:()=>{if(!S.installed||!S.blockKey){me.message(`${S.title} is not installed on this site.`);return}f({collection:"apps",key:S.blockKey})}},S.id)}):s==="redirects"?Y.length===0?t.jsx(jt,{hasItems:a.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):Y.map(S=>t.jsx(He,{icon:vn,title:S.from||"(no source)",subtitle:`→ ${S.to||"(no target)"}`,active:u?.collection==="redirects"&&u.key===S.key,trailing:t.jsx(Il,{type:S.type}),onClick:()=>f({collection:"redirects",key:S.key}),menu:t.jsx(Lt,{onDelete:()=>D(S)})},S.key)):de.length===0?t.jsx(jt,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${lt(s)?Pt[s]:"item"}.`}):de.map(S=>{const se=u?.collection===S.kind&&u.key===S.key;return t.jsx(He,{icon:S.kind==="posts"?Pn:S.kind==="authors"?En:kn,title:S.label,subtitle:S.subtitle,active:se,onClick:()=>f({collection:S.kind,key:S.key}),menu:t.jsx(Lt,{onDuplicate:()=>O(S),onDelete:()=>L(S)})},S.key)}),e[0]=s,e[1]=c,e[2]=r,e[3]=i,e[4]=d,e[5]=p,e[6]=v,e[7]=g,e[8]=L,e[9]=j,e[10]=D,e[11]=k,e[12]=O,e[13]=x,e[14]=E,e[15]=N,e[16]=y,e[17]=B,e[18]=h,e[19]=f,e[20]=w,e[21]=o,e[22]=a,e[23]=m,e[24]=l,e[25]=u,e[26]=K,e[27]=F,e[28]=_,e[29]=A,e[30]=R,e[31]=I}else K=e[26],F=e[27],_=e[28],A=e[29],R=e[30],I=e[31];let V;e[46]!==F||e[47]!==_?(V=t.jsx("div",{className:F,children:_}),e[46]=F,e[47]=_,e[48]=V):V=e[48];let z;e[49]!==K||e[50]!==A||e[51]!==V?(z=t.jsx(K,{className:A,children:V}),e[49]=K,e[50]=A,e[51]=V,e[52]=z):z=e[52];let J;return e[53]!==R||e[54]!==I||e[55]!==z?(J=t.jsxs("div",{className:R,children:[I,z]}),e[53]=R,e[54]=I,e[55]=z,e[56]=J):J=e[56],J}function sc(n){const e=ae.c(25),{virtualMcpId:s}=n,o=we(),[a,l]=$.useState(!1),i=zn(s),{activeTask:c}=bn();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[0]=r):r=e[0];const d=gn(r);if(!(Us(i?.metadata)||Us(c?.metadata))){let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:t.jsx(Gs,{className:"size-7 text-foreground"})}),e[1]=h):h=e[1];let u;e[2]!==o?(u=o("mainPanelTabs.contentTab.noContentToEdit"),e[2]=o,e[3]=u):u=e[3];let f;e[4]!==o?(f=o("mainPanelTabs.contentTab.connectGithubDescription"),e[4]=o,e[5]=f):f=e[5];let g,x;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=()=>l(!0),x=t.jsx(Gs,{className:"size-4"}),e[6]=g,e[7]=x):(g=e[6],x=e[7]);let y;e[8]!==o?(y=o("mainPanelTabs.previewTab.connectGithub"),e[8]=o,e[9]=y):y=e[9];let v;e[10]!==y?(v=t.jsxs(Be,{onClick:g,children:[x,y]}),e[10]=y,e[11]=v):v=e[11];let j;e[12]!==u||e[13]!==f||e[14]!==v?(j=t.jsx(ol,{className:"h-full",image:h,title:u,description:f,actions:v}),e[12]=u,e[13]=f,e[14]=v,e[15]=j):j=e[15];let N;e[16]!==a?(N=t.jsx(al,{open:a,onOpenChange:l,mode:"agent"}),e[16]=a,e[17]=N):N=e[17];let w;return e[18]!==N||e[19]!==j?(w=t.jsxs(t.Fragment,{children:[j,N]}),e[18]=N,e[19]=j,e[20]=w):w=e[20],w}let m;return e[21]!==d.contentPageId||e[22]!==d.contentPath||e[23]!==d.contentPathTemplate?(m=t.jsx(Xr,{deepLinkPage:{pageId:d.contentPageId,path:d.contentPath,pathTemplate:d.contentPathTemplate}}),e[21]=d.contentPageId,e[22]=d.contentPath,e[23]=d.contentPathTemplate,e[24]=m):m=e[24],m}function nc(){const n=ae.c(2),e=ll();let s;return n[0]!==e?(s=t.jsx(_o,{tabId:"content",children:t.jsx(Do,{feature:"cms",children:t.jsx(sc,{virtualMcpId:e})})}),n[0]=e,n[1]=s):s=n[1],s}const Sd=Object.freeze(Object.defineProperty({__proto__:null,default:nc},Symbol.toStringTag,{value:"Module"}));export{xo as $,gd as A,Es as B,rd as C,ld as D,xd as E,yd as F,Jn as G,io as H,Ai as I,Qs as J,pi as K,ad as L,ps as M,so as N,nd as O,Bs as P,dd as Q,bd as R,ud as S,vd as T,fd as U,pt as V,pd as W,md as X,cd as Y,hd as Z,qt as _,sd as a,go as a0,Sd as a1,ss as b,Xl as c,Ti as d,td as e,Ue as f,mt as g,Jt as h,jd as i,oi as j,kd as k,Xn as l,Ts as m,Cl as n,no as o,_t as p,it as q,cl as r,be as s,ro as t,Bi as u,Ke as v,ui as w,od as x,id as y,Me as z};
|
|
9
|
+
`)||void 0,count:O}),Ee=pi(re.map(Ge=>Ge.title),We.themes);if(Ee.length===0){me.info(u("sandbox.postBoard.ideasFailed"));return}let yt=0;for(const Ge of Ee){const at=ri();try{await g.mutateAsync({blockKey:at,data:ci(at,{title:Ge.title,body:Ge.body,pillarKey:T?.key,createdAt:new Date().toISOString()})}),yt++}catch(rs){console.warn("[posts] could not save a generated idea",rs)}}if(yt===0){me.error(u("sandbox.postBoard.ideasFailed"));return}me.success(u("sandbox.postBoard.ideasAdded",{count:String(yt)}))}catch(Q){me.error(Q instanceof Error?Q.message:u("sandbox.postBoard.ideasFailed"))}finally{w(!1)}};return t.jsxs("div",{className:"relative flex h-full min-w-0 flex-col",children:[t.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-between gap-3 border-b px-6 py-3",children:[t.jsx("div",{className:"flex items-center gap-3",children:t.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border p-0.5",children:[t.jsx(un,{active:a==="board",onClick:()=>i("board"),icon:t.jsx(Ko,{size:14}),label:u("sandbox.postBoard.viewBoard")}),t.jsx(un,{active:a==="list",onClick:()=>i("list"),icon:t.jsx(Uo,{size:14}),label:u("sandbox.postBoard.viewList")})]})}),t.jsxs("div",{className:"flex items-center gap-2",children:[N&&t.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","aria-live":"polite",role:"status",children:[t.jsx(Ct,{size:12,className:"animate-spin"}),u("sandbox.postBoard.generatingLabel")]}),t.jsxs(ut,{open:E,onOpenChange:B,children:[t.jsx(Ka,{asChild:!0,children:t.jsxs(Be,{type:"button",variant:"outline",size:"sm",disabled:!0,children:[t.jsx(tt,{size:14}),u("sandbox.postBoard.generateIdeas"),t.jsx(ot,{variant:"secondary",children:u("common.soon")})]})}),t.jsxs(dt,{className:"sm:max-w-lg",children:[t.jsxs(xt,{children:[t.jsx(ct,{children:u("sandbox.postBoard.generateIdeas")}),t.jsx(Vt,{children:u("sandbox.postBoard.ideaGuidanceLabel")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(Rt,{id:"idea-guidance",value:k,rows:6,autoFocus:!0,onChange:T=>D(T.target.value),placeholder:u("sandbox.postBoard.ideaGuidancePlaceholder"),className:"resize-none text-sm"}),le.length>0&&t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(ze,{className:"text-xs",children:u("sandbox.postBoard.ideaPillarLabel")}),t.jsx(Nt,{options:le.map(T=>T.title),value:le.find(T=>T.key===K)?.title??"",emptyLabel:u("sandbox.postBoard.ideaNoPillar"),onChange:T=>F(le.find(Q=>Q.title===T)?.key??"")})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ze,{htmlFor:"idea-count",className:"text-xs",children:u("sandbox.postBoard.ideaCount")}),t.jsx(Ze,{id:"idea-count",type:"number",min:1,max:8,value:O,onChange:T=>L(Math.max(1,Math.min(8,Number(T.target.value)||1))),className:"h-9 w-16"}),t.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:u("sandbox.postBoard.usesCredits")})]})]}),t.jsx(gt,{children:t.jsxs(Be,{type:"button",onClick:()=>{B(!1),is()},children:[t.jsx(tt,{size:14}),u("sandbox.postBoard.generateIdeas")]})})]})]}),t.jsxs(zt,{children:[t.jsx(Ft,{asChild:!0,children:t.jsxs(Be,{type:"button",size:"sm",children:[t.jsx(js,{size:14}),u("sandbox.postBoard.newPost"),t.jsx(ht,{size:14})]})}),t.jsxs(Kt,{align:"end",className:"w-56",children:[t.jsxs(Je,{disabled:!0,onClick:()=>{z(void 0),I(!0)},children:[t.jsx(tt,{size:14}),t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("span",{className:"flex items-center gap-1.5",children:[u("sandbox.postBoard.newPostGenerate"),t.jsx(ot,{variant:"secondary",children:u("common.soon")})]}),t.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.newPostGenerateHint")})]})]}),t.jsxs(Je,{onClick:Dt,children:[t.jsx(zo,{size:14}),t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:u("sandbox.postBoard.newPostWrite")}),t.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.newPostWriteHint")})]})]}),t.jsxs(Je,{onClick:()=>P(!0),children:[t.jsx(ms,{size:14}),t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:u("sandbox.postBoard.importContent")}),t.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.importContentHint")})]})]})]})]}),t.jsx(Ri,{open:R,onOpenChange:I,decofile:o,hasAi:y,seed:V,onGenerate:T=>{de(T)}},V?.title??"scratch"),t.jsx(ut,{open:J,onOpenChange:P,children:t.jsxs(dt,{className:"max-h-[85vh] sm:max-w-2xl",children:[t.jsxs(xt,{children:[t.jsx(ct,{children:u("sandbox.postBoard.importTitle")}),t.jsx(Vt,{children:u("sandbox.postBoard.importDescription")})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"h-72 overflow-hidden rounded-[var(--studio-control-radius,var(--radius-xl))] border bg-[var(--studio-input-background)]",children:t.jsx(Vn,{code:G,language:vo(G)?"html":"markdown",height:"100%",autoFocus:!0,onChange:T=>Y(T??"")})}),t.jsx("input",{ref:q,type:"file",accept:".html,.htm,.md,.markdown,.txt",className:"hidden",onChange:async T=>{const Q=T.target.files?.[0];Q&&Y(await Q.text()),T.target.value=""}}),t.jsxs(Be,{type:"button",variant:"outline",size:"sm",onClick:()=>q.current?.click(),children:[t.jsx(ms,{size:14}),u("sandbox.postBoard.importUpload")]})]}),t.jsx(gt,{children:t.jsxs(Be,{type:"button",disabled:!G.trim(),onClick:ls,children:[t.jsx(ms,{size:14}),u("sandbox.postBoard.importRun")]})})]})})]})]}),te.length===0&&re.length===0?t.jsx(Xa,{className:"flex-1",icon:t.jsx(tt,{size:22}),title:u("sandbox.postBoard.emptyTitle"),description:u("sandbox.postBoard.emptyDescription"),buttonProps:{children:u("sandbox.postBoard.newPost"),onClick:Dt}}):a==="board"?t.jsxs("div",{className:"flex min-h-0 flex-1 gap-3 overflow-x-auto p-4",children:[t.jsx(yr,{ideas:re,collapsed:X.includes(cn),pillarTitleOf:C,onToggleCollapsed:()=>ne(cn),onGenerate:ns,onDelete:os}),t.jsx("div",{"aria-hidden":!0,className:"my-1 w-px shrink-0 self-stretch bg-border"}),Bs.map(T=>{const Q=te.filter(Ee=>Ee.status===T);pr(T)&&Q.sort(fr);const Te=u(Jt[T]),Ve=X.includes(T),We=yo(p,T);return t.jsx("div",{onDragOver:Ee=>{Ee.preventDefault(),j(T)},onDragLeave:()=>j(Ee=>Ee===T?null:Ee),onDrop:Ee=>{Ee.preventDefault(),as(T,Ee.dataTransfer.getData(So))},title:We?u("sandbox.postBoard.moveUnsupported",{required:We.required,command:go}):void 0,className:ge("flex shrink-0 flex-col rounded-xl border bg-muted/30 transition-colors",Ve?"w-11":"w-72",We&&"opacity-50",v===T&&"border-primary bg-primary/5"),children:Ve?t.jsxs("button",{type:"button",onClick:()=>ne(T),"aria-label":u("sandbox.postBoard.expandLane",{lane:Te}),"aria-expanded":!1,className:"flex min-h-0 flex-1 cursor-pointer flex-col items-center gap-2 py-2.5 text-muted-foreground hover:text-foreground",children:[t.jsx(Bt,{size:14,className:"shrink-0"}),t.jsx("span",{className:"text-xs tabular-nums",children:Q.length}),t.jsx("span",{className:"[writing-mode:vertical-rl] text-sm font-medium",children:Te})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2.5 text-sm font-medium",children:[t.jsxs("button",{type:"button",onClick:()=>ne(T),"aria-label":u("sandbox.postBoard.collapseLane",{lane:Te}),"aria-expanded":!0,className:"flex min-w-0 cursor-pointer items-center gap-1.5 text-left hover:text-muted-foreground",children:[t.jsx(ht,{size:14,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:Te})]}),t.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:Q.length})]}),t.jsx("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto px-2 pb-2",children:Q.length===0?t.jsx("p",{className:"px-1 py-6 text-center text-xs text-muted-foreground",children:u("sandbox.postBoard.laneEmpty")}):Q.map(Ee=>t.jsx(br,{post:Ee,payload:W(Ee.key),moving:d.isMoving(Ee.key),onOpen:()=>c(Ee.key),onArchive:Ee.status==="archived"?void 0:()=>{oe(Ee)}},Ee.key))})]})},T)})]}):t.jsxs("div",{className:"flex min-h-0 flex-1",children:[t.jsxs("div",{className:"flex w-80 shrink-0 flex-col border-r",children:[M?t.jsx(ur,{count:je.size,allSelected:Le.length>0&&Le.every(T=>je.has(T.key)),onToggleSelectAll:Ne,onArchive:()=>{Oe()},onExit:()=>Se(new Set)}):t.jsx(ar,{categories:xe,authors:$e,statusCounts:Ae,categoryFilter:S,authorFilter:H,statusFilter:ye,sort:ke,onCategoryFilterChange:se,onAuthorFilterChange:ie,onStatusFilterChange:pe,onSortChange:he}),t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:t.jsx(xr,{posts:Le,selectedKey:Z,selectionActive:M,selectedKeys:je,onToggleSelect:ve,onOpen:c,isMoving:d.isMoving,onArchive:T=>{oe(T)}})})]}),t.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:Z&&h?t.jsx($.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Ct,{size:20,className:"animate-spin text-muted-foreground"})}),children:h(Z)}):t.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-muted-foreground",children:u("sandbox.postBoard.selectPrompt")})})]}),a==="board"&&l&&_&&h&&t.jsx("div",{className:"absolute inset-0 z-30 flex flex-col bg-background",children:h(l,{expanded:!0,onToggleExpand:()=>A(!1),onClose:()=>{A(!1),r?.()}})}),t.jsx(ut,{open:a==="board"&&!!l&&!_,onOpenChange:T=>{T||(A(!1),r?.())},children:t.jsxs(dt,{closeButtonClassName:"hidden",className:"left-auto right-4 top-4 bottom-4 flex h-auto translate-x-0 translate-y-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-3xl",children:[t.jsx(ct,{className:"sr-only",children:u("sandbox.collectionsSidebar.posts")}),l&&h?t.jsx($.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Ct,{size:20,className:"animate-spin text-muted-foreground"})}),children:h(l,{expanded:!1,onToggleExpand:()=>A(!0),onClose:()=>r?.()})}):null]})})]})}function un(n){const e=ae.c(7),{active:s,onClick:o,icon:a,label:l}=n,i=s?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground";let c;e[0]!==i?(c=ge("inline-flex cursor-pointer items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors",i),e[0]=i,e[1]=c):c=e[1];let r;return e[2]!==a||e[3]!==l||e[4]!==o||e[5]!==c?(r=t.jsxs("button",{type:"button",onClick:o,className:c,children:[a,l]}),e[2]=a,e[3]=l,e[4]=o,e[5]=c,e[6]=r):r=e[6],r}function xr(n){const e=ae.c(19),{posts:s,selectedKey:o,selectionActive:a,selectedKeys:l,onToggleSelect:i,onOpen:c,isMoving:r,onArchive:d}=n;let p;if(e[0]!==r||e[1]!==d||e[2]!==c||e[3]!==i||e[4]!==s||e[5]!==o||e[6]!==l||e[7]!==a){let h;e[9]!==r||e[10]!==d||e[11]!==c||e[12]!==i||e[13]!==o||e[14]!==l||e[15]!==a?(h=u=>t.jsx(gr,{post:u,selected:u.key===o,selectionActive:a,checked:l.has(u.key),onToggleSelect:()=>i(u.key),moving:r(u.key),onOpen:()=>c(u.key),onArchive:u.status==="archived"?void 0:()=>d(u)},u.key),e[9]=r,e[10]=d,e[11]=c,e[12]=i,e[13]=o,e[14]=l,e[15]=a,e[16]=h):h=e[16],p=s.map(h),e[0]=r,e[1]=d,e[2]=c,e[3]=i,e[4]=s,e[5]=o,e[6]=l,e[7]=a,e[8]=p}else p=e[8];let m;return e[17]!==p?(m=t.jsx("ul",{className:"divide-y",children:p}),e[17]=p,e[18]=m):m=e[18],m}function gr(n){const e=ae.c(56),{post:s,selected:o,selectionActive:a,checked:l,onToggleSelect:i,moving:c,onOpen:r,onArchive:d}=n,p=we(),m=s.status==="awaiting_review"&&s.missing.length>0,h=s.status==="scheduled"||s.status==="published",u=a||l?"opacity-100":"opacity-0 focus-within:opacity-100 group-hover/row:opacity-100";let f;e[0]!==u?(f=ge("absolute left-3 top-3 z-10 transition-opacity",u),e[0]=u,e[1]=f):f=e[1];let g;e[2]!==i?(g=()=>i(),e[2]=i,e[3]=g):g=e[3];let x;e[4]!==s.title||e[5]!==p?(x=s.title||p("sandbox.postBoard.untitled"),e[4]=s.title,e[5]=p,e[6]=x):x=e[6];let y;e[7]!==l||e[8]!==g||e[9]!==x?(y=t.jsx(Zt,{checked:l,onCheckedChange:g,"aria-label":x}),e[7]=l,e[8]=g,e[9]=x,e[10]=y):y=e[10];let v;e[11]!==f||e[12]!==y?(v=t.jsx("span",{className:f,children:y}),e[11]=f,e[12]=y,e[13]=v):v=e[13];let j;e[14]!==c||e[15]!==d||e[16]!==a?(j=d&&!a&&t.jsx(As,{onArchive:d,disabled:c,className:"top-2.5"}),e[14]=c,e[15]=d,e[16]=a,e[17]=j):j=e[17];let N;e[18]!==r||e[19]!==i||e[20]!==a?(N=()=>a?i():r(),e[18]=r,e[19]=i,e[20]=a,e[21]=N):N=e[21];const w=o?"bg-accent text-accent-foreground":"bg-card hover:bg-muted/50";let E;e[22]!==w?(E=ge("flex w-full cursor-pointer flex-col gap-1.5 py-2.5 pl-10 pr-3 text-left text-sm transition-colors",w),e[22]=w,e[23]=E):E=e[23];let B;e[24]!==s.title||e[25]!==p?(B=s.title||p("sandbox.postBoard.untitled"),e[24]=s.title,e[25]=p,e[26]=B):B=e[26];let k;e[27]!==B?(k=t.jsx("span",{className:"min-w-0 truncate pr-6 font-medium",children:B}),e[27]=B,e[28]=k):k=e[28];const D=mr[s.status],O=Jt[s.status];let L;e[29]!==p||e[30]!==O?(L=p(O),e[29]=p,e[30]=O,e[31]=L):L=e[31];let K;e[32]!==D||e[33]!==L?(K=t.jsx(ot,{variant:D,className:"shrink-0",children:L}),e[32]=D,e[33]=L,e[34]=K):K=e[34];let F;e[35]!==m||e[36]!==s.missing?(F=m&&t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-warning",children:[t.jsx(Yt,{size:12}),s.missing.length]}),e[35]=m,e[36]=s.missing,e[37]=F):F=e[37];let _;e[38]!==h||e[39]!==s.date||e[40]!==s.scheduledDatetime?(_=h&&t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs tabular-nums text-muted-foreground",children:[t.jsx(vs,{size:12}),(s.scheduledDatetime||s.date||"").slice(0,10)]}),e[38]=h,e[39]=s.date,e[40]=s.scheduledDatetime,e[41]=_):_=e[41];let A;e[42]!==K||e[43]!==F||e[44]!==_?(A=t.jsxs("div",{className:"flex items-center gap-2",children:[K,F,_]}),e[42]=K,e[43]=F,e[44]=_,e[45]=A):A=e[45];let R;e[46]!==o||e[47]!==E||e[48]!==k||e[49]!==A||e[50]!==N?(R=t.jsxs("button",{type:"button",onClick:N,"aria-current":o,className:E,children:[k,A]}),e[46]=o,e[47]=E,e[48]=k,e[49]=A,e[50]=N,e[51]=R):R=e[51];let I;return e[52]!==R||e[53]!==v||e[54]!==j?(I=t.jsxs("li",{className:"group/row relative",children:[v,j,R]}),e[52]=R,e[53]=v,e[54]=j,e[55]=I):I=e[55],I}function br(n){const e=ae.c(46),{post:s,payload:o,moving:a,onOpen:l,onArchive:i}=n,c=we(),r=s.status!=="generating"&&!a;let d;e[0]!==o?(d=ql(o),e[0]=o,e[1]=d):d=e[1];const p=d,m=!r&&"opacity-80";let h;e[2]!==m?(h=ge("group/card relative rounded-lg border bg-card shadow-sm transition-colors hover:border-primary/40",m),e[2]=m,e[3]=h):h=e[3];let u;e[4]!==a||e[5]!==i?(u=i&&t.jsx(As,{onArchive:i,disabled:a,className:"top-2"}),e[4]=a,e[5]=i,e[6]=u):u=e[6];let f;e[7]!==s.key?(f=O=>O.dataTransfer.setData(So,s.key),e[7]=s.key,e[8]=f):f=e[8];const g=r?"cursor-grab active:cursor-grabbing":"cursor-pointer";let x;e[9]!==g?(x=ge("block w-full p-3 text-left",g),e[9]=g,e[10]=x):x=e[10];let y;e[11]!==s.title||e[12]!==c?(y=s.title||c("sandbox.postBoard.untitled"),e[11]=s.title,e[12]=c,e[13]=y):y=e[13];let v;e[14]!==y?(v=t.jsx("p",{className:"line-clamp-2 pr-6 text-sm font-medium",children:y}),e[14]=y,e[15]=v):v=e[15];let j;e[16]!==p||e[17]!==s.status?(j=s.status==="draft"&&t.jsxs(t.Fragment,{children:[p.pillarTitle&&t.jsx(ot,{variant:"secondary",className:"max-w-full truncate",children:p.pillarTitle}),p.format?.name&&t.jsx(ot,{variant:"outline",className:"max-w-full truncate",children:p.format.name})]}),e[16]=p,e[17]=s.status,e[18]=j):j=e[18];let N;e[19]!==s.status||e[20]!==c?(N=s.status==="generating"&&t.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[t.jsx(Ct,{size:12,className:"animate-spin"}),c("sandbox.postBoard.generatingLabel")]}),e[19]=s.status,e[20]=c,e[21]=N):N=e[21];let w;e[22]!==s.missing||e[23]!==s.status||e[24]!==c?(w=s.status==="awaiting_review"&&(s.missing.length>0?t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-warning",children:[t.jsx(Yt,{size:12}),c("sandbox.postBoard.nIssues",{count:String(s.missing.length)})]}):t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-success",children:[t.jsx(Qa,{size:12}),c("sandbox.postBoard.readyToSchedule")]})),e[22]=s.missing,e[23]=s.status,e[24]=c,e[25]=w):w=e[25];let E;e[26]!==s.date||e[27]!==s.scheduledDatetime||e[28]!==s.status?(E=(s.status==="scheduled"||s.status==="published")&&t.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[t.jsx(vs,{size:12}),(s.scheduledDatetime||s.date||"").slice(0,10)]}),e[26]=s.date,e[27]=s.scheduledDatetime,e[28]=s.status,e[29]=E):E=e[29];let B;e[30]!==j||e[31]!==N||e[32]!==w||e[33]!==E?(B=t.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[j,N,w,E]}),e[30]=j,e[31]=N,e[32]=w,e[33]=E,e[34]=B):B=e[34];let k;e[35]!==r||e[36]!==l||e[37]!==B||e[38]!==f||e[39]!==x||e[40]!==v?(k=t.jsxs("button",{type:"button",draggable:r,onDragStart:f,onClick:l,className:x,children:[v,B]}),e[35]=r,e[36]=l,e[37]=B,e[38]=f,e[39]=x,e[40]=v,e[41]=k):k=e[41];let D;return e[42]!==k||e[43]!==h||e[44]!==u?(D=t.jsxs("div",{className:h,children:[u,k]}),e[42]=k,e[43]=h,e[44]=u,e[45]=D):D=e[45],D}function yr(n){const e=ae.c(40),{ideas:s,collapsed:o,pillarTitleOf:a,onToggleCollapsed:l,onGenerate:i,onDelete:c}=n,r=we();let d,p,m,h,u,f,g;if(e[0]!==o||e[1]!==s.length||e[2]!==l||e[3]!==r){g=Symbol.for("react.early_return_sentinel");e:{if(d=r("sandbox.postBoard.ideasTray"),o){let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(Bt,{size:14,className:"shrink-0"}),e[11]=k):k=e[11];let D;e[12]!==s.length?(D=t.jsx("span",{className:"text-xs tabular-nums",children:s.length}),e[12]=s.length,e[13]=D):D=e[13],g=t.jsxs("button",{type:"button",onClick:l,"aria-label":r("sandbox.postBoard.expandLane",{lane:d}),"aria-expanded":!1,className:"flex w-11 shrink-0 cursor-pointer flex-col items-center gap-2 py-2.5 text-muted-foreground hover:text-foreground",children:[k,D,t.jsx("span",{className:"[writing-mode:vertical-rl] text-sm font-medium",children:d})]});break e}f="flex w-72 shrink-0 flex-col",u="flex items-center justify-between gap-2 px-3 py-2.5 text-sm font-medium",p="button",m=l,h=r("sandbox.postBoard.collapseLane",{lane:d})}e[0]=o,e[1]=s.length,e[2]=l,e[3]=r,e[4]=d,e[5]=p,e[6]=m,e[7]=h,e[8]=u,e[9]=f,e[10]=g}else d=e[4],p=e[5],m=e[6],h=e[7],u=e[8],f=e[9],g=e[10];if(g!==Symbol.for("react.early_return_sentinel"))return g;let x;e[14]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(ht,{size:14,className:"shrink-0"}),e[14]=x):x=e[14];let y;e[15]!==d?(y=t.jsx("span",{className:"truncate",children:d}),e[15]=d,e[16]=y):y=e[16];let v;e[17]!==p||e[18]!==m||e[19]!==h||e[20]!==y?(v=t.jsxs("button",{type:p,onClick:m,"aria-label":h,"aria-expanded":!0,className:"flex min-w-0 cursor-pointer items-center gap-1.5 text-left hover:text-muted-foreground",children:[x,y]}),e[17]=p,e[18]=m,e[19]=h,e[20]=y,e[21]=v):v=e[21];let j;e[22]!==s.length?(j=t.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:s.length}),e[22]=s.length,e[23]=j):j=e[23];let N;e[24]!==j||e[25]!==u||e[26]!==v?(N=t.jsxs("div",{className:u,children:[v,j]}),e[24]=j,e[25]=u,e[26]=v,e[27]=N):N=e[27];let w;e[28]!==s||e[29]!==c||e[30]!==i||e[31]!==a||e[32]!==r?(w=s.length===0?t.jsx("p",{className:"px-1 py-6 text-center text-xs text-muted-foreground",children:r("sandbox.postBoard.ideasEmpty")}):s.map(k=>{const D=a(k.pillarKey);return t.jsxs("div",{className:"group/card relative rounded-lg border border-dashed bg-card shadow-sm transition-colors hover:border-primary/40",children:[t.jsx(As,{label:r("sandbox.postBoard.deleteIdea"),onArchive:()=>c(k),className:"top-2"}),t.jsxs("div",{className:"p-3",children:[t.jsx("p",{className:"line-clamp-2 pr-6 text-sm font-medium",children:k.title||r("sandbox.postBoard.untitledIdea")}),k.body&&t.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:k.body}),D&&t.jsx(ot,{variant:"secondary",className:"mt-2 max-w-full truncate",children:D})]}),t.jsx("div",{className:"border-t px-3 py-2",children:t.jsxs(Be,{type:"button",variant:"ghost",size:"sm",disabled:!0,className:"h-7 w-full justify-start px-1.5 text-xs",onClick:()=>i(k),children:[t.jsx(tt,{size:13}),r("sandbox.postBoard.writeFromIdea"),t.jsx(ot,{variant:"secondary",className:"ml-auto",children:r("common.soon")})]})})]},k.key)}),e[28]=s,e[29]=c,e[30]=i,e[31]=a,e[32]=r,e[33]=w):w=e[33];let E;e[34]!==w?(E=t.jsx("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto pb-2 pr-1",children:w}),e[34]=w,e[35]=E):E=e[35];let B;return e[36]!==N||e[37]!==E||e[38]!==f?(B=t.jsxs("div",{className:f,children:[N,E]}),e[36]=N,e[37]=E,e[38]=f,e[39]=B):B=e[39],B}function As(n){const e=ae.c(13),{label:s,onArchive:o,disabled:a,className:l}=n,i=we();let c;e[0]!==s||e[1]!==i?(c=s??i("sandbox.postBoard.delete"),e[0]=s,e[1]=i,e[2]=c):c=e[2];const r=c;let d;e[3]!==o?(d=u=>{u.stopPropagation(),o()},e[3]=o,e[4]=d):d=e[4];let p;e[5]!==l?(p=ge("absolute right-2 z-10 flex size-6 cursor-pointer items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-muted hover:text-destructive focus-visible:opacity-100 group-hover/card:opacity-100 group-hover/row:opacity-100",l),e[5]=l,e[6]=p):p=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(ws,{size:13}),e[7]=m):m=e[7];let h;return e[8]!==a||e[9]!==d||e[10]!==p||e[11]!==r?(h=t.jsx("button",{type:"button",disabled:a,"aria-label":r,title:r,onClick:d,className:p,children:m}),e[8]=a,e[9]=d,e[10]=p,e[11]=r,e[12]=h):h=e[12],h}function He(n){const e=ae.c(50),{icon:s,logoUrl:o,title:a,subtitle:l,active:i,accent:c,variantCount:r,trailing:d,selectable:p,selectionActive:m,selected:h,invalid:u,invalidReason:f,onToggleSelect:g,onClick:x,menu:y}=n,v=we(),j=c==="global";let N;e[0]!==s||e[1]!==i||e[2]!==j||e[3]!==o?(N=o?t.jsx("img",{src:o,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):t.jsx("span",{className:ge("flex size-8 shrink-0 items-center justify-center rounded-lg",j?"bg-global-section/15":"bg-muted"),children:t.jsx(s,{size:16,className:ge("shrink-0",!j&&(i?"text-accent-foreground":"text-muted-foreground")),style:j?{color:Ns}:void 0})}),e[0]=s,e[1]=i,e[2]=j,e[3]=o,e[4]=N):N=e[4];const w=N,E=i?j?"bg-global-section/15 text-global-section-fg dark:text-global-section-fg-dark":"bg-accent text-accent-foreground":j?"hover:bg-global-section/10":"hover:bg-muted";let B;e[5]!==E?(B=ge("group relative flex min-w-0 items-center rounded-md transition-colors",E),e[5]=E,e[6]=B):B=e[6];let k;e[7]!==g||e[8]!==p||e[9]!==h||e[10]!==m||e[11]!==v||e[12]!==a?(k=p&&t.jsx("span",{className:ge("flex shrink-0 items-center pl-2.5 transition-opacity",h||m?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),onClick:vr,children:t.jsx(Zt,{checked:h,onCheckedChange:()=>g?.(),"aria-label":v("sandbox.itemRow.selectItem",{title:a})})}),e[7]=g,e[8]=p,e[9]=h,e[10]=m,e[11]=v,e[12]=a,e[13]=k):k=e[13];const D=u&&!i&&"text-destructive";let O;e[14]!==D?(O=ge("block truncate text-sm font-medium",D),e[14]=D,e[15]=O):O=e[15];let L;e[16]!==O||e[17]!==a?(L=t.jsx("span",{className:O,children:a}),e[16]=O,e[17]=a,e[18]=L):L=e[18];const K=i?"text-accent-foreground/70":"text-muted-foreground";let F;e[19]!==K?(F=ge("block truncate text-xs",K),e[19]=K,e[20]=F):F=e[20];let _;e[21]!==l||e[22]!==F?(_=t.jsx("span",{className:F,children:l}),e[21]=l,e[22]=F,e[23]=_):_=e[23];let A;e[24]!==_||e[25]!==L?(A=t.jsxs("span",{className:"min-w-0 flex-1",children:[L,_]}),e[24]=_,e[25]=L,e[26]=A):A=e[26];let R;e[27]!==i||e[28]!==v||e[29]!==r?(R=r!==void 0&&r>1&&t.jsxs(Xe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsxs("span",{className:ge("flex shrink-0 items-center gap-1 text-xs font-medium",i?"text-accent-foreground/70":"text-muted-foreground"),children:[t.jsx(wn,{size:14}),r]})}),t.jsx(Qe,{side:"bottom",children:v("sandbox.itemRow.variantCount",{count:r})})]}),e[27]=i,e[28]=v,e[29]=r,e[30]=R):R=e[30];let I;e[31]!==i||e[32]!==u||e[33]!==f?(I=u&&t.jsxs(Xe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsx("span",{className:ge("flex shrink-0 items-center",i?"text-accent-foreground":"text-destructive"),children:t.jsx(Yt,{size:14})})}),f&&t.jsx(Qe,{side:"bottom",children:f})]}),e[31]=i,e[32]=u,e[33]=f,e[34]=I):I=e[34];let V;e[35]!==x||e[36]!==w||e[37]!==A||e[38]!==R||e[39]!==I||e[40]!==d?(V=t.jsxs("button",{type:"button",onClick:x,className:"flex min-w-0 flex-1 items-center gap-2.5 classic:rounded-md compact:rounded-lg px-2.5 py-2 text-left cursor-pointer",children:[w,A,R,I,d]}),e[35]=x,e[36]=w,e[37]=A,e[38]=R,e[39]=I,e[40]=d,e[41]=V):V=e[41];let z;e[42]!==i||e[43]!==y?(z=y&&t.jsx("div",{className:ge("pr-1 opacity-0 transition-opacity group-hover:opacity-100",i&&"opacity-100"),children:y}),e[42]=i,e[43]=y,e[44]=z):z=e[44];let J;return e[45]!==V||e[46]!==z||e[47]!==B||e[48]!==k?(J=t.jsxs("div",{className:B,children:[k,V,z]}),e[45]=V,e[46]=z,e[47]=B,e[48]=k,e[49]=J):J=e[49],J}function vr(n){return n.stopPropagation()}function st(n){const e=ae.c(10),{icon:s,title:o,description:a}=n;let l;e[0]!==s?(l=s&&t.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=l):l=e[1];let i;e[2]!==o?(i=t.jsx("div",{children:o}),e[2]=o,e[3]=i):i=e[3];let c;e[4]!==a?(c=a&&t.jsx("div",{className:"text-xs text-muted-foreground/80 max-w-sm",children:a}),e[4]=a,e[5]=c):c=e[5];let r;return e[6]!==l||e[7]!==i||e[8]!==c?(r=t.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:[l,i,c]}),e[6]=l,e[7]=i,e[8]=c,e[9]=r):r=e[9],r}const jr={loaders:Nn,actions:Fn},kr={loaders:"Loaders",actions:"Actions"},Sr={analytics:tl,blog:jn,commerce:el,site:Mo,website:Mt};function Nr(n,e){return e===0?Sr[n.toLowerCase()]??Is:Is}function $t(n,e){return e===0?ia(n):n}function wr(n){const e=ae.c(98),{orgSlug:s,virtualMcpId:o,branch:a,previewUrl:l,meta:i,decofile:c,kind:r}=n,d=we();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[0]=p):p=e[0];const[m,h]=$.useState(p),[u,f]=$.useState(null),[g,x]=$.useState(""),[y,v]=$.useState(Ar),[j,N]=$.useState(r);j!==r&&(N(r),h([]),f(null),x(""),v(new Set));let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w=q=>{v(X=>{const ce=new Set(X);return ce.has(q)?ce.delete(q):ce.add(q),ce})},e[1]=w):w=e[1];const E=w;let B;e[2]!==a||e[3]!==s||e[4]!==o?(B={orgSlug:s,virtualMcpId:o,branch:a},e[2]=a,e[3]=s,e[4]=o,e[5]=B):B=e[5];const k=Xt(B);let D;e[6]!==k?(D=$n((q,X)=>k.mutate({blockKey:q,data:X})),e[6]=k,e[7]=D):D=e[7];const O=D;let L;e[8]!==r?(L=ra(r),e[8]=r,e[9]=L):L=e[9];const K=L,F=jr[r];let _,A,R,I,V,z,J;if(e[10]!==F||e[11]!==a||e[12]!==c||e[13]!==r||e[14]!==i||e[15]!==y||e[16]!==s||e[17]!==m||e[18]!==l||e[19]!==k||e[20]!==O||e[21]!==g||e[22]!==u||e[23]!==K||e[24]!==d||e[25]!==o){R=Symbol.for("react.early_return_sentinel");e:{const q=[...na(i,c,r).map(Dr),...oa(i,r).map(_r)],X=g.trim().toLowerCase(),ce=X.length>0,ne=ce?q.filter(M=>M.title.toLowerCase().includes(X)||M.resolveType.toLowerCase().includes(X)):[],de=new Map,te=[],re=new Map;if(!ce){for(const M of q){const ve=M.folderPath;if(!(ve.length<m.length)&&m.every((Ne,Oe)=>ve[Oe]===Ne))if(ve.length===m.length)if(M.savedKey!==void 0){const Ne=re.get(M.resolveType);Ne?Ne.push(M):re.set(M.resolveType,[M])}else te.push(M);else{const Ne=ve[m.length],Oe=de.get(Ne)??{count:0,savedCount:0};M.savedKey!==void 0?Oe.savedCount=Oe.savedCount+1:Oe.count=Oe.count+1,de.set(Ne,Oe)}}te.sort(Er);for(const M of re.values())M.sort(Br)}const le=[...re.entries()].filter(M=>{const[ve]=M;return!te.some(Ne=>Ne.resolveType===ve)}).flatMap(Tr).sort(Pr);let C;e[33]!==m?(C=(M,ve)=>$t(M.name,m.length).localeCompare($t(ve.name,m.length)),e[33]=m,e[34]=C):C=e[34];const W=[...de.entries()].map(Cr).sort(C);let Z;e[35]===Symbol.for("react.memo_cache_sentinel")?(Z=M=>{f(M.savedKey!==void 0?{mode:"saved",key:M.savedKey}:{mode:"available",resolveType:M.resolveType,title:M.title})},e[35]=Z):Z=e[35];const oe=Z;let S;e[36]!==k||e[37]!==K||e[38]!==d?(S=async(M,ve)=>{await k.mutateAsync({blockKey:M,data:ve}),me.success(d("sandbox.runnableBlocksBrowser.savedBlockToast",{singular:K,blockId:M})),f({mode:"saved",key:M})},e[36]=k,e[37]=K,e[38]=d,e[39]=S):S=e[39];const se=S;let H;e[40]!==c||e[41]!==u?(H=$r(u,c),e[40]=c,e[41]=u,e[42]=H):H=e[42];const ie=H;if(ie){const M=`${ie.mode}:${ie.mode==="saved"?ie.blockKey:ie.resolveType}`;let ve;e[43]===Symbol.for("react.memo_cache_sentinel")?(ve=()=>f(null),e[43]=ve):ve=e[43];let Ne;e[44]!==a||e[45]!==c||e[46]!==se||e[47]!==r||e[48]!==i||e[49]!==s||e[50]!==l||e[51]!==k.isPending||e[52]!==O||e[53]!==M||e[54]!==ie.editorTarget||e[55]!==ie.initialValue||e[56]!==o?(Ne=t.jsx(aa,{orgSlug:s,virtualMcpId:o,branch:a,previewUrl:l,meta:i,decofile:c,kind:r,target:ie.editorTarget,initialValue:ie.initialValue,isCreating:k.isPending,onCreate:se,onSaveReferencedBlock:O,onBack:ve},M),e[44]=a,e[45]=c,e[46]=se,e[47]=r,e[48]=i,e[49]=s,e[50]=l,e[51]=k.isPending,e[52]=O,e[53]=M,e[54]=ie.editorTarget,e[55]=ie.initialValue,e[56]=o,e[57]=Ne):Ne=e[57],R=Ne;break e}J="flex h-full w-full min-w-0 flex-col";let ye;e[58]!==d?(ye=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=ye):ye=e[59];let pe;e[60]===Symbol.for("react.memo_cache_sentinel")?(pe=()=>h([]),e[60]=pe):pe=e[60];const ke=m.length===0?"font-medium text-foreground":"text-muted-foreground";let he;e[61]!==ke?(he=ge("min-w-0 truncate classic:rounded-md compact:rounded-lg px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",ke),e[61]=ke,e[62]=he):he=e[62];const je=kr[r];let Se;e[63]!==he||e[64]!==je?(Se=t.jsx("button",{type:"button",onClick:pe,className:he,children:je}),e[63]=he,e[64]=je,e[65]=Se):Se=e[65];let Ae;e[66]!==m?(Ae=m.map((M,ve)=>{const Ne=ve===m.length-1;return t.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[t.jsx(Bt,{className:"size-3 shrink-0 text-muted-foreground/60"}),t.jsx("button",{type:"button",onClick:()=>h(m.slice(0,ve+1)),className:ge("min-w-0 truncate classic:rounded-md compact:rounded-lg px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",Ne?"font-medium text-foreground":"text-muted-foreground"),children:$t(M,ve)})]},`${M}-${ve}`)}),e[66]=m,e[67]=Ae):Ae=e[67];let Ce;e[68]!==ye||e[69]!==Se||e[70]!==Ae?(Ce=t.jsxs("nav",{"aria-label":ye,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[Se,Ae]}),e[68]=ye,e[69]=Se,e[70]=Ae,e[71]=Ce):Ce=e[71];let Pe;e[72]===Symbol.for("react.memo_cache_sentinel")?(Pe=t.jsx(Bn,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=Pe):Pe=e[72];let De;e[73]===Symbol.for("react.memo_cache_sentinel")?(De=M=>x(M.target.value),e[73]=De):De=e[73];let xe;e[74]!==r||e[75]!==d?(xe=d("sandbox.runnableBlocksBrowser.searchPlaceholder",{kind:r}),e[74]=r,e[75]=d,e[76]=xe):xe=e[76];let $e;e[77]!==r||e[78]!==d?($e=d("sandbox.runnableBlocksBrowser.searchAriaLabel",{kind:r}),e[77]=r,e[78]=d,e[79]=$e):$e=e[79];let Le;e[80]!==g||e[81]!==xe||e[82]!==$e?(Le=t.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[Pe,t.jsx("input",{type:"text",value:g,onChange:De,placeholder:xe,"aria-label":$e,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[80]=g,e[81]=xe,e[82]=$e,e[83]=Le):Le=e[83],e[84]!==Ce||e[85]!==Le?(A=t.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[Ce,Le]}),e[84]=Ce,e[85]=Le,e[86]=A):A=e[86],_=Qt,z="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",I="mx-auto w-full max-w-4xl px-6 py-5",V=ce?ne.length===0?t.jsx(st,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:r,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):t.jsx("div",{className:"flex flex-col gap-1",children:ne.map(M=>t.jsx(He,{icon:F,accent:M.savedKey!==void 0?"global":void 0,title:M.title,subtitle:M.resolveType,active:!1,onClick:()=>oe(M)},M.savedKey??M.resolveType))}):W.length===0&&te.length===0&&le.length===0?t.jsx(st,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:r}),description:m.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):t.jsxs(t.Fragment,{children:[W.length>0&&t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:W.map(M=>{const ve=Nr(M.name,m.length);return t.jsxs("button",{type:"button",onClick:()=>h([...m,M.name]),className:"flex items-center gap-2.5 rounded-lg border px-3 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[t.jsx(ve,{size:18,className:"shrink-0 text-muted-foreground"}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-sm font-medium",children:$t(M.name,m.length)}),t.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[M.count," ",M.count===1?K:r,M.savedCount>0&&t.jsxs(t.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:M.savedCount})]})]})]})]},M.name)})}),(te.length>0||le.length>0)&&t.jsxs("div",{className:ge("flex flex-col gap-1",W.length>0&&"mt-4"),children:[te.map(M=>{const ve=re.get(M.resolveType)??[],Ne=y.has(M.resolveType);return t.jsxs("div",{className:"flex flex-col",children:[t.jsx(He,{icon:F,title:M.title,subtitle:M.resolveType,active:!1,onClick:()=>oe(M)}),ve.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",onClick:()=>E(M.resolveType),"aria-expanded":Ne,className:"flex items-center gap-1 self-start classic:rounded-md compact:rounded-lg px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:Ns},children:[Ne?t.jsx(ht,{size:12,className:"shrink-0"}):t.jsx(Bt,{size:12,className:"shrink-0"}),d(Ne?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",ve.length,")"]}),Ne&&t.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:ve.map(Oe=>t.jsx(He,{icon:F,accent:"global",title:Oe.title,subtitle:Oe.resolveType,active:!1,onClick:()=>oe(Oe)},Oe.savedKey))})]})]},M.resolveType)}),le.map(M=>t.jsx(He,{icon:F,accent:"global",title:M.title,subtitle:M.resolveType,active:!1,onClick:()=>oe(M)},M.savedKey))]})]})}e[10]=F,e[11]=a,e[12]=c,e[13]=r,e[14]=i,e[15]=y,e[16]=s,e[17]=m,e[18]=l,e[19]=k,e[20]=O,e[21]=g,e[22]=u,e[23]=K,e[24]=d,e[25]=o,e[26]=_,e[27]=A,e[28]=R,e[29]=I,e[30]=V,e[31]=z,e[32]=J}else _=e[26],A=e[27],R=e[28],I=e[29],V=e[30],z=e[31],J=e[32];if(R!==Symbol.for("react.early_return_sentinel"))return R;let P;e[87]!==I||e[88]!==V?(P=t.jsx("div",{className:I,children:V}),e[87]=I,e[88]=V,e[89]=P):P=e[89];let G;e[90]!==_||e[91]!==P||e[92]!==z?(G=t.jsx(_,{className:z,children:P}),e[90]=_,e[91]=P,e[92]=z,e[93]=G):G=e[93];let Y;return e[94]!==A||e[95]!==G||e[96]!==J?(Y=t.jsxs("div",{className:J,children:[A,G]}),e[94]=A,e[95]=G,e[96]=J,e[97]=Y):Y=e[97],Y}function Cr(n){const[e,s]=n;return{name:e,...s}}function Pr(n,e){return n.title.localeCompare(e.title)}function Tr(n){const[,e]=n;return e}function Br(n,e){return n.title.localeCompare(e.title)}function Er(n,e){return n.title.localeCompare(e.title)}function _r(n){return{resolveType:n.resolveType,title:n.title,folderPath:An(n.resolveType)}}function Dr(n){return{resolveType:n.resolveType,title:n.title,folderPath:An(n.resolveType),savedKey:n.key}}function Ar(){return new Set}function $r(n,e){if(!n)return null;if(n.mode==="available")return{mode:"available",resolveType:n.resolveType,editorTarget:{mode:"available",resolveType:n.resolveType,title:n.title},initialValue:{}};const{resolveType:s,props:o,title:a}=la(e,n.key);return{mode:"saved",blockKey:n.key,resolveType:s,editorTarget:{mode:"saved",blockKey:n.key,resolveType:s,title:a},initialValue:o}}function Lr(n){const e=ae.c(106),{orgSlug:s,virtualMcpId:o,branch:a,previewUrl:l,meta:i,decofile:c,resolveType:r,title:d,defaultBlockId:p,isCreating:m,onCreate:h,onSaveReferencedBlock:u}=n,f=we(),g=Et(),x=g?.virtualMcpId,v=Mn(x===o?o:null)?.metadata?.siteSlug??null;let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j={},e[0]=j):j=e[0];const[N,w]=$.useState(j);let E;e[1]===Symbol.for("react.memo_cache_sentinel")?(E=[],e[1]=E):E=e[1];const[B,k]=$.useState(E),[D,O]=$.useState(0),[L,K]=$.useState(!1);let F;e[2]!==i||e[3]!==r?(F=ks(r,i),e[2]=i,e[3]=r,e[4]=F):F=e[4];const _=F;let A,R,I,V,z,J,P,G;if(e[5]!==v||e[6]!==a||e[7]!==c||e[8]!==B||e[9]!==N||e[10]!==m||e[11]!==h||e[12]!==s||e[13]!==l||e[14]!==r||e[15]!==f||e[16]!==g?.taskId||e[17]!==d||e[18]!==o){const te=r.split("/").pop()?.replace(/\.tsx?$/,"")??r,re=g?.taskId??null,le=l??void 0;let C;e[27]!==v||e[28]!==a||e[29]!==s||e[30]!==le||e[31]!==re||e[32]!==o?(C={orgSlug:s,virtualMcpId:o,branch:a,threadId:re,previewUrl:le,siteSlug:v},e[27]=v,e[28]=a,e[29]=s,e[30]=le,e[31]=re,e[32]=o,e[33]=C):C=e[33],R=C;let W,Z,oe,S;if(e[34]!==c||e[35]!==B||e[36]!==N||e[37]!==h||e[38]!==f||e[39]!==d){const Se=[d,...B],Ae=Pe=>{k(B.slice(0,Pe)),O(Or)};let Ce;e[48]!==c||e[49]!==N||e[50]!==h?(Ce=async Pe=>{const De=da(Pe,c);if(De){me.error(De);return}await h(Pe,N),K(!1)},e[48]=c,e[49]=N,e[50]=h,e[51]=Ce):Ce=e[51],A=Ce,G="flex h-full w-full min-w-0",P="flex min-w-0 flex-1 flex-col",z="shrink-0 border-b px-3 py-2.5",S="flex min-w-0 items-center gap-2 overflow-hidden",e[52]!==f?(W=f("sandbox.availableSectionEditor.editingBreadcrumb"),e[52]=f,e[53]=W):W=e[53],Z="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",oe=Se.map((Pe,De)=>{const xe=De===Se.length-1,$e=ca(Pe);return t.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[De>0&&t.jsx(Bt,{className:"size-3 shrink-0 text-muted-foreground/60"}),t.jsx("button",{type:"button",onClick:()=>Ae(De),title:$e,className:ge("min-w-0 truncate classic:rounded-md compact:rounded-lg px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",xe?"font-medium text-foreground":"text-muted-foreground"),children:$e})]},`${$e}-${De}`)}),e[34]=c,e[35]=B,e[36]=N,e[37]=h,e[38]=f,e[39]=d,e[40]=A,e[41]=W,e[42]=Z,e[43]=oe,e[44]=S,e[45]=z,e[46]=P,e[47]=G}else A=e[40],W=e[41],Z=e[42],oe=e[43],S=e[44],z=e[45],P=e[46],G=e[47];let se;e[54]!==W||e[55]!==Z||e[56]!==oe?(se=t.jsx("nav",{"aria-label":W,className:Z,children:oe}),e[54]=W,e[55]=Z,e[56]=oe,e[57]=se):se=e[57];let H;e[58]===Symbol.for("react.memo_cache_sentinel")?(H=()=>K(!0),e[58]=H):H=e[58];let ie;e[59]!==f?(ie=f("sandbox.availableSectionEditor.saveAsGlobalSection"),e[59]=f,e[60]=ie):ie=e[60];let ye;e[61]===Symbol.for("react.memo_cache_sentinel")?(ye=t.jsx(Vo,{size:14}),e[61]=ye):ye=e[61];let pe;e[62]!==m||e[63]!==ie?(pe=t.jsx(Ye,{asChild:!0,children:t.jsx(Be,{size:"icon",className:"size-8 shrink-0",disabled:m,onClick:H,"aria-label":ie,children:ye})}),e[62]=m,e[63]=ie,e[64]=pe):pe=e[64];let ke;e[65]!==f?(ke=f("sandbox.availableSectionEditor.saveAsGlobalSection"),e[65]=f,e[66]=ke):ke=e[66];let he;e[67]!==ke?(he=t.jsx(Qe,{side:"bottom",children:ke}),e[67]=ke,e[68]=he):he=e[68];let je;e[69]!==pe||e[70]!==he?(je=t.jsxs(Xe,{children:[pe,he]}),e[69]=pe,e[70]=he,e[71]=je):je=e[71],e[72]!==S||e[73]!==se||e[74]!==je?(J=t.jsxs("div",{className:S,children:[se,je]}),e[72]=S,e[73]=se,e[74]=je,e[75]=J):J=e[75],I="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",V=f("sandbox.availableSectionEditor.localEditsHint",{typeLabel:te}),e[5]=v,e[6]=a,e[7]=c,e[8]=B,e[9]=N,e[10]=m,e[11]=h,e[12]=s,e[13]=l,e[14]=r,e[15]=f,e[16]=g?.taskId,e[17]=d,e[18]=o,e[19]=A,e[20]=R,e[21]=I,e[22]=V,e[23]=z,e[24]=J,e[25]=P,e[26]=G}else A=e[19],R=e[20],I=e[21],V=e[22],z=e[23],J=e[24],P=e[25],G=e[26];let Y;e[76]!==I||e[77]!==V?(Y=t.jsx("p",{className:I,children:V}),e[76]=I,e[77]=V,e[78]=Y):Y=e[78];let q;e[79]!==Y||e[80]!==z||e[81]!==J?(q=t.jsxs("div",{className:z,children:[J,Y]}),e[79]=Y,e[80]=z,e[81]=J,e[82]=q):q=e[82];let X;e[83]!==c||e[84]!==B||e[85]!==D||e[86]!==N||e[87]!==i||e[88]!==u||e[89]!==R||e[90]!==_||e[91]!==f?(X=t.jsx(Qt,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:t.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:t.jsx("div",{className:"mx-auto max-w-2xl",children:_?t.jsx(Ln,{schema:_,value:N,onChange:te=>w(te),basePath:"",breadcrumbPath:B,onBreadcrumbChange:k,meta:i,decofile:c,onSaveReferencedBlock:u,sandbox:R},D):t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sandbox.availableSectionEditor.noEditableFields")})})})}),e[83]=c,e[84]=B,e[85]=D,e[86]=N,e[87]=i,e[88]=u,e[89]=R,e[90]=_,e[91]=f,e[92]=X):X=e[92];let ce;e[93]!==q||e[94]!==X||e[95]!==P?(ce=t.jsxs("div",{className:P,children:[q,X]}),e[93]=q,e[94]=X,e[95]=P,e[96]=ce):ce=e[96];let ne;e[97]!==p||e[98]!==A||e[99]!==m||e[100]!==L?(ne=t.jsx(ua,{open:L,onOpenChange:K,defaultBlockId:p,isPending:m,onSubmit:A}),e[97]=p,e[98]=A,e[99]=m,e[100]=L,e[101]=ne):ne=e[101];let de;return e[102]!==ce||e[103]!==ne||e[104]!==G?(de=t.jsxs("div",{className:G,children:[ce,ne]}),e[102]=ce,e[103]=ne,e[104]=G,e[105]=de):de=e[105],de}function Or(n){return n+1}function Rr(n,e){const s={__resolveType:n},o=pa([s],e)[0];return o?ha(s,o,e):null}function Ir({orgSlug:n,virtualMcpId:e,branch:s,previewUrl:o,meta:a,decofile:l,blockKey:i,onSaveReferencedBlock:c}){const r=we(),d=Et(),p=d?.virtualMcpId,h=Mn(p===e?e:null)?.metadata?.siteSlug??null,[u]=$.useState(()=>Rr(i,l)),[f,g]=$.useState(u?.data??{}),[x,y]=$.useState([]),[v,j]=$.useState(0),[N,w]=$.useState(!1),[E,B]=$.useState(null),k=E!==null,{save:D,flush:O}=ma({orgSlug:n,virtualMcpId:e,branch:s}),L=u?.resolveType?ks(u.resolveType,a):null,K=l[i],F=K?Ca(i,K):i,_=d?.taskId??null,A={orgSlug:n,virtualMcpId:e,branch:s,threadId:_,previewUrl:o??void 0,siteSlug:h},R=P=>{g(P),D(i,P)},I=()=>{k?(B(null),w(!1),j(P=>P+1)):B(JSON.stringify(f,null,2))},V=P=>{const G=P??"";try{const Y=JSON.parse(G);if(Y&&typeof Y=="object"&&!Array.isArray(Y)){w(!1),R(Y);return}w(!0)}catch{w(!0)}},z=[F,...x],J=P=>{y(x.slice(0,P)),j(G=>G+1)};return t.jsx("div",{className:"flex h-full w-full min-w-0",children:t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsx(fa,{crumbs:z,onSelect:J}),t.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[t.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:Ns},"aria-hidden":!0}),t.jsx("div",{className:"flex-1"}),t.jsxs(Xe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsx(Be,{variant:k?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:I,"aria-label":r(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":k,children:k?t.jsx(Cs,{size:14}):t.jsx(Cn,{size:14})})}),t.jsx(Qe,{side:"bottom",children:r(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),t.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:r("sandbox.savedSectionEditor.globalSectionDescription")})]}),t.jsxs("div",{className:"relative min-h-0 flex-1",children:[t.jsx(Qt,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:t.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:t.jsx("div",{className:"mx-auto max-w-2xl",children:L?t.jsx(Ln,{schema:L,value:f,onChange:P=>R(P),basePath:"",breadcrumbPath:x,onBreadcrumbChange:y,meta:a,decofile:l,onSaveReferencedBlock:c,sandbox:A},v):t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("sandbox.savedSectionEditor.noEditableFields")})})})}),E!==null&&t.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[N&&t.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:r("sandbox.savedSectionEditor.invalidJsonError")}),t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(Vn,{language:"json",height:"100%",code:E,onChange:V,onSave:P=>{V(P),O()}})})]})]})]})})}function Fr(n){const e=ae.c(36),{selection:s,orgSlug:o,virtualMcpId:a,branch:l,previewUrl:i,meta:c,decofile:r,isCreating:d,onCreateAvailable:p,onSaveReferencedBlock:m}=n,h=we();if(!s){let g;e[0]!==h?(g=h("sandbox.sectionsRightPane.selectSectionTitle"),e[0]=h,e[1]=g):g=e[1];let x;e[2]!==h?(x=h("sandbox.sectionsRightPane.selectSectionDescription"),e[2]=h,e[3]=x):x=e[3];let y;return e[4]!==g||e[5]!==x?(y=t.jsx(st,{title:g,description:x}),e[4]=g,e[5]=x,e[6]=y):y=e[6],y}if(s.collection==="available-section"){const g=`available:${s.resolveType}`,x=s.resolveType,y=s.title;let v;e[7]!==s.title?(v=xa(s.title),e[7]=s.title,e[8]=v):v=e[8];let j;e[9]!==p||e[10]!==s.resolveType?(j=(w,E)=>p(s.resolveType,w,E),e[9]=p,e[10]=s.resolveType,e[11]=j):j=e[11];let N;return e[12]!==l||e[13]!==r||e[14]!==d||e[15]!==c||e[16]!==m||e[17]!==o||e[18]!==i||e[19]!==s.resolveType||e[20]!==s.title||e[21]!==g||e[22]!==v||e[23]!==j||e[24]!==a?(N=t.jsx(Lr,{orgSlug:o,virtualMcpId:a,branch:l,previewUrl:i,meta:c,decofile:r,resolveType:x,title:y,defaultBlockId:v,isCreating:d,onCreate:j,onSaveReferencedBlock:m},g),e[12]=l,e[13]=r,e[14]=d,e[15]=c,e[16]=m,e[17]=o,e[18]=i,e[19]=s.resolveType,e[20]=s.title,e[21]=g,e[22]=v,e[23]=j,e[24]=a,e[25]=N):N=e[25],N}const u=`saved:${s.key}`;let f;return e[26]!==l||e[27]!==r||e[28]!==c||e[29]!==m||e[30]!==o||e[31]!==i||e[32]!==s.key||e[33]!==u||e[34]!==a?(f=t.jsx(Ir,{orgSlug:o,virtualMcpId:a,branch:l,previewUrl:i,meta:c,decofile:r,blockKey:s.key,onSaveReferencedBlock:m},u),e[26]=l,e[27]=r,e[28]=c,e[29]=m,e[30]=o,e[31]=i,e[32]=s.key,e[33]=u,e[34]=a,e[35]=f):f=e[35],f}function Lt(n){const e=ae.c(34),{onDuplicate:s,onRename:o,onAddVariant:a,onEditSeo:l,onViewJson:i,onDelete:c}=n,r=we();let d;e[0]!==r?(d=r("sandbox.itemActions.moreActions"),e[0]=r,e[1]=d):d=e[1];let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Bo,{size:14}),e[2]=p):p=e[2];let m;e[3]!==d?(m=t.jsx(Ft,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center classic:rounded-md compact:rounded-lg text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:Kr,children:p})}),e[3]=d,e[4]=m):m=e[4];let h;e[5]!==o||e[6]!==r?(h=o&&t.jsxs(Je,{onClick:o,children:[t.jsx(nl,{size:14}),r("sandbox.itemActions.rename")]}),e[5]=o,e[6]=r,e[7]=h):h=e[7];let u;e[8]!==s||e[9]!==r?(u=s&&t.jsxs(Je,{onClick:s,children:[t.jsx(sl,{size:14}),r("sandbox.itemActions.duplicate")]}),e[8]=s,e[9]=r,e[10]=u):u=e[10];let f;e[11]!==a||e[12]!==r?(f=a&&t.jsxs(t.Fragment,{children:[t.jsx(cs,{}),t.jsxs(Je,{onClick:a,className:"cursor-pointer text-success focus:text-success",children:[t.jsx(wn,{size:14}),r("sandbox.itemActions.addVariant")]})]}),e[11]=a,e[12]=r,e[13]=f):f=e[13];let g;e[14]!==l||e[15]!==i||e[16]!==r?(g=(l||i)&&t.jsxs(t.Fragment,{children:[t.jsx(cs,{}),l&&t.jsxs(Je,{onClick:l,children:[t.jsx(Sn,{size:14}),r("sandbox.itemActions.editSeo")]}),i&&t.jsxs(Je,{onClick:i,children:[t.jsx(Cn,{size:14}),r("sandbox.itemActions.viewJson")]})]}),e[14]=l,e[15]=i,e[16]=r,e[17]=g):g=e[17];let x;e[18]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(cs,{}),e[18]=x):x=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(ws,{size:14}),e[19]=y):y=e[19];let v;e[20]!==r?(v=r("sandbox.itemActions.delete"),e[20]=r,e[21]=v):v=e[21];let j;e[22]!==c||e[23]!==v?(j=t.jsxs(Je,{onClick:c,className:"text-destructive focus:text-destructive",children:[y,v]}),e[22]=c,e[23]=v,e[24]=j):j=e[24];let N;e[25]!==j||e[26]!==h||e[27]!==u||e[28]!==f||e[29]!==g?(N=t.jsxs(Kt,{align:"end",className:"w-44",children:[h,u,f,g,x,j]}),e[25]=j,e[26]=h,e[27]=u,e[28]=f,e[29]=g,e[30]=N):N=e[30];let w;return e[31]!==N||e[32]!==m?(w=t.jsxs(zt,{children:[m,N]}),e[31]=N,e[32]=m,e[33]=w):w=e[33],w}function Kr(n){return n.stopPropagation()}function zr(n){return n.split("/").pop()?.replace(/\.tsx?$/,"")||n||"Section"}function Mr(n){const e=new Map;for(const s of n){const o=zr(s.resolveType),a=e.get(o);a?a.push(s):e.set(o,[s])}return[...e.entries()].map(([s,o])=>({label:s,sections:o})).sort((s,o)=>s.label.localeCompare(o.label))}function mn(n){const e=ae.c(8),{icon:s,label:o,className:a}=n;let l;e[0]!==a?(l=ge("flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",a),e[0]=a,e[1]=l):l=e[1];let i;e[2]!==s?(i=t.jsx(s,{size:13,className:"shrink-0"}),e[2]=s,e[3]=i):i=e[3];let c;return e[4]!==o||e[5]!==l||e[6]!==i?(c=t.jsxs("div",{className:l,children:[i,o]}),e[4]=o,e[5]=l,e[6]=i,e[7]=c):c=e[7],c}const fn=$.lazy(()=>qe(()=>import("./app-editor-QZzUFuF6.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,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179])).then(n=>({default:n.AppEditor}))),Vr=$.lazy(()=>qe(()=>import("./post-editor-toOl1XPu.js"),__vite__mapDeps([180,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,33,32,34,35,36,37,38,39,40,41,27,28,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,68,107,181,165,144,87,88,67,110,122,117,115,72,71,69,73,74,75,76,77,78,79,80,81,82,83,26,84,85,86,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,108,109,111,24,25,112,113,114,116,118,119,120,121,123,124,125,126,127,128,129,130,131,182,148,70,183,184,185,132,133,134,135,136,137,138,139,140,141,142,143,145,146,147,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,166,167,168,169,170,171,172,173,174,175,176,177,178,179])).then(n=>({default:n.PostEditor}))),Ur=$.lazy(()=>qe(()=>import("./record-editor-BsPd7bUQ.js"),__vite__mapDeps([186,1,2,68,107,25,26,27,28,115,72,71,12,13,3,4,5,6,7,8,9,10,11,14,15,16,17,18,19,20,21,22,23,69,32,33,34,35,36,37,38,39,40,41,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,73,74,75,76,77,78,79,80,67,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,108,109,110,111,24,112,113,114,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,185,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179])).then(n=>({default:n.RecordEditor}))),Gr=$.lazy(()=>qe(()=>import("./context-BZ4dlasJ.js"),__vite__mapDeps([187,1,2,28,32,33,34,35,36,37,38,39,40,41,27,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,68,107,115,110,20,188,105,98,67,106,100,81,82,4,5,6,7,8,9,10,83,26,148,183,116,80,85,87,88,189,152,149,72,71,12,13,3,11,14,15,16,17,18,19,21,22,23,69,73,74,75,76,77,78,79,84,86,89,90,91,92,93,94,95,96,97,99,101,102,103,104,108,109,111,24,25,112,113,114,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,174,185,186,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,150,151,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,175,176,177,178,179,190,182,70,184])).then(n=>({default:n.BlogContext}))),Hr=$.lazy(()=>qe(()=>import("./category-editor-p_MZjxaR.js"),__vite__mapDeps([190,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,37,39,52,32,33,34,35,36,38,40,41,27,28,30,42,43,44,45,46,31,47,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,66,119,68,107,182,116,87,88,67,110,72,71,69,73,74,75,76,77,78,79,80,81,82,83,26,84,85,86,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,108,109,111,24,25,112,113,114,115,117,118,120,121,122,123,124,125,126,127,128,129,130,131,148,70,183,184,185,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179])).then(n=>({default:n.CategoryEditor}))),qr=$.lazy(()=>qe(()=>import("./sections-editor-Ci2hLb6p.js"),__vite__mapDeps([191,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,72,71,69,32,33,34,35,36,37,38,39,40,41,27,28,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,73,74,75,76,77,78,79,80,67,81,82,83,26,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,68,108,109,110,111,24,25,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,174,192,29,70,193])).then(n=>({default:n.SectionsEditor}))),Wr=$.lazy(()=>qe(()=>import("./seo-editor-CDb27yK8.js"),__vite__mapDeps([194,1,2,32,33,34,35,36,37,38,39,40,41,27,28,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,24,25,26,72,71,12,13,3,4,5,6,7,8,9,10,11,14,15,16,17,18,19,20,21,22,23,69,73,74,75,76,77,78,79,80,67,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,68,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,192])).then(n=>({default:n.SeoEditor}))),Jr=$.lazy(()=>qe(()=>import("./variant-calendar-BVfa1Hpt.js"),__vite__mapDeps([195,1,2,32,33,34,35,36,37,38,39,40,41,27,28,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,107,24,25,26,117,83,196,132,133,134,102,8,9,135,7,96,100,6,10,136,3,4,5,11,12,13,14,15,16,17,18,19,20,21,22,23,98,67,137,138,82,104,105,106,68,81,139,84,85,86,87,88,89,90,91,92,93,140,71,79,78,80,75,76,122,141,129,99,142,143,144,145,110,146,147,148,149,150,151,152,153,154,155,156,157,158,159,126,127,160,115,161,162,163,164,165,166,167,74,77,94,95,97,101,103,108,109,168,120,73,169,170,128,124,171,172,173,119,72,69,111,112,113,114,116,118,121,123,125,130,131,174,175,176,177,178,179])).then(n=>({default:n.VariantCalendar}))),Yr=$.lazy(()=>qe(()=>import("./post-calendar-90hRn09B.js"),__vite__mapDeps([197,1,2,33,32,34,35,36,37,38,39,40,41,27,28,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,198,24,25,26,132,133,134,102,8,9,135,7,96,100,6,10,136,3,4,5,11,12,13,14,15,16,17,18,19,20,21,22,23,98,83,67,137,138,82,104,105,106,107,68,81,139,84,85,86,87,88,89,90,91,92,93,140,71,79,78,80,75,76,122,141,129,99,142,143,144,145,110,146,147,148,149,150,151,152,153,154,155,156,157,158,159,126,127,160,115,161,162,163,164,165,166,167,74,77,94,95,97,101,103,108,109,168,120,73,169,170,128,124,171,172,173,119,72,69,111,112,113,114,116,117,118,121,123,125,130,131,174,175,176,177,178,179])).then(n=>({default:n.PostCalendar}))),Qr=$.lazy(()=>qe(()=>import("./redirect-editor-Q-scXYpH.js"),__vite__mapDeps([199,1,2,144,27,68,107,25,26,28,72,71,12,13,3,4,5,6,7,8,9,10,11,14,15,16,17,18,19,20,21,22,23,69,32,33,34,35,36,37,38,39,40,41,30,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,73,74,75,76,77,78,79,80,67,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,108,109,110,111,24,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,185])).then(n=>({default:n.RedirectEditor})));function Xr(n){const e=ae.c(20),{deepLinkPage:s}=n,{currentBranch:o,virtualMcpId:a}=bn(),{org:l}=Eo(),i=Ia(),c=Fa(),{runtime:r,previewServerUrl:d}=Kn(a),p=r==="cms";let m;e[0]!==p||e[1]!==c.previewState||e[2]!==i.lifecycle.phase?(m=Nl({fastPreviewActive:p,previewState:c.previewState,lifecyclePhase:i.lifecycle.phase}),e[0]=p,e[1]=c.previewState,e[2]=i.lifecycle.phase,e[3]=m):m=e[3];const h=m;if(h.kind==="sandbox-card"){const g=`/${l.slug}/settings/connections`;let x;return e[4]!==h.state||e[5]!==c.start||e[6]!==g||e[7]!==i.lifecycle||e[8]!==i.phase?(x=t.jsx(kl,{state:h.state,claimPhase:i.phase,lifecycle:i.lifecycle,onStart:c.start,connectionsHref:g}),e[4]=h.state,e[5]=c.start,e[6]=g,e[7]=i.lifecycle,e[8]=i.phase,e[9]=x):x=e[9],x}if(!a||!o){let g;return e[10]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(st,{title:"Waiting for sandbox context…"}),e[10]=g):g=e[10],g}const u=p?d:c.previewUrl;let f;return e[11]!==o||e[12]!==s||e[13]!==h.devServerReady||e[14]!==h.sandboxWarming||e[15]!==c.previewUrl||e[16]!==l.slug||e[17]!==u||e[18]!==a?(f=t.jsx(ec,{orgSlug:l.slug,virtualMcpId:a,branch:o,previewUrl:c.previewUrl,sitePreviewUrl:u,deepLinkPage:s,devServerReady:h.devServerReady,sandboxWarming:h.sandboxWarming}),e[11]=o,e[12]=s,e[13]=h.devServerReady,e[14]=h.sandboxWarming,e[15]=c.previewUrl,e[16]=l.slug,e[17]=u,e[18]=a,e[19]=f):f=e[19],f}const pn=2e3,Zr=15;function hn(n,e,s,o){return typeof e!="string"||s&&(Un(e,s,o)||n.state.dataUpdateCount>=Zr)?!1:pn}function ec({orgSlug:n,virtualMcpId:e,branch:s,previewUrl:o,sitePreviewUrl:a,deepLinkPage:l,devServerReady:i,sandboxWarming:c}){const r=we(),d=Et()?.taskId??null,p={orgSlug:n,virtualMcpId:e,branch:s,threadId:d,previewUrl:o},{data:m,isLoading:h}=ga(p,{fetchEnabled:i}),u=gn({strict:!1}),[f,g]=$.useState(()=>u.contentCollection&<(u.contentCollection)&&u.contentCollection||"pages"),[x,y]=$.useState(()=>u.contentItem&<(f)?{collection:f,key:u.contentItem}:null),[v,j]=$.useState(null),N=!!(l?.pageId||l?.path||l?.pathTemplate),[w,E]=$.useState(!1);if(N&&!w&&x===null&&m){E(!0);const b=Pa(Ks(m),l??{});b&&(g("pages"),y({collection:"pages",key:b.key,path:b.path}))}const[B,k]=$.useState(""),[D,O]=$.useState("board"),L=b=>{y(b),j(null)},[K,F]=$.useState(f);K!==f&&(F(f),k(""));const{data:_,isLoading:A,isFetching:R}=ba(p,{fetchEnabled:i,refetchInterval:b=>{const U=b.state.data;if(f==="apps"&&x&&x.collection==="apps"){const ue=m?.[x.key];return hn(b,typeof ue?.__resolveType=="string"?ue.__resolveType:void 0,U)}if(f==="site"&&m){const ue=U?zs(m,U):null,fe=m.site,_e=ue?.resolveType??(typeof fe?.__resolveType=="string"?fe.__resolveType:void 0);return hn(b,_e,U,["seo"])}return!1}}),I=(b,U)=>!Un(b,_,U)&&(A||R),{catalog:V,isLoading:z}=bl(_??void 0,m??void 0,{enabled:f==="apps"}),J=Bi({orgSlug:n,virtualMcpId:e,branch:s,meta:_}),P=Xt(p),G=In(p),Y=Di({orgSlug:n,virtualMcpId:e,branch:s,decofile:m??{},support:J,onMoved:(b,U)=>y(ue=>ue?.collection==="posts"&&ue.key===b?{collection:"posts",key:U}:ue)}),[q,X]=$.useState(null),[ce,ne]=$.useState(),[de,te]=$.useState(!1),[re,le]=$.useState(),[C,W]=$.useState(null),[Z,oe]=$.useState(null),[S,se]=$.useState(null),H=!m||!_;if(h||A||H&&c)return t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:t.jsx(rt,{className:"size-5 text-muted-foreground"})});if(H)return t.jsx(st,{title:"Could not load site data."});const ie=Ks(m).sort((b,U)=>b.name.localeCompare(U.name)),ye=Ta(m).sort((b,U)=>b.from.localeCompare(U.from)),pe=Ba(m,_),ke=f==="sections"?Ea(_):[],he=zs(m,_),je=Jn(m),Se=Ps.some(b=>je[b].length>0),Ae=lt(f)?je[f]:[],Ce=Fs(_,"loaders"),Pe=Fs(_,"actions");if(!_a(m,_)&&!Se&&Ce===0&&Pe===0)return t.jsx(st,{icon:Yt,title:"No editable content",description:"This project doesn't expose any Deco pages, sections, apps, loaders, or actions."});const De={pages:ie.length,sections:pe.length,apps:V.length,loaders:Ce,actions:Pe,redirects:ye.length,posts:je.posts.length,authors:je.authors.length,categories:je.categories.length},xe=new Set(ie.map(b=>Ot(b.path))),$e=new Set(ie.map(b=>b.name)),Le=new Set(pe.map(b=>b.name)),M=async b=>{const U=m[b.key];if(!U)return;const ue=On(m,b.key),fe=ya(m,b.key,Math.max(0,ue-1)),_e=va(U.sections,fe);if(_e)try{await P.mutateAsync({blockKey:b.key,data:{...U,sections:_e}}),me.success(`Variant added to "${b.name}"`),y({collection:"pages",key:b.key,path:b.path})}catch(Re){me.error(Re instanceof Error?Re.message:"Could not add variant")}},ve=()=>{ne(void 0),X({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},Ne=b=>{ne(void 0),X({mode:"duplicate",sourceKey:b.key,initialName:Hs($e,b.name),initialPath:wl(xe,b.path)})},Oe=b=>{ne(void 0),X({mode:"rename",sourceKey:b.key,initialName:b.name,initialPath:b.path})},ns=async b=>{if(!q)return;const{mode:U,sourceKey:ue}=q;try{if(U==="create"){let fe;if(b.templateKey){const Re=m[b.templateKey];if(!Re)throw new Error("Selected template no longer exists.");fe={...Re,name:b.name,path:b.path}}else fe=Tl(b.name,b.path);const _e=El(m,b.name);await P.mutateAsync({blockKey:_e,data:fe}),me.success(`Created "${b.name}"`),y({collection:"pages",key:_e,path:b.path})}else if(U==="duplicate"&&ue){const fe=m[ue];if(!fe)throw new Error("Source page not found");const{key:_e,data:Re}=Pl({source:fe,pages:ie,newName:b.name,newPath:b.path});await P.mutateAsync({blockKey:_e,data:Re}),me.success(`Duplicated as "${b.name}"`),y({collection:"pages",key:_e,path:b.path})}else if(U==="rename"&&ue){const fe=m[ue];if(!fe)throw new Error("Page not found");const _e={...fe,name:b.name,path:b.path};await P.mutateAsync({blockKey:ue,data:_e}),me.success("Page updated"),x?.collection==="pages"&&x.key===ue&&y({collection:"pages",key:ue,path:b.path})}X(null)}catch(fe){ne(fe instanceof Error?fe.message:"Save failed")}},os=({path:b})=>{if(!q)return null;const U=Ot(b);return(q.mode==="rename"?Ot(q.initialPath):null)!==U&&xe.has(U)?`A page with path "${b}" already exists.`:null},as=async(b,U,ue)=>{await P.mutateAsync({blockKey:U,data:{...ue,name:U,__resolveType:b}}),me.success(r("sandbox.contentBrowser.createdSection",{name:U})),y({collection:"sections",key:U})},Dt=$n((b,U)=>P.mutate({blockKey:b,data:U})),ls=async b=>{const U=m[b.key];if(!U){me.error(r("sandbox.contentBrowser.sectionNotFound"));return}const ue=Cl(m,b.key),fe=Hs(Le,b.name),_e={...U,name:fe};try{await P.mutateAsync({blockKey:ue,data:_e}),me.success(r("sandbox.contentBrowser.duplicatedSection",{name:b.name})),y({collection:"sections",key:ue})}catch(Re){me.error(Re instanceof Error?Re.message:r("sandbox.contentBrowser.duplicateFailed"))}},is=async b=>{if(!C)return;const U=m[C];if(!U){me.error(r("sandbox.contentBrowser.sectionNotFound"));return}try{await P.mutateAsync({blockKey:C,data:{...U,name:b}}),me.success(r("sandbox.contentBrowser.sectionRenamed")),W(null)}catch(ue){me.error(ue instanceof Error?ue.message:r("sandbox.contentBrowser.renameFailed"))}},T=()=>{le(void 0),te(!0)},Q=async b=>{const U=Da(m,b.from),ue=Aa(b);try{await P.mutateAsync({blockKey:U,data:ue}),me.success("Created redirect"),te(!1),y({collection:"redirects",key:U})}catch(fe){le(fe instanceof Error?fe.message:"Could not create redirect")}},Te=async b=>{const U=ps(m,b),ue=it(U,b,so(b));try{await P.mutateAsync({blockKey:U,data:ue}),me.success(`Created ${Pt[b]}`),y({collection:b,key:U})}catch(fe){me.error(fe instanceof Error?fe.message:"Could not create")}},Ve=async b=>{const U=ps(m,"posts"),ue=it(U,"posts",vi(b));try{await P.mutateAsync({blockKey:U,data:ue}),me.success(r("sandbox.postCalendar.createdScheduledPost")),g("posts"),F("posts"),y({collection:"posts",key:U}),j(null)}catch(fe){me.error(fe instanceof Error?fe.message:r("sandbox.postCalendar.couldNotCreate"))}},We=async(b,U)=>{const ue=m[b],fe=ue?ki(mt(ue,"posts"),U):null;if(!fe){me.error(r("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await P.mutateAsync({blockKey:b,data:it(b,"posts",fe)})}catch(_e){me.error(_e instanceof Error?_e.message:r("sandbox.postCalendar.couldNotReschedule"))}},Ee=async b=>{const U=m[b.key];if(!U){me.error("Record not found.");return}const ue=ps(m,b.kind),fe=b.kind==="posts"?"title":"name",_e={...structuredClone(mt(U,b.kind)),[fe]:`${b.label} (copy)`};try{await P.mutateAsync({blockKey:ue,data:it(ue,b.kind,_e)}),me.success(`Duplicated "${b.label}"`),y({collection:b.kind,key:ue})}catch(Re){me.error(Re instanceof Error?Re.message:"Duplicate failed")}},yt=()=>{g("posts"),F("posts"),y(null),j(null),k("")},Ge=async()=>{if(Z)try{const{kind:b,key:U,label:ue}=Z;if(b==="blog"){if(Z.blogKind==="categories"){const fe=mt(m[U],"categories").slug,_e=typeof fe=="string"?fe:"";if(_e)for(const{key:Re,payload:$s}of Ue(m,"posts")){const Ls=Ql($s,_e);Ls!==$s&&await P.mutateAsync({blockKey:Re,data:it(Re,"posts",Xl(Ls))})}}await G.mutateAsync({blockKey:U})}else await G.mutateAsync({blockKey:U});me.success(`Deleted "${ue}"`),x&&x.collection!=="available-section"&&x.key===U&&y(null),oe(null)}catch(b){me.error(b instanceof Error?b.message:"Delete failed")}},at=G.isPending||P.isPending,rs=Z?.kind==="blog"?Pt[Z.blogKind]:Z?.kind??"item";return t.jsxs("div",{className:"flex h-full w-full",children:[t.jsx(vl,{active:f,counts:De,showBlog:Se,onSelect:b=>{g(b),y(null),j(null)}}),f!=="seo"&&f!=="site"&&f!=="context"&&f!=="calendar"&&f!=="post-schedule"&&f!=="posts"&&f!=="loaders"&&f!=="actions"&&t.jsx(tc,{activeCollection:f,pages:ie,redirects:ye,sections:pe,availableSections:ke,appCatalog:V,appCatalogLoading:z,blogEntries:Ae,decofile:m,searchQuery:B,onSearchChange:k,selection:x,onSelect:L,onCreate:()=>{f==="pages"?ve():f==="redirects"?T():lt(f)&&Te(f)},onDuplicatePage:Ne,onRenamePage:Oe,onAddPageVariant:M,onDeletePage:b=>oe({kind:"page",key:b.key,label:b.name}),onEditPageSeo:b=>{const U={collection:"pages",key:b.key,path:b.path};y(U),j(b.key)},onViewPageJson:b=>se(b.key),onDuplicateSection:ls,onRenameSection:b=>W(b.key),onDeleteSection:b=>oe({kind:"section",key:b.key,label:b.name}),onDeleteRedirect:b=>oe({kind:"redirect",key:b.key,label:b.from||b.key}),onDuplicateBlog:Ee,onDeleteBlog:b=>oe({kind:"blog",blogKind:b.kind,key:b.key,label:b.label})}),t.jsx("div",{className:"flex-1 min-w-0",children:f==="loaders"||f==="actions"?t.jsx(wr,{orgSlug:n,virtualMcpId:e,branch:s,previewUrl:o,meta:_,decofile:m,kind:f}):t.jsx($.Suspense,{fallback:t.jsx("div",{className:"h-full flex items-center justify-center",children:t.jsx(rt,{className:"size-5 text-muted-foreground"})}),children:f==="calendar"?t.jsx(Jr,{decofile:m}):f==="post-schedule"?t.jsx(Yr,{decofile:m,support:J,isCreating:P.isPending,onCreate:b=>{Ve(b)},onReschedule:(b,U)=>{We(b,U)},onSelect:b=>{g("posts"),F("posts"),y({collection:"posts",key:b}),j(null)}}):f==="site"?he?t.jsx(fn,{orgSlug:n,virtualMcpId:e,branch:s,blockKey:he.key,block:m[he.key],decofile:m,meta:_,title:"Site",excludeFields:["seo"],schemaPending:I(he.resolveType,["seo"]),previewBaseUrl:o},`site:${he.key}`):t.jsx(st,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):f==="context"?t.jsx(il,{title:r("sandbox.blogContext.soonTitle"),description:r("sandbox.blogContext.soonDescription"),children:t.jsx(Gr,{orgSlug:n,virtualMcpId:e,branch:s,decofile:m,meta:_,onOpenPost:b=>{g("posts"),F("posts"),y({collection:"posts",key:b}),j(null)},onManageCategoryPosts:()=>{g("posts"),F("posts"),y(null),j(null)}})}):f==="seo"?t.jsx(Wr,{orgSlug:n,virtualMcpId:e,branch:s,decofile:m,meta:_,target:{kind:"site"},previewBaseUrl:a}):f==="sections"?t.jsx(Fr,{selection:x?.collection==="sections"||x?.collection==="available-section"?x:null,orgSlug:n,virtualMcpId:e,branch:s,previewUrl:o,meta:_,decofile:m,isCreating:P.isPending,onCreateAvailable:as,onSaveReferencedBlock:Dt}):f==="posts"?t.jsx(hr,{orgSlug:n,virtualMcpId:e,branch:s,decofile:m,view:D,selectedKey:x?.collection==="posts"?x.key:null,onViewChange:b=>{O(b),y(null)},onClose:()=>y(null),onOpen:b=>{y({collection:"posts",key:b}),j(null)},move:Y,support:J,meta:_,renderDetail:(b,U)=>t.jsx(Vr,{orgSlug:n,virtualMcpId:e,branch:s,blockKey:b,block:m[b],decofile:m,meta:_,previewBaseUrl:a,move:Y,onClose:U?.onClose,expanded:U?.expanded,onToggleExpand:U?.onToggleExpand},`post:${Tt(b)}`)}):x&&x.collection!=="available-section"?x.collection==="apps"?t.jsx(fn,{orgSlug:n,virtualMcpId:e,branch:s,blockKey:x.key,block:m[x.key],decofile:m,meta:_,previewBaseUrl:o,schemaPending:I(typeof m[x.key]?.__resolveType=="string"?String(m[x.key].__resolveType):void 0)},`app:${x.key}`):x.collection==="categories"?t.jsx(Hr,{orgSlug:n,virtualMcpId:e,branch:s,blockKey:x.key,block:m[x.key],decofile:m,meta:_,onManagePosts:()=>yt(),onOpenPost:b=>{g("posts"),F("posts"),y({collection:"posts",key:b}),j(null)},previewBaseUrl:a},`category:${x.key}`):x.collection==="authors"?t.jsx(Ur,{orgSlug:n,virtualMcpId:e,branch:s,kind:"authors",blockKey:x.key,block:m[x.key]},`authors:${x.key}`):x.collection==="redirects"?t.jsx(Qr,{orgSlug:n,virtualMcpId:e,branch:s,blockKey:x.key,block:m[x.key]},`redirect:${x.key}`):t.jsx(qr,{orgSlug:n,virtualMcpId:e,branch:s,previewReady:!0,previewUrl:o??void 0,currentPath:x.collection==="pages"?x.path:"/",activePageBlockKey:x.collection==="pages"?x.key:null,activeGlobalBlockKey:x.collection==="sections"?x.key:null,initialEditSeo:x.collection==="pages"&&v===x.key,onExitSeo:()=>j(null),onSelectRoot:()=>{y(null),j(null)}},x.collection==="pages"?`page:${x.key}`:`section:${x.key}`):t.jsx(st,{title:`Select ${lt(f)?`a ${Pt[f]}`:f==="pages"?"a page":f==="apps"?"an app":f==="redirects"?"a redirect":"a section"} to edit`,description:f==="apps"?"Browse all apps and select an installed one to edit its settings.":'Pick an item from the list, or click "+" to create one.'})})}),q&&t.jsx($l,{open:!!q,mode:q.mode,initialName:q.initialName,initialPath:q.initialPath,isPending:P.isPending,error:ce,templates:ie,validate:os,onSubmit:ns,onOpenChange:b=>{b||(X(null),ne(void 0))}}),t.jsx(Ol,{open:de,isPending:P.isPending,error:re,onSubmit:Q,onOpenChange:b=>{b||(te(!1),le(void 0))}}),C&&t.jsx(Rl,{open:!!C,blockKey:C,initialName:pe.find(b=>b.key===C)?.name??C,isPending:P.isPending,onSubmit:is,onOpenChange:b=>{b||W(null)}}),S&&t.jsx($a,{open:!!S,onOpenChange:b=>{b||se(null)},pageKey:S,decofile:m,onSave:b=>P.mutateAsync({blockKey:S,data:b})}),t.jsx(Go,{open:!!Z,onOpenChange:b=>{!b&&!at&&oe(null)},children:t.jsxs(Ho,{children:[t.jsxs(qo,{children:[t.jsx(Wo,{children:`Delete ${rs}?`}),t.jsx(Jo,{children:Z?.kind==="section"?`"${Z.label}" will be removed. Pages that still reference it will lose this section.`:Z?`"${Z.label}" will be removed permanently. This can't be undone.`:null})]}),t.jsxs(Yo,{children:[t.jsx(Qo,{disabled:at,children:"Cancel"}),t.jsx(Xo,{onClick:b=>{b.preventDefault(),Ge()},disabled:at,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:at?t.jsxs(t.Fragment,{children:[t.jsx(rt,{className:"size-3.5"}),"Deleting…"]}):"Delete"})]})]})})]})}function tc(n){const e=ae.c(57),{activeCollection:s,pages:o,redirects:a,sections:l,availableSections:i,appCatalog:c,appCatalogLoading:r,blogEntries:d,decofile:p,searchQuery:m,onSearchChange:h,selection:u,onSelect:f,onCreate:g,onDuplicatePage:x,onRenamePage:y,onAddPageVariant:v,onDeletePage:j,onEditPageSeo:N,onViewPageJson:w,onDuplicateSection:E,onRenameSection:B,onDeleteSection:k,onDeleteRedirect:D,onDuplicateBlog:O,onDeleteBlog:L}=n;let K,F,_,A,R,I;if(e[0]!==s||e[1]!==c||e[2]!==r||e[3]!==i||e[4]!==d||e[5]!==p||e[6]!==v||e[7]!==g||e[8]!==L||e[9]!==j||e[10]!==D||e[11]!==k||e[12]!==O||e[13]!==x||e[14]!==E||e[15]!==N||e[16]!==y||e[17]!==B||e[18]!==h||e[19]!==f||e[20]!==w||e[21]!==o||e[22]!==a||e[23]!==m||e[24]!==l||e[25]!==u){const P=m.toLowerCase(),G=o.filter(S=>!P||S.name.toLowerCase().includes(P)||S.path.toLowerCase().includes(P)),Y=a.filter(S=>!P||S.from.toLowerCase().includes(P)||S.to.toLowerCase().includes(P)),q=l.filter(S=>!P||S.name.toLowerCase().includes(P)||S.key.toLowerCase().includes(P)||S.resolveType.toLowerCase().includes(P)),X=i.filter(S=>!P||S.title.toLowerCase().includes(P)||S.resolveType.toLowerCase().includes(P)||(S.description?.toLowerCase().includes(P)??!1)),ce=Mr(q),ne=c.filter(S=>!P||S.title.toLowerCase().includes(P)||S.app.toLowerCase().includes(P)||S.vendor.toLowerCase().includes(P)||S.category.toLowerCase().includes(P)),de=d.filter(S=>!P||S.label.toLowerCase().includes(P)||S.subtitle.toLowerCase().includes(P)),te=`Search ${s}…`,re=lt(s)?`Create new ${Pt[s]}`:s==="redirects"?"Create new redirect":"Create new page",le=s!=="apps"&&s!=="sections";R="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let C;e[32]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Bn,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[32]=C):C=e[32];let W;e[33]!==h?(W=S=>h(S.target.value),e[33]=h,e[34]=W):W=e[34];let Z;e[35]!==te||e[36]!==m||e[37]!==W?(Z=t.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[C,t.jsx("input",{type:"text",value:m,onChange:W,placeholder:te,"aria-label":te,className:"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),e[35]=te,e[36]=m,e[37]=W,e[38]=Z):Z=e[38];let oe;e[39]!==re||e[40]!==g||e[41]!==le?(oe=le&&t.jsxs(Xe,{children:[t.jsx(Ye,{asChild:!0,children:t.jsx(Be,{variant:"ghost",size:"icon",onClick:g,"aria-label":re,children:t.jsx(js,{size:14})})}),t.jsx(Qe,{side:"bottom",children:re})]}),e[39]=re,e[40]=g,e[41]=le,e[42]=oe):oe=e[42],e[43]!==Z||e[44]!==oe?(I=t.jsxs("div",{className:"px-2 h-12 flex items-center gap-1 border-b shrink-0",children:[Z,oe]}),e[43]=Z,e[44]=oe,e[45]=I):I=e[45],K=Qt,A="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",F="flex flex-col gap-1 p-1.5",_=s==="pages"?G.length===0?t.jsx(jt,{hasItems:o.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):G.map(S=>{const se=u?.collection==="pages"&&u.key===S.key,H=On(p,S.key);return t.jsx(He,{icon:yn,title:S.name,subtitle:S.path,active:se,variantCount:H,onClick:()=>f({collection:"pages",key:S.key,path:S.path}),menu:t.jsx(Lt,{onDuplicate:()=>x(S),onRename:()=>y(S),onAddVariant:()=>v(S),onEditSeo:()=>N(S),onViewJson:()=>w(S),onDelete:()=>j(S)})},S.key)}):s==="sections"?q.length===0&&X.length===0?t.jsx(jt,{hasItems:l.length>0||i.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):t.jsxs(t.Fragment,{children:[ce.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(mn,{icon:Mt,label:"Saved sections"}),ce.map(S=>t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{className:"px-2.5 pt-1 pb-0.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60",children:S.label}),S.sections.map(se=>{const H=u?.collection==="sections"&&u.key===se.key;return t.jsx(He,{icon:Mt,accent:"global",title:se.name,subtitle:S.label,active:H,onClick:()=>f({collection:"sections",key:se.key}),menu:t.jsx(Lt,{onDuplicate:()=>E(se),onRename:()=>B(se),onDelete:()=>k(se)})},se.key)})]},S.label))]}),X.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(mn,{icon:Rs,label:"Available sections",className:ge(ce.length>0&&"mt-3")}),X.map(S=>{const se=u?.collection==="available-section"&&u.resolveType===S.resolveType,H=S.resolveType.split("/").pop()?.replace(/\.tsx?$/,"");return t.jsx(He,{icon:Rs,title:S.title,subtitle:H??S.resolveType,active:se,onClick:()=>f({collection:"available-section",resolveType:S.resolveType,title:S.title})},S.resolveType)})]})]}):s==="apps"?r?t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(rt,{className:"size-4.5 text-muted-foreground"})}):ne.length===0?t.jsx(jt,{hasItems:c.length>0,emptyLabel:"No apps found.",emptyHint:"Try a different search term."}):ne.map(S=>{const se=u?.collection==="apps"&&S.blockKey!==null&&u.key===S.blockKey;return t.jsx(He,{icon:Tn,logoUrl:S.logo,title:S.title,subtitle:S.category,active:se,trailing:S.installed?t.jsx("span",{className:"shrink-0 rounded-full bg-success/15 px-1.5 py-0.5 text-[10px] font-medium text-success",children:"Installed"}):void 0,onClick:()=>{if(!S.installed||!S.blockKey){me.message(`${S.title} is not installed on this site.`);return}f({collection:"apps",key:S.blockKey})}},S.id)}):s==="redirects"?Y.length===0?t.jsx(jt,{hasItems:a.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):Y.map(S=>t.jsx(He,{icon:vn,title:S.from||"(no source)",subtitle:`→ ${S.to||"(no target)"}`,active:u?.collection==="redirects"&&u.key===S.key,trailing:t.jsx(Il,{type:S.type}),onClick:()=>f({collection:"redirects",key:S.key}),menu:t.jsx(Lt,{onDelete:()=>D(S)})},S.key)):de.length===0?t.jsx(jt,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${lt(s)?Pt[s]:"item"}.`}):de.map(S=>{const se=u?.collection===S.kind&&u.key===S.key;return t.jsx(He,{icon:S.kind==="posts"?Pn:S.kind==="authors"?En:kn,title:S.label,subtitle:S.subtitle,active:se,onClick:()=>f({collection:S.kind,key:S.key}),menu:t.jsx(Lt,{onDuplicate:()=>O(S),onDelete:()=>L(S)})},S.key)}),e[0]=s,e[1]=c,e[2]=r,e[3]=i,e[4]=d,e[5]=p,e[6]=v,e[7]=g,e[8]=L,e[9]=j,e[10]=D,e[11]=k,e[12]=O,e[13]=x,e[14]=E,e[15]=N,e[16]=y,e[17]=B,e[18]=h,e[19]=f,e[20]=w,e[21]=o,e[22]=a,e[23]=m,e[24]=l,e[25]=u,e[26]=K,e[27]=F,e[28]=_,e[29]=A,e[30]=R,e[31]=I}else K=e[26],F=e[27],_=e[28],A=e[29],R=e[30],I=e[31];let V;e[46]!==F||e[47]!==_?(V=t.jsx("div",{className:F,children:_}),e[46]=F,e[47]=_,e[48]=V):V=e[48];let z;e[49]!==K||e[50]!==A||e[51]!==V?(z=t.jsx(K,{className:A,children:V}),e[49]=K,e[50]=A,e[51]=V,e[52]=z):z=e[52];let J;return e[53]!==R||e[54]!==I||e[55]!==z?(J=t.jsxs("div",{className:R,children:[I,z]}),e[53]=R,e[54]=I,e[55]=z,e[56]=J):J=e[56],J}function sc(n){const e=ae.c(25),{virtualMcpId:s}=n,o=we(),[a,l]=$.useState(!1),i=zn(s),{activeTask:c}=bn();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[0]=r):r=e[0];const d=gn(r);if(!(Us(i?.metadata)||Us(c?.metadata))){let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:t.jsx(Gs,{className:"size-7 text-foreground"})}),e[1]=h):h=e[1];let u;e[2]!==o?(u=o("mainPanelTabs.contentTab.noContentToEdit"),e[2]=o,e[3]=u):u=e[3];let f;e[4]!==o?(f=o("mainPanelTabs.contentTab.connectGithubDescription"),e[4]=o,e[5]=f):f=e[5];let g,x;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=()=>l(!0),x=t.jsx(Gs,{className:"size-4"}),e[6]=g,e[7]=x):(g=e[6],x=e[7]);let y;e[8]!==o?(y=o("mainPanelTabs.previewTab.connectGithub"),e[8]=o,e[9]=y):y=e[9];let v;e[10]!==y?(v=t.jsxs(Be,{onClick:g,children:[x,y]}),e[10]=y,e[11]=v):v=e[11];let j;e[12]!==u||e[13]!==f||e[14]!==v?(j=t.jsx(ol,{className:"h-full",image:h,title:u,description:f,actions:v}),e[12]=u,e[13]=f,e[14]=v,e[15]=j):j=e[15];let N;e[16]!==a?(N=t.jsx(al,{open:a,onOpenChange:l,mode:"agent"}),e[16]=a,e[17]=N):N=e[17];let w;return e[18]!==N||e[19]!==j?(w=t.jsxs(t.Fragment,{children:[j,N]}),e[18]=N,e[19]=j,e[20]=w):w=e[20],w}let m;return e[21]!==d.contentPageId||e[22]!==d.contentPath||e[23]!==d.contentPathTemplate?(m=t.jsx(Xr,{deepLinkPage:{pageId:d.contentPageId,path:d.contentPath,pathTemplate:d.contentPathTemplate}}),e[21]=d.contentPageId,e[22]=d.contentPath,e[23]=d.contentPathTemplate,e[24]=m):m=e[24],m}function nc(){const n=ae.c(2),e=ll();let s;return n[0]!==e?(s=t.jsx(_o,{tabId:"content",children:t.jsx(Do,{feature:"cms",children:t.jsx(sc,{virtualMcpId:e})})}),n[0]=e,n[1]=s):s=n[1],s}const Sd=Object.freeze(Object.defineProperty({__proto__:null,default:nc},Symbol.toStringTag,{value:"Module"}));export{xo as $,gd as A,Es as B,rd as C,ld as D,xd as E,yd as F,Jn as G,io as H,Ai as I,Qs as J,pi as K,ad as L,ps as M,so as N,nd as O,Bs as P,dd as Q,bd as R,ud as S,vd as T,fd as U,pt as V,pd as W,md as X,cd as Y,hd as Z,qt as _,sd as a,go as a0,Sd as a1,ss as b,Xl as c,Ti as d,td as e,Ue as f,mt as g,Jt as h,jd as i,oi as j,kd as k,Xn as l,Ts as m,Cl as n,no as o,_t as p,it as q,cl as r,be as s,ro as t,Bi as u,Ke as v,ui as w,od as x,id as y,Me as z};
|