decocms 4.507.0 → 4.507.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{ActiveShapeUtils-qG-AEsLH.js → ActiveShapeUtils-jySIfQfO.js} +1 -1
- package/dist/client/assets/{AlertCircle-DZq02EzT.js → AlertCircle-C49F0ts6.js} +1 -1
- package/dist/client/assets/{AreaChart-BtdW-Fy2.js → AreaChart-DtekUHHL.js} +1 -1
- package/dist/client/assets/{ArrowLeft-C_qdjo3L.js → ArrowLeft-CSSCO41y.js} +1 -1
- package/dist/client/assets/{ArrowUp-B_lKPC5O.js → ArrowUp-eyGXli3J.js} +1 -1
- package/dist/client/assets/{BarChart-4XWgQXi5.js → BarChart-B6-ZUZgm.js} +1 -1
- package/dist/client/assets/{Building02-LYkR_QXB.js → Building02-Cc0RR_mQ.js} +1 -1
- package/dist/client/assets/{CategoricalChart-CHtvdKKv.js → CategoricalChart-Bn8cFml0.js} +1 -1
- package/dist/client/assets/{CheckCircle-B9QHilAa.js → CheckCircle-BED6dkLg.js} +1 -1
- package/dist/client/assets/{ChevronSelectorVertical-0ysVIDar.js → ChevronSelectorVertical-DeVUWHMb.js} +1 -1
- package/dist/client/assets/{ChevronUp-D4PiHnN0.js → ChevronUp-M8O43yJN.js} +1 -1
- package/dist/client/assets/{Copy01-DJEr7OLy.js → Copy01-IjT5Cr-0.js} +1 -1
- package/dist/client/assets/{CreditCard01-b36fqa11.js → CreditCard01-CCewrsPV.js} +1 -1
- package/dist/client/assets/{DotsVertical-CV1b1y4C.js → DotsVertical-C3vEzxwp.js} +1 -1
- package/dist/client/assets/{ErrorBarContext-UL-jymXX.js → ErrorBarContext-Cb5oOttH.js} +1 -1
- package/dist/client/assets/{Globe04-DKUCyty7.js → Globe04-DOtzWDgX.js} +1 -1
- package/dist/client/assets/{Image01-CyRCJwXT.js → Image01-aYI2vrVV.js} +1 -1
- package/dist/client/assets/{Key01-DWXRgH6w.js → Key01-BnFprBC4.js} +1 -1
- package/dist/client/assets/{Link01-CNb9DW_9.js → Link01-CdThLL91.js} +1 -1
- package/dist/client/assets/{LinkBroken01-BU-4AKfc.js → LinkBroken01-Cemx_-td.js} +1 -1
- package/dist/client/assets/{Monitor01-yE6iFgVP.js → Monitor01-BZieTizR.js} +1 -1
- package/dist/client/assets/{Play-ChRMrCTB.js → Play-DJbpbnnH.js} +1 -1
- package/dist/client/assets/{Plus-DtZhz_pb.js → Plus-Xcxre04p.js} +1 -1
- package/dist/client/assets/{SearchMd-BQTuqO8x.js → SearchMd-BiMpzfAz.js} +1 -1
- package/dist/client/assets/{Sector-DeEfQN_u.js → Sector-DzF1455G.js} +1 -1
- package/dist/client/assets/{ShoppingBag01-CQIeNQm_.js → ShoppingBag01-7AUWsp7V.js} +1 -1
- package/dist/client/assets/{Sun-kLYmwsq0.js → Sun-DZd0pcUv.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-DGImzN1R.js → SwitchHorizontal01-lbkLP1BV.js} +1 -1
- package/dist/client/assets/{Tool01-BRVvW2LV.js → Tool01-BuiUP3wu.js} +1 -1
- package/dist/client/assets/{Trash01-Bt3rK1ka.js → Trash01-CSWWBhZk.js} +1 -1
- package/dist/client/assets/{Upload01-s7SnRMvp.js → Upload01-By8WilO1.js} +1 -1
- package/dist/client/assets/{User01-BmCbB_zb.js → User01-558TF773.js} +1 -1
- package/dist/client/assets/{UserSquare-DL7MdeuL.js → UserSquare-CWSxOMqR.js} +1 -1
- package/dist/client/assets/{Users01-BVggEmV6.js → Users01-gicEePNg.js} +1 -1
- package/dist/client/assets/{XAxis-CDuxbcPP.js → XAxis-qI7p2LLk.js} +1 -1
- package/dist/client/assets/{XClose-UWi3HSZE.js → XClose-BEUDzM_1.js} +1 -1
- package/dist/client/assets/{ZoomOut-B4Rw_R2z.js → ZoomOut-DmspxQ49.js} +1 -1
- package/dist/client/assets/{access-gate-D3L-T38D.js → access-gate-bpdPmASp.js} +1 -1
- package/dist/client/assets/{add-connection-dialog-8k8OTwPv.js → add-connection-dialog-D2-Fevp3.js} +1 -1
- package/dist/client/assets/{agent-analytics-bu3kFNJu.js → agent-analytics-CHLX8Dwa.js} +1 -1
- package/dist/client/assets/agent-app-tzNa-TNJ.js +1 -0
- package/dist/client/assets/{agent-assets-DJjZB71J.js → agent-assets-DWHiQD98.js} +1 -1
- package/dist/client/assets/{agent-automation-5jRP2Yu0.js → agent-automation-DObMz1kl.js} +3 -3
- package/dist/client/assets/{agent-automations-DBSfm1Um.js → agent-automations-DYbb1V-B.js} +1 -1
- package/dist/client/assets/{agent-connect-sources-C1dugrdG.js → agent-connect-sources-DebQ4hkB.js} +1 -1
- package/dist/client/assets/agent-deck-BCqe639U.js +1 -0
- package/dist/client/assets/{agent-e2e-PI2OzWvI.js → agent-e2e-BRkJGMbT.js} +1 -1
- package/dist/client/assets/{agent-experiments-DRdlymR5.js → agent-experiments-BjnXROCp.js} +1 -1
- package/dist/client/assets/{agent-file-BzADFUid.js → agent-file-C84-2ZAM.js} +1 -1
- package/dist/client/assets/{agent-hosting-CPH-NeL_.js → agent-hosting-DhdLSA5K.js} +1 -1
- package/dist/client/assets/{agent-icon-Blcoi2NV.js → agent-icon-6qcGzKLI.js} +1 -1
- package/dist/client/assets/agent-library-DNOIKpUu.js +1 -0
- package/dist/client/assets/agent-library-file-DDutw3lu.js +1 -0
- package/dist/client/assets/{agent-monitor-PGLXk9dq.js → agent-monitor-OPCmresQ.js} +1 -1
- package/dist/client/assets/{agent-overview-D278LRIL.js → agent-overview-DhpnVP3O.js} +1 -1
- package/dist/client/assets/{agent-releases-CwPpC6Zn.js → agent-releases-D99QXu6E.js} +1 -1
- package/dist/client/assets/agent-settings-fdQZXBGW.js +1 -0
- package/dist/client/assets/{agent-site-editor-BSI5T3i7.js → agent-site-editor-MPorMBYa.js} +1 -1
- package/dist/client/assets/agent-site-editor-code-Bh5LoZTU.js +2 -0
- package/dist/client/assets/agent-site-editor-content-D8dj4Hmz.js +1 -0
- package/dist/client/assets/agent-site-editor-preview-DQYY8I7P.js +1 -0
- package/dist/client/assets/agent-view-DmLNs6HS.js +1 -0
- package/dist/client/assets/{agent-view-guard-CVWBSVAR.js → agent-view-guard-f1rPRUHJ.js} +1 -1
- package/dist/client/assets/{agents-list-DYmELJk-.js → agents-list-CkAblqIe.js} +1 -1
- package/dist/client/assets/{ai-providers-B3x7urKU.js → ai-providers-BooBUwjF.js} +1 -1
- package/dist/client/assets/{alert-Dp8EatFO.js → alert-ClPly-6t.js} +1 -1
- package/dist/client/assets/{alert-dialog-qlQC4zlU.js → alert-dialog-B2X6GVxf.js} +1 -1
- package/dist/client/assets/{analytics-sections-BirEZrZQ.js → analytics-sections-CqsADfEb.js} +1 -1
- package/dist/client/assets/{api-keys-7UDmxa_w.js → api-keys-C7BCKoXO.js} +1 -1
- package/dist/client/assets/api-keys-CINFl9fA.js +1 -0
- package/dist/client/assets/{app-editor-tLSj0Sjg.js → app-editor-Cd1AaZAP.js} +1 -1
- package/dist/client/assets/{asset-utils-DYZVbDw1.js → asset-utils-PpGBHp7S.js} +1 -1
- package/dist/client/assets/{auth-CLglKqB6.js → auth-CDMxJjZ_.js} +1 -1
- package/dist/client/assets/{auth-catchall-CrJHPLPw.js → auth-catchall-CZDje7WE.js} +1 -1
- package/dist/client/assets/{auth-entry-CD3L2RvS.js → auth-entry-D9r_9K3P.js} +1 -1
- package/dist/client/assets/{auth-split-layout-UjhzYVxM.js → auth-split-layout-oUo4Hk_G.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-ClVBgGv4.js → authenticate-and-persist-oauth-BeZlu0Nl.js} +1 -1
- package/dist/client/assets/{automation-list-row-CAEPQbgy.js → automation-list-row-DWfHs1ka.js} +1 -1
- package/dist/client/assets/{automation-runs-dUM-MaiP.js → automation-runs-DYFrers-.js} +1 -1
- package/dist/client/assets/{automations-megKF7It.js → automations-Dv14tuP7.js} +1 -1
- package/dist/client/assets/{autosend-CE_yiNtR.js → autosend-Bh9N6QTP.js} +1 -1
- package/dist/client/assets/{avatar-B8cS3VPt.js → avatar-DLW_zv2o.js} +1 -1
- package/dist/client/assets/{badge-Qzxf6tet.js → badge-CNOkHFGC.js} +1 -1
- package/dist/client/assets/{block-document-AKpwbifj.js → block-document-BebIohGg.js} +1 -1
- package/dist/client/assets/{blocks-preview-workspace-context-VkiPmc8G.js → blocks-preview-workspace-context-Biv5NAm3.js} +1 -1
- package/dist/client/assets/{blocks-tab-states-BbjL1qhZ.js → blocks-tab-states-BgNWRkH8.js} +3 -3
- package/dist/client/assets/{blog-schema-DL-wxhkE.js → blog-schema-DiNpH4vZ.js} +1 -1
- package/dist/client/assets/{board-analytics-C1pwywOy.js → board-analytics-BaTYwWrV.js} +1 -1
- package/dist/client/assets/{buckets-DZKIT9DY.js → buckets-DE3qVy9B.js} +1 -1
- package/dist/client/assets/{build-improve-prompt-doc-1VLAf1m8.js → build-improve-prompt-doc-BvSYvw5x.js} +1 -1
- package/dist/client/assets/{calendar-BuSRVV5D.js → calendar-BTqmD5cp.js} +1 -1
- package/dist/client/assets/{capability-load-error-DBmMi5Hs.js → capability-load-error-2YdYn89j.js} +1 -1
- package/dist/client/assets/{category-editor-DVRF9hj1.js → category-editor-Cgt25XK9.js} +1 -1
- package/dist/client/assets/{chart-NrDAd4pe.js → chart-DjCzbQW1.js} +1 -1
- package/dist/client/assets/{chat-context-Ch-VpD9W.js → chat-context-Ccuwf3qi.js} +1 -1
- package/dist/client/assets/{chat-draft-B2p2B6Yw.js → chat-draft-DHvm4xVB.js} +1 -1
- package/dist/client/assets/{checkbox-C0-Eo7G1.js → checkbox-Cniz6XYs.js} +1 -1
- package/dist/client/assets/{choose-editor-BeLyDWVx.js → choose-editor-CV0_JmWA.js} +1 -1
- package/dist/client/assets/{cli-auth-success-DUKgfRgt.js → cli-auth-success-BMxtnAHr.js} +1 -1
- package/dist/client/assets/{client-icons-DtQhx8-x.js → client-icons-B-2sMI-E.js} +1 -1
- package/dist/client/assets/cms-settings-editor-B8EnFyLX.js +1 -0
- package/dist/client/assets/{collapsible-EpmgpNpi.js → collapsible-0KvGZBpu.js} +1 -1
- package/dist/client/assets/{collection-detail-BTHodnm7.js → collection-detail-93nG2ose.js} +1 -1
- package/dist/client/assets/{collection-display-button-__Pm6Nmn.js → collection-display-button-C_VxQwWc.js} +1 -1
- package/dist/client/assets/{collection-search-ehqGBK_4.js → collection-search-D-0zgzsL.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BBPmRt9r.js → collection-table-wrapper-DPIsyB6U.js} +1 -1
- package/dist/client/assets/{collection-tabs-iTmpvLeT.js → collection-tabs-BY3qzlzd.js} +1 -1
- package/dist/client/assets/{column-rules-adUN8XvK.js → column-rules-DeMbpPyG.js} +1 -1
- package/dist/client/assets/{combobox-BUo7EBrO.js → combobox-DihCFI-U.js} +1 -1
- package/dist/client/assets/{command-BAgcQ2fh.js → command-CAjgUN60.js} +1 -1
- package/dist/client/assets/{companion-mcps-section-CAn17bJY.js → companion-mcps-section-B5j1olGB.js} +1 -1
- package/dist/client/assets/{config-BDu66MgM.js → config-ChuL84XS.js} +1 -1
- package/dist/client/assets/{connect-2yc9-JJp.js → connect-D60mJT6h.js} +2 -2
- package/dist/client/assets/{connect-layout-DtIoh422.js → connect-layout-YDysA7af.js} +1 -1
- package/dist/client/assets/{connection-B8e9uIdy.js → connection-DD0hCw09.js} +1 -1
- package/dist/client/assets/{connection-card-CLVSIR42.js → connection-card-CyrhBBJS.js} +1 -1
- package/dist/client/assets/{connection-detail-DN36Ozvh.js → connection-detail-DhwlKLOJ.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-CSZF_TQx.js → connection-form-helpers-BEx47naA.js} +1 -1
- package/dist/client/assets/{connections-DC5XESZs.js → connections-CZn8bCAP.js} +1 -1
- package/dist/client/assets/{content-tab-DUe9Pk3L.js → content-tab-DshitHzC.js} +3 -3
- package/dist/client/assets/{context-DdNfBAMU.js → context-D0Ph-RBZ.js} +1 -1
- package/dist/client/assets/{context-menu-DJ87apJ2.js → context-menu-DaGblEhL.js} +1 -1
- package/dist/client/assets/{core.esm-C7s0VVJH.js → core.esm-BlIrt00V.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-DoF61er3.js → create-organization-dialog-ee9_Fve8.js} +1 -1
- package/dist/client/assets/{daily-pulse-C775e_y-.js → daily-pulse-CsWzX1Ru.js} +1 -1
- package/dist/client/assets/{discover-C_Que9Au.js → discover-C9CAEVb4.js} +1 -1
- package/dist/client/assets/{domain-settings-CT-S0BOV.js → domain-settings-CJaRsZyt.js} +1 -1
- package/dist/client/assets/{drawer-CixpU7n-.js → drawer-BxIrQZqO.js} +1 -1
- package/dist/client/assets/{editor-BKRP2Iwc.js → editor-C0Y6NYE-.js} +1 -1
- package/dist/client/assets/{editor-classes-DZByr-lI.js → editor-classes-Bd7RVaJi.js} +1 -1
- package/dist/client/assets/{empty-state-DQLm0d5k.js → empty-state-Bv2fyayR.js} +1 -1
- package/dist/client/assets/{empty-state-BZZcWHI_.js → empty-state-CeH8S3Yb.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DJs0gTBx.js → extract-connection-data-CVxXe6TN.js} +1 -1
- package/dist/client/assets/{feature-gate-CgRSy5_Q.js → feature-gate-BiCs7UB2.js} +1 -1
- package/dist/client/assets/{feature-paywall-EueGiC9A.js → feature-paywall-Bg9evHOs.js} +1 -1
- package/dist/client/assets/{file-explorer-cu0ZoZ2i.js → file-explorer-DBjksoe3.js} +1 -1
- package/dist/client/assets/{file-preview-BJ_PkL7X.js → file-preview-ohLcWFR0.js} +1 -1
- package/dist/client/assets/{file-share-button-rEinR-qh.js → file-share-button-Cj6Po3M3.js} +2 -2
- package/dist/client/assets/{file-type-icon-C2JXE2hG.js → file-type-icon-Dxw9T3ag.js} +1 -1
- package/dist/client/assets/flat-project-NwcrmxWG.js +1 -0
- package/dist/client/assets/{folder-icon-Cayf6XFB.js → folder-icon-CTDuIMqX.js} +1 -1
- package/dist/client/assets/{form-BivWj0r6.js → form-Db6N6TDa.js} +1 -1
- package/dist/client/assets/{general-BQtDTtDD.js → general-Cgs5w9co.js} +1 -1
- package/dist/client/assets/{home-DncG44Vc.js → home-CeX3Z1XE.js} +1 -1
- package/dist/client/assets/{hosted-publish-feedback-CfrjUALv.js → hosted-publish-feedback-JXcVEfrI.js} +1 -1
- package/dist/client/assets/{icon-button-DxqkkLQj.js → icon-button-WQQroCBK.js} +1 -1
- package/dist/client/assets/{index-C-gf76Hu.js → index--5hJacOk.js} +1 -1
- package/dist/client/assets/{index-C47EvNjt.js → index-BGYDBFHU.js} +1 -1
- package/dist/client/assets/{index-xlh3U8dq.js → index-BRCFiPag.js} +1 -1
- package/dist/client/assets/{index-5vR8G6oj.js → index-BdfVBfZr.js} +1 -1
- package/dist/client/assets/{index-BYmaAL9a.js → index-BtVJvkKj.js} +1 -1
- package/dist/client/assets/{index-BtcVoJOD.js → index-Bw0JSfbm.js} +1 -1
- package/dist/client/assets/{index-B26ImUL7.js → index-CE8cdWnC.js} +1 -1
- package/dist/client/assets/{index-CvK4-KP3.js → index-D8O82DD7.js} +14 -14
- package/dist/client/assets/{index-NRMbjvM1.js → index-DCkpKmlr.js} +1 -1
- package/dist/client/assets/index-DdxfBS9Y.js +1 -0
- package/dist/client/assets/{index-BF64aC--.js → index-LAQehZep.js} +1 -1
- package/dist/client/assets/{index-BvuLMeCw.js → index-XGgg6Ukt.js} +3 -3
- package/dist/client/assets/{index-DV6FL3mH.js → index-mJxHbuG8.js} +1 -1
- package/dist/client/assets/{index-TD9q6ZAx.js → index-p-1akJlT.js} +30 -30
- package/dist/client/assets/{index-redirect-CCsqcmui.js → index-redirect-ClvH8pll.js} +1 -1
- package/dist/client/assets/{index-CZciUUmu.js → index-tu8iygVP.js} +2 -2
- package/dist/client/assets/{infiniteQueryObserver-X8qh_Va6.js → infiniteQueryObserver-LkWhFNmL.js} +1 -1
- package/dist/client/assets/{infra-billing-fufjpAYz.js → infra-billing-BXK-vKKS.js} +1 -1
- package/dist/client/assets/input-BwdVmY-Z.js +1 -0
- package/dist/client/assets/{input-BSUErVvJ.js → input-DZSN2_kg.js} +4 -4
- package/dist/client/assets/{integration-icon-DJtlg_0w.js → integration-icon-BfiQkuuA.js} +1 -1
- package/dist/client/assets/{jira-icon-D0XL00z9.js → jira-icon-D82mcgHX.js} +1 -1
- package/dist/client/assets/{label-B-SEr3Fs.js → label-D1700VqO.js} +1 -1
- package/dist/client/assets/{layout-BI2BIstR.js → layout-CmiJ0weC.js} +1 -1
- package/dist/client/assets/legacy-agents-deep-BBEazmY_.js +1 -0
- package/dist/client/assets/{legacy-main-redirect-D6tF7agn.js → legacy-main-redirect-DX4_1VIr.js} +1 -1
- package/dist/client/assets/library-CaFuwk0-.js +1 -0
- package/dist/client/assets/{library-tab-BZkqrpuT.js → library-tab-U68AV6c3.js} +1 -1
- package/dist/client/assets/{login-C9lgbiSh.js → login-J_4Re9C6.js} +1 -1
- package/dist/client/assets/{markdown-B-jDeUMA.js → markdown-yum68Wep.js} +1 -1
- package/dist/client/assets/{mcp-app-renderer-Bk4hyaxU.js → mcp-app-renderer-CjApEMHO.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CaxV9wcl.js → mcp-oauth-DyD71bgf.js} +1 -1
- package/dist/client/assets/{mcp-oauth-V-o-AEQP.js → mcp-oauth-i6-iEEVI.js} +1 -1
- package/dist/client/assets/{members-BLeFrNm9.js → members-C394WPAn.js} +1 -1
- package/dist/client/assets/{memory-BsNDNxr2.js → memory-JQY8gvE2.js} +1 -1
- package/dist/client/assets/{mini-report-page-B0fqOWnH.js → mini-report-page-xHazX5G_.js} +1 -1
- package/dist/client/assets/{mock-board-BFTY4RvG.js → mock-board-TN4Nq-YY.js} +1 -1
- package/dist/client/assets/{monaco-editor-D49CJi8U.js → monaco-editor-BZbJgxOV.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-BB3CDHWN.js → monitoring-stats-row-DAZum_Qb.js} +1 -1
- package/dist/client/assets/{multi-select-BvMK4932.js → multi-select-JpvMfiVw.js} +1 -1
- package/dist/client/assets/{mustache-HTehKKTG.js → mustache-Bt-JW5rB.js} +1 -1
- package/dist/client/assets/{new-project-dialog-DoLb5YVK.js → new-project-dialog-C0rIX_XO.js} +1 -1
- package/dist/client/assets/{oauth-callback-Blwmfj1R.js → oauth-callback-C5XzBraz.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-Dc9onjjw.js → oauth-callback-ai-provider-DcG85B23.js} +1 -1
- package/dist/client/assets/{onboarding-K-cgEcDl.js → onboarding-DW4LAZLj.js} +1 -1
- package/dist/client/assets/{openai-conversation-R6WmtJ5r.js → openai-conversation-B_n_Z1ww.js} +1 -1
- package/dist/client/assets/{optimistic-project-sidebar-views-Bmh9CacI.js → optimistic-project-sidebar-views-0ZawMDqn.js} +1 -1
- package/dist/client/assets/{order-monitor-day-CZfhLaiW.js → order-monitor-day-dqFhfYqs.js} +1 -1
- package/dist/client/assets/{organization-choice-dC-onaYV.js → organization-choice-B8th9GDj.js} +1 -1
- package/dist/client/assets/{orgs-BOJwmOLw.js → orgs-DxYMf8VM.js} +1 -1
- package/dist/client/assets/{page-seo-form-CrsEBL3M.js → page-seo-form-Dkd11mxM.js} +1 -1
- package/dist/client/assets/{pair-CYYi6JKh.js → pair-CdvXgzho.js} +1 -1
- package/dist/client/assets/{plan-ladder-Okx-KzN5.js → plan-ladder-tDE3yVKX.js} +1 -1
- package/dist/client/assets/{popover-gJO3R5Ii.js → popover-Cb6oJHii.js} +1 -1
- package/dist/client/assets/{post-calendar-BgDWtRgx.js → post-calendar-CC5kL8Uu.js} +1 -1
- package/dist/client/assets/{post-editor-CxINLeRV.js → post-editor-AQrMiPgh.js} +1 -1
- package/dist/client/assets/{preview-content-Cfi8bwXI.js → preview-content-BUvb2joL.js} +1 -1
- package/dist/client/assets/{preview-dialog-jZ9sRQON.js → preview-dialog-C3L3Hf_k.js} +1 -1
- package/dist/client/assets/{preview-panel-CN8PRsYc.js → preview-panel-D-BuFBy0.js} +1 -1
- package/dist/client/assets/{preview-tab-DRuTgCNI.js → preview-tab-LnJANPnP.js} +3 -3
- package/dist/client/assets/{product-picker-dialog-DB4JPBCA.js → product-picker-dialog-nfttqvPX.js} +1 -1
- package/dist/client/assets/{profile-DEiIcjHZ.js → profile-BkI92qNB.js} +1 -1
- package/dist/client/assets/{project-app-view-Ml2wH3iy.js → project-app-view-CN3iYy1I.js} +1 -1
- package/dist/client/assets/{project-feed-CfssvHDQ.js → project-feed-BK-cIWDp.js} +1 -1
- package/dist/client/assets/{project-icon-BlJz5cOI.js → project-icon-F3J_yQ0q.js} +1 -1
- package/dist/client/assets/project-reports-DgyjcFph.js +1 -0
- package/dist/client/assets/project-tasks-CmYcTX9M.js +1 -0
- package/dist/client/assets/{projects-empty-state-BDYeDrMv.js → projects-empty-state-C0yTvrcV.js} +1 -1
- package/dist/client/assets/{projects-Dzy3_FXd.js → projects-t0-Z9tsc.js} +1 -1
- package/dist/client/assets/{prompts-DV4Kjfa5.js → prompts-MYwpW0Lg.js} +1 -1
- package/dist/client/assets/record-editor-CBoC3ga-.js +1 -0
- package/dist/client/assets/{redirect-editor-DFCv83sL.js → redirect-editor-CGtccN6N.js} +1 -1
- package/dist/client/assets/reports-4V9HF3Ys.js +1 -0
- package/dist/client/assets/{reports-DXYrq_BO.js → reports-kTfamDed.js} +1 -1
- package/dist/client/assets/{reports-onboarding-1VulbTO6.js → reports-onboarding-RuKhb80u.js} +1 -1
- package/dist/client/assets/{reports-tab-DmNt_T04.js → reports-tab-C31tcj9A.js} +2 -2
- package/dist/client/assets/{repositories-D6jC23CW.js → repositories-bY6iYAdw.js} +1 -1
- package/dist/client/assets/repository-binding-CrTJC4PH.js +1 -0
- package/dist/client/assets/{repository-import-picker-h-r8nnEf.js → repository-import-picker-DC6F2OwG.js} +1 -1
- package/dist/client/assets/{repository-picker-FTAXO4Nx.js → repository-picker-Bo-zD5oc.js} +1 -1
- package/dist/client/assets/{require-capability-BewAou1A.js → require-capability-eym-U6A2.js} +1 -1
- package/dist/client/assets/{required-auth-layout-gIZfj42y.js → required-auth-layout-B5cH35q0.js} +1 -1
- package/dist/client/assets/{reset-password-Bq09blPf.js → reset-password-DQCEjF6G.js} +1 -1
- package/dist/client/assets/{resizable-CGzf0YCQ.js → resizable-BNDCWJ7j.js} +1 -1
- package/dist/client/assets/{resolve-tab-icon-Daxo01Gi.js → resolve-tab-icon-DNW-g7NS.js} +1 -1
- package/dist/client/assets/{review-settings-DR_kj-Ru.js → review-settings-BvwWcj_E.js} +1 -1
- package/dist/client/assets/{roles-DWOkvlO_.js → roles-BjOwGYNe.js} +1 -1
- package/dist/client/assets/route-Cumdkp6N.js +1 -0
- package/dist/client/assets/{route-B-p6J_u6.js → route-DdQnn3q9.js} +1 -1
- package/dist/client/assets/route-Nd3qdGiT.js +1 -0
- package/dist/client/assets/{sandbox-lifecycle-context-rc29IhVV.js → sandbox-lifecycle-context-LiaBB_6I.js} +1 -1
- package/dist/client/assets/{schema-BGirdKR7.js → schema-EWHGi9mE.js} +1 -1
- package/dist/client/assets/{schema-DTvMW5Bj.js → schema-nZYp8MHf.js} +1 -1
- package/dist/client/assets/{scroll-area-D0jo1bkt.js → scroll-area-mUNQ_2-E.js} +1 -1
- package/dist/client/assets/{search-input-DIOUBltI.js → search-input-DmONJsTJ.js} +1 -1
- package/dist/client/assets/{search-toggle-BWyMsPKk.js → search-toggle-CDUbsFv3.js} +1 -1
- package/dist/client/assets/{secret-ciphertext-ANOQlePB.js → secret-ciphertext-LIZTOM-t.js} +1 -1
- package/dist/client/assets/{secret-picker--4BFyqbe.js → secret-picker-Dtf5aH-D.js} +1 -1
- package/dist/client/assets/{secrets-BxBi0DW0.js → secrets-BcM5O7u3.js} +1 -1
- package/dist/client/assets/{sections-editor-cLAvYqLX.js → sections-editor-CQG2qvyW.js} +2 -2
- package/dist/client/assets/{select-vip2MDSn.js → select-jUuHkfjB.js} +1 -1
- package/dist/client/assets/{select-model-Dqb1K6bc.js → select-model-dvdCc609.js} +1 -1
- package/dist/client/assets/{seo-editor-DDZSfwYW.js → seo-editor-Dx3q24BD.js} +1 -1
- package/dist/client/assets/{separator-BQ3AM4Ug.js → separator-CHyWK0Qn.js} +1 -1
- package/dist/client/assets/settings-tab-BtQzOYK6.js +4 -0
- package/dist/client/assets/{sheet-IYrYpc2B.js → sheet-DMEBFfdP.js} +1 -1
- package/dist/client/assets/{shell-layout-BM51_FIv.js → shell-layout-DA1U2kkD.js} +1 -1
- package/dist/client/assets/site-editor-DRIpZazl.js +1 -0
- package/dist/client/assets/{site-editor-toast-DbJhMk7V.js → site-editor-toast-DpTt5s80.js} +1 -1
- package/dist/client/assets/{skills-D2FiXzGW.js → skills-DQF-uSzE.js} +1 -1
- package/dist/client/assets/{slider-CwnL3HRa.js → slider-zbUWyrgS.js} +1 -1
- package/dist/client/assets/{sortable.esm-BmwNKHYn.js → sortable.esm-BSVJlRZf.js} +1 -1
- package/dist/client/assets/{sso-DMQ-B__P.js → sso-D91zcNn9.js} +1 -1
- package/dist/client/assets/{suggestion-B_X9vnmO.js → suggestion-DBa1TtKe.js} +1 -1
- package/dist/client/assets/{switch-B9eCMptF.js → switch-D5BJVOIP.js} +1 -1
- package/dist/client/assets/{symbol-BnsdD8oy.js → symbol-BNQRzFZG.js} +1 -1
- package/dist/client/assets/{synced-repos-VO9uiFX2.js → synced-repos-DbzzsO4o.js} +1 -1
- package/dist/client/assets/{tab-icon-glyph-D53P8msf.js → tab-icon-glyph-DSbT5Juj.js} +1 -1
- package/dist/client/assets/{table-D9fzXIkZ.js → table-BxCPcPbb.js} +1 -1
- package/dist/client/assets/{tabs-BawejvDB.js → tabs-DG-0hqxq.js} +1 -1
- package/dist/client/assets/{task-board-ouLvp423.js → task-board-qH-zSxS3.js} +1 -1
- package/dist/client/assets/{task-route-CjHIKjev.js → task-route-DQ-RXVcD.js} +1 -1
- package/dist/client/assets/{task-status-Buh7B1MG.js → task-status-BdHKicFV.js} +1 -1
- package/dist/client/assets/taskboard-analytics-BPqcdFgc.js +1 -0
- package/dist/client/assets/{tasks-FmvKs9d3.js → tasks-7BmccsLt.js} +3 -3
- package/dist/client/assets/tasks-CoDEIHpe.js +1 -0
- package/dist/client/assets/{textarea-B-TS083j.js → textarea-CQEBFigV.js} +1 -1
- package/dist/client/assets/{thread-analytics-ykgOvgFb.js → thread-analytics-D6QACDju.js} +1 -1
- package/dist/client/assets/{thread-intent-S-gJClOG.js → thread-intent-LfHRYRWC.js} +1 -1
- package/dist/client/assets/{thread-route-DtCL8-V4.js → thread-route-BIvY3iy0.js} +1 -1
- package/dist/client/assets/{thread-route-CQmCTEyn.js → thread-route-DPF9Q-Zg.js} +1 -1
- package/dist/client/assets/{thread-sheet-body-DacE2e8a.js → thread-sheet-body-BLMeXbLM.js} +1 -1
- package/dist/client/assets/{time-range-picker-BIBoZiWJ.js → time-range-picker--BYX_87N.js} +1 -1
- package/dist/client/assets/{toggle-group-DI4ttUmk.js → toggle-group-BEVDihe8.js} +1 -1
- package/dist/client/assets/{tool-namespace-DSuLhjHC.js → tool-namespace-Dcr66XbC.js} +1 -1
- package/dist/client/assets/{toolbar-icon-button-UylaJSAo.js → toolbar-icon-button-DXJ1vH5Z.js} +1 -1
- package/dist/client/assets/{tooltip-D3Lno7Sd.js → tooltip-OxzEYyq8.js} +1 -1
- package/dist/client/assets/{tooltipContext-BF4YYYQ4.js → tooltipContext-F_F397K5.js} +1 -1
- package/dist/client/assets/{track-9gnPqqM1.js → track-BzNFS1Wu.js} +1 -1
- package/dist/client/assets/{types-oDc7dHni.js → types-2GaxflNM.js} +1 -1
- package/dist/client/assets/{url-slug-CzRjxv-k.js → url-slug-DIeHU92G.js} +1 -1
- package/dist/client/assets/{usage-stats-DadTD3M-.js → usage-stats-7JI4qqsk.js} +1 -1
- package/dist/client/assets/{use-ai-providers-AcvGe9-V.js → use-ai-providers-Gj0qAd5n.js} +1 -1
- package/dist/client/assets/{use-app-takeover-BEzFC8oO.js → use-app-takeover-bhFW4jjZ.js} +1 -1
- package/dist/client/assets/{use-automations-CN350YMB.js → use-automations-CHxa5Awm.js} +1 -1
- package/dist/client/assets/{use-autosave-Dav7fRBX.js → use-autosave-Cg3HXp8E.js} +1 -1
- package/dist/client/assets/{use-chat-navigation-DlxbS2Ir.js → use-chat-navigation-Bsf8Ofz7.js} +1 -1
- package/dist/client/assets/{use-clock-tick-Biiz8lzy.js → use-clock-tick-CZTHUR3c.js} +1 -1
- package/dist/client/assets/{use-connect-companion-VKAyFcK2.js → use-connect-companion-BdQpJxNA.js} +1 -1
- package/dist/client/assets/{use-connection-OOD0tHd7.js → use-connection-DJY11N6-.js} +1 -1
- package/dist/client/assets/{use-content-sync-BQvWp4_o.js → use-content-sync--SRRJ-Mw.js} +1 -1
- package/dist/client/assets/{use-copy-Cn4Z57YH.js → use-copy-CCruuyq5.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-CZW2rCq7.js → use-create-virtual-mcp-xZ1qTsxw.js} +1 -1
- package/dist/client/assets/{use-date-fns-locale-ZV1qLyjT.js → use-date-fns-locale-BdVPe2o0.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-DoWWmWzG.js → use-debounced-autosave-B72Pttro.js} +1 -1
- package/dist/client/assets/{use-debounced-value-WEbEbeed.js → use-debounced-value-Ci8g1xZm.js} +1 -1
- package/dist/client/assets/{use-deco-credits-D1idFaA8.js → use-deco-credits-CYX05LPq.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-BITSrHb-.js → use-decopilot-events-Y_bEM1qx.js} +1 -1
- package/dist/client/assets/{use-delete-connection-KMdMK-5V.js → use-delete-connection-BpaP2GE0.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-B_soKFRv.js → use-deployment-admin-CXE8V2Rr.js} +1 -1
- package/dist/client/assets/{use-ensure-project-folder-BUN6VVAV.js → use-ensure-project-folder-1ZUF1juP.js} +1 -1
- package/dist/client/assets/{use-fast-preview-draft-url-CSXqCUZ_.js → use-fast-preview-draft-url-RKLJh4cF.js} +1 -1
- package/dist/client/assets/{use-file-configs-DMVCBG-z.js → use-file-configs-CaudfVHS.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-DjYaDj_j.js → use-infinite-scroll-BzeoWUs-.js} +1 -1
- package/dist/client/assets/{use-join-requests-Be-FCByX.js → use-join-requests-B0Lb4Xld.js} +1 -1
- package/dist/client/assets/{use-main-panel-tabs-Cloon3zW.js → use-main-panel-tabs-CpKxJuHK.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-Bv4IbKQl.js → use-mcp-auth-status-CD5U_xkB.js} +1 -1
- package/dist/client/assets/{use-mcp-client-fTyLcuiX.js → use-mcp-client-TpYhnmjl.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-CyqOUVUD.js → use-mcp-prompts-CpmfoZzy.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-sv7pv5ex.js → use-mcp-tools-BihOJhwY.js} +1 -1
- package/dist/client/assets/{use-members-CvY21L2Q.js → use-members-qFBNBM3N.js} +1 -1
- package/dist/client/assets/{use-mobile-2T0aye5I.js → use-mobile-vYE2HB1P.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-BpeT4fqu.js → use-navigate-to-agent-p0i1D6nD.js} +1 -1
- package/dist/client/assets/{use-open-billing-url-Db0e3guK.js → use-open-billing-url-D_QihQeB.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-CWA2hWCM.js → use-org-auth-client-Fk6ICmBW.js} +1 -1
- package/dist/client/assets/{use-org-fs-CPNJqv-N.js → use-org-fs-CAd5ZqC2.js} +1 -1
- package/dist/client/assets/{use-org-repo-syncs-MWiNxGjz.js → use-org-repo-syncs-CQBUzeD0.js} +1 -1
- package/dist/client/assets/{use-org-sso-BMLNRQyf.js → use-org-sso-BfZer93d.js} +1 -1
- package/dist/client/assets/{use-organization-roles-DwFJmstu.js → use-organization-roles-Dg8DgOVo.js} +1 -1
- package/dist/client/assets/{use-organization-settings-lug340cj.js → use-organization-settings-BFBW8RTu.js} +1 -1
- package/dist/client/assets/{use-panel-navigate-CfJ9Qf-l.js → use-panel-navigate-Cz7L1teW.js} +1 -1
- package/dist/client/assets/use-project-native-view-presence-Bxsn_JFS.js +1 -0
- package/dist/client/assets/{use-project-scope-C99MQSqi.js → use-project-scope--iaz7oOx.js} +1 -1
- package/dist/client/assets/{use-recent-apps-BumxbfgY.js → use-recent-apps-BlKs22ZO.js} +1 -1
- package/dist/client/assets/{use-releases-CRk_-gGM.js → use-releases-DJ7h8Qee.js} +1 -1
- package/dist/client/assets/{use-reports-diagnostic-WXyHMxuT.js → use-reports-diagnostic-CBZ_dauu.js} +1 -1
- package/dist/client/assets/{use-secrets-nvhTtgV_.js → use-secrets-DS6b7i0g.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-BBIzI-Pc.js → use-section-preview-base-DhPFhZwv.js} +1 -1
- package/dist/client/assets/{use-tags-Dawb8nJP.js → use-tags-BYGeHLbk.js} +1 -1
- package/dist/client/assets/{use-task-board-analytics-BaDTyaMf.js → use-task-board-analytics-kSCSn8a8.js} +1 -1
- package/dist/client/assets/{use-task-board-events-viqZq2i-.js → use-task-board-events-BXbE2HoE.js} +1 -1
- package/dist/client/assets/{use-task-board-item-prs-BTOeRNoi.js → use-task-board-item-prs-BXR3CLsn.js} +1 -1
- package/dist/client/assets/{use-task-board-items-Dp3mGHSl.js → use-task-board-items-Cl2KTjjg.js} +1 -1
- package/dist/client/assets/{use-task-metadata-Buvn0eAk.js → use-task-metadata-CEVJreaj.js} +1 -1
- package/dist/client/assets/{use-thread-analytics-DOC2eb9z.js → use-thread-analytics-DI0UUy4e.js} +1 -1
- package/dist/client/assets/{use-thread-outputs-Bmumw8UE.js → use-thread-outputs-DxXrDY7V.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-v5wivWhC.js +1 -0
- package/dist/client/assets/{useQueries-4Zja_Hbg.js → useQueries-CuK-BS9F.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-BZNUHruQ.js +1 -0
- package/dist/client/assets/{users-Cbsspkn2.js → users-wJGegpez.js} +1 -1
- package/dist/client/assets/{utils-zbsUBoHt.js → utils-Ci3T7CsR.js} +1 -1
- package/dist/client/assets/{variant-calendar-BnIxTRkB.js → variant-calendar-Cjo5vNvc.js} +1 -1
- package/dist/client/assets/{variant-draft-pointer-DEL-ZLWj.js → variant-draft-pointer-CFIC5SMO.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-CGu3ANob.js → view-mode-toggle-CdIfZN7k.js} +1 -1
- package/dist/client/assets/{virtual-mcp-DQFtuDZf.js → virtual-mcp-BJLRloMY.js} +1 -1
- package/dist/client/assets/{watch-sse-pool-C7fmCtIy.js → watch-sse-pool-CTU0zZto.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/server.js +106 -106
- package/package.json +1 -1
- package/dist/client/assets/agent-app-BMA5upH5.js +0 -1
- package/dist/client/assets/agent-deck-BJf1WFap.js +0 -1
- package/dist/client/assets/agent-library-BqFtXY1m.js +0 -1
- package/dist/client/assets/agent-library-file-CQDlY3Yr.js +0 -1
- package/dist/client/assets/agent-settings-DeB5MuX_.js +0 -1
- package/dist/client/assets/agent-site-editor-code-Dq4KRDBk.js +0 -2
- package/dist/client/assets/agent-site-editor-content-Blm2auu-.js +0 -1
- package/dist/client/assets/agent-site-editor-preview-CCk80iIG.js +0 -1
- package/dist/client/assets/agent-view-Cl8uWNJN.js +0 -1
- package/dist/client/assets/api-keys-DSwUfsL4.js +0 -1
- package/dist/client/assets/cms-settings-editor-Dxh-Mvqb.js +0 -1
- package/dist/client/assets/flat-project-fhJMf2Fo.js +0 -1
- package/dist/client/assets/index-BmYzltjg.js +0 -1
- package/dist/client/assets/input-h8042dl0.js +0 -1
- package/dist/client/assets/legacy-agents-deep-jcGaNAHc.js +0 -1
- package/dist/client/assets/library-DntM1dnS.js +0 -1
- package/dist/client/assets/project-reports-CsI0AQuY.js +0 -1
- package/dist/client/assets/project-tasks-DLi14b92.js +0 -1
- package/dist/client/assets/record-editor-wOnCkFPK.js +0 -1
- package/dist/client/assets/reports-AMpsYdUr.js +0 -1
- package/dist/client/assets/repository-binding-BnejFX7t.js +0 -1
- package/dist/client/assets/route-G0-ZvPpf.js +0 -1
- package/dist/client/assets/route-UiPRedfp.js +0 -1
- package/dist/client/assets/settings-tab-eia9Fz-X.js +0 -4
- package/dist/client/assets/site-editor-C5iX5zAy.js +0 -1
- package/dist/client/assets/taskboard-analytics-DhwjY7M5.js +0 -1
- package/dist/client/assets/tasks-Ds4uIhX_.js +0 -1
- package/dist/client/assets/use-project-native-view-presence-DdsfKci4.js +0 -1
- package/dist/client/assets/useInfiniteQuery-CQY9cAw7.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-XqqzZbmr.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as it,b as Ft,r as R,l as ae,j as i,b4 as Li,B as _t,U as sn,aw as $i,X as zi,V as Hi,a as xo,F as Wi,K as yo,m as qi,o as Gi,h as Ui,t as oe}from"./index-TD9q6ZAx.js";import{u as Yi}from"./chat-context-Ch-VpD9W.js";import{a5 as Ji,T as Wn,a6 as Qi,a7 as Xi,a8 as Zi,a9 as ea,aa as ta,ab as na,ac as Br,ad as sa,ae as ra,G as jt,af as wt,ag as ze,ah as oa,H as Fn,E as On,b as ia,j as aa,u as la,ai as Kr,q as ca,aj as ua,s as da,o as fa,ak as So,p as _n,al as ma,am as pa,A as Fr,an as ha,ao as ga,ap as Bn,aq as Or,ar as Lr,as as $r,at as us,au as va,av as xa,F as ya,aw as zr,ax as Sa,ay as Hr,az as Wr,M as ba,aA as qr,a as ja,aB as Sn,aC as wa,aD as _a,aE as bn,aF as ds}from"./blocks-tab-states-BbjL1qhZ.js";import{c as ka}from"./repository-binding-BnejFX7t.js";import{n as Ea,t as Ra}from"./ChevronUp-D4PiHnN0.js";import{a8 as bo,b as zn,an as Aa,D as Ca,a1 as Gr,L as Ur}from"./agent-icon-Blcoi2NV.js";import{S as rn}from"./scroll-area-D0jo1bkt.js";import{c as kt,T as Et,a as Rt}from"./tooltip-D3Lno7Sd.js";import{am as Na,g as Yr,J as Ta,u as Va,K as Da,w as Ma,ab as Pa,x as Ia,d as Pt,f as It,a7 as Ba,ar as Ka}from"./site-editor-toast-DbJhMk7V.js";import{m as Fa,u as Oa,P as La}from"./mustache-HTehKKTG.js";import{az as $a,k as Rs,aB as jo,H as za,aC as xt,aD as vs,aE as wo,aj as Gt,a8 as xs,aF as ys,ak as Kt,a9 as on,q as Ha,t as Wa,g as qa,x as Kn,ar as Ga,ai as jn,aa as fs,ah as Bt,ag as wn,aG as Ua,P as Ya,aH as Ja,al as Jr,a1 as Qr,aI as Qa,aJ as qt,aK as Xa,aL as Za,aM as el,aN as Xr,aO as tl,aP as nl,aQ as sl,af as rl,aR as ol,aS as il,aT as al,aU as ll,ae as cl,aV as ul}from"./secret-ciphertext-ANOQlePB.js";import{a as dl}from"./Copy01-DJEr7OLy.js";import{a as Ss,e as _o}from"./UserSquare-DL7MdeuL.js";import{i as Zr}from"./Tool01-BRVvW2LV.js";import{s as eo}from"./Image01-CyRCJwXT.js";import{s as fl}from"./Plus-DtZhz_pb.js";import{s as ml}from"./Trash01-Bt3rK1ka.js";import{i as bs}from"./ZoomOut-B4Rw_R2z.js";import{u as pl,a as to,K as hl,P as gl,b as vl,C as xl,D as yl,c as Sl}from"./core.esm-C7s0VVJH.js";import{u as bl,s as jl,a as Ln,S as wl,v as _l}from"./sortable.esm-BmwNKHYn.js";import{s as kl,g as El,u as Rl,A as Al}from"./use-section-preview-base-BBIzI-Pc.js";import{A as ms}from"./avatar-B8cS3VPt.js";import{e as Cl,d as no,b as Nl,A as Tl,a as Vl,f as Dl}from"./alert-dialog-qlQC4zlU.js";import{b as Ml}from"./format-time-CAj8AQXM.js";import{d as Pl}from"./shell-layout-BM51_FIv.js";import{u as Il}from"./use-members-CvY21L2Q.js";import{a as Bl,P as so,b as Kl}from"./page-seo-form-CrsEBL3M.js";import{c as ro,d as oo,e as Fl,f as Ol}from"./variant-draft-pointer-DEL-ZLWj.js";import"./use-panel-navigate-CfJ9Qf-l.js";import"./thread-route-DtCL8-V4.js";import"./use-project-scope-C99MQSqi.js";import"./autosend-CE_yiNtR.js";import"./thread-intent-S-gJClOG.js";import"./use-mcp-client-fTyLcuiX.js";import"./auth-CLglKqB6.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-C7fmCtIy.js";import"./task-board-ouLvp423.js";import"./schema-DTvMW5Bj.js";import"./slugify-CEUa2lfQ.js";import"./use-decopilot-events-BITSrHb-.js";import"./use-ai-providers-AcvGe9-V.js";import"./use-chat-navigation-DlxbS2Ir.js";import"./location-BjlyegC2.js";import"./use-organization-settings-lug340cj.js";import"./input-BSUErVvJ.js";import"./usage-stats-DadTD3M-.js";import"./tool-namespace-DSuLhjHC.js";import"./form-BivWj0r6.js";import"./label-B-SEr3Fs.js";import"./utils-CVEq3hMx.js";import"./markdown-B-jDeUMA.js";import"./use-copy-Cn4Z57YH.js";import"./use-mobile-2T0aye5I.js";import"./XClose-UWi3HSZE.js";import"./icon-button-DxqkkLQj.js";import"./file-type-icon-C2JXE2hG.js";import"./chat-draft-B2p2B6Yw.js";import"./LinkBroken01-BU-4AKfc.js";import"./ArrowUp-B_lKPC5O.js";import"./ShoppingBag01-CQIeNQm_.js";import"./Upload01-s7SnRMvp.js";import"./AlertCircle-DZq02EzT.js";import"./select-vip2MDSn.js";import"./index-BdQq_4o_.js";import"./index-B26ImUL7.js";import"./ArrowLeft-C_qdjo3L.js";import"./tabs-BawejvDB.js";import"./use-deco-credits-D1idFaA8.js";import"./toggle-group-DI4ttUmk.js";import"./use-open-billing-url-Db0e3guK.js";import"./index-BF64aC--.js";import"./checkbox-C0-Eo7G1.js";import"./ChevronSelectorVertical-0ysVIDar.js";import"./Key01-DWXRgH6w.js";import"./SearchMd-BQTuqO8x.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-yE6iFgVP.js";import"./popover-gJO3R5Ii.js";import"./drawer-CixpU7n-.js";import"./input-h8042dl0.js";import"./suggestion-B_X9vnmO.js";import"./use-project-native-view-presence-DdsfKci4.js";import"./use-file-configs-DMVCBG-z.js";import"./site-slug-DebpOoQq.js";import"./use-mcp-prompts-CyqOUVUD.js";import"./use-org-fs-CPNJqv-N.js";import"./useInfiniteQuery-CQY9cAw7.js";import"./infiniteQueryObserver-X8qh_Va6.js";import"./Link01-CNb9DW_9.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-EueGiC9A.js";import"./plan-ladder-Okx-KzN5.js";import"./add-connection-dialog-8k8OTwPv.js";import"./collection-search-ehqGBK_4.js";import"./extract-connection-data-DJs0gTBx.js";import"./metadata-D72DunRR.js";import"./connection-B8e9uIdy.js";import"./url-slug-CzRjxv-k.js";import"./connection-card-CLVSIR42.js";import"./connection-slug-CITJ0kGN.js";import"./integration-icon-DJtlg_0w.js";import"./textarea-B-TS083j.js";import"./use-connection-OOD0tHd7.js";import"./schema-BGirdKR7.js";import"./connection-form-helpers-CSZF_TQx.js";import"./authenticate-and-persist-oauth-ClVBgGv4.js";import"./mcp-oauth-V-o-AEQP.js";import"./mcp-oauth-CaxV9wcl.js";import"./collection-tabs-iTmpvLeT.js";import"./badge-Qzxf6tet.js";import"./use-infinite-scroll-DjYaDj_j.js";import"./useSuspenseInfiniteQuery-XqqzZbmr.js";import"./use-task-board-events-viqZq2i-.js";import"./utils-zbsUBoHt.js";import"./Play-ChRMrCTB.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-CYYi6JKh.js";import"./collapsible-EpmgpNpi.js";import"./use-clock-tick-Biiz8lzy.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-Bk4hyaxU.js";import"./types-oDc7dHni.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./sheet-IYrYpc2B.js";import"./use-navigate-to-agent-BpeT4fqu.js";import"./use-thread-outputs-Bmumw8UE.js";import"./switch-B9eCMptF.js";import"./command-BAgcQ2fh.js";import"./index-C-gf76Hu.js";import"./monaco-editor-D49CJi8U.js";import"./editor-BKRP2Iwc.js";import"./calendar-BuSRVV5D.js";import"./SwitchHorizontal01-DGImzN1R.js";import"./editor-classes-DZByr-lI.js";import"./view-mode-toggle-CGu3ANob.js";import"./combobox-BUo7EBrO.js";import"./DotsVertical-CV1b1y4C.js";import"./search-input-DIOUBltI.js";import"./use-debounced-value-WEbEbeed.js";import"./asset-utils-DYZVbDw1.js";import"./sandbox-git-api-CRxdlhrN.js";import"./sandbox-url-D3mC8qhT.js";import"./empty-state-BZZcWHI_.js";import"./Building02-LYkR_QXB.js";import"./CheckCircle-B9QHilAa.js";import"./CreditCard01-b36fqa11.js";import"./Globe04-DKUCyty7.js";import"./Sun-kLYmwsq0.js";import"./User01-BmCbB_zb.js";import"./Users01-BVggEmV6.js";import"./index-BYmaAL9a.js";import"./alert-Dp8EatFO.js";import"./section-preview-url-7zfngvgW.js";import"./differenceInSeconds-C3x8sHUj.js";import"./project-icon-BlJz5cOI.js";import"./new-project-dialog-DoLb5YVK.js";import"./repository-import-picker-h-r8nnEf.js";import"./repository-picker-FTAXO4Nx.js";import"./required-auth-layout-gIZfj42y.js";import"./use-org-sso-BMLNRQyf.js";import"./use-org-auth-client-CWA2hWCM.js";const Ll={escape:Ji};function $l(n,e){for(const s of kl(n,e)){const o=typeof s.title=="string"?s.title:void 0;if(o?.includes("{{"))return o}}function zl(n,e){if(!e)return;const s=$a(n);if(s)try{const o=$l(s.resolveType,e);return o&&Fa.render(o,s.data,{},Ll).trim()||void 0}catch{return}}function Hl(n){const e=it.c(13),{icon:s,label:o,className:a}=n;let u;e[0]!==a?(u=ae("size-3.5",a),e[0]=a,e[1]=u):u=e[1];let h;e[2]!==s||e[3]!==u?(h=i.jsx(s,{className:u}),e[2]=s,e[3]=u,e[4]=h):h=e[4];let d;e[5]!==o||e[6]!==h?(d=i.jsx(Et,{asChild:!0,children:i.jsx("span",{role:"img","aria-label":o,className:"shrink-0 cursor-help",children:h})}),e[5]=o,e[6]=h,e[7]=d):d=e[7];let v;e[8]!==o?(v=i.jsx(Rt,{className:"max-w-56",children:o}),e[8]=o,e[9]=v):v=e[9];let m;return e[10]!==d||e[11]!==v?(m=i.jsxs(kt,{children:[d,v]}),e[10]=d,e[11]=v,e[12]=m):m=e[12],m}const Wl="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function io(n){return Array.from({length:n},(e,s)=>({id:crypto.randomUUID(),index:s}))}function ko(n){return n.map((e,s)=>({...e,index:s}))}function ql(n,e){if(e===n.length)return n;if(e<n.length)return ko(n.slice(0,e));const s=Array.from({length:e-n.length},(o,a)=>({id:crypto.randomUUID(),index:n.length+a}));return[...n,...s]}function Eo(n){const e=it.c(44),{section:s,raw:o,meta:a,decofile:u}=n,h=Ft(),d=Wn(),v=s.isSavedBlock===!0,m=s.isMultivariate===!0;let j;e[0]!==a||e[1]!==o?(j=o&&a?El(o,a):void 0,e[0]=a,e[1]=o,e[2]=j):j=e[2];const A=j;let $;e[3]!==a||e[4]!==m||e[5]!==o||e[6]!==v?($=o&&a&&!v&&!m?zl(o,a):void 0,e[3]=a,e[4]=m,e[5]=o,e[6]=v,e[7]=$):$=e[7];const z=$;let H;e[8]!==u||e[9]!==a||e[10]!==o||e[11]!==s?(H=na(o,s,u,a),e[8]=u,e[9]=a,e[10]=o,e[11]=s,e[12]=H):H=e[12];const F=H;let f;e[13]!==m||e[14]!==o?.__resolveType?(f=!m&&Rs(o?.__resolveType??""),e[13]=m,e[14]=o?.__resolveType,e[15]=f):f=e[15];const k=f,X=v?zn:m?bo:_o;let w;e[16]!==m||e[17]!==v?(w=v?{color:za}:m?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=m,e[17]=v,e[18]=w):w=e[18];const I=w;let V;e[19]!==X||e[20]!==d?(V=d?i.jsxs("span",{className:"relative size-4 shrink-0",children:[i.jsx(X,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),i.jsx(ra,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):i.jsx(Aa,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=X,e[20]=d,e[21]=V):V=e[21];let y;e[22]!==A?(y=A&&i.jsx("img",{src:A,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=A,e[23]=y):y=e[23];let C;e[24]!==d||e[25]!==I?(C=!d&&i.jsx(Ss,{className:"h-4 w-4 shrink-0",style:I}),e[24]=d,e[25]=I,e[26]=C):C=e[26];const x=d?"shrink":"flex-1",Y=s.isHidden&&"line-through opacity-50";let M;e[27]!==Y||e[28]!==x?(M=ae("min-w-0 truncate text-sm font-medium",x,Y),e[27]=Y,e[28]=x,e[29]=M):M=e[29];const ge=z??s.label;let me;e[30]!==M||e[31]!==ge?(me=i.jsx("span",{className:M,children:ge}),e[30]=M,e[31]=ge,e[32]=me):me=e[32];let le;e[33]!==k||e[34]!==d||e[35]!==F||e[36]!==h?(le=d?i.jsxs(i.Fragment,{children:[k&&i.jsx(Hl,{icon:bs,label:h("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),F&&i.jsx(Br,{}),i.jsx("span",{className:"min-w-0 flex-1"})]}):F&&i.jsx(Br,{className:"absolute -right-0.5 -top-0.5"}),e[33]=k,e[34]=d,e[35]=F,e[36]=h,e[37]=le):le=e[37];let ee;return e[38]!==me||e[39]!==le||e[40]!==V||e[41]!==y||e[42]!==C?(ee=i.jsxs(i.Fragment,{children:[V,y,C,me,le]}),e[38]=me,e[39]=le,e[40]=V,e[41]=y,e[42]=C,e[43]=ee):ee=e[43],ee}const Gl="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Ul="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]";function Ro(n,e,s){if(s)return sa({selected:e});const o=n.isSavedBlock===!0,a=n.isMultivariate===!0;return ae("group relative flex select-none items-center gap-2 rounded-[var(--studio-control-radius,var(--radius-md))] px-2 py-2.5",e?"bg-accent text-accent-foreground":o?Gl:a?Ul:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function ps(n,e){return ae("h-7 shrink-0 overflow-hidden",e?"w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]":n?"w-7 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100":"w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-7 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]")}function Yl(n){const e=it.c(90),{section:s,raw:o,meta:a,decofile:u,sortableId:h,selected:d,onSelect:v,onDelete:m,onDuplicate:j,onMakeReusable:A,onToggleHidden:$,onToggleLazy:z,onAddVariant:H,onDetach:F}=n,f=Ft(),k=Wn(),X=o?Rs(o.__resolveType??""):!1,w=s.isHidden===!0,I=X||w;let V;e[0]!==s?(V=jo(s),e[0]=s,e[1]=V):V=e[1];const y=V,C=!!z&&!s.isMultivariate;let x;e[2]!==h?(x={id:h,animateLayoutChanges:Xl},e[2]=h,e[3]=x):x=e[3];const{attributes:Y,listeners:M,setNodeRef:ge,transform:me,isDragging:le}=bl(x);let ee;e[4]!==me?(ee=xl.Transform.toString(me?{...me,x:0}:null),e[4]=me,e[5]=ee):ee=e[5];const pe=le?0:void 0;let ce;e[6]!==ee||e[7]!==pe?(ce={transform:ee,opacity:pe},e[6]=ee,e[7]=pe,e[8]=ce):ce=e[8];const he=ce;let ve;e[9]!==s?(ve=Xi(s),e[9]=s,e[10]=ve):ve=e[10];const b=ve,B="button",xe=0;let T;e[11]!==v?(T=re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),v())},e[11]=v,e[12]=T):T=e[12];const ye=le?"cursor-grabbing":"cursor-pointer";let K;e[13]!==k||e[14]!==s||e[15]!==d||e[16]!==ye?(K=ae("touch-none transition-colors",ye,Ro(s,d,k)),e[13]=k,e[14]=s,e[15]=d,e[16]=ye,e[17]=K):K=e[17];let Se;e[18]!==u||e[19]!==a||e[20]!==o||e[21]!==s?(Se=i.jsx(Eo,{section:s,raw:o,meta:a,decofile:u}),e[18]=u,e[19]=a,e[20]=o,e[21]=s,e[22]=Se):Se=e[22];const ue=!k&&C&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(X?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:ae(ps(I,X)),onClick:re=>{re.stopPropagation(),z?.()},onPointerDown:Ql,children:i.jsx(bs,{className:ae("h-3.5 w-3.5",X&&"text-warning")})})}),i.jsx(Rt,{side:"bottom",children:f(X?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),te=k?i.jsx(Zi,{label:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:w,onToggle:$,children:w?i.jsx(Zr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})}):i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:ae(ps(I,w)),onClick:re=>{re.stopPropagation(),$()},onPointerDown:Jl,children:w?i.jsx(Zr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})})}),i.jsx(Rt,{side:"bottom",children:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),se=zi,Te=ea;let Z;e[23]!==f?(Z=f("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=f,e[24]=Z):Z=e[24];const _e=ae(ps(I,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let be;e[25]!==Te||e[26]!==Z||e[27]!==_e?(be=i.jsx(Te,{label:Z,classicClassName:_e}),e[25]=Te,e[26]=Z,e[27]=_e,e[28]=be):be=e[28];let q;e[29]!==k||e[30]!==C||e[31]!==X||e[32]!==z||e[33]!==f?(q=k&&C&&i.jsxs(i.Fragment,{children:[i.jsxs(sn,{onClick:re=>{re.stopPropagation(),z?.()},children:[i.jsx(bs,{className:"h-4 w-4"}),f(X?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")]}),i.jsx($i,{})]}),e[29]=k,e[30]=C,e[31]=X,e[32]=z,e[33]=f,e[34]=q):q=e[34];let O;e[35]!==j?(O=re=>{re.stopPropagation(),j()},e[35]=j,e[36]=O):O=e[36];let Ke;e[37]===Symbol.for("react.memo_cache_sentinel")?(Ke=i.jsx(dl,{className:"h-4 w-4"}),e[37]=Ke):Ke=e[37];let Qe;e[38]!==f?(Qe=f("sectionsEditor.sectionList.duplicateMenuItem"),e[38]=f,e[39]=Qe):Qe=e[39];let Xe;e[40]!==O||e[41]!==Qe?(Xe=i.jsxs(sn,{onClick:O,children:[Ke,Qe]}),e[40]=O,e[41]=Qe,e[42]=Xe):Xe=e[42];let Ye;e[43]!==k||e[44]!==y||e[45]!==H||e[46]!==f?(Ye=y&&i.jsxs(sn,{className:ae(!k&&ta),onClick:re=>{re.stopPropagation(),H()},children:[i.jsx(bo,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.addVariantMenuItem")]}),e[43]=k,e[44]=y,e[45]=H,e[46]=f,e[47]=Ye):Ye=e[47];let Q;e[48]!==k||e[49]!==b||e[50]!==A||e[51]!==f?(Q=b&&i.jsxs(sn,{className:ae(!k&&Wl),onClick:re=>{re.stopPropagation(),A()},children:[k?i.jsx(zn,{className:"h-4 w-4"}):i.jsx(Ss,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[48]=k,e[49]=b,e[50]=A,e[51]=f,e[52]=Q):Q=e[52];let ke;e[53]!==k||e[54]!==F||e[55]!==s.isMultivariate||e[56]!==s.isSavedBlock||e[57]!==f?(ke=s.isSavedBlock===!0&&!s.isMultivariate&&i.jsxs(sn,{onClick:re=>{re.stopPropagation(),F()},children:[k?i.jsx(_o,{className:"h-4 w-4"}):i.jsx(Ss,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.detachMenuItem")]}),e[53]=k,e[54]=F,e[55]=s.isMultivariate,e[56]=s.isSavedBlock,e[57]=f,e[58]=ke):ke=e[58];let He;e[59]!==m?(He=re=>{re.stopPropagation(),m()},e[59]=m,e[60]=He):He=e[60];let We;e[61]===Symbol.for("react.memo_cache_sentinel")?(We=i.jsx(ml,{className:"h-4 w-4"}),e[61]=We):We=e[61];let Ee;e[62]!==f?(Ee=f("sectionsEditor.sectionList.deleteMenuItem"),e[62]=f,e[63]=Ee):Ee=e[63];let Ie;e[64]!==He||e[65]!==Ee?(Ie=i.jsxs(sn,{variant:"destructive",onClick:He,children:[We,Ee]}),e[64]=He,e[65]=Ee,e[66]=Ie):Ie=e[66];let Ve;e[67]!==q||e[68]!==Xe||e[69]!==Ye||e[70]!==Q||e[71]!==ke||e[72]!==Ie?(Ve=i.jsxs(Hi,{align:"end",className:"w-44",children:[q,Xe,Ye,Q,ke,Ie]}),e[67]=q,e[68]=Xe,e[69]=Ye,e[70]=Q,e[71]=ke,e[72]=Ie,e[73]=Ve):Ve=e[73];let Ze;e[74]!==se||e[75]!==be||e[76]!==Ve?(Ze=i.jsxs(se,{children:[be,Ve]}),e[74]=se,e[75]=be,e[76]=Ve,e[77]=Ze):Ze=e[77];let Fe;return e[78]!==Y||e[79]!==M||e[80]!==v||e[81]!==ge||e[82]!==he||e[83]!==K||e[84]!==Se||e[85]!==ue||e[86]!==te||e[87]!==Ze||e[88]!==T?(Fe=i.jsxs("div",{ref:ge,style:he,...Y,...M,role:B,tabIndex:xe,onClick:v,onKeyDown:T,className:K,children:[Se,ue,te,Ze]}),e[78]=Y,e[79]=M,e[80]=v,e[81]=ge,e[82]=he,e[83]=K,e[84]=Se,e[85]=ue,e[86]=te,e[87]=Ze,e[88]=T,e[89]=Fe):Fe=e[89],Fe}function Jl(n){return n.stopPropagation()}function Ql(n){return n.stopPropagation()}function Xl(){return!1}function js(n){const e=it.c(11),{canAddSection:s,onAddSection:o,className:a,size:u}=n,h=Ft();let d;e[0]!==a?(d=ae("w-full",a),e[0]=a,e[1]=d):d=e[1];const v=!s;let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(fl,{size:14}),e[2]=m):m=e[2];let j;e[3]!==h?(j=h("sectionsEditor.sectionList.addSectionButton"),e[3]=h,e[4]=j):j=e[4];let A;return e[5]!==o||e[6]!==u||e[7]!==d||e[8]!==v||e[9]!==j?(A=i.jsxs(_t,{type:"button",variant:"outline",size:u,className:d,disabled:v,onClick:o,children:[m,j]}),e[5]=o,e[6]=u,e[7]=d,e[8]=v,e[9]=j,e[10]=A):A=e[10],A}function Zl(n){const e=it.c(101),{listKey:s,rawSections:o,sections:a,meta:u,decofile:h,selectedIndex:d,onSelect:v,onReorder:m,onDelete:j,onDuplicate:A,onMakeReusable:$,onToggleHidden:z,onToggleLazy:H,onAddVariant:F,onDetach:f,onAddSection:k,canAddSection:X}=n,w=X===void 0?!0:X,I=Ft(),V=Wn();let y;e[0]!==a.length?(y=()=>io(a.length),e[0]=a.length,e[1]=y):y=e[1];const[C,x]=R.useState(y),[Y,M]=R.useState(null),[ge,me]=R.useState(s),[le,ee]=R.useState(a.length),pe=R.useRef(!1);ge!==s?(me(s),ee(a.length),x(io(a.length))):le!==a.length&&(ee(a.length),x(dt=>ql(dt,a.length)));let ce;e[2]===Symbol.for("react.memo_cache_sentinel")?(ce={activationConstraint:{distance:8}},e[2]=ce):ce=e[2];let he;e[3]===Symbol.for("react.memo_cache_sentinel")?(he={coordinateGetter:jl},e[3]=he):he=e[3];const ve=pl(to(gl,ce),to(hl,he));let b;e[4]!==C?(b=C.map(ec),e[4]=C,e[5]=b):b=e[5];const B=b;let xe;e[6]===Symbol.for("react.memo_cache_sentinel")?(xe=dt=>{M(String(dt.active.id))},e[6]=xe):xe=e[6];const T=xe;let ye;e[7]!==B||e[8]!==m?(ye=dt=>{M(null);const{active:ne,over:De}=dt;if(!De||ne.id===De.id)return;const yt=B.indexOf(String(ne.id)),et=B.indexOf(String(De.id));yt===-1||et===-1||(x(ft=>ko(Ln([...ft],yt,et))),pe.current=!0,requestAnimationFrame(()=>{pe.current=!1}),m?.(yt,et))},e[7]=B,e[8]=m,e[9]=ye):ye=e[9];const K=ye;let Se;e[10]===Symbol.for("react.memo_cache_sentinel")?(Se=()=>{M(null)},e[10]=Se):Se=e[10];const ue=Se;let te,se,Te,Z,_e,be,q,O,Ke,Qe,Xe,Ye,Q,ke,He;if(e[11]!==Y||e[12]!==w||e[13]!==V||e[14]!==h||e[15]!==C||e[16]!==B||e[17]!==K||e[18]!==u||e[19]!==k||e[20]!==F||e[21]!==j||e[22]!==f||e[23]!==A||e[24]!==$||e[25]!==v||e[26]!==z||e[27]!==H||e[28]!==o||e[29]!==a||e[30]!==d||e[31]!==ve||e[32]!==I){ke=Symbol.for("react.early_return_sentinel");e:{const dt=ne=>{pe.current||v(ne)};if(e[48]!==Y||e[49]!==w||e[50]!==V||e[51]!==C||e[52]!==k||e[53]!==o||e[54]!==a||e[55]!==I){const ne=Y?C.find(De=>De.id===Y):null;if(Z=ne!=null?a[ne.index]:null,Te=ne!=null?o[ne.index]:void 0,C.length===0){let De;e[59]!==I?(De=I("sectionsEditor.sectionList.noSections"),e[59]=I,e[60]=De):De=e[60];let yt;e[61]!==De?(yt=i.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:De}),e[61]=De,e[62]=yt):yt=e[62];const et=yt;let ft;e[63]!==w||e[64]!==V||e[65]!==et||e[66]!==k?(ft=V?et:i.jsxs("div",{className:"space-y-2",children:[et,i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm"})]}),e[63]=w,e[64]=V,e[65]=et,e[66]=k,e[67]=ft):ft=e[67],ke=ft;break e}Q=ae(ne&&"cursor-grabbing"),e[48]=Y,e[49]=w,e[50]=V,e[51]=C,e[52]=k,e[53]=o,e[54]=a,e[55]=I,e[56]=Te,e[57]=Z,e[58]=Q}else Te=e[56],Z=e[57],Q=e[58];se=yl,O=ve,Ke=Sl,Qe=T,Xe=K,Ye=ue,te=wl,be=B,q=_l,He="space-y-1",_e=C.map(ne=>{const De=a[ne.index];return De?i.jsx(Yl,{sortableId:ne.id,section:De,raw:o[ne.index],meta:u,decofile:h,selected:d===ne.index,onSelect:()=>dt(ne.index),onDelete:()=>j(ne.index),onDuplicate:()=>A(ne.index),onMakeReusable:()=>$(ne.index),onToggleHidden:()=>z(ne.index),onToggleLazy:H?()=>H(ne.index):void 0,onAddVariant:()=>F(ne.index),onDetach:()=>f(ne.index)},ne.id):null})}e[11]=Y,e[12]=w,e[13]=V,e[14]=h,e[15]=C,e[16]=B,e[17]=K,e[18]=u,e[19]=k,e[20]=F,e[21]=j,e[22]=f,e[23]=A,e[24]=$,e[25]=v,e[26]=z,e[27]=H,e[28]=o,e[29]=a,e[30]=d,e[31]=ve,e[32]=I,e[33]=te,e[34]=se,e[35]=Te,e[36]=Z,e[37]=_e,e[38]=be,e[39]=q,e[40]=O,e[41]=Ke,e[42]=Qe,e[43]=Xe,e[44]=Ye,e[45]=Q,e[46]=ke,e[47]=He}else te=e[33],se=e[34],Te=e[35],Z=e[36],_e=e[37],be=e[38],q=e[39],O=e[40],Ke=e[41],Qe=e[42],Xe=e[43],Ye=e[44],Q=e[45],ke=e[46],He=e[47];if(ke!==Symbol.for("react.early_return_sentinel"))return ke;let We;e[68]!==_e||e[69]!==He?(We=i.jsx("div",{className:He,children:_e}),e[68]=_e,e[69]=He,e[70]=We):We=e[70];let Ee;e[71]!==te||e[72]!==be||e[73]!==q||e[74]!==We?(Ee=i.jsx(te,{items:be,strategy:q,children:We}),e[71]=te,e[72]=be,e[73]=q,e[74]=We,e[75]=Ee):Ee=e[75];let Ie;e[76]!==Te||e[77]!==Z||e[78]!==V||e[79]!==h||e[80]!==u?(Ie=Z?i.jsx("div",{className:ae("cursor-grabbing shadow-lg ring-1 ring-border/60",Ro(Z,!1,V)),children:i.jsx(Eo,{section:Z,raw:Te,meta:u,decofile:h})}):null,e[76]=Te,e[77]=Z,e[78]=V,e[79]=h,e[80]=u,e[81]=Ie):Ie=e[81];let Ve;e[82]!==Ie?(Ve=Li.createPortal(i.jsx(vl,{dropAnimation:Qi,children:Ie}),document.body),e[82]=Ie,e[83]=Ve):Ve=e[83];let Ze;e[84]!==se||e[85]!==O||e[86]!==Ke||e[87]!==Qe||e[88]!==Xe||e[89]!==Ye||e[90]!==Ee||e[91]!==Ve?(Ze=i.jsxs(se,{sensors:O,collisionDetection:Ke,onDragStart:Qe,onDragEnd:Xe,onDragCancel:Ye,children:[Ee,Ve]}),e[84]=se,e[85]=O,e[86]=Ke,e[87]=Qe,e[88]=Xe,e[89]=Ye,e[90]=Ee,e[91]=Ve,e[92]=Ze):Ze=e[92];let Fe;e[93]!==w||e[94]!==V||e[95]!==k?(Fe=!V&&i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm",className:"mt-2"}),e[93]=w,e[94]=V,e[95]=k,e[96]=Fe):Fe=e[96];let re;return e[97]!==Q||e[98]!==Ze||e[99]!==Fe?(re=i.jsxs("div",{className:Q,children:[Ze,Fe]}),e[97]=Q,e[98]=Ze,e[99]=Fe,e[100]=re):re=e[100],re}function ec(n){return n.id}function hs(n,e,s,o){if(!n||!e)return null;if(!e.isMultivariate)return jt(n,e,o)?.data??null;const a=xt(n,e),u=a?vs(a,wt)[s]:void 0;return u?wo(u.value,o)?.data??null:null}const tc=50;function nc(n,e){n.own.push(ze(e)),n.own.length>tc&&n.own.shift()}function ao(n,e){return n.own.includes(ze(e))}function sc(n,e){const{sectionIndex:s,variantIndex:o,shown:a,next:u,sectionCount:h}=e;return n&&n.sectionIndex===s&&n.variantIndex===o&&n.emitted===a?(n.emitted=u,n):a?{sectionIndex:s,variantIndex:o,base:a,emitted:u,sectionCount:h,own:[ze(a)]}:null}function Ao(n,e){return e!==null&&ze(n)!==ze(e)}function Co(n,e){return n.__resolveType!==e.__resolveType}function rc(n,e,s,o){if(e.length===o)return"here";const a=ze(n),u=e.flatMap((h,d)=>d!==s&&h!==null&&ze(h)===a?[d]:[]);return u.length===1?u[0]:"unknown"}function lo({formBase:n,rebased:e,versionOf:s}){let o=null;return{ifMatch:a=>{o=a,n&&(n.version===void 0||e)&&(n.version=s(a));const u=n?n.version:s(a);return u===void 0?void 0:{[a]:u}},onApplied:a=>{n&&o!==null&&Object.hasOwn(a,o)&&(n.version=a[o])},reloadOnConflict:!0}}function oc({merged:n,tracked:e,current:s,saved:o}){return!!n&&!!e&&s===e&&e.emitted===o}function co(n,e){return!!n&&!!e&&n.contains(e)}function ws(n){const e=[],s=_s("",n.ancestor,n.mine,n.theirs,e);return{...n,merged:s,pointers:e}}function _s(n,e,s,o,a){const u=(h,d)=>ze(h)===ze(d);if(u(s,o)||u(e,o))return s;if(u(e,s))return o;if(gs(s)&&gs(o)){const h=gs(e)?e:{},d={},v=[...Object.keys(s),...Object.keys(o).filter(m=>!(m in s))];for(const m of v){const j=_s(`${n}/${m.replaceAll("~","~0").replaceAll("/","~1")}`,h[m],s[m],o[m],a);j!==void 0&&(d[m]=j)}return d}return Array.isArray(e)&&Array.isArray(s)&&Array.isArray(o)&&s.length===e.length&&o.length===e.length?e.map((h,d)=>_s(`${n}/${d}`,h,s[d],o[d],a)):(a.push(n),o)}function gs(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function ic(n,e){let s=n.merged;for(const o of n.pointers)e[o]==="mine"&&(s=uc(s,o,Ut(n.mine,o)));return s}function ac(n,e){return Object.fromEntries(n.pointers.map(s=>[s,e]))}function No(n){return ac(n,"mine")}function ks(n,e,s){const o=No(s);for(const a of s.pointers){const u=e[a];if(!u||!n.pointers.includes(a))continue;["mine","theirs"].every(d=>ze(Ut(n[d],a))===ze(Ut(s[d],a)))&&(o[a]=u)}return o}function To(n,e,s={}){const o=e.pointers.filter(a=>!n.pointers.includes(a)||ze(Ut(n.theirs,a))!==ze(Ut(e.theirs,a)));return o.length===0?s:{...s,...Object.fromEntries(o.map(a=>[a,(s[a]??0)+1]))}}function lc(n,e,s){if(!e||Co(n.plan.ancestor,e)||!Ao(n.plan.theirs,e)||s(e))return null;const o=ws({...n.plan,theirs:e});return o.pointers.length===0?null:{plan:o,choices:ks(n.plan,n.choices,o),fresh:To(n.plan,o,n.fresh)}}function cc(n,e){return n.pointers.map(s=>({pointer:s,label:oa(s,e),mine:Ut(n.mine,s),theirs:Ut(n.theirs,s),schema:dc(e??null,s)}))}function As(n){return n.split("/").slice(1).map(e=>e.replaceAll("~1","/").replaceAll("~0","~"))}function Ut(n,e){let s=n;for(const o of As(e))if(Array.isArray(s))s=s[Number(o)];else if(s&&typeof s=="object")s=s[o];else return;return s}function uc(n,e,s){const o=As(e),a=(u,h)=>{if(h===o.length)return s;const d=o[h];if(Array.isArray(u)){const j=[...u];return j[Number(d)]=a(u[Number(d)],h+1),j}const v=u&&typeof u=="object"?{...u}:{},m=a(v[d],h+1);return m===void 0?delete v[d]:v[d]=m,v};return a(n,0)}function dc(n,e){let s=n;for(const o of As(e)){if(!s)return null;s=/^\d+$/.test(o)&&!s.properties?.[o]?s.items:s.properties?.[o]}return s??null}const fc=/\.(png|jpe?g|gif|webp|avif|svg)(\?.*)?$/i,uo=60,mc=3;function Vo(n,e){return e?.format==="image-uri"?!0:n.startsWith("data:image/")||/^(https?:)?\/\//.test(n)&&fc.test(n)}function Es(n,e){if(!(e?.format==="rich-text"||e?.format==="rich-text-inline"||e?.format==="html"||/<\/?[a-z][^>]*>/i.test(n)))return n;const o=n.replace(/<br\s*\/?>/gi,`
|
|
1
|
+
import{c as it,b as Ft,r as R,l as ae,j as i,b4 as Li,B as _t,U as sn,aw as $i,X as zi,V as Hi,a as xo,F as Wi,K as yo,m as qi,o as Gi,h as Ui,t as oe}from"./index-p-1akJlT.js";import{u as Yi}from"./chat-context-Ccuwf3qi.js";import{a5 as Ji,T as Wn,a6 as Qi,a7 as Zi,a8 as Xi,a9 as ea,aa as ta,ab as na,ac as Br,ad as sa,ae as ra,G as jt,af as wt,ag as ze,ah as oa,H as Fn,E as On,b as ia,j as aa,u as la,ai as Kr,q as ca,aj as ua,s as da,o as fa,ak as So,p as _n,al as ma,am as pa,A as Fr,an as ha,ao as ga,ap as Bn,aq as Or,ar as Lr,as as $r,at as us,au as va,av as xa,F as ya,aw as zr,ax as Sa,ay as Hr,az as Wr,M as ba,aA as qr,a as ja,aB as Sn,aC as wa,aD as _a,aE as bn,aF as ds}from"./blocks-tab-states-BgNWRkH8.js";import{c as ka}from"./repository-binding-CrTJC4PH.js";import{n as Ea,t as Ra}from"./ChevronUp-M8O43yJN.js";import{a8 as bo,b as zn,an as Aa,D as Ca,a1 as Gr,Z as Ur}from"./agent-icon-6qcGzKLI.js";import{S as rn}from"./scroll-area-mUNQ_2-E.js";import{c as kt,T as Et,a as Rt}from"./tooltip-OxzEYyq8.js";import{am as Na,g as Yr,J as Ta,u as Va,K as Da,w as Ma,ab as Pa,x as Ia,d as Pt,f as It,a7 as Ba,ar as Ka}from"./site-editor-toast-DpTt5s80.js";import{m as Fa,u as Oa,P as La}from"./mustache-Bt-JW5rB.js";import{az as $a,k as Rs,aB as jo,H as za,aC as xt,aD as vs,aE as wo,aj as Gt,a8 as xs,aF as ys,ak as Kt,a9 as on,q as Ha,t as Wa,g as qa,x as Kn,ar as Ga,ai as jn,aa as fs,ah as Bt,ag as wn,aG as Ua,P as Ya,aH as Ja,al as Jr,a1 as Qr,aI as Qa,aJ as qt,aK as Za,aL as Xa,aM as el,aN as Zr,aO as tl,aP as nl,aQ as sl,af as rl,aR as ol,aS as il,aT as al,aU as ll,ae as cl,aV as ul}from"./secret-ciphertext-LIZTOM-t.js";import{a as dl}from"./Copy01-IjT5Cr-0.js";import{a as Ss,e as _o}from"./UserSquare-CWSxOMqR.js";import{i as Xr}from"./Tool01-BuiUP3wu.js";import{s as eo}from"./Image01-aYI2vrVV.js";import{s as fl}from"./Plus-Xcxre04p.js";import{s as ml}from"./Trash01-CSWWBhZk.js";import{i as bs}from"./ZoomOut-DmspxQ49.js";import{u as pl,a as to,K as hl,P as gl,b as vl,C as xl,D as yl,c as Sl}from"./core.esm-BlIrt00V.js";import{u as bl,s as jl,a as Ln,S as wl,v as _l}from"./sortable.esm-BSVJlRZf.js";import{s as kl,g as El,u as Rl,A as Al}from"./use-section-preview-base-DhPFhZwv.js";import{A as ms}from"./avatar-DLW_zv2o.js";import{e as Cl,d as no,b as Nl,A as Tl,a as Vl,f as Dl}from"./alert-dialog-B2X6GVxf.js";import{b as Ml}from"./format-time-CAj8AQXM.js";import{d as Pl}from"./shell-layout-DA1U2kkD.js";import{u as Il}from"./use-members-qFBNBM3N.js";import{a as Bl,P as so,b as Kl}from"./page-seo-form-Dkd11mxM.js";import{c as ro,d as oo,e as Fl,f as Ol}from"./variant-draft-pointer-CFIC5SMO.js";import"./use-panel-navigate-Cz7L1teW.js";import"./thread-route-BIvY3iy0.js";import"./use-project-scope--iaz7oOx.js";import"./autosend-Bh9N6QTP.js";import"./thread-intent-LfHRYRWC.js";import"./use-mcp-client-TpYhnmjl.js";import"./auth-CDMxJjZ_.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./watch-sse-pool-CTU0zZto.js";import"./task-board-qH-zSxS3.js";import"./schema-nZYp8MHf.js";import"./slugify-CEUa2lfQ.js";import"./use-decopilot-events-Y_bEM1qx.js";import"./use-ai-providers-Gj0qAd5n.js";import"./use-chat-navigation-Bsf8Ofz7.js";import"./location-BjlyegC2.js";import"./use-organization-settings-BFBW8RTu.js";import"./input-DZSN2_kg.js";import"./usage-stats-7JI4qqsk.js";import"./tool-namespace-Dcr66XbC.js";import"./form-Db6N6TDa.js";import"./label-D1700VqO.js";import"./utils-CVEq3hMx.js";import"./markdown-yum68Wep.js";import"./use-copy-CCruuyq5.js";import"./use-mobile-vYE2HB1P.js";import"./XClose-BEUDzM_1.js";import"./icon-button-WQQroCBK.js";import"./file-type-icon-Dxw9T3ag.js";import"./chat-draft-DHvm4xVB.js";import"./LinkBroken01-Cemx_-td.js";import"./ArrowUp-eyGXli3J.js";import"./ShoppingBag01-7AUWsp7V.js";import"./Upload01-By8WilO1.js";import"./AlertCircle-C49F0ts6.js";import"./select-jUuHkfjB.js";import"./index-BdQq_4o_.js";import"./index-CE8cdWnC.js";import"./ArrowLeft-CSSCO41y.js";import"./tabs-DG-0hqxq.js";import"./use-deco-credits-CYX05LPq.js";import"./toggle-group-BEVDihe8.js";import"./use-open-billing-url-D_QihQeB.js";import"./index-LAQehZep.js";import"./checkbox-Cniz6XYs.js";import"./ChevronSelectorVertical-DeVUWHMb.js";import"./Key01-BnFprBC4.js";import"./SearchMd-BiMpzfAz.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-BZieTizR.js";import"./popover-Cb6oJHii.js";import"./drawer-BxIrQZqO.js";import"./input-BwdVmY-Z.js";import"./suggestion-DBa1TtKe.js";import"./use-mcp-prompts-CpmfoZzy.js";import"./use-org-fs-CAd5ZqC2.js";import"./useInfiniteQuery-v5wivWhC.js";import"./infiniteQueryObserver-LkWhFNmL.js";import"./Link01-CdThLL91.js";import"./question-004-sINsf4GQ.js";import"./feature-paywall-Bg9evHOs.js";import"./plan-ladder-tDE3yVKX.js";import"./add-connection-dialog-D2-Fevp3.js";import"./collection-search-D-0zgzsL.js";import"./extract-connection-data-CVxXe6TN.js";import"./metadata-D72DunRR.js";import"./connection-DD0hCw09.js";import"./url-slug-DIeHU92G.js";import"./connection-card-CyrhBBJS.js";import"./connection-slug-CITJ0kGN.js";import"./integration-icon-BfiQkuuA.js";import"./textarea-CQEBFigV.js";import"./use-connection-DJY11N6-.js";import"./schema-EWHGi9mE.js";import"./connection-form-helpers-BEx47naA.js";import"./authenticate-and-persist-oauth-BeZlu0Nl.js";import"./mcp-oauth-i6-iEEVI.js";import"./mcp-oauth-DyD71bgf.js";import"./collection-tabs-BY3qzlzd.js";import"./badge-CNOkHFGC.js";import"./use-infinite-scroll-BzeoWUs-.js";import"./useSuspenseInfiniteQuery-BZNUHruQ.js";import"./use-task-board-events-BXbE2HoE.js";import"./use-project-native-view-presence-Bxsn_JFS.js";import"./use-file-configs-CaudfVHS.js";import"./site-slug-DebpOoQq.js";import"./utils-Ci3T7CsR.js";import"./Play-DJbpbnnH.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-CdvXgzho.js";import"./collapsible-0KvGZBpu.js";import"./use-clock-tick-CZTHUR3c.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-CjApEMHO.js";import"./types-2GaxflNM.js";import"./omit-sandbox-map-jj4lCB2U.js";import"./sheet-DMEBFfdP.js";import"./use-navigate-to-agent-p0i1D6nD.js";import"./use-thread-outputs-DxXrDY7V.js";import"./switch-D5BJVOIP.js";import"./command-CAjgUN60.js";import"./index--5hJacOk.js";import"./monaco-editor-BZbJgxOV.js";import"./editor-C0Y6NYE-.js";import"./calendar-BTqmD5cp.js";import"./SwitchHorizontal01-lbkLP1BV.js";import"./editor-classes-Bd7RVaJi.js";import"./view-mode-toggle-CdIfZN7k.js";import"./combobox-DihCFI-U.js";import"./DotsVertical-C3vEzxwp.js";import"./search-input-DmONJsTJ.js";import"./use-debounced-value-Ci8g1xZm.js";import"./asset-utils-PpGBHp7S.js";import"./sandbox-git-api-CRxdlhrN.js";import"./sandbox-url-D3mC8qhT.js";import"./empty-state-CeH8S3Yb.js";import"./Building02-Cc0RR_mQ.js";import"./CheckCircle-BED6dkLg.js";import"./CreditCard01-CCewrsPV.js";import"./Globe04-DOtzWDgX.js";import"./Sun-DZd0pcUv.js";import"./User01-558TF773.js";import"./Users01-gicEePNg.js";import"./index-BtVJvkKj.js";import"./alert-ClPly-6t.js";import"./section-preview-url-7zfngvgW.js";import"./differenceInSeconds-C3x8sHUj.js";import"./project-icon-F3J_yQ0q.js";import"./new-project-dialog-C0rIX_XO.js";import"./repository-import-picker-DC6F2OwG.js";import"./repository-picker-Bo-zD5oc.js";import"./required-auth-layout-B5cH35q0.js";import"./use-org-sso-BfZer93d.js";import"./use-org-auth-client-Fk6ICmBW.js";const Ll={escape:Ji};function $l(n,e){for(const s of kl(n,e)){const o=typeof s.title=="string"?s.title:void 0;if(o?.includes("{{"))return o}}function zl(n,e){if(!e)return;const s=$a(n);if(s)try{const o=$l(s.resolveType,e);return o&&Fa.render(o,s.data,{},Ll).trim()||void 0}catch{return}}function Hl(n){const e=it.c(13),{icon:s,label:o,className:a}=n;let u;e[0]!==a?(u=ae("size-3.5",a),e[0]=a,e[1]=u):u=e[1];let h;e[2]!==s||e[3]!==u?(h=i.jsx(s,{className:u}),e[2]=s,e[3]=u,e[4]=h):h=e[4];let d;e[5]!==o||e[6]!==h?(d=i.jsx(Et,{asChild:!0,children:i.jsx("span",{role:"img","aria-label":o,className:"shrink-0 cursor-help",children:h})}),e[5]=o,e[6]=h,e[7]=d):d=e[7];let v;e[8]!==o?(v=i.jsx(Rt,{className:"max-w-56",children:o}),e[8]=o,e[9]=v):v=e[9];let m;return e[10]!==d||e[11]!==v?(m=i.jsxs(kt,{children:[d,v]}),e[10]=d,e[11]=v,e[12]=m):m=e[12],m}const Wl="text-global-section-fg focus:bg-global-section/12 focus:text-global-section-fg dark:text-global-section-fg-dark dark:focus:bg-global-section/15 dark:focus:text-global-section-fg-dark [&_svg]:!text-global-section";function io(n){return Array.from({length:n},(e,s)=>({id:crypto.randomUUID(),index:s}))}function ko(n){return n.map((e,s)=>({...e,index:s}))}function ql(n,e){if(e===n.length)return n;if(e<n.length)return ko(n.slice(0,e));const s=Array.from({length:e-n.length},(o,a)=>({id:crypto.randomUUID(),index:n.length+a}));return[...n,...s]}function Eo(n){const e=it.c(44),{section:s,raw:o,meta:a,decofile:u}=n,h=Ft(),d=Wn(),v=s.isSavedBlock===!0,m=s.isMultivariate===!0;let j;e[0]!==a||e[1]!==o?(j=o&&a?El(o,a):void 0,e[0]=a,e[1]=o,e[2]=j):j=e[2];const A=j;let $;e[3]!==a||e[4]!==m||e[5]!==o||e[6]!==v?($=o&&a&&!v&&!m?zl(o,a):void 0,e[3]=a,e[4]=m,e[5]=o,e[6]=v,e[7]=$):$=e[7];const z=$;let H;e[8]!==u||e[9]!==a||e[10]!==o||e[11]!==s?(H=na(o,s,u,a),e[8]=u,e[9]=a,e[10]=o,e[11]=s,e[12]=H):H=e[12];const F=H;let f;e[13]!==m||e[14]!==o?.__resolveType?(f=!m&&Rs(o?.__resolveType??""),e[13]=m,e[14]=o?.__resolveType,e[15]=f):f=e[15];const k=f,Z=v?zn:m?bo:_o;let w;e[16]!==m||e[17]!==v?(w=v?{color:za}:m?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=m,e[17]=v,e[18]=w):w=e[18];const I=w;let V;e[19]!==Z||e[20]!==d?(V=d?i.jsxs("span",{className:"relative size-4 shrink-0",children:[i.jsx(Z,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),i.jsx(ra,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):i.jsx(Aa,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=Z,e[20]=d,e[21]=V):V=e[21];let y;e[22]!==A?(y=A&&i.jsx("img",{src:A,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=A,e[23]=y):y=e[23];let C;e[24]!==d||e[25]!==I?(C=!d&&i.jsx(Ss,{className:"h-4 w-4 shrink-0",style:I}),e[24]=d,e[25]=I,e[26]=C):C=e[26];const x=d?"shrink":"flex-1",Y=s.isHidden&&"line-through opacity-50";let M;e[27]!==Y||e[28]!==x?(M=ae("min-w-0 truncate text-sm font-medium",x,Y),e[27]=Y,e[28]=x,e[29]=M):M=e[29];const ge=z??s.label;let me;e[30]!==M||e[31]!==ge?(me=i.jsx("span",{className:M,children:ge}),e[30]=M,e[31]=ge,e[32]=me):me=e[32];let le;e[33]!==k||e[34]!==d||e[35]!==F||e[36]!==h?(le=d?i.jsxs(i.Fragment,{children:[k&&i.jsx(Hl,{icon:bs,label:h("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),F&&i.jsx(Br,{}),i.jsx("span",{className:"min-w-0 flex-1"})]}):F&&i.jsx(Br,{className:"absolute -right-0.5 -top-0.5"}),e[33]=k,e[34]=d,e[35]=F,e[36]=h,e[37]=le):le=e[37];let ee;return e[38]!==me||e[39]!==le||e[40]!==V||e[41]!==y||e[42]!==C?(ee=i.jsxs(i.Fragment,{children:[V,y,C,me,le]}),e[38]=me,e[39]=le,e[40]=V,e[41]=y,e[42]=C,e[43]=ee):ee=e[43],ee}const Gl="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Ul="text-[oklch(0.45_0.15_160)] hover:bg-[oklch(0.65_0.15_160/0.12)] dark:text-[oklch(0.78_0.15_160)] dark:hover:bg-[oklch(0.65_0.15_160/0.15)]";function Ro(n,e,s){if(s)return sa({selected:e});const o=n.isSavedBlock===!0,a=n.isMultivariate===!0;return ae("group relative flex select-none items-center gap-2 rounded-[var(--studio-control-radius,var(--radius-md))] px-2 py-2.5",e?"bg-accent text-accent-foreground":o?Gl:a?Ul:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function ps(n,e){return ae("h-7 shrink-0 overflow-hidden",e?"w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]":n?"w-7 ml-0 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:opacity-100 group-has-[:focus-visible]:opacity-100":"w-0 -ml-2 opacity-0 [transition:opacity_150ms_ease-out,width_0ms_150ms,margin-left_0ms_150ms] group-hover:ml-0 group-hover:w-7 group-hover:opacity-100 group-hover:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms] group-has-[:focus-visible]:ml-0 group-has-[:focus-visible]:w-7 group-has-[:focus-visible]:opacity-100 group-has-[:focus-visible]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]")}function Yl(n){const e=it.c(90),{section:s,raw:o,meta:a,decofile:u,sortableId:h,selected:d,onSelect:v,onDelete:m,onDuplicate:j,onMakeReusable:A,onToggleHidden:$,onToggleLazy:z,onAddVariant:H,onDetach:F}=n,f=Ft(),k=Wn(),Z=o?Rs(o.__resolveType??""):!1,w=s.isHidden===!0,I=Z||w;let V;e[0]!==s?(V=jo(s),e[0]=s,e[1]=V):V=e[1];const y=V,C=!!z&&!s.isMultivariate;let x;e[2]!==h?(x={id:h,animateLayoutChanges:Zl},e[2]=h,e[3]=x):x=e[3];const{attributes:Y,listeners:M,setNodeRef:ge,transform:me,isDragging:le}=bl(x);let ee;e[4]!==me?(ee=xl.Transform.toString(me?{...me,x:0}:null),e[4]=me,e[5]=ee):ee=e[5];const pe=le?0:void 0;let ce;e[6]!==ee||e[7]!==pe?(ce={transform:ee,opacity:pe},e[6]=ee,e[7]=pe,e[8]=ce):ce=e[8];const he=ce;let ve;e[9]!==s?(ve=Zi(s),e[9]=s,e[10]=ve):ve=e[10];const b=ve,B="button",xe=0;let T;e[11]!==v?(T=re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),v())},e[11]=v,e[12]=T):T=e[12];const ye=le?"cursor-grabbing":"cursor-pointer";let K;e[13]!==k||e[14]!==s||e[15]!==d||e[16]!==ye?(K=ae("touch-none transition-colors",ye,Ro(s,d,k)),e[13]=k,e[14]=s,e[15]=d,e[16]=ye,e[17]=K):K=e[17];let Se;e[18]!==u||e[19]!==a||e[20]!==o||e[21]!==s?(Se=i.jsx(Eo,{section:s,raw:o,meta:a,decofile:u}),e[18]=u,e[19]=a,e[20]=o,e[21]=s,e[22]=Se):Se=e[22];const ue=!k&&C&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(Z?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:ae(ps(I,Z)),onClick:re=>{re.stopPropagation(),z?.()},onPointerDown:Ql,children:i.jsx(bs,{className:ae("h-3.5 w-3.5",Z&&"text-warning")})})}),i.jsx(Rt,{side:"bottom",children:f(Z?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),te=k?i.jsx(Xi,{label:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:w,onToggle:$,children:w?i.jsx(Xr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})}):i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:ae(ps(I,w)),onClick:re=>{re.stopPropagation(),$()},onPointerDown:Jl,children:w?i.jsx(Xr,{className:"h-3.5 w-3.5"}):i.jsx(eo,{className:"h-3.5 w-3.5"})})}),i.jsx(Rt,{side:"bottom",children:f(w?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),se=zi,Te=ea;let X;e[23]!==f?(X=f("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=f,e[24]=X):X=e[24];const _e=ae(ps(I,!1),"data-[state=open]:ml-0 data-[state=open]:w-7 data-[state=open]:opacity-100 data-[state=open]:[transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]");let be;e[25]!==Te||e[26]!==X||e[27]!==_e?(be=i.jsx(Te,{label:X,classicClassName:_e}),e[25]=Te,e[26]=X,e[27]=_e,e[28]=be):be=e[28];let q;e[29]!==k||e[30]!==C||e[31]!==Z||e[32]!==z||e[33]!==f?(q=k&&C&&i.jsxs(i.Fragment,{children:[i.jsxs(sn,{onClick:re=>{re.stopPropagation(),z?.()},children:[i.jsx(bs,{className:"h-4 w-4"}),f(Z?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")]}),i.jsx($i,{})]}),e[29]=k,e[30]=C,e[31]=Z,e[32]=z,e[33]=f,e[34]=q):q=e[34];let O;e[35]!==j?(O=re=>{re.stopPropagation(),j()},e[35]=j,e[36]=O):O=e[36];let Ke;e[37]===Symbol.for("react.memo_cache_sentinel")?(Ke=i.jsx(dl,{className:"h-4 w-4"}),e[37]=Ke):Ke=e[37];let Qe;e[38]!==f?(Qe=f("sectionsEditor.sectionList.duplicateMenuItem"),e[38]=f,e[39]=Qe):Qe=e[39];let Ze;e[40]!==O||e[41]!==Qe?(Ze=i.jsxs(sn,{onClick:O,children:[Ke,Qe]}),e[40]=O,e[41]=Qe,e[42]=Ze):Ze=e[42];let Ye;e[43]!==k||e[44]!==y||e[45]!==H||e[46]!==f?(Ye=y&&i.jsxs(sn,{className:ae(!k&&ta),onClick:re=>{re.stopPropagation(),H()},children:[i.jsx(bo,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.addVariantMenuItem")]}),e[43]=k,e[44]=y,e[45]=H,e[46]=f,e[47]=Ye):Ye=e[47];let Q;e[48]!==k||e[49]!==b||e[50]!==A||e[51]!==f?(Q=b&&i.jsxs(sn,{className:ae(!k&&Wl),onClick:re=>{re.stopPropagation(),A()},children:[k?i.jsx(zn,{className:"h-4 w-4"}):i.jsx(Ss,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[48]=k,e[49]=b,e[50]=A,e[51]=f,e[52]=Q):Q=e[52];let ke;e[53]!==k||e[54]!==F||e[55]!==s.isMultivariate||e[56]!==s.isSavedBlock||e[57]!==f?(ke=s.isSavedBlock===!0&&!s.isMultivariate&&i.jsxs(sn,{onClick:re=>{re.stopPropagation(),F()},children:[k?i.jsx(_o,{className:"h-4 w-4"}):i.jsx(Ss,{className:"h-4 w-4"}),f("sectionsEditor.sectionList.detachMenuItem")]}),e[53]=k,e[54]=F,e[55]=s.isMultivariate,e[56]=s.isSavedBlock,e[57]=f,e[58]=ke):ke=e[58];let He;e[59]!==m?(He=re=>{re.stopPropagation(),m()},e[59]=m,e[60]=He):He=e[60];let We;e[61]===Symbol.for("react.memo_cache_sentinel")?(We=i.jsx(ml,{className:"h-4 w-4"}),e[61]=We):We=e[61];let Ee;e[62]!==f?(Ee=f("sectionsEditor.sectionList.deleteMenuItem"),e[62]=f,e[63]=Ee):Ee=e[63];let Ie;e[64]!==He||e[65]!==Ee?(Ie=i.jsxs(sn,{variant:"destructive",onClick:He,children:[We,Ee]}),e[64]=He,e[65]=Ee,e[66]=Ie):Ie=e[66];let Ve;e[67]!==q||e[68]!==Ze||e[69]!==Ye||e[70]!==Q||e[71]!==ke||e[72]!==Ie?(Ve=i.jsxs(Hi,{align:"end",className:"w-44",children:[q,Ze,Ye,Q,ke,Ie]}),e[67]=q,e[68]=Ze,e[69]=Ye,e[70]=Q,e[71]=ke,e[72]=Ie,e[73]=Ve):Ve=e[73];let Xe;e[74]!==se||e[75]!==be||e[76]!==Ve?(Xe=i.jsxs(se,{children:[be,Ve]}),e[74]=se,e[75]=be,e[76]=Ve,e[77]=Xe):Xe=e[77];let Fe;return e[78]!==Y||e[79]!==M||e[80]!==v||e[81]!==ge||e[82]!==he||e[83]!==K||e[84]!==Se||e[85]!==ue||e[86]!==te||e[87]!==Xe||e[88]!==T?(Fe=i.jsxs("div",{ref:ge,style:he,...Y,...M,role:B,tabIndex:xe,onClick:v,onKeyDown:T,className:K,children:[Se,ue,te,Xe]}),e[78]=Y,e[79]=M,e[80]=v,e[81]=ge,e[82]=he,e[83]=K,e[84]=Se,e[85]=ue,e[86]=te,e[87]=Xe,e[88]=T,e[89]=Fe):Fe=e[89],Fe}function Jl(n){return n.stopPropagation()}function Ql(n){return n.stopPropagation()}function Zl(){return!1}function js(n){const e=it.c(11),{canAddSection:s,onAddSection:o,className:a,size:u}=n,h=Ft();let d;e[0]!==a?(d=ae("w-full",a),e[0]=a,e[1]=d):d=e[1];const v=!s;let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(fl,{size:14}),e[2]=m):m=e[2];let j;e[3]!==h?(j=h("sectionsEditor.sectionList.addSectionButton"),e[3]=h,e[4]=j):j=e[4];let A;return e[5]!==o||e[6]!==u||e[7]!==d||e[8]!==v||e[9]!==j?(A=i.jsxs(_t,{type:"button",variant:"outline",size:u,className:d,disabled:v,onClick:o,children:[m,j]}),e[5]=o,e[6]=u,e[7]=d,e[8]=v,e[9]=j,e[10]=A):A=e[10],A}function Xl(n){const e=it.c(101),{listKey:s,rawSections:o,sections:a,meta:u,decofile:h,selectedIndex:d,onSelect:v,onReorder:m,onDelete:j,onDuplicate:A,onMakeReusable:$,onToggleHidden:z,onToggleLazy:H,onAddVariant:F,onDetach:f,onAddSection:k,canAddSection:Z}=n,w=Z===void 0?!0:Z,I=Ft(),V=Wn();let y;e[0]!==a.length?(y=()=>io(a.length),e[0]=a.length,e[1]=y):y=e[1];const[C,x]=R.useState(y),[Y,M]=R.useState(null),[ge,me]=R.useState(s),[le,ee]=R.useState(a.length),pe=R.useRef(!1);ge!==s?(me(s),ee(a.length),x(io(a.length))):le!==a.length&&(ee(a.length),x(dt=>ql(dt,a.length)));let ce;e[2]===Symbol.for("react.memo_cache_sentinel")?(ce={activationConstraint:{distance:8}},e[2]=ce):ce=e[2];let he;e[3]===Symbol.for("react.memo_cache_sentinel")?(he={coordinateGetter:jl},e[3]=he):he=e[3];const ve=pl(to(gl,ce),to(hl,he));let b;e[4]!==C?(b=C.map(ec),e[4]=C,e[5]=b):b=e[5];const B=b;let xe;e[6]===Symbol.for("react.memo_cache_sentinel")?(xe=dt=>{M(String(dt.active.id))},e[6]=xe):xe=e[6];const T=xe;let ye;e[7]!==B||e[8]!==m?(ye=dt=>{M(null);const{active:ne,over:De}=dt;if(!De||ne.id===De.id)return;const yt=B.indexOf(String(ne.id)),et=B.indexOf(String(De.id));yt===-1||et===-1||(x(ft=>ko(Ln([...ft],yt,et))),pe.current=!0,requestAnimationFrame(()=>{pe.current=!1}),m?.(yt,et))},e[7]=B,e[8]=m,e[9]=ye):ye=e[9];const K=ye;let Se;e[10]===Symbol.for("react.memo_cache_sentinel")?(Se=()=>{M(null)},e[10]=Se):Se=e[10];const ue=Se;let te,se,Te,X,_e,be,q,O,Ke,Qe,Ze,Ye,Q,ke,He;if(e[11]!==Y||e[12]!==w||e[13]!==V||e[14]!==h||e[15]!==C||e[16]!==B||e[17]!==K||e[18]!==u||e[19]!==k||e[20]!==F||e[21]!==j||e[22]!==f||e[23]!==A||e[24]!==$||e[25]!==v||e[26]!==z||e[27]!==H||e[28]!==o||e[29]!==a||e[30]!==d||e[31]!==ve||e[32]!==I){ke=Symbol.for("react.early_return_sentinel");e:{const dt=ne=>{pe.current||v(ne)};if(e[48]!==Y||e[49]!==w||e[50]!==V||e[51]!==C||e[52]!==k||e[53]!==o||e[54]!==a||e[55]!==I){const ne=Y?C.find(De=>De.id===Y):null;if(X=ne!=null?a[ne.index]:null,Te=ne!=null?o[ne.index]:void 0,C.length===0){let De;e[59]!==I?(De=I("sectionsEditor.sectionList.noSections"),e[59]=I,e[60]=De):De=e[60];let yt;e[61]!==De?(yt=i.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:De}),e[61]=De,e[62]=yt):yt=e[62];const et=yt;let ft;e[63]!==w||e[64]!==V||e[65]!==et||e[66]!==k?(ft=V?et:i.jsxs("div",{className:"space-y-2",children:[et,i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm"})]}),e[63]=w,e[64]=V,e[65]=et,e[66]=k,e[67]=ft):ft=e[67],ke=ft;break e}Q=ae(ne&&"cursor-grabbing"),e[48]=Y,e[49]=w,e[50]=V,e[51]=C,e[52]=k,e[53]=o,e[54]=a,e[55]=I,e[56]=Te,e[57]=X,e[58]=Q}else Te=e[56],X=e[57],Q=e[58];se=yl,O=ve,Ke=Sl,Qe=T,Ze=K,Ye=ue,te=wl,be=B,q=_l,He="space-y-1",_e=C.map(ne=>{const De=a[ne.index];return De?i.jsx(Yl,{sortableId:ne.id,section:De,raw:o[ne.index],meta:u,decofile:h,selected:d===ne.index,onSelect:()=>dt(ne.index),onDelete:()=>j(ne.index),onDuplicate:()=>A(ne.index),onMakeReusable:()=>$(ne.index),onToggleHidden:()=>z(ne.index),onToggleLazy:H?()=>H(ne.index):void 0,onAddVariant:()=>F(ne.index),onDetach:()=>f(ne.index)},ne.id):null})}e[11]=Y,e[12]=w,e[13]=V,e[14]=h,e[15]=C,e[16]=B,e[17]=K,e[18]=u,e[19]=k,e[20]=F,e[21]=j,e[22]=f,e[23]=A,e[24]=$,e[25]=v,e[26]=z,e[27]=H,e[28]=o,e[29]=a,e[30]=d,e[31]=ve,e[32]=I,e[33]=te,e[34]=se,e[35]=Te,e[36]=X,e[37]=_e,e[38]=be,e[39]=q,e[40]=O,e[41]=Ke,e[42]=Qe,e[43]=Ze,e[44]=Ye,e[45]=Q,e[46]=ke,e[47]=He}else te=e[33],se=e[34],Te=e[35],X=e[36],_e=e[37],be=e[38],q=e[39],O=e[40],Ke=e[41],Qe=e[42],Ze=e[43],Ye=e[44],Q=e[45],ke=e[46],He=e[47];if(ke!==Symbol.for("react.early_return_sentinel"))return ke;let We;e[68]!==_e||e[69]!==He?(We=i.jsx("div",{className:He,children:_e}),e[68]=_e,e[69]=He,e[70]=We):We=e[70];let Ee;e[71]!==te||e[72]!==be||e[73]!==q||e[74]!==We?(Ee=i.jsx(te,{items:be,strategy:q,children:We}),e[71]=te,e[72]=be,e[73]=q,e[74]=We,e[75]=Ee):Ee=e[75];let Ie;e[76]!==Te||e[77]!==X||e[78]!==V||e[79]!==h||e[80]!==u?(Ie=X?i.jsx("div",{className:ae("cursor-grabbing shadow-lg ring-1 ring-border/60",Ro(X,!1,V)),children:i.jsx(Eo,{section:X,raw:Te,meta:u,decofile:h})}):null,e[76]=Te,e[77]=X,e[78]=V,e[79]=h,e[80]=u,e[81]=Ie):Ie=e[81];let Ve;e[82]!==Ie?(Ve=Li.createPortal(i.jsx(vl,{dropAnimation:Qi,children:Ie}),document.body),e[82]=Ie,e[83]=Ve):Ve=e[83];let Xe;e[84]!==se||e[85]!==O||e[86]!==Ke||e[87]!==Qe||e[88]!==Ze||e[89]!==Ye||e[90]!==Ee||e[91]!==Ve?(Xe=i.jsxs(se,{sensors:O,collisionDetection:Ke,onDragStart:Qe,onDragEnd:Ze,onDragCancel:Ye,children:[Ee,Ve]}),e[84]=se,e[85]=O,e[86]=Ke,e[87]=Qe,e[88]=Ze,e[89]=Ye,e[90]=Ee,e[91]=Ve,e[92]=Xe):Xe=e[92];let Fe;e[93]!==w||e[94]!==V||e[95]!==k?(Fe=!V&&i.jsx(js,{canAddSection:w,onAddSection:k,size:"sm",className:"mt-2"}),e[93]=w,e[94]=V,e[95]=k,e[96]=Fe):Fe=e[96];let re;return e[97]!==Q||e[98]!==Xe||e[99]!==Fe?(re=i.jsxs("div",{className:Q,children:[Xe,Fe]}),e[97]=Q,e[98]=Xe,e[99]=Fe,e[100]=re):re=e[100],re}function ec(n){return n.id}function hs(n,e,s,o){if(!n||!e)return null;if(!e.isMultivariate)return jt(n,e,o)?.data??null;const a=xt(n,e),u=a?vs(a,wt)[s]:void 0;return u?wo(u.value,o)?.data??null:null}const tc=50;function nc(n,e){n.own.push(ze(e)),n.own.length>tc&&n.own.shift()}function ao(n,e){return n.own.includes(ze(e))}function sc(n,e){const{sectionIndex:s,variantIndex:o,shown:a,next:u,sectionCount:h}=e;return n&&n.sectionIndex===s&&n.variantIndex===o&&n.emitted===a?(n.emitted=u,n):a?{sectionIndex:s,variantIndex:o,base:a,emitted:u,sectionCount:h,own:[ze(a)]}:null}function Ao(n,e){return e!==null&&ze(n)!==ze(e)}function Co(n,e){return n.__resolveType!==e.__resolveType}function rc(n,e,s,o){if(e.length===o)return"here";const a=ze(n),u=e.flatMap((h,d)=>d!==s&&h!==null&&ze(h)===a?[d]:[]);return u.length===1?u[0]:"unknown"}function lo({formBase:n,rebased:e,versionOf:s}){let o=null;return{ifMatch:a=>{o=a,n&&(n.version===void 0||e)&&(n.version=s(a));const u=n?n.version:s(a);return u===void 0?void 0:{[a]:u}},onApplied:a=>{n&&o!==null&&Object.hasOwn(a,o)&&(n.version=a[o])},reloadOnConflict:!0}}function oc({merged:n,tracked:e,current:s,saved:o}){return!!n&&!!e&&s===e&&e.emitted===o}function co(n,e){return!!n&&!!e&&n.contains(e)}function ws(n){const e=[],s=_s("",n.ancestor,n.mine,n.theirs,e);return{...n,merged:s,pointers:e}}function _s(n,e,s,o,a){const u=(h,d)=>ze(h)===ze(d);if(u(s,o)||u(e,o))return s;if(u(e,s))return o;if(gs(s)&&gs(o)){const h=gs(e)?e:{},d={},v=[...Object.keys(s),...Object.keys(o).filter(m=>!(m in s))];for(const m of v){const j=_s(`${n}/${m.replaceAll("~","~0").replaceAll("/","~1")}`,h[m],s[m],o[m],a);j!==void 0&&(d[m]=j)}return d}return Array.isArray(e)&&Array.isArray(s)&&Array.isArray(o)&&s.length===e.length&&o.length===e.length?e.map((h,d)=>_s(`${n}/${d}`,h,s[d],o[d],a)):(a.push(n),o)}function gs(n){return!!n&&typeof n=="object"&&!Array.isArray(n)}function ic(n,e){let s=n.merged;for(const o of n.pointers)e[o]==="mine"&&(s=uc(s,o,Ut(n.mine,o)));return s}function ac(n,e){return Object.fromEntries(n.pointers.map(s=>[s,e]))}function No(n){return ac(n,"mine")}function ks(n,e,s){const o=No(s);for(const a of s.pointers){const u=e[a];if(!u||!n.pointers.includes(a))continue;["mine","theirs"].every(d=>ze(Ut(n[d],a))===ze(Ut(s[d],a)))&&(o[a]=u)}return o}function To(n,e,s={}){const o=e.pointers.filter(a=>!n.pointers.includes(a)||ze(Ut(n.theirs,a))!==ze(Ut(e.theirs,a)));return o.length===0?s:{...s,...Object.fromEntries(o.map(a=>[a,(s[a]??0)+1]))}}function lc(n,e,s){if(!e||Co(n.plan.ancestor,e)||!Ao(n.plan.theirs,e)||s(e))return null;const o=ws({...n.plan,theirs:e});return o.pointers.length===0?null:{plan:o,choices:ks(n.plan,n.choices,o),fresh:To(n.plan,o,n.fresh)}}function cc(n,e){return n.pointers.map(s=>({pointer:s,label:oa(s,e),mine:Ut(n.mine,s),theirs:Ut(n.theirs,s),schema:dc(e??null,s)}))}function As(n){return n.split("/").slice(1).map(e=>e.replaceAll("~1","/").replaceAll("~0","~"))}function Ut(n,e){let s=n;for(const o of As(e))if(Array.isArray(s))s=s[Number(o)];else if(s&&typeof s=="object")s=s[o];else return;return s}function uc(n,e,s){const o=As(e),a=(u,h)=>{if(h===o.length)return s;const d=o[h];if(Array.isArray(u)){const j=[...u];return j[Number(d)]=a(u[Number(d)],h+1),j}const v=u&&typeof u=="object"?{...u}:{},m=a(v[d],h+1);return m===void 0?delete v[d]:v[d]=m,v};return a(n,0)}function dc(n,e){let s=n;for(const o of As(e)){if(!s)return null;s=/^\d+$/.test(o)&&!s.properties?.[o]?s.items:s.properties?.[o]}return s??null}const fc=/\.(png|jpe?g|gif|webp|avif|svg)(\?.*)?$/i,uo=60,mc=3;function Vo(n,e){return e?.format==="image-uri"?!0:n.startsWith("data:image/")||/^(https?:)?\/\//.test(n)&&fc.test(n)}function Es(n,e){if(!(e?.format==="rich-text"||e?.format==="rich-text-inline"||e?.format==="html"||/<\/?[a-z][^>]*>/i.test(n)))return n;const o=n.replace(/<br\s*\/?>/gi,`
|
|
2
2
|
`).replace(/<\/(p|div|li|h[1-6])>/gi,`
|
|
3
3
|
`);return hc(o).replace(/\u00a0/g," ").replace(/\n{2,}/g,`
|
|
4
|
-
`).trim()}const pc={" ":" ","&":"&","<":"<",">":">",""":'"',"'":"'"};function hc(n){if(typeof DOMParser<"u")return new DOMParser().parseFromString(n,"text/html").body.textContent??"";let e=n;for(let s="";s!==e;)s=e,e=e.replace(/<[^<>]*>/g,"");return e.replace(/<|>/g,"").replace(/&(nbsp|amp|lt|gt|quot|#39);/g,s=>pc[s]??s)}function $n(n){const e=n.replace(/\s+/g," ").trim();return e.length>uo?`${e.slice(0,uo-1)}…`:e}function gc(n){if(n.startsWith("data:"))return"image";const e=n.split(/[?#]/)[0]??n;return decodeURIComponent(e.split("/").pop()||n)}function Hn(n,e){if(n==null||n==="")return{kind:"empty"};if(typeof n=="string")return Vo(n,e)?{kind:"image",src:n}:{kind:"text",text:Es(n,e)};if(typeof n=="number"||typeof n=="bigint")return{kind:"text",text:String(n)};if(typeof n=="boolean")return{kind:"yesNo",value:n};if(Array.isArray(n)){const s=e?.items??null;return{kind:"list",count:n.length,items:n.slice(0,mc).map(o=>vc(o,s)??"")}}if(typeof n=="object"){const s=n;if("value"in s&&Object.keys(s).length<=2)return Hn(s.value,e?.properties?.value??e);const o=Object.entries(s).filter(([a,u])=>!a.startsWith("__")&&u!==void 0).flatMap(([a,u])=>{const h=e?.properties?.[a]??null,d=Hn(u,h);if(d.kind==="empty")return[];const v=d.kind==="text"?$n(d.text):d.kind==="image"?gc(d.src):d.kind==="yesNo"?d.value?"✓":"✗":d.kind==="list"?`${d.count}`:"…";return[{label:h?.title?.trim()||a,text:v}]}).slice(0,4);return o.length>0?{kind:"fields",entries:o}:{kind:"empty"}}return{kind:"text",text:String(n)}}function vc(n,e){if(typeof n=="string")return $n(Es(n,e));if(!n||typeof n!="object"||Array.isArray(n))return null;const s=n,o=e?.titleBy,a=o?s[o]:void 0;if(typeof a=="string"&&a.trim())return $n(a);for(const[u,h]of Object.entries(s))if(!(u.startsWith("__")||typeof h!="string"||!h.trim())&&!Vo(h,e?.properties?.[u]??null))return $n(Es(h,null));return null}const fo=1500;function xc(n,e){const s=n.split(/(\s+)/).filter(j=>j!==""),o=e.split(/(\s+)/).filter(j=>j!=="");if(s.length>fo||o.length>fo)return{mine:[{text:n,kind:"changed"}],theirs:[{text:e,kind:"changed"}]};const a=Array.from({length:s.length+1},()=>new Array(o.length+1).fill(0));for(let j=s.length-1;j>=0;j--)for(let A=o.length-1;A>=0;A--){const $=a[j];$[A]=s[j]===o[A]?a[j+1][A+1]+1:Math.max(a[j+1][A],$[A+1])}const u=[],h=[],d=(j,A,$)=>{const z=j.at(-1);z&&(z.kind===$||$==="same"&&!A.trim())?z.text+=A:j.push({text:A,kind:$})};let v=0,m=0;for(;v<s.length&&m<o.length;)s[v]===o[m]?(d(u,s[v],"same"),d(h,o[m],"same"),v++,m++):a[v+1][m]>=a[v][m+1]?(d(u,s[v],"changed"),v++):(d(h,o[m],"changed"),m++);for(;v<s.length;v++)d(u,s[v],"changed");for(;m<o.length;m++)d(h,o[m],"changed");return{mine:u,theirs:h}}function yc(n){const e=it.c(10);let s,o;e[0]!==n?({open:s,...o}=n,e[0]=n,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{data:a}=xo.useSession();let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=ae("max-h-[85vh] grid-rows-[auto_minmax(0,1fr)_auto] sm:max-w-lg"),e[3]=u):u=e[3];const h=a?.user??null;let d;e[4]!==o||e[5]!==h?(d=i.jsx(Cl,{className:u,"data-testid":"form-conflict-dialog",onEscapeKeyDown:jc,onOpenAutoFocus:bc,children:i.jsx(Ac,{...o,viewer:h,heading:Sc})}),e[4]=o,e[5]=h,e[6]=d):d=e[6];let v;return e[7]!==s||e[8]!==d?(v=i.jsx(Dl,{open:s,children:d}),e[7]=s,e[8]=d,e[9]=v):v=e[9],v}function Sc(n,e){return i.jsxs(Nl,{className:"text-left",children:[i.jsx(Tl,{children:n}),i.jsx(Vl,{children:e})]})}function bc(n){n.preventDefault(),n.currentTarget?.focus()}function jc(n){return n.preventDefault()}const wc={},_c=(n,e)=>i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:n}),i.jsx("p",{className:"text-sm text-muted-foreground",children:e})]});function kc(n,e,s=0,o={},a=null){const u=e[Math.min(s,e.length-1)],h=a?.you?void 0:a?.name?.split(/\s+/)[0],d={field:u?Rc(u.label):"",label:u?.label??"",name:h??""},v=(m,j,A)=>n(a?.you?A:h?j:m,d);return e.length<=1?{title:v("sectionsEditor.formConflict.titleOne","sectionsEditor.formConflict.titleOneNamed","sectionsEditor.formConflict.titleOneYou"),description:n("sectionsEditor.formConflict.descriptionOne")}:{title:v("sectionsEditor.formConflict.titleStep","sectionsEditor.formConflict.titleStepNamed","sectionsEditor.formConflict.titleStepYou"),description:s>=e.length-1?i.jsx(Ec,{t:n,fields:e,choices:o,name:h}):n("sectionsEditor.formConflict.descriptionStep")}}function Ec(n){const e=it.c(11),{t:s,fields:o,choices:a,name:u}=n;let h;if(e[0]!==a||e[1]!==o||e[2]!==u||e[3]!==s){let v;e[5]!==a||e[6]!==u||e[7]!==s?(v=(m,j)=>i.jsxs(R.Fragment,{children:[j>0&&" · ",`${m.label}: `,i.jsx("span",{className:"font-medium text-foreground",children:s((a[m.pointer]??"mine")==="mine"?"sectionsEditor.formConflict.summaryYours":u?"sectionsEditor.formConflict.summaryTheirsNamed":"sectionsEditor.formConflict.summaryTheirs",{name:u??""})})]},m.pointer),e[5]=a,e[6]=u,e[7]=s,e[8]=v):v=e[8],h=o.map(v),e[0]=a,e[1]=o,e[2]=u,e[3]=s,e[4]=h}else h=e[4];let d;return e[9]!==h?(d=i.jsx("span",{"data-testid":"form-conflict-summary",children:h}),e[9]=h,e[10]=d):d=e[10],d}function Rc(n){return/^[A-Z][a-z]/.test(n)&&!n.includes("›")?n.charAt(0).toLowerCase()+n.slice(1):n}function Ac(n){const e=it.c(68),s=Ft(),{fields:o,choices:a,changedAgain:u,fresh:h,heading:d}=n,v=u===void 0?!1:u,m=h===void 0?wc:h,j=d===void 0?_c:d,A=o.length>1,[$,z]=R.useState(0),[H,F]=R.useState(Cc);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];const[k,X]=R.useState(f),w=Math.max(0,Math.min($,o.length-1)),I=o[w],V=w===o.length-1;let y;e[1]!==w||e[2]!==o||e[3]!==m?(y=Se=>{const ue=o[w],te=o[Se];!ue||!te||Se===w||(F(se=>new Set(se).add(ue.pointer)),X(se=>({...se,[ue.pointer]:m[ue.pointer]??0,[te.pointer]:m[te.pointer]??0})),z(Se))},e[1]=w,e[2]=o,e[3]=m,e[4]=y):y=e[4];const C=y;let x;e[5]!==w||e[6]!==C?(x=Se=>{if(!Se)return;const ue=te=>{const se={ArrowLeft:-1,ArrowRight:1}[te.key];!se||te.defaultPrevented||te.altKey||te.ctrlKey||te.metaKey||te.shiftKey||Pl(te.target)||(te.preventDefault(),C(w+se))};return Se.ownerDocument.addEventListener("keydown",ue),()=>Se.ownerDocument.removeEventListener("keydown",ue)},e[5]=w,e[6]=C,e[7]=x):x=e[7];const Y=x;if(!I)return null;let M,ge,me,le,ee;if(e[8]!==H||e[9]!==w||e[10]!==a||e[11]!==o||e[12]!==m||e[13]!==C||e[14]!==j||e[15]!==Y||e[16]!==A||e[17]!==n||e[18]!==k||e[19]!==s){const{title:Se,description:ue}=kc(s,o,w,a,n.author??null);let te;e[25]!==n?(te=se=>{se.detail>1||n.onApply()},e[25]=n,e[26]=te):te=e[26],M=te,ge=A?Y:void 0,me="flex min-w-0 flex-col gap-3",e[27]!==H||e[28]!==w||e[29]!==o||e[30]!==m||e[31]!==C||e[32]!==A||e[33]!==k||e[34]!==s?(le=A&&i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("div",{role:"group","aria-label":s("sectionsEditor.formConflict.steps"),className:"-m-1 flex flex-wrap items-center",children:o.map((se,Te)=>{const Z=Te!==w&&(m[se.pointer]??0)>(k[se.pointer]??0);return i.jsx("button",{type:"button","aria-label":Z?s("sectionsEditor.formConflict.stepChangedAgain",{label:se.label}):se.label,"aria-current":Te===w?"step":void 0,"data-answered":Te!==w&&H.has(se.pointer)?"":void 0,"data-changed-again":Z?"":void 0,onClick:()=>C(Te),className:"group cursor-pointer rounded-full p-1 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:i.jsx("span",{className:ae("block h-2 w-2 rounded-full bg-border transition-[width,background-color,box-shadow] motion-reduce:transition-none","group-hover:bg-muted-foreground/60","group-data-[answered]:bg-foreground/45","group-aria-[current=step]:w-5 group-aria-[current=step]:bg-foreground","group-data-[changed-again]:ring-2 group-data-[changed-again]:ring-warning group-data-[changed-again]:ring-offset-1 group-data-[changed-again]:ring-offset-background")})},se.pointer)})}),i.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:s("sectionsEditor.formConflict.stepCount",{step:String(w+1),count:String(o.length)})})]}),e[27]=H,e[28]=w,e[29]=o,e[30]=m,e[31]=C,e[32]=A,e[33]=k,e[34]=s,e[35]=le):le=e[35],ee=j(Se,ue),e[8]=H,e[9]=w,e[10]=a,e[11]=o,e[12]=m,e[13]=C,e[14]=j,e[15]=Y,e[16]=A,e[17]=n,e[18]=k,e[19]=s,e[20]=M,e[21]=ge,e[22]=me,e[23]=le,e[24]=ee}else M=e[20],ge=e[21],me=e[22],le=e[23],ee=e[24];let pe;e[36]!==ge||e[37]!==me||e[38]!==le||e[39]!==ee?(pe=i.jsxs("div",{ref:ge,className:me,children:[le,ee]}),e[36]=ge,e[37]=me,e[38]=le,e[39]=ee,e[40]=pe):pe=e[40];const ce=!v&&"sr-only";let he;e[41]!==ce?(he=ae("text-sm text-muted-foreground",ce),e[41]=ce,e[42]=he):he=e[42];let ve;e[43]!==v||e[44]!==A||e[45]!==s?(ve=v?s(A?"sectionsEditor.formConflict.changedAgainSteps":"sectionsEditor.formConflict.changedAgain"):"",e[43]=v,e[44]=A,e[45]=s,e[46]=ve):ve=e[46];let b;e[47]!==he||e[48]!==ve?(b=i.jsx("p",{role:"status",className:he,children:ve}),e[47]=he,e[48]=ve,e[49]=b):b=e[49];const B=A?"vertical":"all";let xe;e[50]!==I||e[51]!==n||e[52]!==B?(xe=i.jsx(Dc,{field:I,...n,arrows:B}),e[50]=I,e[51]=n,e[52]=B,e[53]=xe):xe=e[53];let T;e[54]!==b||e[55]!==xe?(T=i.jsxs("div",{className:"-mx-2 flex min-h-0 flex-col gap-3 overflow-y-auto px-2 py-1",children:[b,xe]}),e[54]=b,e[55]=xe,e[56]=T):T=e[56];let ye;e[57]!==M||e[58]!==w||e[59]!==C||e[60]!==V||e[61]!==A||e[62]!==s?(ye=A?i.jsxs(no,{className:"flex-row flex-wrap items-center justify-between gap-2 sm:justify-between",children:[i.jsx(_t,{type:"button",variant:"outline","aria-disabled":w===0,onClick:()=>C(w-1),className:"aria-disabled:cursor-default aria-disabled:opacity-45",children:s("sectionsEditor.formConflict.back")}),i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:V?M:()=>C(w+1),children:s(V?"sectionsEditor.formConflict.ok":"sectionsEditor.formConflict.next")})]}):i.jsx(no,{className:"items-center gap-2",children:i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:M,children:s("sectionsEditor.formConflict.ok")})}),e[57]=M,e[58]=w,e[59]=C,e[60]=V,e[61]=A,e[62]=s,e[63]=ye):ye=e[63];let K;return e[64]!==pe||e[65]!==T||e[66]!==ye?(K=i.jsxs(i.Fragment,{children:[pe,T,ye]}),e[64]=pe,e[65]=T,e[66]=ye,e[67]=K):K=e[67],K}function Cc(){return new Set}function Nc(n){const e=Hn(n.mine,n.schema),s=Hn(n.theirs,n.schema),o=e.kind==="text"&&s.kind==="text"?xc(e.text,s.text):null;return a=>o?i.jsx(Pc,{parts:o[a]}):i.jsx(Bc,{preview:a==="mine"?e:s})}const Tc={all:{ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},vertical:{ArrowDown:1,ArrowUp:-1}};function Vc(n,e){const s=Tc[e][n.key];if(!s)return;const o=[...n.currentTarget.querySelectorAll('[role="radio"]')],a=o.indexOf(document.activeElement);if(a<0)return;n.preventDefault();const u=o[(a+s+o.length)%o.length];u?.focus(),u?.click()}function Dc(n){const e=it.c(65),{field:s,choices:o,viewer:a,author:u,onChoose:h,arrows:d}=n,v=u===void 0?null:u,m=Ft(),[j]=Wi(),{language:A}=j;let $,z,H,F,f,k,X,w,I,V,y,C,x,Y;if(e[0]!==d||e[1]!==v||e[2]!==o||e[3]!==s||e[4]!==A||e[5]!==h||e[6]!==m||e[7]!==a?.image||e[8]!==a?.name){const me=Nc(s),le=o[s.pointer]??"mine",ee=a?.image??void 0;let pe;e[23]!==m||e[24]!==a?.name?(pe=mo(a?.name)||m("sectionsEditor.formConflict.you"),e[23]=m,e[24]=a?.name,e[25]=pe):pe=e[25];let ce;e[26]!==ee||e[27]!==pe?(ce=i.jsx(ms,{url:ee,fallback:pe,shape:"circle",size:"sm",className:"text-xs"}),e[26]=ee,e[27]=pe,e[28]=ce):ce=e[28];const he=ce;let ve;e[29]!==v||e[30]!==he?(ve=v?.you?he:v?.name?i.jsx(ms,{url:v.avatarUrl,fallback:mo(v.name),shape:"circle",size:"sm",className:"text-xs"}):i.jsx(ms,{url:"icon://user",fallback:"",muted:!0,shape:"circle",size:"sm"}),e[29]=v,e[30]=he,e[31]=ve):ve=e[31];const b=ve,B=v?new Date(v.at):null;H="radiogroup",F=s.label,f="flex flex-col gap-2",e[32]!==d?(k=K=>Vc(K,d),e[32]=d,e[33]=k):k=e[33];let xe;e[34]!==s.pointer||e[35]!==h?(xe=()=>h(s.pointer,"mine"),e[34]=s.pointer,e[35]=h,e[36]=xe):xe=e[36];let T;e[37]!==m?(T=m("sectionsEditor.formConflict.you"),e[37]=m,e[38]=T):T=e[38];let ye;e[39]!==m?(ye=m("sectionsEditor.formConflict.yourVersionNotSaved"),e[39]=m,e[40]=ye):ye=e[40],X=i.jsx(po,{side:"mine",checked:le==="mine",onChoose:xe,avatar:he,who:T,meta:ye,children:me("mine")}),$=po,w="theirs",I=le==="theirs",e[41]!==s.pointer||e[42]!==h?(V=()=>h(s.pointer,"theirs"),e[41]=s.pointer,e[42]=h,e[43]=V):V=e[43],y=b,e[44]!==v?.name||e[45]!==v?.you||e[46]!==m?(C=v?.you?m("sectionsEditor.formConflict.youElsewhere"):v?.name||m("sectionsEditor.formConflict.someoneElse"),e[44]=v?.name,e[45]=v?.you,e[46]=m,e[47]=C):C=e[47],x=B?m("sectionsEditor.formConflict.savedAt",{when:Ml(B,A)}):m("sectionsEditor.formConflict.theirVersionSaved"),Y=B?Mc(B,A):void 0,z=me("theirs"),e[0]=d,e[1]=v,e[2]=o,e[3]=s,e[4]=A,e[5]=h,e[6]=m,e[7]=a?.image,e[8]=a?.name,e[9]=$,e[10]=z,e[11]=H,e[12]=F,e[13]=f,e[14]=k,e[15]=X,e[16]=w,e[17]=I,e[18]=V,e[19]=y,e[20]=C,e[21]=x,e[22]=Y}else $=e[9],z=e[10],H=e[11],F=e[12],f=e[13],k=e[14],X=e[15],w=e[16],I=e[17],V=e[18],y=e[19],C=e[20],x=e[21],Y=e[22];let M;e[48]!==$||e[49]!==z||e[50]!==w||e[51]!==I||e[52]!==V||e[53]!==y||e[54]!==C||e[55]!==x||e[56]!==Y?(M=i.jsx($,{side:w,checked:I,onChoose:V,avatar:y,who:C,meta:x,metaTitle:Y,children:z}),e[48]=$,e[49]=z,e[50]=w,e[51]=I,e[52]=V,e[53]=y,e[54]=C,e[55]=x,e[56]=Y,e[57]=M):M=e[57];let ge;return e[58]!==H||e[59]!==F||e[60]!==f||e[61]!==k||e[62]!==X||e[63]!==M?(ge=i.jsxs("div",{role:H,"aria-label":F,className:f,onKeyDown:k,children:[X,M]}),e[58]=H,e[59]=F,e[60]=f,e[61]=k,e[62]=X,e[63]=M,e[64]=ge):ge=e[64],ge}const Mc=(n,e)=>n.toLocaleString(e,{dateStyle:"medium",timeStyle:"short"});function mo(n){return(n??"").trim().split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join("")}function po(n){const e=it.c(28),{side:s,checked:o,onChoose:a,avatar:u,who:h,meta:d,metaTitle:v,children:m}=n,j=R.useId(),A=`${j}-who`,$=`${j}-meta ${j}-value`,z=o?0:-1,H=o?"border-primary bg-primary/5 ring-1 ring-primary":"hover:bg-muted/50";let F;e[0]!==H?(F=ae("grid w-full cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-start gap-3 rounded-xl border bg-background p-3 text-left transition-[border-color,box-shadow,background-color] outline-none","focus-visible:ring-2 focus-visible:ring-ring/50",H),e[0]=H,e[1]=F):F=e[1];const f=`${j}-who`;let k;e[2]!==f||e[3]!==h?(k=i.jsx("span",{id:f,className:"text-sm font-medium text-foreground",children:h}),e[2]=f,e[3]=h,e[4]=k):k=e[4];const X=`${j}-meta`;let w;e[5]!==d||e[6]!==v||e[7]!==X?(w=i.jsx("span",{id:X,title:v,children:d}),e[5]=d,e[6]=v,e[7]=X,e[8]=w):w=e[8];let I;e[9]!==k||e[10]!==w?(I=i.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[k,w]}),e[9]=k,e[10]=w,e[11]=I):I=e[11];const V=`${j}-value`,y=`conflict-${s}`;let C;e[12]!==m||e[13]!==V||e[14]!==y?(C=i.jsx("span",{id:V,"data-testid":y,className:"min-w-0 text-sm",children:m}),e[12]=m,e[13]=V,e[14]=y,e[15]=C):C=e[15];let x;e[16]!==I||e[17]!==C?(x=i.jsxs("span",{className:"flex min-w-0 flex-col gap-1",children:[I,C]}),e[16]=I,e[17]=C,e[18]=x):x=e[18];let Y;return e[19]!==u||e[20]!==o||e[21]!==a||e[22]!==A||e[23]!==x||e[24]!==$||e[25]!==z||e[26]!==F?(Y=i.jsxs("button",{type:"button",role:"radio","aria-checked":o,"aria-labelledby":A,"aria-describedby":$,tabIndex:z,onClick:a,className:F,children:[u,x]}),e[19]=u,e[20]=o,e[21]=a,e[22]=A,e[23]=x,e[24]=$,e[25]=z,e[26]=F,e[27]=Y):Y=e[27],Y}function Pc(n){const e=it.c(4),{parts:s}=n;let o;e[0]!==s?(o=s.map(Ic),e[0]=s,e[1]=o):o=e[1];let a;return e[2]!==o?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:o}),e[2]=o,e[3]=a):a=e[3],a}function Ic(n,e){return n.kind==="changed"?i.jsx("mark",{className:"rounded-sm bg-warning/20 px-0.5 text-foreground",children:n.text},e):i.jsx("span",{children:n.text},e)}function Bc(n){const e=it.c(29),{preview:s}=n,o=Ft();switch(s.kind){case"empty":{let a;e[0]!==o?(a=o("sectionsEditor.formConflict.empty"),e[0]=o,e[1]=a):a=e[1];let u;return e[2]!==a?(u=i.jsx("span",{className:"italic text-muted-foreground",children:a}),e[2]=a,e[3]=u):u=e[3],u}case"text":{let a;return e[4]!==s.text?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:s.text}),e[4]=s.text,e[5]=a):a=e[5],a}case"image":{let a;return e[6]!==s.src?(a=i.jsx("img",{src:s.src,alt:"",className:"max-h-24 max-w-full rounded border object-contain"}),e[6]=s.src,e[7]=a):a=e[7],a}case"yesNo":{const a=s.value?"sectionsEditor.formConflict.yes":"sectionsEditor.formConflict.no";let u;e[8]!==o||e[9]!==a?(u=o(a),e[8]=o,e[9]=a,e[10]=u):u=e[10];let h;return e[11]!==u?(h=i.jsx("span",{children:u}),e[11]=u,e[12]=h):h=e[12],h}case"list":{const a=s.count===1?"sectionsEditor.formConflict.oneItem":"sectionsEditor.formConflict.items",u=String(s.count);let h;e[13]!==o||e[14]!==a||e[15]!==u?(h=o(a,{count:u}),e[13]=o,e[14]=a,e[15]=u,e[16]=h):h=e[16];let d;e[17]!==h?(d=i.jsx("span",{className:"text-muted-foreground",children:h}),e[17]=h,e[18]=d):d=e[18];let v;e[19]!==s.count||e[20]!==s.items?(v=s.items.some(Boolean)&&i.jsxs("span",{className:"flex flex-col",children:[s.items.map(Fc),s.count>s.items.length&&i.jsx("span",{children:"…"})]}),e[19]=s.count,e[20]=s.items,e[21]=v):v=e[21];let m;return e[22]!==d||e[23]!==v?(m=i.jsxs("span",{className:"flex flex-col gap-1",children:[d,v]}),e[22]=d,e[23]=v,e[24]=m):m=e[24],m}case"fields":{let a;e[25]!==s.entries?(a=s.entries.map(Kc),e[25]=s.entries,e[26]=a):a=e[26];let u;return e[27]!==a?(u=i.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5",children:a}),e[27]=a,e[28]=u):u=e[28],u}}}function Kc(n){return i.jsxs("div",{className:"contents",children:[i.jsx("dt",{className:"text-muted-foreground",children:n.label}),i.jsx("dd",{className:"truncate",children:n.text})]},n.label)}function Fc(n,e){return i.jsx("span",{className:"truncate",children:`${e+1}. ${n||"…"}`},e)}function Oc(n,e){return n.kind==="protocol"&&n.source==="github"?e:null}function Lc(n,e){if(Object.hasOwn(n,e))return n[e]??null;const s=Yr(e),o=Object.keys(n).find(a=>Yr(a)===s);return o===void 0?null:n[o]??null}async function $c(n,e){try{const s=await fetch(`/api/${n.orgSlug}/decofile/${encodeURIComponent(n.virtualMcpId)}/${encodeURIComponent(n.branch)}`,{cache:"no-store",headers:Na("v8")});if(!s.ok)return null;const o=await s.json().catch(()=>({})),a=Lc(o.changedBy??{},e);return a&&typeof a.userId=="string"&&Number.isFinite(Date.parse(a.at))?a:null}catch{return null}}function zc(n,e,s){const o=e.find(h=>h.userId===n.userId),a=o?.user?.name?.trim(),u=o?.user?.image??void 0;return{...a?{name:a}:{},...u?{avatarUrl:u}:{},at:n.at,you:!!s&&n.userId===s}}function Hc(n){let e=2166136261,s=0;for(let o=0;o<n.length;o++){const a=n.charCodeAt(o);e=Math.imul(e^a,16777619),s=Math.imul(s,31)+a|0}return`${(e>>>0).toString(36)}${(s>>>0).toString(36)}:${n.length}`}function Wc(n,e,s){const o=it.c(19),a=!!n&&!!e&&s!==null;let u;o[0]!==e||o[1]!==n||o[2]!==s?(u=yo.conflictAuthor(n?`${n.orgSlug}/${n.virtualMcpId}/${n.branch}`:"",e??"",s??""),o[0]=e,o[1]=n,o[2]=s,o[3]=u):u=o[3];let h;o[4]!==e||o[5]!==n?(h=()=>$c(n,e),o[4]=e,o[5]=n,o[6]=h):h=o[6];let d;o[7]!==a||o[8]!==u||o[9]!==h?(d={queryKey:u,queryFn:h,enabled:a,staleTime:Number.POSITIVE_INFINITY,gcTime:6e5,retry:!1,refetchOnWindowFocus:!1},o[7]=a,o[8]=u,o[9]=h,o[10]=d):d=o[10];const{data:v}=qi(d),m=a?v??null:null,j=!!m;let A;o[11]!==j?(A={enabled:j},o[11]=j,o[12]=A):A=o[12];const{data:$}=Il(A);let z;o[13]!==$?(z=$?.data?.members??[],o[13]=$,o[14]=z):z=o[14];const H=z,{data:F}=xo.useSession();if(!m)return null;const f=F?.user?.id??null;let k;return o[15]!==m||o[16]!==H||o[17]!==f?(k=zc(m,H,f),o[15]=m,o[16]=H,o[17]=f,o[18]=k):k=o[18],k}function qc(n,e,s,o){if(!n||typeof n!="object")return{kind:"error",reason:"no-matcher-rule"};const a=e.trim();if(!a)return Gt(n,s,o)?{kind:"inline",blockKey:n.__resolveType??"",inlinedRule:xs(n,s,o)}:{kind:"noop"};const u=ys(n,s,o);if(!u)return{kind:"error",reason:"unreadable-rule"};if(u.blockKey)return{kind:"updateBlock",blockKey:u.blockKey,blockData:Kt(u.resolveType,u.data,a)};const h=Fn(a),d=On(h,s);return d?{kind:"error",reason:"invalid-block-id",message:d}:{kind:"createBlock",blockId:h,blockData:Kt(u.resolveType,u.data,a),reference:on(h)}}const ho="section-form-stale-save",Gc=3,Uc=1e3;function go(n,e){const s=e.global&&e.pageKey?[{label:"Default",sections:[{__resolveType:e.pageKey}]}]:So(e.pageKey?n[e.pageKey]?.sections:void 0,n),o=Math.max(0,Math.min(e.pageVariantIndex,s.length-1)),a=s[o]?.sections??[];return{pageVariants:s,variantIndex:o,rawSections:a,parsedSections:_n(a,n)}}const vo=new WeakMap;let Yc=0;function Jc(n){let e=vo.get(n);return e===void 0&&(e=++Yc,vo.set(n,e)),e}function tm({orgSlug:n,virtualMcpId:e,branch:s,previewReady:o=!0,previewUrl:a,currentPath:u,activePageBlockKey:h=null,activeGlobalBlockKey:d=null,externalSelection:v,onSaved:m,initialEditSeo:j=!1,onExitSeo:A,onSelectRoot:$,onViewJsonFile:z,onFocusedBlockChange:H,onVariantPreviewOverride:F}){const f=Ft(),k=Yi(),X=k?.taskId??null,w=o?{orgSlug:n,virtualMcpId:e,branch:s,threadId:X,previewUrl:a}:null,[I,V]=R.useState([]),{data:y,isLoading:C}=Ta(w,{pollWhile:I.length>0}),{data:x,isLoading:Y}=ia(w),M=Wn(),ge=k?.virtualMcpId,le=ka(ge===e?e:null)?.metadata?.siteSlug??null,ee=Rl({virtualMcpId:e,branch:s,sandboxUrl:a}),pe=Va(e,s),ce=Da(pe),he=!ce,ve=!!ee||ce,[b,B]=R.useState(null),[xe,T]=R.useState(null),[ye,K]=R.useState(null),[Se,ue]=R.useState(0),[te,se]=R.useState(void 0),[Te,Z]=R.useState(null),[_e,be]=R.useState(null),[q,O]=R.useState([]),Ke=R.useRef(null),[Qe,Xe]=R.useState(q.length);Qe!==q.length&&(Xe(q.length),requestAnimationFrame(()=>{Ke.current&&(Ke.current.scrollTop=0)}));const[Ye,Q]=R.useState(0),[ke,He]=R.useState(null),[We,Ee]=R.useState(null),[Ie,Ve]=R.useState(null),[Ze,Fe]=R.useState(!1),[re,dt]=R.useState(!1),ne=R.useRef(null),[De,yt]=R.useState(!0),[et,ft]=R.useState(!1),[Ot,kn]=R.useState(!1),[qe,an]=R.useState(j),[Cs,Ns]=R.useState(j);j&&!Cs&&(Ns(!0),an(!0),B(null),T(null),K(null),O([])),!j&&Cs&&Ns(!1);const[Do,ln]=R.useState(null),[Ts,En]=R.useState(void 0),[Vs,Lt]=R.useState([]),[Ds,Yt]=R.useState(0),[Je,at]=R.useState(0),[Mo,tt]=R.useState(null),[Jt,st]=R.useState(null),[Ms,Ps]=R.useState(null),Is=Gi(),Bs=Ma({orgSlug:n,virtualMcpId:e,branch:s},{tunnel:!1}),cn=aa({orgSlug:n,virtualMcpId:e,branch:s}),[Po,Io]=R.useState(u),[Bo,Ko]=R.useState(h),[Fo,Oo]=R.useState(d);(Po!==u||Bo!==h||Fo!==d)&&(queueMicrotask(()=>cn.flush()),Io(u),Ko(h),Oo(d),B(null),T(null),K(null),ue(0),Z(null),be(null),at(0),tt(null),st(null),O([]),Q(t=>t+1),an(!1),ln(null),En(void 0),Lt([]),Yt(t=>t+1));const G=la({orgSlug:n,virtualMcpId:e,branch:s}),un=ja((t,r)=>{G.mutate({blockKey:t,data:r},{onSuccess:()=>m?.(),onError:G.reportError})}),Rn=Oa({orgSlug:n,virtualMcpId:e,branch:s}),[Qt,Xt]=R.useState(!1),W=R.useRef(null),At=R.useRef(null),mt=R.useRef(null),pt=R.useRef(null),An=R.useRef({}),$t=R.useRef(null),dn=R.useRef(!1),fn=R.useRef(!1),Oe=R.useRef(new Map),Zt=R.useRef(!1),St=R.useRef([]),qn=R.useRef(new WeakSet);Pa(n,e,t=>{const{activePageKey:r,rawSections:l,parsedSections:c,selectedSectionIndex:p}=Le.current,S=new Set;r&&S.add(r);for(const g of[At.current?.sectionIndex,p]){const _=g==null?void 0:l[g],L=g==null?void 0:c[g],N=_&&L?.isSavedBlock?ds(_,L):null;N&&S.add(N)}if([...S].some(g=>t.has(g))){for(const g of[W,mt,pt])g.current&&clearTimeout(g.current),g.current=null;At.current=null,Oe.current.clear(),r&&t.has(r)&&(An.current={})}});const Le=R.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null}),[Ks,Fs]=R.useState(0),[Lo,$o]=R.useState(0),zo=Wc(Oc(pe,{orgSlug:n,virtualMcpId:e,branch:s}),I[0]?.blockKey??null,I[0]?Hc(ze(I[0].plan.theirs)):null),[Ho,Wo]=R.useState(null),Gn=Ia(n,e).epoch,[qo,Go]=R.useState(Gn);if(!o||C||Y)return i.jsx("div",{className:"h-full w-full flex items-center justify-center",children:i.jsx(Ui,{className:"size-5 text-muted-foreground"})});if(!y||!x)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const Uo=Ha(y,x),ie=!!d,je=ie?null:Wa(Uo,u,h),E=ie?d:je?.key??null,Un=ie&&d?y[d]:void 0,Os=ie&&d&&Un?qa(d,Un):ie&&d?d:"",mn=!ie&&E&&y[E]?y[E]:null,Yn=qe&&y&&x&&E&&je?Kr(y,{kind:"page",pageKey:E,pageName:String(je.name??""),path:String(je.path??"")},x):null,Yo=qe?mn?.seo:void 0,Cn=Ts!==void 0?Ts:Yo,Jo=qe?ca(Cn):void 0,Ls=Yn?.seoTypeOptions??[],$s=qe&&x?ua(x):"",Jn=Do??Jo??{},Nn=qe&&Yn?Bl(Jn,Yn):null,zs=qe&&Nn&&da(Cn)?Kn(Nn,x):null,Hs=qe?fa(y,x)?.seoData:void 0,Me=ie?[{label:"Default",sections:[{__resolveType:d}]}]:So(mn?.sections,y??{}),ht=Me.length>1,we=Math.min(Se,Me.length-1),rt=Me[we],U=rt?.sections??[],Pe=_n(U,y),Qn=!ie&&Ga(mn?.sections);if(ie&&d&&Ms!==d){Ps(d);const t=U[0],r=Pe[0];if(t&&r){B(0),at(0),O([]);const l=jt(t,r,y);l&&(T(l.data),K(l.resolveType),st(null),tt(null))}}!ie&&Ms!==null&&Ps(null),Le.current={rawSections:U,parsedSections:Pe,decofile:y??{},activePageKey:E,pageVariants:Me,variantIndex:we,sectionVariantIndex:Je,selectedSectionIndex:b};const Qo=()=>({multivariate:Qn,index:we,variants:Me.map(t=>({rule:t.rule}))}),Xn=(t,r)=>{if(!F)return;if(!E||!Qn||t.length<=1){F(null);return}const l={multivariate:!0,index:r,variants:t},c=ce?ro(E,l):oo(E,l,y,x);F(c.length>0?c:null)},Zn=F&&E&&Qn&&ht&&!C&&!Y?E:null;if(Zn!==Ho&&(Wo(Zn),Zn)){const t=Me.map(l=>({rule:l.rule})),r=we;queueMicrotask(()=>Xn(t,r))}const en=(t,r,l)=>{if(!F)return;if(!E){F(null);return}const c=Qo(),p=ce?ro(E,c):oo(E,c,y,x);if(!t||r<0){F(p.length>0?p:null);return}const S={pageKey:E,page:c,sectionIndex:r,sectionLazy:Pe[r]?.isLazy??!1,mvObj:t,selectedVariantIndex:l},g=ce?Fl(S):Ol({...S,decofile:y,meta:x}),_=[...p,...g];F(_.length>0?_:null)},bt=(t,r,l,c=b??-1,p=!1)=>{const S=xt(t,r);if(!S){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const _=vs(S,wt)[l];if(!_){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const L=wo(_.value,y);T(L?.data??null),K(L?.resolveType??null);const{resolveType:N,formValue:D}=jn(_.rule,y,x??void 0);st(N),tt(D),p&&en(S,c,l)},pn=v?.index;if(v!==void 0&&(v?.seq??null)!==te&&(se(v?.seq??null),typeof pn=="number")){const t=U[pn],r=Pe[pn];if(t&&r)if(B(pn),at(0),O([]),Q(l=>l+1),r.isMultivariate)bt(t,r,0,pn);else{const l=jt(t,r,y);l?(T(l.data),K(l.resolveType)):(T(null),K(null)),st(null),tt(null)}}if(Gn!==qo){Go(Gn);const t=W.current!==null||Oe.current.size>0||pt.current!==null||mt.current!==null||G.isPending||cn.isPending||I.length>0,r=b!==null&&co(Ke.current,document.activeElement);if(!t&&r&&(Zt.current=!0),!t&&!r&&b!==null){const l=U[b],c=Pe[b];if(O([]),Q(p=>p+1),!l||!c)B(null),T(null),K(null);else if(c.isMultivariate)bt(l,c,Je,b);else{const p=jt(l,c,y);T(p?.data??null),K(p?.resolveType??null)}}!t&&qe&&(ln(null),En(void 0),Yt(l=>l+1))}if(Ks!==Lo){$o(Ks);const t=b!==null?U[b]:null,r=b!==null?Pe[b]:null;if(t&&r&&b!==null)if(O([]),Q(l=>l+1),r.isMultivariate)bt(t,r,Je,b);else{const l=jt(t,r,y);T(l?.data??null),K(l?.resolveType??null)}}const lt=I[0];if(lt){const{formBase:t,target:r}=lt,l=go(y,r),c=t.sectionIndex,p=l.rawSections.length===t.sectionCount?hs(l.rawSections[c],l.parsedSections[c],r.sectionVariantIndex,y):null,S=lc(lt,p,g=>ao(t,g));if(S){const _=[{...lt,...S,changedAgain:!0},...I.slice(1)];St.current=_,V(_)}}const hn={orgSlug:n,virtualMcpId:e,branch:s,threadId:X,previewUrl:ce?void 0:a??void 0,siteSlug:le},Tn=ye&&x?Kn(ye,x):null,ct=(t,r)=>{if(!E)return;W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear(),pt.current&&(clearTimeout(pt.current),pt.current=null),mt.current&&(clearTimeout(mt.current),mt.current=null);const l=Sn(y,E,t,we,Me);G.mutate({blockKey:E,data:l},{onSuccess:()=>r?.onSuccess?.()??m?.(),onError:c=>{r?.onError?.(),G.reportError(c)}})},zt=()=>{H?.(null),B(null),kn(!1),T(null),K(null),at(0),tt(null),st(null),O([]),Q(t=>t+1)},Ws=()=>co(Ke.current,document.activeElement),es=(t=f("sectionsEditor.sectionsEditor.blockChangedElsewhere"))=>{if(W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear(),At.current=null,oe.error(t,{id:ho}),Ws()){Zt.current=!0;return}Fs(r=>r+1)},qs=()=>{!Zt.current||Ws()||St.current.length>0||W.current!==null||dn.current||fn.current||Oe.current.size>0||(Zt.current=!1,Fs(t=>t+1))},Gs=()=>{Zt.current&&setTimeout(qs,0)},Us=t=>Ka(Is,Bs,t),Ys=t=>{Oe.current.size!==0&&setTimeout(()=>{if(dn.current||fn.current)return;const r=[...Oe.current.values()];Oe.current.clear();for(const l of r)l()},t)},Xo=t=>{const{activePageKey:r,variantIndex:l,sectionVariantIndex:c}=Le.current,p=$t.current;return{formBase:p?.sectionIndex===t&&p.variantIndex===c?p:null,pageKey:r,global:ie,pageVariantIndex:l,sectionVariantIndex:c,schema:Tn}},gn=t=>{St.current=t,V(t)},Zo=t=>{const r=St.current,l=r.findIndex(S=>S.formBase===t.formBase),c=l>=0?r[l]:void 0,p=c?r.with(l,{...t,choices:ks(c.plan,c.choices,t.plan),fresh:To(c.plan,t.plan,c.fresh),changedAgain:c.changedAgain||ze(c.plan.theirs)!==ze(t.plan.theirs)}):[...r,{...t,changedAgain:qn.current.has(t.formBase)}];gn(p)},Js=(t,r)=>{const l=St.current,c=l.findIndex(g=>g.formBase===t),p=l[c];if(!p)return!1;if(ze(p.plan.mine)===ze(r))return!0;const S=ws({...p.plan,mine:r});if(S.pointers.length===0){const g=l.filter(_=>_!==p);return gn(g),!1}return gn(l.with(c,{...p,plan:S,choices:ks(p.plan,p.choices,S)})),!0},ei=t=>{const r=Le.current;return r.selectedSectionIndex===t.formBase.sectionIndex&&r.activePageKey===t.target.pageKey&&r.variantIndex===t.target.pageVariantIndex&&r.sectionVariantIndex===t.target.sectionVariantIndex},ti=()=>{const t=St.current[0];if(!t)return null;const{formBase:r,target:l}=t;W.current&&At.current?.sectionIndex===r.sectionIndex&&At.current.sectionVariantIndex===l.sectionVariantIndex&&(clearTimeout(W.current),W.current=null,At.current=null),Oe.current.delete(`${l.pageKey}:${r.sectionIndex}:${l.sectionVariantIndex}`);const c=r.emitted;return c&&typeof c=="object"&&!Js(r,c)&&vn(c,r.sectionIndex,0,l),St.current[0]??null},ni=()=>{const t=St.current[0],r=ti();if(!r||!t||r.formBase!==t.formBase||r.plan.pointers.some(S=>!t.plan.pointers.includes(S)))return;const l=ic(r.plan,r.choices);gn(St.current.slice(1));const{formBase:c,target:p}=r;c.base=r.plan.theirs,c.version=void 0,c.emitted=l,qn.current.add(c),($t.current===c||ei(r))&&($t.current=c,T(l),Q(S=>S+1)),vn(l,c.sectionIndex,0,p)},si=t=>{const[r,...l]=St.current;r&&gn([{...r,choices:t},...l])},vn=(t,r,l=0,c)=>{const p=c??Xo(r),S=p.sectionVariantIndex,g=p.formBase,_=At.current;W.current&&(clearTimeout(W.current),W.current=null,_&&(_.sectionIndex!==r||_.sectionVariantIndex!==S)&&_.write());const L=`${p.pageKey}:${r}:${S}`,N=()=>{if(dn.current||fn.current){Oe.current.set(L,N);return}const D=typeof t=="function"?t():t;if(g&&Js(g,D))return;const P=Le.current.decofile,{rawSections:de,parsedSections:Re,pageVariants:nt,variantIndex:Be}=go(P,p),Ge=p.pageKey,J=de[r];if(!J)return;const fe=Re[r];if(!fe)return;const Ce=g?.base,Ue=hs(J,fe,S,P),gt=!!Ce&&!!Ue&&Ao(Ce,Ue)&&!(g&&ao(g,Ue));if(gt&&Ce&&Ue){if(Co(Ce,Ue)){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}const Ae=fe.isSavedBlock?"here":rc(Ce,de.map((Ne,Mt)=>hs(Ne,Re[Mt],S,P)),r,g?.sectionCount??de.length);if(Ae==="unknown"){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}if(typeof Ae=="number"&&g){g.sectionCount=de.length,g.sectionIndex=Ae,$t.current===g&&B(Ae),vn(D,Ae,l,p);return}}const ot=gt&&Ce&&Ue?ws({ancestor:Ce,mine:D,theirs:Ue}):null;if(ot&&ot.pointers.length>0&&g){g.sectionCount=de.length,Zo({plan:ot,formBase:g,target:p,sectionIndex:r,choices:No(ot),changedAgain:!1,blockKey:fe.isSavedBlock?ds(J,fe):Ge,fresh:{}});return}const vt=ot?ot.merged:null,Dt=vt??D,Mr=oc({merged:!!vt,tracked:g,current:$t.current,saved:D});vt&&oe.info(f("sectionsEditor.sectionsEditor.blockMergedWithOthers"),{id:ho}),Mr&&g&&(g.emitted=vt,T(vt));const cs=Mr||!vt?Dt:D;g&&(g.base=cs,g.sectionCount=de.length,nc(g,cs));const Pr={onSuccess:()=>{g&&qn.current.delete(g),m?.()},onError:Ae=>{if(g?.base===cs&&Ce&&(g.base=Ce),Ae instanceof Ba){g&&(g.version=void 0),l<Gc?(Oe.current.delete(L),fn.current=!0,setTimeout(()=>{fn.current=!1,vn(()=>{const Ne=g?.emitted;return Ne&&typeof Ne=="object"?Ne:D},r,l+1,p),Oe.current.delete(L),Ys(bn)},Uc*2**l)):es();return}G.reportError(Ae)}},Ir=Ae=>{dn.current=!0;let Ne=!1;G.mutateAsync(Ae).then(()=>Pr.onSuccess(),Mt=>{Ne=!0,Pr.onError(Mt)}).finally(()=>{dn.current=!1,Ys(Ne?bn:0),qs()})};if(fe.isSavedBlock){const Ae=ds(J,fe);if(!Ae)return;Ir({blockKey:Ae,data:Dt,...Ce?{base:{value:vt?Ue:Ce}}:{},rebaseOnConflict:!1,guard:lo({formBase:g,rebased:!!vt,versionOf:Us})});return}if(!Ge)return;const In={...P[Ge]},Wt=[...de];if(fe.isMultivariate){const Ae=xt(J,fe);if(!Ae||!Ge)return;const Ne=al(Ae,S,Dt);Wt[r]=qt(J,fe,Ne)}else if(fe.isHidden){const Ae=Rs(J.__resolveType),Ne=Ae?{...J.section}:{...J},Mt=Array.isArray(Ne.variants)?[...Ne.variants]:[];Mt[0]&&(Mt[0]={...Mt[0],value:Dt}),Ne.variants=Mt,Ae?Wt[r]={...J,section:Ne}:Wt[r]=Ne}else fe.isLazy?Wt[r]={...J,section:Dt}:Wt[r]=Dt;if(nt.length>1){const Ae=In.sections,Ne=[...Ae?.variants??[]];Ne[Be]&&(Ne[Be]={...Ne[Be],value:Wt}),In.sections={...Ae,variants:Ne}}else In.sections=Wt;Ir({blockKey:Ge,data:In,rebaseOnConflict:!1,guard:lo({formBase:null,rebased:!1,versionOf:Us})})};At.current={sectionIndex:r,sectionVariantIndex:S,write:N},W.current=setTimeout(()=>{W.current=null,N()},bn)},ri=t=>{Zt.current=!1,B(t),at(0),O([]),Q(p=>p+1);const r=U[t],l=Pe[t];if(H?.(l?.isSavedBlock?l.resolveType??null:null),!r||!l)return;if(l.isMultivariate){bt(r,l,0,t);return}const c=jt(r,l,y);if(!c){T(null),K(null),st(null),tt(null),en(null,t,0);return}T(c.data),K(c.resolveType),st(null),tt(null),en(null,t,0)},Qs=t=>{const r=t;b!==null&&($t.current=sc($t.current,{sectionIndex:b,variantIndex:Le.current.sectionVariantIndex,shown:xe,next:r,sectionCount:Le.current.rawSections.length})),T(r),b!==null&&vn(r,b)},ts=t=>{if(!E||!y||!x||!je)return;const r={kind:"page",pageKey:E,pageName:String(je.name??""),path:String(je.path??"")},l=Kr(y,r,x);l&&cn.save(E,()=>{const c=Is.getQueryData(yo.decofile(Bs))?.[E];if(!c||typeof c!="object"||c===null||Array.isArray(c))return null;const p={...c,...An.current};return An.current={},t?.raw!==void 0?{...p,seo:t.raw}:t?.inner!==void 0?Kl(r,l,p,t.inner):p})},Xs=(t,r)=>{E&&(An.current[t]=r,ts())},oi=(t,r)=>{if(!E)return;const l=Ln([...U],t,r);b!==null&&(b===t?B(r):t<b&&r>=b?B(b-1):t>b&&r<=b&&B(b+1)),ct(l)},ii=t=>{if(!E)return;const r=U.filter((l,c)=>c!==t);b===t?zt():b!==null&&b>t&&B(b-1),ct(r)},ai=t=>{if(!E)return;const r=U[t];if(!r)return;const l=[...U];l.splice(t+1,0,wa(r)),b!==null&&b>t&&B(b+1),ct(l)},li=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l)return;const c=l.isHidden?nl(r):sl(r);if(!c)return;const p=[...U];p[t]=c,b===t&&zt(),ct(p)},ci=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l||l.isMultivariate)return;const c=tl(r);if(!c)return;const p=[...U];p[t]=c,b===t&&zt(),ct(p)},ui=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l?.isSavedBlock)return;const c=jt(r,l,y);if(!c?.data)return;const{name:p,...S}=c.data,g=[...U];l.isLazy?g[t]={...r,section:S}:g[t]=S,b===t&&zt(),ct(g)},di=t=>{if(!E)return;const r=[...U,{__resolveType:t.resolveType}],l=r.length-1;ct(r,{onError:()=>{Le.current.selectedSectionIndex===l&&zt()}}),Fe(!1),B(l),at(0),O([]),Q(g=>g+1);const c=r[l],p=_n(r,y)[l];if(!c||!p)return;if(p.isMultivariate){bt(c,p,0);return}const S=jt(c,p,y);if(!S){T(null),K(null),st(null),tt(null);return}T(S.data),K(S.resolveType),st(null),tt(null)},Zs=t=>{ne.current=t.append,Fe(!0)},fi=t=>{const r=ne.current;if(!r){di(t);return}r({__resolveType:t.resolveType}),Fe(!1),ne.current=null},er=t=>{if(b===null)return;const r=U[b],l=Pe[b];!r||!l?.isMultivariate||(at(t),O([]),Q(c=>c+1),bt(r,l,t,b,!0))},mi=t=>{if(b===null||!E)return;const r=U[b],l=Pe[b];if(!r||!l?.isMultivariate)return;const c=xt(r,l);if(!c)return;const p=Za(c,t);if(!p){oe.error(f("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const S=[...U];S[b]=qt(r,l,p);const g=p.variants;let _=Je;t===Je?_=Math.min(t,g.length-1):t<Je&&(_=Je-1),at(_),O([]),Q(L=>L+1),bt(S[b],l,_),ct(S)},pi=t=>{if(b===null||!E)return;const r=U[b],l=Pe[b];if(!r||!l?.isMultivariate)return;const c=xt(r,l);if(!c)return;const p=el(c,t),S=[...U];S[b]=qt(r,l,p);const g=t+1;at(g),O([]),Q(_=>_+1),bt(S[b],l,g),ct(S)},hi=(t,r)=>{if(b===null||!E||t===r)return;const l=U[b],c=Pe[b];if(!l||!c?.isMultivariate)return;const p=xt(l,c);if(!p)return;const S=Qa(p,t,r),g=[...U];g[b]=qt(l,c,S);let _=Je;Je===t?_=r:t<Je&&r>=Je?_=Je-1:t>Je&&r<=Je&&(_=Je+1),at(_),bt(g[b],c,_),ct(g)},xn=t=>{const r=t??b;if(r===null||!E)return;const l=U[r],c=Pe[r];if(!l||!c)return;const p=Ua(l,c);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const S=[...U];S[r]=p.section;const g=_n(S,y)[r];if(!g?.isMultivariate){oe.error(f("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}B(r),at(p.newVariantIndex),O([]),Q(_=>_+1),bt(p.section,g,p.newVariantIndex,r),ct(S)},tr=()=>{if(b===null||!E)return;const t=U[b],r=Pe[b];if(!t||!r?.isMultivariate)return;const l=xt(t,r);if(!l)return;const c=Xa(t,r,l);if(!c){oe.error(f("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const p=[...U];p[b]=c;const S=_n(p,y)[b];if(!S)return;at(0),st(null),tt(null),O([]),Q(_=>_+1);const g=jt(c,S,y);g?(T(g.data),K(g.resolveType)):(T(null),K(null)),en(null,b,0),ct(p)},gi=async t=>{if(ke===null||!E)return;const r=On(t,y,x);if(r){oe.error(r);return}const l=U[ke],c=Pe[ke];if(!l||!c)return;const p=jt(l,c,y);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const S={...p.data,name:t};try{await G.mutateAsync({blockKey:t,data:S});const g=[...U];g[ke]={__resolveType:t},await G.mutateAsync({blockKey:E,data:Sn(y,E,g,we,Me)}),b===ke&&zt(),He(null),oe.success(f("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),m?.()}catch(g){oe.error(f("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"),{description:Pt(f,It(g))})}},nr=rt?.rule;if(ht&&b===null&&_e===null&&nr){const{resolveType:t,formValue:r}=jn(nr,y??{},x??void 0);be(t),Z(r)}const tn=x?ma(x):[],ns=x&&y?pa(x,y):[],sr=!ie&&!!(ve&&x&&y),rr=_e&&x?Kn(_e,x):null,Ct=()=>{mt.current&&(clearTimeout(mt.current),mt.current=null),pt.current&&(clearTimeout(pt.current),pt.current=null)},Ht=async(t,r)=>{if(!(il(r,t,x)>0))try{await Rn.mutateAsync({blockKey:t})}catch(l){oe.error(f("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"),{description:Pt(f,It(l))})}},or=t=>{mt.current&&clearTimeout(mt.current),mt.current=setTimeout(()=>{const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p={...l[r]},S={...p.sections},g=[...S.variants??[]],_=g[c],L=_?.rule;if(Gt(L,l,x)){const N=L?.__resolveType??"",D=l[N],P=typeof D?.name=="string"?D.name:N,{__resolveType:de,...Re}=t;G.mutate({blockKey:N,data:Kt(de??"",Re,P)},{onSuccess:()=>m?.(),onError:G.reportError});return}_&&(g[c]={..._,rule:t}),p.sections={...S,variants:g},G.mutate({blockKey:r,data:p},{onSuccess:()=>m?.(),onError:G.reportError})},bn)},ir=t=>{be(t);const r=t?Jr(t,x):{__resolveType:Qr};Z(t?r:{}),or(r)},ar=t=>{const r=t;Z(r);const l=_e?{__resolveType:_e,...r}:{...r};or(l)},lr=async t=>{Ct();const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p=l[r],S=p?.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[c];if(!L)return;const N=Bt(L.rule,l,x),D=on(t);_[c]={...L,rule:D};const P={...l,[r]:{...p,sections:{...g,variants:_}}},{resolveType:de,formValue:Re}=jn(D,P,x??void 0);be(de),Z(Re);try{await G.mutateAsync({blockKey:r,data:P[r]}),N&&N!==t&&await Ht(N,P),m?.()}catch(nt){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(nt))})}},cr=t=>{pt.current&&clearTimeout(pt.current);const{selectedSectionIndex:r,sectionVariantIndex:l}=Le.current;r!==null&&(pt.current=setTimeout(()=>{const{rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(!g)return;const N=c[r],D=p[r];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const Re=(P.variants??[])[l]?.rule;if(Gt(Re,S,x)){const J=Re?.__resolveType??"",fe=S[J],Ce=typeof fe?.name=="string"?fe.name:J,{__resolveType:Ue,...gt}=t;G.mutate({blockKey:J,data:Kt(Ue??"",gt,Ce)},{onSuccess:()=>m?.(),onError:G.reportError});return}const nt=Xr(P,l,t),Be=[...c];Be[r]=qt(N,D,nt);const Ge=Sn(S,g,Be,L,_);G.mutate({blockKey:g,data:Ge},{onSuccess:()=>m?.(),onError:G.reportError})},bn))},vi=t=>{st(t);const r=t?Jr(t,x):{__resolveType:Qr};tt(t?r:{}),cr(r)},xi=t=>{const r=t;tt(r);const l=Jt?{__resolveType:Jt,...r}:{...r};cr(l)},yi=async t=>{Ct();const{selectedSectionIndex:r,sectionVariantIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(r===null||!g)return;const N=c[r],D=p[r];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const de=P.variants??[],Re=Bt(de[l]?.rule,S,x),nt=on(t),Be=Xr(P,l,nt),Ge=[...c];Ge[r]=qt(N,D,Be);const J=Sn(S,g,Ge,L,_),fe={...S,[g]:J},{resolveType:Ce,formValue:Ue}=jn(nt,fe,x??void 0);st(Ce),tt(Ue);try{await G.mutateAsync({blockKey:g,data:J}),Re&&Re!==t&&await Ht(Re,fe),m?.()}catch(gt){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(gt))})}};if(!ie&&!je)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.noPageFound",{currentPath:u})});if(ie&&!Un)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.globalBlockNotFound")});const $e=b!==null?Pe[b]??null:null,ur=b!==null?U[b]:null,dr=ur&&$e?.isMultivariate?xt(ur,$e):null,Nt=dr?vs(dr,wt):[],Vn=Math.min(Je,Math.max(Nt.length-1,0)),nn=Nt[Vn]??null,Tt=$e?.isMultivariate===!0,ss=b!==null&&$e!==null,Vt=ss&&(Tt||!!(Tn&&xe)),Si=Vt&&!ie&&$e?.isSavedBlock===!0,ut=ie||Si,fr=ie?Os:$e?.label??"",bi=Jt&&x?Kn(Jt,x):null,mr=(t,r)=>r&&M?`${t} · ${r}`:t,pr=$e?$e.variantOf??$e.label:"",ji=(()=>{const t=Tt&&nn?nn.label:null;return t?M?[mr(pr,t)]:[$e.label,t]:[$e?.label??""]})(),rs=mr(je?.name??"",ht?rt?.label:null),Dn=Vt&&(!ie||q.length>0)?ie?[Os,...q]:[rs,...ji,...q]:[],hr=qe&&je?[je.name,"SEO",...Vs]:[],gr=f("sectionsEditor.pageVariantTabs.variantsLabel"),vr=et&&je?[je.name,gr]:Ot&&je&&$e?[rs,pr,gr]:[],Mn=vr.length>0?vr:hr.length>0?hr:ut?Dn.length>0?Dn:[fr]:Dn.length>0?Dn:[rs],xr=ss&&!Tt&&!$e?.isHidden&&!!E,wi=ut||!ie&&ht&&!!rt||xr,_i=ss&&!Tt&&!ie&&q.length===0&&!!$e&&jo($e)&&!!E,ki=M&&Vt&&!Ot&&Tt&&q.length===0&&!!nn,yr=M&&q.length>0?Fr(q[q.length-1]):null,Ei=q.length>1?Fr(q[q.length-2]):null,Sr=ut?fr:Vt?$e?.label??"":je?.name??"",Ri=et||Ot?f("sectionsEditor.pageVariantTabs.variantsLabel"):qe?f("sectionsEditor.panelSections.seo"):yr??Sr,br=Ot?$e?.variantOf??$e?.label??"":et||qe?je?.name??"":yr?Ei??Sr:ut?f("sectionsEditor.sectionsEditor.globalSectionSubtitle"):Vt?je?.name??"":je?.path??"",os=!et&&!Ot&&!qe&&!Vt&&!ut,Ai=!M&&!qe&&!ie&&Tt&&q.length===0,yn=()=>{if(!E)return;Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const t=y[E],r=Ya(t.sections,U);if(!r)return;const l=Ja(r);G.mutate({blockKey:E,data:{...t,sections:r}},{onSuccess:()=>{ue(l),B(null),T(null),K(null),O([]),Z(null),be(null)},onError:G.reportError})},Pn=(t,r,l)=>{if(!E)return;Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const c=y[E],p=c.sections;if(!p||typeof p!="object"||Array.isArray(p))return;const S=p;if(!Array.isArray(S.variants))return;const g=t([...S.variants]);if(!g)return;const _=ol(S,g),L={...y,[E]:{...c,sections:_}};G.mutate({blockKey:E,data:L[E]},{onSuccess:()=>{r?.();const N=typeof l=="string"?[l]:l??[];(async()=>{for(const D of N)await Ht(D,L)})()},onError:G.reportError})},is=t=>{Ee(null),ue(t),B(null),T(null),K(null),O([]);const r=Me[t]?.rule,{resolveType:l,formValue:c}=jn(r,y??{},x??void 0);be(l),Z(c),Xn(Me.map(p=>({rule:p.rule})),t)},jr=(t,r)=>{if(t===r)return;let l=we;we===t?l=r:t<we&&r>=we?l=we-1:t>we&&r<=we&&(l=we+1),ue(l);const c=Ln(Me.map(p=>({rule:p.rule})),t,r);Xn(c,l),Pn(p=>Ln(p,t,r))},wr=t=>{const r=Me[t]?.rule,l=Bt(r,y??{},x??void 0);Pn(c=>c.length<=1?null:(c.splice(t,1),c),()=>{Me.length-1===1?ue(0):t<we?ue(we-1):t===we&&ue(Math.max(0,t-1)),B(null),T(null),K(null),O([]),Z(null),be(null)},l)},Ci=()=>{const t=Me.map((r,l)=>({variant:r,index:l})).filter(({variant:r})=>!rl(r.rule)).map(({variant:r})=>Bt(r.rule,y??{},x??void 0)).filter(r=>!!r);Pn(r=>{const l=ll({variants:r}),c=r[l];return c?[{...c,rule:cl()}]:null},()=>{ue(0),B(null),T(null),K(null),O([]),Z(null),be(null),ft(!1)},t)},_r=t=>{Pn(r=>ul(r,t),()=>{ue(t+1),B(null),T(null),K(null),O([]),Z(null),be(null)})},Ni=async(t,r)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const l=Le.current.activePageKey,c=Le.current.decofile;if(!l)return;const p=c[l],S=p.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[t];if(!L?.rule||typeof L.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const N=L.rule,D=r.trim();Xt(!0);try{if(!D){if(!Gt(N,c,x)){Ee(null);return}const Ge=N.__resolveType??"";_[t]={...L,rule:xs(N,c,x)};const J={...c,[l]:{...p,sections:{...g,variants:_}}};await G.mutateAsync({blockKey:l,data:J[l]}),await Ht(Ge,J),Ee(null),m?.();return}const P=ys(N,c,x);if(!P){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(P.blockKey){await G.mutateAsync({blockKey:P.blockKey,data:Kt(P.resolveType,P.data,D)}),Ee(null),m?.();return}const de=Fn(D),Re=On(de,c,x);if(Re){oe.error(Re);return}const nt=Kt(P.resolveType,P.data,D);let Be=null;try{await G.mutateAsync({blockKey:de,data:nt}),Be=de,_[t]={...L,rule:on(de)},await G.mutateAsync({blockKey:l,data:{...p,sections:{...g,variants:_}}}),Be=null}catch(Ge){throw Be&&await Rn.mutateAsync({blockKey:Be}).catch(()=>{}),Ge}Ee(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:D})),m?.()}catch(P){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(P))})}finally{Xt(!1)}},Ti=async(t,r)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{selectedSectionIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(l===null||!g)return;const N=c[l],D=p[l];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const de=P.variants??[],Re=de[t];if(!Re?.rule||typeof Re.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const nt=Re.rule,Be=r.trim();Xt(!0);const Ge=async J=>{const fe={...P,variants:J},Ce=[...c];Ce[l]=qt(N,D,fe);const Ue=Sn(S,g,Ce,L,_);return await G.mutateAsync({blockKey:g,data:Ue}),{...S,[g]:Ue}};try{if(!Be){if(!Gt(nt,S,x)){Ve(null);return}const ot=nt.__resolveType??"",vt=[...de];vt[t]={...Re,rule:xs(nt,S,x)};const Dt=await Ge(vt);await Ht(ot,Dt),Ve(null),m?.();return}const J=ys(nt,S,x);if(!J){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(J.blockKey){await G.mutateAsync({blockKey:J.blockKey,data:Kt(J.resolveType,J.data,Be)}),Ve(null),m?.();return}const fe=Fn(Be),Ce=On(fe,S,x);if(Ce){oe.error(Ce);return}const Ue=Kt(J.resolveType,J.data,Be);let gt=null;try{await G.mutateAsync({blockKey:fe,data:Ue}),gt=fe;const ot=[...de];ot[t]={...Re,rule:on(fe)},await Ge(ot),gt=null}catch(ot){throw gt&&await Rn.mutateAsync({blockKey:gt}).catch(()=>{}),ot}Ve(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:Be})),m?.()}catch(J){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(J))})}finally{Xt(!1)}},kr=async(t,r,l)=>{T(l);try{await G.mutateAsync({blockKey:t,data:l})}catch(c){throw T(p=>p===l?r:p),c}},Vi={rename:async(t,r,l)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{activePageKey:c,decofile:p}=Le.current;if(!c)return;const S=Array.isArray(t.variants)?[...t.variants]:[],g=S[r],_=g?.rule&&typeof g.rule=="object"?g.rule:void 0,L=async D=>{const P={...t,variants:D};return await kr(c,t,P),{...p,[c]:P}},N=qc(_,l,p,x);if(N.kind!=="noop"){if(N.kind==="error"){oe.error(N.reason==="no-matcher-rule"?f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"):N.reason==="unreadable-rule"?f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"):N.message??f("sectionsEditor.sectionsEditor.failedToRenameVariant"));return}Xt(!0);try{if(N.kind==="inline"){const P=[...S];P[r]={...g,rule:N.inlinedRule};const de=await L(P);await Ht(N.blockKey,de),m?.();return}if(N.kind==="updateBlock"){await G.mutateAsync({blockKey:N.blockKey,data:N.blockData}),m?.();return}let D=null;try{await G.mutateAsync({blockKey:N.blockId,data:N.blockData}),D=N.blockId;const P=[...S];P[r]={...g,rule:N.reference},await L(P),D=null}catch(P){throw D&&await Rn.mutateAsync({blockKey:D}).catch(()=>{}),P}oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:l.trim()})),m?.()}catch(D){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(D))})}finally{Xt(!1)}}},selectGlobal:async(t,r,l)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{activePageKey:c,decofile:p}=Le.current;if(!c)return;const S=Array.isArray(t.variants)?[...t.variants]:[],g=S[r];if(!g)return;const _=Bt(g.rule,p,x);S[r]={...g,rule:on(l)};const L={...t,variants:S},N={...p,[c]:L};try{await kr(c,t,L),_&&_!==l&&await Ht(_,N),m?.()}catch(D){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(D))})}}},Er=()=>{zt()},Rr=t=>{ln(t),ts({inner:t})},Ar=t=>{En(t),ts({raw:t})},Cr=()=>{ln(null),Lt([])},Nr=()=>Yt(t=>t+1),Tr=()=>{cn.flush(),an(!1),ln(null),En(void 0),Lt([]),Yt(t=>t+1),A?.()},Di=()=>{ft(!1),kn(!1),B(null),an(!0)},Mi=()=>{qe&&Tr(),B(null),ft(!0)},Pi=()=>kn(!0),as=t=>{if(et&&t===0){ft(!1);return}if(Ot&&t<2){kn(!1),t===0&&B(null);return}if(qe){if(t===0){Tr();return}if(t===1){Lt([]),Yt(l=>l+1);return}Lt(Vs.slice(0,t-1)),Yt(l=>l+1);return}if(ie){O(q.slice(0,t)),Q(l=>l+1);return}if(t===0){Er();return}if(t===1){O([]),Q(l=>l+1);return}const r=!M&&Tt&&nn?1:0;if(r===1&&t===2){O([]),Q(l=>l+1);return}O(q.slice(0,t-1-r))},ls=Mn.length>1?i.jsx("button",{type:"button",onClick:()=>as(_a(Mn.length,{isMultivariateSectionTop:Ai})),title:f("sectionsEditor.sectionsEditor.back"),"aria-label":f("sectionsEditor.sectionsEditor.back"),className:ae("shrink-0 inline-flex size-6 items-center justify-center rounded-[var(--studio-control-radius,var(--radius-md))] transition-colors",ut?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:i.jsx(Ca,{className:"size-4"})}):null,Ii=ut||Vt||qe?wi&&i.jsxs("div",{className:ae("border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!ie&&ht&&rt&&i.jsxs("button",{type:"button",onClick:Er,title:f("sectionsEditor.sectionsEditor.editingInVariant",{variant:rt.label}),className:ae("shrink-0 inline-flex items-center gap-1 rounded-lg h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",ga),children:[i.jsx(ha,{rule:fs(rt.rule,y??{},x??void 0),matchers:tn}),i.jsx("span",{className:"max-w-[160px] truncate",children:rt.label})]}),i.jsx("div",{className:"flex-1"}),ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),xr&&i.jsx(Bn,{onClick:()=>xn()})]}),ut&&i.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:f("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):i.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Xs,variant:"header"})}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>an(!0),children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>z&&E?z():dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]}),i.jsx(Bn,{onClick:yn})]}),Bi=i.jsxs(i.Fragment,{children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:Me,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsx($r,{className:"mt-3",children:i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})})]}),Vr=i.jsxs(i.Fragment,{children:[i.jsx(va,{listKey:`${E??""}:${b??""}`,variants:Nt.map((t,r)=>({index:r,label:t.label})),selectedIndex:Vn,onSelect:er,onRename:Ve,onDuplicate:pi,onDelete:mi,onRemoveAll:tr,onReorder:hi,onAdd:()=>xn()}),i.jsx($r,{children:i.jsx(us,{currentRt:Jt??"",currentLabel:wn(nn?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(nn?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:vi,onSelectGlobal:yi,schema:bi,formValue:Mo,onChange:xi,formKey:`${b??"none"}:${Vn}:${Jt??""}`,formWrapperClassName:"pt-1",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Dr=i.jsx("div",{className:ae(M?"px-2":"p-2 pt-3"),children:i.jsx(Zl,{listKey:`${E??""}-${we}`,rawSections:U,sections:Pe,meta:x,decofile:y,selectedIndex:b,onSelect:ri,onReorder:oi,onDelete:ii,onDuplicate:ai,onMakeReusable:He,onToggleHidden:li,onToggleLazy:he?ci:void 0,onAddVariant:xn,onDetach:ui,onAddSection:()=>Fe(!0),canAddSection:sr})}),Ki=i.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[E&&je&&i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Xs}),mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ds,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),Fi=i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:i.jsx("div",{className:"mx-auto max-w-2xl",children:mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ds,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),Oi=i.jsxs(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:Me,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsxs("div",{className:ae("px-3 border-b",De?"pt-3 pb-5 space-y-3":"py-2"),children:[i.jsxs("button",{type:"button",onClick:()=>yt(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-[var(--studio-control-radius,var(--radius-sm))] py-0.5 hover:bg-muted/40","aria-expanded":De,children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("sectionsEditor.sectionsEditor.variantRule")}),De?i.jsx(Ea,{className:"size-3.5 shrink-0 text-muted-foreground"}):i.jsx(Ra,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),De&&i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Dr]},"editor-section-list");return i.jsx(xa,{children:i.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!M&&ls&&i.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:ls}),(M||Mn.length>1)&&i.jsx(ya,{crumbs:Mn,onSelect:as,onSelectRoot:()=>{cn.flush(),$?$():as(0)}}),i.jsx("div",{className:"shrink-0",children:M?i.jsxs("div",{className:ae("flex items-center gap-2 border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[M&&ls,ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[i.jsx("span",{className:"truncate text-sm font-semibold",children:Ri}),br&&i.jsx("span",{className:"truncate text-xs text-muted-foreground",children:br})]}),os&&ht&&rt&&i.jsx(zr,{variants:Me,activeIndex:we,onSelect:is,onManage:Mi,onRemoveAll:Ci}),ki&&i.jsx(zr,{variants:Nt,activeIndex:Vn,onSelect:er,onManage:Pi,onRemoveAll:tr}),os&&!ht&&i.jsx(Bn,{onClick:yn}),_i&&i.jsx(Bn,{onClick:()=>xn()}),i.jsx(Sa,{}),os&&i.jsxs(i.Fragment,{children:[i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:Di,children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),!z&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):Ii}),lt&&i.jsx(yc,{open:!0,fields:cc(lt.plan,lt.target.schema),choices:lt.choices,changedAgain:lt.changedAgain,author:zo,fresh:lt.fresh,onChoose:(t,r)=>si({...lt.choices,[t]:r}),onApply:ni},Jc(lt.formBase)),Ot?i.jsx(Hr,{onAdd:()=>xn(),children:Vr},"editor-section-variants"):Vt?i.jsxs(rn,{viewportRef:Ke,onBlur:Gs,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!M&&Tt&&Nt.length>0&&q.length===0&&Vr,i.jsx(Wr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:q,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:x,decofile:y,onSaveReferencedBlock:un,sandbox:hn,previewBaseUrl:ee,onRequestAddSection:Zs,onVariantMatcherOp:ie?Vi:void 0})]},"editor-section-form"):ie?i.jsx(rn,{viewportRef:Ke,onBlur:Gs,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx(Wr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:q,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:x,decofile:y,onSaveReferencedBlock:un,sandbox:hn,previewBaseUrl:ee,onRequestAddSection:Zs})},"editor-global-block"):qe?M?i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"p-3",children:Ki})},"editor-seo"):Fi:et?i.jsx(Hr,{onAdd:yn,children:Bi},"editor-variants"):M?i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"py-2",children:Dr})}),i.jsx("div",{className:"shrink-0 border-t p-2",children:i.jsx(js,{canAddSection:sr,onAddSection:()=>Fe(!0)})})]},"editor-section-list"):Oi,i.jsx(ba,{open:ke!==null,onOpenChange:t=>{t||He(null)},defaultBlockId:ke!==null?Fn(Pe[ke]?.label??""):"",isPending:G.isPending,onSubmit:gi}),ve&&i.jsx(Al,{open:Ze,onOpenChange:t=>{Fe(t),t||(ne.current=null)},meta:x,decofile:y,previewBaseUrl:ee,onSelect:fi}),re&&E&&y&&i.jsx(La,{open:re,onOpenChange:dt,pageKey:E,decofile:y}),We!==null&&i.jsx(qr,{open:!0,initialName:Gt(Me[We]?.rule,y??{},x??void 0)?wn(Me[We]?.rule,y??{},wt,x??void 0):"",autoLabel:wt(fs(Me[We]?.rule,y??{},x??void 0)),isPending:Qt,onSubmit:async t=>{await Ni(We,t)},onOpenChange:t=>{!t&&!Qt&&Ee(null)}}),Ie!==null&&i.jsx(qr,{open:!0,initialName:Gt(Nt[Ie]?.rule,y??{},x??void 0)?wn(Nt[Ie]?.rule,y??{},wt,x??void 0):"",autoLabel:wt(fs(Nt[Ie]?.rule,y??{},x??void 0)),isPending:Qt,onSubmit:async t=>{await Ti(Ie,t)},onOpenChange:t=>{!t&&!Qt&&Ve(null)}})]})})}export{tm as SectionsEditor};
|
|
4
|
+
`).trim()}const pc={" ":" ","&":"&","<":"<",">":">",""":'"',"'":"'"};function hc(n){if(typeof DOMParser<"u")return new DOMParser().parseFromString(n,"text/html").body.textContent??"";let e=n;for(let s="";s!==e;)s=e,e=e.replace(/<[^<>]*>/g,"");return e.replace(/<|>/g,"").replace(/&(nbsp|amp|lt|gt|quot|#39);/g,s=>pc[s]??s)}function $n(n){const e=n.replace(/\s+/g," ").trim();return e.length>uo?`${e.slice(0,uo-1)}…`:e}function gc(n){if(n.startsWith("data:"))return"image";const e=n.split(/[?#]/)[0]??n;return decodeURIComponent(e.split("/").pop()||n)}function Hn(n,e){if(n==null||n==="")return{kind:"empty"};if(typeof n=="string")return Vo(n,e)?{kind:"image",src:n}:{kind:"text",text:Es(n,e)};if(typeof n=="number"||typeof n=="bigint")return{kind:"text",text:String(n)};if(typeof n=="boolean")return{kind:"yesNo",value:n};if(Array.isArray(n)){const s=e?.items??null;return{kind:"list",count:n.length,items:n.slice(0,mc).map(o=>vc(o,s)??"")}}if(typeof n=="object"){const s=n;if("value"in s&&Object.keys(s).length<=2)return Hn(s.value,e?.properties?.value??e);const o=Object.entries(s).filter(([a,u])=>!a.startsWith("__")&&u!==void 0).flatMap(([a,u])=>{const h=e?.properties?.[a]??null,d=Hn(u,h);if(d.kind==="empty")return[];const v=d.kind==="text"?$n(d.text):d.kind==="image"?gc(d.src):d.kind==="yesNo"?d.value?"✓":"✗":d.kind==="list"?`${d.count}`:"…";return[{label:h?.title?.trim()||a,text:v}]}).slice(0,4);return o.length>0?{kind:"fields",entries:o}:{kind:"empty"}}return{kind:"text",text:String(n)}}function vc(n,e){if(typeof n=="string")return $n(Es(n,e));if(!n||typeof n!="object"||Array.isArray(n))return null;const s=n,o=e?.titleBy,a=o?s[o]:void 0;if(typeof a=="string"&&a.trim())return $n(a);for(const[u,h]of Object.entries(s))if(!(u.startsWith("__")||typeof h!="string"||!h.trim())&&!Vo(h,e?.properties?.[u]??null))return $n(Es(h,null));return null}const fo=1500;function xc(n,e){const s=n.split(/(\s+)/).filter(j=>j!==""),o=e.split(/(\s+)/).filter(j=>j!=="");if(s.length>fo||o.length>fo)return{mine:[{text:n,kind:"changed"}],theirs:[{text:e,kind:"changed"}]};const a=Array.from({length:s.length+1},()=>new Array(o.length+1).fill(0));for(let j=s.length-1;j>=0;j--)for(let A=o.length-1;A>=0;A--){const $=a[j];$[A]=s[j]===o[A]?a[j+1][A+1]+1:Math.max(a[j+1][A],$[A+1])}const u=[],h=[],d=(j,A,$)=>{const z=j.at(-1);z&&(z.kind===$||$==="same"&&!A.trim())?z.text+=A:j.push({text:A,kind:$})};let v=0,m=0;for(;v<s.length&&m<o.length;)s[v]===o[m]?(d(u,s[v],"same"),d(h,o[m],"same"),v++,m++):a[v+1][m]>=a[v][m+1]?(d(u,s[v],"changed"),v++):(d(h,o[m],"changed"),m++);for(;v<s.length;v++)d(u,s[v],"changed");for(;m<o.length;m++)d(h,o[m],"changed");return{mine:u,theirs:h}}function yc(n){const e=it.c(10);let s,o;e[0]!==n?({open:s,...o}=n,e[0]=n,e[1]=s,e[2]=o):(s=e[1],o=e[2]);const{data:a}=xo.useSession();let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=ae("max-h-[85vh] grid-rows-[auto_minmax(0,1fr)_auto] sm:max-w-lg"),e[3]=u):u=e[3];const h=a?.user??null;let d;e[4]!==o||e[5]!==h?(d=i.jsx(Cl,{className:u,"data-testid":"form-conflict-dialog",onEscapeKeyDown:jc,onOpenAutoFocus:bc,children:i.jsx(Ac,{...o,viewer:h,heading:Sc})}),e[4]=o,e[5]=h,e[6]=d):d=e[6];let v;return e[7]!==s||e[8]!==d?(v=i.jsx(Dl,{open:s,children:d}),e[7]=s,e[8]=d,e[9]=v):v=e[9],v}function Sc(n,e){return i.jsxs(Nl,{className:"text-left",children:[i.jsx(Tl,{children:n}),i.jsx(Vl,{children:e})]})}function bc(n){n.preventDefault(),n.currentTarget?.focus()}function jc(n){return n.preventDefault()}const wc={},_c=(n,e)=>i.jsxs("div",{className:"flex flex-col gap-2",children:[i.jsx("h2",{className:"text-lg font-semibold",children:n}),i.jsx("p",{className:"text-sm text-muted-foreground",children:e})]});function kc(n,e,s=0,o={},a=null){const u=e[Math.min(s,e.length-1)],h=a?.you?void 0:a?.name?.split(/\s+/)[0],d={field:u?Rc(u.label):"",label:u?.label??"",name:h??""},v=(m,j,A)=>n(a?.you?A:h?j:m,d);return e.length<=1?{title:v("sectionsEditor.formConflict.titleOne","sectionsEditor.formConflict.titleOneNamed","sectionsEditor.formConflict.titleOneYou"),description:n("sectionsEditor.formConflict.descriptionOne")}:{title:v("sectionsEditor.formConflict.titleStep","sectionsEditor.formConflict.titleStepNamed","sectionsEditor.formConflict.titleStepYou"),description:s>=e.length-1?i.jsx(Ec,{t:n,fields:e,choices:o,name:h}):n("sectionsEditor.formConflict.descriptionStep")}}function Ec(n){const e=it.c(11),{t:s,fields:o,choices:a,name:u}=n;let h;if(e[0]!==a||e[1]!==o||e[2]!==u||e[3]!==s){let v;e[5]!==a||e[6]!==u||e[7]!==s?(v=(m,j)=>i.jsxs(R.Fragment,{children:[j>0&&" · ",`${m.label}: `,i.jsx("span",{className:"font-medium text-foreground",children:s((a[m.pointer]??"mine")==="mine"?"sectionsEditor.formConflict.summaryYours":u?"sectionsEditor.formConflict.summaryTheirsNamed":"sectionsEditor.formConflict.summaryTheirs",{name:u??""})})]},m.pointer),e[5]=a,e[6]=u,e[7]=s,e[8]=v):v=e[8],h=o.map(v),e[0]=a,e[1]=o,e[2]=u,e[3]=s,e[4]=h}else h=e[4];let d;return e[9]!==h?(d=i.jsx("span",{"data-testid":"form-conflict-summary",children:h}),e[9]=h,e[10]=d):d=e[10],d}function Rc(n){return/^[A-Z][a-z]/.test(n)&&!n.includes("›")?n.charAt(0).toLowerCase()+n.slice(1):n}function Ac(n){const e=it.c(68),s=Ft(),{fields:o,choices:a,changedAgain:u,fresh:h,heading:d}=n,v=u===void 0?!1:u,m=h===void 0?wc:h,j=d===void 0?_c:d,A=o.length>1,[$,z]=R.useState(0),[H,F]=R.useState(Cc);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];const[k,Z]=R.useState(f),w=Math.max(0,Math.min($,o.length-1)),I=o[w],V=w===o.length-1;let y;e[1]!==w||e[2]!==o||e[3]!==m?(y=Se=>{const ue=o[w],te=o[Se];!ue||!te||Se===w||(F(se=>new Set(se).add(ue.pointer)),Z(se=>({...se,[ue.pointer]:m[ue.pointer]??0,[te.pointer]:m[te.pointer]??0})),z(Se))},e[1]=w,e[2]=o,e[3]=m,e[4]=y):y=e[4];const C=y;let x;e[5]!==w||e[6]!==C?(x=Se=>{if(!Se)return;const ue=te=>{const se={ArrowLeft:-1,ArrowRight:1}[te.key];!se||te.defaultPrevented||te.altKey||te.ctrlKey||te.metaKey||te.shiftKey||Pl(te.target)||(te.preventDefault(),C(w+se))};return Se.ownerDocument.addEventListener("keydown",ue),()=>Se.ownerDocument.removeEventListener("keydown",ue)},e[5]=w,e[6]=C,e[7]=x):x=e[7];const Y=x;if(!I)return null;let M,ge,me,le,ee;if(e[8]!==H||e[9]!==w||e[10]!==a||e[11]!==o||e[12]!==m||e[13]!==C||e[14]!==j||e[15]!==Y||e[16]!==A||e[17]!==n||e[18]!==k||e[19]!==s){const{title:Se,description:ue}=kc(s,o,w,a,n.author??null);let te;e[25]!==n?(te=se=>{se.detail>1||n.onApply()},e[25]=n,e[26]=te):te=e[26],M=te,ge=A?Y:void 0,me="flex min-w-0 flex-col gap-3",e[27]!==H||e[28]!==w||e[29]!==o||e[30]!==m||e[31]!==C||e[32]!==A||e[33]!==k||e[34]!==s?(le=A&&i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("div",{role:"group","aria-label":s("sectionsEditor.formConflict.steps"),className:"-m-1 flex flex-wrap items-center",children:o.map((se,Te)=>{const X=Te!==w&&(m[se.pointer]??0)>(k[se.pointer]??0);return i.jsx("button",{type:"button","aria-label":X?s("sectionsEditor.formConflict.stepChangedAgain",{label:se.label}):se.label,"aria-current":Te===w?"step":void 0,"data-answered":Te!==w&&H.has(se.pointer)?"":void 0,"data-changed-again":X?"":void 0,onClick:()=>C(Te),className:"group cursor-pointer rounded-full p-1 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:i.jsx("span",{className:ae("block h-2 w-2 rounded-full bg-border transition-[width,background-color,box-shadow] motion-reduce:transition-none","group-hover:bg-muted-foreground/60","group-data-[answered]:bg-foreground/45","group-aria-[current=step]:w-5 group-aria-[current=step]:bg-foreground","group-data-[changed-again]:ring-2 group-data-[changed-again]:ring-warning group-data-[changed-again]:ring-offset-1 group-data-[changed-again]:ring-offset-background")})},se.pointer)})}),i.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:s("sectionsEditor.formConflict.stepCount",{step:String(w+1),count:String(o.length)})})]}),e[27]=H,e[28]=w,e[29]=o,e[30]=m,e[31]=C,e[32]=A,e[33]=k,e[34]=s,e[35]=le):le=e[35],ee=j(Se,ue),e[8]=H,e[9]=w,e[10]=a,e[11]=o,e[12]=m,e[13]=C,e[14]=j,e[15]=Y,e[16]=A,e[17]=n,e[18]=k,e[19]=s,e[20]=M,e[21]=ge,e[22]=me,e[23]=le,e[24]=ee}else M=e[20],ge=e[21],me=e[22],le=e[23],ee=e[24];let pe;e[36]!==ge||e[37]!==me||e[38]!==le||e[39]!==ee?(pe=i.jsxs("div",{ref:ge,className:me,children:[le,ee]}),e[36]=ge,e[37]=me,e[38]=le,e[39]=ee,e[40]=pe):pe=e[40];const ce=!v&&"sr-only";let he;e[41]!==ce?(he=ae("text-sm text-muted-foreground",ce),e[41]=ce,e[42]=he):he=e[42];let ve;e[43]!==v||e[44]!==A||e[45]!==s?(ve=v?s(A?"sectionsEditor.formConflict.changedAgainSteps":"sectionsEditor.formConflict.changedAgain"):"",e[43]=v,e[44]=A,e[45]=s,e[46]=ve):ve=e[46];let b;e[47]!==he||e[48]!==ve?(b=i.jsx("p",{role:"status",className:he,children:ve}),e[47]=he,e[48]=ve,e[49]=b):b=e[49];const B=A?"vertical":"all";let xe;e[50]!==I||e[51]!==n||e[52]!==B?(xe=i.jsx(Dc,{field:I,...n,arrows:B}),e[50]=I,e[51]=n,e[52]=B,e[53]=xe):xe=e[53];let T;e[54]!==b||e[55]!==xe?(T=i.jsxs("div",{className:"-mx-2 flex min-h-0 flex-col gap-3 overflow-y-auto px-2 py-1",children:[b,xe]}),e[54]=b,e[55]=xe,e[56]=T):T=e[56];let ye;e[57]!==M||e[58]!==w||e[59]!==C||e[60]!==V||e[61]!==A||e[62]!==s?(ye=A?i.jsxs(no,{className:"flex-row flex-wrap items-center justify-between gap-2 sm:justify-between",children:[i.jsx(_t,{type:"button",variant:"outline","aria-disabled":w===0,onClick:()=>C(w-1),className:"aria-disabled:cursor-default aria-disabled:opacity-45",children:s("sectionsEditor.formConflict.back")}),i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:V?M:()=>C(w+1),children:s(V?"sectionsEditor.formConflict.ok":"sectionsEditor.formConflict.next")})]}):i.jsx(no,{className:"items-center gap-2",children:i.jsx(_t,{type:"button","data-testid":"form-conflict-primary",onClick:M,children:s("sectionsEditor.formConflict.ok")})}),e[57]=M,e[58]=w,e[59]=C,e[60]=V,e[61]=A,e[62]=s,e[63]=ye):ye=e[63];let K;return e[64]!==pe||e[65]!==T||e[66]!==ye?(K=i.jsxs(i.Fragment,{children:[pe,T,ye]}),e[64]=pe,e[65]=T,e[66]=ye,e[67]=K):K=e[67],K}function Cc(){return new Set}function Nc(n){const e=Hn(n.mine,n.schema),s=Hn(n.theirs,n.schema),o=e.kind==="text"&&s.kind==="text"?xc(e.text,s.text):null;return a=>o?i.jsx(Pc,{parts:o[a]}):i.jsx(Bc,{preview:a==="mine"?e:s})}const Tc={all:{ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},vertical:{ArrowDown:1,ArrowUp:-1}};function Vc(n,e){const s=Tc[e][n.key];if(!s)return;const o=[...n.currentTarget.querySelectorAll('[role="radio"]')],a=o.indexOf(document.activeElement);if(a<0)return;n.preventDefault();const u=o[(a+s+o.length)%o.length];u?.focus(),u?.click()}function Dc(n){const e=it.c(65),{field:s,choices:o,viewer:a,author:u,onChoose:h,arrows:d}=n,v=u===void 0?null:u,m=Ft(),[j]=Wi(),{language:A}=j;let $,z,H,F,f,k,Z,w,I,V,y,C,x,Y;if(e[0]!==d||e[1]!==v||e[2]!==o||e[3]!==s||e[4]!==A||e[5]!==h||e[6]!==m||e[7]!==a?.image||e[8]!==a?.name){const me=Nc(s),le=o[s.pointer]??"mine",ee=a?.image??void 0;let pe;e[23]!==m||e[24]!==a?.name?(pe=mo(a?.name)||m("sectionsEditor.formConflict.you"),e[23]=m,e[24]=a?.name,e[25]=pe):pe=e[25];let ce;e[26]!==ee||e[27]!==pe?(ce=i.jsx(ms,{url:ee,fallback:pe,shape:"circle",size:"sm",className:"text-xs"}),e[26]=ee,e[27]=pe,e[28]=ce):ce=e[28];const he=ce;let ve;e[29]!==v||e[30]!==he?(ve=v?.you?he:v?.name?i.jsx(ms,{url:v.avatarUrl,fallback:mo(v.name),shape:"circle",size:"sm",className:"text-xs"}):i.jsx(ms,{url:"icon://user",fallback:"",muted:!0,shape:"circle",size:"sm"}),e[29]=v,e[30]=he,e[31]=ve):ve=e[31];const b=ve,B=v?new Date(v.at):null;H="radiogroup",F=s.label,f="flex flex-col gap-2",e[32]!==d?(k=K=>Vc(K,d),e[32]=d,e[33]=k):k=e[33];let xe;e[34]!==s.pointer||e[35]!==h?(xe=()=>h(s.pointer,"mine"),e[34]=s.pointer,e[35]=h,e[36]=xe):xe=e[36];let T;e[37]!==m?(T=m("sectionsEditor.formConflict.you"),e[37]=m,e[38]=T):T=e[38];let ye;e[39]!==m?(ye=m("sectionsEditor.formConflict.yourVersionNotSaved"),e[39]=m,e[40]=ye):ye=e[40],Z=i.jsx(po,{side:"mine",checked:le==="mine",onChoose:xe,avatar:he,who:T,meta:ye,children:me("mine")}),$=po,w="theirs",I=le==="theirs",e[41]!==s.pointer||e[42]!==h?(V=()=>h(s.pointer,"theirs"),e[41]=s.pointer,e[42]=h,e[43]=V):V=e[43],y=b,e[44]!==v?.name||e[45]!==v?.you||e[46]!==m?(C=v?.you?m("sectionsEditor.formConflict.youElsewhere"):v?.name||m("sectionsEditor.formConflict.someoneElse"),e[44]=v?.name,e[45]=v?.you,e[46]=m,e[47]=C):C=e[47],x=B?m("sectionsEditor.formConflict.savedAt",{when:Ml(B,A)}):m("sectionsEditor.formConflict.theirVersionSaved"),Y=B?Mc(B,A):void 0,z=me("theirs"),e[0]=d,e[1]=v,e[2]=o,e[3]=s,e[4]=A,e[5]=h,e[6]=m,e[7]=a?.image,e[8]=a?.name,e[9]=$,e[10]=z,e[11]=H,e[12]=F,e[13]=f,e[14]=k,e[15]=Z,e[16]=w,e[17]=I,e[18]=V,e[19]=y,e[20]=C,e[21]=x,e[22]=Y}else $=e[9],z=e[10],H=e[11],F=e[12],f=e[13],k=e[14],Z=e[15],w=e[16],I=e[17],V=e[18],y=e[19],C=e[20],x=e[21],Y=e[22];let M;e[48]!==$||e[49]!==z||e[50]!==w||e[51]!==I||e[52]!==V||e[53]!==y||e[54]!==C||e[55]!==x||e[56]!==Y?(M=i.jsx($,{side:w,checked:I,onChoose:V,avatar:y,who:C,meta:x,metaTitle:Y,children:z}),e[48]=$,e[49]=z,e[50]=w,e[51]=I,e[52]=V,e[53]=y,e[54]=C,e[55]=x,e[56]=Y,e[57]=M):M=e[57];let ge;return e[58]!==H||e[59]!==F||e[60]!==f||e[61]!==k||e[62]!==Z||e[63]!==M?(ge=i.jsxs("div",{role:H,"aria-label":F,className:f,onKeyDown:k,children:[Z,M]}),e[58]=H,e[59]=F,e[60]=f,e[61]=k,e[62]=Z,e[63]=M,e[64]=ge):ge=e[64],ge}const Mc=(n,e)=>n.toLocaleString(e,{dateStyle:"medium",timeStyle:"short"});function mo(n){return(n??"").trim().split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join("")}function po(n){const e=it.c(28),{side:s,checked:o,onChoose:a,avatar:u,who:h,meta:d,metaTitle:v,children:m}=n,j=R.useId(),A=`${j}-who`,$=`${j}-meta ${j}-value`,z=o?0:-1,H=o?"border-primary bg-primary/5 ring-1 ring-primary":"hover:bg-muted/50";let F;e[0]!==H?(F=ae("grid w-full cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-start gap-3 rounded-xl border bg-background p-3 text-left transition-[border-color,box-shadow,background-color] outline-none","focus-visible:ring-2 focus-visible:ring-ring/50",H),e[0]=H,e[1]=F):F=e[1];const f=`${j}-who`;let k;e[2]!==f||e[3]!==h?(k=i.jsx("span",{id:f,className:"text-sm font-medium text-foreground",children:h}),e[2]=f,e[3]=h,e[4]=k):k=e[4];const Z=`${j}-meta`;let w;e[5]!==d||e[6]!==v||e[7]!==Z?(w=i.jsx("span",{id:Z,title:v,children:d}),e[5]=d,e[6]=v,e[7]=Z,e[8]=w):w=e[8];let I;e[9]!==k||e[10]!==w?(I=i.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[k,w]}),e[9]=k,e[10]=w,e[11]=I):I=e[11];const V=`${j}-value`,y=`conflict-${s}`;let C;e[12]!==m||e[13]!==V||e[14]!==y?(C=i.jsx("span",{id:V,"data-testid":y,className:"min-w-0 text-sm",children:m}),e[12]=m,e[13]=V,e[14]=y,e[15]=C):C=e[15];let x;e[16]!==I||e[17]!==C?(x=i.jsxs("span",{className:"flex min-w-0 flex-col gap-1",children:[I,C]}),e[16]=I,e[17]=C,e[18]=x):x=e[18];let Y;return e[19]!==u||e[20]!==o||e[21]!==a||e[22]!==A||e[23]!==x||e[24]!==$||e[25]!==z||e[26]!==F?(Y=i.jsxs("button",{type:"button",role:"radio","aria-checked":o,"aria-labelledby":A,"aria-describedby":$,tabIndex:z,onClick:a,className:F,children:[u,x]}),e[19]=u,e[20]=o,e[21]=a,e[22]=A,e[23]=x,e[24]=$,e[25]=z,e[26]=F,e[27]=Y):Y=e[27],Y}function Pc(n){const e=it.c(4),{parts:s}=n;let o;e[0]!==s?(o=s.map(Ic),e[0]=s,e[1]=o):o=e[1];let a;return e[2]!==o?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:o}),e[2]=o,e[3]=a):a=e[3],a}function Ic(n,e){return n.kind==="changed"?i.jsx("mark",{className:"rounded-sm bg-warning/20 px-0.5 text-foreground",children:n.text},e):i.jsx("span",{children:n.text},e)}function Bc(n){const e=it.c(29),{preview:s}=n,o=Ft();switch(s.kind){case"empty":{let a;e[0]!==o?(a=o("sectionsEditor.formConflict.empty"),e[0]=o,e[1]=a):a=e[1];let u;return e[2]!==a?(u=i.jsx("span",{className:"italic text-muted-foreground",children:a}),e[2]=a,e[3]=u):u=e[3],u}case"text":{let a;return e[4]!==s.text?(a=i.jsx("span",{className:"whitespace-pre-wrap break-words",children:s.text}),e[4]=s.text,e[5]=a):a=e[5],a}case"image":{let a;return e[6]!==s.src?(a=i.jsx("img",{src:s.src,alt:"",className:"max-h-24 max-w-full rounded border object-contain"}),e[6]=s.src,e[7]=a):a=e[7],a}case"yesNo":{const a=s.value?"sectionsEditor.formConflict.yes":"sectionsEditor.formConflict.no";let u;e[8]!==o||e[9]!==a?(u=o(a),e[8]=o,e[9]=a,e[10]=u):u=e[10];let h;return e[11]!==u?(h=i.jsx("span",{children:u}),e[11]=u,e[12]=h):h=e[12],h}case"list":{const a=s.count===1?"sectionsEditor.formConflict.oneItem":"sectionsEditor.formConflict.items",u=String(s.count);let h;e[13]!==o||e[14]!==a||e[15]!==u?(h=o(a,{count:u}),e[13]=o,e[14]=a,e[15]=u,e[16]=h):h=e[16];let d;e[17]!==h?(d=i.jsx("span",{className:"text-muted-foreground",children:h}),e[17]=h,e[18]=d):d=e[18];let v;e[19]!==s.count||e[20]!==s.items?(v=s.items.some(Boolean)&&i.jsxs("span",{className:"flex flex-col",children:[s.items.map(Fc),s.count>s.items.length&&i.jsx("span",{children:"…"})]}),e[19]=s.count,e[20]=s.items,e[21]=v):v=e[21];let m;return e[22]!==d||e[23]!==v?(m=i.jsxs("span",{className:"flex flex-col gap-1",children:[d,v]}),e[22]=d,e[23]=v,e[24]=m):m=e[24],m}case"fields":{let a;e[25]!==s.entries?(a=s.entries.map(Kc),e[25]=s.entries,e[26]=a):a=e[26];let u;return e[27]!==a?(u=i.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5",children:a}),e[27]=a,e[28]=u):u=e[28],u}}}function Kc(n){return i.jsxs("div",{className:"contents",children:[i.jsx("dt",{className:"text-muted-foreground",children:n.label}),i.jsx("dd",{className:"truncate",children:n.text})]},n.label)}function Fc(n,e){return i.jsx("span",{className:"truncate",children:`${e+1}. ${n||"…"}`},e)}function Oc(n,e){return n.kind==="protocol"&&n.source==="github"?e:null}function Lc(n,e){if(Object.hasOwn(n,e))return n[e]??null;const s=Yr(e),o=Object.keys(n).find(a=>Yr(a)===s);return o===void 0?null:n[o]??null}async function $c(n,e){try{const s=await fetch(`/api/${n.orgSlug}/decofile/${encodeURIComponent(n.virtualMcpId)}/${encodeURIComponent(n.branch)}`,{cache:"no-store",headers:Na("v8")});if(!s.ok)return null;const o=await s.json().catch(()=>({})),a=Lc(o.changedBy??{},e);return a&&typeof a.userId=="string"&&Number.isFinite(Date.parse(a.at))?a:null}catch{return null}}function zc(n,e,s){const o=e.find(h=>h.userId===n.userId),a=o?.user?.name?.trim(),u=o?.user?.image??void 0;return{...a?{name:a}:{},...u?{avatarUrl:u}:{},at:n.at,you:!!s&&n.userId===s}}function Hc(n){let e=2166136261,s=0;for(let o=0;o<n.length;o++){const a=n.charCodeAt(o);e=Math.imul(e^a,16777619),s=Math.imul(s,31)+a|0}return`${(e>>>0).toString(36)}${(s>>>0).toString(36)}:${n.length}`}function Wc(n,e,s){const o=it.c(19),a=!!n&&!!e&&s!==null;let u;o[0]!==e||o[1]!==n||o[2]!==s?(u=yo.conflictAuthor(n?`${n.orgSlug}/${n.virtualMcpId}/${n.branch}`:"",e??"",s??""),o[0]=e,o[1]=n,o[2]=s,o[3]=u):u=o[3];let h;o[4]!==e||o[5]!==n?(h=()=>$c(n,e),o[4]=e,o[5]=n,o[6]=h):h=o[6];let d;o[7]!==a||o[8]!==u||o[9]!==h?(d={queryKey:u,queryFn:h,enabled:a,staleTime:Number.POSITIVE_INFINITY,gcTime:6e5,retry:!1,refetchOnWindowFocus:!1},o[7]=a,o[8]=u,o[9]=h,o[10]=d):d=o[10];const{data:v}=qi(d),m=a?v??null:null,j=!!m;let A;o[11]!==j?(A={enabled:j},o[11]=j,o[12]=A):A=o[12];const{data:$}=Il(A);let z;o[13]!==$?(z=$?.data?.members??[],o[13]=$,o[14]=z):z=o[14];const H=z,{data:F}=xo.useSession();if(!m)return null;const f=F?.user?.id??null;let k;return o[15]!==m||o[16]!==H||o[17]!==f?(k=zc(m,H,f),o[15]=m,o[16]=H,o[17]=f,o[18]=k):k=o[18],k}function qc(n,e,s,o){if(!n||typeof n!="object")return{kind:"error",reason:"no-matcher-rule"};const a=e.trim();if(!a)return Gt(n,s,o)?{kind:"inline",blockKey:n.__resolveType??"",inlinedRule:xs(n,s,o)}:{kind:"noop"};const u=ys(n,s,o);if(!u)return{kind:"error",reason:"unreadable-rule"};if(u.blockKey)return{kind:"updateBlock",blockKey:u.blockKey,blockData:Kt(u.resolveType,u.data,a)};const h=Fn(a),d=On(h,s);return d?{kind:"error",reason:"invalid-block-id",message:d}:{kind:"createBlock",blockId:h,blockData:Kt(u.resolveType,u.data,a),reference:on(h)}}const ho="section-form-stale-save",Gc=3,Uc=1e3;function go(n,e){const s=e.global&&e.pageKey?[{label:"Default",sections:[{__resolveType:e.pageKey}]}]:So(e.pageKey?n[e.pageKey]?.sections:void 0,n),o=Math.max(0,Math.min(e.pageVariantIndex,s.length-1)),a=s[o]?.sections??[];return{pageVariants:s,variantIndex:o,rawSections:a,parsedSections:_n(a,n)}}const vo=new WeakMap;let Yc=0;function Jc(n){let e=vo.get(n);return e===void 0&&(e=++Yc,vo.set(n,e)),e}function tm({orgSlug:n,virtualMcpId:e,branch:s,previewReady:o=!0,previewUrl:a,currentPath:u,activePageBlockKey:h=null,activeGlobalBlockKey:d=null,externalSelection:v,onSaved:m,initialEditSeo:j=!1,onExitSeo:A,onSelectRoot:$,onViewJsonFile:z,onFocusedBlockChange:H,onVariantPreviewOverride:F}){const f=Ft(),k=Yi(),Z=k?.taskId??null,w=o?{orgSlug:n,virtualMcpId:e,branch:s,threadId:Z,previewUrl:a}:null,[I,V]=R.useState([]),{data:y,isLoading:C}=Ta(w,{pollWhile:I.length>0}),{data:x,isLoading:Y}=ia(w),M=Wn(),ge=k?.virtualMcpId,le=ka(ge===e?e:null)?.metadata?.siteSlug??null,ee=Rl({virtualMcpId:e,branch:s,sandboxUrl:a}),pe=Va(e,s),ce=Da(pe),he=!ce,ve=!!ee||ce,[b,B]=R.useState(null),[xe,T]=R.useState(null),[ye,K]=R.useState(null),[Se,ue]=R.useState(0),[te,se]=R.useState(void 0),[Te,X]=R.useState(null),[_e,be]=R.useState(null),[q,O]=R.useState([]),Ke=R.useRef(null),[Qe,Ze]=R.useState(q.length);Qe!==q.length&&(Ze(q.length),requestAnimationFrame(()=>{Ke.current&&(Ke.current.scrollTop=0)}));const[Ye,Q]=R.useState(0),[ke,He]=R.useState(null),[We,Ee]=R.useState(null),[Ie,Ve]=R.useState(null),[Xe,Fe]=R.useState(!1),[re,dt]=R.useState(!1),ne=R.useRef(null),[De,yt]=R.useState(!0),[et,ft]=R.useState(!1),[Ot,kn]=R.useState(!1),[qe,an]=R.useState(j),[Cs,Ns]=R.useState(j);j&&!Cs&&(Ns(!0),an(!0),B(null),T(null),K(null),O([])),!j&&Cs&&Ns(!1);const[Do,ln]=R.useState(null),[Ts,En]=R.useState(void 0),[Vs,Lt]=R.useState([]),[Ds,Yt]=R.useState(0),[Je,at]=R.useState(0),[Mo,tt]=R.useState(null),[Jt,st]=R.useState(null),[Ms,Ps]=R.useState(null),Is=Gi(),Bs=Ma({orgSlug:n,virtualMcpId:e,branch:s},{tunnel:!1}),cn=aa({orgSlug:n,virtualMcpId:e,branch:s}),[Po,Io]=R.useState(u),[Bo,Ko]=R.useState(h),[Fo,Oo]=R.useState(d);(Po!==u||Bo!==h||Fo!==d)&&(queueMicrotask(()=>cn.flush()),Io(u),Ko(h),Oo(d),B(null),T(null),K(null),ue(0),X(null),be(null),at(0),tt(null),st(null),O([]),Q(t=>t+1),an(!1),ln(null),En(void 0),Lt([]),Yt(t=>t+1));const G=la({orgSlug:n,virtualMcpId:e,branch:s}),un=ja((t,r)=>{G.mutate({blockKey:t,data:r},{onSuccess:()=>m?.(),onError:G.reportError})}),Rn=Oa({orgSlug:n,virtualMcpId:e,branch:s}),[Qt,Zt]=R.useState(!1),W=R.useRef(null),At=R.useRef(null),mt=R.useRef(null),pt=R.useRef(null),An=R.useRef({}),$t=R.useRef(null),dn=R.useRef(!1),fn=R.useRef(!1),Oe=R.useRef(new Map),Xt=R.useRef(!1),St=R.useRef([]),qn=R.useRef(new WeakSet);Pa(n,e,t=>{const{activePageKey:r,rawSections:l,parsedSections:c,selectedSectionIndex:p}=Le.current,S=new Set;r&&S.add(r);for(const g of[At.current?.sectionIndex,p]){const _=g==null?void 0:l[g],L=g==null?void 0:c[g],N=_&&L?.isSavedBlock?ds(_,L):null;N&&S.add(N)}if([...S].some(g=>t.has(g))){for(const g of[W,mt,pt])g.current&&clearTimeout(g.current),g.current=null;At.current=null,Oe.current.clear(),r&&t.has(r)&&(An.current={})}});const Le=R.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null}),[Ks,Fs]=R.useState(0),[Lo,$o]=R.useState(0),zo=Wc(Oc(pe,{orgSlug:n,virtualMcpId:e,branch:s}),I[0]?.blockKey??null,I[0]?Hc(ze(I[0].plan.theirs)):null),[Ho,Wo]=R.useState(null),Gn=Ia(n,e).epoch,[qo,Go]=R.useState(Gn);if(!o||C||Y)return i.jsx("div",{className:"h-full w-full flex items-center justify-center",children:i.jsx(Ui,{className:"size-5 text-muted-foreground"})});if(!y||!x)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const Uo=Ha(y,x),ie=!!d,je=ie?null:Wa(Uo,u,h),E=ie?d:je?.key??null,Un=ie&&d?y[d]:void 0,Os=ie&&d&&Un?qa(d,Un):ie&&d?d:"",mn=!ie&&E&&y[E]?y[E]:null,Yn=qe&&y&&x&&E&&je?Kr(y,{kind:"page",pageKey:E,pageName:String(je.name??""),path:String(je.path??"")},x):null,Yo=qe?mn?.seo:void 0,Cn=Ts!==void 0?Ts:Yo,Jo=qe?ca(Cn):void 0,Ls=Yn?.seoTypeOptions??[],$s=qe&&x?ua(x):"",Jn=Do??Jo??{},Nn=qe&&Yn?Bl(Jn,Yn):null,zs=qe&&Nn&&da(Cn)?Kn(Nn,x):null,Hs=qe?fa(y,x)?.seoData:void 0,Me=ie?[{label:"Default",sections:[{__resolveType:d}]}]:So(mn?.sections,y??{}),ht=Me.length>1,we=Math.min(Se,Me.length-1),rt=Me[we],U=rt?.sections??[],Pe=_n(U,y),Qn=!ie&&Ga(mn?.sections);if(ie&&d&&Ms!==d){Ps(d);const t=U[0],r=Pe[0];if(t&&r){B(0),at(0),O([]);const l=jt(t,r,y);l&&(T(l.data),K(l.resolveType),st(null),tt(null))}}!ie&&Ms!==null&&Ps(null),Le.current={rawSections:U,parsedSections:Pe,decofile:y??{},activePageKey:E,pageVariants:Me,variantIndex:we,sectionVariantIndex:Je,selectedSectionIndex:b};const Qo=()=>({multivariate:Qn,index:we,variants:Me.map(t=>({rule:t.rule}))}),Zn=(t,r)=>{if(!F)return;if(!E||!Qn||t.length<=1){F(null);return}const l={multivariate:!0,index:r,variants:t},c=ce?ro(E,l):oo(E,l,y,x);F(c.length>0?c:null)},Xn=F&&E&&Qn&&ht&&!C&&!Y?E:null;if(Xn!==Ho&&(Wo(Xn),Xn)){const t=Me.map(l=>({rule:l.rule})),r=we;queueMicrotask(()=>Zn(t,r))}const en=(t,r,l)=>{if(!F)return;if(!E){F(null);return}const c=Qo(),p=ce?ro(E,c):oo(E,c,y,x);if(!t||r<0){F(p.length>0?p:null);return}const S={pageKey:E,page:c,sectionIndex:r,sectionLazy:Pe[r]?.isLazy??!1,mvObj:t,selectedVariantIndex:l},g=ce?Fl(S):Ol({...S,decofile:y,meta:x}),_=[...p,...g];F(_.length>0?_:null)},bt=(t,r,l,c=b??-1,p=!1)=>{const S=xt(t,r);if(!S){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const _=vs(S,wt)[l];if(!_){T(null),K(null),st(null),tt(null),p&&en(null,c,l);return}const L=wo(_.value,y);T(L?.data??null),K(L?.resolveType??null);const{resolveType:N,formValue:D}=jn(_.rule,y,x??void 0);st(N),tt(D),p&&en(S,c,l)},pn=v?.index;if(v!==void 0&&(v?.seq??null)!==te&&(se(v?.seq??null),typeof pn=="number")){const t=U[pn],r=Pe[pn];if(t&&r)if(B(pn),at(0),O([]),Q(l=>l+1),r.isMultivariate)bt(t,r,0,pn);else{const l=jt(t,r,y);l?(T(l.data),K(l.resolveType)):(T(null),K(null)),st(null),tt(null)}}if(Gn!==qo){Go(Gn);const t=W.current!==null||Oe.current.size>0||pt.current!==null||mt.current!==null||G.isPending||cn.isPending||I.length>0,r=b!==null&&co(Ke.current,document.activeElement);if(!t&&r&&(Xt.current=!0),!t&&!r&&b!==null){const l=U[b],c=Pe[b];if(O([]),Q(p=>p+1),!l||!c)B(null),T(null),K(null);else if(c.isMultivariate)bt(l,c,Je,b);else{const p=jt(l,c,y);T(p?.data??null),K(p?.resolveType??null)}}!t&&qe&&(ln(null),En(void 0),Yt(l=>l+1))}if(Ks!==Lo){$o(Ks);const t=b!==null?U[b]:null,r=b!==null?Pe[b]:null;if(t&&r&&b!==null)if(O([]),Q(l=>l+1),r.isMultivariate)bt(t,r,Je,b);else{const l=jt(t,r,y);T(l?.data??null),K(l?.resolveType??null)}}const lt=I[0];if(lt){const{formBase:t,target:r}=lt,l=go(y,r),c=t.sectionIndex,p=l.rawSections.length===t.sectionCount?hs(l.rawSections[c],l.parsedSections[c],r.sectionVariantIndex,y):null,S=lc(lt,p,g=>ao(t,g));if(S){const _=[{...lt,...S,changedAgain:!0},...I.slice(1)];St.current=_,V(_)}}const hn={orgSlug:n,virtualMcpId:e,branch:s,threadId:Z,previewUrl:ce?void 0:a??void 0,siteSlug:le},Tn=ye&&x?Kn(ye,x):null,ct=(t,r)=>{if(!E)return;W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear(),pt.current&&(clearTimeout(pt.current),pt.current=null),mt.current&&(clearTimeout(mt.current),mt.current=null);const l=Sn(y,E,t,we,Me);G.mutate({blockKey:E,data:l},{onSuccess:()=>r?.onSuccess?.()??m?.(),onError:c=>{r?.onError?.(),G.reportError(c)}})},zt=()=>{H?.(null),B(null),kn(!1),T(null),K(null),at(0),tt(null),st(null),O([]),Q(t=>t+1)},Ws=()=>co(Ke.current,document.activeElement),es=(t=f("sectionsEditor.sectionsEditor.blockChangedElsewhere"))=>{if(W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear(),At.current=null,oe.error(t,{id:ho}),Ws()){Xt.current=!0;return}Fs(r=>r+1)},qs=()=>{!Xt.current||Ws()||St.current.length>0||W.current!==null||dn.current||fn.current||Oe.current.size>0||(Xt.current=!1,Fs(t=>t+1))},Gs=()=>{Xt.current&&setTimeout(qs,0)},Us=t=>Ka(Is,Bs,t),Ys=t=>{Oe.current.size!==0&&setTimeout(()=>{if(dn.current||fn.current)return;const r=[...Oe.current.values()];Oe.current.clear();for(const l of r)l()},t)},Zo=t=>{const{activePageKey:r,variantIndex:l,sectionVariantIndex:c}=Le.current,p=$t.current;return{formBase:p?.sectionIndex===t&&p.variantIndex===c?p:null,pageKey:r,global:ie,pageVariantIndex:l,sectionVariantIndex:c,schema:Tn}},gn=t=>{St.current=t,V(t)},Xo=t=>{const r=St.current,l=r.findIndex(S=>S.formBase===t.formBase),c=l>=0?r[l]:void 0,p=c?r.with(l,{...t,choices:ks(c.plan,c.choices,t.plan),fresh:To(c.plan,t.plan,c.fresh),changedAgain:c.changedAgain||ze(c.plan.theirs)!==ze(t.plan.theirs)}):[...r,{...t,changedAgain:qn.current.has(t.formBase)}];gn(p)},Js=(t,r)=>{const l=St.current,c=l.findIndex(g=>g.formBase===t),p=l[c];if(!p)return!1;if(ze(p.plan.mine)===ze(r))return!0;const S=ws({...p.plan,mine:r});if(S.pointers.length===0){const g=l.filter(_=>_!==p);return gn(g),!1}return gn(l.with(c,{...p,plan:S,choices:ks(p.plan,p.choices,S)})),!0},ei=t=>{const r=Le.current;return r.selectedSectionIndex===t.formBase.sectionIndex&&r.activePageKey===t.target.pageKey&&r.variantIndex===t.target.pageVariantIndex&&r.sectionVariantIndex===t.target.sectionVariantIndex},ti=()=>{const t=St.current[0];if(!t)return null;const{formBase:r,target:l}=t;W.current&&At.current?.sectionIndex===r.sectionIndex&&At.current.sectionVariantIndex===l.sectionVariantIndex&&(clearTimeout(W.current),W.current=null,At.current=null),Oe.current.delete(`${l.pageKey}:${r.sectionIndex}:${l.sectionVariantIndex}`);const c=r.emitted;return c&&typeof c=="object"&&!Js(r,c)&&vn(c,r.sectionIndex,0,l),St.current[0]??null},ni=()=>{const t=St.current[0],r=ti();if(!r||!t||r.formBase!==t.formBase||r.plan.pointers.some(S=>!t.plan.pointers.includes(S)))return;const l=ic(r.plan,r.choices);gn(St.current.slice(1));const{formBase:c,target:p}=r;c.base=r.plan.theirs,c.version=void 0,c.emitted=l,qn.current.add(c),($t.current===c||ei(r))&&($t.current=c,T(l),Q(S=>S+1)),vn(l,c.sectionIndex,0,p)},si=t=>{const[r,...l]=St.current;r&&gn([{...r,choices:t},...l])},vn=(t,r,l=0,c)=>{const p=c??Zo(r),S=p.sectionVariantIndex,g=p.formBase,_=At.current;W.current&&(clearTimeout(W.current),W.current=null,_&&(_.sectionIndex!==r||_.sectionVariantIndex!==S)&&_.write());const L=`${p.pageKey}:${r}:${S}`,N=()=>{if(dn.current||fn.current){Oe.current.set(L,N);return}const D=typeof t=="function"?t():t;if(g&&Js(g,D))return;const P=Le.current.decofile,{rawSections:de,parsedSections:Re,pageVariants:nt,variantIndex:Be}=go(P,p),Ge=p.pageKey,J=de[r];if(!J)return;const fe=Re[r];if(!fe)return;const Ce=g?.base,Ue=hs(J,fe,S,P),gt=!!Ce&&!!Ue&&Ao(Ce,Ue)&&!(g&&ao(g,Ue));if(gt&&Ce&&Ue){if(Co(Ce,Ue)){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}const Ae=fe.isSavedBlock?"here":rc(Ce,de.map((Ne,Mt)=>hs(Ne,Re[Mt],S,P)),r,g?.sectionCount??de.length);if(Ae==="unknown"){es(f("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}if(typeof Ae=="number"&&g){g.sectionCount=de.length,g.sectionIndex=Ae,$t.current===g&&B(Ae),vn(D,Ae,l,p);return}}const ot=gt&&Ce&&Ue?ws({ancestor:Ce,mine:D,theirs:Ue}):null;if(ot&&ot.pointers.length>0&&g){g.sectionCount=de.length,Xo({plan:ot,formBase:g,target:p,sectionIndex:r,choices:No(ot),changedAgain:!1,blockKey:fe.isSavedBlock?ds(J,fe):Ge,fresh:{}});return}const vt=ot?ot.merged:null,Dt=vt??D,Mr=oc({merged:!!vt,tracked:g,current:$t.current,saved:D});vt&&oe.info(f("sectionsEditor.sectionsEditor.blockMergedWithOthers"),{id:ho}),Mr&&g&&(g.emitted=vt,T(vt));const cs=Mr||!vt?Dt:D;g&&(g.base=cs,g.sectionCount=de.length,nc(g,cs));const Pr={onSuccess:()=>{g&&qn.current.delete(g),m?.()},onError:Ae=>{if(g?.base===cs&&Ce&&(g.base=Ce),Ae instanceof Ba){g&&(g.version=void 0),l<Gc?(Oe.current.delete(L),fn.current=!0,setTimeout(()=>{fn.current=!1,vn(()=>{const Ne=g?.emitted;return Ne&&typeof Ne=="object"?Ne:D},r,l+1,p),Oe.current.delete(L),Ys(bn)},Uc*2**l)):es();return}G.reportError(Ae)}},Ir=Ae=>{dn.current=!0;let Ne=!1;G.mutateAsync(Ae).then(()=>Pr.onSuccess(),Mt=>{Ne=!0,Pr.onError(Mt)}).finally(()=>{dn.current=!1,Ys(Ne?bn:0),qs()})};if(fe.isSavedBlock){const Ae=ds(J,fe);if(!Ae)return;Ir({blockKey:Ae,data:Dt,...Ce?{base:{value:vt?Ue:Ce}}:{},rebaseOnConflict:!1,guard:lo({formBase:g,rebased:!!vt,versionOf:Us})});return}if(!Ge)return;const In={...P[Ge]},Wt=[...de];if(fe.isMultivariate){const Ae=xt(J,fe);if(!Ae||!Ge)return;const Ne=al(Ae,S,Dt);Wt[r]=qt(J,fe,Ne)}else if(fe.isHidden){const Ae=Rs(J.__resolveType),Ne=Ae?{...J.section}:{...J},Mt=Array.isArray(Ne.variants)?[...Ne.variants]:[];Mt[0]&&(Mt[0]={...Mt[0],value:Dt}),Ne.variants=Mt,Ae?Wt[r]={...J,section:Ne}:Wt[r]=Ne}else fe.isLazy?Wt[r]={...J,section:Dt}:Wt[r]=Dt;if(nt.length>1){const Ae=In.sections,Ne=[...Ae?.variants??[]];Ne[Be]&&(Ne[Be]={...Ne[Be],value:Wt}),In.sections={...Ae,variants:Ne}}else In.sections=Wt;Ir({blockKey:Ge,data:In,rebaseOnConflict:!1,guard:lo({formBase:null,rebased:!1,versionOf:Us})})};At.current={sectionIndex:r,sectionVariantIndex:S,write:N},W.current=setTimeout(()=>{W.current=null,N()},bn)},ri=t=>{Xt.current=!1,B(t),at(0),O([]),Q(p=>p+1);const r=U[t],l=Pe[t];if(H?.(l?.isSavedBlock?l.resolveType??null:null),!r||!l)return;if(l.isMultivariate){bt(r,l,0,t);return}const c=jt(r,l,y);if(!c){T(null),K(null),st(null),tt(null),en(null,t,0);return}T(c.data),K(c.resolveType),st(null),tt(null),en(null,t,0)},Qs=t=>{const r=t;b!==null&&($t.current=sc($t.current,{sectionIndex:b,variantIndex:Le.current.sectionVariantIndex,shown:xe,next:r,sectionCount:Le.current.rawSections.length})),T(r),b!==null&&vn(r,b)},ts=t=>{if(!E||!y||!x||!je)return;const r={kind:"page",pageKey:E,pageName:String(je.name??""),path:String(je.path??"")},l=Kr(y,r,x);l&&cn.save(E,()=>{const c=Is.getQueryData(yo.decofile(Bs))?.[E];if(!c||typeof c!="object"||c===null||Array.isArray(c))return null;const p={...c,...An.current};return An.current={},t?.raw!==void 0?{...p,seo:t.raw}:t?.inner!==void 0?Kl(r,l,p,t.inner):p})},Zs=(t,r)=>{E&&(An.current[t]=r,ts())},oi=(t,r)=>{if(!E)return;const l=Ln([...U],t,r);b!==null&&(b===t?B(r):t<b&&r>=b?B(b-1):t>b&&r<=b&&B(b+1)),ct(l)},ii=t=>{if(!E)return;const r=U.filter((l,c)=>c!==t);b===t?zt():b!==null&&b>t&&B(b-1),ct(r)},ai=t=>{if(!E)return;const r=U[t];if(!r)return;const l=[...U];l.splice(t+1,0,wa(r)),b!==null&&b>t&&B(b+1),ct(l)},li=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l)return;const c=l.isHidden?nl(r):sl(r);if(!c)return;const p=[...U];p[t]=c,b===t&&zt(),ct(p)},ci=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l||l.isMultivariate)return;const c=tl(r);if(!c)return;const p=[...U];p[t]=c,b===t&&zt(),ct(p)},ui=t=>{if(!E)return;const r=U[t],l=Pe[t];if(!r||!l?.isSavedBlock)return;const c=jt(r,l,y);if(!c?.data)return;const{name:p,...S}=c.data,g=[...U];l.isLazy?g[t]={...r,section:S}:g[t]=S,b===t&&zt(),ct(g)},di=t=>{if(!E)return;const r=[...U,{__resolveType:t.resolveType}],l=r.length-1;ct(r,{onError:()=>{Le.current.selectedSectionIndex===l&&zt()}}),Fe(!1),B(l),at(0),O([]),Q(g=>g+1);const c=r[l],p=_n(r,y)[l];if(!c||!p)return;if(p.isMultivariate){bt(c,p,0);return}const S=jt(c,p,y);if(!S){T(null),K(null),st(null),tt(null);return}T(S.data),K(S.resolveType),st(null),tt(null)},Xs=t=>{ne.current=t.append,Fe(!0)},fi=t=>{const r=ne.current;if(!r){di(t);return}r({__resolveType:t.resolveType}),Fe(!1),ne.current=null},er=t=>{if(b===null)return;const r=U[b],l=Pe[b];!r||!l?.isMultivariate||(at(t),O([]),Q(c=>c+1),bt(r,l,t,b,!0))},mi=t=>{if(b===null||!E)return;const r=U[b],l=Pe[b];if(!r||!l?.isMultivariate)return;const c=xt(r,l);if(!c)return;const p=Xa(c,t);if(!p){oe.error(f("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const S=[...U];S[b]=qt(r,l,p);const g=p.variants;let _=Je;t===Je?_=Math.min(t,g.length-1):t<Je&&(_=Je-1),at(_),O([]),Q(L=>L+1),bt(S[b],l,_),ct(S)},pi=t=>{if(b===null||!E)return;const r=U[b],l=Pe[b];if(!r||!l?.isMultivariate)return;const c=xt(r,l);if(!c)return;const p=el(c,t),S=[...U];S[b]=qt(r,l,p);const g=t+1;at(g),O([]),Q(_=>_+1),bt(S[b],l,g),ct(S)},hi=(t,r)=>{if(b===null||!E||t===r)return;const l=U[b],c=Pe[b];if(!l||!c?.isMultivariate)return;const p=xt(l,c);if(!p)return;const S=Qa(p,t,r),g=[...U];g[b]=qt(l,c,S);let _=Je;Je===t?_=r:t<Je&&r>=Je?_=Je-1:t>Je&&r<=Je&&(_=Je+1),at(_),bt(g[b],c,_),ct(g)},xn=t=>{const r=t??b;if(r===null||!E)return;const l=U[r],c=Pe[r];if(!l||!c)return;const p=Ua(l,c);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const S=[...U];S[r]=p.section;const g=_n(S,y)[r];if(!g?.isMultivariate){oe.error(f("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}B(r),at(p.newVariantIndex),O([]),Q(_=>_+1),bt(p.section,g,p.newVariantIndex,r),ct(S)},tr=()=>{if(b===null||!E)return;const t=U[b],r=Pe[b];if(!t||!r?.isMultivariate)return;const l=xt(t,r);if(!l)return;const c=Za(t,r,l);if(!c){oe.error(f("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const p=[...U];p[b]=c;const S=_n(p,y)[b];if(!S)return;at(0),st(null),tt(null),O([]),Q(_=>_+1);const g=jt(c,S,y);g?(T(g.data),K(g.resolveType)):(T(null),K(null)),en(null,b,0),ct(p)},gi=async t=>{if(ke===null||!E)return;const r=On(t,y,x);if(r){oe.error(r);return}const l=U[ke],c=Pe[ke];if(!l||!c)return;const p=jt(l,c,y);if(!p){oe.error(f("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const S={...p.data,name:t};try{await G.mutateAsync({blockKey:t,data:S});const g=[...U];g[ke]={__resolveType:t},await G.mutateAsync({blockKey:E,data:Sn(y,E,g,we,Me)}),b===ke&&zt(),He(null),oe.success(f("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),m?.()}catch(g){oe.error(f("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"),{description:Pt(f,It(g))})}},nr=rt?.rule;if(ht&&b===null&&_e===null&&nr){const{resolveType:t,formValue:r}=jn(nr,y??{},x??void 0);be(t),X(r)}const tn=x?ma(x):[],ns=x&&y?pa(x,y):[],sr=!ie&&!!(ve&&x&&y),rr=_e&&x?Kn(_e,x):null,Ct=()=>{mt.current&&(clearTimeout(mt.current),mt.current=null),pt.current&&(clearTimeout(pt.current),pt.current=null)},Ht=async(t,r)=>{if(!(il(r,t,x)>0))try{await Rn.mutateAsync({blockKey:t})}catch(l){oe.error(f("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"),{description:Pt(f,It(l))})}},or=t=>{mt.current&&clearTimeout(mt.current),mt.current=setTimeout(()=>{const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p={...l[r]},S={...p.sections},g=[...S.variants??[]],_=g[c],L=_?.rule;if(Gt(L,l,x)){const N=L?.__resolveType??"",D=l[N],P=typeof D?.name=="string"?D.name:N,{__resolveType:de,...Re}=t;G.mutate({blockKey:N,data:Kt(de??"",Re,P)},{onSuccess:()=>m?.(),onError:G.reportError});return}_&&(g[c]={..._,rule:t}),p.sections={...S,variants:g},G.mutate({blockKey:r,data:p},{onSuccess:()=>m?.(),onError:G.reportError})},bn)},ir=t=>{be(t);const r=t?Jr(t,x):{__resolveType:Qr};X(t?r:{}),or(r)},ar=t=>{const r=t;X(r);const l=_e?{__resolveType:_e,...r}:{...r};or(l)},lr=async t=>{Ct();const{activePageKey:r,decofile:l,variantIndex:c}=Le.current;if(!r)return;const p=l[r],S=p?.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[c];if(!L)return;const N=Bt(L.rule,l,x),D=on(t);_[c]={...L,rule:D};const P={...l,[r]:{...p,sections:{...g,variants:_}}},{resolveType:de,formValue:Re}=jn(D,P,x??void 0);be(de),X(Re);try{await G.mutateAsync({blockKey:r,data:P[r]}),N&&N!==t&&await Ht(N,P),m?.()}catch(nt){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(nt))})}},cr=t=>{pt.current&&clearTimeout(pt.current);const{selectedSectionIndex:r,sectionVariantIndex:l}=Le.current;r!==null&&(pt.current=setTimeout(()=>{const{rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(!g)return;const N=c[r],D=p[r];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const Re=(P.variants??[])[l]?.rule;if(Gt(Re,S,x)){const J=Re?.__resolveType??"",fe=S[J],Ce=typeof fe?.name=="string"?fe.name:J,{__resolveType:Ue,...gt}=t;G.mutate({blockKey:J,data:Kt(Ue??"",gt,Ce)},{onSuccess:()=>m?.(),onError:G.reportError});return}const nt=Zr(P,l,t),Be=[...c];Be[r]=qt(N,D,nt);const Ge=Sn(S,g,Be,L,_);G.mutate({blockKey:g,data:Ge},{onSuccess:()=>m?.(),onError:G.reportError})},bn))},vi=t=>{st(t);const r=t?Jr(t,x):{__resolveType:Qr};tt(t?r:{}),cr(r)},xi=t=>{const r=t;tt(r);const l=Jt?{__resolveType:Jt,...r}:{...r};cr(l)},yi=async t=>{Ct();const{selectedSectionIndex:r,sectionVariantIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(r===null||!g)return;const N=c[r],D=p[r];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const de=P.variants??[],Re=Bt(de[l]?.rule,S,x),nt=on(t),Be=Zr(P,l,nt),Ge=[...c];Ge[r]=qt(N,D,Be);const J=Sn(S,g,Ge,L,_),fe={...S,[g]:J},{resolveType:Ce,formValue:Ue}=jn(nt,fe,x??void 0);st(Ce),tt(Ue);try{await G.mutateAsync({blockKey:g,data:J}),Re&&Re!==t&&await Ht(Re,fe),m?.()}catch(gt){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(gt))})}};if(!ie&&!je)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.noPageFound",{currentPath:u})});if(ie&&!Un)return i.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:f("sectionsEditor.sectionsEditor.globalBlockNotFound")});const $e=b!==null?Pe[b]??null:null,ur=b!==null?U[b]:null,dr=ur&&$e?.isMultivariate?xt(ur,$e):null,Nt=dr?vs(dr,wt):[],Vn=Math.min(Je,Math.max(Nt.length-1,0)),nn=Nt[Vn]??null,Tt=$e?.isMultivariate===!0,ss=b!==null&&$e!==null,Vt=ss&&(Tt||!!(Tn&&xe)),Si=Vt&&!ie&&$e?.isSavedBlock===!0,ut=ie||Si,fr=ie?Os:$e?.label??"",bi=Jt&&x?Kn(Jt,x):null,mr=(t,r)=>r&&M?`${t} · ${r}`:t,pr=$e?$e.variantOf??$e.label:"",ji=(()=>{const t=Tt&&nn?nn.label:null;return t?M?[mr(pr,t)]:[$e.label,t]:[$e?.label??""]})(),rs=mr(je?.name??"",ht?rt?.label:null),Dn=Vt&&(!ie||q.length>0)?ie?[Os,...q]:[rs,...ji,...q]:[],hr=qe&&je?[je.name,"SEO",...Vs]:[],gr=f("sectionsEditor.pageVariantTabs.variantsLabel"),vr=et&&je?[je.name,gr]:Ot&&je&&$e?[rs,pr,gr]:[],Mn=vr.length>0?vr:hr.length>0?hr:ut?Dn.length>0?Dn:[fr]:Dn.length>0?Dn:[rs],xr=ss&&!Tt&&!$e?.isHidden&&!!E,wi=ut||!ie&&ht&&!!rt||xr,_i=ss&&!Tt&&!ie&&q.length===0&&!!$e&&jo($e)&&!!E,ki=M&&Vt&&!Ot&&Tt&&q.length===0&&!!nn,yr=M&&q.length>0?Fr(q[q.length-1]):null,Ei=q.length>1?Fr(q[q.length-2]):null,Sr=ut?fr:Vt?$e?.label??"":je?.name??"",Ri=et||Ot?f("sectionsEditor.pageVariantTabs.variantsLabel"):qe?f("sectionsEditor.panelSections.seo"):yr??Sr,br=Ot?$e?.variantOf??$e?.label??"":et||qe?je?.name??"":yr?Ei??Sr:ut?f("sectionsEditor.sectionsEditor.globalSectionSubtitle"):Vt?je?.name??"":je?.path??"",os=!et&&!Ot&&!qe&&!Vt&&!ut,Ai=!M&&!qe&&!ie&&Tt&&q.length===0,yn=()=>{if(!E)return;Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const t=y[E],r=Ya(t.sections,U);if(!r)return;const l=Ja(r);G.mutate({blockKey:E,data:{...t,sections:r}},{onSuccess:()=>{ue(l),B(null),T(null),K(null),O([]),X(null),be(null)},onError:G.reportError})},Pn=(t,r,l)=>{if(!E)return;Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const c=y[E],p=c.sections;if(!p||typeof p!="object"||Array.isArray(p))return;const S=p;if(!Array.isArray(S.variants))return;const g=t([...S.variants]);if(!g)return;const _=ol(S,g),L={...y,[E]:{...c,sections:_}};G.mutate({blockKey:E,data:L[E]},{onSuccess:()=>{r?.();const N=typeof l=="string"?[l]:l??[];(async()=>{for(const D of N)await Ht(D,L)})()},onError:G.reportError})},is=t=>{Ee(null),ue(t),B(null),T(null),K(null),O([]);const r=Me[t]?.rule,{resolveType:l,formValue:c}=jn(r,y??{},x??void 0);be(l),X(c),Zn(Me.map(p=>({rule:p.rule})),t)},jr=(t,r)=>{if(t===r)return;let l=we;we===t?l=r:t<we&&r>=we?l=we-1:t>we&&r<=we&&(l=we+1),ue(l);const c=Ln(Me.map(p=>({rule:p.rule})),t,r);Zn(c,l),Pn(p=>Ln(p,t,r))},wr=t=>{const r=Me[t]?.rule,l=Bt(r,y??{},x??void 0);Pn(c=>c.length<=1?null:(c.splice(t,1),c),()=>{Me.length-1===1?ue(0):t<we?ue(we-1):t===we&&ue(Math.max(0,t-1)),B(null),T(null),K(null),O([]),X(null),be(null)},l)},Ci=()=>{const t=Me.map((r,l)=>({variant:r,index:l})).filter(({variant:r})=>!rl(r.rule)).map(({variant:r})=>Bt(r.rule,y??{},x??void 0)).filter(r=>!!r);Pn(r=>{const l=ll({variants:r}),c=r[l];return c?[{...c,rule:cl()}]:null},()=>{ue(0),B(null),T(null),K(null),O([]),X(null),be(null),ft(!1)},t)},_r=t=>{Pn(r=>ul(r,t),()=>{ue(t+1),B(null),T(null),K(null),O([]),X(null),be(null)})},Ni=async(t,r)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const l=Le.current.activePageKey,c=Le.current.decofile;if(!l)return;const p=c[l],S=p.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const g=S;if(!Array.isArray(g.variants))return;const _=[...g.variants],L=_[t];if(!L?.rule||typeof L.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const N=L.rule,D=r.trim();Zt(!0);try{if(!D){if(!Gt(N,c,x)){Ee(null);return}const Ge=N.__resolveType??"";_[t]={...L,rule:xs(N,c,x)};const J={...c,[l]:{...p,sections:{...g,variants:_}}};await G.mutateAsync({blockKey:l,data:J[l]}),await Ht(Ge,J),Ee(null),m?.();return}const P=ys(N,c,x);if(!P){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(P.blockKey){await G.mutateAsync({blockKey:P.blockKey,data:Kt(P.resolveType,P.data,D)}),Ee(null),m?.();return}const de=Fn(D),Re=On(de,c,x);if(Re){oe.error(Re);return}const nt=Kt(P.resolveType,P.data,D);let Be=null;try{await G.mutateAsync({blockKey:de,data:nt}),Be=de,_[t]={...L,rule:on(de)},await G.mutateAsync({blockKey:l,data:{...p,sections:{...g,variants:_}}}),Be=null}catch(Ge){throw Be&&await Rn.mutateAsync({blockKey:Be}).catch(()=>{}),Ge}Ee(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:D})),m?.()}catch(P){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(P))})}finally{Zt(!1)}},Ti=async(t,r)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{selectedSectionIndex:l,rawSections:c,parsedSections:p,decofile:S,activePageKey:g,pageVariants:_,variantIndex:L}=Le.current;if(l===null||!g)return;const N=c[l],D=p[l];if(!N||!D?.isMultivariate)return;const P=xt(N,D);if(!P)return;const de=P.variants??[],Re=de[t];if(!Re?.rule||typeof Re.rule!="object"){oe.error(f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const nt=Re.rule,Be=r.trim();Zt(!0);const Ge=async J=>{const fe={...P,variants:J},Ce=[...c];Ce[l]=qt(N,D,fe);const Ue=Sn(S,g,Ce,L,_);return await G.mutateAsync({blockKey:g,data:Ue}),{...S,[g]:Ue}};try{if(!Be){if(!Gt(nt,S,x)){Ve(null);return}const ot=nt.__resolveType??"",vt=[...de];vt[t]={...Re,rule:xs(nt,S,x)};const Dt=await Ge(vt);await Ht(ot,Dt),Ve(null),m?.();return}const J=ys(nt,S,x);if(!J){oe.error(f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(J.blockKey){await G.mutateAsync({blockKey:J.blockKey,data:Kt(J.resolveType,J.data,Be)}),Ve(null),m?.();return}const fe=Fn(Be),Ce=On(fe,S,x);if(Ce){oe.error(Ce);return}const Ue=Kt(J.resolveType,J.data,Be);let gt=null;try{await G.mutateAsync({blockKey:fe,data:Ue}),gt=fe;const ot=[...de];ot[t]={...Re,rule:on(fe)},await Ge(ot),gt=null}catch(ot){throw gt&&await Rn.mutateAsync({blockKey:gt}).catch(()=>{}),ot}Ve(null),oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:Be})),m?.()}catch(J){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(J))})}finally{Zt(!1)}},kr=async(t,r,l)=>{T(l);try{await G.mutateAsync({blockKey:t,data:l})}catch(c){throw T(p=>p===l?r:p),c}},Vi={rename:async(t,r,l)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{activePageKey:c,decofile:p}=Le.current;if(!c)return;const S=Array.isArray(t.variants)?[...t.variants]:[],g=S[r],_=g?.rule&&typeof g.rule=="object"?g.rule:void 0,L=async D=>{const P={...t,variants:D};return await kr(c,t,P),{...p,[c]:P}},N=qc(_,l,p,x);if(N.kind!=="noop"){if(N.kind==="error"){oe.error(N.reason==="no-matcher-rule"?f("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"):N.reason==="unreadable-rule"?f("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"):N.message??f("sectionsEditor.sectionsEditor.failedToRenameVariant"));return}Zt(!0);try{if(N.kind==="inline"){const P=[...S];P[r]={...g,rule:N.inlinedRule};const de=await L(P);await Ht(N.blockKey,de),m?.();return}if(N.kind==="updateBlock"){await G.mutateAsync({blockKey:N.blockKey,data:N.blockData}),m?.();return}let D=null;try{await G.mutateAsync({blockKey:N.blockId,data:N.blockData}),D=N.blockId;const P=[...S];P[r]={...g,rule:N.reference},await L(P),D=null}catch(P){throw D&&await Rn.mutateAsync({blockKey:D}).catch(()=>{}),P}oe.success(f("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:l.trim()})),m?.()}catch(D){oe.error(f("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Pt(f,It(D))})}finally{Zt(!1)}}},selectGlobal:async(t,r,l)=>{Ct(),W.current&&(clearTimeout(W.current),W.current=null),Oe.current.clear();const{activePageKey:c,decofile:p}=Le.current;if(!c)return;const S=Array.isArray(t.variants)?[...t.variants]:[],g=S[r];if(!g)return;const _=Bt(g.rule,p,x);S[r]={...g,rule:on(l)};const L={...t,variants:S},N={...p,[c]:L};try{await kr(c,t,L),_&&_!==l&&await Ht(_,N),m?.()}catch(D){oe.error(f("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Pt(f,It(D))})}}},Er=()=>{zt()},Rr=t=>{ln(t),ts({inner:t})},Ar=t=>{En(t),ts({raw:t})},Cr=()=>{ln(null),Lt([])},Nr=()=>Yt(t=>t+1),Tr=()=>{cn.flush(),an(!1),ln(null),En(void 0),Lt([]),Yt(t=>t+1),A?.()},Di=()=>{ft(!1),kn(!1),B(null),an(!0)},Mi=()=>{qe&&Tr(),B(null),ft(!0)},Pi=()=>kn(!0),as=t=>{if(et&&t===0){ft(!1);return}if(Ot&&t<2){kn(!1),t===0&&B(null);return}if(qe){if(t===0){Tr();return}if(t===1){Lt([]),Yt(l=>l+1);return}Lt(Vs.slice(0,t-1)),Yt(l=>l+1);return}if(ie){O(q.slice(0,t)),Q(l=>l+1);return}if(t===0){Er();return}if(t===1){O([]),Q(l=>l+1);return}const r=!M&&Tt&&nn?1:0;if(r===1&&t===2){O([]),Q(l=>l+1);return}O(q.slice(0,t-1-r))},ls=Mn.length>1?i.jsx("button",{type:"button",onClick:()=>as(_a(Mn.length,{isMultivariateSectionTop:Ai})),title:f("sectionsEditor.sectionsEditor.back"),"aria-label":f("sectionsEditor.sectionsEditor.back"),className:ae("shrink-0 inline-flex size-6 items-center justify-center rounded-[var(--studio-control-radius,var(--radius-md))] transition-colors",ut?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:i.jsx(Ca,{className:"size-4"})}):null,Ii=ut||Vt||qe?wi&&i.jsxs("div",{className:ae("border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!ie&&ht&&rt&&i.jsxs("button",{type:"button",onClick:Er,title:f("sectionsEditor.sectionsEditor.editingInVariant",{variant:rt.label}),className:ae("shrink-0 inline-flex items-center gap-1 rounded-lg h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",ga),children:[i.jsx(ha,{rule:fs(rt.rule,y??{},x??void 0),matchers:tn}),i.jsx("span",{className:"max-w-[160px] truncate",children:rt.label})]}),i.jsx("div",{className:"flex-1"}),ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),xr&&i.jsx(Bn,{onClick:()=>xn()})]}),ut&&i.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:f("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):i.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Zs,variant:"header"})}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:()=>an(!0),children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"ghost",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>z&&E?z():dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]}),i.jsx(Bn,{onClick:yn})]}),Bi=i.jsxs(i.Fragment,{children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:Me,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsx($r,{className:"mt-3",children:i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})})]}),Vr=i.jsxs(i.Fragment,{children:[i.jsx(va,{listKey:`${E??""}:${b??""}`,variants:Nt.map((t,r)=>({index:r,label:t.label})),selectedIndex:Vn,onSelect:er,onRename:Ve,onDuplicate:pi,onDelete:mi,onRemoveAll:tr,onReorder:hi,onAdd:()=>xn()}),i.jsx($r,{children:i.jsx(us,{currentRt:Jt??"",currentLabel:wn(nn?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(nn?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:vi,onSelectGlobal:yi,schema:bi,formValue:Mo,onChange:xi,formKey:`${b??"none"}:${Vn}:${Jt??""}`,formWrapperClassName:"pt-1",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Dr=i.jsx("div",{className:ae(M?"px-2":"p-2 pt-3"),children:i.jsx(Xl,{listKey:`${E??""}-${we}`,rawSections:U,sections:Pe,meta:x,decofile:y,selectedIndex:b,onSelect:ri,onReorder:oi,onDelete:ii,onDuplicate:ai,onMakeReusable:He,onToggleHidden:li,onToggleLazy:he?ci:void 0,onAddVariant:xn,onDetach:ui,onAddSection:()=>Fe(!0),canAddSection:sr})}),Ki=i.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[E&&je&&i.jsx(Or,{pageKey:E,initialName:je.name,initialPath:je.path,onFieldChange:Zs}),mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ds,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),Fi=i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:i.jsx("div",{className:"mx-auto max-w-2xl",children:mn&&E?i.jsx(so,{rawSeo:Cn,innerSeo:Jn,defaultResolveType:$s,seoSchema:zs,activeResolveType:Nn,seoTypeOptions:Ls,formResetKey:Ds,siteDefaultSeo:Hs,onBreadcrumbChange:Lt,onPersistRaw:Ar,onInnerChange:Rr,onClearForm:Cr,onBumpFormKey:Nr,asyncRenderAvailable:he}):i.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:f("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),Oi=i.jsxs(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ht&&E&&i.jsx(Lr,{listKey:E,variants:Me,activeIndex:we,decofile:y??{},meta:x,matchers:tn,onSelect:is,onReorder:jr,onRename:Ee,onDuplicate:_r,onDelete:wr,onAdd:yn}),ht&&_e!==null&&i.jsxs("div",{className:ae("px-3 border-b",De?"pt-3 pb-5 space-y-3":"py-2"),children:[i.jsxs("button",{type:"button",onClick:()=>yt(t=>!t),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-[var(--studio-control-radius,var(--radius-sm))] py-0.5 hover:bg-muted/40","aria-expanded":De,children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:f("sectionsEditor.sectionsEditor.variantRule")}),De?i.jsx(Ea,{className:"size-3.5 shrink-0 text-muted-foreground"}):i.jsx(Ra,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),De&&i.jsx("div",{className:ae("space-y-3",Qt&&"pointer-events-none opacity-50"),children:i.jsx(us,{currentRt:_e,currentLabel:wn(rt?.rule,y??{},wt,x??void 0),currentGlobalKey:Bt(rt?.rule,y??{},x??void 0)??void 0,matchers:tn,globals:ns,onSelect:ir,onSelectGlobal:lr,schema:rr,formValue:Te,onChange:ar,formKey:`${we}:${_e??""}`,formWrapperClassName:"space-y-3",meta:x??void 0,decofile:y,onSaveReferencedBlock:un,sandbox:hn})})]}),Dr]},"editor-section-list");return i.jsx(xa,{children:i.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!M&&ls&&i.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:ls}),(M||Mn.length>1)&&i.jsx(ya,{crumbs:Mn,onSelect:as,onSelectRoot:()=>{cn.flush(),$?$():as(0)}}),i.jsx("div",{className:"shrink-0",children:M?i.jsxs("div",{className:ae("flex items-center gap-2 border-b px-3 py-2.5",ut&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[M&&ls,ut&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx("span",{className:"shrink-0 cursor-help",children:i.jsx(zn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),i.jsx(Rt,{side:"bottom",className:"max-w-[260px]",children:f("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[i.jsx("span",{className:"truncate text-sm font-semibold",children:Ri}),br&&i.jsx("span",{className:"truncate text-xs text-muted-foreground",children:br})]}),os&&ht&&rt&&i.jsx(zr,{variants:Me,activeIndex:we,onSelect:is,onManage:Mi,onRemoveAll:Ci}),ki&&i.jsx(zr,{variants:Nt,activeIndex:Vn,onSelect:er,onManage:Pi,onRemoveAll:tr}),os&&!ht&&i.jsx(Bn,{onClick:yn}),_i&&i.jsx(Bn,{onClick:()=>xn()}),i.jsx(Sa,{}),os&&i.jsxs(i.Fragment,{children:[i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.editSeo"),className:"size-7 shrink-0",onClick:Di,children:i.jsx(Gr,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.editSeo")})]}),!z&&i.jsxs(kt,{children:[i.jsx(Et,{asChild:!0,children:i.jsx(_t,{type:"button",variant:"outline",size:"icon","aria-label":f("sectionsEditor.sectionsEditor.viewJson"),className:"size-7 shrink-0",onClick:()=>dt(!0),children:i.jsx(Ur,{size:14})})}),i.jsx(Rt,{side:"bottom",children:f("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):Ii}),lt&&i.jsx(yc,{open:!0,fields:cc(lt.plan,lt.target.schema),choices:lt.choices,changedAgain:lt.changedAgain,author:zo,fresh:lt.fresh,onChoose:(t,r)=>si({...lt.choices,[t]:r}),onApply:ni},Jc(lt.formBase)),Ot?i.jsx(Hr,{onAdd:()=>xn(),children:Vr},"editor-section-variants"):Vt?i.jsxs(rn,{viewportRef:Ke,onBlur:Gs,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!M&&Tt&&Nt.length>0&&q.length===0&&Vr,i.jsx(Wr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:q,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:x,decofile:y,onSaveReferencedBlock:un,sandbox:hn,previewBaseUrl:ee,onRequestAddSection:Xs,onVariantMatcherOp:ie?Vi:void 0})]},"editor-section-form"):ie?i.jsx(rn,{viewportRef:Ke,onBlur:Gs,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx(Wr,{activeSchema:Tn,formValue:xe,formResetKey:Ye,onFormChange:Qs,onBreadcrumbChange:O,breadcrumbPath:q,emptyMessage:f("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:x,decofile:y,onSaveReferencedBlock:un,sandbox:hn,previewBaseUrl:ee,onRequestAddSection:Xs})},"editor-global-block"):qe?M?i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"p-3",children:Ki})},"editor-seo"):Fi:et?i.jsx(Hr,{onAdd:yn,children:Bi},"editor-variants"):M?i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[i.jsx(rn,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:i.jsx("div",{className:"py-2",children:Dr})}),i.jsx("div",{className:"shrink-0 border-t p-2",children:i.jsx(js,{canAddSection:sr,onAddSection:()=>Fe(!0)})})]},"editor-section-list"):Oi,i.jsx(ba,{open:ke!==null,onOpenChange:t=>{t||He(null)},defaultBlockId:ke!==null?Fn(Pe[ke]?.label??""):"",isPending:G.isPending,onSubmit:gi}),ve&&i.jsx(Al,{open:Xe,onOpenChange:t=>{Fe(t),t||(ne.current=null)},meta:x,decofile:y,previewBaseUrl:ee,onSelect:fi}),re&&E&&y&&i.jsx(La,{open:re,onOpenChange:dt,pageKey:E,decofile:y}),We!==null&&i.jsx(qr,{open:!0,initialName:Gt(Me[We]?.rule,y??{},x??void 0)?wn(Me[We]?.rule,y??{},wt,x??void 0):"",autoLabel:wt(fs(Me[We]?.rule,y??{},x??void 0)),isPending:Qt,onSubmit:async t=>{await Ni(We,t)},onOpenChange:t=>{!t&&!Qt&&Ee(null)}}),Ie!==null&&i.jsx(qr,{open:!0,initialName:Gt(Nt[Ie]?.rule,y??{},x??void 0)?wn(Nt[Ie]?.rule,y??{},wt,x??void 0):"",autoLabel:wt(fs(Nt[Ie]?.rule,y??{},x??void 0)),isPending:Qt,onSubmit:async t=>{await Ti(Ie,t)},onOpenChange:t=>{!t&&!Qt&&Ve(null)}})]})})}export{tm as SectionsEditor};
|