decocms 4.427.3 → 4.427.4
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-LgH1QoTd.js → AlertCircle-CPQSuuWk.js} +1 -1
- package/dist/client/assets/{AreaChart-nTxNjdUo.js → AreaChart-BKxeqcvu.js} +1 -1
- package/dist/client/assets/{ArrowLeft-DXn8x-hc.js → ArrowLeft-Bvd89_b4.js} +1 -1
- package/dist/client/assets/{ArrowRight-DMcFYEQV.js → ArrowRight-n-IJ4Fik.js} +1 -1
- package/dist/client/assets/{ArrowUp-hOT7zM5c.js → ArrowUp-BTBhPpEu.js} +1 -1
- package/dist/client/assets/{CartesianChart-CNpA5Q-x.js → CartesianChart-Ba_8acEa.js} +1 -1
- package/dist/client/assets/{Check-CJBdxo1x.js → Check-CP73h7yQ.js} +1 -1
- package/dist/client/assets/{CheckCircle-B2FtFP_M.js → CheckCircle-BpnJdBCF.js} +1 -1
- package/dist/client/assets/{ChevronUp-JJQ1R76T.js → ChevronUp-CIZg0YhK.js} +1 -1
- package/dist/client/assets/{Copy01-DLl7IkAX.js → Copy01-YoGcseNZ.js} +1 -1
- package/dist/client/assets/{CreditCard01-BvqpwW9d.js → CreditCard01-C-9IP3Dn.js} +1 -1
- package/dist/client/assets/{DotsVertical-CfCl81oT.js → DotsVertical-_UiBrHHr.js} +1 -1
- package/dist/client/assets/{ErrorBarContext-BywYAHQQ.js → ErrorBarContext-CtWkO946.js} +1 -1
- package/dist/client/assets/{Image01-ChZ5ec4B.js → Image01-C_d_m-XY.js} +1 -1
- package/dist/client/assets/{Key01-DJ4Ph9An.js → Key01-Di5njQWH.js} +1 -1
- package/dist/client/assets/{Line-ahq5Dv8y.js → Line-2NdbZbdQ.js} +1 -1
- package/dist/client/assets/{Link01-D9SeIlWM.js → Link01-BzReMq2w.js} +1 -1
- package/dist/client/assets/{LinkExternal01-wpbajNPV.js → LinkExternal01-CuSjyiN1.js} +1 -1
- package/dist/client/assets/{Monitor01-CldPGi5G.js → Monitor01-C8qvsEmS.js} +1 -1
- package/dist/client/assets/{Palette-D5Dmn1Mg.js → Palette-edCnzPtR.js} +1 -1
- package/dist/client/assets/{Plus-CoCopPFe.js → Plus-BPVcSaQ1.js} +1 -1
- package/dist/client/assets/{SearchMd-D_gFR8gZ.js → SearchMd-CQ_uV2jU.js} +1 -1
- package/dist/client/assets/{Sector-CiAU2uLo.js → Sector-UvElOWGp.js} +1 -1
- package/dist/client/assets/{ShoppingBag01-Dv73R-S1.js → ShoppingBag01-DskCGm9K.js} +1 -1
- package/dist/client/assets/{Sun-Ck9W5L0l.js → Sun-CPwiYds_.js} +1 -1
- package/dist/client/assets/{Tool01-Cmx87k3R.js → Tool01-Cr3g7eFI.js} +1 -1
- package/dist/client/assets/{Trash01-Cn3n-zZO.js → Trash01-DsSqN_Va.js} +1 -1
- package/dist/client/assets/{Upload01-DGQb_EA3.js → Upload01-CsCOoftz.js} +1 -1
- package/dist/client/assets/{User01-Cf1Q03zT.js → User01-CFCaTmZh.js} +1 -1
- package/dist/client/assets/{UserSquare-Dbf0yjYU.js → UserSquare-k-BSPAbI.js} +1 -1
- package/dist/client/assets/{Users01-DlQODEmu.js → Users01-DeynvlqM.js} +1 -1
- package/dist/client/assets/{X-C31L8F55.js → X-srLHGSHt.js} +1 -1
- package/dist/client/assets/{XAxis-CKLs9YQe.js → XAxis-BjWqcwD8.js} +1 -1
- package/dist/client/assets/{XClose-e3DY7fD7.js → XClose-DeW6TQBh.js} +1 -1
- package/dist/client/assets/{ZoomOut-gxmwr3p2.js → ZoomOut-Dv2fO7S6.js} +1 -1
- package/dist/client/assets/{access-gate-C9TGkMuV.js → access-gate-B3mORPKI.js} +1 -1
- package/dist/client/assets/{add-connection-dialog-De-dU7Sc.js → add-connection-dialog-BcjdUiaQ.js} +1 -1
- package/dist/client/assets/{agent-analytics-CG_RWDE0.js → agent-analytics-CKV0hDyk.js} +1 -1
- package/dist/client/assets/agent-app-BFOjtgCv.js +1 -0
- package/dist/client/assets/{agent-assets-CTQdq_7C.js → agent-assets-CdbsBbCR.js} +1 -1
- package/dist/client/assets/{agent-automation-B48W_kZA.js → agent-automation-B4U-RCdw.js} +1 -1
- package/dist/client/assets/{agent-automations--9OwScw6.js → agent-automations-BofxR-p6.js} +1 -1
- package/dist/client/assets/{agent-connect-sources-D4naxmLm.js → agent-connect-sources-DVCassCM.js} +1 -1
- package/dist/client/assets/agent-deck-CzBl7ZXg.js +1 -0
- package/dist/client/assets/{agent-e2e-nsCxCgZH.js → agent-e2e-wt_yRGNI.js} +1 -1
- package/dist/client/assets/{agent-experiments-DbsZWcDI.js → agent-experiments-DDuThSIz.js} +1 -1
- package/dist/client/assets/{agent-file-CFmKPE3z.js → agent-file-B32pX_Mg.js} +1 -1
- package/dist/client/assets/{agent-git-DOOK3AWw.js → agent-git-Bo65C6U1.js} +1 -1
- package/dist/client/assets/{agent-hosting-C1_sfMLQ.js → agent-hosting-EBCxvgo5.js} +1 -1
- package/dist/client/assets/{agent-icon-DOuarSUR.js → agent-icon-Dnnu07Dp.js} +1 -1
- package/dist/client/assets/agent-library-cQi5KYsD.js +1 -0
- package/dist/client/assets/agent-library-file-sn2mdwoo.js +1 -0
- package/dist/client/assets/{agent-monitor-BlgXKjRG.js → agent-monitor-Q5jbBFc5.js} +1 -1
- package/dist/client/assets/{agent-overview-DZp1e5nc.js → agent-overview-jkrc4Z5H.js} +1 -1
- package/dist/client/assets/agent-settings-5TJZgZyU.js +1 -0
- package/dist/client/assets/{agent-site-editor-DZF_4RiJ.js → agent-site-editor-C243VRJF.js} +1 -1
- package/dist/client/assets/agent-site-editor-code-Ci_MsG4X.js +2 -0
- package/dist/client/assets/{agent-site-editor-content-lQkJiJ4D.js → agent-site-editor-content-Bsy-qFwp.js} +3 -3
- package/dist/client/assets/{agent-site-editor-preview-BrZsP1dl.js → agent-site-editor-preview-BmdmZr27.js} +3 -3
- package/dist/client/assets/{agent-view-guard-BfjHuZPk.js → agent-view-guard-CDZZYqXI.js} +1 -1
- package/dist/client/assets/agent-view-tmUFFOC3.js +1 -0
- package/dist/client/assets/{agents-list-DiGjU-95.js → agents-list-nBgdBAsA.js} +1 -1
- package/dist/client/assets/{ai-providers-Bymg50bM.js → ai-providers-D2D5FHP_.js} +1 -1
- package/dist/client/assets/{alert-dialog-HXdE5Gnc.js → alert-dialog-BFZCPfXf.js} +1 -1
- package/dist/client/assets/{alert-Dmahyhuy.js → alert-yU0z8SHT.js} +1 -1
- package/dist/client/assets/{analytics-sections-t4olf6Qe.js → analytics-sections-r7g_2PI9.js} +1 -1
- package/dist/client/assets/api-keys-BzobvLd_.js +1 -0
- package/dist/client/assets/{api-keys-C8JA05v4.js → api-keys-Dq_Ir7lG.js} +1 -1
- package/dist/client/assets/{app-editor-31GxTBfl.js → app-editor-BbrLoyhg.js} +1 -1
- package/dist/client/assets/{asset-utils-CmEiE9Uc.js → asset-utils-DUl4MpZE.js} +1 -1
- package/dist/client/assets/{auth-CEDbnarF.js → auth-DYiVP7MT.js} +1 -1
- package/dist/client/assets/{auth-catchall-Bw98HcCS.js → auth-catchall-PWrNJU9a.js} +1 -1
- package/dist/client/assets/{auth-entry-BguAYTmy.js → auth-entry-DXkRq0Vo.js} +1 -1
- package/dist/client/assets/{auth-split-layout-CN2cfVXP.js → auth-split-layout-CmGSwYw9.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-NS0ShRS6.js → authenticate-and-persist-oauth-Fhu72ZVZ.js} +1 -1
- package/dist/client/assets/{automation-list-row-B5awWkGX.js → automation-list-row-Cws0Y7Xb.js} +1 -1
- package/dist/client/assets/{automation-runs-CqpMal_k.js → automation-runs-2uHfD8tk.js} +1 -1
- package/dist/client/assets/{automations-D1uwssbO.js → automations-D3LKcXfl.js} +1 -1
- package/dist/client/assets/{autosend-D5CvCJ-i.js → autosend-DdEs0_Ox.js} +1 -1
- package/dist/client/assets/{avatar-u_MWZIGi.js → avatar-IYCAP9D4.js} +1 -1
- package/dist/client/assets/{badge-BX9BIMvF.js → badge-Bx-goeTE.js} +1 -1
- package/dist/client/assets/{block-document-BLnHrDch.js → block-document-CudYy7pf.js} +1 -1
- package/dist/client/assets/{blocks-preview-workspace-context-Cdg4ibbN.js → blocks-preview-workspace-context-CZgMFcZn.js} +1 -1
- package/dist/client/assets/{buckets-CWJprjfJ.js → buckets-CTjUYDpA.js} +1 -1
- package/dist/client/assets/{build-improve-prompt-doc-Damnk5Ex.js → build-improve-prompt-doc-sqppqftt.js} +1 -1
- package/dist/client/assets/{calendar-jhyZLBMo.js → calendar-Da7EzsC_.js} +1 -1
- package/dist/client/assets/{capability-load-error-CcDe-fRB.js → capability-load-error-CW18N_J-.js} +1 -1
- package/dist/client/assets/{category-editor-CWwBDlse.js → category-editor-SDdqVzYD.js} +1 -1
- package/dist/client/assets/{chart-B2y-kKQ0.js → chart-CUr_Oc7J.js} +1 -1
- package/dist/client/assets/{chat-context-BwDW_kfn.js → chat-context-DON-iHtd.js} +1 -1
- package/dist/client/assets/{chat-draft-Cl-wTCCT.js → chat-draft-DMzZaSVw.js} +1 -1
- package/dist/client/assets/{checkbox-BSRHWuev.js → checkbox-tfdkp6cA.js} +1 -1
- package/dist/client/assets/{choose-editor-C8WO_xUV.js → choose-editor-DLtNSxee.js} +1 -1
- package/dist/client/assets/{claim-phase-copy-lXnLa3JE.js → claim-phase-copy-DR8vjdW9.js} +1 -1
- package/dist/client/assets/{cli-auth-success-kkM7ps-e.js → cli-auth-success-Bkluc_U5.js} +1 -1
- package/dist/client/assets/{client-icons-BGQmYdos.js → client-icons-CSURvWnQ.js} +1 -1
- package/dist/client/assets/{collapsible-D2v2kHCp.js → collapsible-EbSIRvil.js} +1 -1
- package/dist/client/assets/{collection-detail-D00QEuKM.js → collection-detail-C2v6Molb.js} +1 -1
- package/dist/client/assets/{collection-display-button-Dhq5dlaG.js → collection-display-button-fQZLsPPw.js} +1 -1
- package/dist/client/assets/{collection-search-Ab7KDawL.js → collection-search-DshGdcb0.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-auQPNSDA.js → collection-table-wrapper-DHFOBwKW.js} +1 -1
- package/dist/client/assets/{collection-tabs-CWG2Ssug.js → collection-tabs-DZ5NL0dm.js} +1 -1
- package/dist/client/assets/{combobox-BjW-E7gd.js → combobox-1x_gJLmD.js} +1 -1
- package/dist/client/assets/{command-CbOwtpAb.js → command-CGV8_1wr.js} +1 -1
- package/dist/client/assets/{companion-mcps-section-DybN6E44.js → companion-mcps-section-DBilles0.js} +1 -1
- package/dist/client/assets/{config-cjO0ec13.js → config-BQUS_r3B.js} +1 -1
- package/dist/client/assets/{connect-CZQuBtcR.js → connect-BTbCanHU.js} +1 -1
- package/dist/client/assets/{connect-layout-9t7Rh7Vh.js → connect-layout-DEXuG2Yo.js} +1 -1
- package/dist/client/assets/{connection-BQHh86t6.js → connection-DUhRStgE.js} +1 -1
- package/dist/client/assets/{connection-card-CXVlnV9x.js → connection-card-CLQNp13z.js} +1 -1
- package/dist/client/assets/{connection-detail-DgOWvKok.js → connection-detail-BtJmkvpf.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-D8c6nuwN.js → connection-form-helpers-DSaYnQN2.js} +1 -1
- package/dist/client/assets/{connections-9NgRVJC2.js → connections-D96n_qp_.js} +1 -1
- package/dist/client/assets/{context-Ux9G6xnM.js → context-BGRn957C.js} +1 -1
- package/dist/client/assets/{context-menu-wSg2GQJ1.js → context-menu-CQbUe-ra.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-CjXfUzzS.js → create-organization-dialog-kLzAxj94.js} +1 -1
- package/dist/client/assets/{daily-pulse-C_TjVQs3.js → daily-pulse-Cd1z4FAa.js} +1 -1
- package/dist/client/assets/{decopilot-C2SQZxBZ.js → decopilot-0B-Wngp1.js} +1 -1
- package/dist/client/assets/{dialog-BTrZTHUg.js → dialog-CETaaDWs.js} +1 -1
- package/dist/client/assets/{discover-CDQBWF3f.js → discover-B-ilIHMP.js} +1 -1
- package/dist/client/assets/{domain-settings-DWNXcUq-.js → domain-settings-BslLFOdM.js} +1 -1
- package/dist/client/assets/{download-app-dialog-rxkHUuQW.js → download-app-dialog-8Rp12cmh.js} +1 -1
- package/dist/client/assets/{drawer-D0MZ4mo1.js → drawer-BWFufjc5.js} +1 -1
- package/dist/client/assets/{editor-CZNcI_SV.js → editor-DCdz0KkZ.js} +1 -1
- package/dist/client/assets/{empty-state-2J_TOd9y.js → empty-state-C1nhEd0-.js} +1 -1
- package/dist/client/assets/{empty-state-C0rOaw8I.js → empty-state-CCrjb95L.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BoNYfZov.js → extract-connection-data-CMpFLKxZ.js} +1 -1
- package/dist/client/assets/{feature-gate-CYQFZ14_.js → feature-gate-BFpFz5qO.js} +1 -1
- package/dist/client/assets/{feature-paywall-BwzbgDQ2.js → feature-paywall-C4yY8Ib4.js} +1 -1
- package/dist/client/assets/{file-explorer-BeLwDfpq.js → file-explorer-CdDjQr7g.js} +1 -1
- package/dist/client/assets/{file-preview-DK64AFJA.js → file-preview-C_o5YOlI.js} +1 -1
- package/dist/client/assets/{file-share-button-B8UXgZpv.js → file-share-button-BFkhjbuE.js} +1 -1
- package/dist/client/assets/{file-type-icon-DKVj9WdW.js → file-type-icon-BOUS9AkT.js} +1 -1
- package/dist/client/assets/flat-project-QmHgVWcO.js +1 -0
- package/dist/client/assets/{folder-icon-BAqwN8FW.js → folder-icon-NO1Kx9J0.js} +1 -1
- package/dist/client/assets/{form-8UJeqUiI.js → form-0lcPxUaV.js} +1 -1
- package/dist/client/assets/{gateway-client-Bdpr8BZh.js → gateway-client-l5gwlcsP.js} +1 -1
- package/dist/client/assets/{general-BF-C0Z12.js → general-RK-Z5buE.js} +1 -1
- package/dist/client/assets/{home-DJCEpQ02.js → home-CKLboulk.js} +1 -1
- package/dist/client/assets/{icon-button-CF7hoaxW.js → icon-button-6nUT6iDC.js} +1 -1
- package/dist/client/assets/{index-BWB9RQBb.js → index-5wKgIWMb.js} +1 -1
- package/dist/client/assets/{index-DZb2klda.js → index-B937Cf7T.js} +1 -1
- package/dist/client/assets/{index-DmYJaTVV.js → index-BfVD2brg.js} +1 -1
- package/dist/client/assets/{index-Cmc1gJKg.js → index-Bj1jqTBk.js} +1 -1
- package/dist/client/assets/{index-CF33tV9H.js → index-BkwVGG61.js} +2 -2
- package/dist/client/assets/{index-Vjru0x-d.js → index-CTHyXtAa.js} +1 -1
- package/dist/client/assets/{index-C-POkbWx.js → index-Cryf-8qU.js} +1 -1
- package/dist/client/assets/{index-DsGrUBDn.js → index-DRXNkaTh.js} +3 -3
- package/dist/client/assets/{index-C-EzIAGn.js → index-DaTxyVef.js} +1 -1
- package/dist/client/assets/{index-spGJzdyg.js → index-Ds19ODXY.js} +1 -1
- package/dist/client/assets/{index-76SxZk_X.js → index-DsOjhcBf.js} +1 -1
- package/dist/client/assets/{index-CxrCNzwL.js → index-Dw4oNOsw.js} +1 -1
- package/dist/client/assets/{index-1AIxMAAv.js → index-QMMagPPL.js} +1 -1
- package/dist/client/assets/{index-xbjCfbu7.js → index-cy7uuLPR.js} +1 -1
- package/dist/client/assets/{index-CRkgh-05.js → index-jlKQueRg.js} +1 -1
- package/dist/client/assets/{index-redirect-DSYHpybA.js → index-redirect-Dq7SWXpC.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-B2NoY_fE.js → infiniteQueryObserver-Da-u5q9x.js} +1 -1
- package/dist/client/assets/{infra-billing-DkJvW3iq.js → infra-billing-4atOBTNp.js} +1 -1
- package/dist/client/assets/{input-AjjN82QQ.js → input-BC8VVwvY.js} +1 -1
- package/dist/client/assets/{input-CfFpcyV7.js → input-BdWjJobT.js} +3 -3
- package/dist/client/assets/{input-yaPbdNpf.js → input-C7EfrFTT.js} +1 -1
- package/dist/client/assets/{integration-icon-DP9NSovP.js → integration-icon-B3X6G1Wg.js} +1 -1
- package/dist/client/assets/{label-BbaxSm2e.js → label-1zPphAKx.js} +1 -1
- package/dist/client/assets/{last-preview-page-JBlzHOgO.js → last-preview-page-cK2MEC8D.js} +1 -1
- package/dist/client/assets/{layout-knRlbNSK.js → layout-DHJPER-7.js} +1 -1
- package/dist/client/assets/{legacy-agents-deep-UdzPgZRs.js → legacy-agents-deep-BsoSPgFz.js} +1 -1
- package/dist/client/assets/{legacy-main-redirect-CHPpwdRi.js → legacy-main-redirect-ChGBy0pr.js} +1 -1
- package/dist/client/assets/library-C3wY5IDS.js +1 -0
- package/dist/client/assets/{library-tab-CflDoRvR.js → library-tab-DeBKrgJg.js} +1 -1
- package/dist/client/assets/{login-w4_pWNqb.js → login-C0riyamj.js} +1 -1
- package/dist/client/assets/{markdown-Bgy5OrzQ.js → markdown-CzQeLeJo.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-CFF7AAUa.js → mcp-app-renderer-DGp0KYfs.js} +1 -1
- package/dist/client/assets/{mcp-oauth-BzBo_-Jy.js → mcp-oauth-C_AhA8BD.js} +1 -1
- package/dist/client/assets/{members-DKbvdexc.js → members-wD81k9VR.js} +1 -1
- package/dist/client/assets/{message-templates-FmZnnh3p.js → message-templates-Bz6YUiFR.js} +1 -1
- package/dist/client/assets/{mini-report-page-BnFWPj1C.js → mini-report-page-xC-b4ikd.js} +1 -1
- package/dist/client/assets/{mock-board-BCoIiT3t.js → mock-board-BDB7iXmu.js} +1 -1
- package/dist/client/assets/{monaco-editor-DQWxb8wg.js → monaco-editor-DknCndmN.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-XCQkGjEK.js → monitoring-stats-row-hrEvYAfu.js} +1 -1
- package/dist/client/assets/{multi-select-CcYIvmDR.js → multi-select-BldQfs4n.js} +1 -1
- package/dist/client/assets/{mustache-CdtnXA29.js → mustache-myD7wuI4.js} +1 -1
- package/dist/client/assets/{new-project-dialog-Bakb8W9y.js → new-project-dialog-CSocvB7L.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-Byb3zpPg.js → oauth-callback-ai-provider-CiMFOAgr.js} +1 -1
- package/dist/client/assets/{oauth-callback-DkNp0t-_.js → oauth-callback-onJRIxdw.js} +1 -1
- package/dist/client/assets/{onboarding-D37ykwLO.js → onboarding-CrRJG04Q.js} +1 -1
- package/dist/client/assets/openai-conversation-C-qWjUGl.js +3 -0
- package/dist/client/assets/{optimistic-project-sidebar-views-ecBjPgL5.js → optimistic-project-sidebar-views-CMDmsGJV.js} +1 -1
- package/dist/client/assets/{org-file-open-context-U3fQRmd6.js → org-file-open-context-B35TDcCu.js} +1 -1
- package/dist/client/assets/{organization-choice-ZGqdbIdJ.js → organization-choice-Bs9ulFE-.js} +1 -1
- package/dist/client/assets/{orgs-TnGNXtmZ.js → orgs-JD0iC6HY.js} +1 -1
- package/dist/client/assets/{page-seo-form-uBcIOZzO.js → page-seo-form-CTgmdwJ8.js} +1 -1
- package/dist/client/assets/{pair-B9vgkujD.js → pair-Bg6eSzpi.js} +1 -1
- package/dist/client/assets/{plan-ladder-C4jLq8gJ.js → plan-ladder-CDdTsNd1.js} +1 -1
- package/dist/client/assets/{popover-DN_kN9Uf.js → popover-CmYWPOzN.js} +1 -1
- package/dist/client/assets/{post-calendar-BOHVV9jx.js → post-calendar-ByuVszdB.js} +1 -1
- package/dist/client/assets/{post-editor-DVWD2-YL.js → post-editor-DtruhQnc.js} +1 -1
- package/dist/client/assets/{preview-content-gCXONmKY.js → preview-content-BQkGg4d0.js} +1 -1
- package/dist/client/assets/{preview-dialog-CFWBgSUu.js → preview-dialog-DcCFcBh7.js} +1 -1
- package/dist/client/assets/{profile-Dmk0HG2j.js → profile-DkcT6VXV.js} +1 -1
- package/dist/client/assets/{project-app-view-CuKYEErt.js → project-app-view-C0egNxXw.js} +1 -1
- package/dist/client/assets/{project-feed-DEi8rhF-.js → project-feed-BiP37r-A.js} +1 -1
- package/dist/client/assets/{project-icon-BkqkP7nf.js → project-icon-BNmVQ8L_.js} +1 -1
- package/dist/client/assets/project-reports-DZVcP-kH.js +1 -0
- package/dist/client/assets/project-tasks-DcGDTMZk.js +1 -0
- package/dist/client/assets/{projects-z4rvDAJj.js → projects-DUdfK2n3.js} +1 -1
- package/dist/client/assets/{projects-empty-state-HdBVfNER.js → projects-empty-state-ZlqTL85m.js} +1 -1
- package/dist/client/assets/{prompts-oCi4D2Yn.js → prompts-D7l3ZBvl.js} +1 -1
- package/dist/client/assets/record-editor-BRIfWSyG.js +1 -0
- package/dist/client/assets/{redirect-editor-zzKZ_yFT.js → redirect-editor-CcNVHhk0.js} +1 -1
- package/dist/client/assets/{reports-Bsjf3cGo.js → reports-CFlpMLMU.js} +1 -1
- package/dist/client/assets/reports-DJs1HSu3.js +1 -0
- package/dist/client/assets/{reports-onboarding-CCr9AwWY.js → reports-onboarding-DOel7yM5.js} +1 -1
- package/dist/client/assets/{reports-tab-DHn13A7k.js → reports-tab-DSXBJ6j9.js} +2 -2
- package/dist/client/assets/{repositories-Bvm8OkRO.js → repositories-BlDNOXEU.js} +1 -1
- package/dist/client/assets/{repository-binding-BoCSsnZc.js → repository-binding-B1w5M3gR.js} +1 -1
- package/dist/client/assets/{repository-import-picker-BVazJzzA.js → repository-import-picker-DF4pGbwe.js} +1 -1
- package/dist/client/assets/{repository-picker-8D1UXDg3.js → repository-picker-DgFy3-3l.js} +1 -1
- package/dist/client/assets/{require-capability-DguXasWW.js → require-capability-BnsT5PDo.js} +1 -1
- package/dist/client/assets/{required-auth-layout-RbAoR6Yn.js → required-auth-layout-BY0JzfRF.js} +1 -1
- package/dist/client/assets/{reset-password-Bpw_zifE.js → reset-password-PfCZuD9G.js} +1 -1
- package/dist/client/assets/{resizable-DSTf149y.js → resizable-CVSfaXZw.js} +1 -1
- package/dist/client/assets/{resolve-tab-icon-Bxf16ZwD.js → resolve-tab-icon-D1OGWrhZ.js} +1 -1
- package/dist/client/assets/{review-settings-BK16Nzk_.js → review-settings-q73Hh01R.js} +1 -1
- package/dist/client/assets/{rich-text-link-control-DHPpV00b.js → rich-text-link-control-YXgXuHt3.js} +1 -1
- package/dist/client/assets/{roles-Bjd0yuor.js → roles-Dr-FnL5J.js} +1 -1
- package/dist/client/assets/{route-BpcxVoRm.js → route-Bp5MJKr5.js} +1 -1
- package/dist/client/assets/{route-fNfrD2eG.js → route-CJXhitv7.js} +1 -1
- package/dist/client/assets/route-DN5ECAHy.js +1 -0
- package/dist/client/assets/{runnable-block-editor-Col2LSMj.js → runnable-block-editor-DSW-0LCr.js} +1 -1
- package/dist/client/assets/{sandbox-lifecycle-context-DAbyS7JV.js → sandbox-lifecycle-context-D2n8i5Gu.js} +1 -1
- package/dist/client/assets/{schema-CCD4YccI.js → schema-DvklMLx3.js} +1 -1
- package/dist/client/assets/{scroll-area-DM1jN7ke.js → scroll-area-BVufpFEW.js} +1 -1
- package/dist/client/assets/{search-input-Dx_18pro.js → search-input-BUOZ4kam.js} +1 -1
- package/dist/client/assets/{search-toggle-BMSaJG7T.js → search-toggle-C_JkVd8s.js} +1 -1
- package/dist/client/assets/{secret-picker-BLHfDxBo.js → secret-picker-D8pSURig.js} +1 -1
- package/dist/client/assets/{secrets-6pAliXgF.js → secrets-B8mqBann.js} +1 -1
- package/dist/client/assets/{sections-editor-DhpxII9P.js → sections-editor-BTaByHjs.js} +1 -1
- package/dist/client/assets/{select-BcXaErmA.js → select-Bk77xGJr.js} +1 -1
- package/dist/client/assets/{select-model-BNgkxljj.js → select-model-CiJwtYy9.js} +1 -1
- package/dist/client/assets/{seo-editor-8b-CJKFm.js → seo-editor-BohrAqqO.js} +1 -1
- package/dist/client/assets/{separator-CEzjtG6-.js → separator-BvzthCPi.js} +1 -1
- package/dist/client/assets/{settings-tab-Ca-N-XEW.js → settings-tab-BzkB1T3I.js} +1 -1
- package/dist/client/assets/{sheet-BQj61VK7.js → sheet-DdorBPzD.js} +1 -1
- package/dist/client/assets/{shell-layout-CrZ2-6Ce.js → shell-layout-DOQLZ3dZ.js} +1 -1
- package/dist/client/assets/{skills-BbSvA9id.js → skills-D-IDyzrA.js} +1 -1
- package/dist/client/assets/{sso-DvC-OMNQ.js → sso-81Vm6orn.js} +1 -1
- package/dist/client/assets/{suggestion-KDtRzygk.js → suggestion-DIcqp-mJ.js} +1 -1
- package/dist/client/assets/{switch-Dq_tuvKa.js → switch-DwnLjlqL.js} +1 -1
- package/dist/client/assets/{synced-repos-BjPrHp4f.js → synced-repos-C3FNmB7n.js} +1 -1
- package/dist/client/assets/{tab-icon-glyph-XPSqhFC7.js → tab-icon-glyph-DC_q_J1n.js} +1 -1
- package/dist/client/assets/{table-CLm3Vp87.js → table-CDYgRw2s.js} +1 -1
- package/dist/client/assets/{tabs-Ej7qM1mE.js → tabs-2VLLco4y.js} +1 -1
- package/dist/client/assets/{task-board-Bd0mg36M.js → task-board-C6ymciPp.js} +1 -1
- package/dist/client/assets/{task-route-CRC8grXh.js → task-route-CaJcZGh-.js} +1 -1
- package/dist/client/assets/{task-status-D-8U0vLp.js → task-status-DHBSX2mE.js} +1 -1
- package/dist/client/assets/{taskboard-analytics-CO2xmo5W.js → taskboard-analytics-dVsJ8ut7.js} +1 -1
- package/dist/client/assets/tasks-DIpH-que.js +1 -0
- package/dist/client/assets/{tasks-DoB3AtOX.js → tasks-DPtIBjSy.js} +1 -1
- package/dist/client/assets/{textarea-BCrT32Yf.js → textarea-DqtOZ_En.js} +1 -1
- package/dist/client/assets/{thread-analytics-sFdRkUQb.js → thread-analytics-D__8lYtr.js} +1 -1
- package/dist/client/assets/{thread-intent-CKwVWoUw.js → thread-intent-Dv0pFBsV.js} +1 -1
- package/dist/client/assets/{thread-route-CRN5C0rz.js → thread-route-BZugAEv3.js} +1 -1
- package/dist/client/assets/{thread-route-r92j2DQk.js → thread-route-ycmuVhFr.js} +1 -1
- package/dist/client/assets/{thread-sheet-body-BZ08Szwl.js → thread-sheet-body-CTvxuNl1.js} +1 -1
- package/dist/client/assets/{toggle-group-BG3uQJT1.js → toggle-group-BeacaAeg.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-WdsBB5ag.js → toolbar-icon-button-CLDPbOoA.js} +1 -1
- package/dist/client/assets/{tooltip-BipEhILt.js → tooltip-F9F0ZScm.js} +1 -1
- package/dist/client/assets/{track-DH1PLgww.js → track-DJ0hdxgP.js} +1 -1
- package/dist/client/assets/{types-DjFj33MP.js → types-1jfERRTH.js} +1 -1
- package/dist/client/assets/{usage-stats-CXgOJHoL.js → usage-stats-DFk0NwSH.js} +1 -1
- package/dist/client/assets/{use-ai-providers-nujHT3kc.js → use-ai-providers-ox5ll27Z.js} +1 -1
- package/dist/client/assets/{use-automations-BPYAumfs.js → use-automations-Dl_7dpcH.js} +1 -1
- package/dist/client/assets/{use-autosave-DbkPkV9x.js → use-autosave-YctWTqUt.js} +1 -1
- package/dist/client/assets/{use-chat-layout-state-Df24ZRB3.js → use-chat-layout-state-zJEW_ZS9.js} +1 -1
- package/dist/client/assets/{use-connect-companion-CIuesGgq.js → use-connect-companion-BuvSS7n-.js} +1 -1
- package/dist/client/assets/{use-connection-BP6uA1Pm.js → use-connection-ub_Ste14.js} +1 -1
- package/dist/client/assets/{use-copy-xbzBE9wD.js → use-copy-CtGMHYLy.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-jvahsWTp.js → use-create-virtual-mcp-Bf7w0Lce.js} +1 -1
- package/dist/client/assets/{use-date-fns-locale-CVmVbLGr.js → use-date-fns-locale-B9VkaJgg.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-DtHiemPV.js → use-debounced-autosave-vZPUSJfn.js} +1 -1
- package/dist/client/assets/{use-debounced-value-BqAFy0xh.js → use-debounced-value-Bw9kIjO1.js} +1 -1
- package/dist/client/assets/{use-deco-credits-3SqWhb0e.js → use-deco-credits-MhwX_k9L.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-DKAwuHK5.js → use-decopilot-events-BSl-VzHR.js} +1 -1
- package/dist/client/assets/{use-delete-connection-DGBclfUv.js → use-delete-connection-Va4KqXUY.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-Hzf6w5Lv.js → use-deployment-admin-BmRjrW1v.js} +1 -1
- package/dist/client/assets/{use-fast-preview-draft-url-BMGQbWRn.js → use-fast-preview-draft-url-BXtnB34v.js} +1 -1
- package/dist/client/assets/{use-file-configs-CQzLvGNZ.js → use-file-configs-Cm3sO4It.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-DKwxtCTJ.js → use-infinite-scroll-BnsQBnBU.js} +1 -1
- package/dist/client/assets/{use-join-requests-BOmP9iaL.js → use-join-requests-Dt9TMCIO.js} +1 -1
- package/dist/client/assets/{use-main-panel-tabs-DHYkf6om.js → use-main-panel-tabs-B0LD5D_L.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-B6RnyZox.js → use-mcp-auth-status-DlHZx2h4.js} +1 -1
- package/dist/client/assets/{use-mcp-client-D6KtocGH.js → use-mcp-client-B4p5PsQD.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-B3G2hquO.js → use-mcp-prompts-B6aj_cxq.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CpWlYYef.js → use-mcp-tools-CXnljfkB.js} +1 -1
- package/dist/client/assets/{use-members-Dnggi0H6.js → use-members-CtYcpfCh.js} +1 -1
- package/dist/client/assets/{use-mobile-BNDa1qTW.js → use-mobile-Dh8MyBYN.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-CeA0-zHI.js → use-navigate-to-agent-DlSL6F2i.js} +1 -1
- package/dist/client/assets/use-new-blocks-editor-HQ--6Q1A.js +1 -0
- package/dist/client/assets/{use-open-billing-url-Cs9C1v2X.js → use-open-billing-url-DtL_wVY2.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-EfCsoPfs.js → use-org-auth-client-DURj-ul1.js} +1 -1
- package/dist/client/assets/{use-org-fs-DQxdLo5A.js → use-org-fs-CxNjPBxj.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-bfi-YYwW.js → use-org-repo-syncs-CAB_c8N2.js} +1 -1
- package/dist/client/assets/{use-org-sso-rRMaOWUO.js → use-org-sso-o7wDP61N.js} +1 -1
- package/dist/client/assets/{use-organization-roles-CgoQJuMN.js → use-organization-roles-BkOdkr5h.js} +1 -1
- package/dist/client/assets/{use-organization-settings-CwQMCm2X.js → use-organization-settings-DWQ6x2cR.js} +1 -1
- package/dist/client/assets/{use-panel-navigate-CmlT4jEu.js → use-panel-navigate-BKuLVg6a.js} +1 -1
- package/dist/client/assets/{use-project-scope-C7RhDnCk.js → use-project-scope-5CtWl7GN.js} +1 -1
- package/dist/client/assets/{use-releases-CYvBu8aq.js → use-releases-BhZoP6Ng.js} +1 -1
- package/dist/client/assets/{use-reports-diagnostic-BgQmaMqy.js → use-reports-diagnostic-D3Lwse-O.js} +1 -1
- package/dist/client/assets/{use-secrets-1HQ4IAy9.js → use-secrets-9r6yYa06.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-x9UIH6k9.js → use-section-preview-base-DIWbEEZH.js} +1 -1
- package/dist/client/assets/{use-session-runtime-B4jdIOYN.js → use-session-runtime-B8-oCkfr.js} +1 -1
- package/dist/client/assets/{use-tags-BlpOZnWR.js → use-tags-BxTW3RA-.js} +1 -1
- package/dist/client/assets/{use-task-board-analytics-CBvkLBQE.js → use-task-board-analytics-B1xiX_Yt.js} +1 -1
- package/dist/client/assets/{use-task-board-events-C77eTZYe.js → use-task-board-events-B5EnTn3m.js} +1 -1
- package/dist/client/assets/{use-task-metadata-sbP-XuQa.js → use-task-metadata-LDUAaeqf.js} +1 -1
- package/dist/client/assets/{use-thread-analytics-B4Vm3HVL.js → use-thread-analytics-CBxuhPwb.js} +1 -1
- package/dist/client/assets/{use-thread-outputs-9NrRnT-T.js → use-thread-outputs-B4erQwfd.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CT33ZGQJ.js +1 -0
- package/dist/client/assets/{useQueries-N8-1K_Cp.js → useQueries-CI_3SPtT.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-Bu7a9ISW.js +1 -0
- package/dist/client/assets/{users-CDdQNtGh.js → users-CcUhG10I.js} +1 -1
- package/dist/client/assets/{utils-CZUxIVnX.js → utils-BZ6AqxWQ.js} +1 -1
- package/dist/client/assets/{variant-calendar-BjExOmBY.js → variant-calendar-Dhrw7NO4.js} +1 -1
- package/dist/client/assets/{variant-matcher-override-DXlQIHF1.js → variant-matcher-override-DKsgVjHd.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-BVZCIAk6.js → view-mode-toggle-BFlIWoM5.js} +1 -1
- package/dist/client/assets/{virtual-mcp-oZFwaeGo.js → virtual-mcp-DF2PBYsh.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/agent-app-E92-Gy6a.js +0 -1
- package/dist/client/assets/agent-deck-D_fZUZQS.js +0 -1
- package/dist/client/assets/agent-library-BPINonmt.js +0 -1
- package/dist/client/assets/agent-library-file-AVdvAedU.js +0 -1
- package/dist/client/assets/agent-settings-DUPHIZdv.js +0 -1
- package/dist/client/assets/agent-site-editor-code-CHA17hBZ.js +0 -2
- package/dist/client/assets/agent-view-CCGzL59P.js +0 -1
- package/dist/client/assets/api-keys-BOftoTw7.js +0 -1
- package/dist/client/assets/flat-project-BLTCXO4n.js +0 -1
- package/dist/client/assets/library--ZJ93w6z.js +0 -1
- package/dist/client/assets/openai-conversation-DxP6q00m.js +0 -3
- package/dist/client/assets/project-reports-D5pkTXWX.js +0 -1
- package/dist/client/assets/project-tasks-BjPlWRGd.js +0 -1
- package/dist/client/assets/record-editor-M_ekBwOD.js +0 -1
- package/dist/client/assets/reports-DVnyqFgQ.js +0 -1
- package/dist/client/assets/route-D5lOE-ik.js +0 -1
- package/dist/client/assets/tasks-Csv_fiFp.js +0 -1
- package/dist/client/assets/use-new-blocks-editor-CodmWGli.js +0 -1
- package/dist/client/assets/useInfiniteQuery-CkFqoTC5.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BOArJQiA.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 Se,j as n,m as xs,K as Pt,l as be,r as $,h as lt,B as _e,o as To,e as Bo,t as me,a2 as js,aF as St,aN as bt,F as It,aG as Fs,H as Rt,I as Ft,aA as Eo,U as _o,V as Do,G as Je,ak as Tt,al as ds,ag as Ao,X as $o,u as Sn,aL as He}from"./index-CF33tV9H.js";import{A as Lo}from"./agent-view-guard-BfjHuZPk.js";import{F as Oo}from"./feature-gate-CYQFZ14_.js";import{u as Bt,b as wn}from"./chat-context-BwDW_kfn.js";import{i as Wt}from"./AlertCircle-LgH1QoTd.js";import{I as Io,T as Nn,U as et,V as Cn,W as ks,X as Ro,Y as Pn,Z as Fo,b as Kt,O as Tn,_ as Ko,$ as zo,a0 as wt,a1 as Mo,a2 as Vo,n as Go,a3 as Uo,a4 as Bn,a5 as Ho,a6 as qo,a7 as Jo,l as Ks,a8 as Wo,G as En}from"./agent-icon-DOuarSUR.js";import{a as _n,i as Ss,d as zs}from"./UserSquare-Dbf0yjYU.js";import{b as Dn,i as An}from"./ZoomOut-gxmwr3p2.js";import{c as $n,i as Yo}from"./XClose-e3DY7fD7.js";import{s as ws}from"./Plus-CoCopPFe.js";import{t as Ln}from"./Users01-DlQODEmu.js";import{f as Qo,e as Xo,b as Zo,A as ea,a as ta,d as sa,c as na,g as oa}from"./alert-dialog-HXdE5Gnc.js";import{S as Yt}from"./scroll-area-DM1jN7ke.js";import{T as We,a as Ye,b as Qe}from"./tooltip-BipEhILt.js";import{B as nt}from"./badge-BX9BIMvF.js";import{S as us,n as aa,c as la,g as On,B as ms,P as ia,h as In,o as ra,i as gs,s as ca,u as Qt,l as da,q as ua,R as ma,t as Rn,r as fa,v as pa,d as Fn,w as ha,x as xa,y as Kn,z as ga,M as ba,j as ya,A as va,p as ja,C as ka,D as Sa,e as wa,f as Na,E as Ms,F as zn,k as Ca,G as Pa}from"./runnable-block-editor-Col2LSMj.js";import{r as Ns,S as Ta,m as Cs,i as Ba,o as Ea,q as _a,n as Lt,v as Da,R as Mn,t as Aa,l as $a,w as La,x as Oa,y as Vs,G as Ps,g as Ia,z as Ra,e as Gs,A as Fa,d as Ka,B as za,D as Us,h as Ma,E as Va,F as Ga}from"./claim-phase-copy-lXnLa3JE.js";import{u as Vn,P as Ua}from"./mustache-CdtnXA29.js";import{n as Gn}from"./ShoppingBag01-Dv73R-S1.js";import{t as ft}from"./ChevronUp-JJQ1R76T.js";import{C as Ha,a as qa,b as Ja}from"./collapsible-D2v2kHCp.js";import{c as Wa,d as Ya}from"./sandbox-lifecycle-context-DAbyS7JV.js";import{u as Un}from"./use-session-runtime-B4jdIOYN.js";import{c as pt,d as it,e as ht,b as rt,D as ct,h as zt,a as Qa}from"./dialog-BTrZTHUg.js";import{I as Xe}from"./input-AjjN82QQ.js";import{C as Xt}from"./checkbox-BSRHWuev.js";import{L as ze}from"./label-BbaxSm2e.js";import{c as Xa,b as Za,a as el,d as tl,S as sl}from"./select-BcXaErmA.js";import{o as nl}from"./sandbox-git-api-B1R0585s.js";import{b as Hs}from"./sandbox-url-D3mC8qhT.js";import{a as qs}from"./utils-CZUxIVnX.js";import{i as ol}from"./CheckCircle-B2FtFP_M.js";import{s as Ts}from"./Trash01-Cn3n-zZO.js";import{i as fs}from"./Upload01-DGQb_EA3.js";import{E as al}from"./empty-state-C0rOaw8I.js";import{T as Ot}from"./textarea-BCrT32Yf.js";import{u as ll}from"./use-ai-providers-nujHT3kc.js";import{M as Hn}from"./monaco-editor-DQWxb8wg.js";import{i as Bs}from"./X-C31L8F55.js";import{f as qn,a as il}from"./repository-binding-BoCSsnZc.js";import"./rich-text-link-control-DHPpV00b.js";import{a as rl}from"./Copy01-DLl7IkAX.js";import{c as cl}from"./Tool01-Cmx87k3R.js";import{b as Js}from"./use-project-scope-C7RhDnCk.js";import{E as dl}from"./empty-state-2J_TOd9y.js";import{G as Ws}from"./repository-picker-8D1UXDg3.js";import{R as ul}from"./repository-import-picker-BVazJzzA.js";import{b as ml}from"./thread-route-CRN5C0rz.js";function fl(t){const e=ae.c(18),{title:s,description:o,children:a}=t,l=Se();let i;e[0]!==a?(i=n.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=n.jsx(Io,{}),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=n.jsxs(nt,{variant:"secondary",children:[c,r]}),e[5]=r,e[6]=d):d=e[6];let p;e[7]!==s?(p=n.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&&n.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=n.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/60 p-6 backdrop-blur-sm",children:n.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=n.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 pl(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([o])=>!e.includes(o)));return Object.keys(s).length>0?{...t,properties:s}:t}function hl(t,e,s){return typeof t!="string"?null:pl(Ns(t,e),s)}function Jn(t,e,s){if(!e||typeof t!="string")return!1;const o=hl(t,e,s);return!!o&&Object.keys(o.properties??{}).length>0}function yt(t){const e=ae.c(6),{hasItems:s,emptyLabel:o,emptyHint:a}=t;let l;e[0]!==a||e[1]!==o||e[2]!==s?(l=s?"No results match your search.":n.jsxs(n.Fragment,{children:[n.jsx("div",{children:o}),n.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=n.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 Zt(t,e){return`${t}-${e}`}function Wn(t,e){return`site/apps/${t}/${e}.ts`}function Yn(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function xl(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function gl(t){return t==="local"?"Custom":"Installed"}function Qn(t,e,s){const o=new Set([Zt(t,e),e].map(l=>l.toLowerCase())),a=Wn(t,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 bl(t,e){const s=t.vendor.alias,o=t.name,a=Qn(s,o,e);return{id:Zt(s,o),app:o,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:Wn(s,o),blockKey:a,installed:a!==null}}function yl(t,e,s){if(t===Ta)return null;const o=Yn(t);if(!o)return null;const{vendor:a,app:l}=o,i=Qn(a,l,s),c=Cs(t,e);return{id:Zt(a,l),app:l,vendor:a,title:c.title??l,description:c.description??"",category:"Others",logo:c.logo??c.icon,resolveType:t,blockKey:i,installed:i!==null}}function vl(t,e,s){const o=e.__resolveType;if(typeof o!="string"||Ba(t,e)||!Ea(o))return null;const a=Yn(o)??xl(t);if(!a)return null;const l=Cs(o,s),{vendor:i,app:c}=a;return{id:Zt(i,c),app:c,vendor:i,title:l.title??_a(t,e,s),description:l.description??"",category:gl(i),logo:l.logo??l.icon,resolveType:o,blockKey:t,installed:!0}}function jl(t,e,s){const o=new Map;for(const l of t){const i=bl(l,s);o.set(i.id,i)}const a=e.manifest?.blocks?.apps??{};for(const l of Object.keys(a)){const i=yl(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=vl(l,i,e);!c||o.has(c.id)||o.set(c.id,c)}return[...o.values()].sort(kl)}function kl(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function Sl(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function wl(t,e,s){const o=ae.c(12),a=s?.enabled??!0;let l;o[0]===Symbol.for("react.memo_cache_sentinel")?(l=Pt.decoApps(),o[0]=l):l=o[0];let i;o[1]!==a?(i={queryKey:l,queryFn:Sl,staleTime:3e5,retry:1,enabled:a},o[1]=a,o[2]=i):i=o[2];const c=xs(i);let r;o[3]!==e||o[4]!==t||o[5]!==c.data?(r=t&&e?jl(c.data??[],t,e):[],o[3]=e,o[4]=t,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 Nl=["sections","apps","loaders","actions"];function Cl(t){const e=ae.c(59),{active:s,counts:o,showBlog:a,onSelect:l}=t,i=Se();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=n.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:n.jsx("span",{className:"text-sm font-medium",children: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=n.jsx(Re,{id:"pages",icon:_n,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=n.jsx(Re,{id:"redirects",icon:Nn,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=n.jsx(Re,{id:"site",icon:Ro,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 w;e[26]!==l||e[27]!==v||e[28]!==j?(w=n.jsx(Re,{id:"seo",icon:Pn,label:v,active:j,onSelect:l}),e[26]=l,e[27]=v,e[28]=j,e[29]=w):w=e[29];let C;e[30]!==i?(C=i("sandbox.collectionsSidebar.calendar"),e[30]=i,e[31]=C):C=e[31];const E=s==="calendar";let B;e[32]!==l||e[33]!==C||e[34]!==E?(B=n.jsx(Re,{id:"calendar",icon:Fo,label:C,active:E,onSelect:l}),e[32]=l,e[33]=C,e[34]=E,e[35]=B):B=e[35];let k;e[36]!==s||e[37]!==o||e[38]!==l?(k=n.jsx(Pl,{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&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[n.jsx(Gn,{size:13,className:"shrink-0"}),i("sandbox.collectionsSidebar.blog")]}),n.jsx(Re,{id:"context",icon:et,label:i("sandbox.collectionsSidebar.context"),active:s==="context",onSelect:l}),n.jsx(Re,{id:"posts",icon:Dn,label:i("sandbox.collectionsSidebar.posts"),count:o.posts,active:s==="posts",onSelect:l}),n.jsx(Re,{id:"authors",icon:Ln,label:i("sandbox.collectionsSidebar.authors"),count:o.authors,active:s==="authors",onSelect:l}),n.jsx(Re,{id:"categories",icon:Cn,label:i("sandbox.collectionsSidebar.categories"),count:o.categories,active:s==="categories",onSelect:l}),n.jsx(Re,{id:"post-schedule",icon:ks,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]!==w||e[50]!==B||e[51]!==k||e[52]!==D||e[53]!==m||e[54]!==f?(O=n.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[m,f,y,w,B,k,D]}),e[48]=y,e[49]=w,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=n.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 Pl(t){const e=ae.c(52),{active:s,counts:o,onSelect:a}=t,l=Se();let i;e[0]!==s?(i=Nl.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=be("flex w-full items-center gap-2 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=n.jsx(Ko,{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=n.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=be("shrink-0 text-muted-foreground/70 transition-transform",g),e[8]=g,e[9]=x):x=e[9];let y;e[10]!==x?(y=n.jsx(ft,{size:16,className:x}),e[10]=x,e[11]=y):y=e[11];let v;e[12]!==f||e[13]!==y?(v=n.jsxs(Ha,{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 w=s==="sections";let C;e[17]!==o.sections||e[18]!==a||e[19]!==j||e[20]!==w?(C=n.jsx(Re,{id:"sections",icon:Kt,label:j,count:o.sections,active:w,onSelect:a,indent:!0}),e[17]=o.sections,e[18]=a,e[19]=j,e[20]=w,e[21]=C):C=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=n.jsx(Re,{id:"apps",icon:$n,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=n.jsx(Re,{id:"loaders",icon:Tn,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?(_=n.jsx(Re,{id:"actions",icon:An,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]!==C||e[44]!==k||e[45]!==L||e[46]!==_?(A=n.jsxs(qa,{className:"flex flex-col gap-0.5 pt-0.5",children:[C,k,L,_]}),e[43]=C,e[44]=k,e[45]=L,e[46]=_,e[47]=A):A=e[47];let I;return e[48]!==p||e[49]!==A||e[50]!==v?(I=n.jsxs(Ja,{open:p,onOpenChange:d,children:[v,A]}),e[48]=p,e[49]=A,e[50]=v,e[51]=I):I=e[51],I}function Re(t){const e=ae.c(19),{id:s,icon:o,label:a,count:l,active:i,onSelect:c,indent:r}=t;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=be("flex w-full items-center gap-2 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=n.jsx(o,{size:16,className:"shrink-0"}),e[6]=o,e[7]=u):u=e[7];let f;e[8]!==a?(f=n.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&&n.jsx("span",{className:be("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=n.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 Tl(t){const e=ae.c(12),{state:s,claimPhase:o,lifecycle:a,onStart:l,connectionsHref:i}=t;switch(s.kind){case"starting":{let c;e[0]!==o||e[1]!==a?(c=aa({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=n.jsx(us,{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=n.jsx(us,{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=n.jsx(us,{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 Bl=new Set(["clone-failed","install-failed","start-failed","crashed"]);function El(t){if(t.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(t.previewState.kind!=="iframe")return{kind:"sandbox-card",state:t.previewState};const e=t.lifecyclePhase==="running",s=!e&&!Bl.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function Ys(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),o=`${s} (copy)`;if(!t.has(o))return o;for(let a=2;a<1e3;a++){const l=`${s} (copy ${a})`;if(!t.has(l))return l}return`${s} (copy ${Date.now()})`}function _l(t,e){const s=Lt,o=e.replace(/-copy(?:-\d+)?$/,""),a=`${o}-copy`;if(!t.has(s(a)))return a;for(let l=2;l<1e3;l++){const i=`${o}-copy-${l}`;if(!t.has(s(i)))return i}return`${o}-copy-${Date.now()}`}function Dl(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),o=`${s}_copy`;if(!Object.hasOwn(t,o))return o;for(let a=2;a<1e3;a++){const l=`${s}_copy_${a}`;if(!Object.hasOwn(t,l))return l}return`${s}_copy_${Date.now()}`}function Al(t){const e=On(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function $l(t,e){return la(t,e)}const Ll=1e3;function Ol(t,e){for(let s=0;s<Ll;s++){const o=On(e);if(!Object.hasOwn(t,o))return o}throw new Error("Could not generate a unique page block key")}const Il={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},Rl={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},Fl={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function Kl(t){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}=t,h=i===void 0?!1:i,u=Se(),[f,g]=$.useState(a),[x,y]=$.useState(l),[v,j]=$.useState(ms),[w,C]=$.useState(null),[E,B]=$.useState(s);s!==E&&(B(s),s&&(g(a),y(l),j(ms),C(null)));const k=o==="create"&&!!r?.length;let D;e[0]!==h||e[1]!==m?(D=pe=>{!pe&&!h&&(C(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 we=Da(he);if(we){C(we);return}const Pe=d?.({name:ke,path:he});if(Pe){C(Pe);return}C(null),await p({name:ke,path:he,templateKey:k&&v!==ms?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=w??c,_=Il[o];let A;e[11]!==u||e[12]!==_?(A=u(_),e[11]=u,e[12]=_,e[13]=A):A=e[13];let I;e[14]!==A?(I=n.jsx(pt,{children:n.jsx(it,{children:A})}),e[14]=A,e[15]=I):I=e[15];let R;e[16]!==h||e[17]!==k||e[18]!==u||e[19]!==v||e[20]!==r?(R=k&&n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:u("sandbox.pageFormDialog.labelTemplate")}),n.jsx(ia,{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]=R):R=e[21];let G;e[22]!==u?(G=u("sandbox.pageFormDialog.labelName"),e[22]=u,e[23]=G):G=e[23];let z;e[24]!==G?(z=n.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:G}),e[24]=G,e[25]=z):z=e[25];let W;e[26]===Symbol.for("react.memo_cache_sentinel")?(W=pe=>g(pe.target.value),e[26]=W):W=e[26];let T;e[27]!==u?(T=u("sandbox.pageFormDialog.placeholderName"),e[27]=u,e[28]=T):T=e[28];let U;e[29]!==h||e[30]!==f||e[31]!==T?(U=n.jsx(Xe,{id:"page-form-name",value:f,onChange:W,placeholder:T,autoFocus:!0,disabled:h}),e[29]=h,e[30]=f,e[31]=T,e[32]=U):U=e[32];let Y;e[33]!==U||e[34]!==z?(Y=n.jsxs("div",{className:"space-y-1.5",children:[z,U]}),e[33]=U,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=n.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 de;e[40]===Symbol.for("react.memo_cache_sentinel")?(de=pe=>y(pe.target.value),e[40]=de):de=e[40];let ne;e[41]!==u?(ne=u("sandbox.pageFormDialog.placeholderPath"),e[41]=u,e[42]=ne):ne=e[42];let ue;e[43]!==h||e[44]!==x||e[45]!==ne?(ue=n.jsx(Xe,{id:"page-form-path",value:x,onChange:de,placeholder:ne,disabled:h}),e[43]=h,e[44]=x,e[45]=ne,e[46]=ue):ue=e[46];let te;e[47]!==X||e[48]!==ue?(te=n.jsxs("div",{className:"space-y-1.5",children:[X,ue]}),e[47]=X,e[48]=ue,e[49]=te):te=e[49];let re;e[50]!==F?(re=F&&n.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]!==R?(le=n.jsxs("div",{className:"space-y-4 py-4",children:[R,Y,te,re]}),e[52]=Y,e[53]=te,e[54]=re,e[55]=R,e[56]=le):le=e[56];let N;e[57]!==m?(N=()=>m(!1),e[57]=m,e[58]=N):N=e[58];let J;e[59]!==u?(J=u("sandbox.pageFormDialog.buttonCancel"),e[59]=u,e[60]=J):J=e[60];let Z;e[61]!==h||e[62]!==N||e[63]!==J?(Z=n.jsx(_e,{type:"button",variant:"outline",onClick:N,disabled:h,children:J}),e[61]=h,e[62]=N,e[63]=J,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?n.jsxs(n.Fragment,{children:[n.jsx(lt,{className:"size-3.5"}),u(Fl[o])]}):u(Rl[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=n.jsx(_e,{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=n.jsxs(ht,{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]!==I?(ie=n.jsx(rt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:K,children:[I,le,H]})}),e[79]=K,e[80]=le,e[81]=H,e[82]=I,e[83]=ie):ie=e[83];let ve;return e[84]!==O||e[85]!==s||e[86]!==ie?(ve=n.jsx(ct,{open:s,onOpenChange:O,children:ie}),e[84]=O,e[85]=s,e[86]=ie,e[87]=ve):ve=e[87],ve}const zl=[{value:"temporary",labelKey:"sandbox.redirectEditor.typeTemporary"},{value:"permanent",labelKey:"sandbox.redirectEditor.typePermanent"}],Qs={from:"",to:"",type:"temporary",discardQueryParameters:!1};function Ml(t){const e=ae.c(111),{open:s,isPending:o,error:a,onSubmit:l,onOpenChange:i}=t,c=o===void 0?!1:o,r=Se(),[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(),Fe=d.to.trim();if(!$e||!Fe||c){h(r("sandbox.redirectFormDialog.errorRequired"));return}h(null),await l({...d,from:$e,to:Fe})},e[4]=c,e[5]=l,e[6]=d,e[7]=r,e[8]=j):j=e[8];const w=j,C=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=n.jsx(pt,{children:n.jsx(it,{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=n.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=n.jsx(Xe,{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 I;e[28]!==A||e[29]!==L?(I=n.jsxs("div",{className:"space-y-1.5",children:[L,A]}),e[28]=A,e[29]=L,e[30]=I):I=e[30];let R;e[31]!==r?(R=r("sandbox.redirectEditor.toLabel"),e[31]=r,e[32]=R):R=e[32];let G;e[33]!==R?(G=n.jsx(ze,{htmlFor:"redirect-form-to",children:R}),e[33]=R,e[34]=G):G=e[34];const z=d.to;let W;e[35]===Symbol.for("react.memo_cache_sentinel")?(W=xe=>x({to:xe.target.value}),e[35]=W):W=e[35];let T;e[36]!==r?(T=r("sandbox.redirectEditor.toPlaceholder"),e[36]=r,e[37]=T):T=e[37];let U;e[38]!==c||e[39]!==d.to||e[40]!==T?(U=n.jsx(Xe,{id:"redirect-form-to",value:z,onChange:W,placeholder:T,disabled:c}),e[38]=c,e[39]=d.to,e[40]=T,e[41]=U):U=e[41];let Y;e[42]!==G||e[43]!==U?(Y=n.jsxs("div",{className:"space-y-1.5",children:[G,U]}),e[42]=G,e[43]=U,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=n.jsx(ze,{htmlFor:"redirect-form-type",children:q}),e[47]=q,e[48]=X):X=e[48];const de=d.type;let ne;e[49]===Symbol.for("react.memo_cache_sentinel")?(ne=xe=>x({type:xe}),e[49]=ne):ne=e[49];let ue;e[50]!==r?(ue=r("sandbox.redirectEditor.typePlaceholder"),e[50]=r,e[51]=ue):ue=e[51];let te;e[52]!==ue?(te=n.jsx(Za,{id:"redirect-form-type",className:"w-full",children:n.jsx(el,{placeholder:ue})}),e[52]=ue,e[53]=te):te=e[53];let re;e[54]!==r?(re=zl.map(xe=>n.jsx(Xa,{value:xe.value,children:r(xe.labelKey,{status:Mn[xe.value]})},xe.value)),e[54]=r,e[55]=re):re=e[55];let le;e[56]!==re?(le=n.jsx(tl,{children:re}),e[56]=re,e[57]=le):le=e[57];let N;e[58]!==c||e[59]!==d.type||e[60]!==te||e[61]!==le?(N=n.jsxs(sl,{value:de,onValueChange:ne,disabled:c,children:[te,le]}),e[58]=c,e[59]=d.type,e[60]=te,e[61]=le,e[62]=N):N=e[62];let J;e[63]!==X||e[64]!==N?(J=n.jsxs("div",{className:"space-y-1.5",children:[X,N]}),e[63]=X,e[64]=N,e[65]=J):J=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=n.jsx(Xt,{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=n.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=n.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]!==C?(ie=C&&n.jsx("p",{className:"text-xs text-destructive",children:C}),e[77]=C,e[78]=ie):ie=e[78];let ve;e[79]!==I||e[80]!==Y||e[81]!==J||e[82]!==H||e[83]!==ie?(ve=n.jsxs("div",{className:"space-y-4 py-4",children:[I,Y,J,H,ie]}),e[79]=I,e[80]=Y,e[81]=J,e[82]=H,e[83]=ie,e[84]=ve):ve=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=n.jsx(_e,{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 we=!B;let Pe;e[93]!==c||e[94]!==r?(Pe=c?n.jsxs(n.Fragment,{children:[n.jsx(lt,{className:"size-3.5"}),r("sandbox.redirectFormDialog.pending")]}):r("sandbox.redirectFormDialog.submit"),e[93]=c,e[94]=r,e[95]=Pe):Pe=e[95];let Te;e[96]!==we||e[97]!==Pe?(Te=n.jsx(_e,{type:"submit",disabled:we,children:Pe}),e[96]=we,e[97]=Pe,e[98]=Te):Te=e[98];let Ne;e[99]!==he||e[100]!==Te?(Ne=n.jsxs(ht,{children:[he,Te]}),e[99]=he,e[100]=Te,e[101]=Ne):Ne=e[101];let Be;e[102]!==w||e[103]!==ve||e[104]!==Ne||e[105]!==D?(Be=n.jsx(rt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:w,children:[D,ve,Ne]})}),e[102]=w,e[103]=ve,e[104]=Ne,e[105]=D,e[106]=Be):Be=e[106];let De;return e[107]!==v||e[108]!==s||e[109]!==Be?(De=n.jsx(ct,{open:s,onOpenChange:v,children:Be}),e[107]=v,e[108]=s,e[109]=Be,e[110]=De):De=e[110],De}function Vl(t){const e=ae.c(70),{open:s,blockKey:o,initialName:a,isPending:l,onSubmit:i,onOpenChange:c}=t,r=l===void 0?!1:l,d=Se(),[p,m]=$.useState(a),[h,u]=$.useState(s);s!==h&&(u(s),s&&m(a));let f;e[0]!==r||e[1]!==c?(f=de=>{!de&&!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 de=>{de.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=n.jsx(it,{children:v}),e[9]=v,e[10]=j):j=e[10];let w;e[11]!==d?(w=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=w):w=e[12];let C;e[13]!==w?(C=n.jsx(zt,{children:w}),e[13]=w,e[14]=C):C=e[14];let E;e[15]!==j||e[16]!==C?(E=n.jsxs(pt,{children:[j,C]}),e[15]=j,e[16]=C,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=n.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=de=>m(de.target.value),e[22]=D):D=e[22];let O;e[23]!==r||e[24]!==p?(O=n.jsx(Xe,{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=n.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=n.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?(_=n.jsx(Xe,{value:o,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=o,e[34]=_):_=e[34];let A;e[35]!==F||e[36]!==_?(A=n.jsxs("div",{className:"space-y-1.5",children:[F,_]}),e[35]=F,e[36]=_,e[37]=A):A=e[37];let I;e[38]!==L||e[39]!==A?(I=n.jsxs("div",{className:"space-y-4 py-4",children:[L,A]}),e[38]=L,e[39]=A,e[40]=I):I=e[40];let R;e[41]!==c?(R=()=>c(!1),e[41]=c,e[42]=R):R=e[42];let G;e[43]!==d?(G=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=G):G=e[44];let z;e[45]!==r||e[46]!==R||e[47]!==G?(z=n.jsx(_e,{type:"button",variant:"outline",onClick:R,disabled:r,children:G}),e[45]=r,e[46]=R,e[47]=G,e[48]=z):z=e[48];let W;e[49]!==r||e[50]!==p?(W=!p.trim()||r,e[49]=r,e[50]=p,e[51]=W):W=e[51];let T;e[52]!==r||e[53]!==d?(T=r?n.jsxs(n.Fragment,{children:[n.jsx(lt,{className:"size-3.5"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=r,e[53]=d,e[54]=T):T=e[54];let U;e[55]!==W||e[56]!==T?(U=n.jsx(_e,{type:"submit",disabled:W,children:T}),e[55]=W,e[56]=T,e[57]=U):U=e[57];let Y;e[58]!==z||e[59]!==U?(Y=n.jsxs(ht,{children:[z,U]}),e[58]=z,e[59]=U,e[60]=Y):Y=e[60];let q;e[61]!==y||e[62]!==I||e[63]!==Y||e[64]!==E?(q=n.jsx(rt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:y,children:[E,I,Y]})}),e[61]=y,e[62]=I,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=n.jsx(ct,{open:s,onOpenChange:g,children:q}),e[66]=g,e[67]=s,e[68]=q,e[69]=X):X=e[69],X}function Gl(t){const e=ae.c(7),{type:s}=t,o=Mn[s];let a;e[0]!==o?(a=n.jsx(We,{asChild:!0,children:n.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=n.jsx(Ye,{side:"left",children:l}),e[2]=l,e[3]=i):i=e[3];let c;return e[4]!==a||e[5]!==i?(c=n.jsxs(Qe,{children:[a,i]}),e[4]=a,e[5]=i,e[6]=c):c=e[6],c}const Ul=60,ps={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Es=["posts","authors","categories"],Nt={posts:"post",authors:"author",categories:"category"};function ot(t){return Es.includes(t)}const es={posts:"post",authors:"author",categories:"category"},Xn={posts:ps.post,authors:ps.author,categories:ps.category},Hl=Object.fromEntries(Object.entries(Xn).map(([t,e])=>[e,t]));function ql(t){return typeof t=="string"?Hl[t]??null:null}function Ie(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function ee(t){return typeof t=="string"?t:""}function Jl(t,e){switch(t){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=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Zn(t){const e={posts:[],authors:[],categories:[]};for(const[s,o]of Object.entries(t)){const a=Ie(o);if(!a)continue;const l=ql(a.__resolveType);if(!l)continue;const i=Ie(a[es[l]])??{},{label:c,subtitle:r}=Jl(l,i);e[l].push({key:s,kind:l,label:c,subtitle:r})}for(const s of Es)e[s].sort((o,a)=>o.label.localeCompare(a.label));return e}function Wl(t,e){return Zn(t)[e]}function Ge(t,e){return Wl(t,e).map(s=>({key:s.key,payload:dt(Ie(t[s.key])??void 0,e)}))}const Xs=Object.freeze({});function dt(t,e){return t?Ie(t[es[e]])??Xs:Xs}function at(t,e,s){return{name:t,__resolveType:Xn[e],[es[e]]:s}}function ud({records:t,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?t.find(({payload:x})=>ee(x[s])===u):void 0;if(f)return f;const g=i(h);return g?t.find(({payload:x})=>ee(x.name)===g):void 0},r=t.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=t.find(g=>g.key===u);return f?o(f.payload):d.get(u)}).filter(u=>u!==void 0)}}function Ze(t){return Array.isArray(t)?t:[]}function st(t){if(typeof t=="string")return t;const e=Ie(t);return e?ee(e.slug):""}function eo(t){if(typeof t=="string")return t;const e=Ie(t);return e?ee(e.email):""}function _s(t){const e=[];return ee(t.title).trim()||e.push("Title"),ee(t.slug).trim()||e.push("Slug"),Ze(t.categories).map(st).filter(Boolean).length===0&&e.push("Category"),ee(t.excerpt).trim()||e.push("Excerpt"),ee(t.image).trim()||e.push("Cover image"),e}const Ds=["draft","generating","awaiting_review","scheduled","published","archived"],to=8;function Et(t){switch(ee(t.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 Yl(t,e){return e!=="published"&&e!=="scheduled"||Et(t)===e?!1:_s(t).length>0}function Ql(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,to).toISOString()}function Mt(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const o=ee(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(o).getTime())?Ql(s):o}}function so(t){return Ge(t,"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:Ze(s.categories).map(st).filter(Boolean),authorEmails:Ze(s.authors).map(eo).filter(Boolean),missing:_s(s),status:Et(s),form:"live"}))}const no="blog-manager/posts/";function oo(t){return t.startsWith(no)}function Ct(t){return t.split("/").pop()??t}function Vt(t){return`${no}${t}`}function Xl(t){return`collections/blog/posts/${t}`}function bs(){return xt(12)}function Zl(t){const e=Ie(t.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 ao(t){return{title:t.title,slug:"",excerpt:"",date:t.now.toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[],status:"draft",planning:t.planning??{}}}function ut(t,e){return{name:t,[es.posts]:e}}function md(t,e){return oo(t)?ut(t,e):at(t,"posts",e)}function ei(t){const e=[];for(const[s,o]of Object.entries(t)){if(!oo(s))continue;const a=Ie(o);a&&e.push({key:s,payload:dt(a,"posts")})}return e}function ti(t){return[...ei(t).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:Ze(o.categories).map(st).filter(Boolean),authorEmails:Ze(o.authors).map(eo).filter(Boolean),missing:_s(o),status:Et(o),form:"planning"})),...so(t)]}function si(t,e,s){const o=Mt(t.payload,e,s),a=Ct(t.key),l=e==="scheduled"||e==="published"?"live":"planning",i=l==="live"?Xl(a):Vt(a),c=l==="live"?at(i,"posts",o):ut(i,o);return{writes:{[i]:c},deletes:i===t.key?[]:[t.key]}}function fd(t,e,s){const o=Ze(t.categories);if(!o.some(c=>st(c)===e))return t;const a=o.map(c=>{const r=st(c);return r===e||r===s.slug?{name:s.name,slug:s.slug}:c}),l=new Set,i=a.filter(c=>{const r=st(c);return r?l.has(r)?!1:(l.add(r),!0):!0});return{...t,categories:i}}function ni(t,e){const s=Ze(t.categories);return s.some(o=>st(o)===e)?{...t,categories:s.filter(o=>st(o)!==e)}:t}function oi(t){const e=ee(t.status),s=e==="idea"||e==="in_review"?{status:Et(t)}:{};return{...t,...s,dateModified:new Date().toISOString()}}function xt(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function hs(t,e){const s=`collections/blog/${e}/${xt(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function lo(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${xt(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-${xt(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const ai={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"}},Zs="Box";function li(t){return t.startsWith("site/")?"site":"app"}function ii(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function vt(...t){for(const e of t)if(e!==void 0)return e}function en(t){if(t&&!(t.includes("/")||/\.(tsx?|jsx?)$/.test(t)))return t}function ri(t){const e=t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").trim();return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():t}function io(t){const e=new Set,s=[],o=t.manifest?.blocks??{};for(const a of Object.values(o))for(const l of Object.keys(a)){if(!di(l)||e.has(l))continue;e.add(l);const i=Cs(l,t),c=ts(l),r=ai[c],d=li(l),p=en(i.title),m=en(i.description),h=(d==="site"?vt(p,r?.title):vt(r?.title,p))??ri(c),u=d==="site"?vt(m,r?.description):vt(r?.description,m),f=d==="site"?i.icon:void 0,g=f&&ii(f)?f:void 0,x=g!==void 0?r?.iconName??Zs:vt(f,r?.iconName)??Zs;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 ts(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const ci=["blog/sections/blocks/","site/sections/Blog/Post/"];function di(t){return ci.some(e=>t.startsWith(e))}const As="blog-manager-brand";function Ke(t){if(!Array.isArray(t))return[];const e=[];for(const s of t){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(t){return t.filter(e=>e.name.trim()||e.value.trim())}const ui=6e4,mi=4e3;function fi(t){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(t,"block"),e.join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-editor-BbrLoyhg.js","assets/index-BkwVGG61.js","assets/index-DOdpa4LG.css","assets/chat-context-DON-iHtd.js","assets/use-panel-navigate-BKuLVg6a.js","assets/thread-route-BZugAEv3.js","assets/use-project-scope-5CtWl7GN.js","assets/repository-binding-B1w5M3gR.js","assets/use-mcp-client-B4p5PsQD.js","assets/auth-DYiVP7MT.js","assets/autosend-DdEs0_Ox.js","assets/thread-intent-Dv0pFBsV.js","assets/backoff-8mStPHYB.js","assets/task-board-C6ymciPp.js","assets/schema-DvklMLx3.js","assets/slugify-CEUa2lfQ.js","assets/use-is-desktop-app-BNujXJc_.js","assets/use-decopilot-events-BSl-VzHR.js","assets/use-ai-providers-ox5ll27Z.js","assets/location-DBePU4bz.js","assets/use-organization-settings-DWQ6x2cR.js","assets/scroll-area-BVufpFEW.js","assets/select-Bk77xGJr.js","assets/index-cy7uuLPR.js","assets/Check-CP73h7yQ.js","assets/ChevronUp-CIZg0YhK.js","assets/use-section-preview-base-DIWbEEZH.js","assets/UserSquare-k-BSPAbI.js","assets/agent-icon-Dnnu07Dp.js","assets/AlertCircle-CPQSuuWk.js","assets/Tool01-Cr3g7eFI.js","assets/ArrowUp-BTBhPpEu.js","assets/ArrowLeft-Bvd89_b4.js","assets/ArrowRight-n-IJ4Fik.js","assets/ShoppingBag01-DskCGm9K.js","assets/ZoomOut-Dv2fO7S6.js","assets/Palette-edCnzPtR.js","assets/CheckCircle-BpnJdBCF.js","assets/Copy01-YoGcseNZ.js","assets/CreditCard01-C-9IP3Dn.js","assets/DotsVertical-_UiBrHHr.js","assets/Image01-C_d_m-XY.js","assets/XClose-DeW6TQBh.js","assets/Key01-Di5njQWH.js","assets/Link01-BzReMq2w.js","assets/LinkExternal01-CuSjyiN1.js","assets/Monitor01-C8qvsEmS.js","assets/Sun-CPwiYds_.js","assets/Plus-BPVcSaQ1.js","assets/SearchMd-CQ_uV2jU.js","assets/Trash01-DsSqN_Va.js","assets/Upload01-CsCOoftz.js","assets/User01-CFCaTmZh.js","assets/Users01-DeynvlqM.js","assets/X-srLHGSHt.js","assets/dialog-CETaaDWs.js","assets/input-BC8VVwvY.js","assets/use-new-blocks-editor-HQ--6Q1A.js","assets/claim-phase-copy-DR8vjdW9.js","assets/section-preview-url-Csj0_ZDg.js","assets/use-session-runtime-B8-oCkfr.js","assets/runnable-block-editor-DSW-0LCr.js","assets/sandbox-start-errors-BK_aDCyt.js","assets/pair-Bg6eSzpi.js","assets/format-time-CjIPQhCN.js","assets/differenceInSeconds-C3x8sHUj.js","assets/collapsible-EbSIRvil.js","assets/use-copy-CtGMHYLy.js","assets/usage-stats-DFk0NwSH.js","assets/markdown-CzQeLeJo.js","assets/org-file-open-context-B35TDcCu.js","assets/use-mobile-Dh8MyBYN.js","assets/tooltip-F9F0ZScm.js","assets/shell-layout-DOQLZ3dZ.js","assets/avatar-IYCAP9D4.js","assets/download-app-dialog-8Rp12cmh.js","assets/command-CGV8_1wr.js","assets/index-jlKQueRg.js","assets/integration-icon-B3X6G1Wg.js","assets/project-icon-BNmVQ8L_.js","assets/new-project-dialog-CSocvB7L.js","assets/label-1zPphAKx.js","assets/repository-import-picker-DF4pGbwe.js","assets/use-navigate-to-agent-DlSL6F2i.js","assets/repository-picker-DgFy3-3l.js","assets/useInfiniteQuery-CT33ZGQJ.js","assets/infiniteQueryObserver-Da-u5q9x.js","assets/collection-search-DshGdcb0.js","assets/use-debounced-value-Bw9kIjO1.js","assets/required-auth-layout-BY0JzfRF.js","assets/use-org-sso-o7wDP61N.js","assets/shell-layout-CE2Eihra.css","assets/content-blocks-o63cs2vh.js","assets/mcp-app-renderer-DGp0KYfs.js","assets/types-1jfERRTH.js","assets/omit-sandbox-map-jj4lCB2U.js","assets/gateway-client-l5gwlcsP.js","assets/tool-namespace-DmnQIdtF.js","assets/utils-CVEq3hMx.js","assets/sheet-DdorBPzD.js","assets/use-connection-ub_Ste14.js","assets/use-mcp-prompts-B6aj_cxq.js","assets/index-DsOjhcBf.js","assets/form-0lcPxUaV.js","assets/use-thread-outputs-B4erQwfd.js","assets/file-type-icon-BOUS9AkT.js","assets/popover-CmYWPOzN.js","assets/utils-BZ6AqxWQ.js","assets/monaco-editor-DknCndmN.js","assets/editor-DCdz0KkZ.js","assets/calendar-Da7EzsC_.js","assets/textarea-DqtOZ_En.js","assets/rich-text-link-control-YXgXuHt3.js","assets/switch-DwnLjlqL.js","assets/combobox-1x_gJLmD.js","assets/alert-dialog-BFZCPfXf.js","assets/sandbox-url-D3mC8qhT.js","assets/search-input-BUOZ4kam.js","assets/tabs-2VLLco4y.js","assets/use-file-configs-Cm3sO4It.js","assets/asset-utils-DUl4MpZE.js","assets/use-chat-layout-state-zJEW_ZS9.js","assets/site-slug-DebpOoQq.js","assets/toggle-group-BeacaAeg.js","assets/sandbox-git-api-B1R0585s.js","assets/agent-view-guard-CDZZYqXI.js","assets/use-main-panel-tabs-B0LD5D_L.js","assets/use-mcp-tools-CXnljfkB.js","assets/index-Ds19ODXY.js","assets/drawer-BWFufjc5.js","assets/input-BdWjJobT.js","assets/chat-draft-DMzZaSVw.js","assets/use-deco-credits-MhwX_k9L.js","assets/use-open-billing-url-DtL_wVY2.js","assets/decopilot-0B-Wngp1.js","assets/checkbox-tfdkp6cA.js","assets/ai-providers-logos-DD3qZ33J.js","assets/index-5wKgIWMb.js","assets/input-C7EfrFTT.js","assets/suggestion-DIcqp-mJ.js","assets/use-org-fs-CxNjPBxj.js","assets/question-004-sINsf4GQ.js","assets/use-members-CtYcpfCh.js","assets/use-org-auth-client-DURj-ul1.js","assets/feature-paywall-C4yY8Ib4.js","assets/plan-ladder-CDdTsNd1.js","assets/add-connection-dialog-BcjdUiaQ.js","assets/extract-connection-data-CMpFLKxZ.js","assets/metadata-D72DunRR.js","assets/connection-DUhRStgE.js","assets/connection-card-CLQNp13z.js","assets/connection-slug-CITJ0kGN.js","assets/connection-form-helpers-DSaYnQN2.js","assets/authenticate-and-persist-oauth-Fhu72ZVZ.js","assets/mcp-oauth-C_AhA8BD.js","assets/collection-tabs-DZ5NL0dm.js","assets/badge-Bx-goeTE.js","assets/use-infinite-scroll-BnsQBnBU.js","assets/useSuspenseInfiniteQuery-Bu7a9ISW.js","assets/use-task-board-events-B5EnTn3m.js","assets/input-Bwd_JSM8.css","assets/sandbox-lifecycle-context-D2n8i5Gu.js","assets/resolve-tab-icon-D1OGWrhZ.js","assets/use-task-metadata-LDUAaeqf.js","assets/virtual-mcp-DF2PBYsh.js","assets/feature-gate-BFpFz5qO.js","assets/mustache-myD7wuI4.js","assets/empty-state-CCrjb95L.js","assets/empty-state-C1nhEd0-.js","assets/post-editor-DtruhQnc.js","assets/multi-select-BldQfs4n.js","assets/block-document-CudYy7pf.js","assets/index-QMMagPPL.js","assets/use-fast-preview-draft-url-BXtnB34v.js","assets/use-autosave-YctWTqUt.js","assets/record-editor-BRIfWSyG.js","assets/context-BGRn957C.js","assets/index-B937Cf7T.js","assets/get-initials-D-f_fDFw.js","assets/category-editor-SDdqVzYD.js","assets/sections-editor-BTaByHjs.js","assets/page-seo-form-CTgmdwJ8.js","assets/variant-matcher-override-DKsgVjHd.js","assets/seo-editor-BohrAqqO.js","assets/variant-calendar-Dhrw7NO4.js","assets/view-mode-toggle-BFlIWoM5.js","assets/post-calendar-ByuVszdB.js","assets/alert-yU0z8SHT.js","assets/redirect-editor-CcNVHhk0.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as ae,b as Se,j as n,m as xs,K as Pt,l as be,r as $,h as lt,B as _e,o as To,e as Bo,t as me,a2 as js,aF as St,aN as bt,F as It,aG as Fs,H as Rt,I as Ft,aA as Eo,U as _o,V as Do,G as Je,ak as Tt,al as ds,ag as Ao,X as $o,u as Sn,aL as He}from"./index-BkwVGG61.js";import{A as Lo}from"./agent-view-guard-CDZZYqXI.js";import{F as Oo}from"./feature-gate-BFpFz5qO.js";import{u as Bt,b as wn}from"./chat-context-DON-iHtd.js";import{i as Wt}from"./AlertCircle-CPQSuuWk.js";import{I as Io,T as Nn,U as et,V as Cn,W as ks,X as Ro,Y as Pn,Z as Fo,b as Kt,O as Tn,_ as Ko,$ as zo,a0 as wt,a1 as Mo,a2 as Vo,n as Go,a3 as Uo,a4 as Bn,a5 as Ho,a6 as qo,a7 as Jo,l as Ks,a8 as Wo,G as En}from"./agent-icon-Dnnu07Dp.js";import{a as _n,i as Ss,d as zs}from"./UserSquare-k-BSPAbI.js";import{b as Dn,i as An}from"./ZoomOut-Dv2fO7S6.js";import{c as $n,i as Yo}from"./XClose-DeW6TQBh.js";import{s as ws}from"./Plus-BPVcSaQ1.js";import{t as Ln}from"./Users01-DeynvlqM.js";import{f as Qo,e as Xo,b as Zo,A as ea,a as ta,d as sa,c as na,g as oa}from"./alert-dialog-BFZCPfXf.js";import{S as Yt}from"./scroll-area-BVufpFEW.js";import{T as We,a as Ye,b as Qe}from"./tooltip-F9F0ZScm.js";import{B as nt}from"./badge-Bx-goeTE.js";import{S as us,n as aa,c as la,g as On,B as ms,P as ia,h as In,o as ra,i as gs,s as ca,u as Qt,l as da,q as ua,R as ma,t as Rn,r as fa,v as pa,d as Fn,w as ha,x as xa,y as Kn,z as ga,M as ba,j as ya,A as va,p as ja,C as ka,D as Sa,e as wa,f as Na,E as Ms,F as zn,k as Ca,G as Pa}from"./runnable-block-editor-DSW-0LCr.js";import{r as Ns,S as Ta,m as Cs,i as Ba,o as Ea,q as _a,n as Lt,v as Da,R as Mn,t as Aa,l as $a,w as La,x as Oa,y as Vs,G as Ps,g as Ia,z as Ra,e as Gs,A as Fa,d as Ka,B as za,D as Us,h as Ma,E as Va,F as Ga}from"./claim-phase-copy-DR8vjdW9.js";import{u as Vn,P as Ua}from"./mustache-myD7wuI4.js";import{n as Gn}from"./ShoppingBag01-DskCGm9K.js";import{t as ft}from"./ChevronUp-CIZg0YhK.js";import{C as Ha,a as qa,b as Ja}from"./collapsible-EbSIRvil.js";import{c as Wa,d as Ya}from"./sandbox-lifecycle-context-D2n8i5Gu.js";import{u as Un}from"./use-session-runtime-B8-oCkfr.js";import{c as pt,d as it,e as ht,b as rt,D as ct,h as zt,a as Qa}from"./dialog-CETaaDWs.js";import{I as Xe}from"./input-BC8VVwvY.js";import{C as Xt}from"./checkbox-tfdkp6cA.js";import{L as ze}from"./label-1zPphAKx.js";import{c as Xa,b as Za,a as el,d as tl,S as sl}from"./select-Bk77xGJr.js";import{o as nl}from"./sandbox-git-api-B1R0585s.js";import{b as Hs}from"./sandbox-url-D3mC8qhT.js";import{a as qs}from"./utils-BZ6AqxWQ.js";import{i as ol}from"./CheckCircle-BpnJdBCF.js";import{s as Ts}from"./Trash01-DsSqN_Va.js";import{i as fs}from"./Upload01-CsCOoftz.js";import{E as al}from"./empty-state-CCrjb95L.js";import{T as Ot}from"./textarea-DqtOZ_En.js";import{u as ll}from"./use-ai-providers-ox5ll27Z.js";import{M as Hn}from"./monaco-editor-DknCndmN.js";import{i as Bs}from"./X-srLHGSHt.js";import{f as qn,a as il}from"./repository-binding-B1w5M3gR.js";import"./rich-text-link-control-YXgXuHt3.js";import{a as rl}from"./Copy01-YoGcseNZ.js";import{c as cl}from"./Tool01-Cr3g7eFI.js";import{b as Js}from"./use-project-scope-5CtWl7GN.js";import{E as dl}from"./empty-state-C1nhEd0-.js";import{G as Ws}from"./repository-picker-DgFy3-3l.js";import{R as ul}from"./repository-import-picker-DF4pGbwe.js";import{b as ml}from"./thread-route-BZugAEv3.js";function fl(t){const e=ae.c(18),{title:s,description:o,children:a}=t,l=Se();let i;e[0]!==a?(i=n.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=n.jsx(Io,{}),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=n.jsxs(nt,{variant:"secondary",children:[c,r]}),e[5]=r,e[6]=d):d=e[6];let p;e[7]!==s?(p=n.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&&n.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=n.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/60 p-6 backdrop-blur-sm",children:n.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=n.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 pl(t,e){if(!t||!e?.length)return t;const s=Object.fromEntries(Object.entries(t.properties??{}).filter(([o])=>!e.includes(o)));return Object.keys(s).length>0?{...t,properties:s}:t}function hl(t,e,s){return typeof t!="string"?null:pl(Ns(t,e),s)}function Jn(t,e,s){if(!e||typeof t!="string")return!1;const o=hl(t,e,s);return!!o&&Object.keys(o.properties??{}).length>0}function yt(t){const e=ae.c(6),{hasItems:s,emptyLabel:o,emptyHint:a}=t;let l;e[0]!==a||e[1]!==o||e[2]!==s?(l=s?"No results match your search.":n.jsxs(n.Fragment,{children:[n.jsx("div",{children:o}),n.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=n.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 Zt(t,e){return`${t}-${e}`}function Wn(t,e){return`site/apps/${t}/${e}.ts`}function Yn(t){const e=t.match(/^site\/apps\/([^/]+)\/([^/.]+)\.tsx?$/);if(e)return{vendor:e[1],app:e[2]};const s=t.match(/^([^/]+)\/apps\/([^/.]+)\.tsx?$/);return s?{vendor:s[1],app:s[2]}:null}function xl(t){const e=t.match(/^([^-]+)-(.+)$/);return e?{vendor:e[1],app:e[2]}:null}function gl(t){return t==="local"?"Custom":"Installed"}function Qn(t,e,s){const o=new Set([Zt(t,e),e].map(l=>l.toLowerCase())),a=Wn(t,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 bl(t,e){const s=t.vendor.alias,o=t.name,a=Qn(s,o,e);return{id:Zt(s,o),app:o,vendor:s,title:t.title||t.name,description:t.description,category:t.category??"Other",logo:t.logo||void 0,resolveType:Wn(s,o),blockKey:a,installed:a!==null}}function yl(t,e,s){if(t===Ta)return null;const o=Yn(t);if(!o)return null;const{vendor:a,app:l}=o,i=Qn(a,l,s),c=Cs(t,e);return{id:Zt(a,l),app:l,vendor:a,title:c.title??l,description:c.description??"",category:"Others",logo:c.logo??c.icon,resolveType:t,blockKey:i,installed:i!==null}}function vl(t,e,s){const o=e.__resolveType;if(typeof o!="string"||Ba(t,e)||!Ea(o))return null;const a=Yn(o)??xl(t);if(!a)return null;const l=Cs(o,s),{vendor:i,app:c}=a;return{id:Zt(i,c),app:c,vendor:i,title:l.title??_a(t,e,s),description:l.description??"",category:gl(i),logo:l.logo??l.icon,resolveType:o,blockKey:t,installed:!0}}function jl(t,e,s){const o=new Map;for(const l of t){const i=bl(l,s);o.set(i.id,i)}const a=e.manifest?.blocks?.apps??{};for(const l of Object.keys(a)){const i=yl(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=vl(l,i,e);!c||o.has(c.id)||o.set(c.id,c)}return[...o.values()].sort(kl)}function kl(t,e){return t.installed!==e.installed?t.installed?-1:1:t.title.localeCompare(e.title)}async function Sl(){const t=await fetch("/api/deco-apps");if(!t.ok)throw new Error(`Failed to fetch deco apps: ${t.status}`);return(await t.json()).apps??[]}function wl(t,e,s){const o=ae.c(12),a=s?.enabled??!0;let l;o[0]===Symbol.for("react.memo_cache_sentinel")?(l=Pt.decoApps(),o[0]=l):l=o[0];let i;o[1]!==a?(i={queryKey:l,queryFn:Sl,staleTime:3e5,retry:1,enabled:a},o[1]=a,o[2]=i):i=o[2];const c=xs(i);let r;o[3]!==e||o[4]!==t||o[5]!==c.data?(r=t&&e?jl(c.data??[],t,e):[],o[3]=e,o[4]=t,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 Nl=["sections","apps","loaders","actions"];function Cl(t){const e=ae.c(59),{active:s,counts:o,showBlog:a,onSelect:l}=t,i=Se();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=n.jsx("div",{className:"px-3 h-12 flex items-center border-b shrink-0",children:n.jsx("span",{className:"text-sm font-medium",children: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=n.jsx(Re,{id:"pages",icon:_n,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=n.jsx(Re,{id:"redirects",icon:Nn,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=n.jsx(Re,{id:"site",icon:Ro,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 w;e[26]!==l||e[27]!==v||e[28]!==j?(w=n.jsx(Re,{id:"seo",icon:Pn,label:v,active:j,onSelect:l}),e[26]=l,e[27]=v,e[28]=j,e[29]=w):w=e[29];let C;e[30]!==i?(C=i("sandbox.collectionsSidebar.calendar"),e[30]=i,e[31]=C):C=e[31];const E=s==="calendar";let B;e[32]!==l||e[33]!==C||e[34]!==E?(B=n.jsx(Re,{id:"calendar",icon:Fo,label:C,active:E,onSelect:l}),e[32]=l,e[33]=C,e[34]=E,e[35]=B):B=e[35];let k;e[36]!==s||e[37]!==o||e[38]!==l?(k=n.jsx(Pl,{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&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mt-3 flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-medium text-muted-foreground/70",children:[n.jsx(Gn,{size:13,className:"shrink-0"}),i("sandbox.collectionsSidebar.blog")]}),n.jsx(Re,{id:"context",icon:et,label:i("sandbox.collectionsSidebar.context"),active:s==="context",onSelect:l}),n.jsx(Re,{id:"posts",icon:Dn,label:i("sandbox.collectionsSidebar.posts"),count:o.posts,active:s==="posts",onSelect:l}),n.jsx(Re,{id:"authors",icon:Ln,label:i("sandbox.collectionsSidebar.authors"),count:o.authors,active:s==="authors",onSelect:l}),n.jsx(Re,{id:"categories",icon:Cn,label:i("sandbox.collectionsSidebar.categories"),count:o.categories,active:s==="categories",onSelect:l}),n.jsx(Re,{id:"post-schedule",icon:ks,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]!==w||e[50]!==B||e[51]!==k||e[52]!==D||e[53]!==m||e[54]!==f?(O=n.jsxs("nav",{className:"flex flex-col p-1.5 gap-0.5",children:[m,f,y,w,B,k,D]}),e[48]=y,e[49]=w,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=n.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 Pl(t){const e=ae.c(52),{active:s,counts:o,onSelect:a}=t,l=Se();let i;e[0]!==s?(i=Nl.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=be("flex w-full items-center gap-2 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=n.jsx(Ko,{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=n.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=be("shrink-0 text-muted-foreground/70 transition-transform",g),e[8]=g,e[9]=x):x=e[9];let y;e[10]!==x?(y=n.jsx(ft,{size:16,className:x}),e[10]=x,e[11]=y):y=e[11];let v;e[12]!==f||e[13]!==y?(v=n.jsxs(Ha,{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 w=s==="sections";let C;e[17]!==o.sections||e[18]!==a||e[19]!==j||e[20]!==w?(C=n.jsx(Re,{id:"sections",icon:Kt,label:j,count:o.sections,active:w,onSelect:a,indent:!0}),e[17]=o.sections,e[18]=a,e[19]=j,e[20]=w,e[21]=C):C=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=n.jsx(Re,{id:"apps",icon:$n,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=n.jsx(Re,{id:"loaders",icon:Tn,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?(_=n.jsx(Re,{id:"actions",icon:An,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]!==C||e[44]!==k||e[45]!==L||e[46]!==_?(A=n.jsxs(qa,{className:"flex flex-col gap-0.5 pt-0.5",children:[C,k,L,_]}),e[43]=C,e[44]=k,e[45]=L,e[46]=_,e[47]=A):A=e[47];let I;return e[48]!==p||e[49]!==A||e[50]!==v?(I=n.jsxs(Ja,{open:p,onOpenChange:d,children:[v,A]}),e[48]=p,e[49]=A,e[50]=v,e[51]=I):I=e[51],I}function Re(t){const e=ae.c(19),{id:s,icon:o,label:a,count:l,active:i,onSelect:c,indent:r}=t;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=be("flex w-full items-center gap-2 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=n.jsx(o,{size:16,className:"shrink-0"}),e[6]=o,e[7]=u):u=e[7];let f;e[8]!==a?(f=n.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&&n.jsx("span",{className:be("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=n.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 Tl(t){const e=ae.c(12),{state:s,claimPhase:o,lifecycle:a,onStart:l,connectionsHref:i}=t;switch(s.kind){case"starting":{let c;e[0]!==o||e[1]!==a?(c=aa({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=n.jsx(us,{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=n.jsx(us,{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=n.jsx(us,{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 Bl=new Set(["clone-failed","install-failed","start-failed","crashed"]);function El(t){if(t.fastPreviewActive)return{kind:"ready",devServerReady:!1,sandboxWarming:!1};if(t.previewState.kind!=="iframe")return{kind:"sandbox-card",state:t.previewState};const e=t.lifecyclePhase==="running",s=!e&&!Bl.has(t.lifecyclePhase);return{kind:"ready",devServerReady:e,sandboxWarming:s}}function Ys(t,e){const s=e.replace(/\s*\(copy(?:\s+\d+)?\)\s*$/,"").trim(),o=`${s} (copy)`;if(!t.has(o))return o;for(let a=2;a<1e3;a++){const l=`${s} (copy ${a})`;if(!t.has(l))return l}return`${s} (copy ${Date.now()})`}function _l(t,e){const s=Lt,o=e.replace(/-copy(?:-\d+)?$/,""),a=`${o}-copy`;if(!t.has(s(a)))return a;for(let l=2;l<1e3;l++){const i=`${o}-copy-${l}`;if(!t.has(s(i)))return i}return`${o}-copy-${Date.now()}`}function Dl(t,e){const s=e.replace(/_copy(?:_\d+)?$/,""),o=`${s}_copy`;if(!Object.hasOwn(t,o))return o;for(let a=2;a<1e3;a++){const l=`${s}_copy_${a}`;if(!Object.hasOwn(t,l))return l}return`${s}_copy_${Date.now()}`}function Al(t){const e=On(t.newName),s={...t.source,name:t.newName,path:t.newPath};return{key:e,data:s}}function $l(t,e){return la(t,e)}const Ll=1e3;function Ol(t,e){for(let s=0;s<Ll;s++){const o=On(e);if(!Object.hasOwn(t,o))return o}throw new Error("Could not generate a unique page block key")}const Il={create:"sandbox.pageFormDialog.titleCreate",duplicate:"sandbox.pageFormDialog.titleDuplicate",rename:"sandbox.pageFormDialog.titleRename"},Rl={create:"sandbox.pageFormDialog.submitCreate",duplicate:"sandbox.pageFormDialog.submitDuplicate",rename:"sandbox.pageFormDialog.submitSave"},Fl={create:"sandbox.pageFormDialog.pendingCreate",duplicate:"sandbox.pageFormDialog.pendingDuplicate",rename:"sandbox.pageFormDialog.pendingSave"};function Kl(t){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}=t,h=i===void 0?!1:i,u=Se(),[f,g]=$.useState(a),[x,y]=$.useState(l),[v,j]=$.useState(ms),[w,C]=$.useState(null),[E,B]=$.useState(s);s!==E&&(B(s),s&&(g(a),y(l),j(ms),C(null)));const k=o==="create"&&!!r?.length;let D;e[0]!==h||e[1]!==m?(D=pe=>{!pe&&!h&&(C(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 we=Da(he);if(we){C(we);return}const Pe=d?.({name:ke,path:he});if(Pe){C(Pe);return}C(null),await p({name:ke,path:he,templateKey:k&&v!==ms?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=w??c,_=Il[o];let A;e[11]!==u||e[12]!==_?(A=u(_),e[11]=u,e[12]=_,e[13]=A):A=e[13];let I;e[14]!==A?(I=n.jsx(pt,{children:n.jsx(it,{children:A})}),e[14]=A,e[15]=I):I=e[15];let R;e[16]!==h||e[17]!==k||e[18]!==u||e[19]!==v||e[20]!==r?(R=k&&n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("label",{htmlFor:"page-form-template",className:"text-xs font-medium text-muted-foreground",children:u("sandbox.pageFormDialog.labelTemplate")}),n.jsx(ia,{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]=R):R=e[21];let G;e[22]!==u?(G=u("sandbox.pageFormDialog.labelName"),e[22]=u,e[23]=G):G=e[23];let z;e[24]!==G?(z=n.jsx("label",{htmlFor:"page-form-name",className:"text-xs font-medium text-muted-foreground",children:G}),e[24]=G,e[25]=z):z=e[25];let W;e[26]===Symbol.for("react.memo_cache_sentinel")?(W=pe=>g(pe.target.value),e[26]=W):W=e[26];let T;e[27]!==u?(T=u("sandbox.pageFormDialog.placeholderName"),e[27]=u,e[28]=T):T=e[28];let U;e[29]!==h||e[30]!==f||e[31]!==T?(U=n.jsx(Xe,{id:"page-form-name",value:f,onChange:W,placeholder:T,autoFocus:!0,disabled:h}),e[29]=h,e[30]=f,e[31]=T,e[32]=U):U=e[32];let Y;e[33]!==U||e[34]!==z?(Y=n.jsxs("div",{className:"space-y-1.5",children:[z,U]}),e[33]=U,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=n.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 de;e[40]===Symbol.for("react.memo_cache_sentinel")?(de=pe=>y(pe.target.value),e[40]=de):de=e[40];let ne;e[41]!==u?(ne=u("sandbox.pageFormDialog.placeholderPath"),e[41]=u,e[42]=ne):ne=e[42];let ue;e[43]!==h||e[44]!==x||e[45]!==ne?(ue=n.jsx(Xe,{id:"page-form-path",value:x,onChange:de,placeholder:ne,disabled:h}),e[43]=h,e[44]=x,e[45]=ne,e[46]=ue):ue=e[46];let te;e[47]!==X||e[48]!==ue?(te=n.jsxs("div",{className:"space-y-1.5",children:[X,ue]}),e[47]=X,e[48]=ue,e[49]=te):te=e[49];let re;e[50]!==F?(re=F&&n.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]!==R?(le=n.jsxs("div",{className:"space-y-4 py-4",children:[R,Y,te,re]}),e[52]=Y,e[53]=te,e[54]=re,e[55]=R,e[56]=le):le=e[56];let N;e[57]!==m?(N=()=>m(!1),e[57]=m,e[58]=N):N=e[58];let J;e[59]!==u?(J=u("sandbox.pageFormDialog.buttonCancel"),e[59]=u,e[60]=J):J=e[60];let Z;e[61]!==h||e[62]!==N||e[63]!==J?(Z=n.jsx(_e,{type:"button",variant:"outline",onClick:N,disabled:h,children:J}),e[61]=h,e[62]=N,e[63]=J,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?n.jsxs(n.Fragment,{children:[n.jsx(lt,{className:"size-3.5"}),u(Fl[o])]}):u(Rl[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=n.jsx(_e,{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=n.jsxs(ht,{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]!==I?(ie=n.jsx(rt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:K,children:[I,le,H]})}),e[79]=K,e[80]=le,e[81]=H,e[82]=I,e[83]=ie):ie=e[83];let ve;return e[84]!==O||e[85]!==s||e[86]!==ie?(ve=n.jsx(ct,{open:s,onOpenChange:O,children:ie}),e[84]=O,e[85]=s,e[86]=ie,e[87]=ve):ve=e[87],ve}const zl=[{value:"temporary",labelKey:"sandbox.redirectEditor.typeTemporary"},{value:"permanent",labelKey:"sandbox.redirectEditor.typePermanent"}],Qs={from:"",to:"",type:"temporary",discardQueryParameters:!1};function Ml(t){const e=ae.c(111),{open:s,isPending:o,error:a,onSubmit:l,onOpenChange:i}=t,c=o===void 0?!1:o,r=Se(),[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(),Fe=d.to.trim();if(!$e||!Fe||c){h(r("sandbox.redirectFormDialog.errorRequired"));return}h(null),await l({...d,from:$e,to:Fe})},e[4]=c,e[5]=l,e[6]=d,e[7]=r,e[8]=j):j=e[8];const w=j,C=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=n.jsx(pt,{children:n.jsx(it,{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=n.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=n.jsx(Xe,{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 I;e[28]!==A||e[29]!==L?(I=n.jsxs("div",{className:"space-y-1.5",children:[L,A]}),e[28]=A,e[29]=L,e[30]=I):I=e[30];let R;e[31]!==r?(R=r("sandbox.redirectEditor.toLabel"),e[31]=r,e[32]=R):R=e[32];let G;e[33]!==R?(G=n.jsx(ze,{htmlFor:"redirect-form-to",children:R}),e[33]=R,e[34]=G):G=e[34];const z=d.to;let W;e[35]===Symbol.for("react.memo_cache_sentinel")?(W=xe=>x({to:xe.target.value}),e[35]=W):W=e[35];let T;e[36]!==r?(T=r("sandbox.redirectEditor.toPlaceholder"),e[36]=r,e[37]=T):T=e[37];let U;e[38]!==c||e[39]!==d.to||e[40]!==T?(U=n.jsx(Xe,{id:"redirect-form-to",value:z,onChange:W,placeholder:T,disabled:c}),e[38]=c,e[39]=d.to,e[40]=T,e[41]=U):U=e[41];let Y;e[42]!==G||e[43]!==U?(Y=n.jsxs("div",{className:"space-y-1.5",children:[G,U]}),e[42]=G,e[43]=U,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=n.jsx(ze,{htmlFor:"redirect-form-type",children:q}),e[47]=q,e[48]=X):X=e[48];const de=d.type;let ne;e[49]===Symbol.for("react.memo_cache_sentinel")?(ne=xe=>x({type:xe}),e[49]=ne):ne=e[49];let ue;e[50]!==r?(ue=r("sandbox.redirectEditor.typePlaceholder"),e[50]=r,e[51]=ue):ue=e[51];let te;e[52]!==ue?(te=n.jsx(Za,{id:"redirect-form-type",className:"w-full",children:n.jsx(el,{placeholder:ue})}),e[52]=ue,e[53]=te):te=e[53];let re;e[54]!==r?(re=zl.map(xe=>n.jsx(Xa,{value:xe.value,children:r(xe.labelKey,{status:Mn[xe.value]})},xe.value)),e[54]=r,e[55]=re):re=e[55];let le;e[56]!==re?(le=n.jsx(tl,{children:re}),e[56]=re,e[57]=le):le=e[57];let N;e[58]!==c||e[59]!==d.type||e[60]!==te||e[61]!==le?(N=n.jsxs(sl,{value:de,onValueChange:ne,disabled:c,children:[te,le]}),e[58]=c,e[59]=d.type,e[60]=te,e[61]=le,e[62]=N):N=e[62];let J;e[63]!==X||e[64]!==N?(J=n.jsxs("div",{className:"space-y-1.5",children:[X,N]}),e[63]=X,e[64]=N,e[65]=J):J=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=n.jsx(Xt,{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=n.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=n.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]!==C?(ie=C&&n.jsx("p",{className:"text-xs text-destructive",children:C}),e[77]=C,e[78]=ie):ie=e[78];let ve;e[79]!==I||e[80]!==Y||e[81]!==J||e[82]!==H||e[83]!==ie?(ve=n.jsxs("div",{className:"space-y-4 py-4",children:[I,Y,J,H,ie]}),e[79]=I,e[80]=Y,e[81]=J,e[82]=H,e[83]=ie,e[84]=ve):ve=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=n.jsx(_e,{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 we=!B;let Pe;e[93]!==c||e[94]!==r?(Pe=c?n.jsxs(n.Fragment,{children:[n.jsx(lt,{className:"size-3.5"}),r("sandbox.redirectFormDialog.pending")]}):r("sandbox.redirectFormDialog.submit"),e[93]=c,e[94]=r,e[95]=Pe):Pe=e[95];let Te;e[96]!==we||e[97]!==Pe?(Te=n.jsx(_e,{type:"submit",disabled:we,children:Pe}),e[96]=we,e[97]=Pe,e[98]=Te):Te=e[98];let Ne;e[99]!==he||e[100]!==Te?(Ne=n.jsxs(ht,{children:[he,Te]}),e[99]=he,e[100]=Te,e[101]=Ne):Ne=e[101];let Be;e[102]!==w||e[103]!==ve||e[104]!==Ne||e[105]!==D?(Be=n.jsx(rt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:w,children:[D,ve,Ne]})}),e[102]=w,e[103]=ve,e[104]=Ne,e[105]=D,e[106]=Be):Be=e[106];let De;return e[107]!==v||e[108]!==s||e[109]!==Be?(De=n.jsx(ct,{open:s,onOpenChange:v,children:Be}),e[107]=v,e[108]=s,e[109]=Be,e[110]=De):De=e[110],De}function Vl(t){const e=ae.c(70),{open:s,blockKey:o,initialName:a,isPending:l,onSubmit:i,onOpenChange:c}=t,r=l===void 0?!1:l,d=Se(),[p,m]=$.useState(a),[h,u]=$.useState(s);s!==h&&(u(s),s&&m(a));let f;e[0]!==r||e[1]!==c?(f=de=>{!de&&!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 de=>{de.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=n.jsx(it,{children:v}),e[9]=v,e[10]=j):j=e[10];let w;e[11]!==d?(w=d("sandbox.sectionRenameDialog.description"),e[11]=d,e[12]=w):w=e[12];let C;e[13]!==w?(C=n.jsx(zt,{children:w}),e[13]=w,e[14]=C):C=e[14];let E;e[15]!==j||e[16]!==C?(E=n.jsxs(pt,{children:[j,C]}),e[15]=j,e[16]=C,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=n.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=de=>m(de.target.value),e[22]=D):D=e[22];let O;e[23]!==r||e[24]!==p?(O=n.jsx(Xe,{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=n.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=n.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?(_=n.jsx(Xe,{value:o,readOnly:!0,disabled:!0,className:"font-mono"}),e[33]=o,e[34]=_):_=e[34];let A;e[35]!==F||e[36]!==_?(A=n.jsxs("div",{className:"space-y-1.5",children:[F,_]}),e[35]=F,e[36]=_,e[37]=A):A=e[37];let I;e[38]!==L||e[39]!==A?(I=n.jsxs("div",{className:"space-y-4 py-4",children:[L,A]}),e[38]=L,e[39]=A,e[40]=I):I=e[40];let R;e[41]!==c?(R=()=>c(!1),e[41]=c,e[42]=R):R=e[42];let G;e[43]!==d?(G=d("sandbox.sectionRenameDialog.cancel"),e[43]=d,e[44]=G):G=e[44];let z;e[45]!==r||e[46]!==R||e[47]!==G?(z=n.jsx(_e,{type:"button",variant:"outline",onClick:R,disabled:r,children:G}),e[45]=r,e[46]=R,e[47]=G,e[48]=z):z=e[48];let W;e[49]!==r||e[50]!==p?(W=!p.trim()||r,e[49]=r,e[50]=p,e[51]=W):W=e[51];let T;e[52]!==r||e[53]!==d?(T=r?n.jsxs(n.Fragment,{children:[n.jsx(lt,{className:"size-3.5"}),d("sandbox.sectionRenameDialog.saving")]}):d("sandbox.sectionRenameDialog.save"),e[52]=r,e[53]=d,e[54]=T):T=e[54];let U;e[55]!==W||e[56]!==T?(U=n.jsx(_e,{type:"submit",disabled:W,children:T}),e[55]=W,e[56]=T,e[57]=U):U=e[57];let Y;e[58]!==z||e[59]!==U?(Y=n.jsxs(ht,{children:[z,U]}),e[58]=z,e[59]=U,e[60]=Y):Y=e[60];let q;e[61]!==y||e[62]!==I||e[63]!==Y||e[64]!==E?(q=n.jsx(rt,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:y,children:[E,I,Y]})}),e[61]=y,e[62]=I,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=n.jsx(ct,{open:s,onOpenChange:g,children:q}),e[66]=g,e[67]=s,e[68]=q,e[69]=X):X=e[69],X}function Gl(t){const e=ae.c(7),{type:s}=t,o=Mn[s];let a;e[0]!==o?(a=n.jsx(We,{asChild:!0,children:n.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=n.jsx(Ye,{side:"left",children:l}),e[2]=l,e[3]=i):i=e[3];let c;return e[4]!==a||e[5]!==i?(c=n.jsxs(Qe,{children:[a,i]}),e[4]=a,e[5]=i,e[6]=c):c=e[6],c}const Ul=60,ps={post:"blog/loaders/Blogpost.ts",author:"blog/loaders/Author.ts",category:"blog/loaders/Category.ts"},Es=["posts","authors","categories"],Nt={posts:"post",authors:"author",categories:"category"};function ot(t){return Es.includes(t)}const es={posts:"post",authors:"author",categories:"category"},Xn={posts:ps.post,authors:ps.author,categories:ps.category},Hl=Object.fromEntries(Object.entries(Xn).map(([t,e])=>[e,t]));function ql(t){return typeof t=="string"?Hl[t]??null:null}function Ie(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function ee(t){return typeof t=="string"?t:""}function Jl(t,e){switch(t){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=t;throw new Error(`Unhandled blog kind: ${String(s)}`)}}}function Zn(t){const e={posts:[],authors:[],categories:[]};for(const[s,o]of Object.entries(t)){const a=Ie(o);if(!a)continue;const l=ql(a.__resolveType);if(!l)continue;const i=Ie(a[es[l]])??{},{label:c,subtitle:r}=Jl(l,i);e[l].push({key:s,kind:l,label:c,subtitle:r})}for(const s of Es)e[s].sort((o,a)=>o.label.localeCompare(a.label));return e}function Wl(t,e){return Zn(t)[e]}function Ge(t,e){return Wl(t,e).map(s=>({key:s.key,payload:dt(Ie(t[s.key])??void 0,e)}))}const Xs=Object.freeze({});function dt(t,e){return t?Ie(t[es[e]])??Xs:Xs}function at(t,e,s){return{name:t,__resolveType:Xn[e],[es[e]]:s}}function ud({records:t,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?t.find(({payload:x})=>ee(x[s])===u):void 0;if(f)return f;const g=i(h);return g?t.find(({payload:x})=>ee(x.name)===g):void 0},r=t.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=t.find(g=>g.key===u);return f?o(f.payload):d.get(u)}).filter(u=>u!==void 0)}}function Ze(t){return Array.isArray(t)?t:[]}function st(t){if(typeof t=="string")return t;const e=Ie(t);return e?ee(e.slug):""}function eo(t){if(typeof t=="string")return t;const e=Ie(t);return e?ee(e.email):""}function _s(t){const e=[];return ee(t.title).trim()||e.push("Title"),ee(t.slug).trim()||e.push("Slug"),Ze(t.categories).map(st).filter(Boolean).length===0&&e.push("Category"),ee(t.excerpt).trim()||e.push("Excerpt"),ee(t.image).trim()||e.push("Cover image"),e}const Ds=["draft","generating","awaiting_review","scheduled","published","archived"],to=8;function Et(t){switch(ee(t.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 Yl(t,e){return e!=="published"&&e!=="scheduled"||Et(t)===e?!1:_s(t).length>0}function Ql(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,to).toISOString()}function Mt(t,e,s){if(e!=="scheduled")return{...t,status:e,scheduledDatetime:""};const o=ee(t.scheduledDatetime);return{...t,status:"scheduled",scheduledDatetime:Number.isNaN(new Date(o).getTime())?Ql(s):o}}function so(t){return Ge(t,"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:Ze(s.categories).map(st).filter(Boolean),authorEmails:Ze(s.authors).map(eo).filter(Boolean),missing:_s(s),status:Et(s),form:"live"}))}const no="blog-manager/posts/";function oo(t){return t.startsWith(no)}function Ct(t){return t.split("/").pop()??t}function Vt(t){return`${no}${t}`}function Xl(t){return`collections/blog/posts/${t}`}function bs(){return xt(12)}function Zl(t){const e=Ie(t.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 ao(t){return{title:t.title,slug:"",excerpt:"",date:t.now.toISOString().slice(0,10),image:"",alt:"",authors:[],categories:[],sections:[],status:"draft",planning:t.planning??{}}}function ut(t,e){return{name:t,[es.posts]:e}}function md(t,e){return oo(t)?ut(t,e):at(t,"posts",e)}function ei(t){const e=[];for(const[s,o]of Object.entries(t)){if(!oo(s))continue;const a=Ie(o);a&&e.push({key:s,payload:dt(a,"posts")})}return e}function ti(t){return[...ei(t).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:Ze(o.categories).map(st).filter(Boolean),authorEmails:Ze(o.authors).map(eo).filter(Boolean),missing:_s(o),status:Et(o),form:"planning"})),...so(t)]}function si(t,e,s){const o=Mt(t.payload,e,s),a=Ct(t.key),l=e==="scheduled"||e==="published"?"live":"planning",i=l==="live"?Xl(a):Vt(a),c=l==="live"?at(i,"posts",o):ut(i,o);return{writes:{[i]:c},deletes:i===t.key?[]:[t.key]}}function fd(t,e,s){const o=Ze(t.categories);if(!o.some(c=>st(c)===e))return t;const a=o.map(c=>{const r=st(c);return r===e||r===s.slug?{name:s.name,slug:s.slug}:c}),l=new Set,i=a.filter(c=>{const r=st(c);return r?l.has(r)?!1:(l.add(r),!0):!0});return{...t,categories:i}}function ni(t,e){const s=Ze(t.categories);return s.some(o=>st(o)===e)?{...t,categories:s.filter(o=>st(o)!==e)}:t}function oi(t){const e=ee(t.status),s=e==="idea"||e==="in_review"?{status:Et(t)}:{};return{...t,...s,dateModified:new Date().toISOString()}}function xt(t){const e=new Uint8Array(Math.ceil(t/2));return crypto.getRandomValues(e),Array.from(e,s=>s.toString(16).padStart(2,"0")).join("").slice(0,t)}function hs(t,e){const s=`collections/blog/${e}/${xt(12)}`;if(!Object.hasOwn(t,s))return s;throw new Error("Could not generate a unique blog block key")}function lo(t){switch(t){case"posts":return{title:"Untitled post",excerpt:"",slug:`untitled-${xt(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-${xt(8)}`,description:"",sections:[]};default:{const e=t;throw new Error(`Unhandled blog kind: ${String(e)}`)}}}const ai={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"}},Zs="Box";function li(t){return t.startsWith("site/")?"site":"app"}function ii(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")||t.startsWith("/")}function vt(...t){for(const e of t)if(e!==void 0)return e}function en(t){if(t&&!(t.includes("/")||/\.(tsx?|jsx?)$/.test(t)))return t}function ri(t){const e=t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").trim();return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():t}function io(t){const e=new Set,s=[],o=t.manifest?.blocks??{};for(const a of Object.values(o))for(const l of Object.keys(a)){if(!di(l)||e.has(l))continue;e.add(l);const i=Cs(l,t),c=ts(l),r=ai[c],d=li(l),p=en(i.title),m=en(i.description),h=(d==="site"?vt(p,r?.title):vt(r?.title,p))??ri(c),u=d==="site"?vt(m,r?.description):vt(r?.description,m),f=d==="site"?i.icon:void 0,g=f&&ii(f)?f:void 0,x=g!==void 0?r?.iconName??Zs:vt(f,r?.iconName)??Zs;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 ts(t){return(t.split("/").pop()??t).replace(/\.(tsx?|jsx?)$/,"")}const ci=["blog/sections/blocks/","site/sections/Blog/Post/"];function di(t){return ci.some(e=>t.startsWith(e))}const As="blog-manager-brand";function Ke(t){if(!Array.isArray(t))return[];const e=[];for(const s of t){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(t){return t.filter(e=>e.name.trim()||e.value.trim())}const ui=6e4,mi=4e3;function fi(t){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(t,"block"),e.join(`
|
|
3
3
|
`)}function pd(t,e){const s=new Map,o=d=>{const p=s.get(d);if(p!==void 0)return p;const m=fi(t[d]).slice(0,mi);return s.set(d,m),m},a=(d,p)=>o(p).length-o(d).length,l=[...Ge(t,"posts").map(d=>d.key).sort(a),...Ge(t,"categories").map(d=>d.key),...[...e].sort(a)],i=[],c=new Set;let r=ui;for(const d of l){if(i.length>=Ul)break;if(c.has(d)||!t[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 ro="blog-manager/themes/";function pi(){return`${ro}${crypto.randomUUID()}`}function hi(t,e){return{name:t,title:e.title,body:e.body,pillarKey:e.pillarKey??"",createdAt:e.createdAt}}function co(t){const e=[];for(const[s,o]of Object.entries(t)){if(!s.startsWith(ro))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 uo="blog-manager/pillars/";function hd(){return`${uo}${crypto.randomUUID()}`}function mo(t){const e=[];for(const[s,o]of Object.entries(t)){if(!s.startsWith(uo))continue;const a=Ie(o);a&&e.push({key:s,title:ee(a.title),body:ee(a.body),createdAt:ee(a.createdAt),formats:Ze(a.formats).map(l=>ee(l)).filter(Boolean)})}return e.sort((s,o)=>o.createdAt.localeCompare(s.createdAt)||s.title.localeCompare(o.title))}const fo="blog-manager-formats",xi=40;function xd(t){return Ge(t,"posts").slice(0,xi).map(({key:e,payload:s})=>({key:e,title:ee(s.title),sections:Ze(s.sections).map(o=>ee(Ie(o)?.__resolveType)).filter(Boolean).map(ts)}))}function gi(t){const e=new Map;for(const s of io(t)){const o=ts(s.resolveType);e.has(o)||e.set(o,{name:o,title:s.title,description:s.description})}return[...e.values()]}function bi(t){const e=new Set;for(const s of t.matchAll(/(?:^|[\s([{>])@([A-Za-z][\w-]*)/g))s[1]&&e.add(s[1]);return[...e]}function gd(t,e){const s=new Set(e);return bi(t).filter(o=>!s.has(o))}const yi=["Heading","Paragraph","BlockImage","List","Cta"];function bd(t){const e=new Set(t);return yi.filter(s=>e.has(s))}function tn(t){return t.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().replace(/\s+/g," ").trim()}function vi(t,e){const s=new Set(t.map(tn)),o=[];for(const a of e){const l=tn(a.title);!l||s.has(l)||(s.add(l),o.push(a))}return o}const ji=["companyName","language","description","tone","targetAudience"];function ki(t){const e=Ie(t)??{},s=[];for(const o of ji)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 po(t){const e={};for(const s of io(t)){const o=ts(s.resolveType);o in e||(e[o]=s.resolveType)}return e}function Si(t,e){const s=[];for(const o of t){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 ho(t){return t.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function xo(t,e){const s=ho(t)||`post-${xt(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}-${xt(4)}`}function wi({draft:t,resolveTypes:e,categories:s,authors:o,planning:a,takenSlugs:l,now:i}){const c=new Set(t.categorySlugs),r=new Set(t.authorEmails),d={title:t.title,slug:xo(t.title,l),date:i.toISOString().slice(0,10),excerpt:t.excerpt,image:"",alt:"",authors:o.filter(p=>r.has(p.email)),categories:s.filter(p=>c.has(p.slug)),seo:{title:t.seo.title,description:t.seo.description,image:""},sections:Si(t.sections,e),planning:a??{}};return Mt(d,"awaiting_review",i)}const yd=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],vd=["January","February","March","April","May","June","July","August","September","October","November","December"],go=1440*60*1e3;function mt(t){const e=new Date(t);return e.setHours(0,0,0,0),e}function jd(t){return new Date(t.getFullYear(),t.getMonth(),1)}function kd(t,e){return new Date(t.getFullYear(),t.getMonth()+e,1)}function Gt(t,e){const s=new Date(t);return s.setDate(s.getDate()+e),s}function ys(t,e){return Math.round((mt(t).getTime()-mt(e).getTime())/go)}function Ni(t){const e=(t.getTime()-mt(t).getTime())/go;return Math.min(Math.max(e,0),1)}function sn(t,e){return ys(t,e)+Ni(t)}function Sd(t){const e=Gt(t,-t.getDay()),s=[];for(let o=0;o<6;o++){const a=[];for(let l=0;l<7;l++)a.push(Gt(e,o*7+l));s.push(a)}for(;s.length>0&&s[s.length-1].every(o=>o.getMonth()!==t.getMonth());)s.pop();return s}function wd(t,e){const s=mt(t[0]),o=Gt(s,7),a=s.getTime(),l=o.getTime(),i=[];for(const d of e){const p=mt(d.start),m=mt(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()?Gt(o,-1):m,f=ys(h,s),g=ys(u,h)+1;if(g<=0)continue;const x=Math.max(d.start.getTime(),a),y=Math.min(d.end.getTime(),l),v=sn(new Date(x),s),j=Math.max(sn(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 Ut(t){const e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}const bo=/^(\d{4})-(\d{2})-(\d{2})$/;function Ht(t){const e=t.trim();if(!e)return null;const s=bo.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:mt(o)}function Ci(t){const e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),to);return{...lo("posts"),status:"scheduled",scheduledDatetime:e.toISOString(),date:Ut(t)}}function Pi(t){if(typeof t!="string")return null;const e=t.trim();if(!e)return null;if(bo.test(e))return Ht(e);const s=new Date(e);return Number.isNaN(s.getTime())?null:s}function Ti(t,e){const s=Pi(t.scheduledDatetime);if(!s)return null;const o=new Date(e.getFullYear(),e.getMonth(),e.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),a={...t,scheduledDatetime:o.toISOString()};return(typeof t.date=="string"?t.date:"")===Ut(s)&&(a.date=Ut(o)),a}function Bi(t){return Ht(t.scheduledDatetime)??Ht(t.date)}function Nd(t){const e=new Map,s=[];for(const a of t){const l={post:a,scheduled:Ht(a.scheduledDatetime)!==null},i=Bi(a);if(!i){s.push(l);continue}const c=Ut(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 Ei="0.161.0",_i="0.162.0",nn="7.53.0",Di="@decocms/apps-blog";function on(t){const e=/^v?(\d+)\.(\d+)\.(\d+)$/.exec(t.trim());return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function an(t,e){const s=on(t),o=on(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 yo=/deco-cx\/apps@v?(\d+\.\d+\.\d+)/;function Ai(t){const e=t?.imports;if(!e||typeof e!="object")return null;for(const s of Object.values(e)){if(typeof s!="string")continue;const o=yo.exec(s)?.[1];if(o)return o}return null}function $i(t){const e=t?.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=yo.exec(o)?.[1];if(a)return a}return null}function Li(t){return vs(t?.schema?.definitions,"scheduledDatetime")}function vs(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t))return t.some(o=>vs(o,e));const s=t.properties;return s&&typeof s=="object"&&e in s?!0:Object.values(t).some(o=>vs(o,e))}function Oi(t){const e=t;for(const s of[e?.dependencies,e?.devDependencies]){if(!s||typeof s!="object")continue;const o=s[Di];if(typeof o=="string")return o}return null}function Ii(t){const e=/^[\^~]?v?(\d+\.\d+\.\d+)$/.exec(t.trim());return e?e[1]:null}function Ri(t){const e=t?.packageManager,s=typeof e=="string"?e.split("@")[0]?.trim():null;return s==="pnpm"||s==="yarn"||s==="bun"?s:"npm"}function vo(t){return t==="deno"?[Ei,_i]:[nn,nn]}function ln(t,e){const[s,o]=vo(t);return!e||an(e,s)<0?{kind:"outdated",packageManager:t,version:e}:an(e,o)<0?{kind:"publish-only",packageManager:t,version:e}:{kind:"full",version:e}}function Fi(t){const e=$i(t.meta);if(t.denoJson.kind==="data"||e){const o=t.denoJson.kind==="data"?Ai(t.denoJson.data):null;return ln("deno",o??e)}if(t.packageJson.kind==="data"){const o=Oi(t.packageJson.data);return o===null?{kind:"unsupported-runtime"}:ln(Ri(t.packageJson.data),Ii(o))}return Li(t.meta)?{kind:"full",version:null}:t.denoJson.kind==="unavailable"||t.packageJson.kind==="unavailable"?{kind:"unknown"}:{kind:"unsupported-runtime"}}function Ki(t){return t==="deno"?"deno task update":`npx npm-check-updates -u "@decocms/*" && ${t} install`}function zi(t){return t.kind==="publish-only"||t.kind==="full"}function Cd(t){return t.kind==="full"}function jo(t,e){if(t.kind==="full"||e!=="scheduled"&&e!=="published"||e==="published"&&zi(t))return null;if(t.kind==="unknown")return{reason:"unknown"};if(t.kind==="unsupported-runtime")return{reason:"no-app"};const[s,o]=vo(t.packageManager);return{reason:"outdated",required:e==="scheduled"?o:s,version:t.version,command:Ki(t.packageManager)}}const rn={kind:"unavailable"};function Mi(t){const e=ae.c(26),s=In(t.virtualMcpId),o=Bt()?.taskId??null;let a;e[0]!==s||e[1]!==t||e[2]!==o?(a=y=>({queryFn:()=>ra({...t,threadId:o},gs(s,y)),staleTime:3e5}),e[0]=s,e[1]=t,e[2]=o,e[3]=a):a=e[3];const l=a;let i;e[4]!==t.branch||e[5]!==t.orgSlug||e[6]!==t.virtualMcpId?(i=Pt.denoJson(t.orgSlug,t.virtualMcpId,t.branch),e[4]=t.branch,e[5]=t.orgSlug,e[6]=t.virtualMcpId,e[7]=i):i=e[7];let c;e[8]!==l?(c=l("deno.json"),e[8]=l,e[9]=c):c=e[9];let r;e[10]!==i||e[11]!==c?(r={queryKey:i,...c},e[10]=i,e[11]=c,e[12]=r):r=e[12];const{data:d}=xs(r);let p;e[13]!==t.branch||e[14]!==t.orgSlug||e[15]!==t.virtualMcpId?(p=Pt.packageJson(t.orgSlug,t.virtualMcpId,t.branch),e[13]=t.branch,e[14]=t.orgSlug,e[15]=t.virtualMcpId,e[16]=p):p=e[16];let m;e[17]!==l?(m=l("package.json"),e[17]=l,e[18]=m):m=e[18];let h;e[19]!==p||e[20]!==m?(h={queryKey:p,...m},e[19]=p,e[20]=m,e[21]=h):h=e[21];const{data:u}=xs(h),f=d??rn,g=u??rn;let x;return e[22]!==t.meta||e[23]!==f||e[24]!==g?(x=Fi({denoJson:f,packageJson:g,meta:t.meta}),e[22]=t.meta,e[23]=f,e[24]=g,e[25]=x):x=e[25],x}function Vi(t){const e=ae.c(37),{orgSlug:s,virtualMcpId:o,branch:a}=t,l=To(),i=Bt()?.taskId??null,c=In(o),r=Un(o).runtime==="cms";let d;e[0]!==a||e[1]!==s||e[2]!==o?(d=Pt.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=$a(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=Aa(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 w=>{const{writes:C,deletes:E}=w,B=ca(C);if(r){const D=await La({orgSlug:s,virtualMcpId:o,branch:a},{set:B,delete:E});return Oa(l,{orgSlug:s,virtualMcpId:o,branch:a},D),await l.invalidateQueries({queryKey:nl({orgSlug:s,virtualMcpId:o,branch:a,threadId:i})}),D}const k={orgSlug:s,virtualMcpId:o,branch:a,threadId:i};for(const[D,O]of Object.entries(B)){const L=await fetch(Hs(k,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:gs(c,qs(D)),content:JSON.stringify(O,null,2)})});if(!L.ok)return Vs(L,"Write")}for(const D of E){const O=await fetch(Hs(k,"unlink"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:gs(c,qs(D))})});if(!O.ok)return Vs(O,"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:Pt.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=Bo(g);let y;e[30]!==x||e[31]!==l||e[32]!==p?(y=async w=>{const C=[...Object.keys(w.writes),...w.deletes],E=l.getQueryData(p),B=new Map;for(const k of C)E&&k in E&&B.set(k,E[k]);l.setQueryData(p,k=>Gi(k,w)),l.cancelQueries({queryKey:p});try{return await x.mutateAsync(w)}catch(k){const D=k;throw l.setQueryData(p,O=>{if(!O)return O;const L={...O};for(const K of C)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 Gi(t,{writes:e,deletes:s}){const o={...t??{},...e};for(const a of s)a in e||delete o[a];return o}const qt={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 ko(t,e){switch(e.reason){case"unknown":return t("sandbox.postBoard.moveUnknownApp");case"no-app":return t("sandbox.postBoard.moveNoBlogApp");case"outdated":return t("sandbox.postBoard.moveUnsupported",{required:e.required,command:e.command})}}function Ui({orgSlug:t,virtualMcpId:e,branch:s,decofile:o,support:a,onMoved:l}){const i=Se(),c=Vi({orgSlug:t,virtualMcpId:e,branch:s}),[r,d]=$.useState(new Set),p=f=>dt(o[f],"posts"),m=(f,g,x=p(f))=>{if(g==="generating")return{kind:"not-a-target"};if(r.has(Ct(f)))return{kind:"in-flight"};const y=jo(a,g);return y?{kind:"unsupported",...y}:Yl(x,g)?{kind:"incomplete"}:null},h=f=>{switch(f.kind){case"unsupported":return ko(i,f);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(Et(y)===g)return null;const v=m(f,g,y);if(v)return v.kind!=="in-flight"&&me.error(h(v)),null;const j=Ct(f);d(E=>new Set(E).add(j));const w=si({key:f,payload:y},g,new Date),C=Object.keys(w.writes)[0]??f;C!==f&&l?.(f,C);try{return await c.move(w),C}catch(E){return C!==f&&l?.(C,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(Ct(f))}}function Hi(t){const e=ae.c(14),{value:s,onChange:o,placeholder:a,className:l,onFocus:i,onBlur:c,onKeyDown:r,spellCheck:d,inputRef:p}=t,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=be("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=n.jsx("textarea",{ref:p,value:s,onChange:h,onInput:qi,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 qi(t){const e=t.currentTarget;e.style.height="auto",e.style.height=`${e.scrollHeight}px`}function ye(t){return typeof t=="string"?t:""}function Pd(t){const e=ae.c(11);let s,o;e[0]!==t?({className:s,...o}=t,e[0]=t,e[1]=s,e[2]=o):(s=e[1],o=e[2]);let a;e[3]!==s?(a=be(s,"pr-9"),e[3]=s,e[4]=a):a=e[4];let l;e[5]!==o||e[6]!==a?(l=n.jsx(Hi,{...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=n.jsx(zo,{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=n.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 Td(t){const e=ae.c(5),{label:s,onClick:o,disabled:a}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(ws,{size:13}),e[0]=l):l=e[0];let i;return e[1]!==a||e[2]!==s||e[3]!==o?(i=n.jsxs("button",{type:"button",onClick:o,disabled:a,className:"flex items-center gap-1.5 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(t){const e=ae.c(4),{label:s,onClick:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Ts,{size:13}),e[0]=a):a=e[0];let l;return e[1]!==s||e[2]!==o?(l=n.jsx("button",{type:"button","aria-label":s,onClick:o,className:"flex h-6 w-6 shrink-0 items-center justify-center text-muted-foreground/60 opacity-0 transition-opacity hover:text-destructive group-hover/item:opacity-100 cursor-pointer rounded-lg",children:a}),e[1]=s,e[2]=o,e[3]=l):l=e[3],l}function Ed(t){const e=ae.c(2),{children:s}=t;let o;return e[0]!==s?(o=n.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 _d(t){const e=ae.c(8),{active:s,label:o,onClick:a,children:l}=t,i=s?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let c;e[0]!==i?(c=be("flex h-7 min-w-7 items-center justify-center px-1.5 text-sm transition-colors cursor-pointer 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=n.jsx("button",{type:"button","aria-label":o,"aria-pressed":s,onMouseDown:Ji,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 Ji(t){return t.preventDefault()}function Dd(t){if(Array.isArray(t))return t;if(typeof t!="string"||t.trim()==="")return[];try{const e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}function kt(t){const e=ae.c(14),{options:s,value:o,emptyLabel:a,onChange:l}=t;let i;e[0]!==a||e[1]!==l||e[2]!==o?(i=a&&n.jsx(cn,{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=>n.jsx(cn,{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=n.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 cn(t){const e=ae.c(7),{active:s,onClick:o,children:a}=t,l=s?"border-primary bg-primary text-primary-foreground":"bg-card hover:bg-muted";let i;e[0]!==l?(i=be("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=n.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 Ad(t,e=[]){return typeof t=="string"?t:JSON.stringify(t??e)}const dn=[{id:"idea",label:"sandbox.generatePost.stepIdea"},{id:"format",label:"sandbox.generatePost.stepFormat"},{id:"extra",label:"sandbox.generatePost.stepExtra"}],Wi={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 Yi({open:t,onOpenChange:e,decofile:s,hasAi:o,seed:a,onGenerate:l}){const i=Se(),c=js(),[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(""),[w,C]=$.useState(""),[E,B]=$.useState(""),[k,D]=$.useState(""),[O,L]=$.useState(""),[K,F]=$.useState(!1),_=s[As],A=ki(_),I={companyName:ye(_?.companyName),description:ye(_?.description),language:ye(_?.language),tone:ye(_?.tone),targetAudience:ye(_?.targetAudience),values:Me(Ke(_?.values)),dos:Me(Ke(_?.dos)),avoid:Me(Ke(_?.avoid))},R=co(s),G=R.find(N=>N.key===p),z=mo(s).find(N=>N.key===G?.pillarKey),W=s[fo],T=Me(Ke(W?.formats)),U=Ge(s,"categories").map(({payload:N})=>({name:ye(N.name),slug:ye(N.slug)})).filter(N=>N.slug),Y=Ge(s,"authors").map(({payload:N})=>({name:ye(N.name),email:ye(N.email)})).filter(N=>N.email),q=()=>{d(a?"format":"idea"),m(a?.key??""),u(a?.title??""),g(a?.body??""),y([]),j(""),C(""),B(""),D(""),L("")},X=N=>{e(N),N||q()},de=async()=>{F(!0);try{const N=await c.call("BLOG_THEME_SUGGEST",{brand:I,existingTitles:[],formats:T.map(J=>J.name).filter(Boolean),guidance:z?`Every idea must be one angle inside the pillar "${z.title}": ${z.body}`:void 0,count:4});y(N.themes)}catch(N){me.error(N instanceof Error?N.message:i("sandbox.generatePost.suggestFailed"))}finally{F(!1)}},ne=a?dn.filter(N=>N.id!=="idea"):dn,ue=ne.findIndex(N=>N.id===r),te=r==="idea"?h.trim().length>0:r==="format"?v.trim().length>0&&w.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:w.trim()},category:U.find(N=>N.slug===E),author:Y.find(N=>N.email===k),extraInstructions:O.trim()||void 0}),X(!1)};return n.jsx(ct,{open:t,onOpenChange:X,children:n.jsxs(rt,{className:"flex max-h-[85vh] flex-col sm:max-w-2xl",children:[n.jsxs(pt,{children:[n.jsx(it,{children:i("sandbox.generatePost.title")}),n.jsx(zt,{children:i("sandbox.generatePost.subtitle")})]}),A.length>0?n.jsx("p",{className:"text-sm text-muted-foreground",children:i("sandbox.generatePost.blockedBrand",{fields:A.map(N=>i(Wi[N])).join(", ")})}):n.jsxs(n.Fragment,{children:[n.jsx("ol",{className:"flex shrink-0 items-center gap-1.5 text-xs",children:ne.map((N,J)=>n.jsx("li",{className:be("rounded-md px-2 py-1",J===ue?"bg-primary text-primary-foreground":J<ue?"text-foreground":"text-muted-foreground"),children:i(N.label)},N.id))}),n.jsxs("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto py-1",children:[r==="idea"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:z?i("sandbox.generatePost.ideaHintInPillar",{pillar:z.title}):i("sandbox.generatePost.ideaHint")}),R.length>0&&n.jsx(kt,{options:R.map(N=>N.title).filter(Boolean),value:G?.title??"",emptyLabel:i("sandbox.generatePost.writeAnIdea"),onChange:N=>{const J=R.find(Z=>Z.title===N);m(J?.key??""),u(J?.title??""),g(J?.body??"")}}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-idea-title",children:i("sandbox.generatePost.ideaTitleLabel")}),n.jsx(Xe,{id:"generate-idea-title",value:h,onChange:N=>{m(""),u(N.target.value)},placeholder:i("sandbox.generatePost.ideaTitlePlaceholder")})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-idea-body",children:i("sandbox.generatePost.ideaBodyLabel")}),n.jsx(Ot,{id:"generate-idea-body",value:f,onChange:N=>g(N.target.value),placeholder:i("sandbox.generatePost.ideaBodyPlaceholder"),rows:3})]}),n.jsx(Qi,{label:i("sandbox.generatePost.suggestIdeas"),hint:i("sandbox.generatePost.suggestIdeasHint"),disabled:!o||K,busy:K,onSuggest:de}),n.jsx(Xi,{suggestions:x,onPick:N=>{u(N.title),g(N.body)}})]}),r==="format"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.generatePost.formatHint")}),n.jsx(kt,{options:T.map(N=>N.name),value:v,onChange:N=>{j(N),C(T.find(J=>J.name===N)?.value??"")}}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-format-name",children:i("sandbox.generatePost.formatNameLabel")}),n.jsx(Xe,{id:"generate-format-name",value:v,onChange:N=>j(N.target.value),placeholder:i("sandbox.generatePost.formatNamePlaceholder")})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-format-value",children:i("sandbox.generatePost.formatValueLabel")}),n.jsx(Ot,{id:"generate-format-value",value:w,onChange:N=>C(N.target.value),placeholder:i("sandbox.generatePost.formatValuePlaceholder"),rows:4})]})]}),r==="extra"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-category",children:i("sandbox.generatePost.categoryLabel")}),n.jsx(kt,{options:U.map(N=>N.name),value:U.find(N=>N.slug===E)?.name??"",emptyLabel:i("sandbox.generatePost.inferIt"),onChange:N=>B(U.find(J=>J.name===N)?.slug??"")})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-author",children:i("sandbox.generatePost.authorLabel")}),n.jsx(kt,{options:Y.map(N=>N.name),value:Y.find(N=>N.email===k)?.name??"",emptyLabel:i("sandbox.generatePost.inferIt"),onChange:N=>D(Y.find(J=>J.name===N)?.email??"")})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ze,{htmlFor:"generate-extra",children:i("sandbox.generatePost.extraLabel")}),n.jsx(Ot,{id:"generate-extra",value:O,onChange:N=>L(N.target.value),placeholder:i("sandbox.generatePost.extraPlaceholder"),rows:3})]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.generatePost.inferHint")})]})]}),n.jsxs(ht,{className:"shrink-0 sm:justify-between",children:[n.jsx(_e,{type:"button",variant:"outline",disabled:ue===0,onClick:()=>d(ne[ue-1].id),children:i("sandbox.generatePost.back")}),re?n.jsxs(_e,{type:"button",disabled:!o,onClick:le,children:[n.jsx(et,{size:14}),i("sandbox.generatePost.generate")]}):n.jsx(_e,{type:"button",disabled:!te,onClick:()=>d(ne[ue+1].id),children:i("sandbox.generatePost.next")})]})]})]})})}function Qi(t){const e=ae.c(12),{label:s,hint:o,disabled:a,busy:l,onSuggest:i}=t;let c;e[0]!==o?(c=n.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?n.jsx(wt,{size:14,className:"animate-spin"}):n.jsx(et,{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=n.jsxs(_e,{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=n.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 Xi(t){const e=ae.c(7),{suggestions:s,onPick:o}=t;if(s.length===0)return null;let a;if(e[0]!==o||e[1]!==s){let i;e[3]!==o?(i=c=>n.jsx("li",{children:n.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:[n.jsx("p",{className:"text-sm font-medium",children:c.title}),n.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=n.jsx("ul",{className:"space-y-1.5",children:a}),e[5]=a,e[6]=l):l=e[6],l}const Zi=["Heading","Paragraph","List","Quote","Callout","Cta","Divider"];function er(t){return Zi.includes(t)}function tr({orgSlug:t,virtualMcpId:e,branch:s,decofile:o,meta:a,onStarted:l}){const i=Se(),c=js(),r=Qt({orgSlug:t,virtualMcpId:e,branch:s});return async d=>{const p=Vt(bs()),m={ideaKey:d.idea.key,pillarKey:d.pillar?.key,pillarTitle:d.pillar?.title,format:d.format,brief:d.idea.body},h=Mt(ao({title:d.idea.title,planning:m,now:new Date}),"generating",new Date);await r.mutateAsync({blockKey:p,data:ut(p,h)}),l?.(p);const u=o[As],f=d.category?[d.category]:Ge(o,"categories").map(({payload:x})=>({name:ye(x.name),slug:ye(x.slug)})).filter(x=>x.slug),g=d.author?[d.author]:Ge(o,"authors").map(({payload:x})=>({name:ye(x.name),email:ye(x.email)})).filter(x=>x.email);try{const x=await c.call("BLOG_POST_DRAFT",{brand:{companyName:ye(u?.companyName),description:ye(u?.description),language:ye(u?.language),tone:ye(u?.tone),targetAudience:ye(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:gi(a).filter(v=>er(v.name)).map(v=>({type:v.name,purpose:v.description})),categories:f,authors:g,extraInstructions:d.extraInstructions?.trim()||void 0}),y=wi({draft:x,resolveTypes:po(a),categories:f,authors:g,planning:m,takenSlugs:so(o).map(v=>v.slug),now:new Date});await r.mutateAsync({blockKey:p,data:ut(p,y)}),me.success(i("sandbox.generatePost.done",{title:x.title}))}catch(x){await r.mutateAsync({blockKey:p,data:ut(p,Mt(h,"draft",new Date))}),me.error(x instanceof Error?x.message:i("sandbox.generatePost.failed"))}}}const sr=/<(h[1-6]|p|ul|ol|div|img|br|blockquote|section|article|figure)\b|<\/[a-z]/i;function So(t){return sr.test(t)}function nr(t){const e=t.trim();return e?So(e)?ur(e):fr(e):{title:"",sections:[]}}function $s(t){return t.replace(/ /gi," ").replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/�?39;|'/gi,"'").replace(/&/gi,"&")}function jt(t){let e=t,s;do s=e,e=e.replace(/<[^>]+>/g,"");while(e!==s);return $s(e).replace(/\s+/g," ").trim()}function or(t){let e=t,s;do s=e,e=e.replace(/<!--[\s\S]*?-->/g,"");while(e!==s);return e}function ar(t){let e=t,s;do s=e,e=e.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/gi,"");while(e!==s);return e}function wo(t){let e=t,s;do s=e,e=ar(or(e));while(e!==s);return e}const lr=/^(a|b|strong|i|em|u|s|code|br|span|sub|sup)$/;function Jt(t){let e="";for(const s of t)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 ir(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}const rr=/^<\/?([a-z][a-z0-9]*)\b([^>]*)>/i;function cr(t,e,s){const o=e.toLowerCase();if(!lr.test(o))return"";if(t.startsWith("</"))return`</${o}>`;if(o!=="a")return`<${o}>`;const a=$s(s.match(/href\s*=\s*"([^"]*)"/i)?.[1]??"");return Jt(a)&&a?`<a href="${ir(a)}">`:"<a>"}function No(t){const e=wo(t);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=rr.exec(e.slice(a));if(!l){s+="<",o=a+1;continue}s+=cr(l[0],l[1]??"",l[2]??""),o=a+l[0].length}return s}function Dt(t,e){const s=t.match(new RegExp(`${e}\\s*=\\s*"([^"]*)"`,"i"));return s?.[1]?$s(s[1]):""}const dr=/<(h[1-6]|p|ul|ol|blockquote|figure)\b[^>]*>([\s\S]*?)<\/\1\s*>|<hr\b[^>]*\/?>|<img\b[^>]*>/gi;function ur(t){const e=wo(t);let s="";const o=[];for(const a of e.matchAll(dr)){const l=a[1]?.toLowerCase(),i=a[2]??"",c=a[0];if(!l){if(/^<img/i.test(c)){const r=Dt(c,"src");r&&Jt(r)&&o.push({kind:"image",url:r,alt:Dt(c,"alt"),caption:""})}else o.push({kind:"divider"});continue}if(/^h[1-6]$/.test(l)){const r=jt(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=No(i.trim());jt(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=>jt(d[1]??"")).filter(Boolean);r.length&&o.push({kind:"list",items:r,ordered:l==="ol"})}else if(l==="blockquote"){const r=jt(i);r&&o.push({kind:"quote",text:r})}else if(l==="figure"){const r=i.match(/<img\b[^>]*>/i)?.[0],d=r?Dt(r,"src"):"",p=jt(i.match(/<figcaption\b[^>]*>([\s\S]*?)<\/figcaption\s*>/i)?.[1]??"");d&&Jt(d)&&o.push({kind:"image",url:d,alt:r?Dt(r,"alt"):"",caption:p})}}return{title:s,sections:o}}function mr(t){return t.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 fr(t){const e=t.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:No(mr(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 if(/^(-{3,}|\*{3,}|_{3,})$/.test(h.trim()))p(),o.push({kind:"divider"});else if(f){p();const v=f[2]??"";Jt(v)&&o.push({kind:"image",url:v,alt:f[1]??"",caption:""})}else 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 pr={heading:"Heading",paragraph:"Paragraph",list:"List",quote:"Quote",divider:"Divider",image:"BlockImage"};function hr(t,e){const s=[];for(const o of t){const a=e[pr[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 xr({title:t,blocks:e,takenSlugs:s,now:o}){const a=t.trim();return{title:a,slug:a?xo(a,s):ho(""),date:o.toISOString().slice(0,10),excerpt:"",image:"",alt:"",authors:[],categories:[],sections:e,status:"in_review"}}const un="__all__",mn={"date-desc":"sandbox.postToolbar.sortNewestFirst","date-asc":"sandbox.postToolbar.sortOldestFirst",az:"sandbox.postToolbar.sortTitleAZ",za:"sandbox.postToolbar.sortTitleZA"},gr={"date-desc":"sandbox.postToolbar.sortNewest","date-asc":"sandbox.postToolbar.sortOldest",az:"sandbox.postToolbar.sortAZ",za:"sandbox.postToolbar.sortZA"},fn="status:";function pn(t){if(!t.startsWith(fn))return null;const e=t.slice(fn.length);return Ds.includes(e)?e:null}const hn=$.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=be("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=n.jsx(a,{size:14,className:"shrink-0"}),o[9]=a,o[10]=m):m=o[10];let h;o[11]!==r?(h=r&&n.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=n.jsx(ft,{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=n.jsxs(_e,{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 Ls(t){const e=ae.c(2),{count:s}=t;let o;return e[0]!==s?(o=n.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 br(t){const e=ae.c(19),{value:s,onChange:o}=t,a=Se();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(Ss,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[0]=l):l=e[0];let i;e[1]!==o?(i=h=>o(h.target.value),e[1]=o,e[2]=i):i=e[2];let c;e[3]!==a?(c=a("sandbox.postToolbar.searchPlaceholder"),e[3]=a,e[4]=c):c=e[4];let r;e[5]!==a?(r=a("sandbox.postToolbar.searchAriaLabel"),e[5]=a,e[6]=r):r=e[6];let d;e[7]!==i||e[8]!==c||e[9]!==r||e[10]!==s?(d=n.jsx("input",{type:"text",value:s,onChange:i,placeholder:c,"aria-label":r,className:"min-w-0 flex-1 bg-transparent py-0.5 text-sm outline-none placeholder:text-muted-foreground"}),e[7]=i,e[8]=c,e[9]=r,e[10]=s,e[11]=d):d=e[11];let p;e[12]!==o||e[13]!==a||e[14]!==s?(p=s&&n.jsx(Co,{label:a("sandbox.postToolbar.clearSearch"),onClick:()=>o("")}),e[12]=o,e[13]=a,e[14]=s,e[15]=p):p=e[15];let m;return e[16]!==d||e[17]!==p?(m=n.jsxs("div",{className:"flex items-center gap-2 border-b px-2.5 py-1.5",children:[l,d,p]}),e[16]=d,e[17]=p,e[18]=m):m=e[18],m}function yr(t){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}=t,u=Se();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?qt[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 w=j,C=l?`cat:${l}`:i?`author:${i}`:c?`status:${c}`:un;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))):pn(H)?(d(null),p(null),m(pn(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]!==w||e[25]!==v?(O=n.jsx(It,{asChild:!0,children:n.jsx(hn,{icon:Mo,active:v,value:w,className:"min-w-0 shrink"})}),e[24]=w,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=n.jsx(bt,{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?(_=n.jsx(St,{value:un,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 I;e[37]!==A?(I=n.jsx(bt,{className:"text-muted-foreground/70",children:A}),e[37]=A,e[38]=I):I=e[38];let R;e[39]!==a||e[40]!==u?(R=Ds.map(H=>n.jsxs(St,{value:`status:${H}`,children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:u(qt[H])}),n.jsx(Ls,{count:a[H]??0})]},`status:${H}`)),e[39]=a,e[40]=u,e[41]=R):R=e[41];let G;e[42]!==s.length||e[43]!==u?(G=s.length>0&&n.jsx(bt,{className:"text-muted-foreground/70",children:u("sandbox.postToolbar.categoryLabel")}),e[42]=s.length,e[43]=u,e[44]=G):G=e[44];let z;e[45]!==s?(z=s.map(jr),e[45]=s,e[46]=z):z=e[46];let W;e[47]!==o.length||e[48]!==u?(W=o.length>0&&n.jsx(bt,{className:"text-muted-foreground/70",children:u("sandbox.postToolbar.authorLabel")}),e[47]=o.length,e[48]=u,e[49]=W):W=e[49];let T;e[50]!==o?(T=o.map(vr),e[50]=o,e[51]=T):T=e[51];let U;e[52]!==C||e[53]!==D||e[54]!==_||e[55]!==I||e[56]!==R||e[57]!==G||e[58]!==z||e[59]!==W||e[60]!==T?(U=n.jsxs(Fs,{value:C,onValueChange:D,children:[_,I,R,G,z,W,T]}),e[52]=C,e[53]=D,e[54]=_,e[55]=I,e[56]=R,e[57]=G,e[58]=z,e[59]=W,e[60]=T,e[61]=U):U=e[61];let Y;e[62]!==U||e[63]!==K?(Y=n.jsxs(Rt,{align:"start",className:"max-h-96 w-60 overflow-y-auto",children:[K,U]}),e[62]=U,e[63]=K,e[64]=Y):Y=e[64];let q;e[65]!==Y||e[66]!==O?(q=n.jsxs(Ft,{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&&n.jsx(Co,{label:u("sandbox.postToolbar.clearFilter"),onClick:B}),e[68]=B,e[69]=v,e[70]=u,e[71]=X):X=e[71];const de=gr[r];let ne;e[72]!==u||e[73]!==de?(ne=u(de),e[72]=u,e[73]=de,e[74]=ne):ne=e[74];let ue;e[75]!==ne?(ue=n.jsx(It,{asChild:!0,children:n.jsx(hn,{icon:Vo,active:!0,value:ne})}),e[75]=ne,e[76]=ue):ue=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=n.jsx(bt,{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 N;e[83]===Symbol.for("react.memo_cache_sentinel")?(N=Object.keys(mn),e[83]=N):N=e[83];let J;e[84]!==u?(J=N.map(H=>n.jsx(St,{value:H,children:u(mn[H])},H)),e[84]=u,e[85]=J):J=e[85];let Z;e[86]!==r||e[87]!==le||e[88]!==J?(Z=n.jsx(Fs,{value:r,onValueChange:le,children:J}),e[86]=r,e[87]=le,e[88]=J,e[89]=Z):Z=e[89];let oe;e[90]!==re||e[91]!==Z?(oe=n.jsxs(Rt,{align:"end",className:"w-44",children:[re,Z]}),e[90]=re,e[91]=Z,e[92]=oe):oe=e[92];let S;e[93]!==ue||e[94]!==oe?(S=n.jsx("div",{className:"ml-auto shrink-0",children:n.jsxs(Ft,{children:[ue,oe]})}),e[93]=ue,e[94]=oe,e[95]=S):S=e[95];let se;return e[96]!==q||e[97]!==X||e[98]!==S?(se=n.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 vr(t){return n.jsxs(St,{value:`author:${t.email}`,children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),n.jsx(Ls,{count:t.count})]},`author:${t.email}`)}function jr(t){return n.jsxs(St,{value:`cat:${t.slug}`,children:[n.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.name}),n.jsx(Ls,{count:t.count})]},`cat:${t.slug}`)}function Co(t){const e=ae.c(4),{label:s,onClick:o}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Bs,{size:12}),e[0]=a):a=e[0];let l;return e[1]!==s||e[2]!==o?(l=n.jsx("button",{type:"button","aria-label":s,onClick:o,className:"flex h-6 w-6 shrink-0 items-center justify-center text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer rounded-lg",children:a}),e[1]=s,e[2]=o,e[3]=l):l=e[3],l}function kr(t){const e=ae.c(18),{checked:s,disabled:o,onToggle:a}=t,l=Se();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=n.jsx(We,{asChild:!0,children:n.jsx("span",{className:"flex shrink-0 items-center px-1.5",onClick:Sr,children:n.jsx(Xt,{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=n.jsx(Ye,{side:"bottom",children:d}),e[13]=d,e[14]=p):p=e[14];let m;return e[15]!==r||e[16]!==p?(m=n.jsxs(Qe,{children:[r,p]}),e[15]=r,e[16]=p,e[17]=m):m=e[17],m}function Sr(t){return t.stopPropagation()}function wr(t){const e=ae.c(42),{count:s,allSelected:o,onToggleSelectAll:a,onArchive:l,onExit:i}=t,c=Se();let r;e[0]!==o||e[1]!==a?(r=n.jsx(kr,{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=n.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=n.jsx(Eo,{size:14}),e[10]=u):u=e[10];let f;e[11]!==l||e[12]!==m||e[13]!==h?(f=n.jsx(We,{asChild:!0,children:n.jsx(_e,{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=n.jsx(Ye,{side:"bottom",children:g}),e[17]=g,e[18]=x):x=e[18];let y;e[19]!==f||e[20]!==x?(y=n.jsxs(Qe,{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=n.jsx(Bs,{size:14}),e[24]=j):j=e[24];let w;e[25]!==i||e[26]!==v?(w=n.jsx(We,{asChild:!0,children:n.jsx(_e,{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]=w):w=e[27];let C;e[28]!==c?(C=c("sandbox.postToolbar.exitSelection"),e[28]=c,e[29]=C):C=e[29];let E;e[30]!==C?(E=n.jsx(Ye,{side:"bottom",children:C}),e[30]=C,e[31]=E):E=e[31];let B;e[32]!==w||e[33]!==E?(B=n.jsxs(Qe,{children:[w,E]}),e[32]=w,e[33]=E,e[34]=B):B=e[34];let k;e[35]!==y||e[36]!==B?(k=n.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=n.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 Nr={draft:"outline",generating:"secondary",awaiting_review:"warning",scheduled:"secondary",published:"success",archived:"outline"},xn="ideas",gn=t=>t.scheduledDatetime||t.date||"",Cr=(t,e)=>gn(e).localeCompare(gn(t)),Pr=t=>t==="scheduled"||t==="published",Po="application/x-post-key";function Tr({orgSlug:t,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=Se(),f=js(),g=Qt({orgSlug:t,virtualMcpId:e,branch:s}),x=Vn({orgSlug:t,virtualMcpId:e,branch:s}),y=ll().length>0,[v,j]=$.useState(null),[w,C]=$.useState(!1),[E,B]=$.useState(!1),[k,D]=$.useState(""),[O,L]=$.useState(3),[K,F]=$.useState(""),[_,A]=$.useState(!1),[I,R]=$.useState(!1),[G,z]=$.useState(),[W,T]=$.useState(!1),[U,Y]=$.useState(""),q=$.useRef(null),[X,de]=_o(Do.blogBoardCollapsedLanes(),[]),ne=P=>de(Q=>Q.includes(P)?Q.filter(Ee=>Ee!==P):[...Q,P]),ue=tr({orgSlug:t,virtualMcpId:e,branch:s,decofile:o,meta:m,onStarted:c}),te=ti(o),re=co(o),le=mo(o),N=P=>le.find(Q=>Q.key===P)?.title,J=P=>dt(o[P],"posts"),Z=l&&te.some(P=>P.key===l)?l:te[0]?.key??null,oe=async P=>{await d.apply(P.key,"archived")&&me.success(u("sandbox.postBoard.archived"))},[S,se]=$.useState(null),[H,ie]=$.useState(null),[ve,pe]=$.useState(null),[ke,he]=$.useState("date-desc"),[we,Pe]=$.useState(""),[Te,Ne]=$.useState(new Set),Be=te.reduce((P,Q)=>(P[Q.status]=(P[Q.status]??0)+1,P),{}),De=P=>{const Q=new Map;for(const Ee of te)for(const Ve of P(Ee))Q.set(Ve,(Q.get(Ve)??0)+1);return Q},xe=De(P=>P.categorySlugs),$e=De(P=>P.authorEmails),Fe=Ge(o,"categories").map(({payload:P})=>({slug:ye(P.slug),name:ye(P.name)||ye(P.slug),count:xe.get(ye(P.slug))??0})),M=Ge(o,"authors").map(({payload:P})=>({email:ye(P.email),name:ye(P.name)||ye(P.email),count:$e.get(ye(P.email))??0})),ge=we.trim().toLowerCase(),je=te.filter(P=>!S||P.categorySlugs.includes(S)).filter(P=>!H||P.authorEmails.includes(H)).filter(P=>!ve||P.status===ve).filter(P=>!ge||P.title.toLowerCase().includes(ge)||P.slug.toLowerCase().includes(ge)).sort((P,Q)=>{if(ke==="az")return P.title.localeCompare(Q.title);if(ke==="za")return Q.title.localeCompare(P.title);const Ee=(P.scheduledDatetime||P.date).localeCompare(Q.scheduledDatetime||Q.date);return ke==="date-asc"?Ee:-Ee}),Le=Te.size>0,ss=P=>Ne(Q=>{const Ee=new Set(Q);return Ee.delete(P)||Ee.add(P),Ee}),ns=()=>Ne(P=>je.every(Q=>P.has(Q.key))?new Set:new Set(je.map(Q=>Q.key))),os=async()=>{let P=0;for(const Q of Te)await d.apply(Q,"archived")&&(P+=1);Ne(new Set),P>0&&me.success(u("sandbox.postBoard.archived"))},as=P=>{z({key:P.key,title:P.title,body:P.body}),R(!0)},ls=P=>{x.mutate({blockKey:P.key})},is=(P,Q)=>{j(null),d.apply(Q,P)},_t=()=>{const P=Vt(bs()),Q=ao({title:"",now:new Date});g.mutate({blockKey:P,data:ut(P,Q)}),c(P)},rs=()=>{const P=nr(U),Q=hr(P.sections,po(m));if(Q.length===0&&!P.title.trim()){me.error(u("sandbox.postBoard.importEmpty"));return}const Ee=Vt(bs()),Ve=xr({title:P.title,blocks:Q,takenSlugs:te.map(qe=>qe.slug).filter(Boolean),now:new Date});g.mutate({blockKey:Ee,data:ut(Ee,Ve)}),T(!1),Y(""),me.success(u("sandbox.postBoard.imported")),c(Ee)},cs=async()=>{C(!0);const P=le.find(Q=>Q.key===K);try{const Q=o[As]??{},Ee=o[fo],Ve=Ke(Ee?.formats).map(b=>b.name).filter(Boolean),qe=await f.call("BLOG_THEME_SUGGEST",{brand:{companyName:ye(Q.companyName),description:ye(Q.description),language:ye(Q.language),tone:ye(Q.tone),targetAudience:ye(Q.targetAudience),values:Me(Ke(Q.values)),dos:Me(Ke(Q.dos)),avoid:Me(Ke(Q.avoid))},existingTitles:re.map(b=>b.title).filter(Boolean),formats:Ve,guidance:[P&&`Every idea must be one angle inside the pillar "${P.title}": ${P.body}`,k.trim()].filter(Boolean).join(`
|
|
8
8
|
|
|
9
|
-
`)||void 0,count:O}),Ce=vi(re.map(b=>b.title),qe.themes);if(Ce.length===0){me.info(u("sandbox.postBoard.ideasFailed"));return}let gt=0;for(const b of Ce){const V=pi();try{await g.mutateAsync({blockKey:V,data:hi(V,{title:b.title,body:b.body,pillarKey:P?.key,createdAt:new Date().toISOString()})}),gt++}catch(ce){console.warn("[posts] could not save a generated idea",ce)}}if(gt===0){me.error(u("sandbox.postBoard.ideasFailed"));return}me.success(u("sandbox.postBoard.ideasAdded",{count:String(gt)}))}catch(Q){me.error(Q instanceof Error?Q.message:u("sandbox.postBoard.ideasFailed"))}finally{C(!1)}};return n.jsxs("div",{className:"relative flex h-full min-w-0 flex-col",children:[n.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-between gap-3 border-b px-6 py-3",children:[n.jsx("div",{className:"flex items-center gap-3",children:n.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border p-0.5",children:[n.jsx(bn,{active:a==="board",onClick:()=>i("board"),icon:n.jsx(Go,{size:14}),label:u("sandbox.postBoard.viewBoard")}),n.jsx(bn,{active:a==="list",onClick:()=>i("list"),icon:n.jsx(Yo,{size:14}),label:u("sandbox.postBoard.viewList")})]})}),n.jsxs("div",{className:"flex items-center gap-2",children:[w&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","aria-live":"polite",role:"status",children:[n.jsx(wt,{size:12,className:"animate-spin"}),u("sandbox.postBoard.generatingLabel")]}),n.jsxs(ct,{open:E,onOpenChange:B,children:[n.jsx(Qa,{asChild:!0,children:n.jsxs(_e,{type:"button",variant:"outline",size:"sm",disabled:!0,children:[n.jsx(et,{size:14}),u("sandbox.postBoard.generateIdeas"),n.jsx(nt,{variant:"secondary",children:u("common.soon")})]})}),n.jsxs(rt,{className:"sm:max-w-lg",children:[n.jsxs(pt,{children:[n.jsx(it,{children:u("sandbox.postBoard.generateIdeas")}),n.jsx(zt,{children:u("sandbox.postBoard.ideaGuidanceLabel")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(Ot,{id:"idea-guidance",value:k,rows:6,autoFocus:!0,onChange:P=>D(P.target.value),placeholder:u("sandbox.postBoard.ideaGuidancePlaceholder"),className:"resize-none text-sm"}),le.length>0&&n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(ze,{className:"text-xs",children:u("sandbox.postBoard.ideaPillarLabel")}),n.jsx(kt,{options:le.map(P=>P.title),value:le.find(P=>P.key===K)?.title??"",emptyLabel:u("sandbox.postBoard.ideaNoPillar"),onChange:P=>F(le.find(Q=>Q.title===P)?.key??"")})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ze,{htmlFor:"idea-count",className:"text-xs",children:u("sandbox.postBoard.ideaCount")}),n.jsx(Xe,{id:"idea-count",type:"number",min:1,max:8,value:O,onChange:P=>L(Math.max(1,Math.min(8,Number(P.target.value)||1))),className:"h-9 w-16"}),n.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:u("sandbox.postBoard.usesCredits")})]})]}),n.jsx(ht,{children:n.jsxs(_e,{type:"button",onClick:()=>{B(!1),cs()},children:[n.jsx(et,{size:14}),u("sandbox.postBoard.generateIdeas")]})})]})]}),n.jsxs(Ft,{children:[n.jsx(It,{asChild:!0,children:n.jsxs(_e,{type:"button",size:"sm",children:[n.jsx(ws,{size:14}),u("sandbox.postBoard.newPost"),n.jsx(ft,{size:14})]})}),n.jsxs(Rt,{align:"end",className:"w-56",children:[n.jsxs(Je,{disabled:!0,onClick:()=>{z(void 0),R(!0)},children:[n.jsx(et,{size:14}),n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[u("sandbox.postBoard.newPostGenerate"),n.jsx(nt,{variant:"secondary",children:u("common.soon")})]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.newPostGenerateHint")})]})]}),n.jsxs(Je,{onClick:_t,children:[n.jsx(Uo,{size:14}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:u("sandbox.postBoard.newPostWrite")}),n.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.newPostWriteHint")})]})]}),n.jsxs(Je,{onClick:()=>T(!0),children:[n.jsx(fs,{size:14}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:u("sandbox.postBoard.importContent")}),n.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.importContentHint")})]})]})]})]}),n.jsx(Yi,{open:I,onOpenChange:R,decofile:o,hasAi:y,seed:G,onGenerate:P=>{ue(P)}},G?.title??"scratch"),n.jsx(ct,{open:W,onOpenChange:T,children:n.jsxs(rt,{className:"max-h-[85vh] sm:max-w-2xl",children:[n.jsxs(pt,{children:[n.jsx(it,{children:u("sandbox.postBoard.importTitle")}),n.jsx(zt,{children:u("sandbox.postBoard.importDescription")})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"h-72 overflow-hidden rounded-[var(--studio-control-radius,var(--radius-xl))] border bg-[var(--studio-input-background)]",children:n.jsx(Hn,{code:U,language:So(U)?"html":"markdown",height:"100%",autoFocus:!0,onChange:P=>Y(P??"")})}),n.jsx("input",{ref:q,type:"file",accept:".html,.htm,.md,.markdown,.txt",className:"hidden",onChange:async P=>{const Q=P.target.files?.[0];Q&&Y(await Q.text()),P.target.value=""}}),n.jsxs(_e,{type:"button",variant:"outline",size:"sm",onClick:()=>q.current?.click(),children:[n.jsx(fs,{size:14}),u("sandbox.postBoard.importUpload")]})]}),n.jsx(ht,{children:n.jsxs(_e,{type:"button",disabled:!U.trim(),onClick:rs,children:[n.jsx(fs,{size:14}),u("sandbox.postBoard.importRun")]})})]})})]})]}),te.length===0&&re.length===0?n.jsx(al,{className:"flex-1",icon:n.jsx(et,{size:22}),title:u("sandbox.postBoard.emptyTitle"),description:u("sandbox.postBoard.emptyDescription"),buttonProps:{children:u("sandbox.postBoard.newPost"),onClick:_t}}):a==="board"?n.jsxs("div",{className:"flex min-h-0 flex-1 gap-3 overflow-x-auto p-4",children:[n.jsx(Dr,{ideas:re,collapsed:X.includes(xn),pillarTitleOf:N,onToggleCollapsed:()=>ne(xn),onGenerate:as,onDelete:ls}),n.jsx("div",{"aria-hidden":!0,className:"my-1 w-px shrink-0 self-stretch bg-border"}),Ds.map(P=>{const Q=te.filter(Ce=>Ce.status===P);Pr(P)&&Q.sort(Cr);const Ee=u(qt[P]),Ve=X.includes(P),qe=jo(p,P);return n.jsx("div",{onDragOver:Ce=>{Ce.preventDefault(),j(P)},onDragLeave:()=>j(Ce=>Ce===P?null:Ce),onDrop:Ce=>{Ce.preventDefault(),is(P,Ce.dataTransfer.getData(Po))},title:qe?ko(u,qe):void 0,className:be("flex shrink-0 flex-col rounded-xl border bg-muted/30 transition-colors",Ve?"w-11":"w-72",qe&&"opacity-50",v===P&&"border-primary bg-primary/5"),children:Ve?n.jsxs("button",{type:"button",onClick:()=>ne(P),"aria-label":u("sandbox.postBoard.expandLane",{lane:Ee}),"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:[n.jsx(Tt,{size:14,className:"shrink-0"}),n.jsx("span",{className:"text-xs tabular-nums",children:Q.length}),n.jsx("span",{className:"[writing-mode:vertical-rl] text-sm font-medium",children:Ee})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2.5 text-sm font-medium",children:[n.jsxs("button",{type:"button",onClick:()=>ne(P),"aria-label":u("sandbox.postBoard.collapseLane",{lane:Ee}),"aria-expanded":!0,className:"flex min-w-0 cursor-pointer items-center gap-1.5 text-left hover:text-muted-foreground",children:[n.jsx(ft,{size:14,className:"shrink-0"}),n.jsx("span",{className:"truncate",children:Ee})]}),n.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:Q.length})]}),n.jsx("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto px-2 pb-2",children:Q.length===0?n.jsx("p",{className:"px-1 py-6 text-center text-xs text-muted-foreground",children:u("sandbox.postBoard.laneEmpty")}):Q.map(Ce=>n.jsx(_r,{post:Ce,payload:J(Ce.key),moving:d.isMoving(Ce.key),onOpen:()=>c(Ce.key),onArchive:Ce.status==="archived"?void 0:()=>{oe(Ce)}},Ce.key))})]})},P)})]}):n.jsxs("div",{className:"flex min-h-0 flex-1",children:[n.jsxs("div",{className:"flex w-80 shrink-0 flex-col border-r",children:[n.jsx(br,{value:we,onChange:Pe}),Le?n.jsx(wr,{count:Te.size,allSelected:je.length>0&&je.every(P=>Te.has(P.key)),onToggleSelectAll:ns,onArchive:()=>{os()},onExit:()=>Ne(new Set)}):n.jsx(yr,{categories:Fe,authors:M,statusCounts:Be,categoryFilter:S,authorFilter:H,statusFilter:ve,sort:ke,onCategoryFilterChange:se,onAuthorFilterChange:ie,onStatusFilterChange:pe,onSortChange:he}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:n.jsx(Br,{posts:je,selectedKey:Z,selectionActive:Le,selectedKeys:Te,onToggleSelect:ss,onOpen:c,isMoving:d.isMoving,onArchive:P=>{oe(P)}})})]}),n.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:Z&&h?n.jsx($.Suspense,{fallback:n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsx(wt,{size:20,className:"animate-spin text-muted-foreground"})}),children:h(Z)}):n.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&&n.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?.()}})}),n.jsx(ct,{open:a==="board"&&!!l&&!_,onOpenChange:P=>{P||(A(!1),r?.())},children:n.jsxs(rt,{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:[n.jsx(it,{className:"sr-only",children:u("sandbox.collectionsSidebar.posts")}),l&&h?n.jsx($.Suspense,{fallback:n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsx(wt,{size:20,className:"animate-spin text-muted-foreground"})}),children:h(l,{expanded:!1,onToggleExpand:()=>A(!0),onClose:()=>r?.()})}):null]})})]})}function bn(t){const e=ae.c(7),{active:s,onClick:o,icon:a,label:l}=t,i=s?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground";let c;e[0]!==i?(c=be("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=n.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 Br(t){const e=ae.c(23),{posts:s,selectedKey:o,selectionActive:a,selectedKeys:l,onToggleSelect:i,onOpen:c,isMoving:r,onArchive:d}=t,p=Se();if(s.length===0){let u;e[0]!==p?(u=p("sandbox.postList.noMatches"),e[0]=p,e[1]=u):u=e[1];let f;return e[2]!==u?(f=n.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:u}),e[2]=u,e[3]=f):f=e[3],f}let m;if(e[4]!==r||e[5]!==d||e[6]!==c||e[7]!==i||e[8]!==s||e[9]!==o||e[10]!==l||e[11]!==a){let u;e[13]!==r||e[14]!==d||e[15]!==c||e[16]!==i||e[17]!==o||e[18]!==l||e[19]!==a?(u=f=>n.jsx(Er,{post:f,selected:f.key===o,selectionActive:a,checked:l.has(f.key),onToggleSelect:()=>i(f.key),moving:r(f.key),onOpen:()=>c(f.key),onArchive:f.status==="archived"?void 0:()=>d(f)},f.key),e[13]=r,e[14]=d,e[15]=c,e[16]=i,e[17]=o,e[18]=l,e[19]=a,e[20]=u):u=e[20],m=s.map(u),e[4]=r,e[5]=d,e[6]=c,e[7]=i,e[8]=s,e[9]=o,e[10]=l,e[11]=a,e[12]=m}else m=e[12];let h;return e[21]!==m?(h=n.jsx("ul",{className:"divide-y",children:m}),e[21]=m,e[22]=h):h=e[22],h}function Er(t){const e=ae.c(56),{post:s,selected:o,selectionActive:a,checked:l,onToggleSelect:i,moving:c,onOpen:r,onArchive:d}=t,p=Se(),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=be("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=n.jsx(Xt,{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=n.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&&n.jsx(Os,{onArchive:d,disabled:c,className:"top-2.5"}),e[14]=c,e[15]=d,e[16]=a,e[17]=j):j=e[17];let w;e[18]!==r||e[19]!==i||e[20]!==a?(w=()=>a?i():r(),e[18]=r,e[19]=i,e[20]=a,e[21]=w):w=e[21];const C=o?"bg-accent text-accent-foreground":"bg-card hover:bg-muted/50";let E;e[22]!==C?(E=be("flex w-full cursor-pointer flex-col gap-1.5 py-2.5 pl-10 pr-3 text-left text-sm transition-colors",C),e[22]=C,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=n.jsx("span",{className:"min-w-0 truncate pr-6 font-medium",children:B}),e[27]=B,e[28]=k):k=e[28];const D=Nr[s.status],O=qt[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=n.jsx(nt,{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&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-warning",children:[n.jsx(Wt,{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&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs tabular-nums text-muted-foreground",children:[n.jsx(ks,{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=n.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 I;e[46]!==o||e[47]!==E||e[48]!==k||e[49]!==A||e[50]!==w?(I=n.jsxs("button",{type:"button",onClick:w,"aria-current":o,className:E,children:[k,A]}),e[46]=o,e[47]=E,e[48]=k,e[49]=A,e[50]=w,e[51]=I):I=e[51];let R;return e[52]!==I||e[53]!==v||e[54]!==j?(R=n.jsxs("li",{className:"group/row relative",children:[v,j,I]}),e[52]=I,e[53]=v,e[54]=j,e[55]=R):R=e[55],R}function _r(t){const e=ae.c(46),{post:s,payload:o,moving:a,onOpen:l,onArchive:i}=t,c=Se(),r=s.status!=="generating"&&!a;let d;e[0]!==o?(d=Zl(o),e[0]=o,e[1]=d):d=e[1];const p=d,m=!r&&"opacity-80";let h;e[2]!==m?(h=be("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&&n.jsx(Os,{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(Po,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=be("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=n.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"&&n.jsxs(n.Fragment,{children:[p.pillarTitle&&n.jsx(nt,{variant:"secondary",className:"max-w-full truncate",children:p.pillarTitle}),p.format?.name&&n.jsx(nt,{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 w;e[19]!==s.status||e[20]!==c?(w=s.status==="generating"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[n.jsx(wt,{size:12,className:"animate-spin"}),c("sandbox.postBoard.generatingLabel")]}),e[19]=s.status,e[20]=c,e[21]=w):w=e[21];let C;e[22]!==s.missing||e[23]!==s.status||e[24]!==c?(C=s.status==="awaiting_review"&&(s.missing.length>0?n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-warning",children:[n.jsx(Wt,{size:12}),c("sandbox.postBoard.nIssues",{count:String(s.missing.length)})]}):n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-success",children:[n.jsx(ol,{size:12}),c("sandbox.postBoard.readyToSchedule")]})),e[22]=s.missing,e[23]=s.status,e[24]=c,e[25]=C):C=e[25];let E;e[26]!==s.date||e[27]!==s.scheduledDatetime||e[28]!==s.status?(E=(s.status==="scheduled"||s.status==="published")&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[n.jsx(ks,{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]!==w||e[32]!==C||e[33]!==E?(B=n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[j,w,C,E]}),e[30]=j,e[31]=w,e[32]=C,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=n.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=n.jsxs("div",{className:h,children:[u,k]}),e[42]=k,e[43]=h,e[44]=u,e[45]=D):D=e[45],D}function Dr(t){const e=ae.c(40),{ideas:s,collapsed:o,pillarTitleOf:a,onToggleCollapsed:l,onGenerate:i,onDelete:c}=t,r=Se();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=n.jsx(Tt,{size:14,className:"shrink-0"}),e[11]=k):k=e[11];let D;e[12]!==s.length?(D=n.jsx("span",{className:"text-xs tabular-nums",children:s.length}),e[12]=s.length,e[13]=D):D=e[13],g=n.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,n.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=n.jsx(ft,{size:14,className:"shrink-0"}),e[14]=x):x=e[14];let y;e[15]!==d?(y=n.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=n.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=n.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:s.length}),e[22]=s.length,e[23]=j):j=e[23];let w;e[24]!==j||e[25]!==u||e[26]!==v?(w=n.jsxs("div",{className:u,children:[v,j]}),e[24]=j,e[25]=u,e[26]=v,e[27]=w):w=e[27];let C;e[28]!==s||e[29]!==c||e[30]!==i||e[31]!==a||e[32]!==r?(C=s.length===0?n.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 n.jsxs("div",{className:"group/card relative rounded-lg border border-dashed bg-card shadow-sm transition-colors hover:border-primary/40",children:[n.jsx(Os,{label:r("sandbox.postBoard.deleteIdea"),onArchive:()=>c(k),className:"top-2"}),n.jsxs("div",{className:"p-3",children:[n.jsx("p",{className:"line-clamp-2 pr-6 text-sm font-medium",children:k.title||r("sandbox.postBoard.untitledIdea")}),k.body&&n.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:k.body}),D&&n.jsx(nt,{variant:"secondary",className:"mt-2 max-w-full truncate",children:D})]}),n.jsx("div",{className:"border-t px-3 py-2",children:n.jsxs(_e,{type:"button",variant:"ghost",size:"sm",disabled:!0,className:"h-7 w-full justify-start px-1.5 text-xs",onClick:()=>i(k),children:[n.jsx(et,{size:13}),r("sandbox.postBoard.writeFromIdea"),n.jsx(nt,{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]=C):C=e[33];let E;e[34]!==C?(E=n.jsx("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto pb-2 pr-1",children:C}),e[34]=C,e[35]=E):E=e[35];let B;return e[36]!==w||e[37]!==E||e[38]!==f?(B=n.jsxs("div",{className:f,children:[w,E]}),e[36]=w,e[37]=E,e[38]=f,e[39]=B):B=e[39],B}function Os(t){const e=ae.c(13),{label:s,onArchive:o,disabled:a,className:l}=t,i=Se();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=be("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=n.jsx(Ts,{size:13}),e[7]=m):m=e[7];let h;return e[8]!==a||e[9]!==d||e[10]!==p||e[11]!==r?(h=n.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 Ue(t){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}=t,v=Se(),j=c==="global";let w;e[0]!==s||e[1]!==i||e[2]!==j||e[3]!==o?(w=o?n.jsx("img",{src:o,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):n.jsx("span",{className:be("flex size-8 shrink-0 items-center justify-center rounded-lg",j?"bg-global-section/15":"bg-muted"),children:n.jsx(s,{size:16,className:be("shrink-0",!j&&(i?"text-accent-foreground":"text-muted-foreground")),style:j?{color:Ps}:void 0})}),e[0]=s,e[1]=i,e[2]=j,e[3]=o,e[4]=w):w=e[4];const C=w,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=be("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&&n.jsx("span",{className:be("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:Ar,children:n.jsx(Xt,{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=be("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=n.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=be("block truncate text-xs",K),e[19]=K,e[20]=F):F=e[20];let _;e[21]!==l||e[22]!==F?(_=n.jsx("span",{className:F,children:l}),e[21]=l,e[22]=F,e[23]=_):_=e[23];let A;e[24]!==_||e[25]!==L?(A=n.jsxs("span",{className:"min-w-0 flex-1",children:[L,_]}),e[24]=_,e[25]=L,e[26]=A):A=e[26];let I;e[27]!==i||e[28]!==v||e[29]!==r?(I=r!==void 0&&r>1&&n.jsxs(Qe,{children:[n.jsx(We,{asChild:!0,children:n.jsxs("span",{className:be("flex shrink-0 items-center gap-1 text-xs font-medium",i?"text-accent-foreground/70":"text-muted-foreground"),children:[n.jsx(Bn,{size:14}),r]})}),n.jsx(Ye,{side:"bottom",children:v("sandbox.itemRow.variantCount",{count:r})})]}),e[27]=i,e[28]=v,e[29]=r,e[30]=I):I=e[30];let R;e[31]!==i||e[32]!==u||e[33]!==f?(R=u&&n.jsxs(Qe,{children:[n.jsx(We,{asChild:!0,children:n.jsx("span",{className:be("flex shrink-0 items-center",i?"text-accent-foreground":"text-destructive"),children:n.jsx(Wt,{size:14})})}),f&&n.jsx(Ye,{side:"bottom",children:f})]}),e[31]=i,e[32]=u,e[33]=f,e[34]=R):R=e[34];let G;e[35]!==x||e[36]!==C||e[37]!==A||e[38]!==I||e[39]!==R||e[40]!==d?(G=n.jsxs("button",{type:"button",onClick:x,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-lg px-2.5 py-2 text-left cursor-pointer",children:[C,A,I,R,d]}),e[35]=x,e[36]=C,e[37]=A,e[38]=I,e[39]=R,e[40]=d,e[41]=G):G=e[41];let z;e[42]!==i||e[43]!==y?(z=y&&n.jsx("div",{className:be("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 W;return e[45]!==G||e[46]!==z||e[47]!==B||e[48]!==k?(W=n.jsxs("div",{className:B,children:[k,G,z]}),e[45]=G,e[46]=z,e[47]=B,e[48]=k,e[49]=W):W=e[49],W}function Ar(t){return t.stopPropagation()}function tt(t){const e=ae.c(10),{icon:s,title:o,description:a}=t;let l;e[0]!==s?(l=s&&n.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=l):l=e[1];let i;e[2]!==o?(i=n.jsx("div",{children:o}),e[2]=o,e[3]=i):i=e[3];let c;e[4]!==a?(c=a&&n.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=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[l,i,c]}),e[6]=l,e[7]=i,e[8]=c,e[9]=r):r=e[9],r}const $r={loaders:Tn,actions:An},Lr={loaders:"Loaders",actions:"Actions"},Or={analytics:Jo,blog:Gn,commerce:qo,site:Ho,website:Kt};function Ir(t,e){return e===0?Or[t.toLowerCase()]??Ks:Ks}function At(t,e){return e===0?pa(t):t}function Rr(t){const e=ae.c(98),{orgSlug:s,virtualMcpId:o,branch:a,previewUrl:l,meta:i,decofile:c,kind:r}=t,d=Se();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(Hr),[j,w]=$.useState(r);j!==r&&(w(r),h([]),f(null),x(""),v(new Set));let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=q=>{v(X=>{const de=new Set(X);return de.has(q)?de.delete(q):de.add(q),de})},e[1]=C):C=e[1];const E=C;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=Qt(B);let D;e[6]!==k?(D=Fn((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=ha(r),e[8]=r,e[9]=L):L=e[9];const K=L,F=$r[r];let _,A,I,R,G,z,W;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){I=Symbol.for("react.early_return_sentinel");e:{const q=[...da(i,c,r).map(Ur),...ua(i,r).map(Gr)],X=g.trim().toLowerCase(),de=X.length>0,ne=de?q.filter(M=>M.title.toLowerCase().includes(X)||M.resolveType.toLowerCase().includes(X)):[],ue=new Map,te=[],re=new Map;if(!de){for(const M of q){const ge=M.folderPath;if(!(ge.length<m.length)&&m.every((je,Le)=>ge[Le]===je))if(ge.length===m.length)if(M.savedKey!==void 0){const je=re.get(M.resolveType);je?je.push(M):re.set(M.resolveType,[M])}else te.push(M);else{const je=ge[m.length],Le=ue.get(je)??{count:0,savedCount:0};M.savedKey!==void 0?Le.savedCount=Le.savedCount+1:Le.count=Le.count+1,ue.set(je,Le)}}te.sort(Vr);for(const M of re.values())M.sort(Mr)}const le=[...re.entries()].filter(M=>{const[ge]=M;return!te.some(je=>je.resolveType===ge)}).flatMap(zr).sort(Kr);let N;e[33]!==m?(N=(M,ge)=>At(M.name,m.length).localeCompare(At(ge.name,m.length)),e[33]=m,e[34]=N):N=e[34];const J=[...ue.entries()].map(Fr).sort(N);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,ge)=>{await k.mutateAsync({blockKey:M,data:ge}),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=qr(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 ge;e[43]===Symbol.for("react.memo_cache_sentinel")?(ge=()=>f(null),e[43]=ge):ge=e[43];let je;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?(je=n.jsx(ma,{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:ge},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]=je):je=e[57],I=je;break e}W="flex h-full w-full min-w-0 flex-col";let ve;e[58]!==d?(ve=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=ve):ve=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=be("min-w-0 truncate 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 we=Lr[r];let Pe;e[63]!==he||e[64]!==we?(Pe=n.jsx("button",{type:"button",onClick:pe,className:he,children:we}),e[63]=he,e[64]=we,e[65]=Pe):Pe=e[65];let Te;e[66]!==m?(Te=m.map((M,ge)=>{const je=ge===m.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[n.jsx(Tt,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>h(m.slice(0,ge+1)),className:be("min-w-0 truncate rounded-lg px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",je?"font-medium text-foreground":"text-muted-foreground"),children:At(M,ge)})]},`${M}-${ge}`)}),e[66]=m,e[67]=Te):Te=e[67];let Ne;e[68]!==ve||e[69]!==Pe||e[70]!==Te?(Ne=n.jsxs("nav",{"aria-label":ve,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[Pe,Te]}),e[68]=ve,e[69]=Pe,e[70]=Te,e[71]=Ne):Ne=e[71];let Be;e[72]===Symbol.for("react.memo_cache_sentinel")?(Be=n.jsx(Ss,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=Be):Be=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 Fe;e[80]!==g||e[81]!==xe||e[82]!==$e?(Fe=n.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[Be,n.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]=Fe):Fe=e[83],e[84]!==Ne||e[85]!==Fe?(A=n.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[Ne,Fe]}),e[84]=Ne,e[85]=Fe,e[86]=A):A=e[86],_=Yt,z="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",R="mx-auto w-full max-w-4xl px-6 py-5",G=de?ne.length===0?n.jsx(tt,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:r,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):n.jsx("div",{className:"flex flex-col gap-1",children:ne.map(M=>n.jsx(Ue,{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))}):J.length===0&&te.length===0&&le.length===0?n.jsx(tt,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:r}),description:m.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):n.jsxs(n.Fragment,{children:[J.length>0&&n.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:J.map(M=>{const ge=Ir(M.name,m.length);return n.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:[n.jsx(ge,{size:18,className:"shrink-0 text-muted-foreground"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-sm font-medium",children:At(M.name,m.length)}),n.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[M.count," ",M.count===1?K:r,M.savedCount>0&&n.jsxs(n.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:M.savedCount})]})]})]})]},M.name)})}),(te.length>0||le.length>0)&&n.jsxs("div",{className:be("flex flex-col gap-1",J.length>0&&"mt-4"),children:[te.map(M=>{const ge=re.get(M.resolveType)??[],je=y.has(M.resolveType);return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(Ue,{icon:F,title:M.title,subtitle:M.resolveType,active:!1,onClick:()=>oe(M)}),ge.length>0&&n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",onClick:()=>E(M.resolveType),"aria-expanded":je,className:"flex items-center gap-1 self-start rounded-lg px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:Ps},children:[je?n.jsx(ft,{size:12,className:"shrink-0"}):n.jsx(Tt,{size:12,className:"shrink-0"}),d(je?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",ge.length,")"]}),je&&n.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:ge.map(Le=>n.jsx(Ue,{icon:F,accent:"global",title:Le.title,subtitle:Le.resolveType,active:!1,onClick:()=>oe(Le)},Le.savedKey))})]})]},M.resolveType)}),le.map(M=>n.jsx(Ue,{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]=I,e[29]=R,e[30]=G,e[31]=z,e[32]=W}else _=e[26],A=e[27],I=e[28],R=e[29],G=e[30],z=e[31],W=e[32];if(I!==Symbol.for("react.early_return_sentinel"))return I;let T;e[87]!==R||e[88]!==G?(T=n.jsx("div",{className:R,children:G}),e[87]=R,e[88]=G,e[89]=T):T=e[89];let U;e[90]!==_||e[91]!==T||e[92]!==z?(U=n.jsx(_,{className:z,children:T}),e[90]=_,e[91]=T,e[92]=z,e[93]=U):U=e[93];let Y;return e[94]!==A||e[95]!==U||e[96]!==W?(Y=n.jsxs("div",{className:W,children:[A,U]}),e[94]=A,e[95]=U,e[96]=W,e[97]=Y):Y=e[97],Y}function Fr(t){const[e,s]=t;return{name:e,...s}}function Kr(t,e){return t.title.localeCompare(e.title)}function zr(t){const[,e]=t;return e}function Mr(t,e){return t.title.localeCompare(e.title)}function Vr(t,e){return t.title.localeCompare(e.title)}function Gr(t){return{resolveType:t.resolveType,title:t.title,folderPath:Rn(t.resolveType)}}function Ur(t){return{resolveType:t.resolveType,title:t.title,folderPath:Rn(t.resolveType),savedKey:t.key}}function Hr(){return new Set}function qr(t,e){if(!t)return null;if(t.mode==="available")return{mode:"available",resolveType:t.resolveType,editorTarget:{mode:"available",resolveType:t.resolveType,title:t.title},initialValue:{}};const{resolveType:s,props:o,title:a}=fa(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:a},initialValue:o}}function Jr(t){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}=t,f=Se(),g=Bt(),x=g?.virtualMcpId,v=qn(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[w,C]=$.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=Ns(r,i),e[2]=i,e[3]=r,e[4]=F):F=e[4];const _=F;let A,I,R,G,z,W,T,U;if(e[5]!==v||e[6]!==a||e[7]!==c||e[8]!==B||e[9]!==w||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 N;e[27]!==v||e[28]!==a||e[29]!==s||e[30]!==le||e[31]!==re||e[32]!==o?(N={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]=N):N=e[33],I=N;let J,Z,oe,S;if(e[34]!==c||e[35]!==B||e[36]!==w||e[37]!==h||e[38]!==f||e[39]!==d){const Pe=[d,...B],Te=Be=>{k(B.slice(0,Be)),O(Wr)};let Ne;e[48]!==c||e[49]!==w||e[50]!==h?(Ne=async Be=>{const De=ga(Be,c);if(De){me.error(De);return}await h(Be,w),K(!1)},e[48]=c,e[49]=w,e[50]=h,e[51]=Ne):Ne=e[51],A=Ne,U="flex h-full w-full min-w-0",T="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?(J=f("sandbox.availableSectionEditor.editingBreadcrumb"),e[52]=f,e[53]=J):J=e[53],Z="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",oe=Pe.map((Be,De)=>{const xe=De===Pe.length-1,$e=xa(Be);return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[De>0&&n.jsx(Tt,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>Te(De),title:$e,className:be("min-w-0 truncate 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]=w,e[37]=h,e[38]=f,e[39]=d,e[40]=A,e[41]=J,e[42]=Z,e[43]=oe,e[44]=S,e[45]=z,e[46]=T,e[47]=U}else A=e[40],J=e[41],Z=e[42],oe=e[43],S=e[44],z=e[45],T=e[46],U=e[47];let se;e[54]!==J||e[55]!==Z||e[56]!==oe?(se=n.jsx("nav",{"aria-label":J,className:Z,children:oe}),e[54]=J,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 ve;e[61]===Symbol.for("react.memo_cache_sentinel")?(ve=n.jsx(Wo,{size:14}),e[61]=ve):ve=e[61];let pe;e[62]!==m||e[63]!==ie?(pe=n.jsx(We,{asChild:!0,children:n.jsx(_e,{size:"icon",className:"size-8 shrink-0",disabled:m,onClick:H,"aria-label":ie,children:ve})}),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=n.jsx(Ye,{side:"bottom",children:ke}),e[67]=ke,e[68]=he):he=e[68];let we;e[69]!==pe||e[70]!==he?(we=n.jsxs(Qe,{children:[pe,he]}),e[69]=pe,e[70]=he,e[71]=we):we=e[71],e[72]!==S||e[73]!==se||e[74]!==we?(W=n.jsxs("div",{className:S,children:[se,we]}),e[72]=S,e[73]=se,e[74]=we,e[75]=W):W=e[75],R="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",G=f("sandbox.availableSectionEditor.localEditsHint",{typeLabel:te}),e[5]=v,e[6]=a,e[7]=c,e[8]=B,e[9]=w,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]=I,e[21]=R,e[22]=G,e[23]=z,e[24]=W,e[25]=T,e[26]=U}else A=e[19],I=e[20],R=e[21],G=e[22],z=e[23],W=e[24],T=e[25],U=e[26];let Y;e[76]!==R||e[77]!==G?(Y=n.jsx("p",{className:R,children:G}),e[76]=R,e[77]=G,e[78]=Y):Y=e[78];let q;e[79]!==Y||e[80]!==z||e[81]!==W?(q=n.jsxs("div",{className:z,children:[W,Y]}),e[79]=Y,e[80]=z,e[81]=W,e[82]=q):q=e[82];let X;e[83]!==c||e[84]!==B||e[85]!==D||e[86]!==w||e[87]!==i||e[88]!==u||e[89]!==I||e[90]!==_||e[91]!==f?(X=n.jsx(Yt,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:_?n.jsx(Kn,{schema:_,value:w,onChange:te=>C(te),basePath:"",breadcrumbPath:B,onBreadcrumbChange:k,meta:i,decofile:c,onSaveReferencedBlock:u,sandbox:I},D):n.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]=w,e[87]=i,e[88]=u,e[89]=I,e[90]=_,e[91]=f,e[92]=X):X=e[92];let de;e[93]!==q||e[94]!==X||e[95]!==T?(de=n.jsxs("div",{className:T,children:[q,X]}),e[93]=q,e[94]=X,e[95]=T,e[96]=de):de=e[96];let ne;e[97]!==p||e[98]!==A||e[99]!==m||e[100]!==L?(ne=n.jsx(ba,{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 ue;return e[102]!==de||e[103]!==ne||e[104]!==U?(ue=n.jsxs("div",{className:U,children:[de,ne]}),e[102]=de,e[103]=ne,e[104]=U,e[105]=ue):ue=e[105],ue}function Wr(t){return t+1}function Yr(t,e){const s={__resolveType:t},o=ja([s],e)[0];return o?ka(s,o,e):null}function Qr({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,meta:a,decofile:l,blockKey:i,onSaveReferencedBlock:c}){const r=Se(),d=Bt(),p=d?.virtualMcpId,h=qn(p===e?e:null)?.metadata?.siteSlug??null,[u]=$.useState(()=>Yr(i,l)),[f,g]=$.useState(u?.data??{}),[x,y]=$.useState([]),[v,j]=$.useState(0),[w,C]=$.useState(!1),[E,B]=$.useState(null),k=E!==null,{save:D,flush:O}=ya({orgSlug:t,virtualMcpId:e,branch:s}),L=u?.resolveType?Ns(u.resolveType,a):null,K=l[i],F=K?Ia(i,K):i,_=d?.taskId??null,A={orgSlug:t,virtualMcpId:e,branch:s,threadId:_,previewUrl:o??void 0,siteSlug:h},I=T=>{g(T),D(i,T)},R=()=>{k?(B(null),C(!1),j(T=>T+1)):B(JSON.stringify(f,null,2))},G=T=>{const U=T??"";try{const Y=JSON.parse(U);if(Y&&typeof Y=="object"&&!Array.isArray(Y)){C(!1),I(Y);return}C(!0)}catch{C(!0)}},z=[F,...x],W=T=>{y(x.slice(0,T)),j(U=>U+1)};return n.jsx("div",{className:"flex h-full w-full min-w-0",children:n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[n.jsx(va,{crumbs:z,onSelect:W}),n.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[n.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:Ps},"aria-hidden":!0}),n.jsx("div",{className:"flex-1"}),n.jsxs(Qe,{children:[n.jsx(We,{asChild:!0,children:n.jsx(_e,{variant:k?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:R,"aria-label":r(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":k,children:k?n.jsx(Bs,{size:14}):n.jsx(En,{size:14})})}),n.jsx(Ye,{side:"bottom",children:r(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),n.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:r("sandbox.savedSectionEditor.globalSectionDescription")})]}),n.jsxs("div",{className:"relative min-h-0 flex-1",children:[n.jsx(Yt,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:L?n.jsx(Kn,{schema:L,value:f,onChange:T=>I(T),basePath:"",breadcrumbPath:x,onBreadcrumbChange:y,meta:a,decofile:l,onSaveReferencedBlock:c,sandbox:A},v):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("sandbox.savedSectionEditor.noEditableFields")})})})}),E!==null&&n.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[w&&n.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:r("sandbox.savedSectionEditor.invalidJsonError")}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Hn,{language:"json",height:"100%",code:E,onChange:G,onSave:T=>{G(T),O()}})})]})]})]})})}function Xr(t){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}=t,h=Se();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=n.jsx(tt,{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=Sa(s.title),e[7]=s.title,e[8]=v):v=e[8];let j;e[9]!==p||e[10]!==s.resolveType?(j=(C,E)=>p(s.resolveType,C,E),e[9]=p,e[10]=s.resolveType,e[11]=j):j=e[11];let w;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?(w=n.jsx(Jr,{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]=w):w=e[25],w}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=n.jsx(Qr,{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 $t(t){const e=ae.c(34),{onDuplicate:s,onRename:o,onAddVariant:a,onEditSeo:l,onViewJson:i,onDelete:c}=t,r=Se();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=n.jsx(Ao,{size:14}),e[2]=p):p=e[2];let m;e[3]!==d?(m=n.jsx(It,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center rounded-lg text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:Zr,children:p})}),e[3]=d,e[4]=m):m=e[4];let h;e[5]!==o||e[6]!==r?(h=o&&n.jsxs(Je,{onClick:o,children:[n.jsx(cl,{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&&n.jsxs(Je,{onClick:s,children:[n.jsx(rl,{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&&n.jsxs(n.Fragment,{children:[n.jsx(ds,{}),n.jsxs(Je,{onClick:a,className:"cursor-pointer text-success focus:text-success",children:[n.jsx(Bn,{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)&&n.jsxs(n.Fragment,{children:[n.jsx(ds,{}),l&&n.jsxs(Je,{onClick:l,children:[n.jsx(Pn,{size:14}),r("sandbox.itemActions.editSeo")]}),i&&n.jsxs(Je,{onClick:i,children:[n.jsx(En,{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=n.jsx(ds,{}),e[18]=x):x=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Ts,{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=n.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 w;e[25]!==j||e[26]!==h||e[27]!==u||e[28]!==f||e[29]!==g?(w=n.jsxs(Rt,{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]=w):w=e[30];let C;return e[31]!==w||e[32]!==m?(C=n.jsxs(Ft,{children:[m,w]}),e[31]=w,e[32]=m,e[33]=C):C=e[33],C}function Zr(t){return t.stopPropagation()}function ec(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function tc(t){const e=new Map;for(const s of t){const o=ec(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 yn(t){const e=ae.c(8),{icon:s,label:o,className:a}=t;let l;e[0]!==a?(l=be("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=n.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=n.jsxs("div",{className:l,children:[i,o]}),e[4]=o,e[5]=l,e[6]=i,e[7]=c):c=e[7],c}const vn=$.lazy(()=>He(()=>import("./app-editor-31GxTBfl.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])).then(t=>({default:t.AppEditor}))),sc=$.lazy(()=>He(()=>import("./post-editor-DVWD2-YL.js"),__vite__mapDeps([169,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,29,28,30,31,32,33,34,35,36,37,24,25,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,81,170,156,135,76,77,55,106,118,113,111,61,60,58,62,63,64,65,66,67,68,69,70,71,72,23,73,74,75,78,79,80,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,107,21,22,108,109,110,57,112,114,115,116,117,119,120,121,122,123,124,171,139,59,172,173,174,125,126,127,128,129,130,131,132,133,134,136,137,138,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,157,158,159,160,161,162,163,164,165,166,167,168])).then(t=>({default:t.PostEditor}))),nc=$.lazy(()=>He(()=>import("./record-editor-M_ekBwOD.js"),__vite__mapDeps([175,1,2,56,81,22,23,24,25,111,61,60,11,8,9,12,13,14,15,3,4,5,6,7,10,16,17,18,19,20,58,28,29,30,31,32,33,34,35,36,37,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,62,63,64,65,66,67,68,69,55,70,71,72,73,74,75,76,77,78,79,80,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,21,108,109,110,57,112,113,114,115,116,117,118,119,120,121,122,123,124,174,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])).then(t=>({default:t.RecordEditor}))),oc=$.lazy(()=>He(()=>import("./context-Ux9G6xnM.js"),__vite__mapDeps([176,1,2,25,28,29,30,31,32,33,34,35,36,37,24,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,81,111,106,18,177,102,96,55,103,98,70,71,4,5,6,7,8,9,72,23,139,172,112,69,74,76,77,178,143,140,61,60,11,12,13,14,15,3,10,16,17,19,20,58,62,63,64,65,66,67,68,73,75,78,79,80,82,83,84,85,86,87,88,89,90,91,92,93,94,95,97,99,100,101,104,105,107,21,22,108,109,110,57,113,114,115,116,117,118,119,120,121,122,123,124,166,174,175,125,126,127,128,129,130,131,132,133,134,135,136,137,138,141,142,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,167,168,179,171,59,173])).then(t=>({default:t.BlogContext}))),ac=$.lazy(()=>He(()=>import("./category-editor-CWwBDlse.js"),__vite__mapDeps([179,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,33,35,45,28,29,30,31,32,34,36,37,24,25,27,38,39,40,41,42,43,44,46,47,48,49,50,51,52,53,54,115,56,81,171,112,76,77,55,106,61,60,58,62,63,64,65,66,67,68,69,70,71,72,23,73,74,75,78,79,80,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,107,21,22,108,109,110,111,57,113,114,116,117,118,119,120,121,122,123,124,139,59,172,173,174,125,126,127,128,129,130,131,132,133,134,135,136,137,138,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])).then(t=>({default:t.CategoryEditor}))),lc=$.lazy(()=>He(()=>import("./sections-editor-DhpxII9P.js"),__vite__mapDeps([180,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,57,61,60,58,28,29,30,31,32,33,34,35,36,37,24,25,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,62,63,64,65,66,67,68,69,55,70,71,72,23,73,74,75,76,77,78,79,80,56,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,21,22,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,166,181,26,59,182])).then(t=>({default:t.SectionsEditor}))),ic=$.lazy(()=>He(()=>import("./seo-editor-8b-CJKFm.js"),__vite__mapDeps([183,1,2,28,29,30,31,32,33,34,35,36,37,24,25,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,21,22,23,61,60,11,8,9,12,13,14,15,3,4,5,6,7,10,16,17,18,19,20,58,62,63,64,65,66,67,68,69,55,70,71,72,73,74,75,76,77,78,79,80,56,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,57,112,113,114,115,116,117,118,119,120,121,122,123,124,181])).then(t=>({default:t.SeoEditor}))),rc=$.lazy(()=>He(()=>import("./variant-calendar-BjExOmBY.js"),__vite__mapDeps([184,1,2,28,29,30,31,32,33,34,35,36,37,24,25,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,81,21,22,23,113,72,185,125,126,121,119,20,14,13,122,5,4,6,7,8,9,11,12,15,100,127,94,98,128,3,10,16,17,18,19,96,55,129,87,71,101,102,103,56,70,130,73,74,75,76,77,78,79,80,82,83,84,85,86,88,89,90,91,131,60,68,67,69,64,65,118,132,123,97,133,134,135,136,106,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,111,152,153,154,155,156,157,158,159,160,63,66,92,93,95,99,104,105,161,116,62,162,163,164,165,115,61,58,107,108,109,110,57,112,114,117,120,124,166,167,168])).then(t=>({default:t.VariantCalendar}))),cc=$.lazy(()=>He(()=>import("./post-calendar-BOHVV9jx.js"),__vite__mapDeps([186,1,2,29,28,30,31,32,33,34,35,36,37,24,25,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,187,21,22,23,125,126,121,119,20,14,13,122,5,4,6,7,8,9,11,12,15,100,127,94,98,128,3,10,16,17,18,19,96,72,55,129,87,71,101,102,103,81,56,70,130,73,74,75,76,77,78,79,80,82,83,84,85,86,88,89,90,91,131,60,68,67,69,64,65,118,132,123,97,133,134,135,136,106,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,111,152,153,154,155,156,157,158,159,160,63,66,92,93,95,99,104,105,161,116,62,162,163,164,165,115,61,58,107,108,109,110,57,112,113,114,117,120,124,166,167,168])).then(t=>({default:t.PostCalendar}))),dc=$.lazy(()=>He(()=>import("./redirect-editor-zzKZ_yFT.js"),__vite__mapDeps([188,1,2,135,24,56,81,22,23,25,61,60,11,8,9,12,13,14,15,3,4,5,6,7,10,16,17,18,19,20,58,28,29,30,31,32,33,34,35,36,37,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,62,63,64,65,66,67,68,69,55,70,71,72,73,74,75,76,77,78,79,80,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,21,108,109,110,111,57,112,113,114,115,116,117,118,119,120,121,122,123,124,174])).then(t=>({default:t.RedirectEditor})));function uc(t){const e=ae.c(20),{deepLinkPage:s}=t,{currentBranch:o,virtualMcpId:a}=wn(),{org:l}=$o(),i=Wa(),c=Ya(),{runtime:r,previewServerUrl:d}=Un(a),p=r==="cms";let m;e[0]!==p||e[1]!==c.previewState||e[2]!==i.lifecycle.phase?(m=El({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=n.jsx(Tl,{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=n.jsx(tt,{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=n.jsx(fc,{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 jn=2e3,mc=15;function kn(t,e,s,o){return typeof e!="string"||s&&(Jn(e,s,o)||t.state.dataUpdateCount>=mc)?!1:jn}function fc({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,sitePreviewUrl:a,deepLinkPage:l,devServerReady:i,sandboxWarming:c}){const r=Se(),d=Bt()?.taskId??null,p={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:o},{data:m,isLoading:h}=wa(p,{fetchEnabled:i}),u=Sn({strict:!1}),[f,g]=$.useState(()=>u.contentCollection&&ot(u.contentCollection)&&u.contentCollection||"pages"),[x,y]=$.useState(()=>u.contentItem&&ot(f)?{collection:f,key:u.contentItem}:null),[v,j]=$.useState(null),w=!!(l?.pageId||l?.path||l?.pathTemplate),[C,E]=$.useState(!1);if(w&&!C&&x===null&&m){E(!0);const b=Ra(Gs(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:I}=Na(p,{fetchEnabled:i,refetchInterval:b=>{const V=b.state.data;if(f==="apps"&&x&&x.collection==="apps"){const ce=m?.[x.key];return kn(b,typeof ce?.__resolveType=="string"?ce.__resolveType:void 0,V)}if(f==="site"&&m){const ce=V?Us(m,V):null,fe=m.site,Ae=ce?.resolveType??(typeof fe?.__resolveType=="string"?fe.__resolveType:void 0);return kn(b,Ae,V,["seo"])}return!1}}),R=(b,V)=>!Jn(b,_,V)&&(A||I),{catalog:G,isLoading:z}=wl(_??void 0,m??void 0,{enabled:f==="apps"}),W=Mi({orgSlug:t,virtualMcpId:e,branch:s,meta:_}),T=Qt(p),U=Vn(p),Y=Ui({orgSlug:t,virtualMcpId:e,branch:s,decofile:m??{},support:W,onMoved:(b,V)=>y(ce=>ce?.collection==="posts"&&ce.key===b?{collection:"posts",key:V}:ce)}),[q,X]=$.useState(null),[de,ne]=$.useState(),[ue,te]=$.useState(!1),[re,le]=$.useState(),[N,J]=$.useState(null),[Z,oe]=$.useState(null),[S,se]=$.useState(null),H=!m||!_;if(h||A||H&&c)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(lt,{className:"size-5 text-muted-foreground"})});if(H)return n.jsx(tt,{title:"Could not load site data."});const ie=Gs(m).sort((b,V)=>b.name.localeCompare(V.name)),ve=Fa(m).sort((b,V)=>b.from.localeCompare(V.from)),pe=Ka(m,_),ke=f==="sections"?za(_):[],he=Us(m,_),we=Zn(m),Pe=Es.some(b=>we[b].length>0),Te=ot(f)?we[f]:[],Ne=Ms(_,"loaders"),Be=Ms(_,"actions");if(!Ma(m,_)&&!Pe&&Ne===0&&Be===0)return n.jsx(tt,{icon:Wt,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:G.length,loaders:Ne,actions:Be,redirects:ve.length,posts:we.posts.length,authors:we.authors.length,categories:we.categories.length},xe=new Set(ie.map(b=>Lt(b.path))),$e=new Set(ie.map(b=>b.name)),Fe=new Set(pe.map(b=>b.name)),M=async b=>{const V=m[b.key];if(!V)return;const ce=zn(m,b.key),fe=Ca(m,b.key,Math.max(0,ce-1)),Ae=Pa(V.sections,fe);if(Ae)try{await T.mutateAsync({blockKey:b.key,data:{...V,sections:Ae}}),me.success(`Variant added to "${b.name}"`),y({collection:"pages",key:b.key,path:b.path})}catch(Oe){me.error(Oe instanceof Error?Oe.message:"Could not add variant")}},ge=()=>{ne(void 0),X({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},je=b=>{ne(void 0),X({mode:"duplicate",sourceKey:b.key,initialName:Ys($e,b.name),initialPath:_l(xe,b.path)})},Le=b=>{ne(void 0),X({mode:"rename",sourceKey:b.key,initialName:b.name,initialPath:b.path})},ss=async b=>{if(!q)return;const{mode:V,sourceKey:ce}=q;try{if(V==="create"){let fe;if(b.templateKey){const Oe=m[b.templateKey];if(!Oe)throw new Error("Selected template no longer exists.");fe={...Oe,name:b.name,path:b.path}}else fe=$l(b.name,b.path);const Ae=Ol(m,b.name);await T.mutateAsync({blockKey:Ae,data:fe}),me.success(`Created "${b.name}"`),y({collection:"pages",key:Ae,path:b.path})}else if(V==="duplicate"&&ce){const fe=m[ce];if(!fe)throw new Error("Source page not found");const{key:Ae,data:Oe}=Al({source:fe,pages:ie,newName:b.name,newPath:b.path});await T.mutateAsync({blockKey:Ae,data:Oe}),me.success(`Duplicated as "${b.name}"`),y({collection:"pages",key:Ae,path:b.path})}else if(V==="rename"&&ce){const fe=m[ce];if(!fe)throw new Error("Page not found");const Ae={...fe,name:b.name,path:b.path};await T.mutateAsync({blockKey:ce,data:Ae}),me.success("Page updated"),x?.collection==="pages"&&x.key===ce&&y({collection:"pages",key:ce,path:b.path})}X(null)}catch(fe){ne(fe instanceof Error?fe.message:"Save failed")}},ns=({path:b})=>{if(!q)return null;const V=Lt(b);return(q.mode==="rename"?Lt(q.initialPath):null)!==V&&xe.has(V)?`A page with path "${b}" already exists.`:null},os=async(b,V,ce)=>{await T.mutateAsync({blockKey:V,data:{...ce,name:V,__resolveType:b}}),me.success(r("sandbox.contentBrowser.createdSection",{name:V})),y({collection:"sections",key:V})},as=Fn((b,V)=>T.mutate({blockKey:b,data:V})),ls=async b=>{const V=m[b.key];if(!V){me.error(r("sandbox.contentBrowser.sectionNotFound"));return}const ce=Dl(m,b.key),fe=Ys(Fe,b.name),Ae={...V,name:fe};try{await T.mutateAsync({blockKey:ce,data:Ae}),me.success(r("sandbox.contentBrowser.duplicatedSection",{name:b.name})),y({collection:"sections",key:ce})}catch(Oe){me.error(Oe instanceof Error?Oe.message:r("sandbox.contentBrowser.duplicateFailed"))}},is=async b=>{if(!N)return;const V=m[N];if(!V){me.error(r("sandbox.contentBrowser.sectionNotFound"));return}try{await T.mutateAsync({blockKey:N,data:{...V,name:b}}),me.success(r("sandbox.contentBrowser.sectionRenamed")),J(null)}catch(ce){me.error(ce instanceof Error?ce.message:r("sandbox.contentBrowser.renameFailed"))}},_t=()=>{le(void 0),te(!0)},rs=async b=>{const V=Va(m,b.from),ce=Ga(b);try{await T.mutateAsync({blockKey:V,data:ce}),me.success("Created redirect"),te(!1),y({collection:"redirects",key:V})}catch(fe){le(fe instanceof Error?fe.message:"Could not create redirect")}},cs=async b=>{const V=hs(m,b),ce=at(V,b,lo(b));try{await T.mutateAsync({blockKey:V,data:ce}),me.success(`Created ${Nt[b]}`),y({collection:b,key:V})}catch(fe){me.error(fe instanceof Error?fe.message:"Could not create")}},P=async b=>{const V=hs(m,"posts"),ce=at(V,"posts",Ci(b));try{await T.mutateAsync({blockKey:V,data:ce}),me.success(r("sandbox.postCalendar.createdScheduledPost")),g("posts"),F("posts"),y({collection:"posts",key:V}),j(null)}catch(fe){me.error(fe instanceof Error?fe.message:r("sandbox.postCalendar.couldNotCreate"))}},Q=async(b,V)=>{const ce=m[b],fe=ce?Ti(dt(ce,"posts"),V):null;if(!fe){me.error(r("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await T.mutateAsync({blockKey:b,data:at(b,"posts",fe)})}catch(Ae){me.error(Ae instanceof Error?Ae.message:r("sandbox.postCalendar.couldNotReschedule"))}},Ee=async b=>{const V=m[b.key];if(!V){me.error("Record not found.");return}const ce=hs(m,b.kind),fe=b.kind==="posts"?"title":"name",Ae={...structuredClone(dt(V,b.kind)),[fe]:`${b.label} (copy)`};try{await T.mutateAsync({blockKey:ce,data:at(ce,b.kind,Ae)}),me.success(`Duplicated "${b.label}"`),y({collection:b.kind,key:ce})}catch(Oe){me.error(Oe instanceof Error?Oe.message:"Duplicate failed")}},Ve=()=>{g("posts"),F("posts"),y(null),j(null),k("")},qe=async()=>{if(Z)try{const{kind:b,key:V,label:ce}=Z;if(b==="blog"){if(Z.blogKind==="categories"){const fe=dt(m[V],"categories").slug,Ae=typeof fe=="string"?fe:"";if(Ae)for(const{key:Oe,payload:Is}of Ge(m,"posts")){const Rs=ni(Is,Ae);Rs!==Is&&await T.mutateAsync({blockKey:Oe,data:at(Oe,"posts",oi(Rs))})}}await U.mutateAsync({blockKey:V})}else await U.mutateAsync({blockKey:V});me.success(`Deleted "${ce}"`),x&&x.collection!=="available-section"&&x.key===V&&y(null),oe(null)}catch(b){me.error(b instanceof Error?b.message:"Delete failed")}},Ce=U.isPending||T.isPending,gt=Z?.kind==="blog"?Nt[Z.blogKind]:Z?.kind??"item";return n.jsxs("div",{className:"flex h-full w-full",children:[n.jsx(Cl,{active:f,counts:De,showBlog:Pe,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"&&n.jsx(pc,{activeCollection:f,pages:ie,redirects:ve,sections:pe,availableSections:ke,appCatalog:G,appCatalogLoading:z,blogEntries:Te,decofile:m,searchQuery:B,onSearchChange:k,selection:x,onSelect:L,onCreate:()=>{f==="pages"?ge():f==="redirects"?_t():ot(f)&&cs(f)},onDuplicatePage:je,onRenamePage:Le,onAddPageVariant:M,onDeletePage:b=>oe({kind:"page",key:b.key,label:b.name}),onEditPageSeo:b=>{const V={collection:"pages",key:b.key,path:b.path};y(V),j(b.key)},onViewPageJson:b=>se(b.key),onDuplicateSection:ls,onRenameSection:b=>J(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})}),n.jsx("div",{className:"flex-1 min-w-0",children:f==="loaders"||f==="actions"?n.jsx(Rr,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,meta:_,decofile:m,kind:f}):n.jsx($.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(lt,{className:"size-5 text-muted-foreground"})}),children:f==="calendar"?n.jsx(rc,{decofile:m}):f==="post-schedule"?n.jsx(cc,{decofile:m,support:W,isCreating:T.isPending,onCreate:b=>{P(b)},onReschedule:(b,V)=>{Q(b,V)},onSelect:b=>{g("posts"),F("posts"),y({collection:"posts",key:b}),j(null)}}):f==="site"?he?n.jsx(vn,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:he.key,block:m[he.key],decofile:m,meta:_,title:"Site",excludeFields:["seo"],schemaPending:R(he.resolveType,["seo"]),previewBaseUrl:o},`site:${he.key}`):n.jsx(tt,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):f==="context"?n.jsx(fl,{title:r("sandbox.blogContext.soonTitle"),description:r("sandbox.blogContext.soonDescription"),children:n.jsx(oc,{orgSlug:t,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"?n.jsx(ic,{orgSlug:t,virtualMcpId:e,branch:s,decofile:m,meta:_,target:{kind:"site"},previewBaseUrl:a}):f==="sections"?n.jsx(Xr,{selection:x?.collection==="sections"||x?.collection==="available-section"?x:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,meta:_,decofile:m,isCreating:T.isPending,onCreateAvailable:os,onSaveReferencedBlock:as}):f==="posts"?n.jsx(Tr,{orgSlug:t,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:W,meta:_,renderDetail:(b,V)=>n.jsx(sc,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:b,block:m[b],decofile:m,meta:_,previewBaseUrl:a,move:Y,onClose:V?.onClose,expanded:V?.expanded,onToggleExpand:V?.onToggleExpand},`post:${Ct(b)}`)}):x&&x.collection!=="available-section"?x.collection==="apps"?n.jsx(vn,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:x.key,block:m[x.key],decofile:m,meta:_,previewBaseUrl:o,schemaPending:R(typeof m[x.key]?.__resolveType=="string"?String(m[x.key].__resolveType):void 0)},`app:${x.key}`):x.collection==="categories"?n.jsx(ac,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:x.key,block:m[x.key],decofile:m,meta:_,onManagePosts:()=>Ve(),onOpenPost:b=>{g("posts"),F("posts"),y({collection:"posts",key:b}),j(null)},previewBaseUrl:a},`category:${x.key}`):x.collection==="authors"?n.jsx(nc,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:x.key,block:m[x.key]},`authors:${x.key}`):x.collection==="redirects"?n.jsx(dc,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:x.key,block:m[x.key]},`redirect:${x.key}`):n.jsx(lc,{orgSlug:t,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}`):n.jsx(tt,{title:`Select ${ot(f)?`a ${Nt[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&&n.jsx(Kl,{open:!!q,mode:q.mode,initialName:q.initialName,initialPath:q.initialPath,isPending:T.isPending,error:de,templates:ie,validate:ns,onSubmit:ss,onOpenChange:b=>{b||(X(null),ne(void 0))}}),n.jsx(Ml,{open:ue,isPending:T.isPending,error:re,onSubmit:rs,onOpenChange:b=>{b||(te(!1),le(void 0))}}),N&&n.jsx(Vl,{open:!!N,blockKey:N,initialName:pe.find(b=>b.key===N)?.name??N,isPending:T.isPending,onSubmit:is,onOpenChange:b=>{b||J(null)}}),S&&n.jsx(Ua,{open:!!S,onOpenChange:b=>{b||se(null)},pageKey:S,decofile:m,onSave:b=>T.mutateAsync({blockKey:S,data:b})}),n.jsx(Qo,{open:!!Z,onOpenChange:b=>{!b&&!Ce&&oe(null)},children:n.jsxs(Xo,{children:[n.jsxs(Zo,{children:[n.jsx(ea,{children:`Delete ${gt}?`}),n.jsx(ta,{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})]}),n.jsxs(sa,{children:[n.jsx(na,{disabled:Ce,children:"Cancel"}),n.jsx(oa,{onClick:b=>{b.preventDefault(),qe()},disabled:Ce,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Ce?n.jsxs(n.Fragment,{children:[n.jsx(lt,{className:"size-3.5"}),"Deleting…"]}):"Delete"})]})]})})]})}function pc(t){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:w,onViewPageJson:C,onDuplicateSection:E,onRenameSection:B,onDeleteSection:k,onDeleteRedirect:D,onDuplicateBlog:O,onDeleteBlog:L}=t;let K,F,_,A,I,R;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]!==w||e[16]!==y||e[17]!==B||e[18]!==h||e[19]!==f||e[20]!==C||e[21]!==o||e[22]!==a||e[23]!==m||e[24]!==l||e[25]!==u){const T=m.toLowerCase(),U=o.filter(S=>!T||S.name.toLowerCase().includes(T)||S.path.toLowerCase().includes(T)),Y=a.filter(S=>!T||S.from.toLowerCase().includes(T)||S.to.toLowerCase().includes(T)),q=l.filter(S=>!T||S.name.toLowerCase().includes(T)||S.key.toLowerCase().includes(T)||S.resolveType.toLowerCase().includes(T)),X=i.filter(S=>!T||S.title.toLowerCase().includes(T)||S.resolveType.toLowerCase().includes(T)||(S.description?.toLowerCase().includes(T)??!1)),de=tc(q),ne=c.filter(S=>!T||S.title.toLowerCase().includes(T)||S.app.toLowerCase().includes(T)||S.vendor.toLowerCase().includes(T)||S.category.toLowerCase().includes(T)),ue=d.filter(S=>!T||S.label.toLowerCase().includes(T)||S.subtitle.toLowerCase().includes(T)),te=`Search ${s}…`,re=ot(s)?`Create new ${Nt[s]}`:s==="redirects"?"Create new redirect":"Create new page",le=s!=="apps"&&s!=="sections";I="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let N;e[32]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(Ss,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[32]=N):N=e[32];let J;e[33]!==h?(J=S=>h(S.target.value),e[33]=h,e[34]=J):J=e[34];let Z;e[35]!==te||e[36]!==m||e[37]!==J?(Z=n.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[N,n.jsx("input",{type:"text",value:m,onChange:J,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]=J,e[38]=Z):Z=e[38];let oe;e[39]!==re||e[40]!==g||e[41]!==le?(oe=le&&n.jsxs(Qe,{children:[n.jsx(We,{asChild:!0,children:n.jsx(_e,{variant:"ghost",size:"icon",onClick:g,"aria-label":re,children:n.jsx(ws,{size:14})})}),n.jsx(Ye,{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?(R=n.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]=R):R=e[45],K=Yt,A="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",F="flex flex-col gap-1 p-1.5",_=s==="pages"?U.length===0?n.jsx(yt,{hasItems:o.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):U.map(S=>{const se=u?.collection==="pages"&&u.key===S.key,H=zn(p,S.key);return n.jsx(Ue,{icon:_n,title:S.name,subtitle:S.path,active:se,variantCount:H,onClick:()=>f({collection:"pages",key:S.key,path:S.path}),menu:n.jsx($t,{onDuplicate:()=>x(S),onRename:()=>y(S),onAddVariant:()=>v(S),onEditSeo:()=>w(S),onViewJson:()=>C(S),onDelete:()=>j(S)})},S.key)}):s==="sections"?q.length===0&&X.length===0?n.jsx(yt,{hasItems:l.length>0||i.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):n.jsxs(n.Fragment,{children:[de.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(yn,{icon:Kt,label:"Saved sections"}),de.map(S=>n.jsxs("div",{className:"flex flex-col gap-1",children:[n.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 n.jsx(Ue,{icon:Kt,accent:"global",title:se.name,subtitle:S.label,active:H,onClick:()=>f({collection:"sections",key:se.key}),menu:n.jsx($t,{onDuplicate:()=>E(se),onRename:()=>B(se),onDelete:()=>k(se)})},se.key)})]},S.label))]}),X.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(yn,{icon:zs,label:"Available sections",className:be(de.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 n.jsx(Ue,{icon:zs,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?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx(lt,{className:"size-4.5 text-muted-foreground"})}):ne.length===0?n.jsx(yt,{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 n.jsx(Ue,{icon:$n,logoUrl:S.logo,title:S.title,subtitle:S.category,active:se,trailing:S.installed?n.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?n.jsx(yt,{hasItems:a.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):Y.map(S=>n.jsx(Ue,{icon:Nn,title:S.from||"(no source)",subtitle:`→ ${S.to||"(no target)"}`,active:u?.collection==="redirects"&&u.key===S.key,trailing:n.jsx(Gl,{type:S.type}),onClick:()=>f({collection:"redirects",key:S.key}),menu:n.jsx($t,{onDelete:()=>D(S)})},S.key)):ue.length===0?n.jsx(yt,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${ot(s)?Nt[s]:"item"}.`}):ue.map(S=>{const se=u?.collection===S.kind&&u.key===S.key;return n.jsx(Ue,{icon:S.kind==="posts"?Dn:S.kind==="authors"?Ln:Cn,title:S.label,subtitle:S.subtitle,active:se,onClick:()=>f({collection:S.kind,key:S.key}),menu:n.jsx($t,{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]=w,e[16]=y,e[17]=B,e[18]=h,e[19]=f,e[20]=C,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]=I,e[31]=R}else K=e[26],F=e[27],_=e[28],A=e[29],I=e[30],R=e[31];let G;e[46]!==F||e[47]!==_?(G=n.jsx("div",{className:F,children:_}),e[46]=F,e[47]=_,e[48]=G):G=e[48];let z;e[49]!==K||e[50]!==A||e[51]!==G?(z=n.jsx(K,{className:A,children:G}),e[49]=K,e[50]=A,e[51]=G,e[52]=z):z=e[52];let W;return e[53]!==I||e[54]!==R||e[55]!==z?(W=n.jsxs("div",{className:I,children:[R,z]}),e[53]=I,e[54]=R,e[55]=z,e[56]=W):W=e[56],W}function hc(t){const e=ae.c(25),{virtualMcpId:s}=t,o=Se(),[a,l]=$.useState(!1),i=il(s),{activeTask:c}=wn();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[0]=r):r=e[0];const d=Sn(r);if(!(Js(i?.metadata)||Js(c?.metadata))){let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:n.jsx(Ws,{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=n.jsx(Ws,{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=n.jsxs(_e,{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=n.jsx(dl,{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 w;e[16]!==a?(w=n.jsx(ul,{open:a,onOpenChange:l,mode:"agent"}),e[16]=a,e[17]=w):w=e[17];let C;return e[18]!==w||e[19]!==j?(C=n.jsxs(n.Fragment,{children:[j,w]}),e[18]=w,e[19]=j,e[20]=C):C=e[20],C}let m;return e[21]!==d.contentPageId||e[22]!==d.contentPath||e[23]!==d.contentPathTemplate?(m=n.jsx(uc,{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 xc(){const t=ae.c(2),e=ml();let s;return t[0]!==e?(s=n.jsx(Lo,{tabId:"content",children:n.jsx(Oo,{feature:"cms",children:n.jsx(hc,{virtualMcpId:e})})}),t[0]=e,t[1]=s):s=t[1],s}const $d=Object.freeze(Object.defineProperty({__proto__:null,default:xc},Symbol.toStringTag,{value:"Module"}));export{jo as $,Td as A,As as B,bd as C,xd as D,Pd as E,Ed as F,Zn as G,mo as H,Hi as I,tn as J,vi as K,hd as L,hs as M,lo as N,fd as O,Ds as P,vd as Q,Bd as R,jd as S,_d as T,Sd as U,mt as V,wd as W,kd as X,yd as Y,Nd as Z,Ut as _,md as a,$d as a0,ts as b,oi as c,Cd as d,ud as e,Ge as f,dt as g,qt as h,Dd as i,di as j,Ad as k,so as l,_s as m,Dl as n,io as o,Et as p,at as q,hl as r,ye as s,fo as t,Mi as u,Ke as v,gi as w,pd as x,gd as y,Me as z};
|
|
9
|
+
`)||void 0,count:O}),Ce=vi(re.map(b=>b.title),qe.themes);if(Ce.length===0){me.info(u("sandbox.postBoard.ideasFailed"));return}let gt=0;for(const b of Ce){const V=pi();try{await g.mutateAsync({blockKey:V,data:hi(V,{title:b.title,body:b.body,pillarKey:P?.key,createdAt:new Date().toISOString()})}),gt++}catch(ce){console.warn("[posts] could not save a generated idea",ce)}}if(gt===0){me.error(u("sandbox.postBoard.ideasFailed"));return}me.success(u("sandbox.postBoard.ideasAdded",{count:String(gt)}))}catch(Q){me.error(Q instanceof Error?Q.message:u("sandbox.postBoard.ideasFailed"))}finally{C(!1)}};return n.jsxs("div",{className:"relative flex h-full min-w-0 flex-col",children:[n.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-between gap-3 border-b px-6 py-3",children:[n.jsx("div",{className:"flex items-center gap-3",children:n.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border p-0.5",children:[n.jsx(bn,{active:a==="board",onClick:()=>i("board"),icon:n.jsx(Go,{size:14}),label:u("sandbox.postBoard.viewBoard")}),n.jsx(bn,{active:a==="list",onClick:()=>i("list"),icon:n.jsx(Yo,{size:14}),label:u("sandbox.postBoard.viewList")})]})}),n.jsxs("div",{className:"flex items-center gap-2",children:[w&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","aria-live":"polite",role:"status",children:[n.jsx(wt,{size:12,className:"animate-spin"}),u("sandbox.postBoard.generatingLabel")]}),n.jsxs(ct,{open:E,onOpenChange:B,children:[n.jsx(Qa,{asChild:!0,children:n.jsxs(_e,{type:"button",variant:"outline",size:"sm",disabled:!0,children:[n.jsx(et,{size:14}),u("sandbox.postBoard.generateIdeas"),n.jsx(nt,{variant:"secondary",children:u("common.soon")})]})}),n.jsxs(rt,{className:"sm:max-w-lg",children:[n.jsxs(pt,{children:[n.jsx(it,{children:u("sandbox.postBoard.generateIdeas")}),n.jsx(zt,{children:u("sandbox.postBoard.ideaGuidanceLabel")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(Ot,{id:"idea-guidance",value:k,rows:6,autoFocus:!0,onChange:P=>D(P.target.value),placeholder:u("sandbox.postBoard.ideaGuidancePlaceholder"),className:"resize-none text-sm"}),le.length>0&&n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(ze,{className:"text-xs",children:u("sandbox.postBoard.ideaPillarLabel")}),n.jsx(kt,{options:le.map(P=>P.title),value:le.find(P=>P.key===K)?.title??"",emptyLabel:u("sandbox.postBoard.ideaNoPillar"),onChange:P=>F(le.find(Q=>Q.title===P)?.key??"")})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ze,{htmlFor:"idea-count",className:"text-xs",children:u("sandbox.postBoard.ideaCount")}),n.jsx(Xe,{id:"idea-count",type:"number",min:1,max:8,value:O,onChange:P=>L(Math.max(1,Math.min(8,Number(P.target.value)||1))),className:"h-9 w-16"}),n.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:u("sandbox.postBoard.usesCredits")})]})]}),n.jsx(ht,{children:n.jsxs(_e,{type:"button",onClick:()=>{B(!1),cs()},children:[n.jsx(et,{size:14}),u("sandbox.postBoard.generateIdeas")]})})]})]}),n.jsxs(Ft,{children:[n.jsx(It,{asChild:!0,children:n.jsxs(_e,{type:"button",size:"sm",children:[n.jsx(ws,{size:14}),u("sandbox.postBoard.newPost"),n.jsx(ft,{size:14})]})}),n.jsxs(Rt,{align:"end",className:"w-56",children:[n.jsxs(Je,{disabled:!0,onClick:()=>{z(void 0),R(!0)},children:[n.jsx(et,{size:14}),n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[u("sandbox.postBoard.newPostGenerate"),n.jsx(nt,{variant:"secondary",children:u("common.soon")})]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.newPostGenerateHint")})]})]}),n.jsxs(Je,{onClick:_t,children:[n.jsx(Uo,{size:14}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:u("sandbox.postBoard.newPostWrite")}),n.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.newPostWriteHint")})]})]}),n.jsxs(Je,{onClick:()=>T(!0),children:[n.jsx(fs,{size:14}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{children:u("sandbox.postBoard.importContent")}),n.jsx("span",{className:"text-xs text-muted-foreground",children:u("sandbox.postBoard.importContentHint")})]})]})]})]}),n.jsx(Yi,{open:I,onOpenChange:R,decofile:o,hasAi:y,seed:G,onGenerate:P=>{ue(P)}},G?.title??"scratch"),n.jsx(ct,{open:W,onOpenChange:T,children:n.jsxs(rt,{className:"max-h-[85vh] sm:max-w-2xl",children:[n.jsxs(pt,{children:[n.jsx(it,{children:u("sandbox.postBoard.importTitle")}),n.jsx(zt,{children:u("sandbox.postBoard.importDescription")})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"h-72 overflow-hidden rounded-[var(--studio-control-radius,var(--radius-xl))] border bg-[var(--studio-input-background)]",children:n.jsx(Hn,{code:U,language:So(U)?"html":"markdown",height:"100%",autoFocus:!0,onChange:P=>Y(P??"")})}),n.jsx("input",{ref:q,type:"file",accept:".html,.htm,.md,.markdown,.txt",className:"hidden",onChange:async P=>{const Q=P.target.files?.[0];Q&&Y(await Q.text()),P.target.value=""}}),n.jsxs(_e,{type:"button",variant:"outline",size:"sm",onClick:()=>q.current?.click(),children:[n.jsx(fs,{size:14}),u("sandbox.postBoard.importUpload")]})]}),n.jsx(ht,{children:n.jsxs(_e,{type:"button",disabled:!U.trim(),onClick:rs,children:[n.jsx(fs,{size:14}),u("sandbox.postBoard.importRun")]})})]})})]})]}),te.length===0&&re.length===0?n.jsx(al,{className:"flex-1",icon:n.jsx(et,{size:22}),title:u("sandbox.postBoard.emptyTitle"),description:u("sandbox.postBoard.emptyDescription"),buttonProps:{children:u("sandbox.postBoard.newPost"),onClick:_t}}):a==="board"?n.jsxs("div",{className:"flex min-h-0 flex-1 gap-3 overflow-x-auto p-4",children:[n.jsx(Dr,{ideas:re,collapsed:X.includes(xn),pillarTitleOf:N,onToggleCollapsed:()=>ne(xn),onGenerate:as,onDelete:ls}),n.jsx("div",{"aria-hidden":!0,className:"my-1 w-px shrink-0 self-stretch bg-border"}),Ds.map(P=>{const Q=te.filter(Ce=>Ce.status===P);Pr(P)&&Q.sort(Cr);const Ee=u(qt[P]),Ve=X.includes(P),qe=jo(p,P);return n.jsx("div",{onDragOver:Ce=>{Ce.preventDefault(),j(P)},onDragLeave:()=>j(Ce=>Ce===P?null:Ce),onDrop:Ce=>{Ce.preventDefault(),is(P,Ce.dataTransfer.getData(Po))},title:qe?ko(u,qe):void 0,className:be("flex shrink-0 flex-col rounded-xl border bg-muted/30 transition-colors",Ve?"w-11":"w-72",qe&&"opacity-50",v===P&&"border-primary bg-primary/5"),children:Ve?n.jsxs("button",{type:"button",onClick:()=>ne(P),"aria-label":u("sandbox.postBoard.expandLane",{lane:Ee}),"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:[n.jsx(Tt,{size:14,className:"shrink-0"}),n.jsx("span",{className:"text-xs tabular-nums",children:Q.length}),n.jsx("span",{className:"[writing-mode:vertical-rl] text-sm font-medium",children:Ee})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2.5 text-sm font-medium",children:[n.jsxs("button",{type:"button",onClick:()=>ne(P),"aria-label":u("sandbox.postBoard.collapseLane",{lane:Ee}),"aria-expanded":!0,className:"flex min-w-0 cursor-pointer items-center gap-1.5 text-left hover:text-muted-foreground",children:[n.jsx(ft,{size:14,className:"shrink-0"}),n.jsx("span",{className:"truncate",children:Ee})]}),n.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:Q.length})]}),n.jsx("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto px-2 pb-2",children:Q.length===0?n.jsx("p",{className:"px-1 py-6 text-center text-xs text-muted-foreground",children:u("sandbox.postBoard.laneEmpty")}):Q.map(Ce=>n.jsx(_r,{post:Ce,payload:J(Ce.key),moving:d.isMoving(Ce.key),onOpen:()=>c(Ce.key),onArchive:Ce.status==="archived"?void 0:()=>{oe(Ce)}},Ce.key))})]})},P)})]}):n.jsxs("div",{className:"flex min-h-0 flex-1",children:[n.jsxs("div",{className:"flex w-80 shrink-0 flex-col border-r",children:[n.jsx(br,{value:we,onChange:Pe}),Le?n.jsx(wr,{count:Te.size,allSelected:je.length>0&&je.every(P=>Te.has(P.key)),onToggleSelectAll:ns,onArchive:()=>{os()},onExit:()=>Ne(new Set)}):n.jsx(yr,{categories:Fe,authors:M,statusCounts:Be,categoryFilter:S,authorFilter:H,statusFilter:ve,sort:ke,onCategoryFilterChange:se,onAuthorFilterChange:ie,onStatusFilterChange:pe,onSortChange:he}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:n.jsx(Br,{posts:je,selectedKey:Z,selectionActive:Le,selectedKeys:Te,onToggleSelect:ss,onOpen:c,isMoving:d.isMoving,onArchive:P=>{oe(P)}})})]}),n.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:Z&&h?n.jsx($.Suspense,{fallback:n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsx(wt,{size:20,className:"animate-spin text-muted-foreground"})}),children:h(Z)}):n.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&&n.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?.()}})}),n.jsx(ct,{open:a==="board"&&!!l&&!_,onOpenChange:P=>{P||(A(!1),r?.())},children:n.jsxs(rt,{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:[n.jsx(it,{className:"sr-only",children:u("sandbox.collectionsSidebar.posts")}),l&&h?n.jsx($.Suspense,{fallback:n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsx(wt,{size:20,className:"animate-spin text-muted-foreground"})}),children:h(l,{expanded:!1,onToggleExpand:()=>A(!0),onClose:()=>r?.()})}):null]})})]})}function bn(t){const e=ae.c(7),{active:s,onClick:o,icon:a,label:l}=t,i=s?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground";let c;e[0]!==i?(c=be("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=n.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 Br(t){const e=ae.c(23),{posts:s,selectedKey:o,selectionActive:a,selectedKeys:l,onToggleSelect:i,onOpen:c,isMoving:r,onArchive:d}=t,p=Se();if(s.length===0){let u;e[0]!==p?(u=p("sandbox.postList.noMatches"),e[0]=p,e[1]=u):u=e[1];let f;return e[2]!==u?(f=n.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:u}),e[2]=u,e[3]=f):f=e[3],f}let m;if(e[4]!==r||e[5]!==d||e[6]!==c||e[7]!==i||e[8]!==s||e[9]!==o||e[10]!==l||e[11]!==a){let u;e[13]!==r||e[14]!==d||e[15]!==c||e[16]!==i||e[17]!==o||e[18]!==l||e[19]!==a?(u=f=>n.jsx(Er,{post:f,selected:f.key===o,selectionActive:a,checked:l.has(f.key),onToggleSelect:()=>i(f.key),moving:r(f.key),onOpen:()=>c(f.key),onArchive:f.status==="archived"?void 0:()=>d(f)},f.key),e[13]=r,e[14]=d,e[15]=c,e[16]=i,e[17]=o,e[18]=l,e[19]=a,e[20]=u):u=e[20],m=s.map(u),e[4]=r,e[5]=d,e[6]=c,e[7]=i,e[8]=s,e[9]=o,e[10]=l,e[11]=a,e[12]=m}else m=e[12];let h;return e[21]!==m?(h=n.jsx("ul",{className:"divide-y",children:m}),e[21]=m,e[22]=h):h=e[22],h}function Er(t){const e=ae.c(56),{post:s,selected:o,selectionActive:a,checked:l,onToggleSelect:i,moving:c,onOpen:r,onArchive:d}=t,p=Se(),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=be("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=n.jsx(Xt,{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=n.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&&n.jsx(Os,{onArchive:d,disabled:c,className:"top-2.5"}),e[14]=c,e[15]=d,e[16]=a,e[17]=j):j=e[17];let w;e[18]!==r||e[19]!==i||e[20]!==a?(w=()=>a?i():r(),e[18]=r,e[19]=i,e[20]=a,e[21]=w):w=e[21];const C=o?"bg-accent text-accent-foreground":"bg-card hover:bg-muted/50";let E;e[22]!==C?(E=be("flex w-full cursor-pointer flex-col gap-1.5 py-2.5 pl-10 pr-3 text-left text-sm transition-colors",C),e[22]=C,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=n.jsx("span",{className:"min-w-0 truncate pr-6 font-medium",children:B}),e[27]=B,e[28]=k):k=e[28];const D=Nr[s.status],O=qt[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=n.jsx(nt,{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&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-warning",children:[n.jsx(Wt,{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&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs tabular-nums text-muted-foreground",children:[n.jsx(ks,{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=n.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 I;e[46]!==o||e[47]!==E||e[48]!==k||e[49]!==A||e[50]!==w?(I=n.jsxs("button",{type:"button",onClick:w,"aria-current":o,className:E,children:[k,A]}),e[46]=o,e[47]=E,e[48]=k,e[49]=A,e[50]=w,e[51]=I):I=e[51];let R;return e[52]!==I||e[53]!==v||e[54]!==j?(R=n.jsxs("li",{className:"group/row relative",children:[v,j,I]}),e[52]=I,e[53]=v,e[54]=j,e[55]=R):R=e[55],R}function _r(t){const e=ae.c(46),{post:s,payload:o,moving:a,onOpen:l,onArchive:i}=t,c=Se(),r=s.status!=="generating"&&!a;let d;e[0]!==o?(d=Zl(o),e[0]=o,e[1]=d):d=e[1];const p=d,m=!r&&"opacity-80";let h;e[2]!==m?(h=be("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&&n.jsx(Os,{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(Po,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=be("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=n.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"&&n.jsxs(n.Fragment,{children:[p.pillarTitle&&n.jsx(nt,{variant:"secondary",className:"max-w-full truncate",children:p.pillarTitle}),p.format?.name&&n.jsx(nt,{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 w;e[19]!==s.status||e[20]!==c?(w=s.status==="generating"&&n.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[n.jsx(wt,{size:12,className:"animate-spin"}),c("sandbox.postBoard.generatingLabel")]}),e[19]=s.status,e[20]=c,e[21]=w):w=e[21];let C;e[22]!==s.missing||e[23]!==s.status||e[24]!==c?(C=s.status==="awaiting_review"&&(s.missing.length>0?n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-warning",children:[n.jsx(Wt,{size:12}),c("sandbox.postBoard.nIssues",{count:String(s.missing.length)})]}):n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-success",children:[n.jsx(ol,{size:12}),c("sandbox.postBoard.readyToSchedule")]})),e[22]=s.missing,e[23]=s.status,e[24]=c,e[25]=C):C=e[25];let E;e[26]!==s.date||e[27]!==s.scheduledDatetime||e[28]!==s.status?(E=(s.status==="scheduled"||s.status==="published")&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[n.jsx(ks,{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]!==w||e[32]!==C||e[33]!==E?(B=n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[j,w,C,E]}),e[30]=j,e[31]=w,e[32]=C,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=n.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=n.jsxs("div",{className:h,children:[u,k]}),e[42]=k,e[43]=h,e[44]=u,e[45]=D):D=e[45],D}function Dr(t){const e=ae.c(40),{ideas:s,collapsed:o,pillarTitleOf:a,onToggleCollapsed:l,onGenerate:i,onDelete:c}=t,r=Se();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=n.jsx(Tt,{size:14,className:"shrink-0"}),e[11]=k):k=e[11];let D;e[12]!==s.length?(D=n.jsx("span",{className:"text-xs tabular-nums",children:s.length}),e[12]=s.length,e[13]=D):D=e[13],g=n.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,n.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=n.jsx(ft,{size:14,className:"shrink-0"}),e[14]=x):x=e[14];let y;e[15]!==d?(y=n.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=n.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=n.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:s.length}),e[22]=s.length,e[23]=j):j=e[23];let w;e[24]!==j||e[25]!==u||e[26]!==v?(w=n.jsxs("div",{className:u,children:[v,j]}),e[24]=j,e[25]=u,e[26]=v,e[27]=w):w=e[27];let C;e[28]!==s||e[29]!==c||e[30]!==i||e[31]!==a||e[32]!==r?(C=s.length===0?n.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 n.jsxs("div",{className:"group/card relative rounded-lg border border-dashed bg-card shadow-sm transition-colors hover:border-primary/40",children:[n.jsx(Os,{label:r("sandbox.postBoard.deleteIdea"),onArchive:()=>c(k),className:"top-2"}),n.jsxs("div",{className:"p-3",children:[n.jsx("p",{className:"line-clamp-2 pr-6 text-sm font-medium",children:k.title||r("sandbox.postBoard.untitledIdea")}),k.body&&n.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:k.body}),D&&n.jsx(nt,{variant:"secondary",className:"mt-2 max-w-full truncate",children:D})]}),n.jsx("div",{className:"border-t px-3 py-2",children:n.jsxs(_e,{type:"button",variant:"ghost",size:"sm",disabled:!0,className:"h-7 w-full justify-start px-1.5 text-xs",onClick:()=>i(k),children:[n.jsx(et,{size:13}),r("sandbox.postBoard.writeFromIdea"),n.jsx(nt,{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]=C):C=e[33];let E;e[34]!==C?(E=n.jsx("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto pb-2 pr-1",children:C}),e[34]=C,e[35]=E):E=e[35];let B;return e[36]!==w||e[37]!==E||e[38]!==f?(B=n.jsxs("div",{className:f,children:[w,E]}),e[36]=w,e[37]=E,e[38]=f,e[39]=B):B=e[39],B}function Os(t){const e=ae.c(13),{label:s,onArchive:o,disabled:a,className:l}=t,i=Se();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=be("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=n.jsx(Ts,{size:13}),e[7]=m):m=e[7];let h;return e[8]!==a||e[9]!==d||e[10]!==p||e[11]!==r?(h=n.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 Ue(t){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}=t,v=Se(),j=c==="global";let w;e[0]!==s||e[1]!==i||e[2]!==j||e[3]!==o?(w=o?n.jsx("img",{src:o,alt:"",className:"size-8 shrink-0 rounded-lg object-cover bg-muted"}):n.jsx("span",{className:be("flex size-8 shrink-0 items-center justify-center rounded-lg",j?"bg-global-section/15":"bg-muted"),children:n.jsx(s,{size:16,className:be("shrink-0",!j&&(i?"text-accent-foreground":"text-muted-foreground")),style:j?{color:Ps}:void 0})}),e[0]=s,e[1]=i,e[2]=j,e[3]=o,e[4]=w):w=e[4];const C=w,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=be("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&&n.jsx("span",{className:be("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:Ar,children:n.jsx(Xt,{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=be("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=n.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=be("block truncate text-xs",K),e[19]=K,e[20]=F):F=e[20];let _;e[21]!==l||e[22]!==F?(_=n.jsx("span",{className:F,children:l}),e[21]=l,e[22]=F,e[23]=_):_=e[23];let A;e[24]!==_||e[25]!==L?(A=n.jsxs("span",{className:"min-w-0 flex-1",children:[L,_]}),e[24]=_,e[25]=L,e[26]=A):A=e[26];let I;e[27]!==i||e[28]!==v||e[29]!==r?(I=r!==void 0&&r>1&&n.jsxs(Qe,{children:[n.jsx(We,{asChild:!0,children:n.jsxs("span",{className:be("flex shrink-0 items-center gap-1 text-xs font-medium",i?"text-accent-foreground/70":"text-muted-foreground"),children:[n.jsx(Bn,{size:14}),r]})}),n.jsx(Ye,{side:"bottom",children:v("sandbox.itemRow.variantCount",{count:r})})]}),e[27]=i,e[28]=v,e[29]=r,e[30]=I):I=e[30];let R;e[31]!==i||e[32]!==u||e[33]!==f?(R=u&&n.jsxs(Qe,{children:[n.jsx(We,{asChild:!0,children:n.jsx("span",{className:be("flex shrink-0 items-center",i?"text-accent-foreground":"text-destructive"),children:n.jsx(Wt,{size:14})})}),f&&n.jsx(Ye,{side:"bottom",children:f})]}),e[31]=i,e[32]=u,e[33]=f,e[34]=R):R=e[34];let G;e[35]!==x||e[36]!==C||e[37]!==A||e[38]!==I||e[39]!==R||e[40]!==d?(G=n.jsxs("button",{type:"button",onClick:x,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-lg px-2.5 py-2 text-left cursor-pointer",children:[C,A,I,R,d]}),e[35]=x,e[36]=C,e[37]=A,e[38]=I,e[39]=R,e[40]=d,e[41]=G):G=e[41];let z;e[42]!==i||e[43]!==y?(z=y&&n.jsx("div",{className:be("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 W;return e[45]!==G||e[46]!==z||e[47]!==B||e[48]!==k?(W=n.jsxs("div",{className:B,children:[k,G,z]}),e[45]=G,e[46]=z,e[47]=B,e[48]=k,e[49]=W):W=e[49],W}function Ar(t){return t.stopPropagation()}function tt(t){const e=ae.c(10),{icon:s,title:o,description:a}=t;let l;e[0]!==s?(l=s&&n.jsx(s,{size:24,className:"text-muted-foreground/60"}),e[0]=s,e[1]=l):l=e[1];let i;e[2]!==o?(i=n.jsx("div",{children:o}),e[2]=o,e[3]=i):i=e[3];let c;e[4]!==a?(c=a&&n.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=n.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground",children:[l,i,c]}),e[6]=l,e[7]=i,e[8]=c,e[9]=r):r=e[9],r}const $r={loaders:Tn,actions:An},Lr={loaders:"Loaders",actions:"Actions"},Or={analytics:Jo,blog:Gn,commerce:qo,site:Ho,website:Kt};function Ir(t,e){return e===0?Or[t.toLowerCase()]??Ks:Ks}function At(t,e){return e===0?pa(t):t}function Rr(t){const e=ae.c(98),{orgSlug:s,virtualMcpId:o,branch:a,previewUrl:l,meta:i,decofile:c,kind:r}=t,d=Se();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(Hr),[j,w]=$.useState(r);j!==r&&(w(r),h([]),f(null),x(""),v(new Set));let C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=q=>{v(X=>{const de=new Set(X);return de.has(q)?de.delete(q):de.add(q),de})},e[1]=C):C=e[1];const E=C;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=Qt(B);let D;e[6]!==k?(D=Fn((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=ha(r),e[8]=r,e[9]=L):L=e[9];const K=L,F=$r[r];let _,A,I,R,G,z,W;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){I=Symbol.for("react.early_return_sentinel");e:{const q=[...da(i,c,r).map(Ur),...ua(i,r).map(Gr)],X=g.trim().toLowerCase(),de=X.length>0,ne=de?q.filter(M=>M.title.toLowerCase().includes(X)||M.resolveType.toLowerCase().includes(X)):[],ue=new Map,te=[],re=new Map;if(!de){for(const M of q){const ge=M.folderPath;if(!(ge.length<m.length)&&m.every((je,Le)=>ge[Le]===je))if(ge.length===m.length)if(M.savedKey!==void 0){const je=re.get(M.resolveType);je?je.push(M):re.set(M.resolveType,[M])}else te.push(M);else{const je=ge[m.length],Le=ue.get(je)??{count:0,savedCount:0};M.savedKey!==void 0?Le.savedCount=Le.savedCount+1:Le.count=Le.count+1,ue.set(je,Le)}}te.sort(Vr);for(const M of re.values())M.sort(Mr)}const le=[...re.entries()].filter(M=>{const[ge]=M;return!te.some(je=>je.resolveType===ge)}).flatMap(zr).sort(Kr);let N;e[33]!==m?(N=(M,ge)=>At(M.name,m.length).localeCompare(At(ge.name,m.length)),e[33]=m,e[34]=N):N=e[34];const J=[...ue.entries()].map(Fr).sort(N);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,ge)=>{await k.mutateAsync({blockKey:M,data:ge}),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=qr(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 ge;e[43]===Symbol.for("react.memo_cache_sentinel")?(ge=()=>f(null),e[43]=ge):ge=e[43];let je;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?(je=n.jsx(ma,{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:ge},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]=je):je=e[57],I=je;break e}W="flex h-full w-full min-w-0 flex-col";let ve;e[58]!==d?(ve=d("sandbox.runnableBlocksBrowser.folderBreadcrumb"),e[58]=d,e[59]=ve):ve=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=be("min-w-0 truncate 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 we=Lr[r];let Pe;e[63]!==he||e[64]!==we?(Pe=n.jsx("button",{type:"button",onClick:pe,className:he,children:we}),e[63]=he,e[64]=we,e[65]=Pe):Pe=e[65];let Te;e[66]!==m?(Te=m.map((M,ge)=>{const je=ge===m.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[n.jsx(Tt,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>h(m.slice(0,ge+1)),className:be("min-w-0 truncate rounded-lg px-1 py-0.5 transition-colors hover:bg-accent hover:text-accent-foreground",je?"font-medium text-foreground":"text-muted-foreground"),children:At(M,ge)})]},`${M}-${ge}`)}),e[66]=m,e[67]=Te):Te=e[67];let Ne;e[68]!==ve||e[69]!==Pe||e[70]!==Te?(Ne=n.jsxs("nav",{"aria-label":ve,className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:[Pe,Te]}),e[68]=ve,e[69]=Pe,e[70]=Te,e[71]=Ne):Ne=e[71];let Be;e[72]===Symbol.for("react.memo_cache_sentinel")?(Be=n.jsx(Ss,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[72]=Be):Be=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 Fe;e[80]!==g||e[81]!==xe||e[82]!==$e?(Fe=n.jsxs("div",{className:"flex w-56 shrink-0 items-center gap-2",children:[Be,n.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]=Fe):Fe=e[83],e[84]!==Ne||e[85]!==Fe?(A=n.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b px-4",children:[Ne,Fe]}),e[84]=Ne,e[85]=Fe,e[86]=A):A=e[86],_=Yt,z="min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",R="mx-auto w-full max-w-4xl px-6 py-5",G=de?ne.length===0?n.jsx(tt,{title:d("sandbox.runnableBlocksBrowser.noSearchResults",{kind:r,query:g.trim()}),description:d("sandbox.runnableBlocksBrowser.noSearchResultsDescription")}):n.jsx("div",{className:"flex flex-col gap-1",children:ne.map(M=>n.jsx(Ue,{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))}):J.length===0&&te.length===0&&le.length===0?n.jsx(tt,{title:d("sandbox.runnableBlocksBrowser.emptyFolderTitle",{kind:r}),description:m.length===0?d("sandbox.runnableBlocksBrowser.emptyFolderNoManifest"):d("sandbox.runnableBlocksBrowser.emptyFolder")}):n.jsxs(n.Fragment,{children:[J.length>0&&n.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-2",children:J.map(M=>{const ge=Ir(M.name,m.length);return n.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:[n.jsx(ge,{size:18,className:"shrink-0 text-muted-foreground"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate text-sm font-medium",children:At(M.name,m.length)}),n.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:[M.count," ",M.count===1?K:r,M.savedCount>0&&n.jsxs(n.Fragment,{children:[" ","·"," ",d("sandbox.runnableBlocksBrowser.savedCountLabel",{count:M.savedCount})]})]})]})]},M.name)})}),(te.length>0||le.length>0)&&n.jsxs("div",{className:be("flex flex-col gap-1",J.length>0&&"mt-4"),children:[te.map(M=>{const ge=re.get(M.resolveType)??[],je=y.has(M.resolveType);return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(Ue,{icon:F,title:M.title,subtitle:M.resolveType,active:!1,onClick:()=>oe(M)}),ge.length>0&&n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",onClick:()=>E(M.resolveType),"aria-expanded":je,className:"flex items-center gap-1 self-start rounded-lg px-2.5 py-1 text-xs font-medium transition-colors hover:bg-global-section/10 cursor-pointer ml-11",style:{color:Ps},children:[je?n.jsx(ft,{size:12,className:"shrink-0"}):n.jsx(Tt,{size:12,className:"shrink-0"}),d(je?"sandbox.runnableBlocksBrowser.hideSaved":"sandbox.runnableBlocksBrowser.seeSaved")," ","(",ge.length,")"]}),je&&n.jsx("div",{className:"ml-11 flex flex-col gap-1 pb-1",children:ge.map(Le=>n.jsx(Ue,{icon:F,accent:"global",title:Le.title,subtitle:Le.resolveType,active:!1,onClick:()=>oe(Le)},Le.savedKey))})]})]},M.resolveType)}),le.map(M=>n.jsx(Ue,{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]=I,e[29]=R,e[30]=G,e[31]=z,e[32]=W}else _=e[26],A=e[27],I=e[28],R=e[29],G=e[30],z=e[31],W=e[32];if(I!==Symbol.for("react.early_return_sentinel"))return I;let T;e[87]!==R||e[88]!==G?(T=n.jsx("div",{className:R,children:G}),e[87]=R,e[88]=G,e[89]=T):T=e[89];let U;e[90]!==_||e[91]!==T||e[92]!==z?(U=n.jsx(_,{className:z,children:T}),e[90]=_,e[91]=T,e[92]=z,e[93]=U):U=e[93];let Y;return e[94]!==A||e[95]!==U||e[96]!==W?(Y=n.jsxs("div",{className:W,children:[A,U]}),e[94]=A,e[95]=U,e[96]=W,e[97]=Y):Y=e[97],Y}function Fr(t){const[e,s]=t;return{name:e,...s}}function Kr(t,e){return t.title.localeCompare(e.title)}function zr(t){const[,e]=t;return e}function Mr(t,e){return t.title.localeCompare(e.title)}function Vr(t,e){return t.title.localeCompare(e.title)}function Gr(t){return{resolveType:t.resolveType,title:t.title,folderPath:Rn(t.resolveType)}}function Ur(t){return{resolveType:t.resolveType,title:t.title,folderPath:Rn(t.resolveType),savedKey:t.key}}function Hr(){return new Set}function qr(t,e){if(!t)return null;if(t.mode==="available")return{mode:"available",resolveType:t.resolveType,editorTarget:{mode:"available",resolveType:t.resolveType,title:t.title},initialValue:{}};const{resolveType:s,props:o,title:a}=fa(e,t.key);return{mode:"saved",blockKey:t.key,resolveType:s,editorTarget:{mode:"saved",blockKey:t.key,resolveType:s,title:a},initialValue:o}}function Jr(t){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}=t,f=Se(),g=Bt(),x=g?.virtualMcpId,v=qn(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[w,C]=$.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=Ns(r,i),e[2]=i,e[3]=r,e[4]=F):F=e[4];const _=F;let A,I,R,G,z,W,T,U;if(e[5]!==v||e[6]!==a||e[7]!==c||e[8]!==B||e[9]!==w||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 N;e[27]!==v||e[28]!==a||e[29]!==s||e[30]!==le||e[31]!==re||e[32]!==o?(N={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]=N):N=e[33],I=N;let J,Z,oe,S;if(e[34]!==c||e[35]!==B||e[36]!==w||e[37]!==h||e[38]!==f||e[39]!==d){const Pe=[d,...B],Te=Be=>{k(B.slice(0,Be)),O(Wr)};let Ne;e[48]!==c||e[49]!==w||e[50]!==h?(Ne=async Be=>{const De=ga(Be,c);if(De){me.error(De);return}await h(Be,w),K(!1)},e[48]=c,e[49]=w,e[50]=h,e[51]=Ne):Ne=e[51],A=Ne,U="flex h-full w-full min-w-0",T="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?(J=f("sandbox.availableSectionEditor.editingBreadcrumb"),e[52]=f,e[53]=J):J=e[53],Z="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",oe=Pe.map((Be,De)=>{const xe=De===Pe.length-1,$e=xa(Be);return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[De>0&&n.jsx(Tt,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>Te(De),title:$e,className:be("min-w-0 truncate 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]=w,e[37]=h,e[38]=f,e[39]=d,e[40]=A,e[41]=J,e[42]=Z,e[43]=oe,e[44]=S,e[45]=z,e[46]=T,e[47]=U}else A=e[40],J=e[41],Z=e[42],oe=e[43],S=e[44],z=e[45],T=e[46],U=e[47];let se;e[54]!==J||e[55]!==Z||e[56]!==oe?(se=n.jsx("nav",{"aria-label":J,className:Z,children:oe}),e[54]=J,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 ve;e[61]===Symbol.for("react.memo_cache_sentinel")?(ve=n.jsx(Wo,{size:14}),e[61]=ve):ve=e[61];let pe;e[62]!==m||e[63]!==ie?(pe=n.jsx(We,{asChild:!0,children:n.jsx(_e,{size:"icon",className:"size-8 shrink-0",disabled:m,onClick:H,"aria-label":ie,children:ve})}),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=n.jsx(Ye,{side:"bottom",children:ke}),e[67]=ke,e[68]=he):he=e[68];let we;e[69]!==pe||e[70]!==he?(we=n.jsxs(Qe,{children:[pe,he]}),e[69]=pe,e[70]=he,e[71]=we):we=e[71],e[72]!==S||e[73]!==se||e[74]!==we?(W=n.jsxs("div",{className:S,children:[se,we]}),e[72]=S,e[73]=se,e[74]=we,e[75]=W):W=e[75],R="mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",G=f("sandbox.availableSectionEditor.localEditsHint",{typeLabel:te}),e[5]=v,e[6]=a,e[7]=c,e[8]=B,e[9]=w,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]=I,e[21]=R,e[22]=G,e[23]=z,e[24]=W,e[25]=T,e[26]=U}else A=e[19],I=e[20],R=e[21],G=e[22],z=e[23],W=e[24],T=e[25],U=e[26];let Y;e[76]!==R||e[77]!==G?(Y=n.jsx("p",{className:R,children:G}),e[76]=R,e[77]=G,e[78]=Y):Y=e[78];let q;e[79]!==Y||e[80]!==z||e[81]!==W?(q=n.jsxs("div",{className:z,children:[W,Y]}),e[79]=Y,e[80]=z,e[81]=W,e[82]=q):q=e[82];let X;e[83]!==c||e[84]!==B||e[85]!==D||e[86]!==w||e[87]!==i||e[88]!==u||e[89]!==I||e[90]!==_||e[91]!==f?(X=n.jsx(Yt,{className:"min-h-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:_?n.jsx(Kn,{schema:_,value:w,onChange:te=>C(te),basePath:"",breadcrumbPath:B,onBreadcrumbChange:k,meta:i,decofile:c,onSaveReferencedBlock:u,sandbox:I},D):n.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]=w,e[87]=i,e[88]=u,e[89]=I,e[90]=_,e[91]=f,e[92]=X):X=e[92];let de;e[93]!==q||e[94]!==X||e[95]!==T?(de=n.jsxs("div",{className:T,children:[q,X]}),e[93]=q,e[94]=X,e[95]=T,e[96]=de):de=e[96];let ne;e[97]!==p||e[98]!==A||e[99]!==m||e[100]!==L?(ne=n.jsx(ba,{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 ue;return e[102]!==de||e[103]!==ne||e[104]!==U?(ue=n.jsxs("div",{className:U,children:[de,ne]}),e[102]=de,e[103]=ne,e[104]=U,e[105]=ue):ue=e[105],ue}function Wr(t){return t+1}function Yr(t,e){const s={__resolveType:t},o=ja([s],e)[0];return o?ka(s,o,e):null}function Qr({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,meta:a,decofile:l,blockKey:i,onSaveReferencedBlock:c}){const r=Se(),d=Bt(),p=d?.virtualMcpId,h=qn(p===e?e:null)?.metadata?.siteSlug??null,[u]=$.useState(()=>Yr(i,l)),[f,g]=$.useState(u?.data??{}),[x,y]=$.useState([]),[v,j]=$.useState(0),[w,C]=$.useState(!1),[E,B]=$.useState(null),k=E!==null,{save:D,flush:O}=ya({orgSlug:t,virtualMcpId:e,branch:s}),L=u?.resolveType?Ns(u.resolveType,a):null,K=l[i],F=K?Ia(i,K):i,_=d?.taskId??null,A={orgSlug:t,virtualMcpId:e,branch:s,threadId:_,previewUrl:o??void 0,siteSlug:h},I=T=>{g(T),D(i,T)},R=()=>{k?(B(null),C(!1),j(T=>T+1)):B(JSON.stringify(f,null,2))},G=T=>{const U=T??"";try{const Y=JSON.parse(U);if(Y&&typeof Y=="object"&&!Array.isArray(Y)){C(!1),I(Y);return}C(!0)}catch{C(!0)}},z=[F,...x],W=T=>{y(x.slice(0,T)),j(U=>U+1)};return n.jsx("div",{className:"flex h-full w-full min-w-0",children:n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[n.jsx(va,{crumbs:z,onSelect:W}),n.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[n.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:Ps},"aria-hidden":!0}),n.jsx("div",{className:"flex-1"}),n.jsxs(Qe,{children:[n.jsx(We,{asChild:!0,children:n.jsx(_e,{variant:k?"default":"ghost",size:"icon",className:"size-8 shrink-0",onClick:R,"aria-label":r(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson"),"aria-pressed":k,children:k?n.jsx(Bs,{size:14}):n.jsx(En,{size:14})})}),n.jsx(Ye,{side:"bottom",children:r(k?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson")})]})]}),n.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:r("sandbox.savedSectionEditor.globalSectionDescription")})]}),n.jsxs("div",{className:"relative min-h-0 flex-1",children:[n.jsx(Yt,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:L?n.jsx(Kn,{schema:L,value:f,onChange:T=>I(T),basePath:"",breadcrumbPath:x,onBreadcrumbChange:y,meta:a,decofile:l,onSaveReferencedBlock:c,sandbox:A},v):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:r("sandbox.savedSectionEditor.noEditableFields")})})})}),E!==null&&n.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[w&&n.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:r("sandbox.savedSectionEditor.invalidJsonError")}),n.jsx("div",{className:"min-h-0 flex-1",children:n.jsx(Hn,{language:"json",height:"100%",code:E,onChange:G,onSave:T=>{G(T),O()}})})]})]})]})})}function Xr(t){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}=t,h=Se();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=n.jsx(tt,{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=Sa(s.title),e[7]=s.title,e[8]=v):v=e[8];let j;e[9]!==p||e[10]!==s.resolveType?(j=(C,E)=>p(s.resolveType,C,E),e[9]=p,e[10]=s.resolveType,e[11]=j):j=e[11];let w;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?(w=n.jsx(Jr,{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]=w):w=e[25],w}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=n.jsx(Qr,{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 $t(t){const e=ae.c(34),{onDuplicate:s,onRename:o,onAddVariant:a,onEditSeo:l,onViewJson:i,onDelete:c}=t,r=Se();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=n.jsx(Ao,{size:14}),e[2]=p):p=e[2];let m;e[3]!==d?(m=n.jsx(It,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":d,className:"flex h-7 w-7 items-center justify-center rounded-lg text-muted-foreground hover:bg-background hover:text-foreground cursor-pointer",onClick:Zr,children:p})}),e[3]=d,e[4]=m):m=e[4];let h;e[5]!==o||e[6]!==r?(h=o&&n.jsxs(Je,{onClick:o,children:[n.jsx(cl,{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&&n.jsxs(Je,{onClick:s,children:[n.jsx(rl,{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&&n.jsxs(n.Fragment,{children:[n.jsx(ds,{}),n.jsxs(Je,{onClick:a,className:"cursor-pointer text-success focus:text-success",children:[n.jsx(Bn,{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)&&n.jsxs(n.Fragment,{children:[n.jsx(ds,{}),l&&n.jsxs(Je,{onClick:l,children:[n.jsx(Pn,{size:14}),r("sandbox.itemActions.editSeo")]}),i&&n.jsxs(Je,{onClick:i,children:[n.jsx(En,{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=n.jsx(ds,{}),e[18]=x):x=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y=n.jsx(Ts,{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=n.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 w;e[25]!==j||e[26]!==h||e[27]!==u||e[28]!==f||e[29]!==g?(w=n.jsxs(Rt,{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]=w):w=e[30];let C;return e[31]!==w||e[32]!==m?(C=n.jsxs(Ft,{children:[m,w]}),e[31]=w,e[32]=m,e[33]=C):C=e[33],C}function Zr(t){return t.stopPropagation()}function ec(t){return t.split("/").pop()?.replace(/\.tsx?$/,"")||t||"Section"}function tc(t){const e=new Map;for(const s of t){const o=ec(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 yn(t){const e=ae.c(8),{icon:s,label:o,className:a}=t;let l;e[0]!==a?(l=be("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=n.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=n.jsxs("div",{className:l,children:[i,o]}),e[4]=o,e[5]=l,e[6]=i,e[7]=c):c=e[7],c}const vn=$.lazy(()=>He(()=>import("./app-editor-BbrLoyhg.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])).then(t=>({default:t.AppEditor}))),sc=$.lazy(()=>He(()=>import("./post-editor-DtruhQnc.js"),__vite__mapDeps([169,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,29,28,30,31,32,33,34,35,36,37,24,25,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,81,170,156,135,76,77,55,106,118,113,111,61,60,58,62,63,64,65,66,67,68,69,70,71,72,23,73,74,75,78,79,80,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,107,21,22,108,109,110,57,112,114,115,116,117,119,120,121,122,123,124,171,139,59,172,173,174,125,126,127,128,129,130,131,132,133,134,136,137,138,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,157,158,159,160,161,162,163,164,165,166,167,168])).then(t=>({default:t.PostEditor}))),nc=$.lazy(()=>He(()=>import("./record-editor-BRIfWSyG.js"),__vite__mapDeps([175,1,2,56,81,22,23,24,25,111,61,60,11,8,9,12,13,14,15,3,4,5,6,7,10,16,17,18,19,20,58,28,29,30,31,32,33,34,35,36,37,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,62,63,64,65,66,67,68,69,55,70,71,72,73,74,75,76,77,78,79,80,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,21,108,109,110,57,112,113,114,115,116,117,118,119,120,121,122,123,124,174,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])).then(t=>({default:t.RecordEditor}))),oc=$.lazy(()=>He(()=>import("./context-BGRn957C.js"),__vite__mapDeps([176,1,2,25,28,29,30,31,32,33,34,35,36,37,24,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,56,81,111,106,18,177,102,96,55,103,98,70,71,4,5,6,7,8,9,72,23,139,172,112,69,74,76,77,178,143,140,61,60,11,12,13,14,15,3,10,16,17,19,20,58,62,63,64,65,66,67,68,73,75,78,79,80,82,83,84,85,86,87,88,89,90,91,92,93,94,95,97,99,100,101,104,105,107,21,22,108,109,110,57,113,114,115,116,117,118,119,120,121,122,123,124,166,174,175,125,126,127,128,129,130,131,132,133,134,135,136,137,138,141,142,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,167,168,179,171,59,173])).then(t=>({default:t.BlogContext}))),ac=$.lazy(()=>He(()=>import("./category-editor-SDdqVzYD.js"),__vite__mapDeps([179,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,33,35,45,28,29,30,31,32,34,36,37,24,25,27,38,39,40,41,42,43,44,46,47,48,49,50,51,52,53,54,115,56,81,171,112,76,77,55,106,61,60,58,62,63,64,65,66,67,68,69,70,71,72,23,73,74,75,78,79,80,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,107,21,22,108,109,110,111,57,113,114,116,117,118,119,120,121,122,123,124,139,59,172,173,174,125,126,127,128,129,130,131,132,133,134,135,136,137,138,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])).then(t=>({default:t.CategoryEditor}))),lc=$.lazy(()=>He(()=>import("./sections-editor-BTaByHjs.js"),__vite__mapDeps([180,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,57,61,60,58,28,29,30,31,32,33,34,35,36,37,24,25,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,62,63,64,65,66,67,68,69,55,70,71,72,23,73,74,75,76,77,78,79,80,56,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,21,22,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,166,181,26,59,182])).then(t=>({default:t.SectionsEditor}))),ic=$.lazy(()=>He(()=>import("./seo-editor-BohrAqqO.js"),__vite__mapDeps([183,1,2,28,29,30,31,32,33,34,35,36,37,24,25,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,21,22,23,61,60,11,8,9,12,13,14,15,3,4,5,6,7,10,16,17,18,19,20,58,62,63,64,65,66,67,68,69,55,70,71,72,73,74,75,76,77,78,79,80,56,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,57,112,113,114,115,116,117,118,119,120,121,122,123,124,181])).then(t=>({default:t.SeoEditor}))),rc=$.lazy(()=>He(()=>import("./variant-calendar-Dhrw7NO4.js"),__vite__mapDeps([184,1,2,28,29,30,31,32,33,34,35,36,37,24,25,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,81,21,22,23,113,72,185,125,126,121,119,20,14,13,122,5,4,6,7,8,9,11,12,15,100,127,94,98,128,3,10,16,17,18,19,96,55,129,87,71,101,102,103,56,70,130,73,74,75,76,77,78,79,80,82,83,84,85,86,88,89,90,91,131,60,68,67,69,64,65,118,132,123,97,133,134,135,136,106,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,111,152,153,154,155,156,157,158,159,160,63,66,92,93,95,99,104,105,161,116,62,162,163,164,165,115,61,58,107,108,109,110,57,112,114,117,120,124,166,167,168])).then(t=>({default:t.VariantCalendar}))),cc=$.lazy(()=>He(()=>import("./post-calendar-ByuVszdB.js"),__vite__mapDeps([186,1,2,29,28,30,31,32,33,34,35,36,37,24,25,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,187,21,22,23,125,126,121,119,20,14,13,122,5,4,6,7,8,9,11,12,15,100,127,94,98,128,3,10,16,17,18,19,96,72,55,129,87,71,101,102,103,81,56,70,130,73,74,75,76,77,78,79,80,82,83,84,85,86,88,89,90,91,131,60,68,67,69,64,65,118,132,123,97,133,134,135,136,106,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,111,152,153,154,155,156,157,158,159,160,63,66,92,93,95,99,104,105,161,116,62,162,163,164,165,115,61,58,107,108,109,110,57,112,113,114,117,120,124,166,167,168])).then(t=>({default:t.PostCalendar}))),dc=$.lazy(()=>He(()=>import("./redirect-editor-CcNVHhk0.js"),__vite__mapDeps([188,1,2,135,24,56,81,22,23,25,61,60,11,8,9,12,13,14,15,3,4,5,6,7,10,16,17,18,19,20,58,28,29,30,31,32,33,34,35,36,37,27,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,62,63,64,65,66,67,68,69,55,70,71,72,73,74,75,76,77,78,79,80,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,21,108,109,110,111,57,112,113,114,115,116,117,118,119,120,121,122,123,124,174])).then(t=>({default:t.RedirectEditor})));function uc(t){const e=ae.c(20),{deepLinkPage:s}=t,{currentBranch:o,virtualMcpId:a}=wn(),{org:l}=$o(),i=Wa(),c=Ya(),{runtime:r,previewServerUrl:d}=Un(a),p=r==="cms";let m;e[0]!==p||e[1]!==c.previewState||e[2]!==i.lifecycle.phase?(m=El({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=n.jsx(Tl,{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=n.jsx(tt,{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=n.jsx(fc,{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 jn=2e3,mc=15;function kn(t,e,s,o){return typeof e!="string"||s&&(Jn(e,s,o)||t.state.dataUpdateCount>=mc)?!1:jn}function fc({orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,sitePreviewUrl:a,deepLinkPage:l,devServerReady:i,sandboxWarming:c}){const r=Se(),d=Bt()?.taskId??null,p={orgSlug:t,virtualMcpId:e,branch:s,threadId:d,previewUrl:o},{data:m,isLoading:h}=wa(p,{fetchEnabled:i}),u=Sn({strict:!1}),[f,g]=$.useState(()=>u.contentCollection&&ot(u.contentCollection)&&u.contentCollection||"pages"),[x,y]=$.useState(()=>u.contentItem&&ot(f)?{collection:f,key:u.contentItem}:null),[v,j]=$.useState(null),w=!!(l?.pageId||l?.path||l?.pathTemplate),[C,E]=$.useState(!1);if(w&&!C&&x===null&&m){E(!0);const b=Ra(Gs(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:I}=Na(p,{fetchEnabled:i,refetchInterval:b=>{const V=b.state.data;if(f==="apps"&&x&&x.collection==="apps"){const ce=m?.[x.key];return kn(b,typeof ce?.__resolveType=="string"?ce.__resolveType:void 0,V)}if(f==="site"&&m){const ce=V?Us(m,V):null,fe=m.site,Ae=ce?.resolveType??(typeof fe?.__resolveType=="string"?fe.__resolveType:void 0);return kn(b,Ae,V,["seo"])}return!1}}),R=(b,V)=>!Jn(b,_,V)&&(A||I),{catalog:G,isLoading:z}=wl(_??void 0,m??void 0,{enabled:f==="apps"}),W=Mi({orgSlug:t,virtualMcpId:e,branch:s,meta:_}),T=Qt(p),U=Vn(p),Y=Ui({orgSlug:t,virtualMcpId:e,branch:s,decofile:m??{},support:W,onMoved:(b,V)=>y(ce=>ce?.collection==="posts"&&ce.key===b?{collection:"posts",key:V}:ce)}),[q,X]=$.useState(null),[de,ne]=$.useState(),[ue,te]=$.useState(!1),[re,le]=$.useState(),[N,J]=$.useState(null),[Z,oe]=$.useState(null),[S,se]=$.useState(null),H=!m||!_;if(h||A||H&&c)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(lt,{className:"size-5 text-muted-foreground"})});if(H)return n.jsx(tt,{title:"Could not load site data."});const ie=Gs(m).sort((b,V)=>b.name.localeCompare(V.name)),ve=Fa(m).sort((b,V)=>b.from.localeCompare(V.from)),pe=Ka(m,_),ke=f==="sections"?za(_):[],he=Us(m,_),we=Zn(m),Pe=Es.some(b=>we[b].length>0),Te=ot(f)?we[f]:[],Ne=Ms(_,"loaders"),Be=Ms(_,"actions");if(!Ma(m,_)&&!Pe&&Ne===0&&Be===0)return n.jsx(tt,{icon:Wt,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:G.length,loaders:Ne,actions:Be,redirects:ve.length,posts:we.posts.length,authors:we.authors.length,categories:we.categories.length},xe=new Set(ie.map(b=>Lt(b.path))),$e=new Set(ie.map(b=>b.name)),Fe=new Set(pe.map(b=>b.name)),M=async b=>{const V=m[b.key];if(!V)return;const ce=zn(m,b.key),fe=Ca(m,b.key,Math.max(0,ce-1)),Ae=Pa(V.sections,fe);if(Ae)try{await T.mutateAsync({blockKey:b.key,data:{...V,sections:Ae}}),me.success(`Variant added to "${b.name}"`),y({collection:"pages",key:b.key,path:b.path})}catch(Oe){me.error(Oe instanceof Error?Oe.message:"Could not add variant")}},ge=()=>{ne(void 0),X({mode:"create",sourceKey:null,initialName:"My new page",initialPath:"/example"})},je=b=>{ne(void 0),X({mode:"duplicate",sourceKey:b.key,initialName:Ys($e,b.name),initialPath:_l(xe,b.path)})},Le=b=>{ne(void 0),X({mode:"rename",sourceKey:b.key,initialName:b.name,initialPath:b.path})},ss=async b=>{if(!q)return;const{mode:V,sourceKey:ce}=q;try{if(V==="create"){let fe;if(b.templateKey){const Oe=m[b.templateKey];if(!Oe)throw new Error("Selected template no longer exists.");fe={...Oe,name:b.name,path:b.path}}else fe=$l(b.name,b.path);const Ae=Ol(m,b.name);await T.mutateAsync({blockKey:Ae,data:fe}),me.success(`Created "${b.name}"`),y({collection:"pages",key:Ae,path:b.path})}else if(V==="duplicate"&&ce){const fe=m[ce];if(!fe)throw new Error("Source page not found");const{key:Ae,data:Oe}=Al({source:fe,pages:ie,newName:b.name,newPath:b.path});await T.mutateAsync({blockKey:Ae,data:Oe}),me.success(`Duplicated as "${b.name}"`),y({collection:"pages",key:Ae,path:b.path})}else if(V==="rename"&&ce){const fe=m[ce];if(!fe)throw new Error("Page not found");const Ae={...fe,name:b.name,path:b.path};await T.mutateAsync({blockKey:ce,data:Ae}),me.success("Page updated"),x?.collection==="pages"&&x.key===ce&&y({collection:"pages",key:ce,path:b.path})}X(null)}catch(fe){ne(fe instanceof Error?fe.message:"Save failed")}},ns=({path:b})=>{if(!q)return null;const V=Lt(b);return(q.mode==="rename"?Lt(q.initialPath):null)!==V&&xe.has(V)?`A page with path "${b}" already exists.`:null},os=async(b,V,ce)=>{await T.mutateAsync({blockKey:V,data:{...ce,name:V,__resolveType:b}}),me.success(r("sandbox.contentBrowser.createdSection",{name:V})),y({collection:"sections",key:V})},as=Fn((b,V)=>T.mutate({blockKey:b,data:V})),ls=async b=>{const V=m[b.key];if(!V){me.error(r("sandbox.contentBrowser.sectionNotFound"));return}const ce=Dl(m,b.key),fe=Ys(Fe,b.name),Ae={...V,name:fe};try{await T.mutateAsync({blockKey:ce,data:Ae}),me.success(r("sandbox.contentBrowser.duplicatedSection",{name:b.name})),y({collection:"sections",key:ce})}catch(Oe){me.error(Oe instanceof Error?Oe.message:r("sandbox.contentBrowser.duplicateFailed"))}},is=async b=>{if(!N)return;const V=m[N];if(!V){me.error(r("sandbox.contentBrowser.sectionNotFound"));return}try{await T.mutateAsync({blockKey:N,data:{...V,name:b}}),me.success(r("sandbox.contentBrowser.sectionRenamed")),J(null)}catch(ce){me.error(ce instanceof Error?ce.message:r("sandbox.contentBrowser.renameFailed"))}},_t=()=>{le(void 0),te(!0)},rs=async b=>{const V=Va(m,b.from),ce=Ga(b);try{await T.mutateAsync({blockKey:V,data:ce}),me.success("Created redirect"),te(!1),y({collection:"redirects",key:V})}catch(fe){le(fe instanceof Error?fe.message:"Could not create redirect")}},cs=async b=>{const V=hs(m,b),ce=at(V,b,lo(b));try{await T.mutateAsync({blockKey:V,data:ce}),me.success(`Created ${Nt[b]}`),y({collection:b,key:V})}catch(fe){me.error(fe instanceof Error?fe.message:"Could not create")}},P=async b=>{const V=hs(m,"posts"),ce=at(V,"posts",Ci(b));try{await T.mutateAsync({blockKey:V,data:ce}),me.success(r("sandbox.postCalendar.createdScheduledPost")),g("posts"),F("posts"),y({collection:"posts",key:V}),j(null)}catch(fe){me.error(fe instanceof Error?fe.message:r("sandbox.postCalendar.couldNotCreate"))}},Q=async(b,V)=>{const ce=m[b],fe=ce?Ti(dt(ce,"posts"),V):null;if(!fe){me.error(r("sandbox.postCalendar.onlyScheduledCanMove"));return}try{await T.mutateAsync({blockKey:b,data:at(b,"posts",fe)})}catch(Ae){me.error(Ae instanceof Error?Ae.message:r("sandbox.postCalendar.couldNotReschedule"))}},Ee=async b=>{const V=m[b.key];if(!V){me.error("Record not found.");return}const ce=hs(m,b.kind),fe=b.kind==="posts"?"title":"name",Ae={...structuredClone(dt(V,b.kind)),[fe]:`${b.label} (copy)`};try{await T.mutateAsync({blockKey:ce,data:at(ce,b.kind,Ae)}),me.success(`Duplicated "${b.label}"`),y({collection:b.kind,key:ce})}catch(Oe){me.error(Oe instanceof Error?Oe.message:"Duplicate failed")}},Ve=()=>{g("posts"),F("posts"),y(null),j(null),k("")},qe=async()=>{if(Z)try{const{kind:b,key:V,label:ce}=Z;if(b==="blog"){if(Z.blogKind==="categories"){const fe=dt(m[V],"categories").slug,Ae=typeof fe=="string"?fe:"";if(Ae)for(const{key:Oe,payload:Is}of Ge(m,"posts")){const Rs=ni(Is,Ae);Rs!==Is&&await T.mutateAsync({blockKey:Oe,data:at(Oe,"posts",oi(Rs))})}}await U.mutateAsync({blockKey:V})}else await U.mutateAsync({blockKey:V});me.success(`Deleted "${ce}"`),x&&x.collection!=="available-section"&&x.key===V&&y(null),oe(null)}catch(b){me.error(b instanceof Error?b.message:"Delete failed")}},Ce=U.isPending||T.isPending,gt=Z?.kind==="blog"?Nt[Z.blogKind]:Z?.kind??"item";return n.jsxs("div",{className:"flex h-full w-full",children:[n.jsx(Cl,{active:f,counts:De,showBlog:Pe,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"&&n.jsx(pc,{activeCollection:f,pages:ie,redirects:ve,sections:pe,availableSections:ke,appCatalog:G,appCatalogLoading:z,blogEntries:Te,decofile:m,searchQuery:B,onSearchChange:k,selection:x,onSelect:L,onCreate:()=>{f==="pages"?ge():f==="redirects"?_t():ot(f)&&cs(f)},onDuplicatePage:je,onRenamePage:Le,onAddPageVariant:M,onDeletePage:b=>oe({kind:"page",key:b.key,label:b.name}),onEditPageSeo:b=>{const V={collection:"pages",key:b.key,path:b.path};y(V),j(b.key)},onViewPageJson:b=>se(b.key),onDuplicateSection:ls,onRenameSection:b=>J(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})}),n.jsx("div",{className:"flex-1 min-w-0",children:f==="loaders"||f==="actions"?n.jsx(Rr,{orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,meta:_,decofile:m,kind:f}):n.jsx($.Suspense,{fallback:n.jsx("div",{className:"h-full flex items-center justify-center",children:n.jsx(lt,{className:"size-5 text-muted-foreground"})}),children:f==="calendar"?n.jsx(rc,{decofile:m}):f==="post-schedule"?n.jsx(cc,{decofile:m,support:W,isCreating:T.isPending,onCreate:b=>{P(b)},onReschedule:(b,V)=>{Q(b,V)},onSelect:b=>{g("posts"),F("posts"),y({collection:"posts",key:b}),j(null)}}):f==="site"?he?n.jsx(vn,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:he.key,block:m[he.key],decofile:m,meta:_,title:"Site",excludeFields:["seo"],schemaPending:R(he.resolveType,["seo"]),previewBaseUrl:o},`site:${he.key}`):n.jsx(tt,{title:"Site settings not found",description:"This project doesn't have a site app block (site/apps/site.ts)."}):f==="context"?n.jsx(fl,{title:r("sandbox.blogContext.soonTitle"),description:r("sandbox.blogContext.soonDescription"),children:n.jsx(oc,{orgSlug:t,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"?n.jsx(ic,{orgSlug:t,virtualMcpId:e,branch:s,decofile:m,meta:_,target:{kind:"site"},previewBaseUrl:a}):f==="sections"?n.jsx(Xr,{selection:x?.collection==="sections"||x?.collection==="available-section"?x:null,orgSlug:t,virtualMcpId:e,branch:s,previewUrl:o,meta:_,decofile:m,isCreating:T.isPending,onCreateAvailable:os,onSaveReferencedBlock:as}):f==="posts"?n.jsx(Tr,{orgSlug:t,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:W,meta:_,renderDetail:(b,V)=>n.jsx(sc,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:b,block:m[b],decofile:m,meta:_,previewBaseUrl:a,move:Y,onClose:V?.onClose,expanded:V?.expanded,onToggleExpand:V?.onToggleExpand},`post:${Ct(b)}`)}):x&&x.collection!=="available-section"?x.collection==="apps"?n.jsx(vn,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:x.key,block:m[x.key],decofile:m,meta:_,previewBaseUrl:o,schemaPending:R(typeof m[x.key]?.__resolveType=="string"?String(m[x.key].__resolveType):void 0)},`app:${x.key}`):x.collection==="categories"?n.jsx(ac,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:x.key,block:m[x.key],decofile:m,meta:_,onManagePosts:()=>Ve(),onOpenPost:b=>{g("posts"),F("posts"),y({collection:"posts",key:b}),j(null)},previewBaseUrl:a},`category:${x.key}`):x.collection==="authors"?n.jsx(nc,{orgSlug:t,virtualMcpId:e,branch:s,kind:"authors",blockKey:x.key,block:m[x.key]},`authors:${x.key}`):x.collection==="redirects"?n.jsx(dc,{orgSlug:t,virtualMcpId:e,branch:s,blockKey:x.key,block:m[x.key]},`redirect:${x.key}`):n.jsx(lc,{orgSlug:t,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}`):n.jsx(tt,{title:`Select ${ot(f)?`a ${Nt[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&&n.jsx(Kl,{open:!!q,mode:q.mode,initialName:q.initialName,initialPath:q.initialPath,isPending:T.isPending,error:de,templates:ie,validate:ns,onSubmit:ss,onOpenChange:b=>{b||(X(null),ne(void 0))}}),n.jsx(Ml,{open:ue,isPending:T.isPending,error:re,onSubmit:rs,onOpenChange:b=>{b||(te(!1),le(void 0))}}),N&&n.jsx(Vl,{open:!!N,blockKey:N,initialName:pe.find(b=>b.key===N)?.name??N,isPending:T.isPending,onSubmit:is,onOpenChange:b=>{b||J(null)}}),S&&n.jsx(Ua,{open:!!S,onOpenChange:b=>{b||se(null)},pageKey:S,decofile:m,onSave:b=>T.mutateAsync({blockKey:S,data:b})}),n.jsx(Qo,{open:!!Z,onOpenChange:b=>{!b&&!Ce&&oe(null)},children:n.jsxs(Xo,{children:[n.jsxs(Zo,{children:[n.jsx(ea,{children:`Delete ${gt}?`}),n.jsx(ta,{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})]}),n.jsxs(sa,{children:[n.jsx(na,{disabled:Ce,children:"Cancel"}),n.jsx(oa,{onClick:b=>{b.preventDefault(),qe()},disabled:Ce,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Ce?n.jsxs(n.Fragment,{children:[n.jsx(lt,{className:"size-3.5"}),"Deleting…"]}):"Delete"})]})]})})]})}function pc(t){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:w,onViewPageJson:C,onDuplicateSection:E,onRenameSection:B,onDeleteSection:k,onDeleteRedirect:D,onDuplicateBlog:O,onDeleteBlog:L}=t;let K,F,_,A,I,R;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]!==w||e[16]!==y||e[17]!==B||e[18]!==h||e[19]!==f||e[20]!==C||e[21]!==o||e[22]!==a||e[23]!==m||e[24]!==l||e[25]!==u){const T=m.toLowerCase(),U=o.filter(S=>!T||S.name.toLowerCase().includes(T)||S.path.toLowerCase().includes(T)),Y=a.filter(S=>!T||S.from.toLowerCase().includes(T)||S.to.toLowerCase().includes(T)),q=l.filter(S=>!T||S.name.toLowerCase().includes(T)||S.key.toLowerCase().includes(T)||S.resolveType.toLowerCase().includes(T)),X=i.filter(S=>!T||S.title.toLowerCase().includes(T)||S.resolveType.toLowerCase().includes(T)||(S.description?.toLowerCase().includes(T)??!1)),de=tc(q),ne=c.filter(S=>!T||S.title.toLowerCase().includes(T)||S.app.toLowerCase().includes(T)||S.vendor.toLowerCase().includes(T)||S.category.toLowerCase().includes(T)),ue=d.filter(S=>!T||S.label.toLowerCase().includes(T)||S.subtitle.toLowerCase().includes(T)),te=`Search ${s}…`,re=ot(s)?`Create new ${Nt[s]}`:s==="redirects"?"Create new redirect":"Create new page",le=s!=="apps"&&s!=="sections";I="shrink-0 border-r flex flex-col min-h-0 w-[300px]";let N;e[32]===Symbol.for("react.memo_cache_sentinel")?(N=n.jsx(Ss,{size:14,className:"shrink-0 text-muted-foreground","aria-hidden":!0}),e[32]=N):N=e[32];let J;e[33]!==h?(J=S=>h(S.target.value),e[33]=h,e[34]=J):J=e[34];let Z;e[35]!==te||e[36]!==m||e[37]!==J?(Z=n.jsxs("div",{className:"flex flex-1 items-center gap-2 pl-1",children:[N,n.jsx("input",{type:"text",value:m,onChange:J,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]=J,e[38]=Z):Z=e[38];let oe;e[39]!==re||e[40]!==g||e[41]!==le?(oe=le&&n.jsxs(Qe,{children:[n.jsx(We,{asChild:!0,children:n.jsx(_e,{variant:"ghost",size:"icon",onClick:g,"aria-label":re,children:n.jsx(ws,{size:14})})}),n.jsx(Ye,{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?(R=n.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]=R):R=e[45],K=Yt,A="flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",F="flex flex-col gap-1 p-1.5",_=s==="pages"?U.length===0?n.jsx(yt,{hasItems:o.length>0,emptyLabel:"No pages yet.",emptyHint:'Click "+" to create your first page.'}):U.map(S=>{const se=u?.collection==="pages"&&u.key===S.key,H=zn(p,S.key);return n.jsx(Ue,{icon:_n,title:S.name,subtitle:S.path,active:se,variantCount:H,onClick:()=>f({collection:"pages",key:S.key,path:S.path}),menu:n.jsx($t,{onDuplicate:()=>x(S),onRename:()=>y(S),onAddVariant:()=>v(S),onEditSeo:()=>w(S),onViewJson:()=>C(S),onDelete:()=>j(S)})},S.key)}):s==="sections"?q.length===0&&X.length===0?n.jsx(yt,{hasItems:l.length>0||i.length>0,emptyLabel:"No sections yet.",emptyHint:"Save a section from a page, or start the preview dev server."}):n.jsxs(n.Fragment,{children:[de.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(yn,{icon:Kt,label:"Saved sections"}),de.map(S=>n.jsxs("div",{className:"flex flex-col gap-1",children:[n.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 n.jsx(Ue,{icon:Kt,accent:"global",title:se.name,subtitle:S.label,active:H,onClick:()=>f({collection:"sections",key:se.key}),menu:n.jsx($t,{onDuplicate:()=>E(se),onRename:()=>B(se),onDelete:()=>k(se)})},se.key)})]},S.label))]}),X.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(yn,{icon:zs,label:"Available sections",className:be(de.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 n.jsx(Ue,{icon:zs,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?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx(lt,{className:"size-4.5 text-muted-foreground"})}):ne.length===0?n.jsx(yt,{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 n.jsx(Ue,{icon:$n,logoUrl:S.logo,title:S.title,subtitle:S.category,active:se,trailing:S.installed?n.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?n.jsx(yt,{hasItems:a.length>0,emptyLabel:"No redirects yet.",emptyHint:'Click "+" to create your first redirect.'}):Y.map(S=>n.jsx(Ue,{icon:Nn,title:S.from||"(no source)",subtitle:`→ ${S.to||"(no target)"}`,active:u?.collection==="redirects"&&u.key===S.key,trailing:n.jsx(Gl,{type:S.type}),onClick:()=>f({collection:"redirects",key:S.key}),menu:n.jsx($t,{onDelete:()=>D(S)})},S.key)):ue.length===0?n.jsx(yt,{hasItems:d.length>0,emptyLabel:`No ${s} yet.`,emptyHint:`Click "+" to create your first ${ot(s)?Nt[s]:"item"}.`}):ue.map(S=>{const se=u?.collection===S.kind&&u.key===S.key;return n.jsx(Ue,{icon:S.kind==="posts"?Dn:S.kind==="authors"?Ln:Cn,title:S.label,subtitle:S.subtitle,active:se,onClick:()=>f({collection:S.kind,key:S.key}),menu:n.jsx($t,{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]=w,e[16]=y,e[17]=B,e[18]=h,e[19]=f,e[20]=C,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]=I,e[31]=R}else K=e[26],F=e[27],_=e[28],A=e[29],I=e[30],R=e[31];let G;e[46]!==F||e[47]!==_?(G=n.jsx("div",{className:F,children:_}),e[46]=F,e[47]=_,e[48]=G):G=e[48];let z;e[49]!==K||e[50]!==A||e[51]!==G?(z=n.jsx(K,{className:A,children:G}),e[49]=K,e[50]=A,e[51]=G,e[52]=z):z=e[52];let W;return e[53]!==I||e[54]!==R||e[55]!==z?(W=n.jsxs("div",{className:I,children:[R,z]}),e[53]=I,e[54]=R,e[55]=z,e[56]=W):W=e[56],W}function hc(t){const e=ae.c(25),{virtualMcpId:s}=t,o=Se(),[a,l]=$.useState(!1),i=il(s),{activeTask:c}=wn();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[0]=r):r=e[0];const d=Sn(r);if(!(Js(i?.metadata)||Js(c?.metadata))){let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx("div",{className:"flex size-14 items-center justify-center rounded-full bg-muted",children:n.jsx(Ws,{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=n.jsx(Ws,{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=n.jsxs(_e,{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=n.jsx(dl,{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 w;e[16]!==a?(w=n.jsx(ul,{open:a,onOpenChange:l,mode:"agent"}),e[16]=a,e[17]=w):w=e[17];let C;return e[18]!==w||e[19]!==j?(C=n.jsxs(n.Fragment,{children:[j,w]}),e[18]=w,e[19]=j,e[20]=C):C=e[20],C}let m;return e[21]!==d.contentPageId||e[22]!==d.contentPath||e[23]!==d.contentPathTemplate?(m=n.jsx(uc,{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 xc(){const t=ae.c(2),e=ml();let s;return t[0]!==e?(s=n.jsx(Lo,{tabId:"content",children:n.jsx(Oo,{feature:"cms",children:n.jsx(hc,{virtualMcpId:e})})}),t[0]=e,t[1]=s):s=t[1],s}const $d=Object.freeze(Object.defineProperty({__proto__:null,default:xc},Symbol.toStringTag,{value:"Module"}));export{jo as $,Td as A,As as B,bd as C,xd as D,Pd as E,Ed as F,Zn as G,mo as H,Hi as I,tn as J,vi as K,hd as L,hs as M,lo as N,fd as O,Ds as P,vd as Q,Bd as R,jd as S,_d as T,Sd as U,mt as V,wd as W,kd as X,yd as Y,Nd as Z,Ut as _,md as a,$d as a0,ts as b,oi as c,Cd as d,ud as e,Ge as f,dt as g,qt as h,Dd as i,di as j,Ad as k,so as l,_s as m,Dl as n,io as o,Et as p,at as q,hl as r,ye as s,fo as t,Mi as u,Ke as v,gi as w,pd as x,gd as y,Me as z};
|