decocms 3.67.3 → 3.68.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-Bpe2_GvV.js → AlertCircle-B-Zk3zY-.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-YrfJ1CbZ.js → ArrowUpRight-DrUVVTac.js} +1 -1
- package/dist/client/assets/{CheckCircle-CYtqo8mv.js → CheckCircle-DgjXE82G.js} +1 -1
- package/dist/client/assets/{ChevronDown-Cs8E6-3E.js → ChevronDown-DAwDO8g3.js} +1 -1
- package/dist/client/assets/{ChevronLeft-B-gfvsw1.js → ChevronLeft-BoWRf6EK.js} +1 -1
- package/dist/client/assets/{ChevronRight-zYXs_-Se.js → ChevronRight-CxzKR4UY.js} +1 -1
- package/dist/client/assets/{ChevronUp-ZNXmTuIH.js → ChevronUp-Bu9JV4C-.js} +1 -1
- package/dist/client/assets/{DotsVertical-BX13G9P1.js → DotsVertical-CSx815oq.js} +1 -1
- package/dist/client/assets/{Eye-C5YGQqBB.js → Eye-Clz4yV9V.js} +1 -1
- package/dist/client/assets/{FilterLines-Ct0vyoCk.js → FilterLines-CCXAkAAh.js} +1 -1
- package/dist/client/assets/{Globe01-DqoZJREO.js → Globe01-rz2h7Ebm.js} +1 -1
- package/dist/client/assets/{Globe04-aor3r_Wp.js → Globe04-ZAH-y7Tv.js} +1 -1
- package/dist/client/assets/{HardDrive-C39-XuLX.js → HardDrive-CdL1msYN.js} +1 -1
- package/dist/client/assets/{Key01-C9VOqBor.js → Key01-Cd33I9n1.js} +1 -1
- package/dist/client/assets/{LayoutLeft-Bc24ivgh.js → LayoutLeft-Cx1gVHzQ.js} +1 -1
- package/dist/client/assets/{LinkExternal01-bw0rYexk.js → LinkExternal01-DQqosIE7.js} +1 -1
- package/dist/client/assets/{Monitor01-BBKDcKw2.js → Monitor01-DtUT2Llg.js} +1 -1
- package/dist/client/assets/{Palette-Dee1B_K4.js → Palette-CS46pFVA.js} +1 -1
- package/dist/client/assets/{Play-BYATnDqe.js → Play-CFAWCyYY.js} +1 -1
- package/dist/client/assets/{Plus-DP7MBDcr.js → Plus-Cl80ngk-.js} +1 -1
- package/dist/client/assets/{SearchMd-BNtCiaDl.js → SearchMd-DtbjJ0sS.js} +1 -1
- package/dist/client/assets/{Settings02-BhiFsU64.js → Settings02-BX75SJ47.js} +1 -1
- package/dist/client/assets/{Shield01-zcrbIoQW.js → Shield01-CY7h3_lL.js} +1 -1
- package/dist/client/assets/{Star01-Bi13YWhS.js → Star01-CqiKSE8w.js} +1 -1
- package/dist/client/assets/{Stars01-Cm43N5JK.js → Stars01-CfOrOYJQ.js} +1 -1
- package/dist/client/assets/{Stars02-ilw9rARd.js → Stars02-CCs6aX7m.js} +1 -1
- package/dist/client/assets/{Sun-BI8gfoic.js → Sun-0mP8ve2O.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-BkhFVCHL.js → SwitchHorizontal01-BVb8cFOW.js} +1 -1
- package/dist/client/assets/{Tool01-Ri8IcVVN.js → Tool01-DpllcZ_x.js} +1 -1
- package/dist/client/assets/{Trash01-DgUXWGZr.js → Trash01-B4p5GuSp.js} +1 -1
- package/dist/client/assets/{Upload01-CRl35fVk.js → Upload01--GcqA8-Q.js} +1 -1
- package/dist/client/assets/{User01-B13x_3hK.js → User01-DxuO8uwX.js} +1 -1
- package/dist/client/assets/{Users01-TRM2A3CY.js → Users01-a4XMjW3H.js} +1 -1
- package/dist/client/assets/{Users03-c3H4VKdl.js → Users03-D3FPHz00.js} +1 -1
- package/dist/client/assets/{X-DUzDqibI.js → X-ciDfeMTV.js} +1 -1
- package/dist/client/assets/{XCircle-CiWHFuXX.js → XCircle-DheND3p1.js} +1 -1
- package/dist/client/assets/{XClose-Bod7oMvA.js → XClose-BGdHen0O.js} +1 -1
- package/dist/client/assets/{Zap-DEQh6kKf.js → Zap-Dc-gCUi7.js} +1 -1
- package/dist/client/assets/{ZapSquare-BA2pOs85.js → ZapSquare-BILpiibq.js} +1 -1
- package/dist/client/assets/{ZoomOut-D6k5Mdn4.js → ZoomOut-B_lAoymB.js} +1 -1
- package/dist/client/assets/{access-gate-DHQsgThb.js → access-gate-DpAJKNDg.js} +1 -1
- package/dist/client/assets/{add-section-modal-D5rQ4e_n.js → add-section-modal-08fudMVv.js} +1 -1
- package/dist/client/assets/{agent-icon-BvSYE4X0.js → agent-icon-CS5ajDLh.js} +1 -1
- package/dist/client/assets/{agents-list-BADo6gze.js → agents-list-DxGlqMqe.js} +1 -1
- package/dist/client/assets/{ai-providers-D-btg_ej.js → ai-providers-B7vfwAb0.js} +1 -1
- package/dist/client/assets/{alert-Ck8w_HMj.js → alert-C5GST-R3.js} +1 -1
- package/dist/client/assets/{alert-dialog-Iz7Pne8q.js → alert-dialog-BzcSSmOH.js} +1 -1
- package/dist/client/assets/app-editor-hpV9V9bT.js +1 -0
- package/dist/client/assets/{auth-JrxMRfm7.js → auth-D8scdv8L.js} +1 -1
- package/dist/client/assets/{auth-catchall-2ybrzco_.js → auth-catchall-DH4AcuId.js} +1 -1
- package/dist/client/assets/{auth-split-layout-C4SnTzaq.js → auth-split-layout-5KVfL-AQ.js} +1 -1
- package/dist/client/assets/{automation-list-row-Cjs43Sd-.js → automation-list-row-BBCpkdMa.js} +1 -1
- package/dist/client/assets/{automation-runs-CggowR0J.js → automation-runs-C_CK9GUW.js} +1 -1
- package/dist/client/assets/{automations-USamT7J9.js → automations-B_7k54-x.js} +1 -1
- package/dist/client/assets/{avatar-yh81kVts.js → avatar-CCN_co-X.js} +1 -1
- package/dist/client/assets/{badge-F_XnDxyE.js → badge-BPsAZTXm.js} +1 -1
- package/dist/client/assets/{block-document-y2Lktyst.js → block-document-DLpzkGGl.js} +1 -1
- package/dist/client/assets/{brand-context-DqzmhXuN.js → brand-context-bYYUkcDs.js} +1 -1
- package/dist/client/assets/{buckets-De0LJJ-I.js → buckets-C4Z9fF_s.js} +1 -1
- package/dist/client/assets/{calendar-DV7Tk4AZ.js → calendar-BCaGHasm.js} +1 -1
- package/dist/client/assets/{capability-load-error-D8DXeudL.js → capability-load-error-B0DXeXNJ.js} +1 -1
- package/dist/client/assets/{card-bh08sj3I.js → card-BTSltukm.js} +1 -1
- package/dist/client/assets/category-editor-DDTndAHq.js +1 -0
- package/dist/client/assets/{chat-context-CsxEe8Dk.js → chat-context-BsFLDszr.js} +1 -1
- package/dist/client/assets/{checkbox-xjeH3Wpr.js → checkbox-M3DdO4ws.js} +1 -1
- package/dist/client/assets/{cli-auth-success-DPUOH3tk.js → cli-auth-success-6Lg0rHoz.js} +1 -1
- package/dist/client/assets/{collection-detail-B-VkwAVH.js → collection-detail-BJzSsRXi.js} +1 -1
- package/dist/client/assets/{collection-display-button-WtV7BkCy.js → collection-display-button-C4uiztpf.js} +1 -1
- package/dist/client/assets/{collection-search-t7pP-iq8.js → collection-search-lIRYT3yV.js} +1 -1
- package/dist/client/assets/{collection-tabs-DhaKOcMD.js → collection-tabs-DjP3Ny2m.js} +1 -1
- package/dist/client/assets/{command-tbfb-2AV.js → command-CrEXCPCP.js} +1 -1
- package/dist/client/assets/{connect-desktop-dialog-OG8wSu5b.js → connect-desktop-dialog-CRKR2Xhc.js} +1 -1
- package/dist/client/assets/{connection-card-tc4mvPkM.js → connection-card-Ci8mCMyz.js} +1 -1
- package/dist/client/assets/{connection-detail-C8sRVuZE.js → connection-detail-Cg5wteNS.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-C7CackfK.js → connection-form-helpers-Dl_gZPK3.js} +1 -1
- package/dist/client/assets/{connections-CL79BWSD.js → connections-DSdlpl8m.js} +1 -1
- package/dist/client/assets/{context-menu-CGXH567I.js → context-menu-9HQTa5U2.js} +1 -1
- package/dist/client/assets/{decopilot-C_VwkpOk.js → decopilot-Cd6VUSpu.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-CK5VnB1V.js → decopilot-sse-pool-BP59aBkW.js} +1 -1
- package/dist/client/assets/{dialog-B5Fc7PcC.js → dialog-DXahQA5F.js} +1 -1
- package/dist/client/assets/{domain-settings-B9C8VQl7.js → domain-settings-B2G69X9h.js} +1 -1
- package/dist/client/assets/{drawer-f0G1u50l.js → drawer-BBC9hSU8.js} +1 -1
- package/dist/client/assets/{dropdown-menu-Bo5hgXOF.js → dropdown-menu-6REDhV5o.js} +1 -1
- package/dist/client/assets/{empty-state-Dd2C1L1E.js → empty-state-DXDAVywR.js} +1 -1
- package/dist/client/assets/{extract-connection-data-_MOrxDBF.js → extract-connection-data-CyP5_ll7.js} +1 -1
- package/dist/client/assets/{file-explorer-DzxDZgb_.js → file-explorer-DvIndLZ2.js} +1 -1
- package/dist/client/assets/{file-type-icon-2rgm4864.js → file-type-icon-CD_RZ8rl.js} +1 -1
- package/dist/client/assets/{files-BamfXXFn.js → files-C7AHzVIO.js} +1 -1
- package/dist/client/assets/{form-DEWRKuCN.js → form-C9CSHpUw.js} +1 -1
- package/dist/client/assets/{general-DUftEYdq.js → general-Do4Aw_UB.js} +1 -1
- package/dist/client/assets/{github-repo-picker-DaaFmqbw.js → github-repo-picker-Duq8-HaY.js} +1 -1
- package/dist/client/assets/{hooks-BEP8IXge.js → hooks-C1I2Fhg2.js} +1 -1
- package/dist/client/assets/{image-field-D0-sBCXR.js → image-field-CRd85u-i.js} +1 -1
- package/dist/client/assets/{import-from-deco-dialog-DPg95H7-.js → import-from-deco-dialog-B7gbIQKu.js} +1 -1
- package/dist/client/assets/{index-DK5BMExb.js → index-B62gT9En.js} +1 -1
- package/dist/client/assets/{index-qCsR4teM.js → index-BrlqF8mC.js} +1 -1
- package/dist/client/assets/{index-D7sCHzTD.js → index-CDIbVALl.js} +1 -1
- package/dist/client/assets/{index-Cp09uk5T.js → index-CN18RaKp.js} +1 -1
- package/dist/client/assets/{index-BWm_HFUi.js → index-CVsiyRJv.js} +1 -1
- package/dist/client/assets/{index-DT_lqibQ.js → index-CZ67kZ1v.js} +1 -1
- package/dist/client/assets/{index-u1p_bf-7.js → index-CflKuA1L.js} +1 -1
- package/dist/client/assets/{index-DtdRCqfT.js → index-D6izOmjj.js} +3 -3
- package/dist/client/assets/{index-DdencN2D.js → index-DQcT764V.js} +1 -1
- package/dist/client/assets/{index-CrdcZU1p.js → index-Dyus5M1c.js} +1 -1
- package/dist/client/assets/index-UgUz8dNz.js +502 -0
- package/dist/client/assets/{index-CkYx9UrU.js → index-VDwoBUQS.js} +1 -1
- package/dist/client/assets/{index-DxFKESA7.js → index-a_lJlgHU.js} +1 -1
- package/dist/client/assets/{index-redirect-DlGjs7wZ.js → index-redirect-IkyQEw8C.js} +1 -1
- package/dist/client/assets/{index-C4kX7-WK.js → index-uQZXfeqC.js} +1 -1
- package/dist/client/assets/{input-C6eDTm2J.js → input-DP3XvpLN.js} +1 -1
- package/dist/client/assets/{integration-icon-DZ_y4SYI.js → integration-icon-DZ46sqDL.js} +1 -1
- package/dist/client/assets/{label-CApOnzUS.js → label-CVIIqU26.js} +1 -1
- package/dist/client/assets/{login-B1SVfmeu.js → login-D9Jd5dPi.js} +1 -1
- package/dist/client/assets/{mcp-oauth-topkfZ98.js → mcp-oauth-MmhxfzLz.js} +1 -1
- package/dist/client/assets/{members-CjQxJ_RX.js → members-DY9kX_sz.js} +1 -1
- package/dist/client/assets/{monaco-editor-C74LbgZn.js → monaco-editor-BqXgJc7f.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-QiX1Poqq.js → monitoring-stats-row-BsB6GRCy.js} +1 -1
- package/dist/client/assets/{oauth-callback-CMtN5crm.js → oauth-callback-PLImtAXE.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-B5jMOJVh.js → oauth-callback-ai-provider-BH-Rswm0.js} +1 -1
- package/dist/client/assets/{onboarding-CZ-kOd50.js → onboarding-DqZTmtt-.js} +1 -1
- package/dist/client/assets/{org-install-CYVEJ06f.js → org-install-Bt9032_8.js} +1 -1
- package/dist/client/assets/{org-layout-CuGLO-yG.js → org-layout-BFcVcec6.js} +1 -1
- package/dist/client/assets/{page-seo-form-hHpEj2sm.js → page-seo-form-BYKfoIdi.js} +1 -1
- package/dist/client/assets/page-seo-sheet-Bpi2JjCw.js +1 -0
- package/dist/client/assets/{popover-BZPKY_pJ.js → popover-B5LJwz0j.js} +1 -1
- package/dist/client/assets/{post-editor-bFo5aSK6.js → post-editor-DHf_pKD_.js} +1 -1
- package/dist/client/assets/{preview-dialog-B2V7Iomt.js → preview-dialog-NbAEidmd.js} +1 -1
- package/dist/client/assets/{primitives-DN8h3bGA.js → primitives-C9XYnbHN.js} +1 -1
- package/dist/client/assets/{profile-C3YkJZkf.js → profile-BIh6zBqL.js} +1 -1
- package/dist/client/assets/project-app-view-Doem9rkZ.js +1 -0
- package/dist/client/assets/record-editor-C4dB5nQE.js +1 -0
- package/dist/client/assets/registry-Cbr661Wc.js +2 -0
- package/dist/client/assets/{registry-layout-nx59aaeW.js → registry-layout-CpLwJOk1.js} +1 -1
- package/dist/client/assets/{require-capability-B4oR0b-_.js → require-capability-BCughBI7.js} +1 -1
- package/dist/client/assets/{required-auth-layout-BIvWfoYl.js → required-auth-layout-Czm4wEhq.js} +1 -1
- package/dist/client/assets/{reset-password-DuG163Lb.js → reset-password-CZGPwq_U.js} +1 -1
- package/dist/client/assets/{roles-XTwVX6TJ.js → roles-1pSXErEv.js} +1 -1
- package/dist/client/assets/save-referenced-block-DcQjO7ah.js +1 -0
- package/dist/client/assets/{save-status-DWSE0Ahw.js → save-status-BbqkL83O.js} +1 -1
- package/dist/client/assets/schema-form-B4m0eDMT.js +1 -0
- package/dist/client/assets/{scroll-area-Bdcg37bX.js → scroll-area-D-wTiagO.js} +1 -1
- package/dist/client/assets/{search-input-DWwtSn3X.js → search-input-BpXZI4wE.js} +1 -1
- package/dist/client/assets/{secrets-DIUX8x6L.js → secrets-e1cmnWWE.js} +1 -1
- package/dist/client/assets/sections-editor-BPDMVhPi.js +3 -0
- package/dist/client/assets/{select-DViAZ6BX.js → select-CjjjXRUS.js} +1 -1
- package/dist/client/assets/{select-model-Bd9U_6pO.js → select-model-DuC4X2jB.js} +1 -1
- package/dist/client/assets/{seo-editor-RooODx8v.js → seo-editor-DIker3a9.js} +1 -1
- package/dist/client/assets/{settings-layout-CiyDJqF4.js → settings-layout-becrO5TI.js} +1 -1
- package/dist/client/assets/{settings-section-BjMM3sOA.js → settings-section-Cj3AwHej.js} +1 -1
- package/dist/client/assets/{sheet-CLn7Ee-B.js → sheet-CGQ0l6o4.js} +1 -1
- package/dist/client/assets/{shell-controls-DIyWXZMt.js → shell-controls-rLEkFMFT.js} +1 -1
- package/dist/client/assets/{shell-layout-Cpd3fKJB.js → shell-layout-BuKC3YO-.js} +1 -1
- package/dist/client/assets/{shell-route-loading-Qu4W7RwV.js → shell-route-loading-CvANTPJP.js} +1 -1
- package/dist/client/assets/{sidebar-BvAh8pRK.js → sidebar-Bf91anCU.js} +1 -1
- package/dist/client/assets/{skeleton-CQ4hZKKg.js → skeleton-C_vWUNwW.js} +1 -1
- package/dist/client/assets/{sortable.esm-CRDKOVWU.js → sortable.esm-BDQeT5mM.js} +1 -1
- package/dist/client/assets/{sso-Be-I4LqT.js → sso-s9GwOpzF.js} +1 -1
- package/dist/client/assets/{store-CgjTP1S6.js → store-Bpiz0D_I.js} +1 -1
- package/dist/client/assets/store-registry-B0DZBOpl.js +2 -0
- package/dist/client/assets/{studio-tools-C3pW43RI.js → studio-tools-BBnH3MVd.js} +1 -1
- package/dist/client/assets/{switch-BwuEbygk.js → switch-D5j5jKzb.js} +1 -1
- package/dist/client/assets/{table-KwGxLknv.js → table-HxKELBdZ.js} +1 -1
- package/dist/client/assets/{tabs-CWXbqK3H.js → tabs-DY3LqT6S.js} +1 -1
- package/dist/client/assets/{task-status-CdiSaFNW.js → task-status-D5hR8PPt.js} +1 -1
- package/dist/client/assets/{textarea-CgeTFjY8.js → textarea-DNK54KKl.js} +1 -1
- package/dist/client/assets/{toggle-group-DnKFPpga.js → toggle-group-CYBCkLka.js} +1 -1
- package/dist/client/assets/{toolbar-BUvdNtWO.js → toolbar-L8diPmJo.js} +1 -1
- package/dist/client/assets/{tooltip-D9vE3hJi.js → tooltip-Bk2FCtKr.js} +1 -1
- package/dist/client/assets/{types-HcUrhwzw.js → types-CR3zyk0T.js} +1 -1
- package/dist/client/assets/{use-ai-providers-BwFwpBOt.js → use-ai-providers-BuPYcyWU.js} +1 -1
- package/dist/client/assets/{use-automations-BSPuoSfS.js → use-automations-3CJWtIS7.js} +1 -1
- package/dist/client/assets/{use-capability-BPH95vck.js → use-capability-C1x5gZYr.js} +1 -1
- package/dist/client/assets/{use-clock-tick-BVJBWlDM.js → use-clock-tick-CpGRUyLX.js} +1 -1
- package/dist/client/assets/{use-collections-CtQI9edu.js → use-collections-CCMEiGqY.js} +1 -1
- package/dist/client/assets/{use-connection-B-GnOxIe.js → use-connection-rF7aVJWi.js} +1 -1
- package/dist/client/assets/{use-copy-DkTFPjAl.js → use-copy-B9rnfiig.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BpdjItaW.js → use-create-virtual-mcp-BnWFpzrZ.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-DmyGwJEl.js → use-debounced-autosave-BoaPkBFT.js} +1 -1
- package/dist/client/assets/{use-deco-credits-CM5FdDx1.js → use-deco-credits-DkHNnq8a.js} +1 -1
- package/dist/client/assets/{use-delete-connection-B7j002Rl.js → use-delete-connection-DfIaQmJb.js} +1 -1
- package/dist/client/assets/{use-file-configs-BlRU7DjQ.js → use-file-configs-e6Y2envv.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-tVsKkDwZ.js → use-infinite-scroll-MECqtkyO.js} +1 -1
- package/dist/client/assets/{use-join-requests-qOpXvple.js → use-join-requests-BWwov4uy.js} +1 -1
- package/dist/client/assets/{use-mcp-client-00dhsiuh.js → use-mcp-client-vlTb1_vQ.js} +9 -9
- package/dist/client/assets/{use-mcp-prompts-CPpnRCz9.js → use-mcp-prompts-CGFuFPsL.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CelPls9H.js → use-mcp-tools-Dl-9pwtN.js} +1 -1
- package/dist/client/assets/{use-members-D4qUur-D.js → use-members-DZbTKLCa.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-CjuQTsVF.js → use-navigate-to-agent-CKBlqEnY.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-B6_dXOCB.js → use-org-auth-client-D79Jyhhp.js} +1 -1
- package/dist/client/assets/{use-org-sso-DzARfVqe.js → use-org-sso-CGb3XUqQ.js} +1 -1
- package/dist/client/assets/{use-organization-roles-C1ZE7DRi.js → use-organization-roles-CyuVLsgC.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BwlURqPC.js → use-organization-settings-BBq2AfS3.js} +1 -1
- package/dist/client/assets/{use-registry-connections-CnhucvHw.js → use-registry-connections-Qh4o2c-N.js} +1 -1
- package/dist/client/assets/{use-secrets-CZrigvCX.js → use-secrets-C45eD7gN.js} +1 -1
- package/dist/client/assets/{use-status-sounds-cSQbPNIy.js → use-status-sounds-CqqJRu1j.js} +1 -1
- package/dist/client/assets/{use-view-mode-BqCV5fdk.js → use-view-mode-CY-JucZM.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-BDx6BF9u.js → use-virtual-mcp-D63srVIz.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-Dtdh4OJ7.js +1 -0
- package/dist/client/assets/{useRouterState-DeeIf3re.js → useRouterState-Cy8ALVZD.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DcCILGRB.js +1 -0
- package/dist/client/assets/{view-mode-toggle-BA0E_UOT.js → view-mode-toggle-DNC_S7KK.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/app-editor-DtqVQrAv.js +0 -1
- package/dist/client/assets/category-editor-Cmo_7k3K.js +0 -1
- package/dist/client/assets/index-DgiSaeSc.js +0 -463
- package/dist/client/assets/page-seo-sheet-C2xGdGSj.js +0 -1
- package/dist/client/assets/project-app-view-BpK-h-Rb.js +0 -1
- package/dist/client/assets/record-editor-DqBdXh9_.js +0 -1
- package/dist/client/assets/registry-BZgs9SVc.js +0 -2
- package/dist/client/assets/save-referenced-block-rvEy7Ire.js +0 -1
- package/dist/client/assets/schema-form-V0y_iwdn.js +0 -1
- package/dist/client/assets/sections-editor-tuEhCOpO.js +0 -2
- package/dist/client/assets/store-registry-ToY5BNiI.js +0 -2
- package/dist/client/assets/useInfiniteQuery-3nAveyVa.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DYDXgR3L.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as P,r as M,s as xc,w as ah,x as ch,j as p,B as lr,v as Ol,bI as bc,bJ as uh,aO as dh,af as rn,bK as fh,c as Z,t as hh,P as $t,M as Ot,U as kr,_ as ph,ai as mh,V as hn,bL as kc,T as Sc,p as zt,F as gh,a as yh,K as Kt,n as zi,m as Co,f as Ln,a1 as xh,ac as vc,bM as To,ah as bh,bN as Ut}from"./index-DtdRCqfT.js";import{f as kh,M as Sh,d as vh,ae as wh,V as Ch,U as Th,T as Nh,aa as wc,af as Mh,ag as Eh,A as Cc,ah as it,ai as Ah,aj as Oh,ak as Ih,j as Rh}from"./agent-icon-BvSYE4X0.js";import{t as Fs}from"./Stars01-Cm43N5JK.js";import{a as Tc,t as jh,d as Nc,b as Er}from"./XCircle-CiWHFuXX.js";import{i as No}from"./ChevronUp-ZNXmTuIH.js";import{i as Il}from"./ChevronRight-zYXs_-Se.js";import{a as Mc,s as Dh}from"./Eye-C5YGQqBB.js";import{a as Pt,u as Ec,t as Ac,c as Rl}from"./use-clock-tick-BVJBWlDM.js";import{u as Oc}from"./use-copy-DkTFPjAl.js";import{T as sn,a as on,b as ln}from"./tooltip-D9vE3hJi.js";import{M as Mo,I as Ic,F as Ph}from"./file-type-icon-2rgm4864.js";import{c as Lh}from"./content-blocks-o63cs2vh.js";import{g as Rc,M as _h}from"./types-HcUrhwzw.js";import{S as $h,f as _n,h as zh,c as Eo,a as Bh,u as Fh}from"./chat-context-CsxEe8Dk.js";import{c as Hh,r as Vh,R as Wh}from"./hooks-BEP8IXge.js";import{u as Uh}from"./studio-tools-C3pW43RI.js";import{f as qh,k as Kh,l as Jh}from"./tab-id-BptcWVWa.js";import{d as Gh,u as jc,j as Xh}from"./use-mcp-client-00dhsiuh.js";import{i as Dc}from"./AlertCircle-Bpe2_GvV.js";import{s as Jr,t as Pc}from"./Star01-Bi13YWhS.js";import{s as Yh}from"./XClose-Bod7oMvA.js";import{n as Bi}from"./ZapSquare-BA2pOs85.js";import{n as Lc,i as Qh}from"./Globe01-DqoZJREO.js";import{b as Zh,i as ep,a as Ar}from"./Tool01-Ri8IcVVN.js";import{b as jl,a as tp}from"./ZoomOut-D6k5Mdn4.js";import{i as Gn}from"./Monitor01-BBKDcKw2.js";import{i as np}from"./SearchMd-BNtCiaDl.js";import{i as rp}from"./Upload01-CRl35fVk.js";import{b as sp,c as ip}from"./shell-layout-Cpd3fKJB.js";import{n as _c}from"./LinkExternal01-bw0rYexk.js";import{b as op,S as lp,c as ap,d as cp}from"./sheet-CLn7Ee-B.js";import{I as Sr}from"./integration-icon-DZ_y4SYI.js";import{a as up}from"./use-virtual-mcp-BDx6BF9u.js";import{i as dp}from"./ArrowUpRight-YrfJ1CbZ.js";import{a as Ao}from"./Users03-c3H4VKdl.js";import{a as ot}from"./Palette-Dee1B_K4.js";import{m as $c}from"./use-navigate-to-agent-CjuQTsVF.js";import{a as fp}from"./use-connection-B-GnOxIe.js";import{a as hp}from"./Stars02-ilw9rARd.js";import{g as pp}from"./use-mcp-prompts-CPpnRCz9.js";import{a as mp,D as gp,e as yp,c as xp,d as bp}from"./dialog-B5Fc7PcC.js";import{a as kp,F as Sp,b as vp,c as wp,d as Cp,f as Tp}from"./form-DEWRKuCN.js";import{I as Np}from"./input-C6eDTm2J.js";import{t as Mp}from"./ChevronDown-Cs8E6-3E.js";import{e as Ep}from"./select-DViAZ6BX.js";const Ap={openrouter:n=>{const e=n?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function zc(n){if(!n?.providerMetadata)return 0;for(const e of Object.values(Ap)){const t=e(n.providerMetadata);if(t!==null)return t}return 0}function Bc(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Fc(n,e){if(!e)return n;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:n.inputTokens+(e.inputTokens??0),outputTokens:n.outputTokens+(e.outputTokens??0),reasoningTokens:n.reasoningTokens+(e.reasoningTokens??0),totalTokens:n.totalTokens+(e.totalTokens??0),cost:n.cost+zc(e),cacheReadTokens:n.cacheReadTokens+t,cacheWriteTokens:n.cacheWriteTokens+r}}function gw(n){return n.reduce((e,t)=>Fc(e,t.metadata?.usage),Bc())}function Op(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Oo(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Io(n,e){if(!e)return n;const t=`${Op(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Ip(n,e){return Io(n,e).replace(/[_-]/g," ").toLowerCase()}function Rp(n){const e={};for(const t of n.arguments??[])e[t.name]=t.required?Ol().min(1,"Required"):Ol();return xc(e)}function jp(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Dp(n){const e=P.c(66),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=M.useId();let l;if(e[0]!==t){const $=t?Rp(t):xc({});l=ah($),e[0]=t,e[1]=l}else l=e[1];const c=l;let u;e[2]!==i||e[3]!==t?(u=t?jp(t,i):{},e[2]=i,e[3]=t,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d={resolver:c,defaultValues:u,mode:"onChange"},e[5]=c,e[6]=u,e[7]=d):d=e[7];const f=ch(d);let h;e[8]!==t?.arguments?(h=t?.arguments??[],e[8]=t?.arguments,e[9]=h):h=e[9];const m=h;let g;e[10]!==f||e[11]!==s||e[12]!==r?(g=async $=>{await s($),r(null),f.reset()},e[10]=f,e[11]=s,e[12]=r,e[13]=g):g=e[13];const y=g;let x;e[14]!==f||e[15]!==r?(x=$=>{$||(f.reset(),r(null))},e[14]=f,e[15]=r,e[16]=x):x=e[16];const b=x;if(!t)return null;let S;e[17]!==t._meta||e[18]!==t.name||e[19]!==t.title?(S=t.title||Ip(t.name,Oo(t._meta)),e[17]=t._meta,e[18]=t.name,e[19]=t.title,e[20]=S):S=e[20];let v;e[21]!==S?(v=p.jsx(mp,{children:p.jsx("span",{className:"capitalize",children:S})}),e[21]=S,e[22]=v):v=e[22];let k;e[23]!==t.description?(k=t.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[23]=t.description,e[24]=k):k=e[24];let C;e[25]!==k||e[26]!==v?(C=p.jsxs(gp,{children:[v,k]}),e[25]=k,e[26]=v,e[27]=C):C=e[27];let w;e[28]!==f||e[29]!==y?(w=$=>{$.stopPropagation(),f.handleSubmit(y)($)},e[28]=f,e[29]=y,e[30]=w):w=e[30];let T;if(e[31]!==m||e[32]!==f.control||e[33]!==f.formState.isSubmitting){let $;e[35]!==f.control||e[36]!==f.formState.isSubmitting?($=B=>p.jsx(Sp,{control:f.control,name:B.name,render:J=>{const{field:Y}=J;return p.jsxs(vp,{children:[p.jsxs(wp,{className:"text-xs",children:[B.name,B.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Cp,{children:p.jsx(Np,{...Y,value:Y.value??"",required:B.required,placeholder:B.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(Tp,{})]})}},B.name),e[35]=f.control,e[36]=f.formState.isSubmitting,e[37]=$):$=e[37],T=m.map($),e[31]=m,e[32]=f.control,e[33]=f.formState.isSubmitting,e[34]=T}else T=e[34];let N;e[38]!==b?(N=()=>b(!1),e[38]=b,e[39]=N):N=e[39];let E;e[40]!==f.formState.isSubmitting||e[41]!==N?(E=p.jsx(lr,{type:"button",variant:"ghost",onClick:N,disabled:f.formState.isSubmitting,children:"Cancel"}),e[40]=f.formState.isSubmitting,e[41]=N,e[42]=E):E=e[42];let j;e[43]!==f.formState.isSubmitting?(j=f.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx($h,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=f.formState.isSubmitting,e[44]=j):j=e[44];let L;e[45]!==f.formState.isSubmitting||e[46]!==o||e[47]!==j?(L=p.jsx(lr,{type:"submit",form:o,disabled:f.formState.isSubmitting,children:j}),e[45]=f.formState.isSubmitting,e[46]=o,e[47]=j,e[48]=L):L=e[48];let O;e[49]!==E||e[50]!==L?(O=p.jsxs(yp,{children:[E,L]}),e[49]=E,e[50]=L,e[51]=O):O=e[51];let D;e[52]!==o||e[53]!==w||e[54]!==T||e[55]!==O?(D=p.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:w,children:[T,O]}),e[52]=o,e[53]=w,e[54]=T,e[55]=O,e[56]=D):D=e[56];let R;e[57]!==f||e[58]!==D?(R=p.jsx(kp,{...f,children:D}),e[57]=f,e[58]=D,e[59]=R):R=e[59];let F;e[60]!==C||e[61]!==R?(F=p.jsxs(xp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,R]}),e[60]=C,e[61]=R,e[62]=F):F=e[62];let z;return e[63]!==b||e[64]!==F?(z=p.jsx(bp,{open:!0,onOpenChange:b,children:F}),e[63]=b,e[64]=F,e[65]=z):z=e[65],z}function Hc(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function tt(n,e){return n==="output-error"||n==="output-denied"?"error":n==="approval-requested"?"approval":n==="input-streaming"||n==="input-available"||n==="output-available"&&e===!0?"loading":"idle"}function $n(n){if(n==null||typeof n!="object")return;const e=n;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return n}function Te(n){this.content=n}Te.prototype={constructor:Te,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Te(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Te(t)},addToStart:function(n,e){return new Te([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Te(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Te(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Te.from(n),n.size?new Te(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Te.from(n),n.size?new Te(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Te.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Te.from=function(n){if(n instanceof Te)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Te(e)};function Vc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Vc(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Wc(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Wc(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class A{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new A(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new A(r,s)}cutByIndex(e,t){return e==t?A.empty:e==0&&t==this.content.length?this:new A(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new A(s,i)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Vc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Wc(this,e,t,r)}findIndex(e){if(e==0)return Or(0,e);if(e==this.size)return Or(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Or(t+1,i):Or(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return A.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new A(t||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const ci={index:0,offset:0};function Or(n,e){return ci.index=n,ci.offset=e,ci}function Gr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Gr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Gr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let ne=class Fi{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Gr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Fi.none;if(e instanceof Fi)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};ne.none=[];class Xr extends Error{}class _{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=qc(this.content,e+this.openStart,t);return r&&new _(r,this.openStart,this.openEnd)}removeBetween(e,t){return new _(Uc(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return _.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new _(A.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new _(e,r,s)}}_.empty=new _(A.empty,0,0);function Uc(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Uc(i.content,e-s-1,t-s-1)))}function qc(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=qc(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Pp(n,e,t){if(t.openStart>n.depth)throw new Xr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Xr("Inconsistent open depths");return Kc(n,e,t,0)}function Kc(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Kc(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return Zt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Lp(t,n);return Zt(i,Gc(n,o,l,e,r))}else return Zt(i,Yr(n,e,r))}function Jc(n,e){if(!e.type.compatibleContent(n.type))throw new Xr("Cannot join "+e.type.name+" onto "+n.type.name)}function Hi(n,e,t){let r=n.node(t);return Jc(r,e.node(t)),r}function Qt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Xn(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Qt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)Qt(s.child(l),r);e&&e.depth==t&&e.textOffset&&Qt(e.nodeBefore,r)}function Zt(n,e){return n.type.checkContent(e),n.copy(e)}function Gc(n,e,t,r,s){let i=n.depth>s&&Hi(n,e,s+1),o=r.depth>s&&Hi(t,r,s+1),l=[];return Xn(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Jc(i,o),Qt(Zt(i,Gc(n,e,t,r,s+1)),l)):(i&&Qt(Zt(i,Yr(n,e,s+1)),l),Xn(e,t,s,l),o&&Qt(Zt(o,Yr(t,r,s+1)),l)),Xn(r,null,s,l),new A(l)}function Yr(n,e,t){let r=[];if(Xn(null,n,t,r),n.depth>t){let s=Hi(n,e,t+1);Qt(Zt(s,Yr(n,e,t+1)),r)}return Xn(e,null,t,r),new A(r)}function Lp(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(A.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class ar{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ne.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Qr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new ar(t,r,i)}static resolveCached(e,t){let r=Dl.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else Dl.set(e,r=new _p);let s=r.elts[r.i]=ar.resolve(e,t);return r.i=(r.i+1)%$p,s}}class _p{constructor(){this.elts=[],this.i=0}}const $p=12,Dl=new WeakMap;class Qr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const zp=Object.create(null);class et{constructor(e,t,r,s=ne.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Gr(this.attrs,t||e.defaultAttrs||zp)&&ne.sameSet(this.marks,r||ne.none)}copy(e=null){return e==this.content?this:new et(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new et(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return _.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new _(c,s.depth-o,i.depth-o)}replace(e,t,r){return Pp(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return ar.resolveCached(this,e)}resolveNoCache(e){return ar.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Xc(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=A.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ne.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ne.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=A.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}et.prototype.text=void 0;class Zr extends et{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Xc(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Zr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Zr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Xc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class an{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Bp(e,t);if(r.next==null)return an.empty;let s=Yc(r);r.next&&r.err("Unexpected trailing text");let i=Kp(qp(s));return Jp(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return A.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
|
|
1
|
+
import{e as P,r as M,s as xc,w as ah,x as ch,j as p,B as lr,v as Ol,bI as bc,bJ as uh,aO as dh,af as rn,bK as fh,c as Z,t as hh,P as $t,M as Ot,U as kr,_ as ph,ai as mh,V as hn,bL as kc,T as Sc,p as zt,F as gh,a as yh,K as Kt,n as zi,m as Co,f as Ln,a1 as xh,ac as vc,bM as To,ah as bh,bN as Ut}from"./index-D6izOmjj.js";import{f as kh,M as Sh,d as vh,ae as wh,V as Ch,U as Th,T as Nh,aa as wc,af as Mh,ag as Eh,A as Cc,ah as it,ai as Ah,aj as Oh,ak as Ih,j as Rh}from"./agent-icon-CS5ajDLh.js";import{t as Fs}from"./Stars01-CfOrOYJQ.js";import{a as Tc,t as jh,d as Nc,b as Er}from"./XCircle-DheND3p1.js";import{i as No}from"./ChevronUp-Bu9JV4C-.js";import{i as Il}from"./ChevronRight-CxzKR4UY.js";import{a as Mc,s as Dh}from"./Eye-Clz4yV9V.js";import{a as Pt,u as Ec,t as Ac,c as Rl}from"./use-clock-tick-CpGRUyLX.js";import{u as Oc}from"./use-copy-B9rnfiig.js";import{T as sn,a as on,b as ln}from"./tooltip-Bk2FCtKr.js";import{M as Mo,I as Ic,F as Ph}from"./file-type-icon-CD_RZ8rl.js";import{c as Lh}from"./content-blocks-o63cs2vh.js";import{g as Rc,M as _h}from"./types-CR3zyk0T.js";import{S as $h,f as _n,h as zh,c as Eo,a as Bh,u as Fh}from"./chat-context-BsFLDszr.js";import{c as Hh,r as Vh,R as Wh}from"./hooks-C1I2Fhg2.js";import{u as Uh}from"./studio-tools-BBnH3MVd.js";import{f as qh,k as Kh,l as Jh}from"./tab-id-BptcWVWa.js";import{d as Gh,u as jc,j as Xh}from"./use-mcp-client-vlTb1_vQ.js";import{i as Dc}from"./AlertCircle-B-Zk3zY-.js";import{s as Jr,t as Pc}from"./Star01-CqiKSE8w.js";import{s as Yh}from"./XClose-BGdHen0O.js";import{n as Bi}from"./ZapSquare-BILpiibq.js";import{n as Lc,i as Qh}from"./Globe01-rz2h7Ebm.js";import{b as Zh,i as ep,a as Ar}from"./Tool01-DpllcZ_x.js";import{b as jl,a as tp}from"./ZoomOut-B_lAoymB.js";import{i as Gn}from"./Monitor01-DtUT2Llg.js";import{i as np}from"./SearchMd-DtbjJ0sS.js";import{i as rp}from"./Upload01--GcqA8-Q.js";import{b as sp,c as ip}from"./shell-layout-BuKC3YO-.js";import{n as _c}from"./LinkExternal01-DQqosIE7.js";import{b as op,S as lp,c as ap,d as cp}from"./sheet-CGQ0l6o4.js";import{I as Sr}from"./integration-icon-DZ46sqDL.js";import{a as up}from"./use-virtual-mcp-D63srVIz.js";import{i as dp}from"./ArrowUpRight-DrUVVTac.js";import{a as Ao}from"./Users03-D3FPHz00.js";import{a as ot}from"./Palette-CS46pFVA.js";import{m as $c}from"./use-navigate-to-agent-CKBlqEnY.js";import{a as fp}from"./use-connection-rF7aVJWi.js";import{a as hp}from"./Stars02-CCs6aX7m.js";import{g as pp}from"./use-mcp-prompts-CGFuFPsL.js";import{a as mp,D as gp,e as yp,c as xp,d as bp}from"./dialog-DXahQA5F.js";import{a as kp,F as Sp,b as vp,c as wp,d as Cp,f as Tp}from"./form-C9CSHpUw.js";import{I as Np}from"./input-DP3XvpLN.js";import{t as Mp}from"./ChevronDown-DAwDO8g3.js";import{e as Ep}from"./select-CjjjXRUS.js";const Ap={openrouter:n=>{const e=n?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function zc(n){if(!n?.providerMetadata)return 0;for(const e of Object.values(Ap)){const t=e(n.providerMetadata);if(t!==null)return t}return 0}function Bc(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Fc(n,e){if(!e)return n;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:n.inputTokens+(e.inputTokens??0),outputTokens:n.outputTokens+(e.outputTokens??0),reasoningTokens:n.reasoningTokens+(e.reasoningTokens??0),totalTokens:n.totalTokens+(e.totalTokens??0),cost:n.cost+zc(e),cacheReadTokens:n.cacheReadTokens+t,cacheWriteTokens:n.cacheWriteTokens+r}}function gw(n){return n.reduce((e,t)=>Fc(e,t.metadata?.usage),Bc())}function Op(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Oo(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Io(n,e){if(!e)return n;const t=`${Op(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Ip(n,e){return Io(n,e).replace(/[_-]/g," ").toLowerCase()}function Rp(n){const e={};for(const t of n.arguments??[])e[t.name]=t.required?Ol().min(1,"Required"):Ol();return xc(e)}function jp(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Dp(n){const e=P.c(66),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=M.useId();let l;if(e[0]!==t){const $=t?Rp(t):xc({});l=ah($),e[0]=t,e[1]=l}else l=e[1];const c=l;let u;e[2]!==i||e[3]!==t?(u=t?jp(t,i):{},e[2]=i,e[3]=t,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d={resolver:c,defaultValues:u,mode:"onChange"},e[5]=c,e[6]=u,e[7]=d):d=e[7];const f=ch(d);let h;e[8]!==t?.arguments?(h=t?.arguments??[],e[8]=t?.arguments,e[9]=h):h=e[9];const m=h;let g;e[10]!==f||e[11]!==s||e[12]!==r?(g=async $=>{await s($),r(null),f.reset()},e[10]=f,e[11]=s,e[12]=r,e[13]=g):g=e[13];const y=g;let x;e[14]!==f||e[15]!==r?(x=$=>{$||(f.reset(),r(null))},e[14]=f,e[15]=r,e[16]=x):x=e[16];const b=x;if(!t)return null;let S;e[17]!==t._meta||e[18]!==t.name||e[19]!==t.title?(S=t.title||Ip(t.name,Oo(t._meta)),e[17]=t._meta,e[18]=t.name,e[19]=t.title,e[20]=S):S=e[20];let v;e[21]!==S?(v=p.jsx(mp,{children:p.jsx("span",{className:"capitalize",children:S})}),e[21]=S,e[22]=v):v=e[22];let k;e[23]!==t.description?(k=t.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[23]=t.description,e[24]=k):k=e[24];let C;e[25]!==k||e[26]!==v?(C=p.jsxs(gp,{children:[v,k]}),e[25]=k,e[26]=v,e[27]=C):C=e[27];let w;e[28]!==f||e[29]!==y?(w=$=>{$.stopPropagation(),f.handleSubmit(y)($)},e[28]=f,e[29]=y,e[30]=w):w=e[30];let T;if(e[31]!==m||e[32]!==f.control||e[33]!==f.formState.isSubmitting){let $;e[35]!==f.control||e[36]!==f.formState.isSubmitting?($=B=>p.jsx(Sp,{control:f.control,name:B.name,render:J=>{const{field:Y}=J;return p.jsxs(vp,{children:[p.jsxs(wp,{className:"text-xs",children:[B.name,B.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Cp,{children:p.jsx(Np,{...Y,value:Y.value??"",required:B.required,placeholder:B.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(Tp,{})]})}},B.name),e[35]=f.control,e[36]=f.formState.isSubmitting,e[37]=$):$=e[37],T=m.map($),e[31]=m,e[32]=f.control,e[33]=f.formState.isSubmitting,e[34]=T}else T=e[34];let N;e[38]!==b?(N=()=>b(!1),e[38]=b,e[39]=N):N=e[39];let E;e[40]!==f.formState.isSubmitting||e[41]!==N?(E=p.jsx(lr,{type:"button",variant:"ghost",onClick:N,disabled:f.formState.isSubmitting,children:"Cancel"}),e[40]=f.formState.isSubmitting,e[41]=N,e[42]=E):E=e[42];let j;e[43]!==f.formState.isSubmitting?(j=f.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx($h,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=f.formState.isSubmitting,e[44]=j):j=e[44];let L;e[45]!==f.formState.isSubmitting||e[46]!==o||e[47]!==j?(L=p.jsx(lr,{type:"submit",form:o,disabled:f.formState.isSubmitting,children:j}),e[45]=f.formState.isSubmitting,e[46]=o,e[47]=j,e[48]=L):L=e[48];let O;e[49]!==E||e[50]!==L?(O=p.jsxs(yp,{children:[E,L]}),e[49]=E,e[50]=L,e[51]=O):O=e[51];let D;e[52]!==o||e[53]!==w||e[54]!==T||e[55]!==O?(D=p.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:w,children:[T,O]}),e[52]=o,e[53]=w,e[54]=T,e[55]=O,e[56]=D):D=e[56];let R;e[57]!==f||e[58]!==D?(R=p.jsx(kp,{...f,children:D}),e[57]=f,e[58]=D,e[59]=R):R=e[59];let F;e[60]!==C||e[61]!==R?(F=p.jsxs(xp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,R]}),e[60]=C,e[61]=R,e[62]=F):F=e[62];let z;return e[63]!==b||e[64]!==F?(z=p.jsx(bp,{open:!0,onOpenChange:b,children:F}),e[63]=b,e[64]=F,e[65]=z):z=e[65],z}function Hc(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function tt(n,e){return n==="output-error"||n==="output-denied"?"error":n==="approval-requested"?"approval":n==="input-streaming"||n==="input-available"||n==="output-available"&&e===!0?"loading":"idle"}function $n(n){if(n==null||typeof n!="object")return;const e=n;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return n}function Te(n){this.content=n}Te.prototype={constructor:Te,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Te(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Te(t)},addToStart:function(n,e){return new Te([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Te(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Te(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Te.from(n),n.size?new Te(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Te.from(n),n.size?new Te(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Te.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Te.from=function(n){if(n instanceof Te)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Te(e)};function Vc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Vc(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Wc(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Wc(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class A{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new A(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new A(r,s)}cutByIndex(e,t){return e==t?A.empty:e==0&&t==this.content.length?this:new A(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new A(s,i)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Vc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Wc(this,e,t,r)}findIndex(e){if(e==0)return Or(0,e);if(e==this.size)return Or(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Or(t+1,i):Or(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return A.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new A(t||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const ci={index:0,offset:0};function Or(n,e){return ci.index=n,ci.offset=e,ci}function Gr(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Gr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Gr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let ne=class Fi{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Gr(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Fi.none;if(e instanceof Fi)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};ne.none=[];class Xr extends Error{}class _{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=qc(this.content,e+this.openStart,t);return r&&new _(r,this.openStart,this.openEnd)}removeBetween(e,t){return new _(Uc(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return _.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new _(A.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new _(e,r,s)}}_.empty=new _(A.empty,0,0);function Uc(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Uc(i.content,e-s-1,t-s-1)))}function qc(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=qc(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Pp(n,e,t){if(t.openStart>n.depth)throw new Xr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Xr("Inconsistent open depths");return Kc(n,e,t,0)}function Kc(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Kc(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return Zt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Lp(t,n);return Zt(i,Gc(n,o,l,e,r))}else return Zt(i,Yr(n,e,r))}function Jc(n,e){if(!e.type.compatibleContent(n.type))throw new Xr("Cannot join "+e.type.name+" onto "+n.type.name)}function Hi(n,e,t){let r=n.node(t);return Jc(r,e.node(t)),r}function Qt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Xn(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Qt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)Qt(s.child(l),r);e&&e.depth==t&&e.textOffset&&Qt(e.nodeBefore,r)}function Zt(n,e){return n.type.checkContent(e),n.copy(e)}function Gc(n,e,t,r,s){let i=n.depth>s&&Hi(n,e,s+1),o=r.depth>s&&Hi(t,r,s+1),l=[];return Xn(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Jc(i,o),Qt(Zt(i,Gc(n,e,t,r,s+1)),l)):(i&&Qt(Zt(i,Yr(n,e,s+1)),l),Xn(e,t,s,l),o&&Qt(Zt(o,Yr(t,r,s+1)),l)),Xn(r,null,s,l),new A(l)}function Yr(n,e,t){let r=[];if(Xn(null,n,t,r),n.depth>t){let s=Hi(n,e,t+1);Qt(Zt(s,Yr(n,e,t+1)),r)}return Xn(e,null,t,r),new A(r)}function Lp(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(A.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class ar{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ne.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Qr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new ar(t,r,i)}static resolveCached(e,t){let r=Dl.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else Dl.set(e,r=new _p);let s=r.elts[r.i]=ar.resolve(e,t);return r.i=(r.i+1)%$p,s}}class _p{constructor(){this.elts=[],this.i=0}}const $p=12,Dl=new WeakMap;class Qr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const zp=Object.create(null);class et{constructor(e,t,r,s=ne.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||A.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Gr(this.attrs,t||e.defaultAttrs||zp)&&ne.sameSet(this.marks,r||ne.none)}copy(e=null){return e==this.content?this:new et(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new et(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return _.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new _(c,s.depth-o,i.depth-o)}replace(e,t,r){return Pp(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return ar.resolveCached(this,e)}resolveNoCache(e){return ar.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Xc(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=A.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ne.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ne.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=A.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}et.prototype.text=void 0;class Zr extends et{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Xc(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Zr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Zr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Xc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class an{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Bp(e,t);if(r.next==null)return an.empty;let s=Yc(r);r.next&&r.err("Unexpected trailing text");let i=Kp(qp(s));return Jp(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return A.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
|
|
2
2
|
`)}}an.empty=new an(!0);class Bp{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Yc(n){let e=[];do e.push(Fp(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Fp(n){let e=[];do e.push(Hp(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Hp(n){let e=Up(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Vp(n,e);else break;return e}function Pl(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Vp(n,e){let t=Pl(n),r=t;return n.eat(",")&&(n.next!="}"?r=Pl(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Wp(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let o=t[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function Up(n){if(n.eat("(")){let e=Yc(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Wp(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function qp(n){let e=[[]];return s(i(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=i(o.exprs[a],l);if(a==o.exprs.length-1)return c;s(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();s(i(o.expr,a),u),a=u}if(o.max==-1)s(i(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();r(a,u),s(i(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Qc(n,e){return e-n}function Ll(n,e){let t=[];return r(e),t.sort(Qc);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&t.indexOf(a)==-1&&r(a)}}}function Kp(n){let e=Object.create(null);return t(Ll(n,0));function t(r){let s=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<s.length;u++)s[u][0]==l&&(c=s[u][1]);Ll(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new an(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(Qc);i.next.push({type:s[o][0],next:e[l.join(",")]||t(l)})}return i}}function Jp(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];o.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Zc(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function eu(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let i=n[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function tu(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let i=n[s];i.validate&&i.validate(e[s])}}function nu(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Xp(n,r,e[r]);return t}let _l=class ru{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=nu(e,r.attrs),this.defaultAttrs=Zc(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==an.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:eu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new et(this,this.computeAttrs(e),A.from(t),ne.setFrom(r))}createChecked(e=null,t,r){return t=A.from(t),this.checkContent(t),new et(this,this.computeAttrs(e),t,ne.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=A.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(A.empty,!0);return i?new et(this,e,t.append(i),ne.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){tu(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:ne.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new ru(i,t,o));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Gp(n,e,t){let r=t.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class Xp{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Gp(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Hs{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=nu(e,s.attrs),this.excluded=null;let i=Zc(this.attrs);this.instance=i?new ne(this,i):null}create(e=null){return!e&&this.instance?this.instance:new ne(this,eu(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Hs(i,s++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){tu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class su{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=Te.from(e.nodes),t.marks=Te.from(e.marks||{}),this.nodes=_l.compile(this.spec.nodes,this),this.marks=Hs.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=an.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?$l(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:$l(this,o.split(" "))}this.nodeFromJSON=s=>et.fromJSON(this,s),this.markFromJSON=s=>ne.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof _l){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,s)}text(e,t){let r=this.nodes.text;return new Zr(r,r.defaultAttrs,e,ne.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function $l(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],o=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function Yp(n){return n.tag!=null}function Qp(n){return n.style!=null}class It{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(Yp(s))this.tags.push(s);else if(Qp(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new Bl(this,t,!1);return r.addAll(e,ne.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Bl(this,t,!0);return r.addAll(e,ne.none,t.from,t.to),_.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(tm(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Fl(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Fl(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new It(e,It.schemaRules(e)))}}const iu={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Zp={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ou={ol:!0,ul:!0},cr=1,Vi=2,Yn=4;function zl(n,e,t){return e!=null?(e?cr:0)|(e==="full"?Vi:0):n&&n.whitespace=="pre"?cr|Vi:t&~Yn}class Ir{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=ne.none,this.match=i||(o&Yn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(A.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&cr)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=A.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(A.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!iu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Bl{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=zl(null,t.preserveWhitespace,0)|(r?Yn:0);s?i=new Ir(s.type,s.attrs,ne.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new Ir(null,null,ne.none,!0,null,o):i=new Ir(e.schema.topNodeType,null,ne.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&Vi?"full":this.localPreserveWS||(s.options&cr)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;ou.hasOwnProperty(o)&&this.parser.normalizeLists&&em(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Zp.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(iu.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,s){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=ne.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Hl(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=zl(e,i,o.options);o.options&Yn&&o.content.length==0&&(l|=Yn);let a=ne.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Hl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Ir(e,t,a,s,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=cr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function em(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ou.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function tm(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Fl(n){let e={};for(let t in n)e[t]=n[t];return e}function Hl(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class pn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=ui(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=Vr(ui(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Vr(ui(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return Vr(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new pn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Vl(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Vl(e.marks)}}function Vl(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function ui(n){return n.document||window.document}const Wl=new WeakMap;function nm(n){let e=Wl.get(n);return e===void 0&&Wl.set(n,e=rm(n)),e}function rm(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function Vr(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=nm(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:m}=Vr(n,f,t,r);if(a.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const lu=65535,au=Math.pow(2,16);function sm(n,e){return n+e*au}function Ul(n){return n&lu}function im(n){return(n-(n&lu))/au}const cu=1,uu=2,Wr=4,du=8;class Wi{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&du)>0}get deletedBefore(){return(this.delInfo&(cu|Wr))>0}get deletedAfter(){return(this.delInfo&(uu|Wr))>0}get deletedAcross(){return(this.delInfo&Wr)>0}}class Fe{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Fe.empty)return Fe.empty}recover(e){let t=0,r=Ul(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+im(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+s+(f<0?0:u);if(r)return h;let m=e==(t<0?a:d)?null:sm(l/3,e-a),g=e==a?uu:e==d?cu:Wr;return(t<0?e!=a:e!=d)&&(g|=du),new Wi(h,g,m)}s+=u-c}return r?e+s:new Wi(e+s,0,null)}touches(e,t){let r=0,s=Ul(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new Fe(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Fe.empty:new Fe(e<0?[0,-e,0]:[0,0,e])}}Fe.empty=new Fe([]);class ur{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new ur(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new ur;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new Wi(e,s,null)}}const di=Object.create(null);class De{getMap(){return Fe.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=di[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in di)throw new RangeError("Duplicate use of step JSON ID "+e);return di[e]=t,t.prototype.jsonID=e,t}}class me{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new me(e,null)}static fail(e){return new me(null,e)}static fromReplace(e,t,r,s){try{return me.ok(e.replace(t,r,s))}catch(i){if(i instanceof Xr)return me.fail(i.message);throw i}}}function Ro(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(Ro(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return A.fromArray(r)}class Mt extends De{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new _(Ro(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return me.fromReplace(e,this.from,this.to,i)}invert(){return new Ze(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Mt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Mt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Mt(t.from,t.to,e.markFromJSON(t.mark))}}De.jsonID("addMark",Mt);class Ze extends De{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new _(Ro(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return me.fromReplace(e,this.from,this.to,r)}invert(){return new Mt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ze(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ze&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ze(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ze(t.from,t.to,e.markFromJSON(t.mark))}}De.jsonID("removeMark",Ze);class Et extends De{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return me.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return me.fromReplace(e,this.pos,this.pos+1,new _(A.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new Et(this.pos,t.marks[s]);return new Et(this.pos,this.mark)}}return new cn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Et(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Et(t.pos,e.markFromJSON(t.mark))}}De.jsonID("addNodeMark",Et);class cn extends De{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return me.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return me.fromReplace(e,this.pos,this.pos+1,new _(A.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Et(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new cn(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new cn(t.pos,e.markFromJSON(t.mark))}}De.jsonID("removeNodeMark",cn);class pe extends De{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&Ui(e,this.from,this.to)?me.fail("Structure replace would overwrite content"):me.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Fe([this.from,this.to-this.from,this.slice.size])}invert(e){return new pe(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&pe.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new pe(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof pe)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?_.empty:new _(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pe(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?_.empty:new _(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pe(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new pe(t.from,t.to,_.fromJSON(e,t.slice),!!t.structure)}}pe.MAP_BIAS=1;De.jsonID("replace",pe);class ve extends De{constructor(e,t,r,s,i,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Ui(e,this.from,this.gapFrom)||Ui(e,this.gapTo,this.to)))return me.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return me.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?me.fromReplace(e,this.from,this.to,r):me.fail("Content does not fit in gap")}getMap(){return new Fe([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ve(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new ve(t.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ve(t.from,t.to,t.gapFrom,t.gapTo,_.fromJSON(e,t.slice),t.insert,!!t.structure)}}De.jsonID("replaceAround",ve);function Ui(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function om(n,e,t,r){let s=[],i=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),m=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(o&&o.to==f&&o.mark.eq(d[g])?o.to=h:s.push(o=new Ze(f,h,d[g])));l&&l.to==f?l.to=h:i.push(l=new Mt(f,h,r))}}),s.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function lm(n,e,t,r){let s=[],i=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof Hs){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<s.length;h++){let m=s[h];m.step==i-1&&d.eq(s[h].style)&&(f=m)}f?(f.to=c,f.step=i):s.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),s.forEach(o=>n.step(new Ze(o.from,o.to,o.style)))}function jo(n,e,t,r=t.contentMatch,s=!0){let i=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new pe(l,u,_.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new Ze(l,u,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(c.text);)m||(m=new _(A.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new pe(l+f.index,l+f.index+f[0].length,m))}}l=u}if(!r.validEnd){let a=r.fillBefore(A.empty,!0);n.replace(l,l,new _(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function am(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function zn(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,i=0;;--r){let o=n.$from.node(r),l=n.$from.index(r)+s,a=n.$to.indexAfter(r)-i;if(r<n.depth&&o.canReplace(l,a,t))return r;if(r==0||o.type.spec.isolating||!am(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function cm(n,e,t){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),a=o,c=l,u=A.empty,d=0;for(let m=i,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=A.from(r.node(m).copy(u)),d++):a--;let f=A.empty,h=0;for(let m=i,g=!1;m>t;m--)g||s.after(m+1)<s.end(m)?(g=!0,f=A.from(s.node(m).copy(f)),h++):c++;n.step(new ve(a,c,o,l,new _(u.append(f),d,h),u.size-d,!0))}function Do(n,e,t=null,r=n){let s=um(n,e),i=s&&dm(r,e);return i?s.map(ql).concat({type:e,attrs:t}).concat(i.map(ql)):null}function ql(n){return{type:n,attrs:null}}function um(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return t.canReplaceWith(r,s,o)?i:null}function dm(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function fm(n,e,t){let r=A.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=A.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new ve(s,i,s,i,new _(r,0,0),t.length,!0))}function hm(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&pm(n.doc,n.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?c=!1:!h&&m&&(c=!0)}c===!1&&hu(n,o,l,i),jo(n,n.mapping.slice(i).map(l,1),r,void 0,c===null);let u=n.mapping.slice(i),d=u.map(l,1),f=u.map(l+o.nodeSize,1);return n.step(new ve(d,f,d+1,f-1,new _(A.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&fu(n,o,l,i),!1}})}function fu(n,e,t,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=n.mapping.slice(r).map(t+1+i+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function hu(n,e,t,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+i);n.replaceWith(o,o+1,e.type.schema.text(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as b,c as w,j as a,l as j}from"./index-
|
|
1
|
+
import{e as b,c as w,j as a,l as j}from"./index-D6izOmjj.js";import{i as N}from"./SearchMd-DtbjJ0sS.js";function S(f){const e=b.c(17),{value:l,onChange:c,placeholder:g,onKeyDown:d,className:u,isSearching:p,disabled:i}=f,m=g===void 0?"Search...":g,x=i&&"pointer-events-none opacity-50";let t;e[0]!==u||e[1]!==x?(t=w("flex items-center gap-4 rounded-lg bg-background dark:bg-input/30 px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",x,u),e[0]=u,e[1]=x,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{size:16,className:"animate-spin text-muted-foreground/75 shrink-0"}):a.jsx(N,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=h=>c(h.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==i||e[8]!==d||e[9]!==m||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:d,placeholder:m,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=i,e[8]=d,e[9]=m,e[10]=s,e[11]=l,e[12]=o):o=e[12];let r;return e[13]!==t||e[14]!==n||e[15]!==o?(r=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=r):r=e[16],r}export{S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as p,j as t,a1 as P,r as j,ae as w,B as S,n as y}from"./index-
|
|
1
|
+
import{e as p,j as t,a1 as P,r as j,ae as w,B as S,n as y}from"./index-D6izOmjj.js";import{i as k}from"./AlertCircle-B-Zk3zY-.js";import{s as z}from"./Plus-Cl80ngk-.js";import{s as F}from"./User01-DxuO8uwX.js";import{t as E}from"./Users01-a4XMjW3H.js";import{d as $,c as I,D as O,a as A,b as R,e as T}from"./dialog-DXahQA5F.js";import{I as N}from"./input-DP3XvpLN.js";import{L as g}from"./label-CVIIqU26.js";import{d as B,b as V,c as L,S as q,a as C}from"./select-CjjjXRUS.js";import{S as H}from"./skeleton-C_vWUNwW.js";import{T as K}from"./textarea-DNK54KKl.js";import{P as b}from"./index-B62gT9En.js";import{c as W}from"./settings-section-Cj3AwHej.js";import{u as Y,a as G}from"./use-secrets-C45eD7gN.js";import{R as J}from"./require-capability-BCughBI7.js";import"./X-ciDfeMTV.js";import"./tooltip-Bk2FCtKr.js";import"./ChevronUp-Bu9JV4C-.js";import"./ChevronDown-DAwDO8g3.js";import"./sidebar-Bf91anCU.js";import"./LayoutLeft-Cx1gVHzQ.js";import"./sheet-CGQ0l6o4.js";import"./card-BTSltukm.js";import"./ArrowUpRight-DrUVVTac.js";import"./studio-tools-BBnH3MVd.js";import"./use-capability-C1x5gZYr.js";import"./access-gate-DpAJKNDg.js";import"./capability-load-error-B0DXeXNJ.js";function M(s){const e=p.c(3),{error:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(k,{size:16}),e[0]=c):c=e[0];let n;return e[1]!==r.message?(n=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[c,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load secrets: ",r.message]})]}),e[1]=r.message,e[2]=n):n=e[2],n}function Q(s){const e=p.c(5),{scope:r}=s,c=r==="user"?F:E,n=r==="user"?"Private":"Organization";let i;e[0]!==c?(i=t.jsx(c,{size:12}),e[0]=c,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[i,n]}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function D(s){const e=p.c(20),{secret:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(w,{size:16,className:"text-muted-foreground"})}),e[0]=c):c=e[0];let n;e[1]!==r.name?(n=t.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=n):n=e[2];let i;e[3]!==r.scope?(i=t.jsx(Q,{scope:r.scope}),e[3]=r.scope,e[4]=i):i=e[4];let a;e[5]!==n||e[6]!==i?(a=t.jsxs("div",{className:"flex items-center gap-2",children:[n,i]}),e[5]=n,e[6]=i,e[7]=a):a=e[7];let d;e[8]!==r.description?(d=r.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==d?(u=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[c,t.jsxs("div",{className:"min-w-0",children:[a,d]})]}),e[10]=a,e[11]=d,e[12]=u):u=e[12];let l;e[13]!==r.createdAt?(l=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=l):l=e[14];let o;e[15]!==l?(o=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=o):o=e[16];let x;return e[17]!==u||e[18]!==o?(x=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[u,o]}),e[17]=u,e[18]=o,e[19]=x):x=e[19],x}function U(s){const e=p.c(5),{onCreate:r}=s;let c,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(w,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No secrets yet"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Store API keys, tokens, and other sensitive values. Values are encrypted at rest and never returned over the API."})]}),e[0]=c,e[1]=n):(c=e[0],n=e[1]);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(z,{size:14}),e[2]=i):i=e[2];let a;return e[3]!==r?(a=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[c,n,t.jsxs(S,{onClick:r,size:"sm",className:"mt-2",children:[i,"New secret"]})]}),e[3]=r,e[4]=a):a=e[4],a}function _({open:s,onOpenChange:e}){const[r,c]=j.useState("organization"),[n,i]=j.useState(""),[a,d]=j.useState(""),[u,l]=j.useState(""),o=G();function x(){c("organization"),i(""),d(""),l("")}function f(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!a))try{await o.mutateAsync({scope:r,name:n.trim(),value:a,description:u.trim()||void 0}),y.success(`Secret "${n.trim()}" created`),f()}catch(v){y.error(v instanceof Error?v.message:"Failed to create secret")}}return t.jsx($,{open:s,onOpenChange:m=>{m?e(m):f()},children:t.jsxs(I,{className:"sm:max-w-lg",children:[t.jsxs(O,{children:[t.jsx(A,{children:"New secret"}),t.jsx(R,{children:"Stored encrypted in the credential vault. Choose who can read it."})]}),t.jsxs("form",{onSubmit:h,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-scope",children:"Scope"}),t.jsxs(B,{value:r,onValueChange:m=>c(m),children:[t.jsx(V,{id:"secret-scope",children:t.jsx(L,{})}),t.jsxs(q,{children:[t.jsx(C,{value:"organization",children:"Organization — visible to all members"}),t.jsx(C,{value:"user",children:"Private — only visible to me"})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-name",children:"Name"}),t.jsx(N,{id:"secret-name",value:n,onChange:m=>i(m.target.value),placeholder:"STRIPE_API_KEY",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Case-insensitive within its scope."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-value",children:"Value"}),t.jsx(N,{id:"secret-value",type:"password",value:a,onChange:m=>d(m.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-description",children:"Description (optional)"}),t.jsx(K,{id:"secret-description",value:u,onChange:m=>l(m.target.value),rows:2,placeholder:"What is this secret used for?"})]}),t.jsxs(T,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:f,disabled:o.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:o.isPending||!n.trim()||!a,children:o.isPending?"Creating…":"Create secret"})]})]})]})})}function X(){const s=p.c(21),e=Y(),[r,c]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(U,{onCreate:()=>c(!0)}),s[0]=l):l=s[0];let o;return s[1]!==r?(o=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:c})]}),s[1]=r,s[2]=o):o=s[2],o}let n,i,a;if(s[3]!==e){const l=e.filter(se),o=e.filter(te),x=e.length===1?"":"s";let f;s[7]!==e.length||s[8]!==x?(f=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," secret",x," stored"]}),s[7]=e.length,s[8]=x,s[9]=f):f=s[9];let h;s[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>c(!0),s[10]=h):h=s[10];let m;s[11]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(S,{onClick:h,size:"sm",children:[t.jsx(z,{size:14}),"New secret"]}),s[11]=m):m=s[11],s[12]!==f?(n=t.jsxs("div",{className:"flex items-center justify-between",children:[f,m]}),s[12]=f,s[13]=n):n=s[13],i=l.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Organization"}),t.jsx("div",{children:l.map(ee)})]}):null,a=o.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Private to me"}),t.jsx("div",{children:o.map(Z)})]}):null,s[3]=e,s[4]=n,s[5]=i,s[6]=a}else n=s[4],i=s[5],a=s[6];let d;s[14]!==r?(d=t.jsx(_,{open:r,onOpenChange:c}),s[14]=r,s[15]=d):d=s[15];let u;return s[16]!==n||s[17]!==i||s[18]!==a||s[19]!==d?(u=t.jsxs(t.Fragment,{children:[n,i,a,d]}),s[16]=n,s[17]=i,s[18]=a,s[19]=d,s[20]=u):u=s[20],u}function Z(s){return t.jsx(D,{secret:s},s.id)}function ee(s){return t.jsx(D,{secret:s},s.id)}function te(s){return s.scope==="user"}function se(s){return s.scope==="organization"}function re(){const s=p.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(b.Title,{children:"Secrets"}),s[0]=e):e=s[0];let r;return s[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(b,{children:t.jsx(b.Content,{children:t.jsx(b.Body,{children:t.jsxs(W,{children:[e,t.jsx(P,{fallback:ne,children:t.jsx(j.Suspense,{fallback:t.jsx(H,{className:"h-32 w-full"}),children:t.jsx(X,{})})})]})})})}),s[1]=r):r=s[1],r}function ne(s){const{error:e}=s;return t.jsx(M,{error:e??new Error("Failed to load secrets")})}function $e(){const s=p.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(J,{capability:"secrets:manage",area:"secrets",children:t.jsx(re,{})}),s[0]=e):e=s[0],e}export{$e as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{e as $e,r as D,j as t,B as Fe,l as Zt,c as we,F as ha,n as Ne,K as ga}from"./index-D6izOmjj.js";import{r as va,i as es,c as xa,G as ba,a as Sa,l as nt,b as jt,d as ya,e as ja,f as _a,g as ka,h as Na,j as wa,k as Ca,m as Da,n as Ra,o as bt,p as St,q as Ta,s as Kt,t as tt,v as Ln,w as zn,P as Aa,x as It,y as Pa,z as Ma,A as Va,B as Ea,C as $a,D as Oa,E as La,F as pt,H as za,I as Fa,J as Ka,K as Ia,L as Ba,M as Ha,N as Ua,O as Wa,Q as Bt,R as qa,S as Fn,T as Ya,U as Ga,V as Za,W as Ht,X as Ja,Y as Qa,Z as Kn}from"./index-UgUz8dNz.js";import{t as ts}from"./ChevronDown-DAwDO8g3.js";import{i as Xa}from"./ChevronRight-CxzKR4UY.js";import{n as er}from"./ChevronUp-Bu9JV4C-.js";import{K as _t,D as Jt,R as ns,l as Nt,L as tr,M as nr}from"./agent-icon-CS5ajDLh.js";import{i as sr}from"./Globe01-rz2h7Ebm.js";import{S as yt}from"./scroll-area-D-wTiagO.js";import{T as qe,a as Ye,b as Ge}from"./tooltip-Bk2FCtKr.js";import{a as ss,D as as,b as rs,e as is,c as ls,d as os}from"./dialog-DXahQA5F.js";import{I as cs}from"./input-DP3XvpLN.js";import{a as us,s as ar}from"./Eye-Clz4yV9V.js";import{c as ds}from"./ZoomOut-B_lAoymB.js";import{b as rr}from"./Settings02-BX75SJ47.js";import{s as kt}from"./Plus-Cl80ngk-.js";import{s as wt}from"./Trash01-B4p5GuSp.js";import{i as ir}from"./Zap-Dc-gCUi7.js";import{D as Qt,a as Xt,b as en,c as We,g as lr}from"./dropdown-menu-6REDhV5o.js";import{u as tn,a as mt,K as nn,P as sn,b as an,C as rn,s as ln,d as dt,D as on,c as cn,S as un,v as ms,e as dn,h as or}from"./sortable.esm-BDQeT5mM.js";import{r as cr,s as ur,u as it,S as Gt}from"./schema-form-B4m0eDMT.js";import{r as In,u as dr,d as mr,a as fr,i as pr,f as hr,P as gr,b as vr,S as xr}from"./page-seo-form-BYKfoIdi.js";import{b as br,C as Sr,a as Bn,c as yr,e as jr,g as _r}from"./command-CrEXCPCP.js";import{i as kr}from"./FilterLines-CCXAkAAh.js";import{i as Nr}from"./Tool01-DpllcZ_x.js";import{AddSectionModal as wr}from"./add-section-modal-08fudMVv.js";import{c as Cr}from"./save-referenced-block-DcQjO7ah.js";import"./index-CZ67kZ1v.js";import"./chat-context-BsFLDszr.js";import"./hooks-C1I2Fhg2.js";import"./use-mcp-client-vlTb1_vQ.js";import"./auth-D8scdv8L.js";import"./decopilot-sse-pool-BP59aBkW.js";import"./use-virtual-mcp-D63srVIz.js";import"./use-collections-CCMEiGqY.js";import"./use-ai-providers-BuPYcyWU.js";import"./studio-tools-BBnH3MVd.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings-BBq2AfS3.js";import"./drawer-BBC9hSU8.js";import"./collection-search-lIRYT3yV.js";import"./SearchMd-DtbjJ0sS.js";import"./use-mcp-prompts-CGFuFPsL.js";import"./X-ciDfeMTV.js";import"./shell-layout-BuKC3YO-.js";import"./avatar-CCN_co-X.js";import"./User01-DxuO8uwX.js";import"./Users03-D3FPHz00.js";import"./Stars02-CCs6aX7m.js";import"./XClose-BGdHen0O.js";import"./CheckCircle-DgjXE82G.js";import"./required-auth-layout-Czm4wEhq.js";import"./useRouterState-Cy8ALVZD.js";import"./use-org-sso-CGb3XUqQ.js";import"./SwitchHorizontal01-BVb8cFOW.js";import"./ZapSquare-BILpiibq.js";import"./Star01-CqiKSE8w.js";import"./Upload01--GcqA8-Q.js";import"./AlertCircle-B-Zk3zY-.js";import"./form-C9CSHpUw.js";import"./label-CVIIqU26.js";import"./select-CjjjXRUS.js";import"./XCircle-DheND3p1.js";import"./tabs-DY3LqT6S.js";import"./toggle-group-CYBCkLka.js";import"./use-deco-credits-DkHNnq8a.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-Ci8mCMyz.js";import"./use-registry-connections-Qh4o2c-N.js";import"./use-connection-rF7aVJWi.js";import"./useInfiniteQuery-Dtdh4OJ7.js";import"./use-infinite-scroll-MECqtkyO.js";import"./extract-connection-data-CyP5_ll7.js";import"./card-BTSltukm.js";import"./integration-icon-DZ46sqDL.js";import"./collection-tabs-DjP3Ny2m.js";import"./badge-BPsAZTXm.js";import"./textarea-DNK54KKl.js";import"./connection-form-helpers-Dl_gZPK3.js";import"./useSuspenseInfiniteQuery-DcCILGRB.js";import"./mcp-oauth-MmhxfzLz.js";import"./Monitor01-DtUT2Llg.js";import"./connect-desktop-dialog-CRKR2Xhc.js";import"./decopilot-Cd6VUSpu.js";import"./checkbox-M3DdO4ws.js";import"./skeleton-C_vWUNwW.js";import"./Key01-Cd33I9n1.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-Cj3AwHej.js";import"./ArrowUpRight-DrUVVTac.js";import"./Stars01-CfOrOYJQ.js";import"./popover-B5LJwz0j.js";import"./question-004-sINsf4GQ.js";import"./ChevronLeft-BoWRf6EK.js";import"./use-status-sounds-CqqJRu1j.js";import"./empty-state-DXDAVywR.js";import"./toolbar-L8diPmJo.js";import"./preview-dialog-NbAEidmd.js";import"./LinkExternal01-DQqosIE7.js";import"./index-BrlqF8mC.js";import"./file-type-icon-CD_RZ8rl.js";import"./LayoutLeft-Cx1gVHzQ.js";import"./use-mcp-tools-Dl-9pwtN.js";import"./types-CR3zyk0T.js";import"./use-capability-C1x5gZYr.js";import"./shell-route-loading-CvANTPJP.js";import"./index-CN18RaKp.js";import"./alert-dialog-BzcSSmOH.js";import"./switch-D5j5jKzb.js";import"./Play-CFAWCyYY.js";import"./use-debounced-autosave-BoaPkBFT.js";import"./index-B62gT9En.js";import"./sidebar-Bf91anCU.js";import"./sheet-CGQ0l6o4.js";import"./search-input-BpXZI4wE.js";import"./github-repo-picker-Duq8-HaY.js";import"./use-navigate-to-agent-CKBlqEnY.js";import"./Users01-a4XMjW3H.js";import"./use-secrets-C45eD7gN.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./view-mode-toggle-DNC_S7KK.js";import"./DotsVertical-CSx815oq.js";import"./select-model-DuC4X2jB.js";import"./use-automations-3CJWtIS7.js";import"./monaco-editor-BqXgJc7f.js";import"./automation-runs-C_CK9GUW.js";import"./table-HxKELBdZ.js";import"./use-members-DZbTKLCa.js";import"./use-org-auth-client-D79Jyhhp.js";import"./task-status-D5hR8PPt.js";import"./automation-list-row-BBCpkdMa.js";import"./Globe04-ZAH-y7Tv.js";import"./HardDrive-CdL1msYN.js";import"./Sun-0mP8ve2O.js";import"./Palette-CS46pFVA.js";import"./Shield01-CY7h3_lL.js";import"./use-clock-tick-CpGRUyLX.js";import"./use-copy-B9rnfiig.js";import"./content-blocks-o63cs2vh.js";import"./calendar-BCaGHasm.js";import"./image-field-CRd85u-i.js";import"./use-file-configs-e6Y2envv.js";import"./index-DQcT764V.js";function Dr(i){const e=$e.c(38),{open:s,initialName:r,autoLabel:c,isPending:u,onSubmit:p,onOpenChange:d}=i,o=u===void 0?!1:u,[h,x]=D.useState(r),[b,j]=D.useState(s);s!==b&&(j(s),s&&x(r));let S;e[0]!==o||e[1]!==d?(S=V=>{!V&&!o&&d(!1)},e[0]=o,e[1]=d,e[2]=S):S=e[2];const y=S;let m;e[3]!==o||e[4]!==h||e[5]!==p?(m=async V=>{V.preventDefault(),!o&&await p(h.trim())},e[3]=o,e[4]=h,e[5]=p,e[6]=m):m=e[6];const k=m;let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(ss,{children:"Rename variant"}),e[7]=v):v=e[7];const P=c||"the rule";let $;e[8]!==P?($=t.jsxs(as,{children:[v,t.jsxs(rs,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",t.jsx("span",{className:"font-medium",children:P}),"."]})]}),e[8]=P,e[9]=$):$=e[9];let R;e[10]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=R):R=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=V=>x(V.target.value),e[11]=f):f=e[11];let w;e[12]!==c||e[13]!==o||e[14]!==h?(w=t.jsxs("div",{className:"space-y-1.5 py-4",children:[R,t.jsx(cs,{id:"variant-rename-name",value:h,onChange:f,placeholder:c,autoFocus:!0,disabled:o})]}),e[12]=c,e[13]=o,e[14]=h,e[15]=w):w=e[15];let F;e[16]!==d?(F=()=>d(!1),e[16]=d,e[17]=F):F=e[17];let N;e[18]!==o||e[19]!==F?(N=t.jsx(Fe,{type:"button",variant:"outline",onClick:F,disabled:o,children:"Cancel"}),e[18]=o,e[19]=F,e[20]=N):N=e[20];let H;e[21]!==o?(H=o?t.jsxs(t.Fragment,{children:[t.jsx(Zt,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=o,e[22]=H):H=e[22];let C;e[23]!==o||e[24]!==H?(C=t.jsx(Fe,{type:"submit",disabled:o,children:H}),e[23]=o,e[24]=H,e[25]=C):C=e[25];let O;e[26]!==N||e[27]!==C?(O=t.jsxs(is,{children:[N,C]}),e[26]=N,e[27]=C,e[28]=O):O=e[28];let M;e[29]!==k||e[30]!==O||e[31]!==$||e[32]!==w?(M=t.jsx(ls,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:k,children:[$,w,O]})}),e[29]=k,e[30]=O,e[31]=$,e[32]=w,e[33]=M):M=e[33];let L;return e[34]!==y||e[35]!==s||e[36]!==M?(L=t.jsx(os,{open:s,onOpenChange:y,children:M}),e[34]=y,e[35]=s,e[36]=M,e[37]=L):L=e[37],L}function Ut(i,e,s,r,c){const u={...i[e]};if(c.length>1){const p=u.sections,d=[...p?.variants??[]];d[r]&&(d[r]={...d[r],value:s}),u.sections={...p,variants:d}}else u.sections=s;return u}function Rr(i){return structuredClone(i)}function Tr(i){return!i.isSavedBlock&&!i.isMultivariate&&!i.isHidden}function Hn(i){const e=i.replace(/[^A-Za-z0-9_-]/g,"");return/^[A-Za-z]/.test(e)?e:e?`Block${e}`:""}function Un(i,e){const s=i.trim();return s?s.includes("/")?"Block name cannot contain slashes.":Object.hasOwn(e,s)?"A block with this name already exists.":/^[A-Za-z][A-Za-z0-9_-]*$/.test(s)?null:"Use letters, numbers, hyphens, or underscores. Must start with a letter.":"Block name is required."}const Ar="oklch(0.65 0.15 160)",Pr="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)]",fs="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]",Mr="text-[oklch(0.45_0.15_160)] focus:bg-[oklch(0.65_0.15_160/0.12)] focus:text-[oklch(0.45_0.15_160)] dark:text-[oklch(0.78_0.15_160)] dark:focus:bg-[oklch(0.65_0.15_160/0.15)] dark:focus:text-[oklch(0.78_0.15_160)]";function Wn(i){return i.map(e=>e.label).join(`
|
|
2
|
+
`)}function Wt(i){return i.map(e=>({id:crypto.randomUUID(),index:e.index,label:e.label}))}function Vr(i){return i.map((e,s)=>({...e,index:s}))}function ps(i){const e=$e.c(17),{label:s,canDelete:r,dragging:c,onDuplicate:u,onDelete:p}=i,d=c?"opacity-100":"opacity-0 group-hover:opacity-100";let o;e[0]!==d?(o=we("h-4 w-4 shrink-0 text-muted-foreground/40 transition-opacity",d),e[0]=d,e[1]=o):o=e[1];let h;e[2]!==o?(h=t.jsx(ds,{className:o}),e[2]=o,e[3]=h):h=e[3];let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(_t,{className:"h-4 w-4 shrink-0",style:{color:Ar}}),e[4]=x):x=e[4];let b;e[5]!==s?(b=t.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),e[5]=s,e[6]=b):b=e[6];let j;e[7]!==r||e[8]!==c||e[9]!==s||e[10]!==p||e[11]!==u?(j=!c&&t.jsxs(Qt,{children:[t.jsx(Xt,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":`Open actions for ${s}`,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",onClick:$r,onPointerDown:Er,children:t.jsx(Jt,{size:14})})}),t.jsxs(en,{align:"end",children:[t.jsxs(We,{onClick:y=>{y.stopPropagation(),u?.()},children:[t.jsx(us,{size:14}),"Duplicate"]}),t.jsxs(We,{variant:"destructive",disabled:!r,onClick:y=>{y.stopPropagation(),p?.()},children:[t.jsx(wt,{size:14}),"Delete"]})]})]}),e[7]=r,e[8]=c,e[9]=s,e[10]=p,e[11]=u,e[12]=j):j=e[12];let S;return e[13]!==h||e[14]!==b||e[15]!==j?(S=t.jsxs(t.Fragment,{children:[h,x,b,j]}),e[13]=h,e[14]=b,e[15]=j,e[16]=S):S=e[16],S}function Er(i){return i.stopPropagation()}function $r(i){return i.stopPropagation()}function Or(i){const e=$e.c(26),{entry:s,selected:r,canDelete:c,onSelect:u,onDuplicate:p,onDelete:d}=i;let o;e[0]!==s.id?(o={id:s.id,animateLayoutChanges:Lr},e[0]=s.id,e[1]=o):o=e[1];const{attributes:h,listeners:x,setNodeRef:b,transform:j,isDragging:S}=an(o);let y;e[2]!==j?(y=rn.Transform.toString(j?{...j,x:0}:null),e[2]=j,e[3]=y):y=e[3];const m=S?0:void 0;let k;e[4]!==y||e[5]!==m?(k={transform:y,opacity:m},e[4]=y,e[5]=m,e[6]=k):k=e[6];const v=k;let P;e[7]!==u?(P=N=>{N.target===N.currentTarget&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),u())},e[7]=u,e[8]=P):P=e[8];const $=S?"cursor-grabbing":"cursor-grab",R=r?fs:Pr;let f;e[9]!==$||e[10]!==R?(f=we("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors touch-none",$,R),e[9]=$,e[10]=R,e[11]=f):f=e[11];let w;e[12]!==c||e[13]!==s.label||e[14]!==d||e[15]!==p?(w=t.jsx(ps,{label:s.label,canDelete:c,onDuplicate:p,onDelete:d}),e[12]=c,e[13]=s.label,e[14]=d,e[15]=p,e[16]=w):w=e[16];let F;return e[17]!==h||e[18]!==x||e[19]!==u||e[20]!==b||e[21]!==v||e[22]!==P||e[23]!==f||e[24]!==w?(F=t.jsx("div",{ref:b,style:v,...h,...x,onClick:u,onKeyDown:P,className:f,children:w}),e[17]=h,e[18]=x,e[19]=u,e[20]=b,e[21]=v,e[22]=P,e[23]=f,e[24]=w,e[25]=F):F=e[25],F}function Lr(){return!1}function zr(i){const e=$e.c(81),{listKey:s,variants:r,selectedIndex:c,onSelect:u,onDuplicate:p,onDelete:d,onRemoveAll:o,onReorder:h,onAdd:x}=i,b=r.length>1;let j;e[0]!==r?(j=()=>Wt(r),e[0]=r,e[1]=j):j=e[1];const[S,y]=D.useState(j),[m,k]=D.useState(null),[v,P]=D.useState(s),[$,R]=D.useState(r.length);let f;e[2]!==r?(f=()=>Wn(r),e[2]=r,e[3]=f):f=e[3];const[w,F]=D.useState(f),N=D.useRef(!1),H=Wn(r);v!==s?(P(s),R(r.length),F(H),y(Wt(r))):$!==r.length?(R(r.length),F(H),y(Wt(r))):w!==H&&(F(H),y(_e=>r.map((he,ae)=>({id:_e[ae]?.id??crypto.randomUUID(),index:he.index,label:he.label}))));let C;e[4]===Symbol.for("react.memo_cache_sentinel")?(C={activationConstraint:{distance:8}},e[4]=C):C=e[4];let O;e[5]===Symbol.for("react.memo_cache_sentinel")?(O={coordinateGetter:ln},e[5]=O):O=e[5];const M=tn(mt(sn,C),mt(nn,O));let L;e[6]!==S?(L=S.map(Fr),e[6]=S,e[7]=L):L=e[7];const V=L;let ge;e[8]!==S?(ge=_e=>{const he=String(_e.active.id);k(S.find(ae=>ae.id===he)??null)},e[8]=S,e[9]=ge):ge=e[9];const ce=ge;let J;e[10]!==V||e[11]!==h?(J=_e=>{k(null);const{active:he,over:ae}=_e;if(!ae||he.id===ae.id)return;const be=V.indexOf(String(he.id)),Se=V.indexOf(String(ae.id));be===-1||Se===-1||(y(re=>Vr(dt([...re],be,Se))),N.current=!0,requestAnimationFrame(()=>{N.current=!1}),h(be,Se))},e[10]=V,e[11]=h,e[12]=J):J=e[12];const ue=J;let se;e[13]===Symbol.for("react.memo_cache_sentinel")?(se=()=>{k(null)},e[13]=se):se=e[13];const W=se;let ie,Z,X,ee,q,K,I,te,fe,pe,de,ne,G;if(e[14]!==b||e[15]!==S||e[16]!==V||e[17]!==ue||e[18]!==ce||e[19]!==x||e[20]!==d||e[21]!==p||e[22]!==o||e[23]!==u||e[24]!==c||e[25]!==M){const _e=Y=>{N.current||u(Y)};de="space-y-1 border-b p-2";let he;e[39]===Symbol.for("react.memo_cache_sentinel")?(he=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variants"}),e[39]=he):he=e[39];let ae;e[40]===Symbol.for("react.memo_cache_sentinel")?(ae=t.jsx(kt,{size:14}),e[40]=ae):ae=e[40];let be;e[41]!==x?(be=t.jsx(qe,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-6",onClick:x,children:ae})}),e[41]=x,e[42]=be):be=e[42];let Se;e[43]===Symbol.for("react.memo_cache_sentinel")?(Se=t.jsx(Ye,{children:"Add variant"}),e[43]=Se):Se=e[43];let re;e[44]!==be?(re=t.jsxs(Ge,{children:[be,Se]}),e[44]=be,e[45]=re):re=e[45];let le;e[46]===Symbol.for("react.memo_cache_sentinel")?(le=t.jsx(wt,{size:14}),e[46]=le):le=e[46];let ye;e[47]!==o?(ye=t.jsx(qe,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Remove all variants",className:"size-6 text-muted-foreground hover:text-destructive",onClick:o,children:le})}),e[47]=o,e[48]=ye):ye=e[48];let z;e[49]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx(Ye,{children:"Remove all variants"}),e[49]=z):z=e[49];let U;e[50]!==ye?(U=t.jsxs(Ge,{children:[ye,z]}),e[50]=ye,e[51]=U):U=e[51],e[52]!==re||e[53]!==U?(ne=t.jsxs("div",{className:"flex items-center justify-between",children:[he,t.jsxs("div",{className:"flex items-center gap-0.5",children:[re,U]})]}),e[52]=re,e[53]=U,e[54]=ne):ne=e[54],Z=on,K=M,I=cn,te=ce,fe=ue,pe=W,ie=un,ee=V,q=ms,G="space-y-0.5",X=S.map(Y=>t.jsx(Or,{entry:Y,selected:Y.index===c,canDelete:b,onSelect:()=>_e(Y.index),onDuplicate:()=>p(Y.index),onDelete:()=>d(Y.index)},Y.id)),e[14]=b,e[15]=S,e[16]=V,e[17]=ue,e[18]=ce,e[19]=x,e[20]=d,e[21]=p,e[22]=o,e[23]=u,e[24]=c,e[25]=M,e[26]=ie,e[27]=Z,e[28]=X,e[29]=ee,e[30]=q,e[31]=K,e[32]=I,e[33]=te,e[34]=fe,e[35]=pe,e[36]=de,e[37]=ne,e[38]=G}else ie=e[26],Z=e[27],X=e[28],ee=e[29],q=e[30],K=e[31],I=e[32],te=e[33],fe=e[34],pe=e[35],de=e[36],ne=e[37],G=e[38];let B;e[55]!==X||e[56]!==G?(B=t.jsx("div",{className:G,children:X}),e[55]=X,e[56]=G,e[57]=B):B=e[57];let je;e[58]!==ie||e[59]!==ee||e[60]!==q||e[61]!==B?(je=t.jsx(ie,{items:ee,strategy:q,children:B}),e[58]=ie,e[59]=ee,e[60]=q,e[61]=B,e[62]=je):je=e[62];let ve;e[63]!==m||e[64]!==b?(ve=m?t.jsx("div",{className:we("flex items-center gap-2 rounded-md px-2 py-2.5 shadow-lg ring-1 ring-border/60 cursor-grabbing",fs),children:t.jsx(ps,{label:m.label,canDelete:b,dragging:!0})}):null,e[63]=m,e[64]=b,e[65]=ve):ve=e[65];let Ce;e[66]!==ve?(Ce=t.jsx(dn,{dropAnimation:null,children:ve}),e[66]=ve,e[67]=Ce):Ce=e[67];let xe;e[68]!==Z||e[69]!==K||e[70]!==I||e[71]!==te||e[72]!==fe||e[73]!==pe||e[74]!==je||e[75]!==Ce?(xe=t.jsxs(Z,{sensors:K,collisionDetection:I,onDragStart:te,onDragEnd:fe,onDragCancel:pe,children:[je,Ce]}),e[68]=Z,e[69]=K,e[70]=I,e[71]=te,e[72]=fe,e[73]=pe,e[74]=je,e[75]=Ce,e[76]=xe):xe=e[76];let Re;return e[77]!==de||e[78]!==ne||e[79]!==xe?(Re=t.jsxs("div",{className:de,children:[ne,xe]}),e[77]=de,e[78]=ne,e[79]=xe,e[80]=Re):Re=e[80],Re}function Fr(i){return i.id}function Kr(i){return i.schema?.definitions??i.schema?.$defs??{}}function Ir(i,e){const s=Kr(e),r=s[btoa(i)];if(!r)return;let c=typeof r.image=="string"?r.image:void 0;if(!c&&Array.isArray(r.allOf)){const u=r.allOf.find(p=>typeof p.$ref=="string")?.$ref;if(typeof u=="string"){const p=u.replace("#/definitions/",""),d=s[p];c=typeof d?.image=="string"?d.image:void 0}}if(c?.includes("{{{"))return c}function Br(i,e){if(!e)return;const s=va(i);if(!s)return;const r=Ir(s.resolveType,e);if(!r)return;const c=cr(r,s.data);if(c)return ur(c)}const Hr="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Ur="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 qn(i){return Array.from({length:i},(e,s)=>({id:crypto.randomUUID(),index:s}))}function hs(i){return i.map((e,s)=>({...e,index:s}))}function Wr(i,e){if(e===i.length)return i;if(e<i.length)return hs(i.slice(0,e));const s=Array.from({length:e-i.length},(r,c)=>({id:crypto.randomUUID(),index:i.length+c}));return[...i,...s]}function gs(i){const e=$e.c(20),{section:s,raw:r,meta:c}=i,u=s.isSavedBlock===!0,p=s.isMultivariate===!0;let d;e[0]!==c||e[1]!==r?(d=r&&c?Br(r,c):void 0,e[0]=c,e[1]=r,e[2]=d):d=e[2];const o=d;let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(ds,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=h):h=e[3];let x;e[4]!==o?(x=o&&t.jsx("img",{src:o,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=o,e[5]=x):x=e[5];let b;e[6]!==p||e[7]!==u?(b=u?{color:ba}:p?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=p,e[7]=u,e[8]=b):b=e[8];let j;e[9]!==b?(j=t.jsx(_t,{className:"h-4 w-4 shrink-0",style:b}),e[9]=b,e[10]=j):j=e[10];const S=s.isHidden&&"line-through opacity-50";let y;e[11]!==S?(y=we("min-w-0 flex-1 truncate text-sm font-medium",S),e[11]=S,e[12]=y):y=e[12];let m;e[13]!==s.label||e[14]!==y?(m=t.jsx("span",{className:y,children:s.label}),e[13]=s.label,e[14]=y,e[15]=m):m=e[15];let k;return e[16]!==x||e[17]!==j||e[18]!==m?(k=t.jsxs(t.Fragment,{children:[h,x,j,m]}),e[16]=x,e[17]=j,e[18]=m,e[19]=k):k=e[19],k}function vs(i,e){const s=i.isSavedBlock===!0,r=i.isMultivariate===!0;return we("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":s?Hr:r?"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)]":"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function qr(i){const e=$e.c(64),{section:s,raw:r,meta:c,sortableId:u,selected:p,onSelect:d,onDelete:o,onDuplicate:h,onMakeReusable:x,onToggleHidden:b,onToggleLazy:j,onAddVariant:S,onDetach:y}=i,m=r?es(r.__resolveType??""):!1;let k;e[0]!==s?(k=xa(s),e[0]=s,e[1]=k):k=e[1];const v=k;let P;e[2]!==u?(P={id:u,animateLayoutChanges:Qr},e[2]=u,e[3]=P):P=e[3];const{attributes:$,listeners:R,setNodeRef:f,transform:w,isDragging:F}=an(P);let N;e[4]!==w?(N=rn.Transform.toString(w?{...w,x:0}:null),e[4]=w,e[5]=N):N=e[5];const H=F?0:void 0;let C;e[6]!==N||e[7]!==H?(C={transform:N,opacity:H},e[6]=N,e[7]=H,e[8]=C):C=e[8];const O=C;let M;e[9]!==s?(M=Tr(s),e[9]=s,e[10]=M):M=e[10];const L=M,V="button",ge=0;let ce;e[11]!==d?(ce=B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),d())},e[11]=d,e[12]=ce):ce=e[12];const J=F?"cursor-grabbing":"cursor-pointer";let ue;e[13]!==s||e[14]!==p||e[15]!==J?(ue=we("touch-none transition-colors",J,vs(s,p)),e[13]=s,e[14]=p,e[15]=J,e[16]=ue):ue=e[16];let se;e[17]!==c||e[18]!==r||e[19]!==s?(se=t.jsx(gs,{section:s,raw:r,meta:c}),e[17]=c,e[18]=r,e[19]=s,e[20]=se):se=e[20];const W=!s.isMultivariate&&t.jsxs(Ge,{children:[t.jsx(qe,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":m?"Disable async render":"Enable async render",className:we("h-7 w-7 shrink-0",m?"":"opacity-0 group-hover:opacity-100"),onClick:B=>{B.stopPropagation(),j()},onPointerDown:Jr,children:t.jsx(ir,{className:we("h-3.5 w-3.5",m&&"text-yellow-500")})})}),t.jsx(Ye,{side:"bottom",children:m?"Disable async render":"Enable async render"})]});let ie;e[21]!==b||e[22]!==s.isHidden||e[23]!==s.isMultivariate?(ie=!s.isMultivariate&&t.jsxs(Ge,{children:[t.jsx(qe,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":s.isHidden?"Show section":"Hide section",className:we("h-7 w-7 shrink-0",s.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:B=>{B.stopPropagation(),b()},onPointerDown:Zr,children:s.isHidden?t.jsx(rr,{className:"h-3.5 w-3.5"}):t.jsx(ar,{className:"h-3.5 w-3.5"})})}),t.jsx(Ye,{side:"bottom",children:s.isHidden?"Show section":"Hide section"})]}),e[21]=b,e[22]=s.isHidden,e[23]=s.isMultivariate,e[24]=ie):ie=e[24];let Z;e[25]===Symbol.for("react.memo_cache_sentinel")?(Z=t.jsx(Xt,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Gr,onPointerDown:Yr,children:t.jsx(Jt,{className:"h-3.5 w-3.5"})})}),e[25]=Z):Z=e[25];let X;e[26]!==h?(X=B=>{B.stopPropagation(),h()},e[26]=h,e[27]=X):X=e[27];let ee;e[28]===Symbol.for("react.memo_cache_sentinel")?(ee=t.jsx(us,{className:"h-4 w-4"}),e[28]=ee):ee=e[28];let q;e[29]!==X?(q=t.jsxs(We,{onClick:X,children:[ee,"Duplicate"]}),e[29]=X,e[30]=q):q=e[30];let K;e[31]!==v||e[32]!==S?(K=v&&t.jsxs(We,{className:Mr,onClick:B=>{B.stopPropagation(),S()},children:[t.jsx(ns,{className:"h-4 w-4"}),"Add variant"]}),e[31]=v,e[32]=S,e[33]=K):K=e[33];let I;e[34]!==L||e[35]!==x?(I=L&&t.jsxs(We,{className:Ur,onClick:B=>{B.stopPropagation(),x()},children:[t.jsx(_t,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=L,e[35]=x,e[36]=I):I=e[36];let te;e[37]!==y||e[38]!==s.isMultivariate||e[39]!==s.isSavedBlock?(te=s.isSavedBlock===!0&&!s.isMultivariate&&t.jsxs(We,{onClick:B=>{B.stopPropagation(),y()},children:[t.jsx(_t,{className:"h-4 w-4"}),"Detach"]}),e[37]=y,e[38]=s.isMultivariate,e[39]=s.isSavedBlock,e[40]=te):te=e[40];let fe;e[41]!==o?(fe=B=>{B.stopPropagation(),o()},e[41]=o,e[42]=fe):fe=e[42];let pe;e[43]===Symbol.for("react.memo_cache_sentinel")?(pe=t.jsx(wt,{className:"h-4 w-4"}),e[43]=pe):pe=e[43];let de;e[44]!==fe?(de=t.jsxs(We,{className:"text-destructive focus:text-destructive",onClick:fe,children:[pe,"Delete"]}),e[44]=fe,e[45]=de):de=e[45];let ne;e[46]!==q||e[47]!==K||e[48]!==I||e[49]!==te||e[50]!==de?(ne=t.jsxs(Qt,{children:[Z,t.jsxs(en,{align:"end",className:"w-44",children:[q,K,I,te,de]})]}),e[46]=q,e[47]=K,e[48]=I,e[49]=te,e[50]=de,e[51]=ne):ne=e[51];let G;return e[52]!==$||e[53]!==R||e[54]!==d||e[55]!==f||e[56]!==O||e[57]!==ue||e[58]!==se||e[59]!==W||e[60]!==ie||e[61]!==ne||e[62]!==ce?(G=t.jsxs("div",{ref:f,style:O,...$,...R,role:V,tabIndex:ge,onClick:d,onKeyDown:ce,className:ue,children:[se,W,ie,ne]}),e[52]=$,e[53]=R,e[54]=d,e[55]=f,e[56]=O,e[57]=ue,e[58]=se,e[59]=W,e[60]=ie,e[61]=ne,e[62]=ce,e[63]=G):G=e[63],G}function Yr(i){return i.stopPropagation()}function Gr(i){return i.stopPropagation()}function Zr(i){return i.stopPropagation()}function Jr(i){return i.stopPropagation()}function Qr(){return!1}function Xr(i){const e=$e.c(90),{listKey:s,rawSections:r,sections:c,meta:u,selectedIndex:p,onSelect:d,onReorder:o,onDelete:h,onDuplicate:x,onMakeReusable:b,onToggleHidden:j,onToggleLazy:S,onAddVariant:y,onDetach:m,onAddSection:k,canAddSection:v}=i,P=v===void 0?!0:v;let $;e[0]!==c.length?($=()=>qn(c.length),e[0]=c.length,e[1]=$):$=e[1];const[R,f]=D.useState($),[w,F]=D.useState(null),[N,H]=D.useState(s),[C,O]=D.useState(c.length),M=D.useRef(!1);N!==s?(H(s),O(c.length),f(qn(c.length))):C!==c.length&&(O(c.length),f(z=>Wr(z,c.length)));let L;e[2]===Symbol.for("react.memo_cache_sentinel")?(L={activationConstraint:{distance:8}},e[2]=L):L=e[2];let V;e[3]===Symbol.for("react.memo_cache_sentinel")?(V={coordinateGetter:ln},e[3]=V):V=e[3];const ge=tn(mt(sn,L),mt(nn,V));let ce;e[4]!==R?(ce=R.map(ei),e[4]=R,e[5]=ce):ce=e[5];const J=ce;let ue;e[6]===Symbol.for("react.memo_cache_sentinel")?(ue=z=>{F(String(z.active.id))},e[6]=ue):ue=e[6];const se=ue;let W;e[7]!==J||e[8]!==o?(W=z=>{F(null);const{active:U,over:Y}=z;if(!Y||U.id===Y.id)return;const Ie=J.indexOf(String(U.id)),He=J.indexOf(String(Y.id));Ie===-1||He===-1||(f(Ze=>hs(dt([...Ze],Ie,He))),M.current=!0,requestAnimationFrame(()=>{M.current=!1}),o?.(Ie,He))},e[7]=J,e[8]=o,e[9]=W):W=e[9];const ie=W;let Z;e[10]===Symbol.for("react.memo_cache_sentinel")?(Z=()=>{F(null)},e[10]=Z):Z=e[10];const X=Z;let ee,q,K,I,te,fe,pe,de,ne,G,B,je,ve,Ce,xe;if(e[11]!==w||e[12]!==P||e[13]!==R||e[14]!==J||e[15]!==ie||e[16]!==u||e[17]!==k||e[18]!==y||e[19]!==h||e[20]!==m||e[21]!==x||e[22]!==b||e[23]!==d||e[24]!==j||e[25]!==S||e[26]!==r||e[27]!==c||e[28]!==p||e[29]!==ge){Ce=Symbol.for("react.early_return_sentinel");e:{const z=U=>{M.current||d(U)};if(e[45]!==w||e[46]!==P||e[47]!==R||e[48]!==k||e[49]!==r||e[50]!==c){const U=w?R.find(Y=>Y.id===w):null;if(I=U!=null?c[U.index]:null,K=U!=null?r[U.index]:void 0,R.length===0){let Y;e[54]===Symbol.for("react.memo_cache_sentinel")?(Y=t.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=Y):Y=e[54];const Ie=!P;let He;e[55]===Symbol.for("react.memo_cache_sentinel")?(He=t.jsx(kt,{size:14}),e[55]=He):He=e[55];let Ze;e[56]!==k||e[57]!==Ie?(Ze=t.jsxs("div",{className:"space-y-2",children:[Y,t.jsxs(Fe,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Ie,onClick:k,children:[He,"Add section"]})]}),e[56]=k,e[57]=Ie,e[58]=Ze):Ze=e[58],Ce=Ze;break e}ve=we(U&&"cursor-grabbing"),e[45]=w,e[46]=P,e[47]=R,e[48]=k,e[49]=r,e[50]=c,e[51]=K,e[52]=I,e[53]=ve}else K=e[51],I=e[52],ve=e[53];q=on,de=ge,ne=cn,G=se,B=ie,je=X,ee=un,fe=J,pe=ms,xe="space-y-1",te=R.map(U=>{const Y=c[U.index];return Y?t.jsx(qr,{sortableId:U.id,section:Y,raw:r[U.index],meta:u,selected:p===U.index,onSelect:()=>z(U.index),onDelete:()=>h(U.index),onDuplicate:()=>x(U.index),onMakeReusable:()=>b(U.index),onToggleHidden:()=>j(U.index),onToggleLazy:()=>S(U.index),onAddVariant:()=>y(U.index),onDetach:()=>m(U.index)},U.id):null})}e[11]=w,e[12]=P,e[13]=R,e[14]=J,e[15]=ie,e[16]=u,e[17]=k,e[18]=y,e[19]=h,e[20]=m,e[21]=x,e[22]=b,e[23]=d,e[24]=j,e[25]=S,e[26]=r,e[27]=c,e[28]=p,e[29]=ge,e[30]=ee,e[31]=q,e[32]=K,e[33]=I,e[34]=te,e[35]=fe,e[36]=pe,e[37]=de,e[38]=ne,e[39]=G,e[40]=B,e[41]=je,e[42]=ve,e[43]=Ce,e[44]=xe}else ee=e[30],q=e[31],K=e[32],I=e[33],te=e[34],fe=e[35],pe=e[36],de=e[37],ne=e[38],G=e[39],B=e[40],je=e[41],ve=e[42],Ce=e[43],xe=e[44];if(Ce!==Symbol.for("react.early_return_sentinel"))return Ce;let Re;e[59]!==te||e[60]!==xe?(Re=t.jsx("div",{className:xe,children:te}),e[59]=te,e[60]=xe,e[61]=Re):Re=e[61];let _e;e[62]!==ee||e[63]!==fe||e[64]!==pe||e[65]!==Re?(_e=t.jsx(ee,{items:fe,strategy:pe,children:Re}),e[62]=ee,e[63]=fe,e[64]=pe,e[65]=Re,e[66]=_e):_e=e[66];let he;e[67]!==K||e[68]!==I||e[69]!==u?(he=I?t.jsx("div",{className:we("cursor-grabbing shadow-lg ring-1 ring-border/60",vs(I,!1)),children:t.jsx(gs,{section:I,raw:K,meta:u})}):null,e[67]=K,e[68]=I,e[69]=u,e[70]=he):he=e[70];let ae;e[71]!==he?(ae=t.jsx(dn,{dropAnimation:null,children:he}),e[71]=he,e[72]=ae):ae=e[72];let be;e[73]!==q||e[74]!==de||e[75]!==ne||e[76]!==G||e[77]!==B||e[78]!==je||e[79]!==_e||e[80]!==ae?(be=t.jsxs(q,{sensors:de,collisionDetection:ne,onDragStart:G,onDragEnd:B,onDragCancel:je,children:[_e,ae]}),e[73]=q,e[74]=de,e[75]=ne,e[76]=G,e[77]=B,e[78]=je,e[79]=_e,e[80]=ae,e[81]=be):be=e[81];const Se=!P;let re;e[82]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx(kt,{size:14}),e[82]=re):re=e[82];let le;e[83]!==k||e[84]!==Se?(le=t.jsxs(Fe,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:Se,onClick:k,children:[re,"Add section"]}),e[83]=k,e[84]=Se,e[85]=le):le=e[85];let ye;return e[86]!==ve||e[87]!==be||e[88]!==le?(ye=t.jsxs("div",{className:ve,children:[be,le]}),e[86]=ve,e[87]=be,e[88]=le,e[89]=ye):ye=e[89],ye}function ei(i){return i.id}const ti=[[/always|matchalways/i,"Users03"],[/device|matchdevice/i,"Phone02"],[/date|matchdate/i,"Calendar"],[/random|matchrandom/i,"Shuffle01"],[/host|matchhost/i,"Globe02"],[/location|matchlocation/i,"MarkerPin01"],[/pathname/i,"Link03"],[/cron|matchcron/i,"Clock"],[/multi|matchmulti/i,"FilterLines"],[/never|matchnever/i,"EyeOff"],[/environment|matchenvironment/i,"Cloud01"],[/eq\.ts|\/eq$/i,"Brackets"],[/user|requser|isdecouser/i,"User01"],[/site|template/i,"LayoutAlt01"]],ni={"device-mobile":"Phone02","device-desktop":"Monitor01","device-tablet":"Tablet01","calendar-event":"Calendar","calendar-month":"Calendar",clock:"Clock","current-location":"MarkerPin01","map-2":"MarkerPin01","world-search":"Globe02",shuffle:"Shuffle01",filter:"FilterLines","eye-off":"EyeOff",flask:"Beaker02",link:"Link03","git-merge":"GitBranch01",users:"Users03",flag:"Flag01","cloud-storm":"Cloud01",campaign:"Announcement01",experiment:"Beaker02",language:"Globe02","hand-click":"CursorClick01"};function qt(i){return Nt(i)!==void 0}function mn(i,e){if(e){if(qt(e))return e;const s=ni[e];if(s&&qt(s))return s}for(const[s,r]of ti)if(s.test(i)&&qt(r))return r;return"FilterLines"}function si(i){return Nt(i)??kr}function Yn(i){const e=$e.c(11),{iconName:s,size:r,className:c}=i,u=r===void 0?"md":r;let p;e[0]!==s?(p=si(s),e[0]=s,e[1]=p):p=e[1];const d=p,o=u==="sm"?"size-7":"size-9",h=u==="sm"?16:18;let x;e[2]!==o||e[3]!==c?(x=we("flex shrink-0 items-center justify-center rounded-full bg-muted",o,c),e[2]=o,e[3]=c,e[4]=x):x=e[4];let b;e[5]!==d||e[6]!==h?(b=t.jsx(d,{size:h,className:"text-muted-foreground"}),e[5]=d,e[6]=h,e[7]=b):b=e[7];let j;return e[8]!==x||e[9]!==b?(j=t.jsx("div",{className:x,children:b}),e[8]=x,e[9]=b,e[10]=j):j=e[10],j}const xs="Users03";function ai(i){const e=i.manifest?.blocks??{},s=[];for(const[r,c]of Object.entries(e))if(r.includes("matchers"))for(const u of Object.keys(c)){if(u.includes("always"))continue;const p=Sa(u,i);s.push({resolveType:u,title:p.title??nt(u),description:p.description,iconName:mn(u,p.icon)})}return s}function ri(i,e){if(!i)return xs;const s=e.find(r=>r.resolveType===i);return s?s.iconName:mn(i)}function Gn(i){const e=$e.c(41),{currentRt:s,currentLabel:r,matchers:c,onSelect:u}=i,[p,d]=D.useState(!1);let o;if(e[0]!==s||e[1]!==c){const L=ri(s,c);o=Nt(L),e[0]=s,e[1]=c,e[2]=o}else o=e[2];const h=o;let x;e[3]!==u?(x=L=>{u(L),d(!1)},e[3]=u,e[4]=x):x=e[4];const b=x;let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j=()=>d(!0),e[5]=j):j=e[5];let S;e[6]!==h?(S=h&&t.jsx(h,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[6]=h,e[7]=S):S=e[7];let y;e[8]!==r?(y=t.jsx("span",{className:"flex-1 truncate",children:r}),e[8]=r,e[9]=y):y=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(ts,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[10]=m):m=e[10];let k;e[11]!==S||e[12]!==y?(k=t.jsxs("button",{type:"button",onClick:j,className:"flex h-10 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-left text-sm shadow-xs transition-colors hover:bg-accent/40 cursor-pointer",children:[S,y,m]}),e[11]=S,e[12]=y,e[13]=k):k=e[13];let v;e[14]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(br,{placeholder:"Search rules..."}),e[14]=v):v=e[14];let P;e[15]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(Sr,{children:"No rules found."}),e[15]=P):P=e[15];let $;e[16]!==b?($=()=>b(""),e[16]=b,e[17]=$):$=e[17];const R=!s&&"bg-accent/60";let f;e[18]!==R?(f=we("gap-2.5",R),e[18]=R,e[19]=f):f=e[19];let w;e[20]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(Yn,{iconName:xs,size:"sm"}),e[20]=w):w=e[20];let F;e[21]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsx("span",{className:"text-sm",children:"Always"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Target all users"})]}),e[21]=F):F=e[21];let N;e[22]!==$||e[23]!==f?(N=t.jsxs(Bn,{value:"always Target all users",onSelect:$,className:f,children:[w,F]}),e[22]=$,e[23]=f,e[24]=N):N=e[24];let H;if(e[25]!==s||e[26]!==b||e[27]!==c){let L;e[29]!==s||e[30]!==b?(L=V=>t.jsxs(Bn,{value:`${V.title} ${V.resolveType} ${V.description??""}`,onSelect:()=>b(V.resolveType),className:we("gap-2.5",s===V.resolveType&&"bg-accent/60"),children:[t.jsx(Yn,{iconName:V.iconName,size:"sm"}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsx("span",{className:"text-sm",children:V.title}),V.description&&t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:V.description})]})]},V.resolveType),e[29]=s,e[30]=b,e[31]=L):L=e[31],H=c.map(L),e[25]=s,e[26]=b,e[27]=c,e[28]=H}else H=e[28];let C;e[32]!==N||e[33]!==H?(C=t.jsxs(yr,{children:[P,t.jsxs(jr,{children:[N,H]})]}),e[32]=N,e[33]=H,e[34]=C):C=e[34];let O;e[35]!==p||e[36]!==C?(O=t.jsxs(_r,{open:p,onOpenChange:d,title:"Choose a rule",description:"Pick how to target users for this variant",className:"sm:max-w-lg",children:[v,C]}),e[35]=p,e[36]=C,e[37]=O):O=e[37];let M;return e[38]!==O||e[39]!==k?(M=t.jsxs(t.Fragment,{children:[k,O]}),e[38]=O,e[39]=k,e[40]=M):M=e[40],M}const ii="oklch(0.65 0.15 160)",bs="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function fn(i){const e=$e.c(5),{rule:s,matchers:r}=i,c=s?.__resolveType??"";let u;if(e[0]!==r||e[1]!==c){const h=r.find(x=>x.resolveType===c)?.iconName??mn(c);u=Nt(h),e[0]=r,e[1]=c,e[2]=u}else u=e[2];const p=u;if(!p)return null;let d;return e[3]!==p?(d=t.jsx(p,{size:14,className:"shrink-0"}),e[3]=p,e[4]=d):d=e[4],d}function Zn(i){return i.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
|
|
3
|
+
`)}function Yt(i){return i.map((e,s)=>({id:crypto.randomUUID(),index:s,variant:e}))}function li(i){return i.map((e,s)=>({...e,index:s}))}function oi(i){const e=$e.c(51),{entry:s,sortableId:r,isActive:c,canDelete:u,decofile:p,meta:d,matchers:o,onSelect:h,onRename:x,onDelete:b}=i;let j;e[0]!==r?(j={id:r,animateLayoutChanges:di},e[0]=r,e[1]=j):j=e[1];const{attributes:S,listeners:y,setNodeRef:m,transform:k,isDragging:v}=an(j);let P;e[2]!==k?(P=rn.Transform.toString(k?{...k,y:0}:null),e[2]=k,e[3]=P):P=e[3];const $=v?0:void 0;let R;e[4]!==P||e[5]!==$?(R={transform:P,opacity:$},e[4]=P,e[5]=$,e[6]=R):R=e[6];const f=R,w=d??void 0;let F;e[7]!==p||e[8]!==s.variant.rule||e[9]!==w?(F=jt(s.variant.rule,p,w),e[7]=p,e[8]=s.variant.rule,e[9]=w,e[10]=F):F=e[10];const N=F,H=c?bs:"text-muted-foreground hover:bg-muted hover:text-foreground",C=v?"cursor-grabbing":"cursor-grab";let O;e[11]!==H||e[12]!==C?(O=we("group shrink-0 inline-flex items-center rounded-md transition-colors touch-none",H,C),e[11]=H,e[12]=C,e[13]=O):O=e[13];let M;e[14]!==N||e[15]!==o?(M=t.jsx(fn,{rule:N,matchers:o}),e[14]=N,e[15]=o,e[16]=M):M=e[16];let L;e[17]!==s.variant.label?(L=t.jsx("span",{className:"truncate",children:s.variant.label}),e[17]=s.variant.label,e[18]=L):L=e[18];let V;e[19]!==S||e[20]!==y||e[21]!==h||e[22]!==M||e[23]!==L?(V=t.jsxs("button",{type:"button",...S,...y,onClick:h,className:"inline-flex items-center gap-1.5 h-8 pl-3 pr-1.5 text-sm font-medium cursor-[inherit]",children:[M,L]}),e[19]=S,e[20]=y,e[21]=h,e[22]=M,e[23]=L,e[24]=V):V=e[24];const ge=`Actions for ${s.variant.label}`,ce=c&&"opacity-100";let J;e[25]!==ce?(J=we("inline-flex h-8 w-6 items-center justify-center pr-1 cursor-pointer transition-opacity","opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",ce),e[25]=ce,e[26]=J):J=e[26];let ue;e[27]===Symbol.for("react.memo_cache_sentinel")?(ue=t.jsx(Jt,{size:12}),e[27]=ue):ue=e[27];let se;e[28]!==ge||e[29]!==J?(se=t.jsx(Xt,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":ge,onClick:ui,onPointerDown:ci,className:J,children:ue})}),e[28]=ge,e[29]=J,e[30]=se):se=e[30];let W;e[31]===Symbol.for("react.memo_cache_sentinel")?(W=t.jsx(Nr,{size:14}),e[31]=W):W=e[31];let ie;e[32]!==x?(ie=t.jsxs(We,{onClick:x,children:[W,"Rename"]}),e[32]=x,e[33]=ie):ie=e[33];let Z;e[34]===Symbol.for("react.memo_cache_sentinel")?(Z=t.jsx(lr,{}),e[34]=Z):Z=e[34];const X=!u;let ee;e[35]===Symbol.for("react.memo_cache_sentinel")?(ee=t.jsx(wt,{size:14}),e[35]=ee):ee=e[35];let q;e[36]!==b||e[37]!==X?(q=t.jsxs(We,{variant:"destructive",disabled:X,onClick:b,children:[ee,"Delete"]}),e[36]=b,e[37]=X,e[38]=q):q=e[38];let K;e[39]!==ie||e[40]!==q?(K=t.jsxs(en,{align:"start",className:"w-36",children:[ie,Z,q]}),e[39]=ie,e[40]=q,e[41]=K):K=e[41];let I;e[42]!==se||e[43]!==K?(I=t.jsxs(Qt,{children:[se,K]}),e[42]=se,e[43]=K,e[44]=I):I=e[44];let te;return e[45]!==m||e[46]!==f||e[47]!==V||e[48]!==I||e[49]!==O?(te=t.jsxs("div",{ref:m,style:f,className:O,children:[V,I]}),e[45]=m,e[46]=f,e[47]=V,e[48]=I,e[49]=O,e[50]=te):te=e[50],te}function ci(i){return i.stopPropagation()}function ui(i){return i.stopPropagation()}function di(){return!1}function mi(i){const e=$e.c(13),{variant:s,decofile:r,meta:c,matchers:u}=i,p=c??void 0;let d;e[0]!==r||e[1]!==p||e[2]!==s.rule?(d=jt(s.rule,r,p),e[0]=r,e[1]=p,e[2]=s.rule,e[3]=d):d=e[3];const o=d;let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=we("inline-flex items-center gap-1.5 h-8 pl-3 pr-3 text-sm font-medium rounded-md shadow-lg ring-1 ring-border/60 cursor-grabbing",bs),e[4]=h):h=e[4];let x;e[5]!==o||e[6]!==u?(x=t.jsx(fn,{rule:o,matchers:u}),e[5]=o,e[6]=u,e[7]=x):x=e[7];let b;e[8]!==s.label?(b=t.jsx("span",{className:"truncate",children:s.label}),e[8]=s.label,e[9]=b):b=e[9];let j;return e[10]!==x||e[11]!==b?(j=t.jsxs("div",{className:h,children:[x,b]}),e[10]=x,e[11]=b,e[12]=j):j=e[12],j}function fi(i){const e=$e.c(77),{listKey:s,variants:r,activeIndex:c,decofile:u,meta:p,matchers:d,onSelect:o,onReorder:h,onRename:x,onDelete:b,onAdd:j}=i;let S;e[0]!==r?(S=()=>Yt(r),e[0]=r,e[1]=S):S=e[1];const[y,m]=D.useState(S),[k,v]=D.useState(null),[P,$]=D.useState(s),[R,f]=D.useState(r.length);let w;e[2]!==r?(w=()=>Zn(r),e[2]=r,e[3]=w):w=e[3];const[F,N]=D.useState(w),H=D.useRef(!1),C=Zn(r);P!==s?($(s),f(r.length),N(C),m(Yt(r))):R!==r.length?(f(r.length),N(C),m(Yt(r))):F!==C&&(N(C),m(le=>r.map((ye,z)=>({id:le[z]?.id??crypto.randomUUID(),index:z,variant:ye}))));let O;e[4]===Symbol.for("react.memo_cache_sentinel")?(O={activationConstraint:{distance:8}},e[4]=O):O=e[4];let M;e[5]===Symbol.for("react.memo_cache_sentinel")?(M={coordinateGetter:ln},e[5]=M):M=e[5];const L=tn(mt(sn,O),mt(nn,M));let V;e[6]!==y?(V=y.map(pi),e[6]=y,e[7]=V):V=e[7];const ge=V,ce=r.length>1;let J;e[8]!==y?(J=le=>{const ye=String(le.active.id);v(y.find(z=>z.id===ye)??null)},e[8]=y,e[9]=J):J=e[9];const ue=J;let se;e[10]!==ge||e[11]!==h?(se=le=>{v(null);const{active:ye,over:z}=le;if(!z||ye.id===z.id)return;const U=ge.indexOf(String(ye.id)),Y=ge.indexOf(String(z.id));U===-1||Y===-1||(m(Ie=>li(dt([...Ie],U,Y))),H.current=!0,requestAnimationFrame(()=>{H.current=!1}),h(U,Y))},e[10]=ge,e[11]=h,e[12]=se):se=e[12];const W=se;let ie;e[13]===Symbol.for("react.memo_cache_sentinel")?(ie=()=>{v(null)},e[13]=ie):ie=e[13];const Z=ie;let X,ee,q,K,I,te,fe,pe,de,ne,G,B;if(e[14]!==k||e[15]!==c||e[16]!==ce||e[17]!==u||e[18]!==y||e[19]!==ge||e[20]!==W||e[21]!==ue||e[22]!==d||e[23]!==p||e[24]!==b||e[25]!==x||e[26]!==o||e[27]!==L){const le=z=>{H.current||o(z)};G="flex items-center border-b shrink-0";const ye=k&&"cursor-grabbing";e[40]!==ye?(ne=we("flex flex-1 min-w-0 items-center gap-1.5 pl-3 pr-2 py-2 overflow-x-auto",ye),e[40]=ye,e[41]=ne):ne=e[41],ee=on,I=L,te=cn,fe=ue,pe=W,de=Z,X=un,B=ge,q=or,K=y.map(z=>t.jsx(oi,{sortableId:z.id,entry:z,isActive:z.index===c,canDelete:ce,decofile:u,meta:p,matchers:d,onSelect:()=>le(z.index),onRename:()=>x(z.index),onDelete:()=>b(z.index)},z.id)),e[14]=k,e[15]=c,e[16]=ce,e[17]=u,e[18]=y,e[19]=ge,e[20]=W,e[21]=ue,e[22]=d,e[23]=p,e[24]=b,e[25]=x,e[26]=o,e[27]=L,e[28]=X,e[29]=ee,e[30]=q,e[31]=K,e[32]=I,e[33]=te,e[34]=fe,e[35]=pe,e[36]=de,e[37]=ne,e[38]=G,e[39]=B}else X=e[28],ee=e[29],q=e[30],K=e[31],I=e[32],te=e[33],fe=e[34],pe=e[35],de=e[36],ne=e[37],G=e[38],B=e[39];let je;e[42]!==X||e[43]!==q||e[44]!==K||e[45]!==B?(je=t.jsx(X,{items:B,strategy:q,children:K}),e[42]=X,e[43]=q,e[44]=K,e[45]=B,e[46]=je):je=e[46];let ve;e[47]!==k||e[48]!==u||e[49]!==d||e[50]!==p?(ve=k?t.jsx(mi,{variant:k.variant,decofile:u,meta:p,matchers:d}):null,e[47]=k,e[48]=u,e[49]=d,e[50]=p,e[51]=ve):ve=e[51];let Ce;e[52]!==ve?(Ce=t.jsx(dn,{dropAnimation:null,children:ve}),e[52]=ve,e[53]=Ce):Ce=e[53];let xe;e[54]!==ee||e[55]!==I||e[56]!==te||e[57]!==fe||e[58]!==pe||e[59]!==de||e[60]!==je||e[61]!==Ce?(xe=t.jsxs(ee,{sensors:I,collisionDetection:te,onDragStart:fe,onDragEnd:pe,onDragCancel:de,children:[je,Ce]}),e[54]=ee,e[55]=I,e[56]=te,e[57]=fe,e[58]=pe,e[59]=de,e[60]=je,e[61]=Ce,e[62]=xe):xe=e[62];let Re;e[63]!==ne||e[64]!==xe?(Re=t.jsx("div",{className:ne,children:xe}),e[63]=ne,e[64]=xe,e[65]=Re):Re=e[65];let _e;e[66]===Symbol.for("react.memo_cache_sentinel")?(_e={color:ii},e[66]=_e):_e=e[66];let he;e[67]===Symbol.for("react.memo_cache_sentinel")?(he=t.jsx(kt,{size:14}),e[67]=he):he=e[67];let ae;e[68]!==j?(ae=t.jsx(qe,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-8 shrink-0 cursor-pointer",style:_e,onClick:j,children:he})}),e[68]=j,e[69]=ae):ae=e[69];let be;e[70]===Symbol.for("react.memo_cache_sentinel")?(be=t.jsx(Ye,{side:"bottom",children:"Add variant"}),e[70]=be):be=e[70];let Se;e[71]!==ae?(Se=t.jsx("div",{className:"shrink-0 pr-3 pl-1 py-2",children:t.jsxs(Ge,{children:[ae,be]})}),e[71]=ae,e[72]=Se):Se=e[72];let re;return e[73]!==G||e[74]!==Re||e[75]!==Se?(re=t.jsxs("div",{className:G,children:[Re,Se]}),e[73]=G,e[74]=Re,e[75]=Se,e[76]=re):re=e[76],re}function pi(i){return i.id}function hi(i){const e=$e.c(37),{open:s,onOpenChange:r,defaultBlockId:c,isPending:u,onSubmit:p}=i,d=c===void 0?"":c,o=u===void 0?!1:u,[h,x]=D.useState(d),[b,j]=D.useState(s);s!==b&&(j(s),s&&x(d));let S;e[0]!==o||e[1]!==r?(S=L=>{!L&&!o&&r(!1)},e[0]=o,e[1]=r,e[2]=S):S=e[2];const y=S;let m;e[3]!==h||e[4]!==o||e[5]!==p?(m=async L=>{L.preventDefault();const V=h.trim();!V||o||await p(V)},e[3]=h,e[4]=o,e[5]=p,e[6]=m):m=e[6];const k=m;let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsxs(as,{children:[t.jsx(ss,{children:"Save as global"}),t.jsx(rs,{children:"Save this section as a global block so it can be reused on other pages."})]}),e[7]=v):v=e[7];let P;e[8]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx("label",{htmlFor:"block-id",className:"text-sm font-medium",children:"Block name"}),e[8]=P):P=e[8];let $;e[9]===Symbol.for("react.memo_cache_sentinel")?($=L=>x(L.target.value),e[9]=$):$=e[9];let R;e[10]!==h||e[11]!==o?(R=t.jsxs("div",{className:"py-4 space-y-2",children:[P,t.jsx(cs,{id:"block-id",value:h,onChange:$,placeholder:"MyNewBlock",autoFocus:!0,disabled:o})]}),e[10]=h,e[11]=o,e[12]=R):R=e[12];let f;e[13]!==r?(f=()=>r(!1),e[13]=r,e[14]=f):f=e[14];let w;e[15]!==o||e[16]!==f?(w=t.jsx(Fe,{type:"button",variant:"outline",onClick:f,disabled:o,children:"Cancel"}),e[15]=o,e[16]=f,e[17]=w):w=e[17];let F;e[18]!==h||e[19]!==o?(F=!h.trim()||o,e[18]=h,e[19]=o,e[20]=F):F=e[20];let N;e[21]!==o?(N=o?t.jsxs(t.Fragment,{children:[t.jsx(Zt,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=o,e[22]=N):N=e[22];let H;e[23]!==F||e[24]!==N?(H=t.jsx(Fe,{type:"submit",disabled:F,children:N}),e[23]=F,e[24]=N,e[25]=H):H=e[25];let C;e[26]!==w||e[27]!==H?(C=t.jsxs(is,{children:[w,H]}),e[26]=w,e[27]=H,e[28]=C):C=e[28];let O;e[29]!==k||e[30]!==C||e[31]!==R?(O=t.jsx(ls,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:k,children:[v,R,C]})}),e[29]=k,e[30]=C,e[31]=R,e[32]=O):O=e[32];let M;return e[33]!==y||e[34]!==s||e[35]!==O?(M=t.jsx(os,{open:s,onOpenChange:y,children:O}),e[33]=y,e[34]=s,e[35]=O,e[36]=M):M=e[36],M}function Jn(i){const e=$e.c(21),{activeSchema:s,formValue:r,formResetKey:c,onFormChange:u,onBreadcrumbChange:p,breadcrumbPath:d,emptyMessage:o,beforeForm:h,seoResolveType:x,siteDefaultSeo:b,meta:j,decofile:S,onSaveReferencedBlock:y,sandbox:m}=i;let k;e[0]!==d?(k=d===void 0?[]:d,e[0]=d,e[1]=k):k=e[1];const v=k;let P;e[2]!==s||e[3]!==v||e[4]!==S||e[5]!==c||e[6]!==r||e[7]!==j||e[8]!==p||e[9]!==u||e[10]!==y||e[11]!==m||e[12]!==x||e[13]!==b?(P=s&&r?x?t.jsx(xr,{schema:s,resolveType:x,value:r,formResetKey:c,onChange:u,onBreadcrumbChange:p,siteDefaultSeo:b}):t.jsx(Gt,{schema:s,value:r,onChange:u,basePath:"",breadcrumbPath:v,onBreadcrumbChange:p,meta:j,decofile:S,onSaveReferencedBlock:y,sandbox:m},c):null,e[2]=s,e[3]=v,e[4]=S,e[5]=c,e[6]=r,e[7]=j,e[8]=p,e[9]=u,e[10]=y,e[11]=m,e[12]=x,e[13]=b,e[14]=P):P=e[14];const $=P;let R;e[15]!==o||e[16]!==$?(R=$??t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:o}),e[15]=o,e[16]=$,e[17]=R):R=e[17];let f;return e[18]!==h||e[19]!==R?(f=t.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:t.jsxs("div",{className:"mx-auto max-w-2xl",children:[h,R]})}),e[18]=h,e[19]=R,e[20]=f):f=e[20],f}const gi="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]",vi=i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase();function Qn(i){const{start:e,end:s}=i,r=typeof e=="string"?e:"",c=typeof s=="string"?s:"";if(!r&&!c)return null;const u=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"}),p=h=>{if(!h)return null;const x=new Date(h);return Number.isNaN(x.getTime())?null:u.format(x)},d=p(r),o=p(c);return d&&o?`${d} → ${o}`:d?`From ${d}`:o?`Until ${o}`:null}function st(i){if(!i)return"Default";const e=i.__resolveType??"";if(["website/matchers/always.ts","$live/matchers/MatchAlways.ts"].includes(e)||e==="")return"Default";switch(e){case"website/matchers/never.ts":return"Hidden";case"website/matchers/device.ts":case"$live/matchers/MatchDevice.ts":{const{mobile:r,tablet:c,desktop:u,devices:p=[]}=i,d=[...p];return r&&d.push("Mobile"),c&&d.push("Tablet"),u&&d.push("Desktop"),d.length>0?d.map(vi).join(" & "):nt(e)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return Qn(i)??nt(e);case"website/matchers/random.ts":case"$live/matchers/MatchRandom.ts":{const{traffic:r}=i;return typeof r=="number"?`${Math.ceil(r*100)}% of sessions`:nt(e)}case"website/matchers/host.ts":case"$live/matchers/MatchHost.ts":{const{includes:r,match:c}=i,u=[];return r&&u.push(r),c&&u.push(c),u.length>0?u.join(" - "):nt(e)}case"website/matchers/pathname.ts":{const r=i.case,{type:c,pathname:u}=r??{};return c&&u?`Pathname ${c} ${u}`:nt(e)}case"website/matchers/location.ts":case"$live/matchers/MatchLocation.ts":{const{includeLocations:r,excludeLocations:c}=i,u=o=>[o.city,o.regionCode,o.country].filter(Boolean).join(" - "),p=r?.[0];if(p){const o=(r?.length??0)-1;return`${u(p)}${o>0?` +${o}`:""}`}const d=c?.[0];if(d){const o=(c?.length??0)-1;return`Except ${u(d)}${o>0?` +${o}`:""}`}return"Any location"}case"website/matchers/multi.ts":case"$live/matchers/MatchMulti.ts":{const{matchers:r,op:c="AND"}=i;return r&&r.length>0?r.map(st).join(` ${c} `):nt(e)}default:{const r=Qn(i);return r||nt(e)||"Default"}}}function xi(i,e){return Pa(i,e,st)}function bi(i){const e=$e.c(13),{pageKey:s,initialName:r,initialPath:c,onFieldChange:u}=i,[p,d]=D.useState(r),[o,h]=D.useState(c),[x,b]=D.useState(s);x!==s&&(b(s),d(r),h(c));let j;e[0]!==u?(j=v=>{d(v.target.value),u("name",v.target.value)},e[0]=u,e[1]=j):j=e[1];let S;e[2]!==p||e[3]!==j?(S=t.jsx("input",{type:"text",value:p,onChange:j,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:"Page name"}),e[2]=p,e[3]=j,e[4]=S):S=e[4];let y;e[5]!==u?(y=v=>{h(v.target.value),u("path",v.target.value)},e[5]=u,e[6]=y):y=e[6];let m;e[7]!==o||e[8]!==y?(m=t.jsx("input",{type:"text",value:o,onChange:y,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:"/path"}),e[7]=o,e[8]=y,e[9]=m):m=e[9];let k;return e[10]!==S||e[11]!==m?(k=t.jsxs("div",{className:"space-y-1",children:[S,m]}),e[10]=S,e[11]=m,e[12]=k):k=e[12],k}function Xn(i){const e=$e.c(6),{onClick:s}=i;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(ns,{size:14}),e[0]=r):r=e[0];let c;e[1]!==s?(c=t.jsx(qe,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:r})}),e[1]=s,e[2]=c):c=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Ye,{side:"bottom",children:"Add variant"}),e[3]=u):u=e[3];let p;return e[4]!==c?(p=t.jsxs(Ge,{children:[c,u]}),e[4]=c,e[5]=p):p=e[5],p}function nc({orgSlug:i,virtualMcpId:e,branch:s,previewReady:r=!0,previewUrl:c,currentPath:u,activePageBlockKey:p=null,activeGlobalBlockKey:d=null,externalSelectedIndex:o,onSaved:h,initialEditSeo:x=!1,onExitSeo:b,onViewJsonFile:j,onVariantPreviewOverride:S}){const y=r?{orgSlug:i,virtualMcpId:e,branch:s,previewUrl:c}:null,{data:m,isLoading:k}=ya(y),{data:v,isLoading:P}=ja(y),$=_a(),R=$?.entity?.id===e?$.entity.metadata?.siteSlug??null:null,[f,w]=D.useState(null),[F,N]=D.useState(null),[H,C]=D.useState(null),[O,M]=D.useState(0),[L,V]=D.useState(void 0),[ge,ce]=D.useState(null),[J,ue]=D.useState(null),[se,W]=D.useState([]),[ie,Z]=D.useState(0),[X,ee]=D.useState(null),[q,K]=D.useState(null),[I,te]=D.useState(!0),[fe,pe]=D.useState(!1),[de,ne]=D.useState(!1),[G,B]=D.useState(x),[je,ve]=D.useState(x);x&&!je&&(ve(!0),B(!0),w(null),N(null),C(null),W([])),!x&&je&&ve(!1);const[Ce,xe]=D.useState(null),[Re,_e]=D.useState(void 0),[he,ae]=D.useState([]),[be,Se]=D.useState(0),[re,le]=D.useState(0),[ye,z]=D.useState(null),[U,Y]=D.useState(null),[Ie,He]=D.useState(null),Ze=ha(),Ss=`${i}/${e}/${s}`,Ct=ka({orgSlug:i,virtualMcpId:e,branch:s}),[ys,js]=D.useState(u),[_s,ks]=D.useState(p),[Ns,ws]=D.useState(d);(ys!==u||_s!==p||Ns!==d)&&(queueMicrotask(()=>Ct.flush()),js(u),ks(p),ws(d),w(null),N(null),C(null),M(0),ce(null),ue(null),le(0),z(null),Y(null),W([]),Z(n=>n+1),B(!1),xe(null),_e(void 0),ae([]),Se(n=>n+1));const Oe=Na({orgSlug:i,virtualMcpId:e,branch:s}),pn=Cr((n,a)=>{Oe.mutate({blockKey:n,data:a},{onSuccess:()=>h?.(),onError:l=>Ne.error(`Save failed: ${l.message}`)})}),hn=wa({orgSlug:i,virtualMcpId:e,branch:s}),[Dt,gn]=D.useState(!1),Rt=D.useRef(null),lt=D.useRef(null),ot=D.useRef(null),Tt=D.useRef({}),Je=D.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!r||k||P)return t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:t.jsx(Zt,{size:20,className:"animate-spin text-muted-foreground"})});if(!m||!v)return t.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Could not load site data."});const Cs=Ca(m),Te=!!d,Ke=Te?null:Da(Cs,u,p),T=Te?d:Ke?.key??null,At=Te&&d?m[d]:void 0,vn=Te&&d&&At?Ra(d,At):Te&&d?d:"",ht=!Te&&T&&m[T]?m[T]:null,Pt=G&&m&&v&&T&&Ke?In(m,{kind:"page",pageKey:T,pageName:String(Ke.name??""),path:String(Ke.path??"")},v):null,Ds=G?ht?.seo:void 0,Mt=Re!==void 0?Re:Ds,Rs=G?dr(Mt):void 0,Ts=Pt?.seoTypeOptions??[],As=G&&v?mr(v):"",xn=Ce??Rs??{},Vt=G&&Pt?fr(xn,Pt):null,Ps=G&&Vt&&pr(Mt)?bt(Vt,v):null,Ms=G?hr(m,v)?.seoData:void 0,Le=Te?[{label:"Default",sections:[{__resolveType:d}]}]:xi(ht?.sections,m??{}),gt=Le.length>1,Ve=Math.min(O,Le.length-1),at=Le[Ve],oe=at?.sections??[],Ee=St(oe,m),bn=!Te&&Ta(ht?.sections);if(Te&&d&&Ie!==d){He(d);const n=oe[0],a=Ee[0];if(n&&a){w(0),le(0),W([]);const l=it(n,a,m);l&&(N(l.data),C(l.resolveType),Y(null),z(null))}}!Te&&Ie!==null&&He(null),Je.current={rawSections:oe,parsedSections:Ee,decofile:m??{},activePageKey:T,pageVariants:Le,variantIndex:Ve,sectionVariantIndex:re,selectedSectionIndex:f};const Vs=()=>({multivariate:bn,index:Ve,variants:Le.map(n=>({rule:n.rule}))}),Sn=(n,a)=>{if(!S)return;if(!T||!bn||n.length<=1){S(null);return}const l=Fn(T,{multivariate:!0,index:a,variants:n},m,v);S(l.length>0?l:null)},ct=(n,a,l)=>{if(!S)return;if(!T){S(null);return}const g=Vs(),_=Fn(T,g,m,v);if(!n||a<0){S(_.length>0?_:null);return}const E=Ya({pageKey:T,page:g,sectionIndex:a,sectionLazy:Ee[a]?.isLazy??!1,mvObj:n,selectedVariantIndex:l,decofile:m,meta:v}),A=[..._,...E];S(A.length>0?A:null)},Qe=(n,a,l,g=f??-1,_=!1)=>{const E=tt(n,a);if(!E){N(null),C(null),Y(null),z(null),_&&ct(null,g,l);return}const Q=Ln(E,st)[l];if(!Q){N(null),C(null),Y(null),z(null),_&&ct(null,g,l);return}const De=Ma(Q.value,m);N(De?.data??null),C(De?.resolveType??null);const{resolveType:me,formValue:ke}=Kt(Q.rule,m,v??void 0);Y(me),z(ke),_&&ct(E,g,l)};if(o!==void 0&&o!==L&&(V(o??null),typeof o=="number")){const n=oe[o],a=Ee[o];if(n&&a)if(w(o),le(0),W([]),Z(l=>l+1),a.isMultivariate)Qe(n,a,0,o);else{const l=it(n,a,m);l?(N(l.data),C(l.resolveType)):(N(null),C(null)),Y(null),z(null)}}const yn={orgSlug:i,virtualMcpId:e,branch:s,previewUrl:c??void 0,siteSlug:R},Et=H&&v?bt(H,v):null,Be=(n,a)=>{if(!T)return;const l=Ut(m,T,n,Ve,Le);Oe.mutate({blockKey:T,data:l},{onSuccess:()=>a?.onSuccess?.()??h?.(),onError:g=>Ne.error(`Save failed: ${g.message}`)})},ut=()=>{w(null),N(null),C(null),le(0),z(null),Y(null),W([]),Z(n=>n+1)},Es=(n,a)=>{Rt.current&&clearTimeout(Rt.current);const l=Je.current.sectionVariantIndex;Rt.current=setTimeout(()=>{const{rawSections:g,parsedSections:_,decofile:E,activePageKey:A,pageVariants:Q,variantIndex:De}=Je.current,me=g[a];if(!me)return;const ke=_[a];if(!ke)return;if(ke.isSavedBlock){const Pe=ke.isLazy?me.section?.__resolveType??me.__resolveType:me.__resolveType;Oe.mutate({blockKey:Pe,data:n},{onSuccess:()=>h?.(),onError:Me=>Ne.error(`Save failed: ${Me.message}`)});return}if(!A)return;const Ae={...E[A]},ze=[...g];if(ke.isMultivariate){const Pe=tt(me,ke);if(!Pe||!A)return;const Me=Ja(Pe,l,n);ze[a]=pt(me,ke,Me)}else if(ke.isHidden){const Pe=es(me.__resolveType),Me=Pe?{...me.section}:{...me},Ue=Array.isArray(Me.variants)?[...Me.variants]:[];Ue[0]&&(Ue[0]={...Ue[0],value:n}),Me.variants=Ue,Pe?ze[a]={...me,section:Me}:ze[a]=Me}else ke.isLazy?ze[a]={...me,section:n}:ze[a]=n;if(Q.length>1){const Pe=Ae.sections,Me=[...Pe?.variants??[]];Me[De]&&(Me[De]={...Me[De],value:ze}),Ae.sections={...Pe,variants:Me}}else Ae.sections=ze;Oe.mutate({blockKey:A,data:Ae},{onSuccess:()=>h?.(),onError:Pe=>Ne.error(`Save failed: ${Pe.message}`)})},Ht)},$s=n=>{w(n),le(0),W([]),Z(_=>_+1);const a=oe[n],l=Ee[n];if(!a||!l)return;if(l.isMultivariate){Qe(a,l,0,n);return}const g=it(a,l,m);if(!g){N(null),C(null),Y(null),z(null),ct(null,n,0);return}N(g.data),C(g.resolveType),Y(null),z(null),ct(null,n,0)},jn=n=>{const a=n;N(a),f!==null&&Es(a,f)},$t=n=>{if(!T||!m||!v||!Ke)return;const a={kind:"page",pageKey:T,pageName:String(Ke.name??""),path:String(Ke.path??"")},l=In(m,a,v);l&&Ct.save(T,()=>{const g=Ze.getQueryData(ga.decofile(Ss))?.[T];if(!g||typeof g!="object"||g===null||Array.isArray(g))return null;const _={...g,...Tt.current};return Tt.current={},n?.raw!==void 0?{..._,seo:n.raw}:n?.inner!==void 0?vr(a,l,_,n.inner):_})},Os=(n,a)=>{T&&(Tt.current[n]=a,$t())},Ls=(n,a)=>{if(!T)return;const l=dt([...oe],n,a);f!==null&&(f===n?w(a):n<f&&a>=f?w(f-1):n>f&&a<=f&&w(f+1)),Be(l)},zs=n=>{if(!T)return;const a=oe.filter((l,g)=>g!==n);f===n?ut():f!==null&&f>n&&w(f-1),Be(a)},Fs=n=>{if(!T)return;const a=oe[n];if(!a)return;const l=[...oe];l.splice(n+1,0,Rr(a)),f!==null&&f>n&&w(f+1),Be(l)},Ks=n=>{if(!T)return;const a=oe[n],l=Ee[n];if(!a||!l||l.isMultivariate)return;const g=l.isHidden?Ba(a):Ha(a);if(!g)return;const _=[...oe];_[n]=g,f===n&&ut(),Be(_)},Is=n=>{if(!T)return;const a=oe[n],l=Ee[n];if(!a||!l||l.isMultivariate)return;const g=Ia(a);if(!g)return;const _=[...oe];_[n]=g,f===n&&ut(),Be(_)},Bs=n=>{if(!T)return;const a=oe[n],l=Ee[n];if(!a||!l?.isSavedBlock)return;const g=it(a,l,m);if(!g?.data)return;const{name:_,...E}=g.data,A=[...oe];l.isLazy?A[n]={...a,section:E}:A[n]=E,f===n&&ut(),Be(A)},Hs=n=>{if(!T)return;const a=[...oe,{__resolveType:n.resolveType}],l=a.length-1;Be(a,{onSuccess:()=>{pe(!1),w(l),le(0),W([]),Z(A=>A+1);const g=a[l],_=St(a,m)[l];if(!g||!_)return;if(_.isMultivariate){Qe(g,_,0);return}const E=it(g,_,m);if(!E){N(null),C(null),Y(null),z(null);return}N(E.data),C(E.resolveType),Y(null),z(null)}})},Us=n=>{if(f===null)return;const a=oe[f],l=Ee[f];!a||!l?.isMultivariate||(le(n),W([]),Z(g=>g+1),Qe(a,l,n,f,!0))},Ws=n=>{if(f===null||!T)return;const a=oe[f],l=Ee[f];if(!a||!l?.isMultivariate)return;const g=tt(a,l);if(!g)return;const _=Fa(g,n);if(!_){Ne.error("Cannot delete the only variant.");return}const E=[...oe];E[f]=pt(a,l,_);const A=_.variants;let Q=re;n===re?Q=Math.min(n,A.length-1):n<re&&(Q=re-1),le(Q),W([]),Z(De=>De+1),Qe(E[f],l,Q),Be(E)},qs=n=>{if(f===null||!T)return;const a=oe[f],l=Ee[f];if(!a||!l?.isMultivariate)return;const g=tt(a,l);if(!g)return;const _=Ka(g,n),E=[...oe];E[f]=pt(a,l,_);const A=n+1;le(A),W([]),Z(Q=>Q+1),Qe(E[f],l,A),Be(E)},Ys=(n,a)=>{if(f===null||!T||n===a)return;const l=oe[f],g=Ee[f];if(!l||!g?.isMultivariate)return;const _=tt(l,g);if(!_)return;const E=La(_,n,a),A=[...oe];A[f]=pt(l,g,E);let Q=re;re===n?Q=a:n<re&&a>=re?Q=re-1:n>re&&a<=re&&(Q=re+1),le(Q),Qe(A[f],g,Q),Be(A)},Ot=n=>{const a=n??f;if(a===null||!T)return;const l=oe[a],g=Ee[a];if(!l||!g)return;const _=Va(l,g);if(!_){Ne.error("This section cannot have variants.");return}const E=[...oe];E[a]=_.section;const A=St(E,m)[a];if(!A?.isMultivariate){Ne.error("Could not add variant.");return}w(a),le(_.newVariantIndex),W([]),Z(Q=>Q+1),Qe(_.section,A,_.newVariantIndex,a),Be(E)},Gs=()=>{if(f===null||!T)return;const n=oe[f],a=Ee[f];if(!n||!a?.isMultivariate)return;const l=tt(n,a);if(!l)return;const g=za(n,a,l);if(!g){Ne.error("Could not remove variants.");return}const _=[...oe];_[f]=g;const E=St(_,m)[f];if(!E)return;le(0),Y(null),z(null),W([]),Z(Q=>Q+1);const A=it(g,E,m);A?(N(A.data),C(A.resolveType)):(N(null),C(null)),ct(null,f,0),Be(_)},Zs=async n=>{if(X===null||!T)return;const a=Un(n,m);if(a){Ne.error(a);return}const l=oe[X],g=Ee[X];if(!l||!g)return;const _=it(l,g,m);if(!_){Ne.error("This section cannot be saved as global.");return}const E={..._.data,name:n};try{await Oe.mutateAsync({blockKey:n,data:E});const A=[...oe];A[X]={__resolveType:n},await Oe.mutateAsync({blockKey:T,data:Ut(m,T,A,Ve,Le)}),f===X&&ut(),ee(null),Ne.success(`Saved global block "${n}"`),h?.()}catch(A){Ne.error(A instanceof Error?A.message:"Failed to save global block")}},_n=at?.rule;if(gt&&f===null&&J===null&&_n){const{resolveType:n,formValue:a}=Kt(_n,m??{},v??void 0);ue(n),ce(a)}const vt=v?ai(v):[],Js=!Te&&!!(c&&v&&m),kn=J&&v?bt(J,v):null,Qs=()=>{lt.current&&(clearTimeout(lt.current),lt.current=null),ot.current&&(clearTimeout(ot.current),ot.current=null)},Nn=async(n,a)=>{if(!(Qa(a,n,v)>0))try{await hn.mutateAsync({blockKey:n})}catch(l){Ne.error(l instanceof Error?l.message:"Could not delete matcher block")}},wn=n=>{lt.current&&clearTimeout(lt.current),lt.current=setTimeout(()=>{const{activePageKey:a,decofile:l,variantIndex:g}=Je.current;if(!a)return;const _={...l[a]},E={..._.sections},A=[...E.variants??[]],Q=A[g],De=Q?.rule;if(It(De,l,v)){const me=De?.__resolveType??"",ke=l[me],Ae=typeof ke?.name=="string"?ke.name:me,{__resolveType:ze,...Pe}=n;Oe.mutate({blockKey:me,data:Bt(ze??"",Pe,Ae)},{onSuccess:()=>h?.(),onError:Me=>Ne.error(`Save failed: ${Me.message}`)});return}Q&&(A[g]={...Q,rule:n}),_.sections={...E,variants:A},Oe.mutate({blockKey:a,data:_},{onSuccess:()=>h?.(),onError:me=>Ne.error(`Save failed: ${me.message}`)})},Ht)},Xs=n=>{ue(n);const a=n?{__resolveType:n}:{__resolveType:Kn};ce({}),wn(a)},ea=n=>{const a=n;ce(a);const l=J?{__resolveType:J,...a}:{...a};wn(l)},Cn=n=>{ot.current&&clearTimeout(ot.current);const{selectedSectionIndex:a,sectionVariantIndex:l}=Je.current;a!==null&&(ot.current=setTimeout(()=>{const{rawSections:g,parsedSections:_,decofile:E,activePageKey:A,pageVariants:Q,variantIndex:De}=Je.current;if(!A)return;const me=g[a],ke=_[a];if(!me||!ke?.isMultivariate)return;const Ae=tt(me,ke);if(!Ae)return;const ze=Za(Ae,l,n),Pe=[...g];Pe[a]=pt(me,ke,ze);const Me=Ut(E,A,Pe,De,Q);Oe.mutate({blockKey:A,data:Me},{onSuccess:()=>h?.(),onError:Ue=>Ne.error(`Save failed: ${Ue.message}`)})},Ht))},ta=n=>{Y(n),z({}),Cn(n?{__resolveType:n}:{__resolveType:Kn})},na=n=>{const a=n;z(a);const l=U?{__resolveType:U,...a}:{...a};Cn(l)};if(!Te&&!Ke)return t.jsxs("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:["No page found for ",u]});if(Te&&!At)return t.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Global block not found"});const Xe=f!==null?Ee[f]??null:null,Dn=f!==null?oe[f]:null,Rn=Dn&&Xe?.isMultivariate?tt(Dn,Xe):null,xt=Rn?Ln(Rn,st):[],Tn=Math.min(re,Math.max(xt.length-1,0)),Lt=xt[Tn]??null,rt=Xe?.isMultivariate===!0,An=f!==null&&Xe!==null,ft=An&&(rt||!!(Et&&F)),sa=ft&&!Te&&Xe?.isSavedBlock===!0,et=Te||sa,aa=Te?vn:Xe?.label??"",Pn=U&&v?bt(U,v):null,zt=ft&&(!Te||se.length>0)?Te?[vn,...se]:[Ke.name,Xe.label,...rt&&Lt?[Lt.label]:[],...se]:[],ra=G&&Ke?[Ke.name,"SEO",...he]:[],Mn=G?ra:et?zt.length>0?zt:[aa]:zt,Vn=()=>{if(!T)return;const n=m[T],a=Ea(n.sections,oe);if(!a)return;const l=$a(a);Oe.mutate({blockKey:T,data:{...n,sections:a}},{onSuccess:()=>{M(l),w(null),N(null),C(null),W([]),ce(null),ue(null)},onError:g=>Ne.error(`Save failed: ${g.message}`)})},En=(n,a,l)=>{if(!T)return;const g=m[T],_=g.sections;if(!_||typeof _!="object"||Array.isArray(_))return;const E=_;if(!Array.isArray(E.variants))return;const A=n([...E.variants]);if(!A)return;const Q=Ga(E,A),De={...m,[T]:{...g,sections:Q}};Oe.mutate({blockKey:T,data:De[T]},{onSuccess:()=>{a?.(),l&&Nn(l,De)},onError:me=>Ne.error(`Save failed: ${me.message}`)})},ia=n=>{K(null),M(n),w(null),N(null),C(null),W([]);const a=Le[n]?.rule,{resolveType:l,formValue:g}=Kt(a,m??{},v??void 0);ue(l),ce(g),Sn(Le.map(_=>({rule:_.rule})),n)},la=(n,a)=>{if(n===a)return;let l=Ve;Ve===n?l=a:n<Ve&&a>=Ve?l=Ve-1:n>Ve&&a<=Ve&&(l=Ve+1),M(l);const g=dt(Le.map(_=>({rule:_.rule})),n,a);Sn(g,l),En(_=>dt(_,n,a))},oa=n=>{const a=Le[n]?.rule,l=Oa(a,m??{},v??void 0);En(g=>g.length<=1?null:(g.splice(n,1),g),()=>{Le.length-1===1?M(0):n<Ve?M(Ve-1):n===Ve&&M(Math.max(0,n-1)),w(null),N(null),C(null),W([]),ce(null),ue(null)},l)},ca=async(n,a)=>{Qs();const l=Je.current.activePageKey,g=Je.current.decofile;if(!l)return;const _=g[l],E=_.sections;if(!E||typeof E!="object"||Array.isArray(E))return;const A=E;if(!Array.isArray(A.variants))return;const Q=[...A.variants],De=Q[n];if(!De?.rule||typeof De.rule!="object"){Ne.error("This variant has no matcher rule to rename.");return}const me=De.rule,ke=a.trim();gn(!0);try{if(!ke){if(!It(me,g,v)){K(null);return}const Ft=me.__resolveType??"";Q[n]={...De,rule:Ua(me,g,v)};const On={...g,[l]:{..._,sections:{...A,variants:Q}}};await Oe.mutateAsync({blockKey:l,data:On[l]}),await Nn(Ft,On),K(null),h?.();return}const Ae=Wa(me,g,v);if(!Ae){Ne.error("Could not read this variant's matcher rule.");return}if(Ae.blockKey){await Oe.mutateAsync({blockKey:Ae.blockKey,data:Bt(Ae.resolveType,Ae.data,ke)}),K(null),h?.();return}const ze=Hn(ke),Pe=Un(ze,g);if(Pe){Ne.error(Pe);return}const Me=Bt(Ae.resolveType,Ae.data,ke);let Ue=null;try{await Oe.mutateAsync({blockKey:ze,data:Me}),Ue=ze,Q[n]={...De,rule:qa(ze)},await Oe.mutateAsync({blockKey:l,data:{..._,sections:{...A,variants:Q}}}),Ue=null}catch(Ft){throw Ue&&await hn.mutateAsync({blockKey:Ue}).catch(()=>{}),Ft}K(null),Ne.success(`Saved matcher as global block "${ke}"`),h?.()}catch(Ae){Ne.error(Ae instanceof Error?Ae.message:"Failed to rename variant")}finally{gn(!1)}},$n=()=>{ut()},ua=n=>{xe(n),$t({inner:n})},da=n=>{_e(n),$t({raw:n})},ma=()=>{xe(null),ae([])},fa=()=>Se(n=>n+1),pa=n=>{if(G){if(n===0){Ct.flush(),B(!1),xe(null),_e(void 0),ae([]),Se(l=>l+1),b?.();return}if(n===1){ae([]),Se(l=>l+1);return}ae(he.slice(0,n-1)),Se(l=>l+1);return}if(Te){W(se.slice(0,n)),Z(l=>l+1);return}if(n===0){$n();return}if(n===1){W([]),Z(l=>l+1);return}if(rt&&n===2){W([]),Z(l=>l+1);return}const a=rt?2:1;W(se.slice(0,n-a))};return t.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[t.jsx("div",{className:"shrink-0",children:et||ft||G?t.jsxs("div",{className:we("border-b px-3 py-2.5",et&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!Te&>&&at&&t.jsxs("button",{type:"button",onClick:$n,title:`Editing in variant: ${at.label}`,className:we("shrink-0 inline-flex items-center gap-1 rounded-md h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",gi),children:[t.jsx(fn,{rule:jt(at.rule,m??{},v??void 0),matchers:vt}),t.jsx("span",{className:"max-w-[160px] truncate",children:at.label})]}),t.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:Mn.map((n,a)=>{const l=a===Mn.length-1;return t.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[a>0&&t.jsx(Xa,{className:"size-3 shrink-0 text-muted-foreground/60"}),t.jsx("button",{type:"button",onClick:()=>pa(a),title:n,className:we("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",l?et?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":et?"text-foreground/80":"text-muted-foreground",et?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:n})]},`${n}-${a}`)})}),et&&t.jsxs(Ge,{children:[t.jsx(qe,{asChild:!0,children:t.jsx("span",{className:"shrink-0 cursor-help",children:t.jsx(sr,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),t.jsx(Ye,{side:"bottom",className:"max-w-[260px]",children:"A global section is a reusable block shared across your site. Editing it here updates it everywhere it's used."})]}),An&&!rt&&!Xe?.isHidden&&T&&t.jsx(Xn,{onClick:()=>Ot()})]}),et&&t.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:"This is a global section. Changes apply everywhere this section is used across your site."})]}):t.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(bi,{pageKey:T,initialName:Ke.name,initialPath:Ke.path,onFieldChange:Os})}),t.jsxs(Ge,{children:[t.jsx(qe,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Edit SEO",className:"size-7 shrink-0",onClick:()=>B(!0),children:t.jsx(tr,{size:14})})}),t.jsx(Ye,{side:"bottom",children:"Edit SEO"})]}),t.jsxs(Ge,{children:[t.jsx(qe,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"View JSON",className:"size-7 shrink-0",onClick:()=>j&&T?j(T):ne(!0),children:t.jsx(nr,{size:14})})}),t.jsx(Ye,{side:"bottom",children:"View JSON"})]}),t.jsx(Xn,{onClick:Vn})]})}),gt&&!ft&&!G&&T&&t.jsx(fi,{listKey:T,variants:Le,activeIndex:Ve,decofile:m??{},meta:v,matchers:vt,onSelect:ia,onReorder:la,onRename:K,onDelete:oa,onAdd:Vn}),G?t.jsx(yt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:t.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:t.jsx("div",{className:"mx-auto max-w-2xl",children:ht&&T?t.jsx(gr,{rawSeo:Mt,innerSeo:xn,defaultResolveType:As,seoSchema:Ps,activeResolveType:Vt,seoTypeOptions:Ts,formResetKey:be,siteDefaultSeo:Ms,onBreadcrumbChange:ae,onPersistRaw:da,onInnerChange:ua,onClearForm:ma,onBumpFormKey:fa}):t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"SEO schema not found for this site."})})})}):ft?t.jsxs(yt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[rt&&xt.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(zr,{listKey:`${T??""}:${f??""}`,variants:xt.map((n,a)=>({index:a,label:n.label})),selectedIndex:Tn,onSelect:Us,onDuplicate:qs,onDelete:Ws,onRemoveAll:Gs,onReorder:Ys,onAdd:()=>Ot()}),rt&&t.jsxs("div",{className:"px-3 py-3 border-b space-y-2",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),t.jsx(Gn,{currentRt:U??"",currentLabel:st(Lt?.rule),matchers:vt,onSelect:ta}),Pn&&ye&&t.jsx("div",{className:"pt-1",children:t.jsx(Gt,{schema:Pn,value:ye,onChange:na,basePath:""})})]})]}),t.jsx(Jn,{activeSchema:Et,formValue:F,formResetKey:ie,onFormChange:jn,onBreadcrumbChange:W,breadcrumbPath:se,emptyMessage:"No editable fields for this variant.",meta:v,decofile:m,onSaveReferencedBlock:pn,sandbox:yn})]}):Te?t.jsx(yt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:t.jsx(Jn,{activeSchema:Et,formValue:F,formResetKey:ie,onFormChange:jn,onBreadcrumbChange:W,breadcrumbPath:se,emptyMessage:"No editable fields for this global block.",meta:v,decofile:m,onSaveReferencedBlock:pn,sandbox:yn})}):t.jsxs(yt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[gt&&J!==null&&t.jsxs("div",{className:we("px-3 border-b",I?"pt-3 pb-5 space-y-3":"py-2"),children:[t.jsxs("button",{type:"button",onClick:()=>te(n=>!n),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-sm py-0.5 hover:bg-muted/40","aria-expanded":I,children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),I?t.jsx(er,{className:"size-3.5 shrink-0 text-muted-foreground"}):t.jsx(ts,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),I&&t.jsxs("div",{className:we("space-y-3",Dt&&"pointer-events-none opacity-50"),children:[t.jsx(Gn,{currentRt:J,currentLabel:zn(at?.rule,m??{},st,v??void 0),matchers:vt,onSelect:Xs}),kn&&ge&&t.jsx("div",{className:"space-y-3",children:t.jsx(Gt,{schema:kn,value:ge,onChange:ea,basePath:""})})]})]}),t.jsx("div",{className:"p-2 pt-3",children:t.jsx(Xr,{listKey:`${T??""}-${Ve}`,rawSections:oe,sections:Ee,meta:v,selectedIndex:f,onSelect:$s,onReorder:Ls,onDelete:zs,onDuplicate:Fs,onMakeReusable:ee,onToggleHidden:Ks,onToggleLazy:Is,onAddVariant:Ot,onDetach:Bs,onAddSection:()=>pe(!0),canAddSection:Js})})]}),t.jsx(hi,{open:X!==null,onOpenChange:n=>{n||ee(null)},defaultBlockId:X!==null?Hn(Ee[X]?.label??""):"",isPending:Oe.isPending,onSubmit:Zs}),c&&t.jsx(wr,{open:fe,onOpenChange:pe,meta:v,decofile:m,previewBaseUrl:c,onSelect:Hs}),de&&T&&m&&t.jsx(Aa,{open:de,onOpenChange:ne,pageKey:T,decofile:m}),q!==null&&t.jsx(Dr,{open:!0,initialName:It(Le[q]?.rule,m??{},v??void 0)?zn(Le[q]?.rule,m??{},st,v??void 0):"",autoLabel:st(jt(Le[q]?.rule,m??{},v??void 0)),isPending:Dt,onSubmit:async n=>{await ca(q,n)},onOpenChange:n=>{!n&&!Dt&&K(null)}})]})}export{nc as SectionsEditor};
|