decocms 3.103.2 → 3.103.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-B7YwjVuv.js → AlertCircle-BJzQ1lVJ.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-DvElag-V.js → ArrowUpRight-CA22UP6Q.js} +1 -1
- package/dist/client/assets/{CheckCircle-DIxU9fNb.js → CheckCircle-p5tYLXMg.js} +1 -1
- package/dist/client/assets/{ChevronDown-D7t2IbgZ.js → ChevronDown-DM7Zg7z0.js} +1 -1
- package/dist/client/assets/{ChevronLeft-DnVztwcc.js → ChevronLeft-lcwdftXp.js} +1 -1
- package/dist/client/assets/{ChevronRight-Cw6r4eF5.js → ChevronRight-CKc4NZet.js} +1 -1
- package/dist/client/assets/{ChevronUp-DrHOs0IB.js → ChevronUp-uk87fvlM.js} +1 -1
- package/dist/client/assets/{DotsVertical-p5cw6bzY.js → DotsVertical-DXDm8Xzs.js} +1 -1
- package/dist/client/assets/{Eye-CPb9WDyf.js → Eye-BHPT57Tm.js} +1 -1
- package/dist/client/assets/{FilterLines-2uX2Gf4U.js → FilterLines-HsRbW4y-.js} +1 -1
- package/dist/client/assets/{Globe01-D51Pf1ib.js → Globe01-DD63JJzL.js} +1 -1
- package/dist/client/assets/{Globe04-8CmI5zRW.js → Globe04-CokcJjWp.js} +1 -1
- package/dist/client/assets/{HardDrive-fBNuw9RE.js → HardDrive-xu95HLc0.js} +1 -1
- package/dist/client/assets/{Key01-B-V8oh6M.js → Key01-V7SPr6j-.js} +1 -1
- package/dist/client/assets/{LayoutLeft-B7KWV4nT.js → LayoutLeft-y1fOcQ0I.js} +1 -1
- package/dist/client/assets/{LinkExternal01-Cd3gNz9H.js → LinkExternal01-DCed5R2c.js} +1 -1
- package/dist/client/assets/{Monitor01-BzxQo8OV.js → Monitor01-BKqFs8Gp.js} +1 -1
- package/dist/client/assets/{Palette-TV4PomkE.js → Palette-DkcZCW1n.js} +1 -1
- package/dist/client/assets/{Play-B9WHtGRe.js → Play-CKPBuURg.js} +1 -1
- package/dist/client/assets/{Plus-DrCr8atg.js → Plus-Bi8BbQwT.js} +1 -1
- package/dist/client/assets/{SearchLg-C45t9PQZ.js → SearchLg-D0nJXyNY.js} +1 -1
- package/dist/client/assets/{SearchMd-C5JuA4Q_.js → SearchMd-BkXN-Kzx.js} +1 -1
- package/dist/client/assets/{Settings02-CWsiKyfu.js → Settings02-C-qi4-Q_.js} +1 -1
- package/dist/client/assets/{Shield01-BP8Krja8.js → Shield01-BaBnwolv.js} +1 -1
- package/dist/client/assets/{Star01-BvLdWUOq.js → Star01-D2l7-L0I.js} +1 -1
- package/dist/client/assets/{Stars01-ledCttL2.js → Stars01-CBpnmt-0.js} +1 -1
- package/dist/client/assets/{Stars02-CZ3C1sQr.js → Stars02-DC4cG_dc.js} +1 -1
- package/dist/client/assets/{Sun-DPnjEA61.js → Sun-ubimVQVz.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-fTq_Xj_0.js → SwitchHorizontal01-DkcNGyLK.js} +1 -1
- package/dist/client/assets/{Tool01-MvyjXDCb.js → Tool01-D4LA61If.js} +1 -1
- package/dist/client/assets/{Trash01-C3HJx9Eu.js → Trash01-CbqEHpx0.js} +1 -1
- package/dist/client/assets/{Upload01-DvSZDpgm.js → Upload01-C_kFf8l0.js} +1 -1
- package/dist/client/assets/{User01-TldGh0YP.js → User01-Cykpl4hh.js} +1 -1
- package/dist/client/assets/{Users01-B63UEiqj.js → Users01-fhFCwrP8.js} +1 -1
- package/dist/client/assets/{Users03-BiIAwLFR.js → Users03-BkBCkWQn.js} +1 -1
- package/dist/client/assets/{X-D1lT84o6.js → X-DEdLuuqP.js} +1 -1
- package/dist/client/assets/{XCircle-B1aV7AX3.js → XCircle-IAOWYKKA.js} +1 -1
- package/dist/client/assets/{XClose-9xeu7JIP.js → XClose-ChjX78ei.js} +1 -1
- package/dist/client/assets/{Zap-C8z5Nmtq.js → Zap-DE8YfoLa.js} +1 -1
- package/dist/client/assets/{ZapSquare-C-BUl6mg.js → ZapSquare-hkjSQWO8.js} +1 -1
- package/dist/client/assets/{ZoomOut-DnuKetHD.js → ZoomOut-DoQt1wdd.js} +1 -1
- package/dist/client/assets/{access-gate-BY3tN2ja.js → access-gate-C9EgwKjC.js} +1 -1
- package/dist/client/assets/{add-section-modal-B07Xr2Kn.js → add-section-modal-uGR2Gjzo.js} +1 -1
- package/dist/client/assets/{agent-icon-SFzfjqT3.js → agent-icon-C1dYfmgT.js} +1 -1
- package/dist/client/assets/agents-list-BYujSwxP.js +1 -0
- package/dist/client/assets/{ai-providers-CKzZgnvl.js → ai-providers-BNI68B_k.js} +1 -1
- package/dist/client/assets/{alert-Xi4tmGdJ.js → alert-D_TmabeW.js} +1 -1
- package/dist/client/assets/{alert-dialog-Dv-S36Xs.js → alert-dialog-DZvgeli3.js} +1 -1
- package/dist/client/assets/{app-editor-DkeeVFb9.js → app-editor-CzvUrXdA.js} +1 -1
- package/dist/client/assets/{auth-B9AdzGWs.js → auth-CPEoqZ5f.js} +1 -1
- package/dist/client/assets/{auth-catchall-0TYVm2fW.js → auth-catchall-B0YsSe8e.js} +1 -1
- package/dist/client/assets/{auth-entry-DnJxnsQa.js → auth-entry-BNBDxAD5.js} +1 -1
- package/dist/client/assets/{auth-split-layout-CRM5rJ4I.js → auth-split-layout-TVpnUfp8.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-CWwDFJ5t.js → authenticate-and-persist-oauth-BgoQZkYE.js} +1 -1
- package/dist/client/assets/{automation-list-row-CsaQkLKW.js → automation-list-row-Bic_MYAx.js} +1 -1
- package/dist/client/assets/{automation-runs-B7uMDF25.js → automation-runs-B_ZKhNSO.js} +1 -1
- package/dist/client/assets/automations-B-nS9KAc.js +1 -0
- package/dist/client/assets/{avatar-CdYywjB8.js → avatar-VZM5i0Ki.js} +1 -1
- package/dist/client/assets/{badge-Dxlv54DZ.js → badge-BGbD2JMR.js} +1 -1
- package/dist/client/assets/{block-document-DmBsan0A.js → block-document-alsZITys.js} +1 -1
- package/dist/client/assets/{brand-context-BXcXRl5I.js → brand-context-DSNeUFQk.js} +1 -1
- package/dist/client/assets/{buckets-bgNzTmcE.js → buckets-htbDyfKS.js} +1 -1
- package/dist/client/assets/{capability-load-error-CFxZVJfo.js → capability-load-error-7-bUVJZE.js} +1 -1
- package/dist/client/assets/{card-Dt5JuJj0.js → card-DjLKG66H.js} +1 -1
- package/dist/client/assets/{category-editor-4VhAzI64.js → category-editor-DlDVDfZO.js} +1 -1
- package/dist/client/assets/{chat-context-rSGx0F1S.js → chat-context-DJ9kQ1Gu.js} +5 -5
- package/dist/client/assets/{checkbox-D5qKxHwE.js → checkbox-CHfAThPE.js} +1 -1
- package/dist/client/assets/{cli-auth-success-fK-z6B11.js → cli-auth-success-C0Rp_k77.js} +1 -1
- package/dist/client/assets/{collection-detail-CKsULKt8.js → collection-detail-WRW5wTM9.js} +1 -1
- package/dist/client/assets/{collection-display-button-D1GAS3K4.js → collection-display-button-V-CSOAM6.js} +1 -1
- package/dist/client/assets/{collection-search-Yx1Vcd74.js → collection-search-C4TcbQ-p.js} +1 -1
- package/dist/client/assets/{collection-tabs-DEvCjzY2.js → collection-tabs-CA6SI6KD.js} +1 -1
- package/dist/client/assets/{command--DrDkfnb.js → command-CZZOMfiA.js} +1 -1
- package/dist/client/assets/commerce-onboarding-B618DbMl.js +1 -0
- package/dist/client/assets/{connect-desktop-dialog-Ny2ddpDi.js → connect-desktop-dialog-C7OzpQot.js} +1 -1
- package/dist/client/assets/{connection-card-DGJrNSMY.js → connection-card-CFZ9gVcC.js} +1 -1
- package/dist/client/assets/{connection-detail-CrxMas_a.js → connection-detail-Dz4PneDx.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-Cco6Qbpt.js → connection-form-helpers-CF-WQyTc.js} +1 -1
- package/dist/client/assets/{connections-D2DZU5GB.js → connections-3TpGWQgy.js} +1 -1
- package/dist/client/assets/{context-menu-BLuGnyVu.js → context-menu-DyhUbPtL.js} +1 -1
- package/dist/client/assets/{decopilot-DMutZh6M.js → decopilot-DrrsAbRN.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool--1mtBHxz.js → decopilot-sse-pool-CyIsiJ1H.js} +1 -1
- package/dist/client/assets/{dialog-Dy6eXpKe.js → dialog-Dj81EdMo.js} +1 -1
- package/dist/client/assets/{domain-settings-C1eV-9a-.js → domain-settings-xhuDCJzA.js} +1 -1
- package/dist/client/assets/{drawer-Dvd-9Sja.js → drawer-tdj9aCh7.js} +1 -1
- package/dist/client/assets/{dropdown-menu-OVr8TMr_.js → dropdown-menu-UriF3iJ3.js} +1 -1
- package/dist/client/assets/{empty-state-DQfglbNM.js → empty-state-pCesbyUM.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DrUVsxqd.js → extract-connection-data-DumI9Ge5.js} +1 -1
- package/dist/client/assets/{file-explorer-CkPnNmO8.js → file-explorer-BrAHdPYq.js} +1 -1
- package/dist/client/assets/{file-type-icon-SP0v8UlM.js → file-type-icon-Czo8zyOj.js} +1 -1
- package/dist/client/assets/{files-Wz-xIRKZ.js → files-2-ylEzlS.js} +1 -1
- package/dist/client/assets/{form-CkEHHrgu.js → form--KUjsjlO.js} +1 -1
- package/dist/client/assets/{general-DdP8ztNk.js → general-CESQV-oz.js} +1 -1
- package/dist/client/assets/{github-repo-picker-DSR-TwBo.js → github-repo-picker-B2FrynHJ.js} +1 -1
- package/dist/client/assets/{hooks-o8yCDzJC.js → hooks-dZjznYow.js} +1 -1
- package/dist/client/assets/{import-from-deco-dialog-CEW3ZJjT.js → import-from-deco-dialog-BR852fbZ.js} +1 -1
- package/dist/client/assets/{index-XoC6Mv98.js → index-0P9allDr.js} +1 -1
- package/dist/client/assets/{index-DuwRwNmr.js → index-BBWislhf.js} +1 -1
- package/dist/client/assets/{index-B6kdF_L8.js → index-BWNTd3xK.js} +1 -1
- package/dist/client/assets/{index-Dp_9MLtk.js → index-BcYiAjiX.js} +1 -1
- package/dist/client/assets/{index-j1EmgqV8.js → index-BlbGtC1U.js} +3 -3
- package/dist/client/assets/{index-_cWo9NQL.js → index-BxxTJpbB.js} +30 -30
- package/dist/client/assets/{index-DrmUu6Oi.js → index-CCANgKdB.js} +1 -1
- package/dist/client/assets/{index-D3y2G80O.js → index-CSUPQJzr.js} +1 -1
- package/dist/client/assets/{index-Z9ET5M46.js → index-CTgm7OBW.js} +1 -1
- package/dist/client/assets/{index-kU0DbGlO.js → index-CsOdgboE.js} +1 -1
- package/dist/client/assets/{index-DgC1qvp3.js → index-Dc1mL4BR.js} +1 -1
- package/dist/client/assets/{index-_iXFFHGt.js → index-S2ZDAOoZ.js} +1 -1
- package/dist/client/assets/{index-BFhrz-f4.js → index-bqGy9pqv.js} +1 -1
- package/dist/client/assets/{index-C0th2ciG.js → index-gxmWeiHj.js} +1 -1
- package/dist/client/assets/{index-redirect-Cq22Ou3t.js → index-redirect-DfTnv8HP.js} +1 -1
- package/dist/client/assets/{input-zUoMTUjz.js → input-DHDgjmX0.js} +1 -1
- package/dist/client/assets/{integration-icon-Cpv4CIQ_.js → integration-icon-m4V5ew5R.js} +1 -1
- package/dist/client/assets/{label-DIdfff7-.js → label-PsbKXPB5.js} +1 -1
- package/dist/client/assets/{login-0NOIPa_i.js → login-CjZD7E7q.js} +1 -1
- package/dist/client/assets/{mcp-oauth-iKgiXli9.js → mcp-oauth-D8vUJRgp.js} +1 -1
- package/dist/client/assets/{members-CnFYAz0Z.js → members-BPqR9Tpk.js} +1 -1
- package/dist/client/assets/{monaco-editor-DvDR9w-L.js → monaco-editor-C6TIlc3v.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-BbY_q-eo.js → monitoring-stats-row-CuYST9yW.js} +1 -1
- package/dist/client/assets/{oauth-callback-BPtayFiR.js → oauth-callback-MIwBkTTF.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-K5aCOvaH.js → oauth-callback-ai-provider-DE51OBIS.js} +1 -1
- package/dist/client/assets/{onboarding-ZiU6JGv-.js → onboarding-D2dd9Hw0.js} +1 -1
- package/dist/client/assets/{org-install-Cy54wLGw.js → org-install-TvXy2En0.js} +1 -1
- package/dist/client/assets/{org-layout-D-P2tcqC.js → org-layout-B7of36Ug.js} +1 -1
- package/dist/client/assets/{organization-choice-C1y80Okj.js → organization-choice-ClD6fu3y.js} +1 -1
- package/dist/client/assets/{page-seo-form-xc_ndIWR.js → page-seo-form-B43PbD8q.js} +1 -1
- package/dist/client/assets/page-seo-sheet-Bms3CN63.js +1 -0
- package/dist/client/assets/{popover-DU5qAOzi.js → popover-Do5OoBkb.js} +1 -1
- package/dist/client/assets/{post-editor-Bu1uK3RV.js → post-editor-DyiVSt54.js} +1 -1
- package/dist/client/assets/{preview-dialog-C9-3VKyJ.js → preview-dialog-DxRKsymK.js} +1 -1
- package/dist/client/assets/{primitives-CykDcCCX.js → primitives-DxWZCDhA.js} +1 -1
- package/dist/client/assets/{profile-BKoUm-g9.js → profile-BhdJgKGB.js} +1 -1
- package/dist/client/assets/project-app-view-CI4_btQ-.js +1 -0
- package/dist/client/assets/record-editor-BXTRvz07.js +1 -0
- package/dist/client/assets/registry-Du_E4iar.js +2 -0
- package/dist/client/assets/{registry-layout-B9FmRjJz.js → registry-layout-B9PDVzF6.js} +1 -1
- package/dist/client/assets/{require-capability-CehH7jAZ.js → require-capability-D2RrR3BZ.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CU8fve_K.js → required-auth-layout-BdWFlHgh.js} +1 -1
- package/dist/client/assets/{reset-password-zdekZmVd.js → reset-password-ZLVvnqus.js} +1 -1
- package/dist/client/assets/{roles-D-x_wkGo.js → roles-3wYBxtCJ.js} +1 -1
- package/dist/client/assets/{scroll-area-BAz3Rj9i.js → scroll-area-B3-Gj80e.js} +1 -1
- package/dist/client/assets/{search-input-DRzQD01R.js → search-input-Cmd3sBC3.js} +1 -1
- package/dist/client/assets/{secrets-CuUGkNhM.js → secrets-DwdsYco7.js} +1 -1
- package/dist/client/assets/{sections-editor-DPVFX_7V.js → sections-editor-DC39EH-a.js} +1 -1
- package/dist/client/assets/{select-svPYG6Bw.js → select-DxONb3Kt.js} +1 -1
- package/dist/client/assets/{select-model-Dq-JstQ8.js → select-model-RfbC0RGe.js} +1 -1
- package/dist/client/assets/{seo-editor-BFJub-eW.js → seo-editor-kUNtMQs9.js} +1 -1
- package/dist/client/assets/{settings-layout-a74u_hLy.js → settings-layout-BqoYV9gy.js} +1 -1
- package/dist/client/assets/{settings-section-CNscyKHW.js → settings-section-BlH2FRiM.js} +1 -1
- package/dist/client/assets/{sheet-DahuGsa4.js → sheet-C2Kfge9r.js} +1 -1
- package/dist/client/assets/{shell-controls-K52T5sMB.js → shell-controls-CHbMUihJ.js} +1 -1
- package/dist/client/assets/{shell-layout-Buk6j896.js → shell-layout-BihuyTtm.js} +1 -1
- package/dist/client/assets/{shell-route-loading-B0z1lBof.js → shell-route-loading-De-l4N89.js} +1 -1
- package/dist/client/assets/{sidebar-D5j5gPeI.js → sidebar-BjIzPMot.js} +1 -1
- package/dist/client/assets/{skeleton-U2Av8cLZ.js → skeleton-BG0I4KDd.js} +1 -1
- package/dist/client/assets/sortable.esm-DUIS-SLz.js +5 -0
- package/dist/client/assets/{sso-BoRzwrWA.js → sso-DHlsuJgQ.js} +1 -1
- package/dist/client/assets/{store-vubGBkGy.js → store-CF-c7AjJ.js} +1 -1
- package/dist/client/assets/store-registry-C91x-W79.js +2 -0
- package/dist/client/assets/{studio-tools-BAmwKCdT.js → studio-tools-7mZABBZl.js} +1 -1
- package/dist/client/assets/{switch-CjEoRRuC.js → switch-Dprre6Tx.js} +1 -1
- package/dist/client/assets/{table-T8p77nDy.js → table-2dv8FC6q.js} +1 -1
- package/dist/client/assets/{tabs-DDAkKuLU.js → tabs-nJ0qk72w.js} +1 -1
- package/dist/client/assets/{task-status-Dc-JFjIj.js → task-status-CvjZ7N6W.js} +1 -1
- package/dist/client/assets/{textarea-BrxTK711.js → textarea-HTN5AIWJ.js} +1 -1
- package/dist/client/assets/{toggle-group-r5JjNYaj.js → toggle-group-D22tG_vD.js} +1 -1
- package/dist/client/assets/{toolbar-Cd-zT0GV.js → toolbar-DktIJIGj.js} +1 -1
- package/dist/client/assets/{tooltip-D2IcwsrW.js → tooltip-oPF11xOc.js} +1 -1
- package/dist/client/assets/{types-DdqgwoF-.js → types-DZM3oHCm.js} +1 -1
- package/dist/client/assets/{use-ai-providers-B7DE5RlO.js → use-ai-providers-CZx1BFdY.js} +1 -1
- package/dist/client/assets/{use-automations-BaLowkA-.js → use-automations-DttN1_QI.js} +1 -1
- package/dist/client/assets/{use-capability-BYfWBphf.js → use-capability-CREa5hxg.js} +1 -1
- package/dist/client/assets/{use-clock-tick-vJNeZS2R.js → use-clock-tick-D4shCSZy.js} +1 -1
- package/dist/client/assets/{use-collections-DOhjyZoW.js → use-collections-DZi4alPB.js} +1 -1
- package/dist/client/assets/{use-connection-a48WkDyi.js → use-connection-BaK7gZK8.js} +1 -1
- package/dist/client/assets/{use-copy-Dm0W_H8p.js → use-copy-BGXnmJ0Y.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BRQVpCUG.js → use-create-virtual-mcp-BzfjXCKR.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-oRzID6xD.js → use-debounced-autosave-DCle0l35.js} +1 -1
- package/dist/client/assets/{use-debounced-value-B1GdK5fU.js → use-debounced-value-D0ar8P23.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CKYm7fJS.js → use-delete-connection-IE5Qqa0Q.js} +1 -1
- package/dist/client/assets/{use-file-configs-F_Lh19IF.js → use-file-configs-CZMtO580.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-Cs1p0W0X.js → use-infinite-scroll-c7yDanFw.js} +1 -1
- package/dist/client/assets/{use-join-requests-Cx83Qjv9.js → use-join-requests-CiTPLtoo.js} +1 -1
- package/dist/client/assets/{use-mcp-client-B1E7Nyjd.js → use-mcp-client-BYcrk6lz.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-B4idSZTh.js → use-mcp-prompts-BjyIsgXC.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CqHv2Xxs.js → use-mcp-tools-DYc-d8kf.js} +1 -1
- package/dist/client/assets/{use-members-BqgoI8LN.js → use-members-CDV7-ikh.js} +1 -1
- package/dist/client/assets/{use-mobile-CWv_pUWp.js → use-mobile-BKRfr7ic.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-CWpJGmq-.js → use-navigate-to-agent-D_fgYk51.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-C3mEUOcx.js → use-org-auth-client-C2F1ILpp.js} +1 -1
- package/dist/client/assets/{use-org-sso-Dop9y0HC.js → use-org-sso-DHz7VJ1a.js} +1 -1
- package/dist/client/assets/{use-organization-roles-BJ74MotE.js → use-organization-roles-9DZ9iYns.js} +1 -1
- package/dist/client/assets/{use-organization-settings-8LInvXec.js → use-organization-settings-ClKaDrE7.js} +1 -1
- package/dist/client/assets/{use-registry-connections-D2DhXJmA.js → use-registry-connections-Bgebk2mm.js} +1 -1
- package/dist/client/assets/{use-secrets-BLkb7BZG.js → use-secrets-DLWDaup6.js} +1 -1
- package/dist/client/assets/{use-status-sounds-MjzDR8jw.js → use-status-sounds-CBCN2gk-.js} +1 -1
- package/dist/client/assets/{use-view-mode-pvlDGqxN.js → use-view-mode-MNe61YUF.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-BcsK_V5p.js → use-virtual-mcp-Bkiriz_M.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-bB2OO4_F.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-CgFmFjuu.js +1 -0
- package/dist/client/assets/{useSuspenseQueries-C20MRsU9.js → useSuspenseQueries-DO4LObMF.js} +1 -1
- package/dist/client/assets/{variant-calendar-Dnj2EkPc.js → variant-calendar-B-NYPIkC.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DQyCEqbJ.js → view-mode-toggle-DbKux4TQ.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +510 -451
- package/dist/server/migrate.js +156 -97
- package/package.json +1 -1
- package/dist/client/assets/agents-list-DjZyRbNh.js +0 -1
- package/dist/client/assets/automations-Dss23VYg.js +0 -1
- package/dist/client/assets/commerce-onboarding-C0r_RGc5.js +0 -1
- package/dist/client/assets/page-seo-sheet-CL3gCFpf.js +0 -1
- package/dist/client/assets/project-app-view-y5DH-I8K.js +0 -1
- package/dist/client/assets/record-editor-CvDeMQ2G.js +0 -1
- package/dist/client/assets/registry-BaFm0L19.js +0 -2
- package/dist/client/assets/sortable.esm-DHLm3dqa.js +0 -5
- package/dist/client/assets/store-registry-3H_xbQFv.js +0 -2
- package/dist/client/assets/useInfiniteQuery-QT7BExxx.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CVusVKT2.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as D,r as M,o as bc,n as ch,p as uh,j as p,B as lr,s as Il,bM as kc,bN as dh,aQ as fh,ah as rn,bO as hh,l as Z,w as ph,V as $t,W as Ot,Z as kr,a3 as mh,ak as gh,_ as hn,bP as Sc,Y as vc,D as zt,m as yh,d as xh,K as Kt,t as zi,k as Co,b as Ln,E as bh,ae as wc,bQ as To,aj as kh,bR as Ut}from"./index-j1EmgqV8.js";import{f as Sh,N as vh,e as wh,ap as Ch,Z as Th,a5 as Nh,a4 as Mh,am as Cc,aq as Eh,ar as Ah,A as Tc,as as it,at as Oh,au as Ih,av as Rh,j as jh}from"./agent-icon-SFzfjqT3.js";import{t as Fs}from"./Stars01-ledCttL2.js";import{i as Nc,t as Dh,d as Mc,b as Er}from"./XCircle-B1aV7AX3.js";import{i as No}from"./ChevronUp-DrHOs0IB.js";import{i as Rl}from"./ChevronRight-Cw6r4eF5.js";import{a as Ec,s as Ph}from"./Eye-CPb9WDyf.js";import{a as Pt,t as Mo,u as Ac,c as jl}from"./use-clock-tick-vJNeZS2R.js";import{u as Oc}from"./use-copy-Dm0W_H8p.js";import{a as sn,b as on,T as ln}from"./tooltip-D2IcwsrW.js";import{M as Eo,I as Ic,F as Lh}from"./file-type-icon-SP0v8UlM.js";import{c as _h}from"./content-blocks-o63cs2vh.js";import{g as Rc,M as $h}from"./types-DdqgwoF-.js";import{S as zh,f as _n,h as Bh,c as Ao,a as Fh,u as Hh}from"./chat-context-rSGx0F1S.js";import{c as Vh,r as Wh,R as Uh}from"./hooks-o8yCDzJC.js";import{u as qh}from"./studio-tools-BAmwKCdT.js";import{f as Kh,k as Jh,l as Gh}from"./tab-id-BptcWVWa.js";import{e as Yh,u as jc,l as Xh}from"./use-mcp-client-B1E7Nyjd.js";import{i as Dc}from"./AlertCircle-B7YwjVuv.js";import{s as Jr,t as Pc}from"./Star01-BvLdWUOq.js";import{s as Qh}from"./XClose-9xeu7JIP.js";import{n as Bi}from"./ZapSquare-C-BUl6mg.js";import{n as Lc,i as Zh}from"./Globe01-D51Pf1ib.js";import{c as ep,b as tp,a as Ar}from"./Tool01-MvyjXDCb.js";import{b as Dl,a as np}from"./ZoomOut-DnuKetHD.js";import{i as Gn}from"./Monitor01-BzxQo8OV.js";import{i as rp}from"./SearchMd-C5JuA4Q_.js";import{i as sp}from"./Upload01-DvSZDpgm.js";import{b as ip,c as op}from"./shell-layout-Buk6j896.js";import{n as _c}from"./LinkExternal01-Cd3gNz9H.js";import{b as lp,S as ap,c as cp,d as up}from"./sheet-DahuGsa4.js";import{I as Sr}from"./integration-icon-Cpv4CIQ_.js";import{a as dp}from"./use-virtual-mcp-BcsK_V5p.js";import{i as fp}from"./ArrowUpRight-DvElag-V.js";import{a as Oo}from"./Users03-BiIAwLFR.js";import{a as ot}from"./Palette-TV4PomkE.js";import{m as $c}from"./use-navigate-to-agent-CWpJGmq-.js";import{a as hp}from"./use-connection-a48WkDyi.js";import{a as pp}from"./Stars02-CZ3C1sQr.js";import{g as mp}from"./use-mcp-prompts-B4idSZTh.js";import{a as gp,c as yp,D as xp,d as bp,e as kp}from"./dialog-Dy6eXpKe.js";import{a as Sp,F as vp,b as wp,c as Cp,d as Tp,e as Np}from"./form-CkEHHrgu.js";import{I as Mp}from"./input-zUoMTUjz.js";import{t as Ep}from"./ChevronDown-D7t2IbgZ.js";import{e as Ap}from"./select-svPYG6Bw.js";const Op={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(Op)){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 yw(n){return n.reduce((e,t)=>Fc(e,t.metadata?.usage),Bc())}function Ip(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Io(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Ro(n,e){if(!e)return n;const t=`${Ip(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Rp(n,e){return Ro(n,e).replace(/[_-]/g," ").toLowerCase()}function jp(n){const e={};for(const t of n.arguments??[])e[t.name]=t.required?Il().min(1,"Required"):Il();return bc(e)}function Dp(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Pp(n){const e=D.c(66),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=M.useId();let l;if(e[0]!==t){const $=t?jp(t):bc({});l=ch($),e[0]=t,e[1]=l}else l=e[1];const c=l;let u;e[2]!==i||e[3]!==t?(u=t?Dp(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=uh(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||Rp(t.name,Io(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(gp,{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(yp,{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?($=F=>p.jsx(vp,{control:f.control,name:F.name,render:J=>{const{field:X}=J;return p.jsxs(wp,{children:[p.jsxs(Cp,{className:"text-xs",children:[F.name,F.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Tp,{children:p.jsx(Mp,{...X,value:X.value??"",required:F.required,placeholder:F.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(Np,{})]})}},F.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(zh,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=f.formState.isSubmitting,e[44]=j):j=e[44];let P;e[45]!==f.formState.isSubmitting||e[46]!==o||e[47]!==j?(P=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]=P):P=e[48];let R;e[49]!==E||e[50]!==P?(R=p.jsxs(xp,{children:[E,P]}),e[49]=E,e[50]=P,e[51]=R):R=e[51];let L;e[52]!==o||e[53]!==w||e[54]!==T||e[55]!==R?(L=p.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:w,children:[T,R]}),e[52]=o,e[53]=w,e[54]=T,e[55]=R,e[56]=L):L=e[56];let I;e[57]!==f||e[58]!==L?(I=p.jsx(Sp,{...f,children:L}),e[57]=f,e[58]=L,e[59]=I):I=e[59];let z;e[60]!==C||e[61]!==I?(z=p.jsxs(bp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,I]}),e[60]=C,e[61]=I,e[62]=z):z=e[62];let B;return e[63]!==b||e[64]!==z?(B=p.jsx(kp,{open:!0,onOpenChange:b,children:z}),e[63]=b,e[64]=z,e[65]=B):B=e[65],B}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 Yr 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 Lp(n,e,t){if(t.openStart>n.depth)throw new Yr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Yr("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}=_p(t,n);return Zt(i,Gc(n,o,l,e,r))}else return Zt(i,Xr(n,e,r))}function Jc(n,e){if(!e.type.compatibleContent(n.type))throw new Yr("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 Yn(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 Yn(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,Xr(n,e,s+1)),l),Yn(e,t,s,l),o&&Qt(Zt(o,Xr(t,r,s+1)),l)),Yn(r,null,s,l),new A(l)}function Xr(n,e,t){let r=[];if(Yn(null,n,t,r),n.depth>t){let s=Hi(n,e,t+1);Qt(Zt(s,Xr(n,e,t+1)),r)}return Yn(e,null,t,r),new A(r)}function _p(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=Pl.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 Pl.set(e,r=new $p);let s=r.elts[r.i]=ar.resolve(e,t);return r.i=(r.i+1)%zp,s}}class $p{constructor(){this.elts=[],this.i=0}}const zp=12,Pl=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 Bp=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||Bp)&&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 Lp(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()+")"),Yc(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):Yc(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 Yc(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 Fp(e,t);if(r.next==null)return an.empty;let s=Xc(r);r.next&&r.err("Unexpected trailing text");let i=Jp(Kp(s));return Gp(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{c as D,r as M,o as bc,n as ch,p as uh,j as p,B as lr,s as Il,bM as kc,bN as dh,aQ as fh,ah as rn,bO as hh,l as Z,v as ph,V as $t,W as Ot,Z as kr,a3 as mh,ak as gh,_ as hn,bP as Sc,Y as vc,D as zt,m as yh,d as xh,K as Kt,t as zi,k as Co,b as Ln,E as bh,ae as wc,bQ as To,aj as kh,bR as Ut}from"./index-BlbGtC1U.js";import{f as Sh,N as vh,e as wh,ap as Ch,Z as Th,a5 as Nh,a4 as Mh,am as Cc,aq as Eh,ar as Ah,A as Tc,as as it,at as Oh,au as Ih,av as Rh,j as jh}from"./agent-icon-C1dYfmgT.js";import{t as Fs}from"./Stars01-CBpnmt-0.js";import{i as Nc,t as Dh,d as Mc,b as Er}from"./XCircle-IAOWYKKA.js";import{i as No}from"./ChevronUp-uk87fvlM.js";import{i as Rl}from"./ChevronRight-CKc4NZet.js";import{a as Ec,s as Ph}from"./Eye-BHPT57Tm.js";import{a as Pt,t as Mo,u as Ac,c as jl}from"./use-clock-tick-D4shCSZy.js";import{u as Oc}from"./use-copy-BGXnmJ0Y.js";import{a as sn,b as on,T as ln}from"./tooltip-oPF11xOc.js";import{M as Eo,I as Ic,F as Lh}from"./file-type-icon-Czo8zyOj.js";import{c as _h}from"./content-blocks-o63cs2vh.js";import{g as Rc,M as $h}from"./types-DZM3oHCm.js";import{S as zh,f as _n,h as Bh,c as Ao,a as Fh,u as Hh}from"./chat-context-DJ9kQ1Gu.js";import{c as Vh,r as Wh,R as Uh}from"./hooks-dZjznYow.js";import{u as qh}from"./studio-tools-7mZABBZl.js";import{f as Kh,k as Jh,l as Gh}from"./tab-id-BptcWVWa.js";import{e as Yh,u as jc,l as Xh}from"./use-mcp-client-BYcrk6lz.js";import{i as Dc}from"./AlertCircle-BJzQ1lVJ.js";import{s as Jr,t as Pc}from"./Star01-D2l7-L0I.js";import{s as Qh}from"./XClose-ChjX78ei.js";import{n as Bi}from"./ZapSquare-hkjSQWO8.js";import{n as Lc,i as Zh}from"./Globe01-DD63JJzL.js";import{c as ep,b as tp,a as Ar}from"./Tool01-D4LA61If.js";import{b as Dl,a as np}from"./ZoomOut-DoQt1wdd.js";import{i as Gn}from"./Monitor01-BKqFs8Gp.js";import{i as rp}from"./SearchMd-BkXN-Kzx.js";import{i as sp}from"./Upload01-C_kFf8l0.js";import{b as ip,c as op}from"./shell-layout-BihuyTtm.js";import{n as _c}from"./LinkExternal01-DCed5R2c.js";import{b as lp,S as ap,c as cp,d as up}from"./sheet-C2Kfge9r.js";import{I as Sr}from"./integration-icon-m4V5ew5R.js";import{a as dp}from"./use-virtual-mcp-Bkiriz_M.js";import{i as fp}from"./ArrowUpRight-CA22UP6Q.js";import{a as Oo}from"./Users03-BkBCkWQn.js";import{a as ot}from"./Palette-DkcZCW1n.js";import{m as $c}from"./use-navigate-to-agent-D_fgYk51.js";import{a as hp}from"./use-connection-BaK7gZK8.js";import{a as pp}from"./Stars02-DC4cG_dc.js";import{g as mp}from"./use-mcp-prompts-BjyIsgXC.js";import{a as gp,c as yp,D as xp,d as bp,e as kp}from"./dialog-Dj81EdMo.js";import{a as Sp,F as vp,b as wp,c as Cp,d as Tp,e as Np}from"./form--KUjsjlO.js";import{I as Mp}from"./input-DHDgjmX0.js";import{t as Ep}from"./ChevronDown-DM7Zg7z0.js";import{e as Ap}from"./select-DxONb3Kt.js";const Op={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(Op)){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 yw(n){return n.reduce((e,t)=>Fc(e,t.metadata?.usage),Bc())}function Ip(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Io(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Ro(n,e){if(!e)return n;const t=`${Ip(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Rp(n,e){return Ro(n,e).replace(/[_-]/g," ").toLowerCase()}function jp(n){const e={};for(const t of n.arguments??[])e[t.name]=t.required?Il().min(1,"Required"):Il();return bc(e)}function Dp(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Pp(n){const e=D.c(66),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=M.useId();let l;if(e[0]!==t){const $=t?jp(t):bc({});l=ch($),e[0]=t,e[1]=l}else l=e[1];const c=l;let u;e[2]!==i||e[3]!==t?(u=t?Dp(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=uh(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||Rp(t.name,Io(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(gp,{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(yp,{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?($=F=>p.jsx(vp,{control:f.control,name:F.name,render:J=>{const{field:X}=J;return p.jsxs(wp,{children:[p.jsxs(Cp,{className:"text-xs",children:[F.name,F.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Tp,{children:p.jsx(Mp,{...X,value:X.value??"",required:F.required,placeholder:F.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(Np,{})]})}},F.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(zh,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=f.formState.isSubmitting,e[44]=j):j=e[44];let P;e[45]!==f.formState.isSubmitting||e[46]!==o||e[47]!==j?(P=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]=P):P=e[48];let R;e[49]!==E||e[50]!==P?(R=p.jsxs(xp,{children:[E,P]}),e[49]=E,e[50]=P,e[51]=R):R=e[51];let L;e[52]!==o||e[53]!==w||e[54]!==T||e[55]!==R?(L=p.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:w,children:[T,R]}),e[52]=o,e[53]=w,e[54]=T,e[55]=R,e[56]=L):L=e[56];let I;e[57]!==f||e[58]!==L?(I=p.jsx(Sp,{...f,children:L}),e[57]=f,e[58]=L,e[59]=I):I=e[59];let z;e[60]!==C||e[61]!==I?(z=p.jsxs(bp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,I]}),e[60]=C,e[61]=I,e[62]=z):z=e[62];let B;return e[63]!==b||e[64]!==z?(B=p.jsx(kp,{open:!0,onOpenChange:b,children:z}),e[63]=b,e[64]=z,e[65]=B):B=e[65],B}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 Yr 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 Lp(n,e,t){if(t.openStart>n.depth)throw new Yr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Yr("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}=_p(t,n);return Zt(i,Gc(n,o,l,e,r))}else return Zt(i,Xr(n,e,r))}function Jc(n,e){if(!e.type.compatibleContent(n.type))throw new Yr("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 Yn(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 Yn(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,Xr(n,e,s+1)),l),Yn(e,t,s,l),o&&Qt(Zt(o,Xr(t,r,s+1)),l)),Yn(r,null,s,l),new A(l)}function Xr(n,e,t){let r=[];if(Yn(null,n,t,r),n.depth>t){let s=Hi(n,e,t+1);Qt(Zt(s,Xr(n,e,t+1)),r)}return Yn(e,null,t,r),new A(r)}function _p(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=Pl.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 Pl.set(e,r=new $p);let s=r.elts[r.i]=ar.resolve(e,t);return r.i=(r.i+1)%zp,s}}class $p{constructor(){this.elts=[],this.i=0}}const zp=12,Pl=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 Bp=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||Bp)&&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 Lp(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()+")"),Yc(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):Yc(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 Yc(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 Fp(e,t);if(r.next==null)return an.empty;let s=Xc(r);r.next&&r.err("Unexpected trailing text");let i=Jp(Kp(s));return Gp(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 Fp{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 Xc(n){let e=[];do e.push(Hp(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Hp(n){let e=[];do e.push(Vp(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Vp(n){let e=qp(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=Wp(n,e);else break;return e}function Ll(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Wp(n,e){let t=Ll(n),r=t;return n.eat(",")&&(n.next!="}"?r=Ll(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Up(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 qp(n){if(n.eat("(")){let e=Xc(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=Up(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 Kp(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 _l(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 Jp(n){let e=Object.create(null);return t(_l(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]);_l(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 Gp(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 Yp(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"?Yp(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?zl(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==""?[]:zl(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 zl(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 Qp(n){return n.tag!=null}function Zp(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(Qp(s))this.tags.push(s);else if(Zp(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 Fl(this,t,!1);return r.addAll(e,ne.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Fl(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(nm(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=Hl(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=Hl(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},em={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ou={ol:!0,ul:!0},cr=1,Vi=2,Xn=4;function Bl(n,e,t){return e!=null?(e?cr:0)|(e==="full"?Vi:0):n&&n.whitespace=="pre"?cr|Vi:t&~Xn}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&Xn?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 Fl{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=Bl(null,t.preserveWhitespace,0)|(r?Xn: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&&tm(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:em.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):Vl(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=Bl(e,i,o.options);o.options&Xn&&o.content.length==0&&(l|=Xn);let a=ne.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Vl(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 tm(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 nm(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Hl(n){let e={};for(let t in n)e[t]=n[t];return e}function Vl(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=Wl(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Wl(e.marks)}}function Wl(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 Ul=new WeakMap;function rm(n){let e=Ul.get(n);return e===void 0&&Ul.set(n,e=sm(n)),e}function sm(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=rm(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 im(n,e){return n+e*au}function ql(n){return n&lu}function om(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=ql(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+om(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:im(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=ql(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 Yr)return me.fail(i.message);throw i}}}function jo(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(jo(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 _(jo(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 _(jo(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 lm(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 am(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 Do(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 cm(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||!cm(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function um(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 Po(n,e,t=null,r=n){let s=dm(n,e),i=s&&fm(r,e);return i?s.map(Kl).concat({type:e,attrs:t}).concat(i.map(Kl)):null}function Kl(n){return{type:n,attrs:null}}function dm(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 fm(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 hm(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 pm(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)&&mm(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),Do(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{c as b,l as w,j as a,i as j}from"./index-
|
|
1
|
+
import{c as b,l as w,j as a,i as j}from"./index-BlbGtC1U.js";import{i as N}from"./SearchMd-BkXN-Kzx.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{c as p,j as t,E as P,r as j,ag as w,B as S,t as y}from"./index-
|
|
1
|
+
import{c as p,j as t,E as P,r as j,ag as w,B as S,t as y}from"./index-BlbGtC1U.js";import{i as k}from"./AlertCircle-BJzQ1lVJ.js";import{s as z}from"./Plus-Bi8BbQwT.js";import{s as E}from"./User01-Cykpl4hh.js";import{t as F}from"./Users01-fhFCwrP8.js";import{e as $,d as I,c as O,a as A,b as R,D as T}from"./dialog-Dj81EdMo.js";import{I as N}from"./input-DHDgjmX0.js";import{L as g}from"./label-PsbKXPB5.js";import{d as B,b as V,c as L,S as q,a as C}from"./select-DxONb3Kt.js";import{S as H}from"./skeleton-BG0I4KDd.js";import{T as K}from"./textarea-HTN5AIWJ.js";import{P as b}from"./index-BBWislhf.js";import{c as W}from"./settings-section-BlH2FRiM.js";import{u as Y,a as G}from"./use-secrets-DLWDaup6.js";import{R as J}from"./require-capability-D2RrR3BZ.js";import"./X-DEdLuuqP.js";import"./tooltip-oPF11xOc.js";import"./ChevronUp-uk87fvlM.js";import"./ChevronDown-DM7Zg7z0.js";import"./sidebar-BjIzPMot.js";import"./LayoutLeft-y1fOcQ0I.js";import"./use-mobile-BKRfr7ic.js";import"./sheet-C2Kfge9r.js";import"./card-DjLKG66H.js";import"./ArrowUpRight-CA22UP6Q.js";import"./studio-tools-7mZABBZl.js";import"./use-capability-CREa5hxg.js";import"./access-gate-C9EgwKjC.js";import"./capability-load-error-7-bUVJZE.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"?E:F,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 Ie(){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{Ie as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as Ge,r as k,l as Pe,j as n,B as Ye,i as Hn,m as ha,t as te,K as ga}from"./index-j1EmgqV8.js";import{r as va,a as Sa,s as ba,i as Un,c as ya,b as xa,G as _a,V as ja,d as ka,e as Rt,f as wa,g as Na,h as Ra,j as Da,k as Va,l as Ca,m as Ta,n as Pa,o as Aa,p as $t,q as Ot,t as Ma,v as ut,w as kt,x as Ea,y as Ka,z as Je,A as Cn,S as $a,M as Tn,B as wt,C as Bt,D as Oa,E as sn,P as Ba,F as et,H as bt,I as La,J as Fa,K as Ia,L as za,N as Ha,O as Ua,Q as dt,R as Ga,T as Wa,U as qa,W as Pn,X as Nt,Y as Ya,Z as Ja,_ as Qa,$ as Xa,a0 as Za,a1 as an,a2 as An,a3 as Mn,a4 as yt,a5 as Lt,a6 as En,a7 as er,a8 as tr,a9 as nr,aa as rn,ab as sr,ac as Gn,ad as Kn,ae as ar}from"./index-_cWo9NQL.js";import{t as rr}from"./ChevronDown-D7t2IbgZ.js";import{n as or}from"./ChevronLeft-DnVztwcc.js";import{i as Wn}from"./ChevronRight-Cw6r4eF5.js";import{n as ir}from"./ChevronUp-DrHOs0IB.js";import{L as ln,E as qn,X as Yn,l as lr,M as cr,N as ur}from"./agent-icon-SFzfjqT3.js";import{i as dr}from"./Globe01-D51Pf1ib.js";import{S as Ft}from"./scroll-area-BAz3Rj9i.js";import{T as mt,a as ft,b as pt}from"./tooltip-D2IcwsrW.js";import{a as mr,c as fr,b as pr,D as hr,d as gr,e as vr}from"./dialog-Dy6eXpKe.js";import{I as Sr}from"./input-zUoMTUjz.js";import{s as br,a as Jn}from"./Eye-CPb9WDyf.js";import{c as yr}from"./ZoomOut-DnuKetHD.js";import{i as xr}from"./Settings02-CWsiKyfu.js";import{s as cn}from"./Plus-DrCr8atg.js";import{s as Qn}from"./Trash01-C3HJx9Eu.js";import{i as _r}from"./Zap-C8z5Nmtq.js";import{c as it,a as Xn,D as Zn,b as es,g as jr}from"./dropdown-menu-OVr8TMr_.js";import{b as ts,c as It,K as ns,P as ss,e as as,C as rs,s as os,l as Dt,D as is,d as ls,S as cs,v as kr,k as us,p as wr}from"./sortable.esm-DHLm3dqa.js";import{r as $n,u as Nr,d as Rr,a as Dr,i as Vr,f as Cr,P as Tr,b as Pr,S as Ar}from"./page-seo-form-xc_ndIWR.js";import{b as Mr}from"./Tool01-MvyjXDCb.js";import{A as Er}from"./add-section-modal-B07Xr2Kn.js";import"./index-XoC6Mv98.js";import"./chat-context-rSGx0F1S.js";import"./hooks-o8yCDzJC.js";import"./use-mcp-client-B1E7Nyjd.js";import"./auth-B9AdzGWs.js";import"./decopilot-sse-pool--1mtBHxz.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-BcsK_V5p.js";import"./use-collections-DOhjyZoW.js";import"./use-ai-providers-B7DE5RlO.js";import"./studio-tools-BAmwKCdT.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings-8LInvXec.js";import"./drawer-Dvd-9Sja.js";import"./collection-search-Yx1Vcd74.js";import"./SearchMd-C5JuA4Q_.js";import"./use-mobile-CWv_pUWp.js";import"./use-mcp-prompts-B4idSZTh.js";import"./X-D1lT84o6.js";import"./shell-layout-Buk6j896.js";import"./avatar-CdYywjB8.js";import"./User01-TldGh0YP.js";import"./Users03-BiIAwLFR.js";import"./SearchLg-C45t9PQZ.js";import"./Stars02-CZ3C1sQr.js";import"./XClose-9xeu7JIP.js";import"./CheckCircle-DIxU9fNb.js";import"./FilterLines-2uX2Gf4U.js";import"./required-auth-layout-CU8fve_K.js";import"./use-org-sso-Dop9y0HC.js";import"./SwitchHorizontal01-fTq_Xj_0.js";import"./ZapSquare-C-BUl6mg.js";import"./Star01-BvLdWUOq.js";import"./Upload01-DvSZDpgm.js";import"./AlertCircle-B7YwjVuv.js";import"./form-CkEHHrgu.js";import"./label-DIdfff7-.js";import"./select-svPYG6Bw.js";import"./XCircle-B1aV7AX3.js";import"./tabs-DDAkKuLU.js";import"./toggle-group-r5JjNYaj.js";import"./Monitor01-BzxQo8OV.js";import"./connect-desktop-dialog-Ny2ddpDi.js";import"./decopilot-DMutZh6M.js";import"./checkbox-D5qKxHwE.js";import"./skeleton-U2Av8cLZ.js";import"./Key01-B-V8oh6M.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-CNscyKHW.js";import"./card-Dt5JuJj0.js";import"./ArrowUpRight-DvElag-V.js";import"./Stars01-ledCttL2.js";import"./popover-DU5qAOzi.js";import"./command--DrDkfnb.js";import"./index-D3y2G80O.js";import"./useInfiniteQuery-QT7BExxx.js";import"./use-infinite-scroll-Cs1p0W0X.js";import"./question-004-sINsf4GQ.js";import"./integration-icon-Cpv4CIQ_.js";import"./use-status-sounds-MjzDR8jw.js";import"./empty-state-DQfglbNM.js";import"./toolbar-Cd-zT0GV.js";import"./preview-dialog-C9-3VKyJ.js";import"./LinkExternal01-Cd3gNz9H.js";import"./index-Z9ET5M46.js";import"./file-type-icon-SP0v8UlM.js";import"./LayoutLeft-B7KWV4nT.js";import"./use-connection-a48WkDyi.js";import"./use-mcp-tools-CqHv2Xxs.js";import"./types-DdqgwoF-.js";import"./use-capability-BYfWBphf.js";import"./textarea-BrxTK711.js";import"./shell-route-loading-B0z1lBof.js";import"./extract-connection-data-DrUVsxqd.js";import"./index-kU0DbGlO.js";import"./mcp-oauth-iKgiXli9.js";import"./badge-Dxlv54DZ.js";import"./connection-slug-eyAPH6o3.js";import"./alert-dialog-Dv-S36Xs.js";import"./switch-CjEoRRuC.js";import"./Play-B9WHtGRe.js";import"./use-debounced-autosave-oRzID6xD.js";import"./index-DuwRwNmr.js";import"./sidebar-D5j5gPeI.js";import"./sheet-DahuGsa4.js";import"./search-input-DRzQD01R.js";import"./collection-tabs-DEvCjzY2.js";import"./github-repo-picker-DSR-TwBo.js";import"./use-debounced-value-B1GdK5fU.js";import"./authenticate-and-persist-oauth-CWwDFJ5t.js";import"./use-navigate-to-agent-CWpJGmq-.js";import"./Users01-B63UEiqj.js";import"./use-secrets-BLkb7BZG.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./view-mode-toggle-DQyCEqbJ.js";import"./DotsVertical-p5cw6bzY.js";import"./automation-runs-B7uMDF25.js";import"./table-T8p77nDy.js";import"./use-members-BqgoI8LN.js";import"./use-org-auth-client-C3mEUOcx.js";import"./task-status-Dc-JFjIj.js";import"./use-automations-BaLowkA-.js";import"./useSuspenseInfiniteQuery-CVusVKT2.js";import"./use-file-configs-F_Lh19IF.js";import"./monaco-editor-DvDR9w-L.js";import"./select-model-Dq-JstQ8.js";import"./automation-list-row-CsaQkLKW.js";import"./Globe04-8CmI5zRW.js";import"./HardDrive-fBNuw9RE.js";import"./Sun-DPnjEA61.js";import"./Palette-TV4PomkE.js";import"./Shield01-BP8Krja8.js";import"./use-clock-tick-vJNeZS2R.js";import"./use-copy-Dm0W_H8p.js";import"./content-blocks-o63cs2vh.js";import"./connection-card-DGJrNSMY.js";import"./use-registry-connections-D2DhXJmA.js";import"./connection-form-helpers-Cco6Qbpt.js";function Kr(f){return f.schema?.definitions??f.schema?.$defs??{}}function $r(f,e){const r=Kr(e),u=r[btoa(f)];if(!u)return;let d=typeof u.image=="string"?u.image:void 0;if(!d&&Array.isArray(u.allOf)){const g=u.allOf.find(y=>typeof y.$ref=="string")?.$ref;if(typeof g=="string"){const y=g.replace("#/definitions/",""),p=r[y];d=typeof p?.image=="string"?p.image:void 0}}if(d?.includes("{{{"))return d}function Or(f,e){if(!e)return;const r=va(f);if(!r)return;const u=$r(r.resolveType,e);if(!u)return;const d=Sa(u,r.data);if(d)return ba(d)}const Br="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Lr="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 On(f){return Array.from({length:f},(e,r)=>({id:crypto.randomUUID(),index:r}))}function ds(f){return f.map((e,r)=>({...e,index:r}))}function Fr(f,e){if(e===f.length)return f;if(e<f.length)return ds(f.slice(0,e));const r=Array.from({length:e-f.length},(u,d)=>({id:crypto.randomUUID(),index:f.length+d}));return[...f,...r]}function ms(f){const e=Ge.c(20),{section:r,raw:u,meta:d}=f,g=r.isSavedBlock===!0,y=r.isMultivariate===!0;let p;e[0]!==d||e[1]!==u?(p=u&&d?Or(u,d):void 0,e[0]=d,e[1]=u,e[2]=p):p=e[2];const v=p;let b;e[3]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(yr,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=b):b=e[3];let x;e[4]!==v?(x=v&&n.jsx("img",{src:v,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=v,e[5]=x):x=e[5];let C;e[6]!==y||e[7]!==g?(C=g?{color:_a}:y?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=y,e[7]=g,e[8]=C):C=e[8];let N;e[9]!==C?(N=n.jsx(ln,{className:"h-4 w-4 shrink-0",style:C}),e[9]=C,e[10]=N):N=e[10];const j=r.isHidden&&"line-through opacity-50";let D;e[11]!==j?(D=Pe("min-w-0 flex-1 truncate text-sm font-medium",j),e[11]=j,e[12]=D):D=e[12];let o;e[13]!==r.label||e[14]!==D?(o=n.jsx("span",{className:D,children:r.label}),e[13]=r.label,e[14]=D,e[15]=o):o=e[15];let w;return e[16]!==x||e[17]!==N||e[18]!==o?(w=n.jsxs(n.Fragment,{children:[b,x,N,o]}),e[16]=x,e[17]=N,e[18]=o,e[19]=w):w=e[19],w}function fs(f,e){const r=f.isSavedBlock===!0,u=f.isMultivariate===!0;return Pe("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?Br:u?"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 Ir(f){const e=Ge.c(64),{section:r,raw:u,meta:d,sortableId:g,selected:y,onSelect:p,onDelete:v,onDuplicate:b,onMakeReusable:x,onToggleHidden:C,onToggleLazy:N,onAddVariant:j,onDetach:D}=f,o=u?Un(u.__resolveType??""):!1;let w;e[0]!==r?(w=ya(r),e[0]=r,e[1]=w):w=e[1];const i=w;let se;e[2]!==g?(se={id:g,animateLayoutChanges:Wr},e[2]=g,e[3]=se):se=e[3];const{attributes:Q,listeners:B,setNodeRef:c,transform:T,isDragging:de}=as(se);let P;e[4]!==T?(P=rs.Transform.toString(T?{...T,x:0}:null),e[4]=T,e[5]=P):P=e[5];const be=de?0:void 0;let E;e[6]!==P||e[7]!==be?(E={transform:P,opacity:be},e[6]=P,e[7]=be,e[8]=E):E=e[8];const he=E;let K;e[9]!==r?(K=xa(r),e[9]=r,e[10]=K):K=e[10];const oe=K,me="button",we=0;let U;e[11]!==p?(U=I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),p())},e[11]=p,e[12]=U):U=e[12];const re=de?"cursor-grabbing":"cursor-pointer";let W;e[13]!==r||e[14]!==y||e[15]!==re?(W=Pe("touch-none transition-colors",re,fs(r,y)),e[13]=r,e[14]=y,e[15]=re,e[16]=W):W=e[16];let fe;e[17]!==d||e[18]!==u||e[19]!==r?(fe=n.jsx(ms,{section:r,raw:u,meta:d}),e[17]=d,e[18]=u,e[19]=r,e[20]=fe):fe=e[20];const A=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ye,{type:"button",variant:"ghost",size:"icon","aria-label":o?"Disable async render":"Enable async render",className:Pe("h-7 w-7 shrink-0",o?"":"opacity-0 group-hover:opacity-100"),onClick:I=>{I.stopPropagation(),N()},onPointerDown:Gr,children:n.jsx(_r,{className:Pe("h-3.5 w-3.5",o&&"text-yellow-500")})})}),n.jsx(pt,{side:"bottom",children:o?"Disable async render":"Enable async render"})]});let _e;e[21]!==C||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(_e=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ye,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Pe("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:I=>{I.stopPropagation(),C()},onPointerDown:Ur,children:r.isHidden?n.jsx(xr,{className:"h-3.5 w-3.5"}):n.jsx(br,{className:"h-3.5 w-3.5"})})}),n.jsx(pt,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=C,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=_e):_e=e[24];let $;e[25]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx(Xn,{asChild:!0,children:n.jsx(Ye,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Hr,onPointerDown:zr,children:n.jsx(qn,{className:"h-3.5 w-3.5"})})}),e[25]=$):$=e[25];let ge;e[26]!==b?(ge=I=>{I.stopPropagation(),b()},e[26]=b,e[27]=ge):ge=e[27];let ae;e[28]===Symbol.for("react.memo_cache_sentinel")?(ae=n.jsx(Jn,{className:"h-4 w-4"}),e[28]=ae):ae=e[28];let X;e[29]!==ge?(X=n.jsxs(it,{onClick:ge,children:[ae,"Duplicate"]}),e[29]=ge,e[30]=X):X=e[30];let L;e[31]!==i||e[32]!==j?(L=i&&n.jsxs(it,{className:ja,onClick:I=>{I.stopPropagation(),j()},children:[n.jsx(Yn,{className:"h-4 w-4"}),"Add variant"]}),e[31]=i,e[32]=j,e[33]=L):L=e[33];let O;e[34]!==oe||e[35]!==x?(O=oe&&n.jsxs(it,{className:Lr,onClick:I=>{I.stopPropagation(),x()},children:[n.jsx(ln,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=oe,e[35]=x,e[36]=O):O=e[36];let F;e[37]!==D||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(F=r.isSavedBlock===!0&&!r.isMultivariate&&n.jsxs(it,{onClick:I=>{I.stopPropagation(),D()},children:[n.jsx(ln,{className:"h-4 w-4"}),"Detach"]}),e[37]=D,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=F):F=e[40];let q;e[41]!==v?(q=I=>{I.stopPropagation(),v()},e[41]=v,e[42]=q):q=e[42];let ie;e[43]===Symbol.for("react.memo_cache_sentinel")?(ie=n.jsx(Qn,{className:"h-4 w-4"}),e[43]=ie):ie=e[43];let le;e[44]!==q?(le=n.jsxs(it,{className:"text-destructive focus:text-destructive",onClick:q,children:[ie,"Delete"]}),e[44]=q,e[45]=le):le=e[45];let ve;e[46]!==X||e[47]!==L||e[48]!==O||e[49]!==F||e[50]!==le?(ve=n.jsxs(Zn,{children:[$,n.jsxs(es,{align:"end",className:"w-44",children:[X,L,O,F,le]})]}),e[46]=X,e[47]=L,e[48]=O,e[49]=F,e[50]=le,e[51]=ve):ve=e[51];let ye;return e[52]!==Q||e[53]!==B||e[54]!==p||e[55]!==c||e[56]!==he||e[57]!==W||e[58]!==fe||e[59]!==A||e[60]!==_e||e[61]!==ve||e[62]!==U?(ye=n.jsxs("div",{ref:c,style:he,...Q,...B,role:me,tabIndex:we,onClick:p,onKeyDown:U,className:W,children:[fe,A,_e,ve]}),e[52]=Q,e[53]=B,e[54]=p,e[55]=c,e[56]=he,e[57]=W,e[58]=fe,e[59]=A,e[60]=_e,e[61]=ve,e[62]=U,e[63]=ye):ye=e[63],ye}function zr(f){return f.stopPropagation()}function Hr(f){return f.stopPropagation()}function Ur(f){return f.stopPropagation()}function Gr(f){return f.stopPropagation()}function Wr(){return!1}function qr(f){const e=Ge.c(90),{listKey:r,rawSections:u,sections:d,meta:g,selectedIndex:y,onSelect:p,onReorder:v,onDelete:b,onDuplicate:x,onMakeReusable:C,onToggleHidden:N,onToggleLazy:j,onAddVariant:D,onDetach:o,onAddSection:w,canAddSection:i}=f,se=i===void 0?!0:i;let Q;e[0]!==d.length?(Q=()=>On(d.length),e[0]=d.length,e[1]=Q):Q=e[1];const[B,c]=k.useState(Q),[T,de]=k.useState(null),[P,be]=k.useState(r),[E,he]=k.useState(d.length),K=k.useRef(!1);P!==r?(be(r),he(d.length),c(On(d.length))):E!==d.length&&(he(d.length),c(Z=>Fr(Z,d.length)));let oe;e[2]===Symbol.for("react.memo_cache_sentinel")?(oe={activationConstraint:{distance:8}},e[2]=oe):oe=e[2];let me;e[3]===Symbol.for("react.memo_cache_sentinel")?(me={coordinateGetter:os},e[3]=me):me=e[3];const we=ts(It(ss,oe),It(ns,me));let U;e[4]!==B?(U=B.map(Yr),e[4]=B,e[5]=U):U=e[5];const re=U;let W;e[6]===Symbol.for("react.memo_cache_sentinel")?(W=Z=>{de(String(Z.active.id))},e[6]=W):W=e[6];const fe=W;let A;e[7]!==re||e[8]!==v?(A=Z=>{de(null);const{active:R,over:z}=Z;if(!z||R.id===z.id)return;const Ce=re.indexOf(String(R.id)),pe=re.indexOf(String(z.id));Ce===-1||pe===-1||(c(Qe=>ds(Dt([...Qe],Ce,pe))),K.current=!0,requestAnimationFrame(()=>{K.current=!1}),v?.(Ce,pe))},e[7]=re,e[8]=v,e[9]=A):A=e[9];const _e=A;let $;e[10]===Symbol.for("react.memo_cache_sentinel")?($=()=>{de(null)},e[10]=$):$=e[10];const ge=$;let ae,X,L,O,F,q,ie,le,ve,ye,I,ce,Ne,Me,Ee;if(e[11]!==T||e[12]!==se||e[13]!==B||e[14]!==re||e[15]!==_e||e[16]!==g||e[17]!==w||e[18]!==D||e[19]!==b||e[20]!==o||e[21]!==x||e[22]!==C||e[23]!==p||e[24]!==N||e[25]!==j||e[26]!==u||e[27]!==d||e[28]!==y||e[29]!==we){Me=Symbol.for("react.early_return_sentinel");e:{const Z=R=>{K.current||p(R)};if(e[45]!==T||e[46]!==se||e[47]!==B||e[48]!==w||e[49]!==u||e[50]!==d){const R=T?B.find(z=>z.id===T):null;if(O=R!=null?d[R.index]:null,L=R!=null?u[R.index]:void 0,B.length===0){let z;e[54]===Symbol.for("react.memo_cache_sentinel")?(z=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=z):z=e[54];const Ce=!se;let pe;e[55]===Symbol.for("react.memo_cache_sentinel")?(pe=n.jsx(cn,{size:14}),e[55]=pe):pe=e[55];let Qe;e[56]!==w||e[57]!==Ce?(Qe=n.jsxs("div",{className:"space-y-2",children:[z,n.jsxs(Ye,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Ce,onClick:w,children:[pe,"Add section"]})]}),e[56]=w,e[57]=Ce,e[58]=Qe):Qe=e[58],Me=Qe;break e}Ne=Pe(R&&"cursor-grabbing"),e[45]=T,e[46]=se,e[47]=B,e[48]=w,e[49]=u,e[50]=d,e[51]=L,e[52]=O,e[53]=Ne}else L=e[51],O=e[52],Ne=e[53];X=is,le=we,ve=ls,ye=fe,I=_e,ce=ge,ae=cs,q=re,ie=kr,Ee="space-y-1",F=B.map(R=>{const z=d[R.index];return z?n.jsx(Ir,{sortableId:R.id,section:z,raw:u[R.index],meta:g,selected:y===R.index,onSelect:()=>Z(R.index),onDelete:()=>b(R.index),onDuplicate:()=>x(R.index),onMakeReusable:()=>C(R.index),onToggleHidden:()=>N(R.index),onToggleLazy:()=>j(R.index),onAddVariant:()=>D(R.index),onDetach:()=>o(R.index)},R.id):null})}e[11]=T,e[12]=se,e[13]=B,e[14]=re,e[15]=_e,e[16]=g,e[17]=w,e[18]=D,e[19]=b,e[20]=o,e[21]=x,e[22]=C,e[23]=p,e[24]=N,e[25]=j,e[26]=u,e[27]=d,e[28]=y,e[29]=we,e[30]=ae,e[31]=X,e[32]=L,e[33]=O,e[34]=F,e[35]=q,e[36]=ie,e[37]=le,e[38]=ve,e[39]=ye,e[40]=I,e[41]=ce,e[42]=Ne,e[43]=Me,e[44]=Ee}else ae=e[30],X=e[31],L=e[32],O=e[33],F=e[34],q=e[35],ie=e[36],le=e[37],ve=e[38],ye=e[39],I=e[40],ce=e[41],Ne=e[42],Me=e[43],Ee=e[44];if(Me!==Symbol.for("react.early_return_sentinel"))return Me;let Oe;e[59]!==F||e[60]!==Ee?(Oe=n.jsx("div",{className:Ee,children:F}),e[59]=F,e[60]=Ee,e[61]=Oe):Oe=e[61];let Ve;e[62]!==ae||e[63]!==q||e[64]!==ie||e[65]!==Oe?(Ve=n.jsx(ae,{items:q,strategy:ie,children:Oe}),e[62]=ae,e[63]=q,e[64]=ie,e[65]=Oe,e[66]=Ve):Ve=e[66];let Fe;e[67]!==L||e[68]!==O||e[69]!==g?(Fe=O?n.jsx("div",{className:Pe("cursor-grabbing shadow-lg ring-1 ring-border/60",fs(O,!1)),children:n.jsx(ms,{section:O,raw:L,meta:g})}):null,e[67]=L,e[68]=O,e[69]=g,e[70]=Fe):Fe=e[70];let Be;e[71]!==Fe?(Be=n.jsx(us,{dropAnimation:null,children:Fe}),e[71]=Fe,e[72]=Be):Be=e[72];let Ke;e[73]!==X||e[74]!==le||e[75]!==ve||e[76]!==ye||e[77]!==I||e[78]!==ce||e[79]!==Ve||e[80]!==Be?(Ke=n.jsxs(X,{sensors:le,collisionDetection:ve,onDragStart:ye,onDragEnd:I,onDragCancel:ce,children:[Ve,Be]}),e[73]=X,e[74]=le,e[75]=ve,e[76]=ye,e[77]=I,e[78]=ce,e[79]=Ve,e[80]=Be,e[81]=Ke):Ke=e[81];const Le=!se;let Ie;e[82]===Symbol.for("react.memo_cache_sentinel")?(Ie=n.jsx(cn,{size:14}),e[82]=Ie):Ie=e[82];let Ae;e[83]!==w||e[84]!==Le?(Ae=n.jsxs(Ye,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:Le,onClick:w,children:[Ie,"Add section"]}),e[83]=w,e[84]=Le,e[85]=Ae):Ae=e[85];let ue;return e[86]!==Ne||e[87]!==Ke||e[88]!==Ae?(ue=n.jsxs("div",{className:Ne,children:[Ke,Ae]}),e[86]=Ne,e[87]=Ke,e[88]=Ae,e[89]=ue):ue=e[89],ue}function Yr(f){return f.id}function Bn(f){const e=Ge.c(38),{open:r,initialName:u,autoLabel:d,isPending:g,onSubmit:y,onOpenChange:p}=f,v=g===void 0?!1:g,[b,x]=k.useState(u),[C,N]=k.useState(r);r!==C&&(N(r),r&&x(u));let j;e[0]!==v||e[1]!==p?(j=me=>{!me&&!v&&p(!1)},e[0]=v,e[1]=p,e[2]=j):j=e[2];const D=j;let o;e[3]!==v||e[4]!==b||e[5]!==y?(o=async me=>{me.preventDefault(),!v&&await y(b.trim())},e[3]=v,e[4]=b,e[5]=y,e[6]=o):o=e[6];const w=o;let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(mr,{children:"Rename variant"}),e[7]=i):i=e[7];const se=d||"the rule";let Q;e[8]!==se?(Q=n.jsxs(fr,{children:[i,n.jsxs(pr,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",n.jsx("span",{className:"font-medium",children:se}),"."]})]}),e[8]=se,e[9]=Q):Q=e[9];let B;e[10]===Symbol.for("react.memo_cache_sentinel")?(B=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=B):B=e[10];let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=me=>x(me.target.value),e[11]=c):c=e[11];let T;e[12]!==d||e[13]!==v||e[14]!==b?(T=n.jsxs("div",{className:"space-y-1.5 py-4",children:[B,n.jsx(Sr,{id:"variant-rename-name",value:b,onChange:c,placeholder:d,autoFocus:!0,disabled:v})]}),e[12]=d,e[13]=v,e[14]=b,e[15]=T):T=e[15];let de;e[16]!==p?(de=()=>p(!1),e[16]=p,e[17]=de):de=e[17];let P;e[18]!==v||e[19]!==de?(P=n.jsx(Ye,{type:"button",variant:"outline",onClick:de,disabled:v,children:"Cancel"}),e[18]=v,e[19]=de,e[20]=P):P=e[20];let be;e[21]!==v?(be=v?n.jsxs(n.Fragment,{children:[n.jsx(Hn,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=v,e[22]=be):be=e[22];let E;e[23]!==v||e[24]!==be?(E=n.jsx(Ye,{type:"submit",disabled:v,children:be}),e[23]=v,e[24]=be,e[25]=E):E=e[25];let he;e[26]!==P||e[27]!==E?(he=n.jsxs(hr,{children:[P,E]}),e[26]=P,e[27]=E,e[28]=he):he=e[28];let K;e[29]!==w||e[30]!==he||e[31]!==Q||e[32]!==T?(K=n.jsx(gr,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:w,children:[Q,T,he]})}),e[29]=w,e[30]=he,e[31]=Q,e[32]=T,e[33]=K):K=e[33];let oe;return e[34]!==D||e[35]!==r||e[36]!==K?(oe=n.jsx(vr,{open:r,onOpenChange:D,children:K}),e[34]=D,e[35]=r,e[36]=K,e[37]=oe):oe=e[37],oe}const Jr="oklch(0.65 0.15 160)",ps="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 un(f){const e=Ge.c(5),{rule:r,matchers:u}=f,d=r?.__resolveType??"";let g;if(e[0]!==u||e[1]!==d){const b=u.find(x=>x.resolveType===d)?.iconName??ka(d);g=lr(b),e[0]=u,e[1]=d,e[2]=g}else g=e[2];const y=g;if(!y)return null;let p;return e[3]!==y?(p=n.jsx(y,{size:14,className:"shrink-0"}),e[3]=y,e[4]=p):p=e[4],p}function Ln(f){return f.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
|
|
1
|
+
import{c as Ge,r as k,l as Pe,j as n,B as Ye,i as Hn,m as ha,t as te,K as ga}from"./index-BlbGtC1U.js";import{r as va,a as Sa,s as ba,i as Un,c as ya,b as xa,G as _a,V as ja,d as ka,e as Rt,f as wa,g as Na,h as Ra,j as Da,k as Va,l as Ca,m as Ta,n as Pa,o as Aa,p as $t,q as Ot,t as Ma,v as ut,w as kt,x as Ea,y as Ka,z as Je,A as Cn,S as $a,M as Tn,B as wt,C as Bt,D as Oa,E as sn,P as Ba,F as et,H as bt,I as La,J as Fa,K as Ia,L as za,N as Ha,O as Ua,Q as dt,R as Ga,T as Wa,U as qa,W as Pn,X as Nt,Y as Ya,Z as Ja,_ as Qa,$ as Xa,a0 as Za,a1 as an,a2 as An,a3 as Mn,a4 as yt,a5 as Lt,a6 as En,a7 as er,a8 as tr,a9 as nr,aa as rn,ab as sr,ac as Gn,ad as Kn,ae as ar}from"./index-BxxTJpbB.js";import{t as rr}from"./ChevronDown-DM7Zg7z0.js";import{n as or}from"./ChevronLeft-lcwdftXp.js";import{i as Wn}from"./ChevronRight-CKc4NZet.js";import{n as ir}from"./ChevronUp-uk87fvlM.js";import{L as ln,E as qn,X as Yn,l as lr,M as cr,N as ur}from"./agent-icon-C1dYfmgT.js";import{i as dr}from"./Globe01-DD63JJzL.js";import{S as Ft}from"./scroll-area-B3-Gj80e.js";import{T as mt,a as ft,b as pt}from"./tooltip-oPF11xOc.js";import{a as mr,c as fr,b as pr,D as hr,d as gr,e as vr}from"./dialog-Dj81EdMo.js";import{I as Sr}from"./input-DHDgjmX0.js";import{s as br,a as Jn}from"./Eye-BHPT57Tm.js";import{c as yr}from"./ZoomOut-DoQt1wdd.js";import{i as xr}from"./Settings02-C-qi4-Q_.js";import{s as cn}from"./Plus-Bi8BbQwT.js";import{s as Qn}from"./Trash01-CbqEHpx0.js";import{i as _r}from"./Zap-DE8YfoLa.js";import{c as it,a as Xn,D as Zn,b as es,g as jr}from"./dropdown-menu-UriF3iJ3.js";import{b as ts,c as It,K as ns,P as ss,e as as,C as rs,s as os,l as Dt,D as is,d as ls,S as cs,v as kr,k as us,p as wr}from"./sortable.esm-DUIS-SLz.js";import{r as $n,u as Nr,d as Rr,a as Dr,i as Vr,f as Cr,P as Tr,b as Pr,S as Ar}from"./page-seo-form-B43PbD8q.js";import{b as Mr}from"./Tool01-D4LA61If.js";import{A as Er}from"./add-section-modal-uGR2Gjzo.js";import"./index-0P9allDr.js";import"./chat-context-DJ9kQ1Gu.js";import"./hooks-dZjznYow.js";import"./use-mcp-client-BYcrk6lz.js";import"./auth-CPEoqZ5f.js";import"./decopilot-sse-pool-CyIsiJ1H.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-Bkiriz_M.js";import"./use-collections-DZi4alPB.js";import"./use-ai-providers-CZx1BFdY.js";import"./studio-tools-7mZABBZl.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings-ClKaDrE7.js";import"./drawer-tdj9aCh7.js";import"./collection-search-C4TcbQ-p.js";import"./SearchMd-BkXN-Kzx.js";import"./use-mobile-BKRfr7ic.js";import"./use-mcp-prompts-BjyIsgXC.js";import"./X-DEdLuuqP.js";import"./shell-layout-BihuyTtm.js";import"./avatar-VZM5i0Ki.js";import"./User01-Cykpl4hh.js";import"./Users03-BkBCkWQn.js";import"./SearchLg-D0nJXyNY.js";import"./Stars02-DC4cG_dc.js";import"./XClose-ChjX78ei.js";import"./CheckCircle-p5tYLXMg.js";import"./FilterLines-HsRbW4y-.js";import"./required-auth-layout-BdWFlHgh.js";import"./use-org-sso-DHz7VJ1a.js";import"./SwitchHorizontal01-DkcNGyLK.js";import"./ZapSquare-hkjSQWO8.js";import"./Star01-D2l7-L0I.js";import"./Upload01-C_kFf8l0.js";import"./AlertCircle-BJzQ1lVJ.js";import"./form--KUjsjlO.js";import"./label-PsbKXPB5.js";import"./select-DxONb3Kt.js";import"./XCircle-IAOWYKKA.js";import"./tabs-nJ0qk72w.js";import"./toggle-group-D22tG_vD.js";import"./Monitor01-BKqFs8Gp.js";import"./connect-desktop-dialog-C7OzpQot.js";import"./decopilot-DrrsAbRN.js";import"./checkbox-CHfAThPE.js";import"./skeleton-BG0I4KDd.js";import"./Key01-V7SPr6j-.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-BlH2FRiM.js";import"./card-DjLKG66H.js";import"./ArrowUpRight-CA22UP6Q.js";import"./Stars01-CBpnmt-0.js";import"./popover-Do5OoBkb.js";import"./command-CZZOMfiA.js";import"./index-CSUPQJzr.js";import"./useInfiniteQuery-bB2OO4_F.js";import"./use-infinite-scroll-c7yDanFw.js";import"./question-004-sINsf4GQ.js";import"./integration-icon-m4V5ew5R.js";import"./use-status-sounds-CBCN2gk-.js";import"./empty-state-pCesbyUM.js";import"./toolbar-DktIJIGj.js";import"./preview-dialog-DxRKsymK.js";import"./LinkExternal01-DCed5R2c.js";import"./index-CTgm7OBW.js";import"./file-type-icon-Czo8zyOj.js";import"./LayoutLeft-y1fOcQ0I.js";import"./use-connection-BaK7gZK8.js";import"./use-mcp-tools-DYc-d8kf.js";import"./types-DZM3oHCm.js";import"./use-capability-CREa5hxg.js";import"./textarea-HTN5AIWJ.js";import"./shell-route-loading-De-l4N89.js";import"./extract-connection-data-DumI9Ge5.js";import"./index-CsOdgboE.js";import"./mcp-oauth-D8vUJRgp.js";import"./badge-BGbD2JMR.js";import"./connection-slug-eyAPH6o3.js";import"./alert-dialog-DZvgeli3.js";import"./switch-Dprre6Tx.js";import"./Play-CKPBuURg.js";import"./use-debounced-autosave-DCle0l35.js";import"./index-BBWislhf.js";import"./sidebar-BjIzPMot.js";import"./sheet-C2Kfge9r.js";import"./search-input-Cmd3sBC3.js";import"./collection-tabs-CA6SI6KD.js";import"./github-repo-picker-B2FrynHJ.js";import"./use-debounced-value-D0ar8P23.js";import"./authenticate-and-persist-oauth-BgoQZkYE.js";import"./use-navigate-to-agent-D_fgYk51.js";import"./Users01-fhFCwrP8.js";import"./use-secrets-DLWDaup6.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./view-mode-toggle-DbKux4TQ.js";import"./DotsVertical-DXDm8Xzs.js";import"./automation-runs-B_ZKhNSO.js";import"./table-2dv8FC6q.js";import"./use-members-CDV7-ikh.js";import"./use-org-auth-client-C2F1ILpp.js";import"./task-status-CvjZ7N6W.js";import"./use-automations-DttN1_QI.js";import"./useSuspenseInfiniteQuery-CgFmFjuu.js";import"./use-file-configs-CZMtO580.js";import"./monaco-editor-C6TIlc3v.js";import"./select-model-RfbC0RGe.js";import"./automation-list-row-Bic_MYAx.js";import"./Globe04-CokcJjWp.js";import"./HardDrive-xu95HLc0.js";import"./Sun-ubimVQVz.js";import"./Palette-DkcZCW1n.js";import"./Shield01-BaBnwolv.js";import"./use-clock-tick-D4shCSZy.js";import"./use-copy-BGXnmJ0Y.js";import"./content-blocks-o63cs2vh.js";import"./connection-card-CFZ9gVcC.js";import"./use-registry-connections-Bgebk2mm.js";import"./connection-form-helpers-CF-WQyTc.js";function Kr(f){return f.schema?.definitions??f.schema?.$defs??{}}function $r(f,e){const r=Kr(e),u=r[btoa(f)];if(!u)return;let d=typeof u.image=="string"?u.image:void 0;if(!d&&Array.isArray(u.allOf)){const g=u.allOf.find(y=>typeof y.$ref=="string")?.$ref;if(typeof g=="string"){const y=g.replace("#/definitions/",""),p=r[y];d=typeof p?.image=="string"?p.image:void 0}}if(d?.includes("{{{"))return d}function Or(f,e){if(!e)return;const r=va(f);if(!r)return;const u=$r(r.resolveType,e);if(!u)return;const d=Sa(u,r.data);if(d)return ba(d)}const Br="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",Lr="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 On(f){return Array.from({length:f},(e,r)=>({id:crypto.randomUUID(),index:r}))}function ds(f){return f.map((e,r)=>({...e,index:r}))}function Fr(f,e){if(e===f.length)return f;if(e<f.length)return ds(f.slice(0,e));const r=Array.from({length:e-f.length},(u,d)=>({id:crypto.randomUUID(),index:f.length+d}));return[...f,...r]}function ms(f){const e=Ge.c(20),{section:r,raw:u,meta:d}=f,g=r.isSavedBlock===!0,y=r.isMultivariate===!0;let p;e[0]!==d||e[1]!==u?(p=u&&d?Or(u,d):void 0,e[0]=d,e[1]=u,e[2]=p):p=e[2];const v=p;let b;e[3]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(yr,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=b):b=e[3];let x;e[4]!==v?(x=v&&n.jsx("img",{src:v,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=v,e[5]=x):x=e[5];let C;e[6]!==y||e[7]!==g?(C=g?{color:_a}:y?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=y,e[7]=g,e[8]=C):C=e[8];let N;e[9]!==C?(N=n.jsx(ln,{className:"h-4 w-4 shrink-0",style:C}),e[9]=C,e[10]=N):N=e[10];const j=r.isHidden&&"line-through opacity-50";let D;e[11]!==j?(D=Pe("min-w-0 flex-1 truncate text-sm font-medium",j),e[11]=j,e[12]=D):D=e[12];let o;e[13]!==r.label||e[14]!==D?(o=n.jsx("span",{className:D,children:r.label}),e[13]=r.label,e[14]=D,e[15]=o):o=e[15];let w;return e[16]!==x||e[17]!==N||e[18]!==o?(w=n.jsxs(n.Fragment,{children:[b,x,N,o]}),e[16]=x,e[17]=N,e[18]=o,e[19]=w):w=e[19],w}function fs(f,e){const r=f.isSavedBlock===!0,u=f.isMultivariate===!0;return Pe("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?Br:u?"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 Ir(f){const e=Ge.c(64),{section:r,raw:u,meta:d,sortableId:g,selected:y,onSelect:p,onDelete:v,onDuplicate:b,onMakeReusable:x,onToggleHidden:C,onToggleLazy:N,onAddVariant:j,onDetach:D}=f,o=u?Un(u.__resolveType??""):!1;let w;e[0]!==r?(w=ya(r),e[0]=r,e[1]=w):w=e[1];const i=w;let se;e[2]!==g?(se={id:g,animateLayoutChanges:Wr},e[2]=g,e[3]=se):se=e[3];const{attributes:Q,listeners:B,setNodeRef:c,transform:T,isDragging:de}=as(se);let P;e[4]!==T?(P=rs.Transform.toString(T?{...T,x:0}:null),e[4]=T,e[5]=P):P=e[5];const be=de?0:void 0;let E;e[6]!==P||e[7]!==be?(E={transform:P,opacity:be},e[6]=P,e[7]=be,e[8]=E):E=e[8];const he=E;let K;e[9]!==r?(K=xa(r),e[9]=r,e[10]=K):K=e[10];const oe=K,me="button",we=0;let U;e[11]!==p?(U=I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),p())},e[11]=p,e[12]=U):U=e[12];const re=de?"cursor-grabbing":"cursor-pointer";let W;e[13]!==r||e[14]!==y||e[15]!==re?(W=Pe("touch-none transition-colors",re,fs(r,y)),e[13]=r,e[14]=y,e[15]=re,e[16]=W):W=e[16];let fe;e[17]!==d||e[18]!==u||e[19]!==r?(fe=n.jsx(ms,{section:r,raw:u,meta:d}),e[17]=d,e[18]=u,e[19]=r,e[20]=fe):fe=e[20];const A=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ye,{type:"button",variant:"ghost",size:"icon","aria-label":o?"Disable async render":"Enable async render",className:Pe("h-7 w-7 shrink-0",o?"":"opacity-0 group-hover:opacity-100"),onClick:I=>{I.stopPropagation(),N()},onPointerDown:Gr,children:n.jsx(_r,{className:Pe("h-3.5 w-3.5",o&&"text-yellow-500")})})}),n.jsx(pt,{side:"bottom",children:o?"Disable async render":"Enable async render"})]});let _e;e[21]!==C||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(_e=!r.isMultivariate&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ye,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Pe("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:I=>{I.stopPropagation(),C()},onPointerDown:Ur,children:r.isHidden?n.jsx(xr,{className:"h-3.5 w-3.5"}):n.jsx(br,{className:"h-3.5 w-3.5"})})}),n.jsx(pt,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=C,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=_e):_e=e[24];let $;e[25]===Symbol.for("react.memo_cache_sentinel")?($=n.jsx(Xn,{asChild:!0,children:n.jsx(Ye,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Hr,onPointerDown:zr,children:n.jsx(qn,{className:"h-3.5 w-3.5"})})}),e[25]=$):$=e[25];let ge;e[26]!==b?(ge=I=>{I.stopPropagation(),b()},e[26]=b,e[27]=ge):ge=e[27];let ae;e[28]===Symbol.for("react.memo_cache_sentinel")?(ae=n.jsx(Jn,{className:"h-4 w-4"}),e[28]=ae):ae=e[28];let X;e[29]!==ge?(X=n.jsxs(it,{onClick:ge,children:[ae,"Duplicate"]}),e[29]=ge,e[30]=X):X=e[30];let L;e[31]!==i||e[32]!==j?(L=i&&n.jsxs(it,{className:ja,onClick:I=>{I.stopPropagation(),j()},children:[n.jsx(Yn,{className:"h-4 w-4"}),"Add variant"]}),e[31]=i,e[32]=j,e[33]=L):L=e[33];let O;e[34]!==oe||e[35]!==x?(O=oe&&n.jsxs(it,{className:Lr,onClick:I=>{I.stopPropagation(),x()},children:[n.jsx(ln,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=oe,e[35]=x,e[36]=O):O=e[36];let F;e[37]!==D||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(F=r.isSavedBlock===!0&&!r.isMultivariate&&n.jsxs(it,{onClick:I=>{I.stopPropagation(),D()},children:[n.jsx(ln,{className:"h-4 w-4"}),"Detach"]}),e[37]=D,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=F):F=e[40];let q;e[41]!==v?(q=I=>{I.stopPropagation(),v()},e[41]=v,e[42]=q):q=e[42];let ie;e[43]===Symbol.for("react.memo_cache_sentinel")?(ie=n.jsx(Qn,{className:"h-4 w-4"}),e[43]=ie):ie=e[43];let le;e[44]!==q?(le=n.jsxs(it,{className:"text-destructive focus:text-destructive",onClick:q,children:[ie,"Delete"]}),e[44]=q,e[45]=le):le=e[45];let ve;e[46]!==X||e[47]!==L||e[48]!==O||e[49]!==F||e[50]!==le?(ve=n.jsxs(Zn,{children:[$,n.jsxs(es,{align:"end",className:"w-44",children:[X,L,O,F,le]})]}),e[46]=X,e[47]=L,e[48]=O,e[49]=F,e[50]=le,e[51]=ve):ve=e[51];let ye;return e[52]!==Q||e[53]!==B||e[54]!==p||e[55]!==c||e[56]!==he||e[57]!==W||e[58]!==fe||e[59]!==A||e[60]!==_e||e[61]!==ve||e[62]!==U?(ye=n.jsxs("div",{ref:c,style:he,...Q,...B,role:me,tabIndex:we,onClick:p,onKeyDown:U,className:W,children:[fe,A,_e,ve]}),e[52]=Q,e[53]=B,e[54]=p,e[55]=c,e[56]=he,e[57]=W,e[58]=fe,e[59]=A,e[60]=_e,e[61]=ve,e[62]=U,e[63]=ye):ye=e[63],ye}function zr(f){return f.stopPropagation()}function Hr(f){return f.stopPropagation()}function Ur(f){return f.stopPropagation()}function Gr(f){return f.stopPropagation()}function Wr(){return!1}function qr(f){const e=Ge.c(90),{listKey:r,rawSections:u,sections:d,meta:g,selectedIndex:y,onSelect:p,onReorder:v,onDelete:b,onDuplicate:x,onMakeReusable:C,onToggleHidden:N,onToggleLazy:j,onAddVariant:D,onDetach:o,onAddSection:w,canAddSection:i}=f,se=i===void 0?!0:i;let Q;e[0]!==d.length?(Q=()=>On(d.length),e[0]=d.length,e[1]=Q):Q=e[1];const[B,c]=k.useState(Q),[T,de]=k.useState(null),[P,be]=k.useState(r),[E,he]=k.useState(d.length),K=k.useRef(!1);P!==r?(be(r),he(d.length),c(On(d.length))):E!==d.length&&(he(d.length),c(Z=>Fr(Z,d.length)));let oe;e[2]===Symbol.for("react.memo_cache_sentinel")?(oe={activationConstraint:{distance:8}},e[2]=oe):oe=e[2];let me;e[3]===Symbol.for("react.memo_cache_sentinel")?(me={coordinateGetter:os},e[3]=me):me=e[3];const we=ts(It(ss,oe),It(ns,me));let U;e[4]!==B?(U=B.map(Yr),e[4]=B,e[5]=U):U=e[5];const re=U;let W;e[6]===Symbol.for("react.memo_cache_sentinel")?(W=Z=>{de(String(Z.active.id))},e[6]=W):W=e[6];const fe=W;let A;e[7]!==re||e[8]!==v?(A=Z=>{de(null);const{active:R,over:z}=Z;if(!z||R.id===z.id)return;const Ce=re.indexOf(String(R.id)),pe=re.indexOf(String(z.id));Ce===-1||pe===-1||(c(Qe=>ds(Dt([...Qe],Ce,pe))),K.current=!0,requestAnimationFrame(()=>{K.current=!1}),v?.(Ce,pe))},e[7]=re,e[8]=v,e[9]=A):A=e[9];const _e=A;let $;e[10]===Symbol.for("react.memo_cache_sentinel")?($=()=>{de(null)},e[10]=$):$=e[10];const ge=$;let ae,X,L,O,F,q,ie,le,ve,ye,I,ce,Ne,Me,Ee;if(e[11]!==T||e[12]!==se||e[13]!==B||e[14]!==re||e[15]!==_e||e[16]!==g||e[17]!==w||e[18]!==D||e[19]!==b||e[20]!==o||e[21]!==x||e[22]!==C||e[23]!==p||e[24]!==N||e[25]!==j||e[26]!==u||e[27]!==d||e[28]!==y||e[29]!==we){Me=Symbol.for("react.early_return_sentinel");e:{const Z=R=>{K.current||p(R)};if(e[45]!==T||e[46]!==se||e[47]!==B||e[48]!==w||e[49]!==u||e[50]!==d){const R=T?B.find(z=>z.id===T):null;if(O=R!=null?d[R.index]:null,L=R!=null?u[R.index]:void 0,B.length===0){let z;e[54]===Symbol.for("react.memo_cache_sentinel")?(z=n.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=z):z=e[54];const Ce=!se;let pe;e[55]===Symbol.for("react.memo_cache_sentinel")?(pe=n.jsx(cn,{size:14}),e[55]=pe):pe=e[55];let Qe;e[56]!==w||e[57]!==Ce?(Qe=n.jsxs("div",{className:"space-y-2",children:[z,n.jsxs(Ye,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Ce,onClick:w,children:[pe,"Add section"]})]}),e[56]=w,e[57]=Ce,e[58]=Qe):Qe=e[58],Me=Qe;break e}Ne=Pe(R&&"cursor-grabbing"),e[45]=T,e[46]=se,e[47]=B,e[48]=w,e[49]=u,e[50]=d,e[51]=L,e[52]=O,e[53]=Ne}else L=e[51],O=e[52],Ne=e[53];X=is,le=we,ve=ls,ye=fe,I=_e,ce=ge,ae=cs,q=re,ie=kr,Ee="space-y-1",F=B.map(R=>{const z=d[R.index];return z?n.jsx(Ir,{sortableId:R.id,section:z,raw:u[R.index],meta:g,selected:y===R.index,onSelect:()=>Z(R.index),onDelete:()=>b(R.index),onDuplicate:()=>x(R.index),onMakeReusable:()=>C(R.index),onToggleHidden:()=>N(R.index),onToggleLazy:()=>j(R.index),onAddVariant:()=>D(R.index),onDetach:()=>o(R.index)},R.id):null})}e[11]=T,e[12]=se,e[13]=B,e[14]=re,e[15]=_e,e[16]=g,e[17]=w,e[18]=D,e[19]=b,e[20]=o,e[21]=x,e[22]=C,e[23]=p,e[24]=N,e[25]=j,e[26]=u,e[27]=d,e[28]=y,e[29]=we,e[30]=ae,e[31]=X,e[32]=L,e[33]=O,e[34]=F,e[35]=q,e[36]=ie,e[37]=le,e[38]=ve,e[39]=ye,e[40]=I,e[41]=ce,e[42]=Ne,e[43]=Me,e[44]=Ee}else ae=e[30],X=e[31],L=e[32],O=e[33],F=e[34],q=e[35],ie=e[36],le=e[37],ve=e[38],ye=e[39],I=e[40],ce=e[41],Ne=e[42],Me=e[43],Ee=e[44];if(Me!==Symbol.for("react.early_return_sentinel"))return Me;let Oe;e[59]!==F||e[60]!==Ee?(Oe=n.jsx("div",{className:Ee,children:F}),e[59]=F,e[60]=Ee,e[61]=Oe):Oe=e[61];let Ve;e[62]!==ae||e[63]!==q||e[64]!==ie||e[65]!==Oe?(Ve=n.jsx(ae,{items:q,strategy:ie,children:Oe}),e[62]=ae,e[63]=q,e[64]=ie,e[65]=Oe,e[66]=Ve):Ve=e[66];let Fe;e[67]!==L||e[68]!==O||e[69]!==g?(Fe=O?n.jsx("div",{className:Pe("cursor-grabbing shadow-lg ring-1 ring-border/60",fs(O,!1)),children:n.jsx(ms,{section:O,raw:L,meta:g})}):null,e[67]=L,e[68]=O,e[69]=g,e[70]=Fe):Fe=e[70];let Be;e[71]!==Fe?(Be=n.jsx(us,{dropAnimation:null,children:Fe}),e[71]=Fe,e[72]=Be):Be=e[72];let Ke;e[73]!==X||e[74]!==le||e[75]!==ve||e[76]!==ye||e[77]!==I||e[78]!==ce||e[79]!==Ve||e[80]!==Be?(Ke=n.jsxs(X,{sensors:le,collisionDetection:ve,onDragStart:ye,onDragEnd:I,onDragCancel:ce,children:[Ve,Be]}),e[73]=X,e[74]=le,e[75]=ve,e[76]=ye,e[77]=I,e[78]=ce,e[79]=Ve,e[80]=Be,e[81]=Ke):Ke=e[81];const Le=!se;let Ie;e[82]===Symbol.for("react.memo_cache_sentinel")?(Ie=n.jsx(cn,{size:14}),e[82]=Ie):Ie=e[82];let Ae;e[83]!==w||e[84]!==Le?(Ae=n.jsxs(Ye,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:Le,onClick:w,children:[Ie,"Add section"]}),e[83]=w,e[84]=Le,e[85]=Ae):Ae=e[85];let ue;return e[86]!==Ne||e[87]!==Ke||e[88]!==Ae?(ue=n.jsxs("div",{className:Ne,children:[Ke,Ae]}),e[86]=Ne,e[87]=Ke,e[88]=Ae,e[89]=ue):ue=e[89],ue}function Yr(f){return f.id}function Bn(f){const e=Ge.c(38),{open:r,initialName:u,autoLabel:d,isPending:g,onSubmit:y,onOpenChange:p}=f,v=g===void 0?!1:g,[b,x]=k.useState(u),[C,N]=k.useState(r);r!==C&&(N(r),r&&x(u));let j;e[0]!==v||e[1]!==p?(j=me=>{!me&&!v&&p(!1)},e[0]=v,e[1]=p,e[2]=j):j=e[2];const D=j;let o;e[3]!==v||e[4]!==b||e[5]!==y?(o=async me=>{me.preventDefault(),!v&&await y(b.trim())},e[3]=v,e[4]=b,e[5]=y,e[6]=o):o=e[6];const w=o;let i;e[7]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(mr,{children:"Rename variant"}),e[7]=i):i=e[7];const se=d||"the rule";let Q;e[8]!==se?(Q=n.jsxs(fr,{children:[i,n.jsxs(pr,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",n.jsx("span",{className:"font-medium",children:se}),"."]})]}),e[8]=se,e[9]=Q):Q=e[9];let B;e[10]===Symbol.for("react.memo_cache_sentinel")?(B=n.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=B):B=e[10];let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=me=>x(me.target.value),e[11]=c):c=e[11];let T;e[12]!==d||e[13]!==v||e[14]!==b?(T=n.jsxs("div",{className:"space-y-1.5 py-4",children:[B,n.jsx(Sr,{id:"variant-rename-name",value:b,onChange:c,placeholder:d,autoFocus:!0,disabled:v})]}),e[12]=d,e[13]=v,e[14]=b,e[15]=T):T=e[15];let de;e[16]!==p?(de=()=>p(!1),e[16]=p,e[17]=de):de=e[17];let P;e[18]!==v||e[19]!==de?(P=n.jsx(Ye,{type:"button",variant:"outline",onClick:de,disabled:v,children:"Cancel"}),e[18]=v,e[19]=de,e[20]=P):P=e[20];let be;e[21]!==v?(be=v?n.jsxs(n.Fragment,{children:[n.jsx(Hn,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=v,e[22]=be):be=e[22];let E;e[23]!==v||e[24]!==be?(E=n.jsx(Ye,{type:"submit",disabled:v,children:be}),e[23]=v,e[24]=be,e[25]=E):E=e[25];let he;e[26]!==P||e[27]!==E?(he=n.jsxs(hr,{children:[P,E]}),e[26]=P,e[27]=E,e[28]=he):he=e[28];let K;e[29]!==w||e[30]!==he||e[31]!==Q||e[32]!==T?(K=n.jsx(gr,{className:"sm:max-w-md",children:n.jsxs("form",{onSubmit:w,children:[Q,T,he]})}),e[29]=w,e[30]=he,e[31]=Q,e[32]=T,e[33]=K):K=e[33];let oe;return e[34]!==D||e[35]!==r||e[36]!==K?(oe=n.jsx(vr,{open:r,onOpenChange:D,children:K}),e[34]=D,e[35]=r,e[36]=K,e[37]=oe):oe=e[37],oe}const Jr="oklch(0.65 0.15 160)",ps="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 un(f){const e=Ge.c(5),{rule:r,matchers:u}=f,d=r?.__resolveType??"";let g;if(e[0]!==u||e[1]!==d){const b=u.find(x=>x.resolveType===d)?.iconName??ka(d);g=lr(b),e[0]=u,e[1]=d,e[2]=g}else g=e[2];const y=g;if(!y)return null;let p;return e[3]!==y?(p=n.jsx(y,{size:14,className:"shrink-0"}),e[3]=y,e[4]=p):p=e[4],p}function Ln(f){return f.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
|
|
2
2
|
`)}function on(f){return f.map((e,r)=>({id:crypto.randomUUID(),index:r,variant:e}))}function Qr(f){return f.map((e,r)=>({...e,index:r}))}function Xr(f){const e=Ge.c(55),{entry:r,sortableId:u,isActive:d,canDelete:g,decofile:y,meta:p,matchers:v,onSelect:b,onRename:x,onDuplicate:C,onDelete:N}=f;let j;e[0]!==u?(j={id:u,animateLayoutChanges:to},e[0]=u,e[1]=j):j=e[1];const{attributes:D,listeners:o,setNodeRef:w,transform:i,isDragging:se}=as(j);let Q;e[2]!==i?(Q=rs.Transform.toString(i?{...i,y:0}:null),e[2]=i,e[3]=Q):Q=e[3];const B=se?0:void 0;let c;e[4]!==Q||e[5]!==B?(c={transform:Q,opacity:B},e[4]=Q,e[5]=B,e[6]=c):c=e[6];const T=c,de=p??void 0;let P;e[7]!==y||e[8]!==r.variant.rule||e[9]!==de?(P=Rt(r.variant.rule,y,de),e[7]=y,e[8]=r.variant.rule,e[9]=de,e[10]=P):P=e[10];const be=P,E=d?ps:"text-muted-foreground hover:bg-muted hover:text-foreground",he=se?"cursor-grabbing":"cursor-grab";let K;e[11]!==E||e[12]!==he?(K=Pe("group shrink-0 inline-flex items-center rounded-md transition-colors touch-none",E,he),e[11]=E,e[12]=he,e[13]=K):K=e[13];let oe;e[14]!==be||e[15]!==v?(oe=n.jsx(un,{rule:be,matchers:v}),e[14]=be,e[15]=v,e[16]=oe):oe=e[16];let me;e[17]!==r.variant.label?(me=n.jsx("span",{className:"truncate",children:r.variant.label}),e[17]=r.variant.label,e[18]=me):me=e[18];let we;e[19]!==D||e[20]!==o||e[21]!==b||e[22]!==oe||e[23]!==me?(we=n.jsxs("button",{type:"button",...D,...o,onClick:b,className:"inline-flex items-center gap-1.5 h-8 pl-3 pr-1.5 text-sm font-medium cursor-[inherit]",children:[oe,me]}),e[19]=D,e[20]=o,e[21]=b,e[22]=oe,e[23]=me,e[24]=we):we=e[24];const U=`Actions for ${r.variant.label}`,re=d&&"opacity-100";let W;e[25]!==re?(W=Pe("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",re),e[25]=re,e[26]=W):W=e[26];let fe;e[27]===Symbol.for("react.memo_cache_sentinel")?(fe=n.jsx(qn,{size:12}),e[27]=fe):fe=e[27];let A;e[28]!==U||e[29]!==W?(A=n.jsx(Xn,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":U,onClick:eo,onPointerDown:Zr,className:W,children:fe})}),e[28]=U,e[29]=W,e[30]=A):A=e[30];let _e;e[31]===Symbol.for("react.memo_cache_sentinel")?(_e=n.jsx(Mr,{size:14}),e[31]=_e):_e=e[31];let $;e[32]!==x?($=n.jsxs(it,{onClick:x,children:[_e,"Rename"]}),e[32]=x,e[33]=$):$=e[33];let ge;e[34]===Symbol.for("react.memo_cache_sentinel")?(ge=n.jsx(Jn,{size:14}),e[34]=ge):ge=e[34];let ae;e[35]!==C?(ae=n.jsxs(it,{onClick:C,children:[ge,"Duplicate"]}),e[35]=C,e[36]=ae):ae=e[36];let X;e[37]===Symbol.for("react.memo_cache_sentinel")?(X=n.jsx(jr,{}),e[37]=X):X=e[37];const L=!g;let O;e[38]===Symbol.for("react.memo_cache_sentinel")?(O=n.jsx(Qn,{size:14}),e[38]=O):O=e[38];let F;e[39]!==N||e[40]!==L?(F=n.jsxs(it,{variant:"destructive",disabled:L,onClick:N,children:[O,"Delete"]}),e[39]=N,e[40]=L,e[41]=F):F=e[41];let q;e[42]!==$||e[43]!==ae||e[44]!==F?(q=n.jsxs(es,{align:"start",className:"w-36",children:[$,ae,X,F]}),e[42]=$,e[43]=ae,e[44]=F,e[45]=q):q=e[45];let ie;e[46]!==A||e[47]!==q?(ie=n.jsxs(Zn,{children:[A,q]}),e[46]=A,e[47]=q,e[48]=ie):ie=e[48];let le;return e[49]!==w||e[50]!==T||e[51]!==we||e[52]!==ie||e[53]!==K?(le=n.jsxs("div",{ref:w,style:T,className:K,children:[we,ie]}),e[49]=w,e[50]=T,e[51]=we,e[52]=ie,e[53]=K,e[54]=le):le=e[54],le}function Zr(f){return f.stopPropagation()}function eo(f){return f.stopPropagation()}function to(){return!1}function no(f){const e=Ge.c(13),{variant:r,decofile:u,meta:d,matchers:g}=f,y=d??void 0;let p;e[0]!==u||e[1]!==y||e[2]!==r.rule?(p=Rt(r.rule,u,y),e[0]=u,e[1]=y,e[2]=r.rule,e[3]=p):p=e[3];const v=p;let b;e[4]===Symbol.for("react.memo_cache_sentinel")?(b=Pe("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",ps),e[4]=b):b=e[4];let x;e[5]!==v||e[6]!==g?(x=n.jsx(un,{rule:v,matchers:g}),e[5]=v,e[6]=g,e[7]=x):x=e[7];let C;e[8]!==r.label?(C=n.jsx("span",{className:"truncate",children:r.label}),e[8]=r.label,e[9]=C):C=e[9];let N;return e[10]!==x||e[11]!==C?(N=n.jsxs("div",{className:b,children:[x,C]}),e[10]=x,e[11]=C,e[12]=N):N=e[12],N}function so(f){const e=Ge.c(78),{listKey:r,variants:u,activeIndex:d,decofile:g,meta:y,matchers:p,onSelect:v,onReorder:b,onRename:x,onDuplicate:C,onDelete:N,onAdd:j}=f;let D;e[0]!==u?(D=()=>on(u),e[0]=u,e[1]=D):D=e[1];const[o,w]=k.useState(D),[i,se]=k.useState(null),[Q,B]=k.useState(r),[c,T]=k.useState(u.length);let de;e[2]!==u?(de=()=>Ln(u),e[2]=u,e[3]=de):de=e[3];const[P,be]=k.useState(de),E=k.useRef(!1),he=Ln(u);Q!==r?(B(r),T(u.length),be(he),w(on(u))):c!==u.length?(T(u.length),be(he),w(on(u))):P!==he&&(be(he),w(ue=>u.map((Z,R)=>({id:ue[R]?.id??crypto.randomUUID(),index:R,variant:Z}))));let K;e[4]===Symbol.for("react.memo_cache_sentinel")?(K={activationConstraint:{distance:8}},e[4]=K):K=e[4];let oe;e[5]===Symbol.for("react.memo_cache_sentinel")?(oe={coordinateGetter:os},e[5]=oe):oe=e[5];const me=ts(It(ss,K),It(ns,oe));let we;e[6]!==o?(we=o.map(ao),e[6]=o,e[7]=we):we=e[7];const U=we,re=u.length>1;let W;e[8]!==o?(W=ue=>{const Z=String(ue.active.id);se(o.find(R=>R.id===Z)??null)},e[8]=o,e[9]=W):W=e[9];const fe=W;let A;e[10]!==U||e[11]!==b?(A=ue=>{se(null);const{active:Z,over:R}=ue;if(!R||Z.id===R.id)return;const z=U.indexOf(String(Z.id)),Ce=U.indexOf(String(R.id));z===-1||Ce===-1||(w(pe=>Qr(Dt([...pe],z,Ce))),E.current=!0,requestAnimationFrame(()=>{E.current=!1}),b(z,Ce))},e[10]=U,e[11]=b,e[12]=A):A=e[12];const _e=A;let $;e[13]===Symbol.for("react.memo_cache_sentinel")?($=()=>{se(null)},e[13]=$):$=e[13];const ge=$;let ae,X,L,O,F,q,ie,le,ve,ye,I,ce;if(e[14]!==i||e[15]!==d||e[16]!==re||e[17]!==g||e[18]!==o||e[19]!==U||e[20]!==_e||e[21]!==fe||e[22]!==p||e[23]!==y||e[24]!==N||e[25]!==C||e[26]!==x||e[27]!==v||e[28]!==me){const ue=R=>{E.current||v(R)};I="flex items-center border-b shrink-0";const Z=i&&"cursor-grabbing";e[41]!==Z?(ye=Pe("flex flex-1 min-w-0 items-center gap-1.5 pl-3 pr-2 py-2 overflow-x-auto",Z),e[41]=Z,e[42]=ye):ye=e[42],X=is,F=me,q=ls,ie=fe,le=_e,ve=ge,ae=cs,ce=U,L=wr,O=o.map(R=>n.jsx(Xr,{sortableId:R.id,entry:R,isActive:R.index===d,canDelete:re,decofile:g,meta:y,matchers:p,onSelect:()=>ue(R.index),onRename:()=>x(R.index),onDuplicate:()=>C(R.index),onDelete:()=>N(R.index)},R.id)),e[14]=i,e[15]=d,e[16]=re,e[17]=g,e[18]=o,e[19]=U,e[20]=_e,e[21]=fe,e[22]=p,e[23]=y,e[24]=N,e[25]=C,e[26]=x,e[27]=v,e[28]=me,e[29]=ae,e[30]=X,e[31]=L,e[32]=O,e[33]=F,e[34]=q,e[35]=ie,e[36]=le,e[37]=ve,e[38]=ye,e[39]=I,e[40]=ce}else ae=e[29],X=e[30],L=e[31],O=e[32],F=e[33],q=e[34],ie=e[35],le=e[36],ve=e[37],ye=e[38],I=e[39],ce=e[40];let Ne;e[43]!==ae||e[44]!==L||e[45]!==O||e[46]!==ce?(Ne=n.jsx(ae,{items:ce,strategy:L,children:O}),e[43]=ae,e[44]=L,e[45]=O,e[46]=ce,e[47]=Ne):Ne=e[47];let Me;e[48]!==i||e[49]!==g||e[50]!==p||e[51]!==y?(Me=i?n.jsx(no,{variant:i.variant,decofile:g,meta:y,matchers:p}):null,e[48]=i,e[49]=g,e[50]=p,e[51]=y,e[52]=Me):Me=e[52];let Ee;e[53]!==Me?(Ee=n.jsx(us,{dropAnimation:null,children:Me}),e[53]=Me,e[54]=Ee):Ee=e[54];let Oe;e[55]!==X||e[56]!==F||e[57]!==q||e[58]!==ie||e[59]!==le||e[60]!==ve||e[61]!==Ne||e[62]!==Ee?(Oe=n.jsxs(X,{sensors:F,collisionDetection:q,onDragStart:ie,onDragEnd:le,onDragCancel:ve,children:[Ne,Ee]}),e[55]=X,e[56]=F,e[57]=q,e[58]=ie,e[59]=le,e[60]=ve,e[61]=Ne,e[62]=Ee,e[63]=Oe):Oe=e[63];let Ve;e[64]!==ye||e[65]!==Oe?(Ve=n.jsx("div",{className:ye,children:Oe}),e[64]=ye,e[65]=Oe,e[66]=Ve):Ve=e[66];let Fe;e[67]===Symbol.for("react.memo_cache_sentinel")?(Fe={color:Jr},e[67]=Fe):Fe=e[67];let Be;e[68]===Symbol.for("react.memo_cache_sentinel")?(Be=n.jsx(cn,{size:14}),e[68]=Be):Be=e[68];let Ke;e[69]!==j?(Ke=n.jsx(ft,{asChild:!0,children:n.jsx(Ye,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-8 shrink-0 cursor-pointer",style:Fe,onClick:j,children:Be})}),e[69]=j,e[70]=Ke):Ke=e[70];let Le;e[71]===Symbol.for("react.memo_cache_sentinel")?(Le=n.jsx(pt,{side:"bottom",children:"Add variant"}),e[71]=Le):Le=e[71];let Ie;e[72]!==Ke?(Ie=n.jsx("div",{className:"shrink-0 pr-3 pl-1 py-2",children:n.jsxs(mt,{children:[Ke,Le]})}),e[72]=Ke,e[73]=Ie):Ie=e[73];let Ae;return e[74]!==I||e[75]!==Ve||e[76]!==Ie?(Ae=n.jsxs("div",{className:I,children:[Ve,Ie]}),e[74]=I,e[75]=Ve,e[76]=Ie,e[77]=Ae):Ae=e[77],Ae}function ao(f){return f.id}function Fn(f){const e=Ge.c(15),{schema:r,value:u,onChange:d,meta:g,decofile:y,onSaveReferencedBlock:p,sandbox:v}=f;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=[],e[0]=b):b=e[0];const[x,C]=k.useState(b);let N;e[1]!==x?(N=x.length>0&&n.jsxs("nav",{"aria-label":"Variant rule breadcrumb",className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[n.jsx("button",{type:"button",onClick:()=>C([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:"Back to rule",children:n.jsx(or,{className:"size-3.5"})}),x.map((o,w)=>{const i=w===x.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[w>0&&n.jsx(Wn,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>C(x.slice(0,w+1)),title:o,className:Pe("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",i?"font-medium text-foreground":"text-muted-foreground"),children:o})]},`${o}-${w}`)})]}),e[1]=x,e[2]=N):N=e[2];let j;e[3]!==x||e[4]!==y||e[5]!==g||e[6]!==d||e[7]!==p||e[8]!==v||e[9]!==r||e[10]!==u?(j=n.jsx(Gn,{schema:r,value:u,onChange:d,basePath:"",breadcrumbPath:x,onBreadcrumbChange:C,meta:g,decofile:y,onSaveReferencedBlock:p,sandbox:v}),e[3]=x,e[4]=y,e[5]=g,e[6]=d,e[7]=p,e[8]=v,e[9]=r,e[10]=u,e[11]=j):j=e[11];let D;return e[12]!==N||e[13]!==j?(D=n.jsxs("div",{className:"space-y-2",children:[N,j]}),e[12]=N,e[13]=j,e[14]=D):D=e[14],D}function In(f){const e=Ge.c(21),{activeSchema:r,formValue:u,formResetKey:d,onFormChange:g,onBreadcrumbChange:y,breadcrumbPath:p,emptyMessage:v,beforeForm:b,seoResolveType:x,siteDefaultSeo:C,meta:N,decofile:j,onSaveReferencedBlock:D,sandbox:o}=f;let w;e[0]!==p?(w=p===void 0?[]:p,e[0]=p,e[1]=w):w=e[1];const i=w;let se;e[2]!==r||e[3]!==i||e[4]!==j||e[5]!==d||e[6]!==u||e[7]!==N||e[8]!==y||e[9]!==g||e[10]!==D||e[11]!==o||e[12]!==x||e[13]!==C?(se=r&&u?x?n.jsx(Ar,{schema:r,resolveType:x,value:u,formResetKey:d,onChange:g,onBreadcrumbChange:y,siteDefaultSeo:C}):n.jsx(Gn,{schema:r,value:u,onChange:g,basePath:"",breadcrumbPath:i,onBreadcrumbChange:y,meta:N,decofile:j,onSaveReferencedBlock:D,sandbox:o},d):null,e[2]=r,e[3]=i,e[4]=j,e[5]=d,e[6]=u,e[7]=N,e[8]=y,e[9]=g,e[10]=D,e[11]=o,e[12]=x,e[13]=C,e[14]=se):se=e[14];const Q=se;let B;e[15]!==v||e[16]!==Q?(B=Q??n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:v}),e[15]=v,e[16]=Q,e[17]=B):B=e[17];let c;return e[18]!==b||e[19]!==B?(c=n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsxs("div",{className:"mx-auto max-w-2xl",children:[b,B]})}),e[18]=b,e[19]=B,e[20]=c):c=e[20],c}const ro="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 oo(f,e){return La(f,e,et)}function io(f){const e=Ge.c(13),{pageKey:r,initialName:u,initialPath:d,onFieldChange:g}=f,[y,p]=k.useState(u),[v,b]=k.useState(d),[x,C]=k.useState(r);x!==r&&(C(r),p(u),b(d));let N;e[0]!==g?(N=i=>{p(i.target.value),g("name",i.target.value)},e[0]=g,e[1]=N):N=e[1];let j;e[2]!==y||e[3]!==N?(j=n.jsx("input",{type:"text",value:y,onChange:N,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]=y,e[3]=N,e[4]=j):j=e[4];let D;e[5]!==g?(D=i=>{b(i.target.value),g("path",i.target.value)},e[5]=g,e[6]=D):D=e[6];let o;e[7]!==v||e[8]!==D?(o=n.jsx("input",{type:"text",value:v,onChange:D,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]=v,e[8]=D,e[9]=o):o=e[9];let w;return e[10]!==j||e[11]!==o?(w=n.jsxs("div",{className:"space-y-1",children:[j,o]}),e[10]=j,e[11]=o,e[12]=w):w=e[12],w}function zn(f){const e=Ge.c(6),{onClick:r}=f;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Yn,{size:14}),e[0]=u):u=e[0];let d;e[1]!==r?(d=n.jsx(ft,{asChild:!0,children:n.jsx(Ye,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:r,children:u})}),e[1]=r,e[2]=d):d=e[2];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(pt,{side:"bottom",children:"Add variant"}),e[3]=g):g=e[3];let y;return e[4]!==d?(y=n.jsxs(mt,{children:[d,g]}),e[4]=d,e[5]=y):y=e[5],y}function Hl({orgSlug:f,virtualMcpId:e,branch:r,previewReady:u=!0,previewUrl:d,currentPath:g,activePageBlockKey:y=null,activeGlobalBlockKey:p=null,externalSelectedIndex:v,onSaved:b,initialEditSeo:x=!1,onExitSeo:C,onViewJsonFile:N,onVariantPreviewOverride:j}){const D=u?{orgSlug:f,virtualMcpId:e,branch:r,previewUrl:d}:null,{data:o,isLoading:w}=wa(D),{data:i,isLoading:se}=Na(D),Q=Ra(),B=Q?.entity?.id===e?Q.entity.metadata?.siteSlug??null:null,[c,T]=k.useState(null),[de,P]=k.useState(null),[be,E]=k.useState(null),[he,K]=k.useState(0),[oe,me]=k.useState(void 0),[we,U]=k.useState(null),[re,W]=k.useState(null),[fe,A]=k.useState([]),[_e,$]=k.useState(0),[ge,ae]=k.useState(null),[X,L]=k.useState(null),[O,F]=k.useState(null),[q,ie]=k.useState(!0),[le,ve]=k.useState(!1),[ye,I]=k.useState(!1),[ce,Ne]=k.useState(x),[Me,Ee]=k.useState(x);x&&!Me&&(Ee(!0),Ne(!0),T(null),P(null),E(null),A([])),!x&&Me&&Ee(!1);const[Oe,Ve]=k.useState(null),[Fe,Be]=k.useState(void 0),[Ke,Le]=k.useState([]),[Ie,Ae]=k.useState(0),[ue,Z]=k.useState(0),[R,z]=k.useState(null),[Ce,pe]=k.useState(null),[Qe,dn]=k.useState(null),hs=ha(),gs=`${f}/${e}/${r}`,zt=Da({orgSlug:f,virtualMcpId:e,branch:r}),[vs,Ss]=k.useState(g),[bs,ys]=k.useState(y),[xs,_s]=k.useState(p);(vs!==g||bs!==y||xs!==p)&&(queueMicrotask(()=>zt.flush()),Ss(g),ys(y),_s(p),T(null),P(null),E(null),K(0),U(null),W(null),Z(0),z(null),pe(null),A([]),$(t=>t+1),Ne(!1),Ve(null),Be(void 0),Le([]),Ae(t=>t+1));const je=Va({orgSlug:f,virtualMcpId:e,branch:r}),Vt=Ya((t,s)=>{je.mutate({blockKey:t,data:s},{onSuccess:()=>b?.(),onError:a=>te.error(`Save failed: ${a.message}`)})}),Ht=Ca({orgSlug:f,virtualMcpId:e,branch:r}),[xt,Ct]=k.useState(!1),Ut=k.useRef(null),ht=k.useRef(null),gt=k.useRef(null),Gt=k.useRef({}),We=k.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!u||w||se)return n.jsx("div",{className:"h-full w-full flex items-center justify-center",children:n.jsx(Hn,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!i)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Could not load site data."});const js=Ta(o),ke=!!p,ze=ke?null:Pa(js,g,y),_=ke?p:ze?.key??null,Wt=ke&&p?o[p]:void 0,mn=ke&&p&&Wt?Aa(p,Wt):ke&&p?p:"",Tt=!ke&&_&&o[_]?o[_]:null,qt=ce&&o&&i&&_&&ze?$n(o,{kind:"page",pageKey:_,pageName:String(ze.name??""),path:String(ze.path??"")},i):null,ks=ce?Tt?.seo:void 0,Yt=Fe!==void 0?Fe:ks,ws=ce?Nr(Yt):void 0,Ns=qt?.seoTypeOptions??[],Rs=ce&&i?Rr(i):"",fn=Oe??ws??{},Jt=ce&&qt?Dr(fn,qt):null,Ds=ce&&Jt&&Vr(Yt)?$t(Jt,i):null,Vs=ce?Cr(o,i)?.seoData:void 0,$e=ke?[{label:"Default",sections:[{__resolveType:p}]}]:oo(Tt?.sections,o??{}),Pt=$e.length>1,De=Math.min(he,$e.length-1),tt=$e[De],Y=tt?.sections??[],Te=Ot(Y,o),pn=!ke&&Ma(Tt?.sections);if(ke&&p&&Qe!==p){dn(p);const t=Y[0],s=Te[0];if(t&&s){T(0),Z(0),A([]);const a=ut(t,s,o);a&&(P(a.data),E(a.resolveType),pe(null),z(null))}}!ke&&Qe!==null&&dn(null),We.current={rawSections:Y,parsedSections:Te,decofile:o??{},activePageKey:_,pageVariants:$e,variantIndex:De,sectionVariantIndex:ue,selectedSectionIndex:c};const Cs=()=>({multivariate:pn,index:De,variants:$e.map(t=>({rule:t.rule}))}),hn=(t,s)=>{if(!j)return;if(!_||!pn||t.length<=1){j(null);return}const a=En(_,{multivariate:!0,index:s,variants:t},o,i);j(a.length>0?a:null)},vt=(t,s,a)=>{if(!j)return;if(!_){j(null);return}const l=Cs(),m=En(_,l,o,i);if(!t||s<0){j(m.length>0?m:null);return}const S=er({pageKey:_,page:l,sectionIndex:s,sectionLazy:Te[s]?.isLazy??!1,mvObj:t,selectedVariantIndex:a,decofile:o,meta:i}),h=[...m,...S];j(h.length>0?h:null)},nt=(t,s,a,l=c??-1,m=!1)=>{const S=Je(t,s);if(!S){P(null),E(null),pe(null),z(null),m&&vt(null,l,a);return}const V=Cn(S,et)[a];if(!V){P(null),E(null),pe(null),z(null),m&&vt(null,l,a);return}const ne=Fa(V.value,o);P(ne?.data??null),E(ne?.resolveType??null);const{resolveType:M,formValue:H}=kt(V.rule,o,i??void 0);pe(M),z(H),m&&vt(S,l,a)};if(v!==void 0&&v!==oe&&(me(v??null),typeof v=="number")){const t=Y[v],s=Te[v];if(t&&s)if(T(v),Z(0),A([]),$(a=>a+1),s.isMultivariate)nt(t,s,0,v);else{const a=ut(t,s,o);a?(P(a.data),E(a.resolveType)):(P(null),E(null)),pe(null),z(null)}}const At={orgSlug:f,virtualMcpId:e,branch:r,previewUrl:d??void 0,siteSlug:B},Qt=be&&i?$t(be,i):null,He=(t,s)=>{if(!_)return;const a=Nt(o,_,t,De,$e);je.mutate({blockKey:_,data:a},{onSuccess:()=>s?.onSuccess?.()??b?.(),onError:l=>te.error(`Save failed: ${l.message}`)})},St=()=>{T(null),P(null),E(null),Z(0),z(null),pe(null),A([]),$(t=>t+1)},Ts=(t,s)=>{Ut.current&&clearTimeout(Ut.current);const a=We.current.sectionVariantIndex;Ut.current=setTimeout(()=>{const{rawSections:l,parsedSections:m,decofile:S,activePageKey:h,pageVariants:V,variantIndex:ne}=We.current,M=l[s];if(!M)return;const H=m[s];if(!H)return;if(H.isSavedBlock){const J=H.isLazy?M.section?.__resolveType??M.__resolveType:M.__resolveType;je.mutate({blockKey:J,data:t},{onSuccess:()=>b?.(),onError:ee=>te.error(`Save failed: ${ee.message}`)});return}if(!h)return;const G={...S[h]},xe=[...l];if(H.isMultivariate){const J=Je(M,H);if(!J||!h)return;const ee=sr(J,a,t);xe[s]=dt(M,H,ee)}else if(H.isHidden){const J=Un(M.__resolveType),ee=J?{...M.section}:{...M},Re=Array.isArray(ee.variants)?[...ee.variants]:[];Re[0]&&(Re[0]={...Re[0],value:t}),ee.variants=Re,J?xe[s]={...M,section:ee}:xe[s]=ee}else H.isLazy?xe[s]={...M,section:t}:xe[s]=t;if(V.length>1){const J=G.sections,ee=[...J?.variants??[]];ee[ne]&&(ee[ne]={...ee[ne],value:xe}),G.sections={...J,variants:ee}}else G.sections=xe;je.mutate({blockKey:h,data:G},{onSuccess:()=>b?.(),onError:J=>te.error(`Save failed: ${J.message}`)})},rn)},Ps=t=>{T(t),Z(0),A([]),$(m=>m+1);const s=Y[t],a=Te[t];if(!s||!a)return;if(a.isMultivariate){nt(s,a,0,t);return}const l=ut(s,a,o);if(!l){P(null),E(null),pe(null),z(null),vt(null,t,0);return}P(l.data),E(l.resolveType),pe(null),z(null),vt(null,t,0)},gn=t=>{const s=t;P(s),c!==null&&Ts(s,c)},Xt=t=>{if(!_||!o||!i||!ze)return;const s={kind:"page",pageKey:_,pageName:String(ze.name??""),path:String(ze.path??"")},a=$n(o,s,i);a&&zt.save(_,()=>{const l=hs.getQueryData(ga.decofile(gs))?.[_];if(!l||typeof l!="object"||l===null||Array.isArray(l))return null;const m={...l,...Gt.current};return Gt.current={},t?.raw!==void 0?{...m,seo:t.raw}:t?.inner!==void 0?Pr(s,a,m,t.inner):m})},As=(t,s)=>{_&&(Gt.current[t]=s,Xt())},Ms=(t,s)=>{if(!_)return;const a=Dt([...Y],t,s);c!==null&&(c===t?T(s):t<c&&s>=c?T(c-1):t>c&&s<=c&&T(c+1)),He(a)},Es=t=>{if(!_)return;const s=Y.filter((a,l)=>l!==t);c===t?St():c!==null&&c>t&&T(c-1),He(s)},Ks=t=>{if(!_)return;const s=Y[t];if(!s)return;const a=[...Y];a.splice(t+1,0,Za(s)),c!==null&&c>t&&T(c+1),He(a)},$s=t=>{if(!_)return;const s=Y[t],a=Te[t];if(!s||!a||a.isMultivariate)return;const l=a.isHidden?Qa(s):Xa(s);if(!l)return;const m=[...Y];m[t]=l,c===t&&St(),He(m)},Os=t=>{if(!_)return;const s=Y[t],a=Te[t];if(!s||!a||a.isMultivariate)return;const l=Ja(s);if(!l)return;const m=[...Y];m[t]=l,c===t&&St(),He(m)},Bs=t=>{if(!_)return;const s=Y[t],a=Te[t];if(!s||!a?.isSavedBlock)return;const l=ut(s,a,o);if(!l?.data)return;const{name:m,...S}=l.data,h=[...Y];a.isLazy?h[t]={...s,section:S}:h[t]=S,c===t&&St(),He(h)},Ls=t=>{if(!_)return;const s=[...Y,{__resolveType:t.resolveType}],a=s.length-1;He(s,{onSuccess:()=>{ve(!1),T(a),Z(0),A([]),$(h=>h+1);const l=s[a],m=Ot(s,o)[a];if(!l||!m)return;if(m.isMultivariate){nt(l,m,0);return}const S=ut(l,m,o);if(!S){P(null),E(null),pe(null),z(null);return}P(S.data),E(S.resolveType),pe(null),z(null)}})},Fs=t=>{if(c===null)return;const s=Y[c],a=Te[c];!s||!a?.isMultivariate||(Z(t),A([]),$(l=>l+1),nt(s,a,t,c,!0))},Is=t=>{if(c===null||!_)return;const s=Y[c],a=Te[c];if(!s||!a?.isMultivariate)return;const l=Je(s,a);if(!l)return;const m=Wa(l,t);if(!m){te.error("Cannot delete the only variant.");return}const S=[...Y];S[c]=dt(s,a,m);const h=m.variants;let V=ue;t===ue?V=Math.min(t,h.length-1):t<ue&&(V=ue-1),Z(V),A([]),$(ne=>ne+1),nt(S[c],a,V),He(S)},zs=t=>{if(c===null||!_)return;const s=Y[c],a=Te[c];if(!s||!a?.isMultivariate)return;const l=Je(s,a);if(!l)return;const m=qa(l,t),S=[...Y];S[c]=dt(s,a,m);const h=t+1;Z(h),A([]),$(V=>V+1),nt(S[c],a,h),He(S)},Hs=(t,s)=>{if(c===null||!_||t===s)return;const a=Y[c],l=Te[c];if(!a||!l?.isMultivariate)return;const m=Je(a,l);if(!m)return;const S=Ua(m,t,s),h=[...Y];h[c]=dt(a,l,S);let V=ue;ue===t?V=s:t<ue&&s>=ue?V=ue-1:t>ue&&s<=ue&&(V=ue+1),Z(V),nt(h[c],l,V),He(h)},Zt=t=>{const s=t??c;if(s===null||!_)return;const a=Y[s],l=Te[s];if(!a||!l)return;const m=Ia(a,l);if(!m){te.error("This section cannot have variants.");return}const S=[...Y];S[s]=m.section;const h=Ot(S,o)[s];if(!h?.isMultivariate){te.error("Could not add variant.");return}T(s),Z(m.newVariantIndex),A([]),$(V=>V+1),nt(m.section,h,m.newVariantIndex,s),He(S)},Us=()=>{if(c===null||!_)return;const t=Y[c],s=Te[c];if(!t||!s?.isMultivariate)return;const a=Je(t,s);if(!a)return;const l=Ga(t,s,a);if(!l){te.error("Could not remove variants.");return}const m=[...Y];m[c]=l;const S=Ot(m,o)[c];if(!S)return;Z(0),pe(null),z(null),A([]),$(V=>V+1);const h=ut(l,S,o);h?(P(h.data),E(h.resolveType)):(P(null),E(null)),vt(null,c,0),He(m)},Gs=async t=>{if(ge===null||!_)return;const s=an(t,o);if(s){te.error(s);return}const a=Y[ge],l=Te[ge];if(!a||!l)return;const m=ut(a,l,o);if(!m){te.error("This section cannot be saved as global.");return}const S={...m.data,name:t};try{await je.mutateAsync({blockKey:t,data:S});const h=[...Y];h[ge]={__resolveType:t},await je.mutateAsync({blockKey:_,data:Nt(o,_,h,De,$e)}),c===ge&&St(),ae(null),te.success(`Saved global block "${t}"`),b?.()}catch(h){te.error(h instanceof Error?h.message:"Failed to save global block")}},vn=tt?.rule;if(Pt&&c===null&&re===null&&vn){const{resolveType:t,formValue:s}=kt(vn,o??{},i??void 0);W(t),U(s)}const Mt=i?Ea(i):[],Sn=i&&o?Ka(i,o):[],Ws=!ke&&!!(d&&i&&o),bn=re&&i?$t(re,i):null,Et=()=>{ht.current&&(clearTimeout(ht.current),ht.current=null),gt.current&&(clearTimeout(gt.current),gt.current=null)},_t=async(t,s)=>{if(!(nr(s,t,i)>0))try{await Ht.mutateAsync({blockKey:t})}catch(a){te.error(a instanceof Error?a.message:"Could not delete matcher block")}},yn=t=>{ht.current&&clearTimeout(ht.current),ht.current=setTimeout(()=>{const{activePageKey:s,decofile:a,variantIndex:l}=We.current;if(!s)return;const m={...a[s]},S={...m.sections},h=[...S.variants??[]],V=h[l],ne=V?.rule;if(bt(ne,a,i)){const M=ne?.__resolveType??"",H=a[M],G=typeof H?.name=="string"?H.name:M,{__resolveType:xe,...J}=t;je.mutate({blockKey:M,data:yt(xe??"",J,G)},{onSuccess:()=>b?.(),onError:ee=>te.error(`Save failed: ${ee.message}`)});return}V&&(h[l]={...V,rule:t}),m.sections={...S,variants:h},je.mutate({blockKey:s,data:m},{onSuccess:()=>b?.(),onError:M=>te.error(`Save failed: ${M.message}`)})},rn)},qs=t=>{W(t);const s=t?{__resolveType:t}:{__resolveType:Kn};U({}),yn(s)},Ys=t=>{const s=t;U(s);const a=re?{__resolveType:re,...s}:{...s};yn(a)},Js=async t=>{Et();const{activePageKey:s,decofile:a,variantIndex:l}=We.current;if(!s)return;const m=a[s],S=m?.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const h=S;if(!Array.isArray(h.variants))return;const V=[...h.variants],ne=V[l];if(!ne)return;const M=wt(ne.rule,a,i),H=Lt(t);V[l]={...ne,rule:H};const G={...a,[s]:{...m,sections:{...h,variants:V}}},{resolveType:xe,formValue:J}=kt(H,G,i??void 0);W(xe),U(J);try{await je.mutateAsync({blockKey:s,data:G[s]}),M&&M!==t&&await _t(M,G),b?.()}catch(ee){te.error(ee instanceof Error?ee.message:"Could not apply saved rule")}},xn=t=>{gt.current&&clearTimeout(gt.current);const{selectedSectionIndex:s,sectionVariantIndex:a}=We.current;s!==null&&(gt.current=setTimeout(()=>{const{rawSections:l,parsedSections:m,decofile:S,activePageKey:h,pageVariants:V,variantIndex:ne}=We.current;if(!h)return;const M=l[s],H=m[s];if(!M||!H?.isMultivariate)return;const G=Je(M,H);if(!G)return;const J=(G.variants??[])[a]?.rule;if(bt(J,S,i)){const Se=J?.__resolveType??"",Ue=S[Se],Xe=typeof Ue?.name=="string"?Ue.name:Se,{__resolveType:rt,...Ze}=t;je.mutate({blockKey:Se,data:yt(rt??"",Ze,Xe)},{onSuccess:()=>b?.(),onError:ot=>te.error(`Save failed: ${ot.message}`)});return}const ee=Pn(G,a,t),Re=[...l];Re[s]=dt(M,H,ee);const qe=Nt(S,h,Re,ne,V);je.mutate({blockKey:h,data:qe},{onSuccess:()=>b?.(),onError:Se=>te.error(`Save failed: ${Se.message}`)})},rn))},Qs=t=>{pe(t),z({}),xn(t?{__resolveType:t}:{__resolveType:Kn})},Xs=t=>{const s=t;z(s);const a=Ce?{__resolveType:Ce,...s}:{...s};xn(a)},Zs=async t=>{Et();const{selectedSectionIndex:s,sectionVariantIndex:a,rawSections:l,parsedSections:m,decofile:S,activePageKey:h,pageVariants:V,variantIndex:ne}=We.current;if(s===null||!h)return;const M=l[s],H=m[s];if(!M||!H?.isMultivariate)return;const G=Je(M,H);if(!G)return;const xe=G.variants??[],J=wt(xe[a]?.rule,S,i),ee=Lt(t),Re=Pn(G,a,ee),qe=[...l];qe[s]=dt(M,H,Re);const Se=Nt(S,h,qe,ne,V),Ue={...S,[h]:Se},{resolveType:Xe,formValue:rt}=kt(ee,Ue,i??void 0);pe(Xe),z(rt);try{await je.mutateAsync({blockKey:h,data:Se}),J&&J!==t&&await _t(J,Ue),b?.()}catch(Ze){te.error(Ze instanceof Error?Ze.message:"Could not apply saved rule")}};if(!ke&&!ze)return n.jsxs("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:["No page found for ",g]});if(ke&&!Wt)return n.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Global block not found"});const st=c!==null?Te[c]??null:null,_n=c!==null?Y[c]:null,jn=_n&&st?.isMultivariate?Je(_n,st):null,lt=jn?Cn(jn,et):[],en=Math.min(ue,Math.max(lt.length-1,0)),Kt=lt[en]??null,ct=st?.isMultivariate===!0,kn=c!==null&&st!==null,jt=kn&&(ct||!!(Qt&&de)),ea=jt&&!ke&&st?.isSavedBlock===!0,at=ke||ea,ta=ke?mn:st?.label??"",wn=Ce&&i?$t(Ce,i):null,tn=jt&&(!ke||fe.length>0)?ke?[mn,...fe]:[ze.name,st.label,...ct&&Kt?[Kt.label]:[],...fe]:[],na=ce&&ze?[ze.name,"SEO",...Ke]:[],Nn=ce?na:at?tn.length>0?tn:[ta]:tn,Rn=()=>{if(!_)return;const t=o[_],s=za(t.sections,Y);if(!s)return;const a=Ha(s);je.mutate({blockKey:_,data:{...t,sections:s}},{onSuccess:()=>{K(a),T(null),P(null),E(null),A([]),U(null),W(null)},onError:l=>te.error(`Save failed: ${l.message}`)})},nn=(t,s,a)=>{if(!_)return;const l=o[_],m=l.sections;if(!m||typeof m!="object"||Array.isArray(m))return;const S=m;if(!Array.isArray(S.variants))return;const h=t([...S.variants]);if(!h)return;const V=tr(S,h),ne={...o,[_]:{...l,sections:V}};je.mutate({blockKey:_,data:ne[_]},{onSuccess:()=>{s?.(),a&&_t(a,ne)},onError:M=>te.error(`Save failed: ${M.message}`)})},sa=t=>{L(null),K(t),T(null),P(null),E(null),A([]);const s=$e[t]?.rule,{resolveType:a,formValue:l}=kt(s,o??{},i??void 0);W(a),U(l),hn($e.map(m=>({rule:m.rule})),t)},aa=(t,s)=>{if(t===s)return;let a=De;De===t?a=s:t<De&&s>=De?a=De-1:t>De&&s<=De&&(a=De+1),K(a);const l=Dt($e.map(m=>({rule:m.rule})),t,s);hn(l,a),nn(m=>Dt(m,t,s))},ra=t=>{const s=$e[t]?.rule,a=wt(s,o??{},i??void 0);nn(l=>l.length<=1?null:(l.splice(t,1),l),()=>{$e.length-1===1?K(0):t<De?K(De-1):t===De&&K(Math.max(0,t-1)),T(null),P(null),E(null),A([]),U(null),W(null)},a)},oa=t=>{nn(s=>ar(s,t),()=>{K(t+1),T(null),P(null),E(null),A([]),U(null),W(null)})},ia=async(t,s)=>{Et();const a=We.current.activePageKey,l=We.current.decofile;if(!a)return;const m=l[a],S=m.sections;if(!S||typeof S!="object"||Array.isArray(S))return;const h=S;if(!Array.isArray(h.variants))return;const V=[...h.variants],ne=V[t];if(!ne?.rule||typeof ne.rule!="object"){te.error("This variant has no matcher rule to rename.");return}const M=ne.rule,H=s.trim();Ct(!0);try{if(!H){if(!bt(M,l,i)){L(null);return}const qe=M.__resolveType??"";V[t]={...ne,rule:An(M,l,i)};const Se={...l,[a]:{...m,sections:{...h,variants:V}}};await je.mutateAsync({blockKey:a,data:Se[a]}),await _t(qe,Se),L(null),b?.();return}const G=Mn(M,l,i);if(!G){te.error("Could not read this variant's matcher rule.");return}if(G.blockKey){await je.mutateAsync({blockKey:G.blockKey,data:yt(G.resolveType,G.data,H)}),L(null),b?.();return}const xe=sn(H),J=an(xe,l);if(J){te.error(J);return}const ee=yt(G.resolveType,G.data,H);let Re=null;try{await je.mutateAsync({blockKey:xe,data:ee}),Re=xe,V[t]={...ne,rule:Lt(xe)},await je.mutateAsync({blockKey:a,data:{...m,sections:{...h,variants:V}}}),Re=null}catch(qe){throw Re&&await Ht.mutateAsync({blockKey:Re}).catch(()=>{}),qe}L(null),te.success(`Saved matcher as global block "${H}"`),b?.()}catch(G){te.error(G instanceof Error?G.message:"Failed to rename variant")}finally{Ct(!1)}},la=async(t,s)=>{Et();const{selectedSectionIndex:a,rawSections:l,parsedSections:m,decofile:S,activePageKey:h,pageVariants:V,variantIndex:ne}=We.current;if(a===null||!h)return;const M=l[a],H=m[a];if(!M||!H?.isMultivariate)return;const G=Je(M,H);if(!G)return;const xe=G.variants??[],J=xe[t];if(!J?.rule||typeof J.rule!="object"){te.error("This variant has no matcher rule to rename.");return}const ee=J.rule,Re=s.trim();Ct(!0);const qe=async Se=>{const Ue={...G,variants:Se},Xe=[...l];Xe[a]=dt(M,H,Ue);const rt=Nt(S,h,Xe,ne,V);return await je.mutateAsync({blockKey:h,data:rt}),{...S,[h]:rt}};try{if(!Re){if(!bt(ee,S,i)){F(null);return}const ot=ee.__resolveType??"",Vn=[...xe];Vn[t]={...J,rule:An(ee,S,i)};const pa=await qe(Vn);await _t(ot,pa),F(null),b?.();return}const Se=Mn(ee,S,i);if(!Se){te.error("Could not read this variant's matcher rule.");return}if(Se.blockKey){await je.mutateAsync({blockKey:Se.blockKey,data:yt(Se.resolveType,Se.data,Re)}),F(null),b?.();return}const Ue=sn(Re),Xe=an(Ue,S);if(Xe){te.error(Xe);return}const rt=yt(Se.resolveType,Se.data,Re);let Ze=null;try{await je.mutateAsync({blockKey:Ue,data:rt}),Ze=Ue;const ot=[...xe];ot[t]={...J,rule:Lt(Ue)},await qe(ot),Ze=null}catch(ot){throw Ze&&await Ht.mutateAsync({blockKey:Ze}).catch(()=>{}),ot}F(null),te.success(`Saved matcher as global block "${Re}"`),b?.()}catch(Se){te.error(Se instanceof Error?Se.message:"Failed to rename variant")}finally{Ct(!1)}},Dn=()=>{St()},ca=t=>{Ve(t),Xt({inner:t})},ua=t=>{Be(t),Xt({raw:t})},da=()=>{Ve(null),Le([])},ma=()=>Ae(t=>t+1),fa=t=>{if(ce){if(t===0){zt.flush(),Ne(!1),Ve(null),Be(void 0),Le([]),Ae(a=>a+1),C?.();return}if(t===1){Le([]),Ae(a=>a+1);return}Le(Ke.slice(0,t-1)),Ae(a=>a+1);return}if(ke){A(fe.slice(0,t)),$(a=>a+1);return}if(t===0){Dn();return}if(t===1){A([]),$(a=>a+1);return}if(ct&&t===2){A([]),$(a=>a+1);return}const s=ct?2:1;A(fe.slice(0,t-s))};return n.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[n.jsx("div",{className:"shrink-0",children:at||jt||ce?n.jsxs("div",{className:Pe("border-b px-3 py-2.5",at&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!ke&&Pt&&tt&&n.jsxs("button",{type:"button",onClick:Dn,title:`Editing in variant: ${tt.label}`,className:Pe("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",ro),children:[n.jsx(un,{rule:Rt(tt.rule,o??{},i??void 0),matchers:Mt}),n.jsx("span",{className:"max-w-[160px] truncate",children:tt.label})]}),n.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:Nn.map((t,s)=>{const a=s===Nn.length-1;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[s>0&&n.jsx(Wn,{className:"size-3 shrink-0 text-muted-foreground/60"}),n.jsx("button",{type:"button",onClick:()=>fa(s),title:t,className:Pe("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",a?at?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":at?"text-foreground/80":"text-muted-foreground",at?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:t})]},`${t}-${s}`)})}),at&&n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx("span",{className:"shrink-0 cursor-help",children:n.jsx(dr,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),n.jsx(pt,{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."})]}),kn&&!ct&&!st?.isHidden&&_&&n.jsx(zn,{onClick:()=>Zt()})]}),at&&n.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."})]}):n.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(io,{pageKey:_,initialName:ze.name,initialPath:ze.path,onFieldChange:As})}),n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ye,{type:"button",variant:"ghost",size:"icon","aria-label":"Edit SEO",className:"size-7 shrink-0",onClick:()=>Ne(!0),children:n.jsx(cr,{size:14})})}),n.jsx(pt,{side:"bottom",children:"Edit SEO"})]}),n.jsxs(mt,{children:[n.jsx(ft,{asChild:!0,children:n.jsx(Ye,{type:"button",variant:"ghost",size:"icon","aria-label":"View JSON",className:"size-7 shrink-0",onClick:()=>N&&_?N(_):I(!0),children:n.jsx(ur,{size:14})})}),n.jsx(pt,{side:"bottom",children:"View JSON"})]}),n.jsx(zn,{onClick:Rn})]})}),Pt&&!jt&&!ce&&_&&n.jsx(so,{listKey:_,variants:$e,activeIndex:De,decofile:o??{},meta:i,matchers:Mt,onSelect:sa,onReorder:aa,onRename:L,onDuplicate:oa,onDelete:ra,onAdd:Rn}),ce?n.jsx(Ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:n.jsx("div",{className:"mx-auto max-w-2xl",children:Tt&&_?n.jsx(Tr,{rawSeo:Yt,innerSeo:fn,defaultResolveType:Rs,seoSchema:Ds,activeResolveType:Jt,seoTypeOptions:Ns,formResetKey:Ie,siteDefaultSeo:Vs,onBreadcrumbChange:Le,onPersistRaw:ua,onInnerChange:ca,onClearForm:da,onBumpFormKey:ma}):n.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"SEO schema not found for this site."})})})}):jt?n.jsxs(Ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ct&<.length>0&&n.jsxs(n.Fragment,{children:[n.jsx($a,{listKey:`${_??""}:${c??""}`,variants:lt.map((t,s)=>({index:s,label:t.label})),selectedIndex:en,onSelect:Fs,onRename:F,onDuplicate:zs,onDelete:Is,onRemoveAll:Us,onReorder:Hs,onAdd:()=>Zt()}),ct&&n.jsxs("div",{className:"px-3 py-3 border-b space-y-2",children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),n.jsx(Tn,{currentRt:Ce??"",currentLabel:Bt(Kt?.rule,o??{},et,i??void 0),currentGlobalKey:wt(Kt?.rule,o??{},i??void 0)??void 0,matchers:Mt,globals:Sn,onSelect:Qs,onSelectGlobal:Zs}),wn&&R&&n.jsx("div",{className:"pt-1",children:n.jsx(Fn,{schema:wn,value:R,onChange:Xs,meta:i??void 0,decofile:o,onSaveReferencedBlock:Vt,sandbox:At},`${c??"none"}:${en}:${Ce??""}`)})]})]}),n.jsx(In,{activeSchema:Qt,formValue:de,formResetKey:_e,onFormChange:gn,onBreadcrumbChange:A,breadcrumbPath:fe,emptyMessage:"No editable fields for this variant.",meta:i,decofile:o,onSaveReferencedBlock:Vt,sandbox:At})]}):ke?n.jsx(Ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx(In,{activeSchema:Qt,formValue:de,formResetKey:_e,onFormChange:gn,onBreadcrumbChange:A,breadcrumbPath:fe,emptyMessage:"No editable fields for this global block.",meta:i,decofile:o,onSaveReferencedBlock:Vt,sandbox:At})}):n.jsxs(Ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[Pt&&re!==null&&n.jsxs("div",{className:Pe("px-3 border-b",q?"pt-3 pb-5 space-y-3":"py-2"),children:[n.jsxs("button",{type:"button",onClick:()=>ie(t=>!t),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":q,children:[n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),q?n.jsx(ir,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(rr,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),q&&n.jsxs("div",{className:Pe("space-y-3",xt&&"pointer-events-none opacity-50"),children:[n.jsx(Tn,{currentRt:re,currentLabel:Bt(tt?.rule,o??{},et,i??void 0),currentGlobalKey:wt(tt?.rule,o??{},i??void 0)??void 0,matchers:Mt,globals:Sn,onSelect:qs,onSelectGlobal:Js}),bn&&we&&n.jsx("div",{className:"space-y-3",children:n.jsx(Fn,{schema:bn,value:we,onChange:Ys,meta:i??void 0,decofile:o,onSaveReferencedBlock:Vt,sandbox:At},`${De}:${re??""}`)})]})]}),n.jsx("div",{className:"p-2 pt-3",children:n.jsx(qr,{listKey:`${_??""}-${De}`,rawSections:Y,sections:Te,meta:i,selectedIndex:c,onSelect:Ps,onReorder:Ms,onDelete:Es,onDuplicate:Ks,onMakeReusable:ae,onToggleHidden:$s,onToggleLazy:Os,onAddVariant:Zt,onDetach:Bs,onAddSection:()=>ve(!0),canAddSection:Ws})})]}),n.jsx(Oa,{open:ge!==null,onOpenChange:t=>{t||ae(null)},defaultBlockId:ge!==null?sn(Te[ge]?.label??""):"",isPending:je.isPending,onSubmit:Gs}),d&&n.jsx(Er,{open:le,onOpenChange:ve,meta:i,decofile:o,previewBaseUrl:d,onSelect:Ls}),ye&&_&&o&&n.jsx(Ba,{open:ye,onOpenChange:I,pageKey:_,decofile:o}),X!==null&&n.jsx(Bn,{open:!0,initialName:bt($e[X]?.rule,o??{},i??void 0)?Bt($e[X]?.rule,o??{},et,i??void 0):"",autoLabel:et(Rt($e[X]?.rule,o??{},i??void 0)),isPending:xt,onSubmit:async t=>{await ia(X,t)},onOpenChange:t=>{!t&&!xt&&L(null)}}),O!==null&&n.jsx(Bn,{open:!0,initialName:bt(lt[O]?.rule,o??{},i??void 0)?Bt(lt[O]?.rule,o??{},et,i??void 0):"",autoLabel:et(Rt(lt[O]?.rule,o??{},i??void 0)),isPending:xt,onSubmit:async t=>{await la(O,t)},onOpenChange:t=>{!t&&!xt&&F(null)}})]})}export{Hl as SectionsEditor};
|